@veltra/desktop 1.8.5 → 1.9.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.
Files changed (195) hide show
  1. package/dist/components/alert/alert.js +69 -0
  2. package/dist/components/alert/alert.js.map +1 -0
  3. package/dist/components/alert/style.d.ts +1 -0
  4. package/dist/components/alert/style.js +1 -0
  5. package/dist/components/alert/style2.css +76 -0
  6. package/dist/components/anchor/anchor-item.js +35 -0
  7. package/dist/components/anchor/anchor-item.js.map +1 -0
  8. package/dist/components/anchor/anchor.js +61 -0
  9. package/dist/components/anchor/anchor.js.map +1 -0
  10. package/dist/components/anchor/di.js +6 -0
  11. package/dist/components/anchor/di.js.map +1 -0
  12. package/dist/components/anchor/style.d.ts +1 -0
  13. package/dist/components/anchor/style.js +1 -0
  14. package/dist/components/anchor/style2.css +45 -0
  15. package/dist/components/anchor/use-anchor.js +81 -0
  16. package/dist/components/anchor/use-anchor.js.map +1 -0
  17. package/dist/components/avatar/avatar-group.js +28 -0
  18. package/dist/components/avatar/avatar-group.js.map +1 -0
  19. package/dist/components/avatar/avatar.js +51 -0
  20. package/dist/components/avatar/avatar.js.map +1 -0
  21. package/dist/components/avatar/style.d.ts +1 -0
  22. package/dist/components/avatar/style.js +1 -0
  23. package/dist/components/avatar/style2.css +87 -0
  24. package/dist/components/back-top/back-top.js +82 -0
  25. package/dist/components/back-top/back-top.js.map +1 -0
  26. package/dist/components/back-top/style.d.ts +1 -0
  27. package/dist/components/back-top/style.js +2 -0
  28. package/dist/components/back-top/style2.css +32 -0
  29. package/dist/components/carousel/carousel-item.js +27 -0
  30. package/dist/components/carousel/carousel-item.js.map +1 -0
  31. package/dist/components/carousel/carousel.js +118 -0
  32. package/dist/components/carousel/carousel.js.map +1 -0
  33. package/dist/components/carousel/di.js +7 -0
  34. package/dist/components/carousel/di.js.map +1 -0
  35. package/dist/components/carousel/style.d.ts +1 -0
  36. package/dist/components/carousel/style.js +1 -0
  37. package/dist/components/carousel/style2.css +97 -0
  38. package/dist/components/carousel/use-carousel.js +68 -0
  39. package/dist/components/carousel/use-carousel.js.map +1 -0
  40. package/dist/components/descriptions/descriptions-item.js +16 -0
  41. package/dist/components/descriptions/descriptions-item.js.map +1 -0
  42. package/dist/components/descriptions/descriptions.js +67 -0
  43. package/dist/components/descriptions/descriptions.js.map +1 -0
  44. package/dist/components/descriptions/style.d.ts +1 -0
  45. package/dist/components/descriptions/style.js +1 -0
  46. package/dist/components/descriptions/style2.css +81 -0
  47. package/dist/components/divider/divider.js +41 -0
  48. package/dist/components/divider/divider.js.map +1 -0
  49. package/dist/components/divider/style.d.ts +1 -0
  50. package/dist/components/divider/style.js +1 -0
  51. package/dist/components/divider/style2.css +68 -0
  52. package/dist/components/expression-editor/components/variable-picker.js +1 -1
  53. package/dist/components/expression-editor/components/variable-picker.js.map +1 -1
  54. package/dist/components/image-cropper/image-cropper.js +1 -1
  55. package/dist/components/image-cropper/image-cropper.js.map +1 -1
  56. package/dist/components/index.d.ts +48 -30
  57. package/dist/components/index.js +95 -59
  58. package/dist/components/index.js.map +1 -1
  59. package/dist/components/input/input.js.map +1 -1
  60. package/dist/components/input/input.vue_vue_type_script_setup_true_lang.js +2 -1
  61. package/dist/components/input/input.vue_vue_type_script_setup_true_lang.js.map +1 -1
  62. package/dist/components/rate/rate.js +130 -0
  63. package/dist/components/rate/rate.js.map +1 -0
  64. package/dist/components/rate/style.d.ts +1 -0
  65. package/dist/components/rate/style.js +1 -0
  66. package/dist/components/rate/style2.css +58 -0
  67. package/dist/components/skeleton/skeleton.js +74 -0
  68. package/dist/components/skeleton/skeleton.js.map +1 -0
  69. package/dist/components/skeleton/style.d.ts +1 -0
  70. package/dist/components/skeleton/style.js +1 -0
  71. package/dist/components/skeleton/style2.css +86 -0
  72. package/dist/components/space/space.js +47 -0
  73. package/dist/components/space/space.js.map +1 -0
  74. package/dist/components/space/style.d.ts +1 -0
  75. package/dist/components/space/style.js +1 -0
  76. package/dist/components/space/style2.css +43 -0
  77. package/dist/components/time-picker/style.d.ts +2 -0
  78. package/dist/components/time-picker/style.js +3 -0
  79. package/dist/components/time-picker/style2.css +110 -0
  80. package/dist/components/time-picker/time-picker.js +196 -0
  81. package/dist/components/time-picker/time-picker.js.map +1 -0
  82. package/dist/components/timeline/style.d.ts +1 -0
  83. package/dist/components/timeline/style.js +1 -0
  84. package/dist/components/timeline/style2.css +95 -0
  85. package/dist/components/timeline/timeline-item.js +32 -0
  86. package/dist/components/timeline/timeline-item.js.map +1 -0
  87. package/dist/components/timeline/timeline.js +17 -0
  88. package/dist/components/timeline/timeline.js.map +1 -0
  89. package/dist/components/transfer/style.d.ts +2 -0
  90. package/dist/components/transfer/style.js +4 -0
  91. package/dist/components/transfer/style2.css +172 -0
  92. package/dist/components/transfer/transfer-list.js +101 -0
  93. package/dist/components/transfer/transfer-list.js.map +1 -0
  94. package/dist/components/transfer/transfer.js +138 -0
  95. package/dist/components/transfer/transfer.js.map +1 -0
  96. package/dist/index.d.ts +119 -88
  97. package/dist/index.js +106 -88
  98. package/dist/types/alert.d.ts +27 -0
  99. package/dist/types/anchor.d.ts +48 -0
  100. package/dist/types/avatar.d.ts +28 -0
  101. package/dist/types/back-top.d.ts +19 -0
  102. package/dist/types/carousel.d.ts +25 -0
  103. package/dist/types/descriptions.d.ts +22 -0
  104. package/dist/types/divider.d.ts +14 -0
  105. package/dist/types/index.d.ts +14 -1
  106. package/dist/types/layout.d.ts +2 -1
  107. package/dist/types/rate.d.ts +26 -0
  108. package/dist/types/skeleton.d.ts +24 -0
  109. package/dist/types/space.d.ts +20 -0
  110. package/dist/types/time-picker.d.ts +38 -0
  111. package/dist/types/timeline.d.ts +16 -0
  112. package/dist/types/transfer.d.ts +37 -0
  113. package/package.json +2 -1
  114. package/src/components/alert/alert.vue +62 -0
  115. package/src/components/alert/index.ts +1 -0
  116. package/src/components/alert/style.scss +67 -0
  117. package/src/components/alert/style.ts +1 -0
  118. package/src/components/anchor/anchor-item.vue +35 -0
  119. package/src/components/anchor/anchor.vue +63 -0
  120. package/src/components/anchor/di.ts +15 -0
  121. package/src/components/anchor/index.ts +2 -0
  122. package/src/components/anchor/style.scss +44 -0
  123. package/src/components/anchor/style.ts +1 -0
  124. package/src/components/anchor/use-anchor.ts +120 -0
  125. package/src/components/avatar/avatar-group.vue +26 -0
  126. package/src/components/avatar/avatar.vue +52 -0
  127. package/src/components/avatar/index.ts +2 -0
  128. package/src/components/avatar/style.scss +79 -0
  129. package/src/components/avatar/style.ts +1 -0
  130. package/src/components/back-top/back-top.vue +89 -0
  131. package/src/components/back-top/index.ts +1 -0
  132. package/src/components/back-top/style.scss +31 -0
  133. package/src/components/back-top/style.ts +2 -0
  134. package/src/components/carousel/carousel-item.vue +27 -0
  135. package/src/components/carousel/carousel.vue +93 -0
  136. package/src/components/carousel/di.ts +15 -0
  137. package/src/components/carousel/index.ts +2 -0
  138. package/src/components/carousel/style.scss +109 -0
  139. package/src/components/carousel/style.ts +1 -0
  140. package/src/components/carousel/use-carousel.ts +77 -0
  141. package/src/components/descriptions/descriptions-item.vue +12 -0
  142. package/src/components/descriptions/descriptions.vue +81 -0
  143. package/src/components/descriptions/index.ts +2 -0
  144. package/src/components/descriptions/style.scss +73 -0
  145. package/src/components/descriptions/style.ts +1 -0
  146. package/src/components/divider/divider.vue +29 -0
  147. package/src/components/divider/index.ts +1 -0
  148. package/src/components/divider/style.scss +90 -0
  149. package/src/components/divider/style.ts +1 -0
  150. package/src/components/expression-editor/components/variable-picker.vue +1 -1
  151. package/src/components/image-cropper/image-cropper.vue +1 -1
  152. package/src/components/index.ts +26 -0
  153. package/src/components/input/__test__/input.test.ts +106 -0
  154. package/src/components/input/input.vue +4 -1
  155. package/src/components/rate/index.ts +1 -0
  156. package/src/components/rate/rate.vue +127 -0
  157. package/src/components/rate/style.scss +51 -0
  158. package/src/components/rate/style.ts +1 -0
  159. package/src/components/skeleton/index.ts +1 -0
  160. package/src/components/skeleton/skeleton.vue +37 -0
  161. package/src/components/skeleton/style.scss +94 -0
  162. package/src/components/skeleton/style.ts +1 -0
  163. package/src/components/space/index.ts +1 -0
  164. package/src/components/space/space.vue +45 -0
  165. package/src/components/space/style.scss +41 -0
  166. package/src/components/space/style.ts +1 -0
  167. package/src/components/time-picker/index.ts +1 -0
  168. package/src/components/time-picker/style.scss +82 -0
  169. package/src/components/time-picker/style.ts +3 -0
  170. package/src/components/time-picker/time-picker.vue +183 -0
  171. package/src/components/timeline/index.ts +2 -0
  172. package/src/components/timeline/style.scss +107 -0
  173. package/src/components/timeline/style.ts +1 -0
  174. package/src/components/timeline/timeline-item.vue +43 -0
  175. package/src/components/timeline/timeline.vue +17 -0
  176. package/src/components/transfer/index.ts +1 -0
  177. package/src/components/transfer/style.scss +135 -0
  178. package/src/components/transfer/style.ts +4 -0
  179. package/src/components/transfer/transfer-list.vue +120 -0
  180. package/src/components/transfer/transfer.vue +134 -0
  181. package/src/types/alert.ts +29 -0
  182. package/src/types/anchor.ts +50 -0
  183. package/src/types/avatar.ts +31 -0
  184. package/src/types/back-top.ts +20 -0
  185. package/src/types/carousel.ts +29 -0
  186. package/src/types/descriptions.ts +22 -0
  187. package/src/types/divider.ts +14 -0
  188. package/src/types/index.ts +16 -0
  189. package/src/types/layout.ts +2 -1
  190. package/src/types/rate.ts +27 -0
  191. package/src/types/skeleton.ts +29 -0
  192. package/src/types/space.ts +22 -0
  193. package/src/types/time-picker.ts +40 -0
  194. package/src/types/timeline.ts +15 -0
  195. package/src/types/transfer.ts +45 -0
