@whitesev/pops 4.0.2 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.amd.js +363 -275
- package/dist/index.amd.js.map +1 -1
- package/dist/index.amd.min.js +1 -1
- package/dist/index.amd.min.js.map +1 -1
- package/dist/index.cjs.js +363 -275
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +363 -275
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.iife.js +363 -275
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.system.js +363 -275
- package/dist/index.system.js.map +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/dist/index.umd.js +363 -275
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types/src/Pops.d.ts +116 -16
- package/dist/types/src/components/loading/types/index.d.ts +1 -1
- package/dist/types/src/components/panel/index.d.ts +3 -2
- package/dist/types/src/components/rightClickMenu/types/index.d.ts +1 -1
- package/dist/types/src/components/searchSuggestion/types/index.d.ts +1 -1
- package/dist/types/src/components/tooltip/index.d.ts +82 -1
- package/dist/types/src/components/tooltip/types/index.d.ts +1 -1
- package/dist/types/src/config/GlobalConfig.d.ts +3 -3
- package/dist/types/src/event/EventEmiter.d.ts +7 -1
- package/dist/types/src/handler/PopsInstHandler.d.ts +4 -4
- package/dist/types/src/types/EventEmitter.d.ts +21 -0
- package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +1 -1
- package/dist/types/src/types/components.d.ts +15 -18
- package/dist/types/src/types/global.d.ts +2 -0
- package/dist/types/src/types/mask.d.ts +6 -6
- package/dist/types/src/utils/PopsDOMUtils.d.ts +2 -2
- package/dist/types/src/utils/PopsInstanceUtils.d.ts +22 -0
- package/dist/types/src/utils/PopsUtils.d.ts +21 -16
- package/package.json +1 -1
- package/src/Pops.ts +11 -11
- package/src/components/alert/defaultConfig.ts +1 -1
- package/src/components/alert/index.ts +1 -1
- package/src/components/confirm/defaultConfig.ts +1 -1
- package/src/components/confirm/index.ts +1 -1
- package/src/components/drawer/defaultConfig.ts +1 -1
- package/src/components/drawer/index.ts +2 -1
- package/src/components/folder/defaultConfig.ts +1 -1
- package/src/components/folder/index.ts +1 -1
- package/src/components/iframe/defaultConfig.ts +1 -1
- package/src/components/iframe/index.ts +10 -6
- package/src/components/loading/defaultConfig.ts +1 -0
- package/src/components/loading/index.ts +10 -10
- package/src/components/loading/types/index.ts +1 -4
- package/src/components/panel/defaultConfig.ts +1 -1
- package/src/components/panel/handlerComponents.ts +4 -4
- package/src/components/panel/index.ts +3 -2
- package/src/components/prompt/defaultConfig.ts +1 -1
- package/src/components/prompt/index.ts +1 -1
- package/src/components/rightClickMenu/defaultConfig.ts +1 -1
- package/src/components/rightClickMenu/index.ts +1 -1
- package/src/components/rightClickMenu/types/index.ts +1 -1
- package/src/components/searchSuggestion/defaultConfig.ts +1 -0
- package/src/components/searchSuggestion/index.ts +1 -1
- package/src/components/searchSuggestion/types/index.ts +1 -1
- package/src/components/tooltip/defaultConfig.ts +1 -1
- package/src/components/tooltip/index.ts +1 -1
- package/src/components/tooltip/types/index.ts +1 -1
- package/src/event/EventEmiter.ts +15 -14
- package/src/handler/PopsHandler.ts +9 -21
- package/src/handler/PopsInstHandler.ts +65 -47
- package/src/types/EventEmitter.d.ts +21 -0
- package/src/types/PopsDOMUtilsEventType.d.ts +1 -1
- package/src/types/components.d.ts +15 -18
- package/src/types/global.d.ts +2 -0
- package/src/types/mask.d.ts +6 -6
- package/src/utils/PopsDOMUtils.ts +6 -3
- package/src/utils/PopsInstanceUtils.ts +50 -0
- package/src/utils/PopsUtils.ts +95 -68
- package/dist/types/src/utils/PopsDOMUtilsEventsConfig.d.ts +0 -4
- package/src/utils/PopsDOMUtilsEventsConfig.ts +0 -4
|
@@ -15,4 +15,26 @@ export declare const PopsInstanceUtils: {
|
|
|
15
15
|
* @param sortByDesc 排序是否降序,默认降序
|
|
16
16
|
*/
|
|
17
17
|
sortElementListByProperty<T, R>(getBeforeValueFun: (value: T) => R, getAfterValueFun: (value: T) => R, sortByDesc?: boolean): (after_obj: T, before_obj: T) => 1 | 0 | -1;
|
|
18
|
+
/**
|
|
19
|
+
* 是否是隐藏状态
|
|
20
|
+
*
|
|
21
|
+
* 检测以下项:
|
|
22
|
+
*
|
|
23
|
+
* + `display`: none
|
|
24
|
+
* + `visibility`: hidden
|
|
25
|
+
* + `opacity`: 0
|
|
26
|
+
* + `使用了pops的自定义的隐藏class类`
|
|
27
|
+
* @param $el 需要检测的元素
|
|
28
|
+
*/
|
|
29
|
+
isHide($el: Element): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* 判断元素是否是在`.pops`内
|
|
32
|
+
* @param $el 目标元素
|
|
33
|
+
*/
|
|
34
|
+
isNodeInPopsNode($el: Element): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* 判断是否是`.pops-anim`元素
|
|
37
|
+
* @param $el 目标元素
|
|
38
|
+
*/
|
|
39
|
+
isAnimNode($el: Element): boolean;
|
|
18
40
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import AnyTouch from "any-touch";
|
|
2
1
|
import doubletap from "@any-touch/doubletap";
|
|
2
|
+
import AnyTouch from "any-touch";
|
|
3
3
|
declare class PopsUtils {
|
|
4
4
|
/**
|
|
5
5
|
* 超时时间
|
|
@@ -158,17 +158,26 @@ declare class PopsUtils {
|
|
|
158
158
|
/**
|
|
159
159
|
* 获取页面的坐标中最大的z-index的元素信息
|
|
160
160
|
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
* + 左上角(宽: 1/8,高: 1/8)
|
|
164
|
-
* + 右上角(宽: 7/8,高: 1/8)
|
|
165
|
-
* + 左下角(宽: 1/8,高: 7/8)
|
|
166
|
-
* + 右下角(宽: 7/8,高: 7/8)
|
|
167
|
-
* + 中间(宽: 1/2,高: 1/2)
|
|
161
|
+
* 矩阵坐标计算
|
|
168
162
|
* @param $el 仅检测目标元素最大的z-index(自动往上层找)
|
|
169
163
|
* @param deviation 将对所有获取到的z-index处理偏移量(增加或减少),默认为10
|
|
164
|
+
* @example
|
|
165
|
+
* Utils.getMaxZIndexNodeInfoFromPoint(document.querySelector("a"));
|
|
166
|
+
* @example
|
|
167
|
+
* Utils.getMaxZIndexNodeInfoFromPoint(document.querySelector("a"), 20);
|
|
168
|
+
* @example
|
|
169
|
+
* Utils.getMaxZIndexNodeInfoFromPoint([document.querySelector("a"), document.querySelector("div")]);
|
|
170
|
+
* @example
|
|
171
|
+
* Utils.getMaxZIndexNodeInfoFromPoint({x: 500, y: 500});
|
|
172
|
+
* @example
|
|
173
|
+
* Utils.getMaxZIndexNodeInfoFromPoint({x: 500, y: 500}, 20);
|
|
174
|
+
* @example
|
|
175
|
+
* Utils.getMaxZIndexNodeInfoFromPoint(() => {x: 500, y: 500}, 20);
|
|
170
176
|
*/
|
|
171
|
-
getMaxZIndexNodeInfoFromPoint($el?: IFunction<HTMLElement |
|
|
177
|
+
getMaxZIndexNodeInfoFromPoint($el?: IFunction<IArray<HTMLElement> | IArray<{
|
|
178
|
+
x: number;
|
|
179
|
+
y: number;
|
|
180
|
+
}>>, deviation?: number): {
|
|
172
181
|
/** 处理了偏移量后的z-index值 */
|
|
173
182
|
zIndex: number;
|
|
174
183
|
/** 原始z-index值 */
|
|
@@ -185,14 +194,10 @@ declare class PopsUtils {
|
|
|
185
194
|
/**
|
|
186
195
|
* 获取页面的坐标中最大的z-index的元素信息
|
|
187
196
|
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
* + 左上角(宽: 1/8,高: 1/8)
|
|
191
|
-
* + 右上角(宽: 7/8,高: 1/8)
|
|
192
|
-
* + 左下角(宽: 1/8,高: 7/8)
|
|
193
|
-
* + 右下角(宽: 7/8,高: 7/8)
|
|
194
|
-
* + 中间(宽: 1/2,高: 1/2)
|
|
197
|
+
* 矩阵坐标计算
|
|
195
198
|
* @param deviation 将对所有获取到的z-index处理偏移量(增加或减少)
|
|
199
|
+
* @example
|
|
200
|
+
* Utils.getMaxZIndexNodeInfoFromPoint(20);
|
|
196
201
|
*/
|
|
197
202
|
getMaxZIndexNodeInfoFromPoint(deviation: IFunction<number>): {
|
|
198
203
|
/** 处理了偏移量后的z-index值 */
|
package/package.json
CHANGED
package/src/Pops.ts
CHANGED
|
@@ -22,6 +22,7 @@ import { PopsSearchSuggestion } from "./components/searchSuggestion";
|
|
|
22
22
|
import type { PopsSearchSuggestionConfig } from "./components/searchSuggestion/types/index";
|
|
23
23
|
import { PopsTooltip } from "./components/tooltip";
|
|
24
24
|
import type { PopsToolTipConfig } from "./components/tooltip/types/index";
|
|
25
|
+
import { PopsCommonCSSClassName } from "./config/CommonCSSClassName";
|
|
25
26
|
import { GlobalConfig } from "./config/GlobalConfig";
|
|
26
27
|
import { EventEmiter } from "./event/EventEmiter";
|
|
27
28
|
import { PopsInstHandler } from "./handler/PopsInstHandler";
|
|
@@ -40,6 +41,7 @@ class Pops {
|
|
|
40
41
|
config = {
|
|
41
42
|
/** 版本号 */
|
|
42
43
|
version: version,
|
|
44
|
+
/** 样式配置 */
|
|
43
45
|
cssText: PopsCSS,
|
|
44
46
|
/** icon图标的svg代码 */
|
|
45
47
|
iconSVG: PopsIcon.$data,
|
|
@@ -47,12 +49,9 @@ class Pops {
|
|
|
47
49
|
animation: PopsAnimation.$data,
|
|
48
50
|
/** 存储已创建的元素 */
|
|
49
51
|
instData: PopsInstData,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return popsDOMUtils.preventEvent(event);
|
|
54
|
-
},
|
|
55
|
-
},
|
|
52
|
+
};
|
|
53
|
+
/** 导出的函数 */
|
|
54
|
+
fn = {
|
|
56
55
|
/** pops使用的工具类 */
|
|
57
56
|
Utils: popsUtils,
|
|
58
57
|
/** pops使用的DOM工具类 */
|
|
@@ -62,15 +61,16 @@ class Pops {
|
|
|
62
61
|
/** pops处理float类型使用的工具类 */
|
|
63
62
|
MathFloatUtils: PopsMathFloatUtils,
|
|
64
63
|
/** 实例处理函数 */
|
|
65
|
-
PopsInstHandler,
|
|
64
|
+
InstHandler: PopsInstHandler,
|
|
66
65
|
/** pops.panel中用于处理各个类型的工具 */
|
|
67
|
-
PanelHandlerComponents,
|
|
66
|
+
PanelHandlerComponents: PanelHandlerComponents,
|
|
68
67
|
/** pops.panel中的动画 */
|
|
69
|
-
PopsAnimation,
|
|
68
|
+
Animation: PopsAnimation,
|
|
70
69
|
/** 事件类 */
|
|
71
|
-
EventEmiter,
|
|
70
|
+
EventEmiter: EventEmiter,
|
|
71
|
+
/** 通用的CSS类名 */
|
|
72
|
+
CommonCSSClassName: PopsCommonCSSClassName,
|
|
72
73
|
};
|
|
73
|
-
init() {}
|
|
74
74
|
/**
|
|
75
75
|
* 释放原有的pops控制权
|
|
76
76
|
* @example
|
|
@@ -59,7 +59,7 @@ export const PopsAlertDefaultConfig = (): DeepRequired<PopsAlertConfig> => {
|
|
|
59
59
|
style: null,
|
|
60
60
|
lightStyle: null,
|
|
61
61
|
darkStyle: null,
|
|
62
|
-
beforeAppendToPageCallBack() {},
|
|
63
62
|
stopKeyDownEventPropagation: true,
|
|
63
|
+
emitter: null,
|
|
64
64
|
} as DeepRequired<PopsAlertConfig>;
|
|
65
65
|
};
|
|
@@ -16,13 +16,13 @@ export const PopsAlert = {
|
|
|
16
16
|
const guid = popsUtils.getRandomGUID();
|
|
17
17
|
// 设置当前类型
|
|
18
18
|
const popsType: PopsType = "alert";
|
|
19
|
-
const emitter = new EventEmiter<EventMap>(popsType);
|
|
20
19
|
|
|
21
20
|
let config = PopsAlertDefaultConfig();
|
|
22
21
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
23
22
|
config = popsUtils.assign(config, __config__);
|
|
24
23
|
config = PopsHandler.handleOnly(popsType, config);
|
|
25
24
|
|
|
25
|
+
const emitter = config.emitter ?? new EventEmiter<EventMap>(popsType);
|
|
26
26
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
27
27
|
PopsHandler.handleInit($shadowRoot, [
|
|
28
28
|
{
|
|
@@ -87,7 +87,7 @@ export const PopsConfirmDefaultConfig = (): DeepRequired<PopsConfirmConfig> => {
|
|
|
87
87
|
style: null,
|
|
88
88
|
lightStyle: null,
|
|
89
89
|
darkStyle: null,
|
|
90
|
-
beforeAppendToPageCallBack() {},
|
|
91
90
|
stopKeyDownEventPropagation: true,
|
|
91
|
+
emitter: null,
|
|
92
92
|
} as DeepRequired<PopsConfirmConfig>;
|
|
93
93
|
};
|
|
@@ -16,13 +16,13 @@ export const PopsConfirm = {
|
|
|
16
16
|
const guid = popsUtils.getRandomGUID();
|
|
17
17
|
// 设置当前类型
|
|
18
18
|
const popsType: PopsType = "confirm";
|
|
19
|
-
const emitter = new EventEmiter<EventMap>(popsType);
|
|
20
19
|
|
|
21
20
|
let config = PopsConfirmDefaultConfig();
|
|
22
21
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
23
22
|
config = popsUtils.assign(config, __config__);
|
|
24
23
|
config = PopsHandler.handleOnly(popsType, config);
|
|
25
24
|
|
|
25
|
+
const emitter = config.emitter ?? new EventEmiter<EventMap>(popsType);
|
|
26
26
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
27
27
|
PopsHandler.handleInit($shadowRoot, [
|
|
28
28
|
{
|
|
@@ -85,8 +85,8 @@ export const PopsDrawerDefaultConfig = (): DeepRequired<PopsDrawerConfig> => {
|
|
|
85
85
|
style: null,
|
|
86
86
|
lightStyle: null,
|
|
87
87
|
darkStyle: null,
|
|
88
|
-
beforeAppendToPageCallBack() {},
|
|
89
88
|
forbiddenScroll: false,
|
|
90
89
|
stopKeyDownEventPropagation: true,
|
|
90
|
+
emitter: null,
|
|
91
91
|
};
|
|
92
92
|
};
|
|
@@ -16,12 +16,13 @@ export const PopsDrawer = {
|
|
|
16
16
|
const guid = popsUtils.getRandomGUID();
|
|
17
17
|
// 设置当前类型
|
|
18
18
|
const popsType: PopsType = "drawer";
|
|
19
|
-
const emitter = new EventEmiter<EventMap>(popsType);
|
|
20
19
|
|
|
21
20
|
let config = PopsDrawerDefaultConfig();
|
|
22
21
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
23
22
|
config = popsUtils.assign(config, __config__);
|
|
24
23
|
config = PopsHandler.handleOnly(popsType, config);
|
|
24
|
+
|
|
25
|
+
const emitter = config.emitter ?? new EventEmiter<EventMap>(popsType);
|
|
25
26
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
26
27
|
PopsHandler.handleInit($shadowRoot, [
|
|
27
28
|
{
|
|
@@ -19,13 +19,13 @@ export const PopsFolder = {
|
|
|
19
19
|
const guid = popsUtils.getRandomGUID();
|
|
20
20
|
// 设置当前类型
|
|
21
21
|
const popsType: PopsType = "folder";
|
|
22
|
-
const emitter = new EventEmiter<EventMap>(popsType);
|
|
23
22
|
|
|
24
23
|
let config = PopsFolderDefaultConfig();
|
|
25
24
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
26
25
|
config = popsUtils.assign(config, __config__);
|
|
27
26
|
config = PopsHandler.handleOnly(popsType, config);
|
|
28
27
|
|
|
28
|
+
const emitter = config.emitter ?? new EventEmiter<EventMap>(popsType);
|
|
29
29
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
30
30
|
PopsHandler.handleInit($shadowRoot, [
|
|
31
31
|
{
|
|
@@ -16,11 +16,7 @@ export const PopsIframe = {
|
|
|
16
16
|
const guid = popsUtils.getRandomGUID();
|
|
17
17
|
// 设置当前类型
|
|
18
18
|
const popsType: PopsType = "iframe";
|
|
19
|
-
|
|
20
|
-
"pops:iframe-min": (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
|
|
21
|
-
"pops:iframe-mise": (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
|
|
22
|
-
"pops:iframe-max": (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
|
|
23
|
-
}>(popsType);
|
|
19
|
+
|
|
24
20
|
let config = PopsIframeDefaultConfig();
|
|
25
21
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
26
22
|
config = popsUtils.assign(config, __config__);
|
|
@@ -29,6 +25,13 @@ export const PopsIframe = {
|
|
|
29
25
|
}
|
|
30
26
|
config = PopsHandler.handleOnly(popsType, config);
|
|
31
27
|
|
|
28
|
+
const emitter =
|
|
29
|
+
config.emitter ??
|
|
30
|
+
new EventEmiter<{
|
|
31
|
+
"pops:iframe-min": (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
|
|
32
|
+
"pops:iframe-mise": (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
|
|
33
|
+
"pops:iframe-max": (eventConfig: PopsIframeClickEventConfig, event: MouseEvent | PointerEvent) => void;
|
|
34
|
+
}>(popsType);
|
|
32
35
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
33
36
|
PopsHandler.handleInit($shadowRoot, [
|
|
34
37
|
{
|
|
@@ -57,7 +60,8 @@ export const PopsIframe = {
|
|
|
57
60
|
},
|
|
58
61
|
]);
|
|
59
62
|
|
|
60
|
-
const maskExtraStyle =
|
|
63
|
+
const maskExtraStyle =
|
|
64
|
+
config.animation != null && <string>config.animation != "" && config.animation ? "position:absolute;" : "";
|
|
61
65
|
|
|
62
66
|
// 先把z-index提取出来
|
|
63
67
|
const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
|
|
@@ -13,14 +13,14 @@ export const PopsLoading = {
|
|
|
13
13
|
init(__config__: PopsLoadingConfig) {
|
|
14
14
|
const guid = popsUtils.getRandomGUID();
|
|
15
15
|
// 设置当前类型
|
|
16
|
-
const
|
|
17
|
-
const emitter = new EventEmiter<EventMap>(PopsType);
|
|
16
|
+
const popsType = "loading";
|
|
18
17
|
|
|
19
18
|
let config = PopsLoadingDefaultConfig();
|
|
20
19
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
21
20
|
config = popsUtils.assign(config, __config__);
|
|
22
|
-
config = PopsHandler.handleOnly(
|
|
21
|
+
config = PopsHandler.handleOnly(popsType, config);
|
|
23
22
|
|
|
23
|
+
const emitter = config.emitter ?? new EventEmiter<EventMap>(popsType);
|
|
24
24
|
// 先把z-index提取出来
|
|
25
25
|
const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
|
|
26
26
|
const maskHTML = PopsElementHandler.createMask(guid, zIndex);
|
|
@@ -28,10 +28,10 @@ export const PopsLoading = {
|
|
|
28
28
|
const { contentPStyle } = PopsElementHandler.createContentStyle("loading", config);
|
|
29
29
|
const animHTML = PopsElementHandler.createAnim(
|
|
30
30
|
guid,
|
|
31
|
-
|
|
31
|
+
popsType,
|
|
32
32
|
config,
|
|
33
33
|
/*html*/ `
|
|
34
|
-
<div class="pops-content pops-${
|
|
34
|
+
<div class="pops-content pops-${popsType}-content">${
|
|
35
35
|
config.addIndexCSS
|
|
36
36
|
? /*html*/ `
|
|
37
37
|
<style data-model-name="index">${PopsCSS.index}</style>
|
|
@@ -44,7 +44,7 @@ export const PopsLoading = {
|
|
|
44
44
|
${PopsCSS.loadingCSS}
|
|
45
45
|
</style>
|
|
46
46
|
${config.style != null ? `<style>${config.style}</style>` : ""}
|
|
47
|
-
<p pops class="pops-${
|
|
47
|
+
<p pops class="pops-${popsType}-content-text" style="${contentPStyle}">${config.content.text}</p>
|
|
48
48
|
</div>`,
|
|
49
49
|
"",
|
|
50
50
|
zIndex
|
|
@@ -56,7 +56,7 @@ export const PopsLoading = {
|
|
|
56
56
|
|
|
57
57
|
const $anim = PopsElementHandler.parseElement<HTMLDivElement>(animHTML);
|
|
58
58
|
|
|
59
|
-
const { $pops: $pops } = PopsHandler.handleQueryElement($anim,
|
|
59
|
+
const { $pops: $pops } = PopsHandler.handleQueryElement($anim, popsType);
|
|
60
60
|
/**
|
|
61
61
|
* 遮罩层元素
|
|
62
62
|
*/
|
|
@@ -69,7 +69,7 @@ export const PopsLoading = {
|
|
|
69
69
|
if (config.mask.enable) {
|
|
70
70
|
// 创建遮罩层
|
|
71
71
|
const handleMask = PopsHandler.handleMask({
|
|
72
|
-
type:
|
|
72
|
+
type: popsType,
|
|
73
73
|
guid: guid,
|
|
74
74
|
|
|
75
75
|
config: config,
|
|
@@ -79,12 +79,12 @@ export const PopsLoading = {
|
|
|
79
79
|
$mask = handleMask.maskElement;
|
|
80
80
|
$elList.push($mask);
|
|
81
81
|
}
|
|
82
|
-
const evtConfig = PopsHandler.handleLoadingEventConfig(config, guid,
|
|
82
|
+
const evtConfig = PopsHandler.handleLoadingEventConfig(config, guid, popsType, $anim, $pops, emitter, $mask);
|
|
83
83
|
popsDOMUtils.append(config.$parent, $elList);
|
|
84
84
|
if ($mask != null) {
|
|
85
85
|
$anim.after($mask);
|
|
86
86
|
}
|
|
87
|
-
PopsHandler.handlePush(
|
|
87
|
+
PopsHandler.handlePush(popsType, {
|
|
88
88
|
$shadowContainer: $pops,
|
|
89
89
|
$shadowRoot: $pops,
|
|
90
90
|
guid: guid,
|
|
@@ -3,10 +3,7 @@ import type { PopsGeneralConfig, PopsContentConfig } from "../../../types/compon
|
|
|
3
3
|
/**
|
|
4
4
|
* pops.loading
|
|
5
5
|
*/
|
|
6
|
-
export interface PopsLoadingConfig extends Omit<
|
|
7
|
-
PopsGeneralConfig,
|
|
8
|
-
"width" | "height" | "position" | "beforeAppendToPageCallBack"
|
|
9
|
-
> {
|
|
6
|
+
export interface PopsLoadingConfig extends Omit<PopsGeneralConfig, "width" | "height" | "position"> {
|
|
10
7
|
/**
|
|
11
8
|
* 父元素,默认为document.body
|
|
12
9
|
* @default document.body || document.documentElement
|
|
@@ -865,8 +865,8 @@ export const PopsPanelDefaultConfig = (): DeepRequired<PopsPanelConfig> => {
|
|
|
865
865
|
style: null,
|
|
866
866
|
lightStyle: null,
|
|
867
867
|
darkStyle: null,
|
|
868
|
-
beforeAppendToPageCallBack() {},
|
|
869
868
|
stopKeyDownEventPropagation: true,
|
|
870
869
|
listenEscapeKeyUpToExitDeepMenu: true,
|
|
870
|
+
emitter: null,
|
|
871
871
|
};
|
|
872
872
|
};
|
|
@@ -1963,12 +1963,12 @@ export const PanelHandlerComponents = () => {
|
|
|
1963
1963
|
},
|
|
1964
1964
|
mask: {
|
|
1965
1965
|
enable: true,
|
|
1966
|
-
clickCallBack(
|
|
1966
|
+
clickCallBack(continueExec) {
|
|
1967
1967
|
const ret = dialogCloseCallback();
|
|
1968
1968
|
if (typeof ret === "boolean" && !ret) {
|
|
1969
1969
|
return;
|
|
1970
1970
|
}
|
|
1971
|
-
|
|
1971
|
+
continueExec();
|
|
1972
1972
|
},
|
|
1973
1973
|
clickEvent: {
|
|
1974
1974
|
toClose: true,
|
|
@@ -3171,8 +3171,8 @@ export const PanelHandlerComponents = () => {
|
|
|
3171
3171
|
},
|
|
3172
3172
|
mask: {
|
|
3173
3173
|
enable: true,
|
|
3174
|
-
clickCallBack(
|
|
3175
|
-
|
|
3174
|
+
clickCallBack(continueExec) {
|
|
3175
|
+
continueExec();
|
|
3176
3176
|
dialogCloseCallback();
|
|
3177
3177
|
},
|
|
3178
3178
|
clickEvent: {
|
|
@@ -4,25 +4,26 @@ import { PopsElementHandler } from "../../handler/PopsElementHandler";
|
|
|
4
4
|
import { PopsHandler } from "../../handler/PopsHandler";
|
|
5
5
|
import { PopsInstHandler } from "../../handler/PopsInstHandler";
|
|
6
6
|
import { PopsCSS } from "../../PopsCSS";
|
|
7
|
+
import type { EventMap } from "../../types/EventEmitter";
|
|
7
8
|
import type { PopsType } from "../../types/main";
|
|
8
9
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
9
10
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
10
11
|
import { PopsPanelDefaultConfig } from "./defaultConfig";
|
|
11
12
|
import { PanelHandlerComponents } from "./handlerComponents";
|
|
12
|
-
import type { PopsPanelConfig
|
|
13
|
+
import type { PopsPanelConfig } from "./types";
|
|
13
14
|
|
|
14
15
|
export const PopsPanel = {
|
|
15
16
|
init(__config__: PopsPanelConfig) {
|
|
16
17
|
const guid = popsUtils.getRandomGUID();
|
|
17
18
|
// 设置当前类型
|
|
18
19
|
const popsType: PopsType = "panel";
|
|
19
|
-
const emitter = new EventEmiter<PopsPanelEventType>(popsType);
|
|
20
20
|
|
|
21
21
|
let config: Required<PopsPanelConfig> = PopsPanelDefaultConfig();
|
|
22
22
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
23
23
|
config = popsUtils.assign(config, __config__);
|
|
24
24
|
config = PopsHandler.handleOnly(popsType, config);
|
|
25
25
|
|
|
26
|
+
const emitter = config.emitter ?? new EventEmiter<EventMap>(popsType);
|
|
26
27
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
27
28
|
PopsHandler.handleInit($shadowRoot, [
|
|
28
29
|
{
|
|
@@ -16,13 +16,13 @@ export const PopsPrompt = {
|
|
|
16
16
|
const guid = popsUtils.getRandomGUID();
|
|
17
17
|
// 设置当前类型
|
|
18
18
|
const popsType: PopsType = "prompt";
|
|
19
|
-
const emitter = new EventEmiter<EventMap>(popsType);
|
|
20
19
|
|
|
21
20
|
let config = PopsPromptDefaultConfig();
|
|
22
21
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
23
22
|
config = popsUtils.assign(config, __config__);
|
|
24
23
|
config = PopsHandler.handleOnly(popsType, config);
|
|
25
24
|
|
|
25
|
+
const emitter = config.emitter ?? new EventEmiter<EventMap>(popsType);
|
|
26
26
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
27
27
|
PopsHandler.handleInit($shadowRoot, [
|
|
28
28
|
{
|
|
@@ -97,9 +97,9 @@ export const PopsRightClickMenuDefaultConfig = (): DeepRequired<PopsRightClickMe
|
|
|
97
97
|
style: null,
|
|
98
98
|
lightStyle: null,
|
|
99
99
|
darkStyle: null,
|
|
100
|
-
beforeAppendToPageCallBack() {},
|
|
101
100
|
limitPositionXInView: true,
|
|
102
101
|
limitPositionYInView: true,
|
|
103
102
|
beforeShowCallBack() {},
|
|
103
|
+
emitter: null,
|
|
104
104
|
};
|
|
105
105
|
};
|
|
@@ -24,13 +24,13 @@ export const PopsRightClickMenu = {
|
|
|
24
24
|
const guid = popsUtils.getRandomGUID();
|
|
25
25
|
// 设置当前类型
|
|
26
26
|
const popsType: PopsType = "rightClickMenu";
|
|
27
|
-
const emitter = new EventEmiter<EventMap>(popsType);
|
|
28
27
|
|
|
29
28
|
let config = PopsRightClickMenuDefaultConfig();
|
|
30
29
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
31
30
|
config = popsUtils.assign(config, __config__);
|
|
32
31
|
config = PopsHandler.handleOnly(popsType, config);
|
|
33
32
|
|
|
33
|
+
const emitter = config.emitter ?? new EventEmiter<EventMap>(popsType);
|
|
34
34
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
35
35
|
PopsHandler.handleInit($shadowRoot, [
|
|
36
36
|
{
|
|
@@ -70,7 +70,7 @@ export interface PopsRightClickMenuDataConfig {
|
|
|
70
70
|
*/
|
|
71
71
|
export interface PopsRightClickMenuConfig extends Pick<
|
|
72
72
|
PopsGeneralConfig,
|
|
73
|
-
"useShadowRoot" | "
|
|
73
|
+
"useShadowRoot" | "zIndex" | "style" | "lightStyle" | "darkStyle" | "only" | "emitter"
|
|
74
74
|
> {
|
|
75
75
|
/**
|
|
76
76
|
* 目标元素
|
|
@@ -17,7 +17,6 @@ export const PopsSearchSuggestion = {
|
|
|
17
17
|
const guid = popsUtils.getRandomGUID();
|
|
18
18
|
// 设置当前类型
|
|
19
19
|
const popsType: PopsType = "searchSuggestion";
|
|
20
|
-
const emitter = new EventEmiter<EventMap>(popsType);
|
|
21
20
|
|
|
22
21
|
let config = PopsSearchSuggestionDefaultConfig();
|
|
23
22
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
@@ -27,6 +26,7 @@ export const PopsSearchSuggestion = {
|
|
|
27
26
|
config.$inputTarget = config.$target as HTMLInputElement;
|
|
28
27
|
}
|
|
29
28
|
|
|
29
|
+
const emitter = config.emitter ?? new EventEmiter<EventMap>(popsType);
|
|
30
30
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
31
31
|
PopsHandler.handleInit($shadowRoot, [
|
|
32
32
|
{
|
|
@@ -106,7 +106,7 @@ export type PopsSearchSuggestionData<T> = {
|
|
|
106
106
|
*/
|
|
107
107
|
export interface PopsSearchSuggestionConfig<T = any> extends Pick<
|
|
108
108
|
PopsGeneralConfig,
|
|
109
|
-
"useShadowRoot" | "zIndex" | "style" | "lightStyle" | "darkStyle"
|
|
109
|
+
"useShadowRoot" | "zIndex" | "style" | "lightStyle" | "darkStyle" | "emitter"
|
|
110
110
|
> {
|
|
111
111
|
/**
|
|
112
112
|
* 当前的环境,可以是document,可以是shadowroot,默认是document
|
|
@@ -558,7 +558,6 @@ export const PopsTooltip = {
|
|
|
558
558
|
const guid = popsUtils.getRandomGUID();
|
|
559
559
|
// 设置当前类型
|
|
560
560
|
const popsType: PopsType = "tooltip";
|
|
561
|
-
const emitter = new EventEmiter<EventMap>(popsType);
|
|
562
561
|
|
|
563
562
|
let config = PopsTooltipDefaultConfig();
|
|
564
563
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
@@ -577,6 +576,7 @@ export const PopsTooltip = {
|
|
|
577
576
|
});
|
|
578
577
|
}
|
|
579
578
|
|
|
579
|
+
const emitter = config.emitter ?? new EventEmiter<EventMap>(popsType);
|
|
580
580
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
581
581
|
PopsHandler.handleInit($shadowRoot, [
|
|
582
582
|
{
|
|
@@ -9,7 +9,7 @@ export type PopsTooltipPosition = "top" | "right" | "bottom" | "left" | "follow"
|
|
|
9
9
|
*/
|
|
10
10
|
export interface PopsToolTipConfig extends Pick<
|
|
11
11
|
PopsGeneralConfig,
|
|
12
|
-
"useShadowRoot" | "only" | "zIndex" | "style" | "lightStyle" | "darkStyle" | "
|
|
12
|
+
"useShadowRoot" | "only" | "zIndex" | "style" | "lightStyle" | "darkStyle" | "emitter"
|
|
13
13
|
> {
|
|
14
14
|
/**
|
|
15
15
|
* 目标元素
|