@jsonforms/core 3.1.0-alpha.1 → 3.1.0-alpha.2
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 +427 -258
- package/lib/jsonforms-core.cjs.js.map +1 -1
- package/lib/jsonforms-core.esm.js +313 -200
- 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/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 +112 -73
- 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 +199 -146
- 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 +1 -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,51 @@ 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
|
+
return false;
|
|
664
|
+
}
|
|
665
|
+
var controlPath = getControlPath(error);
|
|
666
|
+
var result = matchPath(controlPath);
|
|
667
|
+
var parentSchema = error.parentSchema;
|
|
668
|
+
if (result &&
|
|
669
|
+
!isObjectSchema$1(parentSchema) &&
|
|
670
|
+
combinatorPaths.findIndex(function (p) { return instancePath.startsWith(p); }) !== -1) {
|
|
671
|
+
result = result && isEqual__default["default"](parentSchema, schema);
|
|
672
|
+
}
|
|
673
|
+
return result;
|
|
674
|
+
});
|
|
675
|
+
};
|
|
676
|
+
};
|
|
667
677
|
var isObjectSchema$1 = function (schema) {
|
|
668
678
|
return (schema === null || schema === void 0 ? void 0 : schema.type) === 'object' || !!(schema === null || schema === void 0 ? void 0 : schema.properties);
|
|
669
679
|
};
|
|
670
|
-
var filteredErrorKeywords = [
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
680
|
+
var filteredErrorKeywords = [
|
|
681
|
+
'additionalProperties',
|
|
682
|
+
'allOf',
|
|
683
|
+
'anyOf',
|
|
684
|
+
'oneOf',
|
|
685
|
+
];
|
|
686
|
+
var getErrorsAt = function (instancePath, schema, matchPath) {
|
|
687
|
+
return function (state) {
|
|
688
|
+
var _a, _b;
|
|
689
|
+
var errors = (_a = state.errors) !== null && _a !== void 0 ? _a : [];
|
|
690
|
+
var additionalErrors = (_b = state.additionalErrors) !== null && _b !== void 0 ? _b : [];
|
|
691
|
+
return errorsAt(instancePath, schema, matchPath)(state.validationMode === 'ValidateAndHide'
|
|
692
|
+
? additionalErrors
|
|
693
|
+
: __spreadArray(__spreadArray([], errors), additionalErrors));
|
|
694
|
+
};
|
|
695
|
+
};
|
|
677
696
|
var errorAt = function (instancePath, schema) {
|
|
678
697
|
return getErrorsAt(instancePath, schema, function (path) { return path === instancePath; });
|
|
679
698
|
};
|
|
680
699
|
var subErrorsAt = function (instancePath, schema) {
|
|
681
|
-
return getErrorsAt(instancePath, schema, function (path) {
|
|
700
|
+
return getErrorsAt(instancePath, schema, function (path) {
|
|
701
|
+
return path.startsWith(instancePath + '.');
|
|
702
|
+
});
|
|
682
703
|
};
|
|
683
704
|
|
|
684
705
|
var defaultDataReducer = function (state, action) {
|
|
@@ -686,7 +707,7 @@ var defaultDataReducer = function (state, action) {
|
|
|
686
707
|
switch (action.type) {
|
|
687
708
|
case ADD_DEFAULT_DATA:
|
|
688
709
|
return state.concat([
|
|
689
|
-
{ schemaPath: action.schemaPath, data: action.data }
|
|
710
|
+
{ schemaPath: action.schemaPath, data: action.data },
|
|
690
711
|
]);
|
|
691
712
|
case REMOVE_DEFAULT_DATA:
|
|
692
713
|
return state.filter(function (t) { return t.schemaPath !== action.schemaPath; });
|
|
@@ -713,6 +734,9 @@ var getI18nKeyPrefix = function (schema, uischema, path) {
|
|
|
713
734
|
var getI18nKey = function (schema, uischema, path, key) {
|
|
714
735
|
return getI18nKeyPrefix(schema, uischema, path) + "." + key;
|
|
715
736
|
};
|
|
737
|
+
var addI18nKeyToPrefix = function (i18nKeyPrefix, key) {
|
|
738
|
+
return i18nKeyPrefix + "." + key;
|
|
739
|
+
};
|
|
716
740
|
var defaultTranslator = function (_id, defaultMessage) { return defaultMessage; };
|
|
717
741
|
var defaultErrorTranslator = function (error, t, uischema) {
|
|
718
742
|
var _a;
|
|
@@ -721,7 +745,9 @@ var defaultErrorTranslator = function (error, t, uischema) {
|
|
|
721
745
|
if (specializedKeywordMessage !== undefined) {
|
|
722
746
|
return specializedKeywordMessage;
|
|
723
747
|
}
|
|
724
|
-
var genericKeywordMessage = t("error." + error.keyword, undefined, {
|
|
748
|
+
var genericKeywordMessage = t("error." + error.keyword, undefined, {
|
|
749
|
+
error: error,
|
|
750
|
+
});
|
|
725
751
|
if (genericKeywordMessage !== undefined) {
|
|
726
752
|
return genericKeywordMessage;
|
|
727
753
|
}
|
|
@@ -729,7 +755,8 @@ var defaultErrorTranslator = function (error, t, uischema) {
|
|
|
729
755
|
if (messageCustomization !== undefined) {
|
|
730
756
|
return messageCustomization;
|
|
731
757
|
}
|
|
732
|
-
if (error.keyword === 'required' &&
|
|
758
|
+
if (error.keyword === 'required' &&
|
|
759
|
+
((_a = error.message) === null || _a === void 0 ? void 0 : _a.startsWith('must have required property'))) {
|
|
733
760
|
return t('is a required property', 'is a required property', { error: error });
|
|
734
761
|
}
|
|
735
762
|
return error.message;
|
|
@@ -737,7 +764,12 @@ var defaultErrorTranslator = function (error, t, uischema) {
|
|
|
737
764
|
var getCombinedErrorMessage = function (errors, et, t, schema, uischema, path) {
|
|
738
765
|
if (errors.length > 0 && t) {
|
|
739
766
|
var customErrorKey = getI18nKey(schema, uischema, path, 'error.custom');
|
|
740
|
-
var specializedErrorMessage = t(customErrorKey, undefined, {
|
|
767
|
+
var specializedErrorMessage = t(customErrorKey, undefined, {
|
|
768
|
+
schema: schema,
|
|
769
|
+
uischema: uischema,
|
|
770
|
+
path: path,
|
|
771
|
+
errors: errors,
|
|
772
|
+
});
|
|
741
773
|
if (specializedErrorMessage !== undefined) {
|
|
742
774
|
return specializedErrorMessage;
|
|
743
775
|
}
|
|
@@ -748,19 +780,80 @@ var deriveLabelForUISchemaElement = function (uischema, t) {
|
|
|
748
780
|
if (uischema.label === false) {
|
|
749
781
|
return undefined;
|
|
750
782
|
}
|
|
751
|
-
if ((uischema.label === undefined ||
|
|
783
|
+
if ((uischema.label === undefined ||
|
|
784
|
+
uischema.label === null ||
|
|
785
|
+
uischema.label === true) &&
|
|
786
|
+
!isInternationalized(uischema)) {
|
|
752
787
|
return undefined;
|
|
753
788
|
}
|
|
754
|
-
var stringifiedLabel = typeof uischema.label === 'string'
|
|
789
|
+
var stringifiedLabel = typeof uischema.label === 'string'
|
|
790
|
+
? uischema.label
|
|
791
|
+
: JSON.stringify(uischema.label);
|
|
755
792
|
var i18nKeyPrefix = getI18nKeyPrefixBySchema(undefined, uischema);
|
|
756
|
-
var i18nKey = typeof i18nKeyPrefix === 'string'
|
|
793
|
+
var i18nKey = typeof i18nKeyPrefix === 'string'
|
|
794
|
+
? i18nKeyPrefix + ".label"
|
|
795
|
+
: stringifiedLabel;
|
|
757
796
|
return t(i18nKey, stringifiedLabel, { uischema: uischema });
|
|
758
797
|
};
|
|
798
|
+
var getArrayTranslations = function (t, defaultTranslations, i18nKeyPrefix, label) {
|
|
799
|
+
var translations = {};
|
|
800
|
+
defaultTranslations.forEach(function (controlElement) {
|
|
801
|
+
var key = addI18nKeyToPrefix(i18nKeyPrefix, controlElement.key);
|
|
802
|
+
translations[controlElement.key] = t(key, controlElement.default(label));
|
|
803
|
+
});
|
|
804
|
+
return translations;
|
|
805
|
+
};
|
|
806
|
+
|
|
807
|
+
exports.ArrayTranslationEnum = void 0;
|
|
808
|
+
(function (ArrayTranslationEnum) {
|
|
809
|
+
ArrayTranslationEnum["addTooltip"] = "addTooltip";
|
|
810
|
+
ArrayTranslationEnum["addAriaLabel"] = "addAriaLabel";
|
|
811
|
+
ArrayTranslationEnum["removeTooltip"] = "removeTooltip";
|
|
812
|
+
ArrayTranslationEnum["upAriaLabel"] = "upAriaLabel";
|
|
813
|
+
ArrayTranslationEnum["downAriaLabel"] = "downAriaLabel";
|
|
814
|
+
ArrayTranslationEnum["noSelection"] = "noSelection";
|
|
815
|
+
ArrayTranslationEnum["removeAriaLabel"] = "removeAriaLabel";
|
|
816
|
+
ArrayTranslationEnum["noDataMessage"] = "noDataMessage";
|
|
817
|
+
ArrayTranslationEnum["deleteDialogTitle"] = "deleteDialogTitle";
|
|
818
|
+
ArrayTranslationEnum["deleteDialogMessage"] = "deleteDialogMessage";
|
|
819
|
+
ArrayTranslationEnum["deleteDialogAccept"] = "deleteDialogAccept";
|
|
820
|
+
ArrayTranslationEnum["deleteDialogDecline"] = "deleteDialogDecline";
|
|
821
|
+
ArrayTranslationEnum["up"] = "up";
|
|
822
|
+
ArrayTranslationEnum["down"] = "down";
|
|
823
|
+
})(exports.ArrayTranslationEnum || (exports.ArrayTranslationEnum = {}));
|
|
824
|
+
var arrayDefaultTranslations = [
|
|
825
|
+
{
|
|
826
|
+
key: exports.ArrayTranslationEnum.addTooltip,
|
|
827
|
+
default: function (input) { return (input ? "Add to " + input : 'Add'); },
|
|
828
|
+
},
|
|
829
|
+
{
|
|
830
|
+
key: exports.ArrayTranslationEnum.addAriaLabel,
|
|
831
|
+
default: function (input) { return (input ? "Add to " + input + " button" : 'Add button'); },
|
|
832
|
+
},
|
|
833
|
+
{ key: exports.ArrayTranslationEnum.removeTooltip, default: function () { return 'Delete'; } },
|
|
834
|
+
{ key: exports.ArrayTranslationEnum.removeAriaLabel, default: function () { return 'Delete button'; } },
|
|
835
|
+
{ key: exports.ArrayTranslationEnum.upAriaLabel, default: function () { return "Move item up"; } },
|
|
836
|
+
{ key: exports.ArrayTranslationEnum.up, default: function () { return 'Up'; } },
|
|
837
|
+
{ key: exports.ArrayTranslationEnum.down, default: function () { return 'Down'; } },
|
|
838
|
+
{ key: exports.ArrayTranslationEnum.downAriaLabel, default: function () { return "Move item down"; } },
|
|
839
|
+
{ key: exports.ArrayTranslationEnum.noDataMessage, default: function () { return 'No data'; } },
|
|
840
|
+
{ key: exports.ArrayTranslationEnum.noSelection, default: function () { return 'No selection'; } },
|
|
841
|
+
{
|
|
842
|
+
key: exports.ArrayTranslationEnum.deleteDialogTitle,
|
|
843
|
+
default: function () { return 'Confirm Deletion'; },
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
key: exports.ArrayTranslationEnum.deleteDialogMessage,
|
|
847
|
+
default: function () { return 'Are you sure you want to delete the selected entry?'; },
|
|
848
|
+
},
|
|
849
|
+
{ key: exports.ArrayTranslationEnum.deleteDialogAccept, default: function () { return 'Yes'; } },
|
|
850
|
+
{ key: exports.ArrayTranslationEnum.deleteDialogDecline, default: function () { return 'No'; } },
|
|
851
|
+
];
|
|
759
852
|
|
|
760
853
|
var defaultJsonFormsI18nState = {
|
|
761
854
|
locale: 'en',
|
|
762
855
|
translate: defaultTranslator,
|
|
763
|
-
translateError: defaultErrorTranslator
|
|
856
|
+
translateError: defaultErrorTranslator,
|
|
764
857
|
};
|
|
765
858
|
var i18nReducer = function (state, action) {
|
|
766
859
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -811,7 +904,7 @@ var rendererReducer = function (state, action) {
|
|
|
811
904
|
switch (action.type) {
|
|
812
905
|
case ADD_RENDERER:
|
|
813
906
|
return state.concat([
|
|
814
|
-
{ tester: action.tester, renderer: action.renderer }
|
|
907
|
+
{ tester: action.tester, renderer: action.renderer },
|
|
815
908
|
]);
|
|
816
909
|
case REMOVE_RENDERER:
|
|
817
910
|
return state.filter(function (t) { return t.tester !== action.tester; });
|
|
@@ -824,41 +917,45 @@ var NOT_APPLICABLE = -1;
|
|
|
824
917
|
var isControl = function (uischema) {
|
|
825
918
|
return !isEmpty__default["default"](uischema) && uischema.scope !== undefined;
|
|
826
919
|
};
|
|
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
|
-
|
|
920
|
+
var schemaMatches = function (predicate) {
|
|
921
|
+
return function (uischema, schema, context) {
|
|
922
|
+
if (isEmpty__default["default"](uischema) || !isControl(uischema)) {
|
|
923
|
+
return false;
|
|
924
|
+
}
|
|
925
|
+
if (isEmpty__default["default"](schema)) {
|
|
926
|
+
return false;
|
|
927
|
+
}
|
|
928
|
+
var schemaPath = uischema.scope;
|
|
929
|
+
if (isEmpty__default["default"](schemaPath)) {
|
|
930
|
+
return false;
|
|
931
|
+
}
|
|
932
|
+
var currentDataSchema = schema;
|
|
933
|
+
if (hasType(schema, 'object')) {
|
|
934
|
+
currentDataSchema = resolveSchema(schema, schemaPath, context === null || context === void 0 ? void 0 : context.rootSchema);
|
|
935
|
+
}
|
|
936
|
+
if (currentDataSchema === undefined) {
|
|
937
|
+
return false;
|
|
938
|
+
}
|
|
939
|
+
return predicate(currentDataSchema, context === null || context === void 0 ? void 0 : context.rootSchema);
|
|
940
|
+
};
|
|
941
|
+
};
|
|
942
|
+
var schemaSubPathMatches = function (subPath, predicate) {
|
|
943
|
+
return function (uischema, schema, context) {
|
|
944
|
+
if (isEmpty__default["default"](uischema) || !isControl(uischema)) {
|
|
945
|
+
return false;
|
|
946
|
+
}
|
|
947
|
+
var schemaPath = uischema.scope;
|
|
948
|
+
var currentDataSchema = schema;
|
|
949
|
+
if (hasType(schema, 'object')) {
|
|
950
|
+
currentDataSchema = resolveSchema(schema, schemaPath, context === null || context === void 0 ? void 0 : context.rootSchema);
|
|
951
|
+
}
|
|
952
|
+
currentDataSchema = get__default["default"](currentDataSchema, subPath);
|
|
953
|
+
if (currentDataSchema === undefined) {
|
|
954
|
+
return false;
|
|
955
|
+
}
|
|
956
|
+
return predicate(currentDataSchema, context === null || context === void 0 ? void 0 : context.rootSchema);
|
|
957
|
+
};
|
|
958
|
+
};
|
|
862
959
|
var schemaTypeIs = function (expectedType) {
|
|
863
960
|
return schemaMatches(function (schema) { return !isEmpty__default["default"](schema) && hasType(schema, expectedType); });
|
|
864
961
|
};
|
|
@@ -869,54 +966,72 @@ var formatIs = function (expectedFormat) {
|
|
|
869
966
|
hasType(schema, 'string');
|
|
870
967
|
});
|
|
871
968
|
};
|
|
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
|
-
};
|
|
969
|
+
var uiTypeIs = function (expected) {
|
|
970
|
+
return function (uischema) {
|
|
971
|
+
return !isEmpty__default["default"](uischema) && uischema.type === expected;
|
|
972
|
+
};
|
|
973
|
+
};
|
|
974
|
+
var optionIs = function (optionName, optionValue) {
|
|
975
|
+
return function (uischema) {
|
|
976
|
+
if (isEmpty__default["default"](uischema)) {
|
|
977
|
+
return false;
|
|
978
|
+
}
|
|
979
|
+
var options = uischema.options;
|
|
980
|
+
return !isEmpty__default["default"](options) && options[optionName] === optionValue;
|
|
981
|
+
};
|
|
982
|
+
};
|
|
983
|
+
var scopeEndsWith = function (expected) {
|
|
984
|
+
return function (uischema) {
|
|
985
|
+
if (isEmpty__default["default"](expected) || !isControl(uischema)) {
|
|
986
|
+
return false;
|
|
987
|
+
}
|
|
988
|
+
return endsWith__default["default"](uischema.scope, expected);
|
|
989
|
+
};
|
|
990
|
+
};
|
|
991
|
+
var scopeEndIs = function (expected) {
|
|
992
|
+
return function (uischema) {
|
|
993
|
+
if (isEmpty__default["default"](expected) || !isControl(uischema)) {
|
|
994
|
+
return false;
|
|
995
|
+
}
|
|
996
|
+
var schemaPath = uischema.scope;
|
|
997
|
+
return !isEmpty__default["default"](schemaPath) && last__default["default"](schemaPath.split('/')) === expected;
|
|
998
|
+
};
|
|
999
|
+
};
|
|
893
1000
|
var and = function () {
|
|
894
1001
|
var testers = [];
|
|
895
1002
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
896
1003
|
testers[_i] = arguments[_i];
|
|
897
1004
|
}
|
|
898
|
-
return function (uischema, schema, context) {
|
|
1005
|
+
return function (uischema, schema, context) {
|
|
1006
|
+
return testers.reduce(function (acc, tester) { return acc && tester(uischema, schema, context); }, true);
|
|
1007
|
+
};
|
|
899
1008
|
};
|
|
900
1009
|
var or = function () {
|
|
901
1010
|
var testers = [];
|
|
902
1011
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
903
1012
|
testers[_i] = arguments[_i];
|
|
904
1013
|
}
|
|
905
|
-
return function (uischema, schema, context) {
|
|
1014
|
+
return function (uischema, schema, context) {
|
|
1015
|
+
return testers.reduce(function (acc, tester) { return acc || tester(uischema, schema, context); }, false);
|
|
1016
|
+
};
|
|
906
1017
|
};
|
|
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) {
|
|
1018
|
+
var rankWith = function (rank, tester) {
|
|
1019
|
+
return function (uischema, schema, context) {
|
|
1020
|
+
if (tester(uischema, schema, context)) {
|
|
1021
|
+
return rank;
|
|
1022
|
+
}
|
|
916
1023
|
return NOT_APPLICABLE;
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
|
|
1024
|
+
};
|
|
1025
|
+
};
|
|
1026
|
+
var withIncreasedRank = function (by, rankedTester) {
|
|
1027
|
+
return function (uischema, schema, context) {
|
|
1028
|
+
var rank = rankedTester(uischema, schema, context);
|
|
1029
|
+
if (rank === NOT_APPLICABLE) {
|
|
1030
|
+
return NOT_APPLICABLE;
|
|
1031
|
+
}
|
|
1032
|
+
return rank + by;
|
|
1033
|
+
};
|
|
1034
|
+
};
|
|
920
1035
|
var isBooleanControl = and(uiTypeIs('Control'), schemaTypeIs('boolean'));
|
|
921
1036
|
var isObjectControl = and(uiTypeIs('Control'), schemaTypeIs('object'));
|
|
922
1037
|
var isAllOfControl = and(uiTypeIs('Control'), schemaMatches(function (schema) { return schema.hasOwnProperty('allOf'); }));
|
|
@@ -934,9 +1049,14 @@ var isMultiLineControl = and(uiTypeIs('Control'), optionIs('multi', true));
|
|
|
934
1049
|
var isDateControl = and(uiTypeIs('Control'), or(formatIs('date'), optionIs('format', 'date')));
|
|
935
1050
|
var isTimeControl = and(uiTypeIs('Control'), or(formatIs('time'), optionIs('format', 'time')));
|
|
936
1051
|
var isDateTimeControl = and(uiTypeIs('Control'), or(formatIs('date-time'), optionIs('format', 'date-time')));
|
|
937
|
-
var isObjectArray = and(schemaMatches(function (schema, rootSchema) {
|
|
1052
|
+
var isObjectArray = and(schemaMatches(function (schema, rootSchema) {
|
|
1053
|
+
return hasType(schema, 'array') &&
|
|
1054
|
+
!Array.isArray(resolveSchema(schema, 'items', rootSchema));
|
|
1055
|
+
}
|
|
938
1056
|
), schemaSubPathMatches('items', function (schema, rootSchema) {
|
|
939
|
-
var resolvedSchema = schema.$ref
|
|
1057
|
+
var resolvedSchema = schema.$ref
|
|
1058
|
+
? resolveSchema(rootSchema, schema.$ref, rootSchema)
|
|
1059
|
+
: schema;
|
|
940
1060
|
return hasType(resolvedSchema, 'object');
|
|
941
1061
|
}));
|
|
942
1062
|
var isObjectArrayControl = and(uiTypeIs('Control'), isObjectArray);
|
|
@@ -980,7 +1100,10 @@ var isObjectArrayWithNesting = function (uischema, schema, context) {
|
|
|
980
1100
|
if (val.$ref !== undefined) {
|
|
981
1101
|
return false;
|
|
982
1102
|
}
|
|
983
|
-
if (val.anyOf || val.
|
|
1103
|
+
if (val.anyOf || val.allOf) {
|
|
1104
|
+
return true;
|
|
1105
|
+
}
|
|
1106
|
+
if (val.oneOf && !isOneOfEnumControl(uischema, val, context)) {
|
|
984
1107
|
return true;
|
|
985
1108
|
}
|
|
986
1109
|
if (hasType(val, 'object')) {
|
|
@@ -1014,7 +1137,9 @@ var isPrimitiveArrayControl = and(uiTypeIs('Control'), schemaMatches(function (s
|
|
|
1014
1137
|
!Array.isArray(resolveSchema(schema, 'items', rootSchema));
|
|
1015
1138
|
}
|
|
1016
1139
|
), schemaSubPathMatches('items', function (schema, rootSchema) {
|
|
1017
|
-
var resolvedSchema = schema.$ref
|
|
1140
|
+
var resolvedSchema = schema.$ref
|
|
1141
|
+
? resolveSchema(rootSchema, schema.$ref, rootSchema)
|
|
1142
|
+
: schema;
|
|
1018
1143
|
var types = deriveTypes(resolvedSchema);
|
|
1019
1144
|
return (types.length === 1 &&
|
|
1020
1145
|
includes__default["default"](['integer', 'number', 'boolean', 'string'], types[0]));
|
|
@@ -1042,7 +1167,11 @@ var hasCategory = function (categorization) {
|
|
|
1042
1167
|
var categorizationHasCategory = function (uischema) {
|
|
1043
1168
|
return hasCategory(uischema);
|
|
1044
1169
|
};
|
|
1045
|
-
var not = function (tester) {
|
|
1170
|
+
var not = function (tester) {
|
|
1171
|
+
return function (uischema, schema, context) {
|
|
1172
|
+
return !tester(uischema, schema, context);
|
|
1173
|
+
};
|
|
1174
|
+
};
|
|
1046
1175
|
|
|
1047
1176
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
1048
1177
|
__proto__: null,
|
|
@@ -1095,24 +1224,27 @@ var uischemaRegistryReducer = function (state, action) {
|
|
|
1095
1224
|
return state
|
|
1096
1225
|
.slice()
|
|
1097
1226
|
.concat({ tester: action.tester, uischema: action.uischema });
|
|
1098
|
-
case REMOVE_UI_SCHEMA:
|
|
1227
|
+
case REMOVE_UI_SCHEMA: {
|
|
1099
1228
|
var copy = state.slice();
|
|
1100
1229
|
remove__default["default"](copy, function (entry) { return entry.tester === action.tester; });
|
|
1101
1230
|
return copy;
|
|
1231
|
+
}
|
|
1102
1232
|
default:
|
|
1103
1233
|
return state;
|
|
1104
1234
|
}
|
|
1105
1235
|
};
|
|
1106
|
-
var findMatchingUISchema = function (state) {
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
match
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1236
|
+
var findMatchingUISchema = function (state) {
|
|
1237
|
+
return function (jsonSchema, schemaPath, path) {
|
|
1238
|
+
var match = maxBy__default["default"](state, function (entry) {
|
|
1239
|
+
return entry.tester(jsonSchema, schemaPath, path);
|
|
1240
|
+
});
|
|
1241
|
+
if (match !== undefined &&
|
|
1242
|
+
match.tester(jsonSchema, schemaPath, path) !== NOT_APPLICABLE) {
|
|
1243
|
+
return match.uischema;
|
|
1244
|
+
}
|
|
1245
|
+
return undefined;
|
|
1246
|
+
};
|
|
1247
|
+
};
|
|
1116
1248
|
|
|
1117
1249
|
var jsonFormsReducerConfig = {
|
|
1118
1250
|
core: coreReducer,
|
|
@@ -1128,7 +1260,7 @@ var findUISchema = function (uischemas, schema, schemaPath, path, fallback, cont
|
|
|
1128
1260
|
if (control && control.options && control.options.detail) {
|
|
1129
1261
|
if (typeof control.options.detail === 'string') {
|
|
1130
1262
|
if (control.options.detail.toUpperCase() === 'GENERATE') {
|
|
1131
|
-
if (typeof fallback ===
|
|
1263
|
+
if (typeof fallback === 'function') {
|
|
1132
1264
|
return fallback();
|
|
1133
1265
|
}
|
|
1134
1266
|
return Generate.uiSchema(schema, fallback);
|
|
@@ -1153,13 +1285,23 @@ var findUISchema = function (uischemas, schema, schemaPath, path, fallback, cont
|
|
|
1153
1285
|
var getErrorAt = function (instancePath, schema) { return function (state) {
|
|
1154
1286
|
return errorAt(instancePath, schema)(state.jsonforms.core);
|
|
1155
1287
|
}; };
|
|
1156
|
-
var getSubErrorsAt = function (instancePath, schema) { return function (state) {
|
|
1288
|
+
var getSubErrorsAt = function (instancePath, schema) { return function (state) {
|
|
1289
|
+
return subErrorsAt(instancePath, schema)(state.jsonforms.core);
|
|
1290
|
+
}; };
|
|
1157
1291
|
var getConfig = function (state) { return state.jsonforms.config; };
|
|
1158
1292
|
var getLocale = function (state) {
|
|
1159
1293
|
return fetchLocale(get__default["default"](state, 'jsonforms.i18n'));
|
|
1160
1294
|
};
|
|
1161
|
-
var getTranslator = function () {
|
|
1162
|
-
|
|
1295
|
+
var getTranslator = function () {
|
|
1296
|
+
return function (state) {
|
|
1297
|
+
return fetchTranslator(get__default["default"](state, 'jsonforms.i18n'));
|
|
1298
|
+
};
|
|
1299
|
+
};
|
|
1300
|
+
var getErrorTranslator = function () {
|
|
1301
|
+
return function (state) {
|
|
1302
|
+
return fetchErrorTranslator(get__default["default"](state, 'jsonforms.i18n'));
|
|
1303
|
+
};
|
|
1304
|
+
};
|
|
1163
1305
|
|
|
1164
1306
|
var getData = function (state) {
|
|
1165
1307
|
return extractData(get__default["default"](state, 'jsonforms.core'));
|
|
@@ -1170,7 +1312,9 @@ var getSchema = function (state) {
|
|
|
1170
1312
|
var getUiSchema = function (state) {
|
|
1171
1313
|
return extractUiSchema(get__default["default"](state, 'jsonforms.core'));
|
|
1172
1314
|
};
|
|
1173
|
-
var getAjv = function (state) {
|
|
1315
|
+
var getAjv = function (state) {
|
|
1316
|
+
return extractAjv(get__default["default"](state, 'jsonforms.core'));
|
|
1317
|
+
};
|
|
1174
1318
|
var getDefaultData = function (state) {
|
|
1175
1319
|
return extractDefaultData(get__default["default"](state, 'jsonforms.defaultData'));
|
|
1176
1320
|
};
|
|
@@ -1216,8 +1360,12 @@ var composeWithUi = function (scopableUi, path) {
|
|
|
1216
1360
|
}
|
|
1217
1361
|
return compose(path, segments.join('.'));
|
|
1218
1362
|
};
|
|
1219
|
-
var encode = function (segment) {
|
|
1220
|
-
|
|
1363
|
+
var encode = function (segment) {
|
|
1364
|
+
return segment === null || segment === void 0 ? void 0 : segment.replace(/~/g, '~0').replace(/\//g, '~1');
|
|
1365
|
+
};
|
|
1366
|
+
var decode = function (pointerSegment) {
|
|
1367
|
+
return pointerSegment === null || pointerSegment === void 0 ? void 0 : pointerSegment.replace(/~1/g, '/').replace(/~0/, '~');
|
|
1368
|
+
};
|
|
1221
1369
|
|
|
1222
1370
|
var isObjectSchema = function (schema) {
|
|
1223
1371
|
return schema.properties !== undefined;
|
|
@@ -1230,9 +1378,7 @@ var resolveData = function (instance, dataPath) {
|
|
|
1230
1378
|
return instance;
|
|
1231
1379
|
}
|
|
1232
1380
|
var dataPathSegments = dataPath.split('.');
|
|
1233
|
-
return dataPathSegments
|
|
1234
|
-
.map(function (segment) { return decodeURIComponent(segment); })
|
|
1235
|
-
.reduce(function (curInstance, decodedSegment) {
|
|
1381
|
+
return dataPathSegments.reduce(function (curInstance, decodedSegment) {
|
|
1236
1382
|
if (!curInstance || !curInstance.hasOwnProperty(decodedSegment)) {
|
|
1237
1383
|
return undefined;
|
|
1238
1384
|
}
|
|
@@ -1467,14 +1613,14 @@ var deriveTypes = function (jsonSchema) {
|
|
|
1467
1613
|
};
|
|
1468
1614
|
var Resolve = {
|
|
1469
1615
|
schema: resolveSchema,
|
|
1470
|
-
data: resolveData
|
|
1616
|
+
data: resolveData,
|
|
1471
1617
|
};
|
|
1472
1618
|
var fromScoped = function (scopable) {
|
|
1473
1619
|
return toDataPathSegments(scopable.scope).join('.');
|
|
1474
1620
|
};
|
|
1475
1621
|
var Paths = {
|
|
1476
1622
|
compose: compose,
|
|
1477
|
-
fromScoped: fromScoped
|
|
1623
|
+
fromScoped: fromScoped,
|
|
1478
1624
|
};
|
|
1479
1625
|
var Runtime = {
|
|
1480
1626
|
isEnabled: function (uischema, data, ajv) {
|
|
@@ -1482,7 +1628,7 @@ var Runtime = {
|
|
|
1482
1628
|
},
|
|
1483
1629
|
isVisible: function (uischema, data, ajv) {
|
|
1484
1630
|
return isVisible(uischema, data, undefined, ajv);
|
|
1485
|
-
}
|
|
1631
|
+
},
|
|
1486
1632
|
};
|
|
1487
1633
|
|
|
1488
1634
|
var deriveLabel = function (controlElement, schemaElement) {
|
|
@@ -1518,7 +1664,7 @@ var createLabelDescriptionFrom = function (withLabel, schema) {
|
|
|
1518
1664
|
};
|
|
1519
1665
|
var labelDescription = function (text, show) { return ({
|
|
1520
1666
|
text: text,
|
|
1521
|
-
show: show
|
|
1667
|
+
show: show,
|
|
1522
1668
|
}); };
|
|
1523
1669
|
|
|
1524
1670
|
var isRequired = function (schema, schemaPath, rootSchema) {
|
|
@@ -1618,7 +1764,13 @@ var mapStateToControlProps = function (state, ownProps) {
|
|
|
1618
1764
|
var schema = resolvedSchema !== null && resolvedSchema !== void 0 ? resolvedSchema : rootSchema;
|
|
1619
1765
|
var t = getTranslator()(state);
|
|
1620
1766
|
var te = getErrorTranslator()(state);
|
|
1621
|
-
var
|
|
1767
|
+
var i18nKeyPrefix = getI18nKeyPrefix(schema, uischema, path);
|
|
1768
|
+
var i18nLabel = t(getI18nKey(schema, uischema, path, 'label'), label, {
|
|
1769
|
+
schema: schema,
|
|
1770
|
+
uischema: uischema,
|
|
1771
|
+
path: path,
|
|
1772
|
+
errors: errors,
|
|
1773
|
+
});
|
|
1622
1774
|
var i18nDescription = t(getI18nKey(schema, uischema, path, 'description'), description, { schema: schema, uischema: uischema, path: path, errors: errors });
|
|
1623
1775
|
var i18nErrorMessage = getCombinedErrorMessage(errors, te, t, schema, uischema, path);
|
|
1624
1776
|
return {
|
|
@@ -1635,13 +1787,14 @@ var mapStateToControlProps = function (state, ownProps) {
|
|
|
1635
1787
|
schema: schema,
|
|
1636
1788
|
config: getConfig(state),
|
|
1637
1789
|
cells: ownProps.cells || state.jsonforms.cells,
|
|
1638
|
-
rootSchema: rootSchema
|
|
1790
|
+
rootSchema: rootSchema,
|
|
1791
|
+
i18nKeyPrefix: i18nKeyPrefix,
|
|
1639
1792
|
};
|
|
1640
1793
|
};
|
|
1641
1794
|
var mapDispatchToControlProps = function (dispatch) { return ({
|
|
1642
1795
|
handleChange: function (path, value) {
|
|
1643
1796
|
dispatch(update(path, function () { return value; }));
|
|
1644
|
-
}
|
|
1797
|
+
},
|
|
1645
1798
|
}); };
|
|
1646
1799
|
var mapStateToEnumControlProps = function (state, ownProps) {
|
|
1647
1800
|
var _a;
|
|
@@ -1651,7 +1804,7 @@ var mapStateToEnumControlProps = function (state, ownProps) {
|
|
|
1651
1804
|
return enumToEnumOptionMapper(e, getTranslator()(state), getI18nKeyPrefix(props.schema, props.uischema, props.path));
|
|
1652
1805
|
})) ||
|
|
1653
1806
|
(props.schema.const && [
|
|
1654
|
-
enumToEnumOptionMapper(props.schema.const, getTranslator()(state), getI18nKeyPrefix(props.schema, props.uischema, props.path))
|
|
1807
|
+
enumToEnumOptionMapper(props.schema.const, getTranslator()(state), getI18nKeyPrefix(props.schema, props.uischema, props.path)),
|
|
1655
1808
|
]);
|
|
1656
1809
|
return __assign(__assign({}, props), { options: options });
|
|
1657
1810
|
};
|
|
@@ -1700,11 +1853,13 @@ var mapStateToControlWithDetailProps = function (state, ownProps) {
|
|
|
1700
1853
|
return __assign(__assign({}, props), { uischemas: state.jsonforms.uischemas });
|
|
1701
1854
|
};
|
|
1702
1855
|
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"]);
|
|
1856
|
+
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
1857
|
var resolvedSchema = Resolve.schema(schema, 'items', props.rootSchema);
|
|
1705
1858
|
var childErrors = getSubErrorsAt(path, resolvedSchema)(state);
|
|
1706
|
-
|
|
1707
|
-
|
|
1859
|
+
var t = getTranslator()(state);
|
|
1860
|
+
return __assign(__assign({}, props), { label: label,
|
|
1861
|
+
path: path,
|
|
1862
|
+
uischema: uischema, schema: resolvedSchema, childErrors: childErrors, renderers: ownProps.renderers || getRenderers(state), cells: ownProps.cells || getCells(state), translations: getArrayTranslations(t, arrayDefaultTranslations, i18nKeyPrefix, label) });
|
|
1708
1863
|
};
|
|
1709
1864
|
var mapDispatchToArrayControlProps = function (dispatch) { return ({
|
|
1710
1865
|
addItem: function (path, value) { return function () {
|
|
@@ -1736,7 +1891,7 @@ var mapDispatchToArrayControlProps = function (dispatch) { return ({
|
|
|
1736
1891
|
moveDown(array, toMove);
|
|
1737
1892
|
return array;
|
|
1738
1893
|
}));
|
|
1739
|
-
}; }
|
|
1894
|
+
}; },
|
|
1740
1895
|
}); };
|
|
1741
1896
|
var mapDispatchToMultiEnumProps = function (dispatch) { return ({
|
|
1742
1897
|
addItem: function (path, value) {
|
|
@@ -1754,13 +1909,13 @@ var mapDispatchToMultiEnumProps = function (dispatch) { return ({
|
|
|
1754
1909
|
data.splice(indexInData, 1);
|
|
1755
1910
|
return data;
|
|
1756
1911
|
}));
|
|
1757
|
-
}
|
|
1912
|
+
},
|
|
1758
1913
|
}); };
|
|
1759
1914
|
var layoutDefaultProps = {
|
|
1760
1915
|
visible: true,
|
|
1761
1916
|
enabled: true,
|
|
1762
1917
|
path: '',
|
|
1763
|
-
direction: 'column'
|
|
1918
|
+
direction: 'column',
|
|
1764
1919
|
};
|
|
1765
1920
|
var getDirection = function (uischema) {
|
|
1766
1921
|
if (uischema.type === 'HorizontalLayout') {
|
|
@@ -1783,7 +1938,9 @@ var mapStateToLayoutProps = function (state, ownProps) {
|
|
|
1783
1938
|
var enabled = isInherentlyEnabled(state, ownProps, uischema, undefined,
|
|
1784
1939
|
rootData, config);
|
|
1785
1940
|
var t = getTranslator()(state);
|
|
1786
|
-
var label = isLabelable(uischema)
|
|
1941
|
+
var label = isLabelable(uischema)
|
|
1942
|
+
? deriveLabelForUISchemaElement(uischema, t)
|
|
1943
|
+
: undefined;
|
|
1787
1944
|
return __assign(__assign({}, layoutDefaultProps), { renderers: ownProps.renderers || getRenderers(state), cells: ownProps.cells || getCells(state), visible: visible,
|
|
1788
1945
|
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
1946
|
label: label });
|
|
@@ -1797,7 +1954,7 @@ var mapStateToJsonFormsRendererProps = function (state, ownProps) {
|
|
|
1797
1954
|
uischema: ownProps.uischema || getUiSchema(state),
|
|
1798
1955
|
path: ownProps.path,
|
|
1799
1956
|
enabled: ownProps.enabled,
|
|
1800
|
-
config: getConfig(state)
|
|
1957
|
+
config: getConfig(state),
|
|
1801
1958
|
};
|
|
1802
1959
|
};
|
|
1803
1960
|
var controlDefaultProps = __assign(__assign({}, layoutDefaultProps), { errors: [] });
|
|
@@ -1810,7 +1967,7 @@ var mapStateToCombinatorRendererProps = function (state, ownProps, keyword) {
|
|
|
1810
1967
|
'additionalProperties',
|
|
1811
1968
|
'type',
|
|
1812
1969
|
'enum',
|
|
1813
|
-
'const'
|
|
1970
|
+
'const',
|
|
1814
1971
|
];
|
|
1815
1972
|
var dataIsValid = function (errors) {
|
|
1816
1973
|
return (!errors ||
|
|
@@ -1849,14 +2006,16 @@ var mapStateToOneOfProps = function (state, ownProps) {
|
|
|
1849
2006
|
return mapStateToCombinatorRendererProps(state, ownProps, 'oneOf');
|
|
1850
2007
|
};
|
|
1851
2008
|
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"]);
|
|
2009
|
+
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
2010
|
var resolvedSchema = Resolve.schema(schema, 'items', props.rootSchema);
|
|
1854
|
-
var
|
|
2011
|
+
var t = getTranslator()(state);
|
|
2012
|
+
var childErrors = getCombinedErrorMessage(getSubErrorsAt(path, resolvedSchema)(state), getErrorTranslator()(state), t, undefined, undefined, undefined);
|
|
1855
2013
|
var allErrors = errors +
|
|
1856
2014
|
(errors.length > 0 && childErrors.length > 0 ? '\n' : '') +
|
|
1857
2015
|
childErrors;
|
|
1858
|
-
return __assign(__assign({}, props), {
|
|
1859
|
-
|
|
2016
|
+
return __assign(__assign({}, props), { label: label,
|
|
2017
|
+
path: path,
|
|
2018
|
+
uischema: uischema, schema: resolvedSchema, data: props.data ? props.data.length : 0, errors: allErrors, minItems: schema.minItems, translations: getArrayTranslations(t, arrayDefaultTranslations, i18nKeyPrefix, label) });
|
|
1860
2019
|
};
|
|
1861
2020
|
var mapStateToLabelProps = function (state, props) {
|
|
1862
2021
|
var uischema = props.uischema;
|
|
@@ -1895,7 +2054,9 @@ var mapStateToCellProps = function (state, ownProps) {
|
|
|
1895
2054
|
else {
|
|
1896
2055
|
enabled = isInherentlyEnabled(state, ownProps, uischema, schema || rootSchema, rootData, config);
|
|
1897
2056
|
}
|
|
1898
|
-
var
|
|
2057
|
+
var t = getTranslator()(state);
|
|
2058
|
+
var te = getErrorTranslator()(state);
|
|
2059
|
+
var errors = getCombinedErrorMessage(getErrorAt(path, schema)(state), te, t, schema, uischema, path);
|
|
1899
2060
|
var isValid = isEmpty__default["default"](errors);
|
|
1900
2061
|
return {
|
|
1901
2062
|
data: Resolve.data(rootData, path),
|
|
@@ -1910,7 +2071,7 @@ var mapStateToCellProps = function (state, ownProps) {
|
|
|
1910
2071
|
config: getConfig(state),
|
|
1911
2072
|
rootSchema: rootSchema,
|
|
1912
2073
|
renderers: renderers,
|
|
1913
|
-
cells: cells
|
|
2074
|
+
cells: cells,
|
|
1914
2075
|
};
|
|
1915
2076
|
};
|
|
1916
2077
|
var mapStateToDispatchCellProps = function (state, ownProps) {
|
|
@@ -1926,7 +2087,7 @@ var defaultMapStateToEnumCellProps = function (state, ownProps) {
|
|
|
1926
2087
|
return enumToEnumOptionMapper(e, getTranslator()(state), getI18nKeyPrefix(props.schema, props.uischema, props.path));
|
|
1927
2088
|
})) ||
|
|
1928
2089
|
(props.schema.const && [
|
|
1929
|
-
enumToEnumOptionMapper(props.schema.const, getTranslator()(state), getI18nKeyPrefix(props.schema, props.uischema, props.path))
|
|
2090
|
+
enumToEnumOptionMapper(props.schema.const, getTranslator()(state), getI18nKeyPrefix(props.schema, props.uischema, props.path)),
|
|
1930
2091
|
]);
|
|
1931
2092
|
return __assign(__assign({}, props), { options: options });
|
|
1932
2093
|
};
|
|
@@ -1944,7 +2105,7 @@ var defaultMapDispatchToControlProps =
|
|
|
1944
2105
|
function (dispatch, ownProps) {
|
|
1945
2106
|
var handleChange = mapDispatchToCellProps(dispatch).handleChange;
|
|
1946
2107
|
return {
|
|
1947
|
-
handleChange: ownProps.handleChange || handleChange
|
|
2108
|
+
handleChange: ownProps.handleChange || handleChange,
|
|
1948
2109
|
};
|
|
1949
2110
|
};
|
|
1950
2111
|
|
|
@@ -1958,11 +2119,13 @@ var createLabel = function (subSchema, subSchemaIndex, keyword) {
|
|
|
1958
2119
|
};
|
|
1959
2120
|
var createCombinatorRenderInfos = function (combinatorSubSchemas, rootSchema, keyword, control, path, uischemas) {
|
|
1960
2121
|
return combinatorSubSchemas.map(function (subSchema, subSchemaIndex) {
|
|
1961
|
-
var schema = subSchema.$ref
|
|
2122
|
+
var schema = subSchema.$ref
|
|
2123
|
+
? Resolve.schema(rootSchema, subSchema.$ref, rootSchema)
|
|
2124
|
+
: subSchema;
|
|
1962
2125
|
return {
|
|
1963
2126
|
schema: schema,
|
|
1964
2127
|
uischema: findUISchema(uischemas, schema, control.scope, path, undefined, control, rootSchema),
|
|
1965
|
-
label: createLabel(subSchema, subSchemaIndex, keyword)
|
|
2128
|
+
label: createLabel(subSchema, subSchemaIndex, keyword),
|
|
1966
2129
|
};
|
|
1967
2130
|
});
|
|
1968
2131
|
};
|
|
@@ -2002,12 +2165,14 @@ var getFirstPrimitiveProp = function (schema) {
|
|
|
2002
2165
|
return undefined;
|
|
2003
2166
|
};
|
|
2004
2167
|
|
|
2005
|
-
var setReadonlyPropertyValue = function (value) {
|
|
2006
|
-
|
|
2007
|
-
child.options
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2168
|
+
var setReadonlyPropertyValue = function (value) {
|
|
2169
|
+
return function (child) {
|
|
2170
|
+
if (!child.options) {
|
|
2171
|
+
child.options = {};
|
|
2172
|
+
}
|
|
2173
|
+
child.options.readonly = value;
|
|
2174
|
+
};
|
|
2175
|
+
};
|
|
2011
2176
|
var setReadonly = function (uischema) {
|
|
2012
2177
|
iterateSchema(uischema, setReadonlyPropertyValue(true));
|
|
2013
2178
|
};
|
|
@@ -2033,11 +2198,11 @@ var createAjv = function (options) {
|
|
|
2033
2198
|
|
|
2034
2199
|
var createLayout = function (layoutType) { return ({
|
|
2035
2200
|
type: layoutType,
|
|
2036
|
-
elements: []
|
|
2201
|
+
elements: [],
|
|
2037
2202
|
}); };
|
|
2038
2203
|
var createControlElement = function (ref) { return ({
|
|
2039
2204
|
type: 'Control',
|
|
2040
|
-
scope: ref
|
|
2205
|
+
scope: ref,
|
|
2041
2206
|
}); };
|
|
2042
2207
|
var wrapInLayoutIfNecessary = function (uischema, layoutType) {
|
|
2043
2208
|
if (!isEmpty__default["default"](uischema) && !isLayout(uischema)) {
|
|
@@ -2056,7 +2221,7 @@ var addLabel = function (layout, labelName) {
|
|
|
2056
2221
|
else {
|
|
2057
2222
|
var label = {
|
|
2058
2223
|
type: 'Label',
|
|
2059
|
-
text: fixedLabel
|
|
2224
|
+
text: fixedLabel,
|
|
2060
2225
|
};
|
|
2061
2226
|
layout.elements.push(label);
|
|
2062
2227
|
}
|
|
@@ -2111,10 +2276,11 @@ var generateUISchema = function (jsonSchema, schemaElements, currentRef, schemaN
|
|
|
2111
2276
|
case 'string':
|
|
2112
2277
|
case 'number':
|
|
2113
2278
|
case 'integer':
|
|
2114
|
-
case 'boolean':
|
|
2279
|
+
case 'boolean': {
|
|
2115
2280
|
var controlObject = createControlElement(currentRef);
|
|
2116
2281
|
schemaElements.push(controlObject);
|
|
2117
2282
|
return controlObject;
|
|
2283
|
+
}
|
|
2118
2284
|
default:
|
|
2119
2285
|
throw new Error('Unknown type: ' + JSON.stringify(jsonSchema));
|
|
2120
2286
|
}
|
|
@@ -2129,11 +2295,11 @@ var generateDefaultUISchema = function (jsonSchema, layoutType, prefix, rootSche
|
|
|
2129
2295
|
var Generate = {
|
|
2130
2296
|
jsonSchema: generateJsonSchema,
|
|
2131
2297
|
uiSchema: generateDefaultUISchema,
|
|
2132
|
-
controlElement: createControlElement
|
|
2298
|
+
controlElement: createControlElement,
|
|
2133
2299
|
};
|
|
2134
2300
|
|
|
2135
2301
|
var INIT = 'jsonforms/INIT';
|
|
2136
|
-
var UPDATE_CORE =
|
|
2302
|
+
var UPDATE_CORE = 'jsonforms/UPDATE_CORE';
|
|
2137
2303
|
var SET_AJV = 'jsonforms/SET_AJV';
|
|
2138
2304
|
var UPDATE_DATA = 'jsonforms/UPDATE';
|
|
2139
2305
|
var UPDATE_ERRORS = 'jsonforms/UPDATE_ERRORS';
|
|
@@ -2143,16 +2309,16 @@ var REMOVE_RENDERER = 'jsonforms/REMOVE_RENDERER';
|
|
|
2143
2309
|
var ADD_CELL = 'jsonforms/ADD_CELL';
|
|
2144
2310
|
var REMOVE_CELL = 'jsonforms/REMOVE_CELL';
|
|
2145
2311
|
var SET_CONFIG = 'jsonforms/SET_CONFIG';
|
|
2146
|
-
var ADD_UI_SCHEMA =
|
|
2147
|
-
var REMOVE_UI_SCHEMA =
|
|
2148
|
-
var SET_SCHEMA =
|
|
2149
|
-
var SET_UISCHEMA =
|
|
2312
|
+
var ADD_UI_SCHEMA = 'jsonforms/ADD_UI_SCHEMA';
|
|
2313
|
+
var REMOVE_UI_SCHEMA = 'jsonforms/REMOVE_UI_SCHEMA';
|
|
2314
|
+
var SET_SCHEMA = 'jsonforms/SET_SCHEMA';
|
|
2315
|
+
var SET_UISCHEMA = 'jsonforms/SET_UISCHEMA';
|
|
2150
2316
|
var SET_VALIDATION_MODE = 'jsonforms/SET_VALIDATION_MODE';
|
|
2151
|
-
var SET_LOCALE =
|
|
2317
|
+
var SET_LOCALE = 'jsonforms/SET_LOCALE';
|
|
2152
2318
|
var SET_TRANSLATOR = 'jsonforms/SET_TRANSLATOR';
|
|
2153
2319
|
var UPDATE_I18N = 'jsonforms/UPDATE_I18N';
|
|
2154
|
-
var ADD_DEFAULT_DATA =
|
|
2155
|
-
var REMOVE_DEFAULT_DATA =
|
|
2320
|
+
var ADD_DEFAULT_DATA = 'jsonforms/ADD_DEFAULT_DATA';
|
|
2321
|
+
var REMOVE_DEFAULT_DATA = 'jsonforms/REMOVE_DEFAULT_DATA';
|
|
2156
2322
|
var init = function (data, schema, uischema, options) {
|
|
2157
2323
|
if (schema === void 0) { schema = generateJsonSchema(data); }
|
|
2158
2324
|
return ({
|
|
@@ -2160,7 +2326,7 @@ var init = function (data, schema, uischema, options) {
|
|
|
2160
2326
|
data: data,
|
|
2161
2327
|
schema: schema,
|
|
2162
2328
|
uischema: typeof uischema === 'object' ? uischema : generateDefaultUISchema(schema),
|
|
2163
|
-
options: options
|
|
2329
|
+
options: options,
|
|
2164
2330
|
});
|
|
2165
2331
|
};
|
|
2166
2332
|
var updateCore = function (data, schema, uischema, options) { return ({
|
|
@@ -2168,93 +2334,93 @@ var updateCore = function (data, schema, uischema, options) { return ({
|
|
|
2168
2334
|
data: data,
|
|
2169
2335
|
schema: schema,
|
|
2170
2336
|
uischema: uischema,
|
|
2171
|
-
options: options
|
|
2337
|
+
options: options,
|
|
2172
2338
|
}); };
|
|
2173
2339
|
var registerDefaultData = function (schemaPath, data) { return ({
|
|
2174
2340
|
type: ADD_DEFAULT_DATA,
|
|
2175
2341
|
schemaPath: schemaPath,
|
|
2176
|
-
data: data
|
|
2342
|
+
data: data,
|
|
2177
2343
|
}); };
|
|
2178
2344
|
var unregisterDefaultData = function (schemaPath) { return ({
|
|
2179
2345
|
type: REMOVE_DEFAULT_DATA,
|
|
2180
|
-
schemaPath: schemaPath
|
|
2346
|
+
schemaPath: schemaPath,
|
|
2181
2347
|
}); };
|
|
2182
2348
|
var setAjv = function (ajv) { return ({
|
|
2183
2349
|
type: SET_AJV,
|
|
2184
|
-
ajv: ajv
|
|
2350
|
+
ajv: ajv,
|
|
2185
2351
|
}); };
|
|
2186
2352
|
var update = function (path, updater) { return ({
|
|
2187
2353
|
type: UPDATE_DATA,
|
|
2188
2354
|
path: path,
|
|
2189
|
-
updater: updater
|
|
2355
|
+
updater: updater,
|
|
2190
2356
|
}); };
|
|
2191
2357
|
var updateErrors = function (errors) { return ({
|
|
2192
2358
|
type: UPDATE_ERRORS,
|
|
2193
|
-
errors: errors
|
|
2359
|
+
errors: errors,
|
|
2194
2360
|
}); };
|
|
2195
2361
|
var registerRenderer = function (tester, renderer) { return ({
|
|
2196
2362
|
type: ADD_RENDERER,
|
|
2197
2363
|
tester: tester,
|
|
2198
|
-
renderer: renderer
|
|
2364
|
+
renderer: renderer,
|
|
2199
2365
|
}); };
|
|
2200
2366
|
var registerCell = function (tester, cell) { return ({
|
|
2201
2367
|
type: ADD_CELL,
|
|
2202
2368
|
tester: tester,
|
|
2203
|
-
cell: cell
|
|
2369
|
+
cell: cell,
|
|
2204
2370
|
}); };
|
|
2205
2371
|
var unregisterCell = function (tester, cell) { return ({
|
|
2206
2372
|
type: REMOVE_CELL,
|
|
2207
2373
|
tester: tester,
|
|
2208
|
-
cell: cell
|
|
2374
|
+
cell: cell,
|
|
2209
2375
|
}); };
|
|
2210
2376
|
var unregisterRenderer = function (tester, renderer) { return ({
|
|
2211
2377
|
type: REMOVE_RENDERER,
|
|
2212
2378
|
tester: tester,
|
|
2213
|
-
renderer: renderer
|
|
2379
|
+
renderer: renderer,
|
|
2214
2380
|
}); };
|
|
2215
2381
|
var setConfig = function (config) { return ({
|
|
2216
2382
|
type: SET_CONFIG,
|
|
2217
|
-
config: config
|
|
2383
|
+
config: config,
|
|
2218
2384
|
}); };
|
|
2219
2385
|
var setValidationMode = function (validationMode) { return ({
|
|
2220
2386
|
type: SET_VALIDATION_MODE,
|
|
2221
|
-
validationMode: validationMode
|
|
2387
|
+
validationMode: validationMode,
|
|
2222
2388
|
}); };
|
|
2223
2389
|
var registerUISchema = function (tester, uischema) {
|
|
2224
2390
|
return {
|
|
2225
2391
|
type: ADD_UI_SCHEMA,
|
|
2226
2392
|
tester: tester,
|
|
2227
|
-
uischema: uischema
|
|
2393
|
+
uischema: uischema,
|
|
2228
2394
|
};
|
|
2229
2395
|
};
|
|
2230
2396
|
var unregisterUISchema = function (tester) {
|
|
2231
2397
|
return {
|
|
2232
2398
|
type: REMOVE_UI_SCHEMA,
|
|
2233
|
-
tester: tester
|
|
2399
|
+
tester: tester,
|
|
2234
2400
|
};
|
|
2235
2401
|
};
|
|
2236
2402
|
var setLocale = function (locale) { return ({
|
|
2237
2403
|
type: SET_LOCALE,
|
|
2238
|
-
locale: locale
|
|
2404
|
+
locale: locale,
|
|
2239
2405
|
}); };
|
|
2240
2406
|
var setSchema = function (schema) { return ({
|
|
2241
2407
|
type: SET_SCHEMA,
|
|
2242
|
-
schema: schema
|
|
2408
|
+
schema: schema,
|
|
2243
2409
|
}); };
|
|
2244
2410
|
var setTranslator = function (translator, errorTranslator) { return ({
|
|
2245
2411
|
type: SET_TRANSLATOR,
|
|
2246
2412
|
translator: translator,
|
|
2247
|
-
errorTranslator: errorTranslator
|
|
2413
|
+
errorTranslator: errorTranslator,
|
|
2248
2414
|
}); };
|
|
2249
2415
|
var updateI18n = function (locale, translator, errorTranslator) { return ({
|
|
2250
2416
|
type: UPDATE_I18N,
|
|
2251
2417
|
locale: locale,
|
|
2252
2418
|
translator: translator,
|
|
2253
|
-
errorTranslator: errorTranslator
|
|
2419
|
+
errorTranslator: errorTranslator,
|
|
2254
2420
|
}); };
|
|
2255
2421
|
var setUISchema = function (uischema) { return ({
|
|
2256
2422
|
type: SET_UISCHEMA,
|
|
2257
|
-
uischema: uischema
|
|
2423
|
+
uischema: uischema,
|
|
2258
2424
|
}); };
|
|
2259
2425
|
|
|
2260
2426
|
var index = /*#__PURE__*/Object.freeze({
|
|
@@ -2304,7 +2470,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
2304
2470
|
|
|
2305
2471
|
var Helpers = {
|
|
2306
2472
|
createLabelDescriptionFrom: createLabelDescriptionFrom,
|
|
2307
|
-
convertToValidClassName: convertToValidClassName
|
|
2473
|
+
convertToValidClassName: convertToValidClassName,
|
|
2308
2474
|
};
|
|
2309
2475
|
|
|
2310
2476
|
exports.ADD_CELL = ADD_CELL;
|
|
@@ -2337,7 +2503,9 @@ exports.UPDATE_DATA = UPDATE_DATA;
|
|
|
2337
2503
|
exports.UPDATE_ERRORS = UPDATE_ERRORS;
|
|
2338
2504
|
exports.UPDATE_I18N = UPDATE_I18N;
|
|
2339
2505
|
exports.VALIDATE = VALIDATE;
|
|
2506
|
+
exports.addI18nKeyToPrefix = addI18nKeyToPrefix;
|
|
2340
2507
|
exports.and = and;
|
|
2508
|
+
exports.arrayDefaultTranslations = arrayDefaultTranslations;
|
|
2341
2509
|
exports.categorizationHasCategory = categorizationHasCategory;
|
|
2342
2510
|
exports.cellReducer = cellReducer;
|
|
2343
2511
|
exports.clearAllIds = clearAllIds;
|
|
@@ -2387,6 +2555,7 @@ exports.formatIs = formatIs;
|
|
|
2387
2555
|
exports.generateDefaultUISchema = generateDefaultUISchema;
|
|
2388
2556
|
exports.generateJsonSchema = generateJsonSchema;
|
|
2389
2557
|
exports.getAjv = getAjv;
|
|
2558
|
+
exports.getArrayTranslations = getArrayTranslations;
|
|
2390
2559
|
exports.getCells = getCells;
|
|
2391
2560
|
exports.getCombinedErrorMessage = getCombinedErrorMessage;
|
|
2392
2561
|
exports.getConfig = getConfig;
|