@whitesev/pops 1.9.0 → 1.9.2

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 (75) hide show
  1. package/dist/index.amd.js +288 -170
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.cjs.js +288 -170
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.esm.js +288 -170
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.iife.js +288 -170
  8. package/dist/index.iife.js.map +1 -1
  9. package/dist/index.system.js +288 -170
  10. package/dist/index.system.js.map +1 -1
  11. package/dist/index.umd.js +288 -170
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/types/src/GlobalConfig.d.ts +1 -0
  14. package/dist/types/src/Pops.d.ts +2 -0
  15. package/dist/types/src/components/alert/config.d.ts +1 -1
  16. package/dist/types/src/components/confirm/config.d.ts +1 -1
  17. package/dist/types/src/components/drawer/config.d.ts +1 -1
  18. package/dist/types/src/components/folder/config.d.ts +1 -1
  19. package/dist/types/src/components/iframe/config.d.ts +1 -1
  20. package/dist/types/src/components/loading/config.d.ts +1 -1
  21. package/dist/types/src/components/panel/config.d.ts +1 -1
  22. package/dist/types/src/components/prompt/config.d.ts +1 -1
  23. package/dist/types/src/components/rightClickMenu/config.d.ts +1 -1
  24. package/dist/types/src/components/rightClickMenu/indexType.d.ts +4 -21
  25. package/dist/types/src/components/searchSuggestion/config.d.ts +1 -1
  26. package/dist/types/src/components/searchSuggestion/indexType.d.ts +2 -10
  27. package/dist/types/src/components/tooltip/config.d.ts +1 -1
  28. package/dist/types/src/components/tooltip/index.d.ts +5 -5
  29. package/dist/types/src/components/tooltip/indexType.d.ts +28 -28
  30. package/dist/types/src/handler/PopsElementHandler.d.ts +1 -1
  31. package/dist/types/src/handler/PopsHandler.d.ts +7 -3
  32. package/dist/types/src/types/button.d.ts +13 -19
  33. package/dist/types/src/types/components.d.ts +26 -11
  34. package/dist/types/src/types/event.d.ts +1 -1
  35. package/dist/types/src/types/global.d.ts +9 -0
  36. package/dist/types/src/types/layer.d.ts +1 -1
  37. package/dist/types/src/types/mask.d.ts +14 -11
  38. package/dist/types/src/utils/PopsInstanceUtils.d.ts +2 -1
  39. package/package.json +1 -1
  40. package/src/Pops.ts +1 -1
  41. package/src/components/alert/config.ts +10 -9
  42. package/src/components/alert/index.ts +9 -9
  43. package/src/components/confirm/config.ts +18 -24
  44. package/src/components/confirm/index.ts +9 -9
  45. package/src/components/drawer/config.ts +22 -21
  46. package/src/components/drawer/index.ts +9 -9
  47. package/src/components/folder/config.ts +17 -16
  48. package/src/components/folder/index.ts +32 -24
  49. package/src/components/iframe/config.ts +3 -3
  50. package/src/components/iframe/index.ts +15 -11
  51. package/src/components/loading/config.ts +3 -3
  52. package/src/components/loading/index.ts +1 -1
  53. package/src/components/panel/config.ts +65 -2
  54. package/src/components/panel/index.ts +13 -11
  55. package/src/components/prompt/config.ts +17 -27
  56. package/src/components/prompt/index.ts +10 -8
  57. package/src/components/rightClickMenu/config.ts +117 -109
  58. package/src/components/rightClickMenu/index.ts +13 -12
  59. package/src/components/rightClickMenu/indexType.ts +13 -24
  60. package/src/components/searchSuggestion/config.ts +2 -1
  61. package/src/components/searchSuggestion/index.ts +11 -10
  62. package/src/components/searchSuggestion/indexType.ts +4 -10
  63. package/src/components/tooltip/config.ts +7 -5
  64. package/src/components/tooltip/index.ts +34 -21
  65. package/src/components/tooltip/indexType.ts +38 -35
  66. package/src/css/index.css +1 -1
  67. package/src/handler/PopsElementHandler.ts +2 -2
  68. package/src/handler/PopsHandler.ts +24 -20
  69. package/src/types/button.d.ts +13 -19
  70. package/src/types/components.d.ts +26 -11
  71. package/src/types/event.d.ts +1 -1
  72. package/src/types/global.d.ts +9 -0
  73. package/src/types/layer.d.ts +1 -1
  74. package/src/types/mask.d.ts +14 -11
  75. package/src/utils/PopsInstanceUtils.ts +8 -8
