@abgov/jsonforms-components 2.25.0 → 2.27.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.
Files changed (2) hide show
  1. package/index.esm.js +33 -9
  2. package/package.json +1 -1
package/index.esm.js CHANGED
@@ -7990,7 +7990,10 @@ const JsonFormsStepperContextProvider = ({
7990
7990
  return category === undefined ? false : !(category === null || category === void 0 ? void 0 : category.isEnabled);
7991
7991
  },
7992
7992
  selectNumberOfCompletedCategories: () => {
7993
- return stepperState === null || stepperState === void 0 ? void 0 : stepperState.categories.reduce((acc, cat) => acc + (cat.isValid && cat.isCompleted && cat.isVisited && (cat === null || cat === void 0 ? void 0 : cat.uischema) && (cat === null || cat === void 0 ? void 0 : cat.uischema) && isVisible(cat.uischema, data, '', ajv) ? 1 : 0), 0);
7993
+ return stepperState === null || stepperState === void 0 ? void 0 : stepperState.categories.reduce((acc, cat) => {
7994
+ var _a, _b, _c, _d;
7995
+ return acc + (cat.isValid && cat.isCompleted && cat.isVisited && (cat === null || cat === void 0 ? void 0 : cat.uischema) && (((_b = (_a = cat === null || cat === void 0 ? void 0 : cat.uischema) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.showInTaskList) || ((_d = (_c = cat === null || cat === void 0 ? void 0 : cat.uischema) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.showInTaskList) === undefined) && (cat === null || cat === void 0 ? void 0 : cat.uischema) && isVisible(cat.uischema, data, '', ajv) ? 1 : 0);
7996
+ }, 0);
7994
7997
  },
7995
7998
  selectIsActive: id => {
7996
7999
  return id === stepperState.activeId;
@@ -8289,7 +8292,10 @@ const ApplicationStatus = () => {
8289
8292
  const {
8290
8293
  categories: allCategories
8291
8294
  } = formStepperCtx.selectStepperState();
8292
- const categories = allCategories.filter(c => (c === null || c === void 0 ? void 0 : c.visible) === true);
8295
+ const categories = allCategories.filter(c => {
8296
+ var _a, _b, _c, _d;
8297
+ return (c === null || c === void 0 ? void 0 : c.visible) === true && (((_b = (_a = c.uischema) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.showInTaskList) || ((_d = (_c = c === null || c === void 0 ? void 0 : c.uischema) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.showInTaskList) === undefined);
8298
+ });
8293
8299
  const total = categories.length;
8294
8300
  const completed = selectNumberOfCompletedCategories();
8295
8301
  const type = total === completed ? 'success' : 'important';
@@ -8422,6 +8428,10 @@ const TaskList = ({
8422
8428
  }) => {
8423
8429
  const testid = 'table-of-contents';
8424
8430
  const sectioned = getCategorySections(categories);
8431
+ const showInTaskListList = categories.map(cat => {
8432
+ var _a, _b, _c, _d;
8433
+ return ((_b = (_a = cat === null || cat === void 0 ? void 0 : cat.uischema) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.showInTaskList) || ((_d = (_c = cat === null || cat === void 0 ? void 0 : cat.uischema) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.showInTaskList) === undefined;
8434
+ });
8425
8435
  let globalIndex = 0;
8426
8436
  let sectionIndex = 1;
8427
8437
  return jsx(PageBorder, {
@@ -8445,16 +8455,29 @@ const TaskList = ({
8445
8455
  sectionTitle,
8446
8456
  categories: group
8447
8457
  }) => jsxs(Fragment, {
8448
- children: [sectionTitle && jsx(SectionHeaderRow, {
8458
+ children: [sectionTitle && showInTaskListList[globalIndex] && jsx(SectionHeaderRow, {
8449
8459
  title: sectionTitle,
8450
8460
  index: sectionIndex++
8451
8461
  }, `section-${sectionTitle}`), group.map(category => {
8462
+ const showGroupTaskListList = categories.map(cat => {
8463
+ var _a, _b, _c, _d;
8464
+ return ((_b = (_a = cat === null || cat === void 0 ? void 0 : cat.uischema) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.showInTaskList) || ((_d = (_c = cat === null || cat === void 0 ? void 0 : cat.uischema) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.showInTaskList) === undefined;
8465
+ });
8466
+ const showCurrent = showInTaskListList[globalIndex];
8452
8467
  const index = globalIndex++;
8453
- return jsx(CategoryRow, {
8454
- category: category,
8455
- index: index,
8456
- onClick: onClick
8457
- }, `cat-${category.label}`);
8468
+ const modifyCategory = JSON.parse(JSON.stringify(category));
8469
+ modifyCategory.isCompleted = group.length === group.filter(category => category.isCompleted).length;
8470
+ let currentCategory = category;
8471
+ if (showGroupTaskListList.length > showGroupTaskListList.filter(item => item === true).length) {
8472
+ currentCategory = modifyCategory;
8473
+ }
8474
+ if (showCurrent) {
8475
+ return jsx(CategoryRow, {
8476
+ category: currentCategory,
8477
+ index: index,
8478
+ onClick: onClick
8479
+ }, `cat-${category.label}`);
8480
+ }
8458
8481
  })]
8459
8482
  })), jsx(SummaryRow, {
8460
8483
  index: globalIndex,
@@ -9490,9 +9513,10 @@ const ObjectArrayToolBar = /*#__PURE__*/React.memo(function TableToolbar({
9490
9513
  children: jsx(GoAButton, Object.assign({
9491
9514
  disabled: !enabled,
9492
9515
  testId: `object-array-toolbar-${label}`,
9516
+ leadingIcon: "add",
9493
9517
  "aria-label": `Add to button to ${(label === null || label === void 0 ? void 0 : label.toLowerCase()) || ''}`,
9494
9518
  onClick: addItem(path, createDefaultValue(schema, rootSchema)),
9495
- type: (_d = (_c = uischema.options) === null || _c === void 0 ? void 0 : _c.addButtonType) !== null && _d !== void 0 ? _d : 'primary'
9519
+ type: (_d = (_c = uischema.options) === null || _c === void 0 ? void 0 : _c.addButtonType) !== null && _d !== void 0 ? _d : 'secondary'
9496
9520
  }, buttonUIProps, {
9497
9521
  children: ((_e = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _e === void 0 ? void 0 : _e.addButtonText) || capitalizeFirstLetter(`Add ${arrayLabel}`)
9498
9522
  }))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.25.0",
3
+ "version": "2.27.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",