@whitesev/pops 3.3.0 → 3.3.1

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 (63) hide show
  1. package/dist/index.amd.js +127 -44
  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 +127 -44
  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 +127 -44
  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 +127 -44
  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 +127 -44
  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 +127 -44
  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 +5 -0
  26. package/dist/types/src/PopsCore.d.ts +1 -1
  27. package/dist/types/src/components/panel/handlerComponents.d.ts +8 -4
  28. package/dist/types/src/components/panel/types/components-switch.d.ts +12 -2
  29. package/dist/types/src/components/rightClickMenu/types/index.d.ts +1 -1
  30. package/dist/types/src/components/searchSuggestion/index.d.ts +1 -1
  31. package/dist/types/src/components/searchSuggestion/types/index.d.ts +1 -1
  32. package/dist/types/src/components/tooltip/index.d.ts +2 -0
  33. package/dist/types/src/components/tooltip/types/index.d.ts +1 -1
  34. package/dist/types/src/config/GlobalConfig.d.ts +2 -0
  35. package/dist/types/src/handler/PopsElementHandler.d.ts +13 -1
  36. package/dist/types/src/types/components.d.ts +12 -0
  37. package/package.json +3 -3
  38. package/src/PopsCore.ts +1 -1
  39. package/src/components/alert/defaultConfig.ts +2 -0
  40. package/src/components/alert/index.ts +2 -2
  41. package/src/components/confirm/defaultConfig.ts +2 -0
  42. package/src/components/drawer/defaultConfig.ts +2 -0
  43. package/src/components/folder/defaultConfig.ts +2 -0
  44. package/src/components/iframe/defaultConfig.ts +2 -0
  45. package/src/components/loading/defaultConfig.ts +2 -0
  46. package/src/components/panel/defaultConfig.ts +2 -0
  47. package/src/components/panel/handlerComponents.ts +38 -21
  48. package/src/components/panel/index.css +1 -0
  49. package/src/components/panel/types/components-switch.ts +12 -2
  50. package/src/components/prompt/defaultConfig.ts +2 -0
  51. package/src/components/rightClickMenu/defaultConfig.ts +2 -0
  52. package/src/components/rightClickMenu/index.ts +7 -12
  53. package/src/components/rightClickMenu/types/index.ts +1 -1
  54. package/src/components/searchSuggestion/defaultConfig.ts +2 -0
  55. package/src/components/searchSuggestion/index.ts +13 -13
  56. package/src/components/searchSuggestion/types/index.ts +1 -1
  57. package/src/components/tooltip/defaultConfig.ts +2 -0
  58. package/src/components/tooltip/index.ts +7 -8
  59. package/src/components/tooltip/types/index.ts +1 -1
  60. package/src/css/index.css +1 -0
  61. package/src/handler/PopsElementHandler.ts +64 -12
  62. package/src/types/components.d.ts +12 -0
  63. package/src/utils/PopsUtils.ts +1 -1
