@whitesev/pops 4.0.1 → 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 +229 -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 +229 -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 +229 -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 +229 -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 +229 -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 +229 -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 +126 -9
  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 +6 -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
@@ -3,7 +3,7 @@ System.register('pops', [], (function (exports) {
3
3
  return {
4
4
  execute: (function () {
5
5
 
6
- const version = "4.0.1";
6
+ const version = "4.1.0";
7
7
 
8
8
  const GlobalConfig = {
9
9
  config: {},
@@ -62,15 +62,16 @@ System.register('pops', [], (function (exports) {
62
62
  };
63
63
 
64
64
  class EventEmiter {
65
- #type;
66
- #data = new Map();
65
+ [Symbol.toStringTag] = "EventEmiter";
66
+ type;
67
+ data = new Map();
67
68
  constructor(type) {
68
- this.#type = type;
69
+ this.type = type;
69
70
  }
70
71
  on(eventName, callback) {
71
- const eventList = this.#data.get(eventName) ?? [];
72
- eventList.push({ type: this.#type, time: Date.now(), callback: callback });
73
- this.#data.set(eventName, eventList);
72
+ const eventList = this.data.get(eventName) ?? [];
73
+ eventList.push({ type: this.type, time: Date.now(), callback: callback });
74
+ this.data.set(eventName, eventList);
74
75
  return {
75
76
  off: () => {
76
77
  this.off(eventName, callback);
@@ -81,7 +82,7 @@ System.register('pops', [], (function (exports) {
81
82
  };
82
83
  }
83
84
  off(eventName, callback) {
84
- const eventList = this.#data.get(eventName) ?? [];
85
+ const eventList = this.data.get(eventName) ?? [];
85
86
  let isOffSuccess = false;
86
87
  for (let index = eventList.length - 1; index >= 0; index--) {
87
88
  if (eventList[index].callback === callback) {
@@ -91,27 +92,27 @@ System.register('pops', [], (function (exports) {
91
92
  }
92
93
  if (eventList.length === 0) {
93
94
  // empty
94
- this.#data.delete(eventName);
95
+ this.data.delete(eventName);
95
96
  }
96
97
  else {
97
98
  if (isOffSuccess) {
98
99
  // update
99
- this.#data.set(eventName, eventList);
100
+ this.data.set(eventName, eventList);
100
101
  }
101
102
  }
102
103
  }
103
104
  async emit(eventName, ...args) {
104
- const eventList = this.#data.get(eventName) ?? [];
105
+ const eventList = this.data.get(eventName) ?? [];
105
106
  for (const item of eventList) {
106
107
  await item.callback(...args);
107
108
  }
108
109
  }
109
110
  offAll(eventName) {
110
111
  if (typeof eventName === "string") {
111
- this.#data.delete(eventName);
112
+ this.data.delete(eventName);
112
113
  }
113
114
  else {
114
- this.#data.clear();
115
+ this.data.clear();
115
116
  }
116
117
  }
117
118
  /**
@@ -119,10 +120,10 @@ System.register('pops', [], (function (exports) {
119
120
  */
120
121
  getAllEvents(eventName) {
121
122
  if (typeof eventName === "string") {
122
- return this.#data.get(eventName);
123
+ return this.data.get(eventName);
123
124
  }
124
125
  else {
125
- return Array.from(this.#data.values());
126
+ return Array.from(this.data.values());
126
127
  }
127
128
  }
128
129
  }
@@ -433,7 +434,8 @@ System.register('pops', [], (function (exports) {
433
434
  if (typeof sourceValue === "object" &&
434
435
  sourceValue != null &&
435
436
  keyName in target &&
436
- !UtilsContext.isDOM(sourceValue)) {
437
+ !UtilsContext.isDOM(sourceValue) &&
438
+ !(sourceValue instanceof EventEmiter)) {
437
439
  // 源端的值是object类型,且不是元素节点
438
440
  // 如果是数组,那此数组中有值,清空旧的数组再赋值
439
441
  let childObjectValue;
@@ -449,7 +451,7 @@ System.register('pops', [], (function (exports) {
449
451
  Reflect.set(target, keyName, childObjectValue);
450
452
  }
451
453
  else {
452
- /* 直接赋值 */
454
+ // 直接赋值
453
455
  Reflect.set(target, keyName, sourceValue);
454
456
  }
455
457
  }
@@ -639,33 +641,31 @@ System.register('pops', [], (function (exports) {
639
641
  if (typeof deviation !== "number" || Number.isNaN(deviation)) {
640
642
  deviation = 10;
641
643
  }
642
- const leftTop = {
643
- x: globalThis.innerWidth * (1 / 8),
644
- y: globalThis.innerHeight * (1 / 8),
645
- };
646
- const leftBottom = {
647
- x: globalThis.innerWidth * (1 / 8),
648
- y: globalThis.innerHeight * (7 / 8),
649
- };
650
- const rightTop = {
651
- x: globalThis.innerWidth * (7 / 8),
652
- y: globalThis.innerHeight * (1 / 8),
653
- };
654
- const rightBottom = {
655
- x: globalThis.innerWidth * (7 / 8),
656
- y: globalThis.innerHeight * (7 / 8),
657
- };
658
- const center = {
659
- x: globalThis.innerWidth / 2,
660
- y: globalThis.innerHeight / 2,
661
- };
662
- const delayHandlerElementPostionList = [
663
- leftTop,
664
- leftBottom,
665
- rightTop,
666
- rightBottom,
667
- center,
668
- ];
644
+ /** 坐标偏移 */
645
+ const positionDistance = 10;
646
+ const defaultCalcPostion = [];
647
+ const maxPostionX = globalThis.innerWidth;
648
+ const maxPostionY = globalThis.innerHeight;
649
+ const gridXCount = 8;
650
+ const gridYCount = 8;
651
+ for (let i = 0; i < gridXCount; i++) {
652
+ for (let j = 0; j < gridYCount; j++) {
653
+ const positionX = globalThis.innerWidth * (i / gridXCount) + positionDistance;
654
+ const positionY = globalThis.innerHeight * (j / gridYCount) + positionDistance;
655
+ const position = {
656
+ x: positionX,
657
+ y: positionY,
658
+ };
659
+ if (position.x > maxPostionX) {
660
+ position.x = maxPostionX;
661
+ }
662
+ if (position.y > maxPostionY) {
663
+ position.y = maxPostionY;
664
+ }
665
+ defaultCalcPostion.push(position);
666
+ }
667
+ }
668
+ const delayHandlerElementPostionList = defaultCalcPostion;
669
669
  if ($el) {
670
670
  delayHandlerElementPostionList.length = 0;
671
671
  if (Array.isArray($el)) {
@@ -677,61 +677,79 @@ System.register('pops', [], (function (exports) {
677
677
  }
678
678
  const positionInfoList = delayHandlerElementPostionList
679
679
  .map((position) => {
680
- let positionNode;
680
+ let $position;
681
681
  let positionX;
682
682
  let positionY;
683
683
  if (position instanceof HTMLElement) {
684
- positionNode = position;
684
+ $position = position;
685
685
  const nodeRect = position.getBoundingClientRect();
686
686
  positionX = nodeRect.x + nodeRect.width / 2;
687
687
  positionY = nodeRect.y + nodeRect.height / 2;
688
688
  }
689
689
  else {
690
- positionNode = document.elementFromPoint(position.x, position.y);
690
+ $position = document.elementFromPoint(position.x, position.y);
691
691
  positionX = position.x;
692
692
  positionY = position.y;
693
693
  }
694
- const shadowRoot = positionNode?.shadowRoot;
694
+ const shadowRoot = $position?.shadowRoot;
695
695
  if (shadowRoot) {
696
- positionNode = shadowRoot.elementFromPoint(positionX, positionY);
696
+ // 处理ShadowRoot
697
+ $position = shadowRoot.elementFromPoint(positionX, positionY);
697
698
  }
698
- if (positionNode instanceof HTMLStyleElement)
699
- return;
700
- if (positionNode instanceof HTMLScriptElement)
701
- return;
702
- if (positionNode instanceof HTMLMetaElement)
703
- return;
704
- if (positionNode instanceof HTMLHeadElement)
705
- return;
706
- if (!(positionNode instanceof HTMLElement))
699
+ if (!($position instanceof HTMLElement))
707
700
  return;
708
- let parent = positionNode;
701
+ let $parent = $position;
709
702
  let zIndex = 0;
710
- let maxZIndexNode = null;
711
- while (parent) {
712
- const nodeStyle = globalThis.getComputedStyle(parent);
703
+ let $maxZIndexNode = null;
704
+ let rect = {
705
+ x: 0,
706
+ y: 0,
707
+ width: 0,
708
+ height: 0,
709
+ top: 0,
710
+ right: 0,
711
+ bottom: 0,
712
+ left: 0,
713
+ };
714
+ while ($parent) {
715
+ const nodeStyle = globalThis.getComputedStyle($parent);
713
716
  const nodeZIndex = parseInt(nodeStyle.zIndex);
714
717
  if (nodeStyle.position !== "static" && !isNaN(nodeZIndex)) {
715
718
  if (nodeZIndex > zIndex) {
716
719
  zIndex = nodeZIndex;
717
- maxZIndexNode = parent;
718
- }
719
- }
720
- parent = parent.parentElement;
720
+ $maxZIndexNode = $parent;
721
+ }
722
+ }
723
+ $parent = $parent.parentElement;
724
+ }
725
+ if ($maxZIndexNode) {
726
+ const maxRect = $maxZIndexNode.getBoundingClientRect();
727
+ rect = {
728
+ x: maxRect.x,
729
+ y: maxRect.y,
730
+ width: maxRect.width,
731
+ height: maxRect.height,
732
+ top: maxRect.top,
733
+ right: maxRect.right,
734
+ bottom: maxRect.bottom,
735
+ left: maxRect.left,
736
+ };
721
737
  }
722
738
  return {
723
- /** 处理了偏移量后的z-index值 */
739
+ /** 计算偏移量后的z-index值 */
724
740
  zIndex: zIndex + deviation,
725
- /** 原始z-index值 */
741
+ /** 获取到的最大的z-index值 */
726
742
  originZIndex: zIndex,
727
743
  /** 拥有最大z-index的元素 */
728
- node: maxZIndexNode,
744
+ node: $maxZIndexNode,
729
745
  /** 目标坐标元素 */
730
- positionNode: positionNode,
731
- /** x坐标 */
746
+ positionNode: $position,
747
+ /** 目标x坐标 */
732
748
  positionX: positionX,
733
- /** y坐标 */
749
+ /** 目标y坐标 */
734
750
  positionY: positionY,
751
+ /** node位置信息 */
752
+ rect,
735
753
  };
736
754
  })
737
755
  .filter((it) => it != null);
@@ -782,10 +800,17 @@ System.register('pops', [], (function (exports) {
782
800
  const PopsCommonCSSClassName = {
783
801
  flexCenter: "pops-flex-items-center",
784
802
  flexYCenter: "pops-flex-y-center",
803
+ flexXCenter: "pops-flex-x-center",
785
804
  hide: "pops-hide",
786
805
  hideImportant: "pops-hide-important",
806
+ noBorder: "pops-no-border",
807
+ noBorderImportant: "pops-no-border-important",
787
808
  userSelectNone: "pops-user-select-none",
788
- textIsDisabled: "pops-text-is-disabled"};
809
+ lineHeightCenter: "pops-line-height-center",
810
+ widthFill: "pops-width-fill",
811
+ textIsDisabled: "pops-text-is-disabled",
812
+ textIsDisabledImportant: "pops-text-is-disabled-important",
813
+ };
789
814
 
790
815
  class PopsDOMUtilsEvent {
791
816
  on(element, eventType, selector, callback, option) {
@@ -1685,6 +1710,35 @@ System.register('pops', [], (function (exports) {
1685
1710
  getTransitionEndNameList() {
1686
1711
  return ["webkitTransitionEnd", "mozTransitionEnd", "MSTransitionEnd", "otransitionend", "transitionend"];
1687
1712
  }
1713
+ /**
1714
+ * 是否是隐藏状态
1715
+ *
1716
+ * 检测以下项:
1717
+ *
1718
+ * + `display`: none
1719
+ * + `visibility`: hidden
1720
+ * + `opacity`: 0
1721
+ * + `使用了pops的自定义的隐藏class类`
1722
+ * @param $el 需要检测的元素
1723
+ */
1724
+ isHide($el) {
1725
+ let flag = false;
1726
+ if (this.containsClassName($el, PopsCommonCSSClassName.hide) ||
1727
+ this.containsClassName($el, PopsCommonCSSClassName.hideImportant)) {
1728
+ flag = true;
1729
+ }
1730
+ else {
1731
+ if ($el instanceof HTMLElement) {
1732
+ const style = $el.style;
1733
+ flag = style.display.includes("none") || style.visibility.includes("hidden") || style.opacity !== "0";
1734
+ }
1735
+ if (!flag) {
1736
+ const style = globalThis.getComputedStyle($el);
1737
+ flag = style.display.includes("none") || style.visibility.includes("hidden") || style.opacity !== "0";
1738
+ }
1739
+ }
1740
+ return flag;
1741
+ }
1688
1742
  /**
1689
1743
  * 实现jQuery中的$().offset();
1690
1744
  * @param element
@@ -3193,7 +3247,7 @@ System.register('pops', [], (function (exports) {
3193
3247
  return totalInstConfigList;
3194
3248
  },
3195
3249
  /**
3196
- * 隐藏
3250
+ * 显示
3197
3251
  * @param popsType
3198
3252
  * @param instConfigList
3199
3253
  * @param guid
@@ -3201,24 +3255,34 @@ System.register('pops', [], (function (exports) {
3201
3255
  * @param $anim
3202
3256
  * @param $mask
3203
3257
  */
3204
- hide(config, popsType, instConfigList, guid, $anim, $mask) {
3258
+ show(config, popsType, instConfigList, guid, $anim, $mask) {
3205
3259
  // oxlint-disable-next-line no-async-promise-executor
3206
3260
  return new Promise(async (resolve) => {
3207
3261
  const $pops = $anim.querySelector(".pops[type-value]");
3208
3262
  const fintInst = instConfigList.find((instConfigItem) => instConfigItem.guid === guid);
3209
3263
  if (fintInst) {
3210
- // 存在实例
3264
+ // 由于是隐蔽状态
3265
+ // 先设置好动画状态
3266
+ // 再显示,会自执行动画
3267
+ const checkVisible = () => {
3268
+ if (!popsDOMUtils.isHide($anim)) {
3269
+ return true;
3270
+ }
3271
+ else {
3272
+ return false;
3273
+ }
3274
+ };
3211
3275
  const startAnim = async () => {
3212
3276
  if (popsType === "drawer") {
3213
3277
  // drawer是抽屉
3214
3278
  // 单独处理动画
3215
3279
  const drawerConfig = config;
3216
- await popsUtils.sleep(drawerConfig.closeDelay ?? 0);
3280
+ await popsUtils.sleep(drawerConfig.openDelay ?? 0);
3217
3281
  if ($mask) {
3218
- popsDOMUtils.css($mask, "display", "none");
3282
+ popsDOMUtils.css($mask, "display", "");
3219
3283
  }
3220
3284
  const direction = drawerConfig.direction;
3221
- const size = "0";
3285
+ const size = drawerConfig.size.toString();
3222
3286
  if (["top", "bottom"].includes(direction)) {
3223
3287
  $pops.style.setProperty("height", size);
3224
3288
  }
@@ -3226,26 +3290,26 @@ System.register('pops', [], (function (exports) {
3226
3290
  $pops.style.setProperty("width", size);
3227
3291
  }
3228
3292
  else {
3229
- console.error("未知direction: ", direction);
3293
+ console.error("未知direction", direction);
3230
3294
  }
3231
3295
  }
3232
3296
  else {
3233
- instConfigItem.$anim.style.width = "100%";
3234
- instConfigItem.$anim.style.height = "100%";
3235
- Reflect.set(instConfigItem.$anim.style, "animation-name", instConfigItem.$anim.getAttribute("anim") + "-reverse");
3297
+ instConfigItem.$anim.style.width = "";
3298
+ instConfigItem.$anim.style.height = "";
3299
+ Reflect.set(instConfigItem.$anim.style, "animation-name", animName);
3236
3300
  }
3237
- };
3238
- const endCallback = () => {
3239
- instConfigItem.$anim.style.display = "none";
3301
+ instConfigItem.$anim.style.display = "";
3240
3302
  if (instConfigItem.$mask) {
3241
- instConfigItem.$mask.style.display = "none";
3303
+ instConfigItem.$mask.style.display = "";
3242
3304
  }
3243
- fintInst.emitter.emit("pops:hide", instConfigItem);
3305
+ };
3306
+ const endCallback = () => {
3307
+ fintInst.emitter.emit("pops:show", instConfigItem);
3244
3308
  };
3245
3309
  const instConfigItem = fintInst;
3246
- fintInst.emitter.emit("pops:before-hide", instConfigItem);
3247
- await startAnim();
3248
- if (PopsAnimation.hasAnim(Reflect.get(instConfigItem.$anim.style, "animation-name"))) {
3310
+ const animName = instConfigItem.$anim.getAttribute("anim").replace("-reverse", "");
3311
+ fintInst.emitter.emit("pops:before-show", instConfigItem);
3312
+ if (checkVisible() && PopsAnimation.hasAnim(animName)) {
3249
3313
  /**
3250
3314
  * 动画结束的回调
3251
3315
  */
@@ -3256,22 +3320,23 @@ System.register('pops', [], (function (exports) {
3256
3320
  };
3257
3321
  const listener = popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), animationendCallBack, {
3258
3322
  capture: true,
3259
- once: true,
3260
3323
  });
3324
+ await startAnim();
3261
3325
  }
3262
3326
  else {
3327
+ await startAnim();
3263
3328
  endCallback();
3264
3329
  resolve();
3265
3330
  }
3266
3331
  }
3267
3332
  else {
3268
- console.error("hide-error: 该实例未存储");
3333
+ console.error("show-error: 该实例未存储");
3269
3334
  resolve();
3270
3335
  }
3271
3336
  });
3272
3337
  },
3273
3338
  /**
3274
- * 显示
3339
+ * 隐藏
3275
3340
  * @param popsType
3276
3341
  * @param instConfigList
3277
3342
  * @param guid
@@ -3279,23 +3344,35 @@ System.register('pops', [], (function (exports) {
3279
3344
  * @param $anim
3280
3345
  * @param $mask
3281
3346
  */
3282
- show(config, popsType, instConfigList, guid, $anim, $mask) {
3347
+ hide(config, popsType, instConfigList, guid, $anim, $mask) {
3283
3348
  // oxlint-disable-next-line no-async-promise-executor
3284
3349
  return new Promise(async (resolve) => {
3285
3350
  const $pops = $anim.querySelector(".pops[type-value]");
3286
3351
  const fintInst = instConfigList.find((instConfigItem) => instConfigItem.guid === guid);
3287
3352
  if (fintInst) {
3353
+ // 由于是已显示状态
3354
+ // 先执行动画
3355
+ // 再隐藏
3356
+ // 存在实例
3357
+ const checkVisible = () => {
3358
+ if (!popsDOMUtils.isHide($anim)) {
3359
+ return true;
3360
+ }
3361
+ else {
3362
+ return false;
3363
+ }
3364
+ };
3288
3365
  const startAnim = async () => {
3289
3366
  if (popsType === "drawer") {
3290
3367
  // drawer是抽屉
3291
3368
  // 单独处理动画
3292
3369
  const drawerConfig = config;
3293
- await popsUtils.sleep(drawerConfig.openDelay ?? 0);
3370
+ await popsUtils.sleep(drawerConfig.closeDelay ?? 0);
3294
3371
  if ($mask) {
3295
- popsDOMUtils.css($mask, "display", "");
3372
+ popsDOMUtils.css($mask, "display", "none");
3296
3373
  }
3297
3374
  const direction = drawerConfig.direction;
3298
- const size = drawerConfig.size.toString();
3375
+ const size = "0";
3299
3376
  if (["top", "bottom"].includes(direction)) {
3300
3377
  $pops.style.setProperty("height", size);
3301
3378
  }
@@ -3303,26 +3380,27 @@ System.register('pops', [], (function (exports) {
3303
3380
  $pops.style.setProperty("width", size);
3304
3381
  }
3305
3382
  else {
3306
- console.error("未知direction", direction);
3383
+ console.error("未知direction: ", direction);
3307
3384
  }
3308
3385
  }
3309
3386
  else {
3310
- instConfigItem.$anim.style.width = "";
3311
- instConfigItem.$anim.style.height = "";
3312
- Reflect.set(instConfigItem.$anim.style, "animation-name", instConfigItem.$anim.getAttribute("anim").replace("-reverse", ""));
3387
+ instConfigItem.$anim.style.width = "100%";
3388
+ instConfigItem.$anim.style.height = "100%";
3389
+ Reflect.set(instConfigItem.$anim.style, "animation-name", reverseAnimName);
3313
3390
  }
3314
3391
  };
3315
3392
  const endCallback = () => {
3316
- instConfigItem.$anim.style.display = "";
3393
+ instConfigItem.$anim.style.display = "none";
3317
3394
  if (instConfigItem.$mask) {
3318
- instConfigItem.$mask.style.display = "";
3395
+ instConfigItem.$mask.style.display = "none";
3319
3396
  }
3320
- fintInst.emitter.emit("pops:show", instConfigItem);
3397
+ fintInst.emitter.emit("pops:hide", instConfigItem);
3321
3398
  };
3322
3399
  const instConfigItem = fintInst;
3323
- fintInst.emitter.emit("pops:before-show", instConfigItem);
3324
- await startAnim();
3325
- if (PopsAnimation.hasAnim(Reflect.get(instConfigItem.$anim.style, "animation-name"))) {
3400
+ const animName = instConfigItem.$anim.getAttribute("anim").replace("-reverse", "");
3401
+ const reverseAnimName = animName + "-reverse";
3402
+ fintInst.emitter.emit("pops:before-hide", instConfigItem);
3403
+ if (!checkVisible() && PopsAnimation.hasAnim(reverseAnimName)) {
3326
3404
  /**
3327
3405
  * 动画结束的回调
3328
3406
  */
@@ -3333,15 +3411,18 @@ System.register('pops', [], (function (exports) {
3333
3411
  };
3334
3412
  const listener = popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), animationendCallBack, {
3335
3413
  capture: true,
3414
+ once: true,
3336
3415
  });
3416
+ await startAnim();
3337
3417
  }
3338
3418
  else {
3419
+ await startAnim();
3339
3420
  endCallback();
3340
3421
  resolve();
3341
3422
  }
3342
3423
  }
3343
3424
  else {
3344
- console.error("show-error: 该实例未存储");
3425
+ console.error("hide-error: 该实例未存储");
3345
3426
  resolve();
3346
3427
  }
3347
3428
  });
@@ -3381,7 +3462,7 @@ System.register('pops', [], (function (exports) {
3381
3462
  await new Promise(async (resolve) => {
3382
3463
  const $pops = $anim.querySelector(".pops[type-value]");
3383
3464
  const drawerConfig = config;
3384
- const start = () => {
3465
+ const startAnim = () => {
3385
3466
  /**
3386
3467
  * 弹窗已关闭的回调
3387
3468
  */
@@ -3422,7 +3503,7 @@ System.register('pops', [], (function (exports) {
3422
3503
  };
3423
3504
  if (popsType === "drawer") {
3424
3505
  await popsUtils.sleep(drawerConfig.closeDelay ?? 0);
3425
- start();
3506
+ startAnim();
3426
3507
  }
3427
3508
  else {
3428
3509
  await PopsInstHandler.removeInstance([instConfigList], guid);
@@ -4173,8 +4254,8 @@ System.register('pops', [], (function (exports) {
4173
4254
  style: null,
4174
4255
  lightStyle: null,
4175
4256
  darkStyle: null,
4176
- beforeAppendToPageCallBack() { },
4177
4257
  stopKeyDownEventPropagation: true,
4258
+ emitter: null,
4178
4259
  };
4179
4260
  };
4180
4261
 
@@ -4183,11 +4264,11 @@ System.register('pops', [], (function (exports) {
4183
4264
  const guid = popsUtils.getRandomGUID();
4184
4265
  // 设置当前类型
4185
4266
  const popsType = "alert";
4186
- const emitter = new EventEmiter(popsType);
4187
4267
  let config = PopsAlertDefaultConfig();
4188
4268
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4189
4269
  config = popsUtils.assign(config, __config__);
4190
4270
  config = PopsHandler.handleOnly(popsType, config);
4271
+ const emitter = config.emitter ?? new EventEmiter(popsType);
4191
4272
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
4192
4273
  PopsHandler.handleInit($shadowRoot, [
4193
4274
  {
@@ -4381,8 +4462,8 @@ System.register('pops', [], (function (exports) {
4381
4462
  style: null,
4382
4463
  lightStyle: null,
4383
4464
  darkStyle: null,
4384
- beforeAppendToPageCallBack() { },
4385
4465
  stopKeyDownEventPropagation: true,
4466
+ emitter: null,
4386
4467
  };
4387
4468
  };
4388
4469
 
@@ -4391,11 +4472,11 @@ System.register('pops', [], (function (exports) {
4391
4472
  const guid = popsUtils.getRandomGUID();
4392
4473
  // 设置当前类型
4393
4474
  const popsType = "confirm";
4394
- const emitter = new EventEmiter(popsType);
4395
4475
  let config = PopsConfirmDefaultConfig();
4396
4476
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4397
4477
  config = popsUtils.assign(config, __config__);
4398
4478
  config = PopsHandler.handleOnly(popsType, config);
4479
+ const emitter = config.emitter ?? new EventEmiter(popsType);
4399
4480
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
4400
4481
  PopsHandler.handleInit($shadowRoot, [
4401
4482
  {
@@ -4588,9 +4669,9 @@ System.register('pops', [], (function (exports) {
4588
4669
  style: null,
4589
4670
  lightStyle: null,
4590
4671
  darkStyle: null,
4591
- beforeAppendToPageCallBack() { },
4592
4672
  forbiddenScroll: false,
4593
4673
  stopKeyDownEventPropagation: true,
4674
+ emitter: null,
4594
4675
  };
4595
4676
  };
4596
4677
 
@@ -4599,11 +4680,11 @@ System.register('pops', [], (function (exports) {
4599
4680
  const guid = popsUtils.getRandomGUID();
4600
4681
  // 设置当前类型
4601
4682
  const popsType = "drawer";
4602
- const emitter = new EventEmiter(popsType);
4603
4683
  let config = PopsDrawerDefaultConfig();
4604
4684
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4605
4685
  config = popsUtils.assign(config, __config__);
4606
4686
  config = PopsHandler.handleOnly(popsType, config);
4687
+ const emitter = config.emitter ?? new EventEmiter(popsType);
4607
4688
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
4608
4689
  PopsHandler.handleInit($shadowRoot, [
4609
4690
  {
@@ -4814,6 +4895,7 @@ System.register('pops', [], (function (exports) {
4814
4895
  darkStyle: null,
4815
4896
  addIndexCSS: true,
4816
4897
  stopKeyDownEventPropagation: true,
4898
+ emitter: null,
4817
4899
  };
4818
4900
  };
4819
4901
 
@@ -4821,19 +4903,19 @@ System.register('pops', [], (function (exports) {
4821
4903
  init(__config__) {
4822
4904
  const guid = popsUtils.getRandomGUID();
4823
4905
  // 设置当前类型
4824
- const PopsType = "loading";
4825
- const emitter = new EventEmiter(PopsType);
4906
+ const popsType = "loading";
4826
4907
  let config = PopsLoadingDefaultConfig();
4827
4908
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
4828
4909
  config = popsUtils.assign(config, __config__);
4829
- config = PopsHandler.handleOnly(PopsType, config);
4910
+ config = PopsHandler.handleOnly(popsType, config);
4911
+ const emitter = config.emitter ?? new EventEmiter(popsType);
4830
4912
  // 先把z-index提取出来
4831
4913
  const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
4832
4914
  const maskHTML = PopsElementHandler.createMask(guid, zIndex);
4833
4915
  const { contentPStyle } = PopsElementHandler.createContentStyle("loading", config);
4834
- const animHTML = PopsElementHandler.createAnim(guid, PopsType, config,
4916
+ const animHTML = PopsElementHandler.createAnim(guid, popsType, config,
4835
4917
  /*html*/ `
4836
- <div class="pops-content pops-${PopsType}-content">${config.addIndexCSS
4918
+ <div class="pops-content pops-${popsType}-content">${config.addIndexCSS
4837
4919
  ? /*html*/ `
4838
4920
  <style data-model-name="index">${PopsCSS.index}</style>
4839
4921
  <style data-model-name="anim">${PopsCSS.anim}</style>
@@ -4844,13 +4926,13 @@ System.register('pops', [], (function (exports) {
4844
4926
  ${PopsCSS.loadingCSS}
4845
4927
  </style>
4846
4928
  ${config.style != null ? `<style>${config.style}</style>` : ""}
4847
- <p pops class="pops-${PopsType}-content-text" style="${contentPStyle}">${config.content.text}</p>
4929
+ <p pops class="pops-${popsType}-content-text" style="${contentPStyle}">${config.content.text}</p>
4848
4930
  </div>`, "", zIndex);
4849
4931
  /**
4850
4932
  * 弹窗的主元素,包括动画层
4851
4933
  */
4852
4934
  const $anim = PopsElementHandler.parseElement(animHTML);
4853
- const { $pops: $pops } = PopsHandler.handleQueryElement($anim, PopsType);
4935
+ const { $pops: $pops } = PopsHandler.handleQueryElement($anim, popsType);
4854
4936
  /**
4855
4937
  * 遮罩层元素
4856
4938
  */
@@ -4862,7 +4944,7 @@ System.register('pops', [], (function (exports) {
4862
4944
  if (config.mask.enable) {
4863
4945
  // 创建遮罩层
4864
4946
  const handleMask = PopsHandler.handleMask({
4865
- type: PopsType,
4947
+ type: popsType,
4866
4948
  guid: guid,
4867
4949
  config: config,
4868
4950
  animElement: $anim,
@@ -4871,12 +4953,12 @@ System.register('pops', [], (function (exports) {
4871
4953
  $mask = handleMask.maskElement;
4872
4954
  $elList.push($mask);
4873
4955
  }
4874
- const evtConfig = PopsHandler.handleLoadingEventConfig(config, guid, PopsType, $anim, $pops, emitter, $mask);
4956
+ const evtConfig = PopsHandler.handleLoadingEventConfig(config, guid, popsType, $anim, $pops, emitter, $mask);
4875
4957
  popsDOMUtils.append(config.$parent, $elList);
4876
4958
  if ($mask != null) {
4877
4959
  $anim.after($mask);
4878
4960
  }
4879
- PopsHandler.handlePush(PopsType, {
4961
+ PopsHandler.handlePush(popsType, {
4880
4962
  $shadowContainer: $pops,
4881
4963
  $shadowRoot: $pops,
4882
4964
  guid: guid,
@@ -5045,8 +5127,8 @@ System.register('pops', [], (function (exports) {
5045
5127
  style: null,
5046
5128
  lightStyle: null,
5047
5129
  darkStyle: null,
5048
- beforeAppendToPageCallBack() { },
5049
5130
  stopKeyDownEventPropagation: true,
5131
+ emitter: null,
5050
5132
  };
5051
5133
  };
5052
5134
 
@@ -5083,11 +5165,11 @@ System.register('pops', [], (function (exports) {
5083
5165
  const guid = popsUtils.getRandomGUID();
5084
5166
  // 设置当前类型
5085
5167
  const popsType = "folder";
5086
- const emitter = new EventEmiter(popsType);
5087
5168
  let config = PopsFolderDefaultConfig();
5088
5169
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
5089
5170
  config = popsUtils.assign(config, __config__);
5090
5171
  config = PopsHandler.handleOnly(popsType, config);
5172
+ const emitter = config.emitter ?? new EventEmiter(popsType);
5091
5173
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
5092
5174
  PopsHandler.handleInit($shadowRoot, [
5093
5175
  {
@@ -6010,8 +6092,8 @@ System.register('pops', [], (function (exports) {
6010
6092
  style: null,
6011
6093
  lightStyle: null,
6012
6094
  darkStyle: null,
6013
- beforeAppendToPageCallBack() { },
6014
6095
  stopKeyDownEventPropagation: true,
6096
+ emitter: null,
6015
6097
  };
6016
6098
  };
6017
6099
 
@@ -6020,7 +6102,6 @@ System.register('pops', [], (function (exports) {
6020
6102
  const guid = popsUtils.getRandomGUID();
6021
6103
  // 设置当前类型
6022
6104
  const popsType = "iframe";
6023
- const emitter = new EventEmiter(popsType);
6024
6105
  let config = PopsIframeDefaultConfig();
6025
6106
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
6026
6107
  config = popsUtils.assign(config, __config__);
@@ -6028,6 +6109,8 @@ System.register('pops', [], (function (exports) {
6028
6109
  throw new TypeError("config.url must not be null.");
6029
6110
  }
6030
6111
  config = PopsHandler.handleOnly(popsType, config);
6112
+ const emitter = config.emitter ??
6113
+ new EventEmiter(popsType);
6031
6114
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
6032
6115
  PopsHandler.handleInit($shadowRoot, [
6033
6116
  {
@@ -6055,7 +6138,7 @@ System.register('pops', [], (function (exports) {
6055
6138
  css: PopsCSS.iframeCSS,
6056
6139
  },
6057
6140
  ]);
6058
- const maskExtraStyle = config.animation != null && config.animation != "" ? "position:absolute;" : "";
6141
+ const maskExtraStyle = config.animation != null && config.animation != "" && config.animation ? "position:absolute;" : "";
6059
6142
  // 先把z-index提取出来
6060
6143
  const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
6061
6144
  const maskHTML = PopsElementHandler.createMask(guid, zIndex, maskExtraStyle);
@@ -7136,9 +7219,9 @@ System.register('pops', [], (function (exports) {
7136
7219
  style: null,
7137
7220
  lightStyle: null,
7138
7221
  darkStyle: null,
7139
- beforeAppendToPageCallBack() { },
7140
7222
  stopKeyDownEventPropagation: true,
7141
7223
  listenEscapeKeyUpToExitDeepMenu: true,
7224
+ emitter: null,
7142
7225
  };
7143
7226
  };
7144
7227
 
@@ -7250,7 +7333,7 @@ System.register('pops', [], (function (exports) {
7250
7333
  style: "",
7251
7334
  lightStyle: null,
7252
7335
  darkStyle: null,
7253
- beforeAppendToPageCallBack() { },
7336
+ emitter: null,
7254
7337
  };
7255
7338
  };
7256
7339
 
@@ -7718,7 +7801,6 @@ System.register('pops', [], (function (exports) {
7718
7801
  const guid = popsUtils.getRandomGUID();
7719
7802
  // 设置当前类型
7720
7803
  const popsType = "tooltip";
7721
- const emitter = new EventEmiter(popsType);
7722
7804
  let config = PopsTooltipDefaultConfig();
7723
7805
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
7724
7806
  config = popsUtils.assign(config, __config__);
@@ -7735,6 +7817,7 @@ System.register('pops', [], (function (exports) {
7735
7817
  config.onShowEventName += ` ${it}`;
7736
7818
  });
7737
7819
  }
7820
+ const emitter = config.emitter ?? new EventEmiter(popsType);
7738
7821
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
7739
7822
  PopsHandler.handleInit($shadowRoot, [
7740
7823
  {
@@ -11600,11 +11683,11 @@ System.register('pops', [], (function (exports) {
11600
11683
  const guid = popsUtils.getRandomGUID();
11601
11684
  // 设置当前类型
11602
11685
  const popsType = "panel";
11603
- const emitter = new EventEmiter(popsType);
11604
11686
  let config = PopsPanelDefaultConfig();
11605
11687
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
11606
11688
  config = popsUtils.assign(config, __config__);
11607
11689
  config = PopsHandler.handleOnly(popsType, config);
11690
+ const emitter = config.emitter ?? new EventEmiter(popsType);
11608
11691
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
11609
11692
  PopsHandler.handleInit($shadowRoot, [
11610
11693
  {
@@ -11854,8 +11937,8 @@ System.register('pops', [], (function (exports) {
11854
11937
  style: null,
11855
11938
  lightStyle: null,
11856
11939
  darkStyle: null,
11857
- beforeAppendToPageCallBack() { },
11858
11940
  stopKeyDownEventPropagation: true,
11941
+ emitter: null,
11859
11942
  };
11860
11943
  };
11861
11944
 
@@ -11864,11 +11947,11 @@ System.register('pops', [], (function (exports) {
11864
11947
  const guid = popsUtils.getRandomGUID();
11865
11948
  // 设置当前类型
11866
11949
  const popsType = "prompt";
11867
- const emitter = new EventEmiter(popsType);
11868
11950
  let config = PopsPromptDefaultConfig();
11869
11951
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
11870
11952
  config = popsUtils.assign(config, __config__);
11871
11953
  config = PopsHandler.handleOnly(popsType, config);
11954
+ const emitter = config.emitter ?? new EventEmiter(popsType);
11872
11955
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
11873
11956
  PopsHandler.handleInit($shadowRoot, [
11874
11957
  {
@@ -12089,10 +12172,10 @@ System.register('pops', [], (function (exports) {
12089
12172
  style: null,
12090
12173
  lightStyle: null,
12091
12174
  darkStyle: null,
12092
- beforeAppendToPageCallBack() { },
12093
12175
  limitPositionXInView: true,
12094
12176
  limitPositionYInView: true,
12095
12177
  beforeShowCallBack() { },
12178
+ emitter: null,
12096
12179
  };
12097
12180
  };
12098
12181
 
@@ -12101,11 +12184,11 @@ System.register('pops', [], (function (exports) {
12101
12184
  const guid = popsUtils.getRandomGUID();
12102
12185
  // 设置当前类型
12103
12186
  const popsType = "rightClickMenu";
12104
- const emitter = new EventEmiter(popsType);
12105
12187
  let config = PopsRightClickMenuDefaultConfig();
12106
12188
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
12107
12189
  config = popsUtils.assign(config, __config__);
12108
12190
  config = PopsHandler.handleOnly(popsType, config);
12191
+ const emitter = config.emitter ?? new EventEmiter(popsType);
12109
12192
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
12110
12193
  PopsHandler.handleInit($shadowRoot, [
12111
12194
  {
@@ -12727,6 +12810,7 @@ System.register('pops', [], (function (exports) {
12727
12810
  style: "",
12728
12811
  lightStyle: null,
12729
12812
  darkStyle: null,
12813
+ emitter: null,
12730
12814
  };
12731
12815
  };
12732
12816
 
@@ -12735,7 +12819,6 @@ System.register('pops', [], (function (exports) {
12735
12819
  const guid = popsUtils.getRandomGUID();
12736
12820
  // 设置当前类型
12737
12821
  const popsType = "searchSuggestion";
12738
- const emitter = new EventEmiter(popsType);
12739
12822
  let config = PopsSearchSuggestionDefaultConfig();
12740
12823
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
12741
12824
  config = popsUtils.assign(config, __config__);
@@ -12743,6 +12826,7 @@ System.register('pops', [], (function (exports) {
12743
12826
  if (config.$inputTarget == null) {
12744
12827
  config.$inputTarget = config.$target;
12745
12828
  }
12829
+ const emitter = config.emitter ?? new EventEmiter(popsType);
12746
12830
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
12747
12831
  PopsHandler.handleInit($shadowRoot, [
12748
12832
  {
@@ -13619,12 +13703,16 @@ System.register('pops', [], (function (exports) {
13619
13703
  InstanceUtils: PopsInstanceUtils,
13620
13704
  /** pops处理float类型使用的工具类 */
13621
13705
  MathFloatUtils: PopsMathFloatUtils,
13706
+ /** 实例处理函数 */
13707
+ PopsInstHandler,
13622
13708
  /** pops.panel中用于处理各个类型的工具 */
13623
13709
  PanelHandlerComponents,
13624
13710
  /** pops.panel中的动画 */
13625
13711
  PopsAnimation,
13626
13712
  /** 事件类 */
13627
13713
  EventEmiter,
13714
+ /** 通用的CSS类名 */
13715
+ PopsCommonCSSClassName,
13628
13716
  };
13629
13717
  init() { }
13630
13718
  /**