@whitesev/pops 1.9.1 → 1.9.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 +133 -94
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +133 -94
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +133 -94
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +133 -94
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +133 -94
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +133 -94
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/GlobalConfig.d.ts +1 -0
- package/dist/types/src/Pops.d.ts +1 -0
- package/dist/types/src/components/rightClickMenu/indexType.d.ts +4 -21
- package/dist/types/src/components/searchSuggestion/indexType.d.ts +2 -10
- package/dist/types/src/components/tooltip/index.d.ts +2 -2
- package/dist/types/src/components/tooltip/indexType.d.ts +5 -24
- package/dist/types/src/handler/PopsElementHandler.d.ts +1 -1
- package/dist/types/src/handler/PopsHandler.d.ts +7 -3
- package/dist/types/src/types/components.d.ts +26 -11
- package/dist/types/src/types/event.d.ts +1 -1
- package/dist/types/src/types/layer.d.ts +1 -1
- package/package.json +1 -1
- package/src/Pops.ts +1 -1
- package/src/components/alert/config.ts +1 -0
- package/src/components/alert/index.ts +9 -8
- package/src/components/confirm/config.ts +1 -0
- package/src/components/confirm/index.ts +9 -9
- package/src/components/drawer/config.ts +1 -0
- package/src/components/drawer/index.ts +9 -8
- package/src/components/folder/config.ts +1 -0
- package/src/components/folder/index.ts +31 -24
- package/src/components/iframe/config.ts +1 -0
- package/src/components/iframe/index.ts +15 -11
- package/src/components/loading/config.ts +1 -0
- package/src/components/panel/config.ts +1 -0
- package/src/components/panel/index.ts +13 -11
- package/src/components/prompt/config.ts +1 -0
- package/src/components/prompt/index.ts +10 -8
- package/src/components/rightClickMenu/config.ts +1 -0
- package/src/components/rightClickMenu/index.ts +11 -10
- package/src/components/rightClickMenu/indexType.ts +13 -24
- package/src/components/searchSuggestion/config.ts +1 -0
- package/src/components/searchSuggestion/index.ts +10 -8
- package/src/components/searchSuggestion/indexType.ts +4 -10
- package/src/components/tooltip/config.ts +1 -0
- package/src/components/tooltip/index.ts +13 -12
- package/src/components/tooltip/indexType.ts +10 -27
- package/src/css/index.css +1 -1
- package/src/handler/PopsElementHandler.ts +2 -2
- package/src/handler/PopsHandler.ts +19 -8
- package/src/types/components.d.ts +26 -11
- package/src/types/event.d.ts +1 -1
- package/src/types/layer.d.ts +1 -1
|
@@ -11,7 +11,19 @@ import { GlobalConfig } from "../../GlobalConfig";
|
|
|
11
11
|
|
|
12
12
|
export class PopsPanel {
|
|
13
13
|
constructor(details: PopsPanelDetails) {
|
|
14
|
-
const
|
|
14
|
+
const guid = popsUtils.getRandomGUID();
|
|
15
|
+
// 设置当前类型
|
|
16
|
+
const PopsType = "panel";
|
|
17
|
+
|
|
18
|
+
let config: Required<PopsPanelDetails> = PopsPanelConfig();
|
|
19
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
20
|
+
config = popsUtils.assign(config, details);
|
|
21
|
+
if (details && Array.isArray(details.content)) {
|
|
22
|
+
config.content = details.content;
|
|
23
|
+
}
|
|
24
|
+
config = PopsHandler.handleOnly(PopsType, config);
|
|
25
|
+
|
|
26
|
+
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
15
27
|
PopsHandler.handleInit($shadowRoot, [
|
|
16
28
|
pops.config.cssText.index,
|
|
17
29
|
pops.config.cssText.ninePalaceGridPosition,
|
|
@@ -22,16 +34,6 @@ export class PopsPanel {
|
|
|
22
34
|
pops.config.cssText.panelCSS,
|
|
23
35
|
]);
|
|
24
36
|
|
|
25
|
-
let config: Required<PopsPanelDetails> = PopsPanelConfig();
|
|
26
|
-
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
27
|
-
config = popsUtils.assign(config, details);
|
|
28
|
-
if (details && Array.isArray(details.content)) {
|
|
29
|
-
config.content = details.content;
|
|
30
|
-
}
|
|
31
|
-
let guid = popsUtils.getRandomGUID();
|
|
32
|
-
const PopsType = "panel";
|
|
33
|
-
config = PopsHandler.handleOnly(PopsType, config);
|
|
34
|
-
|
|
35
37
|
// 先把z-index提取出来
|
|
36
38
|
let zIndex = PopsHandler.handleZIndex(config.zIndex);
|
|
37
39
|
let maskHTML = PopsElementHandler.getMaskHTML(guid, zIndex);
|
|
@@ -10,7 +10,16 @@ import type { PopsPromptDetails } from "./indexType";
|
|
|
10
10
|
|
|
11
11
|
export class PopsPrompt {
|
|
12
12
|
constructor(details: PopsPromptDetails) {
|
|
13
|
-
const
|
|
13
|
+
const guid = popsUtils.getRandomGUID();
|
|
14
|
+
// 设置当前类型
|
|
15
|
+
const PopsType = "prompt";
|
|
16
|
+
|
|
17
|
+
let config = PopsPromptConfig();
|
|
18
|
+
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
19
|
+
config = popsUtils.assign(config, details);
|
|
20
|
+
config = PopsHandler.handleOnly(PopsType, config);
|
|
21
|
+
|
|
22
|
+
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
14
23
|
PopsHandler.handleInit($shadowRoot, [
|
|
15
24
|
pops.config.cssText.index,
|
|
16
25
|
pops.config.cssText.ninePalaceGridPosition,
|
|
@@ -20,13 +29,6 @@ export class PopsPrompt {
|
|
|
20
29
|
pops.config.cssText.common,
|
|
21
30
|
pops.config.cssText.promptCSS,
|
|
22
31
|
]);
|
|
23
|
-
let config = PopsPromptConfig();
|
|
24
|
-
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
25
|
-
config = popsUtils.assign(config, details);
|
|
26
|
-
let guid = popsUtils.getRandomGUID();
|
|
27
|
-
const PopsType = "prompt";
|
|
28
|
-
|
|
29
|
-
config = PopsHandler.handleOnly(PopsType, config);
|
|
30
32
|
|
|
31
33
|
// 先把z-index提取出来
|
|
32
34
|
let zIndex = PopsHandler.handleZIndex(config.zIndex);
|
|
@@ -13,17 +13,14 @@ import type {
|
|
|
13
13
|
|
|
14
14
|
export class PopsRightClickMenu {
|
|
15
15
|
constructor(details: PopsRightClickMenuDetails) {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
pops.config.cssText.anim,
|
|
20
|
-
pops.config.cssText.common,
|
|
21
|
-
pops.config.cssText.rightClickMenu,
|
|
22
|
-
]);
|
|
16
|
+
const guid = popsUtils.getRandomGUID();
|
|
17
|
+
// 设置当前类型
|
|
18
|
+
const PopsType = "rightClickMenu";
|
|
23
19
|
|
|
24
20
|
let config = PopsRightClickMenuConfig();
|
|
25
21
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
26
22
|
config = popsUtils.assign(config, details);
|
|
23
|
+
config = PopsHandler.handleOnly(PopsType, config);
|
|
27
24
|
if (config.target == null) {
|
|
28
25
|
throw "config.target 不能为空";
|
|
29
26
|
}
|
|
@@ -31,9 +28,13 @@ export class PopsRightClickMenu {
|
|
|
31
28
|
// @ts-ignore
|
|
32
29
|
config.data = details.data;
|
|
33
30
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
32
|
+
PopsHandler.handleInit($shadowRoot, [
|
|
33
|
+
pops.config.cssText.index,
|
|
34
|
+
pops.config.cssText.anim,
|
|
35
|
+
pops.config.cssText.common,
|
|
36
|
+
pops.config.cssText.rightClickMenu,
|
|
37
|
+
]);
|
|
37
38
|
|
|
38
39
|
if (config.style != null) {
|
|
39
40
|
let cssNode = document.createElement("style");
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PopsCommonConfig } from "../../types/components";
|
|
1
2
|
import type { PopsIcon } from "../../types/icon";
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -40,11 +41,20 @@ export interface PopsRightClickMenuDataDetails {
|
|
|
40
41
|
/**
|
|
41
42
|
* pops.rightClickMenu
|
|
42
43
|
*/
|
|
43
|
-
export interface PopsRightClickMenuDetails
|
|
44
|
+
export interface PopsRightClickMenuDetails
|
|
45
|
+
extends Pick<
|
|
46
|
+
PopsCommonConfig,
|
|
47
|
+
"useShadowRoot" | "beforeAppendToPageCallBack" | "zIndex" | "style" | "only"
|
|
48
|
+
> {
|
|
44
49
|
/**
|
|
45
|
-
* 目标,默认为document.documentElement
|
|
50
|
+
* 目标,默认为document.documentElement G
|
|
46
51
|
*/
|
|
47
|
-
target?:
|
|
52
|
+
target?:
|
|
53
|
+
| HTMLElement
|
|
54
|
+
| (typeof globalThis & Window)
|
|
55
|
+
| Window
|
|
56
|
+
| EventTarget
|
|
57
|
+
| Node;
|
|
48
58
|
/**
|
|
49
59
|
* 目标的子元素选择器,默认为空
|
|
50
60
|
*/
|
|
@@ -57,33 +67,12 @@ export interface PopsRightClickMenuDetails {
|
|
|
57
67
|
* 自定义className,默认为空
|
|
58
68
|
*/
|
|
59
69
|
className?: string;
|
|
60
|
-
/**
|
|
61
|
-
* 是否是唯一的弹窗,默认false
|
|
62
|
-
*/
|
|
63
|
-
only?: boolean;
|
|
64
70
|
/**
|
|
65
71
|
* 是否启用动画,默认true
|
|
66
72
|
*/
|
|
67
73
|
isAnimation?: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* 弹窗的显示层级,默认10000
|
|
70
|
-
*/
|
|
71
|
-
zIndex?: number | (() => number);
|
|
72
74
|
/**
|
|
73
75
|
* 是否阻止默认contextmenu事件
|
|
74
76
|
*/
|
|
75
77
|
preventDefault?: boolean;
|
|
76
|
-
/**
|
|
77
|
-
* (可选)自定义style
|
|
78
|
-
*/
|
|
79
|
-
style?: string | null;
|
|
80
|
-
/**
|
|
81
|
-
* 在元素添加到页面前的事件
|
|
82
|
-
* @param $shadowRoot 根元素
|
|
83
|
-
* @param $shadowContainer 容器
|
|
84
|
-
*/
|
|
85
|
-
beforeAppendToPageCallBack?: (
|
|
86
|
-
$shadowRoot: ShadowRoot,
|
|
87
|
-
$shadowContainer: HTMLDivElement
|
|
88
|
-
) => void;
|
|
89
78
|
}
|
|
@@ -8,12 +8,9 @@ import { GlobalConfig } from "../../GlobalConfig";
|
|
|
8
8
|
|
|
9
9
|
export class PopsSearchSuggestion {
|
|
10
10
|
constructor(details: PopsSearchSuggestionDetails) {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
pops.config.cssText.anim,
|
|
15
|
-
pops.config.cssText.common,
|
|
16
|
-
]);
|
|
11
|
+
const guid = popsUtils.getRandomGUID();
|
|
12
|
+
// 设置当前类型
|
|
13
|
+
const PopsType = "searchSuggestion";
|
|
17
14
|
|
|
18
15
|
let config = PopsSearchSuggestionConfig();
|
|
19
16
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
@@ -28,8 +25,13 @@ export class PopsSearchSuggestion {
|
|
|
28
25
|
if (details.data) {
|
|
29
26
|
config.data = details.data;
|
|
30
27
|
}
|
|
31
|
-
|
|
32
|
-
const
|
|
28
|
+
|
|
29
|
+
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
30
|
+
PopsHandler.handleInit($shadowRoot, [
|
|
31
|
+
pops.config.cssText.index,
|
|
32
|
+
pops.config.cssText.anim,
|
|
33
|
+
pops.config.cssText.common,
|
|
34
|
+
]);
|
|
33
35
|
|
|
34
36
|
if (config.style != null) {
|
|
35
37
|
let cssNode = document.createElement("style");
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import type { PopsCommonConfig } from "../../types/components";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* 搜索建议悬浮窗
|
|
3
5
|
* pops.searchSuggestion
|
|
4
6
|
*/
|
|
5
|
-
export interface PopsSearchSuggestionDetails<T = any>
|
|
7
|
+
export interface PopsSearchSuggestionDetails<T = any>
|
|
8
|
+
extends Pick<PopsCommonConfig, "useShadowRoot" | "zIndex" | "style"> {
|
|
6
9
|
/**
|
|
7
10
|
* 当前的环境,可以是document,可以是shadowroot,默认是document
|
|
8
11
|
* @default document
|
|
@@ -82,11 +85,6 @@ export interface PopsSearchSuggestionDetails<T = any> {
|
|
|
82
85
|
* @default true
|
|
83
86
|
*/
|
|
84
87
|
positionTopToReverse?: boolean;
|
|
85
|
-
/**
|
|
86
|
-
* 层级,默认10000
|
|
87
|
-
* @default 10000
|
|
88
|
-
*/
|
|
89
|
-
zIndex?: number | (() => number);
|
|
90
88
|
/**
|
|
91
89
|
* 搜索中的提示
|
|
92
90
|
*
|
|
@@ -146,10 +144,6 @@ export interface PopsSearchSuggestionDetails<T = any> {
|
|
|
146
144
|
liElement: HTMLLIElement,
|
|
147
145
|
data: T
|
|
148
146
|
) => void;
|
|
149
|
-
/**
|
|
150
|
-
* (可选)自定义style
|
|
151
|
-
*/
|
|
152
|
-
style?: string;
|
|
153
147
|
}
|
|
154
148
|
|
|
155
149
|
/**
|
|
@@ -11,7 +11,7 @@ type ToolTipEventTypeName = "MouseEvent" | "TouchEvent";
|
|
|
11
11
|
export class ToolTip {
|
|
12
12
|
$el = {
|
|
13
13
|
$shadowContainer: null as unknown as HTMLDivElement,
|
|
14
|
-
$shadowRoot: null as unknown as ShadowRoot,
|
|
14
|
+
$shadowRoot: null as unknown as ShadowRoot | HTMLElement,
|
|
15
15
|
$toolTip: null as unknown as HTMLElement,
|
|
16
16
|
$content: null as unknown as HTMLElement,
|
|
17
17
|
$arrow: null as unknown as HTMLElement,
|
|
@@ -27,7 +27,7 @@ export class ToolTip {
|
|
|
27
27
|
guid: string,
|
|
28
28
|
ShadowInfo: {
|
|
29
29
|
$shadowContainer: HTMLDivElement;
|
|
30
|
-
$shadowRoot: ShadowRoot;
|
|
30
|
+
$shadowRoot: ShadowRoot | HTMLElement;
|
|
31
31
|
}
|
|
32
32
|
) {
|
|
33
33
|
this.$data.config = config;
|
|
@@ -540,13 +540,9 @@ export type PopsTooltipResult<T extends PopsToolTipDetails> = {
|
|
|
540
540
|
|
|
541
541
|
export class PopsTooltip {
|
|
542
542
|
constructor(details: PopsToolTipDetails) {
|
|
543
|
-
const
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
pops.config.cssText.anim,
|
|
547
|
-
pops.config.cssText.common,
|
|
548
|
-
pops.config.cssText.tooltipCSS,
|
|
549
|
-
]);
|
|
543
|
+
const guid = popsUtils.getRandomGUID();
|
|
544
|
+
// 设置当前类型
|
|
545
|
+
const PopsType = "tooltip";
|
|
550
546
|
|
|
551
547
|
let config = PopsTooltipConfig();
|
|
552
548
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
@@ -554,11 +550,16 @@ export class PopsTooltip {
|
|
|
554
550
|
if (!(config.target instanceof HTMLElement)) {
|
|
555
551
|
throw "config.target 必须是HTMLElement类型";
|
|
556
552
|
}
|
|
557
|
-
let guid = popsUtils.getRandomGUID();
|
|
558
|
-
const PopsType = "tooltip";
|
|
559
|
-
|
|
560
553
|
config = PopsHandler.handleOnly(PopsType, config);
|
|
561
554
|
|
|
555
|
+
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
556
|
+
PopsHandler.handleInit($shadowRoot, [
|
|
557
|
+
pops.config.cssText.index,
|
|
558
|
+
pops.config.cssText.anim,
|
|
559
|
+
pops.config.cssText.common,
|
|
560
|
+
pops.config.cssText.tooltipCSS,
|
|
561
|
+
]);
|
|
562
|
+
|
|
562
563
|
let toolTip = new ToolTip(config, guid, {
|
|
563
564
|
$shadowContainer,
|
|
564
565
|
$shadowRoot,
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import type { PopsCommonConfig } from "../../types/components";
|
|
2
|
+
|
|
1
3
|
/** tooltip的出现位置 */
|
|
2
4
|
export type PopsTooltipPosition = "top" | "right" | "bottom" | "left";
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* pops.tooltip
|
|
6
8
|
*/
|
|
7
|
-
export interface PopsToolTipDetails
|
|
9
|
+
export interface PopsToolTipDetails
|
|
10
|
+
extends Pick<
|
|
11
|
+
PopsCommonConfig,
|
|
12
|
+
"useShadowRoot" | "only" | "zIndex" | "style" | "beforeAppendToPageCallBack"
|
|
13
|
+
> {
|
|
8
14
|
/**
|
|
9
15
|
* 目标元素
|
|
10
16
|
*/
|
|
@@ -53,20 +59,12 @@ export interface PopsToolTipDetails {
|
|
|
53
59
|
* @default "mouseleave touchend"
|
|
54
60
|
*/
|
|
55
61
|
triggerCloseEventName?: string;
|
|
56
|
-
/**
|
|
57
|
-
* z-index
|
|
58
|
-
* @default 10000
|
|
59
|
-
*/
|
|
60
|
-
zIndex?: number | (() => number);
|
|
61
|
-
/**
|
|
62
|
-
* 是否唯一
|
|
63
|
-
* @default false
|
|
64
|
-
*/
|
|
65
|
-
only?: boolean;
|
|
66
62
|
/**
|
|
67
63
|
* 监听的事件配置
|
|
68
64
|
*/
|
|
69
|
-
eventOption?:
|
|
65
|
+
eventOption?: {
|
|
66
|
+
[P in keyof AddEventListenerOptions]: AddEventListenerOptions[P];
|
|
67
|
+
};
|
|
70
68
|
/**
|
|
71
69
|
* 触发显示前的回调
|
|
72
70
|
* @returns
|
|
@@ -110,19 +108,4 @@ export interface PopsToolTipDetails {
|
|
|
110
108
|
* @default 0
|
|
111
109
|
*/
|
|
112
110
|
otherDistance?: number;
|
|
113
|
-
/**
|
|
114
|
-
* (可选)自定义style
|
|
115
|
-
*/
|
|
116
|
-
style?: string;
|
|
117
|
-
/**
|
|
118
|
-
* 在元素添加到页面前的事件
|
|
119
|
-
*
|
|
120
|
-
* 当tooltip添加到ShadowRoot内时也会触发
|
|
121
|
-
* @param $shadowRoot 根元素
|
|
122
|
-
* @param $shadowContainer 容器
|
|
123
|
-
*/
|
|
124
|
-
beforeAppendToPageCallBack?: (
|
|
125
|
-
$shadowRoot: ShadowRoot,
|
|
126
|
-
$shadowContainer: HTMLDivElement
|
|
127
|
-
) => void;
|
|
128
111
|
}
|
package/src/css/index.css
CHANGED
|
@@ -65,7 +65,7 @@ export const PopsElementHandler = {
|
|
|
65
65
|
<div
|
|
66
66
|
class="pops-anim"
|
|
67
67
|
anim="${__config.animation || ""}"
|
|
68
|
-
style="${popsAnimStyle}
|
|
68
|
+
style="${popsAnimStyle}"
|
|
69
69
|
data-guid="${guid}">
|
|
70
70
|
${
|
|
71
71
|
config.style != null
|
|
@@ -140,7 +140,7 @@ export const PopsElementHandler = {
|
|
|
140
140
|
*/
|
|
141
141
|
getBottomBtnHTML(
|
|
142
142
|
type: PopsTypeSupportBottomBtn,
|
|
143
|
-
config: PopsSupportBottomBtn[keyof PopsSupportBottomBtn]
|
|
143
|
+
config: Omit<PopsSupportBottomBtn[keyof PopsSupportBottomBtn], "content">
|
|
144
144
|
): string {
|
|
145
145
|
if (!config.btn) {
|
|
146
146
|
// 未设置btn参数
|
|
@@ -8,6 +8,7 @@ import type { PopsPanelDetails } from "../components/panel/indexType";
|
|
|
8
8
|
import type { PopsPromptDetails } from "../components/prompt/indexType";
|
|
9
9
|
import { PopsCore } from "../Core";
|
|
10
10
|
import { pops } from "../Pops";
|
|
11
|
+
import type { PopsCommonConfig } from "../types/components";
|
|
11
12
|
import { PopsEventDetails, PopsHandlerEventDetails } from "../types/event";
|
|
12
13
|
import { PopsLayerCommonConfig } from "../types/layer";
|
|
13
14
|
import type {
|
|
@@ -24,21 +25,31 @@ export const PopsHandler = {
|
|
|
24
25
|
/**
|
|
25
26
|
* 创建shadow
|
|
26
27
|
*/
|
|
27
|
-
handlerShadow() {
|
|
28
|
+
handlerShadow(config: Pick<PopsCommonConfig, "useShadowRoot">) {
|
|
28
29
|
let $shadowContainer = document.createElement("div");
|
|
29
30
|
$shadowContainer.className = "pops-shadow-container";
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
if (config.useShadowRoot) {
|
|
32
|
+
let $shadowRoot = $shadowContainer.attachShadow({ mode: "open" });
|
|
33
|
+
return {
|
|
34
|
+
$shadowContainer,
|
|
35
|
+
$shadowRoot,
|
|
36
|
+
};
|
|
37
|
+
} else {
|
|
38
|
+
return {
|
|
39
|
+
$shadowContainer,
|
|
40
|
+
$shadowRoot: $shadowContainer,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
35
43
|
},
|
|
36
44
|
/**
|
|
37
45
|
* 处理初始化
|
|
38
46
|
* @param $shadowRoot 所在的shadowRoot
|
|
39
47
|
* @param cssText 添加进ShadowRoot的CSS
|
|
40
48
|
*/
|
|
41
|
-
handleInit(
|
|
49
|
+
handleInit(
|
|
50
|
+
$shadowRoot?: ShadowRoot | HTMLElement,
|
|
51
|
+
cssText?: string | string[]
|
|
52
|
+
) {
|
|
42
53
|
pops.init();
|
|
43
54
|
if (!arguments.length) {
|
|
44
55
|
return;
|
|
@@ -364,7 +375,7 @@ export const PopsHandler = {
|
|
|
364
375
|
handleEventDetails(
|
|
365
376
|
guid: string,
|
|
366
377
|
$shadowContainer: HTMLDivElement,
|
|
367
|
-
$shadowRoot: ShadowRoot,
|
|
378
|
+
$shadowRoot: ShadowRoot | HTMLElement,
|
|
368
379
|
mode: PopsLayerMode,
|
|
369
380
|
animElement: HTMLDivElement,
|
|
370
381
|
popsElement: HTMLDivElement,
|
|
@@ -154,36 +154,50 @@ export interface PopsDragConfig {
|
|
|
154
154
|
*/
|
|
155
155
|
export interface PopsCommonConfig {
|
|
156
156
|
/**
|
|
157
|
-
*
|
|
157
|
+
* 是否使用shadowRoot
|
|
158
|
+
*
|
|
159
|
+
* @default true
|
|
160
|
+
*/
|
|
161
|
+
useShadowRoot?: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* 自定义的className
|
|
164
|
+
*
|
|
165
|
+
* @default ""
|
|
158
166
|
*/
|
|
159
167
|
class?: string;
|
|
160
168
|
/**
|
|
161
|
-
*
|
|
169
|
+
* 是否是唯一的
|
|
170
|
+
*
|
|
162
171
|
* @default false
|
|
163
172
|
*/
|
|
164
173
|
only?: boolean;
|
|
165
174
|
/**
|
|
166
|
-
*
|
|
167
|
-
*
|
|
175
|
+
* 宽度
|
|
176
|
+
*
|
|
177
|
+
* @default "350px"
|
|
168
178
|
*/
|
|
169
179
|
width: string;
|
|
170
180
|
/**
|
|
171
|
-
*
|
|
172
|
-
*
|
|
181
|
+
* 高度
|
|
182
|
+
*
|
|
183
|
+
* @default "200px"
|
|
173
184
|
*/
|
|
174
185
|
height: string;
|
|
175
186
|
/**
|
|
176
|
-
*
|
|
187
|
+
* 位置
|
|
188
|
+
*
|
|
177
189
|
* @default "center"
|
|
178
190
|
*/
|
|
179
191
|
position?: PopsPosition;
|
|
180
192
|
/**
|
|
181
|
-
*
|
|
193
|
+
* 动画
|
|
194
|
+
*
|
|
182
195
|
* @default "pops-anim-fadein-zoom"
|
|
183
196
|
*/
|
|
184
197
|
animation?: PopsAnimation;
|
|
185
198
|
/**
|
|
186
|
-
* z-index
|
|
199
|
+
* z-index显示层级
|
|
200
|
+
*
|
|
187
201
|
* @default 10000
|
|
188
202
|
*/
|
|
189
203
|
zIndex?: number | (() => number);
|
|
@@ -192,9 +206,10 @@ export interface PopsCommonConfig {
|
|
|
192
206
|
*/
|
|
193
207
|
mask?: PopsMaskDetails;
|
|
194
208
|
/**
|
|
195
|
-
*
|
|
209
|
+
* 是否禁用页面滚动
|
|
196
210
|
*
|
|
197
211
|
* 暂时不会生效
|
|
212
|
+
*
|
|
198
213
|
* @default false
|
|
199
214
|
*/
|
|
200
215
|
forbiddenScroll?: boolean;
|
|
@@ -208,7 +223,7 @@ export interface PopsCommonConfig {
|
|
|
208
223
|
* @param $shadowContainer 容器
|
|
209
224
|
*/
|
|
210
225
|
beforeAppendToPageCallBack?: (
|
|
211
|
-
$shadowRoot: ShadowRoot,
|
|
226
|
+
$shadowRoot: ShadowRoot | HTMLElement,
|
|
212
227
|
$shadowContainer: HTMLDivElement
|
|
213
228
|
) => void;
|
|
214
229
|
}
|
package/src/types/event.d.ts
CHANGED
package/src/types/layer.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface PopsLayerCommonConfig extends PopsLayerConfig {
|
|
|
16
16
|
/** shadow容器 */
|
|
17
17
|
$shadowContainer: HTMLDivElement;
|
|
18
18
|
/** shadow容器的shandowRoot */
|
|
19
|
-
$shadowRoot: ShadowRoot;
|
|
19
|
+
$shadowRoot: ShadowRoot | HTMLElement;
|
|
20
20
|
/** 移除实例前的回调函数 */
|
|
21
21
|
beforeRemoveCallBack?: (layerCommonConfig: PopsLayerCommonConfig) => void;
|
|
22
22
|
}
|