@jsonforms/core 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 +3 -3
  2. package/lib/Helpers.d.ts +1 -1
  3. package/lib/actions/actions.d.ts +27 -26
  4. package/lib/generators/Generate.d.ts +1 -1
  5. package/lib/generators/schema.d.ts +1 -1
  6. package/lib/i18n/arrayTranslations.d.ts +24 -0
  7. package/lib/i18n/i18nTypes.d.ts +3 -2
  8. package/lib/i18n/i18nUtil.d.ts +5 -2
  9. package/lib/i18n/index.d.ts +1 -0
  10. package/lib/jsonforms-core.cjs.js +428 -259
  11. package/lib/jsonforms-core.cjs.js.map +1 -1
  12. package/lib/jsonforms-core.esm.js +313 -200
  13. package/lib/jsonforms-core.esm.js.map +1 -1
  14. package/lib/models/jsonSchema.d.ts +2 -2
  15. package/lib/models/uischema.d.ts +1 -1
  16. package/lib/reducers/cells.d.ts +2 -2
  17. package/lib/reducers/config.d.ts +1 -1
  18. package/lib/reducers/core.d.ts +3 -2
  19. package/lib/reducers/default-data.d.ts +1 -1
  20. package/lib/reducers/i18n.d.ts +1 -1
  21. package/lib/reducers/reducers.d.ts +4 -4
  22. package/lib/reducers/renderers.d.ts +2 -2
  23. package/lib/reducers/selectors.d.ts +6 -6
  24. package/lib/reducers/uischemas.d.ts +2 -2
  25. package/lib/store.d.ts +3 -3
  26. package/lib/testers/testers.d.ts +1 -1
  27. package/lib/util/cell.d.ts +3 -4
  28. package/lib/util/combinators.d.ts +1 -1
  29. package/lib/util/label.d.ts +1 -1
  30. package/lib/util/path.d.ts +6 -3
  31. package/lib/util/renderer.d.ts +11 -7
  32. package/lib/util/resolvers.d.ts +1 -1
  33. package/lib/util/runtime.d.ts +2 -2
  34. package/lib/util/util.d.ts +2 -2
  35. package/lib/util/validator.d.ts +1 -1
  36. package/package.json +16 -5
  37. package/src/Helpers.ts +2 -2
  38. package/src/actions/actions.ts +59 -61
  39. package/src/configDefault.ts +1 -1
  40. package/src/generators/Generate.ts +4 -2
  41. package/src/generators/schema.ts +30 -26
  42. package/src/generators/uischema.ts +7 -6
  43. package/src/i18n/arrayTranslations.ts +54 -0
  44. package/src/i18n/i18nTypes.ts +12 -7
  45. package/src/i18n/i18nUtil.ts +66 -16
  46. package/src/i18n/index.ts +1 -0
  47. package/src/models/draft4.ts +33 -33
  48. package/src/models/jsonSchema.ts +2 -2
  49. package/src/models/uischema.ts +18 -7
  50. package/src/reducers/cells.ts +10 -9
  51. package/src/reducers/config.ts +1 -1
  52. package/src/reducers/core.ts +115 -75
  53. package/src/reducers/default-data.ts +8 -8
  54. package/src/reducers/i18n.ts +22 -10
  55. package/src/reducers/reducers.ts +24 -34
  56. package/src/reducers/renderers.ts +9 -9
  57. package/src/reducers/selectors.ts +10 -11
  58. package/src/reducers/uischemas.ts +27 -26
  59. package/src/store.ts +4 -4
  60. package/src/testers/testers.ts +200 -147
  61. package/src/util/cell.ts +27 -29
  62. package/src/util/combinators.ts +6 -4
  63. package/src/util/label.ts +2 -2
  64. package/src/util/path.ts +15 -8
  65. package/src/util/renderer.ts +123 -72
  66. package/src/util/resolvers.ts +16 -14
  67. package/src/util/runtime.ts +4 -4
  68. package/src/util/schema.ts +1 -1
  69. package/src/util/type.ts +5 -3
  70. package/src/util/uischema.ts +9 -9
  71. package/src/util/util.ts +54 -54
  72. package/src/util/validator.ts +2 -2
  73. package/.nycrc +0 -6
  74. package/docs/assets/css/main.css +0 -1
  75. package/docs/assets/images/icons.png +0 -0
  76. package/docs/assets/images/icons@2x.png +0 -0
  77. package/docs/assets/images/widgets.png +0 -0
  78. package/docs/assets/images/widgets@2x.png +0 -0
  79. package/docs/assets/js/main.js +0 -51
  80. package/docs/assets/js/search.json +0 -1
  81. package/docs/classes/gen.html +0 -406
  82. package/docs/enums/ruleeffect.html +0 -214
  83. package/docs/globals.html +0 -10568
  84. package/docs/index.html +0 -1297
  85. package/docs/interfaces/action.html +0 -166
  86. package/docs/interfaces/addcellrendereraction.html +0 -181
  87. package/docs/interfaces/addrendereraction.html +0 -181
  88. package/docs/interfaces/adduischemaaction.html +0 -181
  89. package/docs/interfaces/andcondition.html +0 -181
  90. package/docs/interfaces/anyaction.html +0 -189
  91. package/docs/interfaces/arraycontrolprops.html +0 -653
  92. package/docs/interfaces/arraylayoutprops.html +0 -648
  93. package/docs/interfaces/categorization.html +0 -281
  94. package/docs/interfaces/category.html +0 -279
  95. package/docs/interfaces/cellprops.html +0 -452
  96. package/docs/interfaces/combinatorrendererprops.html +0 -503
  97. package/docs/interfaces/combinatorsubschemarenderinfo.html +0 -181
  98. package/docs/interfaces/composablecondition.html +0 -193
  99. package/docs/interfaces/condition.html +0 -176
  100. package/docs/interfaces/controlelement.html +0 -280
  101. package/docs/interfaces/controlprops.html +0 -497
  102. package/docs/interfaces/controlstate.html +0 -184
  103. package/docs/interfaces/controlwithdetailprops.html +0 -501
  104. package/docs/interfaces/dispatchcellprops.html +0 -388
  105. package/docs/interfaces/dispatchcellstateprops.html +0 -408
  106. package/docs/interfaces/dispatchpropsofarraycontrol.html +0 -322
  107. package/docs/interfaces/dispatchpropsofcontrol.html +0 -204
  108. package/docs/interfaces/dispatchpropsofmultienumcontrol.html +0 -215
  109. package/docs/interfaces/enumcellprops.html +0 -467
  110. package/docs/interfaces/enumoption.html +0 -167
  111. package/docs/interfaces/formatted.html +0 -226
  112. package/docs/interfaces/grouplayout.html +0 -284
  113. package/docs/interfaces/horizontallayout.html +0 -234
  114. package/docs/interfaces/initaction.html +0 -209
  115. package/docs/interfaces/initactionoptions.html +0 -181
  116. package/docs/interfaces/internationalizable.html +0 -170
  117. package/docs/interfaces/jsonformscellrendererregistryentry.html +0 -167
  118. package/docs/interfaces/jsonformscore.html +0 -251
  119. package/docs/interfaces/jsonformsdefaultdataregistryentry.html +0 -167
  120. package/docs/interfaces/jsonformsextendedstate.html +0 -175
  121. package/docs/interfaces/jsonformsi18nstate.html +0 -181
  122. package/docs/interfaces/jsonformsprops.html +0 -321
  123. package/docs/interfaces/jsonformsrendererregistryentry.html +0 -167
  124. package/docs/interfaces/jsonformsstate.html +0 -170
  125. package/docs/interfaces/jsonformsstore.html +0 -376
  126. package/docs/interfaces/jsonformssubstates.html +0 -276
  127. package/docs/interfaces/jsonformsuischemaregistryentry.html +0 -167
  128. package/docs/interfaces/jsonschema4.html +0 -758
  129. package/docs/interfaces/jsonschema7.html +0 -884
  130. package/docs/interfaces/labelable.html +0 -184
  131. package/docs/interfaces/labeldescription.html +0 -184
  132. package/docs/interfaces/labeled.html +0 -182
  133. package/docs/interfaces/labelelement.html +0 -251
  134. package/docs/interfaces/labelprops.html +0 -339
  135. package/docs/interfaces/layout.html +0 -253
  136. package/docs/interfaces/layoutprops.html +0 -359
  137. package/docs/interfaces/leafcondition.html +0 -209
  138. package/docs/interfaces/orcondition.html +0 -181
  139. package/docs/interfaces/ownpropsofcell.html +0 -321
  140. package/docs/interfaces/ownpropsofcontrol.html +0 -305
  141. package/docs/interfaces/ownpropsofenum.html +0 -161
  142. package/docs/interfaces/ownpropsofenumcell.html +0 -335
  143. package/docs/interfaces/ownpropsofjsonformsrenderer.html +0 -296
  144. package/docs/interfaces/ownpropsoflabel.html +0 -286
  145. package/docs/interfaces/ownpropsoflayout.html +0 -305
  146. package/docs/interfaces/ownpropsofmasterlistitem.html +0 -289
  147. package/docs/interfaces/ownpropsofrenderer.html +0 -292
  148. package/docs/interfaces/referenceschemamap.html +0 -138
  149. package/docs/interfaces/registerdefaultdataaction.html +0 -181
  150. package/docs/interfaces/removecellrendereraction.html +0 -181
  151. package/docs/interfaces/removerendereraction.html +0 -181
  152. package/docs/interfaces/removeuischemaaction.html +0 -167
  153. package/docs/interfaces/rendererprops.html +0 -331
  154. package/docs/interfaces/rule.html +0 -185
  155. package/docs/interfaces/schemabasedcondition.html +0 -202
  156. package/docs/interfaces/scopable.html +0 -171
  157. package/docs/interfaces/scoped.html +0 -183
  158. package/docs/interfaces/setajvaction.html +0 -167
  159. package/docs/interfaces/setconfigaction.html +0 -167
  160. package/docs/interfaces/setlocaleaction.html +0 -167
  161. package/docs/interfaces/setschemaaction.html +0 -167
  162. package/docs/interfaces/settranslatoraction.html +0 -181
  163. package/docs/interfaces/setuischemaaction.html +0 -167
  164. package/docs/interfaces/setvalidationmodeaction.html +0 -167
  165. package/docs/interfaces/statepropsofarraycontrol.html +0 -474
  166. package/docs/interfaces/statepropsofarraylayout.html +0 -461
  167. package/docs/interfaces/statepropsofcell.html +0 -408
  168. package/docs/interfaces/statepropsofcombinator.html +0 -449
  169. package/docs/interfaces/statepropsofcontrol.html +0 -451
  170. package/docs/interfaces/statepropsofcontrolwithdetail.html +0 -463
  171. package/docs/interfaces/statepropsofenumcell.html +0 -422
  172. package/docs/interfaces/statepropsofjsonformsrenderer.html +0 -324
  173. package/docs/interfaces/statepropsoflabel.html +0 -343
  174. package/docs/interfaces/statepropsoflayout.html +0 -369
  175. package/docs/interfaces/statepropsofmasteritem.html +0 -309
  176. package/docs/interfaces/statepropsofrenderer.html +0 -331
  177. package/docs/interfaces/statepropsofscopedrenderer.html +0 -391
  178. package/docs/interfaces/store.html +0 -386
  179. package/docs/interfaces/testercontext.html +0 -184
  180. package/docs/interfaces/uischemaelement.html +0 -225
  181. package/docs/interfaces/unregisterdefaultdataaction.html +0 -167
  182. package/docs/interfaces/updateaction.html +0 -202
  183. package/docs/interfaces/updatecoreaction.html +0 -209
  184. package/docs/interfaces/updateerrorsaction.html +0 -167
  185. package/docs/interfaces/updatei18naction.html +0 -195
  186. package/docs/interfaces/verticallayout.html +0 -234
  187. package/docs/interfaces/withclassname.html +0 -153
  188. package/rollup.config.js +0 -44
  189. package/stats.html +0 -3279
  190. package/test/actions/actions.test.ts +0 -93
  191. package/test/generators/schema.test.ts +0 -224
  192. package/test/generators/uischema.test.ts +0 -576
  193. package/test/i18n/i18nUtil.test.ts +0 -88
  194. package/test/reducers/core.test.ts +0 -1682
  195. package/test/reducers/uischemas.test.ts +0 -173
  196. package/test/testers.test.ts +0 -948
  197. package/test/util/array.test.ts +0 -28
  198. package/test/util/cell.test.ts +0 -354
  199. package/test/util/derivetype.test.ts +0 -101
  200. package/test/util/label.test.ts +0 -364
  201. package/test/util/path.test.ts +0 -259
  202. package/test/util/renderer.test.ts +0 -1830
  203. package/test/util/resolvers.test.ts +0 -157
  204. package/test/util/runtime.test.ts +0 -779
  205. package/tsconfig.json +0 -13
