@jsonforms/material-renderers 3.7.0-alpha.1 → 3.7.0-alpha.3

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.
@@ -1064,17 +1064,19 @@ var materialBooleanToggleControlTester = core.rankWith(3, core.and(core.isBoolea
1064
1064
  var MaterialBooleanToggleControl$1 = react.withJsonFormsControlProps(MaterialBooleanToggleControl);
1065
1065
 
1066
1066
  var MaterialDateControl = function (props) {
1067
- var _a, _b, _c;
1068
- var _d = useFocus(), focused = _d[0], onFocus = _d[1], onBlur = _d[2];
1067
+ var _a, _b, _c, _d;
1068
+ var _e = useFocus(), focused = _e[0], onFocus = _e[1], onBlur = _e[2];
1069
+ var inputVariant = useInputVariant();
1069
1070
  var description = props.description, id = props.id, errors = props.errors, label = props.label, uischema = props.uischema, visible = props.visible, enabled = props.enabled, required = props.required, path = props.path, handleChange = props.handleChange, data = props.data, config = props.config;
1070
1071
  var isValid = errors.length === 0;
1071
1072
  var appliedUiSchemaOptions = merge__default["default"]({}, config, uischema.options);
1072
1073
  var showDescription = !core.isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
1073
- var _e = React.useState(0), key = _e[0], setKey = _e[1];
1074
- var _f = React.useState(false), open = _f[0], setOpen = _f[1];
1074
+ var _f = React.useState(0), key = _f[0], setKey = _f[1];
1075
+ var _g = React.useState(false), open = _g[0], setOpen = _g[1];
1075
1076
  var format = (_a = appliedUiSchemaOptions.dateFormat) !== null && _a !== void 0 ? _a : 'YYYY-MM-DD';
1076
1077
  var saveFormat = (_b = appliedUiSchemaOptions.dateSaveFormat) !== null && _b !== void 0 ? _b : core.defaultDateFormat;
1077
1078
  var views = (_c = appliedUiSchemaOptions.views) !== null && _c !== void 0 ? _c : ['year', 'day'];
1079
+ var closeOnSelect = (_d = appliedUiSchemaOptions.closeOnSelect) !== null && _d !== void 0 ? _d : true;
1078
1080
  var firstFormHelperText = showDescription
1079
1081
  ? description
1080
1082
  : !isValid
@@ -1085,31 +1087,32 @@ var MaterialDateControl = function (props) {
1085
1087
  var onChange = React.useMemo(function () { return createOnChangeHandler(path, handleChange, saveFormat); }, [path, handleChange, saveFormat]);
1086
1088
  var onBlurHandler = React.useMemo(function () {
1087
1089
  return createOnBlurHandler(path, handleChange, format, saveFormat, updateChild, onBlur);
1088
- }, [path, handleChange, format, saveFormat, updateChild]);
1090
+ }, [path, handleChange, format, saveFormat, updateChild, onBlur]);
1089
1091
  var value = getData(data, saveFormat);
1090
1092
  if (!visible) {
1091
1093
  return null;
1092
1094
  }
1093
1095
  return (React__default["default"].createElement(xDatePickers.LocalizationProvider, { dateAdapter: AdapterDayjs.AdapterDayjs },
1094
- React__default["default"].createElement(xDatePickers.DatePicker, { open: open, onOpen: function () { return setOpen(true); }, onClose: function () { return setOpen(false); }, key: key, label: label, value: value, onAccept: onChange, format: format, views: views, disabled: !enabled, slotProps: {
1096
+ React__default["default"].createElement(xDatePickers.DatePicker, { open: open, onOpen: function () { return setOpen(true); }, onClose: function () { return setOpen(false); }, key: key, label: label, value: value, onAccept: onChange, format: format, views: views, disabled: !enabled, closeOnSelect: closeOnSelect, slotProps: {
1095
1097
  actionBar: function (_a) {
1096
- var wrapperVariant = _a.wrapperVariant;
1098
+ var pickerVariant = _a.pickerVariant;
1097
1099
  return ({
1098
- actions: wrapperVariant === 'desktop' ? [] : ['clear', 'cancel', 'accept'],
1100
+ actions: pickerVariant === 'desktop' ? [] : ['clear', 'cancel', 'accept'],
1099
1101
  });
1100
1102
  },
1101
1103
  textField: {
1102
1104
  id: id + '-input',
1103
1105
  required: required && !appliedUiSchemaOptions.hideRequiredAsterisk,
1104
- autoFocus: appliedUiSchemaOptions.focus,
1105
1106
  error: !isValid,
1106
1107
  fullWidth: !appliedUiSchemaOptions.trim,
1108
+ variant: inputVariant,
1107
1109
  inputProps: {
1110
+ autoFocus: appliedUiSchemaOptions.focus,
1108
1111
  type: 'text',
1112
+ onFocus: onFocus,
1113
+ onBlur: onBlurHandler,
1109
1114
  },
1110
1115
  InputLabelProps: data ? { shrink: true } : undefined,
1111
- onFocus: onFocus,
1112
- onBlur: onBlurHandler,
1113
1116
  },
1114
1117
  } }),
1115
1118
  React__default["default"].createElement(material.FormHelperText, { error: !isValid && !showDescription }, firstFormHelperText),
@@ -1119,22 +1122,24 @@ var materialDateControlTester = core.rankWith(4, core.isDateControl);
1119
1122
  var MaterialDateControl$1 = react.withJsonFormsControlProps(MaterialDateControl);
1120
1123
 
1121
1124
  var MaterialDateTimeControl = function (props) {
1122
- var _a, _b, _c;
1123
- var _d = useFocus(), focused = _d[0], onFocus = _d[1], onBlur = _d[2];
1125
+ var _a, _b, _c, _d;
1126
+ var _e = useFocus(), focused = _e[0], onFocus = _e[1], onBlur = _e[2];
1127
+ var inputVariant = useInputVariant();
1124
1128
  var id = props.id, description = props.description, errors = props.errors, label = props.label, uischema = props.uischema, visible = props.visible, enabled = props.enabled, required = props.required, path = props.path, handleChange = props.handleChange, data = props.data, config = props.config;
1125
1129
  var appliedUiSchemaOptions = merge__default["default"]({}, config, uischema.options);
1126
1130
  var isValid = errors.length === 0;
1127
1131
  var showDescription = !core.isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
1128
1132
  var format = (_a = appliedUiSchemaOptions.dateTimeFormat) !== null && _a !== void 0 ? _a : 'YYYY-MM-DD HH:mm';
1129
1133
  var saveFormat = (_b = appliedUiSchemaOptions.dateTimeSaveFormat) !== null && _b !== void 0 ? _b : core.defaultDateTimeFormat;
1130
- var _e = React.useState(0), key = _e[0], setKey = _e[1];
1131
- var _f = React.useState(false), open = _f[0], setOpen = _f[1];
1134
+ var _f = React.useState(0), key = _f[0], setKey = _f[1];
1135
+ var _g = React.useState(false), open = _g[0], setOpen = _g[1];
1132
1136
  var views = (_c = appliedUiSchemaOptions.views) !== null && _c !== void 0 ? _c : [
1133
1137
  'year',
1134
1138
  'day',
1135
1139
  'hours',
1136
1140
  'minutes',
1137
1141
  ];
1142
+ var closeOnSelect = (_d = appliedUiSchemaOptions.closeOnSelect) !== null && _d !== void 0 ? _d : true;
1138
1143
  var firstFormHelperText = showDescription
1139
1144
  ? description
1140
1145
  : !isValid
@@ -1151,25 +1156,26 @@ var MaterialDateTimeControl = function (props) {
1151
1156
  return null;
1152
1157
  }
1153
1158
  return (React__default["default"].createElement(xDatePickers.LocalizationProvider, { dateAdapter: AdapterDayjs.AdapterDayjs },
1154
- React__default["default"].createElement(xDatePickers.DateTimePicker, { open: open, onOpen: function () { return setOpen(true); }, onClose: function () { return setOpen(false); }, key: key, label: label, value: value, onAccept: onChange, format: format, ampm: !!appliedUiSchemaOptions.ampm, views: views, disabled: !enabled, slotProps: {
1159
+ React__default["default"].createElement(xDatePickers.DateTimePicker, { open: open, onOpen: function () { return setOpen(true); }, onClose: function () { return setOpen(false); }, key: key, label: label, value: value, onAccept: onChange, onChange: onChange, format: format, ampm: !!appliedUiSchemaOptions.ampm, views: views, closeOnSelect: closeOnSelect, disabled: !enabled, slotProps: {
1155
1160
  actionBar: function (_a) {
1156
- var wrapperVariant = _a.wrapperVariant;
1161
+ var pickerVariant = _a.pickerVariant;
1157
1162
  return ({
1158
- actions: wrapperVariant === 'desktop' ? [] : ['clear', 'cancel', 'accept'],
1163
+ actions: pickerVariant === 'desktop' ? [] : ['clear', 'cancel', 'accept'],
1159
1164
  });
1160
1165
  },
1161
1166
  textField: {
1162
1167
  id: id + '-input',
1163
1168
  required: required && !appliedUiSchemaOptions.hideRequiredAsterisk,
1164
- autoFocus: appliedUiSchemaOptions.focus,
1165
1169
  error: !isValid,
1166
1170
  fullWidth: !appliedUiSchemaOptions.trim,
1171
+ variant: inputVariant,
1167
1172
  inputProps: {
1173
+ autoFocus: appliedUiSchemaOptions.focus,
1168
1174
  type: 'text',
1175
+ onFocus: onFocus,
1176
+ onBlur: onBlurHandler,
1169
1177
  },
1170
1178
  InputLabelProps: data ? { shrink: true } : undefined,
1171
- onFocus: onFocus,
1172
- onBlur: onBlurHandler,
1173
1179
  },
1174
1180
  } }),
1175
1181
  React__default["default"].createElement(material.FormHelperText, { error: !isValid && !showDescription }, firstFormHelperText),
@@ -1291,17 +1297,19 @@ var materialTextControlTester = core.rankWith(1, core.isStringControl);
1291
1297
  var MaterialTextControl$1 = react.withJsonFormsControlProps(MaterialTextControl);
1292
1298
 
1293
1299
  var MaterialTimeControl = function (props) {
1294
- var _a, _b, _c;
1295
- var _d = useFocus(), focused = _d[0], onFocus = _d[1], onBlur = _d[2];
1300
+ var _a, _b, _c, _d;
1301
+ var _e = useFocus(), focused = _e[0], onFocus = _e[1], onBlur = _e[2];
1302
+ var inputVariant = useInputVariant();
1296
1303
  var id = props.id, description = props.description, errors = props.errors, label = props.label, uischema = props.uischema, visible = props.visible, enabled = props.enabled, required = props.required, path = props.path, handleChange = props.handleChange, data = props.data, config = props.config;
1297
1304
  var appliedUiSchemaOptions = merge__default["default"]({}, config, uischema.options);
1298
1305
  var isValid = errors.length === 0;
1299
- var _e = React.useState(0), key = _e[0], setKey = _e[1];
1300
- var _f = React.useState(false), open = _f[0], setOpen = _f[1];
1306
+ var _f = React.useState(0), key = _f[0], setKey = _f[1];
1307
+ var _g = React.useState(false), open = _g[0], setOpen = _g[1];
1301
1308
  var showDescription = !core.isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
1302
1309
  var format = (_a = appliedUiSchemaOptions.timeFormat) !== null && _a !== void 0 ? _a : 'HH:mm';
1303
1310
  var saveFormat = (_b = appliedUiSchemaOptions.timeSaveFormat) !== null && _b !== void 0 ? _b : core.defaultTimeFormat;
1304
1311
  var views = (_c = appliedUiSchemaOptions.views) !== null && _c !== void 0 ? _c : ['hours', 'minutes'];
1312
+ var closeOnSelect = (_d = appliedUiSchemaOptions.closeOnSelect) !== null && _d !== void 0 ? _d : true;
1305
1313
  var firstFormHelperText = showDescription
1306
1314
  ? description
1307
1315
  : !isValid
@@ -1318,25 +1326,26 @@ var MaterialTimeControl = function (props) {
1318
1326
  return null;
1319
1327
  }
1320
1328
  return (React__default["default"].createElement(xDatePickers.LocalizationProvider, { dateAdapter: AdapterDayjs.AdapterDayjs },
1321
- React__default["default"].createElement(xDatePickers.TimePicker, { open: open, onOpen: function () { return setOpen(true); }, onClose: function () { return setOpen(false); }, key: key, label: label, value: value, onAccept: onChange, format: format, ampm: !!appliedUiSchemaOptions.ampm, views: views, disabled: !enabled, slotProps: {
1329
+ React__default["default"].createElement(xDatePickers.TimePicker, { open: open, onOpen: function () { return setOpen(true); }, onClose: function () { return setOpen(false); }, key: key, label: label, value: value, onAccept: onChange, onChange: onChange, format: format, ampm: !!appliedUiSchemaOptions.ampm, views: views, closeOnSelect: closeOnSelect, disabled: !enabled, slotProps: {
1322
1330
  actionBar: function (_a) {
1323
- var wrapperVariant = _a.wrapperVariant;
1331
+ var pickerVariant = _a.pickerVariant;
1324
1332
  return ({
1325
- actions: wrapperVariant === 'desktop' ? [] : ['clear', 'cancel', 'accept'],
1333
+ actions: pickerVariant === 'desktop' ? [] : ['clear', 'cancel', 'accept'],
1326
1334
  });
1327
1335
  },
1328
1336
  textField: {
1329
1337
  id: id + '-input',
1330
1338
  required: required && !appliedUiSchemaOptions.hideRequiredAsterisk,
1331
- autoFocus: appliedUiSchemaOptions.focus,
1332
1339
  error: !isValid,
1333
1340
  fullWidth: !appliedUiSchemaOptions.trim,
1341
+ variant: inputVariant,
1334
1342
  inputProps: {
1343
+ autoFocus: appliedUiSchemaOptions.focus,
1335
1344
  type: 'text',
1345
+ onBlur: onBlurHandler,
1346
+ onFocus: onFocus,
1336
1347
  },
1337
1348
  InputLabelProps: data ? { shrink: true } : undefined,
1338
- onFocus: onFocus,
1339
- onBlur: onBlurHandler,
1340
1349
  },
1341
1350
  } }),
1342
1351
  React__default["default"].createElement(material.FormHelperText, { error: !isValid && !showDescription }, firstFormHelperText),
@@ -1520,15 +1529,15 @@ var isSingleLevelCategorization = core.and(core.uiTypeIs('Categorization'), func
1520
1529
  });
1521
1530
  var materialCategorizationTester = core.rankWith(1, isSingleLevelCategorization);
1522
1531
  var MaterialCategorizationLayoutRenderer = function (props) {
1523
- var data = props.data, path = props.path, renderers = props.renderers, cells = props.cells, schema = props.schema, uischema = props.uischema, visible = props.visible, enabled = props.enabled, selected = props.selected, onChange = props.onChange, ajv = props.ajv, t = props.t;
1532
+ var data = props.data, path = props.path, renderers = props.renderers, cells = props.cells, schema = props.schema, uischema = props.uischema, visible = props.visible, enabled = props.enabled, selected = props.selected, onChange = props.onChange, config = props.config, ajv = props.ajv, t = props.t;
1524
1533
  var categorization = uischema;
1525
1534
  var _a = React.useState(uischema), previousCategorization = _a[0], setPreviousCategorization = _a[1];
1526
1535
  var _b = React.useState(selected !== null && selected !== void 0 ? selected : 0), activeCategory = _b[0], setActiveCategory = _b[1];
1527
1536
  var categories = React.useMemo(function () {
1528
1537
  return categorization.elements.filter(function (category) {
1529
- return core.isVisible(category, data, undefined, ajv);
1538
+ return core.isVisible(category, data, undefined, ajv, config);
1530
1539
  });
1531
- }, [categorization, data, ajv]);
1540
+ }, [categorization, data, ajv, config]);
1532
1541
  if (categorization !== previousCategorization) {
1533
1542
  setActiveCategory(0);
1534
1543
  setPreviousCategorization(categorization);
@@ -1682,9 +1691,9 @@ var MaterialCategorizationStepperLayoutRenderer = function (props) {
1682
1691
  };
1683
1692
  var categories = React.useMemo(function () {
1684
1693
  return categorization.elements.filter(function (category) {
1685
- return core.isVisible(category, data, undefined, ajv);
1694
+ return core.isVisible(category, data, undefined, ajv, config);
1686
1695
  });
1687
- }, [categorization, data, ajv]);
1696
+ }, [categorization, data, ajv, config]);
1688
1697
  var childProps = {
1689
1698
  elements: categories[activeCategory].elements,
1690
1699
  schema: schema,