@whitesev/pops 3.2.0 → 3.2.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 (126) hide show
  1. package/README.md +249 -249
  2. package/dist/index.amd.js +702 -667
  3. package/dist/index.amd.js.map +1 -1
  4. package/dist/index.amd.min.js +1 -1
  5. package/dist/index.amd.min.js.map +1 -1
  6. package/dist/index.cjs.js +702 -667
  7. package/dist/index.cjs.js.map +1 -1
  8. package/dist/index.cjs.min.js +1 -1
  9. package/dist/index.cjs.min.js.map +1 -1
  10. package/dist/index.esm.js +702 -667
  11. package/dist/index.esm.js.map +1 -1
  12. package/dist/index.esm.min.js +1 -1
  13. package/dist/index.esm.min.js.map +1 -1
  14. package/dist/index.iife.js +702 -667
  15. package/dist/index.iife.js.map +1 -1
  16. package/dist/index.iife.min.js +1 -1
  17. package/dist/index.iife.min.js.map +1 -1
  18. package/dist/index.system.js +702 -667
  19. package/dist/index.system.js.map +1 -1
  20. package/dist/index.system.min.js +1 -1
  21. package/dist/index.system.min.js.map +1 -1
  22. package/dist/index.umd.js +702 -667
  23. package/dist/index.umd.js.map +1 -1
  24. package/dist/index.umd.min.js +1 -1
  25. package/dist/index.umd.min.js.map +1 -1
  26. package/dist/types/src/components/folder/types/index.d.ts +43 -13
  27. package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +313 -313
  28. package/dist/types/src/types/animation.d.ts +19 -19
  29. package/dist/types/src/types/button.d.ts +94 -94
  30. package/dist/types/src/types/components.d.ts +211 -211
  31. package/dist/types/src/types/event.d.ts +43 -43
  32. package/dist/types/src/types/global.d.ts +31 -31
  33. package/dist/types/src/types/icon.d.ts +32 -32
  34. package/dist/types/src/types/inst.d.ts +28 -28
  35. package/dist/types/src/types/main.d.ts +66 -66
  36. package/dist/types/src/types/mask.d.ts +52 -52
  37. package/dist/types/src/types/position.d.ts +60 -60
  38. package/package.json +27 -25
  39. package/src/Pops.ts +206 -206
  40. package/src/PopsAnimation.ts +32 -32
  41. package/src/PopsCSS.ts +54 -54
  42. package/src/PopsCore.ts +37 -37
  43. package/src/PopsIcon.ts +95 -95
  44. package/src/PopsInst.ts +21 -21
  45. package/src/components/alert/defaultConfig.ts +62 -62
  46. package/src/components/alert/index.ts +163 -163
  47. package/src/components/alert/types/index.ts +23 -23
  48. package/src/components/confirm/defaultConfig.ts +90 -90
  49. package/src/components/confirm/index.ts +165 -165
  50. package/src/components/confirm/types/index.ts +13 -17
  51. package/src/components/drawer/defaultConfig.ts +89 -89
  52. package/src/components/drawer/index.css +37 -37
  53. package/src/components/drawer/index.ts +245 -245
  54. package/src/components/drawer/types/index.ts +62 -61
  55. package/src/components/folder/defaultConfig.ts +151 -151
  56. package/src/components/folder/folderIcon.ts +28 -28
  57. package/src/components/folder/index.css +303 -303
  58. package/src/components/folder/index.ts +953 -932
  59. package/src/components/folder/types/index.ts +143 -110
  60. package/src/components/iframe/defaultConfig.ts +60 -60
  61. package/src/components/iframe/index.css +76 -76
  62. package/src/components/iframe/index.ts +331 -331
  63. package/src/components/iframe/types/index.ts +96 -96
  64. package/src/components/loading/defaultConfig.ts +29 -29
  65. package/src/components/loading/index.css +66 -66
  66. package/src/components/loading/index.ts +101 -101
  67. package/src/components/loading/types/index.ts +36 -34
  68. package/src/components/panel/css/components-select.css +84 -84
  69. package/src/components/panel/defaultConfig.ts +868 -868
  70. package/src/components/panel/handlerComponents.ts +3993 -3993
  71. package/src/components/panel/index.css +1403 -1401
  72. package/src/components/panel/index.ts +221 -221
  73. package/src/components/panel/types/components-button.ts +56 -56
  74. package/src/components/panel/types/components-common.ts +73 -73
  75. package/src/components/panel/types/components-container.ts +25 -25
  76. package/src/components/panel/types/components-deepMenu.ts +64 -64
  77. package/src/components/panel/types/components-input.ts +90 -90
  78. package/src/components/panel/types/components-own.ts +16 -16
  79. package/src/components/panel/types/components-select.ts +169 -169
  80. package/src/components/panel/types/components-selectMultiple.ts +105 -104
  81. package/src/components/panel/types/components-slider.ts +55 -55
  82. package/src/components/panel/types/components-switch.ts +33 -33
  83. package/src/components/panel/types/components-textarea.ts +45 -45
  84. package/src/components/panel/types/index.ts +244 -244
  85. package/src/components/prompt/defaultConfig.ts +94 -94
  86. package/src/components/prompt/index.css +34 -34
  87. package/src/components/prompt/index.ts +187 -215
  88. package/src/components/prompt/types/index.ts +57 -56
  89. package/src/components/rightClickMenu/defaultConfig.ts +103 -103
  90. package/src/components/rightClickMenu/index.css +115 -115
  91. package/src/components/rightClickMenu/index.ts +662 -662
  92. package/src/components/rightClickMenu/types/index.ts +145 -143
  93. package/src/components/searchSuggestion/defaultConfig.ts +63 -63
  94. package/src/components/searchSuggestion/index.ts +813 -813
  95. package/src/components/searchSuggestion/types/index.ts +244 -242
  96. package/src/components/tooltip/defaultConfig.ts +33 -33
  97. package/src/components/tooltip/index.css +199 -199
  98. package/src/components/tooltip/index.ts +617 -617
  99. package/src/components/tooltip/types/index.ts +123 -121
  100. package/src/config/CommonCSSClassName.ts +17 -17
  101. package/src/config/GlobalConfig.ts +63 -63
  102. package/src/css/animation.css +987 -987
  103. package/src/css/button.css +551 -551
  104. package/src/css/common.css +54 -54
  105. package/src/css/index.css +253 -253
  106. package/src/css/ninePalaceGridPosition.css +50 -50
  107. package/src/css/scrollbar.css +22 -22
  108. package/src/handler/PopsElementHandler.ts +303 -303
  109. package/src/handler/PopsHandler.ts +611 -611
  110. package/src/types/PopsDOMUtilsEventType.d.ts +313 -313
  111. package/src/types/animation.d.ts +19 -19
  112. package/src/types/button.d.ts +94 -94
  113. package/src/types/components.d.ts +211 -211
  114. package/src/types/event.d.ts +43 -43
  115. package/src/types/global.d.ts +31 -31
  116. package/src/types/icon.d.ts +32 -32
  117. package/src/types/inst.d.ts +28 -28
  118. package/src/types/main.d.ts +66 -66
  119. package/src/types/mask.d.ts +52 -52
  120. package/src/types/position.d.ts +60 -60
  121. package/src/utils/PopsDOMUtils.ts +2483 -2483
  122. package/src/utils/PopsDOMUtilsEventsConfig.ts +4 -4
  123. package/src/utils/PopsInstanceUtils.ts +714 -714
  124. package/src/utils/PopsMathUtils.ts +71 -71
  125. package/src/utils/PopsSafeUtils.ts +22 -22
  126. package/src/utils/PopsUtils.ts +421 -421
