vxe-table 3.10.15 → 3.11.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/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/custom/mixin.js +5 -1
- package/es/table/module/edit/mixin.js +24 -15
- package/es/table/module/validator/mixin.js +31 -10
- package/es/table/src/body.js +40 -24
- package/es/table/src/cell.js +75 -32
- package/es/table/src/footer.js +159 -131
- package/es/table/src/header.js +128 -90
- package/es/table/src/methods.js +292 -66
- package/es/table/src/props.js +5 -1
- package/es/table/src/table.js +64 -20
- package/es/table/style.css +33 -20
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +9 -4
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +33 -20
- package/es/vxe-table/style.min.css +1 -1
- package/helper/vetur/attributes.json +1 -1
- package/helper/vetur/tags.json +1 -1
- package/lib/index.umd.js +945 -460
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/custom/mixin.js +5 -1
- package/lib/table/module/custom/mixin.min.js +1 -1
- package/lib/table/module/edit/mixin.js +24 -15
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/validator/mixin.js +31 -10
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/src/body.js +31 -15
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +82 -35
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/footer.js +198 -161
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +169 -128
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +321 -69
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/props.js +5 -1
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +70 -20
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +33 -20
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +9 -4
- package/lib/ui/index.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 +33 -20
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +3 -3
- package/packages/table/module/custom/mixin.ts +5 -1
- package/packages/table/module/edit/mixin.ts +24 -15
- package/packages/table/module/validator/mixin.ts +33 -10
- package/packages/table/src/body.ts +43 -25
- package/packages/table/src/cell.ts +120 -67
- package/packages/table/src/footer.ts +164 -150
- package/packages/table/src/header.ts +136 -90
- package/packages/table/src/methods.ts +304 -68
- package/packages/table/src/props.ts +5 -1
- package/packages/table/src/table.ts +71 -19
- package/packages/ui/index.ts +8 -3
- package/styles/components/table.scss +42 -35
- /package/es/{iconfont.1731574584971.ttf → iconfont.1731890707082.ttf} +0 -0
- /package/es/{iconfont.1731574584971.woff → iconfont.1731890707082.woff} +0 -0
- /package/es/{iconfont.1731574584971.woff2 → iconfont.1731890707082.woff2} +0 -0
- /package/lib/{iconfont.1731574584971.ttf → iconfont.1731890707082.ttf} +0 -0
- /package/lib/{iconfont.1731574584971.woff → iconfont.1731890707082.woff} +0 -0
- /package/lib/{iconfont.1731574584971.woff2 → iconfont.1731890707082.woff2} +0 -0
package/es/table/src/footer.js
CHANGED
|
@@ -17,6 +17,163 @@ function mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex) {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
function renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex, _rowIndex) {
|
|
21
|
+
const { $parent: $xetable, fixedType } = _vm;
|
|
22
|
+
const { $listeners: tableListeners, footerCellClassName, footerCellStyle, footerAlign: allFooterAlign, mergeFooterList, footerSpanMethod, align: allAlign, scrollXLoad, columnKey, columnOpts, showFooterOverflow: allColumnFooterOverflow, currentColumn, overflowX, scrollbarWidth, tooltipOpts } = $xetable;
|
|
23
|
+
return tableColumn.map((column, $columnIndex) => {
|
|
24
|
+
const { type, showFooterOverflow, footerAlign, align, footerClassName, editRender, cellRender } = column;
|
|
25
|
+
const renderOpts = editRender || cellRender;
|
|
26
|
+
const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
|
|
27
|
+
const showAllTip = tooltipOpts.showAll || tooltipOpts.enabled;
|
|
28
|
+
const isColGroup = column.children && column.children.length;
|
|
29
|
+
const fixedHiddenColumn = fixedType ? column.fixed !== fixedType && !isColGroup : column.fixed && overflowX;
|
|
30
|
+
const footOverflow = XEUtils.isUndefined(showFooterOverflow) || XEUtils.isNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow;
|
|
31
|
+
const footAlign = footerAlign || (compConf ? compConf.tableFooterCellAlign : '') || allFooterAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
|
|
32
|
+
let showEllipsis = footOverflow === 'ellipsis';
|
|
33
|
+
const showTitle = footOverflow === 'title';
|
|
34
|
+
const showTooltip = footOverflow === true || footOverflow === 'tooltip';
|
|
35
|
+
let hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
36
|
+
const attrs = { colid: column.id };
|
|
37
|
+
const tfOns = {};
|
|
38
|
+
const columnIndex = $xetable.getColumnIndex(column);
|
|
39
|
+
const _columnIndex = $xetable.getVTColumnIndex(column);
|
|
40
|
+
const itemIndex = _columnIndex;
|
|
41
|
+
const cellParams = {
|
|
42
|
+
$table: $xetable,
|
|
43
|
+
$grid: $xetable.xegrid,
|
|
44
|
+
row,
|
|
45
|
+
_rowIndex,
|
|
46
|
+
$rowIndex,
|
|
47
|
+
column,
|
|
48
|
+
columnIndex,
|
|
49
|
+
$columnIndex,
|
|
50
|
+
_columnIndex,
|
|
51
|
+
itemIndex,
|
|
52
|
+
items: row,
|
|
53
|
+
fixed: fixedType,
|
|
54
|
+
type: renderType,
|
|
55
|
+
data: footerTableData
|
|
56
|
+
};
|
|
57
|
+
// 虚拟滚动不支持动态高度
|
|
58
|
+
if (scrollXLoad && !hasEllipsis) {
|
|
59
|
+
showEllipsis = hasEllipsis = true;
|
|
60
|
+
}
|
|
61
|
+
if (showTitle || showTooltip || showAllTip) {
|
|
62
|
+
tfOns.mouseenter = (evnt) => {
|
|
63
|
+
if (showTitle) {
|
|
64
|
+
updateCellTitle(evnt.currentTarget, column);
|
|
65
|
+
}
|
|
66
|
+
else if (showTooltip || showAllTip) {
|
|
67
|
+
$xetable.triggerFooterTooltipEvent(evnt, cellParams);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (showTooltip || showAllTip) {
|
|
72
|
+
tfOns.mouseleave = (evnt) => {
|
|
73
|
+
if (showTooltip || showAllTip) {
|
|
74
|
+
$xetable.handleTargetLeaveEvent(evnt);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
if (tableListeners['footer-cell-click']) {
|
|
79
|
+
tfOns.click = (evnt) => {
|
|
80
|
+
$xetable.emitEvent('footer-cell-click', Object.assign({ cell: evnt.currentTarget }, cellParams), evnt);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (tableListeners['footer-cell-dblclick']) {
|
|
84
|
+
tfOns.dblclick = (evnt) => {
|
|
85
|
+
$xetable.emitEvent('footer-cell-dblclick', Object.assign({ cell: evnt.currentTarget }, cellParams), evnt);
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
// 合并行或列
|
|
89
|
+
if (mergeFooterList.length) {
|
|
90
|
+
const spanRest = mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex);
|
|
91
|
+
if (spanRest) {
|
|
92
|
+
const { rowspan, colspan } = spanRest;
|
|
93
|
+
if (!rowspan || !colspan) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
if (rowspan > 1) {
|
|
97
|
+
attrs.rowspan = rowspan;
|
|
98
|
+
}
|
|
99
|
+
if (colspan > 1) {
|
|
100
|
+
attrs.colspan = colspan;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else if (footerSpanMethod) {
|
|
105
|
+
// 自定义合并方法
|
|
106
|
+
const { rowspan = 1, colspan = 1 } = footerSpanMethod(cellParams) || {};
|
|
107
|
+
if (!rowspan || !colspan) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
if (rowspan > 1) {
|
|
111
|
+
attrs.rowspan = rowspan;
|
|
112
|
+
}
|
|
113
|
+
if (colspan > 1) {
|
|
114
|
+
attrs.colspan = colspan;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return h('td', {
|
|
118
|
+
class: ['vxe-footer--column', column.id, {
|
|
119
|
+
[`col--${footAlign}`]: footAlign,
|
|
120
|
+
[`col--${type}`]: type,
|
|
121
|
+
'col--last': $columnIndex === tableColumn.length - 1,
|
|
122
|
+
'fixed--hidden': fixedHiddenColumn,
|
|
123
|
+
'col--ellipsis': hasEllipsis,
|
|
124
|
+
'col--current': currentColumn === column
|
|
125
|
+
}, getClass(footerClassName, cellParams), getClass(footerCellClassName, cellParams)],
|
|
126
|
+
attrs,
|
|
127
|
+
style: footerCellStyle ? (XEUtils.isFunction(footerCellStyle) ? footerCellStyle(cellParams) : footerCellStyle) : null,
|
|
128
|
+
on: tfOns,
|
|
129
|
+
key: columnKey || columnOpts.useKey || columnOpts.drag ? column.id : $columnIndex
|
|
130
|
+
}, [
|
|
131
|
+
h('div', {
|
|
132
|
+
class: ['vxe-cell', {
|
|
133
|
+
'c--title': showTitle,
|
|
134
|
+
'c--tooltip': showTooltip,
|
|
135
|
+
'c--ellipsis': showEllipsis
|
|
136
|
+
}]
|
|
137
|
+
}, column.renderFooter(h, cellParams))
|
|
138
|
+
]);
|
|
139
|
+
}).concat(scrollbarWidth
|
|
140
|
+
? [
|
|
141
|
+
h('td', {
|
|
142
|
+
key: `gr${$rowIndex}`,
|
|
143
|
+
class: 'vxe-footer--gutter col--gutter'
|
|
144
|
+
})
|
|
145
|
+
]
|
|
146
|
+
: []);
|
|
147
|
+
}
|
|
148
|
+
function renderHeads(h, _vm, footerTableData) {
|
|
149
|
+
const { $parent: $xetable, fixedType, tableColumn } = _vm;
|
|
150
|
+
const { footerRowClassName, footerRowStyle, isDragColMove } = $xetable;
|
|
151
|
+
const columnOpts = $xetable.columnOpts;
|
|
152
|
+
return footerTableData.map((row, $rowIndex) => {
|
|
153
|
+
const _rowIndex = $rowIndex;
|
|
154
|
+
const rowParams = { $table: $xetable, row, _rowIndex, $rowIndex, fixed: fixedType, type: renderType };
|
|
155
|
+
if (columnOpts.drag) {
|
|
156
|
+
return h('transition-group', {
|
|
157
|
+
props: {
|
|
158
|
+
tag: 'tr',
|
|
159
|
+
name: `vxe-header--col-list${isDragColMove ? '' : '-disabled'}`,
|
|
160
|
+
class: [
|
|
161
|
+
'vxe-footer--row',
|
|
162
|
+
footerRowClassName ? XEUtils.isFunction(footerRowClassName) ? footerRowClassName(rowParams) : footerRowClassName : ''
|
|
163
|
+
],
|
|
164
|
+
style: footerRowStyle ? (XEUtils.isFunction(footerRowStyle) ? footerRowStyle(rowParams) : footerRowStyle) : null
|
|
165
|
+
}
|
|
166
|
+
}, renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex, _rowIndex));
|
|
167
|
+
}
|
|
168
|
+
return h('tr', {
|
|
169
|
+
class: [
|
|
170
|
+
'vxe-footer--row',
|
|
171
|
+
footerRowClassName ? XEUtils.isFunction(footerRowClassName) ? footerRowClassName(rowParams) : footerRowClassName : ''
|
|
172
|
+
],
|
|
173
|
+
style: footerRowStyle ? (XEUtils.isFunction(footerRowStyle) ? footerRowStyle(rowParams) : footerRowStyle) : null
|
|
174
|
+
}, renderRows(h, _vm, tableColumn, footerTableData, row, $rowIndex, _rowIndex));
|
|
175
|
+
});
|
|
176
|
+
}
|
|
20
177
|
export default {
|
|
21
178
|
name: 'VxeTableFooter',
|
|
22
179
|
props: {
|
|
@@ -48,7 +205,7 @@ export default {
|
|
|
48
205
|
},
|
|
49
206
|
render(h) {
|
|
50
207
|
let { _e, $parent: $xetable, fixedType, fixedColumn, tableColumn, footerTableData } = this;
|
|
51
|
-
const {
|
|
208
|
+
const { tId, mergeFooterList, footerSpanMethod, scrollXLoad, showFooterOverflow: allColumnFooterOverflow, scrollbarWidth, visibleColumn, expandColumn } = $xetable;
|
|
52
209
|
// 如果是使用优化模式
|
|
53
210
|
if (fixedType) {
|
|
54
211
|
// 如果存在展开行使用全量渲染
|
|
@@ -115,136 +272,7 @@ export default {
|
|
|
115
272
|
*/
|
|
116
273
|
h('tfoot', {
|
|
117
274
|
ref: 'tfoot'
|
|
118
|
-
},
|
|
119
|
-
const $rowIndex = _rowIndex;
|
|
120
|
-
const rowParams = { $table: $xetable, row: list, _rowIndex, $rowIndex, fixed: fixedType, type: renderType };
|
|
121
|
-
return h('tr', {
|
|
122
|
-
class: ['vxe-footer--row', footerRowClassName ? XEUtils.isFunction(footerRowClassName) ? footerRowClassName(rowParams) : footerRowClassName : ''],
|
|
123
|
-
style: footerRowStyle ? (XEUtils.isFunction(footerRowStyle) ? footerRowStyle(rowParams) : footerRowStyle) : null
|
|
124
|
-
}, tableColumn.map((column, $columnIndex) => {
|
|
125
|
-
const { type, showFooterOverflow, footerAlign, align, footerClassName, editRender, cellRender } = column;
|
|
126
|
-
const renderOpts = editRender || cellRender;
|
|
127
|
-
const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
|
|
128
|
-
const showAllTip = tooltipOpts.showAll || tooltipOpts.enabled;
|
|
129
|
-
const isColGroup = column.children && column.children.length;
|
|
130
|
-
const fixedHiddenColumn = fixedType ? column.fixed !== fixedType && !isColGroup : column.fixed && overflowX;
|
|
131
|
-
const footOverflow = XEUtils.isUndefined(showFooterOverflow) || XEUtils.isNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow;
|
|
132
|
-
const footAlign = footerAlign || (compConf ? compConf.tableFooterCellAlign : '') || allFooterAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
|
|
133
|
-
let showEllipsis = footOverflow === 'ellipsis';
|
|
134
|
-
const showTitle = footOverflow === 'title';
|
|
135
|
-
const showTooltip = footOverflow === true || footOverflow === 'tooltip';
|
|
136
|
-
let hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
137
|
-
const attrs = { colid: column.id };
|
|
138
|
-
const tfOns = {};
|
|
139
|
-
const columnIndex = $xetable.getColumnIndex(column);
|
|
140
|
-
const _columnIndex = $xetable.getVTColumnIndex(column);
|
|
141
|
-
const itemIndex = _columnIndex;
|
|
142
|
-
const cellParams = {
|
|
143
|
-
$table: $xetable,
|
|
144
|
-
$grid: $xetable.xegrid,
|
|
145
|
-
row: list,
|
|
146
|
-
_rowIndex,
|
|
147
|
-
$rowIndex,
|
|
148
|
-
column,
|
|
149
|
-
columnIndex,
|
|
150
|
-
$columnIndex,
|
|
151
|
-
_columnIndex,
|
|
152
|
-
itemIndex,
|
|
153
|
-
items: list,
|
|
154
|
-
fixed: fixedType,
|
|
155
|
-
type: renderType,
|
|
156
|
-
data: footerTableData
|
|
157
|
-
};
|
|
158
|
-
// 虚拟滚动不支持动态高度
|
|
159
|
-
if (scrollXLoad && !hasEllipsis) {
|
|
160
|
-
showEllipsis = hasEllipsis = true;
|
|
161
|
-
}
|
|
162
|
-
if (showTitle || showTooltip || showAllTip) {
|
|
163
|
-
tfOns.mouseenter = (evnt) => {
|
|
164
|
-
if (showTitle) {
|
|
165
|
-
updateCellTitle(evnt.currentTarget, column);
|
|
166
|
-
}
|
|
167
|
-
else if (showTooltip || showAllTip) {
|
|
168
|
-
$xetable.triggerFooterTooltipEvent(evnt, cellParams);
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
if (showTooltip || showAllTip) {
|
|
173
|
-
tfOns.mouseleave = (evnt) => {
|
|
174
|
-
if (showTooltip || showAllTip) {
|
|
175
|
-
$xetable.handleTargetLeaveEvent(evnt);
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
if (tableListeners['footer-cell-click']) {
|
|
180
|
-
tfOns.click = (evnt) => {
|
|
181
|
-
$xetable.emitEvent('footer-cell-click', Object.assign({ cell: evnt.currentTarget }, cellParams), evnt);
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
if (tableListeners['footer-cell-dblclick']) {
|
|
185
|
-
tfOns.dblclick = (evnt) => {
|
|
186
|
-
$xetable.emitEvent('footer-cell-dblclick', Object.assign({ cell: evnt.currentTarget }, cellParams), evnt);
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
// 合并行或列
|
|
190
|
-
if (mergeFooterList.length) {
|
|
191
|
-
const spanRest = mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex);
|
|
192
|
-
if (spanRest) {
|
|
193
|
-
const { rowspan, colspan } = spanRest;
|
|
194
|
-
if (!rowspan || !colspan) {
|
|
195
|
-
return null;
|
|
196
|
-
}
|
|
197
|
-
if (rowspan > 1) {
|
|
198
|
-
attrs.rowspan = rowspan;
|
|
199
|
-
}
|
|
200
|
-
if (colspan > 1) {
|
|
201
|
-
attrs.colspan = colspan;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
else if (footerSpanMethod) {
|
|
206
|
-
// 自定义合并方法
|
|
207
|
-
const { rowspan = 1, colspan = 1 } = footerSpanMethod(cellParams) || {};
|
|
208
|
-
if (!rowspan || !colspan) {
|
|
209
|
-
return null;
|
|
210
|
-
}
|
|
211
|
-
if (rowspan > 1) {
|
|
212
|
-
attrs.rowspan = rowspan;
|
|
213
|
-
}
|
|
214
|
-
if (colspan > 1) {
|
|
215
|
-
attrs.colspan = colspan;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
return h('td', {
|
|
219
|
-
class: ['vxe-footer--column', column.id, {
|
|
220
|
-
[`col--${footAlign}`]: footAlign,
|
|
221
|
-
[`col--${type}`]: type,
|
|
222
|
-
'col--last': $columnIndex === tableColumn.length - 1,
|
|
223
|
-
'fixed--hidden': fixedHiddenColumn,
|
|
224
|
-
'col--ellipsis': hasEllipsis,
|
|
225
|
-
'col--current': currentColumn === column
|
|
226
|
-
}, getClass(footerClassName, cellParams), getClass(footerCellClassName, cellParams)],
|
|
227
|
-
attrs,
|
|
228
|
-
style: footerCellStyle ? (XEUtils.isFunction(footerCellStyle) ? footerCellStyle(cellParams) : footerCellStyle) : null,
|
|
229
|
-
on: tfOns,
|
|
230
|
-
key: columnKey || columnOpts.useKey ? column.id : $columnIndex
|
|
231
|
-
}, [
|
|
232
|
-
h('div', {
|
|
233
|
-
class: ['vxe-cell', {
|
|
234
|
-
'c--title': showTitle,
|
|
235
|
-
'c--tooltip': showTooltip,
|
|
236
|
-
'c--ellipsis': showEllipsis
|
|
237
|
-
}]
|
|
238
|
-
}, column.renderFooter(h, cellParams))
|
|
239
|
-
]);
|
|
240
|
-
}).concat(scrollbarWidth
|
|
241
|
-
? [
|
|
242
|
-
h('td', {
|
|
243
|
-
class: 'vxe-footer--gutter col--gutter'
|
|
244
|
-
})
|
|
245
|
-
]
|
|
246
|
-
: []));
|
|
247
|
-
}))
|
|
275
|
+
}, renderHeads(h, this, footerTableData))
|
|
248
276
|
])
|
|
249
277
|
]);
|
|
250
278
|
},
|
package/es/table/src/header.js
CHANGED
|
@@ -5,6 +5,132 @@ import { getOffsetPos, hasClass, addClass, removeClass } from '../../ui/src/dom'
|
|
|
5
5
|
import { convertHeaderColumnToRows, getColReMinWidth } from './util';
|
|
6
6
|
const { renderer } = VxeUI;
|
|
7
7
|
const cellType = 'header';
|
|
8
|
+
const renderRows = (h, _vm, cols, $rowIndex) => {
|
|
9
|
+
const { $parent: $xetable, fixedType } = _vm;
|
|
10
|
+
const { $listeners: tableListeners, resizable: allResizable, border, columnKey, headerCellClassName, headerCellStyle, showHeaderOverflow: allColumnHeaderOverflow, headerAlign: allHeaderAlign, align: allAlign, highlightCurrentColumn, currentColumn, scrollXLoad, overflowX, scrollbarWidth, sortOpts, mouseConfig, columnOpts } = $xetable;
|
|
11
|
+
return cols.map((column, $columnIndex) => {
|
|
12
|
+
const { type, showHeaderOverflow, headerAlign, align, headerClassName, editRender, cellRender } = column;
|
|
13
|
+
// const { enabled } = tooltipOpts
|
|
14
|
+
const colid = column.id;
|
|
15
|
+
const renderOpts = editRender || cellRender;
|
|
16
|
+
const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
|
|
17
|
+
const isColGroup = column.children && column.children.length;
|
|
18
|
+
const fixedHiddenColumn = fixedType ? column.fixed !== fixedType && !isColGroup : column.fixed && overflowX;
|
|
19
|
+
const headOverflow = XEUtils.isUndefined(showHeaderOverflow) || XEUtils.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
20
|
+
const headAlign = headerAlign || (compConf ? compConf.tableHeaderCellAlign : '') || allHeaderAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
|
|
21
|
+
let showEllipsis = headOverflow === 'ellipsis';
|
|
22
|
+
const showTitle = headOverflow === 'title';
|
|
23
|
+
const showTooltip = headOverflow === true || headOverflow === 'tooltip';
|
|
24
|
+
let hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
25
|
+
const thOns = {};
|
|
26
|
+
const hasFilter = column.filters && column.filters.some((item) => item.checked);
|
|
27
|
+
const columnIndex = $xetable.getColumnIndex(column);
|
|
28
|
+
const _columnIndex = $xetable.getVTColumnIndex(column);
|
|
29
|
+
const params = { $table: $xetable, $grid: $xetable.xegrid, $rowIndex, column, columnIndex, $columnIndex, _columnIndex, fixed: fixedType, type: cellType, isHidden: fixedHiddenColumn, hasFilter };
|
|
30
|
+
// 虚拟滚动不支持动态高度
|
|
31
|
+
if (scrollXLoad && !hasEllipsis) {
|
|
32
|
+
showEllipsis = hasEllipsis = true;
|
|
33
|
+
}
|
|
34
|
+
if (columnOpts.isCurrent || highlightCurrentColumn || tableListeners['header-cell-click'] || sortOpts.trigger === 'cell') {
|
|
35
|
+
thOns.click = (evnt) => $xetable.triggerHeaderCellClickEvent(evnt, params);
|
|
36
|
+
}
|
|
37
|
+
if (tableListeners['header-cell-dblclick']) {
|
|
38
|
+
thOns.dblclick = (evnt) => $xetable.triggerHeaderCellDblclickEvent(evnt, params);
|
|
39
|
+
}
|
|
40
|
+
// 按下事件处理
|
|
41
|
+
if (mouseConfig) {
|
|
42
|
+
thOns.mousedown = (evnt) => $xetable.triggerHeaderCellMousedownEvent(evnt, params);
|
|
43
|
+
}
|
|
44
|
+
// 拖拽行事件
|
|
45
|
+
if (columnOpts.drag && !column.parentId) {
|
|
46
|
+
thOns.dragstart = $xetable.handleHeaderCellDragDragstartEvent;
|
|
47
|
+
thOns.dragend = $xetable.handleHeaderCellDragDragendEvent;
|
|
48
|
+
thOns.dragover = $xetable.handleHeaderCellDragDragoverEvent;
|
|
49
|
+
}
|
|
50
|
+
return h('th', {
|
|
51
|
+
class: ['vxe-header--column', colid, {
|
|
52
|
+
[`col--${headAlign}`]: headAlign,
|
|
53
|
+
[`col--${type}`]: type,
|
|
54
|
+
'col--last': $columnIndex === cols.length - 1,
|
|
55
|
+
'col--fixed': column.fixed,
|
|
56
|
+
'col--group': isColGroup,
|
|
57
|
+
'col--ellipsis': hasEllipsis,
|
|
58
|
+
'fixed--hidden': fixedHiddenColumn,
|
|
59
|
+
'is--sortable': column.sortable,
|
|
60
|
+
'col--filter': !!column.filters,
|
|
61
|
+
'is--filter-active': hasFilter,
|
|
62
|
+
'col--current': currentColumn === column
|
|
63
|
+
}, getClass(headerClassName, params), getClass(headerCellClassName, params)],
|
|
64
|
+
attrs: {
|
|
65
|
+
colid,
|
|
66
|
+
colspan: column.colSpan > 1 ? column.colSpan : null,
|
|
67
|
+
rowspan: column.rowSpan > 1 ? column.rowSpan : null
|
|
68
|
+
},
|
|
69
|
+
style: headerCellStyle ? (XEUtils.isFunction(headerCellStyle) ? headerCellStyle(params) : headerCellStyle) : null,
|
|
70
|
+
on: thOns,
|
|
71
|
+
key: columnKey || columnOpts.useKey || columnOpts.drag || isColGroup ? colid : $columnIndex
|
|
72
|
+
}, [
|
|
73
|
+
h('div', {
|
|
74
|
+
class: ['vxe-cell', {
|
|
75
|
+
'c--title': showTitle,
|
|
76
|
+
'c--tooltip': showTooltip,
|
|
77
|
+
'c--ellipsis': showEllipsis
|
|
78
|
+
}]
|
|
79
|
+
}, column.renderHeader(h, params)),
|
|
80
|
+
/**
|
|
81
|
+
* 列宽拖动
|
|
82
|
+
*/
|
|
83
|
+
!fixedHiddenColumn && !isColGroup && (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
|
|
84
|
+
? h('div', {
|
|
85
|
+
class: ['vxe-resizable', {
|
|
86
|
+
'is--line': !border || border === 'none'
|
|
87
|
+
}],
|
|
88
|
+
on: {
|
|
89
|
+
mousedown: (evnt) => _vm.resizeMousedown(evnt, params)
|
|
90
|
+
}
|
|
91
|
+
})
|
|
92
|
+
: null
|
|
93
|
+
]);
|
|
94
|
+
}).concat(scrollbarWidth
|
|
95
|
+
? [
|
|
96
|
+
h('th', {
|
|
97
|
+
key: `gr${$rowIndex}`,
|
|
98
|
+
class: 'vxe-header--gutter col--gutter'
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
: []);
|
|
102
|
+
};
|
|
103
|
+
function renderHeads(h, _vm, headerGroups) {
|
|
104
|
+
const { $parent: $xetable } = _vm;
|
|
105
|
+
const tableProps = $xetable;
|
|
106
|
+
const { fixedType } = _vm;
|
|
107
|
+
const { headerRowClassName, headerRowStyle } = tableProps;
|
|
108
|
+
const { isDragColMove } = $xetable;
|
|
109
|
+
const columnOpts = $xetable.columnOpts;
|
|
110
|
+
return headerGroups.map((cols, $rowIndex) => {
|
|
111
|
+
const params = { $table: $xetable, $rowIndex, fixed: fixedType, type: cellType };
|
|
112
|
+
if (columnOpts.drag) {
|
|
113
|
+
return h('transition-group', {
|
|
114
|
+
props: {
|
|
115
|
+
tag: 'tr',
|
|
116
|
+
name: `vxe-header--col-list${isDragColMove ? '' : '-disabled'}`,
|
|
117
|
+
class: [
|
|
118
|
+
'vxe-header--row',
|
|
119
|
+
headerRowClassName ? XEUtils.isFunction(headerRowClassName) ? headerRowClassName(params) : headerRowClassName : ''
|
|
120
|
+
],
|
|
121
|
+
style: headerRowStyle ? (XEUtils.isFunction(headerRowStyle) ? headerRowStyle(params) : headerRowStyle) : null
|
|
122
|
+
}
|
|
123
|
+
}, renderRows(h, _vm, cols, $rowIndex));
|
|
124
|
+
}
|
|
125
|
+
return h('tr', {
|
|
126
|
+
class: [
|
|
127
|
+
'vxe-header--row',
|
|
128
|
+
headerRowClassName ? XEUtils.isFunction(headerRowClassName) ? headerRowClassName(params) : headerRowClassName : ''
|
|
129
|
+
],
|
|
130
|
+
style: headerRowStyle ? (XEUtils.isFunction(headerRowStyle) ? headerRowStyle(params) : headerRowStyle) : null
|
|
131
|
+
}, renderRows(h, _vm, cols, $rowIndex));
|
|
132
|
+
});
|
|
133
|
+
}
|
|
8
134
|
export default {
|
|
9
135
|
name: 'VxeTableHeader',
|
|
10
136
|
props: {
|
|
@@ -52,7 +178,7 @@ export default {
|
|
|
52
178
|
},
|
|
53
179
|
render(h) {
|
|
54
180
|
const { _e, $parent: $xetable, fixedType, headerColumn, tableColumn, fixedColumn } = this;
|
|
55
|
-
const {
|
|
181
|
+
const { tId, isGroup, visibleColumn, showHeaderOverflow: allColumnHeaderOverflow, scrollXLoad, scrollbarWidth } = $xetable;
|
|
56
182
|
let headerGroups = headerColumn;
|
|
57
183
|
let renderColumnList = tableColumn;
|
|
58
184
|
if (isGroup) {
|
|
@@ -115,95 +241,7 @@ export default {
|
|
|
115
241
|
*/
|
|
116
242
|
h('thead', {
|
|
117
243
|
ref: 'thead'
|
|
118
|
-
},
|
|
119
|
-
return h('tr', {
|
|
120
|
-
class: ['vxe-header--row', headerRowClassName ? XEUtils.isFunction(headerRowClassName) ? headerRowClassName({ $table: $xetable, $rowIndex, fixed: fixedType, type: cellType }) : headerRowClassName : ''],
|
|
121
|
-
style: headerRowStyle ? (XEUtils.isFunction(headerRowStyle) ? headerRowStyle({ $table: $xetable, $rowIndex, fixed: fixedType, type: cellType }) : headerRowStyle) : null
|
|
122
|
-
}, cols.map((column, $columnIndex) => {
|
|
123
|
-
const { type, showHeaderOverflow, headerAlign, align, headerClassName, editRender, cellRender } = column;
|
|
124
|
-
// const { enabled } = tooltipOpts
|
|
125
|
-
const colid = column.id;
|
|
126
|
-
const renderOpts = editRender || cellRender;
|
|
127
|
-
const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
|
|
128
|
-
const isColGroup = column.children && column.children.length;
|
|
129
|
-
const fixedHiddenColumn = fixedType ? column.fixed !== fixedType && !isColGroup : column.fixed && overflowX;
|
|
130
|
-
const headOverflow = XEUtils.isUndefined(showHeaderOverflow) || XEUtils.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
131
|
-
const headAlign = headerAlign || (compConf ? compConf.tableHeaderCellAlign : '') || allHeaderAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
|
|
132
|
-
let showEllipsis = headOverflow === 'ellipsis';
|
|
133
|
-
const showTitle = headOverflow === 'title';
|
|
134
|
-
const showTooltip = headOverflow === true || headOverflow === 'tooltip';
|
|
135
|
-
let hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
136
|
-
const thOns = {};
|
|
137
|
-
const hasFilter = column.filters && column.filters.some((item) => item.checked);
|
|
138
|
-
const columnIndex = $xetable.getColumnIndex(column);
|
|
139
|
-
const _columnIndex = $xetable.getVTColumnIndex(column);
|
|
140
|
-
const params = { $table: $xetable, $grid: $xetable.xegrid, $rowIndex, column, columnIndex, $columnIndex, _columnIndex, fixed: fixedType, type: cellType, isHidden: fixedHiddenColumn, hasFilter };
|
|
141
|
-
// 虚拟滚动不支持动态高度
|
|
142
|
-
if (scrollXLoad && !hasEllipsis) {
|
|
143
|
-
showEllipsis = hasEllipsis = true;
|
|
144
|
-
}
|
|
145
|
-
if (columnOpts.isCurrent || highlightCurrentColumn || tableListeners['header-cell-click'] || sortOpts.trigger === 'cell') {
|
|
146
|
-
thOns.click = (evnt) => $xetable.triggerHeaderCellClickEvent(evnt, params);
|
|
147
|
-
}
|
|
148
|
-
if (tableListeners['header-cell-dblclick']) {
|
|
149
|
-
thOns.dblclick = (evnt) => $xetable.triggerHeaderCellDblclickEvent(evnt, params);
|
|
150
|
-
}
|
|
151
|
-
// 按下事件处理
|
|
152
|
-
if (mouseConfig) {
|
|
153
|
-
thOns.mousedown = (evnt) => $xetable.triggerHeaderCellMousedownEvent(evnt, params);
|
|
154
|
-
}
|
|
155
|
-
return h('th', {
|
|
156
|
-
class: ['vxe-header--column', colid, {
|
|
157
|
-
[`col--${headAlign}`]: headAlign,
|
|
158
|
-
[`col--${type}`]: type,
|
|
159
|
-
'col--last': $columnIndex === cols.length - 1,
|
|
160
|
-
'col--fixed': column.fixed,
|
|
161
|
-
'col--group': isColGroup,
|
|
162
|
-
'col--ellipsis': hasEllipsis,
|
|
163
|
-
'fixed--hidden': fixedHiddenColumn,
|
|
164
|
-
'is--sortable': column.sortable,
|
|
165
|
-
'col--filter': !!column.filters,
|
|
166
|
-
'is--filter-active': hasFilter,
|
|
167
|
-
'col--current': currentColumn === column
|
|
168
|
-
}, getClass(headerClassName, params), getClass(headerCellClassName, params)],
|
|
169
|
-
attrs: {
|
|
170
|
-
colid,
|
|
171
|
-
colspan: column.colSpan > 1 ? column.colSpan : null,
|
|
172
|
-
rowspan: column.rowSpan > 1 ? column.rowSpan : null
|
|
173
|
-
},
|
|
174
|
-
style: headerCellStyle ? (XEUtils.isFunction(headerCellStyle) ? headerCellStyle(params) : headerCellStyle) : null,
|
|
175
|
-
on: thOns,
|
|
176
|
-
key: columnKey || columnOpts.useKey || isColGroup ? colid : $columnIndex
|
|
177
|
-
}, [
|
|
178
|
-
h('div', {
|
|
179
|
-
class: ['vxe-cell', {
|
|
180
|
-
'c--title': showTitle,
|
|
181
|
-
'c--tooltip': showTooltip,
|
|
182
|
-
'c--ellipsis': showEllipsis
|
|
183
|
-
}]
|
|
184
|
-
}, column.renderHeader(h, params)),
|
|
185
|
-
/**
|
|
186
|
-
* 列宽拖动
|
|
187
|
-
*/
|
|
188
|
-
!fixedHiddenColumn && !isColGroup && (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable))
|
|
189
|
-
? h('div', {
|
|
190
|
-
class: ['vxe-resizable', {
|
|
191
|
-
'is--line': !border || border === 'none'
|
|
192
|
-
}],
|
|
193
|
-
on: {
|
|
194
|
-
mousedown: (evnt) => this.resizeMousedown(evnt, params)
|
|
195
|
-
}
|
|
196
|
-
})
|
|
197
|
-
: null
|
|
198
|
-
]);
|
|
199
|
-
}).concat(scrollbarWidth
|
|
200
|
-
? [
|
|
201
|
-
h('th', {
|
|
202
|
-
class: 'vxe-header--gutter col--gutter'
|
|
203
|
-
})
|
|
204
|
-
]
|
|
205
|
-
: []));
|
|
206
|
-
}))
|
|
244
|
+
}, renderHeads(h, this, headerGroups))
|
|
207
245
|
]),
|
|
208
246
|
/**
|
|
209
247
|
* 其他
|