@abgov/jsonforms-components 1.55.1 → 1.56.1
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
|
@@ -4458,8 +4458,6 @@ const GoAInputText = props => {
|
|
|
4458
4458
|
if (schema && schema.title === sinTitle && value !== '') {
|
|
4459
4459
|
formattedValue = formatSin(value);
|
|
4460
4460
|
}
|
|
4461
|
-
/* TODO: add the unit test, when the solution is used */
|
|
4462
|
-
/* istanbul ignore next */
|
|
4463
4461
|
if (isVisited === false && setIsVisited) {
|
|
4464
4462
|
setIsVisited();
|
|
4465
4463
|
}
|
|
@@ -4470,11 +4468,9 @@ const GoAInputText = props => {
|
|
|
4470
4468
|
});
|
|
4471
4469
|
},
|
|
4472
4470
|
onBlur: (name, value) => {
|
|
4473
|
-
/* istanbul ignore next */
|
|
4474
4471
|
if (isVisited === false && setIsVisited) {
|
|
4475
4472
|
setIsVisited();
|
|
4476
4473
|
}
|
|
4477
|
-
/* istanbul ignore next */
|
|
4478
4474
|
onBlurForTextControl({
|
|
4479
4475
|
name,
|
|
4480
4476
|
controlProps: props,
|
|
@@ -4528,8 +4524,6 @@ const MultiLineText = props => {
|
|
|
4528
4524
|
// maxCount={schema.maxLength || 256}
|
|
4529
4525
|
onKeyPress: (name, value, key) => {
|
|
4530
4526
|
const newValue = autoCapitalize ? value.toUpperCase() : value;
|
|
4531
|
-
/* TODO: add the unit test, when the solution is used */
|
|
4532
|
-
/* istanbul ignore next */
|
|
4533
4527
|
if (isVisited === false && setIsVisited) {
|
|
4534
4528
|
setIsVisited();
|
|
4535
4529
|
}
|
|
@@ -4548,8 +4542,6 @@ const MultiLineText = props => {
|
|
|
4548
4542
|
});
|
|
4549
4543
|
},
|
|
4550
4544
|
onChange: (name, value) => {
|
|
4551
|
-
/* TODO: add the unit test, when the solution is used */
|
|
4552
|
-
/* istanbul ignore next */
|
|
4553
4545
|
if (isVisited === false && setIsVisited) {
|
|
4554
4546
|
setIsVisited();
|
|
4555
4547
|
}
|
|
@@ -4642,8 +4634,6 @@ const GoADateInput = props => {
|
|
|
4642
4634
|
disabled: !enabled,
|
|
4643
4635
|
readonly: readOnly,
|
|
4644
4636
|
onChange: (name, value) => {
|
|
4645
|
-
/* TODO: add the unit test, when the solution is used */
|
|
4646
|
-
/* istanbul ignore next */
|
|
4647
4637
|
if (isVisited === false && setIsVisited) {
|
|
4648
4638
|
setIsVisited();
|
|
4649
4639
|
}
|
|
@@ -4662,11 +4652,9 @@ const GoADateInput = props => {
|
|
|
4662
4652
|
});
|
|
4663
4653
|
},
|
|
4664
4654
|
onBlur: (name, value) => {
|
|
4665
|
-
/* istanbul ignore next */
|
|
4666
4655
|
if (isVisited === false && setIsVisited) {
|
|
4667
4656
|
setIsVisited();
|
|
4668
4657
|
}
|
|
4669
|
-
/* istanbul ignore next */
|
|
4670
4658
|
onBlurForDateControl({
|
|
4671
4659
|
name,
|
|
4672
4660
|
value,
|
|
@@ -4719,11 +4707,9 @@ const GoANumberInput = props => {
|
|
|
4719
4707
|
name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
|
|
4720
4708
|
testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
|
|
4721
4709
|
onBlur: (name, value) => {
|
|
4722
|
-
/* istanbul ignore next */
|
|
4723
4710
|
if (isVisited === false && setIsVisited) {
|
|
4724
4711
|
setIsVisited();
|
|
4725
4712
|
}
|
|
4726
|
-
/* istanbul ignore next */
|
|
4727
4713
|
onBlurForNumericControl({
|
|
4728
4714
|
name,
|
|
4729
4715
|
value,
|
|
@@ -4731,8 +4717,6 @@ const GoANumberInput = props => {
|
|
|
4731
4717
|
});
|
|
4732
4718
|
},
|
|
4733
4719
|
onChange: (name, value) => {
|
|
4734
|
-
/* TODO: add the unit test, when the solution is used */
|
|
4735
|
-
/* istanbul ignore next */
|
|
4736
4720
|
if (isVisited === false && setIsVisited) {
|
|
4737
4721
|
setIsVisited();
|
|
4738
4722
|
}
|
|
@@ -4787,10 +4771,7 @@ const GoAInputInteger = props => {
|
|
|
4787
4771
|
placeholder: placeholder,
|
|
4788
4772
|
name: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.name) || `${id || label}-input`,
|
|
4789
4773
|
testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
|
|
4790
|
-
/* istanbul ignore next */
|
|
4791
4774
|
onBlur: (name, value) => {
|
|
4792
|
-
/* TODO: add the unit test, when the solution is used */
|
|
4793
|
-
/* istanbul ignore next */
|
|
4794
4775
|
if (isVisited === false && setIsVisited) {
|
|
4795
4776
|
setIsVisited();
|
|
4796
4777
|
}
|
|
@@ -4801,8 +4782,6 @@ const GoAInputInteger = props => {
|
|
|
4801
4782
|
});
|
|
4802
4783
|
},
|
|
4803
4784
|
onChange: (name, value) => {
|
|
4804
|
-
/* TODO: add the unit test, when the solution is used */
|
|
4805
|
-
/* istanbul ignore next */
|
|
4806
4785
|
if (isVisited === false && setIsVisited) {
|
|
4807
4786
|
setIsVisited();
|
|
4808
4787
|
}
|
|
@@ -4822,7 +4801,6 @@ const GoAInputIntegerControl = withJsonFormsControlProps(GoAIntegerControl);
|
|
|
4822
4801
|
|
|
4823
4802
|
const GoADateTimeInput = props => {
|
|
4824
4803
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
4825
|
-
// eslint-disable-next-line
|
|
4826
4804
|
const {
|
|
4827
4805
|
data,
|
|
4828
4806
|
config,
|
|
@@ -4865,11 +4843,9 @@ const GoADateTimeInput = props => {
|
|
|
4865
4843
|
});
|
|
4866
4844
|
},
|
|
4867
4845
|
onBlur: (name, value) => {
|
|
4868
|
-
/* istanbul ignore next */
|
|
4869
4846
|
if (isVisited === false && setIsVisited) {
|
|
4870
4847
|
setIsVisited();
|
|
4871
4848
|
}
|
|
4872
|
-
/* istanbul ignore next */
|
|
4873
4849
|
onBlurForDateControl({
|
|
4874
4850
|
name,
|
|
4875
4851
|
value,
|
|
@@ -4915,16 +4891,11 @@ const GoATimeInput = props => {
|
|
|
4915
4891
|
readonly: readOnly,
|
|
4916
4892
|
testId: (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.testId) || `${id}-input`,
|
|
4917
4893
|
onBlur: (name, value) => {
|
|
4918
|
-
/* istanbul ignore next */
|
|
4919
4894
|
if (isVisited === false && setIsVisited) {
|
|
4920
4895
|
setIsVisited();
|
|
4921
4896
|
}
|
|
4922
|
-
/* istanbul ignore next */
|
|
4923
4897
|
handleChange(path, value === '' ? undefined : value);
|
|
4924
4898
|
},
|
|
4925
|
-
// Dont use handleChange in the onChange event, use the keyPress or onBlur.
|
|
4926
|
-
// If you use it onChange along with keyPress event it will cause a
|
|
4927
|
-
// side effect that causes the validation to render when it shouldnt.
|
|
4928
4899
|
onChange: (name, value) => {},
|
|
4929
4900
|
onKeyPress: (name, value, key) => {
|
|
4930
4901
|
onKeyPressForTimeControl({
|
|
@@ -6498,12 +6469,15 @@ const FormPagesView = props => {
|
|
|
6498
6469
|
disabled: !(category.isValid && category.isCompleted),
|
|
6499
6470
|
testId: "pages-save-continue-btn",
|
|
6500
6471
|
children: "Save and continue"
|
|
6501
|
-
}) : jsx(
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6472
|
+
}) : jsx(GoAButtonGroup, {
|
|
6473
|
+
alignment: "end",
|
|
6474
|
+
children: jsx(GoAButton, {
|
|
6475
|
+
type: 'primary',
|
|
6476
|
+
onClick: handleSubmit,
|
|
6477
|
+
disabled: !isValid,
|
|
6478
|
+
testId: "pages-submit-btn",
|
|
6479
|
+
children: "Submit"
|
|
6480
|
+
})
|
|
6507
6481
|
})
|
|
6508
6482
|
})]
|
|
6509
6483
|
}, `${category.label}`);
|
|
@@ -6549,8 +6523,8 @@ const categoriesAreValid = uischema => {
|
|
|
6549
6523
|
return isValid;
|
|
6550
6524
|
};
|
|
6551
6525
|
const CategorizationStepperRendererTester = rankWith(2, and(uiTypeIs('Categorization'), categoriesAreValid, uischema => {
|
|
6552
|
-
var _a;
|
|
6553
|
-
return ((_a = uischema.options) === null || _a === void 0 ? void 0 : _a.variant) === 'stepper';
|
|
6526
|
+
var _a, _b;
|
|
6527
|
+
return ((_a = uischema.options) === null || _a === void 0 ? void 0 : _a.variant) === 'stepper' || ((_b = uischema.options) === null || _b === void 0 ? void 0 : _b.variant) === undefined;
|
|
6554
6528
|
}));
|
|
6555
6529
|
const CategorizationPagesRendererTester = rankWith(2, and(uiTypeIs('Categorization'), categoriesAreValid, uischema => {
|
|
6556
6530
|
var _a;
|
|
@@ -8769,11 +8743,7 @@ const AddressLookUpControl = props => {
|
|
|
8769
8743
|
const [open, setOpen] = useState(false);
|
|
8770
8744
|
const label = typeof (uischema === null || uischema === void 0 ? void 0 : uischema.label) === 'string' && uischema.label ? uischema.label : '';
|
|
8771
8745
|
const defaultAddress = {
|
|
8772
|
-
addressLine1: '',
|
|
8773
|
-
addressLine2: '',
|
|
8774
|
-
municipality: '',
|
|
8775
8746
|
subdivisionCode: isAlbertaAddress ? 'AB' : '',
|
|
8776
|
-
postalCode: '',
|
|
8777
8747
|
country: 'CA'
|
|
8778
8748
|
};
|
|
8779
8749
|
const [address, setAddress] = useState(data || defaultAddress);
|
|
@@ -8810,6 +8780,9 @@ const AddressLookUpControl = props => {
|
|
|
8810
8780
|
});
|
|
8811
8781
|
delete errors[field];
|
|
8812
8782
|
}
|
|
8783
|
+
if (value === '' && field in newAddress) {
|
|
8784
|
+
delete newAddress[field];
|
|
8785
|
+
}
|
|
8813
8786
|
setAddress(newAddress);
|
|
8814
8787
|
updateFormData(newAddress);
|
|
8815
8788
|
};
|
|
@@ -8976,7 +8949,7 @@ const AddressViews = ({
|
|
|
8976
8949
|
data,
|
|
8977
8950
|
isAlbertaAddress
|
|
8978
8951
|
}) => {
|
|
8979
|
-
var _a
|
|
8952
|
+
var _a;
|
|
8980
8953
|
const provinces = [{
|
|
8981
8954
|
value: 'AB',
|
|
8982
8955
|
label: 'Alberta'
|
|
@@ -9030,7 +9003,7 @@ const AddressViews = ({
|
|
|
9030
9003
|
gap: "s",
|
|
9031
9004
|
children: [jsx(GoAFormItem, {
|
|
9032
9005
|
label: "Address line 1",
|
|
9033
|
-
error: (
|
|
9006
|
+
error: (data === null || data === void 0 ? void 0 : data.addressLine1) === undefined ? 'addressLine1 is required' : '',
|
|
9034
9007
|
children: jsx(TextWrap, {
|
|
9035
9008
|
children: data === null || data === void 0 ? void 0 : data.addressLine1
|
|
9036
9009
|
})
|
|
@@ -9044,13 +9017,13 @@ const AddressViews = ({
|
|
|
9044
9017
|
minChildWidth: "0ch",
|
|
9045
9018
|
gap: "s",
|
|
9046
9019
|
children: [jsx(GoAFormItem, {
|
|
9047
|
-
error: (
|
|
9020
|
+
error: (data === null || data === void 0 ? void 0 : data.municipality) === undefined ? 'city is required' : '',
|
|
9048
9021
|
label: "City",
|
|
9049
9022
|
children: jsx(TextWrap, {
|
|
9050
9023
|
children: data === null || data === void 0 ? void 0 : data.municipality
|
|
9051
9024
|
})
|
|
9052
9025
|
}), jsx(GoAFormItem, {
|
|
9053
|
-
error: (
|
|
9026
|
+
error: (data === null || data === void 0 ? void 0 : data.postalCode) === undefined ? 'postalCode is required' : '',
|
|
9054
9027
|
label: "Postal Code",
|
|
9055
9028
|
children: jsx(TextWrap, {
|
|
9056
9029
|
children: data === null || data === void 0 ? void 0 : data.postalCode
|
|
@@ -9066,7 +9039,7 @@ const AddressViews = ({
|
|
|
9066
9039
|
children: "Alberta"
|
|
9067
9040
|
}), !isAlbertaAddress && jsx("div", {
|
|
9068
9041
|
"data-testid": "address-form-province-view",
|
|
9069
|
-
children: (
|
|
9042
|
+
children: (_a = provinces.find(p => p.value === (data === null || data === void 0 ? void 0 : data.subdivisionCode))) === null || _a === void 0 ? void 0 : _a.label
|
|
9070
9043
|
})]
|
|
9071
9044
|
}), jsx(GoAFormItem, {
|
|
9072
9045
|
label: "Country",
|
|
@@ -9704,14 +9677,10 @@ const hasElements = schema => {
|
|
|
9704
9677
|
const isEmptyElements = schema => {
|
|
9705
9678
|
return 'elements' in schema && schema.elements !== undefined && schema.elements !== null && Object.keys(schema.elements).length === 0;
|
|
9706
9679
|
};
|
|
9707
|
-
const hasVariant = schema => {
|
|
9708
|
-
return 'options' in schema && schema.options !== undefined && schema.options !== null;
|
|
9709
|
-
};
|
|
9710
9680
|
|
|
9711
9681
|
const errCategorizationHasNonCategories = "Each element of 'Categorizations' must be of type 'Category'";
|
|
9712
9682
|
const errCategorizationHasNoElements = 'A Categorization must contain Categories.';
|
|
9713
9683
|
const errNoElements = type => `A ${type} must contain elements.`;
|
|
9714
|
-
const errCategorizationHasNoVariant = 'A Categorization must contain Options with a variant.';
|
|
9715
9684
|
const errMissingScope = 'A Control must have a scope';
|
|
9716
9685
|
const errMalformedScope = scope => `Scope ${scope} must be prefixed with '#/'.`;
|
|
9717
9686
|
const errUnknownScope = scope => `Failed to render: unknown scope ${scope}`;
|
|
@@ -9756,9 +9725,6 @@ const getUISchemaErrors = (uiSchema, schema) => {
|
|
|
9756
9725
|
if (!hasElements(uiSchema)) {
|
|
9757
9726
|
return errCategorizationHasNoElements;
|
|
9758
9727
|
}
|
|
9759
|
-
if (!hasVariant(uiSchema)) {
|
|
9760
|
-
return errCategorizationHasNoVariant;
|
|
9761
|
-
}
|
|
9762
9728
|
// ensure each element has type Category, and that each category
|
|
9763
9729
|
// has elements
|
|
9764
9730
|
if (isLayout(uiSchema)) {
|
|
@@ -9840,8 +9806,9 @@ const createDefaultAjv = (...schemas) => {
|
|
|
9840
9806
|
});
|
|
9841
9807
|
ajv.addSchema(schemas);
|
|
9842
9808
|
addErrors(ajv);
|
|
9843
|
-
ajv.addFormat('file-urn', /^urn:ads:platform:file-service:v[0-9]:\/files\/[a-zA-Z0-9.-]*$/);
|
|
9844
9809
|
addFormats(ajv);
|
|
9810
|
+
ajv.addFormat('file-urn', /^urn:ads:platform:file-service:v[0-9]:\/files\/[a-zA-Z0-9.-]*$/);
|
|
9811
|
+
ajv.addFormat('time', /^([01]\d|2[0-3]):[0-5]\d(:[0-5]\d)?$/);
|
|
9845
9812
|
return ajv;
|
|
9846
9813
|
};
|
|
9847
9814
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.56.1",
|
|
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",
|
|
@@ -2,7 +2,6 @@ import { JsonSchema, UISchemaElement } from '@jsonforms/core';
|
|
|
2
2
|
export declare const errCategorizationHasNonCategories = "Each element of 'Categorizations' must be of type 'Category'";
|
|
3
3
|
export declare const errCategorizationHasNoElements = "A Categorization must contain Categories.";
|
|
4
4
|
export declare const errNoElements: (type: string) => string;
|
|
5
|
-
export declare const errCategorizationHasNoVariant = "A Categorization must contain Options with a variant.";
|
|
6
5
|
export declare const errMissingScope = "A Control must have a scope";
|
|
7
6
|
export declare const errMalformedScope: (scope: string) => string;
|
|
8
7
|
export declare const errUnknownScope: (scope: string) => string;
|