@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.
Files changed (205) hide show
  1. package/README.md +16 -17
  2. package/lib/additional/ListWithDetailMasterItem.d.ts +2 -0
  3. package/lib/additional/MaterialListWithDetailRenderer.d.ts +1 -1
  4. package/lib/additional/index.d.ts +2 -2
  5. package/lib/additional/unwrapped.d.ts +5 -0
  6. package/lib/cells/index.d.ts +1 -1
  7. package/lib/complex/CombinatorProperties.d.ts +1 -2
  8. package/lib/complex/DeleteDialog.d.ts +5 -1
  9. package/lib/complex/MaterialAllOfRenderer.d.ts +1 -1
  10. package/lib/complex/MaterialAnyOfRenderer.d.ts +1 -1
  11. package/lib/complex/MaterialArrayControlRenderer.d.ts +2 -1
  12. package/lib/complex/MaterialEnumArrayRenderer.d.ts +1 -1
  13. package/lib/complex/MaterialObjectRenderer.d.ts +1 -1
  14. package/lib/complex/MaterialOneOfRenderer.d.ts +1 -1
  15. package/lib/complex/MaterialTableControl.d.ts +4 -2
  16. package/lib/complex/NoBorderTableCell.d.ts +2 -2
  17. package/lib/complex/TableToolbar.d.ts +3 -2
  18. package/lib/complex/index.d.ts +11 -16
  19. package/lib/complex/unwrapped.d.ts +9 -0
  20. package/lib/controls/MaterialBooleanControl.d.ts +1 -1
  21. package/lib/controls/MaterialBooleanToggleControl.d.ts +1 -1
  22. package/lib/controls/index.d.ts +8 -26
  23. package/lib/controls/unwrapped.d.ts +19 -0
  24. package/lib/index.d.ts +34 -1
  25. package/lib/jsonforms-react-material.cjs.js +731 -572
  26. package/lib/jsonforms-react-material.cjs.js.map +1 -1
  27. package/lib/jsonforms-react-material.esm.js +648 -517
  28. package/lib/jsonforms-react-material.esm.js.map +1 -1
  29. package/lib/layouts/ArrayToolbar.d.ts +3 -1
  30. package/lib/layouts/ExpandPanelRenderer.d.ts +3 -1
  31. package/lib/layouts/MaterialGroupLayout.d.ts +1 -1
  32. package/lib/layouts/MaterialHorizontalLayout.d.ts +1 -1
  33. package/lib/layouts/MaterialVerticalLayout.d.ts +1 -1
  34. package/lib/layouts/index.d.ts +3 -1
  35. package/lib/layouts/unwrapped.d.ts +10 -0
  36. package/lib/mui-controls/MuiCheckbox.d.ts +6 -1
  37. package/lib/mui-controls/MuiInputInteger.d.ts +1 -1
  38. package/lib/mui-controls/MuiInputNumber.d.ts +1 -1
  39. package/lib/mui-controls/MuiInputNumberFormat.d.ts +1 -1
  40. package/lib/mui-controls/MuiInputText.d.ts +1 -1
  41. package/lib/mui-controls/MuiInputTime.d.ts +1 -1
  42. package/lib/mui-controls/MuiSelect.d.ts +1 -1
  43. package/lib/mui-controls/MuiToggle.d.ts +6 -1
  44. package/lib/mui-controls/index.d.ts +3 -1
  45. package/lib/util/layout.d.ts +2 -3
  46. package/package.json +33 -15
  47. package/src/additional/ListWithDetailMasterItem.tsx +32 -24
  48. package/src/additional/MaterialLabelRenderer.tsx +8 -15
  49. package/src/additional/MaterialListWithDetailRenderer.tsx +8 -5
  50. package/src/additional/index.ts +12 -4
  51. package/{example/index.ts → src/additional/unwrapped.ts} +7 -6
  52. package/src/cells/MaterialBooleanCell.tsx +1 -1
  53. package/src/cells/MaterialBooleanToggleCell.tsx +2 -2
  54. package/src/cells/MaterialDateCell.tsx +4 -12
  55. package/src/cells/MaterialEnumCell.tsx +13 -6
  56. package/src/cells/MaterialIntegerCell.tsx +1 -1
  57. package/src/cells/MaterialNumberCell.tsx +1 -1
  58. package/src/cells/MaterialNumberFormatCell.tsx +1 -1
  59. package/src/cells/MaterialOneOfEnumCell.tsx +17 -7
  60. package/src/cells/MaterialTextCell.tsx +1 -1
  61. package/src/cells/MaterialTimeCell.tsx +1 -1
  62. package/src/cells/index.ts +7 -7
  63. package/src/complex/CombinatorProperties.tsx +20 -9
  64. package/src/complex/DeleteDialog.tsx +48 -37
  65. package/src/complex/MaterialAllOfRenderer.tsx +2 -2
  66. package/src/complex/MaterialAnyOfRenderer.tsx +3 -3
  67. package/src/complex/MaterialArrayControlRenderer.tsx +27 -11
  68. package/src/complex/MaterialEnumArrayRenderer.tsx +6 -8
  69. package/src/complex/MaterialObjectRenderer.tsx +6 -3
  70. package/src/complex/MaterialOneOfRenderer.tsx +105 -88
  71. package/src/complex/MaterialTableControl.tsx +145 -97
  72. package/src/complex/NoBorderTableCell.tsx +3 -5
  73. package/src/complex/TableToolbar.tsx +24 -25
  74. package/src/complex/ValidationIcon.tsx +10 -18
  75. package/src/complex/index.ts +35 -32
  76. package/{test/renderers/MatchMediaMock.ts → src/complex/unwrapped.ts} +19 -16
  77. package/src/controls/MaterialAnyOfStringOrEnumControl.tsx +19 -11
  78. package/src/controls/MaterialBooleanControl.tsx +90 -23
  79. package/src/controls/MaterialBooleanToggleControl.tsx +90 -23
  80. package/src/controls/MaterialDateControl.tsx +16 -19
  81. package/src/controls/MaterialDateTimeControl.tsx +24 -23
  82. package/src/controls/MaterialEnumControl.tsx +21 -15
  83. package/src/controls/MaterialInputControl.tsx +7 -8
  84. package/src/controls/MaterialIntegerControl.tsx +1 -1
  85. package/src/controls/MaterialNativeControl.tsx +12 -9
  86. package/src/controls/MaterialNumberControl.tsx +1 -1
  87. package/src/controls/MaterialOneOfEnumControl.tsx +21 -15
  88. package/src/controls/MaterialOneOfRadioGroupControl.tsx +5 -3
  89. package/src/controls/MaterialRadioGroup.tsx +11 -17
  90. package/src/controls/MaterialRadioGroupControl.tsx +8 -3
  91. package/src/controls/MaterialSliderControl.tsx +17 -16
  92. package/src/controls/MaterialTextControl.tsx +1 -1
  93. package/src/controls/MaterialTimeControl.tsx +19 -22
  94. package/src/controls/index.ts +36 -72
  95. package/src/controls/unwrapped.ts +57 -0
  96. package/src/index.ts +41 -22
  97. package/src/layouts/ArrayToolbar.tsx +38 -42
  98. package/src/layouts/ExpandPanelRenderer.tsx +96 -67
  99. package/src/layouts/MaterialArrayLayout.tsx +21 -16
  100. package/src/layouts/MaterialArrayLayoutRenderer.tsx +6 -9
  101. package/src/layouts/MaterialCategorizationLayout.tsx +52 -21
  102. package/src/layouts/MaterialCategorizationStepperLayout.tsx +60 -44
  103. package/src/layouts/MaterialGroupLayout.tsx +25 -6
  104. package/src/layouts/MaterialHorizontalLayout.tsx +18 -4
  105. package/src/layouts/MaterialVerticalLayout.tsx +18 -4
  106. package/src/layouts/index.ts +18 -7
  107. package/{test/renderers/util.ts → src/layouts/unwrapped.ts} +19 -28
  108. package/src/mui-controls/MuiAutocomplete.tsx +51 -35
  109. package/src/mui-controls/MuiCheckbox.tsx +14 -5
  110. package/src/mui-controls/MuiInputInteger.tsx +31 -32
  111. package/src/mui-controls/MuiInputNumber.tsx +16 -16
  112. package/src/mui-controls/MuiInputNumberFormat.tsx +51 -42
  113. package/src/mui-controls/MuiInputText.tsx +30 -19
  114. package/src/mui-controls/MuiInputTime.tsx +11 -12
  115. package/src/mui-controls/MuiSelect.tsx +15 -6
  116. package/src/mui-controls/MuiToggle.tsx +14 -5
  117. package/src/mui-controls/index.ts +3 -1
  118. package/src/util/datejs.tsx +41 -20
  119. package/src/util/debounce.ts +26 -11
  120. package/src/util/focus.ts +7 -7
  121. package/src/util/i18nDefaults.ts +2 -2
  122. package/src/util/layout.tsx +47 -42
  123. package/src/util/theme.ts +2 -2
  124. package/docs/assets/css/main.css +0 -1
  125. package/docs/assets/images/icons.png +0 -0
  126. package/docs/assets/images/icons@2x.png +0 -0
  127. package/docs/assets/images/widgets.png +0 -0
  128. package/docs/assets/images/widgets@2x.png +0 -0
  129. package/docs/assets/js/main.js +0 -51
  130. package/docs/assets/js/search.json +0 -1
  131. package/docs/classes/combinatorproperties.html +0 -957
  132. package/docs/classes/materialanyofstringorenumcontrol.html +0 -822
  133. package/docs/classes/materialtablecontrol.html +0 -999
  134. package/docs/globals.html +0 -4492
  135. package/docs/index.html +0 -753
  136. package/docs/interfaces/ajvprops.html +0 -162
  137. package/docs/interfaces/arraylayouttoolbarprops.html +0 -253
  138. package/docs/interfaces/categorizationstate.html +0 -154
  139. package/docs/interfaces/categorizationstepperstate.html +0 -154
  140. package/docs/interfaces/combinatorpropertiesprops.html +0 -182
  141. package/docs/interfaces/deletedialogprops.html +0 -225
  142. package/docs/interfaces/dispatchpropsofexpandpanel.html +0 -296
  143. package/docs/interfaces/emptytableprops.html +0 -154
  144. package/docs/interfaces/expandpanelprops.html +0 -594
  145. package/docs/interfaces/inputref.html +0 -168
  146. package/docs/interfaces/jsonformstheme.html +0 -352
  147. package/docs/interfaces/materialcategorizationlayoutrendererprops.html +0 -460
  148. package/docs/interfaces/materialcategorizationstepperlayoutrendererprops.html +0 -394
  149. package/docs/interfaces/materiallabelablelayoutrendererprops.html +0 -328
  150. package/docs/interfaces/materiallayoutrendererprops.html +0 -317
  151. package/docs/interfaces/materialtabletoolbarprops.html +0 -302
  152. package/docs/interfaces/muitextinputprops.html +0 -168
  153. package/docs/interfaces/nonemptycellcomponentprops.html +0 -266
  154. package/docs/interfaces/nonemptycellprops.html +0 -277
  155. package/docs/interfaces/nonemptyrowprops.html +0 -366
  156. package/docs/interfaces/ownoneofprops.html +0 -308
  157. package/docs/interfaces/ownpropsofexpandpanel.html +0 -397
  158. package/docs/interfaces/ownpropsofnonemptycell.html +0 -229
  159. package/docs/interfaces/statepropsofexpandpanel.html +0 -445
  160. package/docs/interfaces/tableheadercellprops.html +0 -154
  161. package/docs/interfaces/tablerowsprop.html +0 -330
  162. package/docs/interfaces/validationprops.html +0 -168
  163. package/docs/interfaces/withdeletedialogsupport.html +0 -170
  164. package/docs/interfaces/withinput.html +0 -154
  165. package/docs/interfaces/withoptionlabel.html +0 -230
  166. package/example/index.html +0 -16
  167. package/rollup.config.js +0 -51
  168. package/stats.html +0 -3279
  169. package/test/renderers/MaterialAllOfRenderer.test.tsx +0 -114
  170. package/test/renderers/MaterialAnyOfRenderer.test.tsx +0 -310
  171. package/test/renderers/MaterialAnyOfStringOrEnumControl.test.tsx +0 -126
  172. package/test/renderers/MaterialArrayControl.test.tsx +0 -633
  173. package/test/renderers/MaterialArrayLayout.test.tsx +0 -528
  174. package/test/renderers/MaterialBooleanCell.test.tsx +0 -374
  175. package/test/renderers/MaterialBooleanToggleCell.test.tsx +0 -466
  176. package/test/renderers/MaterialBooleanToggleControl.test.tsx +0 -469
  177. package/test/renderers/MaterialCategorizationLayout.test.tsx +0 -458
  178. package/test/renderers/MaterialCategorizationStepperLayout.test.tsx +0 -647
  179. package/test/renderers/MaterialDateCell.test.tsx +0 -303
  180. package/test/renderers/MaterialDateControl.test.tsx +0 -411
  181. package/test/renderers/MaterialDateTimeControl.test.tsx +0 -417
  182. package/test/renderers/MaterialEnumArrayRenderer.test.tsx +0 -207
  183. package/test/renderers/MaterialEnumCell.test.tsx +0 -88
  184. package/test/renderers/MaterialEnumControl.test.tsx +0 -75
  185. package/test/renderers/MaterialGroupLayout.test.tsx +0 -90
  186. package/test/renderers/MaterialInputControl.test.tsx +0 -370
  187. package/test/renderers/MaterialIntegerCell.test.tsx +0 -333
  188. package/test/renderers/MaterialLabelRenderer.test.tsx +0 -114
  189. package/test/renderers/MaterialLayouts.test.tsx +0 -542
  190. package/test/renderers/MaterialListWithDetailRenderer.test.tsx +0 -279
  191. package/test/renderers/MaterialNativeControl.test.tsx +0 -81
  192. package/test/renderers/MaterialNumberCell.test.tsx +0 -382
  193. package/test/renderers/MaterialObjectControl.test.tsx +0 -186
  194. package/test/renderers/MaterialOneOfEnumCell.test.tsx +0 -94
  195. package/test/renderers/MaterialOneOfRadioGroupControl.test.tsx +0 -108
  196. package/test/renderers/MaterialOneOfRenderer.test.tsx +0 -603
  197. package/test/renderers/MaterialRadioGroupControl.test.tsx +0 -125
  198. package/test/renderers/MaterialSliderControl.test.tsx +0 -438
  199. package/test/renderers/MaterialTextCell.test.tsx +0 -541
  200. package/test/renderers/MaterialTextControl.test.tsx +0 -115
  201. package/test/renderers/MaterialTimeCell.test.tsx +0 -331
  202. package/test/renderers/MaterialTimeControl.test.tsx +0 -411
  203. package/tsconfig.json +0 -13
  204. package/tsconfig.test.json +0 -7
  205. package/webpack/webpack.dev.js +0 -11
