@jsonforms/core 3.1.0-alpha.1 → 3.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/lib/actions/actions.d.ts +21 -21
- package/lib/i18n/arrayTranslations.d.ts +24 -0
- package/lib/i18n/i18nUtil.d.ts +3 -0
- package/lib/i18n/index.d.ts +1 -0
- package/lib/jsonforms-core.cjs.js +436 -262
- package/lib/jsonforms-core.cjs.js.map +1 -1
- package/lib/jsonforms-core.esm.js +318 -201
- package/lib/jsonforms-core.esm.js.map +1 -1
- package/lib/util/cell.d.ts +0 -1
- package/lib/util/renderer.d.ts +6 -2
- package/lib/util/schema.d.ts +5 -0
- package/package.json +11 -4
- package/src/Helpers.ts +1 -1
- package/src/actions/actions.ts +52 -55
- package/src/configDefault.ts +1 -1
- package/src/generators/Generate.ts +3 -1
- package/src/generators/schema.ts +29 -25
- package/src/generators/uischema.ts +7 -6
- package/src/i18n/arrayTranslations.ts +54 -0
- package/src/i18n/i18nTypes.ts +10 -6
- package/src/i18n/i18nUtil.ts +64 -14
- package/src/i18n/index.ts +1 -0
- package/src/models/draft4.ts +33 -33
- package/src/models/uischema.ts +17 -6
- package/src/reducers/cells.ts +8 -7
- package/src/reducers/core.ts +119 -75
- package/src/reducers/default-data.ts +7 -7
- package/src/reducers/i18n.ts +21 -9
- package/src/reducers/reducers.ts +20 -30
- package/src/reducers/renderers.ts +7 -7
- package/src/reducers/selectors.ts +4 -5
- package/src/reducers/uischemas.ts +25 -24
- package/src/store.ts +1 -1
- package/src/testers/testers.ts +202 -148
- package/src/util/cell.ts +24 -26
- package/src/util/combinators.ts +5 -3
- package/src/util/label.ts +1 -1
- package/src/util/path.ts +11 -7
- package/src/util/renderer.ts +118 -67
- package/src/util/resolvers.ts +15 -13
- package/src/util/runtime.ts +2 -2
- package/src/util/schema.ts +10 -1
- package/src/util/type.ts +5 -3
- package/src/util/uischema.ts +9 -9
- package/src/util/util.ts +52 -52
- package/src/util/validator.ts +1 -1
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var isEmpty = require('lodash/isEmpty');
|
|
6
6
|
var startCase = require('lodash/startCase');
|
|
7
7
|
var keys = require('lodash/keys');
|
|
8
|
-
var union = require('lodash/union');
|
|
9
8
|
var merge = require('lodash/merge');
|
|
10
9
|
var cloneDeep = require('lodash/cloneDeep');
|
|
11
10
|
var setFp = require('lodash/fp/set');
|
|
@@ -32,7 +31,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
32
31
|
var isEmpty__default = /*#__PURE__*/_interopDefaultLegacy(isEmpty);
|
|
33
32
|
var startCase__default = /*#__PURE__*/_interopDefaultLegacy(startCase);
|
|
34
33
|
var keys__default = /*#__PURE__*/_interopDefaultLegacy(keys);
|
|
35
|
-
var union__default = /*#__PURE__*/_interopDefaultLegacy(union);
|
|
36
34
|
var merge__default = /*#__PURE__*/_interopDefaultLegacy(merge);
|
|
37
35
|
var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
|
|
38
36
|
var setFp__default = /*#__PURE__*/_interopDefaultLegacy(setFp);
|
|
@@ -78,7 +76,7 @@ var Gen = (function () {
|
|
|
78
76
|
var schema = {
|
|
79
77
|
type: 'object',
|
|
80
78
|
properties: props,
|
|
81
|
-
additionalProperties: _this.findOption(props)(ADDITIONAL_PROPERTIES)
|
|
79
|
+
additionalProperties: _this.findOption(props)(ADDITIONAL_PROPERTIES),
|
|
82
80
|
};
|
|
83
81
|
var required = _this.findOption(props)(REQUIRED_PROPERTIES);
|
|
84
82
|
if (required.length > 0) {
|
|
@@ -130,46 +128,49 @@ var Gen = (function () {
|
|
|
130
128
|
if (uniqueProperties.length === 1) {
|
|
131
129
|
return {
|
|
132
130
|
type: 'array',
|
|
133
|
-
items: uniqueProperties[0]
|
|
131
|
+
items: uniqueProperties[0],
|
|
134
132
|
};
|
|
135
133
|
}
|
|
136
134
|
else {
|
|
137
135
|
return {
|
|
138
136
|
type: 'array',
|
|
139
137
|
items: {
|
|
140
|
-
oneOf: uniqueProperties
|
|
141
|
-
}
|
|
138
|
+
oneOf: uniqueProperties,
|
|
139
|
+
},
|
|
142
140
|
};
|
|
143
141
|
}
|
|
144
142
|
}
|
|
145
143
|
else {
|
|
146
144
|
return {
|
|
147
145
|
type: 'array',
|
|
148
|
-
items: {}
|
|
146
|
+
items: {},
|
|
149
147
|
};
|
|
150
148
|
}
|
|
151
149
|
};
|
|
152
150
|
}
|
|
153
151
|
return Gen;
|
|
154
152
|
}());
|
|
155
|
-
var generateJsonSchema = function (
|
|
153
|
+
var generateJsonSchema = function (
|
|
154
|
+
instance, options) {
|
|
156
155
|
if (options === void 0) { options = {}; }
|
|
157
|
-
var findOption = function (props) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
156
|
+
var findOption = function (props) {
|
|
157
|
+
return function (optionName) {
|
|
158
|
+
switch (optionName) {
|
|
159
|
+
case ADDITIONAL_PROPERTIES:
|
|
160
|
+
if (options.hasOwnProperty(ADDITIONAL_PROPERTIES)) {
|
|
161
|
+
return options[ADDITIONAL_PROPERTIES];
|
|
162
|
+
}
|
|
163
|
+
return true;
|
|
164
|
+
case REQUIRED_PROPERTIES:
|
|
165
|
+
if (options.hasOwnProperty(REQUIRED_PROPERTIES)) {
|
|
166
|
+
return options[REQUIRED_PROPERTIES](props);
|
|
167
|
+
}
|
|
168
|
+
return Object.keys(props);
|
|
169
|
+
default:
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
};
|
|
173
174
|
var gen = new Gen(findOption);
|
|
174
175
|
return gen.schemaObject(instance);
|
|
175
176
|
};
|
|
@@ -182,14 +183,14 @@ var Draft4 = {
|
|
|
182
183
|
schemaArray: {
|
|
183
184
|
type: 'array',
|
|
184
185
|
minItems: 1,
|
|
185
|
-
items: { $ref: '#' }
|
|
186
|
+
items: { $ref: '#' },
|
|
186
187
|
},
|
|
187
188
|
positiveInteger: {
|
|
188
189
|
type: 'integer',
|
|
189
|
-
minimum: 0
|
|
190
|
+
minimum: 0,
|
|
190
191
|
},
|
|
191
192
|
positiveIntegerDefault0: {
|
|
192
|
-
allOf: [{ $ref: '#/definitions/positiveInteger' }, { default: 0 }]
|
|
193
|
+
allOf: [{ $ref: '#/definitions/positiveInteger' }, { default: 0 }],
|
|
193
194
|
},
|
|
194
195
|
simpleTypes: {
|
|
195
196
|
enum: [
|
|
@@ -199,104 +200,104 @@ var Draft4 = {
|
|
|
199
200
|
'null',
|
|
200
201
|
'number',
|
|
201
202
|
'object',
|
|
202
|
-
'string'
|
|
203
|
-
]
|
|
203
|
+
'string',
|
|
204
|
+
],
|
|
204
205
|
},
|
|
205
206
|
stringArray: {
|
|
206
207
|
type: 'array',
|
|
207
208
|
items: { type: 'string' },
|
|
208
209
|
minItems: 1,
|
|
209
|
-
uniqueItems: true
|
|
210
|
-
}
|
|
210
|
+
uniqueItems: true,
|
|
211
|
+
},
|
|
211
212
|
},
|
|
212
213
|
type: 'object',
|
|
213
214
|
properties: {
|
|
214
215
|
id: {
|
|
215
216
|
type: 'string',
|
|
216
|
-
format: 'uri'
|
|
217
|
+
format: 'uri',
|
|
217
218
|
},
|
|
218
219
|
$schema: {
|
|
219
220
|
type: 'string',
|
|
220
|
-
format: 'uri'
|
|
221
|
+
format: 'uri',
|
|
221
222
|
},
|
|
222
223
|
title: {
|
|
223
|
-
type: 'string'
|
|
224
|
+
type: 'string',
|
|
224
225
|
},
|
|
225
226
|
description: {
|
|
226
|
-
type: 'string'
|
|
227
|
+
type: 'string',
|
|
227
228
|
},
|
|
228
229
|
default: {},
|
|
229
230
|
multipleOf: {
|
|
230
231
|
type: 'number',
|
|
231
232
|
minimum: 0,
|
|
232
|
-
exclusiveMinimum: true
|
|
233
|
+
exclusiveMinimum: true,
|
|
233
234
|
},
|
|
234
235
|
maximum: {
|
|
235
|
-
type: 'number'
|
|
236
|
+
type: 'number',
|
|
236
237
|
},
|
|
237
238
|
exclusiveMaximum: {
|
|
238
239
|
type: 'boolean',
|
|
239
|
-
default: false
|
|
240
|
+
default: false,
|
|
240
241
|
},
|
|
241
242
|
minimum: {
|
|
242
|
-
type: 'number'
|
|
243
|
+
type: 'number',
|
|
243
244
|
},
|
|
244
245
|
exclusiveMinimum: {
|
|
245
246
|
type: 'boolean',
|
|
246
|
-
default: false
|
|
247
|
+
default: false,
|
|
247
248
|
},
|
|
248
249
|
maxLength: { $ref: '#/definitions/positiveInteger' },
|
|
249
250
|
minLength: { $ref: '#/definitions/positiveIntegerDefault0' },
|
|
250
251
|
pattern: {
|
|
251
252
|
type: 'string',
|
|
252
|
-
format: 'regex'
|
|
253
|
+
format: 'regex',
|
|
253
254
|
},
|
|
254
255
|
additionalItems: {
|
|
255
256
|
anyOf: [{ type: 'boolean' }, { $ref: '#' }],
|
|
256
|
-
default: {}
|
|
257
|
+
default: {},
|
|
257
258
|
},
|
|
258
259
|
items: {
|
|
259
260
|
anyOf: [{ $ref: '#' }, { $ref: '#/definitions/schemaArray' }],
|
|
260
|
-
default: {}
|
|
261
|
+
default: {},
|
|
261
262
|
},
|
|
262
263
|
maxItems: { $ref: '#/definitions/positiveInteger' },
|
|
263
264
|
minItems: { $ref: '#/definitions/positiveIntegerDefault0' },
|
|
264
265
|
uniqueItems: {
|
|
265
266
|
type: 'boolean',
|
|
266
|
-
default: false
|
|
267
|
+
default: false,
|
|
267
268
|
},
|
|
268
269
|
maxProperties: { $ref: '#/definitions/positiveInteger' },
|
|
269
270
|
minProperties: { $ref: '#/definitions/positiveIntegerDefault0' },
|
|
270
271
|
required: { $ref: '#/definitions/stringArray' },
|
|
271
272
|
additionalProperties: {
|
|
272
273
|
anyOf: [{ type: 'boolean' }, { $ref: '#' }],
|
|
273
|
-
default: {}
|
|
274
|
+
default: {},
|
|
274
275
|
},
|
|
275
276
|
definitions: {
|
|
276
277
|
type: 'object',
|
|
277
278
|
additionalProperties: { $ref: '#' },
|
|
278
|
-
default: {}
|
|
279
|
+
default: {},
|
|
279
280
|
},
|
|
280
281
|
properties: {
|
|
281
282
|
type: 'object',
|
|
282
283
|
additionalProperties: { $ref: '#' },
|
|
283
|
-
default: {}
|
|
284
|
+
default: {},
|
|
284
285
|
},
|
|
285
286
|
patternProperties: {
|
|
286
287
|
type: 'object',
|
|
287
288
|
additionalProperties: { $ref: '#' },
|
|
288
|
-
default: {}
|
|
289
|
+
default: {},
|
|
289
290
|
},
|
|
290
291
|
dependencies: {
|
|
291
292
|
type: 'object',
|
|
292
293
|
additionalProperties: {
|
|
293
|
-
anyOf: [{ $ref: '#' }, { $ref: '#/definitions/stringArray' }]
|
|
294
|
-
}
|
|
294
|
+
anyOf: [{ $ref: '#' }, { $ref: '#/definitions/stringArray' }],
|
|
295
|
+
},
|
|
295
296
|
},
|
|
296
297
|
enum: {
|
|
297
298
|
type: 'array',
|
|
298
299
|
minItems: 1,
|
|
299
|
-
uniqueItems: true
|
|
300
|
+
uniqueItems: true,
|
|
300
301
|
},
|
|
301
302
|
type: {
|
|
302
303
|
anyOf: [
|
|
@@ -305,20 +306,20 @@ var Draft4 = {
|
|
|
305
306
|
type: 'array',
|
|
306
307
|
items: { $ref: '#/definitions/simpleTypes' },
|
|
307
308
|
minItems: 1,
|
|
308
|
-
uniqueItems: true
|
|
309
|
-
}
|
|
310
|
-
]
|
|
309
|
+
uniqueItems: true,
|
|
310
|
+
},
|
|
311
|
+
],
|
|
311
312
|
},
|
|
312
313
|
allOf: { $ref: '#/definitions/schemaArray' },
|
|
313
314
|
anyOf: { $ref: '#/definitions/schemaArray' },
|
|
314
315
|
oneOf: { $ref: '#/definitions/schemaArray' },
|
|
315
|
-
not: { $ref: '#' }
|
|
316
|
+
not: { $ref: '#' },
|
|
316
317
|
},
|
|
317
318
|
dependencies: {
|
|
318
319
|
exclusiveMaximum: ['maximum'],
|
|
319
|
-
exclusiveMinimum: ['minimum']
|
|
320
|
+
exclusiveMinimum: ['minimum'],
|
|
320
321
|
},
|
|
321
|
-
default: {}
|
|
322
|
+
default: {},
|
|
322
323
|
};
|
|
323
324
|
|
|
324
325
|
exports.RuleEffect = void 0;
|
|
@@ -329,7 +330,9 @@ exports.RuleEffect = void 0;
|
|
|
329
330
|
RuleEffect["DISABLE"] = "DISABLE";
|
|
330
331
|
})(exports.RuleEffect || (exports.RuleEffect = {}));
|
|
331
332
|
var isInternationalized = function (element) {
|
|
332
|
-
return typeof element === 'object' &&
|
|
333
|
+
return typeof element === 'object' &&
|
|
334
|
+
element !== null &&
|
|
335
|
+
typeof element.i18n === 'string';
|
|
333
336
|
};
|
|
334
337
|
var isGroup = function (layout) {
|
|
335
338
|
return layout.type === 'Group';
|
|
@@ -430,7 +433,7 @@ var configDefault = {
|
|
|
430
433
|
restrict: false,
|
|
431
434
|
trim: false,
|
|
432
435
|
showUnfocusedDescription: false,
|
|
433
|
-
hideRequiredAsterisk: false
|
|
436
|
+
hideRequiredAsterisk: false,
|
|
434
437
|
};
|
|
435
438
|
|
|
436
439
|
var applyDefaultConfiguration = function (config) {
|
|
@@ -465,7 +468,7 @@ var initState = {
|
|
|
465
468
|
validator: undefined,
|
|
466
469
|
ajv: undefined,
|
|
467
470
|
validationMode: 'ValidateAndShow',
|
|
468
|
-
additionalErrors: []
|
|
471
|
+
additionalErrors: [],
|
|
469
472
|
};
|
|
470
473
|
var reuseAjvForSchema = function (ajv, schema) {
|
|
471
474
|
if (schema.hasOwnProperty('id') || schema.hasOwnProperty('$id')) {
|
|
@@ -527,7 +530,9 @@ var coreReducer = function (state, action) {
|
|
|
527
530
|
case INIT: {
|
|
528
531
|
var thisAjv = getOrCreateAjv(state, action);
|
|
529
532
|
var validationMode = getValidationMode(state, action);
|
|
530
|
-
var v = validationMode === 'NoValidation'
|
|
533
|
+
var v = validationMode === 'NoValidation'
|
|
534
|
+
? undefined
|
|
535
|
+
: thisAjv.compile(action.schema);
|
|
531
536
|
var e = validate(v, action.data);
|
|
532
537
|
var additionalErrors = getAdditionalErrors(state, action);
|
|
533
538
|
return __assign(__assign({}, state), { data: action.data, schema: action.schema, uischema: action.uischema, additionalErrors: additionalErrors, errors: e, validator: v, ajv: thisAjv, validationMode: validationMode });
|
|
@@ -563,7 +568,9 @@ var coreReducer = function (state, action) {
|
|
|
563
568
|
}
|
|
564
569
|
case SET_AJV: {
|
|
565
570
|
var currentAjv = action.ajv;
|
|
566
|
-
var validator = state.validationMode === 'NoValidation'
|
|
571
|
+
var validator = state.validationMode === 'NoValidation'
|
|
572
|
+
? undefined
|
|
573
|
+
: currentAjv.compile(state.schema);
|
|
567
574
|
var errors = validate(validator, state.data);
|
|
568
575
|
return __assign(__assign({}, state), { validator: validator,
|
|
569
576
|
errors: errors });
|
|
@@ -648,37 +655,53 @@ var getControlPath = function (error) {
|
|
|
648
655
|
controlPath = controlPath.replace(/^./, '');
|
|
649
656
|
return controlPath;
|
|
650
657
|
};
|
|
651
|
-
var errorsAt = function (instancePath, schema, matchPath) {
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
658
|
+
var errorsAt = function (instancePath, schema, matchPath) {
|
|
659
|
+
return function (errors) {
|
|
660
|
+
var combinatorPaths = filter__default["default"](errors, function (error) { return error.keyword === 'oneOf' || error.keyword === 'anyOf'; }).map(function (error) { return getControlPath(error); });
|
|
661
|
+
return filter__default["default"](errors, function (error) {
|
|
662
|
+
if (filteredErrorKeywords.indexOf(error.keyword) !== -1 &&
|
|
663
|
+
!isOneOfEnumSchema(error.parentSchema)) {
|
|
664
|
+
return false;
|
|
665
|
+
}
|
|
666
|
+
var controlPath = getControlPath(error);
|
|
667
|
+
var result = matchPath(controlPath);
|
|
668
|
+
var parentSchema = error.parentSchema;
|
|
669
|
+
if (result &&
|
|
670
|
+
!isObjectSchema$1(parentSchema) &&
|
|
671
|
+
!isOneOfEnumSchema(parentSchema) &&
|
|
672
|
+
combinatorPaths.findIndex(function (p) { return instancePath.startsWith(p); }) !== -1) {
|
|
673
|
+
result = result && isEqual__default["default"](parentSchema, schema);
|
|
674
|
+
}
|
|
675
|
+
return result;
|
|
676
|
+
});
|
|
677
|
+
};
|
|
678
|
+
};
|
|
667
679
|
var isObjectSchema$1 = function (schema) {
|
|
668
680
|
return (schema === null || schema === void 0 ? void 0 : schema.type) === 'object' || !!(schema === null || schema === void 0 ? void 0 : schema.properties);
|
|
669
681
|
};
|
|
670
|
-
var filteredErrorKeywords = [
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
682
|
+
var filteredErrorKeywords = [
|
|
683
|
+
'additionalProperties',
|
|
684
|
+
'allOf',
|
|
685
|
+
'anyOf',
|
|
686
|
+
'oneOf',
|
|
687
|
+
];
|
|
688
|
+
var getErrorsAt = function (instancePath, schema, matchPath) {
|
|
689
|
+
return function (state) {
|
|
690
|
+
var _a, _b;
|
|
691
|
+
var errors = (_a = state.errors) !== null && _a !== void 0 ? _a : [];
|
|
692
|
+
var additionalErrors = (_b = state.additionalErrors) !== null && _b !== void 0 ? _b : [];
|
|
693
|
+
return errorsAt(instancePath, schema, matchPath)(state.validationMode === 'ValidateAndHide'
|
|
694
|
+
? additionalErrors
|
|
695
|
+
: __spreadArray(__spreadArray([], errors), additionalErrors));
|
|
696
|
+
};
|
|
697
|
+
};
|
|
677
698
|
var errorAt = function (instancePath, schema) {
|
|
678
699
|
return getErrorsAt(instancePath, schema, function (path) { return path === instancePath; });
|
|
679
700
|
};
|
|
680
701
|
var subErrorsAt = function (instancePath, schema) {
|
|
681
|
-
return getErrorsAt(instancePath, schema, function (path) {
|
|
702
|
+
return getErrorsAt(instancePath, schema, function (path) {
|
|
703
|
+
return path.startsWith(instancePath + '.');
|
|
704
|
+
});
|
|
682
705
|
};
|
|
683
706
|
|
|
684
707
|
var defaultDataReducer = function (state, action) {
|
|
@@ -686,7 +709,7 @@ var defaultDataReducer = function (state, action) {
|
|
|
686
709
|
switch (action.type) {
|
|
687
710
|
case ADD_DEFAULT_DATA:
|
|
688
711
|
return state.concat([
|
|
689
|
-
{ schemaPath: action.schemaPath, data: action.data }
|
|
712
|
+
{ schemaPath: action.schemaPath, data: action.data },
|
|
690
713
|
]);
|
|
691
714
|
case REMOVE_DEFAULT_DATA:
|
|
692
715
|
return state.filter(function (t) { return t.schemaPath !== action.schemaPath; });
|
|
@@ -713,6 +736,9 @@ var getI18nKeyPrefix = function (schema, uischema, path) {
|
|
|
713
736
|
var getI18nKey = function (schema, uischema, path, key) {
|
|
714
737
|
return getI18nKeyPrefix(schema, uischema, path) + "." + key;
|
|
715
738
|
};
|
|
739
|
+
var addI18nKeyToPrefix = function (i18nKeyPrefix, key) {
|
|
740
|
+
return i18nKeyPrefix + "." + key;
|
|
741
|
+
};
|
|
716
742
|
var defaultTranslator = function (_id, defaultMessage) { return defaultMessage; };
|
|
717
743
|
var defaultErrorTranslator = function (error, t, uischema) {
|
|
718
744
|
var _a;
|
|
@@ -721,7 +747,9 @@ var defaultErrorTranslator = function (error, t, uischema) {
|
|
|
721
747
|
if (specializedKeywordMessage !== undefined) {
|
|
722
748
|
return specializedKeywordMessage;
|
|
723
749
|
}
|
|
724
|
-
var genericKeywordMessage = t("error." + error.keyword, undefined, {
|
|
750
|
+
var genericKeywordMessage = t("error." + error.keyword, undefined, {
|
|
751
|
+
error: error,
|
|
752
|
+
});
|
|
725
753
|
if (genericKeywordMessage !== undefined) {
|
|
726
754
|
return genericKeywordMessage;
|
|
727
755
|
}
|
|
@@ -729,7 +757,8 @@ var defaultErrorTranslator = function (error, t, uischema) {
|
|
|
729
757
|
if (messageCustomization !== undefined) {
|
|
730
758
|
return messageCustomization;
|
|
731
759
|
}
|
|
732
|
-
if (error.keyword === 'required' &&
|
|
760
|
+
if (error.keyword === 'required' &&
|
|
761
|
+
((_a = error.message) === null || _a === void 0 ? void 0 : _a.startsWith('must have required property'))) {
|
|
733
762
|
return t('is a required property', 'is a required property', { error: error });
|
|
734
763
|
}
|
|
735
764
|
return error.message;
|
|
@@ -737,7 +766,12 @@ var defaultErrorTranslator = function (error, t, uischema) {
|
|
|
737
766
|
var getCombinedErrorMessage = function (errors, et, t, schema, uischema, path) {
|
|
738
767
|
if (errors.length > 0 && t) {
|
|
739
768
|
var customErrorKey = getI18nKey(schema, uischema, path, 'error.custom');
|
|
740
|
-
var specializedErrorMessage = t(customErrorKey, undefined, {
|
|
769
|
+
var specializedErrorMessage = t(customErrorKey, undefined, {
|
|
770
|
+
schema: schema,
|
|
771
|
+
uischema: uischema,
|
|
772
|
+
path: path,
|
|
773
|
+
errors: errors,
|
|
774
|
+
});
|
|
741
775
|
if (specializedErrorMessage !== undefined) {
|
|
742
776
|
return specializedErrorMessage;
|
|
743
777
|
}
|
|
@@ -748,19 +782,80 @@ var deriveLabelForUISchemaElement = function (uischema, t) {
|
|
|
748
782
|
if (uischema.label === false) {
|
|
749
783
|
return undefined;
|
|
750
784
|
}
|
|
751
|
-
if ((uischema.label === undefined ||
|
|
785
|
+
if ((uischema.label === undefined ||
|
|
786
|
+
uischema.label === null ||
|
|
787
|
+
uischema.label === true) &&
|
|
788
|
+
!isInternationalized(uischema)) {
|
|
752
789
|
return undefined;
|
|
753
790
|
}
|
|
754
|
-
var stringifiedLabel = typeof uischema.label === 'string'
|
|
791
|
+
var stringifiedLabel = typeof uischema.label === 'string'
|
|
792
|
+
? uischema.label
|
|
793
|
+
: JSON.stringify(uischema.label);
|
|
755
794
|
var i18nKeyPrefix = getI18nKeyPrefixBySchema(undefined, uischema);
|
|
756
|
-
var i18nKey = typeof i18nKeyPrefix === 'string'
|
|
795
|
+
var i18nKey = typeof i18nKeyPrefix === 'string'
|
|
796
|
+
? i18nKeyPrefix + ".label"
|
|
797
|
+
: stringifiedLabel;
|
|
757
798
|
return t(i18nKey, stringifiedLabel, { uischema: uischema });
|
|
758
799
|
};
|
|
800
|
+
var getArrayTranslations = function (t, defaultTranslations, i18nKeyPrefix, label) {
|
|
801
|
+
var translations = {};
|
|
802
|
+
defaultTranslations.forEach(function (controlElement) {
|
|
803
|
+
var key = addI18nKeyToPrefix(i18nKeyPrefix, controlElement.key);
|
|
804
|
+
translations[controlElement.key] = t(key, controlElement.default(label));
|
|
805
|
+
});
|
|
806
|
+
return translations;
|
|
807
|
+
};
|
|
808
|
+
|
|
809
|
+
exports.ArrayTranslationEnum = void 0;
|
|
810
|
+
(function (ArrayTranslationEnum) {
|
|
811
|
+
ArrayTranslationEnum["addTooltip"] = "addTooltip";
|
|
812
|
+
ArrayTranslationEnum["addAriaLabel"] = "addAriaLabel";
|
|
813
|
+
ArrayTranslationEnum["removeTooltip"] = "removeTooltip";
|
|
814
|
+
ArrayTranslationEnum["upAriaLabel"] = "upAriaLabel";
|
|
815
|
+
ArrayTranslationEnum["downAriaLabel"] = "downAriaLabel";
|
|
816
|
+
ArrayTranslationEnum["noSelection"] = "noSelection";
|
|
817
|
+
ArrayTranslationEnum["removeAriaLabel"] = "removeAriaLabel";
|
|
818
|
+
ArrayTranslationEnum["noDataMessage"] = "noDataMessage";
|
|
819
|
+
ArrayTranslationEnum["deleteDialogTitle"] = "deleteDialogTitle";
|
|
820
|
+
ArrayTranslationEnum["deleteDialogMessage"] = "deleteDialogMessage";
|
|
821
|
+
ArrayTranslationEnum["deleteDialogAccept"] = "deleteDialogAccept";
|
|
822
|
+
ArrayTranslationEnum["deleteDialogDecline"] = "deleteDialogDecline";
|
|
823
|
+
ArrayTranslationEnum["up"] = "up";
|
|
824
|
+
ArrayTranslationEnum["down"] = "down";
|
|
825
|
+
})(exports.ArrayTranslationEnum || (exports.ArrayTranslationEnum = {}));
|
|
826
|
+
var arrayDefaultTranslations = [
|
|
827
|
+
{
|
|
828
|
+
key: exports.ArrayTranslationEnum.addTooltip,
|
|
829
|
+
default: function (input) { return (input ? "Add to " + input : 'Add'); },
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
key: exports.ArrayTranslationEnum.addAriaLabel,
|
|
833
|
+
default: function (input) { return (input ? "Add to " + input + " button" : 'Add button'); },
|
|
834
|
+
},
|
|
835
|
+
{ key: exports.ArrayTranslationEnum.removeTooltip, default: function () { return 'Delete'; } },
|
|
836
|
+
{ key: exports.ArrayTranslationEnum.removeAriaLabel, default: function () { return 'Delete button'; } },
|
|
837
|
+
{ key: exports.ArrayTranslationEnum.upAriaLabel, default: function () { return "Move item up"; } },
|
|
838
|
+
{ key: exports.ArrayTranslationEnum.up, default: function () { return 'Up'; } },
|
|
839
|
+
{ key: exports.ArrayTranslationEnum.down, default: function () { return 'Down'; } },
|
|
840
|
+
{ key: exports.ArrayTranslationEnum.downAriaLabel, default: function () { return "Move item down"; } },
|
|
841
|
+
{ key: exports.ArrayTranslationEnum.noDataMessage, default: function () { return 'No data'; } },
|
|
842
|
+
{ key: exports.ArrayTranslationEnum.noSelection, default: function () { return 'No selection'; } },
|
|
843
|
+
{
|
|
844
|
+
key: exports.ArrayTranslationEnum.deleteDialogTitle,
|
|
845
|
+
default: function () { return 'Confirm Deletion'; },
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
key: exports.ArrayTranslationEnum.deleteDialogMessage,
|
|
849
|
+
default: function () { return 'Are you sure you want to delete the selected entry?'; },
|
|
850
|
+
},
|
|
851
|
+
{ key: exports.ArrayTranslationEnum.deleteDialogAccept, default: function () { return 'Yes'; } },
|
|
852
|
+
{ key: exports.ArrayTranslationEnum.deleteDialogDecline, default: function () { return 'No'; } },
|
|
853
|
+
];
|
|
759
854
|
|
|
760
855
|
var defaultJsonFormsI18nState = {
|
|
761
856
|
locale: 'en',
|
|
762
857
|
translate: defaultTranslator,
|
|
763
|
-
translateError: defaultErrorTranslator
|
|
858
|
+
translateError: defaultErrorTranslator,
|
|
764
859
|
};
|
|
765
860
|
var i18nReducer = function (state, action) {
|
|
766
861
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -811,7 +906,7 @@ var rendererReducer = function (state, action) {
|
|
|
811
906
|
switch (action.type) {
|
|
812
907
|
case ADD_RENDERER:
|
|
813
908
|
return state.concat([
|
|
814
|
-
{ tester: action.tester, renderer: action.renderer }
|
|
909
|
+
{ tester: action.tester, renderer: action.renderer },
|
|
815
910
|
]);
|
|
816
911
|
case REMOVE_RENDERER:
|
|
817
912
|
return state.filter(function (t) { return t.tester !== action.tester; });
|
|
@@ -824,41 +919,45 @@ var NOT_APPLICABLE = -1;
|
|
|
824
919
|
var isControl = function (uischema) {
|
|
825
920
|
return !isEmpty__default["default"](uischema) && uischema.scope !== undefined;
|
|
826
921
|
};
|
|
827
|
-
var schemaMatches = function (predicate) {
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
922
|
+
var schemaMatches = function (predicate) {
|
|
923
|
+
return function (uischema, schema, context) {
|
|
924
|
+
if (isEmpty__default["default"](uischema) || !isControl(uischema)) {
|
|
925
|
+
return false;
|
|
926
|
+
}
|
|
927
|
+
if (isEmpty__default["default"](schema)) {
|
|
928
|
+
return false;
|
|
929
|
+
}
|
|
930
|
+
var schemaPath = uischema.scope;
|
|
931
|
+
if (isEmpty__default["default"](schemaPath)) {
|
|
932
|
+
return false;
|
|
933
|
+
}
|
|
934
|
+
var currentDataSchema = schema;
|
|
935
|
+
if (hasType(schema, 'object')) {
|
|
936
|
+
currentDataSchema = resolveSchema(schema, schemaPath, context === null || context === void 0 ? void 0 : context.rootSchema);
|
|
937
|
+
}
|
|
938
|
+
if (currentDataSchema === undefined) {
|
|
939
|
+
return false;
|
|
940
|
+
}
|
|
941
|
+
return predicate(currentDataSchema, context === null || context === void 0 ? void 0 : context.rootSchema);
|
|
942
|
+
};
|
|
943
|
+
};
|
|
944
|
+
var schemaSubPathMatches = function (subPath, predicate) {
|
|
945
|
+
return function (uischema, schema, context) {
|
|
946
|
+
if (isEmpty__default["default"](uischema) || !isControl(uischema)) {
|
|
947
|
+
return false;
|
|
948
|
+
}
|
|
949
|
+
var schemaPath = uischema.scope;
|
|
950
|
+
var currentDataSchema = schema;
|
|
951
|
+
if (hasType(schema, 'object')) {
|
|
952
|
+
currentDataSchema = resolveSchema(schema, schemaPath, context === null || context === void 0 ? void 0 : context.rootSchema);
|
|
953
|
+
}
|
|
954
|
+
currentDataSchema = get__default["default"](currentDataSchema, subPath);
|
|
955
|
+
if (currentDataSchema === undefined) {
|
|
956
|
+
return false;
|
|
957
|
+
}
|
|
958
|
+
return predicate(currentDataSchema, context === null || context === void 0 ? void 0 : context.rootSchema);
|
|
959
|
+
};
|
|
960
|
+
};
|
|
862
961
|
var schemaTypeIs = function (expectedType) {
|
|
863
962
|
return schemaMatches(function (schema) { return !isEmpty__default["default"](schema) && hasType(schema, expectedType); });
|
|
864
963
|
};
|
|
@@ -869,64 +968,79 @@ var formatIs = function (expectedFormat) {
|
|
|
869
968
|
hasType(schema, 'string');
|
|
870
969
|
});
|
|
871
970
|
};
|
|
872
|
-
var uiTypeIs = function (expected) {
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
return
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
};
|
|
886
|
-
var
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
};
|
|
971
|
+
var uiTypeIs = function (expected) {
|
|
972
|
+
return function (uischema) {
|
|
973
|
+
return !isEmpty__default["default"](uischema) && uischema.type === expected;
|
|
974
|
+
};
|
|
975
|
+
};
|
|
976
|
+
var optionIs = function (optionName, optionValue) {
|
|
977
|
+
return function (uischema) {
|
|
978
|
+
if (isEmpty__default["default"](uischema)) {
|
|
979
|
+
return false;
|
|
980
|
+
}
|
|
981
|
+
var options = uischema.options;
|
|
982
|
+
return !isEmpty__default["default"](options) && options[optionName] === optionValue;
|
|
983
|
+
};
|
|
984
|
+
};
|
|
985
|
+
var scopeEndsWith = function (expected) {
|
|
986
|
+
return function (uischema) {
|
|
987
|
+
if (isEmpty__default["default"](expected) || !isControl(uischema)) {
|
|
988
|
+
return false;
|
|
989
|
+
}
|
|
990
|
+
return endsWith__default["default"](uischema.scope, expected);
|
|
991
|
+
};
|
|
992
|
+
};
|
|
993
|
+
var scopeEndIs = function (expected) {
|
|
994
|
+
return function (uischema) {
|
|
995
|
+
if (isEmpty__default["default"](expected) || !isControl(uischema)) {
|
|
996
|
+
return false;
|
|
997
|
+
}
|
|
998
|
+
var schemaPath = uischema.scope;
|
|
999
|
+
return !isEmpty__default["default"](schemaPath) && last__default["default"](schemaPath.split('/')) === expected;
|
|
1000
|
+
};
|
|
1001
|
+
};
|
|
893
1002
|
var and = function () {
|
|
894
1003
|
var testers = [];
|
|
895
1004
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
896
1005
|
testers[_i] = arguments[_i];
|
|
897
1006
|
}
|
|
898
|
-
return function (uischema, schema, context) {
|
|
1007
|
+
return function (uischema, schema, context) {
|
|
1008
|
+
return testers.reduce(function (acc, tester) { return acc && tester(uischema, schema, context); }, true);
|
|
1009
|
+
};
|
|
899
1010
|
};
|
|
900
1011
|
var or = function () {
|
|
901
1012
|
var testers = [];
|
|
902
1013
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
903
1014
|
testers[_i] = arguments[_i];
|
|
904
1015
|
}
|
|
905
|
-
return function (uischema, schema, context) {
|
|
1016
|
+
return function (uischema, schema, context) {
|
|
1017
|
+
return testers.reduce(function (acc, tester) { return acc || tester(uischema, schema, context); }, false);
|
|
1018
|
+
};
|
|
906
1019
|
};
|
|
907
|
-
var rankWith = function (rank, tester) {
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
}; };
|
|
913
|
-
var withIncreasedRank = function (by, rankedTester) { return function (uischema, schema, context) {
|
|
914
|
-
var rank = rankedTester(uischema, schema, context);
|
|
915
|
-
if (rank === NOT_APPLICABLE) {
|
|
1020
|
+
var rankWith = function (rank, tester) {
|
|
1021
|
+
return function (uischema, schema, context) {
|
|
1022
|
+
if (tester(uischema, schema, context)) {
|
|
1023
|
+
return rank;
|
|
1024
|
+
}
|
|
916
1025
|
return NOT_APPLICABLE;
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
|
|
1026
|
+
};
|
|
1027
|
+
};
|
|
1028
|
+
var withIncreasedRank = function (by, rankedTester) {
|
|
1029
|
+
return function (uischema, schema, context) {
|
|
1030
|
+
var rank = rankedTester(uischema, schema, context);
|
|
1031
|
+
if (rank === NOT_APPLICABLE) {
|
|
1032
|
+
return NOT_APPLICABLE;
|
|
1033
|
+
}
|
|
1034
|
+
return rank + by;
|
|
1035
|
+
};
|
|
1036
|
+
};
|
|
920
1037
|
var isBooleanControl = and(uiTypeIs('Control'), schemaTypeIs('boolean'));
|
|
921
1038
|
var isObjectControl = and(uiTypeIs('Control'), schemaTypeIs('object'));
|
|
922
1039
|
var isAllOfControl = and(uiTypeIs('Control'), schemaMatches(function (schema) { return schema.hasOwnProperty('allOf'); }));
|
|
923
1040
|
var isAnyOfControl = and(uiTypeIs('Control'), schemaMatches(function (schema) { return schema.hasOwnProperty('anyOf'); }));
|
|
924
1041
|
var isOneOfControl = and(uiTypeIs('Control'), schemaMatches(function (schema) { return schema.hasOwnProperty('oneOf'); }));
|
|
925
1042
|
var isEnumControl = and(uiTypeIs('Control'), or(schemaMatches(function (schema) { return schema.hasOwnProperty('enum'); }), schemaMatches(function (schema) { return schema.hasOwnProperty('const'); })));
|
|
926
|
-
var isOneOfEnumControl = and(uiTypeIs('Control'), schemaMatches(function (schema) {
|
|
927
|
-
return schema.hasOwnProperty('oneOf') &&
|
|
928
|
-
schema.oneOf.every(function (s) { return s.const !== undefined; });
|
|
929
|
-
}));
|
|
1043
|
+
var isOneOfEnumControl = and(uiTypeIs('Control'), schemaMatches(function (schema) { return isOneOfEnumSchema(schema); }));
|
|
930
1044
|
var isIntegerControl = and(uiTypeIs('Control'), schemaTypeIs('integer'));
|
|
931
1045
|
var isNumberControl = and(uiTypeIs('Control'), schemaTypeIs('number'));
|
|
932
1046
|
var isStringControl = and(uiTypeIs('Control'), schemaTypeIs('string'));
|
|
@@ -934,9 +1048,14 @@ var isMultiLineControl = and(uiTypeIs('Control'), optionIs('multi', true));
|
|
|
934
1048
|
var isDateControl = and(uiTypeIs('Control'), or(formatIs('date'), optionIs('format', 'date')));
|
|
935
1049
|
var isTimeControl = and(uiTypeIs('Control'), or(formatIs('time'), optionIs('format', 'time')));
|
|
936
1050
|
var isDateTimeControl = and(uiTypeIs('Control'), or(formatIs('date-time'), optionIs('format', 'date-time')));
|
|
937
|
-
var isObjectArray = and(schemaMatches(function (schema, rootSchema) {
|
|
1051
|
+
var isObjectArray = and(schemaMatches(function (schema, rootSchema) {
|
|
1052
|
+
return hasType(schema, 'array') &&
|
|
1053
|
+
!Array.isArray(resolveSchema(schema, 'items', rootSchema));
|
|
1054
|
+
}
|
|
938
1055
|
), schemaSubPathMatches('items', function (schema, rootSchema) {
|
|
939
|
-
var resolvedSchema = schema.$ref
|
|
1056
|
+
var resolvedSchema = schema.$ref
|
|
1057
|
+
? resolveSchema(rootSchema, schema.$ref, rootSchema)
|
|
1058
|
+
: schema;
|
|
940
1059
|
return hasType(resolvedSchema, 'object');
|
|
941
1060
|
}));
|
|
942
1061
|
var isObjectArrayControl = and(uiTypeIs('Control'), isObjectArray);
|
|
@@ -980,7 +1099,10 @@ var isObjectArrayWithNesting = function (uischema, schema, context) {
|
|
|
980
1099
|
if (val.$ref !== undefined) {
|
|
981
1100
|
return false;
|
|
982
1101
|
}
|
|
983
|
-
if (val.anyOf || val.
|
|
1102
|
+
if (val.anyOf || val.allOf) {
|
|
1103
|
+
return true;
|
|
1104
|
+
}
|
|
1105
|
+
if (val.oneOf && !isOneOfEnumSchema(val)) {
|
|
984
1106
|
return true;
|
|
985
1107
|
}
|
|
986
1108
|
if (hasType(val, 'object')) {
|
|
@@ -1014,7 +1136,9 @@ var isPrimitiveArrayControl = and(uiTypeIs('Control'), schemaMatches(function (s
|
|
|
1014
1136
|
!Array.isArray(resolveSchema(schema, 'items', rootSchema));
|
|
1015
1137
|
}
|
|
1016
1138
|
), schemaSubPathMatches('items', function (schema, rootSchema) {
|
|
1017
|
-
var resolvedSchema = schema.$ref
|
|
1139
|
+
var resolvedSchema = schema.$ref
|
|
1140
|
+
? resolveSchema(rootSchema, schema.$ref, rootSchema)
|
|
1141
|
+
: schema;
|
|
1018
1142
|
var types = deriveTypes(resolvedSchema);
|
|
1019
1143
|
return (types.length === 1 &&
|
|
1020
1144
|
includes__default["default"](['integer', 'number', 'boolean', 'string'], types[0]));
|
|
@@ -1042,7 +1166,11 @@ var hasCategory = function (categorization) {
|
|
|
1042
1166
|
var categorizationHasCategory = function (uischema) {
|
|
1043
1167
|
return hasCategory(uischema);
|
|
1044
1168
|
};
|
|
1045
|
-
var not = function (tester) {
|
|
1169
|
+
var not = function (tester) {
|
|
1170
|
+
return function (uischema, schema, context) {
|
|
1171
|
+
return !tester(uischema, schema, context);
|
|
1172
|
+
};
|
|
1173
|
+
};
|
|
1046
1174
|
|
|
1047
1175
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
1048
1176
|
__proto__: null,
|
|
@@ -1095,24 +1223,27 @@ var uischemaRegistryReducer = function (state, action) {
|
|
|
1095
1223
|
return state
|
|
1096
1224
|
.slice()
|
|
1097
1225
|
.concat({ tester: action.tester, uischema: action.uischema });
|
|
1098
|
-
case REMOVE_UI_SCHEMA:
|
|
1226
|
+
case REMOVE_UI_SCHEMA: {
|
|
1099
1227
|
var copy = state.slice();
|
|
1100
1228
|
remove__default["default"](copy, function (entry) { return entry.tester === action.tester; });
|
|
1101
1229
|
return copy;
|
|
1230
|
+
}
|
|
1102
1231
|
default:
|
|
1103
1232
|
return state;
|
|
1104
1233
|
}
|
|
1105
1234
|
};
|
|
1106
|
-
var findMatchingUISchema = function (state) {
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
match
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1235
|
+
var findMatchingUISchema = function (state) {
|
|
1236
|
+
return function (jsonSchema, schemaPath, path) {
|
|
1237
|
+
var match = maxBy__default["default"](state, function (entry) {
|
|
1238
|
+
return entry.tester(jsonSchema, schemaPath, path);
|
|
1239
|
+
});
|
|
1240
|
+
if (match !== undefined &&
|
|
1241
|
+
match.tester(jsonSchema, schemaPath, path) !== NOT_APPLICABLE) {
|
|
1242
|
+
return match.uischema;
|
|
1243
|
+
}
|
|
1244
|
+
return undefined;
|
|
1245
|
+
};
|
|
1246
|
+
};
|
|
1116
1247
|
|
|
1117
1248
|
var jsonFormsReducerConfig = {
|
|
1118
1249
|
core: coreReducer,
|
|
@@ -1128,7 +1259,7 @@ var findUISchema = function (uischemas, schema, schemaPath, path, fallback, cont
|
|
|
1128
1259
|
if (control && control.options && control.options.detail) {
|
|
1129
1260
|
if (typeof control.options.detail === 'string') {
|
|
1130
1261
|
if (control.options.detail.toUpperCase() === 'GENERATE') {
|
|
1131
|
-
if (typeof fallback ===
|
|
1262
|
+
if (typeof fallback === 'function') {
|
|
1132
1263
|
return fallback();
|
|
1133
1264
|
}
|
|
1134
1265
|
return Generate.uiSchema(schema, fallback);
|
|
@@ -1153,13 +1284,23 @@ var findUISchema = function (uischemas, schema, schemaPath, path, fallback, cont
|
|
|
1153
1284
|
var getErrorAt = function (instancePath, schema) { return function (state) {
|
|
1154
1285
|
return errorAt(instancePath, schema)(state.jsonforms.core);
|
|
1155
1286
|
}; };
|
|
1156
|
-
var getSubErrorsAt = function (instancePath, schema) { return function (state) {
|
|
1287
|
+
var getSubErrorsAt = function (instancePath, schema) { return function (state) {
|
|
1288
|
+
return subErrorsAt(instancePath, schema)(state.jsonforms.core);
|
|
1289
|
+
}; };
|
|
1157
1290
|
var getConfig = function (state) { return state.jsonforms.config; };
|
|
1158
1291
|
var getLocale = function (state) {
|
|
1159
1292
|
return fetchLocale(get__default["default"](state, 'jsonforms.i18n'));
|
|
1160
1293
|
};
|
|
1161
|
-
var getTranslator = function () {
|
|
1162
|
-
|
|
1294
|
+
var getTranslator = function () {
|
|
1295
|
+
return function (state) {
|
|
1296
|
+
return fetchTranslator(get__default["default"](state, 'jsonforms.i18n'));
|
|
1297
|
+
};
|
|
1298
|
+
};
|
|
1299
|
+
var getErrorTranslator = function () {
|
|
1300
|
+
return function (state) {
|
|
1301
|
+
return fetchErrorTranslator(get__default["default"](state, 'jsonforms.i18n'));
|
|
1302
|
+
};
|
|
1303
|
+
};
|
|
1163
1304
|
|
|
1164
1305
|
var getData = function (state) {
|
|
1165
1306
|
return extractData(get__default["default"](state, 'jsonforms.core'));
|
|
@@ -1170,7 +1311,9 @@ var getSchema = function (state) {
|
|
|
1170
1311
|
var getUiSchema = function (state) {
|
|
1171
1312
|
return extractUiSchema(get__default["default"](state, 'jsonforms.core'));
|
|
1172
1313
|
};
|
|
1173
|
-
var getAjv = function (state) {
|
|
1314
|
+
var getAjv = function (state) {
|
|
1315
|
+
return extractAjv(get__default["default"](state, 'jsonforms.core'));
|
|
1316
|
+
};
|
|
1174
1317
|
var getDefaultData = function (state) {
|
|
1175
1318
|
return extractDefaultData(get__default["default"](state, 'jsonforms.defaultData'));
|
|
1176
1319
|
};
|
|
@@ -1216,8 +1359,12 @@ var composeWithUi = function (scopableUi, path) {
|
|
|
1216
1359
|
}
|
|
1217
1360
|
return compose(path, segments.join('.'));
|
|
1218
1361
|
};
|
|
1219
|
-
var encode = function (segment) {
|
|
1220
|
-
|
|
1362
|
+
var encode = function (segment) {
|
|
1363
|
+
return segment === null || segment === void 0 ? void 0 : segment.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
1364
|
+
};
|
|
1365
|
+
var decode = function (pointerSegment) {
|
|
1366
|
+
return pointerSegment === null || pointerSegment === void 0 ? void 0 : pointerSegment.replace(/~1/g, '/').replace(/~0/, '~');
|
|
1367
|
+
};
|
|
1221
1368
|
|
|
1222
1369
|
var isObjectSchema = function (schema) {
|
|
1223
1370
|
return schema.properties !== undefined;
|
|
@@ -1230,9 +1377,7 @@ var resolveData = function (instance, dataPath) {
|
|
|
1230
1377
|
return instance;
|
|
1231
1378
|
}
|
|
1232
1379
|
var dataPathSegments = dataPath.split('.');
|
|
1233
|
-
return dataPathSegments
|
|
1234
|
-
.map(function (segment) { return decodeURIComponent(segment); })
|
|
1235
|
-
.reduce(function (curInstance, decodedSegment) {
|
|
1380
|
+
return dataPathSegments.reduce(function (curInstance, decodedSegment) {
|
|
1236
1381
|
if (!curInstance || !curInstance.hasOwnProperty(decodedSegment)) {
|
|
1237
1382
|
return undefined;
|
|
1238
1383
|
}
|
|
@@ -1467,14 +1612,14 @@ var deriveTypes = function (jsonSchema) {
|
|
|
1467
1612
|
};
|
|
1468
1613
|
var Resolve = {
|
|
1469
1614
|
schema: resolveSchema,
|
|
1470
|
-
data: resolveData
|
|
1615
|
+
data: resolveData,
|
|
1471
1616
|
};
|
|
1472
1617
|
var fromScoped = function (scopable) {
|
|
1473
1618
|
return toDataPathSegments(scopable.scope).join('.');
|
|
1474
1619
|
};
|
|
1475
1620
|
var Paths = {
|
|
1476
1621
|
compose: compose,
|
|
1477
|
-
fromScoped: fromScoped
|
|
1622
|
+
fromScoped: fromScoped,
|
|
1478
1623
|
};
|
|
1479
1624
|
var Runtime = {
|
|
1480
1625
|
isEnabled: function (uischema, data, ajv) {
|
|
@@ -1482,7 +1627,7 @@ var Runtime = {
|
|
|
1482
1627
|
},
|
|
1483
1628
|
isVisible: function (uischema, data, ajv) {
|
|
1484
1629
|
return isVisible(uischema, data, undefined, ajv);
|
|
1485
|
-
}
|
|
1630
|
+
},
|
|
1486
1631
|
};
|
|
1487
1632
|
|
|
1488
1633
|
var deriveLabel = function (controlElement, schemaElement) {
|
|
@@ -1518,7 +1663,7 @@ var createLabelDescriptionFrom = function (withLabel, schema) {
|
|
|
1518
1663
|
};
|
|
1519
1664
|
var labelDescription = function (text, show) { return ({
|
|
1520
1665
|
text: text,
|
|
1521
|
-
show: show
|
|
1666
|
+
show: show,
|
|
1522
1667
|
}); };
|
|
1523
1668
|
|
|
1524
1669
|
var isRequired = function (schema, schemaPath, rootSchema) {
|
|
@@ -1618,7 +1763,13 @@ var mapStateToControlProps = function (state, ownProps) {
|
|
|
1618
1763
|
var schema = resolvedSchema !== null && resolvedSchema !== void 0 ? resolvedSchema : rootSchema;
|
|
1619
1764
|
var t = getTranslator()(state);
|
|
1620
1765
|
var te = getErrorTranslator()(state);
|
|
1621
|
-
var
|
|
1766
|
+
var i18nKeyPrefix = getI18nKeyPrefix(schema, uischema, path);
|
|
1767
|
+
var i18nLabel = t(getI18nKey(schema, uischema, path, 'label'), label, {
|
|
1768
|
+
schema: schema,
|
|
1769
|
+
uischema: uischema,
|
|
1770
|
+
path: path,
|
|
1771
|
+
errors: errors,
|
|
1772
|
+
});
|
|
1622
1773
|
var i18nDescription = t(getI18nKey(schema, uischema, path, 'description'), description, { schema: schema, uischema: uischema, path: path, errors: errors });
|
|
1623
1774
|
var i18nErrorMessage = getCombinedErrorMessage(errors, te, t, schema, uischema, path);
|
|
1624
1775
|
return {
|
|
@@ -1635,13 +1786,14 @@ var mapStateToControlProps = function (state, ownProps) {
|
|
|
1635
1786
|
schema: schema,
|
|
1636
1787
|
config: getConfig(state),
|
|
1637
1788
|
cells: ownProps.cells || state.jsonforms.cells,
|
|
1638
|
-
rootSchema: rootSchema
|
|
1789
|
+
rootSchema: rootSchema,
|
|
1790
|
+
i18nKeyPrefix: i18nKeyPrefix,
|
|
1639
1791
|
};
|
|
1640
1792
|
};
|
|
1641
1793
|
var mapDispatchToControlProps = function (dispatch) { return ({
|
|
1642
1794
|
handleChange: function (path, value) {
|
|
1643
1795
|
dispatch(update(path, function () { return value; }));
|
|
1644
|
-
}
|
|
1796
|
+
},
|
|
1645
1797
|
}); };
|
|
1646
1798
|
var mapStateToEnumControlProps = function (state, ownProps) {
|
|
1647
1799
|
var _a;
|
|
@@ -1651,7 +1803,7 @@ var mapStateToEnumControlProps = function (state, ownProps) {
|
|
|
1651
1803
|
return enumToEnumOptionMapper(e, getTranslator()(state), getI18nKeyPrefix(props.schema, props.uischema, props.path));
|
|
1652
1804
|
})) ||
|
|
1653
1805
|
(props.schema.const && [
|
|
1654
|
-
enumToEnumOptionMapper(props.schema.const, getTranslator()(state), getI18nKeyPrefix(props.schema, props.uischema, props.path))
|
|
1806
|
+
enumToEnumOptionMapper(props.schema.const, getTranslator()(state), getI18nKeyPrefix(props.schema, props.uischema, props.path)),
|
|
1655
1807
|
]);
|
|
1656
1808
|
return __assign(__assign({}, props), { options: options });
|
|
1657
1809
|
};
|
|
@@ -1700,11 +1852,13 @@ var mapStateToControlWithDetailProps = function (state, ownProps) {
|
|
|
1700
1852
|
return __assign(__assign({}, props), { uischemas: state.jsonforms.uischemas });
|
|
1701
1853
|
};
|
|
1702
1854
|
var mapStateToArrayControlProps = function (state, ownProps) {
|
|
1703
|
-
var _a = mapStateToControlWithDetailProps(state, ownProps), path = _a.path, schema = _a.schema, uischema = _a.uischema, props = __rest(_a, ["path", "schema", "uischema"]);
|
|
1855
|
+
var _a = mapStateToControlWithDetailProps(state, ownProps), path = _a.path, schema = _a.schema, uischema = _a.uischema, i18nKeyPrefix = _a.i18nKeyPrefix, label = _a.label, props = __rest(_a, ["path", "schema", "uischema", "i18nKeyPrefix", "label"]);
|
|
1704
1856
|
var resolvedSchema = Resolve.schema(schema, 'items', props.rootSchema);
|
|
1705
1857
|
var childErrors = getSubErrorsAt(path, resolvedSchema)(state);
|
|
1706
|
-
|
|
1707
|
-
|
|
1858
|
+
var t = getTranslator()(state);
|
|
1859
|
+
return __assign(__assign({}, props), { label: label,
|
|
1860
|
+
path: path,
|
|
1861
|
+
uischema: uischema, schema: resolvedSchema, childErrors: childErrors, renderers: ownProps.renderers || getRenderers(state), cells: ownProps.cells || getCells(state), translations: getArrayTranslations(t, arrayDefaultTranslations, i18nKeyPrefix, label) });
|
|
1708
1862
|
};
|
|
1709
1863
|
var mapDispatchToArrayControlProps = function (dispatch) { return ({
|
|
1710
1864
|
addItem: function (path, value) { return function () {
|
|
@@ -1736,7 +1890,7 @@ var mapDispatchToArrayControlProps = function (dispatch) { return ({
|
|
|
1736
1890
|
moveDown(array, toMove);
|
|
1737
1891
|
return array;
|
|
1738
1892
|
}));
|
|
1739
|
-
}; }
|
|
1893
|
+
}; },
|
|
1740
1894
|
}); };
|
|
1741
1895
|
var mapDispatchToMultiEnumProps = function (dispatch) { return ({
|
|
1742
1896
|
addItem: function (path, value) {
|
|
@@ -1754,13 +1908,13 @@ var mapDispatchToMultiEnumProps = function (dispatch) { return ({
|
|
|
1754
1908
|
data.splice(indexInData, 1);
|
|
1755
1909
|
return data;
|
|
1756
1910
|
}));
|
|
1757
|
-
}
|
|
1911
|
+
},
|
|
1758
1912
|
}); };
|
|
1759
1913
|
var layoutDefaultProps = {
|
|
1760
1914
|
visible: true,
|
|
1761
1915
|
enabled: true,
|
|
1762
1916
|
path: '',
|
|
1763
|
-
direction: 'column'
|
|
1917
|
+
direction: 'column',
|
|
1764
1918
|
};
|
|
1765
1919
|
var getDirection = function (uischema) {
|
|
1766
1920
|
if (uischema.type === 'HorizontalLayout') {
|
|
@@ -1783,7 +1937,9 @@ var mapStateToLayoutProps = function (state, ownProps) {
|
|
|
1783
1937
|
var enabled = isInherentlyEnabled(state, ownProps, uischema, undefined,
|
|
1784
1938
|
rootData, config);
|
|
1785
1939
|
var t = getTranslator()(state);
|
|
1786
|
-
var label = isLabelable(uischema)
|
|
1940
|
+
var label = isLabelable(uischema)
|
|
1941
|
+
? deriveLabelForUISchemaElement(uischema, t)
|
|
1942
|
+
: undefined;
|
|
1787
1943
|
return __assign(__assign({}, layoutDefaultProps), { renderers: ownProps.renderers || getRenderers(state), cells: ownProps.cells || getCells(state), visible: visible,
|
|
1788
1944
|
enabled: enabled, path: ownProps.path, data: data, uischema: ownProps.uischema, schema: ownProps.schema, direction: (_a = ownProps.direction) !== null && _a !== void 0 ? _a : getDirection(uischema), config: config,
|
|
1789
1945
|
label: label });
|
|
@@ -1797,7 +1953,7 @@ var mapStateToJsonFormsRendererProps = function (state, ownProps) {
|
|
|
1797
1953
|
uischema: ownProps.uischema || getUiSchema(state),
|
|
1798
1954
|
path: ownProps.path,
|
|
1799
1955
|
enabled: ownProps.enabled,
|
|
1800
|
-
config: getConfig(state)
|
|
1956
|
+
config: getConfig(state),
|
|
1801
1957
|
};
|
|
1802
1958
|
};
|
|
1803
1959
|
var controlDefaultProps = __assign(__assign({}, layoutDefaultProps), { errors: [] });
|
|
@@ -1810,7 +1966,7 @@ var mapStateToCombinatorRendererProps = function (state, ownProps, keyword) {
|
|
|
1810
1966
|
'additionalProperties',
|
|
1811
1967
|
'type',
|
|
1812
1968
|
'enum',
|
|
1813
|
-
'const'
|
|
1969
|
+
'const',
|
|
1814
1970
|
];
|
|
1815
1971
|
var dataIsValid = function (errors) {
|
|
1816
1972
|
return (!errors ||
|
|
@@ -1849,14 +2005,16 @@ var mapStateToOneOfProps = function (state, ownProps) {
|
|
|
1849
2005
|
return mapStateToCombinatorRendererProps(state, ownProps, 'oneOf');
|
|
1850
2006
|
};
|
|
1851
2007
|
var mapStateToArrayLayoutProps = function (state, ownProps) {
|
|
1852
|
-
var _a = mapStateToControlWithDetailProps(state, ownProps), path = _a.path, schema = _a.schema, uischema = _a.uischema, errors = _a.errors, props = __rest(_a, ["path", "schema", "uischema", "errors"]);
|
|
2008
|
+
var _a = mapStateToControlWithDetailProps(state, ownProps), path = _a.path, schema = _a.schema, uischema = _a.uischema, errors = _a.errors, i18nKeyPrefix = _a.i18nKeyPrefix, label = _a.label, props = __rest(_a, ["path", "schema", "uischema", "errors", "i18nKeyPrefix", "label"]);
|
|
1853
2009
|
var resolvedSchema = Resolve.schema(schema, 'items', props.rootSchema);
|
|
1854
|
-
var
|
|
2010
|
+
var t = getTranslator()(state);
|
|
2011
|
+
var childErrors = getCombinedErrorMessage(getSubErrorsAt(path, resolvedSchema)(state), getErrorTranslator()(state), t, undefined, undefined, undefined);
|
|
1855
2012
|
var allErrors = errors +
|
|
1856
2013
|
(errors.length > 0 && childErrors.length > 0 ? '\n' : '') +
|
|
1857
2014
|
childErrors;
|
|
1858
|
-
return __assign(__assign({}, props), {
|
|
1859
|
-
|
|
2015
|
+
return __assign(__assign({}, props), { label: label,
|
|
2016
|
+
path: path,
|
|
2017
|
+
uischema: uischema, schema: resolvedSchema, data: props.data ? props.data.length : 0, errors: allErrors, minItems: schema.minItems, translations: getArrayTranslations(t, arrayDefaultTranslations, i18nKeyPrefix, label) });
|
|
1860
2018
|
};
|
|
1861
2019
|
var mapStateToLabelProps = function (state, props) {
|
|
1862
2020
|
var uischema = props.uischema;
|
|
@@ -1895,7 +2053,9 @@ var mapStateToCellProps = function (state, ownProps) {
|
|
|
1895
2053
|
else {
|
|
1896
2054
|
enabled = isInherentlyEnabled(state, ownProps, uischema, schema || rootSchema, rootData, config);
|
|
1897
2055
|
}
|
|
1898
|
-
var
|
|
2056
|
+
var t = getTranslator()(state);
|
|
2057
|
+
var te = getErrorTranslator()(state);
|
|
2058
|
+
var errors = getCombinedErrorMessage(getErrorAt(path, schema)(state), te, t, schema, uischema, path);
|
|
1899
2059
|
var isValid = isEmpty__default["default"](errors);
|
|
1900
2060
|
return {
|
|
1901
2061
|
data: Resolve.data(rootData, path),
|
|
@@ -1910,7 +2070,7 @@ var mapStateToCellProps = function (state, ownProps) {
|
|
|
1910
2070
|
config: getConfig(state),
|
|
1911
2071
|
rootSchema: rootSchema,
|
|
1912
2072
|
renderers: renderers,
|
|
1913
|
-
cells: cells
|
|
2073
|
+
cells: cells,
|
|
1914
2074
|
};
|
|
1915
2075
|
};
|
|
1916
2076
|
var mapStateToDispatchCellProps = function (state, ownProps) {
|
|
@@ -1926,7 +2086,7 @@ var defaultMapStateToEnumCellProps = function (state, ownProps) {
|
|
|
1926
2086
|
return enumToEnumOptionMapper(e, getTranslator()(state), getI18nKeyPrefix(props.schema, props.uischema, props.path));
|
|
1927
2087
|
})) ||
|
|
1928
2088
|
(props.schema.const && [
|
|
1929
|
-
enumToEnumOptionMapper(props.schema.const, getTranslator()(state), getI18nKeyPrefix(props.schema, props.uischema, props.path))
|
|
2089
|
+
enumToEnumOptionMapper(props.schema.const, getTranslator()(state), getI18nKeyPrefix(props.schema, props.uischema, props.path)),
|
|
1930
2090
|
]);
|
|
1931
2091
|
return __assign(__assign({}, props), { options: options });
|
|
1932
2092
|
};
|
|
@@ -1944,7 +2104,7 @@ var defaultMapDispatchToControlProps =
|
|
|
1944
2104
|
function (dispatch, ownProps) {
|
|
1945
2105
|
var handleChange = mapDispatchToCellProps(dispatch).handleChange;
|
|
1946
2106
|
return {
|
|
1947
|
-
handleChange: ownProps.handleChange || handleChange
|
|
2107
|
+
handleChange: ownProps.handleChange || handleChange,
|
|
1948
2108
|
};
|
|
1949
2109
|
};
|
|
1950
2110
|
|
|
@@ -1958,11 +2118,13 @@ var createLabel = function (subSchema, subSchemaIndex, keyword) {
|
|
|
1958
2118
|
};
|
|
1959
2119
|
var createCombinatorRenderInfos = function (combinatorSubSchemas, rootSchema, keyword, control, path, uischemas) {
|
|
1960
2120
|
return combinatorSubSchemas.map(function (subSchema, subSchemaIndex) {
|
|
1961
|
-
var schema = subSchema.$ref
|
|
2121
|
+
var schema = subSchema.$ref
|
|
2122
|
+
? Resolve.schema(rootSchema, subSchema.$ref, rootSchema)
|
|
2123
|
+
: subSchema;
|
|
1962
2124
|
return {
|
|
1963
2125
|
schema: schema,
|
|
1964
2126
|
uischema: findUISchema(uischemas, schema, control.scope, path, undefined, control, rootSchema),
|
|
1965
|
-
label: createLabel(subSchema, subSchemaIndex, keyword)
|
|
2127
|
+
label: createLabel(subSchema, subSchemaIndex, keyword),
|
|
1966
2128
|
};
|
|
1967
2129
|
});
|
|
1968
2130
|
};
|
|
@@ -2001,13 +2163,20 @@ var getFirstPrimitiveProp = function (schema) {
|
|
|
2001
2163
|
}
|
|
2002
2164
|
return undefined;
|
|
2003
2165
|
};
|
|
2166
|
+
var isOneOfEnumSchema = function (schema) {
|
|
2167
|
+
return (schema === null || schema === void 0 ? void 0 : schema.hasOwnProperty('oneOf')) &&
|
|
2168
|
+
(schema === null || schema === void 0 ? void 0 : schema.oneOf) &&
|
|
2169
|
+
schema.oneOf.every(function (s) { return s.const !== undefined; });
|
|
2170
|
+
};
|
|
2004
2171
|
|
|
2005
|
-
var setReadonlyPropertyValue = function (value) {
|
|
2006
|
-
|
|
2007
|
-
child.options
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2172
|
+
var setReadonlyPropertyValue = function (value) {
|
|
2173
|
+
return function (child) {
|
|
2174
|
+
if (!child.options) {
|
|
2175
|
+
child.options = {};
|
|
2176
|
+
}
|
|
2177
|
+
child.options.readonly = value;
|
|
2178
|
+
};
|
|
2179
|
+
};
|
|
2011
2180
|
var setReadonly = function (uischema) {
|
|
2012
2181
|
iterateSchema(uischema, setReadonlyPropertyValue(true));
|
|
2013
2182
|
};
|
|
@@ -2033,11 +2202,11 @@ var createAjv = function (options) {
|
|
|
2033
2202
|
|
|
2034
2203
|
var createLayout = function (layoutType) { return ({
|
|
2035
2204
|
type: layoutType,
|
|
2036
|
-
elements: []
|
|
2205
|
+
elements: [],
|
|
2037
2206
|
}); };
|
|
2038
2207
|
var createControlElement = function (ref) { return ({
|
|
2039
2208
|
type: 'Control',
|
|
2040
|
-
scope: ref
|
|
2209
|
+
scope: ref,
|
|
2041
2210
|
}); };
|
|
2042
2211
|
var wrapInLayoutIfNecessary = function (uischema, layoutType) {
|
|
2043
2212
|
if (!isEmpty__default["default"](uischema) && !isLayout(uischema)) {
|
|
@@ -2056,7 +2225,7 @@ var addLabel = function (layout, labelName) {
|
|
|
2056
2225
|
else {
|
|
2057
2226
|
var label = {
|
|
2058
2227
|
type: 'Label',
|
|
2059
|
-
text: fixedLabel
|
|
2228
|
+
text: fixedLabel,
|
|
2060
2229
|
};
|
|
2061
2230
|
layout.elements.push(label);
|
|
2062
2231
|
}
|
|
@@ -2111,10 +2280,11 @@ var generateUISchema = function (jsonSchema, schemaElements, currentRef, schemaN
|
|
|
2111
2280
|
case 'string':
|
|
2112
2281
|
case 'number':
|
|
2113
2282
|
case 'integer':
|
|
2114
|
-
case 'boolean':
|
|
2283
|
+
case 'boolean': {
|
|
2115
2284
|
var controlObject = createControlElement(currentRef);
|
|
2116
2285
|
schemaElements.push(controlObject);
|
|
2117
2286
|
return controlObject;
|
|
2287
|
+
}
|
|
2118
2288
|
default:
|
|
2119
2289
|
throw new Error('Unknown type: ' + JSON.stringify(jsonSchema));
|
|
2120
2290
|
}
|
|
@@ -2129,11 +2299,11 @@ var generateDefaultUISchema = function (jsonSchema, layoutType, prefix, rootSche
|
|
|
2129
2299
|
var Generate = {
|
|
2130
2300
|
jsonSchema: generateJsonSchema,
|
|
2131
2301
|
uiSchema: generateDefaultUISchema,
|
|
2132
|
-
controlElement: createControlElement
|
|
2302
|
+
controlElement: createControlElement,
|
|
2133
2303
|
};
|
|
2134
2304
|
|
|
2135
2305
|
var INIT = 'jsonforms/INIT';
|
|
2136
|
-
var UPDATE_CORE =
|
|
2306
|
+
var UPDATE_CORE = 'jsonforms/UPDATE_CORE';
|
|
2137
2307
|
var SET_AJV = 'jsonforms/SET_AJV';
|
|
2138
2308
|
var UPDATE_DATA = 'jsonforms/UPDATE';
|
|
2139
2309
|
var UPDATE_ERRORS = 'jsonforms/UPDATE_ERRORS';
|
|
@@ -2143,16 +2313,16 @@ var REMOVE_RENDERER = 'jsonforms/REMOVE_RENDERER';
|
|
|
2143
2313
|
var ADD_CELL = 'jsonforms/ADD_CELL';
|
|
2144
2314
|
var REMOVE_CELL = 'jsonforms/REMOVE_CELL';
|
|
2145
2315
|
var SET_CONFIG = 'jsonforms/SET_CONFIG';
|
|
2146
|
-
var ADD_UI_SCHEMA =
|
|
2147
|
-
var REMOVE_UI_SCHEMA =
|
|
2148
|
-
var SET_SCHEMA =
|
|
2149
|
-
var SET_UISCHEMA =
|
|
2316
|
+
var ADD_UI_SCHEMA = 'jsonforms/ADD_UI_SCHEMA';
|
|
2317
|
+
var REMOVE_UI_SCHEMA = 'jsonforms/REMOVE_UI_SCHEMA';
|
|
2318
|
+
var SET_SCHEMA = 'jsonforms/SET_SCHEMA';
|
|
2319
|
+
var SET_UISCHEMA = 'jsonforms/SET_UISCHEMA';
|
|
2150
2320
|
var SET_VALIDATION_MODE = 'jsonforms/SET_VALIDATION_MODE';
|
|
2151
|
-
var SET_LOCALE =
|
|
2321
|
+
var SET_LOCALE = 'jsonforms/SET_LOCALE';
|
|
2152
2322
|
var SET_TRANSLATOR = 'jsonforms/SET_TRANSLATOR';
|
|
2153
2323
|
var UPDATE_I18N = 'jsonforms/UPDATE_I18N';
|
|
2154
|
-
var ADD_DEFAULT_DATA =
|
|
2155
|
-
var REMOVE_DEFAULT_DATA =
|
|
2324
|
+
var ADD_DEFAULT_DATA = 'jsonforms/ADD_DEFAULT_DATA';
|
|
2325
|
+
var REMOVE_DEFAULT_DATA = 'jsonforms/REMOVE_DEFAULT_DATA';
|
|
2156
2326
|
var init = function (data, schema, uischema, options) {
|
|
2157
2327
|
if (schema === void 0) { schema = generateJsonSchema(data); }
|
|
2158
2328
|
return ({
|
|
@@ -2160,7 +2330,7 @@ var init = function (data, schema, uischema, options) {
|
|
|
2160
2330
|
data: data,
|
|
2161
2331
|
schema: schema,
|
|
2162
2332
|
uischema: typeof uischema === 'object' ? uischema : generateDefaultUISchema(schema),
|
|
2163
|
-
options: options
|
|
2333
|
+
options: options,
|
|
2164
2334
|
});
|
|
2165
2335
|
};
|
|
2166
2336
|
var updateCore = function (data, schema, uischema, options) { return ({
|
|
@@ -2168,93 +2338,93 @@ var updateCore = function (data, schema, uischema, options) { return ({
|
|
|
2168
2338
|
data: data,
|
|
2169
2339
|
schema: schema,
|
|
2170
2340
|
uischema: uischema,
|
|
2171
|
-
options: options
|
|
2341
|
+
options: options,
|
|
2172
2342
|
}); };
|
|
2173
2343
|
var registerDefaultData = function (schemaPath, data) { return ({
|
|
2174
2344
|
type: ADD_DEFAULT_DATA,
|
|
2175
2345
|
schemaPath: schemaPath,
|
|
2176
|
-
data: data
|
|
2346
|
+
data: data,
|
|
2177
2347
|
}); };
|
|
2178
2348
|
var unregisterDefaultData = function (schemaPath) { return ({
|
|
2179
2349
|
type: REMOVE_DEFAULT_DATA,
|
|
2180
|
-
schemaPath: schemaPath
|
|
2350
|
+
schemaPath: schemaPath,
|
|
2181
2351
|
}); };
|
|
2182
2352
|
var setAjv = function (ajv) { return ({
|
|
2183
2353
|
type: SET_AJV,
|
|
2184
|
-
ajv: ajv
|
|
2354
|
+
ajv: ajv,
|
|
2185
2355
|
}); };
|
|
2186
2356
|
var update = function (path, updater) { return ({
|
|
2187
2357
|
type: UPDATE_DATA,
|
|
2188
2358
|
path: path,
|
|
2189
|
-
updater: updater
|
|
2359
|
+
updater: updater,
|
|
2190
2360
|
}); };
|
|
2191
2361
|
var updateErrors = function (errors) { return ({
|
|
2192
2362
|
type: UPDATE_ERRORS,
|
|
2193
|
-
errors: errors
|
|
2363
|
+
errors: errors,
|
|
2194
2364
|
}); };
|
|
2195
2365
|
var registerRenderer = function (tester, renderer) { return ({
|
|
2196
2366
|
type: ADD_RENDERER,
|
|
2197
2367
|
tester: tester,
|
|
2198
|
-
renderer: renderer
|
|
2368
|
+
renderer: renderer,
|
|
2199
2369
|
}); };
|
|
2200
2370
|
var registerCell = function (tester, cell) { return ({
|
|
2201
2371
|
type: ADD_CELL,
|
|
2202
2372
|
tester: tester,
|
|
2203
|
-
cell: cell
|
|
2373
|
+
cell: cell,
|
|
2204
2374
|
}); };
|
|
2205
2375
|
var unregisterCell = function (tester, cell) { return ({
|
|
2206
2376
|
type: REMOVE_CELL,
|
|
2207
2377
|
tester: tester,
|
|
2208
|
-
cell: cell
|
|
2378
|
+
cell: cell,
|
|
2209
2379
|
}); };
|
|
2210
2380
|
var unregisterRenderer = function (tester, renderer) { return ({
|
|
2211
2381
|
type: REMOVE_RENDERER,
|
|
2212
2382
|
tester: tester,
|
|
2213
|
-
renderer: renderer
|
|
2383
|
+
renderer: renderer,
|
|
2214
2384
|
}); };
|
|
2215
2385
|
var setConfig = function (config) { return ({
|
|
2216
2386
|
type: SET_CONFIG,
|
|
2217
|
-
config: config
|
|
2387
|
+
config: config,
|
|
2218
2388
|
}); };
|
|
2219
2389
|
var setValidationMode = function (validationMode) { return ({
|
|
2220
2390
|
type: SET_VALIDATION_MODE,
|
|
2221
|
-
validationMode: validationMode
|
|
2391
|
+
validationMode: validationMode,
|
|
2222
2392
|
}); };
|
|
2223
2393
|
var registerUISchema = function (tester, uischema) {
|
|
2224
2394
|
return {
|
|
2225
2395
|
type: ADD_UI_SCHEMA,
|
|
2226
2396
|
tester: tester,
|
|
2227
|
-
uischema: uischema
|
|
2397
|
+
uischema: uischema,
|
|
2228
2398
|
};
|
|
2229
2399
|
};
|
|
2230
2400
|
var unregisterUISchema = function (tester) {
|
|
2231
2401
|
return {
|
|
2232
2402
|
type: REMOVE_UI_SCHEMA,
|
|
2233
|
-
tester: tester
|
|
2403
|
+
tester: tester,
|
|
2234
2404
|
};
|
|
2235
2405
|
};
|
|
2236
2406
|
var setLocale = function (locale) { return ({
|
|
2237
2407
|
type: SET_LOCALE,
|
|
2238
|
-
locale: locale
|
|
2408
|
+
locale: locale,
|
|
2239
2409
|
}); };
|
|
2240
2410
|
var setSchema = function (schema) { return ({
|
|
2241
2411
|
type: SET_SCHEMA,
|
|
2242
|
-
schema: schema
|
|
2412
|
+
schema: schema,
|
|
2243
2413
|
}); };
|
|
2244
2414
|
var setTranslator = function (translator, errorTranslator) { return ({
|
|
2245
2415
|
type: SET_TRANSLATOR,
|
|
2246
2416
|
translator: translator,
|
|
2247
|
-
errorTranslator: errorTranslator
|
|
2417
|
+
errorTranslator: errorTranslator,
|
|
2248
2418
|
}); };
|
|
2249
2419
|
var updateI18n = function (locale, translator, errorTranslator) { return ({
|
|
2250
2420
|
type: UPDATE_I18N,
|
|
2251
2421
|
locale: locale,
|
|
2252
2422
|
translator: translator,
|
|
2253
|
-
errorTranslator: errorTranslator
|
|
2423
|
+
errorTranslator: errorTranslator,
|
|
2254
2424
|
}); };
|
|
2255
2425
|
var setUISchema = function (uischema) { return ({
|
|
2256
2426
|
type: SET_UISCHEMA,
|
|
2257
|
-
uischema: uischema
|
|
2427
|
+
uischema: uischema,
|
|
2258
2428
|
}); };
|
|
2259
2429
|
|
|
2260
2430
|
var index = /*#__PURE__*/Object.freeze({
|
|
@@ -2304,7 +2474,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
2304
2474
|
|
|
2305
2475
|
var Helpers = {
|
|
2306
2476
|
createLabelDescriptionFrom: createLabelDescriptionFrom,
|
|
2307
|
-
convertToValidClassName: convertToValidClassName
|
|
2477
|
+
convertToValidClassName: convertToValidClassName,
|
|
2308
2478
|
};
|
|
2309
2479
|
|
|
2310
2480
|
exports.ADD_CELL = ADD_CELL;
|
|
@@ -2337,7 +2507,9 @@ exports.UPDATE_DATA = UPDATE_DATA;
|
|
|
2337
2507
|
exports.UPDATE_ERRORS = UPDATE_ERRORS;
|
|
2338
2508
|
exports.UPDATE_I18N = UPDATE_I18N;
|
|
2339
2509
|
exports.VALIDATE = VALIDATE;
|
|
2510
|
+
exports.addI18nKeyToPrefix = addI18nKeyToPrefix;
|
|
2340
2511
|
exports.and = and;
|
|
2512
|
+
exports.arrayDefaultTranslations = arrayDefaultTranslations;
|
|
2341
2513
|
exports.categorizationHasCategory = categorizationHasCategory;
|
|
2342
2514
|
exports.cellReducer = cellReducer;
|
|
2343
2515
|
exports.clearAllIds = clearAllIds;
|
|
@@ -2387,6 +2559,7 @@ exports.formatIs = formatIs;
|
|
|
2387
2559
|
exports.generateDefaultUISchema = generateDefaultUISchema;
|
|
2388
2560
|
exports.generateJsonSchema = generateJsonSchema;
|
|
2389
2561
|
exports.getAjv = getAjv;
|
|
2562
|
+
exports.getArrayTranslations = getArrayTranslations;
|
|
2390
2563
|
exports.getCells = getCells;
|
|
2391
2564
|
exports.getCombinedErrorMessage = getCombinedErrorMessage;
|
|
2392
2565
|
exports.getConfig = getConfig;
|
|
@@ -2440,6 +2613,7 @@ exports.isObjectArrayWithNesting = isObjectArrayWithNesting;
|
|
|
2440
2613
|
exports.isObjectControl = isObjectControl;
|
|
2441
2614
|
exports.isOneOfControl = isOneOfControl;
|
|
2442
2615
|
exports.isOneOfEnumControl = isOneOfEnumControl;
|
|
2616
|
+
exports.isOneOfEnumSchema = isOneOfEnumSchema;
|
|
2443
2617
|
exports.isPrimitiveArrayControl = isPrimitiveArrayControl;
|
|
2444
2618
|
exports.isRangeControl = isRangeControl;
|
|
2445
2619
|
exports.isScopable = isScopable;
|