@whitesev/pops 3.1.3 → 3.2.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 (61) hide show
  1. package/dist/index.amd.js +230 -133
  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 +230 -133
  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 +230 -133
  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 +230 -133
  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 +230 -133
  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 +230 -133
  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 +10 -10
  26. package/dist/types/src/components/panel/index.d.ts +2 -2
  27. package/dist/types/src/components/rightClickMenu/index.d.ts +1 -1
  28. package/dist/types/src/components/rightClickMenu/types/index.d.ts +8 -1
  29. package/dist/types/src/components/tooltip/index.d.ts +5 -5
  30. package/dist/types/src/components/tooltip/types/index.d.ts +15 -14
  31. package/dist/types/src/handler/PopsHandler.d.ts +4 -4
  32. package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +39 -0
  33. package/dist/types/src/types/components.d.ts +2 -1
  34. package/dist/types/src/types/event.d.ts +13 -3
  35. package/dist/types/src/types/inst.d.ts +4 -0
  36. package/dist/types/src/utils/PopsDOMUtils.d.ts +10 -12
  37. package/dist/types/src/utils/PopsInstanceUtils.d.ts +2 -2
  38. package/package.json +2 -2
  39. package/src/components/alert/index.ts +3 -1
  40. package/src/components/confirm/index.ts +3 -1
  41. package/src/components/drawer/index.ts +3 -1
  42. package/src/components/folder/index.ts +3 -1
  43. package/src/components/iframe/index.ts +6 -4
  44. package/src/components/panel/handlerComponents.ts +26 -26
  45. package/src/components/panel/index.ts +3 -1
  46. package/src/components/prompt/index.ts +3 -1
  47. package/src/components/rightClickMenu/defaultConfig.ts +1 -0
  48. package/src/components/rightClickMenu/index.ts +18 -7
  49. package/src/components/rightClickMenu/types/index.ts +8 -1
  50. package/src/components/searchSuggestion/index.ts +7 -19
  51. package/src/components/tooltip/defaultConfig.ts +1 -1
  52. package/src/components/tooltip/index.ts +26 -17
  53. package/src/components/tooltip/types/index.ts +15 -14
  54. package/src/handler/PopsHandler.ts +22 -19
  55. package/src/types/PopsDOMUtilsEventType.d.ts +39 -0
  56. package/src/types/components.d.ts +2 -1
  57. package/src/types/event.d.ts +13 -3
  58. package/src/types/inst.d.ts +4 -0
  59. package/src/utils/PopsDOMUtils.ts +71 -40
  60. package/src/utils/PopsInstanceUtils.ts +62 -30
  61. package/src/utils/PopsUtils.ts +1 -1
