@whitesev/pops 2.5.1 → 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 (46) 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 +16 -16
  26. package/dist/types/src/components/panel/handlerComponents.d.ts +2 -2
  27. package/dist/types/src/components/panel/index.d.ts +1 -1
  28. package/dist/types/src/components/panel/types/components-common.d.ts +3 -5
  29. package/dist/types/src/components/panel/types/index.d.ts +5 -13
  30. package/dist/types/src/components/rightClickMenu/index.d.ts +4 -4
  31. package/dist/types/src/components/rightClickMenu/types/index.d.ts +3 -2
  32. package/dist/types/src/components/searchSuggestion/index.d.ts +1 -1
  33. package/dist/types/src/components/searchSuggestion/types/index.d.ts +3 -2
  34. package/dist/types/src/components/tooltip/index.d.ts +4 -4
  35. package/dist/types/src/components/tooltip/types/index.d.ts +2 -1
  36. package/dist/types/src/utils/PopsDOMUtils.d.ts +1 -1
  37. package/package.json +1 -1
  38. package/src/components/panel/config.ts +36 -43
  39. package/src/components/panel/handlerComponents.ts +7 -22
  40. package/src/components/panel/types/components-common.ts +5 -9
  41. package/src/components/panel/types/index.ts +5 -17
  42. package/src/components/rightClickMenu/types/index.ts +3 -2
  43. package/src/components/searchSuggestion/types/index.ts +3 -2
  44. package/src/components/tooltip/index.ts +1 -3
  45. package/src/components/tooltip/types/index.ts +2 -1
  46. package/src/utils/PopsDOMUtils.ts +23 -10
@@ -34,16 +34,16 @@ declare class Pops {
34
34
  };
35
35
  /** icon图标的svg代码 */
36
36
  iconSVG: {
37
+ loading: string;
37
38
  min: string;
38
- mise: string;
39
39
  max: string;
40
+ mise: string;
40
41
  close: string;
41
42
  edit: string;
42
43
  share: string;
43
44
  delete: string;
44
45
  search: string;
45
46
  upload: string;
46
- loading: string;
47
47
  next: string;
48
48
  prev: string;
49
49
  eleme: string;
@@ -69,14 +69,14 @@ declare class Pops {
69
69
  };
70
70
  /** 存储已创建的元素 */
71
71
  instData: {
72
+ iframe: import("./types/inst").PopsInstCommonConfig[];
72
73
  loading: import("./types/inst").PopsInstCommonConfig[];
74
+ folder: import("./types/inst").PopsInstCommonConfig[];
73
75
  alert: import("./types/inst").PopsInstCommonConfig[];
74
76
  confirm: import("./types/inst").PopsInstCommonConfig[];
75
77
  prompt: import("./types/inst").PopsInstCommonConfig[];
76
- iframe: import("./types/inst").PopsInstCommonConfig[];
77
78
  tooltip: import("./types/inst").PopsInstCommonConfig[];
78
79
  drawer: import("./types/inst").PopsInstCommonConfig[];
79
- folder: import("./types/inst").PopsInstCommonConfig[];
80
80
  panel: import("./types/inst").PopsInstCommonConfig[];
81
81
  rightClickMenu: import("./types/inst").PopsInstCommonConfig[];
82
82
  };
@@ -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;
@@ -393,14 +393,14 @@ declare class Pops {
393
393
  showArrow: boolean;
394
394
  arrowDistance: number;
395
395
  otherDistance: number;
396
- zIndex: number | (() => number);
397
- style: string | null;
398
396
  useShadowRoot: boolean;
399
397
  only: boolean;
398
+ zIndex: number | (() => number);
399
+ style: string | null;
400
400
  beforeAppendToPageCallBack: ($shadowRoot: ShadowRoot | HTMLElement, $shadowContainer: HTMLDivElement) => void;
401
401
  };
402
402
  $shadowContainer: HTMLDivElement;
403
- $shadowRoot: ShadowRoot | HTMLDivElement;
403
+ $shadowRoot: HTMLDivElement | ShadowRoot;
404
404
  toolTip: import("./components/tooltip").ToolTip;
405
405
  };
406
406
  /**
@@ -423,6 +423,7 @@ declare class Pops {
423
423
  close: () => Promise<void>;
424
424
  hide: () => Promise<void>;
425
425
  show: () => Promise<void>;
426
+ guid: string;
426
427
  $shadowContainer: HTMLDivElement;
427
428
  $shadowRoot: ShadowRoot | HTMLElement;
428
429
  element: HTMLDivElement;
@@ -430,7 +431,6 @@ declare class Pops {
430
431
  popsElement: HTMLDivElement;
431
432
  maskElement?: HTMLDivElement | undefined;
432
433
  mode: import("./types/main").PopsType;
433
- guid: string;
434
434
  };
435
435
  /**
436
436
  * 右键菜单
@@ -439,7 +439,7 @@ declare class Pops {
439
439
  rightClickMenu: (details: PopsRightClickMenuDetails) => {
440
440
  guid: string;
441
441
  config: {
442
- target: Node | HTMLElement | {
442
+ target: HTMLElement | Node | {
443
443
  addEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean) => void;
444
444
  dispatchEvent: (event: Event) => boolean;
445
445
  removeEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean) => void;
@@ -21380,14 +21380,14 @@ 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;
21387
- zIndex: number | (() => number);
21388
- style: string | null;
21389
21387
  useShadowRoot: boolean;
21390
21388
  only: boolean;
21389
+ zIndex: number | (() => number);
21390
+ style: string | null;
21391
21391
  beforeAppendToPageCallBack: ($shadowRoot: ShadowRoot | HTMLElement, $shadowContainer: HTMLDivElement) => void;
21392
21392
  };
21393
21393
  removeWindowCheckClickListener: () => void;
@@ -21413,7 +21413,7 @@ declare class Pops {
21413
21413
  * searchSuggestion.setAllEvent();
21414
21414
  */
