@whitesev/pops 1.5.2 → 1.5.4

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 (38) hide show
  1. package/dist/index.amd.js +178 -83
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.cjs.js +178 -83
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.esm.js +178 -83
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.iife.js +178 -83
  8. package/dist/index.iife.js.map +1 -1
  9. package/dist/index.system.js +178 -83
  10. package/dist/index.system.js.map +1 -1
  11. package/dist/index.umd.js +178 -83
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/types/src/components/rightClickMenu/indexType.d.ts +1 -1
  14. package/dist/types/src/components/searchSuggestion/indexType.d.ts +1 -1
  15. package/dist/types/src/components/tooltip/indexType.d.ts +1 -1
  16. package/dist/types/src/handler/PopsElementHandler.d.ts +2 -1
  17. package/dist/types/src/handler/PopsHandler.d.ts +5 -0
  18. package/dist/types/src/types/components.d.ts +1 -1
  19. package/package.json +3 -2
  20. package/src/Pops.ts +1 -1
  21. package/src/components/alert/index.ts +6 -3
  22. package/src/components/confirm/index.ts +6 -3
  23. package/src/components/drawer/index.ts +6 -3
  24. package/src/components/folder/index.ts +79 -40
  25. package/src/components/iframe/index.ts +12 -8
  26. package/src/components/loading/index.ts +8 -3
  27. package/src/components/panel/index.ts +8 -3
  28. package/src/components/prompt/index.ts +7 -4
  29. package/src/components/rightClickMenu/index.ts +15 -3
  30. package/src/components/rightClickMenu/indexType.ts +1 -1
  31. package/src/components/searchSuggestion/index.ts +1 -1
  32. package/src/components/searchSuggestion/indexType.ts +1 -1
  33. package/src/components/tooltip/index.ts +3 -1
  34. package/src/components/tooltip/indexType.ts +1 -1
  35. package/src/handler/PopsElementHandler.ts +24 -18
  36. package/src/handler/PopsHandler.ts +27 -4
  37. package/src/types/components.d.ts +1 -1
  38. package/src/utils/PopsUtils.ts +8 -4
