@whitesev/pops 3.0.0 → 3.0.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.
Files changed (61) hide show
  1. package/dist/index.amd.js +1964 -719
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.amd.min.js +1 -1
  4. package/dist/index.amd.min.js.map +1 -1
  5. package/dist/index.cjs.js +1964 -719
  6. package/dist/index.cjs.js.map +1 -1
  7. package/dist/index.cjs.min.js +1 -1
  8. package/dist/index.cjs.min.js.map +1 -1
  9. package/dist/index.esm.js +1964 -719
  10. package/dist/index.esm.js.map +1 -1
  11. package/dist/index.esm.min.js +1 -1
  12. package/dist/index.esm.min.js.map +1 -1
  13. package/dist/index.iife.js +1964 -719
  14. package/dist/index.iife.js.map +1 -1
  15. package/dist/index.iife.min.js +1 -1
  16. package/dist/index.iife.min.js.map +1 -1
  17. package/dist/index.system.js +1964 -719
  18. package/dist/index.system.js.map +1 -1
  19. package/dist/index.system.min.js +1 -1
  20. package/dist/index.system.min.js.map +1 -1
  21. package/dist/index.umd.js +1964 -719
  22. package/dist/index.umd.js.map +1 -1
  23. package/dist/index.umd.min.js +1 -1
  24. package/dist/index.umd.min.js.map +1 -1
  25. package/dist/types/src/Pops.d.ts +413 -22
  26. package/dist/types/src/PopsCSS.d.ts +3 -1
  27. package/dist/types/src/PopsIcon.d.ts +1 -1
  28. package/dist/types/src/components/panel/handlerComponents.d.ts +1103 -21
  29. package/dist/types/src/components/panel/index.d.ts +2 -2
  30. package/dist/types/src/components/panel/types/components-button.d.ts +1 -1
  31. package/dist/types/src/components/panel/types/components-container.d.ts +1 -1
  32. package/dist/types/src/components/panel/types/components-deepMenu.d.ts +1 -1
  33. package/dist/types/src/components/panel/types/components-input.d.ts +41 -16
  34. package/dist/types/src/components/panel/types/components-own.d.ts +3 -3
  35. package/dist/types/src/components/panel/types/components-select.d.ts +126 -30
  36. package/dist/types/src/components/panel/types/components-selectMultiple.d.ts +10 -15
  37. package/dist/types/src/components/panel/types/components-slider.d.ts +2 -3
  38. package/dist/types/src/components/panel/types/components-switch.d.ts +1 -1
  39. package/dist/types/src/components/panel/types/components-textarea.d.ts +1 -1
  40. package/dist/types/src/components/searchSuggestion/index.d.ts +3 -3
  41. package/dist/types/src/types/global.d.ts +3 -1
  42. package/package.json +8 -8
  43. package/src/PopsCSS.ts +4 -1
  44. package/src/components/panel/css/components-select.css +84 -0
  45. package/src/components/panel/defaultConfig.ts +473 -213
  46. package/src/components/panel/handlerComponents.ts +1504 -499
  47. package/src/components/panel/index.css +149 -14
  48. package/src/components/panel/types/components-button.ts +1 -1
  49. package/src/components/panel/types/components-container.ts +1 -1
  50. package/src/components/panel/types/components-deepMenu.ts +1 -1
  51. package/src/components/panel/types/components-input.ts +51 -16
  52. package/src/components/panel/types/components-own.ts +3 -3
  53. package/src/components/panel/types/components-select.ts +131 -32
  54. package/src/components/panel/types/components-selectMultiple.ts +11 -16
  55. package/src/components/panel/types/components-slider.ts +2 -3
  56. package/src/components/panel/types/components-switch.ts +1 -1
  57. package/src/components/panel/types/components-textarea.ts +1 -1
  58. package/src/components/rightClickMenu/index.css +1 -1
  59. package/src/components/searchSuggestion/index.ts +20 -65
  60. package/src/css/common.css +4 -4
  61. package/src/types/global.d.ts +3 -1
