@whitesev/pops 3.3.4 → 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 (93) hide show
  1. package/dist/index.amd.js +13118 -12906
  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 +805 -593
  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 +805 -593
  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 -12907
  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 -12910
  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 -12909
  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 +61 -46
  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/folder/types/index.d.ts +4 -0
  33. package/dist/types/src/components/iframe/index.d.ts +6 -1
  34. package/dist/types/src/components/iframe/types/index.d.ts +4 -2
  35. package/dist/types/src/components/loading/index.d.ts +3 -1
  36. package/dist/types/src/components/panel/handlerComponents.d.ts +4 -1
  37. package/dist/types/src/components/panel/index.d.ts +2 -16
  38. package/dist/types/src/components/panel/types/index.d.ts +7 -2
  39. package/dist/types/src/components/prompt/index.d.ts +3 -1
  40. package/dist/types/src/components/searchSuggestion/index.d.ts +4 -1
  41. package/dist/types/src/components/tooltip/index.d.ts +6 -2
  42. package/dist/types/src/config/GlobalConfig.d.ts +1 -0
  43. package/dist/types/src/event/EventEmiter.d.ts +33 -0
  44. package/dist/types/src/handler/PopsHandler.d.ts +18 -16
  45. package/dist/types/src/handler/PopsInstHandler.d.ts +67 -0
  46. package/dist/types/src/types/EventEmitter.d.ts +18 -0
  47. package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +4 -0
  48. package/dist/types/src/types/button.d.ts +2 -1
  49. package/dist/types/src/types/components.d.ts +7 -0
  50. package/dist/types/src/types/event.d.ts +6 -2
  51. package/dist/types/src/types/inst.d.ts +4 -4
  52. package/dist/types/src/utils/PopsDOMUtils.d.ts +0 -16
  53. package/dist/types/src/utils/PopsInstanceUtils.d.ts +0 -88
  54. package/dist/types/src/utils/PopsUtils.d.ts +57 -0
  55. package/package.json +3 -3
  56. package/src/Pops.ts +7 -2
  57. package/src/PopsAnimation.ts +126 -0
  58. package/src/components/alert/defaultConfig.ts +1 -0
  59. package/src/components/alert/index.ts +9 -9
  60. package/src/components/confirm/defaultConfig.ts +1 -0
  61. package/src/components/confirm/index.ts +9 -9
  62. package/src/components/drawer/defaultConfig.ts +1 -0
  63. package/src/components/drawer/index.ts +12 -9
  64. package/src/components/folder/defaultConfig.ts +1 -0
  65. package/src/components/folder/index.ts +9 -8
  66. package/src/components/folder/types/index.ts +4 -0
  67. package/src/components/iframe/defaultConfig.ts +1 -0
  68. package/src/components/iframe/index.ts +18 -12
  69. package/src/components/iframe/types/index.ts +10 -8
  70. package/src/components/loading/defaultConfig.ts +1 -0
  71. package/src/components/loading/index.ts +12 -6
  72. package/src/components/panel/defaultConfig.ts +2 -0
  73. package/src/components/panel/handlerComponents.ts +41 -111
  74. package/src/components/panel/index.ts +34 -28
  75. package/src/components/panel/types/index.ts +7 -2
  76. package/src/components/prompt/defaultConfig.ts +1 -0
  77. package/src/components/prompt/index.ts +9 -8
  78. package/src/components/rightClickMenu/index.ts +17 -14
  79. package/src/components/searchSuggestion/index.ts +5 -1
  80. package/src/components/tooltip/index.ts +20 -10
  81. package/src/event/EventEmiter.ts +95 -0
  82. package/src/handler/PopsElementHandler.ts +6 -4
  83. package/src/handler/PopsHandler.ts +100 -58
  84. package/src/handler/PopsInstHandler.ts +557 -0
  85. package/src/types/EventEmitter.d.ts +18 -0
  86. package/src/types/PopsDOMUtilsEventType.d.ts +4 -0
  87. package/src/types/button.d.ts +2 -1
  88. package/src/types/components.d.ts +7 -0
  89. package/src/types/event.d.ts +6 -2
  90. package/src/types/inst.d.ts +4 -4
  91. package/src/utils/PopsDOMUtils.ts +1 -40
  92. package/src/utils/PopsInstanceUtils.ts +19 -627
  93. 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
  /** 配置 */
