@abgov/jsonforms-components 1.53.5 → 1.53.6

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/index.esm.js CHANGED
@@ -5808,13 +5808,21 @@ const getProperty = (obj, propName) => {
5808
5808
  }
5809
5809
  };
5810
5810
  // eslint-disable-next-line
5811
- const pickPropertyValues = (obj, property) => {
5811
+ const pickPropertyValues = (obj, property, endWithType) => {
5812
5812
  let values = [];
5813
5813
  Object.keys(obj).forEach(function (key) {
5814
+ var _a;
5814
5815
  if (key === property) {
5815
5816
  values.push(obj[key]);
5816
5817
  } else if (_$b.isObject(obj[key])) {
5817
- values = [...values, ...pickPropertyValues(obj[key], property)];
5818
+ // if the object type is equal to end type, we are not going to continue the recursive approach
5819
+ if (endWithType && ((_a = obj[key]) === null || _a === void 0 ? void 0 : _a.type) === endWithType) {
5820
+ if (obj[key]) {
5821
+ values.push(obj[key]);
5822
+ }
5823
+ } else {
5824
+ values = [...values, ...pickPropertyValues(obj[key], property)];
5825
+ }
5818
5826
  } else if (_$b.isArray(obj[key])) {
5819
5827
  const nextValues = obj[key].map(function (arrayObj) {
5820
5828
  return pickPropertyValues(arrayObj, property);
@@ -6052,7 +6060,8 @@ const createStepperContextInitData = props => {
6052
6060
  const valid = ajv.validate(schema, data || {});
6053
6061
  const categories = (_a = categorization.elements) === null || _a === void 0 ? void 0 : _a.map((c, id) => {
6054
6062
  const scopes = pickPropertyValues(c, 'scope');
6055
- const incompletePaths = getIncompletePaths(ajv, pickPropertyValues(c, 'scope'));
6063
+ // ListWithDetail path might have conflicts with others. The errors in ListWithDetail will still be caught in the ctx.core.errors
6064
+ const incompletePaths = getIncompletePaths(ajv, pickPropertyValues(c, 'scope', 'ListWithDetail'));
6056
6065
  return {
6057
6066
  id,
6058
6067
  label: deriveLabelForUISchemaElement(c, t),
@@ -7178,7 +7187,7 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
7178
7187
  }) : jsx(GoAFormItem, {
7179
7188
  error: (_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : '',
7180
7189
  mb: errorRow && !error && '2xl' || 'xs',
7181
- children: jsx(GoAInput, {
7190
+ children: dataObject.type === 'number' || dataObject.type === 'string' && !dataObject.enum ? jsx(GoAInput, {
7182
7191
  type: dataObject.type === 'number' ? 'number' : 'text',
7183
7192
  id: schemaName,
7184
7193
  name: schemaName,
@@ -7193,6 +7202,12 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
7193
7202
  },
7194
7203
  "aria-label": schemaName,
7195
7204
  width: "100%"
7205
+ }) : jsx(GoACallout, {
7206
+ type: "important",
7207
+ size: "medium",
7208
+ testId: "form-support-callout",
7209
+ heading: "Not supported",
7210
+ children: "Only string and number are supported inside arrays"
7196
7211
  })
7197
7212
  })
7198
7213
  }, ix);
@@ -7349,9 +7364,12 @@ const ObjectArrayControl = props => {
7349
7364
  currentCategory.data = newCategoryData;
7350
7365
  }
7351
7366
  if ((currentCategory === null || currentCategory === void 0 ? void 0 : currentCategory.count) > 0) currentCategory.count--;
7352
- const handleChangeData = Object.keys(newCategoryData).map(key => {
7367
+ let handleChangeData = Object.keys(newCategoryData).map(key => {
7353
7368
  return newCategoryData[key];
7354
7369
  });
7370
+ if (handleChangeData.length === 0) {
7371
+ handleChangeData = null;
7372
+ }
7355
7373
  props.handleChange(path, handleChangeData);
7356
7374
  dispatch({
7357
7375
  type: DELETE_ACTION,
@@ -7419,8 +7437,10 @@ const ObjectArrayControl = props => {
7419
7437
  children: [jsxs(ToolBarHeader, {
7420
7438
  children: [isInReview && listTitle && jsx("b", {
7421
7439
  children: listTitle
7422
- }), !isInReview && listTitle && jsx(ObjectArrayTitle, {
7423
- children: listTitle
7440
+ }), !isInReview && listTitle && jsxs(ObjectArrayTitle, {
7441
+ children: [listTitle, " ", jsx("span", {
7442
+ children: additionalProps.required && '(required)'
7443
+ })]
7424
7444
  }), !isInReview && jsx(ObjectArrayToolBar, {
7425
7445
  errors: errors,
7426
7446
  label: label,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "1.53.5",
3
+ "version": "1.53.6",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Government of Alberta - React renderers for JSON Forms based on the design system.",
6
6
  "repository": "https://github.com/GovAlta/adsp-monorepo",
@@ -1,2 +1,2 @@
1
1
  export declare const getProperty: any;
2
- export declare const pickPropertyValues: (obj: any, property: string) => string[];
2
+ export declare const pickPropertyValues: (obj: any, property: string, endWithType?: string) => string[];