@jsonforms/core 3.2.0-beta.0 → 3.2.0-beta.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/actions/actions.d.ts +3 -3
- package/lib/i18n/arrayTranslations.d.ts +1 -1
- package/lib/i18n/combinatorTranslations.d.ts +1 -1
- package/lib/i18n/i18nTypes.d.ts +3 -3
- package/lib/jsonforms-core.cjs.js +38 -39
- package/lib/jsonforms-core.cjs.js.map +1 -1
- package/lib/jsonforms-core.esm.js +8 -1
- package/lib/jsonforms-core.esm.js.map +1 -1
- package/lib/models/jsonSchema.d.ts +1 -1
- package/lib/reducers/cells.d.ts +2 -2
- package/lib/reducers/core.d.ts +1 -1
- package/lib/reducers/default-data.d.ts +1 -1
- package/lib/reducers/index.d.ts +1 -0
- package/lib/reducers/middleware.d.ts +6 -0
- package/lib/reducers/renderers.d.ts +1 -1
- package/lib/reducers/uischemas.d.ts +1 -1
- package/lib/testers/testers.d.ts +2 -2
- package/lib/util/cell.d.ts +1 -1
- package/lib/util/combinators.d.ts +1 -1
- package/lib/util/defaultDateFormat.d.ts +3 -0
- package/lib/util/index.d.ts +1 -0
- package/lib/util/renderer.d.ts +1 -1
- package/lib/util/type.d.ts +5 -5
- package/lib/util/uischema.d.ts +1 -1
- package/package.json +4 -4
- package/src/generators/uischema.ts +2 -0
- package/src/reducers/index.ts +1 -0
- package/src/reducers/middleware.ts +36 -0
- package/src/util/defaultDateFormat.ts +28 -0
- package/src/util/index.ts +1 -0
package/lib/reducers/cells.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { RankedTester } from '../testers';
|
|
2
2
|
import { AddCellRendererAction, RemoveCellRendererAction } from '../actions';
|
|
3
3
|
import type { Reducer } from '../util';
|
|
4
|
-
|
|
5
|
-
export
|
|
4
|
+
type ValidCellReducerActions = AddCellRendererAction | RemoveCellRendererAction;
|
|
5
|
+
export type JsonFormsCellRendererRegistryState = JsonFormsCellRendererRegistryEntry[];
|
|
6
6
|
export interface JsonFormsCellRendererRegistryEntry {
|
|
7
7
|
tester: RankedTester;
|
|
8
8
|
cell: any;
|
package/lib/reducers/core.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { CoreActions } from '../actions';
|
|
|
4
4
|
import { Reducer } from '../util';
|
|
5
5
|
import type { JsonSchema, UISchemaElement } from '../models';
|
|
6
6
|
export declare const validate: (validator: ValidateFunction | undefined, data: any) => ErrorObject[];
|
|
7
|
-
export
|
|
7
|
+
export type ValidationMode = 'ValidateAndShow' | 'ValidateAndHide' | 'NoValidation';
|
|
8
8
|
export interface JsonFormsCore {
|
|
9
9
|
data: any;
|
|
10
10
|
schema: JsonSchema;
|
|
@@ -4,7 +4,7 @@ export interface JsonFormsDefaultDataRegistryEntry {
|
|
|
4
4
|
schemaPath: string;
|
|
5
5
|
data: any;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
type ValidDefaultDataActions = RegisterDefaultDataAction | UnregisterDefaultDataAction;
|
|
8
8
|
export declare const defaultDataReducer: Reducer<JsonFormsDefaultDataRegistryEntry[], ValidDefaultDataActions>;
|
|
9
9
|
export declare const extractDefaultData: (state: JsonFormsDefaultDataRegistryEntry[]) => JsonFormsDefaultDataRegistryEntry[];
|
|
10
10
|
export {};
|
package/lib/reducers/index.d.ts
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CoreActions } from '../actions';
|
|
2
|
+
import { JsonFormsCore } from './core';
|
|
3
|
+
export interface Middleware {
|
|
4
|
+
(state: JsonFormsCore, action: CoreActions, defaultReducer: (state: JsonFormsCore, action: CoreActions) => JsonFormsCore): JsonFormsCore;
|
|
5
|
+
}
|
|
6
|
+
export declare const defaultMiddleware: Middleware;
|
|
@@ -5,6 +5,6 @@ export interface JsonFormsRendererRegistryEntry {
|
|
|
5
5
|
tester: RankedTester;
|
|
6
6
|
renderer: any;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
type ValidRendererReducerActions = AddRendererAction | RemoveRendererAction;
|
|
9
9
|
export declare const rendererReducer: Reducer<JsonFormsRendererRegistryEntry[], ValidRendererReducerActions>;
|
|
10
10
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UISchemaActions } from '../actions';
|
|
2
2
|
import type { JsonSchema, UISchemaElement } from '../models';
|
|
3
3
|
import type { Reducer } from '../util';
|
|
4
|
-
export
|
|
4
|
+
export type UISchemaTester = (schema: JsonSchema, schemaPath: string, path: string) => number;
|
|
5
5
|
export interface JsonFormsUISchemaRegistryEntry {
|
|
6
6
|
tester: UISchemaTester;
|
|
7
7
|
uischema: UISchemaElement;
|
package/lib/testers/testers.d.ts
CHANGED
|
@@ -9,11 +9,11 @@ export declare const NOT_APPLICABLE = -1;
|
|
|
9
9
|
* A tester is a function that receives an UI schema and a JSON schema and returns a boolean.
|
|
10
10
|
* The rootSchema is handed over as context. Can be used to resolve references.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export type Tester = (uischema: UISchemaElement, schema: JsonSchema, context: TesterContext) => boolean;
|
|
13
13
|
/**
|
|
14
14
|
* A ranked tester associates a tester with a number.
|
|
15
15
|
*/
|
|
16
|
-
export
|
|
16
|
+
export type RankedTester = (uischema: UISchemaElement, schema: JsonSchema, context: TesterContext) => number;
|
|
17
17
|
/**
|
|
18
18
|
* Additional context given to a tester in addition to UISchema and JsonSchema.
|
|
19
19
|
*/
|
package/lib/util/cell.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export interface StatePropsOfEnumCell extends StatePropsOfCell, OwnPropsOfEnum {
|
|
|
25
25
|
*/
|
|
26
26
|
export interface EnumCellProps extends StatePropsOfEnumCell, DispatchPropsOfControl {
|
|
27
27
|
}
|
|
28
|
-
export
|
|
28
|
+
export type DispatchPropsOfCell = DispatchPropsOfControl;
|
|
29
29
|
/**
|
|
30
30
|
* Props of a cell.
|
|
31
31
|
*/
|
|
@@ -5,5 +5,5 @@ export interface CombinatorSubSchemaRenderInfo {
|
|
|
5
5
|
uischema: UISchemaElement;
|
|
6
6
|
label: string;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
8
|
+
export type CombinatorKeyword = 'anyOf' | 'oneOf' | 'allOf';
|
|
9
9
|
export declare const createCombinatorRenderInfos: (combinatorSubSchemas: JsonSchema[], rootSchema: JsonSchema, keyword: CombinatorKeyword, control: ControlElement, path: string, uischemas: JsonFormsUISchemaRegistryEntry[]) => CombinatorSubSchemaRenderInfo[];
|
package/lib/util/index.d.ts
CHANGED
package/lib/util/renderer.d.ts
CHANGED
|
@@ -357,7 +357,7 @@ export declare const layoutDefaultProps: {
|
|
|
357
357
|
* @returns {StatePropsOfLayout}
|
|
358
358
|
*/
|
|
359
359
|
export declare const mapStateToLayoutProps: (state: JsonFormsState, ownProps: OwnPropsOfLayout) => LayoutProps;
|
|
360
|
-
export
|
|
360
|
+
export type RefResolver = (schema: JsonSchema) => Promise<JsonSchema>;
|
|
361
361
|
export interface OwnPropsOfJsonFormsRenderer extends OwnPropsOfRenderer {
|
|
362
362
|
}
|
|
363
363
|
export interface StatePropsOfJsonFormsRenderer extends OwnPropsOfJsonFormsRenderer {
|
package/lib/util/type.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export interface AnyAction extends Action {
|
|
|
31
31
|
* @template A The type of things (actions or otherwise) which may be
|
|
32
32
|
* dispatched.
|
|
33
33
|
*/
|
|
34
|
-
export
|
|
34
|
+
export type Dispatch<A extends Action = AnyAction> = <T extends A>(action: T) => T;
|
|
35
35
|
/**
|
|
36
36
|
* A store is an object that holds the application's state tree.
|
|
37
37
|
* There should only be a single store in a Redux app, as the composition
|
|
@@ -122,7 +122,7 @@ export interface Store<S = any, A extends Action = AnyAction> {
|
|
|
122
122
|
* For more information, see the observable proposal:
|
|
123
123
|
* https://github.com/tc39/proposal-observable
|
|
124
124
|
*/
|
|
125
|
-
export
|
|
125
|
+
export type Observable<T> = {
|
|
126
126
|
/**
|
|
127
127
|
* The minimal observable subscription method.
|
|
128
128
|
* @param {Object} observer Any object that can be used as an observer.
|
|
@@ -140,7 +140,7 @@ export declare type Observable<T> = {
|
|
|
140
140
|
* An Observer is used to receive data from an Observable, and is supplied as
|
|
141
141
|
* an argument to subscribe.
|
|
142
142
|
*/
|
|
143
|
-
export
|
|
143
|
+
export type Observer<T> = {
|
|
144
144
|
next?(value: T): void;
|
|
145
145
|
};
|
|
146
146
|
/**
|
|
@@ -167,8 +167,8 @@ export declare type Observer<T> = {
|
|
|
167
167
|
* @template S The type of state consumed and produced by this reducer.
|
|
168
168
|
* @template A The type of actions the reducer can potentially respond to.
|
|
169
169
|
*/
|
|
170
|
-
export
|
|
170
|
+
export type Reducer<S = any, A extends Action = AnyAction> = (state: S | undefined, action: A) => S;
|
|
171
171
|
/**
|
|
172
172
|
* Function to remove listener added by `Store.subscribe()`.
|
|
173
173
|
*/
|
|
174
|
-
export
|
|
174
|
+
export type Unsubscribe = () => void;
|
package/lib/util/uischema.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UISchemaElement } from '../models';
|
|
2
|
-
export
|
|
2
|
+
export type IterateCallback = (uischema: UISchemaElement) => void;
|
|
3
3
|
export declare const setReadonly: (uischema: UISchemaElement) => void;
|
|
4
4
|
export declare const unsetReadonly: (uischema: UISchemaElement) => void;
|
|
5
5
|
export declare const iterateSchema: (uischema: UISchemaElement, toApply: IterateCallback) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsonforms/core",
|
|
3
|
-
"version": "3.2.0-beta.
|
|
3
|
+
"version": "3.2.0-beta.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",
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"source-map-support": "0.5.16",
|
|
87
87
|
"ts-node": "^10.4.0",
|
|
88
88
|
"tslib": "^2.5.0",
|
|
89
|
-
"typedoc": "~0.
|
|
90
|
-
"typescript": "4.
|
|
89
|
+
"typedoc": "~0.25.3",
|
|
90
|
+
"typescript": "~4.9.5"
|
|
91
91
|
},
|
|
92
92
|
"scripts": {
|
|
93
93
|
"build": "rollup -c rollup.config.js",
|
|
@@ -97,6 +97,6 @@
|
|
|
97
97
|
"report": "nyc report --reporter=html",
|
|
98
98
|
"test": "ava",
|
|
99
99
|
"test-cov": "rimraf -rf .nyc_output && nyc ava",
|
|
100
|
-
"doc": "typedoc --name 'JSON Forms Core' --excludeExternals --
|
|
100
|
+
"doc": "typedoc --name 'JSON Forms Core' --excludeExternals --out docs src"
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -191,6 +191,8 @@ const generateUISchema = (
|
|
|
191
191
|
/* falls through */
|
|
192
192
|
case 'integer':
|
|
193
193
|
/* falls through */
|
|
194
|
+
case 'null':
|
|
195
|
+
/* falls through */
|
|
194
196
|
case 'boolean': {
|
|
195
197
|
const controlObject: ControlElement = createControlElement(currentRef);
|
|
196
198
|
schemaElements.push(controlObject);
|
package/src/reducers/index.ts
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
The MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2023 EclipseSource Munich
|
|
5
|
+
https://github.com/eclipsesource/jsonforms
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
|
15
|
+
all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
THE SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
import { CoreActions } from '../actions';
|
|
26
|
+
import { JsonFormsCore } from './core';
|
|
27
|
+
|
|
28
|
+
export interface Middleware {
|
|
29
|
+
(
|
|
30
|
+
state: JsonFormsCore,
|
|
31
|
+
action: CoreActions,
|
|
32
|
+
defaultReducer: (state: JsonFormsCore, action: CoreActions) => JsonFormsCore
|
|
33
|
+
): JsonFormsCore;
|
|
34
|
+
}
|
|
35
|
+
export const defaultMiddleware: Middleware = (state, action, defaultReducer) =>
|
|
36
|
+
defaultReducer(state, action);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
The MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2023-2023 EclipseSource Munich
|
|
5
|
+
https://github.com/eclipsesource/jsonforms
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
|
15
|
+
all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
THE SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
export const defaultDateFormat = 'YYYY-MM-DD';
|
|
27
|
+
export const defaultTimeFormat = 'HH:mm:ss';
|
|
28
|
+
export const defaultDateTimeFormat = 'YYYY-MM-DDTHH:mm:ss.sssZ';
|
package/src/util/index.ts
CHANGED