@jsonforms/core 3.0.0-alpha.3 → 3.0.0-beta.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 (193) hide show
  1. package/docs/globals.html +37 -37
  2. package/docs/interfaces/arraycontrolprops.html +21 -21
  3. package/docs/interfaces/arraylayoutprops.html +21 -21
  4. package/docs/interfaces/cellprops.html +12 -12
  5. package/docs/interfaces/combinatorrendererprops.html +13 -13
  6. package/docs/interfaces/controlprops.html +16 -16
  7. package/docs/interfaces/controlstate.html +2 -2
  8. package/docs/interfaces/controlwithdetailprops.html +17 -17
  9. package/docs/interfaces/dispatchcellprops.html +10 -10
  10. package/docs/interfaces/dispatchcellstateprops.html +10 -10
  11. package/docs/interfaces/dispatchpropsofarraycontrol.html +4 -4
  12. package/docs/interfaces/dispatchpropsofcontrol.html +1 -1
  13. package/docs/interfaces/dispatchpropsofmultienumcontrol.html +2 -2
  14. package/docs/interfaces/enumcellprops.html +13 -13
  15. package/docs/interfaces/enumoption.html +2 -2
  16. package/docs/interfaces/jsonformsprops.html +9 -9
  17. package/docs/interfaces/layoutprops.html +10 -10
  18. package/docs/interfaces/ownpropsofcell.html +9 -9
  19. package/docs/interfaces/ownpropsofcontrol.html +9 -9
  20. package/docs/interfaces/ownpropsofenum.html +1 -1
  21. package/docs/interfaces/ownpropsofenumcell.html +10 -10
  22. package/docs/interfaces/ownpropsofjsonformsrenderer.html +8 -8
  23. package/docs/interfaces/ownpropsoflayout.html +9 -9
  24. package/docs/interfaces/ownpropsofmasterlistitem.html +6 -6
  25. package/docs/interfaces/ownpropsofrenderer.html +8 -8
  26. package/docs/interfaces/rendererprops.html +9 -9
  27. package/docs/interfaces/statepropsofarraycontrol.html +17 -17
  28. package/docs/interfaces/statepropsofarraylayout.html +17 -17
  29. package/docs/interfaces/statepropsofcell.html +11 -11
  30. package/docs/interfaces/statepropsofcombinator.html +12 -12
  31. package/docs/interfaces/statepropsofcontrol.html +15 -15
  32. package/docs/interfaces/statepropsofcontrolwithdetail.html +16 -16
  33. package/docs/interfaces/statepropsofenumcell.html +12 -12
  34. package/docs/interfaces/statepropsofjsonformsrenderer.html +9 -9
  35. package/docs/interfaces/statepropsoflayout.html +10 -10
  36. package/docs/interfaces/statepropsofmasteritem.html +7 -7
  37. package/docs/interfaces/statepropsofrenderer.html +9 -9
  38. package/docs/interfaces/statepropsofscopedrenderer.html +12 -12
  39. package/docs/interfaces/withclassname.html +1 -1
  40. package/lib/Helpers.d.ts +5 -5
  41. package/lib/actions/actions.d.ts +181 -181
  42. package/lib/actions/index.d.ts +1 -1
  43. package/lib/configDefault.d.ts +6 -6
  44. package/lib/generators/Generate.d.ts +6 -6
  45. package/lib/generators/index.d.ts +3 -3
  46. package/lib/generators/schema.d.ts +8 -8
  47. package/lib/generators/uischema.d.ts +12 -12
  48. package/lib/i18n/i18nTypes.d.ts +15 -15
  49. package/lib/i18n/i18nUtil.d.ts +18 -18
  50. package/lib/i18n/index.d.ts +2 -2
  51. package/lib/index.d.ts +11 -11
  52. package/lib/jsonforms-core.cjs.js +2445 -0
  53. package/lib/jsonforms-core.cjs.js.map +1 -0
  54. package/lib/jsonforms-core.esm.js +2164 -0
  55. package/lib/jsonforms-core.esm.js.map +1 -0
  56. package/lib/models/draft4.d.ts +198 -198
  57. package/lib/models/index.d.ts +5 -5
  58. package/lib/models/jsonSchema.d.ts +3 -3
  59. package/lib/models/jsonSchema4.d.ts +110 -110
  60. package/lib/models/jsonSchema7.d.ts +119 -119
  61. package/lib/models/uischema.d.ts +201 -201
  62. package/lib/reducers/cells.d.ts +11 -11
  63. package/lib/reducers/config.d.ts +3 -3
  64. package/lib/reducers/core.d.ts +24 -24
  65. package/lib/reducers/default-data.d.ts +10 -10
  66. package/lib/reducers/i18n.d.ts +8 -8
  67. package/lib/reducers/index.d.ts +9 -9
  68. package/lib/reducers/reducers.d.ts +29 -29
  69. package/lib/reducers/renderers.d.ts +10 -10
  70. package/lib/reducers/selectors.d.ts +15 -15
  71. package/lib/reducers/uischemas.d.ts +10 -10
  72. package/lib/store.d.ts +53 -53
  73. package/lib/testers/index.d.ts +1 -1
  74. package/lib/testers/testers.d.ts +203 -203
  75. package/lib/util/Formatted.d.ts +19 -19
  76. package/lib/util/array.d.ts +3 -3
  77. package/lib/util/cell.d.ts +79 -79
  78. package/lib/util/combinators.d.ts +10 -10
  79. package/lib/util/ids.d.ts +3 -3
  80. package/lib/util/index.d.ts +15 -15
  81. package/lib/util/label.d.ts +9 -9
  82. package/lib/util/path.d.ts +25 -25
  83. package/lib/util/renderer.d.ts +398 -397
  84. package/lib/util/resolvers.d.ts +25 -25
  85. package/lib/util/runtime.d.ts +18 -18
  86. package/lib/util/schema.d.ts +1 -1
  87. package/lib/util/type.d.ts +174 -174
  88. package/lib/util/uischema.d.ts +5 -5
  89. package/lib/util/util.d.ts +31 -31
  90. package/lib/util/validator.d.ts +3 -3
  91. package/package.json +16 -13
  92. package/rollup.config.js +44 -0
  93. package/src/reducers/reducers.ts +2 -2
  94. package/src/util/cell.ts +4 -4
  95. package/src/util/renderer.ts +9 -8
  96. package/stats.html +3279 -0
  97. package/lib/Helpers.js +0 -33
  98. package/lib/Helpers.js.map +0 -1
  99. package/lib/actions/actions.js +0 -173
  100. package/lib/actions/actions.js.map +0 -1
  101. package/lib/actions/index.js +0 -29
  102. package/lib/actions/index.js.map +0 -1
  103. package/lib/configDefault.js +0 -48
  104. package/lib/configDefault.js.map +0 -1
  105. package/lib/generators/Generate.js +0 -35
  106. package/lib/generators/Generate.js.map +0 -1
  107. package/lib/generators/index.js +0 -31
  108. package/lib/generators/index.js.map +0 -1
  109. package/lib/generators/schema.js +0 -154
  110. package/lib/generators/schema.js.map +0 -1
  111. package/lib/generators/uischema.js +0 -169
  112. package/lib/generators/uischema.js.map +0 -1
  113. package/lib/i18n/i18nTypes.js +0 -3
  114. package/lib/i18n/i18nTypes.js.map +0 -1
  115. package/lib/i18n/i18nUtil.js +0 -71
  116. package/lib/i18n/i18nUtil.js.map +0 -1
  117. package/lib/i18n/index.js +0 -6
  118. package/lib/i18n/index.js.map +0 -1
  119. package/lib/index.js +0 -40
  120. package/lib/index.js.map +0 -1
  121. package/lib/jsonforms-core.js +0 -25
  122. package/lib/jsonforms-core.js.map +0 -1
  123. package/lib/models/draft4.js +0 -174
  124. package/lib/models/draft4.js.map +0 -1
  125. package/lib/models/index.js +0 -33
  126. package/lib/models/index.js.map +0 -1
  127. package/lib/models/jsonSchema.js +0 -27
  128. package/lib/models/jsonSchema.js.map +0 -1
  129. package/lib/models/jsonSchema4.js +0 -30
  130. package/lib/models/jsonSchema4.js.map +0 -1
  131. package/lib/models/jsonSchema7.js +0 -30
  132. package/lib/models/jsonSchema7.js.map +0 -1
  133. package/lib/models/uischema.js +0 -58
  134. package/lib/models/uischema.js.map +0 -1
  135. package/lib/reducers/cells.js +0 -42
  136. package/lib/reducers/cells.js.map +0 -1
  137. package/lib/reducers/config.js +0 -46
  138. package/lib/reducers/config.js.map +0 -1
  139. package/lib/reducers/core.js +0 -294
  140. package/lib/reducers/core.js.map +0 -1
  141. package/lib/reducers/default-data.js +0 -45
  142. package/lib/reducers/default-data.js.map +0 -1
  143. package/lib/reducers/i18n.js +0 -83
  144. package/lib/reducers/i18n.js.map +0 -1
  145. package/lib/reducers/index.js +0 -37
  146. package/lib/reducers/index.js.map +0 -1
  147. package/lib/reducers/reducers.js +0 -98
  148. package/lib/reducers/reducers.js.map +0 -1
  149. package/lib/reducers/renderers.js +0 -43
  150. package/lib/reducers/renderers.js.map +0 -1
  151. package/lib/reducers/selectors.js +0 -56
  152. package/lib/reducers/selectors.js.map +0 -1
  153. package/lib/reducers/uischemas.js +0 -60
  154. package/lib/reducers/uischemas.js.map +0 -1
  155. package/lib/store.js +0 -27
  156. package/lib/store.js.map +0 -1
  157. package/lib/testers/index.js +0 -29
  158. package/lib/testers/index.js.map +0 -1
  159. package/lib/testers/testers.js +0 -421
  160. package/lib/testers/testers.js.map +0 -1
  161. package/lib/util/Formatted.js +0 -27
  162. package/lib/util/Formatted.js.map +0 -1
  163. package/lib/util/array.js +0 -44
  164. package/lib/util/array.js.map +0 -1
  165. package/lib/util/cell.js +0 -148
  166. package/lib/util/cell.js.map +0 -1
  167. package/lib/util/combinators.js +0 -59
  168. package/lib/util/combinators.js.map +0 -1
  169. package/lib/util/ids.js +0 -54
  170. package/lib/util/ids.js.map +0 -1
  171. package/lib/util/index.js +0 -43
  172. package/lib/util/index.js.map +0 -1
  173. package/lib/util/label.js +0 -73
  174. package/lib/util/label.js.map +0 -1
  175. package/lib/util/path.js +0 -90
  176. package/lib/util/path.js.map +0 -1
  177. package/lib/util/renderer.js +0 -530
  178. package/lib/util/renderer.js.map +0 -1
  179. package/lib/util/resolvers.js +0 -169
  180. package/lib/util/resolvers.js.map +0 -1
  181. package/lib/util/runtime.js +0 -167
  182. package/lib/util/runtime.js.map +0 -1
  183. package/lib/util/schema.js +0 -42
  184. package/lib/util/schema.js.map +0 -1
  185. package/lib/util/type.js +0 -27
  186. package/lib/util/type.js.map +0 -1
  187. package/lib/util/uischema.js +0 -56
  188. package/lib/util/uischema.js.map +0 -1
  189. package/lib/util/util.js +0 -112
  190. package/lib/util/util.js.map +0 -1
  191. package/lib/util/validator.js +0 -37
  192. package/lib/util/validator.js.map +0 -1
  193. package/webpack.build.js +0 -13
