@abgov/jsonforms-components 2.42.1 → 2.42.3

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 +87 -77
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -7160,7 +7160,6 @@ const CompletionStatus = styled.div(_t2$4 || (_t2$4 = _$6`
7160
7160
  const BarTop = styled.div(_t3$3 || (_t3$3 = _$6`
7161
7161
  display: flex;
7162
7162
 
7163
-
7164
7163
  .progress-text {
7165
7164
  margin-left: auto;
7166
7165
  }
@@ -7194,8 +7193,6 @@ const Bar = styled.div(_t4$3 || (_t4$3 = _$6`
7194
7193
 
7195
7194
  box-sizing: border-box;
7196
7195
  }
7197
-
7198
-
7199
7196
  `));
7200
7197
  styled.div(_t5$3 || (_t5$3 = _$6``));
7201
7198
  const BadgeWrapper = styled.div(_t6$2 || (_t6$2 = _$6`
@@ -7321,6 +7318,12 @@ const PageStepperRow = styled.tr(_t25$1 || (_t25$1 = _$6`
7321
7318
  td {
7322
7319
  transition: background-color 0.2s ease-in-out;
7323
7320
  }
7321
+
7322
+
7323
+ &:focus-visible {
7324
+ border-radius: 0.25rem;
7325
+ outline: 3px solid var(--goa-color-interactive-focus);
7326
+ }
7324
7327
  `);
7325
7328
  const SectionHeaderRowTr = styled.tr(_t26 || (_t26 = _$6`
7326
7329
  & > td {
@@ -10154,7 +10157,7 @@ const Trash = styled.div(_t12 || (_t12 = _$3`
10154
10157
  const ListContainer = styled.div(_t13 || (_t13 = _$3`
10155
10158
  padding: 0 0 0 0;
10156
10159
  `));
10157
- const DetailMargin = styled.div(_t14 || (_t14 = _$3`
10160
+ styled.div(_t14 || (_t14 = _$3`
10158
10161
  padding: 0 0 var(--goa-space-l) 0;
10159
10162
  `));
10160
10163
  const IconPadding = styled.div(_t15 || (_t15 = _$3`
@@ -11526,17 +11529,24 @@ const MainTab = ({
11526
11529
  } = useJsonForms();
11527
11530
  const rowData = getDataAtPath(core === null || core === void 0 ? void 0 : core.data, childPath);
11528
11531
  const orderedRowData = orderRowData(rowData, (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.detail);
11529
- const rowErrors = (_b = core === null || core === void 0 ? void 0 : core.errors) === null || _b === void 0 ? void 0 : _b.filter(e => {
11530
- const base = `/${childPath.replace(/\./g, '/')}`;
11531
- return e.instancePath === base || e.instancePath.startsWith(base + '/');
11532
- }).filter(e => {
11533
- var _a;
11534
- return (((_a = e === null || e === void 0 ? void 0 : e.message) === null || _a === void 0 ? void 0 : _a.length) || 0) > 0;
11535
- }).map(e => humanizeAjvError(e, core.schema, core.uischema)).map((msg, index, arr) => `${msg}${index < arr.length - 1 ? ', ' : ''}`);
11532
+ function resolveField(e) {
11533
+ if (e.keyword === 'required') {
11534
+ return e.params.missingProperty;
11535
+ }
11536
+ const path = e.instancePath.split('/');
11537
+ return path[path.length - 1];
11538
+ }
11539
+ const rowBase = `/${childPath.replace(/\./g, '/')}`;
11540
+ const fieldErrors = (_b = core === null || core === void 0 ? void 0 : core.errors) === null || _b === void 0 ? void 0 : _b.filter(e => e.instancePath === rowBase || e.instancePath.startsWith(rowBase + '/')).reduce((acc, e) => {
11541
+ const field = resolveField(e);
11542
+ acc[field] = humanizeAjvError(e, core.schema, core.uischema); //e.message;
11543
+ return acc;
11544
+ }, {});
11545
+ const errorText = fieldErrors && Object.values(fieldErrors).length > 0 ? Object.values(fieldErrors).join(', ') : undefined;
11536
11546
  return jsx("div", {
11537
11547
  "data-testid": `object-array-main-item-${rowIndex}`,
11538
- children: (rowErrors === null || rowErrors === void 0 ? void 0 : rowErrors.length) ? jsx(GoabFormItem, {
11539
- error: (rowErrors === null || rowErrors === void 0 ? void 0 : rowErrors.length) ? rowErrors : null,
11548
+ children: errorText ? jsx(GoabFormItem, {
11549
+ error: errorText,
11540
11550
  children: jsx(MainItemComponent, {
11541
11551
  rowData: orderedRowData,
11542
11552
  childPath: childPath,
@@ -11579,7 +11589,7 @@ const ObjectArrayList = ({
11579
11589
  listTitle,
11580
11590
  errors
11581
11591
  }) => {
11582
- var _a, _b;
11592
+ var _a, _b, _c, _d;
11583
11593
  const isEmptyList = data === 0;
11584
11594
  const rightRef = useRef(null);
11585
11595
  const current = rightRef.current;
@@ -11611,6 +11621,7 @@ const ObjectArrayList = ({
11611
11621
  const selectCurrentTab = index => {
11612
11622
  setCurrentIndex(index);
11613
11623
  };
11624
+ const continueButtonTitle = (_d = (_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.componentProps) === null || _d === void 0 ? void 0 : _d.listWithDetailsContinueButtonTitle;
11614
11625
  return jsx(ListContainer, {
11615
11626
  children: jsxs(RowFlex, {
11616
11627
  children: [currentListPage === 0 && jsx(FlexTabs, {
@@ -11628,7 +11639,8 @@ const ObjectArrayList = ({
11628
11639
  enabled: enabled,
11629
11640
  current: current,
11630
11641
  setCurrentListPage: index => setCurrentListPage(index),
11631
- uischema: uischema
11642
+ uischema: uischema,
11643
+ schema: schema
11632
11644
  }, childPath);
11633
11645
  })
11634
11646
  }), currentListPage > 0 && jsxs(UpdateListContainer, {
@@ -11655,7 +11667,7 @@ const ObjectArrayList = ({
11655
11667
  setCurrentListPage(0);
11656
11668
  },
11657
11669
  testId: "next-list-button",
11658
- children: "Continue"
11670
+ children: continueButtonTitle ? continueButtonTitle : 'Continue'
11659
11671
  })]
11660
11672
  })]
11661
11673
  })
@@ -11721,67 +11733,23 @@ class ListWithDetailControl extends React.Component {
11721
11733
  const controlElement = uischema;
11722
11734
  // eslint-disable-next-line
11723
11735
  const listTitle = (_e = (_d = (_c = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.label) !== null && _a !== void 0 ? _a : (_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.title) !== null && _c !== void 0 ? _c : getItemsTitle(schema)) !== null && _d !== void 0 ? _d : schema === null || schema === void 0 ? void 0 : schema.title) !== null && _e !== void 0 ? _e : label;
11724
- return jsx(Visible, {
11736
+ return jsxs(Visible, {
11725
11737
  visible: visible,
11726
11738
  "data-testid": "jsonforms-object-list-wrapper",
11727
- children: jsxs(DetailMargin, {
11728
- children: [jsxs(ToolBarHeader, {
11729
- children: [listTitle && this.state.currentListPage === 0 && jsx(MarginTop, {
11730
- children: jsxs(ObjectArrayTitle, {
11731
- children: [listTitle, " ", jsx("span", {
11732
- children: additionalProps.required && '(required)'
11733
- }), this.state.maxItemsError && jsx("span", {
11734
- style: {
11735
- color: 'red',
11736
- marginLeft: '1rem'
11737
- },
11738
- children: this.state.maxItemsError
11739
- })]
11740
- })
11741
- }), this.state.currentListPage === 0 && data === 0 && jsx(ObjectArrayToolBar, {
11742
- data: data,
11743
- errors: errors,
11744
- label: label,
11745
- addItem: (path, value) => () => {
11746
- this.addItem(path, value);
11747
- },
11748
- numColumns: 0,
11749
- path: path,
11750
- uischema: controlElement,
11751
- schema: schema,
11752
- rootSchema: rootSchema,
11753
- enabled: enabled,
11754
- setCurrentListPage: listPage => {
11755
- this.setState({
11756
- currentListPage: listPage
11757
- });
11758
- },
11759
- currentListPage: this.state.currentListPage,
11760
- buttonType: "secondary"
11761
- })]
11762
- }), jsx("div", {
11763
- children: jsx(ObjectArrayList, Object.assign({
11764
- path: path,
11765
- schema: schema,
11766
- uischema: uischema,
11767
- enabled: enabled,
11768
- openDeleteDialog: openDeleteDialog,
11769
- translations: {},
11770
- data: data,
11771
- cells: cells,
11772
- config: config,
11773
- currentIndex: this.props.currentTab,
11774
- setCurrentIndex: this.props.setCurrentTab,
11775
- setCurrentListPage: listPage => {
11776
- this.setState({
11777
- currentListPage: listPage
11778
- });
11779
- },
11780
- errors: errors,
11781
- currentListPage: this.state.currentListPage,
11782
- listTitle: listTitle
11783
- }, additionalProps))
11784
- }), this.state.currentListPage === 0 && data > 0 && jsx(ObjectArrayToolBar, {
11739
+ children: [jsxs(ToolBarHeader, {
11740
+ children: [listTitle && this.state.currentListPage === 0 && jsx(MarginTop, {
11741
+ children: jsxs(ObjectArrayTitle, {
11742
+ children: [listTitle, " ", jsx("span", {
11743
+ children: additionalProps.required && '(required)'
11744
+ }), this.state.maxItemsError && jsx("span", {
11745
+ style: {
11746
+ color: 'red',
11747
+ marginLeft: '1rem'
11748
+ },
11749
+ children: this.state.maxItemsError
11750
+ })]
11751
+ })
11752
+ }), this.state.currentListPage === 0 && data === 0 && jsx(ObjectArrayToolBar, {
11785
11753
  data: data,
11786
11754
  errors: errors,
11787
11755
  label: label,
@@ -11800,9 +11768,51 @@ class ListWithDetailControl extends React.Component {
11800
11768
  });
11801
11769
  },
11802
11770
  currentListPage: this.state.currentListPage,
11803
- buttonType: "tertiary"
11771
+ buttonType: "secondary"
11804
11772
  })]
11805
- })
11773
+ }), jsx("div", {
11774
+ children: jsx(ObjectArrayList, Object.assign({
11775
+ path: path,
11776
+ schema: schema,
11777
+ uischema: uischema,
11778
+ enabled: enabled,
11779
+ openDeleteDialog: openDeleteDialog,
11780
+ translations: {},
11781
+ data: data,
11782
+ cells: cells,
11783
+ config: config,
11784
+ currentIndex: this.props.currentTab,
11785
+ setCurrentIndex: this.props.setCurrentTab,
11786
+ setCurrentListPage: listPage => {
11787
+ this.setState({
11788
+ currentListPage: listPage
11789
+ });
11790
+ },
11791
+ errors: errors,
11792
+ currentListPage: this.state.currentListPage,
11793
+ listTitle: listTitle
11794
+ }, additionalProps))
11795
+ }), this.state.currentListPage === 0 && data > 0 && jsx(ObjectArrayToolBar, {
11796
+ data: data,
11797
+ errors: errors,
11798
+ label: label,
11799
+ addItem: (path, value) => () => {
11800
+ this.addItem(path, value);
11801
+ },
11802
+ numColumns: 0,
11803
+ path: path,
11804
+ uischema: controlElement,
11805
+ schema: schema,
11806
+ rootSchema: rootSchema,
11807
+ enabled: enabled,
11808
+ setCurrentListPage: listPage => {
11809
+ this.setState({
11810
+ currentListPage: listPage
11811
+ });
11812
+ },
11813
+ currentListPage: this.state.currentListPage,
11814
+ buttonType: "tertiary"
11815
+ })]
11806
11816
  });
11807
11817
  }
11808
11818
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.42.1",
3
+ "version": "2.42.3",
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",