@@ -1,121 +1,123 @@
1
- import type { PopsGeneralConfig } from "../../../types/components";
2
- import type { PopsPanelGeneralConfig } from "../../panel/types/components-common";
3
-
4
- /** tooltip的出现位置 */
5
- export type PopsTooltipPosition = "top" | "right" | "bottom" | "left" | "follow";
6
-
7
- /**
8
- * pops.tooltip
9
- */
10
- export interface PopsToolTipConfig
11
- extends Pick<PopsGeneralConfig, "useShadowRoot" | "only" | "zIndex" | "style" | "beforeAppendToPageCallBack"> {
12
- /**
13
- * 目标元素
14
- */
15
- $target: HTMLElement;
16
- /**
17
- * 显示的文字
18
- */
19
- content: string | (() => string);
20
- /**
21
- * 是否比较获取到的`content`的内容是否改变
22
- *
23
- * 如果未改变,则在触发`.show`时不修改内容
24
- * @default false
25
- */
26
- isDiffContent?: boolean;
27
- /**
28
- * 位置
29
- * + `follow` 跟随(鼠标|触摸)的位置而移动
30
- * @default "top"
31
- */
32
- position?: PopsTooltipPosition;
33
- /**
34
- * 自定义className
35
- *
36
- * + `github-tooltip`:github的样式
37
- * @default ""
38
- */
39
- className?: PopsPanelGeneralConfig<any>["className"];
40
- /**
41
- * 是否使用`fixed`定位,`false`则是`absolute`定位
42
- * @default false
43
- */
44
- isFixed?: boolean;
45
- /**
46
- * 是否总是显示,默认为false
47
- * + true 设置的`onShowEventName`、`onCloseEventName`将无效
48
- * 返回提供`show`和`close`函数,取消`on`和`off`
49
- * + false 事件触发才显示
50
- */
51
- alwaysShow?: boolean;
52
- /**
53
- * 延迟xxms关闭tooltip
54
- * @default 100
55
- */
56
- delayCloseTime?: number;
57
- /**
58
- * 触发显示事件的名称,默认`mouseenter`、`touchstart`,如果是多个事件,按空格分割
59
- *
60
- * 如果`position`为`follow`,则添加`mousemove`、`touchmove`事件监听
61
- * @default "mouseenter touchstart"
62
- */
63
- onShowEventName?: string;
64
- /**
65
- * 触发关闭事件的名称,默认`mouseleave`、`touchend`、`touchcancel`,如果是多个事件,按空格分割
66
- * @default "mouseleave touchend touchcancel"
67
- */
68
- onCloseEventName?: string;
69
- /**
70
- * 监听的事件配置
71
- */
72
- eventOption?: {
73
- once?: boolean;
74
- passive?: boolean;
75
- capture?: boolean;
76
- };
77
- /**
78
- * 触发显示前的回调
79
- * @returns
80
- * + false 可阻止显示
81
- */
82
- showBeforeCallBack?: ($toolTip: HTMLElement) => false | void;
83
- /**
84
- * 触发显示后的回调
85
- */
86
- showAfterCallBack?: ($toolTip: HTMLElement) => void;
87
- /**
88
- * 触发关闭前的回调
89
- */
90
- closeBeforeCallBack?: (
91
- /**
92
- *
93
- * @returns
94
- * + false 可阻止关闭
95
- */
96
- $toolTip: HTMLElement
97
- ) => false | void;
98
- /**
99
- * 触发关闭后的回调
100
- */
101
- closeAfterCallBack?: ($toolTip: HTMLElement) => void;
102
- /**
103
- * 是否显示箭头
104
- * @default true
105
- */
106
- showArrow?: boolean;
107
- /**
108
- * 箭头与目标的的距离(px)
109
- *
110
- * @default 12.5
111
- */
112
- arrowDistance?: number;
113
- /**
114
- * 其它的距离(px)
115
- * + 当`position`为`left`或者`right`,这个距离是上、下距离
116
- * + 当`position`为`top`或者`bottom`,这个距离是左、右距离
117
- * + 当`position`为`follow`,这个距离是上、左距离
118
- * @default 0
119
- */
120
- otherDistance?: number;
121
- }
1
+ import type { PopsGeneralConfig } from "../../../types/components";
2
+ import type { PopsPanelGeneralConfig } from "../../panel/types/components-common";
3
+
4
+ /** tooltip的出现位置 */
5
+ export type PopsTooltipPosition = "top" | "right" | "bottom" | "left" | "follow";
6
+
7
+ /**
8
+ * pops.tooltip
9
+ */
10
+ export interface PopsToolTipConfig extends Pick<
11
+ PopsGeneralConfig,
12
+ "useShadowRoot" | "only" | "zIndex" | "style" | "beforeAppendToPageCallBack"
13
+ > {
14
+ /**
15
+ * 目标元素
16
+ */
17
+ $target: HTMLElement;
18
+ /**
19
+ * 显示的文字
20
+ */
21
+ content: string | (() => string);
22
+ /**
23
+ * 是否比较获取到的`content`的内容是否改变
24
+ *
25
+ * 如果未改变,则在触发`.show`时不修改内容
26
+ * @default false
27
+ */
28
+ isDiffContent?: boolean;
29
+ /**
30
+ * 位置
31
+ * + `follow` 跟随(鼠标|触摸)的位置而移动
32
+ * @default "top"
33
+ */
34
+ position?: PopsTooltipPosition;
35
+ /**
36
+ * 自定义className
37
+ *
38
+ * + `github-tooltip`:github的样式
39
+ * @default ""
40
+ */
41
+ className?: PopsPanelGeneralConfig<any>["className"];
42
+ /**
43
+ * 是否使用`fixed`定位,`false`则是`absolute`定位
44
+ * @default false
45
+ */
46
+ isFixed?: boolean;
47
+ /**
48
+ * 是否总是显示,默认为false
49
+ * + true 设置的`onShowEventName`、`onCloseEventName`将无效
50
+ * 返回提供`show`和`close`函数,取消`on`和`off`
51
+ * + false 事件触发才显示
52
+ */
53
+ alwaysShow?: boolean;
54
+ /**
55
+ * 延迟xxms关闭tooltip
56
+ * @default 100
57
+ */
58
+ delayCloseTime?: number;
59
+ /**
60
+ * 触发显示事件的名称,默认`mouseenter`、`touchstart`,如果是多个事件,按空格分割
61
+ *
62
+ * 如果`position`为`follow`,则添加`mousemove`、`touchmove`事件监听
63
+ * @default "mouseenter touchstart"
64
+ */
65
+ onShowEventName?: string;
66
+ /**
67
+ * 触发关闭事件的名称,默认`mouseleave`、`touchend`、`touchcancel`,如果是多个事件,按空格分割
68
+ * @default "mouseleave touchend touchcancel"
69
+ */
70
+ onCloseEventName?: string;
71
+ /**
72
+ * 监听的事件配置
73
+ */
74
+ eventOption?: {
75
+ once?: boolean;
76
+ passive?: boolean;
77
+ capture?: boolean;
78
+ };
79
+ /**
80
+ * 触发显示前的回调
81
+ * @returns
82
+ * + false 可阻止显示
83
+ */
84
+ showBeforeCallBack?: ($toolTip: HTMLElement) => false | void;
85
+ /**
86
+ * 触发显示后的回调
87
+ */
88
+ showAfterCallBack?: ($toolTip: HTMLElement) => void;
89
+ /**
90
+ * 触发关闭前的回调
91
+ */
92
+ closeBeforeCallBack?: (
93
+ /**
94
+ *
95
+ * @returns
96
+ * + false 可阻止关闭
97
+ */
98
+ $toolTip: HTMLElement
99
+ ) => false | void;
100
+ /**
101
+ * 触发关闭后的回调
102
+ */
103
+ closeAfterCallBack?: ($toolTip: HTMLElement) => void;
104
+ /**
105
+ * 是否显示箭头
106
+ * @default true
107
+ */
108
+ showArrow?: boolean;
109
+ /**
110
+ * 箭头与目标的的距离(px)
111
+ *
112
+ * @default 12.5
113
+ */
114
+ arrowDistance?: number;
115
+ /**
116
+ * 其它的距离(px)
117
+ * + 当`position`为`left`或者`right`,这个距离是上、下距离
118
+ * + 当`position`为`top`或者`bottom`,这个距离是左、右距离
119
+ * + 当`position`为`follow`,这个距离是上、左距离
120
+ * @default 0
121
+ */
122
+ otherDistance?: number;
123
+ }
@@ -1,17 +1,17 @@
1
- /**
2
- * 通用的CSS类名
3
- */
4
- export const PopsCommonCSSClassName = {
5
- flexCenter: "pops-flex-items-center",
6
- flexYCenter: "pops-flex-y-center",
7
- flexXCenter: "pops-flex-x-center",
8
- hide: "pops-hide",
9
- hideImportant: "pops-hide-important",
10
- noBorder: "pops-no-border",
11
- noBorderImportant: "pops-no-border-important",
12
- userSelectNone: "pops-user-select-none",
13
- lineHeightCenter: "pops-line-height-center",
14
- widthFill: "pops-width-fill",
15
- textIsDisabled: "pops-text-is-disabled",
16
- textIsDisabledImportant: "pops-text-is-disabled-important",
17
- };
1
+ /**
2
+ * 通用的CSS类名
3
+ */
4
+ export const PopsCommonCSSClassName = {
5
+ flexCenter: "pops-flex-items-center",
6
+ flexYCenter: "pops-flex-y-center",
7
+ flexXCenter: "pops-flex-x-center",
8
+ hide: "pops-hide",
9
+ hideImportant: "pops-hide-important",
10
+ noBorder: "pops-no-border",
11
+ noBorderImportant: "pops-no-border-important",
12
+ userSelectNone: "pops-user-select-none",
13
+ lineHeightCenter: "pops-line-height-center",
14
+ widthFill: "pops-width-fill",
15
+ textIsDisabled: "pops-text-is-disabled",
16
+ textIsDisabledImportant: "pops-text-is-disabled-important",
17
+ };
@@ -1,63 +1,63 @@
1
- import type { PopsGeneralConfig, PopsDragConfig } from "../types/components";
2
-
3
- type EnterReturnType<T> = null | T | (() => T);
4
-
5
- type GlobalConfigOption = {
6
- style?: EnterReturnType<string>;
7
- zIndex?: EnterReturnType<number> | EnterReturnType<string>;
8
- } & Partial<PopsGeneralConfig> &
9
- Partial<PopsDragConfig>;
10
-
11
- type ResultGlobalConfigOption<T> = T extends null | undefined ? never : T extends (...args: any) => infer R ? R : T;
12
-
13
- export const GlobalConfig = {
14
- config: {} as GlobalConfigOption,
15
- /**
16
- * 为所有弹窗设置全局属性
17
- */
18
- setGlobalConfig(config: GlobalConfigOption) {
19
- Reflect.ownKeys(config).forEach((keyName) => {
20
- Reflect.set(GlobalConfig.config, keyName, Reflect.get(config, keyName));
21
- });
22
- },
23
- /**
24
- * 获取全局配置
25
- */
26
- getGlobalConfig() {
27
- const result: {
28
- [P in keyof GlobalConfigOption]: ResultGlobalConfigOption<GlobalConfigOption[P]>;
29
- } = {};
30
- Object.keys(GlobalConfig.config).forEach((keyName) => {
31
- const configValue = Reflect.get(GlobalConfig.config, keyName);
32
- if (keyName === "style") {
33
- // 设置style属性
34
- const style = configValue == null ? "" : typeof configValue === "function" ? configValue() : configValue;
35
-
36
- if (typeof style === "string") {
37
- result.style = style;
38
- }
39
- } else if (keyName === "zIndex") {
40
- // 设置zIndex属性
41
- let zIndex = configValue == null ? "" : typeof configValue === "function" ? configValue() : configValue;
42
- if (typeof zIndex === "string") {
43
- const newIndex = (zIndex = Number(zIndex));
44
- if (!isNaN(newIndex)) {
45
- result.zIndex = newIndex;
46
- }
47
- } else {
48
- if (!isNaN(zIndex)) {
49
- result.zIndex = zIndex;
50
- }
51
- }
52
- } else if (keyName === "mask") {
53
- const mask = GlobalConfig.config.mask == null ? {} : GlobalConfig.config.mask;
54
- if (typeof mask === "object" && mask != null) {
55
- result.mask = mask;
56
- }
57
- } else {
58
- Reflect.set(result, keyName, configValue);
59
- }
60
- });
61
- return result;
62
- },
63
- };
1
+ import type { PopsGeneralConfig, PopsDragConfig } from "../types/components";
2
+
3
+ type EnterReturnType<T> = null | T | (() => T);
4
+
5
+ type GlobalConfigOption = {
6
+ style?: EnterReturnType<string>;
7
+ zIndex?: EnterReturnType<number> | EnterReturnType<string>;
8
+ } & Partial<PopsGeneralConfig> &
9
+ Partial<PopsDragConfig>;
10
+
11
+ type ResultGlobalConfigOption<T> = T extends null | undefined ? never : T extends (...args: any) => infer R ? R : T;
12
+
13
+ export const GlobalConfig = {
14
+ config: {} as GlobalConfigOption,
15
+ /**
16
+ * 为所有弹窗设置全局属性
17
+ */
18
+ setGlobalConfig(config: GlobalConfigOption) {
19
+ Reflect.ownKeys(config).forEach((keyName) => {
20
+ Reflect.set(GlobalConfig.config, keyName, Reflect.get(config, keyName));
21
+ });
22
+ },
23
+ /**
24
+ * 获取全局配置
25
+ */
26
+ getGlobalConfig() {
27
+ const result: {
28
+ [P in keyof GlobalConfigOption]: ResultGlobalConfigOption<GlobalConfigOption[P]>;
29
+ } = {};
30
+ Object.keys(GlobalConfig.config).forEach((keyName) => {
31
+ const configValue = Reflect.get(GlobalConfig.config, keyName);
32
+ if (keyName === "style") {
33
+ // 设置style属性
34
+ const style = configValue == null ? "" : typeof configValue === "function" ? configValue() : configValue;
35
+
36
+ if (typeof style === "string") {
37
+ result.style = style;
38
+ }
39
+ } else if (keyName === "zIndex") {
40
+ // 设置zIndex属性
41
+ let zIndex = configValue == null ? "" : typeof configValue === "function" ? configValue() : configValue;
42
+ if (typeof zIndex === "string") {
43
+ const newIndex = (zIndex = Number(zIndex));
44
+ if (!isNaN(newIndex)) {
45
+ result.zIndex = newIndex;
46
+ }
47
+ } else {
48
+ if (!isNaN(zIndex)) {
49
+ result.zIndex = zIndex;
50
+ }
51
+ }
52
+ } else if (keyName === "mask") {
53
+ const mask = GlobalConfig.config.mask == null ? {} : GlobalConfig.config.mask;
54
+ if (typeof mask === "object" && mask != null) {
55
+ result.mask = mask;
56
+ }
57
+ } else {
58
+ Reflect.set(result, keyName, configValue);
59
+ }
60
+ });
61
+ return result;
62
+ },
63
+ };