@resistdesign/voltra 3.0.0-alpha.32 → 3.0.0-alpha.34
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/README.md +72 -2
- package/api/Indexing/fulltext/FullTextDdbBackend.d.ts +5 -3
- package/api/Indexing/index.d.ts +3 -3
- package/api/Indexing/rel/Handlers.d.ts +3 -2
- package/api/ORM/drivers/index.d.ts +1 -1
- package/api/ORM/index.d.ts +2 -11
- package/api/index.js +114 -99
- package/app/forms/Engine.d.ts +3 -0
- package/app/forms/UI.d.ts +7 -1
- package/app/forms/core/createAutoField.d.ts +11 -3
- package/app/forms/core/createFormRenderer.d.ts +3 -2
- package/app/forms/core/mergeSuites.d.ts +3 -2
- package/app/forms/core/resolveSuite.d.ts +2 -1
- package/app/forms/core/types.d.ts +20 -9
- package/app/forms/index.d.ts +1 -2
- package/app/forms/types.d.ts +36 -55
- package/app/index.js +22 -14
- package/app/utils/ApplicationState.d.ts +1 -1
- package/app/utils/Route.d.ts +3 -3
- package/build/index.js +4 -4
- package/chunk-4PV5LPTT.js +1144 -0
- package/chunk-7AMEFPPP.js +78 -0
- package/{chunk-FQMZMCXU.js → chunk-RUVFOXCR.js} +1 -1
- package/chunk-TJFTWPXQ.js +39 -0
- package/{chunk-LGM75I6P.js → chunk-WTD5BBJP.js} +223 -38
- package/common/ItemRelationships/ItemRelationshipValidation.d.ts +1 -1
- package/common/ItemRelationships/index.d.ts +1 -5
- package/common/Logging/Utils.d.ts +0 -9
- package/common/TypeInfoORM/index.d.ts +2 -10
- package/common/TypeParsing/TypeInfo.d.ts +20 -0
- package/common/TypeParsing/Validation.d.ts +152 -22
- package/common/index.d.ts +2 -12
- package/common/index.js +21 -9
- package/iac/packs/auth.d.ts +10 -4
- package/iac-packs/index.d.ts +1 -0
- package/native/forms/UI.d.ts +8 -2
- package/native/forms/createNativeFormRenderer.d.ts +1 -1
- package/native/forms/index.d.ts +16 -0
- package/native/forms/suite.d.ts +1 -1
- package/native/index.js +71 -40
- package/native/testing/react-native.d.ts +33 -15
- package/native/utils/index.d.ts +13 -1
- package/package.json +1 -1
- package/web/forms/UI.d.ts +8 -2
- package/web/forms/createWebFormRenderer.d.ts +1 -1
- package/web/forms/suite.d.ts +1 -1
- package/web/index.js +234 -113
- package/web/utils/Route.d.ts +9 -3
- package/web/utils/index.d.ts +1 -0
- package/chunk-G5CLUK4Y.js +0 -621
- package/chunk-HVY7POTD.js +0 -22
- package/chunk-IWRHGGGH.js +0 -10
- package/chunk-MUCSL3UR.js +0 -1
- package/chunk-WELZGQDJ.js +0 -456
package/app/forms/Engine.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { TypeInfo } from "../../common/TypeParsing/TypeInfo";
|
|
7
7
|
import { TypeOperation } from "../../common/TypeParsing/TypeInfo";
|
|
8
|
+
import { type FieldValueValidatorMap } from "../../common/TypeParsing/Validation";
|
|
8
9
|
import type { FormController, FormValues } from "./types";
|
|
9
10
|
/**
|
|
10
11
|
* Hook that derives form state and field controllers from type metadata.
|
|
@@ -17,4 +18,6 @@ import type { FormController, FormValues } from "./types";
|
|
|
17
18
|
export declare const useFormEngine: (initialValues: FormValues | undefined, typeInfo: TypeInfo, options?: {
|
|
18
19
|
/** Operation to evaluate when deriving field state. */
|
|
19
20
|
operation?: TypeOperation;
|
|
21
|
+
/** Optional custom validators keyed by field name. */
|
|
22
|
+
customValidatorMap?: FieldValueValidatorMap;
|
|
20
23
|
}) => FormController;
|
package/app/forms/UI.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { FC } from "react";
|
|
7
7
|
import type { ReactElement } from "react";
|
|
8
8
|
import type { TypeInfo, TypeOperation } from "../../common/TypeParsing/TypeInfo";
|
|
9
|
-
import type { AutoFieldProps, CustomTypeActionPayload, FormController, FormValues, RelationActionPayload } from "./types";
|
|
9
|
+
import type { AutoFieldProps, CustomValidatorMap, CustomTypeActionPayload, FormController, FormValues, RelationActionPayload, TranslateValidationErrorCode } from "./types";
|
|
10
10
|
import type { ResolvedSuite } from "./core/types";
|
|
11
11
|
/**
|
|
12
12
|
* Renderer contract used by shared AutoForm components.
|
|
@@ -33,6 +33,8 @@ export interface AutoFormViewProps {
|
|
|
33
33
|
onRelationAction?: (payload: RelationActionPayload) => void;
|
|
34
34
|
/** Optional custom type action handler. */
|
|
35
35
|
onCustomTypeAction?: (payload: CustomTypeActionPayload) => void;
|
|
36
|
+
/** Optional translator for validation error descriptors. */
|
|
37
|
+
translateValidationErrorCode?: TranslateValidationErrorCode;
|
|
36
38
|
}
|
|
37
39
|
/**
|
|
38
40
|
* Render a form UI from a prepared form controller.
|
|
@@ -63,6 +65,10 @@ export interface AutoFormProps {
|
|
|
63
65
|
operation?: TypeOperation;
|
|
64
66
|
/** Disable the submit button when true. */
|
|
65
67
|
submitDisabled?: boolean;
|
|
68
|
+
/** Optional translator for validation error descriptors. */
|
|
69
|
+
translateValidationErrorCode?: TranslateValidationErrorCode;
|
|
70
|
+
/** Optional custom validators keyed by field name. */
|
|
71
|
+
customValidatorMap?: CustomValidatorMap;
|
|
66
72
|
}
|
|
67
73
|
/**
|
|
68
74
|
* Build a controller from type metadata and render an auto form.
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Factory for AutoField that delegates rendering to a resolved suite.
|
|
5
5
|
*/
|
|
6
|
+
import { type FC, type ReactElement } from "react";
|
|
6
7
|
import type { TypeInfoField } from "../../../common/TypeParsing/TypeInfo";
|
|
8
|
+
import { type ErrorDescriptor, type ArrayItemErrorMap } from "../../../common/TypeParsing/Validation";
|
|
7
9
|
import type { CustomTypeActionPayload, FieldValue, RelationActionPayload, ResolvedSuite } from "./types";
|
|
8
10
|
/**
|
|
9
11
|
* Input props for AutoField render delegation.
|
|
@@ -17,8 +19,14 @@ export type AutoFieldInput = {
|
|
|
17
19
|
value: FieldValue | undefined;
|
|
18
20
|
/** Change handler for the field value. */
|
|
19
21
|
onChange: (value: FieldValue) => void;
|
|
20
|
-
/** Optional error
|
|
21
|
-
error?:
|
|
22
|
+
/** Optional error descriptor to display under the field. */
|
|
23
|
+
error?: ErrorDescriptor;
|
|
24
|
+
/** Optional value-level errors for the field. */
|
|
25
|
+
errors?: ErrorDescriptor[];
|
|
26
|
+
/** Optional per-index errors for array fields. */
|
|
27
|
+
arrayItemErrorMap?: ArrayItemErrorMap;
|
|
28
|
+
/** Optional translator for validation error descriptors. */
|
|
29
|
+
translateValidationErrorCode?: (error: ErrorDescriptor) => string;
|
|
22
30
|
/** Disables the field UI when true. */
|
|
23
31
|
disabled?: boolean;
|
|
24
32
|
/** Optional callback for relation actions. */
|
|
@@ -32,4 +40,4 @@ export type AutoFieldInput = {
|
|
|
32
40
|
* @param suite - Resolved component suite.
|
|
33
41
|
* @returns AutoField renderer function.
|
|
34
42
|
*/
|
|
35
|
-
export declare const createAutoField: <RenderOutput =
|
|
43
|
+
export declare const createAutoField: <RenderOutput = ReactElement>(suite: ResolvedSuite<RenderOutput>) => FC<AutoFieldInput>;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Factory for building form renderers backed by component suites.
|
|
5
5
|
*/
|
|
6
|
+
import type { ReactElement } from "react";
|
|
6
7
|
import type { ResolvedSuite, ComponentSuite } from "./types";
|
|
7
8
|
import { type AutoFieldInput } from "./createAutoField";
|
|
8
9
|
/**
|
|
@@ -11,11 +12,11 @@ import { type AutoFieldInput } from "./createAutoField";
|
|
|
11
12
|
* @param options - Suite configuration.
|
|
12
13
|
* @returns Renderer helpers tied to resolved suites.
|
|
13
14
|
*/
|
|
14
|
-
export declare const createFormRenderer: <RenderOutput =
|
|
15
|
+
export declare const createFormRenderer: <RenderOutput = ReactElement>(options: {
|
|
15
16
|
fallbackSuite: ComponentSuite<RenderOutput>;
|
|
16
17
|
suite?: ComponentSuite<RenderOutput>;
|
|
17
18
|
}) => {
|
|
18
|
-
AutoField: (
|
|
19
|
+
AutoField: import("react").FC<AutoFieldInput>;
|
|
19
20
|
suite: ResolvedSuite<RenderOutput>;
|
|
20
21
|
};
|
|
21
22
|
/**
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Helpers for composing component suites.
|
|
5
5
|
*/
|
|
6
|
+
import type { ReactElement } from "react";
|
|
6
7
|
import type { ComponentSuite, FieldKind, FieldRenderer } from "./types";
|
|
7
8
|
/**
|
|
8
9
|
* Deep-merge component suites, allowing overrides for renderers and primitives.
|
|
@@ -11,7 +12,7 @@ import type { ComponentSuite, FieldKind, FieldRenderer } from "./types";
|
|
|
11
12
|
* @param overrides - Partial suite overrides.
|
|
12
13
|
* @returns Merged suite.
|
|
13
14
|
*/
|
|
14
|
-
export declare const mergeSuites: <RenderOutput =
|
|
15
|
+
export declare const mergeSuites: <RenderOutput = ReactElement>(base: ComponentSuite<RenderOutput>, overrides: ComponentSuite<RenderOutput>) => ComponentSuite<RenderOutput>;
|
|
15
16
|
/**
|
|
16
17
|
* Convenience helper to override a single renderer.
|
|
17
18
|
*
|
|
@@ -19,4 +20,4 @@ export declare const mergeSuites: <RenderOutput = unknown>(base: ComponentSuite<
|
|
|
19
20
|
* @param renderer - Replacement renderer.
|
|
20
21
|
* @returns Suite with renderer override.
|
|
21
22
|
*/
|
|
22
|
-
export declare const withRendererOverride: <RenderOutput =
|
|
23
|
+
export declare const withRendererOverride: <RenderOutput = ReactElement>(kind: FieldKind, renderer: FieldRenderer<RenderOutput>) => ComponentSuite<RenderOutput>;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Resolve a component suite by merging overrides with fallback defaults.
|
|
5
5
|
*/
|
|
6
|
+
import type { ReactElement } from "react";
|
|
6
7
|
import type { ComponentSuite, ResolvedSuite } from "./types";
|
|
7
8
|
/**
|
|
8
9
|
* Merge a fallback suite with overrides and ensure completeness.
|
|
@@ -11,4 +12,4 @@ import type { ComponentSuite, ResolvedSuite } from "./types";
|
|
|
11
12
|
* @param fallback - Default suite providing full coverage.
|
|
12
13
|
* @returns Fully resolved suite with all renderers present.
|
|
13
14
|
*/
|
|
14
|
-
export declare const resolveSuite: <RenderOutput =
|
|
15
|
+
export declare const resolveSuite: <RenderOutput = ReactElement>(overrides: ComponentSuite<RenderOutput> | undefined, fallback: ComponentSuite<RenderOutput>) => ResolvedSuite<RenderOutput>;
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Core, platform-agnostic types for form rendering.
|
|
5
5
|
*/
|
|
6
|
+
import type { ComponentType, ReactElement } from "react";
|
|
6
7
|
import type { LiteralValue, TypeInfoDataItem, TypeInfoField } from "../../../common/TypeParsing/TypeInfo";
|
|
8
|
+
import type { ArrayItemErrorMap, ErrorDescriptor } from "../../../common/TypeParsing/Validation";
|
|
7
9
|
import type { ItemRelationshipInfoType } from "../../../common/ItemRelationshipInfoTypes";
|
|
8
10
|
/**
|
|
9
11
|
* Supported field kinds for renderer selection.
|
|
@@ -77,8 +79,14 @@ export type FieldRenderContext<RenderOutput = unknown> = {
|
|
|
77
79
|
required: boolean;
|
|
78
80
|
/** True when the field UI should be disabled. */
|
|
79
81
|
disabled: boolean;
|
|
80
|
-
/** Optional error
|
|
81
|
-
error?:
|
|
82
|
+
/** Optional error descriptor to display under the field. */
|
|
83
|
+
error?: ErrorDescriptor;
|
|
84
|
+
/** Optional value-level errors for the field. */
|
|
85
|
+
errors?: ErrorDescriptor[];
|
|
86
|
+
/** Optional per-index errors for array fields. */
|
|
87
|
+
arrayItemErrorMap?: ArrayItemErrorMap;
|
|
88
|
+
/** Translate an error descriptor to a user-facing message. */
|
|
89
|
+
translateValidationErrorCode: (error: ErrorDescriptor) => string;
|
|
82
90
|
/** Current value for the field. */
|
|
83
91
|
value: FieldValue | undefined;
|
|
84
92
|
/** Change handler for the field value. */
|
|
@@ -103,24 +111,27 @@ export type FieldRenderContext<RenderOutput = unknown> = {
|
|
|
103
111
|
fieldKey: string;
|
|
104
112
|
value: FieldValue | undefined;
|
|
105
113
|
onChange: (value: FieldValue) => void;
|
|
106
|
-
error?:
|
|
114
|
+
error?: ErrorDescriptor;
|
|
115
|
+
errors?: ErrorDescriptor[];
|
|
116
|
+
arrayItemErrorMap?: ArrayItemErrorMap;
|
|
117
|
+
translateValidationErrorCode?: (error: ErrorDescriptor) => string;
|
|
107
118
|
disabled?: boolean;
|
|
108
119
|
onRelationAction?: (payload: RelationActionPayload) => void;
|
|
109
120
|
onCustomTypeAction?: (payload: CustomTypeActionPayload) => void;
|
|
110
121
|
}) => RenderOutput;
|
|
111
122
|
};
|
|
112
123
|
/**
|
|
113
|
-
* Renderer
|
|
124
|
+
* Renderer component for a single field kind.
|
|
114
125
|
*/
|
|
115
|
-
export type FieldRenderer<RenderOutput =
|
|
126
|
+
export type FieldRenderer<RenderOutput = ReactElement> = ComponentType<FieldRenderContext<RenderOutput>>;
|
|
116
127
|
/**
|
|
117
128
|
* Optional primitive component contract for suites.
|
|
118
129
|
*/
|
|
119
|
-
export type PrimitiveComponent<Props, RenderOutput =
|
|
130
|
+
export type PrimitiveComponent<Props, RenderOutput = ReactElement> = (props: Props) => RenderOutput;
|
|
120
131
|
/**
|
|
121
132
|
* Primitive components that suites may override.
|
|
122
133
|
*/
|
|
123
|
-
export type PrimitiveComponents<RenderOutput =
|
|
134
|
+
export type PrimitiveComponents<RenderOutput = ReactElement> = {
|
|
124
135
|
/** Root container for the form view. */
|
|
125
136
|
FormRoot: PrimitiveComponent<{
|
|
126
137
|
children: RenderOutput;
|
|
@@ -151,7 +162,7 @@ export type PrimitiveComponents<RenderOutput = unknown> = {
|
|
|
151
162
|
/**
|
|
152
163
|
* Suite definition with optional renderers/primitives.
|
|
153
164
|
*/
|
|
154
|
-
export type ComponentSuite<RenderOutput =
|
|
165
|
+
export type ComponentSuite<RenderOutput = ReactElement> = {
|
|
155
166
|
/** Field renderers keyed by kind. */
|
|
156
167
|
renderers: Partial<Record<FieldKind, FieldRenderer<RenderOutput>>>;
|
|
157
168
|
/** Optional primitive component overrides. */
|
|
@@ -160,7 +171,7 @@ export type ComponentSuite<RenderOutput = unknown> = {
|
|
|
160
171
|
/**
|
|
161
172
|
* Fully resolved suite with required renderers.
|
|
162
173
|
*/
|
|
163
|
-
export type ResolvedSuite<RenderOutput =
|
|
174
|
+
export type ResolvedSuite<RenderOutput = ReactElement> = {
|
|
164
175
|
/** Field renderers keyed by kind. */
|
|
165
176
|
renderers: Record<FieldKind, FieldRenderer<RenderOutput>>;
|
|
166
177
|
/** Optional primitive component overrides. */
|
package/app/forms/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* Form generation module.
|
|
5
5
|
*/
|
|
6
6
|
export * from "./types";
|
|
7
|
-
export
|
|
8
|
-
export { createAutoField, createFormRenderer, getFieldKind, mergeSuites, resolveSuite, withRendererOverride, } from "./core";
|
|
7
|
+
export * from "./core";
|
|
9
8
|
export * from "./Engine";
|
|
10
9
|
export * from "./UI";
|
package/app/forms/types.d.ts
CHANGED
|
@@ -4,7 +4,17 @@
|
|
|
4
4
|
* Types for the form generation system.
|
|
5
5
|
*/
|
|
6
6
|
import type { TypeInfo, TypeInfoDataItem, TypeInfoField, TypeOperation } from "../../common/TypeParsing/TypeInfo";
|
|
7
|
-
import type {
|
|
7
|
+
import type { ArrayErrorDescriptorCollection, ArrayItemErrorMap, ErrorDescriptor, FieldValueValidatorMap, TypeInfoValidationResults } from "../../common/TypeParsing/Validation";
|
|
8
|
+
import type { CustomTypeActionPayload, RelationActionPayload } from "./core/types";
|
|
9
|
+
export * from "./core/types";
|
|
10
|
+
/**
|
|
11
|
+
* Translates validation error descriptors into UI messages.
|
|
12
|
+
*/
|
|
13
|
+
export type TranslateValidationErrorCode = (error: ErrorDescriptor) => string;
|
|
14
|
+
/**
|
|
15
|
+
* Optional custom field validators keyed by field name.
|
|
16
|
+
*/
|
|
17
|
+
export type CustomValidatorMap = FieldValueValidatorMap;
|
|
8
18
|
/**
|
|
9
19
|
* Loose map of form values keyed by field.
|
|
10
20
|
*/
|
|
@@ -46,8 +56,14 @@ export interface AutoFieldProps {
|
|
|
46
56
|
value: FormValue | undefined;
|
|
47
57
|
/** Change handler for the field value. */
|
|
48
58
|
onChange: (value: FormValue) => void;
|
|
49
|
-
/** Optional error
|
|
50
|
-
error?:
|
|
59
|
+
/** Optional primary error descriptor for convenience/backward compatibility. */
|
|
60
|
+
error?: ErrorDescriptor;
|
|
61
|
+
/** Optional list of value-level errors for the field. */
|
|
62
|
+
errors?: ErrorDescriptor[];
|
|
63
|
+
/** Optional per-index errors for array fields. */
|
|
64
|
+
arrayItemErrorMap?: ArrayItemErrorMap;
|
|
65
|
+
/** Optional translator from error descriptor to user-facing message. */
|
|
66
|
+
translateValidationErrorCode?: TranslateValidationErrorCode;
|
|
51
67
|
/** Disables the field UI when true. */
|
|
52
68
|
disabled?: boolean;
|
|
53
69
|
/** Optional callback for relation actions. */
|
|
@@ -81,9 +97,21 @@ export type FormFieldController = {
|
|
|
81
97
|
value: FormValue | undefined;
|
|
82
98
|
/** Change handler for the field value. */
|
|
83
99
|
onChange: (value: FormValue) => void;
|
|
84
|
-
/** Optional error
|
|
85
|
-
error?:
|
|
100
|
+
/** Optional primary error descriptor for the field. */
|
|
101
|
+
error?: ErrorDescriptor;
|
|
102
|
+
/** Optional list of value-level errors for the field. */
|
|
103
|
+
errors?: ErrorDescriptor[];
|
|
104
|
+
/** Optional per-index errors for array fields. */
|
|
105
|
+
arrayItemErrorMap?: ArrayItemErrorMap;
|
|
86
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* Validation errors keyed by field and represented as descriptors/codes.
|
|
109
|
+
*/
|
|
110
|
+
export type FormErrorMap = Record<string, (ErrorDescriptor | ArrayErrorDescriptorCollection)[]>;
|
|
111
|
+
/**
|
|
112
|
+
* Input map used to set form errors, accepting descriptors or raw codes.
|
|
113
|
+
*/
|
|
114
|
+
export type FormErrorInputMap = Record<string, ErrorDescriptor | string | ErrorDescriptor[] | ArrayItemErrorMap | (ErrorDescriptor | ArrayErrorDescriptorCollection)[]>;
|
|
87
115
|
/**
|
|
88
116
|
* Controller for a form instance and its fields.
|
|
89
117
|
*/
|
|
@@ -97,60 +125,13 @@ export type FormController = {
|
|
|
97
125
|
/** Current form values keyed by field. */
|
|
98
126
|
values: FormValues;
|
|
99
127
|
/** Validation errors keyed by field. */
|
|
100
|
-
errors:
|
|
128
|
+
errors: FormErrorMap;
|
|
101
129
|
/** Derived controllers for each field. */
|
|
102
130
|
fields: FormFieldController[];
|
|
103
131
|
/** Update a field value by key. */
|
|
104
132
|
setFieldValue: (key: string, value: FormValue) => void;
|
|
105
133
|
/** Validate the form and return success. */
|
|
106
|
-
validate: () =>
|
|
134
|
+
validate: () => TypeInfoValidationResults;
|
|
107
135
|
/** Override form errors with a provided map. */
|
|
108
|
-
setErrors: (errors:
|
|
109
|
-
};
|
|
110
|
-
/**
|
|
111
|
-
* Supported relation actions emitted by fields.
|
|
112
|
-
*/
|
|
113
|
-
export type RelationAction = "open" | "add" | "edit" | "remove";
|
|
114
|
-
/**
|
|
115
|
-
* Payload for relation action callbacks.
|
|
116
|
-
*/
|
|
117
|
-
export type RelationActionPayload = {
|
|
118
|
-
/** Relation action to perform. */
|
|
119
|
-
action: RelationAction;
|
|
120
|
-
/** Field key that initiated the action. */
|
|
121
|
-
fieldKey: string;
|
|
122
|
-
/** Field metadata for the relation. */
|
|
123
|
-
field: TypeInfoField;
|
|
124
|
-
/** Current relation value for the field. */
|
|
125
|
-
value: ItemRelationshipInfoType | ItemRelationshipInfoType[] | undefined;
|
|
126
|
-
/** Whether relation selection should use full paging. */
|
|
127
|
-
fullPaging?: boolean;
|
|
128
|
-
/** Index when acting on an array item. */
|
|
129
|
-
index?: number;
|
|
130
|
-
/** Change handler to update the relation value. */
|
|
131
|
-
onChange: (value: FormValue) => void;
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* Supported actions for custom type handlers.
|
|
135
|
-
*/
|
|
136
|
-
export type CustomTypeAction = "open" | "add" | "edit" | "remove";
|
|
137
|
-
/**
|
|
138
|
-
* Payload for custom type action callbacks.
|
|
139
|
-
*/
|
|
140
|
-
export type CustomTypeActionPayload = {
|
|
141
|
-
/** Custom type action to perform. */
|
|
142
|
-
action: CustomTypeAction;
|
|
143
|
-
/** Field key that initiated the action. */
|
|
144
|
-
fieldKey: string;
|
|
145
|
-
/** Field metadata for the custom type. */
|
|
146
|
-
field: TypeInfoField;
|
|
147
|
-
/** Custom type identifier. */
|
|
148
|
-
customType: string;
|
|
149
|
-
/** Current value for the custom type. */
|
|
150
|
-
value: FormValue | undefined;
|
|
151
|
-
/** Index when acting on an array item. */
|
|
152
|
-
index?: number;
|
|
153
|
-
/** Change handler to update the custom value. */
|
|
154
|
-
onChange: (value: FormValue) => void;
|
|
136
|
+
setErrors: (errors: FormErrorInputMap) => void;
|
|
155
137
|
};
|
|
156
|
-
export {};
|
package/app/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
export { Route, RouteContext, RouteContextConsumer, RouteContextProvider, RouteProvider, buildHistoryPath, buildQueryString, buildRoutePath, canUseBrowserHistory,
|
|
4
|
-
|
|
5
|
-
import '../chunk-
|
|
6
|
-
import '../chunk-IWRHGGGH.js';
|
|
1
|
+
export { createEasyLayout, getEasyLayoutTemplateDetails, getPascalCaseAreaName } from '../chunk-RUVFOXCR.js';
|
|
2
|
+
export { computeTrackPixels } from '../chunk-TJFTWPXQ.js';
|
|
3
|
+
export { AutoForm, AutoFormView, Route, RouteContext, RouteContextConsumer, RouteContextProvider, RouteProvider, buildHistoryPath, buildQueryString, buildRoutePath, canUseBrowserHistory, computeAreaBounds, createAutoField, createBrowserRouteAdapter, createFormRenderer, createHistoryBackHandler, createManualRouteAdapter, createMemoryHistory, createNativeRouteAdapter, createRouteAdapterFromHistory, createUniversalAdapter, getFieldKind, parseHistoryPath, parseTemplate, resolveSuite, useFormEngine, useRouteContext, validateAreas } from '../chunk-4PV5LPTT.js';
|
|
4
|
+
import '../chunk-7AMEFPPP.js';
|
|
5
|
+
import '../chunk-WTD5BBJP.js';
|
|
7
6
|
import { mergeStringPaths, PATH_DELIMITER } from '../chunk-GYWRAW3Y.js';
|
|
8
7
|
import '../chunk-I2KLQ2HA.js';
|
|
9
8
|
import { createContext, useContext, useRef, useMemo, useCallback, useState, useEffect } from 'react';
|
|
@@ -39,6 +38,8 @@ var useApplicationStateValue = (identifier) => {
|
|
|
39
38
|
} = useContext(ApplicationStateContext);
|
|
40
39
|
const appStateRef = useRef(applicationState);
|
|
41
40
|
appStateRef.current = applicationState;
|
|
41
|
+
const modificationStateRef = useRef(modificationState);
|
|
42
|
+
modificationStateRef.current = modificationState;
|
|
42
43
|
const modified = useMemo(
|
|
43
44
|
() => getApplicationStateModified(identifier, modificationState),
|
|
44
45
|
[identifier, modificationState]
|
|
@@ -50,7 +51,11 @@ var useApplicationStateValue = (identifier) => {
|
|
|
50
51
|
const setModified = useCallback(
|
|
51
52
|
(isModified) => {
|
|
52
53
|
setModificationState(
|
|
53
|
-
setApplicationStateModified(
|
|
54
|
+
setApplicationStateModified(
|
|
55
|
+
identifier,
|
|
56
|
+
isModified,
|
|
57
|
+
modificationStateRef.current
|
|
58
|
+
)
|
|
54
59
|
);
|
|
55
60
|
},
|
|
56
61
|
[identifier, setModificationState]
|
|
@@ -131,6 +136,8 @@ var ApplicationStateProvider = ({
|
|
|
131
136
|
|
|
132
137
|
// src/app/utils/Service.ts
|
|
133
138
|
var getFullUrl = (protocol, domain, basePath = "", path = "", port) => {
|
|
139
|
+
const normalizedProtocol = protocol.endsWith(":") ? protocol.slice(0, -1) : protocol;
|
|
140
|
+
const normalizedDomain = domain.replace(/\/+$/, "");
|
|
134
141
|
const portString = !!port ? `:${port}` : "";
|
|
135
142
|
const fullPath = mergeStringPaths(
|
|
136
143
|
basePath,
|
|
@@ -140,7 +147,8 @@ var getFullUrl = (protocol, domain, basePath = "", path = "", port) => {
|
|
|
140
147
|
false,
|
|
141
148
|
false
|
|
142
149
|
);
|
|
143
|
-
|
|
150
|
+
const normalizedPath = fullPath ? fullPath.startsWith(PATH_DELIMITER) ? fullPath : `${PATH_DELIMITER}${fullPath}` : "";
|
|
151
|
+
return `${normalizedProtocol}://${normalizedDomain}${portString}${normalizedPath}`;
|
|
144
152
|
};
|
|
145
153
|
var sendServiceRequest = async (config, path = "", args = []) => {
|
|
146
154
|
const { protocol, domain, port, basePath = "", authorization = "" } = config;
|
|
@@ -230,7 +238,7 @@ var useApplicationStateLoader = (config) => {
|
|
|
230
238
|
var getKeyValueWithoutError = (obj, key) => {
|
|
231
239
|
try {
|
|
232
240
|
return obj[key];
|
|
233
|
-
} catch (
|
|
241
|
+
} catch (_error) {
|
|
234
242
|
return void 0;
|
|
235
243
|
}
|
|
236
244
|
};
|
|
@@ -241,7 +249,8 @@ var useController = (parentValue, key, onParentValueChange, isArrayIndex = false
|
|
|
241
249
|
try {
|
|
242
250
|
setValue(value2);
|
|
243
251
|
if (isArrayIndex) {
|
|
244
|
-
const
|
|
252
|
+
const baseArray = Array.isArray(parentValue) ? parentValue : [];
|
|
253
|
+
const newArray = [...baseArray];
|
|
245
254
|
newArray[key] = value2;
|
|
246
255
|
onParentValueChange(newArray);
|
|
247
256
|
} else {
|
|
@@ -250,7 +259,7 @@ var useController = (parentValue, key, onParentValueChange, isArrayIndex = false
|
|
|
250
259
|
[key]: value2
|
|
251
260
|
});
|
|
252
261
|
}
|
|
253
|
-
} catch (
|
|
262
|
+
} catch (_error) {
|
|
254
263
|
}
|
|
255
264
|
},
|
|
256
265
|
[parentValue, key, onParentValueChange, isArrayIndex]
|
|
@@ -258,7 +267,7 @@ var useController = (parentValue, key, onParentValueChange, isArrayIndex = false
|
|
|
258
267
|
useEffect(() => {
|
|
259
268
|
try {
|
|
260
269
|
setValue(getKeyValueWithoutError(parentValue, key));
|
|
261
|
-
} catch (
|
|
270
|
+
} catch (_error) {
|
|
262
271
|
setValue(void 0);
|
|
263
272
|
}
|
|
264
273
|
}, [parentValue, key]);
|
|
@@ -379,8 +388,7 @@ var useTypeInfoORMAPI = (typeInfoORMAPI) => {
|
|
|
379
388
|
);
|
|
380
389
|
const api = useMemo(() => {
|
|
381
390
|
const apiBase = {};
|
|
382
|
-
for (const
|
|
383
|
-
const methodName = aM;
|
|
391
|
+
for (const methodName of Object.keys(typeInfoORMAPI)) {
|
|
384
392
|
apiBase[methodName] = requestHandlerFactory(
|
|
385
393
|
typeInfoORMAPI,
|
|
386
394
|
methodName,
|
|
@@ -60,7 +60,7 @@ export declare const getApplicationStateValue: (identifier: ApplicationStateIden
|
|
|
60
60
|
* @param modificationState - The current modification map.
|
|
61
61
|
* @returns A new modification map with the updated flag.
|
|
62
62
|
* */
|
|
63
|
-
export declare const setApplicationStateModified: (identifier: ApplicationStateIdentifier, value: boolean, modificationState:
|
|
63
|
+
export declare const setApplicationStateModified: (identifier: ApplicationStateIdentifier, value: boolean, modificationState: ApplicationStateModificationState) => ApplicationStateModificationState;
|
|
64
64
|
/**
|
|
65
65
|
* Set the stored value for an identifier.
|
|
66
66
|
*
|
package/app/utils/Route.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Render-agnostic routing helpers with nested Route contexts.
|
|
5
5
|
* Supply a RouteAdapter via RouteProvider or use root Route provider mode.
|
|
6
6
|
*/
|
|
7
|
-
import
|
|
7
|
+
import { PropsWithChildren } from "react";
|
|
8
8
|
import { type UniversalRouteIngress } from "./UniversalRouteAdapter";
|
|
9
9
|
/**
|
|
10
10
|
* Platform adapter that supplies the current path and change notifications.
|
|
@@ -97,8 +97,8 @@ export type RouteContextType = {
|
|
|
97
97
|
/**
|
|
98
98
|
* React context for route state and parameters.
|
|
99
99
|
*/
|
|
100
|
-
export declare const RouteContext:
|
|
101
|
-
export declare const RouteContextProvider:
|
|
100
|
+
export declare const RouteContext: import("react").Context<RouteContextType>;
|
|
101
|
+
export declare const RouteContextProvider: import("react").Provider<RouteContextType>, RouteContextConsumer: import("react").Consumer<RouteContextType>;
|
|
102
102
|
/**
|
|
103
103
|
* Access Route path and parameter information.
|
|
104
104
|
*
|
package/build/index.js
CHANGED
|
@@ -394,7 +394,7 @@ var getTypeInfoFromPickOmitFieldFilters = (typeNameStr, typeRef, typeMap) => {
|
|
|
394
394
|
(fieldSet) => fieldSet.filter(
|
|
395
395
|
(field) => picking ? omitFieldNames.includes(field) : !omitFieldNames.includes(field)
|
|
396
396
|
)
|
|
397
|
-
) : void 0;
|
|
397
|
+
).filter((fieldSet) => fieldSet.length > 0) : void 0;
|
|
398
398
|
typeInfo = {
|
|
399
399
|
...typeInfoOther,
|
|
400
400
|
fields: cleanTypeInfoFields,
|
|
@@ -404,7 +404,7 @@ var getTypeInfoFromPickOmitFieldFilters = (typeNameStr, typeRef, typeMap) => {
|
|
|
404
404
|
}
|
|
405
405
|
return typeInfo;
|
|
406
406
|
};
|
|
407
|
-
var getTypeInfoFromExcludeFieldFilter = (
|
|
407
|
+
var getTypeInfoFromExcludeFieldFilter = (_typeNameStr, typeRef, typeMap) => {
|
|
408
408
|
const baseTypeKind = typeRef.typeArguments?.[0].kind;
|
|
409
409
|
const excludeTypeKind = typeRef.typeArguments?.[1].kind;
|
|
410
410
|
let typeInfo;
|
|
@@ -438,7 +438,7 @@ var getTypeInfoFromExcludeFieldFilter = (typeNameStr, typeRef, typeMap) => {
|
|
|
438
438
|
);
|
|
439
439
|
const cleanUnionFieldSets = existingUnionFieldSets ? existingUnionFieldSets.map(
|
|
440
440
|
(fieldSet) => fieldSet.filter((field) => !excludeFieldNames.includes(field))
|
|
441
|
-
) : void 0;
|
|
441
|
+
).filter((fieldSet) => fieldSet.length > 0) : void 0;
|
|
442
442
|
typeInfo = {
|
|
443
443
|
...baseTypeInfo,
|
|
444
444
|
fields: cleanTypeInfoFields,
|
|
@@ -449,7 +449,7 @@ var getTypeInfoFromExcludeFieldFilter = (typeNameStr, typeRef, typeMap) => {
|
|
|
449
449
|
}
|
|
450
450
|
return typeInfo;
|
|
451
451
|
};
|
|
452
|
-
var defaultFieldFilterProcessor = (typeNameStr,
|
|
452
|
+
var defaultFieldFilterProcessor = (typeNameStr, _typeRef, typeMap) => {
|
|
453
453
|
const refNode = typeNameStr ? typeMap[typeNameStr] : void 0;
|
|
454
454
|
let typeInfo;
|
|
455
455
|
if (refNode) {
|