@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
@@ -517,7 +517,7 @@ var pops = (function () {
517
517
  * @param propName
518
518
  */
519
519
  delete(target, propName) {
520
- if (typeof Reflect === "object" && Reflect.deleteProperty) {
520
+ if (typeof Reflect === "object" && typeof Reflect.deleteProperty === "function") {
521
521
  Reflect.deleteProperty(target, propName);
522
522
  }
523
523
  else {
@@ -1023,13 +1023,13 @@ var pops = (function () {
1023
1023
  if (element == null) {
1024
1024
  return;
1025
1025
  }
1026
- let elementList = [];
1026
+ let $elList = [];
1027
1027
  if (element instanceof NodeList || Array.isArray(element)) {
1028
1028
  element = element;
1029
- elementList = [...element];
1029
+ $elList = $elList.concat(element);
1030
1030
  }
1031
1031
  else {
1032
- elementList.push(element);
1032
+ $elList.push(element);
1033
1033
  }
1034
1034
  let eventTypeList = [];
1035
1035
  if (Array.isArray(eventType)) {
@@ -1080,7 +1080,7 @@ var pops = (function () {
1080
1080
  // 目标函数、事件名、回调函数、事件配置、过滤函数
1081
1081
  filter = option;
1082
1082
  }
1083
- elementList.forEach((elementItem) => {
1083
+ $elList.forEach((elementItem) => {
1084
1084
  // 获取对象上的事件
1085
1085
  const elementEvents = Reflect.get(elementItem, SymbolEvents) || {};
1086
1086
  eventTypeList.forEach((eventName) => {
@@ -1127,18 +1127,19 @@ var pops = (function () {
1127
1127
  * @param eventType (可选)需要取消监听的事件
1128
1128
  */
1129
1129
  offAll(element, eventType) {
1130
+ const that = this;
1130
1131
  if (typeof element === "string") {
1131
- element = PopsCore.document.querySelectorAll(element);
1132
+ element = that.selectorAll(element);
1132
1133
  }
1133
1134
  if (element == null) {
1134
1135
  return;
1135
1136
  }
1136
- let elementList = [];
1137
+ let $elList = [];
1137
1138
  if (element instanceof NodeList || Array.isArray(element)) {
1138
- elementList = [...element];
1139
+ $elList = $elList.concat(Array.from(element));
1139
1140
  }
1140
1141
  else {
1141
- elementList.push(element);
1142
+ $elList.push(element);
1142
1143
  }
1143
1144
  let eventTypeList = [];
1144
1145
  if (Array.isArray(eventType)) {
@@ -1147,12 +1148,13 @@ var pops = (function () {
1147
1148
  else if (typeof eventType === "string") {
1148
1149
  eventTypeList = eventTypeList.concat(eventType.split(" "));
1149
1150
  }
1150
- elementList.forEach((elementItem) => {
1151
- Object.getOwnPropertySymbols(elementItem).forEach((__symbolEvents) => {
1152
- if (!__symbolEvents.toString().startsWith("Symbol(events_")) {
1151
+ $elList.forEach(($elItem) => {
1152
+ const symbolList = [...new Set([...Object.getOwnPropertySymbols($elItem), SymbolEvents])];
1153
+ symbolList.forEach((symbolItem) => {
1154
+ if (!symbolItem.toString().startsWith("Symbol(events_")) {
1153
1155
  return;
1154
1156
  }
1155
- const elementEvents = elementItem[__symbolEvents] || {};
1157
+ const elementEvents = Reflect.get($elItem, symbolItem) || {};
1156
1158
  const iterEventNameList = eventTypeList.length ? eventTypeList : Object.keys(elementEvents);
1157
1159
  iterEventNameList.forEach((eventName) => {
1158
1160
  const handlers = elementEvents[eventName];
@@ -1160,11 +1162,12 @@ var pops = (function () {
1160
1162
  return;
1161
1163
  }
1162
1164
  for (const handler of handlers) {
1163
- elementItem.removeEventListener(eventName, handler.callback, {
1165
+ $elItem.removeEventListener(eventName, handler.callback, {
1164
1166
  capture: handler["option"]["capture"],
1165
1167
  });
1166
1168
  }
1167
- popsUtils.delete(elementItem[__symbolEvents], eventName);
1169
+ const events = Reflect.get($elItem, symbolItem);
1170
+ popsUtils.delete(events, eventName);
1168
1171
  });
1169
1172
  });
1170
1173
  });
@@ -1907,7 +1910,8 @@ var pops = (function () {
1907
1910
  }
1908
1911
  return $el.classList.contains(className);
1909
1912
  }
1910
- css(element, property, value) {
1913
+ css($el, property, value) {
1914
+ const that = this;
1911
1915
  /**
1912
1916
  * 把纯数字没有px的加上
1913
1917
  */
@@ -1921,10 +1925,33 @@ var pops = (function () {
1921
1925
  }
1922
1926
  return propertyValue;
1923
1927
  }
1924
- if (typeof element === "string") {
1925
- element = PopsCore.document.querySelector(element);
1928
+ if (typeof $el === "string") {
1929
+ $el = that.selectorAll($el);
1926
1930
  }
1927
- if (element == null) {
1931
+ if ($el == null) {
1932
+ return;
1933
+ }
1934
+ if (Array.isArray($el) || $el instanceof NodeList) {
1935
+ if (typeof property === "string") {
1936
+ if (value == null) {
1937
+ // 获取属性
1938
+ return that.css($el[0], property);
1939
+ }
1940
+ else {
1941
+ // 设置属性
1942
+ $el.forEach(($elItem) => {
1943
+ that.css($elItem, property);
1944
+ });
1945
+ return;
1946
+ }
1947
+ }
1948
+ else if (typeof property === "object") {
1949
+ // 设置属性
1950
+ $el.forEach(($elItem) => {
1951
+ that.css($elItem, property);
1952
+ });
1953
+ return;
1954
+ }
1928
1955
  return;
1929
1956
  }
1930
1957
  const setStyleProperty = (propertyName, propertyValue) => {
@@ -1933,16 +1960,16 @@ var pops = (function () {
1933
1960
  .trim()
1934
1961
  .replace(/!important$/gi, "")
1935
1962
  .trim();
1936
- element.style.setProperty(propertyName, propertyValue, "important");
1963
+ $el.style.setProperty(propertyName, propertyValue, "important");
1937
1964
  }
1938
1965
  else {
1939
1966
  propertyValue = handlePixe(propertyName, propertyValue);
1940
- element.style.setProperty(propertyName, propertyValue);
1967
+ $el.style.setProperty(propertyName, propertyValue);
1941
1968
  }
1942
1969
  };
1943
1970
  if (typeof property === "string") {
1944
1971
  if (value == null) {
1945
- return getComputedStyle(element).getPropertyValue(property);
1972
+ return PopsCore.globalThis.getComputedStyle($el).getPropertyValue(property);
1946
1973
  }
1947
1974
  else {
1948
1975
  setStyleProperty(property, value);
@@ -1954,6 +1981,10 @@ var pops = (function () {
1954
1981
  setStyleProperty(prop, value);
1955
1982
  }
1956
1983
  }
1984
+ else {
1985
+ // 其他情况
1986
+ throw new TypeError("property must be string or object");
1987
+ }
1957
1988
  }
1958
1989
  /**
1959
1990
  * 创建元素
@@ -3088,16 +3119,16 @@ var pops = (function () {
3088
3119
  },
3089
3120
  /**
3090
3121
  * 删除配置中对应的对象
3091
- * @param instConfigList 配置实例列表
3122
+ * @param totalInstConfigList 配置实例列表
3092
3123
  * @param guid 唯一标识
3093
3124
  * @param isAll 是否全部删除
3094
3125
  */
3095
- removeInstance(instConfigList, guid, isAll = false) {
3126
+ async removeInstance(totalInstConfigList, guid, isAll = false) {
3096
3127
  /**
3097
3128
  * 移除元素实例
3098
3129
  * @param instCommonConfig
3099
3130
  */
3100
- function removeItem(instCommonConfig) {
3131
+ const removeInst = function (instCommonConfig) {
3101
3132
  if (typeof instCommonConfig.beforeRemoveCallBack === "function") {
3102
3133
  // 调用移除签的回调
3103
3134
  instCommonConfig.beforeRemoveCallBack(instCommonConfig);
@@ -3106,39 +3137,44 @@ var pops = (function () {
3106
3137
  instCommonConfig?.$pops?.remove();
3107
3138
  instCommonConfig?.$mask?.remove();
3108
3139
  instCommonConfig?.$shadowContainer?.remove();
3109
- }
3140
+ };
3141
+ const asyncInstTask = [];
3110
3142
  // [ inst[], inst[],...]
3111
- instConfigList.forEach((instConfigList) => {
3143
+ totalInstConfigList.forEach((instConfigList) => {
3112
3144
  // inst[]
3113
- instConfigList.forEach((instConfigItem, index) => {
3145
+ instConfigList.forEach(async (instConfigItem, index) => {
3114
3146
  // 移除全部或者guid相同
3115
- if (isAll || instConfigItem["guid"] === guid) {
3147
+ if (isAll || (typeof guid === "string" && instConfigItem.guid === guid)) {
3116
3148
  // 判断是否有动画
3117
3149
  const animName = instConfigItem.$anim.getAttribute("anim");
3118
3150
  if (PopsAnimation.hasAnim(animName)) {
3119
3151
  const reverseAnimName = animName + "-reverse";
3120
- instConfigItem.$anim.style.width = "100%";
3121
- instConfigItem.$anim.style.height = "100%";
3122
- instConfigItem.$anim.style["animation-name"] = reverseAnimName;
3123
- if (PopsAnimation.hasAnim(instConfigItem.$anim.style["animation-name"])) {
3124
- popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), function () {
3125
- removeItem(instConfigItem);
3126
- }, {
3127
- capture: true,
3128
- });
3152
+ popsDOMUtils.css(instConfigItem.$anim, "width", "100%");
3153
+ popsDOMUtils.css(instConfigItem.$anim, "height", "100%");
3154
+ popsDOMUtils.css(instConfigItem.$anim, "animation-name", reverseAnimName);
3155
+ if (PopsAnimation.hasAnim(popsDOMUtils.css(instConfigItem.$anim, "animation-name"))) {
3156
+ asyncInstTask.push(new Promise((resolve) => {
3157
+ popsDOMUtils.on(instConfigItem.$anim, popsDOMUtils.getAnimationEndNameList(), function () {
3158
+ removeInst(instConfigItem);
3159
+ resolve();
3160
+ }, {
3161
+ capture: true,
3162
+ });
3163
+ }));
3129
3164
  }
3130
3165
  else {
3131
- removeItem(instConfigItem);
3166
+ removeInst(instConfigItem);
3132
3167
  }
3133
3168
  }
3134
3169
  else {
3135
- removeItem(instConfigItem);
3170
+ removeInst(instConfigItem);
3136
3171
  }
3137
3172
  instConfigList.splice(index, 1);
3138
3173
  }
3139
3174
  });
3140
3175
  });
3141
- return instConfigList;
3176
+ await Promise.all(asyncInstTask);
3177
+ return totalInstConfigList;
3142
3178
  },
3143
3179
  /**
3144
3180
  * 隐藏
@@ -3283,8 +3319,9 @@ var pops = (function () {
3283
3319
  * @param config
3284
3320
  * @param $anim
3285
3321
  */
3286
- close(config, popsType, instConfigList, guid, $anim) {
3287
- return new Promise((resolve) => {
3322
+ async close(config, popsType, instConfigList, guid, $anim) {
3323
+ // eslint-disable-next-line no-async-promise-executor
3324
+ await new Promise(async (resolve) => {
3288
3325
  const $pops = $anim.querySelector(".pops[type-value]");
3289
3326
  const drawerConfig = config;
3290
3327
  /**
@@ -3294,12 +3331,12 @@ var pops = (function () {
3294
3331
  /**
3295
3332
  * 弹窗已关闭的回调
3296
3333
  */
3297
- function closeCallBack(event) {
3334
+ async function closeCallBack(event) {
3298
3335
  if (event.propertyName !== "transform") {
3299
3336
  return;
3300
3337
  }
3301
- popsDOMUtils.off($pops, popsDOMUtils.getTransitionEndNameList(), void 0, closeCallBack);
3302
- PopsInstanceUtils.removeInstance([instConfigList], guid);
3338
+ popsDOMUtils.off($pops, popsDOMUtils.getTransitionEndNameList(), closeCallBack);
3339
+ await PopsInstanceUtils.removeInstance([instConfigList], guid);
3303
3340
  resolve();
3304
3341
  }
3305
3342
  // 监听过渡结束
@@ -3331,10 +3368,32 @@ var pops = (function () {
3331
3368
  }, drawerConfig.closeDelay);
3332
3369
  }
3333
3370
  else {
3334
- PopsInstanceUtils.removeInstance([instConfigList], guid);
3371
+ await PopsInstanceUtils.removeInstance([instConfigList], guid);
3335
3372
  resolve();
3336
3373
  }
3337
3374
  });
3375
+ // 判断组件内是否有rightClickMenu、tooltip、searchSuggestion组件
3376
+ // 有的话也需要关闭
3377
+ PopsInstData.rightClickMenu.forEach((itemConfig) => {
3378
+ const config = itemConfig.config;
3379
+ if (config.$target instanceof HTMLElement) {
3380
+ const $root = config.$target.getRootNode();
3381
+ if ($root instanceof HTMLElement && $root.parentElement == null) {
3382
+ // 触发销毁元素
3383
+ itemConfig.destory();
3384
+ }
3385
+ }
3386
+ });
3387
+ PopsInstData.tooltip.forEach((itemConfig) => {
3388
+ const config = itemConfig.config;
3389
+ if (config.$target instanceof HTMLElement) {
3390
+ const $root = config.$target.getRootNode();
3391
+ if ($root instanceof HTMLElement && $root.parentElement == null) {
3392
+ // 触发销毁元素
3393
+ itemConfig.destory();
3394
+ }
3395
+ }
3396
+ });
3338
3397
  },
3339
3398
  /**
3340
3399
  * 拖拽元素
@@ -3673,12 +3732,12 @@ var pops = (function () {
3673
3732
  element.hasAttribute("anim"));
3674
3733
  }
3675
3734
  // 判断按下的元素是否是pops-anim
3676
- popsDOMUtils.on(config.animElement, ["touchstart", "mousedown"], void 0, (event) => {
3735
+ popsDOMUtils.on(config.animElement, ["touchstart", "mousedown"], (event) => {
3677
3736
  const $click = event.composedPath()[0];
3678
3737
  isMaskClick = isAnimElement($click);
3679
3738
  });
3680
3739
  // 如果有动画层,在动画层上监听点击事件
3681
- popsDOMUtils.on(config.animElement, "click", void 0, (event) => {
3740
+ popsDOMUtils.on(config.animElement, "click", (event) => {
3682
3741
  const $click = event.composedPath()[0];
3683
3742
  if (isAnimElement($click) && isMaskClick) {
3684
3743
  return clickEvent(event);
@@ -3686,7 +3745,7 @@ var pops = (function () {
3686
3745
  });
3687
3746
  // 在遮罩层监听点击事件
3688
3747
  // 如果有动画层,那么该点击事件触发不了
3689
- popsDOMUtils.on(result.maskElement, "click", void 0, (event) => {
3748
+ popsDOMUtils.on(result.maskElement, "click", (event) => {
3690
3749
  isMaskClick = true;
3691
3750
  clickEvent(event);
3692
3751
  });
@@ -3829,13 +3888,13 @@ var pops = (function () {
3829
3888
  * @param guid
3830
3889
  * @param $shadowContainer
3831
3890
  * @param $shadowRoot
3832
- * @param mode 当前弹窗类型
3891
+ * @param type 当前弹窗类型
3833
3892
  * @param $anim 动画层
3834
3893
  * @param $pops 主元素
3835
3894
  * @param $mask 遮罩层
3836
3895
  * @param config 当前配置
3837
3896
  */
3838
- handleEventConfig(config, guid, $shadowContainer, $shadowRoot, mode, $anim, $pops, $mask) {
3897
+ handleEventConfig(config, guid, $shadowContainer, $shadowRoot, type, $anim, $pops, $mask) {
3839
3898
  return {
3840
3899
  $shadowContainer: $shadowContainer,
3841
3900
  $shadowRoot: $shadowRoot,
@@ -3843,44 +3902,47 @@ var pops = (function () {
3843
3902
  $anim: $anim,
3844
3903
  $pops: $pops,
3845
3904
  $mask: $mask,
3846
- mode: mode,
3905
+ mode: type,
3847
3906
  guid: guid,
3848
3907
  close() {
3849
- return PopsInstanceUtils.close(config, mode, PopsInstData[mode], guid, $anim);
3908
+ return PopsInstanceUtils.close(config, type, PopsInstData[type], guid, $anim);
3850
3909
  },
3851
3910
  hide() {
3852
- return PopsInstanceUtils.hide(config, mode, PopsInstData[mode], guid, $anim, $mask);
3911
+ return PopsInstanceUtils.hide(config, type, PopsInstData[type], guid, $anim, $mask);
3853
3912
  },
3854
- show() {
3855
- return PopsInstanceUtils.show(config, mode, PopsInstData[mode], guid, $anim, $mask);
3913
+ show($parent) {
3914
+ if ($parent) {
3915
+ $parent.appendChild(PopsInstData[type][0].$shadowRoot);
3916
+ }
3917
+ return PopsInstanceUtils.show(config, type, PopsInstData[type], guid, $anim, $mask);
3856
3918
  },
3857
3919
  };
3858
3920
  },
3859
3921
  /**
3860
3922
  * 获取loading的事件配置
3861
3923
  * @param guid
3862
- * @param mode 当前弹窗类型
3924
+ * @param type 当前弹窗类型
3863
3925
  * @param $anim 动画层
3864
3926
  * @param $pops 主元素
3865
3927
  * @param $mask 遮罩层
3866
3928
  * @param config 当前配置
3867
3929
  */
3868
- handleLoadingEventConfig(config, guid, mode, $anim, $pops, $mask) {
3930
+ handleLoadingEventConfig(config, guid, type, $anim, $pops, $mask) {
3869
3931
  return {
3870
3932
  $el: $anim,
3871
3933
  $anim: $anim,
3872
3934
  $pops: $pops,
3873
3935
  $mask: $mask,
3874
- mode: mode,
3936
+ mode: type,
3875
3937
  guid: guid,
3876
3938
  close() {
3877
- return PopsInstanceUtils.close(config, mode, PopsInstData[mode], guid, $anim);
3939
+ return PopsInstanceUtils.close(config, type, PopsInstData[type], guid, $anim);
3878
3940
  },
3879
3941
  hide() {
3880
- return PopsInstanceUtils.hide(config, mode, PopsInstData[mode], guid, $anim, $mask);
3942
+ return PopsInstanceUtils.hide(config, type, PopsInstData[type], guid, $anim, $mask);
3881
3943
  },
3882
3944
  show() {
3883
- return PopsInstanceUtils.show(config, mode, PopsInstData[mode], guid, $anim, $mask);
3945
+ return PopsInstanceUtils.show(config, type, PopsInstData[type], guid, $anim, $mask);
3884
3946
  },
3885
3947
  };
3886
3948
  },
@@ -3993,8 +4055,8 @@ var pops = (function () {
3993
4055
  handleOnly(type, config) {
3994
4056
  if (config.only) {
3995
4057
  // .loading
3996
- // .tooltip
3997
4058
  // .rightClickMenu
4059
+ // .tooltip
3998
4060
  // 单独处理
3999
4061
  if (type === "loading" || type === "tooltip" || type === "rightClickMenu") {
4000
4062
  const inst = PopsInstData[type];
@@ -4006,11 +4068,11 @@ var pops = (function () {
4006
4068
  PopsInstanceUtils.removeInstance([
4007
4069
  PopsInstData.alert,
4008
4070
  PopsInstData.confirm,
4009
- PopsInstData.prompt,
4010
- PopsInstData.iframe,
4011
4071
  PopsInstData.drawer,
4012
4072
  PopsInstData.folder,
4073
+ PopsInstData.iframe,
4013
4074
  PopsInstData.panel,
4075
+ PopsInstData.prompt,
4014
4076
  ], "", true);
4015
4077
  }
4016
4078
  }
@@ -4174,6 +4236,7 @@ var pops = (function () {
4174
4236
  }
4175
4237
  // 处理返回的配置
4176
4238
  const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
4239
+ const result = PopsHandler.handleResultConfig(evtConfig);
4177
4240
  // 为顶部右边的关闭按钮添加点击事件
4178
4241
  PopsHandler.handleClickEvent("close", $headerCloseBtn, evtConfig, config.btn.close?.callback);
4179
4242
  // 为底部ok按钮添加点击事件
@@ -4196,6 +4259,8 @@ var pops = (function () {
4196
4259
  $mask: $mask,
4197
4260
  $shadowContainer: $shadowContainer,
4198
4261
  $shadowRoot: $shadowRoot,
4262
+ config: config,
4263
+ destory: result.close,
4199
4264
  });
4200
4265
  // 拖拽
4201
4266
  if (config.drag) {
@@ -4207,7 +4272,6 @@ var pops = (function () {
4207
4272
  endCallBack: config.dragEndCallBack,
4208
4273
  });
4209
4274
  }
4210
- const result = PopsHandler.handleResultConfig(evtConfig);
4211
4275
  return result;
4212
4276
  },
4213
4277
  };
@@ -4381,6 +4445,7 @@ var pops = (function () {
4381
4445
  $elList.push($mask);
4382
4446
  }
4383
4447
  const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
4448
+ const result = PopsHandler.handleResultConfig(evtConfig);
4384
4449
  PopsHandler.handleClickEvent("close", $btnClose, evtConfig, config.btn.close.callback);
4385
4450
  PopsHandler.handleClickEvent("ok", $btnOk, evtConfig, config.btn.ok.callback);
4386
4451
  PopsHandler.handleClickEvent("cancel", $btnCancel, evtConfig, config.btn.cancel.callback);
@@ -4401,6 +4466,8 @@ var pops = (function () {
4401
4466
  $mask: $mask,
4402
4467
  $shadowContainer: $shadowContainer,
4403
4468
  $shadowRoot: $shadowRoot,
4469
+ config: config,
4470
+ destory: result.close,
4404
4471
  });
4405
4472
  // 拖拽
4406
4473
  if (config.drag) {
@@ -4412,7 +4479,6 @@ var pops = (function () {
4412
4479
  endCallBack: config.dragEndCallBack,
4413
4480
  });
4414
4481
  }
4415
- const result = PopsHandler.handleResultConfig(evtConfig);
4416
4482
  return result;
4417
4483
  },
4418
4484
  };
@@ -4591,6 +4657,7 @@ var pops = (function () {
4591
4657
  $elList.push($mask);
4592
4658
  }
4593
4659
  const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
4660
+ const result = PopsHandler.handleResultConfig(evtConfig);
4594
4661
  // 处理方向
4595
4662
  $pops.setAttribute("direction", config.direction);
4596
4663
  // 处理border-radius
@@ -4686,8 +4753,9 @@ var pops = (function () {
4686
4753
  $mask: $mask,
4687
4754
  $shadowContainer: $shadowContainer,
4688
4755
  $shadowRoot: $shadowRoot,
4756
+ config: config,
4757
+ destory: result.close,
4689
4758
  });
4690
- const result = PopsHandler.handleResultConfig(evtConfig);
4691
4759
  return result;
4692
4760
  },
4693
4761
  };
@@ -5196,6 +5264,7 @@ var pops = (function () {
5196
5264
  }
5197
5265
  // 事件
5198
5266
  const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
5267
+ const result = PopsHandler.handleResultConfig(evtConfig);
5199
5268
  PopsHandler.handleClickEvent("close", $btnCloseBtn, evtConfig, config.btn.close.callback);
5200
5269
  PopsHandler.handleClickEvent("ok", btnOkElement, evtConfig, config.btn.ok.callback);
5201
5270
  PopsHandler.handleClickEvent("cancel", btnCancelElement, evtConfig, config.btn.cancel.callback);
@@ -5775,8 +5844,9 @@ var pops = (function () {
5775
5844
  $mask: $mask,
5776
5845
  $shadowContainer: $shadowContainer,
5777
5846
  $shadowRoot: $shadowRoot,
5847
+ config: config,
5848
+ destory: result.close,
5778
5849
  });
5779
- const result = PopsHandler.handleResultConfig(evtConfig);
5780
5850
  return result;
5781
5851
  },
5782
5852
  };
@@ -5932,6 +6002,7 @@ var pops = (function () {
5932
6002
  const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
5933
6003
  // 赋值额外的$iframe参数
5934
6004
  evtConfig.$iframe = $iframe;
6005
+ const result = PopsHandler.handleResultConfig(evtConfig);
5935
6006
  popsDOMUtils.on($anim, popsDOMUtils.getAnimationEndNameList(), function () {
5936
6007
  // 动画加载完毕
5937
6008
  $anim.style.width = "0%";
@@ -6063,10 +6134,10 @@ var pops = (function () {
6063
6134
  capture: true,
6064
6135
  });
6065
6136
  // 关闭按钮点击事件
6066
- popsDOMUtils.on(headerCloseBtnElement, "click", (event) => {
6137
+ popsDOMUtils.on(headerCloseBtnElement, "click", async (event) => {
6067
6138
  event.preventDefault();
6068
6139
  event.stopPropagation();
6069
- PopsInstanceUtils.removeInstance([PopsInstData.iframe], guid, false);
6140
+ await PopsInstanceUtils.removeInstance([PopsInstData.iframe], guid, false);
6070
6141
  if (typeof config?.btn?.close?.callback === "function") {
6071
6142
  config.btn.close.callback(evtConfig, event);
6072
6143
  }
@@ -6080,8 +6151,9 @@ var pops = (function () {
6080
6151
  $mask: $mask,
6081
6152
  $shadowContainer: $shadowContainer,
6082
6153
  $shadowRoot: $shadowRoot,
6154
+ config: config,
6155
+ destory: result.close,
6083
6156
  });
6084
- const result = PopsHandler.handleResultConfig(evtConfig);
6085
6157
  return result;
6086
6158
  },
6087
6159
  };
@@ -7047,7 +7119,7 @@ var pops = (function () {
7047
7119
  isFixed: false,
7048
7120
  alwaysShow: false,
7049
7121
  onShowEventName: "mouseenter touchstart",
7050
- onCloseEventName: "mouseleave touchend",
7122
+ onCloseEventName: "mouseleave touchend touchcancel",
7051
7123
  zIndex: 10000,
7052
7124
  only: false,
7053
7125
  eventOption: {
@@ -7273,12 +7345,12 @@ var pops = (function () {
7273
7345
  changePosition(event) {
7274
7346
  const positionInfo = this.calcToolTipPosition(this.$data.config.$target, this.$data.config.arrowDistance, this.$data.config.otherDistance, event);
7275
7347
  const positionKey = this.$data.config.position.toUpperCase();
7276
- const positionDetail = positionInfo[positionKey];
7277
- if (positionDetail) {
7278
- this.$el.$toolTip.style.left = positionDetail.left + "px";
7279
- this.$el.$toolTip.style.top = positionDetail.top + "px";
7280
- this.$el.$toolTip.setAttribute("data-motion", positionDetail.motion);
7281
- this.$el.$arrow.setAttribute("data-position", positionDetail.arrow);
7348
+ const position = positionInfo[positionKey];
7349
+ if (position) {
7350
+ this.$el.$toolTip.style.left = position.left + "px";
7351
+ this.$el.$toolTip.style.top = position.top + "px";
7352
+ this.$el.$toolTip.setAttribute("data-motion", position.motion);
7353
+ this.$el.$arrow.setAttribute("data-position", position.arrow);
7282
7354
  }
7283
7355
  else {
7284
7356
  console.error("不存在该位置", this.$data.config.position);
@@ -7450,13 +7522,13 @@ var pops = (function () {
7450
7522
  */
7451
7523
  destory() {
7452
7524
  if (this.$el.$toolTip) {
7453
- this.$el.$shadowRoot.removeChild(this.$el.$toolTip);
7525
+ this.$el.$toolTip.remove();
7454
7526
  }
7455
- // @ts-ignore
7527
+ // @ts-expect-error
7456
7528
  this.$el.$toolTip = null;
7457
- // @ts-ignore
7529
+ // @ts-expect-error
7458
7530
  this.$el.$arrow = null;
7459
- // @ts-ignore
7531
+ // @ts-expect-error
7460
7532
  this.$el.$content = null;
7461
7533
  }
7462
7534
  /**
@@ -7504,29 +7576,29 @@ var pops = (function () {
7504
7576
  popsDOMUtils.on(this.$el.$toolTip, "mouseenter touchstart", this.toolTipMouseEnterEvent, this.$data.config.eventOption);
7505
7577
  }
7506
7578
  /**
7507
- * 取消监听鼠标|触摸事件
7579
+ * 取消监听事件 - 鼠标|触摸
7508
7580
  */
7509
7581
  offToolTipMouseEnterEvent() {
7510
7582
  popsDOMUtils.off(this.$el.$toolTip, "mouseenter touchstart", this.toolTipMouseEnterEvent, this.$data.config.eventOption);
7511
7583
  }
7512
7584
  /**
7513
- * 鼠标|触摸离开事件
7585
+ * 离开事件 - 鼠标|触摸
7514
7586
  */
7515
7587
  toolTipMouseLeaveEvent(event) {
7516
7588
  this.close(event);
7517
7589
  // this.$el.$toolTip.style.animationPlayState = "running";
7518
7590
  }
7519
7591
  /**
7520
- * 监听鼠标|触摸离开事件
7592
+ * 监听离开事件 - 鼠标|触摸
7521
7593
  */
7522
7594
  onToolTipMouseLeaveEvent() {
7523
- popsDOMUtils.on(this.$el.$toolTip, "mouseleave touchend", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
7595
+ popsDOMUtils.on(this.$el.$toolTip, "mouseleave touchend touchcancel", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
7524
7596
  }
7525
7597
  /**
7526
- * 取消监听鼠标|触摸离开事件
7598
+ * 取消监听离开事件 - 鼠标|触摸
7527
7599
  */
7528
7600
  offToolTipMouseLeaveEvent() {
7529
- popsDOMUtils.off(this.$el.$toolTip, "mouseleave touchend", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
7601
+ popsDOMUtils.off(this.$el.$toolTip, "mouseleave touchend touchcancel", this.toolTipMouseLeaveEvent, this.$data.config.eventOption);
7530
7602
  }
7531
7603
  }
7532
7604
  const PopsTooltip = {
@@ -7541,6 +7613,15 @@ var pops = (function () {
7541
7613
  throw new TypeError("config.target 必须是HTMLElement类型");
7542
7614
  }
7543
7615
  config = PopsHandler.handleOnly(popsType, config);
7616
+ if (config.position === "follow") {
7617
+ config.onShowEventName = config.onShowEventName.trim();
7618
+ const showEventNameSplit = config.onShowEventName.split(" ");
7619
+ ["mousemove", "touchmove"].forEach((it) => {
7620
+ if (showEventNameSplit.includes(it))
7621
+ return;
7622
+ config.onShowEventName += ` ${it}`;
7623
+ });
7624
+ }
7544
7625
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
7545
7626
  PopsHandler.handleInit($shadowRoot, [
7546
7627
  {
@@ -8805,7 +8886,7 @@ var pops = (function () {
8805
8886
  * 监听输入框内容改变
8806
8887
  */
8807
8888
  onValueChange() {
8808
- popsDOMUtils.on(this.$el.input, ["input", "propertychange"], void 0, (event) => {
8889
+ popsDOMUtils.on(this.$el.input, ["input", "propertychange"], (event) => {
8809
8890
  this.$data.value = this.$el.input.value;
8810
8891
  if (inputType !== "password") {
8811
8892
  // 不是密码框
@@ -9178,7 +9259,7 @@ var pops = (function () {
9178
9259
  * 监听点击事件
9179
9260
  */
9180
9261
  onClick() {
9181
- popsDOMUtils.on(this.$el.$select, "click", void 0, (event) => {
9262
+ popsDOMUtils.on(this.$el.$select, "click", (event) => {
9182
9263
  this.setSelectOptionsDisableStatus();
9183
9264
  if (typeof viewConfig.clickCallBack === "function") {
9184
9265
  const $isSelectedElement = this.$el.$select[this.$el.$select.selectedIndex];
@@ -10945,7 +11026,7 @@ var pops = (function () {
10945
11026
  * 设置按钮的点击事件
10946
11027
  */
10947
11028
  onButtonClick() {
10948
- popsDOMUtils.on(this.$ele.button, "click", void 0, (event) => {
11029
+ popsDOMUtils.on(this.$ele.button, "click", (event) => {
10949
11030
  if (typeof viewConfig.callback === "function") {
10950
11031
  viewConfig.callback(event);
10951
11032
  }
@@ -11014,13 +11095,13 @@ var pops = (function () {
11014
11095
  initContainerItem($container, formItemConfig) {
11015
11096
  const containerViewConfig = formItemConfig;
11016
11097
  if (containerViewConfig.type === "container") {
11017
- const childForms = containerViewConfig["views"];
11098
+ const childViewConfig = containerViewConfig["views"];
11018
11099
  // 每一项<li>元素
11019
- const formContainerListElement = popsDOMUtils.createElement("li");
11100
+ const $itemLi = popsDOMUtils.createElement("li");
11020
11101
  // 每一项<li>内的子<ul>元素
11021
- const formContainerULElement = popsDOMUtils.createElement("ul");
11022
- formContainerULElement.classList.add("pops-panel-forms-container-item-formlist");
11023
- formContainerListElement.classList.add("pops-panel-forms-container-item");
11102
+ const $itemUL = popsDOMUtils.createElement("ul");
11103
+ $itemUL.classList.add("pops-panel-forms-container-item-formlist");
11104
+ $itemLi.classList.add("pops-panel-forms-container-item");
11024
11105
  // 区域头部的文字
11025
11106
  const formHeaderDivElement = popsDOMUtils.createElement("div", {
11026
11107
  className: "pops-panel-forms-container-item-header-text",
@@ -11040,42 +11121,42 @@ var pops = (function () {
11040
11121
  `);
11041
11122
  // 添加点击事件
11042
11123
  popsDOMUtils.on(formHeaderDivElement, "click", () => {
11043
- if (formContainerListElement.hasAttribute("data-fold-enable")) {
11044
- formContainerListElement.removeAttribute("data-fold-enable");
11124
+ if ($itemLi.hasAttribute("data-fold-enable")) {
11125
+ $itemLi.removeAttribute("data-fold-enable");
11045
11126
  }
11046
11127
  else {
11047
- formContainerListElement.setAttribute("data-fold-enable", "");
11128
+ $itemLi.setAttribute("data-fold-enable", "");
11048
11129
  }
11049
11130
  });
11050
11131
  popsDOMUtils.addClassName(formHeaderDivElement, "pops-panel-forms-fold-container");
11051
11132
  popsDOMUtils.addClassName(formHeaderDivElement, PopsCommonCSSClassName.userSelectNone);
11052
- formContainerListElement.setAttribute("data-fold-enable", "");
11133
+ $itemLi.setAttribute("data-fold-enable", "");
11053
11134
  popsDOMUtils.addClassName(formHeaderDivElement, "pops-panel-forms-fold");
11054
- formContainerListElement.appendChild(formHeaderDivElement);
11135
+ $itemLi.appendChild(formHeaderDivElement);
11055
11136
  }
11056
11137
  else {
11057
11138
  // 加进容器内
11058
- formContainerListElement.appendChild(formHeaderDivElement);
11139
+ $itemLi.appendChild(formHeaderDivElement);
11059
11140
  }
11060
- that.setElementClassName(formContainerListElement, formItemConfig.className);
11061
- that.setElementAttributes(formContainerListElement, formItemConfig.attributes);
11062
- that.setElementProps(formContainerListElement, formItemConfig.props);
11063
- childForms.forEach((childViewConfig) => {
11141
+ that.setElementClassName($itemLi, formItemConfig.className);
11142
+ that.setElementAttributes($itemLi, formItemConfig.attributes);
11143
+ that.setElementProps($itemLi, formItemConfig.props);
11144
+ $itemLi.appendChild($itemUL);
11145
+ $container.appendChild($itemLi);
11146
+ childViewConfig.forEach((childViewConfig) => {
11064
11147
  that.uListContainerAddItem(childViewConfig, {
11065
- ulElement: formContainerULElement,
11148
+ ulElement: $itemUL,
11066
11149
  sectionContainerULElement: that.sectionContainerULElement,
11067
- formContainerListElement: formContainerListElement,
11150
+ formContainerListElement: $itemLi,
11068
11151
  formHeaderDivElement: formHeaderDivElement,
11069
11152
  });
11070
11153
  });
11071
- formContainerListElement.appendChild(formContainerULElement);
11072
- $container.appendChild(formContainerListElement);
11073
11154
  if (typeof containerViewConfig.afterAddToUListCallBack === "function") {
11074
11155
  containerViewConfig.afterAddToUListCallBack(viewConfig, {
11075
- target: formContainerListElement,
11076
- ulElement: formContainerULElement,
11156
+ target: $itemLi,
11157
+ ulElement: $itemUL,
11077
11158
  sectionContainerULElement: that.sectionContainerULElement,
11078
- formContainerListElement: formContainerListElement,
11159
+ formContainerListElement: $itemLi,
11079
11160
  formHeaderDivElement: formHeaderDivElement,
11080
11161
  });
11081
11162
  }
@@ -11214,7 +11295,7 @@ var pops = (function () {
11214
11295
  },
11215
11296
  /** 设置项的点击事件 */
11216
11297
  onLiClick() {
11217
- popsDOMUtils.on($li, "click", void 0, async (event) => {
11298
+ popsDOMUtils.on($li, "click", async (event) => {
11218
11299
  if (typeof viewConfig.clickCallBack === "function") {
11219
11300
  const result = await viewConfig.clickCallBack(event, viewConfig);
11220
11301
  if (result) {
@@ -11542,6 +11623,7 @@ var pops = (function () {
11542
11623
  }
11543
11624
  // 处理返回的配置
11544
11625
  const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
11626
+ const result = PopsHandler.handleResultConfig(evtConfig);
11545
11627
  // 为顶部右边的关闭按钮添加点击事件
11546
11628
  PopsHandler.handleClickEvent("close", $headerBtnClose, evtConfig, config.btn?.close?.callback);
11547
11629
  // 创建到页面中
@@ -11579,6 +11661,8 @@ var pops = (function () {
11579
11661
  $mask: $mask,
11580
11662
  $shadowContainer: $shadowContainer,
11581
11663
  $shadowRoot: $shadowRoot,
11664
+ config: config,
11665
+ destory: result.close,
11582
11666
  });
11583
11667
  // 拖拽
11584
11668
  if (config.drag) {
@@ -11590,7 +11674,6 @@ var pops = (function () {
11590
11674
  endCallBack: config.dragEndCallBack,
11591
11675
  });
11592
11676
  }
11593
- const result = PopsHandler.handleResultConfig(evtConfig);
11594
11677
  return {
11595
11678
  ...result,
11596
11679
  addEventListener: (event, listener, options) => {
@@ -11782,6 +11865,7 @@ var pops = (function () {
11782
11865
  $elList.push($mask);
11783
11866
  }
11784
11867
  const evtConfig = PopsHandler.handleEventConfig(config, guid, $shadowContainer, $shadowRoot, popsType, $anim, $pops, $mask);
11868
+ const result = PopsHandler.handleResultConfig(evtConfig);
11785
11869
  // 输入框赋值初始值
11786
11870
  $input.value = config.content.text;
11787
11871
  PopsHandler.handlePromptClickEvent("close", $input, $btnClose, evtConfig, config.btn.close.callback);
@@ -11804,6 +11888,8 @@ var pops = (function () {
11804
11888
  $mask: $mask,
11805
11889
  $shadowContainer: $shadowContainer,
11806
11890
  $shadowRoot: $shadowRoot,
11891
+ config: config,
11892
+ destory: result.close,
11807
11893
  });
11808
11894
  // 拖拽
11809
11895
  if (config.drag) {
@@ -11823,7 +11909,6 @@ var pops = (function () {
11823
11909
  if (config.content.select) {
11824
11910
  $input.select();
11825
11911
  }
11826
- const result = PopsHandler.handleResultConfig(evtConfig);
11827
11912
  return result;
11828
11913
  },
11829
11914
  };
@@ -11925,6 +12010,7 @@ var pops = (function () {
11925
12010
  beforeAppendToPageCallBack() { },
11926
12011
  limitPositionXInView: true,
11927
12012
  limitPositionYInView: true,
12013
+ beforeShowCallBack() { },
11928
12014
  };
11929
12015
  };
11930
12016
 
@@ -11984,6 +12070,8 @@ var pops = (function () {
11984
12070
  return;
11985
12071
  }
11986
12072
  if ($click.className && $click.className === "pops-shadow-container" && $click.shadowRoot != null) {
12073
+ // pops的shadow-container
12074
+ PopsContextMenu.shadowRootCheckClickEvent(event);
11987
12075
  return;
11988
12076
  }
11989
12077
  PopsContextMenu.closeAllMenu(PopsContextMenu.$el.$root);
@@ -11996,7 +12084,7 @@ var pops = (function () {
11996
12084
  if (!PopsContextMenu.$el.$root) {
11997
12085
  return;
11998
12086
  }
11999
- const $click = event.target;
12087
+ const $click = event.composedPath()[0];
12000
12088
  if ($click.closest(`.pops-${popsType}`)) {
12001
12089
  return;
12002
12090
  }
@@ -12006,13 +12094,13 @@ var pops = (function () {
12006
12094
  * 添加全局点击检测事件
12007
12095
  */
12008
12096
  addWindowCheckClickListener() {
12009
- popsDOMUtils.on(globalThis, "click touchstart", void 0, PopsContextMenu.windowCheckClickEvent, {
12097
+ popsDOMUtils.on(globalThis, "click touchstart", PopsContextMenu.windowCheckClickEvent, {
12010
12098
  capture: true,
12011
12099
  });
12012
12100
  if (config.$target instanceof Node) {
12013
12101
  const $shadowRoot = config.$target.getRootNode();
12014
12102
  if ($shadowRoot instanceof ShadowRoot) {
12015
- popsDOMUtils.on($shadowRoot, "click touchstart", void 0, PopsContextMenu.shadowRootCheckClickEvent, {
12103
+ popsDOMUtils.on($shadowRoot, "click touchstart", PopsContextMenu.shadowRootCheckClickEvent, {
12016
12104
  capture: true,
12017
12105
  });
12018
12106
  }
@@ -12022,13 +12110,13 @@ var pops = (function () {
12022
12110
  * 移除全局点击检测事件
12023
12111
  */
12024
12112
  removeWindowCheckClickListener() {
12025
- popsDOMUtils.off(globalThis, "click touchstart", void 0, PopsContextMenu.windowCheckClickEvent, {
12113
+ popsDOMUtils.off(globalThis, "click touchstart", PopsContextMenu.windowCheckClickEvent, {
12026
12114
  capture: true,
12027
12115
  });
12028
12116
  if (config.$target instanceof Node) {
12029
12117
  const $shadowRoot = config.$target.getRootNode();
12030
12118
  if ($shadowRoot instanceof ShadowRoot) {
12031
- popsDOMUtils.off($shadowRoot, "click touchstart", void 0, PopsContextMenu.windowCheckClickEvent, {
12119
+ popsDOMUtils.off($shadowRoot, "click touchstart", PopsContextMenu.windowCheckClickEvent, {
12032
12120
  capture: true,
12033
12121
  });
12034
12122
  }
@@ -12039,7 +12127,7 @@ var pops = (function () {
12039
12127
  * @param event
12040
12128
  * @param selectorTarget
12041
12129
  */
12042
- contextMenuEvent(event, selectorTarget) {
12130
+ async contextMenuEvent(event, selectorTarget) {
12043
12131
  if (config.preventDefault) {
12044
12132
  popsDOMUtils.preventEvent(event);
12045
12133
  }
@@ -12048,6 +12136,10 @@ var pops = (function () {
12048
12136
  PopsContextMenu.closeAllMenu(PopsContextMenu.$el.$root);
12049
12137
  }
12050
12138
  selectorTarget = selectorTarget ?? config.$target;
12139
+ const beforeShowCallBackResult = await config?.beforeShowCallBack(event);
12140
+ if (typeof beforeShowCallBackResult === "boolean" && !beforeShowCallBackResult) {
12141
+ return;
12142
+ }
12051
12143
  const rootElement = PopsContextMenu.showMenu(event, config.data, selectorTarget);
12052
12144
  PopsContextMenu.$el.$root = rootElement;
12053
12145
  if (config.only) {
@@ -12060,6 +12152,10 @@ var pops = (function () {
12060
12152
  beforeRemoveCallBack(instCommonConfig) {
12061
12153
  PopsContextMenu.closeAllMenu(instCommonConfig.$pops);
12062
12154
  },
12155
+ config: config,
12156
+ destory: () => {
12157
+ PopsContextMenu.closeAllMenu(rootElement);
12158
+ },
12063
12159
  });
12064
12160
  }
12065
12161
  },
@@ -12363,7 +12459,8 @@ var pops = (function () {
12363
12459
  menuLiElement.appendChild(iconElement);
12364
12460
  }
12365
12461
  // 插入文字
12366
- menuLiElement.insertAdjacentHTML("beforeend", PopsSafeUtils.getSafeHTML(`<span>${item.text}</span>`));
12462
+ const text = typeof item.text === "function" ? item.text() : item.text;
12463
+ menuLiElement.insertAdjacentHTML("beforeend", PopsSafeUtils.getSafeHTML(`<span>${text}</span>`));
12367
12464
  // 如果存在子数据,显示
12368
12465
  if (item.item && Array.isArray(item.item)) {
12369
12466
  popsDOMUtils.addClassName(menuLiElement, `pops-${popsType}-item`);
@@ -13002,10 +13099,10 @@ var pops = (function () {
13002
13099
  setShowEvent(option = defaultListenerOption) {
13003
13100
  /* 焦点|点击事件*/
13004
13101
  if (config.followPosition === "target") {
13005
- popsDOMUtils.on([config.$target], ["focus", "click"], void 0, SearchSuggestion.showEvent, option);
13102
+ popsDOMUtils.on([config.$target], ["focus", "click"], SearchSuggestion.showEvent, option);
13006
13103
  }
13007
13104
  else if (config.followPosition === "input") {
13008
- popsDOMUtils.on([config.$inputTarget], ["focus", "click"], void 0, SearchSuggestion.showEvent, option);
13105
+ popsDOMUtils.on([config.$inputTarget], ["focus", "click"], SearchSuggestion.showEvent, option);
13009
13106
  }
13010
13107
  else if (config.followPosition === "inputCursor") {
13011
13108
  popsDOMUtils.on([config.$inputTarget], ["focus", "click", "input"], SearchSuggestion.showEvent, option);
@@ -13019,9 +13116,9 @@ var pops = (function () {
13019
13116
  */
13020
13117
  removeShowEvent(option = defaultListenerOption) {
13021
13118
  /* 焦点|点击事件*/
13022
- popsDOMUtils.off([config.$target, config.$inputTarget], ["focus", "click"], void 0, SearchSuggestion.showEvent, option);
13119
+ popsDOMUtils.off([config.$target, config.$inputTarget], ["focus", "click"], SearchSuggestion.showEvent, option);
13023
13120
  // 内容改变事件
13024
- popsDOMUtils.off([config.$inputTarget], ["input"], void 0, SearchSuggestion.showEvent, option);
13121
+ popsDOMUtils.off([config.$inputTarget], ["input"], SearchSuggestion.showEvent, option);
13025
13122
  },
13026
13123
  /**
13027
13124
  * 隐藏搜索建议框的事件
@@ -13052,7 +13149,7 @@ var pops = (function () {
13052
13149
  // 全局触摸屏点击事件
13053
13150
  if (Array.isArray(SearchSuggestion.selfDocument)) {
13054
13151
  SearchSuggestion.selfDocument.forEach(($checkParent) => {
13055
- popsDOMUtils.on($checkParent, ["click", "touchstart"], void 0, SearchSuggestion.hideEvent, option);
13152
+ popsDOMUtils.on($checkParent, ["click", "touchstart"], SearchSuggestion.hideEvent, option);
13056
13153
  });
13057
13154
  }
13058
13155
  else {
@@ -13065,11 +13162,11 @@ var pops = (function () {
13065
13162
  removeHideEvent(option = defaultListenerOption) {
13066
13163
  if (Array.isArray(SearchSuggestion.selfDocument)) {
13067
13164
  SearchSuggestion.selfDocument.forEach(($checkParent) => {
13068
- popsDOMUtils.off($checkParent, ["click", "touchstart"], void 0, SearchSuggestion.hideEvent, option);
13165
+ popsDOMUtils.off($checkParent, ["click", "touchstart"], SearchSuggestion.hideEvent, option);
13069
13166
  });
13070
13167
  }
13071
13168
  else {
13072
- popsDOMUtils.off(SearchSuggestion.selfDocument, ["click", "touchstart"], void 0, SearchSuggestion.hideEvent, option);
13169
+ popsDOMUtils.off(SearchSuggestion.selfDocument, ["click", "touchstart"], SearchSuggestion.hideEvent, option);
13073
13170
  }
13074
13171
  },
13075
13172
  /**
@@ -13330,7 +13427,7 @@ var pops = (function () {
13330
13427
  },
13331
13428
  };
13332
13429
 
13333
- const version = "3.1.3";
13430
+ const version = "3.2.0";
13334
13431
 
13335
13432
  class Pops {
13336
13433
  /** 配置 */