@whitesev/pops 2.2.2 → 2.2.4
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 +67 -23
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +67 -23
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +67 -23
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +67 -23
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +67 -23
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +67 -23
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Pops.d.ts +10 -10
- package/dist/types/src/PopsIcon.d.ts +2 -2
- 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/dist/types/src/components/rightClickMenu/index.d.ts +2 -2
- package/dist/types/src/components/tooltip/index.d.ts +2 -2
- package/dist/types/src/config/CommonCSSClassName.d.ts +17 -0
- package/dist/types/src/{GlobalConfig.d.ts → config/GlobalConfig.d.ts} +4 -4
- package/dist/types/src/utils/PopsDOMUtils.d.ts +3 -3
- package/package.json +1 -1
- package/src/Pops.ts +2 -2
- package/src/components/alert/index.ts +1 -1
- package/src/components/confirm/index.ts +1 -1
- package/src/components/drawer/index.ts +1 -1
- package/src/components/folder/index.ts +1 -1
- package/src/components/iframe/index.ts +1 -1
- package/src/components/loading/index.ts +1 -1
- package/src/components/panel/handlerComponents.ts +74 -16
- package/src/components/panel/index.ts +1 -1
- 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
- package/src/components/prompt/index.ts +1 -1
- package/src/components/rightClickMenu/index.ts +1 -1
- package/src/components/searchSuggestion/index.ts +7 -3
- package/src/components/tooltip/index.ts +1 -1
- package/src/config/CommonCSSClassName.ts +17 -0
- package/src/{GlobalConfig.ts → config/GlobalConfig.ts} +1 -1
- package/src/css/common.css +14 -0
- package/src/utils/PopsDOMUtils.ts +22 -9
|
@@ -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
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GlobalConfig } from "../../GlobalConfig";
|
|
1
|
+
import { GlobalConfig } from "../../config/GlobalConfig";
|
|
2
2
|
import { PopsElementHandler } from "../../handler/PopsElementHandler";
|
|
3
3
|
import { PopsHandler } from "../../handler/PopsHandler";
|
|
4
4
|
import { PopsCSS } from "../../PopsCSS";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OriginPrototype } from "../../PopsCore";
|
|
2
|
-
import { GlobalConfig } from "../../GlobalConfig";
|
|
2
|
+
import { GlobalConfig } from "../../config/GlobalConfig";
|
|
3
3
|
import { PopsHandler } from "../../handler/PopsHandler";
|
|
4
4
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
5
5
|
import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
|
|
@@ -2,11 +2,12 @@ import { PopsHandler } from "../../handler/PopsHandler";
|
|
|
2
2
|
import { popsDOMUtils } from "../../utils/PopsDOMUtils";
|
|
3
3
|
import { popsUtils } from "../../utils/PopsUtils";
|
|
4
4
|
import { searchSuggestionConfig as PopsSearchSuggestionConfig } from "./config";
|
|
5
|
-
import { GlobalConfig } from "../../GlobalConfig";
|
|
5
|
+
import { GlobalConfig } from "../../config/GlobalConfig";
|
|
6
6
|
import { PopsSafeUtils } from "../../utils/PopsSafeUtils";
|
|
7
7
|
import type { PopsSearchSuggestionDetails } from "./types/index";
|
|
8
8
|
import { PopsCSS } from "../../PopsCSS";
|
|
9
9
|
import type { PopsType } from "../../types/main";
|
|
10
|
+
import { PopsCommonCSSClassName } from "../../config/CommonCSSClassName";
|
|
10
11
|
|
|
11
12
|
export const PopsSearchSuggestion = {
|
|
12
13
|
init(details: PopsSearchSuggestionDetails) {
|
|
@@ -209,14 +210,17 @@ export const PopsSearchSuggestion = {
|
|
|
209
210
|
* @param index 当前项的下标
|
|
210
211
|
*/
|
|
211
212
|
getSearchItemLiElement(data: any, index: number) {
|
|
212
|
-
|
|
213
|
-
className: `pops-${popsType}-search-suggestion-hint-item
|
|
213
|
+
let $li = popsDOMUtils.createElement("li", {
|
|
214
|
+
className: `pops-${popsType}-search-suggestion-hint-item`,
|
|
214
215
|
"data-index": index,
|
|
215
216
|
"data-value": SearchSuggestion.getItemDataValue(data),
|
|
216
217
|
innerHTML: `${config.getItemHTML(data)}${
|
|
217
218
|
config.deleteIcon.enable ? SearchSuggestion.getDeleteIconHTML() : ""
|
|
218
219
|
}`,
|
|
219
220
|
});
|
|
221
|
+
popsDOMUtils.addClassName($li, PopsCommonCSSClassName.flexCenter);
|
|
222
|
+
popsDOMUtils.addClassName($li, PopsCommonCSSClassName.flexYCenter);
|
|
223
|
+
return $li;
|
|
220
224
|
},
|
|
221
225
|
/**
|
|
222
226
|
* 获取data-value值
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 通用的CSS类名
|
|
3
|
+
*/
|
|
4
|
+
export const PopsCommonCSSClassName = {
|
|
5
|
+
flexCenter: "pops-flex-items-center",
|
|
6
|
+
flexYCenter: "pops-flex-y-center",
|
|
7
|
+
flexXCenter: "pops-flex-x-center",
|
|
8
|
+
hide: "pops-hide",
|
|
9
|
+
hideImportant: "pops-hide-important",
|
|
10
|
+
noBorder: "pops-no-border",
|
|
11
|
+
noBorderImportant: "pops-no-border-important",
|
|
12
|
+
userSelectNone: "pops-user-select-none",
|
|
13
|
+
lineHeightCenter: "pops-line-height-center",
|
|
14
|
+
widthFill: "pops-width-fill",
|
|
15
|
+
textIsDisabled: "pops-text-is-disabled",
|
|
16
|
+
textIsDisabledImportant: "pops-text-is-disabled-important",
|
|
17
|
+
};
|
package/src/css/common.css
CHANGED
|
@@ -36,3 +36,17 @@
|
|
|
36
36
|
width: -webkit-fill-available;
|
|
37
37
|
width: -moz-available;
|
|
38
38
|
}
|
|
39
|
+
.pops-text-is-disabled {
|
|
40
|
+
--pops-text-is-disabled-color: #a8abb2;
|
|
41
|
+
color: var(--pops-text-is-disabled-color);
|
|
42
|
+
--pops-panel-forms-container-item-left-desc-text-color: var(
|
|
43
|
+
--pops-text-is-disabled-color
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
.pops-text-is-disabled-important {
|
|
47
|
+
--pops-text-is-disabled-color: #a8abb2;
|
|
48
|
+
color: var(--pops-text-is-disabled-color) !important;
|
|
49
|
+
--pops-panel-forms-container-item-left-desc-text-color: var(
|
|
50
|
+
--pops-text-is-disabled-color
|
|
51
|
+
) !important;
|
|
52
|
+
}
|
|
@@ -11,6 +11,7 @@ import { SymbolEvents } from "./PopsDOMUtilsEventsConfig";
|
|
|
11
11
|
import { OriginPrototype, PopsCore } from "../PopsCore";
|
|
12
12
|
import { popsUtils } from "./PopsUtils";
|
|
13
13
|
import { PopsSafeUtils } from "./PopsSafeUtils";
|
|
14
|
+
import { PopsCommonCSSClassName } from "../config/CommonCSSClassName";
|
|
14
15
|
|
|
15
16
|
class PopsDOMUtilsEvent {
|
|
16
17
|
/**
|
|
@@ -1783,7 +1784,10 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
1783
1784
|
* @param element 目标元素
|
|
1784
1785
|
* @param className className属性
|
|
1785
1786
|
*/
|
|
1786
|
-
addClassName(element:
|
|
1787
|
+
addClassName(element: Element | undefined | null, className: string) {
|
|
1788
|
+
if (element == null) {
|
|
1789
|
+
return;
|
|
1790
|
+
}
|
|
1787
1791
|
if (typeof className !== "string") {
|
|
1788
1792
|
return;
|
|
1789
1793
|
}
|
|
@@ -1797,7 +1801,10 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
1797
1801
|
* @param element 目标元素
|
|
1798
1802
|
* @param className className属性
|
|
1799
1803
|
*/
|
|
1800
|
-
removeClassName(element:
|
|
1804
|
+
removeClassName(element: Element | undefined | null, className: string) {
|
|
1805
|
+
if (element == null) {
|
|
1806
|
+
return;
|
|
1807
|
+
}
|
|
1801
1808
|
if (typeof className !== "string") {
|
|
1802
1809
|
return;
|
|
1803
1810
|
}
|
|
@@ -1811,7 +1818,13 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
1811
1818
|
* @param element 目标元素
|
|
1812
1819
|
* @param className className属性
|
|
1813
1820
|
*/
|
|
1814
|
-
containsClassName(
|
|
1821
|
+
containsClassName(
|
|
1822
|
+
element: HTMLElement | undefined | null,
|
|
1823
|
+
className: string
|
|
1824
|
+
): boolean {
|
|
1825
|
+
if (element == null) {
|
|
1826
|
+
return false;
|
|
1827
|
+
}
|
|
1815
1828
|
if (typeof className !== "string") {
|
|
1816
1829
|
return false;
|
|
1817
1830
|
}
|
|
@@ -2226,9 +2239,9 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
2226
2239
|
return;
|
|
2227
2240
|
}
|
|
2228
2241
|
if (isImportant) {
|
|
2229
|
-
ele.
|
|
2242
|
+
popsDOMUtils.addClassName(ele, PopsCommonCSSClassName.hideImportant);
|
|
2230
2243
|
} else {
|
|
2231
|
-
ele.
|
|
2244
|
+
popsDOMUtils.addClassName(ele, PopsCommonCSSClassName.hide);
|
|
2232
2245
|
}
|
|
2233
2246
|
}
|
|
2234
2247
|
/**
|
|
@@ -2239,8 +2252,8 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
2239
2252
|
if (ele == null) {
|
|
2240
2253
|
return;
|
|
2241
2254
|
}
|
|
2242
|
-
ele.
|
|
2243
|
-
ele.
|
|
2255
|
+
popsDOMUtils.removeClassName(ele, PopsCommonCSSClassName.hide);
|
|
2256
|
+
popsDOMUtils.removeClassName(ele, PopsCommonCSSClassName.hideImportant);
|
|
2244
2257
|
}
|
|
2245
2258
|
/**
|
|
2246
2259
|
* 将字符串转为Element元素
|
|
@@ -2575,7 +2588,7 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
2575
2588
|
return `#${hexs.join("")}`;
|
|
2576
2589
|
};
|
|
2577
2590
|
|
|
2578
|
-
/**
|
|
2591
|
+
/**
|
|
2579
2592
|
* 获取深色
|
|
2580
2593
|
*/
|
|
2581
2594
|
const getDarkColor = (
|
|
@@ -2598,7 +2611,7 @@ class PopsDOMUtils extends PopsDOMUtilsEvent {
|
|
|
2598
2611
|
return useChangeColor().rgbToHex(rgb[0], rgb[1], rgb[2]);
|
|
2599
2612
|
};
|
|
2600
2613
|
|
|
2601
|
-
/**
|
|
2614
|
+
/**
|
|
2602
2615
|
* 获取颜色变浅后的颜色值
|
|
2603
2616
|
*/
|
|
2604
2617
|
const getLightColor = (
|