@jsonforms/material-renderers 2.5.2-alpha.0 → 3.0.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/README.md +1 -1
- package/docs/assets/js/search.json +1 -1
- package/docs/classes/combinatorproperties.html +2 -5
- package/docs/classes/materialanyofstringorenumcontrol.html +6 -9
- package/docs/classes/materialtablecontrol.html +4 -7
- package/docs/globals.html +986 -274
- package/docs/index.html +78 -51
- package/docs/interfaces/ajvprops.html +1 -4
- package/docs/interfaces/arraylayouttoolbarprops.html +0 -3
- package/docs/interfaces/categorizationstate.html +0 -3
- package/docs/interfaces/categorizationstepperstate.html +0 -3
- package/docs/interfaces/combinatorpropertiesprops.html +0 -3
- package/docs/interfaces/deletedialogprops.html +0 -3
- package/docs/interfaces/dispatchpropsofexpandpanel.html +3 -6
- package/docs/interfaces/emptytableprops.html +0 -3
- package/docs/interfaces/expandpanelprops.html +19 -22
- package/docs/interfaces/jsonformstheme.html +0 -3
- package/docs/interfaces/materialcategorizationlayoutrendererprops.html +7 -10
- package/docs/interfaces/materialcategorizationstepperlayoutrendererprops.html +7 -10
- package/docs/interfaces/materiallayoutrendererprops.html +0 -3
- package/docs/interfaces/materialtabletoolbarprops.html +10 -13
- package/docs/interfaces/muitextinputprops.html +2 -5
- package/docs/interfaces/nonemptycellcomponentprops.html +266 -0
- package/docs/interfaces/nonemptycellprops.html +0 -3
- package/docs/interfaces/nonemptyrowprops.html +80 -27
- package/docs/interfaces/ownoneofprops.html +0 -3
- package/docs/interfaces/ownpropsofexpandpanel.html +14 -17
- package/docs/interfaces/ownpropsofnonemptycell.html +0 -3
- package/docs/interfaces/statepropsofexpandpanel.html +16 -19
- package/docs/interfaces/tableheadercellprops.html +0 -3
- package/docs/interfaces/tablerowsprop.html +9 -12
- package/docs/interfaces/validationprops.html +0 -3
- package/docs/interfaces/withdeletedialogsupport.html +0 -3
- package/docs/interfaces/withinput.html +1 -4
- package/docs/interfaces/withoptionlabel.html +3 -6
- package/lib/additional/ListWithDetailMasterItem.d.ts +1 -1
- package/lib/additional/ListWithDetailMasterItem.js.map +1 -1
- package/lib/additional/MaterialLabelRenderer.d.ts +1 -1
- package/lib/additional/MaterialLabelRenderer.js +3 -1
- package/lib/additional/MaterialLabelRenderer.js.map +1 -1
- package/lib/additional/MaterialListWithDetailRenderer.d.ts +1 -1
- package/lib/additional/MaterialListWithDetailRenderer.js +5 -3
- package/lib/additional/MaterialListWithDetailRenderer.js.map +1 -1
- package/lib/additional/index.js +3 -2
- package/lib/additional/index.js.map +1 -1
- package/lib/cells/CustomizableCells.d.ts +1 -0
- package/lib/cells/CustomizableCells.js +11 -8
- package/lib/cells/CustomizableCells.js.map +1 -1
- package/lib/cells/MaterialBooleanCell.d.ts +1 -1
- package/lib/cells/MaterialBooleanCell.js +3 -1
- package/lib/cells/MaterialBooleanCell.js.map +1 -1
- package/lib/cells/MaterialBooleanToggleCell.d.ts +1 -1
- package/lib/cells/MaterialBooleanToggleCell.js +3 -1
- package/lib/cells/MaterialBooleanToggleCell.js.map +1 -1
- package/lib/cells/MaterialDateCell.d.ts +1 -1
- package/lib/cells/MaterialDateCell.js +3 -1
- package/lib/cells/MaterialDateCell.js.map +1 -1
- package/lib/cells/MaterialEnumCell.d.ts +1 -1
- package/lib/cells/MaterialEnumCell.js +3 -1
- package/lib/cells/MaterialEnumCell.js.map +1 -1
- package/lib/cells/MaterialIntegerCell.d.ts +1 -1
- package/lib/cells/MaterialIntegerCell.js +3 -1
- package/lib/cells/MaterialIntegerCell.js.map +1 -1
- package/lib/cells/MaterialNumberCell.d.ts +1 -1
- package/lib/cells/MaterialNumberCell.js +3 -1
- package/lib/cells/MaterialNumberCell.js.map +1 -1
- package/lib/cells/MaterialNumberFormatCell.d.ts +1 -1
- package/lib/cells/MaterialNumberFormatCell.js +3 -1
- package/lib/cells/MaterialNumberFormatCell.js.map +1 -1
- package/lib/cells/MaterialOneOfEnumCell.d.ts +10 -0
- package/lib/cells/MaterialOneOfEnumCell.js +41 -0
- package/lib/cells/MaterialOneOfEnumCell.js.map +1 -0
- package/lib/cells/MaterialTextCell.d.ts +1 -1
- package/lib/cells/MaterialTextCell.js +3 -1
- package/lib/cells/MaterialTextCell.js.map +1 -1
- package/lib/cells/MaterialTimeCell.d.ts +1 -1
- package/lib/cells/MaterialTimeCell.js +3 -1
- package/lib/cells/MaterialTimeCell.js.map +1 -1
- package/lib/cells/index.d.ts +2 -1
- package/lib/cells/index.js +13 -9
- package/lib/cells/index.js.map +1 -1
- package/lib/complex/CombinatorProperties.js +4 -2
- package/lib/complex/CombinatorProperties.js.map +1 -1
- package/lib/complex/DeleteDialog.js +1 -0
- package/lib/complex/DeleteDialog.js.map +1 -1
- package/lib/complex/MaterialAllOfRenderer.d.ts +3 -2
- package/lib/complex/MaterialAllOfRenderer.js +5 -3
- package/lib/complex/MaterialAllOfRenderer.js.map +1 -1
- package/lib/complex/MaterialAnyOfRenderer.d.ts +3 -2
- package/lib/complex/MaterialAnyOfRenderer.js +4 -2
- package/lib/complex/MaterialAnyOfRenderer.js.map +1 -1
- package/lib/complex/MaterialArrayControlRenderer.d.ts +1 -1
- package/lib/complex/MaterialArrayControlRenderer.js +3 -1
- package/lib/complex/MaterialArrayControlRenderer.js.map +1 -1
- package/lib/complex/MaterialEnumArrayRenderer.d.ts +2 -2
- package/lib/complex/MaterialEnumArrayRenderer.js +6 -3
- package/lib/complex/MaterialEnumArrayRenderer.js.map +1 -1
- package/lib/complex/MaterialObjectRenderer.d.ts +3 -2
- package/lib/complex/MaterialObjectRenderer.js +5 -3
- package/lib/complex/MaterialObjectRenderer.js.map +1 -1
- package/lib/complex/MaterialOneOfRenderer.d.ts +2 -1
- package/lib/complex/MaterialOneOfRenderer.js +6 -5
- package/lib/complex/MaterialOneOfRenderer.js.map +1 -1
- package/lib/complex/MaterialTableControl.d.ts +16 -1
- package/lib/complex/MaterialTableControl.js +16 -8
- package/lib/complex/MaterialTableControl.js.map +1 -1
- package/lib/complex/NoBorderTableCell.js.map +1 -1
- package/lib/complex/TableToolbar.d.ts +2 -2
- package/lib/complex/TableToolbar.js.map +1 -1
- package/lib/complex/ValidationIcon.d.ts +5 -3
- package/lib/complex/ValidationIcon.js.map +1 -1
- package/lib/complex/index.js +6 -5
- package/lib/complex/index.js.map +1 -1
- package/lib/controls/MaterialAnyOfStringOrEnumControl.d.ts +1 -1
- package/lib/controls/MaterialAnyOfStringOrEnumControl.js +17 -12
- package/lib/controls/MaterialAnyOfStringOrEnumControl.js.map +1 -1
- package/lib/controls/MaterialBooleanControl.d.ts +1 -1
- package/lib/controls/MaterialBooleanControl.js +3 -1
- package/lib/controls/MaterialBooleanControl.js.map +1 -1
- package/lib/controls/MaterialBooleanToggleControl.d.ts +1 -1
- package/lib/controls/MaterialBooleanToggleControl.js +3 -1
- package/lib/controls/MaterialBooleanToggleControl.js.map +1 -1
- package/lib/controls/MaterialDateControl.d.ts +3 -15
- package/lib/controls/MaterialDateControl.js +27 -45
- package/lib/controls/MaterialDateControl.js.map +1 -1
- package/lib/controls/MaterialDateTimeControl.d.ts +3 -6
- package/lib/controls/MaterialDateTimeControl.js +27 -24
- package/lib/controls/MaterialDateTimeControl.js.map +1 -1
- package/lib/controls/MaterialEnumControl.d.ts +1 -1
- package/lib/controls/MaterialEnumControl.js +3 -1
- package/lib/controls/MaterialEnumControl.js.map +1 -1
- package/lib/controls/MaterialInputControl.d.ts +2 -5
- package/lib/controls/MaterialInputControl.js +23 -28
- package/lib/controls/MaterialInputControl.js.map +1 -1
- package/lib/controls/MaterialIntegerControl.d.ts +1 -1
- package/lib/controls/MaterialIntegerControl.js +3 -1
- package/lib/controls/MaterialIntegerControl.js.map +1 -1
- package/lib/controls/MaterialNativeControl.d.ts +3 -6
- package/lib/controls/MaterialNativeControl.js +15 -18
- package/lib/controls/MaterialNativeControl.js.map +1 -1
- package/lib/controls/MaterialNumberControl.d.ts +1 -1
- package/lib/controls/MaterialNumberControl.js +3 -1
- package/lib/controls/MaterialNumberControl.js.map +1 -1
- package/lib/controls/MaterialOneOfEnumControl.d.ts +1 -1
- package/lib/controls/MaterialOneOfEnumControl.js +3 -1
- package/lib/controls/MaterialOneOfEnumControl.js.map +1 -1
- package/lib/controls/MaterialOneOfRadioGroupControl.d.ts +1 -1
- package/lib/controls/MaterialOneOfRadioGroupControl.js +3 -1
- package/lib/controls/MaterialOneOfRadioGroupControl.js.map +1 -1
- package/lib/controls/MaterialRadioGroup.d.ts +2 -5
- package/lib/controls/MaterialRadioGroup.js +15 -20
- package/lib/controls/MaterialRadioGroup.js.map +1 -1
- package/lib/controls/MaterialRadioGroupControl.d.ts +1 -1
- package/lib/controls/MaterialRadioGroupControl.js +3 -1
- package/lib/controls/MaterialRadioGroupControl.js.map +1 -1
- package/lib/controls/MaterialSliderControl.d.ts +3 -6
- package/lib/controls/MaterialSliderControl.js +35 -39
- package/lib/controls/MaterialSliderControl.js.map +1 -1
- package/lib/controls/MaterialTextControl.d.ts +1 -1
- package/lib/controls/MaterialTextControl.js +3 -1
- package/lib/controls/MaterialTextControl.js.map +1 -1
- package/lib/controls/MaterialTimeControl.d.ts +6 -0
- package/lib/controls/MaterialTimeControl.js +62 -0
- package/lib/controls/MaterialTimeControl.js.map +1 -0
- package/lib/controls/index.d.ts +11 -9
- package/lib/controls/index.js +19 -14
- package/lib/controls/index.js.map +1 -1
- package/lib/extended/MaterialAutocompleteEnumControl.d.ts +1 -1
- package/lib/extended/MaterialAutocompleteEnumControl.js +3 -1
- package/lib/extended/MaterialAutocompleteEnumControl.js.map +1 -1
- package/lib/extended/MaterialAutocompleteOneOfEnumControl.d.ts +1 -1
- package/lib/extended/MaterialAutocompleteOneOfEnumControl.js +3 -1
- package/lib/extended/MaterialAutocompleteOneOfEnumControl.js.map +1 -1
- package/lib/extended/MuiAutocomplete.d.ts +2 -2
- package/lib/extended/MuiAutocomplete.js +4 -3
- package/lib/extended/MuiAutocomplete.js.map +1 -1
- package/lib/extended/index.d.ts +2 -2
- package/lib/extended/index.js +2 -1
- package/lib/extended/index.js.map +1 -1
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/lib/jsonforms-material.js +9 -281
- package/lib/jsonforms-material.js.map +1 -1
- package/lib/layouts/ArrayToolbar.js +1 -0
- package/lib/layouts/ArrayToolbar.js.map +1 -1
- package/lib/layouts/ExpandPanelRenderer.d.ts +2 -3
- package/lib/layouts/ExpandPanelRenderer.js +29 -22
- package/lib/layouts/ExpandPanelRenderer.js.map +1 -1
- package/lib/layouts/MaterialArrayLayout.d.ts +1 -11
- package/lib/layouts/MaterialArrayLayout.js +19 -31
- package/lib/layouts/MaterialArrayLayout.js.map +1 -1
- package/lib/layouts/MaterialArrayLayoutRenderer.d.ts +1 -1
- package/lib/layouts/MaterialArrayLayoutRenderer.js +3 -1
- package/lib/layouts/MaterialArrayLayoutRenderer.js.map +1 -1
- package/lib/layouts/MaterialCategorizationLayout.d.ts +2 -10
- package/lib/layouts/MaterialCategorizationLayout.js +31 -47
- package/lib/layouts/MaterialCategorizationLayout.js.map +1 -1
- package/lib/layouts/MaterialCategorizationStepperLayout.d.ts +2 -9
- package/lib/layouts/MaterialCategorizationStepperLayout.js +42 -53
- package/lib/layouts/MaterialCategorizationStepperLayout.js.map +1 -1
- package/lib/layouts/MaterialGroupLayout.d.ts +1 -1
- package/lib/layouts/MaterialGroupLayout.js +3 -1
- package/lib/layouts/MaterialGroupLayout.js.map +1 -1
- package/lib/layouts/MaterialHorizontalLayout.d.ts +1 -1
- package/lib/layouts/MaterialHorizontalLayout.js +3 -1
- package/lib/layouts/MaterialHorizontalLayout.js.map +1 -1
- package/lib/layouts/MaterialVerticalLayout.d.ts +1 -1
- package/lib/layouts/MaterialVerticalLayout.js +3 -1
- package/lib/layouts/MaterialVerticalLayout.js.map +1 -1
- package/lib/layouts/index.js +6 -5
- package/lib/layouts/index.js.map +1 -1
- package/lib/mui-controls/MuiCheckbox.js +2 -2
- package/lib/mui-controls/MuiCheckbox.js.map +1 -1
- package/lib/mui-controls/MuiInputInteger.js +9 -6
- package/lib/mui-controls/MuiInputInteger.js.map +1 -1
- package/lib/mui-controls/MuiInputNumber.js +9 -6
- package/lib/mui-controls/MuiInputNumber.js.map +1 -1
- package/lib/mui-controls/MuiInputNumberFormat.js +7 -8
- package/lib/mui-controls/MuiInputNumberFormat.js.map +1 -1
- package/lib/mui-controls/MuiInputText.js +11 -7
- package/lib/mui-controls/MuiInputText.js.map +1 -1
- package/lib/mui-controls/MuiInputTime.js +5 -3
- package/lib/mui-controls/MuiInputTime.js.map +1 -1
- package/lib/mui-controls/MuiSelect.js +3 -3
- package/lib/mui-controls/MuiSelect.js.map +1 -1
- package/lib/mui-controls/MuiToggle.js +2 -2
- package/lib/mui-controls/MuiToggle.js.map +1 -1
- package/lib/util/datejs.d.ts +3 -0
- package/lib/util/datejs.js +29 -0
- package/lib/util/datejs.js.map +1 -0
- package/lib/util/debounce.d.ts +1 -0
- package/lib/util/debounce.js +48 -0
- package/lib/util/debounce.js.map +1 -0
- package/lib/util/focus.d.ts +1 -0
- package/lib/util/focus.js +36 -0
- package/lib/util/focus.js.map +1 -0
- package/lib/util/index.d.ts +3 -0
- package/lib/util/index.js +4 -0
- package/lib/util/index.js.map +1 -1
- package/lib/util/layout.d.ts +2 -1
- package/lib/util/layout.js +9 -5
- package/lib/util/layout.js.map +1 -1
- package/package.json +12 -13
- package/src/additional/MaterialListWithDetailRenderer.tsx +3 -4
- package/src/cells/CustomizableCells.ts +1 -0
- package/src/cells/MaterialOneOfEnumCell.tsx +46 -0
- package/src/cells/MaterialTimeCell.tsx +1 -0
- package/src/cells/index.ts +5 -0
- package/src/complex/CombinatorProperties.tsx +2 -2
- package/src/complex/MaterialAllOfRenderer.tsx +5 -4
- package/src/complex/MaterialAnyOfRenderer.tsx +4 -3
- package/src/complex/MaterialEnumArrayRenderer.tsx +1 -0
- package/src/complex/MaterialObjectRenderer.tsx +5 -5
- package/src/complex/MaterialOneOfRenderer.tsx +8 -8
- package/src/complex/MaterialTableControl.tsx +36 -24
- package/src/complex/TableToolbar.tsx +1 -2
- package/src/controls/MaterialAnyOfStringOrEnumControl.tsx +16 -12
- package/src/controls/MaterialDateControl.tsx +82 -113
- package/src/controls/MaterialDateTimeControl.tsx +88 -70
- package/src/controls/MaterialInputControl.tsx +62 -70
- package/src/controls/MaterialNativeControl.tsx +54 -58
- package/src/controls/MaterialRadioGroup.tsx +67 -70
- package/src/controls/MaterialSliderControl.tsx +92 -88
- package/src/controls/MaterialTimeControl.tsx +128 -0
- package/src/controls/index.ts +7 -0
- package/src/extended/MuiAutocomplete.tsx +2 -3
- package/src/index.ts +6 -0
- package/src/layouts/ExpandPanelRenderer.tsx +32 -32
- package/src/layouts/MaterialArrayLayout.tsx +73 -83
- package/src/layouts/MaterialCategorizationLayout.tsx +49 -65
- package/src/layouts/MaterialCategorizationStepperLayout.tsx +79 -87
- package/src/mui-controls/MuiCheckbox.tsx +1 -2
- package/src/mui-controls/MuiInputInteger.tsx +12 -9
- package/src/mui-controls/MuiInputNumber.tsx +9 -6
- package/src/mui-controls/MuiInputNumberFormat.tsx +8 -11
- package/src/mui-controls/MuiInputText.tsx +17 -15
- package/src/mui-controls/MuiInputTime.tsx +6 -4
- package/src/mui-controls/MuiSelect.tsx +2 -3
- package/src/mui-controls/MuiToggle.tsx +1 -2
- package/src/util/datejs.ts +32 -0
- package/src/util/debounce.ts +43 -0
- package/src/util/focus.ts +32 -0
- package/src/util/index.ts +3 -0
- package/src/util/layout.tsx +6 -7
- package/test/renderers/MaterialAnyOfRenderer.test.tsx +14 -8
- package/test/renderers/MaterialArrayLayout.test.tsx +8 -8
- package/test/renderers/MaterialBooleanToggleControl.test.tsx +0 -1
- package/test/renderers/MaterialCategorizationLayout.test.tsx +73 -0
- package/test/renderers/MaterialCategorizationStepperLayout.test.tsx +73 -0
- package/test/renderers/MaterialDateControl.test.tsx +42 -0
- package/test/renderers/MaterialDateTimeControl.test.tsx +54 -11
- package/test/renderers/MaterialInputControl.test.tsx +3 -3
- package/test/renderers/MaterialIntegerCell.test.tsx +41 -20
- package/test/renderers/MaterialNumberCell.test.tsx +45 -24
- package/test/renderers/MaterialOneOfEnumCell.test.tsx +93 -0
- package/test/renderers/MaterialOneOfRenderer.test.tsx +10 -7
- package/test/renderers/MaterialTextCell.test.tsx +41 -20
- package/test/renderers/MaterialTimeCell.test.tsx +41 -20
- package/test/renderers/MaterialTimeControl.test.tsx +378 -0
- package/docs/classes/materialarraylayout.html +0 -777
- package/docs/classes/materialcategorizationlayoutrenderer.html +0 -786
- package/docs/classes/materialcategorizationstepperlayoutrenderer.html +0 -762
- package/docs/classes/materialdatecontrol.html +0 -825
- package/docs/classes/materialdatetimecontrol.html +0 -825
- package/docs/classes/materialinputcontrol.html +0 -825
- package/docs/classes/materialnativecontrol.html +0 -825
- package/docs/classes/materialradiogroup.html +0 -825
- package/docs/classes/materialslidercontrol.html +0 -825
- package/docs/interfaces/datecontrol.html +0 -157
- package/docs/interfaces/materialarraylayoutstate.html +0 -157
- package/docs/interfaces/statepropsofdatecontrol.html +0 -468
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDebouncedChange = void 0;
|
|
4
|
+
/*
|
|
5
|
+
The MIT License
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2021 EclipseSource Munich
|
|
8
|
+
https://github.com/eclipsesource/jsonforms
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in
|
|
18
|
+
all copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
|
+
THE SOFTWARE.
|
|
27
|
+
*/
|
|
28
|
+
var lodash_1 = require("lodash");
|
|
29
|
+
var react_1 = require("react");
|
|
30
|
+
var eventToValue = function (ev) { return ev.target.value; };
|
|
31
|
+
var useDebouncedChange = function (handleChange, defaultValue, data, path, eventToValueFunction, timeout) {
|
|
32
|
+
if (eventToValueFunction === void 0) { eventToValueFunction = eventToValue; }
|
|
33
|
+
if (timeout === void 0) { timeout = 300; }
|
|
34
|
+
var _a = react_1.useState(data !== null && data !== void 0 ? data : defaultValue), input = _a[0], setInput = _a[1];
|
|
35
|
+
react_1.useEffect(function () {
|
|
36
|
+
setInput(data !== null && data !== void 0 ? data : defaultValue);
|
|
37
|
+
}, [data]);
|
|
38
|
+
var debouncedUpdate = react_1.useCallback(lodash_1.debounce(function (newValue) { return handleChange(path, newValue); }, timeout), [handleChange, path, timeout]);
|
|
39
|
+
var onChange = react_1.useCallback(function (ev) {
|
|
40
|
+
var newValue = eventToValueFunction(ev);
|
|
41
|
+
setInput(newValue !== null && newValue !== void 0 ? newValue : defaultValue);
|
|
42
|
+
debouncedUpdate(newValue);
|
|
43
|
+
}, [debouncedUpdate, eventToValueFunction]);
|
|
44
|
+
var onClear = react_1.useCallback(function () { setInput(defaultValue); handleChange(path, undefined); }, [defaultValue, handleChange, path]);
|
|
45
|
+
return [input, onChange, onClear];
|
|
46
|
+
};
|
|
47
|
+
exports.useDebouncedChange = useDebouncedChange;
|
|
48
|
+
//# sourceMappingURL=debounce.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debounce.js","sourceRoot":"","sources":["../../src/util/debounce.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,iCAAkC;AAClC,+BAAwD;AAGxD,IAAM,YAAY,GAAG,UAAC,EAAO,IAAK,OAAA,EAAE,CAAC,MAAM,CAAC,KAAK,EAAf,CAAe,CAAC;AAC3C,IAAM,kBAAkB,GAAG,UAAC,YAAgD,EAAE,YAAiB,EAAE,IAAS,EAAE,IAAY,EAAE,oBAAqD,EAAE,OAAa;IAApE,qCAAA,EAAA,mCAAqD;IAAE,wBAAA,EAAA,aAAa;IAC7L,IAAA,KAAoB,gBAAQ,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,YAAY,CAAC,EAAjD,KAAK,QAAA,EAAE,QAAQ,QAAkC,CAAC;IACzD,iBAAS,CAAC;QACR,QAAQ,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,YAAY,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IACX,IAAM,eAAe,GAAG,mBAAW,CAAC,iBAAQ,CAAC,UAAC,QAAgB,IAAK,OAAA,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,EAA5B,CAA4B,EAAE,OAAO,CAAC,EAAE,CAAC,YAAY,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1I,IAAM,QAAQ,GAAG,mBAAW,CAAC,UAAC,EAAO;QACnC,IAAM,QAAQ,GAAG,oBAAoB,CAAC,EAAE,CAAC,CAAC;QAC1C,QAAQ,CAAC,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,YAAY,CAAC,CAAC;QACnC,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC,EAAE,CAAC,eAAe,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAC5C,IAAM,OAAO,GAAG,mBAAW,CAAC,cAAQ,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA,CAAC,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;IACjI,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AACpC,CAAC,CAAC;AAbW,QAAA,kBAAkB,sBAa7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useFocus: () => [boolean, () => void, () => void];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useFocus = void 0;
|
|
4
|
+
/*
|
|
5
|
+
The MIT License
|
|
6
|
+
|
|
7
|
+
Copyright (c) 2021 EclipseSource Munich
|
|
8
|
+
https://github.com/eclipsesource/jsonforms
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in
|
|
18
|
+
all copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
|
+
THE SOFTWARE.
|
|
27
|
+
*/
|
|
28
|
+
var react_1 = require("react");
|
|
29
|
+
var useFocus = function () {
|
|
30
|
+
var _a = react_1.useState(false), focused = _a[0], setFocused = _a[1];
|
|
31
|
+
var onFocus = react_1.useCallback(function () { return setFocused(true); }, []);
|
|
32
|
+
var onBlur = react_1.useCallback(function () { return setFocused(false); }, []);
|
|
33
|
+
return [focused, onFocus, onBlur];
|
|
34
|
+
};
|
|
35
|
+
exports.useFocus = useFocus;
|
|
36
|
+
//# sourceMappingURL=focus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus.js","sourceRoot":"","sources":["../../src/util/focus.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,+BAA4C;AAErC,IAAM,QAAQ,GAAG;IACd,IAAA,KAAwB,gBAAQ,CAAC,KAAK,CAAC,EAAtC,OAAO,QAAA,EAAE,UAAU,QAAmB,CAAC;IAC9C,IAAM,OAAO,GAAG,mBAAW,CAAC,cAAM,OAAA,UAAU,CAAC,IAAI,CAAC,EAAhB,CAAgB,EAAE,EAAE,CAAC,CAAC;IACxD,IAAM,MAAM,GAAG,mBAAW,CAAC,cAAM,OAAA,UAAU,CAAC,KAAK,CAAC,EAAjB,CAAiB,EAAE,EAAE,CAAC,CAAC;IACxD,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AACtC,CAAC,CAAC;AALW,QAAA,QAAQ,YAKnB"}
|
package/lib/util/index.d.ts
CHANGED
package/lib/util/index.js
CHANGED
|
@@ -25,5 +25,9 @@ var tslib_1 = require("tslib");
|
|
|
25
25
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
26
26
|
THE SOFTWARE.
|
|
27
27
|
*/
|
|
28
|
+
tslib_1.__exportStar(require("./datejs"), exports);
|
|
28
29
|
tslib_1.__exportStar(require("./layout"), exports);
|
|
30
|
+
tslib_1.__exportStar(require("./theme"), exports);
|
|
31
|
+
tslib_1.__exportStar(require("./debounce"), exports);
|
|
32
|
+
tslib_1.__exportStar(require("./focus"), exports);
|
|
29
33
|
//# sourceMappingURL=index.js.map
|
package/lib/util/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,mDAAyB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,mDAAyB;AACzB,mDAAyB;AACzB,kDAAwB;AACxB,qDAA2B;AAC3B,kDAAwB"}
|
package/lib/util/layout.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ComponentType } from 'react';
|
|
3
|
+
import Ajv from 'ajv';
|
|
3
4
|
import { JsonFormsCellRendererRegistryEntry, JsonFormsRendererRegistryEntry, JsonSchema, OwnPropsOfRenderer, UISchemaElement } from '@jsonforms/core';
|
|
4
5
|
export declare const renderLayoutElements: (elements: UISchemaElement[], schema: JsonSchema, path: string, enabled: boolean, renderers?: JsonFormsRendererRegistryEntry[], cells?: JsonFormsCellRendererRegistryEntry[]) => JSX.Element[];
|
|
5
6
|
export interface MaterialLayoutRendererProps extends OwnPropsOfRenderer {
|
package/lib/util/layout.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withAjvProps = exports.MaterialLayoutRenderer = exports.renderLayoutElements = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
5
|
/*
|
|
5
6
|
The MIT License
|
|
@@ -30,11 +31,12 @@ var react_1 = tslib_1.__importDefault(require("react"));
|
|
|
30
31
|
var core_1 = require("@jsonforms/core");
|
|
31
32
|
var react_2 = require("@jsonforms/react");
|
|
32
33
|
var core_2 = require("@material-ui/core");
|
|
33
|
-
|
|
34
|
+
var renderLayoutElements = function (elements, schema, path, enabled, renderers, cells) {
|
|
34
35
|
return elements.map(function (child, index) { return (react_1.default.createElement(core_2.Grid, { item: true, key: path + "-" + index, xs: true },
|
|
35
|
-
react_1.default.createElement(react_2.
|
|
36
|
+
react_1.default.createElement(react_2.JsonFormsDispatch, { uischema: child, schema: schema, path: path, enabled: enabled, renderers: renderers, cells: cells }))); });
|
|
36
37
|
};
|
|
37
|
-
exports.
|
|
38
|
+
exports.renderLayoutElements = renderLayoutElements;
|
|
39
|
+
var MaterialLayoutRendererComponent = function (_a) {
|
|
38
40
|
var visible = _a.visible, elements = _a.elements, schema = _a.schema, path = _a.path, enabled = _a.enabled, direction = _a.direction, renderers = _a.renderers, cells = _a.cells;
|
|
39
41
|
if (isEmpty_1.default(elements)) {
|
|
40
42
|
return null;
|
|
@@ -43,12 +45,14 @@ exports.MaterialLayoutRenderer = react_1.default.memo(function (_a) {
|
|
|
43
45
|
return (react_1.default.createElement(core_2.Hidden, { xsUp: !visible },
|
|
44
46
|
react_1.default.createElement(core_2.Grid, { container: true, direction: direction, spacing: direction === 'row' ? 2 : 0 }, exports.renderLayoutElements(elements, schema, path, enabled, renderers, cells))));
|
|
45
47
|
}
|
|
46
|
-
}
|
|
47
|
-
exports.
|
|
48
|
+
};
|
|
49
|
+
exports.MaterialLayoutRenderer = react_1.default.memo(MaterialLayoutRendererComponent);
|
|
50
|
+
var withAjvProps = function (Component) {
|
|
48
51
|
return function (props) {
|
|
49
52
|
var ctx = react_2.useJsonForms();
|
|
50
53
|
var ajv = core_1.getAjv({ jsonforms: tslib_1.__assign({}, ctx) });
|
|
51
54
|
return (react_1.default.createElement(Component, tslib_1.__assign({}, props, { ajv: ajv })));
|
|
52
55
|
};
|
|
53
56
|
};
|
|
57
|
+
exports.withAjvProps = withAjvProps;
|
|
54
58
|
//# sourceMappingURL=layout.js.map
|
package/lib/util/layout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../src/util/layout.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"layout.js","sourceRoot":"","sources":["../../src/util/layout.tsx"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;EAuBE;AACF,mEAAqC;AACrC,wDAA0B;AAG1B,wCAOyB;AACzB,0CAAmE;AACnE,0CAAiD;AAE1C,IAAM,oBAAoB,GAAG,UAClC,QAA2B,EAC3B,MAAkB,EAClB,IAAY,EACZ,OAAgB,EAChB,SAA4C,EAC5C,KAA4C;IAE5C,OAAO,QAAQ,CAAC,GAAG,CAAC,UAAC,KAAK,EAAE,KAAK,IAAK,OAAA,CACpC,8BAAC,WAAI,IAAC,IAAI,QAAC,GAAG,EAAK,IAAI,SAAI,KAAO,EAAE,EAAE;QACpC,8BAAC,yBAAiB,IAChB,QAAQ,EAAE,KAAK,EACf,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,GACZ,CACG,CACR,EAXqC,CAWrC,CAAC,CAAC;AACL,CAAC,CAAC;AApBW,QAAA,oBAAoB,wBAoB/B;AAMF,IAAM,+BAA+B,GACnC,UAAC,EAS6B;QAR5B,OAAO,aAAA,EACP,QAAQ,cAAA,EACR,MAAM,YAAA,EACN,IAAI,UAAA,EACJ,OAAO,aAAA,EACP,SAAS,eAAA,EACT,SAAS,eAAA,EACT,KAAK,WAAA;IAEL,IAAI,iBAAO,CAAC,QAAQ,CAAC,EAAE;QACrB,OAAO,IAAI,CAAC;KACb;SAAM;QACL,OAAO,CACL,8BAAC,aAAM,IAAC,IAAI,EAAE,CAAC,OAAO;YACpB,8BAAC,WAAI,IACH,SAAS,QACT,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAEnC,4BAAoB,CACnB,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,OAAO,EACP,SAAS,EACT,KAAK,CACN,CACI,CACA,CACV,CAAC;KACH;AACH,CAAC,CAAC;AACS,QAAA,sBAAsB,GAAG,eAAK,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;AAM3E,IAAM,YAAY,GAAG,UAAe,SAAsC;IAC/E,OAAA,UAAC,KAAQ;QACP,IAAM,GAAG,GAAG,oBAAY,EAAE,CAAC;QAC3B,IAAM,GAAG,GAAG,aAAM,CAAC,EAAC,SAAS,uBAAM,GAAG,CAAC,EAAC,CAAC,CAAC;QAE1C,OAAO,CAAC,8BAAC,SAAS,uBAAK,KAAK,IAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;IAC9C,CAAC;AALD,CAKC,CAAC;AANS,QAAA,YAAY,gBAMrB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsonforms/material-renderers",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-alpha.2",
|
|
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",
|
|
@@ -65,27 +65,26 @@
|
|
|
65
65
|
]
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@date-io/
|
|
69
|
-
"
|
|
70
|
-
"@types/uuid": "^3.4.6",
|
|
71
|
-
"moment": "^2.24.0",
|
|
72
|
-
"uuid": "^3.3.3"
|
|
68
|
+
"@date-io/dayjs": "1.3.13",
|
|
69
|
+
"dayjs": "1.10.6"
|
|
73
70
|
},
|
|
74
71
|
"peerDependencies": {
|
|
75
|
-
"@jsonforms/core": "^
|
|
76
|
-
"@jsonforms/react": "^
|
|
72
|
+
"@jsonforms/core": "^3.0.0-alpha.0",
|
|
73
|
+
"@jsonforms/react": "^3.0.0-alpha.0",
|
|
77
74
|
"@material-ui/core": "^4.7.0",
|
|
78
|
-
"@material-ui/icons": "^4.5.1"
|
|
75
|
+
"@material-ui/icons": "^4.5.1",
|
|
76
|
+
"@material-ui/pickers": "^3.3.10"
|
|
79
77
|
},
|
|
80
78
|
"optionalPeerDependencies": {
|
|
81
79
|
"@material-ui/lab": "^4.0.0-alpha.56"
|
|
82
80
|
},
|
|
83
81
|
"devDependencies": {
|
|
84
|
-
"@jsonforms/core": "^
|
|
85
|
-
"@jsonforms/react": "^
|
|
82
|
+
"@jsonforms/core": "^3.0.0-alpha.2",
|
|
83
|
+
"@jsonforms/react": "^3.0.0-alpha.2",
|
|
86
84
|
"@material-ui/core": "^4.7.0",
|
|
87
85
|
"@material-ui/icons": "^4.5.1",
|
|
88
86
|
"@material-ui/lab": "^4.0.0-alpha.56",
|
|
87
|
+
"@material-ui/pickers": "^3.2.8",
|
|
89
88
|
"@types/enzyme": "^3.10.3",
|
|
90
89
|
"@types/enzyme-adapter-react-16": "^1.0.5",
|
|
91
90
|
"@types/react-dom": "^16.8.0",
|
|
@@ -102,10 +101,10 @@
|
|
|
102
101
|
"tslint": "^5.20.1",
|
|
103
102
|
"tslint-loader": "^3.5.4",
|
|
104
103
|
"typedoc": "^0.19.2",
|
|
105
|
-
"typescript": "
|
|
104
|
+
"typescript": "4.2.3",
|
|
106
105
|
"webpack": "^4.41.2",
|
|
107
106
|
"webpack-cli": "^3.2.1",
|
|
108
107
|
"webpack-dev-server": "^3.9.0"
|
|
109
108
|
},
|
|
110
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "7532a3e16558d9f0934bd5c602ccbe3a35ed9dab"
|
|
111
110
|
}
|
|
@@ -30,13 +30,12 @@ import {
|
|
|
30
30
|
createDefaultValue,
|
|
31
31
|
findUISchema,
|
|
32
32
|
isObjectArray,
|
|
33
|
-
isPlainLabel,
|
|
34
33
|
RankedTester,
|
|
35
34
|
rankWith,
|
|
36
35
|
uiTypeIs
|
|
37
36
|
} from '@jsonforms/core';
|
|
38
37
|
import {
|
|
39
|
-
|
|
38
|
+
JsonFormsDispatch,
|
|
40
39
|
withJsonFormsArrayLayoutProps
|
|
41
40
|
} from '@jsonforms/react';
|
|
42
41
|
import { Grid, Hidden, List, Typography } from '@material-ui/core';
|
|
@@ -101,7 +100,7 @@ export const MaterialListWithDetailRenderer = ({
|
|
|
101
100
|
<Hidden xsUp={!visible}>
|
|
102
101
|
<ArrayLayoutToolbar
|
|
103
102
|
label={computeLabel(
|
|
104
|
-
|
|
103
|
+
label,
|
|
105
104
|
required,
|
|
106
105
|
appliedUiSchemaOptions.hideRequiredAsterisk
|
|
107
106
|
)}
|
|
@@ -132,7 +131,7 @@ export const MaterialListWithDetailRenderer = ({
|
|
|
132
131
|
</Grid>
|
|
133
132
|
<Grid item xs>
|
|
134
133
|
{selectedIndex !== undefined ? (
|
|
135
|
-
<
|
|
134
|
+
<JsonFormsDispatch
|
|
136
135
|
renderers={renderers}
|
|
137
136
|
cells={cells}
|
|
138
137
|
visible={visible}
|
|
@@ -28,5 +28,6 @@ export { MaterialEnumCell } from './MaterialEnumCell';
|
|
|
28
28
|
export { MaterialIntegerCell } from './MaterialIntegerCell';
|
|
29
29
|
export { MaterialNumberCell } from './MaterialNumberCell';
|
|
30
30
|
export { MaterialNumberFormatCell } from './MaterialNumberFormatCell';
|
|
31
|
+
export { MaterialOneOfEnumCell } from './MaterialOneOfEnumCell';
|
|
31
32
|
export { MaterialTextCell } from './MaterialTextCell';
|
|
32
33
|
export { MaterialTimeCell } from './MaterialTimeCell';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*
|
|
2
|
+
The MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
5
|
+
https://github.com/eclipsesource/jsonforms
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
|
15
|
+
all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
THE SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
import React from 'react';
|
|
26
|
+
import {
|
|
27
|
+
EnumCellProps,
|
|
28
|
+
isOneOfEnumControl,
|
|
29
|
+
RankedTester,
|
|
30
|
+
rankWith,
|
|
31
|
+
WithClassname
|
|
32
|
+
} from '@jsonforms/core';
|
|
33
|
+
import { withJsonFormsOneOfEnumCellProps } from '@jsonforms/react';
|
|
34
|
+
import { MuiSelect } from '../mui-controls/MuiSelect';
|
|
35
|
+
|
|
36
|
+
export const MaterialOneOfEnumCell = (props: EnumCellProps & WithClassname) => (
|
|
37
|
+
<MuiSelect {...props} />
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Default tester for oneOf enum controls.
|
|
42
|
+
* @type {RankedTester}
|
|
43
|
+
*/
|
|
44
|
+
export const materialOneOfEnumCellTester: RankedTester = rankWith(2, isOneOfEnumControl);
|
|
45
|
+
|
|
46
|
+
export default withJsonFormsOneOfEnumCellProps(MaterialOneOfEnumCell);
|
package/src/cells/index.ts
CHANGED
|
@@ -39,6 +39,9 @@ import MaterialNumberCell, {
|
|
|
39
39
|
import MaterialNumberFormatCell, {
|
|
40
40
|
materialNumberFormatCellTester
|
|
41
41
|
} from './MaterialNumberFormatCell';
|
|
42
|
+
import MaterialOneOfEnumCell, {
|
|
43
|
+
materialOneOfEnumCellTester
|
|
44
|
+
} from './MaterialOneOfEnumCell';
|
|
42
45
|
import MaterialTextCell, { materialTextCellTester } from './MaterialTextCell';
|
|
43
46
|
import MaterialTimeCell, { materialTimeCellTester } from './MaterialTimeCell';
|
|
44
47
|
|
|
@@ -57,6 +60,8 @@ export {
|
|
|
57
60
|
materialNumberCellTester,
|
|
58
61
|
MaterialNumberFormatCell,
|
|
59
62
|
materialNumberFormatCellTester,
|
|
63
|
+
MaterialOneOfEnumCell,
|
|
64
|
+
materialOneOfEnumCellTester,
|
|
60
65
|
MaterialTextCell,
|
|
61
66
|
materialTextCellTester,
|
|
62
67
|
MaterialTimeCell,
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
import React from 'react';
|
|
26
26
|
import _ from 'lodash';
|
|
27
27
|
import { Generate, JsonSchema, Layout, UISchemaElement } from '@jsonforms/core';
|
|
28
|
-
import {
|
|
28
|
+
import { JsonFormsDispatch } from '@jsonforms/react';
|
|
29
29
|
|
|
30
30
|
interface CombinatorPropertiesProps {
|
|
31
31
|
schema: JsonSchema;
|
|
@@ -51,7 +51,7 @@ export class CombinatorProperties extends React.Component<CombinatorPropertiesPr
|
|
|
51
51
|
|
|
52
52
|
if (isLayoutWithElements) {
|
|
53
53
|
return (
|
|
54
|
-
<
|
|
54
|
+
<JsonFormsDispatch
|
|
55
55
|
schema={otherProps}
|
|
56
56
|
path={path}
|
|
57
57
|
uischema={foundUISchema}
|
|
@@ -35,9 +35,9 @@ import {
|
|
|
35
35
|
resolveSubSchemas,
|
|
36
36
|
StatePropsOfCombinator
|
|
37
37
|
} from '@jsonforms/core';
|
|
38
|
-
import {
|
|
38
|
+
import { JsonFormsDispatch, withJsonFormsAllOfProps } from '@jsonforms/react';
|
|
39
39
|
|
|
40
|
-
const MaterialAllOfRenderer = ({
|
|
40
|
+
export const MaterialAllOfRenderer = ({
|
|
41
41
|
schema,
|
|
42
42
|
rootSchema,
|
|
43
43
|
visible,
|
|
@@ -56,7 +56,7 @@ const MaterialAllOfRenderer = ({
|
|
|
56
56
|
if (delegateUISchema) {
|
|
57
57
|
return (
|
|
58
58
|
<Hidden xsUp={!visible}>
|
|
59
|
-
<
|
|
59
|
+
<JsonFormsDispatch
|
|
60
60
|
schema={_schema}
|
|
61
61
|
uischema={delegateUISchema}
|
|
62
62
|
path={path}
|
|
@@ -78,7 +78,7 @@ const MaterialAllOfRenderer = ({
|
|
|
78
78
|
return (
|
|
79
79
|
<Hidden xsUp={!visible}>
|
|
80
80
|
{allOfRenderInfos.map((allOfRenderInfo, allOfIndex) => (
|
|
81
|
-
<
|
|
81
|
+
<JsonFormsDispatch
|
|
82
82
|
key={allOfIndex}
|
|
83
83
|
schema={allOfRenderInfo.schema}
|
|
84
84
|
uischema={allOfRenderInfo.uischema}
|
|
@@ -95,4 +95,5 @@ export const materialAllOfControlTester: RankedTester = rankWith(
|
|
|
95
95
|
3,
|
|
96
96
|
isAllOfControl
|
|
97
97
|
);
|
|
98
|
+
|
|
98
99
|
export default withJsonFormsAllOfProps(MaterialAllOfRenderer);
|
|
@@ -33,11 +33,11 @@ import {
|
|
|
33
33
|
resolveSubSchemas,
|
|
34
34
|
StatePropsOfCombinator
|
|
35
35
|
} from '@jsonforms/core';
|
|
36
|
-
import {
|
|
36
|
+
import { JsonFormsDispatch, withJsonFormsAnyOfProps } from '@jsonforms/react';
|
|
37
37
|
import { Hidden, Tab, Tabs } from '@material-ui/core';
|
|
38
38
|
import CombinatorProperties from './CombinatorProperties';
|
|
39
39
|
|
|
40
|
-
const MaterialAnyOfRenderer = ({
|
|
40
|
+
export const MaterialAnyOfRenderer = ({
|
|
41
41
|
schema,
|
|
42
42
|
rootSchema,
|
|
43
43
|
indexOfFittingSchema,
|
|
@@ -79,7 +79,7 @@ const MaterialAnyOfRenderer = ({
|
|
|
79
79
|
{anyOfRenderInfos.map(
|
|
80
80
|
(anyOfRenderInfo, anyOfIndex) =>
|
|
81
81
|
selectedAnyOf === anyOfIndex && (
|
|
82
|
-
<
|
|
82
|
+
<JsonFormsDispatch
|
|
83
83
|
key={anyOfIndex}
|
|
84
84
|
schema={anyOfRenderInfo.schema}
|
|
85
85
|
uischema={anyOfRenderInfo.uischema}
|
|
@@ -97,4 +97,5 @@ export const materialAnyOfControlTester: RankedTester = rankWith(
|
|
|
97
97
|
3,
|
|
98
98
|
isAnyOfControl
|
|
99
99
|
);
|
|
100
|
+
|
|
100
101
|
export default withJsonFormsAnyOfProps(MaterialAnyOfRenderer);
|
|
@@ -27,16 +27,15 @@ import {
|
|
|
27
27
|
findUISchema,
|
|
28
28
|
GroupLayout,
|
|
29
29
|
isObjectControl,
|
|
30
|
-
isPlainLabel,
|
|
31
30
|
RankedTester,
|
|
32
31
|
rankWith,
|
|
33
32
|
StatePropsOfControlWithDetail
|
|
34
33
|
} from '@jsonforms/core';
|
|
35
|
-
import {
|
|
34
|
+
import { JsonFormsDispatch, withJsonFormsDetailProps } from '@jsonforms/react';
|
|
36
35
|
import { Hidden } from '@material-ui/core';
|
|
37
36
|
import React, { useMemo } from 'react';
|
|
38
37
|
|
|
39
|
-
const MaterialObjectRenderer = ({
|
|
38
|
+
export const MaterialObjectRenderer = ({
|
|
40
39
|
renderers,
|
|
41
40
|
cells,
|
|
42
41
|
uischemas,
|
|
@@ -64,11 +63,11 @@ const MaterialObjectRenderer = ({
|
|
|
64
63
|
if (isEmpty(path)) {
|
|
65
64
|
detailUiSchema.type = 'VerticalLayout';
|
|
66
65
|
} else {
|
|
67
|
-
(detailUiSchema as GroupLayout).label =
|
|
66
|
+
(detailUiSchema as GroupLayout).label = label;
|
|
68
67
|
}
|
|
69
68
|
return (
|
|
70
69
|
<Hidden xsUp={!visible}>
|
|
71
|
-
<
|
|
70
|
+
<JsonFormsDispatch
|
|
72
71
|
visible={visible}
|
|
73
72
|
enabled={enabled}
|
|
74
73
|
schema={schema}
|
|
@@ -85,4 +84,5 @@ export const materialObjectControlTester: RankedTester = rankWith(
|
|
|
85
84
|
2,
|
|
86
85
|
isObjectControl
|
|
87
86
|
);
|
|
87
|
+
|
|
88
88
|
export default withJsonFormsDetailProps(MaterialObjectRenderer);
|
|
@@ -26,7 +26,7 @@ import React, { useCallback, useState } from 'react';
|
|
|
26
26
|
import isEmpty from 'lodash/isEmpty';
|
|
27
27
|
|
|
28
28
|
import {
|
|
29
|
-
|
|
29
|
+
CombinatorRendererProps,
|
|
30
30
|
createCombinatorRenderInfos,
|
|
31
31
|
createDefaultValue,
|
|
32
32
|
isOneOfControl,
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
Tabs
|
|
49
49
|
} from '@material-ui/core';
|
|
50
50
|
import {
|
|
51
|
-
|
|
51
|
+
JsonFormsDispatch,
|
|
52
52
|
withJsonFormsOneOfProps
|
|
53
53
|
} from '@jsonforms/react';
|
|
54
54
|
import CombinatorProperties from './CombinatorProperties';
|
|
@@ -57,9 +57,8 @@ export interface OwnOneOfProps extends OwnPropsOfControl {
|
|
|
57
57
|
indexOfFittingSchema?: number;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
({ handleChange, schema, path, renderers, cells, rootSchema, id, visible, indexOfFittingSchema, uischema, uischemas, data }: CombinatorProps) => {
|
|
60
|
+
export const MaterialOneOfRenderer =
|
|
61
|
+
({ handleChange, schema, path, renderers, cells, rootSchema, id, visible, indexOfFittingSchema, uischema, uischemas, data }: CombinatorRendererProps) => {
|
|
63
62
|
const [open, setOpen] = useState(false);
|
|
64
63
|
const [selectedIndex, setSelectedIndex] = useState(indexOfFittingSchema || 0);
|
|
65
64
|
const [newSelectedIndex, setNewSelectedIndex] = useState(0);
|
|
@@ -67,11 +66,11 @@ const MaterialOneOfRenderer =
|
|
|
67
66
|
const cancel = useCallback(() => {
|
|
68
67
|
setOpen(false);
|
|
69
68
|
}, [setOpen]);
|
|
70
|
-
const _schema = resolveSubSchemas(schema, rootSchema, oneOf);
|
|
69
|
+
const _schema = resolveSubSchemas(schema, rootSchema, 'oneOf');
|
|
71
70
|
const oneOfRenderInfos = createCombinatorRenderInfos(
|
|
72
71
|
(_schema as JsonSchema).oneOf,
|
|
73
72
|
rootSchema,
|
|
74
|
-
oneOf,
|
|
73
|
+
'oneOf',
|
|
75
74
|
uischema,
|
|
76
75
|
path,
|
|
77
76
|
uischemas
|
|
@@ -112,7 +111,7 @@ const MaterialOneOfRenderer =
|
|
|
112
111
|
{
|
|
113
112
|
oneOfRenderInfos.map((oneOfRenderInfo, oneOfIndex) => (
|
|
114
113
|
selectedIndex === oneOfIndex && (
|
|
115
|
-
<
|
|
114
|
+
<JsonFormsDispatch
|
|
116
115
|
key={oneOfIndex}
|
|
117
116
|
schema={oneOfRenderInfo.schema}
|
|
118
117
|
uischema={oneOfRenderInfo.uischema}
|
|
@@ -150,4 +149,5 @@ const MaterialOneOfRenderer =
|
|
|
150
149
|
};
|
|
151
150
|
|
|
152
151
|
export const materialOneOfControlTester: RankedTester = rankWith(3, isOneOfControl);
|
|
152
|
+
|
|
153
153
|
export default withJsonFormsOneOfProps(MaterialOneOfRenderer);
|