@abgov/jsonforms-components 2.63.2 → 2.63.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 +86 -66
- package/package.json +1 -1
- package/renderer-catalog.json +2 -2
- package/src/lib/util/useSyncAutofillFields.d.ts +2 -1
package/index.esm.js
CHANGED
|
@@ -6818,7 +6818,7 @@ const JsonFormsStepperContextProvider = ({
|
|
|
6818
6818
|
children,
|
|
6819
6819
|
StepperProps
|
|
6820
6820
|
}) => {
|
|
6821
|
-
var _uischema$options3, _ctx$core2, _ctx$core3;
|
|
6821
|
+
var _uischema$options3, _ctx$core2, _ctx$core3, _ctx$core5;
|
|
6822
6822
|
const ctx = useJsonForms();
|
|
6823
6823
|
/* istanbul ignore next */
|
|
6824
6824
|
const {
|
|
@@ -6917,6 +6917,17 @@ const JsonFormsStepperContextProvider = ({
|
|
|
6917
6917
|
//eslint-disable-next-line
|
|
6918
6918
|
}, [stepperDispatch, stepperState, (_ctx$core3 = ctx.core) == null ? void 0 : _ctx$core3.errors, ajv, schema, data]);
|
|
6919
6919
|
/* istanbul ignore next */
|
|
6920
|
+
useEffect(() => {
|
|
6921
|
+
var _ctx$core$errors, _ctx$core4;
|
|
6922
|
+
stepperDispatch({
|
|
6923
|
+
type: 'validate/form',
|
|
6924
|
+
payload: {
|
|
6925
|
+
errors: (_ctx$core$errors = ctx == null || (_ctx$core4 = ctx.core) == null ? void 0 : _ctx$core4.errors) != null ? _ctx$core$errors : []
|
|
6926
|
+
}
|
|
6927
|
+
});
|
|
6928
|
+
//eslint-disable-next-line
|
|
6929
|
+
}, [ctx == null || (_ctx$core5 = ctx.core) == null ? void 0 : _ctx$core5.errors]);
|
|
6930
|
+
/* istanbul ignore next */
|
|
6920
6931
|
useEffect(() => {
|
|
6921
6932
|
const handleBeforeUnload = () => {
|
|
6922
6933
|
if (isCacheStatus) {
|
|
@@ -17721,6 +17732,7 @@ const NameInputs = ({
|
|
|
17721
17732
|
}) => {
|
|
17722
17733
|
var _displayedErrors$firs, _displayedErrors$last;
|
|
17723
17734
|
const [internalErrors, setInternalErrors] = useState({});
|
|
17735
|
+
const containerRef = useRef(null);
|
|
17724
17736
|
const currentValues = {
|
|
17725
17737
|
firstName,
|
|
17726
17738
|
middleName: middleName || '',
|
|
@@ -17729,8 +17741,8 @@ const NameInputs = ({
|
|
|
17729
17741
|
useEffect(() => {
|
|
17730
17742
|
const timeout = window.setTimeout(() => {
|
|
17731
17743
|
['firstName', 'middleName', 'lastName'].forEach(field => {
|
|
17732
|
-
var _input$value;
|
|
17733
|
-
const input =
|
|
17744
|
+
var _containerRef$current, _input$value;
|
|
17745
|
+
const input = (_containerRef$current = containerRef.current) == null ? void 0 : _containerRef$current.querySelector(`goa-input[name="${field}"]`);
|
|
17734
17746
|
const liveValue = (input == null || (_input$value = input.value) == null ? void 0 : _input$value.trim()) || '';
|
|
17735
17747
|
if (liveValue && !currentValues[field]) {
|
|
17736
17748
|
handleInputChange(field, liveValue);
|
|
@@ -17776,62 +17788,68 @@ const NameInputs = ({
|
|
|
17776
17788
|
handleRequiredFieldBlur(name);
|
|
17777
17789
|
}
|
|
17778
17790
|
};
|
|
17779
|
-
return
|
|
17780
|
-
|
|
17781
|
-
|
|
17782
|
-
|
|
17783
|
-
|
|
17784
|
-
children:
|
|
17785
|
-
|
|
17786
|
-
|
|
17787
|
-
|
|
17788
|
-
|
|
17789
|
-
children: jsx(
|
|
17790
|
-
|
|
17791
|
-
|
|
17792
|
-
|
|
17793
|
-
|
|
17794
|
-
|
|
17795
|
-
|
|
17796
|
-
|
|
17797
|
-
|
|
17798
|
-
|
|
17799
|
-
|
|
17800
|
-
|
|
17801
|
-
|
|
17802
|
-
|
|
17803
|
-
|
|
17804
|
-
|
|
17805
|
-
|
|
17806
|
-
|
|
17807
|
-
|
|
17808
|
-
|
|
17809
|
-
|
|
17810
|
-
|
|
17811
|
-
|
|
17812
|
-
|
|
17813
|
-
|
|
17814
|
-
|
|
17815
|
-
|
|
17816
|
-
|
|
17817
|
-
|
|
17818
|
-
|
|
17819
|
-
|
|
17820
|
-
|
|
17821
|
-
|
|
17822
|
-
|
|
17823
|
-
|
|
17824
|
-
|
|
17825
|
-
|
|
17826
|
-
|
|
17827
|
-
|
|
17828
|
-
|
|
17829
|
-
|
|
17830
|
-
|
|
17831
|
-
|
|
17832
|
-
|
|
17833
|
-
|
|
17834
|
-
|
|
17791
|
+
return jsx("div", {
|
|
17792
|
+
ref: containerRef,
|
|
17793
|
+
style: {
|
|
17794
|
+
display: 'contents'
|
|
17795
|
+
},
|
|
17796
|
+
children: jsxs(GoabGrid, {
|
|
17797
|
+
minChildWidth: "0ch",
|
|
17798
|
+
gap: "s",
|
|
17799
|
+
mb: "m",
|
|
17800
|
+
testId: "wrapper",
|
|
17801
|
+
children: [jsx(GoabFormItem, {
|
|
17802
|
+
testId: "form-item-first-name",
|
|
17803
|
+
label: "First name",
|
|
17804
|
+
requirement: requiredFields != null && requiredFields.includes('firstName') ? 'required' : undefined,
|
|
17805
|
+
error: (_displayedErrors$firs = displayedErrors == null ? void 0 : displayedErrors['firstName']) != null ? _displayedErrors$firs : '',
|
|
17806
|
+
children: jsx(GoabInput, {
|
|
17807
|
+
type: "text",
|
|
17808
|
+
name: "firstName",
|
|
17809
|
+
disabled: disabled,
|
|
17810
|
+
testId: "name-form-first-name",
|
|
17811
|
+
ariaLabel: 'name-form-first-name',
|
|
17812
|
+
value: firstName || '',
|
|
17813
|
+
onChange: detail => handleInputChange(detail.name, detail.value),
|
|
17814
|
+
onBlur: detail => {
|
|
17815
|
+
handleBlur(detail.name);
|
|
17816
|
+
},
|
|
17817
|
+
width: "100%"
|
|
17818
|
+
})
|
|
17819
|
+
}), jsx(GoabFormItem, {
|
|
17820
|
+
testId: "form-item-middle-name",
|
|
17821
|
+
label: "Middle name",
|
|
17822
|
+
requirement: requiredFields != null && requiredFields.includes('middleName') ? 'required' : undefined,
|
|
17823
|
+
children: jsx(GoabInput, {
|
|
17824
|
+
type: "text",
|
|
17825
|
+
name: "middleName",
|
|
17826
|
+
disabled: disabled,
|
|
17827
|
+
testId: "name-form-middle-name",
|
|
17828
|
+
ariaLabel: 'name-form-middle-name',
|
|
17829
|
+
value: middleName || '',
|
|
17830
|
+
onChange: detail => handleInputChange(detail.name, detail.value),
|
|
17831
|
+
width: "100%"
|
|
17832
|
+
})
|
|
17833
|
+
}), jsx(GoabFormItem, {
|
|
17834
|
+
testId: "form-item-last-name",
|
|
17835
|
+
label: "Last name",
|
|
17836
|
+
requirement: requiredFields != null && requiredFields.includes('lastName') ? 'required' : undefined,
|
|
17837
|
+
error: (_displayedErrors$last = displayedErrors == null ? void 0 : displayedErrors['lastName']) != null ? _displayedErrors$last : '',
|
|
17838
|
+
children: jsx(GoabInput, {
|
|
17839
|
+
type: "text",
|
|
17840
|
+
name: "lastName",
|
|
17841
|
+
disabled: disabled,
|
|
17842
|
+
testId: "name-form-last-name",
|
|
17843
|
+
ariaLabel: 'name-form-last-name',
|
|
17844
|
+
value: lastName || '',
|
|
17845
|
+
onChange: detail => handleInputChange(detail.name, detail.value),
|
|
17846
|
+
onBlur: detail => {
|
|
17847
|
+
handleBlur(detail.name);
|
|
17848
|
+
},
|
|
17849
|
+
width: "100%"
|
|
17850
|
+
})
|
|
17851
|
+
})]
|
|
17852
|
+
})
|
|
17835
17853
|
});
|
|
17836
17854
|
};
|
|
17837
17855
|
|
|
@@ -17972,14 +17990,16 @@ formData,
|
|
|
17972
17990
|
// eslint-disable-next-line
|
|
17973
17991
|
updateFormData,
|
|
17974
17992
|
// eslint-disable-next-line
|
|
17975
|
-
handleRequiredFieldBlur) {
|
|
17993
|
+
handleRequiredFieldBlur, rootRef) {
|
|
17976
17994
|
/* istanbul ignore next */
|
|
17977
17995
|
useEffect(() => {
|
|
17978
17996
|
const rAF = requestAnimationFrame(() => {
|
|
17979
17997
|
const timeout = setTimeout(() => {
|
|
17980
17998
|
const updated = {};
|
|
17981
17999
|
fields.forEach(field => {
|
|
17982
|
-
|
|
18000
|
+
var _rootRef$current;
|
|
18001
|
+
const root = (_rootRef$current = rootRef == null ? void 0 : rootRef.current) != null ? _rootRef$current : document;
|
|
18002
|
+
const input = root.querySelector(`goa-input[name="${field}"]`);
|
|
17983
18003
|
if (input && input.value && !(formData != null && formData[field])) {
|
|
17984
18004
|
updated[field] = input.value;
|
|
17985
18005
|
}
|
|
@@ -18049,9 +18069,9 @@ const FullNameDobControl = props => {
|
|
|
18049
18069
|
};
|
|
18050
18070
|
// eslint-disable-next-line
|
|
18051
18071
|
const handleRequiredFieldBlur = (name, updatedData) => {
|
|
18052
|
-
var _ref, _ref2, _updatedData$name,
|
|
18072
|
+
var _ref, _ref2, _updatedData$name, _controlRef$current;
|
|
18053
18073
|
const err = Object.assign({}, errors);
|
|
18054
|
-
const liveInputValue = (_ref = (_ref2 = (_updatedData$name = updatedData == null ? void 0 : updatedData[name]) != null ? _updatedData$name : data == null ? void 0 : data[name]) != null ? _ref2 : (
|
|
18074
|
+
const liveInputValue = (_ref = (_ref2 = (_updatedData$name = updatedData == null ? void 0 : updatedData[name]) != null ? _updatedData$name : data == null ? void 0 : data[name]) != null ? _ref2 : (_controlRef$current = controlRef.current) == null || (_controlRef$current = _controlRef$current.querySelector(`goa-input[name="${name}"]`)) == null ? void 0 : _controlRef$current.value) != null ? _ref : '';
|
|
18055
18075
|
if (requiredFields.includes(name) && liveInputValue.trim() === '') {
|
|
18056
18076
|
err[name] = `${getRequiredLabel(name)} is required`;
|
|
18057
18077
|
} else {
|
|
@@ -18059,10 +18079,10 @@ const FullNameDobControl = props => {
|
|
|
18059
18079
|
}
|
|
18060
18080
|
setErrors(err);
|
|
18061
18081
|
};
|
|
18062
|
-
useSyncAutofillFields(AUTOFILL_FIELDS, formData, updateFormData, handleRequiredFieldBlur);
|
|
18082
|
+
useSyncAutofillFields(AUTOFILL_FIELDS, formData, updateFormData, handleRequiredFieldBlur, controlRef);
|
|
18063
18083
|
useEffect(() => {
|
|
18064
|
-
var _controlRef$current$q, _controlRef$
|
|
18065
|
-
const host = (_controlRef$current$q = (_controlRef$
|
|
18084
|
+
var _controlRef$current$q, _controlRef$current2, _host$shadowRoot;
|
|
18085
|
+
const host = (_controlRef$current$q = (_controlRef$current2 = controlRef.current) == null ? void 0 : _controlRef$current2.querySelector('goa-input[type="date"]')) != null ? _controlRef$current$q : null;
|
|
18066
18086
|
host == null || (_host$shadowRoot = host.shadowRoot) == null || _host$shadowRoot.querySelector('input[type="date"]');
|
|
18067
18087
|
ensureGoaDatePointerCursor(host);
|
|
18068
18088
|
}, []);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "2.63.
|
|
3
|
+
"version": "2.63.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",
|
package/renderer-catalog.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "1.0.0",
|
|
3
|
-
"generatedAt": "2026-05-
|
|
4
|
-
"sourceCommit": "
|
|
3
|
+
"generatedAt": "2026-05-14T15:36:16.948Z",
|
|
4
|
+
"sourceCommit": "3aca8d4ad58ae957e3b91344397d636f8e1e3697",
|
|
5
5
|
"sourcePath": "libs/jsonforms-components/src/index.ts",
|
|
6
6
|
"rendererCount": 33,
|
|
7
7
|
"renderers": [
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
export declare function useSyncAutofillFields(fields: string[], formData: any, updateFormData: (data: any) => void, handleRequiredFieldBlur: (name: string, updatedData?: any) => void, rootRef?: RefObject<HTMLElement>): void;
|