@abgov/jsonforms-components 2.32.6 → 2.33.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 +222 -81
- package/package.json +1 -1
- package/src/lib/Controls/FormStepper/ApplicationStatus.d.ts +4 -1
- package/src/lib/Controls/FormStepper/TaskList/categorySections.d.ts +1 -2
- package/src/lib/Controls/FormStepper/styled-components.d.ts +7 -1
- package/src/lib/Controls/ObjectArray/ObjectListControlTypes.d.ts +1 -0
package/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as runtime from 'react/jsx-runtime';
|
|
2
2
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import React, { createContext, useContext, useReducer, useMemo, useEffect, useState, useRef, useCallback } from 'react';
|
|
4
|
-
import { GoAFormItem, GoAInput, GoATextArea, GoACallout, GoAInputDate, GoAInputDateTime, GoAInputTime, GoARadioGroup, GoARadioItem, GoACheckbox, GoAIcon, GoAGrid, GoAFormStepper, GoAFormStep, GoAPages, GoAButton, GoAModal, GoAButtonGroup,
|
|
4
|
+
import { GoAFormItem, GoAInput, GoATextArea, GoACallout, GoAInputDate, GoAInputDateTime, GoAInputTime, GoARadioGroup, GoARadioItem, GoACheckbox, GoAIcon, GoAGrid, GoAFormStepper, GoAFormStep, GoAPages, GoAButton, GoAModal, GoAButtonGroup, GoABadge, GoAText, GoATable, GoAIconButton, GoAFileUploadInput, GoACircularProgress, GoAContainer, GoADropdown, GoADropdownItem, GoADetails, GoASpinner } from '@abgov/react-components';
|
|
5
5
|
import styled from 'styled-components';
|
|
6
6
|
import axios from 'axios';
|
|
7
7
|
import get$1 from 'lodash/get';
|
|
@@ -7116,7 +7116,13 @@ let _$6 = t => t,
|
|
|
7116
7116
|
_t19,
|
|
7117
7117
|
_t20,
|
|
7118
7118
|
_t21,
|
|
7119
|
-
_t22
|
|
7119
|
+
_t22,
|
|
7120
|
+
_t23,
|
|
7121
|
+
_t24,
|
|
7122
|
+
_t25,
|
|
7123
|
+
_t26,
|
|
7124
|
+
_t27,
|
|
7125
|
+
_t28;
|
|
7120
7126
|
const ReviewItem = styled.div(_t$6 || (_t$6 = _$6`
|
|
7121
7127
|
display: flex;
|
|
7122
7128
|
flex-direction: column;
|
|
@@ -7124,7 +7130,63 @@ const ReviewItem = styled.div(_t$6 || (_t$6 = _$6`
|
|
|
7124
7130
|
display: none;
|
|
7125
7131
|
}
|
|
7126
7132
|
`));
|
|
7127
|
-
const
|
|
7133
|
+
const CompletionStatus = styled.div(_t2$4 || (_t2$4 = _$6`
|
|
7134
|
+
padding: 0;
|
|
7135
|
+
margin: 0;
|
|
7136
|
+
padding-top: var(--goa-space-xl);
|
|
7137
|
+
|
|
7138
|
+
display: flex;
|
|
7139
|
+
flex-direction: column;
|
|
7140
|
+
`));
|
|
7141
|
+
const BarTop = styled.div(_t3$3 || (_t3$3 = _$6`
|
|
7142
|
+
display: flex;
|
|
7143
|
+
|
|
7144
|
+
|
|
7145
|
+
.progress-text {
|
|
7146
|
+
margin-left: auto;
|
|
7147
|
+
}
|
|
7148
|
+
`));
|
|
7149
|
+
const Bar = styled.div(_t4$3 || (_t4$3 = _$6`
|
|
7150
|
+
display: flex;
|
|
7151
|
+
flex-direction: row;
|
|
7152
|
+
|
|
7153
|
+
.progress-container {
|
|
7154
|
+
align-items: flex-start;
|
|
7155
|
+
width: 100%;
|
|
7156
|
+
|
|
7157
|
+
height: 4px;
|
|
7158
|
+
background-color: #e0e0e0;
|
|
7159
|
+
border-radius: 4;
|
|
7160
|
+
overflow: hidden;
|
|
7161
|
+
position: relative;
|
|
7162
|
+
border: 1px solid #ccc;
|
|
7163
|
+
margin-bottom: 20px;
|
|
7164
|
+
}
|
|
7165
|
+
|
|
7166
|
+
.progress-bar {
|
|
7167
|
+
width: 60%;
|
|
7168
|
+
height: 100%;
|
|
7169
|
+
background-color: #004abf;
|
|
7170
|
+
border-radius: 4;
|
|
7171
|
+
position: relative;
|
|
7172
|
+
display: flex;
|
|
7173
|
+
align-items: center;
|
|
7174
|
+
justify-content: flex-end;
|
|
7175
|
+
|
|
7176
|
+
box-sizing: border-box;
|
|
7177
|
+
}
|
|
7178
|
+
|
|
7179
|
+
|
|
7180
|
+
`));
|
|
7181
|
+
styled.div(_t5$3 || (_t5$3 = _$6``));
|
|
7182
|
+
const BadgeWrapper = styled.div(_t6$2 || (_t6$2 = _$6`
|
|
7183
|
+
margin-left: 10px;
|
|
7184
|
+
margin-top: 7px;
|
|
7185
|
+
`));
|
|
7186
|
+
const CompletionTextHeader = styled.h3(_t7$1 || (_t7$1 = _$6`
|
|
7187
|
+
display: flex;
|
|
7188
|
+
`));
|
|
7189
|
+
const ReviewItemSection = styled.div(_t8$1 || (_t8$1 = _$6`
|
|
7128
7190
|
margin-bottom: var(--goa-space-m);
|
|
7129
7191
|
padding: var(--goa-space-xl) var(--goa-space-2xl);
|
|
7130
7192
|
border: 1px solid var(--goa-color-greyscale-300);
|
|
@@ -7134,18 +7196,18 @@ const ReviewItemSection = styled.div(_t2$4 || (_t2$4 = _$6`
|
|
|
7134
7196
|
max-width: 1600px;
|
|
7135
7197
|
}
|
|
7136
7198
|
`));
|
|
7137
|
-
const ReviewItemHeader = styled.div(
|
|
7199
|
+
const ReviewItemHeader = styled.div(_t9$1 || (_t9$1 = _$6`
|
|
7138
7200
|
display: flex;
|
|
7139
7201
|
align-items: center;
|
|
7140
7202
|
justify-content: space-between;
|
|
7141
7203
|
margin-bottom: var(--goa-space-xl);
|
|
7142
7204
|
`));
|
|
7143
|
-
const ReviewItemTitle = styled.div(
|
|
7205
|
+
const ReviewItemTitle = styled.div(_t0$1 || (_t0$1 = _$6`
|
|
7144
7206
|
font-size: var(--goa-space-l);
|
|
7145
7207
|
line-height: var(--goa-space-xl);
|
|
7146
7208
|
font-weight: 300;
|
|
7147
7209
|
`));
|
|
7148
|
-
const Anchor = styled.div(
|
|
7210
|
+
const Anchor = styled.div(_t1$1 || (_t1$1 = _$6`
|
|
7149
7211
|
color: #0070c4;
|
|
7150
7212
|
text-decoration: underline;
|
|
7151
7213
|
outline: none;
|
|
@@ -7156,20 +7218,20 @@ const Anchor = styled.div(_t5$3 || (_t5$3 = _$6`
|
|
|
7156
7218
|
background-color: #e6f7ff;
|
|
7157
7219
|
}
|
|
7158
7220
|
`));
|
|
7159
|
-
styled.div(
|
|
7221
|
+
styled.div(_t10$1 || (_t10$1 = _$6`
|
|
7160
7222
|
margin-left: var(--goa-space-m);
|
|
7161
7223
|
`));
|
|
7162
|
-
styled.div(
|
|
7224
|
+
styled.div(_t11$1 || (_t11$1 = _$6`
|
|
7163
7225
|
margin-bottom: var(--goa-space-m);
|
|
7164
7226
|
`));
|
|
7165
|
-
styled.div(
|
|
7227
|
+
styled.div(_t12$1 || (_t12$1 = _$6`
|
|
7166
7228
|
margin: var(--goa-space-s);
|
|
7167
7229
|
width: 100%;
|
|
7168
7230
|
`));
|
|
7169
|
-
styled.h3(
|
|
7231
|
+
styled.h3(_t13$1 || (_t13$1 = _$6`
|
|
7170
7232
|
text-transform: capitalize;
|
|
7171
7233
|
`));
|
|
7172
|
-
const RightAlignmentDiv = styled.div(
|
|
7234
|
+
const RightAlignmentDiv = styled.div(_t14$1 || (_t14$1 = _$6`
|
|
7173
7235
|
@media screen and (max-width: 767px) {
|
|
7174
7236
|
margin-bottom: var(--goa-space-l);
|
|
7175
7237
|
}
|
|
@@ -7179,52 +7241,50 @@ const RightAlignmentDiv = styled.div(_t0$1 || (_t0$1 = _$6`
|
|
|
7179
7241
|
margin-bottom: var(--goa-space-l);
|
|
7180
7242
|
}
|
|
7181
7243
|
`));
|
|
7182
|
-
const FormStepperSummaryH3 = styled.h3(
|
|
7244
|
+
const FormStepperSummaryH3 = styled.h3(_t15$1 || (_t15$1 = _$6`
|
|
7183
7245
|
flex: 1;
|
|
7184
7246
|
margin-bottom: var(--goa-space-m);
|
|
7185
7247
|
font-size: var(--goa-font-size-7);
|
|
7186
7248
|
line-height: var(--goa-line-height-4);
|
|
7187
7249
|
font-weight: var(--goa-font-weight-regular);
|
|
7188
7250
|
`));
|
|
7189
|
-
const PageRenderPadding = styled.div(
|
|
7251
|
+
const PageRenderPadding = styled.div(_t16$1 || (_t16$1 = _$6`
|
|
7190
7252
|
margin-top: var(--goa-space-2xl);
|
|
7191
7253
|
`));
|
|
7192
|
-
styled.div(
|
|
7254
|
+
styled.div(_t17$1 || (_t17$1 = _$6`
|
|
7193
7255
|
margin-bottom: var(--goa-space-2xl);
|
|
7194
7256
|
`));
|
|
7195
|
-
const PageBorder = styled.div(
|
|
7257
|
+
const PageBorder = styled.div(_t18$1 || (_t18$1 = _$6`
|
|
7196
7258
|
padding: var(--goa-space-m) var(--goa-space-3xl);
|
|
7197
7259
|
`));
|
|
7198
|
-
const TableReviewItemSection = styled.div(
|
|
7260
|
+
const TableReviewItemSection = styled.div(_t19 || (_t19 = _$6`
|
|
7199
7261
|
.element-style {
|
|
7200
7262
|
max-width: 1600px;
|
|
7201
7263
|
}
|
|
7202
7264
|
`));
|
|
7203
|
-
const TableReviewItem = styled.div(
|
|
7265
|
+
const TableReviewItem = styled.div(_t20 || (_t20 = _$6`
|
|
7204
7266
|
padding: var(--goa-space-xl) var(--goa-space-2xl);
|
|
7205
7267
|
border: 1px solid var(--goa-color-greyscale-300);
|
|
7206
7268
|
border-radius: var(--goa-border-radius-xl);
|
|
7207
7269
|
`));
|
|
7208
|
-
const TableReviewPageTitleRow = styled.div(
|
|
7270
|
+
const TableReviewPageTitleRow = styled.div(_t21 || (_t21 = _$6`
|
|
7209
7271
|
margin-top: var(--goa-space-xl);
|
|
7210
7272
|
display: flex;
|
|
7211
7273
|
justify-content: space-between;
|
|
7212
7274
|
`));
|
|
7213
|
-
const TableReviewCategoryLabel = styled.h3(
|
|
7275
|
+
const TableReviewCategoryLabel = styled.h3(_t22 || (_t22 = _$6`
|
|
7214
7276
|
color: var(--goa-color-text-secondary) !important;
|
|
7215
7277
|
margin-bottom: var(--goa-space-l);
|
|
7216
7278
|
`));
|
|
7217
|
-
const CategoryStatus = styled.td(
|
|
7279
|
+
const CategoryStatus = styled.td(_t23 || (_t23 = _$6`
|
|
7218
7280
|
width: var(--goa-space-xl);
|
|
7219
7281
|
padding-right: var(--goa-space-xl);
|
|
7220
7282
|
align-content: center;
|
|
7221
7283
|
`));
|
|
7222
|
-
const
|
|
7223
|
-
padding:
|
|
7224
|
-
margin: 0;
|
|
7225
|
-
margin-bottom: 0 !important;
|
|
7284
|
+
const Center = styled.div(_t24 || (_t24 = _$6`
|
|
7285
|
+
padding-top: 5px;
|
|
7226
7286
|
`));
|
|
7227
|
-
const PageStepperRow = styled.tr(
|
|
7287
|
+
const PageStepperRow = styled.tr(_t25 || (_t25 = _$6`
|
|
7228
7288
|
${0}
|
|
7229
7289
|
`), ({
|
|
7230
7290
|
disabled
|
|
@@ -7243,7 +7303,7 @@ const PageStepperRow = styled.tr(_t19 || (_t19 = _$6`
|
|
|
7243
7303
|
transition: background-color 0.2s ease-in-out;
|
|
7244
7304
|
}
|
|
7245
7305
|
`);
|
|
7246
|
-
const SectionHeaderRowTr = styled.tr(
|
|
7306
|
+
const SectionHeaderRowTr = styled.tr(_t26 || (_t26 = _$6`
|
|
7247
7307
|
& > td {
|
|
7248
7308
|
border: 0 !important;
|
|
7249
7309
|
padding-top: var(--goa-space-l);
|
|
@@ -7255,11 +7315,11 @@ const SectionHeaderRowTr = styled.tr(_t20 || (_t20 = _$6`
|
|
|
7255
7315
|
border-top: none !important;
|
|
7256
7316
|
}
|
|
7257
7317
|
`));
|
|
7258
|
-
const SummaryRowLink = styled.a(
|
|
7318
|
+
const SummaryRowLink = styled.a(_t27 || (_t27 = _$6`
|
|
7259
7319
|
position: relative;
|
|
7260
7320
|
top: var(--goa-space-xs);
|
|
7261
7321
|
`));
|
|
7262
|
-
const SummaryTd = styled.td(
|
|
7322
|
+
const SummaryTd = styled.td(_t28 || (_t28 = _$6`
|
|
7263
7323
|
border: 0 !important;
|
|
7264
7324
|
padding: 0 !important;
|
|
7265
7325
|
`));
|
|
@@ -8714,31 +8774,43 @@ $$3({ target: 'Set', proto: true, real: true, forced: !setMethodAcceptSetLike('u
|
|
|
8714
8774
|
union: union
|
|
8715
8775
|
});
|
|
8716
8776
|
|
|
8717
|
-
const ApplicationStatus = (
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
const {
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8777
|
+
const ApplicationStatus = ({
|
|
8778
|
+
completedGroups,
|
|
8779
|
+
totalGroups
|
|
8780
|
+
}) => {
|
|
8781
|
+
const completed = completedGroups;
|
|
8782
|
+
const badge = totalGroups === completed ? jsx(GoABadge, {
|
|
8783
|
+
type: "success",
|
|
8784
|
+
content: "Complete"
|
|
8785
|
+
}) : jsx(GoABadge, {
|
|
8786
|
+
type: "information",
|
|
8787
|
+
content: "Incomplete"
|
|
8728
8788
|
});
|
|
8729
|
-
const
|
|
8730
|
-
const
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8789
|
+
const mainHeading = 'Application Progress';
|
|
8790
|
+
const progressPercentageAccurate = 100 * completed / totalGroups;
|
|
8791
|
+
return jsxs(CompletionStatus, {
|
|
8792
|
+
children: [jsxs(CompletionTextHeader, {
|
|
8793
|
+
children: [mainHeading, jsx(BadgeWrapper, {
|
|
8794
|
+
children: badge
|
|
8795
|
+
})]
|
|
8796
|
+
}), jsxs(BarTop, {
|
|
8797
|
+
children: [jsxs("div", {
|
|
8798
|
+
children: [completed, " out of ", totalGroups, " items completed"]
|
|
8799
|
+
}), jsxs("div", {
|
|
8800
|
+
className: "progress-text",
|
|
8801
|
+
children: [Math.round(progressPercentageAccurate), "%"]
|
|
8802
|
+
})]
|
|
8803
|
+
}), jsx(Bar, {
|
|
8804
|
+
children: jsx("div", {
|
|
8805
|
+
className: "progress-container",
|
|
8806
|
+
children: jsx("div", {
|
|
8807
|
+
className: "progress-bar",
|
|
8808
|
+
style: {
|
|
8809
|
+
width: `${progressPercentageAccurate}%`
|
|
8810
|
+
}
|
|
8811
|
+
})
|
|
8812
|
+
})
|
|
8813
|
+
})]
|
|
8742
8814
|
});
|
|
8743
8815
|
};
|
|
8744
8816
|
|
|
@@ -8788,11 +8860,15 @@ const getCategoryStatus = category => {
|
|
|
8788
8860
|
const getCategoryStatusBadge = category => {
|
|
8789
8861
|
const status = getCategoryStatus(category);
|
|
8790
8862
|
const badgeType = status === PageStatus.Complete ? 'success' : 'information';
|
|
8791
|
-
return
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
|
|
8863
|
+
return (
|
|
8864
|
+
// <div style={{ paddingTop: '5px' }}>
|
|
8865
|
+
jsx(GoABadge, {
|
|
8866
|
+
type: badgeType,
|
|
8867
|
+
content: status,
|
|
8868
|
+
ariaLabel: status
|
|
8869
|
+
})
|
|
8870
|
+
// </div>
|
|
8871
|
+
);
|
|
8796
8872
|
};
|
|
8797
8873
|
|
|
8798
8874
|
/* eslint-disable jsx-a11y/anchor-is-valid */
|
|
@@ -8814,7 +8890,9 @@ const CategoryRow = ({
|
|
|
8814
8890
|
children: [jsx("td", {
|
|
8815
8891
|
children: category.label
|
|
8816
8892
|
}, `task-list-${index}-stepper-row-label`), jsx(CategoryStatus, {
|
|
8817
|
-
children:
|
|
8893
|
+
children: jsx(Center, {
|
|
8894
|
+
children: getCategoryStatusBadge(category)
|
|
8895
|
+
})
|
|
8818
8896
|
})]
|
|
8819
8897
|
}, `task-list-${index}-stepper-row`) : null;
|
|
8820
8898
|
};
|
|
@@ -8845,6 +8923,36 @@ const SummaryRow = ({
|
|
|
8845
8923
|
});
|
|
8846
8924
|
};
|
|
8847
8925
|
|
|
8926
|
+
function mergeOrphanSections(sections) {
|
|
8927
|
+
const result = [];
|
|
8928
|
+
for (const section of sections) {
|
|
8929
|
+
const hasValidTitle = section.sectionTitle && section.sectionTitle.trim() !== '';
|
|
8930
|
+
if (hasValidTitle) {
|
|
8931
|
+
result.push(Object.assign({}, section, {
|
|
8932
|
+
categories: [...section.categories]
|
|
8933
|
+
}));
|
|
8934
|
+
} else {
|
|
8935
|
+
if (result.length > 0) {
|
|
8936
|
+
result[result.length - 1].categories.push(...section.categories);
|
|
8937
|
+
} else {
|
|
8938
|
+
result.push({
|
|
8939
|
+
sectionTitle: '',
|
|
8940
|
+
categories: [...section.categories]
|
|
8941
|
+
});
|
|
8942
|
+
}
|
|
8943
|
+
}
|
|
8944
|
+
}
|
|
8945
|
+
return result;
|
|
8946
|
+
}
|
|
8947
|
+
function expandSections(inputArray) {
|
|
8948
|
+
if (!inputArray || inputArray.length === 0) return [];
|
|
8949
|
+
const originalSection = inputArray[0];
|
|
8950
|
+
const categories = originalSection.categories || [];
|
|
8951
|
+
return categories.map((category, index) => ({
|
|
8952
|
+
sectionTitle: `${category.label} Section`,
|
|
8953
|
+
categories: [category]
|
|
8954
|
+
}));
|
|
8955
|
+
}
|
|
8848
8956
|
/* eslint-disable jsx-a11y/anchor-is-valid */
|
|
8849
8957
|
const TaskList = ({
|
|
8850
8958
|
categories,
|
|
@@ -8855,12 +8963,55 @@ const TaskList = ({
|
|
|
8855
8963
|
}) => {
|
|
8856
8964
|
const testid = 'table-of-contents';
|
|
8857
8965
|
const sectioned = getCategorySections(categories);
|
|
8966
|
+
const [completedGroups, setCompletedGroups] = useState(0);
|
|
8967
|
+
const [total, setTotal] = useState(sectioned.filter(s => s.categories && s.sectionTitle).length);
|
|
8968
|
+
const shouldShow = cat => {
|
|
8969
|
+
var _a, _b;
|
|
8970
|
+
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) !== false;
|
|
8971
|
+
};
|
|
8972
|
+
const updateCompletion = (group, category, groupIndex) => {
|
|
8973
|
+
let leftIndex = groupIndex;
|
|
8974
|
+
while (leftIndex > 0 && !shouldShow(group[leftIndex - 1])) {
|
|
8975
|
+
leftIndex--;
|
|
8976
|
+
}
|
|
8977
|
+
let rightIndex = groupIndex;
|
|
8978
|
+
while (rightIndex < group.length - 1 && !shouldShow(group[rightIndex + 1])) {
|
|
8979
|
+
rightIndex++;
|
|
8980
|
+
}
|
|
8981
|
+
const currentLocalGroup = group.slice(leftIndex, rightIndex + 1);
|
|
8982
|
+
const modifyCategory = JSON.parse(JSON.stringify(category));
|
|
8983
|
+
modifyCategory.isCompleted = currentLocalGroup.length === currentLocalGroup.filter(cat => cat.isCompleted).length;
|
|
8984
|
+
return modifyCategory;
|
|
8985
|
+
};
|
|
8858
8986
|
const showInTaskListList = categories.map(cat => {
|
|
8859
8987
|
var _a, _b, _c, _d;
|
|
8860
8988
|
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;
|
|
8861
8989
|
});
|
|
8862
8990
|
let globalIndex = 0;
|
|
8863
8991
|
let sectionIndex = 1;
|
|
8992
|
+
useEffect(() => {
|
|
8993
|
+
let count = 0;
|
|
8994
|
+
let mergedSections = mergeOrphanSections(sectioned);
|
|
8995
|
+
if (mergedSections.length === 1) {
|
|
8996
|
+
mergedSections = expandSections(mergedSections);
|
|
8997
|
+
setTotal(mergedSections.length);
|
|
8998
|
+
}
|
|
8999
|
+
mergedSections.forEach(({
|
|
9000
|
+
categories: group
|
|
9001
|
+
}) => {
|
|
9002
|
+
let countInGroup = 0;
|
|
9003
|
+
group.forEach((category, groupIndex) => {
|
|
9004
|
+
const modifyCategory = updateCompletion(group, category, groupIndex);
|
|
9005
|
+
if (getCategoryStatus(modifyCategory) === 'Completed') {
|
|
9006
|
+
countInGroup++;
|
|
9007
|
+
}
|
|
9008
|
+
});
|
|
9009
|
+
if (countInGroup === group.length) {
|
|
9010
|
+
count++;
|
|
9011
|
+
}
|
|
9012
|
+
});
|
|
9013
|
+
setCompletedGroups(count);
|
|
9014
|
+
}, [categories, sectioned]); // re-run whenever categories change
|
|
8864
9015
|
return jsx(PageBorder, {
|
|
8865
9016
|
children: jsxs("div", {
|
|
8866
9017
|
"data-testid": testid,
|
|
@@ -8869,12 +9020,15 @@ const TaskList = ({
|
|
|
8869
9020
|
ml: "xl",
|
|
8870
9021
|
mb: "xl",
|
|
8871
9022
|
children: title
|
|
8872
|
-
}),
|
|
9023
|
+
}), subtitle && jsx(GoAText, {
|
|
8873
9024
|
size: "heading-l",
|
|
8874
9025
|
mt: "none",
|
|
8875
9026
|
mb: "xl",
|
|
8876
9027
|
ml: "xl",
|
|
8877
9028
|
children: subtitle
|
|
9029
|
+
}), jsx(ApplicationStatus, {
|
|
9030
|
+
completedGroups: completedGroups,
|
|
9031
|
+
totalGroups: total
|
|
8878
9032
|
}), jsx(GoATable, {
|
|
8879
9033
|
width: "100%",
|
|
8880
9034
|
children: jsxs("tbody", {
|
|
@@ -8886,36 +9040,22 @@ const TaskList = ({
|
|
|
8886
9040
|
title: sectionTitle,
|
|
8887
9041
|
index: sectionIndex++
|
|
8888
9042
|
}, `section-${sectionTitle}`), group.map((category, groupIndex) => {
|
|
8889
|
-
//eslint-disable-next-line
|
|
8890
|
-
const shouldShow = cat => {
|
|
8891
|
-
var _a, _b;
|
|
8892
|
-
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) !== false;
|
|
8893
|
-
};
|
|
8894
|
-
let leftIndex = groupIndex;
|
|
8895
|
-
while (leftIndex > 0 && !shouldShow(group[leftIndex - 1])) {
|
|
8896
|
-
leftIndex--;
|
|
8897
|
-
}
|
|
8898
|
-
let rightIndex = groupIndex;
|
|
8899
|
-
while (rightIndex < group.length - 1 && !shouldShow(group[rightIndex + 1])) {
|
|
8900
|
-
rightIndex++;
|
|
8901
|
-
}
|
|
8902
|
-
const currentLocalGroup = group.slice(leftIndex, rightIndex + 1);
|
|
8903
|
-
const showGroupTaskListList = categories.map(cat => shouldShow(cat));
|
|
8904
9043
|
const showCurrent = showInTaskListList[globalIndex];
|
|
8905
|
-
const
|
|
8906
|
-
const modifyCategory = JSON.parse(JSON.stringify(category));
|
|
8907
|
-
modifyCategory.isCompleted = currentLocalGroup.length === currentLocalGroup.filter(category => category.isCompleted).length;
|
|
9044
|
+
const idx = globalIndex++; // renamed from `index` to avoid shadowing
|
|
8908
9045
|
let currentCategory = category;
|
|
9046
|
+
const modifyCategory = updateCompletion(group, category, groupIndex);
|
|
9047
|
+
const showGroupTaskListList = categories.map(cat => shouldShow(cat));
|
|
8909
9048
|
if (showGroupTaskListList.length > showGroupTaskListList.filter(item => item === true).length) {
|
|
8910
9049
|
currentCategory = modifyCategory;
|
|
8911
9050
|
}
|
|
8912
9051
|
if (showCurrent) {
|
|
8913
9052
|
return jsx(CategoryRow, {
|
|
8914
9053
|
category: currentCategory,
|
|
8915
|
-
index:
|
|
9054
|
+
index: idx,
|
|
8916
9055
|
onClick: onClick
|
|
8917
|
-
}, `cat-${category.label}-${
|
|
9056
|
+
}, `cat-${category.label}-${idx}`);
|
|
8918
9057
|
}
|
|
9058
|
+
return null;
|
|
8919
9059
|
})]
|
|
8920
9060
|
}, index)), jsx(SummaryRow, {
|
|
8921
9061
|
index: globalIndex,
|
|
@@ -10261,10 +10401,11 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
|
|
|
10261
10401
|
children: [jsx("thead", {
|
|
10262
10402
|
children: jsxs("tr", {
|
|
10263
10403
|
children: [Object.entries(tableKeys).map(([value, index]) => {
|
|
10404
|
+
const currentProperty = properties[value];
|
|
10264
10405
|
if (!isInReview) {
|
|
10265
10406
|
return jsx("th", {
|
|
10266
10407
|
children: jsxs("p", {
|
|
10267
|
-
children: [convertToSentenceCase(index), (required === null || required === void 0 ? void 0 : required.includes(value)) && jsx(RequiredSpan, {
|
|
10408
|
+
children: [(currentProperty === null || currentProperty === void 0 ? void 0 : currentProperty.title) || convertToSentenceCase(index), (required === null || required === void 0 ? void 0 : required.includes(value)) && jsx(RequiredSpan, {
|
|
10268
10409
|
children: "(required)"
|
|
10269
10410
|
})]
|
|
10270
10411
|
})
|
|
@@ -10272,7 +10413,7 @@ const NonEmptyCellComponent$1 = /*#__PURE__*/React.memo(function NonEmptyCellCom
|
|
|
10272
10413
|
}
|
|
10273
10414
|
return jsx(TableTHHeader, {
|
|
10274
10415
|
children: jsxs("p", {
|
|
10275
|
-
children: [`${convertToSentenceCase(index)}`, (required === null || required === void 0 ? void 0 : required.includes(value)) && jsxs(RequiredSpan, {
|
|
10416
|
+
children: [`${(currentProperty === null || currentProperty === void 0 ? void 0 : currentProperty.title) || convertToSentenceCase(index)}`, (required === null || required === void 0 ? void 0 : required.includes(value)) && jsxs(RequiredSpan, {
|
|
10276
10417
|
children: [jsx("br", {}), " (required)"]
|
|
10277
10418
|
})]
|
|
10278
10419
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.33.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",
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { CategoriesState, CategoryState } from '../context';
|
|
2
|
-
interface SectionMap {
|
|
2
|
+
export interface SectionMap {
|
|
3
3
|
sectionTitle: string;
|
|
4
4
|
categories: CategoryState[];
|
|
5
5
|
}
|
|
6
6
|
export declare const getCategorySections: (categories: CategoriesState) => SectionMap[];
|
|
7
|
-
export {};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export declare const ReviewItem: 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 CompletionStatus: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
+
export declare const BarTop: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
|
+
export declare const Bar: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
5
|
+
export declare const Percentage: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
6
|
+
export declare const BadgeWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
7
|
+
export declare const CompletionTextHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
|
|
2
8
|
export declare const ReviewItemSection: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
9
|
export declare const ReviewItemHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
10
|
export declare const ReviewItemTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
@@ -17,7 +23,7 @@ export declare const TableReviewItem: import("styled-components/dist/types").ISt
|
|
|
17
23
|
export declare const TableReviewPageTitleRow: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
18
24
|
export declare const TableReviewCategoryLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, never>> & string;
|
|
19
25
|
export declare const CategoryStatus: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>, never>> & string;
|
|
20
|
-
export declare const
|
|
26
|
+
export declare const Center: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
21
27
|
interface PageStepperRowProps {
|
|
22
28
|
disabled: boolean;
|
|
23
29
|
}
|