@@ -284,6 +284,7 @@ declare class Pops {
284
284
  init(): void;
285
285
  onClick(): void;
286
286
  setStatus(isChecked?: boolean): void;
287
+ getReverseStatus(): boolean;
287
288
  getStatus(): boolean;
288
289
  disable(): void;
289
290
  notDisable(): void;
@@ -709,6 +710,8 @@ declare class Pops {
709
710
  animation?: import("./types/animation").PopsAnimation | undefined;
710
711
  mask?: import("./types/mask").PopsMaskConfig | undefined;
711
712
  forbiddenScroll?: boolean | undefined;
713
+ lightStyle?: string | undefined;
714
+ darkStyle?: string | undefined;
712
715
  beforeAppendToPageCallBack?: void;
713
716
  drag?: boolean | undefined;
714
717
  dragLimit?: boolean | undefined;
@@ -775,6 +778,8 @@ declare class Pops {
775
778
  only: boolean;
776
779
  zIndex: IFunction<number>;
777
780
  style: string | null;
781
+ lightStyle: string | null;
782
+ darkStyle: string | null;
778
783
  beforeAppendToPageCallBack: ($shadowRoot: ShadowRoot | HTMLElement, $shadowContainer: HTMLDivElement) => void;
779
784
  };
780
785
  $shadowContainer: HTMLDivElement;
@@ -24,4 +24,4 @@ declare const PopsCore: {
24
24
  readonly clearTimeout: typeof clearTimeout;
25
25
  readonly clearInterval: typeof clearInterval;
26
26
  };
27
- export { PopsCore, OriginPrototype };
27
+ export { OriginPrototype, PopsCore };
@@ -1,14 +1,14 @@
1
1
  import { popsUtils } from "../../utils/PopsUtils";
2
2
  import { PopsTooltip } from "../tooltip";
3
+ import type { PopsPanelBottomContentConfig, PopsPanelConfig, PopsPanelContentConfig, PopsPanelViewConfig } from "./types";
3
4
  import type { PopsPanelButtonConfig } from "./types/components-button";
4
5
  import type { PopsPanelGeneralConfig, PopsPanelRightAsideContainerConfig } from "./types/components-common";
5
- import type { PopsPanelDeepViewConfig } from "./types/components-deepMenu";
6
6
  import type { PopsPanelContainerConfig } from "./types/components-container";
7
- import type { PopsPanelBottomContentConfig, PopsPanelContentConfig, PopsPanelConfig, PopsPanelViewConfig } from "./types";
7
+ import type { PopsPanelDeepViewConfig } from "./types/components-deepMenu";
8
8
  import type { PopsPanelInputConfig, PopsPanelInputType } from "./types/components-input";
9
9
  import type { PopsPanelOwnConfig } from "./types/components-own";
10
- import type { PopsPanelSelectMultipleDataOption, PopsPanelSelectMultipleConfig } from "./types/components-selectMultiple";
11
10
  import type { PopsPanelSelectConfig, PopsPanelSelectDataOption } from "./types/components-select";
11
+ import type { PopsPanelSelectMultipleConfig, PopsPanelSelectMultipleDataOption } from "./types/components-selectMultiple";
12
12
  import type { PopsPanelSliderConfig } from "./types/components-slider";
13
13
  import type { PopsPanelSwitchConfig } from "./types/components-switch";
14
14
  import type { PopsPanelTextAreaConfig } from "./types/components-textarea";
@@ -152,7 +152,11 @@ export declare const PanelHandlerComponents: () => {
152
152
  */
153
153
  setStatus(isChecked?: boolean): void;
154
154
  /**
155
- * 根据className来获取逆反值
155
+ * 获取开/关的逆反状态
156
+ */
157
+ getReverseStatus(): boolean;
158
+ /**
159
+ * 获取开/关的状态
156
160
  */
157
161
  getStatus(): boolean;
158
162
  /**
@@ -26,7 +26,17 @@ export interface PopsPanelSwitchConfig extends PopsPanelGeneralConfig<PopsPanelS
26
26
  */
27
27
  getValue(): boolean;
28
28
  /**
29
- * switch开启/关闭触发的回调函数
29
+ * switch`开启`/`关闭`前触发的回调函数
30
+ * @param event 事件
31
+ * @param value switch的状态(开关前)
32
+ * @returns
33
+ * + `false`: 阻止switch的开启/关闭
30
34
  */
31
- callback(event: MouseEvent | PointerEvent, value: boolean): void;
35
+ beforeSwitchStatusChangeCallBack?(event: MouseEvent | PointerEvent, value: boolean): IPromise<void | boolean>;
36
+ /**
37
+ * switch`开启`/`关闭`后触发的回调函数
38
+ * @param event 事件
39
+ * @param value switch的状态(开关后)
40
+ */
41
+ callback(event: MouseEvent | PointerEvent, value: boolean): IPromise<void>;
32
42
  }
@@ -60,7 +60,7 @@ export interface PopsRightClickMenuDataConfig {
60
60
  /**
61
61
  * pops.rightClickMenu
62
62
  */
63
- export interface PopsRightClickMenuConfig extends Pick<PopsGeneralConfig, "useShadowRoot" | "beforeAppendToPageCallBack" | "zIndex" | "style" | "only"> {
63
+ export interface PopsRightClickMenuConfig extends Pick<PopsGeneralConfig, "useShadowRoot" | "beforeAppendToPageCallBack" | "zIndex" | "style" | "lightStyle" | "darkStyle" | "only"> {
64
64
  /**
65
65
  * 目标元素
66
66
  * @default document.documentElement
@@ -1,4 +1,4 @@
1
- import type { PopsSearchSuggestionData, PopsSearchSuggestionConfig } from "./types/index";
1
+ import type { PopsSearchSuggestionConfig, PopsSearchSuggestionData } from "./types/index";
2
2
  export declare const PopsSearchSuggestion: {
3
3
  init<T>(__config__: PopsSearchSuggestionConfig<T>): {
4
4
  /**
@@ -99,7 +99,7 @@ export type PopsSearchSuggestionData<T> = {
99
99
  * 搜索建议悬浮窗
100
100
  * pops.searchSuggestion
101
101
  */
102
- export interface PopsSearchSuggestionConfig<T = any> extends Pick<PopsGeneralConfig, "useShadowRoot" | "zIndex" | "style"> {
102
+ export interface PopsSearchSuggestionConfig<T = any> extends Pick<PopsGeneralConfig, "useShadowRoot" | "zIndex" | "style" | "lightStyle" | "darkStyle"> {
103
103
  /**
104
104
  * 当前的环境,可以是document,可以是shadowroot,默认是document
105
105
  *
@@ -208,6 +208,8 @@ export declare const PopsTooltip: {
208
208
  only: boolean;
209
209
  zIndex: IFunction<number>;
210
210
  style: string | null;
211
+ lightStyle: string | null;
212
+ darkStyle: string | null;
211
213
  beforeAppendToPageCallBack: ($shadowRoot: ShadowRoot | HTMLElement, $shadowContainer: HTMLDivElement) => void;
212
214
  };
213
215
  $shadowContainer: HTMLDivElement;
@@ -5,7 +5,7 @@ export type PopsTooltipPosition = "top" | "right" | "bottom" | "left" | "follow"
5
5
  /**
6
6
  * pops.tooltip
7
7
  */
8
- export interface PopsToolTipConfig extends Pick<PopsGeneralConfig, "useShadowRoot" | "only" | "zIndex" | "style" | "beforeAppendToPageCallBack"> {
8
+ export interface PopsToolTipConfig extends Pick<PopsGeneralConfig, "useShadowRoot" | "only" | "zIndex" | "style" | "lightStyle" | "darkStyle" | "beforeAppendToPageCallBack"> {
9
9
  /**
10
10
  * 目标元素
11
11
  */
@@ -25,6 +25,8 @@ export declare const GlobalConfig: {
25
25
  animation?: import("../types/animation").PopsAnimation | undefined;
26
26
  mask?: import("../types/mask").PopsMaskConfig | undefined;
27
27
  forbiddenScroll?: boolean | undefined;
28
+ lightStyle?: string | undefined;
29
+ darkStyle?: string | undefined;
28
30
  beforeAppendToPageCallBack?: void;
29
31
  drag?: boolean | undefined;
30
32
  dragLimit?: boolean | undefined;
@@ -1,4 +1,4 @@
1
- import type { PopsSupportAnimConfig, PopsSupportBottomButtonConfig, PopsSupportContentConfig, PopsSupportHeaderTitleConfig, PopsSupportAnimConfigType, PopsSupportBottomButtonConfigType, PopsSupportContentConfigType, PopsSupportHeaderTitleConfigType } from "../types/main";
1
+ import type { PopsSupportAnimConfig, PopsSupportAnimConfigType, PopsSupportBottomButtonConfig, PopsSupportBottomButtonConfigType, PopsSupportContentConfig, PopsSupportContentConfigType, PopsSupportHeaderTitleConfig, PopsSupportHeaderTitleConfigType } from "../types/main";
2
2
  export declare const PopsElementHandler: {
3
3
  /**
4
4
  * 获取遮罩层HTML
@@ -52,4 +52,16 @@ export declare const PopsElementHandler: {
52
52
  * @param html
53
53
  */
54
54
  parseElement<T extends HTMLElement>(html: string): T;
55
+ /**
56
+ * 添加样式元素
57
+ */
58
+ addStyle($parent: HTMLElement | ShadowRoot, style?: string | null): HTMLStyleElement | undefined;
59
+ /**
60
+ * 添加在浅色模式下生效的style元素
61
+ */
62
+ addLightStyle($parent: HTMLElement | ShadowRoot, style?: string | null): HTMLStyleElement | undefined;
63
+ /**
64
+ * 添加在深色模式下生效的style元素
65
+ */
66
+ addDarkStyle($parent: HTMLElement | ShadowRoot, style?: string | null): HTMLStyleElement | undefined;
55
67
  };
@@ -202,6 +202,18 @@ export interface PopsGeneralConfig {
202
202
  * @default ""
203
203
  */
204
204
  style?: string | null;
205
+ /**
206
+ * (可选)自定义浅色模式的style
207
+ *
208
+ * 传入的css都在dark内
209
+ */
210
+ lightStyle?: string | null;
211
+ /**
212
+ * (可选)自定义深色模式的style
213
+ *
214
+ * 传入的css都在dark内
215
+ */
216
+ darkStyle?: string | null;
205
217
  /**
206
218
  * 在元素添加到页面前的事件
207
219
  * @param $shadowRoot 根元素
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/pops",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "弹窗库,包含了alert、confirm、prompt、drawer、folder、loading、iframe、panel、tooltip、searchSuggestion、rightClickMenu组件",
5
5
  "keywords": [
6
6
  "ScriptCat",
@@ -56,8 +56,8 @@
56
56
  "eslint-plugin-compat": "^6.0.2",
57
57
  "eslint-plugin-prettier": "^5.5.4",
58
58
  "globals": "^16.5.0",
59
- "oxfmt": "^0.32.0",
60
- "oxlint": "1.46.0",
59
+ "oxfmt": "^0.35.0",
60
+ "oxlint": "1.50.0",
61
61
  "rollup": "^4.54.0",
62
62
  "rollup-plugin-clear": "^2.0.7",
63
63
  "rollup-plugin-import-css": "^4.1.2",
package/src/PopsCore.ts CHANGED
@@ -50,4 +50,4 @@ const PopsCore = {
50
50
  },
51
51
  };
52
52
 
53
- export { PopsCore, OriginPrototype };
53
+ export { OriginPrototype, PopsCore };
@@ -57,6 +57,8 @@ export const PopsAlertDefaultConfig = (): DeepRequired<PopsAlertConfig> => {
57
57
  dragEndCallBack() {},
58
58
  forbiddenScroll: false,
59
59
  style: null,
60
+ lightStyle: null,
61
+ darkStyle: null,
60
62
  beforeAppendToPageCallBack() {},
61
63
  } as DeepRequired<PopsAlertConfig>;
62
64
  };
@@ -1,13 +1,13 @@
1
1
  import { GlobalConfig } from "../../config/GlobalConfig";
2
2
  import { PopsElementHandler } from "../../handler/PopsElementHandler";
3
3
  import { PopsHandler } from "../../handler/PopsHandler";
4
+ import { PopsCSS } from "../../PopsCSS";
5
+ import type { PopsType } from "../../types/main";
4
6
  import { popsDOMUtils } from "../../utils/PopsDOMUtils";
5
7
  import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
6
8
  import { popsUtils } from "../../utils/PopsUtils";
7
9
  import { PopsAlertDefaultConfig } from "./defaultConfig";
8
- import type { PopsType } from "../../types/main";
9
10
  import type { PopsAlertConfig } from "./types";
10
- import { PopsCSS } from "../../PopsCSS";
11
11
 
12
12
  export const PopsAlert = {
13
13
  init(__config__: PopsAlertConfig) {
@@ -85,6 +85,8 @@ export const PopsConfirmDefaultConfig = (): DeepRequired<PopsConfirmConfig> => {
85
85
  forbiddenScroll: false,
86
86
 
87
87
  style: null,
88
+ lightStyle: null,
89
+ darkStyle: null,
88
90
  beforeAppendToPageCallBack() {},
89
91
  } as DeepRequired<PopsConfirmConfig>;
90
92
  };
@@ -83,6 +83,8 @@ export const PopsDrawerDefaultConfig = (): DeepRequired<PopsDrawerConfig> => {
83
83
  borderRadius: 0,
84
84
 
85
85
  style: null,
86
+ lightStyle: null,
87
+ darkStyle: null,
86
88
  beforeAppendToPageCallBack() {},
87
89
  forbiddenScroll: false,
88
90
  };
@@ -146,6 +146,8 @@ export const PopsFolderDefaultConfig = (): DeepRequired<PopsFolderConfig> => {
146
146
  dragEndCallBack() {},
147
147
  forbiddenScroll: false,
148
148
  style: null,
149
+ lightStyle: null,
150
+ darkStyle: null,
149
151
  beforeAppendToPageCallBack() {},
150
152
  };
151
153
  };
@@ -55,6 +55,8 @@ export const PopsIframeDefaultConfig = (): DeepRequired<PopsIframeConfig> => {
55
55
  },
56
56
 
57
57
  style: null,
58
+ lightStyle: null,
59
+ darkStyle: null,
58
60
  beforeAppendToPageCallBack() {},
59
61
  };
60
62
  };
@@ -24,6 +24,8 @@ export const PopsLoadingDefaultConfig = (): DeepRequired<PopsLoadingConfig> => {
24
24
  forbiddenScroll: false,
25
25
  isAbsolute: false,
26
26
  style: null,
27
+ lightStyle: null,
28
+ darkStyle: null,
27
29
  addIndexCSS: true,
28
30
  };
29
31
  };
@@ -863,6 +863,8 @@ export const PopsPanelDefaultConfig = (): DeepRequired<PopsPanelConfig> => {
863
863
  dragEndCallBack() {},
864
864
  forbiddenScroll: false,
865
865
  style: null,
866
+ lightStyle: null,
867
+ darkStyle: null,
866
868
  beforeAppendToPageCallBack() {},
867
869
  };
868
870
  };
@@ -1,3 +1,5 @@
1
+ import { PopsCommonCSSClassName } from "../../config/CommonCSSClassName";
2
+ import { PopsCSS } from "../../PopsCSS";
1
3
  import { PopsIcon } from "../../PopsIcon";
2
4
  import { popsDOMUtils } from "../../utils/PopsDOMUtils";
3
5
  import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
@@ -5,31 +7,29 @@ import { PopsMathFloatUtils } from "../../utils/PopsMathUtils";
5
7
  import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
6
8
  import { popsUtils } from "../../utils/PopsUtils";
7
9
  import { PopsAlert } from "../alert";
8
- import { PopsTooltip } from "../tooltip";
9
- import { PopsCommonCSSClassName } from "../../config/CommonCSSClassName";
10
10
  import type { PopsAlertConfig } from "../alert/types";
11
- import type { PopsPanelButtonConfig } from "./types/components-button";
12
- import type { PopsPanelGeneralConfig, PopsPanelRightAsideContainerConfig } from "./types/components-common";
13
- import type { PopsPanelDeepViewConfig } from "./types/components-deepMenu";
14
- import type { PopsPanelContainerConfig } from "./types/components-container";
11
+ import { PopsTooltip } from "../tooltip";
15
12
  import type {
16
13
  PopsPanelBottomContentConfig,
17
- PopsPanelContentConfig,
18
14
  PopsPanelConfig,
15
+ PopsPanelContentConfig,
19
16
  PopsPanelEventType,
20
17
  PopsPanelViewConfig,
21
18
  } from "./types";
19
+ import type { PopsPanelButtonConfig } from "./types/components-button";
20
+ import type { PopsPanelGeneralConfig, PopsPanelRightAsideContainerConfig } from "./types/components-common";
21
+ import type { PopsPanelContainerConfig } from "./types/components-container";
22
+ import type { PopsPanelDeepViewConfig } from "./types/components-deepMenu";
22
23
  import type { PopsPanelInputConfig, PopsPanelInputType } from "./types/components-input";
23
24
  import type { PopsPanelOwnConfig } from "./types/components-own";
25
+ import type { PopsPanelSelectConfig, PopsPanelSelectDataOption } from "./types/components-select";
24
26
  import type {
25
- PopsPanelSelectMultipleDataOption,
26
27
  PopsPanelSelectMultipleConfig,
28
+ PopsPanelSelectMultipleDataOption,
27
29
  } from "./types/components-selectMultiple";
28
- import type { PopsPanelSelectConfig, PopsPanelSelectDataOption } from "./types/components-select";
29
30
  import type { PopsPanelSliderConfig } from "./types/components-slider";
30
31
  import type { PopsPanelSwitchConfig } from "./types/components-switch";
31
32
  import type { PopsPanelTextAreaConfig } from "./types/components-textarea";
32
- import { PopsCSS } from "../../PopsCSS";
33
33
  /**
34
34
  * 处理组件(把组件配置转为组件元素)
35
35
  */
@@ -395,15 +395,22 @@ export const PanelHandlerComponents = () => {
395
395
  * 设置点击事件
396
396
  */
397
397
  onClick() {
398
- const that = this;
399
- popsDOMUtils.on(this.$ele.core, "click", function (event) {
400
- if (that.$ele.input.disabled || that.$ele.switch.hasAttribute("data-disabled")) {
398
+ popsDOMUtils.on(this.$ele.core, "click", async (event) => {
399
+ if (this.$ele.input.disabled || this.$ele.switch.hasAttribute("data-disabled")) {
401
400
  return;
402
401
  }
403
- that.$data.value = that.getStatus();
404
- that.setStatus(that.$data.value);
402
+ const status = this.getStatus();
403
+ if (typeof viewConfig.beforeSwitchStatusChangeCallBack === "function") {
404
+ const flag = await viewConfig.beforeSwitchStatusChangeCallBack(event, status);
405
+ if (typeof flag === "boolean" && !flag) {
406
+ return;
407
+ }
408
+ }
409
+ // 设置为逆反状态
410
+ this.$data.value = !status;
411
+ this.setStatus(this.$data.value);
405
412
  if (typeof viewConfig.callback === "function") {
406
- viewConfig.callback(event, that.$data.value);
413
+ await viewConfig.callback(event, this.$data.value);
407
414
  }
408
415
  });
409
416
  },
@@ -420,11 +427,17 @@ export const PanelHandlerComponents = () => {
420
427
  }
421
428
  },
422
429
  /**
423
- * 根据className来获取逆反值
430
+ * 获取开/关的逆反状态
431
+ */
432
+ getReverseStatus() {
433
+ return !this.getStatus();
434
+ },
435
+ /**
436
+ * 获取开/关的状态
424
437
  */
425
438
  getStatus() {
426
439
  let checkedValue = false;
427
- if (!popsDOMUtils.containsClassName(this.$ele.switch, "pops-panel-switch-is-checked")) {
440
+ if (popsDOMUtils.containsClassName(this.$ele.switch, "pops-panel-switch-is-checked")) {
428
441
  checkedValue = true;
429
442
  }
430
443
  return checkedValue;
@@ -1896,7 +1909,7 @@ export const PanelHandlerComponents = () => {
1896
1909
  return;
1897
1910
  }
1898
1911
  /** 当前已选中的值 */
1899
- const { style, ...userConfirmConfig } = viewConfig.selectConfirmDialogConfig || {};
1912
+ const { style, lightStyle, darkStyle, ...userConfirmConfig } = viewConfig.selectConfirmDialogConfig || {};
1900
1913
  /**
1901
1914
  * 弹窗关闭的回调
1902
1915
  */
@@ -1966,7 +1979,9 @@ export const PanelHandlerComponents = () => {
1966
1979
  ${PopsCSS.panelCSS}
1967
1980
 
1968
1981
  ${style || ""}
1969
- `,
1982
+ `,
1983
+ lightStyle: lightStyle,
1984
+ darkStyle: darkStyle,
1970
1985
  },
1971
1986
  userConfirmConfig
1972
1987
  );
@@ -3119,7 +3134,7 @@ export const PanelHandlerComponents = () => {
3119
3134
  }
3120
3135
  /** 当前已选中的值 */
3121
3136
  const selectInfo = this.$data.selectedDataList;
3122
- const { style, ...userConfirmConfig } = viewConfig.selectConfirmDialogConfig || {};
3137
+ const { style, lightStyle, darkStyle, ...userConfirmConfig } = viewConfig.selectConfirmDialogConfig || {};
3123
3138
  const dialogCloseCallback = () => {
3124
3139
  this.$data.selectedDataList = [...selectInfo];
3125
3140
  this.updateTagItem();
@@ -3168,6 +3183,8 @@ export const PanelHandlerComponents = () => {
3168
3183
 
3169
3184
  ${style || ""}
3170
3185
  `,
3186
+ lightStyle: lightStyle,
3187
+ darkStyle: darkStyle,
3171
3188
  },
3172
3189
  userConfirmConfig
3173
3190
  );
@@ -1383,6 +1383,7 @@ section.pops-panel-deepMenu-container .pops-panel-container-header-ul li.pops-pa
1383
1383
  --pops-panel-components-input-hover-bd-color: #6f7175;
1384
1384
  --pops-panel-components-input-focus-bd-color: #409eff;
1385
1385
  --pops-panel-components-input-suffix-color: #a8abb2;
1386
+ --pops-panel-components-input-suffix-bg-color: var(--pops-dark-color);
1386
1387
  }
1387
1388
  /* textarea的CSS */
1388
1389
  .pops-panel-textarea {
@@ -27,7 +27,17 @@ export interface PopsPanelSwitchConfig extends PopsPanelGeneralConfig<PopsPanelS
27
27
  */
28
28
  getValue(): boolean;
29
29
  /**
30
- * switch开启/关闭触发的回调函数
30
+ * switch`开启`/`关闭`前触发的回调函数
31
+ * @param event 事件
32
+ * @param value switch的状态(开关前)
33
+ * @returns
34
+ * + `false`: 阻止switch的开启/关闭
31
35
  */
32
- callback(event: MouseEvent | PointerEvent, value: boolean): void;
36
+ beforeSwitchStatusChangeCallBack?(event: MouseEvent | PointerEvent, value: boolean): IPromise<void | boolean>;
37
+ /**
38
+ * switch`开启`/`关闭`后触发的回调函数
39
+ * @param event 事件
40
+ * @param value switch的状态(开关后)
41
+ */
42
+ callback(event: MouseEvent | PointerEvent, value: boolean): IPromise<void>;
33
43
  }
@@ -89,6 +89,8 @@ export const PopsPromptDefaultConfig = (): DeepRequired<PopsPromptConfig> => {
89
89
  forbiddenScroll: false,
90
90
 
91
91
  style: null,
92
+ lightStyle: null,
93
+ darkStyle: null,
92
94
  beforeAppendToPageCallBack() {},
93
95
  };
94
96
  };
@@ -95,6 +95,8 @@ export const PopsRightClickMenuDefaultConfig = (): DeepRequired<PopsRightClickMe
95
95
  zIndex: 10000,
96
96
  preventDefault: true,
97
97
  style: null,
98
+ lightStyle: null,
99
+ darkStyle: null,
98
100
  beforeAppendToPageCallBack() {},
99
101
  limitPositionXInView: true,
100
102
  limitPositionYInView: true,
@@ -15,6 +15,7 @@ import type {
15
15
  import { PopsCSS } from "../../PopsCSS";
16
16
  import { PopsIcon } from "../../PopsIcon";
17
17
  import type { PopsType } from "../../types/main";
18
+ import { PopsElementHandler } from "../../handler/PopsElementHandler";
18
19
 
19
20
  export const PopsRightClickMenu = {
20
21
  init(__config__: PopsRightClickMenuConfig) {
@@ -47,18 +48,12 @@ export const PopsRightClickMenu = {
47
48
  },
48
49
  ]);
49
50
 
50
- if (config.style != null) {
51
- const $css = popsDOMUtils.createElement(
52
- "style",
53
- {
54
- innerHTML: config.style,
55
- },
56
- {
57
- type: "text/css",
58
- }
59
- );
60
- $shadowRoot.appendChild($css);
61
- }
51
+ // 添加自定义style
52
+ PopsElementHandler.addStyle($shadowRoot, config.style);
53
+ // 添加自定义浅色style
54
+ PopsElementHandler.addLightStyle($shadowRoot, config.lightStyle);
55
+ // 添加自定义深色style
56
+ PopsElementHandler.addDarkStyle($shadowRoot, config.darkStyle);
62
57
 
63
58
  const PopsContextMenu = {
64
59
  $data: {
@@ -70,7 +70,7 @@ export interface PopsRightClickMenuDataConfig {
70
70
  */
71
71
  export interface PopsRightClickMenuConfig extends Pick<
72
72
  PopsGeneralConfig,
73
- "useShadowRoot" | "beforeAppendToPageCallBack" | "zIndex" | "style" | "only"
73
+ "useShadowRoot" | "beforeAppendToPageCallBack" | "zIndex" | "style" | "lightStyle" | "darkStyle" | "only"
74
74
  > {
75
75
  /**
76
76
  * 目标元素
@@ -59,5 +59,7 @@ export const PopsSearchSuggestionDefaultConfig = (): DeepRequired<PopsSearchSugg
59
59
  return data.filter((it) => it.value.includes(value));
60
60
  },
61
61
  style: "",
62
+ lightStyle: null,
63
+ darkStyle: null,
62
64
  };
63
65
  };
@@ -1,13 +1,14 @@
1
+ import { PopsCommonCSSClassName } from "../../config/CommonCSSClassName";
2
+ import { GlobalConfig } from "../../config/GlobalConfig";
3
+ import { PopsElementHandler } from "../../handler/PopsElementHandler";
1
4
  import { PopsHandler } from "../../handler/PopsHandler";
5
+ import { PopsCSS } from "../../PopsCSS";
6
+ import type { PopsType } from "../../types/main";
2
7
  import { popsDOMUtils } from "../../utils/PopsDOMUtils";
8
+ import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
3
9
  import { popsUtils } from "../../utils/PopsUtils";
4
10
  import { PopsSearchSuggestionDefaultConfig } from "./defaultConfig";
5
- import { GlobalConfig } from "../../config/GlobalConfig";
6
- import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
7
- import type { PopsSearchSuggestionData, PopsSearchSuggestionConfig } from "./types/index";
8
- import { PopsCSS } from "../../PopsCSS";
9
- import type { PopsType } from "../../types/main";
10
- import { PopsCommonCSSClassName } from "../../config/CommonCSSClassName";
11
+ import type { PopsSearchSuggestionConfig, PopsSearchSuggestionData } from "./types/index";
11
12
 
12
13
  export const PopsSearchSuggestion = {
13
14
  init<T>(__config__: PopsSearchSuggestionConfig<T>) {
@@ -39,13 +40,12 @@ export const PopsSearchSuggestion = {
39
40
  },
40
41
  ]);
41
42
 
42
- if (config.style != null) {
43
- const $css = popsDOMUtils.createElement("style", {
44
- type: "text/css",
45
- innerHTML: config.style,
46
- });
47
- $shadowRoot.appendChild($css);
48
- }
43
+ // 添加自定义style
44
+ PopsElementHandler.addStyle($shadowRoot, config.style);
45
+ // 添加自定义浅色style
46
+ PopsElementHandler.addLightStyle($shadowRoot, config.lightStyle);
47
+ // 添加自定义深色style
48
+ PopsElementHandler.addDarkStyle($shadowRoot, config.darkStyle);
49
49
  /**
50
50
  * 监听器的默认配置
51
51
  */
@@ -106,7 +106,7 @@ export type PopsSearchSuggestionData<T> = {
106
106
  */
107
107
  export interface PopsSearchSuggestionConfig<T = any> extends Pick<
108
108
  PopsGeneralConfig,
109
- "useShadowRoot" | "zIndex" | "style"
109
+ "useShadowRoot" | "zIndex" | "style" | "lightStyle" | "darkStyle"
110
110
  > {
111
111
  /**
112
112
  * 当前的环境,可以是document,可以是shadowroot,默认是document
@@ -28,6 +28,8 @@ export const PopsTooltipDefaultConfig = (): DeepRequired<PopsToolTipConfig> => {
28
28
  arrowDistance: 12.5,
29
29
  otherDistance: 0,
30
30
  style: "",
31
+ lightStyle: null,
32
+ darkStyle: null,
31
33
  beforeAppendToPageCallBack() {},
32
34
  };
33
35
  };
@@ -1,4 +1,5 @@
1
1
  import { GlobalConfig } from "../../config/GlobalConfig";
2
+ import { PopsElementHandler } from "../../handler/PopsElementHandler";
2
3
  import { PopsHandler } from "../../handler/PopsHandler";
3
4
  import { PopsCSS } from "../../PopsCSS";
4
5
  import type { PopsType } from "../../types/main";
@@ -85,14 +86,12 @@ export class ToolTip {
85
86
  popsDOMUtils.addClassName($toolTipContainer, this.$data.config.className);
86
87
  // 添加z-index
87
88
  $toolTipContainer.style.zIndex = PopsHandler.handleZIndex(this.$data.config.zIndex).toString();
88
- if (this.$data.config.style != null) {
89
- // 添加自定义style
90
- const cssNode = popsDOMUtils.createElement("style", {
91
- type: "text/css",
92
- innerHTML: this.$data.config.style,
93
- });
94
- $toolTipContainer.appendChild(cssNode);
95
- }
89
+ // 添加自定义style
90
+ PopsElementHandler.addStyle($toolTipContainer, this.$data.config.style);
91
+ // 添加自定义浅色style
92
+ PopsElementHandler.addLightStyle($toolTipContainer, this.$data.config.lightStyle);
93
+ // 添加自定义深色style
94
+ PopsElementHandler.addDarkStyle($toolTipContainer, this.$data.config.darkStyle);
96
95
  // 处理是否显示箭头元素
97
96
  if (!this.$data.config.showArrow) {
98
97
  $toolTipArrow.remove();
@@ -9,7 +9,7 @@ export type PopsTooltipPosition = "top" | "right" | "bottom" | "left" | "follow"
9
9
  */
10
10
  export interface PopsToolTipConfig extends Pick<
11
11
  PopsGeneralConfig,
12
- "useShadowRoot" | "only" | "zIndex" | "style" | "beforeAppendToPageCallBack"
12
+ "useShadowRoot" | "only" | "zIndex" | "style" | "lightStyle" | "darkStyle" | "beforeAppendToPageCallBack"
13
13
  > {
14
14
  /**
15
15
  * 目标元素