vxe-table 3.9.0-rc.9 → 3.9.0
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/README.md +1 -1
- package/es/grid/src/grid.js +120 -66
- package/es/grid/style.css +0 -1
- package/es/grid/style.min.css +1 -1
- package/es/index.esm.js +22 -3
- package/es/locale/lang/en-US.js +2 -1
- package/es/locale/lang/es-ES.js +2 -1
- package/es/locale/lang/hu-HU.js +2 -1
- package/es/locale/lang/ja-JP.js +2 -1
- package/es/locale/lang/ko-KR.js +2 -1
- package/es/locale/lang/pt-BR.js +2 -1
- package/es/locale/lang/ru-RU.js +2 -1
- package/es/locale/lang/uk-UA.js +2 -1
- package/es/locale/lang/vi-VN.js +2 -1
- package/es/locale/lang/zh-CHT.js +2 -1
- package/es/locale/lang/zh-CN.js +2 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/panel.js +183 -173
- package/es/table/module/edit/mixin.js +33 -24
- package/es/table/module/export/export-panel.js +32 -4
- package/es/table/module/export/import-panel.js +25 -6
- package/es/table/module/export/mixin.js +11 -11
- package/es/table/module/menu/mixin.js +2 -2
- package/es/table/module/validator/mixin.js +4 -4
- package/es/table/render/index.js +17 -11
- package/es/table/src/body.js +1 -0
- package/es/table/src/columnInfo.js +3 -3
- package/es/table/src/methods.js +54 -42
- package/es/table/src/props.js +65 -15
- package/es/table/src/table.js +91 -57
- package/es/table/src/util.js +3 -2
- package/es/table/style.css +37 -48
- package/es/table/style.min.css +1 -1
- package/es/toolbar/src/toolbar.js +21 -7
- package/es/toolbar/style.css +0 -1
- package/es/toolbar/style.min.css +1 -1
- package/es/ui/index.js +5 -3
- package/es/ui/src/log.js +1 -1
- package/es/vxe-grid/style.css +0 -1
- package/es/vxe-grid/style.min.css +1 -1
- package/es/vxe-table/style.css +37 -48
- package/es/vxe-table/style.min.css +1 -1
- package/es/vxe-toolbar/style.css +0 -1
- package/es/vxe-toolbar/style.min.css +1 -1
- package/lib/colgroup/index.js +3 -3
- package/lib/colgroup/index.min.js +1 -1
- package/lib/column/index.js +3 -3
- package/lib/column/index.min.js +1 -1
- package/lib/components.js +9 -11
- package/lib/components.min.js +1 -1
- package/lib/grid/index.js +3 -3
- package/lib/grid/index.min.js +1 -1
- package/lib/grid/src/grid.js +581 -491
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/grid/style/style.css +0 -1
- package/lib/grid/style/style.min.css +1 -1
- package/lib/index.common.js +3 -4
- package/lib/index.umd.js +9174 -17260
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/en-US.js +2 -1
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +2 -1
- package/lib/locale/lang/es-ES.js +2 -1
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +2 -1
- package/lib/locale/lang/hu-HU.js +2 -1
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +2 -1
- package/lib/locale/lang/ja-JP.js +2 -1
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +2 -1
- package/lib/locale/lang/ko-KR.js +2 -1
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +2 -1
- package/lib/locale/lang/pt-BR.js +2 -1
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +2 -1
- package/lib/locale/lang/ru-RU.js +2 -1
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +2 -1
- package/lib/locale/lang/uk-UA.js +2 -1
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +2 -1
- package/lib/locale/lang/vi-VN.js +2 -1
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +2 -1
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +2 -1
- package/lib/locale/lang/zh-CN.js +2 -1
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +2 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/index.js +4 -4
- package/lib/table/index.min.js +1 -1
- package/lib/table/module/custom/mixin.js +53 -44
- package/lib/table/module/custom/mixin.min.js +1 -1
- package/lib/table/module/custom/panel.js +310 -239
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/edit/mixin.js +436 -371
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/export/export-panel.js +136 -106
- package/lib/table/module/export/export-panel.min.js +1 -1
- package/lib/table/module/export/import-panel.js +75 -54
- package/lib/table/module/export/import-panel.min.js +1 -1
- package/lib/table/module/export/mixin.js +592 -597
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/module/export/util.js +6 -4
- package/lib/table/module/export/util.min.js +1 -1
- package/lib/table/module/filter/mixin.js +147 -118
- package/lib/table/module/filter/mixin.min.js +1 -1
- package/lib/table/module/filter/panel.js +86 -65
- package/lib/table/module/filter/panel.min.js +1 -1
- package/lib/table/module/keyboard/mixin.js +163 -151
- package/lib/table/module/keyboard/mixin.min.js +1 -1
- package/lib/table/module/menu/mixin.js +125 -114
- package/lib/table/module/menu/mixin.min.js +1 -1
- package/lib/table/module/menu/panel.js +36 -34
- package/lib/table/module/menu/panel.min.js +1 -1
- package/lib/table/module/validator/mixin.js +225 -214
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/render/index.js +401 -297
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/body.js +411 -349
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +470 -344
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +10 -10
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/columnInfo.js +46 -55
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/footer.js +157 -132
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/group.js +1 -1
- package/lib/table/src/group.min.js +1 -1
- package/lib/table/src/header.js +170 -153
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +2758 -2478
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/props.js +33 -74
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +465 -424
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +143 -131
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +37 -48
- package/lib/table/style/style.min.css +1 -1
- package/lib/toolbar/index.js +3 -3
- package/lib/toolbar/index.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +332 -284
- package/lib/toolbar/src/toolbar.min.js +1 -1
- package/lib/toolbar/style/style.css +0 -1
- package/lib/toolbar/style/style.min.css +1 -1
- package/lib/ui/index.js +50 -41
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/comp.js +2 -3
- package/lib/ui/src/comp.min.js +1 -1
- package/lib/ui/src/dom.js +29 -28
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/log.js +6 -4
- package/lib/ui/src/log.min.js +1 -1
- package/lib/ui/src/utils.js +7 -7
- package/lib/v-x-e-table/index.js +3 -4
- package/lib/v-x-e-table/index.min.js +1 -1
- package/lib/vxe-colgroup/index.js +3 -4
- package/lib/vxe-colgroup/index.min.js +1 -1
- package/lib/vxe-column/index.js +3 -4
- package/lib/vxe-column/index.min.js +1 -1
- package/lib/vxe-grid/index.js +3 -4
- package/lib/vxe-grid/index.min.js +1 -1
- package/lib/vxe-grid/style/style.css +0 -1
- package/lib/vxe-grid/style/style.min.css +1 -1
- package/lib/vxe-table/index.js +3 -4
- package/lib/vxe-table/index.min.js +1 -1
- package/lib/vxe-table/style/style.css +37 -48
- package/lib/vxe-table/style/style.min.css +1 -1
- package/lib/vxe-toolbar/index.js +3 -4
- package/lib/vxe-toolbar/index.min.js +1 -1
- package/lib/vxe-toolbar/style/style.css +0 -1
- package/lib/vxe-toolbar/style/style.min.css +1 -1
- package/lib/vxe-ui/index.js +3 -4
- package/lib/vxe-ui/index.min.js +1 -1
- package/lib/vxe-v-x-e-table/index.js +3 -4
- package/lib/vxe-v-x-e-table/index.min.js +1 -1
- package/package.json +5 -4
- package/packages/grid/src/grid.ts +127 -65
- package/packages/locale/lang/en-US.ts +2 -1
- package/packages/locale/lang/es-ES.ts +2 -1
- package/packages/locale/lang/hu-HU.ts +2 -1
- package/packages/locale/lang/ja-JP.ts +2 -1
- package/packages/locale/lang/ko-KR.ts +2 -1
- package/packages/locale/lang/pt-BR.ts +2 -1
- package/packages/locale/lang/ru-RU.ts +2 -1
- package/packages/locale/lang/uk-UA.ts +2 -1
- package/packages/locale/lang/vi-VN.ts +2 -1
- package/packages/locale/lang/zh-CHT.ts +2 -1
- package/packages/locale/lang/zh-CN.ts +2 -1
- package/packages/table/module/custom/panel.ts +186 -175
- package/packages/table/module/edit/mixin.ts +32 -23
- package/packages/table/module/export/export-panel.ts +36 -4
- package/packages/table/module/export/import-panel.ts +29 -6
- package/packages/table/module/export/mixin.ts +11 -11
- package/packages/table/module/menu/mixin.ts +2 -2
- package/packages/table/module/validator/mixin.ts +4 -4
- package/packages/table/render/index.ts +20 -11
- package/packages/table/src/body.ts +1 -0
- package/packages/table/src/columnInfo.ts +3 -3
- package/packages/table/src/methods.ts +53 -42
- package/packages/table/src/props.ts +68 -15
- package/packages/table/src/table.ts +99 -54
- package/packages/table/src/util.ts +3 -2
- package/packages/toolbar/src/toolbar.ts +21 -7
- package/packages/ui/index.ts +3 -1
- package/styles/components/table.scss +82 -17
- package/types/all.d.ts +1 -0
- /package/es/{iconfont.1726453742001.ttf → iconfont.1728348263835.ttf} +0 -0
- /package/es/{iconfont.1726453742001.woff → iconfont.1728348263835.woff} +0 -0
- /package/es/{iconfont.1726453742001.woff2 → iconfont.1728348263835.woff2} +0 -0
- /package/lib/{iconfont.1726453742001.ttf → iconfont.1728348263835.ttf} +0 -0
- /package/lib/{iconfont.1726453742001.woff → iconfont.1728348263835.woff} +0 -0
- /package/lib/{iconfont.1726453742001.woff2 → iconfont.1728348263835.woff2} +0 -0
|
@@ -10,66 +10,79 @@ var _dom = require("../../../ui/src/dom");
|
|
|
10
10
|
var _log = require("../../../ui/src/log");
|
|
11
11
|
var _xeUtils = _interopRequireDefault(require("xe-utils"));
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const {
|
|
14
|
+
getI18n,
|
|
15
|
+
getIcon,
|
|
16
|
+
renderEmptyElement
|
|
17
|
+
} = _ui.VxeUI;
|
|
15
18
|
function updateDropHint(_vm, evnt) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
const {
|
|
20
|
+
$refs
|
|
21
|
+
} = _vm;
|
|
22
|
+
const dragHintEl = $refs.dragHintElemRef;
|
|
23
|
+
const bodyEl = $refs.bodyElemRef;
|
|
19
24
|
if (!bodyEl) {
|
|
20
25
|
return;
|
|
21
26
|
}
|
|
22
27
|
if (dragHintEl) {
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
const wrapperEl = bodyEl.parentNode;
|
|
29
|
+
const wrapperRect = wrapperEl.getBoundingClientRect();
|
|
25
30
|
dragHintEl.style.display = 'block';
|
|
26
|
-
dragHintEl.style.top =
|
|
27
|
-
dragHintEl.style.left =
|
|
31
|
+
dragHintEl.style.top = `${Math.min(wrapperEl.clientHeight - wrapperEl.scrollTop - dragHintEl.clientHeight, evnt.clientY - wrapperRect.y)}px`;
|
|
32
|
+
dragHintEl.style.left = `${Math.min(wrapperEl.clientWidth - wrapperEl.scrollLeft - dragHintEl.clientWidth - 16, evnt.clientX - wrapperRect.x)}px`;
|
|
28
33
|
}
|
|
29
34
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
35
|
+
const renderSimplePanel = (h, _vm) => {
|
|
36
|
+
const VxeUIButtonComponent = _ui.VxeUI.getComponent('VxeButton');
|
|
37
|
+
const {
|
|
38
|
+
_e,
|
|
39
|
+
$xetable,
|
|
40
|
+
customStore,
|
|
41
|
+
dragColumn
|
|
42
|
+
} = _vm;
|
|
43
|
+
const {
|
|
44
|
+
customColumnList,
|
|
45
|
+
customOpts,
|
|
46
|
+
isMaxFixedColumn
|
|
47
|
+
} = $xetable;
|
|
48
|
+
const {
|
|
49
|
+
maxHeight
|
|
50
|
+
} = customStore;
|
|
51
|
+
const {
|
|
52
|
+
checkMethod,
|
|
53
|
+
visibleMethod,
|
|
54
|
+
allowVisible,
|
|
55
|
+
allowSort,
|
|
56
|
+
allowFixed,
|
|
57
|
+
trigger,
|
|
58
|
+
placement
|
|
59
|
+
} = customOpts;
|
|
60
|
+
const colVNs = [];
|
|
61
|
+
const customWrapperOns = {};
|
|
49
62
|
// hover 触发
|
|
50
63
|
if (trigger === 'hover') {
|
|
51
64
|
customWrapperOns.mouseenter = _vm.handleWrapperMouseenterEvent;
|
|
52
65
|
customWrapperOns.mouseleave = _vm.handleWrapperMouseleaveEvent;
|
|
53
66
|
}
|
|
54
|
-
_xeUtils.default.eachTree(customColumnList,
|
|
55
|
-
|
|
56
|
-
column
|
|
67
|
+
_xeUtils.default.eachTree(customColumnList, (column, index, items, path, parent) => {
|
|
68
|
+
const isVisible = visibleMethod ? visibleMethod({
|
|
69
|
+
column
|
|
57
70
|
}) : true;
|
|
58
71
|
if (isVisible) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
column
|
|
72
|
+
const isChecked = column.renderVisible;
|
|
73
|
+
const isIndeterminate = column.halfVisible;
|
|
74
|
+
const isColGroup = column.children && column.children.length;
|
|
75
|
+
const colTitle = (0, _utils.formatText)(column.getTitle(), 1);
|
|
76
|
+
const isDisabled = checkMethod ? !checkMethod({
|
|
77
|
+
column
|
|
65
78
|
}) : false;
|
|
66
|
-
|
|
79
|
+
const isHidden = !isChecked;
|
|
67
80
|
colVNs.push(h('li', {
|
|
68
81
|
key: column.id,
|
|
69
82
|
attrs: {
|
|
70
83
|
colid: column.id
|
|
71
84
|
},
|
|
72
|
-
class: ['vxe-table-custom--option',
|
|
85
|
+
class: ['vxe-table-custom--option', `level--${column.level}`, {
|
|
73
86
|
'is--hidden': isHidden,
|
|
74
87
|
'is--group': isColGroup
|
|
75
88
|
}],
|
|
@@ -88,7 +101,7 @@ var renderSimplePanel = function renderSimplePanel(h, _vm) {
|
|
|
88
101
|
title: getI18n('vxe.custom.setting.colVisible')
|
|
89
102
|
},
|
|
90
103
|
on: {
|
|
91
|
-
click:
|
|
104
|
+
click: () => {
|
|
92
105
|
if (!isDisabled) {
|
|
93
106
|
_vm.changeCheckboxOption(column);
|
|
94
107
|
}
|
|
@@ -134,7 +147,7 @@ var renderSimplePanel = function renderSimplePanel(h, _vm) {
|
|
|
134
147
|
title: getI18n(column.renderFixed === 'left' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedLeft')
|
|
135
148
|
},
|
|
136
149
|
on: {
|
|
137
|
-
click:
|
|
150
|
+
click: () => {
|
|
138
151
|
_vm.changeFixedOption(column, 'left');
|
|
139
152
|
}
|
|
140
153
|
}
|
|
@@ -147,22 +160,22 @@ var renderSimplePanel = function renderSimplePanel(h, _vm) {
|
|
|
147
160
|
title: getI18n(column.renderFixed === 'right' ? 'vxe.toolbar.cancelFixed' : 'vxe.toolbar.fixedRight')
|
|
148
161
|
},
|
|
149
162
|
on: {
|
|
150
|
-
click:
|
|
163
|
+
click: () => {
|
|
151
164
|
_vm.changeFixedOption(column, 'right');
|
|
152
165
|
}
|
|
153
166
|
}
|
|
154
167
|
})]) : _e()]));
|
|
155
168
|
}
|
|
156
169
|
});
|
|
157
|
-
|
|
158
|
-
|
|
170
|
+
const isAllChecked = customStore.isAll;
|
|
171
|
+
const isAllIndeterminate = customStore.isIndeterminate;
|
|
159
172
|
return h('div', {
|
|
160
173
|
key: 'simple',
|
|
161
|
-
class: ['vxe-table-custom-wrapper',
|
|
174
|
+
class: ['vxe-table-custom-wrapper', `placement--${placement}`, {
|
|
162
175
|
'is--active': customStore.visible
|
|
163
176
|
}],
|
|
164
177
|
style: maxHeight && !['left', 'right'].includes(placement) ? {
|
|
165
|
-
maxHeight:
|
|
178
|
+
maxHeight: `${maxHeight}px`
|
|
166
179
|
} : {}
|
|
167
180
|
}, customStore.visible ? [h('ul', {
|
|
168
181
|
class: 'vxe-table-custom--header'
|
|
@@ -235,44 +248,56 @@ var renderSimplePanel = function renderSimplePanel(h, _vm) {
|
|
|
235
248
|
}
|
|
236
249
|
})]) : null] : []);
|
|
237
250
|
};
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
251
|
+
const renderPopupPanel = (h, _vm) => {
|
|
252
|
+
const VxeUIModalComponent = _ui.VxeUI.getComponent('VxeModal');
|
|
253
|
+
const VxeUIButtonComponent = _ui.VxeUI.getComponent('VxeButton');
|
|
254
|
+
const VxeUIInputComponent = _ui.VxeUI.getComponent('VxeInput');
|
|
255
|
+
const VxeUITooltipComponent = _ui.VxeUI.getComponent('VxeTooltip');
|
|
256
|
+
const $xeTableCustomPanel = _vm;
|
|
257
|
+
const {
|
|
258
|
+
_e,
|
|
259
|
+
$xetable,
|
|
260
|
+
customStore
|
|
261
|
+
} = _vm;
|
|
262
|
+
const {
|
|
263
|
+
customOpts,
|
|
264
|
+
customColumnList,
|
|
265
|
+
columnOpts,
|
|
266
|
+
isMaxFixedColumn
|
|
267
|
+
} = $xetable;
|
|
268
|
+
const {
|
|
269
|
+
modalOptions,
|
|
270
|
+
allowVisible,
|
|
271
|
+
allowSort,
|
|
272
|
+
allowFixed,
|
|
273
|
+
allowResizable,
|
|
274
|
+
checkMethod,
|
|
275
|
+
visibleMethod
|
|
276
|
+
} = customOpts;
|
|
277
|
+
const {
|
|
278
|
+
maxFixedSize
|
|
279
|
+
} = columnOpts;
|
|
280
|
+
const modalOpts = Object.assign({}, modalOptions);
|
|
281
|
+
const trVNs = [];
|
|
282
|
+
_xeUtils.default.eachTree(customColumnList, (column, index, items, path, parent) => {
|
|
283
|
+
const isVisible = visibleMethod ? visibleMethod({
|
|
284
|
+
column
|
|
260
285
|
}) : true;
|
|
261
286
|
if (isVisible) {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
column
|
|
287
|
+
const isChecked = column.renderVisible;
|
|
288
|
+
const isIndeterminate = column.halfVisible;
|
|
289
|
+
const colTitle = (0, _utils.formatText)(column.getTitle(), 1);
|
|
290
|
+
const isColGroup = column.children && column.children.length;
|
|
291
|
+
const isDisabled = checkMethod ? !checkMethod({
|
|
292
|
+
column
|
|
268
293
|
}) : false;
|
|
269
|
-
|
|
294
|
+
const isHidden = !isChecked;
|
|
270
295
|
trVNs.push(h('tr', {
|
|
271
296
|
key: column.id,
|
|
272
297
|
attrs: {
|
|
273
298
|
colid: column.id
|
|
274
299
|
},
|
|
275
|
-
class: [
|
|
300
|
+
class: [`vxe-table-custom-popup--row level--${column.level}`, {
|
|
276
301
|
'is--group': isColGroup
|
|
277
302
|
}],
|
|
278
303
|
on: {
|
|
@@ -292,7 +317,7 @@ var renderPopupPanel = function renderPopupPanel(h, _vm) {
|
|
|
292
317
|
title: getI18n('vxe.custom.setting.colVisible')
|
|
293
318
|
},
|
|
294
319
|
on: {
|
|
295
|
-
click:
|
|
320
|
+
click: () => {
|
|
296
321
|
if (!isDisabled) {
|
|
297
322
|
_vm.changeCheckboxOption(column);
|
|
298
323
|
}
|
|
@@ -331,18 +356,18 @@ var renderPopupPanel = function renderPopupPanel(h, _vm) {
|
|
|
331
356
|
}
|
|
332
357
|
}, colTitle)]), allowResizable ? h('td', {
|
|
333
358
|
class: 'vxe-table-custom-popup--column-item col--resizable'
|
|
334
|
-
}, [column.children && column.children.length ? h('span', '-') : h(
|
|
359
|
+
}, [column.children && column.children.length ? h('span', '-') : VxeUIInputComponent ? h(VxeUIInputComponent, {
|
|
335
360
|
props: {
|
|
336
361
|
type: 'integer',
|
|
337
362
|
disabled: isHidden,
|
|
338
363
|
value: column.renderResizeWidth
|
|
339
364
|
},
|
|
340
365
|
on: {
|
|
341
|
-
modelValue
|
|
366
|
+
modelValue(value) {
|
|
342
367
|
column.renderResizeWidth = Math.max(0, Number(value));
|
|
343
368
|
}
|
|
344
369
|
}
|
|
345
|
-
})]) : _e(), allowFixed ? h('td', {
|
|
370
|
+
}) : renderEmptyElement($xeTableCustomPanel)]) : _e(), allowFixed ? h('td', {
|
|
346
371
|
class: 'vxe-table-custom-popup--column-item col--fixed'
|
|
347
372
|
}, [parent ? h('span', '-') : h('vxe-radio-group', {
|
|
348
373
|
props: {
|
|
@@ -365,16 +390,16 @@ var renderPopupPanel = function renderPopupPanel(h, _vm) {
|
|
|
365
390
|
}]
|
|
366
391
|
},
|
|
367
392
|
on: {
|
|
368
|
-
input
|
|
393
|
+
input(value) {
|
|
369
394
|
column.renderFixed = value;
|
|
370
395
|
}
|
|
371
396
|
}
|
|
372
397
|
})]) : _e()]));
|
|
373
398
|
}
|
|
374
399
|
});
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
return h(
|
|
400
|
+
const isAllChecked = customStore.isAll;
|
|
401
|
+
const isAllIndeterminate = customStore.isIndeterminate;
|
|
402
|
+
return VxeUIModalComponent ? h(VxeUIModalComponent, {
|
|
378
403
|
key: 'modal',
|
|
379
404
|
props: {
|
|
380
405
|
className: ['vxe-table-custom-popup-wrapper', 'vxe-table--ignore-clear', modalOpts.className || ''].join(' '),
|
|
@@ -393,12 +418,12 @@ var renderPopupPanel = function renderPopupPanel(h, _vm) {
|
|
|
393
418
|
showFooter: true
|
|
394
419
|
},
|
|
395
420
|
on: {
|
|
396
|
-
input
|
|
421
|
+
input(value) {
|
|
397
422
|
customStore.visible = value;
|
|
398
423
|
}
|
|
399
424
|
},
|
|
400
425
|
scopedSlots: {
|
|
401
|
-
default:
|
|
426
|
+
default: () => {
|
|
402
427
|
return h('div', {
|
|
403
428
|
ref: 'bodyElemRef',
|
|
404
429
|
class: 'vxe-table-custom-popup--body'
|
|
@@ -441,20 +466,20 @@ var renderPopupPanel = function renderPopupPanel(h, _vm) {
|
|
|
441
466
|
class: 'vxe-checkbox--label'
|
|
442
467
|
}, getI18n('vxe.toolbar.customAll'))])]) : _e(), allowSort ? h('th', {}, [h('span', {
|
|
443
468
|
class: 'vxe-table-custom-popup--table-sort-help-title'
|
|
444
|
-
}, getI18n('vxe.custom.setting.colSort')), h(
|
|
469
|
+
}, getI18n('vxe.custom.setting.colSort')), VxeUITooltipComponent ? h(VxeUITooltipComponent, {
|
|
445
470
|
props: {
|
|
446
471
|
enterable: true,
|
|
447
472
|
content: getI18n('vxe.custom.setting.sortHelpTip'),
|
|
448
473
|
popupClassName: 'vxe-table--ignore-clear'
|
|
449
474
|
},
|
|
450
475
|
scopedSlots: {
|
|
451
|
-
default:
|
|
476
|
+
default: () => {
|
|
452
477
|
return h('i', {
|
|
453
478
|
class: 'vxe-table-custom-popup--table-sort-help-icon vxe-icon-question-circle-fill'
|
|
454
479
|
});
|
|
455
480
|
}
|
|
456
481
|
}
|
|
457
|
-
})]) : _e(), h('th', {}, getI18n('vxe.custom.setting.colTitle')), allowResizable ? h('th', {}, getI18n('vxe.custom.setting.colResizable')) : _e(), allowFixed ? h('th', {}, getI18n(
|
|
482
|
+
}) : renderEmptyElement($xeTableCustomPanel)]) : _e(), h('th', {}, getI18n('vxe.custom.setting.colTitle')), allowResizable ? h('th', {}, getI18n('vxe.custom.setting.colResizable')) : _e(), allowFixed ? h('th', {}, getI18n(`vxe.custom.setting.${maxFixedSize ? 'colFixedMax' : 'colFixed'}`, [maxFixedSize])) : _e()])]), h('transition-group', {
|
|
458
483
|
class: 'vxe-table-custom--body',
|
|
459
484
|
props: {
|
|
460
485
|
tag: 'tbody',
|
|
@@ -465,7 +490,7 @@ var renderPopupPanel = function renderPopupPanel(h, _vm) {
|
|
|
465
490
|
class: 'vxe-table-custom-popup--drag-hint'
|
|
466
491
|
}, getI18n('vxe.custom.cstmDragTarget', [_vm.dragColumn ? _vm.dragColumn.getTitle() : '']))]);
|
|
467
492
|
},
|
|
468
|
-
footer:
|
|
493
|
+
footer: () => {
|
|
469
494
|
return h('div', {
|
|
470
495
|
class: 'vxe-table-custom-popup--footer'
|
|
471
496
|
}, [h(VxeUIButtonComponent, {
|
|
@@ -493,16 +518,14 @@ var renderPopupPanel = function renderPopupPanel(h, _vm) {
|
|
|
493
518
|
})]);
|
|
494
519
|
}
|
|
495
520
|
}
|
|
496
|
-
});
|
|
521
|
+
}) : renderEmptyElement($xeTableCustomPanel);
|
|
497
522
|
};
|
|
498
|
-
var
|
|
523
|
+
var _default = exports.default = {
|
|
499
524
|
name: 'VxeTableCustomPanel',
|
|
500
525
|
props: {
|
|
501
526
|
customStore: {
|
|
502
527
|
type: Object,
|
|
503
|
-
default:
|
|
504
|
-
return {};
|
|
505
|
-
}
|
|
528
|
+
default: () => ({})
|
|
506
529
|
}
|
|
507
530
|
},
|
|
508
531
|
inject: {
|
|
@@ -510,25 +533,30 @@ var _default2 = exports.default = {
|
|
|
510
533
|
default: null
|
|
511
534
|
}
|
|
512
535
|
},
|
|
513
|
-
data
|
|
536
|
+
data() {
|
|
514
537
|
return {
|
|
515
538
|
dragColumn: null
|
|
516
539
|
};
|
|
517
540
|
},
|
|
518
541
|
computed: {},
|
|
519
|
-
created
|
|
520
|
-
var _this = this;
|
|
542
|
+
created() {
|
|
521
543
|
if (process.env.NODE_ENV === 'development') {
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
this.$nextTick(
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
544
|
+
const VxeUIModalComponent = _ui.VxeUI.getComponent('VxeModal');
|
|
545
|
+
const VxeUIDrawerComponent = _ui.VxeUI.getComponent('VxeDrawer');
|
|
546
|
+
const VxeUIButtonComponent = _ui.VxeUI.getComponent('VxeButton');
|
|
547
|
+
const VxeUIInputComponent = _ui.VxeUI.getComponent('VxeInput');
|
|
548
|
+
const VxeUITooltipComponent = _ui.VxeUI.getComponent('VxeTooltip');
|
|
549
|
+
const VxeUIRadioGroupComponent = _ui.VxeUI.getComponent('VxeRadioGroup');
|
|
550
|
+
this.$nextTick(() => {
|
|
551
|
+
const {
|
|
552
|
+
$xetable
|
|
553
|
+
} = this;
|
|
554
|
+
const {
|
|
555
|
+
customOpts
|
|
556
|
+
} = $xetable;
|
|
557
|
+
const {
|
|
558
|
+
mode
|
|
559
|
+
} = customOpts;
|
|
532
560
|
if (!VxeUIModalComponent) {
|
|
533
561
|
(0, _log.errLog)('vxe.error.reqComp', ['vxe-modal']);
|
|
534
562
|
}
|
|
@@ -550,49 +578,63 @@ var _default2 = exports.default = {
|
|
|
550
578
|
});
|
|
551
579
|
}
|
|
552
580
|
},
|
|
553
|
-
render
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
581
|
+
render(h) {
|
|
582
|
+
const {
|
|
583
|
+
$xetable
|
|
584
|
+
} = this;
|
|
585
|
+
const {
|
|
586
|
+
customOpts
|
|
587
|
+
} = $xetable;
|
|
588
|
+
if (['modal', 'popup'].includes(`${customOpts.mode}`)) {
|
|
557
589
|
return renderPopupPanel(h, this);
|
|
558
590
|
}
|
|
559
591
|
return renderSimplePanel(h, this);
|
|
560
592
|
},
|
|
561
593
|
methods: {
|
|
562
|
-
handleWrapperMouseenterEvent
|
|
563
|
-
|
|
564
|
-
|
|
594
|
+
handleWrapperMouseenterEvent(evnt) {
|
|
595
|
+
const {
|
|
596
|
+
$xetable,
|
|
597
|
+
customStore
|
|
598
|
+
} = this;
|
|
565
599
|
customStore.activeWrapper = true;
|
|
566
600
|
$xetable.customOpenEvent(evnt);
|
|
567
601
|
},
|
|
568
|
-
handleWrapperMouseleaveEvent
|
|
569
|
-
|
|
570
|
-
|
|
602
|
+
handleWrapperMouseleaveEvent(evnt) {
|
|
603
|
+
const {
|
|
604
|
+
$xetable,
|
|
605
|
+
customStore
|
|
606
|
+
} = this;
|
|
571
607
|
customStore.activeWrapper = false;
|
|
572
|
-
setTimeout(
|
|
608
|
+
setTimeout(() => {
|
|
573
609
|
if (!customStore.activeBtn && !customStore.activeWrapper) {
|
|
574
610
|
$xetable.customColseEvent(evnt);
|
|
575
611
|
}
|
|
576
612
|
}, 300);
|
|
577
613
|
},
|
|
578
|
-
getStoreData
|
|
614
|
+
getStoreData() {
|
|
579
615
|
return {};
|
|
580
616
|
},
|
|
581
|
-
confirmCustomEvent
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
617
|
+
confirmCustomEvent(evnt) {
|
|
618
|
+
const {
|
|
619
|
+
$xetable
|
|
620
|
+
} = this;
|
|
621
|
+
const {
|
|
622
|
+
customOpts,
|
|
623
|
+
customColumnList
|
|
624
|
+
} = $xetable;
|
|
625
|
+
const {
|
|
626
|
+
allowVisible,
|
|
627
|
+
allowSort,
|
|
628
|
+
allowFixed,
|
|
629
|
+
allowResizable
|
|
630
|
+
} = customOpts;
|
|
631
|
+
_xeUtils.default.eachTree(customColumnList, (column, index, items, path, parent) => {
|
|
590
632
|
if (parent) {
|
|
591
633
|
// 更新子列信息
|
|
592
634
|
column.fixed = parent.fixed;
|
|
593
635
|
} else {
|
|
594
636
|
if (allowSort) {
|
|
595
|
-
|
|
637
|
+
const sortIndex = index + 1;
|
|
596
638
|
column.renderSortNumber = sortIndex;
|
|
597
639
|
}
|
|
598
640
|
if (allowFixed) {
|
|
@@ -615,28 +657,39 @@ var _default2 = exports.default = {
|
|
|
615
657
|
$xetable.emitCustomEvent('confirm', evnt);
|
|
616
658
|
$xetable.saveCustomStore('confirm');
|
|
617
659
|
},
|
|
618
|
-
cancelCloseEvent
|
|
619
|
-
|
|
620
|
-
|
|
660
|
+
cancelCloseEvent({
|
|
661
|
+
$event
|
|
662
|
+
}) {
|
|
663
|
+
const {
|
|
664
|
+
$xetable
|
|
665
|
+
} = this;
|
|
621
666
|
$xetable.closeCustom();
|
|
622
667
|
$xetable.emitCustomEvent('cancel', $event);
|
|
623
668
|
},
|
|
624
|
-
cancelCustomEvent
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
669
|
+
cancelCustomEvent(evnt) {
|
|
670
|
+
const {
|
|
671
|
+
$xetable
|
|
672
|
+
} = this;
|
|
673
|
+
const {
|
|
674
|
+
customStore,
|
|
675
|
+
customOpts,
|
|
676
|
+
customColumnList
|
|
677
|
+
} = $xetable;
|
|
678
|
+
const {
|
|
679
|
+
oldSortMaps,
|
|
680
|
+
oldFixedMaps,
|
|
681
|
+
oldVisibleMaps
|
|
682
|
+
} = customStore;
|
|
683
|
+
const {
|
|
684
|
+
allowVisible,
|
|
685
|
+
allowSort,
|
|
686
|
+
allowFixed,
|
|
687
|
+
allowResizable
|
|
688
|
+
} = customOpts;
|
|
689
|
+
_xeUtils.default.eachTree(customColumnList, column => {
|
|
690
|
+
const colid = column.getKey();
|
|
691
|
+
const visible = !!oldVisibleMaps[colid];
|
|
692
|
+
const fixed = oldFixedMaps[colid] || '';
|
|
640
693
|
if (allowVisible) {
|
|
641
694
|
column.renderVisible = visible;
|
|
642
695
|
column.visible = visible;
|
|
@@ -657,69 +710,73 @@ var _default2 = exports.default = {
|
|
|
657
710
|
$xetable.closeCustom();
|
|
658
711
|
$xetable.emitCustomEvent('cancel', evnt);
|
|
659
712
|
},
|
|
660
|
-
handleResetCustomEvent
|
|
661
|
-
|
|
713
|
+
handleResetCustomEvent(evnt) {
|
|
714
|
+
const {
|
|
715
|
+
$xetable
|
|
716
|
+
} = this;
|
|
662
717
|
$xetable.resetColumn(true);
|
|
663
718
|
$xetable.closeCustom();
|
|
664
719
|
$xetable.emitCustomEvent('reset', evnt);
|
|
665
720
|
},
|
|
666
|
-
resetCustomEvent
|
|
667
|
-
var _this2 = this;
|
|
721
|
+
resetCustomEvent(evnt) {
|
|
668
722
|
if (_ui.VxeUI.modal) {
|
|
669
723
|
_ui.VxeUI.modal.confirm({
|
|
670
724
|
content: getI18n('vxe.custom.cstmConfirmRestore'),
|
|
671
725
|
className: 'vxe-table--ignore-clear',
|
|
672
726
|
escClosable: true
|
|
673
|
-
}).then(
|
|
727
|
+
}).then(type => {
|
|
674
728
|
if (type === 'confirm') {
|
|
675
|
-
|
|
729
|
+
this.handleResetCustomEvent(evnt);
|
|
676
730
|
}
|
|
677
731
|
});
|
|
678
732
|
} else {
|
|
679
733
|
this.handleResetCustomEvent(evnt);
|
|
680
734
|
}
|
|
681
735
|
},
|
|
682
|
-
resetPopupCustomEvent
|
|
683
|
-
var _this3 = this;
|
|
736
|
+
resetPopupCustomEvent(evnt) {
|
|
684
737
|
if (_ui.VxeUI.modal) {
|
|
685
738
|
_ui.VxeUI.modal.confirm({
|
|
686
739
|
content: getI18n('vxe.custom.cstmConfirmRestore'),
|
|
687
740
|
className: 'vxe-table--ignore-clear',
|
|
688
741
|
escClosable: true
|
|
689
|
-
}).then(
|
|
742
|
+
}).then(type => {
|
|
690
743
|
if (type === 'confirm') {
|
|
691
|
-
|
|
744
|
+
this.resetCustomEvent(evnt);
|
|
692
745
|
}
|
|
693
746
|
});
|
|
694
747
|
} else {
|
|
695
748
|
this.resetCustomEvent(evnt);
|
|
696
749
|
}
|
|
697
750
|
},
|
|
698
|
-
handleOptionCheck
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
751
|
+
handleOptionCheck(column) {
|
|
752
|
+
const {
|
|
753
|
+
$xetable
|
|
754
|
+
} = this;
|
|
755
|
+
const {
|
|
756
|
+
customColumnList
|
|
757
|
+
} = $xetable;
|
|
758
|
+
const matchObj = _xeUtils.default.findTree(customColumnList, item => item === column);
|
|
704
759
|
if (matchObj && matchObj.parent) {
|
|
705
|
-
|
|
760
|
+
const {
|
|
761
|
+
parent
|
|
762
|
+
} = matchObj;
|
|
706
763
|
if (parent.children && parent.children.length) {
|
|
707
|
-
parent.visible = parent.children.every(
|
|
708
|
-
|
|
709
|
-
});
|
|
710
|
-
parent.halfVisible = !parent.visible && parent.children.some(function (column) {
|
|
711
|
-
return column.visible || column.halfVisible;
|
|
712
|
-
});
|
|
764
|
+
parent.visible = parent.children.every(column => column.visible);
|
|
765
|
+
parent.halfVisible = !parent.visible && parent.children.some(column => column.visible || column.halfVisible);
|
|
713
766
|
this.handleOptionCheck(parent);
|
|
714
767
|
}
|
|
715
768
|
}
|
|
716
769
|
},
|
|
717
|
-
changeCheckboxOption
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
770
|
+
changeCheckboxOption(column) {
|
|
771
|
+
const {
|
|
772
|
+
$xetable
|
|
773
|
+
} = this;
|
|
774
|
+
const {
|
|
775
|
+
customOpts
|
|
776
|
+
} = $xetable;
|
|
777
|
+
const isChecked = !column.renderVisible;
|
|
721
778
|
if (customOpts.immediate) {
|
|
722
|
-
_xeUtils.default.eachTree([column],
|
|
779
|
+
_xeUtils.default.eachTree([column], item => {
|
|
723
780
|
item.visible = isChecked;
|
|
724
781
|
item.renderVisible = isChecked;
|
|
725
782
|
item.halfVisible = false;
|
|
@@ -727,7 +784,7 @@ var _default2 = exports.default = {
|
|
|
727
784
|
$xetable.handleCustom();
|
|
728
785
|
$xetable.saveCustomStore('update:visible');
|
|
729
786
|
} else {
|
|
730
|
-
_xeUtils.default.eachTree([column],
|
|
787
|
+
_xeUtils.default.eachTree([column], item => {
|
|
731
788
|
item.renderVisible = isChecked;
|
|
732
789
|
item.halfVisible = false;
|
|
733
790
|
});
|
|
@@ -735,19 +792,23 @@ var _default2 = exports.default = {
|
|
|
735
792
|
this.handleOptionCheck(column);
|
|
736
793
|
$xetable.checkCustomStatus();
|
|
737
794
|
},
|
|
738
|
-
changeFixedOption
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
795
|
+
changeFixedOption(column, colFixed) {
|
|
796
|
+
const {
|
|
797
|
+
$xetable
|
|
798
|
+
} = this;
|
|
799
|
+
const {
|
|
800
|
+
isMaxFixedColumn,
|
|
801
|
+
customOpts
|
|
802
|
+
} = $xetable;
|
|
742
803
|
if (customOpts.immediate) {
|
|
743
804
|
if (column.renderFixed === colFixed) {
|
|
744
|
-
_xeUtils.default.eachTree([column],
|
|
805
|
+
_xeUtils.default.eachTree([column], col => {
|
|
745
806
|
col.fixed = '';
|
|
746
807
|
col.renderFixed = '';
|
|
747
808
|
});
|
|
748
809
|
} else {
|
|
749
810
|
if (!isMaxFixedColumn || column.renderFixed) {
|
|
750
|
-
_xeUtils.default.eachTree([column],
|
|
811
|
+
_xeUtils.default.eachTree([column], col => {
|
|
751
812
|
col.fixed = colFixed;
|
|
752
813
|
col.renderFixed = colFixed;
|
|
753
814
|
});
|
|
@@ -757,29 +818,35 @@ var _default2 = exports.default = {
|
|
|
757
818
|
$xetable.saveCustomStore('update:fixed');
|
|
758
819
|
} else {
|
|
759
820
|
if (column.renderFixed === colFixed) {
|
|
760
|
-
_xeUtils.default.eachTree([column],
|
|
821
|
+
_xeUtils.default.eachTree([column], col => {
|
|
761
822
|
col.renderFixed = '';
|
|
762
823
|
});
|
|
763
824
|
} else {
|
|
764
825
|
if (!isMaxFixedColumn || column.renderFixed) {
|
|
765
|
-
_xeUtils.default.eachTree([column],
|
|
826
|
+
_xeUtils.default.eachTree([column], col => {
|
|
766
827
|
col.renderFixed = colFixed;
|
|
767
828
|
});
|
|
768
829
|
}
|
|
769
830
|
}
|
|
770
831
|
}
|
|
771
832
|
},
|
|
772
|
-
allOptionEvent
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
833
|
+
allOptionEvent() {
|
|
834
|
+
const {
|
|
835
|
+
$xetable,
|
|
836
|
+
customStore
|
|
837
|
+
} = this;
|
|
838
|
+
const {
|
|
839
|
+
customColumnList,
|
|
840
|
+
customOpts
|
|
841
|
+
} = $xetable;
|
|
842
|
+
const {
|
|
843
|
+
checkMethod
|
|
844
|
+
} = customOpts;
|
|
845
|
+
const isAll = !customStore.isAll;
|
|
779
846
|
if (customOpts.immediate) {
|
|
780
|
-
_xeUtils.default.eachTree(customColumnList,
|
|
847
|
+
_xeUtils.default.eachTree(customColumnList, column => {
|
|
781
848
|
if (!checkMethod || checkMethod({
|
|
782
|
-
column
|
|
849
|
+
column
|
|
783
850
|
})) {
|
|
784
851
|
column.visible = isAll;
|
|
785
852
|
column.renderVisible = isAll;
|
|
@@ -790,9 +857,9 @@ var _default2 = exports.default = {
|
|
|
790
857
|
$xetable.handleCustom();
|
|
791
858
|
$xetable.saveCustomStore('update:visible');
|
|
792
859
|
} else {
|
|
793
|
-
_xeUtils.default.eachTree(customColumnList,
|
|
860
|
+
_xeUtils.default.eachTree(customColumnList, column => {
|
|
794
861
|
if (!checkMethod || checkMethod({
|
|
795
|
-
column
|
|
862
|
+
column
|
|
796
863
|
})) {
|
|
797
864
|
column.renderVisible = isAll;
|
|
798
865
|
column.halfVisible = false;
|
|
@@ -802,22 +869,24 @@ var _default2 = exports.default = {
|
|
|
802
869
|
}
|
|
803
870
|
$xetable.checkCustomStatus();
|
|
804
871
|
},
|
|
805
|
-
sortMousedownEvent
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
872
|
+
sortMousedownEvent(evnt) {
|
|
873
|
+
const {
|
|
874
|
+
$xetable
|
|
875
|
+
} = this;
|
|
876
|
+
const btnEl = evnt.currentTarget;
|
|
877
|
+
const tdEl = btnEl.parentNode;
|
|
878
|
+
const trEl = tdEl.parentNode;
|
|
879
|
+
const colid = trEl.getAttribute('colid');
|
|
880
|
+
const column = $xetable.getColumnById(colid);
|
|
812
881
|
trEl.draggable = true;
|
|
813
882
|
this.dragColumn = column;
|
|
814
883
|
(0, _dom.addClass)(trEl, 'active--drag-origin');
|
|
815
884
|
},
|
|
816
|
-
sortMouseupEvent
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
885
|
+
sortMouseupEvent(evnt) {
|
|
886
|
+
const btnEl = evnt.currentTarget;
|
|
887
|
+
const tdEl = btnEl.parentNode;
|
|
888
|
+
const trEl = tdEl.parentNode;
|
|
889
|
+
const dragHintEl = this.$refs.dragHintElemRef;
|
|
821
890
|
trEl.draggable = false;
|
|
822
891
|
this.dragColumn = null;
|
|
823
892
|
(0, _dom.removeClass)(trEl, 'active--drag-origin');
|
|
@@ -825,41 +894,41 @@ var _default2 = exports.default = {
|
|
|
825
894
|
dragHintEl.style.display = '';
|
|
826
895
|
}
|
|
827
896
|
},
|
|
828
|
-
sortDragstartEvent
|
|
829
|
-
|
|
897
|
+
sortDragstartEvent(evnt) {
|
|
898
|
+
const img = new Image();
|
|
830
899
|
if (evnt.dataTransfer) {
|
|
831
900
|
evnt.dataTransfer.setDragImage(img, 0, 0);
|
|
832
901
|
}
|
|
833
902
|
},
|
|
834
|
-
sortDragendEvent
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
903
|
+
sortDragendEvent(evnt) {
|
|
904
|
+
const {
|
|
905
|
+
$xetable,
|
|
906
|
+
prevDropTrEl
|
|
907
|
+
} = this;
|
|
908
|
+
const {
|
|
909
|
+
customColumnList,
|
|
910
|
+
customOpts
|
|
911
|
+
} = $xetable;
|
|
912
|
+
const trEl = evnt.currentTarget;
|
|
913
|
+
const dragHintEl = this.$refs.dragHintElemRef;
|
|
841
914
|
if (prevDropTrEl) {
|
|
842
915
|
// 判断是否有拖动
|
|
843
916
|
if (prevDropTrEl !== trEl) {
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
917
|
+
const dragOffset = prevDropTrEl.getAttribute('drag-pos');
|
|
918
|
+
const colid = trEl.getAttribute('colid');
|
|
919
|
+
const column = $xetable.getColumnById(colid);
|
|
847
920
|
if (!column) {
|
|
848
921
|
return;
|
|
849
922
|
}
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
var targetColid = prevDropTrEl.getAttribute('colid');
|
|
854
|
-
var targetColumn = $xetable.getColumnById(targetColid);
|
|
923
|
+
const cIndex = _xeUtils.default.findIndexOf(customColumnList, item => item.id === column.id);
|
|
924
|
+
const targetColid = prevDropTrEl.getAttribute('colid');
|
|
925
|
+
const targetColumn = $xetable.getColumnById(targetColid);
|
|
855
926
|
if (!targetColumn) {
|
|
856
927
|
return;
|
|
857
928
|
}
|
|
858
929
|
// 移出源位置
|
|
859
930
|
customColumnList.splice(cIndex, 1);
|
|
860
|
-
|
|
861
|
-
return item.id === targetColumn.id;
|
|
862
|
-
});
|
|
931
|
+
const tcIndex = _xeUtils.default.findIndexOf(customColumnList, item => item.id === targetColumn.id);
|
|
863
932
|
// 插新位置
|
|
864
933
|
customColumnList.splice(tcIndex + (dragOffset === 'bottom' ? 1 : 0), 0, column);
|
|
865
934
|
}
|
|
@@ -876,9 +945,9 @@ var _default2 = exports.default = {
|
|
|
876
945
|
(0, _dom.removeClass)(trEl, 'active--drag-target');
|
|
877
946
|
(0, _dom.removeClass)(trEl, 'active--drag-origin');
|
|
878
947
|
if (customOpts.immediate) {
|
|
879
|
-
_xeUtils.default.eachTree(customColumnList,
|
|
948
|
+
_xeUtils.default.eachTree(customColumnList, (column, index, items, path, parent) => {
|
|
880
949
|
if (!parent) {
|
|
881
|
-
|
|
950
|
+
const sortIndex = index + 1;
|
|
882
951
|
column.renderSortNumber = sortIndex;
|
|
883
952
|
}
|
|
884
953
|
});
|
|
@@ -886,20 +955,22 @@ var _default2 = exports.default = {
|
|
|
886
955
|
$xetable.saveCustomStore('update:sort');
|
|
887
956
|
}
|
|
888
957
|
},
|
|
889
|
-
sortDragoverEvent
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
958
|
+
sortDragoverEvent(evnt) {
|
|
959
|
+
const {
|
|
960
|
+
$xetable,
|
|
961
|
+
prevDropTrEl
|
|
962
|
+
} = this;
|
|
963
|
+
const trEl = evnt.currentTarget;
|
|
893
964
|
if (prevDropTrEl !== trEl) {
|
|
894
965
|
(0, _dom.removeClass)(prevDropTrEl, 'active--drag-target');
|
|
895
966
|
}
|
|
896
|
-
|
|
897
|
-
|
|
967
|
+
const colid = trEl.getAttribute('colid');
|
|
968
|
+
const column = $xetable.getColumnById(colid);
|
|
898
969
|
// 是否移入有效元行
|
|
899
970
|
if (column && column.level === 1) {
|
|
900
971
|
evnt.preventDefault();
|
|
901
|
-
|
|
902
|
-
|
|
972
|
+
const offsetY = evnt.clientY - trEl.getBoundingClientRect().y;
|
|
973
|
+
const dragOffset = offsetY < trEl.clientHeight / 2 ? 'top' : 'bottom';
|
|
903
974
|
(0, _dom.addClass)(trEl, 'active--drag-target');
|
|
904
975
|
trEl.setAttribute('drag-pos', dragOffset);
|
|
905
976
|
this.prevDropTrEl = trEl;
|