@veltra/desktop 1.14.1 → 1.15.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/auto-complete/style.d.ts +0 -1
- package/dist/components/cascade/cascade.js +13 -19
- package/dist/components/cascade/cascade.js.map +1 -1
- package/dist/components/cascade/style.d.ts +1 -3
- package/dist/components/checkbox/checkbox.js +5 -11
- package/dist/components/checkbox/checkbox.js.map +1 -1
- package/dist/components/checkbox/style.d.ts +1 -1
- package/dist/components/checkbox/style.js +0 -1
- package/dist/components/checkbox-group/style.d.ts +1 -1
- package/dist/components/chip/chip.js +63 -0
- package/dist/components/chip/chip.js.map +1 -0
- package/dist/components/chip/style.d.ts +1 -0
- package/dist/components/chip/style.js +1 -0
- package/dist/components/chip/style2.css +90 -0
- package/dist/components/chip-group/chip-group.js +279 -0
- package/dist/components/chip-group/chip-group.js.map +1 -0
- package/dist/components/chip-group/reveal.js +80 -0
- package/dist/components/chip-group/reveal.js.map +1 -0
- package/dist/components/chip-group/style.d.ts +1 -0
- package/dist/components/chip-group/style.js +2 -0
- package/dist/components/chip-group/style2.css +68 -0
- package/dist/components/condition-editor/style.d.ts +0 -1
- package/dist/components/date-picker/style.d.ts +1 -2
- package/dist/components/date-range-picker/date-range-picker.js +14 -20
- package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/dialog/dialog.js +5 -2
- package/dist/components/dialog/dialog.js.map +1 -1
- package/dist/components/dialog/style2.css +0 -10
- package/dist/components/dialog/use-maximum.js +77 -20
- package/dist/components/dialog/use-maximum.js.map +1 -1
- package/dist/components/drawer/style2.css +4 -4
- package/dist/components/form-item/style2.css +1 -1
- package/dist/components/index.d.ts +32 -30
- package/dist/components/index.js +63 -59
- package/dist/components/index.js.map +1 -1
- package/dist/components/input/input.js.map +1 -1
- package/dist/components/input/input.vue_vue_type_script_setup_true_lang.js +13 -19
- package/dist/components/input/input.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/input/style.d.ts +1 -1
- package/dist/components/input/style.js +0 -1
- package/dist/components/message/style2.css +13 -0
- package/dist/components/message-confirm/style2.css +10 -0
- package/dist/components/multi-select/multi-select.js +13 -19
- package/dist/components/multi-select/multi-select.js.map +1 -1
- package/dist/components/multi-select/style.d.ts +1 -4
- package/dist/components/multi-select/style.js +0 -1
- package/dist/components/multi-tree-select/multi-tree-select.js +10 -19
- package/dist/components/multi-tree-select/multi-tree-select.js.map +1 -1
- package/dist/components/multi-tree-select/style.d.ts +1 -5
- package/dist/components/multi-tree-select/style.js +0 -1
- package/dist/components/nav/nav-sub.js +56 -51
- package/dist/components/nav/nav-sub.js.map +1 -1
- package/dist/components/notification/notification-box.js +4 -2
- package/dist/components/notification/notification-box.js.map +1 -1
- package/dist/components/notification/style2.css +16 -0
- package/dist/components/number-input/style.d.ts +0 -1
- package/dist/components/palette/style.d.ts +1 -2
- package/dist/components/password-input/style.d.ts +1 -1
- package/dist/components/radio/radio.js +5 -8
- package/dist/components/radio/radio.js.map +1 -1
- package/dist/components/radio/style.d.ts +1 -1
- package/dist/components/radio/style.js +0 -1
- package/dist/components/radio-group/style.d.ts +1 -1
- package/dist/components/rich-text-editor/style2.css +2 -2
- package/dist/components/scroll/style2.css +27 -13
- package/dist/components/segment/segment.js +50 -3
- package/dist/components/segment/segment.js.map +1 -1
- package/dist/components/segment/style2.css +20 -2
- package/dist/components/select/select.js +24 -25
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/select/style.d.ts +0 -1
- package/dist/components/switch/style2.css +1 -1
- package/dist/components/table/style.d.ts +1 -3
- package/dist/components/tabs/style.d.ts +1 -2
- package/dist/components/tabs/style.js +0 -1
- package/dist/components/tabs/style2.css +29 -0
- package/dist/components/tabs/tabs-horizontal.js +7 -3
- package/dist/components/tabs/tabs-horizontal.js.map +1 -1
- package/dist/components/tabs/tabs.js +2 -8
- package/dist/components/tabs/tabs.js.map +1 -1
- package/dist/components/tabs/use-tabs-bar.js +41 -9
- package/dist/components/tabs/use-tabs-bar.js.map +1 -1
- package/dist/components/tag/style2.css +3 -3
- package/dist/components/textarea/style.d.ts +1 -1
- package/dist/components/textarea/style.js +0 -1
- package/dist/components/textarea/textarea.js +7 -13
- package/dist/components/textarea/textarea.js.map +1 -1
- package/dist/components/theme/style.d.ts +0 -1
- package/dist/components/theme/style2.css +9 -5
- package/dist/components/time-picker/style.d.ts +1 -2
- package/dist/components/tip/style2.css +5 -5
- package/dist/components/tip/tip.js +22 -1
- package/dist/components/tip/tip.js.map +1 -1
- package/dist/components/transfer/style.d.ts +1 -2
- package/dist/components/tree/style.d.ts +1 -1
- package/dist/components/tree-select/style.d.ts +1 -3
- package/dist/components/tree-select/tree-select.js +24 -25
- package/dist/components/tree-select/tree-select.js.map +1 -1
- package/dist/index.d.ts +86 -82
- package/dist/index.js +84 -82
- package/dist/style.d.ts +0 -8
- package/dist/style.js +2 -0
- package/dist/types/chip-group.d.ts +35 -0
- package/dist/types/chip.d.ts +28 -0
- package/dist/types/index.d.ts +3 -1
- package/package.json +1 -1
- package/src/components/cascade/cascade.vue +9 -11
- package/src/components/checkbox/checkbox.vue +6 -8
- package/src/components/checkbox/style.ts +0 -1
- package/src/components/chip/__test__/chip.test.ts +69 -0
- package/src/components/chip/chip.vue +54 -0
- package/src/components/chip/index.ts +1 -0
- package/src/components/chip/style.scss +91 -0
- package/src/components/chip/style.ts +1 -0
- package/src/components/chip-group/__test__/chip-group.test.ts +411 -0
- package/src/components/chip-group/__test__/reveal.test.ts +74 -0
- package/src/components/chip-group/chip-group.vue +326 -0
- package/src/components/chip-group/index.ts +1 -0
- package/src/components/chip-group/reveal.ts +106 -0
- package/src/components/chip-group/style.scss +72 -0
- package/src/components/chip-group/style.ts +2 -0
- package/src/components/date-range-picker/date-range-picker.vue +10 -12
- package/src/components/dialog/dialog.vue +2 -1
- package/src/components/dialog/style.scss +0 -12
- package/src/components/dialog/use-maximum.ts +88 -28
- package/src/components/drawer/style.scss +1 -1
- package/src/components/form-item/style.scss +2 -2
- package/src/components/index.ts +4 -0
- package/src/components/input/input.vue +14 -16
- package/src/components/input/style.ts +0 -1
- package/src/components/message/style.scss +15 -0
- package/src/components/message-confirm/style.scss +14 -0
- package/src/components/multi-select/multi-select.vue +8 -10
- package/src/components/multi-select/style.ts +0 -1
- package/src/components/multi-tree-select/multi-tree-select.vue +8 -10
- package/src/components/multi-tree-select/style.ts +0 -1
- package/src/components/nav/nav-sub.vue +22 -11
- package/src/components/notification/notification-box.vue +5 -2
- package/src/components/notification/style.scss +18 -0
- package/src/components/radio/radio.vue +1 -3
- package/src/components/radio/style.ts +0 -1
- package/src/components/rich-text-editor/style.scss +7 -2
- package/src/components/scroll/style.scss +39 -20
- package/src/components/segment/segment.vue +44 -2
- package/src/components/segment/style.scss +22 -2
- package/src/components/select/select.vue +24 -19
- package/src/components/switch/style.scss +4 -1
- package/src/components/tabs/style.scss +35 -0
- package/src/components/tabs/style.ts +0 -1
- package/src/components/tabs/tabs-horizontal.vue +2 -1
- package/src/components/tabs/tabs.vue +4 -6
- package/src/components/tabs/use-tabs-bar.ts +55 -8
- package/src/components/tag/style.scss +4 -4
- package/src/components/textarea/style.ts +0 -1
- package/src/components/textarea/textarea.vue +7 -9
- package/src/components/theme/style.scss +25 -5
- package/src/components/tip/style.scss +5 -5
- package/src/components/tip/tip.vue +33 -1
- package/src/components/tree-select/tree-select.vue +21 -17
- package/src/style.ts +2 -0
- package/src/types/chip-group.ts +36 -0
- package/src/types/chip.ts +29 -0
- package/src/types/index.ts +2 -0
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
@use 'pkg:@veltra/styles/vars';
|
|
4
4
|
|
|
5
5
|
@include m.b(segment) {
|
|
6
|
+
position: relative;
|
|
6
7
|
vertical-align: middle;
|
|
7
8
|
@include m.flex($display: inline-flex, $align: center);
|
|
8
9
|
gap: 2px;
|
|
@@ -10,6 +11,23 @@
|
|
|
10
11
|
background-color: fn.use-var(bg-color, bottom);
|
|
11
12
|
box-sizing: border-box;
|
|
12
13
|
|
|
14
|
+
@include m.e(thumb) {
|
|
15
|
+
position: absolute;
|
|
16
|
+
left: 0;
|
|
17
|
+
top: 0;
|
|
18
|
+
z-index: 0;
|
|
19
|
+
pointer-events: none;
|
|
20
|
+
background-color: fn.use-var(bg-color, top);
|
|
21
|
+
box-shadow: fn.use-var(shadow, sm);
|
|
22
|
+
transition:
|
|
23
|
+
transform 200ms cubic-bezier(0.77, 0, 0.175, 1),
|
|
24
|
+
opacity 200ms cubic-bezier(0.77, 0, 0.175, 1);
|
|
25
|
+
|
|
26
|
+
@media (prefers-reduced-motion: reduce) {
|
|
27
|
+
transition: none;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
13
31
|
@include m.size using ($size) {
|
|
14
32
|
border-radius: fn.use-var(radius, $size);
|
|
15
33
|
|
|
@@ -22,6 +40,8 @@
|
|
|
22
40
|
}
|
|
23
41
|
|
|
24
42
|
@include m.e(item) {
|
|
43
|
+
position: relative;
|
|
44
|
+
z-index: 1;
|
|
25
45
|
margin: 0;
|
|
26
46
|
display: inline-flex;
|
|
27
47
|
align-items: center;
|
|
@@ -45,8 +65,8 @@
|
|
|
45
65
|
|
|
46
66
|
@include m.is(active) {
|
|
47
67
|
color: fn.use-var(color, primary);
|
|
48
|
-
background-color:
|
|
49
|
-
box-shadow:
|
|
68
|
+
background-color: transparent;
|
|
69
|
+
box-shadow: none;
|
|
50
70
|
font-weight: 600;
|
|
51
71
|
}
|
|
52
72
|
|
|
@@ -34,20 +34,18 @@
|
|
|
34
34
|
</template>
|
|
35
35
|
|
|
36
36
|
<template #suffix>
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
</u-icon>
|
|
50
|
-
</transition>
|
|
37
|
+
<u-icon
|
|
38
|
+
v-if="showClear"
|
|
39
|
+
:class="cls.e('clear')"
|
|
40
|
+
title="清除"
|
|
41
|
+
key="clear"
|
|
42
|
+
@click.stop="handleClear"
|
|
43
|
+
>
|
|
44
|
+
<Close />
|
|
45
|
+
</u-icon>
|
|
46
|
+
<u-icon v-else :class="cls.e('arrow')" key="arrow">
|
|
47
|
+
<ArrowDown />
|
|
48
|
+
</u-icon>
|
|
51
49
|
</template>
|
|
52
50
|
</u-input>
|
|
53
51
|
</template>
|
|
@@ -265,16 +263,23 @@ const showClear = computed(() => {
|
|
|
265
263
|
})
|
|
266
264
|
|
|
267
265
|
/**
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
266
|
+
* 点击输入框时在 capture 阶段完成开合。
|
|
267
|
+
* 过滤模式只打开、不关闭,避免打断输入;非过滤模式切换开合。
|
|
268
|
+
* 箭头和留白仍交给 dropdown 的 click。
|
|
271
269
|
*/
|
|
272
270
|
function handleTriggerClickCapture(e: MouseEvent) {
|
|
273
|
-
if (
|
|
271
|
+
if (disabled.value) return
|
|
274
272
|
if (!(e.target instanceof HTMLInputElement)) return
|
|
275
273
|
|
|
274
|
+
// capture 与 dropdown 的 bubble click 会在同一毫秒内先后绑定。
|
|
275
|
+
// Vue 会丢掉后绑定的那个,非过滤模式下面板就打不开。开合放在先执行的 capture 里。
|
|
276
276
|
e.stopPropagation()
|
|
277
|
-
if (
|
|
277
|
+
if (filterable.value) {
|
|
278
|
+
if (!dropdownVisible.value) dropdownRef.value?.open()
|
|
279
|
+
return
|
|
280
|
+
}
|
|
281
|
+
if (dropdownVisible.value) dropdownRef.value?.close()
|
|
282
|
+
else dropdownRef.value?.open()
|
|
278
283
|
}
|
|
279
284
|
|
|
280
285
|
const { userAction, isUserActive } = useUserAction()
|
|
@@ -82,7 +82,10 @@ $root-name: switch;
|
|
|
82
82
|
border-radius: 100px;
|
|
83
83
|
background-color: fn.use-var(bg-color, bottom);
|
|
84
84
|
border: 1px solid fn.use-var(border, muted-color);
|
|
85
|
-
transition:
|
|
85
|
+
transition:
|
|
86
|
+
background-color fn.use-var(transition, fast) fn.use-var(transition, ease),
|
|
87
|
+
border-color fn.use-var(transition, fast) fn.use-var(transition, ease),
|
|
88
|
+
box-shadow fn.use-var(transition, fast) fn.use-var(transition, ease);
|
|
86
89
|
padding: 2px;
|
|
87
90
|
flex-shrink: 0;
|
|
88
91
|
}
|
|
@@ -273,6 +273,10 @@ $active-shadow: fn.use-var(shadow, sm);
|
|
|
273
273
|
@include m.bem(tabs-bar, nav) {
|
|
274
274
|
border-radius: 9999px;
|
|
275
275
|
}
|
|
276
|
+
|
|
277
|
+
@include m.bem(tabs-bar, indicator) {
|
|
278
|
+
border-radius: 9999px;
|
|
279
|
+
}
|
|
276
280
|
}
|
|
277
281
|
|
|
278
282
|
@include m.m(horizontal) {
|
|
@@ -280,4 +284,35 @@ $active-shadow: fn.use-var(shadow, sm);
|
|
|
280
284
|
border-radius: 9999px;
|
|
281
285
|
}
|
|
282
286
|
}
|
|
287
|
+
|
|
288
|
+
@include m.m(horizontal) {
|
|
289
|
+
@include m.bem(tabs-bar, list) {
|
|
290
|
+
position: relative;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
@include m.bem(tabs-bar, indicator) {
|
|
294
|
+
position: absolute;
|
|
295
|
+
left: 0;
|
|
296
|
+
top: 0;
|
|
297
|
+
z-index: 0;
|
|
298
|
+
pointer-events: none;
|
|
299
|
+
border-radius: $item-radius;
|
|
300
|
+
background-color: $active-bg;
|
|
301
|
+
box-shadow: $active-shadow;
|
|
302
|
+
transition: transform 200ms cubic-bezier(0.77, 0, 0.175, 1);
|
|
303
|
+
|
|
304
|
+
@media (prefers-reduced-motion: reduce) {
|
|
305
|
+
transition: none;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
@include m.bem(tabs-bar, item) {
|
|
310
|
+
z-index: 1;
|
|
311
|
+
|
|
312
|
+
@include m.is(active) {
|
|
313
|
+
background-color: transparent;
|
|
314
|
+
box-shadow: none;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
283
318
|
}
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
<div ref="viewportRef" :class="cls.e('viewport')">
|
|
23
23
|
<div ref="listRef" :class="cls.e('list')">
|
|
24
|
+
<div :class="cls.e('indicator')" :style="indicatorStyle" aria-hidden="true" />
|
|
24
25
|
<button
|
|
25
26
|
type="button"
|
|
26
27
|
role="tab"
|
|
@@ -99,7 +100,7 @@ const listRef = shallowRef<HTMLElement>()
|
|
|
99
100
|
|
|
100
101
|
const itemsRef = computed(() => props.items)
|
|
101
102
|
|
|
102
|
-
const { showNav, canPrev, canNext, scrollByStep } = useTabsBar({
|
|
103
|
+
const { showNav, canPrev, canNext, scrollByStep, indicatorStyle } = useTabsBar({
|
|
103
104
|
viewportRef,
|
|
104
105
|
listRef,
|
|
105
106
|
items: itemsRef,
|
|
@@ -24,12 +24,10 @@
|
|
|
24
24
|
@close="onClose"
|
|
25
25
|
/>
|
|
26
26
|
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<component v-else :key="model" :is="renderSlots()" />
|
|
32
|
-
</transition>
|
|
27
|
+
<KeepAlive v-if="keepAlive">
|
|
28
|
+
<component :key="model" :is="renderSlots()" />
|
|
29
|
+
</KeepAlive>
|
|
30
|
+
<component v-else :key="model" :is="renderSlots()" />
|
|
33
31
|
</div>
|
|
34
32
|
</template>
|
|
35
33
|
|
|
@@ -6,9 +6,11 @@ import {
|
|
|
6
6
|
scrollViewportByStep
|
|
7
7
|
} from '@veltra/utils'
|
|
8
8
|
import {
|
|
9
|
+
type CSSProperties,
|
|
9
10
|
type ModelRef,
|
|
10
11
|
type Ref,
|
|
11
12
|
type ShallowRef,
|
|
13
|
+
computed,
|
|
12
14
|
nextTick,
|
|
13
15
|
onBeforeUnmount,
|
|
14
16
|
onMounted,
|
|
@@ -61,15 +63,41 @@ export function useTabsBar(options: UseTabsBarOptions) {
|
|
|
61
63
|
const vp = viewportRef.value
|
|
62
64
|
const list = listRef.value
|
|
63
65
|
if (!vp || !list) return
|
|
64
|
-
const
|
|
65
|
-
if (!activeKey) return
|
|
66
|
-
const activeIndex = items.value.findIndex((i) => i.key === activeKey)
|
|
67
|
-
if (activeIndex < 0) return
|
|
68
|
-
const el = list.children[activeIndex] as HTMLElement | undefined
|
|
66
|
+
const el = list.querySelector<HTMLElement>('[role="tab"].is-active')
|
|
69
67
|
if (!el) return
|
|
70
68
|
scrollElementIntoView(vp, el)
|
|
71
69
|
}
|
|
72
70
|
|
|
71
|
+
const indicatorX = shallowRef(0)
|
|
72
|
+
const indicatorY = shallowRef(0)
|
|
73
|
+
const indicatorW = shallowRef(0)
|
|
74
|
+
const indicatorH = shallowRef(0)
|
|
75
|
+
const indicatorOn = shallowRef(false)
|
|
76
|
+
|
|
77
|
+
const indicatorStyle = computed<CSSProperties>(() => ({
|
|
78
|
+
width: `${indicatorW.value}px`,
|
|
79
|
+
height: `${indicatorH.value}px`,
|
|
80
|
+
transform: `translate(${indicatorX.value}px, ${indicatorY.value}px)`,
|
|
81
|
+
opacity: indicatorOn.value ? '1' : '0'
|
|
82
|
+
}))
|
|
83
|
+
|
|
84
|
+
function measureIndicator() {
|
|
85
|
+
const list = listRef.value
|
|
86
|
+
if (!list) return
|
|
87
|
+
const el = list.querySelector<HTMLElement>('[role="tab"].is-active')
|
|
88
|
+
if (!el) {
|
|
89
|
+
indicatorOn.value = false
|
|
90
|
+
return
|
|
91
|
+
}
|
|
92
|
+
const listBox = list.getBoundingClientRect()
|
|
93
|
+
const box = el.getBoundingClientRect()
|
|
94
|
+
indicatorX.value = box.left - listBox.left
|
|
95
|
+
indicatorY.value = box.top - listBox.top
|
|
96
|
+
indicatorW.value = box.width
|
|
97
|
+
indicatorH.value = box.height
|
|
98
|
+
indicatorOn.value = true
|
|
99
|
+
}
|
|
100
|
+
|
|
73
101
|
/** 鼠标滚轮(纵向)驱动水平滚动;触控板横滑(已有 deltaX)不拦截 */
|
|
74
102
|
const handleWheel = (e: WheelEvent) => {
|
|
75
103
|
const vp = viewportRef.value
|
|
@@ -77,11 +105,18 @@ export function useTabsBar(options: UseTabsBarOptions) {
|
|
|
77
105
|
applyWheelHorizontalScroll(e, vp, showNav.value)
|
|
78
106
|
}
|
|
79
107
|
|
|
80
|
-
useResizeObserver({
|
|
108
|
+
useResizeObserver({
|
|
109
|
+
targets: [viewportRef, listRef],
|
|
110
|
+
onResize: () => {
|
|
111
|
+
updateNavState()
|
|
112
|
+
measureIndicator()
|
|
113
|
+
}
|
|
114
|
+
})
|
|
81
115
|
|
|
82
116
|
watch(model, async () => {
|
|
83
117
|
await nextTick()
|
|
84
118
|
ensureActiveVisible()
|
|
119
|
+
measureIndicator()
|
|
85
120
|
})
|
|
86
121
|
|
|
87
122
|
watch(
|
|
@@ -90,6 +125,7 @@ export function useTabsBar(options: UseTabsBarOptions) {
|
|
|
90
125
|
await nextTick()
|
|
91
126
|
updateNavState()
|
|
92
127
|
ensureActiveVisible()
|
|
128
|
+
measureIndicator()
|
|
93
129
|
},
|
|
94
130
|
{ deep: false }
|
|
95
131
|
)
|
|
@@ -100,7 +136,10 @@ export function useTabsBar(options: UseTabsBarOptions) {
|
|
|
100
136
|
vp.addEventListener('wheel', handleWheel, { passive: false })
|
|
101
137
|
vp.addEventListener('scroll', updateNavState, { passive: true })
|
|
102
138
|
updateNavState()
|
|
103
|
-
nextTick(
|
|
139
|
+
nextTick(() => {
|
|
140
|
+
ensureActiveVisible()
|
|
141
|
+
measureIndicator()
|
|
142
|
+
})
|
|
104
143
|
})
|
|
105
144
|
|
|
106
145
|
onBeforeUnmount(() => {
|
|
@@ -110,5 +149,13 @@ export function useTabsBar(options: UseTabsBarOptions) {
|
|
|
110
149
|
vp.removeEventListener('scroll', updateNavState)
|
|
111
150
|
})
|
|
112
151
|
|
|
113
|
-
return {
|
|
152
|
+
return {
|
|
153
|
+
showNav,
|
|
154
|
+
canPrev,
|
|
155
|
+
canNext,
|
|
156
|
+
updateNavState,
|
|
157
|
+
scrollByStep,
|
|
158
|
+
ensureActiveVisible,
|
|
159
|
+
indicatorStyle
|
|
160
|
+
}
|
|
114
161
|
}
|
|
@@ -14,8 +14,8 @@ $root-name: tag;
|
|
|
14
14
|
border: 1px solid fn.use-var(text-color, main);
|
|
15
15
|
@include m.flex(inline-flex, flex-start, center);
|
|
16
16
|
|
|
17
|
-
//
|
|
18
|
-
animation: tag-zoom-in 0.25s cubic-bezier(0.
|
|
17
|
+
// 进入动画:从 0.96 淡入,不从 0 放大
|
|
18
|
+
animation: tag-zoom-in 0.25s cubic-bezier(0.23, 1, 0.32, 1);
|
|
19
19
|
|
|
20
20
|
@include m.e(content) {
|
|
21
21
|
overflow: hidden;
|
|
@@ -75,11 +75,11 @@ $root-name: tag;
|
|
|
75
75
|
@keyframes tag-zoom-in {
|
|
76
76
|
0% {
|
|
77
77
|
opacity: 0;
|
|
78
|
-
transform:
|
|
78
|
+
transform: scale(0.96);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
100% {
|
|
82
82
|
opacity: 1;
|
|
83
|
-
transform:
|
|
83
|
+
transform: scale(1);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -23,15 +23,13 @@
|
|
|
23
23
|
<span v-if="props.maxlength && props.showCount" :class="cls.m('count')">
|
|
24
24
|
{{ initNum }}/{{ props.maxlength }}
|
|
25
25
|
</span>
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
</u-icon>
|
|
34
|
-
</Transition>
|
|
26
|
+
<u-icon
|
|
27
|
+
v-if="props.clearable && model! && hovered && !disabled && !readonly"
|
|
28
|
+
:class="cls.m('clear')"
|
|
29
|
+
@click.stop="handleClear"
|
|
30
|
+
>
|
|
31
|
+
<Close />
|
|
32
|
+
</u-icon>
|
|
35
33
|
</div>
|
|
36
34
|
|
|
37
35
|
<span v-else style="white-space: pre-wrap">
|
|
@@ -90,7 +90,10 @@ $root-name: theme;
|
|
|
90
90
|
border-radius: 999px;
|
|
91
91
|
color: fn.use-var(text-color, second);
|
|
92
92
|
background: rgba(148, 163, 184, 0.12);
|
|
93
|
-
transition:
|
|
93
|
+
transition:
|
|
94
|
+
background-color 0.22s ease,
|
|
95
|
+
color 0.22s ease,
|
|
96
|
+
box-shadow 0.22s ease;
|
|
94
97
|
|
|
95
98
|
&:hover {
|
|
96
99
|
background: rgba(148, 163, 184, 0.18);
|
|
@@ -130,14 +133,25 @@ $root-name: theme;
|
|
|
130
133
|
border-radius: fn.use-var(radius, default);
|
|
131
134
|
background: fn.use-var(bg-color, top);
|
|
132
135
|
border: 1px solid rgba(148, 163, 184, 0.12);
|
|
133
|
-
transition:
|
|
136
|
+
transition:
|
|
137
|
+
background-color 0.22s ease,
|
|
138
|
+
border-color 0.22s ease,
|
|
139
|
+
box-shadow 0.22s ease,
|
|
140
|
+
opacity 0.22s ease,
|
|
141
|
+
transform 0.22s ease;
|
|
134
142
|
|
|
135
143
|
&:hover {
|
|
136
|
-
transform: translateY(-1px);
|
|
137
144
|
background: fn.use-var(bg-color, hover);
|
|
138
145
|
border-color: rgba(30, 136, 229, 0.16);
|
|
139
146
|
}
|
|
140
147
|
|
|
148
|
+
// 触摸屏不抬起,避免点按误触发 hover 位移
|
|
149
|
+
@media (hover: hover) and (pointer: fine) {
|
|
150
|
+
&:hover {
|
|
151
|
+
transform: translateY(-1px);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
141
155
|
@include m.is(active) {
|
|
142
156
|
background: linear-gradient(135deg, rgba(30, 136, 229, 0.14), fn.use-var(bg-color, top));
|
|
143
157
|
border-color: rgba(30, 136, 229, 0.22);
|
|
@@ -221,7 +235,10 @@ $root-name: theme;
|
|
|
221
235
|
border-radius: fn.use-var(radius, default);
|
|
222
236
|
background: fn.use-var(bg-color, top);
|
|
223
237
|
border: 1px solid rgba(148, 163, 184, 0.14);
|
|
224
|
-
transition:
|
|
238
|
+
transition:
|
|
239
|
+
border-color 0.22s ease,
|
|
240
|
+
box-shadow 0.22s ease,
|
|
241
|
+
background-color 0.22s ease;
|
|
225
242
|
|
|
226
243
|
&:hover {
|
|
227
244
|
border-color: rgba(30, 136, 229, 0.16);
|
|
@@ -373,7 +390,10 @@ $root-name: theme;
|
|
|
373
390
|
background: fn.use-var(bg-color, top);
|
|
374
391
|
border: 1px solid rgba(148, 163, 184, 0.16);
|
|
375
392
|
color: fn.use-var(text-color, main);
|
|
376
|
-
transition:
|
|
393
|
+
transition:
|
|
394
|
+
background-color 0.22s ease,
|
|
395
|
+
border-color 0.22s ease,
|
|
396
|
+
color 0.22s ease;
|
|
377
397
|
|
|
378
398
|
&:hover {
|
|
379
399
|
border-color: rgba(30, 136, 229, 0.18);
|
|
@@ -63,16 +63,16 @@ $root-name: tip;
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
.#{$root-name}-enter-active {
|
|
66
|
-
transition-timing-function:
|
|
67
|
-
transition-duration:
|
|
66
|
+
transition-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
|
|
67
|
+
transition-duration: 160ms;
|
|
68
68
|
}
|
|
69
69
|
.#{$root-name}-leave-active {
|
|
70
|
-
transition-timing-function:
|
|
71
|
-
transition-duration:
|
|
70
|
+
transition-timing-function: cubic-bezier(0.23, 1, 0.32, 1);
|
|
71
|
+
transition-duration: 120ms;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
.#{$root-name}-enter-from,
|
|
75
75
|
.#{$root-name}-leave-to {
|
|
76
76
|
opacity: 0;
|
|
77
|
-
transform: scale(0.
|
|
77
|
+
transform: scale(0.96);
|
|
78
78
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
v-if="tipVisible"
|
|
10
10
|
:is="contentTag"
|
|
11
11
|
:class="contentClass"
|
|
12
|
-
:style="[
|
|
12
|
+
:style="[contentStyle, { zIndex: zIndex() }]"
|
|
13
13
|
ref="contentRef"
|
|
14
14
|
@mouseenter="eventsHandlers.onMouseenter"
|
|
15
15
|
@mouseleave="eventsHandlers.onMouseleave"
|
|
@@ -169,6 +169,32 @@ const triggerDom = computed(() => {
|
|
|
169
169
|
return props.triggerDom || triggerRef.value?.$el
|
|
170
170
|
})
|
|
171
171
|
|
|
172
|
+
type TipSide = 'top' | 'bottom' | 'left' | 'right'
|
|
173
|
+
|
|
174
|
+
const placementSide = shallowRef<TipSide>(props.direction)
|
|
175
|
+
|
|
176
|
+
function originFor(side: TipSide): string {
|
|
177
|
+
if (side === 'top') return 'center bottom'
|
|
178
|
+
if (side === 'bottom') return 'center top'
|
|
179
|
+
if (side === 'left') return 'right center'
|
|
180
|
+
return 'left center'
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const contentStyle = computed(() => {
|
|
184
|
+
const origin = { transformOrigin: originFor(placementSide.value) }
|
|
185
|
+
const base = props.style
|
|
186
|
+
if (base == null || base === '') return origin
|
|
187
|
+
if (typeof base === 'string') return [base, origin]
|
|
188
|
+
return [base, origin]
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
watch(
|
|
192
|
+
() => props.direction,
|
|
193
|
+
(side) => {
|
|
194
|
+
placementSide.value = side
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
|
|
172
198
|
const { update, popperContainerId } = usePop({
|
|
173
199
|
triggerRef: triggerDom,
|
|
174
200
|
contentRef,
|
|
@@ -177,6 +203,12 @@ const { update, popperContainerId } = usePop({
|
|
|
177
203
|
alignment: toRef(() => props.alignment),
|
|
178
204
|
onTriggerPositionChange() {
|
|
179
205
|
close()
|
|
206
|
+
},
|
|
207
|
+
onPop(position) {
|
|
208
|
+
const side = position.placement.split('-')[0] as TipSide
|
|
209
|
+
if (side === 'top' || side === 'bottom' || side === 'left' || side === 'right') {
|
|
210
|
+
placementSide.value = side
|
|
211
|
+
}
|
|
180
212
|
}
|
|
181
213
|
})
|
|
182
214
|
|
|
@@ -31,18 +31,16 @@
|
|
|
31
31
|
<slot name="prefix" />
|
|
32
32
|
</template>
|
|
33
33
|
<template #suffix>
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
<u-icon v-else :class="cls.e('arrow')" key="arrow"><ArrowDown /></u-icon>
|
|
45
|
-
</transition>
|
|
34
|
+
<u-icon
|
|
35
|
+
v-if="showClear"
|
|
36
|
+
:class="cls.e('clear')"
|
|
37
|
+
title="清除"
|
|
38
|
+
key="clear"
|
|
39
|
+
@click.stop="handleClear"
|
|
40
|
+
>
|
|
41
|
+
<Close />
|
|
42
|
+
</u-icon>
|
|
43
|
+
<u-icon v-else :class="cls.e('arrow')" key="arrow"><ArrowDown /></u-icon>
|
|
46
44
|
</template>
|
|
47
45
|
</u-input>
|
|
48
46
|
</template>
|
|
@@ -251,16 +249,22 @@ const showClear = computed(() => {
|
|
|
251
249
|
})
|
|
252
250
|
|
|
253
251
|
/**
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
252
|
+
* 点击输入框时在 capture 阶段完成开合。
|
|
253
|
+
* 过滤模式只打开、不关闭,避免打断输入;非过滤模式切换开合。
|
|
254
|
+
* 箭头和留白仍交给 dropdown 的 click。
|
|
257
255
|
*/
|
|
258
256
|
function handleTriggerClickCapture(e: MouseEvent) {
|
|
259
|
-
if (
|
|
257
|
+
if (disabled.value) return
|
|
260
258
|
if (!(e.target instanceof HTMLInputElement)) return
|
|
261
259
|
|
|
260
|
+
// 与 USelect 相同:避免 Vue 吞掉同一毫秒内后绑定的 bubble click。
|
|
262
261
|
e.stopPropagation()
|
|
263
|
-
if (
|
|
262
|
+
if (filterable.value) {
|
|
263
|
+
if (!dropdownVisible.value) dropdownRef.value?.open()
|
|
264
|
+
return
|
|
265
|
+
}
|
|
266
|
+
if (dropdownVisible.value) dropdownRef.value?.close()
|
|
267
|
+
else dropdownRef.value?.open()
|
|
264
268
|
}
|
|
265
269
|
|
|
266
270
|
watch(dropdownVisible, (visible) => {
|
package/src/style.ts
CHANGED
|
@@ -55,6 +55,8 @@ import './components/password-input/style'
|
|
|
55
55
|
import './components/pop-confirm/style'
|
|
56
56
|
import './components/progress-nodes/style'
|
|
57
57
|
import './components/progress/style'
|
|
58
|
+
import './components/chip-group/style'
|
|
59
|
+
import './components/chip/style'
|
|
58
60
|
import './components/radio-group/style'
|
|
59
61
|
import './components/radio/style'
|
|
60
62
|
import './components/rich-text-editor/style'
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { DeconstructValue, FormComponentProps } from '@veltra/utils'
|
|
2
|
+
|
|
3
|
+
/** 胶囊单选组组件属性 */
|
|
4
|
+
export interface ChipGroupProps extends FormComponentProps {
|
|
5
|
+
/** 绑定值,等于选中项的 value */
|
|
6
|
+
modelValue?: any
|
|
7
|
+
/** 选项列表 */
|
|
8
|
+
items: Record<string, any>[]
|
|
9
|
+
/**
|
|
10
|
+
* 选项值字段名
|
|
11
|
+
* @default 'value'
|
|
12
|
+
*/
|
|
13
|
+
valueKey?: string
|
|
14
|
+
/**
|
|
15
|
+
* 标签文本字段名
|
|
16
|
+
* @default 'label'
|
|
17
|
+
*/
|
|
18
|
+
labelKey?: string
|
|
19
|
+
/** 整组禁用 */
|
|
20
|
+
disabled?: boolean
|
|
21
|
+
/** 按项禁用:返回 true 的项不可选 */
|
|
22
|
+
disabledItem?: (item: Record<string, any>) => boolean
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** 胶囊单选组组件事件 */
|
|
26
|
+
export interface ChipGroupEmits {
|
|
27
|
+
(e: 'update:modelValue', modelValue: any): void
|
|
28
|
+
/** 选中项变化,payload 为完整选项对象 */
|
|
29
|
+
(e: 'change', item: Record<string, any>): void
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** 胶囊单选组组件暴露的属性和方法(组件内部使用) */
|
|
33
|
+
export interface _ChipGroupExposed {}
|
|
34
|
+
|
|
35
|
+
/** 胶囊单选组组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
36
|
+
export type ChipGroupExposed = DeconstructValue<_ChipGroupExposed>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { DeconstructValue, FormComponentProps } from '@veltra/utils'
|
|
2
|
+
|
|
3
|
+
/** 胶囊单选组件属性 */
|
|
4
|
+
export interface ChipProps extends FormComponentProps {
|
|
5
|
+
/** 选项值 */
|
|
6
|
+
value?: any
|
|
7
|
+
/** 文本;未提供默认插槽时使用 */
|
|
8
|
+
label?: string
|
|
9
|
+
/** 禁用 */
|
|
10
|
+
disabled?: boolean
|
|
11
|
+
/** 绑定值 */
|
|
12
|
+
modelValue?: any
|
|
13
|
+
/**
|
|
14
|
+
* 原生 radio 的 name。
|
|
15
|
+
* 同一组单选必须相同,方向键才会在组内移动;UChipGroup 会自动传入。
|
|
16
|
+
*/
|
|
17
|
+
name?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** 胶囊单选组件事件 */
|
|
21
|
+
export interface ChipEmits {
|
|
22
|
+
(e: 'update:modelValue', value: any): void
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** 胶囊单选组件暴露的属性和方法(组件内部使用) */
|
|
26
|
+
export interface _ChipExposed {}
|
|
27
|
+
|
|
28
|
+
/** 胶囊单选组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
29
|
+
export type ChipExposed = DeconstructValue<_ChipExposed>
|
package/src/types/index.ts
CHANGED
|
@@ -8,6 +8,8 @@ export * from './layout'
|
|
|
8
8
|
export * from './tag'
|
|
9
9
|
export * from './date-range-picker'
|
|
10
10
|
export * from './radio-group'
|
|
11
|
+
export * from './chip'
|
|
12
|
+
export * from './chip-group'
|
|
11
13
|
export * from './scroll'
|
|
12
14
|
export * from './watermark'
|
|
13
15
|
export * from './progress'
|