@whitesev/pops 2.0.2 → 2.0.4
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 +217 -328
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +217 -328
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +217 -328
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +217 -328
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +217 -328
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +217 -328
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +3 -3
- package/dist/types/src/components/searchSuggestion/indexType.d.ts +1 -1
- package/dist/types/src/handler/PopsElementHandler.d.ts +4 -4
- package/dist/types/src/types/event.d.ts +3 -3
- package/dist/types/src/types/mask.d.ts +1 -1
- package/dist/types/src/utils/PopsInstanceUtils.d.ts +3 -3
- package/package.json +1 -1
- package/src/Pops.ts +1 -1
- package/src/components/alert/index.ts +13 -20
- package/src/components/confirm/index.ts +10 -20
- package/src/components/drawer/index.ts +11 -26
- package/src/components/folder/index.ts +11 -20
- package/src/components/iframe/index.ts +14 -23
- package/src/components/loading/index.ts +10 -9
- package/src/components/panel/PanelHandleContentDetails.ts +14 -36
- package/src/components/panel/index.ts +7 -11
- package/src/components/prompt/index.ts +16 -23
- package/src/components/rightClickMenu/index.ts +9 -7
- package/src/components/searchSuggestion/index.ts +8 -13
- package/src/components/searchSuggestion/indexType.ts +1 -1
- package/src/handler/PopsElementHandler.ts +33 -72
- package/src/handler/PopsHandler.ts +9 -11
- package/src/types/event.d.ts +3 -3
- package/src/types/mask.d.ts +1 -1
- package/src/utils/PopsDOMUtils.ts +21 -19
- package/src/utils/PopsInstanceUtils.ts +120 -96
|
@@ -268,24 +268,29 @@ export const PopsInstanceUtils = {
|
|
|
268
268
|
animElement: HTMLElement,
|
|
269
269
|
maskElement: HTMLElement
|
|
270
270
|
) {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
271
|
+
return new Promise<void>((resolve) => {
|
|
272
|
+
let popsElement =
|
|
273
|
+
animElement.querySelector<HTMLDivElement>(".pops[type-value]")!;
|
|
274
|
+
if (popsType === "drawer") {
|
|
275
|
+
let drawerConfig = config as Required<PopsDrawerDetails>;
|
|
276
|
+
setTimeout(() => {
|
|
277
|
+
maskElement.style.setProperty("display", "none");
|
|
278
|
+
if (["top", "bottom"].includes(drawerConfig.direction)) {
|
|
279
|
+
popsElement.style.setProperty("height", "0");
|
|
280
|
+
} else if (["left", "right"].includes(drawerConfig.direction)) {
|
|
281
|
+
popsElement.style.setProperty("width", "0");
|
|
282
|
+
} else {
|
|
283
|
+
console.error("未知direction:", drawerConfig.direction);
|
|
284
|
+
}
|
|
285
|
+
resolve();
|
|
286
|
+
}, drawerConfig.closeDelay);
|
|
287
|
+
} else {
|
|
288
|
+
let findLayerIns = layerConfigList.find(
|
|
289
|
+
(layerConfigItem) => layerConfigItem.guid === guid
|
|
290
|
+
);
|
|
291
|
+
if (findLayerIns) {
|
|
288
292
|
/* 存在动画 */
|
|
293
|
+
let layerConfigItem = findLayerIns;
|
|
289
294
|
layerConfigItem.animElement.style.width = "100%";
|
|
290
295
|
layerConfigItem.animElement.style.height = "100%";
|
|
291
296
|
(layerConfigItem.animElement.style as any)["animation-name"] =
|
|
@@ -295,6 +300,9 @@ export const PopsInstanceUtils = {
|
|
|
295
300
|
(layerConfigItem.animElement.style as any)["animation-name"]
|
|
296
301
|
)
|
|
297
302
|
) {
|
|
303
|
+
/**
|
|
304
|
+
* 动画结束的回调
|
|
305
|
+
*/
|
|
298
306
|
function animationendCallBack() {
|
|
299
307
|
layerConfigItem.animElement.style.display = "none";
|
|
300
308
|
if (layerConfigItem.maskElement) {
|
|
@@ -308,6 +316,7 @@ export const PopsInstanceUtils = {
|
|
|
308
316
|
capture: true,
|
|
309
317
|
}
|
|
310
318
|
);
|
|
319
|
+
resolve();
|
|
311
320
|
}
|
|
312
321
|
popsDOMUtils.on(
|
|
313
322
|
layerConfigItem.animElement,
|
|
@@ -322,14 +331,13 @@ export const PopsInstanceUtils = {
|
|
|
322
331
|
if (layerConfigItem.maskElement) {
|
|
323
332
|
layerConfigItem.maskElement.style.display = "none";
|
|
324
333
|
}
|
|
325
|
-
}
|
|
326
334
|
|
|
327
|
-
|
|
335
|
+
resolve();
|
|
336
|
+
}
|
|
328
337
|
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
338
|
+
}
|
|
339
|
+
});
|
|
331
340
|
},
|
|
332
|
-
|
|
333
341
|
/**
|
|
334
342
|
* 显示
|
|
335
343
|
* @param popsType
|
|
@@ -353,27 +361,32 @@ export const PopsInstanceUtils = {
|
|
|
353
361
|
| PopsPanelDetails
|
|
354
362
|
| PopsFolderDetails,
|
|
355
363
|
animElement: HTMLElement,
|
|
356
|
-
maskElement
|
|
364
|
+
maskElement?: HTMLElement
|
|
357
365
|
) {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
366
|
+
return new Promise<void>((resolve) => {
|
|
367
|
+
let popsElement =
|
|
368
|
+
animElement.querySelector<HTMLDivElement>(".pops[type-value]")!;
|
|
369
|
+
if (popsType === "drawer") {
|
|
370
|
+
let drawerConfig = config as PopsDrawerDetails;
|
|
371
|
+
setTimeout(() => {
|
|
372
|
+
popsDOMUtils.css(maskElement!, "display", "");
|
|
373
|
+
let direction = drawerConfig.direction!;
|
|
374
|
+
let size = drawerConfig.size!.toString();
|
|
375
|
+
if (["top", "bottom"].includes(direction)) {
|
|
376
|
+
popsElement.style.setProperty("height", size);
|
|
377
|
+
} else if (["left", "right"].includes(direction)) {
|
|
378
|
+
popsElement.style.setProperty("width", size);
|
|
379
|
+
} else {
|
|
380
|
+
console.error("未知direction:", direction);
|
|
381
|
+
}
|
|
382
|
+
resolve();
|
|
383
|
+
}, drawerConfig.openDelay);
|
|
384
|
+
} else {
|
|
385
|
+
let findLayerIns = layerConfigList.find(
|
|
386
|
+
(layerConfigItem) => layerConfigItem.guid === guid
|
|
387
|
+
);
|
|
388
|
+
if (findLayerIns) {
|
|
389
|
+
let layerConfigItem = findLayerIns;
|
|
377
390
|
layerConfigItem.animElement.style.width = "";
|
|
378
391
|
layerConfigItem.animElement.style.height = "";
|
|
379
392
|
(layerConfigItem.animElement.style as any)["animation-name"] =
|
|
@@ -385,10 +398,9 @@ export const PopsInstanceUtils = {
|
|
|
385
398
|
(layerConfigItem.animElement.style as any)["animation-name"]
|
|
386
399
|
)
|
|
387
400
|
) {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
}
|
|
401
|
+
/**
|
|
402
|
+
* 动画结束的回调
|
|
403
|
+
*/
|
|
392
404
|
function animationendCallBack() {
|
|
393
405
|
popsDOMUtils.off(
|
|
394
406
|
layerConfigItem.animElement,
|
|
@@ -398,6 +410,11 @@ export const PopsInstanceUtils = {
|
|
|
398
410
|
capture: true,
|
|
399
411
|
}
|
|
400
412
|
);
|
|
413
|
+
resolve();
|
|
414
|
+
}
|
|
415
|
+
layerConfigItem.animElement.style.display = "";
|
|
416
|
+
if (layerConfigItem.maskElement) {
|
|
417
|
+
layerConfigItem.maskElement.style.display = "";
|
|
401
418
|
}
|
|
402
419
|
popsDOMUtils.on(
|
|
403
420
|
layerConfigItem.animElement,
|
|
@@ -412,11 +429,11 @@ export const PopsInstanceUtils = {
|
|
|
412
429
|
if (layerConfigItem.maskElement) {
|
|
413
430
|
layerConfigItem.maskElement.style.display = "";
|
|
414
431
|
}
|
|
432
|
+
resolve();
|
|
415
433
|
}
|
|
416
434
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
}
|
|
435
|
+
}
|
|
436
|
+
});
|
|
420
437
|
},
|
|
421
438
|
/**
|
|
422
439
|
* 关闭
|
|
@@ -441,61 +458,68 @@ export const PopsInstanceUtils = {
|
|
|
441
458
|
| PopsFolderDetails,
|
|
442
459
|
animElement: HTMLElement
|
|
443
460
|
) {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
function
|
|
452
|
-
|
|
453
|
-
|
|
461
|
+
return new Promise<void>((resolve) => {
|
|
462
|
+
let popsElement =
|
|
463
|
+
animElement.querySelector<HTMLDivElement>(".pops[type-value]")!;
|
|
464
|
+
let drawerConfig = config as Required<PopsDrawerDetails>;
|
|
465
|
+
/**
|
|
466
|
+
* 动画结束事件
|
|
467
|
+
*/
|
|
468
|
+
function transitionendEvent() {
|
|
469
|
+
/**
|
|
470
|
+
* 弹窗已关闭的回调
|
|
471
|
+
*/
|
|
472
|
+
function closeCallBack(event: Event) {
|
|
473
|
+
if ((event as TransitionEvent).propertyName !== "transform") {
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
popsDOMUtils.off(
|
|
477
|
+
popsElement,
|
|
478
|
+
popsDOMUtils.getTransitionEndNameList(),
|
|
479
|
+
void 0,
|
|
480
|
+
closeCallBack
|
|
481
|
+
);
|
|
482
|
+
PopsInstanceUtils.removeInstance([layerConfigList], guid);
|
|
483
|
+
resolve();
|
|
454
484
|
}
|
|
455
|
-
|
|
485
|
+
/* 监听过渡结束 */
|
|
486
|
+
popsDOMUtils.on(
|
|
456
487
|
popsElement,
|
|
457
488
|
popsDOMUtils.getTransitionEndNameList(),
|
|
458
|
-
void 0,
|
|
459
489
|
closeCallBack
|
|
460
490
|
);
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
popsElement,
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
491
|
+
let popsTransForm = getComputedStyle(popsElement).transform;
|
|
492
|
+
if (popsTransForm !== "none") {
|
|
493
|
+
popsDOMUtils.trigger(
|
|
494
|
+
popsElement,
|
|
495
|
+
popsDOMUtils.getTransitionEndNameList(),
|
|
496
|
+
void 0,
|
|
497
|
+
true
|
|
498
|
+
);
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
if (["top"].includes(drawerConfig.direction)) {
|
|
502
|
+
popsElement.style.setProperty("transform", "translateY(-100%)");
|
|
503
|
+
} else if (["bottom"].includes(drawerConfig.direction)) {
|
|
504
|
+
popsElement.style.setProperty("transform", "translateY(100%)");
|
|
505
|
+
} else if (["left"].includes(drawerConfig.direction)) {
|
|
506
|
+
popsElement.style.setProperty("transform", "translateX(-100%)");
|
|
507
|
+
} else if (["right"].includes(drawerConfig.direction)) {
|
|
508
|
+
popsElement.style.setProperty("transform", "translateX(100%)");
|
|
509
|
+
} else {
|
|
510
|
+
console.error("未知direction:", drawerConfig.direction);
|
|
511
|
+
}
|
|
478
512
|
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
popsElement.style.setProperty("transform", "translateX(-100%)");
|
|
485
|
-
} else if (["right"].includes(drawerConfig.direction)) {
|
|
486
|
-
popsElement.style.setProperty("transform", "translateX(100%)");
|
|
513
|
+
|
|
514
|
+
if (popsType === "drawer") {
|
|
515
|
+
setTimeout(() => {
|
|
516
|
+
transitionendEvent();
|
|
517
|
+
}, drawerConfig.closeDelay);
|
|
487
518
|
} else {
|
|
488
|
-
|
|
519
|
+
PopsInstanceUtils.removeInstance([layerConfigList], guid);
|
|
520
|
+
resolve();
|
|
489
521
|
}
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
if (popsType === "drawer") {
|
|
493
|
-
setTimeout(() => {
|
|
494
|
-
transitionendEvent();
|
|
495
|
-
}, drawerConfig.closeDelay);
|
|
496
|
-
} else {
|
|
497
|
-
PopsInstanceUtils.removeInstance([layerConfigList], guid);
|
|
498
|
-
}
|
|
522
|
+
});
|
|
499
523
|
},
|
|
500
524
|
/**
|
|
501
525
|
* 拖拽元素
|