@jsonforms/material-renderers 3.0.0-beta.4 → 3.0.0-rc.1
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/docs/assets/js/search.json +1 -1
- package/docs/globals.html +167 -40
- package/docs/index.html +15 -0
- package/docs/interfaces/categorizationstate.html +1 -1
- package/docs/interfaces/categorizationstepperstate.html +1 -1
- package/docs/interfaces/inputref.html +168 -0
- package/docs/interfaces/materialcategorizationlayoutrendererprops.html +49 -4
- package/docs/interfaces/materialcategorizationstepperlayoutrendererprops.html +46 -1
- package/docs/interfaces/materiallabelablelayoutrendererprops.html +328 -0
- package/docs/interfaces/materiallayoutrendererprops.html +5 -0
- package/docs/interfaces/withoptionlabel.html +3 -3
- package/lib/additional/MaterialLabelRenderer.d.ts +3 -3
- package/lib/cells/MaterialEnumCell.d.ts +2 -1
- package/lib/cells/MaterialOneOfEnumCell.d.ts +2 -1
- package/lib/controls/MaterialEnumControl.d.ts +2 -1
- package/lib/controls/MaterialOneOfEnumControl.d.ts +2 -1
- package/lib/controls/index.d.ts +2 -2
- package/lib/jsonforms-react-material.cjs.js +143 -65
- package/lib/jsonforms-react-material.cjs.js.map +1 -1
- package/lib/jsonforms-react-material.esm.js +137 -57
- package/lib/jsonforms-react-material.esm.js.map +1 -1
- package/lib/layouts/MaterialCategorizationLayout.d.ts +4 -3
- package/lib/layouts/MaterialCategorizationStepperLayout.d.ts +4 -3
- package/lib/layouts/MaterialGroupLayout.d.ts +2 -2
- package/lib/layouts/MaterialHorizontalLayout.d.ts +1 -1
- package/lib/layouts/MaterialVerticalLayout.d.ts +1 -1
- package/lib/mui-controls/MuiAutocomplete.d.ts +2 -2
- package/lib/mui-controls/MuiSelect.d.ts +2 -1
- package/lib/util/datejs.d.ts +17 -1
- package/lib/util/i18nDefaults.d.ts +3 -0
- package/lib/util/index.d.ts +1 -0
- package/lib/util/layout.d.ts +3 -0
- package/package.json +9 -9
- package/src/additional/MaterialLabelRenderer.tsx +5 -7
- package/src/additional/MaterialListWithDetailRenderer.tsx +4 -0
- package/src/cells/MaterialEnumCell.tsx +4 -3
- package/src/cells/MaterialOneOfEnumCell.tsx +3 -3
- package/src/controls/MaterialDateControl.tsx +30 -12
- package/src/controls/MaterialDateTimeControl.tsx +32 -13
- package/src/controls/MaterialEnumControl.tsx +12 -5
- package/src/controls/MaterialOneOfEnumControl.tsx +13 -5
- package/src/controls/MaterialRadioGroup.tsx +1 -1
- package/src/controls/MaterialTimeControl.tsx +31 -13
- package/src/layouts/MaterialCategorizationLayout.tsx +18 -9
- package/src/layouts/MaterialCategorizationStepperLayout.tsx +19 -12
- package/src/layouts/MaterialGroupLayout.tsx +6 -5
- package/src/mui-controls/MuiAutocomplete.tsx +81 -37
- package/src/mui-controls/MuiInputText.tsx +4 -1
- package/src/mui-controls/MuiSelect.tsx +10 -5
- package/src/util/datejs.tsx +73 -0
- package/src/util/i18nDefaults.ts +3 -0
- package/src/util/index.ts +1 -0
- package/src/util/layout.tsx +4 -0
- package/stats.html +1 -1
- package/test/renderers/MaterialArrayLayout.test.tsx +4 -4
- package/test/renderers/MaterialCategorizationLayout.test.tsx +17 -7
- package/test/renderers/MaterialCategorizationStepperLayout.test.tsx +21 -11
- package/test/renderers/MaterialDateControl.test.tsx +27 -0
- package/test/renderers/MaterialDateTimeControl.test.tsx +29 -2
- package/test/renderers/MaterialGroupLayout.test.tsx +4 -1
- package/test/renderers/MaterialInputControl.test.tsx +4 -0
- package/test/renderers/MaterialLabelRenderer.test.tsx +2 -1
- package/test/renderers/MaterialTimeControl.test.tsx +28 -1
- package/test/renderers/util.ts +5 -0
- package/src/util/datejs.ts +0 -32
|
@@ -23,8 +23,8 @@ var customParsing = require('dayjs/plugin/customParseFormat');
|
|
|
23
23
|
var debounce = require('lodash/debounce');
|
|
24
24
|
var Close = require('@mui/icons-material/Close');
|
|
25
25
|
var map = require('lodash/map');
|
|
26
|
-
var
|
|
27
|
-
var AdapterDayjs = require('@mui/
|
|
26
|
+
var xDatePickers = require('@mui/x-date-pickers');
|
|
27
|
+
var AdapterDayjs = require('@mui/x-date-pickers/AdapterDayjs');
|
|
28
28
|
var get = require('lodash/get');
|
|
29
29
|
var ExpandMoreIcon = require('@mui/icons-material/ExpandMore');
|
|
30
30
|
var Input = require('@mui/material/Input');
|
|
@@ -48,7 +48,6 @@ var customParsing__default = /*#__PURE__*/_interopDefaultLegacy(customParsing);
|
|
|
48
48
|
var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
|
|
49
49
|
var Close__default = /*#__PURE__*/_interopDefaultLegacy(Close);
|
|
50
50
|
var map__default = /*#__PURE__*/_interopDefaultLegacy(map);
|
|
51
|
-
var AdapterDayjs__default = /*#__PURE__*/_interopDefaultLegacy(AdapterDayjs);
|
|
52
51
|
var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
|
|
53
52
|
var ExpandMoreIcon__default = /*#__PURE__*/_interopDefaultLegacy(ExpandMoreIcon);
|
|
54
53
|
var Input__default = /*#__PURE__*/_interopDefaultLegacy(Input);
|
|
@@ -448,20 +447,14 @@ var MuiCheckbox = React__default["default"].memo(function (props) {
|
|
|
448
447
|
return (React__default["default"].createElement(material.Checkbox, { checked: checked, onChange: function (_ev, isChecked) { return handleChange(path, isChecked); }, className: className, id: id, disabled: !enabled, inputProps: inputProps }));
|
|
449
448
|
});
|
|
450
449
|
|
|
451
|
-
var MuiSelect = React__default["default"].memo(function (props) {
|
|
452
|
-
var data = props.data, className = props.className, id = props.id, enabled = props.enabled, uischema = props.uischema, path = props.path, handleChange = props.handleChange, options = props.options, config = props.config;
|
|
453
|
-
var appliedUiSchemaOptions = merge__default["default"]({}, config, uischema.options);
|
|
454
|
-
return (React__default["default"].createElement(material.Select, { className: className, id: id, disabled: !enabled, autoFocus: appliedUiSchemaOptions.focus, value: data !== undefined ? data : '', onChange: function (ev) { return handleChange(path, ev.target.value); }, fullWidth: true, variant: 'standard' }, [React__default["default"].createElement(material.MenuItem, { value: '', key: 'empty' })].concat(options.map(function (optionValue) { return (React__default["default"].createElement(material.MenuItem, { value: optionValue.value, key: optionValue.value }, optionValue.label)); }))));
|
|
455
|
-
});
|
|
456
|
-
|
|
457
450
|
dayjs__default["default"].extend(customParsing__default["default"]);
|
|
458
|
-
var createOnChangeHandler = function (path, handleChange, saveFormat) { return function (time) {
|
|
451
|
+
var createOnChangeHandler = function (path, handleChange, saveFormat) { return function (time, textInputValue) {
|
|
459
452
|
if (!time) {
|
|
460
453
|
handleChange(path, undefined);
|
|
461
454
|
return;
|
|
462
455
|
}
|
|
463
456
|
var result = dayjs__default["default"](time).format(saveFormat);
|
|
464
|
-
handleChange(path, result === 'Invalid Date' ?
|
|
457
|
+
handleChange(path, result === 'Invalid Date' ? textInputValue : result);
|
|
465
458
|
}; };
|
|
466
459
|
var getData = function (data, saveFormat) {
|
|
467
460
|
if (!data) {
|
|
@@ -473,6 +466,23 @@ var getData = function (data, saveFormat) {
|
|
|
473
466
|
}
|
|
474
467
|
return dayjsData;
|
|
475
468
|
};
|
|
469
|
+
var ResettableTextField = function (_a) {
|
|
470
|
+
var rawValue = _a.rawValue, dayjsValueIsValid = _a.dayjsValueIsValid, valueInInputFormat = _a.valueInInputFormat, focused = _a.focused, inputProps = _a.inputProps, props = __rest(_a, ["rawValue", "dayjsValueIsValid", "valueInInputFormat", "focused", "inputProps"]);
|
|
471
|
+
var value = React.useRef({ lastInput: inputProps === null || inputProps === void 0 ? void 0 : inputProps.value, toShow: inputProps === null || inputProps === void 0 ? void 0 : inputProps.value });
|
|
472
|
+
if (!focused) {
|
|
473
|
+
if (!dayjsValueIsValid) {
|
|
474
|
+
value.current.toShow = typeof rawValue === 'string' || rawValue === null || rawValue === undefined ? rawValue : JSON.stringify(rawValue);
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
value.current.toShow = valueInInputFormat;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
if (focused && (inputProps === null || inputProps === void 0 ? void 0 : inputProps.value) !== value.current.lastInput) {
|
|
481
|
+
value.current.lastInput = inputProps === null || inputProps === void 0 ? void 0 : inputProps.value;
|
|
482
|
+
value.current.toShow = inputProps === null || inputProps === void 0 ? void 0 : inputProps.value;
|
|
483
|
+
}
|
|
484
|
+
return React__default["default"].createElement(material.TextField, __assign({}, props, { inputProps: __assign(__assign({}, inputProps), { value: value.current.toShow || '' }) }));
|
|
485
|
+
};
|
|
476
486
|
|
|
477
487
|
var renderLayoutElements = function (elements, schema, path, enabled, renderers, cells) {
|
|
478
488
|
return elements.map(function (child, index) { return (React__default["default"].createElement(material.Grid, { item: true, key: path + "-" + index, xs: true },
|
|
@@ -497,9 +507,9 @@ var withAjvProps = function (Component) {
|
|
|
497
507
|
};
|
|
498
508
|
};
|
|
499
509
|
|
|
500
|
-
var eventToValue$
|
|
510
|
+
var eventToValue$3 = function (ev) { return ev.target.value; };
|
|
501
511
|
var useDebouncedChange = function (handleChange, defaultValue, data, path, eventToValueFunction, timeout) {
|
|
502
|
-
if (eventToValueFunction === void 0) { eventToValueFunction = eventToValue$
|
|
512
|
+
if (eventToValueFunction === void 0) { eventToValueFunction = eventToValue$3; }
|
|
503
513
|
if (timeout === void 0) { timeout = 300; }
|
|
504
514
|
var _a = React.useState(data !== null && data !== void 0 ? data : defaultValue), input = _a[0], setInput = _a[1];
|
|
505
515
|
React.useEffect(function () {
|
|
@@ -522,27 +532,39 @@ var useFocus = function () {
|
|
|
522
532
|
return [focused, onFocus, onBlur];
|
|
523
533
|
};
|
|
524
534
|
|
|
535
|
+
var i18nDefaults = {
|
|
536
|
+
'enum.none': 'None'
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
var MuiSelect = React__default["default"].memo(function (props) {
|
|
540
|
+
var data = props.data, className = props.className, id = props.id, enabled = props.enabled, schema = props.schema, uischema = props.uischema, path = props.path, handleChange = props.handleChange, options = props.options, config = props.config, t = props.t;
|
|
541
|
+
var appliedUiSchemaOptions = merge__default["default"]({}, config, uischema.options);
|
|
542
|
+
var noneOptionLabel = React.useMemo(function () { return t('enum.none', i18nDefaults['enum.none'], { schema: schema, uischema: uischema, path: path }); }, [t, schema, uischema, path]);
|
|
543
|
+
return (React__default["default"].createElement(material.Select, { className: className, id: id, disabled: !enabled, autoFocus: appliedUiSchemaOptions.focus, value: data !== undefined ? data : '', onChange: function (ev) { return handleChange(path, ev.target.value || undefined); }, fullWidth: true, variant: 'standard' }, [React__default["default"].createElement(material.MenuItem, { value: '', key: 'jsonforms.enum.none' },
|
|
544
|
+
React__default["default"].createElement("em", null, noneOptionLabel))].concat(options.map(function (optionValue) { return (React__default["default"].createElement(material.MenuItem, { value: optionValue.value, key: optionValue.value }, optionValue.label)); }))));
|
|
545
|
+
});
|
|
546
|
+
|
|
525
547
|
var toNumber$1 = function (value) {
|
|
526
548
|
return value === '' ? undefined : parseInt(value, 10);
|
|
527
549
|
};
|
|
528
|
-
var eventToValue$
|
|
550
|
+
var eventToValue$2 = function (ev) { return toNumber$1(ev.target.value); };
|
|
529
551
|
var MuiInputInteger = React__default["default"].memo(function (props) {
|
|
530
552
|
var data = props.data, className = props.className, id = props.id, enabled = props.enabled, uischema = props.uischema, path = props.path, handleChange = props.handleChange, config = props.config;
|
|
531
553
|
var inputProps = { step: '1' };
|
|
532
554
|
var appliedUiSchemaOptions = merge__default["default"]({}, config, uischema.options);
|
|
533
|
-
var _a = useDebouncedChange(handleChange, '', data, path, eventToValue$
|
|
555
|
+
var _a = useDebouncedChange(handleChange, '', data, path, eventToValue$2), inputValue = _a[0], onChange = _a[1];
|
|
534
556
|
return (React__default["default"].createElement(material.Input, { type: 'number', value: inputValue, onChange: onChange, className: className, id: id, disabled: !enabled, autoFocus: appliedUiSchemaOptions.focus, inputProps: inputProps, fullWidth: true }));
|
|
535
557
|
});
|
|
536
558
|
|
|
537
559
|
var toNumber = function (value) {
|
|
538
560
|
return value === '' ? undefined : parseFloat(value);
|
|
539
561
|
};
|
|
540
|
-
var eventToValue = function (ev) { return toNumber(ev.target.value); };
|
|
562
|
+
var eventToValue$1 = function (ev) { return toNumber(ev.target.value); };
|
|
541
563
|
var MuiInputNumber = React__default["default"].memo(function (props) {
|
|
542
564
|
var data = props.data, className = props.className, id = props.id, enabled = props.enabled, uischema = props.uischema, path = props.path, handleChange = props.handleChange, config = props.config;
|
|
543
565
|
var inputProps = { step: '0.1' };
|
|
544
566
|
var appliedUiSchemaOptions = merge__default["default"]({}, config, uischema.options);
|
|
545
|
-
var _a = useDebouncedChange(handleChange, '', data, path, eventToValue), inputValue = _a[0], onChange = _a[1];
|
|
567
|
+
var _a = useDebouncedChange(handleChange, '', data, path, eventToValue$1), inputValue = _a[0], onChange = _a[1];
|
|
546
568
|
return (React__default["default"].createElement(material.Input, { type: 'number', value: inputValue, onChange: onChange, className: className, id: id, disabled: !enabled, autoFocus: appliedUiSchemaOptions.focus, inputProps: inputProps, fullWidth: true }));
|
|
547
569
|
});
|
|
548
570
|
|
|
@@ -563,6 +585,7 @@ var MuiInputNumberFormat = React__default["default"].memo(function (props) {
|
|
|
563
585
|
return (React__default["default"].createElement(material.Input, { type: 'text', value: inputValue, onChange: onChange, className: className, id: id, disabled: !enabled, autoFocus: appliedUiSchemaOptions.focus, multiline: appliedUiSchemaOptions.multi, fullWidth: !appliedUiSchemaOptions.trim || maxLength === undefined, inputProps: inputProps, error: !isValid }));
|
|
564
586
|
});
|
|
565
587
|
|
|
588
|
+
var eventToValue = function (ev) { return ev.target.value === '' ? undefined : ev.target.value; };
|
|
566
589
|
var MuiInputText = React__default["default"].memo(function (props) {
|
|
567
590
|
var _a, _b, _c;
|
|
568
591
|
var _d = React.useState(false), showAdornment = _d[0], setShowAdornment = _d[1];
|
|
@@ -580,7 +603,7 @@ var MuiInputText = React__default["default"].memo(function (props) {
|
|
|
580
603
|
if (appliedUiSchemaOptions.trim && maxLength !== undefined) {
|
|
581
604
|
inputProps.size = maxLength;
|
|
582
605
|
}
|
|
583
|
-
var _e = useDebouncedChange(handleChange, '', data, path), inputText = _e[0], onChange = _e[1], onClear = _e[2];
|
|
606
|
+
var _e = useDebouncedChange(handleChange, '', data, path, eventToValue), inputText = _e[0], onChange = _e[1], onClear = _e[2];
|
|
584
607
|
var onPointerEnter = function () { return setShowAdornment(true); };
|
|
585
608
|
var onPointerLeave = function () { return setShowAdornment(false); };
|
|
586
609
|
var theme = material.useTheme();
|
|
@@ -644,12 +667,11 @@ var materialArrayControlTester = core.rankWith(3, core.or(core.isObjectArrayCont
|
|
|
644
667
|
|
|
645
668
|
var materialLabelRendererTester = core.rankWith(1, core.uiTypeIs('Label'));
|
|
646
669
|
var MaterialLabelRenderer = function (_a) {
|
|
647
|
-
var
|
|
648
|
-
var labelElement = uischema;
|
|
670
|
+
var text = _a.text, visible = _a.visible;
|
|
649
671
|
return (React__default["default"].createElement(material.Hidden, { xsUp: !visible },
|
|
650
|
-
React__default["default"].createElement(material.Typography, { variant: 'h6' },
|
|
672
|
+
React__default["default"].createElement(material.Typography, { variant: 'h6' }, text)));
|
|
651
673
|
};
|
|
652
|
-
var MaterialLabelRenderer$1 = react.
|
|
674
|
+
var MaterialLabelRenderer$1 = react.withJsonFormsLabelProps(MaterialLabelRenderer);
|
|
653
675
|
|
|
654
676
|
var ArrayLayoutToolbar = React__default["default"].memo(function (_a) {
|
|
655
677
|
var label = _a.label, errors = _a.errors, addItem = _a.addItem, path = _a.path, createDefault = _a.createDefault;
|
|
@@ -698,6 +720,9 @@ var MaterialListWithDetailRenderer = function (_a) {
|
|
|
698
720
|
return core.findUISchema(uischemas, schema, uischema.scope, path, undefined, uischema, rootSchema);
|
|
699
721
|
}, [uischemas, schema, uischema.scope, path, uischema, rootSchema]);
|
|
700
722
|
var appliedUiSchemaOptions = merge__default["default"]({}, config, uischema.options);
|
|
723
|
+
React__default["default"].useEffect(function () {
|
|
724
|
+
setSelectedIndex(undefined);
|
|
725
|
+
}, [schema]);
|
|
701
726
|
return (React__default["default"].createElement(material.Hidden, { xsUp: !visible },
|
|
702
727
|
React__default["default"].createElement(ArrayLayoutToolbar, { label: core.computeLabel(label, required, appliedUiSchemaOptions.hideRequiredAsterisk), errors: errors, path: path, addItem: addItem, createDefault: handleCreateDefaultValue }),
|
|
703
728
|
React__default["default"].createElement(material.Grid, { container: true, direction: 'row', spacing: 2 },
|
|
@@ -755,24 +780,40 @@ var MaterialInputControl = function (props) {
|
|
|
755
780
|
|
|
756
781
|
var MuiAutocomplete = function (props) {
|
|
757
782
|
var _a;
|
|
758
|
-
var data = props.data, className = props.className, id = props.id, enabled = props.enabled, uischema = props.uischema, path = props.path, handleChange = props.handleChange, options = props.options, config = props.config, getOptionLabel = props.getOptionLabel, renderOption = props.renderOption, filterOptions = props.filterOptions;
|
|
783
|
+
var description = props.description, errors = props.errors, visible = props.visible, required = props.required, label = props.label, data = props.data, className = props.className, id = props.id, enabled = props.enabled, uischema = props.uischema, path = props.path, handleChange = props.handleChange, options = props.options, config = props.config, getOptionLabel = props.getOptionLabel, renderOption = props.renderOption, filterOptions = props.filterOptions, isValid = props.isValid;
|
|
759
784
|
var appliedUiSchemaOptions = merge__default["default"]({}, config, uischema.options);
|
|
760
785
|
var _b = React__default["default"].useState(data !== null && data !== void 0 ? data : ''), inputValue = _b[0], setInputValue = _b[1];
|
|
786
|
+
var _c = useFocus(), focused = _c[0], onFocus = _c[1], onBlur = _c[2];
|
|
761
787
|
var findOption = (_a = options.find(function (o) { return o.value === data; })) !== null && _a !== void 0 ? _a : null;
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
788
|
+
var showDescription = !core.isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
789
|
+
var firstFormHelperText = showDescription
|
|
790
|
+
? description
|
|
791
|
+
: !isValid
|
|
792
|
+
? errors
|
|
793
|
+
: null;
|
|
794
|
+
var secondFormHelperText = showDescription && !isValid ? errors : null;
|
|
795
|
+
return (React__default["default"].createElement(material.Hidden, { xsUp: !visible },
|
|
796
|
+
React__default["default"].createElement(material.Autocomplete, { className: className, id: id, disabled: !enabled, value: findOption, onChange: function (_event, newValue) {
|
|
797
|
+
handleChange(path, newValue === null || newValue === void 0 ? void 0 : newValue.value);
|
|
798
|
+
}, inputValue: inputValue, onInputChange: function (_event, newInputValue) {
|
|
799
|
+
setInputValue(newInputValue);
|
|
800
|
+
}, autoHighlight: true, autoSelect: true, autoComplete: true, fullWidth: true, options: options, getOptionLabel: getOptionLabel || (function (option) { return option === null || option === void 0 ? void 0 : option.label; }), freeSolo: false, renderInput: function (params) {
|
|
801
|
+
return (React__default["default"].createElement(material.TextField, __assign({ label: label, variant: 'standard', type: 'text', inputProps: params.inputProps, inputRef: params.InputProps.ref, autoFocus: appliedUiSchemaOptions.focus, disabled: !enabled }, params, { id: id + '-input', required: required && !appliedUiSchemaOptions.hideRequiredAsterisk, error: !isValid, fullWidth: !appliedUiSchemaOptions.trim, InputLabelProps: data ? { shrink: true } : undefined, onFocus: onFocus, onBlur: onBlur, focused: focused })));
|
|
802
|
+
}, renderOption: renderOption, filterOptions: filterOptions }),
|
|
803
|
+
React__default["default"].createElement(material.FormHelperText, { error: !isValid && !showDescription }, firstFormHelperText),
|
|
804
|
+
React__default["default"].createElement(material.FormHelperText, { error: !isValid }, secondFormHelperText)));
|
|
767
805
|
};
|
|
768
806
|
|
|
769
807
|
var MaterialEnumControl = function (props) {
|
|
770
|
-
var config = props.config, uischema = props.uischema;
|
|
808
|
+
var config = props.config, uischema = props.uischema, errors = props.errors;
|
|
771
809
|
var appliedUiSchemaOptions = merge__default["default"]({}, config, uischema.options);
|
|
772
|
-
|
|
810
|
+
var isValid = errors.length === 0;
|
|
811
|
+
return (appliedUiSchemaOptions.autocomplete === false ?
|
|
812
|
+
React__default["default"].createElement(MaterialInputControl, __assign({}, props, { input: MuiSelect })) :
|
|
813
|
+
React__default["default"].createElement(MuiAutocomplete, __assign({}, props, { isValid: isValid })));
|
|
773
814
|
};
|
|
774
815
|
var materialEnumControlTester = core.rankWith(2, core.isEnumControl);
|
|
775
|
-
var MaterialEnumControl$1 = react.withJsonFormsEnumProps(MaterialEnumControl);
|
|
816
|
+
var MaterialEnumControl$1 = react.withJsonFormsEnumProps(react.withTranslateProps(React__default["default"].memo(MaterialEnumControl)), false);
|
|
776
817
|
|
|
777
818
|
var MaterialNativeControl = function (props) {
|
|
778
819
|
var _a;
|
|
@@ -790,14 +831,15 @@ var materialNativeControlTester = core.rankWith(2, core.or(core.isDateControl, c
|
|
|
790
831
|
var MaterialNativeControl$1 = react.withJsonFormsControlProps(MaterialNativeControl);
|
|
791
832
|
|
|
792
833
|
var MaterialDateControl = function (props) {
|
|
793
|
-
var _a, _b;
|
|
794
|
-
var
|
|
834
|
+
var _a, _b, _c;
|
|
835
|
+
var _d = useFocus(), focused = _d[0], onFocus = _d[1], onBlur = _d[2];
|
|
795
836
|
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;
|
|
796
837
|
var isValid = errors.length === 0;
|
|
797
838
|
var appliedUiSchemaOptions = merge__default["default"]({}, config, uischema.options);
|
|
798
839
|
var showDescription = !core.isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
799
840
|
var format = (_a = appliedUiSchemaOptions.dateFormat) !== null && _a !== void 0 ? _a : 'YYYY-MM-DD';
|
|
800
841
|
var saveFormat = (_b = appliedUiSchemaOptions.dateSaveFormat) !== null && _b !== void 0 ? _b : 'YYYY-MM-DD';
|
|
842
|
+
var views = (_c = appliedUiSchemaOptions.views) !== null && _c !== void 0 ? _c : ['year', 'day'];
|
|
801
843
|
var firstFormHelperText = showDescription
|
|
802
844
|
? description
|
|
803
845
|
: !isValid
|
|
@@ -805,9 +847,15 @@ var MaterialDateControl = function (props) {
|
|
|
805
847
|
: null;
|
|
806
848
|
var secondFormHelperText = showDescription && !isValid ? errors : null;
|
|
807
849
|
var onChange = React.useMemo(function () { return createOnChangeHandler(path, handleChange, saveFormat); }, [path, handleChange, saveFormat]);
|
|
850
|
+
var value = getData(data, saveFormat);
|
|
851
|
+
var valueInInputFormat = value ? value.format(format) : '';
|
|
808
852
|
return (React__default["default"].createElement(material.Hidden, { xsUp: !visible },
|
|
809
|
-
React__default["default"].createElement(
|
|
810
|
-
React__default["default"].createElement(
|
|
853
|
+
React__default["default"].createElement(xDatePickers.LocalizationProvider, { dateAdapter: AdapterDayjs.AdapterDayjs },
|
|
854
|
+
React__default["default"].createElement(xDatePickers.DatePicker, { label: label, value: value, onChange: onChange, inputFormat: format, disableMaskedInput: true, views: views, disabled: !enabled, componentsProps: {
|
|
855
|
+
actionBar: {
|
|
856
|
+
actions: function (variant) { return (variant === 'desktop' ? [] : ['clear', 'cancel', 'accept']); }
|
|
857
|
+
}
|
|
858
|
+
}, renderInput: function (params) { return (React__default["default"].createElement(ResettableTextField, __assign({}, params, { rawValue: data, dayjsValueIsValid: value !== null, valueInInputFormat: valueInInputFormat, focused: focused, id: id + '-input', required: required && !appliedUiSchemaOptions.hideRequiredAsterisk, autoFocus: appliedUiSchemaOptions.focus, error: !isValid, fullWidth: !appliedUiSchemaOptions.trim, inputProps: __assign(__assign({}, params.inputProps), { type: 'text' }), InputLabelProps: data ? { shrink: true } : undefined, onFocus: onFocus, onBlur: onBlur, variant: 'standard' }))); } }),
|
|
811
859
|
React__default["default"].createElement(material.FormHelperText, { error: !isValid && !showDescription }, firstFormHelperText),
|
|
812
860
|
React__default["default"].createElement(material.FormHelperText, { error: !isValid }, secondFormHelperText))));
|
|
813
861
|
};
|
|
@@ -815,14 +863,15 @@ var materialDateControlTester = core.rankWith(4, core.isDateControl);
|
|
|
815
863
|
var MaterialDateControl$1 = react.withJsonFormsControlProps(MaterialDateControl);
|
|
816
864
|
|
|
817
865
|
var MaterialDateTimeControl = function (props) {
|
|
818
|
-
var _a, _b;
|
|
819
|
-
var
|
|
866
|
+
var _a, _b, _c;
|
|
867
|
+
var _d = useFocus(), focused = _d[0], onFocus = _d[1], onBlur = _d[2];
|
|
820
868
|
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;
|
|
821
869
|
var appliedUiSchemaOptions = merge__default["default"]({}, config, uischema.options);
|
|
822
870
|
var isValid = errors.length === 0;
|
|
823
871
|
var showDescription = !core.isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
824
872
|
var format = (_a = appliedUiSchemaOptions.dateTimeFormat) !== null && _a !== void 0 ? _a : 'YYYY-MM-DD HH:mm';
|
|
825
873
|
var saveFormat = (_b = appliedUiSchemaOptions.dateTimeSaveFormat) !== null && _b !== void 0 ? _b : undefined;
|
|
874
|
+
var views = (_c = appliedUiSchemaOptions.views) !== null && _c !== void 0 ? _c : ['year', 'day', 'hours', 'minutes'];
|
|
826
875
|
var firstFormHelperText = showDescription
|
|
827
876
|
? description
|
|
828
877
|
: !isValid
|
|
@@ -830,9 +879,15 @@ var MaterialDateTimeControl = function (props) {
|
|
|
830
879
|
: null;
|
|
831
880
|
var secondFormHelperText = showDescription && !isValid ? errors : null;
|
|
832
881
|
var onChange = React.useMemo(function () { return createOnChangeHandler(path, handleChange, saveFormat); }, [path, handleChange, saveFormat]);
|
|
882
|
+
var value = getData(data, saveFormat);
|
|
883
|
+
var valueInInputFormat = value ? value.format(format) : '';
|
|
833
884
|
return (React__default["default"].createElement(material.Hidden, { xsUp: !visible },
|
|
834
|
-
React__default["default"].createElement(
|
|
835
|
-
React__default["default"].createElement(
|
|
885
|
+
React__default["default"].createElement(xDatePickers.LocalizationProvider, { dateAdapter: AdapterDayjs.AdapterDayjs },
|
|
886
|
+
React__default["default"].createElement(xDatePickers.DateTimePicker, { label: label, value: value, onChange: onChange, inputFormat: format, disableMaskedInput: true, ampm: !!appliedUiSchemaOptions.ampm, views: views, disabled: !enabled, componentsProps: {
|
|
887
|
+
actionBar: {
|
|
888
|
+
actions: function (variant) { return (variant === 'desktop' ? [] : ['clear', 'cancel', 'accept']); }
|
|
889
|
+
}
|
|
890
|
+
}, renderInput: function (params) { return (React__default["default"].createElement(ResettableTextField, __assign({}, params, { rawValue: data, dayjsValueIsValid: value !== null, valueInInputFormat: valueInInputFormat, focused: focused, id: id + '-input', required: required && !appliedUiSchemaOptions.hideRequiredAsterisk, autoFocus: appliedUiSchemaOptions.focus, error: !isValid, fullWidth: !appliedUiSchemaOptions.trim, inputProps: __assign(__assign({}, params.inputProps), { type: 'text' }), InputLabelProps: data ? { shrink: true } : undefined, onFocus: onFocus, onBlur: onBlur, variant: 'standard' }))); } }),
|
|
836
891
|
React__default["default"].createElement(material.FormHelperText, { error: !isValid && !showDescription }, firstFormHelperText),
|
|
837
892
|
React__default["default"].createElement(material.FormHelperText, { error: !isValid }, secondFormHelperText))));
|
|
838
893
|
};
|
|
@@ -840,14 +895,15 @@ var materialDateTimeControlTester = core.rankWith(2, core.isDateTimeControl);
|
|
|
840
895
|
var MaterialDateTimeControl$1 = react.withJsonFormsControlProps(MaterialDateTimeControl);
|
|
841
896
|
|
|
842
897
|
var MaterialTimeControl = function (props) {
|
|
843
|
-
var _a, _b;
|
|
844
|
-
var
|
|
898
|
+
var _a, _b, _c;
|
|
899
|
+
var _d = useFocus(), focused = _d[0], onFocus = _d[1], onBlur = _d[2];
|
|
845
900
|
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;
|
|
846
901
|
var appliedUiSchemaOptions = merge__default["default"]({}, config, uischema.options);
|
|
847
902
|
var isValid = errors.length === 0;
|
|
848
903
|
var showDescription = !core.isDescriptionHidden(visible, description, focused, appliedUiSchemaOptions.showUnfocusedDescription);
|
|
849
904
|
var format = (_a = appliedUiSchemaOptions.timeFormat) !== null && _a !== void 0 ? _a : 'HH:mm';
|
|
850
905
|
var saveFormat = (_b = appliedUiSchemaOptions.timeSaveFormat) !== null && _b !== void 0 ? _b : 'HH:mm:ss';
|
|
906
|
+
var views = (_c = appliedUiSchemaOptions.views) !== null && _c !== void 0 ? _c : ['hours', 'minutes'];
|
|
851
907
|
var firstFormHelperText = showDescription
|
|
852
908
|
? description
|
|
853
909
|
: !isValid
|
|
@@ -855,9 +911,15 @@ var MaterialTimeControl = function (props) {
|
|
|
855
911
|
: null;
|
|
856
912
|
var secondFormHelperText = showDescription && !isValid ? errors : null;
|
|
857
913
|
var onChange = React.useMemo(function () { return createOnChangeHandler(path, handleChange, saveFormat); }, [path, handleChange, saveFormat]);
|
|
914
|
+
var value = getData(data, saveFormat);
|
|
915
|
+
var valueInInputFormat = value ? value.format(format) : '';
|
|
858
916
|
return (React__default["default"].createElement(material.Hidden, { xsUp: !visible },
|
|
859
|
-
React__default["default"].createElement(
|
|
860
|
-
React__default["default"].createElement(
|
|
917
|
+
React__default["default"].createElement(xDatePickers.LocalizationProvider, { dateAdapter: AdapterDayjs.AdapterDayjs },
|
|
918
|
+
React__default["default"].createElement(xDatePickers.TimePicker, { label: label, value: value, onChange: onChange, inputFormat: format, disableMaskedInput: true, ampm: !!appliedUiSchemaOptions.ampm, views: views, disabled: !enabled, componentsProps: {
|
|
919
|
+
actionBar: {
|
|
920
|
+
actions: function (variant) { return (variant === 'desktop' ? [] : ['clear', 'cancel', 'accept']); }
|
|
921
|
+
}
|
|
922
|
+
}, renderInput: function (params) { return (React__default["default"].createElement(ResettableTextField, __assign({}, params, { rawValue: data, dayjsValueIsValid: value !== null, valueInInputFormat: valueInInputFormat, focused: focused, id: id + '-input', required: required && !appliedUiSchemaOptions.hideRequiredAsterisk, autoFocus: appliedUiSchemaOptions.focus, error: !isValid, fullWidth: !appliedUiSchemaOptions.trim, inputProps: __assign(__assign({}, params.inputProps), { type: 'text' }), InputLabelProps: data ? { shrink: true } : undefined, onFocus: onFocus, onBlur: onBlur, variant: 'standard' }))); } }),
|
|
861
923
|
React__default["default"].createElement(material.FormHelperText, { error: !isValid && !showDescription }, firstFormHelperText),
|
|
862
924
|
React__default["default"].createElement(material.FormHelperText, { error: !isValid }, secondFormHelperText))));
|
|
863
925
|
};
|
|
@@ -900,7 +962,8 @@ var materialSliderControlTester = core.rankWith(4, core.isRangeControl);
|
|
|
900
962
|
var MaterialSliderControl$1 = react.withJsonFormsControlProps(MaterialSliderControl);
|
|
901
963
|
|
|
902
964
|
var MaterialRadioGroup = function (props) {
|
|
903
|
-
var _a
|
|
965
|
+
var _a;
|
|
966
|
+
var _b = useFocus(), focused = _b[0], onFocus = _b[1], onBlur = _b[2];
|
|
904
967
|
var config = props.config, id = props.id, label = props.label, required = props.required, description = props.description, errors = props.errors, data = props.data, visible = props.visible, options = props.options, handleChange = props.handleChange, path = props.path, enabled = props.enabled;
|
|
905
968
|
var isValid = errors.length === 0;
|
|
906
969
|
var appliedUiSchemaOptions = merge__default["default"]({}, config, props.uischema.options);
|
|
@@ -909,7 +972,7 @@ var MaterialRadioGroup = function (props) {
|
|
|
909
972
|
return (React__default["default"].createElement(material.Hidden, { xsUp: !visible },
|
|
910
973
|
React__default["default"].createElement(material.FormControl, { component: 'fieldset', fullWidth: !appliedUiSchemaOptions.trim, onFocus: onFocus, onBlur: onBlur },
|
|
911
974
|
React__default["default"].createElement(material.FormLabel, { htmlFor: id, error: !isValid, component: 'legend', required: core.showAsRequired(required, appliedUiSchemaOptions.hideRequiredAsterisk) }, label),
|
|
912
|
-
React__default["default"].createElement(material.RadioGroup, { value: props.data, onChange: onChange, row: true }, options.map(function (option) { return (React__default["default"].createElement(material.FormControlLabel, { value: option.value, key: option.label, control: React__default["default"].createElement(material.Radio, { checked: data === option.value }), label: option.label, disabled: !enabled })); })),
|
|
975
|
+
React__default["default"].createElement(material.RadioGroup, { value: (_a = props.data) !== null && _a !== void 0 ? _a : '', onChange: onChange, row: true }, options.map(function (option) { return (React__default["default"].createElement(material.FormControlLabel, { value: option.value, key: option.label, control: React__default["default"].createElement(material.Radio, { checked: data === option.value }), label: option.label, disabled: !enabled })); })),
|
|
913
976
|
React__default["default"].createElement(material.FormHelperText, { error: !isValid }, !isValid ? errors : showDescription ? description : null))));
|
|
914
977
|
};
|
|
915
978
|
|
|
@@ -980,12 +1043,15 @@ var materialAnyOfStringOrEnumControlTester = core.rankWith(5, simpleAnyOf);
|
|
|
980
1043
|
var MaterialAnyOfStringOrEnumControl$1 = react.withJsonFormsControlProps(MaterialAnyOfStringOrEnumControl);
|
|
981
1044
|
|
|
982
1045
|
var MaterialOneOfEnumControl = function (props) {
|
|
983
|
-
var config = props.config, uischema = props.uischema;
|
|
1046
|
+
var config = props.config, uischema = props.uischema, errors = props.errors;
|
|
984
1047
|
var appliedUiSchemaOptions = merge__default["default"]({}, config, uischema.options);
|
|
985
|
-
|
|
1048
|
+
var isValid = errors.length === 0;
|
|
1049
|
+
return (appliedUiSchemaOptions.autocomplete === false ?
|
|
1050
|
+
React__default["default"].createElement(MaterialInputControl, __assign({}, props, { input: MuiSelect })) :
|
|
1051
|
+
React__default["default"].createElement(MuiAutocomplete, __assign({}, props, { isValid: isValid })));
|
|
986
1052
|
};
|
|
987
1053
|
var materialOneOfEnumControlTester = core.rankWith(5, core.isOneOfEnumControl);
|
|
988
|
-
var MaterialOneOfEnumControl$1 = react.withJsonFormsOneOfEnumProps(MaterialOneOfEnumControl);
|
|
1054
|
+
var MaterialOneOfEnumControl$1 = react.withJsonFormsOneOfEnumProps(react.withTranslateProps(React__default["default"].memo(MaterialOneOfEnumControl)), false);
|
|
989
1055
|
|
|
990
1056
|
var MaterialOneOfRadioGroupControl = function (props) {
|
|
991
1057
|
return React__default["default"].createElement(MaterialRadioGroup, __assign({}, props));
|
|
@@ -1014,18 +1080,18 @@ var Unwrapped = {
|
|
|
1014
1080
|
var groupTester = core.rankWith(1, core.uiTypeIs('Group'));
|
|
1015
1081
|
var style = { marginBottom: '10px' };
|
|
1016
1082
|
var GroupComponent = React__default["default"].memo(function (_a) {
|
|
1017
|
-
var visible = _a.visible, enabled = _a.enabled, uischema = _a.uischema, props = __rest(_a, ["visible", "enabled", "uischema"]);
|
|
1083
|
+
var visible = _a.visible, enabled = _a.enabled, uischema = _a.uischema, label = _a.label, props = __rest(_a, ["visible", "enabled", "uischema", "label"]);
|
|
1018
1084
|
var groupLayout = uischema;
|
|
1019
1085
|
return (React__default["default"].createElement(material.Hidden, { xsUp: !visible },
|
|
1020
1086
|
React__default["default"].createElement(material.Card, { style: style },
|
|
1021
|
-
!isEmpty__default["default"](
|
|
1087
|
+
!isEmpty__default["default"](label) && (React__default["default"].createElement(material.CardHeader, { title: label })),
|
|
1022
1088
|
React__default["default"].createElement(material.CardContent, null,
|
|
1023
1089
|
React__default["default"].createElement(MaterialLayoutRenderer, __assign({}, props, { visible: visible, enabled: enabled, elements: groupLayout.elements }))))));
|
|
1024
1090
|
});
|
|
1025
1091
|
var MaterializedGroupLayoutRenderer = function (_a) {
|
|
1026
|
-
var uischema = _a.uischema, schema = _a.schema, path = _a.path, visible = _a.visible, enabled = _a.enabled, renderers = _a.renderers, cells = _a.cells, direction = _a.direction;
|
|
1092
|
+
var uischema = _a.uischema, schema = _a.schema, path = _a.path, visible = _a.visible, enabled = _a.enabled, renderers = _a.renderers, cells = _a.cells, direction = _a.direction, label = _a.label;
|
|
1027
1093
|
var groupLayout = uischema;
|
|
1028
|
-
return (React__default["default"].createElement(GroupComponent, { elements: groupLayout.elements, schema: schema, path: path, direction: direction, visible: visible, enabled: enabled, uischema: uischema, renderers: renderers, cells: cells }));
|
|
1094
|
+
return (React__default["default"].createElement(GroupComponent, { elements: groupLayout.elements, schema: schema, path: path, direction: direction, visible: visible, enabled: enabled, uischema: uischema, renderers: renderers, cells: cells, label: label }));
|
|
1029
1095
|
};
|
|
1030
1096
|
var MaterialGroupLayout = react.withJsonFormsLayoutProps(MaterializedGroupLayoutRenderer);
|
|
1031
1097
|
var materialGroupTester = core.withIncreasedRank(1, groupTester);
|
|
@@ -1069,12 +1135,12 @@ var isSingleLevelCategorization = core.and(core.uiTypeIs('Categorization'), func
|
|
|
1069
1135
|
});
|
|
1070
1136
|
var materialCategorizationTester = core.rankWith(1, isSingleLevelCategorization);
|
|
1071
1137
|
var MaterialCategorizationLayoutRenderer = function (props) {
|
|
1072
|
-
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;
|
|
1138
|
+
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;
|
|
1073
1139
|
var categorization = uischema;
|
|
1074
1140
|
var _a = React.useState(selected !== null && selected !== void 0 ? selected : 0), activeCategory = _a[0], setActiveCategory = _a[1];
|
|
1075
|
-
var categories = categorization.elements.filter(function (category) {
|
|
1141
|
+
var categories = React.useMemo(function () { return categorization.elements.filter(function (category) {
|
|
1076
1142
|
return core.isVisible(category, data, undefined, ajv);
|
|
1077
|
-
});
|
|
1143
|
+
}); }, [categorization, data, ajv]);
|
|
1078
1144
|
var childProps = {
|
|
1079
1145
|
elements: categories[activeCategory].elements,
|
|
1080
1146
|
schema: schema,
|
|
@@ -1091,13 +1157,18 @@ var MaterialCategorizationLayoutRenderer = function (props) {
|
|
|
1091
1157
|
}
|
|
1092
1158
|
setActiveCategory(value);
|
|
1093
1159
|
};
|
|
1160
|
+
var tabLabels = React.useMemo(function () {
|
|
1161
|
+
return categories.map(function (e) {
|
|
1162
|
+
return core.deriveLabelForUISchemaElement(e, t);
|
|
1163
|
+
});
|
|
1164
|
+
}, [categories, t]);
|
|
1094
1165
|
return (React__default["default"].createElement(material.Hidden, { xsUp: !visible },
|
|
1095
1166
|
React__default["default"].createElement(material.AppBar, { position: 'static' },
|
|
1096
|
-
React__default["default"].createElement(material.Tabs, { value: activeCategory, onChange: onTabChange, textColor: 'inherit', indicatorColor: 'secondary', variant: 'scrollable' }, categories.map(function (
|
|
1167
|
+
React__default["default"].createElement(material.Tabs, { value: activeCategory, onChange: onTabChange, textColor: 'inherit', indicatorColor: 'secondary', variant: 'scrollable' }, categories.map(function (_, idx) { return (React__default["default"].createElement(material.Tab, { key: idx, label: tabLabels[idx] })); }))),
|
|
1097
1168
|
React__default["default"].createElement("div", { style: { marginTop: '0.5em' } },
|
|
1098
1169
|
React__default["default"].createElement(MaterialLayoutRenderer, __assign({}, childProps)))));
|
|
1099
1170
|
};
|
|
1100
|
-
var MaterialCategorizationLayout = react.withJsonFormsLayoutProps(
|
|
1171
|
+
var MaterialCategorizationLayout = withAjvProps(react.withTranslateProps(react.withJsonFormsLayoutProps(MaterialCategorizationLayoutRenderer)));
|
|
1101
1172
|
|
|
1102
1173
|
var iconStyle = { float: 'right' };
|
|
1103
1174
|
var ExpandPanelRendererComponent = function (props) {
|
|
@@ -1234,7 +1305,7 @@ var MaterialDateCell$1 = react.withJsonFormsCellProps(MaterialDateCell);
|
|
|
1234
1305
|
|
|
1235
1306
|
var MaterialEnumCell = function (props) { return (React__default["default"].createElement(MuiSelect, __assign({}, props))); };
|
|
1236
1307
|
var materialEnumCellTester = core.rankWith(2, core.isEnumControl);
|
|
1237
|
-
var MaterialEnumCell$1 = react.withJsonFormsEnumCellProps(MaterialEnumCell);
|
|
1308
|
+
var MaterialEnumCell$1 = react.withJsonFormsEnumCellProps(react.withTranslateProps(React__default["default"].memo(MaterialEnumCell)), false);
|
|
1238
1309
|
|
|
1239
1310
|
var MaterialIntegerCell = function (props) { return (React__default["default"].createElement(MuiInputInteger, __assign({}, props))); };
|
|
1240
1311
|
var materialIntegerCellTester = core.rankWith(2, core.isIntegerControl);
|
|
@@ -1250,7 +1321,7 @@ var MaterialNumberFormatCell$1 = react.withJsonFormsCellProps(MaterialNumberForm
|
|
|
1250
1321
|
|
|
1251
1322
|
var MaterialOneOfEnumCell = function (props) { return (React__default["default"].createElement(MuiSelect, __assign({}, props))); };
|
|
1252
1323
|
var materialOneOfEnumCellTester = core.rankWith(2, core.isOneOfEnumControl);
|
|
1253
|
-
var MaterialOneOfEnumCell$1 = react.withJsonFormsOneOfEnumCellProps(MaterialOneOfEnumCell);
|
|
1324
|
+
var MaterialOneOfEnumCell$1 = react.withJsonFormsOneOfEnumCellProps(react.withTranslateProps(React__default["default"].memo(MaterialOneOfEnumCell)), false);
|
|
1254
1325
|
|
|
1255
1326
|
var MaterialTextCell = function (props) { return (React__default["default"].createElement(MuiInputText, __assign({}, props))); };
|
|
1256
1327
|
var materialTextCellTester = core.rankWith(1, core.isStringControl);
|
|
@@ -1279,7 +1350,7 @@ var MaterialCategorizationStepperLayoutRenderer = function (props) {
|
|
|
1279
1350
|
var handleStep = function (step) {
|
|
1280
1351
|
setActiveCategory(step);
|
|
1281
1352
|
};
|
|
1282
|
-
var data = props.data, path = props.path, renderers = props.renderers, schema = props.schema, uischema = props.uischema, visible = props.visible, cells = props.cells, config = props.config, ajv = props.ajv;
|
|
1353
|
+
var data = props.data, path = props.path, renderers = props.renderers, schema = props.schema, uischema = props.uischema, visible = props.visible, cells = props.cells, config = props.config, ajv = props.ajv, t = props.t;
|
|
1283
1354
|
var categorization = uischema;
|
|
1284
1355
|
var appliedUiSchemaOptions = merge__default["default"]({}, config, uischema.options);
|
|
1285
1356
|
var buttonWrapperStyle = {
|
|
@@ -1293,9 +1364,9 @@ var MaterialCategorizationStepperLayoutRenderer = function (props) {
|
|
|
1293
1364
|
var buttonStyle = {
|
|
1294
1365
|
marginRight: '1em'
|
|
1295
1366
|
};
|
|
1296
|
-
var categories = categorization.elements.filter(function (category) {
|
|
1367
|
+
var categories = React.useMemo(function () { return categorization.elements.filter(function (category) {
|
|
1297
1368
|
return core.isVisible(category, data, undefined, ajv);
|
|
1298
|
-
});
|
|
1369
|
+
}); }, [categorization, data, ajv]);
|
|
1299
1370
|
var childProps = {
|
|
1300
1371
|
elements: categories[activeCategory].elements,
|
|
1301
1372
|
schema: schema,
|
|
@@ -1305,16 +1376,21 @@ var MaterialCategorizationStepperLayoutRenderer = function (props) {
|
|
|
1305
1376
|
renderers: renderers,
|
|
1306
1377
|
cells: cells
|
|
1307
1378
|
};
|
|
1379
|
+
var tabLabels = React.useMemo(function () {
|
|
1380
|
+
return categories.map(function (e) {
|
|
1381
|
+
return core.deriveLabelForUISchemaElement(e, t);
|
|
1382
|
+
});
|
|
1383
|
+
}, [categories, t]);
|
|
1308
1384
|
return (React__default["default"].createElement(material.Hidden, { xsUp: !visible },
|
|
1309
|
-
React__default["default"].createElement(material.Stepper, { activeStep: activeCategory, nonLinear: true }, categories.map(function (
|
|
1310
|
-
React__default["default"].createElement(material.StepButton, { onClick: function () { return handleStep(idx); } },
|
|
1385
|
+
React__default["default"].createElement(material.Stepper, { activeStep: activeCategory, nonLinear: true }, categories.map(function (_, idx) { return (React__default["default"].createElement(material.Step, { key: tabLabels[idx] },
|
|
1386
|
+
React__default["default"].createElement(material.StepButton, { onClick: function () { return handleStep(idx); } }, tabLabels[idx]))); })),
|
|
1311
1387
|
React__default["default"].createElement("div", null,
|
|
1312
1388
|
React__default["default"].createElement(MaterialLayoutRenderer, __assign({}, childProps))),
|
|
1313
1389
|
!!appliedUiSchemaOptions.showNavButtons ? (React__default["default"].createElement("div", { style: buttonWrapperStyle },
|
|
1314
1390
|
React__default["default"].createElement(material.Button, { style: buttonNextStyle, variant: "contained", color: "primary", disabled: activeCategory >= categories.length - 1, onClick: function () { return handleStep(activeCategory + 1); } }, "Next"),
|
|
1315
1391
|
React__default["default"].createElement(material.Button, { style: buttonStyle, color: "secondary", variant: "contained", disabled: activeCategory <= 0, onClick: function () { return handleStep(activeCategory - 1); } }, "Previous"))) : (React__default["default"].createElement(React__default["default"].Fragment, null))));
|
|
1316
1392
|
};
|
|
1317
|
-
var MaterialCategorizationStepperLayout = react.withJsonFormsLayoutProps(
|
|
1393
|
+
var MaterialCategorizationStepperLayout = withAjvProps(react.withTranslateProps(react.withJsonFormsLayoutProps(MaterialCategorizationStepperLayoutRenderer)));
|
|
1318
1394
|
|
|
1319
1395
|
var materialRenderers = [
|
|
1320
1396
|
{
|
|
@@ -1433,9 +1509,11 @@ exports.MuiInputNumberFormat = MuiInputNumberFormat;
|
|
|
1433
1509
|
exports.MuiInputText = MuiInputText;
|
|
1434
1510
|
exports.MuiInputTime = MuiInputTime;
|
|
1435
1511
|
exports.MuiSelect = MuiSelect;
|
|
1512
|
+
exports.ResettableTextField = ResettableTextField;
|
|
1436
1513
|
exports.Unwrapped = Unwrapped;
|
|
1437
1514
|
exports.createOnChangeHandler = createOnChangeHandler;
|
|
1438
1515
|
exports.getData = getData;
|
|
1516
|
+
exports.i18nDefaults = i18nDefaults;
|
|
1439
1517
|
exports.materialAllOfControlTester = materialAllOfControlTester;
|
|
1440
1518
|
exports.materialAnyOfControlTester = materialAnyOfControlTester;
|
|
1441
1519
|
exports.materialAnyOfStringOrEnumControlTester = materialAnyOfStringOrEnumControlTester;
|