@whitesev/pops 2.0.2 → 2.0.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.
- package/dist/index.amd.js +217 -328
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +217 -328
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +217 -328
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +217 -328
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +217 -328
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +217 -328
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +3 -3
- package/dist/types/src/components/searchSuggestion/indexType.d.ts +1 -1
- package/dist/types/src/handler/PopsElementHandler.d.ts +4 -4
- package/dist/types/src/types/event.d.ts +3 -3
- package/dist/types/src/types/mask.d.ts +1 -1
- package/dist/types/src/utils/PopsInstanceUtils.d.ts +3 -3
- package/package.json +1 -1
- package/src/Pops.ts +1 -1
- package/src/components/alert/index.ts +13 -20
- package/src/components/confirm/index.ts +10 -20
- package/src/components/drawer/index.ts +11 -26
- package/src/components/folder/index.ts +11 -20
- package/src/components/iframe/index.ts +14 -23
- package/src/components/loading/index.ts +10 -9
- package/src/components/panel/PanelHandleContentDetails.ts +14 -36
- package/src/components/panel/index.ts +7 -11
- package/src/components/prompt/index.ts +16 -23
- package/src/components/rightClickMenu/index.ts +9 -7
- package/src/components/searchSuggestion/index.ts +8 -13
- package/src/components/searchSuggestion/indexType.ts +1 -1
- package/src/handler/PopsElementHandler.ts +33 -72
- package/src/handler/PopsHandler.ts +9 -11
- package/src/types/event.d.ts +3 -3
- package/src/types/mask.d.ts +1 -1
- package/src/utils/PopsDOMUtils.ts +21 -19
- package/src/utils/PopsInstanceUtils.ts +120 -96
|
@@ -2,10 +2,10 @@ import { PopsHandler } from "../../handler/PopsHandler";
|
|
|
2
2
|
import { pops } from "../../Pops";
|
|
3
3
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
4
4
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
5
|
-
import type { PopsSearchSuggestionDetails } from "./indexType";
|
|
6
5
|
import { searchSuggestionConfig as PopsSearchSuggestionConfig } from "./config";
|
|
7
6
|
import { GlobalConfig } from "../../GlobalConfig";
|
|
8
7
|
import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
|
|
8
|
+
import type { PopsSearchSuggestionDetails } from "./indexType";
|
|
9
9
|
|
|
10
10
|
export class PopsSearchSuggestion {
|
|
11
11
|
constructor(details: PopsSearchSuggestionDetails) {
|
|
@@ -105,9 +105,9 @@ export class PopsSearchSuggestion {
|
|
|
105
105
|
<style data-dynamic="true">
|
|
106
106
|
${this.getDynamicCSS()}
|
|
107
107
|
</style>
|
|
108
|
-
<ul class="pops-${PopsType}-search-suggestion-hint"
|
|
109
|
-
|
|
110
|
-
</ul>
|
|
108
|
+
<ul class="pops-${PopsType}-search-suggestion-hint">${
|
|
109
|
+
config.toSearhNotResultHTML
|
|
110
|
+
}</ul>
|
|
111
111
|
`,
|
|
112
112
|
},
|
|
113
113
|
{
|
|
@@ -188,14 +188,9 @@ export class PopsSearchSuggestion {
|
|
|
188
188
|
className: `pops-${PopsType}-search-suggestion-hint-item pops-flex-items-center pops-flex-y-center`,
|
|
189
189
|
"data-index": index,
|
|
190
190
|
"data-value": SearchSuggestion.getItemDataValue(data),
|
|
191
|
-
innerHTML:
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
config.deleteIcon.enable
|
|
195
|
-
? SearchSuggestion.getDeleteIconHTML()
|
|
196
|
-
: ""
|
|
197
|
-
}
|
|
198
|
-
`,
|
|
191
|
+
innerHTML: `${config.getItemHTML(data)}${
|
|
192
|
+
config.deleteIcon.enable ? SearchSuggestion.getDeleteIconHTML() : ""
|
|
193
|
+
}`,
|
|
199
194
|
});
|
|
200
195
|
},
|
|
201
196
|
/**
|
|
@@ -514,7 +509,7 @@ export class PopsSearchSuggestion {
|
|
|
514
509
|
*/
|
|
515
510
|
removePromptsInSearch() {
|
|
516
511
|
SearchSuggestion.$el.$hintULContainer
|
|
517
|
-
.querySelector(
|
|
512
|
+
.querySelector<HTMLLIElement>(
|
|
518
513
|
`li.pops-${PopsType}-search-suggestion-hint-searching-item`
|
|
519
514
|
)
|
|
520
515
|
?.remove();
|
|
@@ -27,7 +27,7 @@ export const PopsElementHandler = {
|
|
|
27
27
|
if (style.startsWith(";")) {
|
|
28
28
|
style = style.replace(";", "");
|
|
29
29
|
}
|
|
30
|
-
return `<div class="pops-mask" data-guid="${guid}" style="z-index:${zIndex};${style}"></div>`;
|
|
30
|
+
return /*html*/ `<div class="pops-mask" data-guid="${guid}" style="z-index:${zIndex};${style}"></div>`;
|
|
31
31
|
},
|
|
32
32
|
/**
|
|
33
33
|
* 获取动画层HTML
|
|
@@ -62,25 +62,16 @@ export const PopsElementHandler = {
|
|
|
62
62
|
}
|
|
63
63
|
let hasBottomBtn = bottomBtnHTML.trim() === "" ? false : true;
|
|
64
64
|
return /*html*/ `
|
|
65
|
-
<div
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
style
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
<div
|
|
76
|
-
class="pops ${config.class || ""}"
|
|
77
|
-
data-bottom-btn="${hasBottomBtn}"
|
|
78
|
-
type-value="${type}"
|
|
79
|
-
style="${popsStyle}"
|
|
80
|
-
position="${popsPosition}"
|
|
81
|
-
data-guid="${guid}">
|
|
82
|
-
${html}
|
|
83
|
-
</div>
|
|
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>
|
|
84
75
|
</div>`;
|
|
85
76
|
},
|
|
86
77
|
/**
|
|
@@ -108,23 +99,21 @@ export const PopsElementHandler = {
|
|
|
108
99
|
let topRightButtonHTML = "";
|
|
109
100
|
__config_iframe.topRightButton.split("|").forEach((item: string) => {
|
|
110
101
|
item = item.toLowerCase();
|
|
111
|
-
topRightButtonHTML += `
|
|
102
|
+
topRightButtonHTML += /*html*/ `
|
|
112
103
|
<button class="pops-header-control" type="${item}">
|
|
113
104
|
<i class="pops-icon">${
|
|
114
105
|
(pops.config.iconSVG as any)[item]
|
|
115
106
|
}</i>
|
|
116
107
|
</button>`;
|
|
117
108
|
});
|
|
118
|
-
resultHTML = `
|
|
119
|
-
<div class="pops-header-controls" data-margin
|
|
120
|
-
${topRightButtonHTML}
|
|
121
|
-
</div>`;
|
|
109
|
+
resultHTML = /*html*/ `
|
|
110
|
+
<div class="pops-header-controls" data-margin>${topRightButtonHTML}</div>`;
|
|
122
111
|
} else {
|
|
123
112
|
if (__config_confirm.btn?.close?.enable) {
|
|
124
|
-
closeHTML = `
|
|
113
|
+
closeHTML = /*html*/ `
|
|
125
114
|
<div class="pops-header-controls">
|
|
126
115
|
<button class="pops-header-control" type="close" data-header>
|
|
127
|
-
|
|
116
|
+
<i class="pops-icon">${pops.config.iconSVG["close"]}</i>
|
|
128
117
|
</button>
|
|
129
118
|
</div>`;
|
|
130
119
|
}
|
|
@@ -189,20 +178,15 @@ export const PopsElementHandler = {
|
|
|
189
178
|
iconHTML = okIcon;
|
|
190
179
|
}
|
|
191
180
|
iconHTML = iconHTML || "";
|
|
192
|
-
okIconHTML =
|
|
193
|
-
<i class="pops-bottom-icon" is-loading="${config.btn.ok.iconIsLoading}">
|
|
194
|
-
${iconHTML}
|
|
195
|
-
</i>`;
|
|
181
|
+
okIconHTML = /*html*/ `<i class="pops-bottom-icon" is-loading="${config.btn.ok.iconIsLoading}">${iconHTML}</i>`;
|
|
196
182
|
}
|
|
197
|
-
okHTML = `
|
|
183
|
+
okHTML = /*html*/ `
|
|
198
184
|
<button
|
|
199
185
|
class="pops-${type}-btn-ok ${okButtonSizeClassName}"
|
|
200
186
|
type="${__config_confirm.btn.ok?.type}"
|
|
201
187
|
data-has-icon="${(__config_confirm.btn.ok!.icon || "") !== ""}"
|
|
202
188
|
data-rightIcon="${__config_confirm.btn.ok?.rightIcon}"
|
|
203
|
-
>
|
|
204
|
-
${okIconHTML}
|
|
205
|
-
<span>${config.btn.ok.text}</span>
|
|
189
|
+
>${okIconHTML}<span>${config.btn.ok.text}</span>
|
|
206
190
|
</button>`;
|
|
207
191
|
}
|
|
208
192
|
|
|
@@ -228,20 +212,15 @@ export const PopsElementHandler = {
|
|
|
228
212
|
iconHTML = cancelIcon;
|
|
229
213
|
}
|
|
230
214
|
iconHTML = iconHTML || "";
|
|
231
|
-
cancelIconHTML =
|
|
232
|
-
<i class="pops-bottom-icon" is-loading="${__config_confirm.btn.cancel.iconIsLoading}">
|
|
233
|
-
${iconHTML}
|
|
234
|
-
</i>`;
|
|
215
|
+
cancelIconHTML = /*html*/ `<i class="pops-bottom-icon" is-loading="${__config_confirm.btn.cancel.iconIsLoading}">${iconHTML}</i>`;
|
|
235
216
|
}
|
|
236
|
-
cancelHTML = `
|
|
217
|
+
cancelHTML = /*html*/ `
|
|
237
218
|
<button
|
|
238
219
|
class="pops-${type}-btn-cancel ${cancelButtonSizeClassName}"
|
|
239
220
|
type="${__config_confirm.btn.cancel.type}"
|
|
240
221
|
data-has-icon="${(__config_confirm.btn.cancel.icon || "") !== ""}"
|
|
241
222
|
data-rightIcon="${__config_confirm.btn.cancel.rightIcon}"
|
|
242
|
-
>
|
|
243
|
-
${cancelIconHTML}
|
|
244
|
-
<span>${__config_confirm.btn.cancel.text}</span>
|
|
223
|
+
>${cancelIconHTML}<span>${__config_confirm.btn.cancel.text}</span>
|
|
245
224
|
</button>`;
|
|
246
225
|
}
|
|
247
226
|
|
|
@@ -267,20 +246,15 @@ export const PopsElementHandler = {
|
|
|
267
246
|
otherIcon;
|
|
268
247
|
}
|
|
269
248
|
iconHTML = iconHTML || "";
|
|
270
|
-
otherIconHTML =
|
|
271
|
-
<i class="pops-bottom-icon" is-loading="${__config_confirm.btn.other.iconIsLoading}">
|
|
272
|
-
${iconHTML}
|
|
273
|
-
</i>`;
|
|
249
|
+
otherIconHTML = /*html*/ `<i class="pops-bottom-icon" is-loading="${__config_confirm.btn.other.iconIsLoading}">${iconHTML}</i>`;
|
|
274
250
|
}
|
|
275
|
-
ohterHTML = `
|
|
251
|
+
ohterHTML = /*html*/ `
|
|
276
252
|
<button
|
|
277
253
|
class="pops-${type}-btn-other ${otherButtonSizeClassName}"
|
|
278
254
|
type="${__config_confirm.btn.other.type}"
|
|
279
255
|
data-has-icon="${(__config_confirm.btn.other.icon || "") !== ""}"
|
|
280
256
|
data-rightIcon="${__config_confirm.btn.other.rightIcon}"
|
|
281
|
-
>
|
|
282
|
-
${otherIconHTML}
|
|
283
|
-
<span>${__config_confirm.btn.other.text}</span>
|
|
257
|
+
>${otherIconHTML}<span>${__config_confirm.btn.other.text}</span>
|
|
284
258
|
</button>`;
|
|
285
259
|
}
|
|
286
260
|
|
|
@@ -291,34 +265,22 @@ export const PopsElementHandler = {
|
|
|
291
265
|
} else {
|
|
292
266
|
flexStyle += "flex-direction: row;";
|
|
293
267
|
}
|
|
294
|
-
resultHTML = `
|
|
295
|
-
<div class="pops-${type}-btn" style="${btnStyle}"
|
|
296
|
-
${ohterHTML}
|
|
297
|
-
<div
|
|
268
|
+
resultHTML = /*html*/ `
|
|
269
|
+
<div class="pops-${type}-btn" style="${btnStyle}">${ohterHTML}<div
|
|
298
270
|
class="pops-${type}-btn-merge"
|
|
299
|
-
style="${flexStyle}">
|
|
300
|
-
${okHTML}
|
|
301
|
-
${cancelHTML}
|
|
302
|
-
</div>
|
|
271
|
+
style="${flexStyle}">${okHTML}${cancelHTML}</div>
|
|
303
272
|
</div>
|
|
304
273
|
`;
|
|
305
274
|
} else {
|
|
306
|
-
resultHTML =
|
|
307
|
-
<div class="pops-${type}-btn" style="${btnStyle}">
|
|
308
|
-
${okHTML}
|
|
309
|
-
${cancelHTML}
|
|
310
|
-
${ohterHTML}
|
|
311
|
-
</div>
|
|
312
|
-
`;
|
|
275
|
+
resultHTML = /*html*/ `<div class="pops-${type}-btn" style="${btnStyle}">${okHTML}${cancelHTML}${ohterHTML}</div>`;
|
|
313
276
|
}
|
|
314
277
|
return resultHTML;
|
|
315
278
|
},
|
|
316
279
|
/**
|
|
317
280
|
* 获取标题style
|
|
318
|
-
* @param type
|
|
319
|
-
* @param config
|
|
281
|
+
* @param type 弹窗类型
|
|
282
|
+
* @param config 弹窗配置
|
|
320
283
|
*/
|
|
321
|
-
|
|
322
284
|
getHeaderStyle(
|
|
323
285
|
type: PopsTypeSupportHeaderTitle,
|
|
324
286
|
config: PopsSupportHeaderTitle[keyof PopsSupportHeaderTitle]
|
|
@@ -331,10 +293,9 @@ export const PopsElementHandler = {
|
|
|
331
293
|
},
|
|
332
294
|
/**
|
|
333
295
|
* 获取内容style
|
|
334
|
-
* @param type
|
|
335
|
-
* @param config
|
|
296
|
+
* @param type 弹窗类型
|
|
297
|
+
* @param config 弹窗配置
|
|
336
298
|
*/
|
|
337
|
-
|
|
338
299
|
getContentStyle(
|
|
339
300
|
type: PopsTypeSupportContent,
|
|
340
301
|
config: PopsSupportContent[keyof PopsSupportContent]
|
|
@@ -99,9 +99,7 @@ export const PopsHandler = {
|
|
|
99
99
|
animElement: HTMLElement;
|
|
100
100
|
maskHTML: string;
|
|
101
101
|
}
|
|
102
|
-
)
|
|
103
|
-
maskElement: HTMLDivElement;
|
|
104
|
-
} {
|
|
102
|
+
) {
|
|
105
103
|
let result = {
|
|
106
104
|
maskElement: popsUtils.parseTextToDOM<HTMLDivElement>(details.maskHTML),
|
|
107
105
|
};
|
|
@@ -117,7 +115,7 @@ export const PopsHandler = {
|
|
|
117
115
|
function originalRun() {
|
|
118
116
|
if (details.config.mask!.clickEvent!.toClose) {
|
|
119
117
|
/* 关闭 */
|
|
120
|
-
PopsInstanceUtils.close(
|
|
118
|
+
return PopsInstanceUtils.close(
|
|
121
119
|
details.type,
|
|
122
120
|
targetLayer,
|
|
123
121
|
details.guid,
|
|
@@ -126,7 +124,7 @@ export const PopsHandler = {
|
|
|
126
124
|
);
|
|
127
125
|
} else if (details.config.mask!.clickEvent!.toHide) {
|
|
128
126
|
/* 隐藏 */
|
|
129
|
-
PopsInstanceUtils.hide(
|
|
127
|
+
return PopsInstanceUtils.hide(
|
|
130
128
|
details.type,
|
|
131
129
|
targetLayer,
|
|
132
130
|
details.guid,
|
|
@@ -400,7 +398,7 @@ export const PopsHandler = {
|
|
|
400
398
|
mode: mode,
|
|
401
399
|
guid: guid,
|
|
402
400
|
close() {
|
|
403
|
-
PopsInstanceUtils.close(
|
|
401
|
+
return PopsInstanceUtils.close(
|
|
404
402
|
mode,
|
|
405
403
|
pops.config.layer[mode],
|
|
406
404
|
guid,
|
|
@@ -409,7 +407,7 @@ export const PopsHandler = {
|
|
|
409
407
|
);
|
|
410
408
|
},
|
|
411
409
|
hide() {
|
|
412
|
-
PopsInstanceUtils.hide(
|
|
410
|
+
return PopsInstanceUtils.hide(
|
|
413
411
|
mode,
|
|
414
412
|
pops.config.layer[mode],
|
|
415
413
|
guid,
|
|
@@ -419,7 +417,7 @@ export const PopsHandler = {
|
|
|
419
417
|
);
|
|
420
418
|
},
|
|
421
419
|
show() {
|
|
422
|
-
PopsInstanceUtils.show(
|
|
420
|
+
return PopsInstanceUtils.show(
|
|
423
421
|
mode,
|
|
424
422
|
pops.config.layer[mode],
|
|
425
423
|
guid,
|
|
@@ -463,7 +461,7 @@ export const PopsHandler = {
|
|
|
463
461
|
mode: mode,
|
|
464
462
|
guid: guid,
|
|
465
463
|
close() {
|
|
466
|
-
PopsInstanceUtils.close(
|
|
464
|
+
return PopsInstanceUtils.close(
|
|
467
465
|
mode,
|
|
468
466
|
pops.config.layer[mode],
|
|
469
467
|
guid,
|
|
@@ -472,7 +470,7 @@ export const PopsHandler = {
|
|
|
472
470
|
);
|
|
473
471
|
},
|
|
474
472
|
hide() {
|
|
475
|
-
PopsInstanceUtils.hide(
|
|
473
|
+
return PopsInstanceUtils.hide(
|
|
476
474
|
mode,
|
|
477
475
|
pops.config.layer[mode],
|
|
478
476
|
guid,
|
|
@@ -482,7 +480,7 @@ export const PopsHandler = {
|
|
|
482
480
|
);
|
|
483
481
|
},
|
|
484
482
|
show() {
|
|
485
|
-
PopsInstanceUtils.show(
|
|
483
|
+
return PopsInstanceUtils.show(
|
|
486
484
|
mode,
|
|
487
485
|
pops.config.layer[mode],
|
|
488
486
|
guid,
|
package/src/types/event.d.ts
CHANGED
|
@@ -48,9 +48,9 @@ export interface PopsEventDetails {
|
|
|
48
48
|
/** 当前弹窗类型 */
|
|
49
49
|
mode: mode;
|
|
50
50
|
guid: guid;
|
|
51
|
-
close: () => void
|
|
52
|
-
hide: () => void
|
|
53
|
-
show: () => void
|
|
51
|
+
close: () => Promise<void>;
|
|
52
|
+
hide: () => Promise<void>;
|
|
53
|
+
show: () => Promise<void>;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
/**
|
package/src/types/mask.d.ts
CHANGED
|
@@ -1569,32 +1569,34 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
1569
1569
|
if (element == null) {
|
|
1570
1570
|
return;
|
|
1571
1571
|
}
|
|
1572
|
+
let setStyleProperty = (
|
|
1573
|
+
propertyName: string,
|
|
1574
|
+
propertyValue: string | number
|
|
1575
|
+
) => {
|
|
1576
|
+
if (
|
|
1577
|
+
typeof propertyValue === "string" &&
|
|
1578
|
+
propertyValue.trim().endsWith("!important")
|
|
1579
|
+
) {
|
|
1580
|
+
propertyValue = propertyValue
|
|
1581
|
+
.trim()
|
|
1582
|
+
.replace(/!important$/gi, "")
|
|
1583
|
+
.trim();
|
|
1584
|
+
element.style.setProperty(propertyName, propertyValue, "important");
|
|
1585
|
+
} else {
|
|
1586
|
+
propertyValue = handlePixe(propertyName, propertyValue);
|
|
1587
|
+
element.style.setProperty(propertyName, propertyValue);
|
|
1588
|
+
}
|
|
1589
|
+
};
|
|
1572
1590
|
if (typeof property === "string") {
|
|
1573
1591
|
if (value == null) {
|
|
1574
1592
|
return getComputedStyle(element).getPropertyValue(property);
|
|
1575
1593
|
} else {
|
|
1576
|
-
|
|
1577
|
-
element.style.setProperty(property, value, "important");
|
|
1578
|
-
} else {
|
|
1579
|
-
value = handlePixe(property, value);
|
|
1580
|
-
element.style.setProperty(property, value);
|
|
1581
|
-
}
|
|
1594
|
+
setStyleProperty(property, value);
|
|
1582
1595
|
}
|
|
1583
1596
|
} else if (typeof property === "object") {
|
|
1584
1597
|
for (let prop in property) {
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
(property[prop] as string).includes("!important")
|
|
1588
|
-
) {
|
|
1589
|
-
element.style.setProperty(
|
|
1590
|
-
prop,
|
|
1591
|
-
property[prop] as string,
|
|
1592
|
-
"important"
|
|
1593
|
-
);
|
|
1594
|
-
} else {
|
|
1595
|
-
property[prop] = handlePixe(prop, property[prop] as string);
|
|
1596
|
-
element.style.setProperty(prop, property[prop] as string);
|
|
1597
|
-
}
|
|
1598
|
+
let value = property[prop];
|
|
1599
|
+
setStyleProperty(prop, value!);
|
|
1598
1600
|
}
|
|
1599
1601
|
}
|
|
1600
1602
|
}
|