@whitesev/pops 2.4.5 → 2.4.7
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/README.md +117 -111
- package/dist/index.amd.js +1248 -1287
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +1248 -1287
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1248 -1287
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +1248 -1287
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +1248 -1287
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +1248 -1287
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +9 -10
- package/dist/types/src/components/panel/types/components-common.d.ts +26 -26
- package/dist/types/src/components/panel/types/index.d.ts +1 -1
- package/dist/types/src/components/rightClickMenu/index.d.ts +3 -4
- package/dist/types/src/components/searchSuggestion/index.d.ts +2 -2
- package/dist/types/src/components/searchSuggestion/types/index.d.ts +2 -2
- package/dist/types/src/handler/PopsHandler.d.ts +3 -3
- package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +252 -256
- package/dist/types/src/types/animation.d.ts +19 -19
- package/dist/types/src/types/button.d.ts +187 -187
- package/dist/types/src/types/components.d.ts +210 -213
- package/dist/types/src/types/event.d.ts +63 -63
- package/dist/types/src/types/global.d.ts +25 -20
- package/dist/types/src/types/icon.d.ts +32 -32
- package/dist/types/src/types/inst.d.ts +24 -24
- package/dist/types/src/types/main.d.ts +111 -114
- package/dist/types/src/types/mask.d.ts +49 -49
- package/dist/types/src/types/position.d.ts +60 -60
- package/dist/types/src/utils/PopsDOMUtils.d.ts +1 -1
- package/dist/types/src/utils/PopsInstanceUtils.d.ts +1 -1
- package/dist/types/src/utils/PopsUtils.d.ts +16 -16
- package/index.ts +3 -0
- package/package.json +20 -9
- package/src/Pops.ts +206 -0
- package/src/PopsAnimation.ts +32 -0
- package/src/PopsCSS.ts +51 -0
- package/src/PopsCore.ts +64 -0
- package/src/PopsIcon.ts +95 -0
- package/src/PopsInst.ts +21 -0
- package/src/components/alert/config.ts +62 -0
- package/src/components/alert/index.css +0 -0
- package/src/components/alert/index.ts +163 -0
- package/src/components/alert/types/index.ts +23 -0
- package/src/components/confirm/config.ts +90 -0
- package/src/components/confirm/index.css +0 -0
- package/src/components/confirm/index.ts +166 -0
- package/src/components/confirm/types/index.ts +17 -0
- package/src/components/drawer/config.ts +89 -0
- package/src/components/drawer/index.css +37 -0
- package/src/components/drawer/index.ts +237 -0
- package/src/components/drawer/types/index.ts +61 -0
- package/src/components/folder/config.ts +147 -0
- package/src/components/folder/folderIcon.ts +28 -0
- package/src/components/folder/index.css +303 -0
- package/src/components/folder/index.ts +929 -0
- package/src/components/folder/types/index.ts +97 -0
- package/src/components/iframe/config.ts +60 -0
- package/src/components/iframe/index.css +76 -0
- package/src/components/iframe/index.ts +334 -0
- package/src/components/iframe/types/index.ts +139 -0
- package/src/components/loading/config.ts +29 -0
- package/src/components/loading/index.css +66 -0
- package/src/components/loading/index.ts +99 -0
- package/src/components/loading/types/index.ts +34 -0
- package/src/components/panel/config.ts +519 -0
- package/src/components/panel/handlerComponents.ts +2900 -0
- package/src/components/panel/index.css +1222 -0
- package/src/components/panel/index.ts +207 -0
- package/src/components/panel/types/components-button.ts +68 -0
- package/src/components/panel/types/components-common.ts +50 -0
- package/src/components/panel/types/components-deepMenu.ts +84 -0
- package/src/components/panel/types/components-forms.ts +44 -0
- package/src/components/panel/types/components-input.ts +78 -0
- package/src/components/panel/types/components-own.ts +30 -0
- package/src/components/panel/types/components-select.ts +93 -0
- package/src/components/panel/types/components-selectMultiple.ts +130 -0
- package/src/components/panel/types/components-slider.ts +77 -0
- package/src/components/panel/types/components-switch.ts +56 -0
- package/src/components/panel/types/components-textarea.ts +68 -0
- package/src/components/panel/types/index.ts +177 -0
- package/src/components/prompt/config.ts +94 -0
- package/src/components/prompt/index.css +34 -0
- package/src/components/prompt/index.ts +216 -0
- package/src/components/prompt/types/index.ts +55 -0
- package/src/components/rightClickMenu/config.ts +98 -0
- package/src/components/rightClickMenu/index.css +112 -0
- package/src/components/rightClickMenu/index.ts +602 -0
- package/src/components/rightClickMenu/types/index.ts +97 -0
- package/src/components/searchSuggestion/config.ts +56 -0
- package/src/components/searchSuggestion/index.ts +856 -0
- package/src/components/searchSuggestion/types/index.ts +239 -0
- package/src/components/tooltip/config.ts +34 -0
- package/src/components/tooltip/index.css +199 -0
- package/src/components/tooltip/index.ts +604 -0
- package/src/components/tooltip/types/index.ts +117 -0
- package/src/config/CommonCSSClassName.ts +17 -0
- package/src/config/GlobalConfig.ts +63 -0
- package/src/css/animation.css +987 -0
- package/src/css/button.css +551 -0
- package/src/css/common.css +48 -0
- package/src/css/index.css +253 -0
- package/src/css/ninePalaceGridPosition.css +50 -0
- package/src/css/scrollbar.css +22 -0
- package/src/handler/PopsElementHandler.ts +304 -0
- package/src/handler/PopsHandler.ts +589 -0
- package/src/svg/arrowLeft.svg +4 -0
- package/src/svg/arrowRight.svg +4 -0
- package/src/svg/chromeFilled.svg +11 -0
- package/src/svg/circleClose.svg +8 -0
- package/src/svg/close.svg +5 -0
- package/src/svg/cpu.svg +8 -0
- package/src/svg/delete.svg +5 -0
- package/src/svg/documentCopy.svg +5 -0
- package/src/svg/edit.svg +8 -0
- package/src/svg/eleme.svg +5 -0
- package/src/svg/elemePlus.svg +5 -0
- package/src/svg/headset.svg +5 -0
- package/src/svg/hide.svg +8 -0
- package/src/svg/keyboard.svg +8 -0
- package/src/svg/loading.svg +5 -0
- package/src/svg/max.svg +5 -0
- package/src/svg/min.svg +5 -0
- package/src/svg/mise.svg +5 -0
- package/src/svg/monitor.svg +5 -0
- package/src/svg/next.svg +5 -0
- package/src/svg/picture.svg +8 -0
- package/src/svg/prev.svg +5 -0
- package/src/svg/search.svg +5 -0
- package/src/svg/share.svg +5 -0
- package/src/svg/upload.svg +5 -0
- package/src/svg/videoPause.svg +5 -0
- package/src/svg/videoPlay.svg +5 -0
- package/src/svg/view.svg +5 -0
- package/src/types/PopsDOMUtilsEventType.d.ts +252 -0
- package/src/types/animation.d.ts +19 -0
- package/src/types/button.d.ts +187 -0
- package/src/types/components.d.ts +210 -0
- package/src/types/event.d.ts +63 -0
- package/src/types/global.d.ts +25 -0
- package/src/types/icon.d.ts +32 -0
- package/src/types/inst.d.ts +24 -0
- package/src/types/main.d.ts +111 -0
- package/src/types/mask.d.ts +49 -0
- package/src/types/position.d.ts +60 -0
- package/src/utils/PopsDOMUtils.ts +2408 -0
- package/src/utils/PopsDOMUtilsEventsConfig.ts +4 -0
- package/src/utils/PopsInstanceUtils.ts +688 -0
- package/src/utils/PopsMathUtils.ts +71 -0
- package/src/utils/PopsSafeUtils.ts +22 -0
- package/src/utils/PopsUtils.ts +406 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { PopsAlertDetails } from "../../alert/types";
|
|
2
|
+
import type { PopsPanelCommonDetails } from "./components-common";
|
|
3
|
+
|
|
4
|
+
export interface PopsPanelSelectMultipleDataOption<T> {
|
|
5
|
+
/**
|
|
6
|
+
* 真正的值
|
|
7
|
+
*/
|
|
8
|
+
value: T;
|
|
9
|
+
/**
|
|
10
|
+
* 显示的文字
|
|
11
|
+
*/
|
|
12
|
+
text:
|
|
13
|
+
| string
|
|
14
|
+
| ((
|
|
15
|
+
/** 当前的值 */
|
|
16
|
+
value: T,
|
|
17
|
+
/** 所有选中的配置信息 */
|
|
18
|
+
allSelectedInfo: PopsPanelSelectMultipleDataOption<T>[]
|
|
19
|
+
) => string);
|
|
20
|
+
/**
|
|
21
|
+
* 显示的文字是否是html
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
isHTML?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* (可选)是否禁用项
|
|
27
|
+
* 触发条件:
|
|
28
|
+
* + 点击select元素
|
|
29
|
+
* + select元素触发change事件
|
|
30
|
+
* @param value 当前的值
|
|
31
|
+
* @param allSelectedInfo 所有选中的配置信息
|
|
32
|
+
*/
|
|
33
|
+
disable?(value: T, allSelectedInfo: PopsPanelSelectMultipleDataOption<T>[]): boolean;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* pops.panel的 select
|
|
37
|
+
*/
|
|
38
|
+
export interface PopsPanelSelectMultipleDetails<T = any>
|
|
39
|
+
extends PopsPanelCommonDetails<PopsPanelSelectMultipleDetails> {
|
|
40
|
+
/**
|
|
41
|
+
* (可选)className属性
|
|
42
|
+
*/
|
|
43
|
+
className?: string;
|
|
44
|
+
/**
|
|
45
|
+
* (可选)自定义元素属性
|
|
46
|
+
*/
|
|
47
|
+
attributes?:
|
|
48
|
+
| {
|
|
49
|
+
[key: string]: any;
|
|
50
|
+
}
|
|
51
|
+
| {
|
|
52
|
+
[key: string]: any;
|
|
53
|
+
}[];
|
|
54
|
+
/**
|
|
55
|
+
* (可选)自定义属性
|
|
56
|
+
*/
|
|
57
|
+
props?: {
|
|
58
|
+
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* 显示在左边的文字
|
|
62
|
+
*/
|
|
63
|
+
text: string;
|
|
64
|
+
/**
|
|
65
|
+
* (可选)左边的文字下面的描述
|
|
66
|
+
*/
|
|
67
|
+
description?: string;
|
|
68
|
+
/**
|
|
69
|
+
* 类型
|
|
70
|
+
*/
|
|
71
|
+
type: "select-multiple";
|
|
72
|
+
/**
|
|
73
|
+
* (可选)是否禁用
|
|
74
|
+
*/
|
|
75
|
+
disabled?: boolean | (() => boolean);
|
|
76
|
+
/**
|
|
77
|
+
* 提示文字
|
|
78
|
+
*/
|
|
79
|
+
placeholder?: string | (() => string);
|
|
80
|
+
/**
|
|
81
|
+
* 获取该项的值的回调函数
|
|
82
|
+
*/
|
|
83
|
+
getValue(): T[];
|
|
84
|
+
/**
|
|
85
|
+
* 弹出的下拉列表弹窗的配置
|
|
86
|
+
*/
|
|
87
|
+
selectConfirmDialogDetails?: Partial<PopsAlertDetails>;
|
|
88
|
+
/**
|
|
89
|
+
* 选择器的值改变触发的回调函数
|
|
90
|
+
* @param event 事件
|
|
91
|
+
* @param isSelectedValue 当前选中的值,也就是元素属性上的__value__
|
|
92
|
+
* @param isSelectedText 当前选中的文本
|
|
93
|
+
*/
|
|
94
|
+
callback?(
|
|
95
|
+
/** 当前已选中的信息 */
|
|
96
|
+
isSelectedInfo: PopsPanelSelectMultipleDataOption<any>[]
|
|
97
|
+
): void;
|
|
98
|
+
/**
|
|
99
|
+
* 点击某个项的元素触发该回调
|
|
100
|
+
* @param event 点击事件
|
|
101
|
+
* @param selectElement 当前的选中的元素
|
|
102
|
+
* @returns 如果返回boolean为false,则不会触发默认的点击事件
|
|
103
|
+
*/
|
|
104
|
+
clickCallBack?(
|
|
105
|
+
event: PointerEvent | MouseEvent,
|
|
106
|
+
/** 当前已选中的信息 */
|
|
107
|
+
isSelectedInfo: PopsPanelSelectMultipleDataOption<any>[]
|
|
108
|
+
): void | boolean;
|
|
109
|
+
/**
|
|
110
|
+
* 点击标签tag的关闭图标触发该回调
|
|
111
|
+
* 如果返回boolean类型且为false,则阻止默认的事件
|
|
112
|
+
*/
|
|
113
|
+
closeIconClickCallBack?: (
|
|
114
|
+
event: PointerEvent | MouseEvent,
|
|
115
|
+
data: {
|
|
116
|
+
/** 标签元素 */
|
|
117
|
+
$tag: HTMLElement;
|
|
118
|
+
/** 关闭图标元素 */
|
|
119
|
+
$closeIcon: HTMLElement;
|
|
120
|
+
/** 值 */
|
|
121
|
+
value: T;
|
|
122
|
+
/** 显示的文字 */
|
|
123
|
+
text: PopsPanelSelectMultipleDataOption<T>["text"];
|
|
124
|
+
}
|
|
125
|
+
) => void | boolean;
|
|
126
|
+
/**
|
|
127
|
+
* 选择器内的数据组
|
|
128
|
+
*/
|
|
129
|
+
data: PopsPanelSelectMultipleDataOption<T>[];
|
|
130
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { PopsPanelCommonDetails } from "./components-common";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* pops.panel的 slider
|
|
5
|
+
*/
|
|
6
|
+
export interface PopsPanelSliderDetails extends PopsPanelCommonDetails<PopsPanelSliderDetails> {
|
|
7
|
+
/**
|
|
8
|
+
* className属性
|
|
9
|
+
* @default ""
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* 自定义元素属性
|
|
14
|
+
*/
|
|
15
|
+
attributes?:
|
|
16
|
+
| {
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}
|
|
19
|
+
| {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}[];
|
|
22
|
+
/**
|
|
23
|
+
* 自定义属性
|
|
24
|
+
*/
|
|
25
|
+
props?: {
|
|
26
|
+
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* 显示在左边的文字
|
|
30
|
+
*/
|
|
31
|
+
text: string;
|
|
32
|
+
/**
|
|
33
|
+
* (可选)左边的文字下面的描述
|
|
34
|
+
* @default ""
|
|
35
|
+
*/
|
|
36
|
+
description?: string;
|
|
37
|
+
/**
|
|
38
|
+
* 类型
|
|
39
|
+
* @default "slider"
|
|
40
|
+
*/
|
|
41
|
+
type: "slider";
|
|
42
|
+
/**
|
|
43
|
+
* (可选)是否禁用
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
disabled?: boolean | (() => boolean);
|
|
47
|
+
/**
|
|
48
|
+
* 是否显示滑块的hover提示
|
|
49
|
+
* @default true
|
|
50
|
+
*/
|
|
51
|
+
isShowHoverTip?: boolean | (() => boolean);
|
|
52
|
+
/**
|
|
53
|
+
* 获取该项的值的回调函数
|
|
54
|
+
*/
|
|
55
|
+
getValue(): number;
|
|
56
|
+
/**
|
|
57
|
+
* 滑块的值改变触发的回调函数
|
|
58
|
+
*/
|
|
59
|
+
callback(event: InputEvent, value: number): void;
|
|
60
|
+
/**
|
|
61
|
+
* 获取tooltip的提示内容,可自定义,默认为slider的值
|
|
62
|
+
*/
|
|
63
|
+
getToolTipContent?: (value: number) => string;
|
|
64
|
+
/**
|
|
65
|
+
* 滑块的最小值
|
|
66
|
+
*/
|
|
67
|
+
min: number;
|
|
68
|
+
/**
|
|
69
|
+
* 滑块的最大值
|
|
70
|
+
*/
|
|
71
|
+
max: number;
|
|
72
|
+
/**
|
|
73
|
+
* (可选)每次滑动的间隔值
|
|
74
|
+
* @default 1
|
|
75
|
+
*/
|
|
76
|
+
step?: number;
|
|
77
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { PopsPanelCommonDetails } from "./components-common";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* pops.panel的 switch
|
|
5
|
+
*/
|
|
6
|
+
export interface PopsPanelSwitchDetails extends PopsPanelCommonDetails<PopsPanelSwitchDetails> {
|
|
7
|
+
/**
|
|
8
|
+
* (可选)className属性
|
|
9
|
+
* @default ""
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* (可选)自定义元素属性
|
|
14
|
+
* @default {}
|
|
15
|
+
*/
|
|
16
|
+
attributes?:
|
|
17
|
+
| {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}
|
|
20
|
+
| {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}[];
|
|
23
|
+
/**
|
|
24
|
+
* (可选)自定义属性
|
|
25
|
+
* @default {}
|
|
26
|
+
*/
|
|
27
|
+
props?: {
|
|
28
|
+
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* 显示在左边的文字
|
|
32
|
+
*/
|
|
33
|
+
text: string;
|
|
34
|
+
/**
|
|
35
|
+
* (可选)左边的文字下面的描述
|
|
36
|
+
* @default ""
|
|
37
|
+
*/
|
|
38
|
+
description?: string;
|
|
39
|
+
/**
|
|
40
|
+
* 类型
|
|
41
|
+
*/
|
|
42
|
+
type: "switch";
|
|
43
|
+
/**
|
|
44
|
+
* (可选)是否禁用
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
disabled?: boolean | (() => boolean);
|
|
48
|
+
/**
|
|
49
|
+
* 获取该项的值的回调函数
|
|
50
|
+
*/
|
|
51
|
+
getValue(): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* switch开启/关闭触发的回调函数
|
|
54
|
+
*/
|
|
55
|
+
callback(event: MouseEvent | PointerEvent, value: boolean): void;
|
|
56
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { PopsPanelCommonDetails } from "./components-common";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* pops.panel的 textarea
|
|
5
|
+
*/
|
|
6
|
+
export interface PopsPanelTextAreaDetails extends PopsPanelCommonDetails<PopsPanelTextAreaDetails> {
|
|
7
|
+
/**
|
|
8
|
+
* (可选)className属性
|
|
9
|
+
* @default ""
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* (可选)自定义元素属性
|
|
14
|
+
* @default {}
|
|
15
|
+
*/
|
|
16
|
+
attributes?:
|
|
17
|
+
| {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}
|
|
20
|
+
| {
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}[];
|
|
23
|
+
/**
|
|
24
|
+
* (可选)自定义属性
|
|
25
|
+
* @default {}
|
|
26
|
+
*/
|
|
27
|
+
props?: {
|
|
28
|
+
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* 显示在左边的文字
|
|
32
|
+
*/
|
|
33
|
+
text: string;
|
|
34
|
+
/**
|
|
35
|
+
* (可选)左边的文字下面的描述
|
|
36
|
+
* @default ""
|
|
37
|
+
*/
|
|
38
|
+
description?: string;
|
|
39
|
+
/**
|
|
40
|
+
* 类型
|
|
41
|
+
*/
|
|
42
|
+
type: "textarea";
|
|
43
|
+
/**
|
|
44
|
+
* (可选)是否禁用
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
disabled?: boolean | (() => boolean);
|
|
48
|
+
/**
|
|
49
|
+
* 获取该项的值的回调函数
|
|
50
|
+
*/
|
|
51
|
+
getValue(): string;
|
|
52
|
+
/**
|
|
53
|
+
* textarea输入框的值改变触发的回调函数
|
|
54
|
+
* @param event 事件
|
|
55
|
+
* @param value 当前的textarea内的值
|
|
56
|
+
*/
|
|
57
|
+
callback(
|
|
58
|
+
event: InputEvent & {
|
|
59
|
+
target: HTMLTextAreaElement;
|
|
60
|
+
},
|
|
61
|
+
value: string
|
|
62
|
+
): void;
|
|
63
|
+
/**
|
|
64
|
+
* 输入框内的提示
|
|
65
|
+
* @default ""
|
|
66
|
+
*/
|
|
67
|
+
placeholder?: string;
|
|
68
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import type { PopsTitleConfig, PopsDragConfig, PopsCommonConfig } from "../../../types/components";
|
|
2
|
+
import type { PopsPanelFormsDetails } from "./components-forms";
|
|
3
|
+
import type { PopsPanelSwitchDetails } from "./components-switch";
|
|
4
|
+
import type { PopsPanelSliderDetails } from "./components-slider";
|
|
5
|
+
import type { PopsPanelInputDetails } from "./components-input";
|
|
6
|
+
import type { PopsPanelTextAreaDetails } from "./components-textarea";
|
|
7
|
+
import type { PopsPanelSelectDetails } from "./components-select";
|
|
8
|
+
import type { PopsPanelButtonDetails } from "./components-button";
|
|
9
|
+
import type { PopsPanelDeepMenuDetails } from "./components-deepMenu";
|
|
10
|
+
import type { PopsPanelOwnDetails } from "./components-own";
|
|
11
|
+
import type { PopsHeaderCloseButtonDetails } from "../../../types/button";
|
|
12
|
+
import type { PopsPanelSelectMultipleDetails } from "./components-selectMultiple";
|
|
13
|
+
|
|
14
|
+
/** panel的各种类型的配置项 */
|
|
15
|
+
export type PopsPanelFormsTotalDetails =
|
|
16
|
+
| PopsPanelSwitchDetails
|
|
17
|
+
| PopsPanelSliderDetails
|
|
18
|
+
| PopsPanelInputDetails
|
|
19
|
+
| PopsPanelTextAreaDetails
|
|
20
|
+
| PopsPanelSelectDetails<any>
|
|
21
|
+
| PopsPanelSelectMultipleDetails<any>
|
|
22
|
+
| PopsPanelButtonDetails
|
|
23
|
+
| PopsPanelDeepMenuDetails
|
|
24
|
+
| PopsPanelOwnDetails;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* panel的内部事件
|
|
28
|
+
*/
|
|
29
|
+
export type PopsPanelEventType = {
|
|
30
|
+
/**
|
|
31
|
+
* 该事件在右侧容器内的元素改变时触发
|
|
32
|
+
*/
|
|
33
|
+
"pops:renderRightContainer": {
|
|
34
|
+
/**
|
|
35
|
+
* 菜单配置
|
|
36
|
+
*/
|
|
37
|
+
formConfig: PopsPanelContentConfig[] | PopsPanelDeepMenuDetails;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* pops.panel的content配置信息
|
|
43
|
+
*/
|
|
44
|
+
export interface PopsPanelContentConfig {
|
|
45
|
+
/**
|
|
46
|
+
* 元素属性id
|
|
47
|
+
*/
|
|
48
|
+
id: string;
|
|
49
|
+
/**
|
|
50
|
+
* (可选)元素的className,值为空的话就不设置
|
|
51
|
+
* @default ""
|
|
52
|
+
*/
|
|
53
|
+
className?: string | string[];
|
|
54
|
+
/**
|
|
55
|
+
* 左侧的标题,可以是html格式
|
|
56
|
+
*/
|
|
57
|
+
title: string | (() => string);
|
|
58
|
+
/**
|
|
59
|
+
* (可选)中间顶部的标题,如果为空,则使用title的值代替
|
|
60
|
+
* @default title
|
|
61
|
+
*/
|
|
62
|
+
headerTitle?: string | (() => string);
|
|
63
|
+
/**
|
|
64
|
+
* (可选)是否是默认的,指打开弹窗的先显示出来的内容,默认为首位第一个项,如果多个配置都设置了isDefault的值为true,那么只有第一个值生效
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
isDefault?: boolean | (() => boolean);
|
|
68
|
+
/**
|
|
69
|
+
* (可选)是否是位于底部的
|
|
70
|
+
*
|
|
71
|
+
* 自上而下排序
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
74
|
+
isBottom?: boolean | (() => boolean);
|
|
75
|
+
/**
|
|
76
|
+
* (可选)是否禁用左侧项的hover的CSS样式
|
|
77
|
+
*/
|
|
78
|
+
disableAsideItemHoverCSS?: boolean | (() => boolean);
|
|
79
|
+
/**
|
|
80
|
+
* (可选)是否自动滚动到默认的项
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
83
|
+
scrollToDefaultView?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* (可选)自定义元素属性.setAttribute、.getAttribute
|
|
86
|
+
*/
|
|
87
|
+
attributes?:
|
|
88
|
+
| {
|
|
89
|
+
[key: string]: any;
|
|
90
|
+
}
|
|
91
|
+
| {
|
|
92
|
+
[key: string]: any;
|
|
93
|
+
}[];
|
|
94
|
+
/**
|
|
95
|
+
* (可选)自定义元素内部的属性值
|
|
96
|
+
*/
|
|
97
|
+
props?: {
|
|
98
|
+
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* 子配置
|
|
102
|
+
*/
|
|
103
|
+
forms: (PopsPanelFormsDetails | PopsPanelFormsTotalDetails)[];
|
|
104
|
+
/**
|
|
105
|
+
* 左侧容器的点击回调(点击后第一个触发该回调)
|
|
106
|
+
* @returns
|
|
107
|
+
* + false 阻止默认行为
|
|
108
|
+
*/
|
|
109
|
+
clickFirstCallback?: (
|
|
110
|
+
event: MouseEvent | PointerEvent,
|
|
111
|
+
rightHeaderElement: HTMLUListElement,
|
|
112
|
+
rightContainerElement: HTMLUListElement
|
|
113
|
+
) => void | boolean | Promise<void | boolean>;
|
|
114
|
+
/**
|
|
115
|
+
* 左侧容器的点击回调
|
|
116
|
+
* @returns
|
|
117
|
+
* + false 阻止默认进入菜单详情
|
|
118
|
+
*/
|
|
119
|
+
clickCallback?: (
|
|
120
|
+
event: MouseEvent | PointerEvent,
|
|
121
|
+
rightHeaderElement: HTMLUListElement,
|
|
122
|
+
rightContainerElement: HTMLUListElement
|
|
123
|
+
) => void | boolean | Promise<void | boolean>;
|
|
124
|
+
/**
|
|
125
|
+
* 左侧项添加到panel后的回调
|
|
126
|
+
*/
|
|
127
|
+
afterRender?: (
|
|
128
|
+
/**
|
|
129
|
+
* 配置
|
|
130
|
+
*/
|
|
131
|
+
data: {
|
|
132
|
+
/** 容器配置 */
|
|
133
|
+
asideConfig: PopsPanelContentConfig;
|
|
134
|
+
/** 左侧容器的元素 */
|
|
135
|
+
$asideLiElement: HTMLLIElement;
|
|
136
|
+
}
|
|
137
|
+
) => void;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* pops.panel
|
|
142
|
+
*/
|
|
143
|
+
export interface PopsPanelDetails extends PopsTitleConfig, PopsDragConfig, PopsCommonConfig {
|
|
144
|
+
/**
|
|
145
|
+
* 内容配置
|
|
146
|
+
*/
|
|
147
|
+
content: PopsPanelContentConfig[];
|
|
148
|
+
/**
|
|
149
|
+
* 右上角的按钮配置
|
|
150
|
+
*/
|
|
151
|
+
btn?: {
|
|
152
|
+
/**
|
|
153
|
+
* 关闭按钮
|
|
154
|
+
*/
|
|
155
|
+
close?: PopsHeaderCloseButtonDetails;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* 移动端适配的的className
|
|
159
|
+
*
|
|
160
|
+
* @default "pops-panel-is-mobile"
|
|
161
|
+
*/
|
|
162
|
+
mobileClassName?: string;
|
|
163
|
+
/**
|
|
164
|
+
* 是否强制是移动端,默认false
|
|
165
|
+
* + true 强制为移动端
|
|
166
|
+
* + false 自动根据UA判断是否是移动端
|
|
167
|
+
* @default false
|
|
168
|
+
*/
|
|
169
|
+
isMobile?: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* 是否使用深度菜单切换动画
|
|
172
|
+
*
|
|
173
|
+
* 如果浏览器不支持`document.startViewTransition`函数,那么即使使用`useDeepMenuSwtichAnimation`为true,那么不会使用动画
|
|
174
|
+
* @default true
|
|
175
|
+
*/
|
|
176
|
+
useDeepMenuSwtichAnimation?: true;
|
|
177
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { PopsPromptDetails } from "./types/index";
|
|
2
|
+
|
|
3
|
+
export const PopsPromptConfig = (): DeepRequired<PopsPromptDetails> => {
|
|
4
|
+
return {
|
|
5
|
+
title: {
|
|
6
|
+
text: "默认标题",
|
|
7
|
+
position: "left",
|
|
8
|
+
html: false,
|
|
9
|
+
style: "",
|
|
10
|
+
},
|
|
11
|
+
content: {
|
|
12
|
+
text: "",
|
|
13
|
+
select: false,
|
|
14
|
+
password: false,
|
|
15
|
+
row: false,
|
|
16
|
+
focus: true,
|
|
17
|
+
placeholder: "默认提示",
|
|
18
|
+
style: "",
|
|
19
|
+
},
|
|
20
|
+
btn: {
|
|
21
|
+
merge: false,
|
|
22
|
+
mergeReverse: false,
|
|
23
|
+
reverse: false,
|
|
24
|
+
position: "flex-end",
|
|
25
|
+
ok: {
|
|
26
|
+
enable: true,
|
|
27
|
+
size: void 0 as any,
|
|
28
|
+
icon: void 0 as any,
|
|
29
|
+
rightIcon: false,
|
|
30
|
+
iconIsLoading: false,
|
|
31
|
+
text: "确定",
|
|
32
|
+
type: "success",
|
|
33
|
+
callback(detail) {
|
|
34
|
+
detail.close();
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
cancel: {
|
|
38
|
+
enable: true,
|
|
39
|
+
size: void 0 as any,
|
|
40
|
+
icon: void 0 as any,
|
|
41
|
+
rightIcon: false,
|
|
42
|
+
iconIsLoading: false,
|
|
43
|
+
text: "关闭",
|
|
44
|
+
type: "default",
|
|
45
|
+
callback(detail) {
|
|
46
|
+
detail.close();
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
other: {
|
|
50
|
+
enable: false,
|
|
51
|
+
size: void 0 as any,
|
|
52
|
+
icon: void 0 as any,
|
|
53
|
+
rightIcon: false,
|
|
54
|
+
iconIsLoading: false,
|
|
55
|
+
text: "其它按钮",
|
|
56
|
+
type: "default",
|
|
57
|
+
callback(detail) {
|
|
58
|
+
detail.close();
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
close: {
|
|
62
|
+
enable: true,
|
|
63
|
+
callback(detail) {
|
|
64
|
+
detail.close();
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
useShadowRoot: true,
|
|
69
|
+
class: "",
|
|
70
|
+
only: false,
|
|
71
|
+
width: window.innerWidth < 550 ? "88vw" : "350px",
|
|
72
|
+
height: window.innerHeight < 450 ? "70vh" : "200px",
|
|
73
|
+
position: "center",
|
|
74
|
+
animation: "pops-anim-fadein-zoom",
|
|
75
|
+
zIndex: 10000,
|
|
76
|
+
mask: {
|
|
77
|
+
enable: false,
|
|
78
|
+
clickEvent: {
|
|
79
|
+
toClose: false,
|
|
80
|
+
toHide: false,
|
|
81
|
+
},
|
|
82
|
+
clickCallBack: null,
|
|
83
|
+
},
|
|
84
|
+
drag: false,
|
|
85
|
+
dragLimit: true,
|
|
86
|
+
dragExtraDistance: 3,
|
|
87
|
+
dragMoveCallBack() {},
|
|
88
|
+
dragEndCallBack() {},
|
|
89
|
+
forbiddenScroll: false,
|
|
90
|
+
|
|
91
|
+
style: null,
|
|
92
|
+
beforeAppendToPageCallBack() {},
|
|
93
|
+
};
|
|
94
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.pops[type-value="prompt"] {
|
|
2
|
+
--input-color: #000000;
|
|
3
|
+
--input-bg-color: none;
|
|
4
|
+
--input-placeholder-color: #a1a4ac;
|
|
5
|
+
}
|
|
6
|
+
.pops[type-value="prompt"] input[pops],
|
|
7
|
+
.pops[type-value="prompt"] textarea[pops] {
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: 100%;
|
|
10
|
+
outline: 0;
|
|
11
|
+
border: 0;
|
|
12
|
+
color: var(--input-color);
|
|
13
|
+
background-color: var(--input-bg-color);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.pops[type-value="prompt"] input[pops] {
|
|
17
|
+
padding: 5px 10px;
|
|
18
|
+
}
|
|
19
|
+
.pops[type-value="prompt"] textarea[pops] {
|
|
20
|
+
padding: 5px 10px;
|
|
21
|
+
resize: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.pops[type-value="prompt"] input[pops]::placeholder,
|
|
25
|
+
.pops[type-value="prompt"] textarea[pops]::placeholder {
|
|
26
|
+
color: var(--input-placeholder-color);
|
|
27
|
+
}
|
|
28
|
+
@media (prefers-color-scheme: dark) {
|
|
29
|
+
.pops[type-value="prompt"] {
|
|
30
|
+
--input-color: #ffffff;
|
|
31
|
+
--input-bg-color: #333333;
|
|
32
|
+
--input-placeholder-color: #8d9095;
|
|
33
|
+
}
|
|
34
|
+
}
|