@veltra/desktop 1.1.3 → 1.1.5
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.js +3 -110
- package/dist/components/action/action-group.js.map +1 -1
- package/dist/components/action/action-group.vue.d.ts +5 -14
- package/dist/components/action/action-group.vue_vue_type_script_setup_true_lang.js +105 -0
- package/dist/components/action/action-group.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/action/action.js +5 -1
- package/dist/components/action/action.js.map +1 -1
- package/dist/components/action/di.js.map +1 -1
- package/dist/components/action/style2.css +17 -14
- package/dist/components/auto-complete/auto-complete.js +1 -1
- package/dist/components/auto-complete/auto-complete.vue.d.ts +2 -2
- package/dist/components/badge/badge.js +1 -1
- package/dist/components/batch-edit/batch-edit-form.js +94 -101
- package/dist/components/batch-edit/batch-edit-form.js.map +1 -1
- package/dist/components/batch-edit/batch-edit-list.js +52 -68
- package/dist/components/batch-edit/batch-edit-list.js.map +1 -1
- package/dist/components/batch-edit/style2.css +13 -89
- package/dist/components/breadcrumb/breadcrumb.js +1 -1
- package/dist/components/button/button.js +1 -1
- package/dist/components/card/card.js +1 -1
- package/dist/components/cascade/cascade-panel-item.js +4 -4
- package/dist/components/cascade/cascade.js +2 -2
- package/dist/components/cascade/cascade.vue.d.ts +5 -5
- package/dist/components/checkbox/checkbox-button.js +1 -1
- package/dist/components/checkbox/checkbox.js +1 -1
- package/dist/components/checkbox-group/checkbox-group.js +1 -1
- package/dist/components/code-editor/code-editor.js +1 -1
- package/dist/components/collapse/collapse.js +1 -1
- package/dist/components/condition-editor/components/condition-group.js +152 -0
- package/dist/components/condition-editor/components/condition-group.js.map +1 -0
- package/dist/components/condition-editor/components/condition-row.js +217 -0
- package/dist/components/condition-editor/components/condition-row.js.map +1 -0
- package/dist/components/condition-editor/condition-editor.js +134 -5
- package/dist/components/condition-editor/condition-editor.js.map +1 -1
- package/dist/components/condition-editor/condition-editor.vue.d.ts +10 -2
- package/dist/components/condition-editor/core/evaluator.js +75 -0
- package/dist/components/condition-editor/core/evaluator.js.map +1 -0
- package/dist/components/condition-editor/core/operators.js +123 -0
- package/dist/components/condition-editor/core/operators.js.map +1 -0
- package/dist/components/condition-editor/style.js +7 -0
- package/dist/components/condition-editor/style2.css +186 -0
- package/dist/components/context-menu/context-menu.js +1 -1
- package/dist/components/date-picker/date-picker.js +2 -2
- package/dist/components/date-picker/date-picker.vue.d.ts +2 -2
- package/dist/components/date-range-picker/date-range-picker.js +2 -2
- package/dist/components/date-range-picker/date-range-picker.vue.d.ts +2 -2
- package/dist/components/dialog/dialog.js +7 -7
- package/dist/components/dialog/style2.css +8 -0
- package/dist/components/dialog/use-maximum.js +1 -1
- package/dist/components/drawer/style2.css +8 -0
- package/dist/components/dropdown/dropdown.js +1 -1
- package/dist/components/expression-editor/components/variable-picker.js +8 -8
- package/dist/components/expression-editor/expression-editor.js +1 -1
- package/dist/components/expression-editor/style2.css +1 -0
- package/dist/components/file-viewer/file-viewer.js +13 -13
- package/dist/components/form-item/form-item.js.map +1 -1
- package/dist/components/form-item/form-item.vue_vue_type_script_setup_true_lang.js +6 -6
- package/dist/components/form-item/form-item.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/grid-input/grid-input.js +1 -1
- package/dist/components/group-input/group-input.js +2 -1
- package/dist/components/group-input/group-input.js.map +1 -1
- package/dist/components/group-input/style.js +1 -0
- package/dist/components/index.js +154 -154
- package/dist/components/input/input.vue.d.ts +4 -4
- package/dist/components/input/input.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/layout/layout-resizer.js +1 -1
- package/dist/components/layout/layout.js +1 -1
- package/dist/components/list/list.js +1 -1
- package/dist/components/loading/loading.js +1 -1
- package/dist/components/menu/menu-sub-collapsed.js +4 -4
- package/dist/components/menu/menu.js +1 -1
- package/dist/components/message/message.js +1 -1
- package/dist/components/message-confirm/message-confirm.js +1 -1
- package/dist/components/multi-select/multi-select-option.js +19 -14
- package/dist/components/multi-select/multi-select-option.js.map +1 -1
- package/dist/components/multi-select/multi-select.js +15 -15
- package/dist/components/multi-select/multi-select.vue.d.ts +4 -4
- package/dist/components/multi-tree-select/multi-tree-select.js +8 -8
- package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +6 -6
- package/dist/components/notification/notification.js +1 -1
- package/dist/components/notification/notification.vue.d.ts +1 -1
- package/dist/components/number/number.vue.d.ts +1 -1
- package/dist/components/number-input/number-input.js +2 -2
- package/dist/components/number-input/number-input.vue.d.ts +4 -4
- package/dist/components/number-range-input/number-range-input.js +1 -1
- package/dist/components/number-range-input/number-range-input.vue.d.ts +1 -1
- package/dist/components/number-range-input/style2.css +1 -0
- package/dist/components/paginator/paginator.js +6 -6
- package/dist/components/paginator/style.js +1 -1
- package/dist/components/palette/palette.js +1 -1
- package/dist/components/password-input/password-input.js +2 -2
- package/dist/components/password-input/password-input.vue.d.ts +1 -1
- package/dist/components/pop-confirm/pop-confirm.js +1 -1
- package/dist/components/pop-confirm/pop-confirm.vue.d.ts +1 -1
- package/dist/components/progress-nodes/progress-nodes.js +1 -1
- package/dist/components/radio/radio.js +1 -1
- package/dist/components/radio-group/radio-group.js +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.js +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.vue.d.ts +1 -1
- package/dist/components/scroll/scroll-bar.js +1 -1
- package/dist/components/scroll/scroll.js +1 -1
- package/dist/components/select/select.js +10 -10
- package/dist/components/select/select.vue.d.ts +2 -2
- package/dist/components/slider/slider.js +1 -1
- package/dist/components/steps/steps.js +2 -2
- package/dist/components/switch/switch.js +1 -1
- package/dist/components/table/style2.css +4 -1
- package/dist/components/table/table.js +2 -2
- package/dist/components/table/table.js.map +1 -1
- package/dist/components/table/use-columns.js +1 -1
- package/dist/components/table/use-fixed-columns.js +8 -31
- package/dist/components/table/use-fixed-columns.js.map +1 -1
- package/dist/components/table-editor/table-editor.js +1 -1
- package/dist/components/tabs/tabs-horizontal.js +1 -1
- package/dist/components/tabs/tabs-horizontal.vue.d.ts +4 -4
- package/dist/components/tabs/tabs-vertical.js +1 -1
- package/dist/components/tabs/tabs-vertical.vue.d.ts +3 -3
- package/dist/components/tabs/tabs.js +1 -1
- package/dist/components/tabs/tabs.vue.d.ts +4 -4
- package/dist/components/tag/tag.js +1 -1
- package/dist/components/textarea/textarea.js +1 -1
- package/dist/components/textarea/textarea.vue.d.ts +4 -4
- package/dist/components/theme/style.js +1 -1
- package/dist/components/theme/theme.js +11 -11
- package/dist/components/tip/tip.js +1 -1
- package/dist/components/tree/tree-node.js +1 -1
- package/dist/components/tree/tree.js +5 -5
- package/dist/components/tree-select/tree-select.js +6 -6
- package/dist/components/tree-select/tree-select.vue.d.ts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +83 -83
- package/dist/style.js +2 -2
- package/dist/types/action.d.ts +5 -11
- package/dist/types/condition-editor.d.ts +41 -8
- package/dist/types/index.d.ts +4 -4
- package/package.json +11 -11
- package/src/components/action/action-group.vue +68 -82
- package/src/components/action/action.vue +9 -1
- package/src/components/action/di.ts +2 -1
- package/src/components/action/style.scss +22 -27
- package/src/components/batch-edit/batch-edit-form.vue +65 -70
- package/src/components/batch-edit/batch-edit-list.vue +35 -41
- package/src/components/batch-edit/style.scss +19 -118
- package/src/components/condition-editor/components/condition-group.vue +131 -0
- package/src/components/condition-editor/components/condition-row.vue +208 -0
- package/src/components/condition-editor/condition-editor.vue +145 -6
- package/src/components/condition-editor/core/evaluator.ts +93 -0
- package/src/components/condition-editor/core/operators.ts +57 -0
- package/src/components/condition-editor/style.scss +239 -1
- package/src/components/condition-editor/style.ts +7 -0
- package/src/components/dialog/style.scss +13 -0
- package/src/components/drawer/style.scss +13 -0
- package/src/components/expression-editor/style.scss +1 -0
- package/src/components/form-item/form-item.vue +1 -1
- package/src/components/group-input/group-input.vue +8 -1
- package/src/components/group-input/style.ts +1 -0
- package/src/components/multi-select/multi-select-option.vue +19 -13
- package/src/components/number-range-input/style.scss +1 -0
- package/src/components/table/style.scss +9 -1
- package/src/components/table/table.vue +1 -3
- package/src/components/table/use-fixed-columns.ts +5 -49
- package/src/types/action.ts +6 -11
- package/src/types/condition-editor.ts +39 -7
|
@@ -2,8 +2,246 @@
|
|
|
2
2
|
@use 'pkg:@veltra/styles/functions' as fn;
|
|
3
3
|
@use 'pkg:@veltra/styles/vars';
|
|
4
4
|
|
|
5
|
-
// 方便拼接
|
|
6
5
|
$root-name: condition-editor;
|
|
7
6
|
|
|
8
7
|
@include m.b($root-name) {
|
|
8
|
+
// ─── 条件分组 ────────────────────────────────────
|
|
9
|
+
@include m.e(group) {
|
|
10
|
+
// 外层不需额外边框
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@include m.e(group-header) {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: 6px;
|
|
17
|
+
margin-bottom: 4px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@include m.e(group-body) {
|
|
21
|
+
border-left: 2px solid fn.use-var(border, muted-color);
|
|
22
|
+
margin-left: 8px;
|
|
23
|
+
padding-left: 10px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@include m.e(group-actions) {
|
|
27
|
+
display: flex;
|
|
28
|
+
gap: 10px;
|
|
29
|
+
padding: 2px 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@include m.e(group-result) {
|
|
33
|
+
font-size: 11px;
|
|
34
|
+
font-weight: 600;
|
|
35
|
+
|
|
36
|
+
&--pass {
|
|
37
|
+
color: fn.use-var(color, success);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&--fail {
|
|
41
|
+
color: fn.use-var(color, danger);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// ─── AND/OR 标签 ──────────────────────────────────
|
|
46
|
+
@include m.e(logic-tag) {
|
|
47
|
+
display: inline-block;
|
|
48
|
+
padding: 1px 8px;
|
|
49
|
+
border-radius: fn.use-var(radius, small);
|
|
50
|
+
font-size: 11px;
|
|
51
|
+
font-weight: 600;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
user-select: none;
|
|
54
|
+
transition: background-color 0.12s ease;
|
|
55
|
+
|
|
56
|
+
&--and {
|
|
57
|
+
background-color: fn.use-var(color, primary, light-9);
|
|
58
|
+
color: fn.use-var(color, primary);
|
|
59
|
+
|
|
60
|
+
&:hover {
|
|
61
|
+
background-color: fn.use-var(color, primary, light-8);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&--or {
|
|
66
|
+
background-color: fn.use-var(color, warning, light-9);
|
|
67
|
+
color: fn.use-var(color, warning);
|
|
68
|
+
|
|
69
|
+
&:hover {
|
|
70
|
+
background-color: fn.use-var(color, warning, light-8);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// ─── 条件行 ──────────────────────────────────────
|
|
76
|
+
@include m.e(row) {
|
|
77
|
+
display: flex;
|
|
78
|
+
gap: 4px;
|
|
79
|
+
align-items: center;
|
|
80
|
+
margin-bottom: 3px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@include m.e(field) {
|
|
84
|
+
width: 90px;
|
|
85
|
+
flex-shrink: 0;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@include m.e(operator) {
|
|
89
|
+
width: 80px;
|
|
90
|
+
flex-shrink: 0;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@include m.e(value) {
|
|
94
|
+
flex: 1;
|
|
95
|
+
min-width: 0;
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@include m.e(value-input) {
|
|
101
|
+
width: 100%;
|
|
102
|
+
height: 28px;
|
|
103
|
+
padding: 0 8px;
|
|
104
|
+
border: 1px solid fn.use-var(border, muted-color);
|
|
105
|
+
border-radius: fn.use-var(radius, small);
|
|
106
|
+
font-size: 12px;
|
|
107
|
+
color: fn.use-var(text-color, main);
|
|
108
|
+
background-color: fn.use-var(bg-color, top);
|
|
109
|
+
outline: none;
|
|
110
|
+
transition: border-color 0.12s ease;
|
|
111
|
+
|
|
112
|
+
&::placeholder {
|
|
113
|
+
color: fn.use-var(text-color, placeholder);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&:focus {
|
|
117
|
+
border-color: fn.use-var(color, primary);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&:disabled {
|
|
121
|
+
background-color: fn.use-var(color, disabled);
|
|
122
|
+
cursor: not-allowed;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@include m.e(value-empty) {
|
|
127
|
+
font-size: 12px;
|
|
128
|
+
color: fn.use-var(text-color, assist);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// ─── 变量 chip ──────────────────────────────────
|
|
132
|
+
@include m.e(value-chip) {
|
|
133
|
+
display: inline-flex;
|
|
134
|
+
align-items: center;
|
|
135
|
+
gap: 4px;
|
|
136
|
+
padding: 0 8px;
|
|
137
|
+
height: 22px;
|
|
138
|
+
font-size: 12px;
|
|
139
|
+
color: fn.use-var(color, primary);
|
|
140
|
+
background-color: fn.use-var(color, primary, light-9);
|
|
141
|
+
border-radius: 999px;
|
|
142
|
+
cursor: pointer;
|
|
143
|
+
user-select: none;
|
|
144
|
+
transition:
|
|
145
|
+
background-color 0.12s ease,
|
|
146
|
+
box-shadow 0.12s ease;
|
|
147
|
+
|
|
148
|
+
&:hover {
|
|
149
|
+
background-color: fn.use-var(color, primary, light-8);
|
|
150
|
+
|
|
151
|
+
.#{vars.$namespace}#{$root-name}__value-chip-close {
|
|
152
|
+
opacity: 1;
|
|
153
|
+
max-width: 14px;
|
|
154
|
+
margin-left: 2px;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@include m.e(value-chip-label) {
|
|
160
|
+
pointer-events: none;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
@include m.e(value-chip-close) {
|
|
164
|
+
display: inline-flex;
|
|
165
|
+
align-items: center;
|
|
166
|
+
justify-content: center;
|
|
167
|
+
width: 14px;
|
|
168
|
+
max-width: 0;
|
|
169
|
+
margin-left: 0;
|
|
170
|
+
overflow: hidden;
|
|
171
|
+
font-size: 14px;
|
|
172
|
+
line-height: 1;
|
|
173
|
+
color: fn.use-var(color, primary);
|
|
174
|
+
opacity: 0;
|
|
175
|
+
transition:
|
|
176
|
+
opacity 0.12s ease,
|
|
177
|
+
max-width 0.12s ease,
|
|
178
|
+
margin-left 0.12s ease;
|
|
179
|
+
|
|
180
|
+
&:hover {
|
|
181
|
+
transform: scale(1.1);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// ─── 删除按钮 ────────────────────────────────────
|
|
186
|
+
@include m.e(row-delete) {
|
|
187
|
+
flex-shrink: 0;
|
|
188
|
+
width: 16px;
|
|
189
|
+
text-align: center;
|
|
190
|
+
font-size: 15px;
|
|
191
|
+
color: fn.use-var(text-color, assist);
|
|
192
|
+
cursor: pointer;
|
|
193
|
+
transition: color 0.12s ease;
|
|
194
|
+
|
|
195
|
+
&:hover {
|
|
196
|
+
color: fn.use-var(color, danger);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// ─── 结果指示 ────────────────────────────────────
|
|
201
|
+
@include m.e(result) {
|
|
202
|
+
flex-shrink: 0;
|
|
203
|
+
width: 16px;
|
|
204
|
+
text-align: center;
|
|
205
|
+
font-size: 11px;
|
|
206
|
+
font-weight: 600;
|
|
207
|
+
|
|
208
|
+
&--pass {
|
|
209
|
+
color: fn.use-var(color, success);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
&--fail {
|
|
213
|
+
color: fn.use-var(color, danger);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
&--none {
|
|
217
|
+
color: fn.use-var(text-color, assist);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// ─── 添加按钮 ────────────────────────────────────
|
|
222
|
+
@include m.e(add-btn) {
|
|
223
|
+
font-size: 11px;
|
|
224
|
+
color: fn.use-var(color, primary);
|
|
225
|
+
cursor: pointer;
|
|
226
|
+
transition: color 0.12s ease;
|
|
227
|
+
|
|
228
|
+
&:hover {
|
|
229
|
+
color: fn.use-var(color, primary, dark-2);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// ─── 状态 ──────────────────────────────────────
|
|
234
|
+
@include m.is(disabled) {
|
|
235
|
+
cursor: not-allowed;
|
|
236
|
+
|
|
237
|
+
@include m.bem($root-name, logic-tag) {
|
|
238
|
+
cursor: not-allowed;
|
|
239
|
+
opacity: 0.6;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
@include m.bem($root-name, add-btn) {
|
|
243
|
+
cursor: not-allowed;
|
|
244
|
+
opacity: 0.6;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
9
247
|
}
|
|
@@ -18,6 +18,19 @@ $root-name: dialog;
|
|
|
18
18
|
background-color: rgba($color: #000000, $alpha: 0.32);
|
|
19
19
|
pointer-events: auto;
|
|
20
20
|
}
|
|
21
|
+
|
|
22
|
+
// 确保遮罩淡入淡出不受外部 fade 样式(如 transform)影响
|
|
23
|
+
&.fade-enter-active,
|
|
24
|
+
&.fade-leave-active {
|
|
25
|
+
transition: opacity 0.25s linear;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&.fade-enter-from,
|
|
29
|
+
&.fade-leave-to {
|
|
30
|
+
opacity: 0;
|
|
31
|
+
transform: none;
|
|
32
|
+
filter: none;
|
|
33
|
+
}
|
|
21
34
|
}
|
|
22
35
|
|
|
23
36
|
@include m.b($root-name) {
|
|
@@ -107,6 +107,19 @@ $direction-map: (
|
|
|
107
107
|
height: 100vh;
|
|
108
108
|
background-color: rgba($color: #000000, $alpha: 0.32);
|
|
109
109
|
overflow: hidden;
|
|
110
|
+
|
|
111
|
+
// 确保遮罩淡入淡出不受外部 fade 样式(如 transform)影响
|
|
112
|
+
&.fade-enter-active,
|
|
113
|
+
&.fade-leave-active {
|
|
114
|
+
transition: opacity 0.25s linear;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&.fade-enter-from,
|
|
118
|
+
&.fade-leave-to {
|
|
119
|
+
opacity: 0;
|
|
120
|
+
transform: none;
|
|
121
|
+
filter: none;
|
|
122
|
+
}
|
|
110
123
|
}
|
|
111
124
|
|
|
112
125
|
// 动画
|
|
@@ -81,7 +81,7 @@ const labelStyles = computed<CSSProperties>(() => {
|
|
|
81
81
|
/** 错误提示 */
|
|
82
82
|
const errorTips = computed<string | undefined>(() => {
|
|
83
83
|
if (props.field) {
|
|
84
|
-
return formProps?.model
|
|
84
|
+
return formProps?.model?.errors.get(props.field)?.[0]
|
|
85
85
|
}
|
|
86
86
|
})
|
|
87
87
|
|
|
@@ -15,7 +15,14 @@
|
|
|
15
15
|
:size="size"
|
|
16
16
|
@click="handleRemove(index)"
|
|
17
17
|
/>
|
|
18
|
-
<u-button
|
|
18
|
+
<u-button
|
|
19
|
+
:icon="Plus"
|
|
20
|
+
circle
|
|
21
|
+
:disabled="disabled"
|
|
22
|
+
:size="size"
|
|
23
|
+
type="primary"
|
|
24
|
+
@click="handleAdd(index)"
|
|
25
|
+
/>
|
|
19
26
|
</span>
|
|
20
27
|
</li>
|
|
21
28
|
</ul>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
<script lang="ts" setup>
|
|
23
23
|
import { Ripple } from '@veltra/directives'
|
|
24
|
-
import { inject, onBeforeUnmount } from 'vue'
|
|
24
|
+
import { inject, onBeforeUnmount, shallowRef } from 'vue'
|
|
25
25
|
|
|
26
26
|
import { UCheckbox } from '../checkbox'
|
|
27
27
|
import { MultiSelectDIKey } from './di'
|
|
@@ -43,8 +43,6 @@ const props = defineProps<{
|
|
|
43
43
|
measureElement?: (index: number, el: Element | null) => void
|
|
44
44
|
}>()
|
|
45
45
|
|
|
46
|
-
const { disabled = false, checked } = props
|
|
47
|
-
|
|
48
46
|
function measureRef(el: unknown) {
|
|
49
47
|
if (typeof props.index !== 'number' || !props.measureElement) return
|
|
50
48
|
props.measureElement(props.index, el as Element | null)
|
|
@@ -56,33 +54,41 @@ const emit = defineEmits<{
|
|
|
56
54
|
|
|
57
55
|
const { optionClass, rippleClass, checkboxClass } = inject(MultiSelectDIKey)!
|
|
58
56
|
|
|
59
|
-
|
|
57
|
+
const rippleRef = shallowRef<Ripple | null>(null)
|
|
60
58
|
|
|
61
59
|
function handleClick(e) {
|
|
62
|
-
if (disabled) return
|
|
63
|
-
emit('check', !checked)
|
|
60
|
+
if (props.disabled) return
|
|
61
|
+
emit('check', !props.checked)
|
|
64
62
|
}
|
|
65
63
|
|
|
66
64
|
function handleMousedown(e: MouseEvent) {
|
|
67
|
-
if (disabled) return
|
|
65
|
+
if (props.disabled) return
|
|
66
|
+
|
|
67
|
+
// 清理旧实例,避免同一元素上多个 Ripple 实例同时修改样式
|
|
68
|
+
if (rippleRef.value) {
|
|
69
|
+
rippleRef.value.remove()
|
|
70
|
+
rippleRef.value = null
|
|
71
|
+
}
|
|
68
72
|
|
|
69
|
-
|
|
73
|
+
rippleRef.value = new Ripple(e.currentTarget as HTMLElement, {
|
|
70
74
|
rippleClass
|
|
71
75
|
})
|
|
72
76
|
|
|
73
|
-
|
|
77
|
+
rippleRef.value.showByEvent(e)
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
function handleMouseleave() {
|
|
77
|
-
|
|
81
|
+
rippleRef.value?.remove()
|
|
82
|
+
rippleRef.value = null
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
function handleMouseup() {
|
|
81
|
-
|
|
86
|
+
rippleRef.value?.remove()
|
|
87
|
+
rippleRef.value = null
|
|
82
88
|
}
|
|
83
89
|
|
|
84
90
|
onBeforeUnmount(() => {
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
rippleRef.value?.remove()
|
|
92
|
+
rippleRef.value = null
|
|
87
93
|
})
|
|
88
94
|
</script>
|
|
@@ -17,8 +17,8 @@ $root-name: table;
|
|
|
17
17
|
width: 100%;
|
|
18
18
|
position: relative;
|
|
19
19
|
border: 1px solid var(--u-table-border-color);
|
|
20
|
-
border-bottom: none;
|
|
21
20
|
overflow: hidden;
|
|
21
|
+
background-color: fn.use-var(bg-color, top);
|
|
22
22
|
|
|
23
23
|
@include m.size using ($size) {
|
|
24
24
|
border-radius: fn.use-var(radius, $size);
|
|
@@ -171,6 +171,14 @@ $root-name: table;
|
|
|
171
171
|
|
|
172
172
|
@include m.e(body) {
|
|
173
173
|
will-change: transform;
|
|
174
|
+
|
|
175
|
+
@include m.bem($root-name, row) {
|
|
176
|
+
&:last-child {
|
|
177
|
+
@include m.bem($root-name, cell) {
|
|
178
|
+
border-bottom: none;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
174
182
|
}
|
|
175
183
|
|
|
176
184
|
@include m.e(empty) {
|
|
@@ -151,9 +151,7 @@ const columnConfig = useColumns({
|
|
|
151
151
|
|
|
152
152
|
const { leafColumns } = columnConfig
|
|
153
153
|
|
|
154
|
-
const { handleScroll, leftFixed, rightFixed } = useFixedColumns(
|
|
155
|
-
isScrolling: isScrollingRelay
|
|
156
|
-
})
|
|
154
|
+
const { handleScroll, leftFixed, rightFixed } = useFixedColumns()
|
|
157
155
|
|
|
158
156
|
const {
|
|
159
157
|
getColumnSlotsNode,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { debounce } from '@cat-kit/core'
|
|
2
|
-
import { type ShallowRef,
|
|
2
|
+
import { type ShallowRef, ref } from 'vue'
|
|
3
3
|
|
|
4
4
|
import type { ScrollPosition } from '../../types'
|
|
5
5
|
|
|
@@ -9,62 +9,18 @@ interface UseColumnFixedReturned {
|
|
|
9
9
|
handleScroll: (e: Required<ScrollPosition>) => void
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* D1:滚动中 (`true`) 暂缓 `leftFixed` / `rightFixed` 的切换,滚动结束后
|
|
15
|
-
* 一次性补算。
|
|
16
|
-
*
|
|
17
|
-
* 背景:固定列的阴影是通过在 cell 上切换 `is-last-fixed` / `is-first-fixed`
|
|
18
|
-
* 等 class 实现的,这些 class 会穿透到 `useTable.getCellClass` 的缓存键,
|
|
19
|
-
* 任何一次切换都会让全表的单元格类名失效重算。滚动本身并不需要实时更新阴影,
|
|
20
|
-
* 因此把切换推迟到 `isScrolling` 归零时做一次即可。
|
|
21
|
-
*
|
|
22
|
-
* 未传入时退化到旧行为(实时切换)。
|
|
23
|
-
*/
|
|
24
|
-
isScrolling?: Ref<boolean>
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* 固定列
|
|
29
|
-
* @returns
|
|
30
|
-
*/
|
|
31
|
-
export function useFixedColumns(options: Options = {}): UseColumnFixedReturned {
|
|
32
|
-
const { isScrolling } = options
|
|
33
|
-
|
|
12
|
+
export function useFixedColumns(): UseColumnFixedReturned {
|
|
34
13
|
const leftFixed = ref(false)
|
|
35
14
|
const rightFixed = ref(false)
|
|
36
15
|
|
|
37
|
-
let pendingLeft: boolean | null = null
|
|
38
|
-
let pendingRight: boolean | null = null
|
|
39
|
-
|
|
40
|
-
const applyImmediate = (nextLeft: boolean, nextRight: boolean): void => {
|
|
41
|
-
if (nextLeft !== leftFixed.value) leftFixed.value = nextLeft
|
|
42
|
-
if (nextRight !== rightFixed.value) rightFixed.value = nextRight
|
|
43
|
-
pendingLeft = null
|
|
44
|
-
pendingRight = null
|
|
45
|
-
}
|
|
46
|
-
|
|
47
16
|
const handleScroll = debounce((e: Required<ScrollPosition>) => {
|
|
48
17
|
const nextLeft = e.x > 0
|
|
49
18
|
// 精度修正:浏览器滚动条最后 1px 的误差
|
|
50
19
|
const nextRight = !(e.cw + e.x + 1 >= e.sw)
|
|
51
20
|
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
applyImmediate(nextLeft, nextRight)
|
|
59
|
-
}, 50)
|
|
60
|
-
|
|
61
|
-
if (isScrolling) {
|
|
62
|
-
watch(isScrolling, (v) => {
|
|
63
|
-
if (v) return
|
|
64
|
-
if (pendingLeft === null && pendingRight === null) return
|
|
65
|
-
applyImmediate(pendingLeft ?? leftFixed.value, pendingRight ?? rightFixed.value)
|
|
66
|
-
})
|
|
67
|
-
}
|
|
21
|
+
if (nextLeft !== leftFixed.value) leftFixed.value = nextLeft
|
|
22
|
+
if (nextRight !== rightFixed.value) rightFixed.value = nextRight
|
|
23
|
+
}, 100)
|
|
68
24
|
|
|
69
25
|
return { leftFixed, rightFixed, handleScroll }
|
|
70
26
|
}
|
package/src/types/action.ts
CHANGED
|
@@ -30,17 +30,6 @@ export interface ActionGroupProps {
|
|
|
30
30
|
*/
|
|
31
31
|
max?: number
|
|
32
32
|
|
|
33
|
-
/**
|
|
34
|
-
* 紧凑悬浮模式
|
|
35
|
-
*
|
|
36
|
-
* @description
|
|
37
|
-
* - 默认半透明,悬浮在父容器上方时完全显现
|
|
38
|
-
* - 提供圆角胶囊容器与磨砂背景,更适合表格行内操作栏
|
|
39
|
-
* - "更多"按钮也会切换为图标态以与其他操作按钮保持一致
|
|
40
|
-
* @default false
|
|
41
|
-
*/
|
|
42
|
-
hover?: boolean
|
|
43
|
-
|
|
44
33
|
/**
|
|
45
34
|
* 子项默认尺寸
|
|
46
35
|
* @default 'small'
|
|
@@ -68,5 +57,11 @@ export interface ActionEmits {
|
|
|
68
57
|
/** 操作组件暴露的属性和方法(组件内部使用) */
|
|
69
58
|
export interface _ActionExposed {}
|
|
70
59
|
|
|
60
|
+
export interface _ActionGroupExposed {
|
|
61
|
+
closeTip: () => void
|
|
62
|
+
}
|
|
63
|
+
|
|
71
64
|
/** 操作组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
72
65
|
export type ActionExposed = DeconstructValue<_ActionExposed>
|
|
66
|
+
|
|
67
|
+
export type ActionGroupExposed = DeconstructValue<_ActionGroupExposed>
|
|
@@ -1,17 +1,49 @@
|
|
|
1
|
-
import type { DeconstructValue } from '@veltra/utils'
|
|
1
|
+
import type { ComponentSize, DeconstructValue } from '@veltra/utils'
|
|
2
|
+
|
|
3
|
+
import type { VariableItem } from './expression-editor'
|
|
4
|
+
|
|
5
|
+
export interface ConditionField {
|
|
6
|
+
label: string
|
|
7
|
+
value: string
|
|
8
|
+
type: 'string' | 'number' | 'boolean' | 'date' | 'enum'
|
|
9
|
+
enumOptions?: { label: string; value: string }[]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type ConditionValue =
|
|
13
|
+
| { kind: 'constant'; value: string }
|
|
14
|
+
| { kind: 'variable'; name: string }
|
|
15
|
+
|
|
16
|
+
export interface ConditionItem {
|
|
17
|
+
field: string
|
|
18
|
+
operator: string
|
|
19
|
+
value: ConditionValue
|
|
20
|
+
_result?: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ConditionGroup {
|
|
24
|
+
logic: 'and' | 'or'
|
|
25
|
+
conditions: ConditionItem[]
|
|
26
|
+
groups: ConditionGroup[]
|
|
27
|
+
_result?: boolean
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type ConditionExpression = ConditionGroup
|
|
2
31
|
|
|
3
|
-
/** 条件编辑器组件属性 */
|
|
4
32
|
export interface ConditionEditorProps {
|
|
5
|
-
modelValue?:
|
|
33
|
+
modelValue?: ConditionExpression
|
|
34
|
+
fields?: ConditionField[]
|
|
35
|
+
variables?: VariableItem[]
|
|
36
|
+
data?: Record<string, unknown>
|
|
37
|
+
size?: ComponentSize
|
|
38
|
+
disabled?: boolean
|
|
39
|
+
readonly?: boolean
|
|
6
40
|
}
|
|
7
41
|
|
|
8
|
-
/** 条件编辑器组件定义的事件 */
|
|
9
42
|
export interface ConditionEditorEmits {
|
|
10
|
-
(e: 'update:modelValue', value:
|
|
43
|
+
(e: 'update:modelValue', value: ConditionExpression): void
|
|
44
|
+
(e: 'evaluate', results: ConditionExpression): void
|
|
11
45
|
}
|
|
12
46
|
|
|
13
|
-
/** 条件编辑器组件暴露的属性和方法(组件内部使用) */
|
|
14
47
|
export interface _ConditionEditorExposed {}
|
|
15
48
|
|
|
16
|
-
/** 条件编辑器组件暴露的属性和方法(组件外部使用, 引用的值会被自动解构) */
|
|
17
49
|
export type ConditionEditorExposed = DeconstructValue<_ConditionEditorExposed>
|