@jsonforms/material-renderers 3.7.0-alpha.1 → 3.7.0-alpha.2
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/jsonforms-react-material.cjs.js +45 -36
- package/lib/jsonforms-react-material.cjs.js.map +1 -1
- package/lib/jsonforms-react-material.esm.js +31 -22
- package/lib/jsonforms-react-material.esm.js.map +1 -1
- package/package.json +15 -8
- package/src/controls/MaterialDateControl.tsx +11 -6
- package/src/controls/MaterialDateTimeControl.tsx +11 -5
- package/src/controls/MaterialTimeControl.tsx +11 -5
- package/src/layouts/MaterialCategorizationLayout.tsx +3 -2
- package/src/layouts/MaterialCategorizationStepperLayout.tsx +2 -2
|
@@ -903,6 +903,7 @@ var MaterialBooleanToggleControl$1 = withJsonFormsControlProps(MaterialBooleanTo
|
|
|
903
903
|
|
|
904
904
|
const MaterialDateControl = (props) => {
|
|
905
905
|
const [focused, onFocus, onBlur] = useFocus();
|
|
906
|
+
const inputVariant = useInputVariant();
|
|
906
907
|
const { description, id, errors, label, uischema, visible, enabled, required, path, handleChange, data, config, } = props;
|
|
907
908
|
const isValid = errors.length === 0;
|
|
908
909
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
@@ -912,6 +913,7 @@ const MaterialDateControl = (props) => {
|
|
|
912
913
|
const format = appliedUiSchemaOptions.dateFormat ?? 'YYYY-MM-DD';
|
|
913
914
|
const saveFormat = appliedUiSchemaOptions.dateSaveFormat ?? defaultDateFormat;
|
|
914
915
|
const views = appliedUiSchemaOptions.views ?? ['year', 'day'];
|
|
916
|
+
const closeOnSelect = appliedUiSchemaOptions.closeOnSelect ?? true;
|
|
915
917
|
const firstFormHelperText = showDescription
|
|
916
918
|
? description
|
|
917
919
|
: !isValid
|
|
@@ -920,28 +922,29 @@ const MaterialDateControl = (props) => {
|
|
|
920
922
|
const secondFormHelperText = showDescription && !isValid ? errors : null;
|
|
921
923
|
const updateChild = useCallback(() => setKey((key) => key + 1), []);
|
|
922
924
|
const onChange = useMemo(() => createOnChangeHandler(path, handleChange, saveFormat), [path, handleChange, saveFormat]);
|
|
923
|
-
const onBlurHandler = useMemo(() => createOnBlurHandler(path, handleChange, format, saveFormat, updateChild, onBlur), [path, handleChange, format, saveFormat, updateChild]);
|
|
925
|
+
const onBlurHandler = useMemo(() => createOnBlurHandler(path, handleChange, format, saveFormat, updateChild, onBlur), [path, handleChange, format, saveFormat, updateChild, onBlur]);
|
|
924
926
|
const value = getData(data, saveFormat);
|
|
925
927
|
if (!visible) {
|
|
926
928
|
return null;
|
|
927
929
|
}
|
|
928
930
|
return (React.createElement(LocalizationProvider, { dateAdapter: AdapterDayjs },
|
|
929
|
-
React.createElement(DatePicker, { open: open, onOpen: () => setOpen(true), onClose: () => setOpen(false), key: key, label: label, value: value, onAccept: onChange, format: format, views: views, disabled: !enabled, slotProps: {
|
|
930
|
-
actionBar: ({
|
|
931
|
-
actions:
|
|
931
|
+
React.createElement(DatePicker, { open: open, onOpen: () => setOpen(true), onClose: () => setOpen(false), key: key, label: label, value: value, onAccept: onChange, format: format, views: views, disabled: !enabled, closeOnSelect: closeOnSelect, slotProps: {
|
|
932
|
+
actionBar: ({ pickerVariant }) => ({
|
|
933
|
+
actions: pickerVariant === 'desktop' ? [] : ['clear', 'cancel', 'accept'],
|
|
932
934
|
}),
|
|
933
935
|
textField: {
|
|
934
936
|
id: id + '-input',
|
|
935
937
|
required: required && !appliedUiSchemaOptions.hideRequiredAsterisk,
|
|
936
|
-
autoFocus: appliedUiSchemaOptions.focus,
|
|
937
938
|
error: !isValid,
|
|
938
939
|
fullWidth: !appliedUiSchemaOptions.trim,
|
|
940
|
+
variant: inputVariant,
|
|
939
941
|
inputProps: {
|
|
942
|
+
autoFocus: appliedUiSchemaOptions.focus,
|
|
940
943
|
type: 'text',
|
|
944
|
+
onFocus: onFocus,
|
|
945
|
+
onBlur: onBlurHandler,
|
|
941
946
|
},
|
|
942
947
|
InputLabelProps: data ? { shrink: true } : undefined,
|
|
943
|
-
onFocus: onFocus,
|
|
944
|
-
onBlur: onBlurHandler,
|
|
945
948
|
},
|
|
946
949
|
} }),
|
|
947
950
|
React.createElement(FormHelperText, { error: !isValid && !showDescription }, firstFormHelperText),
|
|
@@ -952,6 +955,7 @@ var MaterialDateControl$1 = withJsonFormsControlProps(MaterialDateControl);
|
|
|
952
955
|
|
|
953
956
|
const MaterialDateTimeControl = (props) => {
|
|
954
957
|
const [focused, onFocus, onBlur] = useFocus();
|
|
958
|
+
const inputVariant = useInputVariant();
|
|
955
959
|
const { id, description, errors, label, uischema, visible, enabled, required, path, handleChange, data, config, } = props;
|
|
956
960
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
957
961
|
const isValid = errors.length === 0;
|
|
@@ -966,6 +970,7 @@ const MaterialDateTimeControl = (props) => {
|
|
|
966
970
|
'hours',
|
|
967
971
|
'minutes',
|
|
968
972
|
];
|
|
973
|
+
const closeOnSelect = appliedUiSchemaOptions.closeOnSelect ?? true;
|
|
969
974
|
const firstFormHelperText = showDescription
|
|
970
975
|
? description
|
|
971
976
|
: !isValid
|
|
@@ -980,22 +985,23 @@ const MaterialDateTimeControl = (props) => {
|
|
|
980
985
|
return null;
|
|
981
986
|
}
|
|
982
987
|
return (React.createElement(LocalizationProvider, { dateAdapter: AdapterDayjs },
|
|
983
|
-
React.createElement(DateTimePicker, { open: open, onOpen: () => setOpen(true), onClose: () => setOpen(false), key: key, label: label, value: value, onAccept: onChange, format: format, ampm: !!appliedUiSchemaOptions.ampm, views: views, disabled: !enabled, slotProps: {
|
|
984
|
-
actionBar: ({
|
|
985
|
-
actions:
|
|
988
|
+
React.createElement(DateTimePicker, { open: open, onOpen: () => setOpen(true), onClose: () => setOpen(false), key: key, label: label, value: value, onAccept: onChange, onChange: onChange, format: format, ampm: !!appliedUiSchemaOptions.ampm, views: views, closeOnSelect: closeOnSelect, disabled: !enabled, slotProps: {
|
|
989
|
+
actionBar: ({ pickerVariant }) => ({
|
|
990
|
+
actions: pickerVariant === 'desktop' ? [] : ['clear', 'cancel', 'accept'],
|
|
986
991
|
}),
|
|
987
992
|
textField: {
|
|
988
993
|
id: id + '-input',
|
|
989
994
|
required: required && !appliedUiSchemaOptions.hideRequiredAsterisk,
|
|
990
|
-
autoFocus: appliedUiSchemaOptions.focus,
|
|
991
995
|
error: !isValid,
|
|
992
996
|
fullWidth: !appliedUiSchemaOptions.trim,
|
|
997
|
+
variant: inputVariant,
|
|
993
998
|
inputProps: {
|
|
999
|
+
autoFocus: appliedUiSchemaOptions.focus,
|
|
994
1000
|
type: 'text',
|
|
1001
|
+
onFocus: onFocus,
|
|
1002
|
+
onBlur: onBlurHandler,
|
|
995
1003
|
},
|
|
996
1004
|
InputLabelProps: data ? { shrink: true } : undefined,
|
|
997
|
-
onFocus: onFocus,
|
|
998
|
-
onBlur: onBlurHandler,
|
|
999
1005
|
},
|
|
1000
1006
|
} }),
|
|
1001
1007
|
React.createElement(FormHelperText, { error: !isValid && !showDescription }, firstFormHelperText),
|
|
@@ -1116,6 +1122,7 @@ var MaterialTextControl$1 = withJsonFormsControlProps(MaterialTextControl);
|
|
|
1116
1122
|
|
|
1117
1123
|
const MaterialTimeControl = (props) => {
|
|
1118
1124
|
const [focused, onFocus, onBlur] = useFocus();
|
|
1125
|
+
const inputVariant = useInputVariant();
|
|
1119
1126
|
const { id, description, errors, label, uischema, visible, enabled, required, path, handleChange, data, config, } = props;
|
|
1120
1127
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
1121
1128
|
const isValid = errors.length === 0;
|
|
@@ -1125,6 +1132,7 @@ const MaterialTimeControl = (props) => {
|
|
|
1125
1132
|
const format = appliedUiSchemaOptions.timeFormat ?? 'HH:mm';
|
|
1126
1133
|
const saveFormat = appliedUiSchemaOptions.timeSaveFormat ?? defaultTimeFormat;
|
|
1127
1134
|
const views = appliedUiSchemaOptions.views ?? ['hours', 'minutes'];
|
|
1135
|
+
const closeOnSelect = appliedUiSchemaOptions.closeOnSelect ?? true;
|
|
1128
1136
|
const firstFormHelperText = showDescription
|
|
1129
1137
|
? description
|
|
1130
1138
|
: !isValid
|
|
@@ -1139,22 +1147,23 @@ const MaterialTimeControl = (props) => {
|
|
|
1139
1147
|
return null;
|
|
1140
1148
|
}
|
|
1141
1149
|
return (React.createElement(LocalizationProvider, { dateAdapter: AdapterDayjs },
|
|
1142
|
-
React.createElement(TimePicker, { open: open, onOpen: () => setOpen(true), onClose: () => setOpen(false), key: key, label: label, value: value, onAccept: onChange, format: format, ampm: !!appliedUiSchemaOptions.ampm, views: views, disabled: !enabled, slotProps: {
|
|
1143
|
-
actionBar: ({
|
|
1144
|
-
actions:
|
|
1150
|
+
React.createElement(TimePicker, { open: open, onOpen: () => setOpen(true), onClose: () => setOpen(false), key: key, label: label, value: value, onAccept: onChange, onChange: onChange, format: format, ampm: !!appliedUiSchemaOptions.ampm, views: views, closeOnSelect: closeOnSelect, disabled: !enabled, slotProps: {
|
|
1151
|
+
actionBar: ({ pickerVariant }) => ({
|
|
1152
|
+
actions: pickerVariant === 'desktop' ? [] : ['clear', 'cancel', 'accept'],
|
|
1145
1153
|
}),
|
|
1146
1154
|
textField: {
|
|
1147
1155
|
id: id + '-input',
|
|
1148
1156
|
required: required && !appliedUiSchemaOptions.hideRequiredAsterisk,
|
|
1149
|
-
autoFocus: appliedUiSchemaOptions.focus,
|
|
1150
1157
|
error: !isValid,
|
|
1151
1158
|
fullWidth: !appliedUiSchemaOptions.trim,
|
|
1159
|
+
variant: inputVariant,
|
|
1152
1160
|
inputProps: {
|
|
1161
|
+
autoFocus: appliedUiSchemaOptions.focus,
|
|
1153
1162
|
type: 'text',
|
|
1163
|
+
onBlur: onBlurHandler,
|
|
1164
|
+
onFocus: onFocus,
|
|
1154
1165
|
},
|
|
1155
1166
|
InputLabelProps: data ? { shrink: true } : undefined,
|
|
1156
|
-
onFocus: onFocus,
|
|
1157
|
-
onBlur: onBlurHandler,
|
|
1158
1167
|
},
|
|
1159
1168
|
} }),
|
|
1160
1169
|
React.createElement(FormHelperText, { error: !isValid && !showDescription }, firstFormHelperText),
|
|
@@ -1323,11 +1332,11 @@ const isSingleLevelCategorization = and(uiTypeIs('Categorization'), (uischema) =
|
|
|
1323
1332
|
});
|
|
1324
1333
|
const materialCategorizationTester = rankWith(1, isSingleLevelCategorization);
|
|
1325
1334
|
const MaterialCategorizationLayoutRenderer = (props) => {
|
|
1326
|
-
const { data, path, renderers, cells, schema, uischema, visible, enabled, selected, onChange, ajv, t, } = props;
|
|
1335
|
+
const { data, path, renderers, cells, schema, uischema, visible, enabled, selected, onChange, config, ajv, t, } = props;
|
|
1327
1336
|
const categorization = uischema;
|
|
1328
1337
|
const [previousCategorization, setPreviousCategorization] = useState(uischema);
|
|
1329
1338
|
const [activeCategory, setActiveCategory] = useState(selected ?? 0);
|
|
1330
|
-
const categories = useMemo(() => categorization.elements.filter((category) => isVisible(category, data, undefined, ajv)), [categorization, data, ajv]);
|
|
1339
|
+
const categories = useMemo(() => categorization.elements.filter((category) => isVisible(category, data, undefined, ajv, config)), [categorization, data, ajv, config]);
|
|
1331
1340
|
if (categorization !== previousCategorization) {
|
|
1332
1341
|
setActiveCategory(0);
|
|
1333
1342
|
setPreviousCategorization(categorization);
|
|
@@ -1474,7 +1483,7 @@ const MaterialCategorizationStepperLayoutRenderer = (props) => {
|
|
|
1474
1483
|
const buttonStyle = {
|
|
1475
1484
|
marginRight: '1em',
|
|
1476
1485
|
};
|
|
1477
|
-
const categories = useMemo(() => categorization.elements.filter((category) => isVisible(category, data, undefined, ajv)), [categorization, data, ajv]);
|
|
1486
|
+
const categories = useMemo(() => categorization.elements.filter((category) => isVisible(category, data, undefined, ajv, config)), [categorization, data, ajv, config]);
|
|
1478
1487
|
const childProps = {
|
|
1479
1488
|
elements: categories[activeCategory].elements,
|
|
1480
1489
|
schema,
|