@cyberpunk-vue/components 1.12.7 → 1.13.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.
- package/dist/dropdown/index.d.ts +29 -45
- package/dist/dropdown/src/dropdown.d.ts +25 -194
- package/dist/dropdown/src/instance.d.ts +4 -13
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1125 -335
- package/dist/pagination/index.d.ts +1 -1
- package/dist/pagination/src/pagination.vue.d.ts +2 -2
- package/dist/select/index.d.ts +421 -0
- package/dist/select/src/instance.d.ts +16 -0
- package/dist/select/src/select.d.ts +280 -0
- package/dist/{dropdown/src/dropdown.vue.d.ts → select/src/select.vue.d.ts} +16 -16
- package/package.json +5 -4
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import { Size } from '@cyberpunk-vue/hooks';
|
|
3
|
+
/**
|
|
4
|
+
* 选项类型
|
|
5
|
+
*/
|
|
6
|
+
export interface SelectOption {
|
|
7
|
+
/**
|
|
8
|
+
* 显示文本
|
|
9
|
+
*/
|
|
10
|
+
label: string;
|
|
11
|
+
/**
|
|
12
|
+
* 选项值
|
|
13
|
+
*/
|
|
14
|
+
value: string | number;
|
|
15
|
+
/**
|
|
16
|
+
* 是否禁用该选项
|
|
17
|
+
*/
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 选择器尺寸
|
|
22
|
+
* - `sm` - 小尺寸 (28px 高)
|
|
23
|
+
* - `md` - 中等尺寸 (36px 高),默认
|
|
24
|
+
* - `lg` - 大尺寸 (44px 高)
|
|
25
|
+
* - 也支持数字 (px) 或带单位字符串 (如 '2rem')
|
|
26
|
+
*/
|
|
27
|
+
export type SelectSize = Size;
|
|
28
|
+
/**
|
|
29
|
+
* 选择器形状
|
|
30
|
+
* - `clip` - 切角样式(默认,赛博朋克特色)
|
|
31
|
+
* - `no-clip` - 直角矩形
|
|
32
|
+
* - `round` - 圆角矩形
|
|
33
|
+
*/
|
|
34
|
+
export type SelectShape = 'clip' | 'no-clip' | 'round';
|
|
35
|
+
/**
|
|
36
|
+
* 选择器变体
|
|
37
|
+
* - `outline` - 边框样式(默认),透明背景
|
|
38
|
+
* - `filled` - 填充样式,带背景色
|
|
39
|
+
* - `ghost` - 幽灵样式,无边框无背景
|
|
40
|
+
*/
|
|
41
|
+
export type SelectVariant = 'outline' | 'filled' | 'ghost';
|
|
42
|
+
/**
|
|
43
|
+
* 弹出位置
|
|
44
|
+
*/
|
|
45
|
+
export type SelectPlacement = 'bottom' | 'bottom-start' | 'bottom-end' | 'top' | 'top-start' | 'top-end';
|
|
46
|
+
/**
|
|
47
|
+
* CpSelect 组件 Props 定义
|
|
48
|
+
*
|
|
49
|
+
* @description 赛博朋克风格下拉选择器,支持多种尺寸、形态变体、可搜索/可清空功能。
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```vue
|
|
53
|
+
* <!-- 基础用法 -->
|
|
54
|
+
* <CpSelect v-model="value" :options="options" placeholder="请选择" />
|
|
55
|
+
*
|
|
56
|
+
* <!-- 可搜索 -->
|
|
57
|
+
* <CpSelect v-model="value" :options="options" filterable />
|
|
58
|
+
*
|
|
59
|
+
* <!-- 可清空 -->
|
|
60
|
+
* <CpSelect v-model="value" :options="options" clearable />
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @slots
|
|
64
|
+
* - `default` - 自定义选项内容
|
|
65
|
+
* - `prefix` - 触发器前缀
|
|
66
|
+
* - `empty` - 无选项时的空状态
|
|
67
|
+
*
|
|
68
|
+
* @exposes
|
|
69
|
+
* - `focus()` - 使下拉框获取焦点
|
|
70
|
+
* - `blur()` - 使下拉框失去焦点
|
|
71
|
+
* - `open()` - 打开下拉面板
|
|
72
|
+
* - `close()` - 关闭下拉面板
|
|
73
|
+
* @category 表单组件
|
|
74
|
+
* @displayName CpSelect 下拉选择
|
|
75
|
+
*/
|
|
76
|
+
export declare const selectProps: {
|
|
77
|
+
/**
|
|
78
|
+
* 绑定值 (v-model)
|
|
79
|
+
* @default ''
|
|
80
|
+
*/
|
|
81
|
+
readonly modelValue: {
|
|
82
|
+
readonly type: PropType<string | number>;
|
|
83
|
+
readonly default: "";
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* 选项列表
|
|
87
|
+
* @default []
|
|
88
|
+
*/
|
|
89
|
+
readonly options: {
|
|
90
|
+
readonly type: PropType<SelectOption[]>;
|
|
91
|
+
readonly default: () => never[];
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* 占位文本
|
|
95
|
+
* @default '请选择'
|
|
96
|
+
*/
|
|
97
|
+
readonly placeholder: {
|
|
98
|
+
readonly type: StringConstructor;
|
|
99
|
+
readonly default: "请选择";
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* 搜索框占位文本 (仅在面板开启搜索时有效)
|
|
103
|
+
* @default '搜索...'
|
|
104
|
+
*/
|
|
105
|
+
readonly filterPlaceholder: {
|
|
106
|
+
readonly type: StringConstructor;
|
|
107
|
+
readonly default: "搜索...";
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* 是否禁用
|
|
111
|
+
* @default false
|
|
112
|
+
*/
|
|
113
|
+
readonly disabled: {
|
|
114
|
+
readonly type: BooleanConstructor;
|
|
115
|
+
readonly default: false;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* 是否可清空
|
|
119
|
+
* @default false
|
|
120
|
+
*/
|
|
121
|
+
readonly clearable: {
|
|
122
|
+
readonly type: BooleanConstructor;
|
|
123
|
+
readonly default: false;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* 是否可搜索过滤
|
|
127
|
+
* @default false
|
|
128
|
+
*/
|
|
129
|
+
readonly filterable: {
|
|
130
|
+
readonly type: BooleanConstructor;
|
|
131
|
+
readonly default: false;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* 选择器尺寸
|
|
135
|
+
* @default 'md'
|
|
136
|
+
*/
|
|
137
|
+
readonly size: {
|
|
138
|
+
readonly type: PropType<SelectSize>;
|
|
139
|
+
readonly default: "md";
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* 选择器形状
|
|
143
|
+
* @default 'clip'
|
|
144
|
+
*/
|
|
145
|
+
readonly shape: {
|
|
146
|
+
readonly type: PropType<SelectShape>;
|
|
147
|
+
readonly default: "clip";
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* 选择器变体
|
|
151
|
+
* @default 'outline'
|
|
152
|
+
*/
|
|
153
|
+
readonly variant: {
|
|
154
|
+
readonly type: PropType<SelectVariant>;
|
|
155
|
+
readonly default: "outline";
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* 自定义聚焦颜色
|
|
159
|
+
* @default ''
|
|
160
|
+
*/
|
|
161
|
+
readonly color: {
|
|
162
|
+
readonly type: StringConstructor;
|
|
163
|
+
readonly default: "";
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* 未激活状态边框颜色
|
|
167
|
+
* @default ''
|
|
168
|
+
*/
|
|
169
|
+
readonly inactiveColor: {
|
|
170
|
+
readonly type: StringConstructor;
|
|
171
|
+
readonly default: "";
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* Placeholder 文字颜色
|
|
175
|
+
* @default ''
|
|
176
|
+
*/
|
|
177
|
+
readonly placeholderColor: {
|
|
178
|
+
readonly type: StringConstructor;
|
|
179
|
+
readonly default: "";
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* 是否启用行内搜索 (直接在触发器输入)
|
|
183
|
+
* @default false
|
|
184
|
+
*/
|
|
185
|
+
readonly inline: {
|
|
186
|
+
readonly type: BooleanConstructor;
|
|
187
|
+
readonly default: false;
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* 弹出位置
|
|
191
|
+
* @default 'bottom-start'
|
|
192
|
+
*/
|
|
193
|
+
readonly placement: {
|
|
194
|
+
readonly type: PropType<SelectPlacement>;
|
|
195
|
+
readonly default: "bottom-start";
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Teleport 目标
|
|
199
|
+
* @default 'body'
|
|
200
|
+
*/
|
|
201
|
+
readonly teleportTo: {
|
|
202
|
+
readonly type: PropType<string | HTMLElement>;
|
|
203
|
+
readonly default: "body";
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* 下拉面板最大高度 (px)
|
|
207
|
+
* @default 256
|
|
208
|
+
*/
|
|
209
|
+
readonly maxHeight: {
|
|
210
|
+
readonly type: NumberConstructor;
|
|
211
|
+
readonly default: 256;
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* 无匹配时的文本
|
|
215
|
+
* @default '无匹配数据'
|
|
216
|
+
*/
|
|
217
|
+
readonly noMatchText: {
|
|
218
|
+
readonly type: StringConstructor;
|
|
219
|
+
readonly default: "无匹配数据";
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* 无数据时的文本
|
|
223
|
+
* @default '无数据'
|
|
224
|
+
*/
|
|
225
|
+
readonly noDataText: {
|
|
226
|
+
readonly type: StringConstructor;
|
|
227
|
+
readonly default: "无数据";
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* 清除动画持续时间 (ms)
|
|
231
|
+
* 控制点击清空按钮时文字消失动画的速度
|
|
232
|
+
* @default 150
|
|
233
|
+
* @example `<CpSelect :clear-duration="300" />`
|
|
234
|
+
*/
|
|
235
|
+
readonly clearDuration: {
|
|
236
|
+
readonly type: NumberConstructor;
|
|
237
|
+
readonly default: 150;
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* 选择器宽度
|
|
241
|
+
* 支持数字 (px) 或带单位字符串 (如 '200px', '15rem')。
|
|
242
|
+
* 为空时默认 100%(铺满父容器)。
|
|
243
|
+
* @default ''
|
|
244
|
+
*/
|
|
245
|
+
readonly width: {
|
|
246
|
+
readonly type: PropType<string | number>;
|
|
247
|
+
readonly default: "";
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
export type SelectProps = ExtractPropTypes<typeof selectProps>;
|
|
251
|
+
/**
|
|
252
|
+
* CpSelect 组件事件定义
|
|
253
|
+
*/
|
|
254
|
+
export declare const selectEmits: {
|
|
255
|
+
/**
|
|
256
|
+
* 值变化时触发 (v-model 绑定)
|
|
257
|
+
*/
|
|
258
|
+
'update:modelValue': (value: string | number) => boolean;
|
|
259
|
+
/**
|
|
260
|
+
* 选中值变化时触发
|
|
261
|
+
*/
|
|
262
|
+
change: (value: string | number) => boolean;
|
|
263
|
+
/**
|
|
264
|
+
* 清空时触发
|
|
265
|
+
*/
|
|
266
|
+
clear: () => boolean;
|
|
267
|
+
/**
|
|
268
|
+
* 获取焦点时触发
|
|
269
|
+
*/
|
|
270
|
+
focus: () => boolean;
|
|
271
|
+
/**
|
|
272
|
+
* 失去焦点时触发
|
|
273
|
+
*/
|
|
274
|
+
blur: () => boolean;
|
|
275
|
+
/**
|
|
276
|
+
* 下拉面板显示时触发
|
|
277
|
+
*/
|
|
278
|
+
visibleChange: (visible: boolean) => boolean;
|
|
279
|
+
};
|
|
280
|
+
export type SelectEmits = typeof selectEmits;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SelectOption } from './select';
|
|
2
2
|
declare function __VLS_template(): {
|
|
3
3
|
attrs: Partial<{}>;
|
|
4
4
|
slots: {
|
|
5
5
|
prefix?(_: {}): any;
|
|
6
6
|
empty?(_: {}): any;
|
|
7
7
|
default?(_: {
|
|
8
|
-
option:
|
|
8
|
+
option: SelectOption;
|
|
9
9
|
}): any;
|
|
10
10
|
};
|
|
11
11
|
refs: {
|
|
@@ -23,7 +23,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
23
23
|
readonly default: "";
|
|
24
24
|
};
|
|
25
25
|
readonly options: {
|
|
26
|
-
readonly type: import('vue').PropType<
|
|
26
|
+
readonly type: import('vue').PropType<SelectOption[]>;
|
|
27
27
|
readonly default: () => never[];
|
|
28
28
|
};
|
|
29
29
|
readonly placeholder: {
|
|
@@ -47,15 +47,15 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
47
47
|
readonly default: false;
|
|
48
48
|
};
|
|
49
49
|
readonly size: {
|
|
50
|
-
readonly type: import('vue').PropType<import('./
|
|
50
|
+
readonly type: import('vue').PropType<import('./select').SelectSize>;
|
|
51
51
|
readonly default: "md";
|
|
52
52
|
};
|
|
53
53
|
readonly shape: {
|
|
54
|
-
readonly type: import('vue').PropType<import('./
|
|
54
|
+
readonly type: import('vue').PropType<import('./select').SelectShape>;
|
|
55
55
|
readonly default: "clip";
|
|
56
56
|
};
|
|
57
57
|
readonly variant: {
|
|
58
|
-
readonly type: import('vue').PropType<import('./
|
|
58
|
+
readonly type: import('vue').PropType<import('./select').SelectVariant>;
|
|
59
59
|
readonly default: "outline";
|
|
60
60
|
};
|
|
61
61
|
readonly color: {
|
|
@@ -75,7 +75,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
75
75
|
readonly default: false;
|
|
76
76
|
};
|
|
77
77
|
readonly placement: {
|
|
78
|
-
readonly type: import('vue').PropType<import('./
|
|
78
|
+
readonly type: import('vue').PropType<import('./select').SelectPlacement>;
|
|
79
79
|
readonly default: "bottom-start";
|
|
80
80
|
};
|
|
81
81
|
readonly teleportTo: {
|
|
@@ -126,7 +126,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
126
126
|
readonly default: "";
|
|
127
127
|
};
|
|
128
128
|
readonly options: {
|
|
129
|
-
readonly type: import('vue').PropType<
|
|
129
|
+
readonly type: import('vue').PropType<SelectOption[]>;
|
|
130
130
|
readonly default: () => never[];
|
|
131
131
|
};
|
|
132
132
|
readonly placeholder: {
|
|
@@ -150,15 +150,15 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
150
150
|
readonly default: false;
|
|
151
151
|
};
|
|
152
152
|
readonly size: {
|
|
153
|
-
readonly type: import('vue').PropType<import('./
|
|
153
|
+
readonly type: import('vue').PropType<import('./select').SelectSize>;
|
|
154
154
|
readonly default: "md";
|
|
155
155
|
};
|
|
156
156
|
readonly shape: {
|
|
157
|
-
readonly type: import('vue').PropType<import('./
|
|
157
|
+
readonly type: import('vue').PropType<import('./select').SelectShape>;
|
|
158
158
|
readonly default: "clip";
|
|
159
159
|
};
|
|
160
160
|
readonly variant: {
|
|
161
|
-
readonly type: import('vue').PropType<import('./
|
|
161
|
+
readonly type: import('vue').PropType<import('./select').SelectVariant>;
|
|
162
162
|
readonly default: "outline";
|
|
163
163
|
};
|
|
164
164
|
readonly color: {
|
|
@@ -178,7 +178,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
178
178
|
readonly default: false;
|
|
179
179
|
};
|
|
180
180
|
readonly placement: {
|
|
181
|
-
readonly type: import('vue').PropType<import('./
|
|
181
|
+
readonly type: import('vue').PropType<import('./select').SelectPlacement>;
|
|
182
182
|
readonly default: "bottom-start";
|
|
183
183
|
};
|
|
184
184
|
readonly teleportTo: {
|
|
@@ -216,9 +216,9 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
216
216
|
readonly size: import('@cyberpunk-vue/hooks').Size;
|
|
217
217
|
readonly width: string | number;
|
|
218
218
|
readonly color: string;
|
|
219
|
-
readonly variant: import('./
|
|
219
|
+
readonly variant: import('./select').SelectVariant;
|
|
220
220
|
readonly disabled: boolean;
|
|
221
|
-
readonly shape: import('./
|
|
221
|
+
readonly shape: import('./select').SelectShape;
|
|
222
222
|
readonly inline: boolean;
|
|
223
223
|
readonly placeholder: string;
|
|
224
224
|
readonly modelValue: string | number;
|
|
@@ -228,8 +228,8 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
228
228
|
readonly maxHeight: number;
|
|
229
229
|
readonly inactiveColor: string;
|
|
230
230
|
readonly teleportTo: string | HTMLElement;
|
|
231
|
-
readonly placement: import('./
|
|
232
|
-
readonly options:
|
|
231
|
+
readonly placement: import('./select').SelectPlacement;
|
|
232
|
+
readonly options: SelectOption[];
|
|
233
233
|
readonly filterPlaceholder: string;
|
|
234
234
|
readonly filterable: boolean;
|
|
235
235
|
readonly noMatchText: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyberpunk-vue/components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.2",
|
|
4
4
|
"description": "Cyberpunk Vue components - A futuristic Vue 3 component library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -23,9 +23,10 @@
|
|
|
23
23
|
"vue": "^3.5.0"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@
|
|
27
|
-
"@cyberpunk-vue/
|
|
28
|
-
"@cyberpunk-vue/
|
|
26
|
+
"@floating-ui/dom": "^1.7.6",
|
|
27
|
+
"@cyberpunk-vue/hooks": "1.13.2",
|
|
28
|
+
"@cyberpunk-vue/theme-chalk": "1.13.2",
|
|
29
|
+
"@cyberpunk-vue/constants": "1.13.2"
|
|
29
30
|
},
|
|
30
31
|
"author": "Juxest",
|
|
31
32
|
"license": "MIT",
|