@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.
Files changed (78) hide show
  1. package/dist/index.amd.js +183 -175
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.amd.min.js +1 -1
  4. package/dist/index.amd.min.js.map +1 -1
  5. package/dist/index.cjs.js +183 -175
  6. package/dist/index.cjs.js.map +1 -1
  7. package/dist/index.cjs.min.js +1 -1
  8. package/dist/index.cjs.min.js.map +1 -1
  9. package/dist/index.esm.js +183 -175
  10. package/dist/index.esm.js.map +1 -1
  11. package/dist/index.esm.min.js +1 -1
  12. package/dist/index.esm.min.js.map +1 -1
  13. package/dist/index.iife.js +183 -175
  14. package/dist/index.iife.js.map +1 -1
  15. package/dist/index.iife.min.js +1 -1
  16. package/dist/index.iife.min.js.map +1 -1
  17. package/dist/index.system.js +183 -175
  18. package/dist/index.system.js.map +1 -1
  19. package/dist/index.system.min.js +1 -1
  20. package/dist/index.system.min.js.map +1 -1
  21. package/dist/index.umd.js +183 -175
  22. package/dist/index.umd.js.map +1 -1
  23. package/dist/index.umd.min.js +1 -1
  24. package/dist/index.umd.min.js.map +1 -1
  25. package/dist/types/src/Pops.d.ts +14 -14
  26. package/dist/types/src/components/alert/index.d.ts +1 -1
  27. package/dist/types/src/components/confirm/index.d.ts +1 -1
  28. package/dist/types/src/components/drawer/index.d.ts +1 -1
  29. package/dist/types/src/components/folder/index.d.ts +1 -1
  30. package/dist/types/src/components/iframe/index.d.ts +2 -2
  31. package/dist/types/src/components/iframe/types/index.d.ts +6 -6
  32. package/dist/types/src/components/loading/index.d.ts +1 -1
  33. package/dist/types/src/components/panel/index.d.ts +4 -4
  34. package/dist/types/src/components/prompt/index.d.ts +1 -1
  35. package/dist/types/src/handler/PopsHandler.d.ts +18 -17
  36. package/dist/types/src/types/button.d.ts +4 -4
  37. package/dist/types/src/types/event.d.ts +7 -7
  38. package/dist/types/src/utils/PopsInstanceUtils.d.ts +8 -8
  39. package/package.json +5 -5
  40. package/src/components/alert/index.ts +13 -13
  41. package/src/components/confirm/index.ts +15 -16
  42. package/src/components/drawer/index.ts +22 -22
  43. package/src/components/folder/index.ts +14 -14
  44. package/src/components/iframe/index.ts +19 -20
  45. package/src/components/iframe/types/index.ts +6 -6
  46. package/src/components/loading/index.ts +8 -8
  47. package/src/components/panel/handlerComponents.ts +1 -1
  48. package/src/components/panel/index.css +16 -1
  49. package/src/components/panel/index.ts +11 -11
  50. package/src/components/prompt/index.ts +28 -29
  51. package/src/css/common.css +6 -0
  52. package/src/handler/PopsHandler.ts +70 -68
  53. package/src/svg/cpu.svg +7 -7
  54. package/src/svg/delete.svg +4 -4
  55. package/src/svg/documentCopy.svg +4 -4
  56. package/src/svg/edit.svg +7 -7
  57. package/src/svg/eleme.svg +4 -4
  58. package/src/svg/elemePlus.svg +4 -4
  59. package/src/svg/headset.svg +4 -4
  60. package/src/svg/hide.svg +7 -7
  61. package/src/svg/keyboard.svg +7 -7
  62. package/src/svg/loading.svg +4 -4
  63. package/src/svg/max.svg +4 -4
  64. package/src/svg/min.svg +2 -4
  65. package/src/svg/mise.svg +4 -4
  66. package/src/svg/monitor.svg +4 -4
  67. package/src/svg/next.svg +4 -4
  68. package/src/svg/picture.svg +7 -7
  69. package/src/svg/prev.svg +4 -4
  70. package/src/svg/search.svg +4 -4
  71. package/src/svg/share.svg +4 -4
  72. package/src/svg/upload.svg +4 -4
  73. package/src/svg/videoPause.svg +4 -4
  74. package/src/svg/videoPlay.svg +4 -4
  75. package/src/svg/view.svg +4 -4
  76. package/src/types/button.d.ts +4 -4
  77. package/src/types/event.d.ts +7 -7
  78. package/src/utils/PopsInstanceUtils.ts +28 -24
@@ -1,4 +1,4 @@
1
- import type { PopsEventDetails, PopsHandlerEventDetails } from "./event";
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(eventDetails: PopsHandlerEventDetails & T, event: PointerEvent | MouseEvent): void;
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
- eventDetails: PopsHandlerEventDetails & {
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: PopsEventDetails, event: PointerEvent | MouseEvent) => void;
186
+ callback?: (details: PopsEventConfig, event: PointerEvent | MouseEvent) => void;
187
187
  }
@@ -4,7 +4,7 @@ import type { PopsType } from "./main";
4
4
  /**
5
5
  * 事件配置
6
6
  */
7
- export interface PopsIframeEventDetails {
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 PopsEventDetails {
36
+ export interface PopsEventConfig {
37
37
  /** 最外层包裹的元素 */
38
38
  $shadowContainer: HTMLDivElement;
39
39
  /** ShadowRoot */
40
40
  $shadowRoot: ShadowRoot | HTMLElement;
41
41
  /** -> 动画层 */
42
- element: HTMLDivElement;
42
+ $el: HTMLDivElement;
43
43
  /** 动画层 */
44
- animElement: HTMLDivElement;
44
+ $anim: HTMLDivElement;
45
45
  /** 主元素 */
46
- popsElement: HTMLDivElement;
46
+ $pops: HTMLDivElement;
47
47
  /** 遮罩层 */
48
- maskElement?: HTMLDivElement;
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 PopsHandlerEventDetails extends PopsEventDetails {
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 animElement
221
- * @param maskElement
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
- animElement: HTMLElement,
237
- maskElement: HTMLElement
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 = animElement.querySelector<HTMLDivElement>(".pops[type-value]")!;
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
- maskElement.style.setProperty("display", "none");
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 animElement
307
- * @param maskElement
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
- animElement: HTMLElement,
323
- maskElement?: HTMLElement
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 = animElement.querySelector<HTMLDivElement>(".pops[type-value]")!;
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
- popsDOMUtils.css(maskElement!, "display", "");
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 animElement
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
- animElement: HTMLElement
408
+ popsType: string,
409
+ instConfigList: PopsInstCommonConfig[],
410
+ guid: string,
411
+ $anim: HTMLElement
408
412
  ) {
409
413
  return new Promise<void>((resolve) => {
410
- const popsElement = animElement.querySelector<HTMLDivElement>(".pops[type-value]")!;
414
+ const popsElement = $anim.querySelector<HTMLDivElement>(".pops[type-value]")!;
411
415
  const drawerConfig = config as Required<PopsDrawerDetails>;
412
416
  /**
413
417
  * 动画结束事件