@whitesev/pops 2.6.1 → 3.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.
Files changed (160) hide show
  1. package/dist/index.amd.js +1208 -1067
  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 +1208 -1067
  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 +1208 -1067
  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 +1208 -1067
  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 +1208 -1067
  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 +1208 -1067
  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/eslint.config.d.mts +2 -0
  26. package/dist/types/src/Pops.d.ts +98 -103
  27. package/dist/types/src/PopsInst.d.ts +2 -2
  28. package/dist/types/src/components/alert/defaultConfig.d.ts +2 -0
  29. package/dist/types/src/components/alert/index.d.ts +2 -2
  30. package/dist/types/src/components/alert/types/index.d.ts +4 -4
  31. package/dist/types/src/components/confirm/defaultConfig.d.ts +2 -0
  32. package/dist/types/src/components/confirm/index.d.ts +2 -2
  33. package/dist/types/src/components/confirm/types/index.d.ts +2 -2
  34. package/dist/types/src/components/drawer/defaultConfig.d.ts +2 -0
  35. package/dist/types/src/components/drawer/index.d.ts +2 -2
  36. package/dist/types/src/components/drawer/types/index.d.ts +2 -2
  37. package/dist/types/src/components/folder/defaultConfig.d.ts +2 -0
  38. package/dist/types/src/components/folder/index.d.ts +2 -2
  39. package/dist/types/src/components/folder/types/index.d.ts +31 -7
  40. package/dist/types/src/components/iframe/defaultConfig.d.ts +2 -0
  41. package/dist/types/src/components/iframe/index.d.ts +2 -5
  42. package/dist/types/src/components/iframe/types/index.d.ts +13 -42
  43. package/dist/types/src/components/loading/defaultConfig.d.ts +2 -0
  44. package/dist/types/src/components/loading/index.d.ts +2 -2
  45. package/dist/types/src/components/loading/types/index.d.ts +4 -4
  46. package/dist/types/src/components/panel/defaultConfig.d.ts +2 -0
  47. package/dist/types/src/components/panel/handlerComponents.d.ts +47 -43
  48. package/dist/types/src/components/panel/index.d.ts +3 -3
  49. package/dist/types/src/components/panel/types/components-button.d.ts +7 -6
  50. package/dist/types/src/components/panel/types/components-common.d.ts +7 -7
  51. package/dist/types/src/components/panel/types/components-container.d.ts +24 -0
  52. package/dist/types/src/components/panel/types/components-deepMenu.d.ts +13 -13
  53. package/dist/types/src/components/panel/types/components-input.d.ts +6 -6
  54. package/dist/types/src/components/panel/types/components-own.d.ts +2 -2
  55. package/dist/types/src/components/panel/types/components-select.d.ts +9 -9
  56. package/dist/types/src/components/panel/types/components-selectMultiple.d.ts +8 -8
  57. package/dist/types/src/components/panel/types/components-slider.d.ts +7 -7
  58. package/dist/types/src/components/panel/types/components-switch.d.ts +6 -6
  59. package/dist/types/src/components/panel/types/components-textarea.d.ts +6 -6
  60. package/dist/types/src/components/panel/types/index.d.ts +36 -28
  61. package/dist/types/src/components/prompt/defaultConfig.d.ts +2 -0
  62. package/dist/types/src/components/prompt/index.d.ts +2 -2
  63. package/dist/types/src/components/prompt/types/index.d.ts +4 -3
  64. package/dist/types/src/components/rightClickMenu/defaultConfig.d.ts +2 -0
  65. package/dist/types/src/components/rightClickMenu/index.d.ts +29 -27
  66. package/dist/types/src/components/rightClickMenu/types/index.d.ts +32 -11
  67. package/dist/types/src/components/searchSuggestion/defaultConfig.d.ts +2 -0
  68. package/dist/types/src/components/searchSuggestion/index.d.ts +21 -6
  69. package/dist/types/src/components/searchSuggestion/types/index.d.ts +15 -13
  70. package/dist/types/src/components/tooltip/defaultConfig.d.ts +2 -0
  71. package/dist/types/src/components/tooltip/index.d.ts +6 -21
  72. package/dist/types/src/components/tooltip/types/index.d.ts +8 -6
  73. package/dist/types/src/config/GlobalConfig.d.ts +3 -3
  74. package/dist/types/src/handler/PopsElementHandler.d.ts +6 -6
  75. package/dist/types/src/handler/PopsHandler.d.ts +18 -18
  76. package/dist/types/src/types/button.d.ts +4 -97
  77. package/dist/types/src/types/components.d.ts +8 -8
  78. package/dist/types/src/types/event.d.ts +0 -30
  79. package/dist/types/src/types/global.d.ts +2 -0
  80. package/dist/types/src/types/inst.d.ts +5 -5
  81. package/dist/types/src/types/main.d.ts +35 -80
  82. package/dist/types/src/types/mask.d.ts +18 -15
  83. package/dist/types/src/utils/PopsInstanceUtils.d.ts +15 -15
  84. package/dist/types/src/utils/PopsUtils.d.ts +4 -0
  85. package/package.json +10 -10
  86. package/src/Pops.ts +44 -44
  87. package/src/PopsAnimation.ts +1 -1
  88. package/src/PopsInst.ts +2 -2
  89. package/src/components/alert/{config.ts → defaultConfig.ts} +7 -7
  90. package/src/components/alert/index.ts +16 -18
  91. package/src/components/alert/types/index.ts +4 -4
  92. package/src/components/confirm/{config.ts → defaultConfig.ts} +11 -11
  93. package/src/components/confirm/index.ts +11 -13
  94. package/src/components/confirm/types/index.ts +3 -3
  95. package/src/components/drawer/{config.ts → defaultConfig.ts} +10 -10
  96. package/src/components/drawer/index.ts +18 -17
  97. package/src/components/drawer/types/index.ts +3 -3
  98. package/src/components/folder/{config.ts → defaultConfig.ts} +22 -18
  99. package/src/components/folder/index.ts +61 -60
  100. package/src/components/folder/types/index.ts +31 -18
  101. package/src/components/iframe/{config.ts → defaultConfig.ts} +2 -2
  102. package/src/components/iframe/index.ts +24 -29
  103. package/src/components/iframe/types/index.ts +13 -56
  104. package/src/components/loading/{config.ts → defaultConfig.ts} +3 -3
  105. package/src/components/loading/index.ts +13 -11
  106. package/src/components/loading/types/index.ts +5 -5
  107. package/src/components/panel/{config.ts → defaultConfig.ts} +115 -37
  108. package/src/components/panel/handlerComponents.ts +445 -427
  109. package/src/components/panel/index.css +5 -1
  110. package/src/components/panel/index.ts +15 -28
  111. package/src/components/panel/types/components-button.ts +7 -6
  112. package/src/components/panel/types/components-common.ts +7 -7
  113. package/src/components/panel/types/components-container.ts +25 -0
  114. package/src/components/panel/types/components-deepMenu.ts +13 -13
  115. package/src/components/panel/types/components-input.ts +6 -6
  116. package/src/components/panel/types/components-own.ts +2 -2
  117. package/src/components/panel/types/components-select.ts +11 -11
  118. package/src/components/panel/types/components-selectMultiple.ts +8 -9
  119. package/src/components/panel/types/components-slider.ts +7 -7
  120. package/src/components/panel/types/components-switch.ts +6 -6
  121. package/src/components/panel/types/components-textarea.ts +6 -6
  122. package/src/components/panel/types/index.ts +45 -38
  123. package/src/components/prompt/{config.ts → defaultConfig.ts} +10 -10
  124. package/src/components/prompt/index.ts +13 -15
  125. package/src/components/prompt/types/index.ts +4 -3
  126. package/src/components/rightClickMenu/{config.ts → defaultConfig.ts} +20 -19
  127. package/src/components/rightClickMenu/index.ts +125 -108
  128. package/src/components/rightClickMenu/types/index.ts +36 -14
  129. package/src/components/searchSuggestion/{config.ts → defaultConfig.ts} +18 -11
  130. package/src/components/searchSuggestion/index.ts +116 -96
  131. package/src/components/searchSuggestion/types/index.ts +17 -15
  132. package/src/components/tooltip/{config.ts → defaultConfig.ts} +5 -6
  133. package/src/components/tooltip/index.ts +21 -21
  134. package/src/components/tooltip/types/index.ts +9 -7
  135. package/src/config/GlobalConfig.ts +2 -2
  136. package/src/handler/PopsElementHandler.ts +29 -30
  137. package/src/handler/PopsHandler.ts +43 -43
  138. package/src/types/button.d.ts +4 -97
  139. package/src/types/components.d.ts +8 -8
  140. package/src/types/event.d.ts +0 -30
  141. package/src/types/global.d.ts +2 -0
  142. package/src/types/inst.d.ts +5 -5
  143. package/src/types/main.d.ts +35 -80
  144. package/src/types/mask.d.ts +18 -15
  145. package/src/utils/PopsDOMUtils.ts +34 -34
  146. package/src/utils/PopsInstanceUtils.ts +129 -139
  147. package/src/utils/PopsUtils.ts +60 -45
  148. package/dist/types/src/components/alert/config.d.ts +0 -2
  149. package/dist/types/src/components/confirm/config.d.ts +0 -2
  150. package/dist/types/src/components/drawer/config.d.ts +0 -2
  151. package/dist/types/src/components/folder/config.d.ts +0 -2
  152. package/dist/types/src/components/iframe/config.d.ts +0 -2
  153. package/dist/types/src/components/loading/config.d.ts +0 -2
  154. package/dist/types/src/components/panel/config.d.ts +0 -2
  155. package/dist/types/src/components/panel/types/components-forms.d.ts +0 -23
  156. package/dist/types/src/components/prompt/config.d.ts +0 -2
  157. package/dist/types/src/components/rightClickMenu/config.d.ts +0 -2
  158. package/dist/types/src/components/searchSuggestion/config.d.ts +0 -2
  159. package/dist/types/src/components/tooltip/config.d.ts +0 -2
  160. package/src/components/panel/types/components-forms.ts +0 -24
