@whitesev/pops 3.3.5 → 4.0.1

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 (84) hide show
  1. package/dist/index.amd.js +13099 -12934
  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 +752 -587
  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 +752 -587
  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 +13100 -12935
  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 +13103 -12938
  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 +13102 -12937
  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 +131 -77
  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/config/GlobalConfig.d.ts +63 -23
  42. package/dist/types/src/event/EventEmiter.d.ts +33 -0
  43. package/dist/types/src/handler/PopsHandler.d.ts +16 -11
  44. package/dist/types/src/handler/PopsInstHandler.d.ts +67 -0
  45. package/dist/types/src/types/EventEmitter.d.ts +18 -0
  46. package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +4 -0
  47. package/dist/types/src/types/button.d.ts +2 -1
  48. package/dist/types/src/types/event.d.ts +6 -2
  49. package/dist/types/src/types/inst.d.ts +4 -4
  50. package/dist/types/src/utils/PopsDOMUtils.d.ts +0 -16
  51. package/dist/types/src/utils/PopsInstanceUtils.d.ts +1 -89
  52. package/dist/types/src/utils/PopsUtils.d.ts +57 -0
  53. package/package.json +3 -3
  54. package/src/Pops.ts +7 -2
  55. package/src/PopsAnimation.ts +126 -0
  56. package/src/components/alert/index.ts +9 -9
  57. package/src/components/confirm/index.ts +9 -9
  58. package/src/components/drawer/index.ts +12 -9
  59. package/src/components/folder/index.ts +9 -8
  60. package/src/components/iframe/index.ts +18 -12
  61. package/src/components/iframe/types/index.ts +10 -8
  62. package/src/components/loading/index.ts +12 -6
  63. package/src/components/panel/defaultConfig.ts +1 -0
  64. package/src/components/panel/handlerComponents.ts +41 -111
  65. package/src/components/panel/index.ts +34 -28
  66. package/src/components/panel/types/index.ts +7 -2
  67. package/src/components/prompt/index.ts +9 -8
  68. package/src/components/rightClickMenu/index.ts +17 -14
  69. package/src/components/searchSuggestion/index.ts +5 -1
  70. package/src/components/tooltip/index.ts +20 -10
  71. package/src/config/GlobalConfig.ts +21 -14
  72. package/src/css/index.css +2 -0
  73. package/src/event/EventEmiter.ts +95 -0
  74. package/src/handler/PopsElementHandler.ts +8 -6
  75. package/src/handler/PopsHandler.ts +65 -48
  76. package/src/handler/PopsInstHandler.ts +557 -0
  77. package/src/types/EventEmitter.d.ts +18 -0
  78. package/src/types/PopsDOMUtilsEventType.d.ts +4 -0
  79. package/src/types/button.d.ts +2 -1
  80. package/src/types/event.d.ts +6 -2
  81. package/src/types/inst.d.ts +4 -4
  82. package/src/utils/PopsDOMUtils.ts +1 -40
  83. package/src/utils/PopsInstanceUtils.ts +10 -639
  84. package/src/utils/PopsUtils.ts +194 -0
package/dist/index.esm.js CHANGED
@@ -1,3 +1,5 @@
1
+ const version = "4.0.1";
2
+
1
3
  const GlobalConfig = {
2
4
  config: {},
3
5
  /**
@@ -24,18 +26,21 @@ const GlobalConfig = {
24
26
  }
25
27
  else if (keyName === "zIndex") {
26
28
  // 设置zIndex属性
27
- let zIndex = configValue == null ? "" : typeof configValue === "function" ? configValue() : configValue;
28
- if (typeof zIndex === "string") {
29
- const newIndex = (zIndex = Number(zIndex));
30
- if (!isNaN(newIndex)) {
31
- result.zIndex = newIndex;
29
+ result.zIndex = () => {
30
+ let zIndex = configValue == null ? "" : typeof configValue === "function" ? configValue() : configValue;
31
+ if (typeof zIndex === "string") {
32
+ const newIndex = (zIndex = Number(zIndex));
33
+ if (!Number.isNaN(newIndex)) {
34
+ return newIndex;
35
+ }
32
36
  }
33
- }
34
- else {
35
- if (!isNaN(zIndex)) {
36
- result.zIndex = zIndex;
37
+ else {
38
+ if (!Number.isNaN(zIndex)) {
39
+ return zIndex;
40
+ }
37
41
  }
38
- }
42
+ return 0;
43
+ };
39
44
  }
40
45
  else if (keyName === "mask") {
41
46
  const mask = GlobalConfig.config.mask == null ? {} : GlobalConfig.config.mask;
@@ -51,6 +56,72 @@ const GlobalConfig = {
51
56
  },
52
57
  };
53
58
 
59
+ class EventEmiter {
60
+ #type;
61
+ #data = new Map();
62
+ constructor(type) {
63
+ this.#type = type;
64
+ }
65
+ on(eventName, callback) {
66
+ const eventList = this.#data.get(eventName) ?? [];
67
+ eventList.push({ type: this.#type, time: Date.now(), callback: callback });
68
+ this.#data.set(eventName, eventList);
69
+ return {
70
+ off: () => {
71
+ this.off(eventName, callback);
72
+ },
73
+ emit: (...args) => {
74
+ this.emit(eventName, ...args);
75
+ },
76
+ };
77
+ }
78
+ off(eventName, callback) {
79
+ const eventList = this.#data.get(eventName) ?? [];
80
+ let isOffSuccess = false;
81
+ for (let index = eventList.length - 1; index >= 0; index--) {
82
+ if (eventList[index].callback === callback) {
83
+ isOffSuccess = true;
84
+ eventList.splice(index, 1);
85
+ }
86
+ }
87
+ if (eventList.length === 0) {
88
+ // empty
89
+ this.#data.delete(eventName);
90
+ }
91
+ else {
92
+ if (isOffSuccess) {
93
+ // update
94
+ this.#data.set(eventName, eventList);
95
+ }
96
+ }
97
+ }
98
+ async emit(eventName, ...args) {
99
+ const eventList = this.#data.get(eventName) ?? [];
100
+ for (const item of eventList) {
101
+ await item.callback(...args);
102
+ }
103
+ }
104
+ offAll(eventName) {
105
+ if (typeof eventName === "string") {
106
+ this.#data.delete(eventName);
107
+ }
108
+ else {
109
+ this.#data.clear();
110
+ }
111
+ }
112
+ /**
113
+ * 获取所有添加的事件
114
+ */
115
+ getAllEvents(eventName) {
116
+ if (typeof eventName === "string") {
117
+ return this.#data.get(eventName);
118
+ }
119
+ else {
120
+ return Array.from(this.#data.values());
121
+ }
122
+ }
123
+ }
124
+
54
125
  var SVG_min = "<svg viewBox=\"0 0 1024 1024\" xmlns=\"http://www.w3.org/2000/svg\" data-type=\"min\">\r\n <path fill=\"currentColor\" d=\"M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z\"></path>\r\n</svg>\r\n";
55
126
 
56
127
  var SVG_mise = "<svg viewBox=\"0 0 1024 1024\" xmlns=\"http://www.w3.org/2000/svg\" data-type=\"mise\">\r\n <path\r\n fill=\"currentColor\"\r\n d=\"M885.333333 85.333333H330.410667a53.333333 53.333333 0 0 0-53.333334 53.333334v106.666666H138.666667A53.333333 53.333333 0 0 0 85.333333 298.666667v586.666666a53.333333 53.333333 0 0 0 53.333334 53.333334H725.333333a53.333333 53.333333 0 0 0 53.333334-53.333334V746.154667h106.666666c29.44 0 53.333333-23.893333 53.333334-53.333334V138.666667A53.333333 53.333333 0 0 0 885.333333 85.333333zM725.333333 692.821333v192.512H138.666667V298.666667H725.333333v394.154666z m157.866667 0H778.666667V298.666667a53.333333 53.333333 0 0 0-53.333334-53.333334H330.410667v-106.666666h554.922666l-2.133333 554.154666z\"></path>\r\n</svg>\r\n";
@@ -251,6 +322,16 @@ function e(e){e.use(r$2,{name:"doubletap",tapTimes:2});const a=e.get("doubletap"
251
322
  class i extends l$1{constructor(t,u$1){super(t,u$1),this.use(r$2),this.use(u),this.use(a),this.use(c),this.use(r),this.use(i$1);}}i.STATE_POSSIBLE=0,i.STATE_START=4,i.STATE_MOVE=5,i.STATE_END=1,i.STATE_CANCELLED=3,i.STATE_FAILED=2,i.STATE_RECOGNIZED=1,i.tap=r$2,i.pan=u,i.swipe=a,i.press=c,i.rotate=i$1,i.pinch=r,i.doubletap=e;
252
323
 
253
324
  class PopsUtils {
325
+ /**
326
+ * 超时时间
327
+ */
328
+ sleep(timeout) {
329
+ return new Promise((resolve) => {
330
+ setTimeout(() => {
331
+ resolve(true);
332
+ }, timeout);
333
+ });
334
+ }
254
335
  /**
255
336
  * 判断是否是window,例如window、self、globalThis
256
337
  * @param target
@@ -542,6 +623,127 @@ class PopsUtils {
542
623
  }
543
624
  target[key] = newArr;
544
625
  }
626
+ getMaxZIndexNodeInfoFromPoint($el, deviation) {
627
+ if (typeof $el === "function") {
628
+ $el = $el();
629
+ }
630
+ if (typeof $el === "number") {
631
+ deviation = $el;
632
+ $el = void 0;
633
+ }
634
+ if (typeof deviation !== "number" || Number.isNaN(deviation)) {
635
+ deviation = 10;
636
+ }
637
+ const leftTop = {
638
+ x: globalThis.innerWidth * (1 / 8),
639
+ y: globalThis.innerHeight * (1 / 8),
640
+ };
641
+ const leftBottom = {
642
+ x: globalThis.innerWidth * (1 / 8),
643
+ y: globalThis.innerHeight * (7 / 8),
644
+ };
645
+ const rightTop = {
646
+ x: globalThis.innerWidth * (7 / 8),
647
+ y: globalThis.innerHeight * (1 / 8),
648
+ };
649
+ const rightBottom = {
650
+ x: globalThis.innerWidth * (7 / 8),
651
+ y: globalThis.innerHeight * (7 / 8),
652
+ };
653
+ const center = {
654
+ x: globalThis.innerWidth / 2,
655
+ y: globalThis.innerHeight / 2,
656
+ };
657
+ const delayHandlerElementPostionList = [
658
+ leftTop,
659
+ leftBottom,
660
+ rightTop,
661
+ rightBottom,
662
+ center,
663
+ ];
664
+ if ($el) {
665
+ delayHandlerElementPostionList.length = 0;
666
+ if (Array.isArray($el)) {
667
+ delayHandlerElementPostionList.push(...$el);
668
+ }
669
+ else {
670
+ delayHandlerElementPostionList.push($el);
671
+ }
672
+ }
673
+ const positionInfoList = delayHandlerElementPostionList
674
+ .map((position) => {
675
+ let positionNode;
676
+ let positionX;
677
+ let positionY;
678
+ if (position instanceof HTMLElement) {
679
+ positionNode = position;
680
+ const nodeRect = position.getBoundingClientRect();
681
+ positionX = nodeRect.x + nodeRect.width / 2;
682
+ positionY = nodeRect.y + nodeRect.height / 2;
683
+ }
684
+ else {
685
+ positionNode = document.elementFromPoint(position.x, position.y);
686
+ positionX = position.x;
687
+ positionY = position.y;
688
+ }
689
+ const shadowRoot = positionNode?.shadowRoot;
690
+ if (shadowRoot) {
691
+ positionNode = shadowRoot.elementFromPoint(positionX, positionY);
692
+ }
693
+ if (positionNode instanceof HTMLStyleElement)
694
+ return;
695
+ if (positionNode instanceof HTMLScriptElement)
696
+ return;
697
+ if (positionNode instanceof HTMLMetaElement)
698
+ return;
699
+ if (positionNode instanceof HTMLHeadElement)
700
+ return;
701
+ if (!(positionNode instanceof HTMLElement))
702
+ return;
703
+ let parent = positionNode;
704
+ let zIndex = 0;
705
+ let maxZIndexNode = null;
706
+ while (parent) {
707
+ const nodeStyle = globalThis.getComputedStyle(parent);
708
+ const nodeZIndex = parseInt(nodeStyle.zIndex);
709
+ if (nodeStyle.position !== "static" && !isNaN(nodeZIndex)) {
710
+ if (nodeZIndex > zIndex) {
711
+ zIndex = nodeZIndex;
712
+ maxZIndexNode = parent;
713
+ }
714
+ }
715
+ parent = parent.parentElement;
716
+ }
717
+ return {
718
+ /** 处理了偏移量后的z-index值 */
719
+ zIndex: zIndex + deviation,
720
+ /** 原始z-index值 */
721
+ originZIndex: zIndex,
722
+ /** 拥有最大z-index的元素 */
723
+ node: maxZIndexNode,
724
+ /** 目标坐标元素 */
725
+ positionNode: positionNode,
726
+ /** x坐标 */
727
+ positionX: positionX,
728
+ /** y坐标 */
729
+ positionY: positionY,
730
+ };
731
+ })
732
+ .filter((it) => it != null);
733
+ // 降序排序
734
+ positionInfoList.sort((a, b) => {
735
+ if (a.zIndex < b.zIndex) {
736
+ return 1;
737
+ }
738
+ else if (a.zIndex > b.zIndex) {
739
+ return -1;
740
+ }
741
+ else {
742
+ return 0;
743
+ }
744
+ });
745
+ return positionInfoList;
746
+ }
545
747
  }
546
748
  const popsUtils = new PopsUtils();
547
749
 
@@ -832,16 +1034,6 @@ class PopsDOMUtilsEvent {
832
1034
  // 这是存在selector的情况
833
1035
  listenerOption = getOption(args, 4, listenerOption);
834
1036
  }
