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
|
@@ -278,7 +278,7 @@ hooks.add('tableExportModule', {
|
|
|
278
278
|
function getHeaderTitle(opts, column) {
|
|
279
279
|
const columnOpts = computeColumnOpts.value;
|
|
280
280
|
const headExportMethod = column.headerExportMethod || columnOpts.headerExportMethod;
|
|
281
|
-
return headExportMethod ? headExportMethod({ column, options: opts, $table: $xeTable }) : ((opts.isTitle ?
|
|
281
|
+
return headExportMethod ? headExportMethod({ column, options: opts, $table: $xeTable }) : ((opts.isTitle ? $xeTable.getHeaderCellLabel(column) : column.field) || '');
|
|
282
282
|
}
|
|
283
283
|
const toBooleanValue = (cellValue) => {
|
|
284
284
|
return XEUtils.isBoolean(cellValue) ? (cellValue ? 'TRUE' : 'FALSE') : cellValue;
|
|
@@ -932,12 +932,12 @@ hooks.add('tableExportModule', {
|
|
|
932
932
|
const tableTitleMaps = {};
|
|
933
933
|
tableFullColumn.forEach((column) => {
|
|
934
934
|
const field = column.field;
|
|
935
|
-
const title =
|
|
935
|
+
const title = $xeTable.getHeaderCellLabel(column);
|
|
936
936
|
if (field) {
|
|
937
937
|
tableFieldMaps[field] = column;
|
|
938
938
|
}
|
|
939
939
|
if (title) {
|
|
940
|
-
tableTitleMaps[
|
|
940
|
+
tableTitleMaps[title] = column;
|
|
941
941
|
}
|
|
942
942
|
});
|
|
943
943
|
const tableConf = {
|
package/es/table/src/cell.js
CHANGED
|
@@ -356,7 +356,7 @@ export const Cell = {
|
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
|
-
return renderTitleContent(params,
|
|
359
|
+
return renderTitleContent(params, $table.getHeaderCellLabel(column));
|
|
360
360
|
},
|
|
361
361
|
renderDefaultHeader(params) {
|
|
362
362
|
return renderHeaderCellBaseVNs(params, Cell.renderHeaderTitle(params));
|
|
@@ -368,7 +368,7 @@ export const Cell = {
|
|
|
368
368
|
const tableInternalData = $table.internalData;
|
|
369
369
|
const { isRowGroupStatus } = tableReactData;
|
|
370
370
|
const { editConfig } = tableProps;
|
|
371
|
-
const { field, slots, editRender, cellRender, rowGroupNode, aggFunc
|
|
371
|
+
const { field, slots, editRender, cellRender, rowGroupNode, aggFunc } = column;
|
|
372
372
|
const isEnableEdit = editConfig && isEnableConf(editConfig);
|
|
373
373
|
const editRenderOpts = isEnableEdit && isEnableConf(editRender) ? editRender : null;
|
|
374
374
|
const cellRenderOpts = isEnableConf(cellRender) ? cellRender : null;
|
|
@@ -444,8 +444,9 @@ export const Cell = {
|
|
|
444
444
|
return renderCellBaseVNs(params, $table.callSlot(defaultSlot, params));
|
|
445
445
|
}
|
|
446
446
|
const renderOpts = editRenderOpts || cellRenderOpts;
|
|
447
|
-
//
|
|
448
|
-
|
|
447
|
+
// 如果是编辑表格:renderTableCell > formatter
|
|
448
|
+
// 如果是查看表格:renderTableDefault > formatter
|
|
449
|
+
if (renderOpts) {
|
|
449
450
|
const compConf = renderer.get(renderOpts.name);
|
|
450
451
|
if (compConf) {
|
|
451
452
|
const renderFn = editRenderOpts ? (compConf.renderTableCell || compConf.renderCell) : (compConf.renderTableDefault || compConf.renderDefault);
|
|
@@ -616,7 +617,7 @@ export const Cell = {
|
|
|
616
617
|
const { $table, column } = params;
|
|
617
618
|
const { slots } = column;
|
|
618
619
|
const headerSlot = slots ? slots.header : null;
|
|
619
|
-
return renderHeaderCellBaseVNs(params, renderTitleContent(params, headerSlot ? $table.callSlot(headerSlot, params) :
|
|
620
|
+
return renderHeaderCellBaseVNs(params, renderTitleContent(params, headerSlot ? $table.callSlot(headerSlot, params) : $table.getHeaderCellLabel(column)));
|
|
620
621
|
},
|
|
621
622
|
renderSeqCell(params) {
|
|
622
623
|
const { $table, column } = params;
|
|
@@ -651,7 +652,7 @@ export const Cell = {
|
|
|
651
652
|
: [
|
|
652
653
|
h('span', {
|
|
653
654
|
class: 'vxe-radio--label'
|
|
654
|
-
}, titleSlot ? $table.callSlot(titleSlot, params) :
|
|
655
|
+
}, titleSlot ? $table.callSlot(titleSlot, params) : $table.getHeaderCellLabel(column))
|
|
655
656
|
]));
|
|
656
657
|
},
|
|
657
658
|
renderRadioCell(params) {
|
|
@@ -720,7 +721,7 @@ export const Cell = {
|
|
|
720
721
|
const titleSlot = slots ? slots.title : null;
|
|
721
722
|
const checkboxOpts = computeCheckboxOpts.value;
|
|
722
723
|
const { checkStrictly, showHeader, headerTitle } = checkboxOpts;
|
|
723
|
-
const colTitle =
|
|
724
|
+
const colTitle = $table.getHeaderCellLabel(column);
|
|
724
725
|
const ons = {};
|
|
725
726
|
if (!isHidden) {
|
|
726
727
|
ons.onClick = (evnt) => {
|
|
@@ -11,16 +11,13 @@ 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 formatter = _vm.formatter;
|
|
17
17
|
const visible = XEUtils.isBoolean(_vm.visible) ? _vm.visible : true;
|
|
18
18
|
const flCompConf = isEnableConf(filterRender) ? renderer.get(filterRender.name) : null;
|
|
19
19
|
const ctFilterOptions = flCompConf ? flCompConf.createTableFilterOptions : null;
|
|
20
20
|
const filters = toFilters(_vm.filters, colId);
|
|
21
|
-
if (headerFormatter) {
|
|
22
|
-
errLog('vxe.error.notProp', ['header-formatter']);
|
|
23
|
-
}
|
|
24
21
|
const types = ['seq', 'checkbox', 'radio', 'expand', 'html'];
|
|
25
22
|
if (_vm.type && types.indexOf(_vm.type) === -1) {
|
|
26
23
|
warnLog('vxe.error.errProp', [`type=${_vm.type}`, types.join(', ')]);
|
package/es/table/src/emits.js
CHANGED
package/es/table/src/table.js
CHANGED
|
@@ -4,7 +4,7 @@ import XEUtils from 'xe-utils';
|
|
|
4
4
|
import { initTpImg, getTpImg, isPx, isScale, hasClass, addClass, removeClass, wheelScrollTopTo, wheelScrollLeftTo, getEventTargetNode, getPaddingTopBottomSize, setScrollTop, setScrollLeft, toCssUnit, hasControlKey, checkTargetElement, hasEventInputTarget } from '../../ui/src/dom';
|
|
5
5
|
import { getLastZIndex, nextZIndex, hasChildrenList, getFuncText, isEnableConf, formatText, eqEmptyValue } from '../../ui/src/utils';
|
|
6
6
|
import { VxeUI } from '../../ui';
|
|
7
|
-
import { createReactData, createInternalData, getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, hasDeepKey, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth, createHandleUpdateRowId, createHandleGetRowId, getCalcHeight, getCellRestHeight, getLastChildColumn } from './util';
|
|
7
|
+
import { createReactData, createInternalData, getRowUniqueId, createRowId, clearTableAllStatus, getColumnList, toFilters, hasDeepKey, getRowkey, getRowid, rowToVisible, colToVisible, getCellValue, setCellValue, handleRowidOrRow, handleFieldOrColumn, toTreePathSeq, restoreScrollLocation, getRootColumn, getRefElem, getColReMinWidth, getColReMaxWidth, createHandleUpdateRowId, createHandleGetRowId, getCalcHeight, getCellRestHeight, getLastChildColumn } from './util';
|
|
8
8
|
import { getSlotVNs } from '../../ui/src/vn';
|
|
9
9
|
import { moveRowAnimateToTb, clearRowAnimate, moveColAnimateToLr, clearColAnimate } from '../../ui/src/anime';
|
|
10
10
|
import { warnLog, errLog } from '../../ui/src/log';
|
|
@@ -1830,6 +1830,7 @@ export default defineVxeComponent({
|
|
|
1830
1830
|
if (!xHandleEl) {
|
|
1831
1831
|
return;
|
|
1832
1832
|
}
|
|
1833
|
+
const columnOpts = computeColumnOpts.value;
|
|
1833
1834
|
let tWidth = 0;
|
|
1834
1835
|
const minCellWidth = 40; // 列宽最少限制 40px
|
|
1835
1836
|
const bodyWidth = bodyWrapperElem.clientWidth;
|
|
@@ -1838,39 +1839,73 @@ export default defineVxeComponent({
|
|
|
1838
1839
|
const { fit } = props;
|
|
1839
1840
|
const { columnStore } = reactData;
|
|
1840
1841
|
const { resizeList, pxMinList, autoMinList, pxList, scaleList, scaleMinList, autoList, remainList } = columnStore;
|
|
1842
|
+
const parseColumnMaxWidth = (column) => {
|
|
1843
|
+
const maxWidth = column.maxWidth || columnOpts.maxWidth;
|
|
1844
|
+
if (maxWidth && maxWidth !== 'auto') {
|
|
1845
|
+
if (isScale(maxWidth)) {
|
|
1846
|
+
return Math.floor(XEUtils.toInteger(maxWidth) * meanWidth);
|
|
1847
|
+
}
|
|
1848
|
+
return XEUtils.toInteger(maxWidth);
|
|
1849
|
+
}
|
|
1850
|
+
return 0;
|
|
1851
|
+
};
|
|
1841
1852
|
// 最小宽
|
|
1842
1853
|
pxMinList.forEach((column) => {
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1854
|
+
let miWidth = XEUtils.toInteger(column.minWidth);
|
|
1855
|
+
const mxWidth = parseColumnMaxWidth(column);
|
|
1856
|
+
if (mxWidth) {
|
|
1857
|
+
miWidth = Math.min(miWidth, mxWidth);
|
|
1858
|
+
}
|
|
1859
|
+
tWidth += miWidth;
|
|
1860
|
+
column.renderWidth = miWidth;
|
|
1846
1861
|
});
|
|
1847
1862
|
// 最小自适应
|
|
1848
1863
|
autoMinList.forEach((column) => {
|
|
1849
|
-
|
|
1864
|
+
let caWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth));
|
|
1865
|
+
const mxWidth = parseColumnMaxWidth(column);
|
|
1866
|
+
if (mxWidth) {
|
|
1867
|
+
caWidth = Math.min(caWidth, mxWidth);
|
|
1868
|
+
}
|
|
1850
1869
|
tWidth += caWidth;
|
|
1851
1870
|
column.renderWidth = caWidth;
|
|
1852
1871
|
});
|
|
1853
1872
|
// 最小百分比
|
|
1854
1873
|
scaleMinList.forEach((column) => {
|
|
1855
|
-
|
|
1874
|
+
let smWidth = Math.floor(XEUtils.toInteger(column.minWidth) * meanWidth);
|
|
1875
|
+
const mxWidth = parseColumnMaxWidth(column);
|
|
1876
|
+
if (mxWidth) {
|
|
1877
|
+
smWidth = Math.min(smWidth, mxWidth);
|
|
1878
|
+
}
|
|
1856
1879
|
tWidth += smWidth;
|
|
1857
1880
|
column.renderWidth = smWidth;
|
|
1858
1881
|
});
|
|
1859
1882
|
// 固定百分比
|
|
1860
1883
|
scaleList.forEach((column) => {
|
|
1861
|
-
|
|
1884
|
+
let sfWidth = Math.floor(XEUtils.toInteger(column.width) * meanWidth);
|
|
1885
|
+
const mxWidth = parseColumnMaxWidth(column);
|
|
1886
|
+
if (mxWidth) {
|
|
1887
|
+
sfWidth = Math.min(sfWidth, mxWidth);
|
|
1888
|
+
}
|
|
1862
1889
|
tWidth += sfWidth;
|
|
1863
1890
|
column.renderWidth = sfWidth;
|
|
1864
1891
|
});
|
|
1865
1892
|
// 固定宽
|
|
1866
1893
|
pxList.forEach((column) => {
|
|
1867
|
-
|
|
1894
|
+
let pWidth = XEUtils.toInteger(column.width);
|
|
1895
|
+
const mxWidth = parseColumnMaxWidth(column);
|
|
1896
|
+
if (mxWidth) {
|
|
1897
|
+
pWidth = Math.min(pWidth, mxWidth);
|
|
1898
|
+
}
|
|
1868
1899
|
tWidth += pWidth;
|
|
1869
1900
|
column.renderWidth = pWidth;
|
|
1870
1901
|
});
|
|
1871
1902
|
// 自适应宽
|
|
1872
1903
|
autoList.forEach((column) => {
|
|
1873
|
-
|
|
1904
|
+
let aWidth = Math.max(60, XEUtils.toInteger(column.renderAutoWidth));
|
|
1905
|
+
const mxWidth = parseColumnMaxWidth(column);
|
|
1906
|
+
if (mxWidth) {
|
|
1907
|
+
aWidth = Math.min(aWidth, mxWidth);
|
|
1908
|
+
}
|
|
1874
1909
|
tWidth += aWidth;
|
|
1875
1910
|
column.renderWidth = aWidth;
|
|
1876
1911
|
});
|
|
@@ -1880,11 +1915,12 @@ export default defineVxeComponent({
|
|
|
1880
1915
|
tWidth += reWidth;
|
|
1881
1916
|
column.renderWidth = reWidth;
|
|
1882
1917
|
});
|
|
1918
|
+
const zoomColumnList = scaleMinList.concat(pxMinList).concat(autoMinList).filter(column => !parseColumnMaxWidth(column));
|
|
1883
1919
|
remainWidth -= tWidth;
|
|
1884
|
-
meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (
|
|
1920
|
+
meanWidth = remainWidth > 0 ? Math.floor(remainWidth / (zoomColumnList.length + remainList.length)) : 0;
|
|
1885
1921
|
if (fit) {
|
|
1886
1922
|
if (remainWidth > 0) {
|
|
1887
|
-
|
|
1923
|
+
zoomColumnList.forEach((column) => {
|
|
1888
1924
|
tWidth += meanWidth;
|
|
1889
1925
|
column.renderWidth += meanWidth;
|
|
1890
1926
|
});
|
|
@@ -1903,8 +1939,9 @@ export default defineVxeComponent({
|
|
|
1903
1939
|
/**
|
|
1904
1940
|
* 偏移量算法
|
|
1905
1941
|
* 如果所有列足够放的情况下,从最后动态列开始分配
|
|
1942
|
+
* 排除已设置 max-width
|
|
1906
1943
|
*/
|
|
1907
|
-
const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList);
|
|
1944
|
+
const dynamicList = scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList).filter(column => !parseColumnMaxWidth(column));
|
|
1908
1945
|
let dynamicSize = dynamicList.length - 1;
|
|
1909
1946
|
if (dynamicSize > 0) {
|
|
1910
1947
|
let i = bodyWidth - tWidth;
|
|
@@ -4050,6 +4087,7 @@ export default defineVxeComponent({
|
|
|
4050
4087
|
loadScrollXData();
|
|
4051
4088
|
}
|
|
4052
4089
|
});
|
|
4090
|
+
$xeTable.clearHeaderFormatterCache();
|
|
4053
4091
|
$xeTable.clearMergeCells();
|
|
4054
4092
|
$xeTable.clearMergeFooterItems();
|
|
4055
4093
|
$xeTable.handleTableData(true);
|
|
@@ -5291,6 +5329,81 @@ export default defineVxeComponent({
|
|
|
5291
5329
|
}
|
|
5292
5330
|
return nextTick();
|
|
5293
5331
|
},
|
|
5332
|
+
getHeaderCellLabel(fieldOrColumn) {
|
|
5333
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
5334
|
+
if (!column) {
|
|
5335
|
+
return null;
|
|
5336
|
+
}
|
|
5337
|
+
const { headerFormatter } = column;
|
|
5338
|
+
const _columnIndex = $xeTable.getVTColumnIndex(column);
|
|
5339
|
+
let cellLabel = column.getTitle();
|
|
5340
|
+
if (headerFormatter) {
|
|
5341
|
+
let formatData;
|
|
5342
|
+
const { headerFullDataColData } = internalData;
|
|
5343
|
+
const colid = column.id;
|
|
5344
|
+
let colRest = headerFullDataColData[colid];
|
|
5345
|
+
if (!colRest) {
|
|
5346
|
+
colRest = headerFullDataColData[colid] = {};
|
|
5347
|
+
}
|
|
5348
|
+
const formatObj = colRest.formatObj;
|
|
5349
|
+
if (formatObj && formatObj.value === cellLabel) {
|
|
5350
|
+
return formatObj.label;
|
|
5351
|
+
}
|
|
5352
|
+
const headFormatParams = {
|
|
5353
|
+
$table: $xeTable,
|
|
5354
|
+
cellTitle: cellLabel,
|
|
5355
|
+
cellValue: cellLabel,
|
|
5356
|
+
column,
|
|
5357
|
+
_columnIndex,
|
|
5358
|
+
columnIndex: $xeTable.getColumnIndex(column)
|
|
5359
|
+
};
|
|
5360
|
+
if (XEUtils.isString(headerFormatter)) {
|
|
5361
|
+
const gFormatOpts = formats.get(headerFormatter);
|
|
5362
|
+
const fcFormatMethod = gFormatOpts ? gFormatOpts.tableHeaderCellFormatMethod : null;
|
|
5363
|
+
cellLabel = XEUtils.toValueString(fcFormatMethod ? fcFormatMethod(headFormatParams) : '');
|
|
5364
|
+
}
|
|
5365
|
+
else if (XEUtils.isArray(headerFormatter)) {
|
|
5366
|
+
const gFormatOpts = formats.get(headerFormatter[0]);
|
|
5367
|
+
const fcFormatMethod = gFormatOpts ? gFormatOpts.tableHeaderCellFormatMethod : null;
|
|
5368
|
+
cellLabel = XEUtils.toValueString(fcFormatMethod ? fcFormatMethod(headFormatParams, ...headerFormatter.slice(1)) : '');
|
|
5369
|
+
}
|
|
5370
|
+
else {
|
|
5371
|
+
cellLabel = XEUtils.toValueString(headerFormatter(headFormatParams));
|
|
5372
|
+
}
|
|
5373
|
+
if (formatData) {
|
|
5374
|
+
colRest.formatObj = { value: cellLabel, label: cellLabel };
|
|
5375
|
+
}
|
|
5376
|
+
}
|
|
5377
|
+
return cellLabel;
|
|
5378
|
+
},
|
|
5379
|
+
updateHeaderCellLabel(fieldOrColumn) {
|
|
5380
|
+
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
5381
|
+
if (!column) {
|
|
5382
|
+
return '';
|
|
5383
|
+
}
|
|
5384
|
+
const { headerFullDataColData } = internalData;
|
|
5385
|
+
const colid = column.id;
|
|
5386
|
+
const colRest = headerFullDataColData[colid];
|
|
5387
|
+
if (colRest) {
|
|
5388
|
+
colRest.formatObj = undefined;
|
|
5389
|
+
}
|
|
5390
|
+
return $xeTable.getHeaderCellLabel(column);
|
|
5391
|
+
},
|
|
5392
|
+
clearHeaderFormatterCache(isUpdate) {
|
|
5393
|
+
const { tableColumn } = reactData;
|
|
5394
|
+
const { headerFullDataColData } = internalData;
|
|
5395
|
+
XEUtils.each(headerFullDataColData, (colRest) => {
|
|
5396
|
+
if (colRest.formatObj) {
|
|
5397
|
+
colRest.formatObj = undefined;
|
|
5398
|
+
}
|
|
5399
|
+
});
|
|
5400
|
+
if (isUpdate) {
|
|
5401
|
+
tableColumn.forEach(column => {
|
|
5402
|
+
$xeTable.getHeaderCellLabel(column);
|
|
5403
|
+
});
|
|
5404
|
+
}
|
|
5405
|
+
return nextTick();
|
|
5406
|
+
},
|
|
5294
5407
|
getFooterCellLabel(row, fieldOrColumn) {
|
|
5295
5408
|
const column = handleFieldOrColumn($xeTable, fieldOrColumn);
|
|
5296
5409
|
if (!column) {
|
|
@@ -7502,6 +7615,7 @@ export default defineVxeComponent({
|
|
|
7502
7615
|
footData = visibleColumn.length ? footerMethod({ columns: visibleColumn, data: afterFullData, $table: $xeTable, $grid: $xeGrid, $gantt: $xeGantt }) : [];
|
|
7503
7616
|
}
|
|
7504
7617
|
reactData.footerTableData = footData;
|
|
7618
|
+
$xeTable.clearFooterFormatterCache();
|
|
7505
7619
|
$xeTable.handleUpdateFooterMerge();
|
|
7506
7620
|
$xeTable.dispatchEvent('footer-data-change', {
|
|
7507
7621
|
visibleColumn: internalData.visibleColumn,
|
|
@@ -9321,6 +9435,7 @@ export default defineVxeComponent({
|
|
|
9321
9435
|
const dragBtnOffsetWidth = XEUtils.floor(dragBtnWidth / 2);
|
|
9322
9436
|
const dragPosLeft = dragBtnRect.x - tableRect.x + dragBtnOffsetWidth;
|
|
9323
9437
|
const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
|
|
9438
|
+
const maxInterval = getColReMaxWidth(cellParams); // 列之间的最大间距
|
|
9324
9439
|
const dragMinLeft = isRightFixed ? 0 : (cellRect.x - tableRect.x + dragBtnWidth + minInterval);
|
|
9325
9440
|
const dragMaxLeft = cellRect.x - tableRect.x + cell.clientWidth - minInterval;
|
|
9326
9441
|
let fixedLeftRemainWidth = 0;
|
|
@@ -9360,6 +9475,10 @@ export default defineVxeComponent({
|
|
|
9360
9475
|
left = Math.min(left, dragMaxLeft);
|
|
9361
9476
|
}
|
|
9362
9477
|
dragLeft = Math.max(left, dragMinLeft);
|
|
9478
|
+
// 最大宽
|
|
9479
|
+
if (maxInterval > 1) {
|
|
9480
|
+
dragLeft = Math.min(dragLeft, maxInterval + dragMinLeft - minInterval);
|
|
9481
|
+
}
|
|
9363
9482
|
const resizeBarLeft = Math.max(1, dragLeft);
|
|
9364
9483
|
resizeBarElem.style.left = `${resizeBarLeft}px`;
|
|
9365
9484
|
resizeBarElem.style.top = `${scrollbarXToTop ? osbHeight : 0}px`;
|
|
@@ -9440,6 +9559,7 @@ export default defineVxeComponent({
|
|
|
9440
9559
|
const cell = dragBtnElem.parentNode;
|
|
9441
9560
|
const cellParams = Object.assign(params, { cell, $table: $xeTable });
|
|
9442
9561
|
const colMinWidth = getColReMinWidth(cellParams);
|
|
9562
|
+
const colMaxWidth = getColReMaxWidth(cellParams);
|
|
9443
9563
|
el.setAttribute('data-calc-col', 'Y');
|
|
9444
9564
|
let resizeWidth = calcColumnAutoWidth(resizeColumn, el);
|
|
9445
9565
|
el.removeAttribute('data-calc-col');
|
|
@@ -9447,6 +9567,9 @@ export default defineVxeComponent({
|
|
|
9447
9567
|
resizeWidth = Math.max(resizeWidth, colRest.width);
|
|
9448
9568
|
}
|
|
9449
9569
|
resizeWidth = Math.max(colMinWidth, resizeWidth);
|
|
9570
|
+
if (colMaxWidth > 1) {
|
|
9571
|
+
resizeWidth = Math.min(colMaxWidth, resizeWidth);
|
|
9572
|
+
}
|
|
9450
9573
|
const resizeParams = Object.assign(Object.assign({}, params), { resizeWidth, resizeColumn });
|
|
9451
9574
|
reactData.isDragResize = false;
|
|
9452
9575
|
internalData._lastResizeTime = Date.now();
|
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: {},
|
|
@@ -682,14 +683,16 @@ export function getCalcHeight(height) {
|
|
|
682
683
|
}
|
|
683
684
|
/**
|
|
684
685
|
* 列宽拖动最大宽度
|
|
685
|
-
* @param params
|
|
686
|
-
* @returns
|
|
687
686
|
*/
|
|
688
687
|
export function getColReMaxWidth(params) {
|
|
689
|
-
const { $table } = params;
|
|
690
|
-
const
|
|
688
|
+
const { $table, column, cell } = params;
|
|
689
|
+
const internalData = $table.internalData;
|
|
690
|
+
const { elemStore } = internalData;
|
|
691
|
+
const { computeColumnOpts, computeResizableOpts } = $table.getComputeMaps();
|
|
691
692
|
const resizableOpts = computeResizableOpts.value;
|
|
693
|
+
const columnOpts = computeColumnOpts.value;
|
|
692
694
|
const { maxWidth: reMaxWidth } = resizableOpts;
|
|
695
|
+
const colMaxWidth = column.maxWidth || columnOpts.maxWidth;
|
|
693
696
|
// 如果自定义调整宽度逻辑
|
|
694
697
|
if (reMaxWidth) {
|
|
695
698
|
const customMaxWidth = XEUtils.isFunction(reMaxWidth) ? reMaxWidth(params) : reMaxWidth;
|
|
@@ -697,19 +700,35 @@ export function getColReMaxWidth(params) {
|
|
|
697
700
|
return Math.max(1, XEUtils.toNumber(customMaxWidth));
|
|
698
701
|
}
|
|
699
702
|
}
|
|
703
|
+
const minTitleWidth = XEUtils.floor((XEUtils.toNumber(getComputedStyle(cell).fontSize) || 14) * 1.8);
|
|
704
|
+
const paddingLeftRight = getPaddingLeftRightSize(cell) + getPaddingLeftRightSize(queryElement(cell, '.vxe-cell'));
|
|
705
|
+
const mWidth = minTitleWidth + paddingLeftRight;
|
|
706
|
+
// 如果设置最小宽
|
|
707
|
+
if (colMaxWidth) {
|
|
708
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
709
|
+
if (bodyScrollElem) {
|
|
710
|
+
if (isScale(colMaxWidth)) {
|
|
711
|
+
const bodyWidth = bodyScrollElem.clientWidth - 1;
|
|
712
|
+
const meanWidth = bodyWidth / 100;
|
|
713
|
+
return Math.max(mWidth, Math.floor(XEUtils.toInteger(colMaxWidth) * meanWidth));
|
|
714
|
+
}
|
|
715
|
+
else if (isPx(colMaxWidth)) {
|
|
716
|
+
return Math.max(mWidth, XEUtils.toInteger(colMaxWidth));
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
}
|
|
700
720
|
return -1;
|
|
701
721
|
}
|
|
702
722
|
/**
|
|
703
723
|
* 列宽拖动最小宽度
|
|
704
|
-
* @param params
|
|
705
|
-
* @returns
|
|
706
724
|
*/
|
|
707
725
|
export function getColReMinWidth(params) {
|
|
708
726
|
const { $table, column, cell } = params;
|
|
709
727
|
const tableProps = $table.props;
|
|
710
728
|
const internalData = $table.internalData;
|
|
711
|
-
const { computeResizableOpts } = $table.getComputeMaps();
|
|
729
|
+
const { computeColumnOpts, computeResizableOpts } = $table.getComputeMaps();
|
|
712
730
|
const resizableOpts = computeResizableOpts.value;
|
|
731
|
+
const columnOpts = computeColumnOpts.value;
|
|
713
732
|
const { minWidth: reMinWidth } = resizableOpts;
|
|
714
733
|
// 如果自定义调整宽度逻辑
|
|
715
734
|
if (reMinWidth) {
|
|
@@ -720,7 +739,8 @@ export function getColReMinWidth(params) {
|
|
|
720
739
|
}
|
|
721
740
|
const { elemStore } = internalData;
|
|
722
741
|
const { showHeaderOverflow: allColumnHeaderOverflow } = tableProps;
|
|
723
|
-
const { showHeaderOverflow
|
|
742
|
+
const { showHeaderOverflow } = column;
|
|
743
|
+
const colMinWidth = column.minWidth || columnOpts.minWidth;
|
|
724
744
|
const headOverflow = XEUtils.isUndefined(showHeaderOverflow) || XEUtils.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
725
745
|
const showEllipsis = headOverflow === 'ellipsis';
|
|
726
746
|
const showTitle = headOverflow === 'title';
|
package/es/ui/index.js
CHANGED
package/es/ui/src/log.js
CHANGED