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