@jsonforms/material-renderers 3.0.0-beta.1 → 3.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -13
- package/docs/globals.html +55 -85
- package/docs/index.html +70 -13
- package/docs/interfaces/emptytableprops.html +1 -1
- package/docs/interfaces/nonemptycellcomponentprops.html +9 -9
- package/docs/interfaces/nonemptycellprops.html +9 -9
- package/docs/interfaces/ownoneofprops.html +1 -1
- package/docs/interfaces/ownpropsofnonemptycell.html +6 -6
- package/docs/interfaces/tableheadercellprops.html +1 -1
- package/lib/additional/MaterialListWithDetailRenderer.d.ts +1 -1
- package/lib/jsonforms-react-material.cjs.js +20 -28
- package/lib/jsonforms-react-material.cjs.js.map +1 -1
- package/lib/jsonforms-react-material.esm.js +19 -27
- package/lib/jsonforms-react-material.esm.js.map +1 -1
- package/lib/layouts/MaterialArrayLayoutRenderer.d.ts +1 -1
- package/package.json +8 -6
- package/src/additional/MaterialListWithDetailRenderer.tsx +5 -3
- package/src/complex/MaterialAllOfRenderer.tsx +3 -5
- package/src/complex/MaterialAnyOfRenderer.tsx +3 -5
- package/src/complex/MaterialEnumArrayRenderer.tsx +1 -2
- package/src/complex/MaterialObjectRenderer.tsx +3 -8
- package/src/complex/MaterialOneOfRenderer.tsx +3 -5
- package/src/complex/MaterialTableControl.tsx +6 -6
- package/src/layouts/ExpandPanelRenderer.tsx +2 -1
- package/src/layouts/MaterialArrayLayoutRenderer.tsx +3 -25
- package/stats.html +1 -1
- package/test/renderers/MaterialAnyOfStringOrEnumControl.test.tsx +7 -7
- package/test/renderers/MaterialArrayLayout.test.tsx +66 -8
- package/test/renderers/MaterialBooleanCell.test.tsx +10 -7
- package/test/renderers/MaterialBooleanToggleCell.test.tsx +14 -9
- package/test/renderers/MaterialBooleanToggleControl.test.tsx +14 -9
- package/test/renderers/MaterialCategorizationLayout.test.tsx +12 -12
- package/test/renderers/MaterialCategorizationStepperLayout.test.tsx +12 -12
- package/test/renderers/MaterialDateCell.test.tsx +10 -7
- package/test/renderers/MaterialDateControl.test.tsx +12 -8
- package/test/renderers/MaterialDateTimeControl.test.tsx +12 -8
- package/test/renderers/MaterialEnumArrayRenderer.test.tsx +9 -7
- package/test/renderers/MaterialEnumCell.test.tsx +2 -1
- package/test/renderers/MaterialEnumControl.test.tsx +75 -0
- package/test/renderers/MaterialIntegerCell.test.tsx +10 -7
- package/test/renderers/MaterialLabelRenderer.test.tsx +4 -4
- package/test/renderers/MaterialListWithDetailRenderer.test.tsx +5 -5
- package/test/renderers/MaterialNumberCell.test.tsx +10 -7
- package/test/renderers/MaterialObjectControl.test.tsx +10 -7
- package/test/renderers/MaterialOneOfEnumCell.test.tsx +2 -1
- package/test/renderers/MaterialOneOfRadioGroupControl.test.tsx +3 -2
- package/test/renderers/MaterialOneOfRenderer.test.tsx +12 -7
- package/test/renderers/MaterialRadioGroupControl.test.tsx +2 -2
- package/test/renderers/MaterialSliderControl.test.tsx +20 -12
- package/test/renderers/MaterialTextCell.test.tsx +10 -7
- package/test/renderers/MaterialTimeCell.test.tsx +10 -7
- package/test/renderers/MaterialTimeControl.test.tsx +12 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ArrayLayoutProps, RankedTester } from '@jsonforms/core';
|
|
3
|
-
export declare const MaterialArrayLayoutRenderer: ({ visible,
|
|
3
|
+
export declare const MaterialArrayLayoutRenderer: ({ visible, addItem, ...props }: ArrayLayoutProps) => JSX.Element;
|
|
4
4
|
export declare const materialArrayLayoutTester: RankedTester;
|
|
5
5
|
declare const _default: React.ComponentType<import("@jsonforms/core").OwnPropsOfControl>;
|
|
6
6
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsonforms/material-renderers",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.4",
|
|
4
4
|
"description": "Material Renderer Set for JSON Forms",
|
|
5
5
|
"repository": "https://github.com/eclipsesource/jsonforms",
|
|
6
6
|
"bugs": "https://github.com/eclipsesource/jsonforms/issues",
|
|
@@ -74,8 +74,10 @@
|
|
|
74
74
|
"dayjs": "1.10.6"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@
|
|
78
|
-
"@
|
|
77
|
+
"@emotion/react": "^11.4.1",
|
|
78
|
+
"@emotion/styled": "^11.3.0",
|
|
79
|
+
"@jsonforms/core": "3.0.0-beta.4",
|
|
80
|
+
"@jsonforms/react": "3.0.0-beta.4",
|
|
79
81
|
"@mui/icons-material": "^5.0.0",
|
|
80
82
|
"@mui/lab": "^5.0.0-alpha.54",
|
|
81
83
|
"@mui/material": "^5.0.0"
|
|
@@ -83,8 +85,8 @@
|
|
|
83
85
|
"devDependencies": {
|
|
84
86
|
"@emotion/react": "^11.5.0",
|
|
85
87
|
"@emotion/styled": "^11.3.0",
|
|
86
|
-
"@jsonforms/core": "^3.0.0-beta.
|
|
87
|
-
"@jsonforms/react": "^3.0.0-beta.
|
|
88
|
+
"@jsonforms/core": "^3.0.0-beta.4",
|
|
89
|
+
"@jsonforms/react": "^3.0.0-beta.4",
|
|
88
90
|
"@mui/icons-material": "^5.2.0",
|
|
89
91
|
"@mui/lab": "^5.0.0-alpha.58",
|
|
90
92
|
"@mui/material": "^5.2.2",
|
|
@@ -112,5 +114,5 @@
|
|
|
112
114
|
"webpack-cli": "^3.2.1",
|
|
113
115
|
"webpack-dev-server": "^3.9.0"
|
|
114
116
|
},
|
|
115
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "413b9767ea8e2c0b6adb3919f5e6b76263d4be31"
|
|
116
118
|
}
|
|
@@ -60,7 +60,8 @@ export const MaterialListWithDetailRenderer = ({
|
|
|
60
60
|
data,
|
|
61
61
|
renderers,
|
|
62
62
|
cells,
|
|
63
|
-
config
|
|
63
|
+
config,
|
|
64
|
+
rootSchema
|
|
64
65
|
}: ArrayLayoutProps) => {
|
|
65
66
|
const [selectedIndex, setSelectedIndex] = useState(undefined);
|
|
66
67
|
const handleRemoveItem = useCallback(
|
|
@@ -90,9 +91,10 @@ export const MaterialListWithDetailRenderer = ({
|
|
|
90
91
|
uischema.scope,
|
|
91
92
|
path,
|
|
92
93
|
undefined,
|
|
93
|
-
uischema
|
|
94
|
+
uischema,
|
|
95
|
+
rootSchema
|
|
94
96
|
),
|
|
95
|
-
[uischemas, schema, uischema.scope, path, uischema]
|
|
97
|
+
[uischemas, schema, uischema.scope, path, uischema, rootSchema]
|
|
96
98
|
);
|
|
97
99
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
98
100
|
|
|
@@ -32,7 +32,6 @@ import {
|
|
|
32
32
|
JsonSchema,
|
|
33
33
|
RankedTester,
|
|
34
34
|
rankWith,
|
|
35
|
-
resolveSubSchemas,
|
|
36
35
|
StatePropsOfCombinator
|
|
37
36
|
} from '@jsonforms/core';
|
|
38
37
|
import { JsonFormsDispatch, withJsonFormsAllOfProps } from '@jsonforms/react';
|
|
@@ -47,9 +46,8 @@ export const MaterialAllOfRenderer = ({
|
|
|
47
46
|
uischemas,
|
|
48
47
|
uischema
|
|
49
48
|
}: StatePropsOfCombinator) => {
|
|
50
|
-
const _schema = resolveSubSchemas(schema, rootSchema, 'allOf');
|
|
51
49
|
const delegateUISchema = findMatchingUISchema(uischemas)(
|
|
52
|
-
|
|
50
|
+
schema,
|
|
53
51
|
uischema.scope,
|
|
54
52
|
path
|
|
55
53
|
);
|
|
@@ -57,7 +55,7 @@ export const MaterialAllOfRenderer = ({
|
|
|
57
55
|
return (
|
|
58
56
|
<Hidden xsUp={!visible}>
|
|
59
57
|
<JsonFormsDispatch
|
|
60
|
-
schema={
|
|
58
|
+
schema={schema}
|
|
61
59
|
uischema={delegateUISchema}
|
|
62
60
|
path={path}
|
|
63
61
|
renderers={renderers}
|
|
@@ -67,7 +65,7 @@ export const MaterialAllOfRenderer = ({
|
|
|
67
65
|
);
|
|
68
66
|
}
|
|
69
67
|
const allOfRenderInfos = createCombinatorRenderInfos(
|
|
70
|
-
(
|
|
68
|
+
(schema as JsonSchema).allOf,
|
|
71
69
|
rootSchema,
|
|
72
70
|
'allOf',
|
|
73
71
|
uischema,
|
|
@@ -30,7 +30,6 @@ import {
|
|
|
30
30
|
JsonSchema,
|
|
31
31
|
RankedTester,
|
|
32
32
|
rankWith,
|
|
33
|
-
resolveSubSchemas,
|
|
34
33
|
StatePropsOfCombinator
|
|
35
34
|
} from '@jsonforms/core';
|
|
36
35
|
import { JsonFormsDispatch, withJsonFormsAnyOfProps } from '@jsonforms/react';
|
|
@@ -54,9 +53,8 @@ export const MaterialAnyOfRenderer = ({
|
|
|
54
53
|
[setSelectedAnyOf]
|
|
55
54
|
);
|
|
56
55
|
const anyOf = 'anyOf';
|
|
57
|
-
const _schema = resolveSubSchemas(schema, rootSchema, anyOf);
|
|
58
56
|
const anyOfRenderInfos = createCombinatorRenderInfos(
|
|
59
|
-
(
|
|
57
|
+
(schema as JsonSchema).anyOf,
|
|
60
58
|
rootSchema,
|
|
61
59
|
anyOf,
|
|
62
60
|
uischema,
|
|
@@ -67,8 +65,8 @@ export const MaterialAnyOfRenderer = ({
|
|
|
67
65
|
return (
|
|
68
66
|
<Hidden xsUp={!visible}>
|
|
69
67
|
<CombinatorProperties
|
|
70
|
-
schema={
|
|
71
|
-
combinatorKeyword={
|
|
68
|
+
schema={schema}
|
|
69
|
+
combinatorKeyword={anyOf}
|
|
72
70
|
path={path}
|
|
73
71
|
/>
|
|
74
72
|
<Tabs value={selectedAnyOf} onChange={handleChange}>
|
|
@@ -22,7 +22,6 @@ import {
|
|
|
22
22
|
FormHelperText,
|
|
23
23
|
Hidden
|
|
24
24
|
} from '@mui/material';
|
|
25
|
-
import startCase from 'lodash/startCase';
|
|
26
25
|
import isEmpty from 'lodash/isEmpty';
|
|
27
26
|
import React from 'react';
|
|
28
27
|
|
|
@@ -68,7 +67,7 @@ export const MaterialEnumArrayRenderer = ({
|
|
|
68
67
|
{...otherProps}
|
|
69
68
|
/>
|
|
70
69
|
}
|
|
71
|
-
label={
|
|
70
|
+
label={option.label}
|
|
72
71
|
/>
|
|
73
72
|
);
|
|
74
73
|
})}
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
import isEmpty from 'lodash/isEmpty';
|
|
26
26
|
import {
|
|
27
27
|
findUISchema,
|
|
28
|
-
|
|
28
|
+
Generate,
|
|
29
29
|
isObjectControl,
|
|
30
30
|
RankedTester,
|
|
31
31
|
rankWith,
|
|
@@ -54,17 +54,12 @@ export const MaterialObjectRenderer = ({
|
|
|
54
54
|
schema,
|
|
55
55
|
uischema.scope,
|
|
56
56
|
path,
|
|
57
|
-
'Group',
|
|
57
|
+
() => isEmpty(path) ? Generate.uiSchema(schema, 'VerticalLayout') : {...Generate.uiSchema(schema, 'Group'), label},
|
|
58
58
|
uischema,
|
|
59
59
|
rootSchema
|
|
60
60
|
),
|
|
61
|
-
[uischemas, schema, uischema.scope, path, uischema, rootSchema]
|
|
61
|
+
[uischemas, schema, uischema.scope, path, label, uischema, rootSchema]
|
|
62
62
|
);
|
|
63
|
-
if (isEmpty(path)) {
|
|
64
|
-
detailUiSchema.type = 'VerticalLayout';
|
|
65
|
-
} else {
|
|
66
|
-
(detailUiSchema as GroupLayout).label = label;
|
|
67
|
-
}
|
|
68
63
|
return (
|
|
69
64
|
<Hidden xsUp={!visible}>
|
|
70
65
|
<JsonFormsDispatch
|
|
@@ -34,7 +34,6 @@ import {
|
|
|
34
34
|
OwnPropsOfControl,
|
|
35
35
|
RankedTester,
|
|
36
36
|
rankWith,
|
|
37
|
-
resolveSubSchemas
|
|
38
37
|
} from '@jsonforms/core';
|
|
39
38
|
import {
|
|
40
39
|
Button,
|
|
@@ -66,9 +65,8 @@ export const MaterialOneOfRenderer =
|
|
|
66
65
|
const cancel = useCallback(() => {
|
|
67
66
|
setOpen(false);
|
|
68
67
|
}, [setOpen]);
|
|
69
|
-
const _schema = resolveSubSchemas(schema, rootSchema, 'oneOf');
|
|
70
68
|
const oneOfRenderInfos = createCombinatorRenderInfos(
|
|
71
|
-
(
|
|
69
|
+
(schema as JsonSchema).oneOf,
|
|
72
70
|
rootSchema,
|
|
73
71
|
'oneOf',
|
|
74
72
|
uischema,
|
|
@@ -79,7 +77,7 @@ export const MaterialOneOfRenderer =
|
|
|
79
77
|
const openNewTab = (newIndex: number) => {
|
|
80
78
|
handleChange(
|
|
81
79
|
path,
|
|
82
|
-
createDefaultValue(
|
|
80
|
+
createDefaultValue(oneOfRenderInfos[newIndex].schema)
|
|
83
81
|
);
|
|
84
82
|
setSelectedIndex(newIndex);
|
|
85
83
|
}
|
|
@@ -101,7 +99,7 @@ export const MaterialOneOfRenderer =
|
|
|
101
99
|
return (
|
|
102
100
|
<Hidden xsUp={!visible}>
|
|
103
101
|
<CombinatorProperties
|
|
104
|
-
schema={
|
|
102
|
+
schema={schema}
|
|
105
103
|
combinatorKeyword={'oneOf'}
|
|
106
104
|
path={path}
|
|
107
105
|
/>
|
|
@@ -53,7 +53,8 @@ import {
|
|
|
53
53
|
Paths,
|
|
54
54
|
Resolve,
|
|
55
55
|
JsonFormsRendererRegistryEntry,
|
|
56
|
-
JsonFormsCellRendererRegistryEntry
|
|
56
|
+
JsonFormsCellRendererRegistryEntry,
|
|
57
|
+
encode
|
|
57
58
|
} from '@jsonforms/core';
|
|
58
59
|
import DeleteIcon from '@mui/icons-material/Delete';
|
|
59
60
|
import ArrowDownward from '@mui/icons-material/ArrowDownward';
|
|
@@ -206,18 +207,17 @@ interface NonEmptyCellComponentProps {
|
|
|
206
207
|
cells?: JsonFormsCellRendererRegistryEntry[],
|
|
207
208
|
isValid: boolean
|
|
208
209
|
}
|
|
209
|
-
const NonEmptyCellComponent = React.memo(({path, propName, schema,rootSchema, errors, enabled, renderers, cells, isValid}:NonEmptyCellComponentProps) => {
|
|
210
|
-
|
|
210
|
+
const NonEmptyCellComponent = React.memo(({path, propName, schema, rootSchema, errors, enabled, renderers, cells, isValid}:NonEmptyCellComponentProps) => {
|
|
211
211
|
return (
|
|
212
212
|
<NoBorderTableCell>
|
|
213
213
|
{schema.properties ? (
|
|
214
214
|
<DispatchCell
|
|
215
215
|
schema={Resolve.schema(
|
|
216
216
|
schema,
|
|
217
|
-
`#/properties/${propName}`,
|
|
217
|
+
`#/properties/${encode(propName)}`,
|
|
218
218
|
rootSchema
|
|
219
219
|
)}
|
|
220
|
-
uischema={controlWithoutLabel(`#/properties/${propName}`)}
|
|
220
|
+
uischema={controlWithoutLabel(`#/properties/${encode(propName)}`)}
|
|
221
221
|
path={path}
|
|
222
222
|
enabled={enabled}
|
|
223
223
|
renderers={renderers}
|
|
@@ -370,7 +370,7 @@ const TableRows = ({
|
|
|
370
370
|
moveDownCreator={moveDown}
|
|
371
371
|
enableUp={index !== 0}
|
|
372
372
|
enableDown={index !== data - 1}
|
|
373
|
-
showSortButtons={appliedUiSchemaOptions.showSortButtons}
|
|
373
|
+
showSortButtons={appliedUiSchemaOptions.showSortButtons || appliedUiSchemaOptions.showArrayTableSortButtons}
|
|
374
374
|
enabled={enabled}
|
|
375
375
|
cells={cells}
|
|
376
376
|
path={path}
|
|
@@ -119,6 +119,7 @@ const ExpandPanelRendererComponent = (props: ExpandPanelProps) => {
|
|
|
119
119
|
);
|
|
120
120
|
|
|
121
121
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
122
|
+
const showSortButtons = appliedUiSchemaOptions.showSortButtons || appliedUiSchemaOptions.showArrayLayoutSortButtons;
|
|
122
123
|
|
|
123
124
|
return (
|
|
124
125
|
<Accordion
|
|
@@ -147,7 +148,7 @@ const ExpandPanelRendererComponent = (props: ExpandPanelProps) => {
|
|
|
147
148
|
justifyContent='center'
|
|
148
149
|
alignItems='center'
|
|
149
150
|
>
|
|
150
|
-
{
|
|
151
|
+
{showSortButtons ? (
|
|
151
152
|
<Fragment>
|
|
152
153
|
<Grid item>
|
|
153
154
|
<IconButton
|
|
@@ -36,19 +36,8 @@ import { withJsonFormsArrayLayoutProps } from '@jsonforms/react';
|
|
|
36
36
|
|
|
37
37
|
export const MaterialArrayLayoutRenderer = ({
|
|
38
38
|
visible,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
uischema,
|
|
42
|
-
schema,
|
|
43
|
-
label,
|
|
44
|
-
rootSchema,
|
|
45
|
-
renderers,
|
|
46
|
-
cells,
|
|
47
|
-
data,
|
|
48
|
-
path,
|
|
49
|
-
errors,
|
|
50
|
-
uischemas,
|
|
51
|
-
addItem
|
|
39
|
+
addItem,
|
|
40
|
+
...props
|
|
52
41
|
}: ArrayLayoutProps) => {
|
|
53
42
|
const addItemCb = useCallback((p: string, value: any) => addItem(p, value), [
|
|
54
43
|
addItem
|
|
@@ -56,20 +45,9 @@ export const MaterialArrayLayoutRenderer = ({
|
|
|
56
45
|
return (
|
|
57
46
|
<Hidden xsUp={!visible}>
|
|
58
47
|
<MaterialArrayLayout
|
|
59
|
-
label={label}
|
|
60
|
-
uischema={uischema}
|
|
61
|
-
schema={schema}
|
|
62
|
-
id={id}
|
|
63
|
-
rootSchema={rootSchema}
|
|
64
|
-
errors={errors}
|
|
65
|
-
enabled={enabled}
|
|
66
48
|
visible={visible}
|
|
67
|
-
data={data}
|
|
68
|
-
path={path}
|
|
69
49
|
addItem={addItemCb}
|
|
70
|
-
|
|
71
|
-
cells={cells}
|
|
72
|
-
uischemas={uischemas}
|
|
50
|
+
{...props}
|
|
73
51
|
/>
|
|
74
52
|
</Hidden>
|
|
75
53
|
);
|