@jsonforms/material-renderers 3.1.0-alpha.0 → 3.1.0-alpha.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.
Files changed (100) hide show
  1. package/lib/controls/MaterialBooleanControl.d.ts +1 -1
  2. package/lib/controls/MaterialBooleanToggleControl.d.ts +1 -1
  3. package/lib/controls/index.d.ts +2 -2
  4. package/lib/jsonforms-react-material.cjs.js +79 -11
  5. package/lib/jsonforms-react-material.cjs.js.map +1 -1
  6. package/lib/jsonforms-react-material.esm.js +79 -11
  7. package/lib/jsonforms-react-material.esm.js.map +1 -1
  8. package/lib/mui-controls/MuiCheckbox.d.ts +6 -1
  9. package/lib/mui-controls/MuiToggle.d.ts +6 -1
  10. package/package.json +23 -12
  11. package/src/additional/ListWithDetailMasterItem.tsx +1 -1
  12. package/src/controls/MaterialBooleanControl.tsx +84 -23
  13. package/src/controls/MaterialBooleanToggleControl.tsx +84 -23
  14. package/src/mui-controls/MuiCheckbox.tsx +12 -5
  15. package/src/mui-controls/MuiToggle.tsx +12 -5
  16. package/docs/assets/css/main.css +0 -1
  17. package/docs/assets/images/icons.png +0 -0
  18. package/docs/assets/images/icons@2x.png +0 -0
  19. package/docs/assets/images/widgets.png +0 -0
  20. package/docs/assets/images/widgets@2x.png +0 -0
  21. package/docs/assets/js/main.js +0 -51
  22. package/docs/assets/js/search.json +0 -1
  23. package/docs/classes/combinatorproperties.html +0 -957
  24. package/docs/classes/materialanyofstringorenumcontrol.html +0 -822
  25. package/docs/classes/materialtablecontrol.html +0 -999
  26. package/docs/globals.html +0 -4492
  27. package/docs/index.html +0 -753
  28. package/docs/interfaces/ajvprops.html +0 -162
  29. package/docs/interfaces/arraylayouttoolbarprops.html +0 -253
  30. package/docs/interfaces/categorizationstate.html +0 -154
  31. package/docs/interfaces/categorizationstepperstate.html +0 -154
  32. package/docs/interfaces/combinatorpropertiesprops.html +0 -182
  33. package/docs/interfaces/deletedialogprops.html +0 -225
  34. package/docs/interfaces/dispatchpropsofexpandpanel.html +0 -296
  35. package/docs/interfaces/emptytableprops.html +0 -154
  36. package/docs/interfaces/expandpanelprops.html +0 -594
  37. package/docs/interfaces/inputref.html +0 -168
  38. package/docs/interfaces/jsonformstheme.html +0 -352
  39. package/docs/interfaces/materialcategorizationlayoutrendererprops.html +0 -460
  40. package/docs/interfaces/materialcategorizationstepperlayoutrendererprops.html +0 -394
  41. package/docs/interfaces/materiallabelablelayoutrendererprops.html +0 -328
  42. package/docs/interfaces/materiallayoutrendererprops.html +0 -317
  43. package/docs/interfaces/materialtabletoolbarprops.html +0 -302
  44. package/docs/interfaces/muitextinputprops.html +0 -168
  45. package/docs/interfaces/nonemptycellcomponentprops.html +0 -266
  46. package/docs/interfaces/nonemptycellprops.html +0 -277
  47. package/docs/interfaces/nonemptyrowprops.html +0 -366
  48. package/docs/interfaces/ownoneofprops.html +0 -308
  49. package/docs/interfaces/ownpropsofexpandpanel.html +0 -397
  50. package/docs/interfaces/ownpropsofnonemptycell.html +0 -229
  51. package/docs/interfaces/statepropsofexpandpanel.html +0 -445
  52. package/docs/interfaces/tableheadercellprops.html +0 -154
  53. package/docs/interfaces/tablerowsprop.html +0 -330
  54. package/docs/interfaces/validationprops.html +0 -168
  55. package/docs/interfaces/withdeletedialogsupport.html +0 -170
  56. package/docs/interfaces/withinput.html +0 -154
  57. package/docs/interfaces/withoptionlabel.html +0 -230
  58. package/example/index.html +0 -16
  59. package/example/index.ts +0 -31
  60. package/rollup.config.js +0 -51
  61. package/stats.html +0 -3279
  62. package/test/renderers/MatchMediaMock.ts +0 -36
  63. package/test/renderers/MaterialAllOfRenderer.test.tsx +0 -114
  64. package/test/renderers/MaterialAnyOfRenderer.test.tsx +0 -310
  65. package/test/renderers/MaterialAnyOfStringOrEnumControl.test.tsx +0 -126
  66. package/test/renderers/MaterialArrayControl.test.tsx +0 -633
  67. package/test/renderers/MaterialArrayLayout.test.tsx +0 -528
  68. package/test/renderers/MaterialBooleanCell.test.tsx +0 -374
  69. package/test/renderers/MaterialBooleanToggleCell.test.tsx +0 -466
  70. package/test/renderers/MaterialBooleanToggleControl.test.tsx +0 -469
  71. package/test/renderers/MaterialCategorizationLayout.test.tsx +0 -458
  72. package/test/renderers/MaterialCategorizationStepperLayout.test.tsx +0 -647
  73. package/test/renderers/MaterialDateCell.test.tsx +0 -303
  74. package/test/renderers/MaterialDateControl.test.tsx +0 -411
  75. package/test/renderers/MaterialDateTimeControl.test.tsx +0 -417
  76. package/test/renderers/MaterialEnumArrayRenderer.test.tsx +0 -207
  77. package/test/renderers/MaterialEnumCell.test.tsx +0 -88
  78. package/test/renderers/MaterialEnumControl.test.tsx +0 -75
  79. package/test/renderers/MaterialGroupLayout.test.tsx +0 -90
  80. package/test/renderers/MaterialInputControl.test.tsx +0 -370
  81. package/test/renderers/MaterialIntegerCell.test.tsx +0 -333
  82. package/test/renderers/MaterialLabelRenderer.test.tsx +0 -114
  83. package/test/renderers/MaterialLayouts.test.tsx +0 -542
  84. package/test/renderers/MaterialListWithDetailRenderer.test.tsx +0 -279
  85. package/test/renderers/MaterialNativeControl.test.tsx +0 -81
  86. package/test/renderers/MaterialNumberCell.test.tsx +0 -382
  87. package/test/renderers/MaterialObjectControl.test.tsx +0 -186
  88. package/test/renderers/MaterialOneOfEnumCell.test.tsx +0 -94
  89. package/test/renderers/MaterialOneOfRadioGroupControl.test.tsx +0 -108
  90. package/test/renderers/MaterialOneOfRenderer.test.tsx +0 -603
  91. package/test/renderers/MaterialRadioGroupControl.test.tsx +0 -125
  92. package/test/renderers/MaterialSliderControl.test.tsx +0 -438
  93. package/test/renderers/MaterialTextCell.test.tsx +0 -541
  94. package/test/renderers/MaterialTextControl.test.tsx +0 -115
  95. package/test/renderers/MaterialTimeCell.test.tsx +0 -331
  96. package/test/renderers/MaterialTimeControl.test.tsx +0 -411
  97. package/test/renderers/util.ts +0 -50
  98. package/tsconfig.json +0 -13
  99. package/tsconfig.test.json +0 -7
  100. package/webpack/webpack.dev.js +0 -11
