@jsonforms/core 3.1.0-alpha.2 → 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.
@@ -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 (known.hasOwnProperty(discriminatorValue)) {
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 (options.hasOwnProperty(ADDITIONAL_PROPERTIES)) {
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 (options.hasOwnProperty(REQUIRED_PROPERTIES)) {
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 (schema.hasOwnProperty('id') || schema.hasOwnProperty('$id')) {
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;
@@ -659,7 +660,8 @@ var errorsAt = function (instancePath, schema, matchPath) {
659
660
  return function (errors) {
660
661
  var combinatorPaths = filter__default["default"](errors, function (error) { return error.keyword === 'oneOf' || error.keyword === 'anyOf'; }).map(function (error) { return getControlPath(error); });
661
662
  return filter__default["default"](errors, function (error) {
662
- if (filteredErrorKeywords.indexOf(error.keyword) !== -1) {
663
+ if (filteredErrorKeywords.indexOf(error.keyword) !== -1 &&
664
+ !isOneOfEnumSchema(error.parentSchema)) {
663
665
  return false;
664
666
  }
665
667
  var controlPath = getControlPath(error);
@@ -667,6 +669,7 @@ var errorsAt = function (instancePath, schema, matchPath) {
667
669
  var parentSchema = error.parentSchema;
668
670
  if (result &&
669
671
  !isObjectSchema$1(parentSchema) &&
672
+ !isOneOfEnumSchema(parentSchema) &&
670
673
  combinatorPaths.findIndex(function (p) { return instancePath.startsWith(p); }) !== -1) {
671
674
  result = result && isEqual__default["default"](parentSchema, schema);
672
675
  }
@@ -1034,14 +1037,21 @@ var withIncreasedRank = function (by, rankedTester) {
1034
1037
  };
1035
1038
  var isBooleanControl = and(uiTypeIs('Control'), schemaTypeIs('boolean'));
1036
1039
  var isObjectControl = and(uiTypeIs('Control'), schemaTypeIs('object'));
1037
- var isAllOfControl = and(uiTypeIs('Control'), schemaMatches(function (schema) { return schema.hasOwnProperty('allOf'); }));
1038
- var isAnyOfControl = and(uiTypeIs('Control'), schemaMatches(function (schema) { return schema.hasOwnProperty('anyOf'); }));
1039
- var isOneOfControl = and(uiTypeIs('Control'), schemaMatches(function (schema) { return schema.hasOwnProperty('oneOf'); }));
1040
- var isEnumControl = and(uiTypeIs('Control'), or(schemaMatches(function (schema) { return schema.hasOwnProperty('enum'); }), schemaMatches(function (schema) { return schema.hasOwnProperty('const'); })));
1041
- var isOneOfEnumControl = and(uiTypeIs('Control'), schemaMatches(function (schema) {
1042
- return schema.hasOwnProperty('oneOf') &&
1043
- schema.oneOf.every(function (s) { return s.const !== undefined; });
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');
1044
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
+ })));
1054
+ var isOneOfEnumControl = and(uiTypeIs('Control'), schemaMatches(function (schema) { return isOneOfEnumSchema(schema); }));
1045
1055
  var isIntegerControl = and(uiTypeIs('Control'), schemaTypeIs('integer'));
1046
1056
  var isNumberControl = and(uiTypeIs('Control'), schemaTypeIs('number'));
1047
1057
  var isStringControl = and(uiTypeIs('Control'), schemaTypeIs('string'));
@@ -1103,7 +1113,7 @@ var isObjectArrayWithNesting = function (uischema, schema, context) {
1103
1113
  if (val.anyOf || val.allOf) {
1104
1114
  return true;
1105
1115
  }
1106
- if (val.oneOf && !isOneOfEnumControl(uischema, val, context)) {
1116
+ if (val.oneOf && !isOneOfEnumSchema(val)) {
1107
1117
  return true;
1108
1118
  }
1109
1119
  if (hasType(val, 'object')) {
@@ -1145,9 +1155,9 @@ var isPrimitiveArrayControl = and(uiTypeIs('Control'), schemaMatches(function (s
1145
1155
  includes__default["default"](['integer', 'number', 'boolean', 'string'], types[0]));
1146
1156
  }));
1147
1157
  var isRangeControl = and(uiTypeIs('Control'), or(schemaTypeIs('number'), schemaTypeIs('integer')), schemaMatches(function (schema) {
1148
- return schema.hasOwnProperty('maximum') &&
1149
- schema.hasOwnProperty('minimum') &&
1150
- schema.hasOwnProperty('default');
1158
+ return Object.prototype.hasOwnProperty.call(schema, 'maximum') &&
1159
+ Object.prototype.hasOwnProperty.call(schema, 'minimum') &&
1160
+ Object.prototype.hasOwnProperty.call(schema, 'default');
1151
1161
  }), optionIs('slider', true));
1152
1162
  var isNumberFormatControl = and(uiTypeIs('Control'), schemaTypeIs('integer'), optionIs('format', true));
1153
1163
  var isCategorization = function (category) { return category.type === 'Categorization'; };
@@ -1379,7 +1389,8 @@ var resolveData = function (instance, dataPath) {
1379
1389
  }
1380
1390
  var dataPathSegments = dataPath.split('.');
1381
1391
  return dataPathSegments.reduce(function (curInstance, decodedSegment) {
1382
- if (!curInstance || !curInstance.hasOwnProperty(decodedSegment)) {
1392
+ if (!curInstance ||
1393
+ !Object.prototype.hasOwnProperty.call(curInstance, decodedSegment)) {
1383
1394
  return undefined;
1384
1395
  }
1385
1396
  return curInstance[decodedSegment];
@@ -2164,6 +2175,12 @@ var getFirstPrimitiveProp = function (schema) {
2164
2175
  }
2165
2176
  return undefined;
2166
2177
  };
2178
+ var isOneOfEnumSchema = function (schema) {
2179
+ return !!schema &&
2180
+ Object.prototype.hasOwnProperty.call(schema, 'oneOf') &&
2181
+ schema.oneOf &&
2182
+ schema.oneOf.every(function (s) { return s.const !== undefined; });
2183
+ };
2167
2184
 
2168
2185
  var setReadonlyPropertyValue = function (value) {
2169
2186
  return function (child) {
@@ -2609,6 +2626,7 @@ exports.isObjectArrayWithNesting = isObjectArrayWithNesting;
2609
2626
  exports.isObjectControl = isObjectControl;
2610
2627
  exports.isOneOfControl = isOneOfControl;
2611
2628
  exports.isOneOfEnumControl = isOneOfEnumControl;
2629
+ exports.isOneOfEnumSchema = isOneOfEnumSchema;
2612
2630
  exports.isPrimitiveArrayControl = isPrimitiveArrayControl;
2613
2631
  exports.isRangeControl = isRangeControl;
2614
2632
  exports.isScopable = isScopable;