@@ -1,3 +1,3 @@
1
- import { JsonSchema4 } from './jsonSchema4';
2
- import { JsonSchema7 } from './jsonSchema7';
1
+ import type { JsonSchema4 } from './jsonSchema4';
2
+ import type { JsonSchema7 } from './jsonSchema7';
3
3
  export declare type JsonSchema = JsonSchema4 | JsonSchema7;
@@ -1,4 +1,4 @@
1
- import { JsonSchema } from './jsonSchema';
1
+ import type { JsonSchema } from './jsonSchema';
2
2
  /**
3
3
  * Interface for describing an UI schema element that is referencing
4
4
  * a subschema. The value of the scope may be a JSON Pointer.
@@ -1,6 +1,6 @@
1
- import { RankedTester } from '../testers';
1
+ import type { RankedTester } from '../testers';
2
2
  import { AddCellRendererAction, RemoveCellRendererAction } from '../actions';
3
- import { Reducer } from '../util';
3
+ import type { Reducer } from '../util';
4
4
  declare type ValidCellReducerActions = AddCellRendererAction | RemoveCellRendererAction;
5
5
  export declare type JsonFormsCellRendererRegistryState = JsonFormsCellRendererRegistryEntry[];
6
6
  export interface JsonFormsCellRendererRegistryEntry {
@@ -1,3 +1,3 @@
1
1
  import { SetConfigAction } from '../actions';
2
- import { Reducer } from '../util';
2
+ import type { Reducer } from '../util';
3
3
  export declare const configReducer: Reducer<any, SetConfigAction>;
@@ -1,7 +1,8 @@
1
- import Ajv, { ErrorObject, ValidateFunction } from 'ajv';
1
+ import type Ajv from 'ajv';
2
+ import type { ErrorObject, ValidateFunction } from 'ajv';
2
3
  import { CoreActions } from '../actions';
3
4
  import { Reducer } from '../util';
4
- import { JsonSchema, UISchemaElement } from '../models';
5
+ import type { JsonSchema, UISchemaElement } from '../models';
5
6
  export declare const validate: (validator: ValidateFunction | undefined, data: any) => ErrorObject[];
6
7
  export declare type ValidationMode = 'ValidateAndShow' | 'ValidateAndHide' | 'NoValidation';
7
8
  export interface JsonFormsCore {
@@ -1,5 +1,5 @@
1
1
  import { RegisterDefaultDataAction, UnregisterDefaultDataAction } from '../actions';
2
- import { Reducer } from '../util';
2
+ import type { Reducer } from '../util';
3
3
  export interface JsonFormsDefaultDataRegistryEntry {
4
4
  schemaPath: string;
5
5
  data: any;
@@ -1,6 +1,6 @@
1
1
  import { JsonFormsI18nState } from '../i18n';
2
2
  import { I18nActions } from '../actions';
3
- import { Reducer } from '../util';
3
+ import type { Reducer } from '../util';
4
4
  export declare const defaultJsonFormsI18nState: Required<JsonFormsI18nState>;
5
5
  export declare const i18nReducer: Reducer<JsonFormsI18nState, I18nActions>;
6
6
  export declare const fetchLocale: (state?: JsonFormsI18nState) => string;
@@ -1,8 +1,8 @@
1
- import { ControlElement, UISchemaElement } from '../models';
2
- import { JsonFormsState } from '../store';
1
+ import type { ControlElement, UISchemaElement } from '../models';
2
+ import type { JsonFormsState } from '../store';
3
3
  import type { JsonFormsUISchemaRegistryEntry } from './uischemas';
4
- import { JsonSchema } from '../models/jsonSchema';
5
- import { ErrorTranslator, Translator } from '../i18n';
4
+ import type { JsonSchema } from '../models/jsonSchema';
5
+ import type { ErrorTranslator, Translator } from '../i18n';
6
6
  export declare const jsonFormsReducerConfig: {
7
7
  core: import("..").Reducer<import("./core").JsonFormsCore, import("..").CoreActions>;
8
8
  renderers: import("..").Reducer<import("./renderers").JsonFormsRendererRegistryEntry[], import("..").AddRendererAction | import("..").RemoveRendererAction>;
@@ -1,6 +1,6 @@
1
- import { RankedTester } from '../testers';
1
+ import type { RankedTester } from '../testers';
2
2
  import { AddRendererAction, RemoveRendererAction } from '../actions';
3
- import { Reducer } from '../util';
3
+ import type { Reducer } from '../util';
4
4
  export interface JsonFormsRendererRegistryEntry {
5
5
  tester: RankedTester;
6
6
  renderer: any;
@@ -1,10 +1,10 @@
1
- import Ajv from 'ajv';
2
- import { JsonFormsState } from '../store';
3
- import { JsonSchema, UISchemaElement } from '../models';
1
+ import type Ajv from 'ajv';
2
+ import type { JsonFormsState } from '../store';
3
+ import type { JsonSchema, UISchemaElement } from '../models';
4
4
  import { JsonFormsDefaultDataRegistryEntry } from './default-data';
5
- import { JsonFormsRendererRegistryEntry } from './renderers';
6
- import { JsonFormsCellRendererRegistryEntry } from './cells';
7
- import { JsonFormsUISchemaRegistryEntry } from './uischemas';
5
+ import type { JsonFormsRendererRegistryEntry } from './renderers';
6
+ import type { JsonFormsCellRendererRegistryEntry } from './cells';
7
+ import type { JsonFormsUISchemaRegistryEntry } from './uischemas';
8
8
  export declare const getData: (state: JsonFormsState) => any;
9
9
  export declare const getSchema: (state: JsonFormsState) => JsonSchema;
10
10
  export declare const getUiSchema: (state: JsonFormsState) => UISchemaElement;
@@ -1,6 +1,6 @@
1
1
  import { UISchemaActions } from '../actions';
2
- import { JsonSchema, UISchemaElement } from '../models';
3
- import { Reducer } from '../util';
2
+ import type { JsonSchema, UISchemaElement } from '../models';
3
+ import type { Reducer } from '../util';
4
4
  export declare type UISchemaTester = (schema: JsonSchema, schemaPath: string, path: string) => number;
5
5
  export interface JsonFormsUISchemaRegistryEntry {
6
6
  tester: UISchemaTester;
package/lib/store.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Store } from './util';
2
- import { JsonFormsCore, JsonFormsCellRendererRegistryEntry, JsonFormsRendererRegistryEntry, JsonFormsUISchemaRegistryEntry } from './reducers';
3
- import { JsonFormsI18nState } from './i18n';
1
+ import type { Store } from './util';
2
+ import type { JsonFormsCore, JsonFormsCellRendererRegistryEntry, JsonFormsRendererRegistryEntry, JsonFormsUISchemaRegistryEntry } from './reducers';
3
+ import type { JsonFormsI18nState } from './i18n';
4
4
  /**
5
5
  * JSONForms store.
6
6
  */
