@whitesev/pops 3.3.0 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.amd.js +138 -46
- package/dist/index.amd.js.map +1 -1
- package/dist/index.amd.min.js +1 -1
- package/dist/index.amd.min.js.map +1 -1
- package/dist/index.cjs.js +138 -46
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +138 -46
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.iife.js +138 -46
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.system.js +138 -46
- package/dist/index.system.js.map +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/dist/index.umd.js +138 -46
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types/src/Pops.d.ts +6 -0
- package/dist/types/src/PopsCore.d.ts +1 -1
- package/dist/types/src/components/panel/handlerComponents.d.ts +8 -4
- package/dist/types/src/components/panel/types/components-switch.d.ts +12 -2
- package/dist/types/src/components/rightClickMenu/types/index.d.ts +1 -1
- package/dist/types/src/components/searchSuggestion/index.d.ts +1 -1
- package/dist/types/src/components/searchSuggestion/types/index.d.ts +1 -1
- package/dist/types/src/components/tooltip/index.d.ts +2 -0
- package/dist/types/src/components/tooltip/types/index.d.ts +1 -1
- package/dist/types/src/config/GlobalConfig.d.ts +2 -0
- package/dist/types/src/handler/PopsElementHandler.d.ts +13 -1
- package/dist/types/src/types/components.d.ts +12 -0
- package/dist/types/src/utils/PopsUtils.d.ts +8 -0
- package/package.json +4 -3
- package/src/PopsCore.ts +1 -1
- package/src/components/alert/defaultConfig.ts +2 -0
- package/src/components/alert/index.ts +2 -2
- package/src/components/confirm/defaultConfig.ts +2 -0
- package/src/components/drawer/defaultConfig.ts +2 -0
- package/src/components/folder/defaultConfig.ts +2 -0
- package/src/components/iframe/defaultConfig.ts +2 -0
- package/src/components/loading/defaultConfig.ts +2 -0
- package/src/components/panel/defaultConfig.ts +2 -0
- package/src/components/panel/handlerComponents.ts +38 -21
- package/src/components/panel/index.css +1 -0
- package/src/components/panel/types/components-switch.ts +12 -2
- package/src/components/prompt/defaultConfig.ts +2 -0
- package/src/components/rightClickMenu/defaultConfig.ts +2 -0
- package/src/components/rightClickMenu/index.ts +7 -12
- package/src/components/rightClickMenu/types/index.ts +1 -1
- package/src/components/searchSuggestion/defaultConfig.ts +2 -0
- package/src/components/searchSuggestion/index.ts +13 -13
- package/src/components/searchSuggestion/types/index.ts +1 -1
- package/src/components/tooltip/defaultConfig.ts +2 -0
- package/src/components/tooltip/index.ts +7 -8
- package/src/components/tooltip/types/index.ts +1 -1
- package/src/css/index.css +1 -0
- package/src/handler/PopsElementHandler.ts +64 -12
- package/src/handler/PopsHandler.ts +2 -2
- package/src/types/components.d.ts +12 -0
- package/src/utils/PopsUtils.ts +11 -1
package/dist/types/src/Pops.d.ts
CHANGED
|
@@ -100,6 +100,7 @@ declare class Pops {
|
|
|
100
100
|
formatTime(text?: string | number | Date, formatType?: "yyyy-MM-dd HH:mm:ss" | "yyyy/MM/dd HH:mm:ss" | "yyyy_MM_dd_HH_mm_ss" | "yyyy\u5E74MM\u6708dd\u65E5 HH\u65F6mm\u5206ss\u79D2" | "yyyy\u5E74MM\u6708dd\u65E5 hh:mm:ss" | "yyyy\u5E74MM\u6708dd\u65E5 HH:mm:ss" | "yyyy-MM-dd" | "yyyyMMdd" | "HH:mm:ss"): string;
|
|
101
101
|
formatByteToSize<T extends boolean>(byteSize: number | string, addType?: T | undefined): T extends true ? string : number;
|
|
102
102
|
AnyTouch: () => typeof import("any-touch").default;
|
|
103
|
+
AnyTouchDoubleTapPlugin: () => typeof import("@any-touch/doubletap").default;
|
|
103
104
|
isPhone(userAgent?: string): boolean;
|
|
104
105
|
setTimeout(callback: (...args: any[]) => any, timeout?: number): number;
|
|
105
106
|
clearTimeout(timeId: number | undefined): void;
|
|
@@ -284,6 +285,7 @@ declare class Pops {
|
|
|
284
285
|
init(): void;
|
|
285
286
|
onClick(): void;
|
|
286
287
|
setStatus(isChecked?: boolean): void;
|
|
288
|
+
getReverseStatus(): boolean;
|
|
287
289
|
getStatus(): boolean;
|
|
288
290
|
disable(): void;
|
|
289
291
|
notDisable(): void;
|
|
@@ -709,6 +711,8 @@ declare class Pops {
|
|
|
709
711
|
animation?: import("./types/animation").PopsAnimation | undefined;
|
|
710
712
|
mask?: import("./types/mask").PopsMaskConfig | undefined;
|
|
711
713
|
forbiddenScroll?: boolean | undefined;
|
|
714
|
+
lightStyle?: string | undefined;
|
|
715
|
+
darkStyle?: string | undefined;
|
|
712
716
|
beforeAppendToPageCallBack?: void;
|
|
713
717
|
drag?: boolean | undefined;
|
|
714
718
|
dragLimit?: boolean | undefined;
|
|
@@ -775,6 +779,8 @@ declare class Pops {
|
|
|
775
779
|
only: boolean;
|
|
776
780
|
zIndex: IFunction<number>;
|
|
777
781
|
style: string | null;
|
|
782
|
+
lightStyle: string | null;
|
|
783
|
+
darkStyle: string | null;
|
|
778
784
|
beforeAppendToPageCallBack: ($shadowRoot: ShadowRoot | HTMLElement, $shadowContainer: HTMLDivElement) => void;
|
|
779
785
|
};
|
|
780
786
|
$shadowContainer: HTMLDivElement;
|
|
@@ -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 {
|
|
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
|
-
*
|
|
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
|
-
|
|
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 {
|
|
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,
|
|
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 根元素
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import AnyTouch from "any-touch";
|
|
2
|
+
import doubletap from "@any-touch/doubletap";
|
|
2
3
|
declare class PopsUtils {
|
|
3
4
|
/**
|
|
4
5
|
* 判断是否是window,例如window、self、globalThis
|
|
@@ -112,7 +113,14 @@ declare class PopsUtils {
|
|
|
112
113
|
* > 793.27
|
|
113
114
|
**/
|
|
114
115
|
formatByteToSize<T extends boolean>(byteSize: number | string, addType?: T): T extends true ? string : number;
|
|
116
|
+
/**
|
|
117
|
+
* https://github.com/any86/any-touch/blob/master/README.CN.md
|
|
118
|
+
*/
|
|
115
119
|
AnyTouch: () => typeof AnyTouch;
|
|
120
|
+
/**
|
|
121
|
+
* `any-touch`的`doubletap`事件插件
|
|
122
|
+
*/
|
|
123
|
+
AnyTouchDoubleTapPlugin: () => typeof doubletap;
|
|
116
124
|
/**
|
|
117
125
|
* 通过navigator.userAgent判断是否是手机访问
|
|
118
126
|
* @param userAgent
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whitesev/pops",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"description": "弹窗库,包含了alert、confirm、prompt、drawer、folder、loading、iframe、panel、tooltip、searchSuggestion、rightClickMenu组件",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ScriptCat",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"registry": "https://registry.npmjs.org/"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
+
"@any-touch/doubletap": "^2.2.0",
|
|
43
44
|
"any-touch": "^2.2.0"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
@@ -56,8 +57,8 @@
|
|
|
56
57
|
"eslint-plugin-compat": "^6.0.2",
|
|
57
58
|
"eslint-plugin-prettier": "^5.5.4",
|
|
58
59
|
"globals": "^16.5.0",
|
|
59
|
-
"oxfmt": "^0.
|
|
60
|
-
"oxlint": "1.
|
|
60
|
+
"oxfmt": "^0.35.0",
|
|
61
|
+
"oxlint": "1.50.0",
|
|
61
62
|
"rollup": "^4.54.0",
|
|
62
63
|
"rollup-plugin-clear": "^2.0.7",
|
|
63
64
|
"rollup-plugin-import-css": "^4.1.2",
|
package/src/PopsCore.ts
CHANGED
|
@@ -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) {
|
|
@@ -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
|
|
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
|
-
|
|
399
|
-
|
|
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
|
-
|
|
404
|
-
|
|
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,
|
|
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
|
-
*
|
|
430
|
+
* 获取开/关的逆反状态
|
|
431
|
+
*/
|
|
432
|
+
getReverseStatus() {
|
|
433
|
+
return !this.getStatus();
|
|
434
|
+
},
|
|
435
|
+
/**
|
|
436
|
+
* 获取开/关的状态
|
|
424
437
|
*/
|
|
425
438
|
getStatus() {
|
|
426
439
|
let checkedValue = false;
|
|
427
|
-
if (
|
|
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
|
-
|
|
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
|
}
|
|
@@ -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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
* 目标元素
|
|
@@ -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 {
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|