vxe-table 4.19.4 → 4.19.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/dist/all.esm.js +188 -31
- package/dist/style.css +1 -1
- package/es/style.css +1 -1
- package/es/table/module/export/hook.js +3 -3
- package/es/table/src/cell.js +8 -7
- package/es/table/src/columnInfo.js +1 -4
- package/es/table/src/emits.js +1 -0
- package/es/table/src/table.js +135 -12
- package/es/table/src/util.js +28 -8
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +65 -43
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/export/hook.js +3 -3
- package/lib/table/module/export/hook.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/emits.js +1 -1
- package/lib/table/src/emits.min.js +1 -1
- package/lib/table/src/table.js +17 -14
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +31 -7
- 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/hook.ts +3 -3
- package/packages/table/src/cell.ts +8 -7
- package/packages/table/src/columnInfo.ts +1 -5
- package/packages/table/src/emits.ts +1 -0
- package/packages/table/src/table.ts +137 -13
- package/packages/table/src/util.ts +27 -8
- /package/es/{iconfont.1779936744129.ttf → iconfont.1780293024194.ttf} +0 -0
- /package/es/{iconfont.1779936744129.woff → iconfont.1780293024194.woff} +0 -0
- /package/es/{iconfont.1779936744129.woff2 → iconfont.1780293024194.woff2} +0 -0
- /package/lib/{iconfont.1779936744129.ttf → iconfont.1780293024194.ttf} +0 -0
- /package/lib/{iconfont.1779936744129.woff → iconfont.1780293024194.woff} +0 -0
- /package/lib/{iconfont.1779936744129.woff2 → iconfont.1780293024194.woff2} +0 -0
package/dist/all.esm.js
CHANGED
|
@@ -44,7 +44,7 @@ function eqEmptyValue(cellValue) {
|
|
|
44
44
|
return cellValue === '' || XEUtils.eqNull(cellValue);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
const version$1 = "4.19.
|
|
47
|
+
const version$1 = "4.19.6";
|
|
48
48
|
VxeUI.version = version$1;
|
|
49
49
|
VxeUI.tableVersion = version$1;
|
|
50
50
|
VxeUI.setConfig({
|
|
@@ -556,7 +556,7 @@ const modal = {
|
|
|
556
556
|
const defineVxeComponent = defineComponent;
|
|
557
557
|
|
|
558
558
|
const { log } = VxeUI;
|
|
559
|
-
const version = `table v${"4.19.
|
|
559
|
+
const version = `table v${"4.19.6"}`;
|
|
560
560
|
const warnLog = log.create('warn', version);
|
|
561
561
|
const errLog = log.create('error', version);
|
|
562
562
|
|
|
@@ -568,16 +568,13 @@ class ColumnInfo {
|
|
|
568
568
|
const $xeGrid = $xeTable.xeGrid;
|
|
569
569
|
const $xeGantt = $xeTable.xeGantt;
|
|
570
570
|
const $xeGGWrapper = $xeGrid || $xeGantt;
|
|
571
|
-
const { field, editRender, filterRender
|
|
571
|
+
const { field, editRender, filterRender } = _vm;
|
|
572
572
|
const colId = _vm.colId || XEUtils.uniqueId('col_');
|
|
573
573
|
const formatter = _vm.formatter;
|
|
574
574
|
const visible = XEUtils.isBoolean(_vm.visible) ? _vm.visible : true;
|
|
575
575
|
const flCompConf = isEnableConf(filterRender) ? renderer$b.get(filterRender.name) : null;
|
|
576
576
|
const ctFilterOptions = flCompConf ? flCompConf.createTableFilterOptions : null;
|
|
577
577
|
const filters = toFilters(_vm.filters, colId);
|
|
578
|
-
if (headerFormatter) {
|
|
579
|
-
errLog('vxe.error.notProp', ['header-formatter']);
|
|
580
|
-
}
|
|
581
578
|
const types = ['seq', 'checkbox', 'radio', 'expand', 'html'];
|
|
582
579
|
if (_vm.type && types.indexOf(_vm.type) === -1) {
|
|
583
580
|
warnLog('vxe.error.errProp', [`type=${_vm.type}`, types.join(', ')]);
|
|
@@ -1016,6 +1013,7 @@ function createInternalData$3() {
|
|
|
1016
1013
|
// 数据集(仅可视)
|
|
1017
1014
|
visibleDataRowIdData: {},
|
|
1018
1015
|
keepUpdateFieldMaps: {},
|
|
1016
|
+
headerFullDataColData: {},
|
|
1019
1017
|
footerFullDataRowData: {},
|
|
1020
1018
|
// 渲染中缓存数据
|
|
1021
1019
|
sourceDataRowIdData: {},
|
|
@@ -1619,17 +1617,54 @@ function getCalcHeight(height) {
|
|
|
1619
1617
|
}
|
|
1620
1618
|
return height || 0;
|
|
1621
1619
|
}
|
|
1620
|
+
/**
|
|
1621
|
+
* 列宽拖动最大宽度
|
|
1622
|
+
*/
|
|
1623
|
+
function getColReMaxWidth(params) {
|
|
1624
|
+
const { $table, column, cell } = params;
|
|
1625
|
+
const internalData = $table.internalData;
|
|
1626
|
+
const { elemStore } = internalData;
|
|
1627
|
+
const { computeColumnOpts, computeResizableOpts } = $table.getComputeMaps();
|
|
1628
|
+
const resizableOpts = computeResizableOpts.value;
|
|
1629
|
+
const columnOpts = computeColumnOpts.value;
|
|
1630
|
+
const { maxWidth: reMaxWidth } = resizableOpts;
|
|
1631
|
+
const colMaxWidth = column.maxWidth || columnOpts.maxWidth;
|
|
1632
|
+
// 如果自定义调整宽度逻辑
|
|
1633
|
+
if (reMaxWidth) {
|
|
1634
|
+
const customMaxWidth = XEUtils.isFunction(reMaxWidth) ? reMaxWidth(params) : reMaxWidth;
|
|
1635
|
+
if (customMaxWidth !== 'auto') {
|
|
1636
|
+
return Math.max(1, XEUtils.toNumber(customMaxWidth));
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
const minTitleWidth = XEUtils.floor((XEUtils.toNumber(getComputedStyle(cell).fontSize) || 14) * 1.8);
|
|
1640
|
+
const paddingLeftRight = getPaddingLeftRightSize(cell) + getPaddingLeftRightSize(queryElement(cell, '.vxe-cell'));
|
|
1641
|
+
const mWidth = minTitleWidth + paddingLeftRight;
|
|
1642
|
+
// 如果设置最小宽
|
|
1643
|
+
if (colMaxWidth) {
|
|
1644
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
1645
|
+
if (bodyScrollElem) {
|
|
1646
|
+
if (isScale(colMaxWidth)) {
|
|
1647
|
+
const bodyWidth = bodyScrollElem.clientWidth - 1;
|
|
1648
|
+
const meanWidth = bodyWidth / 100;
|
|
1649
|
+
return Math.max(mWidth, Math.floor(XEUtils.toInteger(colMaxWidth) * meanWidth));
|
|
1650
|
+
}
|
|
1651
|
+
else if (isPx(colMaxWidth)) {
|
|
1652
|
+
return Math.max(mWidth, XEUtils.toInteger(colMaxWidth));
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
return -1;
|
|
1657
|
+
}
|
|
1622
1658
|
/**
|
|
1623
1659
|
* 列宽拖动最小宽度
|
|
1624
|
-
* @param params
|
|
1625
|
-
* @returns
|
|
1626
1660
|
*/
|
|
1627
1661
|
function getColReMinWidth(params) {
|
|
1628
1662
|
const { $table, column, cell } = params;
|
|
1629
1663
|
const tableProps = $table.props;
|
|
1630
1664
|
const internalData = $table.internalData;
|
|
1631
|
-
const { computeResizableOpts } = $table.getComputeMaps();
|
|
1665
|
+
const { computeColumnOpts, computeResizableOpts } = $table.getComputeMaps();
|
|
1632
1666
|
const resizableOpts = computeResizableOpts.value;
|
|
1667
|
+
const columnOpts = computeColumnOpts.value;
|
|
1633
1668
|
const { minWidth: reMinWidth } = resizableOpts;
|
|
1634
1669
|
// 如果自定义调整宽度逻辑
|
|
1635
1670
|
if (reMinWidth) {
|
|
@@ -1640,7 +1675,8 @@ function getColReMinWidth(params) {
|
|
|
1640
1675
|
}
|
|
1641
1676
|
const { elemStore } = internalData;
|
|
1642
1677
|
const { showHeaderOverflow: allColumnHeaderOverflow } = tableProps;
|
|
1643
|
-
const { showHeaderOverflow
|
|
1678
|
+
const { showHeaderOverflow } = column;
|
|
1679
|
+
const colMinWidth = column.minWidth || columnOpts.minWidth;
|
|
1644
1680
|
const headOverflow = XEUtils.isUndefined(showHeaderOverflow) || XEUtils.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
1645
1681
|
const showEllipsis = headOverflow === 'ellipsis';
|
|
1646
1682
|
const showTitle = headOverflow === 'title';
|
|
@@ -2300,7 +2336,7 @@ const Cell = {
|
|
|
2300
2336
|
}
|
|
2301
2337
|
}
|
|
2302
2338
|
}
|
|
2303
|
-
return renderTitleContent(params,
|
|
2339
|
+
return renderTitleContent(params, $table.getHeaderCellLabel(column));
|
|
2304
2340
|
},
|
|
2305
2341
|
renderDefaultHeader(params) {
|
|
2306
2342
|
return renderHeaderCellBaseVNs(params, Cell.renderHeaderTitle(params));
|
|
@@ -2312,7 +2348,7 @@ const Cell = {
|
|
|
2312
2348
|
const tableInternalData = $table.internalData;
|
|
2313
2349
|
const { isRowGroupStatus } = tableReactData;
|
|
2314
2350
|
const { editConfig } = tableProps;
|
|
2315
|
-
const { field, slots, editRender, cellRender, rowGroupNode, aggFunc
|
|
2351
|
+
const { field, slots, editRender, cellRender, rowGroupNode, aggFunc } = column;
|
|
2316
2352
|
const isEnableEdit = editConfig && isEnableConf(editConfig);
|
|
2317
2353
|
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
2318
2354
|
const cellRenderOpts = isEnableConf(cellRender) ? cellRender : null;
|
|
@@ -2388,8 +2424,9 @@ const Cell = {
|
|
|
2388
2424
|
return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params));
|
|
2389
2425
|
}
|
|
2390
2426
|
const renderOpts = editRenderOpts || cellRenderOpts;
|
|
2391
|
-
//
|
|
2392
|
-
|
|
2427
|
+
// 如果是编辑表格:renderTableCell > formatter
|
|
2428
|
+
// 如果是查看表格:renderTableDefault > formatter
|
|
2429
|
+
if (renderOpts) {
|
|
2393
2430
|
const compConf = renderer$a.get(renderOpts.name);
|
|
2394
2431
|
if (compConf) {
|
|
2395
2432
|
const renderFn = editRenderOpts ? (compConf.renderTableCell || compConf.renderCell) : (compConf.renderTableDefault || compConf.renderDefault);
|
|
@@ -2560,7 +2597,7 @@ const Cell = {
|
|
|
2560
2597
|
const { $table, column } = params;
|
|
2561
2598
|
const { slots } = column;
|
|
2562
2599
|
const headerSlot = slots ? slots.header : null;
|
|
2563
|
-
return renderHeaderCellBaseVNs(params, renderTitleContent(params, headerSlot ? $table.callSlot(headerSlot, params) :
|
|
2600
|
+
return renderHeaderCellBaseVNs(params, renderTitleContent(params, headerSlot ? $table.callSlot(headerSlot, params) : $table.getHeaderCellLabel(column)));
|
|
2564
2601
|
},
|
|
2565
2602
|
renderSeqCell(params) {
|
|
2566
2603
|
const { $table, column } = params;
|
|
@@ -2595,7 +2632,7 @@ const Cell = {
|
|
|
2595
2632
|
: [
|
|
2596
2633
|
h('span', {
|
|
2597
2634
|
class: 'vxe-radio--label'
|
|
2598
|
-
}, titleSlot ? $table.callSlot(titleSlot, params) :
|
|
2635
|
+
}, titleSlot ? $table.callSlot(titleSlot, params) : $table.getHeaderCellLabel(column))
|
|
2599
2636
|
]));
|
|
2600
2637
|
},
|
|
2601
2638
|
renderRadioCell(params) {
|
|
@@ -2664,7 +2701,7 @@ const Cell = {
|
|
|
2664
2701
|
const titleSlot = slots ? slots.title : null;
|
|
2665
2702
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
2666
2703
|
const { checkStrictly, showHeader, headerTitle } = checkboxOpts;
|
|
2667
|
-
const colTitle =
|
|
2704
|
+
const colTitle = $table.getHeaderCellLabel(column);
|
|
2668
2705
|
const ons = {};
|
|
2669
2706
|
if (!isHidden) {
|
|
2670
2707
|
ons.onClick = (evnt) => {
|
|
@@ -3836,6 +3873,7 @@ const tableEmits = [
|
|
|
3836
3873
|
'cell-area-selection-all-end',
|
|
3837
3874
|
'cell-area-arrows-start',
|
|
3838
3875
|
'cell-area-arrows-end',
|
|
3876
|
+
'cell-area-fill-copy',
|
|
3839
3877
|
'active-cell-change-start',
|
|
3840
3878
|
'active-cell-change-end'
|
|
3841
3879
|
];
|
|
@@ -10415,7 +10453,7 @@ hooks$4.add('tableExportModule', {
|
|
|
10415
10453
|
function getHeaderTitle(opts, column) {
|
|
10416
10454
|
const columnOpts = computeColumnOpts.value;
|
|
10417
10455
|
const headExportMethod = column.headerExportMethod || columnOpts.headerExportMethod;
|
|
10418
|
-
return headExportMethod ? headExportMethod({ column, options: opts, $table: $xeTable }) : ((opts.isTitle ?
|
|
10456
|
+
return headExportMethod ? headExportMethod({ column, options: opts, $table: $xeTable }) : ((opts.isTitle ? $xeTable.getHeaderCellLabel(column) : column.field) || '');
|
|
10419
10457
|
}
|
|
10420
10458
|
const toBooleanValue = (cellValue) => {
|
|
10421
10459
|
return XEUtils.isBoolean(cellValue) ? (cellValue ? 'TRUE' : 'FALSE') : cellValue;
|
|
@@ -11069,12 +11107,12 @@ hooks$4.add('tableExportModule', {
|
|
|
11069
11107
|
const tableTitleMaps = {};
|
|
11070
11108
|
tableFullColumn.forEach((column) => {
|
|
11071
11109
|
const field = column.field;
|
|
11072
|
-
const title =
|
|
11110
|
+
const title = $xeTable.getHeaderCellLabel(column);
|
|
11073
11111
|
if (field) {
|
|
11074
11112
|
tableFieldMaps[field] = column;
|
|
11075
11113
|
}
|
|
11076
11114
|
if (title) {
|
|
11077
|
-
tableTitleMaps[
|
|
11115
|
+
tableTitleMaps[title] = column;
|
|
11078
11116
|
}
|
|
11079
11117
|
});
|
|
11080
11118
|
const tableConf = {
|
|
@@ -16451,6 +16489,7 @@ var VxeTableComponent = defineVxeComponent({
|
|
|
16451
16489
|
if (!xHandleEl) {
|
|
16452
16490
|
return;
|
|
16453
16491
|
}
|
|
16492
|
+
const columnOpts = computeColumnOpts.value;
|
|
16454
16493
|
let tWidth = 0;
|
|
16455
16494
|
const minCellWidth = 40; // 列宽最少限制 40px
|
|
16456
16495
|
const bodyWidth = bodyWrapperElem.clientWidth;
|
|
@@ -16459,39 +16498,73 @@ var VxeTableComponent = defineVxeComponent({
|
|
|
16459
16498
|
const { fit } = props;
|
|
16460
16499
|
const { columnStore } = reactData;
|
|
16461
16500
|
const { resizeList, pxMinList, autoMinList, pxList, scaleList, scaleMinList, autoList, remainList } = columnStore;
|
|
16501
|
+
const parseColumnMaxWidth = (column) => {
|
|
16502
|
+
const maxWidth = column.maxWidth || columnOpts.maxWidth;
|
|
16503
|
+
if (maxWidth && maxWidth !== 'auto') {
|
|
16504
|
+
if (isScale(maxWidth)) {
|
|
16505
|
+
return Math.floor(XEUtils.toInteger(maxWidth) * meanWidth);
|
|
16506
|
+
}
|
|
16507
|
+
return XEUtils.toInteger(maxWidth);
|
|
16508
|
+
}
|
|
16509
|
+
return 0;
|
|
16510
|
+
};
|
|
16462
16511
|
// 最小宽
|
|
16463
16512
|
pxMinList.forEach((column) => {
|
|
16464
|
-
|
|
16465
|
-
|
|
16466
|
-
|
|
16513
|
+
let miWidth = XEUtils.toInteger(column.minWidth);
|
|
16514
|
+
const mxWidth = parseColumnMaxWidth(column);
|
|
16515
|
+
if (mxWidth) {
|
|
16516
|
+
miWidth = Math.min(miWidth, mxWidth);
|
|
16517
|
+
}
|
|
16518
|
+
tWidth += miWidth;
|
|
16519
|
+
column.renderWidth = miWidth;
|
|
16467
16520
|
});
|
|
16468
16521
|
// 最小自适应
|
|
16469
16522
|
autoMinList.forEach((column) => {
|
|
16470
|
-
|
|
16523
|
+
let caWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth));
|
|
16524
|
+
const mxWidth = parseColumnMaxWidth(column);
|
|
16525
|
+
if (mxWidth) {
|
|
16526
|
+
caWidth = Math.min(caWidth, mxWidth);
|
|
16527
|
+
}
|
|
16471
16528
|
tWidth += caWidth;
|
|
16472
16529
|
column.renderWidth = caWidth;
|
|
16473
16530
|
});
|
|
16474
16531
|
// 最小百分比
|
|
16475
16532
|
scaleMinList.forEach((column) => {
|
|
16476
|
-
|
|
16533
|
+
let smWidth = Math.floor(XEUtils.toInteger(column.minWidth) * meanWidth);
|
|
16534
|
+
const mxWidth = parseColumnMaxWidth(column);
|
|
16535
|
+
if (mxWidth) {
|
|
16536
|
+
smWidth = Math.min(smWidth, mxWidth);
|
|
16537
|
+
}
|
|
16477
16538
|
tWidth += smWidth;
|
|
16478
16539
|
column.renderWidth = smWidth;
|
|
16479
16540
|
});
|
|
16480
16541
|
// 固定百分比
|
|
16481
16542
|
scaleList.forEach((column) => {
|
|
16482
|
-
|
|
16543
|
+
let sfWidth = Math.floor(XEUtils.toInteger(column.width) * meanWidth);
|
|
16544
|
+
const mxWidth = parseColumnMaxWidth(column);
|
|
16545
|
+
if (mxWidth) {
|
|
16546
|
+
sfWidth = Math.min(sfWidth, mxWidth);
|
|
16547
|
+
}
|
|
16483
16548
|
tWidth += sfWidth;
|
|
16484
16549
|
column.renderWidth = sfWidth;
|
|
16485
16550
|
});
|
|
16486
16551
|
// 固定宽
|
|
16487
16552
|
pxList.forEach((column) => {
|
|
16488
|
-
|
|
16553
|
+
let pWidth = XEUtils.toInteger(column.width);
|
|
16554
|
+
const mxWidth = parseColumnMaxWidth(column);
|
|
16555
|
+
if (mxWidth) {
|
|
16556
|
+
pWidth = Math.min(pWidth, mxWidth);
|
|
16557
|
+
}
|
|
16489
16558
|
tWidth += pWidth;
|
|
16490
16559
|
column.renderWidth = pWidth;
|
|
16491
16560
|
});
|
|
16492
16561
|
// 自适应宽
|
|
16493
16562
|
autoList.forEach((column) => {
|
|
16494
|
-
|
|
16563
|
+
let aWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth));
|
|
16564
|
+
const mxWidth = parseColumnMaxWidth(column);
|
|
16565
|
+
if (mxWidth) {
|
|
16566
|
+
aWidth = Math.min(aWidth, mxWidth);
|
|
16567
|
+
}
|
|
16495
16568
|
tWidth += aWidth;
|
|
16496
16569
|
column.renderWidth = aWidth;
|
|
16497
16570
|
});
|
|
@@ -16501,11 +16574,12 @@ var VxeTableComponent = defineVxeComponent({
|
|
|
16501
16574
|
tWidth += reWidth;
|
|
16502
16575
|
column.renderWidth = reWidth;
|
|
16503
16576
|
});
|
|
16577
|
+
const zoomColumnList = scaleMinList.concat(pxMinList).concat(autoMinList).filter(column => !parseColumnMaxWidth(column));
|
|
16504
16578
|
remainWidth -= tWidth;
|
|
16505
|
-
meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (
|
|
16579
|
+
meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (zoomColumnList.length + remainList.length)) : 0;
|
|
16506
16580
|
if (fit) {
|
|
16507
16581
|
if (remainWidth > 0) {
|
|
16508
|
-
|
|
16582
|
+
zoomColumnList.forEach((column) => {
|
|
16509
16583
|
tWidth += meanWidth;
|
|
16510
16584
|
column.renderWidth += meanWidth;
|
|
16511
16585
|
});
|
|
@@ -16524,8 +16598,9 @@ var VxeTableComponent = defineVxeComponent({
|
|
|
16524
16598
|
/**
|
|
16525
16599
|
* 偏移量算法
|
|
16526
16600
|
* 如果所有列足够放的情况下,从最后动态列开始分配
|
|
16601
|
+
* 排除已设置 max-width
|
|
16527
16602
|
*/
|
|
16528
|
-
const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList);
|
|
16603
|
+
const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList).filter(column => !parseColumnMaxWidth(column));
|
|
16529
16604
|
let dynamicSize = dynamicList.length - 1;
|
|
16530
16605
|
if (dynamicSize > 0) {
|
|
16531
16606
|
let i = bodyWidth - tWidth;
|
|
@@ -18671,6 +18746,7 @@ var VxeTableComponent = defineVxeComponent({
|
|
|
18671
18746
|
loadScrollXData();
|
|
18672
18747
|
}
|
|
18673
18748
|
});
|
|
18749
|
+
$xeTable.clearHeaderFormatterCache();
|
|
18674
18750
|
$xeTable.clearMergeCells();
|
|
18675
18751
|
$xeTable.clearMergeFooterItems();
|
|
18676
18752
|
$xeTable.handleTableData(true);
|
|
@@ -19912,6 +19988,77 @@ var VxeTableComponent = defineVxeComponent({
|
|
|
19912
19988
|
}
|
|
19913
19989
|
return nextTick();
|
|
19914
19990
|
},
|
|
19991
|
+
getHeaderCellLabel(fieldOrColumn) {
|
|
19992
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
19993
|
+
if (!column) {
|
|
19994
|
+
return null;
|
|
19995
|
+
}
|
|
19996
|
+
const { headerFormatter } = column;
|
|
19997
|
+
const _columnIndex = $xeTable.getVTColumnIndex(column);
|
|
19998
|
+
let cellLabel = column.getTitle();
|
|
19999
|
+
if (headerFormatter) {
|
|
20000
|
+
const { headerFullDataColData } = internalData;
|
|
20001
|
+
const colid = column.id;
|
|
20002
|
+
let colRest = headerFullDataColData[colid];
|
|
20003
|
+
if (!colRest) {
|
|
20004
|
+
colRest = headerFullDataColData[colid] = {};
|
|
20005
|
+
}
|
|
20006
|
+
const formatObj = colRest.formatObj;
|
|
20007
|
+
if (formatObj && formatObj.value === cellLabel) {
|
|
20008
|
+
return formatObj.label;
|
|
20009
|
+
}
|
|
20010
|
+
const headFormatParams = {
|
|
20011
|
+
$table: $xeTable,
|
|
20012
|
+
cellTitle: cellLabel,
|
|
20013
|
+
cellValue: cellLabel,
|
|
20014
|
+
column,
|
|
20015
|
+
_columnIndex,
|
|
20016
|
+
columnIndex: $xeTable.getColumnIndex(column)
|
|
20017
|
+
};
|
|
20018
|
+
if (XEUtils.isString(headerFormatter)) {
|
|
20019
|
+
const gFormatOpts = formats.get(headerFormatter);
|
|
20020
|
+
const fcFormatMethod = gFormatOpts ? gFormatOpts.tableHeaderCellFormatMethod : null;
|
|
20021
|
+
cellLabel = XEUtils.toValueString(fcFormatMethod ? fcFormatMethod(headFormatParams) : '');
|
|
20022
|
+
}
|
|
20023
|
+
else if (XEUtils.isArray(headerFormatter)) {
|
|
20024
|
+
const gFormatOpts = formats.get(headerFormatter[0]);
|
|
20025
|
+
const fcFormatMethod = gFormatOpts ? gFormatOpts.tableHeaderCellFormatMethod : null;
|
|
20026
|
+
cellLabel = XEUtils.toValueString(fcFormatMethod ? fcFormatMethod(headFormatParams, ...headerFormatter.slice(1)) : '');
|
|
20027
|
+
}
|
|
20028
|
+
else {
|
|
20029
|
+
cellLabel = XEUtils.toValueString(headerFormatter(headFormatParams));
|
|
20030
|
+
}
|
|
20031
|
+
}
|
|
20032
|
+
return cellLabel;
|
|
20033
|
+
},
|
|
20034
|
+
updateHeaderCellLabel(fieldOrColumn) {
|
|
20035
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
20036
|
+
if (!column) {
|
|
20037
|
+
return '';
|
|
20038
|
+
}
|
|
20039
|
+
const { headerFullDataColData } = internalData;
|
|
20040
|
+
const colid = column.id;
|
|
20041
|
+
const colRest = headerFullDataColData[colid];
|
|
20042
|
+
if (colRest) {
|
|
20043
|
+
colRest.formatObj = undefined;
|
|
20044
|
+
}
|
|
20045
|
+
return $xeTable.getHeaderCellLabel(column);
|
|
20046
|
+
},
|
|
20047
|
+
clearHeaderFormatterCache(isUpdate) {
|
|
20048
|
+
const { tableColumn } = reactData;
|
|
20049
|
+
const { headerFullDataColData } = internalData;
|
|
20050
|
+
XEUtils.each(headerFullDataColData, (colRest) => {
|
|
20051
|
+
if (colRest.formatObj) {
|
|
20052
|
+
colRest.formatObj = undefined;
|
|
20053
|
+
}
|
|
20054
|
+
});
|
|
20055
|
+
if (isUpdate) {
|
|
20056
|
+
tableColumn.forEach(column => {
|
|
20057
|
+
$xeTable.getHeaderCellLabel(column);
|
|
20058
|
+
});
|
|
20059
|
+
}
|
|
20060
|
+
return nextTick();
|
|
20061
|
+
},
|
|
19915
20062
|
getFooterCellLabel(row, fieldOrColumn) {
|
|
19916
20063
|
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
19917
20064
|
if (!column) {
|
|
@@ -22123,6 +22270,7 @@ var VxeTableComponent = defineVxeComponent({
|
|
|
22123
22270
|
footData = visibleColumn.length ? footerMethod({ columns: visibleColumn, data: afterFullData, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }) : [];
|
|
22124
22271
|
}
|
|
22125
22272
|
reactData.footerTableData = footData;
|
|
22273
|
+
$xeTable.clearFooterFormatterCache();
|
|
22126
22274
|
$xeTable.handleUpdateFooterMerge();
|
|
22127
22275
|
$xeTable.dispatchEvent('footer-data-change', {
|
|
22128
22276
|
visibleColumn: internalData.visibleColumn,
|
|
@@ -23932,6 +24080,7 @@ var VxeTableComponent = defineVxeComponent({
|
|
|
23932
24080
|
const dragBtnOffsetWidth = XEUtils.floor(dragBtnWidth / 2);
|
|
23933
24081
|
const dragPosLeft = dragBtnRect.x - tableRect.x + dragBtnOffsetWidth;
|
|
23934
24082
|
const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
|
|
24083
|
+
const maxInterval = getColReMaxWidth(cellParams); // 列之间的最大间距
|
|
23935
24084
|
const dragMinLeft = isRightFixed ? 0 : (cellRect.x - tableRect.x + dragBtnWidth + minInterval);
|
|
23936
24085
|
const dragMaxLeft = cellRect.x - tableRect.x + cell.clientWidth - minInterval;
|
|
23937
24086
|
let fixedLeftRemainWidth = 0;
|
|
@@ -23971,6 +24120,10 @@ var VxeTableComponent = defineVxeComponent({
|
|
|
23971
24120
|
left = Math.min(left, dragMaxLeft);
|
|
23972
24121
|
}
|
|
23973
24122
|
dragLeft = Math.max(left, dragMinLeft);
|
|
24123
|
+
// 最大宽
|
|
24124
|
+
if (maxInterval > 1) {
|
|
24125
|
+
dragLeft = Math.min(dragLeft, maxInterval + dragMinLeft - minInterval);
|
|
24126
|
+
}
|
|
23974
24127
|
const resizeBarLeft = Math.max(1, dragLeft);
|
|
23975
24128
|
resizeBarElem.style.left = `${resizeBarLeft}px`;
|
|
23976
24129
|
resizeBarElem.style.top = `${scrollbarXToTop ? osbHeight : 0}px`;
|
|
@@ -24051,6 +24204,7 @@ var VxeTableComponent = defineVxeComponent({
|
|
|
24051
24204
|
const cell = dragBtnElem.parentNode;
|
|
24052
24205
|
const cellParams = Object.assign(params, { cell, $table: $xeTable });
|
|
24053
24206
|
const colMinWidth = getColReMinWidth(cellParams);
|
|
24207
|
+
const colMaxWidth = getColReMaxWidth(cellParams);
|
|
24054
24208
|
el.setAttribute('data-calc-col', 'Y');
|
|
24055
24209
|
let resizeWidth = calcColumnAutoWidth(resizeColumn, el);
|
|
24056
24210
|
el.removeAttribute('data-calc-col');
|
|
@@ -24058,6 +24212,9 @@ var VxeTableComponent = defineVxeComponent({
|
|
|
24058
24212
|
resizeWidth = Math.max(resizeWidth, colRest.width);
|
|
24059
24213
|
}
|
|
24060
24214
|
resizeWidth = Math.max(colMinWidth, resizeWidth);
|
|
24215
|
+
if (colMaxWidth > 1) {
|
|
24216
|
+
resizeWidth = Math.min(colMaxWidth, resizeWidth);
|
|
24217
|
+
}
|
|
24061
24218
|
const resizeParams = Object.assign(Object.assign({}, params), { resizeWidth, resizeColumn });
|
|
24062
24219
|
reactData.isDragResize = false;
|
|
24063
24220
|
internalData._lastResizeTime = Date.now();
|