@veltra/desktop 1.8.4 → 1.9.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/dist/components/alert/alert.js +69 -0
- package/dist/components/alert/alert.js.map +1 -0
- package/dist/components/alert/style.d.ts +1 -0
- package/dist/components/alert/style.js +1 -0
- package/dist/components/alert/style2.css +76 -0
- package/dist/components/anchor/anchor-item.js +35 -0
- package/dist/components/anchor/anchor-item.js.map +1 -0
- package/dist/components/anchor/anchor.js +61 -0
- package/dist/components/anchor/anchor.js.map +1 -0
- package/dist/components/anchor/di.js +6 -0
- package/dist/components/anchor/di.js.map +1 -0
- package/dist/components/anchor/style.d.ts +1 -0
- package/dist/components/anchor/style.js +1 -0
- package/dist/components/anchor/style2.css +45 -0
- package/dist/components/anchor/use-anchor.js +81 -0
- package/dist/components/anchor/use-anchor.js.map +1 -0
- package/dist/components/avatar/avatar-group.js +28 -0
- package/dist/components/avatar/avatar-group.js.map +1 -0
- package/dist/components/avatar/avatar.js +51 -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 +87 -0
- package/dist/components/back-top/back-top.js +82 -0
- package/dist/components/back-top/back-top.js.map +1 -0
- package/dist/components/back-top/style.d.ts +1 -0
- package/dist/components/back-top/style.js +2 -0
- package/dist/components/back-top/style2.css +32 -0
- package/dist/components/carousel/carousel-item.js +27 -0
- package/dist/components/carousel/carousel-item.js.map +1 -0
- package/dist/components/carousel/carousel.js +118 -0
- package/dist/components/carousel/carousel.js.map +1 -0
- package/dist/components/carousel/di.js +7 -0
- package/dist/components/carousel/di.js.map +1 -0
- package/dist/components/carousel/style.d.ts +1 -0
- package/dist/components/carousel/style.js +1 -0
- package/dist/components/carousel/style2.css +97 -0
- package/dist/components/carousel/use-carousel.js +68 -0
- package/dist/components/carousel/use-carousel.js.map +1 -0
- package/dist/components/descriptions/descriptions-item.js +16 -0
- package/dist/components/descriptions/descriptions-item.js.map +1 -0
- package/dist/components/descriptions/descriptions.js +67 -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 +81 -0
- package/dist/components/divider/divider.js +41 -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 +68 -0
- package/dist/components/expression-editor/components/variable-picker.js +1 -1
- package/dist/components/expression-editor/components/variable-picker.js.map +1 -1
- package/dist/components/file-viewer/previewers/pdf-previewer.js +3 -1
- package/dist/components/file-viewer/previewers/pdf-previewer.js.map +1 -1
- package/dist/components/image-cropper/image-cropper.js +1 -1
- package/dist/components/image-cropper/image-cropper.js.map +1 -1
- package/dist/components/index.d.ts +48 -30
- package/dist/components/index.js +95 -59
- package/dist/components/index.js.map +1 -1
- package/dist/components/rate/rate.js +130 -0
- package/dist/components/rate/rate.js.map +1 -0
- package/dist/components/rate/style.d.ts +1 -0
- package/dist/components/rate/style.js +1 -0
- package/dist/components/rate/style2.css +58 -0
- package/dist/components/skeleton/skeleton.js +74 -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 +86 -0
- package/dist/components/space/space.js +47 -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 +43 -0
- package/dist/components/time-picker/style.d.ts +2 -0
- package/dist/components/time-picker/style.js +3 -0
- package/dist/components/time-picker/style2.css +110 -0
- package/dist/components/time-picker/time-picker.js +196 -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 +95 -0
- package/dist/components/timeline/timeline-item.js +32 -0
- package/dist/components/timeline/timeline-item.js.map +1 -0
- package/dist/components/timeline/timeline.js +17 -0
- package/dist/components/timeline/timeline.js.map +1 -0
- package/dist/components/transfer/style.d.ts +2 -0
- package/dist/components/transfer/style.js +4 -0
- package/dist/components/transfer/style2.css +172 -0
- package/dist/components/transfer/transfer-list.js +101 -0
- package/dist/components/transfer/transfer-list.js.map +1 -0
- package/dist/components/transfer/transfer.js +138 -0
- package/dist/components/transfer/transfer.js.map +1 -0
- package/dist/index.d.ts +119 -88
- package/dist/index.js +106 -88
- package/dist/types/alert.d.ts +27 -0
- package/dist/types/anchor.d.ts +48 -0
- package/dist/types/avatar.d.ts +28 -0
- package/dist/types/back-top.d.ts +19 -0
- package/dist/types/carousel.d.ts +25 -0
- package/dist/types/descriptions.d.ts +22 -0
- package/dist/types/divider.d.ts +14 -0
- package/dist/types/index.d.ts +14 -1
- package/dist/types/layout.d.ts +2 -1
- package/dist/types/rate.d.ts +26 -0
- package/dist/types/skeleton.d.ts +24 -0
- package/dist/types/space.d.ts +20 -0
- package/dist/types/time-picker.d.ts +38 -0
- package/dist/types/timeline.d.ts +16 -0
- package/dist/types/transfer.d.ts +37 -0
- package/package.json +3 -1
- package/src/components/alert/alert.vue +62 -0
- package/src/components/alert/index.ts +1 -0
- package/src/components/alert/style.scss +67 -0
- package/src/components/alert/style.ts +1 -0
- package/src/components/anchor/anchor-item.vue +35 -0
- package/src/components/anchor/anchor.vue +63 -0
- package/src/components/anchor/di.ts +15 -0
- package/src/components/anchor/index.ts +2 -0
- package/src/components/anchor/style.scss +44 -0
- package/src/components/anchor/style.ts +1 -0
- package/src/components/anchor/use-anchor.ts +120 -0
- package/src/components/avatar/avatar-group.vue +26 -0
- package/src/components/avatar/avatar.vue +52 -0
- package/src/components/avatar/index.ts +2 -0
- package/src/components/avatar/style.scss +79 -0
- package/src/components/avatar/style.ts +1 -0
- package/src/components/back-top/back-top.vue +89 -0
- package/src/components/back-top/index.ts +1 -0
- package/src/components/back-top/style.scss +31 -0
- package/src/components/back-top/style.ts +2 -0
- package/src/components/carousel/carousel-item.vue +27 -0
- package/src/components/carousel/carousel.vue +93 -0
- package/src/components/carousel/di.ts +15 -0
- package/src/components/carousel/index.ts +2 -0
- package/src/components/carousel/style.scss +109 -0
- package/src/components/carousel/style.ts +1 -0
- package/src/components/carousel/use-carousel.ts +77 -0
- package/src/components/descriptions/descriptions-item.vue +12 -0
- package/src/components/descriptions/descriptions.vue +81 -0
- package/src/components/descriptions/index.ts +2 -0
- package/src/components/descriptions/style.scss +73 -0
- package/src/components/descriptions/style.ts +1 -0
- package/src/components/divider/divider.vue +29 -0
- package/src/components/divider/index.ts +1 -0
- package/src/components/divider/style.scss +90 -0
- package/src/components/divider/style.ts +1 -0
- package/src/components/expression-editor/components/variable-picker.vue +1 -1
- package/src/components/file-viewer/previewers/pdf-previewer.vue +6 -1
- package/src/components/image-cropper/image-cropper.vue +1 -1
- package/src/components/index.ts +26 -0
- package/src/components/rate/index.ts +1 -0
- package/src/components/rate/rate.vue +127 -0
- package/src/components/rate/style.scss +51 -0
- package/src/components/rate/style.ts +1 -0
- package/src/components/skeleton/index.ts +1 -0
- package/src/components/skeleton/skeleton.vue +37 -0
- package/src/components/skeleton/style.scss +94 -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/time-picker/index.ts +1 -0
- package/src/components/time-picker/style.scss +82 -0
- package/src/components/time-picker/style.ts +3 -0
- package/src/components/time-picker/time-picker.vue +183 -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 +17 -0
- package/src/components/transfer/index.ts +1 -0
- package/src/components/transfer/style.scss +135 -0
- package/src/components/transfer/style.ts +4 -0
- package/src/components/transfer/transfer-list.vue +120 -0
- package/src/components/transfer/transfer.vue +134 -0
- package/src/env.d.ts +5 -0
- package/src/types/alert.ts +29 -0
- package/src/types/anchor.ts +50 -0
- package/src/types/avatar.ts +31 -0
- package/src/types/back-top.ts +20 -0
- package/src/types/carousel.ts +29 -0
- package/src/types/descriptions.ts +22 -0
- package/src/types/divider.ts +14 -0
- package/src/types/index.ts +16 -0
- package/src/types/layout.ts +2 -1
- package/src/types/rate.ts +27 -0
- package/src/types/skeleton.ts +29 -0
- package/src/types/space.ts +22 -0
- package/src/types/time-picker.ts +40 -0
- package/src/types/timeline.ts +15 -0
- package/src/types/transfer.ts +45 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
@use 'pkg:@veltra/styles/mixins' as m;
|
|
2
|
+
@use 'pkg:@veltra/styles/functions' as fn;
|
|
3
|
+
|
|
4
|
+
$root-name: 'timeline';
|
|
5
|
+
|
|
6
|
+
// 首行行高系数:与根 line-height 保持一致,圆点、尾线、时间戳的对齐基准由它派生
|
|
7
|
+
$line-ratio: 1.6;
|
|
8
|
+
// 内容首行行盒高度:圆点垂直中心的对齐目标
|
|
9
|
+
$first-line: calc(#{fn.use-var(font-size-main, default)} * #{$line-ratio});
|
|
10
|
+
// 圆点直径(几何常量)
|
|
11
|
+
$node-size: 12px;
|
|
12
|
+
// 尾线宽度(几何常量)
|
|
13
|
+
$tail-width: 2px;
|
|
14
|
+
|
|
15
|
+
@include m.b($root-name) {
|
|
16
|
+
margin: 0;
|
|
17
|
+
padding: 0;
|
|
18
|
+
list-style: none;
|
|
19
|
+
font-size: fn.use-var(font-size-main, default);
|
|
20
|
+
line-height: $line-ratio;
|
|
21
|
+
color: fn.use-var(text-color, main);
|
|
22
|
+
|
|
23
|
+
@include m.e(item) {
|
|
24
|
+
position: relative;
|
|
25
|
+
padding-left: calc(#{$node-size} + fn.use-var(gap, default));
|
|
26
|
+
padding-bottom: fn.use-var(gap, large);
|
|
27
|
+
|
|
28
|
+
// 尾线:伪元素绘制,起点在圆点下方一个小间距,水平中心与圆点同心
|
|
29
|
+
&::before {
|
|
30
|
+
content: '';
|
|
31
|
+
position: absolute;
|
|
32
|
+
left: calc((#{$node-size} - #{$tail-width}) / 2);
|
|
33
|
+
top: calc((#{$first-line} + #{$node-size}) / 2 + fn.use-var(gap, small));
|
|
34
|
+
bottom: 0;
|
|
35
|
+
border-left: #{$tail-width} solid fn.use-var(border-color);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&:last-child {
|
|
39
|
+
padding-bottom: 0;
|
|
40
|
+
|
|
41
|
+
&::before {
|
|
42
|
+
display: none;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// 节点盒:高度等于首行行盒,盒内垂直居中即与首行文字中心对齐(纯 CSS,自定义 #dot 同样适用)
|
|
48
|
+
@include m.e(node) {
|
|
49
|
+
position: absolute;
|
|
50
|
+
left: 0;
|
|
51
|
+
top: 0;
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
width: $node-size;
|
|
56
|
+
height: $first-line;
|
|
57
|
+
|
|
58
|
+
// 默认圆点
|
|
59
|
+
&::before {
|
|
60
|
+
content: '';
|
|
61
|
+
width: $node-size;
|
|
62
|
+
height: $node-size;
|
|
63
|
+
border-radius: 50%;
|
|
64
|
+
background-color: fn.use-var(border-color);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 语义色圆点
|
|
68
|
+
@each $type in (primary, success, warning, danger) {
|
|
69
|
+
@include m.m(#{$type}) {
|
|
70
|
+
&::before {
|
|
71
|
+
background-color: fn.use-var(color, $type);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// 自定义节点(#dot 插槽):隐藏默认圆点,插槽内容在首行行盒内垂直居中
|
|
77
|
+
@include m.is(custom) {
|
|
78
|
+
width: auto;
|
|
79
|
+
|
|
80
|
+
&::before {
|
|
81
|
+
display: none;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@include m.e(wrapper) {
|
|
87
|
+
min-width: 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@include m.e(timestamp) {
|
|
91
|
+
margin-top: fn.use-var(gap, small);
|
|
92
|
+
color: fn.use-var(text-color, second);
|
|
93
|
+
font-size: fn.use-var(font-size, main, small);
|
|
94
|
+
// 行盒与内容首行等高,timestamp-placement 为 top 时与圆点共用对齐基准
|
|
95
|
+
line-height: $first-line;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// 时间戳在内容上方时改为下间距
|
|
99
|
+
@include m.em(timestamp, top) {
|
|
100
|
+
margin-top: 0;
|
|
101
|
+
margin-bottom: fn.use-var(gap, small);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@include m.e(content) {
|
|
105
|
+
word-break: break-word;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './style.scss'
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<li :class="cls.e('item')">
|
|
3
|
+
<div :class="nodeClass">
|
|
4
|
+
<slot name="dot" />
|
|
5
|
+
</div>
|
|
6
|
+
<div :class="cls.e('wrapper')">
|
|
7
|
+
<div v-if="timestamp" :class="timestampClass">{{ timestamp }}</div>
|
|
8
|
+
<div :class="cls.e('content')">
|
|
9
|
+
<slot />
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</li>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script lang="ts" setup>
|
|
16
|
+
import { bem } from '@veltra/utils'
|
|
17
|
+
import { computed, useSlots } from 'vue'
|
|
18
|
+
|
|
19
|
+
import type { TimelineItemProps } from '../../types'
|
|
20
|
+
|
|
21
|
+
defineOptions({ name: 'UTimelineItem' })
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
color = 'default',
|
|
25
|
+
timestamp,
|
|
26
|
+
timestampPlacement = 'bottom'
|
|
27
|
+
} = defineProps<TimelineItemProps>()
|
|
28
|
+
|
|
29
|
+
const cls = bem('timeline')
|
|
30
|
+
|
|
31
|
+
const slots = useSlots()
|
|
32
|
+
|
|
33
|
+
const nodeClass = computed(() => [
|
|
34
|
+
cls.e('node'),
|
|
35
|
+
cls.em('node', color),
|
|
36
|
+
bem.is('custom', !!slots.dot)
|
|
37
|
+
])
|
|
38
|
+
|
|
39
|
+
const timestampClass = computed(() => [
|
|
40
|
+
cls.e('timestamp'),
|
|
41
|
+
...(timestampPlacement === 'top' ? [cls.em('timestamp', 'top')] : [])
|
|
42
|
+
])
|
|
43
|
+
</script>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ul :class="cls.b">
|
|
3
|
+
<slot />
|
|
4
|
+
</ul>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
import { bem } from '@veltra/utils'
|
|
9
|
+
|
|
10
|
+
import type { TimelineProps } from '../../types'
|
|
11
|
+
|
|
12
|
+
defineOptions({ name: 'UTimeline' })
|
|
13
|
+
|
|
14
|
+
defineProps<TimelineProps>()
|
|
15
|
+
|
|
16
|
+
const cls = bem('timeline')
|
|
17
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as UTransfer } from './transfer.vue'
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
@use 'pkg:@veltra/styles/mixins' as m;
|
|
2
|
+
@use 'pkg:@veltra/styles/functions' as fn;
|
|
3
|
+
@use 'pkg:@veltra/styles/vars';
|
|
4
|
+
|
|
5
|
+
// 方便拼接
|
|
6
|
+
$root-name: transfer;
|
|
7
|
+
$list-name: $root-name + '-list';
|
|
8
|
+
|
|
9
|
+
// 列表正文固定高度;空态与列表共用同一高度防栏高跳动(body / empty 两处引用同源)
|
|
10
|
+
$body-height: 240px;
|
|
11
|
+
|
|
12
|
+
@include m.b($root-name) {
|
|
13
|
+
width: 100%;
|
|
14
|
+
@include m.flex($align: center);
|
|
15
|
+
|
|
16
|
+
@include m.e(buttons) {
|
|
17
|
+
flex-shrink: 0;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
gap: calc(fn.use-var(gap, default) / 2);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@include m.b($list-name) {
|
|
25
|
+
flex: 1;
|
|
26
|
+
min-width: 0;
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
background-color: fn.use-var(bg-color, top);
|
|
30
|
+
border: fn.use-var(border);
|
|
31
|
+
border-radius: fn.use-var(radius, default);
|
|
32
|
+
box-shadow: fn.use-var(shadow, emboss);
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
|
|
35
|
+
@include m.e(header) {
|
|
36
|
+
flex-shrink: 0;
|
|
37
|
+
@include m.flex;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@include m.e(title) {
|
|
41
|
+
@include m.ellipsis;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@include m.e(count) {
|
|
45
|
+
flex-shrink: 0;
|
|
46
|
+
margin-left: auto;
|
|
47
|
+
color: fn.use-var(text-color, second);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@include m.e(filter) {
|
|
51
|
+
flex-shrink: 0;
|
|
52
|
+
border-bottom: fn.use-var(border);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@include m.e(filter-input) {
|
|
56
|
+
width: 100%;
|
|
57
|
+
padding: 0;
|
|
58
|
+
margin: 0;
|
|
59
|
+
border: none;
|
|
60
|
+
outline: none;
|
|
61
|
+
background: transparent;
|
|
62
|
+
font: inherit;
|
|
63
|
+
color: fn.use-var(text-color, main);
|
|
64
|
+
cursor: text;
|
|
65
|
+
|
|
66
|
+
&::placeholder {
|
|
67
|
+
color: fn.use-var(text-color, placeholder);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&:disabled {
|
|
71
|
+
cursor: not-allowed;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@include m.e(body) {
|
|
76
|
+
flex: 1;
|
|
77
|
+
height: $body-height;
|
|
78
|
+
margin: 0;
|
|
79
|
+
padding: 0;
|
|
80
|
+
list-style: none;
|
|
81
|
+
overflow-y: auto;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@include m.e(item) {
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
user-select: none;
|
|
87
|
+
@include m.flex;
|
|
88
|
+
|
|
89
|
+
&:hover {
|
|
90
|
+
background-color: fn.use-var(bg-color, hover);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@include m.is(disabled) {
|
|
94
|
+
cursor: not-allowed;
|
|
95
|
+
color: fn.use-var(text-color, disabled);
|
|
96
|
+
|
|
97
|
+
&:hover {
|
|
98
|
+
background-color: transparent;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@include m.e(item-label) {
|
|
104
|
+
@include m.ellipsis;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@include m.e(empty) {
|
|
108
|
+
height: $body-height;
|
|
109
|
+
@include m.flex($justify: center);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@include m.size using ($size) {
|
|
113
|
+
@include m.bem($list-name, header) {
|
|
114
|
+
height: fn.use-var(form-component-height, $size);
|
|
115
|
+
padding: 0 fn.use-var(gap, $size);
|
|
116
|
+
border-bottom: fn.use-var(border);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@include m.bem($list-name, filter) {
|
|
120
|
+
height: fn.use-var(form-component-height, $size);
|
|
121
|
+
padding: 0 fn.use-var(gap, $size);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@include m.bem($list-name, count) {
|
|
125
|
+
font-size: fn.use-var(font-size-main, $size);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@include m.bem($list-name, item) {
|
|
129
|
+
height: fn.use-var(form-component-height, $size);
|
|
130
|
+
padding: 0 fn.use-var(gap, $size);
|
|
131
|
+
border-radius: fn.use-var(radius, $size);
|
|
132
|
+
font-size: fn.use-var(font-size-main, $size);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="[cls.b, cls.m(size)]">
|
|
3
|
+
<div :class="cls.e('header')">
|
|
4
|
+
<u-checkbox
|
|
5
|
+
:model-value="allChecked"
|
|
6
|
+
:indeterminate="indeterminate"
|
|
7
|
+
:disabled="disabled || !selectable.length"
|
|
8
|
+
@update:model-value="handleCheckAll"
|
|
9
|
+
/>
|
|
10
|
+
|
|
11
|
+
<span :class="cls.e('title')">{{ title }}</span>
|
|
12
|
+
|
|
13
|
+
<span :class="cls.e('count')">{{ checkedCount }}/{{ options.length }}</span>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div v-if="filterable" :class="cls.e('filter')">
|
|
17
|
+
<input
|
|
18
|
+
v-model="query"
|
|
19
|
+
:class="cls.e('filter-input')"
|
|
20
|
+
:placeholder="placeholder"
|
|
21
|
+
:disabled="disabled"
|
|
22
|
+
/>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<ul v-if="filtered.length" :class="cls.e('body')">
|
|
26
|
+
<li
|
|
27
|
+
v-for="option of filtered"
|
|
28
|
+
:key="option.key"
|
|
29
|
+
:class="[cls.e('item'), bem.is('disabled', disabled || option.disabled)]"
|
|
30
|
+
@click="handleItemClick(option)"
|
|
31
|
+
>
|
|
32
|
+
<u-checkbox
|
|
33
|
+
:model-value="checkedKeys.has(option.key)"
|
|
34
|
+
:disabled="disabled || option.disabled"
|
|
35
|
+
@update:model-value="emit('check', option.key, $event)"
|
|
36
|
+
@click.stop
|
|
37
|
+
/>
|
|
38
|
+
|
|
39
|
+
<span :class="cls.e('item-label')">{{ option.label }}</span>
|
|
40
|
+
</li>
|
|
41
|
+
</ul>
|
|
42
|
+
|
|
43
|
+
<div v-else :class="cls.e('empty')">
|
|
44
|
+
<u-empty />
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script lang="ts" setup>
|
|
50
|
+
import type { ComponentSize } from '@veltra/utils'
|
|
51
|
+
import { bem } from '@veltra/utils'
|
|
52
|
+
import { computed, ref } from 'vue'
|
|
53
|
+
|
|
54
|
+
import type { TransferOption } from '../../types'
|
|
55
|
+
import { UCheckbox } from '../checkbox'
|
|
56
|
+
import { UEmpty } from '../empty'
|
|
57
|
+
|
|
58
|
+
defineOptions({ name: 'UTransferList' })
|
|
59
|
+
|
|
60
|
+
const {
|
|
61
|
+
title = '',
|
|
62
|
+
options = [],
|
|
63
|
+
checkedKeys,
|
|
64
|
+
filterable = false,
|
|
65
|
+
placeholder = '',
|
|
66
|
+
disabled = false,
|
|
67
|
+
size = 'default'
|
|
68
|
+
} = defineProps<{
|
|
69
|
+
/** 栏标题 */
|
|
70
|
+
title?: string
|
|
71
|
+
/** 本栏选项 */
|
|
72
|
+
options?: TransferOption[]
|
|
73
|
+
/** 两栏共用的勾选 key 集合 */
|
|
74
|
+
checkedKeys: Set<string | number>
|
|
75
|
+
/** 是否显示搜索框 */
|
|
76
|
+
filterable?: boolean
|
|
77
|
+
/** 搜索框占位符 */
|
|
78
|
+
placeholder?: string
|
|
79
|
+
/** 是否禁用整栏 */
|
|
80
|
+
disabled?: boolean
|
|
81
|
+
/** 组件尺寸 */
|
|
82
|
+
size?: ComponentSize
|
|
83
|
+
}>()
|
|
84
|
+
|
|
85
|
+
const emit = defineEmits<{
|
|
86
|
+
(e: 'check', key: string | number, checked: boolean): void
|
|
87
|
+
(e: 'check-all', keys: Array<string | number>, checked: boolean): void
|
|
88
|
+
}>()
|
|
89
|
+
|
|
90
|
+
const cls = bem('transfer-list')
|
|
91
|
+
|
|
92
|
+
const query = ref('')
|
|
93
|
+
|
|
94
|
+
/** 搜索只作用于本栏,按 label 匹配 */
|
|
95
|
+
const filtered = computed(() => options.filter((o) => o.label.includes(query.value)))
|
|
96
|
+
const selectable = computed(() => filtered.value.filter((o) => !o.disabled))
|
|
97
|
+
|
|
98
|
+
const allChecked = computed(
|
|
99
|
+
() => selectable.value.length > 0 && selectable.value.every((o) => checkedKeys.has(o.key))
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
const indeterminate = computed(() => {
|
|
103
|
+
const count = selectable.value.filter((o) => checkedKeys.has(o.key)).length
|
|
104
|
+
return count > 0 && !allChecked.value
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
const checkedCount = computed(() => options.filter((o) => checkedKeys.has(o.key)).length)
|
|
108
|
+
|
|
109
|
+
function handleCheckAll(checked: boolean) {
|
|
110
|
+
const keys = checked
|
|
111
|
+
? selectable.value.map((o) => o.key)
|
|
112
|
+
: filtered.value.filter((o) => checkedKeys.has(o.key)).map((o) => o.key)
|
|
113
|
+
emit('check-all', keys, checked)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function handleItemClick(option: TransferOption) {
|
|
117
|
+
if (disabled || option.disabled) return
|
|
118
|
+
emit('check', option.key, !checkedKeys.has(option.key))
|
|
119
|
+
}
|
|
120
|
+
</script>
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="[cls.b, cls.m(size), bem.is('disabled', disabled || readonly)]">
|
|
3
|
+
<u-transfer-list
|
|
4
|
+
:title="titles[0]"
|
|
5
|
+
:options="sourceOptions"
|
|
6
|
+
:checked-keys="checkedSet"
|
|
7
|
+
:filterable="filterable"
|
|
8
|
+
:placeholder="filterPlaceholder[0]"
|
|
9
|
+
:disabled="disabled || readonly"
|
|
10
|
+
:size="size"
|
|
11
|
+
@check="handleCheck"
|
|
12
|
+
@check-all="handleCheckAll"
|
|
13
|
+
/>
|
|
14
|
+
|
|
15
|
+
<div :class="cls.e('buttons')">
|
|
16
|
+
<u-button
|
|
17
|
+
:icon="ArrowRight"
|
|
18
|
+
circle
|
|
19
|
+
:disabled="disabled || readonly || !checkedSourceKeys.length"
|
|
20
|
+
@click="moveTo('right')"
|
|
21
|
+
/>
|
|
22
|
+
|
|
23
|
+
<u-button
|
|
24
|
+
:icon="ArrowLeft"
|
|
25
|
+
circle
|
|
26
|
+
:disabled="disabled || readonly || !checkedTargetKeys.length"
|
|
27
|
+
@click="moveTo('left')"
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<u-transfer-list
|
|
32
|
+
:title="titles[1]"
|
|
33
|
+
:options="targetOptions"
|
|
34
|
+
:checked-keys="checkedSet"
|
|
35
|
+
:filterable="filterable"
|
|
36
|
+
:placeholder="filterPlaceholder[1]"
|
|
37
|
+
:disabled="disabled || readonly"
|
|
38
|
+
:size="size"
|
|
39
|
+
@check="handleCheck"
|
|
40
|
+
@check-all="handleCheckAll"
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script lang="ts" setup>
|
|
46
|
+
import { useFormFallbackProps } from '@veltra/compositions'
|
|
47
|
+
import { ArrowLeft, ArrowRight } from '@veltra/icons/normal'
|
|
48
|
+
import { bem, injectFormContext } from '@veltra/utils'
|
|
49
|
+
import { computed, shallowReactive, watch } from 'vue'
|
|
50
|
+
|
|
51
|
+
import type { TransferDirection, TransferEmits, TransferProps } from '../../types'
|
|
52
|
+
import { UButton } from '../button'
|
|
53
|
+
import UTransferList from './transfer-list.vue'
|
|
54
|
+
|
|
55
|
+
defineOptions({ name: 'UTransfer' })
|
|
56
|
+
|
|
57
|
+
const props = defineProps<TransferProps>()
|
|
58
|
+
|
|
59
|
+
const emit = defineEmits<TransferEmits>()
|
|
60
|
+
|
|
61
|
+
const cls = bem('transfer')
|
|
62
|
+
|
|
63
|
+
const { formProps } = injectFormContext()
|
|
64
|
+
|
|
65
|
+
const { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {
|
|
66
|
+
size: 'default',
|
|
67
|
+
disabled: false,
|
|
68
|
+
readonly: false
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
const model = defineModel<Array<string | number>>({ default: () => [] })
|
|
72
|
+
|
|
73
|
+
/** 数据源,两栏共用;未传时按空列表处理 */
|
|
74
|
+
const dataSource = computed(() => props.dataSource ?? [])
|
|
75
|
+
|
|
76
|
+
/** 栏标题,未传时用默认文案 */
|
|
77
|
+
const titles = computed<[string, string]>(() => props.titles ?? ['源列表', '目标列表'])
|
|
78
|
+
|
|
79
|
+
/** 搜索框占位符,未传时用默认文案 */
|
|
80
|
+
const filterPlaceholder = computed<[string, string]>(
|
|
81
|
+
() => props.filterPlaceholder ?? ['请输入搜索内容', '请输入搜索内容']
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
/** 两栏共用的勾选 key 集合,移动后清空 */
|
|
85
|
+
const checkedSet = shallowReactive<Set<string | number>>(new Set())
|
|
86
|
+
|
|
87
|
+
const targetKeySet = computed(() => new Set(model.value))
|
|
88
|
+
|
|
89
|
+
/** 两栏按 data-source 出现顺序各取一半 */
|
|
90
|
+
const sourceOptions = computed(() => dataSource.value.filter((o) => !targetKeySet.value.has(o.key)))
|
|
91
|
+
const targetOptions = computed(() => dataSource.value.filter((o) => targetKeySet.value.has(o.key)))
|
|
92
|
+
|
|
93
|
+
const checkedSourceKeys = computed(() =>
|
|
94
|
+
Array.from(checkedSet).filter((key) => !targetKeySet.value.has(key))
|
|
95
|
+
)
|
|
96
|
+
const checkedTargetKeys = computed(() =>
|
|
97
|
+
Array.from(checkedSet).filter((key) => targetKeySet.value.has(key))
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
/** 数据源或绑定值外部变化后,清掉已不在数据源里的残留勾选 */
|
|
101
|
+
watch([dataSource, model], () => {
|
|
102
|
+
const keys = new Set(dataSource.value.map((o) => o.key))
|
|
103
|
+
for (const key of checkedSet) {
|
|
104
|
+
if (!keys.has(key)) checkedSet.delete(key)
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
const handleCheck = (key: string | number, checked: boolean) => {
|
|
109
|
+
if (checked) {
|
|
110
|
+
checkedSet.add(key)
|
|
111
|
+
} else {
|
|
112
|
+
checkedSet.delete(key)
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const handleCheckAll = (keys: Array<string | number>, checked: boolean) => {
|
|
117
|
+
keys.forEach((key) => (checked ? checkedSet.add(key) : checkedSet.delete(key)))
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const moveTo = (direction: TransferDirection) => {
|
|
121
|
+
const movedKeys = direction === 'right' ? checkedSourceKeys.value : checkedTargetKeys.value
|
|
122
|
+
if (!movedKeys.length) return
|
|
123
|
+
|
|
124
|
+
const movedSet = new Set(movedKeys)
|
|
125
|
+
const targetKeys =
|
|
126
|
+
direction === 'right'
|
|
127
|
+
? [...model.value, ...movedKeys]
|
|
128
|
+
: model.value.filter((key) => !movedSet.has(key))
|
|
129
|
+
|
|
130
|
+
model.value = targetKeys
|
|
131
|
+
checkedSet.clear()
|
|
132
|
+
emit('change', targetKeys, direction, movedKeys)
|
|
133
|
+
}
|
|
134
|
+
</script>
|
package/src/env.d.ts
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { DeconstructValue } from '@veltra/utils'
|
|
2
|
+
|
|
3
|
+
/** 行内提示条语义类型 */
|
|
4
|
+
export type AlertType = 'info' | 'success' | 'warning' | 'error'
|
|
5
|
+
|
|
6
|
+
/** 行内提示条组件属性 */
|
|
7
|
+
export interface AlertProps {
|
|
8
|
+
/** 语义类型,默认 'info' */
|
|
9
|
+
type?: AlertType
|
|
10
|
+
/** 标题 */
|
|
11
|
+
title?: string
|
|
12
|
+
/** 描述文案,默认插槽可替代 */
|
|
13
|
+
description?: string
|
|
14
|
+
/** 是否显示语义图标 */
|
|
15
|
+
showIcon?: boolean
|
|
16
|
+
/** 是否显示关闭图标 */
|
|
17
|
+
closable?: boolean
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** 行内提示条组件定义的事件 */
|
|
21
|
+
export interface AlertEmits {
|
|
22
|
+
(e: 'close'): void
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** 行内提示条组件暴露的属性和方法(组件内部使用) */
|
|
26
|
+
export interface _AlertExposed {}
|
|
27
|
+
|
|
28
|
+
/** 行内提示条组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
29
|
+
export type AlertExposed = DeconstructValue<_AlertExposed>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { DeconstructValue } from '@veltra/utils'
|
|
2
|
+
|
|
3
|
+
/** 锚点导航组件属性 */
|
|
4
|
+
export interface AnchorProps {
|
|
5
|
+
/**
|
|
6
|
+
* 滚动容器
|
|
7
|
+
* @description
|
|
8
|
+
* CSS 选择器或容器元素(含模板引用初始的 null);缺省时监听 window 滚动
|
|
9
|
+
*/
|
|
10
|
+
container?: string | HTMLElement | null
|
|
11
|
+
/**
|
|
12
|
+
* 定位偏移
|
|
13
|
+
* @description
|
|
14
|
+
* 点击定位与高亮判定统一使用:滚动停止时锚点距容器视口顶部的距离
|
|
15
|
+
* @default 0
|
|
16
|
+
*/
|
|
17
|
+
offset?: number
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** 锚点导航组件定义的事件 */
|
|
21
|
+
export interface AnchorEmits {
|
|
22
|
+
/**
|
|
23
|
+
* 高亮锚点变化
|
|
24
|
+
*/
|
|
25
|
+
(e: 'change', current: string): void
|
|
26
|
+
/**
|
|
27
|
+
* 锚点项点击(点击后平滑滚动到目标锚点)
|
|
28
|
+
*/
|
|
29
|
+
(e: 'click-item', href: string, event: MouseEvent): void
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** 锚点导航项组件属性 */
|
|
33
|
+
export interface AnchorItemProps {
|
|
34
|
+
/**
|
|
35
|
+
* 目标锚点
|
|
36
|
+
* @description
|
|
37
|
+
* `#id` 形式的选择器,需与页内锚点元素对应
|
|
38
|
+
*/
|
|
39
|
+
href: string
|
|
40
|
+
/**
|
|
41
|
+
* 导航文案
|
|
42
|
+
*/
|
|
43
|
+
title?: string
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** 锚点导航组件暴露的属性和方法(组件内部使用) */
|
|
47
|
+
export interface _AnchorExposed {}
|
|
48
|
+
|
|
49
|
+
/** 锚点导航组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
50
|
+
export type AnchorExposed = DeconstructValue<_AnchorExposed>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ComponentProps, DeconstructValue } from '@veltra/utils'
|
|
2
|
+
|
|
3
|
+
/** 头像形状:circle 圆形 / round 圆角方形 */
|
|
4
|
+
export type AvatarShape = 'circle' | 'round'
|
|
5
|
+
|
|
6
|
+
/** 头像组件属性 */
|
|
7
|
+
export interface AvatarProps extends ComponentProps {
|
|
8
|
+
/** 图片地址;未传或加载失败时回退展示默认插槽内容 */
|
|
9
|
+
src?: string
|
|
10
|
+
/** 图片描述,作为 img 的 alt */
|
|
11
|
+
alt?: string
|
|
12
|
+
/** 形状,默认 circle */
|
|
13
|
+
shape?: AvatarShape
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** 头像组件定义的事件 */
|
|
17
|
+
export interface AvatarEmits {
|
|
18
|
+
(e: 'error', ev: Event): void
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** 头像组组件属性 */
|
|
22
|
+
export interface AvatarGroupProps {
|
|
23
|
+
/** 最多展示的头像个数,超出部分以 +N 形式收起 */
|
|
24
|
+
max?: number
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** 头像组件暴露的属性和方法(组件内部使用) */
|
|
28
|
+
export interface _AvatarExposed {}
|
|
29
|
+
|
|
30
|
+
/** 头像组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
31
|
+
export type AvatarExposed = DeconstructValue<_AvatarExposed>
|