@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.cjs.js CHANGED
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ const version = "4.0.1";
4
+
3
5
  const GlobalConfig = {
4
6
  config: {},
5
7
  /**
@@ -26,18 +28,21 @@ const GlobalConfig = {
26
28
  }
27
29
  else if (keyName === "zIndex") {
28
30
  // 设置zIndex属性
29
- let zIndex = configValue == null ? "" : typeof configValue === "function" ? configValue() : configValue;
30
- if (typeof zIndex === "string") {
31
- const newIndex = (zIndex = Number(zIndex));
32
- if (!isNaN(newIndex)) {
33
- result.zIndex = newIndex;
31
+ result.zIndex = () => {
32
+ let zIndex = configValue == null ? "" : typeof configValue === "function" ? configValue() : configValue;
33
+ if (typeof zIndex === "string") {
34
+ const newIndex = (zIndex = Number(zIndex));
35
+ if (!Number.isNaN(newIndex)) {
36
+ return newIndex;
37
+ }
34
38
  }
35
- }
36
- else {
37
- if (!isNaN(zIndex)) {
38
- result.zIndex = zIndex;
39
+ else {
40
+ if (!Number.isNaN(zIndex)) {
41
+ return zIndex;
42
+ }
39
43
  }
40
- }
44
+ return 0;
45
+ };
41
46
  }
42
47
  else if (keyName === "mask") {
43
48
  const mask = GlobalConfig.config.mask == null ? {} : GlobalConfig.config.mask;
@@ -53,6 +58,72 @@ const GlobalConfig = {
53
58
  },
54
59
  };
55
60
 
61
+ class EventEmiter {
62
+ #type;
63
+ #data = new Map();
64
+ constructor(type) {
65
+ this.#type = type;
66
+ }
67
+ on(eventName, callback) {
68
+ const eventList = this.#data.get(eventName) ?? [];
69
+ eventList.push({ type: this.#type, time: Date.now(), callback: callback });
70
+ this.#data.set(eventName, eventList);
71
+ return {
72
+ off: () => {
73
+ this.off(eventName, callback);
74
+ },
75
+ emit: (...args) => {
76
+ this.emit(eventName, ...args);
77
+ },
78
+ };
79
+ }
80
+ off(eventName, callback) {
81
+ const eventList = this.#data.get(eventName) ?? [];
82
+ let isOffSuccess = false;
83
+ for (let index = eventList.length - 1; index >= 0; index--) {
84
+ if (eventList[index].callback === callback) {
85
+ isOffSuccess = true;
86
+ eventList.splice(index, 1);
87
+ }
88
+ }
89
+ if (eventList.length === 0) {
90
+ // empty
91
+ this.#data.delete(eventName);
92
+ }
93
+ else {
94
+ if (isOffSuccess) {
95
+ // update
96
+ this.#data.set(eventName, eventList);
97
+ }
98
+ }
99
+ }
100
+ async emit(eventName, ...args) {
101
+ const eventList = this.#data.get(eventName) ?? [];
102
+ for (const item of eventList) {
103
+ await item.callback(...args);
104
+ }
105
+ }
106
+ offAll(eventName) {
107
+ if (typeof eventName === "string") {
108
+ this.#data.delete(eventName);
109
+ }
110
+ else {
111
+ this.#data.clear();
112
+ }
113
+ }
114
+ /**
115
+ * 获取所有添加的事件
116
+ */
117
+ getAllEvents(eventName) {
118
+ if (typeof eventName === "string") {
119
+ return this.#data.get(eventName);
120
+ }
121
+ else {
122
+ return Array.from(this.#data.values());
123
+ }
124
+ }
125
+ }
126
+
56
127
  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";
57
128
 
58
129
  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";
@@ -253,6 +324,16 @@ function e(e){e.use(r$2,{name:"doubletap",tapTimes:2});const a=e.get("doubletap"
253
324
  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;
254
325
 
255
326
  class PopsUtils {
327
+ /**
328
+ * 超时时间
329
+ */
330
+ sleep(timeout) {
331
+ return new Promise((resolve) => {
332
+ setTimeout(() => {
333
+ resolve(true);
334
+ }, timeout);
335
+ });
336
+ }
256
337
  /**
257
338
  * 判断是否是window,例如window、self、globalThis
258
339
  * @param target
@@ -544,6 +625,127 @@ class PopsUtils {
544
625
  }
545
626
  target[key] = newArr;
546
627
  }
628
+ getMaxZIndexNodeInfoFromPoint($el, deviation) {
629
+ if (typeof $el === "function") {
630
+ $el = $el();
631
+ }
632
+ if (typeof $el === "number") {
633
+ deviation = $el;
634
+ $el = void 0;
635
+ }
636
+ if (typeof deviation !== "number" || Number.isNaN(deviation)) {
637
+ deviation = 10;
638
+ }
639
+ const leftTop = {
640
+ x: globalThis.innerWidth * (1 / 8),
641
+ y: globalThis.innerHeight * (1 / 8),
642
+ };
643
+ const leftBottom = {
644
+ x: globalThis.innerWidth * (1 / 8),
645
+ y: globalThis.innerHeight * (7 / 8),
646
+ };
647
+ const rightTop = {
648
+ x: globalThis.innerWidth * (7 / 8),
649
+ y: globalThis.innerHeight * (1 / 8),
650
+ };
651
+ const rightBottom = {
652
+ x: globalThis.innerWidth * (7 / 8),
653
+ y: globalThis.innerHeight * (7 / 8),
654
+ };
655
+ const center = {
656
+ x: globalThis.innerWidth / 2,
657
+ y: globalThis.innerHeight / 2,
658
+ };
659
+ const delayHandlerElementPostionList = [
660
+ leftTop,
661
+ leftBottom,
662
+ rightTop,
663
+ rightBottom,
664
+ center,
665
+ ];
666
+ if ($el) {
667
+ delayHandlerElementPostionList.length = 0;
668
+ if (Array.isArray($el)) {
669
+ delayHandlerElementPostionList.push(...$el);
670
+ }
671
+ else {
672
+ delayHandlerElementPostionList.push($el);
673
+ }
674
+ }
675
+ const positionInfoList = delayHandlerElementPostionList
676
+ .map((position) => {
677
+ let positionNode;
678
+ let positionX;
679
+ let positionY;
680
+ if (position instanceof HTMLElement) {
681
+ positionNode = position;
682
+ const nodeRect = position.getBoundingClientRect();
683
+ positionX = nodeRect.x + nodeRect.width / 2;
684
+ positionY = nodeRect.y + nodeRect.height / 2;
685
+ }
686
+ else {
687
+ positionNode = document.elementFromPoint(position.x, position.y);
688
+ positionX = position.x;
689
+ positionY = position.y;
690
+ }
691
+ const shadowRoot = positionNode?.shadowRoot;
692
+ if (shadowRoot) {
693
+ positionNode = shadowRoot.elementFromPoint(positionX, positionY);
694
+ }
695
+ if (positionNode instanceof HTMLStyleElement)
696
+ return;
697
+ if (positionNode instanceof HTMLScriptElement)
698
+ return;
699
+ if (positionNode instanceof HTMLMetaElement)
700
+ return;
701
+ if (positionNode instanceof HTMLHeadElement)
702
+ return;
703
+ if (!(positionNode instanceof HTMLElement))
704
+ return;
705
+ let parent = positionNode;
706
+ let zIndex = 0;
707
+ let maxZIndexNode = null;
708
+ while (parent) {
709
+ const nodeStyle = globalThis.getComputedStyle(parent);
710
+ const nodeZIndex = parseInt(nodeStyle.zIndex);
711
+ if (nodeStyle.position !== "static" && !isNaN(nodeZIndex)) {
712
+ if (nodeZIndex > zIndex) {
713
+ zIndex = nodeZIndex;
714
+ maxZIndexNode = parent;
715
+ }
716
+ }
717
+ parent = parent.parentElement;
718
+ }
719
+ return {
720
+ /** 处理了偏移量后的z-index值 */
721
+ zIndex: zIndex + deviation,
722
+ /** 原始z-index值 */
723
+ originZIndex: zIndex,
724
+ /** 拥有最大z-index的元素 */
725
+ node: maxZIndexNode,
726
+ /** 目标坐标元素 */
727
+ positionNode: positionNode,
728
+ /** x坐标 */
729
+ positionX: positionX,
730
+ /** y坐标 */
731
+ positionY: positionY,
732
+ };
733
+ })
734
+ .filter((it) => it != null);
735
+ // 降序排序
736
+ positionInfoList.sort((a, b) => {
737
+ if (a.zIndex < b.zIndex) {
738
+ return 1;
739
+ }
740
+ else if (a.zIndex > b.zIndex) {
741
+ return -1;
742
+ }
743
+ else {
744
+ return 0;
745
+ }
746
+ });
747
+ return positionInfoList;
748
+ }
547
749
  }
548
750
  const popsUtils = new PopsUtils();
549
751
 
@@ -834,16 +1036,6 @@ class PopsDOMUtilsEvent {
834
1036
  // 这是存在selector的情况
835
1037
  listenerOption = getOption(args, 4, listenerOption);
836
1038
  }
