@ng-forge/dynamic-forms 0.10.0-next.2 → 0.10.0-next.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/fesm2022/{ng-forge-dynamic-forms-array-field.component-PPh_uVVh.mjs → ng-forge-dynamic-forms-array-field.component-BfRH3TBm.mjs} +4 -3
- package/fesm2022/ng-forge-dynamic-forms-array-field.component-BfRH3TBm.mjs.map +1 -0
- package/fesm2022/{ng-forge-dynamic-forms-container-field.component-3dZDF3kh.mjs → ng-forge-dynamic-forms-container-field.component-bA-8ICHF.mjs} +4 -3
- package/fesm2022/ng-forge-dynamic-forms-container-field.component-bA-8ICHF.mjs.map +1 -0
- package/fesm2022/{ng-forge-dynamic-forms-container-utils-B7kCznbc.mjs → ng-forge-dynamic-forms-container-utils-BvXn8T_i.mjs} +2 -2
- package/fesm2022/ng-forge-dynamic-forms-container-utils-BvXn8T_i.mjs.map +1 -0
- package/fesm2022/{ng-forge-dynamic-forms-css-wrapper.component-DtWBauY3.mjs → ng-forge-dynamic-forms-css-wrapper.component-DjhcONFh.mjs} +2 -2
- package/fesm2022/ng-forge-dynamic-forms-css-wrapper.component-DjhcONFh.mjs.map +1 -0
- package/fesm2022/{ng-forge-dynamic-forms-emit-initialization-CbY8WZZB.mjs → ng-forge-dynamic-forms-emit-initialization-DhHwU6FJ.mjs} +2 -2
- package/fesm2022/ng-forge-dynamic-forms-emit-initialization-DhHwU6FJ.mjs.map +1 -0
- package/fesm2022/{ng-forge-dynamic-forms-group-field.component-Dr8Z628-.mjs → ng-forge-dynamic-forms-group-field.component-D0_nmXf2.mjs} +4 -3
- package/fesm2022/ng-forge-dynamic-forms-group-field.component-D0_nmXf2.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-integration.mjs +14 -10
- package/fesm2022/ng-forge-dynamic-forms-integration.mjs.map +1 -1
- package/fesm2022/ng-forge-dynamic-forms-internal.mjs +3372 -0
- package/fesm2022/ng-forge-dynamic-forms-internal.mjs.map +1 -0
- package/fesm2022/{ng-forge-dynamic-forms-ng-forge-dynamic-forms-ww_BnAt_.mjs → ng-forge-dynamic-forms-ng-forge-dynamic-forms-CNc4a_Xv.mjs} +725 -3866
- package/fesm2022/ng-forge-dynamic-forms-ng-forge-dynamic-forms-CNc4a_Xv.mjs.map +1 -0
- package/fesm2022/{ng-forge-dynamic-forms-page-field.component-DoGKs3LN.mjs → ng-forge-dynamic-forms-page-field.component-BJRNnoz-.mjs} +4 -3
- package/fesm2022/ng-forge-dynamic-forms-page-field.component-BJRNnoz-.mjs.map +1 -0
- package/fesm2022/{ng-forge-dynamic-forms-row-wrapper.component-CFtnatYj.mjs → ng-forge-dynamic-forms-row-wrapper.component-CwkYn5yl.mjs} +1 -1
- package/fesm2022/ng-forge-dynamic-forms-row-wrapper.component-CwkYn5yl.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms-schema.mjs.map +1 -1
- package/fesm2022/{ng-forge-dynamic-forms-text-field.component-C3TPVvj_.mjs → ng-forge-dynamic-forms-text-field.component-DABkT0O7.mjs} +2 -2
- package/fesm2022/ng-forge-dynamic-forms-text-field.component-DABkT0O7.mjs.map +1 -0
- package/fesm2022/ng-forge-dynamic-forms.mjs +2 -1
- package/fesm2022/ng-forge-dynamic-forms.mjs.map +1 -1
- package/package.json +14 -1
- package/schematics/collection.json +10 -0
- package/schematics/generators.json +12 -0
- package/schematics/ng-add/index.js +87 -0
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/ng-add/nx-wrapper.js +5 -0
- package/schematics/ng-add/nx-wrapper.js.map +1 -0
- package/schematics/ng-add/recipes.js +60 -0
- package/schematics/ng-add/recipes.js.map +1 -0
- package/schematics/ng-add/rules/add-packages.js +73 -0
- package/schematics/ng-add/rules/add-packages.js.map +1 -0
- package/schematics/ng-add/rules/add-providers.js +132 -0
- package/schematics/ng-add/rules/add-providers.js.map +1 -0
- package/schematics/ng-add/rules/add-styles.js +123 -0
- package/schematics/ng-add/rules/add-styles.js.map +1 -0
- package/schematics/ng-add/schema.json +48 -0
- package/schematics/package.json +1 -0
- package/schematics/versions.js +33 -0
- package/schematics/versions.js.map +1 -0
- package/types/ng-forge-dynamic-forms-integration.d.ts +31 -464
- package/types/ng-forge-dynamic-forms-internal.d.ts +3508 -0
- package/types/ng-forge-dynamic-forms-schema.d.ts +2 -117
- package/types/ng-forge-dynamic-forms.d.ts +87 -7170
- package/fesm2022/ng-forge-dynamic-forms-array-field.component-PPh_uVVh.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-container-field.component-3dZDF3kh.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-container-utils-B7kCznbc.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-css-wrapper.component-DtWBauY3.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-emit-initialization-CbY8WZZB.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-group-field.component-Dr8Z628-.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-ng-forge-dynamic-forms-ww_BnAt_.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-page-field.component-DoGKs3LN.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-row-wrapper.component-CFtnatYj.mjs.map +0 -1
- package/fesm2022/ng-forge-dynamic-forms-text-field.component-C3TPVvj_.mjs.map +0 -1
|
@@ -10,35 +10,7 @@ declare const STANDARD_SCHEMA_KIND: "standardSchema";
|
|
|
10
10
|
* Angular schema callback function type.
|
|
11
11
|
* This is the raw callback that Angular's schema() function accepts.
|
|
12
12
|
*
|
|
13
|
-
* Use this when you want to write Angular schema validation directly
|
|
14
|
-
* without any wrapper. This is ideal for Angular-only projects that
|
|
15
|
-
* want full access to Angular's form validation APIs.
|
|
16
|
-
*
|
|
17
13
|
* @typeParam T - The form value type
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* import { FormConfig } from '@ng-forge/dynamic-forms';
|
|
22
|
-
* import { validateTree } from '@angular/forms/signals';
|
|
23
|
-
*
|
|
24
|
-
* const config = {
|
|
25
|
-
* // Raw callback - no wrapper needed!
|
|
26
|
-
* schema: (path) => {
|
|
27
|
-
* validateTree(path, (ctx) => {
|
|
28
|
-
* const { password, confirmPassword } = ctx.value();
|
|
29
|
-
* if (password !== confirmPassword) {
|
|
30
|
-
* return [{ kind: 'passwordMismatch', fieldTree: ctx.fieldTreeOf(path).confirmPassword }];
|
|
31
|
-
* }
|
|
32
|
-
* return null;
|
|
33
|
-
* });
|
|
34
|
-
* },
|
|
35
|
-
* fields: [
|
|
36
|
-
* { key: 'password', type: 'input', label: 'Password', required: true },
|
|
37
|
-
* { key: 'confirmPassword', type: 'input', label: 'Confirm', required: true,
|
|
38
|
-
* validationMessages: { passwordMismatch: 'Passwords must match' } },
|
|
39
|
-
* ],
|
|
40
|
-
* } as const satisfies FormConfig;
|
|
41
|
-
* ```
|
|
42
14
|
*/
|
|
43
15
|
type AngularSchemaCallback<T = unknown> = (path: SchemaPath<T> & SchemaPathTree<T>) => void;
|
|
44
16
|
/**
|
|
@@ -46,35 +18,16 @@ type AngularSchemaCallback<T = unknown> = (path: SchemaPath<T> & SchemaPathTree<
|
|
|
46
18
|
* This allows the dynamic forms system to identify and use standard-compliant schemas
|
|
47
19
|
* for validation without coupling to any specific schema library.
|
|
48
20
|
*
|
|
49
|
-
* The `out` variance modifier makes this type covariant in T, meaning a
|
|
50
|
-
* StandardSchemaMarker<SpecificType> is assignable to StandardSchemaMarker<BroaderType>.
|
|
51
|
-
* This enables Zod/Valibot schemas to be used with FormConfig's inferred TValue.
|
|
52
|
-
*
|
|
53
21
|
* @typeParam T - The inferred type that the schema validates to (covariant)
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```typescript
|
|
57
|
-
* import { z } from 'zod';
|
|
58
|
-
* import { standardSchema } from '@ng-forge/dynamic-forms/schema';
|
|
59
|
-
*
|
|
60
|
-
* const userSchema = z.object({
|
|
61
|
-
* name: z.string(),
|
|
62
|
-
* email: z.string().email(),
|
|
63
|
-
* });
|
|
64
|
-
*
|
|
65
|
-
* // Wrap the Zod schema with standardSchema marker
|
|
66
|
-
* const formSchema = standardSchema(userSchema);
|
|
67
|
-
* ```
|
|
68
22
|
*/
|
|
69
23
|
interface StandardSchemaMarker<out T = unknown> {
|
|
70
24
|
/**
|
|
71
25
|
* Internal marker identifying this as a standard schema wrapper.
|
|
26
|
+
*
|
|
72
27
|
* @internal
|
|
73
28
|
*/
|
|
74
29
|
readonly ɵkind: typeof STANDARD_SCHEMA_KIND;
|
|
75
|
-
/**
|
|
76
|
-
* The underlying schema that implements the Standard Schema spec.
|
|
77
|
-
*/
|
|
30
|
+
/** The underlying schema that implements the Standard Schema spec. */
|
|
78
31
|
readonly schema: StandardSchemaV1<T>;
|
|
79
32
|
}
|
|
80
33
|
/**
|
|
@@ -82,90 +35,22 @@ interface StandardSchemaMarker<out T = unknown> {
|
|
|
82
35
|
* Supports both Standard Schema compliant schemas (Zod, Valibot, ArkType)
|
|
83
36
|
* and raw Angular schema callbacks.
|
|
84
37
|
*
|
|
85
|
-
* The covariance from StandardSchemaMarker flows through, allowing
|
|
86
|
-
* schemas with specific types to be assigned to broader form value types.
|
|
87
|
-
*
|
|
88
38
|
* @typeParam T - The inferred type that the schema validates to
|
|
89
|
-
*
|
|
90
|
-
* @example Standard Schema (Zod)
|
|
91
|
-
* ```typescript
|
|
92
|
-
* import { z } from 'zod';
|
|
93
|
-
* import { standardSchema } from '@ng-forge/dynamic-forms/schema';
|
|
94
|
-
*
|
|
95
|
-
* const config = {
|
|
96
|
-
* schema: standardSchema(z.object({ ... })),
|
|
97
|
-
* fields: [...],
|
|
98
|
-
* };
|
|
99
|
-
* ```
|
|
100
|
-
*
|
|
101
|
-
* @example Angular Schema Callback
|
|
102
|
-
* ```typescript
|
|
103
|
-
* import { validateTree } from '@angular/forms/signals';
|
|
104
|
-
*
|
|
105
|
-
* const config = {
|
|
106
|
-
* schema: (path) => {
|
|
107
|
-
* validateTree(path, (ctx) => { ... });
|
|
108
|
-
* },
|
|
109
|
-
* fields: [...],
|
|
110
|
-
* };
|
|
111
|
-
* ```
|
|
112
39
|
*/
|
|
113
40
|
type FormSchema<T = unknown> = StandardSchemaMarker<T> | AngularSchemaCallback<T>;
|
|
114
41
|
/**
|
|
115
42
|
* Wraps a Standard Schema compliant schema for use with dynamic forms.
|
|
116
43
|
*
|
|
117
|
-
* This function creates a marker wrapper around schemas that implement the
|
|
118
|
-
* Standard Schema spec (Zod, Valibot, ArkType, etc.), allowing the dynamic
|
|
119
|
-
* forms system to identify and use them for validation.
|
|
120
|
-
*
|
|
121
44
|
* @typeParam T - The inferred type that the schema validates to
|
|
122
45
|
* @param schema - A schema implementing the Standard Schema V1 spec
|
|
123
46
|
* @returns A wrapped schema marker that can be passed to dynamic form configuration
|
|
124
|
-
*
|
|
125
|
-
* @example
|
|
126
|
-
* ```typescript
|
|
127
|
-
* import { z } from 'zod';
|
|
128
|
-
* import { standardSchema } from '@ng-forge/dynamic-forms/schema';
|
|
129
|
-
*
|
|
130
|
-
* const loginSchema = z.object({
|
|
131
|
-
* email: z.string().email('Invalid email format'),
|
|
132
|
-
* password: z.string().min(8, 'Password must be at least 8 characters'),
|
|
133
|
-
* });
|
|
134
|
-
*
|
|
135
|
-
* // Wrap for use with dynamic forms
|
|
136
|
-
* const formSchema = standardSchema(loginSchema);
|
|
137
|
-
*
|
|
138
|
-
* // Use in form configuration
|
|
139
|
-
* const formConfig = {
|
|
140
|
-
* schema: formSchema,
|
|
141
|
-
* fields: [
|
|
142
|
-
* input({ key: 'email', label: 'Email' }),
|
|
143
|
-
* input({ key: 'password', label: 'Password', props: { type: 'password' } }),
|
|
144
|
-
* ],
|
|
145
|
-
* };
|
|
146
|
-
* ```
|
|
147
47
|
*/
|
|
148
48
|
declare function standardSchema<T>(schema: StandardSchemaV1<T>): StandardSchemaMarker<T>;
|
|
149
49
|
/**
|
|
150
50
|
* Type guard to check if a value is a StandardSchemaMarker.
|
|
151
51
|
*
|
|
152
|
-
* This is useful when processing form configuration to determine if a schema
|
|
153
|
-
* has been provided and should be used for validation.
|
|
154
|
-
*
|
|
155
52
|
* @param value - The value to check
|
|
156
53
|
* @returns True if the value is a StandardSchemaMarker, false otherwise
|
|
157
|
-
*
|
|
158
|
-
* @example
|
|
159
|
-
* ```typescript
|
|
160
|
-
* import { isStandardSchemaMarker } from '@ng-forge/dynamic-forms/schema';
|
|
161
|
-
*
|
|
162
|
-
* function processFormConfig(config: FormConfig) {
|
|
163
|
-
* if (config.schema && isStandardSchemaMarker(config.schema)) {
|
|
164
|
-
* // Use the schema for validation
|
|
165
|
-
* const result = config.schema.schema['~standard'].validate(formValue);
|
|
166
|
-
* }
|
|
167
|
-
* }
|
|
168
|
-
* ```
|
|
169
54
|
*/
|
|
170
55
|
declare function isStandardSchemaMarker(value: unknown): value is StandardSchemaMarker;
|
|
171
56
|
/**
|