@whitesev/pops 2.2.2 → 2.2.3
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 +19 -6
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +19 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +19 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +19 -6
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +19 -6
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +19 -6
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/components/panel/types/components-input.d.ts +9 -1
- package/dist/types/src/components/panel/types/components-select.d.ts +6 -1
- package/dist/types/src/components/panel/types/components-switch.d.ts +6 -1
- package/dist/types/src/components/panel/types/components-textarea.d.ts +8 -2
- package/package.json +1 -1
- package/src/Pops.ts +1 -1
- package/src/components/panel/handlerComponents.ts +25 -6
- package/src/components/panel/types/components-input.ts +9 -1
- package/src/components/panel/types/components-select.ts +6 -1
- package/src/components/panel/types/components-switch.ts +6 -1
- package/src/components/panel/types/components-textarea.ts +8 -2
|
@@ -5,10 +5,12 @@ import type { PopsPanelCommonDetails } from "./components-common";
|
|
|
5
5
|
export interface PopsPanelInputDetails extends PopsPanelCommonDetails<PopsPanelInputDetails> {
|
|
6
6
|
/**
|
|
7
7
|
* (可选)className属性
|
|
8
|
+
* @default ""
|
|
8
9
|
*/
|
|
9
10
|
className?: string;
|
|
10
11
|
/**
|
|
11
12
|
* (可选)自定义元素属性
|
|
13
|
+
* @default {}
|
|
12
14
|
*/
|
|
13
15
|
attributes?: {
|
|
14
16
|
[key: string]: any;
|
|
@@ -17,6 +19,7 @@ export interface PopsPanelInputDetails extends PopsPanelCommonDetails<PopsPanelI
|
|
|
17
19
|
}[];
|
|
18
20
|
/**
|
|
19
21
|
* (可选)自定义属性
|
|
22
|
+
* @default {}
|
|
20
23
|
*/
|
|
21
24
|
props?: {
|
|
22
25
|
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
@@ -27,6 +30,7 @@ export interface PopsPanelInputDetails extends PopsPanelCommonDetails<PopsPanelI
|
|
|
27
30
|
text: string;
|
|
28
31
|
/**
|
|
29
32
|
* (可选)左边的文字下面的描述
|
|
33
|
+
* @default ""
|
|
30
34
|
*/
|
|
31
35
|
description?: string;
|
|
32
36
|
/**
|
|
@@ -35,8 +39,9 @@ export interface PopsPanelInputDetails extends PopsPanelCommonDetails<PopsPanelI
|
|
|
35
39
|
type: "input";
|
|
36
40
|
/**
|
|
37
41
|
* (可选)是否禁用
|
|
42
|
+
* @default false
|
|
38
43
|
*/
|
|
39
|
-
disabled?: boolean;
|
|
44
|
+
disabled?: boolean | (() => boolean);
|
|
40
45
|
/**
|
|
41
46
|
* 获取该项的值的回调函数
|
|
42
47
|
*/
|
|
@@ -50,14 +55,17 @@ export interface PopsPanelInputDetails extends PopsPanelCommonDetails<PopsPanelI
|
|
|
50
55
|
callback(event: InputEvent, value: string, valueAsNumber?: number): void;
|
|
51
56
|
/**
|
|
52
57
|
* (可选)输入框内的提示
|
|
58
|
+
* @default ""
|
|
53
59
|
*/
|
|
54
60
|
placeholder?: string;
|
|
55
61
|
/**
|
|
56
62
|
* (可选)是否是密码框
|
|
63
|
+
* @default false
|
|
57
64
|
*/
|
|
58
65
|
isPassword?: boolean;
|
|
59
66
|
/**
|
|
60
67
|
* (可选)是否是数字框
|
|
68
|
+
* @default false
|
|
61
69
|
*/
|
|
62
70
|
isNumber?: boolean;
|
|
63
71
|
/**
|
|
@@ -7,10 +7,12 @@ import type { PopsPanelFormsTotalDetails } from ".";
|
|
|
7
7
|
export interface PopsPanelSelectDetails<T = any> extends PopsPanelCommonDetails<PopsPanelSelectDetails> {
|
|
8
8
|
/**
|
|
9
9
|
* (可选)className属性
|
|
10
|
+
* @default ""
|
|
10
11
|
*/
|
|
11
12
|
className?: string;
|
|
12
13
|
/**
|
|
13
14
|
* (可选)自定义元素属性
|
|
15
|
+
* @default {}
|
|
14
16
|
*/
|
|
15
17
|
attributes?: {
|
|
16
18
|
[key: string]: any;
|
|
@@ -19,6 +21,7 @@ export interface PopsPanelSelectDetails<T = any> extends PopsPanelCommonDetails<
|
|
|
19
21
|
}[];
|
|
20
22
|
/**
|
|
21
23
|
* (可选)自定义属性
|
|
24
|
+
* @default {}
|
|
22
25
|
*/
|
|
23
26
|
props?: {
|
|
24
27
|
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
@@ -29,6 +32,7 @@ export interface PopsPanelSelectDetails<T = any> extends PopsPanelCommonDetails<
|
|
|
29
32
|
text: string;
|
|
30
33
|
/**
|
|
31
34
|
* (可选)左边的文字下面的描述
|
|
35
|
+
* @default ""
|
|
32
36
|
*/
|
|
33
37
|
description?: string;
|
|
34
38
|
/**
|
|
@@ -37,8 +41,9 @@ export interface PopsPanelSelectDetails<T = any> extends PopsPanelCommonDetails<
|
|
|
37
41
|
type: "select";
|
|
38
42
|
/**
|
|
39
43
|
* (可选)是否禁用
|
|
44
|
+
* @default false
|
|
40
45
|
*/
|
|
41
|
-
disabled?: boolean;
|
|
46
|
+
disabled?: boolean | (() => boolean);
|
|
42
47
|
/**
|
|
43
48
|
* 获取该项的值的回调函数
|
|
44
49
|
*/
|
|
@@ -5,10 +5,12 @@ import type { PopsPanelCommonDetails } from "./components-common";
|
|
|
5
5
|
export interface PopsPanelSwitchDetails extends PopsPanelCommonDetails<PopsPanelSwitchDetails> {
|
|
6
6
|
/**
|
|
7
7
|
* (可选)className属性
|
|
8
|
+
* @default ""
|
|
8
9
|
*/
|
|
9
10
|
className?: string;
|
|
10
11
|
/**
|
|
11
12
|
* (可选)自定义元素属性
|
|
13
|
+
* @default {}
|
|
12
14
|
*/
|
|
13
15
|
attributes?: {
|
|
14
16
|
[key: string]: any;
|
|
@@ -17,6 +19,7 @@ export interface PopsPanelSwitchDetails extends PopsPanelCommonDetails<PopsPanel
|
|
|
17
19
|
}[];
|
|
18
20
|
/**
|
|
19
21
|
* (可选)自定义属性
|
|
22
|
+
* @default {}
|
|
20
23
|
*/
|
|
21
24
|
props?: {
|
|
22
25
|
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
@@ -27,6 +30,7 @@ export interface PopsPanelSwitchDetails extends PopsPanelCommonDetails<PopsPanel
|
|
|
27
30
|
text: string;
|
|
28
31
|
/**
|
|
29
32
|
* (可选)左边的文字下面的描述
|
|
33
|
+
* @default ""
|
|
30
34
|
*/
|
|
31
35
|
description?: string;
|
|
32
36
|
/**
|
|
@@ -35,8 +39,9 @@ export interface PopsPanelSwitchDetails extends PopsPanelCommonDetails<PopsPanel
|
|
|
35
39
|
type: "switch";
|
|
36
40
|
/**
|
|
37
41
|
* (可选)是否禁用
|
|
42
|
+
* @default false
|
|
38
43
|
*/
|
|
39
|
-
disabled?:
|
|
44
|
+
disabled?: boolean | (() => boolean);
|
|
40
45
|
/**
|
|
41
46
|
* 获取该项的值的回调函数
|
|
42
47
|
*/
|
|
@@ -5,10 +5,12 @@ import type { PopsPanelCommonDetails } from "./components-common";
|
|
|
5
5
|
export interface PopsPanelTextAreaDetails extends PopsPanelCommonDetails<PopsPanelTextAreaDetails> {
|
|
6
6
|
/**
|
|
7
7
|
* (可选)className属性
|
|
8
|
+
* @default ""
|
|
8
9
|
*/
|
|
9
10
|
className?: string;
|
|
10
11
|
/**
|
|
11
12
|
* (可选)自定义元素属性
|
|
13
|
+
* @default {}
|
|
12
14
|
*/
|
|
13
15
|
attributes?: {
|
|
14
16
|
[key: string]: any;
|
|
@@ -17,6 +19,7 @@ export interface PopsPanelTextAreaDetails extends PopsPanelCommonDetails<PopsPan
|
|
|
17
19
|
}[];
|
|
18
20
|
/**
|
|
19
21
|
* (可选)自定义属性
|
|
22
|
+
* @default {}
|
|
20
23
|
*/
|
|
21
24
|
props?: {
|
|
22
25
|
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
@@ -27,6 +30,7 @@ export interface PopsPanelTextAreaDetails extends PopsPanelCommonDetails<PopsPan
|
|
|
27
30
|
text: string;
|
|
28
31
|
/**
|
|
29
32
|
* (可选)左边的文字下面的描述
|
|
33
|
+
* @default ""
|
|
30
34
|
*/
|
|
31
35
|
description?: string;
|
|
32
36
|
/**
|
|
@@ -35,8 +39,9 @@ export interface PopsPanelTextAreaDetails extends PopsPanelCommonDetails<PopsPan
|
|
|
35
39
|
type: "textarea";
|
|
36
40
|
/**
|
|
37
41
|
* (可选)是否禁用
|
|
42
|
+
* @default false
|
|
38
43
|
*/
|
|
39
|
-
disabled?: boolean;
|
|
44
|
+
disabled?: boolean | (() => boolean);
|
|
40
45
|
/**
|
|
41
46
|
* 获取该项的值的回调函数
|
|
42
47
|
*/
|
|
@@ -51,6 +56,7 @@ export interface PopsPanelTextAreaDetails extends PopsPanelCommonDetails<PopsPan
|
|
|
51
56
|
}, value: string): void;
|
|
52
57
|
/**
|
|
53
58
|
* 输入框内的提示
|
|
59
|
+
* @default ""
|
|
54
60
|
*/
|
|
55
|
-
placeholder
|
|
61
|
+
placeholder?: string;
|
|
56
62
|
}
|
package/package.json
CHANGED
package/src/Pops.ts
CHANGED
|
@@ -324,7 +324,11 @@ export const PanelHandlerComponents = () => {
|
|
|
324
324
|
},
|
|
325
325
|
init() {
|
|
326
326
|
this.setStatus(this.$data.value);
|
|
327
|
-
|
|
327
|
+
let disabled =
|
|
328
|
+
typeof formConfig.disabled === "function"
|
|
329
|
+
? formConfig.disabled()
|
|
330
|
+
: formConfig.disabled;
|
|
331
|
+
if (disabled) {
|
|
328
332
|
this.disable();
|
|
329
333
|
}
|
|
330
334
|
this.setClickEvent();
|
|
@@ -1109,9 +1113,11 @@ export const PanelHandlerComponents = () => {
|
|
|
1109
1113
|
$li,
|
|
1110
1114
|
/*html*/ `
|
|
1111
1115
|
<div class="pops-panel-item-left-text">
|
|
1112
|
-
<p class="pops-panel-item-left-main-text">${
|
|
1116
|
+
<p class="pops-panel-item-left-main-text">${
|
|
1117
|
+
formConfig.text
|
|
1118
|
+
}</p>${leftDescriptionText}</div>
|
|
1113
1119
|
<div class="pops-panel-input pops-user-select-none">
|
|
1114
|
-
<input type="${inputType}" placeholder="${formConfig.placeholder}">
|
|
1120
|
+
<input type="${inputType}" placeholder="${formConfig.placeholder ?? ""}">
|
|
1115
1121
|
</div>
|
|
1116
1122
|
`
|
|
1117
1123
|
);
|
|
@@ -1144,7 +1150,12 @@ export const PanelHandlerComponents = () => {
|
|
|
1144
1150
|
}
|
|
1145
1151
|
|
|
1146
1152
|
this.setInputChangeEvent();
|
|
1147
|
-
|
|
1153
|
+
// 是否禁用复选框
|
|
1154
|
+
let disabled =
|
|
1155
|
+
typeof formConfig.disabled === "function"
|
|
1156
|
+
? formConfig.disabled()
|
|
1157
|
+
: formConfig.disabled;
|
|
1158
|
+
if (disabled) {
|
|
1148
1159
|
this.disable();
|
|
1149
1160
|
}
|
|
1150
1161
|
if (typeof formConfig.handlerCallBack === "function") {
|
|
@@ -1348,7 +1359,11 @@ export const PanelHandlerComponents = () => {
|
|
|
1348
1359
|
init() {
|
|
1349
1360
|
this.setValue(this.$data.value);
|
|
1350
1361
|
this.setChangeEvent();
|
|
1351
|
-
|
|
1362
|
+
let disabled =
|
|
1363
|
+
typeof formConfig.disabled === "function"
|
|
1364
|
+
? formConfig.disabled()
|
|
1365
|
+
: formConfig.disabled;
|
|
1366
|
+
if (disabled) {
|
|
1352
1367
|
this.disable();
|
|
1353
1368
|
}
|
|
1354
1369
|
},
|
|
@@ -1450,7 +1465,11 @@ export const PanelHandlerComponents = () => {
|
|
|
1450
1465
|
this.initOption();
|
|
1451
1466
|
this.setChangeEvent();
|
|
1452
1467
|
this.setClickEvent();
|
|
1453
|
-
|
|
1468
|
+
let disabled =
|
|
1469
|
+
typeof formConfig.disabled === "function"
|
|
1470
|
+
? formConfig.disabled()
|
|
1471
|
+
: formConfig.disabled;
|
|
1472
|
+
if (disabled) {
|
|
1454
1473
|
this.disable();
|
|
1455
1474
|
}
|
|
1456
1475
|
},
|
|
@@ -7,10 +7,12 @@ export interface PopsPanelInputDetails
|
|
|
7
7
|
extends PopsPanelCommonDetails<PopsPanelInputDetails> {
|
|
8
8
|
/**
|
|
9
9
|
* (可选)className属性
|
|
10
|
+
* @default ""
|
|
10
11
|
*/
|
|
11
12
|
className?: string;
|
|
12
13
|
/**
|
|
13
14
|
* (可选)自定义元素属性
|
|
15
|
+
* @default {}
|
|
14
16
|
*/
|
|
15
17
|
attributes?:
|
|
16
18
|
| {
|
|
@@ -21,6 +23,7 @@ export interface PopsPanelInputDetails
|
|
|
21
23
|
}[];
|
|
22
24
|
/**
|
|
23
25
|
* (可选)自定义属性
|
|
26
|
+
* @default {}
|
|
24
27
|
*/
|
|
25
28
|
props?: {
|
|
26
29
|
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
@@ -31,6 +34,7 @@ export interface PopsPanelInputDetails
|
|
|
31
34
|
text: string;
|
|
32
35
|
/**
|
|
33
36
|
* (可选)左边的文字下面的描述
|
|
37
|
+
* @default ""
|
|
34
38
|
*/
|
|
35
39
|
description?: string;
|
|
36
40
|
/**
|
|
@@ -39,8 +43,9 @@ export interface PopsPanelInputDetails
|
|
|
39
43
|
type: "input";
|
|
40
44
|
/**
|
|
41
45
|
* (可选)是否禁用
|
|
46
|
+
* @default false
|
|
42
47
|
*/
|
|
43
|
-
disabled?: boolean;
|
|
48
|
+
disabled?: boolean | (() => boolean);
|
|
44
49
|
/**
|
|
45
50
|
* 获取该项的值的回调函数
|
|
46
51
|
*/
|
|
@@ -54,14 +59,17 @@ export interface PopsPanelInputDetails
|
|
|
54
59
|
callback(event: InputEvent, value: string, valueAsNumber?: number): void;
|
|
55
60
|
/**
|
|
56
61
|
* (可选)输入框内的提示
|
|
62
|
+
* @default ""
|
|
57
63
|
*/
|
|
58
64
|
placeholder?: string;
|
|
59
65
|
/**
|
|
60
66
|
* (可选)是否是密码框
|
|
67
|
+
* @default false
|
|
61
68
|
*/
|
|
62
69
|
isPassword?: boolean;
|
|
63
70
|
/**
|
|
64
71
|
* (可选)是否是数字框
|
|
72
|
+
* @default false
|
|
65
73
|
*/
|
|
66
74
|
isNumber?: boolean;
|
|
67
75
|
/**
|
|
@@ -9,10 +9,12 @@ export interface PopsPanelSelectDetails<T = any>
|
|
|
9
9
|
extends PopsPanelCommonDetails<PopsPanelSelectDetails> {
|
|
10
10
|
/**
|
|
11
11
|
* (可选)className属性
|
|
12
|
+
* @default ""
|
|
12
13
|
*/
|
|
13
14
|
className?: string;
|
|
14
15
|
/**
|
|
15
16
|
* (可选)自定义元素属性
|
|
17
|
+
* @default {}
|
|
16
18
|
*/
|
|
17
19
|
attributes?:
|
|
18
20
|
| {
|
|
@@ -23,6 +25,7 @@ export interface PopsPanelSelectDetails<T = any>
|
|
|
23
25
|
}[];
|
|
24
26
|
/**
|
|
25
27
|
* (可选)自定义属性
|
|
28
|
+
* @default {}
|
|
26
29
|
*/
|
|
27
30
|
props?: {
|
|
28
31
|
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
@@ -33,6 +36,7 @@ export interface PopsPanelSelectDetails<T = any>
|
|
|
33
36
|
text: string;
|
|
34
37
|
/**
|
|
35
38
|
* (可选)左边的文字下面的描述
|
|
39
|
+
* @default ""
|
|
36
40
|
*/
|
|
37
41
|
description?: string;
|
|
38
42
|
/**
|
|
@@ -41,8 +45,9 @@ export interface PopsPanelSelectDetails<T = any>
|
|
|
41
45
|
type: "select";
|
|
42
46
|
/**
|
|
43
47
|
* (可选)是否禁用
|
|
48
|
+
* @default false
|
|
44
49
|
*/
|
|
45
|
-
disabled?: boolean;
|
|
50
|
+
disabled?: boolean | (() => boolean);
|
|
46
51
|
/**
|
|
47
52
|
* 获取该项的值的回调函数
|
|
48
53
|
*/
|
|
@@ -7,10 +7,12 @@ export interface PopsPanelSwitchDetails
|
|
|
7
7
|
extends PopsPanelCommonDetails<PopsPanelSwitchDetails> {
|
|
8
8
|
/**
|
|
9
9
|
* (可选)className属性
|
|
10
|
+
* @default ""
|
|
10
11
|
*/
|
|
11
12
|
className?: string;
|
|
12
13
|
/**
|
|
13
14
|
* (可选)自定义元素属性
|
|
15
|
+
* @default {}
|
|
14
16
|
*/
|
|
15
17
|
attributes?:
|
|
16
18
|
| {
|
|
@@ -21,6 +23,7 @@ export interface PopsPanelSwitchDetails
|
|
|
21
23
|
}[];
|
|
22
24
|
/**
|
|
23
25
|
* (可选)自定义属性
|
|
26
|
+
* @default {}
|
|
24
27
|
*/
|
|
25
28
|
props?: {
|
|
26
29
|
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
@@ -31,6 +34,7 @@ export interface PopsPanelSwitchDetails
|
|
|
31
34
|
text: string;
|
|
32
35
|
/**
|
|
33
36
|
* (可选)左边的文字下面的描述
|
|
37
|
+
* @default ""
|
|
34
38
|
*/
|
|
35
39
|
description?: string;
|
|
36
40
|
/**
|
|
@@ -39,8 +43,9 @@ export interface PopsPanelSwitchDetails
|
|
|
39
43
|
type: "switch";
|
|
40
44
|
/**
|
|
41
45
|
* (可选)是否禁用
|
|
46
|
+
* @default false
|
|
42
47
|
*/
|
|
43
|
-
disabled?:
|
|
48
|
+
disabled?: boolean | (() => boolean);
|
|
44
49
|
/**
|
|
45
50
|
* 获取该项的值的回调函数
|
|
46
51
|
*/
|
|
@@ -7,10 +7,12 @@ export interface PopsPanelTextAreaDetails
|
|
|
7
7
|
extends PopsPanelCommonDetails<PopsPanelTextAreaDetails> {
|
|
8
8
|
/**
|
|
9
9
|
* (可选)className属性
|
|
10
|
+
* @default ""
|
|
10
11
|
*/
|
|
11
12
|
className?: string;
|
|
12
13
|
/**
|
|
13
14
|
* (可选)自定义元素属性
|
|
15
|
+
* @default {}
|
|
14
16
|
*/
|
|
15
17
|
attributes?:
|
|
16
18
|
| {
|
|
@@ -21,6 +23,7 @@ export interface PopsPanelTextAreaDetails
|
|
|
21
23
|
}[];
|
|
22
24
|
/**
|
|
23
25
|
* (可选)自定义属性
|
|
26
|
+
* @default {}
|
|
24
27
|
*/
|
|
25
28
|
props?: {
|
|
26
29
|
[K in keyof HTMLElement]?: HTMLElement[K];
|
|
@@ -31,6 +34,7 @@ export interface PopsPanelTextAreaDetails
|
|
|
31
34
|
text: string;
|
|
32
35
|
/**
|
|
33
36
|
* (可选)左边的文字下面的描述
|
|
37
|
+
* @default ""
|
|
34
38
|
*/
|
|
35
39
|
description?: string;
|
|
36
40
|
/**
|
|
@@ -39,8 +43,9 @@ export interface PopsPanelTextAreaDetails
|
|
|
39
43
|
type: "textarea";
|
|
40
44
|
/**
|
|
41
45
|
* (可选)是否禁用
|
|
46
|
+
* @default false
|
|
42
47
|
*/
|
|
43
|
-
disabled?: boolean;
|
|
48
|
+
disabled?: boolean | (() => boolean);
|
|
44
49
|
/**
|
|
45
50
|
* 获取该项的值的回调函数
|
|
46
51
|
*/
|
|
@@ -58,6 +63,7 @@ export interface PopsPanelTextAreaDetails
|
|
|
58
63
|
): void;
|
|
59
64
|
/**
|
|
60
65
|
* 输入框内的提示
|
|
66
|
+
* @default ""
|
|
61
67
|
*/
|
|
62
|
-
placeholder
|
|
68
|
+
placeholder?: string;
|
|
63
69
|
}
|