@@ -0,0 +1,109 @@
1
+ @use 'pkg:@veltra/styles/mixins' as m;
2
+ @use 'pkg:@veltra/styles/functions' as fn;
3
+
4
+ $root-name: carousel;
5
+
6
+ @include m.b($root-name) {
7
+ position: relative;
8
+ width: 100%;
9
+ overflow: hidden;
10
+ border-radius: fn.use-var(radius, default);
11
+ background-color: fn.use-var(bg-color, middle);
12
+
13
+ // 轨道:单层 flex 横排,经 translateX 整体滑动翻页;时长与缓动走 token
14
+ // (transform 过渡期间浏览器会自动提升合成层,不常驻 will-change 以免长期占用层内存)
15
+ @include m.e(track) {
16
+ display: flex;
17
+ transition: transform fn.use-var(transition, slow) fn.use-var(transition, ease-out);
18
+ }
19
+
20
+ @include m.e(item) {
21
+ flex: 0 0 100%;
22
+ width: 100%;
23
+ }
24
+
25
+ // 切换箭头:浮在内容上的半透明圆钮
26
+ @include m.e(arrow) {
27
+ position: absolute;
28
+ top: 50%;
29
+ z-index: 1;
30
+ display: inline-flex;
31
+ align-items: center;
32
+ justify-content: center;
33
+ // 圆钮直径 32px,保证可点击热区又不遮内容
34
+ width: 32px;
35
+ height: 32px;
36
+ padding: 0;
37
+ border: none;
38
+ border-radius: 50%;
39
+ transform: translateY(-50%);
40
+ cursor: pointer;
41
+ color: fn.use-var(text-color, white);
42
+ background-color: fn.color-a(bg-color, 70, black);
43
+ transition:
44
+ transform fn.use-var(transition, fast) fn.use-var(transition, ease),
45
+ opacity fn.use-var(transition, fast) fn.use-var(transition, ease);
46
+
47
+ &:hover:not(:disabled) {
48
+ transform: translateY(-50%) scale(1.08);
49
+ }
50
+
51
+ &:focus-visible {
52
+ box-shadow: fn.use-var(focus-ring);
53
+ }
54
+
55
+ &:disabled {
56
+ cursor: not-allowed;
57
+ opacity: 0.55;
58
+ }
59
+
60
+ @include m.m(prev) {
61
+ left: fn.use-var(gap, default);
62
+ }
63
+
64
+ @include m.m(next) {
65
+ right: fn.use-var(gap, default);
66
+ }
67
+ }
68
+
69
+ // 指示器圆点:激活项拉长为胶囊
70
+ @include m.e(dots) {
71
+ position: absolute;
72
+ bottom: fn.use-var(gap, small);
73
+ left: 0;
74
+ right: 0;
75
+ z-index: 1;
76
+ display: flex;
77
+ align-items: center;
78
+ justify-content: center;
79
+ gap: fn.use-var(gap, small);
80
+ }
81
+
82
+ @include m.e(dot) {
83
+ // 圆点直径 8px,激活时拉长为 20px 胶囊
84
+ width: 8px;
85
+ height: 8px;
86
+ padding: 0;
87
+ border: none;
88
+ border-radius: fn.use-var(radius, default);
89
+ cursor: pointer;
90
+ background-color: fn.color-a(text-color, 40, white);
91
+ transition:
92
+ width fn.use-var(transition, fast) fn.use-var(transition, ease),
93
+ background-color fn.use-var(transition, fast) fn.use-var(transition, ease);
94
+
95
+ &:hover {
96
+ background-color: fn.color-a(text-color, 70, white);
97
+ }
98
+
99
+ &:focus-visible {
100
+ box-shadow: fn.use-var(focus-ring);
101
+ }
102
+
103
+ @include m.is(active) {
104
+ // 激活胶囊宽度,与 8px 圆点同高保持轴心不跳
105
+ width: 20px;
106
+ background-color: fn.use-var(text-color, white);
107
+ }
108
+ }
109
+ }
@@ -0,0 +1 @@
1
+ import './style.scss'
@@ -0,0 +1,77 @@
1
+ import type { MaybeRefOrGetter, ModelRef } from 'vue'
2
+ import { computed, onScopeDispose, toValue, watch } from 'vue'
3
+
4
+ export interface UseCarouselOptions {
5
+ /** 当前页索引,v-model:active-index */
6
+ model: ModelRef<number>
7
+ /** 页数,取已注册页数量 */
8
+ count: MaybeRefOrGetter<number>
9
+ /** 是否自动播放 */
10
+ autoplay: MaybeRefOrGetter<boolean>
11
+ /** 自动播放间隔(毫秒) */
12
+ interval: MaybeRefOrGetter<number>
13
+ /** 是否循环切换 */
14
+ loop: MaybeRefOrGetter<boolean>
15
+ }
16
+
17
+ /**
18
+ * 走马灯索引与自动播放计时:
19
+ * - `goTo` 把目标索引收敛到 `[0, 页数)`,越界按取模回绕
20
+ * - `prev` / `next` 单步切换,循环时回绕,非循环时停在边界
21
+ * - 自动播放开关、间隔、页数、当前页任一变化后重置计时,手动切换同样重新计时
22
+ */
23
+ export function useCarousel({ model, count, autoplay, interval, loop }: UseCarouselOptions) {
24
+ const pageCount = () => Math.max(toValue(count), 0)
25
+
26
+ /** 展示索引:外部传入越界值时收敛到页数范围内,避免轨道滑出空白 */
27
+ const current = computed(() => {
28
+ const total = pageCount()
29
+ if (total <= 0) return 0
30
+ return Math.min(Math.max(model.value, 0), total - 1)
31
+ })
32
+
33
+ const goTo = (index: number) => {
34
+ const total = pageCount()
35
+ if (total <= 0) return
36
+ const next = ((index % total) + total) % total
37
+ if (next !== model.value) model.value = next
38
+ }
39
+
40
+ const step = (direction: 1 | -1) => {
41
+ const total = pageCount()
42
+ if (total <= 1) return
43
+ const target = current.value + direction
44
+ if (toValue(loop)) {
45
+ goTo(target)
46
+ return
47
+ }
48
+ if (target >= 0 && target < total) goTo(target)
49
+ }
50
+
51
+ const canPrev = computed(() => toValue(loop) || current.value > 0)
52
+ const canNext = computed(() => toValue(loop) || current.value < pageCount() - 1)
53
+
54
+ const prev = () => step(-1)
55
+ const next = () => step(1)
56
+
57
+ let timer: ReturnType<typeof setInterval> | undefined
58
+
59
+ const stopAutoplay = () => {
60
+ if (timer !== undefined) {
61
+ clearInterval(timer)
62
+ timer = undefined
63
+ }
64
+ }
65
+
66
+ const startAutoplay = () => {
67
+ stopAutoplay()
68
+ if (!toValue(autoplay) || pageCount() < 2) return
69
+ timer = setInterval(() => step(1), toValue(interval))
70
+ }
71
+
72
+ watch([autoplay, count, interval, current], startAutoplay)
73
+
74
+ onScopeDispose(stopAutoplay)
75
+
76
+ return { current, canPrev, canNext, goTo, prev, next }
77
+ }
@@ -0,0 +1,12 @@
1
+ <template>
2
+ <!-- 本组件不自行布局:由 UDescriptions 收集插槽 vnode 后渲染进键值表格 -->
3
+ <slot />
4
+ </template>
5
+
6
+ <script lang="ts" setup>
7
+ import type { DescriptionsItemProps } from '../../types'
8
+
9
+ defineOptions({ name: 'UDescriptionsItem' })
10
+
11
+ defineProps<DescriptionsItemProps>()
12
+ </script>
@@ -0,0 +1,81 @@
1
+ <template>
2
+ <div :class="classList">
3
+ <div v-if="title" :class="cls.e('header')">{{ title }}</div>
4
+
5
+ <table v-if="rows.length" :class="cls.e('table')">
6
+ <tbody>
7
+ <template v-for="(row, rowIndex) of rows" :key="rowIndex">
8
+ <template v-if="isVertical">
9
+ <tr>
10
+ <th v-for="(item, i) of row" :key="i" :class="cls.e('label')">
11
+ {{ item.label }}
12
+ </th>
13
+ </tr>
14
+ <tr>
15
+ <td v-for="(item, i) of row" :key="i" :class="cls.e('content')">
16
+ <component :is="item.vnode" />
17
+ </td>
18
+ </tr>
19
+ </template>
20
+ <tr v-else>
21
+ <template v-for="(item, i) of row" :key="i">
22
+ <th :class="cls.e('label')">{{ item.label }}</th>
23
+ <td :class="cls.e('content')">
24
+ <component :is="item.vnode" />
25
+ </td>
26
+ </template>
27
+ </tr>
28
+ </template>
29
+ </tbody>
30
+ </table>
31
+ </div>
32
+ </template>
33
+
34
+ <script lang="ts" setup>
35
+ import { useFallbackProps } from '@veltra/compositions'
36
+ import { bem } from '@veltra/utils'
37
+ import { computed, useSlots, type VNode } from 'vue'
38
+
39
+ import type { ComponentSize, DescriptionsProps } from '../../types'
40
+ import UDescriptionsItem from './descriptions-item.vue'
41
+
42
+ defineOptions({ name: 'UDescriptions' })
43
+
44
+ const props = defineProps<DescriptionsProps>()
45
+
46
+ const { size } = useFallbackProps([props], { size: 'default' as ComponentSize })
47
+
48
+ const cls = bem('descriptions')
49
+
50
+ const slots = useSlots()
51
+
52
+ interface DescriptionItem {
53
+ label: string | undefined
54
+ vnode: VNode
55
+ }
56
+
57
+ // 插槽 vnode 须在渲染路径读取:插槽内容读取的响应式数据经调用链追踪,内容变化时重新计算
58
+ const rows = computed<DescriptionItem[][]>(() => {
59
+ const items = (slots.default?.() ?? []).filter((vnode) => vnode.type === UDescriptionsItem)
60
+ const column = Math.max(1, Math.trunc(props.column ?? 3))
61
+
62
+ const grouped: DescriptionItem[][] = []
63
+ for (let i = 0; i < items.length; i += column) {
64
+ grouped.push(
65
+ items
66
+ .slice(i, i + column)
67
+ .map((vnode) => ({ label: vnode.props?.label as string | undefined, vnode }))
68
+ )
69
+ }
70
+ return grouped
71
+ })
72
+
73
+ const isVertical = computed(() => props.layout === 'vertical')
74
+
75
+ const classList = computed(() => [
76
+ cls.b,
77
+ cls.m(props.layout ?? 'horizontal'),
78
+ cls.m(size.value),
79
+ bem.is('bordered', !!props.border)
80
+ ])
81
+ </script>
@@ -0,0 +1,2 @@
1
+ export { default as UDescriptions } from './descriptions.vue'
2
+ export { default as UDescriptionsItem } from './descriptions-item.vue'
@@ -0,0 +1,73 @@
1
+ @use 'pkg:@veltra/styles/mixins' as m;
2
+ @use 'pkg:@veltra/styles/functions' as fn;
3
+
4
+ $root-name: descriptions;
5
+
6
+ @include m.b($root-name) {
7
+ font-size: fn.use-var(font-size-main, default);
8
+ line-height: 1.6;
9
+ color: fn.use-var(text-color, main);
10
+
11
+ @include m.e(header) {
12
+ margin-bottom: fn.use-var(gap, default);
13
+ font-weight: 600;
14
+ color: fn.use-var(text-color, main);
15
+ }
16
+
17
+ @include m.e(table) {
18
+ width: 100%;
19
+ table-layout: fixed;
20
+ border-collapse: separate;
21
+ }
22
+
23
+ @include m.e(label) {
24
+ padding: fn.use-var(gap, small) fn.use-var(gap, default);
25
+ text-align: start;
26
+ font-weight: 500;
27
+ color: fn.use-var(text-color, second);
28
+ }
29
+
30
+ @include m.e(content) {
31
+ padding: fn.use-var(gap, small) fn.use-var(gap, default);
32
+ word-break: break-word;
33
+ color: fn.use-var(text-color, main);
34
+ }
35
+
36
+ // 尺寸档位:字号随根尺寸类切换,单元格垂直内边距随档位收紧/放宽
37
+ @include m.size using ($size) {
38
+ font-size: fn.use-var(font-size, main, $size);
39
+
40
+ #{fn.bem($root-name, label)},
41
+ #{fn.bem($root-name, content)} {
42
+ padding: fn.use-var(gap, $size) fn.use-var(gap, default);
43
+ }
44
+ }
45
+
46
+ // 垂直布局:键名行与内容行上下紧贴
47
+ @include m.m(vertical) {
48
+ #{fn.bem($root-name, label)} {
49
+ padding-bottom: 0;
50
+ }
51
+
52
+ #{fn.bem($root-name, content)} {
53
+ padding-top: fn.use-var(gap, small);
54
+ }
55
+ }
56
+
57
+ // 边框模式:单元格描边 + 键名底色,外层表格描边合成完整网格
58
+ @include m.is(bordered) {
59
+ #{fn.bem($root-name, table)} {
60
+ border-collapse: collapse;
61
+ border: fn.use-var(border-muted);
62
+ }
63
+
64
+ #{fn.bem($root-name, label)} {
65
+ background-color: fn.use-var(bg-color, middle);
66
+ border: fn.use-var(border-muted);
67
+ }
68
+
69
+ #{fn.bem($root-name, content)} {
70
+ border: fn.use-var(border-muted);
71
+ }
72
+ }
73
+ }
@@ -0,0 +1 @@
1
+ import './style.scss'
@@ -0,0 +1,29 @@
1
+ <template>
2
+ <div :class="className" role="separator" :aria-orientation="direction">
3
+ <span v-if="slots.default" :class="cls.e('text')">
4
+ <slot />
5
+ </span>
6
+ </div>
7
+ </template>
8
+
9
+ <script lang="ts" setup>
10
+ import { bem } from '@veltra/utils'
11
+ import { computed, useSlots } from 'vue'
12
+
13
+ import type { DividerProps } from '../../types'
14
+
15
+ defineOptions({ name: 'UDivider' })
16
+
17
+ const { direction = 'horizontal', dashed = false, align = 'center' } = defineProps<DividerProps>()
18
+
19
+ const slots = useSlots()
20
+ const cls = bem('divider')
21
+
22
+ const className = computed(() => [
23
+ cls.b,
24
+ cls.m(direction),
25
+ bem.is('dashed', dashed),
26
+ bem.is('with-text', !!slots.default),
27
+ slots.default && cls.m(align)
28
+ ])
29
+ </script>
@@ -0,0 +1 @@
1
+ export { default as UDivider } from './divider.vue'
@@ -0,0 +1,90 @@
1
+ @use 'pkg:@veltra/styles/mixins' as m;
2
+ @use 'pkg:@veltra/styles/functions' as fn;
3
+
4
+ // 方便拼接
5
+ $root-name: divider;
6
+
7
+ // 文字靠左/靠右时,对侧长线之外那一侧的短线宽度
8
+ $short-line-width: 5%;
9
+
10
+ @include m.b($root-name) {
11
+ // 水平分割线(默认形态):单独使用时由上边框划线
12
+ border-top: 1px solid fn.use-var(border-color);
13
+ margin: fn.use-var(gap, large) 0;
14
+
15
+ // 虚线
16
+ @include m.is(dashed) {
17
+ border-top-style: dashed;
18
+ }
19
+
20
+ // 垂直分割线:行内元素,随文字高度伸缩
21
+ @include m.m(vertical) {
22
+ display: inline-block;
23
+ border-top: none;
24
+ border-left: 1px solid fn.use-var(border-color);
25
+ height: 1em;
26
+ margin: 0 fn.use-var(gap);
27
+ vertical-align: middle;
28
+
29
+ @include m.is(dashed) {
30
+ border-left-style: dashed;
31
+ }
32
+ }
33
+
34
+ // 嵌套文字:两侧伪元素划线,文字默认居中
35
+ @include m.is(with-text) {
36
+ display: flex;
37
+ align-items: center;
38
+ border-top: none;
39
+ margin: fn.use-var(gap, large) 0;
40
+
41
+ &::before,
42
+ &::after {
43
+ content: '';
44
+ flex: 1;
45
+ border-top: 1px solid fn.use-var(border-color);
46
+ }
47
+
48
+ &::before {
49
+ margin-right: fn.use-var(gap);
50
+ }
51
+
52
+ &::after {
53
+ margin-left: fn.use-var(gap);
54
+ }
55
+
56
+ // 虚线作用于两侧伪元素线
57
+ @include m.is(dashed) {
58
+ &::before,
59
+ &::after {
60
+ border-top-style: dashed;
61
+ }
62
+ }
63
+ }
64
+
65
+ // 文字靠左:左线收窄为短线
66
+ @include m.m(left) {
67
+ @include m.is(with-text) {
68
+ &::before {
69
+ flex: none;
70
+ width: $short-line-width;
71
+ }
72
+ }
73
+ }
74
+
75
+ // 文字靠右:右线收窄为短线
76
+ @include m.m(right) {
77
+ @include m.is(with-text) {
78
+ &::after {
79
+ flex: none;
80
+ width: $short-line-width;
81
+ }
82
+ }
83
+ }
84
+
85
+ @include m.e(text) {
86
+ color: fn.use-var(text-color, main);
87
+ font-size: fn.use-var(font-size, main);
88
+ white-space: nowrap;
89
+ }
90
+ }
@@ -0,0 +1 @@
1
+ import './style.scss'
@@ -66,7 +66,7 @@
66
66
  </u-scroll>
