@whitesev/pops 2.5.2 → 2.5.3

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 (44) hide show
  1. package/dist/index.amd.js +62 -74
  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 +62 -74
  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 +62 -74
  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 +62 -74
  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 +62 -74
  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 +62 -74
  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 +4 -4
  26. package/dist/types/src/components/panel/handlerComponents.d.ts +2 -2
  27. package/dist/types/src/components/panel/types/components-common.d.ts +3 -5
  28. package/dist/types/src/components/panel/types/index.d.ts +5 -11
  29. package/dist/types/src/components/rightClickMenu/index.d.ts +1 -1
  30. package/dist/types/src/components/rightClickMenu/types/index.d.ts +3 -2
  31. package/dist/types/src/components/searchSuggestion/types/index.d.ts +3 -2
  32. package/dist/types/src/components/tooltip/index.d.ts +1 -1
  33. package/dist/types/src/components/tooltip/types/index.d.ts +2 -1
  34. package/dist/types/src/utils/PopsDOMUtils.d.ts +1 -1
  35. package/package.json +1 -1
  36. package/src/components/panel/config.ts +36 -43
  37. package/src/components/panel/handlerComponents.ts +7 -22
  38. package/src/components/panel/types/components-common.ts +5 -9
  39. package/src/components/panel/types/index.ts +5 -13
  40. package/src/components/rightClickMenu/types/index.ts +3 -2
  41. package/src/components/searchSuggestion/types/index.ts +3 -2
  42. package/src/components/tooltip/index.ts +1 -3
  43. package/src/components/tooltip/types/index.ts +2 -1
  44. package/src/utils/PopsDOMUtils.ts +23 -10
