@jsonforms/core 3.3.0-beta.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Helpers.d.ts +5 -5
- package/lib/actions/actions.d.ts +198 -198
- package/lib/actions/index.d.ts +1 -1
- package/lib/configDefault.d.ts +6 -6
- package/lib/generators/Generate.d.ts +6 -6
- package/lib/generators/index.d.ts +3 -3
- package/lib/generators/schema.d.ts +8 -8
- package/lib/generators/uischema.d.ts +12 -12
- package/lib/i18n/arrayTranslations.d.ts +24 -24
- package/lib/i18n/combinatorTranslations.d.ts +14 -14
- package/lib/i18n/i18nTypes.d.ts +16 -16
- package/lib/i18n/i18nUtil.d.ts +28 -28
- package/lib/i18n/index.d.ts +4 -4
- package/lib/index.d.ts +11 -11
- package/lib/models/draft4.d.ts +198 -198
- package/lib/models/index.d.ts +5 -5
- package/lib/models/jsonSchema.d.ts +3 -3
- package/lib/models/jsonSchema4.d.ts +110 -110
- package/lib/models/jsonSchema7.d.ts +119 -119
- package/lib/models/uischema.d.ts +231 -231
- package/lib/reducers/cells.d.ts +11 -11
- package/lib/reducers/config.d.ts +3 -3
- package/lib/reducers/core.d.ts +26 -26
- package/lib/reducers/default-data.d.ts +10 -10
- package/lib/reducers/i18n.d.ts +8 -8
- package/lib/reducers/index.d.ts +10 -10
- package/lib/reducers/middleware.d.ts +6 -6
- package/lib/reducers/reducers.d.ts +29 -29
- package/lib/reducers/renderers.d.ts +10 -10
- package/lib/reducers/selectors.d.ts +15 -15
- package/lib/reducers/uischemas.d.ts +10 -10
- package/lib/store.d.ts +53 -53
- package/lib/testers/index.d.ts +1 -1
- package/lib/testers/testers.d.ts +220 -220
- package/lib/util/Formatted.d.ts +19 -19
- package/lib/util/array.d.ts +3 -3
- package/lib/util/cell.d.ts +78 -78
- package/lib/util/combinators.d.ts +9 -9
- package/lib/util/defaultDateFormat.d.ts +3 -3
- package/lib/util/ids.d.ts +3 -3
- package/lib/util/index.d.ts +16 -16
- package/lib/util/label.d.ts +21 -21
- package/lib/util/path.d.ts +38 -38
- package/lib/util/renderer.d.ts +429 -429
- package/lib/util/resolvers.d.ts +25 -25
- package/lib/util/runtime.d.ts +17 -17
- package/lib/util/schema.d.ts +10 -10
- package/lib/util/type.d.ts +174 -174
- package/lib/util/uischema.d.ts +18 -18
- package/lib/util/util.d.ts +57 -57
- package/lib/util/validator.d.ts +3 -3
- package/package.json +2 -2
package/lib/util/resolvers.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import type { JsonSchema } from '../models';
|
|
2
|
-
/**
|
|
3
|
-
* Map for storing refs and the respective schemas they are pointing to.
|
|
4
|
-
*/
|
|
5
|
-
export interface ReferenceSchemaMap {
|
|
6
|
-
[ref: string]: JsonSchema;
|
|
7
|
-
}
|
|
8
|
-
export declare const resolveData: (instance: any, dataPath: string) => any;
|
|
9
|
-
/**
|
|
10
|
-
* Finds all references inside the given schema.
|
|
11
|
-
*
|
|
12
|
-
* @param schema The {@link JsonSchema} to find the references in
|
|
13
|
-
* @param result The initial result map, default: empty map (this parameter is used for recursion
|
|
14
|
-
* inside the function)
|
|
15
|
-
* @param resolveTuples Whether arrays of tuples should be considered; default: false
|
|
16
|
-
*/
|
|
17
|
-
export declare const findAllRefs: (schema: JsonSchema, result?: ReferenceSchemaMap, resolveTuples?: boolean) => ReferenceSchemaMap;
|
|
18
|
-
/**
|
|
19
|
-
* Resolve the given schema path in order to obtain a subschema.
|
|
20
|
-
* @param {JsonSchema} schema the root schema from which to start
|
|
21
|
-
* @param {string} schemaPath the schema path to be resolved
|
|
22
|
-
* @param {JsonSchema} rootSchema the actual root schema
|
|
23
|
-
* @returns {JsonSchema} the resolved sub-schema
|
|
24
|
-
*/
|
|
25
|
-
export declare const resolveSchema: (schema: JsonSchema, schemaPath: string, rootSchema: JsonSchema) => JsonSchema;
|
|
1
|
+
import type { JsonSchema } from '../models';
|
|
2
|
+
/**
|
|
3
|
+
* Map for storing refs and the respective schemas they are pointing to.
|
|
4
|
+
*/
|
|
5
|
+
export interface ReferenceSchemaMap {
|
|
6
|
+
[ref: string]: JsonSchema;
|
|
7
|
+
}
|
|
8
|
+
export declare const resolveData: (instance: any, dataPath: string) => any;
|
|
9
|
+
/**
|
|
10
|
+
* Finds all references inside the given schema.
|
|
11
|
+
*
|
|
12
|
+
* @param schema The {@link JsonSchema} to find the references in
|
|
13
|
+
* @param result The initial result map, default: empty map (this parameter is used for recursion
|
|
14
|
+
* inside the function)
|
|
15
|
+
* @param resolveTuples Whether arrays of tuples should be considered; default: false
|
|
16
|
+
*/
|
|
17
|
+
export declare const findAllRefs: (schema: JsonSchema, result?: ReferenceSchemaMap, resolveTuples?: boolean) => ReferenceSchemaMap;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the given schema path in order to obtain a subschema.
|
|
20
|
+
* @param {JsonSchema} schema the root schema from which to start
|
|
21
|
+
* @param {string} schemaPath the schema path to be resolved
|
|
22
|
+
* @param {JsonSchema} rootSchema the actual root schema
|
|
23
|
+
* @returns {JsonSchema} the resolved sub-schema
|
|
24
|
+
*/
|
|
25
|
+
export declare const resolveSchema: (schema: JsonSchema, schemaPath: string, rootSchema: JsonSchema) => JsonSchema;
|
package/lib/util/runtime.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { JsonSchema, UISchemaElement } from '../models';
|
|
2
|
-
import type Ajv from 'ajv';
|
|
3
|
-
import type { JsonFormsState } from '../store';
|
|
4
|
-
export declare const evalVisibility: (uischema: UISchemaElement, data: any, path: string, ajv: Ajv) => boolean;
|
|
5
|
-
export declare const evalEnablement: (uischema: UISchemaElement, data: any, path: string, ajv: Ajv) => boolean;
|
|
6
|
-
export declare const hasShowRule: (uischema: UISchemaElement) => boolean;
|
|
7
|
-
export declare const hasEnableRule: (uischema: UISchemaElement) => boolean;
|
|
8
|
-
export declare const isVisible: (uischema: UISchemaElement, data: any, path: string, ajv: Ajv) => boolean;
|
|
9
|
-
export declare const isEnabled: (uischema: UISchemaElement, data: any, path: string, ajv: Ajv) => boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Indicates whether the given `uischema` element shall be enabled or disabled.
|
|
12
|
-
* Checks the global readonly flag, uischema rule, uischema options (including the config),
|
|
13
|
-
* the schema and the enablement indicator of the parent.
|
|
14
|
-
*/
|
|
15
|
-
export declare const isInherentlyEnabled: (state: JsonFormsState, ownProps: any, uischema: UISchemaElement, schema: (JsonSchema & {
|
|
16
|
-
readOnly?: boolean;
|
|
17
|
-
}) | undefined, rootData: any, config: any) => any;
|
|
1
|
+
import { JsonSchema, UISchemaElement } from '../models';
|
|
2
|
+
import type Ajv from 'ajv';
|
|
3
|
+
import type { JsonFormsState } from '../store';
|
|
4
|
+
export declare const evalVisibility: (uischema: UISchemaElement, data: any, path: string, ajv: Ajv) => boolean;
|
|
5
|
+
export declare const evalEnablement: (uischema: UISchemaElement, data: any, path: string, ajv: Ajv) => boolean;
|
|
6
|
+
export declare const hasShowRule: (uischema: UISchemaElement) => boolean;
|
|
7
|
+
export declare const hasEnableRule: (uischema: UISchemaElement) => boolean;
|
|
8
|
+
export declare const isVisible: (uischema: UISchemaElement, data: any, path: string, ajv: Ajv) => boolean;
|
|
9
|
+
export declare const isEnabled: (uischema: UISchemaElement, data: any, path: string, ajv: Ajv) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Indicates whether the given `uischema` element shall be enabled or disabled.
|
|
12
|
+
* Checks the global readonly flag, uischema rule, uischema options (including the config),
|
|
13
|
+
* the schema and the enablement indicator of the parent.
|
|
14
|
+
*/
|
|
15
|
+
export declare const isInherentlyEnabled: (state: JsonFormsState, ownProps: any, uischema: UISchemaElement, schema: (JsonSchema & {
|
|
16
|
+
readOnly?: boolean;
|
|
17
|
+
}) | undefined, rootData: any, config: any) => any;
|
package/lib/util/schema.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { JsonSchema } from '../models';
|
|
2
|
-
export declare const getFirstPrimitiveProp: (schema: any) => string;
|
|
3
|
-
/**
|
|
4
|
-
* Tests whether the schema has an enum based on oneOf.
|
|
5
|
-
*/
|
|
6
|
-
export declare const isOneOfEnumSchema: (schema: JsonSchema) => boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Tests whether the schema has an enum.
|
|
9
|
-
*/
|
|
10
|
-
export declare const isEnumSchema: (schema: JsonSchema) => any;
|
|
1
|
+
import { JsonSchema } from '../models';
|
|
2
|
+
export declare const getFirstPrimitiveProp: (schema: any) => string;
|
|
3
|
+
/**
|
|
4
|
+
* Tests whether the schema has an enum based on oneOf.
|
|
5
|
+
*/
|
|
6
|
+
export declare const isOneOfEnumSchema: (schema: JsonSchema) => boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Tests whether the schema has an enum.
|
|
9
|
+
*/
|
|
10
|
+
export declare const isEnumSchema: (schema: JsonSchema) => any;
|
package/lib/util/type.d.ts
CHANGED
|
@@ -1,174 +1,174 @@
|
|
|
1
|
-
export interface Action<T = any> {
|
|
2
|
-
type: T;
|
|
3
|
-
}
|
|
4
|
-
/**
|
|
5
|
-
* An Action type which accepts any other properties.
|
|
6
|
-
* This is mainly for the use of the `Reducer` type.
|
|
7
|
-
* This is not part of `Action` itself to prevent types that extend `Action` from
|
|
8
|
-
* having an index signature.
|
|
9
|
-
*/
|
|
10
|
-
export interface AnyAction extends Action {
|
|
11
|
-
[extraProps: string]: any;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* A *dispatching function* (or simply *dispatch function*) is a function that
|
|
15
|
-
* accepts an action or an async action; it then may or may not dispatch one
|
|
16
|
-
* or more actions to the store.
|
|
17
|
-
*
|
|
18
|
-
* We must distinguish between dispatching functions in general and the base
|
|
19
|
-
* `dispatch` function provided by the store instance without any middleware.
|
|
20
|
-
*
|
|
21
|
-
* The base dispatch function *always* synchronously sends an action to the
|
|
22
|
-
* store's reducer, along with the previous state returned by the store, to
|
|
23
|
-
* calculate a new state. It expects actions to be plain objects ready to be
|
|
24
|
-
* consumed by the reducer.
|
|
25
|
-
*
|
|
26
|
-
* Middleware wraps the base dispatch function. It allows the dispatch
|
|
27
|
-
* function to handle async actions in addition to actions. Middleware may
|
|
28
|
-
* transform, delay, ignore, or otherwise interpret actions or async actions
|
|
29
|
-
* before passing them to the next middleware.
|
|
30
|
-
*
|
|
31
|
-
* @template A The type of things (actions or otherwise) which may be
|
|
32
|
-
* dispatched.
|
|
33
|
-
*/
|
|
34
|
-
export type Dispatch<A extends Action = AnyAction> = <T extends A>(action: T) => T;
|
|
35
|
-
/**
|
|
36
|
-
* A store is an object that holds the application's state tree.
|
|
37
|
-
* There should only be a single store in a Redux app, as the composition
|
|
38
|
-
* happens on the reducer level.
|
|
39
|
-
*
|
|
40
|
-
* @template S The type of state held by this store.
|
|
41
|
-
* @template A the type of actions which may be dispatched by this store.
|
|
42
|
-
*/
|
|
43
|
-
export interface Store<S = any, A extends Action = AnyAction> {
|
|
44
|
-
/**
|
|
45
|
-
* Dispatches an action. It is the only way to trigger a state change.
|
|
46
|
-
*
|
|
47
|
-
* The `reducer` function, used to create the store, will be called with the
|
|
48
|
-
* current state tree and the given `action`. Its return value will be
|
|
49
|
-
* considered the **next** state of the tree, and the change listeners will
|
|
50
|
-
* be notified.
|
|
51
|
-
*
|
|
52
|
-
* The base implementation only supports plain object actions. If you want
|
|
53
|
-
* to dispatch a Promise, an Observable, a thunk, or something else, you
|
|
54
|
-
* need to wrap your store creating function into the corresponding
|
|
55
|
-
* middleware. For example, see the documentation for the `redux-thunk`
|
|
56
|
-
* package. Even the middleware will eventually dispatch plain object
|
|
57
|
-
* actions using this method.
|
|
58
|
-
*
|
|
59
|
-
* @param action A plain object representing “what changed”. It is a good
|
|
60
|
-
* idea to keep actions serializable so you can record and replay user
|
|
61
|
-
* sessions, or use the time travelling `redux-devtools`. An action must
|
|
62
|
-
* have a `type` property which may not be `undefined`. It is a good idea
|
|
63
|
-
* to use string constants for action types.
|
|
64
|
-
*
|
|
65
|
-
* @returns For convenience, the same action object you dispatched.
|
|
66
|
-
*
|
|
67
|
-
* Note that, if you use a custom middleware, it may wrap `dispatch()` to
|
|
68
|
-
* return something else (for example, a Promise you can await).
|
|
69
|
-
*/
|
|
70
|
-
dispatch: Dispatch<A>;
|
|
71
|
-
/**
|
|
72
|
-
* Reads the state tree managed by the store.
|
|
73
|
-
*
|
|
74
|
-
* @returns The current state tree of your application.
|
|
75
|
-
*/
|
|
76
|
-
getState(): S;
|
|
77
|
-
/**
|
|
78
|
-
* Adds a change listener. It will be called any time an action is
|
|
79
|
-
* dispatched, and some part of the state tree may potentially have changed.
|
|
80
|
-
* You may then call `getState()` to read the current state tree inside the
|
|
81
|
-
* callback.
|
|
82
|
-
*
|
|
83
|
-
* You may call `dispatch()` from a change listener, with the following
|
|
84
|
-
* caveats:
|
|
85
|
-
*
|
|
86
|
-
* 1. The subscriptions are snapshotted just before every `dispatch()` call.
|
|
87
|
-
* If you subscribe or unsubscribe while the listeners are being invoked,
|
|
88
|
-
* this will not have any effect on the `dispatch()` that is currently in
|
|
89
|
-
* progress. However, the next `dispatch()` call, whether nested or not,
|
|
90
|
-
* will use a more recent snapshot of the subscription list.
|
|
91
|
-
*
|
|
92
|
-
* 2. The listener should not expect to see all states changes, as the state
|
|
93
|
-
* might have been updated multiple times during a nested `dispatch()` before
|
|
94
|
-
* the listener is called. It is, however, guaranteed that all subscribers
|
|
95
|
-
* registered before the `dispatch()` started will be called with the latest
|
|
96
|
-
* state by the time it exits.
|
|
97
|
-
*
|
|
98
|
-
* @param listener A callback to be invoked on every dispatch.
|
|
99
|
-
* @returns A function to remove this change listener.
|
|
100
|
-
*/
|
|
101
|
-
subscribe(listener: () => void): Unsubscribe;
|
|
102
|
-
/**
|
|
103
|
-
* Replaces the reducer currently used by the store to calculate the state.
|
|
104
|
-
*
|
|
105
|
-
* You might need this if your app implements code splitting and you want to
|
|
106
|
-
* load some of the reducers dynamically. You might also need this if you
|
|
107
|
-
* implement a hot reloading mechanism for Redux.
|
|
108
|
-
*
|
|
109
|
-
* @param nextReducer The reducer for the store to use instead.
|
|
110
|
-
*/
|
|
111
|
-
replaceReducer(nextReducer: Reducer<S, A>): void;
|
|
112
|
-
/**
|
|
113
|
-
* Interoperability point for observable/reactive libraries.
|
|
114
|
-
* @returns {observable} A minimal observable of state changes.
|
|
115
|
-
* For more information, see the observable proposal:
|
|
116
|
-
* https://github.com/tc39/proposal-observable
|
|
117
|
-
*/
|
|
118
|
-
[Symbol.observable](): Observable<S>;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* A minimal observable of state changes.
|
|
122
|
-
* For more information, see the observable proposal:
|
|
123
|
-
* https://github.com/tc39/proposal-observable
|
|
124
|
-
*/
|
|
125
|
-
export type Observable<T> = {
|
|
126
|
-
/**
|
|
127
|
-
* The minimal observable subscription method.
|
|
128
|
-
* @param {Object} observer Any object that can be used as an observer.
|
|
129
|
-
* The observer object should have a `next` method.
|
|
130
|
-
* @returns {subscription} An object with an `unsubscribe` method that can
|
|
131
|
-
* be used to unsubscribe the observable from the store, and prevent further
|
|
132
|
-
* emission of values from the observable.
|
|
133
|
-
*/
|
|
134
|
-
subscribe(observer: Observer<T>): {
|
|
135
|
-
unsubscribe: Unsubscribe;
|
|
136
|
-
};
|
|
137
|
-
[Symbol.observable](): Observable<T>;
|
|
138
|
-
};
|
|
139
|
-
/**
|
|
140
|
-
* An Observer is used to receive data from an Observable, and is supplied as
|
|
141
|
-
* an argument to subscribe.
|
|
142
|
-
*/
|
|
143
|
-
export type Observer<T> = {
|
|
144
|
-
next?(value: T): void;
|
|
145
|
-
};
|
|
146
|
-
/**
|
|
147
|
-
* A *reducer* (also called a *reducing function*) is a function that accepts
|
|
148
|
-
* an accumulation and a value and returns a new accumulation. They are used
|
|
149
|
-
* to reduce a collection of values down to a single value
|
|
150
|
-
*
|
|
151
|
-
* Reducers are not unique to Redux—they are a fundamental concept in
|
|
152
|
-
* functional programming. Even most non-functional languages, like
|
|
153
|
-
* JavaScript, have a built-in API for reducing. In JavaScript, it's
|
|
154
|
-
* `Array.prototype.reduce()`.
|
|
155
|
-
*
|
|
156
|
-
* In Redux, the accumulated value is the state object, and the values being
|
|
157
|
-
* accumulated are actions. Reducers calculate a new state given the previous
|
|
158
|
-
* state and an action. They must be *pure functions*—functions that return
|
|
159
|
-
* the exact same output for given inputs. They should also be free of
|
|
160
|
-
* side-effects. This is what enables exciting features like hot reloading and
|
|
161
|
-
* time travel.
|
|
162
|
-
*
|
|
163
|
-
* Reducers are the most important concept in Redux.
|
|
164
|
-
*
|
|
165
|
-
* *Do not put API calls into reducers.*
|
|
166
|
-
*
|
|
167
|
-
* @template S The type of state consumed and produced by this reducer.
|
|
168
|
-
* @template A The type of actions the reducer can potentially respond to.
|
|
169
|
-
*/
|
|
170
|
-
export type Reducer<S = any, A extends Action = AnyAction> = (state: S | undefined, action: A) => S;
|
|
171
|
-
/**
|
|
172
|
-
* Function to remove listener added by `Store.subscribe()`.
|
|
173
|
-
*/
|
|
174
|
-
export type Unsubscribe = () => void;
|
|
1
|
+
export interface Action<T = any> {
|
|
2
|
+
type: T;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* An Action type which accepts any other properties.
|
|
6
|
+
* This is mainly for the use of the `Reducer` type.
|
|
7
|
+
* This is not part of `Action` itself to prevent types that extend `Action` from
|
|
8
|
+
* having an index signature.
|
|
9
|
+
*/
|
|
10
|
+
export interface AnyAction extends Action {
|
|
11
|
+
[extraProps: string]: any;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A *dispatching function* (or simply *dispatch function*) is a function that
|
|
15
|
+
* accepts an action or an async action; it then may or may not dispatch one
|
|
16
|
+
* or more actions to the store.
|
|
17
|
+
*
|
|
18
|
+
* We must distinguish between dispatching functions in general and the base
|
|
19
|
+
* `dispatch` function provided by the store instance without any middleware.
|
|
20
|
+
*
|
|
21
|
+
* The base dispatch function *always* synchronously sends an action to the
|
|
22
|
+
* store's reducer, along with the previous state returned by the store, to
|
|
23
|
+
* calculate a new state. It expects actions to be plain objects ready to be
|
|
24
|
+
* consumed by the reducer.
|
|
25
|
+
*
|
|
26
|
+
* Middleware wraps the base dispatch function. It allows the dispatch
|
|
27
|
+
* function to handle async actions in addition to actions. Middleware may
|
|
28
|
+
* transform, delay, ignore, or otherwise interpret actions or async actions
|
|
29
|
+
* before passing them to the next middleware.
|
|
30
|
+
*
|
|
31
|
+
* @template A The type of things (actions or otherwise) which may be
|
|
32
|
+
* dispatched.
|
|
33
|
+
*/
|
|
34
|
+
export type Dispatch<A extends Action = AnyAction> = <T extends A>(action: T) => T;
|
|
35
|
+
/**
|
|
36
|
+
* A store is an object that holds the application's state tree.
|
|
37
|
+
* There should only be a single store in a Redux app, as the composition
|
|
38
|
+
* happens on the reducer level.
|
|
39
|
+
*
|
|
40
|
+
* @template S The type of state held by this store.
|
|
41
|
+
* @template A the type of actions which may be dispatched by this store.
|
|
42
|
+
*/
|
|
43
|
+
export interface Store<S = any, A extends Action = AnyAction> {
|
|
44
|
+
/**
|
|
45
|
+
* Dispatches an action. It is the only way to trigger a state change.
|
|
46
|
+
*
|
|
47
|
+
* The `reducer` function, used to create the store, will be called with the
|
|
48
|
+
* current state tree and the given `action`. Its return value will be
|
|
49
|
+
* considered the **next** state of the tree, and the change listeners will
|
|
50
|
+
* be notified.
|
|
51
|
+
*
|
|
52
|
+
* The base implementation only supports plain object actions. If you want
|
|
53
|
+
* to dispatch a Promise, an Observable, a thunk, or something else, you
|
|
54
|
+
* need to wrap your store creating function into the corresponding
|
|
55
|
+
* middleware. For example, see the documentation for the `redux-thunk`
|
|
56
|
+
* package. Even the middleware will eventually dispatch plain object
|
|
57
|
+
* actions using this method.
|
|
58
|
+
*
|
|
59
|
+
* @param action A plain object representing “what changed”. It is a good
|
|
60
|
+
* idea to keep actions serializable so you can record and replay user
|
|
61
|
+
* sessions, or use the time travelling `redux-devtools`. An action must
|
|
62
|
+
* have a `type` property which may not be `undefined`. It is a good idea
|
|
63
|
+
* to use string constants for action types.
|
|
64
|
+
*
|
|
65
|
+
* @returns For convenience, the same action object you dispatched.
|
|
66
|
+
*
|
|
67
|
+
* Note that, if you use a custom middleware, it may wrap `dispatch()` to
|
|
68
|
+
* return something else (for example, a Promise you can await).
|
|
69
|
+
*/
|
|
70
|
+
dispatch: Dispatch<A>;
|
|
71
|
+
/**
|
|
72
|
+
* Reads the state tree managed by the store.
|
|
73
|
+
*
|
|
74
|
+
* @returns The current state tree of your application.
|
|
75
|
+
*/
|
|
76
|
+
getState(): S;
|
|
77
|
+
/**
|
|
78
|
+
* Adds a change listener. It will be called any time an action is
|
|
79
|
+
* dispatched, and some part of the state tree may potentially have changed.
|
|
80
|
+
* You may then call `getState()` to read the current state tree inside the
|
|
81
|
+
* callback.
|
|
82
|
+
*
|
|
83
|
+
* You may call `dispatch()` from a change listener, with the following
|
|
84
|
+
* caveats:
|
|
85
|
+
*
|
|
86
|
+
* 1. The subscriptions are snapshotted just before every `dispatch()` call.
|
|
87
|
+
* If you subscribe or unsubscribe while the listeners are being invoked,
|
|
88
|
+
* this will not have any effect on the `dispatch()` that is currently in
|
|
89
|
+
* progress. However, the next `dispatch()` call, whether nested or not,
|
|
90
|
+
* will use a more recent snapshot of the subscription list.
|
|
91
|
+
*
|
|
92
|
+
* 2. The listener should not expect to see all states changes, as the state
|
|
93
|
+
* might have been updated multiple times during a nested `dispatch()` before
|
|
94
|
+
* the listener is called. It is, however, guaranteed that all subscribers
|
|
95
|
+
* registered before the `dispatch()` started will be called with the latest
|
|
96
|
+
* state by the time it exits.
|
|
97
|
+
*
|
|
98
|
+
* @param listener A callback to be invoked on every dispatch.
|
|
99
|
+
* @returns A function to remove this change listener.
|
|
100
|
+
*/
|
|
101
|
+
subscribe(listener: () => void): Unsubscribe;
|
|
102
|
+
/**
|
|
103
|
+
* Replaces the reducer currently used by the store to calculate the state.
|
|
104
|
+
*
|
|
105
|
+
* You might need this if your app implements code splitting and you want to
|
|
106
|
+
* load some of the reducers dynamically. You might also need this if you
|
|
107
|
+
* implement a hot reloading mechanism for Redux.
|
|
108
|
+
*
|
|
109
|
+
* @param nextReducer The reducer for the store to use instead.
|
|
110
|
+
*/
|
|
111
|
+
replaceReducer(nextReducer: Reducer<S, A>): void;
|
|
112
|
+
/**
|
|
113
|
+
* Interoperability point for observable/reactive libraries.
|
|
114
|
+
* @returns {observable} A minimal observable of state changes.
|
|
115
|
+
* For more information, see the observable proposal:
|
|
116
|
+
* https://github.com/tc39/proposal-observable
|
|
117
|
+
*/
|
|
118
|
+
[Symbol.observable](): Observable<S>;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* A minimal observable of state changes.
|
|
122
|
+
* For more information, see the observable proposal:
|
|
123
|
+
* https://github.com/tc39/proposal-observable
|
|
124
|
+
*/
|
|
125
|
+
export type Observable<T> = {
|
|
126
|
+
/**
|
|
127
|
+
* The minimal observable subscription method.
|
|
128
|
+
* @param {Object} observer Any object that can be used as an observer.
|
|
129
|
+
* The observer object should have a `next` method.
|
|
130
|
+
* @returns {subscription} An object with an `unsubscribe` method that can
|
|
131
|
+
* be used to unsubscribe the observable from the store, and prevent further
|
|
132
|
+
* emission of values from the observable.
|
|
133
|
+
*/
|
|
134
|
+
subscribe(observer: Observer<T>): {
|
|
135
|
+
unsubscribe: Unsubscribe;
|
|
136
|
+
};
|
|
137
|
+
[Symbol.observable](): Observable<T>;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* An Observer is used to receive data from an Observable, and is supplied as
|
|
141
|
+
* an argument to subscribe.
|
|
142
|
+
*/
|
|
143
|
+
export type Observer<T> = {
|
|
144
|
+
next?(value: T): void;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* A *reducer* (also called a *reducing function*) is a function that accepts
|
|
148
|
+
* an accumulation and a value and returns a new accumulation. They are used
|
|
149
|
+
* to reduce a collection of values down to a single value
|
|
150
|
+
*
|
|
151
|
+
* Reducers are not unique to Redux—they are a fundamental concept in
|
|
152
|
+
* functional programming. Even most non-functional languages, like
|
|
153
|
+
* JavaScript, have a built-in API for reducing. In JavaScript, it's
|
|
154
|
+
* `Array.prototype.reduce()`.
|
|
155
|
+
*
|
|
156
|
+
* In Redux, the accumulated value is the state object, and the values being
|
|
157
|
+
* accumulated are actions. Reducers calculate a new state given the previous
|
|
158
|
+
* state and an action. They must be *pure functions*—functions that return
|
|
159
|
+
* the exact same output for given inputs. They should also be free of
|
|
160
|
+
* side-effects. This is what enables exciting features like hot reloading and
|
|
161
|
+
* time travel.
|
|
162
|
+
*
|
|
163
|
+
* Reducers are the most important concept in Redux.
|
|
164
|
+
*
|
|
165
|
+
* *Do not put API calls into reducers.*
|
|
166
|
+
*
|
|
167
|
+
* @template S The type of state consumed and produced by this reducer.
|
|
168
|
+
* @template A The type of actions the reducer can potentially respond to.
|
|
169
|
+
*/
|
|
170
|
+
export type Reducer<S = any, A extends Action = AnyAction> = (state: S | undefined, action: A) => S;
|
|
171
|
+
/**
|
|
172
|
+
* Function to remove listener added by `Store.subscribe()`.
|
|
173
|
+
*/
|
|
174
|
+
export type Unsubscribe = () => void;
|
package/lib/util/uischema.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { UISchemaElement } from '../models';
|
|
2
|
-
export type IterateCallback = (uischema: UISchemaElement) => void;
|
|
3
|
-
export declare const setReadonly: (uischema: UISchemaElement) => void;
|
|
4
|
-
export declare const unsetReadonly: (uischema: UISchemaElement) => void;
|
|
5
|
-
export declare const iterateSchema: (uischema: UISchemaElement, toApply: IterateCallback) => void;
|
|
6
|
-
/**
|
|
7
|
-
* Transform a dotted path to a uiSchema properties path
|
|
8
|
-
* @param path a dotted prop path to a schema value (i.e. articles.comment.author)
|
|
9
|
-
* @return the uiSchema properties path (i.e. /properties/articles/properties/comment/properties/author)
|
|
10
|
-
*/
|
|
11
|
-
export declare const getPropPath: (path: string) => string;
|
|
12
|
-
/**
|
|
13
|
-
* Find a control in a uiSchema, based on the dotted path of the schema value
|
|
14
|
-
* @param {UISchemaElement} uiSchema the uiSchema to search from
|
|
15
|
-
* @param path a dotted prop path to a schema value (i.e. articles.comment.author)
|
|
16
|
-
* @return {UISchemaElement} or undefined if not found
|
|
17
|
-
*/
|
|
18
|
-
export declare const findUiControl: (uiSchema: UISchemaElement, path: string) => UISchemaElement | undefined;
|
|
1
|
+
import { UISchemaElement } from '../models';
|
|
2
|
+
export type IterateCallback = (uischema: UISchemaElement) => void;
|
|
3
|
+
export declare const setReadonly: (uischema: UISchemaElement) => void;
|
|
4
|
+
export declare const unsetReadonly: (uischema: UISchemaElement) => void;
|
|
5
|
+
export declare const iterateSchema: (uischema: UISchemaElement, toApply: IterateCallback) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Transform a dotted path to a uiSchema properties path
|
|
8
|
+
* @param path a dotted prop path to a schema value (i.e. articles.comment.author)
|
|
9
|
+
* @return the uiSchema properties path (i.e. /properties/articles/properties/comment/properties/author)
|
|
10
|
+
*/
|
|
11
|
+
export declare const getPropPath: (path: string) => string;
|
|
12
|
+
/**
|
|
13
|
+
* Find a control in a uiSchema, based on the dotted path of the schema value
|
|
14
|
+
* @param {UISchemaElement} uiSchema the uiSchema to search from
|
|
15
|
+
* @param path a dotted prop path to a schema value (i.e. articles.comment.author)
|
|
16
|
+
* @return {UISchemaElement} or undefined if not found
|
|
17
|
+
*/
|
|
18
|
+
export declare const findUiControl: (uiSchema: UISchemaElement, path: string) => UISchemaElement | undefined;
|
package/lib/util/util.d.ts
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import type { JsonSchema, Scoped, UISchemaElement } from '..';
|
|
2
|
-
import type Ajv from 'ajv';
|
|
3
|
-
/**
|
|
4
|
-
* Returns the string representation of the given date. The format of the output string can be specified:
|
|
5
|
-
* - 'date' for a date-only string (YYYY-MM-DD),
|
|
6
|
-
* - 'time' for a time-only string (HH:mm:ss), or
|
|
7
|
-
* - 'date-time' for a full date-time string in ISO format (YYYY-MM-DDTHH:mm:ss.sssZ).
|
|
8
|
-
* If no format is specified, the full date-time ISO string is returned by default.
|
|
9
|
-
*
|
|
10
|
-
* @returns {string} A string representation of the date in the specified format.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* // returns '2023-11-09'
|
|
14
|
-
* convertDateToString(new Date('2023-11-09T14:22:54.131Z'), 'date');
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* // returns '14:22:54'
|
|
18
|
-
* convertDateToString(new Date('2023-11-09T14:22:54.131Z'), 'time');
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* // returns '2023-11-09T14:22:54.131Z'
|
|
22
|
-
* convertDateToString(new Date('2023-11-09T14:22:54.131Z'), 'date-time');
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* // returns '2023-11-09T14:22:54.131Z'
|
|
26
|
-
* convertDateToString(new Date('2023-11-09T14:22:54.131Z'));
|
|
27
|
-
*/
|
|
28
|
-
export declare const convertDateToString: (date: Date, format?: 'date' | 'time' | 'date-time') => string;
|
|
29
|
-
/**
|
|
30
|
-
* Escape the given string such that it can be used as a class name,
|
|
31
|
-
* i.e. hashes and slashes will be replaced.
|
|
32
|
-
*
|
|
33
|
-
* @param {string} s the string that should be converted to a valid class name
|
|
34
|
-
* @returns {string} the escaped string
|
|
35
|
-
*/
|
|
36
|
-
export declare const convertToValidClassName: (s: string) => string;
|
|
37
|
-
export declare const formatErrorMessage: (errors: string[]) => string;
|
|
38
|
-
export declare const hasType: (jsonSchema: JsonSchema, expected: string) => boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Derives the type of the jsonSchema element
|
|
41
|
-
*/
|
|
42
|
-
export declare const deriveTypes: (jsonSchema: JsonSchema) => string[];
|
|
43
|
-
/**
|
|
44
|
-
* Convenience wrapper around resolveData and resolveSchema.
|
|
45
|
-
*/
|
|
46
|
-
export declare const Resolve: {
|
|
47
|
-
schema(schema: JsonSchema, schemaPath: string, rootSchema: JsonSchema): JsonSchema;
|
|
48
|
-
data(data: any, path: string): any;
|
|
49
|
-
};
|
|
50
|
-
export declare const Paths: {
|
|
51
|
-
compose: (path1: string, path2: string) => string;
|
|
52
|
-
fromScoped: (scopable: Scoped) => string;
|
|
53
|
-
};
|
|
54
|
-
export declare const Runtime: {
|
|
55
|
-
isEnabled(uischema: UISchemaElement, data: any, ajv: Ajv): boolean;
|
|
56
|
-
isVisible(uischema: UISchemaElement, data: any, ajv: Ajv): boolean;
|
|
57
|
-
};
|
|
1
|
+
import type { JsonSchema, Scoped, UISchemaElement } from '..';
|
|
2
|
+
import type Ajv from 'ajv';
|
|
3
|
+
/**
|
|
4
|
+
* Returns the string representation of the given date. The format of the output string can be specified:
|
|
5
|
+
* - 'date' for a date-only string (YYYY-MM-DD),
|
|
6
|
+
* - 'time' for a time-only string (HH:mm:ss), or
|
|
7
|
+
* - 'date-time' for a full date-time string in ISO format (YYYY-MM-DDTHH:mm:ss.sssZ).
|
|
8
|
+
* If no format is specified, the full date-time ISO string is returned by default.
|
|
9
|
+
*
|
|
10
|
+
* @returns {string} A string representation of the date in the specified format.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // returns '2023-11-09'
|
|
14
|
+
* convertDateToString(new Date('2023-11-09T14:22:54.131Z'), 'date');
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // returns '14:22:54'
|
|
18
|
+
* convertDateToString(new Date('2023-11-09T14:22:54.131Z'), 'time');
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // returns '2023-11-09T14:22:54.131Z'
|
|
22
|
+
* convertDateToString(new Date('2023-11-09T14:22:54.131Z'), 'date-time');
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // returns '2023-11-09T14:22:54.131Z'
|
|
26
|
+
* convertDateToString(new Date('2023-11-09T14:22:54.131Z'));
|
|
27
|
+
*/
|
|
28
|
+
export declare const convertDateToString: (date: Date, format?: 'date' | 'time' | 'date-time') => string;
|
|
29
|
+
/**
|
|
30
|
+
* Escape the given string such that it can be used as a class name,
|
|
31
|
+
* i.e. hashes and slashes will be replaced.
|
|
32
|
+
*
|
|
33
|
+
* @param {string} s the string that should be converted to a valid class name
|
|
34
|
+
* @returns {string} the escaped string
|
|
35
|
+
*/
|
|
36
|
+
export declare const convertToValidClassName: (s: string) => string;
|
|
37
|
+
export declare const formatErrorMessage: (errors: string[]) => string;
|
|
38
|
+
export declare const hasType: (jsonSchema: JsonSchema, expected: string) => boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Derives the type of the jsonSchema element
|
|
41
|
+
*/
|
|
42
|
+
export declare const deriveTypes: (jsonSchema: JsonSchema) => string[];
|
|
43
|
+
/**
|
|
44
|
+
* Convenience wrapper around resolveData and resolveSchema.
|
|
45
|
+
*/
|
|
46
|
+
export declare const Resolve: {
|
|
47
|
+
schema(schema: JsonSchema, schemaPath: string, rootSchema: JsonSchema): JsonSchema;
|
|
48
|
+
data(data: any, path: string): any;
|
|
49
|
+
};
|
|
50
|
+
export declare const Paths: {
|
|
51
|
+
compose: (path1: string, path2: string) => string;
|
|
52
|
+
fromScoped: (scopable: Scoped) => string;
|
|
53
|
+
};
|
|
54
|
+
export declare const Runtime: {
|
|
55
|
+
isEnabled(uischema: UISchemaElement, data: any, ajv: Ajv): boolean;
|
|
56
|
+
isVisible(uischema: UISchemaElement, data: any, ajv: Ajv): boolean;
|
|
57
|
+
};
|
package/lib/util/validator.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import Ajv from 'ajv';
|
|
2
|
-
import type { Options } from 'ajv';
|
|
3
|
-
export declare const createAjv: (options?: Options) => Ajv;
|
|
1
|
+
import Ajv from 'ajv';
|
|
2
|
+
import type { Options } from 'ajv';
|
|
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.3.0
|
|
3
|
+
"version": "3.3.0",
|
|
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,7 +86,7 @@
|
|
|
86
86
|
"ts-node": "^10.4.0",
|
|
87
87
|
"tslib": "^2.5.0",
|
|
88
88
|
"typedoc": "~0.25.3",
|
|
89
|
-
"typescript": "~
|
|
89
|
+
"typescript": "~5.2.2"
|
|
90
90
|
},
|
|
91
91
|
"scripts": {
|
|
92
92
|
"build": "rollup -c rollup.config.js",
|