@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.
- package/lib/controls/MaterialBooleanControl.d.ts +1 -1
- package/lib/controls/MaterialBooleanToggleControl.d.ts +1 -1
- package/lib/controls/index.d.ts +2 -2
- package/lib/jsonforms-react-material.cjs.js +79 -11
- package/lib/jsonforms-react-material.cjs.js.map +1 -1
- package/lib/jsonforms-react-material.esm.js +79 -11
- package/lib/jsonforms-react-material.esm.js.map +1 -1
- package/lib/mui-controls/MuiCheckbox.d.ts +6 -1
- package/lib/mui-controls/MuiToggle.d.ts +6 -1
- package/package.json +23 -12
- package/src/additional/ListWithDetailMasterItem.tsx +1 -1
- package/src/controls/MaterialBooleanControl.tsx +84 -23
- package/src/controls/MaterialBooleanToggleControl.tsx +84 -23
- package/src/mui-controls/MuiCheckbox.tsx +12 -5
- package/src/mui-controls/MuiToggle.tsx +12 -5
- 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/example/index.ts +0 -31
- package/rollup.config.js +0 -51
- package/stats.html +0 -3279
- package/test/renderers/MatchMediaMock.ts +0 -36
- 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/test/renderers/util.ts +0 -50
- package/tsconfig.json +0 -13
- package/tsconfig.test.json +0 -7
- package/webpack/webpack.dev.js +0 -11
|
@@ -1,303 +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 * as React from 'react';
|
|
27
|
-
import {
|
|
28
|
-
ControlElement,
|
|
29
|
-
NOT_APPLICABLE
|
|
30
|
-
} from '@jsonforms/core';
|
|
31
|
-
import { JsonFormsStateProvider } from '@jsonforms/react';
|
|
32
|
-
import MaterialDateCell, {
|
|
33
|
-
materialDateCellTester
|
|
34
|
-
} from '../../src/cells/MaterialDateCell';
|
|
35
|
-
import { materialRenderers } from '../../src';
|
|
36
|
-
|
|
37
|
-
import Enzyme, { mount, ReactWrapper } from 'enzyme';
|
|
38
|
-
import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
|
|
39
|
-
import { initCore, TestEmitter } from './util';
|
|
40
|
-
|
|
41
|
-
Enzyme.configure({ adapter: new Adapter() });
|
|
42
|
-
|
|
43
|
-
const data = { foo: '1980-06-04' };
|
|
44
|
-
const schema = {
|
|
45
|
-
type: 'string',
|
|
46
|
-
format: 'date'
|
|
47
|
-
};
|
|
48
|
-
const uischema: ControlElement = {
|
|
49
|
-
type: 'Control',
|
|
50
|
-
scope: '#/properties/foo'
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
describe('Material date cell', () => {
|
|
54
|
-
it('should fail', () => {
|
|
55
|
-
expect(materialDateCellTester(undefined, undefined, undefined)).toBe(NOT_APPLICABLE);
|
|
56
|
-
expect(materialDateCellTester(null, undefined, undefined)).toBe(NOT_APPLICABLE);
|
|
57
|
-
expect(materialDateCellTester({ type: 'Foo' }, undefined, undefined)).toBe(
|
|
58
|
-
NOT_APPLICABLE
|
|
59
|
-
);
|
|
60
|
-
expect(materialDateCellTester({ type: 'Control' }, undefined, undefined)).toBe(
|
|
61
|
-
NOT_APPLICABLE
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
expect(
|
|
65
|
-
materialDateCellTester(uischema, {
|
|
66
|
-
type: 'object',
|
|
67
|
-
properties: {
|
|
68
|
-
foo: { type: 'string' }
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
undefined)
|
|
72
|
-
).toBe(NOT_APPLICABLE);
|
|
73
|
-
expect(
|
|
74
|
-
materialDateCellTester(uischema, {
|
|
75
|
-
type: 'object',
|
|
76
|
-
properties: {
|
|
77
|
-
foo: { type: 'string' },
|
|
78
|
-
bar: {
|
|
79
|
-
type: 'string',
|
|
80
|
-
format: 'date'
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
undefined)
|
|
85
|
-
).toBe(NOT_APPLICABLE);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('should succeed', () => {
|
|
89
|
-
expect(
|
|
90
|
-
materialDateCellTester(uischema, {
|
|
91
|
-
type: 'object',
|
|
92
|
-
properties: {
|
|
93
|
-
foo: {
|
|
94
|
-
type: 'string',
|
|
95
|
-
format: 'date'
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
undefined)
|
|
100
|
-
).toBe(2);
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
describe('Material date cell', () => {
|
|
105
|
-
let wrapper: ReactWrapper;
|
|
106
|
-
|
|
107
|
-
afterEach(() => wrapper.unmount());
|
|
108
|
-
|
|
109
|
-
it('should autofocus via option', () => {
|
|
110
|
-
const control: ControlElement = {
|
|
111
|
-
type: 'Control',
|
|
112
|
-
scope: '#/properties/foo',
|
|
113
|
-
options: {
|
|
114
|
-
focus: true
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
const core = initCore(schema, control, data);
|
|
118
|
-
wrapper = mount(
|
|
119
|
-
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
120
|
-
<MaterialDateCell schema={schema} uischema={control} path='foo' />
|
|
121
|
-
</JsonFormsStateProvider>
|
|
122
|
-
);
|
|
123
|
-
const input = wrapper.find('input').first();
|
|
124
|
-
expect(input.props().autoFocus).toBeTruthy();
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it('should not autofocus via option', () => {
|
|
128
|
-
const control: ControlElement = {
|
|
129
|
-
type: 'Control',
|
|
130
|
-
scope: '#/properties/foo',
|
|
131
|
-
options: {
|
|
132
|
-
focus: false
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
const core = initCore(schema, uischema, data);
|
|
136
|
-
wrapper = mount(
|
|
137
|
-
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
138
|
-
<MaterialDateCell schema={schema} uischema={control} path='foo' />
|
|
139
|
-
</JsonFormsStateProvider>
|
|
140
|
-
);
|
|
141
|
-
const input = wrapper.find('input').first();
|
|
142
|
-
expect(input.props().autoFocus).toBeFalsy();
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
it('should not autofocus by default', () => {
|
|
146
|
-
const control: ControlElement = {
|
|
147
|
-
type: 'Control',
|
|
148
|
-
scope: '#/properties/foo'
|
|
149
|
-
};
|
|
150
|
-
const core = initCore(schema, uischema, data);
|
|
151
|
-
wrapper = mount(
|
|
152
|
-
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
153
|
-
<MaterialDateCell schema={schema} uischema={control} path='foo' />
|
|
154
|
-
</JsonFormsStateProvider>
|
|
155
|
-
);
|
|
156
|
-
const input = wrapper.find('input').first();
|
|
157
|
-
expect(input.props().autoFocus).toBeFalsy();
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
it('should render', () => {
|
|
161
|
-
const core = initCore(schema, uischema, data);
|
|
162
|
-
wrapper = mount(
|
|
163
|
-
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
164
|
-
<MaterialDateCell schema={schema} uischema={uischema} path='foo' />
|
|
165
|
-
</JsonFormsStateProvider>
|
|
166
|
-
);
|
|
167
|
-
|
|
168
|
-
const input = wrapper.find('input').first();
|
|
169
|
-
expect(input.props().type).toBe('date');
|
|
170
|
-
expect(input.props().value).toBe('1980-06-04');
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
it('should update via event', () => {
|
|
174
|
-
const core = initCore(schema, uischema, data);
|
|
175
|
-
const onChangeData: any = {
|
|
176
|
-
data: undefined
|
|
177
|
-
};
|
|
178
|
-
wrapper = mount(
|
|
179
|
-
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
180
|
-
<TestEmitter
|
|
181
|
-
onChange={({ data }) => {
|
|
182
|
-
onChangeData.data = data;
|
|
183
|
-
}}
|
|
184
|
-
/>
|
|
185
|
-
<MaterialDateCell schema={schema} uischema={uischema} path='foo' />
|
|
186
|
-
</JsonFormsStateProvider>
|
|
187
|
-
);
|
|
188
|
-
const input = wrapper.find('input').first();
|
|
189
|
-
input.simulate('change', { target: { value: '1961-04-12' } });
|
|
190
|
-
expect(onChangeData.data.foo).toBe('1961-04-12');
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
it('should update via action', () => {
|
|
194
|
-
const core = initCore(schema, uischema, data);
|
|
195
|
-
wrapper = mount(
|
|
196
|
-
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
197
|
-
<MaterialDateCell schema={schema} uischema={uischema} path='foo' />
|
|
198
|
-
</JsonFormsStateProvider>
|
|
199
|
-
);
|
|
200
|
-
core.data = { ...core.data, foo: '1961-04-12' };
|
|
201
|
-
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
202
|
-
wrapper.update();
|
|
203
|
-
const input = wrapper.find('input').first();
|
|
204
|
-
expect(input.props().value).toBe('1961-04-12');
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
it('should update with null value', () => {
|
|
208
|
-
const core = initCore(schema, uischema, data);
|
|
209
|
-
wrapper = mount(
|
|
210
|
-
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
211
|
-
<MaterialDateCell schema={schema} uischema={uischema} path='foo' />
|
|
212
|
-
</JsonFormsStateProvider>
|
|
213
|
-
);
|
|
214
|
-
core.data = { ...core.data, foo: null };
|
|
215
|
-
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
216
|
-
wrapper.update();
|
|
217
|
-
const input = wrapper.find('input');
|
|
218
|
-
expect(input.props().value).toBe('');
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
it('should update with undefined value', () => {
|
|
222
|
-
const core = initCore(schema, uischema, data);
|
|
223
|
-
wrapper = mount(
|
|
224
|
-
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
225
|
-
<MaterialDateCell schema={schema} uischema={uischema} path='foo' />
|
|
226
|
-
</JsonFormsStateProvider>
|
|
227
|
-
);
|
|
228
|
-
core.data = { ...core.data, foo: undefined };
|
|
229
|
-
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
230
|
-
wrapper.update();
|
|
231
|
-
const input = wrapper.find('input').first();
|
|
232
|
-
expect(input.props().value).toBe('');
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
it('should not update with wrong ref', () => {
|
|
236
|
-
const core = initCore(schema, uischema, data);
|
|
237
|
-
wrapper = mount(
|
|
238
|
-
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
239
|
-
<MaterialDateCell schema={schema} uischema={uischema} path='foo' />
|
|
240
|
-
</JsonFormsStateProvider>
|
|
241
|
-
);
|
|
242
|
-
core.data = { ...core.data, bar: 'Bar' };
|
|
243
|
-
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
244
|
-
wrapper.update();
|
|
245
|
-
const input = wrapper.find('input').first();
|
|
246
|
-
expect(input.props().value).toBe('1980-06-04');
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
it('should not update with null ref', () => {
|
|
250
|
-
const core = initCore(schema, uischema, data);
|
|
251
|
-
wrapper = mount(
|
|
252
|
-
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
253
|
-
<MaterialDateCell schema={schema} uischema={uischema} path='foo' />
|
|
254
|
-
</JsonFormsStateProvider>
|
|
255
|
-
);
|
|
256
|
-
core.data = { ...core.data, null: '1961-04-12' };
|
|
257
|
-
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
258
|
-
wrapper.update();
|
|
259
|
-
const input = wrapper.find('input').first();
|
|
260
|
-
expect(input.props().value).toBe('1980-06-04');
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
it('should update with undefined ref', () => {
|
|
264
|
-
const core = initCore(schema, uischema, data);
|
|
265
|
-
wrapper = mount(
|
|
266
|
-
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
267
|
-
<MaterialDateCell schema={schema} uischema={uischema} path='foo' />
|
|
268
|
-
</JsonFormsStateProvider>
|
|
269
|
-
);
|
|
270
|
-
core.data = { ...core.data, undefined: '1961-04-12' };
|
|
271
|
-
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
272
|
-
wrapper.update();
|
|
273
|
-
const input = wrapper.find('input').first();
|
|
274
|
-
expect(input.props().value).toBe('1980-06-04');
|
|
275
|
-
});
|
|
276
|
-
|
|
277
|
-
it('can be disabled', () => {
|
|
278
|
-
const core = initCore(schema, uischema, data);
|
|
279
|
-
wrapper = mount(
|
|
280
|
-
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
281
|
-
<MaterialDateCell
|
|
282
|
-
schema={schema}
|
|
283
|
-
uischema={uischema}
|
|
284
|
-
enabled={false}
|
|
285
|
-
path='foo'
|
|
286
|
-
/>
|
|
287
|
-
</JsonFormsStateProvider>
|
|
288
|
-
);
|
|
289
|
-
const input = wrapper.find('input').first();
|
|
290
|
-
expect(input.props().disabled).toBeTruthy();
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
it('should be enabled by default', () => {
|
|
294
|
-
const core = initCore(schema, uischema, data);
|
|
295
|
-
wrapper = mount(
|
|
296
|
-
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
297
|
-
<MaterialDateCell schema={schema} uischema={uischema} path='foo' />
|
|
298
|
-
</JsonFormsStateProvider>
|
|
299
|
-
);
|
|
300
|
-
const input = wrapper.find('input').first();
|
|
301
|
-
expect(input.props().disabled).toBeFalsy();
|
|
302
|
-
});
|
|
303
|
-
});
|