@whitesev/pops 2.5.0 → 2.5.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 (71) hide show
  1. package/dist/index.amd.js +319 -159
  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 +319 -159
  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 +319 -159
  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 +319 -159
  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 +319 -159
  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 +319 -159
  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 +23 -19
  26. package/dist/types/src/components/panel/handlerComponents.d.ts +40 -21
  27. package/dist/types/src/components/panel/types/components-button.d.ts +8 -19
  28. package/dist/types/src/components/panel/types/components-common.d.ts +23 -0
  29. package/dist/types/src/components/panel/types/components-deepMenu.d.ts +0 -18
  30. package/dist/types/src/components/panel/types/components-forms.d.ts +0 -18
  31. package/dist/types/src/components/panel/types/components-input.d.ts +0 -21
  32. package/dist/types/src/components/panel/types/components-own.d.ts +0 -14
  33. package/dist/types/src/components/panel/types/components-select.d.ts +0 -21
  34. package/dist/types/src/components/panel/types/components-selectMultiple.d.ts +0 -18
  35. package/dist/types/src/components/panel/types/components-slider.d.ts +0 -19
  36. package/dist/types/src/components/panel/types/components-switch.d.ts +0 -21
  37. package/dist/types/src/components/panel/types/components-textarea.d.ts +0 -21
  38. package/dist/types/src/components/panel/types/index.d.ts +76 -11
  39. package/dist/types/src/components/rightClickMenu/index.d.ts +2 -8
  40. package/dist/types/src/handler/PopsHandler.d.ts +44 -28
  41. package/dist/types/src/types/global.d.ts +11 -9
  42. package/dist/types/src/utils/PopsDOMUtils.d.ts +1 -1
  43. package/package.json +1 -1
  44. package/src/PopsAnimation.ts +6 -6
  45. package/src/components/alert/index.ts +4 -4
  46. package/src/components/confirm/index.ts +6 -6
  47. package/src/components/drawer/index.ts +7 -2
  48. package/src/components/folder/index.ts +22 -22
  49. package/src/components/iframe/index.ts +13 -12
  50. package/src/components/loading/index.ts +1 -1
  51. package/src/components/panel/config.ts +58 -5
  52. package/src/components/panel/handlerComponents.ts +161 -74
  53. package/src/components/panel/index.css +30 -6
  54. package/src/components/panel/index.ts +30 -15
  55. package/src/components/panel/types/components-button.ts +8 -21
  56. package/src/components/panel/types/components-common.ts +27 -0
  57. package/src/components/panel/types/components-deepMenu.ts +0 -20
  58. package/src/components/panel/types/components-forms.ts +0 -20
  59. package/src/components/panel/types/components-input.ts +0 -23
  60. package/src/components/panel/types/components-own.ts +0 -14
  61. package/src/components/panel/types/components-select.ts +0 -23
  62. package/src/components/panel/types/components-selectMultiple.ts +0 -20
  63. package/src/components/panel/types/components-slider.ts +0 -21
  64. package/src/components/panel/types/components-switch.ts +0 -23
  65. package/src/components/panel/types/components-textarea.ts +0 -23
  66. package/src/components/panel/types/index.ts +81 -13
  67. package/src/components/prompt/index.ts +7 -7
  68. package/src/components/searchSuggestion/index.ts +5 -11
  69. package/src/handler/PopsHandler.ts +47 -30
  70. package/src/types/global.d.ts +11 -9
  71. package/src/utils/PopsDOMUtils.ts +14 -14
@@ -5,26 +5,6 @@ import type { PopsIconType } from "../../../types/icon";
5
5
  * pops.panel的 button
6
6
  */