@@ -1,279 +0,0 @@
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 './MatchMediaMock';
26
- import {
27
- ControlElement
28
- } from '@jsonforms/core';
29
- import * as React from 'react';
30
-
31
- import { materialRenderers } from '../../src';
32
- import MaterialListWithDetailRenderer, {
33
- materialListWithDetailTester
34
- } from '../../src/additional/MaterialListWithDetailRenderer';
35
- import Enzyme, { mount, ReactWrapper } from 'enzyme';
36
- import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
37
- import { JsonFormsStateProvider } from '@jsonforms/react';
38
- import { ListItem } from '@mui/material'
39
- import { initCore } from './util';
40
-
41
- Enzyme.configure({ adapter: new Adapter() });
42
-
43
- const data = [
44
- {
45
- message: 'El Barto was here',
46
- done: true
47
- },
48
- {
49
- message: 'Yolo'
50
- }
51
- ];
52
- const schema = {
53
- type: 'array',
54
- items: {
55
- type: 'object',
56
- properties: {
57
- message: {
58
- type: 'string',
59
- maxLength: 3,
60
- title: 'Schema Title'
61
- },
62
- done: {
63
- type: 'boolean'
64
- }
65
- }
66
- }
67
- };
68
-
69
- const uischema: ControlElement = {
70
- type: 'Control',
71
- scope: '#'
72
- };
73
-
74
- const nestedSchema = {
75
- type: 'array',
76
- items: {
77
- ...schema
78
- }
79
- };
80
-
81
- const nestedSchema2 = {
82
- type: 'array',
83
- items: {
84
- type: 'object',
85
- properties: {
86
- objectarrayofstrings: {
87
- type: 'object',
88
- properties: {
89
- choices: {
90
- type: 'array',
91
- items: {
92
- type: 'string'
93
- }
94
- }
95
- }
96
- }
97
- }
98
- }
99
- };
100
-
101
- describe('Material list with detail tester', () => {
102
- it('should only be applicable for intermediate array or when containing proper options', () => {
103
- const correctUISchema = {
104
- type: 'ListWithDetail',
105
- scope: '#'
106
- };
107
- const wrongSchema = {
108
- type: 'array',
109
- items: {
110
- type: 'string'
111
- }
112
- };
113
- expect(materialListWithDetailTester(uischema, schema, undefined)).toBe(-1);
114
- expect(materialListWithDetailTester(correctUISchema, wrongSchema, undefined)).toBe(-1);
115
- expect(materialListWithDetailTester(correctUISchema, schema, undefined)).toBe(4);
116
- expect(materialListWithDetailTester(correctUISchema, nestedSchema, undefined)).toBe(
117
- -1
118
- );
119
- expect(materialListWithDetailTester(correctUISchema, nestedSchema2, undefined)).toBe(
120
- 4
121
- );
122
- });
123
- });
124
- describe('Material list with detail renderer', () => {
125
- let wrapper: ReactWrapper;
126
-
127
- afterEach(() => wrapper.unmount());
128
-
129
- it('should render two list entries', () => {
130
- const core = initCore(schema, uischema, data);
131
- wrapper = mount(
132
- <JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
133
- <MaterialListWithDetailRenderer schema={schema} uischema={uischema} />
134
- </JsonFormsStateProvider>
135
- );
136
-
137
- const lis = wrapper.find('li');
138
- expect(lis).toHaveLength(2);
139
- });
140
- it('should render empty entries', () => {
141
- const core = initCore(schema, uischema, []);
142
- wrapper = mount(
143
- <JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
144
- <MaterialListWithDetailRenderer schema={schema} uischema={uischema} />
145
- </JsonFormsStateProvider>
146
- );
147
-
148
- const lis = wrapper.find('li');
149
- expect(lis).toHaveLength(0);
150
-
151
- const emptyWrapper = wrapper.find('ul').find('p');
152
- expect(emptyWrapper.text()).toBe('No data');
153
- });
154
-
155
- it('should be hideable', () => {
156
- const core = initCore(schema, uischema, data);
157
- wrapper = mount(
158
- <JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
159
- <MaterialListWithDetailRenderer
160
- schema={schema}
161
- uischema={uischema}
162
- visible={false}
163
- />
164
- </JsonFormsStateProvider>
165
- );
166
-
167
- const controls = wrapper.find('ul');
168
- expect(controls).toHaveLength(0);
169
- });
170
-
171
- it('select renders corresponding data in detail', () => {
172
- const core = initCore(schema, uischema, data);
173
- wrapper = mount(
174
- <JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
175
- <MaterialListWithDetailRenderer schema={schema} uischema={uischema} />
176
- </JsonFormsStateProvider>
177
- );
178
-
179
- const liSecond = wrapper.find('div[role="button"]').at(1);
180
- liSecond.simulate('click');
181
-
182
- const controls = wrapper.find('input');
183
- expect(controls).toHaveLength(2);
184
-
185
- const controlFirst = wrapper.find('input').at(0);
186
- expect(controlFirst.props().value).toBe('Yolo');
187
- });
188
-
189
- it('ui schema label for list', () => {
190
- const uischemaWithLabel = {
191
- ...uischema,
192
- label: 'My awesome label'
193
- };
194
- const core = initCore(schema, uischema, data);
195
- wrapper = mount(
196
- <JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
197
- <MaterialListWithDetailRenderer
198
- schema={schema}
199
- uischema={uischemaWithLabel}
200
- />
201
- </JsonFormsStateProvider>
202
- );
203
-
204
- const listLabel = wrapper.find('h6').at(0);
205
- expect(listLabel.text()).toBe('My awesome label');
206
- });
207
-
208
- it('schema title for list', () => {
209
- const titleSchema = {
210
- ...schema,
211
- title: 'My awesome title'
212
- };
213
- const core = initCore(schema, uischema, data);
214
- wrapper = mount(
215
- <JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
216
- <MaterialListWithDetailRenderer
217
- schema={titleSchema}
218
- uischema={uischema}
219
- />
220
- </JsonFormsStateProvider>
221
- );
222
-
223
- const listTitle = wrapper.find('h6').at(0);
224
- expect(listTitle.text()).toBe('My awesome title');
225
- });
226
-
227
- it('choose appropriate labels in nested schema', () => {
228
- const core = initCore(schema, uischema, data);
229
- wrapper = mount(
230
- <JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
231
- <MaterialListWithDetailRenderer schema={schema} uischema={uischema} />
232
- </JsonFormsStateProvider>
233
- );
234
-
235
- const liSecond = wrapper.find('div[role="button"]').at(1);
236
- liSecond.simulate('click');
237
-
238
- const labels = wrapper.find('label');
239
- expect(labels).toHaveLength(2);
240
-
241
- const label = labels.at(0);
242
- expect(label.text()).toBe('Schema Title');
243
- });
244
-
245
- it('add data to the array', () => {
246
- const core = initCore(schema, uischema, data);
247
- wrapper = mount(
248
- <JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
249
- <MaterialListWithDetailRenderer schema={schema} uischema={uischema} />
250
- </JsonFormsStateProvider>
251
- );
252
-
253
- const addButton = wrapper.find('button').at(0);
254
- addButton.simulate('click');
255
-
256
- wrapper.update();
257
-
258
- const lis = wrapper.find('li');
259
- expect(lis).toHaveLength(3);
260
- });
261
-
262
- it('remove data from the array', () => {
263
- const core = initCore(schema, uischema, data);
264
- wrapper = mount(
265
- <JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
266
- <MaterialListWithDetailRenderer schema={schema} uischema={uischema} />
267
- </JsonFormsStateProvider>
268
- );
269
-
270
- expect(wrapper.find(ListItem)).toHaveLength(2);
271
-
272
- const removeButton = wrapper.find('button').at(1);
273
- removeButton.simulate('click');
274
- wrapper.update();
275
-
276
- const lis = wrapper.find(ListItem);
277
- expect(lis).toHaveLength(1);
278
- });
279
- });
@@ -1,81 +0,0 @@
1
- /*
2
- The MIT License
3
-
4
- Copyright (c) 2018-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 './MatchMediaMock';
26
- import React from 'react';
27
- import Enzyme, { mount, ReactWrapper } from 'enzyme';
28
- import { MaterialNativeControl } from '../../src/controls/MaterialNativeControl';
29
- import TextField from '@mui/material/TextField';
30
- import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
31
- import { ControlElement, ControlProps } from '@jsonforms/core';
32
-
33
- Enzyme.configure({ adapter: new Adapter() });
34
-
35
- const schema = {
36
- type: 'object',
37
- properties: {
38
- foo: {
39
- type: 'string',
40
- format: 'time'
41
- }
42
- }
43
- };
44
- const uischema: ControlElement = {
45
- type: 'Control',
46
- scope: '#/properties/foo'
47
- };
48
-
49
- const createMaterialNativeControl = (props: ControlProps) => {
50
- return <MaterialNativeControl {...props} />;
51
- };
52
-
53
- const defaultControlProps = (): ControlProps => {
54
- return {
55
- handleChange: () => { },
56
- enabled: false,
57
- visible: true,
58
- path: 'path',
59
- rootSchema: schema,
60
- schema: schema.properties.foo,
61
- uischema: uischema,
62
- label: 'Foo',
63
- id: 'foo-id',
64
- errors: '',
65
- data: ''
66
- };
67
- };
68
-
69
- describe('Material native control', () => {
70
- let wrapper: ReactWrapper;
71
-
72
- afterEach(() => {
73
- wrapper.unmount();
74
- });
75
-
76
- it('is disabled', () => {
77
- const props = defaultControlProps();
78
- wrapper = mount(createMaterialNativeControl(props));
79
- expect(wrapper.find(TextField).props().disabled).toEqual(true);
80
- });
81
- });