@whitesev/pops 2.0.9 → 2.0.11

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 (57) hide show
  1. package/dist/index.amd.js +1904 -1733
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.cjs.js +1904 -1733
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.esm.js +1904 -1733
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.iife.js +1904 -1733
  8. package/dist/index.iife.js.map +1 -1
  9. package/dist/index.system.js +1904 -1733
  10. package/dist/index.system.js.map +1 -1
  11. package/dist/index.umd.js +1904 -1733
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/types/src/Pops.d.ts +50 -30
  14. package/dist/types/src/PopsAnimation.d.ts +14 -0
  15. package/dist/types/src/PopsCSS.d.ts +34 -0
  16. package/dist/types/src/PopsIcon.d.ts +25 -0
  17. package/dist/types/src/PopsLayer.d.ts +3 -0
  18. package/dist/types/src/components/panel/buttonType.d.ts +2 -2
  19. package/dist/types/src/components/panel/selectMultipleType.d.ts +12 -15
  20. package/dist/types/src/components/rightClickMenu/index.d.ts +1 -2
  21. package/dist/types/src/components/rightClickMenu/indexType.d.ts +2 -2
  22. package/dist/types/src/types/button.d.ts +3 -3
  23. package/dist/types/src/types/icon.d.ts +1 -1
  24. package/dist/types/src/utils/PopsDOMUtils.d.ts +12 -0
  25. package/dist/types/src/utils/PopsInstanceUtils.d.ts +0 -6
  26. package/dist/types/src/utils/PopsUtils.d.ts +5 -6
  27. package/package.json +3 -2
  28. package/src/Pops.ts +12 -152
  29. package/src/PopsAnimation.ts +32 -0
  30. package/src/PopsCSS.ts +51 -0
  31. package/src/PopsIcon.ts +93 -0
  32. package/src/PopsLayer.ts +17 -0
  33. package/src/components/alert/index.ts +8 -8
  34. package/src/components/confirm/index.ts +8 -8
  35. package/src/components/drawer/index.ts +8 -8
  36. package/src/components/folder/index.ts +15 -15
  37. package/src/components/iframe/index.ts +9 -12
  38. package/src/components/loading/index.ts +5 -5
  39. package/src/components/panel/PanelHandleContentDetails.ts +338 -220
  40. package/src/components/panel/buttonType.ts +2 -2
  41. package/src/components/panel/config.ts +41 -11
  42. package/src/components/panel/index.css +33 -0
  43. package/src/components/panel/index.ts +9 -9
  44. package/src/components/panel/selectMultipleType.ts +18 -15
  45. package/src/components/prompt/index.ts +8 -8
  46. package/src/components/rightClickMenu/config.ts +7 -7
  47. package/src/components/rightClickMenu/index.ts +9 -10
  48. package/src/components/rightClickMenu/indexType.ts +2 -2
  49. package/src/components/searchSuggestion/index.ts +5 -5
  50. package/src/components/tooltip/index.ts +5 -5
  51. package/src/handler/PopsElementHandler.ts +17 -17
  52. package/src/handler/PopsHandler.ts +22 -19
  53. package/src/types/button.d.ts +3 -3
  54. package/src/types/icon.d.ts +1 -1
  55. package/src/utils/PopsDOMUtils.ts +34 -1
  56. package/src/utils/PopsInstanceUtils.ts +13 -31
  57. package/src/utils/PopsUtils.ts +7 -16
@@ -1,6 +1,6 @@
1
1
  import type { PopsPanelCommonDetails } from "./commonType";
2
2
  import type { PopsButtonStyleType } from "../../types/button";
3
- import type { PopsIcon } from "../../types/icon";
3
+ import type { PopsIconType } from "../../types/icon";
4
4
  /**
5
5
  * pops.panel的 button
6
6
  */
@@ -48,7 +48,7 @@ export interface PopsPanelButtonDetails extends PopsPanelCommonDetails<PopsPanel
48
48
  /**
49
49
  * 按钮的图标,已配置的svg请看pops.config.iconSVG,或者自定义的图标svg代码
50
50
  */
51
- buttonIcon?: PopsIcon;
51
+ buttonIcon?: PopsIconType;
52
52
  /**
53
53
  * 按钮的图标在右边
54
54
  */