@@ -4,16 +4,16 @@ export declare const PopsPanel: {
4
4
  init(__config__: PopsPanelConfig): {
5
5
  addEventListener: <K extends keyof PopsPanelEventType>(event: K, listener: (evt: CustomEvent<PopsPanelEventType[K]>) => void, options?: boolean | EventListenerOptions) => void;
6
6
  removeEventListener: <K extends keyof PopsPanelEventType>(event: K, listener: (evt: CustomEvent<PopsPanelEventType[K]>) => void, options?: boolean | EventListenerOptions) => void;
7
+ mode: PopsType;
7
8
  close: () => Promise<void>;
8
9
  hide: () => Promise<void>;
9
10
  show: () => Promise<void>;
11
+ guid: string;
10
12
  $shadowContainer: HTMLDivElement;
11
13
  $shadowRoot: ShadowRoot | HTMLElement;
12
14
  $el: HTMLDivElement;
13
15
  $anim: HTMLDivElement;
14
16
  $pops: HTMLDivElement;
15
17
  $mask?: HTMLDivElement | undefined;
16
- mode: PopsType;
17
- guid: string;
18
18
  };
19
19
  };
@@ -6,7 +6,7 @@ import type { PopsIconType } from "../../../types/icon";
6
6
  */
7
7
  export interface PopsPanelButtonConfig extends PopsPanelGeneralConfig<PopsPanelButtonConfig> {
8
8
  /**
9
- * 类型
9
+ * 组件类型
10
10
  */
11
11
  type: "button";
12
12
  /**
@@ -5,7 +5,7 @@ import type { PopsPanelViewConfig } from ".";
5
5
  */
6
6
  export interface PopsPanelContainerConfig extends PopsPanelGeneralConfig<PopsPanelContainerConfig> {
7
7
  /**
8
- * 类型
8
+ * 组件类型
9
9
  */
10
10
  type: "container";
11
11
  /**
@@ -6,7 +6,7 @@ import type { PopsPanelGeneralConfig } from "./components-common";
6
6
  */
7
7
  export interface PopsPanelDeepViewConfig extends PopsPanelGeneralConfig<PopsPanelDeepViewConfig> {
8
8
  /**
9
- * 类型
9
+ * 组件类型
10
10
  */
11
11
  type: "deepMenu";
12
12
  /**
@@ -1,12 +1,41 @@
1
1
  import type { PopsPanelGeneralConfig } from "./components-common";
2
+ /**
3
+ * pops.panel的input的字符串type类型
4
+ */
5
+ export type PopsPanelInputStringType = "text" | "color" | "search" | "email" | "tel" | "url";
6
+ /**
7
+ * pops.panel的input的日期type类型
8
+ */
9
+ export type PopsPanelInputDateType = "date" | "datetime-local" | "time" | "month" | "week";
10
+ /**
11
+ * pops.panel的input的数字ype类型
12
+ */
13
+ export type PopsPanelInputNumberType = "number";
14
+ /**
15
+ * pops.panel的input的密码type类型
16
+ */
17
+ export type PopsPanelInputPasswordType = "password";
18
+ /**
19
+ * pops.panel的input的文件type类型
20
+ */
21
+ export type PopsPanelInputFileType = "file";
22
+ /**
23
+ * pops.panel的input的type类型
24
+ */
25
+ export type PopsPanelInputType = PopsPanelInputStringType | PopsPanelInputDateType | PopsPanelInputNumberType | PopsPanelInputPasswordType | PopsPanelInputFileType;
2
26
  /**
3
27
  * pops.panel的 input
4
28
  */
5
29
  export interface PopsPanelInputConfig extends PopsPanelGeneralConfig<PopsPanelInputConfig> {
6
30
  /**
7
- * 类型
31
+ * 组件类型
8
32
  */
9
33
  type: "input";
34
+ /**
35
+ * (可选)输入框类型
36
+ * @default "text"
37
+ */
38
+ inputType?: PopsPanelInputType;
10
39
  /**
11
40
  * 显示在左边的文字
12
41
  */
@@ -23,32 +52,28 @@ export interface PopsPanelInputConfig extends PopsPanelGeneralConfig<PopsPanelIn
23
52
  disabled?: boolean | (() => boolean);
24
53
  /**
25
54
  * 获取该项的值的回调函数
55
+ *
56
+ * 组件初始化后会调用一次,用于初始话默认值
26
57
  */
27
- getValue(): string;
58
+ getValue(): string | number | Date;
28
59
  /**
29
60
  * 输入框的值改变触发的回调函数
30
61
  * @param event 输入事件
31
62
  * @param value 输入框的值
32
- * @param valueAsNumber 当isNumbertrue时,有该值,它可能是NaN
63
+ * @param valueAsNumber 如果inputTypenumber或日期类型,存在该值,类型为number(可能为isNaN),否则为undefined
64
+ * @param valueAsDate 如果inputType为日期类型,存在该值,类型为Date(可能为null),否则为undefined
33
65
  */
34
- callback(event: InputEvent, value: string, valueAsNumber?: number): void;
66
+ callback(event: InputEvent, value: string, valueAsNumber?: number, valueAsDate?: Date | null): void | {
67
+ valid: boolean;
68
+ message?: string;
69
+ };
35
70
  /**
36
71
  * (可选)输入框内的提示
37
72
  * @default ""
38
73
  */
39
74
  placeholder?: string;
40
75
  /**
41
- * (可选)是否是密码框
42
- * @default false
43
- */
44
- isPassword?: boolean;
45
- /**
46
- * (可选)是否是数字框
47
- * @default false
48
- */
49
- isNumber?: boolean;
50
- /**
51
- * (可选)自己调用的处理回调函数
76
+ * (可选)初始化后调用的回调函数
52
77
  */
53
- handlerCallBack?(liElement: HTMLLIElement, inputElement: HTMLInputElement): void;
78
+ handlerCallBack?($li: HTMLLIElement, $input: HTMLInputElement): void;
54
79
  }
@@ -5,11 +5,11 @@ import type { PopsPanelGeneralConfig } from "./components-common";
5
5
  */
6
6
  export interface PopsPanelOwnConfig extends PopsPanelGeneralConfig<PopsPanelOwnConfig> {
7
7
  /**
8
- * 类型
8
+ * 组件类型
9
9
  */
10
10
  type: "own";
11
11
  /**
12
- * 获取自定义<li>标签元素
12
+ * 生成<li>标签元素
13
13
  */
14
- getLiElementCallBack: (liElement: HTMLLIElement) => HTMLLIElement;
14
+ createLIElement($li: HTMLLIElement): HTMLLIElement;
15
15
  }
@@ -1,12 +1,101 @@
1
1
  import type { PopsPanelGeneralConfig } from "./components-common";
2
2
  import type { PopsPanelContainerConfig } from "./components-container";
3
3
  import type { PopsPanelViewConfig } from ".";
4
+ import type { PopsAlertConfig } from "../../alert/types";
5
+ export type PopsPanelSelectMode = "native" | "dialog" | "horizontal";
6
+ /**
7
+ * 分组配置
8
+ *
9
+ * 用在mode="dialog"里
10
+ */
11
+ export type PopsPanelSelectDialogGroupOption<T> = {
12
+ /**
13
+ * 是否是分组
14
+ * @default false
15
+ *
16
+ * + true 这时候text的值是显示的分组名,value是可以忽略的
17
+ */
18
+ isGroup?: boolean;
19
+ /**
20
+ * 分组内部选择是否是单选
21
+ * @default false
22
+ */
23
+ isSingleSelect?: boolean;
24
+ /**
25
+ * 分组数据列表
26
+ *
27
+ * 该数据仅在mode === "dialog"下生效
28
+ * @default []
29
+ */
30
+ groupDataOptions?: IFunction<Omit<PopsPanelSelectDataOption<T>, keyof PopsPanelSelectDialogGroupOption<T>>[]>;
31
+ };
32
+ /**
33
+ * 选择项的配置数据
34
+ */
35
+ export type PopsPanelSelectDataOption<T> = {
36
+ /**
37
+ * 真正的值
38
+ */
39
+ value: T;
40
+ /**
41
+ * 显示的文字
42
+ */
43
+ text: string | ((
44
+ /** 当前的值 */
45
+ value: T,
46
+ /**当前选中的配置信息 */
47
+ selectedInfo?: PopsPanelSelectDataOption<T>) => string);
48
+ /**
49
+ * 显示的文字是否是html
50
+ * @default false
51
+ */
52
+ isHTML?: boolean;
53
+ /**
54
+ * (可选)是否禁用项
55
+ * 触发条件:
56
+ * + 点击select元素
57
+ * + select元素触发change事件
58
+ * @param value 当前的值
59
+ * @param selectedInfo 当前选中的配置信息
60
+ */
61
+ disable?(value: T, selectedInfo?: PopsPanelSelectDataOption<T>): boolean;
62
+ /**
63
+ * 子配置,跟随切换改变
64
+ *
65
+ * 选中项后,根据配置添加到页面中
66
+ */
67
+ views?: IFunction<(PopsPanelContainerConfig | PopsPanelViewConfig)[]>;
68
+ /**
69
+ * (可选)是否是自定义输入的内容
70
+ * @default false
71
+ */
72
+ addCustomInput?: boolean;
73
+ /**
74
+ * (可选)自定义输入内容存储的key
75
+ *
76
+ * 该属性内部未做处理,仅为传递作用
77
+ */
78
+ customInputStoreKey?: string;
79
+ /**
80
+ * (可选)校验自定义输入内容
81
+ * @default () => {valid: true}
82
+ */
83
+ onValid?(dataOption: PopsPanelSelectDataOption<T>): {
84
+ /**
85
+ *
86
+ * + true: 校验通过
87
+ * + false: 校验失败,阻止关闭弹窗
88
+ */
89
+ valid: boolean;
90
+ message?: string;
91
+ };
92
+ };
4
93
  /**
5
94
  * pops.panel的 select
6
95
  */
7
- export interface PopsPanelSelectConfig<T = any> extends PopsPanelGeneralConfig<PopsPanelSelectConfig> {
96
+ export interface PopsPanelSelectConfig<T = any> extends PopsPanelGeneralConfig<PopsPanelSelectConfig<T>> {
8
97
  /**
9
- * 类型
98
+ * 组件类型
10
99
  */
11
100
  type: "select";
12
101
  /**
@@ -22,46 +111,53 @@ export interface PopsPanelSelectConfig<T = any> extends PopsPanelGeneralConfig<P
22
111
  * (可选)是否禁用
23
112
  * @default false
24
113
  */
25
- disabled?: boolean | (() => boolean);
114
+ disabled?: IFunction<boolean>;
115
+ /**
116
+ * 提示文字
117
+ */
118
+ placeholder?: IFunction<string>;
119
+ /**
120
+ * 已选中文字的显示文字的对齐方式
121
+ *
122
+ * 也包括提示文字的对齐方式
123
+ * @default "left"
124
+ */
125
+ selectedTextAlign?: "left" | "center" | "right";
26
126
  /**
27
127
  * 获取该项的值的回调函数
28
128
  */
29
129
  getValue(): T;
30
130
  /**
31
131
  * 选择器的值改变触发的回调函数
32
- * @param event 事件
33
- * @param isSelectedValue 当前选中的值,也就是元素属性上的__value__
34
- * @param isSelectedText 当前选中的文本
132
+ * @param isSelectedInfo 当前已选中的信息,可能为空
35
133
  */
36
- callback?(event: PointerEvent | TouchEvent, isSelectedValue: T, isSelectedText: string): void;
134
+ callback?(isSelectedInfo?: PopsPanelSelectDataOption<T>): void;
37
135
  /**
38
136
  * 点击select元素触发该回调
39
137
  * @param event 点击事件
40
138
  * @param selectElement 当前的select元素
139
+ * @returns
140
+ * + false 阻止更新状态
41
141
  */
42
- clickCallBack?(event: PointerEvent | MouseEvent, selectElement: HTMLSelectElement): void;
142
+ clickCallBack?(event: PointerEvent | MouseEvent,
143
+ /** 当前已选中的信息 */
144
+ isSelectedInfo: PopsPanelSelectDataOption<T>): void | boolean;
43
145
  /**
44
- * 选择器内的数据组
146
+ * 选择列表内的数据
45
147
  */
46
- data: {
47
- /**
48
- * 真正的值
49
- */
50
- value: T;
51
- /**
52
- * 显示的文字
53
- */
54
- text: string;
55
- /**
56
- * (可选)是否禁用项
57
- * 触发条件:
58
- * + 点击select元素
59
- * + select元素触发change事件
60
- */
61
- disable?(value: T): boolean;
62
- /**
63
- * 子配置,跟随切换改变
64
- */
65
- views?: (PopsPanelContainerConfig | PopsPanelViewConfig)[] | (() => (PopsPanelContainerConfig | PopsPanelViewConfig)[]);
66
- }[];
148
+ data: IFunction<PopsPanelSelectDataOption<T>[]>;
149
+ /**
150
+ * 显示模式
151
+ * @default "native"
152
+ */
153
+ mode?: PopsPanelSelectMode;
154
+ /**
155
+ * 宽度
156
+ * @default "200px"
157
+ */
158
+ width?: number | string;
159
+ /**
160
+ * 弹出的下拉列表弹窗的配置
161
+ */
162
+ selectConfirmDialogConfig?: Partial<PopsAlertConfig>;
67
163
  }
@@ -31,9 +31,9 @@ export interface PopsPanelSelectMultipleDataOption<T> {
31
31
  /**
32
32
  * pops.panel的 select
33
33
  */
34
- export interface PopsPanelSelectMultipleConfig<T = any> extends PopsPanelGeneralConfig<PopsPanelSelectMultipleConfig> {
34
+ export interface PopsPanelSelectMultipleConfig<T = any> extends PopsPanelGeneralConfig<PopsPanelSelectMultipleConfig<T>> {
35
35
  /**
36
- * 类型
36
+ * 组件类型
37
37
  */
38
38
  type: "select-multiple";
39
39
  /**
@@ -56,28 +56,19 @@ export interface PopsPanelSelectMultipleConfig<T = any> extends PopsPanelGeneral
56
56
  * 获取该项的值的回调函数
57
57
  */
58
58
  getValue(): T[];
59
- /**
60
- * 弹出的下拉列表弹窗的配置
61
- */
62
- selectConfirmDialogConfig?: Partial<PopsAlertConfig>;
63
59
  /**
64
60
  * 选择器的值改变触发的回调函数
65
- * @param event 事件
66
- * @param isSelectedValue 当前选中的值,也就是元素属性上的__value__
67
- * @param isSelectedText 当前选中的文本
61
+ * @param isSelectedInfo 当前已选中的信息
68
62
  */
69
- callback?(
70
- /** 当前已选中的信息 */
71
- isSelectedInfo: PopsPanelSelectMultipleDataOption<any>[]): void;
63
+ callback?(isSelectedInfo: PopsPanelSelectMultipleDataOption<T>[]): void;
72
64
  /**
73
65
  * 点击某个项的元素触发该回调
74
66
  * @param event 点击事件
75
- * @param selectElement 当前的选中的元素
76
67
  * @returns 如果返回boolean为false,则不会触发默认的点击事件
77
68
  */
78
69
  clickCallBack?(event: PointerEvent | MouseEvent,
79
70
  /** 当前已选中的信息 */
80
- isSelectedInfo: PopsPanelSelectMultipleDataOption<any>[]): void | boolean;
71
+ isSelectedInfo: PopsPanelSelectMultipleDataOption<T>[]): void | boolean;
81
72
  /**
82
73
  * 点击标签tag的关闭图标触发该回调
83
74
  * 如果返回boolean类型且为false,则阻止默认的事件
@@ -93,7 +84,11 @@ export interface PopsPanelSelectMultipleConfig<T = any> extends PopsPanelGeneral
93
84
  text: PopsPanelSelectMultipleDataOption<T>["text"];
94
85
  }) => void | boolean;
95
86
  /**
96
- * 选择器内的数据组
87
+ * 选择列表内的数据
97
88
  */
98
89
  data: PopsPanelSelectMultipleDataOption<T>[];
90
+ /**
91
+ * 弹出的下拉列表弹窗的配置
92
+ */
93
+ selectConfirmDialogConfig?: Partial<PopsAlertConfig>;
99
94
  }
@@ -4,8 +4,7 @@ import type { PopsPanelGeneralConfig } from "./components-common";
4
4
  */
5
5
  export interface PopsPanelSliderConfig extends PopsPanelGeneralConfig<PopsPanelSliderConfig> {
6
6
  /**
7
- * 类型
8
- * @default "slider"
7
+ * 组件类型
9
8
  */
10
9
  type: "slider";
11
10
  /**
@@ -38,7 +37,7 @@ export interface PopsPanelSliderConfig extends PopsPanelGeneralConfig<PopsPanelS
38
37
  /**
39
38
  * 获取tooltip的提示内容,可自定义,默认为slider的值
40
39
  */
41
- getToolTipContent?: (value: number) => string;
40
+ getToolTipContent?(value: number): string;
42
41
  /**
43
42
  * 滑块的最小值
44
43
  */
@@ -4,7 +4,7 @@ import type { PopsPanelGeneralConfig } from "./components-common";
4
4
  */
5
5
  export interface PopsPanelSwitchConfig extends PopsPanelGeneralConfig<PopsPanelSwitchConfig> {
6
6
  /**
7
- * 类型
7
+ * 组件类型
8
8
  */
9
9
  type: "switch";
10
10
  /**
@@ -4,7 +4,7 @@ import type { PopsPanelGeneralConfig } from "./components-common";
4
4
  */
5
5
  export interface PopsPanelTextAreaConfig extends PopsPanelGeneralConfig<PopsPanelTextAreaConfig> {
6
6
  /**
7
- * 类型
7
+ * 组件类型
8
8
  */
9
9
  type: "textarea";
10
10
  /**
@@ -79,9 +79,9 @@ export declare const PopsSearchSuggestion: {
79
79
  setSearchItemClickEvent($searchItem: HTMLLIElement): void;
80
80
  /**
81
81
  * 设置搜索建议框每一项的选中事件
82
- * @param liElement
82
+ * @param $li 每一项元素
83
83
  */
84
- setSearchItemSelectEvent(liElement: HTMLLIElement): void;
84
+ setSearchItemSelectEvent($li: HTMLLIElement): void;
85
85
  /**
86
86
  * 监听输入框内容改变
87
87
  */
@@ -89,7 +89,7 @@ export declare const PopsSearchSuggestion: {
89
89
  /**
90
90
  * 移除输入框内容改变的监听
91
91
  */
92
- removeInputChangeEvent(option?: AddEventListenerOptions): void;
92
+ removeInputChangeEvent(): void;
93
93
  /**
94
94
  * 显示搜索建议框的事件
95
95
  */
@@ -26,4 +26,6 @@ declare type DeepRequired<T> = T extends any[]
26
26
  }
27
27
  : T;
28
28
 
29
- declare type IPromise<T> = Promise<T> | T;
29
+ declare type IPromise<T> = T | Promise<T>;
30
+
31
+ declare type IFunction<T> = T | (() => T);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/pops",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "弹窗库,包含了alert、confirm、prompt、drawer、loading、iframe、rightClickMenu等组件",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/WhiteSevs/TamperMonkeyScript/tree/master/lib/pops#readme",
@@ -44,25 +44,25 @@
44
44
  "worker-timers": "^8.0.25"
45
45
  },
46
46
  "devDependencies": {
47
- "@eslint/js": "^9.39.0",
47
+ "@eslint/js": "^9.39.1",
48
48
  "@rollup/plugin-commonjs": "^29.0.0",
49
49
  "@rollup/plugin-json": "^6.1.0",
50
50
  "@rollup/plugin-node-resolve": "^16.0.3",
51
51
  "@rollup/plugin-terser": "^0.4.4",
52
52
  "@rollup/plugin-typescript": "12.3.0",
53
- "browserslist": "^4.27.0",
54
- "caniuse-lite": "^1.0.30001753",
55
- "eslint": "^9.39.0",
53
+ "browserslist": "^4.28.0",
54
+ "caniuse-lite": "^1.0.30001756",
55
+ "eslint": "^9.39.1",
56
56
  "eslint-config-prettier": "^10.1.8",
57
57
  "eslint-plugin-compat": "^6.0.2",
58
58
  "eslint-plugin-prettier": "^5.5.4",
59
59
  "globals": "^16.5.0",
60
- "rollup": "^4.52.5",
60
+ "rollup": "^4.53.3",
61
61
  "rollup-plugin-clear": "^2.0.7",
62
- "rollup-plugin-import-css": "^4.1.1",
62
+ "rollup-plugin-import-css": "^4.1.2",
63
63
  "tslib": "^2.8.1",
64
64
  "typescript": "^5.9.3",
65
- "typescript-eslint": "^8.46.2"
65
+ "typescript-eslint": "^8.47.0"
66
66
  },
67
67
  "scripts": {
68
68
  "lint": "eslint .",
package/src/PopsCSS.ts CHANGED
@@ -14,6 +14,7 @@ import drawerCSS from "./components/drawer/index.css";
14
14
  import folderCSS from "./components/folder/index.css";
15
15
  import panelCSS from "./components/panel/index.css";
16
16
  import rightClickMenuCSS from "./components/rightClickMenu/index.css";
17
+ import panelComponents_Select_CSS from "./components/panel/css/components-select.css";
17
18
 
18
19
  export const PopsCSS = {
19
20
  /** 主CSS */
@@ -44,8 +45,10 @@ export const PopsCSS = {
44
45
  drawerCSS: drawerCSS,
45
46
  /** pops.folder */
46
47
  folderCSS: folderCSS,
47
- /** pops.folder */
48
+ /** pops.panel */
48
49
  panelCSS: panelCSS,
49
50
  /** pops.rightClickMenu */
50
51
  rightClickMenu: rightClickMenuCSS,
52
+ /** pops.panel的select组件 */
53
+ panelComponents_Select: panelComponents_Select_CSS,
51
54
  };
@@ -0,0 +1,84 @@
1
+ .pops {
2
+ max-height: 300px;
3
+ }
4
+ .select-container {
5
+ --el-font-size-base: 14px;
6
+ --el-text-color-regular: #606266;
7
+ --el-color-primary: #409eff;
8
+ --el-fill-color-light: #f5f7fa;
9
+ --el-disable-color: #a8abb2;
10
+ }
11
+ .select-item {
12
+ cursor: pointer;
13
+ font-size: var(--el-font-size-base);
14
+ padding: 0 20px 0 20px;
15
+ position: relative;
16
+ white-space: nowrap;
17
+ overflow: hidden;
18
+ text-overflow: ellipsis;
19
+ color: var(--el-text-color-regular);
20
+ min-height: 34px;
21
+ display: flex;
22
+ flex-direction: column;
23
+ justify-content: center;
24
+ align-items: flex-start;
25
+ box-sizing: border-box;
26
+ }
27
+ .select-item[aria-disabled],
28
+ .select-item[disabled] {
29
+ cursor: not-allowed;
30
+ color: var(--el-disable-color);
31
+ background: unset;
32
+ }
33
+ .select-item:hover {
34
+ background-color: var(--el-fill-color-light);
35
+ }
36
+ .select-item.select-item-is-selected:has(.pops-panel-input input) {
37
+ background-color: #e7e7e7;
38
+ }
39
+ .select-item.select-item-is-selected {
40
+ color: var(--el-color-primary);
41
+ font-weight: 700;
42
+ }
43
+ .select-item.select-item-is-selected:not(:has(.pops-panel-input))::after {
44
+ content: "";
45
+ position: absolute;
46
+ top: 50%;
47
+ right: 12px;
48
+ border-top: none;
49
+ border-right: none;
50
+ background-repeat: no-repeat;
51
+ background-position: center;
52
+ background-color: var(--el-color-primary);
53
+ mask: url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E")
54
+ no-repeat;
55
+ mask-size: 100% 100%;
56
+ -webkit-mask: url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E")
57
+ no-repeat;
58
+ -webkit-mask-size: 100% 100%;
59
+ transform: translateY(-50%);
60
+ width: 12px;
61
+ height: 12px;
62
+ }
63
+
64
+ .select-item .pops-panel-input {
65
+ width: 100%;
66
+ margin: 5px 0px;
67
+ }
68
+ .select-item .pops-panel-input:has(.pops-panel-input-valid-error) {
69
+ margin-bottom: 0px;
70
+ }
71
+
72
+ .select-item .select-item-text {
73
+ white-space: nowrap;
74
+ text-overflow: ellipsis;
75
+ overflow: hidden;
76
+ }
77
+
78
+ @media (prefers-color-scheme: dark) {
79
+ .select-container {
80
+ --el-text-color-regular: #f2f2f2;
81
+ --el-disable-color: #8d9095;
82
+ --el-fill-color-light: #262727;
83
+ }
84
+ }