@abgov/jsonforms-components 1.35.4 → 1.36.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
|
@@ -4,9 +4,9 @@ import { GoAFormItem, GoAInput, GoATextArea, GoACallout, GoAInputDate, GoAInputD
|
|
|
4
4
|
import styled from 'styled-components';
|
|
5
5
|
import axios from 'axios';
|
|
6
6
|
import get$1 from 'lodash/get';
|
|
7
|
-
import { rankWith, isStringControl, and, optionIs, uiTypeIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, isEnumControl, isBooleanControl, getAjv, isVisible, isEnabled, deriveLabelForUISchemaElement, schemaTypeIs, formatIs, createDefaultValue, Paths, or, isObjectArrayControl, isPrimitiveArrayControl,
|
|
7
|
+
import { rankWith, isStringControl, and, optionIs, uiTypeIs, isDateControl, isNumberControl, isIntegerControl, isDateTimeControl, isTimeControl, isEnumControl, isBooleanControl, getAjv, isVisible, isEnabled, deriveLabelForUISchemaElement, schemaTypeIs, formatIs, createDefaultValue, Paths, or, isObjectArrayControl, isPrimitiveArrayControl, isControl, isScoped, hasType, isCategorization, isLayout } from '@jsonforms/core';
|
|
8
8
|
import { withJsonFormsControlProps, withJsonFormsRendererProps, withJsonFormsEnumProps, withTranslateProps, useJsonForms, JsonFormsDispatch, withJsonFormsLayoutProps, withJsonFormsArrayLayoutProps, withJsonFormsCellProps } from '@jsonforms/react';
|
|
9
|
-
import { isEqual } from 'lodash';
|
|
9
|
+
import { isEqual, isObject as isObject$e } from 'lodash';
|
|
10
10
|
import merge from 'lodash/merge';
|
|
11
11
|
import isEmpty$1 from 'lodash/isEmpty';
|
|
12
12
|
import range from 'lodash/range';
|
|
@@ -7148,7 +7148,6 @@ const SearchBox = styled.div(_t$1 || (_t$1 = _$1`
|
|
|
7148
7148
|
`));
|
|
7149
7149
|
const LabelDiv = styled.div(_t2 || (_t2 = _$1`
|
|
7150
7150
|
font-size: var(--fs-sl);
|
|
7151
|
-
font-weight: var(--fw-bold);
|
|
7152
7151
|
padding-bottom: 1.5rem;
|
|
7153
7152
|
`));
|
|
7154
7153
|
|
|
@@ -7719,7 +7718,7 @@ const AddressLookUpControl = props => {
|
|
|
7719
7718
|
setErrors({});
|
|
7720
7719
|
};
|
|
7721
7720
|
const handleRequiredFieldBlur = name => {
|
|
7722
|
-
if ((!(data === null || data === void 0 ? void 0 : data[name]) || (data === null || data === void 0 ? void 0 : data[name]) === '') && requiredFields.includes(name)) {
|
|
7721
|
+
if ((!(data === null || data === void 0 ? void 0 : data[name]) || (data === null || data === void 0 ? void 0 : data[name]) === '') && (requiredFields === null || requiredFields === void 0 ? void 0 : requiredFields.includes(name))) {
|
|
7723
7722
|
const err = Object.assign({}, errors);
|
|
7724
7723
|
err[name] = name === 'municipality' ? `city is required` : `${name} is required`;
|
|
7725
7724
|
setErrors(err);
|
|
@@ -7766,7 +7765,29 @@ const AddressLookUpControl = props => {
|
|
|
7766
7765
|
});
|
|
7767
7766
|
};
|
|
7768
7767
|
|
|
7769
|
-
const
|
|
7768
|
+
const isAddressSchema = obj => {
|
|
7769
|
+
if (isObject$e(obj)) {
|
|
7770
|
+
const keys = Object.keys(obj);
|
|
7771
|
+
return ['addressLine2', 'municipality', 'addressLine1', 'subdivisionCode', 'postalCode'].every(attr => keys.includes(attr));
|
|
7772
|
+
}
|
|
7773
|
+
return false;
|
|
7774
|
+
};
|
|
7775
|
+
const isAddressLookup = (uischema, schema, context) => {
|
|
7776
|
+
if (!isControl(uischema) || !isScoped(uischema)) {
|
|
7777
|
+
return false;
|
|
7778
|
+
}
|
|
7779
|
+
if ((schema === null || schema === void 0 ? void 0 : schema.properties) && isObject$e(schema === null || schema === void 0 ? void 0 : schema.properties)) {
|
|
7780
|
+
const propertyFromScope = uischema['scope'].split('/').pop();
|
|
7781
|
+
if (isObject$e(schema.properties[propertyFromScope]) && 'properties' in schema.properties[propertyFromScope]) {
|
|
7782
|
+
const objToTest = schema.properties[propertyFromScope]['properties'];
|
|
7783
|
+
if (objToTest && isAddressSchema(objToTest)) {
|
|
7784
|
+
return true;
|
|
7785
|
+
}
|
|
7786
|
+
}
|
|
7787
|
+
}
|
|
7788
|
+
return false;
|
|
7789
|
+
};
|
|
7790
|
+
const AddressLookUpTester = rankWith(3, isAddressLookup);
|
|
7770
7791
|
|
|
7771
7792
|
const GoATextCell = props => jsx(GoAInputText, Object.assign({}, props));
|
|
7772
7793
|
const GoATextCellTester = rankWith(1, isStringControl);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.36.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,2 +1,3 @@
|
|
|
1
|
-
import { RankedTester } from '@jsonforms/core';
|
|
1
|
+
import { RankedTester, UISchemaElement, JsonSchema, TesterContext } from '@jsonforms/core';
|
|
2
|
+
export declare const isAddressLookup: (uischema: UISchemaElement, schema: JsonSchema, context: TesterContext) => boolean;
|
|
2
3
|
export declare const AddressLookUpTester: RankedTester;
|