@veltra/desktop 1.0.8 → 1.0.9
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 +3 -3
- package/dist/components/auto-complete/auto-complete.vue.d.ts +1 -1
- package/dist/components/batch-edit/style.js +2 -2
- package/dist/components/button/button.vue.d.ts +1 -1
- package/dist/components/cascade/cascade.js +15 -13
- package/dist/components/cascade/cascade.js.map +1 -1
- package/dist/components/cascade/cascade.vue.d.ts +4 -4
- package/dist/components/cascade/node.js.map +1 -1
- package/dist/components/cascade/use-check.js +3 -2
- package/dist/components/cascade/use-check.js.map +1 -1
- package/dist/components/cascade/use-select.js +3 -3
- package/dist/components/cascade/use-select.js.map +1 -1
- package/dist/components/date-panel/date-panel.vue.d.ts +1 -1
- package/dist/components/date-picker/date-picker.js +9 -9
- package/dist/components/date-picker/date-picker.js.map +1 -1
- package/dist/components/date-picker/date-picker.vue.d.ts +1 -1
- package/dist/components/date-range-picker/date-range-picker.js +9 -9
- package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.vue.d.ts +1 -1
- package/dist/components/empty/empty.vue.d.ts +1 -1
- package/dist/components/file-picker/file-picker.vue.d.ts +1 -1
- package/dist/components/file-picker/helper.js +19 -7
- package/dist/components/file-picker/helper.js.map +1 -1
- package/dist/components/file-viewer/file-viewer.js +294 -0
- package/dist/components/file-viewer/file-viewer.js.map +1 -0
- package/dist/components/file-viewer/file-viewer.vue.d.ts +42 -0
- package/dist/components/file-viewer/helper.js +185 -0
- package/dist/components/file-viewer/helper.js.map +1 -0
- package/dist/components/file-viewer/index.d.ts +1 -0
- package/dist/components/file-viewer/previewers/docx-previewer.js +76 -0
- package/dist/components/file-viewer/previewers/docx-previewer.js.map +1 -0
- package/dist/components/file-viewer/previewers/image-previewer.js +64 -0
- package/dist/components/file-viewer/previewers/image-previewer.js.map +1 -0
- package/dist/components/file-viewer/previewers/pdf-previewer.js +90 -0
- package/dist/components/file-viewer/previewers/pdf-previewer.js.map +1 -0
- package/dist/components/file-viewer/previewers/sheet-previewer.js +175 -0
- package/dist/components/file-viewer/previewers/sheet-previewer.js.map +1 -0
- package/dist/components/file-viewer/previewers/text-previewer.js +74 -0
- package/dist/components/file-viewer/previewers/text-previewer.js.map +1 -0
- package/dist/components/file-viewer/previewers/video-previewer.js +62 -0
- package/dist/components/file-viewer/previewers/video-previewer.js.map +1 -0
- package/dist/components/file-viewer/style.d.ts +1 -0
- package/dist/components/file-viewer/style.js +4 -0
- package/dist/components/file-viewer/style2.css +445 -0
- package/dist/components/grid-input/grid-input.vue.d.ts +1 -1
- package/dist/components/index.d.ts +12 -9
- package/dist/components/input/input.vue.d.ts +1 -1
- package/dist/components/multi-select/multi-select-option.js +14 -10
- package/dist/components/multi-select/multi-select-option.js.map +1 -1
- package/dist/components/multi-select/multi-select.js +16 -19
- package/dist/components/multi-select/multi-select.js.map +1 -1
- package/dist/components/multi-select/multi-select.vue.d.ts +3 -3
- 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 +1 -1
- package/dist/components/number-range-input/number-range-input.vue.d.ts +2 -2
- package/dist/components/palette/di.js.map +1 -1
- package/dist/components/palette/palette-alpha.js +7 -10
- package/dist/components/palette/palette-alpha.js.map +1 -1
- package/dist/components/palette/palette-hue.js +5 -7
- package/dist/components/palette/palette-hue.js.map +1 -1
- package/dist/components/palette/palette-sv.js +8 -10
- package/dist/components/palette/palette-sv.js.map +1 -1
- package/dist/components/palette/palette.js +22 -24
- package/dist/components/palette/palette.js.map +1 -1
- package/dist/components/password-input/password-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 +3 -3
- package/dist/components/rich-text-editor/rich-text-editor.vue.d.ts +2 -2
- package/dist/components/select/select.js +14 -12
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/select/select.vue.d.ts +2 -2
- package/dist/components/slider/slider-thumb.js +10 -13
- package/dist/components/slider/slider-thumb.js.map +1 -1
- package/dist/components/slider/slider.js +12 -15
- package/dist/components/slider/slider.js.map +1 -1
- package/dist/components/table/di.js.map +1 -1
- package/dist/components/table/node/row.d.ts +10 -1
- package/dist/components/table/node/row.js +9 -0
- package/dist/components/table/node/row.js.map +1 -1
- package/dist/components/table/style.js +1 -1
- package/dist/components/table/table-body.js +25 -26
- package/dist/components/table/table-body.js.map +1 -1
- package/dist/components/table/table-cell.js +16 -9
- package/dist/components/table/table-cell.js.map +1 -1
- package/dist/components/table/table-row.js +78 -19
- package/dist/components/table/table-row.js.map +1 -1
- package/dist/components/table/table.js +76 -34
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/table/use-fixed-columns.js +27 -8
- package/dist/components/table/use-fixed-columns.js.map +1 -1
- package/dist/components/table/use-rows.js +2 -2
- package/dist/components/table/use-rows.js.map +1 -1
- package/dist/components/table/use-table.js +25 -3
- package/dist/components/table/use-table.js.map +1 -1
- package/dist/components/tabs/index.d.ts +3 -1
- package/dist/components/tabs/style2.css +169 -107
- package/dist/components/tabs/tabs-horizontal.js +133 -0
- package/dist/components/tabs/tabs-horizontal.js.map +1 -0
- package/dist/components/tabs/tabs-horizontal.vue.d.ts +29 -0
- package/dist/components/tabs/tabs-vertical.js +89 -0
- package/dist/components/tabs/tabs-vertical.js.map +1 -0
- package/dist/components/tabs/tabs-vertical.vue.d.ts +28 -0
- package/dist/components/tabs/tabs.js +75 -105
- package/dist/components/tabs/tabs.js.map +1 -1
- package/dist/components/tabs/tabs.vue.d.ts +9 -23
- package/dist/components/tabs/use-tabs-bar.js +105 -0
- package/dist/components/tabs/use-tabs-bar.js.map +1 -0
- package/dist/components/textarea/textarea.vue.d.ts +1 -1
- package/dist/components/tip/tip.vue.d.ts +2 -2
- package/dist/components/tree/style2.css +45 -23
- package/dist/components/tree/tree-node.js +50 -35
- package/dist/components/tree/tree-node.js.map +1 -1
- package/dist/components/tree/tree.js +27 -20
- package/dist/components/tree/tree.js.map +1 -1
- package/dist/components/tree/tree.vue.d.ts +1 -1
- package/dist/components/tree/use-check.js +52 -14
- package/dist/components/tree/use-check.js.map +1 -1
- package/dist/components/tree/use-tree-nodes.js +51 -24
- package/dist/components/tree/use-tree-nodes.js.map +1 -1
- package/dist/components/tree-select/tree-select.vue.d.ts +3 -3
- package/dist/components/watermark/watermark.vue.d.ts +1 -1
- package/dist/index.d.ts +57 -53
- package/dist/index.js +51 -48
- package/dist/types/file-viewer.d.ts +71 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/tabs.d.ts +106 -14
- package/dist/types/tree.d.ts +6 -1
- package/package.json +32 -31
- package/src/components/cascade/cascade.vue +18 -18
- package/src/components/cascade/node.ts +4 -1
- package/src/components/cascade/use-check.ts +5 -4
- package/src/components/cascade/use-select.ts +4 -5
- package/src/components/date-picker/date-picker.vue +10 -9
- package/src/components/date-range-picker/date-range-picker.vue +12 -12
- package/src/components/file-picker/helper.ts +21 -10
- package/src/components/file-viewer/file-viewer.vue +311 -0
- package/src/components/file-viewer/helper.ts +193 -0
- package/src/components/file-viewer/index.ts +1 -0
- package/src/components/file-viewer/previewers/docx-previewer.vue +78 -0
- package/src/components/file-viewer/previewers/image-previewer.vue +64 -0
- package/src/components/file-viewer/previewers/pdf-previewer.vue +90 -0
- package/src/components/file-viewer/previewers/sheet-previewer.vue +210 -0
- package/src/components/file-viewer/previewers/text-previewer.vue +76 -0
- package/src/components/file-viewer/previewers/video-previewer.vue +72 -0
- package/src/components/file-viewer/style.scss +504 -0
- package/src/components/file-viewer/style.ts +4 -0
- package/src/components/index.ts +2 -0
- package/src/components/multi-select/multi-select-option.vue +16 -3
- package/src/components/multi-select/multi-select.vue +17 -9
- package/src/components/palette/di.ts +5 -3
- package/src/components/palette/palette-alpha.vue +7 -10
- package/src/components/palette/palette-hue.vue +5 -7
- package/src/components/palette/palette-sv.vue +12 -14
- package/src/components/palette/palette.vue +19 -21
- package/src/components/select/select.vue +21 -19
- package/src/components/slider/slider-thumb.vue +11 -14
- package/src/components/slider/slider.vue +15 -15
- package/src/components/table/di.ts +20 -3
- package/src/components/table/node/row.ts +10 -1
- package/src/components/table/table-body.vue +28 -33
- package/src/components/table/table-cell.vue +17 -9
- package/src/components/table/table-row.tsx +83 -17
- package/src/components/table/table.vue +73 -45
- package/src/components/table/use-fixed-columns.ts +46 -12
- package/src/components/table/use-rows.ts +14 -3
- package/src/components/table/use-table.ts +27 -3
- package/src/components/tabs/index.ts +2 -0
- package/src/components/tabs/style.scss +217 -134
- package/src/components/tabs/tabs-horizontal.vue +125 -0
- package/src/components/tabs/tabs-vertical.vue +75 -0
- package/src/components/tabs/tabs.vue +56 -127
- package/src/components/tabs/use-tabs-bar.ts +119 -0
- package/src/components/tree/style.scss +74 -29
- package/src/components/tree/tree-node.vue +10 -4
- package/src/components/tree/tree.vue +39 -12
- package/src/components/tree/use-check.ts +79 -23
- package/src/components/tree/use-tree-nodes.ts +85 -34
- package/src/types/file-viewer.ts +69 -0
- package/src/types/index.ts +1 -0
- package/src/types/tabs.ts +113 -19
- package/src/types/tree.ts +6 -1
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
@use 'pkg:@veltra/styles/mixins' as m;
|
|
2
|
+
@use 'pkg:@veltra/styles/functions' as fn;
|
|
3
|
+
|
|
4
|
+
@include m.b(file-viewer) {
|
|
5
|
+
position: relative;
|
|
6
|
+
display: flex;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 100%;
|
|
9
|
+
min-height: 480px;
|
|
10
|
+
color: fn.use-var(text-color, main);
|
|
11
|
+
background: fn.use-var(bg-color, top);
|
|
12
|
+
border-radius: 12px;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
border: 1px solid fn.use-var(border, color);
|
|
15
|
+
|
|
16
|
+
@include m.e(inner) {
|
|
17
|
+
// 内嵌模式下透明包装,直接把子节点暴露为根的 flex 子项
|
|
18
|
+
display: contents;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@include m.is(modal) {
|
|
22
|
+
position: fixed;
|
|
23
|
+
inset: 0;
|
|
24
|
+
z-index: 2000;
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
padding: clamp(16px, 3vw, 48px);
|
|
29
|
+
min-height: 0;
|
|
30
|
+
max-height: none;
|
|
31
|
+
background: transparent;
|
|
32
|
+
border: none;
|
|
33
|
+
border-radius: 0;
|
|
34
|
+
overflow: visible;
|
|
35
|
+
outline: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 模态下的后代覆盖(必须用 & 自拼接,避免 m.e() 误拼为 .is-modal__xxx)
|
|
39
|
+
&.is-modal &__backdrop {
|
|
40
|
+
position: absolute;
|
|
41
|
+
inset: 0;
|
|
42
|
+
background: rgba(15, 23, 42, 0.52);
|
|
43
|
+
backdrop-filter: blur(6px);
|
|
44
|
+
-webkit-backdrop-filter: blur(6px);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&.is-modal &__inner {
|
|
48
|
+
position: relative;
|
|
49
|
+
display: flex;
|
|
50
|
+
width: 100%;
|
|
51
|
+
height: 100%;
|
|
52
|
+
max-width: 1440px;
|
|
53
|
+
background: fn.use-var(bg-color, top);
|
|
54
|
+
border: 1px solid fn.use-var(border, color);
|
|
55
|
+
border-radius: 16px;
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
box-shadow:
|
|
58
|
+
0 24px 64px rgba(15, 23, 42, 0.32),
|
|
59
|
+
0 2px 8px rgba(15, 23, 42, 0.18);
|
|
60
|
+
z-index: 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@include m.e(sidebar) {
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
border-right: 1px solid fn.use-var(border, color);
|
|
67
|
+
background: fn.use-var(bg-color, middle);
|
|
68
|
+
flex-shrink: 0;
|
|
69
|
+
min-width: 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@include m.e(sidebar-head) {
|
|
73
|
+
display: flex;
|
|
74
|
+
justify-content: space-between;
|
|
75
|
+
align-items: baseline;
|
|
76
|
+
padding: 18px 20px 10px;
|
|
77
|
+
color: fn.use-var(text-color, title);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@include m.e(sidebar-title) {
|
|
81
|
+
font-size: 13px;
|
|
82
|
+
font-weight: 600;
|
|
83
|
+
letter-spacing: 0.04em;
|
|
84
|
+
text-transform: uppercase;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@include m.e(sidebar-count) {
|
|
88
|
+
font-size: 12px;
|
|
89
|
+
color: fn.use-var(text-color, second);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@include m.e(list) {
|
|
93
|
+
flex: 1;
|
|
94
|
+
min-height: 0;
|
|
95
|
+
padding: 4px 10px 16px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@include m.e(list-empty) {
|
|
99
|
+
display: flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
justify-content: center;
|
|
102
|
+
padding: 48px 0;
|
|
103
|
+
color: fn.use-var(text-color, second);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@include m.e(item) {
|
|
107
|
+
display: flex;
|
|
108
|
+
gap: 12px;
|
|
109
|
+
align-items: center;
|
|
110
|
+
padding: 10px 12px;
|
|
111
|
+
margin: 2px 0;
|
|
112
|
+
border-radius: 8px;
|
|
113
|
+
cursor: pointer;
|
|
114
|
+
transition:
|
|
115
|
+
background 0.18s ease,
|
|
116
|
+
color 0.18s ease,
|
|
117
|
+
transform 0.18s ease;
|
|
118
|
+
|
|
119
|
+
&:hover {
|
|
120
|
+
background: fn.use-var(bg-color, hover);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@include m.is(active) {
|
|
124
|
+
background: color-mix(in srgb, #{fn.use-var(color, primary)} 14%, transparent);
|
|
125
|
+
color: fn.use-var(color, primary);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@include m.e(item-meta) {
|
|
130
|
+
display: flex;
|
|
131
|
+
flex-direction: column;
|
|
132
|
+
min-width: 0;
|
|
133
|
+
gap: 2px;
|
|
134
|
+
flex: 1;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
@include m.e(item-name) {
|
|
138
|
+
font-size: 13px;
|
|
139
|
+
line-height: 1.4;
|
|
140
|
+
@include m.ellipsis;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@include m.e(item-size) {
|
|
144
|
+
font-size: 11px;
|
|
145
|
+
color: fn.use-var(text-color, second);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@include m.e(badge) {
|
|
149
|
+
flex-shrink: 0;
|
|
150
|
+
display: inline-flex;
|
|
151
|
+
align-items: center;
|
|
152
|
+
justify-content: center;
|
|
153
|
+
width: 42px;
|
|
154
|
+
height: 28px;
|
|
155
|
+
border-radius: 6px;
|
|
156
|
+
font-size: 11px;
|
|
157
|
+
font-weight: 700;
|
|
158
|
+
letter-spacing: 0.04em;
|
|
159
|
+
color: #fff;
|
|
160
|
+
background: fn.use-var(text-color, placeholder);
|
|
161
|
+
|
|
162
|
+
@include m.em(badge, image) {
|
|
163
|
+
background: #0ea5e9;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
@include m.em(badge, video) {
|
|
167
|
+
background: #ef4444;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@include m.em(badge, pdf) {
|
|
171
|
+
background: #dc2626;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@include m.em(badge, sheet) {
|
|
175
|
+
background: #16a34a;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
@include m.em(badge, docx) {
|
|
179
|
+
background: #2563eb;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@include m.em(badge, text) {
|
|
183
|
+
background: #64748b;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
@include m.e(stage) {
|
|
188
|
+
flex: 1;
|
|
189
|
+
display: flex;
|
|
190
|
+
flex-direction: column;
|
|
191
|
+
min-width: 0;
|
|
192
|
+
min-height: 0;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
@include m.e(stage-head) {
|
|
196
|
+
display: flex;
|
|
197
|
+
align-items: center;
|
|
198
|
+
justify-content: space-between;
|
|
199
|
+
gap: 16px;
|
|
200
|
+
padding: 14px 22px;
|
|
201
|
+
border-bottom: 1px solid fn.use-var(border, color);
|
|
202
|
+
background: fn.use-var(bg-color, top);
|
|
203
|
+
flex-shrink: 0;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
@include m.e(stage-title) {
|
|
207
|
+
display: flex;
|
|
208
|
+
align-items: center;
|
|
209
|
+
gap: 12px;
|
|
210
|
+
min-width: 0;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
@include m.e(stage-name) {
|
|
214
|
+
font-size: 14px;
|
|
215
|
+
font-weight: 600;
|
|
216
|
+
color: fn.use-var(text-color, title);
|
|
217
|
+
@include m.ellipsis;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
@include m.e(stage-sub) {
|
|
221
|
+
font-size: 12px;
|
|
222
|
+
color: fn.use-var(text-color, second);
|
|
223
|
+
flex-shrink: 0;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
@include m.e(stage-actions) {
|
|
227
|
+
display: flex;
|
|
228
|
+
gap: 8px;
|
|
229
|
+
flex-shrink: 0;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
@include m.e(action) {
|
|
233
|
+
height: 30px;
|
|
234
|
+
padding: 0 14px;
|
|
235
|
+
border-radius: 6px;
|
|
236
|
+
border: 1px solid fn.use-var(border, color);
|
|
237
|
+
background: transparent;
|
|
238
|
+
color: inherit;
|
|
239
|
+
font-size: 12px;
|
|
240
|
+
cursor: pointer;
|
|
241
|
+
transition:
|
|
242
|
+
background 0.18s,
|
|
243
|
+
border-color 0.18s,
|
|
244
|
+
color 0.18s;
|
|
245
|
+
|
|
246
|
+
&:not(:disabled):hover {
|
|
247
|
+
border-color: fn.use-var(color, primary);
|
|
248
|
+
color: fn.use-var(color, primary);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
&:disabled {
|
|
252
|
+
opacity: 0.45;
|
|
253
|
+
cursor: not-allowed;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
@include m.em(action, primary) {
|
|
257
|
+
background: fn.use-var(color, primary);
|
|
258
|
+
border-color: fn.use-var(color, primary);
|
|
259
|
+
color: #fff;
|
|
260
|
+
|
|
261
|
+
&:not(:disabled):hover {
|
|
262
|
+
color: #fff;
|
|
263
|
+
filter: brightness(1.05);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
@include m.em(action, icon) {
|
|
268
|
+
width: 30px;
|
|
269
|
+
padding: 0;
|
|
270
|
+
display: inline-flex;
|
|
271
|
+
align-items: center;
|
|
272
|
+
justify-content: center;
|
|
273
|
+
margin-left: 4px;
|
|
274
|
+
color: fn.use-var(text-color, second);
|
|
275
|
+
|
|
276
|
+
&:not(:disabled):hover {
|
|
277
|
+
border-color: fn.use-var(color, danger);
|
|
278
|
+
color: fn.use-var(color, danger);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
@include m.e(body) {
|
|
284
|
+
position: relative;
|
|
285
|
+
flex: 1;
|
|
286
|
+
min-height: 0;
|
|
287
|
+
background: fn.use-var(bg-color, bottom);
|
|
288
|
+
overflow: hidden;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
@include m.e(empty) {
|
|
292
|
+
width: 100%;
|
|
293
|
+
height: 100%;
|
|
294
|
+
display: flex;
|
|
295
|
+
align-items: center;
|
|
296
|
+
justify-content: center;
|
|
297
|
+
color: fn.use-var(text-color, second);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
@include m.e(image) {
|
|
301
|
+
position: absolute;
|
|
302
|
+
inset: 0;
|
|
303
|
+
display: flex;
|
|
304
|
+
align-items: center;
|
|
305
|
+
justify-content: center;
|
|
306
|
+
padding: 24px;
|
|
307
|
+
user-select: none;
|
|
308
|
+
|
|
309
|
+
img {
|
|
310
|
+
max-width: 100%;
|
|
311
|
+
max-height: 100%;
|
|
312
|
+
object-fit: contain;
|
|
313
|
+
transition: transform 0.3s ease;
|
|
314
|
+
border-radius: 6px;
|
|
315
|
+
box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
@include m.is(actual) {
|
|
319
|
+
img {
|
|
320
|
+
max-width: none;
|
|
321
|
+
max-height: none;
|
|
322
|
+
object-fit: none;
|
|
323
|
+
cursor: zoom-out;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
@include m.e(video) {
|
|
329
|
+
position: absolute;
|
|
330
|
+
inset: 0;
|
|
331
|
+
display: flex;
|
|
332
|
+
align-items: center;
|
|
333
|
+
justify-content: center;
|
|
334
|
+
background: #000;
|
|
335
|
+
|
|
336
|
+
video {
|
|
337
|
+
max-width: 100%;
|
|
338
|
+
max-height: 100%;
|
|
339
|
+
outline: none;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
@include m.e(text) {
|
|
344
|
+
position: absolute;
|
|
345
|
+
inset: 0;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
@include m.e(text-pre) {
|
|
349
|
+
margin: 0;
|
|
350
|
+
padding: 20px 24px;
|
|
351
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
|
352
|
+
font-size: 12.5px;
|
|
353
|
+
line-height: 1.55;
|
|
354
|
+
white-space: pre;
|
|
355
|
+
tab-size: 2;
|
|
356
|
+
color: fn.use-var(text-color, main);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
@include m.e(pdf) {
|
|
360
|
+
position: absolute;
|
|
361
|
+
inset: 0;
|
|
362
|
+
overflow: hidden;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
@include m.e(pdf-viewport) {
|
|
366
|
+
width: 100%;
|
|
367
|
+
height: 100%;
|
|
368
|
+
background: fn.use-var(bg-color, middle);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
@include m.e(pdf-page) {
|
|
372
|
+
margin: 16px auto;
|
|
373
|
+
background: #fff;
|
|
374
|
+
box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
@include m.e(docx) {
|
|
378
|
+
position: absolute;
|
|
379
|
+
inset: 0;
|
|
380
|
+
background: fn.use-var(bg-color, middle);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
@include m.e(docx-body) {
|
|
384
|
+
padding: 24px;
|
|
385
|
+
|
|
386
|
+
:deep(.u-file-viewer__docx-doc) {
|
|
387
|
+
margin: 0 auto;
|
|
388
|
+
background: #fff;
|
|
389
|
+
box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
|
|
390
|
+
color: #222;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
@include m.e(sheet) {
|
|
395
|
+
position: absolute;
|
|
396
|
+
inset: 0;
|
|
397
|
+
display: flex;
|
|
398
|
+
flex-direction: column;
|
|
399
|
+
background: fn.use-var(bg-color, middle);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
@include m.e(sheet-note) {
|
|
403
|
+
padding: 8px 16px;
|
|
404
|
+
font-size: 12px;
|
|
405
|
+
color: fn.use-var(text-color, second);
|
|
406
|
+
background: fn.use-var(bg-color, top);
|
|
407
|
+
border-bottom: 1px solid fn.use-var(border, color);
|
|
408
|
+
flex-shrink: 0;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
@include m.e(sheet-tabs) {
|
|
412
|
+
display: flex;
|
|
413
|
+
gap: 4px;
|
|
414
|
+
padding: 8px 12px;
|
|
415
|
+
border-bottom: 1px solid fn.use-var(border, color);
|
|
416
|
+
background: fn.use-var(bg-color, top);
|
|
417
|
+
flex-shrink: 0;
|
|
418
|
+
overflow-x: auto;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
@include m.e(sheet-tab) {
|
|
422
|
+
flex-shrink: 0;
|
|
423
|
+
height: 28px;
|
|
424
|
+
padding: 0 12px;
|
|
425
|
+
border-radius: 6px;
|
|
426
|
+
border: 1px solid transparent;
|
|
427
|
+
background: transparent;
|
|
428
|
+
color: fn.use-var(text-color, second);
|
|
429
|
+
font-size: 12px;
|
|
430
|
+
cursor: pointer;
|
|
431
|
+
transition:
|
|
432
|
+
background 0.18s,
|
|
433
|
+
color 0.18s;
|
|
434
|
+
|
|
435
|
+
&:hover {
|
|
436
|
+
background: fn.use-var(bg-color, hover);
|
|
437
|
+
color: fn.use-var(text-color, main);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
@include m.is(active) {
|
|
441
|
+
background: color-mix(in srgb, #{fn.use-var(color, primary)} 14%, transparent);
|
|
442
|
+
color: fn.use-var(color, primary);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
@include m.e(sheet-stage) {
|
|
447
|
+
flex: 1;
|
|
448
|
+
min-height: 0;
|
|
449
|
+
overflow: hidden;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
@include m.e(loading) {
|
|
453
|
+
position: absolute;
|
|
454
|
+
inset: 0;
|
|
455
|
+
display: flex;
|
|
456
|
+
align-items: center;
|
|
457
|
+
justify-content: center;
|
|
458
|
+
color: fn.use-var(text-color, second);
|
|
459
|
+
font-size: 13px;
|
|
460
|
+
pointer-events: none;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.u-file-viewer-fade-enter-active,
|
|
465
|
+
.u-file-viewer-fade-leave-active {
|
|
466
|
+
transition:
|
|
467
|
+
opacity 0.22s ease,
|
|
468
|
+
transform 0.22s ease;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
.u-file-viewer-fade-enter-from,
|
|
472
|
+
.u-file-viewer-fade-leave-to {
|
|
473
|
+
opacity: 0;
|
|
474
|
+
transform: translateY(6px);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.u-file-viewer-modal-enter-active,
|
|
478
|
+
.u-file-viewer-modal-leave-active {
|
|
479
|
+
transition: opacity 0.22s ease;
|
|
480
|
+
|
|
481
|
+
.u-file-viewer__inner {
|
|
482
|
+
transition:
|
|
483
|
+
opacity 0.24s ease,
|
|
484
|
+
transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
.u-file-viewer__backdrop {
|
|
488
|
+
transition: opacity 0.22s ease;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
.u-file-viewer-modal-enter-from,
|
|
493
|
+
.u-file-viewer-modal-leave-to {
|
|
494
|
+
opacity: 1;
|
|
495
|
+
|
|
496
|
+
.u-file-viewer__inner {
|
|
497
|
+
opacity: 0;
|
|
498
|
+
transform: translateY(12px) scale(0.985);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
.u-file-viewer__backdrop {
|
|
502
|
+
opacity: 0;
|
|
503
|
+
}
|
|
504
|
+
}
|
package/src/components/index.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
@mousedown="handleMousedown"
|
|
6
6
|
@mouseup="handleMouseup"
|
|
7
7
|
@mouseleave="handleMouseleave"
|
|
8
|
-
:ref="
|
|
8
|
+
:ref="measureRef"
|
|
9
9
|
>
|
|
10
10
|
<u-checkbox
|
|
11
11
|
:class="checkboxClass"
|
|
@@ -30,13 +30,26 @@ defineOptions({
|
|
|
30
30
|
name: 'MultiSelectOption'
|
|
31
31
|
})
|
|
32
32
|
|
|
33
|
-
const
|
|
33
|
+
const props = defineProps<{
|
|
34
34
|
option: Record<string, any>
|
|
35
35
|
disabled?: boolean
|
|
36
36
|
checked: boolean
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* 虚拟项索引:对应 `options` 数组中的绝对位置。
|
|
39
|
+
* 非虚拟模式下可省略;虚拟模式下必须传入,否则元素卸载时 Virtualizer 无法及时解绑,
|
|
40
|
+
* 会因为 ResizeObserver 对脱离 DOM 的元素回调 size=0 而污染尺寸缓存。
|
|
41
|
+
*/
|
|
42
|
+
index?: number
|
|
43
|
+
measureElement?: (index: number, el: Element | null) => void
|
|
38
44
|
}>()
|
|
39
45
|
|
|
46
|
+
const { disabled = false, checked } = props
|
|
47
|
+
|
|
48
|
+
function measureRef(el: unknown) {
|
|
49
|
+
if (typeof props.index !== 'number' || !props.measureElement) return
|
|
50
|
+
props.measureElement(props.index, el as Element | null)
|
|
51
|
+
}
|
|
52
|
+
|
|
40
53
|
const emit = defineEmits<{
|
|
41
54
|
(e: 'check', checked: boolean): void
|
|
42
55
|
}>()
|
|
@@ -74,13 +74,16 @@
|
|
|
74
74
|
</div>
|
|
75
75
|
|
|
76
76
|
<!-- 多选列表 -->
|
|
77
|
+
<!--
|
|
78
|
+
虚拟化启用时内容容器 height 由 useVirtualizer 命令式写入;
|
|
79
|
+
模板不再绑定 totalSize,避免尺寸变化引起重渲染。
|
|
80
|
+
-->
|
|
77
81
|
<u-scroll
|
|
78
82
|
tag="ul"
|
|
79
83
|
:class="[cls.e('options')]"
|
|
80
84
|
ref="scrollRef"
|
|
81
85
|
v-if="options.length"
|
|
82
86
|
:content-class="[cls.e('options-wrap'), bem.is('virtual', virtualEnabled)]"
|
|
83
|
-
:content-style="{ height: virtualEnabled ? withUnit(totalHeight, 'px') : undefined }"
|
|
84
87
|
>
|
|
85
88
|
<template v-if="virtualEnabled">
|
|
86
89
|
<u-multi-select-option
|
|
@@ -91,7 +94,7 @@
|
|
|
91
94
|
:style="{ transform: `translateY(${offset}px)` }"
|
|
92
95
|
@check="handleCheck(option, $event)"
|
|
93
96
|
:checked="checkedSet.has(option)"
|
|
94
|
-
:
|
|
97
|
+
:index="index"
|
|
95
98
|
:measure-element="measureElement"
|
|
96
99
|
>
|
|
97
100
|
<slot v-bind="{ option, index }">
|
|
@@ -137,9 +140,9 @@
|
|
|
137
140
|
|
|
138
141
|
<script lang="ts" setup>
|
|
139
142
|
import { o as chainObj } from '@cat-kit/core'
|
|
140
|
-
import { useFormComponent, useFormFallbackProps,
|
|
143
|
+
import { useFormComponent, useFormFallbackProps, useVirtualizer } from '@veltra/compositions'
|
|
141
144
|
import { ArrowDown, Close, Search } from '@veltra/icons/normal'
|
|
142
|
-
import { bem, FORM_EMPTY_CONTENT
|
|
145
|
+
import { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'
|
|
143
146
|
import { computed, shallowRef, shallowReactive, watch, provide } from 'vue'
|
|
144
147
|
|
|
145
148
|
import type {
|
|
@@ -209,30 +212,35 @@ const allOptions = computed(() => {
|
|
|
209
212
|
return [...createdOptions.value, ...rawAllOptions.value]
|
|
210
213
|
})
|
|
211
214
|
|
|
212
|
-
const
|
|
213
|
-
|
|
215
|
+
const virtualEnabled = computed(() => options.value.length > 80)
|
|
216
|
+
|
|
217
|
+
const { virtualizer, items } = useVirtualizer({
|
|
214
218
|
estimateSize: () => 40,
|
|
215
219
|
count: computed(() => options.value.length),
|
|
216
|
-
scrollEl:
|
|
220
|
+
scrollEl: () => scrollRef.value?.containerRef ?? null,
|
|
221
|
+
contentEl: () => (virtualEnabled.value ? (scrollRef.value?.contentRef ?? null) : null)
|
|
217
222
|
})
|
|
218
223
|
|
|
219
224
|
const virtualOptions = computed(() => {
|
|
220
225
|
const { valueKey, labelKey } = props
|
|
221
226
|
const _options = options.value
|
|
222
|
-
return
|
|
227
|
+
return items.value.map((v) => {
|
|
223
228
|
const option = _options[v.index]!
|
|
224
229
|
const val = chainObj(option).get(valueKey)
|
|
225
230
|
return {
|
|
226
231
|
option,
|
|
227
232
|
index: v.index,
|
|
228
233
|
val,
|
|
229
|
-
key: v.
|
|
234
|
+
key: v.index,
|
|
230
235
|
offset: v.start,
|
|
231
236
|
label: chainObj(option).get(labelKey)
|
|
232
237
|
}
|
|
233
238
|
})
|
|
234
239
|
})
|
|
235
240
|
|
|
241
|
+
const measureElement: (index: number, el: Element | null) => void = (index, el) =>
|
|
242
|
+
virtualizer.measureElement(index, el)
|
|
243
|
+
|
|
236
244
|
const filterable = computed(() => {
|
|
237
245
|
return props.filterable || props.creatable || typeof props.options === 'function'
|
|
238
246
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { UserAction } from '@veltra/compositions'
|
|
2
2
|
import type { BEM } from '@veltra/utils'
|
|
3
3
|
import type { InjectionKey, Ref, ComputedRef } from 'vue'
|
|
4
4
|
|
|
@@ -14,8 +14,10 @@ export const PaletteDIKey: InjectionKey<{
|
|
|
14
14
|
RGB: ComputedRef<PaletteRGB>
|
|
15
15
|
/** 透明度 */
|
|
16
16
|
alpha: Ref<number>
|
|
17
|
-
/**
|
|
18
|
-
|
|
17
|
+
/** 将函数包装为用户动作(阻断 modelValue 回流副作用) */
|
|
18
|
+
userAction: UserAction
|
|
19
|
+
/** 当前是否处于用户动作期间 */
|
|
20
|
+
isUserActive: () => boolean
|
|
19
21
|
/** 更新色调 */
|
|
20
22
|
updateHue: (deg: number) => void
|
|
21
23
|
/** 更新调色盘透明度 */
|
|
@@ -16,7 +16,7 @@ defineOptions({
|
|
|
16
16
|
name: 'PaletteAlpha'
|
|
17
17
|
})
|
|
18
18
|
|
|
19
|
-
const { cls, updateAlpha, hueRGB, alpha,
|
|
19
|
+
const { cls, updateAlpha, hueRGB, alpha, userAction, isUserActive } = inject(PaletteDIKey)!
|
|
20
20
|
|
|
21
21
|
const alphaRef = shallowRef<HTMLElement>()
|
|
22
22
|
|
|
@@ -34,12 +34,10 @@ function getAlphaWidth() {
|
|
|
34
34
|
rangeX[1] = alphaWidth
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
})
|
|
42
|
-
}
|
|
37
|
+
const updateOffsetX = userAction((offsetX: number) => {
|
|
38
|
+
alphaThumbTransformX.value = offsetX
|
|
39
|
+
updateAlpha(alphaWidth > 0 ? offsetX / alphaWidth : 0)
|
|
40
|
+
})
|
|
43
41
|
|
|
44
42
|
const alphaDragger = useDrag({
|
|
45
43
|
target: alphaRef,
|
|
@@ -73,9 +71,8 @@ onMounted(() => {
|
|
|
73
71
|
watch(
|
|
74
72
|
alpha,
|
|
75
73
|
(newAlphaValue) => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
})
|
|
74
|
+
if (isUserActive()) return
|
|
75
|
+
alphaThumbTransformX.value = alphaWidth > 0 ? alphaWidth * newAlphaValue : 0
|
|
79
76
|
},
|
|
80
77
|
{ flush: 'post' }
|
|
81
78
|
)
|
|
@@ -15,7 +15,7 @@ defineOptions({
|
|
|
15
15
|
name: 'PaletteHue'
|
|
16
16
|
})
|
|
17
17
|
|
|
18
|
-
const { cls, updateHue, HSV,
|
|
18
|
+
const { cls, updateHue, HSV, userAction } = inject(PaletteDIKey)!
|
|
19
19
|
|
|
20
20
|
const hueRef = shallowRef<HTMLElement>()
|
|
21
21
|
|
|
@@ -33,12 +33,10 @@ function getSliderWidth() {
|
|
|
33
33
|
rangeX[1] = sliderWidth
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
})
|
|
41
|
-
}
|
|
36
|
+
const updateOffsetX = userAction((offsetX: number) => {
|
|
37
|
+
transformX.value = offsetX
|
|
38
|
+
updateHue(Math.round((offsetX / sliderWidth) * 360))
|
|
39
|
+
})
|
|
42
40
|
|
|
43
41
|
const sliderDragger = useDrag({
|
|
44
42
|
target: hueRef,
|