@jsonforms/material-renderers 3.2.0-alpha.2 → 3.2.0-alpha.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/lib/complex/CombinatorProperties.d.ts +1 -0
- package/lib/jsonforms-react-material.cjs.js +15 -16
- package/lib/jsonforms-react-material.cjs.js.map +1 -1
- package/lib/jsonforms-react-material.esm.js +18 -16
- package/lib/jsonforms-react-material.esm.js.map +1 -1
- package/package.json +9 -9
- package/src/additional/MaterialListWithDetailRenderer.tsx +1 -1
- package/src/complex/CombinatorProperties.tsx +5 -2
- package/src/complex/MaterialAnyOfRenderer.tsx +9 -2
- package/src/complex/MaterialObjectRenderer.tsx +5 -2
- package/src/complex/MaterialOneOfRenderer.tsx +5 -1
- package/src/complex/TableToolbar.tsx +2 -1
- package/src/controls/MaterialRadioGroup.tsx +7 -3
- package/src/layouts/MaterialArrayLayout.tsx +1 -1
- package/src/mui-controls/MuiAutocomplete.tsx +1 -1
|
@@ -38,9 +38,9 @@ var MaterialAllOfRenderer$1 = withJsonFormsAllOfProps(MaterialAllOfRenderer);
|
|
|
38
38
|
|
|
39
39
|
class CombinatorProperties extends React.Component {
|
|
40
40
|
render() {
|
|
41
|
-
const { schema, combinatorKeyword, path } = this.props;
|
|
41
|
+
const { schema, combinatorKeyword, path, rootSchema } = this.props;
|
|
42
42
|
const otherProps = omit(schema, combinatorKeyword);
|
|
43
|
-
const foundUISchema = Generate.uiSchema(otherProps, 'VerticalLayout');
|
|
43
|
+
const foundUISchema = Generate.uiSchema(otherProps, 'VerticalLayout', undefined, rootSchema);
|
|
44
44
|
let isLayoutWithElements = false;
|
|
45
45
|
if (foundUISchema !== null && isLayout(foundUISchema)) {
|
|
46
46
|
isLayoutWithElements = foundUISchema.elements.length > 0;
|
|
@@ -70,7 +70,7 @@ const MaterialAnyOfRenderer = ({ handleChange, schema, rootSchema, indexOfFittin
|
|
|
70
70
|
const handleTabChange = useCallback((_event, newIndex) => {
|
|
71
71
|
if (isEmpty(data) ||
|
|
72
72
|
typeof data ===
|
|
73
|
-
typeof createDefaultValue(anyOfRenderInfos[newIndex].schema)) {
|
|
73
|
+
typeof createDefaultValue(anyOfRenderInfos[newIndex].schema, rootSchema)) {
|
|
74
74
|
setSelectedAnyOf(newIndex);
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
@@ -79,7 +79,7 @@ const MaterialAnyOfRenderer = ({ handleChange, schema, rootSchema, indexOfFittin
|
|
|
79
79
|
}
|
|
80
80
|
}, [setConfirmDialogOpen, setSelectedAnyOf, data]);
|
|
81
81
|
const openNewTab = (newIndex) => {
|
|
82
|
-
handleChange(path, createDefaultValue(anyOfRenderInfos[newIndex].schema));
|
|
82
|
+
handleChange(path, createDefaultValue(anyOfRenderInfos[newIndex].schema, rootSchema));
|
|
83
83
|
setSelectedAnyOf(newIndex);
|
|
84
84
|
};
|
|
85
85
|
const confirm = useCallback(() => {
|
|
@@ -89,7 +89,7 @@ const MaterialAnyOfRenderer = ({ handleChange, schema, rootSchema, indexOfFittin
|
|
|
89
89
|
const anyOf = 'anyOf';
|
|
90
90
|
const anyOfRenderInfos = createCombinatorRenderInfos(schema.anyOf, rootSchema, anyOf, uischema, path, uischemas);
|
|
91
91
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
92
|
-
React.createElement(CombinatorProperties, { schema: schema, combinatorKeyword: anyOf, path: path }),
|
|
92
|
+
React.createElement(CombinatorProperties, { schema: schema, combinatorKeyword: anyOf, path: path, rootSchema: rootSchema }),
|
|
93
93
|
React.createElement(Tabs, { value: selectedAnyOf, onChange: handleTabChange }, anyOfRenderInfos.map((anyOfRenderInfo) => (React.createElement(Tab, { key: anyOfRenderInfo.label, label: anyOfRenderInfo.label })))),
|
|
94
94
|
anyOfRenderInfos.map((anyOfRenderInfo, anyOfIndex) => selectedAnyOf === anyOfIndex && (React.createElement(JsonFormsDispatch, { key: anyOfIndex, schema: anyOfRenderInfo.schema, uischema: anyOfRenderInfo.uischema, path: path, renderers: renderers, cells: cells }))),
|
|
95
95
|
React.createElement(TabSwitchConfirmDialog, { cancel: handleClose, confirm: confirm, id: 'anyOf-' + id, open: confirmDialogOpen, handleClose: handleClose })));
|
|
@@ -115,7 +115,7 @@ const fixedCellSmall = {
|
|
|
115
115
|
paddingLeft: 0,
|
|
116
116
|
paddingRight: 0,
|
|
117
117
|
};
|
|
118
|
-
const TableToolbar = React.memo(function TableToolbar({ numColumns, errors, label, path, addItem, schema, enabled, translations, }) {
|
|
118
|
+
const TableToolbar = React.memo(function TableToolbar({ numColumns, errors, label, path, addItem, schema, enabled, translations, rootSchema, }) {
|
|
119
119
|
return (React.createElement(TableRow, null,
|
|
120
120
|
React.createElement(NoBorderTableCell, { colSpan: numColumns },
|
|
121
121
|
React.createElement(Grid, { container: true, justifyContent: 'flex-start', alignItems: 'center', spacing: 2 },
|
|
@@ -125,7 +125,7 @@ const TableToolbar = React.memo(function TableToolbar({ numColumns, errors, labe
|
|
|
125
125
|
React.createElement(ValidationIcon, { id: 'tooltip-validation', errorMessages: errors })))))),
|
|
126
126
|
enabled ? (React.createElement(NoBorderTableCell, { align: 'right', style: fixedCellSmall },
|
|
127
127
|
React.createElement(Tooltip, { id: 'tooltip-add', title: translations.addTooltip, placement: 'bottom' },
|
|
128
|
-
React.createElement(IconButton, { "aria-label": translations.addAriaLabel, onClick: addItem(path, createDefaultValue(schema)), size: 'large' },
|
|
128
|
+
React.createElement(IconButton, { "aria-label": translations.addAriaLabel, onClick: addItem(path, createDefaultValue(schema, rootSchema)), size: 'large' },
|
|
129
129
|
React.createElement(AddIcon, null))))) : null));
|
|
130
130
|
});
|
|
131
131
|
|
|
@@ -331,7 +331,7 @@ const MuiAutocomplete = (props) => {
|
|
|
331
331
|
}, inputValue: inputValue, onInputChange: (_event, newInputValue) => {
|
|
332
332
|
setInputValue(newInputValue);
|
|
333
333
|
}, autoHighlight: true, autoSelect: true, autoComplete: true, fullWidth: true, options: options, getOptionLabel: getOptionLabel || ((option) => option?.label), freeSolo: false, renderInput: (params) => {
|
|
334
|
-
return (React.createElement(TextField, Object.assign({ label: label, type: 'text', inputProps: params.inputProps, inputRef: params.InputProps.ref, autoFocus: appliedUiSchemaOptions.focus, disabled: !enabled }, params, { id: id
|
|
334
|
+
return (React.createElement(TextField, Object.assign({ label: label, type: 'text', inputProps: params.inputProps, inputRef: params.InputProps.ref, autoFocus: appliedUiSchemaOptions.focus, disabled: !enabled }, params, { id: id, required: required && !appliedUiSchemaOptions.hideRequiredAsterisk, error: !isValid, fullWidth: !appliedUiSchemaOptions.trim, InputLabelProps: data ? { shrink: true } : undefined, onFocus: onFocus, onBlur: onBlur, focused: focused })));
|
|
335
335
|
}, renderOption: renderOption, filterOptions: filterOptions }),
|
|
336
336
|
React.createElement(FormHelperText, { error: !isValid && !showDescription }, firstFormHelperText),
|
|
337
337
|
React.createElement(FormHelperText, { error: !isValid }, secondFormHelperText)));
|
|
@@ -566,8 +566,11 @@ var MaterialEnumArrayRenderer$1 = withJsonFormsMultiEnumProps(MaterialEnumArrayR
|
|
|
566
566
|
|
|
567
567
|
const MaterialObjectRenderer = ({ renderers, cells, uischemas, schema, label, path, visible, enabled, uischema, rootSchema, }) => {
|
|
568
568
|
const detailUiSchema = useMemo(() => findUISchema(uischemas, schema, uischema.scope, path, () => isEmpty(path)
|
|
569
|
-
? Generate.uiSchema(schema, 'VerticalLayout')
|
|
570
|
-
: {
|
|
569
|
+
? Generate.uiSchema(schema, 'VerticalLayout', undefined, rootSchema)
|
|
570
|
+
: {
|
|
571
|
+
...Generate.uiSchema(schema, 'Group', undefined, rootSchema),
|
|
572
|
+
label,
|
|
573
|
+
}, uischema, rootSchema), [uischemas, schema, uischema.scope, path, label, uischema, rootSchema]);
|
|
571
574
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
572
575
|
React.createElement(JsonFormsDispatch, { visible: visible, enabled: enabled, schema: schema, uischema: detailUiSchema, path: path, renderers: renderers, cells: cells })));
|
|
573
576
|
};
|
|
@@ -584,7 +587,7 @@ const MaterialOneOfRenderer = ({ handleChange, schema, path, renderers, cells, r
|
|
|
584
587
|
}, [setConfirmDialogOpen]);
|
|
585
588
|
const oneOfRenderInfos = createCombinatorRenderInfos(schema.oneOf, rootSchema, 'oneOf', uischema, path, uischemas);
|
|
586
589
|
const openNewTab = (newIndex) => {
|
|
587
|
-
handleChange(path, createDefaultValue(oneOfRenderInfos[newIndex].schema));
|
|
590
|
+
handleChange(path, createDefaultValue(oneOfRenderInfos[newIndex].schema, rootSchema));
|
|
588
591
|
setSelectedIndex(newIndex);
|
|
589
592
|
};
|
|
590
593
|
const confirm = useCallback(() => {
|
|
@@ -601,7 +604,7 @@ const MaterialOneOfRenderer = ({ handleChange, schema, path, renderers, cells, r
|
|
|
601
604
|
}
|
|
602
605
|
}, [setConfirmDialogOpen, setSelectedIndex, data]);
|
|
603
606
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
604
|
-
React.createElement(CombinatorProperties, { schema: schema, combinatorKeyword: 'oneOf', path: path }),
|
|
607
|
+
React.createElement(CombinatorProperties, { schema: schema, combinatorKeyword: 'oneOf', path: path, rootSchema: rootSchema }),
|
|
605
608
|
React.createElement(Tabs, { value: selectedIndex, onChange: handleTabChange }, oneOfRenderInfos.map((oneOfRenderInfo) => (React.createElement(Tab, { key: oneOfRenderInfo.label, label: oneOfRenderInfo.label })))),
|
|
606
609
|
oneOfRenderInfos.map((oneOfRenderInfo, oneOfIndex) => selectedIndex === oneOfIndex && (React.createElement(JsonFormsDispatch, { key: oneOfIndex, schema: oneOfRenderInfo.schema, uischema: oneOfRenderInfo.uischema, path: path, renderers: renderers, cells: cells }))),
|
|
607
610
|
React.createElement(TabSwitchConfirmDialog, { cancel: cancel, confirm: confirm, id: 'oneOf-' + id, open: confirmDialogOpen, handleClose: handleClose })));
|
|
@@ -656,7 +659,7 @@ const MaterialListWithDetailRenderer = ({ uischemas, schema, uischema, path, ena
|
|
|
656
659
|
}
|
|
657
660
|
}, [removeItems, setSelectedIndex]);
|
|
658
661
|
const handleListItemClick = useCallback((index) => () => setSelectedIndex(index), [setSelectedIndex]);
|
|
659
|
-
const handleCreateDefaultValue = useCallback(() => createDefaultValue(schema), [createDefaultValue]);
|
|
662
|
+
const handleCreateDefaultValue = useCallback(() => createDefaultValue(schema, rootSchema), [createDefaultValue]);
|
|
660
663
|
const foundUISchema = useMemo(() => findUISchema(uischemas, schema, uischema.scope, path, undefined, uischema, rootSchema), [uischemas, schema, uischema.scope, path, uischema, rootSchema]);
|
|
661
664
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
662
665
|
React.useEffect(() => {
|
|
@@ -956,11 +959,10 @@ const MaterialRadioGroup = (props) => {
|
|
|
956
959
|
const isValid = errors.length === 0;
|
|
957
960
|
const appliedUiSchemaOptions = merge({}, config, props.uischema.options);
|
|
958
961
|
const showDescription = !isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
959
|
-
const onChange = (_ev, value) => handleChange(path, value);
|
|
960
962
|
return (React.createElement(Hidden, { xsUp: !visible },
|
|
961
963
|
React.createElement(FormControl, { component: 'fieldset', fullWidth: !appliedUiSchemaOptions.trim, onFocus: onFocus, onBlur: onBlur },
|
|
962
964
|
React.createElement(FormLabel, { htmlFor: id, error: !isValid, component: 'legend', required: showAsRequired(required, appliedUiSchemaOptions.hideRequiredAsterisk) }, label),
|
|
963
|
-
React.createElement(RadioGroup, { value: props.data ?? '',
|
|
965
|
+
React.createElement(RadioGroup, { value: props.data ?? '', row: true }, options.map((option) => (React.createElement(FormControlLabel, { value: option.value, key: option.label, control: React.createElement(Radio, { checked: data === option.value, onChange: () => handleChange(path, option.value) }), label: option.label, disabled: !enabled })))),
|
|
964
966
|
React.createElement(FormHelperText, { error: !isValid }, !isValid ? errors : showDescription ? description : null))));
|
|
965
967
|
};
|
|
966
968
|
|
|
@@ -1232,7 +1234,7 @@ var MaterialCategorizationLayout = withAjvProps(withTranslateProps(withJsonForms
|
|
|
1232
1234
|
|
|
1233
1235
|
const MaterialArrayLayoutComponent = (props) => {
|
|
1234
1236
|
const [expanded, setExpanded] = useState(false);
|
|
1235
|
-
const innerCreateDefaultValue = useCallback(() => createDefaultValue(props.schema), [props.schema]);
|
|
1237
|
+
const innerCreateDefaultValue = useCallback(() => createDefaultValue(props.schema, props.rootSchema), [props.schema]);
|
|
1236
1238
|
const handleChange = useCallback((panel) => (_event, expandedPanel) => {
|
|
1237
1239
|
setExpanded(expandedPanel ? panel : false);
|
|
1238
1240
|
}, []);
|