@@ -519,7 +519,7 @@ System.register('pops', [], (function (exports) {
519
519
  * @param propName
520
520
  */
521
521
  delete(target, propName) {
522
- if (typeof Reflect === "object" && Reflect.deleteProperty) {
522
+ if (typeof Reflect === "object" && typeof Reflect.deleteProperty === "function") {
523
523
  Reflect.deleteProperty(target, propName);
524
524
  }
525
525
  else {
@@ -1025,13 +1025,13 @@ System.register('pops', [], (function (exports) {
1025
1025
  if (element == null) {
1026
1026
  return;
1027
1027
  }
1028
- let elementList = [];
1028
+ let $elList = [];
1029
1029
  if (element instanceof NodeList || Array.isArray(element)) {
1030
1030
  element = element;
1031
- elementList = [...element];
1031
+ $elList = $elList.concat(element);
1032
1032
  }
1033
1033
  else {
1034
- elementList.push(element);
1034
+ $elList.push(element);
1035
1035
  }
1036
1036
  let eventTypeList = [];
1037
1037
  if (Array.isArray(eventType)) {
@@ -1082,7 +1082,7 @@ System.register('pops', [], (function (exports) {
1082
1082
  // 目标函数、事件名、回调函数、事件配置、过滤函数
1083
1083
  filter = option;
1084
1084
  }
1085
- elementList.forEach((elementItem) => {
1085
+ $elList.forEach((elementItem) => {
1086
1086
  // 获取对象上的事件
1087
1087
  const elementEvents = Reflect.get(elementItem, SymbolEvents) || {};
1088
1088
  eventTypeList.forEach((eventName) => {
@@ -1129,18 +1129,19 @@ System.register('pops', [], (function (exports) {
1129
1129
  * @param eventType (可选)需要取消监听的事件
1130
1130
  */
1131
1131
  offAll(element, eventType) {
1132
+ const that = this;
1132
1133
  if (typeof element === "string") {
1133
- element = PopsCore.document.querySelectorAll(element);
1134
+ element = that.selectorAll(element);
1134
1135
  }
1135
1136
  if (element == null) {
1136
1137
  return;
1137
1138
  }
1138
- let elementList = [];
1139
+ let $elList = [];
1139
1140
  if (element instanceof NodeList || Array.isArray(element)) {
1140
- elementList = [...element];
1141
+ $elList = $elList.concat(Array.from(element));
1141
1142
  }
1142
1143
  else {
1143
- elementList.push(element);
1144
+ $elList.push(element);
1144
1145
  }
1145
1146
  let eventTypeList = [];
1146
1147
  if (Array.isArray(eventType)) {
@@ -1149,12 +1150,13 @@ System.register('pops', [], (function (exports) {
1149
1150
  else if (typeof eventType === "string") {
1150
1151
  eventTypeList = eventTypeList.concat(eventType.split(" "));
1151
1152
  }
1152
- elementList.forEach((elementItem) => {
1153
- Object.getOwnPropertySymbols(elementItem).forEach((__symbolEvents) => {
1154
- if (!__symbolEvents.toString().startsWith("Symbol(events_")) {
1153
+ $elList.forEach(($elItem) => {
1154
+ const symbolList = [...new Set([...Object.getOwnPropertySymbols($elItem), SymbolEvents])];
1155
+ symbolList.forEach((symbolItem) => {
1156
+ if (!symbolItem.toString().startsWith("Symbol(events_")) {
1155
1157
  return;
1156
1158
  }
1157
- const elementEvents = elementItem[__symbolEvents] || {};
1159
+ const elementEvents = Reflect.get($elItem, symbolItem) || {};
1158
1160
  const iterEventNameList = eventTypeList.length ? eventTypeList : Object.keys(elementEvents);
1159
1161
  iterEventNameList.forEach((eventName) => {
1160
1162
  const handlers = elementEvents[eventName];
@@ -1162,11 +1164,12 @@ System.register('pops', [], (function (exports) {
1162
1164
  return;
1163
1165
  }
1164
1166
  for (const handler of handlers) {
1165
- elementItem.removeEventListener(eventName, handler.callback, {
1167
+ $elItem.removeEventListener(eventName, handler.callback, {
1166
1168
  capture: handler["option"]["capture"],
1167
1169
  });
1168
1170
  }
1169
- popsUtils.delete(elementItem[__symbolEvents], eventName);
1171
+ const events = Reflect.get($elItem, symbolItem);
1172
+ popsUtils.delete(events, eventName);
1170
1173
  });
1171
1174
  });
1172
1175
  });
@@ -1909,7 +1912,8 @@ System.register('pops', [], (function (exports) {
1909
1912
  }
1910
1913
  return $el.classList.contains(className);
1911
1914
  }
1912
- css(element, property, value) {
1915
+ css($el, property, value) {
1916
+ const that = this;
1913
1917
  /**
1914
1918
  * 把纯数字没有px的加上
1915
1919
  */
@@ -1923,10 +1927,33 @@ System.register('pops', [], (function (exports) {
1923
1927
  }
1924
1928
  return propertyValue;
1925
1929
  }
1926
- if (typeof element === "string") {
1927
- element = PopsCore.document.querySelector(element);
1930
+ if (typeof $el === "string") {
1931
+ $el = that.selectorAll($el);
1928
1932
  }
1929
- if (element == null) {
1933
+ if ($el == null) {
1934
+ return;
1935
+ }
1936
+ if (Array.isArray($el) || $el instanceof NodeList) {
1937
+ if (typeof property === "string") {
1938
+ if (value == null) {
1939
+ // 获取属性
1940
+ return that.css($el[0], property);
1941
+ }
1942
+ else {
1943
+ // 设置属性
1944
+ $el.forEach(($elItem) => {
1945
+ that.css($elItem, property);
1946
+ });
1947
+ return;
1948
+ }
1949
+ }
1950
+ else if (typeof property === "object") {
1951
+ // 设置属性
1952
+ $el.forEach(($elItem) => {
1953
+ that.css($elItem, property);
1954
+ });
1955
+ return;
1956
+ }
1930
1957
  return;
1931
1958
  }
1932
1959
  const setStyleProperty = (propertyName, propertyValue) => {
@@ -1935,16 +1962,16 @@ System.register('pops', [], (function (exports) {
1935
1962
  .trim()
1936
1963
  .replace(/!important$/gi, "")
1937
1964
  .trim();
1938
- element.style.setProperty(propertyName, propertyValue, "important");
1965
+ $el.style.setProperty(propertyName, propertyValue, "important");
1939
1966
  }
1940
1967
  else {
1941
1968
  propertyValue = handlePixe(propertyName, propertyValue);
1942
- element.style.setProperty(propertyName, propertyValue);
1969
+ $el.style.setProperty(propertyName, propertyValue);
1943
1970
  }
1944
1971
  };
1945
1972
  if (typeof property === "string") {
1946
1973
  if (value == null) {
1947
- return getComputedStyle(element).getPropertyValue(property);
1974
+ return PopsCore.globalThis.getComputedStyle($el).getPropertyValue(property);
1948
1975
  }
1949
1976
  else {
1950
1977
  setStyleProperty(property, value);
@@ -1956,6 +1983,10 @@ System.register('pops', [], (function (exports) {
1956
1983
  setStyleProperty(prop, value);
1957
1984
  }
1958
1985
  }
1986
+ else {
1987
+ // 其他情况
1988
+ throw new TypeError("property must be string or object");
1989
+ }
1959
1990
  }
1960
1991
  /**
1961
1992
  * 创建元素
@@ -3090,16 +3121,16 @@ System.register('pops', [], (function (exports) {
3090
3121
  },
3091
3122
  /**
3092
3123
  * 删除配置中对应的对象
3093
- * @param instConfigList 配置实例列表
3124
+ * @param totalInstConfigList 配置实例列表
3094
3125
  * @param guid 唯一标识
3095
3126
  * @param isAll 是否全部删除
3096
3127
  */
3097
- removeInstance(instConfigList, guid, isAll = false) {
3128
+ async removeInstance(totalInstConfigList, guid, isAll = false) {
3098
3129
  /**
3099
3130
  * 移除元素实例
3100
3131
  * @param instCommonConfig
3101
3132
  */
3102
- function removeItem(instCommonConfig) {
3133
+ const removeInst = function (instCommonConfig) {
3103
3134
  if (typeof instCommonConfig.beforeRemoveCallBack === "function") {
3104
3135
  // 调用移除签的回调
3105
3136
  instCommonConfig.beforeRemoveCallBack(instCommonConfig);
@@ -3108,39 +3139,44 @@ System.register('pops', [], (function (exports) {
3108
3139
  instCommonConfig?.$pops?.remove();
3109
3140
  instCommonConfig?.$mask?.remove();
3110
3141
  instCommonConfig?.$shadowContainer?.remove();
3111
- }
3142
+ };
3143
+ const asyncInstTask = [];
3112
3144
  // [ inst[], inst[],...]
3113
- instConfigList.forEach((instConfigList) => {
3145
+ totalInstConfigList.forEach((instConfigList) => {
3114
3146
  // inst[]
3115
- instConfigList.forEach((instConfigItem, index) => {
3147
+ instConfigList.forEach(async (instConfigItem, index) => {
3116
3148
  // 移除全部或者guid相同
3117
- if (isAll || instConfigItem["guid"] === guid) {
3149
+ if (isAll || (typeof guid === "string" && instConfigItem.guid === guid)) {
3118
3150
  // 判断是否有动画
3119
3151
  const animName = instConfigItem.$anim.getAttribute("anim");
3120
3152
  if (PopsAnimation.hasAnim(animName)) {
3121
3153
  const reverseAnimName = animName + "-reverse";
3122
- instConfigItem.$anim.style.width = "100%";
3123
- instConfigItem.$anim.style.height = "100%";
3124
- instConfigItem.$anim.style["animation-name"] = reverseAnimName;
3125
- if (PopsAnimation.hasAnim(instConfigItem.$anim.style["animation-name"])) {
3126
- popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), function () {
3127
- removeItem(instConfigItem);
3128
- }, {
3129
- capture: true,
3130
- });
3154
+ popsDOMUtils.css(instConfigItem.$anim, "width", "100%");
3155
+ popsDOMUtils.css(instConfigItem.$anim, "height", "100%");
3156
+ popsDOMUtils.css(instConfigItem.$anim, "animation-name", reverseAnimName);
3157
+ if (PopsAnimation.hasAnim(popsDOMUtils.css(instConfigItem.$anim, "animation-name"))) {
3158
+ asyncInstTask.push(new Promise((resolve) => {
3159
+ popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), function () {
3160
+ removeInst(instConfigItem);
3161
+ resolve();
3162
+ }, {
3163
+ capture: true,
3164
+ });
3165
+ }));
3131
3166
  }
3132
3167
  else {
3133
- removeItem(instConfigItem);
3168
+ removeInst(instConfigItem);
3134
3169
  }
3135
3170
  }
3136
3171
  else {
3137
- removeItem(instConfigItem);
3172
+ removeInst(instConfigItem);
3138
3173
  }
3139
3174
  instConfigList.splice(index, 1);
3140
3175
  }
3141
3176
  });
3142
3177
  });
3143
- return instConfigList;
3178
+ await Promise.all(asyncInstTask);
3179
+ return totalInstConfigList;
3144
3180
  },
3145
3181
  /**
3146
3182
  * 隐藏
@@ -3285,8 +3321,9 @@ System.register('pops', [], (function (exports) {
3285
3321
  * @param config
3286
3322
  * @param $anim
3287
3323
  */
3288
- close(config, popsType, instConfigList, guid, $anim) {
3289
- return new Promise((resolve) => {
3324
+ async close(config, popsType, instConfigList, guid, $anim) {
3325
+ // eslint-disable-next-line no-async-promise-executor
3326
+ await new Promise(async (resolve) => {
3290
3327
  const $pops = $anim.querySelector(".pops[type-value]");
3291
3328
  const drawerConfig = config;
3292
3329
  /**
@@ -3296,12 +3333,12 @@ System.register('pops', [], (function (exports) {
3296
3333
  /**
3297
3334
  * 弹窗已关闭的回调
3298
3335
  */
3299
- function closeCallBack(event) {
3336
+ async function closeCallBack(event) {
3300
3337
  if (event.propertyName !== "transform") {
3301
3338
  return;
3302
3339
  }
3303
- popsDOMUtils.off($pops, popsDOMUtils.getTransitionEndNameList(), void 0, closeCallBack);
3304
- PopsInstanceUtils.removeInstance([instConfigList], guid);
3340
+ popsDOMUtils.off($pops, popsDOMUtils.getTransitionEndNameList(), closeCallBack);
3341
+ await PopsInstanceUtils.removeInstance([instConfigList], guid);
3305
3342
  resolve();
3306
3343
  }
3307
3344
  // 监听过渡结束
@@ -3333,10 +3370,32 @@ System.register('pops', [], (function (exports) {
3333
3370
  }, drawerConfig.closeDelay);
3334
3371
  }
3335
3372
  else {
3336
- PopsInstanceUtils.removeInstance([instConfigList], guid);
3373
+ await PopsInstanceUtils.removeInstance([instConfigList], guid);
3337
3374
  resolve();
3338
3375
  }
3339
3376
  });
3377
+ // 判断组件内是否有rightClickMenu、tooltip、searchSuggestion组件
3378
+ // 有的话也需要关闭
3379
+ PopsInstData.rightClickMenu.forEach((itemConfig) => {
3380
+ const config = itemConfig.config;
3381
+ if (config.$target instanceof HTMLElement) {
3382
+ const $root = config.$target.getRootNode();
3383
+ if ($root instanceof HTMLElement && $root.parentElement == null) {
3384
+ // 触发销毁元素
3385
+ itemConfig.destory();
3386
+ }
3387
+ }
3388
+ });
3389
+ PopsInstData.tooltip.forEach((itemConfig) => {
3390
+ const config = itemConfig.config;
3391
+ if (config.$target instanceof HTMLElement) {
3392
+ const $root = config.$target.getRootNode();
3393
+ if ($root instanceof HTMLElement && $root.parentElement == null) {
3394
+ // 触发销毁元素
3395
+ itemConfig.destory();
3396
+ }
3397
+ }
3398
+ });
3340
3399
  },
3341
3400
  /**
3342
3401
  * 拖拽元素
@@ -3675,12 +3734,12 @@ System.register('pops', [], (function (exports) {
3675
3734
  element.hasAttribute("anim"));
3676
3735
  }
3677
3736
  // 判断按下的元素是否是pops-anim
3678
- popsDOMUtils.on(config.animElement, ["touchstart", "mousedown"], void 0, (event) => {
3737
+ popsDOMUtils.on(config.animElement, ["touchstart", "mousedown"], (event) => {
3679
3738
  const $click = event.composedPath()[0];
3680
3739
  isMaskClick = isAnimElement($click);
3681
3740
  });
3682
3741
  // 如果有动画层,在动画层上监听点击事件
3683
- popsDOMUtils.on(config.animElement, "click", void 0, (event) => {
3742
+ popsDOMUtils.on(config.animElement, "click", (event) => {
3684
3743
  const $click = event.composedPath()[0];
3685
3744
  if (isAnimElement($click) && isMaskClick) {
3686
3745
  return clickEvent(event);
@@ -3688,7 +3747,7 @@ System.register('pops', [], (function (exports) {
3688
3747
  });
3689
3748
  // 在遮罩层监听点击事件
3690
3749
  // 如果有动画层,那么该点击事件触发不了
3691
- popsDOMUtils.on(result.maskElement, "click", void 0, (event) => {
3750
+ popsDOMUtils.on(result.maskElement, "click", (event) => {
3692
3751
  isMaskClick = true;
3693
3752
  clickEvent(event);
3694
3753
  });
@@ -3831,13 +3890,13 @@ System.register('pops', [], (function (exports) {
3831
3890
  * @param guid
3832
3891
  * @param $shadowContainer
3833
3892
  * @param $shadowRoot
3834
- * @param mode 当前弹窗类型
3893
+ * @param type 当前弹窗类型
3835
3894
  * @param $anim 动画层
3836
3895
  * @param $pops 主元素
3837
3896
  * @param $mask 遮罩层
3838
3897
  * @param config 当前配置
3839
3898
  */
3840
- handleEventConfig(config, guid, $shadowContainer, $shadowRoot, mode, $anim, $pops, $mask) {
3899
+ handleEventConfig(config, guid, $shadowContainer, $shadowRoot, type, $anim, $pops, $mask) {
3841
3900
  return {
3842
3901
  $shadowContainer: $shadowContainer,
3843
3902
  $shadowRoot: $shadowRoot,
@@ -3845,44 +3904,47 @@ System.register('pops', [], (function (exports) {
3845
3904
  $anim: $anim,
3846
3905
  $pops: $pops,
3847
3906
  $mask: $mask,
3848
- mode: mode,
3907
+ mode: type,
3849
3908
  guid: guid,
3850
3909
  close() {
3851
- return PopsInstanceUtils.close(config, mode, PopsInstData[mode], guid, $anim);
3910
+ return PopsInstanceUtils.close(config, type, PopsInstData[type], guid, $anim);
3852
3911
  },
3853
3912
  hide() {
3854
- return PopsInstanceUtils.hide(config, mode, PopsInstData[mode], guid, $anim, $mask);
3913
+ return PopsInstanceUtils.hide(config, type, PopsInstData[type], guid, $anim, $mask);
3855
3914
  },
3856
- show() {
3857
- return PopsInstanceUtils.show(config, mode, PopsInstData[mode], guid, $anim, $mask);
3915
+ show($parent) {
3916
+ if ($parent) {
3917
+ $parent.appendChild(PopsInstData[type][0].$shadowRoot);
3918
+ }
3919
+ return PopsInstanceUtils.show(config, type, PopsInstData[type], guid, $anim, $mask);
3858
3920
  },
3859
3921
  };
3860
3922
  },
3861
3923
  /**
3862
3924
  * 获取loading的事件配置
3863
3925
  * @param guid
3864
- * @param mode 当前弹窗类型
3926
+ * @param type 当前弹窗类型
3865
3927
  * @param $anim 动画层
3866
3928
  * @param $pops 主元素
3867
3929
  * @param $mask 遮罩层
3868
3930
  * @param config 当前配置
3869
3931
  */
3870
- handleLoadingEventConfig(config, guid, mode, $anim, $pops, $mask) {
3932
+ handleLoadingEventConfig(config, guid, type, $anim, $pops, $mask) {
3871
3933
  return {
3872
3934
  $el: $anim,
3873
3935
  $anim: $anim,
3874
3936
  $pops: $pops,
3875
3937
  $mask: $mask,
3876
- mode: mode,
3938
+ mode: type,
3877
3939
  guid: guid,
3878
3940
  close() {
3879
- return PopsInstanceUtils.close(config, mode, PopsInstData[mode], guid, $anim);
3941
+ return PopsInstanceUtils.close(config, type, PopsInstData[type], guid, $anim);
3880
3942
  },
3881
3943
  hide() {
3882
- return PopsInstanceUtils.hide(config, mode, PopsInstData[mode], guid, $anim, $mask);
3944
+ return PopsInstanceUtils.hide(config, type, PopsInstData[type], guid, $anim, $mask);
3883
3945
  },
3884
3946
  show() {
3885
- return PopsInstanceUtils.show(config, mode, PopsInstData[mode], guid, $anim, $mask);
3947
+ return PopsInstanceUtils.show(config, type, PopsInstData[type], guid, $anim, $mask);
3886
3948
  },
3887
3949
  };
3888
3950
  },
@@ -3995,8 +4057,8 @@ System.register('pops', [], (function (exports) {
3995
4057
  handleOnly(type, config) {
3996
4058
  if (config.only) {
3997
4059
  // .loading
3998
- // .tooltip
3999
4060
  // .rightClickMenu
4061
+ // .tooltip
4000
4062
  // 单独处理
4001
4063
  if (type === "loading" || type === "tooltip" || type === "rightClickMenu") {
4002
4064
  const inst = PopsInstData[type];
@@ -4008,11 +4070,11 @@ System.register('pops', [], (function (exports) {
4008
4070
  PopsInstanceUtils.removeInstance([
4009
4071
  PopsInstData.alert,
4010
4072
  PopsInstData.confirm,
4011
- PopsInstData.prompt,
4012
- PopsInstData.iframe,
4013
4073
  PopsInstData.drawer,
4014
4074
  PopsInstData.folder,
4075
+ PopsInstData.iframe,
4015
4076
  PopsInstData.panel,
4077
+ PopsInstData.prompt,
4016
4078
  ], "", true);
4017
4079
  }
4018
4080
  }
@@ -4176,6 +4238,7 @@ System.register('pops', [], (function (exports) {
4176
4238
  }
4177
4239
  // 处理返回的配置
4178
4240
  const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
4241
+ const result = PopsHandler.handleResultConfig(evtConfig);
4179
4242
  // 为顶部右边的关闭按钮添加点击事件
4180
4243
  PopsHandler.handleClickEvent("close", $headerCloseBtn, evtConfig, config.btn.close?.callback);
4181
4244
  // 为底部ok按钮添加点击事件
@@ -4198,6 +4261,8 @@ System.register('pops', [], (function (exports) {
4198
4261
  $mask: $mask,
4199
4262
  $shadowContainer: $shadowContainer,
4200
4263
  $shadowRoot: $shadowRoot,
4264
+ config: config,
4265
+ destory: result.close,
4201
4266
  });
4202
4267
  // 拖拽
4203
4268
  if (config.drag) {
@@ -4209,7 +4274,6 @@ System.register('pops', [], (function (exports) {
4209
4274
  endCallBack: config.dragEndCallBack,
4210
4275
  });
4211
4276
  }
4212
- const result = PopsHandler.handleResultConfig(evtConfig);
4213
4277
  return result;
4214
4278
  },
4215
4279
  };
@@ -4383,6 +4447,7 @@ System.register('pops', [], (function (exports) {
4383
4447
  $elList.push($mask);
4384
4448
  }
4385
4449
  const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
4450
+ const result = PopsHandler.handleResultConfig(evtConfig);
4386
4451
  PopsHandler.handleClickEvent("close", $btnClose, evtConfig, config.btn.close.callback);
4387
4452
  PopsHandler.handleClickEvent("ok", $btnOk, evtConfig, config.btn.ok.callback);
4388
4453
  PopsHandler.handleClickEvent("cancel", $btnCancel, evtConfig, config.btn.cancel.callback);
@@ -4403,6 +4468,8 @@ System.register('pops', [], (function (exports) {
4403
4468
  $mask: $mask,
4404
4469
  $shadowContainer: $shadowContainer,
4405
4470
  $shadowRoot: $shadowRoot,
4471
+ config: config,
4472
+ destory: result.close,
4406
4473
  });
4407
4474
  // 拖拽
4408
4475
  if (config.drag) {
@@ -4414,7 +4481,6 @@ System.register('pops', [], (function (exports) {
4414
4481
  endCallBack: config.dragEndCallBack,
4415
4482
  });
4416
4483
  }
4417
- const result = PopsHandler.handleResultConfig(evtConfig);
4418
4484
  return result;
4419
4485
  },
4420
4486
  };
@@ -4593,6 +4659,7 @@ System.register('pops', [], (function (exports) {
4593
4659
  $elList.push($mask);
4594
4660
  }
4595
4661
  const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
4662
+ const result = PopsHandler.handleResultConfig(evtConfig);
4596
4663
  // 处理方向
4597
4664
  $pops.setAttribute("direction", config.direction);
4598
4665
  // 处理border-radius
@@ -4688,8 +4755,9 @@ System.register('pops', [], (function (exports) {
4688
4755
  $mask: $mask,
4689
4756
  $shadowContainer: $shadowContainer,
4690
4757
  $shadowRoot: $shadowRoot,
4758
+ config: config,
4759
+ destory: result.close,
4691
4760
  });
4692
- const result = PopsHandler.handleResultConfig(evtConfig);
4693
4761
  return result;
4694
4762
  },
4695
4763
  };
@@ -5198,6 +5266,7 @@ System.register('pops', [], (function (exports) {
5198
5266
  }
5199
5267
  // 事件
5200
5268
  const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
5269
+ const result = PopsHandler.handleResultConfig(evtConfig);
5201
5270
  PopsHandler.handleClickEvent("close", $btnCloseBtn, evtConfig, config.btn.close.callback);
5202
5271
  PopsHandler.handleClickEvent("ok", btnOkElement, evtConfig, config.btn.ok.callback);
5203
5272
  PopsHandler.handleClickEvent("cancel", btnCancelElement, evtConfig, config.btn.cancel.callback);
@@ -5777,8 +5846,9 @@ System.register('pops', [], (function (exports) {
5777
5846
  $mask: $mask,
5778
5847
  $shadowContainer: $shadowContainer,
5779
5848
  $shadowRoot: $shadowRoot,
5849
+ config: config,
5850
+ destory: result.close,
5780
5851
  });
5781
- const result = PopsHandler.handleResultConfig(evtConfig);
5782
5852
  return result;
5783
5853
  },
5784
5854
  };
@@ -5934,6 +6004,7 @@ System.register('pops', [], (function (exports) {
5934
6004
  const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
5935
6005
  // 赋值额外的$iframe参数
5936
6006
  evtConfig.$iframe = $iframe;
6007
+ const result = PopsHandler.handleResultConfig(evtConfig);
5937
6008
  popsDOMUtils.on($anim, popsDOMUtils.getAnimationEndNameList(), function () {
5938
6009
  // 动画加载完毕
5939
6010
  $anim.style.width = "0%";
@@ -6065,10 +6136,10 @@ System.register('pops', [], (function (exports) {
6065
6136
  capture: true,
6066
6137
  });
6067
6138
  // 关闭按钮点击事件
6068
- popsDOMUtils.on(headerCloseBtnElement, "click", (event) => {
6139
+ popsDOMUtils.on(headerCloseBtnElement, "click", async (event) => {
6069
6140
  event.preventDefault();
6070
6141
  event.stopPropagation();
6071
- PopsInstanceUtils.removeInstance([PopsInstData.iframe], guid, false);
6142
+ await PopsInstanceUtils.removeInstance([PopsInstData.iframe], guid, false);
6072
6143
  if (typeof config?.btn?.close?.callback === "function") {
6073
6144
  config.btn.close.callback(evtConfig, event);
6074
6145
  }
@@ -6082,8 +6153,9 @@ System.register('pops', [], (function (exports) {
6082
6153
  $mask: $mask,
6083
6154
  $shadowContainer: $shadowContainer,
6084
6155
  $shadowRoot: $shadowRoot,
6156
+ config: config,
6157
+ destory: result.close,
6085
6158
  });
6086
- const result = PopsHandler.handleResultConfig(evtConfig);
6087
6159
  return result;
6088
6160
  },
6089
6161
  };
@@ -7049,7 +7121,7 @@ System.register('pops', [], (function (exports) {
7049
7121
  isFixed: false,
7050
7122
  alwaysShow: false,
7051
7123
  onShowEventName: "mouseenter touchstart",
7052
- onCloseEventName: "mouseleave touchend",
7124
+ onCloseEventName: "mouseleave touchend touchcancel",
7053
7125
  zIndex: 10000,
7054
7126
  only: false,
7055
7127
  eventOption: {
@@ -7275,12 +7347,12 @@ System.register('pops', [], (function (exports) {
7275
7347
  changePosition(event) {
7276
7348
  const positionInfo = this.calcToolTipPosition(this.$data.config.$target, this.$data.config.arrowDistance, this.$data.config.otherDistance, event);
7277
7349
  const positionKey = this.$data.config.position.toUpperCase();
7278
- const positionDetail = positionInfo[positionKey];
7279
- if (positionDetail) {
7280
- this.$el.$toolTip.style.left = positionDetail.left + "px";
7281
- this.$el.$toolTip.style.top = positionDetail.top + "px";
7282
- this.$el.$toolTip.setAttribute("data-motion", positionDetail.motion);
7283
- this.$el.$arrow.setAttribute("data-position", positionDetail.arrow);
7350
+ const position = positionInfo[positionKey];
7351
+ if (position) {
7352
+ this.$el.$toolTip.style.left = position.left + "px";
7353
+ this.$el.$toolTip.style.top = position.top + "px";
7354
+ this.$el.$toolTip.setAttribute("data-motion", position.motion);
7355
+ this.$el.$arrow.setAttribute("data-position", position.arrow);
7284
7356
  }
7285
7357
  else {
7286
7358
  console.error("不存在该位置", this.$data.config.position);
@@ -7452,13 +7524,13 @@ System.register('pops', [], (function (exports) {
7452
7524
  */
7453
7525
  destory() {
7454
7526
  if (this.$el.$toolTip) {
7455
- this.$el.$shadowRoot.removeChild(this.$el.$toolTip);
7527
+ this.$el.$toolTip.remove();
7456
7528
  }
7457
- // @ts-ignore
7529
+ // @ts-expect-error
7458
7530
  this.$el.$toolTip = null;
7459
- // @ts-ignore
7531
+ // @ts-expect-error
7460
7532
  this.$el.$arrow = null;
7461
- // @ts-ignore
7533
+ // @ts-expect-error
7462
7534
  this.$el.$content = null;
7463
7535
  }
7464
7536
  /**
@@ -7506,29 +7578,29 @@ System.register('pops', [], (function (exports) {
7506
7578
  popsDOMUtils.on(this.$el.$toolTip, "mouseenter touchstart", this.toolTipMouseEnterEvent, this.$data.config.eventOption);
7507
7579
  }
7508
7580
  /**
7509
- * 取消监听鼠标|触摸事件
7581
+ * 取消监听事件 - 鼠标|触摸
7510
7582
  */
7511
7583
  offToolTipMouseEnterEvent() {
7512
7584
  popsDOMUtils.off(this.$el.$toolTip, "mouseenter touchstart", this.toolTipMouseEnterEvent, this.$data.config.eventOption);
7513
7585
  }
7514
7586
  /**
7515
- * 鼠标|触摸离开事件
7587
+ * 离开事件 - 鼠标|触摸
7516
7588
  */
7517
7589
  toolTipMouseLeaveEvent(event) {
7518
7590
  this.close(event);
7519
7591
  // this.$el.$toolTip.style.animationPlayState = "running";
7520
7592
  }
7521
7593
  /**
7522
- * 监听鼠标|触摸离开事件
7594
+ * 监听离开事件 - 鼠标|触摸
7523
7595
  */
7524
7596
  onToolTipMouseLeaveEvent() {
7525
- popsDOMUtils.on(this.$el.$toolTip, "mouseleave touchend", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
7597
+ popsDOMUtils.on(this.$el.$toolTip, "mouseleave touchend touchcancel", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
7526
7598
  }
7527
7599
  /**
7528
- * 取消监听鼠标|触摸离开事件
7600
+ * 取消监听离开事件 - 鼠标|触摸
7529
7601
  */
7530
7602
  offToolTipMouseLeaveEvent() {
7531
- popsDOMUtils.off(this.$el.$toolTip, "mouseleave touchend", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
7603
+ popsDOMUtils.off(this.$el.$toolTip, "mouseleave touchend touchcancel", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
7532
7604
  }
7533
7605
  }
7534
7606
  const PopsTooltip = {
@@ -7543,6 +7615,15 @@ System.register('pops', [], (function (exports) {
7543
7615
  throw new TypeError("config.target 必须是HTMLElement类型");
7544
7616
  }
7545
7617
  config = PopsHandler.handleOnly(popsType, config);
7618
+ if (config.position === "follow") {
7619
+ config.onShowEventName = config.onShowEventName.trim();
7620
+ const showEventNameSplit = config.onShowEventName.split(" ");
7621
+ ["mousemove", "touchmove"].forEach((it) => {
7622
+ if (showEventNameSplit.includes(it))
7623
+ return;
7624
+ config.onShowEventName += ` ${it}`;
7625
+ });
7626
+ }
7546
7627
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
7547
7628
  PopsHandler.handleInit($shadowRoot, [
7548
7629
  {
@@ -8807,7 +8888,7 @@ System.register('pops', [], (function (exports) {
8807
8888
  * 监听输入框内容改变
8808
8889
  */
8809
8890
  onValueChange() {
8810
- popsDOMUtils.on(this.$el.input, ["input", "propertychange"], void 0, (event) => {
8891
+ popsDOMUtils.on(this.$el.input, ["input", "propertychange"], (event) => {
8811
8892
  this.$data.value = this.$el.input.value;
8812
8893
  if (inputType !== "password") {
8813
8894
  // 不是密码框
@@ -9180,7 +9261,7 @@ System.register('pops', [], (function (exports) {
9180
9261
  * 监听点击事件
9181
9262
  */
9182
9263
  onClick() {
9183
- popsDOMUtils.on(this.$el.$select, "click", void 0, (event) => {
9264
+ popsDOMUtils.on(this.$el.$select, "click", (event) => {
9184
9265
  this.setSelectOptionsDisableStatus();
9185
9266
  if (typeof viewConfig.clickCallBack === "function") {
9186
9267
  const $isSelectedElement = this.$el.$select[this.$el.$select.selectedIndex];
@@ -10947,7 +11028,7 @@ System.register('pops', [], (function (exports) {
10947
11028
  * 设置按钮的点击事件
10948
11029
  */
10949
11030
  onButtonClick() {
10950
- popsDOMUtils.on(this.$ele.button, "click", void 0, (event) => {
11031
+ popsDOMUtils.on(this.$ele.button, "click", (event) => {
10951
11032
  if (typeof viewConfig.callback === "function") {
10952
11033
  viewConfig.callback(event);
10953
11034
  }
@@ -11016,13 +11097,13 @@ System.register('pops', [], (function (exports) {
11016
11097
  initContainerItem($container, formItemConfig) {
11017
11098
  const containerViewConfig = formItemConfig;
11018
11099
  if (containerViewConfig.type === "container") {
11019
- const childForms = containerViewConfig["views"];
11100
+ const childViewConfig = containerViewConfig["views"];
11020
11101
  // 每一项<li>元素
11021
- const formContainerListElement = popsDOMUtils.createElement("li");
11102
+ const $itemLi = popsDOMUtils.createElement("li");
11022
11103
  // 每一项<li>内的子<ul>元素
11023
- const formContainerULElement = popsDOMUtils.createElement("ul");
11024
- formContainerULElement.classList.add("pops-panel-forms-container-item-formlist");
11025
- formContainerListElement.classList.add("pops-panel-forms-container-item");
11104
+ const $itemUL = popsDOMUtils.createElement("ul");
11105
+ $itemUL.classList.add("pops-panel-forms-container-item-formlist");
11106
+ $itemLi.classList.add("pops-panel-forms-container-item");
11026
11107
  // 区域头部的文字
11027
11108
  const formHeaderDivElement = popsDOMUtils.createElement("div", {
11028
11109
  className: "pops-panel-forms-container-item-header-text",
@@ -11042,42 +11123,42 @@ System.register('pops', [], (function (exports) {
11042
11123
  `);
11043
11124
  // 添加点击事件
11044
11125
  popsDOMUtils.on(formHeaderDivElement, "click", () => {
11045
- if (formContainerListElement.hasAttribute("data-fold-enable")) {
11046
- formContainerListElement.removeAttribute("data-fold-enable");
11126
+ if ($itemLi.hasAttribute("data-fold-enable")) {
11127
+ $itemLi.removeAttribute("data-fold-enable");
11047
11128
  }
11048
11129
  else {
11049
- formContainerListElement.setAttribute("data-fold-enable", "");
11130
+ $itemLi.setAttribute("data-fold-enable", "");
11050
11131
  }
11051
11132
  });
11052
11133
  popsDOMUtils.addClassName(formHeaderDivElement, "pops-panel-forms-fold-container");
11053
11134
  popsDOMUtils.addClassName(formHeaderDivElement, PopsCommonCSSClassName.userSelectNone);
11054
- formContainerListElement.setAttribute("data-fold-enable", "");
11135
+ $itemLi.setAttribute("data-fold-enable", "");
11055
11136
  popsDOMUtils.addClassName(formHeaderDivElement, "pops-panel-forms-fold");
11056
- formContainerListElement.appendChild(formHeaderDivElement);
11137
+ $itemLi.appendChild(formHeaderDivElement);
11057
11138
  }
11058
11139
  else {
11059
11140
  // 加进容器内
11060
- formContainerListElement.appendChild(formHeaderDivElement);
11141
+ $itemLi.appendChild(formHeaderDivElement);
11061
11142
  }
11062
- that.setElementClassName(formContainerListElement, formItemConfig.className);
11063
- that.setElementAttributes(formContainerListElement, formItemConfig.attributes);
11064
- that.setElementProps(formContainerListElement, formItemConfig.props);
11065
- childForms.forEach((childViewConfig) => {
11143
+ that.setElementClassName($itemLi, formItemConfig.className);
11144
+ that.setElementAttributes($itemLi, formItemConfig.attributes);
11145
+ that.setElementProps($itemLi, formItemConfig.props);
11146
+ $itemLi.appendChild($itemUL);
11147
+ $container.appendChild($itemLi);
11148
+ childViewConfig.forEach((childViewConfig) => {
11066
11149
  that.uListContainerAddItem(childViewConfig, {
11067
- ulElement: formContainerULElement,
11150
+ ulElement: $itemUL,
11068
11151
  sectionContainerULElement: that.sectionContainerULElement,
11069
- formContainerListElement: formContainerListElement,
11152
+ formContainerListElement: $itemLi,
11070
11153
  formHeaderDivElement: formHeaderDivElement,
11071
11154
  });
11072
11155
  });
11073
- formContainerListElement.appendChild(formContainerULElement);
11074
- $container.appendChild(formContainerListElement);
11075
11156
  if (typeof containerViewConfig.afterAddToUListCallBack === "function") {
11076
11157
  containerViewConfig.afterAddToUListCallBack(viewConfig, {
11077
- target: formContainerListElement,
11078
- ulElement: formContainerULElement,
11158
+ target: $itemLi,
11159
+ ulElement: $itemUL,
11079
11160
  sectionContainerULElement: that.sectionContainerULElement,
11080
- formContainerListElement: formContainerListElement,
11161
+ formContainerListElement: $itemLi,
11081
11162
  formHeaderDivElement: formHeaderDivElement,
11082
11163
  });
11083
11164
  }
@@ -11216,7 +11297,7 @@ System.register('pops', [], (function (exports) {
11216
11297
  },
11217
11298
  /** 设置项的点击事件 */
11218
11299
  onLiClick() {
11219
- popsDOMUtils.on($li, "click", void 0, async (event) => {
11300
+ popsDOMUtils.on($li, "click", async (event) => {
11220
11301
  if (typeof viewConfig.clickCallBack === "function") {
11221
11302
  const result = await viewConfig.clickCallBack(event, viewConfig);
11222
11303
  if (result) {
@@ -11544,6 +11625,7 @@ System.register('pops', [], (function (exports) {
11544
11625
  }
11545
11626
  // 处理返回的配置
11546
11627
  const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
11628
+ const result = PopsHandler.handleResultConfig(evtConfig);
11547
11629
  // 为顶部右边的关闭按钮添加点击事件
11548
11630
  PopsHandler.handleClickEvent("close", $headerBtnClose, evtConfig, config.btn?.close?.callback);
11549
11631
  // 创建到页面中
@@ -11581,6 +11663,8 @@ System.register('pops', [], (function (exports) {
11581
11663
  $mask: $mask,
11582
11664
  $shadowContainer: $shadowContainer,
11583
11665
  $shadowRoot: $shadowRoot,
11666
+ config: config,
11667
+ destory: result.close,
11584
11668
  });
11585
11669
  // 拖拽
11586
11670
  if (config.drag) {
@@ -11592,7 +11676,6 @@ System.register('pops', [], (function (exports) {
11592
11676
  endCallBack: config.dragEndCallBack,
11593
11677
  });
11594
11678
  }
11595
- const result = PopsHandler.handleResultConfig(evtConfig);
11596
11679
  return {
11597
11680
  ...result,
11598
11681
  addEventListener: (event, listener, options) => {
@@ -11784,6 +11867,7 @@ System.register('pops', [], (function (exports) {
11784
11867
  $elList.push($mask);
11785
11868
  }
11786
11869
  const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
11870
+ const result = PopsHandler.handleResultConfig(evtConfig);
11787
11871
  // 输入框赋值初始值
11788
11872
  $input.value = config.content.text;
11789
11873
  PopsHandler.handlePromptClickEvent("close", $input, $btnClose, evtConfig, config.btn.close.callback);
@@ -11806,6 +11890,8 @@ System.register('pops', [], (function (exports) {
11806
11890
  $mask: $mask,
11807
11891
  $shadowContainer: $shadowContainer,
11808
11892
  $shadowRoot: $shadowRoot,
11893
+ config: config,
11894
+ destory: result.close,
11809
11895
  });
11810
11896
  // 拖拽
11811
11897
  if (config.drag) {
@@ -11825,7 +11911,6 @@ System.register('pops', [], (function (exports) {
11825
11911
  if (config.content.select) {
11826
11912
  $input.select();
11827
11913
  }
11828
- const result = PopsHandler.handleResultConfig(evtConfig);
11829
11914
  return result;
11830
11915
  },
11831
11916
  };
@@ -11927,6 +12012,7 @@ System.register('pops', [], (function (exports) {
11927
12012
  beforeAppendToPageCallBack() { },
11928
12013
  limitPositionXInView: true,
11929
12014
  limitPositionYInView: true,
12015
+ beforeShowCallBack() { },
11930
12016
  };
11931
12017
  };
11932
12018
 
@@ -11986,6 +12072,8 @@ System.register('pops', [], (function (exports) {
11986
12072
  return;
11987
12073
  }
11988
12074
  if ($click.className && $click.className === "pops-shadow-container" && $click.shadowRoot != null) {
12075
+ // pops的shadow-container
12076
+ PopsContextMenu.shadowRootCheckClickEvent(event);
11989
12077
  return;
11990
12078
  }
11991
12079
  PopsContextMenu.closeAllMenu(PopsContextMenu.$el.$root);
@@ -11998,7 +12086,7 @@ System.register('pops', [], (function (exports) {
11998
12086
  if (!PopsContextMenu.$el.$root) {
11999
12087
  return;
12000
12088
  }
12001
- const $click = event.target;
12089
+ const $click = event.composedPath()[0];
12002
12090
  if ($click.closest(`.pops-${popsType}`)) {
12003
12091
  return;
12004
12092
  }
@@ -12008,13 +12096,13 @@ System.register('pops', [], (function (exports) {
12008
12096
  * 添加全局点击检测事件
12009
12097
  */
12010
12098
  addWindowCheckClickListener() {
12011
- popsDOMUtils.on(globalThis, "click touchstart", void 0, PopsContextMenu.windowCheckClickEvent, {
12099
+ popsDOMUtils.on(globalThis, "click touchstart", PopsContextMenu.windowCheckClickEvent, {
12012
12100
  capture: true,
12013
12101
  });
12014
12102
  if (config.$target instanceof Node) {
12015
12103
  const $shadowRoot = config.$target.getRootNode();
12016
12104
  if ($shadowRoot instanceof ShadowRoot) {
12017
- popsDOMUtils.on($shadowRoot, "click touchstart", void 0, PopsContextMenu.shadowRootCheckClickEvent, {
12105
+ popsDOMUtils.on($shadowRoot, "click touchstart", PopsContextMenu.shadowRootCheckClickEvent, {
12018
12106
  capture: true,
12019
12107
  });
12020
12108
  }
@@ -12024,13 +12112,13 @@ System.register('pops', [], (function (exports) {
12024
12112
  * 移除全局点击检测事件
12025
12113
  */
12026
12114
  removeWindowCheckClickListener() {
12027
- popsDOMUtils.off(globalThis, "click touchstart", void 0, PopsContextMenu.windowCheckClickEvent, {
12115
+ popsDOMUtils.off(globalThis, "click touchstart", PopsContextMenu.windowCheckClickEvent, {
12028
12116
  capture: true,
12029
12117
  });
12030
12118
  if (config.$target instanceof Node) {
12031
12119
  const $shadowRoot = config.$target.getRootNode();
12032
12120
  if ($shadowRoot instanceof ShadowRoot) {
12033
- popsDOMUtils.off($shadowRoot, "click touchstart", void 0, PopsContextMenu.windowCheckClickEvent, {
12121
+ popsDOMUtils.off($shadowRoot, "click touchstart", PopsContextMenu.windowCheckClickEvent, {
12034
12122
  capture: true,
12035
12123
  });
12036
12124
  }
@@ -12041,7 +12129,7 @@ System.register('pops', [], (function (exports) {
12041
12129
  * @param event
12042
12130
  * @param selectorTarget
12043
12131
  */
12044
- contextMenuEvent(event, selectorTarget) {
12132
+ async contextMenuEvent(event, selectorTarget) {
12045
12133
  if (config.preventDefault) {
12046
12134
  popsDOMUtils.preventEvent(event);
12047
12135
  }
@@ -12050,6 +12138,10 @@ System.register('pops', [], (function (exports) {
12050
12138
  PopsContextMenu.closeAllMenu(PopsContextMenu.$el.$root);
12051
12139
  }
12052
12140
  selectorTarget = selectorTarget ?? config.$target;
12141
+ const beforeShowCallBackResult = await config?.beforeShowCallBack(event);
12142
+ if (typeof beforeShowCallBackResult === "boolean" && !beforeShowCallBackResult) {
12143
+ return;
12144
+ }
12053
12145
  const rootElement = PopsContextMenu.showMenu(event, config.data, selectorTarget);
12054
12146
  PopsContextMenu.$el.$root = rootElement;
12055
12147
  if (config.only) {
@@ -12062,6 +12154,10 @@ System.register('pops', [], (function (exports) {
12062
12154
  beforeRemoveCallBack(instCommonConfig) {
12063
12155
  PopsContextMenu.closeAllMenu(instCommonConfig.$pops);
12064
12156
  },
12157
+ config: config,
12158
+ destory: () => {
12159
+ PopsContextMenu.closeAllMenu(rootElement);
12160
+ },
12065
12161
  });
12066
12162
  }
12067
12163
  },
@@ -12365,7 +12461,8 @@ System.register('pops', [], (function (exports) {
12365
12461
  menuLiElement.appendChild(iconElement);
12366
12462
  }
12367
12463
  // 插入文字
12368
- menuLiElement.insertAdjacentHTML("beforeend", PopsSafeUtils.getSafeHTML(`<span>${item.text}</span>`));
12464
+ const text = typeof item.text === "function" ? item.text() : item.text;
12465
+ menuLiElement.insertAdjacentHTML("beforeend", PopsSafeUtils.getSafeHTML(`<span>${text}</span>`));
12369
12466
  // 如果存在子数据,显示
12370
12467
  if (item.item && Array.isArray(item.item)) {
12371
12468
  popsDOMUtils.addClassName(menuLiElement, `pops-${popsType}-item`);
@@ -13004,10 +13101,10 @@ System.register('pops', [], (function (exports) {
13004
13101
  setShowEvent(option = defaultListenerOption) {
13005
13102
  /* 焦点|点击事件*/
13006
13103
  if (config.followPosition === "target") {
13007
- popsDOMUtils.on([config.$target], ["focus", "click"], void 0, SearchSuggestion.showEvent, option);
13104
+ popsDOMUtils.on([config.$target], ["focus", "click"], SearchSuggestion.showEvent, option);
13008
13105
  }
13009
13106
  else if (config.followPosition === "input") {
13010
- popsDOMUtils.on([config.$inputTarget], ["focus", "click"], void 0, SearchSuggestion.showEvent, option);
13107
+ popsDOMUtils.on([config.$inputTarget], ["focus", "click"], SearchSuggestion.showEvent, option);
13011
13108
  }
13012
13109
  else if (config.followPosition === "inputCursor") {
13013
13110
  popsDOMUtils.on([config.$inputTarget], ["focus", "click", "input"], SearchSuggestion.showEvent, option);
@@ -13021,9 +13118,9 @@ System.register('pops', [], (function (exports) {
13021
13118
  */
13022
13119
  removeShowEvent(option = defaultListenerOption) {
13023
13120
  /* 焦点|点击事件*/
13024
- popsDOMUtils.off([config.$target, config.$inputTarget], ["focus", "click"], void 0, SearchSuggestion.showEvent, option);
13121
+ popsDOMUtils.off([config.$target, config.$inputTarget], ["focus", "click"], SearchSuggestion.showEvent, option);
13025
13122
  // 内容改变事件
13026
- popsDOMUtils.off([config.$inputTarget], ["input"], void 0, SearchSuggestion.showEvent, option);
13123
+ popsDOMUtils.off([config.$inputTarget], ["input"], SearchSuggestion.showEvent, option);
13027
13124
  },
13028
13125
  /**
13029
13126
  * 隐藏搜索建议框的事件
@@ -13054,7 +13151,7 @@ System.register('pops', [], (function (exports) {
13054
13151
  // 全局触摸屏点击事件
13055
13152
  if (Array.isArray(SearchSuggestion.selfDocument)) {
13056
13153
  SearchSuggestion.selfDocument.forEach(($checkParent) => {
13057
- popsDOMUtils.on($checkParent, ["click", "touchstart"], void 0, SearchSuggestion.hideEvent, option);
13154
+ popsDOMUtils.on($checkParent, ["click", "touchstart"], SearchSuggestion.hideEvent, option);
13058
13155
  });
13059
13156
  }
13060
13157
  else {
@@ -13067,11 +13164,11 @@ System.register('pops', [], (function (exports) {
13067
13164
  removeHideEvent(option = defaultListenerOption) {
13068
13165
  if (Array.isArray(SearchSuggestion.selfDocument)) {
13069
13166
  SearchSuggestion.selfDocument.forEach(($checkParent) => {
13070
- popsDOMUtils.off($checkParent, ["click", "touchstart"], void 0, SearchSuggestion.hideEvent, option);
13167
+ popsDOMUtils.off($checkParent, ["click", "touchstart"], SearchSuggestion.hideEvent, option);
13071
13168
  });
13072
13169
  }
13073
13170
  else {
13074
- popsDOMUtils.off(SearchSuggestion.selfDocument, ["click", "touchstart"], void 0, SearchSuggestion.hideEvent, option);
13171
+ popsDOMUtils.off(SearchSuggestion.selfDocument, ["click", "touchstart"], SearchSuggestion.hideEvent, option);
13075
13172
  }
13076
13173
  },
13077
13174
  /**
@@ -13332,7 +13429,7 @@ System.register('pops', [], (function (exports) {
13332
13429
  },
13333
13430
  };
13334
13431
 
13335
- const version = "3.1.3";
13432
+ const version = "3.2.0";
13336
13433
 
13337
13434
  class Pops {
13338
13435
  /** 配置 */