vxe-table 3.10.16 → 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/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 +284 -65
- 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 +906 -449
- 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/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 +313 -68
- 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/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 +296 -67
- 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.1731633464058.ttf → iconfont.1731890707082.ttf} +0 -0
- /package/es/{iconfont.1731633464058.woff → iconfont.1731890707082.woff} +0 -0
- /package/es/{iconfont.1731633464058.woff2 → iconfont.1731890707082.woff2} +0 -0
- /package/lib/{iconfont.1731633464058.ttf → iconfont.1731890707082.ttf} +0 -0
- /package/lib/{iconfont.1731633464058.woff → iconfont.1731890707082.woff} +0 -0
- /package/lib/{iconfont.1731633464058.woff2 → iconfont.1731890707082.woff2} +0 -0
package/lib/table/src/header.js
CHANGED
|
@@ -14,6 +14,173 @@ const {
|
|
|
14
14
|
renderer
|
|
15
15
|
} = _ui.VxeUI;
|
|
16
16
|
const cellType = 'header';
|
|
17
|
+
const renderRows = (h, _vm, cols, $rowIndex) => {
|
|
18
|
+
const {
|
|
19
|
+
$parent: $xetable,
|
|
20
|
+
fixedType
|
|
21
|
+
} = _vm;
|
|
22
|
+
const {
|
|
23
|
+
$listeners: tableListeners,
|
|
24
|
+
resizable: allResizable,
|
|
25
|
+
border,
|
|
26
|
+
columnKey,
|
|
27
|
+
headerCellClassName,
|
|
28
|
+
headerCellStyle,
|
|
29
|
+
showHeaderOverflow: allColumnHeaderOverflow,
|
|
30
|
+
headerAlign: allHeaderAlign,
|
|
31
|
+
align: allAlign,
|
|
32
|
+
highlightCurrentColumn,
|
|
33
|
+
currentColumn,
|
|
34
|
+
scrollXLoad,
|
|
35
|
+
overflowX,
|
|
36
|
+
scrollbarWidth,
|
|
37
|
+
sortOpts,
|
|
38
|
+
mouseConfig,
|
|
39
|
+
columnOpts
|
|
40
|
+
} = $xetable;
|
|
41
|
+
return cols.map((column, $columnIndex) => {
|
|
42
|
+
const {
|
|
43
|
+
type,
|
|
44
|
+
showHeaderOverflow,
|
|
45
|
+
headerAlign,
|
|
46
|
+
align,
|
|
47
|
+
headerClassName,
|
|
48
|
+
editRender,
|
|
49
|
+
cellRender
|
|
50
|
+
} = column;
|
|
51
|
+
// const { enabled } = tooltipOpts
|
|
52
|
+
const colid = column.id;
|
|
53
|
+
const renderOpts = editRender || cellRender;
|
|
54
|
+
const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
|
|
55
|
+
const isColGroup = column.children && column.children.length;
|
|
56
|
+
const fixedHiddenColumn = fixedType ? column.fixed !== fixedType && !isColGroup : column.fixed && overflowX;
|
|
57
|
+
const headOverflow = _xeUtils.default.isUndefined(showHeaderOverflow) || _xeUtils.default.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
58
|
+
const headAlign = headerAlign || (compConf ? compConf.tableHeaderCellAlign : '') || allHeaderAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
|
|
59
|
+
let showEllipsis = headOverflow === 'ellipsis';
|
|
60
|
+
const showTitle = headOverflow === 'title';
|
|
61
|
+
const showTooltip = headOverflow === true || headOverflow === 'tooltip';
|
|
62
|
+
let hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
63
|
+
const thOns = {};
|
|
64
|
+
const hasFilter = column.filters && column.filters.some(item => item.checked);
|
|
65
|
+
const columnIndex = $xetable.getColumnIndex(column);
|
|
66
|
+
const _columnIndex = $xetable.getVTColumnIndex(column);
|
|
67
|
+
const params = {
|
|
68
|
+
$table: $xetable,
|
|
69
|
+
$grid: $xetable.xegrid,
|
|
70
|
+
$rowIndex,
|
|
71
|
+
column,
|
|
72
|
+
columnIndex,
|
|
73
|
+
$columnIndex,
|
|
74
|
+
_columnIndex,
|
|
75
|
+
fixed: fixedType,
|
|
76
|
+
type: cellType,
|
|
77
|
+
isHidden: fixedHiddenColumn,
|
|
78
|
+
hasFilter
|
|
79
|
+
};
|
|
80
|
+
// 虚拟滚动不支持动态高度
|
|
81
|
+
if (scrollXLoad && !hasEllipsis) {
|
|
82
|
+
showEllipsis = hasEllipsis = true;
|
|
83
|
+
}
|
|
84
|
+
if (columnOpts.isCurrent || highlightCurrentColumn || tableListeners['header-cell-click'] || sortOpts.trigger === 'cell') {
|
|
85
|
+
thOns.click = evnt => $xetable.triggerHeaderCellClickEvent(evnt, params);
|
|
86
|
+
}
|
|
87
|
+
if (tableListeners['header-cell-dblclick']) {
|
|
88
|
+
thOns.dblclick = evnt => $xetable.triggerHeaderCellDblclickEvent(evnt, params);
|
|
89
|
+
}
|
|
90
|
+
// 按下事件处理
|
|
91
|
+
if (mouseConfig) {
|
|
92
|
+
thOns.mousedown = evnt => $xetable.triggerHeaderCellMousedownEvent(evnt, params);
|
|
93
|
+
}
|
|
94
|
+
// 拖拽行事件
|
|
95
|
+
if (columnOpts.drag && !column.parentId) {
|
|
96
|
+
thOns.dragstart = $xetable.handleHeaderCellDragDragstartEvent;
|
|
97
|
+
thOns.dragend = $xetable.handleHeaderCellDragDragendEvent;
|
|
98
|
+
thOns.dragover = $xetable.handleHeaderCellDragDragoverEvent;
|
|
99
|
+
}
|
|
100
|
+
return h('th', {
|
|
101
|
+
class: ['vxe-header--column', colid, {
|
|
102
|
+
[`col--${headAlign}`]: headAlign,
|
|
103
|
+
[`col--${type}`]: type,
|
|
104
|
+
'col--last': $columnIndex === cols.length - 1,
|
|
105
|
+
'col--fixed': column.fixed,
|
|
106
|
+
'col--group': isColGroup,
|
|
107
|
+
'col--ellipsis': hasEllipsis,
|
|
108
|
+
'fixed--hidden': fixedHiddenColumn,
|
|
109
|
+
'is--sortable': column.sortable,
|
|
110
|
+
'col--filter': !!column.filters,
|
|
111
|
+
'is--filter-active': hasFilter,
|
|
112
|
+
'col--current': currentColumn === column
|
|
113
|
+
}, (0, _utils.getClass)(headerClassName, params), (0, _utils.getClass)(headerCellClassName, params)],
|
|
114
|
+
attrs: {
|
|
115
|
+
colid,
|
|
116
|
+
colspan: column.colSpan > 1 ? column.colSpan : null,
|
|
117
|
+
rowspan: column.rowSpan > 1 ? column.rowSpan : null
|
|
118
|
+
},
|
|
119
|
+
style: headerCellStyle ? _xeUtils.default.isFunction(headerCellStyle) ? headerCellStyle(params) : headerCellStyle : null,
|
|
120
|
+
on: thOns,
|
|
121
|
+
key: columnKey || columnOpts.useKey || columnOpts.drag || isColGroup ? colid : $columnIndex
|
|
122
|
+
}, [h('div', {
|
|
123
|
+
class: ['vxe-cell', {
|
|
124
|
+
'c--title': showTitle,
|
|
125
|
+
'c--tooltip': showTooltip,
|
|
126
|
+
'c--ellipsis': showEllipsis
|
|
127
|
+
}]
|
|
128
|
+
}, column.renderHeader(h, params)),
|
|
129
|
+
/**
|
|
130
|
+
* 列宽拖动
|
|
131
|
+
*/
|
|
132
|
+
!fixedHiddenColumn && !isColGroup && (_xeUtils.default.isBoolean(column.resizable) ? column.resizable : columnOpts.resizable || allResizable) ? h('div', {
|
|
133
|
+
class: ['vxe-resizable', {
|
|
134
|
+
'is--line': !border || border === 'none'
|
|
135
|
+
}],
|
|
136
|
+
on: {
|
|
137
|
+
mousedown: evnt => _vm.resizeMousedown(evnt, params)
|
|
138
|
+
}
|
|
139
|
+
}) : null]);
|
|
140
|
+
}).concat(scrollbarWidth ? [h('th', {
|
|
141
|
+
key: `gr${$rowIndex}`,
|
|
142
|
+
class: 'vxe-header--gutter col--gutter'
|
|
143
|
+
})] : []);
|
|
144
|
+
};
|
|
145
|
+
function renderHeads(h, _vm, headerGroups) {
|
|
146
|
+
const {
|
|
147
|
+
$parent: $xetable
|
|
148
|
+
} = _vm;
|
|
149
|
+
const tableProps = $xetable;
|
|
150
|
+
const {
|
|
151
|
+
fixedType
|
|
152
|
+
} = _vm;
|
|
153
|
+
const {
|
|
154
|
+
headerRowClassName,
|
|
155
|
+
headerRowStyle
|
|
156
|
+
} = tableProps;
|
|
157
|
+
const {
|
|
158
|
+
isDragColMove
|
|
159
|
+
} = $xetable;
|
|
160
|
+
const columnOpts = $xetable.columnOpts;
|
|
161
|
+
return headerGroups.map((cols, $rowIndex) => {
|
|
162
|
+
const params = {
|
|
163
|
+
$table: $xetable,
|
|
164
|
+
$rowIndex,
|
|
165
|
+
fixed: fixedType,
|
|
166
|
+
type: cellType
|
|
167
|
+
};
|
|
168
|
+
if (columnOpts.drag) {
|
|
169
|
+
return h('transition-group', {
|
|
170
|
+
props: {
|
|
171
|
+
tag: 'tr',
|
|
172
|
+
name: `vxe-header--col-list${isDragColMove ? '' : '-disabled'}`,
|
|
173
|
+
class: ['vxe-header--row', headerRowClassName ? _xeUtils.default.isFunction(headerRowClassName) ? headerRowClassName(params) : headerRowClassName : ''],
|
|
174
|
+
style: headerRowStyle ? _xeUtils.default.isFunction(headerRowStyle) ? headerRowStyle(params) : headerRowStyle : null
|
|
175
|
+
}
|
|
176
|
+
}, renderRows(h, _vm, cols, $rowIndex));
|
|
177
|
+
}
|
|
178
|
+
return h('tr', {
|
|
179
|
+
class: ['vxe-header--row', headerRowClassName ? _xeUtils.default.isFunction(headerRowClassName) ? headerRowClassName(params) : headerRowClassName : ''],
|
|
180
|
+
style: headerRowStyle ? _xeUtils.default.isFunction(headerRowStyle) ? headerRowStyle(params) : headerRowStyle : null
|
|
181
|
+
}, renderRows(h, _vm, cols, $rowIndex));
|
|
182
|
+
});
|
|
183
|
+
}
|
|
17
184
|
var _default = exports.default = {
|
|
18
185
|
name: 'VxeTableHeader',
|
|
19
186
|
props: {
|
|
@@ -81,28 +248,12 @@ var _default = exports.default = {
|
|
|
81
248
|
fixedColumn
|
|
82
249
|
} = this;
|
|
83
250
|
const {
|
|
84
|
-
$listeners: tableListeners,
|
|
85
251
|
tId,
|
|
86
252
|
isGroup,
|
|
87
253
|
visibleColumn,
|
|
88
|
-
resizable: allResizable,
|
|
89
|
-
border,
|
|
90
|
-
columnKey,
|
|
91
|
-
headerRowClassName,
|
|
92
|
-
headerCellClassName,
|
|
93
|
-
headerRowStyle,
|
|
94
|
-
headerCellStyle,
|
|
95
254
|
showHeaderOverflow: allColumnHeaderOverflow,
|
|
96
|
-
headerAlign: allHeaderAlign,
|
|
97
|
-
align: allAlign,
|
|
98
|
-
highlightCurrentColumn,
|
|
99
|
-
currentColumn,
|
|
100
255
|
scrollXLoad,
|
|
101
|
-
|
|
102
|
-
scrollbarWidth,
|
|
103
|
-
sortOpts,
|
|
104
|
-
mouseConfig,
|
|
105
|
-
columnOpts
|
|
256
|
+
scrollbarWidth
|
|
106
257
|
} = $xetable;
|
|
107
258
|
let headerGroups = headerColumn;
|
|
108
259
|
let renderColumnList = tableColumn;
|
|
@@ -157,117 +308,7 @@ var _default = exports.default = {
|
|
|
157
308
|
*/
|
|
158
309
|
h('thead', {
|
|
159
310
|
ref: 'thead'
|
|
160
|
-
},
|
|
161
|
-
return h('tr', {
|
|
162
|
-
class: ['vxe-header--row', headerRowClassName ? _xeUtils.default.isFunction(headerRowClassName) ? headerRowClassName({
|
|
163
|
-
$table: $xetable,
|
|
164
|
-
$rowIndex,
|
|
165
|
-
fixed: fixedType,
|
|
166
|
-
type: cellType
|
|
167
|
-
}) : headerRowClassName : ''],
|
|
168
|
-
style: headerRowStyle ? _xeUtils.default.isFunction(headerRowStyle) ? headerRowStyle({
|
|
169
|
-
$table: $xetable,
|
|
170
|
-
$rowIndex,
|
|
171
|
-
fixed: fixedType,
|
|
172
|
-
type: cellType
|
|
173
|
-
}) : headerRowStyle : null
|
|
174
|
-
}, cols.map((column, $columnIndex) => {
|
|
175
|
-
const {
|
|
176
|
-
type,
|
|
177
|
-
showHeaderOverflow,
|
|
178
|
-
headerAlign,
|
|
179
|
-
align,
|
|
180
|
-
headerClassName,
|
|
181
|
-
editRender,
|
|
182
|
-
cellRender
|
|
183
|
-
} = column;
|
|
184
|
-
// const { enabled } = tooltipOpts
|
|
185
|
-
const colid = column.id;
|
|
186
|
-
const renderOpts = editRender || cellRender;
|
|
187
|
-
const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
|
|
188
|
-
const isColGroup = column.children && column.children.length;
|
|
189
|
-
const fixedHiddenColumn = fixedType ? column.fixed !== fixedType && !isColGroup : column.fixed && overflowX;
|
|
190
|
-
const headOverflow = _xeUtils.default.isUndefined(showHeaderOverflow) || _xeUtils.default.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
191
|
-
const headAlign = headerAlign || (compConf ? compConf.tableHeaderCellAlign : '') || allHeaderAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
|
|
192
|
-
let showEllipsis = headOverflow === 'ellipsis';
|
|
193
|
-
const showTitle = headOverflow === 'title';
|
|
194
|
-
const showTooltip = headOverflow === true || headOverflow === 'tooltip';
|
|
195
|
-
let hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
196
|
-
const thOns = {};
|
|
197
|
-
const hasFilter = column.filters && column.filters.some(item => item.checked);
|
|
198
|
-
const columnIndex = $xetable.getColumnIndex(column);
|
|
199
|
-
const _columnIndex = $xetable.getVTColumnIndex(column);
|
|
200
|
-
const params = {
|
|
201
|
-
$table: $xetable,
|
|
202
|
-
$grid: $xetable.xegrid,
|
|
203
|
-
$rowIndex,
|
|
204
|
-
column,
|
|
205
|
-
columnIndex,
|
|
206
|
-
$columnIndex,
|
|
207
|
-
_columnIndex,
|
|
208
|
-
fixed: fixedType,
|
|
209
|
-
type: cellType,
|
|
210
|
-
isHidden: fixedHiddenColumn,
|
|
211
|
-
hasFilter
|
|
212
|
-
};
|
|
213
|
-
// 虚拟滚动不支持动态高度
|
|
214
|
-
if (scrollXLoad && !hasEllipsis) {
|
|
215
|
-
showEllipsis = hasEllipsis = true;
|
|
216
|
-
}
|
|
217
|
-
if (columnOpts.isCurrent || highlightCurrentColumn || tableListeners['header-cell-click'] || sortOpts.trigger === 'cell') {
|
|
218
|
-
thOns.click = evnt => $xetable.triggerHeaderCellClickEvent(evnt, params);
|
|
219
|
-
}
|
|
220
|
-
if (tableListeners['header-cell-dblclick']) {
|
|
221
|
-
thOns.dblclick = evnt => $xetable.triggerHeaderCellDblclickEvent(evnt, params);
|
|
222
|
-
}
|
|
223
|
-
// 按下事件处理
|
|
224
|
-
if (mouseConfig) {
|
|
225
|
-
thOns.mousedown = evnt => $xetable.triggerHeaderCellMousedownEvent(evnt, params);
|
|
226
|
-
}
|
|
227
|
-
return h('th', {
|
|
228
|
-
class: ['vxe-header--column', colid, {
|
|
229
|
-
[`col--${headAlign}`]: headAlign,
|
|
230
|
-
[`col--${type}`]: type,
|
|
231
|
-
'col--last': $columnIndex === cols.length - 1,
|
|
232
|
-
'col--fixed': column.fixed,
|
|
233
|
-
'col--group': isColGroup,
|
|
234
|
-
'col--ellipsis': hasEllipsis,
|
|
235
|
-
'fixed--hidden': fixedHiddenColumn,
|
|
236
|
-
'is--sortable': column.sortable,
|
|
237
|
-
'col--filter': !!column.filters,
|
|
238
|
-
'is--filter-active': hasFilter,
|
|
239
|
-
'col--current': currentColumn === column
|
|
240
|
-
}, (0, _utils.getClass)(headerClassName, params), (0, _utils.getClass)(headerCellClassName, params)],
|
|
241
|
-
attrs: {
|
|
242
|
-
colid,
|
|
243
|
-
colspan: column.colSpan > 1 ? column.colSpan : null,
|
|
244
|
-
rowspan: column.rowSpan > 1 ? column.rowSpan : null
|
|
245
|
-
},
|
|
246
|
-
style: headerCellStyle ? _xeUtils.default.isFunction(headerCellStyle) ? headerCellStyle(params) : headerCellStyle : null,
|
|
247
|
-
on: thOns,
|
|
248
|
-
key: columnKey || columnOpts.useKey || isColGroup ? colid : $columnIndex
|
|
249
|
-
}, [h('div', {
|
|
250
|
-
class: ['vxe-cell', {
|
|
251
|
-
'c--title': showTitle,
|
|
252
|
-
'c--tooltip': showTooltip,
|
|
253
|
-
'c--ellipsis': showEllipsis
|
|
254
|
-
}]
|
|
255
|
-
}, column.renderHeader(h, params)),
|
|
256
|
-
/**
|
|
257
|
-
* 列宽拖动
|
|
258
|
-
*/
|
|
259
|
-
!fixedHiddenColumn && !isColGroup && (_xeUtils.default.isBoolean(column.resizable) ? column.resizable : columnOpts.resizable || allResizable) ? h('div', {
|
|
260
|
-
class: ['vxe-resizable', {
|
|
261
|
-
'is--line': !border || border === 'none'
|
|
262
|
-
}],
|
|
263
|
-
on: {
|
|
264
|
-
mousedown: evnt => this.resizeMousedown(evnt, params)
|
|
265
|
-
}
|
|
266
|
-
}) : null]);
|
|
267
|
-
}).concat(scrollbarWidth ? [h('th', {
|
|
268
|
-
class: 'vxe-header--gutter col--gutter'
|
|
269
|
-
})] : []));
|
|
270
|
-
}))]),
|
|
311
|
+
}, renderHeads(h, this, headerGroups))]),
|
|
271
312
|
/**
|
|
272
313
|
* 其他
|
|
273
314
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_utils=require("../../ui/src/utils"),_dom=require("../../ui/src/dom"),_util=require("./util");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let renderer=_ui.VxeUI.renderer,cellType="header"
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_ui=require("../../ui"),_utils=require("../../ui/src/utils"),_dom=require("../../ui/src/dom"),_util=require("./util");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}let renderer=_ui.VxeUI.renderer,cellType="header",renderRows=(x,v,C,b)=>{let{$parent:y,fixedType:_}=v,{$listeners:w,resizable:$,border:z,columnKey:S,headerCellClassName:H,headerCellStyle:T,showHeaderOverflow:R,headerAlign:D,align:M,highlightCurrentColumn:W,currentColumn:k,scrollXLoad:U,overflowX:I,scrollbarWidth:e,sortOpts:O,mouseConfig:A,columnOpts:E}=y;return C.map((e,l)=>{var{type:r,showHeaderOverflow:t,headerAlign:a,align:i,headerClassName:o,editRender:n,cellRender:s}=e,d=e.id,n=n||s,s=n?renderer.get(n.name):null,n=e.children&&e.children.length,u=_?e.fixed!==_&&!n:e.fixed&&I,t=_xeUtils.default.isUndefined(t)||_xeUtils.default.isNull(t)?R:t,a=a||(s?s.tableHeaderCellAlign:"")||D||i||(s?s.tableCellAlign:"")||M;let c="ellipsis"===t;i="title"===t,s=!0===t||"tooltip"===t;let p=i||s||c;var t={},m=e.filters&&e.filters.some(e=>e.checked),h=y.getColumnIndex(e),f=y.getVTColumnIndex(e);let g={$table:y,$grid:y.xegrid,$rowIndex:b,column:e,columnIndex:h,$columnIndex:l,_columnIndex:f,fixed:_,type:cellType,isHidden:u,hasFilter:m};return U&&!p&&(c=p=!0),(E.isCurrent||W||w["header-cell-click"]||"cell"===O.trigger)&&(t.click=e=>y.triggerHeaderCellClickEvent(e,g)),w["header-cell-dblclick"]&&(t.dblclick=e=>y.triggerHeaderCellDblclickEvent(e,g)),A&&(t.mousedown=e=>y.triggerHeaderCellMousedownEvent(e,g)),E.drag&&!e.parentId&&(t.dragstart=y.handleHeaderCellDragDragstartEvent,t.dragend=y.handleHeaderCellDragDragendEvent,t.dragover=y.handleHeaderCellDragDragoverEvent),x("th",{class:["vxe-header--column",d,{["col--"+a]:a,["col--"+r]:r,"col--last":l===C.length-1,"col--fixed":e.fixed,"col--group":n,"col--ellipsis":p,"fixed--hidden":u,"is--sortable":e.sortable,"col--filter":!!e.filters,"is--filter-active":m,"col--current":k===e},(0,_utils.getClass)(o,g),(0,_utils.getClass)(H,g)],attrs:{colid:d,colspan:1<e.colSpan?e.colSpan:null,rowspan:1<e.rowSpan?e.rowSpan:null},style:T?_xeUtils.default.isFunction(T)?T(g):T:null,on:t,key:S||E.useKey||E.drag||n?d:l},[x("div",{class:["vxe-cell",{"c--title":i,"c--tooltip":s,"c--ellipsis":c}]},e.renderHeader(x,g)),u||n||!(_xeUtils.default.isBoolean(e.resizable)?e.resizable:E.resizable||$)?null:x("div",{class:["vxe-resizable",{"is--line":!z||"none"===z}],on:{mousedown:e=>v.resizeMousedown(e,g)}})])}).concat(e?[x("th",{key:"gr"+b,class:"vxe-header--gutter col--gutter"})]:[])};function renderHeads(t,a,e){let i=a.$parent;var l=i;let o=a.fixedType,{headerRowClassName:n,headerRowStyle:s}=l,d=i.isDragColMove,u=i.columnOpts;return e.map((e,l)=>{var r={$table:i,$rowIndex:l,fixed:o,type:cellType};return u.drag?t("transition-group",{props:{tag:"tr",name:"vxe-header--col-list"+(d?"":"-disabled"),class:["vxe-header--row",n?_xeUtils.default.isFunction(n)?n(r):n:""],style:s?_xeUtils.default.isFunction(s)?s(r):s:null}},renderRows(t,a,e,l)):t("tr",{class:["vxe-header--row",n?_xeUtils.default.isFunction(n)?n(r):n:""],style:s?_xeUtils.default.isFunction(s)?s(r):s:null},renderRows(t,a,e,l))})}var _default=exports.default={name:"VxeTableHeader",props:{tableData:Array,tableColumn:Array,tableGroupColumn:Array,fixedColumn:Array,size:String,fixedType:String},data(){return{headerColumn:[]}},watch:{tableColumn(){this.uploadColumn()}},created(){this.uploadColumn()},mounted(){var{$parent:e,$el:l,$refs:r,fixedType:t}=this,e=e.elemStore,t=`${t||"main"}-header-`;e[t+"wrapper"]=l,e[t+"table"]=r.table,e[t+"colgroup"]=r.colgroup,e[t+"list"]=r.thead,e[t+"xSpace"]=r.xSpace,e[t+"repair"]=r.repair},destroyed(){var{$parent:e,fixedType:l}=this,e=e.elemStore,l=`${l||"main"}-header-`;e[l+"wrapper"]=null,e[l+"table"]=null,e[l+"colgroup"]=null,e[l+"list"]=null,e[l+"xSpace"]=null,e[l+"repair"]=null},render(r){var{_e:e,$parent:l,fixedType:t,headerColumn:a,tableColumn:i,fixedColumn:o}=this,{tId:l,isGroup:n,visibleColumn:s,showHeaderOverflow:d,scrollXLoad:u,scrollbarWidth:c}=l;let p=a,m=i;return n?m=s:(t&&(u||d)&&(m=o),p=[m]),r("div",{class:["vxe-table--header-wrapper",t?`fixed-${t}--wrapper`:"body--wrapper"],attrs:{xid:l}},[t?e():r("div",{class:"vxe-body--x-space",ref:"xSpace"}),r("table",{class:"vxe-table--header",attrs:{xid:l,cellspacing:0,cellpadding:0,border:0},ref:"table"},[r("colgroup",{ref:"colgroup"},m.map((e,l)=>r("col",{attrs:{name:e.id},key:l})).concat(c?[r("col",{attrs:{name:"col_gutter"}})]:[])),r("thead",{ref:"thead"},renderHeads(r,this,p))]),r("div",{class:"vxe-table--header-border-line",ref:"repair"})])},methods:{uploadColumn(){var e=this.$parent;this.headerColumn=e.isGroup?(0,_util.convertHeaderColumnToRows)(this.tableGroupColumn):[]},resizeMousedown(e,r){let t=r.column,{$parent:a,$el:l,fixedType:i}=this,{tableBody:o,leftContainer:n,rightContainer:s,resizeBar:d}=a.$refs,{target:u,clientX:c}=e,p=r.cell=u.parentNode,m=0,h=o.$el;var f=(0,_dom.getOffsetPos)(u,l),g=u.clientWidth,x=Math.floor(g/2);let v=(0,_util.getColReMinWidth)(r)-x,C=f.left-p.clientWidth+g+v,b=f.left+x,y=document.onmousemove,_=document.onmouseup,w="left"===i,$="right"===i,z=0;if(w||$){var S=w?"nextElementSibling":"previousElementSibling";let e=p[S];for(;e&&!(0,_dom.hasClass)(e,"fixed--hidden");)(0,_dom.hasClass)(e,"col--group")||(z+=e.offsetWidth),e=e[S];$&&s&&(b=s.offsetLeft+z)}function H(e){e.stopPropagation(),e.preventDefault(),e=e.clientX-c;let l=b+e;e=i?0:h.scrollLeft,w?l=Math.min(l,(s?s.offsetLeft:h.clientWidth)-z-v):$?(C=(n?n.clientWidth:0)+z+v,l=Math.min(l,b+p.clientWidth-v)):C=Math.max(h.scrollLeft,C),m=Math.max(l,C),d.style.left=m-e+"px"}a._isResize=!0,(0,_dom.addClass)(a.$el,"drag--resize"),d.style.display="block",document.onmousemove=H,document.onmouseup=function(e){document.onmousemove=y,document.onmouseup=_;let l=t.renderWidth+($?b-m:m-b);t.resizeWidth=l,d.style.display="none",a._isResize=!1,a._lastResizeTime=Date.now(),a.analyColumnWidth(),a.recalculate(!0).then(()=>{a.saveCustomStore("update:visible"),a.updateCellAreas(),a.emitEvent("resizable-change",Object.assign(Object.assign({},r),{resizeWidth:l}),e),setTimeout(()=>a.recalculate(!0),300)}),(0,_dom.removeClass)(a.$el,"drag--resize")},H(e),a.closeMenu()}}};
|