@whitesev/pops 2.2.8 → 2.3.0
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.
- package/dist/index.amd.js +2817 -3012
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +2817 -3012
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +2817 -3012
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +2817 -3012
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +2817 -3012
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +2817 -3012
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +497 -192
- package/dist/types/src/PopsIcon.d.ts +2 -2
- package/dist/types/src/components/panel/index.d.ts +1 -1
- package/dist/types/src/components/rightClickMenu/index.d.ts +487 -182
- package/dist/types/src/components/tooltip/index.d.ts +2 -2
- package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +256 -259
- package/dist/types/src/types/animation.d.ts +19 -19
- package/dist/types/src/types/button.d.ts +187 -196
- package/dist/types/src/types/components.d.ts +213 -229
- package/dist/types/src/types/event.d.ts +63 -63
- package/dist/types/src/types/global.d.ts +20 -20
- package/dist/types/src/types/icon.d.ts +32 -32
- package/dist/types/src/types/inst.d.ts +24 -24
- package/dist/types/src/types/main.d.ts +114 -122
- package/dist/types/src/types/mask.d.ts +49 -49
- package/dist/types/src/types/position.d.ts +60 -60
- package/package.json +13 -8
- package/src/Pops.ts +0 -209
- package/src/PopsAnimation.ts +0 -32
- package/src/PopsCSS.ts +0 -51
- package/src/PopsCore.ts +0 -44
- package/src/PopsIcon.ts +0 -95
- package/src/PopsInst.ts +0 -21
- package/src/components/alert/config.ts +0 -62
- package/src/components/alert/index.css +0 -0
- package/src/components/alert/index.ts +0 -181
- package/src/components/alert/types/index.ts +0 -30
- package/src/components/confirm/config.ts +0 -90
- package/src/components/confirm/index.css +0 -0
- package/src/components/confirm/index.ts +0 -192
- package/src/components/confirm/types/index.ts +0 -17
- package/src/components/drawer/config.ts +0 -89
- package/src/components/drawer/index.css +0 -35
- package/src/components/drawer/index.ts +0 -260
- package/src/components/drawer/types/index.ts +0 -61
- package/src/components/folder/config.ts +0 -147
- package/src/components/folder/folderIcon.ts +0 -28
- package/src/components/folder/index.css +0 -314
- package/src/components/folder/index.ts +0 -1050
- package/src/components/folder/types/index.ts +0 -101
- package/src/components/iframe/config.ts +0 -60
- package/src/components/iframe/index.css +0 -75
- package/src/components/iframe/index.ts +0 -351
- package/src/components/iframe/types/index.ts +0 -146
- package/src/components/loading/config.ts +0 -29
- package/src/components/loading/index.css +0 -66
- package/src/components/loading/index.ts +0 -114
- package/src/components/loading/types/index.ts +0 -40
- package/src/components/panel/config.ts +0 -550
- package/src/components/panel/handlerComponents.ts +0 -3277
- package/src/components/panel/index.css +0 -1292
- package/src/components/panel/index.ts +0 -213
- package/src/components/panel/types/components-button.ts +0 -69
- package/src/components/panel/types/components-common.ts +0 -55
- package/src/components/panel/types/components-deepMenu.ts +0 -85
- package/src/components/panel/types/components-forms.ts +0 -45
- package/src/components/panel/types/components-input.ts +0 -82
- package/src/components/panel/types/components-own.ts +0 -31
- package/src/components/panel/types/components-select.ts +0 -101
- package/src/components/panel/types/components-selectMultiple.ts +0 -133
- package/src/components/panel/types/components-slider.ts +0 -78
- package/src/components/panel/types/components-switch.ts +0 -57
- package/src/components/panel/types/components-textarea.ts +0 -69
- package/src/components/panel/types/index.ts +0 -177
- package/src/components/prompt/config.ts +0 -94
- package/src/components/prompt/index.css +0 -34
- package/src/components/prompt/index.ts +0 -222
- package/src/components/prompt/types/index.ts +0 -55
- package/src/components/rightClickMenu/config.ts +0 -130
- package/src/components/rightClickMenu/index.css +0 -88
- package/src/components/rightClickMenu/index.ts +0 -689
- package/src/components/rightClickMenu/types/index.ts +0 -91
- package/src/components/searchSuggestion/config.ts +0 -59
- package/src/components/searchSuggestion/index.ts +0 -708
- package/src/components/searchSuggestion/types/index.ts +0 -147
- package/src/components/tooltip/config.ts +0 -34
- package/src/components/tooltip/index.css +0 -196
- package/src/components/tooltip/index.ts +0 -655
- package/src/components/tooltip/types/index.ts +0 -125
- package/src/config/CommonCSSClassName.ts +0 -17
- package/src/config/GlobalConfig.ts +0 -80
- package/src/css/animation.css +0 -2245
- package/src/css/button.css +0 -542
- package/src/css/common.css +0 -52
- package/src/css/index.css +0 -254
- package/src/css/ninePalaceGridPosition.css +0 -50
- package/src/css/scrollbar.css +0 -22
- package/src/handler/PopsElementHandler.ts +0 -325
- package/src/handler/PopsHandler.ts +0 -719
- package/src/svg/arrowLeft.svg +0 -4
- package/src/svg/arrowRight.svg +0 -4
- package/src/svg/chromeFilled.svg +0 -14
- package/src/svg/circleClose.svg +0 -8
- package/src/svg/close.svg +0 -5
- package/src/svg/cpu.svg +0 -8
- package/src/svg/delete.svg +0 -5
- package/src/svg/documentCopy.svg +0 -5
- package/src/svg/edit.svg +0 -8
- package/src/svg/eleme.svg +0 -5
- package/src/svg/elemePlus.svg +0 -5
- package/src/svg/headset.svg +0 -5
- package/src/svg/hide.svg +0 -8
- package/src/svg/keyboard.svg +0 -8
- package/src/svg/loading.svg +0 -5
- package/src/svg/max.svg +0 -5
- package/src/svg/min.svg +0 -5
- package/src/svg/mise.svg +0 -5
- package/src/svg/monitor.svg +0 -5
- package/src/svg/next.svg +0 -5
- package/src/svg/picture.svg +0 -8
- package/src/svg/prev.svg +0 -5
- package/src/svg/search.svg +0 -5
- package/src/svg/share.svg +0 -5
- package/src/svg/upload.svg +0 -5
- package/src/svg/videoPause.svg +0 -5
- package/src/svg/videoPlay.svg +0 -5
- package/src/svg/view.svg +0 -5
- package/src/types/PopsDOMUtilsEventType.d.ts +0 -259
- package/src/types/animation.d.ts +0 -19
- package/src/types/button.d.ts +0 -196
- package/src/types/components.d.ts +0 -229
- package/src/types/event.d.ts +0 -63
- package/src/types/global.d.ts +0 -20
- package/src/types/icon.d.ts +0 -32
- package/src/types/inst.d.ts +0 -24
- package/src/types/main.d.ts +0 -122
- package/src/types/mask.d.ts +0 -49
- package/src/types/position.d.ts +0 -60
- package/src/utils/PopsDOMUtils.ts +0 -2649
- package/src/utils/PopsDOMUtilsEventsConfig.ts +0 -6
- package/src/utils/PopsInstanceUtils.ts +0 -801
- package/src/utils/PopsMathUtils.ts +0 -77
- package/src/utils/PopsSafeUtils.ts +0 -24
- package/src/utils/PopsUtils.ts +0 -430
package/src/css/index.css
DELETED
|
@@ -1,254 +0,0 @@
|
|
|
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
|
-
|
|
207
|
-
display: flex;
|
|
208
|
-
align-items: center;
|
|
209
|
-
justify-content: space-between;
|
|
210
|
-
border-bottom: 1px solid var(--pops-title-border-color);
|
|
211
|
-
width: 100%;
|
|
212
|
-
height: var(--container-title-height);
|
|
213
|
-
}
|
|
214
|
-
/* 标题-普通文本 */
|
|
215
|
-
.pops .pops-title p[pops] {
|
|
216
|
-
color: var(--pops-title-color);
|
|
217
|
-
width: 100%;
|
|
218
|
-
overflow: hidden;
|
|
219
|
-
text-indent: 15px;
|
|
220
|
-
text-overflow: ellipsis;
|
|
221
|
-
white-space: nowrap;
|
|
222
|
-
font-weight: 500;
|
|
223
|
-
line-height: normal;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/* 内容 */
|
|
227
|
-
.pops .pops-content {
|
|
228
|
-
width: 100%;
|
|
229
|
-
/*height: calc(
|
|
230
|
-
100% - var(--container-title-height) - var(--container-bottom-btn-height)
|
|
231
|
-
);*/
|
|
232
|
-
flex: 1;
|
|
233
|
-
overflow: auto;
|
|
234
|
-
word-break: break-word;
|
|
235
|
-
}
|
|
236
|
-
/* 内容-普通文本 */
|
|
237
|
-
.pops .pops-content p[pops] {
|
|
238
|
-
color: var(--pops-content-color);
|
|
239
|
-
padding: 5px 10px;
|
|
240
|
-
text-indent: 15px;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/* 底部-按钮组 */
|
|
244
|
-
.pops .pops-botttom-btn-controls {
|
|
245
|
-
display: flex;
|
|
246
|
-
padding: 10px 10px 10px 10px;
|
|
247
|
-
width: 100%;
|
|
248
|
-
height: var(--container-bottom-btn-height);
|
|
249
|
-
max-height: var(--container-bottom-btn-height);
|
|
250
|
-
line-height: normal;
|
|
251
|
-
border-top: 1px solid var(--pops-bottom-btn-controls-border-color);
|
|
252
|
-
text-align: right;
|
|
253
|
-
align-items: center;
|
|
254
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
}
|
package/src/css/scrollbar.css
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,325 +0,0 @@
|
|
|
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
|
-
let __config = config as PopsAlertDetails;
|
|
50
|
-
let popsAnimStyle = "";
|
|
51
|
-
let popsStyle = "";
|
|
52
|
-
let 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
|
-
let hasBottomBtn = bottomBtnHTML.trim() === "" ? false : true;
|
|
64
|
-
return /*html*/ `
|
|
65
|
-
<div class="pops-anim" anim="${
|
|
66
|
-
__config.animation || ""
|
|
67
|
-
}" style="${popsAnimStyle}" data-guid="${guid}">${
|
|
68
|
-
config.style != null
|
|
69
|
-
? `<style tyle="text/css">${config.style}</style>`
|
|
70
|
-
: ""
|
|
71
|
-
}
|
|
72
|
-
<div class="pops ${
|
|
73
|
-
config.class || ""
|
|
74
|
-
}" data-bottom-btn="${hasBottomBtn}" type-value="${type}" style="${popsStyle}" position="${popsPosition}" data-guid="${guid}">${html}</div>
|
|
75
|
-
</div>`;
|
|
76
|
-
},
|
|
77
|
-
/**
|
|
78
|
-
* 获取顶部按钮层HTML
|
|
79
|
-
* @param type
|
|
80
|
-
* @param config
|
|
81
|
-
*/
|
|
82
|
-
createHeader(
|
|
83
|
-
type: PopsSupportHeaderTitleDetailsType,
|
|
84
|
-
config: PopsSupportHeaderTitleDetails[keyof PopsSupportHeaderTitleDetails]
|
|
85
|
-
): string {
|
|
86
|
-
if (!config.btn) {
|
|
87
|
-
return "";
|
|
88
|
-
}
|
|
89
|
-
let confirm_config = config as PopsConfirmDetails;
|
|
90
|
-
if (type !== "iframe" && !confirm_config.btn?.close?.enable) {
|
|
91
|
-
return "";
|
|
92
|
-
}
|
|
93
|
-
let resultHTML = "";
|
|
94
|
-
// let btnStyle = "";
|
|
95
|
-
let closeHTML = "";
|
|
96
|
-
let iframe_config = config as PopsIframeDetails;
|
|
97
|
-
if (type === "iframe" && iframe_config.topRightButton?.trim() !== "") {
|
|
98
|
-
/* iframe的 */
|
|
99
|
-
let topRightButtonHTML = "";
|
|
100
|
-
iframe_config.topRightButton.split("|").forEach((item: string) => {
|
|
101
|
-
// 最小化、最大化、窗口化、关闭按钮
|
|
102
|
-
item = item.toLowerCase();
|
|
103
|
-
topRightButtonHTML += /*html*/ `
|
|
104
|
-
<button class="pops-header-control" type="button" data-type="${item}">
|
|
105
|
-
<i class="pops-icon">${PopsIcon.getIcon(item)}</i>
|
|
106
|
-
</button>`;
|
|
107
|
-
});
|
|
108
|
-
resultHTML = /*html*/ `
|
|
109
|
-
<div class="pops-header-controls" data-margin>${topRightButtonHTML}</div>`;
|
|
110
|
-
} else {
|
|
111
|
-
if (confirm_config.btn?.close?.enable) {
|
|
112
|
-
// 关闭按钮
|
|
113
|
-
closeHTML = /*html*/ `
|
|
114
|
-
<div class="pops-header-controls">
|
|
115
|
-
<button class="pops-header-control" type="button" data-type="close" data-header>
|
|
116
|
-
<i class="pops-icon">${PopsIcon.getIcon("close")}</i>
|
|
117
|
-
</button>
|
|
118
|
-
</div>`;
|
|
119
|
-
}
|
|
120
|
-
resultHTML = closeHTML;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return resultHTML;
|
|
124
|
-
},
|
|
125
|
-
/**
|
|
126
|
-
* 获取标题style
|
|
127
|
-
* @param type 弹窗类型
|
|
128
|
-
* @param config 弹窗配置
|
|
129
|
-
*/
|
|
130
|
-
createHeaderStyle(
|
|
131
|
-
type: PopsSupportHeaderTitleDetailsType,
|
|
132
|
-
config: PopsSupportHeaderTitleDetails[keyof PopsSupportHeaderTitleDetails]
|
|
133
|
-
) {
|
|
134
|
-
return {
|
|
135
|
-
headerStyle: config?.title?.html ? config?.title?.style || "" : "",
|
|
136
|
-
headerPStyle: config?.title?.html ? "" : config?.title?.style || "",
|
|
137
|
-
};
|
|
138
|
-
},
|
|
139
|
-
/**
|
|
140
|
-
* 获取底部按钮层HTML
|
|
141
|
-
* @param type
|
|
142
|
-
* @param config
|
|
143
|
-
*/
|
|
144
|
-
createBottom(
|
|
145
|
-
type: PopsSupportBottomBtnDetailsType,
|
|
146
|
-
config: Omit<
|
|
147
|
-
PopsSupportBottomBtnDetails[keyof PopsSupportBottomBtnDetails],
|
|
148
|
-
"content"
|
|
149
|
-
>
|
|
150
|
-
): string {
|
|
151
|
-
if (config.btn == null) {
|
|
152
|
-
// 未设置btn参数
|
|
153
|
-
return "";
|
|
154
|
-
}
|
|
155
|
-
let confirm_config = config as Required<PopsConfirmDetails>;
|
|
156
|
-
if (
|
|
157
|
-
!(
|
|
158
|
-
config.btn?.ok?.enable ||
|
|
159
|
-
confirm_config.btn?.cancel?.enable ||
|
|
160
|
-
confirm_config.btn?.other?.enable
|
|
161
|
-
)
|
|
162
|
-
) {
|
|
163
|
-
// 确定、取消、其它按钮都未启用直接返回
|
|
164
|
-
return "";
|
|
165
|
-
}
|
|
166
|
-
let btnStyle = "";
|
|
167
|
-
let resultHTML = "";
|
|
168
|
-
let okHTML = "";
|
|
169
|
-
let cancelHTML = "";
|
|
170
|
-
let ohterHTML = "";
|
|
171
|
-
|
|
172
|
-
if (config.btn.position) {
|
|
173
|
-
btnStyle += `justify-content: ${config.btn.position};`;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
if (confirm_config.btn.reverse) {
|
|
177
|
-
btnStyle += "flex-direction: row-reverse;";
|
|
178
|
-
}
|
|
179
|
-
if (config.btn?.ok?.enable) {
|
|
180
|
-
/* 处理确定按钮的尺寸问题 */
|
|
181
|
-
let okButtonSizeClassName = "";
|
|
182
|
-
if (config.btn.ok.size === "large") {
|
|
183
|
-
okButtonSizeClassName = "pops-button-" + config.btn.ok.size;
|
|
184
|
-
} else if (config.btn.ok.size === "small") {
|
|
185
|
-
okButtonSizeClassName = "pops-button-" + config.btn.ok.size;
|
|
186
|
-
}
|
|
187
|
-
let okIconHTML = "";
|
|
188
|
-
let okIcon = confirm_config.btn.ok!.icon! as PopsIconType | string;
|
|
189
|
-
if (okIcon !== "") {
|
|
190
|
-
// 判断图标是否是svg库内的
|
|
191
|
-
let iconHTML = "";
|
|
192
|
-
if (PopsIcon.hasIcon(okIcon)) {
|
|
193
|
-
iconHTML = PopsIcon.getIcon(okIcon)!;
|
|
194
|
-
} else {
|
|
195
|
-
iconHTML = okIcon;
|
|
196
|
-
}
|
|
197
|
-
iconHTML = iconHTML || "";
|
|
198
|
-
okIconHTML = /*html*/ `<i class="pops-bottom-icon" is-loading="${config.btn.ok.iconIsLoading}">${iconHTML}</i>`;
|
|
199
|
-
}
|
|
200
|
-
okHTML = /*html*/ `
|
|
201
|
-
<button
|
|
202
|
-
class="pops-${type}-btn-ok ${okButtonSizeClassName}"
|
|
203
|
-
type="button"
|
|
204
|
-
data-type="${confirm_config.btn.ok?.type}"
|
|
205
|
-
data-has-icon="${(confirm_config.btn.ok!.icon || "") !== ""}"
|
|
206
|
-
data-rightIcon="${confirm_config.btn.ok?.rightIcon}"
|
|
207
|
-
>${okIconHTML}<span>${config.btn.ok.text}</span>
|
|
208
|
-
</button>`;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
if (confirm_config.btn?.cancel?.enable) {
|
|
212
|
-
/* 处理取消按钮的尺寸问题 */
|
|
213
|
-
let cancelButtonSizeClassName = "";
|
|
214
|
-
|
|
215
|
-
if (confirm_config.btn.cancel.size === "large") {
|
|
216
|
-
cancelButtonSizeClassName =
|
|
217
|
-
"pops-button-" + confirm_config.btn.cancel.size;
|
|
218
|
-
} else if (confirm_config.btn.cancel.size === "small") {
|
|
219
|
-
cancelButtonSizeClassName =
|
|
220
|
-
"pops-button-" + confirm_config.btn.cancel.size;
|
|
221
|
-
}
|
|
222
|
-
let cancelIconHTML = "";
|
|
223
|
-
let cancelIcon = confirm_config.btn.cancel!.icon as PopsIconType | string;
|
|
224
|
-
if (cancelIcon !== "") {
|
|
225
|
-
let iconHTML = "";
|
|
226
|
-
// 判断图标是否是svg库内的
|
|
227
|
-
if (PopsIcon.hasIcon(cancelIcon)) {
|
|
228
|
-
iconHTML = PopsIcon.getIcon(cancelIcon)!;
|
|
229
|
-
} else {
|
|
230
|
-
iconHTML = cancelIcon;
|
|
231
|
-
}
|
|
232
|
-
iconHTML = iconHTML || "";
|
|
233
|
-
cancelIconHTML = /*html*/ `<i class="pops-bottom-icon" is-loading="${confirm_config.btn.cancel.iconIsLoading}">${iconHTML}</i>`;
|
|
234
|
-
}
|
|
235
|
-
cancelHTML = /*html*/ `
|
|
236
|
-
<button
|
|
237
|
-
class="pops-${type}-btn-cancel ${cancelButtonSizeClassName}"
|
|
238
|
-
type="button"
|
|
239
|
-
data-type="${confirm_config.btn.cancel.type}"
|
|
240
|
-
data-has-icon="${(confirm_config.btn.cancel.icon || "") !== ""}"
|
|
241
|
-
data-rightIcon="${confirm_config.btn.cancel.rightIcon}"
|
|
242
|
-
>${cancelIconHTML}<span>${confirm_config.btn.cancel.text}</span>
|
|
243
|
-
</button>`;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
if (confirm_config.btn?.other?.enable) {
|
|
247
|
-
/* 处理其它按钮的尺寸问题 */
|
|
248
|
-
let otherButtonSizeClassName = "";
|
|
249
|
-
|
|
250
|
-
if (confirm_config.btn.other.size === "large") {
|
|
251
|
-
otherButtonSizeClassName =
|
|
252
|
-
"pops-button-" + confirm_config.btn.other.size;
|
|
253
|
-
} else if (confirm_config.btn.other.size === "small") {
|
|
254
|
-
otherButtonSizeClassName =
|
|
255
|
-
"pops-button-" + confirm_config.btn.other.size;
|
|
256
|
-
}
|
|
257
|
-
let otherIconHTML = "";
|
|
258
|
-
let otherIcon = confirm_config.btn.other!.icon as PopsIconType | string;
|
|
259
|
-
if (otherIcon !== "") {
|
|
260
|
-
let iconHTML = "";
|
|
261
|
-
// 判断图标是否是svg库内的
|
|
262
|
-
if (PopsIcon.hasIcon(otherIcon)) {
|
|
263
|
-
iconHTML = PopsIcon.getIcon(otherIcon)!;
|
|
264
|
-
} else {
|
|
265
|
-
otherIcon;
|
|
266
|
-
}
|
|
267
|
-
iconHTML = iconHTML || "";
|
|
268
|
-
otherIconHTML = /*html*/ `<i class="pops-bottom-icon" is-loading="${confirm_config.btn.other.iconIsLoading}">${iconHTML}</i>`;
|
|
269
|
-
}
|
|
270
|
-
ohterHTML = /*html*/ `
|
|
271
|
-
<button
|
|
272
|
-
class="pops-${type}-btn-other ${otherButtonSizeClassName}"
|
|
273
|
-
type="button"
|
|
274
|
-
data-type="${confirm_config.btn.other.type}"
|
|
275
|
-
data-has-icon="${(confirm_config.btn.other.icon || "") !== ""}"
|
|
276
|
-
data-rightIcon="${confirm_config.btn.other.rightIcon}"
|
|
277
|
-
>${otherIconHTML}<span>${confirm_config.btn.other.text}</span>
|
|
278
|
-
</button>`;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
if (confirm_config.btn.merge) {
|
|
282
|
-
let flexStyle = "display: flex;";
|
|
283
|
-
if (confirm_config.btn.mergeReverse) {
|
|
284
|
-
flexStyle += "flex-direction: row-reverse;";
|
|
285
|
-
} else {
|
|
286
|
-
flexStyle += "flex-direction: row;";
|
|
287
|
-
}
|
|
288
|
-
resultHTML = /*html*/ `
|
|
289
|
-
<div class="pops-botttom-btn-controls pops-${type}-btn" style="${btnStyle}">${ohterHTML}<div
|
|
290
|
-
class="pops-${type}-btn-merge"
|
|
291
|
-
style="${flexStyle}">${okHTML}${cancelHTML}</div>
|
|
292
|
-
</div>
|
|
293
|
-
`;
|
|
294
|
-
} else {
|
|
295
|
-
resultHTML = /*html*/ `<div class="pops-botttom-btn-controls pops-${type}-btn" style="${btnStyle}">${okHTML}${cancelHTML}${ohterHTML}</div>`;
|
|
296
|
-
}
|
|
297
|
-
return resultHTML;
|
|
298
|
-
},
|
|
299
|
-
/**
|
|
300
|
-
* 获取内容style
|
|
301
|
-
* @param type 弹窗类型
|
|
302
|
-
* @param config 弹窗配置
|
|
303
|
-
*/
|
|
304
|
-
createContentStyle(
|
|
305
|
-
type: PopsSupportContentDetailsType,
|
|
306
|
-
config: PopsSupportContentDetails[keyof PopsSupportContentDetails]
|
|
307
|
-
) {
|
|
308
|
-
return {
|
|
309
|
-
contentStyle: (config?.content as any)?.html
|
|
310
|
-
? config?.content?.style || ""
|
|
311
|
-
: "",
|
|
312
|
-
|
|
313
|
-
contentPStyle: (config?.content as any)?.html
|
|
314
|
-
? ""
|
|
315
|
-
: config?.content?.style || "",
|
|
316
|
-
};
|
|
317
|
-
},
|
|
318
|
-
/**
|
|
319
|
-
* 将html转换成元素
|
|
320
|
-
* @param html
|
|
321
|
-
*/
|
|
322
|
-
parseElement<T extends HTMLElement>(html: string): T {
|
|
323
|
-
return popsDOMUtils.parseTextToDOM(html);
|
|
324
|
-
},
|
|
325
|
-
};
|