@whitesev/pops 2.6.1 → 3.0.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.
- package/dist/index.amd.js +2513 -1534
- 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 +2513 -1534
- 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 +2513 -1534
- 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 +2513 -1534
- 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 +2513 -1534
- 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 +2513 -1534
- 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/eslint.config.d.mts +2 -0
- package/dist/types/src/Pops.d.ts +449 -103
- package/dist/types/src/PopsCSS.d.ts +3 -1
- package/dist/types/src/PopsIcon.d.ts +1 -1
- package/dist/types/src/PopsInst.d.ts +2 -2
- package/dist/types/src/components/alert/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/alert/index.d.ts +2 -2
- package/dist/types/src/components/alert/types/index.d.ts +4 -4
- package/dist/types/src/components/confirm/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/confirm/index.d.ts +2 -2
- package/dist/types/src/components/confirm/types/index.d.ts +2 -2
- package/dist/types/src/components/drawer/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/drawer/index.d.ts +2 -2
- package/dist/types/src/components/drawer/types/index.d.ts +2 -2
- package/dist/types/src/components/folder/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/folder/index.d.ts +2 -2
- package/dist/types/src/components/folder/types/index.d.ts +31 -7
- package/dist/types/src/components/iframe/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/iframe/index.d.ts +2 -5
- package/dist/types/src/components/iframe/types/index.d.ts +13 -42
- package/dist/types/src/components/loading/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/loading/index.d.ts +2 -2
- package/dist/types/src/components/loading/types/index.d.ts +4 -4
- package/dist/types/src/components/panel/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/panel/handlerComponents.d.ts +988 -49
- package/dist/types/src/components/panel/index.d.ts +2 -2
- package/dist/types/src/components/panel/types/components-button.d.ts +7 -6
- package/dist/types/src/components/panel/types/components-common.d.ts +7 -7
- package/dist/types/src/components/panel/types/components-container.d.ts +24 -0
- package/dist/types/src/components/panel/types/components-deepMenu.d.ts +14 -14
- package/dist/types/src/components/panel/types/components-input.d.ts +46 -21
- package/dist/types/src/components/panel/types/components-own.d.ts +5 -5
- package/dist/types/src/components/panel/types/components-select.d.ts +95 -36
- package/dist/types/src/components/panel/types/components-selectMultiple.d.ts +15 -20
- package/dist/types/src/components/panel/types/components-slider.d.ts +7 -8
- package/dist/types/src/components/panel/types/components-switch.d.ts +6 -6
- package/dist/types/src/components/panel/types/components-textarea.d.ts +6 -6
- package/dist/types/src/components/panel/types/index.d.ts +36 -28
- package/dist/types/src/components/prompt/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/prompt/index.d.ts +2 -2
- package/dist/types/src/components/prompt/types/index.d.ts +4 -3
- package/dist/types/src/components/rightClickMenu/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/rightClickMenu/index.d.ts +29 -27
- package/dist/types/src/components/rightClickMenu/types/index.d.ts +32 -11
- package/dist/types/src/components/searchSuggestion/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/searchSuggestion/index.d.ts +24 -9
- package/dist/types/src/components/searchSuggestion/types/index.d.ts +15 -13
- package/dist/types/src/components/tooltip/defaultConfig.d.ts +2 -0
- package/dist/types/src/components/tooltip/index.d.ts +6 -21
- package/dist/types/src/components/tooltip/types/index.d.ts +8 -6
- package/dist/types/src/config/GlobalConfig.d.ts +3 -3
- package/dist/types/src/handler/PopsElementHandler.d.ts +6 -6
- package/dist/types/src/handler/PopsHandler.d.ts +18 -18
- package/dist/types/src/types/button.d.ts +4 -97
- package/dist/types/src/types/components.d.ts +8 -8
- package/dist/types/src/types/event.d.ts +0 -30
- package/dist/types/src/types/global.d.ts +4 -0
- package/dist/types/src/types/inst.d.ts +5 -5
- package/dist/types/src/types/main.d.ts +35 -80
- package/dist/types/src/types/mask.d.ts +18 -15
- package/dist/types/src/utils/PopsInstanceUtils.d.ts +15 -15
- package/dist/types/src/utils/PopsUtils.d.ts +4 -0
- package/package.json +12 -12
- package/src/Pops.ts +44 -44
- package/src/PopsAnimation.ts +1 -1
- package/src/PopsCSS.ts +4 -1
- package/src/PopsInst.ts +2 -2
- package/src/components/alert/{config.ts → defaultConfig.ts} +7 -7
- package/src/components/alert/index.ts +16 -18
- package/src/components/alert/types/index.ts +4 -4
- package/src/components/confirm/{config.ts → defaultConfig.ts} +11 -11
- package/src/components/confirm/index.ts +11 -13
- package/src/components/confirm/types/index.ts +3 -3
- package/src/components/drawer/{config.ts → defaultConfig.ts} +10 -10
- package/src/components/drawer/index.ts +18 -17
- package/src/components/drawer/types/index.ts +3 -3
- package/src/components/folder/{config.ts → defaultConfig.ts} +22 -18
- package/src/components/folder/index.ts +61 -60
- package/src/components/folder/types/index.ts +31 -18
- package/src/components/iframe/{config.ts → defaultConfig.ts} +2 -2
- package/src/components/iframe/index.ts +24 -29
- package/src/components/iframe/types/index.ts +13 -56
- package/src/components/loading/{config.ts → defaultConfig.ts} +3 -3
- package/src/components/loading/index.ts +13 -11
- package/src/components/loading/types/index.ts +5 -5
- package/src/components/panel/css/components-select.css +84 -0
- package/src/components/panel/defaultConfig.ts +818 -0
- package/src/components/panel/handlerComponents.ts +1431 -762
- package/src/components/panel/index.css +90 -6
- package/src/components/panel/index.ts +15 -28
- package/src/components/panel/types/components-button.ts +7 -6
- package/src/components/panel/types/components-common.ts +7 -7
- package/src/components/panel/types/components-container.ts +25 -0
- package/src/components/panel/types/components-deepMenu.ts +14 -14
- package/src/components/panel/types/components-input.ts +56 -21
- package/src/components/panel/types/components-own.ts +5 -5
- package/src/components/panel/types/components-select.ts +100 -38
- package/src/components/panel/types/components-selectMultiple.ts +16 -22
- package/src/components/panel/types/components-slider.ts +7 -8
- package/src/components/panel/types/components-switch.ts +6 -6
- package/src/components/panel/types/components-textarea.ts +6 -6
- package/src/components/panel/types/index.ts +45 -38
- package/src/components/prompt/{config.ts → defaultConfig.ts} +10 -10
- package/src/components/prompt/index.ts +13 -15
- package/src/components/prompt/types/index.ts +4 -3
- package/src/components/rightClickMenu/{config.ts → defaultConfig.ts} +20 -19
- package/src/components/rightClickMenu/index.ts +125 -108
- package/src/components/rightClickMenu/types/index.ts +36 -14
- package/src/components/searchSuggestion/{config.ts → defaultConfig.ts} +18 -11
- package/src/components/searchSuggestion/index.ts +130 -155
- package/src/components/searchSuggestion/types/index.ts +17 -15
- package/src/components/tooltip/{config.ts → defaultConfig.ts} +5 -6
- package/src/components/tooltip/index.ts +21 -21
- package/src/components/tooltip/types/index.ts +9 -7
- package/src/config/GlobalConfig.ts +2 -2
- package/src/handler/PopsElementHandler.ts +29 -30
- package/src/handler/PopsHandler.ts +43 -43
- package/src/types/button.d.ts +4 -97
- package/src/types/components.d.ts +8 -8
- package/src/types/event.d.ts +0 -30
- package/src/types/global.d.ts +4 -0
- package/src/types/inst.d.ts +5 -5
- package/src/types/main.d.ts +35 -80
- package/src/types/mask.d.ts +18 -15
- package/src/utils/PopsDOMUtils.ts +34 -34
- package/src/utils/PopsInstanceUtils.ts +129 -139
- package/src/utils/PopsUtils.ts +60 -45
- package/dist/types/src/components/alert/config.d.ts +0 -2
- package/dist/types/src/components/confirm/config.d.ts +0 -2
- package/dist/types/src/components/drawer/config.d.ts +0 -2
- package/dist/types/src/components/folder/config.d.ts +0 -2
- package/dist/types/src/components/iframe/config.d.ts +0 -2
- package/dist/types/src/components/loading/config.d.ts +0 -2
- package/dist/types/src/components/panel/config.d.ts +0 -2
- package/dist/types/src/components/panel/types/components-forms.d.ts +0 -23
- package/dist/types/src/components/prompt/config.d.ts +0 -2
- package/dist/types/src/components/rightClickMenu/config.d.ts +0 -2
- package/dist/types/src/components/searchSuggestion/config.d.ts +0 -2
- package/dist/types/src/components/tooltip/config.d.ts +0 -2
- package/src/components/panel/config.ts +0 -530
- package/src/components/panel/types/components-forms.ts +0 -24
|
@@ -1,11 +1,77 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { PopsPanelGeneralConfig } from "./components-common";
|
|
2
|
+
import type { PopsPanelContainerConfig } from "./components-container";
|
|
3
|
+
import type { PopsPanelViewConfig } from ".";
|
|
4
|
+
import type { PopsAlertConfig } from "../../alert/types";
|
|
4
5
|
|
|
6
|
+
export interface PopsPanelSelectDataOption<T> {
|
|
7
|
+
/**
|
|
8
|
+
* 真正的值
|
|
9
|
+
*/
|
|
10
|
+
value: T;
|
|
11
|
+
/**
|
|
12
|
+
* 显示的文字
|
|
13
|
+
*/
|
|
14
|
+
text:
|
|
15
|
+
| string
|
|
16
|
+
| ((
|
|
17
|
+
/** 当前的值 */
|
|
18
|
+
value: T,
|
|
19
|
+
/**当前选中的配置信息 */
|
|
20
|
+
selectedInfo?: PopsPanelSelectDataOption<T>
|
|
21
|
+
) => string);
|
|
22
|
+
/**
|
|
23
|
+
* 显示的文字是否是html
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
isHTML?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* (可选)是否禁用项
|
|
29
|
+
* 触发条件:
|
|
30
|
+
* + 点击select元素
|
|
31
|
+
* + select元素触发change事件
|
|
32
|
+
* @param value 当前的值
|
|
33
|
+
* @param selectedInfo 当前选中的配置信息
|
|
34
|
+
*/
|
|
35
|
+
disable?(value: T, selectedInfo?: PopsPanelSelectDataOption<T>): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 子配置,跟随切换改变
|
|
38
|
+
*
|
|
39
|
+
* 选中项后,根据配置添加到页面中
|
|
40
|
+
*/
|
|
41
|
+
views?: IFunction<(PopsPanelContainerConfig | PopsPanelViewConfig)[]>;
|
|
42
|
+
/**
|
|
43
|
+
* (可选)是否是自定义输入的内容
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
addCustomInput?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* (可选)自定义输入内容存储的key
|
|
49
|
+
*
|
|
50
|
+
* 该属性内部未做处理,仅为传递作用
|
|
51
|
+
*/
|
|
52
|
+
customInputStoreKey?: string;
|
|
53
|
+
/**
|
|
54
|
+
* (可选)校验自定义输入内容
|
|
55
|
+
* @default () => {valid: true}
|
|
56
|
+
*/
|
|
57
|
+
onValid?(dataOption: PopsPanelSelectDataOption<T>): {
|
|
58
|
+
/**
|
|
59
|
+
*
|
|
60
|
+
* + true: 校验通过
|
|
61
|
+
* + false: 校验失败,阻止关闭弹窗
|
|
62
|
+
*/
|
|
63
|
+
valid: boolean;
|
|
64
|
+
message?: string;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
5
67
|
/**
|
|
6
68
|
* pops.panel的 select
|
|
7
69
|
*/
|
|
8
|
-
export interface
|
|
70
|
+
export interface PopsPanelSelectConfig<T = any> extends PopsPanelGeneralConfig<PopsPanelSelectConfig<T>> {
|
|
71
|
+
/**
|
|
72
|
+
* 组件类型
|
|
73
|
+
*/
|
|
74
|
+
type: "select";
|
|
9
75
|
/**
|
|
10
76
|
* 显示在左边的文字
|
|
11
77
|
*/
|
|
@@ -15,56 +81,52 @@ export interface PopsPanelSelectDetails<T = any> extends PopsPanelCommonDetails<
|
|
|
15
81
|
* @default ""
|
|
16
82
|
*/
|
|
17
83
|
description?: string;
|
|
18
|
-
/**
|
|
19
|
-
* 类型
|
|
20
|
-
*/
|
|
21
|
-
type: "select";
|
|
22
84
|
/**
|
|
23
85
|
* (可选)是否禁用
|
|
24
86
|
* @default false
|
|
25
87
|
*/
|
|
26
|
-
disabled?: boolean
|
|
88
|
+
disabled?: IFunction<boolean>;
|
|
89
|
+
/**
|
|
90
|
+
* 提示文字
|
|
91
|
+
*/
|
|
92
|
+
placeholder?: IFunction<string>;
|
|
93
|
+
/**
|
|
94
|
+
* 已选中文字的显示文字的对齐方式
|
|
95
|
+
*
|
|
96
|
+
* 也包括提示文字的对齐方式
|
|
97
|
+
* @default "left"
|
|
98
|
+
*/
|
|
99
|
+
selectedTextAlign?: "left" | "center" | "right";
|
|
27
100
|
/**
|
|
28
101
|
* 获取该项的值的回调函数
|
|
29
102
|
*/
|
|
30
103
|
getValue(): T;
|
|
31
104
|
/**
|
|
32
105
|
* 选择器的值改变触发的回调函数
|
|
33
|
-
* @param
|
|
34
|
-
* @param isSelectedValue 当前选中的值,也就是元素属性上的__value__
|
|
35
|
-
* @param isSelectedText 当前选中的文本
|
|
106
|
+
* @param isSelectedInfo 当前已选中的信息,可能为空
|
|
36
107
|
*/
|
|
37
|
-
callback?(
|
|
108
|
+
callback?(isSelectedInfo?: PopsPanelSelectDataOption<T>): void;
|
|
38
109
|
/**
|
|
39
110
|
* 点击select元素触发该回调
|
|
40
111
|
* @param event 点击事件
|
|
41
112
|
* @param selectElement 当前的select元素
|
|
42
113
|
*/
|
|
43
|
-
clickCallBack?(
|
|
114
|
+
clickCallBack?(
|
|
115
|
+
event: PointerEvent | MouseEvent,
|
|
116
|
+
/** 当前已选中的信息 */
|
|
117
|
+
isSelectedInfo: PopsPanelSelectDataOption<T>
|
|
118
|
+
): void | boolean;
|
|
44
119
|
/**
|
|
45
|
-
*
|
|
120
|
+
* 选择列表内的数据
|
|
46
121
|
*/
|
|
47
|
-
data:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
* (可选)是否禁用项
|
|
58
|
-
* 触发条件:
|
|
59
|
-
* + 点击select元素
|
|
60
|
-
* + select元素触发change事件
|
|
61
|
-
*/
|
|
62
|
-
disable?(value: T): boolean;
|
|
63
|
-
/**
|
|
64
|
-
* 子配置,跟随切换改变
|
|
65
|
-
*/
|
|
66
|
-
forms?:
|
|
67
|
-
| (PopsPanelFormsDetails | PopsPanelFormsTotalDetails)[]
|
|
68
|
-
| (() => (PopsPanelFormsDetails | PopsPanelFormsTotalDetails)[]);
|
|
69
|
-
}[];
|
|
122
|
+
data: IFunction<PopsPanelSelectDataOption<T>[]>;
|
|
123
|
+
/**
|
|
124
|
+
* 是否使用弹窗代替
|
|
125
|
+
* @default false
|
|
126
|
+
*/
|
|
127
|
+
useDialog?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* 弹出的下拉列表弹窗的配置
|
|
130
|
+
*/
|
|
131
|
+
selectConfirmDialogConfig?: Partial<PopsAlertConfig>;
|
|
70
132
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { PopsAlertConfig } from "../../alert/types";
|
|
2
|
+
import type { PopsPanelGeneralConfig } from "./components-common";
|
|
3
3
|
|
|
4
4
|
export interface PopsPanelSelectMultipleDataOption<T> {
|
|
5
5
|
/**
|
|
@@ -35,8 +35,12 @@ export interface PopsPanelSelectMultipleDataOption<T> {
|
|
|
35
35
|
/**
|
|
36
36
|
* pops.panel的 select
|
|
37
37
|
*/
|
|
38
|
-
export interface
|
|
39
|
-
extends
|
|
38
|
+
export interface PopsPanelSelectMultipleConfig<T = any>
|
|
39
|
+
extends PopsPanelGeneralConfig<PopsPanelSelectMultipleConfig<T>> {
|
|
40
|
+
/**
|
|
41
|
+
* 组件类型
|
|
42
|
+
*/
|
|
43
|
+
type: "select-multiple";
|
|
40
44
|
/**
|
|
41
45
|
* 显示在左边的文字
|
|
42
46
|
*/
|
|
@@ -45,10 +49,6 @@ export interface PopsPanelSelectMultipleDetails<T = any>
|
|
|
45
49
|
* (可选)左边的文字下面的描述
|
|
46
50
|
*/
|
|
47
51
|
description?: string;
|
|
48
|
-
/**
|
|
49
|
-
* 类型
|
|
50
|
-
*/
|
|
51
|
-
type: "select-multiple";
|
|
52
52
|
/**
|
|
53
53
|
* (可选)是否禁用
|
|
54
54
|
*/
|
|
@@ -61,30 +61,20 @@ export interface PopsPanelSelectMultipleDetails<T = any>
|
|
|
61
61
|
* 获取该项的值的回调函数
|
|
62
62
|
*/
|
|
63
63
|
getValue(): T[];
|
|
64
|
-
/**
|
|
65
|
-
* 弹出的下拉列表弹窗的配置
|
|
66
|
-
*/
|
|
67
|
-
selectConfirmDialogDetails?: Partial<PopsAlertDetails>;
|
|
68
64
|
/**
|
|
69
65
|
* 选择器的值改变触发的回调函数
|
|
70
|
-
* @param
|
|
71
|
-
* @param isSelectedValue 当前选中的值,也就是元素属性上的__value__
|
|
72
|
-
* @param isSelectedText 当前选中的文本
|
|
66
|
+
* @param isSelectedInfo 当前已选中的信息
|
|
73
67
|
*/
|
|
74
|
-
callback?(
|
|
75
|
-
/** 当前已选中的信息 */
|
|
76
|
-
isSelectedInfo: PopsPanelSelectMultipleDataOption<any>[]
|
|
77
|
-
): void;
|
|
68
|
+
callback?(isSelectedInfo: PopsPanelSelectMultipleDataOption<T>[]): void;
|
|
78
69
|
/**
|
|
79
70
|
* 点击某个项的元素触发该回调
|
|
80
71
|
* @param event 点击事件
|
|
81
|
-
* @param selectElement 当前的选中的元素
|
|
82
72
|
* @returns 如果返回boolean为false,则不会触发默认的点击事件
|
|
83
73
|
*/
|
|
84
74
|
clickCallBack?(
|
|
85
75
|
event: PointerEvent | MouseEvent,
|
|
86
76
|
/** 当前已选中的信息 */
|
|
87
|
-
isSelectedInfo: PopsPanelSelectMultipleDataOption<
|
|
77
|
+
isSelectedInfo: PopsPanelSelectMultipleDataOption<T>[]
|
|
88
78
|
): void | boolean;
|
|
89
79
|
/**
|
|
90
80
|
* 点击标签tag的关闭图标触发该回调
|
|
@@ -104,7 +94,11 @@ export interface PopsPanelSelectMultipleDetails<T = any>
|
|
|
104
94
|
}
|
|
105
95
|
) => void | boolean;
|
|
106
96
|
/**
|
|
107
|
-
*
|
|
97
|
+
* 选择列表内的数据
|
|
108
98
|
*/
|
|
109
99
|
data: PopsPanelSelectMultipleDataOption<T>[];
|
|
100
|
+
/**
|
|
101
|
+
* 弹出的下拉列表弹窗的配置
|
|
102
|
+
*/
|
|
103
|
+
selectConfirmDialogConfig?: Partial<PopsAlertConfig>;
|
|
110
104
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PopsPanelGeneralConfig } from "./components-common";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* pops.panel的 slider
|
|
5
5
|
*/
|
|
6
|
-
export interface
|
|
6
|
+
export interface PopsPanelSliderConfig extends PopsPanelGeneralConfig<PopsPanelSliderConfig> {
|
|
7
|
+
/**
|
|
8
|
+
* 组件类型
|
|
9
|
+
*/
|
|
10
|
+
type: "slider";
|
|
7
11
|
/**
|
|
8
12
|
* 显示在左边的文字
|
|
9
13
|
*/
|
|
@@ -13,11 +17,6 @@ export interface PopsPanelSliderDetails extends PopsPanelCommonDetails<PopsPanel
|
|
|
13
17
|
* @default ""
|
|
14
18
|
*/
|
|
15
19
|
description?: string;
|
|
16
|
-
/**
|
|
17
|
-
* 类型
|
|
18
|
-
* @default "slider"
|
|
19
|
-
*/
|
|
20
|
-
type: "slider";
|
|
21
20
|
/**
|
|
22
21
|
* (可选)是否禁用
|
|
23
22
|
* @default false
|
|
@@ -39,7 +38,7 @@ export interface PopsPanelSliderDetails extends PopsPanelCommonDetails<PopsPanel
|
|
|
39
38
|
/**
|
|
40
39
|
* 获取tooltip的提示内容,可自定义,默认为slider的值
|
|
41
40
|
*/
|
|
42
|
-
getToolTipContent
|
|
41
|
+
getToolTipContent?(value: number): string;
|
|
43
42
|
/**
|
|
44
43
|
* 滑块的最小值
|
|
45
44
|
*/
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PopsPanelGeneralConfig } from "./components-common";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* pops.panel的 switch
|
|
5
5
|
*/
|
|
6
|
-
export interface
|
|
6
|
+
export interface PopsPanelSwitchConfig extends PopsPanelGeneralConfig<PopsPanelSwitchConfig> {
|
|
7
|
+
/**
|
|
8
|
+
* 组件类型
|
|
9
|
+
*/
|
|
10
|
+
type: "switch";
|
|
7
11
|
/**
|
|
8
12
|
* 显示在左边的文字
|
|
9
13
|
*/
|
|
@@ -13,10 +17,6 @@ export interface PopsPanelSwitchDetails extends PopsPanelCommonDetails<PopsPanel
|
|
|
13
17
|
* @default ""
|
|
14
18
|
*/
|
|
15
19
|
description?: string;
|
|
16
|
-
/**
|
|
17
|
-
* 类型
|
|
18
|
-
*/
|
|
19
|
-
type: "switch";
|
|
20
20
|
/**
|
|
21
21
|
* (可选)是否禁用
|
|
22
22
|
* @default false
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PopsPanelGeneralConfig } from "./components-common";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* pops.panel的 textarea
|
|
5
5
|
*/
|
|
6
|
-
export interface
|
|
6
|
+
export interface PopsPanelTextAreaConfig extends PopsPanelGeneralConfig<PopsPanelTextAreaConfig> {
|
|
7
|
+
/**
|
|
8
|
+
* 组件类型
|
|
9
|
+
*/
|
|
10
|
+
type: "textarea";
|
|
7
11
|
/**
|
|
8
12
|
* 显示在左边的文字
|
|
9
13
|
*/
|
|
@@ -13,10 +17,6 @@ export interface PopsPanelTextAreaDetails extends PopsPanelCommonDetails<PopsPan
|
|
|
13
17
|
* @default ""
|
|
14
18
|
*/
|
|
15
19
|
description?: string;
|
|
16
|
-
/**
|
|
17
|
-
* 类型
|
|
18
|
-
*/
|
|
19
|
-
type: "textarea";
|
|
20
20
|
/**
|
|
21
21
|
* (可选)是否禁用
|
|
22
22
|
* @default false
|
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
import type { PopsTitleConfig, PopsDragConfig,
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
12
|
-
import type {
|
|
13
|
-
import type {
|
|
14
|
-
|
|
15
|
-
/** panel的各种类型的配置项 */
|
|
16
|
-
export type PopsPanelFormsTotalDetails =
|
|
17
|
-
| PopsPanelSwitchDetails
|
|
18
|
-
| PopsPanelSliderDetails
|
|
19
|
-
| PopsPanelInputDetails
|
|
20
|
-
| PopsPanelTextAreaDetails
|
|
21
|
-
| PopsPanelSelectDetails<any>
|
|
22
|
-
| PopsPanelSelectMultipleDetails<any>
|
|
23
|
-
| PopsPanelButtonDetails
|
|
24
|
-
| PopsPanelDeepMenuDetails
|
|
25
|
-
| PopsPanelOwnDetails;
|
|
1
|
+
import type { PopsTitleConfig, PopsDragConfig, PopsGeneralConfig } from "../../../types/components";
|
|
2
|
+
import type { PopsPanelContainerConfig } from "./components-container";
|
|
3
|
+
import type { PopsPanelSwitchConfig } from "./components-switch";
|
|
4
|
+
import type { PopsPanelSliderConfig } from "./components-slider";
|
|
5
|
+
import type { PopsPanelInputConfig } from "./components-input";
|
|
6
|
+
import type { PopsPanelTextAreaConfig } from "./components-textarea";
|
|
7
|
+
import type { PopsPanelSelectConfig } from "./components-select";
|
|
8
|
+
import type { PopsPanelButtonConfig } from "./components-button";
|
|
9
|
+
import type { PopsPanelDeepViewConfig } from "./components-deepMenu";
|
|
10
|
+
import type { PopsPanelOwnConfig } from "./components-own";
|
|
11
|
+
import type { PopsHeaderCloseButtonConfig } from "../../../types/button";
|
|
12
|
+
import type { PopsPanelSelectMultipleConfig } from "./components-selectMultiple";
|
|
13
|
+
import type { PopsPanelGeneralConfig } from "./components-common";
|
|
26
14
|
|
|
15
|
+
/**
|
|
16
|
+
* panel的各种类型的配置项(不包括type="container"类型的)
|
|
17
|
+
*/
|
|
18
|
+
export type PopsPanelViewConfig =
|
|
19
|
+
| PopsPanelSwitchConfig
|
|
20
|
+
| PopsPanelSliderConfig
|
|
21
|
+
| PopsPanelInputConfig
|
|
22
|
+
| PopsPanelTextAreaConfig
|
|
23
|
+
| PopsPanelSelectConfig<any>
|
|
24
|
+
| PopsPanelSelectMultipleConfig<any>
|
|
25
|
+
| PopsPanelButtonConfig
|
|
26
|
+
| PopsPanelDeepViewConfig
|
|
27
|
+
| PopsPanelOwnConfig;
|
|
28
|
+
/**
|
|
29
|
+
* panel的views配置项
|
|
30
|
+
*/
|
|
31
|
+
export type PopsPanelMainViewConfig = PopsPanelViewConfig | PopsPanelContainerConfig;
|
|
27
32
|
/**
|
|
28
33
|
* panel的内部事件
|
|
29
34
|
*/
|
|
@@ -33,9 +38,9 @@ export type PopsPanelEventType = {
|
|
|
33
38
|
*/
|
|
34
39
|
"pops:renderRightContainer": {
|
|
35
40
|
/**
|
|
36
|
-
*
|
|
41
|
+
* 视图配置
|
|
37
42
|
*/
|
|
38
|
-
|
|
43
|
+
viewConfig: PopsPanelContentConfig[] | PopsPanelDeepViewConfig;
|
|
39
44
|
};
|
|
40
45
|
};
|
|
41
46
|
|
|
@@ -51,7 +56,7 @@ export interface PopsPanelContentConfig {
|
|
|
51
56
|
* (可选)元素的className,值为空的话就不设置
|
|
52
57
|
* @default ""
|
|
53
58
|
*/
|
|
54
|
-
className?:
|
|
59
|
+
className?: PopsPanelGeneralConfig<any>["className"];
|
|
55
60
|
/**
|
|
56
61
|
* 显示的文本,可以是html格式
|
|
57
62
|
*/
|
|
@@ -84,16 +89,18 @@ export interface PopsPanelContentConfig {
|
|
|
84
89
|
scrollToDefaultView?: boolean;
|
|
85
90
|
/**
|
|
86
91
|
* (可选)自定义元素属性.setAttribute、.getAttribute
|
|
92
|
+
* @default {}
|
|
87
93
|
*/
|
|
88
|
-
attributes?:
|
|
94
|
+
attributes?: PopsPanelGeneralConfig<any>["attributes"];
|
|
89
95
|
/**
|
|
90
96
|
* (可选)自定义元素内部的属性值
|
|
97
|
+
* @default {}
|
|
91
98
|
*/
|
|
92
|
-
props?:
|
|
99
|
+
props?: PopsPanelGeneralConfig<any>["props"];
|
|
93
100
|
/**
|
|
94
|
-
*
|
|
101
|
+
* 视图配置
|
|
95
102
|
*/
|
|
96
|
-
|
|
103
|
+
views: PopsPanelMainViewConfig[];
|
|
97
104
|
/**
|
|
98
105
|
* 左侧容器的点击回调(点击后第一个触发该回调)
|
|
99
106
|
* @returns
|
|
@@ -138,7 +145,7 @@ export interface PopsPanelBottomContentConfig {
|
|
|
138
145
|
* (可选)元素的className,值为空的话就不设置
|
|
139
146
|
* @default ""
|
|
140
147
|
*/
|
|
141
|
-
className?:
|
|
148
|
+
className?: PopsPanelGeneralConfig<any>["className"];
|
|
142
149
|
/**
|
|
143
150
|
* (可选)配置所在位置
|
|
144
151
|
*
|
|
@@ -158,12 +165,12 @@ export interface PopsPanelBottomContentConfig {
|
|
|
158
165
|
* (可选)自定义元素属性.setAttribute、.getAttribute
|
|
159
166
|
* @default {}
|
|
160
167
|
*/
|
|
161
|
-
attributes?:
|
|
168
|
+
attributes?: PopsPanelGeneralConfig<any>["attributes"];
|
|
162
169
|
/**
|
|
163
170
|
* (可选)自定义元素内部的属性值
|
|
164
171
|
* @default {}
|
|
165
172
|
*/
|
|
166
|
-
props?:
|
|
173
|
+
props?: PopsPanelGeneralConfig<any>["props"];
|
|
167
174
|
/**
|
|
168
175
|
* 该项的点击回调
|
|
169
176
|
*/
|
|
@@ -196,7 +203,7 @@ export interface PopsPanelBottomContentConfig {
|
|
|
196
203
|
/**
|
|
197
204
|
* pops.panel
|
|
198
205
|
*/
|
|
199
|
-
export interface
|
|
206
|
+
export interface PopsPanelConfig extends PopsTitleConfig, PopsDragConfig, PopsGeneralConfig {
|
|
200
207
|
/**
|
|
201
208
|
* 内容配置
|
|
202
209
|
*/
|
|
@@ -212,14 +219,14 @@ export interface PopsPanelDetails extends PopsTitleConfig, PopsDragConfig, PopsC
|
|
|
212
219
|
/**
|
|
213
220
|
* 关闭按钮
|
|
214
221
|
*/
|
|
215
|
-
close?:
|
|
222
|
+
close?: PopsHeaderCloseButtonConfig;
|
|
216
223
|
};
|
|
217
224
|
/**
|
|
218
225
|
* 移动端适配的的className
|
|
219
226
|
*
|
|
220
227
|
* @default "pops-panel-is-mobile"
|
|
221
228
|
*/
|
|
222
|
-
mobileClassName?:
|
|
229
|
+
mobileClassName?: PopsPanelGeneralConfig<any>["className"];
|
|
223
230
|
/**
|
|
224
231
|
* 是否强制是移动端,默认false
|
|
225
232
|
* + true 强制为移动端
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PopsPromptConfig } from "./types/index";
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const PopsPromptDefaultConfig = (): DeepRequired<PopsPromptConfig> => {
|
|
4
4
|
return {
|
|
5
5
|
title: {
|
|
6
6
|
text: "默认标题",
|
|
@@ -30,8 +30,8 @@ export const PopsPromptConfig = (): DeepRequired<PopsPromptDetails> => {
|
|
|
30
30
|
iconIsLoading: false,
|
|
31
31
|
text: "确定",
|
|
32
32
|
type: "success",
|
|
33
|
-
callback(
|
|
34
|
-
|
|
33
|
+
callback(eventConfig) {
|
|
34
|
+
eventConfig.close();
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
37
|
cancel: {
|
|
@@ -42,8 +42,8 @@ export const PopsPromptConfig = (): DeepRequired<PopsPromptDetails> => {
|
|
|
42
42
|
iconIsLoading: false,
|
|
43
43
|
text: "关闭",
|
|
44
44
|
type: "default",
|
|
45
|
-
callback(
|
|
46
|
-
|
|
45
|
+
callback(eventConfig) {
|
|
46
|
+
eventConfig.close();
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
other: {
|
|
@@ -54,14 +54,14 @@ export const PopsPromptConfig = (): DeepRequired<PopsPromptDetails> => {
|
|
|
54
54
|
iconIsLoading: false,
|
|
55
55
|
text: "其它按钮",
|
|
56
56
|
type: "default",
|
|
57
|
-
callback(
|
|
58
|
-
|
|
57
|
+
callback(eventConfig) {
|
|
58
|
+
eventConfig.close();
|
|
59
59
|
},
|
|
60
60
|
},
|
|
61
61
|
close: {
|
|
62
62
|
enable: true,
|
|
63
|
-
callback(
|
|
64
|
-
|
|
63
|
+
callback(eventConfig) {
|
|
64
|
+
eventConfig.close();
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
},
|
|
@@ -6,18 +6,18 @@ import type { PopsType } from "../../types/main";
|
|
|
6
6
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
7
7
|
import { PopsInstanceUtils } from "../../utils/PopsInstanceUtils";
|
|
8
8
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
9
|
-
import {
|
|
10
|
-
import type {
|
|
9
|
+
import { PopsPromptDefaultConfig } from "./defaultConfig";
|
|
10
|
+
import type { PopsPromptConfig } from "./types/index";
|
|
11
11
|
|
|
12
12
|
export const PopsPrompt = {
|
|
13
|
-
init(
|
|
13
|
+
init(__config__: PopsPromptConfig) {
|
|
14
14
|
const guid = popsUtils.getRandomGUID();
|
|
15
15
|
// 设置当前类型
|
|
16
16
|
const popsType: PopsType = "prompt";
|
|
17
17
|
|
|
18
|
-
let config =
|
|
18
|
+
let config = PopsPromptDefaultConfig();
|
|
19
19
|
config = popsUtils.assign(config, GlobalConfig.getGlobalConfig());
|
|
20
|
-
config = popsUtils.assign(config,
|
|
20
|
+
config = popsUtils.assign(config, __config__);
|
|
21
21
|
config = PopsHandler.handleOnly(popsType, config);
|
|
22
22
|
|
|
23
23
|
const { $shadowContainer, $shadowRoot } = PopsHandler.handlerShadow(config);
|
|
@@ -133,7 +133,7 @@ export const PopsPrompt = {
|
|
|
133
133
|
$pops,
|
|
134
134
|
$mask
|
|
135
135
|
);
|
|
136
|
-
|
|
136
|
+
// 输入框赋值初始值
|
|
137
137
|
|
|
138
138
|
$input.value = config.content.text;
|
|
139
139
|
PopsHandler.handlePromptClickEvent(
|
|
@@ -170,7 +170,7 @@ export const PopsPrompt = {
|
|
|
170
170
|
|
|
171
171
|
config.btn.other.callback
|
|
172
172
|
);
|
|
173
|
-
|
|
173
|
+
// 创建到页面中
|
|
174
174
|
|
|
175
175
|
popsDOMUtils.append($shadowRoot, $elList);
|
|
176
176
|
if (typeof config.beforeAppendToPageCallBack === "function") {
|
|
@@ -183,15 +183,13 @@ export const PopsPrompt = {
|
|
|
183
183
|
}
|
|
184
184
|
PopsHandler.handlePush(popsType, {
|
|
185
185
|
guid: guid,
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
maskElement: $mask!,
|
|
186
|
+
$anim: $anim,
|
|
187
|
+
$pops: $pops!,
|
|
188
|
+
$mask: $mask!,
|
|
191
189
|
$shadowContainer: $shadowContainer,
|
|
192
190
|
$shadowRoot: $shadowRoot,
|
|
193
191
|
});
|
|
194
|
-
|
|
192
|
+
// 拖拽
|
|
195
193
|
if (config.drag) {
|
|
196
194
|
PopsInstanceUtils.drag($pops!, {
|
|
197
195
|
dragElement: $title!,
|
|
@@ -201,11 +199,11 @@ export const PopsPrompt = {
|
|
|
201
199
|
endCallBack: config.dragEndCallBack,
|
|
202
200
|
});
|
|
203
201
|
}
|
|
204
|
-
|
|
202
|
+
// 设置自动获取焦点
|
|
205
203
|
if (config.content.focus) {
|
|
206
204
|
$input.focus();
|
|
207
205
|
}
|
|
208
|
-
|
|
206
|
+
// 设置自动选中所有文字
|
|
209
207
|
if (config.content.select) {
|
|
210
208
|
$input.select();
|
|
211
209
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
PopsTitleConfig,
|
|
3
3
|
PopsDragConfig,
|
|
4
|
-
|
|
4
|
+
PopsGeneralConfig,
|
|
5
5
|
PopsMoreButtonConfig,
|
|
6
6
|
} from "../../../types/components";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* pops.prompt
|
|
10
10
|
*/
|
|
11
|
-
export interface
|
|
11
|
+
export interface PopsPromptConfig
|
|
12
12
|
extends PopsTitleConfig,
|
|
13
13
|
PopsDragConfig,
|
|
14
14
|
PopsMoreButtonConfig<{
|
|
15
15
|
text: string;
|
|
16
16
|
}>,
|
|
17
|
-
|
|
17
|
+
PopsGeneralConfig {
|
|
18
18
|
/**
|
|
19
19
|
* 内容配置
|
|
20
20
|
*/
|
|
@@ -49,6 +49,7 @@ export interface PopsPromptDetails
|
|
|
49
49
|
placeholder?: string;
|
|
50
50
|
/**
|
|
51
51
|
* (可选)文字的自定义CSS
|
|
52
|
+
* @default ""
|
|
52
53
|
*/
|
|
53
54
|
style?: string;
|
|
54
55
|
};
|