@@ -1,3 +1,4 @@
1
+ import { popsDOMUtils } from "../../utils/PopsDOMUtils";
1
2
  import type { PopsPanelDetails } from "./indexType";
2
3
 
3
4
  export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
@@ -130,6 +131,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
130
131
  return "50";
131
132
  },
132
133
  callback(event, value) {
134
+ popsDOMUtils.preventEvent(event);
133
135
  console.log("输入框内容改变:", value);
134
136
  },
135
137
  placeholder: "请输入内容",
@@ -145,6 +147,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
145
147
  return "123456";
146
148
  },
147
149
  callback(event, value) {
150
+ popsDOMUtils.preventEvent(event);
148
151
  console.log("密码输入框内容改变:", value);
149
152
  },
150
153
  isPassword: true,
@@ -161,6 +164,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
161
164
  return "50";
162
165
  },
163
166
  callback(event, value) {
167
+ popsDOMUtils.preventEvent(event);
164
168
  console.log("textarea输入框内容改变:", value);
165
169
  },
166
170
  placeholder: "请输入内容",
@@ -233,40 +237,66 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
233
237
  value: "select-1",
234
238
  text: "单选1",
235
239
  isHTML: false,
236
- disable() {
237
- return false;
240
+ disable(value, allSelectedInfo) {
241
+ return (
242
+ allSelectedInfo.findIndex((it) =>
243
+ ["select-5"].includes(it.value)
244
+ ) !== -1
245
+ );
238
246
  },
239
247
  },
