docs: update docs about new clearChildValidation prop

This commit is contained in:
Daniel Lautzenheiser 2023-08-31 12:13:43 -04:00
parent e0dadaf817
commit e2d32471ad
2 changed files with 26 additions and 48 deletions

View File

@ -73,6 +73,7 @@ export const createMockWidgetControlProps = <
controlled: false,
theme: 'light',
onChange: jest.fn(),
clearChildValidation: jest.fn(),
query: jest.fn(),
t: jest.fn(),
...extra,

View File

@ -40,10 +40,11 @@ CMS.registerWidget(name, control, [preview], [{ schema }]);
The react component that renders the control. It receives the following props:
| Param | Type | Description |
| ------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| -------------------- | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
| label | string | The label for the widget |
| value | An valid widget value | The current value of the widget |
| onChange | function | Function to be called when the value changes. Accepts a valid widget value |
| clearChildValidation | function | Clears all validation errors for children of the widget |
| field | object | The field configuration for the current widget. See [Widget Options](/docs/widgets#common-widget-options) |
| collection | object | The collection configuration for the current widget. See [Collections](/docs/collection-overview) |
| collectionFile | object | The collection file configuration for the current widget if entry is part of a [File Collection](/docs/collection-types#file-collections) |
@ -59,35 +60,11 @@ The react component that renders the control. It receives the following props:
| duplicate | function | Specifies if that field is an i18n duplicate |
| hidden | function | Specifies if that field should be hidden |
| locale | string<br />\| undefined | The current locale of the editor |
| mediaPaths | object | <Deprecated>Use [useMediaInsert](/docs/custom-widgets#interacting-with-the-media-library) instead. Will be removed in v3.0.0.</Deprecated> Key/value object of control IDs (passed to the media library) mapping to media paths |
| clearMediaControl | function | <Deprecated>Use [useMediaInsert](/docs/custom-widgets#interacting-with-the-media-library) instead. Will be removed in v3.0.0.</Deprecated> Clears a control ID's value from the internal store |
| openMediaLibrary | function | <Deprecated>Use [useMediaInsert](/docs/custom-widgets#interacting-with-the-media-library) instead. Will be removed in v3.0.0.</Deprecated> Opens the media library popup. See [Open Media Library](#open-media-library) |
| removeInsertedMedia | function | <Deprecated>Use [useMediaInsert](/docs/custom-widgets#interacting-with-the-media-library) instead. Will be removed in v3.0.0.</Deprecated> Removes draft media for a give control ID |
| removeMediaControl | function | <Deprecated>Use [useMediaInsert](/docs/custom-widgets#interacting-with-the-media-library) instead. Will be removed in v3.0.0.</Deprecated> Clears a control ID completely from the internal store |
| query | function | Runs a search on another collection. See [Query](#query) |
| i18n | object | The current i18n settings |
| t | function | Translates a given key to the current locale |
| theme | 'light'<br />\| 'dark' | The current theme being used by the app |
#### Open Media Library
<Alert severity="error">
Deprecated. Use [useMediaInsert](/docs/custom-widgets#interacting-with-the-media-library) instead.
Will be removed in v3.0.0.
</Alert>
`openMediaLibrary` allows you to open up the media library popup. It accepts the following props:
| Param | Type | Default | Description |
| ------------- | --------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------ |
| controlID | string | | _Optional_ A unique identifier to which the uploaded media will be linked |
| forImage | boolean | `false` | _Optional_ If `true`, restricts upload to image files only |
| value | string<br />list of strings | | _Optional_ The current selected media value |
| allowMultiple | boolean | | _Optional_ Allow multiple files or images to be uploaded at once. Only used on media libraries that support multi upload |
| replaceIndex | number | | _Optional_ The index of the image in an list. Ignored if ` allowMultiple` is `false` |
| config | object | | _Optional_ Media library config options. Available options depend on the media library being used |
| field | object | | _Optional_ The current field configuration |
#### Query
`query` allows you to search the entries of a given collection. It accepts the following props: