@whitesev/pops 4.0.2 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/index.amd.js +227 -141
  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 +227 -141
  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 +227 -141
  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 +227 -141
  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 +227 -141
  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 +227 -141
  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 +109 -10
  26. package/dist/types/src/components/loading/types/index.d.ts +1 -1
  27. package/dist/types/src/components/panel/index.d.ts +3 -2
  28. package/dist/types/src/components/rightClickMenu/types/index.d.ts +1 -1
  29. package/dist/types/src/components/searchSuggestion/types/index.d.ts +1 -1
  30. package/dist/types/src/components/tooltip/index.d.ts +82 -1
  31. package/dist/types/src/components/tooltip/types/index.d.ts +1 -1
  32. package/dist/types/src/config/GlobalConfig.d.ts +3 -3
  33. package/dist/types/src/event/EventEmiter.d.ts +7 -1
  34. package/dist/types/src/handler/PopsInstHandler.d.ts +4 -4
  35. package/dist/types/src/types/EventEmitter.d.ts +21 -0
  36. package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +1 -1
  37. package/dist/types/src/types/components.d.ts +15 -18
  38. package/dist/types/src/types/global.d.ts +2 -0
  39. package/dist/types/src/utils/PopsDOMUtils.d.ts +14 -2
  40. package/dist/types/src/utils/PopsUtils.d.ts +20 -15
  41. package/package.json +1 -1
  42. package/src/Pops.ts +3 -0
  43. package/src/components/alert/defaultConfig.ts +1 -1
  44. package/src/components/alert/index.ts +1 -1
  45. package/src/components/confirm/defaultConfig.ts +1 -1
  46. package/src/components/confirm/index.ts +1 -1
  47. package/src/components/drawer/defaultConfig.ts +1 -1
  48. package/src/components/drawer/index.ts +2 -1
  49. package/src/components/folder/defaultConfig.ts +1 -1
  50. package/src/components/folder/index.ts +1 -1
  51. package/src/components/iframe/defaultConfig.ts +1 -1
  52. package/src/components/iframe/index.ts +10 -6
  53. package/src/components/loading/defaultConfig.ts +1 -0
  54. package/src/components/loading/index.ts +10 -10
  55. package/src/components/loading/types/index.ts +1 -4
  56. package/src/components/panel/defaultConfig.ts +1 -1
  57. package/src/components/panel/index.ts +3 -2
  58. package/src/components/prompt/defaultConfig.ts +1 -1
  59. package/src/components/prompt/index.ts +1 -1
  60. package/src/components/rightClickMenu/defaultConfig.ts +1 -1
  61. package/src/components/rightClickMenu/index.ts +1 -1
  62. package/src/components/rightClickMenu/types/index.ts +1 -1
  63. package/src/components/searchSuggestion/defaultConfig.ts +1 -0
  64. package/src/components/searchSuggestion/index.ts +1 -1
  65. package/src/components/searchSuggestion/types/index.ts +1 -1
  66. package/src/components/tooltip/defaultConfig.ts +1 -1
  67. package/src/components/tooltip/index.ts +1 -1
  68. package/src/components/tooltip/types/index.ts +1 -1
  69. package/src/event/EventEmiter.ts +15 -14
  70. package/src/handler/PopsInstHandler.ts +64 -47
  71. package/src/types/EventEmitter.d.ts +21 -0
  72. package/src/types/PopsDOMUtilsEventType.d.ts +1 -1
  73. package/src/types/components.d.ts +15 -18
  74. package/src/types/global.d.ts +2 -0
  75. package/src/utils/PopsDOMUtils.ts +32 -2
  76. package/src/utils/PopsUtils.ts +94 -67
@@ -1,7 +1,7 @@
1
1
  var pops = (function () {
2
2
  'use strict';
3
3
 
4
- const version = "4.0.2";
4
+ const version = "4.1.0";
5
5
 
6
6
  const GlobalConfig = {
7
7
  config: {},
@@ -60,15 +60,16 @@ var pops = (function () {
60
60
  };
61
61
 
62
62
  class EventEmiter {
63
- #type;
64
- #data = new Map();
63
+ [Symbol.toStringTag] = "EventEmiter";
64
+ type;
65
+ data = new Map();
65
66
  constructor(type) {
66
- this.#type = type;
67
+ this.type = type;
67
68
  }
68
69
  on(eventName, callback) {
69
- const eventList = this.#data.get(eventName) ?? [];
70
- eventList.push({ type: this.#type, time: Date.now(), callback: callback });
71
- this.#data.set(eventName, eventList);
70
+ const eventList = this.data.get(eventName) ?? [];
71
+ eventList.push({ type: this.type, time: Date.now(), callback: callback });
72
+ this.data.set(eventName, eventList);
72
73
  return {
73
74
  off: () => {
74
75
  this.off(eventName, callback);
@@ -79,7 +80,7 @@ var pops = (function () {
79
80
  };
80
81
  }
81
82
  off(eventName, callback) {
82
- const eventList = this.#data.get(eventName) ?? [];
83
+ const eventList = this.data.get(eventName) ?? [];
83
84
  let isOffSuccess = false;
84
85
  for (let index = eventList.length - 1; index >= 0; index--) {
85
86
  if (eventList[index].callback === callback) {
@@ -89,27 +90,27 @@ var pops = (function () {
89
90
  }
90
91
  if (eventList.length === 0) {
91
92
  // empty
92
- this.#data.delete(eventName);
93
+ this.data.delete(eventName);
93
94
  }
94
95
  else {
95
96
  if (isOffSuccess) {
96
97
  // update
97
- this.#data.set(eventName, eventList);
98
+ this.data.set(eventName, eventList);
98
99
  }
99
100
  }
100
101
  }
101
102
  async emit(eventName, ...args) {
102
- const eventList = this.#data.get(eventName) ?? [];
103
+ const eventList = this.data.get(eventName) ?? [];
103
104
  for (const item of eventList) {
104
105
  await item.callback(...args);
105
106
  }
106
107
  }
107
108
  offAll(eventName) {
108
109
  if (typeof eventName === "string") {
109
- this.#data.delete(eventName);
110
+ this.data.delete(eventName);
110
111
  }
111
112
  else {
112
- this.#data.clear();
113
+ this.data.clear();
113
114
  }
114
115
  }
115
116
  /**
@@ -117,10 +118,10 @@ var pops = (function () {
117
118
  */
118
119
  getAllEvents(eventName) {
119
120
  if (typeof eventName === "string") {
120
- return this.#data.get(eventName);
121
+ return this.data.get(eventName);
121
122
  }
122
123
  else {
123
- return Array.from(this.#data.values());
124
+ return Array.from(this.data.values());
124
125
  }
125
126
  }
126
127
  }
@@ -431,7 +432,8 @@ var pops = (function () {
431
432
  if (typeof sourceValue === "object" &&
432
433
  sourceValue != null &&
433
434
  keyName in target &&
434
- !UtilsContext.isDOM(sourceValue)) {
435
+ !UtilsContext.isDOM(sourceValue) &&
436
+ !(sourceValue instanceof EventEmiter)) {
435
437
  // 源端的值是object类型,且不是元素节点
436
438
  // 如果是数组,那此数组中有值,清空旧的数组再赋值
437
439
  let childObjectValue;
@@ -447,7 +449,7 @@ var pops = (function () {
447
449
  Reflect.set(target, keyName, childObjectValue);
448
450
  }
449
451
  else {
450
- /* 直接赋值 */
452
+ // 直接赋值
451
453
  Reflect.set(target, keyName, sourceValue);
452
454
  }
453
455
  }
@@ -637,33 +639,31 @@ var pops = (function () {
637
639
  if (typeof deviation !== "number" || Number.isNaN(deviation)) {
638
640
  deviation = 10;
639
641
  }
640
- const leftTop = {
641
- x: globalThis.innerWidth * (1 / 8),
642
- y: globalThis.innerHeight * (1 / 8),
643
- };
644
- const leftBottom = {
645
- x: globalThis.innerWidth * (1 / 8),
646
- y: globalThis.innerHeight * (7 / 8),
647
- };
648
- const rightTop = {
649
- x: globalThis.innerWidth * (7 / 8),
650
- y: globalThis.innerHeight * (1 / 8),
651
- };
652
- const rightBottom = {
653
- x: globalThis.innerWidth * (7 / 8),
654
- y: globalThis.innerHeight * (7 / 8),
655
- };
656
- const center = {
657
- x: globalThis.innerWidth / 2,
658
- y: globalThis.innerHeight / 2,
659
- };
660
- const delayHandlerElementPostionList = [
661
- leftTop,
662
- leftBottom,
663
- rightTop,
664
- rightBottom,
665
- center,
666
- ];
642
+ /** 坐标偏移 */
643
+ const positionDistance = 10;
644
+ const defaultCalcPostion = [];
645
+ const maxPostionX = globalThis.innerWidth;
646
+ const maxPostionY = globalThis.innerHeight;
647
+ const gridXCount = 8;
648
+ const gridYCount = 8;
649
+ for (let i = 0; i < gridXCount; i++) {
650
+ for (let j = 0; j < gridYCount; j++) {
651
+ const positionX = globalThis.innerWidth * (i / gridXCount) + positionDistance;
652
+ const positionY = globalThis.innerHeight * (j / gridYCount) + positionDistance;
653
+ const position = {
654
+ x: positionX,
655
+ y: positionY,
656
+ };
657
+ if (position.x > maxPostionX) {
658
+ position.x = maxPostionX;
659
+ }
660
+ if (position.y > maxPostionY) {
661
+ position.y = maxPostionY;
662
+ }
663
+ defaultCalcPostion.push(position);
664
+ }
665
+ }
666
+ const delayHandlerElementPostionList = defaultCalcPostion;
667
667
  if ($el) {
668
668
  delayHandlerElementPostionList.length = 0;
669
669
  if (Array.isArray($el)) {
@@ -675,61 +675,79 @@ var pops = (function () {
675
675
  }
676
676
  const positionInfoList = delayHandlerElementPostionList
677
677
  .map((position) => {
678
- let positionNode;
678
+ let $position;
679
679
  let positionX;
680
680
  let positionY;
681
681
  if (position instanceof HTMLElement) {
682
- positionNode = position;
682
+ $position = position;
683
683
  const nodeRect = position.getBoundingClientRect();
684
684
  positionX = nodeRect.x + nodeRect.width / 2;
685
685
  positionY = nodeRect.y + nodeRect.height / 2;
686
686
  }
687
687
  else {
688
- positionNode = document.elementFromPoint(position.x, position.y);
688
+ $position = document.elementFromPoint(position.x, position.y);
689
689
  positionX = position.x;
690
690
  positionY = position.y;
691
691
  }
692
- const shadowRoot = positionNode?.shadowRoot;
692
+ const shadowRoot = $position?.shadowRoot;
693
693
  if (shadowRoot) {
694
- positionNode = shadowRoot.elementFromPoint(positionX, positionY);
694
+ // 处理ShadowRoot
695
+ $position = shadowRoot.elementFromPoint(positionX, positionY);
695
696
  }
696
- if (positionNode instanceof HTMLStyleElement)
697
- return;
698
- if (positionNode instanceof HTMLScriptElement)
699
- return;
700
- if (positionNode instanceof HTMLMetaElement)
701
- return;
702
- if (positionNode instanceof HTMLHeadElement)
703
- return;
704
- if (!(positionNode instanceof HTMLElement))
697
+ if (!($position instanceof HTMLElement))
705
698
  return;
706
- let parent = positionNode;
699
+ let $parent = $position;
707
700
  let zIndex = 0;
708
- let maxZIndexNode = null;
709
- while (parent) {
710
- const nodeStyle = globalThis.getComputedStyle(parent);
701
+ let $maxZIndexNode = null;
702
+ let rect = {
703
+ x: 0,
704
+ y: 0,
705
+ width: 0,
706
+ height: 0,
707
+ top: 0,
708
+ right: 0,
709
+ bottom: 0,
710
+ left: 0,
711
+ };
712
+ while ($parent) {
713
+ const nodeStyle = globalThis.getComputedStyle($parent);
711
714
  const nodeZIndex = parseInt(nodeStyle.zIndex);
712
715
  if (nodeStyle.position !== "static" && !isNaN(nodeZIndex)) {
713
716
  if (nodeZIndex > zIndex) {
714
717
  zIndex = nodeZIndex;
715
- maxZIndexNode = parent;
716
- }
717
- }
718
- parent = parent.parentElement;
718
+ $maxZIndexNode = $parent;
719
+ }
720
+ }
721
+ $parent = $parent.parentElement;
722
+ }
723
+ if ($maxZIndexNode) {
724
+ const maxRect = $maxZIndexNode.getBoundingClientRect();
725
+ rect = {
726
+ x: maxRect.x,
727
+ y: maxRect.y,
728
+ width: maxRect.width,
729
+ height: maxRect.height,
730
+ top: maxRect.top,
731
+ right: maxRect.right,
732
+ bottom: maxRect.bottom,
733
+ left: maxRect.left,
734
+ };
719
735
  }
720
736
  return {
721
- /** 处理了偏移量后的z-index值 */
737
+ /** 计算偏移量后的z-index值 */
722
738
  zIndex: zIndex + deviation,
723
- /** 原始z-index值 */
739
+ /** 获取到的最大的z-index值 */
724
740
  originZIndex: zIndex,
725
741
  /** 拥有最大z-index的元素 */
726
- node: maxZIndexNode,
742
+ node: $maxZIndexNode,
727
743
  /** 目标坐标元素 */
728
- positionNode: positionNode,
729
- /** x坐标 */
744
+ positionNode: $position,
745
+ /** 目标x坐标 */
730
746
  positionX: positionX,
731
- /** y坐标 */
747
+ /** 目标y坐标 */
732
748
  positionY: positionY,
749
+ /** node位置信息 */
750
+ rect,
733
751
  };
734
752
  })
735
753
  .filter((it) => it != null);
@@ -780,10 +798,17 @@ var pops = (function () {
780
798
  const PopsCommonCSSClassName = {
781
799
  flexCenter: "pops-flex-items-center",
782
800
  flexYCenter: "pops-flex-y-center",
801
+ flexXCenter: "pops-flex-x-center",
783
802
  hide: "pops-hide",
784
803
  hideImportant: "pops-hide-important",
804
+ noBorder: "pops-no-border",
805
+ noBorderImportant: "pops-no-border-important",
785
806
  userSelectNone: "pops-user-select-none",
786
- textIsDisabled: "pops-text-is-disabled"};
807
+ lineHeightCenter: "pops-line-height-center",
808
+ widthFill: "pops-width-fill",
809
+ textIsDisabled: "pops-text-is-disabled",
810
+ textIsDisabledImportant: "pops-text-is-disabled-important",
811
+ };
787
812
 
788
813
  class PopsDOMUtilsEvent {
789
814
  on(element, eventType, selector, callback, option) {
@@ -1683,6 +1708,35 @@ var pops = (function () {
1683
1708
  getTransitionEndNameList() {
1684
1709
  return ["webkitTransitionEnd", "mozTransitionEnd", "MSTransitionEnd", "otransitionend", "transitionend"];
1685
1710
  }
1711
+ /**
1712
+ * 是否是隐藏状态
1713
+ *
1714
+ * 检测以下项:
1715
+ *
1716
+ * + `display`: none
1717
+ * + `visibility`: hidden
1718
+ * + `opacity`: 0
1719
+ * + `使用了pops的自定义的隐藏class类`
1720
+ * @param $el 需要检测的元素
1721
+ */
1722
+ isHide($el) {
1723
+ let flag = false;
1724
+ if (this.containsClassName($el, PopsCommonCSSClassName.hide) ||
1725
+ this.containsClassName($el, PopsCommonCSSClassName.hideImportant)) {
1726
+ flag = true;
1727
+ }
1728
+ else {
1729
+ if ($el instanceof HTMLElement) {
1730
+ const style = $el.style;
1731
+ flag = style.display.includes("none") || style.visibility.includes("hidden") || style.opacity !== "0";
1732
+ }
1733
+ if (!flag) {
1734
+ const style = globalThis.getComputedStyle($el);
1735
+ flag = style.display.includes("none") || style.visibility.includes("hidden") || style.opacity !== "0";
1736
+ }
1737
+ }
1738
+ return flag;
1739
+ }
1686
1740
  /**
1687
1741
  * 实现jQuery中的$().offset();
1688
1742
  * @param element
@@ -3191,7 +3245,7 @@ var pops = (function () {
3191
3245
  return totalInstConfigList;
3192
3246
  },
3193
3247
  /**
3194
- * 隐藏
3248
+ * 显示
3195
3249
  * @param popsType
3196
3250
  * @param instConfigList
3197
3251
  * @param guid
@@ -3199,24 +3253,34 @@ var pops = (function () {
3199
3253
  * @param $anim
3200
3254
  * @param $mask
3201
3255
  */
3202
- hide(config, popsType, instConfigList, guid, $anim, $mask) {
3256
+ show(config, popsType, instConfigList, guid, $anim, $mask) {
3203
3257
  // oxlint-disable-next-line no-async-promise-executor
3204
3258
  return new Promise(async (resolve) => {
3205
3259
  const $pops = $anim.querySelector(".pops[type-value]");
3206
3260
  const fintInst = instConfigList.find((instConfigItem) => instConfigItem.guid === guid);
3207
3261
  if (fintInst) {
3208
- // 存在实例
3262
+ // 由于是隐蔽状态
3263
+ // 先设置好动画状态
3264
+ // 再显示,会自执行动画
3265
+ const checkVisible = () => {
3266
+ if (!popsDOMUtils.isHide($anim)) {
3267
+ return true;
3268
+ }
3269
+ else {
3270
+ return false;
3271
+ }
3272
+ };
3209
3273
  const startAnim = async () => {
3210
3274
  if (popsType === "drawer") {
3211
3275
  // drawer是抽屉
3212
3276
  // 单独处理动画
3213
3277
  const drawerConfig = config;
3214
- await popsUtils.sleep(drawerConfig.closeDelay ?? 0);
3278
+ await popsUtils.sleep(drawerConfig.openDelay ?? 0);
3215
3279
  if ($mask) {
3216
- popsDOMUtils.css($mask, "display", "none");
3280
+ popsDOMUtils.css($mask, "display", "");
3217
3281
  }
3218
3282
  const direction = drawerConfig.direction;
3219
- const size = "0";
3283
+ const size = drawerConfig.size.toString();
3220
3284
  if (["top", "bottom"].includes(direction)) {
3221
3285
  $pops.style.setProperty("height", size);
3222
3286
  }
@@ -3224,26 +3288,26 @@ var pops = (function () {
3224
3288
  $pops.style.setProperty("width", size);
3225
3289
  }
3226
3290
  else {
3227
- console.error("未知direction: ", direction);
3291
+ console.error("未知direction", direction);
3228
3292
  }
3229
3293
  }
3230
3294
  else {
3231
- instConfigItem.$anim.style.width = "100%";
3232
- instConfigItem.$anim.style.height = "100%";
3233
- Reflect.set(instConfigItem.$anim.style, "animation-name", instConfigItem.$anim.getAttribute("anim") + "-reverse");
3295
+ instConfigItem.$anim.style.width = "";
3296
+ instConfigItem.$anim.style.height = "";
3297
+ Reflect.set(instConfigItem.$anim.style, "animation-name", animName);
3234
3298
  }
3235
- };
3236
- const endCallback = () => {
3237
- instConfigItem.$anim.style.display = "none";
3299
+ instConfigItem.$anim.style.display = "";
3238
3300
  if (instConfigItem.$mask) {
3239
- instConfigItem.$mask.style.display = "none";
3301
+ instConfigItem.$mask.style.display = "";
3240
3302
  }
3241
- fintInst.emitter.emit("pops:hide", instConfigItem);
3303
+ };
3304
+ const endCallback = () => {
3305
+ fintInst.emitter.emit("pops:show", instConfigItem);
3242
3306
  };
3243
3307
  const instConfigItem = fintInst;
3244
- fintInst.emitter.emit("pops:before-hide", instConfigItem);
3245
- await startAnim();
3246
- if (PopsAnimation.hasAnim(Reflect.get(instConfigItem.$anim.style, "animation-name"))) {
3308
+ const animName = instConfigItem.$anim.getAttribute("anim").replace("-reverse", "");
3309
+ fintInst.emitter.emit("pops:before-show", instConfigItem);
3310
+ if (checkVisible() && PopsAnimation.hasAnim(animName)) {
3247
3311
  /**
3248
3312
  * 动画结束的回调
3249
3313
  */
@@ -3254,22 +3318,23 @@ var pops = (function () {
3254
3318
  };
3255
3319
  const listener = popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), animationendCallBack, {
3256
3320
  capture: true,
3257
- once: true,
3258
3321
  });
3322
+ await startAnim();
3259
3323
  }
3260
3324
  else {
3325
+ await startAnim();
3261
3326
  endCallback();
3262
3327
  resolve();
3263
3328
  }
3264
3329
  }
3265
3330
  else {
3266
- console.error("hide-error: 该实例未存储");
3331
+ console.error("show-error: 该实例未存储");
3267
3332
  resolve();
3268
3333
  }
3269
3334
  });
3270
3335
  },
3271
3336
  /**
3272
- * 显示
3337
+ * 隐藏
3273
3338
  * @param popsType
3274
3339
  * @param instConfigList
3275
3340
  * @param guid
@@ -3277,23 +3342,35 @@ var pops = (function () {
3277
3342
  * @param $anim
3278
3343
  * @param $mask
3279
3344
  */
3280
- show(config, popsType, instConfigList, guid, $anim, $mask) {
3345
+ hide(config, popsType, instConfigList, guid, $anim, $mask) {
3281
3346
  // oxlint-disable-next-line no-async-promise-executor
3282
3347
  return new Promise(async (resolve) => {
3283
3348
  const $pops = $anim.querySelector(".pops[type-value]");
3284
3349
  const fintInst = instConfigList.find((instConfigItem) => instConfigItem.guid === guid);
3285
3350
  if (fintInst) {
3351
+ // 由于是已显示状态
3352
+ // 先执行动画
3353
+ // 再隐藏
3354
+ // 存在实例
3355
+ const checkVisible = () => {
3356
+ if (!popsDOMUtils.isHide($anim)) {
3357
+ return true;
3358
+ }
3359
+ else {
3360
+ return false;
3361
+ }
3362
+ };
3286
3363
  const startAnim = async () => {
3287
3364
  if (popsType === "drawer") {
3288
3365
  // drawer是抽屉
3289
3366
  // 单独处理动画
3290
3367
  const drawerConfig = config;
3291
- await popsUtils.sleep(drawerConfig.openDelay ?? 0);
3368
+ await popsUtils.sleep(drawerConfig.closeDelay ?? 0);
3292
3369
  if ($mask) {
3293
- popsDOMUtils.css($mask, "display", "");
3370
+ popsDOMUtils.css($mask, "display", "none");
3294
3371
  }
3295
3372
  const direction = drawerConfig.direction;
3296
- const size = drawerConfig.size.toString();
3373
+ const size = "0";
3297
3374
  if (["top", "bottom"].includes(direction)) {
3298
3375
  $pops.style.setProperty("height", size);
3299
3376
  }
@@ -3301,26 +3378,27 @@ var pops = (function () {
3301
3378
  $pops.style.setProperty("width", size);
3302
3379
  }
3303
3380
  else {
3304
- console.error("未知direction", direction);
3381
+ console.error("未知direction: ", direction);
3305
3382
  }
3306
3383
  }
3307
3384
  else {
3308
- instConfigItem.$anim.style.width = "";
3309
- instConfigItem.$anim.style.height = "";
3310
- Reflect.set(instConfigItem.$anim.style, "animation-name", instConfigItem.$anim.getAttribute("anim").replace("-reverse", ""));
3385
+ instConfigItem.$anim.style.width = "100%";
3386
+ instConfigItem.$anim.style.height = "100%";
3387
+ Reflect.set(instConfigItem.$anim.style, "animation-name", reverseAnimName);
3311
3388
  }
3312
3389
  };
3313
3390
  const endCallback = () => {
3314
- instConfigItem.$anim.style.display = "";
3391
+ instConfigItem.$anim.style.display = "none";
3315
3392
  if (instConfigItem.$mask) {
3316
- instConfigItem.$mask.style.display = "";
3393
+ instConfigItem.$mask.style.display = "none";
3317
3394
  }
3318
- fintInst.emitter.emit("pops:show", instConfigItem);
3395
+ fintInst.emitter.emit("pops:hide", instConfigItem);
3319
3396
  };
3320
3397
  const instConfigItem = fintInst;
3321
- fintInst.emitter.emit("pops:before-show", instConfigItem);
3322
- await startAnim();
3323
- if (PopsAnimation.hasAnim(Reflect.get(instConfigItem.$anim.style, "animation-name"))) {
3398
+ const animName = instConfigItem.$anim.getAttribute("anim").replace("-reverse", "");
3399
+ const reverseAnimName = animName + "-reverse";
3400
+ fintInst.emitter.emit("pops:before-hide", instConfigItem);
3401
+ if (!checkVisible() && PopsAnimation.hasAnim(reverseAnimName)) {
3324
3402
  /**
3325
3403
  * 动画结束的回调
3326
3404
  */
@@ -3331,15 +3409,18 @@ var pops = (function () {
3331
3409
  };
3332
3410
  const listener = popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), animationendCallBack, {
3333
3411
  capture: true,
3412
+ once: true,
3334
3413
  });
3414
+ await startAnim();
3335
3415
  }
3336
3416
  else {
3417
+ await startAnim();
3337
3418
  endCallback();
3338
3419
  resolve();
3339
3420
  }
3340
3421
  }
3341
3422
  else {
3342
- console.error("show-error: 该实例未存储");
3423
+ console.error("hide-error: 该实例未存储");
3343
3424
  resolve();
3344
3425
  }
3345
3426
  });
@@ -3379,7 +3460,7 @@ var pops = (function () {
3379
3460
  await new Promise(async (resolve) => {
3380
3461
  const $pops = $anim.querySelector(".pops[type-value]");
3381
3462
  const drawerConfig = config;
3382
- const start = () => {
3463
+ const startAnim = () => {
3383
3464
  /**
3384
3465
  * 弹窗已关闭的回调
3385
3466
  */
@@ -3420,7 +3501,7 @@ var pops = (function () {
3420
3501
  };
3421
3502
  if (popsType === "drawer") {
3422
3503
  await popsUtils.sleep(drawerConfig.closeDelay ?? 0);
3423
- start();
3504
+ startAnim();
3424
3505
  }
3425
3506
  else {
3426
3507
  await PopsInstHandler.removeInstance([instConfigList], guid);
@@ -4171,8 +4252,8 @@ var pops = (function () {
4171
4252
  style: null,
4172
4253
  lightStyle: null,
4173
4254
  darkStyle: null,
4174
- beforeAppendToPageCallBack() { },
4175
4255
  stopKeyDownEventPropagation: true,
4256
+ emitter: null,
4176
4257
  };
4177
4258
  };
4178
4259
 
@@ -4181,11 +4262,11 @@ var pops = (function () {
4181
4262
  const guid = popsUtils.getRandomGUID();
4182
4263
  // 设置当前类型
4183
4264
  const popsType = "alert";
4184
- const emitter = new EventEmiter(popsType);
4185
4265
  let config = PopsAlertDefaultConfig();
4186
4266
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4187
4267
  config = popsUtils.assign(config, __config__);
4188
4268
  config = PopsHandler.handleOnly(popsType, config);
4269
+ const emitter = config.emitter ?? new EventEmiter(popsType);
4189
4270
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
4190
4271
  PopsHandler.handleInit($shadowRoot, [
4191
4272
  {
@@ -4379,8 +4460,8 @@ var pops = (function () {
4379
4460
  style: null,
4380
4461
  lightStyle: null,
4381
4462
  darkStyle: null,
4382
- beforeAppendToPageCallBack() { },
4383
4463
  stopKeyDownEventPropagation: true,
4464
+ emitter: null,
4384
4465
  };
4385
4466
  };
4386
4467
 
@@ -4389,11 +4470,11 @@ var pops = (function () {
4389
4470
  const guid = popsUtils.getRandomGUID();
4390
4471
  // 设置当前类型
4391
4472
  const popsType = "confirm";
4392
- const emitter = new EventEmiter(popsType);
4393
4473
  let config = PopsConfirmDefaultConfig();
4394
4474
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4395
4475
  config = popsUtils.assign(config, __config__);
4396
4476
  config = PopsHandler.handleOnly(popsType, config);
4477
+ const emitter = config.emitter ?? new EventEmiter(popsType);
4397
4478
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
4398
4479
  PopsHandler.handleInit($shadowRoot, [
4399
4480
  {
@@ -4586,9 +4667,9 @@ var pops = (function () {
4586
4667
  style: null,
4587
4668
  lightStyle: null,
4588
4669
  darkStyle: null,
4589
- beforeAppendToPageCallBack() { },
4590
4670
  forbiddenScroll: false,
4591
4671
  stopKeyDownEventPropagation: true,
4672
+ emitter: null,
4592
4673
  };
4593
4674
  };
4594
4675
 
@@ -4597,11 +4678,11 @@ var pops = (function () {
4597
4678
  const guid = popsUtils.getRandomGUID();
4598
4679
  // 设置当前类型
4599
4680
  const popsType = "drawer";
4600
- const emitter = new EventEmiter(popsType);
4601
4681
  let config = PopsDrawerDefaultConfig();
4602
4682
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4603
4683
  config = popsUtils.assign(config, __config__);
4604
4684
  config = PopsHandler.handleOnly(popsType, config);
4685
+ const emitter = config.emitter ?? new EventEmiter(popsType);
4605
4686
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
4606
4687
  PopsHandler.handleInit($shadowRoot, [
4607
4688
  {
@@ -4812,6 +4893,7 @@ var pops = (function () {
4812
4893
  darkStyle: null,
4813
4894
  addIndexCSS: true,
4814
4895
  stopKeyDownEventPropagation: true,
4896
+ emitter: null,
4815
4897
  };
4816
4898
  };
4817
4899
 
@@ -4819,19 +4901,19 @@ var pops = (function () {
4819
4901
  init(__config__) {
4820
4902
  const guid = popsUtils.getRandomGUID();
4821
4903
  // 设置当前类型
4822
- const PopsType = "loading";
4823
- const emitter = new EventEmiter(PopsType);
4904
+ const popsType = "loading";
4824
4905
  let config = PopsLoadingDefaultConfig();
4825
4906
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4826
4907
  config = popsUtils.assign(config, __config__);
4827
- config = PopsHandler.handleOnly(PopsType, config);
4908
+ config = PopsHandler.handleOnly(popsType, config);
4909
+ const emitter = config.emitter ?? new EventEmiter(popsType);
4828
4910
  // 先把z-index提取出来
4829
4911
  const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
4830
4912
  const maskHTML = PopsElementHandler.createMask(guid, zIndex);
4831
4913
  const { contentPStyle } = PopsElementHandler.createContentStyle("loading", config);
4832
- const animHTML = PopsElementHandler.createAnim(guid, PopsType, config,
4914
+ const animHTML = PopsElementHandler.createAnim(guid, popsType, config,
4833
4915
  /*html*/ `
4834
- <div class="pops-content pops-${PopsType}-content">${config.addIndexCSS
4916
+ <div class="pops-content pops-${popsType}-content">${config.addIndexCSS
4835
4917
  ? /*html*/ `
4836
4918
  <style data-model-name="index">${PopsCSS.index}</style>
4837
4919
  <style data-model-name="anim">${PopsCSS.anim}</style>
@@ -4842,13 +4924,13 @@ var pops = (function () {
4842
4924
  ${PopsCSS.loadingCSS}
4843
4925
  </style>
4844
4926
  ${config.style != null ? `<style>${config.style}</style>` : ""}
4845
- <p pops class="pops-${PopsType}-content-text" style="${contentPStyle}">${config.content.text}</p>
4927
+ <p pops class="pops-${popsType}-content-text" style="${contentPStyle}">${config.content.text}</p>
4846
4928
  </div>`, "", zIndex);
4847
4929
  /**
4848
4930
  * 弹窗的主元素,包括动画层
4849
4931
  */
4850
4932
  const $anim = PopsElementHandler.parseElement(animHTML);
4851
- const { $pops: $pops } = PopsHandler.handleQueryElement($anim, PopsType);
4933
+ const { $pops: $pops } = PopsHandler.handleQueryElement($anim, popsType);
4852
4934
  /**
4853
4935
  * 遮罩层元素
4854
4936
  */
@@ -4860,7 +4942,7 @@ var pops = (function () {
4860
4942
  if (config.mask.enable) {
4861
4943
  // 创建遮罩层
4862
4944
  const handleMask = PopsHandler.handleMask({
4863
- type: PopsType,
4945
+ type: popsType,
4864
4946
  guid: guid,
4865
4947
  config: config,
4866
4948
  animElement: $anim,
@@ -4869,12 +4951,12 @@ var pops = (function () {
4869
4951
  $mask = handleMask.maskElement;
4870
4952
  $elList.push($mask);
4871
4953
  }
4872
- const evtConfig = PopsHandler.handleLoadingEventConfig(config, guid, PopsType, $anim, $pops, emitter, $mask);
4954
+ const evtConfig = PopsHandler.handleLoadingEventConfig(config, guid, popsType, $anim, $pops, emitter, $mask);
4873
4955
  popsDOMUtils.append(config.$parent, $elList);
4874
4956
  if ($mask != null) {
4875
4957
  $anim.after($mask);
4876
4958
  }
4877
- PopsHandler.handlePush(PopsType, {
4959
+ PopsHandler.handlePush(popsType, {
4878
4960
  $shadowContainer: $pops,
4879
4961
  $shadowRoot: $pops,
4880
4962
  guid: guid,
@@ -5043,8 +5125,8 @@ var pops = (function () {
5043
5125
  style: null,
5044
5126
  lightStyle: null,
5045
5127
  darkStyle: null,
5046
- beforeAppendToPageCallBack() { },
5047
5128
  stopKeyDownEventPropagation: true,
5129
+ emitter: null,
5048
5130
  };
5049
5131
  };
5050
5132
 
@@ -5081,11 +5163,11 @@ var pops = (function () {
5081
5163
  const guid = popsUtils.getRandomGUID();
5082
5164
  // 设置当前类型
5083
5165
  const popsType = "folder";
5084
- const emitter = new EventEmiter(popsType);
5085
5166
  let config = PopsFolderDefaultConfig();
5086
5167
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
5087
5168
  config = popsUtils.assign(config, __config__);
5088
5169
  config = PopsHandler.handleOnly(popsType, config);
5170
+ const emitter = config.emitter ?? new EventEmiter(popsType);
5089
5171
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
5090
5172
  PopsHandler.handleInit($shadowRoot, [
5091
5173
  {
@@ -6008,8 +6090,8 @@ var pops = (function () {
6008
6090
  style: null,
6009
6091
  lightStyle: null,
6010
6092
  darkStyle: null,
6011
- beforeAppendToPageCallBack() { },
6012
6093
  stopKeyDownEventPropagation: true,
6094
+ emitter: null,
6013
6095
  };
6014
6096
  };
6015
6097
 
@@ -6018,7 +6100,6 @@ var pops = (function () {
6018
6100
  const guid = popsUtils.getRandomGUID();
6019
6101
  // 设置当前类型
6020
6102
  const popsType = "iframe";
6021
- const emitter = new EventEmiter(popsType);
6022
6103
  let config = PopsIframeDefaultConfig();
6023
6104
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
6024
6105
  config = popsUtils.assign(config, __config__);
@@ -6026,6 +6107,8 @@ var pops = (function () {
6026
6107
  throw new TypeError("config.url must not be null.");
6027
6108
  }
6028
6109
  config = PopsHandler.handleOnly(popsType, config);
6110
+ const emitter = config.emitter ??
6111
+ new EventEmiter(popsType);
6029
6112
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
6030
6113
  PopsHandler.handleInit($shadowRoot, [
6031
6114
  {
@@ -6053,7 +6136,7 @@ var pops = (function () {
6053
6136
  css: PopsCSS.iframeCSS,
6054
6137
  },
6055
6138
  ]);
6056
- const maskExtraStyle = config.animation != null && config.animation != "" ? "position:absolute;" : "";
6139
+ const maskExtraStyle = config.animation != null && config.animation != "" && config.animation ? "position:absolute;" : "";
6057
6140
  // 先把z-index提取出来
6058
6141
  const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
6059
6142
  const maskHTML = PopsElementHandler.createMask(guid, zIndex, maskExtraStyle);
@@ -7134,9 +7217,9 @@ var pops = (function () {
7134
7217
  style: null,
7135
7218
  lightStyle: null,
7136
7219
  darkStyle: null,
7137
- beforeAppendToPageCallBack() { },
7138
7220
  stopKeyDownEventPropagation: true,
7139
7221
  listenEscapeKeyUpToExitDeepMenu: true,
7222
+ emitter: null,
7140
7223
  };
7141
7224
  };
7142
7225
 
@@ -7248,7 +7331,7 @@ var pops = (function () {
7248
7331
  style: "",
7249
7332
  lightStyle: null,
7250
7333
  darkStyle: null,
7251
- beforeAppendToPageCallBack() { },
7334
+ emitter: null,
7252
7335
  };
7253
7336
  };
7254
7337
 
@@ -7716,7 +7799,6 @@ var pops = (function () {
7716
7799
  const guid = popsUtils.getRandomGUID();
7717
7800
  // 设置当前类型
7718
7801
  const popsType = "tooltip";
7719
- const emitter = new EventEmiter(popsType);
7720
7802
  let config = PopsTooltipDefaultConfig();
7721
7803
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
7722
7804
  config = popsUtils.assign(config, __config__);
@@ -7733,6 +7815,7 @@ var pops = (function () {
7733
7815
  config.onShowEventName += ` ${it}`;
7734
7816
  });
7735
7817
  }
7818
+ const emitter = config.emitter ?? new EventEmiter(popsType);
7736
7819
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
7737
7820
  PopsHandler.handleInit($shadowRoot, [
7738
7821
  {
@@ -11598,11 +11681,11 @@ var pops = (function () {
11598
11681
  const guid = popsUtils.getRandomGUID();
11599
11682
  // 设置当前类型
11600
11683
  const popsType = "panel";
11601
- const emitter = new EventEmiter(popsType);
11602
11684
  let config = PopsPanelDefaultConfig();
11603
11685
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
11604
11686
  config = popsUtils.assign(config, __config__);
11605
11687
  config = PopsHandler.handleOnly(popsType, config);
11688
+ const emitter = config.emitter ?? new EventEmiter(popsType);
11606
11689
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
11607
11690
  PopsHandler.handleInit($shadowRoot, [
11608
11691
  {
@@ -11852,8 +11935,8 @@ var pops = (function () {
11852
11935
  style: null,
11853
11936
  lightStyle: null,
11854
11937
  darkStyle: null,
11855
- beforeAppendToPageCallBack() { },
11856
11938
  stopKeyDownEventPropagation: true,
11939
+ emitter: null,
11857
11940
  };
11858
11941
  };
11859
11942
 
@@ -11862,11 +11945,11 @@ var pops = (function () {
11862
11945
  const guid = popsUtils.getRandomGUID();
11863
11946
  // 设置当前类型
11864
11947
  const popsType = "prompt";
11865
- const emitter = new EventEmiter(popsType);
11866
11948
  let config = PopsPromptDefaultConfig();
11867
11949
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
11868
11950
  config = popsUtils.assign(config, __config__);
11869
11951
  config = PopsHandler.handleOnly(popsType, config);
11952
+ const emitter = config.emitter ?? new EventEmiter(popsType);
11870
11953
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
11871
11954
  PopsHandler.handleInit($shadowRoot, [
11872
11955
  {
@@ -12087,10 +12170,10 @@ var pops = (function () {
12087
12170
  style: null,
12088
12171
  lightStyle: null,
12089
12172
  darkStyle: null,
12090
- beforeAppendToPageCallBack() { },
12091
12173
  limitPositionXInView: true,
12092
12174
  limitPositionYInView: true,
12093
12175
  beforeShowCallBack() { },
12176
+ emitter: null,
12094
12177
  };
12095
12178
  };
12096
12179
 
@@ -12099,11 +12182,11 @@ var pops = (function () {
12099
12182
  const guid = popsUtils.getRandomGUID();
12100
12183
  // 设置当前类型
12101
12184
  const popsType = "rightClickMenu";
12102
- const emitter = new EventEmiter(popsType);
12103
12185
  let config = PopsRightClickMenuDefaultConfig();
12104
12186
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
12105
12187
  config = popsUtils.assign(config, __config__);
12106
12188
  config = PopsHandler.handleOnly(popsType, config);
12189
+ const emitter = config.emitter ?? new EventEmiter(popsType);
12107
12190
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
12108
12191
  PopsHandler.handleInit($shadowRoot, [
12109
12192
  {
@@ -12725,6 +12808,7 @@ var pops = (function () {
12725
12808
  style: "",
12726
12809
  lightStyle: null,
12727
12810
  darkStyle: null,
12811
+ emitter: null,
12728
12812
  };
12729
12813
  };
12730
12814
 
@@ -12733,7 +12817,6 @@ var pops = (function () {
12733
12817
  const guid = popsUtils.getRandomGUID();
12734
12818
  // 设置当前类型
12735
12819
  const popsType = "searchSuggestion";
12736
- const emitter = new EventEmiter(popsType);
12737
12820
  let config = PopsSearchSuggestionDefaultConfig();
12738
12821
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
12739
12822
  config = popsUtils.assign(config, __config__);
@@ -12741,6 +12824,7 @@ var pops = (function () {
12741
12824
  if (config.$inputTarget == null) {
12742
12825
  config.$inputTarget = config.$target;
12743
12826
  }
12827
+ const emitter = config.emitter ?? new EventEmiter(popsType);
12744
12828
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
12745
12829
  PopsHandler.handleInit($shadowRoot, [
12746
12830
  {
@@ -13625,6 +13709,8 @@ var pops = (function () {
13625
13709
  PopsAnimation,
13626
13710
  /** 事件类 */
13627
13711
  EventEmiter,
13712
+ /** 通用的CSS类名 */
13713
+ PopsCommonCSSClassName,
13628
13714
  };
13629
13715
  init() { }
13630
13716
  /**