@jsonforms/material-renderers 3.1.0-alpha.0 → 3.1.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 +16 -17
- package/lib/additional/ListWithDetailMasterItem.d.ts +2 -0
- package/lib/additional/MaterialListWithDetailRenderer.d.ts +1 -1
- package/lib/additional/index.d.ts +2 -2
- package/lib/additional/unwrapped.d.ts +5 -0
- package/lib/cells/index.d.ts +1 -1
- package/lib/complex/CombinatorProperties.d.ts +1 -2
- package/lib/complex/DeleteDialog.d.ts +5 -1
- package/lib/complex/MaterialAllOfRenderer.d.ts +1 -1
- package/lib/complex/MaterialAnyOfRenderer.d.ts +1 -1
- package/lib/complex/MaterialArrayControlRenderer.d.ts +2 -1
- package/lib/complex/MaterialEnumArrayRenderer.d.ts +1 -1
- package/lib/complex/MaterialObjectRenderer.d.ts +1 -1
- package/lib/complex/MaterialOneOfRenderer.d.ts +1 -1
- package/lib/complex/MaterialTableControl.d.ts +4 -2
- package/lib/complex/NoBorderTableCell.d.ts +2 -2
- package/lib/complex/TableToolbar.d.ts +3 -2
- package/lib/complex/index.d.ts +11 -16
- package/lib/complex/unwrapped.d.ts +9 -0
- package/lib/controls/MaterialBooleanControl.d.ts +1 -1
- package/lib/controls/MaterialBooleanToggleControl.d.ts +1 -1
- package/lib/controls/index.d.ts +8 -26
- package/lib/controls/unwrapped.d.ts +19 -0
- package/lib/index.d.ts +34 -1
- package/lib/jsonforms-react-material.cjs.js +731 -572
- package/lib/jsonforms-react-material.cjs.js.map +1 -1
- package/lib/jsonforms-react-material.esm.js +648 -517
- package/lib/jsonforms-react-material.esm.js.map +1 -1
- package/lib/layouts/ArrayToolbar.d.ts +3 -1
- package/lib/layouts/ExpandPanelRenderer.d.ts +3 -1
- package/lib/layouts/MaterialGroupLayout.d.ts +1 -1
- package/lib/layouts/MaterialHorizontalLayout.d.ts +1 -1
- package/lib/layouts/MaterialVerticalLayout.d.ts +1 -1
- package/lib/layouts/index.d.ts +3 -1
- package/lib/layouts/unwrapped.d.ts +10 -0
- package/lib/mui-controls/MuiCheckbox.d.ts +6 -1
- package/lib/mui-controls/MuiInputInteger.d.ts +1 -1
- package/lib/mui-controls/MuiInputNumber.d.ts +1 -1
- package/lib/mui-controls/MuiInputNumberFormat.d.ts +1 -1
- package/lib/mui-controls/MuiInputText.d.ts +1 -1
- package/lib/mui-controls/MuiInputTime.d.ts +1 -1
- package/lib/mui-controls/MuiSelect.d.ts +1 -1
- package/lib/mui-controls/MuiToggle.d.ts +6 -1
- package/lib/mui-controls/index.d.ts +3 -1
- package/lib/util/layout.d.ts +2 -3
- package/package.json +33 -15
- package/src/additional/ListWithDetailMasterItem.tsx +32 -24
- package/src/additional/MaterialLabelRenderer.tsx +8 -15
- package/src/additional/MaterialListWithDetailRenderer.tsx +8 -5
- package/src/additional/index.ts +12 -4
- package/{example/index.ts → src/additional/unwrapped.ts} +7 -6
- package/src/cells/MaterialBooleanCell.tsx +1 -1
- package/src/cells/MaterialBooleanToggleCell.tsx +2 -2
- package/src/cells/MaterialDateCell.tsx +4 -12
- package/src/cells/MaterialEnumCell.tsx +13 -6
- package/src/cells/MaterialIntegerCell.tsx +1 -1
- package/src/cells/MaterialNumberCell.tsx +1 -1
- package/src/cells/MaterialNumberFormatCell.tsx +1 -1
- package/src/cells/MaterialOneOfEnumCell.tsx +17 -7
- package/src/cells/MaterialTextCell.tsx +1 -1
- package/src/cells/MaterialTimeCell.tsx +1 -1
- package/src/cells/index.ts +7 -7
- package/src/complex/CombinatorProperties.tsx +20 -9
- package/src/complex/DeleteDialog.tsx +48 -37
- package/src/complex/MaterialAllOfRenderer.tsx +2 -2
- package/src/complex/MaterialAnyOfRenderer.tsx +3 -3
- package/src/complex/MaterialArrayControlRenderer.tsx +27 -11
- package/src/complex/MaterialEnumArrayRenderer.tsx +6 -8
- package/src/complex/MaterialObjectRenderer.tsx +6 -3
- package/src/complex/MaterialOneOfRenderer.tsx +105 -88
- package/src/complex/MaterialTableControl.tsx +145 -97
- package/src/complex/NoBorderTableCell.tsx +3 -5
- package/src/complex/TableToolbar.tsx +24 -25
- package/src/complex/ValidationIcon.tsx +10 -18
- package/src/complex/index.ts +35 -32
- package/{test/renderers/MatchMediaMock.ts → src/complex/unwrapped.ts} +19 -16
- package/src/controls/MaterialAnyOfStringOrEnumControl.tsx +19 -11
- package/src/controls/MaterialBooleanControl.tsx +90 -23
- package/src/controls/MaterialBooleanToggleControl.tsx +90 -23
- package/src/controls/MaterialDateControl.tsx +16 -19
- package/src/controls/MaterialDateTimeControl.tsx +24 -23
- package/src/controls/MaterialEnumControl.tsx +21 -15
- package/src/controls/MaterialInputControl.tsx +7 -8
- package/src/controls/MaterialIntegerControl.tsx +1 -1
- package/src/controls/MaterialNativeControl.tsx +12 -9
- package/src/controls/MaterialNumberControl.tsx +1 -1
- package/src/controls/MaterialOneOfEnumControl.tsx +21 -15
- package/src/controls/MaterialOneOfRadioGroupControl.tsx +5 -3
- package/src/controls/MaterialRadioGroup.tsx +11 -17
- package/src/controls/MaterialRadioGroupControl.tsx +8 -3
- package/src/controls/MaterialSliderControl.tsx +17 -16
- package/src/controls/MaterialTextControl.tsx +1 -1
- package/src/controls/MaterialTimeControl.tsx +19 -22
- package/src/controls/index.ts +36 -72
- package/src/controls/unwrapped.ts +57 -0
- package/src/index.ts +41 -22
- package/src/layouts/ArrayToolbar.tsx +38 -42
- package/src/layouts/ExpandPanelRenderer.tsx +96 -67
- package/src/layouts/MaterialArrayLayout.tsx +21 -16
- package/src/layouts/MaterialArrayLayoutRenderer.tsx +6 -9
- package/src/layouts/MaterialCategorizationLayout.tsx +52 -21
- package/src/layouts/MaterialCategorizationStepperLayout.tsx +60 -44
- package/src/layouts/MaterialGroupLayout.tsx +25 -6
- package/src/layouts/MaterialHorizontalLayout.tsx +18 -4
- package/src/layouts/MaterialVerticalLayout.tsx +18 -4
- package/src/layouts/index.ts +18 -7
- package/{test/renderers/util.ts → src/layouts/unwrapped.ts} +19 -28
- package/src/mui-controls/MuiAutocomplete.tsx +51 -35
- package/src/mui-controls/MuiCheckbox.tsx +14 -5
- package/src/mui-controls/MuiInputInteger.tsx +31 -32
- package/src/mui-controls/MuiInputNumber.tsx +16 -16
- package/src/mui-controls/MuiInputNumberFormat.tsx +51 -42
- package/src/mui-controls/MuiInputText.tsx +30 -19
- package/src/mui-controls/MuiInputTime.tsx +11 -12
- package/src/mui-controls/MuiSelect.tsx +15 -6
- package/src/mui-controls/MuiToggle.tsx +14 -5
- package/src/mui-controls/index.ts +3 -1
- package/src/util/datejs.tsx +41 -20
- package/src/util/debounce.ts +26 -11
- package/src/util/focus.ts +7 -7
- package/src/util/i18nDefaults.ts +2 -2
- package/src/util/layout.tsx +47 -42
- package/src/util/theme.ts +2 -2
- package/docs/assets/css/main.css +0 -1
- package/docs/assets/images/icons.png +0 -0
- package/docs/assets/images/icons@2x.png +0 -0
- package/docs/assets/images/widgets.png +0 -0
- package/docs/assets/images/widgets@2x.png +0 -0
- package/docs/assets/js/main.js +0 -51
- package/docs/assets/js/search.json +0 -1
- package/docs/classes/combinatorproperties.html +0 -957
- package/docs/classes/materialanyofstringorenumcontrol.html +0 -822
- package/docs/classes/materialtablecontrol.html +0 -999
- package/docs/globals.html +0 -4492
- package/docs/index.html +0 -753
- package/docs/interfaces/ajvprops.html +0 -162
- package/docs/interfaces/arraylayouttoolbarprops.html +0 -253
- package/docs/interfaces/categorizationstate.html +0 -154
- package/docs/interfaces/categorizationstepperstate.html +0 -154
- package/docs/interfaces/combinatorpropertiesprops.html +0 -182
- package/docs/interfaces/deletedialogprops.html +0 -225
- package/docs/interfaces/dispatchpropsofexpandpanel.html +0 -296
- package/docs/interfaces/emptytableprops.html +0 -154
- package/docs/interfaces/expandpanelprops.html +0 -594
- package/docs/interfaces/inputref.html +0 -168
- package/docs/interfaces/jsonformstheme.html +0 -352
- package/docs/interfaces/materialcategorizationlayoutrendererprops.html +0 -460
- package/docs/interfaces/materialcategorizationstepperlayoutrendererprops.html +0 -394
- package/docs/interfaces/materiallabelablelayoutrendererprops.html +0 -328
- package/docs/interfaces/materiallayoutrendererprops.html +0 -317
- package/docs/interfaces/materialtabletoolbarprops.html +0 -302
- package/docs/interfaces/muitextinputprops.html +0 -168
- package/docs/interfaces/nonemptycellcomponentprops.html +0 -266
- package/docs/interfaces/nonemptycellprops.html +0 -277
- package/docs/interfaces/nonemptyrowprops.html +0 -366
- package/docs/interfaces/ownoneofprops.html +0 -308
- package/docs/interfaces/ownpropsofexpandpanel.html +0 -397
- package/docs/interfaces/ownpropsofnonemptycell.html +0 -229
- package/docs/interfaces/statepropsofexpandpanel.html +0 -445
- package/docs/interfaces/tableheadercellprops.html +0 -154
- package/docs/interfaces/tablerowsprop.html +0 -330
- package/docs/interfaces/validationprops.html +0 -168
- package/docs/interfaces/withdeletedialogsupport.html +0 -170
- package/docs/interfaces/withinput.html +0 -154
- package/docs/interfaces/withoptionlabel.html +0 -230
- package/example/index.html +0 -16
- package/rollup.config.js +0 -51
- package/stats.html +0 -3279
- package/test/renderers/MaterialAllOfRenderer.test.tsx +0 -114
- package/test/renderers/MaterialAnyOfRenderer.test.tsx +0 -310
- package/test/renderers/MaterialAnyOfStringOrEnumControl.test.tsx +0 -126
- package/test/renderers/MaterialArrayControl.test.tsx +0 -633
- package/test/renderers/MaterialArrayLayout.test.tsx +0 -528
- package/test/renderers/MaterialBooleanCell.test.tsx +0 -374
- package/test/renderers/MaterialBooleanToggleCell.test.tsx +0 -466
- package/test/renderers/MaterialBooleanToggleControl.test.tsx +0 -469
- package/test/renderers/MaterialCategorizationLayout.test.tsx +0 -458
- package/test/renderers/MaterialCategorizationStepperLayout.test.tsx +0 -647
- package/test/renderers/MaterialDateCell.test.tsx +0 -303
- package/test/renderers/MaterialDateControl.test.tsx +0 -411
- package/test/renderers/MaterialDateTimeControl.test.tsx +0 -417
- package/test/renderers/MaterialEnumArrayRenderer.test.tsx +0 -207
- package/test/renderers/MaterialEnumCell.test.tsx +0 -88
- package/test/renderers/MaterialEnumControl.test.tsx +0 -75
- package/test/renderers/MaterialGroupLayout.test.tsx +0 -90
- package/test/renderers/MaterialInputControl.test.tsx +0 -370
- package/test/renderers/MaterialIntegerCell.test.tsx +0 -333
- package/test/renderers/MaterialLabelRenderer.test.tsx +0 -114
- package/test/renderers/MaterialLayouts.test.tsx +0 -542
- package/test/renderers/MaterialListWithDetailRenderer.test.tsx +0 -279
- package/test/renderers/MaterialNativeControl.test.tsx +0 -81
- package/test/renderers/MaterialNumberCell.test.tsx +0 -382
- package/test/renderers/MaterialObjectControl.test.tsx +0 -186
- package/test/renderers/MaterialOneOfEnumCell.test.tsx +0 -94
- package/test/renderers/MaterialOneOfRadioGroupControl.test.tsx +0 -108
- package/test/renderers/MaterialOneOfRenderer.test.tsx +0 -603
- package/test/renderers/MaterialRadioGroupControl.test.tsx +0 -125
- package/test/renderers/MaterialSliderControl.test.tsx +0 -438
- package/test/renderers/MaterialTextCell.test.tsx +0 -541
- package/test/renderers/MaterialTextControl.test.tsx +0 -115
- package/test/renderers/MaterialTimeCell.test.tsx +0 -331
- package/test/renderers/MaterialTimeControl.test.tsx +0 -411
- package/tsconfig.json +0 -13
- package/tsconfig.test.json +0 -7
- package/webpack/webpack.dev.js +0 -11
|
@@ -0,0 +1,57 @@
|
|
|
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 { MaterialAnyOfStringOrEnumControl } from './MaterialAnyOfStringOrEnumControl';
|
|
26
|
+
import { MaterialBooleanControl } from './MaterialBooleanControl';
|
|
27
|
+
import { MaterialBooleanToggleControl } from './MaterialBooleanToggleControl';
|
|
28
|
+
import { MaterialDateControl } from './MaterialDateControl';
|
|
29
|
+
import { MaterialDateTimeControl } from './MaterialDateTimeControl';
|
|
30
|
+
import { MaterialEnumControl } from './MaterialEnumControl';
|
|
31
|
+
import { MaterialIntegerControl } from './MaterialIntegerControl';
|
|
32
|
+
import { MaterialNativeControl } from './MaterialNativeControl';
|
|
33
|
+
import { MaterialNumberControl } from './MaterialNumberControl';
|
|
34
|
+
import { MaterialOneOfEnumControl } from './MaterialOneOfEnumControl';
|
|
35
|
+
import { MaterialOneOfRadioGroupControl } from './MaterialOneOfRadioGroupControl';
|
|
36
|
+
import { MaterialRadioGroupControl } from './MaterialRadioGroupControl';
|
|
37
|
+
import { MaterialSliderControl } from './MaterialSliderControl';
|
|
38
|
+
import { MaterialTextControl } from './MaterialTextControl';
|
|
39
|
+
import { MaterialTimeControl } from './MaterialTimeControl';
|
|
40
|
+
|
|
41
|
+
export const UnwrappedControls = {
|
|
42
|
+
MaterialAnyOfStringOrEnumControl,
|
|
43
|
+
MaterialBooleanControl,
|
|
44
|
+
MaterialBooleanToggleControl,
|
|
45
|
+
MaterialDateControl,
|
|
46
|
+
MaterialDateTimeControl,
|
|
47
|
+
MaterialEnumControl,
|
|
48
|
+
MaterialIntegerControl,
|
|
49
|
+
MaterialNativeControl,
|
|
50
|
+
MaterialNumberControl,
|
|
51
|
+
MaterialOneOfEnumControl,
|
|
52
|
+
MaterialOneOfRadioGroupControl,
|
|
53
|
+
MaterialSliderControl,
|
|
54
|
+
MaterialRadioGroupControl,
|
|
55
|
+
MaterialTextControl,
|
|
56
|
+
MaterialTimeControl,
|
|
57
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import {
|
|
26
26
|
JsonFormsCellRendererRegistryEntry,
|
|
27
|
-
JsonFormsRendererRegistryEntry
|
|
27
|
+
JsonFormsRendererRegistryEntry,
|
|
28
28
|
} from '@jsonforms/core';
|
|
29
29
|
import {
|
|
30
30
|
materialAllOfControlTester,
|
|
@@ -38,13 +38,13 @@ import {
|
|
|
38
38
|
materialOneOfControlTester,
|
|
39
39
|
MaterialOneOfRenderer,
|
|
40
40
|
MaterialEnumArrayRenderer,
|
|
41
|
-
materialEnumArrayRendererTester
|
|
41
|
+
materialEnumArrayRendererTester,
|
|
42
42
|
} from './complex';
|
|
43
43
|
import {
|
|
44
44
|
MaterialLabelRenderer,
|
|
45
45
|
materialLabelRendererTester,
|
|
46
46
|
MaterialListWithDetailRenderer,
|
|
47
|
-
materialListWithDetailTester
|
|
47
|
+
materialListWithDetailTester,
|
|
48
48
|
} from './additional';
|
|
49
49
|
import {
|
|
50
50
|
MaterialAnyOfStringOrEnumControl,
|
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
MaterialTextControl,
|
|
77
77
|
materialTextControlTester,
|
|
78
78
|
MaterialOneOfRadioGroupControl,
|
|
79
|
-
materialOneOfRadioGroupControlTester
|
|
79
|
+
materialOneOfRadioGroupControlTester,
|
|
80
80
|
} from './controls';
|
|
81
81
|
import {
|
|
82
82
|
MaterialArrayLayout,
|
|
@@ -88,7 +88,7 @@ import {
|
|
|
88
88
|
MaterialHorizontalLayout,
|
|
89
89
|
materialHorizontalLayoutTester,
|
|
90
90
|
MaterialVerticalLayout,
|
|
91
|
-
materialVerticalLayoutTester
|
|
91
|
+
materialVerticalLayoutTester,
|
|
92
92
|
} from './layouts';
|
|
93
93
|
import {
|
|
94
94
|
MaterialBooleanCell,
|
|
@@ -110,16 +110,17 @@ import {
|
|
|
110
110
|
MaterialTextCell,
|
|
111
111
|
materialTextCellTester,
|
|
112
112
|
MaterialTimeCell,
|
|
113
|
-
materialTimeCellTester
|
|
113
|
+
materialTimeCellTester,
|
|
114
114
|
} from './cells';
|
|
115
115
|
import MaterialCategorizationStepperLayout, {
|
|
116
|
-
materialCategorizationStepperTester
|
|
116
|
+
materialCategorizationStepperTester,
|
|
117
117
|
} from './layouts/MaterialCategorizationStepperLayout';
|
|
118
118
|
|
|
119
|
+
export * from './additional';
|
|
120
|
+
export * from './cells';
|
|
119
121
|
export * from './complex';
|
|
120
122
|
export * from './controls';
|
|
121
123
|
export * from './layouts';
|
|
122
|
-
export * from './cells';
|
|
123
124
|
export * from './mui-controls';
|
|
124
125
|
export * from './util';
|
|
125
126
|
|
|
@@ -127,10 +128,13 @@ export const materialRenderers: JsonFormsRendererRegistryEntry[] = [
|
|
|
127
128
|
// controls
|
|
128
129
|
{
|
|
129
130
|
tester: materialArrayControlTester,
|
|
130
|
-
renderer: MaterialArrayControlRenderer
|
|
131
|
+
renderer: MaterialArrayControlRenderer,
|
|
131
132
|
},
|
|
132
133
|
{ tester: materialBooleanControlTester, renderer: MaterialBooleanControl },
|
|
133
|
-
{
|
|
134
|
+
{
|
|
135
|
+
tester: materialBooleanToggleControlTester,
|
|
136
|
+
renderer: MaterialBooleanToggleControl,
|
|
137
|
+
},
|
|
134
138
|
{ tester: materialNativeControlTester, renderer: MaterialNativeControl },
|
|
135
139
|
{ tester: materialEnumControlTester, renderer: MaterialEnumControl },
|
|
136
140
|
{ tester: materialIntegerControlTester, renderer: MaterialIntegerControl },
|
|
@@ -138,7 +142,7 @@ export const materialRenderers: JsonFormsRendererRegistryEntry[] = [
|
|
|
138
142
|
{ tester: materialTextControlTester, renderer: MaterialTextControl },
|
|
139
143
|
{ tester: materialDateTimeControlTester, renderer: MaterialDateTimeControl },
|
|
140
144
|
{ tester: materialDateControlTester, renderer: MaterialDateControl },
|
|
141
|
-
{ tester: materialTimeControlTester, renderer: MaterialTimeControl },
|
|
145
|
+
{ tester: materialTimeControlTester, renderer: MaterialTimeControl },
|
|
142
146
|
{ tester: materialSliderControlTester, renderer: MaterialSliderControl },
|
|
143
147
|
{ tester: materialObjectControlTester, renderer: MaterialObjectRenderer },
|
|
144
148
|
{ tester: materialAllOfControlTester, renderer: MaterialAllOfRenderer },
|
|
@@ -146,43 +150,46 @@ export const materialRenderers: JsonFormsRendererRegistryEntry[] = [
|
|
|
146
150
|
{ tester: materialOneOfControlTester, renderer: MaterialOneOfRenderer },
|
|
147
151
|
{
|
|
148
152
|
tester: materialRadioGroupControlTester,
|
|
149
|
-
renderer: MaterialRadioGroupControl
|
|
153
|
+
renderer: MaterialRadioGroupControl,
|
|
150
154
|
},
|
|
151
155
|
{
|
|
152
156
|
tester: materialOneOfRadioGroupControlTester,
|
|
153
|
-
renderer: MaterialOneOfRadioGroupControl
|
|
157
|
+
renderer: MaterialOneOfRadioGroupControl,
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
tester: materialOneOfEnumControlTester,
|
|
161
|
+
renderer: MaterialOneOfEnumControl,
|
|
154
162
|
},
|
|
155
|
-
{ tester: materialOneOfEnumControlTester, renderer: MaterialOneOfEnumControl },
|
|
156
163
|
// layouts
|
|
157
164
|
{ tester: materialGroupTester, renderer: MaterialGroupLayout },
|
|
158
165
|
{
|
|
159
166
|
tester: materialHorizontalLayoutTester,
|
|
160
|
-
renderer: MaterialHorizontalLayout
|
|
167
|
+
renderer: MaterialHorizontalLayout,
|
|
161
168
|
},
|
|
162
169
|
{ tester: materialVerticalLayoutTester, renderer: MaterialVerticalLayout },
|
|
163
170
|
{
|
|
164
171
|
tester: materialCategorizationTester,
|
|
165
|
-
renderer: MaterialCategorizationLayout
|
|
172
|
+
renderer: MaterialCategorizationLayout,
|
|
166
173
|
},
|
|
167
174
|
{
|
|
168
175
|
tester: materialCategorizationStepperTester,
|
|
169
|
-
renderer: MaterialCategorizationStepperLayout
|
|
176
|
+
renderer: MaterialCategorizationStepperLayout,
|
|
170
177
|
},
|
|
171
178
|
{ tester: materialArrayLayoutTester, renderer: MaterialArrayLayout },
|
|
172
179
|
// additional
|
|
173
180
|
{ tester: materialLabelRendererTester, renderer: MaterialLabelRenderer },
|
|
174
181
|
{
|
|
175
182
|
tester: materialListWithDetailTester,
|
|
176
|
-
renderer: MaterialListWithDetailRenderer
|
|
183
|
+
renderer: MaterialListWithDetailRenderer,
|
|
177
184
|
},
|
|
178
185
|
{
|
|
179
186
|
tester: materialAnyOfStringOrEnumControlTester,
|
|
180
|
-
renderer: MaterialAnyOfStringOrEnumControl
|
|
187
|
+
renderer: MaterialAnyOfStringOrEnumControl,
|
|
181
188
|
},
|
|
182
189
|
{
|
|
183
190
|
tester: materialEnumArrayRendererTester,
|
|
184
|
-
renderer: MaterialEnumArrayRenderer
|
|
185
|
-
}
|
|
191
|
+
renderer: MaterialEnumArrayRenderer,
|
|
192
|
+
},
|
|
186
193
|
];
|
|
187
194
|
|
|
188
195
|
export const materialCells: JsonFormsCellRendererRegistryEntry[] = [
|
|
@@ -195,5 +202,17 @@ export const materialCells: JsonFormsCellRendererRegistryEntry[] = [
|
|
|
195
202
|
{ tester: materialNumberFormatCellTester, cell: MaterialNumberFormatCell },
|
|
196
203
|
{ tester: materialOneOfEnumCellTester, cell: MaterialOneOfEnumCell },
|
|
197
204
|
{ tester: materialTextCellTester, cell: MaterialTextCell },
|
|
198
|
-
{ tester: materialTimeCellTester, cell: MaterialTimeCell }
|
|
205
|
+
{ tester: materialTimeCellTester, cell: MaterialTimeCell },
|
|
199
206
|
];
|
|
207
|
+
|
|
208
|
+
import { UnwrappedAdditional } from './additional/unwrapped';
|
|
209
|
+
import { UnwrappedComplex } from './complex/unwrapped';
|
|
210
|
+
import { UnwrappedControls } from './controls/unwrapped';
|
|
211
|
+
import { UnwrappedLayouts } from './layouts/unwrapped';
|
|
212
|
+
|
|
213
|
+
export const Unwrapped = {
|
|
214
|
+
...UnwrappedAdditional,
|
|
215
|
+
...UnwrappedComplex,
|
|
216
|
+
...UnwrappedControls,
|
|
217
|
+
...UnwrappedLayouts,
|
|
218
|
+
};
|
|
@@ -1,59 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Grid,
|
|
3
|
-
IconButton,
|
|
4
|
-
Toolbar,
|
|
5
|
-
Tooltip,
|
|
6
|
-
Typography
|
|
7
|
-
} from '@mui/material';
|
|
1
|
+
import { Grid, IconButton, Toolbar, Tooltip, Typography } from '@mui/material';
|
|
8
2
|
import AddIcon from '@mui/icons-material/Add';
|
|
9
3
|
import React from 'react';
|
|
10
4
|
import ValidationIcon from '../complex/ValidationIcon';
|
|
5
|
+
import { ArrayTranslations } from '@jsonforms/core';
|
|
11
6
|
export interface ArrayLayoutToolbarProps {
|
|
12
7
|
label: string;
|
|
13
8
|
errors: string;
|
|
14
9
|
path: string;
|
|
15
10
|
addItem(path: string, data: any): () => void;
|
|
16
11
|
createDefault(): any;
|
|
12
|
+
translations: ArrayTranslations;
|
|
17
13
|
}
|
|
18
|
-
export const ArrayLayoutToolbar = React.memo(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
export const ArrayLayoutToolbar = React.memo(function ArrayLayoutToolbar({
|
|
15
|
+
label,
|
|
16
|
+
errors,
|
|
17
|
+
addItem,
|
|
18
|
+
path,
|
|
19
|
+
createDefault,
|
|
20
|
+
translations,
|
|
21
|
+
}: ArrayLayoutToolbarProps) {
|
|
22
|
+
return (
|
|
23
|
+
<Toolbar disableGutters={true}>
|
|
24
|
+
<Grid container alignItems='center' justifyContent='space-between'>
|
|
25
|
+
<Grid item>
|
|
26
|
+
<Typography variant={'h6'}>{label}</Typography>
|
|
27
|
+
</Grid>
|
|
28
|
+
{errors.length !== 0 && (
|
|
29
29
|
<Grid item>
|
|
30
|
-
<
|
|
30
|
+
<ValidationIcon id='tooltip-validation' errorMessages={errors} />
|
|
31
31
|
</Grid>
|
|
32
|
-
|
|
32
|
+
)}
|
|
33
|
+
<Grid item>
|
|
34
|
+
<Grid container>
|
|
33
35
|
<Grid item>
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
placement='bottom'
|
|
36
|
+
<Tooltip
|
|
37
|
+
id='tooltip-add'
|
|
38
|
+
title={translations.addTooltip}
|
|
39
|
+
placement='bottom'
|
|
40
|
+
>
|
|
41
|
+
<IconButton
|
|
42
|
+
aria-label={translations.addAriaLabel}
|
|
43
|
+
onClick={addItem(path, createDefault())}
|
|
44
|
+
size='large'
|
|
44
45
|
>
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
size='large'>
|
|
49
|
-
<AddIcon />
|
|
50
|
-
</IconButton>
|
|
51
|
-
</Tooltip>
|
|
52
|
-
</Grid>
|
|
46
|
+
<AddIcon />
|
|
47
|
+
</IconButton>
|
|
48
|
+
</Tooltip>
|
|
53
49
|
</Grid>
|
|
54
50
|
</Grid>
|
|
55
51
|
</Grid>
|
|
56
|
-
</
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
);
|
|
52
|
+
</Grid>
|
|
53
|
+
</Toolbar>
|
|
54
|
+
);
|
|
55
|
+
});
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import merge from 'lodash/merge';
|
|
2
2
|
import get from 'lodash/get';
|
|
3
|
-
import React, {
|
|
3
|
+
import React, {
|
|
4
|
+
ComponentType,
|
|
5
|
+
Dispatch,
|
|
6
|
+
Fragment,
|
|
7
|
+
ReducerAction,
|
|
8
|
+
useMemo,
|
|
9
|
+
useState,
|
|
10
|
+
useEffect,
|
|
11
|
+
useCallback,
|
|
12
|
+
} from 'react';
|
|
4
13
|
import {
|
|
5
14
|
JsonFormsDispatch,
|
|
6
15
|
JsonFormsStateContext,
|
|
7
|
-
withJsonFormsContext
|
|
16
|
+
withJsonFormsContext,
|
|
8
17
|
} from '@jsonforms/react';
|
|
9
18
|
import {
|
|
10
19
|
composePaths,
|
|
@@ -20,7 +29,8 @@ import {
|
|
|
20
29
|
JsonFormsUISchemaRegistryEntry,
|
|
21
30
|
getFirstPrimitiveProp,
|
|
22
31
|
createId,
|
|
23
|
-
removeId
|
|
32
|
+
removeId,
|
|
33
|
+
ArrayTranslations,
|
|
24
34
|
} from '@jsonforms/core';
|
|
25
35
|
import {
|
|
26
36
|
Accordion,
|
|
@@ -28,7 +38,7 @@ import {
|
|
|
28
38
|
AccordionDetails,
|
|
29
39
|
Avatar,
|
|
30
40
|
Grid,
|
|
31
|
-
IconButton
|
|
41
|
+
IconButton,
|
|
32
42
|
} from '@mui/material';
|
|
33
43
|
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
34
44
|
import DeleteIcon from '@mui/icons-material/Delete';
|
|
@@ -53,6 +63,7 @@ interface OwnPropsOfExpandPanel {
|
|
|
53
63
|
config: any;
|
|
54
64
|
childLabelProp?: string;
|
|
55
65
|
handleExpansion(panel: string): (event: any, expanded: boolean) => void;
|
|
66
|
+
translations: ArrayTranslations;
|
|
56
67
|
}
|
|
57
68
|
|
|
58
69
|
interface StatePropsOfExpandPanel extends OwnPropsOfExpandPanel {
|
|
@@ -103,7 +114,8 @@ const ExpandPanelRendererComponent = (props: ExpandPanelProps) => {
|
|
|
103
114
|
uischemas,
|
|
104
115
|
renderers,
|
|
105
116
|
cells,
|
|
106
|
-
config
|
|
117
|
+
config,
|
|
118
|
+
translations,
|
|
107
119
|
} = props;
|
|
108
120
|
|
|
109
121
|
const foundUISchema = useMemo(
|
|
@@ -121,7 +133,9 @@ const ExpandPanelRendererComponent = (props: ExpandPanelProps) => {
|
|
|
121
133
|
);
|
|
122
134
|
|
|
123
135
|
const appliedUiSchemaOptions = merge({}, config, uischema.options);
|
|
124
|
-
const showSortButtons =
|
|
136
|
+
const showSortButtons =
|
|
137
|
+
appliedUiSchemaOptions.showSortButtons ||
|
|
138
|
+
appliedUiSchemaOptions.showArrayLayoutSortButtons;
|
|
125
139
|
|
|
126
140
|
return (
|
|
127
141
|
<Accordion
|
|
@@ -157,8 +171,9 @@ const ExpandPanelRendererComponent = (props: ExpandPanelProps) => {
|
|
|
157
171
|
onClick={moveUp(path, index)}
|
|
158
172
|
style={iconStyle}
|
|
159
173
|
disabled={!enableMoveUp}
|
|
160
|
-
aria-label={
|
|
161
|
-
size='large'
|
|
174
|
+
aria-label={translations.upAriaLabel}
|
|
175
|
+
size='large'
|
|
176
|
+
>
|
|
162
177
|
<ArrowUpward />
|
|
163
178
|
</IconButton>
|
|
164
179
|
</Grid>
|
|
@@ -167,8 +182,9 @@ const ExpandPanelRendererComponent = (props: ExpandPanelProps) => {
|
|
|
167
182
|
onClick={moveDown(path, index)}
|
|
168
183
|
style={iconStyle}
|
|
169
184
|
disabled={!enableMoveDown}
|
|
170
|
-
aria-label={
|
|
171
|
-
size='large'
|
|
185
|
+
aria-label={translations.downAriaLabel}
|
|
186
|
+
size='large'
|
|
187
|
+
>
|
|
172
188
|
<ArrowDownward />
|
|
173
189
|
</IconButton>
|
|
174
190
|
</Grid>
|
|
@@ -180,8 +196,9 @@ const ExpandPanelRendererComponent = (props: ExpandPanelProps) => {
|
|
|
180
196
|
<IconButton
|
|
181
197
|
onClick={removeItems(path, [index])}
|
|
182
198
|
style={iconStyle}
|
|
183
|
-
aria-label={
|
|
184
|
-
size='large'
|
|
199
|
+
aria-label={translations.removeAriaLabel}
|
|
200
|
+
size='large'
|
|
201
|
+
>
|
|
185
202
|
<DeleteIcon />
|
|
186
203
|
</IconButton>
|
|
187
204
|
</Grid>
|
|
@@ -206,7 +223,7 @@ const ExpandPanelRendererComponent = (props: ExpandPanelProps) => {
|
|
|
206
223
|
);
|
|
207
224
|
};
|
|
208
225
|
|
|
209
|
-
const ExpandPanelRenderer = React.memo(ExpandPanelRendererComponent);
|
|
226
|
+
export const ExpandPanelRenderer = React.memo(ExpandPanelRendererComponent);
|
|
210
227
|
|
|
211
228
|
/**
|
|
212
229
|
* Maps state to dispatch properties of an expand pandel control.
|
|
@@ -216,37 +233,49 @@ const ExpandPanelRenderer = React.memo(ExpandPanelRendererComponent);
|
|
|
216
233
|
*/
|
|
217
234
|
export const ctxDispatchToExpandPanelProps: (
|
|
218
235
|
dispatch: Dispatch<ReducerAction<any>>
|
|
219
|
-
) => DispatchPropsOfExpandPanel = dispatch => ({
|
|
220
|
-
removeItems: useCallback(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
dispatch
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
236
|
+
) => DispatchPropsOfExpandPanel = (dispatch) => ({
|
|
237
|
+
removeItems: useCallback(
|
|
238
|
+
(path: string, toDelete: number[]) =>
|
|
239
|
+
(event: any): void => {
|
|
240
|
+
event.stopPropagation();
|
|
241
|
+
dispatch(
|
|
242
|
+
update(path, (array) => {
|
|
243
|
+
toDelete
|
|
244
|
+
.sort()
|
|
245
|
+
.reverse()
|
|
246
|
+
.forEach((s) => array.splice(s, 1));
|
|
247
|
+
return array;
|
|
248
|
+
})
|
|
249
|
+
);
|
|
250
|
+
},
|
|
251
|
+
[dispatch]
|
|
252
|
+
),
|
|
253
|
+
moveUp: useCallback(
|
|
254
|
+
(path: string, toMove: number) =>
|
|
255
|
+
(event: any): void => {
|
|
256
|
+
event.stopPropagation();
|
|
257
|
+
dispatch(
|
|
258
|
+
update(path, (array) => {
|
|
259
|
+
moveUp(array, toMove);
|
|
260
|
+
return array;
|
|
261
|
+
})
|
|
262
|
+
);
|
|
263
|
+
},
|
|
264
|
+
[dispatch]
|
|
265
|
+
),
|
|
266
|
+
moveDown: useCallback(
|
|
267
|
+
(path: string, toMove: number) =>
|
|
268
|
+
(event: any): void => {
|
|
269
|
+
event.stopPropagation();
|
|
270
|
+
dispatch(
|
|
271
|
+
update(path, (array) => {
|
|
272
|
+
moveDown(array, toMove);
|
|
273
|
+
return array;
|
|
274
|
+
})
|
|
275
|
+
);
|
|
276
|
+
},
|
|
277
|
+
[dispatch]
|
|
278
|
+
),
|
|
250
279
|
});
|
|
251
280
|
|
|
252
281
|
/**
|
|
@@ -257,33 +286,33 @@ export const ctxDispatchToExpandPanelProps: (
|
|
|
257
286
|
*/
|
|
258
287
|
export const withContextToExpandPanelProps = (
|
|
259
288
|
Component: ComponentType<ExpandPanelProps>
|
|
260
|
-
): ComponentType<OwnPropsOfExpandPanel> =>
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
289
|
+
): ComponentType<OwnPropsOfExpandPanel> =>
|
|
290
|
+
function WithContextToExpandPanelProps({
|
|
291
|
+
ctx,
|
|
292
|
+
props,
|
|
293
|
+
}: JsonFormsStateContext & ExpandPanelProps) {
|
|
294
|
+
const dispatchProps = ctxDispatchToExpandPanelProps(ctx.dispatch);
|
|
295
|
+
const { childLabelProp, schema, path, index, uischemas } = props;
|
|
296
|
+
const childPath = composePaths(path, `${index}`);
|
|
297
|
+
const childData = Resolve.data(ctx.core.data, childPath);
|
|
298
|
+
const childLabel = childLabelProp
|
|
299
|
+
? get(childData, childLabelProp, '')
|
|
300
|
+
: get(childData, getFirstPrimitiveProp(schema), '');
|
|
271
301
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
};
|
|
302
|
+
return (
|
|
303
|
+
<Component
|
|
304
|
+
{...props}
|
|
305
|
+
{...dispatchProps}
|
|
306
|
+
childLabel={childLabel}
|
|
307
|
+
childPath={childPath}
|
|
308
|
+
uischemas={uischemas}
|
|
309
|
+
/>
|
|
310
|
+
);
|
|
311
|
+
};
|
|
282
312
|
|
|
283
313
|
export const withJsonFormsExpandPanelProps = (
|
|
284
314
|
Component: ComponentType<ExpandPanelProps>
|
|
285
315
|
): ComponentType<OwnPropsOfExpandPanel> =>
|
|
286
|
-
withJsonFormsContext(
|
|
287
|
-
withContextToExpandPanelProps(Component));
|
|
316
|
+
withJsonFormsContext(withContextToExpandPanelProps(Component));
|
|
288
317
|
|
|
289
318
|
export default withJsonFormsExpandPanelProps(ExpandPanelRenderer);
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
import range from 'lodash/range';
|
|
26
|
-
import React, {useState, useCallback} from 'react';
|
|
26
|
+
import React, { useState, useCallback } from 'react';
|
|
27
27
|
import {
|
|
28
28
|
ArrayLayoutProps,
|
|
29
29
|
composePaths,
|
|
@@ -35,15 +35,21 @@ import { ArrayLayoutToolbar } from './ArrayToolbar';
|
|
|
35
35
|
import ExpandPanelRenderer from './ExpandPanelRenderer';
|
|
36
36
|
import merge from 'lodash/merge';
|
|
37
37
|
|
|
38
|
-
const MaterialArrayLayoutComponent = (props: ArrayLayoutProps)=> {
|
|
39
|
-
const [expanded, setExpanded] = useState<string|boolean>(false);
|
|
40
|
-
const innerCreateDefaultValue = useCallback(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
38
|
+
const MaterialArrayLayoutComponent = (props: ArrayLayoutProps) => {
|
|
39
|
+
const [expanded, setExpanded] = useState<string | boolean>(false);
|
|
40
|
+
const innerCreateDefaultValue = useCallback(
|
|
41
|
+
() => createDefaultValue(props.schema),
|
|
42
|
+
[props.schema]
|
|
43
|
+
);
|
|
44
|
+
const handleChange = useCallback(
|
|
45
|
+
(panel: string) => (_event: any, expandedPanel: boolean) => {
|
|
46
|
+
setExpanded(expandedPanel ? panel : false);
|
|
47
|
+
},
|
|
48
|
+
[]
|
|
49
|
+
);
|
|
50
|
+
const isExpanded = (index: number) =>
|
|
45
51
|
expanded === composePaths(props.path, `${index}`);
|
|
46
|
-
|
|
52
|
+
|
|
47
53
|
const {
|
|
48
54
|
enabled,
|
|
49
55
|
data,
|
|
@@ -58,17 +64,15 @@ const MaterialArrayLayoutComponent = (props: ArrayLayoutProps)=> {
|
|
|
58
64
|
required,
|
|
59
65
|
rootSchema,
|
|
60
66
|
config,
|
|
61
|
-
uischemas
|
|
67
|
+
uischemas,
|
|
68
|
+
translations,
|
|
62
69
|
} = props;
|
|
63
|
-
const appliedUiSchemaOptions = merge(
|
|
64
|
-
{},
|
|
65
|
-
config,
|
|
66
|
-
props.uischema.options
|
|
67
|
-
);
|
|
70
|
+
const appliedUiSchemaOptions = merge({}, config, props.uischema.options);
|
|
68
71
|
|
|
69
72
|
return (
|
|
70
73
|
<div>
|
|
71
74
|
<ArrayLayoutToolbar
|
|
75
|
+
translations={translations}
|
|
72
76
|
label={computeLabel(
|
|
73
77
|
label,
|
|
74
78
|
required,
|
|
@@ -81,7 +85,7 @@ const MaterialArrayLayoutComponent = (props: ArrayLayoutProps)=> {
|
|
|
81
85
|
/>
|
|
82
86
|
<div>
|
|
83
87
|
{data > 0 ? (
|
|
84
|
-
map(range(data), index => {
|
|
88
|
+
map(range(data), (index) => {
|
|
85
89
|
return (
|
|
86
90
|
<ExpandPanelRenderer
|
|
87
91
|
enabled={enabled}
|
|
@@ -100,6 +104,7 @@ const MaterialArrayLayoutComponent = (props: ArrayLayoutProps)=> {
|
|
|
100
104
|
config={config}
|
|
101
105
|
childLabelProp={appliedUiSchemaOptions.elementLabelProp}
|
|
102
106
|
uischemas={uischemas}
|
|
107
|
+
translations={translations}
|
|
103
108
|
/>
|
|
104
109
|
);
|
|
105
110
|
})
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
ArrayLayoutProps,
|
|
29
29
|
isObjectArrayWithNesting,
|
|
30
30
|
RankedTester,
|
|
31
|
-
rankWith
|
|
31
|
+
rankWith,
|
|
32
32
|
} from '@jsonforms/core';
|
|
33
33
|
import { Hidden } from '@mui/material';
|
|
34
34
|
import { MaterialArrayLayout } from './MaterialArrayLayout';
|
|
@@ -39,16 +39,13 @@ export const MaterialArrayLayoutRenderer = ({
|
|
|
39
39
|
addItem,
|
|
40
40
|
...props
|
|
41
41
|
}: ArrayLayoutProps) => {
|
|
42
|
-
const addItemCb = useCallback(
|
|
43
|
-
addItem
|
|
44
|
-
|
|
42
|
+
const addItemCb = useCallback(
|
|
43
|
+
(p: string, value: any) => addItem(p, value),
|
|
44
|
+
[addItem]
|
|
45
|
+
);
|
|
45
46
|
return (
|
|
46
47
|
<Hidden xsUp={!visible}>
|
|
47
|
-
<MaterialArrayLayout
|
|
48
|
-
visible={visible}
|
|
49
|
-
addItem={addItemCb}
|
|
50
|
-
{...props}
|
|
51
|
-
/>
|
|
48
|
+
<MaterialArrayLayout visible={visible} addItem={addItemCb} {...props} />
|
|
52
49
|
</Hidden>
|
|
53
50
|
);
|
|
54
51
|
};
|