7
7
  export interface PopsPanelButtonDetails extends PopsPanelCommonDetails<PopsPanelButtonDetails> {
8
- /**
9
- * (可选)className属性
10
- */
11
- className?: string;
12
- /**
13
- * (可选)自定义元素属性
14
- */
15
- attributes?:
16
- | {
17
- [key: string]: any;
18
- }
19
- | {
20
- [key: string]: any;
21
- }[];
22
- /**
23
- * (可选)自定义属性
24
- */
25
- props?: {
26
- [K in keyof HTMLElement]?: HTMLElement[K];
27
- };
28
8
  /**
29
9
  * 显示在左边的文字
30
10
  */
@@ -50,15 +30,22 @@ export interface PopsPanelButtonDetails extends PopsPanelCommonDetails<PopsPanel
50
30
  */
51
31
  buttonText: string | (() => string);
52
32
  /**
53
- * 按钮的图标,已配置的svg请看pops.config.iconSVG,或者自定义的图标svg代码
33
+ * 按钮的图标,已配置的svg请看pops.config.iconSVG,或者自定义的图标svg代码,留空则是没有图标
34
+ * @default ""
54
35
  */
55
36
  buttonIcon?: PopsIconType;
56
37
  /**
57
38
  * 按钮的图标在右边
39
+ * + true 右边
40
+ * + false 左边
41
+ * @default false
58
42
  */
59
43
  buttonIsRightIcon?: boolean;
60
44
  /**
61
45
  * 按钮的图标旋转
46
+ * + true 旋转
47
+ * + false 不旋转
48
+ * @default false
62
49
  */
63
50
  buttonIconIsLoading?: boolean;
64
51
  /**
@@ -20,6 +20,33 @@ export interface PopsPanelRightAsideContainerOptions {
20
20
  * 通用配置
21
21
  */
22
22
  export interface PopsPanelCommonDetails<T extends PopsPanelFormsTotalDetails | PopsPanelFormsDetails> {
23
+ /**
24
+ * (可选)className属性
25
+ * @default ""
26
+ */
27
+ className?: string;
28
+ /**
29
+ * (可选)自定义元素属性
30
+ * @default {}
31
+ */
32
+ attributes?:
33
+ | {
34
+ [key: string]: any;
35
+ }
36
+ | {
37
+ [key: string]: any;
38
+ }[];
39
+ /**
40
+ * (可选)自定义属性
41
+ * @default {}
42
+ */
43
+ props?:
44
+ | {
45
+ [K in keyof HTMLElement]?: HTMLElement[K];
46
+ }
47
+ | {
48
+ [key: string]: any;
49
+ };
23
50
  /**
24
51
  * 在添加到<ul>元素后触发该回调
25
52
  * @param formConfig 配置
@@ -9,26 +9,6 @@ export interface PopsPanelDeepMenuDetails extends PopsPanelCommonDetails<PopsPan
9
9
  * 类型
10
10
  */
11
11
  type: "deepMenu";
12
- /**
13
- * (可选)className属性
14
- */
15
- className?: string;
16
- /**
17
- * (可选)自定义元素属性
18
- */
19
- attributes?:
20
- | {
21
- [key: string]: any;
22
- }
23
- | {
24
- [key: string]: any;
25
- }[];
26
- /**
27
- * (可选)自定义属性
28
- */
29
- props?: {
30
- [K in keyof HTMLElement]?: HTMLElement[K];
31
- };
32
12
  /**
33
13
  * 显示在左边的文字
34
14
  */
@@ -5,26 +5,6 @@ import type { PopsPanelFormsTotalDetails } from ".";
5
5
  * pops.panel的 forms
6
6
  */
7
7
  export interface PopsPanelFormsDetails extends PopsPanelCommonDetails<PopsPanelFormsDetails> {
8
- /**
9
- * (可选)className属性
10
- */
11
- className?: string;
12
- /**
13
- * (可选)自定义元素属性
14
- */
15
- attributes?:
16
- | {
17
- [key: string]: any;
18
- }
19
- | {
20
- [key: string]: any;
21
- }[];
22
- /**
23
- * (可选)自定义属性
24
- */
25
- props?: {
26
- [K in keyof HTMLElement]?: HTMLElement[K];
27
- };
28
8
  /**
29
9
  * 显示在左边的文字
30
10
  */
@@ -4,29 +4,6 @@ import type { PopsPanelCommonDetails } from "./components-common";
4
4
  * pops.panel的 input
5
5
  */
6
6
  export interface PopsPanelInputDetails extends PopsPanelCommonDetails<PopsPanelInputDetails> {
7
- /**
8
- * (可选)className属性
9
- * @default ""
10
- */
11
- className?: string;
12
- /**
13
- * (可选)自定义元素属性
14
- * @default {}
15
- */
16
- attributes?:
17
- | {
18
- [key: string]: any;
19
- }
20
- | {
21
- [key: string]: any;
22
- }[];
23
- /**
24
- * (可选)自定义属性
25
- * @default {}
26
- */
27
- props?: {
28
- [K in keyof HTMLElement]?: HTMLElement[K];
29
- };
30
7
  /**
31
8
  * 显示在左边的文字
32
9
  */
@@ -5,20 +5,6 @@ import type { PopsPanelCommonDetails } from "./components-common";
5
5
  * 自定义的
6
6
  */
7
7
  export interface PopsPanelOwnDetails extends PopsPanelCommonDetails<PopsPanelOwnDetails> {
8
- /**
9
- * (可选)className属性
10
- */
11
- className?: string;
12
- /**
13
- * (可选)自定义元素属性
14
- */
15
- attributes?: any;
16
- /**
17
- * (可选)自定义属性
18
- */
19
- props?: {
20
- [K in keyof HTMLElement]?: HTMLElement[K];
21
- };
22
8
  /**
23
9
  * 类型
24
10
  */
@@ -6,29 +6,6 @@ import type { PopsPanelFormsTotalDetails } from ".";
6
6
  * pops.panel的 select
7
7
  */
8
8
  export interface PopsPanelSelectDetails<T = any> extends PopsPanelCommonDetails<PopsPanelSelectDetails> {
9
- /**
10
- * (可选)className属性
11
- * @default ""
12
- */
13
- className?: string;
14
- /**
15
- * (可选)自定义元素属性
16
- * @default {}
17
- */
18
- attributes?:
19
- | {
20
- [key: string]: any;
21
- }
22
- | {
23
- [key: string]: any;
24
- }[];
25
- /**
26
- * (可选)自定义属性
27
- * @default {}
28
- */
29
- props?: {
30
- [K in keyof HTMLElement]?: HTMLElement[K];
31
- };
32
9
  /**
33
10
  * 显示在左边的文字
34
11
  */
@@ -37,26 +37,6 @@ export interface PopsPanelSelectMultipleDataOption<T> {
37
37
  */
38
38
  export interface PopsPanelSelectMultipleDetails<T = any>
39
39
  extends PopsPanelCommonDetails<PopsPanelSelectMultipleDetails> {
40
- /**
41
- * (可选)className属性
42
- */
43
- className?: string;
44
- /**
45
- * (可选)自定义元素属性
46
- */
47
- attributes?:
48
- | {
49
- [key: string]: any;
50
- }
51
- | {
52
- [key: string]: any;
53
- }[];
54
- /**
55
- * (可选)自定义属性
56
- */
57
- props?: {
58
- [K in keyof HTMLElement]?: HTMLElement[K];
59
- };
60
40
  /**
61
41
  * 显示在左边的文字
62
42
  */
@@ -4,27 +4,6 @@ import type { PopsPanelCommonDetails } from "./components-common";
4
4
  * pops.panel的 slider
5
5
  */
6
6
  export interface PopsPanelSliderDetails extends PopsPanelCommonDetails<PopsPanelSliderDetails> {
7
- /**
8
- * className属性
9
- * @default ""
10
- */
11
- className?: string;
12
- /**
13
- * 自定义元素属性
14
- */
15
- attributes?:
16
- | {
17
- [key: string]: any;
18
- }
19
- | {
20
- [key: string]: any;
21
- }[];
22
- /**
23
- * 自定义属性
24
- */
25
- props?: {
26
- [K in keyof HTMLElement]?: HTMLElement[K];
27
- };
28
7
  /**
29
8
  * 显示在左边的文字
30
9
  */
@@ -4,29 +4,6 @@ import type { PopsPanelCommonDetails } from "./components-common";
4
4
  * pops.panel的 switch
5
5
  */
6
6
  export interface PopsPanelSwitchDetails extends PopsPanelCommonDetails<PopsPanelSwitchDetails> {
7
- /**
8
- * (可选)className属性
9
- * @default ""
10
- */
11
- className?: string;
12
- /**
13
- * (可选)自定义元素属性
14
- * @default {}
15
- */
16
- attributes?:
17
- | {
18
- [key: string]: any;
19
- }
20
- | {
21
- [key: string]: any;
22
- }[];
23
- /**
24
- * (可选)自定义属性
25
- * @default {}
26
- */
27
- props?: {
28
- [K in keyof HTMLElement]?: HTMLElement[K];
29
- };
30
7
  /**
31
8
  * 显示在左边的文字
32
9
  */
@@ -4,29 +4,6 @@ import type { PopsPanelCommonDetails } from "./components-common";
4
4
  * pops.panel的 textarea
5
5
  */
6
6
  export interface PopsPanelTextAreaDetails extends PopsPanelCommonDetails<PopsPanelTextAreaDetails> {
7
- /**
8
- * (可选)className属性
9
- * @default ""
10
- */
11
- className?: string;
12
- /**
13
- * (可选)自定义元素属性
14
- * @default {}
15
- */
16
- attributes?:
17
- | {
18
- [key: string]: any;
19
- }
20
- | {
21
- [key: string]: any;
22
- }[];
23
- /**
24
- * (可选)自定义属性
25
- * @default {}
26
- */
27
- props?: {
28
- [K in keyof HTMLElement]?: HTMLElement[K];
29
- };
30
7
  /**
31
8
  * 显示在左边的文字
32
9
  */
@@ -10,6 +10,7 @@ import type { PopsPanelDeepMenuDetails } from "./components-deepMenu";
10
10
  import type { PopsPanelOwnDetails } from "./components-own";
11
11
  import type { PopsHeaderCloseButtonDetails } from "../../../types/button";
12
12
  import type { PopsPanelSelectMultipleDetails } from "./components-selectMultiple";
13
+ import type { PopsPanelCommonDetails } from "./components-common";
13
14
 
14
15
  /** panel的各种类型的配置项 */
15
16
  export type PopsPanelFormsTotalDetails =
@@ -52,11 +53,11 @@ export interface PopsPanelContentConfig {
52
53
  */
53
54
  className?: string | string[];
54
55
  /**
55
- * 左侧的标题,可以是html格式
56
+ * 显示的文本,可以是html格式
56
57
  */
57
58
  title: string | (() => string);
58
59
  /**
59
- * (可选)中间顶部的标题,如果为空,则使用title的值代替
60
+ * (可选)中间顶部的文本,如果为空,则使用title的值代替
60
61
  * @default title
61
62
  */
62
63
  headerTitle?: string | (() => string);
@@ -84,19 +85,11 @@ export interface PopsPanelContentConfig {
84
85
  /**
85
86
  * (可选)自定义元素属性.setAttribute、.getAttribute
86
87
  */
87
- attributes?:
88
- | {
89
- [key: string]: any;
90
- }
91
- | {
92
- [key: string]: any;
93
- }[];
88
+ attributes?: PopsPanelCommonDetails<any>["attributes"];
94
89
  /**
95
90
  * (可选)自定义元素内部的属性值
96
91
  */
97
- props?: {
98
- [K in keyof HTMLElement]?: HTMLElement[K];
99
- };
92
+ props?: PopsPanelCommonDetails<any>["props"];
100
93
  /**
101
94
  * 子配置
102
95
  */
@@ -128,7 +121,7 @@ export interface PopsPanelContentConfig {
128
121
  /**
129
122
  * 配置
130
123
  */
131
- data: {
124
+ config: {
132
125
  /** 容器配置 */
133
126
  asideConfig: PopsPanelContentConfig;
134
127
  /** 左侧容器的元素 */
@@ -137,6 +130,77 @@ export interface PopsPanelContentConfig {
137
130
  ) => void;
138
131
  }
139
132
 
133
+ /**
134
+ * pops.panel的bottomContent配置信息
135
+ */
136
+ export interface PopsPanelBottomContentConfig {
137
+ /**
138
+ * (可选)元素的className,值为空的话就不设置
139
+ * @default ""
140
+ */
141
+ className?: string | string[];
142
+ /**
143
+ * (可选)配置所在位置
144
+ *
145
+ * @default "left"
146
+ */
147
+ position: "left" | "right";
148
+ /**
149
+ * 显示的文本,可以是html格式
150
+ */
151
+ text: string | (() => string);
152
+ /**
153
+ * (可选)是否禁用hover的CSS样式
154
+ * @default false
155
+ */
156
+ disableHoverCSS?: boolean | (() => boolean);
157
+ /**
158
+ * (可选)自定义元素属性.setAttribute、.getAttribute
159
+ * @default {}
160
+ */
161
+ attributes?: {
162
+ [key: string]: any;
163
+ };
164
+ /**
165
+ * (可选)自定义元素内部的属性值
166
+ * @default {}
167
+ */
168
+ props?:
169
+ | {
170
+ [K in keyof HTMLElement]?: HTMLElement[K];
171
+ }
172
+ | {
173
+ [key: string]: any;
174
+ };
175
+ /**
176
+ * 该项的点击回调
177
+ */
178
+ clickCallback?: (
179
+ /**
180
+ * 点击事件
181
+ */
182
+ event: MouseEvent | PointerEvent
183
+ ) => void;
184
+ /**
185
+ * 该项添加到panel后的回调
186
+ */
187
+ afterRender?: (
188
+ /**
189
+ * 配置
190
+ */
191
+ config: {
192
+ /** panel底部区域 */
193
+ $bottomWrapper: HTMLElement;
194
+ /** panel底部区域容器 */
195
+ $bottomContainer: HTMLElement;
196
+ /** panel底部区域左侧容器 */
197
+ $bottomLeftContainer: HTMLElement;
198
+ /** panel底部区域右侧容器 */
199
+ $bottomRightContainer: HTMLElement;
200
+ }
201
+ ) => void;
202
+ }
203
+
140
204
  /**
141
205
  * pops.panel
142
206
  */
@@ -145,6 +209,10 @@ export interface PopsPanelDetails extends PopsTitleConfig, PopsDragConfig, PopsC
145
209
  * 内容配置
146
210
  */
147
211
  content: PopsPanelContentConfig[];
212
+ /**
213
+ * 底部内容配置
214
+ */
215
+ bottomContentConfig?: PopsPanelBottomContentConfig[];
148
216
  /**
149
217
  * 右上角的按钮配置
150
218
  */
@@ -93,13 +93,13 @@ export const PopsPrompt = {
93
93
  const $anim = PopsElementHandler.parseElement<HTMLDivElement>(animHTML);
94
94
 
95
95
  const {
96
- popsElement: $pops,
97
- inputElement: $input,
98
- headerCloseBtnElement: $btnClose,
99
- btnOkElement: $btnOk,
100
- btnCancelElement: $btnCancel,
101
- btnOtherElement: $btnOther,
102
- titleElement: $title,
96
+ $pops: $pops,
97
+ $input: $input,
98
+ $headerBtnClose: $btnClose,
99
+ $btnOk: $btnOk,
100
+ $btnCancel: $btnCancel,
101
+ $btnOther: $btnOther,
102
+ $title: $title,
103
103
  } = PopsHandler.handleQueryElement($anim, popsType);
104
104
  /**
105
105
  * 遮罩层元素
@@ -46,17 +46,11 @@ export const PopsSearchSuggestion = {
46
46
  ]);
47
47
 
48
48
  if (config.style != null) {
49
- const cssNode = document.createElement("style");
50
- popsDOMUtils.createElement(
51
- "style",
52
- {
53
- innerHTML: config.style,
54
- },
55
- {
56
- type: "text/css",
57
- }
58
- );
59
- $shadowRoot.appendChild(cssNode);
49
+ const $css = popsDOMUtils.createElement("style", {
50
+ type: "text/css",
51
+ innerHTML: config.style,
52
+ });
53
+ $shadowRoot.appendChild($css);
60
54
  }
61
55
 
62
56
  const SearchSuggestion = {