@reformer/core 11.0.0-beta.5 → 11.0.0-beta.6
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/dist/form/create-form.d.ts +6 -6
- package/dist/form/factories/node-factory.d.ts +16 -16
- package/dist/form/nodes/array-node.d.ts +3 -3
- package/dist/form/nodes/field-node.d.ts +3 -3
- package/dist/form/nodes/group-node.d.ts +7 -7
- package/dist/form/nodes/model-array-node.d.ts +2 -2
- package/dist/form/types/deep-schema.d.ts +5 -5
- package/dist/index.js +443 -399
- package/dist/platforms/react/field-binding/field-adapter.d.ts +87 -0
- package/dist/platforms/react/field-binding/field-handle.d.ts +50 -0
- package/dist/platforms/react/index.d.ts +4 -0
- package/docs/llms/02-quick-start.md +7 -7
- package/docs/llms/03-api-signatures.md +5 -5
- package/docs/llms/05-common-mistakes.md +1 -1
- package/docs/llms/09-formschema.md +12 -12
- package/docs/llms/10-arrays.md +4 -4
- package/docs/llms/14-extended-mistakes.md +1 -1
- package/docs/llms/15-project-structure.md +15 -13
- package/docs/llms/16-ui-components.md +36 -9
- package/docs/llms/17-nonexistent-api.md +16 -2
- package/docs/llms/29-async-preload.md +4 -4
- package/docs/llms/30-type-safety-recipes.md +1 -1
- package/llms-index.json +1 -1
- package/llms.txt +340 -81
- package/package.json +1 -1
|
@@ -52,9 +52,9 @@ export interface CreateFormFromModelArgs<T> {
|
|
|
52
52
|
* component: Section,
|
|
53
53
|
* children: [
|
|
54
54
|
* // Layout несёт только component/componentProps; правила — в отдельной ValidationSchema.
|
|
55
|
-
* { value: model.$.email, component:
|
|
55
|
+
* { value: model.$.email, component: Input },
|
|
56
56
|
* // вложенная группа: `model.$.profile.name` (≡ под-модель `model.profile.$.name` — тот же сигнал)
|
|
57
|
-
* { value: model.$.profile.name, component:
|
|
57
|
+
* { value: model.$.profile.name, component: Input },
|
|
58
58
|
* ],
|
|
59
59
|
* };
|
|
60
60
|
*
|
|
@@ -93,8 +93,8 @@ export declare function createFormFromModel<T>(args: CreateFormFromModelArgs<T>)
|
|
|
93
93
|
* // Layout-схема НЕ несёт validators — только component/componentProps.
|
|
94
94
|
* const schema = {
|
|
95
95
|
* children: [
|
|
96
|
-
* { value: model.$.email, component:
|
|
97
|
-
* { value: model.$.password, component:
|
|
96
|
+
* { value: model.$.email, component: Input },
|
|
97
|
+
* { value: model.$.password, component: Input },
|
|
98
98
|
* ],
|
|
99
99
|
* };
|
|
100
100
|
*
|
|
@@ -125,8 +125,8 @@ export declare function createForm<T>(config: GroupNodeConfig<T>): FormProxy<T>;
|
|
|
125
125
|
* @example Legacy (back-compat) — плоская схема без модели
|
|
126
126
|
* ```typescript
|
|
127
127
|
* const form = createForm<UserForm>({
|
|
128
|
-
* email: { value: '', component:
|
|
129
|
-
* password: { value: '', component:
|
|
128
|
+
* email: { value: '', component: Input },
|
|
129
|
+
* password: { value: '', component: Input },
|
|
130
130
|
* });
|
|
131
131
|
* ```
|
|
132
132
|
*/
|
|
@@ -11,7 +11,7 @@ import { ConfigWithSchema, ConfigWithValue, UnknownRecord } from '../types/index
|
|
|
11
11
|
* import { NodeFactory } from '@reformer/core';
|
|
12
12
|
*
|
|
13
13
|
* const factory = new NodeFactory();
|
|
14
|
-
* const node = factory.createNode({ value: '', component:
|
|
14
|
+
* const node = factory.createNode({ value: '', component: Input }); // → FieldNode<string>
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
17
|
export declare class NodeFactory {
|
|
@@ -37,25 +37,25 @@ export declare class NodeFactory {
|
|
|
37
37
|
* // FieldNode
|
|
38
38
|
* const field = factory.createNode({
|
|
39
39
|
* value: 'test@mail.com',
|
|
40
|
-
* component:
|
|
40
|
+
* component: Input,
|
|
41
41
|
* validators: [required, email]
|
|
42
42
|
* });
|
|
43
43
|
*
|
|
44
44
|
* // GroupNode
|
|
45
45
|
* const group = factory.createNode({
|
|
46
|
-
* email: { value: '', component:
|
|
47
|
-
* password: { value: '', component:
|
|
46
|
+
* email: { value: '', component: Input },
|
|
47
|
+
* password: { value: '', component: Input }
|
|
48
48
|
* });
|
|
49
49
|
*
|
|
50
50
|
* // ArrayNode (объект)
|
|
51
51
|
* const array = factory.createNode({
|
|
52
|
-
* schema: { title: { value: '', component:
|
|
52
|
+
* schema: { title: { value: '', component: Input } },
|
|
53
53
|
* initialItems: [{ title: 'Item 1' }]
|
|
54
54
|
* });
|
|
55
55
|
*
|
|
56
56
|
* // ArrayNode (массив) - новый формат
|
|
57
57
|
* const array2 = factory.createNode([
|
|
58
|
-
* { title: { value: '', component:
|
|
58
|
+
* { title: { value: '', component: Input } }, // schema
|
|
59
59
|
* { title: 'Item 1' }, // initial item 1
|
|
60
60
|
* { title: 'Item 2' } // initial item 2
|
|
61
61
|
* ]);
|
|
@@ -80,7 +80,7 @@ export declare class NodeFactory {
|
|
|
80
80
|
*
|
|
81
81
|
* // Массив с начальными элементами
|
|
82
82
|
* const array = factory.createArrayNodeFromArray([
|
|
83
|
-
* { title: { value: '', component:
|
|
83
|
+
* { title: { value: '', component: Input } }, // schema
|
|
84
84
|
* { title: 'Item 1' }, // initial value
|
|
85
85
|
* { title: 'Item 2' } // initial value
|
|
86
86
|
* ]);
|
|
@@ -94,7 +94,7 @@ export declare class NodeFactory {
|
|
|
94
94
|
* ✅ НОВОЕ: Извлечено из GroupNode для централизации логики
|
|
95
95
|
*
|
|
96
96
|
* Преобразует схему формы в объект со значениями:
|
|
97
|
-
* - `{ name: { value: 'John', component:
|
|
97
|
+
* - `{ name: { value: 'John', component: Input } } → { name: 'John' }`
|
|
98
98
|
* - Поддерживает вложенные группы
|
|
99
99
|
* - Поддерживает массивы
|
|
100
100
|
*
|
|
@@ -106,10 +106,10 @@ export declare class NodeFactory {
|
|
|
106
106
|
* const factory = new NodeFactory();
|
|
107
107
|
*
|
|
108
108
|
* const schema = {
|
|
109
|
-
* name: { value: 'John', component:
|
|
110
|
-
* age: { value: 30, component:
|
|
109
|
+
* name: { value: 'John', component: Input },
|
|
110
|
+
* age: { value: 30, component: Input },
|
|
111
111
|
* address: {
|
|
112
|
-
* city: { value: 'Moscow', component:
|
|
112
|
+
* city: { value: 'Moscow', component: Input }
|
|
113
113
|
* }
|
|
114
114
|
* };
|
|
115
115
|
*
|
|
@@ -132,7 +132,7 @@ export declare class NodeFactory {
|
|
|
132
132
|
* ```typescript
|
|
133
133
|
* const factory = new NodeFactory();
|
|
134
134
|
*
|
|
135
|
-
* factory.isFieldConfig({ value: '', component:
|
|
135
|
+
* factory.isFieldConfig({ value: '', component: Input }); // true
|
|
136
136
|
* factory.isFieldConfig({ email: { value: '' } }); // false
|
|
137
137
|
* factory.isFieldConfig(null); // false
|
|
138
138
|
* ```
|
|
@@ -155,7 +155,7 @@ export declare class NodeFactory {
|
|
|
155
155
|
* const factory = new NodeFactory();
|
|
156
156
|
*
|
|
157
157
|
* factory.isArrayConfig({ schema: {}, initialItems: [] }); // true
|
|
158
|
-
* factory.isArrayConfig({ value: '', component:
|
|
158
|
+
* factory.isArrayConfig({ value: '', component: Input }); // false
|
|
159
159
|
* factory.isArrayConfig({ email: { value: '' } }); // false
|
|
160
160
|
* ```
|
|
161
161
|
*/
|
|
@@ -176,11 +176,11 @@ export declare class NodeFactory {
|
|
|
176
176
|
* const factory = new NodeFactory();
|
|
177
177
|
*
|
|
178
178
|
* factory.isGroupConfig({
|
|
179
|
-
* email: { value: '', component:
|
|
180
|
-
* password: { value: '', component:
|
|
179
|
+
* email: { value: '', component: Input },
|
|
180
|
+
* password: { value: '', component: Input }
|
|
181
181
|
* }); // true
|
|
182
182
|
*
|
|
183
|
-
* factory.isGroupConfig({ value: '', component:
|
|
183
|
+
* factory.isGroupConfig({ value: '', component: Input }); // false
|
|
184
184
|
* factory.isGroupConfig({ schema: {} }); // false
|
|
185
185
|
* factory.isGroupConfig(null); // false
|
|
186
186
|
* ```
|
|
@@ -11,8 +11,8 @@ import { FormProxy } from '../types/form-proxy';
|
|
|
11
11
|
* @example
|
|
12
12
|
* ```typescript
|
|
13
13
|
* const array = new ArrayNode({
|
|
14
|
-
* title: { value: '', component:
|
|
15
|
-
* price: { value: 0, component:
|
|
14
|
+
* title: { value: '', component: Input },
|
|
15
|
+
* price: { value: 0, component: Input },
|
|
16
16
|
* });
|
|
17
17
|
*
|
|
18
18
|
* array.push({ title: 'Item 1', price: 100 });
|
|
@@ -141,7 +141,7 @@ export declare class ArrayNode<T extends object> extends FormNode<T[]> {
|
|
|
141
141
|
* @example
|
|
142
142
|
* ```typescript
|
|
143
143
|
* const arrayNode = new ArrayNode(
|
|
144
|
-
* { name: { value: '', component:
|
|
144
|
+
* { name: { value: '', component: Input } },
|
|
145
145
|
* [{ name: 'Initial 1' }, { name: 'Initial 2' }]
|
|
146
146
|
* );
|
|
147
147
|
*
|
|
@@ -11,7 +11,7 @@ import { FieldConfig, FieldStatus, ValidationError } from '../types/index';
|
|
|
11
11
|
* ```typescript
|
|
12
12
|
* const field = new FieldNode({
|
|
13
13
|
* value: '',
|
|
14
|
-
* component:
|
|
14
|
+
* component: Input,
|
|
15
15
|
* validators: [required, email],
|
|
16
16
|
* });
|
|
17
17
|
*
|
|
@@ -103,7 +103,7 @@ export declare class FieldNode<T> extends FormNode<T> {
|
|
|
103
103
|
*
|
|
104
104
|
* @example
|
|
105
105
|
* ```typescript
|
|
106
|
-
* const field = new FieldNode({ value: 'initial', component:
|
|
106
|
+
* const field = new FieldNode({ value: 'initial', component: Input });
|
|
107
107
|
*
|
|
108
108
|
* field.setValue('changed');
|
|
109
109
|
* field.reset('temp value');
|
|
@@ -202,7 +202,7 @@ export declare class FieldNode<T> extends FormNode<T> {
|
|
|
202
202
|
* const form = createForm({
|
|
203
203
|
* email: {
|
|
204
204
|
* value: '',
|
|
205
|
-
* component:
|
|
205
|
+
* component: Input,
|
|
206
206
|
* updateOn: 'submit', // Изначально валидация только при submit
|
|
207
207
|
* validators: [required, email],
|
|
208
208
|
* },
|
|
@@ -15,8 +15,8 @@ import { SubmitOptions, SubmitResult } from '../form-submitter';
|
|
|
15
15
|
* @example
|
|
16
16
|
* ```typescript
|
|
17
17
|
* const form = new GroupNode({
|
|
18
|
-
* email: { valueSignal: model.$.email, component:
|
|
19
|
-
* password: { valueSignal: model.$.password, component:
|
|
18
|
+
* email: { valueSignal: model.$.email, component: Input },
|
|
19
|
+
* password: { valueSignal: model.$.password, component: Input },
|
|
20
20
|
* });
|
|
21
21
|
*
|
|
22
22
|
* // Прямой доступ к полям через Proxy
|
|
@@ -136,8 +136,8 @@ export declare class GroupNode<T> extends FormNode<T> {
|
|
|
136
136
|
* @example
|
|
137
137
|
* ```typescript
|
|
138
138
|
* const form = new GroupNode({
|
|
139
|
-
* email: { value: '', component:
|
|
140
|
-
* name: { value: '', component:
|
|
139
|
+
* email: { value: '', component: Input },
|
|
140
|
+
* name: { value: '', component: Input },
|
|
141
141
|
* });
|
|
142
142
|
*
|
|
143
143
|
* const proxy = form.getProxy();
|
|
@@ -189,11 +189,11 @@ export declare class GroupNode<T> extends FormNode<T> {
|
|
|
189
189
|
* @example
|
|
190
190
|
* ```typescript
|
|
191
191
|
* const form = new GroupNode({
|
|
192
|
-
* email: { value: '', component:
|
|
192
|
+
* email: { value: '', component: Input },
|
|
193
193
|
* address: {
|
|
194
|
-
* city: { value: '', component:
|
|
194
|
+
* city: { value: '', component: Input }
|
|
195
195
|
* },
|
|
196
|
-
* items: [{ name: { value: '', component:
|
|
196
|
+
* items: [{ name: { value: '', component: Input } }]
|
|
197
197
|
* });
|
|
198
198
|
*
|
|
199
199
|
* form.getFieldByPath('email'); // FieldNode
|
|
@@ -36,8 +36,8 @@ export interface ModelArrayControl<TItem extends object> {
|
|
|
36
36
|
* const model = createModel<{ rows: { name: string; qty: number }[] }>({ rows: [] });
|
|
37
37
|
*
|
|
38
38
|
* const rowItem = (item: FormModel<{ name: string; qty: number }>) => ({
|
|
39
|
-
* name: { value: item.$.name, component:
|
|
40
|
-
* qty: { value: item.$.qty, component:
|
|
39
|
+
* name: { value: item.$.name, component: Input },
|
|
40
|
+
* qty: { value: item.$.qty, component: Input },
|
|
41
41
|
* });
|
|
42
42
|
*
|
|
43
43
|
* const form = createForm({
|
|
@@ -89,14 +89,14 @@ type NonEmptyFieldConfig<T> = RequireAtLeastOne<FieldConfig<T>>;
|
|
|
89
89
|
* }
|
|
90
90
|
*
|
|
91
91
|
* const schema: FormSchema<Form> = {
|
|
92
|
-
* name: { value: '', component:
|
|
92
|
+
* name: { value: '', component: Input },
|
|
93
93
|
* address: {
|
|
94
|
-
* city: { value: '', component:
|
|
95
|
-
* street: { value: '', component:
|
|
94
|
+
* city: { value: '', component: Input },
|
|
95
|
+
* street: { value: '', component: Input },
|
|
96
96
|
* },
|
|
97
97
|
* items: [{
|
|
98
|
-
* title: { value: '', component:
|
|
99
|
-
* price: { value: 0, component:
|
|
98
|
+
* title: { value: '', component: Input },
|
|
99
|
+
* price: { value: 0, component: Input },
|
|
100
100
|
* }],
|
|
101
101
|
* };
|
|
102
102
|
* ```
|