837
- // 是否移除所有事件
838
- let isRemoveAll = false;
839
- if (args.length === 2) {
840
- // 目标函数、事件名
841
- isRemoveAll = true;
842
- }
843
- else if ((args.length === 3 && typeof args[2] === "string") || Array.isArray(args[2])) {
844
- // 目标函数、事件名、子元素选择器
845
- isRemoveAll = true;
846
- }
847
1039
  if (args.length === 5 && typeof args[4] === "function" && typeof filter !== "function") {
848
1040
  // 目标函数、事件名、回调函数、事件配置、过滤函数
849
1041
  filter = option;
@@ -873,7 +1065,7 @@ class PopsDOMUtilsEvent {
873
1065
  // 事件的配置项不同
874
1066
  flag = false;
875
1067
  }
876
- if (flag || isRemoveAll) {
1068
+ if (flag) {
877
1069
  elementItem.removeEventListener(eventName, handler.callback, handler.option);
878
1070
  const findIndex = handlers.findIndex((item) => item === handler);
879
1071
  if (findIndex !== -1) {
@@ -1265,31 +1457,6 @@ class PopsDOMUtilsEvent {
1265
1457
  const listener = this.on(target, "keydown", handler, option);
1266
1458
  return listener;
1267
1459
  }
1268
- /**
1269
- * 当按键按下时触发事件
1270
- * keydown - > keypress - > keyup
1271
- * @param target 目标
1272
- * @param handler 事件处理函数
1273
- * @param option 配置
1274
- * @example
1275
- * // 监听a.xx元素的按键按下
1276
- * DOMUtils.keypress(document.querySelector("a.xx"),()=>{
1277
- * console.log("按键按下");
1278
- * })
1279
- * DOMUtils.keypress("a.xx",()=>{
1280
- * console.log("按键按下");
1281
- * })
1282
- */
1283
- onKeypress(target, handler, option) {
1284
- if (target == null) {
1285
- return;
1286
- }
1287
- if (typeof target === "string") {
1288
- target = this.selector(target);
1289
- }
1290
- const listener = this.on(target, "keypress", handler, option);
1291
- return listener;
1292
- }
1293
1460
  preventEvent(...args) {
1294
1461
  /**
1295
1462
  * 阻止事件的默认行为发生,并阻止事件传播
@@ -2460,7 +2627,7 @@ const PopsElementHandler = {
2460
2627
  const popsPosition = __config__.position || "";
2461
2628
  if (config.zIndex != null) {
2462
2629
  popsAnimStyle += `z-index: ${zIndex};`;
2463
- popsStyle += `z-index: ${zIndex};`;
2630
+ // popsStyle += `z-index: ${zIndex};`;
2464
2631
  }
2465
2632
  if (__config__.width != null) {
2466
2633
  popsStyle += `width: ${__config__.width};`;
@@ -2469,11 +2636,15 @@ const PopsElementHandler = {
2469
2636
  popsStyle += `height: ${__config__.height};`;
2470
2637
  }
2471
2638
  const hasBottomBtn = bottomBtnHTML.trim() === "" ? false : true;
2639
+ const popsClassNameList = ["pops"];
2640
+ if (config.class) {
2641
+ popsClassNameList.push(...config.class.split(" "));
2642
+ }
2472
2643
  return /*html*/ `
2473
2644
  <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>` : ""}
2474
2645
  ${config.lightStyle != null ? /*html*/ `<style tyle="text/css" data-name="lightStyle">@media (prefers-color-scheme: light) {${config.lightStyle}}</style>` : ""}
2475
2646
  ${config.darkStyle != null ? /*html*/ `<style tyle="text/css" data-name="darkStyle">@media (prefers-color-scheme: dark) {${config.darkStyle}}</style>` : ""}
2476
- <div class="pops ${config.class || ""}" data-bottom-btn="${hasBottomBtn}" type-value="${type}" style="${popsStyle}" position="${popsPosition}" data-guid="${guid}">${html}</div>
2647
+ <div class="${popsClassNameList.join(" ")}" data-bottom-btn="${hasBottomBtn}" type-value="${type}" style="${popsStyle}" position="${popsPosition}" data-guid="${guid}">${html}</div>
2477
2648
  </div>`;
2478
2649
  },
2479
2650
  /**
@@ -2713,7 +2884,7 @@ const PopsElementHandler = {
2713
2884
  addLightStyle($parent, style) {
2714
2885
  const darkCSS = /*css*/ `
2715
2886
  @media (prefers-color-scheme: light) {
2716
- ${style}
2887
+ ${style ?? ""}
2717
2888
  }
2718
2889
  `;
2719
2890
  const $css = this.addStyle($parent, darkCSS);
@@ -2729,7 +2900,7 @@ const PopsElementHandler = {
2729
2900
  addDarkStyle($parent, style) {
2730
2901
  const darkCSS = /*css*/ `
2731
2902
  @media (prefers-color-scheme: dark) {
2732
- ${style}
2903
+ ${style ?? ""}
2733
2904
  }
2734
2905
  `;
2735
2906
  const $css = this.addStyle($parent, darkCSS);
@@ -2741,7 +2912,7 @@ const PopsElementHandler = {
2741
2912
  },
2742
2913
  };
2743
2914
 
2744
- 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";
2915
+ 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";
2745
2916
 
2746
2917
  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";
2747
2918
 
@@ -2839,6 +3010,105 @@ const PopsAnimation = {
2839
3010
  hasAnim(name) {
2840
3011
  return Object.prototype.hasOwnProperty.call(this.$data, name);
2841
3012
  },
3013
+ /**
3014
+ * 带动画的进入元素
3015
+ * @param $el 当前元素
3016
+ * @param $next 切换的元素
3017
+ * @param option 配置
3018
+ */
3019
+ createSwitchElementWithAnimation($el, $next, option) {
3020
+ const animOptions = {
3021
+ // 150 220 300
3022
+ duration: 220,
3023
+ easing: "ease-in-out",
3024
+ ...(option.animOptions ?? {}),
3025
+ };
3026
+ if (option.useAnimation == null) {
3027
+ option.useAnimation = true;
3028
+ }
3029
+ return {
3030
+ /**
3031
+ * 进入
3032
+ */
3033
+ async enter() {
3034
+ const transitionEndCallback = async () => {
3035
+ // 先直接隐藏旧的容器
3036
+ popsDOMUtils.cssHide($el, true);
3037
+ // 添加元素
3038
+ await option.enterToAddElementCallback();
3039
+ };
3040
+ // 进入下一层
3041
+ if (option.useAnimation && typeof document.startViewTransition == "function") {
3042
+ // 处理添加的元素的动画
3043
+ const transition = document.startViewTransition(transitionEndCallback);
3044
+ await transition.ready;
3045
+ await $next.animate(
3046
+ // 从右向左移入(进入动画)
3047
+ [
3048
+ {
3049
+ // from
3050
+ transform: "translateX(100%)",
3051
+ },
3052
+ {
3053
+ // to
3054
+ transform: "translateX(0)",
3055
+ },
3056
+ ], animOptions).finished;
3057
+ await transition.finished;
3058
+ }
3059
+ else {
3060
+ await transitionEndCallback();
3061
+ }
3062
+ },
3063
+ /**
3064
+ * 退出
3065
+ */
3066
+ async exit() {
3067
+ // 返回上一层菜单
3068
+ const transitionEndCallback = async () => {
3069
+ // 显示上层菜单
3070
+ popsDOMUtils.cssShow($el);
3071
+ // 移除下一层的菜单
3072
+ $next.remove();
3073
+ if (typeof option.exitToRemoveElementCallback === "function") {
3074
+ await option.exitToRemoveElementCallback();
3075
+ }
3076
+ };
3077
+ if (option.useAnimation && typeof document.startViewTransition == "function") {
3078
+ const leaveTransition = document.startViewTransition(transitionEndCallback);
3079
+ await leaveTransition.ready;
3080
+ await Promise.all([
3081
+ // 从原位置向右移出
3082
+ $next.animate([
3083
+ {
3084
+ // from
3085
+ transform: "translateX(0)",
3086
+ },
3087
+ {
3088
+ // to
3089
+ transform: "translateX(100%)",
3090
+ },
3091
+ ], animOptions).finished,
3092
+ // 从最左边向右移入
3093
+ $el.animate([
3094
+ {
3095
+ // from
3096
+ transform: "translateX(-100%)",
3097
+ },
3098
+ {
3099
+ // to
3100
+ transform: "translateX(0)",
3101
+ },
3102
+ ], animOptions).finished,
3103
+ ]);
3104
+ await leaveTransition.finished;
3105
+ }
3106
+ else {
3107
+ await transitionEndCallback();
3108
+ }
3109
+ },
3110
+ };
3111
+ },
2842
3112
  };
2843
3113
 
2844
3114
  /**
@@ -2858,137 +3128,7 @@ const PopsInstData = {
2858
3128
  tooltip: [],
2859
3129
  };
2860
3130
 
2861
- const PopsInstanceUtils = {
2862
- /**
2863
- * 获取页面中最大的z-index的元素信息
2864
- * @param deviation 获取最大的z-index值的偏移,默认是+1
2865
- * @param node 进行判断的元素,默认是document
2866
- * @param ignoreCallBack 执行元素处理时调用的函数,返回false可忽略不想要处理的元素
2867
- * @example
2868
- * Utils.getMaxZIndexNodeInfo();
2869
- * > {
2870
- * node: ...,
2871
- * zIndex: 1001
2872
- * }
2873
- **/
2874
- getMaxZIndexNodeInfo(deviation = 1, target = PopsCore.document, ignoreCallBack) {
2875
- deviation = Number.isNaN(deviation) ? 1 : deviation;
2876
- // 最大值 2147483647
2877
- // const maxZIndex = Math.pow(2, 31) - 1;
2878
- // 比较值 2000000000
2879
- const maxZIndexCompare = 2 * Math.pow(10, 9);
2880
- // 当前页面最大的z-index
2881
- let zIndex = 0;
2882
- // 当前的最大z-index的元素,调试使用
2883
- let maxZIndexNode = null;
2884
- /**
2885
- * 元素是否可见
2886
- * @param $css
2887
- */
2888
- function isVisibleNode($css) {
2889
- return $css.position !== "static" && $css.display !== "none";
2890
- }
2891
- /**
2892
- * 查询元素的z-index
2893
- * 并比较值是否是已获取的最大值
2894
- * @param $ele
2895
- */
2896
- function queryMaxZIndex($ele) {
2897
- if (typeof ignoreCallBack === "function") {
2898
- const ignoreResult = ignoreCallBack($ele);
2899
- if (typeof ignoreResult === "boolean" && !ignoreResult) {
2900
- return;
2901
- }
2902
- }
2903
- /** 元素的样式 */
2904
- const nodeStyle = PopsCore.window.getComputedStyle($ele);
2905
- // 不对position为static和display为none的元素进行获取它们的z-index
2906
- if (isVisibleNode(nodeStyle)) {
2907
- const nodeZIndex = parseInt(nodeStyle.zIndex);
2908
- if (!isNaN(nodeZIndex)) {
2909
- if (nodeZIndex > zIndex) {
2910
- // 赋值到全局
2911
- zIndex = nodeZIndex;
2912
- maxZIndexNode = $ele;
2913
- }
2914
- }
2915
- // 判断shadowRoot
2916
- if ($ele.shadowRoot != null && $ele instanceof ShadowRoot) {
2917
- $ele.shadowRoot.querySelectorAll("*").forEach(($shadowEle) => {
2918
- queryMaxZIndex($shadowEle);
2919
- });
2920
- }
2921
- }
2922
- }
2923
- target.querySelectorAll("*").forEach(($ele) => {
2924
- queryMaxZIndex($ele);
2925
- });
2926
- zIndex += deviation;
2927
- if (zIndex >= maxZIndexCompare) {
2928
- // 最好不要超过最大值
2929
- zIndex = maxZIndexCompare;
2930
- }
2931
- return {
2932
- node: maxZIndexNode,
2933
- zIndex: zIndex,
2934
- };
2935
- },
2936
- /**
2937
- * 获取pops所有弹窗中的最大的z-index
2938
- * @param deviation
2939
- */
2940
- getPopsMaxZIndex(deviation = 1) {
2941
- deviation = Number.isNaN(deviation) ? 1 : deviation;
2942
- // 最大值 2147483647
2943
- // const browserMaxZIndex = Math.pow(2, 31) - 1;
2944
- // 比较值 2000000000
2945
- const maxZIndex = 2 * Math.pow(10, 9);
2946
- // 当前页面最大的z-index
2947
- let zIndex = 0;
2948
- // 当前的最大z-index的元素,调试使用
2949
- let maxZIndexNode = null;
2950
- /**
2951
- * 元素是否可见
2952
- * @param $css
2953
- */
2954
- function isVisibleNode($css) {
2955
- return $css.position !== "static" && $css.display !== "none";
2956
- }
2957
- Object.keys(PopsInstData).forEach((instKeyName) => {
2958
- const instData = PopsInstData[instKeyName];
2959
- for (let index = 0; index < instData.length; index++) {
2960
- const inst = instData[index];
2961
- const nodeStyle = window.getComputedStyle(inst.$anim);
2962
- // 不对position为static和display为none的元素进行获取它们的z-index
2963
- if (isVisibleNode(nodeStyle)) {
2964
- const nodeZIndex = parseInt(nodeStyle.zIndex);
2965
- if (!isNaN(nodeZIndex)) {
2966
- if (nodeZIndex > zIndex) {
2967
- zIndex = nodeZIndex;
2968
- maxZIndexNode = inst.$anim;
2969
- }
2970
- }
2971
- }
2972
- }
2973
- });
2974
- zIndex += deviation;
2975
- const isOverMaxZIndex = zIndex >= maxZIndex;
2976
- if (isOverMaxZIndex) {
2977
- // 超出z-index最大值
2978
- zIndex = maxZIndex;
2979
- }
2980
- return { zIndex: zIndex, animElement: maxZIndexNode, isOverMaxZIndex };
2981
- },
2982
- /**
2983
- * 获取页面中最大的z-index
2984
- * @param deviation 获取最大的z-index值的偏移,默认是+1
2985
- * @example
2986
- * getMaxZIndex();
2987
- * > 1001
2988
- **/
2989
- getMaxZIndex(deviation = 1) {
2990
- return this.getMaxZIndexNodeInfo(deviation).zIndex;
2991
- },
3131
+ const PopsInstHandler = {
2992
3132
  /**
2993
3133
  * 删除配置中对应的对象
2994
3134
  * @param totalInstConfigList 配置实例列表
@@ -3000,21 +3140,21 @@ const PopsInstanceUtils = {
3000
3140
  * 移除元素实例
3001
3141
  * @param instCommonConfig
3002
3142
  */
3003
- const removeInst = function (instCommonConfig) {
3004
- if (typeof instCommonConfig.beforeRemoveCallBack === "function") {
3005
- // 调用移除签的回调
3006
- instCommonConfig.beforeRemoveCallBack(instCommonConfig);
3007
- }
3143
+ const removeInst = async (instCommonConfig) => {
3144
+ await instCommonConfig.emitter.emit("pops:before-destory", instCommonConfig);
3008
3145
  instCommonConfig?.$anim?.remove();
3009
3146
  instCommonConfig?.$pops?.remove();
3010
3147
  instCommonConfig?.$mask?.remove();
3011
3148
  instCommonConfig?.$shadowContainer?.remove();
3149
+ await instCommonConfig.emitter.emit("pops:destory");
3150
+ // 再清空全部监听的事件
3151
+ await instCommonConfig.emitter.offAll();
3012
3152
  };
3013
3153
  const asyncInstTask = [];
3014
3154
  // [ inst[], inst[],...]
3015
- totalInstConfigList.forEach((instConfigList) => {
3016
- // inst[]
3017
- instConfigList.forEach(async (instConfigItem, index) => {
3155
+ for (const instConfigList of totalInstConfigList) {
3156
+ for (let index = 0; index < instConfigList.length; index++) {
3157
+ const instConfigItem = instConfigList[index];
3018
3158
  // 移除全部或者guid相同
3019
3159
  if (isAll || (typeof guid === "string" && instConfigItem.guid === guid)) {
3020
3160
  // 判断是否有动画
@@ -3026,8 +3166,8 @@ const PopsInstanceUtils = {
3026
3166
  popsDOMUtils.css(instConfigItem.$anim, "animation-name", reverseAnimName);
3027
3167
  if (PopsAnimation.hasAnim(popsDOMUtils.css(instConfigItem.$anim, "animation-name"))) {
3028
3168
  asyncInstTask.push(new Promise((resolve) => {
3029
- popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), function () {
3030
- removeInst(instConfigItem);
3169
+ popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), async () => {
3170
+ await removeInst(instConfigItem);
3031
3171
  resolve();
3032
3172
  }, {
3033
3173
  capture: true,
@@ -3035,16 +3175,17 @@ const PopsInstanceUtils = {
3035
3175
  }));
3036
3176
  }
3037
3177
  else {
3038
- removeInst(instConfigItem);
3178
+ asyncInstTask.push(removeInst(instConfigItem));
3039
3179
  }
3040
3180
  }
3041
3181
  else {
3042
- removeInst(instConfigItem);
3182
+ asyncInstTask.push(removeInst(instConfigItem));
3043
3183
  }
3044
3184
  instConfigList.splice(index, 1);
3185
+ index--;
3045
3186
  }
3046
- });
3047
- });
3187
+ }
3188
+ }
3048
3189
  await Promise.all(asyncInstTask);
3049
3190
  return totalInstConfigList;
3050
3191
  },
@@ -3058,61 +3199,72 @@ const PopsInstanceUtils = {
3058
3199
  * @param $mask
3059
3200
  */
3060
3201
  hide(config, popsType, instConfigList, guid, $anim, $mask) {
3061
- return new Promise((resolve) => {
3202
+ // oxlint-disable-next-line no-async-promise-executor
3203
+ return new Promise(async (resolve) => {
3062
3204
  const $pops = $anim.querySelector(".pops[type-value]");
3063
- if (popsType === "drawer") {
3064
- const drawerConfig = config;
3065
- popsUtils.setTimeout(() => {
3066
- if ($mask) {
3067
- popsDOMUtils.css($mask, "display", "none");
3068
- }
3069
- if (["top", "bottom"].includes(drawerConfig.direction)) {
3070
- $pops.style.setProperty("height", "0");
3071
- }
3072
- else if (["left", "right"].includes(drawerConfig.direction)) {
3073
- $pops.style.setProperty("width", "0");
3205
+ const fintInst = instConfigList.find((instConfigItem) => instConfigItem.guid === guid);
3206
+ if (fintInst) {
3207
+ // 存在实例
3208
+ const startAnim = async () => {
3209
+ if (popsType === "drawer") {
3210
+ // drawer是抽屉
3211
+ // 单独处理动画
3212
+ const drawerConfig = config;
3213
+ await popsUtils.sleep(drawerConfig.closeDelay ?? 0);
3214
+ if ($mask) {
3215
+ popsDOMUtils.css($mask, "display", "none");
3216
+ }
3217
+ const direction = drawerConfig.direction;
3218
+ const size = "0";
3219
+ if (["top", "bottom"].includes(direction)) {
3220
+ $pops.style.setProperty("height", size);
3221
+ }
3222
+ else if (["left", "right"].includes(direction)) {
3223
+ $pops.style.setProperty("width", size);
3224
+ }
3225
+ else {
3226
+ console.error("未知direction: ", direction);
3227
+ }
3074
3228
  }
3075
3229
  else {
3076
- console.error("未知direction:", drawerConfig.direction);
3230
+ instConfigItem.$anim.style.width = "100%";
3231
+ instConfigItem.$anim.style.height = "100%";
3232
+ Reflect.set(instConfigItem.$anim.style, "animation-name", instConfigItem.$anim.getAttribute("anim") + "-reverse");
3077
3233
  }
3078
- resolve();
3079
- }, drawerConfig.closeDelay);
3080
- }
3081
- else {
3082
- const fintInst = instConfigList.find((instConfigItem) => instConfigItem.guid === guid);
3083
- if (fintInst) {
3084
- // 存在动画
3085
- const instConfigItem = fintInst;
3086
- instConfigItem.$anim.style.width = "100%";
3087
- instConfigItem.$anim.style.height = "100%";
3088
- Reflect.set(instConfigItem.$anim.style, "animation-name", instConfigItem.$anim.getAttribute("anim") + "-reverse");
3089
- if (PopsAnimation.hasAnim(Reflect.get(instConfigItem.$anim.style, "animation-name"))) {
3090
- /**
3091
- * 动画结束的回调
3092
- */
3093
- function animationendCallBack() {
3094
- instConfigItem.$anim.style.display = "none";
3095
- if (instConfigItem.$mask) {
3096
- instConfigItem.$mask.style.display = "none";
3097
- }
3098
- popsDOMUtils.off(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), animationendCallBack, {
3099
- capture: true,
3100
- });
3101
- resolve();
3102
- }
3103
- popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), animationendCallBack, {
3104
- capture: true,
3105
- });
3234
+ };
3235
+ const endCallback = () => {
3236
+ instConfigItem.$anim.style.display = "none";
3237
+ if (instConfigItem.$mask) {
3238
+ instConfigItem.$mask.style.display = "none";
3106
3239
  }
3107
- else {
3108
- instConfigItem.$anim.style.display = "none";
3109
- if (instConfigItem.$mask) {
3110
- instConfigItem.$mask.style.display = "none";
3111
- }
3240
+ fintInst.emitter.emit("pops:hide", instConfigItem);
3241
+ };
3242
+ const instConfigItem = fintInst;
3243
+ fintInst.emitter.emit("pops:before-hide", instConfigItem);
3244
+ await startAnim();
3245
+ if (PopsAnimation.hasAnim(Reflect.get(instConfigItem.$anim.style, "animation-name"))) {
3246
+ /**
3247
+ * 动画结束的回调
3248
+ */
3249
+ const animationendCallBack = () => {
3250
+ listener.off();
3251
+ endCallback();
3112
3252
  resolve();
3113
- }
3253
+ };
3254
+ const listener = popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), animationendCallBack, {
3255
+ capture: true,
3256
+ once: true,
3257
+ });
3258
+ }
3259
+ else {
3260
+ endCallback();
3261
+ resolve();
3114
3262
  }
3115
3263
  }
3264
+ else {
3265
+ console.error("hide-error: 该实例未存储");
3266
+ resolve();
3267
+ }
3116
3268
  });
3117
3269
  },
3118
3270
  /**
@@ -3125,62 +3277,70 @@ const PopsInstanceUtils = {
3125
3277
  * @param $mask
3126
3278
  */
3127
3279
  show(config, popsType, instConfigList, guid, $anim, $mask) {
3128
- return new Promise((resolve) => {
3280
+ // oxlint-disable-next-line no-async-promise-executor
3281
+ return new Promise(async (resolve) => {
3129
3282
  const $pops = $anim.querySelector(".pops[type-value]");
3130
- if (popsType === "drawer") {
3131
- const drawerConfig = config;
3132
- popsUtils.setTimeout(() => {
3133
- if ($mask) {
3134
- popsDOMUtils.css($mask, "display", "");
3135
- }
3136
- const direction = drawerConfig.direction;
3137
- const size = drawerConfig.size.toString();
3138
- if (["top", "bottom"].includes(direction)) {
3139
- $pops.style.setProperty("height", size);
3140
- }
3141
- else if (["left", "right"].includes(direction)) {
3142
- $pops.style.setProperty("width", size);
3143
- }
3144
- else {
3145
- console.error("未知direction:", direction);
3146
- }
3147
- resolve();
3148
- }, drawerConfig.openDelay ?? 0);
3149
- }
3150
- else {
3151
- const fintInst = instConfigList.find((instConfigItem) => instConfigItem.guid === guid);
3152
- if (fintInst) {
3153
- const instConfigItem = fintInst;
3154
- instConfigItem.$anim.style.width = "";
3155
- instConfigItem.$anim.style.height = "";
3156
- Reflect.set(instConfigItem.$anim.style, "animation-name", instConfigItem.$anim.getAttribute("anim").replace("-reverse", ""));
3157
- if (PopsAnimation.hasAnim(Reflect.get(instConfigItem.$anim.style, "animation-name"))) {
3158
- /**
3159
- * 动画结束的回调
3160
- */
3161
- function animationendCallBack() {
3162
- popsDOMUtils.off(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), animationendCallBack, {
3163
- capture: true,
3164
- });
3165
- resolve();
3283
+ const fintInst = instConfigList.find((instConfigItem) => instConfigItem.guid === guid);
3284
+ if (fintInst) {
3285
+ const startAnim = async () => {
3286
+ if (popsType === "drawer") {
3287
+ // drawer是抽屉
3288
+ // 单独处理动画
3289
+ const drawerConfig = config;
3290
+ await popsUtils.sleep(drawerConfig.openDelay ?? 0);
3291
+ if ($mask) {
3292
+ popsDOMUtils.css($mask, "display", "");
3293
+ }
3294
+ const direction = drawerConfig.direction;
3295
+ const size = drawerConfig.size.toString();
3296
+ if (["top", "bottom"].includes(direction)) {
3297
+ $pops.style.setProperty("height", size);
3166
3298
  }
3167
- instConfigItem.$anim.style.display = "";
3168
- if (instConfigItem.$mask) {
3169
- instConfigItem.$mask.style.display = "";
3299
+ else if (["left", "right"].includes(direction)) {
3300
+ $pops.style.setProperty("width", size);
3301
+ }
3302
+ else {
3303
+ console.error("未知direction:", direction);
3170
3304
  }
3171
- popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), animationendCallBack, {
3172
- capture: true,
3173
- });
3174
3305
  }
3175
3306
  else {
3176
- instConfigItem.$anim.style.display = "";
3177
- if (instConfigItem.$mask) {
3178
- instConfigItem.$mask.style.display = "";
3179
- }
3180
- resolve();
3307
+ instConfigItem.$anim.style.width = "";
3308
+ instConfigItem.$anim.style.height = "";
3309
+ Reflect.set(instConfigItem.$anim.style, "animation-name", instConfigItem.$anim.getAttribute("anim").replace("-reverse", ""));
3181
3310
  }
3311
+ };
3312
+ const endCallback = () => {
3313
+ instConfigItem.$anim.style.display = "";
3314
+ if (instConfigItem.$mask) {
3315
+ instConfigItem.$mask.style.display = "";
3316
+ }
3317
+ fintInst.emitter.emit("pops:show", instConfigItem);
3318
+ };
3319
+ const instConfigItem = fintInst;
3320
+ fintInst.emitter.emit("pops:before-show", instConfigItem);
3321
+ await startAnim();
3322
+ if (PopsAnimation.hasAnim(Reflect.get(instConfigItem.$anim.style, "animation-name"))) {
3323
+ /**
3324
+ * 动画结束的回调
3325
+ */
3326
+ const animationendCallBack = () => {
3327
+ listener.off();
3328
+ endCallback();
3329
+ resolve();
3330
+ };
3331
+ const listener = popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), animationendCallBack, {
3332
+ capture: true,
3333
+ });
3334
+ }
3335
+ else {
3336
+ endCallback();
3337
+ resolve();
3182
3338
  }
3183
3339
  }
3340
+ else {
3341
+ console.error("show-error: 该实例未存储");
3342
+ resolve();
3343
+ }
3184
3344
  });
3185
3345
  },
3186
3346
  /**
@@ -3192,30 +3352,53 @@ const PopsInstanceUtils = {
3192
3352
  * @param $anim
3193
3353
  */
3194
3354
  async close(config, popsType, instConfigList, guid, $anim) {
3355
+ // 判断组件内部是否有rightClickMenu、tooltip、searchSuggestion组件
3356
+ // 有的话也需要关闭
3357
+ PopsInstData.rightClickMenu.forEach((itemConfig) => {
3358
+ const config = itemConfig.config;
3359
+ if (config.$target instanceof HTMLElement) {
3360
+ const $root = config.$target.getRootNode();
3361
+ if ($root instanceof HTMLElement && $root.parentElement == null) {
3362
+ // 触发销毁元素
3363
+ itemConfig.emitter.emit("pops:before-destory", itemConfig);
3364
+ }
3365
+ }
3366
+ });
3367
+ PopsInstData.tooltip.forEach((itemConfig) => {
3368
+ const config = itemConfig.config;
3369
+ if (config.$target instanceof HTMLElement) {
3370
+ const $root = config.$target.getRootNode();
3371
+ if ($root instanceof HTMLElement && $root.parentElement == null) {
3372
+ // 触发销毁元素
3373
+ itemConfig.emitter.emit("pops:before-destory", itemConfig);
3374
+ }
3375
+ }
3376
+ });
3195
3377
  // eslint-disable-next-line no-async-promise-executor
3196
3378
  await new Promise(async (resolve) => {
3197
3379
  const $pops = $anim.querySelector(".pops[type-value]");
3198
3380
  const drawerConfig = config;
3199
- /**
3200
- * 动画结束事件
3201
- */
3202
- function transitionendEvent() {
3381
+ const start = () => {
3203
3382
  /**
3204
3383
  * 弹窗已关闭的回调
3205
3384
  */
3206
- async function closeCallBack(event) {
3385
+ const transtionEndCallback = async (event) => {
3207
3386
  if (event.propertyName !== "transform") {
3208
3387
  return;
3209
3388
  }
3210
- popsDOMUtils.off($pops, popsDOMUtils.getTransitionEndNameList(), closeCallBack);
3211
- await PopsInstanceUtils.removeInstance([instConfigList], guid);
3389
+ listener.off();
3390
+ await PopsInstHandler.removeInstance([instConfigList], guid);
3212
3391
  resolve();
3213
- }
3392
+ };
3214
3393
  // 监听过渡结束
3215
- popsDOMUtils.on($pops, popsDOMUtils.getTransitionEndNameList(), closeCallBack);
3216
- const popsTransForm = getComputedStyle($pops).transform;
3394
+ const listener = popsDOMUtils.on($pops, popsDOMUtils.getTransitionEndNameList(), transtionEndCallback, {
3395
+ once: true,
3396
+ });
3397
+ const popsTransForm = globalThis.getComputedStyle($pops).transform;
3217
3398
  if (popsTransForm !== "none") {
3218
- popsDOMUtils.emit($pops, popsDOMUtils.getTransitionEndNameList(), void 0, true);
3399
+ // 不存在动画
3400
+ // 直接移除实例
3401
+ listener.emit({ propertyName: "transform" });
3219
3402
  return;
3220
3403
  }
3221
3404
  if (["top"].includes(drawerConfig.direction)) {
@@ -3231,41 +3414,18 @@ const PopsInstanceUtils = {
3231
3414
  $pops.style.setProperty("transform", "translateX(100%)");
3232
3415
  }
3233
3416
  else {
3234
- console.error("未知direction", drawerConfig.direction);
3417
+ console.error("未知direction: ", drawerConfig.direction);
3235
3418
  }
3236
- }
3419
+ };
3237
3420
  if (popsType === "drawer") {
3238
- popsUtils.setTimeout(() => {
3239
- transitionendEvent();
3240
- }, drawerConfig.closeDelay);
3421
+ await popsUtils.sleep(drawerConfig.closeDelay ?? 0);
3422
+ start();
3241
3423
  }
3242
3424
  else {
3243
- await PopsInstanceUtils.removeInstance([instConfigList], guid);
3425
+ await PopsInstHandler.removeInstance([instConfigList], guid);
3244
3426
  resolve();
3245
3427
  }
3246
3428
  });
3247
- // 判断组件内是否有rightClickMenu、tooltip、searchSuggestion组件
3248
- // 有的话也需要关闭
3249
- PopsInstData.rightClickMenu.forEach((itemConfig) => {
3250
- const config = itemConfig.config;
3251
- if (config.$target instanceof HTMLElement) {
3252
- const $root = config.$target.getRootNode();
3253
- if ($root instanceof HTMLElement && $root.parentElement == null) {
3254
- // 触发销毁元素
3255
- itemConfig.destory();
3256
- }
3257
- }
3258
- });
3259
- PopsInstData.tooltip.forEach((itemConfig) => {
3260
- const config = itemConfig.config;
3261
- if (config.$target instanceof HTMLElement) {
3262
- const $root = config.$target.getRootNode();
3263
- if ($root instanceof HTMLElement && $root.parentElement == null) {
3264
- // 触发销毁元素
3265
- itemConfig.destory();
3266
- }
3267
- }
3268
- });
3269
3429
  },
3270
3430
  /**
3271
3431
  * 拖拽元素
@@ -3353,17 +3513,10 @@ const PopsInstanceUtils = {
3353
3513
  clickElementLeftOffset = event.x - rect.left;
3354
3514
  clickElementTopOffset = event.y - rect.top;
3355
3515
  transformInfo = popsDOMUtils.getTransform($move);
3356
- //if (event.nativeEvent.offsetX) {
3357
- // clickElementLeftOffset = parseInt(event.nativeEvent.offsetX);
3358
- //} else {
3359
- // clickElementLeftOffset = parseInt(event.getOffset().x);
3360
- //}
3361
- //if (event.nativeEvent.offsetY) {
3362
- // clickElementTopOffset = parseInt(event.nativeEvent.offsetY);
3363
- //} else {
3364
- // clickElementTopOffset = parseInt(event.getOffset().y);
3365
- //}
3366
3516
  resumeMoveElementStyle = changeMoveElementStyle($move);
3517
+ if (typeof options.startCallBack === "function") {
3518
+ options.startCallBack($move, clickElementLeftOffset, clickElementTopOffset);
3519
+ }
3367
3520
  }
3368
3521
  /** 当前移动的left偏移 */
3369
3522
  let currentMoveLeftOffset = event.x - clickElementLeftOffset + transformInfo.transformLeft;
@@ -3440,46 +3593,6 @@ const PopsInstanceUtils = {
3440
3593
  });
3441
3594
  }
3442
3595
  },
3443
- /**
3444
- * 排序数组
3445
- * @param getBeforeValueFun
3446
- * @param getAfterValueFun
3447
- * @param sortByDesc 排序是否降序,默认降序
3448
- */
3449
- sortElementListByProperty(getBeforeValueFun, getAfterValueFun, sortByDesc = true) {
3450
- if (typeof sortByDesc !== "boolean") {
3451
- throw new TypeError("参数 sortByDesc 必须为boolean类型");
3452
- }
3453
- if (getBeforeValueFun == null || getAfterValueFun == null) {
3454
- throw new Error("获取前面的值或后面的值的方法不能为空");
3455
- }
3456
- return function (after_obj, before_obj) {
3457
- const beforeValue = getBeforeValueFun(before_obj); // 前
3458
- const afterValue = getAfterValueFun(after_obj); // 后
3459
- if (sortByDesc) {
3460
- if (afterValue > beforeValue) {
3461
- return -1;
3462
- }
3463
- else if (afterValue < beforeValue) {
3464
- return 1;
3465
- }
3466
- else {
3467
- return 0;
3468
- }
3469
- }
3470
- else {
3471
- if (afterValue < beforeValue) {
3472
- return -1;
3473
- }
3474
- else if (afterValue > beforeValue) {
3475
- return 1;
3476
- }
3477
- else {
3478
- return 0;
3479
- }
3480
- }
3481
- };
3482
- },
3483
3596
  };
3484
3597
 
3485
3598
  const PopsHandler = {
@@ -3593,11 +3706,11 @@ const PopsHandler = {
3593
3706
  function originalRun() {
3594
3707
  if (config.config.mask.clickEvent.toClose) {
3595
3708
  // 关闭
3596
- return PopsInstanceUtils.close(config.config, config.type, targetInst, config.guid, config.animElement);
3709
+ return PopsInstHandler.close(config.config, config.type, targetInst, config.guid, config.animElement);
3597
3710
  }
3598
3711
  else if (config.config.mask.clickEvent.toHide) {
3599
3712
  // 隐藏
3600
- return PopsInstanceUtils.hide(config.config, config.type, targetInst, config.guid, config.animElement, result.maskElement);
3713
+ return PopsInstHandler.hide(config.config, config.type, targetInst, config.guid, config.animElement, result.maskElement);
3601
3714
  }
3602
3715
  }
3603
3716
  if (typeof config.config.mask.clickCallBack === "function") {
@@ -3784,7 +3897,7 @@ const PopsHandler = {
3784
3897
  * @param $mask 遮罩层
3785
3898
  * @param config 当前配置
3786
3899
  */
3787
- handleEventConfig(config, guid, $shadowContainer, $shadowRoot, type, $anim, $pops, $mask) {
3900
+ handleEventConfig(config, guid, $shadowContainer, $shadowRoot, type, $anim, $pops, emitter, $mask) {
3788
3901
  return {
3789
3902
  $shadowContainer: $shadowContainer,
3790
3903
  $shadowRoot: $shadowRoot,
@@ -3794,17 +3907,18 @@ const PopsHandler = {
3794
3907
  $mask: $mask,
3795
3908
  mode: type,
3796
3909
  guid: guid,
3910
+ emitter: emitter,
3797
3911
  close() {
3798
- return PopsInstanceUtils.close(config, type, PopsInstData[type], guid, $anim);
3912
+ return PopsInstHandler.close(config, type, PopsInstData[type], guid, $anim);
3799
3913
  },
3800
3914
  hide() {
3801
- return PopsInstanceUtils.hide(config, type, PopsInstData[type], guid, $anim, $mask);
3915
+ return PopsInstHandler.hide(config, type, PopsInstData[type], guid, $anim, $mask);
3802
3916
  },
3803
3917
  show($parent) {
3804
3918
  if ($parent) {
3805
3919
  $parent.appendChild(PopsInstData[type][0].$shadowRoot);
3806
3920
  }
3807
- return PopsInstanceUtils.show(config, type, PopsInstData[type], guid, $anim, $mask);
3921
+ return PopsInstHandler.show(config, type, PopsInstData[type], guid, $anim, $mask);
3808
3922
  },
3809
3923
  };
3810
3924
  },
@@ -3817,7 +3931,7 @@ const PopsHandler = {
3817
3931
  * @param $mask 遮罩层
3818
3932
  * @param config 当前配置
3819
3933
  */
3820
- handleLoadingEventConfig(config, guid, type, $anim, $pops, $mask) {
3934
+ handleLoadingEventConfig(config, guid, type, $anim, $pops, emitter, $mask) {
3821
3935
  return {
3822
3936
  $el: $anim,
3823
3937
  $anim: $anim,
@@ -3825,14 +3939,15 @@ const PopsHandler = {
3825
3939
  $mask: $mask,
3826
3940
  mode: type,
3827
3941
  guid: guid,
3942
+ emitter,
3828
3943
  close() {
3829
- return PopsInstanceUtils.close(config, type, PopsInstData[type], guid, $anim);
3944
+ return PopsInstHandler.close(config, type, PopsInstData[type], guid, $anim);
3830
3945
  },
3831
3946
  hide() {
3832
- return PopsInstanceUtils.hide(config, type, PopsInstData[type], guid, $anim, $mask);
3947
+ return PopsInstHandler.hide(config, type, PopsInstData[type], guid, $anim, $mask);
3833
3948
  },
3834
3949
  show() {
3835
- return PopsInstanceUtils.show(config, type, PopsInstData[type], guid, $anim, $mask);
3950
+ return PopsInstHandler.show(config, type, PopsInstData[type], guid, $anim, $mask);
3836
3951
  },
3837
3952
  };
3838
3953
  },
@@ -3856,7 +3971,7 @@ const PopsHandler = {
3856
3971
  handleClickEvent(type, $btn, eventConfig, callback) {
3857
3972
  if (typeof callback !== "function")
3858
3973
  return;
3859
- popsDOMUtils.on($btn, "click", (event) => {
3974
+ return popsDOMUtils.on($btn, "click", (event) => {
3860
3975
  const extraParam = {
3861
3976
  type: type,
3862
3977
  };
@@ -3894,16 +4009,10 @@ const PopsHandler = {
3894
4009
  callback && callback(event);
3895
4010
  }
3896
4011
  };
3897
- popsDOMUtils.on(PopsCore.globalThis, "keydown", keyboardEvent, {
4012
+ const listener = popsDOMUtils.on(PopsCore.globalThis, "keydown", keyboardEvent, {
3898
4013
  capture: true,
3899
4014
  });
3900
- return {
3901
- removeKeyboardEvent() {
3902
- popsDOMUtils.off(globalThis, "keydown", keyboardEvent, {
3903
- capture: true,
3904
- });
3905
- },
3906
- };
4015
+ return listener;
3907
4016
  },
3908
4017
  /**
3909
4018
  * 处理prompt的点击事件
@@ -3926,15 +4035,16 @@ const PopsHandler = {
3926
4035
  });
3927
4036
  },
3928
4037
  /**
3929
- * 把配置的z-index配置转为数字
3930
- * @param zIndex
4038
+ * 获取数值
4039
+ * @param target
3931
4040
  */
3932
- handleZIndex(zIndex) {
3933
- if (typeof zIndex === "function") {
3934
- return zIndex();
4041
+ getTargerOrFunctionValue(target) {
4042
+ if (typeof target === "function") {
4043
+ const result = target();
4044
+ return result;
3935
4045
  }
3936
4046
  else {
3937
- return zIndex;
4047
+ return target;
3938
4048
  }
3939
4049
  },
3940
4050
  /**
@@ -3951,11 +4061,11 @@ const PopsHandler = {
3951
4061
  if (type === "loading" || type === "tooltip" || type === "rightClickMenu") {
3952
4062
  const inst = PopsInstData[type];
3953
4063
  if (inst) {
3954
- PopsInstanceUtils.removeInstance([inst], "", true);
4064
+ PopsInstHandler.removeInstance([inst], "", true);
3955
4065
  }
3956
4066
  }
3957
4067
  else {
3958
- PopsInstanceUtils.removeInstance([
4068
+ PopsInstHandler.removeInstance([
3959
4069
  PopsInstData.alert,
3960
4070
  PopsInstData.confirm,
3961
4071
  PopsInstData.drawer,
@@ -3966,17 +4076,31 @@ const PopsHandler = {
3966
4076
  ], "", true);
3967
4077
  }
3968
4078
  }
3969
- else {
3970
- // 对配置进行处理
3971
- // 选择配置的z-index和已有的pops实例的最大z-index值
3972
- const originZIndex = config.zIndex;
3973
- config.zIndex = () => {
3974
- const { zIndex: maxZIndex } = PopsInstanceUtils.getPopsMaxZIndex(PopsHandler.handleZIndex(originZIndex) + 100);
3975
- return maxZIndex;
3976
- };
4079
+ if (type !== "rightClickMenu") {
4080
+ // rightClickMenu在配置处理时就处理了一次,这里不需要重复处理
4081
+ config = this.handleZIndex(config);
3977
4082
  }
3978
4083
  return config;
3979
4084
  },
4085
+ /**
4086
+ * 处理z-index
4087
+ * @param config 配置
4088
+ */
4089
+ handleZIndex(config) {
4090
+ // 对配置进行处理
4091
+ // 选择配置的z-index和已有的pops实例的最大z-index值
4092
+ const originZIndex = config.zIndex;
4093
+ const handler = () => {
4094
+ let deviation = 100;
4095
+ deviation += PopsHandler.getTargerOrFunctionValue(originZIndex) ?? 0;
4096
+ let maxZIndex = deviation;
4097
+ const pointZIndex = popsUtils.getMaxZIndexNodeInfoFromPoint(deviation)[0]?.zIndex ?? 0;
4098
+ maxZIndex = Math.max(maxZIndex, pointZIndex);
4099
+ return maxZIndex === deviation ? maxZIndex : maxZIndex + deviation;
4100
+ };
4101
+ config.zIndex = handler;
4102
+ return config;
4103
+ },
3980
4104
  /**
3981
4105
  * 处理把已创建的元素保存到内部环境中
3982
4106
  * @param type 当前弹窗类型
@@ -4056,6 +4180,7 @@ const PopsAlert = {
4056
4180
  const guid = popsUtils.getRandomGUID();
4057
4181
  // 设置当前类型
4058
4182
  const popsType = "alert";
4183
+ const emitter = new EventEmiter(popsType);
4059
4184
  let config = PopsAlertDefaultConfig();
4060
4185
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4061
4186
  config = popsUtils.assign(config, __config__);
@@ -4092,7 +4217,7 @@ const PopsAlert = {
4092
4217
  },
4093
4218
  ]);
4094
4219
  // 先把z-index提取出来
4095
- const zIndex = PopsHandler.handleZIndex(config.zIndex);
4220
+ const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
4096
4221
  const maskHTML = PopsElementHandler.createMask(guid, zIndex);
4097
4222
  const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
4098
4223
  const bottomBtnHTML = PopsElementHandler.createBottom(popsType, config);
@@ -4128,7 +4253,7 @@ const PopsAlert = {
4128
4253
  $elList.push($mask);
4129
4254
  }
4130
4255
  // 处理返回的配置
4131
- const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
4256
+ const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, emitter, $mask);
4132
4257
  const result = PopsHandler.handleResultConfig(evtConfig);
4133
4258
  // 为顶部右边的关闭按钮添加点击事件
4134
4259
  PopsHandler.handleClickEvent("close", $headerCloseBtn, evtConfig, config.btn.close?.callback);
@@ -4136,9 +4261,7 @@ const PopsAlert = {
4136
4261
  PopsHandler.handleClickEvent("ok", btnOkElement, evtConfig, config.btn.ok?.callback);
4137
4262
  // 创建到页面中
4138
4263
  popsDOMUtils.append($shadowRoot, $elList);
4139
- if (typeof config.beforeAppendToPageCallBack === "function") {
4140
- config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
4141
- }
4264
+ emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
4142
4265
  popsDOMUtils.appendBody($shadowContainer);
4143
4266
  if ($mask != null) {
4144
4267
  // 添加遮罩层
@@ -4153,11 +4276,11 @@ const PopsAlert = {
4153
4276
  $shadowContainer: $shadowContainer,
4154
4277
  $shadowRoot: $shadowRoot,
4155
4278
  config: config,
4156
- destory: result.close,
4279
+ emitter,
4157
4280
  });
4158
4281
  // 拖拽
4159
4282
  if (config.drag) {
4160
- PopsInstanceUtils.drag($pops, {
4283
+ PopsInstHandler.drag($pops, {
4161
4284
  dragElement: $title,
4162
4285
  limit: config.dragLimit,
4163
4286
  extraDistance: config.dragExtraDistance,
@@ -4265,6 +4388,7 @@ const PopsConfirm = {
4265
4388
  const guid = popsUtils.getRandomGUID();
4266
4389
  // 设置当前类型
4267
4390
  const popsType = "confirm";
4391
+ const emitter = new EventEmiter(popsType);
4268
4392
  let config = PopsConfirmDefaultConfig();
4269
4393
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4270
4394
  config = popsUtils.assign(config, __config__);
@@ -4301,7 +4425,7 @@ const PopsConfirm = {
4301
4425
  },
4302
4426
  ]);
4303
4427
  // 先把z-index提取出来
4304
- const zIndex = PopsHandler.handleZIndex(config.zIndex);
4428
+ const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
4305
4429
  const maskHTML = PopsElementHandler.createMask(guid, zIndex);
4306
4430
  const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
4307
4431
  const bottomBtnHTML = PopsElementHandler.createBottom(popsType, config);
@@ -4340,7 +4464,7 @@ const PopsConfirm = {
4340
4464
  $mask = handleMask.maskElement;
4341
4465
  $elList.push($mask);
4342
4466
  }
4343
- const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
4467
+ const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, emitter, $mask);
4344
4468
  const result = PopsHandler.handleResultConfig(evtConfig);
4345
4469
  PopsHandler.handleClickEvent("close", $btnClose, evtConfig, config.btn.close.callback);
4346
4470
  PopsHandler.handleClickEvent("ok", $btnOk, evtConfig, config.btn.ok.callback);
@@ -4348,9 +4472,7 @@ const PopsConfirm = {
4348
4472
  PopsHandler.handleClickEvent("other", $btnOther, evtConfig, config.btn.other.callback);
4349
4473
  // 创建到页面中
4350
4474
  popsDOMUtils.append($shadowRoot, $elList);
4351
- if (typeof config.beforeAppendToPageCallBack === "function") {
4352
- config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
4353
- }
4475
+ emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
4354
4476
  popsDOMUtils.appendBody($shadowContainer);
4355
4477
  if ($mask != null) {
4356
4478
  $anim.after($mask);
@@ -4363,11 +4485,11 @@ const PopsConfirm = {
4363
4485
  $shadowContainer: $shadowContainer,
4364
4486
  $shadowRoot: $shadowRoot,
4365
4487
  config: config,
4366
- destory: result.close,
4488
+ emitter,
4367
4489
  });
4368
4490
  // 拖拽
4369
4491
  if (config.drag) {
4370
- PopsInstanceUtils.drag($pops, {
4492
+ PopsInstHandler.drag($pops, {
4371
4493
  dragElement: $title,
4372
4494
  limit: config.dragLimit,
4373
4495
  extraDistance: config.dragExtraDistance,
@@ -4474,6 +4596,7 @@ const PopsDrawer = {
4474
4596
  const guid = popsUtils.getRandomGUID();
4475
4597
  // 设置当前类型
4476
4598
  const popsType = "drawer";
4599
+ const emitter = new EventEmiter(popsType);
4477
4600
  let config = PopsDrawerDefaultConfig();
4478
4601
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4479
4602
  config = popsUtils.assign(config, __config__);
@@ -4510,7 +4633,7 @@ const PopsDrawer = {
4510
4633
  },
4511
4634
  ]);
4512
4635
  // 先把z-index提取出来
4513
- const zIndex = PopsHandler.handleZIndex(config.zIndex);
4636
+ const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
4514
4637
  const maskHTML = PopsElementHandler.createMask(guid, zIndex);
4515
4638
  const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
4516
4639
  const bottomBtnHTML = PopsElementHandler.createBottom(popsType, config);
@@ -4555,7 +4678,7 @@ const PopsDrawer = {
4555
4678
  $mask = handleMask.maskElement;
4556
4679
  $elList.push($mask);
4557
4680
  }
4558
- const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
4681
+ const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, emitter, $mask);
4559
4682
  const result = PopsHandler.handleResultConfig(evtConfig);
4560
4683
  // 处理方向
4561
4684
  $pops.setAttribute("direction", config.direction);
@@ -4579,9 +4702,12 @@ const PopsDrawer = {
4579
4702
  }
4580
4703
  // 按下Esc键触发关闭
4581
4704
  if (config.closeOnPressEscape) {
4582
- PopsHandler.handleKeyboardEvent("Escape", [], function () {
4705
+ const listener = PopsHandler.handleKeyboardEvent("Escape", [], function () {
4583
4706
  evtConfig.close();
4584
4707
  });
4708
+ emitter.on("pops:destory", () => {
4709
+ listener.off();
4710
+ });
4585
4711
  }
4586
4712
  // 待处理的点击事件列表
4587
4713
  const needHandleClickEventList = [
@@ -4633,9 +4759,7 @@ const PopsDrawer = {
4633
4759
  });
4634
4760
  // 创建到页面中
4635
4761
  popsDOMUtils.append($shadowRoot, $elList);
4636
- if (typeof config.beforeAppendToPageCallBack === "function") {
4637
- config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
4638
- }
4762
+ emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
4639
4763
  popsDOMUtils.appendBody($shadowContainer);
4640
4764
  popsUtils.setTimeout(() => {
4641
4765
  popsUtils.setTimeout(() => {
@@ -4653,7 +4777,7 @@ const PopsDrawer = {
4653
4777
  $shadowContainer: $shadowContainer,
4654
4778
  $shadowRoot: $shadowRoot,
4655
4779
  config: config,
4656
- destory: result.close,
4780
+ emitter: emitter,
4657
4781
  });
4658
4782
  return result;
4659
4783
  },
@@ -4695,12 +4819,13 @@ const PopsLoading = {
4695
4819
  const guid = popsUtils.getRandomGUID();
4696
4820
  // 设置当前类型
4697
4821
  const PopsType = "loading";
4822
+ const emitter = new EventEmiter(PopsType);
4698
4823
  let config = PopsLoadingDefaultConfig();
4699
4824
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4700
4825
  config = popsUtils.assign(config, __config__);
4701
4826
  config = PopsHandler.handleOnly(PopsType, config);
4702
4827
  // 先把z-index提取出来
4703
- const zIndex = PopsHandler.handleZIndex(config.zIndex);
4828
+ const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
4704
4829
  const maskHTML = PopsElementHandler.createMask(guid, zIndex);
4705
4830
  const { contentPStyle } = PopsElementHandler.createContentStyle("loading", config);
4706
4831
  const animHTML = PopsElementHandler.createAnim(guid, PopsType, config,
@@ -4743,17 +4868,20 @@ const PopsLoading = {
4743
4868
  $mask = handleMask.maskElement;
4744
4869
  $elList.push($mask);
4745
4870
  }
4746
- const evtConfig = PopsHandler.handleLoadingEventConfig(config, guid, PopsType, $anim, $pops, $mask);
4871
+ const evtConfig = PopsHandler.handleLoadingEventConfig(config, guid, PopsType, $anim, $pops, emitter, $mask);
4747
4872
  popsDOMUtils.append(config.$parent, $elList);
4748
4873
  if ($mask != null) {
4749
4874
  $anim.after($mask);
4750
4875
  }
4751
- // @ts-ignore
4752
4876
  PopsHandler.handlePush(PopsType, {
4877
+ $shadowContainer: $pops,
4878
+ $shadowRoot: $pops,
4753
4879
  guid: guid,
4754
4880
  $anim: $anim,
4755
4881
  $pops: $pops,
4756
4882
  $mask: $mask,
4883
+ emitter: emitter,
4884
+ config: config,
4757
4885
  });
4758
4886
  if (config.isAbsolute) {
4759
4887
  // 遮罩层必须是跟随主内容
@@ -4952,6 +5080,7 @@ const PopsFolder = {
4952
5080
  const guid = popsUtils.getRandomGUID();
4953
5081
  // 设置当前类型
4954
5082
  const popsType = "folder";
5083
+ const emitter = new EventEmiter(popsType);
4955
5084
  let config = PopsFolderDefaultConfig();
4956
5085
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4957
5086
  config = popsUtils.assign(config, __config__);
@@ -5035,7 +5164,7 @@ const PopsFolder = {
5035
5164
  Reflect.set(config, "folder", config.folder);
5036
5165
  }
5037
5166
  // 先把z-index提取出来
5038
- const zIndex = PopsHandler.handleZIndex(config.zIndex);
5167
+ const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
5039
5168
  const maskHTML = PopsElementHandler.createMask(guid, zIndex);
5040
5169
  const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
5041
5170
  const bottomBtnHTML = PopsElementHandler.createBottom(popsType, config);
@@ -5168,7 +5297,7 @@ const PopsFolder = {
5168
5297
  $elList.push($mask);
5169
5298
  }
5170
5299
  // 事件
5171
- const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
5300
+ const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, emitter, $mask);
5172
5301
  const result = PopsHandler.handleResultConfig(evtConfig);
5173
5302
  PopsHandler.handleClickEvent("close", $btnCloseBtn, evtConfig, config.btn.close.callback);
5174
5303
  PopsHandler.handleClickEvent("ok", btnOkElement, evtConfig, config.btn.ok.callback);
@@ -5176,9 +5305,7 @@ const PopsFolder = {
5176
5305
  PopsHandler.handleClickEvent("other", btnOtherElement, evtConfig, config.btn.other.callback);
5177
5306
  // 创建到页面中
5178
5307
  popsDOMUtils.append($shadowRoot, $elList);
5179
- if (typeof config.beforeAppendToPageCallBack === "function") {
5180
- config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
5181
- }
5308
+ emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
5182
5309
  popsDOMUtils.appendBody($shadowContainer);
5183
5310
  if ($mask != null) {
5184
5311
  $anim.after($mask);
@@ -5802,7 +5929,7 @@ const PopsFolder = {
5802
5929
  Reflect.set($pops, "data-pops-folder", popsFolder);
5803
5930
  // 拖拽
5804
5931
  if (config.drag) {
5805
- PopsInstanceUtils.drag($pops, {
5932
+ PopsInstHandler.drag($pops, {
5806
5933
  dragElement: $title,
5807
5934
  limit: config.dragLimit,
5808
5935
  extraDistance: config.dragExtraDistance,
@@ -5818,7 +5945,7 @@ const PopsFolder = {
5818
5945
  $shadowContainer: $shadowContainer,
5819
5946
  $shadowRoot: $shadowRoot,
5820
5947
  config: config,
5821
- destory: result.close,
5948
+ emitter,
5822
5949
  });
5823
5950
  return result;
5824
5951
  },
@@ -5890,6 +6017,7 @@ const PopsIframe = {
5890
6017
  const guid = popsUtils.getRandomGUID();
5891
6018
  // 设置当前类型
5892
6019
  const popsType = "iframe";
6020
+ const emitter = new EventEmiter(popsType);
5893
6021
  let config = PopsIframeDefaultConfig();
5894
6022
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
5895
6023
  config = popsUtils.assign(config, __config__);
@@ -5926,7 +6054,7 @@ const PopsIframe = {
5926
6054
  ]);
5927
6055
  const maskExtraStyle = config.animation != null && config.animation != "" ? "position:absolute;" : "";
5928
6056
  // 先把z-index提取出来
5929
- const zIndex = PopsHandler.handleZIndex(config.zIndex);
6057
+ const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
5930
6058
  const maskHTML = PopsElementHandler.createMask(guid, zIndex, maskExtraStyle);
5931
6059
  const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
5932
6060
  const iframeLoadingHTML = /*html*/ '<div class="pops-loading"></div>';
@@ -5975,7 +6103,7 @@ const PopsIframe = {
5975
6103
  $mask = handleMask.maskElement;
5976
6104
  $elList.push($mask);
5977
6105
  }
5978
- const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
6106
+ const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, emitter, $mask);
5979
6107
  // 赋值额外的$iframe参数
5980
6108
  evtConfig.$iframe = $iframe;
5981
6109
  const result = PopsHandler.handleResultConfig(evtConfig);
@@ -6000,16 +6128,14 @@ const PopsIframe = {
6000
6128
  });
6001
6129
  // 创建到页面中
6002
6130
  popsDOMUtils.append($shadowRoot, $elList);
6003
- if (typeof config.beforeAppendToPageCallBack === "function") {
6004
- config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
6005
- }
6131
+ emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
6006
6132
  $iframeContainer.appendChild($shadowContainer);
6007
6133
  if ($mask != null) {
6008
6134
  $anim.after($mask);
6009
6135
  }
6010
6136
  // 拖拽
6011
6137
  if (config.drag) {
6012
- PopsInstanceUtils.drag($pops, {
6138
+ PopsInstHandler.drag($pops, {
6013
6139
  dragElement: $title,
6014
6140
  limit: config.dragLimit,
6015
6141
  extraDistance: config.dragExtraDistance,
@@ -6040,6 +6166,7 @@ const PopsIframe = {
6040
6166
  if (typeof config?.btn?.min?.callback === "function") {
6041
6167
  config.btn.min.callback(evtConfig, event);
6042
6168
  }
6169
+ emitter.emit("pops:iframe-min", evtConfig, event);
6043
6170
  }, {
6044
6171
  capture: true,
6045
6172
  });
@@ -6069,6 +6196,7 @@ const PopsIframe = {
6069
6196
  if (typeof config?.btn?.max?.callback === "function") {
6070
6197
  config.btn.max.callback(evtConfig, event);
6071
6198
  }
6199
+ emitter.emit("pops:iframe-max", evtConfig, event);
6072
6200
  }, {
6073
6201
  capture: true,
6074
6202
  });
@@ -6106,6 +6234,7 @@ const PopsIframe = {
6106
6234
  if (typeof config?.btn?.mise?.callback === "function") {
6107
6235
  config.btn.mise.callback(evtConfig, event);
6108
6236
  }
6237
+ emitter.emit("pops:iframe-mise", evtConfig, event);
6109
6238
  }, {
6110
6239
  capture: true,
6111
6240
  });
@@ -6113,7 +6242,7 @@ const PopsIframe = {
6113
6242
  popsDOMUtils.on(headerCloseBtnElement, "click", async (event) => {
6114
6243
  event.preventDefault();
6115
6244
  event.stopPropagation();
6116
- await PopsInstanceUtils.removeInstance([PopsInstData.iframe], guid, false);
6245
+ await PopsInstHandler.removeInstance([PopsInstData.iframe], guid, false);
6117
6246
  if (typeof config?.btn?.close?.callback === "function") {
6118
6247
  config.btn.close.callback(evtConfig, event);
6119
6248
  }
@@ -6128,7 +6257,7 @@ const PopsIframe = {
6128
6257
  $shadowContainer: $shadowContainer,
6129
6258
  $shadowRoot: $shadowRoot,
6130
6259
  config: config,
6131
- destory: result.close,
6260
+ emitter,
6132
6261
  });
6133
6262
  return result;
6134
6263
  },
@@ -7006,6 +7135,7 @@ const PopsPanelDefaultConfig = () => {
7006
7135
  darkStyle: null,
7007
7136
  beforeAppendToPageCallBack() { },
7008
7137
  stopKeyDownEventPropagation: true,
7138
+ listenEscapeKeyUpToExitDeepMenu: true,
7009
7139
  };
7010
7140
  };
7011
7141
 
@@ -7129,13 +7259,15 @@ class ToolTip {
7129
7259
  $content: null,
7130
7260
  $arrow: null,
7131
7261
  };
7262
+ emitter;
7132
7263
  $data = {
7133
7264
  config: null,
7134
7265
  guid: null,
7135
7266
  timeId_close_TouchEvent: [],
7136
7267
  timeId_close_MouseEvent: [],
7137
7268
  };
7138
- constructor(config, guid, ShadowInfo) {
7269
+ constructor(config, guid, ShadowInfo, emitter) {
7270
+ this.emitter = emitter;
7139
7271
  this.$data.config = config;
7140
7272
  this.$data.guid = guid;
7141
7273
  this.$el.$shadowContainer = ShadowInfo.$shadowContainer;
@@ -7181,7 +7313,7 @@ class ToolTip {
7181
7313
  // 处理className
7182
7314
  popsDOMUtils.addClassName($toolTipContainer, this.$data.config.className);
7183
7315
  // 添加z-index
7184
- $toolTipContainer.style.zIndex = PopsHandler.handleZIndex(this.$data.config.zIndex).toString();
7316
+ $toolTipContainer.style.zIndex = PopsHandler.getTargerOrFunctionValue(this.$data.config.zIndex).toString();
7185
7317
  // 添加自定义style
7186
7318
  PopsElementHandler.addStyle($toolTipContainer, this.$data.config.style);
7187
7319
  // 添加自定义浅色style
@@ -7229,7 +7361,7 @@ class ToolTip {
7229
7361
  * 获取z-index
7230
7362
  */
7231
7363
  getZIndex() {
7232
- const zIndex = PopsHandler.handleZIndex(this.$data.config.zIndex);
7364
+ const zIndex = PopsHandler.getTargerOrFunctionValue(this.$data.config.zIndex);
7233
7365
  return zIndex;
7234
7366
  }
7235
7367
  /**
@@ -7412,9 +7544,7 @@ class ToolTip {
7412
7544
  }
7413
7545
  if (!popsUtils.contains(this.$el.$shadowContainer)) {
7414
7546
  // 页面不存在Shadow,添加
7415
- if (typeof this.$data.config.beforeAppendToPageCallBack === "function") {
7416
- this.$data.config.beforeAppendToPageCallBack(this.$el.$shadowRoot, this.$el.$shadowContainer);
7417
- }
7547
+ this.emitter.emit("pops:before-append-to-page", this.$el.$shadowRoot, this.$el.$shadowContainer);
7418
7548
  popsDOMUtils.append(document.body, this.$el.$shadowContainer);
7419
7549
  }
7420
7550
  // 更新内容
@@ -7585,6 +7715,7 @@ const PopsTooltip = {
7585
7715
  const guid = popsUtils.getRandomGUID();
7586
7716
  // 设置当前类型
7587
7717
  const popsType = "tooltip";
7718
+ const emitter = new EventEmiter(popsType);
7588
7719
  let config = PopsTooltipDefaultConfig();
7589
7720
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
7590
7721
  config = popsUtils.assign(config, __config__);
@@ -7623,7 +7754,7 @@ const PopsTooltip = {
7623
7754
  const toolTip = new ToolTip(config, guid, {
7624
7755
  $shadowContainer,
7625
7756
  $shadowRoot,
7626
- });
7757
+ }, emitter);
7627
7758
  if (config.alwaysShow) {
7628
7759
  // 总是显示
7629
7760
  // 直接显示
@@ -7635,6 +7766,7 @@ const PopsTooltip = {
7635
7766
  $shadowContainer,
7636
7767
  $shadowRoot,
7637
7768
  toolTip,
7769
+ emitter,
7638
7770
  };
7639
7771
  },
7640
7772
  };
@@ -7683,6 +7815,7 @@ const PanelHandlerComponents = () => {
7683
7815
  nodeStoreConfigKey: "data-view-config",
7684
7816
  },
7685
7817
  $config: {},
7818
+ emitter: null,
7686
7819
  /**
7687
7820
  * 初始化
7688
7821
  * @param data
@@ -7693,6 +7826,7 @@ const PanelHandlerComponents = () => {
7693
7826
  ...data.$el,
7694
7827
  };
7695
7828
  this.$config = data.config;
7829
+ this.emitter = data.emitter;
7696
7830
  this.asideULElement = this.$el.$panelLeftAside.querySelector(`ul.pops-${PopsType}-aside-top-container`);
7697
7831
  this.asideBottomULElement = this.$el.$panelLeftAside.querySelector(`ul.pops-${PopsType}-aside-bottom-container`);
7698
7832
  this.sectionContainerHeaderULElement = this.$el.$panelContentSectionContainer.querySelector(`ul.pops-${PopsType}-container-header-ul`);
@@ -8603,7 +8737,8 @@ const PanelHandlerComponents = () => {
8603
8737
  $target: this.$ele.button,
8604
8738
  content: getToolTipContent,
8605
8739
  zIndex: () => {
8606
- return PopsInstanceUtils.getPopsMaxZIndex().zIndex;
8740
+ // return PopsInstanceUtils.getPopsMaxZIndex().zIndex;
8741
+ return popsUtils.getMaxZIndexNodeInfoFromPoint(this.$ele.button)[0].zIndex;
8607
8742
  },
8608
8743
  isFixed: true,
8609
8744
  className: "github-tooltip",
@@ -11194,91 +11329,31 @@ const PanelHandlerComponents = () => {
11194
11329
  className: "pops-panel-deepMenu-container-left-arrow-icon",
11195
11330
  innerHTML: PopsIcon.getIcon("arrowLeft"),
11196
11331
  });
11197
- // 动画配置
11198
- const animOptions = {
11199
- // 150 220 300
11200
- duration: 220,
11201
- easing: "ease-in-out",
11202
- };
11203
- // 进入动画
11204
- const enterViewTransition = () => {
11205
- // 隐藏旧的容器
11206
- popsDOMUtils.cssHide($currentSection, true);
11207
- popsDOMUtils.on($headerLeftArrow, "click", async (event) => {
11208
- popsDOMUtils.preventEvent(event);
11209
- // 返回动画
11210
- const leaveViewTransition = () => {
11211
- const $prev = $currentSection;
11212
- popsDOMUtils.cssShow($prev);
11213
- $deepMenuSection.remove();
11214
- };
11215
- // 返回上一层菜单
11216
- if (that.$config.useDeepMenuSwtichAnimation && document.startViewTransition) {
11217
- const leaveTransition = document.startViewTransition(leaveViewTransition);
11218
- await leaveTransition.ready;
11219
- // 向右移出
11220
- await Promise.all([
11221
- $deepMenuSection.animate([
11222
- {
11223
- // from
11224
- transform: "translateX(0)",
11225
- },
11226
- {
11227
- // to
11228
- transform: "translateX(100%)",
11229
- },
11230
- ], animOptions).finished,
11231
- // 向右移入
11232
- $currentSection.animate([
11233
- {
11234
- // from
11235
- transform: "translateX(-100%)",
11236
- },
11237
- {
11238
- // to
11239
- transform: "translateX(0)",
11240
- },
11241
- ], animOptions).finished,
11242
- ]);
11243
- await leaveTransition.finished;
11244
- }
11245
- else {
11246
- leaveViewTransition();
11247
- }
11248
- that.emitRenderRightContainer($currentSection);
11249
- }, {
11250
- once: true,
11251
- });
11252
- popsDOMUtils.before($header.firstElementChild, $headerLeftArrow);
11253
- $deepMenuHeaderUL.appendChild($header);
11254
- $deepMenuSection.appendChild($deepMenuHeaderUL);
11255
- $deepMenuSection.appendChild($deepMenuMain);
11256
- if (viewConfig.views && Array.isArray(viewConfig.views)) {
11257
- for (let index = 0; index < viewConfig.views.length; index++) {
11258
- const formItemConfig = viewConfig.views[index];
11259
- this.initContainerItem($deepMenuMain, formItemConfig);
11332
+ const switchAnim = PopsAnimation.createSwitchElementWithAnimation($currentSection, $deepMenuSection, {
11333
+ useAnimation: that.$config.useDeepMenuSwtichAnimation,
11334
+ enterToAddElementCallback: () => {
11335
+ popsDOMUtils.on($headerLeftArrow, "click", async (event) => {
11336
+ popsDOMUtils.preventEvent(event);
11337
+ // 返回动画
11338
+ await switchAnim.exit();
11339
+ that.emitRenderRightContainer($currentSection);
11340
+ }, {
11341
+ once: true,
11342
+ });
11343
+ popsDOMUtils.before($header.firstElementChild, $headerLeftArrow);
11344
+ $deepMenuHeaderUL.appendChild($header);
11345
+ $deepMenuSection.appendChild($deepMenuHeaderUL);
11346
+ $deepMenuSection.appendChild($deepMenuMain);
11347
+ if (viewConfig.views && Array.isArray(viewConfig.views)) {
11348
+ for (let index = 0; index < viewConfig.views.length; index++) {
11349
+ const formItemConfig = viewConfig.views[index];
11350
+ this.initContainerItem($deepMenuMain, formItemConfig);
11351
+ }
11260
11352
  }
11261
- }
11262
- that.$el.$panelRightSectionWrapper.appendChild($deepMenuSection);
11263
- };
11264
- if (that.$config.useDeepMenuSwtichAnimation && document.startViewTransition) {
11265
- const transition = document.startViewTransition(enterViewTransition);
11266
- await transition.ready;
11267
- await $deepMenuSection.animate([
11268
- {
11269
- // from
11270
- transform: "translateX(100%)",
11271
- },
11272
- {
11273
- // to
11274
- transform: "translateX(0)",
11275
- },
11276
- ], animOptions).finished;
11277
- await transition.finished;
11278
- }
11279
- else {
11280
- enterViewTransition();
11281
- }
11353
+ that.$el.$panelRightSectionWrapper.appendChild($deepMenuSection);
11354
+ },
11355
+ });
11356
+ await switchAnim.enter();
11282
11357
  if (typeof viewConfig.afterEnterDeepMenuCallBack === "function") {
11283
11358
  viewConfig.afterEnterDeepMenuCallBack(viewConfig, {
11284
11359
  $sectionContainer: $deepMenuSection,
@@ -11450,11 +11525,9 @@ const PanelHandlerComponents = () => {
11450
11525
  */
11451
11526
  emitRenderRightContainer($container) {
11452
11527
  const dataViewConfig = Reflect.get($container, this.$data.nodeStoreConfigKey);
11453
- this.$el.$pops.dispatchEvent(new CustomEvent("pops:renderRightContainer", {
11454
- detail: {
11455
- viewConfig: dataViewConfig,
11456
- },
11457
- }));
11528
+ this.emitter.emit("pops:renderRightContainer", {
11529
+ viewConfig: dataViewConfig,
11530
+ });
11458
11531
  },
11459
11532
  /**
11460
11533
  *
@@ -11524,6 +11597,7 @@ const PopsPanel = {
11524
11597
  const guid = popsUtils.getRandomGUID();
11525
11598
  // 设置当前类型
11526
11599
  const popsType = "panel";
11600
+ const emitter = new EventEmiter(popsType);
11527
11601
  let config = PopsPanelDefaultConfig();
11528
11602
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
11529
11603
  config = popsUtils.assign(config, __config__);
@@ -11560,7 +11634,7 @@ const PopsPanel = {
11560
11634
  },
11561
11635
  ]);
11562
11636
  // 先把z-index提取出来
11563
- const zIndex = PopsHandler.handleZIndex(config.zIndex);
11637
+ const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
11564
11638
  const maskHTML = PopsElementHandler.createMask(guid, zIndex);
11565
11639
  const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
11566
11640
  const { headerStyle, headerPStyle } = PopsElementHandler.createHeaderStyle(popsType, config);
@@ -11618,15 +11692,13 @@ const PopsPanel = {
11618
11692
  $elList.push($mask);
11619
11693
  }
11620
11694
  // 处理返回的配置
11621
- const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
11695
+ const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, emitter, $mask);
11622
11696
  const result = PopsHandler.handleResultConfig(evtConfig);
11623
11697
  // 为顶部右边的关闭按钮添加点击事件
11624
11698
  PopsHandler.handleClickEvent("close", $headerBtnClose, evtConfig, config.btn?.close?.callback);
11625
11699
  // 创建到页面中
11626
11700
  popsDOMUtils.append($shadowRoot, $elList);
11627
- if (typeof config.beforeAppendToPageCallBack === "function") {
11628
- config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
11629
- }
11701
+ emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
11630
11702
  popsDOMUtils.appendBody($shadowContainer);
11631
11703
  // 追加遮罩层元素
11632
11704
  if ($mask != null) {
@@ -11649,6 +11721,7 @@ const PopsPanel = {
11649
11721
  $panelBottomLeftContainer,
11650
11722
  $panelBottomRightContainer,
11651
11723
  },
11724
+ emitter,
11652
11725
  });
11653
11726
  PopsHandler.handlePush(popsType, {
11654
11727
  guid: guid,
@@ -11658,11 +11731,11 @@ const PopsPanel = {
11658
11731
  $shadowContainer: $shadowContainer,
11659
11732
  $shadowRoot: $shadowRoot,
11660
11733
  config: config,
11661
- destory: result.close,
11734
+ emitter,
11662
11735
  });
11663
11736
  // 拖拽
11664
11737
  if (config.drag) {
11665
- PopsInstanceUtils.drag($pops, {
11738
+ PopsInstHandler.drag($pops, {
11666
11739
  dragElement: $title,
11667
11740
  limit: config.dragLimit,
11668
11741
  extraDistance: config.dragExtraDistance,
@@ -11670,15 +11743,21 @@ const PopsPanel = {
11670
11743
  endCallBack: config.dragEndCallBack,
11671
11744
  });
11672
11745
  }
11673
- return {
11674
- ...result,
11675
- addEventListener: (event, listener, options) => {
11676
- $pops.addEventListener(event, listener, options);
11677
- },
11678
- removeEventListener: (event, listener, options) => {
11679
- $pops.removeEventListener(event, listener, options);
11680
- },
11681
- };
11746
+ if (config.listenEscapeKeyUpToExitDeepMenu) {
11747
+ const escapeListener = popsDOMUtils.onKeyup(globalThis, (evt) => {
11748
+ if (evt.key === "Escape" && !evt.ctrlKey && !evt.shiftKey && !evt.altKey && !evt.metaKey) {
11749
+ // Esc
11750
+ const $exitBtn = $panelRightSectionWrapper.querySelector(".pops-panel-deepMenu-container-left-arrow-icon");
11751
+ if ($exitBtn) {
11752
+ $exitBtn.click();
11753
+ }
11754
+ }
11755
+ }, { capture: true });
11756
+ emitter.on("pops:before-destory", () => {
11757
+ escapeListener?.off();
11758
+ });
11759
+ }
11760
+ return result;
11682
11761
  },
11683
11762
  };
11684
11763
 
@@ -11782,6 +11861,7 @@ const PopsPrompt = {
11782
11861
  const guid = popsUtils.getRandomGUID();
11783
11862
  // 设置当前类型
11784
11863
  const popsType = "prompt";
11864
+ const emitter = new EventEmiter(popsType);
11785
11865
  let config = PopsPromptDefaultConfig();
11786
11866
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
11787
11867
  config = popsUtils.assign(config, __config__);
@@ -11818,7 +11898,7 @@ const PopsPrompt = {
11818
11898
  },
11819
11899
  ]);
11820
11900
  // 先把z-index提取出来
11821
- const zIndex = PopsHandler.handleZIndex(config.zIndex);
11901
+ const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
11822
11902
  const maskHTML = PopsElementHandler.createMask(guid, zIndex);
11823
11903
  const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
11824
11904
  const bottomBtnHTML = PopsElementHandler.createBottom(popsType, config);
@@ -11863,7 +11943,7 @@ const PopsPrompt = {
11863
11943
  $mask = handleMask.maskElement;
11864
11944
  $elList.push($mask);
11865
11945
  }
11866
- const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
11946
+ const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, emitter, $mask);
11867
11947
  const result = PopsHandler.handleResultConfig(evtConfig);
11868
11948
  // 输入框赋值初始值
11869
11949
  $input.value = config.content.text;
@@ -11873,9 +11953,7 @@ const PopsPrompt = {
11873
11953
  PopsHandler.handlePromptClickEvent("other", $input, $btnOther, evtConfig, config.btn.other.callback);
11874
11954
  // 创建到页面中
11875
11955
  popsDOMUtils.append($shadowRoot, $elList);
11876
- if (typeof config.beforeAppendToPageCallBack === "function") {
11877
- config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
11878
- }
11956
+ emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
11879
11957
  popsDOMUtils.appendBody($shadowContainer);
11880
11958
  if ($mask != null) {
11881
11959
  $anim.after($mask);
@@ -11888,11 +11966,11 @@ const PopsPrompt = {
11888
11966
  $shadowContainer: $shadowContainer,
11889
11967
  $shadowRoot: $shadowRoot,
11890
11968
  config: config,
11891
- destory: result.close,
11969
+ emitter,
11892
11970
  });
11893
11971
  // 拖拽
11894
11972
  if (config.drag) {
11895
- PopsInstanceUtils.drag($pops, {
11973
+ PopsInstHandler.drag($pops, {
11896
11974
  dragElement: $title,
11897
11975
  limit: config.dragLimit,
11898
11976
  extraDistance: config.dragExtraDistance,
@@ -12020,6 +12098,7 @@ const PopsRightClickMenu = {
12020
12098
  const guid = popsUtils.getRandomGUID();
12021
12099
  // 设置当前类型
12022
12100
  const popsType = "rightClickMenu";
12101
+ const emitter = new EventEmiter(popsType);
12023
12102
  let config = PopsRightClickMenuDefaultConfig();
12024
12103
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
12025
12104
  config = popsUtils.assign(config, __config__);
@@ -12148,13 +12227,14 @@ const PopsRightClickMenu = {
12148
12227
  guid: guid,
12149
12228
  $anim: rootElement,
12150
12229
  $pops: rootElement,
12151
- beforeRemoveCallBack(instCommonConfig) {
12152
- PopsContextMenu.closeAllMenu(instCommonConfig.$pops);
12153
- },
12154
12230
  config: config,
12155
- destory: () => {
12156
- PopsContextMenu.closeAllMenu(rootElement);
12157
- },
12231
+ emitter,
12232
+ });
12233
+ emitter.on("pops:before-destory", () => {
12234
+ PopsContextMenu.closeAllMenu(rootElement);
12235
+ });
12236
+ emitter.on("pops:destory", () => {
12237
+ PopsContextMenu.closeAllMenu(rootElement);
12158
12238
  });
12159
12239
  }
12160
12240
  },
@@ -12242,6 +12322,7 @@ const PopsRightClickMenu = {
12242
12322
  });
12243
12323
  const zIndex = this.getMenuZIndex();
12244
12324
  if (zIndex > 10000) {
12325
+ // 大于默认值
12245
12326
  $menu.style.zIndex = zIndex.toString();
12246
12327
  }
12247
12328
  if (isChildren) {
@@ -12262,7 +12343,7 @@ const PopsRightClickMenu = {
12262
12343
  * 动态获取配的z-index
12263
12344
  */
12264
12345
  getMenuZIndex() {
12265
- return PopsHandler.handleZIndex(config.zIndex);
12346
+ return PopsHandler.getTargerOrFunctionValue(config.zIndex);
12266
12347
  },
12267
12348
  /**
12268
12349
  * 获取left、top偏移
@@ -12376,9 +12457,7 @@ const PopsRightClickMenu = {
12376
12457
  popsDOMUtils.append($shadowRoot, menuElement);
12377
12458
  // 判断容器是否存在
12378
12459
  if (!document.contains($shadowContainer)) {
12379
- if (typeof config.beforeAppendToPageCallBack === "function") {
12380
- config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
12381
- }
12460
+ emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
12382
12461
  popsDOMUtils.appendBody($shadowContainer);
12383
12462
  }
12384
12463
  this.handlerShowMenuCSS(menuElement, menuEvent);
@@ -12653,6 +12732,7 @@ const PopsSearchSuggestion = {
12653
12732
  const guid = popsUtils.getRandomGUID();
12654
12733
  // 设置当前类型
12655
12734
  const popsType = "searchSuggestion";
12735
+ const emitter = new EventEmiter(popsType);
12656
12736
  let config = PopsSearchSuggestionDefaultConfig();
12657
12737
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
12658
12738
  config = popsUtils.assign(config, __config__);
@@ -12689,6 +12769,7 @@ const PopsSearchSuggestion = {
12689
12769
  passive: true,
12690
12770
  };
12691
12771
  const SearchSuggestion = {
12772
+ emitter: emitter,
12692
12773
  /**
12693
12774
  * 当前的环境,可以是document,可以是shadowroot,默认是document
12694
12775
  */
@@ -12904,7 +12985,7 @@ const PopsSearchSuggestion = {
12904
12985
  border: initial;
12905
12986
  overflow: initial;
12906
12987
  position: ${config.isAbsolute ? "absolute" : "fixed"};
12907
- z-index: ${PopsHandler.handleZIndex(config.zIndex)};
12988
+ z-index: ${PopsHandler.getTargerOrFunctionValue(config.zIndex)};
12908
12989
  }
12909
12990
  .pops-${popsType}-search-suggestion-dropdown-wrapper{
12910
12991
  max-height: ${config.maxHeight};
@@ -13427,7 +13508,87 @@ const PopsSearchSuggestion = {
13427
13508
  },
13428
13509
  };
13429
13510
 
13430
- const version = "3.3.5";
13511
+ const PopsInstanceUtils = {
13512
+ /**
13513
+ * 获取pops所有弹窗中的最大的z-index
13514
+ * @param deviation
13515
+ */
13516
+ getPopsMaxZIndex(deviation = 1) {
13517
+ deviation = Number.isNaN(deviation) ? 1 : deviation;
13518
+ // 最大值 2147483647
13519
+ // const browserMaxZIndex = Math.pow(2, 31) - 1;
13520
+ // 比较值 2000000000
13521
+ const maxZIndex = 2 * Math.pow(10, 9);
13522
+ // 当前页面最大的z-index
13523
+ let zIndex = 0;
13524
+ // 当前的最大z-index的元素,调试使用
13525
+ let maxZIndexNode = null;
13526
+ Object.keys(PopsInstData).forEach((instKeyName) => {
13527
+ const instData = PopsInstData[instKeyName];
13528
+ for (let index = 0; index < instData.length; index++) {
13529
+ const inst = instData[index];
13530
+ // 不对position为static和display为none的元素进行获取它们的z-index
13531
+ const $elList = [inst.$anim, inst.$pops, inst.$mask].filter((it) => it instanceof HTMLElement);
13532
+ const nodeZIndexInfoList = popsUtils.getMaxZIndexNodeInfoFromPoint($elList);
13533
+ const maxNodeZIndexInfo = nodeZIndexInfoList[0];
13534
+ if (maxNodeZIndexInfo) {
13535
+ const nodeZIndex = maxNodeZIndexInfo.zIndex;
13536
+ if (nodeZIndex > zIndex) {
13537
+ zIndex = nodeZIndex;
13538
+ maxZIndexNode = maxNodeZIndexInfo.node || maxNodeZIndexInfo.positionNode;
13539
+ }
13540
+ }
13541
+ }
13542
+ });
13543
+ zIndex += deviation;
13544
+ const isOverMaxZIndex = zIndex >= maxZIndex;
13545
+ if (isOverMaxZIndex) {
13546
+ // 超出z-index最大值
13547
+ zIndex = maxZIndex;
13548
+ }
13549
+ return { zIndex: zIndex, animElement: maxZIndexNode, isOverMaxZIndex };
13550
+ },
13551
+ /**
13552
+ * 排序数组
13553
+ * @param getBeforeValueFun
13554
+ * @param getAfterValueFun
13555
+ * @param sortByDesc 排序是否降序,默认降序
13556
+ */
13557
+ sortElementListByProperty(getBeforeValueFun, getAfterValueFun, sortByDesc = true) {
13558
+ if (typeof sortByDesc !== "boolean") {
13559
+ throw new TypeError("参数 sortByDesc 必须为boolean类型");
13560
+ }
13561
+ if (getBeforeValueFun == null || getAfterValueFun == null) {
13562
+ throw new Error("获取前面的值或后面的值的方法不能为空");
13563
+ }
13564
+ return function (after_obj, before_obj) {
13565
+ const beforeValue = getBeforeValueFun(before_obj); // 前
13566
+ const afterValue = getAfterValueFun(after_obj); // 后
13567
+ if (sortByDesc) {
13568
+ if (afterValue > beforeValue) {
13569
+ return -1;
13570
+ }
13571
+ else if (afterValue < beforeValue) {
13572
+ return 1;
13573
+ }
13574
+ else {
13575
+ return 0;
13576
+ }
13577
+ }
13578
+ else {
13579
+ if (afterValue < beforeValue) {
13580
+ return -1;
13581
+ }
13582
+ else if (afterValue > beforeValue) {
13583
+ return 1;
13584
+ }
13585
+ else {
13586
+ return 0;
13587
+ }
13588
+ }
13589
+ };
13590
+ },
13591
+ };
13431
13592
 
13432
13593
  class Pops {
13433
13594
  /** 配置 */
@@ -13456,7 +13617,11 @@ class Pops {
13456
13617
  /** pops处理float类型使用的工具类 */
13457
13618
  MathFloatUtils: PopsMathFloatUtils,
13458
13619
  /** pops.panel中用于处理各个类型的工具 */
13459
- PanelHandlerComponents: PanelHandlerComponents,
13620
+ PanelHandlerComponents,
13621
+ /** pops.panel中的动画 */
13622
+ PopsAnimation,
13623
+ /** 事件类 */
13624
+ EventEmiter,
13460
13625
  };
13461
13626
  init() { }
13462
13627
  /**