vxe-table 3.21.5 → 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/src/methods.js +68 -22
- package/es/table/src/util.js +46 -2
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +71 -19
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/src/methods.js +14 -11
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/util.js +56 -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/src/methods.ts +72 -22
- package/packages/table/src/util.ts +62 -4
- /package/es/{iconfont.1780200130470.ttf → iconfont.1780293000244.ttf} +0 -0
- /package/es/{iconfont.1780200130470.woff → iconfont.1780293000244.woff} +0 -0
- /package/es/{iconfont.1780200130470.woff2 → iconfont.1780293000244.woff2} +0 -0
- /package/lib/{iconfont.1780200130470.ttf → iconfont.1780293000244.ttf} +0 -0
- /package/lib/{iconfont.1780200130470.woff → iconfont.1780293000244.woff} +0 -0
- /package/lib/{iconfont.1780200130470.woff2 → iconfont.1780293000244.woff2} +0 -0
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;
|
|
@@ -6521,6 +6558,7 @@ const tableMethods = {
|
|
|
6521
6558
|
const dragBtnOffsetWidth = XEUtils.floor(dragBtnWidth / 2);
|
|
6522
6559
|
const dragPosLeft = dragBtnRect.x - tableRect.x + dragBtnOffsetWidth;
|
|
6523
6560
|
const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
|
|
6561
|
+
const maxInterval = getColReMaxWidth(cellParams); // 列之间的最大间距
|
|
6524
6562
|
const dragMinLeft = isRightFixed ? 0 : (cellRect.x - tableRect.x + dragBtnWidth + minInterval);
|
|
6525
6563
|
const dragMaxLeft = cellRect.x - tableRect.x + cell.clientWidth - minInterval;
|
|
6526
6564
|
let fixedLeftRemainWidth = 0;
|
|
@@ -6560,6 +6598,10 @@ const tableMethods = {
|
|
|
6560
6598
|
left = Math.min(left, dragMaxLeft);
|
|
6561
6599
|
}
|
|
6562
6600
|
dragLeft = Math.max(left, dragMinLeft);
|
|
6601
|
+
// 最大宽
|
|
6602
|
+
if (maxInterval > 1) {
|
|
6603
|
+
dragLeft = Math.min(dragLeft, maxInterval + dragMinLeft - minInterval);
|
|
6604
|
+
}
|
|
6563
6605
|
const resizeBarLeft = Math.max(1, dragLeft);
|
|
6564
6606
|
resizeBarElem.style.left = `${resizeBarLeft}px`;
|
|
6565
6607
|
resizeBarElem.style.top = `${scrollbarXToTop ? osbHeight : 0}px`;
|
|
@@ -6643,6 +6685,7 @@ const tableMethods = {
|
|
|
6643
6685
|
const cell = dragBtnElem.parentNode;
|
|
6644
6686
|
const cellParams = Object.assign(params, { cell, $table: $xeTable });
|
|
6645
6687
|
const colMinWidth = getColReMinWidth(cellParams);
|
|
6688
|
+
const colMaxWidth = getColReMaxWidth(cellParams);
|
|
6646
6689
|
el.setAttribute('data-calc-col', 'Y');
|
|
6647
6690
|
let resizeWidth = calcColumnAutoWidth($xeTable, resizeColumn, el);
|
|
6648
6691
|
el.removeAttribute('data-calc-col');
|
|
@@ -6650,6 +6693,9 @@ const tableMethods = {
|
|
|
6650
6693
|
resizeWidth = Math.max(resizeWidth, colRest.width);
|
|
6651
6694
|
}
|
|
6652
6695
|
resizeWidth = Math.max(colMinWidth, resizeWidth);
|
|
6696
|
+
if (colMaxWidth > 1) {
|
|
6697
|
+
resizeWidth = Math.min(colMaxWidth, resizeWidth);
|
|
6698
|
+
}
|
|
6653
6699
|
const resizeParams = Object.assign(Object.assign({}, params), { resizeWidth, resizeColumn });
|
|
6654
6700
|
reactData.isDragResize = false;
|
|
6655
6701
|
internalData._lastResizeTime = Date.now();
|
package/es/table/src/util.js
CHANGED
|
@@ -711,10 +711,52 @@ export function toFilters(filters, colid) {
|
|
|
711
711
|
}
|
|
712
712
|
return filters;
|
|
713
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
|
+
*/
|
|
714
754
|
export function getColReMinWidth(params) {
|
|
715
755
|
const { $table, column, cell } = params;
|
|
756
|
+
const tableProps = $table;
|
|
716
757
|
const internalData = $table;
|
|
717
|
-
const
|
|
758
|
+
const resizableOpts = $table.computeResizableOpts;
|
|
759
|
+
const columnOpts = $table.computeColumnOpts;
|
|
718
760
|
const { minWidth } = resizableOpts;
|
|
719
761
|
// 如果自定义调整宽度逻辑
|
|
720
762
|
if (minWidth) {
|
|
@@ -724,7 +766,9 @@ export function getColReMinWidth(params) {
|
|
|
724
766
|
}
|
|
725
767
|
}
|
|
726
768
|
const { elemStore } = internalData;
|
|
727
|
-
const { showHeaderOverflow
|
|
769
|
+
const { showHeaderOverflow: allColumnHeaderOverflow } = tableProps;
|
|
770
|
+
const { showHeaderOverflow } = column;
|
|
771
|
+
const colMinWidth = column.minWidth || columnOpts.minWidth;
|
|
728
772
|
const headOverflow = XEUtils.isUndefined(showHeaderOverflow) || XEUtils.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
729
773
|
const showEllipsis = headOverflow === 'ellipsis';
|
|
730
774
|
const showTitle = headOverflow === 'title';
|
package/es/ui/index.js
CHANGED
package/es/ui/src/log.js
CHANGED
package/lib/index.umd.js
CHANGED
|
@@ -3311,7 +3311,7 @@ function getClass(property, params) {
|
|
|
3311
3311
|
/* unused harmony import specifier */ var VxeUI;
|
|
3312
3312
|
|
|
3313
3313
|
|
|
3314
|
-
const version = "3.21.
|
|
3314
|
+
const version = "3.21.6";
|
|
3315
3315
|
core_.VxeUI.version = version;
|
|
3316
3316
|
core_.VxeUI.tableVersion = version;
|
|
3317
3317
|
core_.VxeUI.setConfig({
|
|
@@ -3842,7 +3842,7 @@ var es_iterator_some = __webpack_require__(3579);
|
|
|
3842
3842
|
const {
|
|
3843
3843
|
log: log_log
|
|
3844
3844
|
} = core_.VxeUI;
|
|
3845
|
-
const log_version = `table v${"3.21.
|
|
3845
|
+
const log_version = `table v${"3.21.6"}`;
|
|
3846
3846
|
const warnLog = log_log.create('warn', log_version);
|
|
3847
3847
|
const errLog = log_log.create('error', log_version);
|
|
3848
3848
|
;// ./packages/table/src/columnInfo.ts
|
|
@@ -5063,7 +5063,10 @@ function toFilters(filters, colid) {
|
|
|
5063
5063
|
}
|
|
5064
5064
|
return filters;
|
|
5065
5065
|
}
|
|
5066
|
-
|
|
5066
|
+
/**
|
|
5067
|
+
* 列宽拖动最大宽度
|
|
5068
|
+
*/
|
|
5069
|
+
function getColReMaxWidth(params) {
|
|
5067
5070
|
const {
|
|
5068
5071
|
$table,
|
|
5069
5072
|
column,
|
|
@@ -5071,9 +5074,52 @@ function getColReMinWidth(params) {
|
|
|
5071
5074
|
} = params;
|
|
5072
5075
|
const internalData = $table;
|
|
5073
5076
|
const {
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
+
elemStore
|
|
5078
|
+
} = internalData;
|
|
5079
|
+
const resizableOpts = $table.computeResizableOpts;
|
|
5080
|
+
const columnOpts = $table.computeColumnOpts;
|
|
5081
|
+
const {
|
|
5082
|
+
maxWidth: reMaxWidth
|
|
5083
|
+
} = resizableOpts;
|
|
5084
|
+
const colMaxWidth = column.maxWidth || columnOpts.maxWidth;
|
|
5085
|
+
// 如果自定义调整宽度逻辑
|
|
5086
|
+
if (reMaxWidth) {
|
|
5087
|
+
const customMaxWidth = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(reMaxWidth) ? reMaxWidth(params) : reMaxWidth;
|
|
5088
|
+
if (customMaxWidth !== 'auto') {
|
|
5089
|
+
return Math.max(1, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(customMaxWidth));
|
|
5090
|
+
}
|
|
5091
|
+
}
|
|
5092
|
+
const minTitleWidth = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor((external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(getComputedStyle(cell).fontSize) || 14) * 1.8);
|
|
5093
|
+
const paddingLeftRight = getPaddingLeftRightSize(cell) + getPaddingLeftRightSize(queryElement(cell, '.vxe-cell'));
|
|
5094
|
+
const mWidth = minTitleWidth + paddingLeftRight;
|
|
5095
|
+
// 如果设置最小宽
|
|
5096
|
+
if (colMaxWidth) {
|
|
5097
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
5098
|
+
if (bodyScrollElem) {
|
|
5099
|
+
if (isScale(colMaxWidth)) {
|
|
5100
|
+
const bodyWidth = bodyScrollElem.clientWidth - 1;
|
|
5101
|
+
const meanWidth = bodyWidth / 100;
|
|
5102
|
+
return Math.max(mWidth, Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(colMaxWidth) * meanWidth));
|
|
5103
|
+
} else if (isPx(colMaxWidth)) {
|
|
5104
|
+
return Math.max(mWidth, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(colMaxWidth));
|
|
5105
|
+
}
|
|
5106
|
+
}
|
|
5107
|
+
}
|
|
5108
|
+
return -1;
|
|
5109
|
+
}
|
|
5110
|
+
/**
|
|
5111
|
+
* 列宽拖动最小宽度
|
|
5112
|
+
*/
|
|
5113
|
+
function getColReMinWidth(params) {
|
|
5114
|
+
const {
|
|
5115
|
+
$table,
|
|
5116
|
+
column,
|
|
5117
|
+
cell
|
|
5118
|
+
} = params;
|
|
5119
|
+
const tableProps = $table;
|
|
5120
|
+
const internalData = $table;
|
|
5121
|
+
const resizableOpts = $table.computeResizableOpts;
|
|
5122
|
+
const columnOpts = $table.computeColumnOpts;
|
|
5077
5123
|
const {
|
|
5078
5124
|
minWidth
|
|
5079
5125
|
} = resizableOpts;
|
|
@@ -5088,9 +5134,12 @@ function getColReMinWidth(params) {
|
|
|
5088
5134
|
elemStore
|
|
5089
5135
|
} = internalData;
|
|
5090
5136
|
const {
|
|
5091
|
-
showHeaderOverflow
|
|
5092
|
-
|
|
5137
|
+
showHeaderOverflow: allColumnHeaderOverflow
|
|
5138
|
+
} = tableProps;
|
|
5139
|
+
const {
|
|
5140
|
+
showHeaderOverflow
|
|
5093
5141
|
} = column;
|
|
5142
|
+
const colMinWidth = column.minWidth || columnOpts.minWidth;
|
|
5094
5143
|
const headOverflow = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isUndefined(showHeaderOverflow) || external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
5095
5144
|
const showEllipsis = headOverflow === 'ellipsis';
|
|
5096
5145
|
const showTitle = headOverflow === 'title';
|
|
@@ -7749,19 +7798,20 @@ val=144;}}else{val=defMinHeight;}}}let num=0;if(val){if(val==='100%'||val==='aut
|
|
|
7749
7798
|
* 支持动态列表调整分配
|
|
7750
7799
|
* 支持自动分配偏移量
|
|
7751
7800
|
* 支持 width=60 width=60px width=10% min-width=60 min-width=60px min-width=10%
|
|
7752
|
-
*/function autoCellWidth($xeTable){const props=$xeTable;const reactData=$xeTable;const internalData=$xeTable;const{elemStore}=internalData;const bodyWrapperElem=getRefElem(elemStore['main-body-wrapper']);if(!bodyWrapperElem){return;}const yHandleEl=$xeTable.$refs.refScrollYHandleElem;if(!yHandleEl){return;}const xHandleEl=$xeTable.$refs.refScrollXHandleElem;if(!xHandleEl){return;}let tWidth=0;const minCellWidth=40;// 列宽最少限制 40px
|
|
7753
|
-
const bodyWidth=bodyWrapperElem.clientWidth;let remainWidth=bodyWidth;let meanWidth=remainWidth/100;const{fit}=props;const{columnStore}=reactData;const{resizeList,pxMinList,autoMinList,pxList,scaleList,scaleMinList,autoList,remainList}=columnStore;// 最小宽
|
|
7754
|
-
pxMinList.forEach(column=>{
|
|
7755
|
-
autoMinList.forEach(column=>{
|
|
7756
|
-
scaleMinList.forEach(column=>{
|
|
7757
|
-
scaleList.forEach(column=>{
|
|
7758
|
-
pxList.forEach(column=>{
|
|
7759
|
-
autoList.forEach(column=>{
|
|
7760
|
-
resizeList.forEach(column=>{const width=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.resizeWidth);tWidth+=width;column.renderWidth=width;});remainWidth-=tWidth;meanWidth=remainWidth>0?Math.floor(remainWidth/(
|
|
7801
|
+
*/function autoCellWidth($xeTable){const props=$xeTable;const reactData=$xeTable;const internalData=$xeTable;const{elemStore}=internalData;const bodyWrapperElem=getRefElem(elemStore['main-body-wrapper']);if(!bodyWrapperElem){return;}const yHandleEl=$xeTable.$refs.refScrollYHandleElem;if(!yHandleEl){return;}const xHandleEl=$xeTable.$refs.refScrollXHandleElem;if(!xHandleEl){return;}const columnOpts=$xeTable.computeColumnOpts;let tWidth=0;const minCellWidth=40;// 列宽最少限制 40px
|
|
7802
|
+
const bodyWidth=bodyWrapperElem.clientWidth;let remainWidth=bodyWidth;let meanWidth=remainWidth/100;const{fit}=props;const{columnStore}=reactData;const{resizeList,pxMinList,autoMinList,pxList,scaleList,scaleMinList,autoList,remainList}=columnStore;const parseColumnMaxWidth=column=>{const maxWidth=column.maxWidth||columnOpts.maxWidth;if(maxWidth&&maxWidth!=='auto'){if(isScale(maxWidth)){return Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(maxWidth)*meanWidth);}return external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(maxWidth);}return 0;};// 最小宽
|
|
7803
|
+
pxMinList.forEach(column=>{let miWidth=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.minWidth);const mxWidth=parseColumnMaxWidth(column);if(mxWidth){miWidth=Math.min(miWidth,mxWidth);}tWidth+=miWidth;column.renderWidth=miWidth;});// 最小自适应
|
|
7804
|
+
autoMinList.forEach(column=>{let caWidth=Math.max(60,external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.renderAutoWidth));const mxWidth=parseColumnMaxWidth(column);if(mxWidth){caWidth=Math.min(caWidth,mxWidth);}tWidth+=caWidth;column.renderWidth=caWidth;});// 最小百分比
|
|
7805
|
+
scaleMinList.forEach(column=>{let smWidth=Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.minWidth)*meanWidth);const mxWidth=parseColumnMaxWidth(column);if(mxWidth){smWidth=Math.min(smWidth,mxWidth);}tWidth+=smWidth;column.renderWidth=smWidth;});// 固定百分比
|
|
7806
|
+
scaleList.forEach(column=>{let sfWidth=Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.width)*meanWidth);const mxWidth=parseColumnMaxWidth(column);if(mxWidth){sfWidth=Math.min(sfWidth,mxWidth);}tWidth+=sfWidth;column.renderWidth=sfWidth;});// 固定宽
|
|
7807
|
+
pxList.forEach(column=>{let pWidth=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.width);const mxWidth=parseColumnMaxWidth(column);if(mxWidth){pWidth=Math.min(pWidth,mxWidth);}tWidth+=pWidth;column.renderWidth=pWidth;});// 自适应宽
|
|
7808
|
+
autoList.forEach(column=>{let aWidth=Math.max(60,external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.renderAutoWidth));const mxWidth=parseColumnMaxWidth(column);if(mxWidth){aWidth=Math.min(aWidth,mxWidth);}tWidth+=aWidth;column.renderWidth=aWidth;});// 调整了列宽
|
|
7809
|
+
resizeList.forEach(column=>{const width=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.resizeWidth);tWidth+=width;column.renderWidth=width;});const zoomColumnList=scaleMinList.concat(pxMinList).concat(autoMinList).filter(column=>!parseColumnMaxWidth(column));remainWidth-=tWidth;meanWidth=remainWidth>0?Math.floor(remainWidth/(zoomColumnList.length+remainList.length)):0;if(fit){if(remainWidth>0){zoomColumnList.forEach(column=>{tWidth+=meanWidth;column.renderWidth+=meanWidth;});}}else{meanWidth=minCellWidth;}// 剩余均分
|
|
7761
7810
|
remainList.forEach(column=>{const width=Math.max(meanWidth,minCellWidth);column.renderWidth=width;tWidth+=width;});if(fit){/**
|
|
7762
7811
|
* 偏移量算法
|
|
7763
7812
|
* 如果所有列足够放的情况下,从最后动态列开始分配
|
|
7764
|
-
|
|
7813
|
+
* 排除已设置 max-width
|
|
7814
|
+
*/const dynamicList=scaleList.concat(scaleMinList).concat(pxMinList).concat(autoMinList).concat(remainList).filter(column=>!parseColumnMaxWidth(column));let dynamicSize=dynamicList.length-1;if(dynamicSize>0){let i=bodyWidth-tWidth;if(i>0){while(i>0&&dynamicSize>=0){i--;dynamicList[dynamicSize--].renderWidth++;}tWidth=bodyWidth;}}}reactData.scrollXWidth=tWidth;reactData.resizeWidthFlag++;updateColumnOffsetLeft($xeTable);updateHeight($xeTable);}/**
|
|
7765
7815
|
* 计算自适应行高
|
|
7766
7816
|
*/const calcCellAutoHeight=($xeTable,rowRest,wrapperEl)=>{const reactData=$xeTable;const{scrollXLoad}=reactData;const wrapperElemList=wrapperEl.querySelectorAll(`.vxe-cell--wrapper[rowid="${rowRest.rowid}"]`);let colHeight=0;let firstCellStyle=null;let topBottomPadding=0;for(let i=0;i<wrapperElemList.length;i++){const wrapperElem=wrapperElemList[i];const cellElem=wrapperElem.parentElement;const cellStyle=cellElem.style;const orHeight=cellStyle.height;if(!scrollXLoad){cellStyle.height='';}if(!firstCellStyle){firstCellStyle=getComputedStyle(cellElem);topBottomPadding=firstCellStyle?Math.ceil(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(firstCellStyle.paddingTop)+external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(firstCellStyle.paddingBottom)):0;}if(!scrollXLoad){cellStyle.height=orHeight;}const cellHeight=wrapperElem?wrapperElem.clientHeight:0;colHeight=Math.max(colHeight,Math.ceil(cellHeight+topBottomPadding));}if(scrollXLoad){colHeight=Math.max(colHeight,rowRest.height);}return colHeight;};/**
|
|
7767
7817
|
* 自适应行高
|
|
@@ -8062,8 +8112,10 @@ filterOptions.forEach(option=>{const{_checked,checked}=option;option._checked=ch
|
|
|
8062
8112
|
*/refreshColumn(initSort){const $xeTable=this;if(initSort){handleUpdateColumn($xeTable);}return parseColumns($xeTable,true).then(()=>{return this.refreshScroll();}).then(()=>{return handleLazyRecalculate($xeTable,false,true,true);});},/**
|
|
8063
8113
|
* 指定列宽的列进行拆分
|
|
8064
8114
|
*/analyColumnWidth(){const{columnOpts}=this;const{width:defaultWidth,minWidth:defaultMinWidth}=columnOpts;const resizeList=[];const pxList=[];const pxMinList=[];const autoMinList=[];const scaleList=[];const scaleMinList=[];const autoList=[];const remainList=[];this.tableFullColumn.forEach(column=>{if(defaultWidth&&!column.width){column.width=defaultWidth;}if(defaultMinWidth&&!column.minWidth){column.minWidth=defaultMinWidth;}if(column.visible){if(column.resizeWidth){resizeList.push(column);}else if(column.width==='auto'){autoList.push(column);}else if(isPx(column.width)){pxList.push(column);}else if(isScale(column.width)){scaleList.push(column);}else if(isPx(column.minWidth)){pxMinList.push(column);}else if(column.minWidth==='auto'){autoMinList.push(column);}else if(isScale(column.minWidth)){scaleMinList.push(column);}else{remainList.push(column);}}});Object.assign(this.columnStore,{resizeList,pxList,pxMinList,autoMinList,scaleList,scaleMinList,autoList,remainList});},handleColResizeMousedownEvent(evnt,fixedType,params){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const isLeftBtn=evnt.button===0;if(!isLeftBtn){return;}evnt.stopPropagation();evnt.preventDefault();const{column}=params;const{columnStore,overflowX,scrollbarHeight}=reactData;const{visibleColumn}=internalData;const{leftList,rightList}=columnStore;const resizableOpts=$xeTable.computeResizableOpts;const osbHeight=overflowX?scrollbarHeight:0;const tableEl=$xeTable.$refs.refElem;const leftContainerElem=$xeTable.$refs.refLeftContainer;const rightContainerElem=$xeTable.$refs.refRightContainer;const resizeBarElem=$xeTable.$refs.refColResizeBar;if(!resizeBarElem){return;}const isLeftFixed=fixedType==='left';const isRightFixed=fixedType==='right';const resizeTipElem=resizeBarElem.firstElementChild;const scrollbarXToTop=$xeTable.computeScrollbarXToTop;const{clientX:dragClientX}=evnt;const dragBtnElem=evnt.target;let cell=dragBtnElem.parentElement;let resizeColumn=column;const isDragGroupCol=column.children&&column.children.length;if(isDragGroupCol){resizeColumn=getLastChildColumn(column);if(isDragGroupCol){const trEl=cell?cell.parentElement:null;const theadEl=trEl?trEl.parentElement:null;cell=theadEl?theadEl.querySelector(`.vxe-header--column[colid="${resizeColumn.id}"]`):null;}}if(!cell){return;}const cellParams=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().assign(params,{cell,$table:$xeTable});let dragLeft=0;const tableRect=tableEl.getBoundingClientRect();const rightContainerRect=rightContainerElem?rightContainerElem.getBoundingClientRect():null;const cellRect=cell.getBoundingClientRect();const dragBtnRect=dragBtnElem.getBoundingClientRect();const dragBtnWidth=dragBtnElem.clientWidth;const dragBtnOffsetWidth=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().floor(dragBtnWidth/2);const dragPosLeft=dragBtnRect.x-tableRect.x+dragBtnOffsetWidth;const minInterval=getColReMinWidth(cellParams)-dragBtnOffsetWidth;// 列之间的最小间距
|
|
8115
|
+
const maxInterval=getColReMaxWidth(cellParams);// 列之间的最大间距
|
|
8065
8116
|
const dragMinLeft=isRightFixed?0:cellRect.x-tableRect.x+dragBtnWidth+minInterval;const dragMaxLeft=cellRect.x-tableRect.x+cell.clientWidth-minInterval;let fixedLeftRemainWidth=0;let fixedRightRemainWidth=0;if(isLeftFixed||isRightFixed){let isMach=false;const fixedColumn=isLeftFixed?leftList:rightList;for(let i=0;i<fixedColumn.length;i++){const item=fixedColumn[i];if(isMach){fixedLeftRemainWidth+=item.renderWidth;}else{isMach=item.id===resizeColumn.id;if(!isMach){fixedRightRemainWidth+=item.renderWidth;}}}}// 处理拖动事件
|
|
8066
|
-
const updateEvent=evnt=>{evnt.stopPropagation();evnt.preventDefault();const tableHeight=tableEl.clientHeight;const offsetX=evnt.clientX-dragClientX;let left=dragPosLeft+offsetX;if(isLeftFixed){if(rightContainerRect){left=Math.min(left,rightContainerRect.x-tableRect.x-fixedLeftRemainWidth-minInterval);}}else if(isRightFixed){if(leftContainerElem){left=Math.max(left,leftContainerElem.clientWidth+fixedRightRemainWidth+minInterval);}left=Math.min(left,dragMaxLeft);}dragLeft=Math.max(left,dragMinLeft)
|
|
8117
|
+
const updateEvent=evnt=>{evnt.stopPropagation();evnt.preventDefault();const tableHeight=tableEl.clientHeight;const offsetX=evnt.clientX-dragClientX;let left=dragPosLeft+offsetX;if(isLeftFixed){if(rightContainerRect){left=Math.min(left,rightContainerRect.x-tableRect.x-fixedLeftRemainWidth-minInterval);}}else if(isRightFixed){if(leftContainerElem){left=Math.max(left,leftContainerElem.clientWidth+fixedRightRemainWidth+minInterval);}left=Math.min(left,dragMaxLeft);}dragLeft=Math.max(left,dragMinLeft);// 最大宽
|
|
8118
|
+
if(maxInterval>1){dragLeft=Math.min(dragLeft,maxInterval+dragMinLeft-minInterval);}const resizeBarLeft=Math.max(1,dragLeft);resizeBarElem.style.left=`${resizeBarLeft}px`;resizeBarElem.style.top=`${scrollbarXToTop?osbHeight:0}px`;resizeBarElem.style.height=`${scrollbarXToTop?tableHeight-osbHeight:tableHeight}px`;if(resizableOpts.showDragTip&&resizeTipElem){resizeTipElem.textContent=methods_getI18n('vxe.table.resizeColTip',[Math.floor(resizeColumn.renderWidth+(isRightFixed?dragPosLeft-dragLeft:dragLeft-dragPosLeft))]);const tableWrapperWidth=tableEl.clientWidth;const resizeBarWidth=resizeBarElem.clientWidth;const resizeTipWidth=resizeTipElem.clientWidth;const resizeTipHeight=resizeTipElem.clientHeight;let resizeTipLeft=-resizeTipWidth;if(resizeBarLeft<resizeTipWidth+resizeBarWidth){resizeTipLeft=0;}else if(resizeBarLeft>tableWrapperWidth){resizeTipLeft+=tableWrapperWidth-resizeBarLeft;}resizeTipElem.style.left=`${resizeTipLeft}px`;resizeTipElem.style.top=`${Math.min(tableHeight-resizeTipHeight,Math.max(0,evnt.clientY-tableRect.y-resizeTipHeight/2))}px`;}reactData.isDragResize=true;};reactData.isDragResize=true;addClass(tableEl,'col-drag--resize');resizeBarElem.style.display='block';document.onmousemove=updateEvent;document.onmouseup=function(evnt){document.onmousemove=null;document.onmouseup=null;resizeBarElem.style.display='none';internalData._lastResizeTime=Date.now();setTimeout(()=>{reactData.isDragResize=false;},50);const resizeWidth=resizeColumn.renderWidth+(isRightFixed?dragPosLeft-dragLeft:dragLeft-dragPosLeft);const resizeParams={...params,resizeWidth,resizeColumn};if(resizableOpts.dragMode==='fixed'){visibleColumn.forEach(item=>{if(item.id!==resizeColumn.id){if(!item.resizeWidth){item.resizeWidth=item.renderWidth;}}});}if($xeTable.handleColResizeCellAreaEvent){$xeTable.handleColResizeCellAreaEvent(evnt,resizeParams);}else{resizeColumn.resizeWidth=resizeWidth;handleUpdateColResize($xeTable,evnt,resizeParams);}removeClass(tableEl,'col-drag--resize');};updateEvent(evnt);if($xeTable.closeMenu){$xeTable.closeMenu();}},handleColResizeDblclickEvent(evnt,params){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const resizableOpts=$xeTable.computeResizableOpts;const{isDblclickAutoWidth}=resizableOpts;const el=$xeTable.$refs.refElem;if(isDblclickAutoWidth&&el){evnt.stopPropagation();evnt.preventDefault();const{fullColumnIdData}=internalData;const{column}=params;let resizeColumn=column;if(column.children&&column.children.length){external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(column.children,childColumn=>{resizeColumn=childColumn;});}const colid=resizeColumn.id;const colRest=fullColumnIdData[colid];const dragBtnElem=evnt.target;const cell=dragBtnElem.parentNode;const cellParams=Object.assign(params,{cell,$table:$xeTable});const colMinWidth=getColReMinWidth(cellParams);const colMaxWidth=getColReMaxWidth(cellParams);el.setAttribute('data-calc-col','Y');let resizeWidth=calcColumnAutoWidth($xeTable,resizeColumn,el);el.removeAttribute('data-calc-col');if(colRest){resizeWidth=Math.max(resizeWidth,colRest.width);}resizeWidth=Math.max(colMinWidth,resizeWidth);if(colMaxWidth>1){resizeWidth=Math.min(colMaxWidth,resizeWidth);}const resizeParams={...params,resizeWidth,resizeColumn};reactData.isDragResize=false;internalData._lastResizeTime=Date.now();if($xeTable.handleColResizeDblclickCellAreaEvent){$xeTable.handleColResizeDblclickCellAreaEvent(evnt,resizeParams);}else{resizeColumn.resizeWidth=resizeWidth;handleUpdateColResize($xeTable,evnt,resizeParams);}}},handleRowResizeMousedownEvent(evnt,params){const $xeTable=this;const props=$xeTable;const reactData=$xeTable;const internalData=$xeTable;evnt.stopPropagation();evnt.preventDefault();const $xeGantt=$xeTable.$xeGantt;const{row}=params;const{showOverflow}=props;const{overflowX,scrollbarWidth,overflowY,scrollbarHeight}=reactData;const{elemStore,fullAllDataRowIdData}=internalData;const osbWidth=overflowY?scrollbarWidth:0;const osbHeight=overflowX?scrollbarHeight:0;const scrollbarYToLeft=$xeTable.computeScrollbarYToLeft;const resizableOpts=$xeTable.computeResizableOpts;const rowOpts=$xeTable.computeRowOpts;const cellOpts=$xeTable.computeCellOpts;let tableEl=$xeTable.$refs.refElem;if($xeGantt){const ganttContainerElem=$xeGantt.$refs.refGanttContainerElem;if(ganttContainerElem){tableEl=ganttContainerElem;}}const resizeBarElem=$xeTable.$refs.refRowResizeBar;if(!resizeBarElem){return;}const{clientY:dragClientY}=evnt;const resizeTipElem=resizeBarElem.firstElementChild;const dragBtnElem=evnt.currentTarget;const tdEl=dragBtnElem.parentNode;const trEl=tdEl.parentNode;const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);if(!bodyScrollElem){return;}const rowid=getRowid($xeTable,row);const rowRest=fullAllDataRowIdData[rowid];if(!rowRest){return;}const defaultRowHeight=$xeTable.computeDefaultRowHeight;let currCellHeight=rowRest.resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight;if(!showOverflow){currCellHeight=tdEl.clientHeight;}const tableRect=tableEl.getBoundingClientRect();const trRect=trEl.getBoundingClientRect();const targetOffsetY=dragClientY-trRect.y-trEl.clientHeight;let resizeHeight=currCellHeight;const cellEl=tdEl.querySelector('.vxe-cell');let cellMinHeight=0;if(cellEl){const cellStyle=getComputedStyle(cellEl);cellMinHeight=Math.max(1,Math.ceil(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellStyle.paddingTop)+external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(cellStyle.paddingBottom)));}const minTop=trRect.y-tableRect.y+cellMinHeight;// 处理拖动事件
|
|
8067
8119
|
const updateEvent=evnt=>{evnt.stopPropagation();evnt.preventDefault();const rtWidth=tableEl.clientWidth-osbWidth;const tableHeight=tableEl.clientHeight-osbHeight;let dragTop=evnt.clientY-tableRect.y-targetOffsetY;if(dragTop<minTop){dragTop=minTop;}else{resizeHeight=Math.max(cellMinHeight,currCellHeight+evnt.clientY-dragClientY);}resizeBarElem.style.left=`${scrollbarYToLeft?osbWidth:0}px`;resizeBarElem.style.top=`${dragTop}px`;resizeBarElem.style.width=`${rtWidth}px`;if(resizableOpts.showDragTip&&resizeTipElem){resizeTipElem.textContent=methods_getI18n('vxe.table.resizeRowTip',[resizeHeight]);const resizeTipWidth=resizeTipElem.clientWidth;const resizeTipHeight=resizeTipElem.clientHeight;let resizeBarLeft=Math.max(2,evnt.clientX-tableRect.x);let resizeBarTop=0;if(resizeBarLeft+resizeTipWidth>=rtWidth-2){resizeBarLeft=rtWidth-resizeTipWidth-2;}if(dragTop+resizeTipHeight>=tableHeight){resizeBarTop=tableHeight-(dragTop+resizeTipHeight);}resizeTipElem.style.left=`${resizeBarLeft}px`;resizeTipElem.style.top=`${resizeBarTop}px`;}reactData.isDragResize=true;};reactData.isDragResize=true;addClass(tableEl,'row-drag--resize');resizeBarElem.style.display='block';document.onmousemove=updateEvent;document.onmouseup=function(evnt){document.onmousemove=null;document.onmouseup=null;resizeBarElem.style.display='none';internalData._lastResizeTime=Date.now();setTimeout(()=>{reactData.isDragResize=false;},50);if(resizeHeight!==currCellHeight){const resizeParams={...params,resizeHeight,resizeRow:row};internalData.isResizeCellHeight=true;if($xeTable.handleRowResizeCellAreaEvent){$xeTable.handleRowResizeCellAreaEvent(evnt,resizeParams);}else{rowRest.resizeHeight=resizeHeight;handleUpdateRowResize($xeTable,evnt,resizeParams);updateRowOffsetTop($xeTable);}}removeClass(tableEl,'row-drag--resize');};updateEvent(evnt);},handleRowResizeDblclickEvent(evnt,params){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const resizableOpts=$xeTable.computeResizableOpts;const{isDblclickAutoHeight}=resizableOpts;const el=$xeTable.$refs.refElem;if(isDblclickAutoHeight&&el){evnt.stopPropagation();evnt.preventDefault();const{editStore}=reactData;const{fullAllDataRowIdData}=internalData;const{actived}=editStore;const{row}=params;const rowid=getRowid($xeTable,row);const rowRest=fullAllDataRowIdData[rowid];if(!rowRest){return;}const handleRsHeight=()=>{el.setAttribute('data-calc-row','Y');const resizeHeight=calcCellAutoHeight($xeTable,rowRest,el);el.removeAttribute('data-calc-row');const resizeParams={...params,resizeHeight,resizeRow:row};reactData.isDragResize=false;internalData._lastResizeTime=Date.now();if($xeTable.handleRowResizeDblclickCellAreaEvent){$xeTable.handleRowResizeDblclickCellAreaEvent(evnt,resizeParams);}else{rowRest.resizeHeight=resizeHeight;handleUpdateRowResize($xeTable,evnt,resizeParams);}};if(actived.row||actived.column){$xeTable.clearEdit().then(handleRsHeight);}else{handleRsHeight();}}},setRowHeightConf(heightConf){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const{fullAllDataRowIdData}=internalData;let status=false;if(heightConf){external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().each(heightConf,(height,rowid)=>{const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const rHeight=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(height);if(rHeight){rowRest.resizeHeight=rHeight;if(!status){status=true;}}}});if(status){internalData.isResizeCellHeight=true;reactData.resizeHeightFlag++;}}return $xeTable.$nextTick().then(()=>{updateRowOffsetTop($xeTable);return{status};});},getRowHeightConf(isFull){const $xeTable=this;const internalData=$xeTable;const{fullAllDataRowIdData,afterFullData}=internalData;const{handleGetRowId}=createHandleGetRowId($xeTable);const rowOpts=$xeTable.computeRowOpts;const cellOpts=$xeTable.computeCellOpts;const defaultRowHeight=$xeTable.computeDefaultRowHeight;const rest={};afterFullData.forEach(row=>{const rowid=handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){const resizeHeight=rowRest.resizeHeight;if(resizeHeight||isFull){const currCellHeight=resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight;rest[rowid]=currCellHeight;}}});return rest;},recalcRowHeight(rowOrId){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const{fullAllDataRowIdData}=internalData;const rows=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rowOrId)?rowOrId:[rowOrId];const el=$xeTable.$refs.refElem;if(el){const{handleGetRowId}=createHandleGetRowId($xeTable);el.setAttribute('data-calc-row','Y');rows.forEach(row=>{const rowid=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(row)||external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(row)?row:handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){rowRest.resizeHeight=calcCellAutoHeight($xeTable,rowRest,el);}el.removeAttribute('data-calc-row');});reactData.calcCellHeightFlag++;}return $xeTable.$nextTick();},setRowHeight(rowOrId,height){const $xeTable=this;const reactData=$xeTable;const internalData=$xeTable;const{fullAllDataRowIdData}=internalData;let status=false;const rows=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isArray(rowOrId)?rowOrId:[rowOrId];let rHeight=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(height);if(isScale(height)){const tableBody=$xeTable.$refs.refTableBody;const bodyElem=tableBody?tableBody.$el:null;const bodyHeight=bodyElem?bodyElem.clientHeight-1:0;rHeight=Math.floor(rHeight*bodyHeight);}if(rHeight){const{handleGetRowId}=createHandleGetRowId($xeTable);rows.forEach(row=>{const rowid=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(row)||external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(row)?row:handleGetRowId(row);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){rowRest.resizeHeight=rHeight;if(!status){status=true;}}});if(status){internalData.isResizeCellHeight=true;reactData.resizeHeightFlag++;}}return $xeTable.$nextTick();},getRowHeight(rowOrId){const $xeTable=this;const internalData=$xeTable;const{fullAllDataRowIdData}=internalData;const rowOpts=$xeTable.computeRowOpts;const cellOpts=$xeTable.computeCellOpts;const defaultRowHeight=$xeTable.computeDefaultRowHeight;const rowid=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isString(rowOrId)||external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isNumber(rowOrId)?rowOrId:getRowid($xeTable,rowOrId);const rowRest=fullAllDataRowIdData[rowid];if(rowRest){return rowRest.resizeHeight||cellOpts.height||rowOpts.height||rowRest.height||defaultRowHeight;}return 0;},/**
|
|
8068
8120
|
* 刷新滚动操作,手动同步滚动相关位置(对于某些特殊的操作,比如滚动条错位、固定列不同步)
|
|
8069
8121
|
*/refreshScroll(){const $xeTable=this;const internalData=$xeTable;const{elemStore,lastScrollLeft,lastScrollTop}=internalData;const headerScrollElem=getRefElem(elemStore['main-header-scroll']);const bodyScrollElem=getRefElem(elemStore['main-body-scroll']);const footerScrollElem=getRefElem(elemStore['main-footer-scroll']);const leftScrollElem=getRefElem(elemStore['left-body-scroll']);const rightScrollElem=getRefElem(elemStore['right-body-scroll']);const xHandleEl=$xeTable.$refs.refScrollXHandleElem;const yHandleEl=$xeTable.$refs.refScrollYHandleElem;return new Promise(resolve=>{// 还原滚动条位置
|