@veltra/mobile 1.1.0 → 1.1.1
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/components/_internal/bottom-sheet/bottom-sheet.js +68 -0
- package/dist/components/_internal/bottom-sheet/bottom-sheet.js.map +1 -0
- package/dist/components/_internal/bottom-sheet/style.d.ts +1 -0
- package/dist/components/_internal/bottom-sheet/style.js +1 -0
- package/dist/components/_internal/bottom-sheet/style2.css +121 -0
- package/dist/components/_internal/overlay-container.js +16 -0
- package/dist/components/_internal/overlay-container.js.map +1 -0
- package/dist/components/avatar/avatar.js +47 -0
- package/dist/components/avatar/avatar.js.map +1 -0
- package/dist/components/avatar/style.d.ts +1 -0
- package/dist/components/avatar/style.js +1 -0
- package/dist/components/avatar/style2.css +68 -0
- package/dist/components/badge/badge.js +66 -0
- package/dist/components/badge/badge.js.map +1 -0
- package/dist/components/badge/style.d.ts +1 -0
- package/dist/components/badge/style.js +1 -0
- package/dist/components/badge/style2.css +94 -0
- package/dist/components/button/button.js +88 -0
- package/dist/components/button/button.js.map +1 -0
- package/dist/components/button/style.d.ts +1 -0
- package/dist/components/button/style.js +1 -0
- package/dist/components/button/style2.css +515 -0
- package/dist/components/card/card.js +31 -0
- package/dist/components/card/card.js.map +1 -0
- package/dist/components/card/style.d.ts +1 -0
- package/dist/components/card/style.js +1 -0
- package/dist/components/card/style2.css +49 -0
- package/dist/components/cascade/cascade.js +539 -0
- package/dist/components/cascade/cascade.js.map +1 -0
- package/dist/components/cascade/node.js +19 -0
- package/dist/components/cascade/node.js.map +1 -0
- package/dist/components/cascade/style.d.ts +1 -0
- package/dist/components/cascade/style.js +2 -0
- package/dist/components/cascade/style2.css +378 -0
- package/dist/components/check-tag/check-tag.js +40 -0
- package/dist/components/check-tag/check-tag.js.map +1 -0
- package/dist/components/check-tag/style.d.ts +1 -0
- package/dist/components/check-tag/style.js +1 -0
- package/dist/components/check-tag/style2.css +60 -0
- package/dist/components/checkbox/checkbox.js +86 -0
- package/dist/components/checkbox/checkbox.js.map +1 -0
- package/dist/components/checkbox/style.d.ts +1 -0
- package/dist/components/checkbox/style.js +2 -0
- package/dist/components/checkbox/style2.css +143 -0
- package/dist/components/checkbox-group/checkbox-group.js +109 -0
- package/dist/components/checkbox-group/checkbox-group.js.map +1 -0
- package/dist/components/checkbox-group/style.d.ts +1 -0
- package/dist/components/checkbox-group/style.js +2 -0
- package/dist/components/checkbox-group/style2.css +73 -0
- package/dist/components/collapse/collapse-item.js +116 -0
- package/dist/components/collapse/collapse-item.js.map +1 -0
- package/dist/components/collapse/collapse.js +94 -0
- package/dist/components/collapse/collapse.js.map +1 -0
- package/dist/components/collapse/di.js +6 -0
- package/dist/components/collapse/di.js.map +1 -0
- package/dist/components/collapse/style.d.ts +1 -0
- package/dist/components/collapse/style.js +1 -0
- package/dist/components/collapse/style2.css +164 -0
- package/dist/components/date-picker/date-picker.js +303 -0
- package/dist/components/date-picker/date-picker.js.map +1 -0
- package/dist/components/date-picker/style.d.ts +1 -0
- package/dist/components/date-picker/style.js +2 -0
- package/dist/components/date-picker/style2.css +221 -0
- package/dist/components/descriptions/descriptions-item.js +15 -0
- package/dist/components/descriptions/descriptions-item.js.map +1 -0
- package/dist/components/descriptions/descriptions.js +49 -0
- package/dist/components/descriptions/descriptions.js.map +1 -0
- package/dist/components/descriptions/style.d.ts +1 -0
- package/dist/components/descriptions/style.js +1 -0
- package/dist/components/descriptions/style2.css +112 -0
- package/dist/components/dialog/dialog.js +157 -0
- package/dist/components/dialog/dialog.js.map +1 -0
- package/dist/components/dialog/style.d.ts +2 -0
- package/dist/components/dialog/style.js +4 -0
- package/dist/components/dialog/style2.css +162 -0
- package/dist/components/divider/divider.js +40 -0
- package/dist/components/divider/divider.js.map +1 -0
- package/dist/components/divider/style.d.ts +1 -0
- package/dist/components/divider/style.js +1 -0
- package/dist/components/divider/style2.css +77 -0
- package/dist/components/drawer/drawer.js +173 -0
- package/dist/components/drawer/drawer.js.map +1 -0
- package/dist/components/drawer/style.d.ts +1 -0
- package/dist/components/drawer/style.js +2 -0
- package/dist/components/drawer/style2.css +251 -0
- package/dist/components/empty/empty.js +25 -0
- package/dist/components/empty/empty.js.map +1 -0
- package/dist/components/empty/style.d.ts +1 -0
- package/dist/components/empty/style.js +1 -0
- package/dist/components/empty/style2.css +50 -0
- package/dist/components/form/form.js +112 -0
- package/dist/components/form/form.js.map +1 -0
- package/dist/components/form/is-field-modified.js +11 -0
- package/dist/components/form/is-field-modified.js.map +1 -0
- package/dist/components/form/style.d.ts +1 -0
- package/dist/components/form/style.js +2 -0
- package/dist/components/form/style2.css +69 -0
- package/dist/components/form/use-form-fields.js +81 -0
- package/dist/components/form/use-form-fields.js.map +1 -0
- package/dist/components/form/use-node-interceptor.js +78 -0
- package/dist/components/form/use-node-interceptor.js.map +1 -0
- package/dist/components/form-item/form-item.js +127 -0
- package/dist/components/form-item/form-item.js.map +1 -0
- package/dist/components/form-item/helper.js +10 -0
- package/dist/components/form-item/helper.js.map +1 -0
- package/dist/components/form-item/style.d.ts +1 -0
- package/dist/components/form-item/style.js +1 -0
- package/dist/components/form-item/style2.css +108 -0
- package/dist/components/form-item/validate.js +96 -0
- package/dist/components/form-item/validate.js.map +1 -0
- package/dist/components/icon/icon.js +25 -0
- package/dist/components/icon/icon.js.map +1 -0
- package/dist/components/icon/style.d.ts +1 -0
- package/dist/components/icon/style.js +1 -0
- package/dist/components/icon/style2.css +58 -0
- package/dist/components/input/input.js +184 -0
- package/dist/components/input/input.js.map +1 -0
- package/dist/components/input/style.d.ts +1 -0
- package/dist/components/input/style.js +1 -0
- package/dist/components/input/style2.css +142 -0
- package/dist/components/list/list-item.js +18 -0
- package/dist/components/list/list-item.js.map +1 -0
- package/dist/components/list/list.js +27 -0
- package/dist/components/list/list.js.map +1 -0
- package/dist/components/list/style.d.ts +1 -0
- package/dist/components/list/style.js +1 -0
- package/dist/components/list/style2.css +58 -0
- package/dist/components/loading/directive.d.ts +3 -0
- package/dist/components/loading/directive.js +28 -0
- package/dist/components/loading/directive.js.map +1 -0
- package/dist/components/loading/index.d.ts +3 -0
- package/dist/components/loading/loading.js +31 -0
- package/dist/components/loading/loading.js.map +1 -0
- package/dist/components/loading/style.d.ts +1 -0
- package/dist/components/loading/style.js +2 -0
- package/dist/components/loading/style2.css +144 -0
- package/dist/components/message/helper.js +22 -0
- package/dist/components/message/helper.js.map +1 -0
- package/dist/components/message/index.d.ts +3 -0
- package/dist/components/message/message-box.js +37 -0
- package/dist/components/message/message-box.js.map +1 -0
- package/dist/components/message/message.d.ts +4 -0
- package/dist/components/message/message.js +63 -0
- package/dist/components/message/message.js.map +1 -0
- package/dist/components/message/message2.js +107 -0
- package/dist/components/message/message2.js.map +1 -0
- package/dist/components/message/style.d.ts +1 -0
- package/dist/components/message/style.js +1 -0
- package/dist/components/message/style2.css +148 -0
- package/dist/components/message-confirm/index.d.ts +3 -0
- package/dist/components/message-confirm/message-confirm-box.js +38 -0
- package/dist/components/message-confirm/message-confirm-box.js.map +1 -0
- package/dist/components/message-confirm/message-confirm.d.ts +4 -0
- package/dist/components/message-confirm/message-confirm.js +62 -0
- package/dist/components/message-confirm/message-confirm.js.map +1 -0
- package/dist/components/message-confirm/message-confirm2.js +118 -0
- package/dist/components/message-confirm/message-confirm2.js.map +1 -0
- package/dist/components/message-confirm/style.d.ts +1 -0
- package/dist/components/message-confirm/style.js +1 -0
- package/dist/components/message-confirm/style2.css +135 -0
- package/dist/components/multi-select/multi-select.js +368 -0
- package/dist/components/multi-select/multi-select.js.map +1 -0
- package/dist/components/multi-select/style.d.ts +1 -0
- package/dist/components/multi-select/style.js +2 -0
- package/dist/components/multi-select/style2.css +340 -0
- package/dist/components/number-input/number-input.js +366 -0
- package/dist/components/number-input/number-input.js.map +1 -0
- package/dist/components/number-input/style.d.ts +1 -0
- package/dist/components/number-input/style.js +2 -0
- package/dist/components/number-input/style2.css +117 -0
- package/dist/components/password-input/password-input.js +141 -0
- package/dist/components/password-input/password-input.js.map +1 -0
- package/dist/components/password-input/style.d.ts +1 -0
- package/dist/components/password-input/style.js +2 -0
- package/dist/components/password-input/style2.css +54 -0
- package/dist/components/progress/progress.js +83 -0
- package/dist/components/progress/progress.js.map +1 -0
- package/dist/components/progress/style.d.ts +1 -0
- package/dist/components/progress/style.js +1 -0
- package/dist/components/progress/style2.css +113 -0
- package/dist/components/radio/radio.js +68 -0
- package/dist/components/radio/radio.js.map +1 -0
- package/dist/components/radio/style.d.ts +1 -0
- package/dist/components/radio/style.js +1 -0
- package/dist/components/radio/style2.css +130 -0
- package/dist/components/radio-group/radio-group.js +83 -0
- package/dist/components/radio-group/radio-group.js.map +1 -0
- package/dist/components/radio-group/style.d.ts +1 -0
- package/dist/components/radio-group/style.js +2 -0
- package/dist/components/radio-group/style2.css +41 -0
- package/dist/components/segment/segment.js +143 -0
- package/dist/components/segment/segment.js.map +1 -0
- package/dist/components/segment/style.d.ts +1 -0
- package/dist/components/segment/style.js +1 -0
- package/dist/components/segment/style2.css +145 -0
- package/dist/components/select/select.js +254 -0
- package/dist/components/select/select.js.map +1 -0
- package/dist/components/select/style.d.ts +1 -0
- package/dist/components/select/style.js +2 -0
- package/dist/components/select/style2.css +219 -0
- package/dist/components/select/use-options.js +140 -0
- package/dist/components/select/use-options.js.map +1 -0
- package/dist/components/skeleton/skeleton.js +73 -0
- package/dist/components/skeleton/skeleton.js.map +1 -0
- package/dist/components/skeleton/style.d.ts +1 -0
- package/dist/components/skeleton/style.js +1 -0
- package/dist/components/skeleton/style2.css +95 -0
- package/dist/components/space/space.js +46 -0
- package/dist/components/space/space.js.map +1 -0
- package/dist/components/space/style.d.ts +1 -0
- package/dist/components/space/style.js +1 -0
- package/dist/components/space/style2.css +52 -0
- package/dist/components/steps/steps.js +98 -0
- package/dist/components/steps/steps.js.map +1 -0
- package/dist/components/steps/style.d.ts +1 -0
- package/dist/components/steps/style.js +1 -0
- package/dist/components/steps/style2.css +238 -0
- package/dist/components/switch/style.d.ts +1 -0
- package/dist/components/switch/style.js +1 -0
- package/dist/components/switch/style2.css +141 -0
- package/dist/components/switch/switch.js +82 -0
- package/dist/components/switch/switch.js.map +1 -0
- package/dist/components/tabs/style.d.ts +1 -0
- package/dist/components/tabs/style.js +1 -0
- package/dist/components/tabs/style2.css +243 -0
- package/dist/components/tabs/tabs.js +131 -0
- package/dist/components/tabs/tabs.js.map +1 -0
- package/dist/components/tag/style.d.ts +1 -0
- package/dist/components/tag/style.js +1 -0
- package/dist/components/tag/style2.css +200 -0
- package/dist/components/tag/tag.js +51 -0
- package/dist/components/tag/tag.js.map +1 -0
- package/dist/components/text/style.d.ts +1 -0
- package/dist/components/text/style.js +1 -0
- package/dist/components/text/style2.css +67 -0
- package/dist/components/text/text.js +54 -0
- package/dist/components/text/text.js.map +1 -0
- package/dist/components/textarea/style.d.ts +1 -0
- package/dist/components/textarea/style.js +1 -0
- package/dist/components/textarea/style2.css +141 -0
- package/dist/components/textarea/textarea.js +151 -0
- package/dist/components/textarea/textarea.js.map +1 -0
- package/dist/components/textarea/utils.js +16 -0
- package/dist/components/textarea/utils.js.map +1 -0
- package/dist/components/time-picker/style.d.ts +1 -0
- package/dist/components/time-picker/style.js +2 -0
- package/dist/components/time-picker/style2.css +206 -0
- package/dist/components/time-picker/time-picker.js +285 -0
- package/dist/components/time-picker/time-picker.js.map +1 -0
- package/dist/components/timeline/style.d.ts +1 -0
- package/dist/components/timeline/style.js +1 -0
- package/dist/components/timeline/style2.css +101 -0
- package/dist/components/timeline/timeline-item.js +31 -0
- package/dist/components/timeline/timeline-item.js.map +1 -0
- package/dist/components/timeline/timeline.js +16 -0
- package/dist/components/timeline/timeline.js.map +1 -0
- package/dist/components/uploader/style.d.ts +1 -0
- package/dist/components/uploader/style.js +1 -0
- package/dist/components/uploader/style2.css +218 -0
- package/dist/components/uploader/uploader.js +303 -0
- package/dist/components/uploader/uploader.js.map +1 -0
- package/dist/index.d.ts +97 -0
- package/dist/index.js +52 -0
- package/dist/shared/bem.js +13 -0
- package/dist/shared/bem.js.map +1 -0
- package/dist/shared/use-scroll-lock.d.ts +9 -0
- package/dist/shared/use-scroll-lock.js +93 -0
- package/dist/shared/use-scroll-lock.js.map +1 -0
- package/dist/shared/use-touch-gesture.d.ts +61 -0
- package/dist/shared/use-touch-gesture.js +91 -0
- package/dist/shared/use-touch-gesture.js.map +1 -0
- package/dist/types/avatar.d.ts +26 -0
- package/dist/types/badge.d.ts +25 -0
- package/dist/types/button.d.ts +44 -0
- package/dist/types/card.d.ts +12 -0
- package/dist/types/cascade.d.ts +77 -0
- package/dist/types/check-tag.d.ts +18 -0
- package/dist/types/checkbox-group.d.ts +19 -0
- package/dist/types/checkbox.d.ts +14 -0
- package/dist/types/collapse.d.ts +66 -0
- package/dist/types/date-picker.d.ts +35 -0
- package/dist/types/descriptions.d.ts +20 -0
- package/dist/types/dialog.d.ts +49 -0
- package/dist/types/divider.d.ts +12 -0
- package/dist/types/drawer.d.ts +32 -0
- package/dist/types/empty.d.ts +15 -0
- package/dist/types/form-item.d.ts +20 -0
- package/dist/types/form.d.ts +51 -0
- package/dist/types/icon.d.ts +9 -0
- package/dist/types/input.d.ts +48 -0
- package/dist/types/list.d.ts +10 -0
- package/dist/types/loading.d.ts +16 -0
- package/dist/types/message-confirm.d.ts +65 -0
- package/dist/types/message.d.ts +64 -0
- package/dist/types/multi-select.d.ts +35 -0
- package/dist/types/number-input.d.ts +30 -0
- package/dist/types/password-input.d.ts +15 -0
- package/dist/types/progress.d.ts +19 -0
- package/dist/types/radio-group.d.ts +32 -0
- package/dist/types/radio.d.ts +17 -0
- package/dist/types/segment.d.ts +38 -0
- package/dist/types/select.d.ts +62 -0
- package/dist/types/skeleton.d.ts +22 -0
- package/dist/types/space.d.ts +18 -0
- package/dist/types/steps.d.ts +61 -0
- package/dist/types/switch.d.ts +16 -0
- package/dist/types/tabs.d.ts +59 -0
- package/dist/types/tag.d.ts +18 -0
- package/dist/types/text.d.ts +26 -0
- package/dist/types/textarea.d.ts +70 -0
- package/dist/types/time-picker.d.ts +36 -0
- package/dist/types/timeline.d.ts +14 -0
- package/dist/types/uploader.d.ts +47 -0
- package/package.json +1 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 单指触摸手势基建(Drawer 四向边缘拖拽关闭、DatePicker 横滑翻月共用)
|
|
3
|
+
*
|
|
4
|
+
* - 只消费 `touch*` 事件,不依赖 pointer / hover
|
|
5
|
+
* - 判定逻辑不调用 `preventDefault`,监听是否 passive 均可工作;
|
|
6
|
+
* 需要阻断滚动链时由组件在模板上加 `.prevent` 修饰符
|
|
7
|
+
*
|
|
8
|
+
* 用法:返回的四个处理函数逐个绑到模板(或 `v-on` 整体展开),
|
|
9
|
+
* 位移跟随写在 `onMove`,释放判定用 `shouldCloseByDrag` / `horizontalSwipeDirection`
|
|
10
|
+
*/
|
|
11
|
+
export interface TouchGestureState {
|
|
12
|
+
/** 相对起点的横向位移(px,向右为正) */
|
|
13
|
+
dx: number;
|
|
14
|
+
/** 相对起点的纵向位移(px,向下为正) */
|
|
15
|
+
dy: number;
|
|
16
|
+
/** 起触至今的时长(ms) */
|
|
17
|
+
duration: number;
|
|
18
|
+
/** 横向速度(px/ms,向右为正,按最近一段位移计算) */
|
|
19
|
+
vx: number;
|
|
20
|
+
/** 纵向速度(px/ms,向下为正,按最近一段位移计算) */
|
|
21
|
+
vy: number;
|
|
22
|
+
}
|
|
23
|
+
export interface UseTouchGestureOptions {
|
|
24
|
+
/** 触摸开始(位移为 0 的首帧) */
|
|
25
|
+
onStart?: (state: TouchGestureState) => void;
|
|
26
|
+
/** 触摸移动(每帧更新,供拖拽跟随) */
|
|
27
|
+
onMove?: (state: TouchGestureState) => void;
|
|
28
|
+
/** 松手,在这里做释放判定 */
|
|
29
|
+
onEnd?: (state: TouchGestureState) => void;
|
|
30
|
+
/** 手势被打断(来电、系统手势、落到多指等):拖拽中的组件应回弹而非关闭 */
|
|
31
|
+
onCancel?: (state: TouchGestureState) => void;
|
|
32
|
+
}
|
|
33
|
+
/** 绑定到模板 `touch*` 事件的处理函数集,可直接 `v-on` 展开 */
|
|
34
|
+
export interface TouchGestureHandlers {
|
|
35
|
+
touchstart: (event: TouchEvent) => void;
|
|
36
|
+
touchmove: (event: TouchEvent) => void;
|
|
37
|
+
touchend: (event: TouchEvent) => void;
|
|
38
|
+
touchcancel: () => void;
|
|
39
|
+
}
|
|
40
|
+
export declare function useTouchGesture(options?: UseTouchGestureOptions): TouchGestureHandlers;
|
|
41
|
+
export interface DragDismissOptions {
|
|
42
|
+
/** 拖拽轴:Drawer 的 bottom / top 形态用 y,left / right 形态用 x */
|
|
43
|
+
axis: 'x' | 'y';
|
|
44
|
+
/**
|
|
45
|
+
* 关闭方向:1 沿正方向(右 / 下)拖动关闭,-1 沿负方向(左 / 上)。
|
|
46
|
+
* Drawer 对应关系:bottom 向下拉 1、top 向上推 -1、left 向左拖 -1、right 向右拖 1
|
|
47
|
+
*/
|
|
48
|
+
sign: 1 | -1;
|
|
49
|
+
/** 判定为关闭的最小位移(px),默认 100 */
|
|
50
|
+
distance?: number;
|
|
51
|
+
/** 判定为关闭的最小甩动速度(px/ms),默认 0.3 */
|
|
52
|
+
velocity?: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 拖拽释放判定:沿关闭方向的位移或甩动速度任一达标即应关闭;
|
|
56
|
+
* 反方向(离开关闭方向)拖动永远不关闭
|
|
57
|
+
*/
|
|
58
|
+
export declare function shouldCloseByDrag(state: TouchGestureState, options: DragDismissOptions): boolean;
|
|
59
|
+
/** 横向滑动方向判定:位移达阈值且横向分量大于纵向时返回方向,否则 null(点按或纵向滚动) */
|
|
60
|
+
export declare function horizontalSwipeDirection(state: TouchGestureState, distance?: number): 'left' | 'right' | null;
|
|
61
|
+
//# sourceMappingURL=use-touch-gesture.d.ts.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// src/shared/use-touch-gesture.ts
|
|
2
|
+
function useTouchGesture(options = {}) {
|
|
3
|
+
let startX = 0;
|
|
4
|
+
let startY = 0;
|
|
5
|
+
let startT = 0;
|
|
6
|
+
let lastX = 0;
|
|
7
|
+
let lastY = 0;
|
|
8
|
+
let lastT = 0;
|
|
9
|
+
let lastVX = 0;
|
|
10
|
+
let lastVY = 0;
|
|
11
|
+
let tracking = false;
|
|
12
|
+
function stateAt(x, y, t) {
|
|
13
|
+
const dt = t - lastT;
|
|
14
|
+
if (dt > 0) {
|
|
15
|
+
lastVX = (x - lastX) / dt;
|
|
16
|
+
lastVY = (y - lastY) / dt;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
dx: x - startX,
|
|
20
|
+
dy: y - startY,
|
|
21
|
+
duration: t - startT,
|
|
22
|
+
vx: lastVX,
|
|
23
|
+
vy: lastVY
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function cancelTracking() {
|
|
27
|
+
if (!tracking) return;
|
|
28
|
+
tracking = false;
|
|
29
|
+
options.onCancel?.(stateAt(lastX, lastY, lastT));
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
touchstart(e) {
|
|
33
|
+
if (tracking || e.touches.length !== 1) {
|
|
34
|
+
cancelTracking();
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const touch = e.touches[0];
|
|
38
|
+
tracking = true;
|
|
39
|
+
startX = lastX = touch.clientX;
|
|
40
|
+
startY = lastY = touch.clientY;
|
|
41
|
+
lastT = startT = e.timeStamp;
|
|
42
|
+
lastVX = lastVY = 0;
|
|
43
|
+
options.onStart?.({
|
|
44
|
+
dx: 0,
|
|
45
|
+
dy: 0,
|
|
46
|
+
duration: 0,
|
|
47
|
+
vx: 0,
|
|
48
|
+
vy: 0
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
touchmove(e) {
|
|
52
|
+
if (!tracking) return;
|
|
53
|
+
if (e.touches.length !== 1) {
|
|
54
|
+
cancelTracking();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const touch = e.touches[0];
|
|
58
|
+
options.onMove?.(stateAt(touch.clientX, touch.clientY, e.timeStamp));
|
|
59
|
+
lastX = touch.clientX;
|
|
60
|
+
lastY = touch.clientY;
|
|
61
|
+
lastT = e.timeStamp;
|
|
62
|
+
},
|
|
63
|
+
touchend(e) {
|
|
64
|
+
if (!tracking) return;
|
|
65
|
+
tracking = false;
|
|
66
|
+
const touch = e.changedTouches[0];
|
|
67
|
+
options.onEnd?.(stateAt(touch?.clientX ?? lastX, touch?.clientY ?? lastY, e.timeStamp));
|
|
68
|
+
},
|
|
69
|
+
touchcancel: cancelTracking
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 拖拽释放判定:沿关闭方向的位移或甩动速度任一达标即应关闭;
|
|
74
|
+
* 反方向(离开关闭方向)拖动永远不关闭
|
|
75
|
+
*/
|
|
76
|
+
function shouldCloseByDrag(state, options) {
|
|
77
|
+
const { axis, sign, distance = 100, velocity = .3 } = options;
|
|
78
|
+
const delta = sign * (axis === "x" ? state.dx : state.dy);
|
|
79
|
+
if (delta <= 0) return false;
|
|
80
|
+
const speed = sign * (axis === "x" ? state.vx : state.vy);
|
|
81
|
+
return delta >= distance || speed >= velocity;
|
|
82
|
+
}
|
|
83
|
+
/** 横向滑动方向判定:位移达阈值且横向分量大于纵向时返回方向,否则 null(点按或纵向滚动) */
|
|
84
|
+
function horizontalSwipeDirection(state, distance = 50) {
|
|
85
|
+
const { dx, dy } = state;
|
|
86
|
+
if (Math.abs(dx) < distance || Math.abs(dx) <= Math.abs(dy)) return null;
|
|
87
|
+
return dx > 0 ? "right" : "left";
|
|
88
|
+
}
|
|
89
|
+
export { horizontalSwipeDirection, shouldCloseByDrag, useTouchGesture };
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=use-touch-gesture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-touch-gesture.js","names":[],"sources":["../../src/shared/use-touch-gesture.ts"],"sourcesContent":["/**\n * 单指触摸手势基建(Drawer 四向边缘拖拽关闭、DatePicker 横滑翻月共用)\n *\n * - 只消费 `touch*` 事件,不依赖 pointer / hover\n * - 判定逻辑不调用 `preventDefault`,监听是否 passive 均可工作;\n * 需要阻断滚动链时由组件在模板上加 `.prevent` 修饰符\n *\n * 用法:返回的四个处理函数逐个绑到模板(或 `v-on` 整体展开),\n * 位移跟随写在 `onMove`,释放判定用 `shouldCloseByDrag` / `horizontalSwipeDirection`\n */\n\nexport interface TouchGestureState {\n /** 相对起点的横向位移(px,向右为正) */\n dx: number\n /** 相对起点的纵向位移(px,向下为正) */\n dy: number\n /** 起触至今的时长(ms) */\n duration: number\n /** 横向速度(px/ms,向右为正,按最近一段位移计算) */\n vx: number\n /** 纵向速度(px/ms,向下为正,按最近一段位移计算) */\n vy: number\n}\n\nexport interface UseTouchGestureOptions {\n /** 触摸开始(位移为 0 的首帧) */\n onStart?: (state: TouchGestureState) => void\n /** 触摸移动(每帧更新,供拖拽跟随) */\n onMove?: (state: TouchGestureState) => void\n /** 松手,在这里做释放判定 */\n onEnd?: (state: TouchGestureState) => void\n /** 手势被打断(来电、系统手势、落到多指等):拖拽中的组件应回弹而非关闭 */\n onCancel?: (state: TouchGestureState) => void\n}\n\n/** 绑定到模板 `touch*` 事件的处理函数集,可直接 `v-on` 展开 */\nexport interface TouchGestureHandlers {\n touchstart: (event: TouchEvent) => void\n touchmove: (event: TouchEvent) => void\n touchend: (event: TouchEvent) => void\n touchcancel: () => void\n}\n\nexport function useTouchGesture(options: UseTouchGestureOptions = {}): TouchGestureHandlers {\n let startX = 0\n let startY = 0\n let startT = 0\n let lastX = 0\n let lastY = 0\n let lastT = 0\n let lastVX = 0\n let lastVY = 0\n let tracking = false\n\n function stateAt(x: number, y: number, t: number): TouchGestureState {\n const dt = t - lastT\n // 速度按最近一段位移计算,长距离慢拖后再甩动时不被整体平均稀释\n if (dt > 0) {\n lastVX = (x - lastX) / dt\n lastVY = (y - lastY) / dt\n }\n\n return { dx: x - startX, dy: y - startY, duration: t - startT, vx: lastVX, vy: lastVY }\n }\n\n function cancelTracking() {\n if (!tracking) return\n tracking = false\n options.onCancel?.(stateAt(lastX, lastY, lastT))\n }\n\n return {\n touchstart(e) {\n // 只跟踪单指;第二指落下视为手势被打断\n if (tracking || e.touches.length !== 1) {\n cancelTracking()\n return\n }\n\n const touch = e.touches[0]!\n tracking = true\n startX = lastX = touch.clientX\n startY = lastY = touch.clientY\n lastT = startT = e.timeStamp\n lastVX = lastVY = 0\n options.onStart?.({ dx: 0, dy: 0, duration: 0, vx: 0, vy: 0 })\n },\n\n touchmove(e) {\n if (!tracking) return\n if (e.touches.length !== 1) {\n cancelTracking()\n return\n }\n\n const touch = e.touches[0]!\n options.onMove?.(stateAt(touch.clientX, touch.clientY, e.timeStamp))\n lastX = touch.clientX\n lastY = touch.clientY\n lastT = e.timeStamp\n },\n\n touchend(e) {\n if (!tracking) return\n tracking = false\n const touch = e.changedTouches[0]\n options.onEnd?.(stateAt(touch?.clientX ?? lastX, touch?.clientY ?? lastY, e.timeStamp))\n },\n\n touchcancel: cancelTracking\n }\n}\n\nexport interface DragDismissOptions {\n /** 拖拽轴:Drawer 的 bottom / top 形态用 y,left / right 形态用 x */\n axis: 'x' | 'y'\n /**\n * 关闭方向:1 沿正方向(右 / 下)拖动关闭,-1 沿负方向(左 / 上)。\n * Drawer 对应关系:bottom 向下拉 1、top 向上推 -1、left 向左拖 -1、right 向右拖 1\n */\n sign: 1 | -1\n /** 判定为关闭的最小位移(px),默认 100 */\n distance?: number\n /** 判定为关闭的最小甩动速度(px/ms),默认 0.3 */\n velocity?: number\n}\n\n/**\n * 拖拽释放判定:沿关闭方向的位移或甩动速度任一达标即应关闭;\n * 反方向(离开关闭方向)拖动永远不关闭\n */\nexport function shouldCloseByDrag(state: TouchGestureState, options: DragDismissOptions): boolean {\n const { axis, sign, distance = 100, velocity = 0.3 } = options\n const delta = sign * (axis === 'x' ? state.dx : state.dy)\n\n if (delta <= 0) return false\n\n const speed = sign * (axis === 'x' ? state.vx : state.vy)\n return delta >= distance || speed >= velocity\n}\n\n/** 横向滑动方向判定:位移达阈值且横向分量大于纵向时返回方向,否则 null(点按或纵向滚动) */\nexport function horizontalSwipeDirection(\n state: TouchGestureState,\n distance = 50\n): 'left' | 'right' | null {\n const { dx, dy } = state\n if (Math.abs(dx) < distance || Math.abs(dx) <= Math.abs(dy)) return null\n return dx > 0 ? 'right' : 'left'\n}\n"],"mappings":";AA2CA,SAAgB,gBAAgB,UAAkC,CAAC,GAAyB;CAC1F,IAAI,SAAS;CACb,IAAI,SAAS;CACb,IAAI,SAAS;CACb,IAAI,QAAQ;CACZ,IAAI,QAAQ;CACZ,IAAI,QAAQ;CACZ,IAAI,SAAS;CACb,IAAI,SAAS;CACb,IAAI,WAAW;CAEf,SAAS,QAAQ,GAAW,GAAW,GAA8B;EACnE,MAAM,KAAK,IAAI;EAEf,IAAI,KAAK,GAAG;GACV,UAAU,IAAI,SAAS;GACvB,UAAU,IAAI,SAAS;EACzB;EAEA,OAAO;GAAE,IAAI,IAAI;GAAQ,IAAI,IAAI;GAAQ,UAAU,IAAI;GAAQ,IAAI;GAAQ,IAAI;EAAO;CACxF;CAEA,SAAS,iBAAiB;EACxB,IAAI,CAAC,UAAU;EACf,WAAW;EACX,QAAQ,WAAW,QAAQ,OAAO,OAAO,KAAK,CAAC;CACjD;CAEA,OAAO;EACL,WAAW,GAAG;GAEZ,IAAI,YAAY,EAAE,QAAQ,WAAW,GAAG;IACtC,eAAe;IACf;GACF;GAEA,MAAM,QAAQ,EAAE,QAAQ;GACxB,WAAW;GACX,SAAS,QAAQ,MAAM;GACvB,SAAS,QAAQ,MAAM;GACvB,QAAQ,SAAS,EAAE;GACnB,SAAS,SAAS;GAClB,QAAQ,UAAU;IAAE,IAAI;IAAG,IAAI;IAAG,UAAU;IAAG,IAAI;IAAG,IAAI;GAAE,CAAC;EAC/D;EAEA,UAAU,GAAG;GACX,IAAI,CAAC,UAAU;GACf,IAAI,EAAE,QAAQ,WAAW,GAAG;IAC1B,eAAe;IACf;GACF;GAEA,MAAM,QAAQ,EAAE,QAAQ;GACxB,QAAQ,SAAS,QAAQ,MAAM,SAAS,MAAM,SAAS,EAAE,SAAS,CAAC;GACnE,QAAQ,MAAM;GACd,QAAQ,MAAM;GACd,QAAQ,EAAE;EACZ;EAEA,SAAS,GAAG;GACV,IAAI,CAAC,UAAU;GACf,WAAW;GACX,MAAM,QAAQ,EAAE,eAAe;GAC/B,QAAQ,QAAQ,QAAQ,OAAO,WAAW,OAAO,OAAO,WAAW,OAAO,EAAE,SAAS,CAAC;EACxF;EAEA,aAAa;CACf;AACF;;;;;AAoBA,SAAgB,kBAAkB,OAA0B,SAAsC;CAChG,MAAM,EAAE,MAAM,MAAM,WAAW,KAAK,WAAW,OAAQ;CACvD,MAAM,QAAQ,QAAQ,SAAS,MAAM,MAAM,KAAK,MAAM;CAEtD,IAAI,SAAS,GAAG,OAAO;CAEvB,MAAM,QAAQ,QAAQ,SAAS,MAAM,MAAM,KAAK,MAAM;CACtD,OAAO,SAAS,YAAY,SAAS;AACvC;;AAGA,SAAgB,yBACd,OACA,WAAW,IACc;CACzB,MAAM,EAAE,IAAI,OAAO;CACnB,IAAI,KAAK,IAAI,EAAE,IAAI,YAAY,KAAK,IAAI,EAAE,KAAK,KAAK,IAAI,EAAE,GAAG,OAAO;CACpE,OAAO,KAAK,IAAI,UAAU;AAC5B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ComponentProps, DeconstructValue } from "@veltra/utils";
|
|
2
|
+
/** 头像形状:circle 圆形 / round 圆角方形 */
|
|
3
|
+
export type AvatarShape = 'circle' | 'round';
|
|
4
|
+
/** 头像组件属性 */
|
|
5
|
+
export interface AvatarProps extends ComponentProps {
|
|
6
|
+
/**
|
|
7
|
+
* 尺寸档位(继承自 ComponentProps):small / default / large,
|
|
8
|
+
* 宽高取移动端密度 token `--um-avatar-size-*`(32 / 40 / 48px),默认 default
|
|
9
|
+
*/
|
|
10
|
+
size?: ComponentProps['size'];
|
|
11
|
+
/** 图片地址;未传或加载失败时回退展示默认插槽内容 */
|
|
12
|
+
src?: string;
|
|
13
|
+
/** 图片描述,作为 img 的 alt */
|
|
14
|
+
alt?: string;
|
|
15
|
+
/** 形状,默认 circle */
|
|
16
|
+
shape?: AvatarShape;
|
|
17
|
+
}
|
|
18
|
+
/** 头像组件定义的事件 */
|
|
19
|
+
export interface AvatarEmits {
|
|
20
|
+
(e: 'error', ev: Event): void;
|
|
21
|
+
}
|
|
22
|
+
/** 头像组件暴露的属性和方法(组件内部使用) */
|
|
23
|
+
export interface _AvatarExposed {}
|
|
24
|
+
/** 头像组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
25
|
+
export type AvatarExposed = DeconstructValue<_AvatarExposed>;
|
|
26
|
+
//# sourceMappingURL=avatar.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ColorType, ComponentProps, DeconstructValue } from "@veltra/utils";
|
|
2
|
+
/** 徽章组件属性 */
|
|
3
|
+
export interface BadgeProps extends ComponentProps {
|
|
4
|
+
/** 显示值 */
|
|
5
|
+
value?: number | string;
|
|
6
|
+
/** 类别 */
|
|
7
|
+
type?: ColorType;
|
|
8
|
+
/** 自定义背景色 */
|
|
9
|
+
color?: string;
|
|
10
|
+
/** 是否隐藏 Badge */
|
|
11
|
+
hidden?: boolean;
|
|
12
|
+
/** 最大值 {{max}}+ */
|
|
13
|
+
max?: number;
|
|
14
|
+
/** 是否显示小圆点 */
|
|
15
|
+
dot?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** 徽章组件定义的事件 */
|
|
18
|
+
export interface BadgeEmits {
|
|
19
|
+
(e: 'update:modelValue', value: string): void;
|
|
20
|
+
}
|
|
21
|
+
/** 徽章组件暴露的属性和方法(组件内部使用) */
|
|
22
|
+
export interface _BadgeExposed {}
|
|
23
|
+
/** 徽章组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
24
|
+
export type BadgeExposed = DeconstructValue<_BadgeExposed>;
|
|
25
|
+
//# sourceMappingURL=badge.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Component, ShallowRef } from "vue";
|
|
2
|
+
import { ColorType, ComponentProps, DeconstructValue } from "@veltra/utils";
|
|
3
|
+
/** 按钮类型 */
|
|
4
|
+
export type ButtonType = ColorType;
|
|
5
|
+
/**
|
|
6
|
+
* 按钮属性类型
|
|
7
|
+
* @description 组件不注入默认 `aria-label`:可访问名来自默认插槽文本,
|
|
8
|
+
* 或你自己传入的 `aria-label`(透传到根元素);只有图标的按钮必须自行传 `aria-label`
|
|
9
|
+
*/
|
|
10
|
+
export interface ButtonProps extends ComponentProps {
|
|
11
|
+
/** 按钮类型 */
|
|
12
|
+
type?: ButtonType;
|
|
13
|
+
/** 是否以文本形式展示 */
|
|
14
|
+
text?: boolean;
|
|
15
|
+
/** 朴素模式 */
|
|
16
|
+
plain?: boolean;
|
|
17
|
+
/** 加载中 */
|
|
18
|
+
loading?: boolean;
|
|
19
|
+
/** 加载图标 */
|
|
20
|
+
loadingIcon?: Component;
|
|
21
|
+
/** 圆形 */
|
|
22
|
+
circle?: boolean;
|
|
23
|
+
/** 禁用 */
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/** 图标 */
|
|
26
|
+
icon?: Component;
|
|
27
|
+
/** 图标大小, 单位px */
|
|
28
|
+
iconSize?: number;
|
|
29
|
+
/** 图标位置 */
|
|
30
|
+
iconPosition?: 'left' | 'right';
|
|
31
|
+
/** 事件是否传播(冒泡或者捕获) */
|
|
32
|
+
propagate?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface ButtonEmits {
|
|
35
|
+
/** 点击事件 */
|
|
36
|
+
(name: 'click', e: MouseEvent): void;
|
|
37
|
+
}
|
|
38
|
+
/** 在组件内部引用 */
|
|
39
|
+
export interface _ButtonExposed {
|
|
40
|
+
el: ShallowRef<HTMLButtonElement | undefined>;
|
|
41
|
+
}
|
|
42
|
+
/** 按钮暴露的属性和方法 */
|
|
43
|
+
export type ButtonExposed = DeconstructValue<_ButtonExposed>;
|
|
44
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComponentProps, DeconstructValue } from "@veltra/utils";
|
|
2
|
+
/** 卡片组件属性 */
|
|
3
|
+
export interface CardProps extends ComponentProps {
|
|
4
|
+
/** 宽度 */
|
|
5
|
+
width?: string | number;
|
|
6
|
+
/** 融合样式,卡片不再有阴影 */
|
|
7
|
+
integrate?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface CardEmits {}
|
|
10
|
+
export interface _CardExposed {}
|
|
11
|
+
export type CardExposed = DeconstructValue<_CardExposed>;
|
|
12
|
+
//# sourceMappingURL=card.d.ts.map
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { CSSProperties } from "vue";
|
|
2
|
+
import { DeconstructValue, FormComponentProps } from "@veltra/utils";
|
|
3
|
+
import { TreeNode } from "@cat-kit/core";
|
|
4
|
+
export interface CascadeNode<Data extends Record<string, any> = Record<string, any>> extends TreeNode<Data, CascadeNode<Data>> {
|
|
5
|
+
visible: boolean;
|
|
6
|
+
value: string;
|
|
7
|
+
label: string;
|
|
8
|
+
}
|
|
9
|
+
/** 级联选择器组件属性(移动端形态:面包屑 Tab + 底部面板) */
|
|
10
|
+
export interface CascadeProps extends FormComponentProps {
|
|
11
|
+
/**
|
|
12
|
+
* 分隔符
|
|
13
|
+
* @default '/'
|
|
14
|
+
*/
|
|
15
|
+
separator?: string;
|
|
16
|
+
/** 数据值 */
|
|
17
|
+
modelValue?: string[] | string;
|
|
18
|
+
/** 级联数据项的标签字段 */
|
|
19
|
+
labelKey?: string;
|
|
20
|
+
/**
|
|
21
|
+
* 兜底展示文案
|
|
22
|
+
* @description 单选 modelValue 未命中数据时展示 text(如回显路径已不在选项中),命中时展示节点 label 路径
|
|
23
|
+
*/
|
|
24
|
+
text?: string;
|
|
25
|
+
/** 级联数据项的值字段 */
|
|
26
|
+
valueKey?: string;
|
|
27
|
+
/** 占位符 */
|
|
28
|
+
placeholder?: string;
|
|
29
|
+
/** 是否可清除 */
|
|
30
|
+
clearable?: boolean;
|
|
31
|
+
/** 子级字段 */
|
|
32
|
+
childrenKey?: string;
|
|
33
|
+
/** 严格模式:仅叶子节点提交,非叶子点击只展开下级 */
|
|
34
|
+
strict?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* 是否展示/提交完整路径
|
|
37
|
+
* @default true
|
|
38
|
+
* false 时显示、modelValue、update:label 均只体现选中叶子节点
|
|
39
|
+
*/
|
|
40
|
+
showFullPath?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* 数据项
|
|
43
|
+
*/
|
|
44
|
+
data?: Record<string, any>[];
|
|
45
|
+
/**
|
|
46
|
+
* 多选
|
|
47
|
+
*/
|
|
48
|
+
multiple?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* 搜索
|
|
51
|
+
*/
|
|
52
|
+
filterable?: boolean;
|
|
53
|
+
/** 触发器上最多展示的标签数,超出折叠为 +N */
|
|
54
|
+
visibilityLimit?: number;
|
|
55
|
+
/** 底部面板内容容器样式 */
|
|
56
|
+
contentStyle?: CSSProperties | string;
|
|
57
|
+
/** 底部面板内容容器类名 */
|
|
58
|
+
contentClass?: unknown;
|
|
59
|
+
}
|
|
60
|
+
/** 级联选择器组件定义的事件 */
|
|
61
|
+
export interface CascadeEmits {
|
|
62
|
+
/** 触发更新 label 事件 */
|
|
63
|
+
(e: 'update:label', label?: string | string[]): void;
|
|
64
|
+
(e: 'update:modelValue', value?: string | string[]): void;
|
|
65
|
+
(e: 'change', items: (Record<string, any> & {
|
|
66
|
+
fullLabel?: string;
|
|
67
|
+
})[], fullLabels?: string[]): void;
|
|
68
|
+
(e: 'change', item: (Record<string, any> & {
|
|
69
|
+
fullLabel?: string;
|
|
70
|
+
}) | undefined, fullLabel?: string): void;
|
|
71
|
+
(e: 'clear'): void;
|
|
72
|
+
}
|
|
73
|
+
/** 级联选择器组件暴露的属性和方法(组件内部使用) */
|
|
74
|
+
export interface _CascadeExposed {}
|
|
75
|
+
/** 级联选择器组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
76
|
+
export type CascadeExposed = DeconstructValue<_CascadeExposed>;
|
|
77
|
+
//# sourceMappingURL=cascade.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { DeconstructValue } from "@veltra/utils";
|
|
2
|
+
/** check-tag组件属性 */
|
|
3
|
+
export interface CheckTagProps {
|
|
4
|
+
modelValue?: boolean;
|
|
5
|
+
checked?: boolean;
|
|
6
|
+
/** 是否禁用;禁用后点击不切换选中态、不触发任何事件 */
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** check-tag组件定义的事件 */
|
|
10
|
+
export interface CheckTagEmits {
|
|
11
|
+
(e: 'update:modelValue', value: boolean): void;
|
|
12
|
+
(e: 'change', value: boolean): void;
|
|
13
|
+
}
|
|
14
|
+
/** check-tag组件暴露的属性和方法(组件内部使用) */
|
|
15
|
+
export interface _CheckTagExposed {}
|
|
16
|
+
/** check-tag组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
17
|
+
export type CheckTagExposed = DeconstructValue<_CheckTagExposed>;
|
|
18
|
+
//# sourceMappingURL=check-tag.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FormComponentProps } from "@veltra/utils";
|
|
2
|
+
/** 复选框组组件属性(移动端列表行式:选项纵向排列占满整行,v-model 为选中值数组) */
|
|
3
|
+
export interface CheckboxGroupProps extends FormComponentProps {
|
|
4
|
+
/** 值 */
|
|
5
|
+
modelValue?: Array<any>;
|
|
6
|
+
/** 复选框项 */
|
|
7
|
+
items: Array<Record<string, any>>;
|
|
8
|
+
/** 标签文本的key */
|
|
9
|
+
labelKey?: string;
|
|
10
|
+
/** 值的key */
|
|
11
|
+
valueKey?: string;
|
|
12
|
+
/** 选项行间细分隔线。默认 false */
|
|
13
|
+
divider?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** 复选框组组件定义的事件 */
|
|
16
|
+
export interface CheckboxGroupEmits {
|
|
17
|
+
(e: 'update:modelValue', value: Array<any>): void;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=checkbox-group.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FormComponentProps } from "@veltra/utils";
|
|
2
|
+
/** 复选框组件属性(与 @veltra/desktop UCheckbox 同名;呈移动端列表行式选项形态) */
|
|
3
|
+
export interface CheckboxProps extends FormComponentProps {
|
|
4
|
+
/** 部分选中 */
|
|
5
|
+
indeterminate?: boolean;
|
|
6
|
+
/** 是否选中 */
|
|
7
|
+
modelValue?: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** 复选框组件定义的事件 */
|
|
10
|
+
export interface CheckboxEmits {
|
|
11
|
+
(name: 'update:modelValue', checked: boolean): void;
|
|
12
|
+
(name: 'change', checked: boolean, e: MouseEvent): void;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=checkbox.d.ts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Component } from "vue";
|
|
2
|
+
import { ComponentProps } from "@veltra/utils";
|
|
3
|
+
/** Collapse 项的唯一标识 */
|
|
4
|
+
export type CollapseValue = string | number;
|
|
5
|
+
/** Collapse modelValue:手风琴模式为单值,普通模式为数组(也兼容传入单值) */
|
|
6
|
+
export type CollapseModelValue = CollapseValue | CollapseValue[];
|
|
7
|
+
/** Collapse 组件属性 */
|
|
8
|
+
export interface CollapseProps extends ComponentProps {
|
|
9
|
+
/** 当前展开项的 value(单个或多个) */
|
|
10
|
+
modelValue?: CollapseModelValue;
|
|
11
|
+
/**
|
|
12
|
+
* 是否手风琴模式(一次只能展开一项)
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
accordion?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* 是否默认折叠全部项。设为 false 时默认全部展开。
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
defaultCollapseAll?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* 自定义展开图标组件,活动态会自动旋转 180°。
|
|
23
|
+
* 接受任意 Vue 组件(SFC、Functional Component 等)。
|
|
24
|
+
*/
|
|
25
|
+
expandIcon?: Component;
|
|
26
|
+
}
|
|
27
|
+
export interface CollapseEmits {
|
|
28
|
+
(e: 'update:modelValue', value: CollapseModelValue): void;
|
|
29
|
+
/** 当前展开项变更时触发 */
|
|
30
|
+
(e: 'change', value: CollapseModelValue): void;
|
|
31
|
+
}
|
|
32
|
+
/** CollapseItem 组件属性 */
|
|
33
|
+
export interface CollapseItemProps {
|
|
34
|
+
/**
|
|
35
|
+
* 唯一标识;在 `UCollapse` 内使用时必填。
|
|
36
|
+
* 独立使用时可选。
|
|
37
|
+
*/
|
|
38
|
+
value?: CollapseValue;
|
|
39
|
+
/**
|
|
40
|
+
* 独立使用时的展开状态(`v-model`)。
|
|
41
|
+
* 在 `UCollapse` 内由父组件 `modelValue` 管理,此属性无效。
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
modelValue?: boolean;
|
|
45
|
+
/** 标题文本(也可通过 #header 插槽自定义标题区;展开图标始终保留,可用 expandIcon 替换) */
|
|
46
|
+
title?: string;
|
|
47
|
+
/** 是否禁用 */
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* 独立使用时的自定义展开图标,活动态会自动旋转 180°。
|
|
51
|
+
* 在 `UCollapse` 内由父组件 `expandIcon` 统一管理。
|
|
52
|
+
*/
|
|
53
|
+
expandIcon?: Component;
|
|
54
|
+
/**
|
|
55
|
+
* 折叠动画结束后卸载内容 DOM(展开时重新挂载),减少长列表的内存与渲染成本。
|
|
56
|
+
* 注意:卸载会丢失内容区的本地组件状态。
|
|
57
|
+
* @default false
|
|
58
|
+
*/
|
|
59
|
+
destroyOnCollapse?: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface CollapseItemEmits {
|
|
62
|
+
(e: 'update:modelValue', value: boolean): void;
|
|
63
|
+
/** 展开状态变更时触发(仅独立使用) */
|
|
64
|
+
(e: 'change', value: boolean): void;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=collapse.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { DeconstructValue, FormComponentProps } from "@veltra/utils";
|
|
2
|
+
import { Dater } from "@cat-kit/core";
|
|
3
|
+
/** 绑定值类型 */
|
|
4
|
+
export type DatePickerDataType = 'date' | 'timestamp' | 'string';
|
|
5
|
+
/** date-picker组件属性(与 @veltra/desktop UDatePicker 对齐) */
|
|
6
|
+
export interface DatePickerProps extends FormComponentProps {
|
|
7
|
+
modelValue?: string | number | Date;
|
|
8
|
+
/** 占位 */
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
/** 日期类型 */
|
|
11
|
+
type?: 'date' | 'month' | 'year';
|
|
12
|
+
/** 日期格式化 */
|
|
13
|
+
format?: string;
|
|
14
|
+
/** 日期值格式化, 当没有指定时默认使用format属性,仅当值和显示的内容不一致时才需要使用到该属性 */
|
|
15
|
+
valueFormat?: string;
|
|
16
|
+
/**
|
|
17
|
+
* 绑定值的类型,默认为字符串。
|
|
18
|
+
* 当 dataType 没有指定为字符串时,valueFormat 属性不生效
|
|
19
|
+
*/
|
|
20
|
+
dataType?: DatePickerDataType;
|
|
21
|
+
/** 最小可选日期 */
|
|
22
|
+
disabledDate?: (date: Dater, raw: Date) => boolean;
|
|
23
|
+
/** 是否显示清除按钮 */
|
|
24
|
+
clearable?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/** date-picker组件定义的事件 */
|
|
27
|
+
export interface DatePickerEmits {
|
|
28
|
+
(e: 'update:modelValue', value?: string | number | Date): void;
|
|
29
|
+
(e: 'change', date?: Date): void;
|
|
30
|
+
}
|
|
31
|
+
/** date-picker组件暴露的属性和方法(组件内部使用) */
|
|
32
|
+
export interface _DatePickerExposed {}
|
|
33
|
+
/** date-picker组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
34
|
+
export type DatePickerExposed = DeconstructValue<_DatePickerExposed>;
|
|
35
|
+
//# sourceMappingURL=date-picker.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ComponentProps } from "@veltra/utils";
|
|
2
|
+
/** 描述列表布局:horizontal 键值同行 / vertical 键值分行 */
|
|
3
|
+
export type DescriptionsLayout = 'horizontal' | 'vertical';
|
|
4
|
+
/** 描述列表组件属性 */
|
|
5
|
+
export interface DescriptionsProps extends ComponentProps {
|
|
6
|
+
/** 列表标题,渲染在列表顶部 */
|
|
7
|
+
title?: string;
|
|
8
|
+
/** 每行展示的键值对列数,默认 3 */
|
|
9
|
+
column?: number;
|
|
10
|
+
/** 边框模式:键值单元格带描边与键名底色,默认 false(无边框) */
|
|
11
|
+
border?: boolean;
|
|
12
|
+
/** 布局方向,默认 'horizontal' */
|
|
13
|
+
layout?: DescriptionsLayout;
|
|
14
|
+
}
|
|
15
|
+
/** 描述列表项组件属性 */
|
|
16
|
+
export interface DescriptionsItemProps {
|
|
17
|
+
/** 键名文本 */
|
|
18
|
+
label?: string;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=descriptions.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { DeconstructValue } from "@veltra/utils";
|
|
2
|
+
/** 对话框过渡动画名称 */
|
|
3
|
+
export type DialogTransition = 'fade-scale';
|
|
4
|
+
/** 对话框正文水平对齐(NutUI 惯例默认居中,表单等场景可切左对齐) */
|
|
5
|
+
export type DialogContentAlign = 'left' | 'center' | 'right';
|
|
6
|
+
/** 对话框组件属性 */
|
|
7
|
+
export interface DialogProps {
|
|
8
|
+
/** 显示或隐藏 */
|
|
9
|
+
modelValue?: boolean;
|
|
10
|
+
/** 弹框标题,header的别名 */
|
|
11
|
+
title?: string;
|
|
12
|
+
/** 弹框头部内容,别名是header */
|
|
13
|
+
header?: string;
|
|
14
|
+
/** 确认按钮文字;传入 #footer 插槽时整个按钮组由插槽接管 */
|
|
15
|
+
confirmText?: string;
|
|
16
|
+
/** 取消按钮文字 */
|
|
17
|
+
cancelText?: string;
|
|
18
|
+
/** 是否显示取消按钮 */
|
|
19
|
+
showCancel?: boolean;
|
|
20
|
+
/** footer 按钮组纵向堆叠(多操作/长文案场景) */
|
|
21
|
+
verticalActions?: boolean;
|
|
22
|
+
/** 正文水平对齐 */
|
|
23
|
+
contentAlign?: DialogContentAlign;
|
|
24
|
+
/** 显示模态层 */
|
|
25
|
+
modal?: boolean;
|
|
26
|
+
/** 全屏 */
|
|
27
|
+
fullscreen?: boolean;
|
|
28
|
+
/** 弹框过渡动画,默认为 fade-scale */
|
|
29
|
+
transition?: DialogTransition;
|
|
30
|
+
}
|
|
31
|
+
/** 对话框组件定义的事件 */
|
|
32
|
+
export interface DialogEmits {
|
|
33
|
+
/** 更新对话框的显示 */
|
|
34
|
+
(e: 'update:modelValue', visible: boolean): void;
|
|
35
|
+
/** 点击确认按钮(默认随点击关闭) */
|
|
36
|
+
(e: 'confirm'): void;
|
|
37
|
+
/** 点击取消按钮(默认随点击关闭) */
|
|
38
|
+
(e: 'cancel'): void;
|
|
39
|
+
/** 对话框完全关闭后触发的事件 */
|
|
40
|
+
(e: 'closed'): void;
|
|
41
|
+
}
|
|
42
|
+
/** 对话框组件暴露的属性和方法(组件内部使用) */
|
|
43
|
+
export interface _DialogExposed {
|
|
44
|
+
/** 关闭对话框 */
|
|
45
|
+
close: () => void;
|
|
46
|
+
}
|
|
47
|
+
/** 对话框组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
48
|
+
export type DialogExposed = DeconstructValue<_DialogExposed>;
|
|
49
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** 分割线组件属性 */
|
|
2
|
+
export interface DividerProps {
|
|
3
|
+
/** 方向,水平或垂直,默认 'horizontal' */
|
|
4
|
+
direction?: 'horizontal' | 'vertical';
|
|
5
|
+
/** 是否为虚线,默认 false */
|
|
6
|
+
dashed?: boolean;
|
|
7
|
+
/** 嵌套文字的对齐位置,仅水平方向生效,默认 'center' */
|
|
8
|
+
align?: 'left' | 'center' | 'right';
|
|
9
|
+
}
|
|
10
|
+
/** 分割线组件定义的事件 */
|
|
11
|
+
export interface DividerEmits {}
|
|
12
|
+
//# sourceMappingURL=divider.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DeconstructValue } from "@veltra/utils";
|
|
2
|
+
/** 抽屉方位(NutUI 惯例 prop 名),决定滑出方向与对应边缘的拖拽关闭手势 */
|
|
3
|
+
export type DrawerPlacement = 'left' | 'right' | 'top' | 'bottom';
|
|
4
|
+
/** 抽屉模式 */
|
|
5
|
+
export type DrawerMode = 'edge' | 'inset';
|
|
6
|
+
/** 抽屉组件属性 */
|
|
7
|
+
export interface DrawerProps {
|
|
8
|
+
/** 是否显示抽屉 */
|
|
9
|
+
modelValue?: boolean;
|
|
10
|
+
/** 抽屉方位,默认 bottom(移动端惯例底部面板) */
|
|
11
|
+
placement?: DrawerPlacement;
|
|
12
|
+
/** 是否显示关闭按钮 */
|
|
13
|
+
showClose?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* 抽屉标题;传入时在内容区上方渲染标题栏
|
|
16
|
+
* @description 不传则不渲染标题栏,内容仍全部来自默认插槽
|
|
17
|
+
*/
|
|
18
|
+
title?: string;
|
|
19
|
+
}
|
|
20
|
+
/** 抽屉组件定义的事件 */
|
|
21
|
+
export interface DrawerEmits {
|
|
22
|
+
(e: 'update:modelValue', value: boolean): void;
|
|
23
|
+
/** 开始关闭时触发(点遮罩、点关闭按钮、边缘拖拽关闭) */
|
|
24
|
+
(e: 'close'): void;
|
|
25
|
+
/** 完全关闭后触发:抽屉与遮罩的退出动画结束、节点已移除时 */
|
|
26
|
+
(e: 'closed'): void;
|
|
27
|
+
}
|
|
28
|
+
/** 抽屉组件暴露的属性和方法(组件内部使用) */
|
|
29
|
+
export interface _DrawerExposed {}
|
|
30
|
+
/** 抽屉组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
31
|
+
export type DrawerExposed = DeconstructValue<_DrawerExposed>;
|
|
32
|
+
//# sourceMappingURL=drawer.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DeconstructValue } from "@veltra/utils";
|
|
2
|
+
/** 空内容组件属性 */
|
|
3
|
+
export interface EmptyProps {
|
|
4
|
+
/** 图标大小, 默认48 */
|
|
5
|
+
size?: number;
|
|
6
|
+
/** 空文本 */
|
|
7
|
+
text?: string;
|
|
8
|
+
}
|
|
9
|
+
/** 空内容组件定义的事件 */
|
|
10
|
+
export interface EmptyEmits {}
|
|
11
|
+
/** 空内容组件暴露的属性和方法(组件内部使用) */
|
|
12
|
+
export interface _EmptyExposed {}
|
|
13
|
+
/** 空内容组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
14
|
+
export type EmptyExposed = DeconstructValue<_EmptyExposed>;
|
|
15
|
+
//# sourceMappingURL=empty.d.ts.map
|