@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.
Files changed (53) hide show
  1. package/docs/assets/js/search.json +1 -1
  2. package/docs/globals.html +77 -31
  3. package/docs/index.html +6 -0
  4. package/docs/interfaces/categorizationstate.html +1 -1
  5. package/docs/interfaces/categorizationstepperstate.html +1 -1
  6. package/docs/interfaces/materialcategorizationlayoutrendererprops.html +49 -4
  7. package/docs/interfaces/materialcategorizationstepperlayoutrendererprops.html +46 -1
  8. package/docs/interfaces/materiallabelablelayoutrendererprops.html +328 -0
  9. package/docs/interfaces/materiallayoutrendererprops.html +5 -0
  10. package/docs/interfaces/withoptionlabel.html +3 -3
  11. package/lib/additional/MaterialLabelRenderer.d.ts +3 -3
  12. package/lib/cells/MaterialEnumCell.d.ts +2 -1
  13. package/lib/cells/MaterialOneOfEnumCell.d.ts +2 -1
  14. package/lib/controls/MaterialEnumControl.d.ts +2 -1
  15. package/lib/controls/MaterialOneOfEnumControl.d.ts +2 -1
  16. package/lib/controls/index.d.ts +2 -2
  17. package/lib/jsonforms-react-material.cjs.js +82 -46
  18. package/lib/jsonforms-react-material.cjs.js.map +1 -1
  19. package/lib/jsonforms-react-material.esm.js +79 -48
  20. package/lib/jsonforms-react-material.esm.js.map +1 -1
  21. package/lib/layouts/MaterialCategorizationLayout.d.ts +4 -3
  22. package/lib/layouts/MaterialCategorizationStepperLayout.d.ts +4 -3
  23. package/lib/layouts/MaterialGroupLayout.d.ts +2 -2
  24. package/lib/layouts/MaterialHorizontalLayout.d.ts +1 -1
  25. package/lib/layouts/MaterialVerticalLayout.d.ts +1 -1
  26. package/lib/mui-controls/MuiAutocomplete.d.ts +2 -2
  27. package/lib/mui-controls/MuiSelect.d.ts +2 -1
  28. package/lib/util/i18nDefaults.d.ts +3 -0
  29. package/lib/util/index.d.ts +1 -0
  30. package/lib/util/layout.d.ts +3 -0
  31. package/package.json +6 -6
  32. package/src/additional/MaterialLabelRenderer.tsx +5 -7
  33. package/src/cells/MaterialEnumCell.tsx +4 -3
  34. package/src/cells/MaterialOneOfEnumCell.tsx +3 -3
  35. package/src/controls/MaterialEnumControl.tsx +12 -5
  36. package/src/controls/MaterialOneOfEnumControl.tsx +13 -5
  37. package/src/layouts/MaterialCategorizationLayout.tsx +18 -9
  38. package/src/layouts/MaterialCategorizationStepperLayout.tsx +19 -12
  39. package/src/layouts/MaterialGroupLayout.tsx +6 -5
  40. package/src/mui-controls/MuiAutocomplete.tsx +81 -38
  41. package/src/mui-controls/MuiInputText.tsx +4 -1
  42. package/src/mui-controls/MuiSelect.tsx +10 -5
  43. package/src/util/i18nDefaults.ts +3 -0
  44. package/src/util/index.ts +1 -0
  45. package/src/util/layout.tsx +4 -0
  46. package/stats.html +1 -1
  47. package/test/renderers/MaterialArrayLayout.test.tsx +4 -4
  48. package/test/renderers/MaterialCategorizationLayout.test.tsx +17 -7
  49. package/test/renderers/MaterialCategorizationStepperLayout.test.tsx +21 -11
  50. package/test/renderers/MaterialGroupLayout.test.tsx +4 -1
  51. package/test/renderers/MaterialInputControl.test.tsx +4 -0
  52. package/test/renderers/MaterialLabelRenderer.test.tsx +2 -1
  53. 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
- {...layoutDefaultProps}
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
- {...layoutDefaultProps}
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
- {...layoutDefaultProps}
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
- {...layoutDefaultProps}
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
- {...layoutDefaultProps}
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
- {...layoutDefaultProps}
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
- {...layoutDefaultProps}
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
- {...layoutDefaultProps}
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
- {...layoutDefaultProps}
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
- {...layoutDefaultProps}
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');
@@ -250,6 +250,10 @@ describe('Material input control', () => {
250
250
  <MaterialHorizontalLayoutRenderer
251
251
  schema={jsonSchema}
252
252
  uischema={layout}
253
+ direction="row"
254
+ enabled
255
+ visible
256
+ path=""
253
257
  />
254
258
  </ JsonFormsStateProvider>
255
259
  );
@@ -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
  };
@@ -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
+ };