@abgov/jsonforms-components 1.41.5 → 1.42.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
CHANGED
|
@@ -2341,6 +2341,9 @@ fixRegExpWellKnownSymbolLogic$1('replace', function (_, nativeReplace, maybeCall
|
|
|
2341
2341
|
];
|
|
2342
2342
|
}, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
|
|
2343
2343
|
|
|
2344
|
+
const sinTitle = 'Social insurance number';
|
|
2345
|
+
const invalidSin = 'Social insurance number is invalid';
|
|
2346
|
+
|
|
2344
2347
|
/**
|
|
2345
2348
|
* Sets the first word to be capitalized so that it is sentence cased.
|
|
2346
2349
|
* @param words
|
|
@@ -2422,10 +2425,10 @@ const checkFieldValidity = props => {
|
|
|
2422
2425
|
} = props;
|
|
2423
2426
|
const labelToUpdate = getLabelText(uischema.scope, label);
|
|
2424
2427
|
const extraSchema = schema;
|
|
2425
|
-
if (extraSchema && data && (extraSchema === null || extraSchema === void 0 ? void 0 : extraSchema.title) ===
|
|
2428
|
+
if (extraSchema && data && (extraSchema === null || extraSchema === void 0 ? void 0 : extraSchema.title) === sinTitle) {
|
|
2426
2429
|
if (data.length === 11 && !validateSinWithLuhn(data)) {
|
|
2427
|
-
return '
|
|
2428
|
-
} else if (data.length < 11) {
|
|
2430
|
+
return data === '' ? '' : invalidSin;
|
|
2431
|
+
} else if (data.length > 0 && data.length < 11) {
|
|
2429
2432
|
return extraSchema.errorMessage;
|
|
2430
2433
|
}
|
|
2431
2434
|
}
|
|
@@ -3822,7 +3825,7 @@ const GoAInputText = props => {
|
|
|
3822
3825
|
const appliedUiSchemaOptions = Object.assign(Object.assign({}, config), uischema === null || uischema === void 0 ? void 0 : uischema.options);
|
|
3823
3826
|
const placeholder = (appliedUiSchemaOptions === null || appliedUiSchemaOptions === void 0 ? void 0 : appliedUiSchemaOptions.placeholder) || (schema === null || schema === void 0 ? void 0 : schema.description) || '';
|
|
3824
3827
|
const errorsFormInput = checkFieldValidity(props);
|
|
3825
|
-
const isSinField = schema.title ===
|
|
3828
|
+
const isSinField = schema.title === sinTitle;
|
|
3826
3829
|
const autoCapitalize = ((_b = (_a = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _a === void 0 ? void 0 : _a.componentProps) === null || _b === void 0 ? void 0 : _b.autoCapitalize) === true || ((_c = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _c === void 0 ? void 0 : _c.autoCapitalize) === true;
|
|
3827
3830
|
const readOnly = (_f = (_e = (_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.componentProps) === null || _e === void 0 ? void 0 : _e.readOnly) !== null && _f !== void 0 ? _f : false;
|
|
3828
3831
|
return jsx(GoAInput, Object.assign({
|
|
@@ -3843,7 +3846,7 @@ const GoAInputText = props => {
|
|
|
3843
3846
|
// side effect that causes the validation to render when it shouldn't.
|
|
3844
3847
|
onChange: (name, value) => {
|
|
3845
3848
|
let formattedValue = value;
|
|
3846
|
-
if (schema && schema.title ===
|
|
3849
|
+
if (schema && schema.title === sinTitle && value !== '') {
|
|
3847
3850
|
formattedValue = formatSin(value);
|
|
3848
3851
|
}
|
|
3849
3852
|
onChangeForInputControl({
|
|
@@ -5513,10 +5516,11 @@ const RenderStepElements = props => {
|
|
|
5513
5516
|
);
|
|
5514
5517
|
};
|
|
5515
5518
|
|
|
5519
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5516
5520
|
const validateData = (jsonSchema, data, ajv) => {
|
|
5517
5521
|
const newSchema = JSON.parse(JSON.stringify(jsonSchema));
|
|
5518
5522
|
Object.keys(newSchema.properties || {}).forEach(propertyName => {
|
|
5519
|
-
var _a, _b, _c, _d;
|
|
5523
|
+
var _a, _b, _c, _d, _e;
|
|
5520
5524
|
const property = newSchema.properties || {};
|
|
5521
5525
|
if (((_a = property[propertyName]) === null || _a === void 0 ? void 0 : _a.enum) && ((_b = property[propertyName]) === null || _b === void 0 ? void 0 : _b.enum[0]) === '') {
|
|
5522
5526
|
(_c = property[propertyName]) === null || _c === void 0 ? true : delete _c.enum;
|
|
@@ -5524,6 +5528,9 @@ const validateData = (jsonSchema, data, ajv) => {
|
|
|
5524
5528
|
if (((_d = property[propertyName]) === null || _d === void 0 ? void 0 : _d.format) === 'file-urn') {
|
|
5525
5529
|
delete property[propertyName].format;
|
|
5526
5530
|
}
|
|
5531
|
+
if (((_e = property[propertyName]) === null || _e === void 0 ? void 0 : _e.title) === sinTitle && data && data[propertyName] === '') {
|
|
5532
|
+
delete data[propertyName];
|
|
5533
|
+
}
|
|
5527
5534
|
});
|
|
5528
5535
|
try {
|
|
5529
5536
|
const validate = ajv.compile(newSchema);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.42.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",
|