@jsonforms/core 3.1.0-alpha.3 → 3.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/jsonforms-core.cjs.js +27 -14
- package/lib/jsonforms-core.cjs.js.map +1 -1
- package/lib/jsonforms-core.esm.js +17 -14
- package/lib/jsonforms-core.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/generators/schema.ts +7 -3
- package/src/reducers/core.ts +4 -1
- package/src/testers/testers.ts +18 -8
- package/src/util/resolvers.ts +4 -1
- package/src/util/schema.ts +3 -2
|
@@ -58,7 +58,7 @@ var distinct = function (properties, discriminator) {
|
|
|
58
58
|
var known = {};
|
|
59
59
|
return properties.filter(function (item) {
|
|
60
60
|
var discriminatorValue = discriminator(item);
|
|
61
|
-
if (
|
|
61
|
+
if (Object.prototype.hasOwnProperty.call(known, discriminatorValue)) {
|
|
62
62
|
return false;
|
|
63
63
|
}
|
|
64
64
|
else {
|
|
@@ -157,12 +157,12 @@ instance, options) {
|
|
|
157
157
|
return function (optionName) {
|
|
158
158
|
switch (optionName) {
|
|
159
159
|
case ADDITIONAL_PROPERTIES:
|
|
160
|
-
if (
|
|
160
|
+
if (Object.prototype.hasOwnProperty.call(options, ADDITIONAL_PROPERTIES)) {
|
|
161
161
|
return options[ADDITIONAL_PROPERTIES];
|
|
162
162
|
}
|
|
163
163
|
return true;
|
|
164
164
|
case REQUIRED_PROPERTIES:
|
|
165
|
-
if (
|
|
165
|
+
if (Object.prototype.hasOwnProperty.call(options, REQUIRED_PROPERTIES)) {
|
|
166
166
|
return options[REQUIRED_PROPERTIES](props);
|
|
167
167
|
}
|
|
168
168
|
return Object.keys(props);
|
|
@@ -471,7 +471,8 @@ var initState = {
|
|
|
471
471
|
additionalErrors: [],
|
|
472
472
|
};
|
|
473
473
|
var reuseAjvForSchema = function (ajv, schema) {
|
|
474
|
-
if (
|
|
474
|
+
if (Object.prototype.hasOwnProperty.call(schema, 'id') ||
|
|
475
|
+
Object.prototype.hasOwnProperty.call(schema, '$id')) {
|
|
475
476
|
ajv.removeSchema(schema);
|
|
476
477
|
}
|
|
477
478
|
return ajv;
|
|
@@ -1036,10 +1037,20 @@ var withIncreasedRank = function (by, rankedTester) {
|
|
|
1036
1037
|
};
|
|
1037
1038
|
var isBooleanControl = and(uiTypeIs('Control'), schemaTypeIs('boolean'));
|
|
1038
1039
|
var isObjectControl = and(uiTypeIs('Control'), schemaTypeIs('object'));
|
|
1039
|
-
var isAllOfControl = and(uiTypeIs('Control'), schemaMatches(function (schema) {
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
var
|
|
1040
|
+
var isAllOfControl = and(uiTypeIs('Control'), schemaMatches(function (schema) {
|
|
1041
|
+
return Object.prototype.hasOwnProperty.call(schema, 'allOf');
|
|
1042
|
+
}));
|
|
1043
|
+
var isAnyOfControl = and(uiTypeIs('Control'), schemaMatches(function (schema) {
|
|
1044
|
+
return Object.prototype.hasOwnProperty.call(schema, 'anyOf');
|
|
1045
|
+
}));
|
|
1046
|
+
var isOneOfControl = and(uiTypeIs('Control'), schemaMatches(function (schema) {
|
|
1047
|
+
return Object.prototype.hasOwnProperty.call(schema, 'oneOf');
|
|
1048
|
+
}));
|
|
1049
|
+
var isEnumControl = and(uiTypeIs('Control'), or(schemaMatches(function (schema) {
|
|
1050
|
+
return Object.prototype.hasOwnProperty.call(schema, 'enum');
|
|
1051
|
+
}), schemaMatches(function (schema) {
|
|
1052
|
+
return Object.prototype.hasOwnProperty.call(schema, 'const');
|
|
1053
|
+
})));
|
|
1043
1054
|
var isOneOfEnumControl = and(uiTypeIs('Control'), schemaMatches(function (schema) { return isOneOfEnumSchema(schema); }));
|
|
1044
1055
|
var isIntegerControl = and(uiTypeIs('Control'), schemaTypeIs('integer'));
|
|
1045
1056
|
var isNumberControl = and(uiTypeIs('Control'), schemaTypeIs('number'));
|
|
@@ -1144,9 +1155,9 @@ var isPrimitiveArrayControl = and(uiTypeIs('Control'), schemaMatches(function (s
|
|
|
1144
1155
|
includes__default["default"](['integer', 'number', 'boolean', 'string'], types[0]));
|
|
1145
1156
|
}));
|
|
1146
1157
|
var isRangeControl = and(uiTypeIs('Control'), or(schemaTypeIs('number'), schemaTypeIs('integer')), schemaMatches(function (schema) {
|
|
1147
|
-
return
|
|
1148
|
-
|
|
1149
|
-
|
|
1158
|
+
return Object.prototype.hasOwnProperty.call(schema, 'maximum') &&
|
|
1159
|
+
Object.prototype.hasOwnProperty.call(schema, 'minimum') &&
|
|
1160
|
+
Object.prototype.hasOwnProperty.call(schema, 'default');
|
|
1150
1161
|
}), optionIs('slider', true));
|
|
1151
1162
|
var isNumberFormatControl = and(uiTypeIs('Control'), schemaTypeIs('integer'), optionIs('format', true));
|
|
1152
1163
|
var isCategorization = function (category) { return category.type === 'Categorization'; };
|
|
@@ -1378,7 +1389,8 @@ var resolveData = function (instance, dataPath) {
|
|
|
1378
1389
|
}
|
|
1379
1390
|
var dataPathSegments = dataPath.split('.');
|
|
1380
1391
|
return dataPathSegments.reduce(function (curInstance, decodedSegment) {
|
|
1381
|
-
if (!curInstance ||
|
|
1392
|
+
if (!curInstance ||
|
|
1393
|
+
!Object.prototype.hasOwnProperty.call(curInstance, decodedSegment)) {
|
|
1382
1394
|
return undefined;
|
|
1383
1395
|
}
|
|
1384
1396
|
return curInstance[decodedSegment];
|
|
@@ -2164,8 +2176,9 @@ var getFirstPrimitiveProp = function (schema) {
|
|
|
2164
2176
|
return undefined;
|
|
2165
2177
|
};
|
|
2166
2178
|
var isOneOfEnumSchema = function (schema) {
|
|
2167
|
-
return
|
|
2168
|
-
(schema
|
|
2179
|
+
return !!schema &&
|
|
2180
|
+
Object.prototype.hasOwnProperty.call(schema, 'oneOf') &&
|
|
2181
|
+
schema.oneOf &&
|
|
2169
2182
|
schema.oneOf.every(function (s) { return s.const !== undefined; });
|
|
2170
2183
|
};
|
|
2171
2184
|
|