@whitesev/pops 2.5.5 → 2.6.1
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 +183 -175
- 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 +183 -175
- 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 +183 -175
- 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 +183 -175
- 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 +183 -175
- 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 +183 -175
- 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 +14 -14
- package/dist/types/src/components/alert/index.d.ts +1 -1
- package/dist/types/src/components/confirm/index.d.ts +1 -1
- package/dist/types/src/components/drawer/index.d.ts +1 -1
- package/dist/types/src/components/folder/index.d.ts +1 -1
- package/dist/types/src/components/iframe/index.d.ts +2 -2
- package/dist/types/src/components/iframe/types/index.d.ts +6 -6
- package/dist/types/src/components/loading/index.d.ts +1 -1
- package/dist/types/src/components/panel/index.d.ts +4 -4
- package/dist/types/src/components/prompt/index.d.ts +1 -1
- package/dist/types/src/handler/PopsHandler.d.ts +18 -17
- package/dist/types/src/types/button.d.ts +4 -4
- package/dist/types/src/types/event.d.ts +7 -7
- package/dist/types/src/utils/PopsInstanceUtils.d.ts +8 -8
- package/package.json +5 -5
- package/src/components/alert/index.ts +13 -13
- package/src/components/confirm/index.ts +15 -16
- package/src/components/drawer/index.ts +22 -22
- package/src/components/folder/index.ts +14 -14
- package/src/components/iframe/index.ts +19 -20
- package/src/components/iframe/types/index.ts +6 -6
- package/src/components/loading/index.ts +8 -8
- package/src/components/panel/handlerComponents.ts +1 -1
- package/src/components/panel/index.css +16 -1
- package/src/components/panel/index.ts +11 -11
- package/src/components/prompt/index.ts +28 -29
- package/src/css/common.css +6 -0
- package/src/handler/PopsHandler.ts +70 -68
- package/src/svg/cpu.svg +7 -7
- package/src/svg/delete.svg +4 -4
- package/src/svg/documentCopy.svg +4 -4
- package/src/svg/edit.svg +7 -7
- package/src/svg/eleme.svg +4 -4
- package/src/svg/elemePlus.svg +4 -4
- package/src/svg/headset.svg +4 -4
- package/src/svg/hide.svg +7 -7
- package/src/svg/keyboard.svg +7 -7
- package/src/svg/loading.svg +4 -4
- package/src/svg/max.svg +4 -4
- package/src/svg/min.svg +2 -4
- package/src/svg/mise.svg +4 -4
- package/src/svg/monitor.svg +4 -4
- package/src/svg/next.svg +4 -4
- package/src/svg/picture.svg +7 -7
- package/src/svg/prev.svg +4 -4
- package/src/svg/search.svg +4 -4
- package/src/svg/share.svg +4 -4
- package/src/svg/upload.svg +4 -4
- package/src/svg/videoPause.svg +4 -4
- package/src/svg/videoPlay.svg +4 -4
- package/src/svg/view.svg +4 -4
- package/src/types/button.d.ts +4 -4
- package/src/types/event.d.ts +7 -7
- package/src/utils/PopsInstanceUtils.ts +28 -24
package/src/types/button.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PopsEventConfig, PopsHandlerEventConfig } from "./event";
|
|
2
2
|
import type { PopsIconType } from "./icon";
|
|
3
3
|
import type { PopsType } from "./main";
|
|
4
4
|
|
|
@@ -110,7 +110,7 @@ export interface PopsButtonDetails<T = object> {
|
|
|
110
110
|
*
|
|
111
111
|
* 如果传入该值,那么将不会自动关闭弹窗
|
|
112
112
|
*/
|
|
113
|
-
callback(
|
|
113
|
+
callback(eventConfig: PopsHandlerEventConfig & T, event: PointerEvent | MouseEvent): void;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
/**
|
|
@@ -127,7 +127,7 @@ export type PopsButtonDetailsAnyType<T = object> = Omit<PopsButtonDetails<T>, "t
|
|
|
127
127
|
/** prompt的点击回调 */
|
|
128
128
|
export interface PopsPromptButtonDetails extends PopsButtonDetails {
|
|
129
129
|
callback(
|
|
130
|
-
|
|
130
|
+
eventConfig: PopsHandlerEventConfig & {
|
|
131
131
|
text: string;
|
|
132
132
|
},
|
|
133
133
|
event: PointerEvent | MouseEvent
|
|
@@ -183,5 +183,5 @@ export interface PopsHeaderCloseButtonDetails {
|
|
|
183
183
|
*
|
|
184
184
|
* 如果传入该值,那么将不会自动关闭弹窗
|
|
185
185
|
*/
|
|
186
|
-
callback?: (details:
|
|
186
|
+
callback?: (details: PopsEventConfig, event: PointerEvent | MouseEvent) => void;
|
|
187
187
|
}
|
package/src/types/event.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { PopsType } from "./main";
|
|
|
4
4
|
/**
|
|
5
5
|
* 事件配置
|
|
6
6
|
*/
|
|
7
|
-
export interface
|
|
7
|
+
export interface PopsIframeEventConfig {
|
|
8
8
|
/**
|
|
9
9
|
* 唯一id
|
|
10
10
|
*/
|
|
@@ -33,19 +33,19 @@ export interface PopsIframeEventDetails {
|
|
|
33
33
|
/**
|
|
34
34
|
* 事件配置
|
|
35
35
|
*/
|
|
36
|
-
export interface
|
|
36
|
+
export interface PopsEventConfig {
|
|
37
37
|
/** 最外层包裹的元素 */
|
|
38
38
|
$shadowContainer: HTMLDivElement;
|
|
39
39
|
/** ShadowRoot */
|
|
40
40
|
$shadowRoot: ShadowRoot | HTMLElement;
|
|
41
41
|
/** -> 动画层 */
|
|
42
|
-
|
|
42
|
+
$el: HTMLDivElement;
|
|
43
43
|
/** 动画层 */
|
|
44
|
-
|
|
44
|
+
$anim: HTMLDivElement;
|
|
45
45
|
/** 主元素 */
|
|
46
|
-
|
|
46
|
+
$pops: HTMLDivElement;
|
|
47
47
|
/** 遮罩层 */
|
|
48
|
-
|
|
48
|
+
$mask?: HTMLDivElement;
|
|
49
49
|
/** 当前弹窗类型 */
|
|
50
50
|
mode: PopsType;
|
|
51
51
|
guid: string;
|
|
@@ -57,7 +57,7 @@ export interface PopsEventDetails {
|
|
|
57
57
|
/**
|
|
58
58
|
* 处理过的事件配置
|
|
59
59
|
*/
|
|
60
|
-
export interface
|
|
60
|
+
export interface PopsHandlerEventConfig extends PopsEventConfig {
|
|
61
61
|
/** 当前按钮类型 */
|
|
62
62
|
type: "cancel" | "close" | "ok" | "other";
|
|
63
63
|
}
|
|
@@ -217,13 +217,10 @@ export const PopsInstanceUtils = {
|
|
|
217
217
|
* @param instConfigList
|
|
218
218
|
* @param guid
|
|
219
219
|
* @param config
|
|
220
|
-
* @param
|
|
221
|
-
* @param
|
|
220
|
+
* @param $anim
|
|
221
|
+
* @param $mask
|
|
222
222
|
*/
|
|
223
223
|
hide(
|
|
224
|
-
popsType: PopsInstStoreType,
|
|
225
|
-
instConfigList: PopsInstCommonConfig[],
|
|
226
|
-
guid: string,
|
|
227
224
|
config:
|
|
228
225
|
| PopsAlertDetails
|
|
229
226
|
| PopsDrawerDetails
|
|
@@ -233,15 +230,20 @@ export const PopsInstanceUtils = {
|
|
|
233
230
|
| PopsLoadingDetails
|
|
234
231
|
| PopsPanelDetails
|
|
235
232
|
| PopsFolderDetails,
|
|
236
|
-
|
|
237
|
-
|
|
233
|
+
popsType: PopsInstStoreType,
|
|
234
|
+
instConfigList: PopsInstCommonConfig[],
|
|
235
|
+
guid: string,
|
|
236
|
+
$anim: HTMLElement,
|
|
237
|
+
$mask?: HTMLElement
|
|
238
238
|
) {
|
|
239
239
|
return new Promise<void>((resolve) => {
|
|
240
|
-
const popsElement =
|
|
240
|
+
const popsElement = $anim.querySelector<HTMLDivElement>(".pops[type-value]")!;
|
|
241
241
|
if (popsType === "drawer") {
|
|
242
242
|
const drawerConfig = config as Required<PopsDrawerDetails>;
|
|
243
243
|
popsUtils.setTimeout(() => {
|
|
244
|
-
|
|
244
|
+
if ($mask) {
|
|
245
|
+
popsDOMUtils.css($mask, "display", "none");
|
|
246
|
+
}
|
|
245
247
|
if (["top", "bottom"].includes(drawerConfig.direction)) {
|
|
246
248
|
popsElement.style.setProperty("height", "0");
|
|
247
249
|
} else if (["left", "right"].includes(drawerConfig.direction)) {
|
|
@@ -303,13 +305,10 @@ export const PopsInstanceUtils = {
|
|
|
303
305
|
* @param instConfigList
|
|
304
306
|
* @param guid
|
|
305
307
|
* @param config
|
|
306
|
-
* @param
|
|
307
|
-
* @param
|
|
308
|
+
* @param $anim
|
|
309
|
+
* @param $mask
|
|
308
310
|
*/
|
|
309
311
|
show(
|
|
310
|
-
popsType: PopsInstStoreType,
|
|
311
|
-
instConfigList: PopsInstCommonConfig[],
|
|
312
|
-
guid: string,
|
|
313
312
|
config:
|
|
314
313
|
| PopsAlertDetails
|
|
315
314
|
| PopsDrawerDetails
|
|
@@ -319,15 +318,20 @@ export const PopsInstanceUtils = {
|
|
|
319
318
|
| PopsLoadingDetails
|
|
320
319
|
| PopsPanelDetails
|
|
321
320
|
| PopsFolderDetails,
|
|
322
|
-
|
|
323
|
-
|
|
321
|
+
popsType: PopsInstStoreType,
|
|
322
|
+
instConfigList: PopsInstCommonConfig[],
|
|
323
|
+
guid: string,
|
|
324
|
+
$anim: HTMLElement,
|
|
325
|
+
$mask?: HTMLElement
|
|
324
326
|
) {
|
|
325
327
|
return new Promise<void>((resolve) => {
|
|
326
|
-
const popsElement =
|
|
328
|
+
const popsElement = $anim.querySelector<HTMLDivElement>(".pops[type-value]")!;
|
|
327
329
|
if (popsType === "drawer") {
|
|
328
330
|
const drawerConfig = config as PopsDrawerDetails;
|
|
329
331
|
popsUtils.setTimeout(() => {
|
|
330
|
-
|
|
332
|
+
if ($mask) {
|
|
333
|
+
popsDOMUtils.css($mask, "display", "");
|
|
334
|
+
}
|
|
331
335
|
const direction = drawerConfig.direction!;
|
|
332
336
|
const size = drawerConfig.size!.toString();
|
|
333
337
|
if (["top", "bottom"].includes(direction)) {
|
|
@@ -389,12 +393,9 @@ export const PopsInstanceUtils = {
|
|
|
389
393
|
* @param instConfigList
|
|
390
394
|
* @param guid
|
|
391
395
|
* @param config
|
|
392
|
-
* @param
|
|
396
|
+
* @param $anim
|
|
393
397
|
*/
|
|
394
398
|
close(
|
|
395
|
-
popsType: string,
|
|
396
|
-
instConfigList: PopsInstCommonConfig[],
|
|
397
|
-
guid: string,
|
|
398
399
|
config:
|
|
399
400
|
| PopsAlertDetails
|
|
400
401
|
| PopsDrawerDetails
|
|
@@ -404,10 +405,13 @@ export const PopsInstanceUtils = {
|
|
|
404
405
|
| PopsLoadingDetails
|
|
405
406
|
| PopsPanelDetails
|
|
406
407
|
| PopsFolderDetails,
|
|
407
|
-
|
|
408
|
+
popsType: string,
|
|
409
|
+
instConfigList: PopsInstCommonConfig[],
|
|
410
|
+
guid: string,
|
|
411
|
+
$anim: HTMLElement
|
|
408
412
|
) {
|
|
409
413
|
return new Promise<void>((resolve) => {
|
|
410
|
-
const popsElement =
|
|
414
|
+
const popsElement = $anim.querySelector<HTMLDivElement>(".pops[type-value]")!;
|
|
411
415
|
const drawerConfig = config as Required<PopsDrawerDetails>;
|
|
412
416
|
/**
|
|
413
417
|
* 动画结束事件
|