@@ -22,7 +22,7 @@
22
22
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  THE SOFTWARE.
24
24
  */
25
- import React, {useState, useMemo} from 'react';
25
+ import React, { useState, useMemo } from 'react';
26
26
  import { AppBar, Hidden, Tab, Tabs } from '@mui/material';
27
27
  import {
28
28
  and,
@@ -35,14 +35,18 @@ import {
35
35
  StatePropsOfLayout,
36
36
  Tester,
37
37
  UISchemaElement,
38
- uiTypeIs
38
+ uiTypeIs,
39
39
  } from '@jsonforms/core';
40
- import { TranslateProps, withJsonFormsLayoutProps, withTranslateProps } from '@jsonforms/react';
40
+ import {
41
+ TranslateProps,
42
+ withJsonFormsLayoutProps,
43
+ withTranslateProps,
44
+ } from '@jsonforms/react';
41
45
  import {
42
46
  AjvProps,
43
47
  MaterialLayoutRenderer,
44
48
  MaterialLayoutRendererProps,
45
- withAjvProps
49
+ withAjvProps,
46
50
  } from '../util/layout';
47
51
 
48
52
  export const isSingleLevelCategorization: Tester = and(
@@ -69,14 +73,18 @@ export interface CategorizationState {
69
73
  }
70
74
 
71
75
  export interface MaterialCategorizationLayoutRendererProps
72
- extends StatePropsOfLayout, AjvProps, TranslateProps {
76
+ extends StatePropsOfLayout,
77
+ AjvProps,
78
+ TranslateProps {
73
79
  selected?: number;
74
80
  ownState?: boolean;
75
81
  data?: any;
76
82
  onChange?(selected: number, prevSelected: number): void;
77
83
  }
78
84
 
79
- export const MaterialCategorizationLayoutRenderer = (props: MaterialCategorizationLayoutRendererProps) => {
85
+ export const MaterialCategorizationLayoutRenderer = (
86
+ props: MaterialCategorizationLayoutRendererProps
87
+ ) => {
80
88
  const {
81
89
  data,
82
90
  path,
@@ -89,50 +97,73 @@ export const MaterialCategorizationLayoutRenderer = (props: MaterialCategorizati
89
97
  selected,
90
98
  onChange,
91
99
  ajv,
92
- t
100
+ t,
93
101
  } = props;
94
102
  const categorization = uischema as Categorization;
95
- const [activeCategory, setActiveCategory]= useState<number|undefined>(selected??0);
96
- const categories = useMemo(() => categorization.elements.filter((category: Category) =>
97
- isVisible(category, data, undefined, ajv)
98
- ),[categorization, data, ajv]);
103
+ const [previousCategorization, setPreviousCategorization] =
104
+ useState<Categorization>(uischema as Categorization);
105
+ const [activeCategory, setActiveCategory] = useState<number>(selected ?? 0);
106
+ const categories = useMemo(
107
+ () =>
108
+ categorization.elements.filter((category: Category) =>
109
+ isVisible(category, data, undefined, ajv)
110
+ ),
111
+ [categorization, data, ajv]
112
+ );
113
+
114
+ if (categorization !== previousCategorization) {
115
+ setActiveCategory(0);
116
+ setPreviousCategorization(categorization);
117
+ }
118
+
119
+ const safeCategory =
120
+ activeCategory >= categorization.elements.length ? 0 : activeCategory;
121
+
99
122
  const childProps: MaterialLayoutRendererProps = {
100
- elements: categories[activeCategory].elements,
123
+ elements: categories[safeCategory] ? categories[safeCategory].elements : [],
101
124
  schema,
102
125
  path,
103
126
  direction: 'column',
104
127
  enabled,
105
128
  visible,
106
129
  renderers,
107
- cells
130
+ cells,
108
131
  };
109
132
  const onTabChange = (_event: any, value: any) => {
110
133
  if (onChange) {
111
- onChange(value, activeCategory);
134
+ onChange(value, safeCategory);
112
135
  }
113
136
  setActiveCategory(value);
114
137
  };
115
138
 
116
139
  const tabLabels = useMemo(() => {
117
- return categories.map((e: Category) =>
118
- deriveLabelForUISchemaElement(e, t)
119
- )
120
- }, [categories, t])
140
+ return categories.map((e: Category) => deriveLabelForUISchemaElement(e, t));
141
+ }, [categories, t]);
121
142
 
122
143
  return (
123
144
  <Hidden xsUp={!visible}>
124
145
  <AppBar position='static'>
125
- <Tabs value={activeCategory} onChange={onTabChange} textColor='inherit' indicatorColor='secondary' variant='scrollable'>
146
+ <Tabs
147
+ value={safeCategory}
148
+ onChange={onTabChange}
149
+ textColor='inherit'
150
+ indicatorColor='secondary'
151
+ variant='scrollable'
152
+ >
126
153
  {categories.map((_, idx: number) => (
127
154
  <Tab key={idx} label={tabLabels[idx]} />
128
155
  ))}
129
156
  </Tabs>
130
157
  </AppBar>
131
158
  <div style={{ marginTop: '0.5em' }}>
132
- <MaterialLayoutRenderer {...childProps} />
159
+ <MaterialLayoutRenderer {...childProps} key={safeCategory} />
133
160
  </div>
134
161
  </Hidden>
135
162
  );
136
163
  };
137
164
 
138
- export default withAjvProps(withTranslateProps(withJsonFormsLayoutProps(MaterialCategorizationLayoutRenderer)));
165
+ export default withAjvProps(
166
+ withTranslateProps(
167
+ withJsonFormsLayoutProps(MaterialCategorizationLayoutRenderer)
168
+ )
169
+ );
@@ -22,7 +22,7 @@
22
22
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  THE SOFTWARE.
24
24
  */
25
- import React, {useState, useMemo} from 'react';
25
+ import React, { useState, useMemo } from 'react';
26
26
  import merge from 'lodash/merge';
27
27
  import { Button, Hidden, Step, StepButton, Stepper } from '@mui/material';
28
28
  import {
@@ -36,14 +36,18 @@ import {
36
36
  RankedTester,
37
37
  rankWith,
38
38
  StatePropsOfLayout,
39
- uiTypeIs
39
+ uiTypeIs,
40
40
  } from '@jsonforms/core';
41
- import { TranslateProps, withJsonFormsLayoutProps, withTranslateProps } from '@jsonforms/react';
41
+ import {
42
+ TranslateProps,
43
+ withJsonFormsLayoutProps,
44
+ withTranslateProps,
45
+ } from '@jsonforms/react';
42
46
  import {
43
47
  AjvProps,
44
48
  MaterialLayoutRenderer,
45
49
  MaterialLayoutRendererProps,
46
- withAjvProps
50
+ withAjvProps,
47
51
  } from '../util/layout';
48
52
 
49
53
  export const materialCategorizationStepperTester: RankedTester = rankWith(
@@ -60,15 +64,19 @@ export interface CategorizationStepperState {
60
64
  }
61
65
 
62
66
  export interface MaterialCategorizationStepperLayoutRendererProps
63
- extends StatePropsOfLayout, AjvProps, TranslateProps {
64
- data: any;
67
+ extends StatePropsOfLayout,
68
+ AjvProps,
69
+ TranslateProps {
70
+ data: any;
65
71
  }
66
72
 
67
- export const MaterialCategorizationStepperLayoutRenderer = (props: MaterialCategorizationStepperLayoutRendererProps)=> {
73
+ export const MaterialCategorizationStepperLayoutRenderer = (
74
+ props: MaterialCategorizationStepperLayoutRendererProps
75
+ ) => {
68
76
  const [activeCategory, setActiveCategory] = useState<number>(0);
69
77
 
70
78
  const handleStep = (step: number) => {
71
- setActiveCategory( step);
79
+ setActiveCategory(step);
72
80
  };
73
81
 
74
82
  const {
@@ -81,24 +89,28 @@ export const MaterialCategorizationStepperLayoutRenderer = (props: MaterialCateg
81
89
  cells,
82
90
  config,
83
91
  ajv,
84
- t
92
+ t,
85
93
  } = props;
86
94
  const categorization = uischema as Categorization;
87
95
  const appliedUiSchemaOptions = merge({}, config, uischema.options);
88
96
  const buttonWrapperStyle = {
89
- textAlign: 'right' as 'right',
97
+ textAlign: 'right' as const,
90
98
  width: '100%',
91
- margin: '1em auto'
99
+ margin: '1em auto',
92
100
  };
93
101
  const buttonNextStyle = {
94
- float: 'right' as 'right'
102
+ float: 'right' as const,
95
103
  };
96
104
  const buttonStyle = {
97
- marginRight: '1em'
105
+ marginRight: '1em',
98
106
  };
99
- const categories = useMemo(() => categorization.elements.filter((category: Category) =>
100
- isVisible(category, data, undefined, ajv)
101
- ),[categorization, data, ajv]);
107
+ const categories = useMemo(
108
+ () =>
109
+ categorization.elements.filter((category: Category) =>
110
+ isVisible(category, data, undefined, ajv)
111
+ ),
112
+ [categorization, data, ajv]
113
+ );
102
114
  const childProps: MaterialLayoutRendererProps = {
103
115
  elements: categories[activeCategory].elements,
104
116
  schema,
@@ -106,13 +118,11 @@ export const MaterialCategorizationStepperLayoutRenderer = (props: MaterialCateg
106
118
  direction: 'column',
107
119
  visible,
108
120
  renderers,
109
- cells
121
+ cells,
110
122
  };
111
123
  const tabLabels = useMemo(() => {
112
- return categories.map((e: Category) =>
113
- deriveLabelForUISchemaElement(e, t)
114
- )
115
- }, [categories, t])
124
+ return categories.map((e: Category) => deriveLabelForUISchemaElement(e, t));
125
+ }, [categories, t]);
116
126
  return (
117
127
  <Hidden xsUp={!visible}>
118
128
  <Stepper activeStep={activeCategory} nonLinear>
@@ -127,30 +137,36 @@ export const MaterialCategorizationStepperLayoutRenderer = (props: MaterialCateg
127
137
  <div>
128
138
  <MaterialLayoutRenderer {...childProps} />
129
139
  </div>
130
- { !!appliedUiSchemaOptions.showNavButtons ? (<div style={buttonWrapperStyle}>
131
- <Button
132
- style={buttonNextStyle}
133
- variant="contained"
134
- color="primary"
135
- disabled={activeCategory >= categories.length - 1}
136
- onClick={() => handleStep(activeCategory + 1)}
137
- >
138
- Next
139
- </Button>
140
- <Button
141
- style={buttonStyle}
142
- color="secondary"
143
- variant="contained"
144
- disabled={activeCategory <= 0}
145
- onClick={() => handleStep(activeCategory - 1)}
146
- >
147
- Previous
148
- </Button>
149
- </div>) : (<></>)}
140
+ {appliedUiSchemaOptions.showNavButtons ? (
141
+ <div style={buttonWrapperStyle}>
142
+ <Button
143
+ style={buttonNextStyle}
144
+ variant='contained'
145
+ color='primary'
146
+ disabled={activeCategory >= categories.length - 1}
147
+ onClick={() => handleStep(activeCategory + 1)}
148
+ >
149
+ Next
150
+ </Button>
151
+ <Button
152
+ style={buttonStyle}
153
+ color='secondary'
154
+ variant='contained'
155
+ disabled={activeCategory <= 0}
156
+ onClick={() => handleStep(activeCategory - 1)}
157
+ >
158
+ Previous
159
+ </Button>
160
+ </div>
161
+ ) : (
162
+ <></>
163
+ )}
150
164
  </Hidden>
151
165
  );
152
166
  };
153
167
 
154
- export default withAjvProps(withTranslateProps(
155
- withJsonFormsLayoutProps(MaterialCategorizationStepperLayoutRenderer
156
- )));
168
+ export default withAjvProps(
169
+ withTranslateProps(
170
+ withJsonFormsLayoutProps(MaterialCategorizationStepperLayoutRenderer)
171
+ )
172
+ );
@@ -42,23 +42,42 @@ import { withJsonFormsLayoutProps } from '@jsonforms/react';
42
42
  export const groupTester: RankedTester = rankWith(1, uiTypeIs('Group'));
43
43
  const style: { [x: string]: any } = { marginBottom: '10px' };
44
44
 
45
- const GroupComponent = React.memo(({ visible, enabled, uischema, label, ...props }: MaterialLabelableLayoutRendererProps) => {
45
+ const GroupComponent = React.memo(function GroupComponent({
46
+ visible,
47
+ enabled,
48
+ uischema,
49
+ label,
50
+ ...props
51
+ }: MaterialLabelableLayoutRendererProps) {
46
52
  const groupLayout = uischema as GroupLayout;
47
53
  return (
48
54
  <Hidden xsUp={!visible}>
49
55
  <Card style={style}>
50
- {!isEmpty(label) && (
51
- <CardHeader title={label} />
52
- )}
56
+ {!isEmpty(label) && <CardHeader title={label} />}
53
57
  <CardContent>
54
- <MaterialLayoutRenderer {...props} visible={visible} enabled={enabled} elements={groupLayout.elements} />
58
+ <MaterialLayoutRenderer
59
+ {...props}
60
+ visible={visible}
61
+ enabled={enabled}
62
+ elements={groupLayout.elements}
63
+ />
55
64
  </CardContent>
56
65
  </Card>
57
66
  </Hidden>
58
67
  );
59
68
  });
60
69
 
61
- export const MaterializedGroupLayoutRenderer = ({ uischema, schema, path, visible, enabled, renderers, cells, direction, label }: LayoutProps) => {
70
+ export const MaterializedGroupLayoutRenderer = ({
71
+ uischema,
72
+ schema,
73
+ path,
74
+ visible,
75
+ enabled,
76
+ renderers,
77
+ cells,
78
+ direction,
79
+ label,
80
+ }: LayoutProps) => {
62
81
  const groupLayout = uischema as GroupLayout;
63
82
 
64
83
  return (
@@ -33,7 +33,7 @@ import {
33
33
  import { withJsonFormsLayoutProps } from '@jsonforms/react';
34
34
  import {
35
35
  MaterialLayoutRenderer,
36
- MaterialLayoutRendererProps
36
+ MaterialLayoutRendererProps,
37
37
  } from '../util/layout';
38
38
 
39
39
  /**
@@ -45,7 +45,15 @@ export const materialHorizontalLayoutTester: RankedTester = rankWith(
45
45
  uiTypeIs('HorizontalLayout')
46
46
  );
47
47
 
48
- export const MaterialHorizontalLayoutRenderer = ({ uischema, renderers, cells, schema, path, enabled, visible }: LayoutProps) => {
48
+ export const MaterialHorizontalLayoutRenderer = ({
49
+ uischema,
50
+ renderers,
51
+ cells,
52
+ schema,
53
+ path,
54
+ enabled,
55
+ visible,
56
+ }: LayoutProps) => {
49
57
  const layout = uischema as HorizontalLayout;
50
58
  const childProps: MaterialLayoutRendererProps = {
51
59
  elements: layout.elements,
@@ -53,10 +61,16 @@ export const MaterialHorizontalLayoutRenderer = ({ uischema, renderers, cells, s
53
61
  path,
54
62
  enabled,
55
63
  direction: 'row',
56
- visible
64
+ visible,
57
65
  };
58
66
 
59
- return <MaterialLayoutRenderer {...childProps} renderers={renderers} cells={cells} />;
67
+ return (
68
+ <MaterialLayoutRenderer
69
+ {...childProps}
70
+ renderers={renderers}
71
+ cells={cells}
72
+ />
73
+ );
60
74
  };
61
75
 
62
76
  export default withJsonFormsLayoutProps(MaterialHorizontalLayoutRenderer);
@@ -32,7 +32,7 @@ import {
32
32
  } from '@jsonforms/core';
33
33
  import {
34
34
  MaterialLayoutRenderer,
35
- MaterialLayoutRendererProps
35
+ MaterialLayoutRendererProps,
36
36
  } from '../util/layout';
37
37
  import { withJsonFormsLayoutProps } from '@jsonforms/react';
38
38
 
@@ -45,7 +45,15 @@ export const materialVerticalLayoutTester: RankedTester = rankWith(
45
45
  uiTypeIs('VerticalLayout')
46
46
  );
47
47
 
48
- export const MaterialVerticalLayoutRenderer = ({ uischema, schema, path, enabled, visible, renderers, cells }: LayoutProps) => {
48
+ export const MaterialVerticalLayoutRenderer = ({
49
+ uischema,
50
+ schema,
51
+ path,
52
+ enabled,
53
+ visible,
54
+ renderers,
55
+ cells,
56
+ }: LayoutProps) => {
49
57
  const verticalLayout = uischema as VerticalLayout;
50
58
  const childProps: MaterialLayoutRendererProps = {
51
59
  elements: verticalLayout.elements,
@@ -53,10 +61,16 @@ export const MaterialVerticalLayoutRenderer = ({ uischema, schema, path, enabled
53
61
  path,
54
62
  enabled,
55
63
  direction: 'column',
56
- visible
64
+ visible,
57
65
  };
58
66
 
59
- return <MaterialLayoutRenderer {...childProps} renderers={renderers} cells={cells} />;
67
+ return (
68
+ <MaterialLayoutRenderer
69
+ {...childProps}
70
+ renderers={renderers}
71
+ cells={cells}
72
+ />
73
+ );
60
74
  };
61
75
 
62
76
  export default withJsonFormsLayoutProps(MaterialVerticalLayoutRenderer);
@@ -22,25 +22,34 @@
22
22
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  THE SOFTWARE.
24
24
  */
25
+ import ExpandPanelRenderer, {
26
+ ctxDispatchToExpandPanelProps,
27
+ withContextToExpandPanelProps,
28
+ withJsonFormsExpandPanelProps,
29
+ } from './ExpandPanelRenderer';
25
30
  import MaterialGroupLayout, {
26
- materialGroupTester
31
+ materialGroupTester,
27
32
  } from './MaterialGroupLayout';
28
33
  import MaterialHorizontalLayout, {
29
- materialHorizontalLayoutTester
34
+ materialHorizontalLayoutTester,
30
35
  } from './MaterialHorizontalLayout';
31
36
  import MaterialVerticalLayout, {
32
- materialVerticalLayoutTester
37
+ materialVerticalLayoutTester,
33
38
  } from './MaterialVerticalLayout';
34
39
  import MaterialCategorizationLayout, {
35
- materialCategorizationTester
40
+ materialCategorizationTester,
36
41
  } from './MaterialCategorizationLayout';
37
42
  import MaterialArrayLayout, {
38
- materialArrayLayoutTester
43
+ materialArrayLayoutTester,
39
44
  } from './MaterialArrayLayoutRenderer';
40
45
 
41
46
  export {
42
- materialArrayLayoutTester,
47
+ ExpandPanelRenderer,
48
+ ctxDispatchToExpandPanelProps,
49
+ withContextToExpandPanelProps,
50
+ withJsonFormsExpandPanelProps,
43
51
  MaterialArrayLayout,
52
+ materialArrayLayoutTester,
44
53
  MaterialCategorizationLayout,
45
54
  materialCategorizationTester,
46
55
  MaterialGroupLayout,
@@ -48,5 +57,7 @@ export {
48
57
  MaterialHorizontalLayout,
49
58
  materialHorizontalLayoutTester,
50
59
  MaterialVerticalLayout,
51
- materialVerticalLayoutTester
60
+ materialVerticalLayoutTester,
52
61
  };
62
+
63
+ export * from './ArrayToolbar';
@@ -1,19 +1,19 @@
1
1
  /*
2
2
  The MIT License
3
-
3
+
4
4
  Copyright (c) 2017-2019 EclipseSource Munich
5
5
  https://github.com/eclipsesource/jsonforms
6
-
6
+
7
7
  Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  of this software and associated documentation files (the "Software"), to deal
9
9
  in the Software without restriction, including without limitation the rights
10
10
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
11
  copies of the Software, and to permit persons to whom the Software is
12
12
  furnished to do so, subject to the following conditions:
13
-
13
+
14
14
  The above copyright notice and this permission notice shall be included in
15
15
  all copies or substantial portions of the Software.
16
-
16
+
17
17
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
18
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
19
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -22,29 +22,20 @@
22
22
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  THE SOFTWARE.
24
24
  */
25
-
26
- import {
27
- createAjv,
28
- JsonSchema,
29
- TesterContext,
30
- UISchemaElement
31
- } from '@jsonforms/core';
32
- import { JsonFormsReactProps, useJsonForms } from '@jsonforms/react';
33
- import React from 'react';
34
-
35
- export const initCore = (schema: JsonSchema, uischema: UISchemaElement, data?: any) => {
36
- return { schema, uischema, data, ajv: createAjv() };
37
- };
38
-
39
- export const TestEmitter : React.FC<JsonFormsReactProps> = ({onChange}) => {
40
- const ctx = useJsonForms();
41
- const { data, errors } = ctx.core;
42
- React.useEffect(() => {
43
- onChange({ data, errors });
44
- }, [data, errors]);
45
- return null;
25
+ import { ExpandPanelRenderer as ExpandPanelRendererUnwrapped } from './ExpandPanelRenderer';
26
+ import { MaterializedGroupLayoutRenderer } from './MaterialGroupLayout';
27
+ import { MaterialHorizontalLayoutRenderer } from './MaterialHorizontalLayout';
28
+ import { MaterialVerticalLayoutRenderer } from './MaterialVerticalLayout';
29
+ import { MaterialCategorizationLayoutRenderer } from './MaterialCategorizationLayout';
30
+ import { MaterialArrayLayoutRenderer } from './MaterialArrayLayoutRenderer';
31
+
32
+ export const UnwrappedLayouts = {
33
+ ExpandPanelRenderer: ExpandPanelRendererUnwrapped,
34
+ MaterialArrayLayout: MaterialArrayLayoutRenderer,
35
+ MaterialCategorizationLayout: MaterialCategorizationLayoutRenderer,
36
+ MaterialGroupLayout: MaterializedGroupLayoutRenderer,
37
+ MaterialHorizontalLayout: MaterialHorizontalLayoutRenderer,
38
+ MaterialVerticalLayout: MaterialVerticalLayoutRenderer,
46
39
  };
47
40
 
48
- export const createTesterContext = (rootSchema: JsonSchema, config?: any): TesterContext => {
49
- return { rootSchema, config };
50
- };
41
+ export * from './ArrayToolbar';