@piying/view-angular-core 2.2.3 → 2.3.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
@@ -1,5 +1,5 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { WritableSignal, Signal, Injector, CreateEffectOptions, EffectRef, CreateSignalOptions, InjectionToken, EnvironmentInjector } from '@angular/core';
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;
@@ -638,6 +640,8 @@ interface BuildRootItem {
638
640
  field: {
639
641
  fieldGroup?: undefined;
640
642
  fullPath: [];
643
+ injector: Injector;
644
+ providers?: InjectorProvider[];
641
645
  };
642
646
  form?: undefined;
643
647
  resolvedField$: WritableSignal<_PiResolvedCommonViewFieldConfig | undefined>;
@@ -680,6 +684,10 @@ declare const classAction: {
680
684
  asyncComponent: typeof patchAsyncClass;
681
685
  };
682
686
 
687
+ declare function setProviders<T>(providers: InjectorProvider[]): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
688
+ declare function patchProviders<T>(providers: InjectorProvider[]): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
689
+ declare function changeProviders<T>(providersFn: (input: InjectorProvider[]) => InjectorProvider[]): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
690
+
683
691
  declare const actions: {
684
692
  class: {
685
693
  top: <T>(className: clsx.ClassValue, merge?: boolean) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
@@ -704,6 +712,11 @@ declare const actions: {
704
712
  set: _piying_view_angular_core.HooksConfig<_piying_view_angular_core.HookConfig<_piying_view_angular_core._PiResolvedCommonViewFieldConfig> | undefined>;
705
713
  patch: _piying_view_angular_core.HooksConfig<_piying_view_angular_core.HookConfig<_piying_view_angular_core._PiResolvedCommonViewFieldConfig> | undefined>;
706
714
  };
715
+ providers: {
716
+ set: typeof setProviders;
717
+ patch: typeof patchProviders;
718
+ change: typeof changeProviders;
719
+ };
707
720
  inputs: {
708
721
  patch: <T>(value: Record<string, any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
709
722
  set: <T>(value: Record<string, any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
@@ -749,10 +762,9 @@ declare const actions: {
749
762
  };
750
763
 
751
764
  declare function convert<RESULT extends Omit<PiResolvedCommonViewFieldConfig<any, any>, 'define'>>(obj: SchemaOrPipe, options: SetOptional<ConvertOptions<typeof CoreSchemaHandle<any, any>>, 'handle'> & {
752
- injector: Injector;
765
+ injector: DestroyableInjector;
753
766
  builder: typeof FormBuilder<CoreSchemaHandle<any, any>>;
754
767
  fieldGlobalConfig?: PiCommonConfig;
755
- registerOnDestroy?: (fn: any) => void;
756
768
  }): RESULT;
757
769
 
758
770
  /** NonFieldControl */
@@ -798,7 +810,7 @@ type PiResolvedCommonViewFieldConfig<SelfResolvedFn extends () => any, Define> =
798
810
  };
799
811
  /** 仅用来开发时debug使用 */
800
812
  readonly origin: any;
801
- injector: EnvironmentInjector;
813
+ injector: Injector;
802
814
  /** 外部传入引用 */
803
815
  readonly context?: any;
804
816
  get: (keyPath: KeyPath, aliasNotFoundFn?: (name: string, field: PiResolvedCommonViewFieldConfig<any, any>) => PiResolvedCommonViewFieldConfig<any, any>) => ReturnType<SelfResolvedFn> | undefined;
@@ -808,7 +820,7 @@ type PiResolvedCommonViewFieldConfig<SelfResolvedFn extends () => any, Define> =
808
820
  };
809
821
  readonly define?: WritableSignal<Define>;
810
822
  wrappers: CombineSignal<CoreWrapperConfig>;
811
- } & Readonly<Pick<AnyCoreSchemaHandle, 'priority' | 'alias'>> & Readonly<Required<Pick<AnyCoreSchemaHandle, 'inputs' | 'outputs' | 'attributes' | 'events'>>> & Readonly<Wrapper$<Required<Pick<AnyCoreSchemaHandle, 'formConfig' | 'renderConfig'>>>>;
823
+ } & Readonly<Pick<AnyCoreSchemaHandle, 'priority' | 'alias' | 'providers'>> & Readonly<Required<Pick<AnyCoreSchemaHandle, 'inputs' | 'outputs' | 'attributes' | 'events'>>> & Readonly<Wrapper$<Required<Pick<AnyCoreSchemaHandle, 'formConfig' | 'renderConfig'>>>>;
812
824
  type _PiResolvedCommonViewFieldConfig = PiResolvedCommonViewFieldConfig<() => _PiResolvedCommonViewFieldConfig, CoreResolvedComponentDefine>;
813
825
  interface FormBuilderOptions<T> {
814
826
  form$$: Signal<FieldGroup>;
@@ -838,5 +850,5 @@ declare class FormBuilder<SchemaHandle extends CoreSchemaHandle<any, any>> {
838
850
  declare function isGroup(schema: AnyCoreSchemaHandle): boolean | undefined;
839
851
  declare function isArray(schema: AnyCoreSchemaHandle): boolean;
840
852
 
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 };
853
+ 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, changeProviders as ɵchangeProviders, classAction as ɵclassAction, patchProviders as ɵpatchProviders, setProviders as ɵsetProviders, wrappers as ɵwrappers };
854
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piying/view-angular-core",
3
- "version": "2.2.3",
3
+ "version": "2.3.0",
4
4
  "homepage": "https://piying-org.github.io/website/docs/client/intro",
5
5
  "repository": {
6
6
  "url": "https://github.com/piying-org/piying-view"