@abgov/jsonforms-components 2.43.5 → 2.43.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 +19 -3
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -11969,19 +11969,35 @@ const MainTab = ({
11969
11969
  const rowData = getDataAtPath(core == null ? void 0 : core.data, childPath);
11970
11970
  const orderedRowData = orderRowData(rowData, uischema == null || (_uischema$options10 = uischema.options) == null ? void 0 : _uischema$options10.detail);
11971
11971
  function resolveField(e) {
11972
+ var _e$params;
11972
11973
  if (e.keyword === 'required') {
11973
11974
  return e.params.missingProperty;
11975
+ } else if (e.keyword === 'errorMessage' && (_e$params = e.params) != null && _e$params.errors[0].params.missingProperty) {
11976
+ return e.params.errors[0].params.missingProperty;
11974
11977
  }
11975
11978
  const path = e.instancePath.split('/');
11976
11979
  return path[path.length - 1];
11977
11980
  }
11978
11981
  const rowBase = `/${childPath.replace(/\./g, '/')}`;
11979
11982
  const fieldErrors = core == null || (_core$errors = core.errors) == null ? void 0 : _core$errors.filter(e => e.instancePath === rowBase || e.instancePath.startsWith(rowBase + '/')).reduce((acc, e) => {
11983
+ var _e$params2;
11980
11984
  const field = resolveField(e);
11981
- acc[field] = humanizeAjvError(e, core.schema, core.uischema); //e.message;
11985
+ if (e.keyword === 'errorMessage' && (_e$params2 = e.params) != null && _e$params2.errors) {
11986
+ if (field) {
11987
+ acc.fields[field] = e.message || 'Unknown error';
11988
+ } else {
11989
+ acc.row = (e == null ? void 0 : e.message) || 'Unknown error';
11990
+ return acc;
11991
+ }
11992
+ }
11993
+ if (!acc.fields[field]) {
11994
+ acc.fields[field] = humanizeAjvError(e, core.schema, core.uischema);
11995
+ }
11982
11996
  return acc;
11983
- }, {});
11984
- const errorText = fieldErrors && Object.values(fieldErrors).length > 0 ? Object.values(fieldErrors).join(', ') : undefined;
11997
+ }, {
11998
+ fields: {}
11999
+ });
12000
+ const errorText = fieldErrors && Object.values(fieldErrors.fields).length > 0 ? Object.values(fieldErrors.fields).join(', ') : fieldErrors == null ? void 0 : fieldErrors.row;
11985
12001
  return jsx("div", {
11986
12002
  "data-testid": `object-array-main-item-${rowIndex}`,
11987
12003
  children: errorText ? jsx(GoabFormItem, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.43.5",
3
+ "version": "2.43.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",