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