@@ -1,4 +1,4 @@
1
- import { Categorization, ControlElement, JsonSchema, UISchemaElement } from '../models';
1
+ import type { Categorization, ControlElement, JsonSchema, UISchemaElement } from '../models';
2
2
  /**
3
3
  * Constant that indicates that a tester is not capable of handling
4
4
  * a combination of schema/data.
@@ -1,9 +1,8 @@
1
1
  import type { JsonFormsCellRendererRegistryEntry } from '../reducers';
2
- import { AnyAction, Dispatch } from './type';
2
+ import type { AnyAction, Dispatch } from './type';
3
3
  import { DispatchPropsOfControl, OwnPropsOfControl, OwnPropsOfEnum, StatePropsOfScopedRenderer } from './renderer';
4
- import { JsonFormsState } from '../store';
5
- import { JsonSchema } from '../models';
6
- export type { JsonFormsCellRendererRegistryEntry };
4
+ import type { JsonFormsState } from '../store';
5
+ import type { JsonSchema } from '../models';
7
6
  export interface OwnPropsOfCell extends OwnPropsOfControl {
8
7
  data?: any;
9
8
  }
@@ -1,4 +1,4 @@
1
- import { ControlElement, JsonSchema, UISchemaElement } from '../models';
1
+ import type { ControlElement, JsonSchema, UISchemaElement } from '../models';
2
2
  import { JsonFormsUISchemaRegistryEntry } from '../reducers';
3
3
  export interface CombinatorSubSchemaRenderInfo {
4
4
  schema: JsonSchema;
@@ -1,4 +1,4 @@
1
- import { ControlElement, JsonSchema, LabelDescription } from '../models';
1
+ import type { ControlElement, JsonSchema, LabelDescription } from '../models';
2
2
  export declare const createCleanLabel: (label: string) => string;
3
3
  /**
4
4
  * Return a label object based on the given control and schema element.
@@ -14,12 +14,15 @@ export { compose as composePaths };
14
14
  */
