@abgov/jsonforms-components 2.3.0 → 2.3.1

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
@@ -8675,7 +8675,12 @@ class ListWithDetailControl extends React.Component {
8675
8675
  constructor() {
8676
8676
  super(...arguments);
8677
8677
  // eslint-disable-next-line
8678
- this.addItem = (path, value) => this.props.addItem(path, value);
8678
+ this.addItem = (path, value) => {
8679
+ const pathIdValue = (path === null || path === void 0 ? void 0 : path.split('.')) || '';
8680
+ if (pathIdValue.length > 1 && +this.props.data === 0 || pathIdValue.length === 1) {
8681
+ this.props.addItem(path, value)();
8682
+ }
8683
+ };
8679
8684
  }
8680
8685
  render() {
8681
8686
  var _a;
@@ -8710,7 +8715,9 @@ class ListWithDetailControl extends React.Component {
8710
8715
  }), jsx(ObjectArrayToolBar, {
8711
8716
  errors: errors,
8712
8717
  label: label,
8713
- addItem: this.addItem,
8718
+ addItem: (path, value) => () => {
8719
+ this.addItem(path, value);
8720
+ },
8714
8721
  numColumns: 0,
8715
8722
  path: path,
8716
8723
  uischema: controlElement,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
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",
@@ -33,7 +33,7 @@ interface NonEmptyRowProps {
33
33
  }
34
34
  export declare const NonEmptyList: React.MemoExoticComponent<({ childPath, schema, enabled, cells, uischema, }: NonEmptyRowProps & WithDeleteDialogSupport) => import("react/jsx-runtime").JSX.Element>;
35
35
  export declare class ListWithDetailControl extends React.Component<ObjectArrayControlProps, any> {
36
- addItem: (path: string, value: any) => () => void;
36
+ addItem: (path: string, value: any) => void;
37
37
  render(): import("react/jsx-runtime").JSX.Element;
38
38
  }
39
39
  export {};