@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
@@ -62,7 +62,7 @@ export interface PopsRightClickMenuDetails {
62
62
  /**
63
63
  * 弹窗的显示层级,默认10000
64
64
  */
65
- zIndex?: number;
65
+ zIndex?: number | (() => number);
66
66
  /**
67
67
  * 是否阻止默认contextmenu事件
68
68
  */
@@ -71,7 +71,7 @@ export interface PopsSearchSuggestionDetails<T = any> {
71
71
  /**
72
72
  * 层级,默认10000
73
73
  */
74
- zIndex?: 10000;
74
+ zIndex?: number | (() => number);
75
75
  /**
76
76
  * 搜索中的提示
77
77
  */
@@ -39,7 +39,7 @@ export interface PopsToolTipDetails {
39
39
  /**
40
40
  * z-index,默认10000
41
41
  */
42
- zIndex?: number;
42
+ zIndex?: number | (() => number);
43
43
  /**
44
44
  * 是否唯一,默认false
45
45
  */
@@ -14,8 +14,9 @@ export declare const PopsElementHandler: {
14
14
  * @param config
15
15
  * @param html
16
16
  * @param bottomBtnHTML
17
+ * @param zIndex
17
18
  */
18
- getAnimHTML(guid: string, type: PopsTypeSupportAnim, config: PopsSupportAnim[keyof PopsSupportAnim], html?: string, bottomBtnHTML?: string): string;
19
+ getAnimHTML(guid: string, type: PopsTypeSupportAnim, config: PopsSupportAnim[keyof PopsSupportAnim], html: string | undefined, bottomBtnHTML: string | undefined, zIndex: number): string;
19
20
  /**
20
21
  * 获取顶部按钮层HTML
21
22
  * @param type
@@ -207,6 +207,11 @@ export declare const PopsHandler: {
207
207
  type: any;
208
208
  text: string;
209
209
  }, event: MouseEvent | PointerEvent) => void): void;
210
+ /**
211
+ * 把配置的z-index配置转为数字
212
+ * @param zIndex
213
+ */
214
+ handleZIndex(zIndex: number | (() => number)): number;
210
215
  /**
211
216
  * 处理config.only
212
217
  * @param type 当前弹窗类型
@@ -170,7 +170,7 @@ export interface PopsCommonConfig {
170
170
  /**
171
171
  * z-index显示层级,默认10000
172
172
  */
173
- zIndex?: number;
173
+ zIndex?: number | (() => number);
174
174
  /**
175
175
  * 遮罩层
176
176
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/pops",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "description": "弹窗库",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -45,6 +45,7 @@
45
45
  "typescript": "^5.4.5"
46
46
  },
47
47
  "scripts": {
48
- "build": "rollup --config"
48
+ "build": "rollup --config",
49
+ "build:all": "rollup --config"
49
50
  }
50
51
  }
package/src/Pops.ts CHANGED
@@ -80,7 +80,7 @@ class Pops {
80
80
  /** 配置 */
81
81
  config = {
82
82
  /** 版本号 */
83
- version: "2024.8.15",
83
+ version: "2024.9.10",
84
84
  cssText: {
85
85
  /** 主CSS */
86
86
  index: indexCSS,
@@ -83,7 +83,9 @@ export class PopsAlert {
83
83
  const PopsType: PopsMode = "alert";
84
84
  config = PopsHandler.handleOnly(PopsType, config);
85
85
 
86
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
86
+ // 先把z-index提取出来
87
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
88
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
87
89
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
88
90
  let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
89
91
  let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(
@@ -98,7 +100,7 @@ export class PopsAlert {
98
100
  guid,
99
101
  PopsType,
100
102
  config,
101
- `
103
+ /*html*/ `
102
104
  <div
103
105
  class="pops-alert-title"
104
106
  style="text-align: ${config.title.position};
@@ -118,7 +120,8 @@ export class PopsAlert {
118
120
  }
119
121
  </div>
120
122
  ${bottomBtnHTML}`,
121
- bottomBtnHTML
123
+ bottomBtnHTML,
124
+ zIndex
122
125
  );
123
126
  /**
124
127
  * 弹窗的主元素,包括动画层
@@ -117,7 +117,9 @@ export class PopsConfirm {
117
117
 
118
118
  config = PopsHandler.handleOnly(PopsType, config);
119
119
 
120
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
120
+ // 先把z-index提取出来
121
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
122
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
121
123
 
122
124
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
123
125
  let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
@@ -133,7 +135,7 @@ export class PopsConfirm {
133
135
  guid,
134
136
  PopsType,
135
137
  config,
136
- `
138
+ /*html*/ `
137
139
  <div class="pops-confirm-title" style="text-align: ${
138
140
  config.title.position
139
141
  };${headerStyle}">
@@ -154,7 +156,8 @@ export class PopsConfirm {
154
156
  </div>
155
157
  ${bottomBtnHTML}
156
158
  `,
157
- bottomBtnHTML
159
+ bottomBtnHTML,
160
+ zIndex
158
161
  );
159
162
  /**
160
163
  * 弹窗的主元素,包括动画层
@@ -112,7 +112,9 @@ export class PopsDrawer {
112
112
 
113
113
  config = PopsHandler.handleOnly(PopsType, config);
114
114
 
115
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
115
+ // 先把z-index提取出来
116
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
117
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
116
118
 
117
119
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
118
120
  let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
@@ -128,7 +130,7 @@ export class PopsDrawer {
128
130
  guid,
129
131
  PopsType,
130
132
  config,
131
- `
133
+ /*html*/ `
132
134
  ${
133
135
  config.title.enable
134
136
  ? `
@@ -159,7 +161,8 @@ export class PopsDrawer {
159
161
 
160
162
  ${bottomBtnHTML}
161
163
  `,
162
- bottomBtnHTML
164
+ bottomBtnHTML,
165
+ zIndex
163
166
  );
164
167
  /**
165
168
  * 弹窗的主元素,包括动画层
@@ -217,7 +217,10 @@ export class PopsFolder {
217
217
 
218
218
  config = PopsHandler.handleOnly(PopsType, config);
219
219
 
220
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
220
+ // 先把z-index提取出来
221
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
222
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
223
+
221
224
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
222
225
  let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(
223
226
  PopsType,
@@ -348,7 +351,8 @@ export class PopsFolder {
348
351
  </div>
349
352
  ${bottomBtnHTML}
350
353
  `,
351
- bottomBtnHTML
354
+ bottomBtnHTML,
355
+ zIndex
352
356
  );
353
357
  /**
354
358
  * 弹窗的主元素,包括动画层
@@ -448,11 +452,13 @@ export class PopsFolder {
448
452
  * @param fileName
449
453
  * @param latestTime
450
454
  * @param [fileSize="-"]
455
+ * @param isFolder
451
456
  */
452
457
  function createFolderRowElement(
453
458
  fileName: string,
454
- latestTime = "-",
455
- fileSize = "-"
459
+ latestTime: string | number = "-",
460
+ fileSize: string | number = "-",
461
+ isFolder: boolean = false
456
462
  ) {
457
463
  let origin_fileName = fileName;
458
464
  let origin_latestTime = latestTime;
@@ -467,7 +473,7 @@ export class PopsFolder {
467
473
  let fileFormatSize = popsDOMUtils.createElement("td");
468
474
  let fileType = "";
469
475
  let fileIcon = Folder_ICON.folder;
470
- if (arguments.length === 1) {
476
+ if (isFolder) {
471
477
  /* 文件夹 */
472
478
  latestTime = "";
473
479
  fileSize = "";
@@ -523,6 +529,7 @@ export class PopsFolder {
523
529
  fileName: origin_fileName,
524
530
  latestTime: origin_latestTime,
525
531
  fileSize: origin_fileSize,
532
+ isFolder: isFolder,
526
533
  };
527
534
 
528
535
  (fileNameElement as any)["__value__"] = __value__;
@@ -547,8 +554,9 @@ export class PopsFolder {
547
554
  */
548
555
  function createMobileFolderRowElement(
549
556
  fileName: string,
550
- latestTime = "-",
551
- fileSize = "-"
557
+ latestTime: number | string = "-",
558
+ fileSize: number | string = "-",
559
+ isFolder: boolean = false
552
560
  ) {
553
561
  let origin_fileName = fileName;
554
562
  let origin_latestTime = latestTime;
@@ -559,7 +567,7 @@ export class PopsFolder {
559
567
  let fileNameElement = popsDOMUtils.createElement("td");
560
568
  let fileType = "";
561
569
  let fileIcon = Folder_ICON.folder;
562
- if (arguments.length === 1) {
570
+ if (isFolder) {
563
571
  /* 文件夹 */
564
572
  latestTime = "";
565
573
  fileSize = "";
@@ -603,6 +611,7 @@ export class PopsFolder {
603
611
  fileName: origin_fileName,
604
612
  latestTime: origin_latestTime,
605
613
  fileSize: origin_fileSize,
614
+ isFolder: isFolder,
606
615
  };
607
616
 
608
617
  (fileNameElement as any)["__value__"] = __value__;
@@ -833,34 +842,43 @@ export class PopsFolder {
833
842
  }
834
843
  /**
835
844
  * 对配置进行排序
836
- * @param _config_
845
+ * @param folderDataConfigList
837
846
  * @param sortName 比较的属性,默认fileName
838
847
  * @param isDesc 是否降序,默认false(升序)
839
848
  */
840
849
  function sortFolderConfig(
841
- _config_: PopsFolderDataConfig[],
850
+ folderDataConfigList: PopsFolderDataConfig[],
842
851
  sortName: "fileName" | "fileSize" | "latestTime" = "fileName",
843
852
  isDesc = false
844
853
  ) {
845
- _config_.sort((a, b) => {
846
- let beforeVal = a[sortName];
847
- let afterVal = b[sortName];
848
- if (sortName === "fileName") {
849
- /* 文件名,进行字符串转换 */
850
- beforeVal = beforeVal.toString();
851
- afterVal = afterVal.toString();
852
- } else if (sortName === "fileSize") {
853
- /* 文件大小,进行Float转换 */
854
-
855
- beforeVal = parseFloat(beforeVal as string);
856
-
857
- afterVal = parseFloat(afterVal as string);
858
- } else if (sortName === "latestTime") {
859
- /* 文件时间 */
860
- beforeVal = new Date(beforeVal).getTime();
861
- afterVal = new Date(afterVal).getTime();
862
- }
863
- if (typeof beforeVal === "string" && typeof afterVal === "string") {
854
+ console.log(folderDataConfigList, sortName, isDesc);
855
+ if (sortName === "fileName") {
856
+ // 如果是以文件名排序,文件夹优先放前面
857
+ let onlyFolderDataConfigList = folderDataConfigList.filter((value) => {
858
+ return value.isFolder;
859
+ });
860
+ let onlyFileDataConfigList = folderDataConfigList.filter((value) => {
861
+ return !value.isFolder;
862
+ });
863
+ // 文件夹排序
864
+ onlyFolderDataConfigList.sort((leftConfig, rightConfig) => {
865
+ let beforeVal = leftConfig[sortName].toString();
866
+ let afterVal = rightConfig[sortName].toString();
867
+ let compareVal = beforeVal.localeCompare(afterVal);
868
+ if (isDesc) {
869
+ /* 降序 */
870
+ if (compareVal > 0) {
871
+ compareVal = -1;
872
+ } else if (compareVal < 0) {
873
+ compareVal = 1;
874
+ }
875
+ }
876
+ return compareVal;
877
+ });
878
+ // 文件名排序
879
+ onlyFileDataConfigList.sort((leftConfig, rightConfig) => {
880
+ let beforeVal = leftConfig[sortName].toString();
881
+ let afterVal = rightConfig[sortName].toString();
864
882
  let compareVal = beforeVal.localeCompare(afterVal);
865
883
  if (isDesc) {
866
884
  /* 降序 */
@@ -871,7 +889,27 @@ export class PopsFolder {
871
889
  }
872
890
  }
873
891
  return compareVal;
892
+ });
893
+ if (isDesc) {
894
+ // 降序,文件夹在下面
895
+ return [...onlyFileDataConfigList, ...onlyFolderDataConfigList];
874
896
  } else {
897
+ // 升序,文件夹在上面
898
+ return [...onlyFolderDataConfigList, ...onlyFileDataConfigList];
899
+ }
900
+ } else {
901
+ folderDataConfigList.sort((beforeConfig, afterConfig) => {
902
+ let beforeVal = beforeConfig[sortName];
903
+ let afterVal = afterConfig[sortName];
904
+ if (sortName === "fileSize") {
905
+ /* 文件大小,进行Float转换 */
906
+ beforeVal = parseFloat(beforeVal.toString());
907
+ afterVal = parseFloat(afterVal.toString());
908
+ } else if (sortName === "latestTime") {
909
+ /* 文件时间 */
910
+ beforeVal = new Date(beforeVal).getTime();
911
+ afterVal = new Date(afterVal).getTime();
912
+ }
875
913
  if (beforeVal > afterVal) {
876
914
  if (isDesc) {
877
915
  /* 降序 */
@@ -889,9 +927,9 @@ export class PopsFolder {
889
927
  } else {
890
928
  return 0;
891
929
  }
892
- }
893
- });
894
- return _config_;
930
+ });
931
+ return folderDataConfigList;
932
+ }
895
933
  }
896
934
  /**
897
935
  * 添加元素
@@ -902,8 +940,8 @@ export class PopsFolder {
902
940
  _config_.forEach((item) => {
903
941
  if (item["isFolder"]) {
904
942
  let { folderELement, fileNameElement } = pops.isPhone()
905
- ? createMobileFolderRowElement(item["fileName"])
906
- : createFolderRowElement(item["fileName"]);
943
+ ? createMobileFolderRowElement(item["fileName"], "", "", true)
944
+ : createFolderRowElement(item["fileName"], "", "", true);
907
945
 
908
946
  popsDOMUtils.on<MouseEvent | PointerEvent>(
909
947
  fileNameElement,
@@ -918,13 +956,15 @@ export class PopsFolder {
918
956
  let { folderELement, fileNameElement } = pops.isPhone()
919
957
  ? createMobileFolderRowElement(
920
958
  item["fileName"],
921
- (item as any)["latestTime"],
922
- (item as any)["fileSize"]
959
+ item.latestTime,
960
+ item.fileSize,
961
+ false
923
962
  )
924
963
  : createFolderRowElement(
925
964
  item["fileName"],
926
- (item as any)["latestTime"],
927
- (item as any)["fileSize"]
965
+ item.latestTime,
966
+ item.fileSize,
967
+ false
928
968
  );
929
969
  setFileClickEvent(fileNameElement, item);
930
970
 
@@ -990,7 +1030,6 @@ export class PopsFolder {
990
1030
  * @param {PointerEvent} target
991
1031
  * @param {HTMLElement} event
992
1032
  * @param {string} sortName
993
- * @returns
994
1033
  */
995
1034
  function arrowSortClickEvent(
996
1035
  target: HTMLDivElement,
@@ -1029,7 +1068,7 @@ export class PopsFolder {
1029
1068
  childrenList.push(__value__);
1030
1069
  });
1031
1070
  let sortedConfigList = sortFolderConfig(
1032
- childrenList as any,
1071
+ childrenList,
1033
1072
  config.sort.name,
1034
1073
  config.sort.isDesc
1035
1074
  );
@@ -87,12 +87,11 @@ export class PopsIframe {
87
87
  config.animation != null && (config as any).animation != ""
88
88
  ? "position:absolute;"
89
89
  : "";
90
- let maskHTML = PopsElementHandler.getMaskHTML(
91
- guid,
92
90
 
93
- config.zIndex,
94
- maskExtraStyle
95
- );
91
+ // 先把z-index提取出来
92
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
93
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex, maskExtraStyle);
94
+
96
95
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
97
96
  let iframeLoadingHTML = '<div class="pops-loading"></div>';
98
97
  let titleText =
@@ -105,7 +104,7 @@ export class PopsIframe {
105
104
  guid,
106
105
  PopsType,
107
106
  config,
108
- `
107
+ /*html*/ `
109
108
  <div
110
109
  class="pops-iframe-title"
111
110
  style="text-align: ${config.title.position};${headerStyle}"
@@ -131,7 +130,8 @@ export class PopsIframe {
131
130
  </div>
132
131
  ${config.loading.enable ? iframeLoadingHTML : ""}
133
132
  `,
134
- ""
133
+ "",
134
+ zIndex
135
135
  );
136
136
  /**
137
137
  * 弹窗的主元素,包括动画层
@@ -362,7 +362,11 @@ export class PopsIframe {
362
362
  headerCloseBtnElement,
363
363
  "click",
364
364
  (event) => {
365
- PopsInstanceUtils.removeInstance([pops.config.layer.iframe], guid, false);
365
+ PopsInstanceUtils.removeInstance(
366
+ [pops.config.layer.iframe],
367
+ guid,
368
+ false
369
+ );
366
370
  setTimeout(() => {
367
371
  let allIsMinElementList: HTMLElement[] = [];
368
372
  pops.config.layer.iframe.forEach((item) => {
@@ -37,7 +37,11 @@ export class PopsLoading {
37
37
  const PopsType = "loading";
38
38
 
39
39
  config = PopsHandler.handleOnly(PopsType, config);
40
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
40
+
41
+ // 先把z-index提取出来
42
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
43
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
44
+
41
45
  let { contentPStyle } = PopsElementHandler.getContentStyle(
42
46
  "loading",
43
47
  config
@@ -46,7 +50,7 @@ export class PopsLoading {
46
50
  guid,
47
51
  PopsType,
48
52
  config,
49
- `
53
+ /*html*/ `
50
54
  <div class="pops-loading-content">
51
55
  ${
52
56
  config.addIndexCSS
@@ -64,7 +68,8 @@ export class PopsLoading {
64
68
  <p pops style="${contentPStyle}">${config.content.text}</p>
65
69
  </div>
66
70
  `,
67
- ""
71
+ "",
72
+ zIndex
68
73
  );
69
74
 
70
75
  /**
@@ -346,7 +346,11 @@ export class PopsPanel {
346
346
  let guid = popsUtils.getRandomGUID();
347
347
  const PopsType = "panel";
348
348
  config = PopsHandler.handleOnly(PopsType, config);
349
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
349
+
350
+ // 先把z-index提取出来
351
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
352
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
353
+
350
354
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
351
355
  let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(
352
356
  PopsType,
@@ -357,7 +361,7 @@ export class PopsPanel {
357
361
  guid,
358
362
  PopsType,
359
363
  config,
360
- `
364
+ /*html*/ `
361
365
  <div
362
366
  class="pops-${PopsType}-title"
363
367
  style="text-align: ${config.title.position};
@@ -378,7 +382,8 @@ export class PopsPanel {
378
382
  <ul></ul>
379
383
  </section>
380
384
  </div>`,
381
- ""
385
+ "",
386
+ zIndex
382
387
  );
383
388
  /**
384
389
  * 弹窗的主元素,包括动画层
@@ -123,7 +123,9 @@ export class PopsPrompt {
123
123
 
124
124
  config = PopsHandler.handleOnly(PopsType, config);
125
125
 
126
- let maskHTML = PopsElementHandler.getMaskHTML(guid, config.zIndex);
126
+ // 先把z-index提取出来
127
+ let zIndex = PopsHandler.handleZIndex(config.zIndex);
128
+ let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
127
129
 
128
130
  let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(PopsType, config);
129
131
  let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(PopsType, config);
@@ -139,7 +141,7 @@ export class PopsPrompt {
139
141
  guid,
140
142
  PopsType,
141
143
  config,
142
- `
144
+ /*html*/ `
143
145
  <div class="pops-prompt-title" style="text-align: ${
144
146
  config.title.position
145
147
  };${headerStyle}">
@@ -163,9 +165,10 @@ export class PopsPrompt {
163
165
  '">'
164
166
  }
165
167
  </div>
166
- ${bottomBtnHTML}
168
+ ${bottomBtnHTML}
167
169
  `,
168
- bottomBtnHTML
170
+ bottomBtnHTML,
171
+ zIndex
169
172
  );
170
173
  /**
171
174
  * 弹窗的主元素,包括动画层
@@ -355,7 +355,7 @@ export class PopsRightClickMenu {
355
355
  * @param isChildren 是否是rightClickMenu的某一项的子菜单
356
356
  */
357
357
  getMenuContainerElement(zIndex: number, isChildren: boolean) {
358
- let menuElement = popsUtils.parseTextToDOM(`
358
+ let menuElement = popsUtils.parseTextToDOM(/*html*/ `
359
359
  <div class="pops-${PopsType}" ${isChildren ? 'is-children="true"' : ""}>
360
360
  <style type="text/css" data-from="pops-${PopsType}">
361
361
  .pops-${PopsType} *{
@@ -443,6 +443,12 @@ export class PopsRightClickMenu {
443
443
  }
444
444
  return menuElement;
445
445
  },
446
+ /**
447
+ * 动态获取配的z-index
448
+ */
449
+ getMenuZIndex() {
450
+ return PopsHandler.handleZIndex(config.zIndex);
451
+ },
446
452
  /**
447
453
  * 获取left、top偏移
448
454
  * @param menuElement 菜单元素
@@ -483,7 +489,10 @@ export class PopsRightClickMenu {
483
489
  menuEvent: PointerEvent,
484
490
  _config_: PopsRightClickMenuDataDetails[]
485
491
  ) {
486
- let menuElement = this.getMenuContainerElement(config.zIndex, false);
492
+ let menuElement = this.getMenuContainerElement(
493
+ this.getMenuZIndex(),
494
+ false
495
+ );
487
496
  (menuElement as any)["__menuData__"] = {
488
497
  child: [],
489
498
  };
@@ -539,7 +548,10 @@ export class PopsRightClickMenu {
539
548
  rootElement: HTMLDivElement,
540
549
  targetLiElement: HTMLLIElement
541
550
  ) {
542
- let menuElement = this.getMenuContainerElement(config.zIndex, true);
551
+ let menuElement = this.getMenuContainerElement(
552
+ this.getMenuZIndex(),
553
+ true
554
+ );
543
555
  (menuElement as any)["__menuData__"] = {
544
556
  parent: targetLiElement,
545
557
  root: rootElement,
@@ -68,7 +68,7 @@ export interface PopsRightClickMenuDetails {
68
68
  /**
69
69
  * 弹窗的显示层级,默认10000
70
70
  */
71
- zIndex?: number;
71
+ zIndex?: number | (() => number);
72
72
  /**
73
73
  * 是否阻止默认contextmenu事件
74
74
  */
@@ -144,7 +144,7 @@ export class PopsSearchSuggestion {
144
144
  }
145
145
  ul.pops-${PopsType}-search-suggestion-hint{
146
146
  position: ${config.isAbsolute ? "absolute" : "fixed"};
147
- z-index: ${config.zIndex};
147
+ z-index: ${PopsHandler.handleZIndex(config.zIndex)};
148
148
  width: 0;
149
149
  left: 0;
150
150
  max-height: ${config.maxHeight};
@@ -75,7 +75,7 @@ export interface PopsSearchSuggestionDetails<T = any> {
75
75
  /**
76
76
  * 层级,默认10000
77
77
  */
78
- zIndex?: 10000;
78
+ zIndex?: number | (() => number);
79
79
  /**
80
80
  * 搜索中的提示
81
81
  */
@@ -69,7 +69,9 @@ export class PopsTooltip {
69
69
  }
70
70
  _toolTipElement_.setAttribute("data-guid", guid);
71
71
 
72
- _toolTipElement_.style.zIndex = config.zIndex.toString();
72
+ _toolTipElement_.style.zIndex = PopsHandler.handleZIndex(
73
+ config.zIndex
74
+ ).toString();
73
75
  _toolTipElement_.innerHTML = `<div style="text-align: center;">${getContent()}</div>`;
74
76
  /* 箭头元素 */
75
77
  let _toolTipArrowHTML_ = '<div class="pops-tip-arrow"></div>';
@@ -40,7 +40,7 @@ export interface PopsToolTipDetails {
40
40
  /**
41
41
  * z-index,默认10000
42
42
  */
43
- zIndex?: number;
43
+ zIndex?: number | (() => number);
44
44
  /**
45
45
  * 是否唯一,默认false
46
46
  */