15
15
  export declare const toDataPathSegments: (schemaPath: string) => string[];
16
16
  /**
17
- * Remove all schema-specific keywords (e.g. 'properties') from a given path.
17
+ * Convert a schema path (i.e. JSON pointer) to a data path.
18
+ *
19
+ * Data paths can be used in field change event handlers like handleChange.
20
+ *
18
21
  * @example
19
- * toDataPath('#/properties/foo/properties/bar') === '#/foo/bar')
22
+ * toDataPath('#/properties/foo/properties/bar') === 'foo.bar')
20
23
  *
21
24
  * @param {string} schemaPath the schema path to be converted
22
- * @returns {string} the path without schema-specific keywords
25
+ * @returns {string} the data path
23
26
  */
24
27
  export declare const toDataPath: (schemaPath: string) => string;
25
28
  export declare const composeWithUi: (scopableUi: Scopable, path: string) => string;
@@ -1,13 +1,13 @@
1
1
  import { ControlElement, JsonSchema, LabelElement, UISchemaElement } from '../models';
2
- import { 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';
2
+ import type { JsonFormsCellRendererRegistryEntry, JsonFormsRendererRegistryEntry, JsonFormsUISchemaRegistryEntry } from '../reducers';
3
+ import type { RankedTester } from '../testers';
4
+ import type { CombinatorKeyword } from './combinators';
5
+ import type { AnyAction, Dispatch } from './type';
7
6
  import { CoreActions } from '../actions';
8
- import { ErrorObject } from 'ajv';
9
- import { JsonFormsState } from '../store';
7
+ import type { ErrorObject } from 'ajv';
8
+ import type { JsonFormsState } from '../store';
10
9
  import { Translator } from '../i18n';
10
+ import { ArrayTranslations } from '../i18n/arrayTranslations';
11
11
  /**
12
12
  * Adds an asterisk to the given label string based
13
13
  * on the required parameter.
@@ -179,6 +179,7 @@ export interface StatePropsOfControl extends StatePropsOfScopedRenderer {
179
179
  * Whether the rendered data is required.
180
180
  */
181
181
  required?: boolean;
182
+ i18nKeyPrefix?: string;
182
183
  }
