@yongdall/web 0.5.2 → 0.5.4

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.mts CHANGED
@@ -1,112 +1,113 @@
1
1
  import * as dot_request1 from "dot-request";
2
2
  import DotRequest, { default as DotRequest$1 } from "dot-request";
3
3
  import { ArrayStore, BindObjectStore, ObjectStore, Schema, Schema as Schema$1, Store, Store as Store$1, StoreLayout, StoreLayout as StoreLayout$1, renderStore } from "@neeloong/form";
4
- import { Field, FormLayout, MaybePromise, PageForm, Permission, Permissions } from "@yongdall/types";
5
4
  import { Hook, Indicator, Plugin, Search } from "@yongdall/common";
5
+ import { Field, FormLayout, MaybePromise, PageForm, Permission, Permissions } from "@yongdall/types";
6
6
  import { Signal as Signal$1 } from "signal-polyfill";
7
- export * from "@yongdall/types";
8
7
  export * from "@yongdall/common";
8
+ export * from "@yongdall/types";
9
9
 
10
10
  //#region \0rolldown/runtime.js
11
11
  //#endregion
12
12
  //#region packages/web/signal.d.mts
13
13
  /**
14
14
  * @template T
15
- * @typedef {object} State
16
- * @property {() => T} get
17
- * @property {(newValue: T) => void} set
18
15
  */
16
+ interface State<T> {
17
+ get(): T;
18
+ set(newValue: T): void;
19
+ }
19
20
  /**
20
21
  * 相应式执行
21
- * @param {() => void} fn 执行函数
22
- * @param {AbortSignal} [signal]
23
- * @returns {void}
22
+ * @param fn 执行函数
23
+ * @param signal 可选的中断信号
24
24
  */
25
25
  declare function effect(fn: () => void, signal?: AbortSignal): void;
26
26
  /**
27
27
  * 创建可赋值计算值
28
28
  * @template T
29
- * @overload
30
- * @param {(() => T)[]} getter 取值方法
31
- * @param {(value: T[]) => void} callback 取值方法
32
- * @param {object} [options]
33
- * @param {boolean} [options.immediate] 是否立即执行一次
34
- * @param {AbortSignal} [options.signal]
35
- * @returns {void}
36
- */
37
- declare function watch<T>(getter: (() => T)[], callback: (value: T[]) => void, options?: {
38
- immediate?: boolean | undefined;
39
- signal?: AbortSignal | undefined;
40
- } | undefined): void;
29
+ * @param getter 取值方法或取值方法数组
30
+ * @param callback 回调函数,接收当前值和旧值
31
+ * @param options 配置选项
32
+ * @param options.immediate 是否立即执行一次
33
+ * @param options.signal 中断信号
34
+ */
35
+ declare function watch<T>(getter: (() => T)[], callback: (value: T[], oldValue: T[] | undefined, onCleanup: ((() => AbortSignal) & ((cleanupFn: () => void) => void))) => void, options?: {
36
+ immediate?: boolean;
37
+ signal?: AbortSignal;
38
+ }): void;
41
39
  /**
42
40
  * 创建可赋值计算值
43
41
  * @template T
44
- * @overload
45
- * @param {(() => any)[]} getter 取值方法
46
- * @param {(value: any[]) => void} callback 取值方法
47
- * @param {object} [options]
48
- * @param {boolean} [options.immediate] 是否立即执行一次
49
- * @param {AbortSignal} [options.signal]
50
- * @returns {void}
51
- */
52
- declare function watch<T>(getter: (() => any)[], callback: (value: any[]) => void, options?: {
53
- immediate?: boolean | undefined;
54
- signal?: AbortSignal | undefined;
55
- } | undefined): void;
42
+ * @param getter 取值方法或取值方法数组
43
+ * @param callback 回调函数,接收当前值和旧值
44
+ * @param options 配置选项
45
+ * @param options.immediate 是否立即执行一次
46
+ * @param options.signal 中断信号
47
+ */
48
+ declare function watch<T>(getter: (() => any)[], callback: (value: any[], oldValue: any[] | undefined, onCleanup: ((() => AbortSignal) & ((cleanupFn: () => void) => void))) => void, options?: {
49
+ immediate?: boolean;
50
+ signal?: AbortSignal;
51
+ }): void;
56
52
  /**
57
53
  * 创建可赋值计算值
58
54
  * @template T
59
- * @overload
60
- * @param {() => T} getter 取值方法
61
- * @param {(value: T) => void} callback 取值方法
62
- * @param {object} [options]
63
- * @param {boolean} [options.immediate] 是否立即执行一次
64
- * @param {AbortSignal} [options.signal]
65
- * @returns {void}
66
- */
67
- declare function watch<T>(getter: () => T, callback: (value: T) => void, options?: {
68
- immediate?: boolean | undefined;
69
- signal?: AbortSignal | undefined;
70
- } | undefined): void;
55
+ * @param getter 取值方法或取值方法数组
56
+ * @param callback 回调函数,接收当前值和旧值
57
+ * @param options 配置选项
58
+ * @param options.immediate 是否立即执行一次
59
+ * @param options.signal 中断信号
60
+ */
61
+ declare function watch<T>(getter: () => T, callback: (value: T, oldValue: T | undefined, onCleanup: ((() => AbortSignal) & ((cleanupFn: () => void) => void))) => void, options?: {
62
+ immediate?: boolean;
63
+ signal?: AbortSignal;
64
+ }): void;
71
65
  /**
66
+ * 创建响应式状态
72
67
  * @template T
73
- * @overload
74
- * @param {T} initValue
75
- * @returns {State<T>}
68
+ * @param initValue 初始值
69
+ * @returns 一个响应式状态对象
76
70
  */
77
71
  declare function createState<T>(initValue: T): State<T>;
78
72
  /**
73
+ * 创建响应式状态
79
74
  * @template T
80
- * @overload
81
- * @param {T} [initValue]
82
- * @returns {State<T | undefined>}
75
+ * @param initValue 初始值
76
+ * @returns 一个响应式状态对象
83
77
  */
84
- declare function createState<T>(initValue?: T | undefined): State<T | undefined>;
78
+ declare function createState<T>(initValue?: T): State<T | undefined>;
85
79
  /**
86
- *
80
+ * 创建计算状态
87
81
  * @template T
88
- * @param {() => T} get
89
- * @param {(newValue: T) => void} [set]
90
- * @returns {State<T>}
82
+ * @param get 获取函数
83
+ * @param set 设置函数(可选)
84
+ * @returns 一个响应式状态对象
91
85
  */
92
86
  declare function createComputed<T>(get: () => T, set?: (newValue: T) => void): State<T>;
93
87
  /**
94
- * @template {Record<string, any>} T
95
- * @param {State<T>} state
96
- * @param {Record<string, any>} struct
97
- * @returns {T}
88
+ * 创建安全计算状态,防止递归更新
89
+ * @template T
90
+ * @param initialValue 初始值
91
+ * @param get 获取函数
92
+ * @param set 设置函数(可选)
93
+ * @returns 一个响应式状态对象
94
+ */
95
+ declare function createSafeComputed<T>(initialValue: T, get: () => T, set?: (newValue: T) => void): State<T>;
96
+ /**
97
+ * 创建深层响应式状态
98
+ * @template T
99
+ * @param state 父状态
100
+ * @param struct 结构定义
101
+ * @returns 具有深层响应式属性的对象
98
102
  */
99
103
  declare function createDeeply<T extends Record<string, any>>(state: State<T>, struct: Record<string, any>): T;
100
104
  /**
101
- *
102
- * @param {number} interval
103
- * @param {AbortSignal} [signal]
105
+ * 创建响应式计时器
106
+ * @param interval 间隔时间(毫秒)
107
+ * @param signal 可选的中断信号
108
+ * @returns 表示计时次数的响应式状态
104
109
  */
105
110
  declare function createTick(interval: number, signal?: AbortSignal): State<number>;
106
- type State<T> = {
107
- get: () => T;
108
- set: (newValue: T) => void;
109
- };
110
111
  //#endregion
111
112
  //#region packages/web/route/home.d.mts
