@whitesev/pops 2.4.5 → 2.4.7

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 (153) hide show
  1. package/README.md +117 -111
  2. package/dist/index.amd.js +1248 -1287
  3. package/dist/index.amd.js.map +1 -1
  4. package/dist/index.cjs.js +1248 -1287
  5. package/dist/index.cjs.js.map +1 -1
  6. package/dist/index.esm.js +1248 -1287
  7. package/dist/index.esm.js.map +1 -1
  8. package/dist/index.iife.js +1248 -1287
  9. package/dist/index.iife.js.map +1 -1
  10. package/dist/index.system.js +1248 -1287
  11. package/dist/index.system.js.map +1 -1
  12. package/dist/index.umd.js +1248 -1287
  13. package/dist/index.umd.js.map +1 -1
  14. package/dist/types/src/Pops.d.ts +9 -10
  15. package/dist/types/src/components/panel/types/components-common.d.ts +26 -26
  16. package/dist/types/src/components/panel/types/index.d.ts +1 -1
  17. package/dist/types/src/components/rightClickMenu/index.d.ts +3 -4
  18. package/dist/types/src/components/searchSuggestion/index.d.ts +2 -2
  19. package/dist/types/src/components/searchSuggestion/types/index.d.ts +2 -2
  20. package/dist/types/src/handler/PopsHandler.d.ts +3 -3
  21. package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +252 -256
  22. package/dist/types/src/types/animation.d.ts +19 -19
  23. package/dist/types/src/types/button.d.ts +187 -187
  24. package/dist/types/src/types/components.d.ts +210 -213
  25. package/dist/types/src/types/event.d.ts +63 -63
  26. package/dist/types/src/types/global.d.ts +25 -20
  27. package/dist/types/src/types/icon.d.ts +32 -32
  28. package/dist/types/src/types/inst.d.ts +24 -24
  29. package/dist/types/src/types/main.d.ts +111 -114
  30. package/dist/types/src/types/mask.d.ts +49 -49
  31. package/dist/types/src/types/position.d.ts +60 -60
  32. package/dist/types/src/utils/PopsDOMUtils.d.ts +1 -1
  33. package/dist/types/src/utils/PopsInstanceUtils.d.ts +1 -1
  34. package/dist/types/src/utils/PopsUtils.d.ts +16 -16
  35. package/index.ts +3 -0
  36. package/package.json +20 -9
  37. package/src/Pops.ts +206 -0
  38. package/src/PopsAnimation.ts +32 -0
  39. package/src/PopsCSS.ts +51 -0
  40. package/src/PopsCore.ts +64 -0
  41. package/src/PopsIcon.ts +95 -0
  42. package/src/PopsInst.ts +21 -0
  43. package/src/components/alert/config.ts +62 -0
  44. package/src/components/alert/index.css +0 -0
  45. package/src/components/alert/index.ts +163 -0
  46. package/src/components/alert/types/index.ts +23 -0
  47. package/src/components/confirm/config.ts +90 -0
  48. package/src/components/confirm/index.css +0 -0
  49. package/src/components/confirm/index.ts +166 -0
  50. package/src/components/confirm/types/index.ts +17 -0
  51. package/src/components/drawer/config.ts +89 -0
  52. package/src/components/drawer/index.css +37 -0
  53. package/src/components/drawer/index.ts +237 -0
  54. package/src/components/drawer/types/index.ts +61 -0
  55. package/src/components/folder/config.ts +147 -0
  56. package/src/components/folder/folderIcon.ts +28 -0
  57. package/src/components/folder/index.css +303 -0
  58. package/src/components/folder/index.ts +929 -0
  59. package/src/components/folder/types/index.ts +97 -0
  60. package/src/components/iframe/config.ts +60 -0
  61. package/src/components/iframe/index.css +76 -0
  62. package/src/components/iframe/index.ts +334 -0
  63. package/src/components/iframe/types/index.ts +139 -0
  64. package/src/components/loading/config.ts +29 -0
  65. package/src/components/loading/index.css +66 -0
  66. package/src/components/loading/index.ts +99 -0
  67. package/src/components/loading/types/index.ts +34 -0
  68. package/src/components/panel/config.ts +519 -0
  69. package/src/components/panel/handlerComponents.ts +2900 -0
  70. package/src/components/panel/index.css +1222 -0
  71. package/src/components/panel/index.ts +207 -0
  72. package/src/components/panel/types/components-button.ts +68 -0
  73. package/src/components/panel/types/components-common.ts +50 -0
  74. package/src/components/panel/types/components-deepMenu.ts +84 -0
  75. package/src/components/panel/types/components-forms.ts +44 -0
  76. package/src/components/panel/types/components-input.ts +78 -0
  77. package/src/components/panel/types/components-own.ts +30 -0
  78. package/src/components/panel/types/components-select.ts +93 -0
  79. package/src/components/panel/types/components-selectMultiple.ts +130 -0
  80. package/src/components/panel/types/components-slider.ts +77 -0
  81. package/src/components/panel/types/components-switch.ts +56 -0
  82. package/src/components/panel/types/components-textarea.ts +68 -0
  83. package/src/components/panel/types/index.ts +177 -0
  84. package/src/components/prompt/config.ts +94 -0
  85. package/src/components/prompt/index.css +34 -0
  86. package/src/components/prompt/index.ts +216 -0
  87. package/src/components/prompt/types/index.ts +55 -0
  88. package/src/components/rightClickMenu/config.ts +98 -0
  89. package/src/components/rightClickMenu/index.css +112 -0
  90. package/src/components/rightClickMenu/index.ts +602 -0
  91. package/src/components/rightClickMenu/types/index.ts +97 -0
  92. package/src/components/searchSuggestion/config.ts +56 -0
  93. package/src/components/searchSuggestion/index.ts +856 -0
  94. package/src/components/searchSuggestion/types/index.ts +239 -0
  95. package/src/components/tooltip/config.ts +34 -0
  96. package/src/components/tooltip/index.css +199 -0
  97. package/src/components/tooltip/index.ts +604 -0
  98. package/src/components/tooltip/types/index.ts +117 -0
  99. package/src/config/CommonCSSClassName.ts +17 -0
  100. package/src/config/GlobalConfig.ts +63 -0
  101. package/src/css/animation.css +987 -0
  102. package/src/css/button.css +551 -0
  103. package/src/css/common.css +48 -0
  104. package/src/css/index.css +253 -0
  105. package/src/css/ninePalaceGridPosition.css +50 -0
  106. package/src/css/scrollbar.css +22 -0
  107. package/src/handler/PopsElementHandler.ts +304 -0
  108. package/src/handler/PopsHandler.ts +589 -0
  109. package/src/svg/arrowLeft.svg +4 -0
  110. package/src/svg/arrowRight.svg +4 -0
  111. package/src/svg/chromeFilled.svg +11 -0
  112. package/src/svg/circleClose.svg +8 -0
  113. package/src/svg/close.svg +5 -0
  114. package/src/svg/cpu.svg +8 -0
  115. package/src/svg/delete.svg +5 -0
  116. package/src/svg/documentCopy.svg +5 -0
  117. package/src/svg/edit.svg +8 -0
  118. package/src/svg/eleme.svg +5 -0
  119. package/src/svg/elemePlus.svg +5 -0
  120. package/src/svg/headset.svg +5 -0
  121. package/src/svg/hide.svg +8 -0
  122. package/src/svg/keyboard.svg +8 -0
  123. package/src/svg/loading.svg +5 -0
  124. package/src/svg/max.svg +5 -0
  125. package/src/svg/min.svg +5 -0
  126. package/src/svg/mise.svg +5 -0
  127. package/src/svg/monitor.svg +5 -0
  128. package/src/svg/next.svg +5 -0
  129. package/src/svg/picture.svg +8 -0
  130. package/src/svg/prev.svg +5 -0
  131. package/src/svg/search.svg +5 -0
  132. package/src/svg/share.svg +5 -0
  133. package/src/svg/upload.svg +5 -0
  134. package/src/svg/videoPause.svg +5 -0
  135. package/src/svg/videoPlay.svg +5 -0
  136. package/src/svg/view.svg +5 -0
  137. package/src/types/PopsDOMUtilsEventType.d.ts +252 -0
  138. package/src/types/animation.d.ts +19 -0
  139. package/src/types/button.d.ts +187 -0
  140. package/src/types/components.d.ts +210 -0
  141. package/src/types/event.d.ts +63 -0
  142. package/src/types/global.d.ts +25 -0
  143. package/src/types/icon.d.ts +32 -0
  144. package/src/types/inst.d.ts +24 -0
  145. package/src/types/main.d.ts +111 -0
  146. package/src/types/mask.d.ts +49 -0
  147. package/src/types/position.d.ts +60 -0
  148. package/src/utils/PopsDOMUtils.ts +2408 -0
  149. package/src/utils/PopsDOMUtilsEventsConfig.ts +4 -0
  150. package/src/utils/PopsInstanceUtils.ts +688 -0
  151. package/src/utils/PopsMathUtils.ts +71 -0
  152. package/src/utils/PopsSafeUtils.ts +22 -0
  153. package/src/utils/PopsUtils.ts +406 -0
