@abgov/jsonforms-components 2.1.5 → 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.
- package/index.esm.js +9 -4
- 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 (
|
|
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", {
|
|
@@ -7742,7 +7747,7 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
|
|
|
7742
7747
|
const errorRow = errors === null || errors === void 0 ? void 0 : errors.find(error => error.instancePath.includes(`/${props.rowPath.replace(/\./g, '/')}/${i}`));
|
|
7743
7748
|
return jsxs("tr", {
|
|
7744
7749
|
children: [Object.keys(properties).map((element, ix) => {
|
|
7745
|
-
var _a;
|
|
7750
|
+
var _a, _b;
|
|
7746
7751
|
const dataObject = properties[element];
|
|
7747
7752
|
const schemaName = element;
|
|
7748
7753
|
const currentData = data && data[num] ? data[num][element] : '';
|
|
@@ -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]),
|
|
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,
|
|
@@ -7774,7 +7779,7 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
|
|
|
7774
7779
|
}
|
|
7775
7780
|
return jsx("td", {
|
|
7776
7781
|
children: jsx(GoAFormItem, {
|
|
7777
|
-
error: (
|
|
7782
|
+
error: (_b = error === null || error === void 0 ? void 0 : error.message) !== null && _b !== void 0 ? _b : '',
|
|
7778
7783
|
mb: errorRow && !error && '2xl' || 'xs',
|
|
7779
7784
|
children: dataObject.type === 'number' || dataObject.type === 'string' && !dataObject.enum ? jsx(GoAInput, {
|
|
7780
7785
|
error: (error === null || error === void 0 ? void 0 : error.message.length) > 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "2.1.
|
|
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",
|