@whitesev/pops 2.2.0 → 2.2.2
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 +364 -357
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +364 -357
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +364 -357
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +364 -357
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +364 -357
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +364 -357
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +17 -17
- package/dist/types/src/PopsInst.d.ts +8 -0
- package/dist/types/src/components/panel/index.d.ts +2 -1
- package/dist/types/src/components/searchSuggestion/index.d.ts +1 -1
- package/dist/types/src/handler/PopsElementHandler.d.ts +6 -6
- package/dist/types/src/handler/PopsHandler.d.ts +6 -6
- package/dist/types/src/types/button.d.ts +2 -2
- package/dist/types/src/types/components.d.ts +5 -5
- package/dist/types/src/types/event.d.ts +3 -3
- package/dist/types/src/types/{layer.d.ts → inst.d.ts} +7 -5
- package/dist/types/src/types/main.d.ts +36 -58
- package/dist/types/src/utils/PopsInstanceUtils.d.ts +10 -10
- package/package.json +1 -1
- package/src/Pops.ts +2 -2
- package/src/PopsInst.ts +21 -0
- package/src/components/alert/index.ts +16 -16
- package/src/components/confirm/index.ts +16 -15
- package/src/components/drawer/index.ts +16 -15
- package/src/components/folder/index.ts +141 -152
- package/src/components/iframe/index.ts +16 -15
- package/src/components/panel/index.ts +19 -18
- package/src/components/prompt/index.ts +15 -14
- package/src/components/rightClickMenu/index.ts +19 -18
- package/src/components/searchSuggestion/index.ts +21 -20
- package/src/components/tooltip/index.ts +3 -2
- package/src/css/scrollbar.css +9 -5
- package/src/handler/PopsElementHandler.ts +18 -18
- package/src/handler/PopsHandler.ts +38 -32
- package/src/types/button.d.ts +2 -2
- package/src/types/components.d.ts +5 -5
- package/src/types/event.d.ts +3 -3
- package/src/types/{layer.d.ts → inst.d.ts} +7 -5
- package/src/types/main.d.ts +36 -58
- package/src/utils/PopsInstanceUtils.ts +84 -81
- package/dist/types/src/PopsLayer.d.ts +0 -5
- package/src/PopsLayer.ts +0 -18
|
@@ -8,12 +8,13 @@ import { PopsPanelConfig } from "./config";
|
|
|
8
8
|
import { PanelHandlerComponents } from "./handlerComponents";
|
|
9
9
|
import { GlobalConfig } from "../../GlobalConfig";
|
|
10
10
|
import { PopsCSS } from "../../PopsCSS";
|
|
11
|
+
import type { PopsType } from "../../types/main";
|
|
11
12
|
|
|
12
13
|
export const PopsPanel = {
|
|
13
14
|
init(details: PopsPanelDetails) {
|
|
14
15
|
const guid = popsUtils.getRandomGUID();
|
|
15
16
|
// 设置当前类型
|
|
16
|
-
const PopsType = "panel";
|
|
17
|
+
const popsType: PopsType = "panel";
|
|
17
18
|
|
|
18
19
|
let config: Required<PopsPanelDetails> = PopsPanelConfig();
|
|
19
20
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
@@ -21,7 +22,7 @@ export const PopsPanel = {
|
|
|
21
22
|
if (details && Array.isArray(details.content)) {
|
|
22
23
|
config.content = details.content;
|
|
23
24
|
}
|
|
24
|
-
config = PopsHandler.handleOnly(
|
|
25
|
+
config = PopsHandler.handleOnly(popsType, config);
|
|
25
26
|
|
|
26
27
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
27
28
|
PopsHandler.handleInit($shadowRoot, [
|
|
@@ -59,32 +60,32 @@ export const PopsPanel = {
|
|
|
59
60
|
let zIndex = PopsHandler.handleZIndex(config.zIndex);
|
|
60
61
|
let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
|
|
61
62
|
|
|
62
|
-
let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(
|
|
63
|
+
let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(popsType, config);
|
|
63
64
|
let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(
|
|
64
|
-
|
|
65
|
+
popsType,
|
|
65
66
|
config
|
|
66
67
|
);
|
|
67
68
|
|
|
68
69
|
let animHTML = PopsElementHandler.getAnimHTML(
|
|
69
70
|
guid,
|
|
70
|
-
|
|
71
|
+
popsType,
|
|
71
72
|
config,
|
|
72
73
|
/*html*/ `
|
|
73
|
-
<div class="pops-title pops-${
|
|
74
|
+
<div class="pops-title pops-${popsType}-title" style="text-align: ${
|
|
74
75
|
config.title.position
|
|
75
76
|
};${headerStyle}">${
|
|
76
77
|
config.title.html
|
|
77
78
|
? config.title.text
|
|
78
|
-
: `<p pops class="pops-${
|
|
79
|
+
: `<p pops class="pops-${popsType}-title-text" class="pops-${popsType}-title-text" style="${headerPStyle}">${config.title.text}</p>`
|
|
79
80
|
}${headerBtnHTML}</div>
|
|
80
|
-
<div class="pops-content pops-${
|
|
81
|
-
<aside class="pops-${
|
|
82
|
-
<ul class="pops-${
|
|
83
|
-
<ul class="pops-${
|
|
81
|
+
<div class="pops-content pops-${popsType}-content">
|
|
82
|
+
<aside class="pops-${popsType}-aside">
|
|
83
|
+
<ul class="pops-${popsType}-aside-top-container"></ul>
|
|
84
|
+
<ul class="pops-${popsType}-aside-bottom-container"></ul>
|
|
84
85
|
</aside>
|
|
85
|
-
<section class="pops-${
|
|
86
|
-
<ul class="pops-${
|
|
87
|
-
<ul class="pops-${
|
|
86
|
+
<section class="pops-${popsType}-container">
|
|
87
|
+
<ul class="pops-${popsType}-container-header-ul"></ul>
|
|
88
|
+
<ul class="pops-${popsType}-container-main-ul"></ul>
|
|
88
89
|
</section>
|
|
89
90
|
</div>`,
|
|
90
91
|
"",
|
|
@@ -102,7 +103,7 @@ export const PopsPanel = {
|
|
|
102
103
|
contentElement: $content,
|
|
103
104
|
contentAsideElement: $contentAside,
|
|
104
105
|
contentSectionContainerElement: $contentSectionContainer,
|
|
105
|
-
} = PopsHandler.handleQueryElement($anim,
|
|
106
|
+
} = PopsHandler.handleQueryElement($anim, popsType);
|
|
106
107
|
if (config.isMobile || popsUtils.isPhone()) {
|
|
107
108
|
popsDOMUtils.addClassName($pops, config.mobileClassName);
|
|
108
109
|
}
|
|
@@ -118,7 +119,7 @@ export const PopsPanel = {
|
|
|
118
119
|
/* 遮罩层元素 */
|
|
119
120
|
if (config.mask.enable) {
|
|
120
121
|
let { maskElement } = PopsHandler.handleMask({
|
|
121
|
-
type:
|
|
122
|
+
type: popsType,
|
|
122
123
|
guid: guid,
|
|
123
124
|
config: config,
|
|
124
125
|
animElement: $anim,
|
|
@@ -133,7 +134,7 @@ export const PopsPanel = {
|
|
|
133
134
|
guid,
|
|
134
135
|
$shadowContainer,
|
|
135
136
|
$shadowRoot,
|
|
136
|
-
|
|
137
|
+
popsType,
|
|
137
138
|
$anim,
|
|
138
139
|
$pops,
|
|
139
140
|
$mask!,
|
|
@@ -171,7 +172,7 @@ export const PopsPanel = {
|
|
|
171
172
|
},
|
|
172
173
|
});
|
|
173
174
|
|
|
174
|
-
PopsHandler.handlePush(
|
|
175
|
+
PopsHandler.handlePush(popsType, {
|
|
175
176
|
guid: guid,
|
|
176
177
|
animElement: $anim,
|
|
177
178
|
popsElement: $pops,
|
|
@@ -2,6 +2,7 @@ import { GlobalConfig } from "../../GlobalConfig";
|
|
|
2
2
|
import { PopsElementHandler } from "../../handler/PopsElementHandler";
|
|
3
3
|
import { PopsHandler } from "../../handler/PopsHandler";
|
|
4
4
|
import { PopsCSS } from "../../PopsCSS";
|
|
5
|
+
import type { PopsType } from "../../types/main";
|
|
5
6
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
6
7
|
import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
|
|
7
8
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
@@ -12,12 +13,12 @@ export const PopsPrompt = {
|
|
|
12
13
|
init(details: PopsPromptDetails) {
|
|
13
14
|
const guid = popsUtils.getRandomGUID();
|
|
14
15
|
// 设置当前类型
|
|
15
|
-
const PopsType = "prompt";
|
|
16
|
+
const popsType: PopsType = "prompt";
|
|
16
17
|
|
|
17
18
|
let config = PopsPromptConfig();
|
|
18
19
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
19
20
|
config = popsUtils.assign(config, details);
|
|
20
|
-
config = PopsHandler.handleOnly(
|
|
21
|
+
config = PopsHandler.handleOnly(popsType, config);
|
|
21
22
|
|
|
22
23
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
23
24
|
PopsHandler.handleInit($shadowRoot, [
|
|
@@ -55,29 +56,29 @@ export const PopsPrompt = {
|
|
|
55
56
|
let zIndex = PopsHandler.handleZIndex(config.zIndex);
|
|
56
57
|
let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
|
|
57
58
|
|
|
58
|
-
let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(
|
|
59
|
-
let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(
|
|
59
|
+
let headerBtnHTML = PopsElementHandler.getHeaderBtnHTML(popsType, config);
|
|
60
|
+
let bottomBtnHTML = PopsElementHandler.getBottomBtnHTML(popsType, config);
|
|
60
61
|
let { headerStyle, headerPStyle } = PopsElementHandler.getHeaderStyle(
|
|
61
|
-
|
|
62
|
+
popsType,
|
|
62
63
|
config
|
|
63
64
|
);
|
|
64
65
|
let { contentPStyle } = PopsElementHandler.getContentStyle(
|
|
65
|
-
|
|
66
|
+
popsType,
|
|
66
67
|
config
|
|
67
68
|
);
|
|
68
69
|
let animHTML = PopsElementHandler.getAnimHTML(
|
|
69
70
|
guid,
|
|
70
|
-
|
|
71
|
+
popsType,
|
|
71
72
|
config,
|
|
72
73
|
/*html*/ `
|
|
73
|
-
<div class="pops-title pops-${
|
|
74
|
+
<div class="pops-title pops-${popsType}-title" style="text-align: ${
|
|
74
75
|
config.title.position
|
|
75
76
|
};${headerStyle}">${
|
|
76
77
|
config.title.html
|
|
77
78
|
? config.title.text
|
|
78
|
-
: `<p pops class="pops-${
|
|
79
|
+
: `<p pops class="pops-${popsType}-title-text" style="${headerPStyle}">${config.title.text}</p>`
|
|
79
80
|
}${headerBtnHTML}</div>
|
|
80
|
-
<div class="pops-content pops-${
|
|
81
|
+
<div class="pops-content pops-${popsType}-content" style="${contentPStyle}">${
|
|
81
82
|
config.content.row
|
|
82
83
|
? '<textarea name="pops-input-text" pops="" placeholder="' +
|
|
83
84
|
config.content.placeholder +
|
|
@@ -105,7 +106,7 @@ export const PopsPrompt = {
|
|
|
105
106
|
btnCancelElement: $btnCancel,
|
|
106
107
|
btnOtherElement: $btnOther,
|
|
107
108
|
titleElement: $title,
|
|
108
|
-
} = PopsHandler.handleQueryElement($anim,
|
|
109
|
+
} = PopsHandler.handleQueryElement($anim, popsType);
|
|
109
110
|
/**
|
|
110
111
|
* 遮罩层元素
|
|
111
112
|
*/
|
|
@@ -119,7 +120,7 @@ export const PopsPrompt = {
|
|
|
119
120
|
if (config.mask.enable) {
|
|
120
121
|
// 启用遮罩层
|
|
121
122
|
let _handleMask_ = PopsHandler.handleMask({
|
|
122
|
-
type:
|
|
123
|
+
type: popsType,
|
|
123
124
|
guid: guid,
|
|
124
125
|
config: config,
|
|
125
126
|
animElement: $anim,
|
|
@@ -132,7 +133,7 @@ export const PopsPrompt = {
|
|
|
132
133
|
guid,
|
|
133
134
|
$shadowContainer,
|
|
134
135
|
$shadowRoot,
|
|
135
|
-
|
|
136
|
+
popsType,
|
|
136
137
|
$anim,
|
|
137
138
|
|
|
138
139
|
$pops!,
|
|
@@ -187,7 +188,7 @@ export const PopsPrompt = {
|
|
|
187
188
|
if ($mask != null) {
|
|
188
189
|
$anim.after($mask);
|
|
189
190
|
}
|
|
190
|
-
PopsHandler.handlePush(
|
|
191
|
+
PopsHandler.handlePush(popsType, {
|
|
191
192
|
guid: guid,
|
|
192
193
|
animElement: $anim,
|
|
193
194
|
|
|
@@ -11,17 +11,18 @@ import type {
|
|
|
11
11
|
} from "./types";
|
|
12
12
|
import { PopsCSS } from "../../PopsCSS";
|
|
13
13
|
import { PopsIcon } from "../../PopsIcon";
|
|
14
|
+
import type { PopsType } from "../../types/main";
|
|
14
15
|
|
|
15
16
|
export const PopsRightClickMenu = {
|
|
16
17
|
init(details: PopsRightClickMenuDetails) {
|
|
17
18
|
const guid = popsUtils.getRandomGUID();
|
|
18
19
|
// 设置当前类型
|
|
19
|
-
const PopsType = "rightClickMenu";
|
|
20
|
+
const popsType: PopsType = "rightClickMenu";
|
|
20
21
|
|
|
21
22
|
let config = PopsRightClickMenuConfig();
|
|
22
23
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
23
24
|
config = popsUtils.assign(config, details);
|
|
24
|
-
config = PopsHandler.handleOnly(
|
|
25
|
+
config = PopsHandler.handleOnly(popsType, config);
|
|
25
26
|
if (config.target == null) {
|
|
26
27
|
throw new Error("config.target 不能为空");
|
|
27
28
|
}
|
|
@@ -76,7 +77,7 @@ export const PopsRightClickMenu = {
|
|
|
76
77
|
return;
|
|
77
78
|
}
|
|
78
79
|
let $click = event.target as HTMLElement;
|
|
79
|
-
if ($click.closest(`.pops-${
|
|
80
|
+
if ($click.closest(`.pops-${popsType}`)) {
|
|
80
81
|
return;
|
|
81
82
|
}
|
|
82
83
|
if (
|
|
@@ -97,7 +98,7 @@ export const PopsRightClickMenu = {
|
|
|
97
98
|
return;
|
|
98
99
|
}
|
|
99
100
|
let $click = event.target as HTMLElement;
|
|
100
|
-
if ($click.closest(`.pops-${
|
|
101
|
+
if ($click.closest(`.pops-${popsType}`)) {
|
|
101
102
|
return;
|
|
102
103
|
}
|
|
103
104
|
PopsContextMenu.closeAllMenu(PopsContextMenu.rootElement);
|
|
@@ -167,7 +168,7 @@ export const PopsRightClickMenu = {
|
|
|
167
168
|
if (config.preventDefault) {
|
|
168
169
|
popsDOMUtils.preventEvent(event);
|
|
169
170
|
}
|
|
170
|
-
PopsHandler.handleOnly(
|
|
171
|
+
PopsHandler.handleOnly(popsType, config);
|
|
171
172
|
if (PopsContextMenu.rootElement) {
|
|
172
173
|
PopsContextMenu.closeAllMenu(PopsContextMenu.rootElement);
|
|
173
174
|
}
|
|
@@ -178,14 +179,14 @@ export const PopsRightClickMenu = {
|
|
|
178
179
|
);
|
|
179
180
|
PopsContextMenu.rootElement = rootElement;
|
|
180
181
|
if (config.only) {
|
|
181
|
-
PopsHandler.handlePush(
|
|
182
|
+
PopsHandler.handlePush(popsType, {
|
|
182
183
|
$shadowRoot: $shadowRoot,
|
|
183
184
|
$shadowContainer: $shadowContainer,
|
|
184
185
|
guid: guid,
|
|
185
186
|
animElement: rootElement,
|
|
186
187
|
popsElement: rootElement,
|
|
187
|
-
beforeRemoveCallBack(
|
|
188
|
-
PopsContextMenu.closeAllMenu(
|
|
188
|
+
beforeRemoveCallBack(instCommonConfig) {
|
|
189
|
+
PopsContextMenu.closeAllMenu(instCommonConfig.popsElement);
|
|
189
190
|
},
|
|
190
191
|
});
|
|
191
192
|
}
|
|
@@ -241,7 +242,7 @@ export const PopsRightClickMenu = {
|
|
|
241
242
|
);
|
|
242
243
|
element.remove();
|
|
243
244
|
}
|
|
244
|
-
if (element.classList.contains(`pops-${
|
|
245
|
+
if (element.classList.contains(`pops-${popsType}-anim-show`)) {
|
|
245
246
|
/* 有动画 */
|
|
246
247
|
popsDOMUtils.on(
|
|
247
248
|
element,
|
|
@@ -251,7 +252,7 @@ export const PopsRightClickMenu = {
|
|
|
251
252
|
capture: true,
|
|
252
253
|
}
|
|
253
254
|
);
|
|
254
|
-
element.classList.remove(`pops-${
|
|
255
|
+
element.classList.remove(`pops-${popsType}-anim-show`);
|
|
255
256
|
} else {
|
|
256
257
|
/* 无动画 */
|
|
257
258
|
element.remove();
|
|
@@ -283,7 +284,7 @@ export const PopsRightClickMenu = {
|
|
|
283
284
|
*/
|
|
284
285
|
getMenuContainerElement(isChildren: boolean) {
|
|
285
286
|
let $menu = popsDOMUtils.createElement("div", {
|
|
286
|
-
className: `pops-${
|
|
287
|
+
className: `pops-${popsType}`,
|
|
287
288
|
innerHTML: /*html*/ `
|
|
288
289
|
<ul></ul>
|
|
289
290
|
`,
|
|
@@ -297,7 +298,7 @@ export const PopsRightClickMenu = {
|
|
|
297
298
|
}
|
|
298
299
|
/* 添加动画 */
|
|
299
300
|
if (config.isAnimation) {
|
|
300
|
-
popsDOMUtils.addClassName($menu, `pops-${
|
|
301
|
+
popsDOMUtils.addClassName($menu, `pops-${popsType}-anim-grid`);
|
|
301
302
|
}
|
|
302
303
|
return $menu;
|
|
303
304
|
},
|
|
@@ -456,7 +457,7 @@ export const PopsRightClickMenu = {
|
|
|
456
457
|
});
|
|
457
458
|
/* 过渡动画 */
|
|
458
459
|
if (config.isAnimation) {
|
|
459
|
-
popsDOMUtils.addClassName(menuElement, `pops-${
|
|
460
|
+
popsDOMUtils.addClassName(menuElement, `pops-${popsType}-anim-show`);
|
|
460
461
|
}
|
|
461
462
|
return menuElement;
|
|
462
463
|
},
|
|
@@ -518,7 +519,7 @@ export const PopsRightClickMenu = {
|
|
|
518
519
|
popsDOMUtils.css(menuElement, { ...offset, display: "" });
|
|
519
520
|
/* 过渡动画 */
|
|
520
521
|
if (config.isAnimation) {
|
|
521
|
-
popsDOMUtils.addClassName(menuElement, `pops-${
|
|
522
|
+
popsDOMUtils.addClassName(menuElement, `pops-${popsType}-anim-show`);
|
|
522
523
|
}
|
|
523
524
|
return menuElement;
|
|
524
525
|
},
|
|
@@ -546,7 +547,7 @@ export const PopsRightClickMenu = {
|
|
|
546
547
|
if (typeof item.icon === "string" && item.icon.trim() !== "") {
|
|
547
548
|
let iconSVGHTML = PopsIcon.getIcon(item.icon) ?? item.icon;
|
|
548
549
|
let iconElement = popsDOMUtils.parseTextToDOM(
|
|
549
|
-
/*html*/ `<i class="pops-${
|
|
550
|
+
/*html*/ `<i class="pops-${popsType}-icon" is-loading="${
|
|
550
551
|
item.iconIsLoading ?? false
|
|
551
552
|
}">${iconSVGHTML}</i>`
|
|
552
553
|
);
|
|
@@ -559,7 +560,7 @@ export const PopsRightClickMenu = {
|
|
|
559
560
|
);
|
|
560
561
|
/* 如果存在子数据,显示 */
|
|
561
562
|
if (item.item && Array.isArray(item.item)) {
|
|
562
|
-
popsDOMUtils.addClassName(menuLiElement, `pops-${
|
|
563
|
+
popsDOMUtils.addClassName(menuLiElement, `pops-${popsType}-item`);
|
|
563
564
|
}
|
|
564
565
|
/* 鼠标|触摸 移入事件 */
|
|
565
566
|
function liElementHoverEvent() {
|
|
@@ -568,7 +569,7 @@ export const PopsRightClickMenu = {
|
|
|
568
569
|
).forEach((liElement) => {
|
|
569
570
|
popsDOMUtils.removeClassName(
|
|
570
571
|
liElement,
|
|
571
|
-
`pops-${
|
|
572
|
+
`pops-${popsType}-is-visited`
|
|
572
573
|
);
|
|
573
574
|
if (!(liElement as any).__menuData__) {
|
|
574
575
|
return;
|
|
@@ -600,7 +601,7 @@ export const PopsRightClickMenu = {
|
|
|
600
601
|
}
|
|
601
602
|
popsDOMUtils.addClassName(
|
|
602
603
|
menuLiElement,
|
|
603
|
-
`pops-${
|
|
604
|
+
`pops-${popsType}-is-visited`
|
|
604
605
|
);
|
|
605
606
|
if (!item.item) {
|
|
606
607
|
return;
|
|
@@ -6,12 +6,13 @@ import { GlobalConfig } from "../../GlobalConfig";
|
|
|
6
6
|
import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
|
|
7
7
|
import type { PopsSearchSuggestionDetails } from "./types/index";
|
|
8
8
|
import { PopsCSS } from "../../PopsCSS";
|
|
9
|
+
import type { PopsType } from "../../types/main";
|
|
9
10
|
|
|
10
11
|
export const PopsSearchSuggestion = {
|
|
11
12
|
init(details: PopsSearchSuggestionDetails) {
|
|
12
13
|
const guid = popsUtils.getRandomGUID();
|
|
13
14
|
// 设置当前类型
|
|
14
|
-
const PopsType = "searchSuggestion";
|
|
15
|
+
const popsType: PopsType = "searchSuggestion";
|
|
15
16
|
|
|
16
17
|
let config = PopsSearchSuggestionConfig();
|
|
17
18
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
@@ -88,7 +89,7 @@ export const PopsSearchSuggestion = {
|
|
|
88
89
|
|
|
89
90
|
SearchSuggestion.hide();
|
|
90
91
|
if (config.isAnimation) {
|
|
91
|
-
SearchSuggestion.$el.root.classList.add(`pops-${
|
|
92
|
+
SearchSuggestion.$el.root.classList.add(`pops-${popsType}-animation`);
|
|
92
93
|
}
|
|
93
94
|
$shadowRoot.appendChild(SearchSuggestion.$el.root);
|
|
94
95
|
parentElement.appendChild($shadowContainer);
|
|
@@ -109,19 +110,19 @@ export const PopsSearchSuggestion = {
|
|
|
109
110
|
let element = popsDOMUtils.createElement(
|
|
110
111
|
"div",
|
|
111
112
|
{
|
|
112
|
-
className: `pops pops-${
|
|
113
|
+
className: `pops pops-${popsType}-search-suggestion`,
|
|
113
114
|
innerHTML: /*html*/ `
|
|
114
115
|
<style data-dynamic="true">
|
|
115
116
|
${this.getDynamicCSS()}
|
|
116
117
|
</style>
|
|
117
|
-
<ul class="pops-${
|
|
118
|
+
<ul class="pops-${popsType}-search-suggestion-hint">${
|
|
118
119
|
config.toSearhNotResultHTML
|
|
119
120
|
}</ul>
|
|
120
121
|
`,
|
|
121
122
|
},
|
|
122
123
|
{
|
|
123
124
|
"data-guid": guid,
|
|
124
|
-
"type-value":
|
|
125
|
+
"type-value": popsType,
|
|
125
126
|
}
|
|
126
127
|
);
|
|
127
128
|
if (config.className !== "" && config.className != null) {
|
|
@@ -132,24 +133,24 @@ export const PopsSearchSuggestion = {
|
|
|
132
133
|
/** 动态获取CSS */
|
|
133
134
|
getDynamicCSS() {
|
|
134
135
|
return /*css*/ `
|
|
135
|
-
.pops-${
|
|
136
|
+
.pops-${popsType}-animation{
|
|
136
137
|
-moz-animation: searchSelectFalIn 0.5s 1 linear;
|
|
137
138
|
-webkit-animation: searchSelectFalIn 0.5s 1 linear;
|
|
138
139
|
-o-animation: searchSelectFalIn 0.5s 1 linear;
|
|
139
140
|
-ms-animation: searchSelectFalIn 0.5s 1 linear;
|
|
140
141
|
}
|
|
141
|
-
.pops-${
|
|
142
|
+
.pops-${popsType}-search-suggestion{
|
|
142
143
|
--search-suggestion-bg-color: #ffffff;
|
|
143
144
|
--search-suggestion-box-shadow-color: rgb(0 0 0 / 20%);
|
|
144
145
|
--search-suggestion-item-color: #515a6e;
|
|
145
146
|
--search-suggestion-item-none-color: #8e8e8e;
|
|
146
147
|
--search-suggestion-item-hover-bg-color: rgba(0, 0, 0, .1);
|
|
147
148
|
}
|
|
148
|
-
.pops-${
|
|
149
|
+
.pops-${popsType}-search-suggestion{
|
|
149
150
|
border: initial;
|
|
150
151
|
overflow: initial;
|
|
151
152
|
}
|
|
152
|
-
ul.pops-${
|
|
153
|
+
ul.pops-${popsType}-search-suggestion-hint{
|
|
153
154
|
position: ${config.isAbsolute ? "absolute" : "fixed"};
|
|
154
155
|
z-index: ${PopsHandler.handleZIndex(config.zIndex)};
|
|
155
156
|
width: 0;
|
|
@@ -164,14 +165,14 @@ export const PopsSearchSuggestion = {
|
|
|
164
165
|
box-shadow: 0 1px 6px var(--search-suggestion-box-shadow-color);
|
|
165
166
|
}
|
|
166
167
|
/* 建议框在上面时 */
|
|
167
|
-
ul.pops-${
|
|
168
|
+
ul.pops-${popsType}-search-suggestion-hint[data-top-reverse]{
|
|
168
169
|
display: flex;
|
|
169
170
|
flex-direction: column-reverse;
|
|
170
171
|
}
|
|
171
|
-
ul.pops-${
|
|
172
|
+
ul.pops-${popsType}-search-suggestion-hint[data-top-reverse] li{
|
|
172
173
|
flex-shrink: 0;
|
|
173
174
|
}
|
|
174
|
-
ul.pops-${
|
|
175
|
+
ul.pops-${popsType}-search-suggestion-hint li{
|
|
175
176
|
padding: 7px;
|
|
176
177
|
margin: 0;
|
|
177
178
|
clear: both;
|
|
@@ -184,17 +185,17 @@ export const PopsSearchSuggestion = {
|
|
|
184
185
|
text-overflow: ellipsis;
|
|
185
186
|
width: 100%;
|
|
186
187
|
}
|
|
187
|
-
ul.pops-${
|
|
188
|
+
ul.pops-${popsType}-search-suggestion-hint li[data-none]{
|
|
188
189
|
text-align: center;
|
|
189
190
|
font-size: 12px;
|
|
190
191
|
color: var(--search-suggestion-item-none-color);
|
|
191
192
|
}
|
|
192
|
-
ul.pops-${
|
|
193
|
+
ul.pops-${popsType}-search-suggestion-hint li:hover{
|
|
193
194
|
background-color: var(--search-suggestion-item-hover-bg-color);
|
|
194
195
|
}
|
|
195
196
|
|
|
196
197
|
@media (prefers-color-scheme: dark){
|
|
197
|
-
.pops-${
|
|
198
|
+
.pops-${popsType}-search-suggestion{
|
|
198
199
|
--search-suggestion-bg-color: #1d1e1f;
|
|
199
200
|
--search-suggestion-item-color: #cfd3d4;
|
|
200
201
|
--search-suggestion-item-hover-bg-color: rgba(175, 175, 175, .1);
|
|
@@ -209,7 +210,7 @@ export const PopsSearchSuggestion = {
|
|
|
209
210
|
*/
|
|
210
211
|
getSearchItemLiElement(data: any, index: number) {
|
|
211
212
|
return popsDOMUtils.createElement("li", {
|
|
212
|
-
className: `pops-${
|
|
213
|
+
className: `pops-${popsType}-search-suggestion-hint-item pops-flex-items-center pops-flex-y-center`,
|
|
213
214
|
"data-index": index,
|
|
214
215
|
"data-value": SearchSuggestion.getItemDataValue(data),
|
|
215
216
|
innerHTML: `${config.getItemHTML(data)}${
|
|
@@ -236,7 +237,7 @@ export const PopsSearchSuggestion = {
|
|
|
236
237
|
(event) => {
|
|
237
238
|
popsDOMUtils.preventEvent(event);
|
|
238
239
|
let $click = event.target as HTMLLIElement;
|
|
239
|
-
if ($click.closest(`.pops-${
|
|
240
|
+
if ($click.closest(`.pops-${popsType}-delete-icon`)) {
|
|
240
241
|
/* 点击的是删除按钮 */
|
|
241
242
|
if (typeof config.deleteIcon.callback === "function") {
|
|
242
243
|
config.deleteIcon.callback(
|
|
@@ -512,7 +513,7 @@ export const PopsSearchSuggestion = {
|
|
|
512
513
|
*/
|
|
513
514
|
getDeleteIconHTML(size = 16, fill = "#bababa") {
|
|
514
515
|
return /*html*/ `
|
|
515
|
-
<svg class="pops-${
|
|
516
|
+
<svg class="pops-${popsType}-delete-icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="${size}" height="${size}" fill="${fill}">
|
|
516
517
|
<path d="M512 883.2A371.2 371.2 0 1 0 140.8 512 371.2 371.2 0 0 0 512 883.2z m0 64a435.2 435.2 0 1 1 435.2-435.2 435.2 435.2 0 0 1-435.2 435.2z"></path>
|
|
517
518
|
<path d="M557.056 512l122.368 122.368a31.744 31.744 0 1 1-45.056 45.056L512 557.056l-122.368 122.368a31.744 31.744 0 1 1-45.056-45.056L466.944 512 344.576 389.632a31.744 31.744 0 1 1 45.056-45.056L512 466.944l122.368-122.368a31.744 31.744 0 1 1 45.056 45.056z"></path>
|
|
518
519
|
</svg>
|
|
@@ -523,7 +524,7 @@ export const PopsSearchSuggestion = {
|
|
|
523
524
|
*/
|
|
524
525
|
setPromptsInSearch() {
|
|
525
526
|
let isSearchingElement = popsDOMUtils.createElement("li", {
|
|
526
|
-
className: `pops-${
|
|
527
|
+
className: `pops-${popsType}-search-suggestion-hint-searching-item`,
|
|
527
528
|
innerHTML: config.searchingTip,
|
|
528
529
|
});
|
|
529
530
|
SearchSuggestion.$el.$hintULContainer.appendChild(isSearchingElement);
|
|
@@ -534,7 +535,7 @@ export const PopsSearchSuggestion = {
|
|
|
534
535
|
removePromptsInSearch() {
|
|
535
536
|
SearchSuggestion.$el.$hintULContainer
|
|
536
537
|
.querySelector<HTMLLIElement>(
|
|
537
|
-
`li.pops-${
|
|
538
|
+
`li.pops-${popsType}-search-suggestion-hint-searching-item`
|
|
538
539
|
)
|
|
539
540
|
?.remove();
|
|
540
541
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { GlobalConfig } from "../../GlobalConfig";
|
|
2
2
|
import { PopsHandler } from "../../handler/PopsHandler";
|
|
3
3
|
import { PopsCSS } from "../../PopsCSS";
|
|
4
|
+
import type { PopsType } from "../../types/main";
|
|
4
5
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
5
6
|
import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
|
|
6
7
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
@@ -601,7 +602,7 @@ export const PopsTooltip = {
|
|
|
601
602
|
init(details: PopsToolTipDetails) {
|
|
602
603
|
const guid = popsUtils.getRandomGUID();
|
|
603
604
|
// 设置当前类型
|
|
604
|
-
const PopsType = "tooltip";
|
|
605
|
+
const popsType: PopsType = "tooltip";
|
|
605
606
|
|
|
606
607
|
let config = PopsTooltipConfig();
|
|
607
608
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
@@ -609,7 +610,7 @@ export const PopsTooltip = {
|
|
|
609
610
|
if (!(config.target instanceof HTMLElement)) {
|
|
610
611
|
throw new TypeError("config.target 必须是HTMLElement类型");
|
|
611
612
|
}
|
|
612
|
-
config = PopsHandler.handleOnly(
|
|
613
|
+
config = PopsHandler.handleOnly(popsType, config);
|
|
613
614
|
|
|
614
615
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
615
616
|
PopsHandler.handleInit($shadowRoot, [
|
package/src/css/scrollbar.css
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
/*
|
|
1
|
+
/* ::-webkit-scrollbar 是非标准的css */
|
|
2
|
+
/* https://caniuse.com/?search=%20%3A%3A-webkit-scrollbar */
|
|
2
3
|
.pops ::-webkit-scrollbar {
|
|
3
4
|
width: 6px;
|
|
4
5
|
height: 0;
|
|
5
6
|
}
|
|
6
7
|
|
|
8
|
+
/* 滚动条轨道 */
|
|
7
9
|
.pops ::-webkit-scrollbar-track {
|
|
8
10
|
width: 0;
|
|
9
11
|
}
|
|
10
|
-
|
|
11
|
-
background: rgb(178, 178, 178, var(--pops-bg-opacity));
|
|
12
|
-
}
|
|
12
|
+
/* 滚动条滑块 */
|
|
13
13
|
.pops ::-webkit-scrollbar-thumb {
|
|
14
14
|
min-height: 28px;
|
|
15
15
|
border-radius: 2em;
|
|
16
|
-
background: rgb(204, 204, 204, var(--pops-bg-opacity));
|
|
16
|
+
background: rgb(204, 204, 204, var(--pops-bg-opacity, 1));
|
|
17
17
|
background-clip: padding-box;
|
|
18
18
|
}
|
|
19
|
+
/* 滚动条滑块 */
|
|
20
|
+
.pops ::-webkit-scrollbar-thumb:hover {
|
|
21
|
+
background: rgb(178, 178, 178, var(--pops-bg-opacity, 1));
|
|
22
|
+
}
|
|
@@ -3,14 +3,14 @@ import type { PopsConfirmDetails } from "../components/confirm/types";
|
|
|
3
3
|
import type { PopsIframeDetails } from "../components/iframe/types";
|
|
4
4
|
import type { PopsIconType } from "../types/icon";
|
|
5
5
|
import type {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
PopsSupportAnimDetails,
|
|
7
|
+
PopsSupportBottomBtnDetails,
|
|
8
|
+
PopsSupportContentDetails,
|
|
9
|
+
PopsSupportHeaderTitleDetails,
|
|
10
|
+
PopsSupportAnimDetailsType,
|
|
11
|
+
PopsSupportBottomBtnDetailsType,
|
|
12
|
+
PopsSupportContentDetailsType,
|
|
13
|
+
PopsSupportHeaderTitleDetailsType,
|
|
14
14
|
} from "../types/main";
|
|
15
15
|
import { PopsIcon } from "../PopsIcon";
|
|
16
16
|
import { popsDOMUtils } from "../utils/PopsDOMUtils";
|
|
@@ -40,8 +40,8 @@ export const PopsElementHandler = {
|
|
|
40
40
|
*/
|
|
41
41
|
getAnimHTML(
|
|
42
42
|
guid: string,
|
|
43
|
-
type:
|
|
44
|
-
config:
|
|
43
|
+
type: PopsSupportAnimDetailsType,
|
|
44
|
+
config: PopsSupportAnimDetails[keyof PopsSupportAnimDetails],
|
|
45
45
|
html = "",
|
|
46
46
|
bottomBtnHTML = "",
|
|
47
47
|
zIndex: number
|
|
@@ -80,8 +80,8 @@ export const PopsElementHandler = {
|
|
|
80
80
|
* @param config
|
|
81
81
|
*/
|
|
82
82
|
getHeaderBtnHTML(
|
|
83
|
-
type:
|
|
84
|
-
config:
|
|
83
|
+
type: PopsSupportHeaderTitleDetailsType,
|
|
84
|
+
config: PopsSupportHeaderTitleDetails[keyof PopsSupportHeaderTitleDetails]
|
|
85
85
|
): string {
|
|
86
86
|
if (!config.btn) {
|
|
87
87
|
return "";
|
|
@@ -126,8 +126,8 @@ export const PopsElementHandler = {
|
|
|
126
126
|
* @param config
|
|
127
127
|
*/
|
|
128
128
|
getBottomBtnHTML(
|
|
129
|
-
type:
|
|
130
|
-
config: Omit<
|
|
129
|
+
type: PopsSupportBottomBtnDetailsType,
|
|
130
|
+
config: Omit<PopsSupportBottomBtnDetails[keyof PopsSupportBottomBtnDetails], "content">
|
|
131
131
|
): string {
|
|
132
132
|
if (!config.btn) {
|
|
133
133
|
// 未设置btn参数
|
|
@@ -282,8 +282,8 @@ export const PopsElementHandler = {
|
|
|
282
282
|
* @param config 弹窗配置
|
|
283
283
|
*/
|
|
284
284
|
getHeaderStyle(
|
|
285
|
-
type:
|
|
286
|
-
config:
|
|
285
|
+
type: PopsSupportHeaderTitleDetailsType,
|
|
286
|
+
config: PopsSupportHeaderTitleDetails[keyof PopsSupportHeaderTitleDetails]
|
|
287
287
|
) {
|
|
288
288
|
return {
|
|
289
289
|
headerStyle: config?.title?.html ? config?.title?.style || "" : "",
|
|
@@ -297,8 +297,8 @@ export const PopsElementHandler = {
|
|
|
297
297
|
* @param config 弹窗配置
|
|
298
298
|
*/
|
|
299
299
|
getContentStyle(
|
|
300
|
-
type:
|
|
301
|
-
config:
|
|
300
|
+
type: PopsSupportContentDetailsType,
|
|
301
|
+
config: PopsSupportContentDetails[keyof PopsSupportContentDetails]
|
|
302
302
|
) {
|
|
303
303
|
return {
|
|
304
304
|
contentStyle: (config?.content as any)?.html
|