@@ -5,8 +5,8 @@ import type { PopsType } from "../../types/main";
5
5
  import { popsDOMUtils } from "../../utils/PopsDOMUtils";
6
6
  import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
7
7
  import { popsUtils } from "../../utils/PopsUtils";
8
- import { PopsTooltipConfig } from "./config";
9
- import type { PopsToolTipDetails } from "./types/index";
8
+ import { PopsTooltipDefaultConfig } from "./defaultConfig";
9
+ import type { PopsToolTipConfig } from "./types/index";
10
10
 
11
11
  type ToolTipEventTypeName = "MouseEvent" | "TouchEvent";
12
12
 
@@ -19,13 +19,13 @@ export class ToolTip {
19
19
  $arrow: null as unknown as HTMLElement,
20
20
  };
21
21
  $data = {
22
- config: null as any as Required<PopsToolTipDetails>,
22
+ config: null as any as Required<PopsToolTipConfig>,
23
23
  guid: null as any as string,
24
24
  timeId_close_TouchEvent: <number[]>[],
25
25
  timeId_close_MouseEvent: <number[]>[],
26
26
  };
27
27
  constructor(
28
- config: Required<PopsToolTipDetails>,
28
+ config: Required<PopsToolTipConfig>,
29
29
  guid: string,
30
30
  ShadowInfo: {
31
31
  $shadowContainer: HTMLDivElement;
@@ -86,7 +86,7 @@ export class ToolTip {
86
86
  // 添加z-index
87
87
  $toolTipContainer.style.zIndex = PopsHandler.handleZIndex(this.$data.config.zIndex).toString();
88
88
  if (this.$data.config.style != null) {
89
- /* 添加自定义style */
89
+ // 添加自定义style
90
90
  const cssNode = popsDOMUtils.createElement("style", {
91
91
  type: "text/css",
92
92
  innerHTML: this.$data.config.style,
@@ -173,9 +173,9 @@ export class ToolTip {
173
173
 
174
174
  const toolTipElement_width = popsDOMUtils.outerWidth(this.$el.$toolTip);
175
175
  const toolTipElement_height = popsDOMUtils.outerHeight(this.$el.$toolTip);
176
- /* 目标元素的x轴的中间位置 */
176
+ // 目标元素的x轴的中间位置
177
177
  const targetElement_X_center_pos = targetElement_left + targetElement_width / 2 - toolTipElement_width / 2;
178
- /* 目标元素的Y轴的中间位置 */
178
+ // 目标元素的Y轴的中间位置
179
179
  const targetElement_Y_center_pos = targetElement_top + targetElement_height / 2 - toolTipElement_height / 2;
180
180
 
181
181
  let mouseX = 0;
@@ -235,7 +235,7 @@ export class ToolTip {
235
235
  */
236
236
  changePosition(event?: MouseEvent | TouchEvent | PointerEvent) {
237
237
  const positionInfo = this.calcToolTipPosition(
238
- this.$data.config.target,
238
+ this.$data.config.$target,
239
239
  this.$data.config.arrowDistance,
240
240
  this.$data.config.otherDistance,
241
241
  event
@@ -348,7 +348,7 @@ export class ToolTip {
348
348
  */
349
349
  onShowEvent() {
350
350
  popsDOMUtils.on(
351
- this.$data.config.target,
351
+ this.$data.config.$target,
352
352
  this.$data.config.triggerShowEventName,
353
353
  this.show,
354
354
  this.$data.config.eventOption
@@ -358,7 +358,7 @@ export class ToolTip {
358
358
  * 取消绑定 显示事件
359
359
  */
360
360
  offShowEvent() {
361
- popsDOMUtils.off(this.$data.config.target, this.$data.config.triggerShowEventName, this.show, {
361
+ popsDOMUtils.off(this.$data.config.$target, this.$data.config.triggerShowEventName, this.show, {
362
362
  capture: true,
363
363
  });
364
364
  }
@@ -373,7 +373,7 @@ export class ToolTip {
373
373
  if (event && event instanceof MouseEvent) {
374
374
  const $target = event.composedPath()[0];
375
375
  // 如果是目标元素的子元素/tooltip元素的子元素触发的话,那就不管
376
- if ($target != this.$data.config.target && $target != this.$el.$toolTip) {
376
+ if ($target != this.$data.config.$target && $target != this.$el.$toolTip) {
377
377
  return;
378
378
  }
379
379
  }
@@ -418,7 +418,7 @@ export class ToolTip {
418
418
  */
419
419
  onCloseEvent() {
420
420
  popsDOMUtils.on(
421
- this.$data.config.target,
421
+ this.$data.config.$target,
422
422
  this.$data.config.triggerCloseEventName,
423
423
  this.close,
424
424
  this.$data.config.eventOption
@@ -428,7 +428,7 @@ export class ToolTip {
428
428
  * 取消绑定 关闭事件
429
429
  */
430
430
  offCloseEvent() {
431
- popsDOMUtils.off(this.$data.config.target, this.$data.config.triggerCloseEventName, this.close, {
431
+ popsDOMUtils.off(this.$data.config.$target, this.$data.config.triggerCloseEventName, this.close, {
432
432
  capture: true,
433
433
  });
434
434
  }
@@ -537,7 +537,7 @@ export class ToolTip {
537
537
  }
538
538
  }
539
539
 
540
- export type PopsTooltipResult<T extends PopsToolTipDetails> = {
540
+ export type PopsTooltipResult<T extends PopsToolTipConfig> = {
541
541
  guid: string;
542
542
  config: T;
543
543
  $shadowContainer: HTMLDivElement;
@@ -546,15 +546,15 @@ export type PopsTooltipResult<T extends PopsToolTipDetails> = {
546
546
  };
547
547
 
548
548
  export const PopsTooltip = {
549
- init(details: PopsToolTipDetails) {
549
+ init(__config__: PopsToolTipConfig) {
550
550
  const guid = popsUtils.getRandomGUID();
551
551
  // 设置当前类型
552
552
  const popsType: PopsType = "tooltip";
553
553
 
554
- let config = PopsTooltipConfig();
554
+ let config = PopsTooltipDefaultConfig();
555
555
  config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
556
- config = popsUtils.assign(config, details);
557
- if (!(config.target instanceof HTMLElement)) {
556
+ config = popsUtils.assign(config, __config__);
557
+ if (!(config.$target instanceof HTMLElement)) {
558
558
  throw new TypeError("config.target 必须是HTMLElement类型");
559
559
  }
560
560
  config = PopsHandler.handleOnly(popsType, config);
@@ -584,11 +584,11 @@ export const PopsTooltip = {
584
584
  $shadowRoot,
585
585
  });
586
586
  if (config.alwaysShow) {
587
- /* 总是显示 */
588
- /* 直接显示 */
587
+ // 总是显示
588
+ // 直接显示
589
589
  toolTip.show();
590
590
  } else {
591
- /* 事件触发才显示 */
591
+ // 事件触发才显示
592
592
  }
593
593
 
594
594
  return {
@@ -1,5 +1,5 @@
1
- import type { PopsCommonConfig } from "../../../types/components";
2
- import type { PopsPanelCommonDetails } from "../../panel/types/components-common";
1
+ import type { PopsGeneralConfig } from "../../../types/components";
2
+ import type { PopsPanelGeneralConfig } from "../../panel/types/components-common";
3
3
 
4
4
  /** tooltip的出现位置 */
5
5
  export type PopsTooltipPosition = "top" | "right" | "bottom" | "left" | "follow";
@@ -7,12 +7,12 @@ export type PopsTooltipPosition = "top" | "right" | "bottom" | "left" | "follow"
7
7
  /**
8
8
  * pops.tooltip
9
9
  */
10
- export interface PopsToolTipDetails
11
- extends Pick<PopsCommonConfig, "useShadowRoot" | "only" | "zIndex" | "style" | "beforeAppendToPageCallBack"> {
10
+ export interface PopsToolTipConfig
11
+ extends Pick<PopsGeneralConfig, "useShadowRoot" | "only" | "zIndex" | "style" | "beforeAppendToPageCallBack"> {
12
12
  /**
13
13
  * 目标元素
14
14
  */
15
- target: HTMLElement;
15
+ $target: HTMLElement;
16
16
  /**
17
17
  * 显示的文字
18
18
  */
@@ -36,7 +36,7 @@ export interface PopsToolTipDetails
36
36
  * + `github-tooltip` github的样式
37
37
  * @default ""
38
38
  */
39
- className?: PopsPanelCommonDetails<any>["className"];
39
+ className?: PopsPanelGeneralConfig<any>["className"];
40
40
  /**
41
41
  * 是否使用fixed定位,false则是absolute定位
42
42
  *
@@ -69,7 +69,9 @@ export interface PopsToolTipDetails
69
69
  * 监听的事件配置
70
70
  */
71
71
  eventOption?: {
72
- [P in keyof AddEventListenerOptions]: AddEventListenerOptions[P];
72
+ once?: boolean;
73
+ passive?: boolean;
74
+ capture?: boolean;
73
75
  };
74
76
  /**
75
77
  * 触发显示前的回调
@@ -1,11 +1,11 @@
1
- import type { PopsCommonConfig, PopsDragConfig } from "../types/components";
1
+ import type { PopsGeneralConfig, PopsDragConfig } from "../types/components";
2
2
 
3
3
  type EnterReturnType<T> = null | T | (() => T);
4
4
 
5
5
  type GlobalConfigOption = {
6
6
  style?: EnterReturnType<string>;
7
7
  zIndex?: EnterReturnType<number> | EnterReturnType<string>;
8
- } & Partial<PopsCommonConfig> &
8
+ } & Partial<PopsGeneralConfig> &
9
9
  Partial<PopsDragConfig>;
10
10
 
11
11
  type ResultGlobalConfigOption<T> = T extends null | undefined ? never : T extends (...args: any) => infer R ? R : T;
@@ -1,16 +1,16 @@
1
- import type { PopsAlertDetails } from "../components/alert/types";
2
- import type { PopsConfirmDetails } from "../components/confirm/types";
3
- import type { PopsIframeDetails } from "../components/iframe/types";
1
+ import type { PopsAlertConfig } from "../components/alert/types";
2
+ import type { PopsConfirmConfig } from "../components/confirm/types";
3
+ import type { PopsIframeConfig } from "../components/iframe/types";
4
4
  import type { PopsIconType } from "../types/icon";
5
5
  import type {
6
- PopsSupportAnimDetails,
7
- PopsSupportBottomBtnDetails,
8
- PopsSupportContentDetails,
9
- PopsSupportHeaderTitleDetails,
10
- PopsSupportAnimDetailsType,
11
- PopsSupportBottomBtnDetailsType,
12
- PopsSupportContentDetailsType,
13
- PopsSupportHeaderTitleDetailsType,
6
+ PopsSupportAnimConfig,
7
+ PopsSupportBottomButtonConfig,
8
+ PopsSupportContentConfig,
9
+ PopsSupportHeaderTitleConfig,
10
+ PopsSupportAnimConfigType,
11
+ PopsSupportBottomButtonConfigType,
12
+ PopsSupportContentConfigType,
13
+ PopsSupportHeaderTitleConfigType,
14
14
  } from "../types/main";
15
15
  import { PopsIcon } from "../PopsIcon";
16
16
  import { popsDOMUtils } from "../utils/PopsDOMUtils";
@@ -40,13 +40,13 @@ export const PopsElementHandler = {
40
40
  */
41
41
  createAnim(
42
42
  guid: string,
43
- type: PopsSupportAnimDetailsType,
44
- config: PopsSupportAnimDetails[keyof PopsSupportAnimDetails],
43
+ type: PopsSupportAnimConfigType,
44
+ config: PopsSupportAnimConfig[keyof PopsSupportAnimConfig],
45
45
  html = "",
46
46
  bottomBtnHTML = "",
47
47
  zIndex: number
48
48
  ) {
49
- const __config = config as PopsAlertDetails;
49
+ const __config = config as PopsAlertConfig;
50
50
  let popsAnimStyle = "";
51
51
  let popsStyle = "";
52
52
  const popsPosition = __config.position || "";
@@ -76,22 +76,22 @@ export const PopsElementHandler = {
76
76
  * @param config
77
77
  */
78
78
  createHeader(
79
- type: PopsSupportHeaderTitleDetailsType,
80
- config: PopsSupportHeaderTitleDetails[keyof PopsSupportHeaderTitleDetails]
79
+ type: PopsSupportHeaderTitleConfigType,
80
+ config: PopsSupportHeaderTitleConfig[keyof PopsSupportHeaderTitleConfig]
81
81
  ): string {
82
82
  if (!config.btn) {
83
83
  return "";
84
84
  }
85
- const confirm_config = config as PopsConfirmDetails;
85
+ const confirm_config = config as PopsConfirmConfig;
86
86
  if (type !== "iframe" && !confirm_config.btn?.close?.enable) {
87
87
  return "";
88
88
  }
89
89
  let resultHTML = "";
90
90
  // let btnStyle = "";
91
91
  let closeHTML = "";
92
- const iframe_config = config as PopsIframeDetails;
92
+ const iframe_config = config as PopsIframeConfig;
93
93
  if (type === "iframe" && iframe_config.topRightButton?.trim() !== "") {
94
- /* iframe的 */
94
+ // iframe的
95
95
  let topRightButtonHTML = "";
96
96
  iframe_config.topRightButton.split("|").forEach((item: string) => {
97
97
  // 最小化、最大化、窗口化、关闭按钮
@@ -124,8 +124,8 @@ export const PopsElementHandler = {
124
124
  * @param config 弹窗配置
125
125
  */
126
126
  createHeaderStyle(
127
- type: PopsSupportHeaderTitleDetailsType,
128
- config: PopsSupportHeaderTitleDetails[keyof PopsSupportHeaderTitleDetails]
127
+ type: PopsSupportHeaderTitleConfigType,
128
+ config: PopsSupportHeaderTitleConfig[keyof PopsSupportHeaderTitleConfig]
129
129
  ) {
130
130
  return {
131
131
  headerStyle: config?.title?.html ? config?.title?.style || "" : "",
@@ -138,14 +138,14 @@ export const PopsElementHandler = {
138
138
  * @param config
139
139
  */
140
140
  createBottom(
141
- type: PopsSupportBottomBtnDetailsType,
142
- config: Omit<PopsSupportBottomBtnDetails[keyof PopsSupportBottomBtnDetails], "content">
141
+ type: PopsSupportBottomButtonConfigType,
142
+ config: Omit<PopsSupportBottomButtonConfig[keyof PopsSupportBottomButtonConfig], "content">
143
143
  ): string {
144
144
  if (config.btn == null) {
145
145
  // 未设置btn参数
146
146
  return "";
147
147
  }
148
- const confirm_config = config as Required<PopsConfirmDetails>;
148
+ const confirm_config = config as Required<PopsConfirmConfig>;
149
149
  if (!(config.btn?.ok?.enable || confirm_config.btn?.cancel?.enable || confirm_config.btn?.other?.enable)) {
150
150
  // 确定、取消、其它按钮都未启用直接返回
151
151
  return "";
@@ -164,7 +164,7 @@ export const PopsElementHandler = {
164
164
  btnStyle += "flex-direction: row-reverse;";
165
165
  }
166
166
  if (config.btn?.ok?.enable) {
167
- /* 处理确定按钮的尺寸问题 */
167
+ // 处理确定按钮的尺寸问题
168
168
  let okButtonSizeClassName = "";
169
169
  if (config.btn.ok.size === "large") {
170
170
  okButtonSizeClassName = "pops-button-" + config.btn.ok.size;
@@ -196,7 +196,7 @@ export const PopsElementHandler = {
196
196
  }
197
197
 
198
198
  if (confirm_config.btn?.cancel?.enable) {
199
- /* 处理取消按钮的尺寸问题 */
199
+ // 处理取消按钮的尺寸问题
200
200
  let cancelButtonSizeClassName = "";
201
201
 
202
202
  if (confirm_config.btn.cancel.size === "large") {
@@ -229,7 +229,7 @@ export const PopsElementHandler = {
229
229
  }
230
230
 
231
231
  if (confirm_config.btn?.other?.enable) {
232
- /* 处理其它按钮的尺寸问题 */
232
+ // 处理其它按钮的尺寸问题
233
233
  let otherButtonSizeClassName = "";
234
234
 
235
235
  if (confirm_config.btn.other.size === "large") {
@@ -285,12 +285,11 @@ export const PopsElementHandler = {
285
285
  * @param config 弹窗配置
286
286
  */
287
287
  createContentStyle(
288
- type: PopsSupportContentDetailsType,
289
- config: PopsSupportContentDetails[keyof PopsSupportContentDetails]
288
+ type: PopsSupportContentConfigType,
289
+ config: PopsSupportContentConfig[keyof PopsSupportContentConfig]
290
290
  ) {
291
291
  return {
292
292
  contentStyle: (config?.content as any)?.html ? config?.content?.style || "" : "",
293
-
294
293
  contentPStyle: (config?.content as any)?.html ? "" : config?.content?.style || "",
295
294
  };
296
295
  },
@@ -1,18 +1,18 @@
1
- import type { PopsAlertDetails } from "../components/alert/types";
2
- import type { PopsConfirmDetails } from "../components/confirm/types";
3
- import type { PopsDrawerDetails } from "../components/drawer/types";
4
- import type { PopsFolderDetails } from "../components/folder/types";
5
- import type { PopsIframeDetails } from "../components/iframe/types";
6
- import type { PopsLoadingDetails } from "../components/loading/types";
7
- import type { PopsPanelDetails } from "../components/panel/types";
8
- import type { PopsPromptDetails } from "../components/prompt/types/index";
1
+ import type { PopsAlertConfig } from "../components/alert/types";
2
+ import type { PopsConfirmConfig } from "../components/confirm/types";
3
+ import type { PopsDrawerConfig } from "../components/drawer/types";
4
+ import type { PopsFolderConfig } from "../components/folder/types";
5
+ import type { PopsIframeConfig } from "../components/iframe/types";
6
+ import type { PopsLoadingConfig } from "../components/loading/types";
7
+ import type { PopsPanelConfig } from "../components/panel/types";
8
+ import type { PopsPromptConfig } from "../components/prompt/types/index";
9
9
  import { PopsCore } from "../PopsCore";
10
10
  import { PopsAnimation } from "../PopsAnimation";
11
11
  import { PopsInstData } from "../PopsInst";
12
- import type { PopsCommonConfig } from "../types/components";
12
+ import type { PopsGeneralConfig } from "../types/components";
13
13
  import type { PopsEventConfig, PopsHandlerEventConfig } from "../types/event";
14
- import type { PopsInstCommonConfig } from "../types/inst";
15
- import type { PopsInstStoreType, PopsType, PopsSupportAnimDetailsType, PopsSupportOnlyDetails } from "../types/main";
14
+ import type { PopsInstGeneralConfig } from "../types/inst";
15
+ import type { PopsInstStoreType, PopsType, PopsSupportAnimConfigType, PopsSupportOnlyConfig } from "../types/main";
16
16
  import { popsDOMUtils } from "../utils/PopsDOMUtils";
17
17
  import { PopsInstanceUtils } from "../utils/PopsInstanceUtils";
18
18
  import { popsUtils } from "../utils/PopsUtils";
@@ -21,7 +21,7 @@ export const PopsHandler = {
21
21
  /**
22
22
  * 创建shadow
23
23
  */
24
- handlerShadow(config: Pick<PopsCommonConfig, "useShadowRoot">) {
24
+ handlerShadow(config: Pick<PopsGeneralConfig, "useShadowRoot">) {
25
25
  const $shadowContainer = popsDOMUtils.createElement("div", {
26
26
  className: "pops-shadow-container",
27
27
  });
@@ -110,12 +110,12 @@ export const PopsHandler = {
110
110
  type: "alert" | "confirm" | "prompt" | "loading" | "iframe" | "drawer" | "folder" | "panel";
111
111
  guid: string;
112
112
  config:
113
- | Required<PopsAlertDetails>
114
- | Required<PopsLoadingDetails>
115
- | Required<PopsIframeDetails>
116
- | Required<PopsDrawerDetails>
117
- | Required<PopsPanelDetails>
118
- | Required<PopsFolderDetails>;
113
+ | Required<PopsAlertConfig>
114
+ | Required<PopsLoadingConfig>
115
+ | Required<PopsIframeConfig>
116
+ | Required<PopsDrawerConfig>
117
+ | Required<PopsPanelConfig>
118
+ | Required<PopsFolderConfig>;
119
119
  animElement: HTMLElement;
120
120
  maskHTML: string;
121
121
  }
@@ -134,10 +134,10 @@ export const PopsHandler = {
134
134
  const targetInst = PopsInstData[config.type];
135
135
  function originalRun() {
136
136
  if (config.config.mask!.clickEvent!.toClose) {
137
- /* 关闭 */
137
+ // 关闭
138
138
  return PopsInstanceUtils.close(config.config, config.type, targetInst, config.guid, config.animElement);
139
139
  } else if (config.config.mask!.clickEvent!.toHide) {
140
- /* 隐藏 */
140
+ // 隐藏
141
141
  return PopsInstanceUtils.hide(
142
142
  config.config,
143
143
  config.type,
@@ -170,20 +170,20 @@ export const PopsHandler = {
170
170
  element.hasAttribute("anim")
171
171
  );
172
172
  }
173
- /* 判断按下的元素是否是pops-anim */
173
+ // 判断按下的元素是否是pops-anim
174
174
  popsDOMUtils.on(config.animElement, ["touchstart", "mousedown"], void 0, (event) => {
175
175
  const $click = event.composedPath()[0] as HTMLElement;
176
176
  isMaskClick = isAnimElement($click);
177
177
  });
178
- /* 如果有动画层,在动画层上监听点击事件 */
178
+ // 如果有动画层,在动画层上监听点击事件
179
179
  popsDOMUtils.on<MouseEvent | PointerEvent>(config.animElement, "click", void 0, (event) => {
180
180
  const $click = event.composedPath()[0] as HTMLElement;
181
181
  if (isAnimElement($click) && isMaskClick) {
182
182
  return clickEvent(event);
183
183
  }
184
184
  });
185
- /* 在遮罩层监听点击事件 */
186
- /* 如果有动画层,那么该点击事件触发不了 */
185
+ // 在遮罩层监听点击事件
186
+ // 如果有动画层,那么该点击事件触发不了
187
187
  popsDOMUtils.on<MouseEvent | PointerEvent>(result.maskElement, "click", void 0, (event) => {
188
188
  isMaskClick = true;
189
189
  clickEvent(event);
@@ -196,7 +196,7 @@ export const PopsHandler = {
196
196
  * @param animElement
197
197
  * @param type
198
198
  */
199
- handleQueryElement(animElement: HTMLDivElement, type: PopsSupportAnimDetailsType) {
199
+ handleQueryElement(animElement: HTMLDivElement, type: PopsSupportAnimConfigType) {
200
200
  return {
201
201
  /**
202
202
  * 主元素
@@ -351,14 +351,14 @@ export const PopsHandler = {
351
351
  */
352
352
  handleEventConfig(
353
353
  config:
354
- | PopsAlertDetails
355
- | PopsDrawerDetails
356
- | PopsPromptDetails
357
- | PopsConfirmDetails
358
- | PopsIframeDetails
359
- | PopsLoadingDetails
360
- | PopsPanelDetails
361
- | PopsFolderDetails,
354
+ | PopsAlertConfig
355
+ | PopsDrawerConfig
356
+ | PopsPromptConfig
357
+ | PopsConfirmConfig
358
+ | PopsIframeConfig
359
+ | PopsLoadingConfig
360
+ | PopsPanelConfig
361
+ | PopsFolderConfig,
362
362
  guid: string,
363
363
  $shadowContainer: HTMLDivElement,
364
364
  $shadowRoot: ShadowRoot | HTMLElement,
@@ -398,14 +398,14 @@ export const PopsHandler = {
398
398
  */
399
399
  handleLoadingEventConfig(
400
400
  config:
401
- | PopsAlertDetails
402
- | PopsDrawerDetails
403
- | PopsPromptDetails
404
- | PopsConfirmDetails
405
- | PopsIframeDetails
406
- | PopsLoadingDetails
407
- | PopsPanelDetails
408
- | PopsFolderDetails,
401
+ | PopsAlertConfig
402
+ | PopsDrawerConfig
403
+ | PopsPromptConfig
404
+ | PopsConfirmConfig
405
+ | PopsIframeConfig
406
+ | PopsLoadingConfig
407
+ | PopsPanelConfig
408
+ | PopsFolderConfig,
409
409
  guid: string,
410
410
  mode: "loading",
411
411
  $anim: HTMLDivElement,
@@ -560,7 +560,7 @@ export const PopsHandler = {
560
560
  * @param type 当前弹窗类型
561
561
  * @param config 配置
562
562
  */
563
- handleOnly<T extends Required<PopsSupportOnlyDetails[keyof PopsSupportOnlyDetails]>>(type: PopsType, config: T): T {
563
+ handleOnly<T extends Required<PopsSupportOnlyConfig[keyof PopsSupportOnlyConfig]>>(type: PopsType, config: T): T {
564
564
  if (config.only) {
565
565
  // .loading
566
566
  // .tooltip
@@ -602,7 +602,7 @@ export const PopsHandler = {
602
602
  * @param type 当前弹窗类型
603
603
  * @param value
604
604
  */
605
- handlePush(type: PopsInstStoreType, value: PopsInstCommonConfig) {
605
+ handlePush(type: PopsInstStoreType, value: PopsInstGeneralConfig) {
606
606
  PopsInstData[type].push(value);
607
607
  },
608
608
  };
@@ -1,6 +1,5 @@
1
1
  import type { PopsEventConfig, PopsHandlerEventConfig } from "./event";
2
2
  import type { PopsIconType } from "./icon";
3
- import type { PopsType } from "./main";
4
3
 
5
4
  /**
6
5
  * 按钮类型
@@ -24,56 +23,10 @@ export type PopsButtonStyleType =
24
23
  */
25
24
  export type PopsButtonSize = "large" | "small";
26
25
 
27
- /**
28
- * 按钮的点击回调参数event
29
- */
30
- export interface PopsBtnCallBackEvent {
31
- /**
32
- * 元素
33
- */
34
- element: HTMLElement;
35
- /**
36
- * 动画元素(包裹着弹窗元素)
37
- */
38
- animElement: HTMLElement;
39
- /**
40
- * 弹窗元素
41
- */
42
- popsElement: HTMLElement;
43
- /**
44
- * 遮罩层元素
45
- */
46
- maskElement: HTMLElement | undefined;
47
- /**
48
- * 按钮调用类型
49
- */
50
- type: PopsButtonType;
51
- /**
52
- * 调用的方法
53
- */
54
- mode: PopsType;
55
- /**
56
- * 唯一id
57
- */
58
- guid: string;
59
- /**
60
- * 关闭弹窗
61
- */
62
- close(): void;
63
- /**
64
- * 隐藏弹窗
65
- */
66
- hide(): void;
67
- /**
68
- * 显示弹窗
69
- */
70
- show(): void;
71
- }
72
-
73
26
  /**
74
27
  * 按钮配置
75
28
  */
76
- export interface PopsButtonDetails<T = object> {
29
+ export interface PopsGlobalButtonConfig<T = object> {
77
30
  /**
78
31
  * 是否启用按钮
79
32
  */
@@ -116,7 +69,7 @@ export interface PopsButtonDetails<T = object> {
116
69
  /**
117
70
  * 按钮配置(匹配任意类型)
118
71
  */
119
- export type PopsButtonDetailsAnyType<T = object> = Omit<PopsButtonDetails<T>, "type"> & {
72
+ export type PopsButtonConfigAnyType<T = object> = Omit<PopsGlobalButtonConfig<T>, "type"> & {
120
73
  /**
121
74
  * 按钮样式类型
122
75
  * @default "default"
@@ -124,56 +77,10 @@ export type PopsButtonDetailsAnyType<T = object> = Omit<PopsButtonDetails<T>, "t
124
77
  type: string;
125
78
  };
126
79
 
127
- /** prompt的点击回调 */
128
- export interface PopsPromptButtonDetails extends PopsButtonDetails {
129
- callback(
130
- eventConfig: PopsHandlerEventConfig & {
131
- text: string;
132
- },
133
- event: PointerEvent | MouseEvent
134
- ): void;
135
- }
136
- /**
137
- * 右上角关闭按钮点击回调的配置
138
- */
139
- export interface PopsHeaderCloseButtonClickCallBackEvent {
140
- /**
141
- * 动画元素(包裹着弹窗元素)
142
- */
143
- animElement: HTMLElement;
144
- /**
145
- * 遮罩层元素,如果未设置,那么不存在
146
- */
147
- maskElement?: HTMLElement;
148
- /**
149
- * 按钮调用类型
150
- */
151
- type: string;
152
- /**
153
- * 唯一id
154
- */
155
- guid: string;
156
- /**
157
- * 关闭弹窗
158
- */
159
- close(): void;
160
- /**
161
- * 隐藏弹窗
162
- */
163
- hide(): void;
164
- /**
165
- * 显示弹窗
166
- */
167
- show(): void;
168
- /**
169
- * 输入的内容
170
- */
171
- text: string;
172
- }
173
80
  /**
174
81
  * 顶部关闭按钮配置
175
82
  */
176
- export interface PopsHeaderCloseButtonDetails {
83
+ export interface PopsHeaderCloseButtonConfig {
177
84
  /**
178
85
  * 是否启用按钮
179
86
  */
@@ -183,5 +90,5 @@ export interface PopsHeaderCloseButtonDetails {
183
90
  *
184
91
  * 如果传入该值,那么将不会自动关闭弹窗
185
92
  */
186
- callback?: (details: PopsEventConfig, event: PointerEvent | MouseEvent) => void;
93
+ callback?: (eventConfig: PopsEventConfig, event: PointerEvent | MouseEvent) => void;
187
94
  }