@piying/view-angular-core 1.10.4 → 2.0.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,12 +1,13 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { WritableSignal, Signal, Injector, CreateEffectOptions, EffectRef, InjectionToken } from '@angular/core';
3
- import { UnaryFunction, Observable } from 'rxjs';
2
+ import { WritableSignal, Signal, Injector, CreateEffectOptions, EffectRef, CreateSignalOptions, InjectionToken } from '@angular/core';
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';
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, RawConfigActionCommon, ConvertOptions } from '@piying/valibot-visit';
7
+ import { SchemaOrPipe, BaseSchemaHandle, LazySchema, DefaultSchema, TupleSchema, ObjectSchema, EnumSchema, IntersectSchema, UnionSchema, Schema, VoidSchema, MetadataAction, RawConfigActionCommon, RawConfigAction, 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
+ import * as clsx from 'clsx';
10
11
  import { ClassValue } from 'clsx';
11
12
 
12
13
  type DisabledValueStrategy = 'reserve' | 'delete';
@@ -233,6 +234,9 @@ declare function isFieldLogicGroup(input: any): input is FieldLogicGroup;
233
234
 
234
235
  declare function arrayStartsWith(list: any[], parts: any[] | any): boolean;
235
236
 
237
+ type UnWrapSignal<T> = T extends Signal<infer Value> ? Value : T;
238
+ type SignalInputValue<T> = T | Signal<T> | WritableSignal<T> | undefined;
239
+
236
240
  type KeyPath = (string | number)[];
237
241
  type RawKeyPath = string | number;
238
242
  type SetOptional<OBJ, K extends keyof OBJ> = Omit<OBJ, K> & Partial<Pick<OBJ, K>>;
@@ -242,10 +246,14 @@ type QueryPath = string | number | KeyPath;
242
246
  type Wrapper$<T> = {
243
247
  [P in keyof T]: WritableSignal<T[P]>;
244
248
  };
249
+ type UnWrapper$<T> = {
250
+ [P in keyof T]: UnWrapSignal<T[P]>;
251
+ };
245
252
  type Wrapper$$<T> = {
246
253
  [P in keyof T]: Signal<T[P]>;
247
254
  };
248
255
  type SetWrapper$<OBJ, K extends keyof OBJ> = Omit<OBJ, K> & Wrapper$<Pick<OBJ, K>>;
256
+ type SetUnWrapper$<OBJ, K extends keyof OBJ> = Omit<OBJ, K> & UnWrapper$<Pick<OBJ, K>>;
249
257
  type SetWrapper$$<OBJ, K extends keyof OBJ> = Omit<OBJ, K> & Wrapper$$<Pick<OBJ, K>>;
250
258
  type Writeable<T> = {
251
259
  -readonly [P in keyof T]: T[P];
@@ -281,10 +289,6 @@ declare function toObservable<T>(listen: Signal<any>, source: Signal<T>, options
281
289
 
282
290
  declare const clone: <T>(input: T) => T;
283
291
 
284
- declare function unWrapSignal<T>(value?: T | Signal<T>): T | undefined;
285
- type UnWrapSignal<T> = T extends Signal<infer Value> ? Value : T;
286
- type SignalInputValue<T> = T | Signal<T> | WritableSignal<T> | undefined;
287
-
288
292
  declare function toArray(input: any): any[] | undefined;
289
293
 
290
294
  declare class SortedArray<T> extends Array {
@@ -421,6 +425,38 @@ declare function getDeepError(control?: AbstractControl): {
421
425
  errors: _piying_view_angular_core.ValidationErrors | undefined;
422
426
  }[];
423
427
 
428
+ type ObservableSignal<Input, Output> = WritableSignal<Input> & {
429
+ input: Signal<Input>;
430
+ output: Signal<Output>;
431
+ loading: Signal<boolean>;
432
+ input$$: Observable<Input>;
433
+ subject: BehaviorSubject<Input>;
434
+ output$$: Observable<Output>;
435
+ };
436
+ /** set输入,()输出的是管道后的值, */
437
+ declare function observableSignal<Input, Output>(initialValue: Input, options?: CreateSignalOptions<Input> & {
438
+ pipe?: OperatorFunction<Input, Output>;
439
+ injector?: Injector;
440
+ autoDestroy?: boolean;
441
+ }): ObservableSignal<Input, Output>;
442
+
443
+ type AsyncObjectSignal<Input> = Signal<Input> & {
444
+ connect: (key: string, value: Signal<any> | Promise<any> | Observable<any> | any) => void;
445
+ disconnect: (key: string) => void;
446
+ set(value: Input): void;
447
+ update(updateFn: (value: Input) => Input): void;
448
+ };
449
+ declare function asyncObjectSignal<Input extends Record<string, any> | undefined>(initialValue: Input, options?: CreateSignalOptions<Input>): AsyncObjectSignal<Input>;
450
+
451
+ type CombineSignal<Input> = Signal<Input[]> & {
452
+ add: (item: Signal<Input>, index?: number) => void;
453
+ remove: (item: Signal<Input>) => void;
454
+ items: () => Signal<Input>[];
455
+ clean: () => void;
456
+ update: (fn: (list: Signal<Input>[]) => Signal<Input>[]) => void;
457
+ };
458
+ declare function combineSignal<Input>(initialValue?: Signal<Input>[], options?: CreateSignalOptions<Input[]>): CombineSignal<Input>;
459
+
424
460
  interface LayoutAction<TInput = unknown> extends BaseMetadata<TInput> {
425
461
  readonly type: 'layout';
426
462
  readonly reference: typeof layout;
@@ -432,10 +468,12 @@ interface LayoutAction<TInput = unknown> extends BaseMetadata<TInput> {
432
468
  declare function layout<TInput>(value: LayoutAction['value']): LayoutAction<TInput>;
433
469
 
434
470
  declare class CoreSchemaHandle<Self extends CoreSchemaHandle<any, any>, RESOLVED_FN extends () => any> extends BaseSchemaHandle<Self> {
435
- inputs?: CoreRawViewInputs;
436
- outputs?: CoreRawViewOutputs;
437
- wrappers?: CoreRawWrapperConfig[];
438
- attributes?: Record<string, any>;
471
+ inputs: _piying_view_angular_core.AsyncObjectSignal<ViewInputs>;
472
+ outputs: _piying_view_angular_core.AsyncObjectSignal<ViewOutputs>;
473
+ attributes: _piying_view_angular_core.AsyncObjectSignal<ViewAttributes>;
474
+ events: _piying_view_angular_core.AsyncObjectSignal<ViewEvents>;
475
+ wrappers: _piying_view_angular_core.CombineSignal<CoreWrapperConfig>;
476
+ props: _piying_view_angular_core.AsyncObjectSignal<ViewProps>;
439
477
  alias?: string;
440
478
  movePath?: KeyPath;
441
479
  renderConfig?: FieldRenderConfig;
@@ -456,6 +494,7 @@ declare class CoreSchemaHandle<Self extends CoreSchemaHandle<any, any>, RESOLVED
456
494
  recordSchema(key: v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>, value: v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>): void;
457
495
  restSchema(schema: v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>): void;
458
496
  enumSchema(schema: EnumSchema): void;
497
+ updateProps(key: string, value: any): void;
459
498
  intersectBefore(schema: IntersectSchema): void;
460
499
  logicItemSchema(schema: v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>, index: number, type: 'intersect' | 'union'): void;
461
500
  unionBefore(schema: UnionSchema): void;
@@ -471,42 +510,9 @@ declare const rawConfig: <TInput>(value: (field: AnyCoreSchemaHandle, context?:
471
510
  declare function setComponent<T>(type: any): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle> | _piying_valibot_visit.MetadataListAction<T>;
472
511
  declare function findComponent<T>(field: _PiResolvedCommonViewFieldConfig, type: any): any;
473
512
 
474
- declare function setInputs<T>(inputs: CoreRawViewInputs): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
475
- declare function patchInputs<T>(inputs: CoreRawViewInputs): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
476
- declare function removeInputs<T>(list: string[]): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
477
- declare function asyncInputMerge(dataObj: Record<string, any>, data$: WritableSignal<any>): WritableSignal<any>;
478
- type AsyncResult = Promise<any> | Observable<any> | Signal<any> | (any & {});
479
- type AsyncProperty = (field: _PiResolvedCommonViewFieldConfig) => AsyncResult;
480
- declare function patchAsyncFn(patchKey: 'props' | 'inputs' | 'attributes'): <T>(dataObj: Record<string, AsyncProperty>, options?: {
481
- addPosition: "top" | "bottom";
482
- hookName: "fieldResolved" | "allFieldsResolved";
483
- }) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
484
- declare const patchAsyncInputs: <T>(dataObj: Record<string, AsyncProperty>, options?: {
485
- addPosition: "top" | "bottom";
486
- hookName: "fieldResolved" | "allFieldsResolved";
487
- }) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
488
-
489
- declare function setAttributes<T>(attributes: CoreRawViewAttributes): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
490
- declare function patchAttributes<T>(attributes: CoreRawViewAttributes): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
491
- declare function removeAttributes<T>(list: string[]): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
492
- declare const patchAsyncAttributes: <T>(dataObj: Record<string, _piying_view_angular_core.AsyncProperty>, options?: {
493
- addPosition: "top" | "bottom";
494
- hookName: "fieldResolved" | "allFieldsResolved";
495
- }) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
496
-
497
- declare function setProps<T>(props: CoreRawProps): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
498
- declare function patchProps<T>(props: CoreRawProps): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
499
- declare function removeProps<T>(list: string[]): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
500
- declare const patchAsyncProps: <T>(dataObj: Record<string, _piying_view_angular_core.AsyncProperty>, options?: {
501
- addPosition: "top" | "bottom";
502
- hookName: "fieldResolved" | "allFieldsResolved";
503
- }) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
504
-
505
- declare function setOutputs<T>(outputs: CoreRawViewOutputs): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, AnyCoreSchemaHandle>;
506
- declare function patchOutputs<T>(outputs: CoreRawViewOutputs): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, AnyCoreSchemaHandle>;
507
- declare function removeOutputs<T>(list: string[]): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, AnyCoreSchemaHandle>;
508
- declare function mergeOutputFn(field: _PiResolvedCommonViewFieldConfig, outputs: CoreRawViewOutputs): void;
513
+ declare function mergeOutputFn(field: _PiResolvedCommonViewFieldConfig, outputs: ViewOutputs): void;
509
514
  declare const mergeOutputs: <T>(outputs: Record<string, (...args: any[]) => void>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, AnyCoreSchemaHandle>;
515
+ declare const asyncMergeOutputs: <T>(outputs: Record<string, (field: _PiResolvedCommonViewFieldConfig) => (...args: any[]) => void>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, AnyCoreSchemaHandle>;
510
516
  type EventChangeFn = (fn: (input: {
511
517
  list: KeyPath | undefined;
512
518
  output: string;
@@ -518,18 +524,6 @@ type EventChangeFn = (fn: (input: {
518
524
  declare function outputChangeFn(rawField: AnyCoreSchemaHandle, fn: EventChangeFn): void;
519
525
  declare function outputChange<T>(fn: EventChangeFn): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, AnyCoreSchemaHandle>;
520
526
 
521
- declare function setWrappers<T>(wrappers: CoreRawWrapperConfig[]): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
522
- type PatchWrappersOptions = {
523
- position: 'head' | 'tail';
524
- };
525
- declare function patchWrappers<T>(wrappers: CoreRawWrapperConfig | CoreRawWrapperConfig[], options?: PatchWrappersOptions): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
526
- type AsyncCoreRawWrapperConfig = Omit<Exclude<CoreRawWrapperConfig, string>, 'inputs' | 'attributes'> & {
527
- inputs?: Record<string, AsyncProperty>;
528
- attributes?: Record<string, AsyncProperty>;
529
- };
530
- declare function patchAsyncWrapper<T>(inputWrapper: AsyncCoreRawWrapperConfig, options?: PatchWrappersOptions): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
531
- declare function removeWrappers<T>(list: string[]): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
532
-
533
527
  declare function setAlias<T>(alias: string): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
534
528
 
535
529
  declare function renderConfig<T>(type: FieldRenderConfig): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
@@ -584,16 +578,6 @@ interface DisableWhenOption<T extends _PiResolvedCommonViewFieldConfig = _PiReso
584
578
  }
585
579
  declare function disableWhen<TInput>(options: DisableWhenOption): _piying_valibot_visit.RawConfigAction<"viewRawConfig", TInput, _piying_view_angular_core.AnyCoreSchemaHandle>;
586
580
 
587
- /** 必须防止到所有wrappers操作后面,防止设置错误
588
- * 设置到顶层,可能是wrapper,也可能是component
589
- *
590
- */
591
- declare function topClass<T>(className: ClassValue, merge?: boolean): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
592
- /** 仅设置在组件上 */
593
- declare function componentClass<T>(className: ClassValue, merge?: boolean): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
594
- declare const bottomClass: typeof componentClass;
595
- declare function patchAsyncClass<T>(fn: (field: _PiResolvedCommonViewFieldConfig) => AsyncResult): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
596
-
597
581
  interface NonFieldControlAction<TInput = unknown> extends BaseMetadata<TInput> {
598
582
  readonly type: 'nonFieldControl';
599
583
  readonly reference: typeof nonFieldControl;
@@ -601,6 +585,140 @@ interface NonFieldControlAction<TInput = unknown> extends BaseMetadata<TInput> {
601
585
  }
602
586
  declare function nonFieldControl<TInput>(value?: boolean): NonFieldControlAction<TInput>;
603
587
 
588
+ declare const CustomDataSymbol: unique symbol;
589
+ type ConfigAction<T> = RawConfigAction<'viewRawConfig', T, any>;
590
+
591
+ declare function setWrappers<T>(wrappers: (SetOptional<SetUnWrapper$<CoreWrapperConfig, 'inputs' | 'outputs' | 'attributes' | 'events'>, 'inputs' | 'outputs' | 'attributes' | 'events'> | string)[]): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
592
+ declare function removeWrappers<T>(removeList: string[] | ((list: Signal<CoreWrapperConfig>[]) => Signal<CoreWrapperConfig>[])): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
593
+ declare function patchAsyncWrapper<T>(type: any, actions?: ConfigAction<any>[], options?: {
594
+ insertIndex?: number;
595
+ }): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
596
+ declare function changeAsyncWrapper<T>(indexFn: (list: Signal<CoreWrapperConfig>[]) => any, actions: ConfigAction<any>[]): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
597
+ declare const wrappers: {
598
+ set: typeof setWrappers;
599
+ patchAsync: typeof patchAsyncWrapper;
600
+ remove: typeof removeWrappers;
601
+ changeAsync: typeof changeAsyncWrapper;
602
+ };
603
+
604
+ interface PiCommonConfig<C = any, W = any> {
605
+ types?: Record<string, {
606
+ type?: C;
607
+ actions?: BaseMetadata<any>[];
608
+ }>;
609
+ wrappers?: Record<string, {
610
+ type: W;
611
+ actions?: RawConfigAction<'viewRawConfig', any, any>[];
612
+ }>;
613
+ }
614
+
615
+ /** 一些默认配置 */
616
+ declare const PI_VIEW_CONFIG_TOKEN: InjectionToken<PiCommonConfig<any, any>>;
617
+ /** 上下文注入 */
618
+ declare const PI_CONTEXT_TOKEN: InjectionToken<any>;
619
+
620
+ interface BuildRootInputItem<SchemaHandle extends CoreSchemaHandle<any, any>> {
621
+ field: SchemaHandle;
622
+ resolvedField$: WritableSignal<_PiResolvedCommonViewFieldConfig | undefined>;
623
+ }
624
+ interface BuildRootItem {
625
+ type: 'root';
626
+ field: {
627
+ fieldGroup?: undefined;
628
+ fullPath: [];
629
+ };
630
+ form?: undefined;
631
+ resolvedField$: WritableSignal<_PiResolvedCommonViewFieldConfig | undefined>;
632
+ append: (input: _PiResolvedCommonViewFieldConfig) => void;
633
+ }
634
+ interface BuildGroupItem<SchemaHandle extends CoreSchemaHandle<any, any>> {
635
+ type: 'group';
636
+ templateField?: SchemaHandle;
637
+ fields: SchemaHandle[];
638
+ form: FieldGroup;
639
+ field: _PiResolvedCommonViewFieldConfig;
640
+ append: (input: _PiResolvedCommonViewFieldConfig) => void;
641
+ skipAppend?: boolean;
642
+ }
643
+ interface BuildArrayItem<SchemaHandle extends CoreSchemaHandle<any, any>> {
644
+ type: 'array';
645
+ templateField: SchemaHandle;
646
+ fields: SchemaHandle[];
647
+ form: FieldArray;
648
+ field: _PiResolvedCommonViewFieldConfig;
649
+ append: (input: _PiResolvedCommonViewFieldConfig) => void;
650
+ skipAppend?: boolean;
651
+ }
652
+
653
+ type AsyncCallback<R> = (field: _PiResolvedCommonViewFieldConfig) => Promise<R> | Observable<R> | Signal<R> | (R & {});
654
+
655
+ /** 必须防止到所有wrappers操作后面,防止设置错误
656
+ * 设置到顶层,可能是wrapper,也可能是component
657
+ *
658
+ */
659
+ declare function topClass<T>(className: ClassValue, merge?: boolean): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
660
+ declare function patchAsyncClass<T>(fn: AsyncCallback<string>): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
661
+ declare function asyncTopClass<T>(classNameFn: AsyncCallback<ClassValue>): _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
662
+ declare const classAction: {
663
+ top: typeof topClass;
664
+ bottom: <T>(className: ClassValue, merge?: boolean) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
665
+ component: <T>(className: ClassValue, merge?: boolean) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
666
+ asyncTop: typeof asyncTopClass;
667
+ asyncBottom: typeof patchAsyncClass;
668
+ asyncComponent: typeof patchAsyncClass;
669
+ };
670
+
671
+ declare const actions: {
672
+ class: {
673
+ top: <T>(className: clsx.ClassValue, merge?: boolean) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
674
+ bottom: <T>(className: clsx.ClassValue, merge?: boolean) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
675
+ component: <T>(className: clsx.ClassValue, merge?: boolean) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
676
+ asyncTop: <T>(classNameFn: _piying_view_angular_core.AsyncCallback<clsx.ClassValue>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
677
+ asyncBottom: <T>(fn: _piying_view_angular_core.AsyncCallback<string>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
678
+ asyncComponent: <T>(fn: _piying_view_angular_core.AsyncCallback<string>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
679
+ };
680
+ wrappers: {
681
+ set: <T>(wrappers: (_piying_view_angular_core.SetOptional<_piying_view_angular_core.SetUnWrapper$<_piying_view_angular_core.CoreWrapperConfig, "inputs" | "outputs" | "attributes" | "events">, "inputs" | "outputs" | "attributes" | "events"> | string)[]) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
682
+ patchAsync: <T>(type: any, actions?: _piying_view_angular_core.ConfigAction<any>[], options?: {
683
+ insertIndex?: number;
684
+ }) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
685
+ remove: <T>(removeList: string[] | ((list: _angular_core.Signal<_piying_view_angular_core.CoreWrapperConfig>[]) => _angular_core.Signal<_piying_view_angular_core.CoreWrapperConfig>[])) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
686
+ changeAsync: <T>(indexFn: (list: _angular_core.Signal<_piying_view_angular_core.CoreWrapperConfig>[]) => any, actions: _piying_view_angular_core.ConfigAction<any>[]) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
687
+ };
688
+ inputs: {
689
+ patch: <T>(value: Record<string, any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
690
+ set: <T>(value: Record<string, any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
691
+ patchAsync: <T>(dataObj: Record<string, (field: _piying_view_angular_core._PiResolvedCommonViewFieldConfig) => any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
692
+ remove: <T>(list: string[]) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
693
+ };
694
+ outputs: {
695
+ patch: <T>(value: Record<string, (...args: any[]) => any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
696
+ set: <T>(value: Record<string, (...args: any[]) => any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
697
+ patchAsync: <T>(dataObj: Record<string, (field: _piying_view_angular_core._PiResolvedCommonViewFieldConfig) => (...args: any[]) => any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
698
+ remove: <T>(list: string[]) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
699
+ merge: <T>(outputs: Record<string, (...args: any[]) => void>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
700
+ mergeAsync: <T>(outputs: Record<string, (field: _piying_view_angular_core._PiResolvedCommonViewFieldConfig) => (...args: any[]) => void>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
701
+ };
702
+ attributes: {
703
+ patch: <T>(value: Record<string, any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
704
+ set: <T>(value: Record<string, any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
705
+ patchAsync: <T>(dataObj: Record<string, (field: _piying_view_angular_core._PiResolvedCommonViewFieldConfig) => any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
706
+ remove: <T>(list: string[]) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
707
+ };
708
+ events: {
709
+ patch: <T>(value: Record<string, (event: Event) => any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
710
+ set: <T>(value: Record<string, (event: Event) => any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
711
+ patchAsync: <T>(dataObj: Record<string, (field: _piying_view_angular_core._PiResolvedCommonViewFieldConfig) => (event: Event) => any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
712
+ remove: <T>(list: string[]) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
713
+ };
714
+ props: {
715
+ patch: <T>(value: Record<string, any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
716
+ set: <T>(value: Record<string, any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
717
+ patchAsync: <T>(dataObj: Record<string, (field: _piying_view_angular_core._PiResolvedCommonViewFieldConfig) => any>) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
718
+ remove: <T>(list: string[]) => _piying_valibot_visit.RawConfigAction<"viewRawConfig", T, _piying_view_angular_core.AnyCoreSchemaHandle>;
719
+ };
720
+ };
721
+
604
722
  declare function convert<RESULT extends Omit<PiResolvedCommonViewFieldConfig<any, any>, 'define'>>(obj: SchemaOrPipe, options: SetOptional<ConvertOptions, 'handle'> & {
605
723
  injector: Injector;
606
724
  builder: typeof FormBuilder;
@@ -614,20 +732,14 @@ declare const NFCSchema: v.OptionalSchema<v.VoidSchema<undefined>, undefined>;
614
732
  interface FieldRenderConfig {
615
733
  hidden?: boolean;
616
734
  }
617
- /** 全局定义使用 */
618
- type CoreRawComponentDefine = {
619
- /** @deprecated 使用actions */
735
+ /** 解析后define使用 */
736
+ type CoreResolvedComponentDefine = {
620
737
  type: any;
621
- /** @deprecated 使用actions */
622
- attributes?: Record<string, any>;
623
- /** @deprecated 使用actions */
624
- inputs?: CoreRawViewInputs;
625
- /** @deprecated 使用actions */
626
- outputs?: CoreRawViewOutputs;
627
- actions?: BaseMetadata<any>[];
738
+ inputs?: AsyncObjectSignal<ViewInputs>;
739
+ outputs?: AsyncObjectSignal<ViewOutputs>;
740
+ attributes?: AsyncObjectSignal<ViewAttributes>;
741
+ events?: AsyncObjectSignal<ViewEvents>;
628
742
  };
629
- /** 解析后define使用 */
630
- type CoreResolvedComponentDefine = SetWrapper$<CoreRawComponentDefine, 'attributes' | 'inputs' | 'outputs'>;
631
743
  interface HookConfig<RESOLVED_FIELD> {
632
744
  /** 配置刚被解析 */
633
745
  fieldResolved?: (field: RESOLVED_FIELD) => void;
@@ -664,119 +776,36 @@ type PiResolvedCommonViewFieldConfig<SelfResolvedFn extends () => any, Define> =
664
776
  remove: (index: any) => void;
665
777
  };
666
778
  readonly define?: WritableSignal<Define>;
667
- wrappers: WritableSignal<CoreResolvedWrapperConfig[]>;
668
- } & Readonly<Pick<AnyCoreSchemaHandle, 'priority' | 'alias'>> & Readonly<Wrapper$<Required<Pick<AnyCoreSchemaHandle, 'inputs' | 'outputs' | 'attributes' | 'formConfig' | 'renderConfig'>>>>;
779
+ wrappers: CombineSignal<CoreWrapperConfig>;
780
+ } & Readonly<Pick<AnyCoreSchemaHandle, 'priority' | 'alias'>> & Readonly<Required<Pick<AnyCoreSchemaHandle, 'inputs' | 'outputs' | 'attributes' | 'events'>>> & Readonly<Wrapper$<Required<Pick<AnyCoreSchemaHandle, 'formConfig' | 'renderConfig'>>>>;
669
781
  type _PiResolvedCommonViewFieldConfig = PiResolvedCommonViewFieldConfig<() => _PiResolvedCommonViewFieldConfig, CoreResolvedComponentDefine>;
670
- type ConfigMergeStrategy = 'merge' | 'replace';
671
- type PiCommonDefaultConfig = {
672
- /** @deprecated 使用actions代替 */
673
- formConfig?: CoreSchemaHandle<any, any>['formConfig'];
674
- /** @deprecated 使用actions代替 */
675
- props?: CoreSchemaHandle<any, any>['props'];
676
- /** @deprecated 使用actions代替 */
677
- renderConfig?: CoreSchemaHandle<any, any>['renderConfig'];
678
- /** @deprecated 使用actions代替 */
679
- inputs?: CoreSchemaHandle<any, any>['inputs'];
680
- /** @deprecated 使用actions代替 */
681
- outputs?: CoreSchemaHandle<any, any>['outputs'];
682
- /** @deprecated 使用actions代替 */
683
- wrappers?: CoreSchemaHandle<any, any>['wrappers'];
684
- /** @deprecated 使用actions代替*/
685
- attributes?: CoreSchemaHandle<any, any>['attributes'];
686
- /** @deprecated 使用actions代替*/
687
- type?: any;
688
- actions?: BaseMetadata<any>[];
689
- };
690
782
  interface FormBuilderOptions<T> {
691
783
  form$$: Signal<FieldGroup>;
692
784
  resolvedField$: WritableSignal<T>;
693
785
  context: any;
694
786
  }
695
- type CoreRawViewInputs = Record<string, any>;
696
- type CoreRawViewAttributes = Record<string, any>;
697
- type CoreRawProps = Record<string, any>;
698
- interface CoreRawViewOutputs {
699
- [name: string]: (...args: any[]) => void;
700
- }
701
- type CoreWrapperConfig1 = {
787
+ type ViewInputs = Record<string, any>;
788
+ type ViewOutputs = Record<string, (...args: any[]) => any>;
789
+ type ViewAttributes = Record<string, any>;
790
+ type ViewEvents = Record<string, (event: Event) => any>;
791
+ type ViewProps = Record<string, any>;
792
+ type CoreWrapperConfig = {
702
793
  type: string | any | LazyImport<any>;
703
- attributes?: CoreRawViewAttributes;
704
- inputs?: CoreRawViewInputs;
705
- outputs?: CoreRawViewOutputs;
706
- };
707
- type CoreRawWrapperConfig = string | CoreWrapperConfig1;
708
- type CoreResolvedWrapperConfig = {
709
- type: any | LazyImport<any>;
710
- attributes: WritableSignal<CoreRawViewAttributes | undefined>;
711
- inputs: WritableSignal<CoreRawViewInputs | undefined>;
712
- outputs?: CoreRawViewOutputs;
794
+ attributes: AsyncObjectSignal<ViewAttributes>;
795
+ inputs: AsyncObjectSignal<ViewInputs>;
796
+ outputs: AsyncObjectSignal<ViewOutputs>;
797
+ events: AsyncObjectSignal<ViewEvents>;
713
798
  };
714
799
 
715
- interface BuildRootInputItem<SchemaHandle extends CoreSchemaHandle<any, any>> {
716
- field: SchemaHandle;
717
- resolvedField$: WritableSignal<_PiResolvedCommonViewFieldConfig | undefined>;
718
- }
719
- interface BuildRootItem {
720
- type: 'root';
721
- field: {
722
- fieldGroup?: undefined;
723
- fullPath: [];
724
- };
725
- form?: undefined;
726
- resolvedField$: WritableSignal<_PiResolvedCommonViewFieldConfig | undefined>;
727
- append: (input: _PiResolvedCommonViewFieldConfig) => void;
728
- }
729
- interface BuildGroupItem<SchemaHandle extends CoreSchemaHandle<any, any>> {
730
- type: 'group';
731
- templateField?: SchemaHandle;
732
- fields: SchemaHandle[];
733
- form: FieldGroup;
734
- field: _PiResolvedCommonViewFieldConfig;
735
- append: (input: _PiResolvedCommonViewFieldConfig) => void;
736
- skipAppend?: boolean;
737
- }
738
- interface BuildArrayItem<SchemaHandle extends CoreSchemaHandle<any, any>> {
739
- type: 'array';
740
- templateField: SchemaHandle;
741
- fields: SchemaHandle[];
742
- form: FieldArray;
743
- field: _PiResolvedCommonViewFieldConfig;
744
- append: (input: _PiResolvedCommonViewFieldConfig) => void;
745
- skipAppend?: boolean;
746
- }
747
-
748
800
  declare class FormBuilder<SchemaHandle extends CoreSchemaHandle<any, any>> {
749
801
  #private;
750
802
  buildRoot(item: BuildRootInputItem<SchemaHandle>): void;
751
803
  allFieldInitHookCall(): void;
752
804
  afterResolveConfig(rawConfig: SchemaHandle, config: _PiResolvedCommonViewFieldConfig): _PiResolvedCommonViewFieldConfig | undefined;
753
- protected configMergeRaw<T extends SignalInputValue<any>>(list: T[], isArray: boolean, strategy: ConfigMergeStrategy): UnWrapSignal<NonNullable<T>>;
754
- /**
755
- * 后面覆盖前面
756
- * */
757
- protected configMerge<T extends SignalInputValue<any>>(list: T[], isArray: boolean, strategy: ConfigMergeStrategy): WritableSignal<UnWrapSignal<NonNullable<T>>>;
758
805
  }
759
806
 
760
- interface PiCommonConfig {
761
- types?: Record<string, PiCommonDefaultConfig>;
762
- /** @deprecated 使用defaultConfig中的actions代替 */
763
- defaultConfig?: Omit<PiCommonDefaultConfig, 'type'>;
764
- /** @deprecated 使用defaultConfig中的actions代替 */
765
- defaultConfigMergeStrategy?: Record<DefaultConfigKey, ConfigMergeStrategy>;
766
- wrappers?: Record<string, Omit<CoreWrapperConfig1, 'type'> & {
767
- type: any | LazyImport<any>;
768
- actions?: BaseMetadata<any>[];
769
- }>;
770
- }
771
- type DefaultConfigKey = Exclude<keyof PiCommonDefaultConfig, 'type' | 'actions'>;
772
-
773
- /** 一些默认配置 */
774
- declare const PI_VIEW_CONFIG_TOKEN: InjectionToken<PiCommonConfig>;
775
- /** 上下文注入 */
776
- declare const PI_CONTEXT_TOKEN: InjectionToken<any>;
777
-
778
807
  declare function isGroup(schema: AnyCoreSchemaHandle): boolean | undefined;
779
808
  declare function isArray(schema: AnyCoreSchemaHandle): boolean;
780
809
 
781
- export { AbstractControl, CoreSchemaHandle, FieldArray, FieldControl, FieldGroup, FieldLogicGroup, FormBuilder, INVALID, NFCSchema, PENDING, PI_CONTEXT_TOKEN, PI_VIEW_CONFIG_TOKEN, SortedArray, UpdateType, VALID, arrayStartsWith, asyncInputMerge, bottomClass, clone, componentClass, 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, outputChange, outputChangeFn, patchAsyncAttributes, patchAsyncClass, patchAsyncFn, patchAsyncInputs, patchAsyncProps, patchAsyncWrapper, patchAttributes, patchHooks, patchInputs, patchOutputs, patchProps, patchWrappers, rawConfig, removeAttributes, removeHooks, removeInputs, removeOutputs, removeProps, removeWrappers, renderConfig, setAlias, setAttributes, setComponent, setHooks, setInputs, setOutputs, setProps, setWrappers, toArray, toObservable, topClass, unWrapSignal, valueChange, valueChangeFn };
782
- export type { AbstractControlParams, AnyCoreSchemaHandle, ArraryIterable, ArrayDeletionMode, AsyncCoreRawWrapperConfig, AsyncProperty, AsyncResult, AsyncValidatorFn, BuildArrayItem, BuildGroupItem, BuildRootInputItem, BuildRootItem, ConfigMergeStrategy, ControlValueAccessor, CoreRawComponentDefine, CoreRawProps, CoreRawViewAttributes, CoreRawViewInputs, CoreRawViewOutputs, CoreRawWrapperConfig, CoreResolvedComponentDefine, CoreResolvedWrapperConfig, CoreWrapperConfig1, DefaultConfigKey, DisableWhenOption, DisabledValueStrategy, EventChangeFn, FieldArrayConfig$, FieldFormConfig, FieldFormConfig$, FieldGroupConfig$, FieldLogicGroupConfig$, FieldRenderConfig, FieldTransformerConfig, FormBuilderOptions, FormHooks, HideWhenOption, HookConfig, HooksConfig, KeyPath, LayoutAction, LazyImport, LazyMarkType, LogicType, MergeHooksConfig, NonFieldControlAction, PiCommonConfig, PiCommonDefaultConfig, PiResolvedCommonViewFieldConfig, QueryPath, RawKeyPath, SetOptional, SetReadonly, SetWrapper$, SetWrapper$$, SignalInputValue, ToObservableOptions, UnWrapSignal, VALID_STATUS, ValidationErrors, ValidatorFn, ValueChangFnOptions, ValueChangeFn, Wrapper$, Writeable, _PiResolvedCommonViewFieldConfig };
810
+ export { AbstractControl, CoreSchemaHandle, CustomDataSymbol, FieldArray, FieldControl, FieldGroup, FieldLogicGroup, FormBuilder, INVALID, 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 };
811
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piying/view-angular-core",
3
- "version": "1.10.4",
3
+ "version": "2.0.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"