vxe-table 4.10.6-beta.8 → 4.10.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/grid/src/grid.js +1 -1
- package/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/locale/lang/ar-EG.js +2 -1
- package/es/locale/lang/de-DE.js +2 -1
- package/es/locale/lang/en-US.js +4 -3
- package/es/locale/lang/es-ES.js +2 -1
- package/es/locale/lang/fr-FR.js +2 -1
- package/es/locale/lang/hu-HU.js +2 -1
- package/es/locale/lang/hy-AM.js +2 -1
- package/es/locale/lang/it-IT.js +2 -1
- package/es/locale/lang/ja-JP.js +2 -1
- package/es/locale/lang/ko-KR.js +2 -1
- package/es/locale/lang/nb-NO.js +2 -1
- package/es/locale/lang/pt-BR.js +2 -1
- package/es/locale/lang/ru-RU.js +4 -3
- package/es/locale/lang/th-TH.js +2 -1
- package/es/locale/lang/ug-CN.js +2 -1
- package/es/locale/lang/uk-UA.js +518 -517
- package/es/locale/lang/vi-VN.js +2 -1
- package/es/locale/lang/zh-CHT.js +2 -1
- package/es/locale/lang/zh-CN.js +2 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/edit/hook.js +7 -7
- package/es/table/module/export/hook.js +97 -62
- package/es/table/module/keyboard/hook.js +63 -27
- package/es/table/src/body.js +128 -81
- package/es/table/src/cell.js +41 -55
- package/es/table/src/column.js +13 -1
- package/es/table/src/columnInfo.js +3 -0
- package/es/table/src/emits.js +2 -0
- package/es/table/src/footer.js +48 -10
- package/es/table/src/header.js +70 -168
- package/es/table/src/props.js +14 -4
- package/es/table/src/table.js +884 -426
- package/es/table/src/util.js +77 -62
- package/es/table/style.css +253 -189
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +26 -11
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +253 -189
- package/es/vxe-table/style.min.css +1 -1
- package/lib/grid/src/grid.js +1 -1
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +1533 -917
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +2 -1
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/de-DE.js +2 -1
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/en-US.js +4 -3
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +4 -3
- 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/fr-FR.js +2 -1
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/hu-HU.js +2 -1
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +2 -1
- package/lib/locale/lang/hy-AM.js +2 -1
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/it-IT.js +2 -1
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/ja-JP.js +2 -1
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +2 -1
- package/lib/locale/lang/ko-KR.js +2 -1
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +2 -1
- package/lib/locale/lang/nb-NO.js +2 -1
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/pt-BR.js +2 -1
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +2 -1
- package/lib/locale/lang/ru-RU.js +4 -3
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +4 -3
- package/lib/locale/lang/th-TH.js +2 -1
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/ug-CN.js +2 -1
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/uk-UA.js +518 -517
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +518 -517
- package/lib/locale/lang/vi-VN.js +2 -1
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +2 -1
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CN.js +2 -1
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +2 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/edit/hook.js +7 -2
- package/lib/table/module/edit/hook.min.js +1 -1
- package/lib/table/module/export/hook.js +97 -57
- package/lib/table/module/export/hook.min.js +1 -1
- package/lib/table/module/keyboard/hook.js +71 -28
- package/lib/table/module/keyboard/hook.min.js +1 -1
- package/lib/table/src/body.js +129 -80
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +32 -42
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +13 -1
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/columnInfo.js +3 -0
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/emits.js +1 -1
- package/lib/table/src/emits.min.js +1 -1
- package/lib/table/src/footer.js +48 -8
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +54 -181
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/props.js +14 -4
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +935 -417
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +100 -82
- package/lib/table/src/util.min.js +1 -1
- package/lib/table/style/style.css +253 -189
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +26 -11
- 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 +253 -189
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/grid/src/grid.ts +1 -1
- package/packages/locale/lang/ar-EG.ts +2 -1
- package/packages/locale/lang/de-DE.ts +2 -1
- package/packages/locale/lang/en-US.ts +4 -3
- package/packages/locale/lang/es-ES.ts +2 -1
- package/packages/locale/lang/fr-FR.ts +2 -1
- package/packages/locale/lang/hu-HU.ts +2 -1
- package/packages/locale/lang/hy-AM.ts +2 -1
- package/packages/locale/lang/it-IT.ts +2 -1
- package/packages/locale/lang/ja-JP.ts +2 -1
- package/packages/locale/lang/ko-KR.ts +2 -1
- package/packages/locale/lang/nb-NO.ts +2 -1
- package/packages/locale/lang/pt-BR.ts +2 -1
- package/packages/locale/lang/ru-RU.ts +4 -3
- package/packages/locale/lang/th-TH.ts +2 -1
- package/packages/locale/lang/ug-CN.ts +2 -1
- package/packages/locale/lang/uk-UA.ts +518 -517
- package/packages/locale/lang/vi-VN.ts +2 -1
- package/packages/locale/lang/zh-CHT.ts +2 -1
- package/packages/locale/lang/zh-CN.ts +2 -1
- package/packages/table/module/edit/hook.ts +7 -7
- package/packages/table/module/export/hook.ts +118 -65
- package/packages/table/module/keyboard/hook.ts +59 -25
- package/packages/table/src/body.ts +148 -91
- package/packages/table/src/cell.ts +41 -63
- package/packages/table/src/column.ts +13 -1
- package/packages/table/src/columnInfo.ts +3 -0
- package/packages/table/src/emits.ts +5 -1
- package/packages/table/src/footer.ts +51 -11
- package/packages/table/src/header.ts +70 -168
- package/packages/table/src/props.ts +14 -5
- package/packages/table/src/table.ts +890 -428
- package/packages/table/src/util.ts +81 -62
- package/packages/ui/index.ts +25 -10
- package/styles/components/table.scss +319 -271
- package/styles/theme/base.scss +4 -6
- package/styles/theme/dark.scss +1 -0
- package/styles/theme/light.scss +1 -0
- package/styles/variable.scss +1 -1
- /package/es/{iconfont.1736840923205.ttf → iconfont.1738985856004.ttf} +0 -0
- /package/es/{iconfont.1736840923205.woff → iconfont.1738985856004.woff} +0 -0
- /package/es/{iconfont.1736840923205.woff2 → iconfont.1738985856004.woff2} +0 -0
- /package/lib/{iconfont.1736840923205.ttf → iconfont.1738985856004.ttf} +0 -0
- /package/lib/{iconfont.1736840923205.woff → iconfont.1738985856004.woff} +0 -0
- /package/lib/{iconfont.1736840923205.woff2 → iconfont.1738985856004.woff2} +0 -0
package/es/table/src/footer.js
CHANGED
|
@@ -2,6 +2,7 @@ import { defineComponent, TransitionGroup, h, ref, inject, nextTick, onMounted,
|
|
|
2
2
|
import XEUtils from 'xe-utils';
|
|
3
3
|
import { VxeUI } from '../../ui';
|
|
4
4
|
import { updateCellTitle, getPropClass } from '../../ui/src/dom';
|
|
5
|
+
import { getCellHeight } from './util';
|
|
5
6
|
const { renderer, renderEmptyElement } = VxeUI;
|
|
6
7
|
const renderType = 'footer';
|
|
7
8
|
function mergeFooterMethod(mergeFooterList, _rowIndex, _columnIndex) {
|
|
@@ -40,7 +41,7 @@ export default defineComponent({
|
|
|
40
41
|
setup(props) {
|
|
41
42
|
const $xeTable = inject('$xeTable', {});
|
|
42
43
|
const { xID, props: tableProps, reactData: tableReactData, internalData: tableInternalData } = $xeTable;
|
|
43
|
-
const { computeTooltipOpts, computeColumnOpts, computeColumnDragOpts } = $xeTable.getComputeMaps();
|
|
44
|
+
const { computeTooltipOpts, computeColumnOpts, computeColumnDragOpts, computeCellOpts, computeFooterCellOpts, computeDefaultRowHeight, computeResizableOpts } = $xeTable.getComputeMaps();
|
|
44
45
|
const refElem = ref();
|
|
45
46
|
const refFooterScroll = ref();
|
|
46
47
|
const refFooterTable = ref();
|
|
@@ -49,25 +50,34 @@ export default defineComponent({
|
|
|
49
50
|
const refFooterXSpace = ref();
|
|
50
51
|
const renderRows = (tableColumn, footerTableData, row, $rowIndex, _rowIndex) => {
|
|
51
52
|
const { fixedType } = props;
|
|
52
|
-
const { footerCellClassName, footerCellStyle, footerAlign: allFooterAlign, footerSpanMethod, align: allAlign, columnKey, showFooterOverflow: allColumnFooterOverflow } = tableProps;
|
|
53
|
+
const { resizable: allResizable, border, footerCellClassName, footerCellStyle, footerAlign: allFooterAlign, footerSpanMethod, align: allAlign, columnKey, showFooterOverflow: allColumnFooterOverflow } = tableProps;
|
|
53
54
|
const { scrollXLoad, scrollYLoad, overflowX, currentColumn, mergeFooterList } = tableReactData;
|
|
54
55
|
const { scrollXStore } = tableInternalData;
|
|
55
56
|
const tooltipOpts = computeTooltipOpts.value;
|
|
57
|
+
const resizableOpts = computeResizableOpts.value;
|
|
58
|
+
const { isAllColumnDrag } = resizableOpts;
|
|
56
59
|
const columnOpts = computeColumnOpts.value;
|
|
60
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
61
|
+
const cellOpts = computeCellOpts.value;
|
|
62
|
+
const footerCellOpts = computeFooterCellOpts.value;
|
|
63
|
+
const currCellHeight = getCellHeight(footerCellOpts.height || cellOpts.height) || defaultRowHeight;
|
|
57
64
|
return tableColumn.map((column, $columnIndex) => {
|
|
58
65
|
const { type, showFooterOverflow, footerAlign, align, footerClassName, editRender, cellRender } = column;
|
|
66
|
+
const colid = column.id;
|
|
59
67
|
const renderOpts = editRender || cellRender;
|
|
60
68
|
const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
|
|
61
69
|
const showAllTip = tooltipOpts.showAll;
|
|
62
70
|
const isColGroup = column.children && column.children.length;
|
|
63
71
|
const fixedHiddenColumn = fixedType ? column.fixed !== fixedType && !isColGroup : column.fixed && overflowX;
|
|
72
|
+
const isPadding = XEUtils.isBoolean(footerCellOpts.padding) ? footerCellOpts.padding : cellOpts.padding;
|
|
64
73
|
const footOverflow = XEUtils.eqNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow;
|
|
65
74
|
const footAlign = footerAlign || (compConf ? compConf.tableFooterCellAlign : '') || allFooterAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
|
|
66
75
|
let showEllipsis = footOverflow === 'ellipsis';
|
|
67
76
|
const showTitle = footOverflow === 'title';
|
|
68
77
|
const showTooltip = footOverflow === true || footOverflow === 'tooltip';
|
|
69
78
|
let hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
70
|
-
const
|
|
79
|
+
const showResizable = (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable));
|
|
80
|
+
const attrs = { colid };
|
|
71
81
|
const tfOns = {};
|
|
72
82
|
const columnIndex = $xeTable.getColumnIndex(column);
|
|
73
83
|
const _columnIndex = $xeTable.getVTColumnIndex(column);
|
|
@@ -147,9 +157,16 @@ export default defineComponent({
|
|
|
147
157
|
}
|
|
148
158
|
const isLastColumn = $columnIndex === tableColumn.length - 1;
|
|
149
159
|
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
|
|
150
|
-
let
|
|
151
|
-
if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex || _columnIndex > scrollXStore.visibleEndIndex)) {
|
|
152
|
-
|
|
160
|
+
let isVNPreEmptyStatus = false;
|
|
161
|
+
if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
|
|
162
|
+
isVNPreEmptyStatus = true;
|
|
163
|
+
}
|
|
164
|
+
const tcStyle = {};
|
|
165
|
+
if (hasEllipsis) {
|
|
166
|
+
tcStyle.height = `${currCellHeight}px`;
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
tcStyle.minHeight = `${currCellHeight}px`;
|
|
153
170
|
}
|
|
154
171
|
return h('td', Object.assign(Object.assign(Object.assign(Object.assign({ class: ['vxe-footer--column', column.id, {
|
|
155
172
|
[`col--${footAlign}`]: footAlign,
|
|
@@ -157,6 +174,7 @@ export default defineComponent({
|
|
|
157
174
|
'col--last': isLastColumn,
|
|
158
175
|
'fixed--width': !isAutoCellWidth,
|
|
159
176
|
'fixed--hidden': fixedHiddenColumn,
|
|
177
|
+
'is--padding': isPadding,
|
|
160
178
|
'col--ellipsis': hasEllipsis,
|
|
161
179
|
'col--current': currentColumn === column
|
|
162
180
|
}, getPropClass(footerClassName, cellParams), getPropClass(footerCellClassName, cellParams)] }, attrs), { style: footerCellStyle ? (XEUtils.isFunction(footerCellStyle) ? footerCellStyle(cellParams) : footerCellStyle) : null }), tfOns), { key: columnKey || scrollXLoad || scrollYLoad || columnOpts.useKey || columnOpts.drag ? column.id : $columnIndex }), [
|
|
@@ -165,21 +183,41 @@ export default defineComponent({
|
|
|
165
183
|
'c--title': showTitle,
|
|
166
184
|
'c--tooltip': showTooltip,
|
|
167
185
|
'c--ellipsis': showEllipsis
|
|
168
|
-
}]
|
|
169
|
-
|
|
186
|
+
}],
|
|
187
|
+
style: tcStyle
|
|
188
|
+
}, isVNPreEmptyStatus
|
|
189
|
+
? []
|
|
190
|
+
: [
|
|
191
|
+
h('div', {
|
|
192
|
+
colid,
|
|
193
|
+
class: 'vxe-cell--wrapper'
|
|
194
|
+
}, column.renderFooter(cellParams))
|
|
195
|
+
]),
|
|
196
|
+
/**
|
|
197
|
+
* 列宽拖动
|
|
198
|
+
*/
|
|
199
|
+
!fixedHiddenColumn && showResizable && isAllColumnDrag
|
|
200
|
+
? h('div', {
|
|
201
|
+
class: ['vxe-cell--col-resizable', {
|
|
202
|
+
'is--line': !border || border === 'none'
|
|
203
|
+
}],
|
|
204
|
+
onMousedown: (evnt) => $xeTable.handleColResizeMousedownEvent(evnt, fixedType, cellParams),
|
|
205
|
+
onDblclick: (evnt) => $xeTable.handleColResizeDblclickEvent(evnt, cellParams)
|
|
206
|
+
})
|
|
207
|
+
: renderEmptyElement($xeTable)
|
|
170
208
|
]);
|
|
171
209
|
});
|
|
172
210
|
};
|
|
173
211
|
const renderHeads = (renderColumnList) => {
|
|
174
212
|
const { fixedType, footerTableData } = props;
|
|
175
213
|
const { footerRowClassName, footerRowStyle } = tableProps;
|
|
176
|
-
const { isDragColMove } = tableReactData;
|
|
214
|
+
const { isColLoading, isDragColMove } = tableReactData;
|
|
177
215
|
const columnOpts = computeColumnOpts.value;
|
|
178
216
|
const columnDragOpts = computeColumnDragOpts.value;
|
|
179
217
|
return footerTableData.map((row, $rowIndex) => {
|
|
180
218
|
const _rowIndex = $rowIndex;
|
|
181
219
|
const rowParams = { $table: $xeTable, row, _rowIndex, $rowIndex, fixed: fixedType, type: renderType };
|
|
182
|
-
if (columnOpts.drag && columnDragOpts.animation) {
|
|
220
|
+
if (!isColLoading && columnOpts.drag && columnDragOpts.animation) {
|
|
183
221
|
return h(TransitionGroup, {
|
|
184
222
|
key: $rowIndex,
|
|
185
223
|
name: `vxe-header--col-list${isDragColMove ? '' : '-disabled'}`,
|
package/es/table/src/header.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { defineComponent, TransitionGroup, h, ref, inject, nextTick, watch, onMounted, onUnmounted } from 'vue';
|
|
2
2
|
import XEUtils from 'xe-utils';
|
|
3
3
|
import { VxeUI } from '../../ui';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const { getI18n, renderer, renderEmptyElement } = VxeUI;
|
|
4
|
+
import { getCellHeight, convertHeaderColumnToRows } from './util';
|
|
5
|
+
const { renderer, renderEmptyElement } = VxeUI;
|
|
7
6
|
const renderType = 'header';
|
|
8
7
|
export default defineComponent({
|
|
9
8
|
name: 'VxeTableHeader',
|
|
@@ -20,8 +19,7 @@ export default defineComponent({
|
|
|
20
19
|
setup(props) {
|
|
21
20
|
const $xeTable = inject('$xeTable', {});
|
|
22
21
|
const { xID, props: tableProps, reactData: tableReactData, internalData: tableInternalData } = $xeTable;
|
|
23
|
-
const {
|
|
24
|
-
const { computeColumnOpts, computeColumnDragOpts, computeResizableOpts, computeScrollbarXToTop } = $xeTable.getComputeMaps();
|
|
22
|
+
const { computeColumnOpts, computeColumnDragOpts, computeCellOpts, computeMouseOpts, computeHeaderCellOpts, computeDefaultRowHeight } = $xeTable.getComputeMaps();
|
|
25
23
|
const headerColumn = ref([]);
|
|
26
24
|
const refElem = ref();
|
|
27
25
|
const refHeaderScroll = ref();
|
|
@@ -34,141 +32,6 @@ export default defineComponent({
|
|
|
34
32
|
const { isGroup } = tableReactData;
|
|
35
33
|
headerColumn.value = isGroup ? convertHeaderColumnToRows(props.tableGroupColumn) : [];
|
|
36
34
|
};
|
|
37
|
-
const resizeMousedownEvent = (evnt, params) => {
|
|
38
|
-
const { column } = params;
|
|
39
|
-
const { fixedType } = props;
|
|
40
|
-
const { scrollbarHeight } = tableReactData;
|
|
41
|
-
const { elemStore, visibleColumn } = tableInternalData;
|
|
42
|
-
const resizableOpts = computeResizableOpts.value;
|
|
43
|
-
const tableEl = tableRefElem.value;
|
|
44
|
-
const leftContainerElem = refLeftContainer.value;
|
|
45
|
-
const rightContainerElem = refRightContainer.value;
|
|
46
|
-
const resizeBarElem = refCellResizeBar.value;
|
|
47
|
-
const resizeTipElem = refCellResizeTip.value;
|
|
48
|
-
const scrollbarXToTop = computeScrollbarXToTop.value;
|
|
49
|
-
const { clientX: dragClientX } = evnt;
|
|
50
|
-
const wrapperElem = refElem.value;
|
|
51
|
-
const dragBtnElem = evnt.target;
|
|
52
|
-
let resizeColumn = column;
|
|
53
|
-
if (column.children && column.children.length) {
|
|
54
|
-
XEUtils.eachTree(column.children, childColumn => {
|
|
55
|
-
resizeColumn = childColumn;
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
const cell = dragBtnElem.parentNode;
|
|
59
|
-
const cellParams = Object.assign(params, { cell });
|
|
60
|
-
let dragLeft = 0;
|
|
61
|
-
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
62
|
-
if (!bodyScrollElem) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
const pos = getOffsetPos(dragBtnElem, wrapperElem);
|
|
66
|
-
const dragBtnWidth = dragBtnElem.clientWidth;
|
|
67
|
-
const dragBtnOffsetWidth = Math.floor(dragBtnWidth / 2);
|
|
68
|
-
const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
|
|
69
|
-
let dragMinLeft = pos.left - cell.clientWidth + dragBtnWidth + minInterval;
|
|
70
|
-
let dragPosLeft = pos.left + dragBtnOffsetWidth;
|
|
71
|
-
const domMousemove = document.onmousemove;
|
|
72
|
-
const domMouseup = document.onmouseup;
|
|
73
|
-
const isLeftFixed = fixedType === 'left';
|
|
74
|
-
const isRightFixed = fixedType === 'right';
|
|
75
|
-
// 计算左右侧固定列偏移量
|
|
76
|
-
let fixedOffsetWidth = 0;
|
|
77
|
-
if (isLeftFixed || isRightFixed) {
|
|
78
|
-
const siblingProp = isLeftFixed ? 'nextElementSibling' : 'previousElementSibling';
|
|
79
|
-
let tempCellElem = cell[siblingProp];
|
|
80
|
-
while (tempCellElem) {
|
|
81
|
-
if (hasClass(tempCellElem, 'fixed--hidden')) {
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
else if (!hasClass(tempCellElem, 'col--group')) {
|
|
85
|
-
fixedOffsetWidth += tempCellElem.offsetWidth;
|
|
86
|
-
}
|
|
87
|
-
tempCellElem = tempCellElem[siblingProp];
|
|
88
|
-
}
|
|
89
|
-
if (isRightFixed && rightContainerElem) {
|
|
90
|
-
dragPosLeft = rightContainerElem.offsetLeft + fixedOffsetWidth;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
// 处理拖动事件
|
|
94
|
-
const updateEvent = (evnt) => {
|
|
95
|
-
evnt.stopPropagation();
|
|
96
|
-
evnt.preventDefault();
|
|
97
|
-
const tableHeight = tableEl.clientHeight;
|
|
98
|
-
const offsetX = evnt.clientX - dragClientX;
|
|
99
|
-
let left = dragPosLeft + offsetX;
|
|
100
|
-
const scrollLeft = fixedType ? 0 : bodyScrollElem.scrollLeft;
|
|
101
|
-
if (isLeftFixed) {
|
|
102
|
-
// 左固定列(不允许超过右侧固定列、不允许超过右边距)
|
|
103
|
-
left = Math.min(left, (rightContainerElem ? rightContainerElem.offsetLeft : bodyScrollElem.clientWidth) - fixedOffsetWidth - minInterval);
|
|
104
|
-
}
|
|
105
|
-
else if (isRightFixed) {
|
|
106
|
-
// 右侧固定列(不允许超过左侧固定列、不允许超过左边距)
|
|
107
|
-
dragMinLeft = (leftContainerElem ? leftContainerElem.clientWidth : 0) + fixedOffsetWidth + minInterval;
|
|
108
|
-
left = Math.min(left, dragPosLeft + cell.clientWidth - minInterval);
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
dragMinLeft = Math.max(bodyScrollElem.scrollLeft, dragMinLeft);
|
|
112
|
-
// left = Math.min(left, bodyScrollElem.clientWidth + bodyScrollElem.scrollLeft - 40)
|
|
113
|
-
}
|
|
114
|
-
dragLeft = Math.max(left, dragMinLeft);
|
|
115
|
-
const resizeBarLeft = Math.max(1, dragLeft - scrollLeft);
|
|
116
|
-
resizeBarElem.style.left = `${resizeBarLeft}px`;
|
|
117
|
-
resizeBarElem.style.top = `${scrollbarXToTop ? scrollbarHeight : 0}px`;
|
|
118
|
-
resizeBarElem.style.height = `${scrollbarXToTop ? tableHeight - scrollbarHeight : tableHeight}px`;
|
|
119
|
-
if (resizableOpts.showDragTip && resizeTipElem) {
|
|
120
|
-
const tableWidth = tableEl.clientWidth;
|
|
121
|
-
const wrapperRect = wrapperElem.getBoundingClientRect();
|
|
122
|
-
const resizeBarWidth = resizeBarElem.clientWidth;
|
|
123
|
-
const resizeTipWidth = resizeTipElem.clientWidth;
|
|
124
|
-
const resizeTipHeight = resizeTipElem.clientHeight;
|
|
125
|
-
let resizeTipLeft = -resizeTipWidth;
|
|
126
|
-
if (resizeBarLeft < resizeTipWidth + resizeBarWidth) {
|
|
127
|
-
resizeTipLeft = 0;
|
|
128
|
-
}
|
|
129
|
-
else if (resizeBarLeft > tableWidth) {
|
|
130
|
-
resizeTipLeft += tableWidth - resizeBarLeft;
|
|
131
|
-
}
|
|
132
|
-
resizeTipElem.style.left = `${resizeTipLeft}px`;
|
|
133
|
-
resizeTipElem.style.top = `${Math.min(tableHeight - resizeTipHeight, Math.max(0, evnt.clientY - wrapperRect.y - resizeTipHeight / 2))}px`;
|
|
134
|
-
resizeTipElem.textContent = getI18n('vxe.table.resizeColTip', [resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft)]);
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
tableReactData._isResize = true;
|
|
138
|
-
addClass(tableEl, 'drag--resize');
|
|
139
|
-
resizeBarElem.style.display = 'block';
|
|
140
|
-
document.onmousemove = updateEvent;
|
|
141
|
-
document.onmouseup = function (evnt) {
|
|
142
|
-
document.onmousemove = domMousemove;
|
|
143
|
-
document.onmouseup = domMouseup;
|
|
144
|
-
const resizeWidth = resizeColumn.renderWidth + (isRightFixed ? dragPosLeft - dragLeft : dragLeft - dragPosLeft);
|
|
145
|
-
resizeColumn.resizeWidth = resizeWidth;
|
|
146
|
-
if (resizableOpts.dragMode === 'fixed') {
|
|
147
|
-
visibleColumn.forEach(item => {
|
|
148
|
-
if (item.id !== resizeColumn.id) {
|
|
149
|
-
if (!item.resizeWidth) {
|
|
150
|
-
item.resizeWidth = item.renderWidth;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
resizeBarElem.style.display = 'none';
|
|
156
|
-
tableReactData._isResize = false;
|
|
157
|
-
tableInternalData._lastResizeTime = Date.now();
|
|
158
|
-
$xeTable.analyColumnWidth();
|
|
159
|
-
$xeTable.recalculate(true).then(() => {
|
|
160
|
-
$xeTable.saveCustomStore('update:visible');
|
|
161
|
-
$xeTable.updateCellAreas();
|
|
162
|
-
$xeTable.dispatchEvent('resizable-change', Object.assign(Object.assign({}, params), { resizeWidth }), evnt);
|
|
163
|
-
setTimeout(() => $xeTable.recalculate(true), 300);
|
|
164
|
-
});
|
|
165
|
-
removeClass(tableEl, 'drag--resize');
|
|
166
|
-
};
|
|
167
|
-
updateEvent(evnt);
|
|
168
|
-
if ($xeTable.closeMenu) {
|
|
169
|
-
$xeTable.closeMenu();
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
35
|
const renderRows = (isGroup, isOptimizeMode, cols, $rowIndex) => {
|
|
173
36
|
const { fixedType } = props;
|
|
174
37
|
const { resizable: allResizable, border, columnKey, headerCellClassName, headerCellStyle, showHeaderOverflow: allColumnHeaderOverflow, headerAlign: allHeaderAlign, align: allAlign, mouseConfig } = tableProps;
|
|
@@ -176,6 +39,10 @@ export default defineComponent({
|
|
|
176
39
|
const { scrollXStore } = tableInternalData;
|
|
177
40
|
const columnOpts = computeColumnOpts.value;
|
|
178
41
|
const columnDragOpts = computeColumnDragOpts.value;
|
|
42
|
+
const cellOpts = computeCellOpts.value;
|
|
43
|
+
const defaultRowHeight = computeDefaultRowHeight.value;
|
|
44
|
+
const headerCellOpts = computeHeaderCellOpts.value;
|
|
45
|
+
const currCellHeight = getCellHeight(headerCellOpts.height || cellOpts.height) || defaultRowHeight;
|
|
179
46
|
const { disabledMethod: dragDisabledMethod, isCrossDrag, isPeerDrag } = columnDragOpts;
|
|
180
47
|
return cols.map((column, $columnIndex) => {
|
|
181
48
|
const { type, showHeaderOverflow, headerAlign, align, filters, headerClassName, editRender, cellRender } = column;
|
|
@@ -184,6 +51,7 @@ export default defineComponent({
|
|
|
184
51
|
const compConf = renderOpts ? renderer.get(renderOpts.name) : null;
|
|
185
52
|
const isColGroup = column.children && column.children.length;
|
|
186
53
|
const fixedHiddenColumn = fixedType ? (column.fixed !== fixedType && !isColGroup) : !!column.fixed && overflowX;
|
|
54
|
+
const isPadding = XEUtils.isBoolean(headerCellOpts.padding) ? headerCellOpts.padding : cellOpts.padding;
|
|
187
55
|
const headOverflow = XEUtils.eqNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
188
56
|
const headAlign = headerAlign || (compConf ? compConf.tableHeaderCellAlign : '') || allHeaderAlign || align || (compConf ? compConf.tableCellAlign : '') || allAlign;
|
|
189
57
|
let showEllipsis = headOverflow === 'ellipsis';
|
|
@@ -198,15 +66,15 @@ export default defineComponent({
|
|
|
198
66
|
}
|
|
199
67
|
const columnIndex = $xeTable.getColumnIndex(column);
|
|
200
68
|
const _columnIndex = $xeTable.getVTColumnIndex(column);
|
|
201
|
-
const
|
|
69
|
+
const cellParams = { $table: $xeTable, $grid: $xeTable.xegrid, $rowIndex, column, columnIndex, $columnIndex, _columnIndex, firstFilterOption, fixed: fixedType, type: renderType, isHidden: fixedHiddenColumn, hasFilter };
|
|
202
70
|
const thAttrs = {
|
|
203
71
|
colid,
|
|
204
72
|
colspan: column.colSpan > 1 ? column.colSpan : null,
|
|
205
73
|
rowspan: column.rowSpan > 1 ? column.rowSpan : null
|
|
206
74
|
};
|
|
207
75
|
const thOns = {
|
|
208
|
-
onClick: (evnt) => $xeTable.triggerHeaderCellClickEvent(evnt,
|
|
209
|
-
onDblclick: (evnt) => $xeTable.triggerHeaderCellDblclickEvent(evnt,
|
|
76
|
+
onClick: (evnt) => $xeTable.triggerHeaderCellClickEvent(evnt, cellParams),
|
|
77
|
+
onDblclick: (evnt) => $xeTable.triggerHeaderCellDblclickEvent(evnt, cellParams)
|
|
210
78
|
};
|
|
211
79
|
// 横向虚拟滚动不支持动态行高
|
|
212
80
|
if (scrollXLoad && !hasEllipsis) {
|
|
@@ -215,11 +83,11 @@ export default defineComponent({
|
|
|
215
83
|
const isColDragCell = columnOpts.drag && columnDragOpts.trigger === 'cell';
|
|
216
84
|
let isDisabledDrag = false;
|
|
217
85
|
if (isColDragCell) {
|
|
218
|
-
isDisabledDrag = !!(dragDisabledMethod && dragDisabledMethod(
|
|
86
|
+
isDisabledDrag = !!(dragDisabledMethod && dragDisabledMethod(cellParams));
|
|
219
87
|
}
|
|
220
88
|
// 按下事件处理
|
|
221
89
|
if (mouseConfig || isColDragCell) {
|
|
222
|
-
thOns.onMousedown = (evnt) => $xeTable.triggerHeaderCellMousedownEvent(evnt,
|
|
90
|
+
thOns.onMousedown = (evnt) => $xeTable.triggerHeaderCellMousedownEvent(evnt, cellParams);
|
|
223
91
|
}
|
|
224
92
|
// 拖拽列事件
|
|
225
93
|
if (columnOpts.drag) {
|
|
@@ -233,9 +101,16 @@ export default defineComponent({
|
|
|
233
101
|
const isLastColumn = $columnIndex === cols.length - 1;
|
|
234
102
|
const showResizable = (XEUtils.isBoolean(column.resizable) ? column.resizable : (columnOpts.resizable || allResizable));
|
|
235
103
|
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto');
|
|
236
|
-
let
|
|
237
|
-
if (scrollXLoad && !
|
|
238
|
-
|
|
104
|
+
let isVNPreEmptyStatus = false;
|
|
105
|
+
if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
|
|
106
|
+
isVNPreEmptyStatus = true;
|
|
107
|
+
}
|
|
108
|
+
const tcStyle = {};
|
|
109
|
+
if (hasEllipsis) {
|
|
110
|
+
tcStyle.height = `${currCellHeight}px`;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
tcStyle.minHeight = `${currCellHeight}px`;
|
|
239
114
|
}
|
|
240
115
|
return h('th', Object.assign(Object.assign(Object.assign({ class: ['vxe-header--column', colid, {
|
|
241
116
|
[`col--${headAlign}`]: headAlign,
|
|
@@ -246,6 +121,7 @@ export default defineComponent({
|
|
|
246
121
|
'col--ellipsis': hasEllipsis,
|
|
247
122
|
'fixed--width': !isAutoCellWidth,
|
|
248
123
|
'fixed--hidden': fixedHiddenColumn,
|
|
124
|
+
'is--padding': isPadding,
|
|
249
125
|
'is--sortable': column.sortable,
|
|
250
126
|
'col--filter': !!filters,
|
|
251
127
|
'is--filter-active': hasFilter,
|
|
@@ -253,26 +129,34 @@ export default defineComponent({
|
|
|
253
129
|
'is--drag-disabled': isDisabledDrag,
|
|
254
130
|
'col--current': currentColumn === column
|
|
255
131
|
},
|
|
256
|
-
headerClassName ? (XEUtils.isFunction(headerClassName) ? headerClassName(
|
|
257
|
-
headerCellClassName ? (XEUtils.isFunction(headerCellClassName) ? headerCellClassName(
|
|
258
|
-
], style: headerCellStyle ? (XEUtils.isFunction(headerCellStyle) ? headerCellStyle(
|
|
132
|
+
headerClassName ? (XEUtils.isFunction(headerClassName) ? headerClassName(cellParams) : headerClassName) : '',
|
|
133
|
+
headerCellClassName ? (XEUtils.isFunction(headerCellClassName) ? headerCellClassName(cellParams) : headerCellClassName) : ''
|
|
134
|
+
], style: headerCellStyle ? (XEUtils.isFunction(headerCellStyle) ? headerCellStyle(cellParams) : headerCellStyle) : null }, thAttrs), thOns), { key: columnKey || scrollXLoad || scrollYLoad || columnOpts.useKey || columnOpts.drag || isColGroup ? colid : $columnIndex }), [
|
|
259
135
|
h('div', {
|
|
260
136
|
class: ['vxe-cell', {
|
|
261
137
|
'c--title': showTitle,
|
|
262
138
|
'c--tooltip': showTooltip,
|
|
263
139
|
'c--ellipsis': showEllipsis
|
|
264
|
-
}]
|
|
265
|
-
|
|
140
|
+
}],
|
|
141
|
+
style: tcStyle
|
|
142
|
+
}, isVNPreEmptyStatus || (isOptimizeMode && fixedHiddenColumn)
|
|
143
|
+
? []
|
|
144
|
+
: [
|
|
145
|
+
h('div', {
|
|
146
|
+
colid,
|
|
147
|
+
class: 'vxe-cell--wrapper'
|
|
148
|
+
}, column.renderHeader(cellParams))
|
|
149
|
+
]),
|
|
266
150
|
/**
|
|
267
151
|
* 列宽拖动
|
|
268
152
|
*/
|
|
269
153
|
!fixedHiddenColumn && showResizable
|
|
270
154
|
? h('div', {
|
|
271
|
-
class: ['vxe-resizable', {
|
|
155
|
+
class: ['vxe-cell--col-resizable', {
|
|
272
156
|
'is--line': !border || border === 'none'
|
|
273
157
|
}],
|
|
274
|
-
onMousedown: (evnt) =>
|
|
275
|
-
onDblclick: (evnt) => $xeTable.
|
|
158
|
+
onMousedown: (evnt) => $xeTable.handleColResizeMousedownEvent(evnt, fixedType, cellParams),
|
|
159
|
+
onDblclick: (evnt) => $xeTable.handleColResizeDblclickEvent(evnt, cellParams)
|
|
276
160
|
})
|
|
277
161
|
: renderEmptyElement($xeTable)
|
|
278
162
|
]);
|
|
@@ -281,12 +165,12 @@ export default defineComponent({
|
|
|
281
165
|
const renderHeads = (isGroup, isOptimizeMode, headerGroups) => {
|
|
282
166
|
const { fixedType } = props;
|
|
283
167
|
const { headerRowClassName, headerRowStyle } = tableProps;
|
|
284
|
-
const { isDragColMove } = tableReactData;
|
|
168
|
+
const { isColLoading, isDragColMove } = tableReactData;
|
|
285
169
|
const columnOpts = computeColumnOpts.value;
|
|
286
170
|
const columnDragOpts = computeColumnDragOpts.value;
|
|
287
171
|
return headerGroups.map((cols, $rowIndex) => {
|
|
288
172
|
const params = { $table: $xeTable, $rowIndex, fixed: fixedType, type: renderType };
|
|
289
|
-
if (columnOpts.drag && columnDragOpts.animation) {
|
|
173
|
+
if (!isColLoading && columnOpts.drag && columnDragOpts.animation) {
|
|
290
174
|
return h(TransitionGroup, {
|
|
291
175
|
key: $rowIndex,
|
|
292
176
|
name: `vxe-header--col-list${isDragColMove ? '' : '-disabled'}`,
|
|
@@ -312,9 +196,10 @@ export default defineComponent({
|
|
|
312
196
|
};
|
|
313
197
|
const renderVN = () => {
|
|
314
198
|
const { fixedType, fixedColumn, tableColumn } = props;
|
|
315
|
-
const { showHeaderOverflow: allColumnHeaderOverflow, spanMethod, footerSpanMethod } = tableProps;
|
|
199
|
+
const { mouseConfig, showHeaderOverflow: allColumnHeaderOverflow, spanMethod, footerSpanMethod } = tableProps;
|
|
316
200
|
const { isGroup, scrollXLoad, scrollYLoad, dragCol } = tableReactData;
|
|
317
201
|
const { visibleColumn, fullColumnIdData } = tableInternalData;
|
|
202
|
+
const mouseOpts = computeMouseOpts.value;
|
|
318
203
|
let renderHeaderList = headerColumn.value;
|
|
319
204
|
let renderColumnList = tableColumn;
|
|
320
205
|
let isOptimizeMode = false;
|
|
@@ -410,15 +295,32 @@ export default defineComponent({
|
|
|
410
295
|
h('thead', {
|
|
411
296
|
ref: refHeaderTHead
|
|
412
297
|
}, renderHeads(isGroup, isOptimizeMode, renderHeaderList))
|
|
413
|
-
])
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
298
|
+
]),
|
|
299
|
+
mouseConfig && mouseOpts.area
|
|
300
|
+
? h('div', {
|
|
301
|
+
class: 'vxe-table--cell-area'
|
|
302
|
+
}, [
|
|
303
|
+
h('span', {
|
|
304
|
+
class: 'vxe-table--cell-main-area'
|
|
305
|
+
}),
|
|
306
|
+
h('span', {
|
|
307
|
+
class: 'vxe-table--cell-copy-area'
|
|
308
|
+
}),
|
|
309
|
+
h('span', {
|
|
310
|
+
class: 'vxe-table--cell-extend-area'
|
|
311
|
+
}),
|
|
312
|
+
h('span', {
|
|
313
|
+
class: 'vxe-table--cell-multi-area'
|
|
314
|
+
}),
|
|
315
|
+
h('span', {
|
|
316
|
+
class: 'vxe-table--cell-active-area'
|
|
317
|
+
}),
|
|
318
|
+
h('span', {
|
|
319
|
+
class: 'vxe-table--cell-col-status-area'
|
|
320
|
+
})
|
|
321
|
+
])
|
|
322
|
+
: renderEmptyElement($xeTable)
|
|
323
|
+
])
|
|
422
324
|
]);
|
|
423
325
|
};
|
|
424
326
|
watch(() => props.tableColumn, uploadColumn);
|
package/es/table/src/props.js
CHANGED
|
@@ -29,10 +29,10 @@ export default {
|
|
|
29
29
|
type: [Boolean, String],
|
|
30
30
|
default: () => getConfig().table.border
|
|
31
31
|
},
|
|
32
|
-
//
|
|
32
|
+
// 已废弃,被 cell-config.padding 替换
|
|
33
33
|
padding: {
|
|
34
34
|
type: Boolean,
|
|
35
|
-
default:
|
|
35
|
+
default: null
|
|
36
36
|
},
|
|
37
37
|
// 是否圆角边框
|
|
38
38
|
round: {
|
|
@@ -81,12 +81,18 @@ export default {
|
|
|
81
81
|
type: Boolean,
|
|
82
82
|
default: () => getConfig().table.highlightHoverRow
|
|
83
83
|
},
|
|
84
|
-
|
|
84
|
+
/**
|
|
85
|
+
* (即将废弃)是否要高亮当前选中列
|
|
86
|
+
* @deprecated
|
|
87
|
+
*/
|
|
85
88
|
highlightCurrentColumn: {
|
|
86
89
|
type: Boolean,
|
|
87
90
|
default: () => getConfig().table.highlightCurrentColumn
|
|
88
91
|
},
|
|
89
|
-
|
|
92
|
+
/**
|
|
93
|
+
* (即将废弃)鼠标移到列是否要高亮显示
|
|
94
|
+
* @deprecated
|
|
95
|
+
*/
|
|
90
96
|
highlightHoverColumn: {
|
|
91
97
|
type: Boolean,
|
|
92
98
|
default: () => getConfig().table.highlightHoverColumn
|
|
@@ -178,6 +184,10 @@ export default {
|
|
|
178
184
|
columnConfig: Object,
|
|
179
185
|
// 单元格配置信息
|
|
180
186
|
cellConfig: Object,
|
|
187
|
+
// 表头单元格配置信息
|
|
188
|
+
headerCellConfig: Object,
|
|
189
|
+
// 表尾单元格配置信息
|
|
190
|
+
footerCellConfig: Object,
|
|
181
191
|
// 行配置信息
|
|
182
192
|
rowConfig: Object,
|
|
183
193
|
// 已废弃,被 rowDragConfig 替换
|