adaptform 2.0.2 → 2.0.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/dist/Form-DOdrOtbT.d.cts +213 -0
- package/dist/Form-DOdrOtbT.d.ts +213 -0
- package/dist/index.cjs +0 -61
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -229
- package/dist/index.d.ts +3 -229
- package/dist/index.mjs +1 -58
- 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 +13 -5
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
interface FieldPlugin<T = any> {
|
|
2
|
+
pluginOptions?: PluginOptions;
|
|
3
|
+
init?(field: Field<T>): void;
|
|
4
|
+
toRawValue?(value: any, field: Field<T>): any;
|
|
5
|
+
toValueClear?(value: any, field: Field<T>): any;
|
|
6
|
+
}
|
|
7
|
+
declare abstract class BasePlugin<T = any> implements FieldPlugin<T> {
|
|
8
|
+
pluginOptions: PluginOptions;
|
|
9
|
+
constructor(pluginOptions?: PluginOptions);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare class ArrayField<T = any> {
|
|
13
|
+
protected factory: (value?: T) => Field<T>;
|
|
14
|
+
protected options: ArrayFieldOptions;
|
|
15
|
+
protected _items: Field<T>[];
|
|
16
|
+
protected _errors: string[];
|
|
17
|
+
isTouched: boolean;
|
|
18
|
+
constructor(factory: (value?: T) => Field<T>, options?: ArrayFieldOptions, initial?: T[]);
|
|
19
|
+
set itemsValue(items: T[]);
|
|
20
|
+
get itemsValue(): T[];
|
|
21
|
+
get items(): Field<T>[];
|
|
22
|
+
add(value?: T, force_check?: boolean): Field<T>;
|
|
23
|
+
remove(index: number): void;
|
|
24
|
+
clear(): void;
|
|
25
|
+
private isRequired;
|
|
26
|
+
checkValid(form?: Form): boolean;
|
|
27
|
+
checkAndSetValid(form?: Form): boolean;
|
|
28
|
+
get isValid(): boolean;
|
|
29
|
+
get error(): string;
|
|
30
|
+
set error(message: string | null);
|
|
31
|
+
get errors(): string[];
|
|
32
|
+
reset(): void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare class ArrayFormField<T extends Form = Form> {
|
|
36
|
+
private FormConstructor;
|
|
37
|
+
private options;
|
|
38
|
+
private _forms;
|
|
39
|
+
private _errors;
|
|
40
|
+
isTouched: boolean;
|
|
41
|
+
constructor(FormConstructor: new () => T, options?: ArrayFormFieldOptions, initial?: any[]);
|
|
42
|
+
set forms(forms: any[]);
|
|
43
|
+
get forms(): Form[];
|
|
44
|
+
get formsFieldsValue(): any[];
|
|
45
|
+
add(data?: any, force_check?: boolean): T;
|
|
46
|
+
remove(index: number): void;
|
|
47
|
+
clear(): void;
|
|
48
|
+
reset(): void;
|
|
49
|
+
private isRequired;
|
|
50
|
+
checkValid(form?: Form): boolean;
|
|
51
|
+
checkAndSetValid(form?: Form): boolean;
|
|
52
|
+
get isValid(): boolean;
|
|
53
|
+
get errors(): string[];
|
|
54
|
+
get error(): string;
|
|
55
|
+
set error(message: string | null);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface messagesOptions {
|
|
59
|
+
isRequired?: string;
|
|
60
|
+
validate?: string;
|
|
61
|
+
type?: string;
|
|
62
|
+
invalid?: string;
|
|
63
|
+
}
|
|
64
|
+
interface messagesStringOptions extends messagesOptions {
|
|
65
|
+
minLength?: string;
|
|
66
|
+
maxLength?: string;
|
|
67
|
+
pattern?: string;
|
|
68
|
+
}
|
|
69
|
+
interface messagesNumberOptions extends messagesOptions {
|
|
70
|
+
gt?: string;
|
|
71
|
+
ge?: string;
|
|
72
|
+
lt?: string;
|
|
73
|
+
le?: string;
|
|
74
|
+
}
|
|
75
|
+
interface messagesBooleanOptions extends messagesOptions {
|
|
76
|
+
mustBeTrue?: string;
|
|
77
|
+
mustBeFalse?: string;
|
|
78
|
+
}
|
|
79
|
+
interface messagesDateOptions extends messagesOptions {
|
|
80
|
+
minDate?: string;
|
|
81
|
+
maxDate?: string;
|
|
82
|
+
}
|
|
83
|
+
interface messagesDecimalOptions extends messagesOptions {
|
|
84
|
+
gt?: string;
|
|
85
|
+
ge?: string;
|
|
86
|
+
lt?: string;
|
|
87
|
+
le?: string;
|
|
88
|
+
decimalPlaces?: string;
|
|
89
|
+
maxDigits?: string;
|
|
90
|
+
}
|
|
91
|
+
interface messagesArrayFieldOptions extends messagesOptions {
|
|
92
|
+
minItems?: string;
|
|
93
|
+
maxItems?: string;
|
|
94
|
+
}
|
|
95
|
+
interface messagesArrayFormFieldOptions extends messagesOptions {
|
|
96
|
+
minForms?: string;
|
|
97
|
+
maxForms?: string;
|
|
98
|
+
}
|
|
99
|
+
interface FieldOptions {
|
|
100
|
+
isRequired?: boolean | ((form?: any) => boolean);
|
|
101
|
+
messages?: messagesOptions;
|
|
102
|
+
validate?: (value: any, form?: any) => boolean | string;
|
|
103
|
+
plugins?: FieldPlugin[];
|
|
104
|
+
}
|
|
105
|
+
interface StringOptions extends FieldOptions {
|
|
106
|
+
minLength?: number;
|
|
107
|
+
maxLength?: number;
|
|
108
|
+
pattern?: RegExp;
|
|
109
|
+
messages?: messagesStringOptions;
|
|
110
|
+
}
|
|
111
|
+
interface NumberOptions extends FieldOptions {
|
|
112
|
+
gt?: number;
|
|
113
|
+
ge?: number;
|
|
114
|
+
lt?: number;
|
|
115
|
+
le?: number;
|
|
116
|
+
messages?: messagesNumberOptions;
|
|
117
|
+
}
|
|
118
|
+
interface BooleanOptions extends FieldOptions {
|
|
119
|
+
mustBeTrue?: boolean;
|
|
120
|
+
mustBeFalse?: boolean;
|
|
121
|
+
messages?: messagesBooleanOptions;
|
|
122
|
+
}
|
|
123
|
+
interface DateOptions extends FieldOptions {
|
|
124
|
+
minDate?: Date;
|
|
125
|
+
maxDate?: Date;
|
|
126
|
+
isDatetime?: boolean;
|
|
127
|
+
messages?: messagesDateOptions;
|
|
128
|
+
}
|
|
129
|
+
interface DecimalOptions extends FieldOptions {
|
|
130
|
+
gt?: number;
|
|
131
|
+
ge?: number;
|
|
132
|
+
lt?: number;
|
|
133
|
+
le?: number;
|
|
134
|
+
decimalPlaces?: number;
|
|
135
|
+
maxDigits?: number;
|
|
136
|
+
messages?: messagesDecimalOptions;
|
|
137
|
+
}
|
|
138
|
+
interface ArrayFieldOptions {
|
|
139
|
+
isRequired?: boolean | ((form?: any) => boolean);
|
|
140
|
+
messages?: messagesArrayFieldOptions;
|
|
141
|
+
validate?: (value: any[], form?: any) => boolean | string;
|
|
142
|
+
minItems?: number;
|
|
143
|
+
maxItems?: number;
|
|
144
|
+
}
|
|
145
|
+
interface ArrayFormFieldOptions {
|
|
146
|
+
isRequired?: boolean | ((form?: any) => boolean);
|
|
147
|
+
messages?: messagesArrayFormFieldOptions;
|
|
148
|
+
validate?: (value: any[], form?: any) => boolean | string;
|
|
149
|
+
minForms?: number;
|
|
150
|
+
maxForms?: number;
|
|
151
|
+
}
|
|
152
|
+
interface PluginOptions {
|
|
153
|
+
priority?: number;
|
|
154
|
+
}
|
|
155
|
+
interface MaskPluginOptions {
|
|
156
|
+
maskFormat: string;
|
|
157
|
+
maskPlaceholder: string;
|
|
158
|
+
digitPattern: RegExp;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
declare abstract class FieldType<T, O extends FieldOptions = FieldOptions> {
|
|
162
|
+
options: O;
|
|
163
|
+
constructor(options: O);
|
|
164
|
+
abstract cast(rawValue: any): T | null;
|
|
165
|
+
abstract validate(value: T, form?: Form): string[];
|
|
166
|
+
abstract getTypeName(): string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
type FieldTypeConstructor<T, O extends FieldOptions = FieldOptions> = new (options: O) => FieldType<T, O>;
|
|
170
|
+
declare class Field<T = any, O extends FieldOptions = FieldOptions> {
|
|
171
|
+
protected _rawValue: any;
|
|
172
|
+
protected _valueClear: T | null;
|
|
173
|
+
protected filed_type: FieldType<T, O>;
|
|
174
|
+
protected defaultValue: T | null;
|
|
175
|
+
protected _errors: string[];
|
|
176
|
+
isValid: boolean | null;
|
|
177
|
+
isTouched: boolean;
|
|
178
|
+
constructor(TypeConstructor: FieldTypeConstructor<T, O>, defaultValue?: T | null, options?: O | null);
|
|
179
|
+
protected get plugins(): FieldPlugin<any>[];
|
|
180
|
+
get options(): O;
|
|
181
|
+
set options(options: O);
|
|
182
|
+
get rawValue(): T | null;
|
|
183
|
+
set rawValue(input: any);
|
|
184
|
+
get errors(): string[];
|
|
185
|
+
get error(): string;
|
|
186
|
+
set error(message: string | null);
|
|
187
|
+
get valueClear(): any;
|
|
188
|
+
private isRequired;
|
|
189
|
+
checkValid(form?: Form): boolean;
|
|
190
|
+
checkAndSetValid(form?: Form): boolean;
|
|
191
|
+
get isEmpty(): boolean;
|
|
192
|
+
reset(): void;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
declare abstract class Form {
|
|
196
|
+
private _globalErrors;
|
|
197
|
+
protected get _fields(): Record<string, Field<any> | ArrayField<any> | ArrayFormField<any>>;
|
|
198
|
+
checkValid(form?: this): boolean;
|
|
199
|
+
get fieldsValue(): Record<string, any>;
|
|
200
|
+
set fields(data: Record<string, any>);
|
|
201
|
+
get allErrors(): Record<string, string[]>;
|
|
202
|
+
get globalErrors(): Record<string, string>;
|
|
203
|
+
set errors(errors: Record<string, string>);
|
|
204
|
+
setGlobalError(key: string, message: string): void;
|
|
205
|
+
clearGlobalErrors(): void;
|
|
206
|
+
reset(): void;
|
|
207
|
+
get isTouched(): boolean;
|
|
208
|
+
get isValid(): boolean;
|
|
209
|
+
toFormData(): FormData;
|
|
210
|
+
toJSON(): Record<string, any>;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export { type ArrayFieldOptions as A, BasePlugin as B, type DecimalOptions as D, Field as F, type MaskPluginOptions as M, type NumberOptions as N, type PluginOptions as P, type StringOptions as S, FieldType as a, type BooleanOptions as b, type DateOptions as c, Form as d, type messagesStringOptions as e, type messagesNumberOptions as f, type messagesBooleanOptions as g, type messagesDateOptions as h, type messagesDecimalOptions as i, type messagesArrayFieldOptions as j, type messagesArrayFormFieldOptions as k, type FieldOptions as l, type messagesOptions as m, type ArrayFormFieldOptions as n, ArrayField as o, ArrayFormField as p, type FieldPlugin as q };
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
interface FieldPlugin<T = any> {
|
|
2
|
+
pluginOptions?: PluginOptions;
|
|
3
|
+
init?(field: Field<T>): void;
|
|
4
|
+
toRawValue?(value: any, field: Field<T>): any;
|
|
5
|
+
toValueClear?(value: any, field: Field<T>): any;
|
|
6
|
+
}
|
|
7
|
+
declare abstract class BasePlugin<T = any> implements FieldPlugin<T> {
|
|
8
|
+
pluginOptions: PluginOptions;
|
|
9
|
+
constructor(pluginOptions?: PluginOptions);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare class ArrayField<T = any> {
|
|
13
|
+
protected factory: (value?: T) => Field<T>;
|
|
14
|
+
protected options: ArrayFieldOptions;
|
|
15
|
+
protected _items: Field<T>[];
|
|
16
|
+
protected _errors: string[];
|
|
17
|
+
isTouched: boolean;
|
|
18
|
+
constructor(factory: (value?: T) => Field<T>, options?: ArrayFieldOptions, initial?: T[]);
|
|
19
|
+
set itemsValue(items: T[]);
|
|
20
|
+
get itemsValue(): T[];
|
|
21
|
+
get items(): Field<T>[];
|
|
22
|
+
add(value?: T, force_check?: boolean): Field<T>;
|
|
23
|
+
remove(index: number): void;
|
|
24
|
+
clear(): void;
|
|
25
|
+
private isRequired;
|
|
26
|
+
checkValid(form?: Form): boolean;
|
|
27
|
+
checkAndSetValid(form?: Form): boolean;
|
|
28
|
+
get isValid(): boolean;
|
|
29
|
+
get error(): string;
|
|
30
|
+
set error(message: string | null);
|
|
31
|
+
get errors(): string[];
|
|
32
|
+
reset(): void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare class ArrayFormField<T extends Form = Form> {
|
|
36
|
+
private FormConstructor;
|
|
37
|
+
private options;
|
|
38
|
+
private _forms;
|
|
39
|
+
private _errors;
|
|
40
|
+
isTouched: boolean;
|
|
41
|
+
constructor(FormConstructor: new () => T, options?: ArrayFormFieldOptions, initial?: any[]);
|
|
42
|
+
set forms(forms: any[]);
|
|
43
|
+
get forms(): Form[];
|
|
44
|
+
get formsFieldsValue(): any[];
|
|
45
|
+
add(data?: any, force_check?: boolean): T;
|
|
46
|
+
remove(index: number): void;
|
|
47
|
+
clear(): void;
|
|
48
|
+
reset(): void;
|
|
49
|
+
private isRequired;
|
|
50
|
+
checkValid(form?: Form): boolean;
|
|
51
|
+
checkAndSetValid(form?: Form): boolean;
|
|
52
|
+
get isValid(): boolean;
|
|
53
|
+
get errors(): string[];
|
|
54
|
+
get error(): string;
|
|
55
|
+
set error(message: string | null);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
interface messagesOptions {
|
|
59
|
+
isRequired?: string;
|
|
60
|
+
validate?: string;
|
|
61
|
+
type?: string;
|
|
62
|
+
invalid?: string;
|
|
63
|
+
}
|
|
64
|
+
interface messagesStringOptions extends messagesOptions {
|
|
65
|
+
minLength?: string;
|
|
66
|
+
maxLength?: string;
|
|
67
|
+
pattern?: string;
|
|
68
|
+
}
|
|
69
|
+
interface messagesNumberOptions extends messagesOptions {
|
|
70
|
+
gt?: string;
|
|
71
|
+
ge?: string;
|
|
72
|
+
lt?: string;
|
|
73
|
+
le?: string;
|
|
74
|
+
}
|
|
75
|
+
interface messagesBooleanOptions extends messagesOptions {
|
|
76
|
+
mustBeTrue?: string;
|
|
77
|
+
mustBeFalse?: string;
|
|
78
|
+
}
|
|
79
|
+
interface messagesDateOptions extends messagesOptions {
|
|
80
|
+
minDate?: string;
|
|
81
|
+
maxDate?: string;
|
|
82
|
+
}
|
|
83
|
+
interface messagesDecimalOptions extends messagesOptions {
|
|
84
|
+
gt?: string;
|
|
85
|
+
ge?: string;
|
|
86
|
+
lt?: string;
|
|
87
|
+
le?: string;
|
|
88
|
+
decimalPlaces?: string;
|
|
89
|
+
maxDigits?: string;
|
|
90
|
+
}
|
|
91
|
+
interface messagesArrayFieldOptions extends messagesOptions {
|
|
92
|
+
minItems?: string;
|
|
93
|
+
maxItems?: string;
|
|
94
|
+
}
|
|
95
|
+
interface messagesArrayFormFieldOptions extends messagesOptions {
|
|
96
|
+
minForms?: string;
|
|
97
|
+
maxForms?: string;
|
|
98
|
+
}
|
|
99
|
+
interface FieldOptions {
|
|
100
|
+
isRequired?: boolean | ((form?: any) => boolean);
|
|
101
|
+
messages?: messagesOptions;
|
|
102
|
+
validate?: (value: any, form?: any) => boolean | string;
|
|
103
|
+
plugins?: FieldPlugin[];
|
|
104
|
+
}
|
|
105
|
+
interface StringOptions extends FieldOptions {
|
|
106
|
+
minLength?: number;
|
|
107
|
+
maxLength?: number;
|
|
108
|
+
pattern?: RegExp;
|
|
109
|
+
messages?: messagesStringOptions;
|
|
110
|
+
}
|
|
111
|
+
interface NumberOptions extends FieldOptions {
|
|
112
|
+
gt?: number;
|
|
113
|
+
ge?: number;
|
|
114
|
+
lt?: number;
|
|
115
|
+
le?: number;
|
|
116
|
+
messages?: messagesNumberOptions;
|
|
117
|
+
}
|
|
118
|
+
interface BooleanOptions extends FieldOptions {
|
|
119
|
+
mustBeTrue?: boolean;
|
|
120
|
+
mustBeFalse?: boolean;
|
|
121
|
+
messages?: messagesBooleanOptions;
|
|
122
|
+
}
|
|
123
|
+
interface DateOptions extends FieldOptions {
|
|
124
|
+
minDate?: Date;
|
|
125
|
+
maxDate?: Date;
|
|
126
|
+
isDatetime?: boolean;
|
|
127
|
+
messages?: messagesDateOptions;
|
|
128
|
+
}
|
|
129
|
+
interface DecimalOptions extends FieldOptions {
|
|
130
|
+
gt?: number;
|
|
131
|
+
ge?: number;
|
|
132
|
+
lt?: number;
|
|
133
|
+
le?: number;
|
|
134
|
+
decimalPlaces?: number;
|
|
135
|
+
maxDigits?: number;
|
|
136
|
+
messages?: messagesDecimalOptions;
|
|
137
|
+
}
|
|
138
|
+
interface ArrayFieldOptions {
|
|
139
|
+
isRequired?: boolean | ((form?: any) => boolean);
|
|
140
|
+
messages?: messagesArrayFieldOptions;
|
|
141
|
+
validate?: (value: any[], form?: any) => boolean | string;
|
|
142
|
+
minItems?: number;
|
|
143
|
+
maxItems?: number;
|
|
144
|
+
}
|
|
145
|
+
interface ArrayFormFieldOptions {
|
|
146
|
+
isRequired?: boolean | ((form?: any) => boolean);
|
|
147
|
+
messages?: messagesArrayFormFieldOptions;
|
|
148
|
+
validate?: (value: any[], form?: any) => boolean | string;
|
|
149
|
+
minForms?: number;
|
|
150
|
+
maxForms?: number;
|
|
151
|
+
}
|
|
152
|
+
interface PluginOptions {
|
|
153
|
+
priority?: number;
|
|
154
|
+
}
|
|
155
|
+
interface MaskPluginOptions {
|
|
156
|
+
maskFormat: string;
|
|
157
|
+
maskPlaceholder: string;
|
|
158
|
+
digitPattern: RegExp;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
declare abstract class FieldType<T, O extends FieldOptions = FieldOptions> {
|
|
162
|
+
options: O;
|
|
163
|
+
constructor(options: O);
|
|
164
|
+
abstract cast(rawValue: any): T | null;
|
|
165
|
+
abstract validate(value: T, form?: Form): string[];
|
|
166
|
+
abstract getTypeName(): string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
type FieldTypeConstructor<T, O extends FieldOptions = FieldOptions> = new (options: O) => FieldType<T, O>;
|
|
170
|
+
declare class Field<T = any, O extends FieldOptions = FieldOptions> {
|
|
171
|
+
protected _rawValue: any;
|
|
172
|
+
protected _valueClear: T | null;
|
|
173
|
+
protected filed_type: FieldType<T, O>;
|
|
174
|
+
protected defaultValue: T | null;
|
|
175
|
+
protected _errors: string[];
|
|
176
|
+
isValid: boolean | null;
|
|
177
|
+
isTouched: boolean;
|
|
178
|
+
constructor(TypeConstructor: FieldTypeConstructor<T, O>, defaultValue?: T | null, options?: O | null);
|
|
179
|
+
protected get plugins(): FieldPlugin<any>[];
|
|
180
|
+
get options(): O;
|
|
181
|
+
set options(options: O);
|
|
182
|
+
get rawValue(): T | null;
|
|
183
|
+
set rawValue(input: any);
|
|
184
|
+
get errors(): string[];
|
|
185
|
+
get error(): string;
|
|
186
|
+
set error(message: string | null);
|
|
187
|
+
get valueClear(): any;
|
|
188
|
+
private isRequired;
|
|
189
|
+
checkValid(form?: Form): boolean;
|
|
190
|
+
checkAndSetValid(form?: Form): boolean;
|
|
191
|
+
get isEmpty(): boolean;
|
|
192
|
+
reset(): void;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
declare abstract class Form {
|
|
196
|
+
private _globalErrors;
|
|
197
|
+
protected get _fields(): Record<string, Field<any> | ArrayField<any> | ArrayFormField<any>>;
|
|
198
|
+
checkValid(form?: this): boolean;
|
|
199
|
+
get fieldsValue(): Record<string, any>;
|
|
200
|
+
set fields(data: Record<string, any>);
|
|
201
|
+
get allErrors(): Record<string, string[]>;
|
|
202
|
+
get globalErrors(): Record<string, string>;
|
|
203
|
+
set errors(errors: Record<string, string>);
|
|
204
|
+
setGlobalError(key: string, message: string): void;
|
|
205
|
+
clearGlobalErrors(): void;
|
|
206
|
+
reset(): void;
|
|
207
|
+
get isTouched(): boolean;
|
|
208
|
+
get isValid(): boolean;
|
|
209
|
+
toFormData(): FormData;
|
|
210
|
+
toJSON(): Record<string, any>;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export { type ArrayFieldOptions as A, BasePlugin as B, type DecimalOptions as D, Field as F, type MaskPluginOptions as M, type NumberOptions as N, type PluginOptions as P, type StringOptions as S, FieldType as a, type BooleanOptions as b, type DateOptions as c, Form as d, type messagesStringOptions as e, type messagesNumberOptions as f, type messagesBooleanOptions as g, type messagesDateOptions as h, type messagesDecimalOptions as i, type messagesArrayFieldOptions as j, type messagesArrayFormFieldOptions as k, type FieldOptions as l, type messagesOptions as m, type ArrayFormFieldOptions as n, ArrayField as o, ArrayFormField as p, type FieldPlugin as q };
|
package/dist/index.cjs
CHANGED
|
@@ -1012,63 +1012,6 @@ var DateType = class extends FieldType {
|
|
|
1012
1012
|
}
|
|
1013
1013
|
};
|
|
1014
1014
|
|
|
1015
|
-
// src/core/utils/luxon-loader.ts
|
|
1016
|
-
var DateTimeConstructor = null;
|
|
1017
|
-
var isLoading = false;
|
|
1018
|
-
var loadError = null;
|
|
1019
|
-
var loadPromise = null;
|
|
1020
|
-
function getDateTimeConstructor() {
|
|
1021
|
-
if (DateTimeConstructor) {
|
|
1022
|
-
return DateTimeConstructor;
|
|
1023
|
-
}
|
|
1024
|
-
if (loadError) {
|
|
1025
|
-
throw loadError;
|
|
1026
|
-
}
|
|
1027
|
-
if (isLoading) {
|
|
1028
|
-
throw new Error(
|
|
1029
|
-
"Luxon is still loading. Please await initLuxon() first."
|
|
1030
|
-
);
|
|
1031
|
-
}
|
|
1032
|
-
throw new Error(
|
|
1033
|
-
"Luxon is not initialized. Install: npm install luxon"
|
|
1034
|
-
);
|
|
1035
|
-
}
|
|
1036
|
-
function initLuxon() {
|
|
1037
|
-
if (DateTimeConstructor) {
|
|
1038
|
-
return Promise.resolve(DateTimeConstructor);
|
|
1039
|
-
}
|
|
1040
|
-
if (loadPromise) {
|
|
1041
|
-
return loadPromise;
|
|
1042
|
-
}
|
|
1043
|
-
isLoading = true;
|
|
1044
|
-
loadPromise = (async () => {
|
|
1045
|
-
try {
|
|
1046
|
-
const luxon = await import('luxon');
|
|
1047
|
-
DateTimeConstructor = luxon.DateTime;
|
|
1048
|
-
return DateTimeConstructor;
|
|
1049
|
-
} catch (error) {
|
|
1050
|
-
loadError = new Error(
|
|
1051
|
-
'DateLuxonType requires the "luxon" package to be installed.\nInstall: npm install luxon'
|
|
1052
|
-
);
|
|
1053
|
-
throw loadError;
|
|
1054
|
-
} finally {
|
|
1055
|
-
isLoading = false;
|
|
1056
|
-
}
|
|
1057
|
-
})();
|
|
1058
|
-
return loadPromise;
|
|
1059
|
-
}
|
|
1060
|
-
function isLuxonAvailable() {
|
|
1061
|
-
return DateTimeConstructor !== null;
|
|
1062
|
-
}
|
|
1063
|
-
function resetLuxon() {
|
|
1064
|
-
DateTimeConstructor = null;
|
|
1065
|
-
isLoading = false;
|
|
1066
|
-
loadError = null;
|
|
1067
|
-
loadPromise = null;
|
|
1068
|
-
}
|
|
1069
|
-
initLuxon().catch(() => {
|
|
1070
|
-
});
|
|
1071
|
-
|
|
1072
1015
|
exports.ArrayField = ArrayField;
|
|
1073
1016
|
exports.ArrayFormField = ArrayFormField;
|
|
1074
1017
|
exports.BasePlugin = BasePlugin;
|
|
@@ -1081,9 +1024,5 @@ exports.Form = Form;
|
|
|
1081
1024
|
exports.MaskPlugin = MaskPlugin;
|
|
1082
1025
|
exports.NumberType = NumberType;
|
|
1083
1026
|
exports.StringType = StringType;
|
|
1084
|
-
exports.getDateTimeConstructor = getDateTimeConstructor;
|
|
1085
|
-
exports.initLuxon = initLuxon;
|
|
1086
|
-
exports.isLuxonAvailable = isLuxonAvailable;
|
|
1087
|
-
exports.resetLuxon = resetLuxon;
|
|
1088
1027
|
//# sourceMappingURL=index.cjs.map
|
|
1089
1028
|
//# sourceMappingURL=index.cjs.map
|