@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
@@ -1527,17 +1527,21 @@ System.register('pops', [], (function (exports) {
1527
1527
  else {
1528
1528
  for (const targetKeyName in target) {
1529
1529
  if (targetKeyName in source) {
1530
+ // @ts-ignore
1530
1531
  let targetValue = target[targetKeyName];
1532
+ // @ts-ignore
1531
1533
  let sourceValue = source[targetKeyName];
1532
1534
  if (typeof sourceValue === "object" &&
1533
1535
  sourceValue != null &&
1534
1536
  !UtilsContext.isDOM(sourceValue) &&
1535
1537
  Object.keys(sourceValue).length) {
1536
1538
  /* 源端的值是object类型,且不是元素节点 */
1539
+ // @ts-ignore
1537
1540
  target[targetKeyName] = UtilsContext.assign(targetValue, sourceValue, isAdd);
1538
1541
  continue;
1539
1542
  }
1540
1543
  /* 直接赋值 */
1544
+ // @ts-ignore
1541
1545
  target[targetKeyName] = sourceValue;
1542
1546
  }
1543
1547
  }
@@ -3555,6 +3559,9 @@ System.register('pops', [], (function (exports) {
3555
3559
  */
3556
3560
  getMaskHTML(guid, zIndex = 101, style = "") {
3557
3561
  zIndex = zIndex - 100;
3562
+ if (style.startsWith(";")) {
3563
+ style = style.replace(";", "");
3564
+ }
3558
3565
  return `<div class="pops-mask" data-guid="${guid}" style="z-index:${zIndex};${style}"></div>`;
3559
3566
  },
3560
3567
  /**
@@ -3564,15 +3571,16 @@ System.register('pops', [], (function (exports) {
3564
3571
  * @param config
3565
3572
  * @param html
3566
3573
  * @param bottomBtnHTML
3574
+ * @param zIndex
3567
3575
  */
3568
- getAnimHTML(guid, type, config, html = "", bottomBtnHTML = "") {
3576
+ getAnimHTML(guid, type, config, html = "", bottomBtnHTML = "", zIndex) {
3569
3577
  let __config = config;
3570
3578
  let popsAnimStyle = "";
3571
3579
  let popsStyle = "";
3572
3580
  let popsPosition = __config.position || "";
3573
3581
  if (config.zIndex != null) {
3574
- popsAnimStyle += `z-index: ${config.zIndex};`;
3575
- popsStyle += `z-index: ${config.zIndex};`;
3582
+ popsAnimStyle += `z-index: ${zIndex};`;
3583
+ popsStyle += `z-index: ${zIndex};`;
3576
3584
  }
3577
3585
  if (__config.width != null) {
3578
3586
  popsStyle += `width: ${__config.width};`;
@@ -3581,24 +3589,25 @@ System.register('pops', [], (function (exports) {
3581
3589
  popsStyle += `height: ${__config.height};`;
3582
3590
  }
3583
3591
  let hasBottomBtn = bottomBtnHTML.trim() === "" ? false : true;
3584
- return `<div
3585
- class="pops-anim"
3586
- anim="${__config.animation || ""}"
3587
- style="${popsAnimStyle};"
3588
- data-guid="${guid}">
3592
+ return /*html*/ `
3593
+ <div
3594
+ class="pops-anim"
3595
+ anim="${__config.animation || ""}"
3596
+ style="${popsAnimStyle};"
3597
+ data-guid="${guid}">
3589
3598
  ${config.style != null
3590
3599
  ? `<style tyle="text/css">${config.style}</style>`
3591
3600
  : ""}
3592
- <div
3593
- class="pops ${config.class || ""}"
3594
- data-bottom-btn="${hasBottomBtn}"
3595
- type-value="${type}"
3596
- style="${popsStyle}"
3597
- position="${popsPosition}"
3598
- data-guid="${guid}">
3599
- ${html}
3600
- </div>
3601
- </div>`;
3601
+ <div
3602
+ class="pops ${config.class || ""}"
3603
+ data-bottom-btn="${hasBottomBtn}"
3604
+ type-value="${type}"
3605
+ style="${popsStyle}"
3606
+ position="${popsPosition}"
3607
+ data-guid="${guid}">
3608
+ ${html}
3609
+ </div>
3610
+ </div>`;
3602
3611
  },
3603
3612
  /**
3604
3613
  * 获取顶部按钮层HTML
@@ -4208,6 +4217,18 @@ System.register('pops', [], (function (exports) {
4208
4217
  capture: true,
4209
4218
  });
4210
4219
  },
4220
+ /**
4221
+ * 把配置的z-index配置转为数字
4222
+ * @param zIndex
4223
+ */
4224
+ handleZIndex(zIndex) {
4225
+ if (typeof zIndex === "function") {
4226
+ return zIndex();
4227
+ }
4228
+ else {
4229
+ return zIndex;
4230
+ }
4231
+ },
4211
4232
  /**
4212
4233
  * 处理config.only
4213
4234
  * @param type 当前弹窗类型
@@ -4233,8 +4254,19 @@ System.register('pops', [], (function (exports) {
4233
4254
  }
4234
4255
  }
4235
4256
  else {
4236
- const { zIndex: maxZIndex } = PopsInstanceUtils.getPopsMaxZIndex(config.zIndex + 100);
4237
- config.zIndex = maxZIndex;
4257
+ // 对配置进行处理
4258
+ // 选择配置的z-index和已有的pops实例的最大z-index值
4259
+ if (typeof config.zIndex === "function") {
4260
+ let originZIndexFn = config.zIndex;
4261
+ config.zIndex = () => {
4262
+ const { zIndex: maxZIndex } = PopsInstanceUtils.getPopsMaxZIndex(PopsHandler.handleZIndex(originZIndexFn) + 100);
4263
+ return maxZIndex;
4264
+ };
4265
+ }
4266
+ else {
4267
+ const { zIndex: maxZIndex } = PopsInstanceUtils.getPopsMaxZIndex(PopsHandler.handleZIndex(config.zIndex) + 100);
4268
+ config.zIndex = maxZIndex;
4269
+ }
4238
4270
  }
4239
4271
  return config;
4240
4272
  },
@@ -4322,12 +4354,15 @@ System.register('pops', [], (function (exports) {
4322
4354
  // 设置当前类型
4323
4355
  const PopsType = "alert";
4324
4356
  config = PopsHandler.handleOnly(PopsType, config);
4325
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
4357
+ // 先把z-index提取出来
4358
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
4359
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
4326
4360
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
4327
4361
  let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
4328
4362
  let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(PopsType, config);
4329
4363
  let { contentStyle, contentPStyle } = PopsElementHandler.getContentStyle(PopsType, config);
4330
- let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config, `
4364
+ let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config,
4365
+ /*html*/ `
4331
4366
  <div
4332
4367
  class="pops-alert-title"
4333
4368
  style="text-align: ${config.title.position};
@@ -4342,7 +4377,7 @@ System.register('pops', [], (function (exports) {
4342
4377
  ? config.content.text
4343
4378
  : `<p pops style="${contentPStyle}">${config.content.text}</p>`}
4344
4379
  </div>
4345
- ${bottomBtnHTML}`, bottomBtnHTML);
4380
+ ${bottomBtnHTML}`, bottomBtnHTML, zIndex);
4346
4381
  /**
4347
4382
  * 弹窗的主元素,包括动画层
4348
4383
  */
@@ -4504,12 +4539,15 @@ System.register('pops', [], (function (exports) {
4504
4539
  // 设置当前类型
4505
4540
  const PopsType = "confirm";
4506
4541
  config = PopsHandler.handleOnly(PopsType, config);
4507
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
4542
+ // 先把z-index提取出来
4543
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
4544
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
4508
4545
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
4509
4546
  let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
4510
4547
  let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(PopsType, config);
4511
4548
  let { contentStyle, contentPStyle } = PopsElementHandler.getContentStyle(PopsType, config);
4512
- let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config, `
4549
+ let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config,
4550
+ /*html*/ `
4513
4551
  <div class="pops-confirm-title" style="text-align: ${config.title.position};${headerStyle}">
4514
4552
  ${config.title.html
4515
4553
  ? config.title.text
@@ -4523,7 +4561,7 @@ System.register('pops', [], (function (exports) {
4523
4561
 
4524
4562
  </div>
4525
4563
  ${bottomBtnHTML}
4526
- `, bottomBtnHTML);
4564
+ `, bottomBtnHTML, zIndex);
4527
4565
  /**
4528
4566
  * 弹窗的主元素,包括动画层
4529
4567
  */
@@ -4692,12 +4730,15 @@ System.register('pops', [], (function (exports) {
4692
4730
  let guid = popsUtils.getRandomGUID();
4693
4731
  const PopsType = "prompt";
4694
4732
  config = PopsHandler.handleOnly(PopsType, config);
4695
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
4733
+ // 先把z-index提取出来
4734
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
4735
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
4696
4736
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
4697
4737
  let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
4698
4738
  let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(PopsType, config);
4699
4739
  let { contentPStyle } = PopsElementHandler.getContentStyle(PopsType, config);
4700
- let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config, `
4740
+ let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config,
4741
+ /*html*/ `
4701
4742
  <div class="pops-prompt-title" style="text-align: ${config.title.position};${headerStyle}">
4702
4743
  ${config.title.html
4703
4744
  ? config.title.text
@@ -4715,8 +4756,8 @@ System.register('pops', [], (function (exports) {
4715
4756
  (config.content.password ? "password" : "text") +
4716
4757
  '">'}
4717
4758
  </div>
4718
- ${bottomBtnHTML}
4719
- `, bottomBtnHTML);
4759
+ ${bottomBtnHTML}
4760
+ `, bottomBtnHTML, zIndex);
4720
4761
  /**
4721
4762
  * 弹窗的主元素,包括动画层
4722
4763
  */
@@ -4813,9 +4854,12 @@ System.register('pops', [], (function (exports) {
4813
4854
  let guid = popsUtils.getRandomGUID();
4814
4855
  const PopsType = "loading";
4815
4856
  config = PopsHandler.handleOnly(PopsType, config);
4816
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
4857
+ // 先把z-index提取出来
4858
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
4859
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
4817
4860
  let { contentPStyle } = PopsElementHandler.getContentStyle("loading", config);
4818
- let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config, `
4861
+ let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config,
4862
+ /*html*/ `
4819
4863
  <div class="pops-loading-content">
4820
4864
  ${config.addIndexCSS
4821
4865
  ? `
@@ -4830,7 +4874,7 @@ System.register('pops', [], (function (exports) {
4830
4874
  ${config.style != null ? `<style>${config.style}</style>` : ""}
4831
4875
  <p pops style="${contentPStyle}">${config.content.text}</p>
4832
4876
  </div>
4833
- `, "");
4877
+ `, "", zIndex);
4834
4878
  /**
4835
4879
  * 弹窗的主元素,包括动画层
4836
4880
  */
@@ -4946,12 +4990,15 @@ System.register('pops', [], (function (exports) {
4946
4990
  let maskExtraStyle = config.animation != null && config.animation != ""
4947
4991
  ? "position:absolute;"
4948
4992
  : "";
4949
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex, maskExtraStyle);
4993
+ // 先把z-index提取出来
4994
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
4995
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex, maskExtraStyle);
4950
4996
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
4951
4997
  let iframeLoadingHTML = '<div class="pops-loading"></div>';
4952
4998
  let titleText = config.title.text.trim() !== "" ? config.title.text : config.url;
4953
4999
  let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(PopsType, config);
4954
- let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config, `
5000
+ let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config,
5001
+ /*html*/ `
4955
5002
  <div
4956
5003
  class="pops-iframe-title"
4957
5004
  style="text-align: ${config.title.position};${headerStyle}"
@@ -4972,7 +5019,7 @@ System.register('pops', [], (function (exports) {
4972
5019
  </iframe>
4973
5020
  </div>
4974
5021
  ${config.loading.enable ? iframeLoadingHTML : ""}
4975
- `, "");
5022
+ `, "", zIndex);
4976
5023
  /**
4977
5024
  * 弹窗的主元素,包括动画层
4978
5025
  */
@@ -5204,7 +5251,7 @@ System.register('pops', [], (function (exports) {
5204
5251
  popsDOMUtils.addClassName(_toolTipElement_, config.className);
5205
5252
  }
5206
5253
  _toolTipElement_.setAttribute("data-guid", guid);
5207
- _toolTipElement_.style.zIndex = config.zIndex.toString();
5254
+ _toolTipElement_.style.zIndex = PopsHandler.handleZIndex(config.zIndex).toString();
5208
5255
  _toolTipElement_.innerHTML = `<div style="text-align: center;">${getContent()}</div>`;
5209
5256
  /* 箭头元素 */
5210
5257
  let _toolTipArrowHTML_ = '<div class="pops-tip-arrow"></div>';
@@ -5521,12 +5568,15 @@ System.register('pops', [], (function (exports) {
5521
5568
  let guid = popsUtils.getRandomGUID();
5522
5569
  const PopsType = "drawer";
5523
5570
  config = PopsHandler.handleOnly(PopsType, config);
5524
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
5571
+ // 先把z-index提取出来
5572
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
5573
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
5525
5574
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
5526
5575
  let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
5527
5576
  let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(PopsType, config);
5528
5577
  let { contentStyle, contentPStyle } = PopsElementHandler.getContentStyle(PopsType, config);
5529
- let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config, `
5578
+ let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config,
5579
+ /*html*/ `
5530
5580
  ${config.title.enable
5531
5581
  ? `
5532
5582
  <div class="pops-${PopsType}-title" style="${headerStyle}">
@@ -5550,7 +5600,7 @@ System.register('pops', [], (function (exports) {
5550
5600
  </div>
5551
5601
 
5552
5602
  ${bottomBtnHTML}
5553
- `, bottomBtnHTML);
5603
+ `, bottomBtnHTML, zIndex);
5554
5604
  /**
5555
5605
  * 弹窗的主元素,包括动画层
5556
5606
  */
@@ -5908,7 +5958,9 @@ System.register('pops', [], (function (exports) {
5908
5958
  let guid = popsUtils.getRandomGUID();
5909
5959
  const PopsType = "folder";
5910
5960
  config = PopsHandler.handleOnly(PopsType, config);
5911
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
5961
+ // 先把z-index提取出来
5962
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
5963
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
5912
5964
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
5913
5965
  let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
5914
5966
  let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(PopsType, config);
@@ -6019,7 +6071,7 @@ System.register('pops', [], (function (exports) {
6019
6071
  </div>
6020
6072
  </div>
6021
6073
  ${bottomBtnHTML}
6022
- `, bottomBtnHTML);
6074
+ `, bottomBtnHTML, zIndex);
6023
6075
  /**
6024
6076
  * 弹窗的主元素,包括动画层
6025
6077
  */
@@ -6070,8 +6122,9 @@ System.register('pops', [], (function (exports) {
6070
6122
  * @param fileName
6071
6123
  * @param latestTime
6072
6124
  * @param [fileSize="-"]
6125
+ * @param isFolder
6073
6126
  */
6074
- function createFolderRowElement(fileName, latestTime = "-", fileSize = "-") {
6127
+ function createFolderRowElement(fileName, latestTime = "-", fileSize = "-", isFolder = false) {
6075
6128
  let origin_fileName = fileName;
6076
6129
  let origin_latestTime = latestTime;
6077
6130
  let origin_fileSize = fileSize;
@@ -6081,7 +6134,7 @@ System.register('pops', [], (function (exports) {
6081
6134
  let fileFormatSize = popsDOMUtils.createElement("td");
6082
6135
  let fileType = "";
6083
6136
  let fileIcon = Folder_ICON.folder;
6084
- if (arguments.length === 1) {
6137
+ if (isFolder) {
6085
6138
  /* 文件夹 */
6086
6139
  latestTime = "";
6087
6140
  fileSize = "";
@@ -6136,6 +6189,7 @@ System.register('pops', [], (function (exports) {
6136
6189
  fileName: origin_fileName,
6137
6190
  latestTime: origin_latestTime,
6138
6191
  fileSize: origin_fileSize,
6192
+ isFolder: isFolder,
6139
6193
  };
6140
6194
  fileNameElement["__value__"] = __value__;
6141
6195
  fileTimeElement["__value__"] = __value__;
@@ -6154,7 +6208,7 @@ System.register('pops', [], (function (exports) {
6154
6208
  /**
6155
6209
  * 创建移动端文件夹元素
6156
6210
  */
6157
- function createMobileFolderRowElement(fileName, latestTime = "-", fileSize = "-") {
6211
+ function createMobileFolderRowElement(fileName, latestTime = "-", fileSize = "-", isFolder = false) {
6158
6212
  let origin_fileName = fileName;
6159
6213
  let origin_latestTime = latestTime;
6160
6214
  let origin_fileSize = fileSize;
@@ -6162,7 +6216,7 @@ System.register('pops', [], (function (exports) {
6162
6216
  let fileNameElement = popsDOMUtils.createElement("td");
6163
6217
  let fileType = "";
6164
6218
  let fileIcon = Folder_ICON.folder;
6165
- if (arguments.length === 1) {
6219
+ if (isFolder) {
6166
6220
  /* 文件夹 */
6167
6221
  latestTime = "";
6168
6222
  fileSize = "";
@@ -6206,6 +6260,7 @@ System.register('pops', [], (function (exports) {
6206
6260
  fileName: origin_fileName,
6207
6261
  latestTime: origin_latestTime,
6208
6262
  fileSize: origin_fileSize,
6263
+ isFolder: isFolder,
6209
6264
  };
6210
6265
  fileNameElement["__value__"] = __value__;
6211
6266
  folderELement["__value__"] = __value__;
@@ -6379,30 +6434,24 @@ System.register('pops', [], (function (exports) {
6379
6434
  }
6380
6435
  /**
6381
6436
  * 对配置进行排序
6382
- * @param _config_
6437
+ * @param folderDataConfigList
6383
6438
  * @param sortName 比较的属性,默认fileName
6384
6439
  * @param isDesc 是否降序,默认false(升序)
6385
6440
  */
6386
- function sortFolderConfig(_config_, sortName = "fileName", isDesc = false) {
6387
- _config_.sort((a, b) => {
6388
- let beforeVal = a[sortName];
6389
- let afterVal = b[sortName];
6390
- if (sortName === "fileName") {
6391
- /* 文件名,进行字符串转换 */
6392
- beforeVal = beforeVal.toString();
6393
- afterVal = afterVal.toString();
6394
- }
6395
- else if (sortName === "fileSize") {
6396
- /* 文件大小,进行Float转换 */
6397
- beforeVal = parseFloat(beforeVal);
6398
- afterVal = parseFloat(afterVal);
6399
- }
6400
- else if (sortName === "latestTime") {
6401
- /* 文件时间 */
6402
- beforeVal = new Date(beforeVal).getTime();
6403
- afterVal = new Date(afterVal).getTime();
6404
- }
6405
- if (typeof beforeVal === "string" && typeof afterVal === "string") {
6441
+ function sortFolderConfig(folderDataConfigList, sortName = "fileName", isDesc = false) {
6442
+ console.log(folderDataConfigList, sortName, isDesc);
6443
+ if (sortName === "fileName") {
6444
+ // 如果是以文件名排序,文件夹优先放前面
6445
+ let onlyFolderDataConfigList = folderDataConfigList.filter((value) => {
6446
+ return value.isFolder;
6447
+ });
6448
+ let onlyFileDataConfigList = folderDataConfigList.filter((value) => {
6449
+ return !value.isFolder;
6450
+ });
6451
+ // 文件夹排序
6452
+ onlyFolderDataConfigList.sort((leftConfig, rightConfig) => {
6453
+ let beforeVal = leftConfig[sortName].toString();
6454
+ let afterVal = rightConfig[sortName].toString();
6406
6455
  let compareVal = beforeVal.localeCompare(afterVal);
6407
6456
  if (isDesc) {
6408
6457
  /* 降序 */
@@ -6414,8 +6463,46 @@ System.register('pops', [], (function (exports) {
6414
6463
  }
6415
6464
  }
6416
6465
  return compareVal;
6466
+ });
6467
+ // 文件名排序
6468
+ onlyFileDataConfigList.sort((leftConfig, rightConfig) => {
6469
+ let beforeVal = leftConfig[sortName].toString();
6470
+ let afterVal = rightConfig[sortName].toString();
6471
+ let compareVal = beforeVal.localeCompare(afterVal);
6472
+ if (isDesc) {
6473
+ /* 降序 */
6474
+ if (compareVal > 0) {
6475
+ compareVal = -1;
6476
+ }
6477
+ else if (compareVal < 0) {
6478
+ compareVal = 1;
6479
+ }
6480
+ }
6481
+ return compareVal;
6482
+ });
6483
+ if (isDesc) {
6484
+ // 降序,文件夹在下面
6485
+ return [...onlyFileDataConfigList, ...onlyFolderDataConfigList];
6417
6486
  }
6418
6487
  else {
6488
+ // 升序,文件夹在上面
6489
+ return [...onlyFolderDataConfigList, ...onlyFileDataConfigList];
6490
+ }
6491
+ }
6492
+ else {
6493
+ folderDataConfigList.sort((beforeConfig, afterConfig) => {
6494
+ let beforeVal = beforeConfig[sortName];
6495
+ let afterVal = afterConfig[sortName];
6496
+ if (sortName === "fileSize") {
6497
+ /* 文件大小,进行Float转换 */
6498
+ beforeVal = parseFloat(beforeVal.toString());
6499
+ afterVal = parseFloat(afterVal.toString());
6500
+ }
6501
+ else if (sortName === "latestTime") {
6502
+ /* 文件时间 */
6503
+ beforeVal = new Date(beforeVal).getTime();
6504
+ afterVal = new Date(afterVal).getTime();
6505
+ }
6419
6506
  if (beforeVal > afterVal) {
6420
6507
  if (isDesc) {
6421
6508
  /* 降序 */
@@ -6437,9 +6524,9 @@ System.register('pops', [], (function (exports) {
6437
6524
  else {
6438
6525
  return 0;
6439
6526
  }
6440
- }
6441
- });
6442
- return _config_;
6527
+ });
6528
+ return folderDataConfigList;
6529
+ }
6443
6530
  }
6444
6531
  /**
6445
6532
  * 添加元素
@@ -6450,8 +6537,8 @@ System.register('pops', [], (function (exports) {
6450
6537
  _config_.forEach((item) => {
6451
6538
  if (item["isFolder"]) {
6452
6539
  let { folderELement, fileNameElement } = pops.isPhone()
6453
- ? createMobileFolderRowElement(item["fileName"])
6454
- : createFolderRowElement(item["fileName"]);
6540
+ ? createMobileFolderRowElement(item["fileName"], "", "", true)
6541
+ : createFolderRowElement(item["fileName"], "", "", true);
6455
6542
  popsDOMUtils.on(fileNameElement, "click", (event) => {
6456
6543
  refreshFolderInfoClickEvent(event, item);
6457
6544
  });
@@ -6459,8 +6546,8 @@ System.register('pops', [], (function (exports) {
6459
6546
  }
6460
6547
  else {
6461
6548
  let { folderELement, fileNameElement } = pops.isPhone()
6462
- ? createMobileFolderRowElement(item["fileName"], item["latestTime"], item["fileSize"])
6463
- : createFolderRowElement(item["fileName"], item["latestTime"], item["fileSize"]);
6549
+ ? createMobileFolderRowElement(item["fileName"], item.latestTime, item.fileSize, false)
6550
+ : createFolderRowElement(item["fileName"], item.latestTime, item.fileSize, false);
6464
6551
  setFileClickEvent(fileNameElement, item);
6465
6552
  folderListBodyElement.appendChild(folderELement);
6466
6553
  }
@@ -6497,7 +6584,6 @@ System.register('pops', [], (function (exports) {
6497
6584
  * @param {PointerEvent} target
6498
6585
  * @param {HTMLElement} event
6499
6586
  * @param {string} sortName
6500
- * @returns
6501
6587
  */
6502
6588
  function arrowSortClickEvent(target, event, sortName) {
6503
6589
  if (!event["notChangeSortRule"]) {
@@ -6976,10 +7062,13 @@ System.register('pops', [], (function (exports) {
6976
7062
  let guid = popsUtils.getRandomGUID();
6977
7063
  const PopsType = "panel";
6978
7064
  config = PopsHandler.handleOnly(PopsType, config);
6979
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
7065
+ // 先把z-index提取出来
7066
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
7067
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
6980
7068
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
6981
7069
  let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(PopsType, config);
6982
- let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config, `
7070
+ let animHTML = PopsElementHandler.getAnimHTML(guid, PopsType, config,
7071
+ /*html*/ `
6983
7072
  <div
6984
7073
  class="pops-${PopsType}-title"
6985
7074
  style="text-align: ${config.title.position};
@@ -6997,7 +7086,7 @@ System.register('pops', [], (function (exports) {
6997
7086
  <ul class="pops-panel-container-header-ul"></ul>
6998
7087
  <ul></ul>
6999
7088
  </section>
7000
- </div>`, "");
7089
+ </div>`, "", zIndex);
7001
7090
  /**
7002
7091
  * 弹窗的主元素,包括动画层
7003
7092
  */
@@ -9088,7 +9177,7 @@ System.register('pops', [], (function (exports) {
9088
9177
  * @param isChildren 是否是rightClickMenu的某一项的子菜单
9089
9178
  */
9090
9179
  getMenuContainerElement(zIndex, isChildren) {
9091
- let menuElement = popsUtils.parseTextToDOM(`
9180
+ let menuElement = popsUtils.parseTextToDOM(/*html*/ `
9092
9181
  <div class="pops-${PopsType}" ${isChildren ? 'is-children="true"' : ""}>
9093
9182
  <style type="text/css" data-from="pops-${PopsType}">
9094
9183
  .pops-${PopsType} *{
@@ -9176,6 +9265,12 @@ System.register('pops', [], (function (exports) {
9176
9265
  }
9177
9266
  return menuElement;
9178
9267
  },
9268
+ /**
9269
+ * 动态获取配的z-index
9270
+ */
9271
+ getMenuZIndex() {
9272
+ return PopsHandler.handleZIndex(config.zIndex);
9273
+ },
9179
9274
  /**
9180
9275
  * 获取left、top偏移
9181
9276
  * @param menuElement 菜单元素
@@ -9210,7 +9305,7 @@ System.register('pops', [], (function (exports) {
9210
9305
  * @param _config_
9211
9306
  */
9212
9307
  showMenu(menuEvent, _config_) {
9213
- let menuElement = this.getMenuContainerElement(config.zIndex, false);
9308
+ let menuElement = this.getMenuContainerElement(this.getMenuZIndex(), false);
9214
9309
  menuElement["__menuData__"] = {
9215
9310
  child: [],
9216
9311
  };
@@ -9248,7 +9343,7 @@ System.register('pops', [], (function (exports) {
9248
9343
  * @param targetLiElement 父li项元素
9249
9344
  */
9250
9345
  showClildMenu(menuEvent, posInfo, _config_, rootElement, targetLiElement) {
9251
- let menuElement = this.getMenuContainerElement(config.zIndex, true);
9346
+ let menuElement = this.getMenuContainerElement(this.getMenuZIndex(), true);
9252
9347
  menuElement["__menuData__"] = {
9253
9348
  parent: targetLiElement,
9254
9349
  root: rootElement,
@@ -9514,7 +9609,7 @@ System.register('pops', [], (function (exports) {
9514
9609
  }
9515
9610
  ul.pops-${PopsType}-search-suggestion-hint{
9516
9611
  position: ${config.isAbsolute ? "absolute" : "fixed"};
9517
- z-index: ${config.zIndex};
9612
+ z-index: ${PopsHandler.handleZIndex(config.zIndex)};
9518
9613
  width: 0;
9519
9614
  left: 0;
9520
9615
  max-height: ${config.maxHeight};
@@ -9951,7 +10046,7 @@ System.register('pops', [], (function (exports) {
9951
10046
  /** 配置 */
9952
10047
  config = {
9953
10048
  /** 版本号 */
9954
- version: "2024.8.15",
10049
+ version: "2024.9.10",
9955
10050
  cssText: {
9956
10051
  /** 主CSS */
9957
10052
  index: indexCSS,