@jsonforms/core 3.1.0-alpha.2 → 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.
@@ -606,7 +606,8 @@ const getControlPath = (error) => {
606
606
  const errorsAt = (instancePath, schema, matchPath) => (errors) => {
607
607
  const combinatorPaths = filter(errors, (error) => error.keyword === 'oneOf' || error.keyword === 'anyOf').map((error) => getControlPath(error));
608
608
  return filter(errors, (error) => {
609
- if (filteredErrorKeywords.indexOf(error.keyword) !== -1) {
609
+ if (filteredErrorKeywords.indexOf(error.keyword) !== -1 &&
610
+ !isOneOfEnumSchema(error.parentSchema)) {
610
611
  return false;
611
612
  }
612
613
  const controlPath = getControlPath(error);
@@ -614,6 +615,7 @@ const errorsAt = (instancePath, schema, matchPath) => (errors) => {
614
615
  const parentSchema = error.parentSchema;
615
616
  if (result &&
616
617
  !isObjectSchema$1(parentSchema) &&
618
+ !isOneOfEnumSchema(parentSchema) &&
617
619
  combinatorPaths.findIndex((p) => instancePath.startsWith(p)) !== -1) {
618
620
  result = result && isEqual(parentSchema, schema);
619
621
  }
@@ -940,8 +942,7 @@ const isAllOfControl = and(uiTypeIs('Control'), schemaMatches((schema) => schema
940
942
  const isAnyOfControl = and(uiTypeIs('Control'), schemaMatches((schema) => schema.hasOwnProperty('anyOf')));
941
943
  const isOneOfControl = and(uiTypeIs('Control'), schemaMatches((schema) => schema.hasOwnProperty('oneOf')));
942
944
  const isEnumControl = and(uiTypeIs('Control'), or(schemaMatches((schema) => schema.hasOwnProperty('enum')), schemaMatches((schema) => schema.hasOwnProperty('const'))));
943
- const isOneOfEnumControl = and(uiTypeIs('Control'), schemaMatches((schema) => schema.hasOwnProperty('oneOf') &&
944
- schema.oneOf.every((s) => s.const !== undefined)));
945
+ const isOneOfEnumControl = and(uiTypeIs('Control'), schemaMatches((schema) => isOneOfEnumSchema(schema)));
945
946
  const isIntegerControl = and(uiTypeIs('Control'), schemaTypeIs('integer'));
946
947
  const isNumberControl = and(uiTypeIs('Control'), schemaTypeIs('number'));
947
948
  const isStringControl = and(uiTypeIs('Control'), schemaTypeIs('string'));
@@ -997,7 +998,7 @@ const isObjectArrayWithNesting = (uischema, schema, context) => {
997
998
  if (val.anyOf || val.allOf) {
998
999
  return true;
999
1000
  }
1000
- if (val.oneOf && !isOneOfEnumControl(uischema, val, context)) {
1001
+ if (val.oneOf && !isOneOfEnumSchema(val)) {
1001
1002
  return true;
1002
1003
  }
1003
1004
  if (hasType(val, 'object')) {
@@ -2022,6 +2023,9 @@ const getFirstPrimitiveProp = (schema) => {
2022
2023
  }
2023
2024
  return undefined;
2024
2025
  };
2026
+ const isOneOfEnumSchema = (schema) => schema?.hasOwnProperty('oneOf') &&
2027
+ schema?.oneOf &&
2028
+ schema.oneOf.every((s) => s.const !== undefined);
2025
2029
 
2026
2030
  const setReadonlyPropertyValue = (value) => (child) => {
2027
2031
  if (!child.options) {
@@ -2326,5 +2330,5 @@ const Helpers = {
2326
2330
  convertToValidClassName,
2327
2331
  };
2328
2332
 
2329
- export { ADD_CELL, ADD_DEFAULT_DATA, ADD_RENDERER, ADD_UI_SCHEMA, index as Actions, ArrayTranslationEnum, Draft4, Generate, Helpers, INIT, NOT_APPLICABLE, Paths, REMOVE_CELL, REMOVE_DEFAULT_DATA, REMOVE_RENDERER, REMOVE_UI_SCHEMA, Resolve, RuleEffect, Runtime, SET_AJV, SET_CONFIG, SET_LOCALE, SET_SCHEMA, SET_TRANSLATOR, SET_UISCHEMA, SET_VALIDATION_MODE, index$1 as Test, UPDATE_CORE, UPDATE_DATA, UPDATE_ERRORS, UPDATE_I18N, VALIDATE, addI18nKeyToPrefix, and, arrayDefaultTranslations, categorizationHasCategory, cellReducer, clearAllIds, compose, compose as composePaths, composeWithUi, computeLabel, configReducer, controlDefaultProps, convertToValidClassName, coreReducer, createAjv, createCleanLabel, createCombinatorRenderInfos, createControlElement, createDefaultValue, createId, createLabelDescriptionFrom, decode, defaultDataReducer, defaultErrorTranslator, defaultJsonFormsI18nState, defaultMapDispatchToControlProps, defaultMapStateToEnumCellProps, defaultTranslator, deriveLabelForUISchemaElement, deriveTypes, encode, enumToEnumOptionMapper, errorAt, errorsAt, evalEnablement, evalVisibility, extractAjv, extractData, extractDefaultData, extractSchema, extractUiSchema, fetchErrorTranslator, fetchLocale, fetchTranslator, findAllRefs, findMatchingUISchema, findUISchema, formatErrorMessage, formatIs, generateDefaultUISchema, generateJsonSchema, getAjv, getArrayTranslations, getCells, getCombinedErrorMessage, getConfig, getControlPath, getData, getDefaultData, getErrorAt, getErrorTranslator, getFirstPrimitiveProp, getI18nKey, getI18nKeyPrefix, getI18nKeyPrefixBySchema, getLocale, getRenderers, getSchema, getSubErrorsAt, getTranslator, getUISchemas, getUiSchema, hasCategory, hasEnableRule, hasShowRule, hasType, i18nReducer, init, isAllOfControl, isAnyOfControl, isArrayObjectControl, isBooleanControl, isCategorization, isCategory, isControl, isDateControl, isDateTimeControl, isDescriptionHidden, isEnabled, isEnumControl, isGroup, isInherentlyEnabled, isIntegerControl, isInternationalized, isLabelable, isLabeled, isLayout, isMultiLineControl, isNumberControl, isNumberFormatControl, isObjectArray, isObjectArrayControl, isObjectArrayWithNesting, isObjectControl, isOneOfControl, isOneOfEnumControl, isPrimitiveArrayControl, isRangeControl, isScopable, isScoped, isStringControl, isTimeControl, isVisible, iterateSchema, jsonFormsReducerConfig, layoutDefaultProps, mapDispatchToArrayControlProps, mapDispatchToCellProps, mapDispatchToControlProps, mapDispatchToMultiEnumProps, mapStateToAllOfProps, mapStateToAnyOfProps, mapStateToArrayControlProps, mapStateToArrayLayoutProps, mapStateToCellProps, mapStateToCombinatorRendererProps, mapStateToControlProps, mapStateToControlWithDetailProps, mapStateToDispatchCellProps, mapStateToEnumControlProps, mapStateToJsonFormsRendererProps, mapStateToLabelProps, mapStateToLayoutProps, mapStateToMasterListItemProps, mapStateToMultiEnumControlProps, mapStateToOneOfEnumCellProps, mapStateToOneOfEnumControlProps, mapStateToOneOfProps, moveDown, moveUp, not, oneOfToEnumOptionMapper, optionIs, or, rankWith, registerCell, registerDefaultData, registerRenderer, registerUISchema, removeId, rendererReducer, resolveData, resolveSchema, schemaMatches, schemaSubPathMatches, schemaTypeIs, scopeEndIs, scopeEndsWith, setAjv, setConfig, setLocale, setReadonly, setSchema, setTranslator, setUISchema, setValidationMode, showAsRequired, subErrorsAt, toDataPath, toDataPathSegments, transformPathToI18nPrefix, uiTypeIs, uischemaRegistryReducer, unregisterCell, unregisterDefaultData, unregisterRenderer, unregisterUISchema, unsetReadonly, update, updateCore, updateErrors, updateI18n, validate, withIncreasedRank };
2333
+ export { ADD_CELL, ADD_DEFAULT_DATA, ADD_RENDERER, ADD_UI_SCHEMA, index as Actions, ArrayTranslationEnum, Draft4, Generate, Helpers, INIT, NOT_APPLICABLE, Paths, REMOVE_CELL, REMOVE_DEFAULT_DATA, REMOVE_RENDERER, REMOVE_UI_SCHEMA, Resolve, RuleEffect, Runtime, SET_AJV, SET_CONFIG, SET_LOCALE, SET_SCHEMA, SET_TRANSLATOR, SET_UISCHEMA, SET_VALIDATION_MODE, index$1 as Test, UPDATE_CORE, UPDATE_DATA, UPDATE_ERRORS, UPDATE_I18N, VALIDATE, addI18nKeyToPrefix, and, arrayDefaultTranslations, categorizationHasCategory, cellReducer, clearAllIds, compose, compose as composePaths, composeWithUi, computeLabel, configReducer, controlDefaultProps, convertToValidClassName, coreReducer, createAjv, createCleanLabel, createCombinatorRenderInfos, createControlElement, createDefaultValue, createId, createLabelDescriptionFrom, decode, defaultDataReducer, defaultErrorTranslator, defaultJsonFormsI18nState, defaultMapDispatchToControlProps, defaultMapStateToEnumCellProps, defaultTranslator, deriveLabelForUISchemaElement, deriveTypes, encode, enumToEnumOptionMapper, errorAt, errorsAt, evalEnablement, evalVisibility, extractAjv, extractData, extractDefaultData, extractSchema, extractUiSchema, fetchErrorTranslator, fetchLocale, fetchTranslator, findAllRefs, findMatchingUISchema, findUISchema, formatErrorMessage, formatIs, generateDefaultUISchema, generateJsonSchema, getAjv, getArrayTranslations, getCells, getCombinedErrorMessage, getConfig, getControlPath, getData, getDefaultData, getErrorAt, getErrorTranslator, getFirstPrimitiveProp, getI18nKey, getI18nKeyPrefix, getI18nKeyPrefixBySchema, getLocale, getRenderers, getSchema, getSubErrorsAt, getTranslator, getUISchemas, getUiSchema, hasCategory, hasEnableRule, hasShowRule, hasType, i18nReducer, init, isAllOfControl, isAnyOfControl, isArrayObjectControl, isBooleanControl, isCategorization, isCategory, isControl, isDateControl, isDateTimeControl, isDescriptionHidden, isEnabled, isEnumControl, isGroup, isInherentlyEnabled, isIntegerControl, isInternationalized, isLabelable, isLabeled, isLayout, isMultiLineControl, isNumberControl, isNumberFormatControl, isObjectArray, isObjectArrayControl, isObjectArrayWithNesting, isObjectControl, isOneOfControl, isOneOfEnumControl, isOneOfEnumSchema, isPrimitiveArrayControl, isRangeControl, isScopable, isScoped, isStringControl, isTimeControl, isVisible, iterateSchema, jsonFormsReducerConfig, layoutDefaultProps, mapDispatchToArrayControlProps, mapDispatchToCellProps, mapDispatchToControlProps, mapDispatchToMultiEnumProps, mapStateToAllOfProps, mapStateToAnyOfProps, mapStateToArrayControlProps, mapStateToArrayLayoutProps, mapStateToCellProps, mapStateToCombinatorRendererProps, mapStateToControlProps, mapStateToControlWithDetailProps, mapStateToDispatchCellProps, mapStateToEnumControlProps, mapStateToJsonFormsRendererProps, mapStateToLabelProps, mapStateToLayoutProps, mapStateToMasterListItemProps, mapStateToMultiEnumControlProps, mapStateToOneOfEnumCellProps, mapStateToOneOfEnumControlProps, mapStateToOneOfProps, moveDown, moveUp, not, oneOfToEnumOptionMapper, optionIs, or, rankWith, registerCell, registerDefaultData, registerRenderer, registerUISchema, removeId, rendererReducer, resolveData, resolveSchema, schemaMatches, schemaSubPathMatches, schemaTypeIs, scopeEndIs, scopeEndsWith, setAjv, setConfig, setLocale, setReadonly, setSchema, setTranslator, setUISchema, setValidationMode, showAsRequired, subErrorsAt, toDataPath, toDataPathSegments, transformPathToI18nPrefix, uiTypeIs, uischemaRegistryReducer, unregisterCell, unregisterDefaultData, unregisterRenderer, unregisterUISchema, unsetReadonly, update, updateCore, updateErrors, updateI18n, validate, withIncreasedRank };
2330
2334
  //# sourceMappingURL=jsonforms-core.esm.js.map