|
1 | | -import { Meta, Canvas } from '@storybook/addon-docs'; |
2 | | -import { JsonForm } from '@sagold/react-json-editor'; |
3 | 1 | import * as ArrayItems from './ArrayItems.stories'; |
| 2 | +import { JsonForm } from '@sagold/react-json-editor'; |
| 3 | +import { Markdown } from '@storybook/blocks'; |
| 4 | +import { Meta, Canvas } from '@storybook/addon-docs'; |
| 5 | +import { Tabs } from './components/Tabs'; |
4 | 6 |
|
5 | 7 | <Meta title="ArrayItems" /> |
6 | 8 |
|
7 | 9 | # Array Items |
8 | 10 |
|
9 | | -> _json-schema_ has a set of definitions for array items. This section details how those definitions transfer to a user interface build with _@sagold/react-json-editor_ and its default widgets. |
10 | | -
|
11 | | -Validation of data is fully supported, the following list tracks support of the user interface: |
12 | | - |
13 | | -| Status | Feature | Comments | |
14 | | -| :----: | :------------------------------------ | :------------------------------------------------- | |
15 | | -| ✅ | [items array-schema](#array-schema) | defined set of array items | |
16 | | -| ❎ | [additionalItems](#additional-items) | ui does not support adding arbitrary data | |
17 | | -| ✅ | [items object-schema](#object-schema) | object schema for child-items | |
18 | | -| ✅ | [items oneOf](#one-of) | |
19 | | -| ✅ | [length](#length) | support for **minItems** and **maxItems** | |
20 | | -| ✅ | [if-then-else](#if-then-else) | |
21 | | -| ❌ | enum | only supported by validation not by user interface | |
22 | | -| ✅ | [not](#not) | validation only, exlude specific item types | |
23 | | -| ✅ | [uniqueItems](#uniqueitems) | validation only, exclude redundant items | |
24 | | -| ✅ | [contains](#contains) | validation only, ensure a specific item is present | |
| 11 | +> _json-schema_ has a set of definitions for array items. This section details how those definitions transfer to a user |
| 12 | +> interface build with _@sagold/react-json-editor_ and _@sagold/rje-mantine-widgets_. |
| 13 | +
|
| 14 | +Validation of data is fully supported, the following list tracks support by the user interface: |
| 15 | + |
| 16 | +<Markdown> |
| 17 | + {` |
| 18 | + | Status | Feature | draft | Comments | |
| 19 | + | :----: | :------------------------------------ | :--: | :---------------------------------------------------- | |
| 20 | + | ❎ | [additionalItems](#additional-items) | <= 2019-09 | ui does not support adding arbitrary data | |
| 21 | + | ✅ | [contains](#contains) | * | validation only, ensure a specific item is present | |
| 22 | + | ❌ | enum | * | only supported by validation not by user interface | |
| 23 | + | ✅ | [items object-schema](#object-schema) | * | object schema for child-items | |
| 24 | + | ✅ | [items oneOf](#one-of) | * | |
| 25 | + | ✅ | [items array-schema](#array-schema) | <= 2019-09 | defined set of array items | |
| 26 | + | ✅ | [prefixItems](#array-schema) | >= 2020-12 | defined set of array items | |
| 27 | + | ✅ | [if-then-else](#if-then-else) | * | |
| 28 | + | ✅ | [length](#length) | * | support for **minItems** and **maxItems** | |
| 29 | + | ✅ | [not](#not) | * | validation only, exlude specific item types | |
| 30 | + | ✅ | [uniqueItems](#uniqueitems) | * | validation only, exclude redundant items | |
| 31 | + `} |
| 32 | +</Markdown> |
25 | 33 |
|
26 | 34 | ## Array Schema |
27 | 35 |
|
28 | | -Fixed number and schema of array items |
| 36 | +Using array-items schema you define a JSON Schema for a fixed numer of array items. With no additional items defined, |
| 37 | +item edit options are disabled. |
29 | 38 |
|
30 | | -<Canvas className="inline" of={ArrayItems.ItemsArray} /> |
| 39 | +<Tabs> |
| 40 | + <Canvas tabTitle="draft-2020-12" className="inline" of={ArrayItems.ItemsArray} /> |
| 41 | + <Canvas tabTitle="draft-2019-09" className="inline" of={ArrayItems.ItemsArrayDraft2019} /> |
| 42 | +</Tabs> |
31 | 43 |
|
32 | 44 | ## additional items |
33 | 45 |
|
|
0 commit comments