feat(widget-object): add collapsed option to collapse object by default (#3606)
This commit is contained in:
parent
99071c14e4
commit
9f17363bee
@ -124,6 +124,7 @@ collections: # A list of collections the CMS should be able to edit
|
|||||||
- label: 'Object'
|
- label: 'Object'
|
||||||
name: 'object'
|
name: 'object'
|
||||||
widget: 'object'
|
widget: 'object'
|
||||||
|
collapsed: true
|
||||||
fields:
|
fields:
|
||||||
- label: 'Related Post'
|
- label: 'Related Post'
|
||||||
name: 'post'
|
name: 'post'
|
||||||
|
@ -42,7 +42,7 @@ export default class ObjectControl extends React.Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
collapsed: false,
|
collapsed: props.field.get('collapsed', false),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ The object widget allows you to group multiple widgets together, nested under a
|
|||||||
- **Data type:** list of child widget values
|
- **Data type:** list of child widget values
|
||||||
- **Options:**
|
- **Options:**
|
||||||
- `default`: you can set defaults within each sub-field's configuration
|
- `default`: you can set defaults within each sub-field's configuration
|
||||||
|
- `collapsed`: if added and labeled `true`, the widget's content is collapsed by default
|
||||||
- `fields`: (**required**) a nested list of widget fields to include in your widget
|
- `fields`: (**required**) a nested list of widget fields to include in your widget
|
||||||
- **Example:**
|
- **Example:**
|
||||||
```yaml
|
```yaml
|
||||||
@ -27,6 +28,7 @@ The object widget allows you to group multiple widgets together, nested under a
|
|||||||
- label: "Address"
|
- label: "Address"
|
||||||
name: "address"
|
name: "address"
|
||||||
widget: "object"
|
widget: "object"
|
||||||
|
collapsed: true
|
||||||
fields:
|
fields:
|
||||||
- {label: "Street Address", name: "street", widget: "string"}
|
- {label: "Street Address", name: "street", widget: "string"}
|
||||||
- {label: "City", name: "city", widget: "string"}
|
- {label: "City", name: "city", widget: "string"}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user