183
184
  /**
184
185
  * Dispatch-based props of a Control.
@@ -280,6 +281,7 @@ export interface OwnPropsOfMasterListItem {
280
281
  schema: JsonSchema;
281
282
  handleSelect(index: number): () => void;
282
283
  removeItem(path: string, value: number): () => void;
284
+ translations: ArrayTranslations;
283
285
  }
284
286
  export interface StatePropsOfMasterItem extends OwnPropsOfMasterListItem {
285
287
  childLabel: string;
@@ -298,6 +300,7 @@ export interface ControlWithDetailProps extends StatePropsOfControlWithDetail, D
298
300
  * State-based props of a table control.
299
301
  */
300
302
  export interface StatePropsOfArrayControl extends StatePropsOfControlWithDetail {
303
+ translations: ArrayTranslations;
301
304
  childErrors?: ErrorObject[];
302
305
  }
303
306
  /**
@@ -386,6 +389,7 @@ export declare const mapStateToAnyOfProps: (state: JsonFormsState, ownProps: Own
386
389
  export declare const mapStateToOneOfProps: (state: JsonFormsState, ownProps: OwnPropsOfControl) => StatePropsOfCombinator;
387
390
  export interface StatePropsOfArrayLayout extends StatePropsOfControlWithDetail {
388
391
  data: number;
392
+ translations: ArrayTranslations;
389
393
  minItems?: number;
390
394
  }
391
395
  /**
@@ -1,4 +1,4 @@
1
- import { JsonSchema } from '../models';
1
+ import type { JsonSchema } from '../models';
2
2
  /**
3
3
  * Map for storing refs and the respective schemas they are pointing to.
4
4
  */
@@ -1,6 +1,6 @@
1
1
  import { JsonSchema, UISchemaElement } from '../models';
2
- import Ajv from 'ajv';
3
- import { JsonFormsState } from '../store';
2
+ import type Ajv from 'ajv';
3
+ import type { JsonFormsState } from '../store';
4
4
  export declare const evalVisibility: (uischema: UISchemaElement, data: any, path: string, ajv: Ajv) => boolean;
5
5
  export declare const evalEnablement: (uischema: UISchemaElement, data: any, path: string, ajv: Ajv) => boolean;
6
6
  export declare const hasShowRule: (uischema: UISchemaElement) => boolean;
@@ -1,5 +1,5 @@
1
- import { JsonSchema, Scoped, UISchemaElement } from '..';
2
- import Ajv from 'ajv';
1
+ import type { JsonSchema, Scoped, UISchemaElement } from '..';
2
+ import type Ajv from 'ajv';
3
3
  /**
4
4
  * Escape the given string such that it can be used as a class name,
5
5
  * i.e. hashes and slashes will be replaced.
@@ -1,3 +1,3 @@
1
1
  import Ajv from 'ajv';
2
- import { Options } from 'ajv';
2
+ import type { Options } from 'ajv';
3
3
  export declare const createAjv: (options?: Options) => Ajv;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsonforms/core",
3
- "version": "3.1.0-alpha.0",
3
+ "version": "3.1.0-alpha.2",
4
4
  "description": "Core module of JSON Forms",
5
5
  "repository": "https://github.com/eclipsesource/jsonforms",
6
6
  "bugs": "https://github.com/eclipsesource/jsonforms/issues",
@@ -13,6 +13,10 @@
13
13
  "src": "src",
14
14
  "test": "test"
15
15
  },
16
+ "files": [
17
+ "lib",
18
+ "src"
19
+ ],
16
20
  "keywords": [
17
21
  "form",
18
22
  "forms",
@@ -35,7 +39,8 @@
35
39
  "scripts": {
36
40
  "build": "rollup -c rollup.config.js",
37
41
  "clean": "rimraf -rf lib coverage dist .nyc_output 2> /dev/null",
38
- "lint": "tslint --project tsconfig.json --exclude src/models/jsonSchema.ts",
42
+ "lint": "eslint .",
43
+ "lint:fix": "eslint --fix .",
39
44
  "report": "nyc report --reporter=html",
40
45
  "test": "cross-env TS_NODE_COMPILER_OPTIONS={\\\"module\\\":\\\"commonjs\\\",\\\"target\\\":\\\"es5\\\"} ava",
41
46
  "test-cov": "rimraf -rf .nyc_output && cross-env TS_NODE_COMPILER_OPTIONS={\\\"module\\\":\\\"commonjs\\\",\\\"target\\\":\\\"es5\\\"} nyc ava",
@@ -69,24 +74,30 @@
69
74
  "devDependencies": {
70
75
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
71
76
  "@types/redux-mock-store": "^1.0.1",
77
+ "@typescript-eslint/eslint-plugin": "^5.54.1",
78
+ "@typescript-eslint/parser": "^5.54.1",
72
79
  "ava": "~2.4.0",
73
80
  "cross-env": "^7.0.2",
74
81
  "document-register-element": "^1.14.3",
82
+ "eslint": "^7.32.0",
83
+ "eslint-config-prettier": "^8.7.0",
84
+ "eslint-plugin-import": "^2.27.5",
85
+ "eslint-plugin-prettier": "^4.2.1",
75
86
  "jsdom": "^15.2.1",
76
87
  "jsdom-global": "^3.0.2",
77
88
  "nyc": "^15.1.0",
89
+ "prettier": "^2.8.4",
78
90
  "redux": "^4.0.4",
79
91
  "redux-mock-store": "1.5.3",
80
92
  "rimraf": "^3.0.2",
81
- "rollup": "^2.7.3",
93
+ "rollup": "^2.78.0",
82
94
  "rollup-plugin-cleanup": "^3.2.1",
83
95
  "rollup-plugin-typescript2": "^0.31.1",
84
96
  "rollup-plugin-visualizer": "^5.4.1",
85
97
  "source-map-support": "0.5.16",
86
98
  "ts-node": "^10.4.0",
87
- "tslint": "^5.20.1",
88
99
  "typedoc": "^0.19.2",
89
100
  "typescript": "4.2.3"
90
101
  },
91
- "gitHead": "91f351daa7b7ae4bb0f0dffd47f00bb6cf682ec1"
102
+ "gitHead": "1e1ccad5f7ebfaf80412c8af3e422faebb12d0d5"
92
103
  }
package/src/Helpers.ts CHANGED
@@ -24,7 +24,7 @@
24
24
  */
