@dynamicforms/vue-forms 0.6.1 → 0.12.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 +1884 -794
- package/dist/dynamicforms-vue-forms.js.map +1 -1
- package/dist/index.d.ts +843 -83
- package/package.json +6 -14
- package/readme.md +58 -21
- package/dist/dynamicforms-vue-forms.umd.cjs +0 -3
- package/dist/dynamicforms-vue-forms.umd.cjs.map +0 -1
- package/dist/index.d.cts +0 -663
package/dist/index.d.cts
DELETED
|
@@ -1,663 +0,0 @@
|
|
|
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
|
-
/**
|
|
182
|
-
* While true, validate() on this field does nothing at all: it neither recomputes _valid nor emits
|
|
183
|
-
* ValidChangedAction, and nothing climbs to the parent. A container that walks its members one by one - assigning
|
|
184
|
-
* them a value, or revalidating them - sets it for the duration of the walk, so a member's upward climb cannot
|
|
185
|
-
* announce the verdict of a half-applied value or of a half-revalidated set, and clears it in a finally block
|
|
186
|
-
* followed by its own validate(). That call recomputes over the finished state and emits the net transition, so
|
|
187
|
-
* the deferral cannot swallow a real change.
|
|
188
|
-
*/
|
|
189
|
-
protected suppressValidation: boolean;
|
|
190
|
-
/**
|
|
191
|
-
* While true, a validity change is still recomputed and still announced on this field, but it is not passed up to
|
|
192
|
-
* the parent: the climb is only remembered and carried out by flushParentValidityClimb(). A setter that notifies
|
|
193
|
-
* the parent of the new value itself holds it over the notifying region, so the parent forms its verdict once,
|
|
194
|
-
* over the finished value, instead of once over the value being replaced and once over the value replacing it.
|
|
195
|
-
*/
|
|
196
|
-
protected suppressParentValidityClimb: boolean;
|
|
197
|
-
private parentValidityClimbPending;
|
|
198
|
-
/** Carries out the climb that a validity change made while suppressParentValidityClimb was held, if there was one. */
|
|
199
|
-
protected flushParentValidityClimb(): void;
|
|
200
|
-
validate(revalidate?: boolean): void;
|
|
201
|
-
get valid(): boolean;
|
|
202
|
-
get fullValue(): any;
|
|
203
|
-
get isChanged(): boolean;
|
|
204
|
-
/**
|
|
205
|
-
* Registers the actions a constructor received in its parameters: registration without the eager trigger,
|
|
206
|
-
* because a constructor ends with a single this.actions.triggerEager(...) over the finished value, and an
|
|
207
|
-
* eager action registered here would otherwise also run once per registration, over a half-built field.
|
|
208
|
-
*/
|
|
209
|
-
protected registerInitialActions(actions: FieldActionBase[]): void;
|
|
210
|
-
registerAction(action: FieldActionBase): this;
|
|
211
|
-
triggerAction<T2 extends FieldActionBase>(actionClass: (abstract new (...args: any[]) => T2) & {
|
|
212
|
-
classIdentifier: symbol;
|
|
213
|
-
}, ...params: any[]): any;
|
|
214
|
-
private _validationEpoch;
|
|
215
|
-
/**
|
|
216
|
-
* Generation counter of the validators attached to this field. A Validator reads it when a run starts and drops
|
|
217
|
-
* a result whose epoch no longer matches, so a validation still in flight when clearValidators() is called
|
|
218
|
-
* cannot push an error onto a field that no longer has the validator that produced it.
|
|
219
|
-
*/
|
|
220
|
-
get validationEpoch(): number;
|
|
221
|
-
clearValidators(): void;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
export declare type FieldsToValues<T extends GenericFieldsInterface> = {
|
|
225
|
-
[K in keyof T]: T[K]['value'];
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
declare namespace Form {
|
|
229
|
-
export {
|
|
230
|
-
DisplayMode,
|
|
231
|
-
FieldActionBase,
|
|
232
|
-
ActionsMap,
|
|
233
|
-
EnabledChangedAction,
|
|
234
|
-
EnabledChangingAction,
|
|
235
|
-
ExecuteAction,
|
|
236
|
-
VisibilityChangedAction,
|
|
237
|
-
VisibilityChangingAction,
|
|
238
|
-
ValidChangedAction,
|
|
239
|
-
ValueChangedAction,
|
|
240
|
-
ListItemAddedAction,
|
|
241
|
-
ListItemRemovedAction,
|
|
242
|
-
Operator,
|
|
243
|
-
ConditionalStatementAction,
|
|
244
|
-
ConditionalVisibilityAction,
|
|
245
|
-
ConditionalEnabledAction,
|
|
246
|
-
ConditionalValueAction,
|
|
247
|
-
OperandType,
|
|
248
|
-
Statement,
|
|
249
|
-
ActionValue,
|
|
250
|
-
Action,
|
|
251
|
-
NullableAction,
|
|
252
|
-
MessagesWidget,
|
|
253
|
-
Field,
|
|
254
|
-
NullableField,
|
|
255
|
-
EmptyField,
|
|
256
|
-
IFieldConstructorActionsList,
|
|
257
|
-
IFieldConstructorParams,
|
|
258
|
-
AbortEventHandlingException,
|
|
259
|
-
FieldActionExecute,
|
|
260
|
-
FieldBase,
|
|
261
|
-
GenericFieldsInterface,
|
|
262
|
-
FieldsToValues,
|
|
263
|
-
GroupValue,
|
|
264
|
-
GroupValueInput,
|
|
265
|
-
Group,
|
|
266
|
-
NullableGroup,
|
|
267
|
-
ListValue,
|
|
268
|
-
List,
|
|
269
|
-
NullableList,
|
|
270
|
-
Validators,
|
|
271
|
-
buildErrorMessage,
|
|
272
|
-
isSimpleComponentDef,
|
|
273
|
-
isCallableFunction,
|
|
274
|
-
MdString,
|
|
275
|
-
SimpleComponentDef,
|
|
276
|
-
ClassType,
|
|
277
|
-
ClassTypes,
|
|
278
|
-
RenderContentNonCallable,
|
|
279
|
-
RenderContentCallable,
|
|
280
|
-
RenderContent,
|
|
281
|
-
RenderContentRef,
|
|
282
|
-
ValidationError,
|
|
283
|
-
ValidationErrorText,
|
|
284
|
-
ValidationErrorRenderContent,
|
|
285
|
-
RenderableValue,
|
|
286
|
-
ValidationFunctionResult,
|
|
287
|
-
ValidationFunction,
|
|
288
|
-
Validator
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
export default Form;
|
|
292
|
-
|
|
293
|
-
export declare const forms: {
|
|
294
|
-
install(app: any, options?: Partial<FormsConfig>): void;
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
declare interface FormsConfig {
|
|
298
|
-
useMarkdownInValidators: boolean;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
export declare type GenericFieldsInterface = Record<string, FieldBase>;
|
|
302
|
-
|
|
303
|
-
export declare class Group<T extends GenericFieldsInterface = GenericFieldsInterface> extends FieldBase<GroupValue<T>> {
|
|
304
|
-
private readonly _fields;
|
|
305
|
-
private _value;
|
|
306
|
-
private suppressNotifyValueChanged;
|
|
307
|
-
constructor(fields: T, params?: Partial<IFieldConstructorParams<GroupValueInput<T>>>);
|
|
308
|
-
private addField;
|
|
309
|
-
private static isValidFields;
|
|
310
|
-
static createFromFormData(data: Record<string, any> | null): Group;
|
|
311
|
-
field<K extends keyof T>(fieldName: K): T[K] | null;
|
|
312
|
-
get fields(): T;
|
|
313
|
-
get value(): GroupValue<T>;
|
|
314
|
-
/**
|
|
315
|
-
* Writes the members that the given value carries, without letting any single member announce the state in
|
|
316
|
-
* between: the group's own value notification and its own validation are both held back for the duration, so
|
|
317
|
-
* neither a ValueChangedAction nor a ValidChangedAction reports a verdict over a half-applied value. The
|
|
318
|
-
* caller decides what to announce once the whole value is in place. Both flags are restored to what they were,
|
|
319
|
-
* so a caller that is itself holding the group back stays in charge.
|
|
320
|
-
*/
|
|
321
|
-
private assignMembers;
|
|
322
|
-
set value(newValue: GroupValueInput<T>);
|
|
323
|
-
get touched(): boolean;
|
|
324
|
-
set touched(touched: boolean);
|
|
325
|
-
get fullValue(): Record<string, any>;
|
|
326
|
-
notifyValueChanged(): void;
|
|
327
|
-
get valid(): boolean;
|
|
328
|
-
validate(revalidate?: boolean): void;
|
|
329
|
-
clone(overrides?: Partial<IFieldConstructorParams<GroupValueInput<T>>>): Group<T>;
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
/** what Group.value reads back: the full field map, or null when no field serializes */
|
|
333
|
-
export declare type GroupValue<T extends GenericFieldsInterface> = FieldsToValues<T> | null;
|
|
334
|
-
|
|
335
|
-
/** what Group.value and the Group constructor accept: keys left out are simply not assigned */
|
|
336
|
-
export declare type GroupValueInput<T extends GenericFieldsInterface> = Partial<FieldsToValues<T>> | null;
|
|
337
|
-
|
|
338
|
-
export declare interface IFieldConstructorActionsList {
|
|
339
|
-
actions?: FieldActionBase[];
|
|
340
|
-
validators?: FieldActionBase[];
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* Parameters accepted by field constructors and by clone overrides.
|
|
345
|
-
*
|
|
346
|
-
* Only writable members are listed. valid, validating, fullValue and isChanged are getter-only, so assigning
|
|
347
|
-
* them throws a TypeError. parent and fieldName are set by the container: until a Group or List installs them
|
|
348
|
-
* as non-configurable accessors, assigning them is silently accepted, which is why the type rejects them.
|
|
349
|
-
*/
|
|
350
|
-
export declare type IFieldConstructorParams<T = any> = {
|
|
351
|
-
value: T;
|
|
352
|
-
originalValue: T;
|
|
353
|
-
enabled: boolean;
|
|
354
|
-
visibility: DisplayMode;
|
|
355
|
-
touched: boolean;
|
|
356
|
-
errors: ValidationError[];
|
|
357
|
-
} & IFieldConstructorActionsList;
|
|
358
|
-
|
|
359
|
-
declare class InAllowedValues<T = any> extends Validator {
|
|
360
|
-
constructor(allowedValues: T[], message?: RenderContentRef);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
export declare function isCallableFunction(msg?: RenderContentRef): msg is RenderContentCallable;
|
|
364
|
-
|
|
365
|
-
/**
|
|
366
|
-
* Type guard to check if content is a custom component definition
|
|
367
|
-
* @param msg - Content to check
|
|
368
|
-
* @returns True if content is a custom component definition
|
|
369
|
-
*/
|
|
370
|
-
export declare function isSimpleComponentDef(msg?: RenderContentRef): msg is SimpleComponentDef;
|
|
371
|
-
|
|
372
|
-
declare class LengthInRange<T = any> extends Validator {
|
|
373
|
-
constructor(minLength: number, maxLength: number, message?: RenderContentRef);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
export declare class List<T extends GenericFieldsInterface = GenericFieldsInterface> extends FieldBase<ListValue> {
|
|
377
|
-
private _value;
|
|
378
|
-
private _itemTemplate?;
|
|
379
|
-
private _previousValue;
|
|
380
|
-
constructor(itemTemplate?: Group<T>, params?: Partial<IFieldConstructorParams<ListValue>>);
|
|
381
|
-
private processSetValueItem;
|
|
382
|
-
/**
|
|
383
|
-
* Builds the item that fills a gap left by an insert beyond the end of the list: a copy of the item template with
|
|
384
|
-
* the template's own values, or an empty group when the list has no template.
|
|
385
|
-
*/
|
|
386
|
-
private createPaddingItem;
|
|
387
|
-
private setValueInternal;
|
|
388
|
-
get value(): ListValue;
|
|
389
|
-
set value(newValue: Record<string, any>[]);
|
|
390
|
-
get touched(): boolean;
|
|
391
|
-
set touched(touched: boolean);
|
|
392
|
-
clone(overrides?: Partial<IFieldConstructorParams<ListValue>>): List<T>;
|
|
393
|
-
notifyValueChanged(): void;
|
|
394
|
-
get valid(): boolean;
|
|
395
|
-
validate(revalidate?: boolean): void;
|
|
396
|
-
get(index: number): Group<T> | undefined;
|
|
397
|
-
push(item: any): number;
|
|
398
|
-
pop(): Group<T> | undefined;
|
|
399
|
-
remove(index: number): Group<T> | undefined;
|
|
400
|
-
insert(item: any, index: number): number;
|
|
401
|
-
clear(): void;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
export declare class ListItemAddedAction extends FieldActionBase {
|
|
405
|
-
constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, item: any, index: number) => void);
|
|
406
|
-
static get classIdentifier(): symbol;
|
|
407
|
-
execute(field: FieldBase, supr: FieldActionExecute, item: any, index: number): void;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
export declare class ListItemRemovedAction extends FieldActionBase {
|
|
411
|
-
constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, item: any, index: number) => void);
|
|
412
|
-
static get classIdentifier(): symbol;
|
|
413
|
-
execute(field: FieldBase, supr: FieldActionExecute, item: any, index: number): void;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
/** what List.value reads back: one plain object per item, or null when the list is empty */
|
|
417
|
-
export declare type ListValue = Record<string, any>[] | null;
|
|
418
|
-
|
|
419
|
-
declare class MaxLength<T = any> extends Validator {
|
|
420
|
-
constructor(maxLength: number, message?: RenderContentRef);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
declare class MaxValue<T = any> extends Validator {
|
|
424
|
-
constructor(maxValue: T, message?: RenderContentRef);
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
/**
|
|
428
|
-
* Marks content for markdown rendering
|
|
429
|
-
*/
|
|
430
|
-
export declare class MdString extends String {
|
|
431
|
-
plugins?: any[];
|
|
432
|
-
options?: any;
|
|
433
|
-
constructor(value: string, options?: any, plugins?: any[]);
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
export declare const MessagesWidget: DefineComponent<Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
437
|
-
|
|
438
|
-
declare class MinLength<T = any> extends Validator {
|
|
439
|
-
constructor(minLength: number, message?: RenderContentRef);
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
declare class MinValue<T = any> extends Validator {
|
|
443
|
-
constructor(minValue: T, message?: RenderContentRef);
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
export declare type NullableAction = Action | null;
|
|
447
|
-
|
|
448
|
-
export declare type NullableField<T = any> = Field<T> | null;
|
|
449
|
-
|
|
450
|
-
export declare type NullableGroup = Group | null;
|
|
451
|
-
|
|
452
|
-
export declare type NullableList = List | null;
|
|
453
|
-
|
|
454
|
-
export declare type OperandType = any | Statement | FieldBase;
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* Operators provides us a functionality for backend to send us complex condition upon which we send
|
|
458
|
-
* dynamic visibility prop for form input fields
|
|
459
|
-
*/
|
|
460
|
-
export declare enum Operator {
|
|
461
|
-
NOT = 0,
|
|
462
|
-
OR = 1,
|
|
463
|
-
AND = 2,
|
|
464
|
-
XOR = 3,
|
|
465
|
-
NAND = 4,
|
|
466
|
-
NOR = 5,
|
|
467
|
-
EQUALS = -1,
|
|
468
|
-
NOT_EQUALS = -2,
|
|
469
|
-
GT = -3,
|
|
470
|
-
LT = -4,
|
|
471
|
-
GE = -5,
|
|
472
|
-
LE = -6,
|
|
473
|
-
IN = -7,
|
|
474
|
-
NOT_IN = -8,
|
|
475
|
-
INCLUDES = -9,
|
|
476
|
-
NOT_INCLUDES = -10
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
export declare namespace Operator {
|
|
480
|
-
export function fromString(operator: string): Operator;
|
|
481
|
-
export function fromAny(mode: any): Operator;
|
|
482
|
-
export function isDefined(operator: number | string): boolean;
|
|
483
|
-
export function isLogicOperator(operator: Operator): boolean;
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
declare class Pattern<T = any> extends Validator {
|
|
487
|
-
constructor(pattern: RegExp, message?: RenderContentRef);
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
declare interface Props {
|
|
491
|
-
message: string | ValidationError[];
|
|
492
|
-
classes?: ClassTypes;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
/**
|
|
496
|
-
* A value, renderable three different ways (plain text, markdown, component) - alias for ValidationErrorRenderContent
|
|
497
|
-
*/
|
|
498
|
-
export declare class RenderableValue extends ValidationErrorRenderContent {
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
/**
|
|
502
|
-
* Type for different renderable content formats: plain string, markdown, or custom component
|
|
503
|
-
*/
|
|
504
|
-
export declare type RenderContent = RenderContentNonCallable | RenderContentCallable;
|
|
505
|
-
|
|
506
|
-
export declare type RenderContentCallable = () => RenderContentNonCallable;
|
|
507
|
-
|
|
508
|
-
export declare type RenderContentNonCallable = string | MdString | SimpleComponentDef;
|
|
509
|
-
|
|
510
|
-
/**
|
|
511
|
-
* Type for different renderable content formats (supporting references): plain string, markdown, or custom component
|
|
512
|
-
*/
|
|
513
|
-
export declare type RenderContentRef = RenderContent | Ref<RenderContent>;
|
|
514
|
-
|
|
515
|
-
declare class Required_2<T = any> extends Validator {
|
|
516
|
-
constructor(message?: RenderContentRef);
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
/**
|
|
520
|
-
* Interface for custom component content definition
|
|
521
|
-
*/
|
|
522
|
-
export declare interface SimpleComponentDef {
|
|
523
|
-
componentName: string;
|
|
524
|
-
componentProps?: Record<any, any>;
|
|
525
|
-
componentVHtml?: string;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
export declare class Statement {
|
|
529
|
-
private readonly operand1;
|
|
530
|
-
private readonly operator;
|
|
531
|
-
private readonly operand2;
|
|
532
|
-
constructor(operand1: OperandType, operator: Operator, operand2: OperandType);
|
|
533
|
-
get operand1Value(): any;
|
|
534
|
-
get operand2Value(): any;
|
|
535
|
-
evaluate(): boolean;
|
|
536
|
-
/**
|
|
537
|
-
* Recursively collects all fields used in this statement and its nested statements
|
|
538
|
-
* @returns A set of all fields used in this statement
|
|
539
|
-
*/
|
|
540
|
-
collectFields(): Set<FieldBase>;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
/**
|
|
544
|
-
* Base validation error class with component rendering capabilities
|
|
545
|
-
*/
|
|
546
|
-
export declare class ValidationError {
|
|
547
|
-
get componentName(): string;
|
|
548
|
-
get componentBindings(): {};
|
|
549
|
-
get componentBody(): string;
|
|
550
|
-
get extraClasses(): ClassTypes;
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
/**
|
|
554
|
-
* Validation error that supports multiple content types (plain text, markdown, component)
|
|
555
|
-
*/
|
|
556
|
-
export declare class ValidationErrorRenderContent extends ValidationError {
|
|
557
|
-
classes: ClassTypes;
|
|
558
|
-
private text;
|
|
559
|
-
private textType;
|
|
560
|
-
constructor(text: RenderContentRef, classes?: ClassTypes);
|
|
561
|
-
get resolvedText(): RenderContentNonCallable;
|
|
562
|
-
get getTextType(): "string" | "md" | "component";
|
|
563
|
-
get componentName(): string;
|
|
564
|
-
get componentBindings(): Record<any, any>;
|
|
565
|
-
get componentBody(): string;
|
|
566
|
-
get extraClasses(): ClassTypes;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
/**
|
|
570
|
-
* Simple text-only ValidationError
|
|
571
|
-
*/
|
|
572
|
-
export declare class ValidationErrorText extends ValidationError {
|
|
573
|
-
text: string;
|
|
574
|
-
classes: ClassTypes;
|
|
575
|
-
constructor(text: string, classes?: ClassTypes);
|
|
576
|
-
get componentName(): string;
|
|
577
|
-
get componentBody(): string;
|
|
578
|
-
get extraClasses(): ClassTypes;
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
export declare type ValidationFunction<T = any> = (newValue: T, oldValue: T, field: FieldBase<T>) => ValidationFunctionResult | Promise<ValidationFunctionResult>;
|
|
582
|
-
|
|
583
|
-
export declare type ValidationFunctionResult = ValidationError[] | null;
|
|
584
|
-
|
|
585
|
-
/**
|
|
586
|
-
* Validator is a specialized action that performs validation when a field's value changes.
|
|
587
|
-
* It automatically adds/removes validation errors from the field's errors array.
|
|
588
|
-
*/
|
|
589
|
-
export declare class Validator<T = any> extends ValueChangedAction {
|
|
590
|
-
private readonly source;
|
|
591
|
-
/**
|
|
592
|
-
* Sequence number of the newest run of this validator, per field. Every execution takes the next number, and a
|
|
593
|
-
* result is applied only while its number is still the newest one, so a slow run cannot overwrite the verdict of
|
|
594
|
-
* a faster one that started after it. The key is the field because one validator instance may be registered on
|
|
595
|
-
* several fields, each with a sequence of its own.
|
|
596
|
-
*/
|
|
597
|
-
private readonly runs;
|
|
598
|
-
/**
|
|
599
|
-
* Creates a new validator
|
|
600
|
-
* @param validationFn Function that validates the field value and returns errors or null
|
|
601
|
-
*/
|
|
602
|
-
constructor(validationFn: ValidationFunction<T>);
|
|
603
|
-
/**
|
|
604
|
-
* Returns the error instance this validator owns and may later withdraw: the argument itself when it carries no
|
|
605
|
-
* ownership stamp or already carries this validator's, a copy of it when it belongs to another validator. The
|
|
606
|
-
* stamp is not configurable, so an instance one validator owns can never be reassigned to another; the copy is
|
|
607
|
-
* what makes an error instance shareable between validators, and it keeps the prototype and every own property,
|
|
608
|
-
* including the non-enumerable ones, so it renders exactly like the instance it was made from.
|
|
609
|
-
*/
|
|
610
|
-
private claim;
|
|
611
|
-
static get classIdentifier(): symbol;
|
|
612
|
-
get eager(): boolean;
|
|
613
|
-
protected replacePlaceholdersFunction(text: RenderContentRef, replace: Record<string, any>): RenderContentRef;
|
|
614
|
-
protected replacePlaceholders(text: RenderContentRef, replace: Record<string, any>): RenderContentRef;
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
export declare namespace Validators {
|
|
618
|
-
export {
|
|
619
|
-
CompareTo,
|
|
620
|
-
InAllowedValues,
|
|
621
|
-
Required_2 as Required,
|
|
622
|
-
Pattern,
|
|
623
|
-
ValidationFunctionResult,
|
|
624
|
-
ValidationFunction,
|
|
625
|
-
Validator,
|
|
626
|
-
MinValue,
|
|
627
|
-
MaxValue,
|
|
628
|
-
ValueInRange,
|
|
629
|
-
MinLength,
|
|
630
|
-
MaxLength,
|
|
631
|
-
LengthInRange
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
export declare class ValidChangedAction extends FieldActionBase {
|
|
636
|
-
constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean) => void);
|
|
637
|
-
static get classIdentifier(): symbol;
|
|
638
|
-
execute(field: FieldBase, supr: FieldActionExecute, newValue: boolean, oldValue: boolean): void;
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
export declare class ValueChangedAction<T = any> extends FieldActionBase {
|
|
642
|
-
constructor(executorFn: (field: FieldBase<T>, supr: FieldActionExecute<T>, newValue: T, oldValue: T) => void);
|
|
643
|
-
static get classIdentifier(): symbol;
|
|
644
|
-
execute(field: FieldBase<T>, supr: FieldActionExecute<T>, newValue: T, oldValue: T): void;
|
|
645
|
-
}
|
|
646
|
-
|
|
647
|
-
declare class ValueInRange<T = any> extends Validator {
|
|
648
|
-
constructor(minValue: T, maxValue: T, message?: RenderContentRef);
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
export declare class VisibilityChangedAction extends FieldActionBase {
|
|
652
|
-
constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, newValue: DisplayMode, oldValue: DisplayMode) => void);
|
|
653
|
-
static get classIdentifier(): symbol;
|
|
654
|
-
execute(field: FieldBase, supr: FieldActionExecute, newValue: DisplayMode, oldValue: DisplayMode): void;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
export declare class VisibilityChangingAction extends FieldActionBase {
|
|
658
|
-
constructor(executorFn: (field: FieldBase, supr: FieldActionExecute, newValue: DisplayMode, oldValue: DisplayMode) => DisplayMode);
|
|
659
|
-
static get classIdentifier(): symbol;
|
|
660
|
-
execute(field: FieldBase, supr: FieldActionExecute, newValue: DisplayMode, oldValue: DisplayMode): DisplayMode;
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
export { }
|