vxe-table 3.11.26 → 3.11.27-beta.1
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 +3 -3
- package/es/locale/lang/de-DE.js +3 -3
- package/es/locale/lang/en-US.js +3 -3
- package/es/locale/lang/es-ES.js +3 -3
- package/es/locale/lang/fr-FR.js +3 -3
- package/es/locale/lang/hu-HU.js +3 -3
- package/es/locale/lang/hy-AM.js +3 -3
- package/es/locale/lang/ja-JP.js +3 -3
- package/es/locale/lang/ko-KR.js +3 -3
- package/es/locale/lang/nb-NO.js +3 -3
- package/es/locale/lang/pt-BR.js +3 -3
- package/es/locale/lang/ru-RU.js +3 -3
- package/es/locale/lang/ug-CN.js +3 -3
- package/es/locale/lang/uk-UA.js +3 -3
- package/es/locale/lang/vi-VN.js +3 -3
- package/es/locale/lang/zh-CHT.js +3 -3
- package/es/locale/lang/zh-CN.js +3 -3
- 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 +433 -231
- package/es/table/src/body.js +2 -2
- package/es/table/src/cell.js +2 -2
- package/es/table/src/column.js +10 -8
- package/es/table/src/group.js +37 -6
- package/es/table/src/methods.js +167 -73
- package/es/table/src/table.js +1 -1
- package/es/table/src/util.js +0 -1
- package/es/table/style.css +106 -37
- 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 +106 -37
- 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 +618 -260
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +3 -3
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/de-DE.js +3 -3
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/en-US.js +3 -3
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +3 -3
- package/lib/locale/lang/es-ES.js +3 -3
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +3 -3
- package/lib/locale/lang/fr-FR.js +3 -3
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/hu-HU.js +3 -3
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +3 -3
- package/lib/locale/lang/hy-AM.js +3 -3
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/ja-JP.js +3 -3
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +3 -3
- package/lib/locale/lang/ko-KR.js +3 -3
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +3 -3
- package/lib/locale/lang/nb-NO.js +3 -3
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/pt-BR.js +3 -3
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +3 -3
- package/lib/locale/lang/ru-RU.js +3 -3
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +3 -3
- package/lib/locale/lang/ug-CN.js +3 -3
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/uk-UA.js +3 -3
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +3 -3
- package/lib/locale/lang/vi-VN.js +3 -3
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +3 -3
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +3 -3
- package/lib/locale/lang/zh-CN.js +3 -3
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +3 -3
- 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 +2 -2
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +2 -1
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +11 -9
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/group.js +39 -6
- package/lib/table/src/group.min.js +1 -1
- package/lib/table/src/methods.js +181 -74
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +1 -1
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +0 -1
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +106 -37
- 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 +106 -37
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/locale/lang/ar-EG.ts +3 -3
- package/packages/locale/lang/de-DE.ts +3 -3
- package/packages/locale/lang/en-US.ts +3 -3
- package/packages/locale/lang/es-ES.ts +3 -3
- package/packages/locale/lang/fr-FR.ts +3 -3
- package/packages/locale/lang/hu-HU.ts +3 -3
- package/packages/locale/lang/hy-AM.ts +3 -3
- package/packages/locale/lang/ja-JP.ts +3 -3
- package/packages/locale/lang/ko-KR.ts +3 -3
- package/packages/locale/lang/nb-NO.ts +3 -3
- package/packages/locale/lang/pt-BR.ts +3 -3
- package/packages/locale/lang/ru-RU.ts +3 -3
- package/packages/locale/lang/ug-CN.ts +3 -3
- package/packages/locale/lang/uk-UA.ts +3 -3
- package/packages/locale/lang/vi-VN.ts +3 -3
- package/packages/locale/lang/zh-CHT.ts +3 -3
- package/packages/locale/lang/zh-CN.ts +3 -3
- package/packages/table/module/custom/mixin.ts +2 -0
- package/packages/table/module/custom/panel.ts +458 -234
- package/packages/table/src/body.ts +2 -2
- package/packages/table/src/cell.ts +2 -2
- package/packages/table/src/column.ts +10 -8
- package/packages/table/src/group.ts +40 -6
- package/packages/table/src/methods.ts +182 -86
- package/packages/table/src/table.ts +1 -1
- package/packages/table/src/util.ts +0 -1
- package/packages/ui/src/dom.ts +2 -0
- package/styles/components/table-module/custom.scss +92 -12
- package/styles/components/table.scss +5 -0
- /package/es/{iconfont.1733885890565.ttf → iconfont.1734000397391.ttf} +0 -0
- /package/es/{iconfont.1733885890565.woff → iconfont.1734000397391.woff} +0 -0
- /package/es/{iconfont.1733885890565.woff2 → iconfont.1734000397391.woff2} +0 -0
- /package/lib/{iconfont.1733885890565.ttf → iconfont.1734000397391.ttf} +0 -0
- /package/lib/{iconfont.1733885890565.woff → iconfont.1734000397391.woff} +0 -0
- /package/lib/{iconfont.1733885890565.woff2 → iconfont.1734000397391.woff2} +0 -0
|
@@ -1,24 +1,85 @@
|
|
|
1
1
|
import { VxeUI } from '../../../ui';
|
|
2
2
|
import { formatText } from '../../../ui/src/utils';
|
|
3
|
-
import { addClass, removeClass } from '../../../ui/src/dom';
|
|
3
|
+
import { tpImg, addClass, removeClass } from '../../../ui/src/dom';
|
|
4
4
|
import { errLog } from '../../../ui/src/log';
|
|
5
5
|
import XEUtils from 'xe-utils';
|
|
6
6
|
const { getI18n, getIcon, renderEmptyElement } = VxeUI;
|
|
7
|
-
function
|
|
8
|
-
const {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
if (!bodyEl) {
|
|
7
|
+
function showDropTip(_vm, evnt, optEl, showLine, dragPos) {
|
|
8
|
+
const { prevDragToChild } = _vm;
|
|
9
|
+
const el = _vm.$refs.bodyElemRef;
|
|
10
|
+
if (!el) {
|
|
12
11
|
return;
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
const wrapperRect = el.getBoundingClientRect();
|
|
14
|
+
if (optEl) {
|
|
15
|
+
const dragLineEl = _vm.$refs.refDragLineElem;
|
|
16
|
+
if (dragLineEl) {
|
|
17
|
+
if (showLine) {
|
|
18
|
+
const optRect = optEl.getBoundingClientRect();
|
|
19
|
+
dragLineEl.style.display = 'block';
|
|
20
|
+
dragLineEl.style.top = `${Math.max(1, optRect.y - wrapperRect.y)}px`;
|
|
21
|
+
dragLineEl.style.height = `${optRect.height}px`;
|
|
22
|
+
dragLineEl.style.width = `${optRect.width}px`;
|
|
23
|
+
dragLineEl.setAttribute('drag-pos', dragPos);
|
|
24
|
+
dragLineEl.setAttribute('drag-to-child', prevDragToChild ? 'y' : 'n');
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
dragLineEl.style.display = '';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const dragTipEl = _vm.$refs.refDragTipElem;
|
|
32
|
+
if (dragTipEl) {
|
|
33
|
+
dragTipEl.style.display = 'block';
|
|
34
|
+
dragTipEl.style.top = `${Math.min(el.clientHeight - el.scrollTop - dragTipEl.clientHeight, evnt.clientY - wrapperRect.y)}px`;
|
|
35
|
+
dragTipEl.style.left = `${Math.min(el.clientWidth - el.scrollLeft - dragTipEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`;
|
|
36
|
+
dragTipEl.setAttribute('drag-status', showLine ? (prevDragToChild ? 'sub' : 'normal') : 'disabled');
|
|
20
37
|
}
|
|
21
38
|
}
|
|
39
|
+
function hideDropTip(_vm) {
|
|
40
|
+
const dragTipEl = _vm.$refs.refDragTipElem;
|
|
41
|
+
const dragLineEl = _vm.$refs.refDragLineElem;
|
|
42
|
+
if (dragTipEl) {
|
|
43
|
+
dragTipEl.style.display = '';
|
|
44
|
+
}
|
|
45
|
+
if (dragLineEl) {
|
|
46
|
+
dragLineEl.style.display = '';
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const renderDragTip = (h, _vm) => {
|
|
50
|
+
const { dragCol } = _vm;
|
|
51
|
+
return h('div', {}, [
|
|
52
|
+
h('div', {
|
|
53
|
+
ref: 'refDragLineElem',
|
|
54
|
+
class: 'vxe-table-custom-popup--drag-line'
|
|
55
|
+
}),
|
|
56
|
+
h('div', {
|
|
57
|
+
ref: 'refDragTipElem',
|
|
58
|
+
class: 'vxe-table-custom-popup--drag-tip'
|
|
59
|
+
}, [
|
|
60
|
+
h('div', {
|
|
61
|
+
class: 'vxe-table-custom-popup--drag-tip-wrapper'
|
|
62
|
+
}, [
|
|
63
|
+
h('div', {
|
|
64
|
+
class: 'vxe-table-custom-popup--drag-tip-status'
|
|
65
|
+
}, [
|
|
66
|
+
h('span', {
|
|
67
|
+
class: ['vxe-table-custom-popup--drag-tip-normal-status', getIcon().TABLE_DRAG_STATUS_ROW]
|
|
68
|
+
}),
|
|
69
|
+
h('span', {
|
|
70
|
+
class: ['vxe-table-custom-popup--drag-tip-sub-status', getIcon().TABLE_DRAG_STATUS_SUB_ROW]
|
|
71
|
+
}),
|
|
72
|
+
h('span', {
|
|
73
|
+
class: ['vxe-table-custom-popup--drag-tip-disabled-status', getIcon().TABLE_DRAG_DISABLED]
|
|
74
|
+
})
|
|
75
|
+
]),
|
|
76
|
+
h('div', {
|
|
77
|
+
class: 'vxe-table--drag-tip-content'
|
|
78
|
+
}, getI18n('vxe.custom.cstmDragTarget', [dragCol && dragCol.type !== 'html' ? dragCol.getTitle() : '']))
|
|
79
|
+
])
|
|
80
|
+
])
|
|
81
|
+
]);
|
|
82
|
+
};
|
|
22
83
|
const renderSimplePanel = (h, _vm) => {
|
|
23
84
|
const VxeUIButtonComponent = VxeUI.getComponent('VxeButton');
|
|
24
85
|
const props = _vm;
|
|
@@ -27,9 +88,12 @@ const renderSimplePanel = (h, _vm) => {
|
|
|
27
88
|
const { customStore } = props;
|
|
28
89
|
const { isCustomStatus, customColumnList } = reactData;
|
|
29
90
|
const customOpts = $xeTable.computeCustomOpts;
|
|
91
|
+
const { immediate } = customOpts;
|
|
92
|
+
const columnDragOpts = $xeTable.computeColumnDragOpts;
|
|
30
93
|
const { maxHeight } = customStore;
|
|
31
94
|
const { checkMethod, visibleMethod, allowVisible, allowSort, allowFixed, trigger, placement } = customOpts;
|
|
32
95
|
const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
|
|
96
|
+
const { isCrossDrag } = columnDragOpts;
|
|
33
97
|
const slots = customOpts.slots || {};
|
|
34
98
|
const headerSlot = slots.header;
|
|
35
99
|
const topSlot = slots.top;
|
|
@@ -40,7 +104,6 @@ const renderSimplePanel = (h, _vm) => {
|
|
|
40
104
|
const customWrapperOns = {};
|
|
41
105
|
const isAllChecked = customStore.isAll;
|
|
42
106
|
const isAllIndeterminate = customStore.isIndeterminate;
|
|
43
|
-
const dragColumn = _vm.dragColumn;
|
|
44
107
|
// hover 触发
|
|
45
108
|
if (trigger === 'hover') {
|
|
46
109
|
customWrapperOns.mouseenter = _vm.handleWrapperMouseenterEvent;
|
|
@@ -101,45 +164,49 @@ const renderSimplePanel = (h, _vm) => {
|
|
|
101
164
|
})
|
|
102
165
|
])
|
|
103
166
|
: renderEmptyElement($xeTable),
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
h('
|
|
109
|
-
class:
|
|
110
|
-
'is--disabled': isDisabled || isHidden
|
|
111
|
-
}],
|
|
112
|
-
attrs: {
|
|
113
|
-
title: getI18n('vxe.custom.setting.sortHelpTip')
|
|
114
|
-
},
|
|
115
|
-
on: isDisabled || isHidden
|
|
116
|
-
? {}
|
|
117
|
-
: {
|
|
118
|
-
mousedown: _vm.sortMousedownEvent,
|
|
119
|
-
mouseup: _vm.sortMouseupEvent
|
|
120
|
-
}
|
|
167
|
+
h('div', {
|
|
168
|
+
class: 'vxe-table-custom--name-option'
|
|
169
|
+
}, [
|
|
170
|
+
allowSort && ((isCrossDrag ? immediate : false) || column.level === 1)
|
|
171
|
+
? h('div', {
|
|
172
|
+
class: 'vxe-table-custom--sort-option'
|
|
121
173
|
}, [
|
|
122
|
-
h('
|
|
123
|
-
class:
|
|
124
|
-
|
|
174
|
+
h('span', {
|
|
175
|
+
class: ['vxe-table-custom--sort-btn', {
|
|
176
|
+
'is--disabled': isDisabled || isHidden || column.renderFixed
|
|
177
|
+
}],
|
|
178
|
+
attrs: {
|
|
179
|
+
title: getI18n('vxe.custom.setting.sortHelpTip')
|
|
180
|
+
},
|
|
181
|
+
on: isDisabled || isHidden || column.renderFixed
|
|
182
|
+
? {}
|
|
183
|
+
: {
|
|
184
|
+
mousedown: _vm.sortMousedownEvent,
|
|
185
|
+
mouseup: _vm.sortMouseupEvent
|
|
186
|
+
}
|
|
187
|
+
}, [
|
|
188
|
+
h('i', {
|
|
189
|
+
class: getIcon().TABLE_CUSTOM_SORT
|
|
190
|
+
})
|
|
191
|
+
])
|
|
125
192
|
])
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
193
|
+
: renderEmptyElement($xeTable),
|
|
194
|
+
column.type === 'html'
|
|
195
|
+
? h('div', {
|
|
196
|
+
key: '1',
|
|
197
|
+
class: 'vxe-table-custom--checkbox-label',
|
|
198
|
+
domProps: {
|
|
199
|
+
innerHTML: colTitle
|
|
200
|
+
}
|
|
201
|
+
})
|
|
202
|
+
: h('div', {
|
|
203
|
+
key: '0',
|
|
204
|
+
class: 'vxe-table-custom--checkbox-label',
|
|
205
|
+
attrs: {
|
|
206
|
+
title: colTitle
|
|
207
|
+
}
|
|
208
|
+
}, colTitle)
|
|
209
|
+
]),
|
|
143
210
|
!parent && allowFixed
|
|
144
211
|
? h('div', {
|
|
145
212
|
class: 'vxe-table-custom--fixed-option'
|
|
@@ -252,10 +319,7 @@ const renderSimplePanel = (h, _vm) => {
|
|
|
252
319
|
class: 'vxe-table-custom--panel-bottom'
|
|
253
320
|
}, $xeTable.callSlot(bottomSlot, params, h))
|
|
254
321
|
: renderEmptyElement($xeTable),
|
|
255
|
-
h
|
|
256
|
-
ref: 'dragHintElemRef',
|
|
257
|
-
class: 'vxe-table-custom-popup--drag-hint'
|
|
258
|
-
}, getI18n('vxe.custom.cstmDragTarget', [dragColumn && dragColumn.type !== 'html' ? dragColumn.getTitle() : '']))
|
|
322
|
+
renderDragTip(h, _vm)
|
|
259
323
|
]),
|
|
260
324
|
customOpts.showFooter
|
|
261
325
|
? h('div', {
|
|
@@ -276,7 +340,7 @@ const renderSimplePanel = (h, _vm) => {
|
|
|
276
340
|
click: _vm.resetCustomEvent
|
|
277
341
|
}
|
|
278
342
|
}),
|
|
279
|
-
|
|
343
|
+
immediate
|
|
280
344
|
? h(VxeUIButtonComponent, {
|
|
281
345
|
props: {
|
|
282
346
|
mode: 'text',
|
|
@@ -295,7 +359,7 @@ const renderSimplePanel = (h, _vm) => {
|
|
|
295
359
|
click: _vm.cancelCustomEvent
|
|
296
360
|
}
|
|
297
361
|
}),
|
|
298
|
-
|
|
362
|
+
immediate
|
|
299
363
|
? renderEmptyElement($xeTable)
|
|
300
364
|
: h(VxeUIButtonComponent, {
|
|
301
365
|
props: {
|
|
@@ -318,7 +382,6 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
318
382
|
const VxeUIDrawerComponent = VxeUI.getComponent('VxeDrawer');
|
|
319
383
|
const VxeUIButtonComponent = VxeUI.getComponent('VxeButton');
|
|
320
384
|
const VxeUINumberInputComponent = VxeUI.getComponent('VxeInput');
|
|
321
|
-
const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip');
|
|
322
385
|
const $xeTableCustomPanel = _vm;
|
|
323
386
|
const props = _vm;
|
|
324
387
|
const $xeTable = _vm.$xeTable;
|
|
@@ -328,6 +391,8 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
328
391
|
const { resizable: allResizable } = tableProps;
|
|
329
392
|
const { isCustomStatus, customColumnList } = reactData;
|
|
330
393
|
const customOpts = $xeTable.computeCustomOpts;
|
|
394
|
+
const { immediate } = customOpts;
|
|
395
|
+
const columnDragOpts = $xeTable.computeColumnDragOpts;
|
|
331
396
|
const { mode, modalOptions, drawerOptions, allowVisible, allowSort, allowFixed, allowResizable, checkMethod, visibleMethod } = customOpts;
|
|
332
397
|
const columnOpts = $xeTable.computeColumnOpts;
|
|
333
398
|
const { maxFixedSize } = columnOpts;
|
|
@@ -336,6 +401,7 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
336
401
|
const modalOpts = Object.assign({}, modalOptions);
|
|
337
402
|
const drawerOpts = Object.assign({}, drawerOptions);
|
|
338
403
|
const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
|
|
404
|
+
const { isCrossDrag } = columnDragOpts;
|
|
339
405
|
const slots = customOpts.slots || {};
|
|
340
406
|
const headerSlot = slots.header;
|
|
341
407
|
const topSlot = slots.top;
|
|
@@ -345,7 +411,6 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
345
411
|
const trVNs = [];
|
|
346
412
|
const isAllChecked = customStore.isAll;
|
|
347
413
|
const isAllIndeterminate = customStore.isIndeterminate;
|
|
348
|
-
const dragColumn = _vm.dragColumn;
|
|
349
414
|
const params = {
|
|
350
415
|
$table: $xeTable,
|
|
351
416
|
$grid: $xeTable.xegrid,
|
|
@@ -422,50 +487,52 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
422
487
|
])
|
|
423
488
|
])
|
|
424
489
|
: renderEmptyElement($xeTable),
|
|
425
|
-
allowSort
|
|
426
|
-
? h('td', {
|
|
427
|
-
class: 'vxe-table-custom-popup--column-item col--sort'
|
|
428
|
-
}, [
|
|
429
|
-
column.level === 1
|
|
430
|
-
? h('span', {
|
|
431
|
-
class: ['vxe-table-custom-popup--column-sort-btn', {
|
|
432
|
-
'is--disabled': isDisabled || isHidden
|
|
433
|
-
}],
|
|
434
|
-
attrs: {
|
|
435
|
-
title: getI18n('vxe.custom.setting.sortHelpTip')
|
|
436
|
-
},
|
|
437
|
-
on: isDisabled || isHidden
|
|
438
|
-
? {}
|
|
439
|
-
: {
|
|
440
|
-
mousedown: _vm.sortMousedownEvent,
|
|
441
|
-
mouseup: _vm.sortMouseupEvent
|
|
442
|
-
}
|
|
443
|
-
}, [
|
|
444
|
-
h('i', {
|
|
445
|
-
class: getIcon().TABLE_CUSTOM_SORT
|
|
446
|
-
})
|
|
447
|
-
])
|
|
448
|
-
: h('span', '-')
|
|
449
|
-
])
|
|
450
|
-
: renderEmptyElement($xeTable),
|
|
451
490
|
h('td', {
|
|
452
491
|
class: 'vxe-table-custom-popup--column-item col--name'
|
|
453
492
|
}, [
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
493
|
+
h('div', {
|
|
494
|
+
class: 'vxe-table-custom-popup--name'
|
|
495
|
+
}, [
|
|
496
|
+
allowSort
|
|
497
|
+
? ((isCrossDrag ? immediate : false) || column.level === 1
|
|
498
|
+
? h('div', {
|
|
499
|
+
class: ['vxe-table-custom-popup--column-sort-btn', {
|
|
500
|
+
'is--disabled': isDisabled || isHidden || column.renderFixed
|
|
501
|
+
}],
|
|
502
|
+
attrs: {
|
|
503
|
+
title: getI18n('vxe.custom.setting.sortHelpTip')
|
|
504
|
+
},
|
|
505
|
+
on: (isDisabled || isHidden || column.renderFixed
|
|
506
|
+
? {}
|
|
507
|
+
: {
|
|
508
|
+
mousedown: _vm.sortMousedownEvent,
|
|
509
|
+
mouseup: _vm.sortMouseupEvent
|
|
510
|
+
})
|
|
511
|
+
}, [
|
|
512
|
+
h('i', {
|
|
513
|
+
class: getIcon().TABLE_CUSTOM_SORT
|
|
514
|
+
})
|
|
515
|
+
])
|
|
516
|
+
: h('div', {
|
|
517
|
+
class: 'vxe-table-custom-popup--column-sort-placeholder'
|
|
518
|
+
}))
|
|
519
|
+
: renderEmptyElement($xeTable),
|
|
520
|
+
column.type === 'html'
|
|
521
|
+
? h('div', {
|
|
522
|
+
key: '1',
|
|
523
|
+
class: 'vxe-table-custom-popup--title',
|
|
524
|
+
domProps: {
|
|
525
|
+
innerHTML: colTitle
|
|
526
|
+
}
|
|
527
|
+
})
|
|
528
|
+
: h('div', {
|
|
529
|
+
key: '0',
|
|
530
|
+
class: 'vxe-table-custom-popup--title',
|
|
531
|
+
attrs: {
|
|
532
|
+
title: colTitle
|
|
533
|
+
}
|
|
534
|
+
}, colTitle)
|
|
535
|
+
])
|
|
469
536
|
]),
|
|
470
537
|
allowResizable
|
|
471
538
|
? h('td', {
|
|
@@ -478,6 +545,7 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
478
545
|
? h(VxeUINumberInputComponent, {
|
|
479
546
|
props: {
|
|
480
547
|
type: 'integer',
|
|
548
|
+
immediate: false,
|
|
481
549
|
disabled: isDisabled || isHidden,
|
|
482
550
|
value: column.renderResizeWidth,
|
|
483
551
|
min: customMinWidth || undefined,
|
|
@@ -486,6 +554,9 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
486
554
|
on: {
|
|
487
555
|
modelValue(value) {
|
|
488
556
|
column.renderResizeWidth = Math.max(0, Number(value));
|
|
557
|
+
},
|
|
558
|
+
change() {
|
|
559
|
+
_vm.changeColumnWidth(column);
|
|
489
560
|
}
|
|
490
561
|
}
|
|
491
562
|
})
|
|
@@ -512,7 +583,7 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
512
583
|
},
|
|
513
584
|
on: {
|
|
514
585
|
input(value) {
|
|
515
|
-
column
|
|
586
|
+
_vm.changeFixedOption(column, value);
|
|
516
587
|
}
|
|
517
588
|
}
|
|
518
589
|
})
|
|
@@ -545,11 +616,6 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
545
616
|
class: 'vxe-table-custom-popup--table-col-seq'
|
|
546
617
|
})
|
|
547
618
|
: renderEmptyElement($xeTable),
|
|
548
|
-
allowSort
|
|
549
|
-
? h('col', {
|
|
550
|
-
class: 'vxe-table-custom-popup--table-col-sort'
|
|
551
|
-
})
|
|
552
|
-
: renderEmptyElement($xeTable),
|
|
553
619
|
h('col', {
|
|
554
620
|
class: 'vxe-table-custom-popup--table-col-title'
|
|
555
621
|
}),
|
|
@@ -589,29 +655,6 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
589
655
|
])
|
|
590
656
|
])
|
|
591
657
|
: renderEmptyElement($xeTable),
|
|
592
|
-
allowSort
|
|
593
|
-
? h('th', {}, [
|
|
594
|
-
h('span', {
|
|
595
|
-
class: 'vxe-table-custom-popup--table-sort-help-title'
|
|
596
|
-
}, getI18n('vxe.custom.setting.colSort')),
|
|
597
|
-
VxeUITooltipComponent
|
|
598
|
-
? h(VxeUITooltipComponent, {
|
|
599
|
-
props: {
|
|
600
|
-
enterable: true,
|
|
601
|
-
content: getI18n('vxe.custom.setting.sortHelpTip'),
|
|
602
|
-
popupClassName: 'vxe-table--ignore-clear'
|
|
603
|
-
},
|
|
604
|
-
scopedSlots: {
|
|
605
|
-
default: () => {
|
|
606
|
-
return h('i', {
|
|
607
|
-
class: 'vxe-table-custom-popup--table-sort-help-icon vxe-icon-question-circle-fill'
|
|
608
|
-
});
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
})
|
|
612
|
-
: renderEmptyElement($xeTableCustomPanel)
|
|
613
|
-
])
|
|
614
|
-
: renderEmptyElement($xeTable),
|
|
615
658
|
h('th', {}, getI18n('vxe.custom.setting.colTitle')),
|
|
616
659
|
allowResizable
|
|
617
660
|
? h('th', {}, getI18n('vxe.custom.setting.colResizable'))
|
|
@@ -635,10 +678,7 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
635
678
|
class: 'vxe-table-custom-popup--table-bottom'
|
|
636
679
|
}, $xeTable.callSlot(bottomSlot, params, h))
|
|
637
680
|
: renderEmptyElement($xeTable),
|
|
638
|
-
h
|
|
639
|
-
ref: 'dragHintElemRef',
|
|
640
|
-
class: 'vxe-table-custom-popup--drag-hint'
|
|
641
|
-
}, getI18n('vxe.custom.cstmDragTarget', [dragColumn ? dragColumn.getTitle() : '']))
|
|
681
|
+
renderDragTip(h, _vm)
|
|
642
682
|
]);
|
|
643
683
|
},
|
|
644
684
|
footer: () => {
|
|
@@ -657,23 +697,34 @@ const renderPopupPanel = (h, _vm) => {
|
|
|
657
697
|
click: _vm.resetCustomEvent
|
|
658
698
|
}
|
|
659
699
|
}),
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
700
|
+
immediate
|
|
701
|
+
? h(VxeUIButtonComponent, {
|
|
702
|
+
props: {
|
|
703
|
+
content: customOpts.resetButtonText || getI18n('vxe.custom.customClose')
|
|
704
|
+
},
|
|
705
|
+
on: {
|
|
706
|
+
click: _vm.cancelCloseEvent
|
|
707
|
+
}
|
|
708
|
+
})
|
|
709
|
+
: h(VxeUIButtonComponent, {
|
|
710
|
+
props: {
|
|
711
|
+
content: customOpts.resetButtonText || getI18n('vxe.custom.cstmCancel')
|
|
712
|
+
},
|
|
713
|
+
on: {
|
|
714
|
+
click: _vm.cancelCustomEvent
|
|
715
|
+
}
|
|
716
|
+
}),
|
|
717
|
+
immediate
|
|
718
|
+
? renderEmptyElement($xeTable)
|
|
719
|
+
: h(VxeUIButtonComponent, {
|
|
720
|
+
props: {
|
|
721
|
+
status: 'primary',
|
|
722
|
+
content: customOpts.confirmButtonText || getI18n('vxe.custom.cstmConfirm')
|
|
723
|
+
},
|
|
724
|
+
on: {
|
|
725
|
+
click: _vm.confirmCustomEvent
|
|
726
|
+
}
|
|
727
|
+
})
|
|
677
728
|
]);
|
|
678
729
|
}
|
|
679
730
|
};
|
|
@@ -754,7 +805,9 @@ export default {
|
|
|
754
805
|
},
|
|
755
806
|
data() {
|
|
756
807
|
return {
|
|
757
|
-
|
|
808
|
+
prevDragCol: undefined,
|
|
809
|
+
prevDragToChild: false,
|
|
810
|
+
prevDragPos: null
|
|
758
811
|
};
|
|
759
812
|
},
|
|
760
813
|
computed: {},
|
|
@@ -764,7 +817,6 @@ export default {
|
|
|
764
817
|
const VxeUIDrawerComponent = VxeUI.getComponent('VxeDrawer');
|
|
765
818
|
const VxeUIButtonComponent = VxeUI.getComponent('VxeButton');
|
|
766
819
|
const VxeUINumberInputComponent = VxeUI.getComponent('VxeNumberInput');
|
|
767
|
-
const VxeUITooltipComponent = VxeUI.getComponent('VxeTooltip');
|
|
768
820
|
const VxeUIRadioGroupComponent = VxeUI.getComponent('VxeRadioGroup');
|
|
769
821
|
this.$nextTick(() => {
|
|
770
822
|
const { $xetable } = this;
|
|
@@ -782,9 +834,6 @@ export default {
|
|
|
782
834
|
if (!VxeUINumberInputComponent) {
|
|
783
835
|
errLog('vxe.error.reqComp', ['vxe-input']);
|
|
784
836
|
}
|
|
785
|
-
if (!VxeUITooltipComponent) {
|
|
786
|
-
errLog('vxe.error.reqComp', ['vxe-tooltip']);
|
|
787
|
-
}
|
|
788
837
|
if (!VxeUIRadioGroupComponent) {
|
|
789
838
|
errLog('vxe.error.reqComp', ['vxe-radio-group']);
|
|
790
839
|
}
|
|
@@ -819,6 +868,8 @@ export default {
|
|
|
819
868
|
},
|
|
820
869
|
confirmCustomEvent({ $event }) {
|
|
821
870
|
const $xeTable = this.$xeTable;
|
|
871
|
+
const reactData = $xeTable;
|
|
872
|
+
reactData.isCustomStatus = true;
|
|
822
873
|
$xeTable.saveCustom();
|
|
823
874
|
$xeTable.closeCustom();
|
|
824
875
|
$xeTable.emitCustomEvent('confirm', $event);
|
|
@@ -886,8 +937,9 @@ export default {
|
|
|
886
937
|
}
|
|
887
938
|
},
|
|
888
939
|
changeCheckboxOption(column) {
|
|
889
|
-
const
|
|
890
|
-
const
|
|
940
|
+
const $xeTable = this.$xetable;
|
|
941
|
+
const reactData = $xeTable;
|
|
942
|
+
const { customOpts } = $xeTable.customOpts;
|
|
891
943
|
const isChecked = !column.renderVisible;
|
|
892
944
|
if (customOpts.immediate) {
|
|
893
945
|
XEUtils.eachTree([column], (item) => {
|
|
@@ -895,8 +947,9 @@ export default {
|
|
|
895
947
|
item.renderVisible = isChecked;
|
|
896
948
|
item.halfVisible = false;
|
|
897
949
|
});
|
|
898
|
-
|
|
899
|
-
$
|
|
950
|
+
reactData.isCustomStatus = true;
|
|
951
|
+
$xeTable.handleCustom();
|
|
952
|
+
$xeTable.saveCustomStore('update:visible');
|
|
900
953
|
}
|
|
901
954
|
else {
|
|
902
955
|
XEUtils.eachTree([column], (item) => {
|
|
@@ -905,11 +958,27 @@ export default {
|
|
|
905
958
|
});
|
|
906
959
|
}
|
|
907
960
|
this.handleOptionCheck(column);
|
|
908
|
-
$
|
|
961
|
+
$xeTable.checkCustomStatus();
|
|
962
|
+
},
|
|
963
|
+
changeColumnWidth(column) {
|
|
964
|
+
const $xeTable = this.$xetable;
|
|
965
|
+
const reactData = $xeTable;
|
|
966
|
+
const customOpts = $xeTable.computeCustomOpts;
|
|
967
|
+
if (customOpts.immediate) {
|
|
968
|
+
if (column.renderResizeWidth !== column.renderWidth) {
|
|
969
|
+
column.resizeWidth = column.renderResizeWidth;
|
|
970
|
+
column.renderWidth = column.renderResizeWidth;
|
|
971
|
+
reactData.isCustomStatus = true;
|
|
972
|
+
$xeTable.handleCustom();
|
|
973
|
+
$xeTable.saveCustomStore('update:width');
|
|
974
|
+
}
|
|
975
|
+
}
|
|
909
976
|
},
|
|
910
977
|
changeFixedOption(column, colFixed) {
|
|
911
|
-
const
|
|
912
|
-
const
|
|
978
|
+
const $xeTable = this.$xetable;
|
|
979
|
+
const reactData = $xeTable;
|
|
980
|
+
const isMaxFixedColumn = $xeTable.computeIsMaxFixedColumn;
|
|
981
|
+
const customOpts = $xeTable.computeCustomOpts;
|
|
913
982
|
if (customOpts.immediate) {
|
|
914
983
|
if (column.renderFixed === colFixed) {
|
|
915
984
|
XEUtils.eachTree([column], col => {
|
|
@@ -925,8 +994,9 @@ export default {
|
|
|
925
994
|
});
|
|
926
995
|
}
|
|
927
996
|
}
|
|
928
|
-
|
|
929
|
-
$
|
|
997
|
+
reactData.isCustomStatus = true;
|
|
998
|
+
$xeTable.handleCustom();
|
|
999
|
+
$xeTable.saveCustomStore('update:fixed');
|
|
930
1000
|
}
|
|
931
1001
|
else {
|
|
932
1002
|
if (column.renderFixed === colFixed) {
|
|
@@ -948,102 +1018,234 @@ export default {
|
|
|
948
1018
|
$xetable.toggleCustomAllCheckbox();
|
|
949
1019
|
},
|
|
950
1020
|
sortMousedownEvent(evnt) {
|
|
951
|
-
const
|
|
1021
|
+
const $xeTable = this.$xetable;
|
|
952
1022
|
const btnEl = evnt.currentTarget;
|
|
953
|
-
const
|
|
954
|
-
const
|
|
1023
|
+
const cellEl = btnEl.parentElement;
|
|
1024
|
+
const tdEl = cellEl.parentElement;
|
|
1025
|
+
const trEl = tdEl.parentElement;
|
|
955
1026
|
const colid = trEl.getAttribute('colid');
|
|
956
|
-
const column = $
|
|
1027
|
+
const column = $xeTable.getColumnById(colid);
|
|
957
1028
|
trEl.draggable = true;
|
|
958
|
-
this.
|
|
1029
|
+
this.dragCol = column;
|
|
959
1030
|
addClass(trEl, 'active--drag-origin');
|
|
960
|
-
updateDropHint(this, evnt);
|
|
961
1031
|
},
|
|
962
1032
|
sortMouseupEvent(evnt) {
|
|
963
1033
|
const btnEl = evnt.currentTarget;
|
|
964
|
-
const
|
|
965
|
-
const
|
|
966
|
-
const
|
|
1034
|
+
const cellEl = btnEl.parentElement;
|
|
1035
|
+
const tdEl = cellEl.parentElement;
|
|
1036
|
+
const trEl = tdEl.parentElement;
|
|
1037
|
+
hideDropTip(this);
|
|
967
1038
|
trEl.draggable = false;
|
|
968
|
-
this.
|
|
1039
|
+
this.dragCol = null;
|
|
969
1040
|
removeClass(trEl, 'active--drag-origin');
|
|
970
|
-
if (dragHintEl) {
|
|
971
|
-
dragHintEl.style.display = '';
|
|
972
|
-
}
|
|
973
1041
|
},
|
|
974
1042
|
sortDragstartEvent(evnt) {
|
|
975
|
-
const img = new Image();
|
|
976
1043
|
if (evnt.dataTransfer) {
|
|
1044
|
+
const img = new Image();
|
|
1045
|
+
img.src = tpImg;
|
|
977
1046
|
evnt.dataTransfer.setDragImage(img, 0, 0);
|
|
978
1047
|
}
|
|
979
1048
|
},
|
|
980
1049
|
sortDragendEvent(evnt) {
|
|
981
|
-
const
|
|
982
|
-
const
|
|
1050
|
+
const $xeTable = this.$xetable;
|
|
1051
|
+
const tableProps = $xeTable;
|
|
1052
|
+
const reactData = $xeTable;
|
|
1053
|
+
const internalData = $xeTable;
|
|
1054
|
+
const { dragCol, prevDragPos, prevDragCol, prevDragToChild } = this;
|
|
1055
|
+
const { mouseConfig } = tableProps;
|
|
1056
|
+
const { customColumnList } = reactData;
|
|
1057
|
+
const { collectColumn } = internalData;
|
|
1058
|
+
const customOpts = $xeTable.computeCustomOpts;
|
|
1059
|
+
const { immediate } = customOpts;
|
|
983
1060
|
const trEl = evnt.currentTarget;
|
|
984
|
-
const
|
|
985
|
-
|
|
1061
|
+
const columnDragOpts = $xeTable.computeColumnDragOpts;
|
|
1062
|
+
const { isCrossDrag, isSelfToChildDrag, isToChildDrag, dragEndMethod } = columnDragOpts;
|
|
1063
|
+
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
|
|
1064
|
+
if (prevDragCol && dragCol) {
|
|
986
1065
|
// 判断是否有拖动
|
|
987
|
-
if (
|
|
988
|
-
const
|
|
989
|
-
const
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1066
|
+
if (prevDragCol !== dragCol) {
|
|
1067
|
+
const oldColumn = dragCol;
|
|
1068
|
+
const newColumn = prevDragCol;
|
|
1069
|
+
Promise.resolve(dragEndMethod
|
|
1070
|
+
? dragEndMethod({
|
|
1071
|
+
oldColumn,
|
|
1072
|
+
newColumn,
|
|
1073
|
+
dragPos: prevDragPos,
|
|
1074
|
+
offsetIndex: dragOffsetIndex
|
|
1075
|
+
})
|
|
1076
|
+
: true).then((status) => {
|
|
1077
|
+
if (!status) {
|
|
1078
|
+
return;
|
|
1079
|
+
}
|
|
1080
|
+
let oafIndex = -1;
|
|
1081
|
+
let nafIndex = -1;
|
|
1082
|
+
const oldAllMaps = {};
|
|
1083
|
+
XEUtils.eachTree([oldColumn], column => {
|
|
1084
|
+
oldAllMaps[column.id] = column;
|
|
1085
|
+
});
|
|
1086
|
+
let isSelfToChildStatus = false;
|
|
1087
|
+
// 只有实时拖拽支持跨层级
|
|
1088
|
+
if (immediate) {
|
|
1089
|
+
if (oldColumn.parentId && newColumn.parentId) {
|
|
1090
|
+
// 子到子
|
|
1091
|
+
if (!isCrossDrag) {
|
|
1092
|
+
return;
|
|
1093
|
+
}
|
|
1094
|
+
if (oldAllMaps[newColumn.id]) {
|
|
1095
|
+
isSelfToChildStatus = true;
|
|
1096
|
+
if (!isSelfToChildDrag) {
|
|
1097
|
+
if (VxeUI.modal) {
|
|
1098
|
+
VxeUI.modal.message({
|
|
1099
|
+
status: 'error',
|
|
1100
|
+
content: getI18n('vxe.error.treeDragChild')
|
|
1101
|
+
});
|
|
1102
|
+
}
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
else if (oldColumn.parentId) {
|
|
1108
|
+
// 子到根
|
|
1109
|
+
if (!isCrossDrag) {
|
|
1110
|
+
return;
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
else if (newColumn.parentId) {
|
|
1114
|
+
// 根到子
|
|
1115
|
+
if (!isCrossDrag) {
|
|
1116
|
+
return;
|
|
1117
|
+
}
|
|
1118
|
+
if (oldAllMaps[newColumn.id]) {
|
|
1119
|
+
isSelfToChildStatus = true;
|
|
1120
|
+
if (!isSelfToChildDrag) {
|
|
1121
|
+
if (VxeUI.modal) {
|
|
1122
|
+
VxeUI.modal.message({
|
|
1123
|
+
status: 'error',
|
|
1124
|
+
content: getI18n('vxe.error.treeDragChild')
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
return;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
else {
|
|
1132
|
+
// 根到根
|
|
1133
|
+
}
|
|
1134
|
+
const oldewMatchRest = XEUtils.findTree(collectColumn, item => item.id === oldColumn.id);
|
|
1135
|
+
// 改变层级
|
|
1136
|
+
if (isSelfToChildStatus && isSelfToChildDrag) {
|
|
1137
|
+
if (oldewMatchRest) {
|
|
1138
|
+
const { items: oCols, index: oIndex } = oldewMatchRest;
|
|
1139
|
+
const childList = oldColumn.children || [];
|
|
1140
|
+
childList.forEach(column => {
|
|
1141
|
+
column.parentId = oldColumn.parentId;
|
|
1142
|
+
});
|
|
1143
|
+
oCols.splice(oIndex, 1, ...childList);
|
|
1144
|
+
oldColumn.children = [];
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
else {
|
|
1148
|
+
if (oldewMatchRest) {
|
|
1149
|
+
const { items: oCols, index: oIndex, parent: oParent } = oldewMatchRest;
|
|
1150
|
+
oCols.splice(oIndex, 1);
|
|
1151
|
+
if (!oParent) {
|
|
1152
|
+
oafIndex = oIndex;
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
const newMatchRest = XEUtils.findTree(collectColumn, item => item.id === newColumn.id);
|
|
1157
|
+
if (newMatchRest) {
|
|
1158
|
+
const { items: nCols, index: nIndex, parent: nParent } = newMatchRest;
|
|
1159
|
+
// 转子级
|
|
1160
|
+
if (isToChildDrag && prevDragToChild) {
|
|
1161
|
+
oldColumn.parentId = newColumn.id;
|
|
1162
|
+
newColumn.children = (newColumn.children || []).concat([oldColumn]);
|
|
1163
|
+
}
|
|
1164
|
+
else {
|
|
1165
|
+
oldColumn.parentId = newColumn.parentId;
|
|
1166
|
+
nCols.splice(nIndex + dragOffsetIndex, 0, oldColumn);
|
|
1167
|
+
}
|
|
1168
|
+
if (!nParent) {
|
|
1169
|
+
nafIndex = nIndex;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
XEUtils.eachTree(collectColumn, (column, index, items, path, parent) => {
|
|
1173
|
+
if (!parent) {
|
|
1174
|
+
const sortIndex = index + 1;
|
|
1175
|
+
column.renderSortNumber = sortIndex;
|
|
1176
|
+
}
|
|
1177
|
+
});
|
|
1178
|
+
}
|
|
1179
|
+
else {
|
|
1180
|
+
oafIndex = XEUtils.findIndexOf(customColumnList, item => item.id === oldColumn.id);
|
|
1181
|
+
customColumnList.splice(oafIndex, 1);
|
|
1182
|
+
nafIndex = XEUtils.findIndexOf(customColumnList, item => item.id === newColumn.id);
|
|
1183
|
+
customColumnList.splice(nafIndex + dragOffsetIndex, 0, oldColumn);
|
|
1184
|
+
}
|
|
1185
|
+
reactData.isDragColMove = true;
|
|
1186
|
+
if (mouseConfig) {
|
|
1187
|
+
if ($xeTable.clearSelected) {
|
|
1188
|
+
$xeTable.clearSelected();
|
|
1189
|
+
}
|
|
1190
|
+
if ($xeTable.clearCellAreas) {
|
|
1191
|
+
$xeTable.clearCellAreas();
|
|
1192
|
+
$xeTable.clearCopyCellArea();
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
$xeTable.dispatchEvent('column-dragend', {
|
|
1196
|
+
oldColumn,
|
|
1197
|
+
newColumn,
|
|
1198
|
+
dragPos: prevDragPos,
|
|
1199
|
+
offsetIndex: dragOffsetIndex,
|
|
1200
|
+
_index: {
|
|
1201
|
+
newIndex: nafIndex,
|
|
1202
|
+
oldIndex: oafIndex
|
|
1203
|
+
}
|
|
1204
|
+
}, evnt);
|
|
1205
|
+
if (immediate) {
|
|
1206
|
+
reactData.customColumnList = collectColumn.slice(0);
|
|
1207
|
+
$xeTable.refreshColumn(true).then(() => {
|
|
1208
|
+
$xeTable.updateCellAreas();
|
|
1209
|
+
$xeTable.handleCustom();
|
|
1210
|
+
$xeTable.saveCustomStore('update:sort');
|
|
1211
|
+
});
|
|
1212
|
+
}
|
|
1213
|
+
}).catch(() => {
|
|
1214
|
+
});
|
|
1005
1215
|
}
|
|
1006
|
-
prevDropTrEl.draggable = false;
|
|
1007
|
-
prevDropTrEl.removeAttribute('drag-pos');
|
|
1008
|
-
removeClass(prevDropTrEl, 'active--drag-target');
|
|
1009
1216
|
}
|
|
1010
|
-
this
|
|
1217
|
+
hideDropTip(this);
|
|
1218
|
+
this.dragCol.value = null;
|
|
1011
1219
|
trEl.draggable = false;
|
|
1012
1220
|
trEl.removeAttribute('drag-pos');
|
|
1013
|
-
if (dragHintEl) {
|
|
1014
|
-
dragHintEl.style.display = '';
|
|
1015
|
-
}
|
|
1016
1221
|
removeClass(trEl, 'active--drag-target');
|
|
1017
1222
|
removeClass(trEl, 'active--drag-origin');
|
|
1018
|
-
if (customOpts.immediate) {
|
|
1019
|
-
XEUtils.eachTree(customColumnList, (column, index, items, path, parent) => {
|
|
1020
|
-
if (!parent) {
|
|
1021
|
-
const sortIndex = index + 1;
|
|
1022
|
-
column.renderSortNumber = sortIndex;
|
|
1023
|
-
}
|
|
1024
|
-
});
|
|
1025
|
-
$xetable.handleCustom();
|
|
1026
|
-
$xetable.saveCustomStore('update:sort');
|
|
1027
|
-
}
|
|
1028
1223
|
},
|
|
1029
1224
|
sortDragoverEvent(evnt) {
|
|
1030
|
-
const
|
|
1031
|
-
const
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
const
|
|
1036
|
-
const
|
|
1037
|
-
|
|
1038
|
-
|
|
1225
|
+
const $xeTable = this.$xetable;
|
|
1226
|
+
const { dragCol } = this;
|
|
1227
|
+
const customOpts = $xeTable.computeCustomOpts;
|
|
1228
|
+
const { immediate } = customOpts;
|
|
1229
|
+
const columnDragOpts = $xeTable.computeColumnDragOpts;
|
|
1230
|
+
const { isCrossDrag, isToChildDrag } = columnDragOpts;
|
|
1231
|
+
const optEl = evnt.currentTarget;
|
|
1232
|
+
const hasCtrlKey = evnt.ctrlKey;
|
|
1233
|
+
const colid = optEl.getAttribute('colid');
|
|
1234
|
+
const column = $xeTable.getColumnById(colid);
|
|
1235
|
+
// 是否移入有效列
|
|
1236
|
+
if (column && (isCrossDrag || column.level === 1)) {
|
|
1039
1237
|
evnt.preventDefault();
|
|
1040
|
-
const offsetY = evnt.clientY -
|
|
1041
|
-
const
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1238
|
+
const offsetY = evnt.clientY - optEl.getBoundingClientRect().y;
|
|
1239
|
+
const dragPos = offsetY < optEl.clientHeight / 2 ? 'top' : 'bottom';
|
|
1240
|
+
if ((dragCol && dragCol.id === column.id) || (!isCrossDrag && column.level === 1) || (!immediate && column.level > 1) || column.renderFixed) {
|
|
1241
|
+
showDropTip(this, evnt, optEl, false, dragPos);
|
|
1242
|
+
return;
|
|
1243
|
+
}
|
|
1244
|
+
this.prevDragToChild = !!(isToChildDrag && hasCtrlKey && immediate);
|
|
1245
|
+
this.prevDragCol = column;
|
|
1246
|
+
this.prevDragPos = dragPos;
|
|
1247
|
+
showDropTip(this, evnt, optEl, true, dragPos);
|
|
1045
1248
|
}
|
|
1046
|
-
updateDropHint(this, evnt);
|
|
1047
1249
|
}
|
|
1048
1250
|
}
|
|
1049
1251
|
};
|