@abgov/jsonforms-components 2.37.0 → 2.38.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
@@ -12,6 +12,7 @@ import ___default, { isEqual, isEmpty as isEmpty$1, isObject as isObject$f } fro
12
12
  import merge from 'lodash/merge';
13
13
  import isEmpty from 'lodash/isEmpty';
14
14
  import range from 'lodash/range';
15
+ import pluralize from 'pluralize';
15
16
  import { evaluateSync, compileSync } from '@mdx-js/mdx';
16
17
  import { Parser } from 'expr-eval';
17
18
  import Ajv from 'ajv';
@@ -7084,10 +7085,10 @@ let _$6 = t => t,
7084
7085
  _t16$1,
7085
7086
  _t17$1,
7086
7087
  _t18$1,
7087
- _t19,
7088
- _t20,
7089
- _t21,
7090
- _t22,
7088
+ _t19$1,
7089
+ _t20$1,
7090
+ _t21$1,
7091
+ _t22$1,
7091
7092
  _t23,
7092
7093
  _t24,
7093
7094
  _t25,
@@ -7228,22 +7229,22 @@ styled.div(_t17$1 || (_t17$1 = _$6`
7228
7229
  const PageBorder = styled.div(_t18$1 || (_t18$1 = _$6`
7229
7230
  padding: var(--goa-space-m) var(--goa-space-3xl);
7230
7231
  `));
7231
- const TableReviewItemSection = styled.div(_t19 || (_t19 = _$6`
7232
+ const TableReviewItemSection = styled.div(_t19$1 || (_t19$1 = _$6`
7232
7233
  .element-style {
7233
7234
  max-width: 1600px;
7234
7235
  }
7235
7236
  `));
7236
- const TableReviewItem = styled.div(_t20 || (_t20 = _$6`
7237
+ const TableReviewItem = styled.div(_t20$1 || (_t20$1 = _$6`
7237
7238
  padding: var(--goa-space-xl) var(--goa-space-2xl);
7238
7239
  border: 1px solid var(--goa-color-greyscale-300);
7239
7240
  border-radius: var(--goa-border-radius-xl);
7240
7241
  `));
7241
- const TableReviewPageTitleRow = styled.div(_t21 || (_t21 = _$6`
7242
+ const TableReviewPageTitleRow = styled.div(_t21$1 || (_t21$1 = _$6`
7242
7243
  margin-top: var(--goa-space-xl);
7243
7244
  display: flex;
7244
7245
  justify-content: space-between;
7245
7246
  `));
7246
- const TableReviewCategoryLabel = styled.h3(_t22 || (_t22 = _$6`
7247
+ const TableReviewCategoryLabel = styled.h3(_t22$1 || (_t22$1 = _$6`
7247
7248
  color: var(--goa-color-text-secondary) !important;
7248
7249
  margin-bottom: var(--goa-space-l);
7249
7250
  `));
@@ -8748,10 +8749,12 @@ const ApplicationStatus = ({
8748
8749
  const completed = completedGroups;
8749
8750
  const badge = totalGroups === completed ? jsx(GoABadge, {
8750
8751
  type: "success",
8751
- content: "Complete"
8752
+ content: "Complete",
8753
+ icon: false
8752
8754
  }) : jsx(GoABadge, {
8753
8755
  type: "information",
8754
- content: "Incomplete"
8756
+ content: "Incomplete",
8757
+ icon: false
8755
8758
  });
8756
8759
  const mainHeading = 'Application Progress';
8757
8760
  const progressPercentageAccurate = 100 * completed / totalGroups;
@@ -8832,7 +8835,8 @@ const getCategoryStatusBadge = category => {
8832
8835
  jsx(GoABadge, {
8833
8836
  type: badgeType,
8834
8837
  content: status,
8835
- ariaLabel: status
8838
+ ariaLabel: status,
8839
+ icon: false
8836
8840
  })
8837
8841
  // </div>
8838
8842
  );
@@ -9922,97 +9926,117 @@ let _$3 = t => t,
9922
9926
  _t15,
9923
9927
  _t16,
9924
9928
  _t17,
9925
- _t18;
9929
+ _t18,
9930
+ _t19,
9931
+ _t20,
9932
+ _t21,
9933
+ _t22;
9926
9934
  const DeleteDialogContent = styled.div(_t$3 || (_t$3 = _$3`
9927
9935
  margin-bottom: var(--goa-space-m);
9928
9936
  `));
9929
- const NonEmptyCellStyle = styled.div(_t2$2 || (_t2$2 = _$3`
9937
+ const MarginTop = styled.div(_t2$2 || (_t2$2 = _$3`
9938
+ margin-top: var(--goa-space-l);
9939
+ `));
9940
+ const NonEmptyCellStyle = styled.div(_t3$1 || (_t3$1 = _$3`
9930
9941
  goa-table thead th {
9931
9942
  background-color: #000:
9932
9943
  }
9933
9944
  `));
9934
- const ToolBarHeader = styled.div(_t3$1 || (_t3$1 = _$3`
9935
- margin-bottom: var(--goa-space-l);
9945
+ const ToolBarHeader = styled.div(_t4$1 || (_t4$1 = _$3`
9946
+ margin-bottom: var(--goa-space-s);
9936
9947
  `));
9937
- const ObjectArrayTitle = styled.h3(_t4$1 || (_t4$1 = _$3`
9938
- margin-bottom: var(--goa-space-l);
9948
+ const ObjectArrayTitle = styled.h3(_t5$1 || (_t5$1 = _$3`
9949
+ margin-bottom: var(--goa-space-s);
9939
9950
 
9940
9951
  span {
9941
9952
  color: #666666;
9942
9953
  font-size: var(--goa-font-size-2);
9943
9954
  }
9944
9955
  `));
9945
- const RequiredSpan = styled.span(_t5$1 || (_t5$1 = _$3`
9956
+ const RequiredSpan = styled.span(_t6$1 || (_t6$1 = _$3`
9946
9957
  color: #666666;
9947
9958
  font-weight: var(--goa-font-weight-regular);
9948
9959
  font-size: var(--goa-font-size-2);
9949
9960
  `));
9950
- const TextCenter = styled.div(_t6$1 || (_t6$1 = _$3`
9961
+ const TextCenter = styled.div(_t7 || (_t7 = _$3`
9951
9962
  text-align: center;
9952
9963
  `));
9953
- const SideMenuItem = styled.div(_t7 || (_t7 = _$3`
9964
+ const SideMenuItem = styled.div(_t8 || (_t8 = _$3`
9954
9965
  &:hover {
9955
9966
  background: #f1f1f1;
9956
9967
  }
9957
9968
  `));
9958
- const RowFlex = styled.div(_t8 || (_t8 = _$3`
9969
+ const RowFlex = styled.div(_t9 || (_t9 = _$3`
9959
9970
  display: flex;
9960
9971
  align-items: stretch;
9961
9972
  `));
9962
- const RowFlexMenu = styled.div(_t9 || (_t9 = _$3`
9973
+ const RowFlexMenu = styled.div(_t0 || (_t0 = _$3`
9963
9974
  display: flex;
9964
9975
  flex-direction: row;
9965
- border-bottom: 1px solid #dcdcdc;
9976
+ border: 1px solid #dcdcdc;
9977
+ margin-top: 1rem;
9966
9978
  `));
9967
- const FlexTabs = styled.div(_t0 || (_t0 = _$3`
9979
+ const FlexTabs = styled.div(_t1 || (_t1 = _$3`
9968
9980
  flex-direction: column;
9969
9981
  flex: 1;
9970
9982
  overflow-y: auto !important;
9971
- margin-right: 1.5rem;
9972
9983
  `));
9973
- const FlexForm = styled.div(_t1 || (_t1 = _$3`
9984
+ const FlexForm = styled.div(_t10 || (_t10 = _$3`
9974
9985
  flex-direction: column;
9975
- margin: 1.5rem 0;
9976
9986
  flex: 3;
9977
9987
  `));
9978
- const TabName = styled.div(_t10 || (_t10 = _$3`
9988
+ const TabData = styled.div(_t11 || (_t11 = _$3`
9979
9989
  margin: 1rem 0 1rem 1rem;
9980
- font-weight: 700;
9990
+ font-weight: 400;
9991
+ white-space: nowrap;
9992
+ overflow: hidden;
9993
+ text-overflow: ellipsis;
9981
9994
  `));
9982
- const Trash = styled.div(_t11 || (_t11 = _$3`
9983
- margin: 0.75rem 1.25rem 0.75rem 0.75rem;
9995
+ const Trash = styled.div(_t12 || (_t12 = _$3`
9996
+ margin: 0.9rem 0.4rem 0.6rem 0.75rem;
9984
9997
  margin-left: auto;
9985
9998
  `));
9986
- const ListContainer = styled.div(_t12 || (_t12 = _$3`
9999
+ const ListContainer = styled.div(_t13 || (_t13 = _$3`
10000
+ padding: 0 0 0 0;
10001
+ `));
10002
+ const IconPadding = styled.div(_t14 || (_t14 = _$3`
10003
+ padding: 0.9rem 0.5rem 0 0;
10004
+ `));
10005
+ const UpdateListContainer = styled.div(_t15 || (_t15 = _$3`
10006
+ width: 100%;
10007
+ border: 1px solid #dcdcdc;
10008
+ padding: var(--goa-space-xl);
10009
+ `));
10010
+ styled.div(_t16 || (_t16 = _$3`
9987
10011
  padding: 0 1.5rem 0 0;
9988
10012
  border: 1px solid #dcdcdc;
9989
10013
  `));
9990
- const TableTHHeader = styled.th(_t13 || (_t13 = _$3`
10014
+ const TableTHHeader = styled.th(_t17 || (_t17 = _$3`
9991
10015
  background-color: var(--goa-color-greyscale-100) !important;
9992
10016
  vertical-align: top;
9993
10017
  `));
9994
- const ObjectArrayWarningIconDiv = styled.div(_t14 || (_t14 = _$3`
10018
+ const ObjectArrayWarningIconDiv = styled.div(_t18 || (_t18 = _$3`
9995
10019
  display: inline-flex;
9996
10020
  align-items: flex-start;
9997
10021
  gap: 0.25rem;
9998
10022
  font-size: var(--goa-font-size-2);
9999
10023
  color: var(--goa-color-interactive-error);
10000
10024
  `));
10001
- const ListWithDetailWarningIconDiv = styled.div(_t15 || (_t15 = _$3`
10025
+ const ListWithDetailWarningIconDiv = styled.div(_t19 || (_t19 = _$3`
10002
10026
  display: inline-flex;
10003
10027
  align-items: flex-start;
10004
10028
  gap: 0.25rem;
10005
10029
  font-size: var(--goa-font-size-3);
10006
10030
  color: var(--goa-color-interactive-error);
10007
10031
  `));
10008
- styled.label(_t16 || (_t16 = _$3`
10032
+ styled.label(_t20 || (_t20 = _$3`
10009
10033
  color: var(--goa-color-interactive-error);
10010
10034
  font-weight: var(--goa-font-weight-regular);
10011
10035
  font-size: var(--goa-font-size-3);
10012
10036
  line-height: var(--goa-line-height-1);
10013
10037
  font-style: normal;
10014
10038
  `));
10015
- styled.div(_t17 || (_t17 = _$3`
10039
+ styled.div(_t21 || (_t21 = _$3`
10016
10040
  margin-top: var(--goa-space-m);
10017
10041
  color: var(--goa-color-interactive-error);
10018
10042
  font-weight: var(--goa-font-weight-regular);
@@ -10020,7 +10044,7 @@ styled.div(_t17 || (_t17 = _$3`
10020
10044
  line-height: var(--goa-line-height-1);
10021
10045
  font-style: normal;
10022
10046
  `));
10023
- const HilightCellWarning = styled.div(_t18 || (_t18 = _$3`
10047
+ const HilightCellWarning = styled.div(_t22 || (_t22 = _$3`
10024
10048
  background-color: var(--goa-color-warning-default);
10025
10049
  `));
10026
10050
 
@@ -10072,15 +10096,18 @@ const DeleteDialog = /*#__PURE__*/React.memo(function DeleteDialog({
10072
10096
  });
10073
10097
 
10074
10098
  const ObjectArrayToolBar = /*#__PURE__*/React.memo(function TableToolbar({
10099
+ data,
10075
10100
  label,
10076
10101
  path,
10077
10102
  addItem,
10078
10103
  schema,
10079
10104
  enabled,
10080
10105
  rootSchema,
10081
- uischema
10106
+ uischema,
10107
+ setCurrentListPage,
10108
+ buttonType
10082
10109
  }) {
10083
- var _a, _b, _c, _d, _e;
10110
+ var _a, _b, _c, _d, _e, _f;
10084
10111
  const buttonPosition = ((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.addButtonPosition) || 'left';
10085
10112
  const buttonUIProps = ((_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.addButtonUIProps) || {};
10086
10113
  const arrayLabel = getLabelText(uischema.scope, label);
@@ -10089,16 +10116,21 @@ const ObjectArrayToolBar = /*#__PURE__*/React.memo(function TableToolbar({
10089
10116
  style: {
10090
10117
  textAlign: buttonPosition
10091
10118
  },
10092
- children: jsx(GoAButton, Object.assign({
10093
- disabled: !enabled,
10094
- testId: `object-array-toolbar-${label}`,
10095
- leadingIcon: "add",
10096
- "aria-label": `Add to button to ${(label === null || label === void 0 ? void 0 : label.toLowerCase()) || ''}`,
10097
- onClick: addItem(path, createDefaultValue(schema, rootSchema)),
10098
- type: (_d = (_c = uischema.options) === null || _c === void 0 ? void 0 : _c.addButtonType) !== null && _d !== void 0 ? _d : 'secondary'
10099
- }, buttonUIProps, {
10100
- children: ((_e = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _e === void 0 ? void 0 : _e.addButtonText) || capitalizeFirstLetter(`Add ${arrayLabel}`)
10101
- }))
10119
+ children: jsx(MarginTop, {
10120
+ children: jsx(GoAButton, Object.assign({
10121
+ disabled: !enabled,
10122
+ testId: `object-array-toolbar-${label}`,
10123
+ leadingIcon: "add",
10124
+ "aria-label": `Add to button to ${(label === null || label === void 0 ? void 0 : label.toLowerCase()) || ''}`,
10125
+ onClick: () => {
10126
+ addItem(path, createDefaultValue(schema, rootSchema))();
10127
+ setCurrentListPage === null || setCurrentListPage === void 0 ? void 0 : setCurrentListPage(data + 1);
10128
+ },
10129
+ type: (_e = (_d = (_c = uischema.options) === null || _c === void 0 ? void 0 : _c.addButtonType) !== null && _d !== void 0 ? _d : buttonType) !== null && _e !== void 0 ? _e : 'secondary'
10130
+ }, buttonUIProps, {
10131
+ children: ((_f = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _f === void 0 ? void 0 : _f.addButtonText) || `Add ${pluralize.singular(arrayLabel.charAt(0).toLowerCase() + arrayLabel.slice(1))}`
10132
+ }))
10133
+ })
10102
10134
  })
10103
10135
  });
10104
10136
  });
@@ -11029,7 +11061,7 @@ const NonEmptyRowComponent = ({
11029
11061
  }) : null
11030
11062
  }, childPath);
11031
11063
  };
11032
- const LeftTab = ({
11064
+ const MainTab = ({
11033
11065
  childPath,
11034
11066
  rowIndex,
11035
11067
  openDeleteDialog,
@@ -11038,41 +11070,59 @@ const LeftTab = ({
11038
11070
  currentTab,
11039
11071
  name,
11040
11072
  current,
11041
- translations
11073
+ setCurrentListPage
11042
11074
  }) => {
11075
+ var _a;
11076
+ /* eslint-disable @typescript-eslint/no-explicit-any */
11077
+ const getDataAtPath = (data, path) => path.replace(/\[(\d+)\]/g, '.$1').split('.').reduce((acc, key) => acc ? acc[key] : undefined, data);
11078
+ const {
11079
+ core
11080
+ } = useJsonForms();
11081
+ const rowData = getDataAtPath(core === null || core === void 0 ? void 0 : core.data, childPath);
11082
+ const rowErrors = (_a = core === null || core === void 0 ? void 0 : core.errors) === null || _a === void 0 ? void 0 : _a.filter(e => {
11083
+ const base = `/${childPath.replace(/\./g, '/')}`;
11084
+ return e.instancePath === base || e.instancePath.startsWith(base + '/');
11085
+ }).map(error => error === null || error === void 0 ? void 0 : error.message);
11043
11086
  return jsx("div", {
11044
- children: jsx(SideMenuItem, {
11045
- style: currentTab === rowIndex ? {
11046
- background: '#EFF8FF'
11047
- } : {},
11048
- onClick: () => selectCurrentTab(rowIndex),
11049
- onKeyDown: e => {
11050
- if (e.key === 'ArrowRight') {
11051
- e.preventDefault();
11052
- if (current) {
11053
- const goa = current === null || current === void 0 ? void 0 : current.querySelector('goa-input, goa-button');
11054
- if (goa === null || goa === void 0 ? void 0 : goa.shadowRoot) {
11055
- const internal = goa.shadowRoot.querySelector('input, button');
11056
- internal === null || internal === void 0 ? void 0 : internal.focus();
11057
- selectCurrentTab(rowIndex);
11087
+ children: jsx(GoAFormItem, {
11088
+ error: (rowErrors === null || rowErrors === void 0 ? void 0 : rowErrors.length) ? rowErrors : undefined,
11089
+ children: jsx(SideMenuItem, {
11090
+ onClick: () => selectCurrentTab(rowIndex),
11091
+ onKeyDown: e => {
11092
+ if (e.key === 'ArrowRight') {
11093
+ e.preventDefault();
11094
+ if (current) {
11095
+ const goa = current === null || current === void 0 ? void 0 : current.querySelector('goa-input, goa-button');
11096
+ if (goa === null || goa === void 0 ? void 0 : goa.shadowRoot) {
11097
+ const internal = goa.shadowRoot.querySelector('input, button');
11098
+ internal === null || internal === void 0 ? void 0 : internal.focus();
11099
+ selectCurrentTab(rowIndex);
11100
+ }
11058
11101
  }
11059
11102
  }
11060
- }
11061
- },
11062
- children: jsxs(RowFlexMenu, {
11063
- tabIndex: 0,
11064
- children: [jsx(TabName, {
11065
- children: name
11066
- }), enabled ? jsx(Trash, {
11067
- role: "trash button",
11068
- children: jsx(GoAIconButton, {
11069
- disabled: !enabled,
11070
- icon: "trash",
11071
- title: 'trash button',
11072
- testId: "remove the details",
11073
- onClick: () => openDeleteDialog(childPath, rowIndex, name)
11074
- })
11075
- }) : null]
11103
+ },
11104
+ children: jsxs(RowFlexMenu, {
11105
+ tabIndex: 0,
11106
+ children: [jsxs(TabData, {
11107
+ children: [Object.keys(rowData !== null && rowData !== void 0 ? rowData : {}).length === 0 && 'No data', " ", Object.values(rowData).join(', ')]
11108
+ }), enabled ? jsx(Trash, {
11109
+ children: jsx(GoAIconButton, {
11110
+ disabled: !enabled,
11111
+ icon: "trash",
11112
+ title: 'remove',
11113
+ testId: "remove the details",
11114
+ onClick: () => openDeleteDialog(childPath, rowIndex, name)
11115
+ })
11116
+ }) : null, jsx(IconPadding, {
11117
+ children: jsx(GoAIconButton, {
11118
+ disabled: !enabled,
11119
+ icon: "create",
11120
+ title: 'edit',
11121
+ testId: "edit button",
11122
+ onClick: () => setCurrentListPage(currentTab + 1)
11123
+ })
11124
+ })]
11125
+ })
11076
11126
  })
11077
11127
  })
11078
11128
  }, childPath);
@@ -11089,13 +11139,17 @@ const ObjectArrayList = ({
11089
11139
  cells,
11090
11140
  translations,
11091
11141
  currentIndex,
11092
- setCurrentIndex
11142
+ setCurrentIndex,
11143
+ setCurrentListPage,
11144
+ currentListPage,
11145
+ listTitle,
11146
+ errors
11093
11147
  }) => {
11094
11148
  var _a, _b;
11095
11149
  const isEmptyList = data === 0;
11096
11150
  const rightRef = useRef(null);
11097
11151
  const current = rightRef.current;
11098
- const minHeight = 300;
11152
+ const minHeight = 100;
11099
11153
  const [rightHeight, setRightHeight] = useState(minHeight);
11100
11154
  useEffect(() => {
11101
11155
  const resizeObserver = new ResizeObserver(() => {
@@ -11123,18 +11177,20 @@ const ObjectArrayList = ({
11123
11177
  const selectCurrentTab = index => {
11124
11178
  setCurrentIndex(index);
11125
11179
  };
11126
- const paddedHeight = rightHeight && rightHeight + 48;
11127
- // const detailRef = useRef<HTMLDivElement>(null);
11180
+ (() => {
11181
+ const str = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.itemLabel) ? `${appliedUiSchemaOptions.itemLabel}` : `${path}`;
11182
+ return str.charAt(0).toUpperCase() + str.slice(1);
11183
+ })();
11128
11184
  return jsx(ListContainer, {
11129
11185
  children: jsxs(RowFlex, {
11130
- children: [jsx(FlexTabs, {
11186
+ children: [currentListPage === 0 && jsx(FlexTabs, {
11131
11187
  style: {
11132
- height: paddedHeight
11188
+ height: '100%'
11133
11189
  },
11134
11190
  children: range(data).map(index => {
11135
11191
  const childPath = Paths.compose(path, `${index}`);
11136
- const name = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.itemLabel) ? `${appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.itemLabel} ${index + 1}` : `${path} ${index + 1}`;
11137
- return jsx(LeftTab, {
11192
+ const name = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.itemLabel) ? `${pluralize.singular(appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.itemLabel)} ${index + 1}` : `${pluralize.singular(path)} ${index + 1}`;
11193
+ return jsx(MainTab, {
11138
11194
  childPath: childPath,
11139
11195
  rowIndex: index,
11140
11196
  currentTab: currentIndex,
@@ -11143,24 +11199,35 @@ const ObjectArrayList = ({
11143
11199
  selectCurrentTab: selectCurrentTab,
11144
11200
  enabled: enabled,
11145
11201
  current: current,
11146
- translations: translations
11202
+ setCurrentListPage: index => setCurrentListPage(index)
11147
11203
  }, childPath);
11148
11204
  })
11149
- }), jsx(FlexForm, {
11150
- ref: rightRef,
11151
- tabIndex: -1,
11152
- children: jsx(NonEmptyList, {
11153
- childPath: Paths.compose(path, `${currentIndex}`),
11154
- rowIndex: currentIndex,
11155
- schema: schema,
11156
- openDeleteDialog: openDeleteDialog,
11157
- showSortButtons: appliedUiSchemaOptions.showSortButtons || appliedUiSchemaOptions.showArrayTableSortButtons,
11158
- enabled: enabled,
11159
- cells: cells,
11160
- path: path,
11161
- uischema: uischema,
11162
- translations: translations
11163
- }, Paths.compose(path, `${currentIndex}`))
11205
+ }), currentListPage > 0 && jsxs(UpdateListContainer, {
11206
+ children: [jsxs(FlexForm, {
11207
+ ref: rightRef,
11208
+ tabIndex: -1,
11209
+ children: [jsx(ObjectArrayTitle, {
11210
+ children: pluralize.singular(listTitle || '')
11211
+ }), jsx(NonEmptyList, {
11212
+ childPath: Paths.compose(path, `${currentIndex}`),
11213
+ rowIndex: currentIndex,
11214
+ schema: schema,
11215
+ openDeleteDialog: openDeleteDialog,
11216
+ showSortButtons: appliedUiSchemaOptions.showSortButtons || appliedUiSchemaOptions.showArrayTableSortButtons,
11217
+ enabled: enabled,
11218
+ cells: cells,
11219
+ path: path,
11220
+ uischema: uischema,
11221
+ translations: translations
11222
+ }, Paths.compose(path, `${currentIndex}`))]
11223
+ }), jsx(GoAButton, {
11224
+ type: 'primary',
11225
+ onClick: () => {
11226
+ setCurrentListPage(0);
11227
+ },
11228
+ testId: "next-list-button",
11229
+ children: "Continue"
11230
+ })]
11164
11231
  })]
11165
11232
  })
11166
11233
  });
@@ -11170,7 +11237,8 @@ class ListWithDetailControl extends React.Component {
11170
11237
  constructor() {
11171
11238
  super(...arguments);
11172
11239
  this.state = {
11173
- maxItemsError: ''
11240
+ maxItemsError: '',
11241
+ currentListPage: 0
11174
11242
  };
11175
11243
  // eslint-disable-next-line
11176
11244
  this.addItem = (path, value) => {
@@ -11228,17 +11296,20 @@ class ListWithDetailControl extends React.Component {
11228
11296
  visible: visible,
11229
11297
  "data-testid": "jsonforms-object-list-wrapper",
11230
11298
  children: [jsxs(ToolBarHeader, {
11231
- children: [listTitle && jsxs(ObjectArrayTitle, {
11232
- children: [listTitle, " ", jsx("span", {
11233
- children: additionalProps.required && '(required)'
11234
- }), this.state.maxItemsError && jsx("span", {
11235
- style: {
11236
- color: 'red',
11237
- marginLeft: '1rem'
11238
- },
11239
- children: this.state.maxItemsError
11240
- })]
11241
- }), jsx(ObjectArrayToolBar, {
11299
+ children: [listTitle && this.state.currentListPage === 0 && jsx(MarginTop, {
11300
+ children: jsxs(ObjectArrayTitle, {
11301
+ children: [listTitle, " ", jsx("span", {
11302
+ children: additionalProps.required && '(required)'
11303
+ }), this.state.maxItemsError && jsx("span", {
11304
+ style: {
11305
+ color: 'red',
11306
+ marginLeft: '1rem'
11307
+ },
11308
+ children: this.state.maxItemsError
11309
+ })]
11310
+ })
11311
+ }), this.state.currentListPage === 0 && data === 0 && jsx(ObjectArrayToolBar, {
11312
+ data: data,
11242
11313
  errors: errors,
11243
11314
  label: label,
11244
11315
  addItem: (path, value) => () => {
@@ -11249,7 +11320,14 @@ class ListWithDetailControl extends React.Component {
11249
11320
  uischema: controlElement,
11250
11321
  schema: schema,
11251
11322
  rootSchema: rootSchema,
11252
- enabled: enabled
11323
+ enabled: enabled,
11324
+ setCurrentListPage: listPage => {
11325
+ this.setState({
11326
+ currentListPage: listPage
11327
+ });
11328
+ },
11329
+ currentListPage: this.state.currentListPage,
11330
+ buttonType: "secondary"
11253
11331
  })]
11254
11332
  }), jsx("div", {
11255
11333
  children: jsx(ObjectArrayList, Object.assign({
@@ -11263,8 +11341,36 @@ class ListWithDetailControl extends React.Component {
11263
11341
  cells: cells,
11264
11342
  config: config,
11265
11343
  currentIndex: this.props.currentTab,
11266
- setCurrentIndex: this.props.setCurrentTab
11344
+ setCurrentIndex: this.props.setCurrentTab,
11345
+ setCurrentListPage: listPage => {
11346
+ this.setState({
11347
+ currentListPage: listPage
11348
+ });
11349
+ },
11350
+ errors: errors,
11351
+ currentListPage: this.state.currentListPage,
11352
+ listTitle: listTitle
11267
11353
  }, additionalProps))
11354
+ }), this.state.currentListPage === 0 && data > 0 && jsx(ObjectArrayToolBar, {
11355
+ data: data,
11356
+ errors: errors,
11357
+ label: label,
11358
+ addItem: (path, value) => () => {
11359
+ this.addItem(path, value);
11360
+ },
11361
+ numColumns: 0,
11362
+ path: path,
11363
+ uischema: controlElement,
11364
+ schema: schema,
11365
+ rootSchema: rootSchema,
11366
+ enabled: enabled,
11367
+ setCurrentListPage: listPage => {
11368
+ this.setState({
11369
+ currentListPage: listPage
11370
+ });
11371
+ },
11372
+ currentListPage: this.state.currentListPage,
11373
+ buttonType: "tertiary"
11268
11374
  })]
11269
11375
  });
11270
11376
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.37.0",
3
+ "version": "2.38.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",
@@ -13,7 +13,8 @@
13
13
  "ajv-errors": "^3.0.0",
14
14
  "ajv-formats": "^3.0.1",
15
15
  "@mdx-js/mdx": "^3.1.0",
16
- "expr-eval": "^2.0.2"
16
+ "expr-eval": "^2.0.2",
17
+ "pluralize": "^8.0.0"
17
18
  },
18
19
  "dependencies": {
19
20
  "axios": "^1.6.7",
@@ -31,6 +31,7 @@ interface NonEmptyRowProps {
31
31
  path: string;
32
32
  translations: ArrayTranslations;
33
33
  uischema: ControlElement;
34
+ listTitle?: string;
34
35
  }
35
36
  export declare const NonEmptyList: React.MemoExoticComponent<({ childPath, schema, enabled, cells, uischema, }: NonEmptyRowProps & WithDeleteDialogSupport) => import("react/jsx-runtime").JSX.Element>;
36
37
  interface ListWithDetailControlProps extends ObjectArrayControlProps {
@@ -40,6 +41,7 @@ interface ListWithDetailControlProps extends ObjectArrayControlProps {
40
41
  export declare class ListWithDetailControl extends React.Component<ListWithDetailControlProps, any> {
41
42
  state: {
42
43
  maxItemsError: string;
44
+ currentListPage: number;
43
45
  };
44
46
  addItem: (path: string, value: any) => void;
45
47
  render(): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { ControlElement, JsonSchema } from '@jsonforms/core';
3
3
  export interface ObjectArrayToolbarProps {
4
+ data?: any;
4
5
  numColumns: number;
5
6
  errors: string;
6
7
  label: string;
@@ -10,6 +11,9 @@ export interface ObjectArrayToolbarProps {
10
11
  rootSchema: JsonSchema;
11
12
  enabled: boolean;
12
13
  addItem(path: string, value: any): () => void;
14
+ setCurrentListPage?: (page: number) => void;
15
+ currentListPage?: number;
16
+ buttonType?: string;
13
17
  }
14
18
  declare const ObjectArrayToolBar: React.NamedExoticComponent<ObjectArrayToolbarProps>;
15
19
  export default ObjectArrayToolBar;
@@ -1,4 +1,5 @@
1
1
  export declare const DeleteDialogContent: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
+ export declare const MarginTop: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
2
3
  export declare const NonEmptyCellStyle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
3
4
  export declare const ToolBarHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
4
5
  export declare const ObjectArrayTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
@@ -9,9 +10,12 @@ export declare const RowFlex: import("styled-components/dist/types").IStyledComp
9
10
  export declare const RowFlexMenu: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
10
11
  export declare const FlexTabs: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
11
12
  export declare const FlexForm: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
12
- export declare const TabName: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
13
+ export declare const TabData: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
13
14
  export declare const Trash: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
14
15
  export declare const ListContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
16
+ export declare const IconPadding: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
17
+ export declare const UpdateListContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
18
+ export declare const CompleteContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
15
19
  export declare const TableTHHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>, never>> & string;
16
20
  export declare const ObjectArrayWarningIconDiv: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
17
21
  export declare const ListWithDetailWarningIconDiv: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;