@abgov/jsonforms-components 2.1.4 → 2.1.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.
Files changed (2) hide show
  1. package/index.esm.js +8 -3
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -7558,11 +7558,16 @@ const renderCellColumn = ({
7558
7558
  }
7559
7559
  const path = `/${rowPath}/${index}/${element}/${index === 0 ? index : index - 1}`;
7560
7560
  const nestedErrors = errors === null || errors === void 0 ? void 0 : errors.filter(e => e.instancePath.includes(path));
7561
+ /* istanbul ignore next */
7561
7562
  if (typeof currentData === 'string') {
7562
7563
  return currentData;
7563
7564
  } else if (typeof currentData === 'object' || Array.isArray(currentData)) {
7564
7565
  const result = Object.keys(currentData);
7565
- if (result.length === 0) {
7566
+ if (!isRequired && nestedErrors.length === 0) {
7567
+ return jsx("pre", {
7568
+ children: JSON.stringify(currentData, null, 2)
7569
+ });
7570
+ } else if (result.length === 0) {
7566
7571
  return renderWarningCell();
7567
7572
  } else if (result.length > 0 && (isObjectArrayEmpty(currentData) || nestedErrors.length > 0)) {
7568
7573
  return jsx("pre", {
@@ -7678,7 +7683,7 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
7678
7683
  const properties = (schema === null || schema === void 0 ? void 0 : schema.items) && 'properties' in schema.items && schema.items.properties || {};
7679
7684
  const required = (_a = schema.items) === null || _a === void 0 ? void 0 : _a.required;
7680
7685
  const propertyKeys = Object.keys(properties);
7681
- const nestedItems = extractNestedFields(properties, propertyKeys);
7686
+ extractNestedFields(properties, propertyKeys);
7682
7687
  let tableKeys = extractNames((_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.detail);
7683
7688
  if (Object.keys(tableKeys).length === 0) {
7684
7689
  Object.keys(properties).forEach(item => {
@@ -7762,7 +7767,7 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
7762
7767
  children: renderCellColumn({
7763
7768
  currentData,
7764
7769
  error: error === null || error === void 0 ? void 0 : error.message,
7765
- isRequired: (required === null || required === void 0 ? void 0 : required.includes(tableKeys[element])) || ((_a = nestedItems[element]) === null || _a === void 0 ? void 0 : _a.required.length) > 0,
7770
+ isRequired: (_a = required === null || required === void 0 ? void 0 : required.includes(tableKeys[element])) !== null && _a !== void 0 ? _a : false,
7766
7771
  errors: errors !== undefined ? errors : [],
7767
7772
  count: count !== undefined ? count : -1,
7768
7773
  element,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.1.4",
3
+ "version": "2.1.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",