@@ -1,397 +1,398 @@
1
- import { ControlElement, JsonSchema, UISchemaElement } from '../models';
2
- import { JsonFormsCellRendererRegistryEntry, JsonFormsRendererRegistryEntry, JsonFormsUISchemaRegistryEntry } from '../reducers';
3
- import { RankedTester } from '../testers';
4
- import { CombinatorKeyword } from './combinators';
5
- import { AnyAction, Dispatch } from './type';
6
- import { CoreActions } from '../actions';
7
- import { ErrorObject } from 'ajv';
8
- import { JsonFormsState } from '../store';
9
- import { Translator } from '../i18n';
10
- /**
11
- * Adds an asterisk to the given label string based
12
- * on the required parameter.
13
- *
14
- * @param {string} label the label string
15
- * @param {boolean} required whether the label belongs to a control which is required
16
- * @param {boolean} hideRequiredAsterisk applied UI Schema option
17
- * @returns {string} the label string
18
- */
19
- export declare const computeLabel: (label: string, required: boolean, hideRequiredAsterisk: boolean) => string;
20
- /**
21
- * Indicates whether to mark a field as required.
22
- *
23
- * @param {boolean} required whether the label belongs to a control which is required
24
- * @param {boolean} hideRequiredAsterisk applied UI Schema option
25
- * @returns {boolean} should the field be marked as required
26
- */
27
- export declare const showAsRequired: (required: boolean, hideRequiredAsterisk: boolean) => boolean;
28
- /**
29
- * Create a default value based on the given scheam.
30
- * @param schema the schema for which to create a default value.
31
- * @returns {any}
32
- */
33
- export declare const createDefaultValue: (schema: JsonSchema) => {};
34
- /**
35
- * Whether an element's description should be hidden.
36
- *
37
- * @param visible whether an element is visible
38
- * @param description the element's description
39
- * @param isFocused whether the element is focused
40
- *
41
- * @returns {boolean} true, if the description is to be hidden, false otherwise
42
- */
43
- export declare const isDescriptionHidden: (visible: boolean, description: string, isFocused: boolean, showUnfocusedDescription: boolean) => boolean;
44
- export interface WithClassname {
45
- className?: string;
46
- }
47
- export interface EnumOption {
48
- label: string;
49
- value: any;
50
- }
51
- export declare const enumToEnumOptionMapper: (e: any, t?: Translator, i18nKey?: string) => EnumOption;
52
- export declare const oneOfToEnumOptionMapper: (e: any, t?: Translator, fallbackI18nKey?: string) => EnumOption;
53
- export interface OwnPropsOfRenderer {
54
- /**
55
- * The UI schema to be rendered.
56
- */
57
- uischema?: UISchemaElement;
58
- /**
59
- * The JSON schema that describes the data.
60
- */
61
- schema?: JsonSchema;
62
- /**
63
- * Whether the rendered element should be enabled.
64
- */
65
- enabled?: boolean;
66
- /**
67
- * Whether the rendered element should be visible.
68
- */
69
- visible?: boolean;
70
- /**
71
- * Optional instance path. Necessary when the actual data
72
- * path can not be inferred via the UI schema element as
73
- * it is the case with nested controls.
74
- */
75
- path?: string;
76
- renderers?: JsonFormsRendererRegistryEntry[];
77
- cells?: JsonFormsCellRendererRegistryEntry[];
78
- uischemas?: JsonFormsUISchemaRegistryEntry[];
79
- }
80
- export interface OwnPropsOfControl extends OwnPropsOfRenderer {
81
- id?: string;
82
- uischema?: ControlElement;
83
- }
84
- export interface OwnPropsOfEnum {
85
- options?: EnumOption[];
86
- }
87
- export interface OwnPropsOfLayout extends OwnPropsOfRenderer {
88
- direction?: 'row' | 'column';
89
- }
90
- /**
91
- * State-based props of a {@link Renderer}.
92
- */
93
- export interface StatePropsOfRenderer {
94
- /**
95
- * Any configuration options for the element.
96
- */
97
- config?: any;
98
- /**
99
- * The UI schema to be rendered.
100
- */
101
- uischema: UISchemaElement;
102
- /**
103
- * The JSON schema that describes the data.
104
- */
105
- schema: JsonSchema;
106
- /**
107
- * The data to be rendered.
108
- */
109
- data?: any;
110
- /**
111
- * Whether the rendered element should be enabled.
112
- */
113
- enabled: boolean;
114
- /**
115
- * Whether the rendered element should be visible.
116
- */
117
- visible: boolean;
118
- /**
119
- * Instance path the data is written to, in case of a control.
120
- */
121
- path: string;
122
- /**
123
- * All available renderers.
124
- */
125
- renderers?: JsonFormsRendererRegistryEntry[];
126
- /**
127
- * All available cell renderers.
128
- */
129
- cells?: JsonFormsCellRendererRegistryEntry[];
130
- }
131
- /**
132
- * State-based properties for UI schema elements that have a scope.
133
- */
134
- export interface StatePropsOfScopedRenderer extends StatePropsOfRenderer {
135
- uischema: ControlElement;
136
- /**
137
- * Any validation errors that are caused by the data to be rendered.
138
- */
139
- errors: string;
140
- /**
141
- * The data to be rendered.
142
- */
143
- data: any;
144
- /**
145
- * The root schema as returned by the store.
146
- */
147
- rootSchema: JsonSchema;
148
- /**
149
- * A unique ID that should be used for rendering the scoped UI schema element.
150
- */
151
- id: string;
152
- }
153
- /**
154
- * Props of a {@link Renderer}.
155
- */
156
- export interface RendererProps extends StatePropsOfRenderer {
157
- }
158
- /**
159
- * State-based props of a Control
160
- */
161
- export interface StatePropsOfControl extends StatePropsOfScopedRenderer {
162
- cells?: {
163
- tester: RankedTester;
164
- cell: any;
165
- }[];
166
- /**
167
- * The label for the rendered element.
168
- */
169
- label: string;
170
- /**
171
- * Description of input cell
172
- */
173
- description?: string;
174
- /**
175
- * Whether the rendered data is required.
176
- */
177
- required?: boolean;
178
- }
179
- /**
180
- * Dispatch-based props of a Control.
181
- */
182
- export interface DispatchPropsOfControl {
183
- /**
184
- * Update handler that emits a data change
185
- *
186
- * @param {string} path the path to the data to be updated
187
- * @param {any} value the new value that should be written to the given path
188
- */
189
- handleChange(path: string, value: any): void;
190
- }
191
- /**
192
- * Props of a Control.
193
- */
194
- export interface ControlProps extends StatePropsOfControl, DispatchPropsOfControl {
195
- }
196
- /**
197
- * State props of a layout;
198
- */
199
- export interface StatePropsOfLayout extends StatePropsOfRenderer {
200
- /**
201
- * Direction for the layout to flow
202
- */
203
- direction: 'row' | 'column';
204
- }
205
- export interface LayoutProps extends StatePropsOfLayout {
206
- }
207
- /**
208
- * The state of a control.
209
- */
210
- export interface ControlState {
211
- /**
212
- * The current value.
213
- */
214
- value: any;
215
- /**
216
- * Whether the control is focused.
217
- */
218
- isFocused: boolean;
219
- }
220
- /**
221
- * Map state to control props.
222
- * @param state the store's state
223
- * @param ownProps any own props
224
- * @returns {StatePropsOfControl} state props for a control
225
- */
226
- export declare const mapStateToControlProps: (state: JsonFormsState, ownProps: OwnPropsOfControl) => StatePropsOfControl;
227
- /**
228
- *
229
- * Map dispatch to control props.
230
- *
231
- * @param dispatch the store's dispatch method
232
- * @returns {DispatchPropsOfControl} dispatch props for a control
233
- */
234
- export declare const mapDispatchToControlProps: (dispatch: Dispatch<AnyAction>) => DispatchPropsOfControl;
235
- /**
236
- * Default mapStateToCellProps for enum control. Options is used for populating dropdown list
237
- * @param state
238
- * @param ownProps
239
- * @returns {StatePropsOfControl & OwnPropsOfEnum}
240
- */
241
- export declare const mapStateToEnumControlProps: (state: JsonFormsState, ownProps: OwnPropsOfControl & OwnPropsOfEnum) => StatePropsOfControl & OwnPropsOfEnum;
242
- /**
243
- * Default mapStateToCellProps for enum control based on oneOf. Options is used for populating dropdown list
244
- * @param state
245
- * @param ownProps
246
- * @returns {StatePropsOfControl & OwnPropsOfEnum}
247
- */
248
- export declare const mapStateToOneOfEnumControlProps: (state: JsonFormsState, ownProps: OwnPropsOfControl & OwnPropsOfEnum) => StatePropsOfControl & OwnPropsOfEnum;
249
- /**
250
- * Default mapStateToCellProps for multi enum control. Options is used for populating dropdown list
251
- * @param state
252
- * @param ownProps
253
- * @returns {StatePropsOfControl & OwnPropsOfEnum}
254
- */
255
- export declare const mapStateToMultiEnumControlProps: (state: JsonFormsState, ownProps: OwnPropsOfControl & OwnPropsOfEnum) => StatePropsOfControl & OwnPropsOfEnum;
256
- /**
257
- * Map state to control props.
258
- * @param state the store's state
259
- * @param ownProps any own props
260
- * @returns {StatePropsOfControl} state props for a control
261
- */
262
- export declare const mapStateToMasterListItemProps: (state: JsonFormsState, ownProps: OwnPropsOfMasterListItem) => StatePropsOfMasterItem;
263
- /**
264
- * State-based props of a table control.
265
- */
266
- export interface StatePropsOfControlWithDetail extends StatePropsOfControl {
267
- uischemas?: JsonFormsUISchemaRegistryEntry[];
268
- renderers?: JsonFormsRendererRegistryEntry[];
269
- cells?: JsonFormsCellRendererRegistryEntry[];
270
- }
271
- export interface OwnPropsOfMasterListItem {
272
- index: number;
273
- selected: boolean;
274
- path: string;
275
- schema: JsonSchema;
276
- handleSelect(index: number): () => void;
277
- removeItem(path: string, value: number): () => void;
278
- }
279
- export interface StatePropsOfMasterItem extends OwnPropsOfMasterListItem {
280
- childLabel: string;
281
- }
282
- /**
283
- * Map state to control with detail props
284
- *
285
- * @param state the store's state
286
- * @param ownProps any element's own props
287
- * @returns {StatePropsOfArrayControl} state props for a table control
288
- */
289
- export declare const mapStateToControlWithDetailProps: (state: JsonFormsState, ownProps: OwnPropsOfControl) => StatePropsOfControlWithDetail;
290
- export interface ControlWithDetailProps extends StatePropsOfControlWithDetail, DispatchPropsOfControl {
291
- }
292
- /**
293
- * State-based props of a table control.
294
- */
295
- export interface StatePropsOfArrayControl extends StatePropsOfControlWithDetail {
296
- childErrors?: ErrorObject[];
297
- }
298
- /**
299
- * Map state to table props
300
- *
301
- * @param state the store's state
302
- * @param ownProps any element's own props
303
- * @returns {StatePropsOfArrayControl} state props for a table control
304
- */
305
- export declare const mapStateToArrayControlProps: (state: JsonFormsState, ownProps: OwnPropsOfControl) => StatePropsOfArrayControl;
306
- /**
307
- * Dispatch props of a table control
308
- */
309
- export interface DispatchPropsOfArrayControl {
310
- addItem(path: string, value: any): () => void;
311
- removeItems?(path: string, toDelete: number[]): () => void;
312
- moveUp?(path: string, toMove: number): () => void;
313
- moveDown?(path: string, toMove: number): () => void;
314
- }
315
- /**
316
- * Maps state to dispatch properties of an array control.
317
- *
318
- * @param dispatch the store's dispatch method
319
- * @returns {DispatchPropsOfArrayControl} dispatch props of an array control
320
- */
321
- export declare const mapDispatchToArrayControlProps: (dispatch: Dispatch<CoreActions>) => DispatchPropsOfArrayControl;
322
- export interface DispatchPropsOfMultiEnumControl {
323
- addItem: (path: string, value: any) => void;
324
- removeItem?: (path: string, toDelete: any) => void;
325
- }
326
- export declare const mapDispatchToMultiEnumProps: (dispatch: Dispatch<CoreActions>) => DispatchPropsOfMultiEnumControl;
327
- /**
328
- * Props of an array control.
329
- */
330
- export interface ArrayControlProps extends StatePropsOfArrayControl, DispatchPropsOfArrayControl {
331
- }
332
- export declare const layoutDefaultProps: {
333
- visible: boolean;
334
- enabled: boolean;
335
- path: string;
336
- direction: 'row' | 'column';
337
- };
338
- /**
339
- * Map state to layout props.
340
- * @param state JSONForms state tree
341
- * @param ownProps any own props
342
- * @returns {StatePropsOfLayout}
343
- */
344
- export declare const mapStateToLayoutProps: (state: JsonFormsState, ownProps: OwnPropsOfLayout) => LayoutProps;
345
- export declare type RefResolver = (schema: JsonSchema) => Promise<JsonSchema>;
346
- export interface OwnPropsOfJsonFormsRenderer extends OwnPropsOfRenderer {
347
- }
348
- export interface StatePropsOfJsonFormsRenderer extends OwnPropsOfJsonFormsRenderer {
349
- rootSchema: JsonSchema;
350
- }
351
- export interface JsonFormsProps extends StatePropsOfJsonFormsRenderer {
352
- }
353
- export declare const mapStateToJsonFormsRendererProps: (state: JsonFormsState, ownProps: OwnPropsOfJsonFormsRenderer) => StatePropsOfJsonFormsRenderer;
354
- export declare const controlDefaultProps: {
355
- errors: string[];
356
- visible: boolean;
357
- enabled: boolean;
358
- path: string;
359
- direction: 'row' | 'column';
360
- };
361
- export interface StatePropsOfCombinator extends OwnPropsOfControl {
362
- rootSchema: JsonSchema;
363
- path: string;
364
- id: string;
365
- indexOfFittingSchema: number;
366
- uischemas: JsonFormsUISchemaRegistryEntry[];
367
- data: any;
368
- }
369
- export declare const mapStateToCombinatorRendererProps: (state: JsonFormsState, ownProps: OwnPropsOfControl, keyword: CombinatorKeyword) => StatePropsOfCombinator;
370
- export interface CombinatorRendererProps extends StatePropsOfCombinator, DispatchPropsOfControl {
371
- }
372
- /**
373
- * Map state to all of renderer props.
374
- * @param state the store's state
375
- * @param ownProps any own props
376
- * @returns {StatePropsOfCombinator} state props for a combinator
377
- */
378
- export declare const mapStateToAllOfProps: (state: JsonFormsState, ownProps: OwnPropsOfControl) => StatePropsOfCombinator;
379
- export declare const mapStateToAnyOfProps: (state: JsonFormsState, ownProps: OwnPropsOfControl) => StatePropsOfCombinator;
380
- export declare const mapStateToOneOfProps: (state: JsonFormsState, ownProps: OwnPropsOfControl) => StatePropsOfCombinator;
381
- export interface StatePropsOfArrayLayout extends StatePropsOfControlWithDetail {
382
- data: number;
383
- minItems?: number;
384
- }
385
- /**
386
- * Map state to table props
387
- *
388
- * @param state the store's state
389
- * @param ownProps any element's own props
390
- * @returns {StatePropsOfArrayControl} state props for a table control
391
- */
392
- export declare const mapStateToArrayLayoutProps: (state: JsonFormsState, ownProps: OwnPropsOfControl) => StatePropsOfArrayLayout;
393
- /**
394
- * Props of an array control.
395
- */
396
- export interface ArrayLayoutProps extends StatePropsOfArrayLayout, DispatchPropsOfArrayControl {
397
- }
1
+ import { ControlElement, JsonSchema, UISchemaElement } from '../models';
2
+ import type { JsonFormsCellRendererRegistryEntry, JsonFormsRendererRegistryEntry } from '../reducers';
3
+ import { JsonFormsUISchemaRegistryEntry } from '../reducers';
4
+ import { RankedTester } from '../testers';
5
+ import { CombinatorKeyword } from './combinators';
6
+ import { AnyAction, Dispatch } from './type';
7
+ import { CoreActions } from '../actions';
8
+ import { ErrorObject } from 'ajv';
9
+ import { JsonFormsState } from '../store';
10
+ import { Translator } from '../i18n';
11
+ /**
12
+ * Adds an asterisk to the given label string based
13
+ * on the required parameter.
14
+ *
15
+ * @param {string | undefined} label the label string
16
+ * @param {boolean} required whether the label belongs to a control which is required
17
+ * @param {boolean} hideRequiredAsterisk applied UI Schema option
18
+ * @returns {string} the label string
19
+ */
20
+ export declare const computeLabel: (label: string | undefined, required: boolean, hideRequiredAsterisk: boolean) => string;
21
+ /**
22
+ * Indicates whether to mark a field as required.
23
+ *
24
+ * @param {boolean} required whether the label belongs to a control which is required
25
+ * @param {boolean} hideRequiredAsterisk applied UI Schema option
26
+ * @returns {boolean} should the field be marked as required
27
+ */
28
+ export declare const showAsRequired: (required: boolean, hideRequiredAsterisk: boolean) => boolean;
29
+ /**
30
+ * Create a default value based on the given scheam.
31
+ * @param schema the schema for which to create a default value.
32
+ * @returns {any}
33
+ */
34
+ export declare const createDefaultValue: (schema: JsonSchema) => {};
35
+ /**
36
+ * Whether an element's description should be hidden.
37
+ *
38
+ * @param visible whether an element is visible
39
+ * @param description the element's description
40
+ * @param isFocused whether the element is focused
41
+ *
42
+ * @returns {boolean} true, if the description is to be hidden, false otherwise
43
+ */
44
+ export declare const isDescriptionHidden: (visible: boolean, description: string | undefined, isFocused: boolean, showUnfocusedDescription: boolean) => boolean;
45
+ export interface WithClassname {
46
+ className?: string;
47
+ }
48
+ export interface EnumOption {
49
+ label: string;
50
+ value: any;
51
+ }
52
+ export declare const enumToEnumOptionMapper: (e: any, t?: Translator, i18nKey?: string) => EnumOption;
53
+ export declare const oneOfToEnumOptionMapper: (e: any, t?: Translator, fallbackI18nKey?: string) => EnumOption;
54
+ export interface OwnPropsOfRenderer {
55
+ /**
56
+ * The UI schema to be rendered.
57
+ */
58
+ uischema?: UISchemaElement;
59
+ /**
60
+ * The JSON schema that describes the data.
61
+ */
62
+ schema?: JsonSchema;
63
+ /**
64
+ * Whether the rendered element should be enabled.
65
+ */
66
+ enabled?: boolean;
67
+ /**
68
+ * Whether the rendered element should be visible.
69
+ */
70
+ visible?: boolean;
71
+ /**
72
+ * Optional instance path. Necessary when the actual data
73
+ * path can not be inferred via the UI schema element as
74
+ * it is the case with nested controls.
75
+ */
76
+ path?: string;
77
+ renderers?: JsonFormsRendererRegistryEntry[];
78
+ cells?: JsonFormsCellRendererRegistryEntry[];
79
+ uischemas?: JsonFormsUISchemaRegistryEntry[];
80
+ }
81
+ export interface OwnPropsOfControl extends OwnPropsOfRenderer {
82
+ id?: string;
83
+ uischema?: ControlElement;
84
+ }
85
+ export interface OwnPropsOfEnum {
86
+ options?: EnumOption[];
87
+ }
88
+ export interface OwnPropsOfLayout extends OwnPropsOfRenderer {
89
+ direction?: 'row' | 'column';
90
+ }
91
+ /**
92
+ * State-based props of a {@link Renderer}.
93
+ */
94
+ export interface StatePropsOfRenderer {
95
+ /**
96
+ * Any configuration options for the element.
97
+ */
98
+ config?: any;
99
+ /**
100
+ * The UI schema to be rendered.
101
+ */
102
+ uischema: UISchemaElement;
103
+ /**
104
+ * The JSON schema that describes the data.
105
+ */
106
+ schema: JsonSchema;
107
+ /**
108
+ * The data to be rendered.
109
+ */
110
+ data?: any;
111
+ /**
112
+ * Whether the rendered element should be enabled.
113
+ */
114
+ enabled: boolean;
115
+ /**
116
+ * Whether the rendered element should be visible.
117
+ */
118
+ visible: boolean;
119
+ /**
120
+ * Instance path the data is written to, in case of a control.
121
+ */
122
+ path: string;
123
+ /**
124
+ * All available renderers.
125
+ */
126
+ renderers?: JsonFormsRendererRegistryEntry[];
127
+ /**
128
+ * All available cell renderers.
129
+ */
130
+ cells?: JsonFormsCellRendererRegistryEntry[];
131
+ }
132
+ /**
133
+ * State-based properties for UI schema elements that have a scope.
134
+ */
135
+ export interface StatePropsOfScopedRenderer extends StatePropsOfRenderer {
136
+ uischema: ControlElement;
137
+ /**
138
+ * Any validation errors that are caused by the data to be rendered.
139
+ */
140
+ errors: string;
141
+ /**
142
+ * The data to be rendered.
143
+ */
144
+ data: any;
145
+ /**
146
+ * The root schema as returned by the store.
147
+ */
148
+ rootSchema: JsonSchema;
149
+ /**
150
+ * A unique ID that should be used for rendering the scoped UI schema element.
151
+ */
152
+ id: string;
153
+ }
154
+ /**
155
+ * Props of a {@link Renderer}.
156
+ */
157
+ export interface RendererProps extends StatePropsOfRenderer {
158
+ }
159
+ /**
160
+ * State-based props of a Control
161
+ */
162
+ export interface StatePropsOfControl extends StatePropsOfScopedRenderer {
163
+ cells?: {
164
+ tester: RankedTester;
165
+ cell: any;
166
+ }[];
167
+ /**
168
+ * The label for the rendered element.
169
+ */
170
+ label: string;
171
+ /**
172
+ * Description of input cell
173
+ */
174
+ description?: string;
175
+ /**
176
+ * Whether the rendered data is required.
177
+ */
178
+ required?: boolean;
179
+ }
180
+ /**
181
+ * Dispatch-based props of a Control.
182
+ */
183
+ export interface DispatchPropsOfControl {
184
+ /**
185
+ * Update handler that emits a data change
186
+ *
187
+ * @param {string} path the path to the data to be updated
188
+ * @param {any} value the new value that should be written to the given path
189
+ */
190
+ handleChange(path: string, value: any): void;
191
+ }
192
+ /**
193
+ * Props of a Control.
194
+ */
195
+ export interface ControlProps extends StatePropsOfControl, DispatchPropsOfControl {
196
+ }
197
+ /**
198
+ * State props of a layout;
199
+ */
200
+ export interface StatePropsOfLayout extends StatePropsOfRenderer {
201
+ /**
202
+ * Direction for the layout to flow
203
+ */
204
+ direction: 'row' | 'column';
205
+ }
206
+ export interface LayoutProps extends StatePropsOfLayout {
207
+ }
208
+ /**
209
+ * The state of a control.
210
+ */
211
+ export interface ControlState {
212
+ /**
213
+ * The current value.
214
+ */
215
+ value: any;
216
+ /**
217
+ * Whether the control is focused.
218
+ */
219
+ isFocused: boolean;
220
+ }
221
+ /**
222
+ * Map state to control props.
223
+ * @param state the store's state
224
+ * @param ownProps any own props
225
+ * @returns {StatePropsOfControl} state props for a control
226
+ */
227
+ export declare const mapStateToControlProps: (state: JsonFormsState, ownProps: OwnPropsOfControl) => StatePropsOfControl;
228
+ /**
229
+ *
230
+ * Map dispatch to control props.
231
+ *
232
+ * @param dispatch the store's dispatch method
233
+ * @returns {DispatchPropsOfControl} dispatch props for a control
234
+ */
235
+ export declare const mapDispatchToControlProps: (dispatch: Dispatch<AnyAction>) => DispatchPropsOfControl;
236
+ /**
237
+ * Default mapStateToCellProps for enum control. Options is used for populating dropdown list
238
+ * @param state
239
+ * @param ownProps
240
+ * @returns {StatePropsOfControl & OwnPropsOfEnum}
241
+ */
242
+ export declare const mapStateToEnumControlProps: (state: JsonFormsState, ownProps: OwnPropsOfControl & OwnPropsOfEnum) => StatePropsOfControl & OwnPropsOfEnum;
243
+ /**
244
+ * Default mapStateToCellProps for enum control based on oneOf. Options is used for populating dropdown list
245
+ * @param state
246
+ * @param ownProps
247
+ * @returns {StatePropsOfControl & OwnPropsOfEnum}
248
+ */
249
+ export declare const mapStateToOneOfEnumControlProps: (state: JsonFormsState, ownProps: OwnPropsOfControl & OwnPropsOfEnum) => StatePropsOfControl & OwnPropsOfEnum;
250
+ /**
251
+ * Default mapStateToCellProps for multi enum control. Options is used for populating dropdown list
252
+ * @param state
253
+ * @param ownProps
254
+ * @returns {StatePropsOfControl & OwnPropsOfEnum}
255
+ */
256
+ export declare const mapStateToMultiEnumControlProps: (state: JsonFormsState, ownProps: OwnPropsOfControl & OwnPropsOfEnum) => StatePropsOfControl & OwnPropsOfEnum;
257
+ /**
258
+ * Map state to control props.
259
+ * @param state the store's state
260
+ * @param ownProps any own props
261
+ * @returns {StatePropsOfControl} state props for a control
262
+ */
263
+ export declare const mapStateToMasterListItemProps: (state: JsonFormsState, ownProps: OwnPropsOfMasterListItem) => StatePropsOfMasterItem;
264
+ /**
265
+ * State-based props of a table control.
266
+ */
267
+ export interface StatePropsOfControlWithDetail extends StatePropsOfControl {
268
+ uischemas?: JsonFormsUISchemaRegistryEntry[];
269
+ renderers?: JsonFormsRendererRegistryEntry[];
270
+ cells?: JsonFormsCellRendererRegistryEntry[];
271
+ }
272
+ export interface OwnPropsOfMasterListItem {
273
+ index: number;
274
+ selected: boolean;
275
+ path: string;
276
+ schema: JsonSchema;
277
+ handleSelect(index: number): () => void;
278
+ removeItem(path: string, value: number): () => void;
279
+ }
280
+ export interface StatePropsOfMasterItem extends OwnPropsOfMasterListItem {
281
+ childLabel: string;
282
+ }
283
+ /**
284
+ * Map state to control with detail props
285
+ *
286
+ * @param state the store's state
287
+ * @param ownProps any element's own props
288
+ * @returns {StatePropsOfArrayControl} state props for a table control
289
+ */
290
+ export declare const mapStateToControlWithDetailProps: (state: JsonFormsState, ownProps: OwnPropsOfControl) => StatePropsOfControlWithDetail;
291
+ export interface ControlWithDetailProps extends StatePropsOfControlWithDetail, DispatchPropsOfControl {
292
+ }
293
+ /**
294
+ * State-based props of a table control.
295
+ */
296
+ export interface StatePropsOfArrayControl extends StatePropsOfControlWithDetail {
297
+ childErrors?: ErrorObject[];
298
+ }
299
+ /**
300
+ * Map state to table props
301
+ *
302
+ * @param state the store's state
303
+ * @param ownProps any element's own props
304
+ * @returns {StatePropsOfArrayControl} state props for a table control
305
+ */
306
+ export declare const mapStateToArrayControlProps: (state: JsonFormsState, ownProps: OwnPropsOfControl) => StatePropsOfArrayControl;
307
+ /**
308
+ * Dispatch props of a table control
309
+ */
310
+ export interface DispatchPropsOfArrayControl {
311
+ addItem(path: string, value: any): () => void;
312
+ removeItems?(path: string, toDelete: number[]): () => void;
313
+ moveUp?(path: string, toMove: number): () => void;
314
+ moveDown?(path: string, toMove: number): () => void;
315
+ }
316
+ /**
317
+ * Maps state to dispatch properties of an array control.
318
+ *
319
+ * @param dispatch the store's dispatch method
320
+ * @returns {DispatchPropsOfArrayControl} dispatch props of an array control
321
+ */
322
+ export declare const mapDispatchToArrayControlProps: (dispatch: Dispatch<CoreActions>) => DispatchPropsOfArrayControl;
323
+ export interface DispatchPropsOfMultiEnumControl {
324
+ addItem: (path: string, value: any) => void;
325
+ removeItem?: (path: string, toDelete: any) => void;
326
+ }
327
+ export declare const mapDispatchToMultiEnumProps: (dispatch: Dispatch<CoreActions>) => DispatchPropsOfMultiEnumControl;
328
+ /**
329
+ * Props of an array control.
330
+ */
331
+ export interface ArrayControlProps extends StatePropsOfArrayControl, DispatchPropsOfArrayControl {
332
+ }
333
+ export declare const layoutDefaultProps: {
334
+ visible: boolean;
335
+ enabled: boolean;
336
+ path: string;
337
+ direction: 'row' | 'column';
338
+ };
339
+ /**
340
+ * Map state to layout props.
341
+ * @param state JSONForms state tree
342
+ * @param ownProps any own props
343
+ * @returns {StatePropsOfLayout}
344
+ */
345
+ export declare const mapStateToLayoutProps: (state: JsonFormsState, ownProps: OwnPropsOfLayout) => LayoutProps;
346
+ export declare type RefResolver = (schema: JsonSchema) => Promise<JsonSchema>;
347
+ export interface OwnPropsOfJsonFormsRenderer extends OwnPropsOfRenderer {
348
+ }
349
+ export interface StatePropsOfJsonFormsRenderer extends OwnPropsOfJsonFormsRenderer {
350
+ rootSchema: JsonSchema;
351
+ }
352
+ export interface JsonFormsProps extends StatePropsOfJsonFormsRenderer {
353
+ }
354
+ export declare const mapStateToJsonFormsRendererProps: (state: JsonFormsState, ownProps: OwnPropsOfJsonFormsRenderer) => StatePropsOfJsonFormsRenderer;
355
+ export declare const controlDefaultProps: {
356
+ errors: string[];
357
+ visible: boolean;
358
+ enabled: boolean;
359
+ path: string;
360
+ direction: 'row' | 'column';
361
+ };
362
+ export interface StatePropsOfCombinator extends OwnPropsOfControl {
363
+ rootSchema: JsonSchema;
364
+ path: string;
365
+ id: string;
366
+ indexOfFittingSchema: number;
367
+ uischemas: JsonFormsUISchemaRegistryEntry[];
368
+ data: any;
369
+ }
370
+ export declare const mapStateToCombinatorRendererProps: (state: JsonFormsState, ownProps: OwnPropsOfControl, keyword: CombinatorKeyword) => StatePropsOfCombinator;
371
+ export interface CombinatorRendererProps extends StatePropsOfCombinator, DispatchPropsOfControl {
372
+ }
373
+ /**
374
+ * Map state to all of renderer props.
375
+ * @param state the store's state
376
+ * @param ownProps any own props
377
+ * @returns {StatePropsOfCombinator} state props for a combinator
378
+ */
379
+ export declare const mapStateToAllOfProps: (state: JsonFormsState, ownProps: OwnPropsOfControl) => StatePropsOfCombinator;
380
+ export declare const mapStateToAnyOfProps: (state: JsonFormsState, ownProps: OwnPropsOfControl) => StatePropsOfCombinator;
381
+ export declare const mapStateToOneOfProps: (state: JsonFormsState, ownProps: OwnPropsOfControl) => StatePropsOfCombinator;
382
+ export interface StatePropsOfArrayLayout extends StatePropsOfControlWithDetail {
383
+ data: number;
384
+ minItems?: number;
385
+ }
386
+ /**
387
+ * Map state to table props
388
+ *
389
+ * @param state the store's state
390
+ * @param ownProps any element's own props
391
+ * @returns {StatePropsOfArrayControl} state props for a table control
392
+ */
393
+ export declare const mapStateToArrayLayoutProps: (state: JsonFormsState, ownProps: OwnPropsOfControl) => StatePropsOfArrayLayout;
394
+ /**
395
+ * Props of an array control.
396
+ */
397
+ export interface ArrayLayoutProps extends StatePropsOfArrayLayout, DispatchPropsOfArrayControl {
398
+ }