vxe-table 3.21.4 → 3.21.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/style.css +1 -1
- package/es/table/module/export/mixin.js +3 -3
- package/es/table/src/cell.js +8 -7
- package/es/table/src/columnInfo.js +1 -4
- package/es/table/src/methods.js +152 -22
- package/es/table/src/util.js +47 -2
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +87 -38
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/export/mixin.js +3 -3
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/src/cell.js +8 -8
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/columnInfo.js +1 -5
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/methods.js +17 -14
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/util.js +57 -6
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +1 -1
- 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/package.json +2 -2
- package/packages/table/module/export/mixin.ts +3 -3
- package/packages/table/src/cell.ts +8 -7
- package/packages/table/src/columnInfo.ts +1 -5
- package/packages/table/src/methods.ts +157 -22
- package/packages/table/src/util.ts +63 -4
- /package/es/{iconfont.1779936730544.ttf → iconfont.1780293000244.ttf} +0 -0
- /package/es/{iconfont.1779936730544.woff → iconfont.1780293000244.woff} +0 -0
- /package/es/{iconfont.1779936730544.woff2 → iconfont.1780293000244.woff2} +0 -0
- /package/lib/{iconfont.1779936730544.ttf → iconfont.1780293000244.ttf} +0 -0
- /package/lib/{iconfont.1779936730544.woff → iconfont.1780293000244.woff} +0 -0
- /package/lib/{iconfont.1779936730544.woff2 → iconfont.1780293000244.woff2} +0 -0
|
@@ -365,7 +365,7 @@ function getBooleanValue(cellValue) {
|
|
|
365
365
|
function getHeaderTitle($xeTable, opts, column) {
|
|
366
366
|
const columnOpts = $xeTable.computeColumnOpts;
|
|
367
367
|
const headExportMethod = column.headerExportMethod || columnOpts.headerExportMethod;
|
|
368
|
-
return headExportMethod ? headExportMethod({ column, options: opts, $table: $xeTable }) : ((opts.isTitle ?
|
|
368
|
+
return headExportMethod ? headExportMethod({ column, options: opts, $table: $xeTable }) : ((opts.isTitle ? $xeTable.getHeaderCellLabel(column) : column.field) || '');
|
|
369
369
|
}
|
|
370
370
|
function getFooterCellValue($xeTable, opts, row, column) {
|
|
371
371
|
const columnOpts = $xeTable.computeColumnOpts;
|
|
@@ -883,12 +883,12 @@ function handleImport($xeTable, content, opts) {
|
|
|
883
883
|
const tableTitleMaps = {};
|
|
884
884
|
tableFullColumn.forEach((column) => {
|
|
885
885
|
const field = column.field;
|
|
886
|
-
const title =
|
|
886
|
+
const title = $xeTable.getHeaderCellLabel(column);
|
|
887
887
|
if (field) {
|
|
888
888
|
tableFieldMaps[field] = column;
|
|
889
889
|
}
|
|
890
890
|
if (title) {
|
|
891
|
-
tableTitleMaps[
|
|
891
|
+
tableTitleMaps[title] = column;
|
|
892
892
|
}
|
|
893
893
|
});
|
|
894
894
|
const tableConf = {
|
package/es/table/src/cell.js
CHANGED
|
@@ -358,7 +358,7 @@ export const Cell = {
|
|
|
358
358
|
return getSlotVNs(renderTitleContent(h, params, rtHeader.call($table, h, renderOpts, params)));
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
-
return renderTitleContent(h, params,
|
|
361
|
+
return renderTitleContent(h, params, $table.getHeaderCellLabel(column));
|
|
362
362
|
},
|
|
363
363
|
renderDefaultHeader(h, params) {
|
|
364
364
|
return renderHeaderCellBaseVNs(h, params, Cell.renderHeaderTitle(h, params));
|
|
@@ -370,7 +370,7 @@ export const Cell = {
|
|
|
370
370
|
const tableInternalData = $table;
|
|
371
371
|
const { isRowGroupStatus } = tableReactData;
|
|
372
372
|
const { editConfig } = tableProps;
|
|
373
|
-
const { field, slots, editRender, cellRender, rowGroupNode, aggFunc
|
|
373
|
+
const { field, slots, editRender, cellRender, rowGroupNode, aggFunc } = column;
|
|
374
374
|
const isEnableEdit = editConfig && isEnableConf(editConfig);
|
|
375
375
|
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
376
376
|
const cellRenderOpts = isEnableConf(cellRender) ? cellRender : null;
|
|
@@ -445,8 +445,9 @@ export const Cell = {
|
|
|
445
445
|
return renderCellBaseVNs(h, params, $table.callSlot(defaultSlot, params, h));
|
|
446
446
|
}
|
|
447
447
|
const renderOpts = editRenderOpts || cellRenderOpts;
|
|
448
|
-
//
|
|
449
|
-
|
|
448
|
+
// 如果是编辑表格:renderTableCell > formatter
|
|
449
|
+
// 如果是查看表格:renderTableDefault > formatter
|
|
450
|
+
if (renderOpts) {
|
|
450
451
|
const compConf = renderer.get(renderOpts.name);
|
|
451
452
|
if (compConf) {
|
|
452
453
|
const renderFn = editRenderOpts ? (compConf.renderTableCell || compConf.renderCell) : (compConf.renderTableDefault || compConf.renderDefault);
|
|
@@ -620,7 +621,7 @@ export const Cell = {
|
|
|
620
621
|
renderSeqHeader(h, params) {
|
|
621
622
|
const { $table, column } = params;
|
|
622
623
|
const { slots } = column;
|
|
623
|
-
return renderHeaderCellBaseVNs(h, params, renderTitleContent(h, params, slots && slots.header ? $table.callSlot(slots.header, params, h) :
|
|
624
|
+
return renderHeaderCellBaseVNs(h, params, renderTitleContent(h, params, slots && slots.header ? $table.callSlot(slots.header, params, h) : $table.getHeaderCellLabel(column)));
|
|
624
625
|
},
|
|
625
626
|
renderSeqCell(h, params) {
|
|
626
627
|
const { $table, column } = params;
|
|
@@ -653,7 +654,7 @@ export const Cell = {
|
|
|
653
654
|
: [
|
|
654
655
|
h('span', {
|
|
655
656
|
class: 'vxe-radio--label'
|
|
656
|
-
}, titleSlot ? $table.callSlot(titleSlot, params, h) :
|
|
657
|
+
}, titleSlot ? $table.callSlot(titleSlot, params, h) : $table.getHeaderCellLabel(column))
|
|
657
658
|
]));
|
|
658
659
|
},
|
|
659
660
|
renderRadioCell(h, params) {
|
|
@@ -723,7 +724,7 @@ export const Cell = {
|
|
|
723
724
|
const titleSlot = slots ? slots.title : null;
|
|
724
725
|
const checkboxOpts = $table.computeCheckboxOpts;
|
|
725
726
|
const { checkStrictly, showHeader, headerTitle } = checkboxOpts;
|
|
726
|
-
const colTitle =
|
|
727
|
+
const colTitle = $table.getHeaderCellLabel(column);
|
|
727
728
|
const ons = {};
|
|
728
729
|
if (!isHidden) {
|
|
729
730
|
ons.click = (evnt) => {
|
|
@@ -11,7 +11,7 @@ export class ColumnInfo {
|
|
|
11
11
|
const $xeGrid = $xeTable.$xeGrid;
|
|
12
12
|
const $xeGantt = $xeTable.$xeGantt;
|
|
13
13
|
const $xeGGWrapper = $xeGrid || $xeGantt;
|
|
14
|
-
const { field, editRender, filterRender
|
|
14
|
+
const { field, editRender, filterRender } = _vm;
|
|
15
15
|
const colId = _vm.colId || XEUtils.uniqueId('col_');
|
|
16
16
|
const proxyOpts = $xeGrid ? $xeGrid.computeProxyOpts : null;
|
|
17
17
|
const formatter = _vm.formatter;
|
|
@@ -19,9 +19,6 @@ export class ColumnInfo {
|
|
|
19
19
|
const flCompConf = isEnableConf(filterRender) ? renderer.get(filterRender.name) : null;
|
|
20
20
|
const ctFilterOptions = flCompConf ? flCompConf.createTableFilterOptions : null;
|
|
21
21
|
const filters = toFilters(_vm.filters, colId);
|
|
22
|
-
if (headerFormatter) {
|
|
23
|
-
errLog('vxe.error.notProp', ['header-formatter']);
|
|
24
|
-
}
|
|
25
22
|
const types = ['seq', 'checkbox', 'radio', 'expand', 'html'];
|
|
26
23
|
if (_vm.type && types.indexOf(_vm.type) === -1) {
|
|
27
24
|
warnLog('vxe.error.errProp', [`type=${_vm.type}`, types.join(', ')]);
|
package/es/table/src/methods.js
CHANGED
|
@@ -3,7 +3,7 @@ import { getTpImg, isPx, isScale, hasClass, addClass, removeClass, wheelScrollLe
|
|
|
3
3
|
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
|
|
4
4
|
import { VxeUI } from '../../ui';
|
|
5
5
|
import Cell from './cell';
|
|
6
|
-
import { getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem, getCellRestHeight, getLastChildColumn } from './util';
|
|
6
|
+
import { getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getColReMinWidth, getColReMaxWidth, createHandleUpdateRowId, createHandleGetRowId, getRefElem, getCellRestHeight, getLastChildColumn } from './util';
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn';
|
|
8
8
|
import { moveRowAnimateToTb, clearRowAnimate, moveColAnimateToLr, clearColAnimate } from '../../ui/src/anime';
|
|
9
9
|
import { warnLog, errLog } from '../../ui/src/log';
|
|
@@ -2332,6 +2332,7 @@ function autoCellWidth($xeTable) {
|
|
|
2332
2332
|
if (!xHandleEl) {
|
|
2333
2333
|
return;
|
|
2334
2334
|
}
|
|
2335
|
+
const columnOpts = $xeTable.computeColumnOpts;
|
|
2335
2336
|
let tWidth = 0;
|
|
2336
2337
|
const minCellWidth = 40; // 列宽最少限制 40px
|
|
2337
2338
|
const bodyWidth = bodyWrapperElem.clientWidth;
|
|
@@ -2340,41 +2341,75 @@ function autoCellWidth($xeTable) {
|
|
|
2340
2341
|
const { fit } = props;
|
|
2341
2342
|
const { columnStore } = reactData;
|
|
2342
2343
|
const { resizeList, pxMinList, autoMinList, pxList, scaleList, scaleMinList, autoList, remainList } = columnStore;
|
|
2344
|
+
const parseColumnMaxWidth = (column) => {
|
|
2345
|
+
const maxWidth = column.maxWidth || columnOpts.maxWidth;
|
|
2346
|
+
if (maxWidth && maxWidth !== 'auto') {
|
|
2347
|
+
if (isScale(maxWidth)) {
|
|
2348
|
+
return Math.floor(XEUtils.toInteger(maxWidth) * meanWidth);
|
|
2349
|
+
}
|
|
2350
|
+
return XEUtils.toInteger(maxWidth);
|
|
2351
|
+
}
|
|
2352
|
+
return 0;
|
|
2353
|
+
};
|
|
2343
2354
|
// 最小宽
|
|
2344
2355
|
pxMinList.forEach((column) => {
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2356
|
+
let miWidth = XEUtils.toInteger(column.minWidth);
|
|
2357
|
+
const mxWidth = parseColumnMaxWidth(column);
|
|
2358
|
+
if (mxWidth) {
|
|
2359
|
+
miWidth = Math.min(miWidth, mxWidth);
|
|
2360
|
+
}
|
|
2361
|
+
tWidth += miWidth;
|
|
2362
|
+
column.renderWidth = miWidth;
|
|
2348
2363
|
});
|
|
2349
2364
|
// 最小自适应
|
|
2350
2365
|
autoMinList.forEach((column) => {
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2366
|
+
let caWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth));
|
|
2367
|
+
const mxWidth = parseColumnMaxWidth(column);
|
|
2368
|
+
if (mxWidth) {
|
|
2369
|
+
caWidth = Math.min(caWidth, mxWidth);
|
|
2370
|
+
}
|
|
2371
|
+
tWidth += caWidth;
|
|
2372
|
+
column.renderWidth = caWidth;
|
|
2354
2373
|
});
|
|
2355
2374
|
// 最小百分比
|
|
2356
2375
|
scaleMinList.forEach((column) => {
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2376
|
+
let smWidth = Math.floor(XEUtils.toInteger(column.minWidth) * meanWidth);
|
|
2377
|
+
const mxWidth = parseColumnMaxWidth(column);
|
|
2378
|
+
if (mxWidth) {
|
|
2379
|
+
smWidth = Math.min(smWidth, mxWidth);
|
|
2380
|
+
}
|
|
2381
|
+
tWidth += smWidth;
|
|
2382
|
+
column.renderWidth = smWidth;
|
|
2360
2383
|
});
|
|
2361
2384
|
// 固定百分比
|
|
2362
2385
|
scaleList.forEach((column) => {
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2386
|
+
let sfWidth = Math.floor(XEUtils.toInteger(column.width) * meanWidth);
|
|
2387
|
+
const mxWidth = parseColumnMaxWidth(column);
|
|
2388
|
+
if (mxWidth) {
|
|
2389
|
+
sfWidth = Math.min(sfWidth, mxWidth);
|
|
2390
|
+
}
|
|
2391
|
+
tWidth += sfWidth;
|
|
2392
|
+
column.renderWidth = sfWidth;
|
|
2366
2393
|
});
|
|
2367
2394
|
// 固定宽
|
|
2368
2395
|
pxList.forEach((column) => {
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2396
|
+
let pWidth = XEUtils.toInteger(column.width);
|
|
2397
|
+
const mxWidth = parseColumnMaxWidth(column);
|
|
2398
|
+
if (mxWidth) {
|
|
2399
|
+
pWidth = Math.min(pWidth, mxWidth);
|
|
2400
|
+
}
|
|
2401
|
+
tWidth += pWidth;
|
|
2402
|
+
column.renderWidth = pWidth;
|
|
2372
2403
|
});
|
|
2373
2404
|
// 自适应宽
|
|
2374
2405
|
autoList.forEach((column) => {
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2406
|
+
let aWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth));
|
|
2407
|
+
const mxWidth = parseColumnMaxWidth(column);
|
|
2408
|
+
if (mxWidth) {
|
|
2409
|
+
aWidth = Math.min(aWidth, mxWidth);
|
|
2410
|
+
}
|
|
2411
|
+
tWidth += aWidth;
|
|
2412
|
+
column.renderWidth = aWidth;
|
|
2378
2413
|
});
|
|
2379
2414
|
// 调整了列宽
|
|
2380
2415
|
resizeList.forEach((column) => {
|
|
@@ -2382,11 +2417,12 @@ function autoCellWidth($xeTable) {
|
|
|
2382
2417
|
tWidth += width;
|
|
2383
2418
|
column.renderWidth = width;
|
|
2384
2419
|
});
|
|
2420
|
+
const zoomColumnList = scaleMinList.concat(pxMinList).concat(autoMinList).filter(column => !parseColumnMaxWidth(column));
|
|
2385
2421
|
remainWidth -= tWidth;
|
|
2386
|
-
meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (
|
|
2422
|
+
meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (zoomColumnList.length + remainList.length)) : 0;
|
|
2387
2423
|
if (fit) {
|
|
2388
2424
|
if (remainWidth > 0) {
|
|
2389
|
-
|
|
2425
|
+
zoomColumnList.forEach((column) => {
|
|
2390
2426
|
tWidth += meanWidth;
|
|
2391
2427
|
column.renderWidth += meanWidth;
|
|
2392
2428
|
});
|
|
@@ -2405,8 +2441,9 @@ function autoCellWidth($xeTable) {
|
|
|
2405
2441
|
/**
|
|
2406
2442
|
* 偏移量算法
|
|
2407
2443
|
* 如果所有列足够放的情况下,从最后动态列开始分配
|
|
2444
|
+
* 排除已设置 max-width
|
|
2408
2445
|
*/
|
|
2409
|
-
const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList);
|
|
2446
|
+
const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList).filter(column => !parseColumnMaxWidth(column));
|
|
2410
2447
|
let dynamicSize = dynamicList.length - 1;
|
|
2411
2448
|
if (dynamicSize > 0) {
|
|
2412
2449
|
let i = bodyWidth - tWidth;
|
|
@@ -3786,6 +3823,7 @@ function handleInitColumn($xeTable, collectColumn) {
|
|
|
3786
3823
|
loadScrollXData($xeTable);
|
|
3787
3824
|
}
|
|
3788
3825
|
});
|
|
3826
|
+
$xeTable.clearHeaderFormatterCache();
|
|
3789
3827
|
$xeTable.clearMergeCells();
|
|
3790
3828
|
$xeTable.clearMergeFooterItems();
|
|
3791
3829
|
$xeTable.handleTableData(true);
|
|
@@ -5408,6 +5446,88 @@ const tableMethods = {
|
|
|
5408
5446
|
}
|
|
5409
5447
|
return $xeTable.$nextTick();
|
|
5410
5448
|
},
|
|
5449
|
+
getHeaderCellLabel(fieldOrColumn) {
|
|
5450
|
+
const $xeTable = this;
|
|
5451
|
+
const internalData = $xeTable;
|
|
5452
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
5453
|
+
if (!column) {
|
|
5454
|
+
return null;
|
|
5455
|
+
}
|
|
5456
|
+
const { headerFormatter } = column;
|
|
5457
|
+
const _columnIndex = $xeTable.getVTColumnIndex(column);
|
|
5458
|
+
let cellLabel = column.getTitle();
|
|
5459
|
+
if (headerFormatter) {
|
|
5460
|
+
let formatData;
|
|
5461
|
+
const { headerFullDataColData } = internalData;
|
|
5462
|
+
const colid = column.id;
|
|
5463
|
+
let colRest = headerFullDataColData[colid];
|
|
5464
|
+
if (!colRest) {
|
|
5465
|
+
colRest = headerFullDataColData[colid] = {};
|
|
5466
|
+
}
|
|
5467
|
+
const formatObj = colRest.formatObj;
|
|
5468
|
+
if (formatObj && formatObj.value === cellLabel) {
|
|
5469
|
+
return formatObj.label;
|
|
5470
|
+
}
|
|
5471
|
+
const headFormatParams = {
|
|
5472
|
+
$table: $xeTable,
|
|
5473
|
+
cellTitle: cellLabel,
|
|
5474
|
+
cellValue: cellLabel,
|
|
5475
|
+
column,
|
|
5476
|
+
_columnIndex,
|
|
5477
|
+
columnIndex: $xeTable.getColumnIndex(column)
|
|
5478
|
+
};
|
|
5479
|
+
if (XEUtils.isString(headerFormatter)) {
|
|
5480
|
+
const gFormatOpts = formats.get(headerFormatter);
|
|
5481
|
+
const fcFormatMethod = gFormatOpts ? gFormatOpts.tableHeaderCellFormatMethod : null;
|
|
5482
|
+
cellLabel = XEUtils.toValueString(fcFormatMethod ? fcFormatMethod(headFormatParams) : '');
|
|
5483
|
+
}
|
|
5484
|
+
else if (XEUtils.isArray(headerFormatter)) {
|
|
5485
|
+
const gFormatOpts = formats.get(headerFormatter[0]);
|
|
5486
|
+
const fcFormatMethod = gFormatOpts ? gFormatOpts.tableHeaderCellFormatMethod : null;
|
|
5487
|
+
cellLabel = XEUtils.toValueString(fcFormatMethod ? fcFormatMethod(headFormatParams, ...headerFormatter.slice(1)) : '');
|
|
5488
|
+
}
|
|
5489
|
+
else {
|
|
5490
|
+
cellLabel = XEUtils.toValueString(headerFormatter(headFormatParams));
|
|
5491
|
+
}
|
|
5492
|
+
if (formatData) {
|
|
5493
|
+
colRest.formatObj = { value: cellLabel, label: cellLabel };
|
|
5494
|
+
}
|
|
5495
|
+
}
|
|
5496
|
+
return cellLabel;
|
|
5497
|
+
},
|
|
5498
|
+
updateHeaderCellLabel(fieldOrColumn) {
|
|
5499
|
+
const $xeTable = this;
|
|
5500
|
+
const internalData = $xeTable;
|
|
5501
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
5502
|
+
if (!column) {
|
|
5503
|
+
return '';
|
|
5504
|
+
}
|
|
5505
|
+
const { headerFullDataColData } = internalData;
|
|
5506
|
+
const colid = column.id;
|
|
5507
|
+
const colRest = headerFullDataColData[colid];
|
|
5508
|
+
if (colRest) {
|
|
5509
|
+
colRest.formatObj = undefined;
|
|
5510
|
+
}
|
|
5511
|
+
return $xeTable.getHeaderCellLabel(column);
|
|
5512
|
+
},
|
|
5513
|
+
clearHeaderFormatterCache(isUpdate) {
|
|
5514
|
+
const $xeTable = this;
|
|
5515
|
+
const reactData = $xeTable;
|
|
5516
|
+
const internalData = $xeTable;
|
|
5517
|
+
const { tableColumn } = reactData;
|
|
5518
|
+
const { headerFullDataColData } = internalData;
|
|
5519
|
+
XEUtils.each(headerFullDataColData, (colRest) => {
|
|
5520
|
+
if (colRest.formatObj) {
|
|
5521
|
+
colRest.formatObj = undefined;
|
|
5522
|
+
}
|
|
5523
|
+
});
|
|
5524
|
+
if (isUpdate) {
|
|
5525
|
+
tableColumn.forEach(column => {
|
|
5526
|
+
$xeTable.getHeaderCellLabel(column);
|
|
5527
|
+
});
|
|
5528
|
+
}
|
|
5529
|
+
return $xeTable.$nextTick();
|
|
5530
|
+
},
|
|
5411
5531
|
getFooterCellLabel(row, fieldOrColumn) {
|
|
5412
5532
|
const $xeTable = this;
|
|
5413
5533
|
const reactData = $xeTable;
|
|
@@ -6438,6 +6558,7 @@ const tableMethods = {
|
|
|
6438
6558
|
const dragBtnOffsetWidth = XEUtils.floor(dragBtnWidth / 2);
|
|
6439
6559
|
const dragPosLeft = dragBtnRect.x - tableRect.x + dragBtnOffsetWidth;
|
|
6440
6560
|
const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
|
|
6561
|
+
const maxInterval = getColReMaxWidth(cellParams); // 列之间的最大间距
|
|
6441
6562
|
const dragMinLeft = isRightFixed ? 0 : (cellRect.x - tableRect.x + dragBtnWidth + minInterval);
|
|
6442
6563
|
const dragMaxLeft = cellRect.x - tableRect.x + cell.clientWidth - minInterval;
|
|
6443
6564
|
let fixedLeftRemainWidth = 0;
|
|
@@ -6477,6 +6598,10 @@ const tableMethods = {
|
|
|
6477
6598
|
left = Math.min(left, dragMaxLeft);
|
|
6478
6599
|
}
|
|
6479
6600
|
dragLeft = Math.max(left, dragMinLeft);
|
|
6601
|
+
// 最大宽
|
|
6602
|
+
if (maxInterval > 1) {
|
|
6603
|
+
dragLeft = Math.min(dragLeft, maxInterval + dragMinLeft - minInterval);
|
|
6604
|
+
}
|
|
6480
6605
|
const resizeBarLeft = Math.max(1, dragLeft);
|
|
6481
6606
|
resizeBarElem.style.left = `${resizeBarLeft}px`;
|
|
6482
6607
|
resizeBarElem.style.top = `${scrollbarXToTop ? osbHeight : 0}px`;
|
|
@@ -6560,6 +6685,7 @@ const tableMethods = {
|
|
|
6560
6685
|
const cell = dragBtnElem.parentNode;
|
|
6561
6686
|
const cellParams = Object.assign(params, { cell, $table: $xeTable });
|
|
6562
6687
|
const colMinWidth = getColReMinWidth(cellParams);
|
|
6688
|
+
const colMaxWidth = getColReMaxWidth(cellParams);
|
|
6563
6689
|
el.setAttribute('data-calc-col', 'Y');
|
|
6564
6690
|
let resizeWidth = calcColumnAutoWidth($xeTable, resizeColumn, el);
|
|
6565
6691
|
el.removeAttribute('data-calc-col');
|
|
@@ -6567,6 +6693,9 @@ const tableMethods = {
|
|
|
6567
6693
|
resizeWidth = Math.max(resizeWidth, colRest.width);
|
|
6568
6694
|
}
|
|
6569
6695
|
resizeWidth = Math.max(colMinWidth, resizeWidth);
|
|
6696
|
+
if (colMaxWidth > 1) {
|
|
6697
|
+
resizeWidth = Math.min(colMaxWidth, resizeWidth);
|
|
6698
|
+
}
|
|
6570
6699
|
const resizeParams = Object.assign(Object.assign({}, params), { resizeWidth, resizeColumn });
|
|
6571
6700
|
reactData.isDragResize = false;
|
|
6572
6701
|
internalData._lastResizeTime = Date.now();
|
|
@@ -12458,6 +12587,7 @@ const tableMethods = {
|
|
|
12458
12587
|
footData = visibleColumn.length ? footerMethod({ columns: visibleColumn, data: afterFullData, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }) : [];
|
|
12459
12588
|
}
|
|
12460
12589
|
reactData.footerTableData = footData;
|
|
12590
|
+
$xeTable.clearFooterFormatterCache();
|
|
12461
12591
|
$xeTable.handleUpdateFooterMerge();
|
|
12462
12592
|
$xeTable.dispatchEvent('footer-data-change', {
|
|
12463
12593
|
visibleColumn: internalData.visibleColumn,
|
package/es/table/src/util.js
CHANGED
|
@@ -77,6 +77,7 @@ export function createInternalData() {
|
|
|
77
77
|
// 数据集(仅可视)
|
|
78
78
|
visibleDataRowIdData: {},
|
|
79
79
|
keepUpdateFieldMaps: {},
|
|
80
|
+
headerFullDataColData: {},
|
|
80
81
|
footerFullDataRowData: {},
|
|
81
82
|
// 渲染中缓存数据
|
|
82
83
|
sourceDataRowIdData: {},
|
|
@@ -710,10 +711,52 @@ export function toFilters(filters, colid) {
|
|
|
710
711
|
}
|
|
711
712
|
return filters;
|
|
712
713
|
}
|
|
714
|
+
/**
|
|
715
|
+
* 列宽拖动最大宽度
|
|
716
|
+
*/
|
|
717
|
+
export function getColReMaxWidth(params) {
|
|
718
|
+
const { $table, column, cell } = params;
|
|
719
|
+
const internalData = $table;
|
|
720
|
+
const { elemStore } = internalData;
|
|
721
|
+
const resizableOpts = $table.computeResizableOpts;
|
|
722
|
+
const columnOpts = $table.computeColumnOpts;
|
|
723
|
+
const { maxWidth: reMaxWidth } = resizableOpts;
|
|
724
|
+
const colMaxWidth = column.maxWidth || columnOpts.maxWidth;
|
|
725
|
+
// 如果自定义调整宽度逻辑
|
|
726
|
+
if (reMaxWidth) {
|
|
727
|
+
const customMaxWidth = XEUtils.isFunction(reMaxWidth) ? reMaxWidth(params) : reMaxWidth;
|
|
728
|
+
if (customMaxWidth !== 'auto') {
|
|
729
|
+
return Math.max(1, XEUtils.toNumber(customMaxWidth));
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
const minTitleWidth = XEUtils.floor((XEUtils.toNumber(getComputedStyle(cell).fontSize) || 14) * 1.8);
|
|
733
|
+
const paddingLeftRight = getPaddingLeftRightSize(cell) + getPaddingLeftRightSize(queryElement(cell, '.vxe-cell'));
|
|
734
|
+
const mWidth = minTitleWidth + paddingLeftRight;
|
|
735
|
+
// 如果设置最小宽
|
|
736
|
+
if (colMaxWidth) {
|
|
737
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
738
|
+
if (bodyScrollElem) {
|
|
739
|
+
if (isScale(colMaxWidth)) {
|
|
740
|
+
const bodyWidth = bodyScrollElem.clientWidth - 1;
|
|
741
|
+
const meanWidth = bodyWidth / 100;
|
|
742
|
+
return Math.max(mWidth, Math.floor(XEUtils.toInteger(colMaxWidth) * meanWidth));
|
|
743
|
+
}
|
|
744
|
+
else if (isPx(colMaxWidth)) {
|
|
745
|
+
return Math.max(mWidth, XEUtils.toInteger(colMaxWidth));
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
return -1;
|
|
750
|
+
}
|
|
751
|
+
/**
|
|
752
|
+
* 列宽拖动最小宽度
|
|
753
|
+
*/
|
|
713
754
|
export function getColReMinWidth(params) {
|
|
714
755
|
const { $table, column, cell } = params;
|
|
756
|
+
const tableProps = $table;
|
|
715
757
|
const internalData = $table;
|
|
716
|
-
const
|
|
758
|
+
const resizableOpts = $table.computeResizableOpts;
|
|
759
|
+
const columnOpts = $table.computeColumnOpts;
|
|
717
760
|
const { minWidth } = resizableOpts;
|
|
718
761
|
// 如果自定义调整宽度逻辑
|
|
719
762
|
if (minWidth) {
|
|
@@ -723,7 +766,9 @@ export function getColReMinWidth(params) {
|
|
|
723
766
|
}
|
|
724
767
|
}
|
|
725
768
|
const { elemStore } = internalData;
|
|
726
|
-
const { showHeaderOverflow
|
|
769
|
+
const { showHeaderOverflow: allColumnHeaderOverflow } = tableProps;
|
|
770
|
+
const { showHeaderOverflow } = column;
|
|
771
|
+
const colMinWidth = column.minWidth || columnOpts.minWidth;
|
|
727
772
|
const headOverflow = XEUtils.isUndefined(showHeaderOverflow) || XEUtils.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
728
773
|
const showEllipsis = headOverflow === 'ellipsis';
|
|
729
774
|
const showTitle = headOverflow === 'title';
|
package/es/ui/index.js
CHANGED
package/es/ui/src/log.js
CHANGED