@veltra/mobile 1.0.0 → 1.1.0
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/package.json +32 -6
- package/src/components/_internal/bottom-sheet/bottom-sheet.vue +81 -0
- package/src/components/_internal/bottom-sheet/index.ts +1 -0
- package/src/components/_internal/bottom-sheet/style.scss +116 -0
- package/src/components/_internal/bottom-sheet/style.ts +1 -0
- package/src/components/_internal/overlay-container.ts +34 -0
- package/src/components/avatar/avatar.vue +44 -0
- package/src/components/avatar/index.ts +1 -0
- package/src/components/avatar/style.scss +53 -0
- package/src/components/avatar/style.ts +1 -0
- package/src/components/badge/badge.vue +59 -0
- package/src/components/badge/index.ts +1 -0
- package/src/components/badge/style.scss +62 -0
- package/src/components/badge/style.ts +1 -0
- package/src/components/button/button.vue +76 -0
- package/src/components/button/index.ts +1 -0
- package/src/components/button/style.scss +207 -0
- package/src/components/button/style.ts +1 -0
- package/src/components/card/card.vue +24 -0
- package/src/components/card/index.ts +1 -0
- package/src/components/card/style.scss +35 -0
- package/src/components/card/style.ts +1 -0
- package/src/components/cascade/cascade.vue +595 -0
- package/src/components/cascade/index.ts +1 -0
- package/src/components/cascade/node.ts +29 -0
- package/src/components/cascade/style.scss +424 -0
- package/src/components/cascade/style.ts +2 -0
- package/src/components/check-tag/check-tag.vue +35 -0
- package/src/components/check-tag/index.ts +1 -0
- package/src/components/check-tag/style.scss +46 -0
- package/src/components/check-tag/style.ts +1 -0
- package/src/components/checkbox/checkbox.vue +67 -0
- package/src/components/checkbox/index.ts +1 -0
- package/src/components/checkbox/style.scss +132 -0
- package/src/components/checkbox/style.ts +2 -0
- package/src/components/checkbox-group/checkbox-group.vue +94 -0
- package/src/components/checkbox-group/index.ts +1 -0
- package/src/components/checkbox-group/style.scss +57 -0
- package/src/components/checkbox-group/style.ts +2 -0
- package/src/components/collapse/collapse-item.vue +134 -0
- package/src/components/collapse/collapse.vue +117 -0
- package/src/components/collapse/di.ts +18 -0
- package/src/components/collapse/index.ts +3 -0
- package/src/components/collapse/style.scss +157 -0
- package/src/components/collapse/style.ts +1 -0
- package/src/components/date-picker/date-picker.vue +326 -0
- package/src/components/date-picker/index.ts +1 -0
- package/src/components/date-picker/style.scss +236 -0
- package/src/components/date-picker/style.ts +2 -0
- package/src/components/descriptions/descriptions-item.vue +12 -0
- package/src/components/descriptions/descriptions.vue +50 -0
- package/src/components/descriptions/index.ts +2 -0
- package/src/components/descriptions/style.scss +120 -0
- package/src/components/descriptions/style.ts +1 -0
- package/src/components/dialog/dialog.vue +143 -0
- package/src/components/dialog/index.ts +1 -0
- package/src/components/dialog/style.scss +163 -0
- package/src/components/dialog/style.ts +4 -0
- package/src/components/divider/divider.vue +29 -0
- package/src/components/divider/index.ts +1 -0
- package/src/components/divider/style.scss +91 -0
- package/src/components/divider/style.ts +1 -0
- package/src/components/drawer/drawer.vue +168 -0
- package/src/components/drawer/index.ts +1 -0
- package/src/components/drawer/style.scss +240 -0
- package/src/components/drawer/style.ts +2 -0
- package/src/components/empty/empty.vue +22 -0
- package/src/components/empty/index.ts +1 -0
- package/src/components/empty/style.scss +36 -0
- package/src/components/empty/style.ts +1 -0
- package/src/components/form/form.vue +119 -0
- package/src/components/form/index.ts +1 -0
- package/src/components/form/is-field-modified.ts +16 -0
- package/src/components/form/style.scss +58 -0
- package/src/components/form/style.ts +2 -0
- package/src/components/form/use-form-fields.ts +115 -0
- package/src/components/form/use-node-interceptor.ts +101 -0
- package/src/components/form-item/form-item.vue +171 -0
- package/src/components/form-item/helper.ts +9 -0
- package/src/components/form-item/index.ts +1 -0
- package/src/components/form-item/style.scss +121 -0
- package/src/components/form-item/style.ts +1 -0
- package/src/components/form-item/validate.ts +131 -0
- package/src/components/icon/icon.vue +23 -0
- package/src/components/icon/index.ts +1 -0
- package/src/components/icon/style.scss +37 -0
- package/src/components/icon/style.ts +1 -0
- package/src/components/input/index.ts +1 -0
- package/src/components/input/input.vue +187 -0
- package/src/components/input/style.scss +121 -0
- package/src/components/input/style.ts +1 -0
- package/src/components/list/index.ts +3 -0
- package/src/components/list/list-item.vue +20 -0
- package/src/components/list/list.vue +20 -0
- package/src/components/list/style.scss +50 -0
- package/src/components/list/style.ts +1 -0
- package/src/components/loading/directive.ts +34 -0
- package/src/components/loading/index.ts +3 -0
- package/src/components/loading/loading.vue +25 -0
- package/src/components/loading/style.scss +179 -0
- package/src/components/loading/style.ts +2 -0
- package/src/components/message/helper.ts +28 -0
- package/src/components/message/index.ts +3 -0
- package/src/components/message/message-box.vue +31 -0
- package/src/components/message/message.ts +122 -0
- package/src/components/message/message.vue +54 -0
- package/src/components/message/style.scss +130 -0
- package/src/components/message/style.ts +1 -0
- package/src/components/message-confirm/index.ts +3 -0
- package/src/components/message-confirm/message-confirm-box.vue +36 -0
- package/src/components/message-confirm/message-confirm.ts +139 -0
- package/src/components/message-confirm/message-confirm.vue +53 -0
- package/src/components/message-confirm/style.scss +138 -0
- package/src/components/message-confirm/style.ts +1 -0
- package/src/components/multi-select/index.ts +1 -0
- package/src/components/multi-select/multi-select.vue +410 -0
- package/src/components/multi-select/style.scss +376 -0
- package/src/components/multi-select/style.ts +2 -0
- package/src/components/number-input/index.ts +1 -0
- package/src/components/number-input/number-input.vue +407 -0
- package/src/components/number-input/style.scss +118 -0
- package/src/components/number-input/style.ts +2 -0
- package/src/components/password-input/index.ts +1 -0
- package/src/components/password-input/password-input.vue +134 -0
- package/src/components/password-input/style.scss +40 -0
- package/src/components/password-input/style.ts +2 -0
- package/src/components/progress/index.ts +1 -0
- package/src/components/progress/progress.vue +90 -0
- package/src/components/progress/style.scss +73 -0
- package/src/components/progress/style.ts +1 -0
- package/src/components/radio/index.ts +1 -0
- package/src/components/radio/radio.vue +57 -0
- package/src/components/radio/style.scss +113 -0
- package/src/components/radio/style.ts +1 -0
- package/src/components/radio-group/index.ts +1 -0
- package/src/components/radio-group/radio-group.vue +60 -0
- package/src/components/radio-group/style.scss +29 -0
- package/src/components/radio-group/style.ts +2 -0
- package/src/components/segment/index.ts +1 -0
- package/src/components/segment/segment.vue +121 -0
- package/src/components/segment/style.scss +118 -0
- package/src/components/segment/style.ts +1 -0
- package/src/components/select/index.ts +1 -0
- package/src/components/select/select.vue +278 -0
- package/src/components/select/style.scss +237 -0
- package/src/components/select/style.ts +2 -0
- package/src/components/select/use-options.ts +195 -0
- package/src/components/skeleton/index.ts +1 -0
- package/src/components/skeleton/skeleton.vue +37 -0
- package/src/components/skeleton/style.scss +95 -0
- package/src/components/skeleton/style.ts +1 -0
- package/src/components/space/index.ts +1 -0
- package/src/components/space/space.vue +45 -0
- package/src/components/space/style.scss +41 -0
- package/src/components/space/style.ts +1 -0
- package/src/components/steps/index.ts +1 -0
- package/src/components/steps/steps.vue +114 -0
- package/src/components/steps/style.scss +231 -0
- package/src/components/steps/style.ts +1 -0
- package/src/components/switch/index.ts +1 -0
- package/src/components/switch/style.scss +137 -0
- package/src/components/switch/style.ts +1 -0
- package/src/components/switch/switch.vue +63 -0
- package/src/components/tabs/index.ts +1 -0
- package/src/components/tabs/style.scss +285 -0
- package/src/components/tabs/style.ts +1 -0
- package/src/components/tabs/tabs.vue +127 -0
- package/src/components/tag/index.ts +1 -0
- package/src/components/tag/style.scss +114 -0
- package/src/components/tag/style.ts +1 -0
- package/src/components/tag/tag.vue +49 -0
- package/src/components/text/index.ts +1 -0
- package/src/components/text/style.scss +63 -0
- package/src/components/text/style.ts +1 -0
- package/src/components/text/text.vue +63 -0
- package/src/components/textarea/index.ts +1 -0
- package/src/components/textarea/style.scss +124 -0
- package/src/components/textarea/style.ts +1 -0
- package/src/components/textarea/textarea.vue +121 -0
- package/src/components/textarea/utils.ts +11 -0
- package/src/components/time-picker/index.ts +1 -0
- package/src/components/time-picker/style.scss +216 -0
- package/src/components/time-picker/style.ts +2 -0
- package/src/components/time-picker/time-picker.vue +263 -0
- package/src/components/timeline/index.ts +2 -0
- package/src/components/timeline/style.scss +107 -0
- package/src/components/timeline/style.ts +1 -0
- package/src/components/timeline/timeline-item.vue +43 -0
- package/src/components/timeline/timeline.vue +16 -0
- package/src/components/uploader/index.ts +1 -0
- package/src/components/uploader/style.scss +220 -0
- package/src/components/uploader/style.ts +1 -0
- package/src/components/uploader/uploader.vue +306 -0
- package/src/env.d.ts +7 -0
- package/src/index.ts +99 -1
- package/src/shared/bem.ts +12 -0
- package/src/shared/use-scroll-lock.ts +111 -0
- package/src/shared/use-touch-gesture.ts +150 -0
- package/src/styles/_tokens.scss +129 -0
- package/src/types/avatar.ts +31 -0
- package/src/types/badge.ts +28 -0
- package/src/types/button.ts +48 -0
- package/src/types/card.ts +16 -0
- package/src/types/cascade.ts +87 -0
- package/src/types/check-tag.ts +24 -0
- package/src/types/checkbox-group.ts +20 -0
- package/src/types/checkbox.ts +15 -0
- package/src/types/collapse.ts +79 -0
- package/src/types/date-picker.ts +39 -0
- package/src/types/descriptions.ts +22 -0
- package/src/types/dialog.ts +54 -0
- package/src/types/divider.ts +14 -0
- package/src/types/drawer.ts +38 -0
- package/src/types/empty.ts +19 -0
- package/src/types/form-item.ts +22 -0
- package/src/types/form.ts +54 -0
- package/src/types/icon.ts +10 -0
- package/src/types/input.ts +51 -0
- package/src/types/list.ts +13 -0
- package/src/types/loading.ts +20 -0
- package/src/types/message-confirm.ts +72 -0
- package/src/types/message.ts +71 -0
- package/src/types/multi-select.ts +38 -0
- package/src/types/number-input.ts +32 -0
- package/src/types/password-input.ts +19 -0
- package/src/types/progress.ts +22 -0
- package/src/types/radio-group.ts +33 -0
- package/src/types/radio.ts +18 -0
- package/src/types/segment.ts +42 -0
- package/src/types/select.ts +63 -0
- package/src/types/skeleton.ts +29 -0
- package/src/types/space.ts +22 -0
- package/src/types/steps.ts +67 -0
- package/src/types/switch.ts +17 -0
- package/src/types/tabs.ts +63 -0
- package/src/types/tag.ts +19 -0
- package/src/types/text.ts +28 -0
- package/src/types/textarea.ts +76 -0
- package/src/types/time-picker.ts +40 -0
- package/src/types/timeline.ts +15 -0
- package/src/types/uploader.ts +50 -0
- package/.turbo/turbo-build.log +0 -2
- package/.turbo/turbo-check-types.log +0 -1
- package/tsconfig.json +0 -12
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { ComponentProps } from '@veltra/utils'
|
|
2
|
+
import type { Component } from 'vue'
|
|
3
|
+
|
|
4
|
+
/** Collapse 项的唯一标识 */
|
|
5
|
+
export type CollapseValue = string | number
|
|
6
|
+
|
|
7
|
+
/** Collapse modelValue:手风琴模式为单值,普通模式为数组(也兼容传入单值) */
|
|
8
|
+
export type CollapseModelValue = CollapseValue | CollapseValue[]
|
|
9
|
+
|
|
10
|
+
/** Collapse 组件属性 */
|
|
11
|
+
export interface CollapseProps extends ComponentProps {
|
|
12
|
+
/** 当前展开项的 value(单个或多个) */
|
|
13
|
+
modelValue?: CollapseModelValue
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 是否手风琴模式(一次只能展开一项)
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
accordion?: boolean
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 是否默认折叠全部项。设为 false 时默认全部展开。
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
defaultCollapseAll?: boolean
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 自定义展开图标组件,活动态会自动旋转 180°。
|
|
29
|
+
* 接受任意 Vue 组件(SFC、Functional Component 等)。
|
|
30
|
+
*/
|
|
31
|
+
expandIcon?: Component
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface CollapseEmits {
|
|
35
|
+
(e: 'update:modelValue', value: CollapseModelValue): void
|
|
36
|
+
/** 当前展开项变更时触发 */
|
|
37
|
+
(e: 'change', value: CollapseModelValue): void
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** CollapseItem 组件属性 */
|
|
41
|
+
export interface CollapseItemProps {
|
|
42
|
+
/**
|
|
43
|
+
* 唯一标识;在 `UCollapse` 内使用时必填。
|
|
44
|
+
* 独立使用时可选。
|
|
45
|
+
*/
|
|
46
|
+
value?: CollapseValue
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* 独立使用时的展开状态(`v-model`)。
|
|
50
|
+
* 在 `UCollapse` 内由父组件 `modelValue` 管理,此属性无效。
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
modelValue?: boolean
|
|
54
|
+
|
|
55
|
+
/** 标题文本(也可通过 #header 插槽自定义标题区;展开图标始终保留,可用 expandIcon 替换) */
|
|
56
|
+
title?: string
|
|
57
|
+
|
|
58
|
+
/** 是否禁用 */
|
|
59
|
+
disabled?: boolean
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 独立使用时的自定义展开图标,活动态会自动旋转 180°。
|
|
63
|
+
* 在 `UCollapse` 内由父组件 `expandIcon` 统一管理。
|
|
64
|
+
*/
|
|
65
|
+
expandIcon?: Component
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 折叠动画结束后卸载内容 DOM(展开时重新挂载),减少长列表的内存与渲染成本。
|
|
69
|
+
* 注意:卸载会丢失内容区的本地组件状态。
|
|
70
|
+
* @default false
|
|
71
|
+
*/
|
|
72
|
+
destroyOnCollapse?: boolean
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface CollapseItemEmits {
|
|
76
|
+
(e: 'update:modelValue', value: boolean): void
|
|
77
|
+
/** 展开状态变更时触发(仅独立使用) */
|
|
78
|
+
(e: 'change', value: boolean): void
|
|
79
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Dater } from '@cat-kit/core'
|
|
2
|
+
import type { DeconstructValue, FormComponentProps } from '@veltra/utils'
|
|
3
|
+
|
|
4
|
+
/** 绑定值类型 */
|
|
5
|
+
export type DatePickerDataType = 'date' | 'timestamp' | 'string'
|
|
6
|
+
|
|
7
|
+
/** date-picker组件属性(与 @veltra/desktop UDatePicker 对齐) */
|
|
8
|
+
export interface DatePickerProps extends FormComponentProps {
|
|
9
|
+
modelValue?: string | number | Date
|
|
10
|
+
/** 占位 */
|
|
11
|
+
placeholder?: string
|
|
12
|
+
/** 日期类型 */
|
|
13
|
+
type?: 'date' | 'month' | 'year'
|
|
14
|
+
/** 日期格式化 */
|
|
15
|
+
format?: string
|
|
16
|
+
/** 日期值格式化, 当没有指定时默认使用format属性,仅当值和显示的内容不一致时才需要使用到该属性 */
|
|
17
|
+
valueFormat?: string
|
|
18
|
+
/**
|
|
19
|
+
* 绑定值的类型,默认为字符串。
|
|
20
|
+
* 当 dataType 没有指定为字符串时,valueFormat 属性不生效
|
|
21
|
+
*/
|
|
22
|
+
dataType?: DatePickerDataType
|
|
23
|
+
/** 最小可选日期 */
|
|
24
|
+
disabledDate?: (date: Dater, raw: Date) => boolean
|
|
25
|
+
/** 是否显示清除按钮 */
|
|
26
|
+
clearable?: boolean
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** date-picker组件定义的事件 */
|
|
30
|
+
export interface DatePickerEmits {
|
|
31
|
+
(e: 'update:modelValue', value?: string | number | Date): void
|
|
32
|
+
(e: 'change', date?: Date): void
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** date-picker组件暴露的属性和方法(组件内部使用) */
|
|
36
|
+
export interface _DatePickerExposed {}
|
|
37
|
+
|
|
38
|
+
/** date-picker组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
39
|
+
export type DatePickerExposed = DeconstructValue<_DatePickerExposed>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ComponentProps } from '@veltra/utils'
|
|
2
|
+
|
|
3
|
+
/** 描述列表布局:horizontal 键值同行 / vertical 键值分行 */
|
|
4
|
+
export type DescriptionsLayout = 'horizontal' | 'vertical'
|
|
5
|
+
|
|
6
|
+
/** 描述列表组件属性 */
|
|
7
|
+
export interface DescriptionsProps extends ComponentProps {
|
|
8
|
+
/** 列表标题,渲染在列表顶部 */
|
|
9
|
+
title?: string
|
|
10
|
+
/** 每行展示的键值对列数,默认 3 */
|
|
11
|
+
column?: number
|
|
12
|
+
/** 边框模式:键值单元格带描边与键名底色,默认 false(无边框) */
|
|
13
|
+
border?: boolean
|
|
14
|
+
/** 布局方向,默认 'horizontal' */
|
|
15
|
+
layout?: DescriptionsLayout
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** 描述列表项组件属性 */
|
|
19
|
+
export interface DescriptionsItemProps {
|
|
20
|
+
/** 键名文本 */
|
|
21
|
+
label?: string
|
|
22
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { DeconstructValue } from '@veltra/utils'
|
|
2
|
+
|
|
3
|
+
/** 对话框过渡动画名称 */
|
|
4
|
+
export type DialogTransition = 'fade-scale'
|
|
5
|
+
|
|
6
|
+
/** 对话框正文水平对齐(NutUI 惯例默认居中,表单等场景可切左对齐) */
|
|
7
|
+
export type DialogContentAlign = 'left' | 'center' | 'right'
|
|
8
|
+
|
|
9
|
+
/** 对话框组件属性 */
|
|
10
|
+
export interface DialogProps {
|
|
11
|
+
/** 显示或隐藏 */
|
|
12
|
+
modelValue?: boolean
|
|
13
|
+
/** 弹框标题,header的别名 */
|
|
14
|
+
title?: string
|
|
15
|
+
/** 弹框头部内容,别名是header */
|
|
16
|
+
header?: string
|
|
17
|
+
/** 确认按钮文字;传入 #footer 插槽时整个按钮组由插槽接管 */
|
|
18
|
+
confirmText?: string
|
|
19
|
+
/** 取消按钮文字 */
|
|
20
|
+
cancelText?: string
|
|
21
|
+
/** 是否显示取消按钮 */
|
|
22
|
+
showCancel?: boolean
|
|
23
|
+
/** footer 按钮组纵向堆叠(多操作/长文案场景) */
|
|
24
|
+
verticalActions?: boolean
|
|
25
|
+
/** 正文水平对齐 */
|
|
26
|
+
contentAlign?: DialogContentAlign
|
|
27
|
+
/** 显示模态层 */
|
|
28
|
+
modal?: boolean
|
|
29
|
+
/** 全屏 */
|
|
30
|
+
fullscreen?: boolean
|
|
31
|
+
/** 弹框过渡动画,默认为 fade-scale */
|
|
32
|
+
transition?: DialogTransition
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** 对话框组件定义的事件 */
|
|
36
|
+
export interface DialogEmits {
|
|
37
|
+
/** 更新对话框的显示 */
|
|
38
|
+
(e: 'update:modelValue', visible: boolean): void
|
|
39
|
+
/** 点击确认按钮(默认随点击关闭) */
|
|
40
|
+
(e: 'confirm'): void
|
|
41
|
+
/** 点击取消按钮(默认随点击关闭) */
|
|
42
|
+
(e: 'cancel'): void
|
|
43
|
+
/** 对话框完全关闭后触发的事件 */
|
|
44
|
+
(e: 'closed'): void
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** 对话框组件暴露的属性和方法(组件内部使用) */
|
|
48
|
+
export interface _DialogExposed {
|
|
49
|
+
/** 关闭对话框 */
|
|
50
|
+
close: () => void
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** 对话框组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
54
|
+
export type DialogExposed = DeconstructValue<_DialogExposed>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** 分割线组件属性 */
|
|
2
|
+
export interface DividerProps {
|
|
3
|
+
/** 方向,水平或垂直,默认 'horizontal' */
|
|
4
|
+
direction?: 'horizontal' | 'vertical'
|
|
5
|
+
|
|
6
|
+
/** 是否为虚线,默认 false */
|
|
7
|
+
dashed?: boolean
|
|
8
|
+
|
|
9
|
+
/** 嵌套文字的对齐位置,仅水平方向生效,默认 'center' */
|
|
10
|
+
align?: 'left' | 'center' | 'right'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** 分割线组件定义的事件 */
|
|
14
|
+
export interface DividerEmits {}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { DeconstructValue } from '@veltra/utils'
|
|
2
|
+
|
|
3
|
+
/** 抽屉方位(NutUI 惯例 prop 名),决定滑出方向与对应边缘的拖拽关闭手势 */
|
|
4
|
+
export type DrawerPlacement = 'left' | 'right' | 'top' | 'bottom'
|
|
5
|
+
|
|
6
|
+
/** 抽屉模式 */
|
|
7
|
+
export type DrawerMode = 'edge' | 'inset'
|
|
8
|
+
|
|
9
|
+
/** 抽屉组件属性 */
|
|
10
|
+
export interface DrawerProps {
|
|
11
|
+
/** 是否显示抽屉 */
|
|
12
|
+
modelValue?: boolean
|
|
13
|
+
/** 抽屉方位,默认 bottom(移动端惯例底部面板) */
|
|
14
|
+
placement?: DrawerPlacement
|
|
15
|
+
|
|
16
|
+
/** 是否显示关闭按钮 */
|
|
17
|
+
showClose?: boolean
|
|
18
|
+
/**
|
|
19
|
+
* 抽屉标题;传入时在内容区上方渲染标题栏
|
|
20
|
+
* @description 不传则不渲染标题栏,内容仍全部来自默认插槽
|
|
21
|
+
*/
|
|
22
|
+
title?: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** 抽屉组件定义的事件 */
|
|
26
|
+
export interface DrawerEmits {
|
|
27
|
+
(e: 'update:modelValue', value: boolean): void
|
|
28
|
+
/** 开始关闭时触发(点遮罩、点关闭按钮、边缘拖拽关闭) */
|
|
29
|
+
(e: 'close'): void
|
|
30
|
+
/** 完全关闭后触发:抽屉与遮罩的退出动画结束、节点已移除时 */
|
|
31
|
+
(e: 'closed'): void
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** 抽屉组件暴露的属性和方法(组件内部使用) */
|
|
35
|
+
export interface _DrawerExposed {}
|
|
36
|
+
|
|
37
|
+
/** 抽屉组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
38
|
+
export type DrawerExposed = DeconstructValue<_DrawerExposed>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DeconstructValue } from '@veltra/utils'
|
|
2
|
+
|
|
3
|
+
/** 空内容组件属性 */
|
|
4
|
+
export interface EmptyProps {
|
|
5
|
+
/** 图标大小, 默认48 */
|
|
6
|
+
size?: number
|
|
7
|
+
|
|
8
|
+
/** 空文本 */
|
|
9
|
+
text?: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** 空内容组件定义的事件 */
|
|
13
|
+
export interface EmptyEmits {}
|
|
14
|
+
|
|
15
|
+
/** 空内容组件暴露的属性和方法(组件内部使用) */
|
|
16
|
+
export interface _EmptyExposed {}
|
|
17
|
+
|
|
18
|
+
/** 空内容组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
19
|
+
export type EmptyExposed = DeconstructValue<_EmptyExposed>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FormComponentProps } from '@veltra/utils'
|
|
2
|
+
|
|
3
|
+
/** 表单项组件属性 */
|
|
4
|
+
export interface FormItemProps extends FormComponentProps {
|
|
5
|
+
/**
|
|
6
|
+
* 标签宽度
|
|
7
|
+
* - number 单位 px;传了该值(自身或 UForm)label 用固定宽对齐
|
|
8
|
+
* - 都未传时 label 按内容自适应宽度(移动端默认)
|
|
9
|
+
*/
|
|
10
|
+
labelWidth?: string | number
|
|
11
|
+
/** 标签位置;默认 'left' 行式(label 左、控件右),'top' 时 label 在控件上方 */
|
|
12
|
+
labelPosition?: 'top' | 'left'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** 表单项组件定义的事件 */
|
|
16
|
+
export interface FormItemEmits {
|
|
17
|
+
/** 内部控件 change,参数与控件一致 */
|
|
18
|
+
(e: 'change', ...args: any[]): void
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** 表单项组件暴露的属性和方法 */
|
|
22
|
+
export interface FormItemExposed {}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ComponentProps, DeconstructValue } from '@veltra/utils'
|
|
2
|
+
import type { ShallowRef } from 'vue'
|
|
3
|
+
|
|
4
|
+
/** 表单组件属性 */
|
|
5
|
+
export interface FormProps extends ComponentProps {
|
|
6
|
+
/**
|
|
7
|
+
* 自定义表单列数
|
|
8
|
+
* - 移动端单列呈现,该属性不生效
|
|
9
|
+
*/
|
|
10
|
+
cols?: number
|
|
11
|
+
/** 分组标题:渲染在卡片列表顶部,与 #header 插槽二选一,插槽优先 */
|
|
12
|
+
title?: string
|
|
13
|
+
/** 表单数据 */
|
|
14
|
+
model?: Record<string, any>
|
|
15
|
+
/** 开启后,字段当前值与基准值不同时,在控件下方展示「变更前」 */
|
|
16
|
+
showModified?: boolean
|
|
17
|
+
/** 「变更前」标签文案,默认「变更前:」 */
|
|
18
|
+
modifiedLabel?: string
|
|
19
|
+
/** 变更前基准数据;未传时回退到 model 引用首次传入时的快照(与 reset 一致) */
|
|
20
|
+
initialModel?: Record<string, any>
|
|
21
|
+
/**
|
|
22
|
+
* 表单项 label 宽度
|
|
23
|
+
* - number 单位 px;传了该值各行 label 固定宽对齐
|
|
24
|
+
* - 未传时 label 按内容自适应宽度(移动端默认)
|
|
25
|
+
*/
|
|
26
|
+
labelWidth?: string | number
|
|
27
|
+
/** 表单项 label 位置;默认 'left' 行式(label 左、控件右),'top' 时 label 在控件上方 */
|
|
28
|
+
labelPosition?: 'top' | 'left'
|
|
29
|
+
/** 是否不显示tips */
|
|
30
|
+
noTips?: boolean
|
|
31
|
+
/** 是否只读 */
|
|
32
|
+
readonly?: boolean
|
|
33
|
+
/** 是否禁用 */
|
|
34
|
+
disabled?: boolean
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** 表单组件定义的事件 */
|
|
38
|
+
export interface FormEmits {
|
|
39
|
+
/** model 字段值更新,含编程写入 */
|
|
40
|
+
(e: 'field:update', field: string, value: any): void
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** 表单暴露的属性和方法(组件内部使用) */
|
|
44
|
+
export interface _FormExposed {
|
|
45
|
+
el: ShallowRef<HTMLElement | null | undefined>
|
|
46
|
+
/** 校验指定字段,未传 keys 时校验全部已注册字段 */
|
|
47
|
+
validate: (keys?: string[]) => Promise<boolean>
|
|
48
|
+
clearValidate: () => void
|
|
49
|
+
/** 将 model 恢复为最近一次 props.model 引用变更时的快照,并清除校验 */
|
|
50
|
+
reset: () => void
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** 表单暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
54
|
+
export type FormExposed = DeconstructValue<_FormExposed>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { DeconstructValue, FormComponentProps } from '@veltra/utils'
|
|
2
|
+
import type { ShallowRef } from 'vue'
|
|
3
|
+
|
|
4
|
+
/** 输入框组件属性(API 与 @veltra/desktop UInput 对齐;字号 16px、44px 触控热区为移动端形态) */
|
|
5
|
+
export interface InputProps extends FormComponentProps {
|
|
6
|
+
/** modelValue */
|
|
7
|
+
modelValue?: string
|
|
8
|
+
/** 占位符 */
|
|
9
|
+
placeholder?: string
|
|
10
|
+
/** 前缀 */
|
|
11
|
+
prefix?: string
|
|
12
|
+
/** 后缀 */
|
|
13
|
+
suffix?: string
|
|
14
|
+
/** 是否可清除(移动端有值即展示清除按钮,不依赖 hover),默认 true */
|
|
15
|
+
clearable?: boolean
|
|
16
|
+
/** 原生只读 */
|
|
17
|
+
nativeReadonly?: boolean
|
|
18
|
+
/**
|
|
19
|
+
* 模式
|
|
20
|
+
* @description 如果指定请保证有一个符合模式的默认值
|
|
21
|
+
*/
|
|
22
|
+
pattern?: RegExp
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** 输入框组件定义的事件 */
|
|
26
|
+
export interface InputEmits {
|
|
27
|
+
/** 输入时持续更新 */
|
|
28
|
+
(e: 'update:modelValue', value: string): void
|
|
29
|
+
/** 在输入框失焦时触发更新 */
|
|
30
|
+
(e: 'change', value: string): void
|
|
31
|
+
/** 后缀点击事件 */
|
|
32
|
+
(e: 'suffix:click', value?: string): void
|
|
33
|
+
/** 前缀点击事件 */
|
|
34
|
+
(e: 'prefix:click', value?: string): void
|
|
35
|
+
/** 聚焦事件 */
|
|
36
|
+
(e: 'focus', value?: string): void
|
|
37
|
+
/** 清除事件 */
|
|
38
|
+
(e: 'clear'): void
|
|
39
|
+
/** 失焦事件 */
|
|
40
|
+
(e: 'blur', value?: string): void
|
|
41
|
+
/** 原生输入事件 */
|
|
42
|
+
(e: 'native:input', ev: Event): void
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** 输入框暴露的属性和方法(组件内部使用) */
|
|
46
|
+
export interface _InputExposed {
|
|
47
|
+
el: ShallowRef<HTMLInputElement | undefined>
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** 输入框暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
51
|
+
export type InputExposed = DeconstructValue<_InputExposed>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ComponentSize, DeconstructValue } from '@veltra/utils'
|
|
2
|
+
|
|
3
|
+
export interface ListProps {
|
|
4
|
+
size?: ComponentSize
|
|
5
|
+
/** 列表数据 */
|
|
6
|
+
data: Record<string, any>[]
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface ListEmits {}
|
|
10
|
+
|
|
11
|
+
export interface _ListExposed {}
|
|
12
|
+
|
|
13
|
+
export type ListExposed = DeconstructValue<_ListExposed>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { DeconstructValue } from '@veltra/utils'
|
|
2
|
+
|
|
3
|
+
export type LoadingType = 'dual-ring' | 'dot' | 'ring' | 'bars'
|
|
4
|
+
|
|
5
|
+
/** loading组件属性 */
|
|
6
|
+
export interface LoadingProps {
|
|
7
|
+
/** 加载类型 */
|
|
8
|
+
type: LoadingType
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** loading组件定义的事件 */
|
|
12
|
+
export interface LoadingEmits {
|
|
13
|
+
(e: 'update:modelValue', value: string): void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** loading组件暴露的属性和方法(组件内部使用) */
|
|
17
|
+
export interface _LoadingExposed {}
|
|
18
|
+
|
|
19
|
+
/** loading组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
20
|
+
export type LoadingExposed = DeconstructValue<_LoadingExposed>
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ColorType, ComponentProps, DeconstructValue } from '@veltra/utils'
|
|
2
|
+
import type { AppContext } from 'vue'
|
|
3
|
+
|
|
4
|
+
/** 消息确认框用户操作 */
|
|
5
|
+
export type MessageConfirmAction = 'confirm' | 'cancel'
|
|
6
|
+
|
|
7
|
+
/** 消息确认框组件属性 */
|
|
8
|
+
export interface MessageConfirmProps extends ComponentProps {
|
|
9
|
+
/** 标题 */
|
|
10
|
+
title?: string
|
|
11
|
+
/** 内容 */
|
|
12
|
+
message: string
|
|
13
|
+
/** 确认按钮文字 */
|
|
14
|
+
confirmButtonText?: string
|
|
15
|
+
/** 取消按钮文字,为空则不显示 */
|
|
16
|
+
cancelButtonText?: string
|
|
17
|
+
/** 确认按钮类型 */
|
|
18
|
+
confirmButtonType?: ColorType
|
|
19
|
+
/** 层级,默认由 API 创建时自增分配 */
|
|
20
|
+
zIndex?: number
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** 消息确认框调用选项 */
|
|
24
|
+
export interface MessageConfirmOptions extends MessageConfirmProps {
|
|
25
|
+
/** 点击按钮触发关闭时回调 */
|
|
26
|
+
onClose?: (action: MessageConfirmAction) => void
|
|
27
|
+
/** 关闭动画结束后回调 */
|
|
28
|
+
onClosed?: (action: MessageConfirmAction) => void
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** 消息确认框实例 */
|
|
32
|
+
export interface MessageConfirmInstance {
|
|
33
|
+
/** 唯一标识 */
|
|
34
|
+
id: string
|
|
35
|
+
/** 手动关闭,未指定操作时视为 cancel */
|
|
36
|
+
close(action?: MessageConfirmAction): void
|
|
37
|
+
/** 彻底关闭(含动画结束)后的 Promise,值为用户操作 */
|
|
38
|
+
onClosed: Promise<MessageConfirmAction>
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
type MessageConfirmShortcutConfig = Omit<MessageConfirmOptions, 'message' | 'confirmButtonType'>
|
|
42
|
+
|
|
43
|
+
/** 消息确认框函数式 API */
|
|
44
|
+
export interface MessageConfirm {
|
|
45
|
+
/** 创建确认框 */
|
|
46
|
+
(options: MessageConfirmOptions | string): MessageConfirmInstance
|
|
47
|
+
/** 主要确认框 */
|
|
48
|
+
primary(message: string, config?: MessageConfirmShortcutConfig): MessageConfirmInstance
|
|
49
|
+
/** 成功确认框 */
|
|
50
|
+
success(message: string, config?: MessageConfirmShortcutConfig): MessageConfirmInstance
|
|
51
|
+
/** 信息确认框 */
|
|
52
|
+
info(message: string, config?: MessageConfirmShortcutConfig): MessageConfirmInstance
|
|
53
|
+
/** 警告确认框 */
|
|
54
|
+
warning(message: string, config?: MessageConfirmShortcutConfig): MessageConfirmInstance
|
|
55
|
+
/** 危险确认框 */
|
|
56
|
+
danger(message: string, config?: MessageConfirmShortcutConfig): MessageConfirmInstance
|
|
57
|
+
/** 关闭所有确认框 */
|
|
58
|
+
closeAll(): void
|
|
59
|
+
/** 设置全局渲染上下文 */
|
|
60
|
+
_context: AppContext | null
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** 消息确认框组件定义的事件 */
|
|
64
|
+
export interface MessageConfirmEmits {
|
|
65
|
+
(e: 'close', action: MessageConfirmAction): void
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** 消息确认框组件暴露的属性和方法(组件内部使用) */
|
|
69
|
+
export interface _MessageConfirmExposed {}
|
|
70
|
+
|
|
71
|
+
/** 消息确认框组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
72
|
+
export type MessageConfirmExposed = DeconstructValue<_MessageConfirmExposed>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { DeconstructValue } from '@veltra/utils'
|
|
2
|
+
import type { DefineComponent, AppContext } from 'vue'
|
|
3
|
+
|
|
4
|
+
/** 消息类型 */
|
|
5
|
+
export type MessageType = 'success' | 'warn' | 'info' | 'error' | 'default'
|
|
6
|
+
|
|
7
|
+
/** 消息选项 */
|
|
8
|
+
export type MessageOptions = MessageProps & {
|
|
9
|
+
/** 关闭回调 */
|
|
10
|
+
onClose?: () => void
|
|
11
|
+
/** 关闭结束后回调 */
|
|
12
|
+
onClosed?: () => void
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type MsgAliasConf = Omit<MessageOptions, 'type' | 'message'>
|
|
16
|
+
|
|
17
|
+
export interface MessageInstance {
|
|
18
|
+
/** 消息唯一标识 */
|
|
19
|
+
id: string
|
|
20
|
+
/** 手动关闭消息 */
|
|
21
|
+
close(): void
|
|
22
|
+
/** 消息彻底销毁后的 Promise (包括动画结束) */
|
|
23
|
+
onClosed: Promise<void>
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface Message {
|
|
27
|
+
/** 创建消息 */
|
|
28
|
+
(options: MessageOptions | string): MessageInstance
|
|
29
|
+
/** 关闭所有的消息 */
|
|
30
|
+
closeAll(): void
|
|
31
|
+
/** 成功消息 */
|
|
32
|
+
success(message: string, config?: MsgAliasConf): MessageInstance
|
|
33
|
+
/** 警告消息 */
|
|
34
|
+
warn(message: string, config?: MsgAliasConf): MessageInstance
|
|
35
|
+
/** 信息消息 */
|
|
36
|
+
info(message: string, config?: MsgAliasConf): MessageInstance
|
|
37
|
+
/** 错误消息 */
|
|
38
|
+
error(message: string, config?: MsgAliasConf): MessageInstance
|
|
39
|
+
/** 默认消息 */
|
|
40
|
+
default(message: string, config?: MsgAliasConf): MessageInstance
|
|
41
|
+
/** 设置全局渲染上下文 */
|
|
42
|
+
_context: AppContext | null
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** 消息弹框组件组件属性 */
|
|
46
|
+
export interface MessageProps {
|
|
47
|
+
/** 消息内容 */
|
|
48
|
+
message?: string
|
|
49
|
+
/** 渲染样式 */
|
|
50
|
+
type?: MessageType
|
|
51
|
+
/** 是否可以关闭 */
|
|
52
|
+
closable?: boolean
|
|
53
|
+
/**
|
|
54
|
+
* 持续时间, 单位ms
|
|
55
|
+
* @default 3000
|
|
56
|
+
*/
|
|
57
|
+
duration?: number
|
|
58
|
+
/** 渲染html */
|
|
59
|
+
html?: boolean
|
|
60
|
+
/** 图标 */
|
|
61
|
+
icon?: DefineComponent
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** 消息弹框组件组件定义的事件 */
|
|
65
|
+
export interface MessageEmits {}
|
|
66
|
+
|
|
67
|
+
/** 消息弹框组件组件暴露的属性和方法(组件内部使用) */
|
|
68
|
+
export interface _MessageExposed {}
|
|
69
|
+
|
|
70
|
+
/** 消息弹框组件组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
71
|
+
export type MessageExposed = DeconstructValue<_MessageExposed>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { FormComponentProps } from '@veltra/utils'
|
|
2
|
+
import type { CSSProperties } from 'vue'
|
|
3
|
+
|
|
4
|
+
/** multi-select 组件属性(移动端形态:面板走 BottomSheet) */
|
|
5
|
+
export interface MultiSelectProps extends FormComponentProps {
|
|
6
|
+
/** 绑定值 */
|
|
7
|
+
modelValue?: Array<any>
|
|
8
|
+
/** 列表选项 */
|
|
9
|
+
options?:
|
|
10
|
+
| Record<string, any>[]
|
|
11
|
+
| ((qs: string) => Promise<Record<string, any>[]> | Record<string, any>[])
|
|
12
|
+
/** 值字段 */
|
|
13
|
+
valueKey?: string
|
|
14
|
+
/** 标签字段 */
|
|
15
|
+
labelKey?: string
|
|
16
|
+
/** 是否可清除 */
|
|
17
|
+
clearable?: boolean
|
|
18
|
+
/** 占位符 */
|
|
19
|
+
placeholder?: string
|
|
20
|
+
/** 是否启用搜索功能 */
|
|
21
|
+
filterable?: boolean
|
|
22
|
+
/** 最大展示数量 */
|
|
23
|
+
visibilityLimit?: number
|
|
24
|
+
/** 最大可选数量 */
|
|
25
|
+
max?: number
|
|
26
|
+
/** 底部面板内容容器样式 */
|
|
27
|
+
contentStyle?: CSSProperties | string
|
|
28
|
+
/** 底部面板内容容器类名 */
|
|
29
|
+
contentClass?: unknown
|
|
30
|
+
/** 是否允许创建新选项 */
|
|
31
|
+
creatable?: boolean
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** multi-select 组件定义的事件 */
|
|
35
|
+
export interface MultiSelectEmits {
|
|
36
|
+
(e: 'update:modelValue', value: Array<any>): void
|
|
37
|
+
(e: 'change', options: Record<string, any>[]): void
|
|
38
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { InputProps } from './input'
|
|
2
|
+
|
|
3
|
+
/** 数字输入组件属性(API 与 @veltra/desktop UNumberInput 对齐;步进按钮外置右侧、44px 触控热区为移动端形态) */
|
|
4
|
+
export interface NumberInputProps extends Omit<InputProps, 'modelValue'> {
|
|
5
|
+
modelValue?: number
|
|
6
|
+
/** 是否为货币模式 */
|
|
7
|
+
currency?: boolean
|
|
8
|
+
/** 精度 */
|
|
9
|
+
precision?: number
|
|
10
|
+
/** 最小精度 */
|
|
11
|
+
minPrecision?: number
|
|
12
|
+
/** 最大精度 */
|
|
13
|
+
maxPrecision?: number
|
|
14
|
+
/** 步进, 指定为数字时开启累加按钮并将该值作为累加的步长, 为true则步长默认为1 */
|
|
15
|
+
step?: boolean | number
|
|
16
|
+
/** 最大值 */
|
|
17
|
+
max?: number
|
|
18
|
+
/** 最小值 */
|
|
19
|
+
min?: number
|
|
20
|
+
/** 倍数 */
|
|
21
|
+
multiple?: number
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** 数字输入组件定义的事件 */
|
|
25
|
+
export interface NumberInputEmits {
|
|
26
|
+
(event: 'update:modelValue', value?: number): void
|
|
27
|
+
(event: 'change', value?: number): void
|
|
28
|
+
(event: 'clear'): void
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** 数字输入组件暴露的属性和方法 */
|
|
32
|
+
export interface NumberInputExposed {}
|