@jsonforms/core 3.0.0 → 3.1.0-alpha.1
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/lib/Helpers.d.ts +1 -1
- package/lib/actions/actions.d.ts +6 -5
- package/lib/generators/Generate.d.ts +1 -1
- package/lib/generators/schema.d.ts +1 -1
- package/lib/i18n/i18nTypes.d.ts +3 -2
- package/lib/i18n/i18nUtil.d.ts +2 -2
- package/lib/jsonforms-core.cjs.js +3 -3
- package/lib/jsonforms-core.cjs.js.map +1 -1
- package/lib/jsonforms-core.esm.js +2 -2
- 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 -3
- 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 +5 -5
- 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 +7 -3
- package/src/Helpers.ts +1 -1
- package/src/actions/actions.ts +6 -5
- package/src/generators/Generate.ts +1 -1
- package/src/generators/schema.ts +1 -1
- package/src/i18n/i18nTypes.ts +3 -2
- package/src/i18n/i18nUtil.ts +2 -2
- package/src/models/jsonSchema.ts +2 -2
- package/src/models/uischema.ts +1 -1
- package/src/reducers/cells.ts +2 -2
- package/src/reducers/config.ts +1 -1
- package/src/reducers/core.ts +4 -3
- package/src/reducers/default-data.ts +1 -1
- package/src/reducers/i18n.ts +1 -1
- package/src/reducers/reducers.ts +4 -4
- package/src/reducers/renderers.ts +2 -2
- package/src/reducers/selectors.ts +6 -6
- package/src/reducers/uischemas.ts +2 -2
- package/src/store.ts +3 -3
- package/src/testers/testers.ts +2 -2
- package/src/util/cell.ts +3 -3
- package/src/util/combinators.ts +1 -1
- package/src/util/label.ts +1 -1
- package/src/util/path.ts +6 -3
- package/src/util/renderer.ts +5 -5
- package/src/util/resolvers.ts +2 -2
- package/src/util/runtime.ts +2 -2
- package/src/util/util.ts +2 -2
- package/src/util/validator.ts +1 -1
- 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,8 +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';
|
|
4
|
+
import type { JsonFormsState } from '../store';
|
|
5
|
+
import type { JsonSchema } from '../models';
|
|
6
6
|
export type { JsonFormsCellRendererRegistryEntry };
|
|
7
7
|
export interface OwnPropsOfCell extends OwnPropsOfControl {
|
|
8
8
|
data?: any;
|
|
@@ -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,12 +1,12 @@
|
|
|
1
1
|
import { ControlElement, JsonSchema, LabelElement, UISchemaElement } from '../models';
|
|
2
2
|
import { JsonFormsCellRendererRegistryEntry, JsonFormsRendererRegistryEntry } from '../reducers';
|
|
3
3
|
import { JsonFormsUISchemaRegistryEntry } from '../reducers';
|
|
4
|
-
import { RankedTester } from '../testers';
|
|
5
|
-
import { CombinatorKeyword } from './combinators';
|
|
6
|
-
import { AnyAction, Dispatch } from './type';
|
|
4
|
+
import type { RankedTester } from '../testers';
|
|
5
|
+
import type { CombinatorKeyword } from './combinators';
|
|
6
|
+
import type { AnyAction, Dispatch } from './type';
|
|
7
7
|
import { CoreActions } from '../actions';
|
|
8
|
-
import { ErrorObject } from 'ajv';
|
|
9
|
-
import { JsonFormsState } from '../store';
|
|
8
|
+
import type { ErrorObject } from 'ajv';
|
|
9
|
+
import type { JsonFormsState } from '../store';
|
|
10
10
|
import { Translator } from '../i18n';
|
|
11
11
|
/**
|
|
12
12
|
* Adds an asterisk to the given label string based
|
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.0.
|
|
3
|
+
"version": "3.1.0-alpha.1",
|
|
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",
|
|
@@ -78,7 +82,7 @@
|
|
|
78
82
|
"redux": "^4.0.4",
|
|
79
83
|
"redux-mock-store": "1.5.3",
|
|
80
84
|
"rimraf": "^3.0.2",
|
|
81
|
-
"rollup": "^2.
|
|
85
|
+
"rollup": "^2.78.0",
|
|
82
86
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
83
87
|
"rollup-plugin-typescript2": "^0.31.1",
|
|
84
88
|
"rollup-plugin-visualizer": "^5.4.1",
|
|
@@ -88,5 +92,5 @@
|
|
|
88
92
|
"typedoc": "^0.19.2",
|
|
89
93
|
"typescript": "4.2.3"
|
|
90
94
|
},
|
|
91
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "386174994eabc41758450b8d551e1c859498a468"
|
|
92
96
|
}
|
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(
|
package/src/actions/actions.ts
CHANGED
|
@@ -23,13 +23,14 @@
|
|
|
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';
|
|
31
|
+
import type { RankedTester } from '../testers';
|
|
32
|
+
import type { UISchemaTester, ValidationMode } from '../reducers';
|
|
33
|
+
import type { ErrorTranslator, Translator } from '../i18n';
|
|
33
34
|
|
|
34
35
|
export const INIT: 'jsonforms/INIT' = 'jsonforms/INIT';
|
|
35
36
|
export const UPDATE_CORE: 'jsonforms/UPDATE_CORE' = `jsonforms/UPDATE_CORE`;
|
|
@@ -25,7 +25,7 @@
|
|
|
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
31
|
jsonSchema(instance: Object, options?: any): JsonSchema;
|
package/src/generators/schema.ts
CHANGED
package/src/i18n/i18nTypes.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { ErrorObject } from 'ajv';
|
|
2
|
-
import { JsonSchema, UISchemaElement } from '../models';
|
|
1
|
+
import type { ErrorObject } from 'ajv';
|
|
2
|
+
import type { JsonSchema, UISchemaElement } from '../models';
|
|
3
3
|
|
|
4
4
|
export type Translator = {
|
|
5
5
|
(id: string, defaultMessage: string, values?: any): string;
|
|
6
6
|
(id: string, defaultMessage: undefined, values?: any): string | undefined;
|
|
7
|
+
(id: string, defaultMessage?: string, values?: any): string | undefined;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
export type ErrorTranslator = (error: ErrorObject, translate: Translator, uischema?: UISchemaElement) => string;
|
package/src/i18n/i18nUtil.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ErrorObject } from 'ajv';
|
|
1
|
+
import type { ErrorObject } from 'ajv';
|
|
2
2
|
import { isInternationalized, Labelable, UISchemaElement } from '../models';
|
|
3
3
|
import { getControlPath } from '../reducers';
|
|
4
4
|
import { formatErrorMessage } from '../util';
|
|
5
|
-
import { i18nJsonSchema, ErrorTranslator, Translator } from './i18nTypes';
|
|
5
|
+
import type { i18nJsonSchema, ErrorTranslator, Translator } from './i18nTypes';
|
|
6
6
|
|
|
7
7
|
export const getI18nKeyPrefixBySchema = (
|
|
8
8
|
schema: i18nJsonSchema | undefined,
|
package/src/models/jsonSchema.ts
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import { JsonSchema4 } from './jsonSchema4';
|
|
27
|
-
import { JsonSchema7 } from './jsonSchema7';
|
|
26
|
+
import type { JsonSchema4 } from './jsonSchema4';
|
|
27
|
+
import type { JsonSchema7 } from './jsonSchema7';
|
|
28
28
|
|
|
29
29
|
export type JsonSchema = JsonSchema4 | JsonSchema7;
|
package/src/models/uischema.ts
CHANGED
package/src/reducers/cells.ts
CHANGED
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import { RankedTester } from '../testers';
|
|
26
|
+
import type { RankedTester } from '../testers';
|
|
27
27
|
import {
|
|
28
28
|
ADD_CELL,
|
|
29
29
|
AddCellRendererAction,
|
|
30
30
|
REMOVE_CELL,
|
|
31
31
|
RemoveCellRendererAction
|
|
32
32
|
} from '../actions';
|
|
33
|
-
import { Reducer } from '../util';
|
|
33
|
+
import type { Reducer } from '../util';
|
|
34
34
|
|
|
35
35
|
type ValidCellReducerActions = AddCellRendererAction | RemoveCellRendererAction;
|
|
36
36
|
|
package/src/reducers/config.ts
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
import merge from 'lodash/merge';
|
|
27
27
|
import { SET_CONFIG, SetConfigAction } from '../actions';
|
|
28
28
|
import { configDefault } from '../configDefault';
|
|
29
|
-
import { Reducer } from '../util';
|
|
29
|
+
import type { Reducer } from '../util';
|
|
30
30
|
|
|
31
31
|
const applyDefaultConfiguration = (config: any = {}) =>
|
|
32
32
|
merge({}, configDefault, config);
|
package/src/reducers/core.ts
CHANGED
|
@@ -29,7 +29,8 @@ import get from 'lodash/get';
|
|
|
29
29
|
import filter from 'lodash/filter';
|
|
30
30
|
import isEqual from 'lodash/isEqual';
|
|
31
31
|
import isFunction from 'lodash/isFunction';
|
|
32
|
-
import Ajv
|
|
32
|
+
import type Ajv from 'ajv';
|
|
33
|
+
import type { ErrorObject, ValidateFunction } from 'ajv';
|
|
33
34
|
import {
|
|
34
35
|
CoreActions,
|
|
35
36
|
INIT,
|
|
@@ -45,7 +46,7 @@ import {
|
|
|
45
46
|
UpdateCoreAction
|
|
46
47
|
} from '../actions';
|
|
47
48
|
import { createAjv, Reducer } from '../util';
|
|
48
|
-
import { JsonSchema, UISchemaElement } from '../models';
|
|
49
|
+
import type { JsonSchema, UISchemaElement } from '../models';
|
|
49
50
|
|
|
50
51
|
export const validate = (validator: ValidateFunction | undefined, data: any): ErrorObject[] => {
|
|
51
52
|
if (validator === undefined) {
|
|
@@ -424,4 +425,4 @@ const getErrorsAt = (
|
|
|
424
425
|
export const errorAt = (instancePath: string, schema: JsonSchema) =>
|
|
425
426
|
getErrorsAt(instancePath, schema, path => path === instancePath);
|
|
426
427
|
export const subErrorsAt = (instancePath: string, schema: JsonSchema) =>
|
|
427
|
-
getErrorsAt(instancePath, schema, path => path.startsWith(instancePath));
|
|
428
|
+
getErrorsAt(instancePath, schema, path => path.startsWith(instancePath + '.'));
|
package/src/reducers/i18n.ts
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
import { defaultErrorTranslator, defaultTranslator, JsonFormsI18nState } from '../i18n';
|
|
27
27
|
import { I18nActions, SET_LOCALE, SET_TRANSLATOR, UPDATE_I18N } from '../actions';
|
|
28
|
-
import { Reducer } from '../util';
|
|
28
|
+
import type { Reducer } from '../util';
|
|
29
29
|
|
|
30
30
|
export const defaultJsonFormsI18nState: Required<JsonFormsI18nState> = {
|
|
31
31
|
locale: 'en',
|
package/src/reducers/reducers.ts
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import { ControlElement, UISchemaElement } from '../models';
|
|
26
|
+
import type { ControlElement, UISchemaElement } from '../models';
|
|
27
27
|
import {
|
|
28
28
|
coreReducer,
|
|
29
29
|
errorAt,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
} from './core';
|
|
32
32
|
import { defaultDataReducer } from './default-data';
|
|
33
33
|
import { rendererReducer } from './renderers';
|
|
34
|
-
import { JsonFormsState } from '../store';
|
|
34
|
+
import type { JsonFormsState } from '../store';
|
|
35
35
|
import type { JsonFormsUISchemaRegistryEntry } from './uischemas';
|
|
36
36
|
import {
|
|
37
37
|
findMatchingUISchema,
|
|
@@ -44,13 +44,13 @@ import {
|
|
|
44
44
|
} from './i18n';
|
|
45
45
|
|
|
46
46
|
import { Generate } from '../generators';
|
|
47
|
-
import { JsonSchema } from '../models/jsonSchema';
|
|
47
|
+
import type { JsonSchema } from '../models/jsonSchema';
|
|
48
48
|
|
|
49
49
|
import { cellReducer } from './cells';
|
|
50
50
|
import { configReducer } from './config';
|
|
51
51
|
import get from 'lodash/get';
|
|
52
52
|
import { fetchTranslator } from '.';
|
|
53
|
-
import { ErrorTranslator, Translator } from '../i18n';
|
|
53
|
+
import type { ErrorTranslator, Translator } from '../i18n';
|
|
54
54
|
|
|
55
55
|
export const jsonFormsReducerConfig = {
|
|
56
56
|
core: coreReducer,
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import { RankedTester } from '../testers';
|
|
26
|
+
import type { RankedTester } from '../testers';
|
|
27
27
|
import {
|
|
28
28
|
ADD_RENDERER,
|
|
29
29
|
AddRendererAction,
|
|
30
30
|
REMOVE_RENDERER,
|
|
31
31
|
RemoveRendererAction
|
|
32
32
|
} from '../actions';
|
|
33
|
-
import { Reducer } from '../util';
|
|
33
|
+
import type { Reducer } from '../util';
|
|
34
34
|
|
|
35
35
|
export interface JsonFormsRendererRegistryEntry {
|
|
36
36
|
tester: RankedTester;
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
import get from 'lodash/get';
|
|
27
|
-
import Ajv from 'ajv';
|
|
28
|
-
import { JsonFormsState } from '../store';
|
|
29
|
-
import { JsonSchema, UISchemaElement } from '../models';
|
|
27
|
+
import type Ajv from 'ajv';
|
|
28
|
+
import type { JsonFormsState } from '../store';
|
|
29
|
+
import type { JsonSchema, UISchemaElement } from '../models';
|
|
30
30
|
import {
|
|
31
31
|
extractAjv,
|
|
32
32
|
extractData,
|
|
@@ -37,9 +37,9 @@ import {
|
|
|
37
37
|
extractDefaultData,
|
|
38
38
|
JsonFormsDefaultDataRegistryEntry
|
|
39
39
|
} from './default-data';
|
|
40
|
-
import { JsonFormsRendererRegistryEntry } from './renderers';
|
|
41
|
-
import { JsonFormsCellRendererRegistryEntry } from './cells';
|
|
42
|
-
import { JsonFormsUISchemaRegistryEntry } from './uischemas';
|
|
40
|
+
import type { JsonFormsRendererRegistryEntry } from './renderers';
|
|
41
|
+
import type { JsonFormsCellRendererRegistryEntry } from './cells';
|
|
42
|
+
import type { JsonFormsUISchemaRegistryEntry } from './uischemas';
|
|
43
43
|
|
|
44
44
|
export const getData = (state: JsonFormsState) =>
|
|
45
45
|
extractData(get(state, 'jsonforms.core'));
|
|
@@ -27,8 +27,8 @@ import maxBy from 'lodash/maxBy';
|
|
|
27
27
|
import remove from 'lodash/remove';
|
|
28
28
|
import { ADD_UI_SCHEMA, REMOVE_UI_SCHEMA, UISchemaActions } from '../actions';
|
|
29
29
|
import { NOT_APPLICABLE } from '../testers';
|
|
30
|
-
import { JsonSchema, UISchemaElement } from '../models';
|
|
31
|
-
import { Reducer } from '../util';
|
|
30
|
+
import type { JsonSchema, UISchemaElement } from '../models';
|
|
31
|
+
import type { Reducer } from '../util';
|
|
32
32
|
|
|
33
33
|
export type UISchemaTester = (
|
|
34
34
|
schema: JsonSchema,
|
package/src/store.ts
CHANGED
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import { Store } from './util';
|
|
27
|
-
import {
|
|
26
|
+
import type { Store } from './util';
|
|
27
|
+
import type {
|
|
28
28
|
JsonFormsCore,
|
|
29
29
|
JsonFormsCellRendererRegistryEntry,
|
|
30
30
|
JsonFormsRendererRegistryEntry,
|
|
31
31
|
JsonFormsUISchemaRegistryEntry
|
|
32
32
|
} from './reducers';
|
|
33
|
-
import { JsonFormsI18nState } from './i18n';
|
|
33
|
+
import type { JsonFormsI18nState } from './i18n';
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* JSONForms store.
|
package/src/testers/testers.ts
CHANGED
|
@@ -31,7 +31,7 @@ import isArray from 'lodash/isArray';
|
|
|
31
31
|
import reduce from 'lodash/reduce';
|
|
32
32
|
import toPairs from 'lodash/toPairs';
|
|
33
33
|
import includes from 'lodash/includes';
|
|
34
|
-
import {
|
|
34
|
+
import type {
|
|
35
35
|
Categorization,
|
|
36
36
|
ControlElement,
|
|
37
37
|
JsonSchema,
|
|
@@ -466,7 +466,7 @@ export const isObjectArrayWithNesting = (
|
|
|
466
466
|
if (val.$ref !== undefined) {
|
|
467
467
|
return false;
|
|
468
468
|
}
|
|
469
|
-
if (val.anyOf || val.oneOf) {
|
|
469
|
+
if (val.anyOf || val.oneOf || val.allOf) {
|
|
470
470
|
return true;
|
|
471
471
|
}
|
|
472
472
|
if (hasType(val, 'object')) {
|
package/src/util/cell.ts
CHANGED
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
getSchema,
|
|
35
35
|
getTranslator,
|
|
36
36
|
} from '../reducers';
|
|
37
|
-
import { AnyAction, Dispatch } from './type';
|
|
37
|
+
import type { AnyAction, Dispatch } from './type';
|
|
38
38
|
import {
|
|
39
39
|
formatErrorMessage,
|
|
40
40
|
Resolve,
|
|
@@ -53,8 +53,8 @@ import {
|
|
|
53
53
|
OwnPropsOfEnum,
|
|
54
54
|
StatePropsOfScopedRenderer,
|
|
55
55
|
} from './renderer';
|
|
56
|
-
import { JsonFormsState } from '../store';
|
|
57
|
-
import { JsonSchema } from '../models';
|
|
56
|
+
import type { JsonFormsState } from '../store';
|
|
57
|
+
import type { JsonSchema } from '../models';
|
|
58
58
|
import { getI18nKeyPrefix } from '../i18n';
|
|
59
59
|
|
|
60
60
|
export type { JsonFormsCellRendererRegistryEntry };
|
package/src/util/combinators.ts
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
THE SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import { ControlElement, JsonSchema, UISchemaElement } from '../models';
|
|
26
|
+
import type { ControlElement, JsonSchema, UISchemaElement } from '../models';
|
|
27
27
|
import { findUISchema, JsonFormsUISchemaRegistryEntry } from '../reducers';
|
|
28
28
|
import { Resolve } from './util';
|
|
29
29
|
|
package/src/util/label.ts
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
import startCase from 'lodash/startCase';
|
|
27
27
|
|
|
28
|
-
import { ControlElement, JsonSchema, LabelDescription } from '../models';
|
|
28
|
+
import type { ControlElement, JsonSchema, LabelDescription } from '../models';
|
|
29
29
|
import { decode } from './path';
|
|
30
30
|
|
|
31
31
|
const deriveLabel = (
|
package/src/util/path.ts
CHANGED
|
@@ -69,12 +69,15 @@ export const toDataPathSegments = (schemaPath: string): string[] => {
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* Convert a schema path (i.e. JSON pointer) to a data path.
|
|
73
|
+
*
|
|
74
|
+
* Data paths can be used in field change event handlers like handleChange.
|
|
75
|
+
*
|
|
73
76
|
* @example
|
|
74
|
-
* toDataPath('#/properties/foo/properties/bar') === '
|
|
77
|
+
* toDataPath('#/properties/foo/properties/bar') === 'foo.bar')
|
|
75
78
|
*
|
|
76
79
|
* @param {string} schemaPath the schema path to be converted
|
|
77
|
-
* @returns {string} the path
|
|
80
|
+
* @returns {string} the data path
|
|
78
81
|
*/
|
|
79
82
|
export const toDataPath = (schemaPath: string): string => {
|
|
80
83
|
return toDataPathSegments(schemaPath).join('.');
|