File tree Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Expand file tree Collapse file tree 2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change 25
25
</template >
26
26
<div class =" table-toolbar-inner" >
27
27
<n-checkbox-group v-model:value =" checkList" @update:value =" onChange" >
28
- <Draggable v-model =" columnsList" animation =" 300" item-key =" key" @end =" draggableEnd" >
28
+ <Draggable
29
+ v-model =" columnsList"
30
+ animation =" 300"
31
+ item-key =" key"
32
+ filter =" .no-draggable"
33
+ :move =" onMove"
34
+ @end =" draggableEnd"
35
+ >
29
36
<template #item =" { element } " >
30
37
<div
31
38
class =" table-toolbar-inner-checkbox"
32
- :class =" { 'table-toolbar-inner-checkbox-dark': getDarkTheme === true }"
39
+ :class =" {
40
+ 'table-toolbar-inner-checkbox-dark': getDarkTheme === true,
41
+ 'no-draggable': element.draggable === false,
42
+ }"
33
43
>
34
- <span class =" drag-icon" >
44
+ <span
45
+ class =" drag-icon"
46
+ :class =" { 'drag-icon-hidden': element.draggable === false }"
47
+ >
35
48
<n-icon size =" 18" >
36
49
<DragOutlined />
37
50
</n-icon >
211
224
}
212
225
}
213
226
227
+ function onMove(e ) {
228
+ if (e .draggedContext .element .draggable === false ) return false ;
229
+ return true ;
230
+ }
231
+
214
232
// 固定
215
233
function fixedColumn(item , fixed ) {
216
234
if (! state .checkList .includes (item .key )) return ;
232
250
onChange ,
233
251
onCheckAll ,
234
252
onSelection ,
253
+ onMove ,
235
254
resetColumns ,
236
255
fixedColumn ,
237
256
draggableEnd ,
275
294
display : inline-flex ;
276
295
margin-right : 8px ;
277
296
cursor : move ;
297
+ &-hidden {
298
+ visibility : hidden ;
299
+ cursor : default ;
300
+ }
278
301
}
279
302
280
303
.fixed-item {
Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ export interface BasicColumn extends TableBaseColumn {
14
14
auth ?: string [ ] ;
15
15
// 业务控制是否显示
16
16
ifShow ?: boolean | ( ( column : BasicColumn ) => boolean ) ;
17
+ // 控制是否支持拖拽,默认支持
18
+ draggable ?: boolean ;
17
19
}
18
20
19
21
export interface TableActionType {
You can’t perform that action at this time.
0 commit comments