@whitesev/pops 3.3.5 → 4.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.
Files changed (81) hide show
  1. package/dist/index.amd.js +13118 -12932
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.amd.min.js +1 -1
  4. package/dist/index.amd.min.js.map +1 -1
  5. package/dist/index.cjs.js +761 -575
  6. package/dist/index.cjs.js.map +1 -1
  7. package/dist/index.cjs.min.js +1 -1
  8. package/dist/index.cjs.min.js.map +1 -1
  9. package/dist/index.esm.js +761 -575
  10. package/dist/index.esm.js.map +1 -1
  11. package/dist/index.esm.min.js +1 -1
  12. package/dist/index.esm.min.js.map +1 -1
  13. package/dist/index.iife.js +13119 -12933
  14. package/dist/index.iife.js.map +1 -1
  15. package/dist/index.iife.min.js +1 -1
  16. package/dist/index.iife.min.js.map +1 -1
  17. package/dist/index.system.js +13122 -12936
  18. package/dist/index.system.js.map +1 -1
  19. package/dist/index.system.min.js +1 -1
  20. package/dist/index.system.min.js.map +1 -1
  21. package/dist/index.umd.js +13121 -12935
  22. package/dist/index.umd.js.map +1 -1
  23. package/dist/index.umd.min.js +1 -1
  24. package/dist/index.umd.min.js.map +1 -1
  25. package/dist/types/src/Pops.d.ts +66 -52
  26. package/dist/types/src/PopsAnimation.d.ts +33 -0
  27. package/dist/types/src/PopsIcon.d.ts +1 -1
  28. package/dist/types/src/components/alert/index.d.ts +3 -1
  29. package/dist/types/src/components/confirm/index.d.ts +3 -1
  30. package/dist/types/src/components/drawer/index.d.ts +3 -1
  31. package/dist/types/src/components/folder/index.d.ts +3 -1
  32. package/dist/types/src/components/iframe/index.d.ts +6 -1
  33. package/dist/types/src/components/iframe/types/index.d.ts +4 -2
  34. package/dist/types/src/components/loading/index.d.ts +3 -1
  35. package/dist/types/src/components/panel/handlerComponents.d.ts +4 -1
  36. package/dist/types/src/components/panel/index.d.ts +2 -16
  37. package/dist/types/src/components/panel/types/index.d.ts +7 -2
  38. package/dist/types/src/components/prompt/index.d.ts +3 -1
  39. package/dist/types/src/components/searchSuggestion/index.d.ts +4 -1
  40. package/dist/types/src/components/tooltip/index.d.ts +5 -1
  41. package/dist/types/src/event/EventEmiter.d.ts +33 -0
  42. package/dist/types/src/handler/PopsHandler.d.ts +16 -11
  43. package/dist/types/src/handler/PopsInstHandler.d.ts +67 -0
  44. package/dist/types/src/types/EventEmitter.d.ts +18 -0
  45. package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +4 -0
  46. package/dist/types/src/types/button.d.ts +2 -1
  47. package/dist/types/src/types/event.d.ts +6 -2
  48. package/dist/types/src/types/inst.d.ts +4 -4
  49. package/dist/types/src/utils/PopsDOMUtils.d.ts +0 -16
  50. package/dist/types/src/utils/PopsInstanceUtils.d.ts +0 -88
  51. package/dist/types/src/utils/PopsUtils.d.ts +57 -0
  52. package/package.json +3 -3
  53. package/src/Pops.ts +7 -2
  54. package/src/PopsAnimation.ts +126 -0
  55. package/src/components/alert/index.ts +9 -9
  56. package/src/components/confirm/index.ts +9 -9
  57. package/src/components/drawer/index.ts +12 -9
  58. package/src/components/folder/index.ts +9 -8
  59. package/src/components/iframe/index.ts +18 -12
  60. package/src/components/iframe/types/index.ts +10 -8
  61. package/src/components/loading/index.ts +12 -6
  62. package/src/components/panel/defaultConfig.ts +1 -0
  63. package/src/components/panel/handlerComponents.ts +41 -111
  64. package/src/components/panel/index.ts +34 -28
  65. package/src/components/panel/types/index.ts +7 -2
  66. package/src/components/prompt/index.ts +9 -8
  67. package/src/components/rightClickMenu/index.ts +17 -14
  68. package/src/components/searchSuggestion/index.ts +5 -1
  69. package/src/components/tooltip/index.ts +20 -10
  70. package/src/event/EventEmiter.ts +95 -0
  71. package/src/handler/PopsElementHandler.ts +6 -4
  72. package/src/handler/PopsHandler.ts +66 -48
  73. package/src/handler/PopsInstHandler.ts +557 -0
  74. package/src/types/EventEmitter.d.ts +18 -0
  75. package/src/types/PopsDOMUtilsEventType.d.ts +4 -0
  76. package/src/types/button.d.ts +2 -1
  77. package/src/types/event.d.ts +6 -2
  78. package/src/types/inst.d.ts +4 -4
  79. package/src/utils/PopsDOMUtils.ts +1 -40
  80. package/src/utils/PopsInstanceUtils.ts +19 -627
  81. package/src/utils/PopsUtils.ts +194 -0
@@ -10,6 +10,7 @@ import type { PopsRightClickMenuConfig } from "./components/rightClickMenu/types
10
10
  import type { PopsSearchSuggestionConfig } from "./components/searchSuggestion/types/index";
11
11
  import { PopsTooltip } from "./components/tooltip";
12
12
  import type { PopsToolTipConfig } from "./components/tooltip/types/index";
13
+ import { EventEmiter } from "./event/EventEmiter";
13
14
  import { popsUtils } from "./utils/PopsUtils";
