@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
@@ -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
  }
@@ -105,10 +105,9 @@ export const PopsInstanceUtils = {
105
105
  getPopsMaxZIndex(deviation: number = 1) {
106
106
  deviation = Number.isNaN(deviation) ? 1 : deviation;
107
107
  // 最大值 2147483647
108
- // 最大值 2147483647
109
- // const maxZIndex = Math.pow(2, 31) - 1;
108
+ // const browserMaxZIndex = Math.pow(2, 31) - 1;
110
109
  // 比较值 2000000000
111
- const maxZIndexCompare = 2 * Math.pow(10, 9);
110
+ const maxZIndex = 2 * Math.pow(10, 9);
112
111
  // 当前页面最大的z-index
113
112
  let zIndex = 0;
114
113
  // 当前的最大z-index的元素,调试使用
@@ -139,17 +138,18 @@ export const PopsInstanceUtils = {
139
138
  }
140
139
  });
141
140
  zIndex += deviation;
142
- if (zIndex >= maxZIndexCompare) {
143
- // 最好不要超过最大值
144
- zIndex = maxZIndexCompare;
141
+ let isOverMaxZIndex = zIndex >= maxZIndex;
142
+ if (isOverMaxZIndex) {
143
+ // 超出z-index最大值
144
+ zIndex = maxZIndex;
145
145
  }
146
- return { zIndex: zIndex, animElement: maxZIndexNode };
146
+ return { zIndex: zIndex, animElement: maxZIndexNode, isOverMaxZIndex };
147
147
  },
148
148
  /**
149
149
  * 获取页面中最大的z-index
150
150
  * @param deviation 获取最大的z-index值的偏移,默认是+1
151
151
  * @example
152
- * Utils.getMaxZIndex();
152
+ * getMaxZIndex();
153
153
  * > 1001
154
154
  **/
155
155
  getMaxZIndex(deviation = 1): number {