@veltra/desktop 1.1.7 → 1.1.10
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/action/action-group.vue.d.ts +2 -2
- package/dist/components/action/action.vue.d.ts +2 -2
- package/dist/components/button/style2.css +75 -11
- package/dist/components/card/style2.css +4 -6
- package/dist/components/cascade/cascade.vue.d.ts +4 -4
- package/dist/components/checkbox/checkbox-button.vue.d.ts +1 -1
- package/dist/components/checkbox-group/checkbox-group.vue.d.ts +1 -1
- package/dist/components/collapse/collapse-item.js +8 -23
- package/dist/components/collapse/collapse-item.js.map +1 -1
- package/dist/components/collapse/collapse-item.vue.d.ts +5 -9
- package/dist/components/collapse/collapse.js +22 -44
- package/dist/components/collapse/collapse.js.map +1 -1
- package/dist/components/collapse/collapse.vue.d.ts +3 -4
- package/dist/components/collapse/di.js.map +1 -1
- package/dist/components/collapse/style2.css +36 -38
- package/dist/components/date-panel/date-panel.vue.d.ts +1 -1
- package/dist/components/date-picker/date-picker.vue.d.ts +1 -1
- package/dist/components/date-range-picker/date-range-picker.vue.d.ts +1 -1
- package/dist/components/drawer/drawer.vue.d.ts +2 -2
- package/dist/components/file-viewer/file-viewer.vue.d.ts +3 -3
- package/dist/components/file-viewer/previewers/image-previewer.js +2 -2
- package/dist/components/file-viewer/previewers/image-previewer.js.map +1 -1
- package/dist/components/file-viewer/previewers/pdf-previewer.js +2 -2
- package/dist/components/file-viewer/previewers/pdf-previewer.js.map +1 -1
- package/dist/components/file-viewer/previewers/video-previewer.js +2 -2
- package/dist/components/file-viewer/previewers/video-previewer.js.map +1 -1
- package/dist/components/input/input.vue.d.ts +2 -2
- package/dist/components/multi-select/multi-select.vue.d.ts +2 -2
- package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +4 -4
- package/dist/components/notification/notification.vue.d.ts +1 -1
- package/dist/components/number-input/number-input.vue.d.ts +2 -2
- package/dist/components/number-range-input/number-range-input.vue.d.ts +1 -1
- package/dist/components/pop-confirm/pop-confirm.vue.d.ts +1 -1
- package/dist/components/progress-nodes/progress-nodes.vue.d.ts +2 -2
- package/dist/components/radio-group/radio-group.vue.d.ts +1 -1
- package/dist/components/select/select.vue.d.ts +1 -1
- package/dist/components/tabs/style.js +1 -0
- package/dist/components/tabs/tabs-horizontal.vue.d.ts +3 -3
- package/dist/components/tabs/tabs-vertical.vue.d.ts +2 -2
- package/dist/components/tabs/tabs.vue.d.ts +3 -3
- package/dist/components/textarea/textarea.vue.d.ts +2 -2
- package/dist/components/tip/tip.vue.d.ts +1 -1
- package/dist/components/tree-select/tree-select.vue.d.ts +4 -4
- package/dist/index.d.ts +3 -3
- package/dist/types/collapse.d.ts +5 -28
- package/dist/types/index.d.ts +2 -2
- package/package.json +11 -11
- package/src/components/button/style.scss +51 -11
- package/src/components/card/style.scss +4 -18
- package/src/components/cascade/style.scss +5 -1
- package/src/components/collapse/__test__/collapse.test.ts +178 -0
- package/src/components/collapse/collapse-item.vue +3 -12
- package/src/components/collapse/collapse.vue +42 -52
- package/src/components/collapse/di.ts +3 -2
- package/src/components/collapse/style.scss +32 -80
- package/src/components/expression-editor/style.scss +10 -2
- package/src/components/file-viewer/previewers/image-previewer.vue +2 -2
- package/src/components/file-viewer/previewers/pdf-previewer.vue +2 -2
- package/src/components/file-viewer/previewers/video-previewer.vue +2 -2
- package/src/components/paginator/style.scss +10 -2
- package/src/components/tabs/style.ts +1 -0
- package/src/components/tree/style.scss +5 -1
- package/src/types/collapse.ts +4 -32
|
@@ -7,15 +7,9 @@
|
|
|
7
7
|
<script lang="ts" setup>
|
|
8
8
|
import { useFormFallbackProps, useModel } from '@veltra/compositions'
|
|
9
9
|
import { bem, ExpandTransition } from '@veltra/utils'
|
|
10
|
-
import { computed, provide } from 'vue'
|
|
11
|
-
|
|
12
|
-
import type {
|
|
13
|
-
CollapseEmits,
|
|
14
|
-
CollapseModelValue,
|
|
15
|
-
CollapseProps,
|
|
16
|
-
CollapseValue,
|
|
17
|
-
_CollapseExposed
|
|
18
|
-
} from '../../types'
|
|
10
|
+
import { computed, provide, ref } from 'vue'
|
|
11
|
+
|
|
12
|
+
import type { CollapseEmits, CollapseModelValue, CollapseProps, CollapseValue } from '../../types'
|
|
19
13
|
import { CollapseDIKey } from './di'
|
|
20
14
|
|
|
21
15
|
defineOptions({
|
|
@@ -24,8 +18,7 @@ defineOptions({
|
|
|
24
18
|
|
|
25
19
|
const props = withDefaults(defineProps<CollapseProps>(), {
|
|
26
20
|
accordion: false,
|
|
27
|
-
|
|
28
|
-
iconPosition: 'right'
|
|
21
|
+
defaultCollapseAll: false
|
|
29
22
|
})
|
|
30
23
|
const emit = defineEmits<CollapseEmits>()
|
|
31
24
|
|
|
@@ -37,15 +30,9 @@ const expandTransition = new ExpandTransition({
|
|
|
37
30
|
|
|
38
31
|
const { size } = useFormFallbackProps([props], { size: 'default' })
|
|
39
32
|
|
|
40
|
-
const iconPosition = computed(() => props.iconPosition ?? 'right')
|
|
41
33
|
const expandIcon = computed(() => props.expandIcon)
|
|
42
34
|
|
|
43
|
-
const classList = computed(() => [
|
|
44
|
-
cls.b,
|
|
45
|
-
cls.m(size.value),
|
|
46
|
-
cls.m(`icon-${iconPosition.value}`),
|
|
47
|
-
bem.is('bordered', props.bordered)
|
|
48
|
-
])
|
|
35
|
+
const classList = computed(() => [cls.b, cls.m(size.value)])
|
|
49
36
|
|
|
50
37
|
const modelValue = useModel<CollapseProps, 'modelValue'>({
|
|
51
38
|
props,
|
|
@@ -77,51 +64,54 @@ const toggle = (value: CollapseValue) => {
|
|
|
77
64
|
update(values)
|
|
78
65
|
}
|
|
79
66
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
67
|
+
// 收集子组件已注册的 values
|
|
68
|
+
const registeredValues = ref<CollapseValue[]>([])
|
|
69
|
+
|
|
70
|
+
// 初始捕获 modelValue 是否具有有效初值
|
|
71
|
+
const hasInitialValue =
|
|
72
|
+
modelValue.value !== undefined &&
|
|
73
|
+
modelValue.value !== null &&
|
|
74
|
+
(!Array.isArray(modelValue.value) || modelValue.value.length > 0)
|
|
75
|
+
|
|
76
|
+
const register = (value: CollapseValue) => {
|
|
77
|
+
if (!registeredValues.value.includes(value)) {
|
|
78
|
+
registeredValues.value.push(value)
|
|
79
|
+
|
|
80
|
+
// 若默认展开全部(defaultCollapseAll 为 false)且外部未指定初始值,则自动展开该子项
|
|
81
|
+
if (!props.defaultCollapseAll && !hasInitialValue) {
|
|
82
|
+
if (props.accordion) {
|
|
83
|
+
if (registeredValues.value.length === 1) {
|
|
84
|
+
update(value)
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
const current = Array.isArray(modelValue.value)
|
|
88
|
+
? modelValue.value
|
|
89
|
+
: modelValue.value !== undefined && modelValue.value !== null
|
|
90
|
+
? [modelValue.value]
|
|
91
|
+
: []
|
|
92
|
+
if (!current.includes(value)) {
|
|
93
|
+
update([...current, value])
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
85
97
|
}
|
|
86
|
-
update([...activeValues.value, value])
|
|
87
98
|
}
|
|
88
99
|
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
if (
|
|
92
|
-
|
|
93
|
-
return
|
|
100
|
+
const unregister = (value: CollapseValue) => {
|
|
101
|
+
const idx = registeredValues.value.indexOf(value)
|
|
102
|
+
if (idx > -1) {
|
|
103
|
+
registeredValues.value.splice(idx, 1)
|
|
94
104
|
}
|
|
95
|
-
update(activeValues.value.filter((v) => v !== value))
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const expandAll = (values: CollapseValue[]) => {
|
|
99
|
-
if (props.accordion) {
|
|
100
|
-
update(values[0] ?? [])
|
|
101
|
-
return
|
|
102
|
-
}
|
|
103
|
-
update([...values])
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const collapseAll = () => {
|
|
107
|
-
update([])
|
|
108
105
|
}
|
|
109
106
|
|
|
110
107
|
provide(CollapseDIKey, {
|
|
111
108
|
cls,
|
|
112
109
|
size,
|
|
113
|
-
iconPosition,
|
|
114
110
|
expandIcon,
|
|
115
111
|
activeValues,
|
|
116
112
|
toggle,
|
|
117
|
-
expandTransition
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
defineExpose<_CollapseExposed>({
|
|
121
|
-
toggle,
|
|
122
|
-
expand,
|
|
123
|
-
collapse,
|
|
124
|
-
expandAll,
|
|
125
|
-
collapseAll
|
|
113
|
+
expandTransition,
|
|
114
|
+
register,
|
|
115
|
+
unregister
|
|
126
116
|
})
|
|
127
117
|
</script>
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { type BEM, type ComponentSize, ExpandTransition } from '@veltra/utils'
|
|
2
2
|
import type { Component, ComputedRef, InjectionKey } from 'vue'
|
|
3
3
|
|
|
4
|
-
import type {
|
|
4
|
+
import type { CollapseValue } from '../../types'
|
|
5
5
|
|
|
6
6
|
export interface CollapseContext {
|
|
7
7
|
cls: BEM<'collapse'>
|
|
8
8
|
size: ComputedRef<ComponentSize>
|
|
9
|
-
iconPosition: ComputedRef<CollapseIconPosition>
|
|
10
9
|
expandIcon: ComputedRef<Component | undefined>
|
|
11
10
|
activeValues: ComputedRef<CollapseValue[]>
|
|
12
11
|
toggle: (value: CollapseValue) => void
|
|
13
12
|
expandTransition: ExpandTransition
|
|
13
|
+
register: (value: CollapseValue) => void
|
|
14
|
+
unregister: (value: CollapseValue) => void
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export const CollapseDIKey: InjectionKey<CollapseContext> = Symbol('Collapse')
|
|
@@ -10,54 +10,48 @@ $ease: cubic-bezier(0.4, 0, 0.2, 1);
|
|
|
10
10
|
$transition-fast: 0.18s $ease;
|
|
11
11
|
$transition-normal: 0.24s $ease;
|
|
12
12
|
|
|
13
|
-
// 各尺寸的水平 / 垂直内边距:决定 header 和 content 的呼吸感
|
|
14
|
-
// 节奏在配置项分组场景下既不过紧、也不过松
|
|
15
|
-
$header-padding-x: (
|
|
16
|
-
small: 12px,
|
|
17
|
-
default: 16px,
|
|
18
|
-
large: 20px
|
|
19
|
-
);
|
|
20
|
-
$header-padding-y: (
|
|
21
|
-
small: 10px,
|
|
22
|
-
default: 14px,
|
|
23
|
-
large: 18px
|
|
24
|
-
);
|
|
25
|
-
|
|
26
13
|
@include m.b($root-name) {
|
|
27
14
|
width: 100%;
|
|
28
15
|
font-size: fn.use-var(font-size-main, default);
|
|
29
16
|
color: fn.use-var(text-color, main);
|
|
17
|
+
background-color: transparent;
|
|
30
18
|
|
|
31
|
-
// =====
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
background-color: fn.use-var(bg-color, top);
|
|
37
|
-
box-shadow:
|
|
38
|
-
0 1px 2px rgba(15, 23, 42, 0.04),
|
|
39
|
-
0 1px 3px rgba(15, 23, 42, 0.04);
|
|
40
|
-
overflow: hidden;
|
|
19
|
+
// ===== Item =====
|
|
20
|
+
@include m.e(item) {
|
|
21
|
+
border-radius: calc(fn.use-var(radius, default) + 2px);
|
|
22
|
+
background-color: fn.use-var(bg-color, hover);
|
|
23
|
+
transition: background-color $transition-fast;
|
|
41
24
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
25
|
+
& + #{fn.bem($root-name, item)} {
|
|
26
|
+
margin-top: fn.use-var(gap, default);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@include m.is-not(disabled) {
|
|
30
|
+
&:hover {
|
|
31
|
+
// hover 状态与展开状态保持一致的微加深背景(混入 6% 的正文文字色)
|
|
32
|
+
background-color: color-mix(
|
|
33
|
+
in srgb,
|
|
34
|
+
#{fn.use-var(text-color, main)} 6%,
|
|
35
|
+
#{fn.use-var(bg-color, hover)}
|
|
36
|
+
);
|
|
45
37
|
}
|
|
46
38
|
}
|
|
47
|
-
}
|
|
48
39
|
|
|
49
|
-
|
|
50
|
-
|
|
40
|
+
@include m.is(active) {
|
|
41
|
+
// 展开/活动状态背景(混入 6% 的正文文字色)
|
|
42
|
+
background-color: color-mix(
|
|
43
|
+
in srgb,
|
|
44
|
+
#{fn.use-var(text-color, main)} 6%,
|
|
45
|
+
#{fn.use-var(bg-color, hover)}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
51
49
|
@include m.is(disabled) {
|
|
52
50
|
opacity: 0.55;
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
53
|
|
|
56
54
|
// ===== Header =====
|
|
57
|
-
// 反馈策略:
|
|
58
|
-
// - hover:仅背景轻微变化("我可点击"信号)
|
|
59
|
-
// - active:仅 font-weight 加重 + 箭头旋转("我已展开"信号由内容显现承担)
|
|
60
|
-
// - 颜色不切换到 primary,避免在大量配置块同时展开时产生视觉嘈杂
|
|
61
55
|
@include m.e(header) {
|
|
62
56
|
position: relative;
|
|
63
57
|
display: flex;
|
|
@@ -72,12 +66,7 @@ $header-padding-y: (
|
|
|
72
66
|
transition:
|
|
73
67
|
color $transition-fast,
|
|
74
68
|
background-color $transition-fast;
|
|
75
|
-
|
|
76
|
-
@include m.is-not(disabled) {
|
|
77
|
-
&:hover {
|
|
78
|
-
background-color: fn.use-var(bg-color, hover);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
69
|
+
border-radius: inherit;
|
|
81
70
|
|
|
82
71
|
&:focus-visible {
|
|
83
72
|
box-shadow: inset 0 0 0 2px fn.use-var(color, primary);
|
|
@@ -86,11 +75,6 @@ $header-padding-y: (
|
|
|
86
75
|
@include m.is(disabled) {
|
|
87
76
|
cursor: not-allowed;
|
|
88
77
|
color: fn.use-var(text-color, placeholder);
|
|
89
|
-
|
|
90
|
-
&:hover {
|
|
91
|
-
background-color: transparent;
|
|
92
|
-
color: fn.use-var(text-color, placeholder);
|
|
93
|
-
}
|
|
94
78
|
}
|
|
95
79
|
|
|
96
80
|
@include m.is(active) {
|
|
@@ -124,12 +108,6 @@ $header-padding-y: (
|
|
|
124
108
|
}
|
|
125
109
|
|
|
126
110
|
// ===== Content wrapper =====
|
|
127
|
-
// 高度由共享 expand transition hook 在 isActive 切换时驱动:
|
|
128
|
-
// 未挂载前 → CSS 兜底 height: 0
|
|
129
|
-
// 未激活 → 0px(带 transition)
|
|
130
|
-
// 激活中 → 0 → scrollHeight(CSS transition: height)
|
|
131
|
-
// 已激活 → auto(动画结束后回归,避免锁死内容动态变化)
|
|
132
|
-
// 比 grid-template-rows: 0fr ↔ 1fr 减少每帧 grid 布局重算,嵌套场景显著更流畅。
|
|
133
111
|
@include m.e(content-wrapper) {
|
|
134
112
|
overflow: hidden;
|
|
135
113
|
height: 0;
|
|
@@ -142,50 +120,24 @@ $header-padding-y: (
|
|
|
142
120
|
}
|
|
143
121
|
|
|
144
122
|
// ===== Sizes =====
|
|
145
|
-
// padding-bottom 始终生效;inactive 时由 wrapper height: 0 + overflow: hidden
|
|
146
|
-
// 自然裁切,scrollHeight 计算因此始终一致,避免动画首帧抖动。
|
|
147
123
|
@include m.size using ($size) {
|
|
148
124
|
font-size: fn.use-var(font-size-main, $size);
|
|
149
125
|
|
|
150
126
|
@include m.bem($root-name, header) {
|
|
151
|
-
padding:
|
|
127
|
+
padding: calc(fn.use-var(gap, $size) - 2px) fn.use-var(gap, $size);
|
|
152
128
|
font-size: fn.use-var(font-size-title, $size);
|
|
153
129
|
}
|
|
154
130
|
|
|
155
131
|
@include m.bem($root-name, content) {
|
|
156
132
|
font-size: fn.use-var(font-size-main, $size);
|
|
157
|
-
padding:
|
|
133
|
+
padding: calc(fn.use-var(gap, $size) - 2px) fn.use-var(gap, $size) fn.use-var(gap, $size);
|
|
158
134
|
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// ===== Ghost(无边框):项级胶囊化,反馈完全由 item hover 承担 =====
|
|
162
|
-
// 嵌入卡片 / 对话框时使用,不引入额外的容器边界
|
|
163
|
-
@include m.is-not(bordered) {
|
|
164
|
-
background-color: transparent;
|
|
165
135
|
|
|
166
136
|
#{fn.bem($root-name, item)} {
|
|
167
|
-
border-radius: calc(fn.use-var(radius,
|
|
168
|
-
transition: background-color $transition-fast;
|
|
137
|
+
border-radius: calc(fn.use-var(radius, $size) + 2px);
|
|
169
138
|
|
|
170
139
|
& + #{fn.bem($root-name, item)} {
|
|
171
|
-
margin-top:
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
@include m.is-not(disabled) {
|
|
175
|
-
&:hover {
|
|
176
|
-
background-color: fn.use-var(bg-color, hover);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// ghost 下 header 自身不再单独 hover,由 item 整体承载
|
|
182
|
-
#{fn.bem($root-name, header)} {
|
|
183
|
-
border-radius: inherit;
|
|
184
|
-
|
|
185
|
-
@include m.is-not(disabled) {
|
|
186
|
-
&:hover {
|
|
187
|
-
background-color: transparent;
|
|
188
|
-
}
|
|
140
|
+
margin-top: fn.use-var(gap, $size);
|
|
189
141
|
}
|
|
190
142
|
}
|
|
191
143
|
}
|
|
@@ -85,7 +85,11 @@ $root-name: expression-editor;
|
|
|
85
85
|
line-height: 1;
|
|
86
86
|
font-size: 12px;
|
|
87
87
|
color: fn.component-var(expression-editor, chip-color, fn.use-var(color, primary));
|
|
88
|
-
background-color: fn.component-var(
|
|
88
|
+
background-color: fn.component-var(
|
|
89
|
+
expression-editor,
|
|
90
|
+
chip-bg,
|
|
91
|
+
fn.use-var(color, primary, light-9)
|
|
92
|
+
);
|
|
89
93
|
border-radius: 999px;
|
|
90
94
|
cursor: pointer;
|
|
91
95
|
user-select: none;
|
|
@@ -95,7 +99,11 @@ $root-name: expression-editor;
|
|
|
95
99
|
|
|
96
100
|
&:hover {
|
|
97
101
|
color: fn.component-var(expression-editor, chip-color, fn.use-var(color, primary));
|
|
98
|
-
background-color: fn.component-var(
|
|
102
|
+
background-color: fn.component-var(
|
|
103
|
+
expression-editor,
|
|
104
|
+
chip-bg,
|
|
105
|
+
fn.use-var(color, primary, light-8)
|
|
106
|
+
);
|
|
99
107
|
box-shadow: 0 1px 4px fn.use-var(shadow, color);
|
|
100
108
|
|
|
101
109
|
.#{vars.$namespace}#{$root-name}__chip-close {
|
|
@@ -18,6 +18,7 @@ import { bem } from '@veltra/utils'
|
|
|
18
18
|
import { onBeforeUnmount, ref, shallowRef, useAttrs, watch } from 'vue'
|
|
19
19
|
|
|
20
20
|
import type { FileViewerItem } from '../../../types/file-viewer'
|
|
21
|
+
import { toBlobUrl } from '../helper'
|
|
21
22
|
|
|
22
23
|
defineOptions({ name: 'FileViewerImagePreviewer', inheritAttrs: false })
|
|
23
24
|
|
|
@@ -34,11 +35,10 @@ const failed = ref(false)
|
|
|
34
35
|
|
|
35
36
|
let revoke: (() => void) | undefined
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
function load() {
|
|
38
39
|
loading.value = true
|
|
39
40
|
failed.value = false
|
|
40
41
|
revoke?.()
|
|
41
|
-
const { toBlobUrl } = await import('../helper')
|
|
42
42
|
const r = toBlobUrl(props.file.src, props.file.mime)
|
|
43
43
|
url.value = r.url
|
|
44
44
|
revoke = r.revoke
|
|
@@ -39,6 +39,7 @@ import { bem } from '@veltra/utils'
|
|
|
39
39
|
import { computed, onBeforeUnmount, shallowRef, useAttrs, watch } from 'vue'
|
|
40
40
|
|
|
41
41
|
import type { FileViewerItem } from '../../../types/file-viewer'
|
|
42
|
+
import { toBlobUrl } from '../helper'
|
|
42
43
|
|
|
43
44
|
defineOptions({ name: 'FileViewerPdfPreviewer', inheritAttrs: false })
|
|
44
45
|
|
|
@@ -54,9 +55,8 @@ const { engine, isLoading, error } = usePdfiumEngine()
|
|
|
54
55
|
const pdfUrl = shallowRef<string>('')
|
|
55
56
|
let revoke: (() => void) | undefined
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
function load() {
|
|
58
59
|
revoke?.()
|
|
59
|
-
const { toBlobUrl } = await import('../helper')
|
|
60
60
|
const r = toBlobUrl(props.file.src, props.file.mime ?? 'application/pdf')
|
|
61
61
|
pdfUrl.value = r.url
|
|
62
62
|
revoke = r.revoke
|
|
@@ -18,6 +18,7 @@ import { bem } from '@veltra/utils'
|
|
|
18
18
|
import { onBeforeUnmount, shallowRef, useTemplateRef, watch } from 'vue'
|
|
19
19
|
|
|
20
20
|
import type { FileViewerItem } from '../../../types/file-viewer'
|
|
21
|
+
import { toBlobUrl } from '../helper'
|
|
21
22
|
|
|
22
23
|
defineOptions({ name: 'FileViewerVideoPreviewer' })
|
|
23
24
|
|
|
@@ -33,9 +34,8 @@ const videoRef = useTemplateRef<HTMLVideoElement>('videoRef')
|
|
|
33
34
|
let revoke: (() => void) | undefined
|
|
34
35
|
let unmounting = false
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
function load() {
|
|
37
38
|
revoke?.()
|
|
38
|
-
const { toBlobUrl } = await import('../helper')
|
|
39
39
|
const r = toBlobUrl(props.file.src, props.file.mime)
|
|
40
40
|
url.value = r.url
|
|
41
41
|
revoke = r.revoke
|
|
@@ -39,12 +39,20 @@ $root-name: paginator;
|
|
|
39
39
|
@include m.flex($justify: center);
|
|
40
40
|
|
|
41
41
|
&:hover {
|
|
42
|
-
background-color: fn.component-var(
|
|
42
|
+
background-color: fn.component-var(
|
|
43
|
+
paginator,
|
|
44
|
+
btn-hover-bg,
|
|
45
|
+
fn.use-var(color, primary, 'light-9')
|
|
46
|
+
);
|
|
43
47
|
color: fn.component-var(paginator, btn-hover-color, fn.use-var(text, color, title));
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
@include m.is(active) {
|
|
47
|
-
background-color: fn.component-var(
|
|
51
|
+
background-color: fn.component-var(
|
|
52
|
+
paginator,
|
|
53
|
+
btn-active-bg,
|
|
54
|
+
fn.use-var(color, primary, 'light-9')
|
|
55
|
+
);
|
|
48
56
|
color: fn.component-var(paginator, btn-active-color, fn.use-var(color, primary));
|
|
49
57
|
}
|
|
50
58
|
|
|
@@ -74,7 +74,11 @@ $indent-width: 20px;
|
|
|
74
74
|
|
|
75
75
|
@include m.is(selected) {
|
|
76
76
|
@include m.bem($root-name, node-content) {
|
|
77
|
-
background-color: fn.component-var(
|
|
77
|
+
background-color: fn.component-var(
|
|
78
|
+
tree,
|
|
79
|
+
node-selected-bg,
|
|
80
|
+
fn.use-var(color, primary, light-9)
|
|
81
|
+
);
|
|
78
82
|
color: fn.component-var(tree, node-selected-color, fn.use-var(color, primary));
|
|
79
83
|
font-weight: 500;
|
|
80
84
|
|
package/src/types/collapse.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentProps
|
|
1
|
+
import type { ComponentProps } from '@veltra/utils'
|
|
2
2
|
import type { Component } from 'vue'
|
|
3
3
|
|
|
4
4
|
/** Collapse 项的唯一标识 */
|
|
@@ -7,9 +7,6 @@ export type CollapseValue = string | number
|
|
|
7
7
|
/** Collapse modelValue:手风琴模式为单值,普通模式为数组(也兼容传入单值) */
|
|
8
8
|
export type CollapseModelValue = CollapseValue | CollapseValue[]
|
|
9
9
|
|
|
10
|
-
/** 展开图标位置 */
|
|
11
|
-
export type CollapseIconPosition = 'left' | 'right'
|
|
12
|
-
|
|
13
10
|
/** Collapse 组件属性 */
|
|
14
11
|
export interface CollapseProps extends ComponentProps {
|
|
15
12
|
/** 当前展开项的 value(单个或多个) */
|
|
@@ -22,16 +19,10 @@ export interface CollapseProps extends ComponentProps {
|
|
|
22
19
|
accordion?: boolean
|
|
23
20
|
|
|
24
21
|
/**
|
|
25
|
-
*
|
|
26
|
-
* @default
|
|
27
|
-
*/
|
|
28
|
-
bordered?: boolean
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* 展开/收起图标位置
|
|
32
|
-
* @default 'right'
|
|
22
|
+
* 是否默认折叠全部项。设为 false 时默认全部展开。
|
|
23
|
+
* @default false
|
|
33
24
|
*/
|
|
34
|
-
|
|
25
|
+
defaultCollapseAll?: boolean
|
|
35
26
|
|
|
36
27
|
/**
|
|
37
28
|
* 自定义展开图标组件,活动态会自动旋转 90°。
|
|
@@ -46,22 +37,6 @@ export interface CollapseEmits {
|
|
|
46
37
|
(e: 'change', value: CollapseModelValue): void
|
|
47
38
|
}
|
|
48
39
|
|
|
49
|
-
/** Collapse 暴露的实例方法 */
|
|
50
|
-
export interface _CollapseExposed {
|
|
51
|
-
/** 切换某项的展开状态 */
|
|
52
|
-
toggle: (value: CollapseValue) => void
|
|
53
|
-
/** 展开某项 */
|
|
54
|
-
expand: (value: CollapseValue) => void
|
|
55
|
-
/** 收起某项 */
|
|
56
|
-
collapse: (value: CollapseValue) => void
|
|
57
|
-
/** 展开全部(accordion 模式下展开第一个传入的 value) */
|
|
58
|
-
expandAll: (values: CollapseValue[]) => void
|
|
59
|
-
/** 全部收起 */
|
|
60
|
-
collapseAll: () => void
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export type CollapseExposed = DeconstructValue<_CollapseExposed>
|
|
64
|
-
|
|
65
40
|
/** CollapseItem 组件属性 */
|
|
66
41
|
export interface CollapseItemProps {
|
|
67
42
|
/** 唯一标识 */
|
|
@@ -72,7 +47,4 @@ export interface CollapseItemProps {
|
|
|
72
47
|
|
|
73
48
|
/** 是否禁用 */
|
|
74
49
|
disabled?: boolean
|
|
75
|
-
|
|
76
|
-
/** 是否隐藏展开图标 */
|
|
77
|
-
hideIcon?: boolean
|
|
78
50
|
}
|