feat(widget-object): add collapsed option to collapse object by default (#3606)

This commit is contained in:
Hannes Küttner 2020-04-15 13:46:09 +02:00 committed by GitHub
parent 99071c14e4
commit 9f17363bee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View File

@ -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'

View File

@ -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),
};
}

View File

@ -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"}