21415
21415
  searchSuggestion: <T = any>(details: PopsSearchSuggestionDetails<T>) => {
21416
- selfDocument: ShadowRoot | Document | (ShadowRoot | Document)[];
21416
+ selfDocument: Document | ShadowRoot | (Document | ShadowRoot)[];
21417
21417
  $el: {
21418
21418
  root: HTMLElement;
21419
21419
  $hintULContainer: HTMLUListElement;
@@ -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 配置
@@ -7,6 +7,7 @@ export declare const PopsPanel: {
7
7
  close: () => Promise<void>;
8
8
  hide: () => Promise<void>;
9
9
  show: () => Promise<void>;
10
+ guid: string;
10
11
  $shadowContainer: HTMLDivElement;
11
12
  $shadowRoot: ShadowRoot | HTMLElement;
12
13
  element: HTMLDivElement;
@@ -14,6 +15,5 @@ export declare const PopsPanel: {
14
15
  popsElement: HTMLDivElement;
15
16
  maskElement?: HTMLDivElement | undefined;
16
17
  mode: PopsType;
17
- guid: string;
18
18
  };
19
19
  };
@@ -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,20 +136,12 @@ export interface PopsPanelBottomContentConfig {
136
136
  * (可选)自定义元素属性.setAttribute、.getAttribute
137
137
  * @default {}
138
138
  */
139
- attributes?: {
140
- [key: string]: any;
141
- } | {
142
- [key: string]: any;
143
- }[];
139
+ attributes?: PopsPanelCommonDetails<any>["attributes"];
144
140
  /**
145
141
  * (可选)自定义元素内部的属性值
146
142
  * @default {}
147
143
  */
148
- props?: {
149
- [K in keyof HTMLElement]?: HTMLElement[K];
150
- } | {
151
- [key: string]: any;
152
- };
144
+ props?: PopsPanelCommonDetails<any>["props"];
153
145
  /**
154
146
  * 该项的点击回调
155
147
  */
@@ -202,7 +194,7 @@ export interface PopsPanelDetails extends PopsTitleConfig, PopsDragConfig, PopsC
202
194
  *
203
195
  * @default "pops-panel-is-mobile"
204
196
  */
205
- mobileClassName?: string;
197
+ mobileClassName?: PopsPanelCommonDetails<any>["className"];
206
198
  /**
207
199
  * 是否强制是移动端,默认false
208
200
  * + true 强制为移动端
@@ -3,7 +3,7 @@ export declare const PopsRightClickMenu: {
3
3
  init(details: PopsRightClickMenuDetails): {
4
4
  guid: string;
5
5
  config: {
6
- target: Node | HTMLElement | {
6
+ target: HTMLElement | Node | {
7
7
  addEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean) => void;
8
8
  dispatchEvent: (event: Event) => boolean;
9
9
  removeEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean) => void;
@@ -20944,14 +20944,14 @@ 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;
20951
- zIndex: number | (() => number);
20952
- style: string | null;
20953
20951
  useShadowRoot: boolean;
20954
20952
  only: boolean;
20953
+ zIndex: number | (() => number);
20954
+ style: string | null;
20955
20955
  beforeAppendToPageCallBack: ($shadowRoot: ShadowRoot | HTMLElement, $shadowContainer: HTMLDivElement) => void;
20956
20956
  };
20957
20957
  removeWindowCheckClickListener: () => void;
@@ -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
  *
@@ -4,7 +4,7 @@ export declare const PopsSearchSuggestion: {
4
4
  /**
5
5
  * 当前的环境,可以是document,可以是shadowroot,默认是document
6
6
  */
7
- selfDocument: ShadowRoot | Document | (ShadowRoot | Document)[];
7
+ selfDocument: Document | ShadowRoot | (Document | ShadowRoot)[];
8
8
  $el: {
9
9
  /** 根元素 */
10
10
  root: HTMLElement;
@@ -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;
@@ -219,14 +219,14 @@ export declare const PopsTooltip: {
219
219
  showArrow: boolean;
220
220
  arrowDistance: number;
221
221
  otherDistance: number;
222
- zIndex: number | (() => number);
223
- style: string | null;
224
222
  useShadowRoot: boolean;
225
223
  only: boolean;
224
+ zIndex: number | (() => number);
225
+ style: string | null;
226
226
  beforeAppendToPageCallBack: ($shadowRoot: ShadowRoot | HTMLElement, $shadowContainer: HTMLDivElement) => void;
227
227
  };
228
228
  $shadowContainer: HTMLDivElement;
229
- $shadowRoot: ShadowRoot | HTMLDivElement;
229
+ $shadowRoot: HTMLDivElement | ShadowRoot;
230
230
  toolTip: ToolTip;
231
231
  };
232
232
  };
@@ -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.1",
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>