25
25
 
26
26
  import { convertToValidClassName, createLabelDescriptionFrom } from './util';
27
- import { ControlElement, JsonSchema, LabelDescription } from './models';
27
+ import type { ControlElement, JsonSchema, LabelDescription } from './models';
28
28
 
29
29
  export const Helpers: {
30
30
  createLabelDescriptionFrom(
@@ -34,5 +34,5 @@ export const Helpers: {
34
34
  convertToValidClassName(s: string): string;
35
35
  } = {
36
36
  createLabelDescriptionFrom,
37
- convertToValidClassName
37
+ convertToValidClassName,
38
38
  };
@@ -23,42 +23,38 @@
23
23
  THE SOFTWARE.
24
24
  */
25
25
 
26
- import AJV, { ErrorObject } from 'ajv';
27
- import { JsonSchema, UISchemaElement } from '../models';
26
+ import type AJV from 'ajv';
27
+ import type { ErrorObject } from 'ajv';
28
+ import type { JsonSchema, UISchemaElement } from '../models';
28
29
  import { generateDefaultUISchema, generateJsonSchema } from '../generators';
29
30
 
30
- import { RankedTester } from '../testers';
31
- import { UISchemaTester, ValidationMode } from '../reducers';
32
- import { ErrorTranslator, Translator } from '../i18n';
33
-
34
- export const INIT: 'jsonforms/INIT' = 'jsonforms/INIT';
35
- export const UPDATE_CORE: 'jsonforms/UPDATE_CORE' = `jsonforms/UPDATE_CORE`;
36
- export const SET_AJV: 'jsonforms/SET_AJV' = 'jsonforms/SET_AJV';
37
- export const UPDATE_DATA: 'jsonforms/UPDATE' = 'jsonforms/UPDATE';
38
- export const UPDATE_ERRORS: 'jsonforms/UPDATE_ERRORS' =
39
- 'jsonforms/UPDATE_ERRORS';
40
- export const VALIDATE: 'jsonforms/VALIDATE' = 'jsonforms/VALIDATE';
41
- export const ADD_RENDERER: 'jsonforms/ADD_RENDERER' = 'jsonforms/ADD_RENDERER';
42
- export const REMOVE_RENDERER: 'jsonforms/REMOVE_RENDERER' =
43
- 'jsonforms/REMOVE_RENDERER';
44
- export const ADD_CELL: 'jsonforms/ADD_CELL' = 'jsonforms/ADD_CELL';
45
- export const REMOVE_CELL: 'jsonforms/REMOVE_CELL' = 'jsonforms/REMOVE_CELL';
46
- export const SET_CONFIG: 'jsonforms/SET_CONFIG' = 'jsonforms/SET_CONFIG';
47
- export const ADD_UI_SCHEMA: 'jsonforms/ADD_UI_SCHEMA' = `jsonforms/ADD_UI_SCHEMA`;
48
- export const REMOVE_UI_SCHEMA: 'jsonforms/REMOVE_UI_SCHEMA' = `jsonforms/REMOVE_UI_SCHEMA`;
49
- export const SET_SCHEMA: 'jsonforms/SET_SCHEMA' = `jsonforms/SET_SCHEMA`;
50
- export const SET_UISCHEMA: 'jsonforms/SET_UISCHEMA' = `jsonforms/SET_UISCHEMA`;
51
- export const SET_VALIDATION_MODE: 'jsonforms/SET_VALIDATION_MODE' =
52
- 'jsonforms/SET_VALIDATION_MODE';
53
-
54
- export const SET_LOCALE: 'jsonforms/SET_LOCALE' = `jsonforms/SET_LOCALE`;
55
- export const SET_TRANSLATOR: 'jsonforms/SET_TRANSLATOR' =
56
- 'jsonforms/SET_TRANSLATOR';
57
- export const UPDATE_I18N: 'jsonforms/UPDATE_I18N' =
58
- 'jsonforms/UPDATE_I18N';
59
-
60
- export const ADD_DEFAULT_DATA: 'jsonforms/ADD_DEFAULT_DATA' = `jsonforms/ADD_DEFAULT_DATA`;
61
- export const REMOVE_DEFAULT_DATA: 'jsonforms/REMOVE_DEFAULT_DATA' = `jsonforms/REMOVE_DEFAULT_DATA`;
31
+ import type { RankedTester } from '../testers';
32
+ import type { UISchemaTester, ValidationMode } from '../reducers';
33
+ import type { ErrorTranslator, Translator } from '../i18n';
34
+
35
+ export const INIT = 'jsonforms/INIT' as const;
36
+ export const UPDATE_CORE = 'jsonforms/UPDATE_CORE' as const;
37
+ export const SET_AJV = 'jsonforms/SET_AJV' as const;
38
+ export const UPDATE_DATA = 'jsonforms/UPDATE' as const;
39
+ export const UPDATE_ERRORS = 'jsonforms/UPDATE_ERRORS' as const;
40
+ export const VALIDATE = 'jsonforms/VALIDATE' as const;
41
+ export const ADD_RENDERER = 'jsonforms/ADD_RENDERER' as const;
42
+ export const REMOVE_RENDERER = 'jsonforms/REMOVE_RENDERER' as const;
43
+ export const ADD_CELL = 'jsonforms/ADD_CELL' as const;
44
+ export const REMOVE_CELL = 'jsonforms/REMOVE_CELL' as const;
45
+ export const SET_CONFIG = 'jsonforms/SET_CONFIG' as const;
46
+ export const ADD_UI_SCHEMA = 'jsonforms/ADD_UI_SCHEMA' as const;
47
+ export const REMOVE_UI_SCHEMA = 'jsonforms/REMOVE_UI_SCHEMA' as const;
48
+ export const SET_SCHEMA = 'jsonforms/SET_SCHEMA' as const;
49
+ export const SET_UISCHEMA = 'jsonforms/SET_UISCHEMA' as const;
50
+ export const SET_VALIDATION_MODE = 'jsonforms/SET_VALIDATION_MODE' as const;
51
+
52
+ export const SET_LOCALE = 'jsonforms/SET_LOCALE' as const;
53
+ export const SET_TRANSLATOR = 'jsonforms/SET_TRANSLATOR' as const;
54
+ export const UPDATE_I18N = 'jsonforms/UPDATE_I18N' as const;
55
+
56
+ export const ADD_DEFAULT_DATA = 'jsonforms/ADD_DEFAULT_DATA' as const;
57
+ export const REMOVE_DEFAULT_DATA = 'jsonforms/REMOVE_DEFAULT_DATA' as const;
62
58
 
63
59
  export type CoreActions =
64
60
  | InitAction
@@ -104,8 +100,8 @@ export interface InitActionOptions {
104
100
  }
105
101
 
106
102
  export interface SetValidationModeAction {
107
- type: 'jsonforms/SET_VALIDATION_MODE'
108
- validationMode: ValidationMode
103
+ type: 'jsonforms/SET_VALIDATION_MODE';
104
+ validationMode: ValidationMode;
109
105
  }
110
106
 
111
107
  export const init = (
@@ -119,7 +115,7 @@ export const init = (
119
115
  schema,
120
116
  uischema:
121
117
  typeof uischema === 'object' ? uischema : generateDefaultUISchema(schema),
122
- options
118
+ options,
123
119
  });
124
120
 
125
121
  export const updateCore = (
@@ -132,7 +128,7 @@ export const updateCore = (
132
128
  data,
133
129
  schema,
134
130
  uischema,
135
- options
131
+ options,
136
132
  });
137
133
 
138
134
  export interface RegisterDefaultDataAction {
@@ -144,7 +140,7 @@ export interface RegisterDefaultDataAction {
144
140
  export const registerDefaultData = (schemaPath: string, data: any) => ({
145
141
  type: ADD_DEFAULT_DATA,
146
142
  schemaPath,
147
- data
143
+ data,
148
144
  });
149
145
 
150
146
  export interface UnregisterDefaultDataAction {
@@ -154,7 +150,7 @@ export interface UnregisterDefaultDataAction {
154
150
 
155
151
  export const unregisterDefaultData = (schemaPath: string) => ({
156
152
  type: REMOVE_DEFAULT_DATA,
157
- schemaPath
153
+ schemaPath,
158
154
  });
159
155
 
160
156
  export interface SetAjvAction {
@@ -164,7 +160,7 @@ export interface SetAjvAction {
164
160
 
165
161
  export const setAjv = (ajv: AJV) => ({
166
162
  type: SET_AJV,
167
- ajv
163
+ ajv,
168
164
  });
169
165
 
170
166
  export const update = (
@@ -173,12 +169,12 @@ export const update = (
173
169
  ): UpdateAction => ({
174
170
  type: UPDATE_DATA,
175
171
  path,
176
- updater
172
+ updater,
177
173
  });
178
174
 
179
175
  export const updateErrors = (errors: ErrorObject[]): UpdateErrorsAction => ({
180
176
  type: UPDATE_ERRORS,
181
- errors
177
+ errors,
182
178
  });
183
179
 
184
180
  export interface AddRendererAction {
@@ -190,7 +186,7 @@ export interface AddRendererAction {
190
186
  export const registerRenderer = (tester: RankedTester, renderer: any) => ({
191
187
  type: ADD_RENDERER,
192
188
  tester,
193
- renderer
189
+ renderer,
194
190
  });
195
191
 
196
192
  export interface AddCellRendererAction {
@@ -202,7 +198,7 @@ export interface AddCellRendererAction {
202
198
  export const registerCell = (tester: RankedTester, cell: any) => ({
203
199
  type: ADD_CELL,
204
200
  tester,
205
- cell
201
+ cell,
206
202
  });
207
203
 
208
204
  export interface RemoveCellRendererAction {
@@ -214,7 +210,7 @@ export interface RemoveCellRendererAction {
214
210
  export const unregisterCell = (tester: RankedTester, cell: any) => ({
215
211
  type: REMOVE_CELL,
216
212
  tester,
217
- cell
213
+ cell,
218
214
  });
219
215
 
220
216
  export interface RemoveRendererAction {
@@ -226,7 +222,7 @@ export interface RemoveRendererAction {
226
222
  export const unregisterRenderer = (tester: RankedTester, renderer: any) => ({
227
223
  type: REMOVE_RENDERER,
228
224
  tester,
229
- renderer
225
+ renderer,
230
226
  });
231
227
 
232
228
  export interface SetConfigAction {
@@ -236,13 +232,15 @@ export interface SetConfigAction {
236
232
 
237
233
  export const setConfig = (config: any): SetConfigAction => ({
238
234
  type: SET_CONFIG,
239
- config
235
+ config,
240
236
  });
241
237
 
242
- export const setValidationMode = (validationMode: ValidationMode): SetValidationModeAction => ({
238
+ export const setValidationMode = (
239
+ validationMode: ValidationMode
240
+ ): SetValidationModeAction => ({
243
241
  type: SET_VALIDATION_MODE,
244
- validationMode
245
- })
242
+ validationMode,
243
+ });
246
244
 
247
245
  export type UISchemaActions = AddUISchemaAction | RemoveUISchemaAction;
248
246
 
@@ -259,7 +257,7 @@ export const registerUISchema = (
259
257
  return {
260
258
  type: ADD_UI_SCHEMA,
261
259
  tester,
262
- uischema
260
+ uischema,
263
261
  };
264
262
  };
265
263
 
@@ -273,14 +271,14 @@ export const unregisterUISchema = (
273
271
  ): RemoveUISchemaAction => {
274
272
  return {
275
273
  type: REMOVE_UI_SCHEMA,
276
- tester
274
+ tester,
277
275
  };
278
276
  };
279
277
 
280
278
  export type I18nActions =
281
279
  | SetLocaleAction
282
280
  | SetTranslatorAction
283
- | UpdateI18nAction
281
+ | UpdateI18nAction;
284
282
 
285
283
  export interface SetLocaleAction {
286
284
  type: 'jsonforms/SET_LOCALE';
@@ -289,7 +287,7 @@ export interface SetLocaleAction {
289
287
 
290
288
  export const setLocale = (locale: string | undefined): SetLocaleAction => ({
291
289
  type: SET_LOCALE,
292
- locale
290
+ locale,
293
291
  });
294
292
 
295
293
  export interface SetSchemaAction {
@@ -299,13 +297,13 @@ export interface SetSchemaAction {
299
297
 
300
298
  export const setSchema = (schema: JsonSchema): SetSchemaAction => ({
301
299
  type: SET_SCHEMA,
302
- schema
300
+ schema,
303
301
  });
304
302
 
305
303
  export interface SetTranslatorAction {
306
304
  type: 'jsonforms/SET_TRANSLATOR';
307
305
  translator?: Translator;
308
- errorTranslator?: ErrorTranslator;
306
+ errorTranslator?: ErrorTranslator;
309
307
  }
310
308
 
311
309
  export const setTranslator = (
@@ -314,14 +312,14 @@ export const setTranslator = (
314
312
  ): SetTranslatorAction => ({
315
313
  type: SET_TRANSLATOR,
316
314
  translator,
317
- errorTranslator
315
+ errorTranslator,
318
316
  });
319
317
 
320
318
  export interface UpdateI18nAction {
321
319
  type: 'jsonforms/UPDATE_I18N';
322
320
  locale: string | undefined;
323
321
  translator: Translator | undefined;
324
- errorTranslator: ErrorTranslator | undefined;
322
+ errorTranslator: ErrorTranslator | undefined;
325
323
  }
326
324
 
327
325
  export const updateI18n = (
@@ -332,7 +330,7 @@ export const updateI18n = (
332
330
  type: UPDATE_I18N,
333
331
  locale,
334
332
  translator,
335
- errorTranslator
333
+ errorTranslator,
336
334
  });
337
335
 
338
336
  export interface SetUISchemaAction {
@@ -342,5 +340,5 @@ export interface SetUISchemaAction {
342
340
 
343
341
  export const setUISchema = (uischema: UISchemaElement): SetUISchemaAction => ({
344
342
  type: SET_UISCHEMA,
345
- uischema
343
+ uischema,
346
344
  });
@@ -44,5 +44,5 @@ export const configDefault = {
44
44
  /*
45
45
  * [text] if asterisks in labels for required fields should be hidden
46
46
  */
47
- hideRequiredAsterisk: false
47
+ hideRequiredAsterisk: false,
48
48
  };
@@ -25,9 +25,11 @@
25
25
 
26
26
  import { generateJsonSchema } from './schema';
27
27
  import { createControlElement, generateDefaultUISchema } from './uischema';
28
- import { ControlElement, JsonSchema, UISchemaElement } from '../';
28
+ import type { ControlElement, JsonSchema, UISchemaElement } from '../';
29
29
 
30
30
  export const Generate: {
31
+ // TODO fix @typescript-eslint/ban-types
32
+ // eslint-disable-next-line @typescript-eslint/ban-types
31
33
  jsonSchema(instance: Object, options?: any): JsonSchema;
32
34
  uiSchema(
33
35
  jsonSchema: JsonSchema,
@@ -39,5 +41,5 @@ export const Generate: {
39
41
  } = {
40
42
  jsonSchema: generateJsonSchema,
41
43
  uiSchema: generateDefaultUISchema,
42
- controlElement: createControlElement
44
+ controlElement: createControlElement,
43
45
  };