@@ -1525,17 +1525,21 @@ var pops = (function () {
1525
1525
  else {
1526
1526
  for (const targetKeyName in target) {
1527
1527
  if (targetKeyName in source) {
1528
+ // @ts-ignore
1528
1529
  let targetValue = target[targetKeyName];
1530
+ // @ts-ignore
1529
1531
  let sourceValue = source[targetKeyName];
1530
1532
  if (typeof sourceValue === "object" &&
1531
1533
  sourceValue != null &&
1532
1534
  !UtilsContext.isDOM(sourceValue) &&
1533
1535
  Object.keys(sourceValue).length) {
1534
1536
  /* 源端的值是object类型,且不是元素节点 */
1537
+ // @ts-ignore
1535
1538
  target[targetKeyName] = UtilsContext.assign(targetValue, sourceValue, isAdd);
1536
1539
  continue;
1537
1540
  }
1538
1541
  /* 直接赋值 */
1542
+ // @ts-ignore
1539
1543
  target[targetKeyName] = sourceValue;
1540
1544
  }
1541
1545
  }
@@ -3553,6 +3557,9 @@ var pops = (function () {
3553
3557
  */
3554
3558
  getMaskHTML(guid, zIndex = 101, style = "") {
3555
3559
  zIndex = zIndex - 100;
3560
+ if (style.startsWith(";")) {
3561
+ style = style.replace(";", "");
3562
+ }
3556
3563
  return `<div class="pops-mask" data-guid="${guid}" style="z-index:${zIndex};${style}"></div>`;
3557
3564
  },
3558
3565
  /**
@@ -3562,15 +3569,16 @@ var pops = (function () {
3562
3569
  * @param config
3563
3570
  * @param html
3564
3571
  * @param bottomBtnHTML
3572
+ * @param zIndex
3565
3573
  */
3566
- getAnimHTML(guid, type, config, html = "", bottomBtnHTML = "") {
3574
+ getAnimHTML(guid, type, config, html = "", bottomBtnHTML = "", zIndex) {
3567
3575
  let __config = config;
3568
3576
  let popsAnimStyle = "";
3569
3577
  let popsStyle = "";
3570
3578
  let popsPosition = __config.position || "";
3571
3579
  if (config.zIndex != null) {
3572
- popsAnimStyle += `z-index: ${config.zIndex};`;
3573
- popsStyle += `z-index: ${config.zIndex};`;
3580
+ popsAnimStyle += `z-index: ${zIndex};`;
3581
+ popsStyle += `z-index: ${zIndex};`;
3574
3582
  }
3575
3583
  if (__config.width != null) {
3576
3584
  popsStyle += `width: ${__config.width};`;
@@ -3579,24 +3587,25 @@ var pops = (function () {
3579
3587
  popsStyle += `height: ${__config.height};`;
3580
3588
  }
3581
3589
  let hasBottomBtn = bottomBtnHTML.trim() === "" ? false : true;
3582
- return `<div
3583
- class="pops-anim"
3584
- anim="${__config.animation || ""}"
3585
- style="${popsAnimStyle};"
3586
- data-guid="${guid}">
3590
+ return /*html*/ `
3591
+ <div
3592
+ class="pops-anim"
3593
+ anim="${__config.animation || ""}"
3594
+ style="${popsAnimStyle};"
3595
+ data-guid="${guid}">
3587
3596
  ${config.style != null
3588
3597
  ? `<style tyle="text/css">${config.style}</style>`
3589
3598
  : ""}
3590
- <div
3591
- class="pops ${config.class || ""}"
3592
- data-bottom-btn="${hasBottomBtn}"
3593
- type-value="${type}"
3594
- style="${popsStyle}"
3595
- position="${popsPosition}"
3596
- data-guid="${guid}">
3597
- ${html}
3598
- </div>
3599
- </div>`;
3599
+ <div
3600
+ class="pops ${config.class || ""}"
3601
+ data-bottom-btn="${hasBottomBtn}"
3602
+ type-value="${type}"
3603
+ style="${popsStyle}"
3604
+ position="${popsPosition}"
3605
+ data-guid="${guid}">
3606
+ ${html}
3607
+ </div>
3608
+ </div>`;
3600
3609
  },
3601
3610
  /**
3602
3611
  * 获取顶部按钮层HTML
@@ -4206,6 +4215,18 @@ var pops = (function () {
4206
4215
  capture: true,
4207
4216
  });
4208
4217
  },
4218
+ /**
4219
+ * 把配置的z-index配置转为数字
4220
+ * @param zIndex
4221
+ */
4222
+ handleZIndex(zIndex) {
4223
+ if (typeof zIndex === "function") {
4224
+ return zIndex();
4225
+ }
4226
+ else {
4227
+ return zIndex;
4228
+ }
4229
+ },
4209
4230
  /**
4210
4231
  * 处理config.only
4211
4232
  * @param type 当前弹窗类型
@@ -4231,8 +4252,19 @@ var pops = (function () {
4231
4252
  }
4232
4253
  }
4233
4254
  else {
4234
- const { zIndex: maxZIndex } = PopsInstanceUtils.getPopsMaxZIndex(config.zIndex + 100);
4235
- config.zIndex = maxZIndex;
4255
+ // 对配置进行处理
4256
+ // 选择配置的z-index和已有的pops实例的最大z-index值
4257
+ if (typeof config.zIndex === "function") {
4258
+ let originZIndexFn = config.zIndex;
4259
+ config.zIndex = () => {
4260
+ const { zIndex: maxZIndex } = PopsInstanceUtils.getPopsMaxZIndex(PopsHandler.handleZIndex(originZIndexFn) + 100);
4261
+ return maxZIndex;
4262
+ };
4263
+ }
4264
+ else {
4265
+ const { zIndex: maxZIndex } = PopsInstanceUtils.getPopsMaxZIndex(PopsHandler.handleZIndex(config.zIndex) + 100);
4266
+ config.zIndex = maxZIndex;
4267
+ }
4236
4268
  }
4237
4269
  return config;
4238
4270
  },
@@ -4320,12 +4352,15 @@ var pops = (function () {
4320
4352
  // 设置当前类型
4321
4353
  const PopsType = "alert";
4322
4354
  config = PopsHandler.handleOnly(PopsType, config);
4323
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
4355
+ // 先把z-index提取出来
4356
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
4357
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
4324
4358
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
4325
4359
  let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
4326
4360
  let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(PopsType, config);
4327
4361
  let { contentStyle, contentPStyle } = PopsElementHandler.getContentStyle(PopsType, config);
4328
- let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config, `
4362
+ let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config,
4363
+ /*html*/ `
4329
4364
  <div
4330
4365
  class="pops-alert-title"
4331
4366
  style="text-align: ${config.title.position};
@@ -4340,7 +4375,7 @@ var pops = (function () {
4340
4375
  ? config.content.text
4341
4376
  : `<p pops style="${contentPStyle}">${config.content.text}</p>`}
4342
4377
  </div>
4343
- ${bottomBtnHTML}`, bottomBtnHTML);
4378
+ ${bottomBtnHTML}`, bottomBtnHTML, zIndex);
4344
4379
  /**
4345
4380
  * 弹窗的主元素,包括动画层
4346
4381
  */
@@ -4502,12 +4537,15 @@ var pops = (function () {
4502
4537
  // 设置当前类型
4503
4538
  const PopsType = "confirm";
4504
4539
  config = PopsHandler.handleOnly(PopsType, config);
4505
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
4540
+ // 先把z-index提取出来
4541
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
4542
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
4506
4543
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
4507
4544
  let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
4508
4545
  let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(PopsType, config);
4509
4546
  let { contentStyle, contentPStyle } = PopsElementHandler.getContentStyle(PopsType, config);
4510
- let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config, `
4547
+ let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config,
4548
+ /*html*/ `
4511
4549
  <div class="pops-confirm-title" style="text-align: ${config.title.position};${headerStyle}">
4512
4550
  ${config.title.html
4513
4551
  ? config.title.text
@@ -4521,7 +4559,7 @@ var pops = (function () {
4521
4559
 
4522
4560
  </div>
4523
4561
  ${bottomBtnHTML}
4524
- `, bottomBtnHTML);
4562
+ `, bottomBtnHTML, zIndex);
4525
4563
  /**
4526
4564
  * 弹窗的主元素,包括动画层
4527
4565
  */
@@ -4690,12 +4728,15 @@ var pops = (function () {
4690
4728
  let guid = popsUtils.getRandomGUID();
4691
4729
  const PopsType = "prompt";
4692
4730
  config = PopsHandler.handleOnly(PopsType, config);
4693
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
4731
+ // 先把z-index提取出来
4732
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
4733
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
4694
4734
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
4695
4735
  let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
4696
4736
  let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(PopsType, config);
4697
4737
  let { contentPStyle } = PopsElementHandler.getContentStyle(PopsType, config);
4698
- let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config, `
4738
+ let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config,
4739
+ /*html*/ `
4699
4740
  <div class="pops-prompt-title" style="text-align: ${config.title.position};${headerStyle}">
4700
4741
  ${config.title.html
4701
4742
  ? config.title.text
@@ -4713,8 +4754,8 @@ var pops = (function () {
4713
4754
  (config.content.password ? "password" : "text") +
4714
4755
  '">'}
4715
4756
  </div>
4716
- ${bottomBtnHTML}
4717
- `, bottomBtnHTML);
4757
+ ${bottomBtnHTML}
4758
+ `, bottomBtnHTML, zIndex);
4718
4759
  /**
4719
4760
  * 弹窗的主元素,包括动画层
4720
4761
  */
@@ -4811,9 +4852,12 @@ var pops = (function () {
4811
4852
  let guid = popsUtils.getRandomGUID();
4812
4853
  const PopsType = "loading";
4813
4854
  config = PopsHandler.handleOnly(PopsType, config);
4814
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
4855
+ // 先把z-index提取出来
4856
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
4857
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
4815
4858
  let { contentPStyle } = PopsElementHandler.getContentStyle("loading", config);
4816
- let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config, `
4859
+ let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config,
4860
+ /*html*/ `
4817
4861
  <div class="pops-loading-content">
4818
4862
  ${config.addIndexCSS
4819
4863
  ? `
@@ -4828,7 +4872,7 @@ var pops = (function () {
4828
4872
  ${config.style != null ? `<style>${config.style}</style>` : ""}
4829
4873
  <p pops style="${contentPStyle}">${config.content.text}</p>
4830
4874
  </div>
4831
- `, "");
4875
+ `, "", zIndex);
4832
4876
  /**
4833
4877
  * 弹窗的主元素,包括动画层
4834
4878
  */
@@ -4944,12 +4988,15 @@ var pops = (function () {
4944
4988
  let maskExtraStyle = config.animation != null && config.animation != ""
4945
4989
  ? "position:absolute;"
4946
4990
  : "";
4947
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex, maskExtraStyle);
4991
+ // 先把z-index提取出来
4992
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
4993
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex, maskExtraStyle);
4948
4994
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
4949
4995
  let iframeLoadingHTML = '<div class="pops-loading"></div>';
4950
4996
  let titleText = config.title.text.trim() !== "" ? config.title.text : config.url;
4951
4997
  let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(PopsType, config);
4952
- let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config, `
4998
+ let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config,
4999
+ /*html*/ `
4953
5000
  <div
4954
5001
  class="pops-iframe-title"
4955
5002
  style="text-align: ${config.title.position};${headerStyle}"
@@ -4970,7 +5017,7 @@ var pops = (function () {
4970
5017
  </iframe>
4971
5018
  </div>
4972
5019
  ${config.loading.enable ? iframeLoadingHTML : ""}
4973
- `, "");
5020
+ `, "", zIndex);
4974
5021
  /**
4975
5022
  * 弹窗的主元素,包括动画层
4976
5023
  */
@@ -5202,7 +5249,7 @@ var pops = (function () {
5202
5249
  popsDOMUtils.addClassName(_toolTipElement_, config.className);
5203
5250
  }
5204
5251
  _toolTipElement_.setAttribute("data-guid", guid);
5205
- _toolTipElement_.style.zIndex = config.zIndex.toString();
5252
+ _toolTipElement_.style.zIndex = PopsHandler.handleZIndex(config.zIndex).toString();
5206
5253
  _toolTipElement_.innerHTML = `<div style="text-align: center;">${getContent()}</div>`;
5207
5254
  /* 箭头元素 */
5208
5255
  let _toolTipArrowHTML_ = '<div class="pops-tip-arrow"></div>';
@@ -5519,12 +5566,15 @@ var pops = (function () {
5519
5566
  let guid = popsUtils.getRandomGUID();
5520
5567
  const PopsType = "drawer";
5521
5568
  config = PopsHandler.handleOnly(PopsType, config);
5522
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
5569
+ // 先把z-index提取出来
5570
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
5571
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
5523
5572
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
5524
5573
  let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
5525
5574
  let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(PopsType, config);
5526
5575
  let { contentStyle, contentPStyle } = PopsElementHandler.getContentStyle(PopsType, config);
5527
- let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config, `
5576
+ let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config,
5577
+ /*html*/ `
5528
5578
  ${config.title.enable
5529
5579
  ? `
5530
5580
  <div class="pops-${PopsType}-title" style="${headerStyle}">
@@ -5548,7 +5598,7 @@ var pops = (function () {
5548
5598
  </div>
5549
5599
 
5550
5600
  ${bottomBtnHTML}
5551
- `, bottomBtnHTML);
5601
+ `, bottomBtnHTML, zIndex);
5552
5602
  /**
5553
5603
  * 弹窗的主元素,包括动画层
5554
5604
  */
@@ -5906,7 +5956,9 @@ var pops = (function () {
5906
5956
  let guid = popsUtils.getRandomGUID();
5907
5957
  const PopsType = "folder";
5908
5958
  config = PopsHandler.handleOnly(PopsType, config);
5909
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
5959
+ // 先把z-index提取出来
5960
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
5961
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
5910
5962
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
5911
5963
  let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
5912
5964
  let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(PopsType, config);
@@ -6017,7 +6069,7 @@ var pops = (function () {
6017
6069
  </div>
6018
6070
  </div>
6019
6071
  ${bottomBtnHTML}
6020
- `, bottomBtnHTML);
6072
+ `, bottomBtnHTML, zIndex);
6021
6073
  /**
6022
6074
  * 弹窗的主元素,包括动画层
6023
6075
  */
@@ -6068,8 +6120,9 @@ var pops = (function () {
6068
6120
  * @param fileName
6069
6121
  * @param latestTime
6070
6122
  * @param [fileSize="-"]
6123
+ * @param isFolder
6071
6124
  */
6072
- function createFolderRowElement(fileName, latestTime = "-", fileSize = "-") {
6125
+ function createFolderRowElement(fileName, latestTime = "-", fileSize = "-", isFolder = false) {
6073
6126
  let origin_fileName = fileName;
6074
6127
  let origin_latestTime = latestTime;
6075
6128
  let origin_fileSize = fileSize;
@@ -6079,7 +6132,7 @@ var pops = (function () {
6079
6132
  let fileFormatSize = popsDOMUtils.createElement("td");
6080
6133
  let fileType = "";
6081
6134
  let fileIcon = Folder_ICON.folder;
6082
- if (arguments.length === 1) {
6135
+ if (isFolder) {
6083
6136
  /* 文件夹 */
6084
6137
  latestTime = "";
6085
6138
  fileSize = "";
@@ -6134,6 +6187,7 @@ var pops = (function () {
6134
6187
  fileName: origin_fileName,
6135
6188
  latestTime: origin_latestTime,
6136
6189
  fileSize: origin_fileSize,
6190
+ isFolder: isFolder,
6137
6191
  };
6138
6192
  fileNameElement["__value__"] = __value__;
6139
6193
  fileTimeElement["__value__"] = __value__;
@@ -6152,7 +6206,7 @@ var pops = (function () {
6152
6206
  /**
6153
6207
  * 创建移动端文件夹元素
6154
6208
  */
6155
- function createMobileFolderRowElement(fileName, latestTime = "-", fileSize = "-") {
6209
+ function createMobileFolderRowElement(fileName, latestTime = "-", fileSize = "-", isFolder = false) {
6156
6210
  let origin_fileName = fileName;
6157
6211
  let origin_latestTime = latestTime;
6158
6212
  let origin_fileSize = fileSize;
@@ -6160,7 +6214,7 @@ var pops = (function () {
6160
6214
  let fileNameElement = popsDOMUtils.createElement("td");
6161
6215
  let fileType = "";
6162
6216
  let fileIcon = Folder_ICON.folder;
6163
- if (arguments.length === 1) {
6217
+ if (isFolder) {
6164
6218
  /* 文件夹 */
6165
6219
  latestTime = "";
6166
6220
  fileSize = "";
@@ -6204,6 +6258,7 @@ var pops = (function () {
6204
6258
  fileName: origin_fileName,
6205
6259
  latestTime: origin_latestTime,
6206
6260
  fileSize: origin_fileSize,
6261
+ isFolder: isFolder,
6207
6262
  };
6208
6263
  fileNameElement["__value__"] = __value__;
6209
6264
  folderELement["__value__"] = __value__;
@@ -6377,30 +6432,24 @@ var pops = (function () {
6377
6432
  }
6378
6433
  /**
6379
6434
  * 对配置进行排序
6380
- * @param _config_
6435
+ * @param folderDataConfigList
6381
6436
  * @param sortName 比较的属性,默认fileName
6382
6437
  * @param isDesc 是否降序,默认false(升序)
6383
6438
  */
6384
- function sortFolderConfig(_config_, sortName = "fileName", isDesc = false) {
6385
- _config_.sort((a, b) => {
6386
- let beforeVal = a[sortName];
6387
- let afterVal = b[sortName];
6388
- if (sortName === "fileName") {
6389
- /* 文件名,进行字符串转换 */
6390
- beforeVal = beforeVal.toString();
6391
- afterVal = afterVal.toString();
6392
- }
6393
- else if (sortName === "fileSize") {
6394
- /* 文件大小,进行Float转换 */
6395
- beforeVal = parseFloat(beforeVal);
6396
- afterVal = parseFloat(afterVal);
6397
- }
6398
- else if (sortName === "latestTime") {
6399
- /* 文件时间 */
6400
- beforeVal = new Date(beforeVal).getTime();
6401
- afterVal = new Date(afterVal).getTime();
6402
- }
6403
- if (typeof beforeVal === "string" && typeof afterVal === "string") {
6439
+ function sortFolderConfig(folderDataConfigList, sortName = "fileName", isDesc = false) {
6440
+ console.log(folderDataConfigList, sortName, isDesc);
6441
+ if (sortName === "fileName") {
6442
+ // 如果是以文件名排序,文件夹优先放前面
6443
+ let onlyFolderDataConfigList = folderDataConfigList.filter((value) => {
6444
+ return value.isFolder;
6445
+ });
6446
+ let onlyFileDataConfigList = folderDataConfigList.filter((value) => {
6447
+ return !value.isFolder;
6448
+ });
6449
+ // 文件夹排序
6450
+ onlyFolderDataConfigList.sort((leftConfig, rightConfig) => {
6451
+ let beforeVal = leftConfig[sortName].toString();
6452
+ let afterVal = rightConfig[sortName].toString();
6404
6453
  let compareVal = beforeVal.localeCompare(afterVal);
6405
6454
  if (isDesc) {
6406
6455
  /* 降序 */
@@ -6412,8 +6461,46 @@ var pops = (function () {
6412
6461
  }
6413
6462
  }
6414
6463
  return compareVal;
6464
+ });
6465
+ // 文件名排序
6466
+ onlyFileDataConfigList.sort((leftConfig, rightConfig) => {
6467
+ let beforeVal = leftConfig[sortName].toString();
6468
+ let afterVal = rightConfig[sortName].toString();
6469
+ let compareVal = beforeVal.localeCompare(afterVal);
6470
+ if (isDesc) {
6471
+ /* 降序 */
6472
+ if (compareVal > 0) {
6473
+ compareVal = -1;
6474
+ }
6475
+ else if (compareVal < 0) {
6476
+ compareVal = 1;
6477
+ }
6478
+ }
6479
+ return compareVal;
6480
+ });
6481
+ if (isDesc) {
6482
+ // 降序,文件夹在下面
6483
+ return [...onlyFileDataConfigList, ...onlyFolderDataConfigList];
6415
6484
  }
6416
6485
  else {
6486
+ // 升序,文件夹在上面
6487
+ return [...onlyFolderDataConfigList, ...onlyFileDataConfigList];
6488
+ }
6489
+ }
6490
+ else {
6491
+ folderDataConfigList.sort((beforeConfig, afterConfig) => {
6492
+ let beforeVal = beforeConfig[sortName];
6493
+ let afterVal = afterConfig[sortName];
6494
+ if (sortName === "fileSize") {
6495
+ /* 文件大小,进行Float转换 */
6496
+ beforeVal = parseFloat(beforeVal.toString());
6497
+ afterVal = parseFloat(afterVal.toString());
6498
+ }
6499
+ else if (sortName === "latestTime") {
6500
+ /* 文件时间 */
6501
+ beforeVal = new Date(beforeVal).getTime();
6502
+ afterVal = new Date(afterVal).getTime();
6503
+ }
6417
6504
  if (beforeVal > afterVal) {
6418
6505
  if (isDesc) {
6419
6506
  /* 降序 */
@@ -6435,9 +6522,9 @@ var pops = (function () {
6435
6522
  else {
6436
6523
  return 0;
6437
6524
  }
6438
- }
6439
- });
6440
- return _config_;
6525
+ });
6526
+ return folderDataConfigList;
6527
+ }
6441
6528
  }
6442
6529
  /**
6443
6530
  * 添加元素
@@ -6448,8 +6535,8 @@ var pops = (function () {
6448
6535
  _config_.forEach((item) => {
6449
6536
  if (item["isFolder"]) {
6450
6537
  let { folderELement, fileNameElement } = pops.isPhone()
6451
- ? createMobileFolderRowElement(item["fileName"])
6452
- : createFolderRowElement(item["fileName"]);
6538
+ ? createMobileFolderRowElement(item["fileName"], "", "", true)
6539
+ : createFolderRowElement(item["fileName"], "", "", true);
6453
6540
  popsDOMUtils.on(fileNameElement, "click", (event) => {
6454
6541
  refreshFolderInfoClickEvent(event, item);
6455
6542
  });
@@ -6457,8 +6544,8 @@ var pops = (function () {
6457
6544
  }
6458
6545
  else {
6459
6546
  let { folderELement, fileNameElement } = pops.isPhone()
6460
- ? createMobileFolderRowElement(item["fileName"], item["latestTime"], item["fileSize"])
6461
- : createFolderRowElement(item["fileName"], item["latestTime"], item["fileSize"]);
6547
+ ? createMobileFolderRowElement(item["fileName"], item.latestTime, item.fileSize, false)
6548
+ : createFolderRowElement(item["fileName"], item.latestTime, item.fileSize, false);
6462
6549
  setFileClickEvent(fileNameElement, item);
6463
6550
  folderListBodyElement.appendChild(folderELement);
6464
6551
  }
@@ -6495,7 +6582,6 @@ var pops = (function () {
6495
6582
  * @param {PointerEvent} target
6496
6583
  * @param {HTMLElement} event
6497
6584
  * @param {string} sortName
6498
- * @returns
6499
6585
  */
6500
6586
  function arrowSortClickEvent(target, event, sortName) {
6501
6587
  if (!event["notChangeSortRule"]) {
@@ -6974,10 +7060,13 @@ var pops = (function () {
6974
7060
  let guid = popsUtils.getRandomGUID();
6975
7061
  const PopsType = "panel";
6976
7062
  config = PopsHandler.handleOnly(PopsType, config);
6977
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
7063
+ // 先把z-index提取出来
7064
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
7065
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
6978
7066
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
6979
7067
  let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(PopsType, config);
6980
- let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config, `
7068
+ let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config,
7069
+ /*html*/ `
6981
7070
  <div
6982
7071
  class="pops-${PopsType}-title"
6983
7072
  style="text-align: ${config.title.position};
@@ -6995,7 +7084,7 @@ var pops = (function () {
6995
7084
  <ul class="pops-panel-container-header-ul"></ul>
6996
7085
  <ul></ul>
6997
7086
  </section>
6998
- </div>`, "");
7087
+ </div>`, "", zIndex);
6999
7088
  /**
7000
7089
  * 弹窗的主元素,包括动画层
7001
7090
  */
@@ -9086,7 +9175,7 @@ var pops = (function () {
9086
9175
  * @param isChildren 是否是rightClickMenu的某一项的子菜单
9087
9176
  */
9088
9177
  getMenuContainerElement(zIndex, isChildren) {
9089
- let menuElement = popsUtils.parseTextToDOM(`
9178
+ let menuElement = popsUtils.parseTextToDOM(/*html*/ `
9090
9179
  <div class="pops-${PopsType}" ${isChildren ? 'is-children="true"' : ""}>
9091
9180
  <style type="text/css" data-from="pops-${PopsType}">
9092
9181
  .pops-${PopsType} *{
@@ -9174,6 +9263,12 @@ var pops = (function () {
9174
9263
  }
9175
9264
  return menuElement;
9176
9265
  },
9266
+ /**
9267
+ * 动态获取配的z-index
9268
+ */
9269
+ getMenuZIndex() {
9270
+ return PopsHandler.handleZIndex(config.zIndex);
9271
+ },
9177
9272
  /**
9178
9273
  * 获取left、top偏移
9179
9274
  * @param menuElement 菜单元素
@@ -9208,7 +9303,7 @@ var pops = (function () {
9208
9303
  * @param _config_
9209
9304
  */
9210
9305
  showMenu(menuEvent, _config_) {
9211
- let menuElement = this.getMenuContainerElement(config.zIndex, false);
9306
+ let menuElement = this.getMenuContainerElement(this.getMenuZIndex(), false);
9212
9307
  menuElement["__menuData__"] = {
9213
9308
  child: [],
9214
9309
  };
@@ -9246,7 +9341,7 @@ var pops = (function () {
9246
9341
  * @param targetLiElement 父li项元素
9247
9342
  */
9248
9343
  showClildMenu(menuEvent, posInfo, _config_, rootElement, targetLiElement) {
9249
- let menuElement = this.getMenuContainerElement(config.zIndex, true);
9344
+ let menuElement = this.getMenuContainerElement(this.getMenuZIndex(), true);
9250
9345
  menuElement["__menuData__"] = {
9251
9346
  parent: targetLiElement,
9252
9347
  root: rootElement,
@@ -9512,7 +9607,7 @@ var pops = (function () {
9512
9607
  }
9513
9608
  ul.pops-${PopsType}-search-suggestion-hint{
9514
9609
  position: ${config.isAbsolute ? "absolute" : "fixed"};
9515
- z-index: ${config.zIndex};
9610
+ z-index: ${PopsHandler.handleZIndex(config.zIndex)};
9516
9611
  width: 0;
9517
9612
  left: 0;
9518
9613
  max-height: ${config.maxHeight};
@@ -9949,7 +10044,7 @@ var pops = (function () {
9949
10044
  /** 配置 */
9950
10045
  config = {
9951
10046
  /** 版本号 */
9952
- version: "2024.8.15",
10047
+ version: "2024.9.10",
9953
10048
  cssText: {
9954
10049
  /** 主CSS */
9955
10050
  index: indexCSS,