112
113
  declare class HomeContext {
@@ -653,13 +654,24 @@ declare class ModalFooter extends GeneralContext {
653
654
  declare class Modal extends GeneralContext {
654
655
  /**
655
656
  * @param {object} [options]
656
- * @param {AbortSignal} [options.signal]
657
+ * @param {AbortSignal?} [options.signal]
657
658
  * @param {HTMLElement} [options.parent]
659
+ * @param {boolean} [options.wide]
660
+ * @param {boolean} [options.inlineContainer]
661
+ * @param {boolean | (() => boolean)} [options.cancelable]
658
662
  */
659
663
  constructor(options?: {
660
- signal?: AbortSignal | undefined;
664
+ signal?: AbortSignal | null | undefined;
661
665
  parent?: HTMLElement | undefined;
666
+ wide?: boolean | undefined;
667
+ inlineContainer?: boolean | undefined;
668
+ cancelable?: boolean | (() => boolean) | undefined;
662
669
  });
670
+ get returnValue(): string;
671
+ set wide(wide: boolean);
672
+ get wide(): boolean;
673
+ set inlineContainer(inlineContainer: boolean);
674
+ get inlineContainer(): boolean;
663
675
  set cancelable(cancelable: boolean | (() => boolean));
664
676
  get cancelable(): boolean | (() => boolean);
665
677
  set size(size: string);
@@ -738,86 +750,6 @@ declare function createProgressModal<T, R>(list: T[], exec: (item: T, signal: Ab
738
750
  title?: string | undefined;
739
751
  }): Promise<PromiseSettledResult<R>[]>;
740
752
  //#endregion
741
- //#region packages/web/dom/index.d.mts
742
- declare const isMac: boolean;
743
- //#endregion
744
- //#region packages/web/route/PageSider.d.mts
745
- declare class PageSider extends GeneralContext {
746
- /**
747
- *
748
- * @param {ParentNode} parent
749
- * @param {Node?} next
750
- * @param {boolean} inserted
751
- * @param {AbortSignal} signal
752
- * @returns
753
- */
754
- constructor(parent: ParentNode, next: Node | null, inserted: boolean, signal: AbortSignal);
755
- /**
756
- * @template T
757
- * @overload
758
- * @param {(dialog: HTMLDialogElement, signal: AbortSignal) => PromiseLike<T> | T} exec
759
- * @param {AbortSignal} [signal]
760
- * @returns {Promise<T>}
761
- */
762
- createDialog<T>(exec: (dialog: HTMLDialogElement, signal: AbortSignal) => PromiseLike<T> | T, signal?: AbortSignal | undefined): Promise<T>;
763
- /**
764
- * @overload
765
- * @param {AbortSignal} [signal]
766
- * @returns {HTMLDialogElement}
767
- */
768
- createDialog(signal?: AbortSignal | undefined): HTMLDialogElement;
769
- /**
770
- * @template T
771
- * @overload
772
- * @param {(modal: Modal) => PromiseLike<T> | T} exec
773
- * @param {AbortSignal} [signal]
774
- * @returns {Promise<T>}
775
- */
776
- createModal<T>(exec: (modal: Modal) => PromiseLike<T> | T, signal?: AbortSignal | undefined): Promise<T>;
777
- /**
778
- * @overload
779
- * @param {AbortSignal} [signal]
780
- * @returns {Modal}
781
- */
782
- createModal(signal?: AbortSignal | undefined): Modal;
783
- /**
784
- * @template T
785
- * @template R
786
- * @param {T[]} list
787
- * @param {(item: T, signal: AbortSignal) => PromiseLike<R> | R} exec
788
- * @param {object} [options]
789
- * @param {AbortSignal} [options.signal]
790
- * @param {boolean} [options.abortable]
791
- * @param {string} [options.label]
792
- * @param {string} [options.title]
793
- */
794
- createProgressModal<T, R>(list: T[], exec: (item: T, signal: AbortSignal) => PromiseLike<R> | R, options?: {
795
- signal?: AbortSignal | undefined;
796
- abortable?: boolean | undefined;
797
- label?: string | undefined;
798
- title?: string | undefined;
799
- }): Promise<PromiseSettledResult<R>[]>;
800
- get container(): HTMLDivElement;
801
- set unprintable(unprintable: boolean);
802
- get unprintable(): boolean;
803
- set panel(panel: boolean);
804
- get panel(): boolean;
805
- set title(t: string);
806
- get title(): string;
807
- /**
808
- *
809
- * @param {(Menu | null)[]} menus
810
- * @param {Menu?} button
811
- * @param {Menu.Renderer} [create]
812
- * @returns
813
- */
814
- setMenu(menus: (Menu | null)[], button: Menu | null, create?: Menu.Renderer): void;
815
- get inserted(): boolean;
816
- insert(): void;
817
- remove(): void;
818
- #private;
819
- }
820
- //#endregion
821
753
  //#region packages/web/services/page.d.mts
822
754
  type PageConfiguration = {
823
755
  id?: string | undefined;
@@ -962,79 +894,160 @@ declare namespace PageIdent {
962
894
  type Parser = (path: string) => PageIdent.Route;
963
895
  }
964
896
  //#endregion
965
- //#region packages/web/route/PageHeader.d.mts
966
- declare class PageHeader extends GeneralContext {
897
+ //#region packages/web/route/PageHandle.d.mts
898
+ /**
899
+ * @typedef {object} RootPageExt
900
+ * @property {() => { path: string; search: string; hash: string; }} get
901
+ * @property {(path: string,search: string, hash: string) => void} update
902
+ */
903
+ declare class PageHandle extends GeneralContext {
967
904
  /**
968
905
  *
969
- * @param {HTMLElement} root
970
- * @param {AbortSignal} [signal]
971
- * @returns
906
+ * @param {Object} options
907
+ * @param {string} options.pageId
908
+ * @param {PageConfiguration?} options.define
909
+ * @param {PageIdent} options.ident
910
+ * @param {string} options.root
911
+ * @param {string} options.path
912
+ * @param {string} options.search
913
+ * @param {string} options.hash
914
+ * @param {PageInfo & RootPageExt} options.pageHandler
915
+ * @param {(url: string, replace?: boolean) => void} options.open
916
+ * @param {(p: string, replace?: boolean) => void} options.setRootPath
972
917
  */
973
- constructor(root: HTMLElement, signal?: AbortSignal);
918
+ constructor({
919
+ pageId,
920
+ define,
921
+ ident,
922
+ root,
923
+ path,
924
+ search,
925
+ hash,
926
+ pageHandler,
927
+ open,
928
+ setRootPath
929
+ }: {
930
+ pageId: string;
931
+ define: PageConfiguration | null;
932
+ ident: PageIdent;
933
+ root: string;
934
+ path: string;
935
+ search: string;
936
+ hash: string;
937
+ pageHandler: PageInfo & RootPageExt;
938
+ open: (url: string, replace?: boolean) => void;
939
+ setRootPath: (p: string, replace?: boolean) => void;
940
+ });
941
+ /** @param {string | (() => string)} title */
942
+ set title(title: string | (() => string));
943
+ /** @returns {string} */
944
+ get title(): string;
974
945
  /**
975
- * @template T
976
- * @overload
977
- * @param {(dialog: HTMLDialogElement, signal: AbortSignal) => PromiseLike<T> | T} exec
978
- * @param {AbortSignal} [signal]
979
- * @returns {Promise<T>}
946
+ *
947
+ * @param {(show: boolean) => void} fn
948
+ * @param {AbortSignal} signal
980
949
  */
981
- createDialog<T>(exec: (dialog: HTMLDialogElement, signal: AbortSignal) => PromiseLike<T> | T, signal?: AbortSignal | undefined): Promise<T>;
950
+ onToggle(fn: (show: boolean) => void, signal: AbortSignal): void;
951
+ get bootLoading(): boolean;
952
+ get define(): PageConfiguration | null;
953
+ get ident(): PageIdent;
954
+ get root(): string;
955
+ get path(): string;
956
+ get search(): string;
957
+ get hash(): string;
958
+ get href(): string;
959
+ get current(): boolean;
960
+ get shown(): boolean;
961
+ /** @param {string | (() => string)} icon */
962
+ set icon(icon: string | (() => string));
963
+ /** @returns {string} */
964
+ get icon(): string;
965
+ set print(print: Print);
966
+ get print(): Print;
967
+ /** @param {boolean | (() => boolean)} unsaved */
968
+ set unsaved(unsaved: boolean | (() => boolean));
969
+ /** @returns {boolean} */
970
+ get unsaved(): boolean;
971
+ /** @param {boolean | (() => boolean)} guarded */
972
+ set guarded(guarded: boolean | (() => boolean));
973
+ /** @returns {boolean} */
974
+ get guarded(): boolean;
975
+ set loading(loading: boolean);
976
+ get loading(): boolean;
977
+ /**
978
+ * @param {string} url
979
+ * @param {string | PageIdent} [page]
980
+ * @returns {string}
981
+ */
982
+ toUrl(url: string, page?: string | PageIdent): string;
982
983
  /**
983
984
  * @overload
984
- * @param {AbortSignal} [signal]
985
- * @returns {HTMLDialogElement}
985
+ * @param {string} url
986
+ * @param {boolean} [replace]
987
+ * @returns {void}
986
988
  */
987
- createDialog(signal?: AbortSignal | undefined): HTMLDialogElement;
989
+ open(url: string, replace?: boolean | undefined): void;
988
990
  /**
989
- * @template T
990
991
  * @overload
991
- * @param {(modal: Modal) => PromiseLike<T> | T} exec
992
- * @param {AbortSignal} [signal]
993
- * @returns {Promise<T>}
992
+ * @param {string} url
993
+ * @param {string | PageIdent} [page]
994
+ * @param {boolean} [replace]
995
+ * @returns {void}
994
996
  */
995
- createModal<T>(exec: (modal: Modal) => PromiseLike<T> | T, signal?: AbortSignal | undefined): Promise<T>;
997
+ open(url: string, page?: string | PageIdent | undefined, replace?: boolean | undefined): void;
996
998
  /**
997
999
  * @overload
998
- * @param {AbortSignal} [signal]
999
- * @returns {Modal}
1000
+ * @param {string} url
1001
+ * @param {boolean | string | PageIdent} [page]
1002
+ * @param {boolean} [replace]
1003
+ * @returns {void}
1000
1004
  */
1001
- createModal(signal?: AbortSignal | undefined): Modal;
1005
+ open(url: string, page?: string | boolean | PageIdent | undefined, replace?: boolean | undefined): void;
1002
1006
  /**
1003
- * @template T
1004
- * @template R
1005
- * @param {T[]} list
1006
- * @param {(item: T, signal: AbortSignal) => PromiseLike<R> | R} exec
1007
- * @param {object} [options]
1008
- * @param {AbortSignal} [options.signal]
1009
- * @param {boolean} [options.abortable]
1010
- * @param {string} [options.label]
1011
- * @param {string} [options.title]
1007
+ *
1008
+ * @param {string} p
1009
+ * @param {boolean} [replace]
1010
+ * @returns {void}
1012
1011
  */
1013
- createProgressModal<T, R>(list: T[], exec: (item: T, signal: AbortSignal) => PromiseLike<R> | R, options?: {
1014
- signal?: AbortSignal | undefined;
1015
- abortable?: boolean | undefined;
1016
- label?: string | undefined;
1017
- title?: string | undefined;
1018
- }): Promise<PromiseSettledResult<R>[]>;
1019
- set sticky(sticky: boolean);
1020
- get sticky(): boolean;
1021
- set panel(panel: boolean);
1022
- get panel(): boolean;
1023
- get container(): HTMLDivElement;
1012
+ setPath(p: string, replace?: boolean): void;
1024
1013
  /**
1025
1014
  *
1026
- * @param {*} menus
1027
- * @param {Menu.Renderer} [create]
1028
- * @returns
1015
+ * @param {boolean} [replace]
1016
+ * @returns {void}
1029
1017
  */
1030
- setMenu(menus: any, create?: Menu.Renderer): void;
1031
- set unprintable(unprintable: boolean);
1032
- get unprintable(): boolean;
1018
+ show(replace?: boolean): void;
1019
+ get destroyDeferred(): boolean;
1020
+ /**
1021
+ * @param {boolean} [defer]
1022
+ * @returns {boolean}
1023
+ */
1024
+ destroy(defer?: boolean): boolean;
1033
1025
  #private;
1034
1026
  }
1027
+ type RootPageExt = {
1028
+ get: () => {
1029
+ path: string;
1030
+ search: string;
1031
+ hash: string;
1032
+ };
1033
+ update: (path: string, search: string, hash: string) => void;
1034
+ };
1035
1035
  //#endregion
1036
- //#region packages/web/route/PageFooter.d.mts
1037
- declare class PageFooter extends GeneralContext {
1036
+ //#region packages/web/route/pageManager.d.mts
1037
+ /**
1038
+ *
1039
+ * @param {PageManager} manager
1040
+ * @returns
1041
+ */
1042
+ declare function addManager(manager: PageManager): () => void;
1043
+ declare function getPages(): PageHandle[];
1044
+ /**
1045
+ * 页面管理器
1046
+ */
1047
+ type PageManager = (page: PageHandle) => void;
1048
+ //#endregion
1049
+ //#region packages/web/route/PageHeader.d.mts
1050
+ declare class PageHeader extends GeneralContext {
1038
1051
  /**
1039
1052
  *
1040
1053
  * @param {HTMLElement} root
@@ -1092,22 +1105,27 @@ declare class PageFooter extends GeneralContext {
1092
1105
  set panel(panel: boolean);
1093
1106
  get panel(): boolean;
1094
1107
  get container(): HTMLDivElement;
1108
+ /**
1109
+ *
1110
+ * @param {*} menus
1111
+ * @param {Menu.Renderer} [create]
1112
+ * @returns
1113
+ */
1114
+ setMenu(menus: any, create?: Menu.Renderer): void;
1095
1115
  set unprintable(unprintable: boolean);
1096
1116
  get unprintable(): boolean;
1097
1117
  #private;
1098
1118
  }
1099
1119
  //#endregion
1100
- //#region packages/web/route/PageSection.d.mts
1101
- declare class PageSection extends GeneralContext {
1120
+ //#region packages/web/route/PageFooter.d.mts
1121
+ declare class PageFooter extends GeneralContext {
1102
1122
  /**
1103
1123
  *
1104
- * @param {ParentNode} parent
1105
- * @param {Node?} next
1106
- * @param {boolean} inserted
1107
- * @param {AbortSignal} signal
1124
+ * @param {HTMLElement} root
1125
+ * @param {AbortSignal} [signal]
1108
1126
  * @returns
1109
1127
  */
1110
- constructor(parent: ParentNode, next: Node | null, inserted: boolean, signal: AbortSignal);
1128
+ constructor(root: HTMLElement, signal?: AbortSignal);
1111
1129
  /**
1112
1130
  * @template T
1113
1131
  * @overload
@@ -1153,351 +1171,82 @@ declare class PageSection extends GeneralContext {
1153
1171
  label?: string | undefined;
1154
1172
  title?: string | undefined;
1155
1173
  }): Promise<PromiseSettledResult<R>[]>;
1174
+ set sticky(sticky: boolean);
1175
+ get sticky(): boolean;
1176
+ set panel(panel: boolean);
1177
+ get panel(): boolean;
1156
1178
  get container(): HTMLDivElement;
1157
1179
  set unprintable(unprintable: boolean);
1158
1180
  get unprintable(): boolean;
1159
- set panel(panel: boolean);
1160
- get panel(): boolean;
1161
- get inserted(): boolean;
1162
- insert(): void;
1163
- remove(): void;
1164
1181
  #private;
1165
1182
  }
1166
1183
  //#endregion
1167
- //#region packages/web/services/model.d.mts
1168
- /**
1169
- *
1170
- * @param {string} model
1171
- * @returns
1172
- */
1173
- declare function modelService(model: string): {
1174
- then<TResult1 = ModelConfiguration | null, TResult2 = never>(onfulfilled?: ((value: ModelConfiguration | null) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
1175
- catch<TResult2 = never>(onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<ModelConfiguration | TResult2 | null>;
1176
- finally(onfinally?: (() => void) | null | undefined): Promise<ModelConfiguration | null>;
1177
- /**
1178
- * @param {Search.Param} [options]
1179
- * @returns {Promise<{documents: any[]; total: number}>}
1180
- */
1181
- query({
1182
- values,
1183
- where,
1184
- orWhere,
1185
- sort,
1186
- limit,
1187
- page,
1188
- offset,
1189
- select,
1190
- total,
1191
- primary
1192
- }?: Search.Param): Promise<{
1193
- documents: any[];
1194
- total: number;
1195
- }>;
1196
- getOptions(): Record<string, any>[];
1197
- /**
1198
- * @overload
1199
- * @param {boolean} [options]
1200
- * @returns {Promise<Record<string, any>[]>}
1201
- */
1202
- options(options?: boolean | undefined): Promise<Record<string, any>[]>;
1203
- /**
1204
- * @overload
1205
- * @param {Search.Param} options
1206
- * @returns {Promise<{options: Record<string, any>[]; total: number}>}
1207
- */
1208
- options(options: Search.Param): Promise<{
1209
- options: Record<string, any>[];
1210
- total: number;
1211
- }>;
1212
- /**
1213
- *
1214
- * @param {string | number} id
1215
- */
1216
- option(id: string | number): Promise<any>;
1217
- /**
1218
- *
1219
- * @param {Record<string, any>} data
1220
- * @returns
1221
- */
1222
- create(data: Record<string, any>): Promise<any>;
1223
- /**
1224
- *
1225
- * @param {string | number} id
1226
- */
1227
- document(id: string | number): {
1228
- then<TResult1 = Record<string, any>, TResult2 = never>(onfulfilled?: ((value: Record<string, any>) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
1229
- catch<TResult2 = never>(onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<Record<string, any> | TResult2>;
1230
- finally(onfinally?: (() => void) | null | undefined): Promise<Record<string, any>>;
1231
- get: () => Promise<Record<string, any>>;
1232
- /**
1233
- * @param {Record<string, any>} data
1234
- * @returns
1235
- */
1236
- update(data: Record<string, any>): Promise<any>;
1237
- delete(): Promise<void>; /** @param {string} field */
1238
- field(field: string): {
1239
- then<TResult1 = any, TResult2 = never>(onfulfilled?: ((value: any) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
1240
- catch<TResult2 = never>(onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<any>;
1241
- finally(onfinally?: (() => void) | null | undefined): Promise<any>;
1242
- get: () => Promise<any>;
1243
- };
1244
- };
1245
- loadModel: (force?: boolean) => Promise<ModelConfiguration | null>;
1246
- loadScript: (force?: boolean) => Promise<ModelScriptConfiguration | null>;
1247
- getModel: () => ModelConfiguration | null;
1248
- getScript: () => ModelScriptConfiguration | null;
1249
- };
1250
- type ModelConfiguration = {
1251
- id?: string | undefined;
1252
- label?: string | undefined;
1253
- /**
1254
- * 字段配置
1255
- */
1256
- fields: Record<string, Field>;
1257
- /**
1258
- * 图标字段
1259
- */
1260
- iconField?: string | null | undefined;
1261
- /**
1262
- * 图像字段
1263
- */
1264
- imageField?: string | null | undefined;
1265
- /**
1266
- * 标签字段
1267
- */
1268
- labelField?: string | null | undefined;
1269
- /**
1270
- * 标签命名规则
1271
- */
1272
- labelPattern?: string | null | undefined;
1273
- /**
1274
- * 权限配置
1275
- */
1276
- permissions?: Permission[] | undefined;
1277
- /**
1278
- * 模型选项,关联前端脚本可读取
1279
- */
1280
- options?: Record<string, unknown> | null | undefined;
1281
- /**
1282
- * 关联前端脚本
1283
- */
1284
- scripts?: (string | [string, object])[] | null | undefined;
1285
- /**
1286
- * 关联默认页面
1287
- * // TODO: 查询配置
1288
- * // TODO: 前端按钮配置
1289
- * // TODO: 是否可销毁、可创建、更新、保存、upsert
1290
- * // TODO: 列表内操作按钮
1291
- * // TODO: 编辑内按钮
1292
- * // TODO: 操作事件
1293
- * // TODO: 是否分页
1294
- */
1295
- pages?: Record<string, string | object | null> | null | undefined;
1296
- };
1297
- type FieldScriptConfiguration = Omit<Field, "scripts" | "type"> & {
1298
- script?: Omit<FieldScript, "subFields">;
1299
- type: string | Record<string, FieldScriptConfiguration>;
1300
- };
1301
- type ModelScriptConfiguration = Omit<ModelConfiguration, "scripts" | "fields"> & {
1302
- script?: Omit<ModelScript, "fields">;
1303
- fields: Record<string, FieldScriptConfiguration>;
1304
- };
1305
- type ListScriptParameter = {
1306
- model: ModelScriptConfiguration;
1307
- checkedDocuments?: Record<string, any>[] | undefined;
1308
- documents?: Record<string, any>[] | undefined;
1309
- };
1310
- type DocumentScriptParameter = {
1311
- model: ModelScriptConfiguration;
1312
- document?: Record<string, any> | undefined;
1313
- store?: Store$1<any, any, {
1314
- [x: string]: any;
1315
- }> | undefined;
1316
- };
1317
- type ModelScript = {
1318
- /**
1319
- * 字段配置
1320
- */
1321
- fields?: Record<string, FieldScript> | undefined;
1322
- input?: ((document: any, ...fields: (string | number)[]) => void) | null | undefined;
1323
- change?: ((document: any, ...fields: (string | number)[]) => void) | null | undefined;
1324
- beforeCreate?: ((document: any) => void) | null | undefined;
1325
- beforeUpdate?: ((document: any) => void) | null | undefined;
1326
- beforeSave?: ((document: any) => void) | null | undefined;
1327
- beforeDestroy?: ((document: any) => void) | null | undefined;
1328
- beforeUpsert?: ((document: any) => void) | null | undefined;
1329
- listScripts?: Record<string, (params: ListScriptParameter) => void> | undefined;
1330
- documentScripts?: Record<string, (params: DocumentScriptParameter) => void> | undefined;
1331
- };
1332
- type FieldScript = {
1333
- /**
1334
- * 子字段配置
1335
- */
1336
- subFields?: Record<string, FieldScript> | undefined;
1337
- component?: FieldComponent<Record<string, any>> | undefined;
1338
- input?: ((value: InputEvent, store: Store$1) => void | boolean | null) | null | undefined;
1339
- change?: ((value: InputEvent, store: Store$1) => void | boolean | null) | null | undefined;
1340
- click?: ((value: Event, store: Store$1) => void | boolean | null) | null | undefined;
1341
- focus?: ((value: Event, store: Store$1) => void | boolean | null) | null | undefined;
1342
- blur?: ((value: Event, store: Store$1) => void | boolean | null) | null | undefined;
1343
- add?: ((document: any, field: string, ...fields: (string | number)[]) => void | object) | null | undefined;
1344
- remove?: ((value: any[], document: any, field: string, ...fields: (string | number)[]) => void) | null | undefined;
1345
- move?: ((from: number[], to: number, document: any, field: string, ...fields: (string | number)[]) => void) | null | undefined;
1346
- readonly?: ((store: Store$1) => boolean) | null | undefined;
1347
- hidden?: ((store: Store$1) => boolean) | null | undefined;
1348
- required?: ((store: Store$1) => boolean) | null | undefined;
1349
- clearable?: ((store: Store$1) => boolean) | null | undefined;
1350
- disabled?: ((store: Store$1) => boolean) | null | undefined;
1351
- default?: ((store: Store$1) => any) | null | undefined;
1352
- label?: ((store: Store$1) => string) | null | undefined;
1353
- description?: ((store: Store$1) => string) | null | undefined;
1354
- placeholder?: ((store: Store$1) => string) | null | undefined;
1355
- validator?: Schema$1.Validator | Schema$1.Validator[] | null | undefined;
1356
- source?: ((store?: Store$1 | null) => Iterable<Record<string, any>>) | null | undefined;
1357
- filter?: ((item: Record<string, any>, store?: Store$1 | null) => boolean) | null | undefined;
1358
- };
1359
- //#endregion
1360
- //#region packages/web/route/PageHandle.d.mts
1361
- /**
1362
- * @typedef {object} RootPageExt
1363
- * @property {() => { path: string; search: string; hash: string; }} get
1364
- * @property {(path: string,search: string, hash: string) => void} update
1365
- */
1366
- declare class PageHandle extends GeneralContext {
1367
- /**
1368
- *
1369
- * @param {Object} options
1370
- * @param {string} options.pageId
1371
- * @param {PageConfiguration?} options.define
1372
- * @param {PageIdent} options.ident
1373
- * @param {string} options.root
1374
- * @param {string} options.path
1375
- * @param {string} options.search
1376
- * @param {string} options.hash
1377
- * @param {PageInfo & RootPageExt} options.pageHandler
1378
- * @param {(url: string, replace?: boolean) => void} options.open
1379
- * @param {(p: string, replace?: boolean) => void} options.setRootPath
1380
- */
1381
- constructor({
1382
- pageId,
1383
- define,
1384
- ident,
1385
- root,
1386
- path,
1387
- search,
1388
- hash,
1389
- pageHandler,
1390
- open,
1391
- setRootPath
1392
- }: {
1393
- pageId: string;
1394
- define: PageConfiguration | null;
1395
- ident: PageIdent;
1396
- root: string;
1397
- path: string;
1398
- search: string;
1399
- hash: string;
1400
- pageHandler: PageInfo & RootPageExt;
1401
- open: (url: string, replace?: boolean) => void;
1402
- setRootPath: (p: string, replace?: boolean) => void;
1403
- });
1404
- set title(title: string);
1405
- get title(): string;
1184
+ //#region packages/web/route/PageSection.d.mts
1185
+ declare class PageSection extends GeneralContext {
1406
1186
  /**
1407
1187
  *
1408
- * @param {(show: boolean) => void} fn
1188
+ * @param {ParentNode} parent
1189
+ * @param {Node?} next
1190
+ * @param {boolean} inserted
1409
1191
  * @param {AbortSignal} signal
1192
+ * @returns
1410
1193
  */
1411
- onToggle(fn: (show: boolean) => void, signal: AbortSignal): void;
1412
- get bootLoading(): boolean;
1413
- get define(): PageConfiguration | null;
1414
- get ident(): PageIdent;
1415
- get root(): string;
1416
- get path(): string;
1417
- get search(): string;
1418
- get hash(): string;
1419
- get href(): string;
1420
- get current(): boolean;
1421
- get shown(): boolean;
1422
- set icon(icon: string);
1423
- get icon(): string;
1424
- set print(print: Print);
1425
- get print(): Print;
1426
- set unsaved(unsaved: boolean);
1427
- get unsaved(): boolean;
1428
- set loading(loading: boolean);
1429
- get loading(): boolean;
1430
- /**
1431
- * @param {string} url
1432
- * @param {string | PageIdent} [page]
1433
- * @returns {string}
1434
- */
1435
- toUrl(url: string, page?: string | PageIdent): string;
1194
+ constructor(parent: ParentNode, next: Node | null, inserted: boolean, signal: AbortSignal);
1436
1195
  /**
1196
+ * @template T
1437
1197
  * @overload
1438
- * @param {string} url
1439
- * @param {boolean} [replace]
1440
- * @returns {void}
1198
+ * @param {(dialog: HTMLDialogElement, signal: AbortSignal) => PromiseLike<T> | T} exec
1199
+ * @param {AbortSignal} [signal]
1200
+ * @returns {Promise<T>}
1441
1201
  */
1442
- open(url: string, replace?: boolean | undefined): void;
1202
+ createDialog<T>(exec: (dialog: HTMLDialogElement, signal: AbortSignal) => PromiseLike<T> | T, signal?: AbortSignal | undefined): Promise<T>;
1443
1203
  /**
1444
1204
  * @overload
1445
- * @param {string} url
1446
- * @param {string | PageIdent} [page]
1447
- * @param {boolean} [replace]
1448
- * @returns {void}
1205
+ * @param {AbortSignal} [signal]
1206
+ * @returns {HTMLDialogElement}
1449
1207
  */
1450
- open(url: string, page?: string | PageIdent | undefined, replace?: boolean | undefined): void;
1208
+ createDialog(signal?: AbortSignal | undefined): HTMLDialogElement;
1451
1209
  /**
1210
+ * @template T
1452
1211
  * @overload
1453
- * @param {string} url
1454
- * @param {boolean | string | PageIdent} [page]
1455
- * @param {boolean} [replace]
1456
- * @returns {void}
1457
- */
1458
- open(url: string, page?: string | boolean | PageIdent | undefined, replace?: boolean | undefined): void;
1459
- /**
1460
- *
1461
- * @param {string} p
1462
- * @param {boolean} [replace]
1463
- * @returns {void}
1212
+ * @param {(modal: Modal) => PromiseLike<T> | T} exec
1213
+ * @param {AbortSignal} [signal]
1214
+ * @returns {Promise<T>}
1464
1215
  */
1465
- setPath(p: string, replace?: boolean): void;
1216
+ createModal<T>(exec: (modal: Modal) => PromiseLike<T> | T, signal?: AbortSignal | undefined): Promise<T>;
1466
1217
  /**
1467
- *
1468
- * @param {boolean} [replace]
1469
- * @returns {void}
1218
+ * @overload
1219
+ * @param {AbortSignal} [signal]
1220
+ * @returns {Modal}
1470
1221
  */
1471
- show(replace?: boolean): void;
1472
- get destroyDeferred(): boolean;
1222
+ createModal(signal?: AbortSignal | undefined): Modal;
1473
1223
  /**
1474
- * @param {boolean} [defer]
1475
- * @returns {boolean}
1224
+ * @template T
1225
+ * @template R
1226
+ * @param {T[]} list
1227
+ * @param {(item: T, signal: AbortSignal) => PromiseLike<R> | R} exec
1228
+ * @param {object} [options]
1229
+ * @param {AbortSignal} [options.signal]
1230
+ * @param {boolean} [options.abortable]
1231
+ * @param {string} [options.label]
1232
+ * @param {string} [options.title]
1476
1233
  */
1477
- destroy(defer?: boolean): boolean;
1234
+ createProgressModal<T, R>(list: T[], exec: (item: T, signal: AbortSignal) => PromiseLike<R> | R, options?: {
1235
+ signal?: AbortSignal | undefined;
1236
+ abortable?: boolean | undefined;
1237
+ label?: string | undefined;
1238
+ title?: string | undefined;
1239
+ }): Promise<PromiseSettledResult<R>[]>;
1240
+ get container(): HTMLDivElement;
1241
+ set unprintable(unprintable: boolean);
1242
+ get unprintable(): boolean;
1243
+ set panel(panel: boolean);
1244
+ get panel(): boolean;
1245
+ get inserted(): boolean;
1246
+ insert(): void;
1247
+ remove(): void;
1478
1248
  #private;
1479
1249
  }
1480
- type RootPageExt = {
1481
- get: () => {
1482
- path: string;
1483
- search: string;
1484
- hash: string;
1485
- };
1486
- update: (path: string, search: string, hash: string) => void;
1487
- };
1488
- //#endregion
1489
- //#region packages/web/route/pageManager.d.mts
1490
- /**
1491
- *
1492
- * @param {PageManager} manager
1493
- * @returns
1494
- */
1495
- declare function addManager(manager: PageManager): () => void;
1496
- declare function getPages(): PageHandle[];
1497
- /**
1498
- * 页面管理器
1499
- */
1500
- type PageManager = (page: PageHandle) => void;
1501
1250
  //#endregion
1502
1251
  //#region packages/web/route/Page.d.mts
1503
1252
  declare class Page {
@@ -1866,8 +1615,12 @@ interface CurrentPage {
1866
1615
  icon: string;
1867
1616
  print: Print;
1868
1617
  unsaved: boolean;
1618
+ guarded: boolean;
1869
1619
  loading: boolean;
1870
1620
  }
1621
+ interface GlobalPage {
1622
+ guarded: boolean;
1623
+ }
1871
1624
  interface VerifyError {
1872
1625
  focus(): void;
1873
1626
  stop: boolean;
@@ -2038,6 +1791,7 @@ interface Hooks {
2038
1791
  /** 用户构造 */
2039
1792
  user: UserHook;
2040
1793
  commands: Record<string, Command>;
1794
+ /** @deprecated */
2041
1795
  configurationPages: Record<string, PageRenderer | string>;
2042
1796
  /** 图标库 */
2043
1797
  icons: Record<string, IconDefine>;
@@ -2085,18 +1839,404 @@ interface ModelIndicator {
2085
1839
  fields?: string[];
2086
1840
  get: (doc: object) => Indicator;
2087
1841
  }
2088
- interface PageFrame {
2089
- toggle(show: boolean): void;
2090
- destroy(): void;
1842
+ interface PageFrame {
1843
+ toggle(show: boolean): void;
1844
+ destroy(): void;
1845
+ }
1846
+ declare namespace PageFrame {
1847
+ interface Context {
1848
+ url: string;
1849
+ show: boolean;
1850
+ title: string;
1851
+ icon: string;
1852
+ loading: boolean;
1853
+ }
1854
+ }
1855
+ //#endregion
1856
+ //#region packages/web/services/model.d.mts
1857
+ /**
1858
+ *
1859
+ * @param {string} model
1860
+ * @returns
1861
+ */
1862
+ declare function modelService(model: string): {
1863
+ then<TResult1 = ModelConfiguration | null, TResult2 = never>(onfulfilled?: ((value: ModelConfiguration | null) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
1864
+ catch<TResult2 = never>(onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<ModelConfiguration | TResult2 | null>;
1865
+ finally(onfinally?: (() => void) | null | undefined): Promise<ModelConfiguration | null>;
1866
+ /**
1867
+ * @param {Search.Param} [options]
1868
+ * @returns {Promise<{documents: any[]; total: number}>}
1869
+ */
1870
+ query({
1871
+ values,
1872
+ where,
1873
+ orWhere,
1874
+ sort,
1875
+ limit,
1876
+ page,
1877
+ offset,
1878
+ select,
1879
+ total,
1880
+ primary
1881
+ }?: Search.Param): Promise<{
1882
+ documents: any[];
1883
+ total: number;
1884
+ }>;
1885
+ getOptions(): Record<string, any>[];
1886
+ /**
1887
+ * @overload
1888
+ * @param {boolean} [options]
1889
+ * @returns {Promise<Record<string, any>[]>}
1890
+ */
1891
+ options(options?: boolean | undefined): Promise<Record<string, any>[]>;
1892
+ /**
1893
+ * @overload
1894
+ * @param {Search.Param} options
1895
+ * @returns {Promise<{options: Record<string, any>[]; total: number}>}
1896
+ */
1897
+ options(options: Search.Param): Promise<{
1898
+ options: Record<string, any>[];
1899
+ total: number;
1900
+ }>;
1901
+ /**
1902
+ *
1903
+ * @param {string | number} id
1904
+ */
1905
+ option(id: string | number): Promise<any>;
1906
+ /**
1907
+ *
1908
+ * @param {Record<string, any>} data
1909
+ * @returns
1910
+ */
1911
+ create(data: Record<string, any>): Promise<any>;
1912
+ /**
1913
+ *
1914
+ * @param {string | number} id
1915
+ */
1916
+ document(id: string | number): {
1917
+ then<TResult1 = Record<string, any>, TResult2 = never>(onfulfilled?: ((value: Record<string, any>) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
1918
+ catch<TResult2 = never>(onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<Record<string, any> | TResult2>;
1919
+ finally(onfinally?: (() => void) | null | undefined): Promise<Record<string, any>>;
1920
+ get: () => Promise<Record<string, any>>;
1921
+ /**
1922
+ * @param {Record<string, any>} data
1923
+ * @returns
1924
+ */
1925
+ update(data: Record<string, any>): Promise<any>;
1926
+ delete(): Promise<void>; /** @param {string} field */
1927
+ field(field: string): {
1928
+ then<TResult1 = any, TResult2 = never>(onfulfilled?: ((value: any) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
1929
+ catch<TResult2 = never>(onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<any>;
1930
+ finally(onfinally?: (() => void) | null | undefined): Promise<any>;
1931
+ get: () => Promise<any>;
1932
+ };
1933
+ };
1934
+ loadModel: (force?: boolean) => Promise<ModelConfiguration | null>;
1935
+ loadScript: (force?: boolean) => Promise<ModelScriptConfiguration | null>;
1936
+ getModel: () => ModelConfiguration | null;
1937
+ getScript: () => ModelScriptConfiguration | null;
1938
+ };
1939
+ type ModelConfiguration = {
1940
+ id?: string | undefined;
1941
+ label?: string | undefined;
1942
+ /**
1943
+ * 字段配置
1944
+ */
1945
+ fields: Record<string, Field>;
1946
+ /**
1947
+ * 图标字段
1948
+ */
1949
+ iconField?: string | null | undefined;
1950
+ /**
1951
+ * 图像字段
1952
+ */
1953
+ imageField?: string | null | undefined;
1954
+ /**
1955
+ * 标签字段
1956
+ */
1957
+ labelField?: string | null | undefined;
1958
+ /**
1959
+ * 标签命名规则
1960
+ */
1961
+ labelPattern?: string | null | undefined;
1962
+ /**
1963
+ * 权限配置
1964
+ */
1965
+ permissions?: Permission[] | undefined;
1966
+ /**
1967
+ * 模型选项,关联前端脚本可读取
1968
+ */
1969
+ options?: Record<string, unknown> | null | undefined;
1970
+ /**
1971
+ * 关联前端脚本
1972
+ */
1973
+ scripts?: (string | [string, object])[] | null | undefined;
1974
+ /**
1975
+ * 关联默认页面
1976
+ * // TODO: 查询配置
1977
+ * // TODO: 前端按钮配置
1978
+ * // TODO: 是否可销毁、可创建、更新、保存、upsert
1979
+ * // TODO: 列表内操作按钮
1980
+ * // TODO: 编辑内按钮
1981
+ * // TODO: 操作事件
1982
+ * // TODO: 是否分页
1983
+ */
1984
+ pages?: Record<string, string | object | null> | null | undefined;
1985
+ };
1986
+ type FieldScriptConfiguration = Omit<Field, "scripts" | "type"> & {
1987
+ script?: Omit<FieldScript, "subFields">;
1988
+ type: string | Record<string, FieldScriptConfiguration>;
1989
+ };
1990
+ type ModelScriptConfiguration = Omit<ModelConfiguration, "scripts" | "fields"> & {
1991
+ script?: Omit<ModelScript, "fields">;
1992
+ fields: Record<string, FieldScriptConfiguration>;
1993
+ };
1994
+ type ListScriptParameter = {
1995
+ model: ModelScriptConfiguration;
1996
+ checkedDocuments?: Record<string, any>[] | undefined;
1997
+ documents?: Record<string, any>[] | undefined;
1998
+ };
1999
+ type DocumentScriptParameter = {
2000
+ model: ModelScriptConfiguration;
2001
+ document?: Record<string, any> | undefined;
2002
+ store?: Store$1<any, any, {
2003
+ [x: string]: any;
2004
+ }> | undefined;
2005
+ };
2006
+ type ModelScript = {
2007
+ /**
2008
+ * 字段配置
2009
+ */
2010
+ fields?: Record<string, FieldScript> | undefined;
2011
+ input?: ((document: any, ...fields: (string | number)[]) => void) | null | undefined;
2012
+ change?: ((document: any, ...fields: (string | number)[]) => void) | null | undefined;
2013
+ beforeCreate?: ((document: any) => void) | null | undefined;
2014
+ beforeUpdate?: ((document: any) => void) | null | undefined;
2015
+ beforeSave?: ((document: any) => void) | null | undefined;
2016
+ beforeDestroy?: ((document: any) => void) | null | undefined;
2017
+ beforeUpsert?: ((document: any) => void) | null | undefined;
2018
+ listScripts?: Record<string, (params: ListScriptParameter) => void> | undefined;
2019
+ documentScripts?: Record<string, (params: DocumentScriptParameter) => void> | undefined;
2020
+ };
2021
+ type FieldScript = {
2022
+ /**
2023
+ * 子字段配置
2024
+ */
2025
+ subFields?: Record<string, FieldScript> | undefined;
2026
+ component?: FieldComponent<Record<string, any>> | undefined;
2027
+ input?: ((value: InputEvent, store: Store$1) => void | boolean | null) | null | undefined;
2028
+ change?: ((value: InputEvent, store: Store$1) => void | boolean | null) | null | undefined;
2029
+ click?: ((value: Event, store: Store$1) => void | boolean | null) | null | undefined;
2030
+ focus?: ((value: Event, store: Store$1) => void | boolean | null) | null | undefined;
2031
+ blur?: ((value: Event, store: Store$1) => void | boolean | null) | null | undefined;
2032
+ add?: ((document: any, field: string, ...fields: (string | number)[]) => void | object) | null | undefined;
2033
+ remove?: ((value: any[], document: any, field: string, ...fields: (string | number)[]) => void) | null | undefined;
2034
+ move?: ((from: number[], to: number, document: any, field: string, ...fields: (string | number)[]) => void) | null | undefined;
2035
+ readonly?: ((store: Store$1) => boolean) | null | undefined;
2036
+ hidden?: ((store: Store$1) => boolean) | null | undefined;
2037
+ required?: ((store: Store$1) => boolean) | null | undefined;
2038
+ clearable?: ((store: Store$1) => boolean) | null | undefined;
2039
+ disabled?: ((store: Store$1) => boolean) | null | undefined;
2040
+ default?: ((store: Store$1) => any) | null | undefined;
2041
+ label?: ((store: Store$1) => string) | null | undefined;
2042
+ description?: ((store: Store$1) => string) | null | undefined;
2043
+ placeholder?: ((store: Store$1) => string) | null | undefined;
2044
+ validator?: Schema$1.Validator | Schema$1.Validator[] | null | undefined;
2045
+ source?: ((store?: Store$1 | null) => Iterable<Record<string, any>>) | null | undefined;
2046
+ filter?: ((item: Record<string, any>, store?: Store$1 | null) => boolean) | null | undefined;
2047
+ };
2048
+ //#endregion
2049
+ //#region packages/web/dom/Guide.d.mts
2050
+ /**
2051
+ * @typedef {object} Guide.Page
2052
+ * @property {string} label
2053
+ * @property {boolean} disabled
2054
+ * @property {boolean} hidden
2055
+ * @property {boolean} current
2056
+ * @property {number} index
2057
+ * @property {(force?: boolean) => void} switch
2058
+ */
2059
+ /**
2060
+ * @template T
2061
+ */
2062
+ declare class Guide<T> extends GeneralContext {
2063
+ /**
2064
+ * @param {Modal} modal
2065
+ * @param {Store} store
2066
+ * @param {Guide.PageForm[]} pages
2067
+ * @param {object} [options]
2068
+ * @param {string} [options.title]
2069
+ * @param {ModelScriptConfiguration?} [options.model]
2070
+ * @param {((store: Store) => boolean) | boolean} [options.cancelable]
2071
+ * @param {(store: Store) => boolean} [options.completable]
2072
+ */
2073
+ static modal(modal: Modal, store: Store$1, pages: Guide.PageForm[], options?: {
2074
+ title?: string | undefined;
2075
+ model?: ModelScriptConfiguration | null | undefined;
2076
+ cancelable?: boolean | ((store: Store$1) => boolean) | undefined;
2077
+ completable?: ((store: Store$1) => boolean) | undefined;
2078
+ }): Guide<unknown>;
2079
+ /**
2080
+ * @param {Store} store
2081
+ * @param {(Guide.PageForm<T>)[]} pages
2082
+ * @param {object} options
2083
+ * @param {((store: Store, state: State<T | undefined>) =>string) | string} [options.title]
2084
+ * @param {ModelScriptConfiguration?} [options.model]
2085
+ * @param {AbortSignal?} [options.signal]
2086
+ * @param {((store: Store, state: State<T | undefined>) => boolean) | boolean} [options.cancelable]
2087
+ * @param {(store: Store, state: State<T | undefined>) => boolean} [options.completable]
2088
+ */
2089
+ constructor(store: Store$1, pages: (Guide.PageForm<T>)[], {
2090
+ model,
2091
+ cancelable,
2092
+ completable,
2093
+ title,
2094
+ signal: _signal
2095
+ }: {
2096
+ title?: string | ((store: Store$1, state: State<T | undefined>) => string) | undefined;
2097
+ model?: ModelScriptConfiguration | null | undefined;
2098
+ signal?: AbortSignal | null | undefined;
2099
+ cancelable?: boolean | ((store: Store$1, state: State<T | undefined>) => boolean) | undefined;
2100
+ completable?: ((store: Store$1, state: State<T | undefined>) => boolean) | undefined;
2101
+ });
2102
+ get store(): Store$1<any, any, {
2103
+ [x: string]: any;
2104
+ }>;
2105
+ get state(): State<T | undefined>;
2106
+ get content(): HTMLDivElement;
2107
+ get index(): number;
2108
+ get cancelable(): boolean | null;
2109
+ get title(): string | null;
2110
+ get pages(): Guide.Page[];
2111
+ get current(): Guide.Page;
2112
+ get prev(): Guide.Page | null;
2113
+ get next(): Guide.Page | null;
2114
+ get completable(): boolean;
2115
+ complete(): void;
2116
+ cancel(): void;
2117
+ /**
2118
+ * @template [TResult1=void]
2119
+ * @template [TResult2=never]
2120
+ * @param {((value: void) => TResult1 | PromiseLike<TResult1>)?} [onfulfilled]
2121
+ * @param {((reason: any) => TResult2 | PromiseLike<TResult2>)?} [onrejected]
2122
+ * @returns {Promise<TResult1 | TResult2>};
2123
+ */
2124
+ then<TResult1 = void, TResult2 = never>(onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
2125
+ /**
2126
+ * @template [TResult2=never]
2127
+ * @param {((reason: any) => TResult2 | PromiseLike<TResult2>)?} [onrejected]
2128
+ * @returns {Promise<void | TResult2>};
2129
+ */
2130
+ catch<TResult2 = never>(onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<void | TResult2>;
2131
+ /**
2132
+ * @param {(() => void)?} [onfinally]
2133
+ * @returns {Promise<void>};
2134
+ */
2135
+ finally(onfinally?: (() => void) | null): Promise<void>;
2136
+ #private;
2137
+ }
2138
+ declare namespace Guide {
2139
+ type PageForm<T_1 = unknown> = {
2140
+ type?: "" | null | undefined;
2141
+ label: string | ((store: Store$1, state: State<T_1 | undefined>) => string);
2142
+ hidden?: ((store: Store$1, state: State<T_1 | undefined>) => boolean) | undefined;
2143
+ disabled?: ((store: Store$1, state: State<T_1 | undefined>) => boolean) | undefined;
2144
+ /**
2145
+ * 表单布局
2146
+ */
2147
+ layout?: StoreLayout$1<any> | null | undefined;
2148
+ editable?: boolean | undefined;
2149
+ enableLink?: boolean | undefined;
2150
+ layoutType?: string | undefined;
2151
+ };
2152
+ type Page = {
2153
+ label: string;
2154
+ disabled: boolean;
2155
+ hidden: boolean;
2156
+ current: boolean;
2157
+ index: number;
2158
+ switch: (force?: boolean) => void;
2159
+ };
2091
2160
  }
2092
- declare namespace PageFrame {
2093
- interface Context {
2094
- url: string;
2095
- show: boolean;
2096
- title: string;
2097
- icon: string;
2098
- loading: boolean;
2099
- }
2161
+ //#endregion
2162
+ //#region packages/web/dom/index.d.mts
2163
+ declare const isMac: boolean;
2164
+ //#endregion
2165
+ //#region packages/web/route/PageSider.d.mts
2166
+ declare class PageSider extends GeneralContext {
2167
+ /**
2168
+ *
2169
+ * @param {ParentNode} parent
2170
+ * @param {Node?} next
2171
+ * @param {boolean} inserted
2172
+ * @param {AbortSignal} signal
2173
+ * @returns
2174
+ */
2175
+ constructor(parent: ParentNode, next: Node | null, inserted: boolean, signal: AbortSignal);
2176
+ /**
2177
+ * @template T
2178
+ * @overload
2179
+ * @param {(dialog: HTMLDialogElement, signal: AbortSignal) => PromiseLike<T> | T} exec
2180
+ * @param {AbortSignal} [signal]
2181
+ * @returns {Promise<T>}
2182
+ */
2183
+ createDialog<T>(exec: (dialog: HTMLDialogElement, signal: AbortSignal) => PromiseLike<T> | T, signal?: AbortSignal | undefined): Promise<T>;
2184
+ /**
2185
+ * @overload
2186
+ * @param {AbortSignal} [signal]
2187
+ * @returns {HTMLDialogElement}
2188
+ */
2189
+ createDialog(signal?: AbortSignal | undefined): HTMLDialogElement;
2190
+ /**
2191
+ * @template T
2192
+ * @overload
2193
+ * @param {(modal: Modal) => PromiseLike<T> | T} exec
2194
+ * @param {AbortSignal} [signal]
2195
+ * @returns {Promise<T>}
2196
+ */
2197
+ createModal<T>(exec: (modal: Modal) => PromiseLike<T> | T, signal?: AbortSignal | undefined): Promise<T>;
2198
+ /**
2199
+ * @overload
2200
+ * @param {AbortSignal} [signal]
2201
+ * @returns {Modal}
2202
+ */
2203
+ createModal(signal?: AbortSignal | undefined): Modal;
2204
+ /**
2205
+ * @template T
2206
+ * @template R
2207
+ * @param {T[]} list
2208
+ * @param {(item: T, signal: AbortSignal) => PromiseLike<R> | R} exec
2209
+ * @param {object} [options]
2210
+ * @param {AbortSignal} [options.signal]
2211
+ * @param {boolean} [options.abortable]
2212
+ * @param {string} [options.label]
2213
+ * @param {string} [options.title]
2214
+ */
2215
+ createProgressModal<T, R>(list: T[], exec: (item: T, signal: AbortSignal) => PromiseLike<R> | R, options?: {
2216
+ signal?: AbortSignal | undefined;
2217
+ abortable?: boolean | undefined;
2218
+ label?: string | undefined;
2219
+ title?: string | undefined;
2220
+ }): Promise<PromiseSettledResult<R>[]>;
2221
+ get container(): HTMLDivElement;
2222
+ set unprintable(unprintable: boolean);
2223
+ get unprintable(): boolean;
2224
+ set panel(panel: boolean);
2225
+ get panel(): boolean;
2226
+ set title(t: string);
2227
+ get title(): string;
2228
+ /**
2229
+ *
2230
+ * @param {(Menu | null)[]} menus
2231
+ * @param {Menu?} button
2232
+ * @param {Menu.Renderer} [create]
2233
+ * @returns
2234
+ */
2235
+ setMenu(menus: (Menu | null)[], button: Menu | null, create?: Menu.Renderer): void;
2236
+ get inserted(): boolean;
2237
+ insert(): void;
2238
+ remove(): void;
2239
+ #private;
2100
2240
  }
2101
2241
  //#endregion
2102
2242
  //#region packages/web/route/PageContext.d.mts
@@ -2123,14 +2263,24 @@ declare class PageContext extends GeneralContext {
2123
2263
  get href(): string;
2124
2264
  get current(): boolean;
2125
2265
  get shown(): boolean;
2126
- set title(title: string);
2266
+ /** @param {string | (() => string)} title */
2267
+ set title(title: string | (() => string));
2268
+ /** @returns {string} */
2127
2269
  get title(): string;
2128
- set icon(icon: string);
2270
+ /** @param {string | (() => string)} icon */
2271
+ set icon(icon: string | (() => string));
2272
+ /** @returns {string} */
2129
2273
  get icon(): string;
2130
2274
  set print(print: Print);
2131
2275
  get print(): Print;
2132
- set unsaved(unsaved: boolean);
2276
+ /** @param {boolean | (() => boolean)} unsaved */
2277
+ set unsaved(unsaved: boolean | (() => boolean));
2278
+ /** @returns {boolean} */
2133
2279
  get unsaved(): boolean;
2280
+ /** @param {boolean | (() => boolean)} guarded */
2281
+ set guarded(guarded: boolean | (() => boolean));
2282
+ /** @returns {boolean} */
2283
+ get guarded(): boolean;
2134
2284
  set loading(loading: boolean);
2135
2285
  get loading(): boolean;
2136
2286
  get container(): HTMLElement;
@@ -2489,11 +2639,21 @@ type Filters = {
2489
2639
  *
2490
2640
  * @param {ModelScriptConfiguration} modelDefine
2491
2641
  * @param {Search.AndItem[]?} [value]
2492
- * @param {HTMLElement} [root]
2642
+ * @param {HTMLElement} [parent]
2493
2643
  * @param {AbortSignal} [signal]
2494
2644
  * @returns {Promise<Search.AndItem[]>}
2495
2645
  */
2496
- declare function showFilterDialog(modelDefine: ModelScriptConfiguration, value?: Search.AndItem[] | null, root?: HTMLElement, signal?: AbortSignal): Promise<Search.AndItem[]>;
2646
+ declare function _default$3(modelDefine: ModelScriptConfiguration, value?: Search.AndItem[] | null, parent?: HTMLElement, signal?: AbortSignal): Promise<Search.AndItem[]>;
2647
+ //#endregion
2648
+ //#region packages/web/form/showSortDialog.d.mts
2649
+ /**
2650
+ *
2651
+ * @param {Modal} modal
2652
+ * @param {ModelScriptConfiguration} modelDefine
2653
+ * @param {[field: string, desc?: boolean][]?} [value]
2654
+ * @returns {Promise<[field: string, desc?: boolean][]>}
2655
+ */
2656
+ declare function showSortDialog(modal: Modal, modelDefine: ModelScriptConfiguration, value?: [field: string, desc?: boolean][] | null): Promise<[field: string, desc?: boolean][]>;
2497
2657
  //#endregion
2498
2658
  //#region packages/web/form/createStoreField.d.mts
2499
2659
  /**
@@ -2632,6 +2792,25 @@ declare function loadMenu(type: string, group?: string | undefined, force?: bool
2632
2792
  */
2633
2793
  declare function loadMenu(type: string, group?: string | boolean | undefined, force?: boolean | undefined): Promise<Menu.Define[]>;
2634
2794
  //#endregion
2795
+ //#region packages/web/services/application.d.mts
2796
+ declare namespace Application {
2797
+ const logo: string;
2798
+ const title: string;
2799
+ const company: string;
2800
+ const help: string;
2801
+ function refresh(): void;
2802
+ const menus: any;
2803
+ /** @param {boolean?} [force] */
2804
+ function loadMenus(force?: boolean | null): Promise<any>;
2805
+ const userMenus: any;
2806
+ /** @param {boolean?} [force] */
2807
+ function loadUserMenus(force?: boolean | null): Promise<any>;
2808
+ /** @param {string} page */
2809
+ function loadPage(page: string): Promise<(() => Promise<any>) | null>;
2810
+ /** @param {string} page */
2811
+ function loadContinuation(page: string): Promise<(() => Promise<any>) | null>;
2812
+ }
2813
+ //#endregion
2635
2814
  //#region packages/web/import.d.mts
2636
2815
  /**
2637
2816
  * @template T
@@ -3087,4 +3266,4 @@ declare function updateHooks(hooks: Record<string, Hook.Define<Hooks>>): void;
3087
3266
  /** @type {Hook<Hooks>} */
3088
3267
  declare const allHooks: Hook<Hooks>;
3089
3268
  //#endregion
3090
- export { ArrayStore, Authenticator, BindObjectStore, code128_d_exports as Code128, Command, ConfiguratorComponent, ConfiguratorContext, type ContinuationDefine, CurrentPage, type DataSource, DotRequest, ErrorAlerter, FieldComponent, FieldComponentEvent, FieldComponents, FieldContext, FieldDefine, FieldFilter, FieldFilterComponent, FieldFilterContext, FieldFilterFns, FieldFilterOptions, FieldFilterStyle, type FieldScript, type FieldScriptConfiguration, FieldShowHandle, FieldStyle, FilterFns, FormFieldHook, FromRenderer, GeneralContext, type HomeContext, Hooks, IconDefine, Ident_d_exports as Ident, List, type Match, Menu, Modal, ModalFooter, ModalHeader, type ModelConfiguration, ModelIndicator, type ModelScript, type ModelScriptConfiguration, ObjectStore, Page, type PageConfiguration, type PageContext, type PageError, PageFooter, PageFrame, type PageHandle, PageHeader, PageIdent, type PageManager, type PageRenderer, PageSection, PageSectionParam, PageSider, Pagination, type Print, ResponseError, type Schema, Signal$1 as Signal, State, Store, type StoreLayout, SubmodelsLayoutEvent, Theme, User, UserHook, VerifyContext, VerifyError, type WorkspaceDefine, addManager, allHooks, application, buildDataSource, buildPlugin, createComputed, createDeeply, createDialog, createDocumentInModal, createFilters, createFrame, createIcon, createModal, createModelDefault, createProgressModal, createQuickFilters, createShowField, createState, createStore, createStoreField, createTick, effect, enumerationsService, execScript, filterPermission, flatPermission, formLayoutsService, getAllFilterFns, getAuthorizations, getField, getFieldFilter, getFieldFilterOperators, getFilterFns, getPages, getPermissionFields, getPrimaryFields, hasField, hasFieldFilter, importStyle, importWidget, isMac, isPluginId, loadMenu, modelService, neverAbortedSignal, pathRoots, _default as permissionsService, plugins, _default$1 as renderForm, renderStore, _default$2 as renderStoreForm, request, root$1 as root, selectFile, setIcon, showDocumentInModal, showFilterDialog, start, testPermission, testPermissionConstraints, testPermissions, toFileLink, toFileURL, toId, toPermissionFilter, toSchema, toUrl, updateHooks, waitAbortSignal, watch };
3269
+ export { Application, ArrayStore, Authenticator, BindObjectStore, code128_d_exports as Code128, Command, ConfiguratorComponent, ConfiguratorContext, type ContinuationDefine, CurrentPage, type DataSource, DotRequest, ErrorAlerter, FieldComponent, FieldComponentEvent, FieldComponents, FieldContext, FieldDefine, FieldFilter, FieldFilterComponent, FieldFilterContext, FieldFilterFns, FieldFilterOptions, FieldFilterStyle, type FieldScript, type FieldScriptConfiguration, FieldShowHandle, FieldStyle, FilterFns, FormFieldHook, FromRenderer, GeneralContext, GlobalPage, Guide, type HomeContext, Hooks, IconDefine, Ident_d_exports as Ident, List, type Match, Menu, Modal, ModalFooter, ModalHeader, type ModelConfiguration, ModelIndicator, type ModelScript, type ModelScriptConfiguration, ObjectStore, Page, type PageConfiguration, type PageContext, type PageError, PageFooter, PageFrame, type PageHandle, PageHeader, PageIdent, type PageManager, type PageRenderer, PageSection, PageSectionParam, PageSider, Pagination, type Print, ResponseError, type Schema, Signal$1 as Signal, State, Store, type StoreLayout, SubmodelsLayoutEvent, Theme, User, UserHook, VerifyContext, VerifyError, type WorkspaceDefine, addManager, allHooks, application, buildDataSource, buildPlugin, createComputed, createDeeply, createDialog, createDocumentInModal, createFilters, createFrame, createIcon, createModal, createModelDefault, createProgressModal, createQuickFilters, createSafeComputed, createShowField, createState, createStore, createStoreField, createTick, effect, enumerationsService, execScript, filterPermission, flatPermission, formLayoutsService, getAllFilterFns, getAuthorizations, getField, getFieldFilter, getFieldFilterOperators, getFilterFns, getPages, getPermissionFields, getPrimaryFields, hasField, hasFieldFilter, importStyle, importWidget, isMac, isPluginId, loadMenu, modelService, neverAbortedSignal, pathRoots, _default as permissionsService, plugins, _default$1 as renderForm, renderStore, _default$2 as renderStoreForm, request, root$1 as root, selectFile, setIcon, showDocumentInModal, _default$3 as showFilterDialog, showSortDialog, start, testPermission, testPermissionConstraints, testPermissions, toFileLink, toFileURL, toId, toPermissionFilter, toSchema, toUrl, updateHooks, waitAbortSignal, watch };