835
- // 是否移除所有事件
836
- let isRemoveAll = false;
837
- if (args.length === 2) {
838
- // 目标函数、事件名
839
- isRemoveAll = true;
840
- }
841
- else if ((args.length === 3 && typeof args[2] === "string") || Array.isArray(args[2])) {
842
- // 目标函数、事件名、子元素选择器
843
- isRemoveAll = true;
844
- }
845
1037
  if (args.length === 5 && typeof args[4] === "function" && typeof filter !== "function") {
846
1038
  // 目标函数、事件名、回调函数、事件配置、过滤函数
847
1039
  filter = option;
@@ -871,7 +1063,7 @@ class PopsDOMUtilsEvent {
871
1063
  // 事件的配置项不同
872
1064
  flag = false;
873
1065
  }
874
- if (flag || isRemoveAll) {
1066
+ if (flag) {
875
1067
  elementItem.removeEventListener(eventName, handler.callback, handler.option);
876
1068
  const findIndex = handlers.findIndex((item) => item === handler);
877
1069
  if (findIndex !== -1) {
@@ -1263,31 +1455,6 @@ class PopsDOMUtilsEvent {
1263
1455
  const listener = this.on(target, "keydown", handler, option);
1264
1456
  return listener;
1265
1457
  }
1266
- /**
1267
- * 当按键按下时触发事件
1268
- * keydown - > keypress - > keyup
1269
- * @param target 目标
1270
- * @param handler 事件处理函数
1271
- * @param option 配置
1272
- * @example
1273
- * // 监听a.xx元素的按键按下
1274
- * DOMUtils.keypress(document.querySelector("a.xx"),()=>{
1275
- * console.log("按键按下");
1276
- * })
1277
- * DOMUtils.keypress("a.xx",()=>{
1278
- * console.log("按键按下");
1279
- * })
1280
- */
1281
- onKeypress(target, handler, option) {
1282
- if (target == null) {
1283
- return;
1284
- }
1285
- if (typeof target === "string") {
1286
- target = this.selector(target);
1287
- }
1288
- const listener = this.on(target, "keypress", handler, option);
1289
- return listener;
1290
- }
1291
1458
  preventEvent(...args) {
1292
1459
  /**
1293
1460
  * 阻止事件的默认行为发生,并阻止事件传播
@@ -2458,7 +2625,7 @@ const PopsElementHandler = {
2458
2625
  const popsPosition = __config__.position || "";
2459
2626
  if (config.zIndex != null) {
2460
2627
  popsAnimStyle += `z-index: ${zIndex};`;
2461
- popsStyle += `z-index: ${zIndex};`;
2628
+ // popsStyle += `z-index: ${zIndex};`;
2462
2629
  }
2463
2630
  if (__config__.width != null) {
2464
2631
  popsStyle += `width: ${__config__.width};`;
@@ -2467,11 +2634,15 @@ const PopsElementHandler = {
2467
2634
  popsStyle += `height: ${__config__.height};`;
2468
2635
  }
2469
2636
  const hasBottomBtn = bottomBtnHTML.trim() === "" ? false : true;
2637
+ const popsClassNameList = ["pops"];
2638
+ if (config.class) {
2639
+ popsClassNameList.push(...config.class.split(" "));
2640
+ }
2470
2641
  return /*html*/ `
2471
2642
  <div class="pops-anim" anim="${__config__.animation || ""}" style="${popsAnimStyle}" data-guid="${guid}">${config.style != null ? /*html*/ `<style tyle="text/css" data-name="style">${config.style}</style>` : ""}
2472
2643
  ${config.lightStyle != null ? /*html*/ `<style tyle="text/css" data-name="lightStyle">@media (prefers-color-scheme: light) {${config.lightStyle}}</style>` : ""}
2473
2644
  ${config.darkStyle != null ? /*html*/ `<style tyle="text/css" data-name="darkStyle">@media (prefers-color-scheme: dark) {${config.darkStyle}}</style>` : ""}
2474
- <div class="pops ${config.class || ""}" data-bottom-btn="${hasBottomBtn}" type-value="${type}" style="${popsStyle}" position="${popsPosition}" data-guid="${guid}">${html}</div>
2645
+ <div class="${popsClassNameList.join(" ")}" data-bottom-btn="${hasBottomBtn}" type-value="${type}" style="${popsStyle}" position="${popsPosition}" data-guid="${guid}">${html}</div>
2475
2646
  </div>`;
2476
2647
  },
2477
2648
  /**
@@ -2711,7 +2882,7 @@ const PopsElementHandler = {
2711
2882
  addLightStyle($parent, style) {
2712
2883
  const darkCSS = /*css*/ `
2713
2884
  @media (prefers-color-scheme: light) {
2714
- ${style}
2885
+ ${style ?? ""}
2715
2886
  }
2716
2887
  `;
2717
2888
  const $css = this.addStyle($parent, darkCSS);
@@ -2727,7 +2898,7 @@ const PopsElementHandler = {
2727
2898
  addDarkStyle($parent, style) {
2728
2899
  const darkCSS = /*css*/ `
2729
2900
  @media (prefers-color-scheme: dark) {
2730
- ${style}
2901
+ ${style ?? ""}
2731
2902
  }
2732
2903
  `;
2733
2904
  const $css = this.addStyle($parent, darkCSS);
@@ -2739,7 +2910,7 @@ const PopsElementHandler = {
2739
2910
  },
2740
2911
  };
2741
2912
 
2742
- var indexCSS = "@charset \"utf-8\";\n.pops * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n /* 代替::-webkit-scrollbar */\n scrollbar-width: thin;\n}\n.pops {\n --pops-bg-opacity: 1;\n --pops-bd-opacity: 1;\n --pops-font-size: 16px;\n interpolate-size: allow-keywords;\n --pops-color: #000000;\n --pops-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));\n --pops-bd-color: rgb(235, 238, 245, var(--pops-bd-opacity));\n --pops-box-shadow-color: rgba(0, 0, 0, 0.12);\n --pops-title-color: #000000;\n --pops-title-border-color: var(--pops-bd-color);\n --pops-content-color: #000000;\n --pops-bottom-btn-controls-border-color: var(--pops-bd-color);\n --pops-components-is-disabled-text-color: #a8abb2;\n --pops-components-is-disabled-bg-color: #f5f7fa;\n}\n@media (prefers-color-scheme: dark) {\n .pops {\n --pops-mask-bg-opacity: 0.8;\n --pops-color: #ffffff;\n --pops-dark-color: #262626;\n --pops-bg-color: rgb(17, 17, 17, var(--pops-bg-opacity));\n --pops-bd-color: rgb(55, 55, 55, var(--pops-bd-opacity));\n --pops-box-shadow-color: rgba(81, 81, 81, 0.12);\n --pops-title-color: #e8e8e8;\n --pops-title-border-color: var(--pops-bd-color);\n --pops-content-color: #e5e5e5;\n --pops-components-is-disabled-text-color: #a8abb2;\n --pops-components-is-disabled-bg-color: #262727;\n }\n}\n.pops {\n color: var(--pops-color);\n background-color: var(--pops-bg-color);\n border: 1px solid var(--pops-bd-color);\n border-radius: 4px;\n font-size: var(--pops-font-size);\n line-height: normal;\n box-shadow: 0 0 12px var(--pops-box-shadow-color);\n box-sizing: border-box;\n overflow: hidden;\n transition: all 0.35s;\n display: flex;\n flex-direction: column;\n}\n.pops-anim {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n.pops-anim[anim=\"\"] {\n top: unset;\n right: unset;\n bottom: unset;\n left: unset;\n width: unset;\n height: unset;\n transition: none;\n}\n/* 底部图标动画和样式 */\n.pops i.pops-bottom-icon[is-loading=\"true\"] {\n animation: rotating 2s linear infinite;\n}\n.pops i.pops-bottom-icon {\n height: 1em;\n width: 1em;\n line-height: normal;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n position: relative;\n fill: currentColor;\n color: inherit;\n font-size: inherit;\n}\n\n/* 遮罩层样式 */\n.pops-mask {\n --pops-mask-bg-opacity: 0.4;\n --pops-mask-bg-color: rgba(0, 0, 0, var(--pops-mask-bg-opacity));\n}\n.pops-mask {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: 0;\n border-radius: 0;\n background-color: var(--pops-mask-bg-color);\n box-shadow: none;\n transition: none;\n}\n\n.pops-header-controls button.pops-header-control[type][data-header] {\n float: right;\n margin: 0 0;\n outline: 0;\n border: 0;\n border-color: rgb(136, 136, 136, var(--pops-bd-opacity));\n background-color: transparent;\n color: #888;\n cursor: pointer;\n}\n.pops-header-controls button.pops-header-control[data-type=\"max\"],\n.pops-header-controls button.pops-header-control[data-type=\"mise\"],\n.pops-header-controls button.pops-header-control[data-type=\"min\"] {\n outline: 0 !important;\n border: 0;\n border-color: rgb(136, 136, 136, var(--pops-bd-opacity));\n background-color: transparent;\n color: rgb(136, 136, 136);\n cursor: pointer;\n transition: all 0.3s ease-in-out;\n}\nbutton.pops-header-control i {\n color: rgb(144, 147, 153);\n font-size: inherit;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n position: relative;\n fill: currentColor;\n}\nbutton.pops-header-control svg {\n height: 1.25em;\n width: 1.25em;\n}\nbutton.pops-header-control {\n right: 15px;\n padding: 0;\n border: none;\n outline: 0;\n background: 0 0;\n cursor: pointer;\n position: unset;\n line-height: normal;\n}\nbutton.pops-header-control i:hover {\n color: rgb(64, 158, 255);\n}\n.pops-header-controls[data-margin] button.pops-header-control {\n margin: 0 6px;\n display: flex;\n align-items: center;\n}\n.pops[type-value] .pops-header-controls {\n display: flex;\n gap: 6px;\n}\n\n/* 代码块 <code> */\n.pops code {\n font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace;\n font-size: 0.85em;\n color: #000;\n background-color: #f0f0f0;\n border-radius: 3px;\n border: 0;\n padding: 0.2em 0;\n white-space: normal;\n background: #f5f5f5;\n text-wrap: wrap;\n text-align: left;\n word-spacing: normal;\n word-break: normal;\n word-wrap: normal;\n line-height: 1.4;\n -moz-tab-size: 8;\n -o-tab-size: 8;\n tab-size: 8;\n -webkit-hyphens: none;\n -moz-hyphens: none;\n -ms-hyphens: none;\n hyphens: none;\n direction: ltr;\n}\n\n.pops code::before,\n.pops code::after {\n letter-spacing: -0.2em;\n content: \"\\00a0\";\n}\n\n/* 标题 */\n.pops .pops-title {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n display: flex;\n align-items: center;\n justify-content: space-between;\n border-bottom: 1px solid var(--pops-title-border-color);\n width: 100%;\n height: var(--container-title-height);\n}\n/* 标题-普通文本 */\n.pops .pops-title p[pops] {\n color: var(--pops-title-color);\n width: 100%;\n overflow: hidden;\n text-indent: 15px;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-weight: 500;\n line-height: normal;\n}\n\n/* 内容 */\n.pops .pops-content {\n width: 100%;\n /*height: calc(\n\t\t100% - var(--container-title-height) - var(--container-bottom-btn-height)\n\t);*/\n flex: 1;\n overflow: auto;\n word-break: break-word;\n}\n/* 内容-普通文本 */\n.pops .pops-content p[pops] {\n color: var(--pops-content-color);\n padding: 5px 10px;\n text-indent: 15px;\n}\n\n/* 底部-按钮组 */\n.pops .pops-botttom-btn-controls {\n display: flex;\n padding: 10px 10px 10px 10px;\n width: 100%;\n height: var(--container-bottom-btn-height);\n max-height: var(--container-bottom-btn-height);\n line-height: normal;\n border-top: 1px solid var(--pops-bottom-btn-controls-border-color);\n text-align: right;\n align-items: center;\n}\n";
2913
+ var indexCSS = "@charset \"utf-8\";\n.pops * {\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n -webkit-tap-highlight-color: transparent;\n /* 代替::-webkit-scrollbar */\n scrollbar-width: thin;\n}\n.pops {\n --pops-bg-opacity: 1;\n --pops-bd-opacity: 1;\n --pops-font-size: 16px;\n interpolate-size: allow-keywords;\n --pops-color: #000000;\n --pops-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));\n --pops-bd-color: rgb(235, 238, 245, var(--pops-bd-opacity));\n --pops-box-shadow-color: rgba(0, 0, 0, 0.12);\n --pops-title-color: #000000;\n --pops-title-border-color: var(--pops-bd-color);\n --pops-content-color: #000000;\n --pops-bottom-btn-controls-border-color: var(--pops-bd-color);\n --pops-components-is-disabled-text-color: #a8abb2;\n --pops-components-is-disabled-bg-color: #f5f7fa;\n}\n@media (prefers-color-scheme: dark) {\n .pops {\n --pops-mask-bg-opacity: 0.8;\n --pops-color: #ffffff;\n --pops-dark-color: #262626;\n --pops-bg-color: rgb(17, 17, 17, var(--pops-bg-opacity));\n --pops-bd-color: rgb(55, 55, 55, var(--pops-bd-opacity));\n --pops-box-shadow-color: rgba(81, 81, 81, 0.12);\n --pops-title-color: #e8e8e8;\n --pops-title-border-color: var(--pops-bd-color);\n --pops-content-color: #e5e5e5;\n --pops-components-is-disabled-text-color: #a8abb2;\n --pops-components-is-disabled-bg-color: #262727;\n }\n}\n.pops {\n color: var(--pops-color);\n background-color: var(--pops-bg-color);\n border: 1px solid var(--pops-bd-color);\n border-radius: 4px;\n font-size: var(--pops-font-size);\n line-height: normal;\n box-shadow: 0 0 12px var(--pops-box-shadow-color);\n box-sizing: border-box;\n overflow: hidden;\n transition: all 0.35s;\n display: flex;\n flex-direction: column;\n}\n.pops-anim {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n.pops-anim[anim=\"\"] {\n top: unset;\n right: unset;\n bottom: unset;\n left: unset;\n width: unset;\n height: unset;\n transition: none;\n}\n/* 底部图标动画和样式 */\n.pops i.pops-bottom-icon[is-loading=\"true\"] {\n animation: rotating 2s linear infinite;\n}\n.pops i.pops-bottom-icon {\n height: 1em;\n width: 1em;\n line-height: normal;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n position: relative;\n fill: currentColor;\n color: inherit;\n font-size: inherit;\n}\n\n/* 遮罩层样式 */\n.pops-mask {\n --pops-mask-bg-opacity: 0.4;\n --pops-mask-bg-color: rgba(0, 0, 0, var(--pops-mask-bg-opacity));\n}\n.pops-mask {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: 0;\n border-radius: 0;\n background-color: var(--pops-mask-bg-color);\n box-shadow: none;\n transition: none;\n}\n\n.pops-header-controls button.pops-header-control[type][data-header] {\n float: right;\n margin: 0 0;\n outline: 0;\n border: 0;\n border-color: rgb(136, 136, 136, var(--pops-bd-opacity));\n background-color: transparent;\n color: #888;\n cursor: pointer;\n}\n.pops-header-controls button.pops-header-control[data-type=\"max\"],\n.pops-header-controls button.pops-header-control[data-type=\"mise\"],\n.pops-header-controls button.pops-header-control[data-type=\"min\"] {\n outline: 0 !important;\n border: 0;\n border-color: rgb(136, 136, 136, var(--pops-bd-opacity));\n background-color: transparent;\n color: rgb(136, 136, 136);\n cursor: pointer;\n transition: all 0.3s ease-in-out;\n}\nbutton.pops-header-control i {\n color: rgb(144, 147, 153);\n font-size: inherit;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n position: relative;\n fill: currentColor;\n}\nbutton.pops-header-control svg {\n height: 1.25em;\n width: 1.25em;\n}\nbutton.pops-header-control {\n right: 15px;\n padding: 0;\n border: none;\n outline: 0;\n background: 0 0;\n cursor: pointer;\n position: unset;\n line-height: normal;\n}\nbutton.pops-header-control i:hover {\n color: rgb(64, 158, 255);\n}\n.pops-header-controls[data-margin] button.pops-header-control {\n margin: 0 6px;\n display: flex;\n align-items: center;\n}\n.pops[type-value] .pops-header-controls {\n display: flex;\n gap: 6px;\n}\n\n/* 代码块 <code> */\n.pops code {\n font-family: Menlo, Monaco, Consolas, \"Courier New\", monospace;\n font-size: 0.85em;\n color: #000;\n background-color: #f0f0f0;\n border-radius: 3px;\n border: 0;\n padding: 0.2em 0;\n white-space: normal;\n background: #f5f5f5;\n text-wrap: wrap;\n text-align: left;\n word-spacing: normal;\n word-break: normal;\n word-wrap: normal;\n line-height: 1.4;\n -moz-tab-size: 8;\n -o-tab-size: 8;\n tab-size: 8;\n -webkit-hyphens: none;\n -moz-hyphens: none;\n -ms-hyphens: none;\n hyphens: none;\n direction: ltr;\n}\n\n.pops code::before,\n.pops code::after {\n letter-spacing: -0.2em;\n content: \"\\00a0\";\n}\n\n/* 标题 */\n.pops .pops-title {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n display: flex;\n align-items: center;\n justify-content: space-between;\n border-bottom: 1px solid var(--pops-title-border-color);\n width: 100%;\n height: var(--container-title-height);\n}\n/* 标题-普通文本 */\n.pops .pops-title p[pops] {\n color: var(--pops-title-color);\n width: 100%;\n height: 100%;\n align-content: center;\n overflow: hidden;\n text-indent: 15px;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-weight: 500;\n line-height: normal;\n}\n\n/* 内容 */\n.pops .pops-content {\n width: 100%;\n /*height: calc(\n\t\t100% - var(--container-title-height) - var(--container-bottom-btn-height)\n\t);*/\n flex: 1;\n overflow: auto;\n word-break: break-word;\n}\n/* 内容-普通文本 */\n.pops .pops-content p[pops] {\n color: var(--pops-content-color);\n padding: 5px 10px;\n text-indent: 15px;\n}\n\n/* 底部-按钮组 */\n.pops .pops-botttom-btn-controls {\n display: flex;\n padding: 10px 10px 10px 10px;\n width: 100%;\n height: var(--container-bottom-btn-height);\n max-height: var(--container-bottom-btn-height);\n line-height: normal;\n border-top: 1px solid var(--pops-bottom-btn-controls-border-color);\n text-align: right;\n align-items: center;\n}\n";
2743
2914
 
2744
2915
  var ninePalaceGridPositionCSS = ".pops[position=\"top_left\"] {\n position: fixed;\n top: 0;\n left: 0;\n}\n.pops[position=\"top\"] {\n position: fixed;\n top: 0;\n left: 50%;\n transform: translateX(-50%);\n}\n.pops[position=\"top_right\"] {\n position: fixed;\n top: 0;\n right: 0;\n}\n.pops[position=\"center_left\"] {\n position: fixed;\n top: 50%;\n left: 0;\n transform: translateY(-50%);\n}\n.pops[position=\"center\"] {\n position: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n.pops[position=\"center_right\"] {\n position: fixed;\n top: 50%;\n right: 0;\n transform: translateY(-50%);\n}\n.pops[position=\"bottom_left\"] {\n position: fixed;\n bottom: 0;\n left: 0;\n}\n.pops[position=\"bottom\"] {\n position: fixed;\n bottom: 0;\n left: 50%;\n transform: translate(-50%, 0);\n}\n.pops[position=\"bottom_right\"] {\n position: fixed;\n right: 0;\n bottom: 0;\n}\n";
2745
2916
 
@@ -2837,6 +3008,105 @@ const PopsAnimation = {
2837
3008
  hasAnim(name) {
2838
3009
  return Object.prototype.hasOwnProperty.call(this.$data, name);
2839
3010
  },
3011
+ /**
3012
+ * 带动画的进入元素
3013
+ * @param $el 当前元素
3014
+ * @param $next 切换的元素
3015
+ * @param option 配置
3016
+ */
3017
+ createSwitchElementWithAnimation($el, $next, option) {
3018
+ const animOptions = {
3019
+ // 150 220 300
3020
+ duration: 220,
3021
+ easing: "ease-in-out",
3022
+ ...(option.animOptions ?? {}),
3023
+ };
3024
+ if (option.useAnimation == null) {
3025
+ option.useAnimation = true;
3026
+ }
3027
+ return {
3028
+ /**
3029
+ * 进入
3030
+ */
3031
+ async enter() {
3032
+ const transitionEndCallback = async () => {
3033
+ // 先直接隐藏旧的容器
3034
+ popsDOMUtils.cssHide($el, true);
3035
+ // 添加元素
3036
+ await option.enterToAddElementCallback();
3037
+ };
3038
+ // 进入下一层
3039
+ if (option.useAnimation && typeof document.startViewTransition == "function") {
3040
+ // 处理添加的元素的动画
3041
+ const transition = document.startViewTransition(transitionEndCallback);
3042
+ await transition.ready;
3043
+ await $next.animate(
3044
+ // 从右向左移入(进入动画)
3045
+ [
3046
+ {
3047
+ // from
3048
+ transform: "translateX(100%)",
3049
+ },
3050
+ {
3051
+ // to
3052
+ transform: "translateX(0)",
3053
+ },
3054
+ ], animOptions).finished;
3055
+ await transition.finished;
3056
+ }
3057
+ else {
3058
+ await transitionEndCallback();
3059
+ }
3060
+ },
3061
+ /**
3062
+ * 退出
3063
+ */
3064
+ async exit() {
3065
+ // 返回上一层菜单
3066
+ const transitionEndCallback = async () => {
3067
+ // 显示上层菜单
3068
+ popsDOMUtils.cssShow($el);
3069
+ // 移除下一层的菜单
3070
+ $next.remove();
3071
+ if (typeof option.exitToRemoveElementCallback === "function") {
3072
+ await option.exitToRemoveElementCallback();
3073
+ }
3074
+ };
3075
+ if (option.useAnimation && typeof document.startViewTransition == "function") {
3076
+ const leaveTransition = document.startViewTransition(transitionEndCallback);
3077
+ await leaveTransition.ready;
3078
+ await Promise.all([
3079
+ // 从原位置向右移出
3080
+ $next.animate([
3081
+ {
3082
+ // from
3083
+ transform: "translateX(0)",
3084
+ },
3085
+ {
3086
+ // to
3087
+ transform: "translateX(100%)",
3088
+ },
3089
+ ], animOptions).finished,
3090
+ // 从最左边向右移入
3091
+ $el.animate([
3092
+ {
3093
+ // from
3094
+ transform: "translateX(-100%)",
3095
+ },
3096
+ {
3097
+ // to
3098
+ transform: "translateX(0)",
3099
+ },
3100
+ ], animOptions).finished,
3101
+ ]);
3102
+ await leaveTransition.finished;
3103
+ }
3104
+ else {
3105
+ await transitionEndCallback();
3106
+ }
3107
+ },
3108
+ };
3109
+ },
2840
3110
  };
2841
3111
 
2842
3112
  /**
@@ -2856,137 +3126,7 @@ const PopsInstData = {
2856
3126
  tooltip: [],
2857
3127
  };
2858
3128
 
2859
- const PopsInstanceUtils = {
2860
- /**
2861
- * 获取页面中最大的z-index的元素信息
2862
- * @param deviation 获取最大的z-index值的偏移,默认是+1
2863
- * @param node 进行判断的元素,默认是document
2864
- * @param ignoreCallBack 执行元素处理时调用的函数,返回false可忽略不想要处理的元素
2865
- * @example
2866
- * Utils.getMaxZIndexNodeInfo();
2867
- * > {
2868
- * node: ...,
2869
- * zIndex: 1001
2870
- * }
2871
- **/
2872
- getMaxZIndexNodeInfo(deviation = 1, target = PopsCore.document, ignoreCallBack) {
2873
- deviation = Number.isNaN(deviation) ? 1 : deviation;
2874
- // 最大值 2147483647
2875
- // const maxZIndex = Math.pow(2, 31) - 1;
2876
- // 比较值 2000000000
2877
- const maxZIndexCompare = 2 * Math.pow(10, 9);
2878
- // 当前页面最大的z-index
2879
- let zIndex = 0;
2880
- // 当前的最大z-index的元素,调试使用
2881
- let maxZIndexNode = null;
2882
- /**
2883
- * 元素是否可见
2884
- * @param $css
2885
- */
2886
- function isVisibleNode($css) {
2887
- return $css.position !== "static" && $css.display !== "none";
2888
- }
2889
- /**
2890
- * 查询元素的z-index
2891
- * 并比较值是否是已获取的最大值
2892
- * @param $ele
2893
- */
2894
- function queryMaxZIndex($ele) {
2895
- if (typeof ignoreCallBack === "function") {
2896
- const ignoreResult = ignoreCallBack($ele);
2897
- if (typeof ignoreResult === "boolean" && !ignoreResult) {
2898
- return;
2899
- }
2900
- }
2901
- /** 元素的样式 */
2902
- const nodeStyle = PopsCore.window.getComputedStyle($ele);
2903
- // 不对position为static和display为none的元素进行获取它们的z-index
2904
- if (isVisibleNode(nodeStyle)) {
2905
- const nodeZIndex = parseInt(nodeStyle.zIndex);
2906
- if (!isNaN(nodeZIndex)) {
2907
- if (nodeZIndex > zIndex) {
2908
- // 赋值到全局
2909
- zIndex = nodeZIndex;
2910
- maxZIndexNode = $ele;
2911
- }
2912
- }
2913
- // 判断shadowRoot
2914
- if ($ele.shadowRoot != null && $ele instanceof ShadowRoot) {
2915
- $ele.shadowRoot.querySelectorAll("*").forEach(($shadowEle) => {
2916
- queryMaxZIndex($shadowEle);
2917
- });
2918
- }
2919
- }
2920
- }
2921
- target.querySelectorAll("*").forEach(($ele) => {
2922
- queryMaxZIndex($ele);
2923
- });
2924
- zIndex += deviation;
2925
- if (zIndex >= maxZIndexCompare) {
2926
- // 最好不要超过最大值
2927
- zIndex = maxZIndexCompare;
2928
- }
2929
- return {
2930
- node: maxZIndexNode,
2931
- zIndex: zIndex,
2932
- };
2933
- },
2934
- /**
2935
- * 获取pops所有弹窗中的最大的z-index
2936
- * @param deviation
2937
- */
2938
- getPopsMaxZIndex(deviation = 1) {
2939
- deviation = Number.isNaN(deviation) ? 1 : deviation;
2940
- // 最大值 2147483647
2941
- // const browserMaxZIndex = Math.pow(2, 31) - 1;
2942
- // 比较值 2000000000
2943
- const maxZIndex = 2 * Math.pow(10, 9);
2944
- // 当前页面最大的z-index
2945
- let zIndex = 0;
2946
- // 当前的最大z-index的元素,调试使用
2947
- let maxZIndexNode = null;
2948
- /**
2949
- * 元素是否可见
2950
- * @param $css
2951
- */
2952
- function isVisibleNode($css) {
2953
- return $css.position !== "static" && $css.display !== "none";
2954
- }
2955
- Object.keys(PopsInstData).forEach((instKeyName) => {
2956
- const instData = PopsInstData[instKeyName];
2957
- for (let index = 0; index < instData.length; index++) {
2958
- const inst = instData[index];
2959
- const nodeStyle = window.getComputedStyle(inst.$anim);
2960
- // 不对position为static和display为none的元素进行获取它们的z-index
2961
- if (isVisibleNode(nodeStyle)) {
2962
- const nodeZIndex = parseInt(nodeStyle.zIndex);
2963
- if (!isNaN(nodeZIndex)) {
2964
- if (nodeZIndex > zIndex) {
2965
- zIndex = nodeZIndex;
2966
- maxZIndexNode = inst.$anim;
2967
- }
2968
- }
2969
- }
2970
- }
2971
- });
2972
- zIndex += deviation;
2973
- const isOverMaxZIndex = zIndex >= maxZIndex;
2974
- if (isOverMaxZIndex) {
2975
- // 超出z-index最大值
2976
- zIndex = maxZIndex;
2977
- }
2978
- return { zIndex: zIndex, animElement: maxZIndexNode, isOverMaxZIndex };
2979
- },
2980
- /**
2981
- * 获取页面中最大的z-index
2982
- * @param deviation 获取最大的z-index值的偏移,默认是+1
2983
- * @example
2984
- * getMaxZIndex();
2985
- * > 1001
2986
- **/
2987
- getMaxZIndex(deviation = 1) {
2988
- return this.getMaxZIndexNodeInfo(deviation).zIndex;
2989
- },
3129
+ const PopsInstHandler = {
2990
3130
  /**
2991
3131
  * 删除配置中对应的对象
2992
3132
  * @param totalInstConfigList 配置实例列表
@@ -2998,21 +3138,21 @@ const PopsInstanceUtils = {
2998
3138
  * 移除元素实例
2999
3139
  * @param instCommonConfig
3000
3140
  */
3001
- const removeInst = function (instCommonConfig) {
3002
- if (typeof instCommonConfig.beforeRemoveCallBack === "function") {
3003
- // 调用移除签的回调
3004
- instCommonConfig.beforeRemoveCallBack(instCommonConfig);
3005
- }
3141
+ const removeInst = async (instCommonConfig) => {
3142
+ await instCommonConfig.emitter.emit("pops:before-destory", instCommonConfig);
3006
3143
  instCommonConfig?.$anim?.remove();
3007
3144
  instCommonConfig?.$pops?.remove();
3008
3145
  instCommonConfig?.$mask?.remove();
3009
3146
  instCommonConfig?.$shadowContainer?.remove();
3147
+ await instCommonConfig.emitter.emit("pops:destory");
3148
+ // 再清空全部监听的事件
3149
+ await instCommonConfig.emitter.offAll();
3010
3150
  };
3011
3151
  const asyncInstTask = [];
3012
3152
  // [ inst[], inst[],...]
3013
- totalInstConfigList.forEach((instConfigList) => {
3014
- // inst[]
3015
- instConfigList.forEach(async (instConfigItem, index) => {
3153
+ for (const instConfigList of totalInstConfigList) {
3154
+ for (let index = 0; index < instConfigList.length; index++) {
3155
+ const instConfigItem = instConfigList[index];
3016
3156
  // 移除全部或者guid相同
3017
3157
  if (isAll || (typeof guid === "string" && instConfigItem.guid === guid)) {
3018
3158
  // 判断是否有动画
@@ -3024,8 +3164,8 @@ const PopsInstanceUtils = {
3024
3164
  popsDOMUtils.css(instConfigItem.$anim, "animation-name", reverseAnimName);
3025
3165
  if (PopsAnimation.hasAnim(popsDOMUtils.css(instConfigItem.$anim, "animation-name"))) {
3026
3166
  asyncInstTask.push(new Promise((resolve) => {
3027
- popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), function () {
3028
- removeInst(instConfigItem);
3167
+ popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), async () => {
3168
+ await removeInst(instConfigItem);
3029
3169
  resolve();
3030
3170
  }, {
3031
3171
  capture: true,
@@ -3033,16 +3173,17 @@ const PopsInstanceUtils = {
3033
3173
  }));
3034
3174
  }
3035
3175
  else {
3036
- removeInst(instConfigItem);
3176
+ asyncInstTask.push(removeInst(instConfigItem));
3037
3177
  }
3038
3178
  }
3039
3179
  else {
3040
- removeInst(instConfigItem);
3180
+ asyncInstTask.push(removeInst(instConfigItem));
3041
3181
  }
3042
3182
  instConfigList.splice(index, 1);
3183
+ index--;
3043
3184
  }
3044
- });
3045
- });
3185
+ }
3186
+ }
3046
3187
  await Promise.all(asyncInstTask);
3047
3188
  return totalInstConfigList;
3048
3189
  },
@@ -3056,61 +3197,72 @@ const PopsInstanceUtils = {
3056
3197
  * @param $mask
3057
3198
  */
3058
3199
  hide(config, popsType, instConfigList, guid, $anim, $mask) {
3059
- return new Promise((resolve) => {
3200
+ // oxlint-disable-next-line no-async-promise-executor
3201
+ return new Promise(async (resolve) => {
3060
3202
  const $pops = $anim.querySelector(".pops[type-value]");
3061
- if (popsType === "drawer") {
3062
- const drawerConfig = config;
3063
- popsUtils.setTimeout(() => {
3064
- if ($mask) {
3065
- popsDOMUtils.css($mask, "display", "none");
3066
- }
3067
- if (["top", "bottom"].includes(drawerConfig.direction)) {
3068
- $pops.style.setProperty("height", "0");
3069
- }
3070
- else if (["left", "right"].includes(drawerConfig.direction)) {
3071
- $pops.style.setProperty("width", "0");
3203
+ const fintInst = instConfigList.find((instConfigItem) => instConfigItem.guid === guid);
3204
+ if (fintInst) {
3205
+ // 存在实例
3206
+ const startAnim = async () => {
3207
+ if (popsType === "drawer") {
3208
+ // drawer是抽屉
3209
+ // 单独处理动画
3210
+ const drawerConfig = config;
3211
+ await popsUtils.sleep(drawerConfig.closeDelay ?? 0);
3212
+ if ($mask) {
3213
+ popsDOMUtils.css($mask, "display", "none");
3214
+ }
3215
+ const direction = drawerConfig.direction;
3216
+ const size = "0";
3217
+ if (["top", "bottom"].includes(direction)) {
3218
+ $pops.style.setProperty("height", size);
3219
+ }
3220
+ else if (["left", "right"].includes(direction)) {
3221
+ $pops.style.setProperty("width", size);
3222
+ }
3223
+ else {
3224
+ console.error("未知direction: ", direction);
3225
+ }
3072
3226
  }
3073
3227
  else {
3074
- console.error("未知direction:", drawerConfig.direction);
3228
+ instConfigItem.$anim.style.width = "100%";
3229
+ instConfigItem.$anim.style.height = "100%";
3230
+ Reflect.set(instConfigItem.$anim.style, "animation-name", instConfigItem.$anim.getAttribute("anim") + "-reverse");
3075
3231
  }
3076
- resolve();
3077
- }, drawerConfig.closeDelay);
3078
- }
3079
- else {
3080
- const fintInst = instConfigList.find((instConfigItem) => instConfigItem.guid === guid);
3081
- if (fintInst) {
3082
- // 存在动画
3083
- const instConfigItem = fintInst;
3084
- instConfigItem.$anim.style.width = "100%";
3085
- instConfigItem.$anim.style.height = "100%";
3086
- Reflect.set(instConfigItem.$anim.style, "animation-name", instConfigItem.$anim.getAttribute("anim") + "-reverse");
3087
- if (PopsAnimation.hasAnim(Reflect.get(instConfigItem.$anim.style, "animation-name"))) {
3088
- /**
3089
- * 动画结束的回调
3090
- */
3091
- function animationendCallBack() {
3092
- instConfigItem.$anim.style.display = "none";
3093
- if (instConfigItem.$mask) {
3094
- instConfigItem.$mask.style.display = "none";
3095
- }
3096
- popsDOMUtils.off(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), animationendCallBack, {
3097
- capture: true,
3098
- });
3099
- resolve();
3100
- }
3101
- popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), animationendCallBack, {
3102
- capture: true,
3103
- });
3232
+ };
3233
+ const endCallback = () => {
3234
+ instConfigItem.$anim.style.display = "none";
3235
+ if (instConfigItem.$mask) {
3236
+ instConfigItem.$mask.style.display = "none";
3104
3237
  }
3105
- else {
3106
- instConfigItem.$anim.style.display = "none";
3107
- if (instConfigItem.$mask) {
3108
- instConfigItem.$mask.style.display = "none";
3109
- }
3238
+ fintInst.emitter.emit("pops:hide", instConfigItem);
3239
+ };
3240
+ const instConfigItem = fintInst;
3241
+ fintInst.emitter.emit("pops:before-hide", instConfigItem);
3242
+ await startAnim();
3243
+ if (PopsAnimation.hasAnim(Reflect.get(instConfigItem.$anim.style, "animation-name"))) {
3244
+ /**
3245
+ * 动画结束的回调
3246
+ */
3247
+ const animationendCallBack = () => {
3248
+ listener.off();
3249
+ endCallback();
3110
3250
  resolve();
3111
- }
3251
+ };
3252
+ const listener = popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), animationendCallBack, {
3253
+ capture: true,
3254
+ once: true,
3255
+ });
3256
+ }
3257
+ else {
3258
+ endCallback();
3259
+ resolve();
3112
3260
  }
3113
3261
  }
3262
+ else {
3263
+ console.error("hide-error: 该实例未存储");
3264
+ resolve();
3265
+ }
3114
3266
  });
3115
3267
  },
3116
3268
  /**
@@ -3123,62 +3275,70 @@ const PopsInstanceUtils = {
3123
3275
  * @param $mask
3124
3276
  */
3125
3277
  show(config, popsType, instConfigList, guid, $anim, $mask) {
3126
- return new Promise((resolve) => {
3278
+ // oxlint-disable-next-line no-async-promise-executor
3279
+ return new Promise(async (resolve) => {
3127
3280
  const $pops = $anim.querySelector(".pops[type-value]");
3128
- if (popsType === "drawer") {
3129
- const drawerConfig = config;
3130
- popsUtils.setTimeout(() => {
3131
- if ($mask) {
3132
- popsDOMUtils.css($mask, "display", "");
3133
- }
3134
- const direction = drawerConfig.direction;
3135
- const size = drawerConfig.size.toString();
3136
- if (["top", "bottom"].includes(direction)) {
3137
- $pops.style.setProperty("height", size);
3138
- }
3139
- else if (["left", "right"].includes(direction)) {
3140
- $pops.style.setProperty("width", size);
3141
- }
3142
- else {
3143
- console.error("未知direction:", direction);
3144
- }
3145
- resolve();
3146
- }, drawerConfig.openDelay ?? 0);
3147
- }
3148
- else {
3149
- const fintInst = instConfigList.find((instConfigItem) => instConfigItem.guid === guid);
3150
- if (fintInst) {
3151
- const instConfigItem = fintInst;
3152
- instConfigItem.$anim.style.width = "";
3153
- instConfigItem.$anim.style.height = "";
3154
- Reflect.set(instConfigItem.$anim.style, "animation-name", instConfigItem.$anim.getAttribute("anim").replace("-reverse", ""));
3155
- if (PopsAnimation.hasAnim(Reflect.get(instConfigItem.$anim.style, "animation-name"))) {
3156
- /**
3157
- * 动画结束的回调
3158
- */
3159
- function animationendCallBack() {
3160
- popsDOMUtils.off(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), animationendCallBack, {
3161
- capture: true,
3162
- });
3163
- resolve();
3281
+ const fintInst = instConfigList.find((instConfigItem) => instConfigItem.guid === guid);
3282
+ if (fintInst) {
3283
+ const startAnim = async () => {
3284
+ if (popsType === "drawer") {
3285
+ // drawer是抽屉
3286
+ // 单独处理动画
3287
+ const drawerConfig = config;
3288
+ await popsUtils.sleep(drawerConfig.openDelay ?? 0);
3289
+ if ($mask) {
3290
+ popsDOMUtils.css($mask, "display", "");
3291
+ }
3292
+ const direction = drawerConfig.direction;
3293
+ const size = drawerConfig.size.toString();
3294
+ if (["top", "bottom"].includes(direction)) {
3295
+ $pops.style.setProperty("height", size);
3164
3296
  }
3165
- instConfigItem.$anim.style.display = "";
3166
- if (instConfigItem.$mask) {
3167
- instConfigItem.$mask.style.display = "";
3297
+ else if (["left", "right"].includes(direction)) {
3298
+ $pops.style.setProperty("width", size);
3299
+ }
3300
+ else {
3301
+ console.error("未知direction:", direction);
3168
3302
  }
3169
- popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), animationendCallBack, {
3170
- capture: true,
3171
- });
3172
3303
  }
3173
3304
  else {
3174
- instConfigItem.$anim.style.display = "";
3175
- if (instConfigItem.$mask) {
3176
- instConfigItem.$mask.style.display = "";
3177
- }
3178
- resolve();
3305
+ instConfigItem.$anim.style.width = "";
3306
+ instConfigItem.$anim.style.height = "";
3307
+ Reflect.set(instConfigItem.$anim.style, "animation-name", instConfigItem.$anim.getAttribute("anim").replace("-reverse", ""));
3179
3308
  }
3309
+ };
3310
+ const endCallback = () => {
3311
+ instConfigItem.$anim.style.display = "";
3312
+ if (instConfigItem.$mask) {
3313
+ instConfigItem.$mask.style.display = "";
3314
+ }
3315
+ fintInst.emitter.emit("pops:show", instConfigItem);
3316
+ };
3317
+ const instConfigItem = fintInst;
3318
+ fintInst.emitter.emit("pops:before-show", instConfigItem);
3319
+ await startAnim();
3320
+ if (PopsAnimation.hasAnim(Reflect.get(instConfigItem.$anim.style, "animation-name"))) {
3321
+ /**
3322
+ * 动画结束的回调
3323
+ */
3324
+ const animationendCallBack = () => {
3325
+ listener.off();
3326
+ endCallback();
3327
+ resolve();
3328
+ };
3329
+ const listener = popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), animationendCallBack, {
3330
+ capture: true,
3331
+ });
3332
+ }
3333
+ else {
3334
+ endCallback();
3335
+ resolve();
3180
3336
  }
3181
3337
  }
3338
+ else {
3339
+ console.error("show-error: 该实例未存储");
3340
+ resolve();
3341
+ }
3182
3342
  });
3183
3343
  },
3184
3344
  /**
@@ -3190,30 +3350,53 @@ const PopsInstanceUtils = {
3190
3350
  * @param $anim
3191
3351
  */
3192
3352
  async close(config, popsType, instConfigList, guid, $anim) {
3353
+ // 判断组件内部是否有rightClickMenu、tooltip、searchSuggestion组件
3354
+ // 有的话也需要关闭
3355
+ PopsInstData.rightClickMenu.forEach((itemConfig) => {
3356
+ const config = itemConfig.config;
3357
+ if (config.$target instanceof HTMLElement) {
3358
+ const $root = config.$target.getRootNode();
3359
+ if ($root instanceof HTMLElement && $root.parentElement == null) {
3360
+ // 触发销毁元素
3361
+ itemConfig.emitter.emit("pops:before-destory", itemConfig);
3362
+ }
3363
+ }
3364
+ });
3365
+ PopsInstData.tooltip.forEach((itemConfig) => {
3366
+ const config = itemConfig.config;
3367
+ if (config.$target instanceof HTMLElement) {
3368
+ const $root = config.$target.getRootNode();
3369
+ if ($root instanceof HTMLElement && $root.parentElement == null) {
3370
+ // 触发销毁元素
3371
+ itemConfig.emitter.emit("pops:before-destory", itemConfig);
3372
+ }
3373
+ }
3374
+ });
3193
3375
  // eslint-disable-next-line no-async-promise-executor
3194
3376
  await new Promise(async (resolve) => {
3195
3377
  const $pops = $anim.querySelector(".pops[type-value]");
3196
3378
  const drawerConfig = config;
3197
- /**
3198
- * 动画结束事件
3199
- */
3200
- function transitionendEvent() {
3379
+ const start = () => {
3201
3380
  /**
3202
3381
  * 弹窗已关闭的回调
3203
3382
  */
3204
- async function closeCallBack(event) {
3383
+ const transtionEndCallback = async (event) => {
3205
3384
  if (event.propertyName !== "transform") {
3206
3385
  return;
3207
3386
  }
3208
- popsDOMUtils.off($pops, popsDOMUtils.getTransitionEndNameList(), closeCallBack);
3209
- await PopsInstanceUtils.removeInstance([instConfigList], guid);
3387
+ listener.off();
3388
+ await PopsInstHandler.removeInstance([instConfigList], guid);
3210
3389
  resolve();
3211
- }
3390
+ };
3212
3391
  // 监听过渡结束
3213
- popsDOMUtils.on($pops, popsDOMUtils.getTransitionEndNameList(), closeCallBack);
3214
- const popsTransForm = getComputedStyle($pops).transform;
3392
+ const listener = popsDOMUtils.on($pops, popsDOMUtils.getTransitionEndNameList(), transtionEndCallback, {
3393
+ once: true,
3394
+ });
3395
+ const popsTransForm = globalThis.getComputedStyle($pops).transform;
3215
3396
  if (popsTransForm !== "none") {
3216
- popsDOMUtils.emit($pops, popsDOMUtils.getTransitionEndNameList(), void 0, true);
3397
+ // 不存在动画
3398
+ // 直接移除实例
3399
+ listener.emit({ propertyName: "transform" });
3217
3400
  return;
3218
3401
  }
3219
3402
  if (["top"].includes(drawerConfig.direction)) {
@@ -3229,41 +3412,18 @@ const PopsInstanceUtils = {
3229
3412
  $pops.style.setProperty("transform", "translateX(100%)");
3230
3413
  }
3231
3414
  else {
3232
- console.error("未知direction", drawerConfig.direction);
3415
+ console.error("未知direction: ", drawerConfig.direction);
3233
3416
  }
3234
- }
3417
+ };
3235
3418
  if (popsType === "drawer") {
3236
- popsUtils.setTimeout(() => {
3237
- transitionendEvent();
3238
- }, drawerConfig.closeDelay);
3419
+ await popsUtils.sleep(drawerConfig.closeDelay ?? 0);
3420
+ start();
3239
3421
  }
3240
3422
  else {
3241
- await PopsInstanceUtils.removeInstance([instConfigList], guid);
3423
+ await PopsInstHandler.removeInstance([instConfigList], guid);
3242
3424
  resolve();
3243
3425
  }
3244
3426
  });
3245
- // 判断组件内是否有rightClickMenu、tooltip、searchSuggestion组件
3246
- // 有的话也需要关闭
3247
- PopsInstData.rightClickMenu.forEach((itemConfig) => {
3248
- const config = itemConfig.config;
3249
- if (config.$target instanceof HTMLElement) {
3250
- const $root = config.$target.getRootNode();
3251
- if ($root instanceof HTMLElement && $root.parentElement == null) {
3252
- // 触发销毁元素
3253
- itemConfig.destory();
3254
- }
3255
- }
3256
- });
3257
- PopsInstData.tooltip.forEach((itemConfig) => {
3258
- const config = itemConfig.config;
3259
- if (config.$target instanceof HTMLElement) {
3260
- const $root = config.$target.getRootNode();
3261
- if ($root instanceof HTMLElement && $root.parentElement == null) {
3262
- // 触发销毁元素
3263
- itemConfig.destory();
3264
- }
3265
- }
3266
- });
3267
3427
  },
3268
3428
  /**
3269
3429
  * 拖拽元素
@@ -3351,17 +3511,10 @@ const PopsInstanceUtils = {
3351
3511
  clickElementLeftOffset = event.x - rect.left;
3352
3512
  clickElementTopOffset = event.y - rect.top;
3353
3513
  transformInfo = popsDOMUtils.getTransform($move);
3354
- //if (event.nativeEvent.offsetX) {
3355
- // clickElementLeftOffset = parseInt(event.nativeEvent.offsetX);
3356
- //} else {
3357
- // clickElementLeftOffset = parseInt(event.getOffset().x);
3358
- //}
3359
- //if (event.nativeEvent.offsetY) {
3360
- // clickElementTopOffset = parseInt(event.nativeEvent.offsetY);
3361
- //} else {
3362
- // clickElementTopOffset = parseInt(event.getOffset().y);
3363
- //}
3364
3514
  resumeMoveElementStyle = changeMoveElementStyle($move);
3515
+ if (typeof options.startCallBack === "function") {
3516
+ options.startCallBack($move, clickElementLeftOffset, clickElementTopOffset);
3517
+ }
3365
3518
  }
3366
3519
  /** 当前移动的left偏移 */
3367
3520
  let currentMoveLeftOffset = event.x - clickElementLeftOffset + transformInfo.transformLeft;
@@ -3438,46 +3591,6 @@ const PopsInstanceUtils = {
3438
3591
  });
3439
3592
  }
3440
3593
  },
3441
- /**
3442
- * 排序数组
3443
- * @param getBeforeValueFun
3444
- * @param getAfterValueFun
3445
- * @param sortByDesc 排序是否降序,默认降序
3446
- */
3447
- sortElementListByProperty(getBeforeValueFun, getAfterValueFun, sortByDesc = true) {
3448
- if (typeof sortByDesc !== "boolean") {
3449
- throw new TypeError("参数 sortByDesc 必须为boolean类型");
3450
- }
3451
- if (getBeforeValueFun == null || getAfterValueFun == null) {
3452
- throw new Error("获取前面的值或后面的值的方法不能为空");
3453
- }
3454
- return function (after_obj, before_obj) {
3455
- const beforeValue = getBeforeValueFun(before_obj); // 前
3456
- const afterValue = getAfterValueFun(after_obj); // 后
3457
- if (sortByDesc) {
3458
- if (afterValue > beforeValue) {
3459
- return -1;
3460
- }
3461
- else if (afterValue < beforeValue) {
3462
- return 1;
3463
- }
3464
- else {
3465
- return 0;
3466
- }
3467
- }
3468
- else {
3469
- if (afterValue < beforeValue) {
3470
- return -1;
3471
- }
3472
- else if (afterValue > beforeValue) {
3473
- return 1;
3474
- }
3475
- else {
3476
- return 0;
3477
- }
3478
- }
3479
- };
3480
- },
3481
3594
  };
3482
3595
 
3483
3596
  const PopsHandler = {
@@ -3591,11 +3704,11 @@ const PopsHandler = {
3591
3704
  function originalRun() {
3592
3705
  if (config.config.mask.clickEvent.toClose) {
3593
3706
  // 关闭
3594
- return PopsInstanceUtils.close(config.config, config.type, targetInst, config.guid, config.animElement);
3707
+ return PopsInstHandler.close(config.config, config.type, targetInst, config.guid, config.animElement);
3595
3708
  }
3596
3709
  else if (config.config.mask.clickEvent.toHide) {
3597
3710
  // 隐藏
3598
- return PopsInstanceUtils.hide(config.config, config.type, targetInst, config.guid, config.animElement, result.maskElement);
3711
+ return PopsInstHandler.hide(config.config, config.type, targetInst, config.guid, config.animElement, result.maskElement);
3599
3712
  }
3600
3713
  }
3601
3714
  if (typeof config.config.mask.clickCallBack === "function") {
@@ -3782,7 +3895,7 @@ const PopsHandler = {
3782
3895
  * @param $mask 遮罩层
3783
3896
  * @param config 当前配置
3784
3897
  */
3785
- handleEventConfig(config, guid, $shadowContainer, $shadowRoot, type, $anim, $pops, $mask) {
3898
+ handleEventConfig(config, guid, $shadowContainer, $shadowRoot, type, $anim, $pops, emitter, $mask) {
3786
3899
  return {
3787
3900
  $shadowContainer: $shadowContainer,
3788
3901
  $shadowRoot: $shadowRoot,
@@ -3792,17 +3905,18 @@ const PopsHandler = {
3792
3905
  $mask: $mask,
3793
3906
  mode: type,
3794
3907
  guid: guid,
3908
+ emitter: emitter,
3795
3909
  close() {
3796
- return PopsInstanceUtils.close(config, type, PopsInstData[type], guid, $anim);
3910
+ return PopsInstHandler.close(config, type, PopsInstData[type], guid, $anim);
3797
3911
  },
3798
3912
  hide() {
3799
- return PopsInstanceUtils.hide(config, type, PopsInstData[type], guid, $anim, $mask);
3913
+ return PopsInstHandler.hide(config, type, PopsInstData[type], guid, $anim, $mask);
3800
3914
  },
3801
3915
  show($parent) {
3802
3916
  if ($parent) {
3803
3917
  $parent.appendChild(PopsInstData[type][0].$shadowRoot);
3804
3918
  }
3805
- return PopsInstanceUtils.show(config, type, PopsInstData[type], guid, $anim, $mask);
3919
+ return PopsInstHandler.show(config, type, PopsInstData[type], guid, $anim, $mask);
3806
3920
  },
3807
3921
  };
3808
3922
  },
@@ -3815,7 +3929,7 @@ const PopsHandler = {
3815
3929
  * @param $mask 遮罩层
3816
3930
  * @param config 当前配置
3817
3931
  */
3818
- handleLoadingEventConfig(config, guid, type, $anim, $pops, $mask) {
3932
+ handleLoadingEventConfig(config, guid, type, $anim, $pops, emitter, $mask) {
3819
3933
  return {
3820
3934
  $el: $anim,
3821
3935
  $anim: $anim,
@@ -3823,14 +3937,15 @@ const PopsHandler = {
3823
3937
  $mask: $mask,
3824
3938
  mode: type,
3825
3939
  guid: guid,
3940
+ emitter,
3826
3941
  close() {
3827
- return PopsInstanceUtils.close(config, type, PopsInstData[type], guid, $anim);
3942
+ return PopsInstHandler.close(config, type, PopsInstData[type], guid, $anim);
3828
3943
  },
3829
3944
  hide() {
3830
- return PopsInstanceUtils.hide(config, type, PopsInstData[type], guid, $anim, $mask);
3945
+ return PopsInstHandler.hide(config, type, PopsInstData[type], guid, $anim, $mask);
3831
3946
  },
3832
3947
  show() {
3833
- return PopsInstanceUtils.show(config, type, PopsInstData[type], guid, $anim, $mask);
3948
+ return PopsInstHandler.show(config, type, PopsInstData[type], guid, $anim, $mask);
3834
3949
  },
3835
3950
  };
3836
3951
  },
@@ -3854,7 +3969,7 @@ const PopsHandler = {
3854
3969
  handleClickEvent(type, $btn, eventConfig, callback) {
3855
3970
  if (typeof callback !== "function")
3856
3971
  return;
3857
- popsDOMUtils.on($btn, "click", (event) => {
3972
+ return popsDOMUtils.on($btn, "click", (event) => {
3858
3973
  const extraParam = {
3859
3974
  type: type,
3860
3975
  };
@@ -3892,16 +4007,10 @@ const PopsHandler = {
3892
4007
  callback && callback(event);
3893
4008
  }
3894
4009
  };
3895
- popsDOMUtils.on(PopsCore.globalThis, "keydown", keyboardEvent, {
4010
+ const listener = popsDOMUtils.on(PopsCore.globalThis, "keydown", keyboardEvent, {
3896
4011
  capture: true,
3897
4012
  });
3898
- return {
3899
- removeKeyboardEvent() {
3900
- popsDOMUtils.off(globalThis, "keydown", keyboardEvent, {
3901
- capture: true,
3902
- });
3903
- },
3904
- };
4013
+ return listener;
3905
4014
  },
3906
4015
  /**
3907
4016
  * 处理prompt的点击事件
@@ -3924,15 +4033,16 @@ const PopsHandler = {
3924
4033
  });
3925
4034
  },
3926
4035
  /**
3927
- * 把配置的z-index配置转为数字
3928
- * @param zIndex
4036
+ * 获取数值
4037
+ * @param target
3929
4038
  */
3930
- handleZIndex(zIndex) {
3931
- if (typeof zIndex === "function") {
3932
- return zIndex();
4039
+ getTargerOrFunctionValue(target) {
4040
+ if (typeof target === "function") {
4041
+ const result = target();
4042
+ return result;
3933
4043
  }
3934
4044
  else {
3935
- return zIndex;
4045
+ return target;
3936
4046
  }
3937
4047
  },
3938
4048
  /**
@@ -3949,11 +4059,11 @@ const PopsHandler = {
3949
4059
  if (type === "loading" || type === "tooltip" || type === "rightClickMenu") {
3950
4060
  const inst = PopsInstData[type];
3951
4061
  if (inst) {
3952
- PopsInstanceUtils.removeInstance([inst], "", true);
4062
+ PopsInstHandler.removeInstance([inst], "", true);
3953
4063
  }
3954
4064
  }
3955
4065
  else {
3956
- PopsInstanceUtils.removeInstance([
4066
+ PopsInstHandler.removeInstance([
3957
4067
  PopsInstData.alert,
3958
4068
  PopsInstData.confirm,
3959
4069
  PopsInstData.drawer,
@@ -3964,17 +4074,31 @@ const PopsHandler = {
3964
4074
  ], "", true);
3965
4075
  }
3966
4076
  }
3967
- else {
3968
- // 对配置进行处理
3969
- // 选择配置的z-index和已有的pops实例的最大z-index值
3970
- const originZIndex = config.zIndex;
3971
- config.zIndex = () => {
3972
- const { zIndex: maxZIndex } = PopsInstanceUtils.getPopsMaxZIndex(PopsHandler.handleZIndex(originZIndex) + 100);
3973
- return maxZIndex;
3974
- };
4077
+ if (type !== "rightClickMenu") {
4078
+ // rightClickMenu在配置处理时就处理了一次,这里不需要重复处理
4079
+ config = this.handleZIndex(config);
3975
4080
  }
3976
4081
  return config;
3977
4082
  },
4083
+ /**
4084
+ * 处理z-index
4085
+ * @param config 配置
4086
+ */
4087
+ handleZIndex(config) {
4088
+ // 对配置进行处理
4089
+ // 选择配置的z-index和已有的pops实例的最大z-index值
4090
+ const originZIndex = config.zIndex;
4091
+ const handler = () => {
4092
+ let deviation = 100;
4093
+ deviation += PopsHandler.getTargerOrFunctionValue(originZIndex) ?? 0;
4094
+ let maxZIndex = deviation;
4095
+ const pointZIndex = popsUtils.getMaxZIndexNodeInfoFromPoint(deviation)[0]?.zIndex ?? 0;
4096
+ maxZIndex = Math.max(maxZIndex, pointZIndex);
4097
+ return maxZIndex === deviation ? maxZIndex : maxZIndex + deviation;
4098
+ };
4099
+ config.zIndex = handler;
4100
+ return config;
4101
+ },
3978
4102
  /**
3979
4103
  * 处理把已创建的元素保存到内部环境中
3980
4104
  * @param type 当前弹窗类型
@@ -4054,6 +4178,7 @@ const PopsAlert = {
4054
4178
  const guid = popsUtils.getRandomGUID();
4055
4179
  // 设置当前类型
4056
4180
  const popsType = "alert";
4181
+ const emitter = new EventEmiter(popsType);
4057
4182
  let config = PopsAlertDefaultConfig();
4058
4183
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4059
4184
  config = popsUtils.assign(config, __config__);
@@ -4090,7 +4215,7 @@ const PopsAlert = {
4090
4215
  },
4091
4216
  ]);
4092
4217
  // 先把z-index提取出来
4093
- const zIndex = PopsHandler.handleZIndex(config.zIndex);
4218
+ const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
4094
4219
  const maskHTML = PopsElementHandler.createMask(guid, zIndex);
4095
4220
  const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
4096
4221
  const bottomBtnHTML = PopsElementHandler.createBottom(popsType, config);
@@ -4126,7 +4251,7 @@ const PopsAlert = {
4126
4251
  $elList.push($mask);
4127
4252
  }
4128
4253
  // 处理返回的配置
4129
- const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
4254
+ const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, emitter, $mask);
4130
4255
  const result = PopsHandler.handleResultConfig(evtConfig);
4131
4256
  // 为顶部右边的关闭按钮添加点击事件
4132
4257
  PopsHandler.handleClickEvent("close", $headerCloseBtn, evtConfig, config.btn.close?.callback);
@@ -4134,9 +4259,7 @@ const PopsAlert = {
4134
4259
  PopsHandler.handleClickEvent("ok", btnOkElement, evtConfig, config.btn.ok?.callback);
4135
4260
  // 创建到页面中
4136
4261
  popsDOMUtils.append($shadowRoot, $elList);
4137
- if (typeof config.beforeAppendToPageCallBack === "function") {
4138
- config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
4139
- }
4262
+ emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
4140
4263
  popsDOMUtils.appendBody($shadowContainer);
4141
4264
  if ($mask != null) {
4142
4265
  // 添加遮罩层
@@ -4151,11 +4274,11 @@ const PopsAlert = {
4151
4274
  $shadowContainer: $shadowContainer,
4152
4275
  $shadowRoot: $shadowRoot,
4153
4276
  config: config,
4154
- destory: result.close,
4277
+ emitter,
4155
4278
  });
4156
4279
  // 拖拽
4157
4280
  if (config.drag) {
4158
- PopsInstanceUtils.drag($pops, {
4281
+ PopsInstHandler.drag($pops, {
4159
4282
  dragElement: $title,
4160
4283
  limit: config.dragLimit,
4161
4284
  extraDistance: config.dragExtraDistance,
@@ -4263,6 +4386,7 @@ const PopsConfirm = {
4263
4386
  const guid = popsUtils.getRandomGUID();
4264
4387
  // 设置当前类型
4265
4388
  const popsType = "confirm";
4389
+ const emitter = new EventEmiter(popsType);
4266
4390
  let config = PopsConfirmDefaultConfig();
4267
4391
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4268
4392
  config = popsUtils.assign(config, __config__);
@@ -4299,7 +4423,7 @@ const PopsConfirm = {
4299
4423
  },
4300
4424
  ]);
4301
4425
  // 先把z-index提取出来
4302
- const zIndex = PopsHandler.handleZIndex(config.zIndex);
4426
+ const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
4303
4427
  const maskHTML = PopsElementHandler.createMask(guid, zIndex);
4304
4428
  const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
4305
4429
  const bottomBtnHTML = PopsElementHandler.createBottom(popsType, config);
@@ -4338,7 +4462,7 @@ const PopsConfirm = {
4338
4462
  $mask = handleMask.maskElement;
4339
4463
  $elList.push($mask);
4340
4464
  }
4341
- const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
4465
+ const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, emitter, $mask);
4342
4466
  const result = PopsHandler.handleResultConfig(evtConfig);
4343
4467
  PopsHandler.handleClickEvent("close", $btnClose, evtConfig, config.btn.close.callback);
4344
4468
  PopsHandler.handleClickEvent("ok", $btnOk, evtConfig, config.btn.ok.callback);
@@ -4346,9 +4470,7 @@ const PopsConfirm = {
4346
4470
  PopsHandler.handleClickEvent("other", $btnOther, evtConfig, config.btn.other.callback);
4347
4471
  // 创建到页面中
4348
4472
  popsDOMUtils.append($shadowRoot, $elList);
4349
- if (typeof config.beforeAppendToPageCallBack === "function") {
4350
- config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
4351
- }
4473
+ emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
4352
4474
  popsDOMUtils.appendBody($shadowContainer);
4353
4475
  if ($mask != null) {
4354
4476
  $anim.after($mask);
@@ -4361,11 +4483,11 @@ const PopsConfirm = {
4361
4483
  $shadowContainer: $shadowContainer,
4362
4484
  $shadowRoot: $shadowRoot,
4363
4485
  config: config,
4364
- destory: result.close,
4486
+ emitter,
4365
4487
  });
4366
4488
  // 拖拽
4367
4489
  if (config.drag) {
4368
- PopsInstanceUtils.drag($pops, {
4490
+ PopsInstHandler.drag($pops, {
4369
4491
  dragElement: $title,
4370
4492
  limit: config.dragLimit,
4371
4493
  extraDistance: config.dragExtraDistance,
@@ -4472,6 +4594,7 @@ const PopsDrawer = {
4472
4594
  const guid = popsUtils.getRandomGUID();
4473
4595
  // 设置当前类型
4474
4596
  const popsType = "drawer";
4597
+ const emitter = new EventEmiter(popsType);
4475
4598
  let config = PopsDrawerDefaultConfig();
4476
4599
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4477
4600
  config = popsUtils.assign(config, __config__);
@@ -4508,7 +4631,7 @@ const PopsDrawer = {
4508
4631
  },
4509
4632
  ]);
4510
4633
  // 先把z-index提取出来
4511
- const zIndex = PopsHandler.handleZIndex(config.zIndex);
4634
+ const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
4512
4635
  const maskHTML = PopsElementHandler.createMask(guid, zIndex);
4513
4636
  const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
4514
4637
  const bottomBtnHTML = PopsElementHandler.createBottom(popsType, config);
@@ -4553,7 +4676,7 @@ const PopsDrawer = {
4553
4676
  $mask = handleMask.maskElement;
4554
4677
  $elList.push($mask);
4555
4678
  }
4556
- const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
4679
+ const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, emitter, $mask);
4557
4680
  const result = PopsHandler.handleResultConfig(evtConfig);
4558
4681
  // 处理方向
4559
4682
  $pops.setAttribute("direction", config.direction);
@@ -4577,9 +4700,12 @@ const PopsDrawer = {
4577
4700
  }
4578
4701
  // 按下Esc键触发关闭
4579
4702
  if (config.closeOnPressEscape) {
4580
- PopsHandler.handleKeyboardEvent("Escape", [], function () {
4703
+ const listener = PopsHandler.handleKeyboardEvent("Escape", [], function () {
4581
4704
  evtConfig.close();
4582
4705
  });
4706
+ emitter.on("pops:destory", () => {
4707
+ listener.off();
4708
+ });
4583
4709
  }
4584
4710
  // 待处理的点击事件列表
4585
4711
  const needHandleClickEventList = [
@@ -4631,9 +4757,7 @@ const PopsDrawer = {
4631
4757
  });
4632
4758
  // 创建到页面中
4633
4759
  popsDOMUtils.append($shadowRoot, $elList);
4634
- if (typeof config.beforeAppendToPageCallBack === "function") {
4635
- config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
4636
- }
4760
+ emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
4637
4761
  popsDOMUtils.appendBody($shadowContainer);
4638
4762
  popsUtils.setTimeout(() => {
4639
4763
  popsUtils.setTimeout(() => {
@@ -4651,7 +4775,7 @@ const PopsDrawer = {
4651
4775
  $shadowContainer: $shadowContainer,
4652
4776
  $shadowRoot: $shadowRoot,
4653
4777
  config: config,
4654
- destory: result.close,
4778
+ emitter: emitter,
4655
4779
  });
4656
4780
  return result;
4657
4781
  },
@@ -4693,12 +4817,13 @@ const PopsLoading = {
4693
4817
  const guid = popsUtils.getRandomGUID();
4694
4818
  // 设置当前类型
4695
4819
  const PopsType = "loading";
4820
+ const emitter = new EventEmiter(PopsType);
4696
4821
  let config = PopsLoadingDefaultConfig();
4697
4822
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4698
4823
  config = popsUtils.assign(config, __config__);
4699
4824
  config = PopsHandler.handleOnly(PopsType, config);
4700
4825
  // 先把z-index提取出来
4701
- const zIndex = PopsHandler.handleZIndex(config.zIndex);
4826
+ const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
4702
4827
  const maskHTML = PopsElementHandler.createMask(guid, zIndex);
4703
4828
  const { contentPStyle } = PopsElementHandler.createContentStyle("loading", config);
4704
4829
  const animHTML = PopsElementHandler.createAnim(guid, PopsType, config,
@@ -4741,17 +4866,20 @@ const PopsLoading = {
4741
4866
  $mask = handleMask.maskElement;
4742
4867
  $elList.push($mask);
4743
4868
  }
4744
- const evtConfig = PopsHandler.handleLoadingEventConfig(config, guid, PopsType, $anim, $pops, $mask);
4869
+ const evtConfig = PopsHandler.handleLoadingEventConfig(config, guid, PopsType, $anim, $pops, emitter, $mask);
4745
4870
  popsDOMUtils.append(config.$parent, $elList);
4746
4871
  if ($mask != null) {
4747
4872
  $anim.after($mask);
4748
4873
  }
4749
- // @ts-ignore
4750
4874
  PopsHandler.handlePush(PopsType, {
4875
+ $shadowContainer: $pops,
4876
+ $shadowRoot: $pops,
4751
4877
  guid: guid,
4752
4878
  $anim: $anim,
4753
4879
  $pops: $pops,
4754
4880
  $mask: $mask,
4881
+ emitter: emitter,
4882
+ config: config,
4755
4883
  });
4756
4884
  if (config.isAbsolute) {
4757
4885
  // 遮罩层必须是跟随主内容
@@ -4950,6 +5078,7 @@ const PopsFolder = {
4950
5078
  const guid = popsUtils.getRandomGUID();
4951
5079
  // 设置当前类型
4952
5080
  const popsType = "folder";
5081
+ const emitter = new EventEmiter(popsType);
4953
5082
  let config = PopsFolderDefaultConfig();
4954
5083
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4955
5084
  config = popsUtils.assign(config, __config__);
@@ -5033,7 +5162,7 @@ const PopsFolder = {
5033
5162
  Reflect.set(config, "folder", config.folder);
5034
5163
  }
5035
5164
  // 先把z-index提取出来
5036
- const zIndex = PopsHandler.handleZIndex(config.zIndex);
5165
+ const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
5037
5166
  const maskHTML = PopsElementHandler.createMask(guid, zIndex);
5038
5167
  const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
5039
5168
  const bottomBtnHTML = PopsElementHandler.createBottom(popsType, config);
@@ -5166,7 +5295,7 @@ const PopsFolder = {
5166
5295
  $elList.push($mask);
5167
5296
  }
5168
5297
  // 事件
5169
- const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
5298
+ const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, emitter, $mask);
5170
5299
  const result = PopsHandler.handleResultConfig(evtConfig);
5171
5300
  PopsHandler.handleClickEvent("close", $btnCloseBtn, evtConfig, config.btn.close.callback);
5172
5301
  PopsHandler.handleClickEvent("ok", btnOkElement, evtConfig, config.btn.ok.callback);
@@ -5174,9 +5303,7 @@ const PopsFolder = {
5174
5303
  PopsHandler.handleClickEvent("other", btnOtherElement, evtConfig, config.btn.other.callback);
5175
5304
  // 创建到页面中
5176
5305
  popsDOMUtils.append($shadowRoot, $elList);
5177
- if (typeof config.beforeAppendToPageCallBack === "function") {
5178
- config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
5179
- }
5306
+ emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
5180
5307
  popsDOMUtils.appendBody($shadowContainer);
5181
5308
  if ($mask != null) {
5182
5309
  $anim.after($mask);
@@ -5800,7 +5927,7 @@ const PopsFolder = {
5800
5927
  Reflect.set($pops, "data-pops-folder", popsFolder);
5801
5928
  // 拖拽
5802
5929
  if (config.drag) {
5803
- PopsInstanceUtils.drag($pops, {
5930
+ PopsInstHandler.drag($pops, {
5804
5931
  dragElement: $title,
5805
5932
  limit: config.dragLimit,
5806
5933
  extraDistance: config.dragExtraDistance,
@@ -5816,7 +5943,7 @@ const PopsFolder = {
5816
5943
  $shadowContainer: $shadowContainer,
5817
5944
  $shadowRoot: $shadowRoot,
5818
5945
  config: config,
5819
- destory: result.close,
5946
+ emitter,
5820
5947
  });
5821
5948
  return result;
5822
5949
  },
@@ -5888,6 +6015,7 @@ const PopsIframe = {
5888
6015
  const guid = popsUtils.getRandomGUID();
5889
6016
  // 设置当前类型
5890
6017
  const popsType = "iframe";
6018
+ const emitter = new EventEmiter(popsType);
5891
6019
  let config = PopsIframeDefaultConfig();
5892
6020
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
5893
6021
  config = popsUtils.assign(config, __config__);
@@ -5924,7 +6052,7 @@ const PopsIframe = {
5924
6052
  ]);
5925
6053
  const maskExtraStyle = config.animation != null && config.animation != "" ? "position:absolute;" : "";
5926
6054
  // 先把z-index提取出来
5927
- const zIndex = PopsHandler.handleZIndex(config.zIndex);
6055
+ const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
5928
6056
  const maskHTML = PopsElementHandler.createMask(guid, zIndex, maskExtraStyle);
5929
6057
  const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
5930
6058
  const iframeLoadingHTML = /*html*/ '<div class="pops-loading"></div>';
@@ -5973,7 +6101,7 @@ const PopsIframe = {
5973
6101
  $mask = handleMask.maskElement;
5974
6102
  $elList.push($mask);
5975
6103
  }
5976
- const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
6104
+ const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, emitter, $mask);
5977
6105
  // 赋值额外的$iframe参数
5978
6106
  evtConfig.$iframe = $iframe;
5979
6107
  const result = PopsHandler.handleResultConfig(evtConfig);
@@ -5998,16 +6126,14 @@ const PopsIframe = {
5998
6126
  });
5999
6127
  // 创建到页面中
6000
6128
  popsDOMUtils.append($shadowRoot, $elList);
6001
- if (typeof config.beforeAppendToPageCallBack === "function") {
6002
- config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
6003
- }
6129
+ emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
6004
6130
  $iframeContainer.appendChild($shadowContainer);
6005
6131
  if ($mask != null) {
6006
6132
  $anim.after($mask);
6007
6133
  }
6008
6134
  // 拖拽
6009
6135
  if (config.drag) {
6010
- PopsInstanceUtils.drag($pops, {
6136
+ PopsInstHandler.drag($pops, {
6011
6137
  dragElement: $title,
6012
6138
  limit: config.dragLimit,
6013
6139
  extraDistance: config.dragExtraDistance,
@@ -6038,6 +6164,7 @@ const PopsIframe = {
6038
6164
  if (typeof config?.btn?.min?.callback === "function") {
6039
6165
  config.btn.min.callback(evtConfig, event);
6040
6166
  }
6167
+ emitter.emit("pops:iframe-min", evtConfig, event);
6041
6168
  }, {
6042
6169
  capture: true,
6043
6170
  });
@@ -6067,6 +6194,7 @@ const PopsIframe = {
6067
6194
  if (typeof config?.btn?.max?.callback === "function") {
6068
6195
  config.btn.max.callback(evtConfig, event);
6069
6196
  }
6197
+ emitter.emit("pops:iframe-max", evtConfig, event);
6070
6198
  }, {
6071
6199
  capture: true,
6072
6200
  });
@@ -6104,6 +6232,7 @@ const PopsIframe = {
6104
6232
  if (typeof config?.btn?.mise?.callback === "function") {
6105
6233
  config.btn.mise.callback(evtConfig, event);
6106
6234
  }
6235
+ emitter.emit("pops:iframe-mise", evtConfig, event);
6107
6236
  }, {
6108
6237
  capture: true,
6109
6238
  });
@@ -6111,7 +6240,7 @@ const PopsIframe = {
6111
6240
  popsDOMUtils.on(headerCloseBtnElement, "click", async (event) => {
6112
6241
  event.preventDefault();
6113
6242
  event.stopPropagation();
6114
- await PopsInstanceUtils.removeInstance([PopsInstData.iframe], guid, false);
6243
+ await PopsInstHandler.removeInstance([PopsInstData.iframe], guid, false);
6115
6244
  if (typeof config?.btn?.close?.callback === "function") {
6116
6245
  config.btn.close.callback(evtConfig, event);
6117
6246
  }
@@ -6126,7 +6255,7 @@ const PopsIframe = {
6126
6255
  $shadowContainer: $shadowContainer,
6127
6256
  $shadowRoot: $shadowRoot,
6128
6257
  config: config,
6129
- destory: result.close,
6258
+ emitter,
6130
6259
  });
6131
6260
  return result;
6132
6261
  },
@@ -7004,6 +7133,7 @@ const PopsPanelDefaultConfig = () => {
7004
7133
  darkStyle: null,
7005
7134
  beforeAppendToPageCallBack() { },
7006
7135
  stopKeyDownEventPropagation: true,
7136
+ listenEscapeKeyUpToExitDeepMenu: true,
7007
7137
  };
7008
7138
  };
7009
7139
 
@@ -7127,13 +7257,15 @@ class ToolTip {
7127
7257
  $content: null,
7128
7258
  $arrow: null,
7129
7259
  };
7260
+ emitter;
7130
7261
  $data = {
7131
7262
  config: null,
7132
7263
  guid: null,
7133
7264
  timeId_close_TouchEvent: [],
7134
7265
  timeId_close_MouseEvent: [],
7135
7266
  };
7136
- constructor(config, guid, ShadowInfo) {
7267
+ constructor(config, guid, ShadowInfo, emitter) {
7268
+ this.emitter = emitter;
7137
7269
  this.$data.config = config;
7138
7270
  this.$data.guid = guid;
7139
7271
  this.$el.$shadowContainer = ShadowInfo.$shadowContainer;
@@ -7179,7 +7311,7 @@ class ToolTip {
7179
7311
  // 处理className
7180
7312
  popsDOMUtils.addClassName($toolTipContainer, this.$data.config.className);
7181
7313
  // 添加z-index
7182
- $toolTipContainer.style.zIndex = PopsHandler.handleZIndex(this.$data.config.zIndex).toString();
7314
+ $toolTipContainer.style.zIndex = PopsHandler.getTargerOrFunctionValue(this.$data.config.zIndex).toString();
7183
7315
  // 添加自定义style
7184
7316
  PopsElementHandler.addStyle($toolTipContainer, this.$data.config.style);
7185
7317
  // 添加自定义浅色style
@@ -7227,7 +7359,7 @@ class ToolTip {
7227
7359
  * 获取z-index
7228
7360
  */
7229
7361
  getZIndex() {
7230
- const zIndex = PopsHandler.handleZIndex(this.$data.config.zIndex);
7362
+ const zIndex = PopsHandler.getTargerOrFunctionValue(this.$data.config.zIndex);
7231
7363
  return zIndex;
7232
7364
  }
7233
7365
  /**
@@ -7410,9 +7542,7 @@ class ToolTip {
7410
7542
  }
7411
7543
  if (!popsUtils.contains(this.$el.$shadowContainer)) {
7412
7544
  // 页面不存在Shadow,添加
7413
- if (typeof this.$data.config.beforeAppendToPageCallBack === "function") {
7414
- this.$data.config.beforeAppendToPageCallBack(this.$el.$shadowRoot, this.$el.$shadowContainer);
7415
- }
7545
+ this.emitter.emit("pops:before-append-to-page", this.$el.$shadowRoot, this.$el.$shadowContainer);
7416
7546
  popsDOMUtils.append(document.body, this.$el.$shadowContainer);
7417
7547
  }
7418
7548
  // 更新内容
@@ -7583,6 +7713,7 @@ const PopsTooltip = {
7583
7713
  const guid = popsUtils.getRandomGUID();
7584
7714
  // 设置当前类型
7585
7715
  const popsType = "tooltip";
7716
+ const emitter = new EventEmiter(popsType);
7586
7717
  let config = PopsTooltipDefaultConfig();
7587
7718
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
7588
7719
  config = popsUtils.assign(config, __config__);
@@ -7621,7 +7752,7 @@ const PopsTooltip = {
7621
7752
  const toolTip = new ToolTip(config, guid, {
7622
7753
  $shadowContainer,
7623
7754
  $shadowRoot,
7624
- });
7755
+ }, emitter);
7625
7756
  if (config.alwaysShow) {
7626
7757
  // 总是显示
7627
7758
  // 直接显示
@@ -7633,6 +7764,7 @@ const PopsTooltip = {
7633
7764
  $shadowContainer,
7634
7765
  $shadowRoot,
7635
7766
  toolTip,
7767
+ emitter,
7636
7768
  };
7637
7769
  },
7638
7770
  };
@@ -7681,6 +7813,7 @@ const PanelHandlerComponents = () => {
7681
7813
  nodeStoreConfigKey: "data-view-config",
7682
7814
  },
7683
7815
  $config: {},
7816
+ emitter: null,
7684
7817
  /**
7685
7818
  * 初始化
7686
7819
  * @param data
@@ -7691,6 +7824,7 @@ const PanelHandlerComponents = () => {
7691
7824
  ...data.$el,
7692
7825
  };
7693
7826
  this.$config = data.config;
7827
+ this.emitter = data.emitter;
7694
7828
  this.asideULElement = this.$el.$panelLeftAside.querySelector(`ul.pops-${PopsType}-aside-top-container`);
7695
7829
  this.asideBottomULElement = this.$el.$panelLeftAside.querySelector(`ul.pops-${PopsType}-aside-bottom-container`);
7696
7830
  this.sectionContainerHeaderULElement = this.$el.$panelContentSectionContainer.querySelector(`ul.pops-${PopsType}-container-header-ul`);
@@ -8601,7 +8735,8 @@ const PanelHandlerComponents = () => {
8601
8735
  $target: this.$ele.button,
8602
8736
  content: getToolTipContent,
8603
8737
  zIndex: () => {
8604
- return PopsInstanceUtils.getPopsMaxZIndex().zIndex;
8738
+ // return PopsInstanceUtils.getPopsMaxZIndex().zIndex;
8739
+ return popsUtils.getMaxZIndexNodeInfoFromPoint(this.$ele.button)[0].zIndex;
8605
8740
  },
8606
8741
  isFixed: true,
8607
8742
  className: "github-tooltip",
@@ -11192,91 +11327,31 @@ const PanelHandlerComponents = () => {
11192
11327
  className: "pops-panel-deepMenu-container-left-arrow-icon",
11193
11328
  innerHTML: PopsIcon.getIcon("arrowLeft"),
11194
11329
  });
11195
- // 动画配置
11196
- const animOptions = {
11197
- // 150 220 300
11198
- duration: 220,
11199
- easing: "ease-in-out",
11200
- };
11201
- // 进入动画
11202
- const enterViewTransition = () => {
11203
- // 隐藏旧的容器
11204
- popsDOMUtils.cssHide($currentSection, true);
11205
- popsDOMUtils.on($headerLeftArrow, "click", async (event) => {
11206
- popsDOMUtils.preventEvent(event);
11207
- // 返回动画
11208
- const leaveViewTransition = () => {
11209
- const $prev = $currentSection;
11210
- popsDOMUtils.cssShow($prev);
11211
- $deepMenuSection.remove();
11212
- };
11213
- // 返回上一层菜单
11214
- if (that.$config.useDeepMenuSwtichAnimation && document.startViewTransition) {
11215
- const leaveTransition = document.startViewTransition(leaveViewTransition);
11216
- await leaveTransition.ready;
11217
- // 向右移出
11218
- await Promise.all([
11219
- $deepMenuSection.animate([
11220
- {
11221
- // from
11222
- transform: "translateX(0)",
11223
- },
11224
- {
11225
- // to
11226
- transform: "translateX(100%)",
11227
- },
11228
- ], animOptions).finished,
11229
- // 向右移入
11230
- $currentSection.animate([
11231
- {
11232
- // from
11233
- transform: "translateX(-100%)",
11234
- },
11235
- {
11236
- // to
11237
- transform: "translateX(0)",
11238
- },
11239
- ], animOptions).finished,
11240
- ]);
11241
- await leaveTransition.finished;
11242
- }
11243
- else {
11244
- leaveViewTransition();
11245
- }
11246
- that.emitRenderRightContainer($currentSection);
11247
- }, {
11248
- once: true,
11249
- });
11250
- popsDOMUtils.before($header.firstElementChild, $headerLeftArrow);
11251
- $deepMenuHeaderUL.appendChild($header);
11252
- $deepMenuSection.appendChild($deepMenuHeaderUL);
11253
- $deepMenuSection.appendChild($deepMenuMain);
11254
- if (viewConfig.views && Array.isArray(viewConfig.views)) {
11255
- for (let index = 0; index < viewConfig.views.length; index++) {
11256
- const formItemConfig = viewConfig.views[index];
11257
- this.initContainerItem($deepMenuMain, formItemConfig);
11330
+ const switchAnim = PopsAnimation.createSwitchElementWithAnimation($currentSection, $deepMenuSection, {
11331
+ useAnimation: that.$config.useDeepMenuSwtichAnimation,
11332
+ enterToAddElementCallback: () => {
11333
+ popsDOMUtils.on($headerLeftArrow, "click", async (event) => {
11334
+ popsDOMUtils.preventEvent(event);
11335
+ // 返回动画
11336
+ await switchAnim.exit();
11337
+ that.emitRenderRightContainer($currentSection);
11338
+ }, {
11339
+ once: true,
11340
+ });
11341
+ popsDOMUtils.before($header.firstElementChild, $headerLeftArrow);
11342
+ $deepMenuHeaderUL.appendChild($header);
11343
+ $deepMenuSection.appendChild($deepMenuHeaderUL);
11344
+ $deepMenuSection.appendChild($deepMenuMain);
11345
+ if (viewConfig.views && Array.isArray(viewConfig.views)) {
11346
+ for (let index = 0; index < viewConfig.views.length; index++) {
11347
+ const formItemConfig = viewConfig.views[index];
11348
+ this.initContainerItem($deepMenuMain, formItemConfig);
11349
+ }
11258
11350
  }
11259
- }
11260
- that.$el.$panelRightSectionWrapper.appendChild($deepMenuSection);
11261
- };
11262
- if (that.$config.useDeepMenuSwtichAnimation && document.startViewTransition) {
11263
- const transition = document.startViewTransition(enterViewTransition);
11264
- await transition.ready;
11265
- await $deepMenuSection.animate([
11266
- {
11267
- // from
11268
- transform: "translateX(100%)",
11269
- },
11270
- {
11271
- // to
11272
- transform: "translateX(0)",
11273
- },
11274
- ], animOptions).finished;
11275
- await transition.finished;
11276
- }
11277
- else {
11278
- enterViewTransition();
11279
- }
11351
+ that.$el.$panelRightSectionWrapper.appendChild($deepMenuSection);
11352
+ },
11353
+ });
11354
+ await switchAnim.enter();
11280
11355
  if (typeof viewConfig.afterEnterDeepMenuCallBack === "function") {
11281
11356
  viewConfig.afterEnterDeepMenuCallBack(viewConfig, {
11282
11357
  $sectionContainer: $deepMenuSection,
@@ -11448,11 +11523,9 @@ const PanelHandlerComponents = () => {
11448
11523
  */
11449
11524
  emitRenderRightContainer($container) {
11450
11525
  const dataViewConfig = Reflect.get($container, this.$data.nodeStoreConfigKey);
11451
- this.$el.$pops.dispatchEvent(new CustomEvent("pops:renderRightContainer", {
11452
- detail: {
11453
- viewConfig: dataViewConfig,
11454
- },
11455
- }));
11526
+ this.emitter.emit("pops:renderRightContainer", {
11527
+ viewConfig: dataViewConfig,
11528
+ });
11456
11529
  },
11457
11530
  /**
11458
11531
  *
@@ -11522,6 +11595,7 @@ const PopsPanel = {
11522
11595
  const guid = popsUtils.getRandomGUID();
11523
11596
  // 设置当前类型
11524
11597
  const popsType = "panel";
11598
+ const emitter = new EventEmiter(popsType);
11525
11599
  let config = PopsPanelDefaultConfig();
11526
11600
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
11527
11601
  config = popsUtils.assign(config, __config__);
@@ -11558,7 +11632,7 @@ const PopsPanel = {
11558
11632
  },
11559
11633
  ]);
11560
11634
  // 先把z-index提取出来
11561
- const zIndex = PopsHandler.handleZIndex(config.zIndex);
11635
+ const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
11562
11636
  const maskHTML = PopsElementHandler.createMask(guid, zIndex);
11563
11637
  const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
11564
11638
  const { headerStyle, headerPStyle } = PopsElementHandler.createHeaderStyle(popsType, config);
@@ -11616,15 +11690,13 @@ const PopsPanel = {
11616
11690
  $elList.push($mask);
11617
11691
  }
11618
11692
  // 处理返回的配置
11619
- const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
11693
+ const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, emitter, $mask);
11620
11694
  const result = PopsHandler.handleResultConfig(evtConfig);
11621
11695
  // 为顶部右边的关闭按钮添加点击事件
11622
11696
  PopsHandler.handleClickEvent("close", $headerBtnClose, evtConfig, config.btn?.close?.callback);
11623
11697
  // 创建到页面中
11624
11698
  popsDOMUtils.append($shadowRoot, $elList);
11625
- if (typeof config.beforeAppendToPageCallBack === "function") {
11626
- config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
11627
- }
11699
+ emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
11628
11700
  popsDOMUtils.appendBody($shadowContainer);
11629
11701
  // 追加遮罩层元素
11630
11702
  if ($mask != null) {
@@ -11647,6 +11719,7 @@ const PopsPanel = {
11647
11719
  $panelBottomLeftContainer,
11648
11720
  $panelBottomRightContainer,
11649
11721
  },
11722
+ emitter,
11650
11723
  });
11651
11724
  PopsHandler.handlePush(popsType, {
11652
11725
  guid: guid,
@@ -11656,11 +11729,11 @@ const PopsPanel = {
11656
11729
  $shadowContainer: $shadowContainer,
11657
11730
  $shadowRoot: $shadowRoot,
11658
11731
  config: config,
11659
- destory: result.close,
11732
+ emitter,
11660
11733
  });
11661
11734
  // 拖拽
11662
11735
  if (config.drag) {
11663
- PopsInstanceUtils.drag($pops, {
11736
+ PopsInstHandler.drag($pops, {
11664
11737
  dragElement: $title,
11665
11738
  limit: config.dragLimit,
11666
11739
  extraDistance: config.dragExtraDistance,
@@ -11668,15 +11741,21 @@ const PopsPanel = {
11668
11741
  endCallBack: config.dragEndCallBack,
11669
11742
  });
11670
11743
  }
11671
- return {
11672
- ...result,
11673
- addEventListener: (event, listener, options) => {
11674
- $pops.addEventListener(event, listener, options);
11675
- },
11676
- removeEventListener: (event, listener, options) => {
11677
- $pops.removeEventListener(event, listener, options);
11678
- },
11679
- };
11744
+ if (config.listenEscapeKeyUpToExitDeepMenu) {
11745
+ const escapeListener = popsDOMUtils.onKeyup(globalThis, (evt) => {
11746
+ if (evt.key === "Escape" && !evt.ctrlKey && !evt.shiftKey && !evt.altKey && !evt.metaKey) {
11747
+ // Esc
11748
+ const $exitBtn = $panelRightSectionWrapper.querySelector(".pops-panel-deepMenu-container-left-arrow-icon");
11749
+ if ($exitBtn) {
11750
+ $exitBtn.click();
11751
+ }
11752
+ }
11753
+ }, { capture: true });
11754
+ emitter.on("pops:before-destory", () => {
11755
+ escapeListener?.off();
11756
+ });
11757
+ }
11758
+ return result;
11680
11759
  },
11681
11760
  };
11682
11761
 
@@ -11780,6 +11859,7 @@ const PopsPrompt = {
11780
11859
  const guid = popsUtils.getRandomGUID();
11781
11860
  // 设置当前类型
11782
11861
  const popsType = "prompt";
11862
+ const emitter = new EventEmiter(popsType);
11783
11863
  let config = PopsPromptDefaultConfig();
11784
11864
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
11785
11865
  config = popsUtils.assign(config, __config__);
@@ -11816,7 +11896,7 @@ const PopsPrompt = {
11816
11896
  },
11817
11897
  ]);
11818
11898
  // 先把z-index提取出来
11819
- const zIndex = PopsHandler.handleZIndex(config.zIndex);
11899
+ const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
11820
11900
  const maskHTML = PopsElementHandler.createMask(guid, zIndex);
11821
11901
  const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
11822
11902
  const bottomBtnHTML = PopsElementHandler.createBottom(popsType, config);
@@ -11861,7 +11941,7 @@ const PopsPrompt = {
11861
11941
  $mask = handleMask.maskElement;
11862
11942
  $elList.push($mask);
11863
11943
  }
11864
- const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
11944
+ const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, emitter, $mask);
11865
11945
  const result = PopsHandler.handleResultConfig(evtConfig);
11866
11946
  // 输入框赋值初始值
11867
11947
  $input.value = config.content.text;
@@ -11871,9 +11951,7 @@ const PopsPrompt = {
11871
11951
  PopsHandler.handlePromptClickEvent("other", $input, $btnOther, evtConfig, config.btn.other.callback);
11872
11952
  // 创建到页面中
11873
11953
  popsDOMUtils.append($shadowRoot, $elList);
11874
- if (typeof config.beforeAppendToPageCallBack === "function") {
11875
- config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
11876
- }
11954
+ emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
11877
11955
  popsDOMUtils.appendBody($shadowContainer);
11878
11956
  if ($mask != null) {
11879
11957
  $anim.after($mask);
@@ -11886,11 +11964,11 @@ const PopsPrompt = {
11886
11964
  $shadowContainer: $shadowContainer,
11887
11965
  $shadowRoot: $shadowRoot,
11888
11966
  config: config,
11889
- destory: result.close,
11967
+ emitter,
11890
11968
  });
11891
11969
  // 拖拽
11892
11970
  if (config.drag) {
11893
- PopsInstanceUtils.drag($pops, {
11971
+ PopsInstHandler.drag($pops, {
11894
11972
  dragElement: $title,
11895
11973
  limit: config.dragLimit,
11896
11974
  extraDistance: config.dragExtraDistance,
@@ -12018,6 +12096,7 @@ const PopsRightClickMenu = {
12018
12096
  const guid = popsUtils.getRandomGUID();
12019
12097
  // 设置当前类型
12020
12098
  const popsType = "rightClickMenu";
12099
+ const emitter = new EventEmiter(popsType);
12021
12100
  let config = PopsRightClickMenuDefaultConfig();
12022
12101
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
12023
12102
  config = popsUtils.assign(config, __config__);
@@ -12146,13 +12225,14 @@ const PopsRightClickMenu = {
12146
12225
  guid: guid,
12147
12226
  $anim: rootElement,
12148
12227
  $pops: rootElement,
12149
- beforeRemoveCallBack(instCommonConfig) {
12150
- PopsContextMenu.closeAllMenu(instCommonConfig.$pops);
12151
- },
12152
12228
  config: config,
12153
- destory: () => {
12154
- PopsContextMenu.closeAllMenu(rootElement);
12155
- },
12229
+ emitter,
12230
+ });
12231
+ emitter.on("pops:before-destory", () => {
12232
+ PopsContextMenu.closeAllMenu(rootElement);
12233
+ });
12234
+ emitter.on("pops:destory", () => {
12235
+ PopsContextMenu.closeAllMenu(rootElement);
12156
12236
  });
12157
12237
  }
12158
12238
  },
@@ -12240,6 +12320,7 @@ const PopsRightClickMenu = {
12240
12320
  });
12241
12321
  const zIndex = this.getMenuZIndex();
12242
12322
  if (zIndex > 10000) {
12323
+ // 大于默认值
12243
12324
  $menu.style.zIndex = zIndex.toString();
12244
12325
  }
12245
12326
  if (isChildren) {
@@ -12260,7 +12341,7 @@ const PopsRightClickMenu = {
12260
12341
  * 动态获取配的z-index
12261
12342
  */
12262
12343
  getMenuZIndex() {
12263
- return PopsHandler.handleZIndex(config.zIndex);
12344
+ return PopsHandler.getTargerOrFunctionValue(config.zIndex);
12264
12345
  },
12265
12346
  /**
12266
12347
  * 获取left、top偏移
@@ -12374,9 +12455,7 @@ const PopsRightClickMenu = {
12374
12455
  popsDOMUtils.append($shadowRoot, menuElement);
12375
12456
  // 判断容器是否存在
12376
12457
  if (!document.contains($shadowContainer)) {
12377
- if (typeof config.beforeAppendToPageCallBack === "function") {
12378
- config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
12379
- }
12458
+ emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
12380
12459
  popsDOMUtils.appendBody($shadowContainer);
12381
12460
  }
12382
12461
  this.handlerShowMenuCSS(menuElement, menuEvent);
@@ -12651,6 +12730,7 @@ const PopsSearchSuggestion = {
12651
12730
  const guid = popsUtils.getRandomGUID();
12652
12731
  // 设置当前类型
12653
12732
  const popsType = "searchSuggestion";
12733
+ const emitter = new EventEmiter(popsType);
12654
12734
  let config = PopsSearchSuggestionDefaultConfig();
12655
12735
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
12656
12736
  config = popsUtils.assign(config, __config__);
@@ -12687,6 +12767,7 @@ const PopsSearchSuggestion = {
12687
12767
  passive: true,
12688
12768
  };
12689
12769
  const SearchSuggestion = {
12770
+ emitter: emitter,
12690
12771
  /**
12691
12772
  * 当前的环境,可以是document,可以是shadowroot,默认是document
12692
12773
  */
@@ -12902,7 +12983,7 @@ const PopsSearchSuggestion = {
12902
12983
  border: initial;
12903
12984
  overflow: initial;
12904
12985
  position: ${config.isAbsolute ? "absolute" : "fixed"};
12905
- z-index: ${PopsHandler.handleZIndex(config.zIndex)};
12986
+ z-index: ${PopsHandler.getTargerOrFunctionValue(config.zIndex)};
12906
12987
  }
12907
12988
  .pops-${popsType}-search-suggestion-dropdown-wrapper{
12908
12989
  max-height: ${config.maxHeight};
@@ -13425,7 +13506,87 @@ const PopsSearchSuggestion = {
13425
13506
  },
13426
13507
  };
13427
13508
 
13428
- const version = "3.3.5";
13509
+ const PopsInstanceUtils = {
13510
+ /**
13511
+ * 获取pops所有弹窗中的最大的z-index
13512
+ * @param deviation
13513
+ */
13514
+ getPopsMaxZIndex(deviation = 1) {
13515
+ deviation = Number.isNaN(deviation) ? 1 : deviation;
13516
+ // 最大值 2147483647
13517
+ // const browserMaxZIndex = Math.pow(2, 31) - 1;
13518
+ // 比较值 2000000000
13519
+ const maxZIndex = 2 * Math.pow(10, 9);
13520
+ // 当前页面最大的z-index
13521
+ let zIndex = 0;
13522
+ // 当前的最大z-index的元素,调试使用
13523
+ let maxZIndexNode = null;
13524
+ Object.keys(PopsInstData).forEach((instKeyName) => {
13525
+ const instData = PopsInstData[instKeyName];
13526
+ for (let index = 0; index < instData.length; index++) {
13527
+ const inst = instData[index];
13528
+ // 不对position为static和display为none的元素进行获取它们的z-index
13529
+ const $elList = [inst.$anim, inst.$pops, inst.$mask].filter((it) => it instanceof HTMLElement);
13530
+ const nodeZIndexInfoList = popsUtils.getMaxZIndexNodeInfoFromPoint($elList);
13531
+ const maxNodeZIndexInfo = nodeZIndexInfoList[0];
13532
+ if (maxNodeZIndexInfo) {
13533
+ const nodeZIndex = maxNodeZIndexInfo.zIndex;
13534
+ if (nodeZIndex > zIndex) {
13535
+ zIndex = nodeZIndex;
13536
+ maxZIndexNode = maxNodeZIndexInfo.node || maxNodeZIndexInfo.positionNode;
13537
+ }
13538
+ }
13539
+ }
13540
+ });
13541
+ zIndex += deviation;
13542
+ const isOverMaxZIndex = zIndex >= maxZIndex;
13543
+ if (isOverMaxZIndex) {
13544
+ // 超出z-index最大值
13545
+ zIndex = maxZIndex;
13546
+ }
13547
+ return { zIndex: zIndex, animElement: maxZIndexNode, isOverMaxZIndex };
13548
+ },
13549
+ /**
13550
+ * 排序数组
13551
+ * @param getBeforeValueFun
13552
+ * @param getAfterValueFun
13553
+ * @param sortByDesc 排序是否降序,默认降序
13554
+ */
13555
+ sortElementListByProperty(getBeforeValueFun, getAfterValueFun, sortByDesc = true) {
13556
+ if (typeof sortByDesc !== "boolean") {
13557
+ throw new TypeError("参数 sortByDesc 必须为boolean类型");
13558
+ }
13559
+ if (getBeforeValueFun == null || getAfterValueFun == null) {
13560
+ throw new Error("获取前面的值或后面的值的方法不能为空");
13561
+ }
13562
+ return function (after_obj, before_obj) {
13563
+ const beforeValue = getBeforeValueFun(before_obj); // 前
13564
+ const afterValue = getAfterValueFun(after_obj); // 后
13565
+ if (sortByDesc) {
13566
+ if (afterValue > beforeValue) {
13567
+ return -1;
13568
+ }
13569
+ else if (afterValue < beforeValue) {
13570
+ return 1;
13571
+ }
13572
+ else {
13573
+ return 0;
13574
+ }
13575
+ }
13576
+ else {
13577
+ if (afterValue < beforeValue) {
13578
+ return -1;
13579
+ }
13580
+ else if (afterValue > beforeValue) {
13581
+ return 1;
13582
+ }
13583
+ else {
13584
+ return 0;
13585
+ }
13586
+ }
13587
+ };
13588
+ },
13589
+ };
13429
13590
 
13430
13591
  class Pops {
13431
13592
  /** 配置 */
@@ -13454,7 +13615,11 @@ class Pops {
13454
13615
  /** pops处理float类型使用的工具类 */
13455
13616
  MathFloatUtils: PopsMathFloatUtils,
13456
13617
  /** pops.panel中用于处理各个类型的工具 */
13457
- PanelHandlerComponents: PanelHandlerComponents,
13618
+ PanelHandlerComponents,
13619
+ /** pops.panel中的动画 */
13620
+ PopsAnimation,
13621
+ /** 事件类 */
13622
+ EventEmiter,
13458
13623
  };
13459
13624
  init() { }
13460
13625
  /**