@@ -112,7 +112,7 @@ declare class Pops {
112
112
  height(element: HTMLElement | string | Window | Document | typeof globalThis, isShow?: boolean, parent?: HTMLElement | ShadowRoot): number;
113
113
  outerWidth(element: HTMLElement | string | Window | Document, isShow?: boolean, parent?: HTMLElement | ShadowRoot): number;
114
114
  outerHeight(element: HTMLElement | string | Window, isShow?: boolean, parent?: HTMLElement | ShadowRoot): number;
115
- addClassName($el: Element | undefined | null, className: string): void;
115
+ addClassName($el: Element | undefined | null | undefined, className: string | string[] | (() => string | string[]) | undefined | null): void;
116
116
  removeClassName($el: Element | undefined | null, className: string): void;
117
117
  containsClassName($el: HTMLElement | undefined | null, className: string): boolean;
118
118
  css(element: HTMLElement | string, property: keyof CSSStyleDeclaration): string;
@@ -257,7 +257,7 @@ declare class Pops {
257
257
  setAsideItemIsVisited($el: HTMLElement): void;
258
258
  setElementAttributes($el: HTMLElement, attributes?: any): void;
259
259
  setElementProps($el: HTMLElement, props?: any): void;
260
- setElementClassName($el: HTMLElement, className?: string | string[] | (() => string | string[])): void;
260
+ setElementClassName($el: HTMLElement, className?: import("./components/panel/types/components-common").PopsPanelCommonDetails<any>["className"]): void;
261
261
  createBottomItem(bottomItemConfig: import("./components/panel/types").PopsPanelBottomContentConfig): HTMLLIElement;
262
262
  setBottomItemClickEvent($bottomItem: HTMLElement, bottomItemConfig: import("./components/panel/types").PopsPanelBottomContentConfig): void;
263
263
  createAsideItem(asideConfig: import("./components/panel/types").PopsPanelContentConfig): HTMLLIElement;
@@ -360,7 +360,7 @@ declare class Pops {
360
360
  content: string | (() => string);
361
361
  isDiffContent: boolean;
362
362
  position: import("./components/tooltip/types/index").PopsTooltipPosition;
363
- className: string;
363
+ className: string | string[] | (() => string | string[]);
364
364
  isFixed: boolean;
365
365
  alwaysShow: boolean;
366
366
  delayCloseTime: number;
@@ -21380,7 +21380,7 @@ declare class Pops {
21380
21380
  data: import("./components/rightClickMenu/types").PopsRightClickMenuDataDetails[];
21381
21381
  chileMenuLeftOrRightDistance: number;
21382
21382
  childMenuTopOrBottomDistance: number;
21383
- className: string;
21383
+ className: string | string[] | (() => string | string[]);
21384
21384
  isAnimation: boolean;
21385
21385
  useScaleAnimation: boolean;
21386
21386
  preventDefault: boolean;
@@ -1,5 +1,5 @@
1
1
  import type { PopsPanelButtonDetails } from "./types/components-button";
2
- import type { PopsPanelRightAsideContainerOptions } from "./types/components-common";
2
+ import type { PopsPanelCommonDetails, PopsPanelRightAsideContainerOptions } from "./types/components-common";
3
3
  import type { PopsPanelDeepMenuDetails } from "./types/components-deepMenu";
4
4
  import type { PopsPanelFormsDetails } from "./types/components-forms";
5
5
  import type { PopsPanelBottomContentConfig, PopsPanelContentConfig, PopsPanelDetails, PopsPanelFormsTotalDetails } from "./types";
@@ -102,7 +102,7 @@ export declare const PanelHandlerComponents: () => {
102
102
  * @param $el 元素
103
103
  * @param className
104
104
  */
105
- setElementClassName($el: HTMLElement, className?: string | string[] | (() => string | string[])): void;
105
+ setElementClassName($el: HTMLElement, className?: PopsPanelCommonDetails<any>["className"]): void;
106
106
  /**
107
107
  * 创建底部项元素<li>
108
108
  * @param bottomItemConfig 配置
@@ -20,19 +20,17 @@ export interface PopsPanelRightAsideContainerOptions {
20
20
  */
21
21
  export interface PopsPanelCommonDetails<T extends PopsPanelFormsTotalDetails | PopsPanelFormsDetails> {
22
22
  /**
23
- * (可选)className属性
23
+ * (可选)元素的className,值为空的话就不设置
24
24
  * @default ""
25
25
  */
26
- className?: string;
26
+ className?: string | string[] | (() => string | string[]);
27
27
  /**
28
28
  * (可选)自定义元素属性
29
29
  * @default {}
30
30
  */
31
31
  attributes?: {
32
32
  [key: string]: any;
33
- } | {
34
- [key: string]: any;
35
- }[];
33
+ };
36
34
  /**
37
35
  * (可选)自定义属性
38
36
  * @default {}
@@ -39,7 +39,7 @@ export interface PopsPanelContentConfig {
39
39
  * (可选)元素的className,值为空的话就不设置
40
40
  * @default ""
41
41
  */
42
- className?: string | string[];
42
+ className?: PopsPanelCommonDetails<any>["className"];
43
43
  /**
44
44
  * 显示的文本,可以是html格式
45
45
  */
@@ -116,7 +116,7 @@ export interface PopsPanelBottomContentConfig {
116
116
  * (可选)元素的className,值为空的话就不设置
117
117
  * @default ""
118
118
  */
119
- className?: string | string[];
119
+ className?: PopsPanelCommonDetails<any>["className"];
120
120
  /**
121
121
  * (可选)配置所在位置
122
122
  *
@@ -136,18 +136,12 @@ export interface PopsPanelBottomContentConfig {
136
136
  * (可选)自定义元素属性.setAttribute、.getAttribute
137
137
  * @default {}
138
138
  */
139
- attributes?: {
140
- [key: string]: any;
141
- };
139
+ attributes?: PopsPanelCommonDetails<any>["attributes"];
142
140
  /**
143
141
  * (可选)自定义元素内部的属性值
144
142
  * @default {}
145
143
  */
146
- props?: {
147
- [K in keyof HTMLElement]?: HTMLElement[K];
148
- } | {
149
- [key: string]: any;
150
- };
144
+ props?: PopsPanelCommonDetails<any>["props"];
151
145
  /**
152
146
  * 该项的点击回调
153
147
  */
@@ -200,7 +194,7 @@ export interface PopsPanelDetails extends PopsTitleConfig, PopsDragConfig, PopsC
200
194
  *
201
195
  * @default "pops-panel-is-mobile"
202
196
  */
203
- mobileClassName?: string;
197
+ mobileClassName?: PopsPanelCommonDetails<any>["className"];
204
198
  /**
205
199
  * 是否强制是移动端,默认false
206
200
  * + true 强制为移动端
@@ -20944,7 +20944,7 @@ export declare const PopsRightClickMenu: {
20944
20944
  data: PopsRightClickMenuDataDetails[];
20945
20945
  chileMenuLeftOrRightDistance: number;
20946
20946
  childMenuTopOrBottomDistance: number;
20947
- className: string;
20947
+ className: string | string[] | (() => string | string[]);
20948
20948
  isAnimation: boolean;
20949
20949
  useScaleAnimation: boolean;
20950
20950
  preventDefault: boolean;
@@ -1,5 +1,6 @@
1
1
  import type { PopsCommonConfig } from "../../../types/components";
2
2
  import type { PopsIconType } from "../../../types/icon";
3
+ import type { PopsPanelCommonDetails } from "../../panel/types/components-common";
3
4
  /**
4
5
  * pops.rightClickMenu的右键菜单配置
5
6
  */
@@ -63,10 +64,10 @@ export interface PopsRightClickMenuDetails extends Pick<PopsCommonConfig, "useSh
63
64
  */
64
65
  childMenuTopOrBottomDistance?: number;
65
66
  /**
66
- * 自定义className,默认为空
67
+ * (可选)元素的className,值为空的话就不设置
67
68
  * @default ""
68
69
  */
69
- className?: string;
70
+ className?: PopsPanelCommonDetails<any>["className"];
70
71
  /**
71
72
  * 是否启用动画,默认false
72
73
  *
@@ -1,4 +1,5 @@
1
1
  import type { PopsCommonConfig } from "../../../types/components";
2
+ import type { PopsPanelCommonDetails } from "../../panel/types/components-common";
2
3
  export type PopsSearchSuggestionData<T = any> = {
3
4
  /**
4
5
  * 值
@@ -120,10 +121,10 @@ export interface PopsSearchSuggestionDetails<T = any> extends Pick<PopsCommonCon
120
121
  */
121
122
  data: PopsSearchSuggestionData<T>[] | (() => PopsSearchSuggestionData<T>[]);
122
123
  /**
123
- * 自定义的className
124
+ * (可选)元素的className,值为空的话就不设置
124
125
  * @default ""
125
126
  */
126
- className?: string;
127
+ className?: PopsPanelCommonDetails<any>["className"];
127
128
  /**
128
129
  * 建议框的position位置
129
130
  *
@@ -186,7 +186,7 @@ export declare const PopsTooltip: {
186
186
  content: string | (() => string);
187
187
  isDiffContent: boolean;
188
188
  position: import("./types/index").PopsTooltipPosition;
189
- className: string;
189
+ className: string | string[] | (() => string | string[]);
190
190
  isFixed: boolean;
191
191
  alwaysShow: boolean;
192
192
  delayCloseTime: number;
@@ -1,4 +1,5 @@
1
1
  import type { PopsCommonConfig } from "../../../types/components";
2
+ import type { PopsPanelCommonDetails } from "../../panel/types/components-common";
2
3
  /** tooltip的出现位置 */
3
4
  export type PopsTooltipPosition = "top" | "right" | "bottom" | "left" | "follow";
4
5
  /**
@@ -32,7 +33,7 @@ export interface PopsToolTipDetails extends Pick<PopsCommonConfig, "useShadowRoo
32
33
  * + `github-tooltip` github的样式
33
34
  * @default ""
34
35
  */
35
- className?: string;
36
+ className?: PopsPanelCommonDetails<any>["className"];
36
37
  /**
37
38
  * 是否使用fixed定位,false则是absolute定位
38
39
  *
@@ -502,7 +502,7 @@ declare class PopsDOMUtils extends PopsDOMUtilsEvent {
502
502
  * @param $el 目标元素
503
503
  * @param className className属性
504
504
  */
505
- addClassName($el: Element | undefined | null, className: string): void;
505
+ addClassName($el: Element | undefined | null | undefined, className: string | string[] | (() => string | string[]) | undefined | null): void;
506
506
  /**
507
507
  * 删除className
508
508
  * @param $el 目标元素
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/pops",
3
- "version": "2.5.2",
3
+ "version": "2.5.3",
4
4
  "description": "弹窗库",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/WhiteSevs/TamperMonkeyScript/tree/master/lib/pops#readme",
@@ -15,18 +15,16 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
15
15
  title: "菜单配置1",
16
16
  headerTitle: "菜单配置1",
17
17
  isDefault: false,
18
- attributes: [
19
- {
20
- "data-test": "test",
21
- "data-test-2": "test2",
22
- },
23
- ],
18
+ attributes: {
19
+ "data-test": "test",
20
+ "data-test-2": "test2",
21
+ },
24
22
  forms: [
25
23
  {
26
24
  className: "forms-1",
27
25
  text: "区域设置",
28
26
  type: "forms",
29
- attributes: [],
27
+ attributes: {},
30
28
  forms: [
31
29
  {
32
30
  className: "panel-switch",
@@ -38,7 +36,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
38
36
  // TODO
39
37
  },
40
38
  props: {},
41
- attributes: [],
39
+ attributes: {},
42
40
  getValue() {
43
41
  return true;
44
42
  },
@@ -61,7 +59,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
61
59
  isShowHoverTip: true,
62
60
  step: 1,
63
61
  props: {},
64
- attributes: [],
62
+ attributes: {},
65
63
  getValue() {
66
64
  return 50;
67
65
  },
@@ -82,7 +80,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
82
80
  afterAddToUListCallBack() {
83
81
  // TODO
84
82
  },
85
- attributes: [],
83
+ attributes: {},
86
84
  buttonIcon: "view",
87
85
  buttonIconIsLoading: true,
88
86
  buttonType: "default",
@@ -96,7 +94,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
96
94
  text: "button",
97
95
  type: "button",
98
96
  props: {},
99
- attributes: [],
97
+ attributes: {},
100
98
  buttonIcon: "eleme",
101
99
  buttonIconIsLoading: true,
102
100
  buttonType: "warning",
@@ -111,7 +109,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
111
109
  // @ts-ignore
112
110
  props: {},
113
111
  type: "button",
114
- attributes: [],
112
+ attributes: {},
115
113
  buttonIcon: "chromeFilled",
116
114
  buttonIconIsLoading: true,
117
115
  buttonType: "danger",
@@ -124,7 +122,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
124
122
  className: "panel-button",
125
123
  text: "button",
126
124
  type: "button",
127
- attributes: [],
125
+ attributes: {},
128
126
  // @ts-ignore
129
127
  props: {},
130
128
  buttonIcon: "upload",
@@ -144,12 +142,10 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
144
142
  title: "菜单配置2",
145
143
  headerTitle: "菜单配置2",
146
144
  isDefault: true,
147
- attributes: [
148
- {
149
- "data-value": "value",
150
- "data-value-2": "value2",
151
- },
152
- ],
145
+ attributes: {
146
+ "data-value": "value",
147
+ "data-value-2": "value2",
148
+ },
153
149
  forms: [
154
150
  {
155
151
  className: "panel-input",
@@ -157,7 +153,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
157
153
  type: "input",
158
154
  isNumber: false,
159
155
  props: {},
160
- attributes: [],
156
+ attributes: {},
161
157
  getValue() {
162
158
  return "50";
163
159
  },
@@ -173,7 +169,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
173
169
  type: "input",
174
170
  // @ts-ignore
175
171
  props: {},
176
- attributes: [],
172
+ attributes: {},
177
173
  getValue() {
178
174
  return "123456";
179
175
  },
@@ -190,7 +186,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
190
186
  type: "textarea",
191
187
  // @ts-ignore
192
188
  props: {},
193
- attributes: [],
189
+ attributes: {},
194
190
  getValue() {
195
191
  return "50";
196
192
  },
@@ -207,7 +203,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
207
203
  disabled: true,
208
204
  // @ts-ignore
209
205
  props: {},
210
- attributes: [],
206
+ attributes: {},
211
207
  getValue() {
212
208
  return 50;
213
209
  },
@@ -249,7 +245,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
249
245
  // @ts-ignore
250
246
  props: {},
251
247
 
252
- attributes: [],
248
+ attributes: {},
253
249
  placeholder: "请至少选择一个选项",
254
250
  getValue() {
255
251
  return ["select-1", "select-2"];
@@ -332,7 +328,8 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
332
328
  className: "forms-1",
333
329
  text: "区域设置",
334
330
  type: "forms",
335
- attributes: [],
331
+ attributes: {},
332
+ props: {},
336
333
  forms: [
337
334
  {
338
335
  className: "panel-switch",
@@ -340,7 +337,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
340
337
  type: "switch",
341
338
  // @ts-ignore
342
339
  props: {},
343
- attributes: [],
340
+ attributes: {},
344
341
  getValue() {
345
342
  return true;
346
343
  },
@@ -354,7 +351,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
354
351
  // @ts-ignore
355
352
  props: {},
356
353
  type: "slider",
357
- attributes: [],
354
+ attributes: {},
358
355
  getValue() {
359
356
  return 50;
360
357
  },
@@ -370,7 +367,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
370
367
  // @ts-ignore
371
368
  props: {},
372
369
  type: "button",
373
- attributes: [],
370
+ attributes: {},
374
371
  buttonIcon: "eleme",
375
372
  buttonIconIsLoading: true,
376
373
  buttonType: "warning",
@@ -385,7 +382,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
385
382
  type: "button",
386
383
  // @ts-ignore
387
384
  props: {},
388
- attributes: [],
385
+ attributes: {},
389
386
  buttonIcon: "chromeFilled",
390
387
  buttonIconIsLoading: true,
391
388
  buttonType: "danger",
@@ -400,7 +397,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
400
397
  // @ts-ignore
401
398
  props: {},
402
399
  type: "button",
403
- attributes: [],
400
+ attributes: {},
404
401
  buttonIcon: "upload",
405
402
  buttonIconIsLoading: false,
406
403
  buttonType: "info",
@@ -447,7 +444,7 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
447
444
  // @ts-ignore
448
445
  props: {},
449
446
  type: "switch",
450
- attributes: [],
447
+ attributes: {},
451
448
  getValue() {
452
449
  return true;
453
450
  },
@@ -466,12 +463,10 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
466
463
  `,
467
464
  isBottom: true,
468
465
  disableAsideItemHoverCSS: true,
469
- attributes: [
470
- {
471
- "data-value": "value",
472
- "data-value-2": "value2",
473
- },
474
- ],
466
+ attributes: {
467
+ "data-value": "value",
468
+ "data-value-2": "value2",
469
+ },
475
470
  // @ts-ignore
476
471
  props: {},
477
472
  forms: [],
@@ -483,12 +478,10 @@ export const PopsPanelConfig = (): DeepRequired<PopsPanelDetails> => {
483
478
  id: "whitesev-panel-bottom-config-2",
484
479
  title: "版本:xxx.xx.xx",
485
480
  isBottom: true,
486
- attributes: [
487
- {
488
- "data-value": "value",
489
- "data-value-2": "value2",
490
- },
491
- ],
481
+ attributes: {
482
+ "data-value": "value",
483
+ "data-value-2": "value2",
484
+ },
492
485
  // @ts-ignore
493
486
  props: {},
494
487
  forms: [],
@@ -9,7 +9,7 @@ import { PopsTooltip } from "../tooltip";
9
9
  import { PopsCommonCSSClassName } from "../../config/CommonCSSClassName";
10
10
  import type { PopsAlertDetails } from "../alert/types";
11
11
  import type { PopsPanelButtonDetails } from "./types/components-button";
12
- import type { PopsPanelRightAsideContainerOptions } from "./types/components-common";
12
+ import type { PopsPanelCommonDetails, PopsPanelRightAsideContainerOptions } from "./types/components-common";
13
13
  import type { PopsPanelDeepMenuDetails } from "./types/components-deepMenu";
14
14
  import type { PopsPanelFormsDetails } from "./types/components-forms";
15
15
  import type {
@@ -238,10 +238,10 @@ export const PanelHandlerComponents = () => {
238
238
  * @param props 属性
239
239
  */
240
240
  setElementProps($el: HTMLElement, props?: any) {
241
- if (props == null) {
242
- return;
243
- }
244
- Object.keys(props).forEach((propName) => {
241
+ if (props == null) return;
242
+ if (typeof props !== "object") return;
243
+ const propsKeys = Object.keys(props);
244
+ propsKeys.forEach((propName) => {
245
245
  const value = props[propName];
246
246
  if (propName === "innerHTML") {
247
247
  PopsSafeUtils.setSafeHTML($el, value);
@@ -255,23 +255,8 @@ export const PanelHandlerComponents = () => {
255
255
  * @param $el 元素
256
256
  * @param className
257
257
  */
258
- setElementClassName($el: HTMLElement, className?: string | string[] | (() => string | string[])) {
259
- if (className == null) {
260
- return;
261
- }
262
- if (typeof className === "function") {
263
- className = className();
264
- }
265
- if (typeof className === "string") {
266
- const splitClassName = className.split(" ");
267
- splitClassName.forEach((classNameStr) => {
268
- $el.classList.add(classNameStr);
269
- });
270
- } else if (Array.isArray(className)) {
271
- className.forEach((classNameStr) => {
272
- this.setElementClassName($el, classNameStr);
273
- });
274
- }
258
+ setElementClassName($el: HTMLElement, className?: PopsPanelCommonDetails<any>["className"]) {
259
+ popsDOMUtils.addClassName($el, className);
275
260
  },
276
261
  /**
277
262
  * 创建底部项元素<li>
@@ -21,21 +21,17 @@ export interface PopsPanelRightAsideContainerOptions {
21
21
  */
22
22
  export interface PopsPanelCommonDetails<T extends PopsPanelFormsTotalDetails | PopsPanelFormsDetails> {
23
23
  /**
24
- * (可选)className属性
24
+ * (可选)元素的className,值为空的话就不设置
25
25
  * @default ""
26
26
  */
27
- className?: string;
27
+ className?: string | string[] | (() => string | string[]);
28
28
  /**
29
29
  * (可选)自定义元素属性
30
30
  * @default {}
31
31
  */
32
- attributes?:
33
- | {
34
- [key: string]: any;
35
- }
36
- | {
37
- [key: string]: any;
38
- }[];
32
+ attributes?: {
33
+ [key: string]: any;
34
+ };
39
35
  /**
40
36
  * (可选)自定义属性
41
37
  * @default {}
@@ -51,7 +51,7 @@ export interface PopsPanelContentConfig {
51
51
  * (可选)元素的className,值为空的话就不设置
52
52
  * @default ""
53
53
  */
54
- className?: string | string[];
54
+ className?: PopsPanelCommonDetails<any>["className"];
55
55
  /**
56
56
  * 显示的文本,可以是html格式
57
57
  */
@@ -138,7 +138,7 @@ export interface PopsPanelBottomContentConfig {
138
138
  * (可选)元素的className,值为空的话就不设置
139
139
  * @default ""
140
140
  */
141
- className?: string | string[];
141
+ className?: PopsPanelCommonDetails<any>["className"];
142
142
  /**
143
143
  * (可选)配置所在位置
144
144
  *
@@ -158,20 +158,12 @@ export interface PopsPanelBottomContentConfig {
158
158
  * (可选)自定义元素属性.setAttribute、.getAttribute
159
159
  * @default {}
160
160
  */
161
- attributes?: {
162
- [key: string]: any;
163
- };
161
+ attributes?: PopsPanelCommonDetails<any>["attributes"];
164
162
  /**
165
163
  * (可选)自定义元素内部的属性值
166
164
  * @default {}
167
165
  */
168
- props?:
169
- | {
170
- [K in keyof HTMLElement]?: HTMLElement[K];
171
- }
172
- | {
173
- [key: string]: any;
174
- };
166
+ props?: PopsPanelCommonDetails<any>["props"];
175
167
  /**
176
168
  * 该项的点击回调
177
169
  */
@@ -227,7 +219,7 @@ export interface PopsPanelDetails extends PopsTitleConfig, PopsDragConfig, PopsC
227
219
  *
228
220
  * @default "pops-panel-is-mobile"
229
221
  */
230
- mobileClassName?: string;
222
+ mobileClassName?: PopsPanelCommonDetails<any>["className"];
231
223
  /**
232
224
  * 是否强制是移动端,默认false
233
225
  * + true 强制为移动端
@@ -1,5 +1,6 @@
1
1
  import type { PopsCommonConfig } from "../../../types/components";
2
2
  import type { PopsIconType } from "../../../types/icon";
3
+ import type { PopsPanelCommonDetails } from "../../panel/types/components-common";
3
4
 
4
5
  /**
5
6
  * pops.rightClickMenu的右键菜单配置
@@ -71,10 +72,10 @@ export interface PopsRightClickMenuDetails
71
72
  */
72
73
  childMenuTopOrBottomDistance?: number;
73
74
  /**
74
- * 自定义className,默认为空
75
+ * (可选)元素的className,值为空的话就不设置
75
76
  * @default ""
76
77
  */
77
- className?: string;
78
+ className?: PopsPanelCommonDetails<any>["className"];
78
79
  /**
79
80
  * 是否启用动画,默认false
80
81
  *
@@ -1,4 +1,5 @@
1
1
  import type { PopsCommonConfig } from "../../../types/components";
2
+ import type { PopsPanelCommonDetails } from "../../panel/types/components-common";
2
3
 
3
4
  export type PopsSearchSuggestionData<T = any> = {
4
5
  /**
@@ -126,10 +127,10 @@ export interface PopsSearchSuggestionDetails<T = any>
126
127
  */
127
128
  data: PopsSearchSuggestionData<T>[] | (() => PopsSearchSuggestionData<T>[]);
128
129
  /**
129
- * 自定义的className
130
+ * (可选)元素的className,值为空的话就不设置
130
131
  * @default ""
131
132
  */
132
- className?: string;
133
+ className?: PopsPanelCommonDetails<any>["className"];
133
134
  /**
134
135
  * 建议框的position位置
135
136
  *
@@ -82,9 +82,7 @@ export class ToolTip {
82
82
  const $toolTipArrow = $toolTipContainer.querySelector<HTMLElement>(".pops-tip-arrow")!;
83
83
 
84
84
  // 处理className
85
- if (typeof this.$data.config.className === "string" && this.$data.config.className.trim() !== "") {
86
- popsDOMUtils.addClassName($toolTipContainer, this.$data.config.className);
87
- }
85
+ popsDOMUtils.addClassName($toolTipContainer, this.$data.config.className);
88
86
  // 添加z-index
89
87
  $toolTipContainer.style.zIndex = PopsHandler.handleZIndex(this.$data.config.zIndex).toString();
90
88
  if (this.$data.config.style != null) {
@@ -1,4 +1,5 @@
1
1
  import type { PopsCommonConfig } from "../../../types/components";
2
+ import type { PopsPanelCommonDetails } from "../../panel/types/components-common";
2
3
 
3
4
  /** tooltip的出现位置 */
4
5
  export type PopsTooltipPosition = "top" | "right" | "bottom" | "left" | "follow";
@@ -35,7 +36,7 @@ export interface PopsToolTipDetails
35
36
  * + `github-tooltip` github的样式
36
37
  * @default ""
37
38
  */
38
- className?: string;
39
+ className?: PopsPanelCommonDetails<any>["className"];
39
40
  /**
40
41
  * 是否使用fixed定位,false则是absolute定位
41
42
  *