@abgov/jsonforms-components 2.70.3 → 2.71.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 +786 -646
- package/package.json +1 -1
- package/renderer-catalog.json +2 -2
- package/src/lib/Context/ContextProvider.d.ts +8 -0
- package/src/lib/Controls/FormStepper/context/util.d.ts +7 -0
- package/src/lib/Controls/FullName/FullNameInputs.d.ts +2 -0
- package/src/lib/util/useDebouncedCommit.d.ts +37 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.71.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",
|
package/renderer-catalog.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "1.0.0",
|
|
3
|
-
"generatedAt": "2026-
|
|
4
|
-
"sourceCommit": "
|
|
3
|
+
"generatedAt": "2026-08-04T16:45:42.802Z",
|
|
4
|
+
"sourceCommit": "a30b2d185c20480fc9d22daa6bcd39656cb4085e",
|
|
5
5
|
"sourcePath": "libs/jsonforms-components/src/index.ts",
|
|
6
6
|
"rendererCount": 33,
|
|
7
7
|
"renderers": [
|
|
@@ -24,6 +24,10 @@ interface SubmitManagement {
|
|
|
24
24
|
submitForm?: (any: any) => void;
|
|
25
25
|
saveForm?: (any: any) => void;
|
|
26
26
|
}
|
|
27
|
+
export interface AutoPopulatedValue {
|
|
28
|
+
path: string;
|
|
29
|
+
value: unknown;
|
|
30
|
+
}
|
|
27
31
|
type Props = {
|
|
28
32
|
children?: React.ReactNode;
|
|
29
33
|
fileManagement?: FileManagement;
|
|
@@ -31,6 +35,8 @@ type Props = {
|
|
|
31
35
|
isFormSubmitted?: boolean;
|
|
32
36
|
data?: any;
|
|
33
37
|
formUrl?: string | null | undefined;
|
|
38
|
+
autoPopulatedData?: AutoPopulatedValue[];
|
|
39
|
+
formId?: string;
|
|
34
40
|
};
|
|
35
41
|
export declare class ContextProviderClass {
|
|
36
42
|
selfProps: Props | undefined;
|
|
@@ -48,6 +54,8 @@ export declare class ContextProviderClass {
|
|
|
48
54
|
getAllFormContextData: () => AllData;
|
|
49
55
|
isFormSubmitted?: boolean;
|
|
50
56
|
formUrl: string | null | undefined;
|
|
57
|
+
autoPopulatedData?: AutoPopulatedValue[];
|
|
58
|
+
formId?: string;
|
|
51
59
|
};
|
|
52
60
|
addFormContextData: (key: string, data: Record<string, unknown> | unknown[]) => void;
|
|
53
61
|
addDataByUrl(key: string, url: string, processDataFunction: (data: object) => string[], token?: string): Promise<void>;
|
|
@@ -4,6 +4,10 @@ import { StepStatusData } from './types';
|
|
|
4
4
|
export declare function hasMeaningfulValue(val: any): boolean;
|
|
5
5
|
export declare function isScopeRequired(normalizedScopes: string[], required: string[]): boolean;
|
|
6
6
|
export declare function hasValueAtScope(data: any, scope: string): boolean;
|
|
7
|
+
export interface AutoPopulatedPathValue {
|
|
8
|
+
path: string;
|
|
9
|
+
value: unknown;
|
|
10
|
+
}
|
|
7
11
|
export declare function getStepStatus(opts: {
|
|
8
12
|
scopes: string[];
|
|
9
13
|
data: any;
|
|
@@ -11,6 +15,7 @@ export declare function getStepStatus(opts: {
|
|
|
11
15
|
schema: JsonSchema;
|
|
12
16
|
visited?: boolean;
|
|
13
17
|
autoPopulatedScopes?: string[];
|
|
18
|
+
autoPopulatedValues?: AutoPopulatedPathValue[];
|
|
14
19
|
}): StepStatusData;
|
|
15
20
|
export declare const isErrorPathIncluded: (errorPaths: string[], path: string) => boolean;
|
|
16
21
|
type AjvError = ErrorObject & {
|
|
@@ -22,6 +27,8 @@ export declare function getIncompletePaths(errors: AjvError[] | null | undefined
|
|
|
22
27
|
export declare const subErrorInParent: (error: ErrorObject, paths: string[]) => boolean;
|
|
23
28
|
export declare const getErrorsInScopes: (errors: ErrorObject[] | null | undefined, scopes: string[]) => ErrorObject[];
|
|
24
29
|
export declare const hasDataInScopes: (data: object, scopes: string[]) => boolean;
|
|
30
|
+
export declare const saveVisitedSteps: (formId: string | undefined, ids: number[]) => void;
|
|
31
|
+
export declare const getVisitedSteps: (formId: string | undefined) => number[] | undefined;
|
|
25
32
|
export declare function isJson(str: string): boolean;
|
|
26
33
|
export declare const saveIsVisitFromLocalStorage: (status: boolean[]) => void;
|
|
27
34
|
export declare const getIsVisitFromLocalStorage: () => boolean[] | undefined;
|
|
@@ -9,6 +9,8 @@ interface NameInputsProps {
|
|
|
9
9
|
requiredFields?: string[];
|
|
10
10
|
errors?: Record<string, string>;
|
|
11
11
|
onFieldBlur?: (name: string) => void;
|
|
12
|
+
/** Called whenever a field loses focus, so the owner can push pending edits without waiting out the debounce. */
|
|
13
|
+
onFieldCommit?: () => void;
|
|
12
14
|
handleInputChange: (field: string, value: string) => void;
|
|
13
15
|
}
|
|
14
16
|
export declare const NameInputs: React.FC<NameInputsProps>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const COMMIT_DELAY = 300;
|
|
2
|
+
export interface SetValueOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Whether the edit should be pushed upstream once typing stops. Pass false for a field whose
|
|
5
|
+
* owner commits on its own schedule; the value is still mirrored and still protected from
|
|
6
|
+
* incoming data until something calls flush.
|
|
7
|
+
*/
|
|
8
|
+
autoCommit?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface DebouncedCommit<T> {
|
|
11
|
+
/** The live value to bind to the input; updated on every keystroke. */
|
|
12
|
+
value: T;
|
|
13
|
+
/** Records a keystroke and, unless told otherwise, schedules the commit. */
|
|
14
|
+
setValue: (next: T, options?: SetValueOptions) => void;
|
|
15
|
+
/** Commits straight away, for events that are not typing (blur, selecting a suggestion, unmount). */
|
|
16
|
+
flush: () => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Keeps a live, per-keystroke mirror of a control's value and pushes it into the form data only
|
|
20
|
+
* once the user pauses typing.
|
|
21
|
+
*
|
|
22
|
+
* The GoA web components keep the value in their own DOM and report changes back a macrotask
|
|
23
|
+
* late, while their update path writes an incoming `value` prop straight back into the field
|
|
24
|
+
* whenever it differs from what is in the box. So a render that commits a value older than what
|
|
25
|
+
* has been typed since wipes out the characters in between. Committing on every keystroke
|
|
26
|
+
* re-renders and revalidates the whole form, which makes that window wide enough to swallow
|
|
27
|
+
* characters; debouncing the commit keeps it to a single local render.
|
|
28
|
+
*
|
|
29
|
+
* The echo of our own commit is ignored while further edits are outstanding, so data arriving
|
|
30
|
+
* back from the form can never overwrite what the user has typed in the meantime.
|
|
31
|
+
*
|
|
32
|
+
* @param externalValue the value held in the form data; must be referentially stable between
|
|
33
|
+
* renders (memoize it when it is an object), otherwise the sync effect runs on every render
|
|
34
|
+
* @param commit pushes a settled value into the form data
|
|
35
|
+
* @param delay how long to wait for typing to stop before committing
|
|
36
|
+
*/
|
|
37
|
+
export declare function useDebouncedCommit<T>(externalValue: T, commit: (value: T) => void, delay?: number): DebouncedCommit<T>;
|