adaptform 2.0.1 → 2.0.3
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-DOdrOtbT.d.cts +213 -0
- package/dist/Form-DOdrOtbT.d.ts +213 -0
- package/dist/index.cjs +970 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -223
- package/dist/index.d.ts +40 -223
- package/dist/index.mjs +961 -57
- package/dist/index.mjs.map +1 -1
- package/dist/luxon.cjs +122 -0
- package/dist/luxon.cjs.map +1 -0
- package/dist/luxon.d.cts +26 -0
- package/dist/luxon.d.ts +26 -0
- package/dist/luxon.mjs +120 -0
- package/dist/luxon.mjs.map +1 -0
- package/package.json +19 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,225 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
maxLength?: string;
|
|
21
|
-
pattern?: string;
|
|
22
|
-
}
|
|
23
|
-
interface messagesNumberOptions extends messagesOptions {
|
|
24
|
-
gt?: string;
|
|
25
|
-
ge?: string;
|
|
26
|
-
lt?: string;
|
|
27
|
-
le?: string;
|
|
28
|
-
}
|
|
29
|
-
interface messagesBooleanOptions extends messagesOptions {
|
|
30
|
-
mustBeTrue?: string;
|
|
31
|
-
mustBeFalse?: string;
|
|
32
|
-
}
|
|
33
|
-
interface messagesDateOptions extends messagesOptions {
|
|
34
|
-
minDate?: string;
|
|
35
|
-
maxDate?: string;
|
|
36
|
-
}
|
|
37
|
-
interface messagesDateLuxonOptions extends messagesOptions {
|
|
38
|
-
minDate?: string;
|
|
39
|
-
maxDate?: string;
|
|
40
|
-
}
|
|
41
|
-
interface messagesDecimalOptions extends messagesOptions {
|
|
42
|
-
gt?: string;
|
|
43
|
-
ge?: string;
|
|
44
|
-
lt?: string;
|
|
45
|
-
le?: string;
|
|
46
|
-
decimalPlaces?: string;
|
|
47
|
-
maxDigits?: string;
|
|
48
|
-
}
|
|
49
|
-
interface messagesArrayFieldOptions extends messagesOptions {
|
|
50
|
-
minItems?: string;
|
|
51
|
-
maxItems?: string;
|
|
52
|
-
}
|
|
53
|
-
interface messagesArrayFormFieldOptions extends messagesOptions {
|
|
54
|
-
minForms?: string;
|
|
55
|
-
maxForms?: string;
|
|
56
|
-
}
|
|
57
|
-
interface FieldOptions {
|
|
58
|
-
isRequired?: boolean | ((form?: any) => boolean);
|
|
59
|
-
messages?: messagesOptions;
|
|
60
|
-
validate?: (value: any, form?: any) => boolean | string;
|
|
61
|
-
plugins?: FieldPlugin[];
|
|
62
|
-
}
|
|
63
|
-
interface StringOptions extends FieldOptions {
|
|
64
|
-
minLength?: number;
|
|
65
|
-
maxLength?: number;
|
|
66
|
-
pattern?: RegExp;
|
|
67
|
-
messages?: messagesStringOptions;
|
|
68
|
-
}
|
|
69
|
-
interface NumberOptions extends FieldOptions {
|
|
70
|
-
gt?: number;
|
|
71
|
-
ge?: number;
|
|
72
|
-
lt?: number;
|
|
73
|
-
le?: number;
|
|
74
|
-
messages?: messagesNumberOptions;
|
|
75
|
-
}
|
|
76
|
-
interface BooleanOptions extends FieldOptions {
|
|
77
|
-
mustBeTrue?: boolean;
|
|
78
|
-
mustBeFalse?: boolean;
|
|
79
|
-
messages?: messagesBooleanOptions;
|
|
80
|
-
}
|
|
81
|
-
interface DateOptions extends FieldOptions {
|
|
82
|
-
minDate?: Date;
|
|
83
|
-
maxDate?: Date;
|
|
84
|
-
isDatetime?: boolean;
|
|
85
|
-
messages?: messagesDateOptions;
|
|
86
|
-
}
|
|
87
|
-
interface DateLuxonOptions extends FieldOptions {
|
|
88
|
-
minDate?: any;
|
|
89
|
-
maxDate?: any;
|
|
90
|
-
inputFormat?: string;
|
|
91
|
-
outputFormat?: string;
|
|
92
|
-
isDatetime?: boolean;
|
|
93
|
-
messages?: messagesDateLuxonOptions;
|
|
94
|
-
}
|
|
95
|
-
interface DecimalOptions extends FieldOptions {
|
|
96
|
-
gt?: number;
|
|
97
|
-
ge?: number;
|
|
98
|
-
lt?: number;
|
|
99
|
-
le?: number;
|
|
100
|
-
decimalPlaces?: number;
|
|
101
|
-
maxDigits?: number;
|
|
102
|
-
messages?: messagesDecimalOptions;
|
|
103
|
-
}
|
|
104
|
-
interface ArrayFieldOptions {
|
|
105
|
-
isRequired?: boolean | ((form?: any) => boolean);
|
|
106
|
-
messages?: messagesArrayFieldOptions;
|
|
107
|
-
validate?: (value: any[], form?: any) => boolean | string;
|
|
108
|
-
minItems?: number;
|
|
109
|
-
maxItems?: number;
|
|
110
|
-
}
|
|
111
|
-
interface ArrayFormFieldOptions {
|
|
112
|
-
isRequired?: boolean | ((form?: any) => boolean);
|
|
113
|
-
messages?: messagesArrayFormFieldOptions;
|
|
114
|
-
validate?: (value: any[], form?: any) => boolean | string;
|
|
115
|
-
minForms?: number;
|
|
116
|
-
maxForms?: number;
|
|
117
|
-
}
|
|
118
|
-
interface PluginOptions {
|
|
119
|
-
priority?: number;
|
|
120
|
-
}
|
|
121
|
-
interface MaskPluginOptions {
|
|
122
|
-
maskFormat: string;
|
|
123
|
-
maskPlaceholder: string;
|
|
124
|
-
digitPattern: RegExp;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
declare abstract class FieldType<T, O extends FieldOptions = FieldOptions> {
|
|
128
|
-
options: O;
|
|
129
|
-
constructor(options: O);
|
|
130
|
-
abstract cast(rawValue: any): T | null;
|
|
131
|
-
abstract validate(value: T, form?: Form): string[];
|
|
132
|
-
abstract getTypeName(): string;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
type FieldTypeConstructor<T, O extends FieldOptions = FieldOptions> = new (options: O) => FieldType<T, O>;
|
|
136
|
-
declare class Field<T = any, O extends FieldOptions = FieldOptions> {
|
|
137
|
-
protected _rawValue: any;
|
|
138
|
-
protected _valueClear: T | null;
|
|
139
|
-
protected filed_type: FieldType<T, O>;
|
|
140
|
-
protected defaultValue: T | null;
|
|
141
|
-
protected _errors: string[];
|
|
142
|
-
isValid: boolean | null;
|
|
143
|
-
isTouched: boolean;
|
|
144
|
-
constructor(TypeConstructor: FieldTypeConstructor<T, O>, defaultValue?: T | null, options?: O | null);
|
|
145
|
-
protected get plugins(): FieldPlugin<any>[];
|
|
146
|
-
get options(): O;
|
|
147
|
-
set options(options: O);
|
|
148
|
-
get rawValue(): T | null;
|
|
149
|
-
set rawValue(input: any);
|
|
150
|
-
get errors(): string[];
|
|
151
|
-
get error(): string;
|
|
152
|
-
set error(message: string | null);
|
|
153
|
-
get valueClear(): any;
|
|
154
|
-
private isRequired;
|
|
155
|
-
checkValid(form?: Form): boolean;
|
|
156
|
-
checkAndSetValid(form?: Form): boolean;
|
|
157
|
-
get isEmpty(): boolean;
|
|
158
|
-
reset(): void;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
declare class ArrayField<T = any> {
|
|
162
|
-
protected factory: (value?: T) => Field<T>;
|
|
163
|
-
protected options: ArrayFieldOptions;
|
|
164
|
-
protected _items: Field<T>[];
|
|
165
|
-
protected _errors: string[];
|
|
166
|
-
isTouched: boolean;
|
|
167
|
-
constructor(factory: (value?: T) => Field<T>, options?: ArrayFieldOptions, initial?: T[]);
|
|
168
|
-
set itemsValue(items: T[]);
|
|
169
|
-
get itemsValue(): T[];
|
|
170
|
-
get items(): Field<T>[];
|
|
171
|
-
add(value?: T, force_check?: boolean): Field<T>;
|
|
172
|
-
remove(index: number): void;
|
|
173
|
-
clear(): void;
|
|
174
|
-
private isRequired;
|
|
175
|
-
checkValid(form?: Form): boolean;
|
|
176
|
-
checkAndSetValid(form?: Form): boolean;
|
|
177
|
-
get isValid(): boolean;
|
|
178
|
-
get error(): string;
|
|
179
|
-
set error(message: string | null);
|
|
180
|
-
get errors(): string[];
|
|
181
|
-
reset(): void;
|
|
1
|
+
import { B as BasePlugin, M as MaskPluginOptions, P as PluginOptions, F as Field, a as FieldType, S as StringOptions, N as NumberOptions, D as DecimalOptions, b as BooleanOptions, c as DateOptions } from './Form-DOdrOtbT.js';
|
|
2
|
+
export { o as ArrayField, A as ArrayFieldOptions, p as ArrayFormField, n as ArrayFormFieldOptions, l as FieldOptions, q as FieldPlugin, d as Form, j as messagesArrayFieldOptions, k as messagesArrayFormFieldOptions, g as messagesBooleanOptions, h as messagesDateOptions, i as messagesDecimalOptions, f as messagesNumberOptions, m as messagesOptions, e as messagesStringOptions } from './Form-DOdrOtbT.js';
|
|
3
|
+
|
|
4
|
+
declare class MaskPlugin extends BasePlugin {
|
|
5
|
+
private config;
|
|
6
|
+
private maskParts;
|
|
7
|
+
constructor(config: MaskPluginOptions, pluginOptions?: PluginOptions);
|
|
8
|
+
init(field: Field<any>): void;
|
|
9
|
+
toRawValue(value: string, field: Field): string;
|
|
10
|
+
toValueClear(value: string, field: Field): string;
|
|
11
|
+
private parseMask;
|
|
12
|
+
private applyMask;
|
|
13
|
+
private removeMask;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare class StringType extends FieldType<string, StringOptions> {
|
|
17
|
+
cast(rawValue: any): string | null;
|
|
18
|
+
validate(value: string): string[];
|
|
19
|
+
getTypeName(): string;
|
|
182
20
|
}
|
|
183
21
|
|
|
184
|
-
declare class
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
private _errors;
|
|
189
|
-
isTouched: boolean;
|
|
190
|
-
constructor(FormConstructor: new () => T, options?: ArrayFormFieldOptions, initial?: any[]);
|
|
191
|
-
set forms(forms: any[]);
|
|
192
|
-
get forms(): Form[];
|
|
193
|
-
get formsFieldsValue(): any[];
|
|
194
|
-
add(data?: any, force_check?: boolean): T;
|
|
195
|
-
remove(index: number): void;
|
|
196
|
-
clear(): void;
|
|
197
|
-
reset(): void;
|
|
198
|
-
private isRequired;
|
|
199
|
-
checkValid(form?: Form): boolean;
|
|
200
|
-
checkAndSetValid(form?: Form): boolean;
|
|
201
|
-
get isValid(): boolean;
|
|
202
|
-
get errors(): string[];
|
|
203
|
-
get error(): string;
|
|
204
|
-
set error(message: string | null);
|
|
22
|
+
declare class NumberType extends FieldType<number, NumberOptions> {
|
|
23
|
+
cast(rawValue: any): number | null;
|
|
24
|
+
validate(value: number): string[];
|
|
25
|
+
getTypeName(): string;
|
|
205
26
|
}
|
|
206
27
|
|
|
207
|
-
declare
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
set errors(errors: Record<string, string>);
|
|
216
|
-
setGlobalError(key: string, message: string): void;
|
|
217
|
-
clearGlobalErrors(): void;
|
|
218
|
-
reset(): void;
|
|
219
|
-
get isTouched(): boolean;
|
|
220
|
-
get isValid(): boolean;
|
|
221
|
-
toFormData(): FormData;
|
|
222
|
-
toJSON(): Record<string, any>;
|
|
28
|
+
declare class DecimalType extends FieldType<number | string, DecimalOptions> {
|
|
29
|
+
constructor(options?: DecimalOptions);
|
|
30
|
+
cast(rawValue: any): number | string | null;
|
|
31
|
+
private castString;
|
|
32
|
+
validate(value: number | string): string[];
|
|
33
|
+
private isValidNumberString;
|
|
34
|
+
private numberToString;
|
|
35
|
+
getTypeName(): string;
|
|
223
36
|
}
|
|
224
37
|
|
|
225
38
|
declare class BooleanType extends FieldType<boolean, BooleanOptions> {
|
|
@@ -228,9 +41,13 @@ declare class BooleanType extends FieldType<boolean, BooleanOptions> {
|
|
|
228
41
|
getTypeName(): string;
|
|
229
42
|
}
|
|
230
43
|
|
|
231
|
-
declare
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
44
|
+
declare class DateType extends FieldType<Date, DateOptions> {
|
|
45
|
+
constructor(options?: DateOptions);
|
|
46
|
+
cast(rawValue: any): Date | null;
|
|
47
|
+
validate(value: Date): string[];
|
|
48
|
+
getTypeName(): string;
|
|
49
|
+
private compareDates;
|
|
50
|
+
private toDateOnly;
|
|
51
|
+
}
|
|
235
52
|
|
|
236
|
-
export {
|
|
53
|
+
export { BasePlugin, BooleanOptions, BooleanType, DateOptions, DateType, DecimalOptions, DecimalType, Field, FieldType, MaskPlugin, MaskPluginOptions, NumberOptions, NumberType, PluginOptions, StringOptions, StringType };
|