@whitesev/pops 2.2.1 → 2.2.3
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 +275 -263
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +275 -263
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +275 -263
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +275 -263
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +275 -263
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +275 -263
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +1 -1
- package/dist/types/src/components/panel/index.d.ts +2 -1
- package/dist/types/src/components/panel/types/components-input.d.ts +9 -1
- package/dist/types/src/components/panel/types/components-select.d.ts +6 -1
- package/dist/types/src/components/panel/types/components-switch.d.ts +6 -1
- package/dist/types/src/components/panel/types/components-textarea.d.ts +8 -2
- 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 +3 -3
- package/dist/types/src/types/components.d.ts +5 -5
- package/dist/types/src/types/main.d.ts +34 -31
- package/package.json +1 -1
- package/src/Pops.ts +1 -1
- package/src/components/alert/index.ts +15 -15
- 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 +14 -13
- package/src/components/panel/handlerComponents.ts +25 -6
- package/src/components/panel/index.ts +19 -18
- package/src/components/panel/types/components-input.ts +9 -1
- package/src/components/panel/types/components-select.ts +6 -1
- package/src/components/panel/types/components-switch.ts +6 -1
- package/src/components/panel/types/components-textarea.ts +8 -2
- package/src/components/prompt/index.ts +15 -14
- package/src/components/rightClickMenu/index.ts +17 -16
- package/src/components/searchSuggestion/index.ts +21 -20
- package/src/components/tooltip/index.ts +3 -2
- package/src/handler/PopsElementHandler.ts +18 -18
- package/src/handler/PopsHandler.ts +13 -7
- package/src/types/components.d.ts +5 -5
- package/src/types/main.d.ts +34 -31
|
@@ -324,7 +324,11 @@ export const PanelHandlerComponents = () => {
|
|
|
324
324
|
},
|
|
325
325
|
init() {
|
|
326
326
|
this.setStatus(this.$data.value);
|
|
327
|
-
|
|
327
|
+
let disabled =
|
|
328
|
+
typeof formConfig.disabled === "function"
|
|
329
|
+
? formConfig.disabled()
|
|
330
|
+
: formConfig.disabled;
|
|
331
|
+
if (disabled) {
|
|
328
332
|
this.disable();
|
|
329
333
|
}
|
|
330
334
|
this.setClickEvent();
|
|
@@ -1109,9 +1113,11 @@ export const PanelHandlerComponents = () => {
|
|
|
1109
1113
|
$li,
|
|
1110
1114
|
/*html*/ `
|
|
1111
1115
|
<div class="pops-panel-item-left-text">
|
|
1112
|
-
<p class="pops-panel-item-left-main-text">${
|
|
1116
|
+
<p class="pops-panel-item-left-main-text">${
|
|
1117
|
+
formConfig.text
|
|
1118
|
+
}</p>${leftDescriptionText}</div>
|
|
1113
1119
|
<div class="pops-panel-input pops-user-select-none">
|
|
1114
|
-
<input type="${inputType}" placeholder="${formConfig.placeholder}">
|
|
1120
|
+
<input type="${inputType}" placeholder="${formConfig.placeholder ?? ""}">
|
|
1115
1121
|
</div>
|
|
1116
1122
|
`
|
|
1117
1123
|
);
|
|
@@ -1144,7 +1150,12 @@ export const PanelHandlerComponents = () => {
|
|
|
1144
1150
|
}
|
|
1145
1151
|
|
|
1146
1152
|
this.setInputChangeEvent();
|
|
1147
|
-
|
|
1153
|
+
// 是否禁用复选框
|
|
1154
|
+
let disabled =
|
|
1155
|
+
typeof formConfig.disabled === "function"
|
|
1156
|
+
? formConfig.disabled()
|
|
1157
|
+
: formConfig.disabled;
|
|
1158
|
+
if (disabled) {
|
|
1148
1159
|
this.disable();
|
|
1149
1160
|
}
|
|
1150
1161
|
if (typeof formConfig.handlerCallBack === "function") {
|
|
@@ -1348,7 +1359,11 @@ export const PanelHandlerComponents = () => {
|
|
|
1348
1359
|
init() {
|
|
1349
1360
|
this.setValue(this.$data.value);
|
|
1350
1361
|
this.setChangeEvent();
|
|
1351
|
-
|
|
1362
|
+
let disabled =
|
|
1363
|
+
typeof formConfig.disabled === "function"
|
|
1364
|
+
? formConfig.disabled()
|
|
1365
|
+
: formConfig.disabled;
|
|
1366
|
+
if (disabled) {
|
|
1352
1367
|
this.disable();
|
|
1353
1368
|
}
|
|
1354
1369
|
},
|
|
@@ -1450,7 +1465,11 @@ export const PanelHandlerComponents = () => {
|
|
|
1450
1465
|
this.initOption();
|
|
1451
1466
|
this.setChangeEvent();
|
|
1452
1467
|
this.setClickEvent();
|
|
1453
|
-
|
|
1468
|
+
let disabled =
|
|
1469
|
+
typeof formConfig.disabled === "function"
|
|
1470
|
+
? formConfig.disabled()
|
|
1471
|
+
: formConfig.disabled;
|
|
1472
|
+
if (disabled) {
|
|
1454
1473
|
this.disable();
|
|
1455
1474
|
}
|
|
1456
1475
|
},
|
|
@@ -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,
|
|
@@ -7,10 +7,12 @@ export interface PopsPanelInputDetails
|
|
|
7
7
|
extends PopsPanelCommonDetails<PopsPanelInputDetails> {
|
|
8
8
|
/**
|
|
9
9
|
* (可选)className属性
|
|
10
|
+
* @default ""
|
|
10
11
|
*/
|
|
11
12
|
className?: string;
|
|
12
13
|
/**
|
|
13
14
|
* (可选)自定义元素属性
|
|
15
|
+
* @default {}
|
|
14
16
|
*/
|
|
15
17
|
attributes?:
|
|
16
18
|
| {
|
|
@@ -21,6 +23,7 @@ export interface PopsPanelInputDetails
|
|
|
21
23
|
}[];
|
|
22
24
|
/**
|
|
23
25
|
* (可选)自定义属性
|
|
26
|
+
* @default {}
|
|
24
27
|
*/
|
|
25
28
|
props?: {
|
|
26
29
|
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
@@ -31,6 +34,7 @@ export interface PopsPanelInputDetails
|
|
|
31
34
|
text: string;
|
|
32
35
|
/**
|
|
33
36
|
* (可选)左边的文字下面的描述
|
|
37
|
+
* @default ""
|
|
34
38
|
*/
|
|
35
39
|
description?: string;
|
|
36
40
|
/**
|
|
@@ -39,8 +43,9 @@ export interface PopsPanelInputDetails
|
|
|
39
43
|
type: "input";
|
|
40
44
|
/**
|
|
41
45
|
* (可选)是否禁用
|
|
46
|
+
* @default false
|
|
42
47
|
*/
|
|
43
|
-
disabled?: boolean;
|
|
48
|
+
disabled?: boolean | (() => boolean);
|
|
44
49
|
/**
|
|
45
50
|
* 获取该项的值的回调函数
|
|
46
51
|
*/
|
|
@@ -54,14 +59,17 @@ export interface PopsPanelInputDetails
|
|
|
54
59
|
callback(event: InputEvent, value: string, valueAsNumber?: number): void;
|
|
55
60
|
/**
|
|
56
61
|
* (可选)输入框内的提示
|
|
62
|
+
* @default ""
|
|
57
63
|
*/
|
|
58
64
|
placeholder?: string;
|
|
59
65
|
/**
|
|
60
66
|
* (可选)是否是密码框
|
|
67
|
+
* @default false
|
|
61
68
|
*/
|
|
62
69
|
isPassword?: boolean;
|
|
63
70
|
/**
|
|
64
71
|
* (可选)是否是数字框
|
|
72
|
+
* @default false
|
|
65
73
|
*/
|
|
66
74
|
isNumber?: boolean;
|
|
67
75
|
/**
|
|
@@ -9,10 +9,12 @@ export interface PopsPanelSelectDetails<T = any>
|
|
|
9
9
|
extends PopsPanelCommonDetails<PopsPanelSelectDetails> {
|
|
10
10
|
/**
|
|
11
11
|
* (可选)className属性
|
|
12
|
+
* @default ""
|
|
12
13
|
*/
|
|
13
14
|
className?: string;
|
|
14
15
|
/**
|
|
15
16
|
* (可选)自定义元素属性
|
|
17
|
+
* @default {}
|
|
16
18
|
*/
|
|
17
19
|
attributes?:
|
|
18
20
|
| {
|
|
@@ -23,6 +25,7 @@ export interface PopsPanelSelectDetails<T = any>
|
|
|
23
25
|
}[];
|
|
24
26
|
/**
|
|
25
27
|
* (可选)自定义属性
|
|
28
|
+
* @default {}
|
|
26
29
|
*/
|
|
27
30
|
props?: {
|
|
28
31
|
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
@@ -33,6 +36,7 @@ export interface PopsPanelSelectDetails<T = any>
|
|
|
33
36
|
text: string;
|
|
34
37
|
/**
|
|
35
38
|
* (可选)左边的文字下面的描述
|
|
39
|
+
* @default ""
|
|
36
40
|
*/
|
|
37
41
|
description?: string;
|
|
38
42
|
/**
|
|
@@ -41,8 +45,9 @@ export interface PopsPanelSelectDetails<T = any>
|
|
|
41
45
|
type: "select";
|
|
42
46
|
/**
|
|
43
47
|
* (可选)是否禁用
|
|
48
|
+
* @default false
|
|
44
49
|
*/
|
|
45
|
-
disabled?: boolean;
|
|
50
|
+
disabled?: boolean | (() => boolean);
|
|
46
51
|
/**
|
|
47
52
|
* 获取该项的值的回调函数
|
|
48
53
|
*/
|
|
@@ -7,10 +7,12 @@ export interface PopsPanelSwitchDetails
|
|
|
7
7
|
extends PopsPanelCommonDetails<PopsPanelSwitchDetails> {
|
|
8
8
|
/**
|
|
9
9
|
* (可选)className属性
|
|
10
|
+
* @default ""
|
|
10
11
|
*/
|
|
11
12
|
className?: string;
|
|
12
13
|
/**
|
|
13
14
|
* (可选)自定义元素属性
|
|
15
|
+
* @default {}
|
|
14
16
|
*/
|
|
15
17
|
attributes?:
|
|
16
18
|
| {
|
|
@@ -21,6 +23,7 @@ export interface PopsPanelSwitchDetails
|
|
|
21
23
|
}[];
|
|
22
24
|
/**
|
|
23
25
|
* (可选)自定义属性
|
|
26
|
+
* @default {}
|
|
24
27
|
*/
|
|
25
28
|
props?: {
|
|
26
29
|
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
@@ -31,6 +34,7 @@ export interface PopsPanelSwitchDetails
|
|
|
31
34
|
text: string;
|
|
32
35
|
/**
|
|
33
36
|
* (可选)左边的文字下面的描述
|
|
37
|
+
* @default ""
|
|
34
38
|
*/
|
|
35
39
|
description?: string;
|
|
36
40
|
/**
|
|
@@ -39,8 +43,9 @@ export interface PopsPanelSwitchDetails
|
|
|
39
43
|
type: "switch";
|
|
40
44
|
/**
|
|
41
45
|
* (可选)是否禁用
|
|
46
|
+
* @default false
|
|
42
47
|
*/
|
|
43
|
-
disabled?:
|
|
48
|
+
disabled?: boolean | (() => boolean);
|
|
44
49
|
/**
|
|
45
50
|
* 获取该项的值的回调函数
|
|
46
51
|
*/
|
|
@@ -7,10 +7,12 @@ export interface PopsPanelTextAreaDetails
|
|
|
7
7
|
extends PopsPanelCommonDetails<PopsPanelTextAreaDetails> {
|
|
8
8
|
/**
|
|
9
9
|
* (可选)className属性
|
|
10
|
+
* @default ""
|
|
10
11
|
*/
|
|
11
12
|
className?: string;
|
|
12
13
|
/**
|
|
13
14
|
* (可选)自定义元素属性
|
|
15
|
+
* @default {}
|
|
14
16
|
*/
|
|
15
17
|
attributes?:
|
|
16
18
|
| {
|
|
@@ -21,6 +23,7 @@ export interface PopsPanelTextAreaDetails
|
|
|
21
23
|
}[];
|
|
22
24
|
/**
|
|
23
25
|
* (可选)自定义属性
|
|
26
|
+
* @default {}
|
|
24
27
|
*/
|
|
25
28
|
props?: {
|
|
26
29
|
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
@@ -31,6 +34,7 @@ export interface PopsPanelTextAreaDetails
|
|
|
31
34
|
text: string;
|
|
32
35
|
/**
|
|
33
36
|
* (可选)左边的文字下面的描述
|
|
37
|
+
* @default ""
|
|
34
38
|
*/
|
|
35
39
|
description?: string;
|
|
36
40
|
/**
|
|
@@ -39,8 +43,9 @@ export interface PopsPanelTextAreaDetails
|
|
|
39
43
|
type: "textarea";
|
|
40
44
|
/**
|
|
41
45
|
* (可选)是否禁用
|
|
46
|
+
* @default false
|
|
42
47
|
*/
|
|
43
|
-
disabled?: boolean;
|
|
48
|
+
disabled?: boolean | (() => boolean);
|
|
44
49
|
/**
|
|
45
50
|
* 获取该项的值的回调函数
|
|
46
51
|
*/
|
|
@@ -58,6 +63,7 @@ export interface PopsPanelTextAreaDetails
|
|
|
58
63
|
): void;
|
|
59
64
|
/**
|
|
60
65
|
* 输入框内的提示
|
|
66
|
+
* @default ""
|
|
61
67
|
*/
|
|
62
|
-
placeholder
|
|
68
|
+
placeholder?: string;
|
|
63
69
|
}
|
|
@@ -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,7 +179,7 @@ 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,
|
|
@@ -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;
|