14
15
  declare class Pops {
15
16
  /** 配置 */
@@ -37,16 +38,16 @@ declare class Pops {
37
38
  };
38
39
  /** icon图标的svg代码 */
39
40
  iconSVG: {
41
+ loading: string;
42
+ close: string;
40
43
  min: string;
41
- mise: string;
42
44
  max: string;
43
- close: string;
45
+ search: string;
46
+ mise: string;
44
47
  edit: string;
45
48
  share: string;
46
49
  delete: string;
47
- search: string;
48
50
  upload: string;
49
- loading: string;
50
51
  next: string;
51
52
  prev: string;
52
53
  eleme: string;
@@ -72,14 +73,14 @@ declare class Pops {
72
73
  };
73
74
  /** 存储已创建的元素 */
74
75
  instData: {
75
- loading: import("./types/inst").PopsInstGeneralConfig[];
76
+ iframe: import("./types/inst").PopsInstGeneralConfig[];
77
+ folder: import("./types/inst").PopsInstGeneralConfig[];
76
78
  alert: import("./types/inst").PopsInstGeneralConfig[];
77
79
  confirm: import("./types/inst").PopsInstGeneralConfig[];
78
80
  prompt: import("./types/inst").PopsInstGeneralConfig[];
79
- iframe: import("./types/inst").PopsInstGeneralConfig[];
81
+ loading: import("./types/inst").PopsInstGeneralConfig[];
80
82
  tooltip: import("./types/inst").PopsInstGeneralConfig[];
81
83
  drawer: import("./types/inst").PopsInstGeneralConfig[];
82
- folder: import("./types/inst").PopsInstGeneralConfig[];
83
84
  panel: import("./types/inst").PopsInstGeneralConfig[];
84
85
  rightClickMenu: import("./types/inst").PopsInstGeneralConfig[];
85
86
  };
@@ -89,6 +90,7 @@ declare class Pops {
89
90
  };
90
91
  /** pops使用的工具类 */
91
92
  Utils: {
93
+ sleep(timeout: number): Promise<unknown>;
92
94
  isWin(target: any): boolean;
93
95
  isDOM(target: any): boolean;
94
96
  isNodeList($ele: any): $ele is any[] | NodeList;
@@ -108,6 +110,22 @@ declare class Pops {
108
110
  setInterval(callback: (...args: any[]) => any, timeout?: number): number;
109
111
  clearInterval(timeId: number | undefined): void;
110
112
  setArray<T>(target: T, key: keyof T, newArr: any[]): void;
113
+ getMaxZIndexNodeInfoFromPoint($el?: IFunction<HTMLElement | HTMLElement[]>, deviation?: number): {
114
+ zIndex: number;
115
+ originZIndex: number;
116
+ node: HTMLElement | null;
117
+ positionNode: HTMLElement;
118
+ positionX: number;
119
+ positionY: number;
120
+ }[];
121
+ getMaxZIndexNodeInfoFromPoint(deviation: IFunction<number>): {
122
+ zIndex: number;
123
+ originZIndex: number;
124
+ node: HTMLElement | null;
125
+ positionNode: HTMLElement;
126
+ positionX: number;
127
+ positionY: number;
128
+ }[];
111
129
  };
112
130
  /** pops使用的DOM工具类 */
113
131
  DOMUtils: {
@@ -179,7 +197,6 @@ declare class Pops {
179
197
  onHover(element: import("./types/PopsDOMUtilsEventType").PopsDOMUtilsTargetElementType | Element | DocumentFragment | Node, handler: (this: HTMLElement, event: import("./types/PopsDOMUtilsEventType").PopsDOMUtils_Event["hover"]) => void, option?: boolean | import("./types/PopsDOMUtilsEventType").PopsDOMUtilsEventListenerOption): import("./types/PopsDOMUtilsEventType").PopsDOMUtilsAddEventListenerResult | undefined;
180
198
  onKeyup(target: HTMLElement | string | Window | typeof globalThis, handler: (event: import("./types/PopsDOMUtilsEventType").PopsDOMUtils_Event["keyup"]) => void, option?: boolean | AddEventListenerOptions): import("./types/PopsDOMUtilsEventType").PopsDOMUtilsAddEventListenerResult | undefined;
181
199
  onKeydown(target: HTMLElement | Window | typeof globalThis | string, handler: (event: import("./types/PopsDOMUtilsEventType").PopsDOMUtils_Event["keydown"]) => void, option?: boolean | AddEventListenerOptions): import("./types/PopsDOMUtilsEventType").PopsDOMUtilsAddEventListenerResult | undefined;
182
- onKeypress(target: HTMLElement | Window | typeof globalThis | string, handler: (event: import("./types/PopsDOMUtilsEventType").PopsDOMUtils_Event["keypress"]) => void, option?: boolean | AddEventListenerOptions): import("./types/PopsDOMUtilsEventType").PopsDOMUtilsAddEventListenerResult | undefined;
183
200
  preventEvent(event: Event): false;
184
201
  preventEvent<T extends boolean>(event: Event, onlyStopPropagation: T): T extends true ? void : false;
185
202
  preventEvent($el: HTMLElement, eventNameList: string | string[], option?: {
@@ -204,30 +221,11 @@ declare class Pops {
204
221
  };
205
222
  /** pops创建的实例使用的工具类 */
206
223
  InstanceUtils: {
207
- getMaxZIndexNodeInfo(deviation?: number, target?: Element | ShadowRoot | Document, ignoreCallBack?: ($ele: Element | HTMLElement | ShadowRoot) => boolean | void): {
208
- node: Element;
209
- zIndex: number;
210
- };
211
224
  getPopsMaxZIndex(deviation?: number): {
212
225
  zIndex: number;
213
226
  animElement: HTMLDivElement | null;
214
227
  isOverMaxZIndex: boolean;
215
228
  };
216
- getMaxZIndex(deviation?: number): number;
217
- removeInstance(totalInstConfigList: import("./types/inst").PopsInstGeneralConfig[][], guid?: string, isAll?: boolean): Promise<import("./types/inst").PopsInstGeneralConfig[][]>;
218
- hide(config: PopsAlertConfig | PopsDrawerConfig | PopsPromptConfig | PopsConfirmConfig | PopsIframeConfig | PopsLoadingConfig | PopsPanelConfig | PopsFolderConfig, popsType: import("./types/main").PopsInstStoreType, instConfigList: import("./types/inst").PopsInstGeneralConfig[], guid: string, $anim: HTMLElement, $mask?: HTMLElement): Promise<void>;
219
- show(config: PopsAlertConfig | PopsDrawerConfig | PopsPromptConfig | PopsConfirmConfig | PopsIframeConfig | PopsLoadingConfig | PopsPanelConfig | PopsFolderConfig, popsType: import("./types/main").PopsInstStoreType, instConfigList: import("./types/inst").PopsInstGeneralConfig[], guid: string, $anim: HTMLElement, $mask?: HTMLElement): Promise<void>;
220
- close(config: PopsAlertConfig | PopsDrawerConfig | PopsPromptConfig | PopsConfirmConfig | PopsIframeConfig | PopsLoadingConfig | PopsPanelConfig | PopsFolderConfig, popsType: string, instConfigList: import("./types/inst").PopsInstGeneralConfig[], guid: string, $anim: HTMLElement): Promise<void>;
221
- drag($move: HTMLElement, options: {
222
- dragElement: HTMLElement;
223
- limit: boolean;
224
- emitClick?: boolean;
225
- extraDistance: number;
226
- container?: Window | typeof globalThis | HTMLElement;
227
- moveCallBack?: (moveElement: HTMLElement, left: number, top: number) => void;
228
- endCallBack?: (moveElement: HTMLElement, left: number, top: number) => void;
229
- preventEvent?: (event: TouchEvent | PointerEvent) => boolean;
230
- }): void;
231
229
  sortElementListByProperty<T, R>(getBeforeValueFun: (value: T) => R, getAfterValueFun: (value: T) => R, sortByDesc?: boolean): (after_obj: T, before_obj: T) => 1 | 0 | -1;
232
230
  };
233
231
  /** pops处理float类型使用的工具类 */
@@ -258,6 +256,7 @@ declare class Pops {
258
256
  nodeStoreConfigKey: string;
259
257
  };
260
258
  $config: Required<PopsPanelConfig>;
259
+ emitter: EventEmiter<import("./components/panel/types").PopsPanelEventType>;
261
260
  init(data: {
262
261
  config: Required<PopsPanelConfig>;
263
262
  $el: {
@@ -271,6 +270,7 @@ declare class Pops {
271
270
  $panelBottomLeftContainer: HTMLElement;
272
271
  $panelBottomRightContainer: HTMLElement;
273
272
  };
273
+ emitter: EventEmiter<import("./components/panel/types").PopsPanelEventType>;
274
274
  }): void;
275
275
  clearContainer(): void;
276
276
  clearDeepMenuContainer(): void;
@@ -687,6 +687,28 @@ declare class Pops {
687
687
  uListContainerAddItem(viewConfig: import("./components/panel/types").PopsPanelViewConfig, containerOptions: Omit<import("./components/panel/types/components-common").PopsPanelRightAsideContainerConfig, "target">): void;
688
688
  onAsideItemClick($asideItem: HTMLElement, asideConfig: import("./components/panel/types").PopsPanelContentConfig): void;
689
689
  };
690
+ /** pops.panel中的动画 */
691
+ PopsAnimation: {
692
+ $data: {
693
+ [key: string]: CSSKeyframesRule;
694
+ };
695
+ $flag: {
696
+ isInit: boolean;
697
+ };
698
+ init(): void;
699
+ hasAnim(name: string): boolean;
700
+ createSwitchElementWithAnimation($el: HTMLElement, $next: HTMLElement, option: {
701
+ useAnimation?: boolean;
702
+ animOptions?: KeyframeAnimationOptions;
703
+ enterToAddElementCallback: () => IPromise<void>;
704
+ exitToRemoveElementCallback?: () => IPromise<void>;
705
+ }): {
706
+ enter(): Promise<void>;
707
+ exit(): Promise<void>;
708
+ };
709
+ };
710
+ /** 事件类 */
711
+ EventEmiter: typeof EventEmiter;
690
712
  };
691
713
  init(): void;
692
714
  /**
@@ -739,27 +761,31 @@ declare class Pops {
739
761
  * 普通信息框
740
762
  * @param config 配置
741
763
  */
742
- alert: (config: PopsAlertConfig) => Omit<import("./types/event").PopsEventConfig, "function" | "type">;
764
+ alert: (config: PopsAlertConfig) => Omit<import("./types/event").PopsEventConfig<EventEmiter<import("./types/EventEmitter").EventMap>>, "function" | "type">;
743
765
  /**
744
766
  * 询问框
745
767
  * @param config 配置
746
768
  */
747
- confirm: (config: PopsConfirmConfig) => Omit<import("./types/event").PopsEventConfig, "function" | "type">;
769
+ confirm: (config: PopsConfirmConfig) => Omit<import("./types/event").PopsEventConfig<EventEmiter<import("./types/EventEmitter").EventMap>>, "function" | "type">;
748
770
  /**
749
771
  * 输入框
750
772
  * @param config 配置
751
773
  */
752
- prompt: (config: PopsPromptConfig) => Omit<import("./types/event").PopsEventConfig, "function" | "type">;
774
+ prompt: (config: PopsPromptConfig) => Omit<import("./types/event").PopsEventConfig<EventEmiter<import("./types/EventEmitter").EventMap>>, "function" | "type">;
753
775
  /**
754
776
  * 加载层
755
777
  * @param config 配置
756
778
  */
757
- loading: (config: PopsLoadingConfig) => Omit<Omit<import("./types/event").PopsEventConfig, "$shadowContainer" | "$shadowRoot">, "function" | "type">;
779
+ loading: (config: PopsLoadingConfig) => Omit<Omit<import("./types/event").PopsEventConfig<EventEmiter<import("./types/EventEmitter").EventMap>>, "$shadowContainer" | "$shadowRoot">, "function" | "type">;
758
780
  /**
759
781
  * iframe层
760
782
  * @param config 配置
761
783
  */
762
- iframe: (config: PopsIframeConfig) => Omit<import("./components/iframe/types").PopsIframeClickEventConfig, "function" | "type">;
784
+ iframe: (config: PopsIframeConfig) => Omit<import("./components/iframe/types").PopsIframeClickEventConfig<EventEmiter<{
785
+ "pops:iframe-min": (eventConfig: import("./components/iframe/types").PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
786
+ "pops:iframe-mise": (eventConfig: import("./components/iframe/types").PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
787
+ "pops:iframe-max": (eventConfig: import("./components/iframe/types").PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
788
+ }>>, "function" | "type">;
763
789
  /**
764
790
  * 提示框
765
791
  * @param config 配置
@@ -789,47 +815,34 @@ declare class Pops {
789
815
  showArrow: boolean;
790
816
  arrowDistance: number;
791
817
  otherDistance: number;
792
- zIndex: IFunction<number>;
793
- style: string | null;
794
818
  useShadowRoot: boolean;
795
819
  only: boolean;
820
+ zIndex: IFunction<number>;
821
+ style: string | null;
796
822
  lightStyle: string | null;
797
823
  darkStyle: string | null;
798
824
  beforeAppendToPageCallBack: ($shadowRoot: ShadowRoot | HTMLElement, $shadowContainer: HTMLDivElement) => void;
799
825
  };
800
826
  $shadowContainer: HTMLDivElement;
801
- $shadowRoot: ShadowRoot | HTMLElement;
827
+ $shadowRoot: HTMLElement | ShadowRoot;
802
828
  toolTip: import("./components/tooltip").ToolTip;
829
+ emitter: EventEmiter<import("./types/EventEmitter").EventMap>;
803
830
  };
804
831
  /**
805
832
  * 抽屉
806
833
  * @param config 配置
807
834
  */
808
- drawer: (config: PopsDrawerConfig) => Omit<import("./types/event").PopsEventConfig, "function" | "type">;
835
+ drawer: (config: PopsDrawerConfig) => Omit<import("./types/event").PopsEventConfig<EventEmiter<import("./types/EventEmitter").EventMap>>, "function" | "type">;
809
836
  /**
810
837
  * 文件夹
811
838
  * @param config 配置
812
839
  */
813
- folder: (config: PopsFolderConfig) => Omit<import("./types/event").PopsEventConfig, "function" | "type">;
840
+ folder: (config: PopsFolderConfig) => Omit<import("./types/event").PopsEventConfig<EventEmiter<import("./types/EventEmitter").EventMap>>, "function" | "type">;
814
841
  /**
815
842
  * 配置面板
816
843
  * @param config 配置
817
844
  */
818
- panel: (config: PopsPanelConfig) => {
819
- addEventListener: <K extends keyof import("./components/panel/types").PopsPanelEventType>(event: K, listener: (evt: CustomEvent<import("./components/panel/types").PopsPanelEventType[K]>) => void, options?: boolean | EventListenerOptions) => void;
820
- removeEventListener: <K extends keyof import("./components/panel/types").PopsPanelEventType>(event: K, listener: (evt: CustomEvent<import("./components/panel/types").PopsPanelEventType[K]>) => void, options?: boolean | EventListenerOptions) => void;
821
- close: () => Promise<void>;
822
- hide: () => Promise<void>;
823
- mode: import("./types/main").PopsType;
824
- show: ($parent?: HTMLElement | Document | ShadowRoot) => Promise<void>;
825
- $shadowContainer: HTMLDivElement;
826
- $shadowRoot: ShadowRoot | HTMLElement;
827
- $el: HTMLDivElement;
828
- $anim: HTMLDivElement;
829
- $pops: HTMLDivElement;
830
- $mask?: HTMLDivElement | undefined;
831
- guid: string;
832
- };
845
+ panel: (config: PopsPanelConfig) => Omit<import("./types/event").PopsEventConfig<EventEmiter<import("./components/panel/types").PopsPanelEventType>>, "function" | "type">;
833
846
  /**
834
847
  * 右键菜单
835
848
  * @param config 配置
@@ -908,6 +921,7 @@ declare class Pops {
908
921
  * searchSuggestion.setAllEvent();
909
922
  */
910
923
  searchSuggestion: <T = any>(config: PopsSearchSuggestionConfig<T>) => {
924
+ emitter: EventEmiter<import("./types/EventEmitter").EventMap>;
911
925
  selfDocument: ShadowRoot | Document | (ShadowRoot | Document)[];
912
926
  $el: {
913
927
  root: HTMLElement;
@@ -11,4 +11,37 @@ export declare const PopsAnimation: {
11
11
  * 判断是否存在某个动画名
12
12
  */
13
13
  hasAnim(name: string): boolean;
14
+ /**
15
+ * 带动画的进入元素
16
+ * @param $el 当前元素
17
+ * @param $next 切换的元素
18
+ * @param option 配置
19
+ */
20
+ createSwitchElementWithAnimation($el: HTMLElement, $next: HTMLElement, option: {
21
+ /**
22
+ * 是否使用动画
23
+ * @default true
24
+ */
25
+ useAnimation?: boolean;
26
+ /**
27
+ * 动画配置
28
+ *
29
+ * + `duration`: 默认`220`
30
+ * + `easing`: 默认`"ease-in-out"`
31
+ */
32
+ animOptions?: KeyframeAnimationOptions;
33
+ /** 为$next内部添加元素 */
34
+ enterToAddElementCallback: () => IPromise<void>;
35
+ /** 退出时移除$next元素 */
36
+ exitToRemoveElementCallback?: () => IPromise<void>;
37
+ }): {
38
+ /**
39
+ * 进入
40
+ */
41
+ enter(): Promise<void>;
42
+ /**
43
+ * 退出
44
+ */
45
+ exit(): Promise<void>;
46
+ };
14
47
  };
@@ -1,11 +1,11 @@
1
1
  export declare const PopsIcon: {
2
2
  $data: {
3
3
  loading: string;
4
+ close: string;
4
5
  min: string;
5
6
  max: string;
6
7
  search: string;
7
8
  mise: string;
8
- close: string;
9
9
  edit: string;
10
10
  share: string;
11
11
  delete: string;
@@ -1,4 +1,6 @@
1
+ import { EventEmiter } from "../../event/EventEmiter";
2
+ import type { EventMap } from "../../types/EventEmitter";
1
3
  import type { PopsAlertConfig } from "./types";
2
4
  export declare const PopsAlert: {
3
- init(__config__: PopsAlertConfig): Omit<import("../../types/event").PopsEventConfig, "function" | "type">;
5
+ init(__config__: PopsAlertConfig): Omit<import("../../types/event").PopsEventConfig<EventEmiter<EventMap>>, "function" | "type">;
4
6
  };
@@ -1,4 +1,6 @@
1
+ import { EventEmiter } from "../../event/EventEmiter";
2
+ import type { EventMap } from "../../types/EventEmitter";
1
3
  import type { PopsConfirmConfig } from "./types";
2
4
  export declare const PopsConfirm: {
3
- init(__config__: PopsConfirmConfig): Omit<import("../../types/event").PopsEventConfig, "function" | "type">;
5
+ init(__config__: PopsConfirmConfig): Omit<import("../../types/event").PopsEventConfig<EventEmiter<EventMap>>, "function" | "type">;
4
6
  };
@@ -1,4 +1,6 @@
1
+ import { EventEmiter } from "../../event/EventEmiter";
2
+ import type { EventMap } from "../../types/EventEmitter";
1
3
  import type { PopsDrawerConfig } from "./types";
2
4
  export declare const PopsDrawer: {
3
- init(__config__: PopsDrawerConfig): Omit<import("../../types/event").PopsEventConfig, "function" | "type">;
5
+ init(__config__: PopsDrawerConfig): Omit<import("../../types/event").PopsEventConfig<EventEmiter<EventMap>>, "function" | "type">;
4
6
  };
@@ -1,4 +1,6 @@
1
+ import { EventEmiter } from "../../event/EventEmiter";
2
+ import type { EventMap } from "../../types/EventEmitter";
1
3
  import type { PopsFolderConfig } from "./types";
2
4
  export declare const PopsFolder: {
3
- init(__config__: PopsFolderConfig): Omit<import("../../types/event").PopsEventConfig, "function" | "type">;
5
+ init(__config__: PopsFolderConfig): Omit<import("../../types/event").PopsEventConfig<EventEmiter<EventMap>>, "function" | "type">;
4
6
  };
@@ -1,4 +1,9 @@
1
+ import { EventEmiter } from "../../event/EventEmiter";
1
2
  import type { PopsIframeClickEventConfig, PopsIframeConfig } from "./types";
2
3
  export declare const PopsIframe: {
3
- init(__config__: PopsIframeConfig): Omit<PopsIframeClickEventConfig, "function" | "type">;
4
+ init(__config__: PopsIframeConfig): Omit<PopsIframeClickEventConfig<EventEmiter<{
5
+ "pops:iframe-min": (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
6
+ "pops:iframe-mise": (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
7
+ "pops:iframe-max": (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
8
+ }>>, "function" | "type">;
4
9
  };
@@ -1,9 +1,11 @@
1
- import type { PopsTitleConfig, PopsDragConfig, PopsGeneralConfig } from "../../../types/components";
1
+ import type { EventEmiter } from "../../../event/EventEmiter";
2
+ import type { PopsDragConfig, PopsGeneralConfig, PopsTitleConfig } from "../../../types/components";
2
3
  import type { PopsEventConfig } from "../../../types/event";
4
+ import type { CustomEventMap } from "../../../types/EventEmitter";
3
5
  /**
4
6
  * pops.iframe的按钮点击事件回调的配置参数
5
7
  */
6
- export type PopsIframeClickEventConfig = PopsEventConfig & {
8
+ export type PopsIframeClickEventConfig<E extends EventEmiter<CustomEventMap> = EventEmiter<CustomEventMap>> = PopsEventConfig<E> & {
7
9
  /**
8
10
  * iframe元素
9
11
  */
@@ -1,4 +1,6 @@
1
+ import { EventEmiter } from "../../event/EventEmiter";
2
+ import type { EventMap } from "../../types/EventEmitter";
1
3
  import type { PopsLoadingConfig } from "./types";
2
4
  export declare const PopsLoading: {
3
- init(__config__: PopsLoadingConfig): Omit<Omit<import("../../types/event").PopsEventConfig, "$shadowContainer" | "$shadowRoot">, "function" | "type">;
5
+ init(__config__: PopsLoadingConfig): Omit<Omit<import("../../types/event").PopsEventConfig<EventEmiter<EventMap>>, "$shadowContainer" | "$shadowRoot">, "function" | "type">;
4
6
  };
@@ -1,6 +1,7 @@
1
+ import type { EventEmiter } from "../../event/EventEmiter";
1
2
  import { popsUtils } from "../../utils/PopsUtils";
2
3
  import { PopsTooltip } from "../tooltip";
3
- import type { PopsPanelBottomContentConfig, PopsPanelConfig, PopsPanelContentConfig, PopsPanelViewConfig } from "./types";
4
+ import type { PopsPanelBottomContentConfig, PopsPanelConfig, PopsPanelContentConfig, PopsPanelEventType, PopsPanelViewConfig } from "./types";
4
5
  import type { PopsPanelButtonConfig } from "./types/components-button";
5
6
  import type { PopsPanelGeneralConfig, PopsPanelRightAsideContainerConfig } from "./types/components-common";
6
7
  import type { PopsPanelContainerConfig } from "./types/components-container";
@@ -55,6 +56,7 @@ export declare const PanelHandlerComponents: () => {
55
56
  nodeStoreConfigKey: string;
56
57
  };
57
58
  $config: Required<PopsPanelConfig>;
59
+ emitter: EventEmiter<PopsPanelEventType>;
58
60
  /**
59
61
  * 初始化
60
62
  * @param data
@@ -72,6 +74,7 @@ export declare const PanelHandlerComponents: () => {
72
74
  $panelBottomLeftContainer: HTMLElement;
73
75
  $panelBottomRightContainer: HTMLElement;
74
76
  };
77
+ emitter: EventEmiter<PopsPanelEventType>;
75
78
  }): void;
76
79
  /**
77
80
  * 清空container容器的元素
@@ -1,19 +1,5 @@
1
+ import { EventEmiter } from "../../event/EventEmiter";
1
2
  import type { PopsPanelConfig, PopsPanelEventType } from "./types";
2
- import type { PopsType } from "../../types/main";
3
3
  export declare const PopsPanel: {
4
- init(__config__: PopsPanelConfig): {
5
- addEventListener: <K extends keyof PopsPanelEventType>(event: K, listener: (evt: CustomEvent<PopsPanelEventType[K]>) => void, options?: boolean | EventListenerOptions) => void;
6
- removeEventListener: <K extends keyof PopsPanelEventType>(event: K, listener: (evt: CustomEvent<PopsPanelEventType[K]>) => void, options?: boolean | EventListenerOptions) => void;
7
- mode: PopsType;
8
- close: () => Promise<void>;
9
- hide: () => Promise<void>;
10
- show: ($parent?: HTMLElement | Document | ShadowRoot) => Promise<void>;
11
- $shadowContainer: HTMLDivElement;
12
- $shadowRoot: ShadowRoot | HTMLElement;
13
- $el: HTMLDivElement;
14
- $anim: HTMLDivElement;
15
- $pops: HTMLDivElement;
16
- $mask?: HTMLDivElement | undefined;
17
- guid: string;
18
- };
4
+ init(__config__: PopsPanelConfig): Omit<import("../../types/event").PopsEventConfig<EventEmiter<PopsPanelEventType>>, "function" | "type">;
19
5
  };
@@ -26,12 +26,12 @@ export type PopsPanelEventType = {
26
26
  /**
27
27
  * 该事件在右侧容器内的元素改变时触发
28
28
  */
29
- "pops:renderRightContainer": {
29
+ "pops:renderRightContainer": (data: {
30
30
  /**
31
31
  * 视图配置
32
32
  */
33
33
  viewConfig: PopsPanelContentConfig[] | PopsPanelDeepViewConfig;
34
- };
34
+ }) => void;
35
35
  };
36
36
  /**
37
37
  * pops.panel的content配置信息
@@ -217,4 +217,9 @@ export interface PopsPanelConfig extends PopsTitleConfig, PopsDragConfig, PopsGe
217
217
  * @default true
218
218
  */
219
219
  useDeepMenuSwtichAnimation?: true;
220
+ /**
221
+ * 监听按键按下Esc来退出内部菜单
222
+ * @default true
223
+ */
224
+ listenEscapeKeyUpToExitDeepMenu?: boolean;
220
225
  }
@@ -1,4 +1,6 @@
1
+ import { EventEmiter } from "../../event/EventEmiter";
2
+ import type { EventMap } from "../../types/EventEmitter";
1
3
  import type { PopsPromptConfig } from "./types/index";
2
4
  export declare const PopsPrompt: {
3
- init(__config__: PopsPromptConfig): Omit<import("../../types/event").PopsEventConfig, "function" | "type">;
5
+ init(__config__: PopsPromptConfig): Omit<import("../../types/event").PopsEventConfig<EventEmiter<EventMap>>, "function" | "type">;
4
6
  };
@@ -1,10 +1,13 @@
1
+ import { EventEmiter } from "../../event/EventEmiter";
2
+ import type { EventMap } from "../../types/EventEmitter";
1
3
  import type { PopsSearchSuggestionConfig, PopsSearchSuggestionData } from "./types/index";
2
4
  export declare const PopsSearchSuggestion: {
3
5
  init<T>(__config__: PopsSearchSuggestionConfig<T>): {
6
+ emitter: EventEmiter<EventMap>;
4
7
  /**
5
8
  * 当前的环境,可以是document,可以是shadowroot,默认是document
6
9
  */
7
- selfDocument: Document | ShadowRoot | (Document | ShadowRoot)[];
10
+ selfDocument: ShadowRoot | Document | (ShadowRoot | Document)[];
8
11
  $el: {
9
12
  /** 根元素 */
10
13
  root: HTMLElement;
@@ -1,3 +1,5 @@
1
+ import { EventEmiter } from "../../event/EventEmiter";
2
+ import type { EventMap } from "../../types/EventEmitter";
1
3
  import type { PopsToolTipConfig } from "./types/index";
2
4
  type ToolTipEventTypeName = "MouseEvent" | "TouchEvent";
3
5
  export declare class ToolTip {
@@ -8,6 +10,7 @@ export declare class ToolTip {
8
10
  $content: HTMLElement;
9
11
  $arrow: HTMLElement;
10
12
  };
13
+ emitter: EventEmiter<EventMap>;
11
14
  $data: {
12
15
  config: Required<PopsToolTipConfig>;
13
16
  guid: string;
@@ -17,7 +20,7 @@ export declare class ToolTip {
17
20
  constructor(config: Required<PopsToolTipConfig>, guid: string, ShadowInfo: {
18
21
  $shadowContainer: HTMLDivElement;
19
22
  $shadowRoot: ShadowRoot | HTMLElement;
20
- });
23
+ }, emitter: EventEmiter<EventMap>);
21
24
  init(): void;
22
25
  /**
23
26
  * 创建提示元素
@@ -215,6 +218,7 @@ export declare const PopsTooltip: {
215
218
  $shadowContainer: HTMLDivElement;
216
219
  $shadowRoot: HTMLElement | ShadowRoot;
217
220
  toolTip: ToolTip;
221
+ emitter: EventEmiter<EventMap>;
218
222
  };
219
223
  };
220
224
  export {};
@@ -0,0 +1,33 @@
1
+ import type { EventMap, CustomEventMap } from "../types/EventEmitter";
2
+ import type { PopsType } from "../types/main";
3
+ declare class EventEmiter<T extends CustomEventMap = CustomEventMap> {
4
+ #private;
5
+ constructor(type: PopsType);
6
+ on<P extends keyof EventMap>(eventName: P, callback: EventMap[P]): {
7
+ off: () => IPromise<void>;
8
+ emit: (...args: Parameters<T[P]>) => IPromise<void>;
9
+ };
10
+ on<P extends keyof T>(eventName: P, callback: T[P]): {
11
+ off: () => IPromise<void>;
12
+ emit: (...args: Parameters<T[P]>) => IPromise<void>;
13
+ };
14
+ off<P extends keyof EventMap>(eventName: P, callback: EventMap[P]): IPromise<void>;
15
+ off<P extends keyof T>(eventName: P, callback: T[P]): IPromise<void>;
16
+ emit<P extends keyof T>(eventName: P, ...args: Parameters<T[P]>): IPromise<void>;
17
+ emit<P extends keyof EventMap>(eventName: P, ...args: Parameters<EventMap[P]>): IPromise<void>;
18
+ offAll<P extends keyof EventMap>(eventName?: P): IPromise<void>;
19
+ offAll<P extends keyof T>(eventName?: P): IPromise<void>;
20
+ /**
21
+ * 获取所有添加的事件
22
+ */
23
+ getAllEvents(eventName?: string): {
24
+ type: PopsType;
25
+ time: number;
26
+ callback: (...args: any[]) => IPromise<void>;
27
+ }[] | {
28
+ type: PopsType;
29
+ time: number;
30
+ callback: (...args: any[]) => IPromise<void>;
31
+ }[][] | undefined;
32
+ }
33
+ export { EventEmiter };
@@ -6,10 +6,12 @@ import type { PopsIframeConfig } from "../components/iframe/types";
6
6
  import type { PopsLoadingConfig } from "../components/loading/types";
7
7
  import type { PopsPanelConfig } from "../components/panel/types";
8
8
  import type { PopsPromptConfig } from "../components/prompt/types/index";
9
+ import type { EventEmiter } from "../event/EventEmiter";
9
10
  import type { PopsGeneralConfig } from "../types/components";
10
11
  import type { PopsEventConfig, PopsHandlerEventConfig } from "../types/event";
12
+ import type { CustomEventMap } from "../types/EventEmitter";
11
13
  import type { PopsInstGeneralConfig } from "../types/inst";
12
- import type { PopsInstStoreType, PopsType, PopsSupportAnimConfigType, PopsSupportOnlyConfig } from "../types/main";
14
+ import type { PopsInstStoreType, PopsSupportAnimConfigType, PopsSupportOnlyConfig, PopsType } from "../types/main";
13
15
  export declare const PopsHandler: {
14
16
  /**
15
17
  * 创建shadow
@@ -180,7 +182,7 @@ export declare const PopsHandler: {
180
182
  * @param $mask 遮罩层
181
183
  * @param config 当前配置
182
184
  */
183
- handleEventConfig(config: PopsAlertConfig | PopsDrawerConfig | PopsPromptConfig | PopsConfirmConfig | PopsIframeConfig | PopsLoadingConfig | PopsPanelConfig | PopsFolderConfig, guid: string, $shadowContainer: HTMLDivElement, $shadowRoot: ShadowRoot | HTMLElement, type: PopsInstStoreType, $anim: HTMLDivElement, $pops: HTMLDivElement, $mask?: HTMLDivElement): PopsEventConfig;
185
+ handleEventConfig<E extends EventEmiter<CustomEventMap> = EventEmiter<CustomEventMap>>(config: PopsAlertConfig | PopsDrawerConfig | PopsPromptConfig | PopsConfirmConfig | PopsIframeConfig | PopsLoadingConfig | PopsPanelConfig | PopsFolderConfig, guid: string, $shadowContainer: HTMLDivElement, $shadowRoot: ShadowRoot | HTMLElement, type: PopsInstStoreType, $anim: HTMLDivElement, $pops: HTMLDivElement, emitter: E, $mask?: HTMLDivElement): PopsEventConfig<E>;
184
186
  /**
185
187
  * 获取loading的事件配置
186
188
  * @param guid
@@ -190,7 +192,7 @@ export declare const PopsHandler: {
190
192
  * @param $mask 遮罩层
191
193
  * @param config 当前配置
192
194
  */
193
- handleLoadingEventConfig(config: PopsAlertConfig | PopsDrawerConfig | PopsPromptConfig | PopsConfirmConfig | PopsIframeConfig | PopsLoadingConfig | PopsPanelConfig | PopsFolderConfig, guid: string, type: "loading", $anim: HTMLDivElement, $pops: HTMLDivElement, $mask?: HTMLDivElement): Omit<PopsEventConfig, "$shadowContainer" | "$shadowRoot">;
195
+ handleLoadingEventConfig<E extends EventEmiter<CustomEventMap> = EventEmiter<CustomEventMap>>(config: PopsAlertConfig | PopsDrawerConfig | PopsPromptConfig | PopsConfirmConfig | PopsIframeConfig | PopsLoadingConfig | PopsPanelConfig | PopsFolderConfig, guid: string, type: "loading", $anim: HTMLDivElement, $pops: HTMLDivElement, emitter: E, $mask?: HTMLDivElement): Omit<PopsEventConfig<E>, "$shadowContainer" | "$shadowRoot">;
194
196
  /**
195
197
  * 处理返回的配置,针对popsHandler.handleEventConfig
196
198
  * @param config 配置
@@ -203,16 +205,14 @@ export declare const PopsHandler: {
203
205
  * @param eventConfig 事件配置,由popsHandler.handleEventConfig创建的
204
206
  * @param callback 点击回调
205
207
  */
206
- handleClickEvent(type: PopsHandlerEventConfig["type"], $btn: HTMLElement, eventConfig: PopsEventConfig, callback?: (details: PopsHandlerEventConfig, event: PointerEvent | MouseEvent) => void): void;
208
+ handleClickEvent<E extends EventEmiter<CustomEventMap> = EventEmiter<CustomEventMap>>(type: PopsHandlerEventConfig<E>["type"], $btn: HTMLElement, eventConfig: PopsEventConfig<E>, callback?: (details: PopsHandlerEventConfig<E>, event: PointerEvent | MouseEvent) => void): import("../types/PopsDOMUtilsEventType").PopsDOMUtilsAddEventListenerResult | undefined;
207
209
  /**
208
210
  * 全局监听键盘事件
209
211
  * @param keyName 键名|键值
210
212
  * @param otherKeyList 组合按键,数组类型,包含ctrl、shift、alt和meta(win键或mac的cmd键)
211
213
  * @param callback 回调函数
212
214
  */
213
- handleKeyboardEvent(keyName: string | number, otherKeyList: string[] | undefined, callback: (event: KeyboardEvent) => void): {
214
- removeKeyboardEvent(): void;
215
- };
215
+ handleKeyboardEvent(keyName: string | number, otherKeyList: string[] | undefined, callback: (event: KeyboardEvent) => void): import("../types/PopsDOMUtilsEventType").PopsDOMUtilsAddEventListenerResult;
216
216
  /**
217
217
  * 处理prompt的点击事件
218
218
  * @param type 触发事件类型
@@ -221,21 +221,26 @@ export declare const PopsHandler: {
221
221
  * @param eventConfig 事件配置,由popsHandler.handleEventConfig创建的
222
222
  * @param callback 点击回调
223
223
  */
224
- handlePromptClickEvent(type: PopsHandlerEventConfig["type"], inputElement: HTMLInputElement | HTMLTextAreaElement, $btn: HTMLElement, eventConfig: PopsEventConfig, callback: (details: PopsEventConfig & {
224
+ handlePromptClickEvent<E extends EventEmiter<CustomEventMap> = EventEmiter<CustomEventMap>>(type: PopsHandlerEventConfig<E>["type"], inputElement: HTMLInputElement | HTMLTextAreaElement, $btn: HTMLElement, eventConfig: PopsEventConfig<E>, callback: (details: PopsEventConfig<E> & {
225
225
  type: any;
226
226
  text: string;
227
227
  }, event: MouseEvent | PointerEvent) => void): void;
228
228
  /**
229
- * 把配置的z-index配置转为数字
230
- * @param zIndex
229
+ * 获取数值
230
+ * @param target
231
231
  */
232
- handleZIndex(zIndex: number | (() => number)): number;
232
+ getTargerOrFunctionValue<T>(target: T | (() => T)): T;
233
233
  /**
234
234
  * 处理config.only
235
235
  * @param type 当前弹窗类型
236
236
  * @param config 配置
237
237
  */
238
238
  handleOnly<T extends Required<PopsSupportOnlyConfig[keyof PopsSupportOnlyConfig]>>(type: PopsType, config: T): T;
239
+ /**
240
+ * 处理z-index
241
+ * @param config 配置
242
+ */
243
+ handleZIndex<T extends Required<PopsSupportOnlyConfig[keyof PopsSupportOnlyConfig]>>(config: T): T;
239
244
  /**
240
245
  * 处理把已创建的元素保存到内部环境中
241
246
  * @param type 当前弹窗类型