240
248
  {
241
249
  value: "select-2",
242
250
  text: "单选2",
243
251
  isHTML: false,
244
- disable() {
245
- return false;
252
+ disable(value, allSelectedInfo) {
253
+ return (
254
+ allSelectedInfo.findIndex((it) =>
255
+ ["select-5"].includes(it.value)
256
+ ) !== -1
257
+ );
246
258
  },
247
259
  },
248
260
  {
249
261
  value: "select-3",
250
262
  text: "单选3",
251
263
  isHTML: false,
252
- disable() {
253
- return false;
264
+ disable(value, allSelectedInfo) {
265
+ return (
266
+ allSelectedInfo.findIndex((it) =>
267
+ ["select-2", "select-5"].includes(it.value)
268
+ ) !== -1
269
+ );
254
270
  },
255
271
  },
256
272
  {
257
273
  value: "select-4",
258
274
  text: "单选4",
259
275
  isHTML: false,
260
- disable() {
261
- return false;
276
+ disable(value, allSelectedInfo) {
277
+ return (
278
+ allSelectedInfo.findIndex((it) =>
279
+ ["select-3", "select-5"].includes(it.value)
280
+ ) !== -1
281
+ );
262
282
  },
263
283
  },
264
284
  {
265
285
  value: "select-5",
266
- text: "单选5",
286
+ text(value, allSelectedInfo) {
287
+ return allSelectedInfo.findIndex((it) =>
288
+ ["select-4"].includes(it.value)
289
+ ) !== -1
290
+ ? "单选5-禁用"
291
+ : "单选5";
292
+ },
267
293
  isHTML: false,
268
- disable() {
269
- return false;
294
+ disable(value, allSelectedInfo) {
295
+ return (
296
+ allSelectedInfo.findIndex((it) =>
297
+ ["select-4"].includes(it.value)
298
+ ) !== -1
299
+ );
270
300
  },
271
301
  },
272
302
  ],
@@ -1076,3 +1076,36 @@ section.pops-panel-container
1076
1076
  height: inherit;
1077
1077
  }
1078
1078
  /* deepMenu的css */
1079
+
1080
+ /* <code> */
1081
+ .pops[type-value="panel"] code {
1082
+ font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
1083
+ font-size: 0.85em;
1084
+ color: #000;
1085
+ background-color: #f0f0f0;
1086
+ border-radius: 3px;
1087
+ border: 0;
1088
+ padding: 0.2em 0;
1089
+ white-space: normal;
1090
+ background: #f5f5f5;
1091
+ text-wrap: wrap;
1092
+ text-align: left;
1093
+ word-spacing: normal;
1094
+ word-break: normal;
1095
+ word-wrap: normal;
1096
+ line-height: 1.4;
1097
+ -moz-tab-size: 8;
1098
+ -o-tab-size: 8;
1099
+ tab-size: 8;
1100
+ -webkit-hyphens: none;
1101
+ -moz-hyphens: none;
1102
+ -ms-hyphens: none;
1103
+ hyphens: none;
1104
+ direction: ltr;
1105
+ }
1106
+
1107
+ .pops[type-value="panel"] code::before,
1108
+ .pops[type-value="panel"] code::after {
1109
+ letter-spacing: -0.2em;
1110
+ content: "\00a0";
1111
+ }
@@ -1,6 +1,5 @@
1
1
  import { PopsElementHandler } from "../../handler/PopsElementHandler";
2
2
  import { PopsHandler } from "../../handler/PopsHandler";
3
- import { pops } from "../../Pops";
4
3
  import { popsDOMUtils } from "../../utils/PopsDOMUtils";
5
4
  import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
6
5
  import { popsUtils } from "../../utils/PopsUtils";
@@ -8,6 +7,7 @@ import type { PopsPanelDetails } from "./indexType";
8
7
  import { PopsPanelConfig } from "./config";
9
8
  import { PanelHandleContentDetails } from "./PanelHandleContentDetails";
10
9
  import { GlobalConfig } from "../../GlobalConfig";
10
+ import { PopsCSS } from "../../PopsCSS";
11
11
 
12
12
  export const PopsPanel = {
13
13
  init(details: PopsPanelDetails) {
@@ -25,13 +25,13 @@ export const PopsPanel = {
25
25
 
26
26
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
27
27
  PopsHandler.handleInit($shadowRoot, [
28
- pops.config.cssText.index,
29
- pops.config.cssText.ninePalaceGridPosition,
30
- pops.config.cssText.scrollbar,
31
- pops.config.cssText.button,
32
- pops.config.cssText.anim,
33
- pops.config.cssText.common,
34
- pops.config.cssText.panelCSS,
28
+ PopsCSS.index,
29
+ PopsCSS.ninePalaceGridPosition,
30
+ PopsCSS.scrollbar,
31
+ PopsCSS.button,
32
+ PopsCSS.anim,
33
+ PopsCSS.common,
34
+ PopsCSS.panelCSS,
35
35
  ]);
36
36
 
37
37
  // 先把z-index提取出来
@@ -81,7 +81,7 @@ export const PopsPanel = {
81
81
  contentAsideElement: $contentAside,
82
82
  contentSectionContainerElement: $contentSectionContainer,
83
83
  } = PopsHandler.handleQueryElement($anim, PopsType);
84
- if (config.isMobile || pops.isPhone()) {
84
+ if (config.isMobile || popsUtils.isPhone()) {
85
85
  popsDOMUtils.addClassName($pops, config.mobileClassName);
86
86
  }
87
87
  /**
@@ -9,9 +9,17 @@ export interface PopsPanelSelectMultipleDataOption<T> {
9
9
  /**
10
10
  * 显示的文字
11
11
  */
12
- text: string;
12
+ text:
13
+ | string
14
+ | ((
15
+ /** 当前的值 */
16
+ value: T,
17
+ /** 所有选中的配置信息 */
18
+ allSelectedInfo: PopsPanelSelectMultipleDataOption<T>[]
19
+ ) => string);
13
20
  /**
14
21
  * 显示的文字是否是html
22
+ * @default false
15
23
  */
16
24
  isHTML?: boolean;
17
25
  /**
@@ -19,8 +27,13 @@ export interface PopsPanelSelectMultipleDataOption<T> {
19
27
  * 触发条件:
20
28
  * + 点击select元素
21
29
  * + select元素触发change事件
30
+ * @param value 当前的值
31
+ * @param allSelectedInfo 所有选中的配置信息
22
32
  */
23
- disable?(value: T): boolean;
33
+ disable?(
34
+ value: T,
35
+ allSelectedInfo: PopsPanelSelectMultipleDataOption<T>[]
36
+ ): boolean;
24
37
  }
25
38
  /**
26
39
  * pops.panel的 select
@@ -79,12 +92,7 @@ export interface PopsPanelSelectMultipleDetails<T = any>
79
92
  */
80
93
  callback?(
81
94
  /** 当前已选中的信息 */
82
- isSelectedInfo: {
83
- /** 值 */
84
- value: T;
85
- /** 显示的文字 */
86
- text: string;
87
- }[]
95
+ isSelectedInfo: PopsPanelSelectMultipleDataOption<any>[]
88
96
  ): void;
89
97
  /**
90
98
  * 点击某个项的元素触发该回调
@@ -95,12 +103,7 @@ export interface PopsPanelSelectMultipleDetails<T = any>
95
103
  clickCallBack?(
96
104
  event: PointerEvent | MouseEvent,
97
105
  /** 当前已选中的信息 */
98
- isSelectedInfo: {
99
- /** 值 */
100
- value: T;
101
- /** 显示的文字 */
102
- text: string;
103
- }[]
106
+ isSelectedInfo: PopsPanelSelectMultipleDataOption<any>[]
104
107
  ): void | boolean;
105
108
  /**
106
109
  * 点击标签tag的关闭图标触发该回调
@@ -116,7 +119,7 @@ export interface PopsPanelSelectMultipleDetails<T = any>
116
119
  /** 值 */
117
120
  value: T;
118
121
  /** 显示的文字 */
119
- text: string;
122
+ text: PopsPanelSelectMultipleDataOption<T>["text"];
120
123
  }
121
124
  ) => void | boolean;
122
125
  /**
@@ -1,7 +1,7 @@
1
1
  import { GlobalConfig } from "../../GlobalConfig";
2
2
  import { PopsElementHandler } from "../../handler/PopsElementHandler";
3
3
  import { PopsHandler } from "../../handler/PopsHandler";
4
- import { pops } from "../../Pops";
4
+ import { PopsCSS } from "../../PopsCSS";
5
5
  import { popsDOMUtils } from "../../utils/PopsDOMUtils";
6
6
  import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
7
7
  import { popsUtils } from "../../utils/PopsUtils";
@@ -21,13 +21,13 @@ export const PopsPrompt = {
21
21
 
22
22
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
23
23
  PopsHandler.handleInit($shadowRoot, [
24
- pops.config.cssText.index,
25
- pops.config.cssText.ninePalaceGridPosition,
26
- pops.config.cssText.scrollbar,
27
- pops.config.cssText.button,
28
- pops.config.cssText.anim,
29
- pops.config.cssText.common,
30
- pops.config.cssText.promptCSS,
24
+ PopsCSS.index,
25
+ PopsCSS.ninePalaceGridPosition,
26
+ PopsCSS.scrollbar,
27
+ PopsCSS.button,
28
+ PopsCSS.anim,
29
+ PopsCSS.common,
30
+ PopsCSS.promptCSS,
31
31
  ]);
32
32
 
33
33
  // 先把z-index提取出来
@@ -1,4 +1,4 @@
1
- import { pops } from "../../Pops";
1
+ import { PopsIcon } from "../../PopsIcon";
2
2
  import type { PopsRightClickMenuDetails } from "./indexType";
3
3
 
4
4
  export const rightClickMenuConfig =
@@ -8,7 +8,7 @@ export const rightClickMenuConfig =
8
8
  targetSelector: null,
9
9
  data: [
10
10
  {
11
- icon: pops.config.iconSVG.search,
11
+ icon: PopsIcon.getIcon("search")!,
12
12
  iconIsLoading: false,
13
13
  text: "搜索",
14
14
  item: [],
@@ -21,7 +21,7 @@ export const rightClickMenuConfig =
21
21
  },
22
22
  },
23
23
  {
24
- icon: pops.config.iconSVG.documentCopy,
24
+ icon: PopsIcon.getIcon("documentCopy")!,
25
25
  iconIsLoading: false,
26
26
  text: "复制",
27
27
  item: [],
@@ -34,7 +34,7 @@ export const rightClickMenuConfig =
34
34
  },
35
35
  },
36
36
  {
37
- icon: pops.config.iconSVG.delete,
37
+ icon: PopsIcon.getIcon("delete")!,
38
38
  text: "删除",
39
39
  iconIsLoading: false,
40
40
  item: [],
@@ -47,7 +47,7 @@ export const rightClickMenuConfig =
47
47
  },
48
48
  },
49
49
  {
50
- icon: pops.config.iconSVG.loading,
50
+ icon: PopsIcon.getIcon("loading")!,
51
51
  iconIsLoading: true,
52
52
  text: "加载",
53
53
  item: [],
@@ -61,7 +61,7 @@ export const rightClickMenuConfig =
61
61
  },
62
62
  },
63
63
  {
64
- icon: pops.config.iconSVG.elemePlus,
64
+ icon: PopsIcon.getIcon("elemePlus")!,
65
65
  iconIsLoading: true,
66
66
  text: "饿了么",
67
67
  callback(clickEvent, contextMenuEvent, liElement) {
@@ -99,7 +99,7 @@ export const rightClickMenuConfig =
99
99
  },
100
100
  item: [
101
101
  {
102
- icon: pops.config.iconSVG.view,
102
+ icon: PopsIcon.getIcon("view")!,
103
103
  iconIsLoading: false,
104
104
  text: "查看",
105
105
  item: [],
@@ -1,16 +1,16 @@
1
1
  import { OriginPrototype } from "../../Core";
2
2
  import { GlobalConfig } from "../../GlobalConfig";
3
3
  import { PopsHandler } from "../../handler/PopsHandler";
4
- import { pops } from "../../Pops";
5
4
  import { popsDOMUtils } from "../../utils/PopsDOMUtils";
6
5
  import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
7
6
  import { popsUtils } from "../../utils/PopsUtils";
8
7
  import { rightClickMenuConfig as PopsRightClickMenuConfig } from "./config";
9
- import type { PopsIcon } from "../../types/icon";
10
8
  import type {
11
9
  PopsRightClickMenuDataDetails,
12
10
  PopsRightClickMenuDetails,
13
11
  } from "./indexType";
12
+ import { PopsCSS } from "../../PopsCSS";
13
+ import { PopsIcon } from "../../PopsIcon";
14
14
 
15
15
  export const PopsRightClickMenu = {
16
16
  init(details: PopsRightClickMenuDetails) {
@@ -31,10 +31,10 @@ export const PopsRightClickMenu = {
31
31
  }
32
32
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
33
33
  PopsHandler.handleInit($shadowRoot, [
34
- pops.config.cssText.index,
35
- pops.config.cssText.anim,
36
- pops.config.cssText.common,
37
- pops.config.cssText.rightClickMenu,
34
+ PopsCSS.index,
35
+ PopsCSS.anim,
36
+ PopsCSS.common,
37
+ PopsCSS.rightClickMenu,
38
38
  ]);
39
39
 
40
40
  if (config.style != null) {
@@ -441,12 +441,11 @@ export const PopsRightClickMenu = {
441
441
  let menuULElement = menuElement.querySelector<HTMLUListElement>("ul")!;
442
442
  _config_.forEach((item) => {
443
443
  let menuLiElement =
444
- popsUtils.parseTextToDOM<HTMLLIElement>(`<li></li>`);
444
+ popsDOMUtils.parseTextToDOM<HTMLLIElement>(`<li></li>`);
445
445
  /* 判断有无图标,有就添加进去 */
446
446
  if (typeof item.icon === "string" && item.icon.trim() !== "") {
447
- let iconSVGHTML =
448
- pops.config.iconSVG[item.icon as PopsIcon] ?? item.icon;
449
- let iconElement = popsUtils.parseTextToDOM(
447
+ let iconSVGHTML = PopsIcon.getIcon(item.icon) ?? item.icon;
448
+ let iconElement = popsDOMUtils.parseTextToDOM(
450
449
  /*html*/ `<i class="pops-${PopsType}-icon" is-loading="${item.iconIsLoading}">${iconSVGHTML}</i>`
451
450
  );
452
451
  menuLiElement.appendChild(iconElement);
@@ -1,5 +1,5 @@
1
1
  import type { PopsCommonConfig } from "../../types/components";
2
- import type { PopsIcon } from "../../types/icon";
2
+ import type { PopsIconType } from "../../types/icon";
3
3
 
4
4
  /**
5
5
  * pops.rightClickMenu的右键菜单配置
@@ -8,7 +8,7 @@ export interface PopsRightClickMenuDataDetails {
8
8
  /**
9
9
  * svg图标
10
10
  */
11
- icon: PopsIcon | string;
11
+ icon: PopsIconType | string;
12
12
  /**
13
13
  * 图标是否旋转
14
14
  */
@@ -1,11 +1,11 @@
1
1
  import { PopsHandler } from "../../handler/PopsHandler";
2
- import { pops } from "../../Pops";
3
2
  import { popsDOMUtils } from "../../utils/PopsDOMUtils";
4
3
  import { popsUtils } from "../../utils/PopsUtils";
5
4
  import { searchSuggestionConfig as PopsSearchSuggestionConfig } from "./config";
6
5
  import { GlobalConfig } from "../../GlobalConfig";
7
6
  import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
8
7
  import type { PopsSearchSuggestionDetails } from "./indexType";
8
+ import { PopsCSS } from "../../PopsCSS";
9
9
 
10
10
  export const PopsSearchSuggestion = {
11
11
  init(details: PopsSearchSuggestionDetails) {
@@ -29,9 +29,9 @@ export const PopsSearchSuggestion = {
29
29
 
30
30
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
31
31
  PopsHandler.handleInit($shadowRoot, [
32
- pops.config.cssText.index,
33
- pops.config.cssText.anim,
34
- pops.config.cssText.common,
32
+ PopsCSS.index,
33
+ PopsCSS.anim,
34
+ PopsCSS.common,
35
35
  ]);
36
36
 
37
37
  if (config.style != null) {
@@ -655,7 +655,7 @@ export const PopsSearchSuggestion = {
655
655
  this.$data.isEmpty = true;
656
656
  this.clearAllSearchItemLi();
657
657
  this.$el.$hintULContainer.appendChild(
658
- popsUtils.parseTextToDOM(config.toSearhNotResultHTML)
658
+ popsDOMUtils.parseTextToDOM(config.toSearhNotResultHTML)
659
659
  );
660
660
  if (config.toHideWithNotResult) {
661
661
  this.hide();
@@ -1,6 +1,6 @@
1
1
  import { GlobalConfig } from "../../GlobalConfig";
2
2
  import { PopsHandler } from "../../handler/PopsHandler";
3
- import { pops } from "../../Pops";
3
+ import { PopsCSS } from "../../PopsCSS";
4
4
  import { popsDOMUtils } from "../../utils/PopsDOMUtils";
5
5
  import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
6
6
  import { popsUtils } from "../../utils/PopsUtils";
@@ -613,10 +613,10 @@ export const PopsTooltip = {
613
613
 
614
614
  const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
615
615
  PopsHandler.handleInit($shadowRoot, [
616
- pops.config.cssText.index,
617
- pops.config.cssText.anim,
618
- pops.config.cssText.common,
619
- pops.config.cssText.tooltipCSS,
616
+ PopsCSS.index,
617
+ PopsCSS.anim,
618
+ PopsCSS.common,
619
+ PopsCSS.tooltipCSS,
620
620
  ]);
621
621
 
622
622
  let toolTip = new ToolTip(config, guid, {
@@ -1,8 +1,7 @@
1
1
  import type { PopsAlertDetails } from "../components/alert/indexType";
2
2
  import type { PopsConfirmDetails } from "../components/confirm/indexType";
3
3
  import type { PopsIframeDetails } from "../components/iframe/indexType";
4
- import { pops } from "../Pops";
5
- import type { PopsIcon } from "../types/icon";
4
+ import type { PopsIconType } from "../types/icon";
6
5
  import type {
7
6
  PopsSupportAnim,
8
7
  PopsSupportBottomBtn,
@@ -13,7 +12,8 @@ import type {
13
12
  PopsTypeSupportContent,
14
13
  PopsTypeSupportHeaderTitle,
15
14
  } from "../types/main";
16
- import { popsUtils } from "../utils/PopsUtils";
15
+ import { PopsIcon } from "../PopsIcon";
16
+ import { popsDOMUtils } from "../utils/PopsDOMUtils";
17
17
 
18
18
  export const PopsElementHandler = {
19
19
  /**
@@ -101,9 +101,7 @@ export const PopsElementHandler = {
101
101
  item = item.toLowerCase();
102
102
  topRightButtonHTML += /*html*/ `
103
103
  <button class="pops-header-control" type="${item}">
104
- <i class="pops-icon">${
105
- (pops.config.iconSVG as any)[item]
106
- }</i>
104
+ <i class="pops-icon">${PopsIcon.getIcon(item)}</i>
107
105
  </button>`;
108
106
  });
109
107
  resultHTML = /*html*/ `
@@ -113,7 +111,7 @@ export const PopsElementHandler = {
113
111
  closeHTML = /*html*/ `
114
112
  <div class="pops-header-controls">
115
113
  <button class="pops-header-control" type="close" data-header>
116
- <i class="pops-icon">${pops.config.iconSVG["close"]}</i>
114
+ <i class="pops-icon">${PopsIcon.getIcon("close")}</i>
117
115
  </button>
118
116
  </div>`;
119
117
  }
@@ -168,12 +166,12 @@ export const PopsElementHandler = {
168
166
  okButtonSizeClassName = "pops-button-" + config.btn.ok.size;
169
167
  }
170
168
  let okIconHTML = "";
171
- let okIcon = __config_confirm.btn.ok!.icon! as PopsIcon | string;
169
+ let okIcon = __config_confirm.btn.ok!.icon! as PopsIconType | string;
172
170
  if (okIcon !== "") {
173
171
  // 判断图标是否是svg库内的
174
172
  let iconHTML = "";
175
- if (okIcon in pops.config.iconSVG) {
176
- iconHTML = pops.config.iconSVG[okIcon as PopsIcon];
173
+ if (PopsIcon.hasIcon(okIcon)) {
174
+ iconHTML = PopsIcon.getIcon(okIcon)!;
177
175
  } else {
178
176
  iconHTML = okIcon;
179
177
  }
@@ -202,12 +200,14 @@ export const PopsElementHandler = {
202
200
  "pops-button-" + __config_confirm.btn.cancel.size;
203
201
  }
204
202
  let cancelIconHTML = "";
205
- let cancelIcon = __config_confirm.btn.cancel!.icon as PopsIcon | string;
203
+ let cancelIcon = __config_confirm.btn.cancel!.icon as
204
+ | PopsIconType
205
+ | string;
206
206
  if (cancelIcon !== "") {
207
207
  let iconHTML = "";
208
208
  // 判断图标是否是svg库内的
209
- if (cancelIcon in pops.config.iconSVG) {
210
- iconHTML = pops.config.iconSVG[cancelIcon as PopsIcon];
209
+ if (PopsIcon.hasIcon(cancelIcon)) {
210
+ iconHTML = PopsIcon.getIcon(cancelIcon)!;
211
211
  } else {
212
212
  iconHTML = cancelIcon;
213
213
  }
@@ -236,12 +236,12 @@ export const PopsElementHandler = {
236
236
  "pops-button-" + __config_confirm.btn.other.size;
237
237
  }
238
238
  let otherIconHTML = "";
239
- let otherIcon = __config_confirm.btn.other!.icon as PopsIcon | string;
239
+ let otherIcon = __config_confirm.btn.other!.icon as PopsIconType | string;
240
240
  if (otherIcon !== "") {
241
241
  let iconHTML = "";
242
242
  // 判断图标是否是svg库内的
243
- if (otherIcon in pops.config.iconSVG) {
244
- iconHTML = pops.config.iconSVG[otherIcon as PopsIcon];
243
+ if (PopsIcon.hasIcon(otherIcon)) {
244
+ iconHTML = PopsIcon.getIcon(otherIcon)!;
245
245
  } else {
246
246
  otherIcon;
247
247
  }
@@ -315,6 +315,6 @@ export const PopsElementHandler = {
315
315
  * @param html
316
316
  */
317
317
  parseElement<T extends HTMLElement>(html: string): T {
318
- return popsUtils.parseTextToDOM(html);
318
+ return popsDOMUtils.parseTextToDOM(html);
319
319
  },
320
320
  };