@jsonforms/core 3.5.1 → 3.6.0-alpha.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.
@@ -75,7 +75,7 @@ export declare enum RuleEffect {
75
75
  /**
76
76
  * Represents a condition to be evaluated.
77
77
  */
78
- export interface Condition {
78
+ export interface BaseCondition {
79
79
  /**
80
80
  * The type of condition.
81
81
  */
@@ -84,14 +84,14 @@ export interface Condition {
84
84
  /**
85
85
  * A leaf condition.
86
86
  */
87
- export interface LeafCondition extends Condition, Scoped {
87
+ export interface LeafCondition extends BaseCondition, Scoped {
88
88
  type: 'LEAF';
89
89
  /**
90
90
  * The expected value when evaluating the condition
91
91
  */
92
92
  expectedValue: any;
93
93
  }
94
- export interface SchemaBasedCondition extends Condition, Scoped {
94
+ export interface SchemaBasedCondition extends BaseCondition, Scoped {
95
95
  schema: JsonSchema;
96
96
  /**
97
97
  * When the scope resolves to undefined and `failWhenUndefined` is set to `true`, the condition
@@ -109,7 +109,7 @@ export interface SchemaBasedCondition extends Condition, Scoped {
109
109
  /**
110
110
  * A composable condition.
111
111
  */
112
- export interface ComposableCondition extends Condition {
112
+ export interface ComposableCondition extends BaseCondition {
113
113
  conditions: Condition[];
114
114
  }
115
115
  /**
@@ -124,10 +124,14 @@ export interface OrCondition extends ComposableCondition {
124
124
  export interface AndCondition extends ComposableCondition {
125
125
  type: 'AND';
126
126
  }
127
+ /**
128
+ * A union of all available conditions.
129
+ */
130
+ export type Condition = BaseCondition | LeafCondition | OrCondition | AndCondition | SchemaBasedCondition;
127
131
  /**
128
132
  * Common base interface for any UI schema element.
129
133
  */
130
- export interface UISchemaElement {
134
+ export interface BaseUISchemaElement {
131
135
  /**
132
136
  * The type of this UI schema element.
133
137
  */
@@ -147,7 +151,7 @@ export interface UISchemaElement {
147
151
  * Represents a layout element which can order its children
148
152
  * in a specific way.
149
153
  */
150
- export interface Layout extends UISchemaElement {
154
+ export interface Layout extends BaseUISchemaElement {
151
155
  /**
152
156
  * The child elements of this layout.
153
157
  */
@@ -188,7 +192,7 @@ export interface LabelDescription {
188
192
  /**
189
193
  * A label element.
190
194
  */
191
- export interface LabelElement extends UISchemaElement, Internationalizable {
195
+ export interface LabelElement extends BaseUISchemaElement, Internationalizable {
192
196
  type: 'Label';
193
197
  /**
194
198
  * The text of label.
@@ -199,7 +203,7 @@ export interface LabelElement extends UISchemaElement, Internationalizable {
199
203
  * A control element. The scope property of the control determines
200
204
  * to which part of the schema the control should be bound.
201
205
  */
202
- export interface ControlElement extends UISchemaElement, Scoped, Labelable<string | boolean | LabelDescription>, Internationalizable {
206
+ export interface ControlElement extends BaseUISchemaElement, Scoped, Labelable<string | boolean | LabelDescription>, Internationalizable {
203
207
  type: 'Control';
204
208
  }
205
209
  /**
@@ -213,7 +217,7 @@ export interface Category extends Layout, Labeled, Internationalizable {
213
217
  * A child element may either be itself a Categorization or a Category, hence
214
218
  * the categorization element can be used to represent recursive structures like trees.
215
219
  */
216
- export interface Categorization extends UISchemaElement, Labeled, Internationalizable {
220
+ export interface Categorization extends BaseUISchemaElement, Labeled, Internationalizable {
217
221
  type: 'Categorization';
218
222
  /**
219
223
  * The child elements of this categorization which are either of type
@@ -221,3 +225,9 @@ export interface Categorization extends UISchemaElement, Labeled, Internationali
221
225
  */
222
226
  elements: (Category | Categorization)[];
223
227
  }
228
+ /**
229
+ * A union of all available UI schema elements.
230
+ * This includes all layout elements, control elements, label elements,
231
+ * group elements, category elements and categorization elements.
232
+ */
233
+ export type UISchemaElement = BaseUISchemaElement | ControlElement | Layout | LabelElement | GroupLayout | Category | Categorization | VerticalLayout | HorizontalLayout;
@@ -1,6 +1,7 @@
1
1
  import { CoreActions, InitAction, UpdateCoreAction } from '../actions';
2
2
  import { JsonFormsCore, Reducer, ValidationMode } from '../store';
3
- import Ajv, { ErrorObject } from 'ajv';
3
+ import type Ajv from 'ajv';
4
+ import type { ErrorObject } from 'ajv';
4
5
  export declare const initState: JsonFormsCore;
5
6
  export declare const getValidationMode: (state: JsonFormsCore, action?: InitAction | UpdateCoreAction) => ValidationMode;
6
7
  export declare const getAdditionalErrors: (state: JsonFormsCore, action?: InitAction | UpdateCoreAction) => ErrorObject[];
@@ -1,4 +1,5 @@
1
- import Ajv, { ErrorObject } from 'ajv';
1
+ import type Ajv from 'ajv';
2
+ import type { ErrorObject } from 'ajv';
2
3
  import { JsonSchema, UISchemaElement } from '../models';
3
4
  import { JsonFormsCellRendererRegistryEntry, JsonFormsCore, JsonFormsRendererRegistryEntry, JsonFormsState, JsonFormsUISchemaRegistryEntry } from './store';
4
5
  export declare const errorAt: (instancePath: string, schema: JsonSchema) => (state: JsonFormsCore) => ErrorObject[];
@@ -1,7 +1,8 @@
1
1
  import type { Store } from './type';
2
2
  import { RankedTester, UISchemaTester } from '../testers';
3
3
  import { JsonSchema, UISchemaElement } from '../models';
4
- import Ajv, { ErrorObject, ValidateFunction } from 'ajv';
4
+ import type Ajv from 'ajv';
5
+ import type { ErrorObject, ValidateFunction } from 'ajv';
5
6
  import { JsonFormsI18nState } from './i18nTypes';
6
7
  /**
7
8
  * JSONForms store.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsonforms/core",
3
- "version": "3.5.1",
3
+ "version": "3.6.0-alpha.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",
@@ -1,19 +1,19 @@
1
1
  /*
2
2
  The MIT License
3
-
3
+
4
4
  Copyright (c) 2017-2019 EclipseSource Munich
5
5
  https://github.com/eclipsesource/jsonforms
6
-
6
+
7
7
  Permission is hereby granted, free of charge, to any person obtaining a copy
8
8
  of this software and associated documentation files (the "Software"), to deal
9
9
  in the Software without restriction, including without limitation the rights
10
10
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
11
  copies of the Software, and to permit persons to whom the Software is
12
12
  furnished to do so, subject to the following conditions:
13
-
13
+
14
14
  The above copyright notice and this permission notice shall be included in
15
15
  all copies or substantial portions of the Software.
16
-
16
+
17
17
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
18
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
19
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -114,7 +114,7 @@ export enum RuleEffect {
114
114
  /**
115
115
  * Represents a condition to be evaluated.
116
116
  */
117
- export interface Condition {
117
+ export interface BaseCondition {
118
118
  /**
119
119
  * The type of condition.
120
120
  */
@@ -124,7 +124,7 @@ export interface Condition {
124
124
  /**
125
125
  * A leaf condition.
126
126
  */
127
- export interface LeafCondition extends Condition, Scoped {
127
+ export interface LeafCondition extends BaseCondition, Scoped {
128
128
  type: 'LEAF';
129
129
 
130
130
  /**
@@ -133,7 +133,7 @@ export interface LeafCondition extends Condition, Scoped {
133
133
  expectedValue: any;
134
134
  }
135
135
 
136
- export interface SchemaBasedCondition extends Condition, Scoped {
136
+ export interface SchemaBasedCondition extends BaseCondition, Scoped {
137
137
  schema: JsonSchema;
138
138
 
139
139
  /**
@@ -153,7 +153,7 @@ export interface SchemaBasedCondition extends Condition, Scoped {
153
153
  /**
154
154
  * A composable condition.
155
155
  */
156
- export interface ComposableCondition extends Condition {
156
+ export interface ComposableCondition extends BaseCondition {
157
157
  conditions: Condition[];
158
158
  }
159
159
 
@@ -171,10 +171,20 @@ export interface AndCondition extends ComposableCondition {
171
171
  type: 'AND';
172
172
  }
173
173
 
174
+ /**
175
+ * A union of all available conditions.
176
+ */
177
+ export type Condition =
178
+ | BaseCondition
179
+ | LeafCondition
180
+ | OrCondition
181
+ | AndCondition
182
+ | SchemaBasedCondition;
183
+
174
184
  /**
175
185
  * Common base interface for any UI schema element.
176
186
  */
177
- export interface UISchemaElement {
187
+ export interface BaseUISchemaElement {
178
188
  /**
179
189
  * The type of this UI schema element.
180
190
  */
@@ -195,7 +205,7 @@ export interface UISchemaElement {
195
205
  * Represents a layout element which can order its children
196
206
  * in a specific way.
197
207
  */
198
- export interface Layout extends UISchemaElement {
208
+ export interface Layout extends BaseUISchemaElement {
199
209
  /**
200
210
  * The child elements of this layout.
201
211
  */
@@ -241,7 +251,7 @@ export interface LabelDescription {
241
251
  /**
242
252
  * A label element.
243
253
  */
244
- export interface LabelElement extends UISchemaElement, Internationalizable {
254
+ export interface LabelElement extends BaseUISchemaElement, Internationalizable {
245
255
  type: 'Label';
246
256
  /**
247
257
  * The text of label.
@@ -254,7 +264,7 @@ export interface LabelElement extends UISchemaElement, Internationalizable {
254
264
  * to which part of the schema the control should be bound.
255
265
  */
256
266
  export interface ControlElement
257
- extends UISchemaElement,
267
+ extends BaseUISchemaElement,
258
268
  Scoped,
259
269
  Labelable<string | boolean | LabelDescription>,
260
270
  Internationalizable {
@@ -274,7 +284,7 @@ export interface Category extends Layout, Labeled, Internationalizable {
274
284
  * the categorization element can be used to represent recursive structures like trees.
275
285
  */
276
286
  export interface Categorization
277
- extends UISchemaElement,
287
+ extends BaseUISchemaElement,
278
288
  Labeled,
279
289
  Internationalizable {
280
290
  type: 'Categorization';
@@ -284,3 +294,19 @@ export interface Categorization
284
294
  */
285
295
  elements: (Category | Categorization)[];
286
296
  }
297
+
298
+ /**
299
+ * A union of all available UI schema elements.
300
+ * This includes all layout elements, control elements, label elements,
301
+ * group elements, category elements and categorization elements.
302
+ */
303
+ export type UISchemaElement =
304
+ | BaseUISchemaElement
305
+ | ControlElement
306
+ | Layout
307
+ | LabelElement
308
+ | GroupLayout
309
+ | Category
310
+ | Categorization
311
+ | VerticalLayout
312
+ | HorizontalLayout;
@@ -43,7 +43,8 @@ import {
43
43
  UpdateCoreAction,
44
44
  } from '../actions';
45
45
  import { JsonFormsCore, Reducer, ValidationMode } from '../store';
46
- import Ajv, { ErrorObject } from 'ajv';
46
+ import type Ajv from 'ajv';
47
+ import type { ErrorObject } from 'ajv';
47
48
  import isFunction from 'lodash/isFunction';
48
49
  import { createAjv, validate } from '../util';
49
50
 
@@ -1,4 +1,5 @@
1
- import Ajv, { ErrorObject } from 'ajv';
1
+ import type Ajv from 'ajv';
2
+ import type { ErrorObject } from 'ajv';
2
3
  import { JsonSchema, UISchemaElement } from '../models';
3
4
  import get from 'lodash/get';
4
5
  import { errorsAt } from '../util';
@@ -26,7 +26,8 @@
26
26
  import type { Store } from './type';
27
27
  import { RankedTester, UISchemaTester } from '../testers';
28
28
  import { JsonSchema, UISchemaElement } from '../models';
29
- import Ajv, { ErrorObject, ValidateFunction } from 'ajv';
29
+ import type Ajv from 'ajv';
30
+ import type { ErrorObject, ValidateFunction } from 'ajv';
30
31
  import { JsonFormsI18nState } from './i18nTypes';
31
32
 
32
33
  /**