feat: dependent fields (#839)
This commit is contained in:
committed by
GitHub
parent
0dc7576bb4
commit
654263dd6f
@ -15,7 +15,7 @@ weight: 9
|
||||
| icon | string | | _Optional_. Unique name of icon to use in main menu. See [custom icons](/docs/custom-icons) |
|
||||
| description | string | | _Optional_. Text displayed below the label when viewing a collection |
|
||||
| files or folder | [Collection Files](/docs/collection-types#file-collections)<br />\| [Collection Folder](/docs/collection-types#folder-collections) | | **Requires one of these**: Specifies the collection type and location; details in [collection types](/docs/collection-types) |
|
||||
| filter | FilterRule<br />\| List of FilterRules | | _Optional_. Field and file filter for [Folder Collections](/docs/collection-types#folder-collections). See [filtered folder collections](/docs/collection-types#filtered-folder-collections) |
|
||||
| filter | FilterRule<br />\| List of FilterRules | | _Optional_. Field and file filter for [Folder Collections](/docs/collection-types#folder-collections). See [filtered folder collections](/docs/collection-types#filtered-folder-collections) |
|
||||
| create | boolean | `false` | _Optional_. **For [Folder Collections](/docs/collection-types#folder-collections) only**<br />`true` - Allows users to create new items in the collection |
|
||||
| hide | boolean | `false` | _Optional_. `true` hides a collection in the Static CMS UI. Useful when using the relation widget to hide referenced collections |
|
||||
| delete | boolean | `true` | _Optional_. `false` prevents users from deleting items in a collection |
|
||||
|
@ -103,7 +103,7 @@ collections: [
|
||||
|
||||
</CodeTabs>
|
||||
|
||||
### Filtered folder collections
|
||||
### Filtered Folder Collections
|
||||
|
||||
The entries for any folder collection can be filtered based on the values of the fields or on file names. By filtering a folder into different collections, you can manage files with different fields, options, extensions, etc. in the same folder.
|
||||
|
||||
|
@ -30,22 +30,35 @@ To see working examples of all of the built-in widgets, try making a 'Kitchen Si
|
||||
| [Select](/docs/widget-select) | The select widget allows you to pick a string value from a dropdown menu |
|
||||
| [String](/docs/widget-string) | The string widget translates a basic text input to a string value |
|
||||
| [Text](/docs/widget-text) | The text widget takes a multiline text field and saves it as a string |
|
||||
| [UUID](/docs/widget-uuid) | The uuid widget generates a unique id (uuid) and saves it as a string |
|
||||
| [UUID](/docs/widget-uuid) | The uuid widget generates a unique id (uuid) and saves it as a string |
|
||||
|
||||
## Common widget options
|
||||
|
||||
The following options are available on all fields:
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| -------- | ----------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| name | string | | The name of the field |
|
||||
| widget | string | `'string'` | _Optional_. The type of widget to render for the field |
|
||||
| label | string | `name` | _Optional_. The display name of the field |
|
||||
| required | boolean | `true` | _Optional_. Specify as `false` to make a field optional |
|
||||
| hint | string | | _Optional_. Adds helper text directly below a widget. Useful for including instructions. Accepts markdown for bold, italic, strikethrough, and links. |
|
||||
| pattern | list of strings | | _Optional_. Adds field validation by specifying a list with a [regex pattern](https://regexr.com/) and an error message; more extensive validation can be achieved with [custom widgets](/docs/custom-widgets/#advanced-field-validation) |
|
||||
| i18n | boolean<br />\|'translate'<br />\|'duplicate'<br />\|'none' | | _Optional_. <BetaImage /><ul><li>`translate` - Allows translation of the field</li><li>`duplicate` - Duplicates the value from the default locale</li><li>`true` - Accept parent values as default</li><li>`none` or `false` - Exclude field from translations</li></ul> |
|
||||
| comment | string | | _Optional_. Adds comment before the field (only supported for yaml) |
|
||||
| Name | Type | Default | Description |
|
||||
| --------- | -------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| name | string | | The name of the field |
|
||||
| widget | string | `'string'` | _Optional_. The type of widget to render for the field |
|
||||
| label | string | `name` | _Optional_. The display name of the field |
|
||||
| required | boolean | `true` | _Optional_. Specify as `false` to make a field optional |
|
||||
| hint | string | | _Optional_. Adds helper text directly below a widget. Useful for including instructions. Accepts markdown for bold, italic, strikethrough, and links. |
|
||||
| pattern | list of strings | | _Optional_. Adds field validation by specifying a list with a [regex pattern](https://regexr.com/) and an error message; more extensive validation can be achieved with [custom widgets](/docs/custom-widgets/#advanced-field-validation) |
|
||||
| i18n | boolean<br />\| 'translate'<br />\| 'duplicate'<br />\| 'none' | | _Optional_. <BetaImage /><ul><li>`translate` - Allows translation of the field</li><li>`duplicate` - Duplicates the value from the default locale</li><li>`true` - Accept parent values as default</li><li>`none` or `false` - Exclude field from translations</li></ul> |
|
||||
| condition | FilterRule<br />\| List of FilterRules | | _Optional_. See [Field Conditions](#field-conditions) |
|
||||
|
||||
## Field Conditions
|
||||
|
||||
The fields can be shown conditionally based on the values of the other fields.
|
||||
|
||||
The `condition` option can take a single filter rule or a list of filter rules.
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| -------- | ------------------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| field | string | | The name of one of the field. |
|
||||
| value | string<br />\| list of strings | | _Optional_. The desired value or values to match. Required if no `pattern` provided. Ignored if `pattern` is provided |
|
||||
| pattern | regular expression | | _Optional_. A regex pattern to match against the field's value |
|
||||
| matchAll | boolean | `false` | _Optional_. _Ignored if value is not a list of strings_<br /><ul><li>`true` - The field's values must include or match all of the filter rule's values</li><li>`false` - The field's value must include or match only one of the filter rule's values</li></ul> |
|
||||
|
||||
## Example
|
||||
|
||||
|
Reference in New Issue
Block a user