vxe-table 3.11.27-beta.0 → 3.11.27
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/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/locale/lang/ar-EG.js +1 -1
- package/es/locale/lang/de-DE.js +1 -1
- package/es/locale/lang/en-US.js +1 -1
- package/es/locale/lang/es-ES.js +1 -1
- package/es/locale/lang/fr-FR.js +1 -1
- package/es/locale/lang/hu-HU.js +1 -1
- package/es/locale/lang/hy-AM.js +1 -1
- package/es/locale/lang/ja-JP.js +1 -1
- package/es/locale/lang/ko-KR.js +1 -1
- package/es/locale/lang/nb-NO.js +1 -1
- package/es/locale/lang/pt-BR.js +1 -1
- package/es/locale/lang/ru-RU.js +1 -1
- package/es/locale/lang/ug-CN.js +1 -1
- package/es/locale/lang/uk-UA.js +1 -1
- package/es/locale/lang/vi-VN.js +1 -1
- package/es/locale/lang/zh-CHT.js +1 -1
- package/es/locale/lang/zh-CN.js +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/mixin.js +2 -0
- package/es/table/module/custom/panel.js +436 -231
- package/es/table/src/body.js +1 -1
- package/es/table/src/methods.js +1 -4
- package/es/table/src/table.js +4 -1
- package/es/table/style.css +110 -40
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/dom.js +1 -0
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +110 -40
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +381 -165
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +1 -1
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/de-DE.js +1 -1
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/en-US.js +1 -1
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +1 -1
- package/lib/locale/lang/es-ES.js +1 -1
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +1 -1
- package/lib/locale/lang/fr-FR.js +1 -1
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/hu-HU.js +1 -1
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +1 -1
- package/lib/locale/lang/hy-AM.js +1 -1
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/ja-JP.js +1 -1
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +1 -1
- package/lib/locale/lang/ko-KR.js +1 -1
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +1 -1
- package/lib/locale/lang/nb-NO.js +1 -1
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/pt-BR.js +1 -1
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +1 -1
- package/lib/locale/lang/ru-RU.js +1 -1
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +1 -1
- package/lib/locale/lang/ug-CN.js +1 -1
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/uk-UA.js +1 -1
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +1 -1
- package/lib/locale/lang/vi-VN.js +1 -1
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +1 -1
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +1 -1
- package/lib/locale/lang/zh-CN.js +1 -1
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/custom/mixin.js +2 -0
- package/lib/table/module/custom/mixin.min.js +1 -1
- package/lib/table/module/custom/panel.js +369 -156
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/src/body.js +1 -1
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/methods.js +2 -5
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +4 -1
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +110 -40
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/dom.js +2 -0
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-table/style/style.css +110 -40
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/locale/lang/ar-EG.ts +1 -1
- package/packages/locale/lang/de-DE.ts +1 -1
- package/packages/locale/lang/en-US.ts +1 -1
- package/packages/locale/lang/es-ES.ts +1 -1
- package/packages/locale/lang/fr-FR.ts +1 -1
- package/packages/locale/lang/hu-HU.ts +1 -1
- package/packages/locale/lang/hy-AM.ts +1 -1
- package/packages/locale/lang/ja-JP.ts +1 -1
- package/packages/locale/lang/ko-KR.ts +1 -1
- package/packages/locale/lang/nb-NO.ts +1 -1
- package/packages/locale/lang/pt-BR.ts +1 -1
- package/packages/locale/lang/ru-RU.ts +1 -1
- package/packages/locale/lang/ug-CN.ts +1 -1
- package/packages/locale/lang/uk-UA.ts +1 -1
- package/packages/locale/lang/vi-VN.ts +1 -1
- package/packages/locale/lang/zh-CHT.ts +1 -1
- package/packages/locale/lang/zh-CN.ts +1 -1
- package/packages/table/module/custom/mixin.ts +2 -0
- package/packages/table/module/custom/panel.ts +463 -234
- package/packages/table/src/body.ts +1 -1
- package/packages/table/src/methods.ts +1 -5
- package/packages/table/src/table.ts +4 -1
- package/packages/ui/src/dom.ts +2 -0
- package/styles/components/table-module/custom.scss +95 -13
- package/styles/components/table.scss +6 -2
- /package/es/{iconfont.1733931178504.ttf → iconfont.1734055169729.ttf} +0 -0
- /package/es/{iconfont.1733931178504.woff → iconfont.1734055169729.woff} +0 -0
- /package/es/{iconfont.1733931178504.woff2 → iconfont.1734055169729.woff2} +0 -0
- /package/lib/{iconfont.1733931178504.ttf → iconfont.1734055169729.ttf} +0 -0
- /package/lib/{iconfont.1733931178504.woff → iconfont.1734055169729.woff} +0 -0
- /package/lib/{iconfont.1733931178504.woff2 → iconfont.1734055169729.woff2} +0 -0
|
@@ -1,30 +1,94 @@
|
|
|
1
1
|
import { CreateElement, VNode } from 'vue'
|
|
2
2
|
import { VxeUI } from '../../../ui'
|
|
3
3
|
import { formatText } from '../../../ui/src/utils'
|
|
4
|
-
import { addClass, removeClass } from '../../../ui/src/dom'
|
|
4
|
+
import { tpImg, addClass, removeClass } from '../../../ui/src/dom'
|
|
5
5
|
import { errLog } from '../../../ui/src/log'
|
|
6
6
|
import XEUtils from 'xe-utils'
|
|
7
7
|
|
|
8
|
-
import type {
|
|
8
|
+
import type { VxeTableDefines } from '../../../../types'
|
|
9
|
+
import type { VxeModalComponent, VxeDrawerComponent, VxeButtonComponent, VxeRadioGroupComponent, VxeInputComponent } from 'vxe-pc-ui'
|
|
9
10
|
|
|
10
11
|
const { getI18n, getIcon, renderEmptyElement } = VxeUI
|
|
11
12
|
|
|
12
|
-
function
|
|
13
|
-
const {
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
13
|
+
function showDropTip (_vm: any, evnt: DragEvent | MouseEvent, optEl: HTMLElement | null, showLine: boolean, dragPos: string) {
|
|
14
|
+
const { prevDragToChild } = _vm
|
|
15
|
+
|
|
16
|
+
const el = _vm.$refs.bodyElemRef as HTMLDivElement
|
|
17
|
+
if (!el) {
|
|
17
18
|
return
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
const wrapperRect = el.getBoundingClientRect()
|
|
21
|
+
if (optEl) {
|
|
22
|
+
const dragLineEl = _vm.$refs.refDragLineElem as HTMLDivElement
|
|
23
|
+
if (dragLineEl) {
|
|
24
|
+
if (showLine) {
|
|
25
|
+
const optRect = optEl.getBoundingClientRect()
|
|
26
|
+
dragLineEl.style.display = 'block'
|
|
27
|
+
dragLineEl.style.top = `${Math.max(1, optRect.y - wrapperRect.y)}px`
|
|
28
|
+
dragLineEl.style.height = `${optRect.height}px`
|
|
29
|
+
dragLineEl.style.width = `${optRect.width}px`
|
|
30
|
+
dragLineEl.setAttribute('drag-pos', dragPos)
|
|
31
|
+
dragLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n')
|
|
32
|
+
} else {
|
|
33
|
+
dragLineEl.style.display = ''
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const dragTipEl = _vm.$refs.refDragTipElem as HTMLDivElement
|
|
38
|
+
if (dragTipEl) {
|
|
39
|
+
dragTipEl.style.display = 'block'
|
|
40
|
+
dragTipEl.style.top = `${Math.min(el.clientHeight - el.scrollTop - dragTipEl.clientHeight, evnt.clientY - wrapperRect.y)}px`
|
|
41
|
+
dragTipEl.style.left = `${Math.min(el.clientWidth - el.scrollLeft - dragTipEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`
|
|
42
|
+
dragTipEl.setAttribute('drag-status', showLine ? (prevDragToChild ? 'sub' : 'normal') : 'disabled')
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function hideDropTip (_vm: any) {
|
|
47
|
+
const dragTipEl = _vm.$refs.refDragTipElem as HTMLDivElement
|
|
48
|
+
const dragLineEl = _vm.$refs.refDragLineElem as HTMLDivElement
|
|
49
|
+
if (dragTipEl) {
|
|
50
|
+
dragTipEl.style.display = ''
|
|
51
|
+
}
|
|
52
|
+
if (dragLineEl) {
|
|
53
|
+
dragLineEl.style.display = ''
|
|
25
54
|
}
|
|
26
55
|
}
|
|
27
56
|
|
|
57
|
+
const renderDragTip = (h: CreateElement, _vm: any) => {
|
|
58
|
+
const { dragCol } = _vm
|
|
59
|
+
return h('div', {}, [
|
|
60
|
+
h('div', {
|
|
61
|
+
ref: 'refDragLineElem',
|
|
62
|
+
class: 'vxe-table-custom-popup--drag-line'
|
|
63
|
+
}),
|
|
64
|
+
h('div', {
|
|
65
|
+
ref: 'refDragTipElem',
|
|
66
|
+
class: 'vxe-table-custom-popup--drag-tip'
|
|
67
|
+
}, [
|
|
68
|
+
h('div', {
|
|
69
|
+
class: 'vxe-table-custom-popup--drag-tip-wrapper'
|
|
70
|
+
}, [
|
|
71
|
+
h('div', {
|
|
72
|
+
class: 'vxe-table-custom-popup--drag-tip-status'
|
|
73
|
+
}, [
|
|
74
|
+
h('span', {
|
|
75
|
+
class: ['vxe-table-custom-popup--drag-tip-normal-status', getIcon().TABLE_DRAG_STATUS_ROW]
|
|
76
|
+
}),
|
|
77
|
+
h('span', {
|
|
78
|
+
class: ['vxe-table-custom-popup--drag-tip-sub-status', getIcon().TABLE_DRAG_STATUS_SUB_ROW]
|
|
79
|
+
}),
|
|
80
|
+
h('span', {
|
|
81
|
+
class: ['vxe-table-custom-popup--drag-tip-disabled-status', getIcon().TABLE_DRAG_DISABLED]
|
|
82
|
+
})
|
|
83
|
+
]),
|
|
84
|
+
h('div', {
|
|
85
|
+
class: 'vxe-table--drag-tip-content'
|
|
86
|
+
}, getI18n('vxe.custom.cstmDragTarget', [dragCol && dragCol.type !== 'html' ? dragCol.getTitle() : '']))
|
|
87
|
+
])
|
|
88
|
+
])
|
|
89
|
+
])
|
|
90
|
+
}
|
|
91
|
+
|
|
28
92
|
const renderSimplePanel = (h: CreateElement, _vm: any) => {
|
|
29
93
|
const VxeUIButtonComponent = VxeUI.getComponent<VxeButtonComponent>('VxeButton')
|
|
30
94
|
|
|
@@ -36,9 +100,12 @@ const renderSimplePanel = (h: CreateElement, _vm: any) => {
|
|
|
36
100
|
const { customStore } = props
|
|
37
101
|
const { isCustomStatus, customColumnList } = reactData
|
|
38
102
|
const customOpts = $xeTable.computeCustomOpts
|
|
103
|
+
const { immediate } = customOpts
|
|
104
|
+
const columnDragOpts = $xeTable.computeColumnDragOpts
|
|
39
105
|
const { maxHeight } = customStore
|
|
40
106
|
const { checkMethod, visibleMethod, allowVisible, allowSort, allowFixed, trigger, placement } = customOpts
|
|
41
107
|
const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn
|
|
108
|
+
const { isCrossDrag } = columnDragOpts
|
|
42
109
|
const slots = customOpts.slots || {}
|
|
43
110
|
const headerSlot = slots.header
|
|
44
111
|
const topSlot = slots.top
|
|
@@ -49,7 +116,6 @@ const renderSimplePanel = (h: CreateElement, _vm: any) => {
|
|
|
49
116
|
const customWrapperOns: any = {}
|
|
50
117
|
const isAllChecked = customStore.isAll
|
|
51
118
|
const isAllIndeterminate = customStore.isIndeterminate
|
|
52
|
-
const dragColumn = _vm.dragColumn
|
|
53
119
|
// hover 触发
|
|
54
120
|
if (trigger === 'hover') {
|
|
55
121
|
customWrapperOns.mouseenter = _vm.handleWrapperMouseenterEvent
|
|
@@ -111,45 +177,49 @@ const renderSimplePanel = (h: CreateElement, _vm: any) => {
|
|
|
111
177
|
})
|
|
112
178
|
])
|
|
113
179
|
: renderEmptyElement($xeTable),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
h('
|
|
119
|
-
class:
|
|
120
|
-
'is--disabled': isDisabled || isHidden
|
|
121
|
-
}],
|
|
122
|
-
attrs: {
|
|
123
|
-
title: getI18n('vxe.custom.setting.sortHelpTip')
|
|
124
|
-
},
|
|
125
|
-
on: isDisabled || isHidden
|
|
126
|
-
? {}
|
|
127
|
-
: {
|
|
128
|
-
mousedown: _vm.sortMousedownEvent,
|
|
129
|
-
mouseup: _vm.sortMouseupEvent
|
|
130
|
-
}
|
|
180
|
+
h('div', {
|
|
181
|
+
class: 'vxe-table-custom--name-option'
|
|
182
|
+
}, [
|
|
183
|
+
allowSort && ((isCrossDrag ? immediate : false) || column.level === 1)
|
|
184
|
+
? h('div', {
|
|
185
|
+
class: 'vxe-table-custom--sort-option'
|
|
131
186
|
}, [
|
|
132
|
-
h('
|
|
133
|
-
class:
|
|
134
|
-
|
|
187
|
+
h('span', {
|
|
188
|
+
class: ['vxe-table-custom--sort-btn', {
|
|
189
|
+
'is--disabled': isDisabled || isHidden || column.renderFixed
|
|
190
|
+
}],
|
|
191
|
+
attrs: {
|
|
192
|
+
title: getI18n('vxe.custom.setting.sortHelpTip')
|
|
193
|
+
},
|
|
194
|
+
on: isDisabled || isHidden || column.renderFixed
|
|
195
|
+
? {}
|
|
196
|
+
: {
|
|
197
|
+
mousedown: _vm.sortMousedownEvent,
|
|
198
|
+
mouseup: _vm.sortMouseupEvent
|
|
199
|
+
}
|
|
200
|
+
}, [
|
|
201
|
+
h('i', {
|
|
202
|
+
class: getIcon().TABLE_CUSTOM_SORT
|
|
203
|
+
})
|
|
204
|
+
])
|
|
135
205
|
])
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
|
|
206
|
+
: renderEmptyElement($xeTable),
|
|
207
|
+
column.type === 'html'
|
|
208
|
+
? h('div', {
|
|
209
|
+
key: '1',
|
|
210
|
+
class: 'vxe-table-custom--checkbox-label',
|
|
211
|
+
domProps: {
|
|
212
|
+
innerHTML: colTitle
|
|
213
|
+
}
|
|
214
|
+
})
|
|
215
|
+
: h('div', {
|
|
216
|
+
key: '0',
|
|
217
|
+
class: 'vxe-table-custom--checkbox-label',
|
|
218
|
+
attrs: {
|
|
219
|
+
title: colTitle
|
|
220
|
+
}
|
|
221
|
+
}, colTitle)
|
|
222
|
+
]),
|
|
153
223
|
!parent && allowFixed
|
|
154
224
|
? h('div', {
|
|
155
225
|
class: 'vxe-table-custom--fixed-option'
|
|
@@ -263,10 +333,7 @@ const renderSimplePanel = (h: CreateElement, _vm: any) => {
|
|
|
263
333
|
class: 'vxe-table-custom--panel-bottom'
|
|
264
334
|
}, $xeTable.callSlot(bottomSlot, params, h))
|
|
265
335
|
: renderEmptyElement($xeTable),
|
|
266
|
-
h
|
|
267
|
-
ref: 'dragHintElemRef',
|
|
268
|
-
class: 'vxe-table-custom-popup--drag-hint'
|
|
269
|
-
}, getI18n('vxe.custom.cstmDragTarget', [dragColumn && dragColumn.type !== 'html' ? dragColumn.getTitle() : '']))
|
|
336
|
+
renderDragTip(h, _vm)
|
|
270
337
|
]),
|
|
271
338
|
customOpts.showFooter
|
|
272
339
|
? h('div', {
|
|
@@ -287,7 +354,7 @@ const renderSimplePanel = (h: CreateElement, _vm: any) => {
|
|
|
287
354
|
click: _vm.resetCustomEvent
|
|
288
355
|
}
|
|
289
356
|
}),
|
|
290
|
-
|
|
357
|
+
immediate
|
|
291
358
|
? h(VxeUIButtonComponent, {
|
|
292
359
|
props: {
|
|
293
360
|
mode: 'text',
|
|
@@ -306,7 +373,7 @@ const renderSimplePanel = (h: CreateElement, _vm: any) => {
|
|
|
306
373
|
click: _vm.cancelCustomEvent
|
|
307
374
|
}
|
|
308
375
|
}),
|
|
309
|
-
|
|
376
|
+
immediate
|
|
310
377
|
? renderEmptyElement($xeTable)
|
|
311
378
|
: h(VxeUIButtonComponent, {
|
|
312
379
|
props: {
|
|
@@ -330,7 +397,6 @@ const renderPopupPanel = (h: CreateElement, _vm: any) => {
|
|
|
330
397
|
const VxeUIDrawerComponent = VxeUI.getComponent<VxeDrawerComponent>('VxeDrawer')
|
|
331
398
|
const VxeUIButtonComponent = VxeUI.getComponent<VxeButtonComponent>('VxeButton')
|
|
332
399
|
const VxeUINumberInputComponent = VxeUI.getComponent<VxeInputComponent>('VxeInput')
|
|
333
|
-
const VxeUITooltipComponent = VxeUI.getComponent<VxeTooltipComponent>('VxeTooltip')
|
|
334
400
|
const $xeTableCustomPanel = _vm
|
|
335
401
|
|
|
336
402
|
const props = _vm
|
|
@@ -343,6 +409,8 @@ const renderPopupPanel = (h: CreateElement, _vm: any) => {
|
|
|
343
409
|
const { resizable: allResizable } = tableProps
|
|
344
410
|
const { isCustomStatus, customColumnList } = reactData
|
|
345
411
|
const customOpts = $xeTable.computeCustomOpts
|
|
412
|
+
const { immediate } = customOpts
|
|
413
|
+
const columnDragOpts = $xeTable.computeColumnDragOpts
|
|
346
414
|
const { mode, modalOptions, drawerOptions, allowVisible, allowSort, allowFixed, allowResizable, checkMethod, visibleMethod } = customOpts
|
|
347
415
|
const columnOpts = $xeTable.computeColumnOpts
|
|
348
416
|
const { maxFixedSize } = columnOpts
|
|
@@ -351,6 +419,7 @@ const renderPopupPanel = (h: CreateElement, _vm: any) => {
|
|
|
351
419
|
const modalOpts = Object.assign({}, modalOptions)
|
|
352
420
|
const drawerOpts = Object.assign({}, drawerOptions)
|
|
353
421
|
const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn
|
|
422
|
+
const { isCrossDrag } = columnDragOpts
|
|
354
423
|
const slots = customOpts.slots || {}
|
|
355
424
|
const headerSlot = slots.header
|
|
356
425
|
const topSlot = slots.top
|
|
@@ -360,7 +429,6 @@ const renderPopupPanel = (h: CreateElement, _vm: any) => {
|
|
|
360
429
|
const trVNs: VNode[] = []
|
|
361
430
|
const isAllChecked = customStore.isAll
|
|
362
431
|
const isAllIndeterminate = customStore.isIndeterminate
|
|
363
|
-
const dragColumn = _vm.dragColumn
|
|
364
432
|
const params = {
|
|
365
433
|
$table: $xeTable,
|
|
366
434
|
$grid: $xeTable.xegrid,
|
|
@@ -439,50 +507,52 @@ const renderPopupPanel = (h: CreateElement, _vm: any) => {
|
|
|
439
507
|
])
|
|
440
508
|
])
|
|
441
509
|
: renderEmptyElement($xeTable),
|
|
442
|
-
allowSort
|
|
443
|
-
? h('td', {
|
|
444
|
-
class: 'vxe-table-custom-popup--column-item col--sort'
|
|
445
|
-
}, [
|
|
446
|
-
column.level === 1
|
|
447
|
-
? h('span', {
|
|
448
|
-
class: ['vxe-table-custom-popup--column-sort-btn', {
|
|
449
|
-
'is--disabled': isDisabled || isHidden
|
|
450
|
-
}],
|
|
451
|
-
attrs: {
|
|
452
|
-
title: getI18n('vxe.custom.setting.sortHelpTip')
|
|
453
|
-
},
|
|
454
|
-
on: isDisabled || isHidden
|
|
455
|
-
? {}
|
|
456
|
-
: {
|
|
457
|
-
mousedown: _vm.sortMousedownEvent,
|
|
458
|
-
mouseup: _vm.sortMouseupEvent
|
|
459
|
-
}
|
|
460
|
-
}, [
|
|
461
|
-
h('i', {
|
|
462
|
-
class: getIcon().TABLE_CUSTOM_SORT
|
|
463
|
-
})
|
|
464
|
-
])
|
|
465
|
-
: h('span', '-')
|
|
466
|
-
])
|
|
467
|
-
: renderEmptyElement($xeTable),
|
|
468
510
|
h('td', {
|
|
469
511
|
class: 'vxe-table-custom-popup--column-item col--name'
|
|
470
512
|
}, [
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
513
|
+
h('div', {
|
|
514
|
+
class: 'vxe-table-custom-popup--name'
|
|
515
|
+
}, [
|
|
516
|
+
allowSort
|
|
517
|
+
? ((isCrossDrag ? immediate : false) || column.level === 1
|
|
518
|
+
? h('div', {
|
|
519
|
+
class: ['vxe-table-custom-popup--column-sort-btn', {
|
|
520
|
+
'is--disabled': isDisabled || isHidden || column.renderFixed
|
|
521
|
+
}],
|
|
522
|
+
attrs: {
|
|
523
|
+
title: getI18n('vxe.custom.setting.sortHelpTip')
|
|
524
|
+
},
|
|
525
|
+
on: (isDisabled || isHidden || column.renderFixed
|
|
526
|
+
? {}
|
|
527
|
+
: {
|
|
528
|
+
mousedown: _vm.sortMousedownEvent,
|
|
529
|
+
mouseup: _vm.sortMouseupEvent
|
|
530
|
+
})
|
|
531
|
+
}, [
|
|
532
|
+
h('i', {
|
|
533
|
+
class: getIcon().TABLE_CUSTOM_SORT
|
|
534
|
+
})
|
|
535
|
+
])
|
|
536
|
+
: h('div', {
|
|
537
|
+
class: 'vxe-table-custom-popup--column-sort-placeholder'
|
|
538
|
+
}))
|
|
539
|
+
: renderEmptyElement($xeTable),
|
|
540
|
+
column.type === 'html'
|
|
541
|
+
? h('div', {
|
|
542
|
+
key: '1',
|
|
543
|
+
class: 'vxe-table-custom-popup--title',
|
|
544
|
+
domProps: {
|
|
545
|
+
innerHTML: colTitle
|
|
546
|
+
}
|
|
547
|
+
})
|
|
548
|
+
: h('div', {
|
|
549
|
+
key: '0',
|
|
550
|
+
class: 'vxe-table-custom-popup--title',
|
|
551
|
+
attrs: {
|
|
552
|
+
title: colTitle
|
|
553
|
+
}
|
|
554
|
+
}, colTitle)
|
|
555
|
+
])
|
|
486
556
|
]),
|
|
487
557
|
allowResizable
|
|
488
558
|
? h('td', {
|
|
@@ -497,6 +567,7 @@ const renderPopupPanel = (h: CreateElement, _vm: any) => {
|
|
|
497
567
|
? h(VxeUINumberInputComponent, {
|
|
498
568
|
props: {
|
|
499
569
|
type: 'integer',
|
|
570
|
+
immediate: false,
|
|
500
571
|
disabled: isDisabled || isHidden,
|
|
501
572
|
value: column.renderResizeWidth,
|
|
502
573
|
min: customMinWidth || undefined,
|
|
@@ -505,6 +576,9 @@ const renderPopupPanel = (h: CreateElement, _vm: any) => {
|
|
|
505
576
|
on: {
|
|
506
577
|
modelValue (value: any) {
|
|
507
578
|
column.renderResizeWidth = Math.max(0, Number(value))
|
|
579
|
+
},
|
|
580
|
+
change () {
|
|
581
|
+
_vm.changeColumnWidth(column)
|
|
508
582
|
}
|
|
509
583
|
}
|
|
510
584
|
})
|
|
@@ -532,7 +606,7 @@ const renderPopupPanel = (h: CreateElement, _vm: any) => {
|
|
|
532
606
|
},
|
|
533
607
|
on: {
|
|
534
608
|
input (value: any) {
|
|
535
|
-
column
|
|
609
|
+
_vm.changeFixedOption(column, value)
|
|
536
610
|
}
|
|
537
611
|
}
|
|
538
612
|
})
|
|
@@ -566,11 +640,6 @@ const renderPopupPanel = (h: CreateElement, _vm: any) => {
|
|
|
566
640
|
class: 'vxe-table-custom-popup--table-col-seq'
|
|
567
641
|
})
|
|
568
642
|
: renderEmptyElement($xeTable),
|
|
569
|
-
allowSort
|
|
570
|
-
? h('col', {
|
|
571
|
-
class: 'vxe-table-custom-popup--table-col-sort'
|
|
572
|
-
})
|
|
573
|
-
: renderEmptyElement($xeTable),
|
|
574
643
|
h('col', {
|
|
575
644
|
class: 'vxe-table-custom-popup--table-col-title'
|
|
576
645
|
}),
|
|
@@ -611,29 +680,6 @@ const renderPopupPanel = (h: CreateElement, _vm: any) => {
|
|
|
611
680
|
])
|
|
612
681
|
])
|
|
613
682
|
: renderEmptyElement($xeTable),
|
|
614
|
-
allowSort
|
|
615
|
-
? h('th', {}, [
|
|
616
|
-
h('span', {
|
|
617
|
-
class: 'vxe-table-custom-popup--table-sort-help-title'
|
|
618
|
-
}, getI18n('vxe.custom.setting.colSort')),
|
|
619
|
-
VxeUITooltipComponent
|
|
620
|
-
? h(VxeUITooltipComponent, {
|
|
621
|
-
props: {
|
|
622
|
-
enterable: true,
|
|
623
|
-
content: getI18n('vxe.custom.setting.sortHelpTip'),
|
|
624
|
-
popupClassName: 'vxe-table--ignore-clear'
|
|
625
|
-
},
|
|
626
|
-
scopedSlots: {
|
|
627
|
-
default: () => {
|
|
628
|
-
return h('i', {
|
|
629
|
-
class: 'vxe-table-custom-popup--table-sort-help-icon vxe-icon-question-circle-fill'
|
|
630
|
-
})
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
})
|
|
634
|
-
: renderEmptyElement($xeTableCustomPanel)
|
|
635
|
-
])
|
|
636
|
-
: renderEmptyElement($xeTable),
|
|
637
683
|
h('th', {}, getI18n('vxe.custom.setting.colTitle')),
|
|
638
684
|
allowResizable
|
|
639
685
|
? h('th', {}, getI18n('vxe.custom.setting.colResizable'))
|
|
@@ -657,10 +703,7 @@ const renderPopupPanel = (h: CreateElement, _vm: any) => {
|
|
|
657
703
|
class: 'vxe-table-custom-popup--table-bottom'
|
|
658
704
|
}, $xeTable.callSlot(bottomSlot, params, h))
|
|
659
705
|
: renderEmptyElement($xeTable),
|
|
660
|
-
h
|
|
661
|
-
ref: 'dragHintElemRef',
|
|
662
|
-
class: 'vxe-table-custom-popup--drag-hint'
|
|
663
|
-
}, getI18n('vxe.custom.cstmDragTarget', [dragColumn ? dragColumn.getTitle() : '']))
|
|
706
|
+
renderDragTip(h, _vm)
|
|
664
707
|
])
|
|
665
708
|
},
|
|
666
709
|
footer: () => {
|
|
@@ -679,23 +722,34 @@ const renderPopupPanel = (h: CreateElement, _vm: any) => {
|
|
|
679
722
|
click: _vm.resetCustomEvent
|
|
680
723
|
}
|
|
681
724
|
}),
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
725
|
+
immediate
|
|
726
|
+
? h(VxeUIButtonComponent, {
|
|
727
|
+
props: {
|
|
728
|
+
content: customOpts.resetButtonText || getI18n('vxe.custom.customClose')
|
|
729
|
+
},
|
|
730
|
+
on: {
|
|
731
|
+
click: _vm.cancelCloseEvent
|
|
732
|
+
}
|
|
733
|
+
})
|
|
734
|
+
: h(VxeUIButtonComponent, {
|
|
735
|
+
props: {
|
|
736
|
+
content: customOpts.resetButtonText || getI18n('vxe.custom.cstmCancel')
|
|
737
|
+
},
|
|
738
|
+
on: {
|
|
739
|
+
click: _vm.cancelCustomEvent
|
|
740
|
+
}
|
|
741
|
+
}),
|
|
742
|
+
immediate
|
|
743
|
+
? renderEmptyElement($xeTable)
|
|
744
|
+
: h(VxeUIButtonComponent, {
|
|
745
|
+
props: {
|
|
746
|
+
status: 'primary',
|
|
747
|
+
content: customOpts.confirmButtonText || getI18n('vxe.custom.cstmConfirm')
|
|
748
|
+
},
|
|
749
|
+
on: {
|
|
750
|
+
click: _vm.confirmCustomEvent
|
|
751
|
+
}
|
|
752
|
+
})
|
|
699
753
|
])
|
|
700
754
|
}
|
|
701
755
|
}
|
|
@@ -777,7 +831,9 @@ export default {
|
|
|
777
831
|
},
|
|
778
832
|
data () {
|
|
779
833
|
return {
|
|
780
|
-
|
|
834
|
+
prevDragCol: undefined,
|
|
835
|
+
prevDragToChild: false,
|
|
836
|
+
prevDragPos: null
|
|
781
837
|
}
|
|
782
838
|
},
|
|
783
839
|
computed: {
|
|
@@ -788,7 +844,6 @@ export default {
|
|
|
788
844
|
const VxeUIDrawerComponent = VxeUI.getComponent<VxeDrawerComponent>('VxeDrawer')
|
|
789
845
|
const VxeUIButtonComponent = VxeUI.getComponent<VxeButtonComponent>('VxeButton')
|
|
790
846
|
const VxeUINumberInputComponent = VxeUI.getComponent<VxeInputComponent>('VxeNumberInput')
|
|
791
|
-
const VxeUITooltipComponent = VxeUI.getComponent<VxeTooltipComponent>('VxeTooltip')
|
|
792
847
|
const VxeUIRadioGroupComponent = VxeUI.getComponent<VxeRadioGroupComponent>('VxeRadioGroup')
|
|
793
848
|
|
|
794
849
|
this.$nextTick(() => {
|
|
@@ -807,9 +862,6 @@ export default {
|
|
|
807
862
|
if (!VxeUINumberInputComponent) {
|
|
808
863
|
errLog('vxe.error.reqComp', ['vxe-input'])
|
|
809
864
|
}
|
|
810
|
-
if (!VxeUITooltipComponent) {
|
|
811
|
-
errLog('vxe.error.reqComp', ['vxe-tooltip'])
|
|
812
|
-
}
|
|
813
865
|
if (!VxeUIRadioGroupComponent) {
|
|
814
866
|
errLog('vxe.error.reqComp', ['vxe-radio-group'])
|
|
815
867
|
}
|
|
@@ -844,7 +896,9 @@ export default {
|
|
|
844
896
|
},
|
|
845
897
|
confirmCustomEvent ({ $event }: any) {
|
|
846
898
|
const $xeTable = this.$xeTable
|
|
899
|
+
const reactData = $xeTable
|
|
847
900
|
|
|
901
|
+
reactData.isCustomStatus = true
|
|
848
902
|
$xeTable.saveCustom()
|
|
849
903
|
$xeTable.closeCustom()
|
|
850
904
|
$xeTable.emitCustomEvent('confirm', $event)
|
|
@@ -912,8 +966,10 @@ export default {
|
|
|
912
966
|
}
|
|
913
967
|
},
|
|
914
968
|
changeCheckboxOption (column: any) {
|
|
915
|
-
const
|
|
916
|
-
const
|
|
969
|
+
const $xeTable = this.$xetable
|
|
970
|
+
const reactData = $xeTable
|
|
971
|
+
|
|
972
|
+
const { customOpts } = $xeTable.customOpts
|
|
917
973
|
const isChecked = !column.renderVisible
|
|
918
974
|
if (customOpts.immediate) {
|
|
919
975
|
XEUtils.eachTree([column], (item) => {
|
|
@@ -921,8 +977,9 @@ export default {
|
|
|
921
977
|
item.renderVisible = isChecked
|
|
922
978
|
item.halfVisible = false
|
|
923
979
|
})
|
|
924
|
-
|
|
925
|
-
$
|
|
980
|
+
reactData.isCustomStatus = true
|
|
981
|
+
$xeTable.handleCustom()
|
|
982
|
+
$xeTable.saveCustomStore('update:visible')
|
|
926
983
|
} else {
|
|
927
984
|
XEUtils.eachTree([column], (item) => {
|
|
928
985
|
item.renderVisible = isChecked
|
|
@@ -930,11 +987,29 @@ export default {
|
|
|
930
987
|
})
|
|
931
988
|
}
|
|
932
989
|
this.handleOptionCheck(column)
|
|
933
|
-
$
|
|
990
|
+
$xeTable.checkCustomStatus()
|
|
991
|
+
},
|
|
992
|
+
changeColumnWidth (column: VxeTableDefines.ColumnInfo) {
|
|
993
|
+
const $xeTable = this.$xetable
|
|
994
|
+
const reactData = $xeTable
|
|
995
|
+
|
|
996
|
+
const customOpts = $xeTable.computeCustomOpts
|
|
997
|
+
if (customOpts.immediate) {
|
|
998
|
+
if (column.renderResizeWidth !== column.renderWidth) {
|
|
999
|
+
column.resizeWidth = column.renderResizeWidth
|
|
1000
|
+
column.renderWidth = column.renderResizeWidth
|
|
1001
|
+
reactData.isCustomStatus = true
|
|
1002
|
+
$xeTable.handleCustom()
|
|
1003
|
+
$xeTable.saveCustomStore('update:width')
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
934
1006
|
},
|
|
935
1007
|
changeFixedOption (column: any, colFixed: any) {
|
|
936
|
-
const
|
|
937
|
-
const
|
|
1008
|
+
const $xeTable = this.$xetable
|
|
1009
|
+
const reactData = $xeTable
|
|
1010
|
+
|
|
1011
|
+
const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn
|
|
1012
|
+
const customOpts = $xeTable.computeCustomOpts
|
|
938
1013
|
if (customOpts.immediate) {
|
|
939
1014
|
if (column.renderFixed === colFixed) {
|
|
940
1015
|
XEUtils.eachTree([column], col => {
|
|
@@ -949,8 +1024,9 @@ export default {
|
|
|
949
1024
|
})
|
|
950
1025
|
}
|
|
951
1026
|
}
|
|
952
|
-
|
|
953
|
-
$
|
|
1027
|
+
reactData.isCustomStatus = true
|
|
1028
|
+
$xeTable.handleCustom()
|
|
1029
|
+
$xeTable.saveCustomStore('update:fixed')
|
|
954
1030
|
} else {
|
|
955
1031
|
if (column.renderFixed === colFixed) {
|
|
956
1032
|
XEUtils.eachTree([column], col => {
|
|
@@ -971,103 +1047,256 @@ export default {
|
|
|
971
1047
|
$xetable.toggleCustomAllCheckbox()
|
|
972
1048
|
},
|
|
973
1049
|
sortMousedownEvent (evnt: MouseEvent) {
|
|
974
|
-
const
|
|
1050
|
+
const $xeTable = this.$xetable
|
|
1051
|
+
|
|
975
1052
|
const btnEl = evnt.currentTarget as HTMLElement
|
|
976
|
-
const
|
|
977
|
-
const
|
|
1053
|
+
const cellEl = btnEl.parentElement as HTMLElement
|
|
1054
|
+
const tdEl = cellEl.parentElement as HTMLElement
|
|
1055
|
+
const trEl = tdEl.parentElement as HTMLElement
|
|
978
1056
|
const colid = trEl.getAttribute('colid')
|
|
979
|
-
const column = $
|
|
1057
|
+
const column = $xeTable.getColumnById(colid)
|
|
980
1058
|
trEl.draggable = true
|
|
981
|
-
this.
|
|
1059
|
+
this.dragCol = column
|
|
982
1060
|
addClass(trEl, 'active--drag-origin')
|
|
983
|
-
updateDropHint(this, evnt)
|
|
984
1061
|
},
|
|
985
1062
|
sortMouseupEvent (evnt: MouseEvent) {
|
|
986
1063
|
const btnEl = evnt.currentTarget as HTMLElement
|
|
987
|
-
const
|
|
988
|
-
const
|
|
989
|
-
const
|
|
1064
|
+
const cellEl = btnEl.parentElement as HTMLElement
|
|
1065
|
+
const tdEl = cellEl.parentElement as HTMLElement
|
|
1066
|
+
const trEl = tdEl.parentElement as HTMLElement
|
|
1067
|
+
hideDropTip(this)
|
|
990
1068
|
trEl.draggable = false
|
|
991
|
-
this.
|
|
1069
|
+
this.dragCol = null
|
|
992
1070
|
removeClass(trEl, 'active--drag-origin')
|
|
993
|
-
if (dragHintEl) {
|
|
994
|
-
dragHintEl.style.display = ''
|
|
995
|
-
}
|
|
996
1071
|
},
|
|
997
1072
|
sortDragstartEvent (evnt: any) {
|
|
998
|
-
const img = new Image()
|
|
999
1073
|
if (evnt.dataTransfer) {
|
|
1074
|
+
const img = new Image()
|
|
1075
|
+
img.src = tpImg
|
|
1000
1076
|
evnt.dataTransfer.setDragImage(img, 0, 0)
|
|
1001
1077
|
}
|
|
1002
1078
|
},
|
|
1003
1079
|
sortDragendEvent (evnt: any) {
|
|
1004
|
-
const
|
|
1005
|
-
const
|
|
1006
|
-
const
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1080
|
+
const $xeTable = this.$xetable
|
|
1081
|
+
const tableProps = $xeTable
|
|
1082
|
+
const reactData = $xeTable
|
|
1083
|
+
const internalData = $xeTable
|
|
1084
|
+
|
|
1085
|
+
const { dragCol, prevDragPos, prevDragCol, prevDragToChild } = this
|
|
1086
|
+
|
|
1087
|
+
const { mouseConfig } = tableProps
|
|
1088
|
+
const { customColumnList } = reactData
|
|
1089
|
+
const { collectColumn } = internalData
|
|
1090
|
+
const customOpts = $xeTable.computeCustomOpts
|
|
1091
|
+
const { immediate } = customOpts
|
|
1092
|
+
const trEl = evnt.currentTarget as HTMLElement
|
|
1093
|
+
const columnDragOpts = $xeTable.computeColumnDragOpts
|
|
1094
|
+
const { isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts
|
|
1095
|
+
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0
|
|
1096
|
+
if (prevDragCol && dragCol) {
|
|
1009
1097
|
// 判断是否有拖动
|
|
1010
|
-
if (
|
|
1011
|
-
const
|
|
1012
|
-
const
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1098
|
+
if (prevDragCol !== dragCol) {
|
|
1099
|
+
const oldColumn: VxeTableDefines.ColumnInfo = dragCol
|
|
1100
|
+
const newColumn: VxeTableDefines.ColumnInfo = prevDragCol
|
|
1101
|
+
Promise.resolve(
|
|
1102
|
+
dragEndMethod
|
|
1103
|
+
? dragEndMethod({
|
|
1104
|
+
oldColumn,
|
|
1105
|
+
newColumn,
|
|
1106
|
+
dragPos: prevDragPos as any,
|
|
1107
|
+
offsetIndex: dragOffsetIndex
|
|
1108
|
+
})
|
|
1109
|
+
: true
|
|
1110
|
+
).then((status) => {
|
|
1111
|
+
if (!status) {
|
|
1112
|
+
return
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
let oafIndex = -1
|
|
1116
|
+
let nafIndex = -1
|
|
1117
|
+
|
|
1118
|
+
const oldAllMaps: Record<string, any> = {}
|
|
1119
|
+
XEUtils.eachTree([oldColumn], column => {
|
|
1120
|
+
oldAllMaps[column.id] = column
|
|
1121
|
+
})
|
|
1122
|
+
|
|
1123
|
+
let isSelfToChildStatus = false
|
|
1124
|
+
|
|
1125
|
+
// 只有实时拖拽支持跨层级
|
|
1126
|
+
if (immediate) {
|
|
1127
|
+
if (oldColumn.parentId && newColumn.parentId) {
|
|
1128
|
+
// 子到子
|
|
1129
|
+
|
|
1130
|
+
if (!isCrossDrag) {
|
|
1131
|
+
return
|
|
1132
|
+
}
|
|
1133
|
+
if (oldAllMaps[newColumn.id]) {
|
|
1134
|
+
isSelfToChildStatus = true
|
|
1135
|
+
if (!isSelfToChildDrag) {
|
|
1136
|
+
if (VxeUI.modal) {
|
|
1137
|
+
VxeUI.modal.message({
|
|
1138
|
+
status: 'error',
|
|
1139
|
+
content: getI18n('vxe.error.treeDragChild')
|
|
1140
|
+
})
|
|
1141
|
+
}
|
|
1142
|
+
return
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
} else if (oldColumn.parentId) {
|
|
1146
|
+
// 子到根
|
|
1147
|
+
|
|
1148
|
+
if (!isCrossDrag) {
|
|
1149
|
+
return
|
|
1150
|
+
}
|
|
1151
|
+
} else if (newColumn.parentId) {
|
|
1152
|
+
// 根到子
|
|
1153
|
+
|
|
1154
|
+
if (!isCrossDrag) {
|
|
1155
|
+
return
|
|
1156
|
+
}
|
|
1157
|
+
if (oldAllMaps[newColumn.id]) {
|
|
1158
|
+
isSelfToChildStatus = true
|
|
1159
|
+
if (!isSelfToChildDrag) {
|
|
1160
|
+
if (VxeUI.modal) {
|
|
1161
|
+
VxeUI.modal.message({
|
|
1162
|
+
status: 'error',
|
|
1163
|
+
content: getI18n('vxe.error.treeDragChild')
|
|
1164
|
+
})
|
|
1165
|
+
}
|
|
1166
|
+
return
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
} else {
|
|
1170
|
+
// 根到根
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
const oldewMatchRest = XEUtils.findTree(collectColumn as VxeTableDefines.ColumnInfo[], item => item.id === oldColumn.id)
|
|
1174
|
+
|
|
1175
|
+
// 改变层级
|
|
1176
|
+
if (isSelfToChildStatus && isSelfToChildDrag) {
|
|
1177
|
+
if (oldewMatchRest) {
|
|
1178
|
+
const { items: oCols, index: oIndex } = oldewMatchRest
|
|
1179
|
+
const childList = oldColumn.children || []
|
|
1180
|
+
childList.forEach(column => {
|
|
1181
|
+
column.parentId = oldColumn.parentId
|
|
1182
|
+
})
|
|
1183
|
+
oCols.splice(oIndex, 1, ...childList)
|
|
1184
|
+
oldColumn.children = []
|
|
1185
|
+
}
|
|
1186
|
+
} else {
|
|
1187
|
+
if (oldewMatchRest) {
|
|
1188
|
+
const { items: oCols, index: oIndex, parent: oParent } = oldewMatchRest
|
|
1189
|
+
oCols.splice(oIndex, 1)
|
|
1190
|
+
if (!oParent) {
|
|
1191
|
+
oafIndex = oIndex
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
const newMatchRest = XEUtils.findTree(collectColumn as VxeTableDefines.ColumnInfo[], item => item.id === newColumn.id)
|
|
1197
|
+
if (newMatchRest) {
|
|
1198
|
+
const { items: nCols, index: nIndex, parent: nParent } = newMatchRest
|
|
1199
|
+
// 转子级
|
|
1200
|
+
if (isToChildDrag && prevDragToChild) {
|
|
1201
|
+
oldColumn.parentId = newColumn.id
|
|
1202
|
+
newColumn.children = (newColumn.children || []).concat([oldColumn])
|
|
1203
|
+
} else {
|
|
1204
|
+
oldColumn.parentId = newColumn.parentId
|
|
1205
|
+
nCols.splice(nIndex + dragOffsetIndex, 0, oldColumn)
|
|
1206
|
+
}
|
|
1207
|
+
if (!nParent) {
|
|
1208
|
+
nafIndex = nIndex
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
XEUtils.eachTree(collectColumn, (column, index, items, path, parent) => {
|
|
1213
|
+
if (!parent) {
|
|
1214
|
+
const sortIndex = index + 1
|
|
1215
|
+
column.renderSortNumber = sortIndex
|
|
1216
|
+
}
|
|
1217
|
+
})
|
|
1218
|
+
} else {
|
|
1219
|
+
oafIndex = XEUtils.findIndexOf(customColumnList, item => item.id === oldColumn.id)
|
|
1220
|
+
customColumnList.splice(oafIndex, 1)
|
|
1221
|
+
|
|
1222
|
+
nafIndex = XEUtils.findIndexOf(customColumnList, item => item.id === newColumn.id)
|
|
1223
|
+
customColumnList.splice(nafIndex + dragOffsetIndex, 0, oldColumn)
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
reactData.isDragColMove = true
|
|
1227
|
+
if (mouseConfig) {
|
|
1228
|
+
if ($xeTable.clearSelected) {
|
|
1229
|
+
$xeTable.clearSelected()
|
|
1230
|
+
}
|
|
1231
|
+
if ($xeTable.clearCellAreas) {
|
|
1232
|
+
$xeTable.clearCellAreas()
|
|
1233
|
+
$xeTable.clearCopyCellArea()
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
$xeTable.dispatchEvent('column-dragend', {
|
|
1238
|
+
oldColumn,
|
|
1239
|
+
newColumn,
|
|
1240
|
+
dragPos: prevDragPos,
|
|
1241
|
+
offsetIndex: dragOffsetIndex,
|
|
1242
|
+
_index: {
|
|
1243
|
+
newIndex: nafIndex,
|
|
1244
|
+
oldIndex: oafIndex
|
|
1245
|
+
}
|
|
1246
|
+
}, evnt)
|
|
1247
|
+
|
|
1248
|
+
if (immediate) {
|
|
1249
|
+
reactData.customColumnList = collectColumn.slice(0)
|
|
1250
|
+
$xeTable.refreshColumn(true).then(() => {
|
|
1251
|
+
$xeTable.updateCellAreas()
|
|
1252
|
+
$xeTable.handleCustom()
|
|
1253
|
+
$xeTable.saveCustomStore('update:sort')
|
|
1254
|
+
})
|
|
1255
|
+
}
|
|
1256
|
+
}).catch(() => {
|
|
1257
|
+
})
|
|
1028
1258
|
}
|
|
1029
|
-
prevDropTrEl.draggable = false
|
|
1030
|
-
prevDropTrEl.removeAttribute('drag-pos')
|
|
1031
|
-
removeClass(prevDropTrEl, 'active--drag-target')
|
|
1032
1259
|
}
|
|
1033
|
-
|
|
1260
|
+
|
|
1261
|
+
hideDropTip(this)
|
|
1262
|
+
this.dragCol.value = null
|
|
1034
1263
|
trEl.draggable = false
|
|
1035
1264
|
trEl.removeAttribute('drag-pos')
|
|
1036
|
-
if (dragHintEl) {
|
|
1037
|
-
dragHintEl.style.display = ''
|
|
1038
|
-
}
|
|
1039
1265
|
removeClass(trEl, 'active--drag-target')
|
|
1040
1266
|
removeClass(trEl, 'active--drag-origin')
|
|
1041
|
-
|
|
1042
|
-
if (customOpts.immediate) {
|
|
1043
|
-
XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
|
|
1044
|
-
if (!parent) {
|
|
1045
|
-
const sortIndex = index + 1
|
|
1046
|
-
column.renderSortNumber = sortIndex
|
|
1047
|
-
}
|
|
1048
|
-
})
|
|
1049
|
-
$xetable.handleCustom()
|
|
1050
|
-
$xetable.saveCustomStore('update:sort')
|
|
1051
|
-
}
|
|
1052
1267
|
},
|
|
1053
1268
|
sortDragoverEvent (evnt: any) {
|
|
1054
|
-
const
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
const
|
|
1060
|
-
const
|
|
1061
|
-
|
|
1062
|
-
|
|
1269
|
+
const $xeTable = this.$xetable
|
|
1270
|
+
|
|
1271
|
+
const { dragCol } = this
|
|
1272
|
+
|
|
1273
|
+
const customOpts = $xeTable.computeCustomOpts
|
|
1274
|
+
const { immediate } = customOpts
|
|
1275
|
+
const columnDragOpts = $xeTable.computeColumnDragOpts
|
|
1276
|
+
const { isCrossDrag, isToChildDrag } = columnDragOpts
|
|
1277
|
+
const optEl = evnt.currentTarget as HTMLElement
|
|
1278
|
+
const hasCtrlKey = evnt.ctrlKey
|
|
1279
|
+
const colid = optEl.getAttribute('colid')
|
|
1280
|
+
const column = $xeTable.getColumnById(colid)
|
|
1281
|
+
// 是否移入有效列
|
|
1282
|
+
if (column && (isCrossDrag || column.level === 1)) {
|
|
1063
1283
|
evnt.preventDefault()
|
|
1064
|
-
const offsetY = evnt.clientY -
|
|
1065
|
-
const
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1284
|
+
const offsetY = evnt.clientY - optEl.getBoundingClientRect().y
|
|
1285
|
+
const dragPos = offsetY < optEl.clientHeight / 2 ? 'top' : 'bottom'
|
|
1286
|
+
if (
|
|
1287
|
+
(dragCol && dragCol.id === column.id) ||
|
|
1288
|
+
(!isCrossDrag && column.level > 1) ||
|
|
1289
|
+
(!immediate && column.level > 1) ||
|
|
1290
|
+
column.renderFixed
|
|
1291
|
+
) {
|
|
1292
|
+
showDropTip(this, evnt, optEl, false, dragPos)
|
|
1293
|
+
return
|
|
1294
|
+
}
|
|
1295
|
+
this.prevDragToChild = !!(isToChildDrag && hasCtrlKey && immediate)
|
|
1296
|
+
this.prevDragCol = column
|
|
1297
|
+
this.prevDragPos = dragPos
|
|
1298
|
+
showDropTip(this, evnt, optEl, true, dragPos)
|
|
1069
1299
|
}
|
|
1070
|
-
updateDropHint(this, evnt)
|
|
1071
1300
|
}
|
|
1072
1301
|
} as any
|
|
1073
1302
|
}
|