vxe-table 3.9.0-rc.8 → 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 -8
- package/es/locale/lang/es-ES.js +2 -1
- package/es/locale/lang/hu-HU.d.ts +2 -0
- package/es/locale/lang/hu-HU.js +497 -501
- package/es/locale/lang/ja-JP.js +2 -8
- package/es/locale/lang/ko-KR.d.ts +2 -0
- package/es/locale/lang/ko-KR.js +2 -8
- package/es/locale/lang/pt-BR.js +2 -8
- package/es/locale/lang/ru-RU.d.ts +2 -0
- package/es/locale/lang/ru-RU.js +497 -503
- package/es/locale/lang/uk-UA.d.ts +2 -0
- package/es/locale/lang/uk-UA.js +667 -0
- package/es/locale/lang/vi-VN.js +2 -8
- package/es/locale/lang/zh-CHT.d.ts +2 -0
- package/es/locale/lang/zh-CHT.js +667 -0
- package/es/locale/lang/zh-CN.js +2 -8
- package/es/locale/lang/zh-HK.js +2 -2
- package/es/locale/lang/zh-MO.js +2 -2
- package/es/locale/lang/zh-TC.js +2 -673
- package/es/locale/lang/zh-TW.js +2 -2
- 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 +175 -60
- 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 +9212 -17224
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/en-US.js +2 -8
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +2 -8
- 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.d.ts +2 -0
- package/lib/locale/lang/hu-HU.js +497 -501
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +687 -0
- package/lib/locale/lang/ja-JP.js +2 -8
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +2 -8
- package/lib/locale/lang/ko-KR.d.ts +2 -0
- package/lib/locale/lang/ko-KR.js +2 -8
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +687 -0
- package/lib/locale/lang/pt-BR.js +2 -8
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +2 -8
- package/lib/locale/lang/ru-RU.d.ts +2 -0
- package/lib/locale/lang/ru-RU.js +497 -503
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +687 -0
- package/lib/locale/lang/uk-UA.d.ts +2 -0
- package/lib/locale/lang/uk-UA.js +673 -0
- package/lib/locale/lang/uk-UA.min.js +1 -0
- package/lib/locale/lang/uk-UA.umd.js +687 -0
- package/lib/locale/lang/vi-VN.js +2 -8
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.d.ts +2 -0
- package/lib/locale/lang/zh-CHT.js +673 -0
- package/lib/locale/lang/zh-CHT.min.js +1 -0
- package/lib/locale/lang/zh-CHT.umd.js +687 -0
- package/lib/locale/lang/zh-CN.js +2 -8
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +2 -8
- package/lib/locale/lang/zh-HK.js +2 -2
- package/lib/locale/lang/zh-HK.min.js +1 -1
- package/lib/locale/lang/zh-HK.umd.js +7 -677
- package/lib/locale/lang/zh-MO.js +2 -2
- package/lib/locale/lang/zh-MO.min.js +1 -1
- package/lib/locale/lang/zh-MO.umd.js +7 -677
- package/lib/locale/lang/zh-TC.js +3 -673
- package/lib/locale/lang/zh-TC.min.js +1 -1
- package/lib/locale/lang/zh-TC.umd.js +7 -677
- package/lib/locale/lang/zh-TW.js +2 -2
- package/lib/locale/lang/zh-TW.min.js +1 -1
- package/lib/locale/lang/zh-TW.umd.js +7 -677
- 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 +519 -397
- 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 -10
- package/packages/locale/lang/es-ES.ts +2 -1
- package/packages/locale/lang/hu-HU.ts +497 -503
- package/packages/locale/lang/ja-JP.ts +2 -10
- package/packages/locale/lang/ko-KR.ts +2 -10
- package/packages/locale/lang/pt-BR.ts +2 -10
- package/packages/locale/lang/ru-RU.ts +497 -505
- package/packages/locale/lang/uk-UA.ts +667 -0
- package/packages/locale/lang/vi-VN.ts +2 -10
- package/packages/locale/lang/zh-CHT.ts +667 -0
- package/packages/locale/lang/zh-CN.ts +2 -10
- package/packages/locale/lang/zh-HK.ts +2 -2
- package/packages/locale/lang/zh-MO.ts +2 -2
- package/packages/locale/lang/zh-TC.ts +2 -674
- package/packages/locale/lang/zh-TW.ts +2 -2
- 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 +183 -57
- 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.1726318179195.ttf → iconfont.1728348263835.ttf} +0 -0
- /package/es/{iconfont.1726318179195.woff → iconfont.1728348263835.woff} +0 -0
- /package/es/{iconfont.1726318179195.woff2 → iconfont.1728348263835.woff2} +0 -0
- /package/lib/{iconfont.1726318179195.ttf → iconfont.1728348263835.ttf} +0 -0
- /package/lib/{iconfont.1726318179195.woff → iconfont.1728348263835.woff} +0 -0
- /package/lib/{iconfont.1726318179195.woff2 → iconfont.1728348263835.woff2} +0 -0
package/lib/table/src/body.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -12,36 +11,35 @@ var _util = require("./util");
|
|
|
12
11
|
var _dom = require("../../ui/src/dom");
|
|
13
12
|
var _vn = require("../../ui/src/vn");
|
|
14
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
21
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
22
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
23
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
24
|
-
var getI18n = _ui.VxeUI.getI18n,
|
|
25
|
-
renderer = _ui.VxeUI.renderer;
|
|
26
|
-
var renderType = 'body';
|
|
14
|
+
const {
|
|
15
|
+
getI18n,
|
|
16
|
+
renderer
|
|
17
|
+
} = _ui.VxeUI;
|
|
18
|
+
const renderType = 'body';
|
|
27
19
|
// 滚动、拖动过程中不需要触发
|
|
28
20
|
function isVMScrollProcess($xetable) {
|
|
29
21
|
return $xetable._isResize || $xetable.lastScrollTime && Date.now() < $xetable.lastScrollTime + $xetable.delayHover;
|
|
30
22
|
}
|
|
31
23
|
function renderLine(h, _vm, $xetable, params) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
24
|
+
const {
|
|
25
|
+
row,
|
|
26
|
+
column
|
|
27
|
+
} = params;
|
|
28
|
+
const {
|
|
29
|
+
afterFullData,
|
|
30
|
+
treeOpts,
|
|
31
|
+
treeConfig,
|
|
32
|
+
fullAllDataRowIdData
|
|
33
|
+
} = $xetable;
|
|
34
|
+
const {
|
|
35
|
+
slots,
|
|
36
|
+
treeNode
|
|
37
|
+
} = column;
|
|
38
|
+
const rowid = (0, _util.getRowid)($xetable, row);
|
|
39
|
+
const rest = fullAllDataRowIdData[rowid];
|
|
40
|
+
let rLevel = 0;
|
|
41
|
+
let rIndex = 0;
|
|
42
|
+
let items = [];
|
|
45
43
|
if (rest) {
|
|
46
44
|
rLevel = rest.level;
|
|
47
45
|
rIndex = rest._index;
|
|
@@ -50,15 +48,15 @@ function renderLine(h, _vm, $xetable, params) {
|
|
|
50
48
|
if (slots && slots.line) {
|
|
51
49
|
return $xetable.callSlot(slots.line, params, h);
|
|
52
50
|
}
|
|
53
|
-
|
|
51
|
+
const isFirstRow = $xetable.eqRow(afterFullData[0], row);
|
|
54
52
|
if (treeConfig && treeNode && (treeOpts.showLine || treeOpts.line)) {
|
|
55
53
|
return [h('div', {
|
|
56
54
|
class: 'vxe-tree--line-wrapper'
|
|
57
55
|
}, [h('div', {
|
|
58
56
|
class: 'vxe-tree--line',
|
|
59
57
|
style: {
|
|
60
|
-
height:
|
|
61
|
-
left:
|
|
58
|
+
height: `${isFirstRow ? 1 : (0, _util.calcTreeLine)(params, items, rIndex)}px`,
|
|
59
|
+
left: `${rLevel * treeOpts.indent + (rLevel ? 2 - (0, _util.getOffsetSize)($xetable) : 0) + 16}px`
|
|
62
60
|
}
|
|
63
61
|
})])];
|
|
64
62
|
}
|
|
@@ -68,97 +66,106 @@ function renderLine(h, _vm, $xetable, params) {
|
|
|
68
66
|
* 渲染列
|
|
69
67
|
*/
|
|
70
68
|
function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, columns, items) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
afterFullData
|
|
74
|
-
tableData
|
|
75
|
-
height
|
|
76
|
-
columnKey
|
|
77
|
-
overflowX
|
|
78
|
-
sYOpts
|
|
79
|
-
scrollXLoad
|
|
80
|
-
scrollYLoad
|
|
81
|
-
highlightCurrentRow
|
|
82
|
-
allColumnOverflow
|
|
83
|
-
isAllOverflow
|
|
84
|
-
allAlign
|
|
85
|
-
currentColumn
|
|
86
|
-
allCellClassName
|
|
87
|
-
cellStyle
|
|
88
|
-
mergeList
|
|
89
|
-
spanMethod
|
|
90
|
-
radioOpts
|
|
91
|
-
checkboxOpts
|
|
92
|
-
expandOpts
|
|
93
|
-
treeOpts
|
|
94
|
-
tooltipOpts
|
|
95
|
-
mouseConfig
|
|
96
|
-
editConfig
|
|
97
|
-
editOpts
|
|
98
|
-
editRules
|
|
99
|
-
validOpts
|
|
100
|
-
editStore
|
|
101
|
-
tooltipConfig
|
|
102
|
-
rowOpts
|
|
103
|
-
columnOpts
|
|
104
|
-
validErrorMaps
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
69
|
+
const {
|
|
70
|
+
$listeners: tableListeners,
|
|
71
|
+
afterFullData,
|
|
72
|
+
tableData,
|
|
73
|
+
height,
|
|
74
|
+
columnKey,
|
|
75
|
+
overflowX,
|
|
76
|
+
sYOpts,
|
|
77
|
+
scrollXLoad,
|
|
78
|
+
scrollYLoad,
|
|
79
|
+
highlightCurrentRow,
|
|
80
|
+
showOverflow: allColumnOverflow,
|
|
81
|
+
isAllOverflow,
|
|
82
|
+
align: allAlign,
|
|
83
|
+
currentColumn,
|
|
84
|
+
cellClassName: allCellClassName,
|
|
85
|
+
cellStyle,
|
|
86
|
+
mergeList,
|
|
87
|
+
spanMethod,
|
|
88
|
+
radioOpts,
|
|
89
|
+
checkboxOpts,
|
|
90
|
+
expandOpts,
|
|
91
|
+
treeOpts,
|
|
92
|
+
tooltipOpts,
|
|
93
|
+
mouseConfig,
|
|
94
|
+
editConfig,
|
|
95
|
+
editOpts,
|
|
96
|
+
editRules,
|
|
97
|
+
validOpts,
|
|
98
|
+
editStore,
|
|
99
|
+
tooltipConfig,
|
|
100
|
+
rowOpts,
|
|
101
|
+
columnOpts,
|
|
102
|
+
validErrorMaps
|
|
103
|
+
} = $xetable;
|
|
104
|
+
const {
|
|
105
|
+
type,
|
|
106
|
+
cellRender,
|
|
107
|
+
editRender,
|
|
108
|
+
align,
|
|
109
|
+
showOverflow,
|
|
110
|
+
className,
|
|
111
|
+
treeNode,
|
|
112
|
+
slots
|
|
113
|
+
} = column;
|
|
114
|
+
const {
|
|
115
|
+
actived
|
|
116
|
+
} = editStore;
|
|
117
|
+
const {
|
|
118
|
+
rHeight: scrollYRHeight
|
|
119
|
+
} = sYOpts;
|
|
120
|
+
const {
|
|
121
|
+
height: rowHeight
|
|
122
|
+
} = rowOpts;
|
|
123
|
+
const renderOpts = editRender || cellRender;
|
|
124
|
+
const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
|
|
125
|
+
const compCellClassName = compConf ? compConf.tableCellClassName || compConf.cellClassName : '';
|
|
126
|
+
const compCellStyle = compConf ? compConf.tableCellStyle || compConf.cellStyle : '';
|
|
127
|
+
const showAllTip = tooltipOpts.showAll || tooltipOpts.enabled;
|
|
128
|
+
const columnIndex = $xetable.getColumnIndex(column);
|
|
129
|
+
const _columnIndex = $xetable.getVTColumnIndex(column);
|
|
130
|
+
const isEdit = (0, _utils.isEnableConf)(editRender);
|
|
131
|
+
let fixedHiddenColumn = fixedType ? column.fixed !== fixedType : column.fixed && overflowX;
|
|
132
|
+
const cellOverflow = _xeUtils.default.isUndefined(showOverflow) || _xeUtils.default.isNull(showOverflow) ? allColumnOverflow : showOverflow;
|
|
133
|
+
let showEllipsis = cellOverflow === 'ellipsis';
|
|
134
|
+
const showTitle = cellOverflow === 'title';
|
|
135
|
+
const showTooltip = cellOverflow === true || cellOverflow === 'tooltip';
|
|
136
|
+
let hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
137
|
+
let isDirty;
|
|
138
|
+
const tdOns = {};
|
|
139
|
+
const cellAlign = align || allAlign;
|
|
140
|
+
const errorValidItem = validErrorMaps[`${rowid}:${column.id}`];
|
|
141
|
+
const showValidTip = editRules && validOpts.showMessage && (validOpts.message === 'default' ? height || tableData.length > 1 : validOpts.message === 'inline');
|
|
142
|
+
const attrs = {
|
|
136
143
|
colid: column.id
|
|
137
144
|
};
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
145
|
+
const bindMouseenter = tableListeners['cell-mouseenter'];
|
|
146
|
+
const bindMouseleave = tableListeners['cell-mouseleave'];
|
|
147
|
+
const triggerDblclick = editRender && editConfig && editOpts.trigger === 'dblclick';
|
|
148
|
+
const params = {
|
|
142
149
|
$table: $xetable,
|
|
143
150
|
$grid: $xetable.$xegrid,
|
|
144
151
|
isEdit: false,
|
|
145
|
-
seq
|
|
146
|
-
rowid
|
|
147
|
-
row
|
|
148
|
-
rowIndex
|
|
149
|
-
$rowIndex
|
|
150
|
-
_rowIndex
|
|
151
|
-
column
|
|
152
|
-
columnIndex
|
|
153
|
-
$columnIndex
|
|
154
|
-
_columnIndex
|
|
152
|
+
seq,
|
|
153
|
+
rowid,
|
|
154
|
+
row,
|
|
155
|
+
rowIndex,
|
|
156
|
+
$rowIndex,
|
|
157
|
+
_rowIndex,
|
|
158
|
+
column,
|
|
159
|
+
columnIndex,
|
|
160
|
+
$columnIndex,
|
|
161
|
+
_columnIndex,
|
|
155
162
|
fixed: fixedType,
|
|
156
163
|
type: renderType,
|
|
157
164
|
isHidden: fixedHiddenColumn,
|
|
158
165
|
level: rowLevel,
|
|
159
166
|
visibleData: afterFullData,
|
|
160
167
|
data: tableData,
|
|
161
|
-
items
|
|
168
|
+
items
|
|
162
169
|
};
|
|
163
170
|
// 虚拟滚动不支持动态高度
|
|
164
171
|
if ((scrollXLoad || scrollYLoad) && !hasEllipsis) {
|
|
@@ -166,7 +173,7 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
166
173
|
}
|
|
167
174
|
// hover 进入事件
|
|
168
175
|
if (showTitle || showTooltip || showAllTip || bindMouseenter || tooltipConfig) {
|
|
169
|
-
tdOns.mouseenter =
|
|
176
|
+
tdOns.mouseenter = evnt => {
|
|
170
177
|
if (isVMScrollProcess($xetable)) {
|
|
171
178
|
return;
|
|
172
179
|
}
|
|
@@ -185,7 +192,7 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
185
192
|
}
|
|
186
193
|
// hover 退出事件
|
|
187
194
|
if (showTooltip || showAllTip || bindMouseleave || tooltipConfig) {
|
|
188
|
-
tdOns.mouseleave =
|
|
195
|
+
tdOns.mouseleave = evnt => {
|
|
189
196
|
if (isVMScrollProcess($xetable)) {
|
|
190
197
|
return;
|
|
191
198
|
}
|
|
@@ -201,28 +208,30 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
201
208
|
}
|
|
202
209
|
// 按下事件处理
|
|
203
210
|
if (checkboxOpts.range || mouseConfig) {
|
|
204
|
-
tdOns.mousedown =
|
|
211
|
+
tdOns.mousedown = evnt => {
|
|
205
212
|
$xetable.triggerCellMousedownEvent(evnt, params);
|
|
206
213
|
};
|
|
207
214
|
}
|
|
208
215
|
// 点击事件处理
|
|
209
216
|
if (rowOpts.isCurrent || highlightCurrentRow || tableListeners['cell-click'] || editRender && editConfig || expandOpts.trigger === 'row' || expandOpts.trigger === 'cell' || radioOpts.trigger === 'row' || column.type === 'radio' && radioOpts.trigger === 'cell' || checkboxOpts.trigger === 'row' || column.type === 'checkbox' && checkboxOpts.trigger === 'cell' || treeOpts.trigger === 'row' || column.treeNode && treeOpts.trigger === 'cell') {
|
|
210
|
-
tdOns.click =
|
|
217
|
+
tdOns.click = evnt => {
|
|
211
218
|
$xetable.triggerCellClickEvent(evnt, params);
|
|
212
219
|
};
|
|
213
220
|
}
|
|
214
221
|
// 双击事件处理
|
|
215
222
|
if (triggerDblclick || tableListeners['cell-dblclick']) {
|
|
216
|
-
tdOns.dblclick =
|
|
223
|
+
tdOns.dblclick = evnt => {
|
|
217
224
|
$xetable.triggerCellDblclickEvent(evnt, params);
|
|
218
225
|
};
|
|
219
226
|
}
|
|
220
227
|
// 合并行或列
|
|
221
228
|
if (mergeList.length) {
|
|
222
|
-
|
|
229
|
+
const spanRest = (0, _util.mergeBodyMethod)(mergeList, _rowIndex, _columnIndex);
|
|
223
230
|
if (spanRest) {
|
|
224
|
-
|
|
225
|
-
|
|
231
|
+
const {
|
|
232
|
+
rowspan,
|
|
233
|
+
colspan
|
|
234
|
+
} = spanRest;
|
|
226
235
|
if (!rowspan || !colspan) {
|
|
227
236
|
return null;
|
|
228
237
|
}
|
|
@@ -235,19 +244,18 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
235
244
|
}
|
|
236
245
|
} else if (spanMethod) {
|
|
237
246
|
// 自定义合并行或列的方法
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
if (!_rowspan || !_colspan) {
|
|
247
|
+
const {
|
|
248
|
+
rowspan = 1,
|
|
249
|
+
colspan = 1
|
|
250
|
+
} = spanMethod(params) || {};
|
|
251
|
+
if (!rowspan || !colspan) {
|
|
244
252
|
return null;
|
|
245
253
|
}
|
|
246
|
-
if (
|
|
247
|
-
attrs.rowspan =
|
|
254
|
+
if (rowspan > 1) {
|
|
255
|
+
attrs.rowspan = rowspan;
|
|
248
256
|
}
|
|
249
|
-
if (
|
|
250
|
-
attrs.colspan =
|
|
257
|
+
if (colspan > 1) {
|
|
258
|
+
attrs.colspan = colspan;
|
|
251
259
|
}
|
|
252
260
|
}
|
|
253
261
|
// 如果被合并不可隐藏
|
|
@@ -260,7 +268,7 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
260
268
|
if (!fixedHiddenColumn && editConfig && (editRender || cellRender) && (editOpts.showStatus || editOpts.showUpdateStatus)) {
|
|
261
269
|
isDirty = $xetable.isUpdateByRow(row, column.field);
|
|
262
270
|
}
|
|
263
|
-
|
|
271
|
+
const tdVNs = [];
|
|
264
272
|
if (fixedHiddenColumn && (allColumnOverflow ? isAllOverflow : allColumnOverflow)) {
|
|
265
273
|
tdVNs.push(h('div', {
|
|
266
274
|
class: ['vxe-cell', {
|
|
@@ -269,32 +277,32 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
269
277
|
'c--ellipsis': showEllipsis
|
|
270
278
|
}],
|
|
271
279
|
style: {
|
|
272
|
-
maxHeight: hasEllipsis && (scrollYRHeight || rowHeight) ?
|
|
280
|
+
maxHeight: hasEllipsis && (scrollYRHeight || rowHeight) ? `${scrollYRHeight || rowHeight}px` : ''
|
|
273
281
|
}
|
|
274
282
|
}));
|
|
275
283
|
} else {
|
|
276
284
|
// 渲染单元格
|
|
277
|
-
tdVNs.push
|
|
285
|
+
tdVNs.push(...renderLine(h, _vm, $xetable, params), h('div', {
|
|
278
286
|
class: ['vxe-cell', {
|
|
279
287
|
'c--title': showTitle,
|
|
280
288
|
'c--tooltip': showTooltip,
|
|
281
289
|
'c--ellipsis': showEllipsis
|
|
282
290
|
}],
|
|
283
291
|
style: {
|
|
284
|
-
maxHeight: hasEllipsis && (scrollYRHeight || rowHeight) ?
|
|
292
|
+
maxHeight: hasEllipsis && (scrollYRHeight || rowHeight) ? `${scrollYRHeight || rowHeight}px` : ''
|
|
285
293
|
},
|
|
286
294
|
attrs: {
|
|
287
295
|
title: showTitle ? $xetable.getCellLabel(row, column) : null
|
|
288
296
|
}
|
|
289
|
-
}, column.renderCell(h, params))
|
|
297
|
+
}, column.renderCell(h, params)));
|
|
290
298
|
if (showValidTip && errorValidItem) {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
299
|
+
const errRule = errorValidItem.rule;
|
|
300
|
+
const validSlot = slots ? slots.valid : null;
|
|
301
|
+
const validParams = Object.assign(Object.assign({}, params), errorValidItem);
|
|
294
302
|
tdVNs.push(h('div', {
|
|
295
303
|
class: ['vxe-cell--valid-error-hint', (0, _utils.getClass)(validOpts.className, errorValidItem)],
|
|
296
304
|
style: errRule && errRule.maxWidth ? {
|
|
297
|
-
width:
|
|
305
|
+
width: `${errRule.maxWidth}px`
|
|
298
306
|
} : null
|
|
299
307
|
}, validSlot ? $xetable.callSlot(validSlot, validParams, h) : [h('span', {
|
|
300
308
|
class: 'vxe-cell--valid-error-msg'
|
|
@@ -302,86 +310,101 @@ function renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, ro
|
|
|
302
310
|
}
|
|
303
311
|
}
|
|
304
312
|
return h('td', {
|
|
305
|
-
class: ['vxe-body--column', column.id,
|
|
313
|
+
class: ['vxe-body--column', column.id, {
|
|
314
|
+
[`col--${cellAlign}`]: cellAlign,
|
|
315
|
+
[`col--${type}`]: type,
|
|
316
|
+
'col--last': $columnIndex === columns.length - 1,
|
|
317
|
+
'col--tree-node': treeNode,
|
|
318
|
+
'col--edit': isEdit,
|
|
319
|
+
'col--ellipsis': hasEllipsis,
|
|
320
|
+
'col--height': !!rowOpts.height,
|
|
321
|
+
'fixed--hidden': fixedHiddenColumn,
|
|
322
|
+
'col--dirty': isDirty,
|
|
323
|
+
'col--active': editConfig && isEdit && actived.row === row && (actived.column === column || editOpts.mode === 'row'),
|
|
324
|
+
'col--valid-error': !!errorValidItem,
|
|
325
|
+
'col--current': currentColumn === column
|
|
326
|
+
}, (0, _utils.getClass)(compCellClassName, params), (0, _utils.getClass)(className, params), (0, _utils.getClass)(allCellClassName, params)],
|
|
306
327
|
key: columnKey || columnOpts.useKey ? column.id : $columnIndex,
|
|
307
|
-
attrs
|
|
328
|
+
attrs,
|
|
308
329
|
style: Object.assign({
|
|
309
|
-
height: hasEllipsis && (scrollYRHeight || rowHeight) ?
|
|
330
|
+
height: hasEllipsis && (scrollYRHeight || rowHeight) ? `${scrollYRHeight || rowHeight}px` : ''
|
|
310
331
|
}, _xeUtils.default.isFunction(compCellStyle) ? compCellStyle(params) : compCellStyle, _xeUtils.default.isFunction(cellStyle) ? cellStyle(params) : cellStyle),
|
|
311
332
|
on: tdOns
|
|
312
333
|
}, tdVNs);
|
|
313
334
|
}
|
|
314
335
|
function renderRows(h, _vm, $xetable, fixedType, tableData, tableColumn) {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
336
|
+
const {
|
|
337
|
+
stripe,
|
|
338
|
+
rowKey,
|
|
339
|
+
highlightHoverRow,
|
|
340
|
+
rowClassName,
|
|
341
|
+
rowStyle,
|
|
342
|
+
editConfig,
|
|
343
|
+
showOverflow: allColumnOverflow,
|
|
344
|
+
treeConfig,
|
|
345
|
+
treeOpts,
|
|
346
|
+
expandOpts,
|
|
347
|
+
editOpts,
|
|
348
|
+
treeExpandedMaps,
|
|
349
|
+
scrollYLoad,
|
|
350
|
+
rowExpandedMaps,
|
|
351
|
+
radioOpts,
|
|
352
|
+
checkboxOpts,
|
|
353
|
+
expandColumn,
|
|
354
|
+
hasFixedColumn,
|
|
355
|
+
fullAllDataRowIdData,
|
|
356
|
+
rowOpts,
|
|
357
|
+
pendingRowList,
|
|
358
|
+
pendingRowMaps
|
|
359
|
+
} = $xetable;
|
|
360
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
361
|
+
const rows = [];
|
|
362
|
+
tableData.forEach((row, $rowIndex) => {
|
|
363
|
+
const trOn = {};
|
|
364
|
+
let rowIndex = $rowIndex;
|
|
365
|
+
const _rowIndex = $xetable.getVTRowIndex(row);
|
|
343
366
|
// 确保任何情况下 rowIndex 都精准指向真实 data 索引
|
|
344
367
|
rowIndex = $xetable.getRowIndex(row);
|
|
345
368
|
// 事件绑定
|
|
346
369
|
if (rowOpts.isHover || highlightHoverRow) {
|
|
347
|
-
trOn.mouseenter =
|
|
370
|
+
trOn.mouseenter = evnt => {
|
|
348
371
|
if (isVMScrollProcess($xetable)) {
|
|
349
372
|
return;
|
|
350
373
|
}
|
|
351
374
|
$xetable.triggerHoverEvent(evnt, {
|
|
352
|
-
row
|
|
353
|
-
rowIndex
|
|
375
|
+
row,
|
|
376
|
+
rowIndex
|
|
354
377
|
});
|
|
355
378
|
};
|
|
356
|
-
trOn.mouseleave =
|
|
379
|
+
trOn.mouseleave = () => {
|
|
357
380
|
if (isVMScrollProcess($xetable)) {
|
|
358
381
|
return;
|
|
359
382
|
}
|
|
360
383
|
$xetable.clearHoverRow();
|
|
361
384
|
};
|
|
362
385
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
386
|
+
const rowid = (0, _util.getRowid)($xetable, row);
|
|
387
|
+
const rest = fullAllDataRowIdData[rowid];
|
|
388
|
+
const rowLevel = rest ? rest.level : 0;
|
|
389
|
+
const seq = rest ? rest.seq : -1;
|
|
390
|
+
const params = {
|
|
368
391
|
$table: $xetable,
|
|
369
|
-
seq
|
|
370
|
-
rowid
|
|
392
|
+
seq,
|
|
393
|
+
rowid,
|
|
371
394
|
fixed: fixedType,
|
|
372
395
|
type: renderType,
|
|
373
396
|
level: rowLevel,
|
|
374
|
-
row
|
|
375
|
-
rowIndex
|
|
376
|
-
$rowIndex
|
|
397
|
+
row,
|
|
398
|
+
rowIndex,
|
|
399
|
+
$rowIndex
|
|
377
400
|
};
|
|
378
401
|
// 行是否被展开
|
|
379
|
-
|
|
402
|
+
const isExpandRow = expandColumn && !!rowExpandedMaps[rowid];
|
|
380
403
|
// 树节点是否被展开
|
|
381
|
-
|
|
382
|
-
|
|
404
|
+
let isExpandTree = false;
|
|
405
|
+
let rowChildren = [];
|
|
383
406
|
// 是否新增行
|
|
384
|
-
|
|
407
|
+
let isNewRow = false;
|
|
385
408
|
if (editConfig) {
|
|
386
409
|
isNewRow = $xetable.isInsertByRow(row);
|
|
387
410
|
}
|
|
@@ -390,7 +413,7 @@ function renderRows(h, _vm, $xetable, fixedType, tableData, tableColumn) {
|
|
|
390
413
|
isExpandTree = rowChildren && rowChildren.length && !!treeExpandedMaps[rowid];
|
|
391
414
|
}
|
|
392
415
|
rows.push(h('tr', {
|
|
393
|
-
class: ['vxe-body--row', treeConfig ?
|
|
416
|
+
class: ['vxe-body--row', treeConfig ? `row--level-${rowLevel}` : '', {
|
|
394
417
|
'row--stripe': stripe && ($xetable.getVTRowIndex(row) + 1) % 2 === 0,
|
|
395
418
|
'is--new': isNewRow,
|
|
396
419
|
'is--expand-row': isExpandRow,
|
|
@@ -401,43 +424,47 @@ function renderRows(h, _vm, $xetable, fixedType, tableData, tableColumn) {
|
|
|
401
424
|
'row--pending': pendingRowList.length && !!pendingRowMaps[rowid]
|
|
402
425
|
}, rowClassName ? _xeUtils.default.isFunction(rowClassName) ? rowClassName(params) : rowClassName : ''],
|
|
403
426
|
attrs: {
|
|
404
|
-
rowid
|
|
427
|
+
rowid
|
|
405
428
|
},
|
|
406
429
|
style: rowStyle ? _xeUtils.default.isFunction(rowStyle) ? rowStyle(params) : rowStyle : null,
|
|
407
430
|
key: rowKey || rowOpts.useKey || treeConfig ? rowid : $rowIndex,
|
|
408
431
|
on: trOn
|
|
409
|
-
}, tableColumn.map(
|
|
432
|
+
}, tableColumn.map((column, $columnIndex) => {
|
|
410
433
|
return renderColumn(h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, rowIndex, $rowIndex, _rowIndex, column, $columnIndex, tableColumn, tableData);
|
|
411
434
|
})));
|
|
412
435
|
// 如果行被展开了
|
|
413
436
|
if (isExpandRow) {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
437
|
+
const {
|
|
438
|
+
height: expandHeight,
|
|
439
|
+
padding
|
|
440
|
+
} = expandOpts;
|
|
441
|
+
const cellStyle = {};
|
|
417
442
|
if (expandHeight) {
|
|
418
|
-
cellStyle.height =
|
|
443
|
+
cellStyle.height = `${expandHeight}px`;
|
|
419
444
|
}
|
|
420
445
|
if (treeConfig) {
|
|
421
|
-
cellStyle.paddingLeft =
|
|
446
|
+
cellStyle.paddingLeft = `${rowLevel * treeOpts.indent + 30}px`;
|
|
422
447
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
448
|
+
const {
|
|
449
|
+
showOverflow
|
|
450
|
+
} = expandColumn;
|
|
451
|
+
const hasEllipsis = _xeUtils.default.isUndefined(showOverflow) || _xeUtils.default.isNull(showOverflow) ? allColumnOverflow : showOverflow;
|
|
452
|
+
const expandParams = {
|
|
426
453
|
$table: $xetable,
|
|
427
|
-
seq
|
|
454
|
+
seq,
|
|
428
455
|
column: expandColumn,
|
|
429
456
|
fixed: fixedType,
|
|
430
457
|
type: renderType,
|
|
431
458
|
level: rowLevel,
|
|
432
|
-
row
|
|
433
|
-
rowIndex
|
|
434
|
-
$rowIndex
|
|
459
|
+
row,
|
|
460
|
+
rowIndex,
|
|
461
|
+
$rowIndex
|
|
435
462
|
};
|
|
436
463
|
rows.push(h('tr', {
|
|
437
464
|
class: ['vxe-body--expanded-row', {
|
|
438
465
|
'is--padding': padding
|
|
439
466
|
}],
|
|
440
|
-
key:
|
|
467
|
+
key: `expand_${rowid}`,
|
|
441
468
|
style: rowStyle ? _xeUtils.default.isFunction(rowStyle) ? rowStyle(expandParams) : rowStyle : null,
|
|
442
469
|
on: trOn
|
|
443
470
|
}, [h('td', {
|
|
@@ -459,7 +486,7 @@ function renderRows(h, _vm, $xetable, fixedType, tableData, tableColumn) {
|
|
|
459
486
|
}
|
|
460
487
|
// 如果是树形表格
|
|
461
488
|
if (isExpandTree) {
|
|
462
|
-
rows.push
|
|
489
|
+
rows.push(...renderRows(h, _vm, $xetable, fixedType, rowChildren, tableColumn));
|
|
463
490
|
}
|
|
464
491
|
});
|
|
465
492
|
return rows;
|
|
@@ -467,7 +494,7 @@ function renderRows(h, _vm, $xetable, fixedType, tableData, tableColumn) {
|
|
|
467
494
|
/**
|
|
468
495
|
* 同步滚动条
|
|
469
496
|
*/
|
|
470
|
-
|
|
497
|
+
let scrollProcessTimeout;
|
|
471
498
|
function syncBodyScroll(_vm, fixedType, scrollTop, elem1, elem2) {
|
|
472
499
|
if (elem1 || elem2) {
|
|
473
500
|
if (elem1) {
|
|
@@ -479,7 +506,7 @@ function syncBodyScroll(_vm, fixedType, scrollTop, elem1, elem2) {
|
|
|
479
506
|
elem2.scrollTop = scrollTop;
|
|
480
507
|
}
|
|
481
508
|
clearTimeout(scrollProcessTimeout);
|
|
482
|
-
scrollProcessTimeout = setTimeout(
|
|
509
|
+
scrollProcessTimeout = setTimeout(() => {
|
|
483
510
|
// const { tableBody, leftBody, rightBody } = _vm.$refs
|
|
484
511
|
// const bodyElem = tableBody.$el
|
|
485
512
|
// const leftElem = leftBody ? leftBody.$el : null
|
|
@@ -512,7 +539,7 @@ var _default = exports.default = {
|
|
|
512
539
|
size: String,
|
|
513
540
|
fixedType: String
|
|
514
541
|
},
|
|
515
|
-
data
|
|
542
|
+
data() {
|
|
516
543
|
return {
|
|
517
544
|
wheelTime: null,
|
|
518
545
|
wheelYSize: 0,
|
|
@@ -520,68 +547,80 @@ var _default = exports.default = {
|
|
|
520
547
|
wheelYTotal: 0
|
|
521
548
|
};
|
|
522
549
|
},
|
|
523
|
-
mounted
|
|
524
|
-
|
|
525
|
-
$
|
|
526
|
-
$
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
elemStore[
|
|
535
|
-
elemStore[
|
|
536
|
-
elemStore[
|
|
550
|
+
mounted() {
|
|
551
|
+
const {
|
|
552
|
+
$parent: $xetable,
|
|
553
|
+
$el,
|
|
554
|
+
$refs,
|
|
555
|
+
fixedType
|
|
556
|
+
} = this;
|
|
557
|
+
const {
|
|
558
|
+
elemStore
|
|
559
|
+
} = $xetable;
|
|
560
|
+
const prefix = `${fixedType || 'main'}-body-`;
|
|
561
|
+
elemStore[`${prefix}wrapper`] = $el;
|
|
562
|
+
elemStore[`${prefix}table`] = $refs.table;
|
|
563
|
+
elemStore[`${prefix}colgroup`] = $refs.colgroup;
|
|
564
|
+
elemStore[`${prefix}list`] = $refs.tbody;
|
|
565
|
+
elemStore[`${prefix}xSpace`] = $refs.xSpace;
|
|
566
|
+
elemStore[`${prefix}ySpace`] = $refs.ySpace;
|
|
567
|
+
elemStore[`${prefix}emptyBlock`] = $refs.emptyBlock;
|
|
537
568
|
if (this.$el) {
|
|
538
569
|
this.$el.onscroll = this.scrollEvent;
|
|
539
570
|
this.$el._onscroll = this.scrollEvent;
|
|
540
571
|
}
|
|
541
572
|
},
|
|
542
|
-
beforeDestroy
|
|
573
|
+
beforeDestroy() {
|
|
543
574
|
clearTimeout(this.wheelTime);
|
|
544
575
|
if (this.$el) {
|
|
545
576
|
this.$el._onscroll = null;
|
|
546
577
|
this.$el.onscroll = null;
|
|
547
578
|
}
|
|
548
579
|
},
|
|
549
|
-
destroyed
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
elemStore[
|
|
559
|
-
elemStore[
|
|
560
|
-
elemStore[
|
|
580
|
+
destroyed() {
|
|
581
|
+
const {
|
|
582
|
+
$parent: $xetable,
|
|
583
|
+
fixedType
|
|
584
|
+
} = this;
|
|
585
|
+
const {
|
|
586
|
+
elemStore
|
|
587
|
+
} = $xetable;
|
|
588
|
+
const prefix = `${fixedType || 'main'}-body-`;
|
|
589
|
+
elemStore[`${prefix}wrapper`] = null;
|
|
590
|
+
elemStore[`${prefix}table`] = null;
|
|
591
|
+
elemStore[`${prefix}colgroup`] = null;
|
|
592
|
+
elemStore[`${prefix}list`] = null;
|
|
593
|
+
elemStore[`${prefix}xSpace`] = null;
|
|
594
|
+
elemStore[`${prefix}ySpace`] = null;
|
|
595
|
+
elemStore[`${prefix}emptyBlock`] = null;
|
|
561
596
|
},
|
|
562
|
-
render
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
597
|
+
render(h) {
|
|
598
|
+
const {
|
|
599
|
+
_e,
|
|
600
|
+
$parent: $xetable,
|
|
601
|
+
fixedColumn,
|
|
602
|
+
fixedType
|
|
603
|
+
} = this;
|
|
604
|
+
let {
|
|
605
|
+
$scopedSlots,
|
|
606
|
+
tId,
|
|
607
|
+
tableData,
|
|
608
|
+
tableColumn,
|
|
609
|
+
visibleColumn,
|
|
610
|
+
expandColumn,
|
|
611
|
+
showOverflow: allColumnOverflow,
|
|
612
|
+
keyboardConfig,
|
|
613
|
+
keyboardOpts,
|
|
614
|
+
mergeList,
|
|
615
|
+
spanMethod,
|
|
616
|
+
scrollXLoad,
|
|
617
|
+
scrollYLoad,
|
|
618
|
+
isAllOverflow,
|
|
619
|
+
emptyOpts,
|
|
620
|
+
mouseConfig,
|
|
621
|
+
mouseOpts,
|
|
622
|
+
sYOpts
|
|
623
|
+
} = $xetable;
|
|
585
624
|
// 如果是使用优化模式
|
|
586
625
|
if (fixedType) {
|
|
587
626
|
// 如果存在展开行使用全量渲染
|
|
@@ -603,14 +642,14 @@ var _default = exports.default = {
|
|
|
603
642
|
tableColumn = visibleColumn;
|
|
604
643
|
}
|
|
605
644
|
}
|
|
606
|
-
|
|
645
|
+
let emptyContent;
|
|
607
646
|
if ($scopedSlots.empty) {
|
|
608
647
|
emptyContent = $scopedSlots.empty.call(this, {
|
|
609
648
|
$table: $xetable
|
|
610
649
|
}, h);
|
|
611
650
|
} else {
|
|
612
|
-
|
|
613
|
-
|
|
651
|
+
const compConf = emptyOpts.name ? renderer.get(emptyOpts.name) : null;
|
|
652
|
+
const renderTableEmptyView = compConf ? compConf.renderTableEmptyView || compConf.renderEmpty : null;
|
|
614
653
|
if (renderTableEmptyView) {
|
|
615
654
|
emptyContent = (0, _vn.getSlotVNs)(renderTableEmptyView.call(this, h, emptyOpts, {
|
|
616
655
|
$table: $xetable
|
|
@@ -620,7 +659,7 @@ var _default = exports.default = {
|
|
|
620
659
|
}
|
|
621
660
|
}
|
|
622
661
|
return h('div', {
|
|
623
|
-
class: ['vxe-table--body-wrapper', fixedType ?
|
|
662
|
+
class: ['vxe-table--body-wrapper', fixedType ? `fixed-${fixedType}--wrapper` : 'body--wrapper'],
|
|
624
663
|
attrs: {
|
|
625
664
|
xid: tId
|
|
626
665
|
},
|
|
@@ -648,7 +687,7 @@ var _default = exports.default = {
|
|
|
648
687
|
*/
|
|
649
688
|
h('colgroup', {
|
|
650
689
|
ref: 'colgroup'
|
|
651
|
-
}, tableColumn.map(
|
|
690
|
+
}, tableColumn.map((column, $columnIndex) => {
|
|
652
691
|
return h('col', {
|
|
653
692
|
attrs: {
|
|
654
693
|
name: column.id
|
|
@@ -670,7 +709,7 @@ var _default = exports.default = {
|
|
|
670
709
|
}, mouseOpts.extension ? [h('span', {
|
|
671
710
|
class: 'vxe-table--cell-main-area-btn',
|
|
672
711
|
on: {
|
|
673
|
-
mousedown
|
|
712
|
+
mousedown(evnt) {
|
|
674
713
|
$xetable.triggerCellExtendMousedownEvent(evnt, {
|
|
675
714
|
$table: $xetable,
|
|
676
715
|
fixed: fixedType,
|
|
@@ -699,37 +738,43 @@ var _default = exports.default = {
|
|
|
699
738
|
* 如果存在列固定左侧,同步更新滚动状态
|
|
700
739
|
* 如果存在列固定右侧,同步更新滚动状态
|
|
701
740
|
*/
|
|
702
|
-
scrollEvent
|
|
703
|
-
|
|
704
|
-
$
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
741
|
+
scrollEvent(evnt) {
|
|
742
|
+
const {
|
|
743
|
+
$el: scrollBodyElem,
|
|
744
|
+
$parent: $xetable,
|
|
745
|
+
fixedType
|
|
746
|
+
} = this;
|
|
747
|
+
const {
|
|
748
|
+
$refs,
|
|
749
|
+
elemStore,
|
|
750
|
+
highlightHoverRow,
|
|
751
|
+
scrollXLoad,
|
|
752
|
+
scrollYLoad,
|
|
753
|
+
lastScrollTop,
|
|
754
|
+
lastScrollLeft,
|
|
755
|
+
rowOpts
|
|
756
|
+
} = $xetable;
|
|
757
|
+
const {
|
|
758
|
+
tableHeader,
|
|
759
|
+
tableBody,
|
|
760
|
+
leftBody,
|
|
761
|
+
rightBody,
|
|
762
|
+
tableFooter,
|
|
763
|
+
validTip
|
|
764
|
+
} = $refs;
|
|
765
|
+
const headerElem = tableHeader ? tableHeader.$el : null;
|
|
766
|
+
const footerElem = tableFooter ? tableFooter.$el : null;
|
|
767
|
+
const bodyElem = tableBody.$el;
|
|
768
|
+
const leftElem = leftBody ? leftBody.$el : null;
|
|
769
|
+
const rightElem = rightBody ? rightBody.$el : null;
|
|
770
|
+
const bodyYElem = elemStore['main-body-ySpace'];
|
|
771
|
+
const bodyXElem = elemStore['main-body-xSpace'];
|
|
772
|
+
const bodyHeight = scrollYLoad && bodyYElem ? bodyYElem.clientHeight : bodyElem.clientHeight;
|
|
773
|
+
const bodyWidth = scrollXLoad && bodyXElem ? bodyXElem.clientWidth : bodyElem.clientWidth;
|
|
774
|
+
let scrollTop = scrollBodyElem.scrollTop;
|
|
775
|
+
const scrollLeft = bodyElem.scrollLeft;
|
|
776
|
+
const isRollX = scrollLeft !== lastScrollLeft;
|
|
777
|
+
const isRollY = scrollTop !== lastScrollTop;
|
|
733
778
|
$xetable.lastScrollTop = scrollTop;
|
|
734
779
|
$xetable.lastScrollLeft = scrollLeft;
|
|
735
780
|
$xetable.lastScrollTime = Date.now();
|
|
@@ -770,54 +815,63 @@ var _default = exports.default = {
|
|
|
770
815
|
$xetable.emitEvent('scroll', {
|
|
771
816
|
type: renderType,
|
|
772
817
|
fixed: fixedType,
|
|
773
|
-
scrollTop
|
|
774
|
-
scrollLeft
|
|
818
|
+
scrollTop,
|
|
819
|
+
scrollLeft,
|
|
775
820
|
scrollHeight: bodyElem.scrollHeight,
|
|
776
821
|
scrollWidth: bodyElem.scrollWidth,
|
|
777
|
-
bodyHeight
|
|
778
|
-
bodyWidth
|
|
822
|
+
bodyHeight,
|
|
823
|
+
bodyWidth,
|
|
779
824
|
isX: isRollX,
|
|
780
825
|
isY: isRollY
|
|
781
826
|
}, evnt);
|
|
782
827
|
},
|
|
783
|
-
handleWheel
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
828
|
+
handleWheel(evnt, isTopWheel, deltaTop, isRollX, isRollY) {
|
|
829
|
+
const {
|
|
830
|
+
$parent: $xetable
|
|
831
|
+
} = this;
|
|
832
|
+
const {
|
|
833
|
+
$refs,
|
|
834
|
+
elemStore,
|
|
835
|
+
scrollYLoad,
|
|
836
|
+
scrollXLoad
|
|
837
|
+
} = $xetable;
|
|
838
|
+
const {
|
|
839
|
+
tableBody,
|
|
840
|
+
leftBody,
|
|
841
|
+
rightBody
|
|
842
|
+
} = $refs;
|
|
843
|
+
const bodyElem = tableBody.$el;
|
|
844
|
+
const leftElem = leftBody ? leftBody.$el : null;
|
|
845
|
+
const rightElem = rightBody ? rightBody.$el : null;
|
|
846
|
+
const remainSize = this.isPrevWheelTop === isTopWheel ? Math.max(0, this.wheelYSize - this.wheelYTotal) : 0;
|
|
847
|
+
const bodyYElem = elemStore['main-body-ySpace'];
|
|
848
|
+
const bodyXElem = elemStore['main-body-xSpace'];
|
|
849
|
+
const bodyHeight = scrollYLoad && bodyYElem ? bodyYElem.clientHeight : bodyElem.clientHeight;
|
|
850
|
+
const bodyWidth = scrollXLoad && bodyXElem ? bodyXElem.clientWidth : bodyElem.clientWidth;
|
|
801
851
|
this.isPrevWheelTop = isTopWheel;
|
|
802
852
|
this.wheelYSize = Math.abs(isTopWheel ? deltaTop - remainSize : deltaTop + remainSize);
|
|
803
853
|
this.wheelYInterval = 0;
|
|
804
854
|
this.wheelYTotal = 0;
|
|
805
855
|
clearTimeout(this.wheelTime);
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
856
|
+
const handleSmooth = () => {
|
|
857
|
+
let {
|
|
858
|
+
fixedType,
|
|
859
|
+
wheelYTotal,
|
|
860
|
+
wheelYSize,
|
|
861
|
+
wheelYInterval
|
|
862
|
+
} = this;
|
|
811
863
|
if (wheelYTotal < wheelYSize) {
|
|
812
864
|
wheelYInterval = Math.max(5, Math.floor(wheelYInterval * 1.5));
|
|
813
865
|
wheelYTotal = wheelYTotal + wheelYInterval;
|
|
814
866
|
if (wheelYTotal > wheelYSize) {
|
|
815
867
|
wheelYInterval = wheelYInterval - (wheelYTotal - wheelYSize);
|
|
816
868
|
}
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
869
|
+
const {
|
|
870
|
+
scrollTop,
|
|
871
|
+
clientHeight,
|
|
872
|
+
scrollHeight
|
|
873
|
+
} = bodyElem;
|
|
874
|
+
const targetTop = scrollTop + wheelYInterval * (isTopWheel ? -1 : 1);
|
|
821
875
|
bodyElem.scrollTop = targetTop;
|
|
822
876
|
if (leftElem) {
|
|
823
877
|
leftElem.scrollTop = targetTop;
|
|
@@ -826,10 +880,10 @@ var _default = exports.default = {
|
|
|
826
880
|
rightElem.scrollTop = targetTop;
|
|
827
881
|
}
|
|
828
882
|
if (isTopWheel ? targetTop < scrollHeight - clientHeight : targetTop >= 0) {
|
|
829
|
-
|
|
883
|
+
this.wheelTime = setTimeout(handleSmooth, 10);
|
|
830
884
|
}
|
|
831
|
-
|
|
832
|
-
|
|
885
|
+
this.wheelYTotal = wheelYTotal;
|
|
886
|
+
this.wheelYInterval = wheelYInterval;
|
|
833
887
|
$xetable.emitEvent('scroll', {
|
|
834
888
|
type: renderType,
|
|
835
889
|
fixed: fixedType,
|
|
@@ -837,42 +891,50 @@ var _default = exports.default = {
|
|
|
837
891
|
scrollLeft: bodyElem.scrollLeft,
|
|
838
892
|
scrollHeight: bodyElem.scrollHeight,
|
|
839
893
|
scrollWidth: bodyElem.scrollWidth,
|
|
840
|
-
bodyHeight
|
|
841
|
-
bodyWidth
|
|
894
|
+
bodyHeight,
|
|
895
|
+
bodyWidth,
|
|
842
896
|
isX: isRollX,
|
|
843
897
|
isY: isRollY
|
|
844
898
|
}, evnt);
|
|
845
899
|
}
|
|
846
900
|
};
|
|
847
|
-
|
|
901
|
+
handleSmooth();
|
|
848
902
|
},
|
|
849
903
|
/**
|
|
850
904
|
* 滚轮处理
|
|
851
905
|
*/
|
|
852
|
-
wheelEvent
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
906
|
+
wheelEvent(evnt) {
|
|
907
|
+
const {
|
|
908
|
+
deltaY,
|
|
909
|
+
deltaX
|
|
910
|
+
} = evnt;
|
|
911
|
+
const {
|
|
912
|
+
$el: scrollBodyElem,
|
|
913
|
+
$parent: $xetable
|
|
914
|
+
} = this;
|
|
915
|
+
const {
|
|
916
|
+
$refs,
|
|
917
|
+
highlightHoverRow,
|
|
918
|
+
scrollYLoad,
|
|
919
|
+
lastScrollTop,
|
|
920
|
+
lastScrollLeft,
|
|
921
|
+
rowOpts
|
|
922
|
+
} = $xetable;
|
|
923
|
+
const {
|
|
924
|
+
tableBody
|
|
925
|
+
} = $refs;
|
|
926
|
+
const bodyElem = tableBody.$el;
|
|
927
|
+
const deltaTop = deltaY;
|
|
928
|
+
const deltaLeft = deltaX;
|
|
929
|
+
const isTopWheel = deltaTop < 0;
|
|
868
930
|
// 如果滚动位置已经是顶部或底部,则不需要触发
|
|
869
931
|
if (isTopWheel ? scrollBodyElem.scrollTop <= 0 : scrollBodyElem.scrollTop >= scrollBodyElem.scrollHeight - scrollBodyElem.clientHeight) {
|
|
870
932
|
return;
|
|
871
933
|
}
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
934
|
+
const scrollTop = scrollBodyElem.scrollTop + deltaTop;
|
|
935
|
+
const scrollLeft = bodyElem.scrollLeft + deltaLeft;
|
|
936
|
+
const isRollX = scrollLeft !== lastScrollLeft;
|
|
937
|
+
const isRollY = scrollTop !== lastScrollTop;
|
|
876
938
|
// 用于鼠标纵向滚轮处理
|
|
877
939
|
if (isRollY) {
|
|
878
940
|
evnt.preventDefault();
|