@whitesev/pops 3.3.4 → 4.0.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 +13118 -12906
- 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 +805 -593
- 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 +805 -593
- 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 +13119 -12907
- 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 +13122 -12910
- 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 +13121 -12909
- 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 +61 -46
- package/dist/types/src/PopsAnimation.d.ts +33 -0
- package/dist/types/src/PopsIcon.d.ts +1 -1
- package/dist/types/src/components/alert/index.d.ts +3 -1
- package/dist/types/src/components/confirm/index.d.ts +3 -1
- package/dist/types/src/components/drawer/index.d.ts +3 -1
- package/dist/types/src/components/folder/index.d.ts +3 -1
- package/dist/types/src/components/folder/types/index.d.ts +4 -0
- package/dist/types/src/components/iframe/index.d.ts +6 -1
- package/dist/types/src/components/iframe/types/index.d.ts +4 -2
- package/dist/types/src/components/loading/index.d.ts +3 -1
- package/dist/types/src/components/panel/handlerComponents.d.ts +4 -1
- package/dist/types/src/components/panel/index.d.ts +2 -16
- package/dist/types/src/components/panel/types/index.d.ts +7 -2
- package/dist/types/src/components/prompt/index.d.ts +3 -1
- package/dist/types/src/components/searchSuggestion/index.d.ts +4 -1
- package/dist/types/src/components/tooltip/index.d.ts +6 -2
- package/dist/types/src/config/GlobalConfig.d.ts +1 -0
- package/dist/types/src/event/EventEmiter.d.ts +33 -0
- package/dist/types/src/handler/PopsHandler.d.ts +18 -16
- package/dist/types/src/handler/PopsInstHandler.d.ts +67 -0
- package/dist/types/src/types/EventEmitter.d.ts +18 -0
- package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +4 -0
- package/dist/types/src/types/button.d.ts +2 -1
- package/dist/types/src/types/components.d.ts +7 -0
- package/dist/types/src/types/event.d.ts +6 -2
- package/dist/types/src/types/inst.d.ts +4 -4
- package/dist/types/src/utils/PopsDOMUtils.d.ts +0 -16
- package/dist/types/src/utils/PopsInstanceUtils.d.ts +0 -88
- package/dist/types/src/utils/PopsUtils.d.ts +57 -0
- package/package.json +3 -3
- package/src/Pops.ts +7 -2
- package/src/PopsAnimation.ts +126 -0
- package/src/components/alert/defaultConfig.ts +1 -0
- package/src/components/alert/index.ts +9 -9
- package/src/components/confirm/defaultConfig.ts +1 -0
- package/src/components/confirm/index.ts +9 -9
- package/src/components/drawer/defaultConfig.ts +1 -0
- package/src/components/drawer/index.ts +12 -9
- package/src/components/folder/defaultConfig.ts +1 -0
- package/src/components/folder/index.ts +9 -8
- package/src/components/folder/types/index.ts +4 -0
- package/src/components/iframe/defaultConfig.ts +1 -0
- package/src/components/iframe/index.ts +18 -12
- package/src/components/iframe/types/index.ts +10 -8
- package/src/components/loading/defaultConfig.ts +1 -0
- package/src/components/loading/index.ts +12 -6
- package/src/components/panel/defaultConfig.ts +2 -0
- package/src/components/panel/handlerComponents.ts +41 -111
- package/src/components/panel/index.ts +34 -28
- package/src/components/panel/types/index.ts +7 -2
- package/src/components/prompt/defaultConfig.ts +1 -0
- package/src/components/prompt/index.ts +9 -8
- package/src/components/rightClickMenu/index.ts +17 -14
- package/src/components/searchSuggestion/index.ts +5 -1
- package/src/components/tooltip/index.ts +20 -10
- package/src/event/EventEmiter.ts +95 -0
- package/src/handler/PopsElementHandler.ts +6 -4
- package/src/handler/PopsHandler.ts +100 -58
- package/src/handler/PopsInstHandler.ts +557 -0
- package/src/types/EventEmitter.d.ts +18 -0
- package/src/types/PopsDOMUtilsEventType.d.ts +4 -0
- package/src/types/button.d.ts +2 -1
- package/src/types/components.d.ts +7 -0
- package/src/types/event.d.ts +6 -2
- package/src/types/inst.d.ts +4 -4
- package/src/utils/PopsDOMUtils.ts +1 -40
- package/src/utils/PopsInstanceUtils.ts +19 -627
- package/src/utils/PopsUtils.ts +194 -0
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { GlobalConfig } from "../../config/GlobalConfig";
|
|
2
|
+
import { EventEmiter } from "../../event/EventEmiter";
|
|
2
3
|
import { PopsElementHandler } from "../../handler/PopsElementHandler";
|
|
3
4
|
import { PopsHandler } from "../../handler/PopsHandler";
|
|
5
|
+
import { PopsInstHandler } from "../../handler/PopsInstHandler";
|
|
4
6
|
import { PopsCSS } from "../../PopsCSS";
|
|
7
|
+
import type { EventMap } from "../../types/EventEmitter";
|
|
5
8
|
import type { PopsType } from "../../types/main";
|
|
6
9
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
7
|
-
import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
|
|
8
10
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
9
11
|
import { PopsAlertDefaultConfig } from "./defaultConfig";
|
|
10
12
|
import type { PopsAlertConfig } from "./types";
|
|
@@ -14,6 +16,7 @@ export const PopsAlert = {
|
|
|
14
16
|
const guid = popsUtils.getRandomGUID();
|
|
15
17
|
// 设置当前类型
|
|
16
18
|
const popsType: PopsType = "alert";
|
|
19
|
+
const emitter = new EventEmiter<EventMap>(popsType);
|
|
17
20
|
|
|
18
21
|
let config = PopsAlertDefaultConfig();
|
|
19
22
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
@@ -53,7 +56,7 @@ export const PopsAlert = {
|
|
|
53
56
|
]);
|
|
54
57
|
|
|
55
58
|
// 先把z-index提取出来
|
|
56
|
-
const zIndex = PopsHandler.
|
|
59
|
+
const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
|
|
57
60
|
const maskHTML = PopsElementHandler.createMask(guid, zIndex);
|
|
58
61
|
const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
|
|
59
62
|
const bottomBtnHTML = PopsElementHandler.createBottom(popsType, config);
|
|
@@ -116,6 +119,7 @@ export const PopsAlert = {
|
|
|
116
119
|
popsType,
|
|
117
120
|
$anim,
|
|
118
121
|
$pops,
|
|
122
|
+
emitter,
|
|
119
123
|
$mask
|
|
120
124
|
);
|
|
121
125
|
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
@@ -125,12 +129,8 @@ export const PopsAlert = {
|
|
|
125
129
|
PopsHandler.handleClickEvent("ok", btnOkElement, evtConfig, config.btn.ok?.callback);
|
|
126
130
|
|
|
127
131
|
// 创建到页面中
|
|
128
|
-
|
|
129
132
|
popsDOMUtils.append($shadowRoot, $elList);
|
|
130
|
-
|
|
131
|
-
config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
|
|
132
|
-
}
|
|
133
|
-
|
|
133
|
+
emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
|
|
134
134
|
popsDOMUtils.appendBody($shadowContainer);
|
|
135
135
|
if ($mask != null) {
|
|
136
136
|
// 添加遮罩层
|
|
@@ -145,11 +145,11 @@ export const PopsAlert = {
|
|
|
145
145
|
$shadowContainer: $shadowContainer,
|
|
146
146
|
$shadowRoot: $shadowRoot,
|
|
147
147
|
config: config,
|
|
148
|
-
|
|
148
|
+
emitter,
|
|
149
149
|
});
|
|
150
150
|
// 拖拽
|
|
151
151
|
if (config.drag) {
|
|
152
|
-
|
|
152
|
+
PopsInstHandler.drag($pops!, {
|
|
153
153
|
dragElement: $title!,
|
|
154
154
|
limit: config.dragLimit,
|
|
155
155
|
extraDistance: config.dragExtraDistance!,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { GlobalConfig } from "../../config/GlobalConfig";
|
|
2
|
+
import { EventEmiter } from "../../event/EventEmiter";
|
|
2
3
|
import { PopsElementHandler } from "../../handler/PopsElementHandler";
|
|
3
4
|
import { PopsHandler } from "../../handler/PopsHandler";
|
|
5
|
+
import { PopsInstHandler } from "../../handler/PopsInstHandler";
|
|
4
6
|
import { PopsCSS } from "../../PopsCSS";
|
|
7
|
+
import type { EventMap } from "../../types/EventEmitter";
|
|
5
8
|
import type { PopsType } from "../../types/main";
|
|
6
9
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
7
|
-
import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
|
|
8
10
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
9
11
|
import { PopsConfirmDefaultConfig } from "./defaultConfig";
|
|
10
12
|
import type { PopsConfirmConfig } from "./types";
|
|
@@ -14,6 +16,7 @@ export const PopsConfirm = {
|
|
|
14
16
|
const guid = popsUtils.getRandomGUID();
|
|
15
17
|
// 设置当前类型
|
|
16
18
|
const popsType: PopsType = "confirm";
|
|
19
|
+
const emitter = new EventEmiter<EventMap>(popsType);
|
|
17
20
|
|
|
18
21
|
let config = PopsConfirmDefaultConfig();
|
|
19
22
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
@@ -53,7 +56,7 @@ export const PopsConfirm = {
|
|
|
53
56
|
]);
|
|
54
57
|
|
|
55
58
|
// 先把z-index提取出来
|
|
56
|
-
const zIndex = PopsHandler.
|
|
59
|
+
const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
|
|
57
60
|
const maskHTML = PopsElementHandler.createMask(guid, zIndex);
|
|
58
61
|
|
|
59
62
|
const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
|
|
@@ -121,6 +124,7 @@ export const PopsConfirm = {
|
|
|
121
124
|
popsType,
|
|
122
125
|
$anim,
|
|
123
126
|
$pops,
|
|
127
|
+
emitter,
|
|
124
128
|
$mask
|
|
125
129
|
);
|
|
126
130
|
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
@@ -130,12 +134,8 @@ export const PopsConfirm = {
|
|
|
130
134
|
PopsHandler.handleClickEvent("other", $btnOther, evtConfig, config.btn.other.callback);
|
|
131
135
|
|
|
132
136
|
// 创建到页面中
|
|
133
|
-
|
|
134
137
|
popsDOMUtils.append($shadowRoot, $elList);
|
|
135
|
-
|
|
136
|
-
config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
|
|
137
|
-
}
|
|
138
|
-
|
|
138
|
+
emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
|
|
139
139
|
popsDOMUtils.appendBody($shadowContainer);
|
|
140
140
|
if ($mask != null) {
|
|
141
141
|
$anim.after($mask);
|
|
@@ -148,11 +148,11 @@ export const PopsConfirm = {
|
|
|
148
148
|
$shadowContainer: $shadowContainer,
|
|
149
149
|
$shadowRoot: $shadowRoot,
|
|
150
150
|
config: config,
|
|
151
|
-
|
|
151
|
+
emitter,
|
|
152
152
|
});
|
|
153
153
|
// 拖拽
|
|
154
154
|
if (config.drag) {
|
|
155
|
-
|
|
155
|
+
PopsInstHandler.drag($pops!, {
|
|
156
156
|
dragElement: $title!,
|
|
157
157
|
limit: config.dragLimit,
|
|
158
158
|
extraDistance: config.dragExtraDistance,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { GlobalConfig } from "../../config/GlobalConfig";
|
|
2
|
+
import { EventEmiter } from "../../event/EventEmiter";
|
|
2
3
|
import { PopsElementHandler } from "../../handler/PopsElementHandler";
|
|
3
4
|
import { PopsHandler } from "../../handler/PopsHandler";
|
|
4
5
|
import { PopsCSS } from "../../PopsCSS";
|
|
5
6
|
import type { PopsHandlerEventConfig } from "../../types/event";
|
|
7
|
+
import type { EventMap } from "../../types/EventEmitter";
|
|
6
8
|
import type { PopsType } from "../../types/main";
|
|
7
9
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
8
10
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
@@ -14,12 +16,12 @@ export const PopsDrawer = {
|
|
|
14
16
|
const guid = popsUtils.getRandomGUID();
|
|
15
17
|
// 设置当前类型
|
|
16
18
|
const popsType: PopsType = "drawer";
|
|
19
|
+
const emitter = new EventEmiter<EventMap>(popsType);
|
|
17
20
|
|
|
18
21
|
let config = PopsDrawerDefaultConfig();
|
|
19
22
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
20
23
|
config = popsUtils.assign(config, __config__);
|
|
21
24
|
config = PopsHandler.handleOnly(popsType, config);
|
|
22
|
-
|
|
23
25
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
24
26
|
PopsHandler.handleInit($shadowRoot, [
|
|
25
27
|
{
|
|
@@ -53,7 +55,7 @@ export const PopsDrawer = {
|
|
|
53
55
|
]);
|
|
54
56
|
|
|
55
57
|
// 先把z-index提取出来
|
|
56
|
-
const zIndex = PopsHandler.
|
|
58
|
+
const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
|
|
57
59
|
const maskHTML = PopsElementHandler.createMask(guid, zIndex);
|
|
58
60
|
|
|
59
61
|
const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
|
|
@@ -126,6 +128,7 @@ export const PopsDrawer = {
|
|
|
126
128
|
popsType,
|
|
127
129
|
$anim,
|
|
128
130
|
$pops,
|
|
131
|
+
emitter,
|
|
129
132
|
$mask
|
|
130
133
|
);
|
|
131
134
|
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
@@ -155,13 +158,16 @@ export const PopsDrawer = {
|
|
|
155
158
|
|
|
156
159
|
// 按下Esc键触发关闭
|
|
157
160
|
if (config.closeOnPressEscape) {
|
|
158
|
-
PopsHandler.handleKeyboardEvent("Escape", [], function () {
|
|
161
|
+
const listener = PopsHandler.handleKeyboardEvent("Escape", [], function () {
|
|
159
162
|
evtConfig.close();
|
|
160
163
|
});
|
|
164
|
+
emitter.on("pops:destory", () => {
|
|
165
|
+
listener.off();
|
|
166
|
+
});
|
|
161
167
|
}
|
|
162
168
|
// 待处理的点击事件列表
|
|
163
169
|
const needHandleClickEventList: {
|
|
164
|
-
type: PopsHandlerEventConfig["type"];
|
|
170
|
+
type: PopsHandlerEventConfig<typeof emitter>["type"];
|
|
165
171
|
ele: HTMLElement;
|
|
166
172
|
}[] = [
|
|
167
173
|
{
|
|
@@ -215,10 +221,7 @@ export const PopsDrawer = {
|
|
|
215
221
|
// 创建到页面中
|
|
216
222
|
|
|
217
223
|
popsDOMUtils.append($shadowRoot, $elList);
|
|
218
|
-
|
|
219
|
-
config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
|
|
220
|
-
}
|
|
221
|
-
|
|
224
|
+
emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
|
|
222
225
|
popsDOMUtils.appendBody($shadowContainer);
|
|
223
226
|
popsUtils.setTimeout(() => {
|
|
224
227
|
popsUtils.setTimeout(() => {
|
|
@@ -238,7 +241,7 @@ export const PopsDrawer = {
|
|
|
238
241
|
$shadowContainer: $shadowContainer,
|
|
239
242
|
$shadowRoot: $shadowRoot,
|
|
240
243
|
config: config,
|
|
241
|
-
|
|
244
|
+
emitter: emitter,
|
|
242
245
|
});
|
|
243
246
|
return result;
|
|
244
247
|
},
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { GlobalConfig } from "../../config/GlobalConfig";
|
|
2
|
+
import { EventEmiter } from "../../event/EventEmiter";
|
|
2
3
|
import { PopsElementHandler } from "../../handler/PopsElementHandler";
|
|
3
4
|
import { PopsHandler } from "../../handler/PopsHandler";
|
|
5
|
+
import { PopsInstHandler } from "../../handler/PopsInstHandler";
|
|
4
6
|
import { PopsCSS } from "../../PopsCSS";
|
|
7
|
+
import type { EventMap } from "../../types/EventEmitter";
|
|
5
8
|
import type { PopsType } from "../../types/main";
|
|
6
9
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
7
|
-
import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
|
|
8
10
|
import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
|
|
9
11
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
10
12
|
import { PopsLoading } from "../loading";
|
|
@@ -17,6 +19,7 @@ export const PopsFolder = {
|
|
|
17
19
|
const guid = popsUtils.getRandomGUID();
|
|
18
20
|
// 设置当前类型
|
|
19
21
|
const popsType: PopsType = "folder";
|
|
22
|
+
const emitter = new EventEmiter<EventMap>(popsType);
|
|
20
23
|
|
|
21
24
|
let config = PopsFolderDefaultConfig();
|
|
22
25
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
@@ -110,7 +113,7 @@ export const PopsFolder = {
|
|
|
110
113
|
}
|
|
111
114
|
|
|
112
115
|
// 先把z-index提取出来
|
|
113
|
-
const zIndex = PopsHandler.
|
|
116
|
+
const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
|
|
114
117
|
const maskHTML = PopsElementHandler.createMask(guid, zIndex);
|
|
115
118
|
|
|
116
119
|
const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
|
|
@@ -278,6 +281,7 @@ export const PopsFolder = {
|
|
|
278
281
|
popsType,
|
|
279
282
|
$anim,
|
|
280
283
|
$pops,
|
|
284
|
+
emitter,
|
|
281
285
|
$mask
|
|
282
286
|
);
|
|
283
287
|
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
@@ -288,10 +292,7 @@ export const PopsFolder = {
|
|
|
288
292
|
// 创建到页面中
|
|
289
293
|
|
|
290
294
|
popsDOMUtils.append($shadowRoot, $elList);
|
|
291
|
-
|
|
292
|
-
config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
+
emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
|
|
295
296
|
popsDOMUtils.appendBody($shadowContainer);
|
|
296
297
|
if ($mask != null) {
|
|
297
298
|
$anim.after($mask);
|
|
@@ -955,7 +956,7 @@ export const PopsFolder = {
|
|
|
955
956
|
Reflect.set($pops, "data-pops-folder", popsFolder);
|
|
956
957
|
// 拖拽
|
|
957
958
|
if (config.drag) {
|
|
958
|
-
|
|
959
|
+
PopsInstHandler.drag($pops, {
|
|
959
960
|
dragElement: $title,
|
|
960
961
|
limit: config.dragLimit,
|
|
961
962
|
extraDistance: config.dragExtraDistance,
|
|
@@ -971,7 +972,7 @@ export const PopsFolder = {
|
|
|
971
972
|
$shadowContainer: $shadowContainer,
|
|
972
973
|
$shadowRoot: $shadowRoot,
|
|
973
974
|
config: config,
|
|
974
|
-
|
|
975
|
+
emitter,
|
|
975
976
|
});
|
|
976
977
|
return result;
|
|
977
978
|
},
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { GlobalConfig } from "../../config/GlobalConfig";
|
|
2
|
+
import { EventEmiter } from "../../event/EventEmiter";
|
|
2
3
|
import { PopsElementHandler } from "../../handler/PopsElementHandler";
|
|
3
4
|
import { PopsHandler } from "../../handler/PopsHandler";
|
|
5
|
+
import { PopsInstHandler } from "../../handler/PopsInstHandler";
|
|
4
6
|
import { PopsCSS } from "../../PopsCSS";
|
|
5
7
|
import { PopsInstData } from "../../PopsInst";
|
|
6
8
|
import type { PopsType } from "../../types/main";
|
|
7
9
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
8
|
-
import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
|
|
9
10
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
10
11
|
import { PopsIframeDefaultConfig } from "./defaultConfig";
|
|
11
12
|
import type { PopsIframeClickEventConfig, PopsIframeConfig } from "./types";
|
|
@@ -15,7 +16,11 @@ export const PopsIframe = {
|
|
|
15
16
|
const guid = popsUtils.getRandomGUID();
|
|
16
17
|
// 设置当前类型
|
|
17
18
|
const popsType: PopsType = "iframe";
|
|
18
|
-
|
|
19
|
+
const emitter = new EventEmiter<{
|
|
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
|
let config = PopsIframeDefaultConfig();
|
|
20
25
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
21
26
|
config = popsUtils.assign(config, __config__);
|
|
@@ -55,7 +60,7 @@ export const PopsIframe = {
|
|
|
55
60
|
const maskExtraStyle = config.animation != null && <string>config.animation != "" ? "position:absolute;" : "";
|
|
56
61
|
|
|
57
62
|
// 先把z-index提取出来
|
|
58
|
-
const zIndex = PopsHandler.
|
|
63
|
+
const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
|
|
59
64
|
const maskHTML = PopsElementHandler.createMask(guid, zIndex, maskExtraStyle);
|
|
60
65
|
|
|
61
66
|
const headerBtnHTML = PopsElementHandler.createHeader(popsType, config);
|
|
@@ -140,10 +145,11 @@ export const PopsIframe = {
|
|
|
140
145
|
popsType,
|
|
141
146
|
$anim,
|
|
142
147
|
$pops,
|
|
148
|
+
emitter,
|
|
143
149
|
$mask
|
|
144
|
-
) as PopsIframeClickEventConfig
|
|
150
|
+
) as PopsIframeClickEventConfig<typeof emitter>;
|
|
145
151
|
// 赋值额外的$iframe参数
|
|
146
|
-
evtConfig.$iframe = $iframe
|
|
152
|
+
evtConfig.$iframe = $iframe;
|
|
147
153
|
|
|
148
154
|
const result = PopsHandler.handleResultConfig(evtConfig);
|
|
149
155
|
|
|
@@ -172,17 +178,14 @@ export const PopsIframe = {
|
|
|
172
178
|
// 创建到页面中
|
|
173
179
|
|
|
174
180
|
popsDOMUtils.append($shadowRoot, $elList);
|
|
175
|
-
|
|
176
|
-
config.beforeAppendToPageCallBack($shadowRoot, $shadowContainer);
|
|
177
|
-
}
|
|
178
|
-
|
|
181
|
+
emitter.emit("pops:before-append-to-page", $shadowRoot, $shadowContainer);
|
|
179
182
|
$iframeContainer.appendChild($shadowContainer);
|
|
180
183
|
if ($mask != null) {
|
|
181
184
|
$anim.after($mask);
|
|
182
185
|
}
|
|
183
186
|
// 拖拽
|
|
184
187
|
if (config.drag) {
|
|
185
|
-
|
|
188
|
+
PopsInstHandler.drag($pops!, {
|
|
186
189
|
dragElement: $title!,
|
|
187
190
|
limit: config.dragLimit,
|
|
188
191
|
extraDistance: config.dragExtraDistance,
|
|
@@ -217,6 +220,7 @@ export const PopsIframe = {
|
|
|
217
220
|
if (typeof config?.btn?.min?.callback === "function") {
|
|
218
221
|
config.btn.min.callback(evtConfig, event);
|
|
219
222
|
}
|
|
223
|
+
emitter.emit("pops:iframe-min", evtConfig, event);
|
|
220
224
|
},
|
|
221
225
|
{
|
|
222
226
|
capture: true,
|
|
@@ -251,6 +255,7 @@ export const PopsIframe = {
|
|
|
251
255
|
if (typeof config?.btn?.max?.callback === "function") {
|
|
252
256
|
config.btn.max.callback(evtConfig, event);
|
|
253
257
|
}
|
|
258
|
+
emitter.emit("pops:iframe-max", evtConfig, event);
|
|
254
259
|
},
|
|
255
260
|
{
|
|
256
261
|
capture: true,
|
|
@@ -293,6 +298,7 @@ export const PopsIframe = {
|
|
|
293
298
|
if (typeof config?.btn?.mise?.callback === "function") {
|
|
294
299
|
config.btn.mise.callback(evtConfig, event);
|
|
295
300
|
}
|
|
301
|
+
emitter.emit("pops:iframe-mise", evtConfig, event);
|
|
296
302
|
},
|
|
297
303
|
{
|
|
298
304
|
capture: true,
|
|
@@ -305,7 +311,7 @@ export const PopsIframe = {
|
|
|
305
311
|
async (event) => {
|
|
306
312
|
event.preventDefault();
|
|
307
313
|
event.stopPropagation();
|
|
308
|
-
await
|
|
314
|
+
await PopsInstHandler.removeInstance([PopsInstData.iframe], guid, false);
|
|
309
315
|
if (typeof config?.btn?.close?.callback === "function") {
|
|
310
316
|
config.btn.close.callback(evtConfig, event);
|
|
311
317
|
}
|
|
@@ -323,7 +329,7 @@ export const PopsIframe = {
|
|
|
323
329
|
$shadowContainer: $shadowContainer,
|
|
324
330
|
$shadowRoot: $shadowRoot,
|
|
325
331
|
config: config,
|
|
326
|
-
|
|
332
|
+
emitter,
|
|
327
333
|
});
|
|
328
334
|
return result;
|
|
329
335
|
},
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { EventEmiter } from "../../../event/EventEmiter";
|
|
2
|
+
import type { PopsDragConfig, PopsGeneralConfig, PopsTitleConfig } from "../../../types/components";
|
|
3
3
|
import type { PopsEventConfig } from "../../../types/event";
|
|
4
|
+
import type { CustomEventMap } from "../../../types/EventEmitter";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* pops.iframe的按钮点击事件回调的配置参数
|
|
7
8
|
*/
|
|
8
|
-
export type PopsIframeClickEventConfig =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
export type PopsIframeClickEventConfig<E extends EventEmiter<CustomEventMap> = EventEmiter<CustomEventMap>> =
|
|
10
|
+
PopsEventConfig<E> & {
|
|
11
|
+
/**
|
|
12
|
+
* iframe元素
|
|
13
|
+
*/
|
|
14
|
+
$iframe: HTMLIFrameElement;
|
|
15
|
+
};
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* pops.iframe
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { GlobalConfig } from "../../config/GlobalConfig";
|
|
2
|
+
import { EventEmiter } from "../../event/EventEmiter";
|
|
2
3
|
import { PopsElementHandler } from "../../handler/PopsElementHandler";
|
|
3
4
|
import { PopsHandler } from "../../handler/PopsHandler";
|
|
4
5
|
import { PopsCSS } from "../../PopsCSS";
|
|
6
|
+
import type { EventMap } from "../../types/EventEmitter";
|
|
5
7
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
6
8
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
7
9
|
import { PopsLoadingDefaultConfig } from "./defaultConfig";
|
|
@@ -12,14 +14,15 @@ export const PopsLoading = {
|
|
|
12
14
|
const guid = popsUtils.getRandomGUID();
|
|
13
15
|
// 设置当前类型
|
|
14
16
|
const PopsType = "loading";
|
|
17
|
+
const emitter = new EventEmiter<EventMap>(PopsType);
|
|
18
|
+
|
|
15
19
|
let config = PopsLoadingDefaultConfig();
|
|
16
20
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
17
21
|
config = popsUtils.assign(config, __config__);
|
|
18
|
-
|
|
19
22
|
config = PopsHandler.handleOnly(PopsType, config);
|
|
20
23
|
|
|
21
24
|
// 先把z-index提取出来
|
|
22
|
-
const zIndex = PopsHandler.
|
|
25
|
+
const zIndex = PopsHandler.getTargerOrFunctionValue(config.zIndex);
|
|
23
26
|
const maskHTML = PopsElementHandler.createMask(guid, zIndex);
|
|
24
27
|
|
|
25
28
|
const { contentPStyle } = PopsElementHandler.createContentStyle("loading", config);
|
|
@@ -76,17 +79,20 @@ export const PopsLoading = {
|
|
|
76
79
|
$mask = handleMask.maskElement;
|
|
77
80
|
$elList.push($mask);
|
|
78
81
|
}
|
|
79
|
-
const evtConfig = PopsHandler.handleLoadingEventConfig(config, guid, PopsType, $anim, $pops, $mask);
|
|
82
|
+
const evtConfig = PopsHandler.handleLoadingEventConfig(config, guid, PopsType, $anim, $pops, emitter, $mask);
|
|
80
83
|
popsDOMUtils.append(config.$parent, $elList);
|
|
81
84
|
if ($mask != null) {
|
|
82
85
|
$anim.after($mask);
|
|
83
86
|
}
|
|
84
|
-
// @ts-ignore
|
|
85
87
|
PopsHandler.handlePush(PopsType, {
|
|
88
|
+
$shadowContainer: $pops,
|
|
89
|
+
$shadowRoot: $pops,
|
|
86
90
|
guid: guid,
|
|
87
91
|
$anim: $anim,
|
|
88
|
-
$pops: $pops
|
|
89
|
-
$mask: $mask
|
|
92
|
+
$pops: $pops,
|
|
93
|
+
$mask: $mask,
|
|
94
|
+
emitter: emitter,
|
|
95
|
+
config: config,
|
|
90
96
|
});
|
|
91
97
|
|
|
92
98
|
if (config.isAbsolute) {
|