@@ -16,6 +16,7 @@ export declare const GlobalConfig: {
16
16
  getGlobalConfig(): {
17
17
  style?: string | undefined;
18
18
  zIndex?: string | number | undefined;
19
+ useShadowRoot?: boolean | undefined;
19
20
  class?: string | undefined;
20
21
  only?: boolean | undefined;
21
22
  width?: string | undefined;
@@ -153,6 +153,7 @@ declare class Pops {
153
153
  getPopsMaxZIndex(deviation?: number): {
154
154
  zIndex: number;
155
155
  animElement: HTMLDivElement | null;
156
+ isOverMaxZIndex: boolean;
156
157
  };
157
158
  getMaxZIndex(deviation?: number): number;
158
159
  getKeyFrames(sheet: CSSStyleSheet): {};
@@ -247,6 +248,7 @@ declare class Pops {
247
248
  getGlobalConfig(): {
248
249
  style?: string | undefined;
249
250
  zIndex?: string | number | undefined;
251
+ useShadowRoot?: boolean | undefined;
250
252
  class?: string | undefined;
251
253
  only?: boolean | undefined;
252
254
  width?: string | undefined;
@@ -1,2 +1,2 @@
1
1
  import type { PopsAlertDetails } from "./indexType";
2
- export declare const PopsAlertConfig: () => Required<PopsAlertDetails>;
2
+ export declare const PopsAlertConfig: () => DeepRequired<PopsAlertDetails>;
@@ -1,2 +1,2 @@
1
1
  import type { PopsConfirmDetails } from "./indexType";
2
- export declare const PopsConfirmConfig: () => Required<PopsConfirmDetails>;
2
+ export declare const PopsConfirmConfig: () => DeepRequired<PopsConfirmDetails>;
@@ -1,2 +1,2 @@
1
1
  import type { PopsDrawerDetails } from "./indexType";
2
- export declare const PopsDrawerConfig: () => Required<PopsDrawerDetails>;
2
+ export declare const PopsDrawerConfig: () => DeepRequired<PopsDrawerDetails>;
@@ -1,2 +1,2 @@
1
1
  import type { PopsFolderDetails } from "./indexType";
2
- export declare const PopsFolderConfig: () => Required<PopsFolderDetails>;
2
+ export declare const PopsFolderConfig: () => DeepRequired<PopsFolderDetails>;
@@ -1,2 +1,2 @@
1
1
  import type { PopsIframeDetails } from "./indexType";
2
- export declare const PopsIframeConfig: () => Required<PopsIframeDetails>;
2
+ export declare const PopsIframeConfig: () => DeepRequired<PopsIframeDetails>;
@@ -1,2 +1,2 @@
1
1
  import type { PopsLoadingDetails } from "./indexType";
2
- export declare const PopsLoadingConfig: () => Required<PopsLoadingDetails>;
2
+ export declare const PopsLoadingConfig: () => DeepRequired<PopsLoadingDetails>;
@@ -1,2 +1,2 @@
1
1
  import type { PopsPanelDetails } from "./indexType";
2
- export declare const PopsPanelConfig: () => Required<PopsPanelDetails>;
2
+ export declare const PopsPanelConfig: () => DeepRequired<PopsPanelDetails>;
@@ -1,2 +1,2 @@
1
1
  import type { PopsPromptDetails } from "./indexType";
2
- export declare const PopsPromptConfig: () => Required<PopsPromptDetails>;
2
+ export declare const PopsPromptConfig: () => DeepRequired<PopsPromptDetails>;
@@ -1,2 +1,2 @@
1
1
  import type { PopsRightClickMenuDetails } from "./indexType";
2
- export declare const rightClickMenuConfig: () => Required<PopsRightClickMenuDetails>;
2
+ export declare const rightClickMenuConfig: () => DeepRequired<PopsRightClickMenuDetails>;
@@ -1,3 +1,4 @@
1
+ import type { PopsCommonConfig } from "../../types/components";
1
2
  import type { PopsIcon } from "../../types/icon";
2
3
  /**
3
4
  * pops.rightClickMenu的右键菜单配置
@@ -34,11 +35,11 @@ export interface PopsRightClickMenuDataDetails {
34
35
  /**
35
36
  * pops.rightClickMenu
36
37
  */
37
- export interface PopsRightClickMenuDetails {
38
+ export interface PopsRightClickMenuDetails extends Pick<PopsCommonConfig, "useShadowRoot" | "beforeAppendToPageCallBack" | "zIndex" | "style" | "only"> {
38
39
  /**
39
- * 目标,默认为document.documentElement
40
+ * 目标,默认为document.documentElement G
40
41
  */
41
- target?: HTMLElement | typeof globalThis | Window | EventTarget | Node;
42
+ target?: HTMLElement | (typeof globalThis & Window) | Window | EventTarget | Node;
42
43
  /**
43
44
  * 目标的子元素选择器,默认为空
44
45
  */
@@ -51,30 +52,12 @@ export interface PopsRightClickMenuDetails {
51
52
  * 自定义className,默认为空
52
53
  */
53
54
  className?: string;
54
- /**
55
- * 是否是唯一的弹窗,默认false
56
- */
57
- only?: boolean;
58
55
  /**
59
56
  * 是否启用动画,默认true
60
57
  */
61
58
  isAnimation?: boolean;
62
- /**
63
- * 弹窗的显示层级,默认10000
64
- */
65
- zIndex?: number | (() => number);
66
59
  /**
67
60
  * 是否阻止默认contextmenu事件
68
61
  */
69
62
  preventDefault?: boolean;
70
- /**
71
- * (可选)自定义style
72
- */
73
- style?: string | null;
74
- /**
75
- * 在元素添加到页面前的事件
76
- * @param $shadowRoot 根元素
77
- * @param $shadowContainer 容器
78
- */
79
- beforeAppendToPageCallBack?: ($shadowRoot: ShadowRoot, $shadowContainer: HTMLDivElement) => void;
80
63
  }
@@ -1,2 +1,2 @@
1
1
  import type { PopsSearchSuggestionDetails } from "./indexType";
2
- export declare const searchSuggestionConfig: () => Required<PopsSearchSuggestionDetails>;
2
+ export declare const searchSuggestionConfig: () => DeepRequired<PopsSearchSuggestionDetails>;
@@ -1,8 +1,9 @@
1
+ import type { PopsCommonConfig } from "../../types/components";
1
2
  /**
2
3
  * 搜索建议悬浮窗
3
4
  * pops.searchSuggestion
4
5
  */
5
- export interface PopsSearchSuggestionDetails<T = any> {
6
+ export interface PopsSearchSuggestionDetails<T = any> extends Pick<PopsCommonConfig, "useShadowRoot" | "zIndex" | "style"> {
6
7
  /**
7
8
  * 当前的环境,可以是document,可以是shadowroot,默认是document
8
9
  * @default document
@@ -78,11 +79,6 @@ export interface PopsSearchSuggestionDetails<T = any> {
78
79
  * @default true
79
80
  */
80
81
  positionTopToReverse?: boolean;
81
- /**
82
- * 层级,默认10000
83
- * @default 10000
84
- */
85
- zIndex?: number | (() => number);
86
82
  /**
87
83
  * 搜索中的提示
88
84
  *
@@ -134,10 +130,6 @@ export interface PopsSearchSuggestionDetails<T = any> {
134
130
  * @param data config.data的数据
135
131
  */
136
132
  selectCallBack?: (event: MouseEvent, liElement: HTMLLIElement, data: T) => void;
137
- /**
138
- * (可选)自定义style
139
- */
140
- style?: string;
141
133
  }
142
134
  /**
143
135
  * pops.searchSuggestion的函数返回值
@@ -1,2 +1,2 @@
1
1
  import type { PopsToolTipDetails } from "./indexType";
2
- export declare const PopsTooltipConfig: () => Required<PopsToolTipDetails>;
2
+ export declare const PopsTooltipConfig: () => DeepRequired<PopsToolTipDetails>;
@@ -3,7 +3,7 @@ type ToolTipEventTypeName = "MouseEvent" | "TouchEvent";
3
3
  export declare class ToolTip {
4
4
  $el: {
5
5
  $shadowContainer: HTMLDivElement;
6
- $shadowRoot: ShadowRoot;
6
+ $shadowRoot: ShadowRoot | HTMLElement;
7
7
  $toolTip: HTMLElement;
8
8
  $content: HTMLElement;
9
9
  $arrow: HTMLElement;
@@ -16,7 +16,7 @@ export declare class ToolTip {
16
16
  };
17
17
  constructor(config: Required<PopsToolTipDetails>, guid: string, ShadowInfo: {
18
18
  $shadowContainer: HTMLDivElement;
19
- $shadowRoot: ShadowRoot;
19
+ $shadowRoot: ShadowRoot | HTMLElement;
20
20
  });
21
21
  init(): void;
22
22
  /**
@@ -45,12 +45,12 @@ export declare class ToolTip {
45
45
  */
46
46
  changeZIndex(): void;
47
47
  /**
48
- * 获取 提示框的位置
48
+ * 计算 提示框的位置
49
49
  * @param targetElement 目标元素
50
50
  * @param arrowDistance 箭头和目标元素的距离
51
51
  * @param otherDistance 其它位置的偏移
52
52
  */
53
- getPosition(targetElement: HTMLElement, arrowDistance: number, otherDistance: number): {
53
+ calcToolTipPosition(targetElement: HTMLElement, arrowDistance: number, otherDistance: number): {
54
54
  TOP: {
55
55
  left: number;
56
56
  top: number;
@@ -154,7 +154,7 @@ export declare class ToolTip {
154
154
  /**
155
155
  * 鼠标|触摸离开事件
156
156
  */
157
- toolTipMouseLeaveEvent(): void;
157
+ toolTipMouseLeaveEvent(event: MouseEvent | PointerEvent): void;
158
158
  /**
159
159
  * 监听鼠标|触摸离开事件
160
160
  */
@@ -1,9 +1,10 @@
1
+ import type { PopsCommonConfig } from "../../types/components";
1
2
  /** tooltip的出现位置 */
2
3
  export type PopsTooltipPosition = "top" | "right" | "bottom" | "left";
3
4
  /**
4
5
  * pops.tooltip
5
6
  */
6
- export interface PopsToolTipDetails {
7
+ export interface PopsToolTipDetails extends Pick<PopsCommonConfig, "useShadowRoot" | "only" | "zIndex" | "style" | "beforeAppendToPageCallBack"> {
7
8
  /**
8
9
  * 目标元素
9
10
  */
@@ -13,12 +14,15 @@ export interface PopsToolTipDetails {
13
14
  */
14
15
  content: string | (() => string);
15
16
  /**
16
- * 位置,默认top
17
+ * 位置
18
+ * @default "top"
17
19
  */
18
20
  position?: PopsTooltipPosition;
19
21
  /**
20
- * 自定义className,默认为空
21
- * + github-tooltip
22
+ * 自定义className
23
+ *
24
+ * + github-tooltip github的样式
25
+ * @default ""
22
26
  */
23
27
  className?: string;
24
28
  /**
@@ -41,24 +45,20 @@ export interface PopsToolTipDetails {
41
45
  delayCloseTime?: number;
42
46
  /**
43
47
  * 触发显示事件的名称,默认mouseenter touchstart,如果是多个事件,按空格分割
48
+ * @default "mouseenter touchstart"
44
49
  */
45
50
  triggerShowEventName?: string;
46
51
  /**
47
52
  * 触发关闭事件的名称,默认mouseleave touchend,如果是多个事件,按空格分割
53
+ * @default "mouseleave touchend"
48
54
  */
49
55
  triggerCloseEventName?: string;
50
- /**
51
- * z-index,默认10000
52
- */
53
- zIndex?: number | (() => number);
54
- /**
55
- * 是否唯一,默认false
56
- */
57
- only?: boolean;
58
56
  /**
59
57
  * 监听的事件配置
60
58
  */
61
- eventOption?: AddEventListenerOptions;
59
+ eventOption?: {
60
+ [P in keyof AddEventListenerOptions]: AddEventListenerOptions[P];
61
+ };
62
62
  /**
63
63
  * 触发显示前的回调
64
64
  * @returns
@@ -71,34 +71,34 @@ export interface PopsToolTipDetails {
71
71
  showAfterCallBack?: ($toolTip: HTMLElement) => void;
72
72
  /**
73
73
  * 触发关闭前的回调
74
+ */
75
+ closeBeforeCallBack?: (
76
+ /**
77
+ *
74
78
  * @returns
75
79
  * + false 可阻止关闭
76
80
  */
77
- closeBeforeCallBack?: ($toolTip: HTMLElement) => false | void;
81
+ $toolTip: HTMLElement) => false | void;
78
82
  /**
79
83
  * 触发关闭后的回调
80
84
  */
81
85
  closeAfterCallBack?: ($toolTip: HTMLElement) => void;
82
86
  /**
83
- * 箭头与目标的的距离,默认12.5(px)
87
+ * 是否显示箭头
88
+ * @default true
89
+ */
90
+ showArrow?: boolean;
91
+ /**
92
+ * 箭头与目标的的距离(px)
93
+ *
94
+ * @default 12.5
84
95
  */
85
96
  arrowDistance?: number;
86
97
  /**
87
- * 其它的距离,默认0(px)
98
+ * 其它的距离(px)
88
99
  * + 当position为left或者right,这个距离是上、下距离
89
100
  * + 当position为top或者bottom,这个距离是左、右距离
101
+ * @default 0
90
102
  */
91
103
  otherDistance?: number;
92
- /**
93
- * (可选)自定义style
94
- */
95
- style?: string;
96
- /**
97
- * 在元素添加到页面前的事件
98
- *
99
- * 当tooltip添加到ShadowRoot内时也会触发
100
- * @param $shadowRoot 根元素
101
- * @param $shadowContainer 容器
102
- */
103
- beforeAppendToPageCallBack?: ($shadowRoot: ShadowRoot, $shadowContainer: HTMLDivElement) => void;
104
104
  }
@@ -28,7 +28,7 @@ export declare const PopsElementHandler: {
28
28
  * @param type
29
29
  * @param config
30
30
  */
31
- getBottomBtnHTML(type: PopsTypeSupportBottomBtn, config: PopsSupportBottomBtn[keyof PopsSupportBottomBtn]): string;
31
+ getBottomBtnHTML(type: PopsTypeSupportBottomBtn, config: Omit<PopsSupportBottomBtn[keyof PopsSupportBottomBtn], "content">): string;
32
32
  /**
33
33
  * 获取标题style
34
34
  * @param type
@@ -6,6 +6,7 @@ import type { PopsIframeDetails } from "../components/iframe/indexType";
6
6
  import type { PopsLoadingDetails } from "../components/loading/indexType";
7
7
  import type { PopsPanelDetails } from "../components/panel/indexType";
8
8
  import type { PopsPromptDetails } from "../components/prompt/indexType";
9
+ import type { PopsCommonConfig } from "../types/components";
9
10
  import { PopsEventDetails, PopsHandlerEventDetails } from "../types/event";
10
11
  import { PopsLayerCommonConfig } from "../types/layer";
11
12
  import type { PopsAllDetails, PopsLayerMode, PopsMode, PopsType } from "../types/main";
@@ -13,16 +14,19 @@ export declare const PopsHandler: {
13
14
  /**
14
15
  * 创建shadow
15
16
  */
16
- handlerShadow(): {
17
+ handlerShadow(config: Pick<PopsCommonConfig, "useShadowRoot">): {
17
18
  $shadowContainer: HTMLDivElement;
18
19
  $shadowRoot: ShadowRoot;
20
+ } | {
21
+ $shadowContainer: HTMLDivElement;
22
+ $shadowRoot: HTMLDivElement;
19
23
  };
20
24
  /**
21
25
  * 处理初始化
22
26
  * @param $shadowRoot 所在的shadowRoot
23
27
  * @param cssText 添加进ShadowRoot的CSS
24
28
  */
25
- handleInit($shadowRoot?: ShadowRoot, cssText?: string | string[]): void;
29
+ handleInit($shadowRoot?: ShadowRoot | HTMLElement, cssText?: string | string[]): void;
26
30
  /**
27
31
  * 处理遮罩层
28
32
  *
@@ -156,7 +160,7 @@ export declare const PopsHandler: {
156
160
  * @param maskElement 遮罩层
157
161
  * @param config 当前配置
158
162
  */
159
- handleEventDetails(guid: string, $shadowContainer: HTMLDivElement, $shadowRoot: ShadowRoot, mode: PopsLayerMode, animElement: HTMLDivElement, popsElement: HTMLDivElement, maskElement: HTMLDivElement, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails): PopsEventDetails;
163
+ handleEventDetails(guid: string, $shadowContainer: HTMLDivElement, $shadowRoot: ShadowRoot | HTMLElement, mode: PopsLayerMode, animElement: HTMLDivElement, popsElement: HTMLDivElement, maskElement: HTMLDivElement, config: PopsAlertDetails | PopsDrawerDetails | PopsPromptDetails | PopsConfirmDetails | PopsIframeDetails | PopsLoadingDetails | PopsPanelDetails | PopsFolderDetails): PopsEventDetails;
160
164
  /**
161
165
  * 获取loading的事件配置
162
166
  * @param guid
@@ -85,15 +85,18 @@ export interface PopsButtonDetails<T = {}> {
85
85
  */
86
86
  rightIcon: boolean;
87
87
  /**
88
- * 图标按钮是否是旋转360°,默认false
88
+ * 图标按钮是否是旋转360°
89
+ * @default false
89
90
  */
90
91
  iconIsLoading: boolean;
91
92
  /**
92
- * 按钮尺寸大小,默认为空
93
+ * 按钮尺寸大小
94
+ * @default ""
93
95
  */
94
- size: PopsButtonSize;
96
+ size: PopsButtonSize | "";
95
97
  /**
96
- * 按钮样式类型,默认为default
98
+ * 按钮样式类型
99
+ * @default "default"
97
100
  */
98
101
  type: PopsButtonStyleType;
99
102
  /**
@@ -126,11 +129,13 @@ export interface PopsButtonDetailsAnyType<T = {}> {
126
129
  */
127
130
  rightIcon: boolean;
128
131
  /**
129
- * 图标按钮是否是旋转360°,默认false
132
+ * 图标按钮是否是旋转360°
133
+ * @default false
130
134
  */
131
135
  iconIsLoading: boolean;
132
136
  /**
133
- * 按钮尺寸大小,默认为空
137
+ * 按钮尺寸大小
138
+ * @default ""
134
139
  */
135
140
  size: PopsButtonSize;
136
141
  /**
@@ -138,7 +143,8 @@ export interface PopsButtonDetailsAnyType<T = {}> {
138
143
  */
139
144
  type: string;
140
145
  /**
141
- * 按钮文字,默认为空
146
+ * 按钮文字
147
+ * @default ""
142
148
  */
143
149
  text: string;
144
150
  /**
@@ -204,18 +210,6 @@ export interface PopsHeaderCloseButtonDetails {
204
210
  * 是否启用按钮
205
211
  */
206
212
  enable?: boolean;
207
- /**
208
- * 按钮尺寸大小,默认为空
209
- */
210
- size?: PopsButtonSize;
211
- /**
212
- * 按钮样式类型,默认为default
213
- */
214
- type?: PopsButtonStyleType;
215
- /**
216
- * 按钮文字,默认为空
217
- */
218
- text?: string;
219
213
  /**
220
214
  * 按钮点击的回调
221
215
  */
@@ -154,36 +154,50 @@ export interface PopsDragConfig {
154
154
  */
155
155
  export interface PopsCommonConfig {
156
156
  /**
157
- * 自定义的className,默认为空
157
+ * 是否使用shadowRoot
158
+ *
159
+ * @default true
160
+ */
161
+ useShadowRoot?: boolean;
162
+ /**
163
+ * 自定义的className
164
+ *
165
+ * @default ""
158
166
  */
159
167
  class?: string;
160
168
  /**
161
- * 是否是唯一的,默认false
169
+ * 是否是唯一的
170
+ *
162
171
  * @default false
163
172
  */
164
173
  only?: boolean;
165
174
  /**
166
- * 宽度,默认350px
167
- * @default 350
175
+ * 宽度
176
+ *
177
+ * @default "350px"
168
178
  */
169
179
  width: string;
170
180
  /**
171
- * 高度,默认200px
172
- * @default 200
181
+ * 高度
182
+ *
183
+ * @default "200px"
173
184
  */
174
185
  height: string;
175
186
  /**
176
- * 位置,默认center
187
+ * 位置
188
+ *
177
189
  * @default "center"
178
190
  */
179
191
  position?: PopsPosition;
180
192
  /**
181
- * 动画,默认pops-anim-fadein-zoom
193
+ * 动画
194
+ *
182
195
  * @default "pops-anim-fadein-zoom"
183
196
  */
184
197
  animation?: PopsAnimation;
185
198
  /**
186
- * z-index显示层级,默认10000
199
+ * z-index显示层级
200
+ *
187
201
  * @default 10000
188
202
  */
189
203
  zIndex?: number | (() => number);
@@ -192,9 +206,10 @@ export interface PopsCommonConfig {
192
206
  */
193
207
  mask?: PopsMaskDetails;
194
208
  /**
195
- * 是否禁用页面滚动,默认false
209
+ * 是否禁用页面滚动
196
210
  *
197
211
  * 暂时不会生效
212
+ *
198
213
  * @default false
199
214
  */
200
215
  forbiddenScroll?: boolean;
@@ -208,7 +223,7 @@ export interface PopsCommonConfig {
208
223
  * @param $shadowContainer 容器
209
224
  */
210
225
  beforeAppendToPageCallBack?: (
211
- $shadowRoot: ShadowRoot,
226
+ $shadowRoot: ShadowRoot | HTMLElement,
212
227
  $shadowContainer: HTMLDivElement
213
228
  ) => void;
214
229
  }
@@ -36,7 +36,7 @@ export interface PopsEventDetails {
36
36
  /** 最外层包裹的元素 */
37
37
  $shadowContainer: HTMLDivElement;
38
38
  /** ShadowRoot */
39
- $shadowRoot: ShadowRoot;
39
+ $shadowRoot: ShadowRoot | HTMLElement;
40
40
  /** -> 动画层 */
41
41
  element: HTMLDivElement;
42
42
  /** 动画层 */
@@ -9,3 +9,12 @@ declare module "*.svg" {
9
9
  const content: string;
10
10
  export default content;
11
11
  }
12
+ type DeepRequired<T> = T extends Function
13
+ ? T
14
+ : T extends object
15
+ ? T extends Node
16
+ ? T
17
+ : {
18
+ [K in keyof T]-?: DeepRequired<T[K]>;
19
+ }
20
+ : T;
@@ -16,7 +16,7 @@ export interface PopsLayerCommonConfig extends PopsLayerConfig {
16
16
  /** shadow容器 */
17
17
  $shadowContainer: HTMLDivElement;
18
18
  /** shadow容器的shandowRoot */
19
- $shadowRoot: ShadowRoot;
19
+ $shadowRoot: ShadowRoot | HTMLElement;
20
20
  /** 移除实例前的回调函数 */
21
21
  beforeRemoveCallBack?: (layerCommonConfig: PopsLayerCommonConfig) => void;
22
22
  }
@@ -24,15 +24,18 @@ export interface PopsMaskDetails {
24
24
  * @param originalRun 当toClose为true,它是关闭弹窗,当toHide为true,它是隐藏弹窗
25
25
  * @param config 配置信息
26
26
  */
27
- clickCallBack?: (
28
- originalRun: () => void,
29
- config:
30
- | PopsAlertDetails
31
- | PopsDrawerDetails
32
- | PopsIframeDetails
33
- | PopsPromptDetails
34
- | PopsFolderDetails
35
- | PopsLoadingDetails
36
- | PopsPanelDetails
37
- ) => void;
27
+ clickCallBack?:
28
+ | ((
29
+ originalRun: () => void,
30
+ config:
31
+ | PopsAlertDetails
32
+ | PopsDrawerDetails
33
+ | PopsIframeDetails
34
+ | PopsPromptDetails
35
+ | PopsFolderDetails
36
+ | PopsLoadingDetails
37
+ | PopsPanelDetails
38
+ ) => void)
39
+ | undefined
40
+ | null;
38
41
  }
@@ -32,12 +32,13 @@ export declare const PopsInstanceUtils: {
32
32
  getPopsMaxZIndex(deviation?: number): {
33
33
  zIndex: number;
34
34
  animElement: HTMLDivElement | null;
35
+ isOverMaxZIndex: boolean;
35
36
  };
36
37
  /**
37
38
  * 获取页面中最大的z-index
38
39
  * @param deviation 获取最大的z-index值的偏移,默认是+1
39
40
  * @example
40
- * Utils.getMaxZIndex();
41
+ * getMaxZIndex();
41
42
  * > 1001
42
43
  **/
43
44
  getMaxZIndex(deviation?: number): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/pops",
3
- "version": "1.9.0",
3
+ "version": "1.9.2",
4
4
  "description": "弹窗库",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
package/src/Pops.ts CHANGED
@@ -83,7 +83,7 @@ class Pops {
83
83
  /** 配置 */
84
84
  config = {
85
85
  /** 版本号 */
86
- version: "2024.11.3",
86
+ version: "2024.11.24",
87
87
  cssText: {
88
88
  /** 主CSS */
89
89
  index: indexCSS,