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'
|
||||
name: 'object'
|
||||
widget: 'object'
|
||||
collapsed: true
|
||||
fields:
|
||||
- label: 'Related Post'
|
||||
name: 'post'
|
||||
|
@ -42,7 +42,7 @@ export default class ObjectControl extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
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
|
||||
- **Options:**
|
||||
- `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
|
||||
- **Example:**
|
||||
```yaml
|
||||
@ -27,6 +28,7 @@ The object widget allows you to group multiple widgets together, nested under a
|
||||
- label: "Address"
|
||||
name: "address"
|
||||
widget: "object"
|
||||
collapsed: true
|
||||
fields:
|
||||
- {label: "Street Address", name: "street", widget: "string"}
|
||||
- {label: "City", name: "city", widget: "string"}
|
||||
|
Loading…
x
Reference in New Issue
Block a user