@@ -0,0 +1,253 @@
1
+ @charset "utf-8";
2
+ .pops * {
3
+ -webkit-box-sizing: border-box;
4
+ box-sizing: border-box;
5
+ margin: 0;
6
+ padding: 0;
7
+ -webkit-tap-highlight-color: transparent;
8
+ /* 代替::-webkit-scrollbar */
9
+ scrollbar-width: thin;
10
+ }
11
+ .pops {
12
+ --pops-bg-opacity: 1;
13
+ --pops-bd-opacity: 1;
14
+ --pops-font-size: 16px;
15
+ interpolate-size: allow-keywords;
16
+ --pops-color: #000000;
17
+ --pops-bg-color: rgb(255, 255, 255, var(--pops-bg-opacity));
18
+ --pops-bd-color: rgb(235, 238, 245, var(--pops-bd-opacity));
19
+ --pops-box-shadow-color: rgba(0, 0, 0, 0.12);
20
+ --pops-title-color: #000000;
21
+ --pops-title-border-color: var(--pops-bd-color);
22
+ --pops-content-color: #000000;
23
+ --pops-bottom-btn-controls-border-color: var(--pops-bd-color);
24
+ --pops-components-is-disabled-text-color: #a8abb2;
25
+ --pops-components-is-disabled-bg-color: #f5f7fa;
26
+ }
27
+ @media (prefers-color-scheme: dark) {
28
+ .pops {
29
+ --pops-mask-bg-opacity: 0.8;
30
+ --pops-color: #ffffff;
31
+ --pops-bg-color: rgb(17, 17, 17, var(--pops-bg-opacity));
32
+ --pops-bd-color: rgb(55, 55, 55, var(--pops-bd-opacity));
33
+ --pops-box-shadow-color: rgba(81, 81, 81, 0.12);
34
+ --pops-title-color: #e8e8e8;
35
+ --pops-title-border-color: var(--pops-bd-color);
36
+ --pops-content-color: #e5e5e5;
37
+ --pops-components-is-disabled-text-color: #a8abb2;
38
+ --pops-components-is-disabled-bg-color: #262727;
39
+ }
40
+ }
41
+ .pops {
42
+ color: var(--pops-color);
43
+ background-color: var(--pops-bg-color);
44
+ border: 1px solid var(--pops-bd-color);
45
+ border-radius: 4px;
46
+ font-size: var(--pops-font-size);
47
+ line-height: normal;
48
+ box-shadow: 0 0 12px var(--pops-box-shadow-color);
49
+ box-sizing: border-box;
50
+ overflow: hidden;
51
+ transition: all 0.35s;
52
+ display: flex;
53
+ flex-direction: column;
54
+ }
55
+ .pops-anim {
56
+ position: fixed;
57
+ top: 0;
58
+ right: 0;
59
+ bottom: 0;
60
+ left: 0;
61
+ width: 100%;
62
+ height: 100%;
63
+ }
64
+ .pops-anim[anim=""] {
65
+ top: unset;
66
+ right: unset;
67
+ bottom: unset;
68
+ left: unset;
69
+ width: unset;
70
+ height: unset;
71
+ transition: none;
72
+ }
73
+ /* 底部图标动画和样式 */
74
+ .pops i.pops-bottom-icon[is-loading="true"] {
75
+ animation: rotating 2s linear infinite;
76
+ }
77
+ .pops i.pops-bottom-icon {
78
+ height: 1em;
79
+ width: 1em;
80
+ line-height: normal;
81
+ display: inline-flex;
82
+ justify-content: center;
83
+ align-items: center;
84
+ position: relative;
85
+ fill: currentColor;
86
+ color: inherit;
87
+ font-size: inherit;
88
+ }
89
+
90
+ /* 遮罩层样式 */
91
+ .pops-mask {
92
+ --pops-mask-bg-opacity: 0.4;
93
+ --pops-mask-bg-color: rgba(0, 0, 0, var(--pops-mask-bg-opacity));
94
+ }
95
+ .pops-mask {
96
+ position: fixed;
97
+ top: 0;
98
+ right: 0;
99
+ bottom: 0;
100
+ left: 0;
101
+ width: 100%;
102
+ height: 100%;
103
+ border: 0;
104
+ border-radius: 0;
105
+ background-color: var(--pops-mask-bg-color);
106
+ box-shadow: none;
107
+ transition: none;
108
+ }
109
+
110
+ .pops-header-controls button.pops-header-control[type][data-header] {
111
+ float: right;
112
+ margin: 0 0;
113
+ outline: 0;
114
+ border: 0;
115
+ border-color: rgb(136, 136, 136, var(--pops-bd-opacity));
116
+ background-color: transparent;
117
+ color: #888;
118
+ cursor: pointer;
119
+ }
120
+ .pops-header-controls button.pops-header-control[data-type="max"],
121
+ .pops-header-controls button.pops-header-control[data-type="mise"],
122
+ .pops-header-controls button.pops-header-control[data-type="min"] {
123
+ outline: 0 !important;
124
+ border: 0;
125
+ border-color: rgb(136, 136, 136, var(--pops-bd-opacity));
126
+ background-color: transparent;
127
+ color: rgb(136, 136, 136);
128
+ cursor: pointer;
129
+ transition: all 0.3s ease-in-out;
130
+ }
131
+ button.pops-header-control i {
132
+ color: rgb(144, 147, 153);
133
+ font-size: inherit;
134
+ display: inline-flex;
135
+ justify-content: center;
136
+ align-items: center;
137
+ position: relative;
138
+ fill: currentColor;
139
+ }
140
+ button.pops-header-control svg {
141
+ height: 1.25em;
142
+ width: 1.25em;
143
+ }
144
+ button.pops-header-control {
145
+ right: 15px;
146
+ padding: 0;
147
+ border: none;
148
+ outline: 0;
149
+ background: 0 0;
150
+ cursor: pointer;
151
+ position: unset;
152
+ line-height: normal;
153
+ }
154
+ button.pops-header-control i:hover {
155
+ color: rgb(64, 158, 255);
156
+ }
157
+ .pops-header-controls[data-margin] button.pops-header-control {
158
+ margin: 0 6px;
159
+ display: flex;
160
+ align-items: center;
161
+ }
162
+ .pops[type-value] .pops-header-controls {
163
+ display: flex;
164
+ gap: 6px;
165
+ }
166
+
167
+ /* 代码块 <code> */
168
+ .pops code {
169
+ font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
170
+ font-size: 0.85em;
171
+ color: #000;
172
+ background-color: #f0f0f0;
173
+ border-radius: 3px;
174
+ border: 0;
175
+ padding: 0.2em 0;
176
+ white-space: normal;
177
+ background: #f5f5f5;
178
+ text-wrap: wrap;
179
+ text-align: left;
180
+ word-spacing: normal;
181
+ word-break: normal;
182
+ word-wrap: normal;
183
+ line-height: 1.4;
184
+ -moz-tab-size: 8;
185
+ -o-tab-size: 8;
186
+ tab-size: 8;
187
+ -webkit-hyphens: none;
188
+ -moz-hyphens: none;
189
+ -ms-hyphens: none;
190
+ hyphens: none;
191
+ direction: ltr;
192
+ }
193
+
194
+ .pops code::before,
195
+ .pops code::after {
196
+ letter-spacing: -0.2em;
197
+ content: "\00a0";
198
+ }
199
+
200
+ /* 标题 */
201
+ .pops .pops-title {
202
+ -webkit-user-select: none;
203
+ -moz-user-select: none;
204
+ -ms-user-select: none;
205
+ user-select: none;
206
+ display: flex;
207
+ align-items: center;
208
+ justify-content: space-between;
209
+ border-bottom: 1px solid var(--pops-title-border-color);
210
+ width: 100%;
211
+ height: var(--container-title-height);
212
+ }
213
+ /* 标题-普通文本 */
214
+ .pops .pops-title p[pops] {
215
+ color: var(--pops-title-color);
216
+ width: 100%;
217
+ overflow: hidden;
218
+ text-indent: 15px;
219
+ text-overflow: ellipsis;
220
+ white-space: nowrap;
221
+ font-weight: 500;
222
+ line-height: normal;
223
+ }
224
+
225
+ /* 内容 */
226
+ .pops .pops-content {
227
+ width: 100%;
228
+ /*height: calc(
229
+ 100% - var(--container-title-height) - var(--container-bottom-btn-height)
230
+ );*/
231
+ flex: 1;
232
+ overflow: auto;
233
+ word-break: break-word;
234
+ }
235
+ /* 内容-普通文本 */
236
+ .pops .pops-content p[pops] {
237
+ color: var(--pops-content-color);
238
+ padding: 5px 10px;
239
+ text-indent: 15px;
240
+ }
241
+
242
+ /* 底部-按钮组 */
243
+ .pops .pops-botttom-btn-controls {
244
+ display: flex;
245
+ padding: 10px 10px 10px 10px;
246
+ width: 100%;
247
+ height: var(--container-bottom-btn-height);
248
+ max-height: var(--container-bottom-btn-height);
249
+ line-height: normal;
250
+ border-top: 1px solid var(--pops-bottom-btn-controls-border-color);
251
+ text-align: right;
252
+ align-items: center;
253
+ }
@@ -0,0 +1,50 @@
1
+ .pops[position="top_left"] {
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ }
6
+ .pops[position="top"] {
7
+ position: fixed;
8
+ top: 0;
9
+ left: 50%;
10
+ transform: translateX(-50%);
11
+ }
12
+ .pops[position="top_right"] {
13
+ position: fixed;
14
+ top: 0;
15
+ right: 0;
16
+ }
17
+ .pops[position="center_left"] {
18
+ position: fixed;
19
+ top: 50%;
20
+ left: 0;
21
+ transform: translateY(-50%);
22
+ }
23
+ .pops[position="center"] {
24
+ position: fixed;
25
+ top: 50%;
26
+ left: 50%;
27
+ transform: translate(-50%, -50%);
28
+ }
29
+ .pops[position="center_right"] {
30
+ position: fixed;
31
+ top: 50%;
32
+ right: 0;
33
+ transform: translateY(-50%);
34
+ }
35
+ .pops[position="bottom_left"] {
36
+ position: fixed;
37
+ bottom: 0;
38
+ left: 0;
39
+ }
40
+ .pops[position="bottom"] {
41
+ position: fixed;
42
+ bottom: 0;
43
+ left: 50%;
44
+ transform: translate(-50%, 0);
45
+ }
46
+ .pops[position="bottom_right"] {
47
+ position: fixed;
48
+ right: 0;
49
+ bottom: 0;
50
+ }
@@ -0,0 +1,22 @@
1
+ /* ::-webkit-scrollbar 是非标准的css */
2
+ /* https://caniuse.com/?search=%20%3A%3A-webkit-scrollbar */
3
+ .pops ::-webkit-scrollbar {
4
+ width: 6px;
5
+ height: 0;
6
+ }
7
+
8
+ /* 滚动条轨道 */
9
+ .pops ::-webkit-scrollbar-track {
10
+ width: 0;
11
+ }
12
+ /* 滚动条滑块 */
13
+ .pops ::-webkit-scrollbar-thumb {
14
+ min-height: 28px;
15
+ border-radius: 2em;
16
+ background: rgb(204, 204, 204, var(--pops-bg-opacity, 1));
17
+ background-clip: padding-box;
18
+ }
19
+ /* 滚动条滑块 */
20
+ .pops ::-webkit-scrollbar-thumb:hover {
21
+ background: rgb(178, 178, 178, var(--pops-bg-opacity, 1));
22
+ }
@@ -0,0 +1,304 @@
1
+ import type { PopsAlertDetails } from "../components/alert/types";
2
+ import type { PopsConfirmDetails } from "../components/confirm/types";
3
+ import type { PopsIframeDetails } from "../components/iframe/types";
4
+ import type { PopsIconType } from "../types/icon";
5
+ import type {
6
+ PopsSupportAnimDetails,
7
+ PopsSupportBottomBtnDetails,
8
+ PopsSupportContentDetails,
9
+ PopsSupportHeaderTitleDetails,
10
+ PopsSupportAnimDetailsType,
11
+ PopsSupportBottomBtnDetailsType,
12
+ PopsSupportContentDetailsType,
13
+ PopsSupportHeaderTitleDetailsType,
14
+ } from "../types/main";
15
+ import { PopsIcon } from "../PopsIcon";
16
+ import { popsDOMUtils } from "../utils/PopsDOMUtils";
17
+
18
+ export const PopsElementHandler = {
19
+ /**
20
+ * 获取遮罩层HTML
21
+ * @param guid
22
+ * @param zIndex z-index
23
+ * @param style
24
+ */
25
+ createMask(guid: string, zIndex: number = 101, style = ""): string {
26
+ zIndex = zIndex - 100;
27
+ if (style.startsWith(";")) {
28
+ style = style.replace(";", "");
29
+ }
30
+ return /*html*/ `<div class="pops-mask" data-guid="${guid}" style="z-index:${zIndex};${style}"></div>`;
31
+ },
32
+ /**
33
+ * 获取动画层HTML
34
+ * @param guid
35
+ * @param type
36
+ * @param config
37
+ * @param html
38
+ * @param bottomBtnHTML
39
+ * @param zIndex
40
+ */
41
+ createAnim(
42
+ guid: string,
43
+ type: PopsSupportAnimDetailsType,
44
+ config: PopsSupportAnimDetails[keyof PopsSupportAnimDetails],
45
+ html = "",
46
+ bottomBtnHTML = "",
47
+ zIndex: number
48
+ ) {
49
+ const __config = config as PopsAlertDetails;
50
+ let popsAnimStyle = "";
51
+ let popsStyle = "";
52
+ const popsPosition = __config.position || "";
53
+ if (config.zIndex != null) {
54
+ popsAnimStyle += `z-index: ${zIndex};`;
55
+ popsStyle += `z-index: ${zIndex};`;
56
+ }
57
+ if (__config.width != null) {
58
+ popsStyle += `width: ${__config.width};`;
59
+ }
60
+ if (__config.height != null) {
61
+ popsStyle += `height: ${__config.height};`;
62
+ }
63
+ const hasBottomBtn = bottomBtnHTML.trim() === "" ? false : true;
64
+ return /*html*/ `
65
+ <div class="pops-anim" anim="${__config.animation || ""}" style="${popsAnimStyle}" data-guid="${guid}">${
66
+ config.style != null ? `<style tyle="text/css">${config.style}</style>` : ""
67
+ }
68
+ <div class="pops ${
69
+ config.class || ""
70
+ }" data-bottom-btn="${hasBottomBtn}" type-value="${type}" style="${popsStyle}" position="${popsPosition}" data-guid="${guid}">${html}</div>
71
+ </div>`;
72
+ },
73
+ /**
74
+ * 获取顶部按钮层HTML
75
+ * @param type
76
+ * @param config
77
+ */
78
+ createHeader(
79
+ type: PopsSupportHeaderTitleDetailsType,
80
+ config: PopsSupportHeaderTitleDetails[keyof PopsSupportHeaderTitleDetails]
81
+ ): string {
82
+ if (!config.btn) {
83
+ return "";
84
+ }
85
+ const confirm_config = config as PopsConfirmDetails;
86
+ if (type !== "iframe" && !confirm_config.btn?.close?.enable) {
87
+ return "";
88
+ }
89
+ let resultHTML = "";
90
+ // let btnStyle = "";
91
+ let closeHTML = "";
92
+ const iframe_config = config as PopsIframeDetails;
93
+ if (type === "iframe" && iframe_config.topRightButton?.trim() !== "") {
94
+ /* iframe的 */
95
+ let topRightButtonHTML = "";
96
+ iframe_config.topRightButton.split("|").forEach((item: string) => {
97
+ // 最小化、最大化、窗口化、关闭按钮
98
+ item = item.toLowerCase();
99
+ topRightButtonHTML += /*html*/ `
100
+ <button class="pops-header-control" type="button" data-type="${item}">
101
+ <i class="pops-icon">${PopsIcon.getIcon(item)}</i>
102
+ </button>`;
103
+ });
104
+ resultHTML = /*html*/ `
105
+ <div class="pops-header-controls" data-margin>${topRightButtonHTML}</div>`;
106
+ } else {
107
+ if (confirm_config.btn?.close?.enable) {
108
+ // 关闭按钮
109
+ closeHTML = /*html*/ `
110
+ <div class="pops-header-controls">
111
+ <button class="pops-header-control" type="button" data-type="close" data-header>
112
+ <i class="pops-icon">${PopsIcon.getIcon("close")}</i>
113
+ </button>
114
+ </div>`;
115
+ }
116
+ resultHTML = closeHTML;
117
+ }
118
+
119
+ return resultHTML;
120
+ },
121
+ /**
122
+ * 获取标题style
123
+ * @param type 弹窗类型
124
+ * @param config 弹窗配置
125
+ */
126
+ createHeaderStyle(
127
+ type: PopsSupportHeaderTitleDetailsType,
128
+ config: PopsSupportHeaderTitleDetails[keyof PopsSupportHeaderTitleDetails]
129
+ ) {
130
+ return {
131
+ headerStyle: config?.title?.html ? config?.title?.style || "" : "",
132
+ headerPStyle: config?.title?.html ? "" : config?.title?.style || "",
133
+ };
134
+ },
135
+ /**
136
+ * 获取底部按钮层HTML
137
+ * @param type
138
+ * @param config
139
+ */
140
+ createBottom(
141
+ type: PopsSupportBottomBtnDetailsType,
142
+ config: Omit<PopsSupportBottomBtnDetails[keyof PopsSupportBottomBtnDetails], "content">
143
+ ): string {
144
+ if (config.btn == null) {
145
+ // 未设置btn参数
146
+ return "";
147
+ }
148
+ const confirm_config = config as Required<PopsConfirmDetails>;
149
+ if (!(config.btn?.ok?.enable || confirm_config.btn?.cancel?.enable || confirm_config.btn?.other?.enable)) {
150
+ // 确定、取消、其它按钮都未启用直接返回
151
+ return "";
152
+ }
153
+ let btnStyle = "";
154
+ let resultHTML = "";
155
+ let okHTML = "";
156
+ let cancelHTML = "";
157
+ let ohterHTML = "";
158
+
159
+ if (config.btn.position) {
160
+ btnStyle += `justify-content: ${config.btn.position};`;
161
+ }
162
+
163
+ if (confirm_config.btn.reverse) {
164
+ btnStyle += "flex-direction: row-reverse;";
165
+ }
166
+ if (config.btn?.ok?.enable) {
167
+ /* 处理确定按钮的尺寸问题 */
168
+ let okButtonSizeClassName = "";
169
+ if (config.btn.ok.size === "large") {
170
+ okButtonSizeClassName = "pops-button-" + config.btn.ok.size;
171
+ } else if (config.btn.ok.size === "small") {
172
+ okButtonSizeClassName = "pops-button-" + config.btn.ok.size;
173
+ }
174
+ let okIconHTML = "";
175
+ const okIcon = confirm_config.btn.ok!.icon! as PopsIconType | string;
176
+ if (okIcon !== "") {
177
+ // 判断图标是否是svg库内的
178
+ let iconHTML = "";
179
+ if (PopsIcon.hasIcon(okIcon)) {
180
+ iconHTML = PopsIcon.getIcon(okIcon)!;
181
+ } else {
182
+ iconHTML = okIcon;
183
+ }
184
+ iconHTML = iconHTML || "";
185
+ okIconHTML = /*html*/ `<i class="pops-bottom-icon" is-loading="${config.btn.ok.iconIsLoading}">${iconHTML}</i>`;
186
+ }
187
+ okHTML = /*html*/ `
188
+ <button
189
+ class="pops-${type}-btn-ok ${okButtonSizeClassName}"
190
+ type="button"
191
+ data-type="${confirm_config.btn.ok?.type}"
192
+ data-has-icon="${(confirm_config.btn.ok!.icon || "") !== ""}"
193
+ data-rightIcon="${confirm_config.btn.ok?.rightIcon}"
194
+ >${okIconHTML}<span>${config.btn.ok.text}</span>
195
+ </button>`;
196
+ }
197
+
198
+ if (confirm_config.btn?.cancel?.enable) {
199
+ /* 处理取消按钮的尺寸问题 */
200
+ let cancelButtonSizeClassName = "";
201
+
202
+ if (confirm_config.btn.cancel.size === "large") {
203
+ cancelButtonSizeClassName = "pops-button-" + confirm_config.btn.cancel.size;
204
+ } else if (confirm_config.btn.cancel.size === "small") {
205
+ cancelButtonSizeClassName = "pops-button-" + confirm_config.btn.cancel.size;
206
+ }
207
+ let cancelIconHTML = "";
208
+ const cancelIcon = confirm_config.btn.cancel!.icon as PopsIconType | string;
209
+ if (cancelIcon !== "") {
210
+ let iconHTML = "";
211
+ // 判断图标是否是svg库内的
212
+ if (PopsIcon.hasIcon(cancelIcon)) {
213
+ iconHTML = PopsIcon.getIcon(cancelIcon)!;
214
+ } else {
215
+ iconHTML = cancelIcon;
216
+ }
217
+ iconHTML = iconHTML || "";
218
+ cancelIconHTML = /*html*/ `<i class="pops-bottom-icon" is-loading="${confirm_config.btn.cancel.iconIsLoading}">${iconHTML}</i>`;
219
+ }
220
+ cancelHTML = /*html*/ `
221
+ <button
222
+ class="pops-${type}-btn-cancel ${cancelButtonSizeClassName}"
223
+ type="button"
224
+ data-type="${confirm_config.btn.cancel.type}"
225
+ data-has-icon="${(confirm_config.btn.cancel.icon || "") !== ""}"
226
+ data-rightIcon="${confirm_config.btn.cancel.rightIcon}"
227
+ >${cancelIconHTML}<span>${confirm_config.btn.cancel.text}</span>
228
+ </button>`;
229
+ }
230
+
231
+ if (confirm_config.btn?.other?.enable) {
232
+ /* 处理其它按钮的尺寸问题 */
233
+ let otherButtonSizeClassName = "";
234
+
235
+ if (confirm_config.btn.other.size === "large") {
236
+ otherButtonSizeClassName = "pops-button-" + confirm_config.btn.other.size;
237
+ } else if (confirm_config.btn.other.size === "small") {
238
+ otherButtonSizeClassName = "pops-button-" + confirm_config.btn.other.size;
239
+ }
240
+ let otherIconHTML = "";
241
+ const otherIcon = confirm_config.btn.other!.icon as PopsIconType | string;
242
+ if (otherIcon !== "") {
243
+ let iconHTML = "";
244
+ // 判断图标是否是svg库内的
245
+ if (PopsIcon.hasIcon(otherIcon)) {
246
+ iconHTML = PopsIcon.getIcon(otherIcon)!;
247
+ } else {
248
+ otherIcon;
249
+ }
250
+ iconHTML = iconHTML || "";
251
+ otherIconHTML = /*html*/ `<i class="pops-bottom-icon" is-loading="${confirm_config.btn.other.iconIsLoading}">${iconHTML}</i>`;
252
+ }
253
+ ohterHTML = /*html*/ `
254
+ <button
255
+ class="pops-${type}-btn-other ${otherButtonSizeClassName}"
256
+ type="button"
257
+ data-type="${confirm_config.btn.other.type}"
258
+ data-has-icon="${(confirm_config.btn.other.icon || "") !== ""}"
259
+ data-rightIcon="${confirm_config.btn.other.rightIcon}"
260
+ >${otherIconHTML}<span>${confirm_config.btn.other.text}</span>
261
+ </button>`;
262
+ }
263
+
264
+ if (confirm_config.btn.merge) {
265
+ let flexStyle = "display: flex;";
266
+ if (confirm_config.btn.mergeReverse) {
267
+ flexStyle += "flex-direction: row-reverse;";
268
+ } else {
269
+ flexStyle += "flex-direction: row;";
270
+ }
271
+ resultHTML = /*html*/ `
272
+ <div class="pops-botttom-btn-controls pops-${type}-btn" style="${btnStyle}">${ohterHTML}<div
273
+ class="pops-${type}-btn-merge"
274
+ style="${flexStyle}">${okHTML}${cancelHTML}</div>
275
+ </div>
276
+ `;
277
+ } else {
278
+ resultHTML = /*html*/ `<div class="pops-botttom-btn-controls pops-${type}-btn" style="${btnStyle}">${okHTML}${cancelHTML}${ohterHTML}</div>`;
279
+ }
280
+ return resultHTML;
281
+ },
282
+ /**
283
+ * 获取内容style
284
+ * @param type 弹窗类型
285
+ * @param config 弹窗配置
286
+ */
287
+ createContentStyle(
288
+ type: PopsSupportContentDetailsType,
289
+ config: PopsSupportContentDetails[keyof PopsSupportContentDetails]
290
+ ) {
291
+ return {
292
+ contentStyle: (config?.content as any)?.html ? config?.content?.style || "" : "",
293
+
294
+ contentPStyle: (config?.content as any)?.html ? "" : config?.content?.style || "",
295
+ };
296
+ },
297
+ /**
298
+ * 将html转换成元素
299
+ * @param html
300
+ */
301
+ parseElement<T extends HTMLElement>(html: string): T {
302
+ return popsDOMUtils.parseTextToDOM(html);
303
+ },
304
+ };