@piying/view-angular-core 2.4.6 → 2.5.1
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/index.d.ts
CHANGED
|
@@ -55,14 +55,34 @@ declare const enum UpdateType {
|
|
|
55
55
|
|
|
56
56
|
declare const ValidatorPending: unique symbol;
|
|
57
57
|
|
|
58
|
-
type
|
|
58
|
+
type ValidationErrorsLegacy = {
|
|
59
59
|
[key: string]: any;
|
|
60
60
|
};
|
|
61
|
+
type ValidationValibotError2 = {
|
|
62
|
+
kind: 'valibot';
|
|
63
|
+
metadata: [v.BaseIssue<unknown>, ...v.BaseIssue<unknown>[]];
|
|
64
|
+
};
|
|
65
|
+
type ValidationErrorError2 = {
|
|
66
|
+
kind: 'error';
|
|
67
|
+
metadata: Error;
|
|
68
|
+
};
|
|
69
|
+
type ValidationDescendantError2 = {
|
|
70
|
+
kind: 'descendant';
|
|
71
|
+
key: string | number;
|
|
72
|
+
field: AbstractControl;
|
|
73
|
+
metadata: ValidationCommonError2[];
|
|
74
|
+
};
|
|
75
|
+
type ValidationCommonError2 = {
|
|
76
|
+
kind: string;
|
|
77
|
+
metadata?: any;
|
|
78
|
+
message?: string;
|
|
79
|
+
};
|
|
80
|
+
type ValidationErrors2 = ValidationValibotError2 | ValidationErrorError2 | ValidationDescendantError2 | ValidationCommonError2;
|
|
61
81
|
interface ValidatorFn {
|
|
62
|
-
(control: AbstractControl):
|
|
82
|
+
(control: AbstractControl): ValidationErrorsLegacy | ValidationErrors2[] | undefined;
|
|
63
83
|
}
|
|
64
84
|
interface AsyncValidatorFn {
|
|
65
|
-
(control: AbstractControl): Promise<
|
|
85
|
+
(control: AbstractControl): Promise<ValidationErrorsLegacy | ValidationErrors2[] | undefined> | Observable<ValidationErrorsLegacy | ValidationErrors2[] | undefined> | Signal<ValidationErrorsLegacy | ValidationErrors2[] | undefined>;
|
|
66
86
|
}
|
|
67
87
|
declare const VALID = "VALID";
|
|
68
88
|
declare const INVALID = "INVALID";
|
|
@@ -86,12 +106,15 @@ declare abstract class AbstractControl<TValue = any> {
|
|
|
86
106
|
/** 父级取值时,当前子级是否包含在内 */
|
|
87
107
|
shouldInclude$$: Signal<boolean>;
|
|
88
108
|
readonly injector: Injector;
|
|
109
|
+
originValue$$: Signal<TValue | undefined>;
|
|
89
110
|
/** model的value */
|
|
90
|
-
value$$: Signal<TValue
|
|
111
|
+
value$$: Signal<TValue>;
|
|
91
112
|
/** 已激活的子级,用于校验获得返回值之类 */
|
|
92
113
|
activatedChildren$$?: Signal<AbstractControl[]>;
|
|
93
114
|
/** 通用的子级,用于查询之类 */
|
|
94
|
-
children$$?: Signal<
|
|
115
|
+
children$$?: Signal<{
|
|
116
|
+
[s: string]: AbstractControl;
|
|
117
|
+
} | ArrayLike<AbstractControl>>;
|
|
95
118
|
/** disabled */
|
|
96
119
|
readonly selfDisabled$$: Signal<boolean>;
|
|
97
120
|
/** `self` || `parent` */
|
|
@@ -112,16 +135,16 @@ declare abstract class AbstractControl<TValue = any> {
|
|
|
112
135
|
get dirty(): boolean;
|
|
113
136
|
get pristine(): boolean;
|
|
114
137
|
protected resetIndex$: _angular_core.WritableSignal<number>;
|
|
115
|
-
syncError$: _angular_core.WritableSignal<
|
|
116
|
-
asyncErrorRes$$: Signal<Signal<typeof ValidatorPending |
|
|
117
|
-
asyncError$$: Signal<"PENDING" |
|
|
118
|
-
rawError$$: Signal<"PENDING" |
|
|
138
|
+
syncError$: _angular_core.WritableSignal<ValidationErrors2[] | undefined>;
|
|
139
|
+
asyncErrorRes$$: Signal<Signal<typeof ValidatorPending | (ValidationValibotError2 | ValidationErrorError2 | ValidationDescendantError2 | ValidationCommonError2)[] | undefined> | undefined>;
|
|
140
|
+
asyncError$$: Signal<"PENDING" | (ValidationValibotError2 | ValidationErrorError2 | ValidationDescendantError2 | ValidationCommonError2)[] | undefined>;
|
|
141
|
+
rawError$$: Signal<"PENDING" | ValidationErrors2[] | undefined>;
|
|
119
142
|
valueNoError$$: Signal<boolean>;
|
|
120
|
-
get errors():
|
|
143
|
+
get errors(): ValidationErrors2[] | undefined;
|
|
121
144
|
/** parent */
|
|
122
145
|
private _parent?;
|
|
123
146
|
get parent(): AbstractControl | undefined;
|
|
124
|
-
get value(): TValue
|
|
147
|
+
get value(): TValue;
|
|
125
148
|
required$$: Signal<boolean | undefined>;
|
|
126
149
|
readonly schemaParser: v.SafeParser<SchemaOrPipe, undefined>;
|
|
127
150
|
context: any;
|
|
@@ -146,7 +169,7 @@ declare abstract class AbstractControl<TValue = any> {
|
|
|
146
169
|
updateValue(value: any): void;
|
|
147
170
|
config$: FieldFormConfig$;
|
|
148
171
|
protected getInitValue(value: any): any;
|
|
149
|
-
protected
|
|
172
|
+
protected transformToModel(value: any, control: AbstractControl<any>): any;
|
|
150
173
|
find(name: string | number): AbstractControl | null;
|
|
151
174
|
setControl(name: string | number, control: AbstractControl): void;
|
|
152
175
|
/** 校验和获得值用 */
|
|
@@ -171,13 +194,15 @@ declare class FieldGroup<TControl extends {
|
|
|
171
194
|
[K in keyof TControl]: AbstractControl<any>;
|
|
172
195
|
} = any> extends FieldGroupbase {
|
|
173
196
|
#private;
|
|
174
|
-
|
|
197
|
+
originValue$$: _angular_core.Signal<any>;
|
|
175
198
|
fixedControls$: _angular_core.WritableSignal<Record<string, AbstractControl<any>>>;
|
|
176
199
|
resetControls$: _angular_core.WritableSignal<Record<string, AbstractControl<any>>>;
|
|
177
200
|
get controls(): {
|
|
178
201
|
[x: string]: AbstractControl<any>;
|
|
179
202
|
};
|
|
180
|
-
children$$: _angular_core.Signal<
|
|
203
|
+
children$$: _angular_core.Signal<{
|
|
204
|
+
[x: string]: AbstractControl<any>;
|
|
205
|
+
}>;
|
|
181
206
|
removeRestControl(key: string): void;
|
|
182
207
|
setControl(key: string, control: AbstractControl): void;
|
|
183
208
|
getRawValue(): any;
|
|
@@ -196,7 +221,7 @@ declare class FieldControl<TValue = any> extends AbstractControl<TValue> {
|
|
|
196
221
|
/** 传入到view中的值 */
|
|
197
222
|
modelValueToViewValue$$: _angular_core.Signal<any>;
|
|
198
223
|
/** modelValue + viewValue => modelValue */
|
|
199
|
-
|
|
224
|
+
originValue$$: WritableSignal<any>;
|
|
200
225
|
reset(formState?: TValue): void;
|
|
201
226
|
/** view变更 */
|
|
202
227
|
viewValueChange(value: TValue | undefined): void;
|
|
@@ -207,7 +232,7 @@ declare class FieldControl<TValue = any> extends AbstractControl<TValue> {
|
|
|
207
232
|
|
|
208
233
|
declare class FieldArray<TControl extends AbstractControl<any> = any> extends FieldGroupbase {
|
|
209
234
|
#private;
|
|
210
|
-
|
|
235
|
+
originValue$$: _angular_core.Signal<any>;
|
|
211
236
|
children$$: _angular_core.Signal<AbstractControl<any>[]>;
|
|
212
237
|
fixedControls$: _angular_core.WritableSignal<AbstractControl<any>[]>;
|
|
213
238
|
resetControls$: _angular_core.WritableSignal<AbstractControl<any>[]>;
|
|
@@ -226,7 +251,7 @@ declare class FieldLogicGroup extends FieldArray {
|
|
|
226
251
|
activateIndex$: _angular_core.WritableSignal<number>;
|
|
227
252
|
type: _angular_core.WritableSignal<LogicType>;
|
|
228
253
|
activateControls$: _angular_core.WritableSignal<AbstractControl<any>[] | undefined>;
|
|
229
|
-
|
|
254
|
+
originValue$$: _angular_core.Signal<any>;
|
|
230
255
|
activatedChildren$$: _angular_core.Signal<AbstractControl<any>[]>;
|
|
231
256
|
getValue(rawData: boolean): any;
|
|
232
257
|
reset(value?: any[]): void;
|
|
@@ -427,10 +452,17 @@ declare function fieldControlStatusClass(fieldControl?: AbstractControl, skipDis
|
|
|
427
452
|
|
|
428
453
|
declare function initListen(input: any, control: AbstractControl, injector: Injector, fn: (input: any) => void): _angular_core.EffectRef;
|
|
429
454
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
455
|
+
interface ErrorSummary {
|
|
456
|
+
/** 方便判断是哪一个控件产生的异常 */
|
|
457
|
+
debugPathList: string[];
|
|
458
|
+
/** 可以用于直接get查询到当前配置 */
|
|
459
|
+
queryPathList: (number | string)[];
|
|
460
|
+
fieldList: AbstractControl[];
|
|
461
|
+
item: Exclude<ValidationErrors2, ValidationDescendantError2>;
|
|
462
|
+
valibotIssueSummary: string | undefined;
|
|
463
|
+
}
|
|
464
|
+
declare function errorSummary(control?: AbstractControl): ErrorSummary[];
|
|
465
|
+
declare const getDeepError: typeof errorSummary;
|
|
434
466
|
|
|
435
467
|
type ObservableSignal<Input, Output> = WritableSignal<Input> & {
|
|
436
468
|
input: Signal<Input>;
|
|
@@ -496,6 +528,8 @@ declare class CoreSchemaHandle<Self extends CoreSchemaHandle<any, any>, RESOLVED
|
|
|
496
528
|
nonFieldControl: boolean;
|
|
497
529
|
hooks?: HookConfig<ReturnType<RESOLVED_FN>>;
|
|
498
530
|
providers?: InjectorProvider[];
|
|
531
|
+
checkSchema?: v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>;
|
|
532
|
+
checkActions: (v.BaseValidation<any, any, any> | v.BaseTransformation<any, any, any>)[];
|
|
499
533
|
lazySchema(schema: LazySchema): void;
|
|
500
534
|
arraySchema(schema: ArraySchema<BaseSchema<unknown, unknown, BaseIssue<unknown>>, ErrorMessage<ArrayIssue> | undefined>): void;
|
|
501
535
|
defaultSchema(schema: DefaultSchema): void;
|
|
@@ -511,7 +545,11 @@ declare class CoreSchemaHandle<Self extends CoreSchemaHandle<any, any>, RESOLVED
|
|
|
511
545
|
beforeSchemaType(schema: Schema): void;
|
|
512
546
|
voidSchema(schema: VoidSchema): void;
|
|
513
547
|
metadataDefaulthandle(metadata: MetadataAction, environments: string[]): void;
|
|
548
|
+
validation(item: v.BaseValidation<any, any, v.BaseIssue<unknown>>): void;
|
|
549
|
+
transformation(item: v.BaseTransformation<any, any, v.BaseIssue<unknown>>): void;
|
|
514
550
|
end(schema: SchemaOrPipe): void;
|
|
551
|
+
coreSchema: v.BaseSchema<any, any, any>;
|
|
552
|
+
defineSchema(schema: SchemaOrPipe): void;
|
|
515
553
|
}
|
|
516
554
|
type AnyCoreSchemaHandle = CoreSchemaHandle<any, () => _PiResolvedCommonViewFieldConfig>;
|
|
517
555
|
|
|
@@ -858,5 +896,7 @@ declare class FormBuilder<SchemaHandle extends CoreSchemaHandle<any, any>> {
|
|
|
858
896
|
declare function isGroup(schema: AnyCoreSchemaHandle): boolean | undefined;
|
|
859
897
|
declare function isArray(schema: AnyCoreSchemaHandle): boolean;
|
|
860
898
|
|
|
861
|
-
|
|
862
|
-
|
|
899
|
+
declare function findError<K extends string>(list: ValidationErrors2[] | undefined, key: K): (K extends ValidationValibotError2['kind'] ? ValidationValibotError2 : K extends ValidationErrorError2['kind'] ? ValidationErrorError2 : ValidationCommonError2) | undefined;
|
|
900
|
+
|
|
901
|
+
export { AbstractControl, CoreSchemaHandle, CustomDataSymbol, FieldArray, FieldControl, FieldGroup, FieldLogicGroup, FormBuilder, INVALID, InitPendingValue, NFCSchema, PENDING, PI_CONTEXT_TOKEN, PI_VIEW_CONFIG_TOKEN, PI_VIEW_FIELD_TOKEN, SortedArray, UpdateType, VALID, actions, arrayStartsWith, asyncMergeOutputs, asyncObjectSignal, clone, combineSignal, controlStatusList, convert, createViewControlLink, disableWhen, effectListen, errorSummary, fieldControlStatusClass, findComponent, findError, formConfig, getDeepError, getLazyImport, hideWhen, initListen, isArray, isFieldArray, isFieldControl, isFieldGroup, isFieldLogicGroup, isGroup, isLazyMark, layout, lazyMark, mergeHooks, mergeHooksFn, mergeOutputFn, mergeOutputs, nonFieldControl, observableSignal, outputChange, outputChangeFn, patchHooks, rawConfig, removeHooks, renderConfig, setAlias, setComponent, setHooks, toArray, toObservable, valueChange, valueChangeFn, changeProviders as ɵchangeProviders, classAction as ɵclassAction, patchProviders as ɵpatchProviders, setProviders as ɵsetProviders, wrappers as ɵwrappers };
|
|
902
|
+
export type { AbstractControlParams, AnyCoreSchemaHandle, ArraryIterable, ArrayDeletionMode, AsyncCallback, AsyncObjectSignal, AsyncValidatorFn, BuildArrayItem, BuildGroupItem, BuildRootInputItem, BuildRootItem, CombineSignal, ConfigAction, ControlValueAccessor, CoreResolvedComponentDefine, CoreWrapperConfig, DisableWhenOption, DisabledValueStrategy, ErrorSummary, EventChangeFn, FieldArrayConfig$, FieldFormConfig, FieldFormConfig$, FieldGroupConfig$, FieldLogicGroupConfig$, FieldRenderConfig, FieldTransformerConfig, FormBuilderOptions, FormHooks, HideWhenOption, HookConfig, HooksConfig, InjectorProvider, KeyPath, LayoutAction, LazyImport, LazyMarkType, LogicType, MergeHooksConfig, NonFieldControlAction, ObservableSignal, PiCommonConfig, PiResolvedCommonViewFieldConfig, QueryPath, RawCoreWrapperConfig, RawKeyPath, SetOptional, SetReadonly, SetUnWrapper$, SetWrapper$, SetWrapper$$, SignalInputValue, ToObservableOptions, UnWrapSignal, UnWrapper$, VALID_STATUS, ValidationCommonError2, ValidationDescendantError2, ValidationErrorError2, ValidationErrors2, ValidationErrorsLegacy, ValidationValibotError2, ValidatorFn, ValueChangFnOptions, ValueChangeFn, ViewAttributes, ViewEvents, ViewInputs, ViewOutputs, ViewProps, Wrapper$, Writeable, _PiResolvedCommonViewFieldConfig };
|