@abgov/jsonforms-components 1.42.5 → 1.42.6
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 +48 -19
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -3684,7 +3684,7 @@ const GoAInputBaseControl = props => {
|
|
|
3684
3684
|
error: modifiedErrors,
|
|
3685
3685
|
testId: `${isStepperReview === true && 'review-base-'}${path}`,
|
|
3686
3686
|
label: (props === null || props === void 0 ? void 0 : props.noLabel) === true ? '' : labelToUpdate,
|
|
3687
|
-
helpText: typeof ((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.help) === 'string' ? (_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.help : '',
|
|
3687
|
+
helpText: typeof ((_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.help) === 'string' && !isStepperReview ? (_b = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _b === void 0 ? void 0 : _b.help : '',
|
|
3688
3688
|
children: jsx(InnerComponent, Object.assign({}, modifiedProps))
|
|
3689
3689
|
})
|
|
3690
3690
|
})
|
|
@@ -5673,7 +5673,7 @@ const FormStepper = props => {
|
|
|
5673
5673
|
const categoryLabels = [...allCategories.elements.map(category => category.label), summaryLabel];
|
|
5674
5674
|
const visibleLabels = [...visibleCategoryLabels, summaryLabel];
|
|
5675
5675
|
const newPage = mapToVisibleStep(page, categoryLabels, visibleLabels);
|
|
5676
|
-
const pageStatus = getCompletionStatus(inputStatuses, page);
|
|
5676
|
+
const pageStatus = getCompletionStatus(inputStatuses, page, true);
|
|
5677
5677
|
const statuses = [...stepStatuses];
|
|
5678
5678
|
statuses[page - 1] = pageStatus ? pageStatus : 'incomplete';
|
|
5679
5679
|
setStepStatuses(statuses);
|
|
@@ -8202,7 +8202,7 @@ const AddressViews = ({
|
|
|
8202
8202
|
gap: "s",
|
|
8203
8203
|
children: [jsx(GoAFormItem, {
|
|
8204
8204
|
error: ((_a = data === null || data === void 0 ? void 0 : data.addressLine1) === null || _a === void 0 ? void 0 : _a.length) === 0 ? 'addressLine1 is required' : '',
|
|
8205
|
-
label: `${isAlbertaAddress ? 'Alberta
|
|
8205
|
+
label: `${isAlbertaAddress ? 'Alberta' : 'Canada'} postal address`,
|
|
8206
8206
|
children: jsx("p", {
|
|
8207
8207
|
children: data === null || data === void 0 ? void 0 : data.addressLine1
|
|
8208
8208
|
})
|
|
@@ -8258,11 +8258,9 @@ const AddressLookUpControlReview = props => {
|
|
|
8258
8258
|
schema
|
|
8259
8259
|
} = props;
|
|
8260
8260
|
const isAlbertaAddress = ((_b = (_a = schema === null || schema === void 0 ? void 0 : schema.properties) === null || _a === void 0 ? void 0 : _a.subdivisionCode) === null || _b === void 0 ? void 0 : _b.const) === 'AB';
|
|
8261
|
-
return jsx(
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
isAlbertaAddress: isAlbertaAddress
|
|
8265
|
-
})
|
|
8261
|
+
return jsx(AddressViews, {
|
|
8262
|
+
data: data,
|
|
8263
|
+
isAlbertaAddress: isAlbertaAddress
|
|
8266
8264
|
});
|
|
8267
8265
|
};
|
|
8268
8266
|
|
|
@@ -8378,30 +8376,44 @@ const NameInputs = ({
|
|
|
8378
8376
|
};
|
|
8379
8377
|
|
|
8380
8378
|
const FullNameReviewControl = props => {
|
|
8381
|
-
var _a, _b, _c;
|
|
8379
|
+
var _a, _b, _c, _d, _e;
|
|
8382
8380
|
const requiredFields = props.schema.required;
|
|
8381
|
+
const [errors, setErrors] = useState({});
|
|
8382
|
+
useEffect(() => {
|
|
8383
|
+
var _a, _b;
|
|
8384
|
+
const err = {};
|
|
8385
|
+
if ((requiredFields === null || requiredFields === void 0 ? void 0 : requiredFields.includes('firstName')) && !((_a = props.data) === null || _a === void 0 ? void 0 : _a.firstName)) {
|
|
8386
|
+
err['firstName'] = `First name is required`;
|
|
8387
|
+
}
|
|
8388
|
+
if ((requiredFields === null || requiredFields === void 0 ? void 0 : requiredFields.includes('lastName')) && !((_b = props.data) === null || _b === void 0 ? void 0 : _b.lastName)) {
|
|
8389
|
+
err['lastName'] = `Last name is required`;
|
|
8390
|
+
}
|
|
8391
|
+
setErrors(err);
|
|
8392
|
+
}, [props.data, requiredFields]);
|
|
8383
8393
|
return jsxs(GoAGrid, {
|
|
8384
8394
|
minChildWidth: "0ch",
|
|
8385
8395
|
gap: "s",
|
|
8386
8396
|
children: [jsx(GoAFormItem, {
|
|
8387
8397
|
label: "First Name",
|
|
8388
8398
|
requirement: (requiredFields === null || requiredFields === void 0 ? void 0 : requiredFields.includes('firstName')) ? 'required' : undefined,
|
|
8399
|
+
error: (_a = errors === null || errors === void 0 ? void 0 : errors['firstName']) !== null && _a !== void 0 ? _a : '',
|
|
8389
8400
|
children: jsx("div", {
|
|
8390
8401
|
"data-testid": `firstName-control-${props.id}`,
|
|
8391
|
-
children: (
|
|
8402
|
+
children: (_b = props.data) === null || _b === void 0 ? void 0 : _b.firstName
|
|
8392
8403
|
})
|
|
8393
8404
|
}), jsx(GoAFormItem, {
|
|
8394
8405
|
label: "Middle Name",
|
|
8395
8406
|
children: jsx("div", {
|
|
8396
8407
|
"data-testid": `middleName-control-${props.id}`,
|
|
8397
|
-
children: (
|
|
8408
|
+
children: (_c = props.data) === null || _c === void 0 ? void 0 : _c.middleName
|
|
8398
8409
|
})
|
|
8399
8410
|
}), jsx(GoAFormItem, {
|
|
8400
8411
|
label: "Last Name",
|
|
8401
8412
|
requirement: (requiredFields === null || requiredFields === void 0 ? void 0 : requiredFields.includes('lastName')) ? 'required' : undefined,
|
|
8413
|
+
error: (_d = errors === null || errors === void 0 ? void 0 : errors['lastName']) !== null && _d !== void 0 ? _d : '',
|
|
8402
8414
|
children: jsx("div", {
|
|
8403
8415
|
"data-testid": `lastName-control-${props.id}`,
|
|
8404
|
-
children: (
|
|
8416
|
+
children: (_e = props.data) === null || _e === void 0 ? void 0 : _e.lastName
|
|
8405
8417
|
})
|
|
8406
8418
|
})]
|
|
8407
8419
|
});
|
|
@@ -8492,6 +8504,7 @@ const FullNameDobControl = props => {
|
|
|
8492
8504
|
};
|
|
8493
8505
|
const [formData, setFormData] = useState(data || defaultNameAndDob);
|
|
8494
8506
|
const updateFormData = updatedData => {
|
|
8507
|
+
updatedData = Object.fromEntries(Object.entries(updatedData).filter(([_, value]) => value !== ''));
|
|
8495
8508
|
handleChange(path, updatedData);
|
|
8496
8509
|
};
|
|
8497
8510
|
const handleInputChange = (field, value) => {
|
|
@@ -8500,7 +8513,6 @@ const FullNameDobControl = props => {
|
|
|
8500
8513
|
});
|
|
8501
8514
|
setFormData(updatedData);
|
|
8502
8515
|
updateFormData(updatedData);
|
|
8503
|
-
handleRequiredFieldBlur(field, updatedData);
|
|
8504
8516
|
};
|
|
8505
8517
|
const handleDobChange = (field, value) => {
|
|
8506
8518
|
const updatedData = Object.assign(Object.assign({}, formData), {
|
|
@@ -8537,7 +8549,6 @@ const FullNameDobControl = props => {
|
|
|
8537
8549
|
value: formData.firstName || '',
|
|
8538
8550
|
onChange: (name, value) => {
|
|
8539
8551
|
handleInputChange(name, value);
|
|
8540
|
-
handleRequiredFieldBlur(name);
|
|
8541
8552
|
},
|
|
8542
8553
|
onBlur: name => {
|
|
8543
8554
|
/* istanbul ignore next */
|
|
@@ -8604,8 +8615,23 @@ const FullNameDobControl = props => {
|
|
|
8604
8615
|
};
|
|
8605
8616
|
|
|
8606
8617
|
const FullNameDobReviewControl = props => {
|
|
8607
|
-
var _a, _b, _c, _d;
|
|
8618
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
8608
8619
|
const requiredFields = props.schema.required;
|
|
8620
|
+
const [errors, setErrors] = useState({});
|
|
8621
|
+
useEffect(() => {
|
|
8622
|
+
var _a, _b, _c;
|
|
8623
|
+
const err = {};
|
|
8624
|
+
if ((requiredFields === null || requiredFields === void 0 ? void 0 : requiredFields.includes('firstName')) && !((_a = props.data) === null || _a === void 0 ? void 0 : _a.firstName)) {
|
|
8625
|
+
err['firstName'] = `First name is required`;
|
|
8626
|
+
}
|
|
8627
|
+
if ((requiredFields === null || requiredFields === void 0 ? void 0 : requiredFields.includes('lastName')) && !((_b = props.data) === null || _b === void 0 ? void 0 : _b.lastName)) {
|
|
8628
|
+
err['lastName'] = `Last name is required`;
|
|
8629
|
+
}
|
|
8630
|
+
if ((requiredFields === null || requiredFields === void 0 ? void 0 : requiredFields.includes('dateOfBirth')) && !((_c = props.data) === null || _c === void 0 ? void 0 : _c.dateOfBirth)) {
|
|
8631
|
+
err['dateOfBirth'] = `Date of birth is required`;
|
|
8632
|
+
}
|
|
8633
|
+
setErrors(err);
|
|
8634
|
+
}, [props.data, requiredFields]);
|
|
8609
8635
|
return jsxs(Fragment, {
|
|
8610
8636
|
children: [jsxs(GoAGrid, {
|
|
8611
8637
|
minChildWidth: "0ch",
|
|
@@ -8613,22 +8639,24 @@ const FullNameDobReviewControl = props => {
|
|
|
8613
8639
|
children: [jsx(GoAFormItem, {
|
|
8614
8640
|
label: "First name",
|
|
8615
8641
|
requirement: (requiredFields === null || requiredFields === void 0 ? void 0 : requiredFields.includes('firstName')) ? 'required' : undefined,
|
|
8642
|
+
error: (_a = errors === null || errors === void 0 ? void 0 : errors['firstName']) !== null && _a !== void 0 ? _a : '',
|
|
8616
8643
|
children: jsx("div", {
|
|
8617
8644
|
"data-testid": `firstName-control-${props.id}`,
|
|
8618
|
-
children: (
|
|
8645
|
+
children: (_b = props.data) === null || _b === void 0 ? void 0 : _b.firstName
|
|
8619
8646
|
})
|
|
8620
8647
|
}), jsx(GoAFormItem, {
|
|
8621
8648
|
label: "Middle name",
|
|
8622
8649
|
children: jsx("div", {
|
|
8623
8650
|
"data-testid": `middleName-control-${props.id}`,
|
|
8624
|
-
children: (
|
|
8651
|
+
children: (_c = props.data) === null || _c === void 0 ? void 0 : _c.middleName
|
|
8625
8652
|
})
|
|
8626
8653
|
}), jsx(GoAFormItem, {
|
|
8627
8654
|
label: "Last name",
|
|
8628
8655
|
requirement: (requiredFields === null || requiredFields === void 0 ? void 0 : requiredFields.includes('lastName')) ? 'required' : undefined,
|
|
8656
|
+
error: (_d = errors === null || errors === void 0 ? void 0 : errors['lastName']) !== null && _d !== void 0 ? _d : '',
|
|
8629
8657
|
children: jsx("div", {
|
|
8630
8658
|
"data-testid": `lastName-control-${props.id}`,
|
|
8631
|
-
children: (
|
|
8659
|
+
children: (_e = props.data) === null || _e === void 0 ? void 0 : _e.lastName
|
|
8632
8660
|
})
|
|
8633
8661
|
})]
|
|
8634
8662
|
}), jsx(GoAGrid, {
|
|
@@ -8637,9 +8665,10 @@ const FullNameDobReviewControl = props => {
|
|
|
8637
8665
|
children: jsx(GoAFormItem, {
|
|
8638
8666
|
label: "Date of birth",
|
|
8639
8667
|
requirement: (requiredFields === null || requiredFields === void 0 ? void 0 : requiredFields.includes('dateOfBirth')) ? 'required' : undefined,
|
|
8668
|
+
error: (_f = errors === null || errors === void 0 ? void 0 : errors['dateOfBirth']) !== null && _f !== void 0 ? _f : '',
|
|
8640
8669
|
children: jsx("div", {
|
|
8641
8670
|
"data-testid": `dob-control-${props.id}`,
|
|
8642
|
-
children: (
|
|
8671
|
+
children: (_g = props.data) === null || _g === void 0 ? void 0 : _g.dateOfBirth
|
|
8643
8672
|
})
|
|
8644
8673
|
})
|
|
8645
8674
|
})]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "1.42.
|
|
3
|
+
"version": "1.42.6",
|
|
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",
|