@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.
- package/README.md +3 -3
- package/lib/Helpers.d.ts +1 -1
- package/lib/actions/actions.d.ts +27 -26
- package/lib/generators/Generate.d.ts +1 -1
- package/lib/generators/schema.d.ts +1 -1
- package/lib/i18n/arrayTranslations.d.ts +24 -0
- package/lib/i18n/i18nTypes.d.ts +3 -2
- package/lib/i18n/i18nUtil.d.ts +5 -2
- package/lib/i18n/index.d.ts +1 -0
- package/lib/jsonforms-core.cjs.js +428 -259
- package/lib/jsonforms-core.cjs.js.map +1 -1
- package/lib/jsonforms-core.esm.js +313 -200
- package/lib/jsonforms-core.esm.js.map +1 -1
- package/lib/models/jsonSchema.d.ts +2 -2
- package/lib/models/uischema.d.ts +1 -1
- package/lib/reducers/cells.d.ts +2 -2
- package/lib/reducers/config.d.ts +1 -1
- package/lib/reducers/core.d.ts +3 -2
- package/lib/reducers/default-data.d.ts +1 -1
- package/lib/reducers/i18n.d.ts +1 -1
- package/lib/reducers/reducers.d.ts +4 -4
- package/lib/reducers/renderers.d.ts +2 -2
- package/lib/reducers/selectors.d.ts +6 -6
- package/lib/reducers/uischemas.d.ts +2 -2
- package/lib/store.d.ts +3 -3
- package/lib/testers/testers.d.ts +1 -1
- package/lib/util/cell.d.ts +3 -4
- package/lib/util/combinators.d.ts +1 -1
- package/lib/util/label.d.ts +1 -1
- package/lib/util/path.d.ts +6 -3
- package/lib/util/renderer.d.ts +11 -7
- package/lib/util/resolvers.d.ts +1 -1
- package/lib/util/runtime.d.ts +2 -2
- package/lib/util/util.d.ts +2 -2
- package/lib/util/validator.d.ts +1 -1
- package/package.json +16 -5
- package/src/Helpers.ts +2 -2
- package/src/actions/actions.ts +59 -61
- package/src/configDefault.ts +1 -1
- package/src/generators/Generate.ts +4 -2
- package/src/generators/schema.ts +30 -26
- package/src/generators/uischema.ts +7 -6
- package/src/i18n/arrayTranslations.ts +54 -0
- package/src/i18n/i18nTypes.ts +12 -7
- package/src/i18n/i18nUtil.ts +66 -16
- package/src/i18n/index.ts +1 -0
- package/src/models/draft4.ts +33 -33
- package/src/models/jsonSchema.ts +2 -2
- package/src/models/uischema.ts +18 -7
- package/src/reducers/cells.ts +10 -9
- package/src/reducers/config.ts +1 -1
- package/src/reducers/core.ts +115 -75
- package/src/reducers/default-data.ts +8 -8
- package/src/reducers/i18n.ts +22 -10
- package/src/reducers/reducers.ts +24 -34
- package/src/reducers/renderers.ts +9 -9
- package/src/reducers/selectors.ts +10 -11
- package/src/reducers/uischemas.ts +27 -26
- package/src/store.ts +4 -4
- package/src/testers/testers.ts +200 -147
- package/src/util/cell.ts +27 -29
- package/src/util/combinators.ts +6 -4
- package/src/util/label.ts +2 -2
- package/src/util/path.ts +15 -8
- package/src/util/renderer.ts +123 -72
- package/src/util/resolvers.ts +16 -14
- package/src/util/runtime.ts +4 -4
- package/src/util/schema.ts +1 -1
- package/src/util/type.ts +5 -3
- package/src/util/uischema.ts +9 -9
- package/src/util/util.ts +54 -54
- package/src/util/validator.ts +2 -2
- package/.nycrc +0 -6
- package/docs/assets/css/main.css +0 -1
- package/docs/assets/images/icons.png +0 -0
- package/docs/assets/images/icons@2x.png +0 -0
- package/docs/assets/images/widgets.png +0 -0
- package/docs/assets/images/widgets@2x.png +0 -0
- package/docs/assets/js/main.js +0 -51
- package/docs/assets/js/search.json +0 -1
- package/docs/classes/gen.html +0 -406
- package/docs/enums/ruleeffect.html +0 -214
- package/docs/globals.html +0 -10568
- package/docs/index.html +0 -1297
- package/docs/interfaces/action.html +0 -166
- package/docs/interfaces/addcellrendereraction.html +0 -181
- package/docs/interfaces/addrendereraction.html +0 -181
- package/docs/interfaces/adduischemaaction.html +0 -181
- package/docs/interfaces/andcondition.html +0 -181
- package/docs/interfaces/anyaction.html +0 -189
- package/docs/interfaces/arraycontrolprops.html +0 -653
- package/docs/interfaces/arraylayoutprops.html +0 -648
- package/docs/interfaces/categorization.html +0 -281
- package/docs/interfaces/category.html +0 -279
- package/docs/interfaces/cellprops.html +0 -452
- package/docs/interfaces/combinatorrendererprops.html +0 -503
- package/docs/interfaces/combinatorsubschemarenderinfo.html +0 -181
- package/docs/interfaces/composablecondition.html +0 -193
- package/docs/interfaces/condition.html +0 -176
- package/docs/interfaces/controlelement.html +0 -280
- package/docs/interfaces/controlprops.html +0 -497
- package/docs/interfaces/controlstate.html +0 -184
- package/docs/interfaces/controlwithdetailprops.html +0 -501
- package/docs/interfaces/dispatchcellprops.html +0 -388
- package/docs/interfaces/dispatchcellstateprops.html +0 -408
- package/docs/interfaces/dispatchpropsofarraycontrol.html +0 -322
- package/docs/interfaces/dispatchpropsofcontrol.html +0 -204
- package/docs/interfaces/dispatchpropsofmultienumcontrol.html +0 -215
- package/docs/interfaces/enumcellprops.html +0 -467
- package/docs/interfaces/enumoption.html +0 -167
- package/docs/interfaces/formatted.html +0 -226
- package/docs/interfaces/grouplayout.html +0 -284
- package/docs/interfaces/horizontallayout.html +0 -234
- package/docs/interfaces/initaction.html +0 -209
- package/docs/interfaces/initactionoptions.html +0 -181
- package/docs/interfaces/internationalizable.html +0 -170
- package/docs/interfaces/jsonformscellrendererregistryentry.html +0 -167
- package/docs/interfaces/jsonformscore.html +0 -251
- package/docs/interfaces/jsonformsdefaultdataregistryentry.html +0 -167
- package/docs/interfaces/jsonformsextendedstate.html +0 -175
- package/docs/interfaces/jsonformsi18nstate.html +0 -181
- package/docs/interfaces/jsonformsprops.html +0 -321
- package/docs/interfaces/jsonformsrendererregistryentry.html +0 -167
- package/docs/interfaces/jsonformsstate.html +0 -170
- package/docs/interfaces/jsonformsstore.html +0 -376
- package/docs/interfaces/jsonformssubstates.html +0 -276
- package/docs/interfaces/jsonformsuischemaregistryentry.html +0 -167
- package/docs/interfaces/jsonschema4.html +0 -758
- package/docs/interfaces/jsonschema7.html +0 -884
- package/docs/interfaces/labelable.html +0 -184
- package/docs/interfaces/labeldescription.html +0 -184
- package/docs/interfaces/labeled.html +0 -182
- package/docs/interfaces/labelelement.html +0 -251
- package/docs/interfaces/labelprops.html +0 -339
- package/docs/interfaces/layout.html +0 -253
- package/docs/interfaces/layoutprops.html +0 -359
- package/docs/interfaces/leafcondition.html +0 -209
- package/docs/interfaces/orcondition.html +0 -181
- package/docs/interfaces/ownpropsofcell.html +0 -321
- package/docs/interfaces/ownpropsofcontrol.html +0 -305
- package/docs/interfaces/ownpropsofenum.html +0 -161
- package/docs/interfaces/ownpropsofenumcell.html +0 -335
- package/docs/interfaces/ownpropsofjsonformsrenderer.html +0 -296
- package/docs/interfaces/ownpropsoflabel.html +0 -286
- package/docs/interfaces/ownpropsoflayout.html +0 -305
- package/docs/interfaces/ownpropsofmasterlistitem.html +0 -289
- package/docs/interfaces/ownpropsofrenderer.html +0 -292
- package/docs/interfaces/referenceschemamap.html +0 -138
- package/docs/interfaces/registerdefaultdataaction.html +0 -181
- package/docs/interfaces/removecellrendereraction.html +0 -181
- package/docs/interfaces/removerendereraction.html +0 -181
- package/docs/interfaces/removeuischemaaction.html +0 -167
- package/docs/interfaces/rendererprops.html +0 -331
- package/docs/interfaces/rule.html +0 -185
- package/docs/interfaces/schemabasedcondition.html +0 -202
- package/docs/interfaces/scopable.html +0 -171
- package/docs/interfaces/scoped.html +0 -183
- package/docs/interfaces/setajvaction.html +0 -167
- package/docs/interfaces/setconfigaction.html +0 -167
- package/docs/interfaces/setlocaleaction.html +0 -167
- package/docs/interfaces/setschemaaction.html +0 -167
- package/docs/interfaces/settranslatoraction.html +0 -181
- package/docs/interfaces/setuischemaaction.html +0 -167
- package/docs/interfaces/setvalidationmodeaction.html +0 -167
- package/docs/interfaces/statepropsofarraycontrol.html +0 -474
- package/docs/interfaces/statepropsofarraylayout.html +0 -461
- package/docs/interfaces/statepropsofcell.html +0 -408
- package/docs/interfaces/statepropsofcombinator.html +0 -449
- package/docs/interfaces/statepropsofcontrol.html +0 -451
- package/docs/interfaces/statepropsofcontrolwithdetail.html +0 -463
- package/docs/interfaces/statepropsofenumcell.html +0 -422
- package/docs/interfaces/statepropsofjsonformsrenderer.html +0 -324
- package/docs/interfaces/statepropsoflabel.html +0 -343
- package/docs/interfaces/statepropsoflayout.html +0 -369
- package/docs/interfaces/statepropsofmasteritem.html +0 -309
- package/docs/interfaces/statepropsofrenderer.html +0 -331
- package/docs/interfaces/statepropsofscopedrenderer.html +0 -391
- package/docs/interfaces/store.html +0 -386
- package/docs/interfaces/testercontext.html +0 -184
- package/docs/interfaces/uischemaelement.html +0 -225
- package/docs/interfaces/unregisterdefaultdataaction.html +0 -167
- package/docs/interfaces/updateaction.html +0 -202
- package/docs/interfaces/updatecoreaction.html +0 -209
- package/docs/interfaces/updateerrorsaction.html +0 -167
- package/docs/interfaces/updatei18naction.html +0 -195
- package/docs/interfaces/verticallayout.html +0 -234
- package/docs/interfaces/withclassname.html +0 -153
- package/rollup.config.js +0 -44
- package/stats.html +0 -3279
- package/test/actions/actions.test.ts +0 -93
- package/test/generators/schema.test.ts +0 -224
- package/test/generators/uischema.test.ts +0 -576
- package/test/i18n/i18nUtil.test.ts +0 -88
- package/test/reducers/core.test.ts +0 -1682
- package/test/reducers/uischemas.test.ts +0 -173
- package/test/testers.test.ts +0 -948
- package/test/util/array.test.ts +0 -28
- package/test/util/cell.test.ts +0 -354
- package/test/util/derivetype.test.ts +0 -101
- package/test/util/label.test.ts +0 -364
- package/test/util/path.test.ts +0 -259
- package/test/util/renderer.test.ts +0 -1830
- package/test/util/resolvers.test.ts +0 -157
- package/test/util/runtime.test.ts +0 -779
- 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;
|
package/lib/models/uischema.d.ts
CHANGED
package/lib/reducers/cells.d.ts
CHANGED
|
@@ -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 {
|
package/lib/reducers/config.d.ts
CHANGED
package/lib/reducers/core.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import 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 {
|
package/lib/reducers/i18n.d.ts
CHANGED
|
@@ -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
|
*/
|
package/lib/testers/testers.d.ts
CHANGED
|
@@ -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.
|
package/lib/util/cell.d.ts
CHANGED
|
@@ -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;
|
package/lib/util/label.d.ts
CHANGED
|
@@ -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.
|
package/lib/util/path.d.ts
CHANGED
|
@@ -14,12 +14,15 @@ export { compose as composePaths };
|
|
|
14
14
|
*/
|
|
15
15
|
export declare const toDataPathSegments: (schemaPath: string) => string[];
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
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') === '
|
|
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
|
|
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;
|
package/lib/util/renderer.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ControlElement, JsonSchema, LabelElement, UISchemaElement } from '../models';
|
|
2
|
-
import { JsonFormsCellRendererRegistryEntry, JsonFormsRendererRegistryEntry } from '../reducers';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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
|
/**
|
package/lib/util/resolvers.d.ts
CHANGED
package/lib/util/runtime.d.ts
CHANGED
|
@@ -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;
|
package/lib/util/util.d.ts
CHANGED
|
@@ -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.
|
package/lib/util/validator.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsonforms/core",
|
|
3
|
-
"version": "3.1.0-alpha.
|
|
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": "
|
|
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.
|
|
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": "
|
|
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
|
};
|
package/src/actions/actions.ts
CHANGED
|
@@ -23,42 +23,38 @@
|
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import AJV
|
|
27
|
-
import {
|
|
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
|
|
35
|
-
export const UPDATE_CORE
|
|
36
|
-
export const SET_AJV
|
|
37
|
-
export const UPDATE_DATA
|
|
38
|
-
export const UPDATE_ERRORS
|
|
39
|
-
|
|
40
|
-
export const
|
|
41
|
-
export const
|
|
42
|
-
export const
|
|
43
|
-
|
|
44
|
-
export const
|
|
45
|
-
export const
|
|
46
|
-
export const
|
|
47
|
-
export const
|
|
48
|
-
export const
|
|
49
|
-
export const
|
|
50
|
-
|
|
51
|
-
export const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
export const
|
|
56
|
-
|
|
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 = (
|
|
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
|
});
|
package/src/configDefault.ts
CHANGED
|
@@ -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
|
};
|