67
67
  </div>
68
68
  <div v-else :class="cls.e('empty')">
69
- <UEmpty description="暂无可用变量" />
69
+ <UEmpty text="暂无可用变量" />
70
70
  </div>
71
71
 
72
72
  <PathPreview v-if="isFlat && activePath.length > 0" :path="activePath" />
@@ -149,7 +149,7 @@ import { usePreview } from './use-preview'
149
149
  import { SELECTION_HANDLES, useSelection } from './use-selection'
150
150
  import { useTransform } from './use-transform'
151
151
 
152
- defineOptions({ name: 'ImageCropper' })
152
+ defineOptions({ name: 'UImageCropper' })
153
153
 
154
154
  const props = withDefaults(defineProps<ImageCropperProps>(), {
155
155
  showToolbar: true,
@@ -86,6 +86,8 @@ export * from './action'
86
86
 
87
87
  export * from './tip'
88
88
 
89
+ export * from './transfer'
90
+
89
91
  export * from './textarea'
90
92
 
91
93
  export * from './button'
@@ -155,3 +157,27 @@ export * from './segment'
155
157
  export * from './image-cropper'
156
158
 
157
159
  export * from './kanban'
160
+
161
+ export * from './anchor'
162
+
163
+ export * from './avatar'
164
+
165
+ export * from './back-top'
166
+
167
+ export * from './alert'
168
+
169
+ export * from './rate'
170
+
171
+ export * from './divider'
172
+
173
+ export * from './space'
174
+
175
+ export * from './skeleton'
176
+
177
+ export * from './time-picker'
178
+
179
+ export * from './descriptions'
180
+
181
+ export * from './timeline'
182
+
183
+ export * from './carousel'
@@ -0,0 +1,106 @@
1
+ import { describe, expect, it } from 'vite-plus/test'
2
+ import { createApp, h, nextTick, ref } from 'vue'
3
+
4
+ import UInput from '../input.vue'
5
+
6
+ const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))
7
+
8
+ function mountInput(props: Record<string, unknown>) {
9
+ const host = document.createElement('div')
10
+ document.body.appendChild(host)
11
+
12
+ const model = ref(props.modelValue as string | undefined)
13
+ const app = createApp({
14
+ render() {
15
+ return h(UInput, {
16
+ ...props,
17
+ modelValue: model.value,
18
+ 'onUpdate:modelValue': (value: string | undefined) => {
19
+ model.value = value
20
+ }
21
+ })
22
+ }
23
+ })
24
+
25
+ app.mount(host)
26
+
27
+ return {
28
+ host,
29
+ model,
30
+ unmount() {
31
+ app.unmount()
32
+ host.remove()
33
+ }
34
+ }
35
+ }
36
+
37
+ function hover(host: HTMLElement) {
38
+ host.querySelector('.u-input')?.dispatchEvent(new MouseEvent('mouseenter'))
39
+ }
40
+
41
+ describe('Input', () => {
42
+ it('reserves suffix space before hover when clearable', () => {
43
+ const { host, unmount } = mountInput({ modelValue: 'a' })
44
+
45
+ try {
46
+ expect(host.querySelector('.u-input__suffix')).not.toBeNull()
47
+ expect(host.querySelector('.u-input__clear')).toBeNull()
48
+ } finally {
49
+ unmount()
50
+ }
51
+ })
52
+
53
+ it('does not render suffix when clearable is false and no suffix content', () => {
54
+ const { host, unmount } = mountInput({ modelValue: 'a', clearable: false })
55
+
56
+ try {
57
+ expect(host.querySelector('.u-input__suffix')).toBeNull()
58
+ } finally {
59
+ unmount()
60
+ }
61
+ })
62
+
63
+ it('renders suffix content with the suffix prop', () => {
64
+ const { host, unmount } = mountInput({ modelValue: 'a', clearable: false, suffix: '元' })
65
+
66
+ try {
67
+ expect(host.querySelector('.u-input__suffix-content')?.textContent).toContain('元')
68
+ } finally {
69
+ unmount()
70
+ }
71
+ })
72
+
73
+ it('replaces suffix content with the clear icon on hover', async () => {
74
+ const { host, unmount } = mountInput({ modelValue: 'a', suffix: '元' })
75
+
76
+ try {
77
+ hover(host)
78
+ await nextTick()
79
+ // out-in 过渡:等前一个节点离场、清除图标入场
80
+ await sleep(50)
81
+
82
+ expect(host.querySelector('.u-input__clear')).not.toBeNull()
83
+ expect(host.querySelector('.u-input__suffix-content')).toBeNull()
84
+ } finally {
85
+ unmount()
86
+ }
87
+ })
88
+
89
+ it('clears the value on clear icon click', async () => {
90
+ const { host, model, unmount } = mountInput({ modelValue: 'a' })
91
+
92
+ try {
93
+ hover(host)
94
+ await nextTick()
95
+ await sleep(50)
96
+
97
+ host
98
+ .querySelector<HTMLElement>('.u-input__clear')!
99
+ .dispatchEvent(new MouseEvent('click', { bubbles: true }))
100
+ await nextTick()
101
+ expect(model.value).toBe('')
102
+ } finally {
103
+ unmount()
104
+ }
105
+ })
106
+ })
@@ -134,6 +134,8 @@ const handlePrefixClick = () => {
134
134
  }
135
135
 
136
136
  const handleSuffixClick = () => {
137
+ // 占位空后缀不触发点击(与恒渲染前的行为一致)
138
+ if (!hasSuffixContent.value) return
137
139
  emit('suffix:click', model.value)
138
140
  }
139
141
 
@@ -159,8 +161,9 @@ const hasSuffixContent = computed(() => {
159
161
  return !!inst?.slots.suffix || !!props.suffix
160
162
  })
161
163
 
164
+ // clearable 时后缀恒渲染占位(min-width 20px),避免 hover 出现清除图标时宽度跳变
162
165
  const hasSuffix = computed(() => {
163
- return hasSuffixContent.value || showClear.value
166
+ return hasSuffixContent.value || props.clearable
164
167
  })
165
168
 
166
169
  const handleChange = (e: Event) => {
@@ -0,0 +1 @@
1
+ export { default as URate } from './rate.vue'