@whitesev/pops 1.5.5 → 1.5.8

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.
@@ -3016,17 +3016,27 @@ System.register('pops', [], (function (exports) {
3016
3016
  * @param isAll 是否全部删除
3017
3017
  */
3018
3018
  removeInstance(moreLayerConfigList, guid, isAll = false) {
3019
- function removeItem(item) {
3020
- item?.animElement?.remove();
3021
- item?.popsElement?.remove();
3022
- item?.maskElement?.remove();
3023
- item?.$shadowContainer?.remove();
3019
+ /**
3020
+ * 移除元素实例
3021
+ * @param layerCommonConfig
3022
+ */
3023
+ function removeItem(layerCommonConfig) {
3024
+ if (typeof layerCommonConfig.beforeRemoveCallBack === "function") {
3025
+ // 调用移除签的回调
3026
+ layerCommonConfig.beforeRemoveCallBack(layerCommonConfig);
3027
+ }
3028
+ layerCommonConfig?.animElement?.remove();
3029
+ layerCommonConfig?.popsElement?.remove();
3030
+ layerCommonConfig?.maskElement?.remove();
3031
+ layerCommonConfig?.$shadowContainer?.remove();
3024
3032
  }
3025
3033
  // [ layer[], layer[],...]
3026
3034
  moreLayerConfigList.forEach((layerConfigList) => {
3027
3035
  // layer[]
3028
3036
  layerConfigList.forEach((layerConfigItem, index) => {
3037
+ // 移除全部或者guid相同
3029
3038
  if (isAll || layerConfigItem["guid"] === guid) {
3039
+ // 判断是否有动画
3030
3040
  if (pops.config.animation.hasOwnProperty(layerConfigItem.animElement.getAttribute("anim"))) {
3031
3041
  layerConfigItem.animElement.style.width = "100%";
3032
3042
  layerConfigItem.animElement.style.height = "100%";
@@ -4239,7 +4249,10 @@ System.register('pops', [], (function (exports) {
4239
4249
  if (type === "loading" ||
4240
4250
  type === "tooltip" ||
4241
4251
  type === "rightClickMenu") {
4242
- PopsInstanceUtils.removeInstance([pops.config.layer[type]], "", true);
4252
+ let layer = pops.config.layer[type];
4253
+ if (layer) {
4254
+ PopsInstanceUtils.removeInstance([layer], "", true);
4255
+ }
4243
4256
  }
4244
4257
  else {
4245
4258
  PopsInstanceUtils.removeInstance([
@@ -4644,6 +4657,7 @@ System.register('pops', [], (function (exports) {
4644
4657
  },
4645
4658
  content: {
4646
4659
  text: "",
4660
+ select: false,
4647
4661
  password: false,
4648
4662
  row: false,
4649
4663
  focus: true,
@@ -4819,7 +4833,11 @@ System.register('pops', [], (function (exports) {
4819
4833
  }
4820
4834
  /* 设置自动获取焦点 */
4821
4835
  if (config.content.focus) {
4822
- $input?.focus();
4836
+ $input.focus();
4837
+ }
4838
+ /* 设置自动选中所有文字 */
4839
+ if (config.content.select) {
4840
+ $input.select();
4823
4841
  }
4824
4842
  return PopsHandler.handleResultDetails(eventDetails);
4825
4843
  }
@@ -6379,7 +6397,9 @@ System.register('pops', [], (function (exports) {
6379
6397
  let linkElement = targetElement.querySelector("a");
6380
6398
  if (typeof _config_.clickEvent === "function") {
6381
6399
  let downloadInfo = await _config_.clickEvent(event, _config_);
6382
- if (typeof downloadInfo === "object" &&
6400
+ if (downloadInfo != null &&
6401
+ typeof downloadInfo === "object" &&
6402
+ !Array.isArray(downloadInfo) &&
6383
6403
  typeof downloadInfo.url === "string" &&
6384
6404
  downloadInfo.url.trim() !== "") {
6385
6405
  linkElement.setAttribute("href", downloadInfo.url);
@@ -6439,7 +6459,6 @@ System.register('pops', [], (function (exports) {
6439
6459
  * @param isDesc 是否降序,默认false(升序)
6440
6460
  */
6441
6461
  function sortFolderConfig(folderDataConfigList, sortName = "fileName", isDesc = false) {
6442
- console.log(folderDataConfigList, sortName, isDesc);
6443
6462
  if (sortName === "fileName") {
6444
6463
  // 如果是以文件名排序,文件夹优先放前面
6445
6464
  let onlyFolderDataConfigList = folderDataConfigList.filter((value) => {
@@ -9108,10 +9127,24 @@ System.register('pops', [], (function (exports) {
9108
9127
  if (config.preventDefault) {
9109
9128
  popsDOMUtils.preventEvent(event);
9110
9129
  }
9130
+ PopsHandler.handleOnly(PopsType, config);
9111
9131
  if (PopsContextMenu.rootElement) {
9112
9132
  PopsContextMenu.closeAllMenu(PopsContextMenu.rootElement);
9113
9133
  }
9114
- PopsContextMenu.rootElement = PopsContextMenu.showMenu(event, config.data);
9134
+ let rootElement = PopsContextMenu.showMenu(event, config.data);
9135
+ PopsContextMenu.rootElement = rootElement;
9136
+ if (config.only) {
9137
+ PopsHandler.handlePush(PopsType, {
9138
+ $shadowRoot: $shadowRoot,
9139
+ $shadowContainer: $shadowContainer,
9140
+ guid: guid,
9141
+ animElement: rootElement,
9142
+ popsElement: rootElement,
9143
+ beforeRemoveCallBack(layerCommonConfig) {
9144
+ PopsContextMenu.closeAllMenu(layerCommonConfig.popsElement);
9145
+ },
9146
+ });
9147
+ }
9115
9148
  },
9116
9149
  /**
9117
9150
  * 添加contextmenu事件
@@ -9160,6 +9193,9 @@ System.register('pops', [], (function (exports) {
9160
9193
  * @param rootElement
9161
9194
  */
9162
9195
  closeAllMenu(rootElement) {
9196
+ if (rootElement == null) {
9197
+ return;
9198
+ }
9163
9199
  if (rootElement?.["__menuData__"]?.root) {
9164
9200
  rootElement = rootElement?.["__menuData__"]?.root;
9165
9201
  }
@@ -9462,7 +9498,9 @@ System.register('pops', [], (function (exports) {
9462
9498
  });
9463
9499
  },
9464
9500
  };
9501
+ // 添加右键菜单事件
9465
9502
  PopsContextMenu.addContextMenuEvent(config.target, config.targetSelector);
9503
+ // 添加全局点击检测
9466
9504
  PopsContextMenu.addWindowCheckClickListener();
9467
9505
  return {
9468
9506
  guid: guid,
@@ -10046,7 +10084,7 @@ System.register('pops', [], (function (exports) {
10046
10084
  /** 配置 */
10047
10085
  config = {
10048
10086
  /** 版本号 */
10049
- version: "2024.9.11",
10087
+ version: "2024.9.16",
10050
10088
  cssText: {
10051
10089
  /** 主CSS */
10052
10090
  index: indexCSS,
@@ -10125,6 +10163,7 @@ System.register('pops', [], (function (exports) {
10125
10163
  drawer: [],
10126
10164
  folder: [],
10127
10165
  panel: [],
10166
+ rightClickMenu: [],
10128
10167
  },
10129
10168
  /** 禁止滚动 */
10130
10169
  forbiddenScroll: {