@whitesev/pops 2.2.3 → 2.2.4

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 (37) hide show
  1. package/dist/index.amd.js +49 -18
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.cjs.js +49 -18
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.esm.js +49 -18
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.iife.js +49 -18
  8. package/dist/index.iife.js.map +1 -1
  9. package/dist/index.system.js +49 -18
  10. package/dist/index.system.js.map +1 -1
  11. package/dist/index.umd.js +49 -18
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/types/src/Pops.d.ts +10 -10
  14. package/dist/types/src/PopsIcon.d.ts +2 -2
  15. package/dist/types/src/components/rightClickMenu/index.d.ts +2 -2
  16. package/dist/types/src/components/tooltip/index.d.ts +2 -2
  17. package/dist/types/src/config/CommonCSSClassName.d.ts +17 -0
  18. package/dist/types/src/{GlobalConfig.d.ts → config/GlobalConfig.d.ts} +4 -4
  19. package/dist/types/src/utils/PopsDOMUtils.d.ts +3 -3
  20. package/package.json +1 -1
  21. package/src/Pops.ts +2 -2
  22. package/src/components/alert/index.ts +1 -1
  23. package/src/components/confirm/index.ts +1 -1
  24. package/src/components/drawer/index.ts +1 -1
  25. package/src/components/folder/index.ts +1 -1
  26. package/src/components/iframe/index.ts +1 -1
  27. package/src/components/loading/index.ts +1 -1
  28. package/src/components/panel/handlerComponents.ts +49 -10
  29. package/src/components/panel/index.ts +1 -1
  30. package/src/components/prompt/index.ts +1 -1
  31. package/src/components/rightClickMenu/index.ts +1 -1
  32. package/src/components/searchSuggestion/index.ts +7 -3
  33. package/src/components/tooltip/index.ts +1 -1
  34. package/src/config/CommonCSSClassName.ts +17 -0
  35. package/src/{GlobalConfig.ts → config/GlobalConfig.ts} +1 -1
  36. package/src/css/common.css +14 -0
  37. package/src/utils/PopsDOMUtils.ts +22 -9
