@abgov/jsonforms-components 2.32.7 → 2.34.0

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
@@ -8959,7 +8959,8 @@ const TaskList = ({
8959
8959
  onClick,
8960
8960
  title,
8961
8961
  subtitle,
8962
- isValid
8962
+ isValid,
8963
+ hideSummary
8963
8964
  }) => {
8964
8965
  const testid = 'table-of-contents';
8965
8966
  const sectioned = getCategorySections(categories);
@@ -9057,11 +9058,11 @@ const TaskList = ({
9057
9058
  }
9058
9059
  return null;
9059
9060
  })]
9060
- }, index)), jsx(SummaryRow, {
9061
+ }, index)), !hideSummary ? jsx(SummaryRow, {
9061
9062
  index: globalIndex,
9062
9063
  isValid: isValid,
9063
9064
  onClick: onClick
9064
- }, "task-list-table-summary")]
9065
+ }, "task-list-table-summary") : null]
9065
9066
  })
9066
9067
  })]
9067
9068
  })
@@ -9214,7 +9215,7 @@ const BackButton = ({
9214
9215
  };
9215
9216
 
9216
9217
  const RenderPages = props => {
9217
- var _a, _b, _c, _d;
9218
+ var _a, _b, _c, _d, _e, _f, _g;
9218
9219
  const {
9219
9220
  data,
9220
9221
  schema,
@@ -9240,6 +9241,8 @@ const RenderPages = props => {
9240
9241
  } = formStepperCtx.selectStepperState();
9241
9242
  const hideSubmit = (_b = (_a = props.categoryProps.uischema.options) === null || _a === void 0 ? void 0 : _a.hideSubmit) !== null && _b !== void 0 ? _b : false;
9242
9243
  const toAppOverviewLabel = (_d = (_c = props.categoryProps.uischema.options) === null || _c === void 0 ? void 0 : _c.toAppOverviewLabel) !== null && _d !== void 0 ? _d : 'Back to application overview';
9244
+ const submissionLabel = (_f = (_e = props.categoryProps.uischema.options) === null || _e === void 0 ? void 0 : _e.submissionLabel) !== null && _f !== void 0 ? _f : 'Next';
9245
+ const hideSummary = (_g = props.categoryProps.uischema.options) === null || _g === void 0 ? void 0 : _g.hideSummary;
9243
9246
  const submitFormFunction = enumerators === null || enumerators === void 0 ? void 0 : enumerators.submitFunction.get('submit-form');
9244
9247
  const submitForm = submitFormFunction && submitFormFunction();
9245
9248
  const saveFormFunction = enumerators === null || enumerators === void 0 ? void 0 : enumerators.saveFunction.get('save-form');
@@ -9287,6 +9290,8 @@ const RenderPages = props => {
9287
9290
  data
9288
9291
  };
9289
9292
  if (index === activeId && !isOnReview) {
9293
+ const currentStep = index + 1 - categories.filter(c => !c.visible && c.id < index).length;
9294
+ const totalSteps = categories.filter(c => c.visible).length;
9290
9295
  return jsxs("div", {
9291
9296
  "data-testid": `step_${index}-content-pages`,
9292
9297
  style: {
@@ -9294,7 +9299,7 @@ const RenderPages = props => {
9294
9299
  },
9295
9300
  children: [jsxs(PageRenderPadding, {
9296
9301
  children: [jsxs("h3", {
9297
- children: ["Step ", index + 1 - categories.filter(c => !c.visible && c.id < index).length, " of", ' ', categories.filter(c => c.visible).length]
9302
+ children: ["Step ", currentStep, " of ", totalSteps]
9298
9303
  }), jsx(RenderStepElements, Object.assign({}, categoryProps))]
9299
9304
  }), jsx(PageRenderPadding, {
9300
9305
  children: jsxs(GoAGrid, {
@@ -9327,11 +9332,13 @@ const RenderPages = props => {
9327
9332
  while (nextId < categories.length && categories[nextId].visible === false) {
9328
9333
  nextId = nextId + 1;
9329
9334
  }
9330
- goToPage(nextId);
9335
+ if (!(currentStep === totalSteps && hideSummary)) {
9336
+ goToPage(nextId);
9337
+ }
9331
9338
  },
9332
9339
  disabled: !enabled,
9333
9340
  testId: "pages-save-continue-btn",
9334
- children: "Next"
9341
+ children: currentStep === totalSteps ? submissionLabel : "Next"
9335
9342
  })
9336
9343
  })]
9337
9344
  })
@@ -9438,7 +9445,7 @@ const FormPageStepper = props => {
9438
9445
  });
9439
9446
  };
9440
9447
  const FormPagesView = props => {
9441
- var _a, _b, _c, _d;
9448
+ var _a, _b, _c, _d, _e, _f;
9442
9449
  const data = props.data;
9443
9450
  const formStepperCtx = useContext(JsonFormsStepperContext);
9444
9451
  const {
@@ -9472,7 +9479,8 @@ const FormPagesView = props => {
9472
9479
  onClick: handleGoToPage,
9473
9480
  title: (_b = (_a = props.uischema) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.title,
9474
9481
  subtitle: (_d = (_c = props.uischema) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.subtitle,
9475
- isValid: completedCount === visibleCats.length
9482
+ isValid: completedCount === visibleCats.length,
9483
+ hideSummary: (_f = (_e = props.uischema) === null || _e === void 0 ? void 0 : _e.options) === null || _f === void 0 ? void 0 : _f.hideSummary
9476
9484
  };
9477
9485
  return jsx(TaskList, Object.assign({}, tocProps));
9478
9486
  }
@@ -10401,10 +10409,11 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
10401
10409
  children: [jsx("thead", {
10402
10410
  children: jsxs("tr", {
10403
10411
  children: [Object.entries(tableKeys).map(([value, index]) => {
10412
+ const currentProperty = properties[value];
10404
10413
  if (!isInReview) {
10405
10414
  return jsx("th", {
10406
10415
  children: jsxs("p", {
10407
- children: [convertToSentenceCase(index), (required === null || required === void 0 ? void 0 : required.includes(value)) && jsx(RequiredSpan, {
10416
+ children: [(currentProperty === null || currentProperty === void 0 ? void 0 : currentProperty.title) || convertToSentenceCase(index), (required === null || required === void 0 ? void 0 : required.includes(value)) && jsx(RequiredSpan, {
10408
10417
  children: "(required)"
10409
10418
  })]
10410
10419
  })
@@ -10412,7 +10421,7 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
10412
10421
  }
10413
10422
  return jsx(TableTHHeader, {
10414
10423
  children: jsxs("p", {
10415
- children: [`${convertToSentenceCase(index)}`, (required === null || required === void 0 ? void 0 : required.includes(value)) && jsxs(RequiredSpan, {
10424
+ children: [`${(currentProperty === null || currentProperty === void 0 ? void 0 : currentProperty.title) || convertToSentenceCase(index)}`, (required === null || required === void 0 ? void 0 : required.includes(value)) && jsxs(RequiredSpan, {
10416
10425
  children: [jsx("br", {}), " (required)"]
10417
10426
  })]
10418
10427
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.32.7",
3
+ "version": "2.34.0",
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",
@@ -6,6 +6,7 @@ export interface TocProps {
6
6
  title?: string;
7
7
  subtitle?: string;
8
8
  isValid: boolean;
9
+ hideSummary: boolean;
9
10
  }
10
- export declare const TaskList: ({ categories, onClick, title, subtitle, isValid }: TocProps) => JSX.Element;
11
+ export declare const TaskList: ({ categories, onClick, title, subtitle, isValid, hideSummary, }: TocProps) => JSX.Element;
11
12
  export declare const TableOfContentsTester: RankedTester;
@@ -12,6 +12,7 @@ export interface DataProperty {
12
12
  required?: string[];
13
13
  enum: string[];
14
14
  items?: Record<string, unknown>;
15
+ title?: string;
15
16
  }
16
17
  export interface DataObject {
17
18
  [key: string]: DataProperty;