@jsonforms/material-renderers 3.0.0-beta.5 → 3.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/assets/js/search.json +1 -1
- package/docs/globals.html +77 -31
- package/docs/index.html +6 -0
- package/docs/interfaces/categorizationstate.html +1 -1
- package/docs/interfaces/categorizationstepperstate.html +1 -1
- package/docs/interfaces/materialcategorizationlayoutrendererprops.html +49 -4
- package/docs/interfaces/materialcategorizationstepperlayoutrendererprops.html +46 -1
- package/docs/interfaces/materiallabelablelayoutrendererprops.html +328 -0
- package/docs/interfaces/materiallayoutrendererprops.html +5 -0
- package/docs/interfaces/withoptionlabel.html +3 -3
- package/lib/additional/MaterialLabelRenderer.d.ts +3 -3
- package/lib/cells/MaterialEnumCell.d.ts +2 -1
- package/lib/cells/MaterialOneOfEnumCell.d.ts +2 -1
- package/lib/controls/MaterialEnumControl.d.ts +2 -1
- package/lib/controls/MaterialOneOfEnumControl.d.ts +2 -1
- package/lib/controls/index.d.ts +2 -2
- package/lib/jsonforms-react-material.cjs.js +82 -46
- package/lib/jsonforms-react-material.cjs.js.map +1 -1
- package/lib/jsonforms-react-material.esm.js +79 -48
- package/lib/jsonforms-react-material.esm.js.map +1 -1
- package/lib/layouts/MaterialCategorizationLayout.d.ts +4 -3
- package/lib/layouts/MaterialCategorizationStepperLayout.d.ts +4 -3
- package/lib/layouts/MaterialGroupLayout.d.ts +2 -2
- package/lib/layouts/MaterialHorizontalLayout.d.ts +1 -1
- package/lib/layouts/MaterialVerticalLayout.d.ts +1 -1
- package/lib/mui-controls/MuiAutocomplete.d.ts +2 -2
- package/lib/mui-controls/MuiSelect.d.ts +2 -1
- package/lib/util/i18nDefaults.d.ts +3 -0
- package/lib/util/index.d.ts +1 -0
- package/lib/util/layout.d.ts +3 -0
- package/package.json +6 -6
- package/src/additional/MaterialLabelRenderer.tsx +5 -7
- package/src/cells/MaterialEnumCell.tsx +4 -3
- package/src/cells/MaterialOneOfEnumCell.tsx +3 -3
- package/src/controls/MaterialEnumControl.tsx +12 -5
- package/src/controls/MaterialOneOfEnumControl.tsx +13 -5
- package/src/layouts/MaterialCategorizationLayout.tsx +18 -9
- package/src/layouts/MaterialCategorizationStepperLayout.tsx +19 -12
- package/src/layouts/MaterialGroupLayout.tsx +6 -5
- package/src/mui-controls/MuiAutocomplete.tsx +81 -38
- package/src/mui-controls/MuiInputText.tsx +4 -1
- package/src/mui-controls/MuiSelect.tsx +10 -5
- package/src/util/i18nDefaults.ts +3 -0
- package/src/util/index.ts +1 -0
- package/src/util/layout.tsx +4 -0
- package/stats.html +1 -1
- package/test/renderers/MaterialArrayLayout.test.tsx +4 -4
- package/test/renderers/MaterialCategorizationLayout.test.tsx +17 -7
- package/test/renderers/MaterialCategorizationStepperLayout.test.tsx +21 -11
- package/test/renderers/MaterialGroupLayout.test.tsx +4 -1
- package/test/renderers/MaterialInputControl.test.tsx +4 -0
- package/test/renderers/MaterialLabelRenderer.test.tsx +2 -1
- package/test/renderers/util.ts +5 -0
|
@@ -27,6 +27,8 @@ import React from 'react';
|
|
|
27
27
|
import {
|
|
28
28
|
Categorization,
|
|
29
29
|
ControlElement,
|
|
30
|
+
createAjv,
|
|
31
|
+
defaultJsonFormsI18nState,
|
|
30
32
|
Layout,
|
|
31
33
|
layoutDefaultProps,
|
|
32
34
|
RuleEffect,
|
|
@@ -63,9 +65,17 @@ const fixture = {
|
|
|
63
65
|
label: 'B'
|
|
64
66
|
}
|
|
65
67
|
]
|
|
66
|
-
}
|
|
68
|
+
},
|
|
67
69
|
};
|
|
68
70
|
|
|
71
|
+
const testDefaultProps = {
|
|
72
|
+
...layoutDefaultProps,
|
|
73
|
+
data: fixture.data,
|
|
74
|
+
ajv: createAjv(),
|
|
75
|
+
t: defaultJsonFormsI18nState.translate,
|
|
76
|
+
locale: defaultJsonFormsI18nState.locale
|
|
77
|
+
}
|
|
78
|
+
|
|
69
79
|
describe('Material categorization stepper layout tester', () => {
|
|
70
80
|
it('should not fail when given undefined data', () => {
|
|
71
81
|
expect(materialCategorizationStepperTester(undefined, undefined, undefined)).toBe(-1);
|
|
@@ -218,7 +228,7 @@ describe('Material categorization stepper layout', () => {
|
|
|
218
228
|
const wrapper = mount(
|
|
219
229
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
220
230
|
<MaterialCategorizationStepperLayoutRenderer
|
|
221
|
-
{...
|
|
231
|
+
{...testDefaultProps}
|
|
222
232
|
schema={fixture.schema}
|
|
223
233
|
uischema={uischema}
|
|
224
234
|
/>
|
|
@@ -273,7 +283,7 @@ describe('Material categorization stepper layout', () => {
|
|
|
273
283
|
const wrapper = mount(
|
|
274
284
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
275
285
|
<MaterialCategorizationStepperLayoutRenderer
|
|
276
|
-
{...
|
|
286
|
+
{...testDefaultProps}
|
|
277
287
|
schema={fixture.schema}
|
|
278
288
|
uischema={uischema}
|
|
279
289
|
/>
|
|
@@ -297,7 +307,7 @@ describe('Material categorization stepper layout', () => {
|
|
|
297
307
|
const wrapper = mount(
|
|
298
308
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
299
309
|
<MaterialCategorizationStepperLayoutRenderer
|
|
300
|
-
{...
|
|
310
|
+
{...testDefaultProps}
|
|
301
311
|
schema={fixture.schema}
|
|
302
312
|
uischema={fixture.uischema}
|
|
303
313
|
visible={false}
|
|
@@ -314,7 +324,7 @@ describe('Material categorization stepper layout', () => {
|
|
|
314
324
|
const wrapper = mount(
|
|
315
325
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
316
326
|
<MaterialCategorizationStepperLayoutRenderer
|
|
317
|
-
{...
|
|
327
|
+
{...testDefaultProps}
|
|
318
328
|
schema={fixture.schema}
|
|
319
329
|
uischema={fixture.uischema}
|
|
320
330
|
/>
|
|
@@ -355,7 +365,7 @@ describe('Material categorization stepper layout', () => {
|
|
|
355
365
|
const wrapper = mount(
|
|
356
366
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
357
367
|
<MaterialCategorizationStepperLayoutRenderer
|
|
358
|
-
{...
|
|
368
|
+
{...testDefaultProps}
|
|
359
369
|
schema={fixture.schema}
|
|
360
370
|
uischema={uischema}
|
|
361
371
|
/>
|
|
@@ -372,7 +382,7 @@ describe('Material categorization stepper layout', () => {
|
|
|
372
382
|
const wrapper = mount(
|
|
373
383
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
374
384
|
<MaterialCategorizationStepperLayoutRenderer
|
|
375
|
-
{...
|
|
385
|
+
{...testDefaultProps}
|
|
376
386
|
schema={fixture.schema}
|
|
377
387
|
uischema={fixture.uischema}
|
|
378
388
|
renderers={renderers}
|
|
@@ -413,7 +423,7 @@ describe('Material categorization stepper layout', () => {
|
|
|
413
423
|
const wrapper = mount(
|
|
414
424
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
415
425
|
<MaterialCategorizationStepperLayoutRenderer
|
|
416
|
-
{...
|
|
426
|
+
{...testDefaultProps}
|
|
417
427
|
schema={fixture.schema}
|
|
418
428
|
uischema={uischema}
|
|
419
429
|
/>
|
|
@@ -481,7 +491,7 @@ describe('Material categorization stepper layout', () => {
|
|
|
481
491
|
const wrapper = mount(
|
|
482
492
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
483
493
|
<MaterialCategorizationStepperLayoutRenderer
|
|
484
|
-
{...
|
|
494
|
+
{...testDefaultProps}
|
|
485
495
|
schema={fixture.schema}
|
|
486
496
|
uischema={uischema}
|
|
487
497
|
/>
|
|
@@ -540,7 +550,7 @@ describe('Material categorization stepper layout', () => {
|
|
|
540
550
|
const wrapper = mount(
|
|
541
551
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
542
552
|
<MaterialCategorizationStepperLayoutRenderer
|
|
543
|
-
{...
|
|
553
|
+
{...testDefaultProps}
|
|
544
554
|
schema={fixture.schema}
|
|
545
555
|
uischema={uischema}
|
|
546
556
|
/>
|
|
@@ -610,7 +620,7 @@ describe('Material categorization stepper layout', () => {
|
|
|
610
620
|
const wrapper = mount(
|
|
611
621
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
612
622
|
<MaterialCategorizationStepperLayoutRenderer
|
|
613
|
-
{...
|
|
623
|
+
{...testDefaultProps}
|
|
614
624
|
schema={fixture.schema}
|
|
615
625
|
uischema={uischema}
|
|
616
626
|
/>
|
|
@@ -67,7 +67,7 @@ const uischema = {
|
|
|
67
67
|
describe('Material group layout', () => {
|
|
68
68
|
it('should render a GroupComponent with direction column when given no direction LayoutProp', () => {
|
|
69
69
|
const wrapper = mount(
|
|
70
|
-
<MaterialGroupLayout schema={schema} uischema={uischema} />
|
|
70
|
+
<MaterialGroupLayout schema={schema} uischema={uischema} direction="column" enabled visible path=""/>
|
|
71
71
|
);
|
|
72
72
|
expect(wrapper.find(MaterialLayoutRenderer).props().direction).toBe(
|
|
73
73
|
'column'
|
|
@@ -80,6 +80,9 @@ describe('Material group layout', () => {
|
|
|
80
80
|
schema={schema}
|
|
81
81
|
uischema={uischema}
|
|
82
82
|
direction={'row'}
|
|
83
|
+
enabled
|
|
84
|
+
visible
|
|
85
|
+
path=""
|
|
83
86
|
/>
|
|
84
87
|
);
|
|
85
88
|
expect(wrapper.find(MaterialLayoutRenderer).props().direction).toBe('row');
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
import './MatchMediaMock';
|
|
26
26
|
import * as React from 'react';
|
|
27
27
|
import {
|
|
28
|
+
LabelElement,
|
|
28
29
|
NOT_APPLICABLE
|
|
29
30
|
} from '@jsonforms/core';
|
|
30
31
|
import '../../src/cells';
|
|
@@ -44,7 +45,7 @@ const schema = {
|
|
|
44
45
|
type: 'object',
|
|
45
46
|
properties: {}
|
|
46
47
|
};
|
|
47
|
-
const uischema = {
|
|
48
|
+
const uischema: LabelElement = {
|
|
48
49
|
type: 'Label',
|
|
49
50
|
text: 'Foo'
|
|
50
51
|
};
|
package/test/renderers/util.ts
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
import {
|
|
27
27
|
createAjv,
|
|
28
28
|
JsonSchema,
|
|
29
|
+
TesterContext,
|
|
29
30
|
UISchemaElement
|
|
30
31
|
} from '@jsonforms/core';
|
|
31
32
|
import { JsonFormsReactProps, useJsonForms } from '@jsonforms/react';
|
|
@@ -43,3 +44,7 @@ export const TestEmitter : React.FC<JsonFormsReactProps> = ({onChange}) => {
|
|
|
43
44
|
}, [data, errors]);
|
|
44
45
|
return null;
|
|
45
46
|
};
|
|
47
|
+
|
|
48
|
+
export const createTesterContext = (rootSchema: JsonSchema, config?: any): TesterContext => {
|
|
49
|
+
return { rootSchema, config };
|
|
50
|
+
};
|