@@ -35,10 +35,10 @@ declare class Pops {
35
35
  /** icon图标的svg代码 */
36
36
  iconSVG: {
37
37
  loading: string;
38
+ close: string;
38
39
  min: string;
39
- max: string;
40
40
  mise: string;
41
- close: string;
41
+ max: string;
42
42
  edit: string;
43
43
  share: string;
44
44
  delete: string;
@@ -71,12 +71,12 @@ declare class Pops {
71
71
  instData: {
72
72
  iframe: import("./types/inst").PopsInstCommonConfig[];
73
73
  loading: import("./types/inst").PopsInstCommonConfig[];
74
- folder: import("./types/inst").PopsInstCommonConfig[];
75
74
  alert: import("./types/inst").PopsInstCommonConfig[];
76
75
  confirm: import("./types/inst").PopsInstCommonConfig[];
77
76
  prompt: import("./types/inst").PopsInstCommonConfig[];
78
77
  tooltip: import("./types/inst").PopsInstCommonConfig[];
79
78
  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,9 +112,9 @@ 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(element: HTMLElement, className: string): void;
116
- removeClassName(element: HTMLElement, className: string): void;
117
- containsClassName(element: HTMLElement, className: string): boolean;
115
+ addClassName(element: Element | undefined | null, className: string): void;
116
+ removeClassName(element: Element | undefined | null, className: string): void;
117
+ containsClassName(element: HTMLElement | undefined | null, className: string): boolean;
118
118
  css(element: HTMLElement | string, property: keyof CSSStyleDeclaration): string;
119
119
  css(element: HTMLElement | string, property: string): string;
120
120
  css(element: HTMLElement | string, property: keyof CSSStyleDeclaration & string, value: string | number): string;
@@ -372,14 +372,14 @@ declare class Pops {
372
372
  showArrow: boolean;
373
373
  arrowDistance: number;
374
374
  otherDistance: number;
375
+ style: string | null;
375
376
  useShadowRoot: boolean;
376
377
  only: boolean;
377
378
  zIndex: number | (() => number);
378
- style: string | null;
379
379
  beforeAppendToPageCallBack: ($shadowRoot: ShadowRoot | HTMLElement, $shadowContainer: HTMLDivElement) => void;
380
380
  };
381
381
  $shadowContainer: HTMLDivElement;
382
- $shadowRoot: HTMLDivElement | ShadowRoot;
382
+ $shadowRoot: ShadowRoot | HTMLDivElement;
383
383
  toolTip: import("./components/tooltip").ToolTip;
384
384
  };
385
385
  /**
@@ -418,7 +418,7 @@ declare class Pops {
418
418
  rightClickMenu: (details: PopsRightClickMenuDetails) => {
419
419
  guid: string;
420
420
  config: {
421
- target: HTMLElement | Node | {
421
+ target: Node | HTMLElement | {
422
422
  addEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean) => void;
423
423
  dispatchEvent: (event: Event) => boolean;
424
424
  removeEventListener: (type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean) => void;
@@ -21064,10 +21064,10 @@ declare class Pops {
21064
21064
  className: string;
21065
21065
  isAnimation: boolean;
21066
21066
  preventDefault: boolean;
21067
+ style: string | null;
21067
21068
  useShadowRoot: boolean;
21068
21069
  only: boolean;
21069
21070
  zIndex: number | (() => number);
21070
- style: string | null;
21071
21071
  beforeAppendToPageCallBack: ($shadowRoot: ShadowRoot | HTMLElement, $shadowContainer: HTMLDivElement) => void;
21072
21072
  };
21073
21073
  removeWindowCheckClickListener: () => void;
@@ -1,10 +1,10 @@
1
1
  export declare const PopsIcon: {
2
2
  $data: {
3
3
  loading: string;
4
+ close: string;
4
5
  min: string;
5
- max: string;
6
6
  mise: string;
7
- close: string;
7
+ max: string;
8
8
  edit: string;
9
9
  share: string;
10
10
  delete: string;
@@ -3,7 +3,7 @@ export declare const PopsRightClickMenu: {
3
3
  init(details: PopsRightClickMenuDetails): {
4
4
  guid: string;
5
5
  config: {
6
- target: HTMLElement | Node | {
6
+ target: Node | HTMLElement | {
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;
@@ -20649,10 +20649,10 @@ export declare const PopsRightClickMenu: {
20649
20649
  className: string;
20650
20650
  isAnimation: boolean;
20651
20651
  preventDefault: boolean;
20652
+ style: string | null;
20652
20653
  useShadowRoot: boolean;
20653
20654
  only: boolean;
20654
20655
  zIndex: number | (() => number);
20655
- style: string | null;
20656
20656
  beforeAppendToPageCallBack: ($shadowRoot: ShadowRoot | HTMLElement, $shadowContainer: HTMLDivElement) => void;
20657
20657
  };
20658
20658
  removeWindowCheckClickListener: () => void;
@@ -219,14 +219,14 @@ export declare const PopsTooltip: {
219
219
  showArrow: boolean;
220
220
  arrowDistance: number;
221
221
  otherDistance: number;
222
+ style: string | null;
222
223
  useShadowRoot: boolean;
223
224
  only: boolean;
224
225
  zIndex: number | (() => number);
225
- style: string | null;
226
226
  beforeAppendToPageCallBack: ($shadowRoot: ShadowRoot | HTMLElement, $shadowContainer: HTMLDivElement) => void;
227
227
  };
228
228
  $shadowContainer: HTMLDivElement;
229
- $shadowRoot: HTMLDivElement | ShadowRoot;
229
+ $shadowRoot: ShadowRoot | HTMLDivElement;
230
230
  toolTip: ToolTip;
231
231
  };
232
232
  };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * 通用的CSS类名
3
+ */
4
+ export declare const PopsCommonCSSClassName: {
5
+ flexCenter: string;
6
+ flexYCenter: string;
7
+ flexXCenter: string;
8
+ hide: string;
9
+ hideImportant: string;
10
+ noBorder: string;
11
+ noBorderImportant: string;
12
+ userSelectNone: string;
13
+ lineHeightCenter: string;
14
+ widthFill: string;
15
+ textIsDisabled: string;
16
+ textIsDisabledImportant: string;
17
+ };
@@ -1,4 +1,4 @@
1
- import type { PopsCommonConfig, PopsDragConfig } from "./types/components";
1
+ import type { PopsCommonConfig, PopsDragConfig } from "../types/components";
2
2
  type EnterReturnType<T> = null | T | (() => T);
3
3
  type GlobalConfigOption = {
4
4
  style?: EnterReturnType<string>;
@@ -21,9 +21,9 @@ export declare const GlobalConfig: {
21
21
  only?: boolean | undefined;
22
22
  width?: string | undefined;
23
23
  height?: string | undefined;
24
- position?: import("./types/position").PopsPosition | undefined;
25
- animation?: import("./types/animation").PopsAnimation | undefined;
26
- mask?: import("./types/mask").PopsMaskDetails | undefined;
24
+ position?: import("../types/position").PopsPosition | undefined;
25
+ animation?: import("../types/animation").PopsAnimation | undefined;
26
+ mask?: import("../types/mask").PopsMaskDetails | undefined;
27
27
  forbiddenScroll?: boolean | undefined;
28
28
  beforeAppendToPageCallBack?: void;
29
29
  drag?: boolean | undefined;
@@ -502,19 +502,19 @@ declare class PopsDOMUtils extends PopsDOMUtilsEvent {
502
502
  * @param element 目标元素
503
503
  * @param className className属性
504
504
  */
505
- addClassName(element: HTMLElement, className: string): void;
505
+ addClassName(element: Element | undefined | null, className: string): void;
506
506
  /**
507
507
  * 删除className
508
508
  * @param element 目标元素
509
509
  * @param className className属性
510
510
  */
511
- removeClassName(element: HTMLElement, className: string): void;
511
+ removeClassName(element: Element | undefined | null, className: string): void;
512
512
  /**
513
513
  * 判断元素是否包含某个className
514
514
  * @param element 目标元素
515
515
  * @param className className属性
516
516
  */
517
- containsClassName(element: HTMLElement, className: string): boolean;
517
+ containsClassName(element: HTMLElement | undefined | null, className: string): boolean;
518
518
  /**
519
519
  * 获取元素的样式属性值
520
520
  * @param element 目标元素
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/pops",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "type": "module",
5
5
  "description": "弹窗库",
6
6
  "main": "dist/index.cjs.js",
package/src/Pops.ts CHANGED
@@ -25,7 +25,7 @@ import type { PopsSearchSuggestionDetails } from "./components/searchSuggestion/
25
25
  import { PopsSearchSuggestion } from "./components/searchSuggestion";
26
26
  import { PopsMathFloatUtils } from "./utils/PopsMathUtils";
27
27
  import { PanelHandlerComponents } from "./components/panel/handlerComponents";
28
- import { GlobalConfig } from "./GlobalConfig";
28
+ import { GlobalConfig } from "./config/GlobalConfig";
29
29
  import { PopsTooltip } from "./components/tooltip";
30
30
  import { PopsCSS } from "./PopsCSS";
31
31
  import { PopsIcon } from "./PopsIcon";
@@ -36,7 +36,7 @@ class Pops {
36
36
  /** 配置 */
37
37
  config = {
38
38
  /** 版本号 */
39
- version: "2025.7.15",
39
+ version: "2025.7.16",
40
40
  cssText: PopsCSS,
41
41
  /** icon图标的svg代码 */
42
42
  iconSVG: PopsIcon.$data,
@@ -1,4 +1,4 @@
1
- import { GlobalConfig } from "../../GlobalConfig";
1
+ import { GlobalConfig } from "../../config/GlobalConfig";
2
2
  import { PopsElementHandler } from "../../handler/PopsElementHandler";
3
3
  import { PopsHandler } from "../../handler/PopsHandler";
4
4
  import { popsDOMUtils } from "../../utils/PopsDOMUtils";
@@ -1,4 +1,4 @@
1
- import { GlobalConfig } from "../../GlobalConfig";
1
+ import { GlobalConfig } from "../../config/GlobalConfig";
2
2
  import { PopsElementHandler } from "../../handler/PopsElementHandler";
3
3
  import { PopsHandler } from "../../handler/PopsHandler";
4
4
  import { PopsCSS } from "../../PopsCSS";
@@ -1,4 +1,4 @@
1
- import { GlobalConfig } from "../../GlobalConfig";
1
+ import { GlobalConfig } from "../../config/GlobalConfig";
2
2
  import { PopsElementHandler } from "../../handler/PopsElementHandler";
3
3
  import { PopsHandler } from "../../handler/PopsHandler";
4
4
  import { PopsCSS } from "../../PopsCSS";
@@ -1,4 +1,4 @@
1
- import { GlobalConfig } from "../../GlobalConfig";
1
+ import { GlobalConfig } from "../../config/GlobalConfig";
2
2
  import { PopsElementHandler } from "../../handler/PopsElementHandler";
3
3
  import { PopsHandler } from "../../handler/PopsHandler";
4
4
  import { PopsCSS } from "../../PopsCSS";
@@ -1,5 +1,5 @@
1
1
  import { PopsCore } from "../../PopsCore";
2
- import { GlobalConfig } from "../../GlobalConfig";
2
+ import { GlobalConfig } from "../../config/GlobalConfig";
3
3
  import { PopsElementHandler } from "../../handler/PopsElementHandler";
4
4
  import { PopsHandler } from "../../handler/PopsHandler";
5
5
  import { PopsCSS } from "../../PopsCSS";
@@ -1,4 +1,4 @@
1
- import { GlobalConfig } from "../../GlobalConfig";
1
+ import { GlobalConfig } from "../../config/GlobalConfig";
2
2
  import { PopsElementHandler } from "../../handler/PopsElementHandler";
3
3
  import { PopsHandler } from "../../handler/PopsHandler";
4
4
  import { PopsCSS } from "../../PopsCSS";
@@ -27,6 +27,7 @@ import type { PopsPanelSelectDetails } from "./types/components-select";
27
27
  import type { PopsPanelSliderDetails } from "./types/components-slider";
28
28
  import type { PopsPanelSwitchDetails } from "./types/components-switch";
29
29
  import type { PopsPanelTextAreaDetails } from "./types/components-textarea";
30
+ import { PopsCommonCSSClassName } from "../../config/CommonCSSClassName";
30
31
 
31
32
  /**
32
33
  * 处理组件(把组件配置转为组件元素)
@@ -321,6 +322,9 @@ export const PanelHandlerComponents = () => {
321
322
  ".pops-panel-switch__input"
322
323
  )!,
323
324
  core: $li.querySelector<HTMLSpanElement>(".pops-panel-switch__core")!,
325
+ itemLeftTextContainer: $li.querySelector<HTMLDivElement>(
326
+ ".pops-panel-item-left-text"
327
+ ),
324
328
  },
325
329
  init() {
326
330
  this.setStatus(this.$data.value);
@@ -333,9 +337,12 @@ export const PanelHandlerComponents = () => {
333
337
  }
334
338
  this.setClickEvent();
335
339
  },
340
+ /**
341
+ * 设置点击事件
342
+ */
336
343
  setClickEvent() {
337
344
  let that = this;
338
- popsDOMUtils.on(this.$ele.core, "click", void 0, function (event) {
345
+ popsDOMUtils.on(this.$ele.core, "click", function (event) {
339
346
  if (
340
347
  that.$ele.input.disabled ||
341
348
  that.$ele.switch.hasAttribute("data-disabled")
@@ -388,13 +395,21 @@ export const PanelHandlerComponents = () => {
388
395
  disable() {
389
396
  this.$ele.input.disabled = true;
390
397
  this.$ele.switch.setAttribute("data-disabled", "true");
398
+ popsDOMUtils.addClassName(
399
+ this.$ele.itemLeftTextContainer,
400
+ PopsCommonCSSClassName.textIsDisabled
401
+ );
391
402
  },
392
403
  /**
393
- * 启用复选框
404
+ * 取消禁用复选框
394
405
  */
395
406
  notDisable() {
396
407
  this.$ele.input.disabled = false;
397
408
  this.$ele.switch.removeAttribute("data-disabled");
409
+ popsDOMUtils.removeClassName(
410
+ this.$ele.itemLeftTextContainer,
411
+ PopsCommonCSSClassName.textIsDisabled
412
+ );
398
413
  },
399
414
  };
400
415
 
@@ -1116,7 +1131,7 @@ export const PanelHandlerComponents = () => {
1116
1131
  <p class="pops-panel-item-left-main-text">${
1117
1132
  formConfig.text
1118
1133
  }</p>${leftDescriptionText}</div>
1119
- <div class="pops-panel-input pops-user-select-none">
1134
+ <div class="pops-panel-input">
1120
1135
  <input type="${inputType}" placeholder="${formConfig.placeholder ?? ""}">
1121
1136
  </div>
1122
1137
  `
@@ -1187,6 +1202,10 @@ export const PanelHandlerComponents = () => {
1187
1202
  this.$ele.inputSpanIcon.querySelector<HTMLElement>(
1188
1203
  ".pops-panel-icon"
1189
1204
  )!;
1205
+ popsDOMUtils.addClassName(
1206
+ this.$ele.panelInput,
1207
+ PopsCommonCSSClassName.userSelectNone
1208
+ );
1190
1209
  },
1191
1210
  /**
1192
1211
  * 禁用
@@ -1439,7 +1458,7 @@ export const PanelHandlerComponents = () => {
1439
1458
  /*html*/ `
1440
1459
  <div class="pops-panel-item-left-text">
1441
1460
  <p class="pops-panel-item-left-main-text">${formConfig.text}</p>${leftDescriptionText}</div>
1442
- <div class="pops-panel-select pops-user-select-none">
1461
+ <div class="pops-panel-select">
1443
1462
  <select></select>
1444
1463
  </div>
1445
1464
  `
@@ -1462,6 +1481,10 @@ export const PanelHandlerComponents = () => {
1462
1481
  defaultValue: formConfig.getValue(),
1463
1482
  },
1464
1483
  init() {
1484
+ popsDOMUtils.addClassName(
1485
+ this.$ele.panelSelect,
1486
+ PopsCommonCSSClassName.userSelectNone
1487
+ );
1465
1488
  this.initOption();
1466
1489
  this.setChangeEvent();
1467
1490
  this.setClickEvent();
@@ -2672,12 +2695,19 @@ export const PanelHandlerComponents = () => {
2672
2695
  formContainerListElement.setAttribute("data-fold-enable", "");
2673
2696
  }
2674
2697
  });
2675
- formHeaderDivElement.classList.add(
2698
+ popsDOMUtils.addClassName(
2699
+ formHeaderDivElement,
2676
2700
  "pops-panel-forms-fold-container"
2677
2701
  );
2678
- formHeaderDivElement.classList.add("pops-user-select-none");
2702
+ popsDOMUtils.addClassName(
2703
+ formHeaderDivElement,
2704
+ PopsCommonCSSClassName.userSelectNone
2705
+ );
2679
2706
  formContainerListElement.setAttribute("data-fold-enable", "");
2680
- formContainerListElement.classList.add("pops-panel-forms-fold");
2707
+ popsDOMUtils.addClassName(
2708
+ formHeaderDivElement,
2709
+ "pops-panel-forms-fold"
2710
+ );
2681
2711
  formContainerListElement.appendChild(formHeaderDivElement);
2682
2712
  } else {
2683
2713
  /* 加进容器内 */
@@ -2938,10 +2968,19 @@ export const PanelHandlerComponents = () => {
2938
2968
  formContainerListElement.setAttribute("data-fold-enable", "");
2939
2969
  }
2940
2970
  });
2941
- formHeaderDivElement.classList.add("pops-panel-forms-fold-container");
2942
- formHeaderDivElement.classList.add("pops-user-select-none");
2971
+ popsDOMUtils.addClassName(
2972
+ formHeaderDivElement,
2973
+ "pops-panel-forms-fold-container"
2974
+ );
2975
+ popsDOMUtils.addClassName(
2976
+ formHeaderDivElement,
2977
+ PopsCommonCSSClassName.userSelectNone
2978
+ );
2943
2979
  formContainerListElement.setAttribute("data-fold-enable", "");
2944
- formContainerListElement.classList.add("pops-panel-forms-fold");
2980
+ popsDOMUtils.addClassName(
2981
+ formHeaderDivElement,
2982
+ "pops-panel-forms-fold"
2983
+ );
2945
2984
  formContainerListElement.appendChild(formHeaderDivElement);
2946
2985
  } else {
2947
2986
  /* 加进容器内 */
@@ -6,7 +6,7 @@ import { popsUtils } from "../../utils/PopsUtils";
6
6
  import type { PopsPanelDetails, PopsPanelEventType } from "./types";
7
7
  import { PopsPanelConfig } from "./config";
8
8
  import { PanelHandlerComponents } from "./handlerComponents";
9
- import { GlobalConfig } from "../../GlobalConfig";
9
+ import { GlobalConfig } from "../../config/GlobalConfig";
10
10
  import { PopsCSS } from "../../PopsCSS";
11
11
  import type { PopsType } from "../../types/main";
12
12
 
@@ -1,4 +1,4 @@
1
- import { GlobalConfig } from "../../GlobalConfig";
1
+ import { GlobalConfig } from "../../config/GlobalConfig";
2
2
  import { PopsElementHandler } from "../../handler/PopsElementHandler";
3
3
  import { PopsHandler } from "../../handler/PopsHandler";
4
4
  import { PopsCSS } from "../../PopsCSS";
@@ -1,5 +1,5 @@
1
1
  import { OriginPrototype } from "../../PopsCore";
2
- import { GlobalConfig } from "../../GlobalConfig";
2
+ import { GlobalConfig } from "../../config/GlobalConfig";
3
3
  import { PopsHandler } from "../../handler/PopsHandler";
4
4
  import { popsDOMUtils } from "../../utils/PopsDOMUtils";
5
5
  import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
@@ -2,11 +2,12 @@ import { PopsHandler } from "../../handler/PopsHandler";
2
2
  import { popsDOMUtils } from "../../utils/PopsDOMUtils";
3
3
  import { popsUtils } from "../../utils/PopsUtils";
4
4
  import { searchSuggestionConfig as PopsSearchSuggestionConfig } from "./config";
5
- import { GlobalConfig } from "../../GlobalConfig";
5
+ import { GlobalConfig } from "../../config/GlobalConfig";
6
6
  import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
7
7
  import type { PopsSearchSuggestionDetails } from "./types/index";
8
8
  import { PopsCSS } from "../../PopsCSS";
9
9
  import type { PopsType } from "../../types/main";
10
+ import { PopsCommonCSSClassName } from "../../config/CommonCSSClassName";
10
11
 
11
12
  export const PopsSearchSuggestion = {
12
13
  init(details: PopsSearchSuggestionDetails) {
@@ -209,14 +210,17 @@ export const PopsSearchSuggestion = {
209
210
  * @param index 当前项的下标
210
211
  */
211
212
  getSearchItemLiElement(data: any, index: number) {
212
- return popsDOMUtils.createElement("li", {
213
- className: `pops-${popsType}-search-suggestion-hint-item pops-flex-items-center pops-flex-y-center`,
213
+ let $li = popsDOMUtils.createElement("li", {
214
+ className: `pops-${popsType}-search-suggestion-hint-item`,
214
215
  "data-index": index,
215
216
  "data-value": SearchSuggestion.getItemDataValue(data),
216
217
  innerHTML: `${config.getItemHTML(data)}${
217
218
  config.deleteIcon.enable ? SearchSuggestion.getDeleteIconHTML() : ""
218
219
  }`,
219
220
  });
221
+ popsDOMUtils.addClassName($li, PopsCommonCSSClassName.flexCenter);
222
+ popsDOMUtils.addClassName($li, PopsCommonCSSClassName.flexYCenter);
223
+ return $li;
220
224
  },
221
225
  /**
222
226
  * 获取data-value值
@@ -1,4 +1,4 @@
1
- import { GlobalConfig } from "../../GlobalConfig";
1
+ import { GlobalConfig } from "../../config/GlobalConfig";
2
2
  import { PopsHandler } from "../../handler/PopsHandler";
3
3
  import { PopsCSS } from "../../PopsCSS";
4
4
  import type { PopsType } from "../../types/main";
@@ -0,0 +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,4 +1,4 @@
1
- import type { PopsCommonConfig, PopsDragConfig } from "./types/components";
1
+ import type { PopsCommonConfig, PopsDragConfig } from "../types/components";
2
2
 
3
3
  type EnterReturnType<T> = null | T | (() => T);
4
4
 
@@ -36,3 +36,17 @@
36
36
  width: -webkit-fill-available;
37
37
  width: -moz-available;
38
38
  }
39
+ .pops-text-is-disabled {
40
+ --pops-text-is-disabled-color: #a8abb2;
41
+ color: var(--pops-text-is-disabled-color);
42
+ --pops-panel-forms-container-item-left-desc-text-color: var(
43
+ --pops-text-is-disabled-color
44
+ );
45
+ }
46
+ .pops-text-is-disabled-important {
47
+ --pops-text-is-disabled-color: #a8abb2;
48
+ color: var(--pops-text-is-disabled-color) !important;
49
+ --pops-panel-forms-container-item-left-desc-text-color: var(
50
+ --pops-text-is-disabled-color
51
+ ) !important;
52
+ }
@@ -11,6 +11,7 @@ import { SymbolEvents } from "./PopsDOMUtilsEventsConfig";
11
11
  import { OriginPrototype, PopsCore } from "../PopsCore";
12
12
  import { popsUtils } from "./PopsUtils";
13
13
  import { PopsSafeUtils } from "./PopsSafeUtils";
14
+ import { PopsCommonCSSClassName } from "../config/CommonCSSClassName";
14
15
 
15
16
  class PopsDOMUtilsEvent {
16
17
  /**
@@ -1783,7 +1784,10 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
1783
1784
  * @param element 目标元素
1784
1785
  * @param className className属性
1785
1786
  */
1786
- addClassName(element: HTMLElement, className: string) {
1787
+ addClassName(element: Element | undefined | null, className: string) {
1788
+ if (element == null) {
1789
+ return;
1790
+ }
1787
1791
  if (typeof className !== "string") {
1788
1792
  return;
1789
1793
  }
@@ -1797,7 +1801,10 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
1797
1801
  * @param element 目标元素
1798
1802
  * @param className className属性
1799
1803
  */
1800
- removeClassName(element: HTMLElement, className: string) {
1804
+ removeClassName(element: Element | undefined | null, className: string) {
1805
+ if (element == null) {
1806
+ return;
1807
+ }
1801
1808
  if (typeof className !== "string") {
1802
1809
  return;
1803
1810
  }
@@ -1811,7 +1818,13 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
1811
1818
  * @param element 目标元素
1812
1819
  * @param className className属性
1813
1820
  */
1814
- containsClassName(element: HTMLElement, className: string): boolean {
1821
+ containsClassName(
1822
+ element: HTMLElement | undefined | null,
1823
+ className: string
1824
+ ): boolean {
1825
+ if (element == null) {
1826
+ return false;
1827
+ }
1815
1828
  if (typeof className !== "string") {
1816
1829
  return false;
1817
1830
  }
@@ -2226,9 +2239,9 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
2226
2239
  return;
2227
2240
  }
2228
2241
  if (isImportant) {
2229
- ele.classList.add("pops-hide-important");
2242
+ popsDOMUtils.addClassName(ele, PopsCommonCSSClassName.hideImportant);
2230
2243
  } else {
2231
- ele.classList.add("pops-hide");
2244
+ popsDOMUtils.addClassName(ele, PopsCommonCSSClassName.hide);
2232
2245
  }
2233
2246
  }
2234
2247
  /**
@@ -2239,8 +2252,8 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
2239
2252
  if (ele == null) {
2240
2253
  return;
2241
2254
  }
2242
- ele.classList.remove("pops-hide-important");
2243
- ele.classList.remove("pops-hide");
2255
+ popsDOMUtils.removeClassName(ele, PopsCommonCSSClassName.hide);
2256
+ popsDOMUtils.removeClassName(ele, PopsCommonCSSClassName.hideImportant);
2244
2257
  }
2245
2258
  /**
2246
2259
  * 将字符串转为Element元素
@@ -2575,7 +2588,7 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
2575
2588
  return `#${hexs.join("")}`;
2576
2589
  };
2577
2590
 
2578
- /**
2591
+ /**
2579
2592
  * 获取深色
2580
2593
  */
2581
2594
  const getDarkColor = (
@@ -2598,7 +2611,7 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
2598
2611
  return useChangeColor().rgbToHex(rgb[0], rgb[1], rgb[2]);
2599
2612
  };
2600
2613
 
2601
- /**
2614
+ /**
2602
2615
  * 获取颜色变浅后的颜色值
2603
2616
  */
2604
2617
  const getLightColor = (