@piying/view-angular-core 2.6.4 → 2.7.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/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { UnaryFunction, Observable, BehaviorSubject, OperatorFunction } from 'rx
|
|
|
4
4
|
import * as v from 'valibot';
|
|
5
5
|
import { BaseSchema, BaseMetadata, ArraySchema, BaseIssue, ErrorMessage, ArrayIssue } from 'valibot';
|
|
6
6
|
import * as _piying_valibot_visit from '@piying/valibot-visit';
|
|
7
|
-
import { SchemaOrPipe, BaseSchemaHandle, LazySchema, DefaultSchema, TupleSchema, ObjectSchema, EnumSchema, IntersectSchema, UnionSchema, Schema, VoidSchema, MetadataAction,
|
|
7
|
+
import { SchemaOrPipe, BaseSchemaHandle, LazySchema, DefaultSchema, TupleSchema, ObjectSchema, EnumSchema, IntersectSchema, UnionSchema, Schema, VoidSchema, MetadataAction, DefineTypeAction, RawConfigAction, RawConfigActionCommon, ConvertOptions } from '@piying/valibot-visit';
|
|
8
8
|
export { RawConfig, asControl, asVirtualGroup, changeObject, condition, getDefaults, getSchemaByIssuePath, getSchemaMetadata } from '@piying/valibot-visit';
|
|
9
9
|
import * as _piying_view_angular_core from '@piying/view-angular-core';
|
|
10
10
|
import * as clsx from 'clsx';
|
|
@@ -146,7 +146,7 @@ declare abstract class AbstractControl<TValue = any> {
|
|
|
146
146
|
private _parent?;
|
|
147
147
|
get parent(): AbstractControl | undefined;
|
|
148
148
|
get valuePath(): (string | number)[];
|
|
149
|
-
get
|
|
149
|
+
get fieldPath(): (string | number)[];
|
|
150
150
|
get value(): TValue;
|
|
151
151
|
required$$: Signal<boolean | undefined>;
|
|
152
152
|
readonly schemaParser: v.SafeParser<SchemaOrPipe, undefined>;
|
|
@@ -242,10 +242,7 @@ declare class FieldArray<TControl extends AbstractControl<any> = any> extends Fi
|
|
|
242
242
|
fixedControls$: _angular_core.WritableSignal<AbstractControl<any>[]>;
|
|
243
243
|
resetControls$: _angular_core.WritableSignal<AbstractControl<any>[]>;
|
|
244
244
|
get controls(): AbstractControl<any>[];
|
|
245
|
-
activatedChildren(): Iterable<[
|
|
246
|
-
string | number,
|
|
247
|
-
AbstractControl
|
|
248
|
-
]>;
|
|
245
|
+
activatedChildren(): Iterable<[string | number, AbstractControl]>;
|
|
249
246
|
removeRestControl(key: number): void;
|
|
250
247
|
setControl(key: number, control: TControl): void;
|
|
251
248
|
get length(): number;
|
|
@@ -566,7 +563,9 @@ type AnyCoreSchemaHandle = CoreSchemaHandle<any, () => _PiResolvedCommonViewFiel
|
|
|
566
563
|
|
|
567
564
|
declare const rawConfig: <TInput>(value: (field: AnyCoreSchemaHandle, context?: any) => void, workOn?: "afterSchemaType") => _piying_valibot_visit.RawConfigAction<"viewRawConfig", TInput, AnyCoreSchemaHandle>;
|
|
568
565
|
|
|
569
|
-
declare function setComponent<T>(type:
|
|
566
|
+
declare function setComponent<T, D>(type: D): D extends string ? DefineTypeAction<T> : RawConfigAction<'viewRawConfig', T, AnyCoreSchemaHandle> & {
|
|
567
|
+
__type: D;
|
|
568
|
+
};
|
|
570
569
|
declare function findComponent<T>(field: _PiResolvedCommonViewFieldConfig, type: any): any;
|
|
571
570
|
|
|
572
571
|
declare function mergeOutputFn(field: _PiResolvedCommonViewFieldConfig, outputs: ViewOutputs): void;
|
|
@@ -648,6 +647,8 @@ interface NonFieldControlAction<TInput = unknown> extends BaseMetadata<TInput> {
|
|
|
648
647
|
}
|
|
649
648
|
declare function nonFieldControl<TInput>(value?: boolean): NonFieldControlAction<TInput>;
|
|
650
649
|
|
|
650
|
+
type AsyncResult<T = any> = Promise<T> | Observable<T> | Signal<T> | (T & {});
|
|
651
|
+
type AsyncProperty<T = any> = (field: _PiResolvedCommonViewFieldConfig) => AsyncResult<T>;
|
|
651
652
|
declare const CustomDataSymbol: unique symbol;
|
|
652
653
|
type ConfigAction<T> = RawConfigAction<'viewRawConfig', T, any>;
|
|
653
654
|
|
|
@@ -664,19 +665,23 @@ declare const wrappers: {
|
|
|
664
665
|
changeAsync: typeof changeAsyncWrapper;
|
|
665
666
|
};
|
|
666
667
|
|
|
667
|
-
interface
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
668
|
+
interface PiTypeConfig<TComponent = any, TActionList extends readonly BaseMetadata<any>[] = any[]> {
|
|
669
|
+
type?: TComponent;
|
|
670
|
+
actions?: TActionList;
|
|
671
|
+
}
|
|
672
|
+
interface PiWrapperConfig<TWrapperComponent = any> {
|
|
673
|
+
type: TWrapperComponent;
|
|
674
|
+
actions?: RawConfigAction<'viewRawConfig', any, any>[];
|
|
675
|
+
}
|
|
676
|
+
interface PiCommonConfig<TComponent = any, TWrapperComponent = any, Types extends Record<string, PiTypeConfig<TComponent>> = Record<string, PiTypeConfig<TComponent>>, Wrappers extends Record<string, PiWrapperConfig<TWrapperComponent>> = Record<string, PiWrapperConfig<TWrapperComponent>>> {
|
|
677
|
+
types?: Types;
|
|
678
|
+
wrappers?: Wrappers;
|
|
676
679
|
}
|
|
680
|
+
type GetTypeConfig<Types extends Record<string, PiTypeConfig<any>>, Key extends string> = Key extends keyof Types ? Types[Key] : undefined;
|
|
681
|
+
type GetWrapperConfig<Wrappers extends Record<string, PiWrapperConfig<any>>, Key extends string> = Key extends keyof Wrappers ? Wrappers[Key] : undefined;
|
|
677
682
|
|
|
678
683
|
/** 一些默认配置 */
|
|
679
|
-
declare const PI_VIEW_CONFIG_TOKEN: InjectionToken<PiCommonConfig<any, any
|
|
684
|
+
declare const PI_VIEW_CONFIG_TOKEN: InjectionToken<PiCommonConfig<any, any, Record<string, _piying_view_angular_core.PiTypeConfig<any, any[]>>, Record<string, _piying_view_angular_core.PiWrapperConfig<any>>>>;
|
|
680
685
|
/** 上下文注入 */
|
|
681
686
|
declare const PI_CONTEXT_TOKEN: InjectionToken<any>;
|
|
682
687
|
declare const PI_VIEW_FIELD_TOKEN: InjectionToken<Signal<_PiResolvedCommonViewFieldConfig>>;
|
|
@@ -770,7 +775,7 @@ declare const actions: {
|
|
|
770
775
|
inputs: {
|
|
771
776
|
patch: <T>(value: Record<string, any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
772
777
|
set: <T>(value: Record<string, any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
773
|
-
patchAsync: <T>(dataObj: Record<string,
|
|
778
|
+
patchAsync: <T>(dataObj: Record<string, _piying_view_angular_core.AsyncProperty<any>>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
774
779
|
remove: <T>(list: string[]) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
775
780
|
mapAsync: <T>(fn: (field: _piying_view_angular_core._PiResolvedCommonViewFieldConfig) => (value: any) => any) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
776
781
|
};
|
|
@@ -786,7 +791,7 @@ declare const actions: {
|
|
|
786
791
|
attributes: {
|
|
787
792
|
patch: <T>(value: Record<string, any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
788
793
|
set: <T>(value: Record<string, any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
789
|
-
patchAsync: <T>(dataObj: Record<string,
|
|
794
|
+
patchAsync: <T>(dataObj: Record<string, _piying_view_angular_core.AsyncProperty<any>>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
790
795
|
remove: <T>(list: string[]) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
791
796
|
mapAsync: <T>(fn: (field: _piying_view_angular_core._PiResolvedCommonViewFieldConfig) => (value: any) => any) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
792
797
|
};
|
|
@@ -800,7 +805,7 @@ declare const actions: {
|
|
|
800
805
|
props: {
|
|
801
806
|
patch: <T>(value: Record<string, any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
802
807
|
set: <T>(value: Record<string, any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
803
|
-
patchAsync: <T>(dataObj: Record<string,
|
|
808
|
+
patchAsync: <T>(dataObj: Record<string, _piying_view_angular_core.AsyncProperty<any>>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
804
809
|
remove: <T>(list: string[]) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
805
810
|
mapAsync: <T>(fn: (field: _piying_view_angular_core._PiResolvedCommonViewFieldConfig) => (value: any) => any) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
806
811
|
};
|
|
@@ -910,4 +915,4 @@ declare function isArray(schema: AnyCoreSchemaHandle): boolean;
|
|
|
910
915
|
declare function findError<K extends string>(list: ValidationErrors2[] | undefined, key: K): (K extends ValidationValibotError2['kind'] ? ValidationValibotError2 : K extends ValidationErrorError2['kind'] ? ValidationErrorError2 : ValidationCommonError2) | undefined;
|
|
911
916
|
|
|
912
917
|
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 };
|
|
913
|
-
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 };
|
|
918
|
+
export type { AbstractControlParams, AnyCoreSchemaHandle, ArraryIterable, ArrayDeletionMode, AsyncCallback, AsyncObjectSignal, AsyncProperty, AsyncValidatorFn, BuildArrayItem, BuildGroupItem, BuildRootInputItem, BuildRootItem, CombineSignal, ConfigAction, ControlValueAccessor, CoreResolvedComponentDefine, CoreWrapperConfig, DisableWhenOption, DisabledValueStrategy, ErrorSummary, EventChangeFn, FieldArrayConfig$, FieldFormConfig, FieldFormConfig$, FieldGroupConfig$, FieldLogicGroupConfig$, FieldRenderConfig, FieldTransformerConfig, FormBuilderOptions, FormHooks, GetTypeConfig, GetWrapperConfig, HideWhenOption, HookConfig, HooksConfig, InjectorProvider, KeyPath, LayoutAction, LazyImport, LazyMarkType, LogicType, MergeHooksConfig, NonFieldControlAction, ObservableSignal, PiCommonConfig, PiResolvedCommonViewFieldConfig, PiTypeConfig, PiWrapperConfig, 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 };
|