vxe-table 4.19.5 → 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 +102 -17
- package/dist/style.css +1 -1
- package/es/style.css +1 -1
- package/es/table/src/emits.js +1 -0
- package/es/table/src/table.js +58 -12
- package/es/table/src/util.js +27 -8
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +49 -24
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +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 +14 -11
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +30 -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/src/emits.ts +1 -0
- package/packages/table/src/table.ts +62 -13
- package/packages/table/src/util.ts +26 -8
- /package/es/{iconfont.1780200147870.ttf → iconfont.1780293024194.ttf} +0 -0
- /package/es/{iconfont.1780200147870.woff → iconfont.1780293024194.woff} +0 -0
- /package/es/{iconfont.1780200147870.woff2 → iconfont.1780293024194.woff2} +0 -0
- /package/lib/{iconfont.1780200147870.ttf → iconfont.1780293024194.ttf} +0 -0
- /package/lib/{iconfont.1780200147870.woff → iconfont.1780293024194.woff} +0 -0
- /package/lib/{iconfont.1780200147870.woff2 → iconfont.1780293024194.woff2} +0 -0
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;
|
|
@@ -9398,6 +9435,7 @@ export default defineVxeComponent({
|
|
|
9398
9435
|
const dragBtnOffsetWidth = XEUtils.floor(dragBtnWidth / 2);
|
|
9399
9436
|
const dragPosLeft = dragBtnRect.x - tableRect.x + dragBtnOffsetWidth;
|
|
9400
9437
|
const minInterval = getColReMinWidth(cellParams) - dragBtnOffsetWidth; // 列之间的最小间距
|
|
9438
|
+
const maxInterval = getColReMaxWidth(cellParams); // 列之间的最大间距
|
|
9401
9439
|
const dragMinLeft = isRightFixed ? 0 : (cellRect.x - tableRect.x + dragBtnWidth + minInterval);
|
|
9402
9440
|
const dragMaxLeft = cellRect.x - tableRect.x + cell.clientWidth - minInterval;
|
|
9403
9441
|
let fixedLeftRemainWidth = 0;
|
|
@@ -9437,6 +9475,10 @@ export default defineVxeComponent({
|
|
|
9437
9475
|
left = Math.min(left, dragMaxLeft);
|
|
9438
9476
|
}
|
|
9439
9477
|
dragLeft = Math.max(left, dragMinLeft);
|
|
9478
|
+
// 最大宽
|
|
9479
|
+
if (maxInterval > 1) {
|
|
9480
|
+
dragLeft = Math.min(dragLeft, maxInterval + dragMinLeft - minInterval);
|
|
9481
|
+
}
|
|
9440
9482
|
const resizeBarLeft = Math.max(1, dragLeft);
|
|
9441
9483
|
resizeBarElem.style.left = `${resizeBarLeft}px`;
|
|
9442
9484
|
resizeBarElem.style.top = `${scrollbarXToTop ? osbHeight : 0}px`;
|
|
@@ -9517,6 +9559,7 @@ export default defineVxeComponent({
|
|
|
9517
9559
|
const cell = dragBtnElem.parentNode;
|
|
9518
9560
|
const cellParams = Object.assign(params, { cell, $table: $xeTable });
|
|
9519
9561
|
const colMinWidth = getColReMinWidth(cellParams);
|
|
9562
|
+
const colMaxWidth = getColReMaxWidth(cellParams);
|
|
9520
9563
|
el.setAttribute('data-calc-col', 'Y');
|
|
9521
9564
|
let resizeWidth = calcColumnAutoWidth(resizeColumn, el);
|
|
9522
9565
|
el.removeAttribute('data-calc-col');
|
|
@@ -9524,6 +9567,9 @@ export default defineVxeComponent({
|
|
|
9524
9567
|
resizeWidth = Math.max(resizeWidth, colRest.width);
|
|
9525
9568
|
}
|
|
9526
9569
|
resizeWidth = Math.max(colMinWidth, resizeWidth);
|
|
9570
|
+
if (colMaxWidth > 1) {
|
|
9571
|
+
resizeWidth = Math.min(colMaxWidth, resizeWidth);
|
|
9572
|
+
}
|
|
9527
9573
|
const resizeParams = Object.assign(Object.assign({}, params), { resizeWidth, resizeColumn });
|
|
9528
9574
|
reactData.isDragResize = false;
|
|
9529
9575
|
internalData._lastResizeTime = Date.now();
|
package/es/table/src/util.js
CHANGED
|
@@ -683,14 +683,16 @@ export function getCalcHeight(height) {
|
|
|
683
683
|
}
|
|
684
684
|
/**
|
|
685
685
|
* 列宽拖动最大宽度
|
|
686
|
-
* @param params
|
|
687
|
-
* @returns
|
|
688
686
|
*/
|
|
689
687
|
export function getColReMaxWidth(params) {
|
|
690
|
-
const { $table } = params;
|
|
691
|
-
const
|
|
688
|
+
const { $table, column, cell } = params;
|
|
689
|
+
const internalData = $table.internalData;
|
|
690
|
+
const { elemStore } = internalData;
|
|
691
|
+
const { computeColumnOpts, computeResizableOpts } = $table.getComputeMaps();
|
|
692
692
|
const resizableOpts = computeResizableOpts.value;
|
|
693
|
+
const columnOpts = computeColumnOpts.value;
|
|
693
694
|
const { maxWidth: reMaxWidth } = resizableOpts;
|
|
695
|
+
const colMaxWidth = column.maxWidth || columnOpts.maxWidth;
|
|
694
696
|
// 如果自定义调整宽度逻辑
|
|
695
697
|
if (reMaxWidth) {
|
|
696
698
|
const customMaxWidth = XEUtils.isFunction(reMaxWidth) ? reMaxWidth(params) : reMaxWidth;
|
|
@@ -698,19 +700,35 @@ export function getColReMaxWidth(params) {
|
|
|
698
700
|
return Math.max(1, XEUtils.toNumber(customMaxWidth));
|
|
699
701
|
}
|
|
700
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
|
+
}
|
|
701
720
|
return -1;
|
|
702
721
|
}
|
|
703
722
|
/**
|
|
704
723
|
* 列宽拖动最小宽度
|
|
705
|
-
* @param params
|
|
706
|
-
* @returns
|
|
707
724
|
*/
|
|
708
725
|
export function getColReMinWidth(params) {
|
|
709
726
|
const { $table, column, cell } = params;
|
|
710
727
|
const tableProps = $table.props;
|
|
711
728
|
const internalData = $table.internalData;
|
|
712
|
-
const { computeResizableOpts } = $table.getComputeMaps();
|
|
729
|
+
const { computeColumnOpts, computeResizableOpts } = $table.getComputeMaps();
|
|
713
730
|
const resizableOpts = computeResizableOpts.value;
|
|
731
|
+
const columnOpts = computeColumnOpts.value;
|
|
714
732
|
const { minWidth: reMinWidth } = resizableOpts;
|
|
715
733
|
// 如果自定义调整宽度逻辑
|
|
716
734
|
if (reMinWidth) {
|
|
@@ -721,7 +739,8 @@ export function getColReMinWidth(params) {
|
|
|
721
739
|
}
|
|
722
740
|
const { elemStore } = internalData;
|
|
723
741
|
const { showHeaderOverflow: allColumnHeaderOverflow } = tableProps;
|
|
724
|
-
const { showHeaderOverflow
|
|
742
|
+
const { showHeaderOverflow } = column;
|
|
743
|
+
const colMinWidth = column.minWidth || columnOpts.minWidth;
|
|
725
744
|
const headOverflow = XEUtils.isUndefined(showHeaderOverflow) || XEUtils.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
726
745
|
const showEllipsis = headOverflow === 'ellipsis';
|
|
727
746
|
const showTitle = headOverflow === 'title';
|
package/es/ui/index.js
CHANGED
package/es/ui/src/log.js
CHANGED
package/lib/index.umd.js
CHANGED
|
@@ -3314,7 +3314,7 @@ function getDefaultConfig(val1, def1) {
|
|
|
3314
3314
|
/* unused harmony import specifier */ var VxeUI;
|
|
3315
3315
|
|
|
3316
3316
|
|
|
3317
|
-
const version = "4.19.
|
|
3317
|
+
const version = "4.19.6";
|
|
3318
3318
|
core_.VxeUI.version = version;
|
|
3319
3319
|
core_.VxeUI.tableVersion = version;
|
|
3320
3320
|
core_.VxeUI.setConfig({
|
|
@@ -3848,7 +3848,7 @@ var es_iterator_some = __webpack_require__(3579);
|
|
|
3848
3848
|
const {
|
|
3849
3849
|
log: log_log
|
|
3850
3850
|
} = core_.VxeUI;
|
|
3851
|
-
const log_version = `table v${"4.19.
|
|
3851
|
+
const log_version = `table v${"4.19.6"}`;
|
|
3852
3852
|
const warnLog = log_log.create('warn', log_version);
|
|
3853
3853
|
const errLog = log_log.create('error', log_version);
|
|
3854
3854
|
;// ./packages/table/src/columnInfo.ts
|
|
@@ -4330,7 +4330,6 @@ function wheelScrollTopTo(diffNum, cb) {
|
|
|
4330
4330
|
});
|
|
4331
4331
|
}
|
|
4332
4332
|
;// ./packages/table/src/util.ts
|
|
4333
|
-
/* unused harmony import specifier */ var util_XEUtils;
|
|
4334
4333
|
|
|
4335
4334
|
|
|
4336
4335
|
|
|
@@ -5055,33 +5054,54 @@ function getCalcHeight(height) {
|
|
|
5055
5054
|
}
|
|
5056
5055
|
/**
|
|
5057
5056
|
* 列宽拖动最大宽度
|
|
5058
|
-
* @param params
|
|
5059
|
-
* @returns
|
|
5060
5057
|
*/
|
|
5061
5058
|
function getColReMaxWidth(params) {
|
|
5062
5059
|
const {
|
|
5063
|
-
$table
|
|
5060
|
+
$table,
|
|
5061
|
+
column,
|
|
5062
|
+
cell
|
|
5064
5063
|
} = params;
|
|
5064
|
+
const internalData = $table.internalData;
|
|
5065
5065
|
const {
|
|
5066
|
+
elemStore
|
|
5067
|
+
} = internalData;
|
|
5068
|
+
const {
|
|
5069
|
+
computeColumnOpts,
|
|
5066
5070
|
computeResizableOpts
|
|
5067
5071
|
} = $table.getComputeMaps();
|
|
5068
5072
|
const resizableOpts = computeResizableOpts.value;
|
|
5073
|
+
const columnOpts = computeColumnOpts.value;
|
|
5069
5074
|
const {
|
|
5070
5075
|
maxWidth: reMaxWidth
|
|
5071
5076
|
} = resizableOpts;
|
|
5077
|
+
const colMaxWidth = column.maxWidth || columnOpts.maxWidth;
|
|
5072
5078
|
// 如果自定义调整宽度逻辑
|
|
5073
5079
|
if (reMaxWidth) {
|
|
5074
|
-
const customMaxWidth =
|
|
5080
|
+
const customMaxWidth = external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().isFunction(reMaxWidth) ? reMaxWidth(params) : reMaxWidth;
|
|
5075
5081
|
if (customMaxWidth !== 'auto') {
|
|
5076
|
-
return Math.max(1,
|
|
5082
|
+
return Math.max(1, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toNumber(customMaxWidth));
|
|
5083
|
+
}
|
|
5084
|
+
}
|
|
5085
|
+
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);
|
|
5086
|
+
const paddingLeftRight = getPaddingLeftRightSize(cell) + getPaddingLeftRightSize(queryElement(cell, '.vxe-cell'));
|
|
5087
|
+
const mWidth = minTitleWidth + paddingLeftRight;
|
|
5088
|
+
// 如果设置最小宽
|
|
5089
|
+
if (colMaxWidth) {
|
|
5090
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll']);
|
|
5091
|
+
if (bodyScrollElem) {
|
|
5092
|
+
if (isScale(colMaxWidth)) {
|
|
5093
|
+
const bodyWidth = bodyScrollElem.clientWidth - 1;
|
|
5094
|
+
const meanWidth = bodyWidth / 100;
|
|
5095
|
+
return Math.max(mWidth, Math.floor(external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(colMaxWidth) * meanWidth));
|
|
5096
|
+
} else if (isPx(colMaxWidth)) {
|
|
5097
|
+
return Math.max(mWidth, external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(colMaxWidth));
|
|
5098
|
+
}
|
|
5077
5099
|
}
|
|
5078
5100
|
}
|
|
5079
5101
|
return -1;
|
|
5080
5102
|
}
|
|
5081
5103
|
/**
|
|
5082
5104
|
* 列宽拖动最小宽度
|
|
5083
|
-
* @param params
|
|
5084
|
-
* @returns
|
|
5085
5105
|
*/
|
|
5086
5106
|
function getColReMinWidth(params) {
|
|
5087
5107
|
const {
|
|
@@ -5092,9 +5112,11 @@ function getColReMinWidth(params) {
|
|
|
5092
5112
|
const tableProps = $table.props;
|
|
5093
5113
|
const internalData = $table.internalData;
|
|
5094
5114
|
const {
|
|
5115
|
+
computeColumnOpts,
|
|
5095
5116
|
computeResizableOpts
|
|
5096
5117
|
} = $table.getComputeMaps();
|
|
5097
5118
|
const resizableOpts = computeResizableOpts.value;
|
|
5119
|
+
const columnOpts = computeColumnOpts.value;
|
|
5098
5120
|
const {
|
|
5099
5121
|
minWidth: reMinWidth
|
|
5100
5122
|
} = resizableOpts;
|
|
@@ -5112,9 +5134,9 @@ function getColReMinWidth(params) {
|
|
|
5112
5134
|
showHeaderOverflow: allColumnHeaderOverflow
|
|
5113
5135
|
} = tableProps;
|
|
5114
5136
|
const {
|
|
5115
|
-
showHeaderOverflow
|
|
5116
|
-
minWidth: colMinWidth
|
|
5137
|
+
showHeaderOverflow
|
|
5117
5138
|
} = column;
|
|
5139
|
+
const colMinWidth = column.minWidth || columnOpts.minWidth;
|
|
5118
5140
|
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;
|
|
5119
5141
|
const showEllipsis = headOverflow === 'ellipsis';
|
|
5120
5142
|
const showTitle = headOverflow === 'title';
|
|
@@ -7681,7 +7703,7 @@ const gridProps = {
|
|
|
7681
7703
|
}
|
|
7682
7704
|
};
|
|
7683
7705
|
;// ./packages/table/src/emits.ts
|
|
7684
|
-
const tableEmits = ['ready', 'init-rendered', 'data-rendered', 'update:data', 'keydown-start', 'keydown', 'keydown-end', 'paste', 'copy', 'cut', 'undo', 'redo', 'context-menu', 'columns-change', 'data-change', 'footer-data-change', 'current-change', 'current-row-change', 'current-row-disabled', 'current-column-change', 'current-column-disabled', 'radio-change', 'checkbox-change', 'checkbox-all', 'checkbox-range-start', 'checkbox-range-change', 'checkbox-range-end', 'checkbox-range-select', 'cell-click', 'cell-dblclick', 'cell-menu', 'cell-mouseenter', 'cell-mouseleave', 'cell-selected', 'cell-delete-value', 'cell-backspace-value', 'header-cell-click', 'header-cell-dblclick', 'header-cell-menu', 'footer-cell-click', 'footer-cell-dblclick', 'footer-cell-menu', 'clear-merge', 'sort-change', 'clear-sort', 'clear-all-sort', 'filter-change', 'filter-visible', 'clear-filter', 'clear-all-filter', 'resizable-change', 'column-resizable-change', 'row-resizable-change', 'toggle-row-group-expand', 'toggle-row-expand', 'toggle-tree-expand', 'menu-click', 'edit-closed', 'row-dragstart', 'row-dragover', 'row-dragend', 'row-remove-dragend', 'row-insert-dragend', 'column-dragstart', 'column-dragover', 'column-dragend', 'enter-append-row', 'tab-append-row', 'edit-actived', 'edit-activated', 'edit-disabled', 'valid-error', 'scroll', 'scroll-boundary', 'custom', 'custom-visible-change', 'custom-visible-all', 'custom-fixed-change', 'custom-sort-change', 'change-fnr', 'open-fnr', 'show-fnr', 'hide-fnr', 'fnr-change', 'fnr-find', 'fnr-find-all', 'fnr-replace', 'fnr-replace-all', 'cell-area-copy', 'cell-area-cut', 'cell-area-paste', 'cell-area-merge', 'clear-cell-area-selection', 'clear-cell-area-merge', 'header-cell-area-selection', 'cell-area-selection-invalid', 'cell-area-selection-start', 'cell-area-selection-drag', 'cell-area-selection-end', 'cell-area-extension-start', 'cell-area-extension-drag', 'cell-area-extension-end', 'cell-area-extension-fill', 'cell-area-selection-all-start', 'cell-area-selection-all-end', 'cell-area-arrows-start', 'cell-area-arrows-end', 'active-cell-change-start', 'active-cell-change-end'];
|
|
7706
|
+
const tableEmits = ['ready', 'init-rendered', 'data-rendered', 'update:data', 'keydown-start', 'keydown', 'keydown-end', 'paste', 'copy', 'cut', 'undo', 'redo', 'context-menu', 'columns-change', 'data-change', 'footer-data-change', 'current-change', 'current-row-change', 'current-row-disabled', 'current-column-change', 'current-column-disabled', 'radio-change', 'checkbox-change', 'checkbox-all', 'checkbox-range-start', 'checkbox-range-change', 'checkbox-range-end', 'checkbox-range-select', 'cell-click', 'cell-dblclick', 'cell-menu', 'cell-mouseenter', 'cell-mouseleave', 'cell-selected', 'cell-delete-value', 'cell-backspace-value', 'header-cell-click', 'header-cell-dblclick', 'header-cell-menu', 'footer-cell-click', 'footer-cell-dblclick', 'footer-cell-menu', 'clear-merge', 'sort-change', 'clear-sort', 'clear-all-sort', 'filter-change', 'filter-visible', 'clear-filter', 'clear-all-filter', 'resizable-change', 'column-resizable-change', 'row-resizable-change', 'toggle-row-group-expand', 'toggle-row-expand', 'toggle-tree-expand', 'menu-click', 'edit-closed', 'row-dragstart', 'row-dragover', 'row-dragend', 'row-remove-dragend', 'row-insert-dragend', 'column-dragstart', 'column-dragover', 'column-dragend', 'enter-append-row', 'tab-append-row', 'edit-actived', 'edit-activated', 'edit-disabled', 'valid-error', 'scroll', 'scroll-boundary', 'custom', 'custom-visible-change', 'custom-visible-all', 'custom-fixed-change', 'custom-sort-change', 'change-fnr', 'open-fnr', 'show-fnr', 'hide-fnr', 'fnr-change', 'fnr-find', 'fnr-find-all', 'fnr-replace', 'fnr-replace-all', 'cell-area-copy', 'cell-area-cut', 'cell-area-paste', 'cell-area-merge', 'clear-cell-area-selection', 'clear-cell-area-merge', 'header-cell-area-selection', 'cell-area-selection-invalid', 'cell-area-selection-start', 'cell-area-selection-drag', 'cell-area-selection-end', 'cell-area-extension-start', 'cell-area-extension-drag', 'cell-area-extension-end', 'cell-area-extension-fill', 'cell-area-selection-all-start', 'cell-area-selection-all-end', 'cell-area-arrows-start', 'cell-area-arrows-end', 'cell-area-fill-copy', 'active-cell-change-start', 'active-cell-change-end'];
|
|
7685
7707
|
;// ./packages/grid/src/emits.ts
|
|
7686
7708
|
|
|
7687
7709
|
const gridEmits = [...tableEmits, 'page-change', 'form-submit', 'form-submit-invalid', 'form-reset', 'form-collapse', 'form-toggle-collapse', 'proxy-query', 'proxy-delete', 'proxy-save', 'toolbar-button-click', 'toolbar-tool-click', 'zoom'];
|
|
@@ -20323,19 +20345,20 @@ if(reactData.scrollYLoad&&!(internalData.customHeight||internalData.customMinHei
|
|
|
20323
20345
|
* 支持动态列表调整分配
|
|
20324
20346
|
* 支持自动分配偏移量
|
|
20325
20347
|
* 支持 width=60 width=60px width=10% min-width=60 min-width=60px min-width=10%
|
|
20326
|
-
*/const autoCellWidth=()=>{const{elemStore}=internalData;const bodyWrapperElem=getRefElem(elemStore['main-body-wrapper']);if(!bodyWrapperElem){return;}const yHandleEl=refScrollYHandleElem.value;if(!yHandleEl){return;}const xHandleEl=refScrollXHandleElem.value;if(!xHandleEl){return;}let tWidth=0;const minCellWidth=40;// 列宽最少限制 40px
|
|
20327
|
-
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;// 最小宽
|
|
20328
|
-
pxMinList.forEach(column=>{
|
|
20329
|
-
autoMinList.forEach(column=>{
|
|
20330
|
-
scaleMinList.forEach(column=>{
|
|
20331
|
-
scaleList.forEach(column=>{
|
|
20332
|
-
pxList.forEach(column=>{
|
|
20333
|
-
autoList.forEach(column=>{
|
|
20334
|
-
resizeList.forEach(column=>{const reWidth=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.resizeWidth);tWidth+=reWidth;column.renderWidth=reWidth;});remainWidth-=tWidth;meanWidth=remainWidth>0?Math.floor(remainWidth/(
|
|
20348
|
+
*/const autoCellWidth=()=>{const{elemStore}=internalData;const bodyWrapperElem=getRefElem(elemStore['main-body-wrapper']);if(!bodyWrapperElem){return;}const yHandleEl=refScrollYHandleElem.value;if(!yHandleEl){return;}const xHandleEl=refScrollXHandleElem.value;if(!xHandleEl){return;}const columnOpts=computeColumnOpts.value;let tWidth=0;const minCellWidth=40;// 列宽最少限制 40px
|
|
20349
|
+
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;};// 最小宽
|
|
20350
|
+
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;});// 最小自适应
|
|
20351
|
+
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;});// 最小百分比
|
|
20352
|
+
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;});// 固定百分比
|
|
20353
|
+
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;});// 固定宽
|
|
20354
|
+
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;});// 自适应宽
|
|
20355
|
+
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;});// 调整了列宽
|
|
20356
|
+
resizeList.forEach(column=>{const reWidth=external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().toInteger(column.resizeWidth);tWidth+=reWidth;column.renderWidth=reWidth;});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;}// 剩余均分
|
|
20335
20357
|
remainList.forEach(column=>{const width=Math.max(meanWidth,minCellWidth);column.renderWidth=width;tWidth+=width;});if(fit){/**
|
|
20336
20358
|
* 偏移量算法
|
|
20337
20359
|
* 如果所有列足够放的情况下,从最后动态列开始分配
|
|
20338
|
-
|
|
20360
|
+
* 排除已设置 max-width
|
|
20361
|
+
*/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();updateHeight();};/**
|
|
20339
20362
|
* 计算自适应行高
|
|
20340
20363
|
*/const calcCellAutoHeight=(rowRest,wrapperEl)=>{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;};/**
|
|
20341
20364
|
* 自适应行高
|
|
@@ -20967,8 +20990,10 @@ if(selectCheckboxMaps[rowid]){selectCheckboxMaps[rowid]=row;}if(rowExpandedMaps[
|
|
|
20967
20990
|
if(treeConfig){const childrenField=treeOpts.children||treeOpts.childrenField;external_root_XEUtils_commonjs_xe_utils_commonjs2_xe_utils_amd_xe_utils_default().eachTree(sourceData,handleSourceRow,{children:treeOpts.transform?treeOpts.mapChildrenField:childrenField});}else{sourceData.forEach(handleSourceRow);}internalData.sourceDataRowIdData=sourceRowIdData;internalData.tableSourceData=sourceData;},/**
|
|
20968
20991
|
* 指定列宽的列进行拆分
|
|
20969
20992
|
*/analyColumnWidth(){const{tableFullColumn}=internalData;const columnOpts=computeColumnOpts.value;const{width:defaultWidth,minWidth:defaultMinWidth}=columnOpts;const resizeList=[];const pxList=[];const pxMinList=[];const autoMinList=[];const scaleList=[];const scaleMinList=[];const autoList=[];const remainList=[];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(reactData.columnStore,{resizeList,pxList,pxMinList,autoMinList,scaleList,scaleMinList,autoList,remainList});},handleColResizeMousedownEvent(evnt,fixedType,params){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=computeResizableOpts.value;const osbHeight=overflowX?scrollbarHeight:0;const tableEl=refElem.value;const leftContainerElem=refLeftContainer.value;const rightContainerElem=refRightContainer.value;const resizeBarElem=refColResizeBar.value;if(!resizeBarElem){return;}const isLeftFixed=fixedType==='left';const isRightFixed=fixedType==='right';const resizeTipElem=resizeBarElem.firstElementChild;const scrollbarXToTop=computeScrollbarXToTop.value;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;// 列之间的最小间距
|
|
20993
|
+
const maxInterval=getColReMaxWidth(cellParams);// 列之间的最大间距
|
|
20970
20994
|
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;}}}}// 处理拖动事件
|
|
20971
|
-
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)
|
|
20995
|
+
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);// 最大宽
|
|
20996
|
+
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=table_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(evnt,resizeParams);}removeClass(tableEl,'col-drag--resize');};updateEvent(evnt);if($xeTable.closeMenu){$xeTable.closeMenu();}},handleColResizeDblclickEvent(evnt,params){const resizableOpts=computeResizableOpts.value;const{isDblclickAutoWidth}=resizableOpts;const el=refElem.value;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(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(evnt,resizeParams);}}},handleRowResizeMousedownEvent(evnt,params){evnt.stopPropagation();evnt.preventDefault();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=computeScrollbarYToLeft.value;const resizableOpts=computeResizableOpts.value;const rowOpts=computeRowOpts.value;const cellOpts=computeCellOpts.value;let tableEl=refElem.value;if($xeGantt){const{refGanttContainerElem}=$xeGantt.getRefMaps();const ganttContainerElem=refGanttContainerElem.value;if(ganttContainerElem){tableEl=ganttContainerElem;}}const resizeBarElem=refRowResizeBar.value;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=computeDefaultRowHeight.value;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;// 处理拖动事件
|
|
20972
20997
|
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=table_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(evnt,resizeParams);updateRowOffsetTop();}}removeClass(tableEl,'row-drag--resize');};updateEvent(evnt);},handleRowResizeDblclickEvent(evnt,params){const resizableOpts=computeResizableOpts.value;const{isDblclickAutoHeight}=resizableOpts;const el=refElem.value;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(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(evnt,resizeParams);}};if(actived.row||actived.column){$xeTable.clearEdit().then(handleRsHeight);}else{handleRsHeight();}}},saveCustomStore(type){const{customConfig}=props;const tableId=computeTableId.value;const customOpts=computeCustomOpts.value;const{updateStore,storage,storeOptions}=customOpts;const isAllCustom=storage===true;const storageOpts=Object.assign({},isAllCustom?{}:storage||{},storeOptions);const isCustomResizable=hangleStorageDefaultValue(storageOpts.resizable,isAllCustom);const isCustomVisible=hangleStorageDefaultValue(storageOpts.visible,isAllCustom);const isCustomFixed=hangleStorageDefaultValue(storageOpts.fixed,isAllCustom);const isCustomSort=hangleStorageDefaultValue(storageOpts.sort,isAllCustom);const isCustomAggGroup=hangleStorageDefaultValue(storageOpts.aggGroup,isAllCustom);const isCustomAggFunc=hangleStorageDefaultValue(storageOpts.aggFunc,isAllCustom);if(type!=='reset'){// fix:修复拖动列宽,重置按钮无法点击的问题
|
|
20973
20998
|
reactData.isCustomStatus=true;}if(storage&&(customConfig?isEnableConf(customOpts):customOpts.enabled)&&(isCustomResizable||isCustomVisible||isCustomFixed||isCustomSort||isCustomAggGroup||isCustomAggFunc)){if(!tableId){errLog('vxe.error.reqProp',['id']);return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();}const storeData=type==='reset'?{resizableData:{},sortData:[],visibleData:{},fixedData:{},aggGroupData:{},aggFuncData:{}}:$xeTable.getCustomStoreData();if(updateStore){return updateStore({$table:$xeTable,id:tableId,type,storeData});}else{setCustomStorageMap(tableId,type==='reset'?null:storeData);}}return (0,external_commonjs_vue_commonjs2_vue_root_Vue_.nextTick)();},handleCustom(){const{mouseConfig}=props;if(mouseConfig){if($xeTable.clearSelected){$xeTable.clearSelected();}if($xeTable.clearCellAreas){$xeTable.clearCellAreas();$xeTable.clearCopyCellArea();}}$xeTable.analyColumnWidth();return $xeTable.refreshColumn(true);},handleUpdateDataQueue(){reactData.upDataFlag++;},handleRefreshColumnQueue(){reactData.reColumnFlag++;},handleFilterOptions(column){if(column){const{filterStore}=reactData;const{filterRender,filters}=column;const filterOptions=filters||[];const compConf=isEnableConf(filterRender)?table_renderer.get(filterRender.name):null;const frMethod=column.filterRecoverMethod||(compConf?compConf.tableFilterRecoverMethod||compConf.filterRecoverMethod:null);filterStore.column=column;// 复原状态
|
|
20974
20999
|
filterOptions.forEach(option=>{const{_checked,checked}=option;option._checked=checked;if(!checked&&_checked!==checked){if(frMethod){frMethod({option,column,$table:$xeTable});}}});$xeTable.checkFilterOptions();}},preventEvent(evnt,type,args,next,end){let evntList=table_interceptor.get(type);// 兼容老版本
|