@piying/view-angular-core 2.2.4 → 2.3.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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
|
-
import { WritableSignal, Signal, Injector, CreateEffectOptions, EffectRef, CreateSignalOptions, InjectionToken,
|
|
2
|
+
import { WritableSignal, Signal, Injector, CreateEffectOptions, EffectRef, CreateSignalOptions, Provider, StaticProvider, InjectionToken, DestroyableInjector } from '@angular/core';
|
|
3
3
|
import { UnaryFunction, Observable, BehaviorSubject, OperatorFunction } from 'rxjs';
|
|
4
4
|
import * as v from 'valibot';
|
|
5
5
|
import { BaseSchema, BaseMetadata, ArraySchema, BaseIssue, ErrorMessage, ArrayIssue } from 'valibot';
|
|
@@ -475,6 +475,7 @@ interface LayoutAction<TInput = unknown> extends BaseMetadata<TInput> {
|
|
|
475
475
|
}
|
|
476
476
|
declare function layout<TInput>(value: LayoutAction['value']): LayoutAction<TInput>;
|
|
477
477
|
|
|
478
|
+
type InjectorProvider = Provider | StaticProvider;
|
|
478
479
|
declare class CoreSchemaHandle<Self extends CoreSchemaHandle<any, any>, RESOLVED_FN extends () => any> extends BaseSchemaHandle<Self> {
|
|
479
480
|
inputs: _piying_view_angular_core.AsyncObjectSignal<ViewInputs>;
|
|
480
481
|
outputs: _piying_view_angular_core.AsyncObjectSignal<ViewOutputs>;
|
|
@@ -494,6 +495,7 @@ declare class CoreSchemaHandle<Self extends CoreSchemaHandle<any, any>, RESOLVED
|
|
|
494
495
|
isTuple: boolean;
|
|
495
496
|
nonFieldControl: boolean;
|
|
496
497
|
hooks?: HookConfig<ReturnType<RESOLVED_FN>>;
|
|
498
|
+
providers?: InjectorProvider[];
|
|
497
499
|
lazySchema(schema: LazySchema): void;
|
|
498
500
|
arraySchema(schema: ArraySchema<BaseSchema<unknown, unknown, BaseIssue<unknown>>, ErrorMessage<ArrayIssue> | undefined>): void;
|
|
499
501
|
defaultSchema(schema: DefaultSchema): void;
|
|
@@ -628,6 +630,7 @@ interface PiCommonConfig<C = any, W = any> {
|
|
|
628
630
|
declare const PI_VIEW_CONFIG_TOKEN: InjectionToken<PiCommonConfig<any, any>>;
|
|
629
631
|
/** 上下文注入 */
|
|
630
632
|
declare const PI_CONTEXT_TOKEN: InjectionToken<any>;
|
|
633
|
+
declare const PI_VIEW_FIELD_TOKEN: InjectionToken<Signal<_PiResolvedCommonViewFieldConfig>>;
|
|
631
634
|
|
|
632
635
|
interface BuildRootInputItem<SchemaHandle extends CoreSchemaHandle<any, any>> {
|
|
633
636
|
field: SchemaHandle;
|
|
@@ -638,6 +641,8 @@ interface BuildRootItem {
|
|
|
638
641
|
field: {
|
|
639
642
|
fieldGroup?: undefined;
|
|
640
643
|
fullPath: [];
|
|
644
|
+
injector: Injector;
|
|
645
|
+
providers?: InjectorProvider[];
|
|
641
646
|
};
|
|
642
647
|
form?: undefined;
|
|
643
648
|
resolvedField$: WritableSignal<_PiResolvedCommonViewFieldConfig | undefined>;
|
|
@@ -680,6 +685,10 @@ declare const classAction: {
|
|
|
680
685
|
asyncComponent: typeof patchAsyncClass;
|
|
681
686
|
};
|
|
682
687
|
|
|
688
|
+
declare function setProviders<T>(providers: InjectorProvider[]): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
689
|
+
declare function patchProviders<T>(providers: InjectorProvider[]): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
690
|
+
declare function changeProviders<T>(providersFn: (input: InjectorProvider[]) => InjectorProvider[]): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
691
|
+
|
|
683
692
|
declare const actions: {
|
|
684
693
|
class: {
|
|
685
694
|
top: <T>(className: clsx.ClassValue, merge?: boolean) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
@@ -704,6 +713,11 @@ declare const actions: {
|
|
|
704
713
|
set: _piying_view_angular_core.HooksConfig<_piying_view_angular_core.HookConfig<_piying_view_angular_core._PiResolvedCommonViewFieldConfig> | undefined>;
|
|
705
714
|
patch: _piying_view_angular_core.HooksConfig<_piying_view_angular_core.HookConfig<_piying_view_angular_core._PiResolvedCommonViewFieldConfig> | undefined>;
|
|
706
715
|
};
|
|
716
|
+
providers: {
|
|
717
|
+
set: typeof setProviders;
|
|
718
|
+
patch: typeof patchProviders;
|
|
719
|
+
change: typeof changeProviders;
|
|
720
|
+
};
|
|
707
721
|
inputs: {
|
|
708
722
|
patch: <T>(value: Record<string, any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
709
723
|
set: <T>(value: Record<string, any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
|
|
@@ -749,10 +763,9 @@ declare const actions: {
|
|
|
749
763
|
};
|
|
750
764
|
|
|
751
765
|
declare function convert<RESULT extends Omit<PiResolvedCommonViewFieldConfig<any, any>, 'define'>>(obj: SchemaOrPipe, options: SetOptional<ConvertOptions<typeof CoreSchemaHandle<any, any>>, 'handle'> & {
|
|
752
|
-
injector:
|
|
766
|
+
injector: DestroyableInjector;
|
|
753
767
|
builder: typeof FormBuilder<CoreSchemaHandle<any, any>>;
|
|
754
768
|
fieldGlobalConfig?: PiCommonConfig;
|
|
755
|
-
registerOnDestroy?: (fn: any) => void;
|
|
756
769
|
}): RESULT;
|
|
757
770
|
|
|
758
771
|
/** NonFieldControl */
|
|
@@ -798,7 +811,7 @@ type PiResolvedCommonViewFieldConfig<SelfResolvedFn extends () => any, Define> =
|
|
|
798
811
|
};
|
|
799
812
|
/** 仅用来开发时debug使用 */
|
|
800
813
|
readonly origin: any;
|
|
801
|
-
injector:
|
|
814
|
+
injector: Injector;
|
|
802
815
|
/** 外部传入引用 */
|
|
803
816
|
readonly context?: any;
|
|
804
817
|
get: (keyPath: KeyPath, aliasNotFoundFn?: (name: string, field: PiResolvedCommonViewFieldConfig<any, any>) => PiResolvedCommonViewFieldConfig<any, any>) => ReturnType<SelfResolvedFn> | undefined;
|
|
@@ -808,7 +821,7 @@ type PiResolvedCommonViewFieldConfig<SelfResolvedFn extends () => any, Define> =
|
|
|
808
821
|
};
|
|
809
822
|
readonly define?: WritableSignal<Define>;
|
|
810
823
|
wrappers: CombineSignal<CoreWrapperConfig>;
|
|
811
|
-
} & Readonly<Pick<AnyCoreSchemaHandle, 'priority' | 'alias'>> & Readonly<Required<Pick<AnyCoreSchemaHandle, 'inputs' | 'outputs' | 'attributes' | 'events'>>> & Readonly<Wrapper$<Required<Pick<AnyCoreSchemaHandle, 'formConfig' | 'renderConfig'>>>>;
|
|
824
|
+
} & Readonly<Pick<AnyCoreSchemaHandle, 'priority' | 'alias' | 'providers'>> & Readonly<Required<Pick<AnyCoreSchemaHandle, 'inputs' | 'outputs' | 'attributes' | 'events'>>> & Readonly<Wrapper$<Required<Pick<AnyCoreSchemaHandle, 'formConfig' | 'renderConfig'>>>>;
|
|
812
825
|
type _PiResolvedCommonViewFieldConfig = PiResolvedCommonViewFieldConfig<() => _PiResolvedCommonViewFieldConfig, CoreResolvedComponentDefine>;
|
|
813
826
|
interface FormBuilderOptions<T> {
|
|
814
827
|
form$$: Signal<FieldGroup>;
|
|
@@ -838,5 +851,5 @@ declare class FormBuilder<SchemaHandle extends CoreSchemaHandle<any, any>> {
|
|
|
838
851
|
declare function isGroup(schema: AnyCoreSchemaHandle): boolean | undefined;
|
|
839
852
|
declare function isArray(schema: AnyCoreSchemaHandle): boolean;
|
|
840
853
|
|
|
841
|
-
export { AbstractControl, CoreSchemaHandle, CustomDataSymbol, FieldArray, FieldControl, FieldGroup, FieldLogicGroup, FormBuilder, INVALID, InitPendingValue, NFCSchema, PENDING, PI_CONTEXT_TOKEN, PI_VIEW_CONFIG_TOKEN, SortedArray, UpdateType, VALID, actions, arrayStartsWith, asyncMergeOutputs, asyncObjectSignal, clone, combineSignal, controlStatusList, convert, createViewControlLink, disableWhen, effectListen, fieldControlStatusClass, findComponent, 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, classAction as ɵclassAction, wrappers as ɵwrappers };
|
|
842
|
-
export type { AbstractControlParams, AnyCoreSchemaHandle, ArraryIterable, ArrayDeletionMode, AsyncCallback, AsyncObjectSignal, AsyncValidatorFn, BuildArrayItem, BuildGroupItem, BuildRootInputItem, BuildRootItem, CombineSignal, ConfigAction, ControlValueAccessor, CoreResolvedComponentDefine, CoreWrapperConfig, DisableWhenOption, DisabledValueStrategy, EventChangeFn, FieldArrayConfig$, FieldFormConfig, FieldFormConfig$, FieldGroupConfig$, FieldLogicGroupConfig$, FieldRenderConfig, FieldTransformerConfig, FormBuilderOptions, FormHooks, HideWhenOption, HookConfig, HooksConfig, KeyPath, LayoutAction, LazyImport, LazyMarkType, LogicType, MergeHooksConfig, NonFieldControlAction, ObservableSignal, PiCommonConfig, PiResolvedCommonViewFieldConfig, QueryPath, RawKeyPath, SetOptional, SetReadonly, SetUnWrapper$, SetWrapper$, SetWrapper$$, SignalInputValue, ToObservableOptions, UnWrapSignal, UnWrapper$, VALID_STATUS, ValidationErrors, ValidatorFn, ValueChangFnOptions, ValueChangeFn, ViewAttributes, ViewEvents, ViewInputs, ViewOutputs, ViewProps, Wrapper$, Writeable, _PiResolvedCommonViewFieldConfig };
|
|
854
|
+
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, fieldControlStatusClass, findComponent, 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 };
|
|
855
|
+
export type { AbstractControlParams, AnyCoreSchemaHandle, ArraryIterable, ArrayDeletionMode, AsyncCallback, AsyncObjectSignal, AsyncValidatorFn, BuildArrayItem, BuildGroupItem, BuildRootInputItem, BuildRootItem, CombineSignal, ConfigAction, ControlValueAccessor, CoreResolvedComponentDefine, CoreWrapperConfig, DisableWhenOption, DisabledValueStrategy, 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, RawKeyPath, SetOptional, SetReadonly, SetUnWrapper$, SetWrapper$, SetWrapper$$, SignalInputValue, ToObservableOptions, UnWrapSignal, UnWrapper$, VALID_STATUS, ValidationErrors, ValidatorFn, ValueChangFnOptions, ValueChangeFn, ViewAttributes, ViewEvents, ViewInputs, ViewOutputs, ViewProps, Wrapper$, Writeable, _PiResolvedCommonViewFieldConfig };
|