@reformer/core 3.0.0 → 4.0.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/dist/behaviors/compute-from.d.ts +2 -0
- package/dist/behaviors/compute-from.js +31 -0
- package/dist/behaviors/copy-from.d.ts +2 -0
- package/dist/behaviors/copy-from.js +29 -0
- package/dist/behaviors/enable-when.d.ts +2 -0
- package/dist/behaviors/enable-when.js +25 -0
- package/dist/behaviors/reset-when.d.ts +2 -0
- package/dist/behaviors/reset-when.js +24 -0
- package/dist/behaviors/revalidate-when.d.ts +2 -0
- package/dist/behaviors/revalidate-when.js +18 -0
- package/dist/behaviors/sync-fields.d.ts +2 -0
- package/dist/behaviors/sync-fields.js +41 -0
- package/dist/behaviors/transform-value.d.ts +2 -0
- package/dist/behaviors/transform-value.js +45 -0
- package/dist/behaviors/watch-field.d.ts +2 -0
- package/dist/behaviors/watch-field.js +21 -0
- package/dist/behaviors.js +26 -19
- package/dist/core/behavior/behavior-context.d.ts +26 -12
- package/dist/core/behavior/behavior-registry.d.ts +15 -27
- package/dist/core/behavior/behaviors/compute-from.d.ts +50 -21
- package/dist/core/behavior/behaviors/copy-from.d.ts +39 -14
- package/dist/core/behavior/behaviors/enable-when.d.ts +88 -19
- package/dist/core/behavior/behaviors/reset-when.d.ts +31 -18
- package/dist/core/behavior/behaviors/revalidate-when.d.ts +40 -17
- package/dist/core/behavior/behaviors/sync-fields.d.ts +34 -14
- package/dist/core/behavior/behaviors/transform-value.d.ts +116 -44
- package/dist/core/behavior/behaviors/watch-field.d.ts +66 -21
- package/dist/core/behavior/compose-behavior.d.ts +2 -12
- package/dist/core/behavior/index.d.ts +0 -1
- package/dist/core/behavior/types.d.ts +2 -8
- package/dist/core/factories/node-factory.d.ts +6 -29
- package/dist/core/nodes/array-node.d.ts +39 -19
- package/dist/core/nodes/field-node.d.ts +51 -26
- package/dist/core/nodes/form-node.d.ts +18 -20
- package/dist/core/nodes/group-node.d.ts +25 -21
- package/dist/core/types/deep-schema.d.ts +2 -12
- package/dist/core/types/field-path.d.ts +1 -1
- package/dist/core/types/form-context.d.ts +26 -26
- package/dist/core/types/form-proxy.d.ts +2 -32
- package/dist/core/types/index.d.ts +51 -5
- package/dist/core/types/validation-schema.d.ts +3 -12
- package/dist/core/utils/abstract-registry.d.ts +74 -0
- package/dist/core/utils/aggregate-signals.d.ts +71 -0
- package/dist/core/utils/create-form.d.ts +1 -18
- package/dist/core/utils/error-handler.d.ts +1 -18
- package/dist/core/utils/field-path-navigator.d.ts +1 -1
- package/dist/core/utils/field-path.d.ts +23 -11
- package/dist/core/utils/form-observer.d.ts +176 -0
- package/dist/core/utils/form-proxy-builder.d.ts +25 -0
- package/dist/core/utils/form-submitter.d.ts +121 -0
- package/dist/core/utils/index.d.ts +9 -2
- package/dist/core/utils/registry-helpers.d.ts +0 -7
- package/dist/core/utils/safe-effect.d.ts +73 -0
- package/dist/core/utils/status-machine.d.ts +153 -0
- package/dist/core/utils/type-guards.d.ts +5 -23
- package/dist/core/utils/unique-id.d.ts +53 -0
- package/dist/core/validation/core/apply-when.d.ts +3 -9
- package/dist/core/validation/core/apply.d.ts +2 -13
- package/dist/core/validation/core/validate-async.d.ts +2 -8
- package/dist/core/validation/core/validate-tree.d.ts +0 -6
- package/dist/core/validation/core/validate.d.ts +1 -7
- package/dist/core/validation/index.d.ts +8 -2
- package/dist/core/validation/validate-form.d.ts +1 -38
- package/dist/core/validation/validation-applicator.d.ts +2 -21
- package/dist/core/validation/validation-context.d.ts +58 -42
- package/dist/core/validation/validation-registry.d.ts +11 -25
- package/dist/core/validation/validators/array-validators.d.ts +2 -12
- package/dist/core/validation/validators/date-utils.d.ts +26 -0
- package/dist/core/validation/validators/email.d.ts +2 -9
- package/dist/core/validation/validators/future-date.d.ts +35 -0
- package/dist/core/validation/validators/index.d.ts +7 -1
- package/dist/core/validation/validators/is-date.d.ts +36 -0
- package/dist/core/validation/validators/max-age.d.ts +36 -0
- package/dist/core/validation/validators/max-date.d.ts +36 -0
- package/dist/core/validation/validators/max-length.d.ts +3 -10
- package/dist/core/validation/validators/max.d.ts +3 -10
- package/dist/core/validation/validators/min-age.d.ts +36 -0
- package/dist/core/validation/validators/min-date.d.ts +36 -0
- package/dist/core/validation/validators/min-length.d.ts +3 -10
- package/dist/core/validation/validators/min.d.ts +3 -10
- package/dist/core/validation/validators/number.d.ts +2 -9
- package/dist/core/validation/validators/past-date.d.ts +35 -0
- package/dist/core/validation/validators/pattern.d.ts +2 -9
- package/dist/core/validation/validators/phone.d.ts +2 -9
- package/dist/core/validation/validators/required.d.ts +2 -9
- package/dist/core/validation/validators/url.d.ts +2 -9
- package/dist/date-utils-xUWFslTj.js +29 -0
- package/dist/field-path-DuKdGcIE.js +66 -0
- package/dist/hooks/types.d.ts +1 -1
- package/dist/hooks/useArrayLength.d.ts +31 -0
- package/dist/hooks/useFormControl.d.ts +4 -4
- package/dist/hooks/useFormControlValue.d.ts +2 -2
- package/dist/hooks/useHiddenCondition.d.ts +25 -0
- package/dist/hooks/useSignalSubscription.d.ts +1 -1
- package/dist/index-D25LsbRm.js +73 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1171 -786
- package/dist/registry-helpers-Bv_BJ1s-.js +615 -0
- package/dist/safe-effect-Dh8uw81c.js +20 -0
- package/dist/validate-C3XiA_zf.js +10 -0
- package/dist/validators/email.d.ts +2 -0
- package/dist/validators/email.js +13 -0
- package/dist/validators/future-date.d.ts +2 -0
- package/dist/validators/future-date.js +20 -0
- package/dist/validators/is-date.d.ts +2 -0
- package/dist/validators/is-date.js +12 -0
- package/dist/validators/max-age.d.ts +2 -0
- package/dist/validators/max-age.js +20 -0
- package/dist/validators/max-date.d.ts +2 -0
- package/dist/validators/max-date.js +20 -0
- package/dist/validators/max-length.d.ts +2 -0
- package/dist/validators/max-length.js +11 -0
- package/dist/validators/max.d.ts +2 -0
- package/dist/validators/max.js +11 -0
- package/dist/validators/min-age.d.ts +2 -0
- package/dist/validators/min-age.js +20 -0
- package/dist/validators/min-date.d.ts +2 -0
- package/dist/validators/min-date.js +20 -0
- package/dist/validators/min-length.d.ts +2 -0
- package/dist/validators/min-length.js +11 -0
- package/dist/validators/min.d.ts +2 -0
- package/dist/validators/min.js +11 -0
- package/dist/validators/number.d.ts +2 -0
- package/dist/validators/number.js +35 -0
- package/dist/validators/past-date.d.ts +2 -0
- package/dist/validators/past-date.js +20 -0
- package/dist/validators/pattern.d.ts +2 -0
- package/dist/validators/pattern.js +11 -0
- package/dist/validators/phone.d.ts +2 -0
- package/dist/validators/phone.js +35 -0
- package/dist/validators/required.d.ts +2 -0
- package/dist/validators/required.js +15 -0
- package/dist/validators/url.d.ts +2 -0
- package/dist/validators/url.js +19 -0
- package/dist/validators-BGsNOgT1.js +207 -0
- package/dist/validators.js +54 -29
- package/llms.txt +7878 -311
- package/package.json +83 -9
- package/dist/behaviors-DzYL8kY_.js +0 -499
- package/dist/core/behavior/create-field-path.d.ts +0 -7
- package/dist/core/context/form-context-impl.d.ts +0 -29
- package/dist/core/utils/debounce.d.ts +0 -160
- package/dist/core/utils/resources.d.ts +0 -41
- package/dist/core/validation/field-path.d.ts +0 -7
- package/dist/core/validation/validators/date.d.ts +0 -38
- package/dist/registry-helpers-BRxAr6nG.js +0 -490
- package/dist/validators-gXoHPdqM.js +0 -418
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Debouncer - утилита для отложенного выполнения функций
|
|
3
|
-
*
|
|
4
|
-
* Устраняет дублирование debounce логики между field-node.ts и behavior-registry.ts
|
|
5
|
-
*
|
|
6
|
-
* @internal
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```typescript
|
|
10
|
-
* const debouncer = new Debouncer(300);
|
|
11
|
-
*
|
|
12
|
-
* // Отложить выполнение на 300мс
|
|
13
|
-
* await debouncer.debounce(async () => {
|
|
14
|
-
* await validateField();
|
|
15
|
-
* });
|
|
16
|
-
*
|
|
17
|
-
* // Отменить отложенное выполнение
|
|
18
|
-
* debouncer.cancel();
|
|
19
|
-
*
|
|
20
|
-
* // Выполнить немедленно, отменив отложенное
|
|
21
|
-
* await debouncer.flush(async () => {
|
|
22
|
-
* await validateField();
|
|
23
|
-
* });
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* Класс для debouncing (отложенного выполнения) функций
|
|
28
|
-
*
|
|
29
|
-
* @internal
|
|
30
|
-
*
|
|
31
|
-
* Откладывает выполнение функции на заданное время. Если функция вызывается
|
|
32
|
-
* повторно до истечения времени, предыдущий вызов отменяется.
|
|
33
|
-
*
|
|
34
|
-
* Полезно для:
|
|
35
|
-
* - Отложенной валидации при вводе (debounced validation)
|
|
36
|
-
* - Отложенного сохранения данных
|
|
37
|
-
* - Отложенной обработки событий behaviors
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```typescript
|
|
41
|
-
* // В FieldNode
|
|
42
|
-
* class FieldNode {
|
|
43
|
-
* private validationDebouncer: Debouncer;
|
|
44
|
-
*
|
|
45
|
-
* constructor(config) {
|
|
46
|
-
* this.validationDebouncer = new Debouncer(config.debounce || 0);
|
|
47
|
-
* }
|
|
48
|
-
*
|
|
49
|
-
* async validate(): Promise<boolean> {
|
|
50
|
-
* return this.validationDebouncer.debounce(async () => {
|
|
51
|
-
* // Валидация выполнится через debounce мс
|
|
52
|
-
* return await this.runValidation();
|
|
53
|
-
* });
|
|
54
|
-
* }
|
|
55
|
-
* }
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
export declare class Debouncer {
|
|
59
|
-
private readonly delay;
|
|
60
|
-
/**
|
|
61
|
-
* Таймер для отложенного выполнения
|
|
62
|
-
* @private
|
|
63
|
-
*/
|
|
64
|
-
private timer?;
|
|
65
|
-
/**
|
|
66
|
-
* Создать Debouncer с заданной задержкой
|
|
67
|
-
*
|
|
68
|
-
* @param delay Задержка в миллисекундах (0 = без задержки)
|
|
69
|
-
*
|
|
70
|
-
* @example
|
|
71
|
-
* ```typescript
|
|
72
|
-
* const debouncer = new Debouncer(300); // 300мс задержка
|
|
73
|
-
* const immediate = new Debouncer(0); // Без задержки
|
|
74
|
-
* ```
|
|
75
|
-
*/
|
|
76
|
-
constructor(delay: number);
|
|
77
|
-
/**
|
|
78
|
-
* Отложить выполнение функции
|
|
79
|
-
*
|
|
80
|
-
* Если вызывается повторно до истечения delay, предыдущий вызов отменяется
|
|
81
|
-
* и таймер перезапускается.
|
|
82
|
-
*
|
|
83
|
-
* @param fn Функция для выполнения (может быть async)
|
|
84
|
-
* @returns Promise, который разрешается результатом функции
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* ```typescript
|
|
88
|
-
* const debouncer = new Debouncer(300);
|
|
89
|
-
*
|
|
90
|
-
* // Первый вызов - запланирован через 300мс
|
|
91
|
-
* debouncer.debounce(async () => console.log('First'));
|
|
92
|
-
*
|
|
93
|
-
* // Второй вызов через 100мс - отменяет первый, запланирован через 300мс
|
|
94
|
-
* debouncer.debounce(async () => console.log('Second'));
|
|
95
|
-
*
|
|
96
|
-
* // Через 300мс выведет только: "Second"
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
debounce<T>(fn: () => T | Promise<T>): Promise<T>;
|
|
100
|
-
/**
|
|
101
|
-
* Отменить отложенное выполнение
|
|
102
|
-
*
|
|
103
|
-
* Если есть запланированный вызов, он будет отменен и не выполнится.
|
|
104
|
-
* Promise из debounce() никогда не разрешится.
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* ```typescript
|
|
108
|
-
* const debouncer = new Debouncer(300);
|
|
109
|
-
*
|
|
110
|
-
* debouncer.debounce(async () => {
|
|
111
|
-
* console.log('This will not execute');
|
|
112
|
-
* });
|
|
113
|
-
*
|
|
114
|
-
* debouncer.cancel(); // Отменяем вызов
|
|
115
|
-
* ```
|
|
116
|
-
*/
|
|
117
|
-
cancel(): void;
|
|
118
|
-
/**
|
|
119
|
-
* Выполнить функцию немедленно, отменив любой отложенный вызов
|
|
120
|
-
*
|
|
121
|
-
* Полезно когда нужно принудительно выполнить действие сейчас,
|
|
122
|
-
* игнорируя debounce.
|
|
123
|
-
*
|
|
124
|
-
* @param fn Функция для немедленного выполнения
|
|
125
|
-
* @returns Promise с результатом функции
|
|
126
|
-
*
|
|
127
|
-
* @example
|
|
128
|
-
* ```typescript
|
|
129
|
-
* const debouncer = new Debouncer(300);
|
|
130
|
-
*
|
|
131
|
-
* // Запланировано через 300мс
|
|
132
|
-
* debouncer.debounce(async () => console.log('Delayed'));
|
|
133
|
-
*
|
|
134
|
-
* // Отменяем отложенный и выполняем немедленно
|
|
135
|
-
* await debouncer.flush(async () => console.log('Immediate'));
|
|
136
|
-
* // Выведет: "Immediate" (сразу)
|
|
137
|
-
* // "Delayed" не выполнится (отменен)
|
|
138
|
-
* ```
|
|
139
|
-
*/
|
|
140
|
-
flush<T>(fn: () => T | Promise<T>): Promise<T>;
|
|
141
|
-
/**
|
|
142
|
-
* Проверить, есть ли активный (запланированный) вызов
|
|
143
|
-
*
|
|
144
|
-
* @returns true если есть запланированный вызов
|
|
145
|
-
*
|
|
146
|
-
* @example
|
|
147
|
-
* ```typescript
|
|
148
|
-
* const debouncer = new Debouncer(300);
|
|
149
|
-
*
|
|
150
|
-
* console.log(debouncer.isPending()); // false
|
|
151
|
-
*
|
|
152
|
-
* debouncer.debounce(() => console.log('Test'));
|
|
153
|
-
* console.log(debouncer.isPending()); // true
|
|
154
|
-
*
|
|
155
|
-
* // Через 300мс
|
|
156
|
-
* console.log(debouncer.isPending()); // false
|
|
157
|
-
* ```
|
|
158
|
-
*/
|
|
159
|
-
isPending(): boolean;
|
|
160
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export interface ResourceItem<T> {
|
|
2
|
-
id: string | number;
|
|
3
|
-
label: string;
|
|
4
|
-
description: string;
|
|
5
|
-
value: T;
|
|
6
|
-
[key: string]: unknown;
|
|
7
|
-
}
|
|
8
|
-
export interface ResourceResult<T> {
|
|
9
|
-
items: ResourceItem<T>[];
|
|
10
|
-
totalCount: number;
|
|
11
|
-
}
|
|
12
|
-
export interface ResourceConfig<T> {
|
|
13
|
-
type: 'static' | 'preload' | 'partial';
|
|
14
|
-
load: (params?: ResourceLoadParams) => Promise<ResourceResult<T>>;
|
|
15
|
-
}
|
|
16
|
-
export interface ResourceLoadParams {
|
|
17
|
-
search?: string;
|
|
18
|
-
page?: number;
|
|
19
|
-
pageSize?: number;
|
|
20
|
-
[key: string]: unknown;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Статический ресурс - данные загружаются один раз
|
|
24
|
-
* @param items - массив элементов
|
|
25
|
-
*/
|
|
26
|
-
export declare function staticResource<T>(items: ResourceItem<T>[]): ResourceConfig<T>;
|
|
27
|
-
/**
|
|
28
|
-
* Предзагрузка - данные загружаются один раз при первом обращении через функцию
|
|
29
|
-
* @param loader - функция загрузки, принимает параметры и возвращает массив
|
|
30
|
-
*/
|
|
31
|
-
export declare function preloadResource<T>(loader: (params?: ResourceLoadParams) => Promise<ResourceItem<T>[]>): ResourceConfig<T>;
|
|
32
|
-
/**
|
|
33
|
-
* Парциональная загрузка - данные загружаются порциями с учетом поиска/пагинации
|
|
34
|
-
* @param loader - функция загрузки, принимает параметры и возвращает массив
|
|
35
|
-
*/
|
|
36
|
-
export declare function partialResource<T>(loader: (params?: ResourceLoadParams) => Promise<ResourceItem<T>[]>): ResourceConfig<T>;
|
|
37
|
-
export declare const Resources: {
|
|
38
|
-
static: typeof staticResource;
|
|
39
|
-
preload: typeof preloadResource;
|
|
40
|
-
partial: typeof partialResource;
|
|
41
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* FieldPath proxy - типобезопасный доступ к путям полей формы
|
|
3
|
-
*
|
|
4
|
-
* @deprecated Импортируйте из '../utils/field-path' напрямую.
|
|
5
|
-
* Этот файл оставлен для обратной совместимости.
|
|
6
|
-
*/
|
|
7
|
-
export { createFieldPath, extractPath, extractKey, toFieldPath } from '../utils/field-path';
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Валидатор даты
|
|
3
|
-
*
|
|
4
|
-
* @group Validation
|
|
5
|
-
* @category Validators
|
|
6
|
-
* @module validators/date
|
|
7
|
-
*/
|
|
8
|
-
import type { ValidateOptions } from '../../types/validation-schema';
|
|
9
|
-
import type { FieldPathNode } from '../../types';
|
|
10
|
-
/**
|
|
11
|
-
* Адаптер для date валидатора
|
|
12
|
-
* Проверяет, что значение является валидной датой и соответствует ограничениям
|
|
13
|
-
*
|
|
14
|
-
* @group Validation
|
|
15
|
-
* @category Validators
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```typescript
|
|
19
|
-
* date(path.birthDate);
|
|
20
|
-
* date(path.birthDate, { maxDate: new Date() }); // Не позже сегодня
|
|
21
|
-
* date(path.eventDate, { minDate: new Date(), message: 'Дата не может быть в прошлом' });
|
|
22
|
-
* date(path.age, { minAge: 18, maxAge: 100 });
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export declare function date<TForm, TField extends string | Date | undefined = string | Date>(fieldPath: FieldPathNode<TForm, TField> | undefined, options?: ValidateOptions & {
|
|
26
|
-
/** Минимальная дата (включительно) */
|
|
27
|
-
minDate?: Date;
|
|
28
|
-
/** Максимальная дата (включительно) */
|
|
29
|
-
maxDate?: Date;
|
|
30
|
-
/** Минимальный возраст (для дат рождения) */
|
|
31
|
-
minAge?: number;
|
|
32
|
-
/** Максимальный возраст (для дат рождения) */
|
|
33
|
-
maxAge?: number;
|
|
34
|
-
/** Не разрешать будущие даты */
|
|
35
|
-
noFuture?: boolean;
|
|
36
|
-
/** Не разрешать прошлые даты */
|
|
37
|
-
noPast?: boolean;
|
|
38
|
-
}): void;
|