@cyberpunk-vue/components 1.13.6 → 1.13.7

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.
@@ -0,0 +1,657 @@
1
+ import { ExtractPropTypes, PropType } from 'vue';
2
+ import { Placement } from '@floating-ui/dom';
3
+ import { Size } from '@cyberpunk-vue/hooks';
4
+ export type PickerType = 'date' | 'dates' | 'week' | 'month' | 'year' | 'daterange' | 'monthrange' | 'yearrange' | 'time' | 'timerange' | 'datetime' | 'datetimerange';
5
+ export type PickerSize = Size;
6
+ export type PickerShape = 'clip' | 'no-clip' | 'round';
7
+ export type PickerVariant = 'outline' | 'filled' | 'ghost';
8
+ export type PickerValueItem = string | number | Date;
9
+ export type PickerModelValue = PickerValueItem | PickerValueItem[] | null | undefined;
10
+ export type PickerRangeRole = 'start' | 'end';
11
+ export interface PickerShortcut {
12
+ /** 快捷项显示文本 */
13
+ text: string;
14
+ /** 快捷项值,可以是静态值或返回值的函数 */
15
+ value: PickerModelValue | (() => PickerModelValue);
16
+ }
17
+ export interface PickerCell {
18
+ /** 单元格对应日期 */
19
+ date: Date;
20
+ /** 单元格显示文本 */
21
+ label: string;
22
+ /** 是否为当前视图范围外的日期 */
23
+ outside: boolean;
24
+ /** 是否为今天 */
25
+ today: boolean;
26
+ /** 是否被选中 */
27
+ selected: boolean;
28
+ /** 是否处于范围内 */
29
+ inRange: boolean;
30
+ /** 是否为范围起点 */
31
+ rangeStart: boolean;
32
+ /** 是否为范围终点 */
33
+ rangeEnd: boolean;
34
+ /** 是否禁用 */
35
+ disabled: boolean;
36
+ }
37
+ export type DisabledTimeResolver = (role?: PickerRangeRole) => number[];
38
+ /**
39
+ * CpDatePickerSelect 组件 Props 定义
40
+ *
41
+ * @description 输入框弹层日期选择器,支持日期、多日期、周、月、年以及日期范围选择。
42
+ *
43
+ * @example
44
+ * ```vue
45
+ * <CpDatePickerSelect v-model="date" value-format="YYYY-MM-DD" />
46
+ * <CpDatePickerSelect v-model="range" type="daterange" value-format="YYYY-MM-DD" />
47
+ * ```
48
+ *
49
+ * @slots
50
+ * - `prefix` - 触发器前缀内容
51
+ * - `suffix` - 触发器后缀内容
52
+ * - `cell` - 自定义日期单元格内容
53
+ * - `footer` - 自定义面板底部操作区
54
+ *
55
+ * @exposes
56
+ * - `open` - 打开选择器浮层
57
+ * - `close` - 关闭选择器浮层
58
+ * - `toggle` - 切换选择器浮层
59
+ * - `focus` - 聚焦触发器
60
+ * - `blur` - 失焦触发器
61
+ * @category 表单组件
62
+ * @displayName CpDatePickerSelect 日期选择选择器
63
+ */
64
+ export declare const pickerProps: {
65
+ /**
66
+ * 绑定值 (v-model)
67
+ * @default null
68
+ */
69
+ readonly modelValue: {
70
+ readonly type: PropType<PickerModelValue>;
71
+ readonly default: null;
72
+ };
73
+ /**
74
+ * 选择器类型
75
+ * @default 'date'
76
+ */
77
+ readonly type: {
78
+ readonly type: PropType<PickerType>;
79
+ readonly default: "date";
80
+ };
81
+ /**
82
+ * 显示格式,例如 `YYYY-MM-DD HH:mm:ss`
83
+ * @default 按 type 自动推导
84
+ */
85
+ readonly format: {
86
+ readonly type: StringConstructor;
87
+ readonly default: "";
88
+ };
89
+ /**
90
+ * 输出值格式。为空时输出 Date;传入 `timestamp` 时输出时间戳。
91
+ * @default ''
92
+ */
93
+ readonly valueFormat: {
94
+ readonly type: StringConstructor;
95
+ readonly default: "";
96
+ };
97
+ /**
98
+ * 占位文本
99
+ * @default ''
100
+ */
101
+ readonly placeholder: {
102
+ readonly type: StringConstructor;
103
+ readonly default: "";
104
+ };
105
+ /**
106
+ * 范围起始占位文本
107
+ * @default '开始'
108
+ */
109
+ readonly startPlaceholder: {
110
+ readonly type: StringConstructor;
111
+ readonly default: "开始";
112
+ };
113
+ /**
114
+ * 范围结束占位文本
115
+ * @default '结束'
116
+ */
117
+ readonly endPlaceholder: {
118
+ readonly type: StringConstructor;
119
+ readonly default: "结束";
120
+ };
121
+ /**
122
+ * 范围分隔符
123
+ * @default ' - '
124
+ */
125
+ readonly rangeSeparator: {
126
+ readonly type: StringConstructor;
127
+ readonly default: " - ";
128
+ };
129
+ /**
130
+ * 是否禁用
131
+ * @default false
132
+ */
133
+ readonly disabled: {
134
+ readonly type: BooleanConstructor;
135
+ readonly default: false;
136
+ };
137
+ /**
138
+ * 是否只读
139
+ * @default false
140
+ */
141
+ readonly readonly: {
142
+ readonly type: BooleanConstructor;
143
+ readonly default: false;
144
+ };
145
+ /**
146
+ * 是否允许直接输入
147
+ * @default false
148
+ */
149
+ readonly editable: {
150
+ readonly type: BooleanConstructor;
151
+ readonly default: false;
152
+ };
153
+ /**
154
+ * 是否可清空
155
+ * @default true
156
+ */
157
+ readonly clearable: {
158
+ readonly type: BooleanConstructor;
159
+ readonly default: true;
160
+ };
161
+ /**
162
+ * 是否显示确认按钮。未设置时范围、时间和日期时间类型默认需要确认。
163
+ * @default undefined
164
+ */
165
+ readonly confirm: {
166
+ readonly type: PropType<boolean | undefined>;
167
+ readonly default: undefined;
168
+ };
169
+ /**
170
+ * 组件尺寸
171
+ * @default 'md'
172
+ */
173
+ readonly size: {
174
+ readonly type: PropType<PickerSize>;
175
+ readonly default: "md";
176
+ };
177
+ /**
178
+ * 形状模式
179
+ * @default 'clip'
180
+ */
181
+ readonly shape: {
182
+ readonly type: PropType<PickerShape>;
183
+ readonly default: "clip";
184
+ };
185
+ /**
186
+ * 视觉变体
187
+ * @default 'outline'
188
+ */
189
+ readonly variant: {
190
+ readonly type: PropType<PickerVariant>;
191
+ readonly default: "outline";
192
+ };
193
+ /**
194
+ * 自定义主题色
195
+ * @default ''
196
+ */
197
+ readonly color: {
198
+ readonly type: StringConstructor;
199
+ readonly default: "";
200
+ };
201
+ /**
202
+ * 未激活边框颜色
203
+ * @default ''
204
+ */
205
+ readonly inactiveColor: {
206
+ readonly type: StringConstructor;
207
+ readonly default: "";
208
+ };
209
+ /**
210
+ * Placeholder 颜色
211
+ * @default ''
212
+ */
213
+ readonly placeholderColor: {
214
+ readonly type: StringConstructor;
215
+ readonly default: "";
216
+ };
217
+ /**
218
+ * 触发器宽度
219
+ * @default ''
220
+ */
221
+ readonly width: {
222
+ readonly type: PropType<string | number>;
223
+ readonly default: "";
224
+ };
225
+ /**
226
+ * 弹出位置
227
+ * @default 'bottom-start'
228
+ */
229
+ readonly placement: {
230
+ readonly type: PropType<Placement>;
231
+ readonly default: "bottom-start";
232
+ };
233
+ /**
234
+ * Teleport 目标
235
+ * @default 'body'
236
+ */
237
+ readonly teleportTo: {
238
+ readonly type: PropType<string | HTMLElement>;
239
+ readonly default: "body";
240
+ };
241
+ /**
242
+ * 禁用日期判断函数
243
+ */
244
+ readonly disabledDate: {
245
+ readonly type: PropType<(date: Date) => boolean>;
246
+ readonly default: undefined;
247
+ };
248
+ /**
249
+ * 禁用小时列表
250
+ */
251
+ readonly disabledHours: {
252
+ readonly type: PropType<DisabledTimeResolver>;
253
+ readonly default: undefined;
254
+ };
255
+ /**
256
+ * 禁用分钟列表
257
+ */
258
+ readonly disabledMinutes: {
259
+ readonly type: PropType<DisabledTimeResolver>;
260
+ readonly default: undefined;
261
+ };
262
+ /**
263
+ * 禁用秒列表
264
+ */
265
+ readonly disabledSeconds: {
266
+ readonly type: PropType<DisabledTimeResolver>;
267
+ readonly default: undefined;
268
+ };
269
+ /**
270
+ * 小时步长
271
+ * @default 1
272
+ */
273
+ readonly hourStep: {
274
+ readonly type: NumberConstructor;
275
+ readonly default: 1;
276
+ };
277
+ /**
278
+ * 分钟步长
279
+ * @default 1
280
+ */
281
+ readonly minuteStep: {
282
+ readonly type: NumberConstructor;
283
+ readonly default: 1;
284
+ };
285
+ /**
286
+ * 秒步长
287
+ * @default 1
288
+ */
289
+ readonly secondStep: {
290
+ readonly type: NumberConstructor;
291
+ readonly default: 1;
292
+ };
293
+ /**
294
+ * 是否显示秒
295
+ * @default true
296
+ */
297
+ readonly showSeconds: {
298
+ readonly type: BooleanConstructor;
299
+ readonly default: true;
300
+ };
301
+ /**
302
+ * 快捷选项
303
+ * @default []
304
+ */
305
+ readonly shortcuts: {
306
+ readonly type: PropType<PickerShortcut[]>;
307
+ readonly default: () => never[];
308
+ };
309
+ /**
310
+ * 默认展示日期
311
+ */
312
+ readonly defaultValue: {
313
+ readonly type: PropType<PickerValueItem>;
314
+ readonly default: undefined;
315
+ };
316
+ /**
317
+ * 默认时间,支持 `HH:mm:ss` 或范围数组
318
+ * @default undefined
319
+ */
320
+ readonly defaultTime: {
321
+ readonly type: PropType<string | [string, string]>;
322
+ readonly default: undefined;
323
+ };
324
+ /**
325
+ * 范围面板是否解除联动
326
+ * @default false
327
+ */
328
+ readonly unlinkPanels: {
329
+ readonly type: BooleanConstructor;
330
+ readonly default: false;
331
+ };
332
+ };
333
+ export type PickerProps = ExtractPropTypes<typeof pickerProps>;
334
+ export declare const datePickerSelectProps: {
335
+ /**
336
+ * 绑定值 (v-model)
337
+ * @default null
338
+ */
339
+ readonly modelValue: {
340
+ readonly type: PropType<PickerModelValue>;
341
+ readonly default: null;
342
+ };
343
+ /**
344
+ * 选择器类型
345
+ * @default 'date'
346
+ */
347
+ readonly type: {
348
+ readonly type: PropType<PickerType>;
349
+ readonly default: "date";
350
+ };
351
+ /**
352
+ * 显示格式,例如 `YYYY-MM-DD HH:mm:ss`
353
+ * @default 按 type 自动推导
354
+ */
355
+ readonly format: {
356
+ readonly type: StringConstructor;
357
+ readonly default: "";
358
+ };
359
+ /**
360
+ * 输出值格式。为空时输出 Date;传入 `timestamp` 时输出时间戳。
361
+ * @default ''
362
+ */
363
+ readonly valueFormat: {
364
+ readonly type: StringConstructor;
365
+ readonly default: "";
366
+ };
367
+ /**
368
+ * 占位文本
369
+ * @default ''
370
+ */
371
+ readonly placeholder: {
372
+ readonly type: StringConstructor;
373
+ readonly default: "";
374
+ };
375
+ /**
376
+ * 范围起始占位文本
377
+ * @default '开始'
378
+ */
379
+ readonly startPlaceholder: {
380
+ readonly type: StringConstructor;
381
+ readonly default: "开始";
382
+ };
383
+ /**
384
+ * 范围结束占位文本
385
+ * @default '结束'
386
+ */
387
+ readonly endPlaceholder: {
388
+ readonly type: StringConstructor;
389
+ readonly default: "结束";
390
+ };
391
+ /**
392
+ * 范围分隔符
393
+ * @default ' - '
394
+ */
395
+ readonly rangeSeparator: {
396
+ readonly type: StringConstructor;
397
+ readonly default: " - ";
398
+ };
399
+ /**
400
+ * 是否禁用
401
+ * @default false
402
+ */
403
+ readonly disabled: {
404
+ readonly type: BooleanConstructor;
405
+ readonly default: false;
406
+ };
407
+ /**
408
+ * 是否只读
409
+ * @default false
410
+ */
411
+ readonly readonly: {
412
+ readonly type: BooleanConstructor;
413
+ readonly default: false;
414
+ };
415
+ /**
416
+ * 是否允许直接输入
417
+ * @default false
418
+ */
419
+ readonly editable: {
420
+ readonly type: BooleanConstructor;
421
+ readonly default: false;
422
+ };
423
+ /**
424
+ * 是否可清空
425
+ * @default true
426
+ */
427
+ readonly clearable: {
428
+ readonly type: BooleanConstructor;
429
+ readonly default: true;
430
+ };
431
+ /**
432
+ * 是否显示确认按钮。未设置时范围、时间和日期时间类型默认需要确认。
433
+ * @default undefined
434
+ */
435
+ readonly confirm: {
436
+ readonly type: PropType<boolean | undefined>;
437
+ readonly default: undefined;
438
+ };
439
+ /**
440
+ * 组件尺寸
441
+ * @default 'md'
442
+ */
443
+ readonly size: {
444
+ readonly type: PropType<PickerSize>;
445
+ readonly default: "md";
446
+ };
447
+ /**
448
+ * 形状模式
449
+ * @default 'clip'
450
+ */
451
+ readonly shape: {
452
+ readonly type: PropType<PickerShape>;
453
+ readonly default: "clip";
454
+ };
455
+ /**
456
+ * 视觉变体
457
+ * @default 'outline'
458
+ */
459
+ readonly variant: {
460
+ readonly type: PropType<PickerVariant>;
461
+ readonly default: "outline";
462
+ };
463
+ /**
464
+ * 自定义主题色
465
+ * @default ''
466
+ */
467
+ readonly color: {
468
+ readonly type: StringConstructor;
469
+ readonly default: "";
470
+ };
471
+ /**
472
+ * 未激活边框颜色
473
+ * @default ''
474
+ */
475
+ readonly inactiveColor: {
476
+ readonly type: StringConstructor;
477
+ readonly default: "";
478
+ };
479
+ /**
480
+ * Placeholder 颜色
481
+ * @default ''
482
+ */
483
+ readonly placeholderColor: {
484
+ readonly type: StringConstructor;
485
+ readonly default: "";
486
+ };
487
+ /**
488
+ * 触发器宽度
489
+ * @default ''
490
+ */
491
+ readonly width: {
492
+ readonly type: PropType<string | number>;
493
+ readonly default: "";
494
+ };
495
+ /**
496
+ * 弹出位置
497
+ * @default 'bottom-start'
498
+ */
499
+ readonly placement: {
500
+ readonly type: PropType<Placement>;
501
+ readonly default: "bottom-start";
502
+ };
503
+ /**
504
+ * Teleport 目标
505
+ * @default 'body'
506
+ */
507
+ readonly teleportTo: {
508
+ readonly type: PropType<string | HTMLElement>;
509
+ readonly default: "body";
510
+ };
511
+ /**
512
+ * 禁用日期判断函数
513
+ */
514
+ readonly disabledDate: {
515
+ readonly type: PropType<(date: Date) => boolean>;
516
+ readonly default: undefined;
517
+ };
518
+ /**
519
+ * 禁用小时列表
520
+ */
521
+ readonly disabledHours: {
522
+ readonly type: PropType<DisabledTimeResolver>;
523
+ readonly default: undefined;
524
+ };
525
+ /**
526
+ * 禁用分钟列表
527
+ */
528
+ readonly disabledMinutes: {
529
+ readonly type: PropType<DisabledTimeResolver>;
530
+ readonly default: undefined;
531
+ };
532
+ /**
533
+ * 禁用秒列表
534
+ */
535
+ readonly disabledSeconds: {
536
+ readonly type: PropType<DisabledTimeResolver>;
537
+ readonly default: undefined;
538
+ };
539
+ /**
540
+ * 小时步长
541
+ * @default 1
542
+ */
543
+ readonly hourStep: {
544
+ readonly type: NumberConstructor;
545
+ readonly default: 1;
546
+ };
547
+ /**
548
+ * 分钟步长
549
+ * @default 1
550
+ */
551
+ readonly minuteStep: {
552
+ readonly type: NumberConstructor;
553
+ readonly default: 1;
554
+ };
555
+ /**
556
+ * 秒步长
557
+ * @default 1
558
+ */
559
+ readonly secondStep: {
560
+ readonly type: NumberConstructor;
561
+ readonly default: 1;
562
+ };
563
+ /**
564
+ * 是否显示秒
565
+ * @default true
566
+ */
567
+ readonly showSeconds: {
568
+ readonly type: BooleanConstructor;
569
+ readonly default: true;
570
+ };
571
+ /**
572
+ * 快捷选项
573
+ * @default []
574
+ */
575
+ readonly shortcuts: {
576
+ readonly type: PropType<PickerShortcut[]>;
577
+ readonly default: () => never[];
578
+ };
579
+ /**
580
+ * 默认展示日期
581
+ */
582
+ readonly defaultValue: {
583
+ readonly type: PropType<PickerValueItem>;
584
+ readonly default: undefined;
585
+ };
586
+ /**
587
+ * 默认时间,支持 `HH:mm:ss` 或范围数组
588
+ * @default undefined
589
+ */
590
+ readonly defaultTime: {
591
+ readonly type: PropType<string | [string, string]>;
592
+ readonly default: undefined;
593
+ };
594
+ /**
595
+ * 范围面板是否解除联动
596
+ * @default false
597
+ */
598
+ readonly unlinkPanels: {
599
+ readonly type: BooleanConstructor;
600
+ readonly default: false;
601
+ };
602
+ };
603
+ export type DatePickerSelectProps = PickerProps;
604
+ export declare const pickerEmits: {
605
+ /**
606
+ * v-model 更新事件
607
+ */
608
+ 'update:modelValue': (_value: PickerModelValue) => boolean;
609
+ /**
610
+ * 值变化事件
611
+ */
612
+ change: (_value: PickerModelValue) => boolean;
613
+ /**
614
+ * 清空事件
615
+ */
616
+ clear: () => boolean;
617
+ /**
618
+ * 聚焦事件
619
+ */
620
+ focus: (event?: FocusEvent) => boolean;
621
+ /**
622
+ * 失焦事件
623
+ */
624
+ blur: (event?: FocusEvent) => boolean;
625
+ /**
626
+ * 浮层显示状态变化
627
+ */
628
+ visibleChange: (visible: boolean) => boolean;
629
+ };
630
+ export type PickerEmits = typeof pickerEmits;
631
+ export declare const datePickerSelectEmits: {
632
+ /**
633
+ * v-model 更新事件
634
+ */
635
+ 'update:modelValue': (_value: PickerModelValue) => boolean;
636
+ /**
637
+ * 值变化事件
638
+ */
639
+ change: (_value: PickerModelValue) => boolean;
640
+ /**
641
+ * 清空事件
642
+ */
643
+ clear: () => boolean;
644
+ /**
645
+ * 聚焦事件
646
+ */
647
+ focus: (event?: FocusEvent) => boolean;
648
+ /**
649
+ * 失焦事件
650
+ */
651
+ blur: (event?: FocusEvent) => boolean;
652
+ /**
653
+ * 浮层显示状态变化
654
+ */
655
+ visibleChange: (visible: boolean) => boolean;
656
+ };
657
+ export type DatePickerSelectEmits = PickerEmits;