@@ -38,11 +39,11 @@ declare class Pops {
38
39
  /** icon图标的svg代码 */
39
40
  iconSVG: {
40
41
  loading: string;
42
+ close: string;
41
43
  min: string;
42
44
  max: string;
43
45
  search: string;
44
46
  mise: string;
45
- close: string;
46
47
  edit: string;
47
48
  share: string;
48
49
  delete: string;
@@ -74,10 +75,10 @@ declare class Pops {
74
75
  instData: {
75
76
  iframe: import("./types/inst").PopsInstGeneralConfig[];
76
77
  folder: import("./types/inst").PopsInstGeneralConfig[];
77
- loading: import("./types/inst").PopsInstGeneralConfig[];
78
78
  alert: import("./types/inst").PopsInstGeneralConfig[];
79
79
  confirm: import("./types/inst").PopsInstGeneralConfig[];
80
80
  prompt: import("./types/inst").PopsInstGeneralConfig[];
81
+ loading: import("./types/inst").PopsInstGeneralConfig[];
81
82
  tooltip: import("./types/inst").PopsInstGeneralConfig[];
82
83
  drawer: import("./types/inst").PopsInstGeneralConfig[];
83
84
  panel: import("./types/inst").PopsInstGeneralConfig[];
@@ -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
  /**
@@ -726,6 +748,7 @@ declare class Pops {
726
748
  forbiddenScroll?: boolean | undefined;
727
749
  lightStyle?: string | undefined;
728
750
  darkStyle?: string | undefined;
751
+ stopKeyDownEventPropagation?: boolean | undefined;
729
752
  beforeAppendToPageCallBack?: void;
730
753
  drag?: boolean | undefined;
731
754
  dragLimit?: boolean | undefined;
@@ -738,27 +761,31 @@ declare class Pops {
738
761
  * 普通信息框
739
762
  * @param config 配置
740
763
  */
741
- 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">;
742
765
  /**
743
766
  * 询问框
744
767
  * @param config 配置
745
768
  */
746
- 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">;
747
770
  /**
748
771
  * 输入框
749
772
  * @param config 配置
750
773
  */
751
- 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">;
752
775
  /**
753
776
  * 加载层
754
777
  * @param config 配置
755
778
  */
756
- 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">;
757
780
  /**
758
781
  * iframe层
759
782
  * @param config 配置
760
783
  */
761
- 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">;
762
789
  /**
763
790
  * 提示框
764
791
  * @param config 配置
@@ -797,38 +824,25 @@ declare class Pops {
797
824
  beforeAppendToPageCallBack: ($shadowRoot: ShadowRoot | HTMLElement, $shadowContainer: HTMLDivElement) => void;
798
825
  };
799
826
  $shadowContainer: HTMLDivElement;
800
- $shadowRoot: HTMLDivElement | ShadowRoot;
827
+ $shadowRoot: HTMLElement | ShadowRoot;
801
828
  toolTip: import("./components/tooltip").ToolTip;
829
+ emitter: EventEmiter<import("./types/EventEmitter").EventMap>;
802
830
  };
803
831
  /**
804
832
  * 抽屉
805
833
  * @param config 配置
806
834
  */
807
- 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">;
808
836
  /**
809
837
  * 文件夹
810
838
  * @param config 配置
811
839
  */
812
- 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">;
813
841
  /**
814
842
  * 配置面板
815
843
  * @param config 配置
816
844
  */
817
- panel: (config: PopsPanelConfig) => {
818
- 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;
819
- 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;
820
- mode: import("./types/main").PopsType;
821
- close: () => Promise<void>;
822
- hide: () => Promise<void>;
823
- show: ($parent?: HTMLElement | Document | ShadowRoot) => Promise<void>;
824
- $shadowContainer: HTMLDivElement;
825
- $shadowRoot: ShadowRoot | HTMLElement;
826
- $el: HTMLDivElement;
827
- $anim: HTMLDivElement;
828
- $pops: HTMLDivElement;
829
- $mask?: HTMLDivElement | undefined;
830
- guid: string;
831
- };
845
+ panel: (config: PopsPanelConfig) => Omit<import("./types/event").PopsEventConfig<EventEmiter<import("./components/panel/types").PopsPanelEventType>>, "function" | "type">;
832
846
  /**
833
847
  * 右键菜单
834
848
  * @param config 配置
@@ -907,7 +921,8 @@ declare class Pops {
907
921
  * searchSuggestion.setAllEvent();
908
922
  */
909
923
  searchSuggestion: <T = any>(config: PopsSearchSuggestionConfig<T>) => {
910
- selfDocument: Document | ShadowRoot | (Document | ShadowRoot)[];
924
+ emitter: EventEmiter<import("./types/EventEmitter").EventMap>;
925
+ selfDocument: ShadowRoot | Document | (ShadowRoot | Document)[];
911
926
  $el: {
912
927
  root: HTMLElement;
913
928
  $dropdownWrapper: 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
  };
@@ -4,8 +4,12 @@ import type { PopsTitleConfig, PopsDragConfig, PopsGeneralConfig, PopsMoreButton
4
4
  */
5
5
  export type PopsFolderDownloadOption = {
6
6
  /**
7
+ *
8
+ * 前置条件:url不为空
9
+ *
7
10
  * 下载方式,不传入就不下载(不做任何处理)
8
11
  *
12
+ *
9
13
  * + `a`: 使用`a标签`进行下载
10
14
  * + `aBlank`: 使用`a标签`进行下载(添加属性`target="_blank"`)
11
15
  * + `iframe`: 使用`iframe`进行下载
@@ -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
  * 创建提示元素
@@ -213,8 +216,9 @@ export declare const PopsTooltip: {
213
216
  beforeAppendToPageCallBack: ($shadowRoot: ShadowRoot | HTMLElement, $shadowContainer: HTMLDivElement) => void;
214
217
  };
215
218
  $shadowContainer: HTMLDivElement;
216
- $shadowRoot: HTMLDivElement | ShadowRoot;
219
+ $shadowRoot: HTMLElement | ShadowRoot;
217
220
  toolTip: ToolTip;
221
+ emitter: EventEmiter<EventMap>;
218
222
  };
219
223
  };
220
224
  export {};
@@ -27,6 +27,7 @@ export declare const GlobalConfig: {
27
27
  forbiddenScroll?: boolean | undefined;
28
28
  lightStyle?: string | undefined;
29
29
  darkStyle?: string | undefined;
30
+ stopKeyDownEventPropagation?: boolean | undefined;
30
31
  beforeAppendToPageCallBack?: void;
31
32
  drag?: boolean | undefined;
32
33
  dragLimit?: boolean | undefined;
@@ -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 };