@abgov/jsonforms-components 2.43.5 → 2.43.7

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 +23 -7
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -6867,7 +6867,7 @@ const Dropdown = props => {
6867
6867
  const [inputText, setInputText] = useState(selected);
6868
6868
  const prevCountRef = useRef(props.items);
6869
6869
  const trailingIcon = isOpen ? 'chevron-up' : 'chevron-down';
6870
- const textInputName = `dropdown-${label}`;
6870
+ const textInputName = `dropdown-${label}-${id}`;
6871
6871
  const textInput = (_document$getElements = document.getElementsByName(textInputName)[0]) != null ? _document$getElements : null;
6872
6872
  const PREFIX = 'jsonforms-dropdown';
6873
6873
  useEffect(() => {
@@ -7040,7 +7040,7 @@ const Dropdown = props => {
7040
7040
  },
7041
7041
  children: jsx(GoabInput, {
7042
7042
  disabled: !enabled,
7043
- name: `dropdown-${label}`,
7043
+ name: `dropdown-${label}-${id}`,
7044
7044
  width: "100%",
7045
7045
  value: inputText,
7046
7046
  testId: `${id}-input`,
@@ -7757,7 +7757,7 @@ const EnumSelect = props => {
7757
7757
  enabled: enabled,
7758
7758
  selected: typeof data === 'object' ? ___default.get(data, valuePath) : data,
7759
7759
  width: width,
7760
- id: `jsonforms-${label}-dropdown`,
7760
+ id: `jsonforms-${path}-dropdown`,
7761
7761
  label: label,
7762
7762
  isAutoCompletion: autoCompletion,
7763
7763
  onChange: value => {
@@ -7769,7 +7769,7 @@ const EnumSelect = props => {
7769
7769
  handleChange(path, value);
7770
7770
  }
7771
7771
  }
7772
- }, `jsonforms-${label}-dropdown`)
7772
+ }, `jsonforms-${path}-dropdown`)
7773
7773
  });
7774
7774
  };
7775
7775
  const enumControl = props => {
@@ -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.7",
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",