@jsonforms/core 3.0.0-rc.0 → 3.0.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.
@@ -295,9 +295,9 @@ var RuleEffect;
295
295
  const isInternationalized = (element) => typeof element === 'object' && element !== null && typeof element.i18n === 'string';
296
296
  const isGroup = (layout) => layout.type === 'Group';
297
297
  const isLayout = (uischema) => uischema.elements !== undefined;
298
- const isScopable = (obj) => obj && typeof obj === 'object';
298
+ const isScopable = (obj) => !!obj && typeof obj === 'object';
299
299
  const isScoped = (obj) => isScopable(obj) && typeof obj.scope === 'string';
300
- const isLabelable = (obj) => obj && typeof obj === 'object';
300
+ const isLabelable = (obj) => !!obj && typeof obj === 'object';
301
301
  const isLabeled = (obj) => isLabelable(obj) && ['string', 'boolean'].includes(typeof obj.label);
302
302
 
303
303
  const move = (array, index, delta) => {
@@ -905,6 +905,9 @@ const isObjectArrayWithNesting = (uischema, schema, context) => {
905
905
  if (val.$ref !== undefined) {
906
906
  return false;
907
907
  }
908
+ if (val.anyOf || val.oneOf) {
909
+ return true;
910
+ }
908
911
  if (hasType(val, 'object')) {
909
912
  objectDepth++;
910
913
  if (objectDepth === 2) {
@@ -1699,7 +1702,7 @@ const controlDefaultProps = {
1699
1702
  errors: []
1700
1703
  };
1701
1704
  const mapStateToCombinatorRendererProps = (state, ownProps, keyword) => {
1702
- const { data, schema, ...props } = mapStateToControlProps(state, ownProps);
1705
+ const { data, schema, rootSchema, ...props } = mapStateToControlProps(state, ownProps);
1703
1706
  const ajv = state.jsonforms.core.ajv;
1704
1707
  const structuralKeywords = [
1705
1708
  'required',
@@ -1716,7 +1719,11 @@ const mapStateToCombinatorRendererProps = (state, ownProps, keyword) => {
1716
1719
  let indexOfFittingSchema;
1717
1720
  for (let i = 0; i < schema[keyword]?.length; i++) {
1718
1721
  try {
1719
- const valFn = ajv.compile(schema[keyword][i]);
1722
+ let _schema = schema[keyword][i];
1723
+ if (_schema.$ref) {
1724
+ _schema = Resolve.schema(rootSchema, _schema.$ref, rootSchema);
1725
+ }
1726
+ const valFn = ajv.compile(_schema);
1720
1727
  valFn(data);
1721
1728
  if (dataIsValid(valFn.errors)) {
1722
1729
  indexOfFittingSchema = i;
@@ -1730,6 +1737,7 @@ const mapStateToCombinatorRendererProps = (state, ownProps, keyword) => {
1730
1737
  return {
1731
1738
  data,
1732
1739
  schema,
1740
+ rootSchema,
1733
1741
  ...props,
1734
1742
  indexOfFittingSchema,
1735
1743
  uischemas: getUISchemas(state)