@abgov/jsonforms-components 1.43.2 → 1.43.4
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 +26 -12
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -2466,7 +2466,7 @@ const StepperContext = /*#__PURE__*/createContext({
|
|
|
2466
2466
|
stepId: 0
|
|
2467
2467
|
});
|
|
2468
2468
|
const isEmpty = value => {
|
|
2469
|
-
return value === undefined || value === null || typeof value === 'string' && value.length < 1;
|
|
2469
|
+
return value === undefined || value === null || typeof value === 'string' && value.length < 1 || typeof value === 'boolean' && value === false;
|
|
2470
2470
|
};
|
|
2471
2471
|
const getCompletionStatus = (table, step, isFormChanged = false) => {
|
|
2472
2472
|
const nonEmptyCount = getNonEmptyCount(table, step);
|
|
@@ -5743,15 +5743,24 @@ const FormStepper = props => {
|
|
|
5743
5743
|
}
|
|
5744
5744
|
setPage(page);
|
|
5745
5745
|
}
|
|
5746
|
+
const getAllStatuses = (nextPage, totalVisibleTabs) => {
|
|
5747
|
+
const previouslyActivePage = nextPage - 1;
|
|
5748
|
+
const statuses = [...stepStatuses];
|
|
5749
|
+
for (let currentPage = 1; currentPage <= previouslyActivePage; currentPage++) {
|
|
5750
|
+
const pageStatus = getCompletionStatus(inputStatuses, currentPage, true);
|
|
5751
|
+
statuses[currentPage - 1] = pageStatus ? pageStatus : 'incomplete';
|
|
5752
|
+
}
|
|
5753
|
+
return statuses;
|
|
5754
|
+
};
|
|
5746
5755
|
/* istanbul ignore next */
|
|
5747
5756
|
function setTab(page) {
|
|
5748
5757
|
const categoryLabels = [...allCategories.elements.map(category => category.label), summaryLabel];
|
|
5749
5758
|
const visibleLabels = [...visibleCategoryLabels, summaryLabel];
|
|
5750
5759
|
const newPage = mapToVisibleStep(page, categoryLabels, visibleLabels);
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5760
|
+
if (Object.keys(inputStatuses).length) {
|
|
5761
|
+
const statuses = getAllStatuses(page, visibleLabels.length);
|
|
5762
|
+
setStepStatuses(statuses);
|
|
5763
|
+
}
|
|
5755
5764
|
setPage(newPage);
|
|
5756
5765
|
}
|
|
5757
5766
|
function setPage(page) {
|
|
@@ -6144,6 +6153,7 @@ const AttachmentBorder = styled.div(_t2$2 || (_t2$2 = _$3`
|
|
|
6144
6153
|
margin-top: var(--goa-space-2xs);
|
|
6145
6154
|
`));
|
|
6146
6155
|
const FileUploaderStyle = styled.div(_t3$2 || (_t3$2 = _$3`
|
|
6156
|
+
margin-bottom: var(--goa-space-l);
|
|
6147
6157
|
.label {
|
|
6148
6158
|
display: block;
|
|
6149
6159
|
font-weight: var(--goa-font-weight-bold);
|
|
@@ -8001,6 +8011,7 @@ const AddressLookUpControl = props => {
|
|
|
8001
8011
|
const [loading, setLoading] = useState(false);
|
|
8002
8012
|
const [errors, setErrors] = useState({});
|
|
8003
8013
|
const requiredFields = schema.required;
|
|
8014
|
+
const [dropdownSelected, setDropdownSelected] = useState(false);
|
|
8004
8015
|
const updateFormData = updatedAddress => {
|
|
8005
8016
|
setAddress(updatedAddress);
|
|
8006
8017
|
handleChange(path, updatedAddress);
|
|
@@ -8009,6 +8020,9 @@ const AddressLookUpControl = props => {
|
|
|
8009
8020
|
const dropdownRef = useRef(null);
|
|
8010
8021
|
const handleInputChange = (field, value) => {
|
|
8011
8022
|
var _a, _b;
|
|
8023
|
+
if (field === 'addressLine1' && searchTerm.length < 3) {
|
|
8024
|
+
setDropdownSelected(false);
|
|
8025
|
+
}
|
|
8012
8026
|
let newAddress;
|
|
8013
8027
|
const postalCodeErrorMessage = (_b = (_a = schema.errorMessage) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.postalCode;
|
|
8014
8028
|
if (field === 'postalCode') {
|
|
@@ -8035,7 +8049,7 @@ const AddressLookUpControl = props => {
|
|
|
8035
8049
|
};
|
|
8036
8050
|
useEffect(() => {
|
|
8037
8051
|
const fetchSuggestions = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
8038
|
-
if (searchTerm.length > 2) {
|
|
8052
|
+
if (searchTerm.length > 2 && dropdownSelected === false) {
|
|
8039
8053
|
setLoading(true);
|
|
8040
8054
|
setOpen(true);
|
|
8041
8055
|
yield fetchAddressSuggestions(formUrl, searchTerm, isAlbertaAddress).then(response => {
|
|
@@ -8053,7 +8067,7 @@ const AddressLookUpControl = props => {
|
|
|
8053
8067
|
}
|
|
8054
8068
|
});
|
|
8055
8069
|
fetchSuggestions();
|
|
8056
|
-
}, [searchTerm]);
|
|
8070
|
+
}, [searchTerm, dropdownSelected]);
|
|
8057
8071
|
const handleDropdownChange = value => {
|
|
8058
8072
|
setSearchTerm(value);
|
|
8059
8073
|
handleInputChange('addressLine1', value);
|
|
@@ -8064,6 +8078,7 @@ const AddressLookUpControl = props => {
|
|
|
8064
8078
|
handleChange(path, suggestAddress);
|
|
8065
8079
|
setSuggestions([]);
|
|
8066
8080
|
setErrors({});
|
|
8081
|
+
setDropdownSelected(true);
|
|
8067
8082
|
};
|
|
8068
8083
|
/* istanbul ignore next */
|
|
8069
8084
|
const handleRequiredFieldBlur = name => {
|
|
@@ -8118,9 +8133,7 @@ const AddressLookUpControl = props => {
|
|
|
8118
8133
|
ariaLabel: 'address-form-address1',
|
|
8119
8134
|
placeholder: "Start typing the first line of your address, required.",
|
|
8120
8135
|
value: (address === null || address === void 0 ? void 0 : address.addressLine1) || '',
|
|
8121
|
-
onChange: (e, value) =>
|
|
8122
|
-
handleDropdownChange(value);
|
|
8123
|
-
},
|
|
8136
|
+
onChange: (e, value) => handleDropdownChange(value),
|
|
8124
8137
|
onBlur: name => handleRequiredFieldBlur(name),
|
|
8125
8138
|
width: "100%",
|
|
8126
8139
|
onKeyPress: (e, value, key) => {
|
|
@@ -8132,10 +8145,9 @@ const AddressLookUpControl = props => {
|
|
|
8132
8145
|
variant: "inline",
|
|
8133
8146
|
size: "small",
|
|
8134
8147
|
visible: true
|
|
8135
|
-
}), suggestions && autocompletion && jsx("ul", {
|
|
8148
|
+
}), !loading && suggestions && autocompletion && jsx("ul", {
|
|
8136
8149
|
ref: dropdownRef,
|
|
8137
8150
|
className: "suggestions",
|
|
8138
|
-
tabIndex: 0,
|
|
8139
8151
|
children: suggestions && autocompletion && open && suggestions.map((suggestion, index) => jsx(ListItem, {
|
|
8140
8152
|
"data-index": index,
|
|
8141
8153
|
onMouseDown: e => {
|
|
@@ -8341,6 +8353,7 @@ const NameInputs = ({
|
|
|
8341
8353
|
return jsxs(GoAGrid, {
|
|
8342
8354
|
minChildWidth: "0ch",
|
|
8343
8355
|
gap: "s",
|
|
8356
|
+
mb: "m",
|
|
8344
8357
|
testId: "wrapper",
|
|
8345
8358
|
children: [jsx(GoAFormItem, {
|
|
8346
8359
|
testId: "formitem-first-name",
|
|
@@ -8557,6 +8570,7 @@ const FullNameDobControl = props => {
|
|
|
8557
8570
|
children: [jsxs(GoAGrid, {
|
|
8558
8571
|
minChildWidth: "0ch",
|
|
8559
8572
|
gap: "s",
|
|
8573
|
+
mb: "m",
|
|
8560
8574
|
children: [jsx(GoAFormItem, {
|
|
8561
8575
|
label: "First name",
|
|
8562
8576
|
requirement: ((_a = schema === null || schema === void 0 ? void 0 : schema.required) === null || _a === void 0 ? void 0 : _a.includes('firstName')) ? 'required' : undefined,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "1.43.
|
|
3
|
+
"version": "1.43.4",
|
|
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",
|