@dynamicforms/vue-forms 0.5.0 → 0.6.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/dynamicforms-vue-forms.js +530 -528
- package/dist/dynamicforms-vue-forms.js.map +1 -1
- package/dist/dynamicforms-vue-forms.umd.cjs +2 -2
- package/dist/dynamicforms-vue-forms.umd.cjs.map +1 -1
- package/dist/index.d.cts +603 -0
- package/dist/index.d.ts +103 -93
- package/package.json +26 -9
- package/readme.md +135 -47
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,603 @@
|
|
|
1
|
+
import { ComponentOptionsMixin } from 'vue';
|
|
2
|
+
import { ComponentProvideOptions } from 'vue';
|
|
3
|
+
import { DefineComponent } from 'vue';
|
|
4
|
+
import { PublicProps } from 'vue';
|
|
5
|
+
import { Ref } from 'vue';
|
|
6
|
+
|
|
7
|
+
export declare class AbortEventHandlingException extends Error {
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export declare class Action<T extends ActionValue = ActionValue> extends Field<T> {
|
|
11
|
+
protected init(params?: Partial<IFieldConstructorParams<T>>): void;
|
|
12
|
+
get icon(): string | undefined;
|
|
13
|
+
set icon(newValue: string | undefined);
|
|
14
|
+
get label(): string | undefined;
|
|
15
|
+
set label(newValue: string | undefined);
|
|
16
|
+
execute(params: any): void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare type ActionExecutor = (field: FieldBase, supr: FieldActionExecute, ...params: any[]) => any;
|
|
20
|
+
|
|
21
|
+
export declare class ActionsMap extends Map<symbol, FieldActionExecute> {
|
|
22
|
+
private readonly eagerActions;
|
|
23
|
+
private readonly registeredActions;
|
|
24
|
+
register(action: FieldActionBase): void;
|
|
25
|
+
trigger<T extends FieldActionBase>(ActionClass: (abstract new (...args: any[]) => T) & {
|
|
26
|
+
classIdentifier: symbol;
|
|
27
|
+
}, field: FieldBase, ...params: any[]): any;
|
|
28
|
+
triggerEager(field: FieldBase, ...params: any[]): any;
|
|
29
|
+
clone(): ActionsMap;
|
|
30
|
+
cloneWithoutValidators(): ActionsMap;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export declare interface ActionValue {
|
|
34
|
+
label?: string;
|
|
35
|
+
icon?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Depending on the useMarkdownInValidators setting, return either markdown or a plain string error message
|
|
40
|
+
* @param mdErrorString markdown source to optionally be stripped
|
|
41
|
+
* @return MdString or string
|
|
42
|
+
*/
|
|
43
|
+
export declare function buildErrorMessage(mdErrorString: string): string | MdString;
|
|
44
|
+
|
|
45
|
+
export declare type ClassType = string | string[] | Record<string, boolean>;
|
|
46
|
+
|
|
47
|
+
export declare type ClassTypes = ClassType | ClassType[];
|
|
48
|
+
|
|
49
|
+
declare class CompareTo<T = any> extends Validator {
|
|
50
|
+
private otherField;
|
|
51
|
+
private isValidComparison;
|
|
52
|
+
private unregistered;
|
|
53
|
+
constructor(otherField: FieldBase, isValidComparison: (myValue: T, otherValue: T) => boolean, message: RenderContentRef);
|
|
54
|
+
unregister(): void;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export declare class ConditionalEnabledAction extends ConditionalStatementAction {
|
|
58
|
+
constructor(statement: Statement);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare type ConditionalExecutorFn = (field: FieldBase, currentResult: boolean, previousResult: boolean | undefined) => void;
|
|
62
|
+
|
|
63
|
+
export declare class ConditionalStatementAction extends ValueChangedAction {
|
|
64
|
+
private lastResult;
|
|
65
|
+
private readonly boundFields;
|
|
66
|
+
constructor(statement: Statement, executorFn: ConditionalExecutorFn);
|
|
67
|
+
static get classIdentifier(): symbol;
|
|
68
|
+
get eager(): boolean;
|
|
69
|
+
boundToField(field: FieldBase): void;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export declare class ConditionalValueAction<T> extends ConditionalStatementAction {
|
|
73
|
+
constructor(statement: Statement, trueValue: T);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export declare class ConditionalVisibilityAction extends ConditionalStatementAction {
|
|
77
|
+
constructor(statement: Statement);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* DisplayMode enum provides an enumeration for supported ways of rendering a particular object in the DOM
|
|
82
|
+
*/
|
|
83
|
+
export declare enum DisplayMode {
|
|
84
|
+
SUPPRESS = 1,// Field will be entirely suppressed. it will not render (not even to JSON) and will not parse for PUT
|
|
85
|
+
HIDDEN = 5,// Field will render as <input type="hidden"> or <tr data-field_name>
|
|
86
|
+
INVISIBLE = 8,// Field will render completely, but with display: none. Equal to setting its style = {display: none}
|
|
87
|
+
FULL = 10
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export declare namespace DisplayMode {
|
|
91
|
+
export function fromString(mode: string): DisplayMode;
|
|
92
|
+
export function fromAny(mode: any): DisplayMode;
|
|
93
|
+
export function isDefined(mode: number | string): boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export declare const EmptyField: Field<string>;
|
|
97
|
+
|
|
98
|
+
export declare class EnabledChangedAction extends FieldActionBase {
|
|
99
|
+
constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean) => void);
|
|
100
|
+
static get classIdentifier(): symbol;
|
|
101
|
+
execute(field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean): void;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export declare class EnabledChangingAction extends FieldActionBase {
|
|
105
|
+
constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean) => boolean);
|
|
106
|
+
static get classIdentifier(): symbol;
|
|
107
|
+
execute(field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean): boolean;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export declare class ExecuteAction extends FieldActionBase {
|
|
111
|
+
constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, params: any) => any);
|
|
112
|
+
static get classIdentifier(): symbol;
|
|
113
|
+
execute(field: FieldBase, supr: FieldActionExecute, params: any): any;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export declare class Field<T = any> extends FieldBase<T> {
|
|
117
|
+
protected _value: T;
|
|
118
|
+
protected _touched: boolean;
|
|
119
|
+
constructor(params?: Partial<IFieldConstructorParams<T>>);
|
|
120
|
+
/**
|
|
121
|
+
* Applies the constructor parameters. It is a hook so that a subclass needing different parameter handling
|
|
122
|
+
* overrides one method instead of redeclaring the constructor - Action does exactly that.
|
|
123
|
+
*
|
|
124
|
+
* It is called from this constructor, so it runs before a subclass's own class field initializers, which
|
|
125
|
+
* only run once super() returns. An override must therefore work off its parameters alone: members the
|
|
126
|
+
* subclass initializes read as undefined inside it, and anything it writes to such a member is overwritten
|
|
127
|
+
* the moment the initializer runs.
|
|
128
|
+
*/
|
|
129
|
+
protected init(params?: Partial<IFieldConstructorParams<T>>): void;
|
|
130
|
+
get value(): T;
|
|
131
|
+
set value(newValue: T);
|
|
132
|
+
get touched(): boolean;
|
|
133
|
+
set touched(touched: boolean);
|
|
134
|
+
clone(overrides?: Partial<IFieldConstructorParams<T>>): this;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export declare abstract class FieldActionBase {
|
|
138
|
+
static get classIdentifier(): symbol;
|
|
139
|
+
get classIdentifier(): symbol;
|
|
140
|
+
private readonly executorFn;
|
|
141
|
+
constructor(executorFn: ActionExecutor);
|
|
142
|
+
execute(field: FieldBase, supr: FieldActionExecute, ...params: any[]): any;
|
|
143
|
+
get eager(): boolean;
|
|
144
|
+
boundToField(field: FieldBase): void;
|
|
145
|
+
unregister(): void;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export declare type FieldActionExecute<T = any> = (field: FieldBase<T>, ...params: any[]) => any;
|
|
149
|
+
|
|
150
|
+
export declare abstract class FieldBase<T = any> {
|
|
151
|
+
/**
|
|
152
|
+
* A field is a Vue reactive proxy from construction onwards: the base constructor returns the proxy, and a
|
|
153
|
+
* derived class's `this` is whatever super() returned, so every subclass constructor, field initializer and
|
|
154
|
+
* method sees the proxy. Consequence: plain `field.property = value` is tracked, with no wrapper in between.
|
|
155
|
+
*/
|
|
156
|
+
constructor();
|
|
157
|
+
abstract get value(): T;
|
|
158
|
+
abstract set value(newValue: T);
|
|
159
|
+
abstract get touched(): boolean;
|
|
160
|
+
abstract set touched(touched: boolean);
|
|
161
|
+
abstract clone(overrides?: Partial<IFieldConstructorParams<T>>): FieldBase<T>;
|
|
162
|
+
originalValue: T;
|
|
163
|
+
private validatingCount;
|
|
164
|
+
/** true while at least one asynchronous validator is still running for this field */
|
|
165
|
+
get validating(): boolean;
|
|
166
|
+
/** announces the start of one asynchronous validation run; validators pair it with endValidating */
|
|
167
|
+
beginValidating(): void;
|
|
168
|
+
/** announces the end of one asynchronous validation run */
|
|
169
|
+
endValidating(): void;
|
|
170
|
+
protected _valid: boolean;
|
|
171
|
+
errors: ValidationError[];
|
|
172
|
+
parent?: Group;
|
|
173
|
+
fieldName?: string;
|
|
174
|
+
protected actions: ActionsMap;
|
|
175
|
+
private _visibility;
|
|
176
|
+
get visibility(): DisplayMode;
|
|
177
|
+
set visibility(newValue: DisplayMode);
|
|
178
|
+
private _enabled;
|
|
179
|
+
get enabled(): boolean;
|
|
180
|
+
set enabled(newValue: boolean);
|
|
181
|
+
validate(revalidate?: boolean): void;
|
|
182
|
+
get valid(): boolean;
|
|
183
|
+
get fullValue(): any;
|
|
184
|
+
get isChanged(): boolean;
|
|
185
|
+
registerAction(action: FieldActionBase): this;
|
|
186
|
+
triggerAction<T2 extends FieldActionBase>(actionClass: (abstract new (...args: any[]) => T2) & {
|
|
187
|
+
classIdentifier: symbol;
|
|
188
|
+
}, ...params: any[]): any;
|
|
189
|
+
clearValidators(): void;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export declare type FieldsToValues<T extends GenericFieldsInterface> = {
|
|
193
|
+
[K in keyof T]: T[K]['value'];
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
declare namespace Form {
|
|
197
|
+
export {
|
|
198
|
+
DisplayMode,
|
|
199
|
+
FieldActionBase,
|
|
200
|
+
ActionsMap,
|
|
201
|
+
EnabledChangedAction,
|
|
202
|
+
EnabledChangingAction,
|
|
203
|
+
ExecuteAction,
|
|
204
|
+
VisibilityChangedAction,
|
|
205
|
+
VisibilityChangingAction,
|
|
206
|
+
ValidChangedAction,
|
|
207
|
+
ValueChangedAction,
|
|
208
|
+
ListItemAddedAction,
|
|
209
|
+
ListItemRemovedAction,
|
|
210
|
+
Operator,
|
|
211
|
+
ConditionalStatementAction,
|
|
212
|
+
ConditionalVisibilityAction,
|
|
213
|
+
ConditionalEnabledAction,
|
|
214
|
+
ConditionalValueAction,
|
|
215
|
+
OperandType,
|
|
216
|
+
Statement,
|
|
217
|
+
ActionValue,
|
|
218
|
+
Action,
|
|
219
|
+
NullableAction,
|
|
220
|
+
MessagesWidget,
|
|
221
|
+
Field,
|
|
222
|
+
NullableField,
|
|
223
|
+
EmptyField,
|
|
224
|
+
IFieldConstructorActionsList,
|
|
225
|
+
IFieldConstructorParams,
|
|
226
|
+
AbortEventHandlingException,
|
|
227
|
+
FieldActionExecute,
|
|
228
|
+
FieldBase,
|
|
229
|
+
GenericFieldsInterface,
|
|
230
|
+
FieldsToValues,
|
|
231
|
+
GroupValue,
|
|
232
|
+
GroupValueInput,
|
|
233
|
+
Group,
|
|
234
|
+
NullableGroup,
|
|
235
|
+
ListValue,
|
|
236
|
+
List,
|
|
237
|
+
NullableList,
|
|
238
|
+
Validators,
|
|
239
|
+
buildErrorMessage,
|
|
240
|
+
isSimpleComponentDef,
|
|
241
|
+
isCallableFunction,
|
|
242
|
+
MdString,
|
|
243
|
+
SimpleComponentDef,
|
|
244
|
+
ClassType,
|
|
245
|
+
ClassTypes,
|
|
246
|
+
RenderContentNonCallable,
|
|
247
|
+
RenderContentCallable,
|
|
248
|
+
RenderContent,
|
|
249
|
+
RenderContentRef,
|
|
250
|
+
ValidationError,
|
|
251
|
+
ValidationErrorText,
|
|
252
|
+
ValidationErrorRenderContent,
|
|
253
|
+
RenderableValue,
|
|
254
|
+
ValidationFunctionResult,
|
|
255
|
+
ValidationFunction,
|
|
256
|
+
Validator
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
export default Form;
|
|
260
|
+
|
|
261
|
+
export declare const forms: {
|
|
262
|
+
install(app: any, options?: Partial<FormsConfig>): void;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
declare interface FormsConfig {
|
|
266
|
+
useMarkdownInValidators: boolean;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export declare type GenericFieldsInterface = Record<string, FieldBase>;
|
|
270
|
+
|
|
271
|
+
export declare class Group<T extends GenericFieldsInterface = GenericFieldsInterface> extends FieldBase<GroupValue<T>> {
|
|
272
|
+
private readonly _fields;
|
|
273
|
+
private _value;
|
|
274
|
+
private suppressNotifyValueChanged;
|
|
275
|
+
constructor(fields: T, params?: Partial<IFieldConstructorParams<GroupValueInput<T>>>);
|
|
276
|
+
private addField;
|
|
277
|
+
private static isValidFields;
|
|
278
|
+
static createFromFormData(data: Record<string, any> | null): Group;
|
|
279
|
+
field<K extends keyof T>(fieldName: K): T[K] | null;
|
|
280
|
+
get fields(): T;
|
|
281
|
+
get value(): GroupValue<T>;
|
|
282
|
+
set value(newValue: GroupValueInput<T>);
|
|
283
|
+
get touched(): boolean;
|
|
284
|
+
set touched(touched: boolean);
|
|
285
|
+
get fullValue(): Record<string, any>;
|
|
286
|
+
notifyValueChanged(): void;
|
|
287
|
+
get valid(): boolean;
|
|
288
|
+
validate(revalidate?: boolean): void;
|
|
289
|
+
clone(overrides?: Partial<IFieldConstructorParams<GroupValueInput<T>>>): Group<T>;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/** what Group.value reads back: the full field map, or null when no field serializes */
|
|
293
|
+
export declare type GroupValue<T extends GenericFieldsInterface> = FieldsToValues<T> | null;
|
|
294
|
+
|
|
295
|
+
/** what Group.value and the Group constructor accept: keys left out are simply not assigned */
|
|
296
|
+
export declare type GroupValueInput<T extends GenericFieldsInterface> = Partial<FieldsToValues<T>> | null;
|
|
297
|
+
|
|
298
|
+
export declare interface IFieldConstructorActionsList {
|
|
299
|
+
actions?: FieldActionBase[];
|
|
300
|
+
validators?: FieldActionBase[];
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Parameters accepted by field constructors and by clone overrides.
|
|
305
|
+
*
|
|
306
|
+
* Only writable members are listed. valid, validating, fullValue and isChanged are getter-only, so assigning
|
|
307
|
+
* them throws a TypeError. parent and fieldName are set by the container: until a Group or List installs them
|
|
308
|
+
* as non-configurable accessors, assigning them is silently accepted, which is why the type rejects them.
|
|
309
|
+
*/
|
|
310
|
+
export declare type IFieldConstructorParams<T = any> = {
|
|
311
|
+
value: T;
|
|
312
|
+
originalValue: T;
|
|
313
|
+
enabled: boolean;
|
|
314
|
+
visibility: DisplayMode;
|
|
315
|
+
touched: boolean;
|
|
316
|
+
errors: ValidationError[];
|
|
317
|
+
} & IFieldConstructorActionsList;
|
|
318
|
+
|
|
319
|
+
declare class InAllowedValues<T = any> extends Validator {
|
|
320
|
+
constructor(allowedValues: T[], message?: RenderContentRef);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export declare function isCallableFunction(msg?: RenderContentRef): msg is RenderContentCallable;
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Type guard to check if content is a custom component definition
|
|
327
|
+
* @param msg - Content to check
|
|
328
|
+
* @returns True if content is a custom component definition
|
|
329
|
+
*/
|
|
330
|
+
export declare function isSimpleComponentDef(msg?: RenderContentRef): msg is SimpleComponentDef;
|
|
331
|
+
|
|
332
|
+
declare class LengthInRange<T = any> extends Validator {
|
|
333
|
+
constructor(minLength: number, maxLength: number, message?: RenderContentRef);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export declare class List<T extends GenericFieldsInterface = GenericFieldsInterface> extends FieldBase<ListValue> {
|
|
337
|
+
private _value;
|
|
338
|
+
private _itemTemplate?;
|
|
339
|
+
private _previousValue;
|
|
340
|
+
constructor(itemTemplate?: Group<T>, params?: Partial<IFieldConstructorParams<ListValue>>);
|
|
341
|
+
private processSetValueItem;
|
|
342
|
+
private setValueInternal;
|
|
343
|
+
get value(): ListValue;
|
|
344
|
+
set value(newValue: Record<string, any>[]);
|
|
345
|
+
get touched(): boolean;
|
|
346
|
+
set touched(touched: boolean);
|
|
347
|
+
clone(overrides?: Partial<IFieldConstructorParams<ListValue>>): List<T>;
|
|
348
|
+
notifyValueChanged(): void;
|
|
349
|
+
get valid(): boolean;
|
|
350
|
+
validate(revalidate?: boolean): void;
|
|
351
|
+
get(index: number): Group<T> | undefined;
|
|
352
|
+
push(item: any): number;
|
|
353
|
+
pop(): Group<T> | undefined;
|
|
354
|
+
remove(index: number): Group<T> | undefined;
|
|
355
|
+
insert(item: any, index: number): number;
|
|
356
|
+
clear(): void;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
export declare class ListItemAddedAction extends FieldActionBase {
|
|
360
|
+
constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, item: any, index: number) => void);
|
|
361
|
+
static get classIdentifier(): symbol;
|
|
362
|
+
execute(field: FieldBase, supr: FieldActionExecute, item: any, index: number): void;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
export declare class ListItemRemovedAction extends FieldActionBase {
|
|
366
|
+
constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, item: any, index: number) => void);
|
|
367
|
+
static get classIdentifier(): symbol;
|
|
368
|
+
execute(field: FieldBase, supr: FieldActionExecute, item: any, index: number): void;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/** what List.value reads back: one plain object per item, or null when the list is empty */
|
|
372
|
+
export declare type ListValue = Record<string, any>[] | null;
|
|
373
|
+
|
|
374
|
+
declare class MaxLength<T = any> extends Validator {
|
|
375
|
+
constructor(maxLength: number, message?: RenderContentRef);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
declare class MaxValue<T = any> extends Validator {
|
|
379
|
+
constructor(maxValue: T, message?: RenderContentRef);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Marks content for markdown rendering
|
|
384
|
+
*/
|
|
385
|
+
export declare class MdString extends String {
|
|
386
|
+
plugins?: any[];
|
|
387
|
+
options?: any;
|
|
388
|
+
constructor(value: string, options?: any, plugins?: any[]);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export declare const MessagesWidget: DefineComponent<Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
392
|
+
|
|
393
|
+
declare class MinLength<T = any> extends Validator {
|
|
394
|
+
constructor(minLength: number, message?: RenderContentRef);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
declare class MinValue<T = any> extends Validator {
|
|
398
|
+
constructor(minValue: T, message?: RenderContentRef);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
export declare type NullableAction = Action | null;
|
|
402
|
+
|
|
403
|
+
export declare type NullableField<T = any> = Field<T> | null;
|
|
404
|
+
|
|
405
|
+
export declare type NullableGroup = Group | null;
|
|
406
|
+
|
|
407
|
+
export declare type NullableList = List | null;
|
|
408
|
+
|
|
409
|
+
export declare type OperandType = any | Statement | FieldBase;
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Operators provides us a functionality for backend to send us complex condition upon which we send
|
|
413
|
+
* dynamic visibility prop for form input fields
|
|
414
|
+
*/
|
|
415
|
+
export declare enum Operator {
|
|
416
|
+
NOT = 0,
|
|
417
|
+
OR = 1,
|
|
418
|
+
AND = 2,
|
|
419
|
+
XOR = 3,
|
|
420
|
+
NAND = 4,
|
|
421
|
+
NOR = 5,
|
|
422
|
+
EQUALS = -1,
|
|
423
|
+
NOT_EQUALS = -2,
|
|
424
|
+
GT = -3,
|
|
425
|
+
LT = -4,
|
|
426
|
+
GE = -5,
|
|
427
|
+
LE = -6,
|
|
428
|
+
IN = -7,
|
|
429
|
+
NOT_IN = -8,
|
|
430
|
+
INCLUDES = -9,
|
|
431
|
+
NOT_INCLUDES = -10
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
export declare namespace Operator {
|
|
435
|
+
export function fromString(operator: string): Operator;
|
|
436
|
+
export function fromAny(mode: any): Operator;
|
|
437
|
+
export function isDefined(operator: number | string): boolean;
|
|
438
|
+
export function isLogicOperator(operator: Operator): boolean;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
declare class Pattern<T = any> extends Validator {
|
|
442
|
+
constructor(pattern: RegExp, message?: RenderContentRef);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
declare interface Props {
|
|
446
|
+
message: string | ValidationError[];
|
|
447
|
+
classes?: ClassTypes;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* A value, renderable three different ways (plain text, markdown, component) - alias for ValidationErrorRenderContent
|
|
452
|
+
*/
|
|
453
|
+
export declare class RenderableValue extends ValidationErrorRenderContent {
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Type for different renderable content formats: plain string, markdown, or custom component
|
|
458
|
+
*/
|
|
459
|
+
export declare type RenderContent = RenderContentNonCallable | RenderContentCallable;
|
|
460
|
+
|
|
461
|
+
export declare type RenderContentCallable = () => RenderContentNonCallable;
|
|
462
|
+
|
|
463
|
+
export declare type RenderContentNonCallable = string | MdString | SimpleComponentDef;
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Type for different renderable content formats (supporting references): plain string, markdown, or custom component
|
|
467
|
+
*/
|
|
468
|
+
export declare type RenderContentRef = RenderContent | Ref<RenderContent>;
|
|
469
|
+
|
|
470
|
+
declare class Required_2<T = any> extends Validator {
|
|
471
|
+
constructor(message?: RenderContentRef);
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Interface for custom component content definition
|
|
476
|
+
*/
|
|
477
|
+
export declare interface SimpleComponentDef {
|
|
478
|
+
componentName: string;
|
|
479
|
+
componentProps?: Record<any, any>;
|
|
480
|
+
componentVHtml?: string;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
export declare class Statement {
|
|
484
|
+
private readonly operand1;
|
|
485
|
+
private readonly operator;
|
|
486
|
+
private readonly operand2;
|
|
487
|
+
constructor(operand1: OperandType, operator: Operator, operand2: OperandType);
|
|
488
|
+
get operand1Value(): any;
|
|
489
|
+
get operand2Value(): any;
|
|
490
|
+
evaluate(): boolean;
|
|
491
|
+
/**
|
|
492
|
+
* Recursively collects all fields used in this statement and its nested statements
|
|
493
|
+
* @returns A set of all fields used in this statement
|
|
494
|
+
*/
|
|
495
|
+
collectFields(): Set<FieldBase>;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Base validation error class with component rendering capabilities
|
|
500
|
+
*/
|
|
501
|
+
export declare class ValidationError {
|
|
502
|
+
get componentName(): string;
|
|
503
|
+
get componentBindings(): {};
|
|
504
|
+
get componentBody(): string;
|
|
505
|
+
get extraClasses(): ClassTypes;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Validation error that supports multiple content types (plain text, markdown, component)
|
|
510
|
+
*/
|
|
511
|
+
export declare class ValidationErrorRenderContent extends ValidationError {
|
|
512
|
+
classes: ClassTypes;
|
|
513
|
+
private text;
|
|
514
|
+
private textType;
|
|
515
|
+
constructor(text: RenderContentRef, classes?: ClassTypes);
|
|
516
|
+
get resolvedText(): RenderContentNonCallable;
|
|
517
|
+
get getTextType(): "string" | "md" | "component";
|
|
518
|
+
get componentName(): string;
|
|
519
|
+
get componentBindings(): Record<any, any>;
|
|
520
|
+
get componentBody(): string;
|
|
521
|
+
get extraClasses(): ClassTypes;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Simple text-only ValidationError
|
|
526
|
+
*/
|
|
527
|
+
export declare class ValidationErrorText extends ValidationError {
|
|
528
|
+
text: string;
|
|
529
|
+
classes: ClassTypes;
|
|
530
|
+
constructor(text: string, classes?: ClassTypes);
|
|
531
|
+
get componentName(): string;
|
|
532
|
+
get componentBody(): string;
|
|
533
|
+
get extraClasses(): ClassTypes;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
export declare type ValidationFunction<T = any> = (newValue: T, oldValue: T, field: FieldBase<T>) => ValidationFunctionResult | Promise<ValidationFunctionResult>;
|
|
537
|
+
|
|
538
|
+
export declare type ValidationFunctionResult = ValidationError[] | null;
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Validator is a specialized action that performs validation when a field's value changes.
|
|
542
|
+
* It automatically adds/removes validation errors from the field's errors array.
|
|
543
|
+
*/
|
|
544
|
+
export declare class Validator<T = any> extends ValueChangedAction {
|
|
545
|
+
private readonly source;
|
|
546
|
+
/**
|
|
547
|
+
* Creates a new validator
|
|
548
|
+
* @param validationFn Function that validates the field value and returns errors or null
|
|
549
|
+
*/
|
|
550
|
+
constructor(validationFn: ValidationFunction<T>);
|
|
551
|
+
static get classIdentifier(): symbol;
|
|
552
|
+
get eager(): boolean;
|
|
553
|
+
protected replacePlaceholdersFunction(text: RenderContentRef, replace: Record<string, any>): RenderContentRef;
|
|
554
|
+
protected replacePlaceholders(text: RenderContentRef, replace: Record<string, any>): RenderContentRef;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
export declare namespace Validators {
|
|
558
|
+
export {
|
|
559
|
+
CompareTo,
|
|
560
|
+
InAllowedValues,
|
|
561
|
+
Required_2 as Required,
|
|
562
|
+
Pattern,
|
|
563
|
+
ValidationFunctionResult,
|
|
564
|
+
ValidationFunction,
|
|
565
|
+
Validator,
|
|
566
|
+
MinValue,
|
|
567
|
+
MaxValue,
|
|
568
|
+
ValueInRange,
|
|
569
|
+
MinLength,
|
|
570
|
+
MaxLength,
|
|
571
|
+
LengthInRange
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
export declare class ValidChangedAction extends FieldActionBase {
|
|
576
|
+
constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean) => void);
|
|
577
|
+
static get classIdentifier(): symbol;
|
|
578
|
+
execute(field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean): void;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
export declare class ValueChangedAction<T = any> extends FieldActionBase {
|
|
582
|
+
constructor(executorFn: (field: FieldBase<T>, supr: FieldActionExecute<T>, newValue: T, oldValue: T) => void);
|
|
583
|
+
static get classIdentifier(): symbol;
|
|
584
|
+
execute(field: FieldBase<T>, supr: FieldActionExecute<T>, newValue: T, oldValue: T): void;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
declare class ValueInRange<T = any> extends Validator {
|
|
588
|
+
constructor(minValue: T, maxValue: T, message?: RenderContentRef);
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
export declare class VisibilityChangedAction extends FieldActionBase {
|
|
592
|
+
constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, newValue: DisplayMode, oldValue: DisplayMode) => void);
|
|
593
|
+
static get classIdentifier(): symbol;
|
|
594
|
+
execute(field: FieldBase, supr: FieldActionExecute, newValue: DisplayMode, oldValue: DisplayMode): void;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
export declare class VisibilityChangingAction extends FieldActionBase {
|
|
598
|
+
constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, newValue: DisplayMode, oldValue: DisplayMode) => DisplayMode);
|
|
599
|
+
static get classIdentifier(): symbol;
|
|
600
|
+
execute(field: FieldBase, supr: FieldActionExecute, newValue: DisplayMode, oldValue: DisplayMode): DisplayMode;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
export { }
|