vxe-table 3.14.0-beta.8 → 3.14.0
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/grid/src/grid.js +75 -50
- package/es/locale/lang/ar-EG.js +7 -1
- package/es/locale/lang/de-DE.js +7 -1
- package/es/locale/lang/en-US.js +7 -1
- package/es/locale/lang/es-ES.js +7 -1
- package/es/locale/lang/fr-FR.js +7 -1
- package/es/locale/lang/hu-HU.js +7 -1
- package/es/locale/lang/hy-AM.js +7 -1
- package/es/locale/lang/id-ID.js +7 -1
- package/es/locale/lang/it-IT.js +7 -1
- package/es/locale/lang/ja-JP.js +7 -1
- package/es/locale/lang/ko-KR.js +7 -1
- package/es/locale/lang/nb-NO.js +7 -1
- package/es/locale/lang/pt-BR.js +7 -1
- package/es/locale/lang/ru-RU.js +7 -1
- package/es/locale/lang/th-TH.js +7 -1
- package/es/locale/lang/ug-CN.js +7 -1
- package/es/locale/lang/uk-UA.js +7 -1
- package/es/locale/lang/vi-VN.js +7 -1
- package/es/locale/lang/zh-CHT.js +7 -1
- package/es/locale/lang/zh-CN.js +7 -1
- package/es/style.css +1 -1
- package/es/table/module/custom/mixin.js +4 -2
- package/es/table/module/custom/panel.js +24 -23
- package/es/table/module/edit/mixin.js +17 -11
- package/es/table/module/export/export-panel.js +5 -4
- package/es/table/module/export/import-panel.js +8 -7
- package/es/table/module/export/mixin.js +30 -27
- package/es/table/module/filter/panel.js +21 -10
- package/es/table/module/keyboard/mixin.js +141 -41
- package/es/table/module/menu/mixin.js +6 -3
- package/es/table/module/menu/panel.js +7 -7
- package/es/table/module/validator/mixin.js +2 -2
- package/es/table/render/index.js +2 -2
- package/es/table/src/body.js +39 -20
- package/es/table/src/cell.js +27 -22
- package/es/table/src/column.js +11 -9
- package/es/table/src/columnInfo.js +6 -6
- package/es/table/src/footer.js +12 -7
- package/es/table/src/group.js +6 -5
- package/es/table/src/header.js +15 -9
- package/es/table/src/methods.js +773 -704
- package/es/table/src/props.js +4 -0
- package/es/table/src/table.js +85 -49
- package/es/table/src/util.js +55 -20
- package/es/toolbar/src/toolbar.js +3 -3
- package/es/ui/index.js +2 -1
- package/es/ui/src/log.js +1 -1
- package/helper/vetur/attributes.json +1 -1
- package/helper/vetur/tags.json +1 -1
- package/lib/grid/src/grid.js +82 -67
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +1590 -1249
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +7 -1
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/de-DE.js +7 -1
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/en-US.js +7 -1
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +7 -1
- package/lib/locale/lang/es-ES.js +7 -1
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +7 -1
- package/lib/locale/lang/fr-FR.js +7 -1
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/hu-HU.js +7 -1
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +7 -1
- package/lib/locale/lang/hy-AM.js +7 -1
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/id-ID.js +7 -1
- package/lib/locale/lang/id-ID.min.js +1 -1
- package/lib/locale/lang/it-IT.js +7 -1
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/ja-JP.js +7 -1
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +7 -1
- package/lib/locale/lang/ko-KR.js +7 -1
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +7 -1
- package/lib/locale/lang/nb-NO.js +7 -1
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/pt-BR.js +7 -1
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +7 -1
- package/lib/locale/lang/ru-RU.js +7 -1
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +7 -1
- package/lib/locale/lang/th-TH.js +7 -1
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/ug-CN.js +7 -1
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/uk-UA.js +7 -1
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +7 -1
- package/lib/locale/lang/vi-VN.js +7 -1
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/zh-CHT.js +7 -1
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +7 -1
- package/lib/locale/lang/zh-CN.js +7 -1
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +7 -1
- package/lib/style.css +1 -1
- package/lib/table/module/custom/mixin.js +5 -3
- package/lib/table/module/custom/mixin.min.js +1 -1
- package/lib/table/module/custom/panel.js +22 -29
- package/lib/table/module/custom/panel.min.js +1 -1
- package/lib/table/module/edit/mixin.js +19 -13
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/export/export-panel.js +5 -4
- package/lib/table/module/export/export-panel.min.js +1 -1
- package/lib/table/module/export/import-panel.js +8 -7
- package/lib/table/module/export/import-panel.min.js +1 -1
- package/lib/table/module/export/mixin.js +35 -34
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/module/filter/panel.js +16 -16
- package/lib/table/module/filter/panel.min.js +1 -1
- package/lib/table/module/keyboard/mixin.js +149 -47
- package/lib/table/module/keyboard/mixin.min.js +1 -1
- package/lib/table/module/menu/mixin.js +6 -3
- package/lib/table/module/menu/mixin.min.js +1 -1
- package/lib/table/module/menu/panel.js +7 -7
- package/lib/table/module/menu/panel.min.js +1 -1
- package/lib/table/module/validator/mixin.js +3 -3
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/render/index.js +3 -2
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/body.js +47 -20
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +39 -23
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/column.js +11 -9
- package/lib/table/src/column.min.js +1 -1
- package/lib/table/src/columnInfo.js +6 -6
- package/lib/table/src/columnInfo.min.js +1 -1
- package/lib/table/src/footer.js +12 -5
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/group.js +6 -5
- package/lib/table/src/group.min.js +1 -1
- package/lib/table/src/header.js +16 -8
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +911 -830
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/props.js +4 -0
- package/lib/table/src/props.min.js +1 -1
- package/lib/table/src/table.js +93 -52
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +62 -21
- package/lib/table/src/util.min.js +1 -1
- package/lib/toolbar/src/toolbar.js +3 -3
- package/lib/ui/index.js +2 -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/grid/src/grid.ts +88 -59
- package/packages/locale/lang/ar-EG.ts +7 -1
- package/packages/locale/lang/de-DE.ts +7 -1
- package/packages/locale/lang/en-US.ts +7 -1
- package/packages/locale/lang/es-ES.ts +7 -1
- package/packages/locale/lang/fr-FR.ts +7 -1
- package/packages/locale/lang/hu-HU.ts +7 -1
- package/packages/locale/lang/hy-AM.ts +7 -1
- package/packages/locale/lang/id-ID.ts +7 -1
- package/packages/locale/lang/it-IT.ts +7 -1
- package/packages/locale/lang/ja-JP.ts +7 -1
- package/packages/locale/lang/ko-KR.ts +7 -1
- package/packages/locale/lang/nb-NO.ts +7 -1
- package/packages/locale/lang/pt-BR.ts +7 -1
- package/packages/locale/lang/ru-RU.ts +7 -1
- package/packages/locale/lang/th-TH.ts +7 -1
- package/packages/locale/lang/ug-CN.ts +7 -1
- package/packages/locale/lang/uk-UA.ts +7 -1
- package/packages/locale/lang/vi-VN.ts +7 -1
- package/packages/locale/lang/zh-CHT.ts +7 -1
- package/packages/locale/lang/zh-CN.ts +7 -1
- package/packages/table/module/custom/mixin.ts +6 -3
- package/packages/table/module/custom/panel.ts +42 -37
- package/packages/table/module/edit/mixin.ts +20 -14
- package/packages/table/module/export/export-panel.ts +8 -5
- package/packages/table/module/export/import-panel.ts +11 -7
- package/packages/table/module/export/mixin.ts +37 -32
- package/packages/table/module/filter/panel.ts +25 -10
- package/packages/table/module/keyboard/mixin.ts +155 -49
- package/packages/table/module/menu/mixin.ts +12 -6
- package/packages/table/module/menu/panel.ts +10 -7
- package/packages/table/module/validator/mixin.ts +2 -2
- package/packages/table/render/index.ts +2 -2
- package/packages/table/src/body.ts +39 -20
- package/packages/table/src/cell.ts +27 -22
- package/packages/table/src/column.ts +14 -10
- package/packages/table/src/columnInfo.ts +9 -6
- package/packages/table/src/footer.ts +12 -7
- package/packages/table/src/group.ts +9 -5
- package/packages/table/src/header.ts +16 -9
- package/packages/table/src/methods.ts +854 -740
- package/packages/table/src/props.ts +16 -12
- package/packages/table/src/table.ts +99 -52
- package/packages/table/src/util.ts +63 -21
- package/packages/toolbar/src/toolbar.ts +3 -3
- package/packages/ui/index.ts +1 -0
- /package/es/{iconfont.1741333630357.ttf → iconfont.1742955973002.ttf} +0 -0
- /package/es/{iconfont.1741333630357.woff → iconfont.1742955973002.woff} +0 -0
- /package/es/{iconfont.1741333630357.woff2 → iconfont.1742955973002.woff2} +0 -0
- /package/lib/{iconfont.1741333630357.ttf → iconfont.1742955973002.ttf} +0 -0
- /package/lib/{iconfont.1741333630357.woff → iconfont.1742955973002.woff} +0 -0
- /package/lib/{iconfont.1741333630357.woff2 → iconfont.1742955973002.woff2} +0 -0
package/lib/table/src/methods.js
CHANGED
|
@@ -21,6 +21,7 @@ const {
|
|
|
21
21
|
interceptor,
|
|
22
22
|
createEvent
|
|
23
23
|
} = _ui.VxeUI;
|
|
24
|
+
const supportMaxRow = 5e6;
|
|
24
25
|
const customStorageKey = 'VXE_CUSTOM_STORE';
|
|
25
26
|
const maxYHeight = 5e6;
|
|
26
27
|
const maxXWidth = 5e6;
|
|
@@ -287,7 +288,7 @@ function cacheColumnMap($xeTable) {
|
|
|
287
288
|
fullColumnFieldData[field] = rest;
|
|
288
289
|
} else {
|
|
289
290
|
if (storage && !type || columnOpts.drag && (isCrossDrag || isSelfToChildDrag)) {
|
|
290
|
-
(0, _log.errLog)('vxe.error.reqProp', [`${column.getTitle() || type || ''} -> column.field
|
|
291
|
+
(0, _log.errLog)('vxe.error.reqProp', [`${column.getTitle() || type || ''} -> column.field=?`]);
|
|
291
292
|
}
|
|
292
293
|
}
|
|
293
294
|
if (!hasFixed && fixed) {
|
|
@@ -393,9 +394,12 @@ function updateAfterListIndex($xeTable) {
|
|
|
393
394
|
fullDataRowIdData,
|
|
394
395
|
fullAllDataRowIdData
|
|
395
396
|
} = internalData;
|
|
397
|
+
const {
|
|
398
|
+
handleGetRowId
|
|
399
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
396
400
|
const fullMaps = {};
|
|
397
401
|
afterFullData.forEach((row, index) => {
|
|
398
|
-
const rowid = (
|
|
402
|
+
const rowid = handleGetRowId(row);
|
|
399
403
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
400
404
|
const seq = index + 1;
|
|
401
405
|
if (rowRest) {
|
|
@@ -449,8 +453,11 @@ function updateAfterDataIndex($xeTable) {
|
|
|
449
453
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
450
454
|
const fullMaps = {};
|
|
451
455
|
if (treeConfig) {
|
|
456
|
+
const {
|
|
457
|
+
handleGetRowId
|
|
458
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
452
459
|
_xeUtils.default.eachTree(afterTreeFullData, (row, index, items, path) => {
|
|
453
|
-
const rowid = (
|
|
460
|
+
const rowid = handleGetRowId(row);
|
|
454
461
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
455
462
|
const seq = path.map((num, i) => i % 2 === 0 ? Number(num) + 1 : '.').join('');
|
|
456
463
|
if (rowRest) {
|
|
@@ -492,25 +499,25 @@ function updateAfterDataIndex($xeTable) {
|
|
|
492
499
|
*/
|
|
493
500
|
function handleVirtualTreeToList($xeTable) {
|
|
494
501
|
const props = $xeTable;
|
|
495
|
-
const reactData = $xeTable;
|
|
496
502
|
const internalData = $xeTable;
|
|
497
503
|
const {
|
|
498
504
|
treeConfig
|
|
499
505
|
} = props;
|
|
500
506
|
const {
|
|
507
|
+
fullAllDataRowIdData,
|
|
501
508
|
treeExpandedMaps
|
|
502
|
-
} = reactData;
|
|
503
|
-
const {
|
|
504
|
-
fullAllDataRowIdData
|
|
505
509
|
} = internalData;
|
|
506
510
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
507
511
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
508
512
|
if (treeConfig && treeOpts.transform) {
|
|
513
|
+
const {
|
|
514
|
+
handleGetRowId
|
|
515
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
509
516
|
const fullData = [];
|
|
510
517
|
const expandMaps = {};
|
|
511
518
|
_xeUtils.default.eachTree(internalData.afterTreeFullData, (row, index, items, path, parentRow) => {
|
|
512
|
-
const rowid = (
|
|
513
|
-
const parentRowid = (
|
|
519
|
+
const rowid = handleGetRowId(row);
|
|
520
|
+
const parentRowid = handleGetRowId(parentRow);
|
|
514
521
|
if (!parentRow || expandMaps[parentRowid] && treeExpandedMaps[parentRowid]) {
|
|
515
522
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
516
523
|
if (rowRest) {
|
|
@@ -558,7 +565,6 @@ function updateStyle($xeTable) {
|
|
|
558
565
|
} = reactData;
|
|
559
566
|
const {
|
|
560
567
|
visibleColumn,
|
|
561
|
-
fullColumnIdData,
|
|
562
568
|
tableHeight,
|
|
563
569
|
headerHeight,
|
|
564
570
|
footerHeight,
|
|
@@ -575,7 +581,6 @@ function updateStyle($xeTable) {
|
|
|
575
581
|
const osbWidth = overflowY ? scrollbarWidth : 0;
|
|
576
582
|
const osbHeight = overflowX ? scrollbarHeight : 0;
|
|
577
583
|
const emptyPlaceholderElem = $xeTable.$refs.refEmptyPlaceholder;
|
|
578
|
-
const cellOffsetWidth = $xeTable.computeCellOffsetWidth;
|
|
579
584
|
const mouseOpts = $xeTable.computeMouseOpts;
|
|
580
585
|
const expandOpts = $xeTable.computeExpandOpts;
|
|
581
586
|
const bodyWrapperElem = (0, _util.getRefElem)(elemStore['main-body-wrapper']);
|
|
@@ -837,58 +842,6 @@ function updateStyle($xeTable) {
|
|
|
837
842
|
tableElem.style.width = tWidth ? `${tWidth}px` : '';
|
|
838
843
|
}
|
|
839
844
|
}
|
|
840
|
-
const colgroupElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-colgroup`]);
|
|
841
|
-
if (colgroupElem) {
|
|
842
|
-
_xeUtils.default.arrayEach(colgroupElem.children, colElem => {
|
|
843
|
-
const colid = colElem.getAttribute('name');
|
|
844
|
-
if (fullColumnIdData[colid]) {
|
|
845
|
-
const colRest = fullColumnIdData[colid];
|
|
846
|
-
const column = colRest.column;
|
|
847
|
-
const {
|
|
848
|
-
showHeaderOverflow,
|
|
849
|
-
showFooterOverflow,
|
|
850
|
-
showOverflow
|
|
851
|
-
} = column;
|
|
852
|
-
let cellOverflow;
|
|
853
|
-
colElem.style.width = `${column.renderWidth}px`;
|
|
854
|
-
if (layout === 'header') {
|
|
855
|
-
cellOverflow = _xeUtils.default.isUndefined(showHeaderOverflow) || _xeUtils.default.isNull(showHeaderOverflow) ? allColumnHeaderOverflow : showHeaderOverflow;
|
|
856
|
-
} else if (layout === 'footer') {
|
|
857
|
-
cellOverflow = _xeUtils.default.isUndefined(showFooterOverflow) || _xeUtils.default.isNull(showFooterOverflow) ? allColumnFooterOverflow : showFooterOverflow;
|
|
858
|
-
} else {
|
|
859
|
-
cellOverflow = _xeUtils.default.isUndefined(showOverflow) || _xeUtils.default.isNull(showOverflow) ? isAllOverflow : showOverflow;
|
|
860
|
-
}
|
|
861
|
-
const showEllipsis = cellOverflow === 'ellipsis';
|
|
862
|
-
const showTitle = cellOverflow === 'title';
|
|
863
|
-
const showTooltip = cellOverflow === true || cellOverflow === 'tooltip';
|
|
864
|
-
let hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
865
|
-
const listElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-list`]);
|
|
866
|
-
// 纵向虚拟滚动不支持动态行高
|
|
867
|
-
if (scrollYLoad && !hasEllipsis) {
|
|
868
|
-
hasEllipsis = true;
|
|
869
|
-
}
|
|
870
|
-
if (listElem) {
|
|
871
|
-
_xeUtils.default.arrayEach(listElem.querySelectorAll(`.${column.id}`), elem => {
|
|
872
|
-
const colspan = parseInt(elem.getAttribute('colspan') || 1);
|
|
873
|
-
const cellElem = elem.querySelector('.vxe-cell');
|
|
874
|
-
let colWidth = column.renderWidth;
|
|
875
|
-
if (cellElem) {
|
|
876
|
-
if (colspan > 1) {
|
|
877
|
-
const columnIndex = $xeTable.getColumnIndex(column);
|
|
878
|
-
for (let index = 1; index < colspan; index++) {
|
|
879
|
-
const nextColumn = $xeTable.getColumns(columnIndex + index);
|
|
880
|
-
if (nextColumn) {
|
|
881
|
-
colWidth += nextColumn.renderWidth;
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
cellElem.style.width = hasEllipsis ? `${colWidth - cellOffsetWidth * colspan}px` : '';
|
|
886
|
-
}
|
|
887
|
-
});
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
});
|
|
891
|
-
}
|
|
892
845
|
});
|
|
893
846
|
});
|
|
894
847
|
if (currentRow) {
|
|
@@ -899,6 +852,21 @@ function updateStyle($xeTable) {
|
|
|
899
852
|
}
|
|
900
853
|
return $xeTable.$nextTick();
|
|
901
854
|
}
|
|
855
|
+
function checkValidate($xeTable, type) {
|
|
856
|
+
if ($xeTable.triggerValidate) {
|
|
857
|
+
return $xeTable.triggerValidate(type);
|
|
858
|
+
}
|
|
859
|
+
return $xeTable.$nextTick();
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* 当单元格发生改变时
|
|
863
|
+
* 如果存在规则,则校验
|
|
864
|
+
*/
|
|
865
|
+
function handleChangeCell($xeTable, evnt, params) {
|
|
866
|
+
checkValidate($xeTable, 'blur').catch(e => e).then(() => {
|
|
867
|
+
$xeTable.handleEdit(params, evnt).then(() => checkValidate($xeTable, 'change')).catch(e => e);
|
|
868
|
+
});
|
|
869
|
+
}
|
|
902
870
|
function handleRadioReserveRow($xeTable, row) {
|
|
903
871
|
const internalData = $xeTable;
|
|
904
872
|
const radioOpts = $xeTable.computeRadioOpts;
|
|
@@ -950,12 +918,10 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
|
|
|
950
918
|
const {
|
|
951
919
|
treeConfig
|
|
952
920
|
} = props;
|
|
953
|
-
const {
|
|
954
|
-
selectCheckboxMaps
|
|
955
|
-
} = reactData;
|
|
956
921
|
const {
|
|
957
922
|
afterFullData,
|
|
958
|
-
checkboxReserveRowMap
|
|
923
|
+
checkboxReserveRowMap,
|
|
924
|
+
selectCheckboxMaps
|
|
959
925
|
} = internalData;
|
|
960
926
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
961
927
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
@@ -965,6 +931,9 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
|
|
|
965
931
|
reserve,
|
|
966
932
|
checkMethod
|
|
967
933
|
} = checkboxOpts;
|
|
934
|
+
const {
|
|
935
|
+
handleGetRowId
|
|
936
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
968
937
|
// indeterminateField 仅支持读取
|
|
969
938
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
970
939
|
const selectRowMaps = {};
|
|
@@ -978,7 +947,7 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
|
|
|
978
947
|
row
|
|
979
948
|
})) {
|
|
980
949
|
if (checked) {
|
|
981
|
-
selectRowMaps[(
|
|
950
|
+
selectRowMaps[handleGetRowId(row)] = row;
|
|
982
951
|
}
|
|
983
952
|
_xeUtils.default.set(row, checkField, checked);
|
|
984
953
|
}
|
|
@@ -1010,7 +979,8 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
|
|
|
1010
979
|
if (isForce || !checkMethod || checkMethod({
|
|
1011
980
|
row
|
|
1012
981
|
})) {
|
|
1013
|
-
|
|
982
|
+
const rowid = handleGetRowId(row);
|
|
983
|
+
selectRowMaps[rowid] = row;
|
|
1014
984
|
}
|
|
1015
985
|
}, {
|
|
1016
986
|
children: childrenField
|
|
@@ -1022,7 +992,7 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
|
|
|
1022
992
|
*/
|
|
1023
993
|
if (!isForce && checkMethod) {
|
|
1024
994
|
_xeUtils.default.eachTree(afterFullData, row => {
|
|
1025
|
-
const rowid = (
|
|
995
|
+
const rowid = handleGetRowId(row);
|
|
1026
996
|
if (checkMethod({
|
|
1027
997
|
row
|
|
1028
998
|
}) ? 0 : selectCheckboxMaps[rowid]) {
|
|
@@ -1042,7 +1012,7 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
|
|
|
1042
1012
|
*/
|
|
1043
1013
|
if (!isForce && checkMethod) {
|
|
1044
1014
|
afterFullData.forEach(row => {
|
|
1045
|
-
const rowid = (
|
|
1015
|
+
const rowid = handleGetRowId(row);
|
|
1046
1016
|
if (selectCheckboxMaps[rowid] || checkMethod({
|
|
1047
1017
|
row
|
|
1048
1018
|
})) {
|
|
@@ -1051,7 +1021,8 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
|
|
|
1051
1021
|
});
|
|
1052
1022
|
} else {
|
|
1053
1023
|
afterFullData.forEach(row => {
|
|
1054
|
-
|
|
1024
|
+
const rowid = handleGetRowId(row);
|
|
1025
|
+
selectRowMaps[rowid] = row;
|
|
1055
1026
|
});
|
|
1056
1027
|
}
|
|
1057
1028
|
} else {
|
|
@@ -1062,7 +1033,7 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
|
|
|
1062
1033
|
*/
|
|
1063
1034
|
if (!isForce && checkMethod) {
|
|
1064
1035
|
afterFullData.forEach(row => {
|
|
1065
|
-
const rowid = (
|
|
1036
|
+
const rowid = handleGetRowId(row);
|
|
1066
1037
|
if (checkMethod({
|
|
1067
1038
|
row
|
|
1068
1039
|
}) ? 0 : selectCheckboxMaps[rowid]) {
|
|
@@ -1082,10 +1053,10 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
|
|
|
1082
1053
|
afterFullData.forEach(row => handleCheckboxReserveRow($xeTable, row, false));
|
|
1083
1054
|
}
|
|
1084
1055
|
}
|
|
1085
|
-
reactData.
|
|
1056
|
+
reactData.updateCheckboxFlag++;
|
|
1057
|
+
internalData.selectCheckboxMaps = checkField ? {} : selectRowMaps;
|
|
1086
1058
|
reactData.isAllSelected = checked;
|
|
1087
1059
|
reactData.isIndeterminate = false;
|
|
1088
|
-
reactData.treeIndeterminateMaps = {};
|
|
1089
1060
|
internalData.treeIndeterminateRowMaps = {};
|
|
1090
1061
|
$xeTable.checkSelectionStatus();
|
|
1091
1062
|
return $xeTable.$nextTick();
|
|
@@ -1101,15 +1072,15 @@ function handleReserveStatus($xeTable) {
|
|
|
1101
1072
|
const {
|
|
1102
1073
|
expandColumn,
|
|
1103
1074
|
currentRow,
|
|
1104
|
-
|
|
1105
|
-
selectRadioRow,
|
|
1106
|
-
rowExpandedMaps,
|
|
1107
|
-
treeExpandedMaps
|
|
1075
|
+
selectRadioRow
|
|
1108
1076
|
} = reactData;
|
|
1109
1077
|
const {
|
|
1110
1078
|
fullDataRowIdData,
|
|
1111
1079
|
fullAllDataRowIdData,
|
|
1112
|
-
radioReserveRow
|
|
1080
|
+
radioReserveRow,
|
|
1081
|
+
selectCheckboxMaps,
|
|
1082
|
+
treeExpandedMaps,
|
|
1083
|
+
rowExpandedMaps
|
|
1113
1084
|
} = internalData;
|
|
1114
1085
|
const expandOpts = $xeTable.computeExpandOpts;
|
|
1115
1086
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
@@ -1127,7 +1098,8 @@ function handleReserveStatus($xeTable) {
|
|
|
1127
1098
|
}
|
|
1128
1099
|
}
|
|
1129
1100
|
// 复选框
|
|
1130
|
-
|
|
1101
|
+
internalData.selectCheckboxMaps = getRecoverRowMaps($xeTable, selectCheckboxMaps); // 刷新多选行状态
|
|
1102
|
+
reactData.updateCheckboxFlag++;
|
|
1131
1103
|
// 还原保留选中状态
|
|
1132
1104
|
if (checkboxOpts.reserve) {
|
|
1133
1105
|
handleCheckedCheckboxRow($xeTable, handleReserveRow($xeTable, internalData.checkboxReserveRowMap), true, true);
|
|
@@ -1136,17 +1108,194 @@ function handleReserveStatus($xeTable) {
|
|
|
1136
1108
|
reactData.currentRow = null; // 刷新当前行状态
|
|
1137
1109
|
}
|
|
1138
1110
|
// 行展开
|
|
1139
|
-
|
|
1111
|
+
internalData.rowExpandedMaps = expandColumn ? getRecoverRowMaps($xeTable, rowExpandedMaps) : {}; // 刷新行展开状态
|
|
1112
|
+
reactData.rowExpandedFlag++;
|
|
1140
1113
|
// 还原保留状态
|
|
1141
1114
|
if (expandColumn && expandOpts.reserve) {
|
|
1142
1115
|
$xeTable.setRowExpand(handleReserveRow($xeTable, internalData.rowExpandedReserveRowMap), true);
|
|
1143
1116
|
}
|
|
1144
1117
|
// 树展开
|
|
1145
|
-
|
|
1118
|
+
internalData.treeExpandedMaps = treeConfig ? getRecoverRowMaps($xeTable, treeExpandedMaps) : {}; // 刷新树展开状态
|
|
1119
|
+
reactData.treeExpandedFlag++;
|
|
1146
1120
|
if (treeConfig && treeOpts.reserve) {
|
|
1147
1121
|
$xeTable.setTreeExpand(handleReserveRow($xeTable, internalData.treeExpandedReserveRowMap), true);
|
|
1148
1122
|
}
|
|
1149
1123
|
}
|
|
1124
|
+
/**
|
|
1125
|
+
* 处理默认展开树节点
|
|
1126
|
+
*/
|
|
1127
|
+
const handleDefaultTreeExpand = $xeTable => {
|
|
1128
|
+
const props = $xeTable;
|
|
1129
|
+
const internalData = $xeTable;
|
|
1130
|
+
const {
|
|
1131
|
+
treeConfig
|
|
1132
|
+
} = props;
|
|
1133
|
+
if (treeConfig) {
|
|
1134
|
+
const {
|
|
1135
|
+
tableFullData
|
|
1136
|
+
} = internalData;
|
|
1137
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
1138
|
+
const {
|
|
1139
|
+
expandAll,
|
|
1140
|
+
expandRowKeys
|
|
1141
|
+
} = treeOpts;
|
|
1142
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
1143
|
+
if (expandAll) {
|
|
1144
|
+
$xeTable.setAllTreeExpand(true);
|
|
1145
|
+
} else if (expandRowKeys) {
|
|
1146
|
+
const defExpandeds = [];
|
|
1147
|
+
const rowkey = (0, _util.getRowkey)($xeTable);
|
|
1148
|
+
expandRowKeys.forEach(rowid => {
|
|
1149
|
+
const matchObj = _xeUtils.default.findTree(tableFullData, item => rowid === _xeUtils.default.get(item, rowkey), {
|
|
1150
|
+
children: childrenField
|
|
1151
|
+
});
|
|
1152
|
+
if (matchObj) {
|
|
1153
|
+
defExpandeds.push(matchObj.item);
|
|
1154
|
+
}
|
|
1155
|
+
});
|
|
1156
|
+
$xeTable.setTreeExpand(defExpandeds, true);
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
const handleAsyncTreeExpandChilds = ($xeTable, row) => {
|
|
1161
|
+
const reactData = $xeTable;
|
|
1162
|
+
const internalData = $xeTable;
|
|
1163
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
1164
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
1165
|
+
const {
|
|
1166
|
+
transform,
|
|
1167
|
+
loadMethod
|
|
1168
|
+
} = treeOpts;
|
|
1169
|
+
const {
|
|
1170
|
+
checkStrictly
|
|
1171
|
+
} = checkboxOpts;
|
|
1172
|
+
return new Promise(resolve => {
|
|
1173
|
+
if (loadMethod) {
|
|
1174
|
+
const {
|
|
1175
|
+
fullAllDataRowIdData,
|
|
1176
|
+
treeExpandLazyLoadedMaps
|
|
1177
|
+
} = internalData;
|
|
1178
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
1179
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
1180
|
+
treeExpandLazyLoadedMaps[rowid] = row;
|
|
1181
|
+
Promise.resolve(loadMethod({
|
|
1182
|
+
$table: $xeTable,
|
|
1183
|
+
row
|
|
1184
|
+
})).then(childRecords => {
|
|
1185
|
+
if (rowRest) {
|
|
1186
|
+
rowRest.treeLoaded = true;
|
|
1187
|
+
}
|
|
1188
|
+
if (treeExpandLazyLoadedMaps[rowid]) {
|
|
1189
|
+
delete treeExpandLazyLoadedMaps[rowid];
|
|
1190
|
+
}
|
|
1191
|
+
if (!_xeUtils.default.isArray(childRecords)) {
|
|
1192
|
+
childRecords = [];
|
|
1193
|
+
}
|
|
1194
|
+
if (childRecords) {
|
|
1195
|
+
return $xeTable.loadTreeChildren(row, childRecords).then(childRows => {
|
|
1196
|
+
const {
|
|
1197
|
+
treeExpandedMaps
|
|
1198
|
+
} = internalData;
|
|
1199
|
+
if (childRows.length && !treeExpandedMaps[rowid]) {
|
|
1200
|
+
treeExpandedMaps[rowid] = row;
|
|
1201
|
+
}
|
|
1202
|
+
reactData.treeExpandedFlag++;
|
|
1203
|
+
// 如果当前节点已选中,则展开后子节点也被选中
|
|
1204
|
+
if (!checkStrictly && $xeTable.isCheckedByCheckboxRow(row)) {
|
|
1205
|
+
handleCheckedCheckboxRow($xeTable, childRows, true);
|
|
1206
|
+
}
|
|
1207
|
+
return $xeTable.$nextTick().then(() => {
|
|
1208
|
+
if (transform) {
|
|
1209
|
+
$xeTable.handleTableData();
|
|
1210
|
+
updateAfterDataIndex($xeTable);
|
|
1211
|
+
return $xeTable.$nextTick();
|
|
1212
|
+
}
|
|
1213
|
+
});
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
}).catch(() => {
|
|
1217
|
+
const {
|
|
1218
|
+
treeExpandLazyLoadedMaps
|
|
1219
|
+
} = internalData;
|
|
1220
|
+
if (rowRest) {
|
|
1221
|
+
rowRest.treeLoaded = false;
|
|
1222
|
+
}
|
|
1223
|
+
if (treeExpandLazyLoadedMaps[rowid]) {
|
|
1224
|
+
delete treeExpandLazyLoadedMaps[rowid];
|
|
1225
|
+
}
|
|
1226
|
+
}).finally(() => {
|
|
1227
|
+
reactData.treeExpandedFlag++;
|
|
1228
|
+
$xeTable.$nextTick().then(() => $xeTable.recalculate()).then(() => resolve());
|
|
1229
|
+
});
|
|
1230
|
+
} else {
|
|
1231
|
+
resolve();
|
|
1232
|
+
}
|
|
1233
|
+
});
|
|
1234
|
+
};
|
|
1235
|
+
const handleTreeExpandReserve = ($xeTable, row, expanded) => {
|
|
1236
|
+
const internalData = $xeTable;
|
|
1237
|
+
const {
|
|
1238
|
+
treeExpandedReserveRowMap
|
|
1239
|
+
} = internalData;
|
|
1240
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
1241
|
+
if (treeOpts.reserve) {
|
|
1242
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
1243
|
+
if (expanded) {
|
|
1244
|
+
treeExpandedReserveRowMap[rowid] = row;
|
|
1245
|
+
} else if (treeExpandedReserveRowMap[rowid]) {
|
|
1246
|
+
delete treeExpandedReserveRowMap[rowid];
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
};
|
|
1250
|
+
const handleAsyncRowExpand = ($xeTable, row) => {
|
|
1251
|
+
const reactData = $xeTable;
|
|
1252
|
+
const internalData = $xeTable;
|
|
1253
|
+
return new Promise(resolve => {
|
|
1254
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
1255
|
+
const {
|
|
1256
|
+
loadMethod
|
|
1257
|
+
} = expandOpts;
|
|
1258
|
+
if (loadMethod) {
|
|
1259
|
+
const {
|
|
1260
|
+
fullAllDataRowIdData,
|
|
1261
|
+
rowExpandLazyLoadedMaps
|
|
1262
|
+
} = internalData;
|
|
1263
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
1264
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
1265
|
+
rowExpandLazyLoadedMaps[rowid] = row;
|
|
1266
|
+
loadMethod({
|
|
1267
|
+
$table: $xeTable,
|
|
1268
|
+
row,
|
|
1269
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
1270
|
+
$rowIndex: $xeTable.getVMRowIndex(row)
|
|
1271
|
+
}).then(() => {
|
|
1272
|
+
const {
|
|
1273
|
+
rowExpandedMaps
|
|
1274
|
+
} = internalData;
|
|
1275
|
+
if (rowRest) {
|
|
1276
|
+
rowRest.expandLoaded = true;
|
|
1277
|
+
}
|
|
1278
|
+
rowExpandedMaps[rowid] = row;
|
|
1279
|
+
reactData.rowExpandedFlag++;
|
|
1280
|
+
}).catch(() => {
|
|
1281
|
+
if (rowRest) {
|
|
1282
|
+
rowRest.expandLoaded = false;
|
|
1283
|
+
}
|
|
1284
|
+
}).finally(() => {
|
|
1285
|
+
const {
|
|
1286
|
+
rowExpandLazyLoadedMaps
|
|
1287
|
+
} = internalData;
|
|
1288
|
+
if (rowExpandLazyLoadedMaps[rowid]) {
|
|
1289
|
+
delete rowExpandLazyLoadedMaps[rowid];
|
|
1290
|
+
}
|
|
1291
|
+
reactData.rowExpandedFlag++;
|
|
1292
|
+
$xeTable.$nextTick().then(() => $xeTable.recalculate()).then(() => $xeTable.updateCellAreas()).then(() => resolve());
|
|
1293
|
+
});
|
|
1294
|
+
} else {
|
|
1295
|
+
resolve();
|
|
1296
|
+
}
|
|
1297
|
+
});
|
|
1298
|
+
};
|
|
1150
1299
|
function calcVarRowHeightConfig($xeTable, sizeKey, sizeEl) {
|
|
1151
1300
|
const reactData = $xeTable;
|
|
1152
1301
|
const {
|
|
@@ -1221,12 +1370,15 @@ function handleVirtualYVisible($xeTable) {
|
|
|
1221
1370
|
toVisibleIndex = Math.floor(startTop / defaultRowHeight) - 1;
|
|
1222
1371
|
visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1;
|
|
1223
1372
|
} else {
|
|
1373
|
+
const {
|
|
1374
|
+
handleGetRowId
|
|
1375
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
1224
1376
|
let leftIndex = 0;
|
|
1225
1377
|
let rightIndex = afterFullData.length;
|
|
1226
1378
|
while (leftIndex < rightIndex) {
|
|
1227
1379
|
const rIndex = Math.floor((leftIndex + rightIndex) / 2);
|
|
1228
1380
|
const row = afterFullData[rIndex];
|
|
1229
|
-
const rowid = (
|
|
1381
|
+
const rowid = handleGetRowId(row);
|
|
1230
1382
|
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
1231
1383
|
if (rowRest.oTop <= startTop) {
|
|
1232
1384
|
leftIndex = rIndex + 1;
|
|
@@ -1237,7 +1389,7 @@ function handleVirtualYVisible($xeTable) {
|
|
|
1237
1389
|
toVisibleIndex = Math.max(0, leftIndex < afterFullData.length ? leftIndex - 2 : 0);
|
|
1238
1390
|
for (let rIndex = toVisibleIndex, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
|
|
1239
1391
|
const row = afterFullData[rIndex];
|
|
1240
|
-
const rowid = (
|
|
1392
|
+
const rowid = handleGetRowId(row);
|
|
1241
1393
|
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
1242
1394
|
visibleSize++;
|
|
1243
1395
|
if (rowRest.oTop > endTop || visibleSize >= 100) {
|
|
@@ -1276,12 +1428,16 @@ function calculateMergerOffsetIndex(list, offsetItem, type) {
|
|
|
1276
1428
|
}
|
|
1277
1429
|
}
|
|
1278
1430
|
}
|
|
1279
|
-
function setMerges(
|
|
1431
|
+
function setMerges($xeTable, merges, mList, rowList) {
|
|
1432
|
+
const props = $xeTable;
|
|
1433
|
+
const internalData = $xeTable;
|
|
1280
1434
|
if (merges) {
|
|
1281
1435
|
const {
|
|
1282
|
-
treeConfig
|
|
1436
|
+
treeConfig
|
|
1437
|
+
} = props;
|
|
1438
|
+
const {
|
|
1283
1439
|
visibleColumn
|
|
1284
|
-
} =
|
|
1440
|
+
} = internalData;
|
|
1285
1441
|
if (!_xeUtils.default.isArray(merges)) {
|
|
1286
1442
|
merges = [merges];
|
|
1287
1443
|
}
|
|
@@ -1331,13 +1487,17 @@ function setMerges(_vm, merges, mList, rowList) {
|
|
|
1331
1487
|
});
|
|
1332
1488
|
}
|
|
1333
1489
|
}
|
|
1334
|
-
function removeMerges(
|
|
1490
|
+
function removeMerges($xeTable, merges, mList, rowList) {
|
|
1491
|
+
const props = $xeTable;
|
|
1492
|
+
const internalData = $xeTable;
|
|
1335
1493
|
const rest = [];
|
|
1336
1494
|
if (merges) {
|
|
1337
1495
|
const {
|
|
1338
|
-
treeConfig
|
|
1496
|
+
treeConfig
|
|
1497
|
+
} = props;
|
|
1498
|
+
const {
|
|
1339
1499
|
visibleColumn
|
|
1340
|
-
} =
|
|
1500
|
+
} = internalData;
|
|
1341
1501
|
if (!_xeUtils.default.isArray(merges)) {
|
|
1342
1502
|
merges = [merges];
|
|
1343
1503
|
}
|
|
@@ -1534,6 +1694,7 @@ function autoCellWidth($xeTable) {
|
|
|
1534
1694
|
internalData.headerHeight = headerHeight;
|
|
1535
1695
|
internalData.footerHeight = footerHeight;
|
|
1536
1696
|
reactData.overflowX = overflowX;
|
|
1697
|
+
reactData.resizeWidthFlag++;
|
|
1537
1698
|
updateColumnOffsetLeft($xeTable);
|
|
1538
1699
|
updateHeight($xeTable);
|
|
1539
1700
|
reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight());
|
|
@@ -1568,8 +1729,11 @@ const calcCellHeight = $xeTable => {
|
|
|
1568
1729
|
const defaultRowHeight = $xeTable.computeDefaultRowHeight;
|
|
1569
1730
|
const el = $xeTable.$refs.refElem;
|
|
1570
1731
|
if (!isAllOverflow && scrollYLoad && el) {
|
|
1732
|
+
const {
|
|
1733
|
+
handleGetRowId
|
|
1734
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
1571
1735
|
tableData.forEach(row => {
|
|
1572
|
-
const rowid = (
|
|
1736
|
+
const rowid = handleGetRowId(row);
|
|
1573
1737
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
1574
1738
|
if (rowRest) {
|
|
1575
1739
|
const height = calcCellAutoHeight(rowRest, el);
|
|
@@ -1826,9 +1990,10 @@ function hideDropTip($xeTable) {
|
|
|
1826
1990
|
* @param {Event} evnt 事件
|
|
1827
1991
|
* @param {Row} row 行对象
|
|
1828
1992
|
*/
|
|
1829
|
-
function handleTooltip($xeTable, evnt, tdEl, overflowElem,
|
|
1993
|
+
function handleTooltip($xeTable, evnt, tdEl, overflowElem, params) {
|
|
1830
1994
|
const reactData = $xeTable;
|
|
1831
|
-
|
|
1995
|
+
const tipOverEl = overflowElem || tdEl;
|
|
1996
|
+
if (!tipOverEl) {
|
|
1832
1997
|
return $xeTable.$nextTick();
|
|
1833
1998
|
}
|
|
1834
1999
|
params.cell = tdEl;
|
|
@@ -1846,9 +2011,8 @@ function handleTooltip($xeTable, evnt, tdEl, overflowElem, tipElem, params) {
|
|
|
1846
2011
|
} = tooltipOpts;
|
|
1847
2012
|
const customContent = contentMethod ? contentMethod(params) : null;
|
|
1848
2013
|
const useCustom = contentMethod && !_xeUtils.default.eqNull(customContent);
|
|
1849
|
-
const content = useCustom ? customContent : _xeUtils.default.toString(column.type === 'html' ?
|
|
1850
|
-
|
|
1851
|
-
if (content && (showAll || useCustom || isCellOverflow)) {
|
|
2014
|
+
const content = useCustom ? customContent : _xeUtils.default.toString(column.type === 'html' ? tipOverEl.innerText : tipOverEl.textContent).trim();
|
|
2015
|
+
if (content && (showAll || useCustom || tipOverEl.scrollWidth > tipOverEl.clientWidth)) {
|
|
1852
2016
|
Object.assign(tooltipStore, {
|
|
1853
2017
|
row,
|
|
1854
2018
|
column,
|
|
@@ -1858,7 +2022,7 @@ function handleTooltip($xeTable, evnt, tdEl, overflowElem, tipElem, params) {
|
|
|
1858
2022
|
$xeTable.$nextTick(() => {
|
|
1859
2023
|
const $tooltip = $xeTable.$refs.refTooltip;
|
|
1860
2024
|
if ($tooltip && $tooltip.open) {
|
|
1861
|
-
$tooltip.open(
|
|
2025
|
+
$tooltip.open(tipOverEl, (0, _utils.formatText)(content));
|
|
1862
2026
|
}
|
|
1863
2027
|
});
|
|
1864
2028
|
}
|
|
@@ -2069,10 +2233,8 @@ function parseColumns($xeTable, isReset) {
|
|
|
2069
2233
|
const props = $xeTable;
|
|
2070
2234
|
const reactData = $xeTable;
|
|
2071
2235
|
const internalData = $xeTable;
|
|
2072
|
-
const {
|
|
2073
|
-
|
|
2074
|
-
} = props;
|
|
2075
|
-
const rowOpts = $xeTable.computeRowOpts;
|
|
2236
|
+
// const { showOverflow } = props
|
|
2237
|
+
// const rowOpts = $xeTable.computeRowOpts
|
|
2076
2238
|
const leftList = [];
|
|
2077
2239
|
const centerList = [];
|
|
2078
2240
|
const rightList = [];
|
|
@@ -2149,28 +2311,28 @@ function parseColumns($xeTable, isReset) {
|
|
|
2149
2311
|
rightList
|
|
2150
2312
|
});
|
|
2151
2313
|
if (scrollXLoad) {
|
|
2152
|
-
if (showOverflow) {
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
}
|
|
2160
|
-
if (process.env.NODE_ENV === 'development') {
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
}
|
|
2314
|
+
// if (showOverflow) {
|
|
2315
|
+
// if (!rowOpts.height) {
|
|
2316
|
+
// const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
|
|
2317
|
+
// if (errColumn) {
|
|
2318
|
+
// errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
|
|
2319
|
+
// }
|
|
2320
|
+
// }
|
|
2321
|
+
// }
|
|
2322
|
+
// if (process.env.NODE_ENV === 'development') {
|
|
2323
|
+
// if (props.showHeader && !props.showHeaderOverflow) {
|
|
2324
|
+
// warnLog('vxe.error.reqProp', ['show-header-overflow'])
|
|
2325
|
+
// }
|
|
2326
|
+
// if (props.showFooter && !props.showFooterOverflow) {
|
|
2327
|
+
// warnLog('vxe.error.reqProp', ['show-footer-overflow'])
|
|
2328
|
+
// }
|
|
2329
|
+
if (props.spanMethod) {
|
|
2330
|
+
(0, _log.warnLog)('vxe.error.scrollErrProp', ['span-method']);
|
|
2331
|
+
}
|
|
2332
|
+
if (props.footerSpanMethod) {
|
|
2333
|
+
(0, _log.warnLog)('vxe.error.scrollErrProp', ['footer-span-method']);
|
|
2334
|
+
}
|
|
2335
|
+
// }
|
|
2174
2336
|
if (isReset) {
|
|
2175
2337
|
const {
|
|
2176
2338
|
visibleSize
|
|
@@ -2307,6 +2469,39 @@ function loadScrollYData($xeTable) {
|
|
|
2307
2469
|
}
|
|
2308
2470
|
}
|
|
2309
2471
|
}
|
|
2472
|
+
const createGetRowCacheProp = prop => {
|
|
2473
|
+
return function (row) {
|
|
2474
|
+
const $xeTable = this;
|
|
2475
|
+
const internalData = $xeTable;
|
|
2476
|
+
const {
|
|
2477
|
+
fullAllDataRowIdData
|
|
2478
|
+
} = internalData;
|
|
2479
|
+
if (row) {
|
|
2480
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
2481
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
2482
|
+
if (rowRest) {
|
|
2483
|
+
return rowRest[prop];
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
return -1;
|
|
2487
|
+
};
|
|
2488
|
+
};
|
|
2489
|
+
const createGetColumnCacheProp = prop => {
|
|
2490
|
+
return function (column) {
|
|
2491
|
+
const $xeTable = this;
|
|
2492
|
+
const internalData = $xeTable;
|
|
2493
|
+
const {
|
|
2494
|
+
fullColumnIdData
|
|
2495
|
+
} = internalData;
|
|
2496
|
+
if (column) {
|
|
2497
|
+
const colRest = fullColumnIdData[column.id];
|
|
2498
|
+
if (colRest) {
|
|
2499
|
+
return colRest[prop];
|
|
2500
|
+
}
|
|
2501
|
+
}
|
|
2502
|
+
return -1;
|
|
2503
|
+
};
|
|
2504
|
+
};
|
|
2310
2505
|
function lazyScrollXData($xeTable) {
|
|
2311
2506
|
const internalData = $xeTable;
|
|
2312
2507
|
const {
|
|
@@ -2478,7 +2673,7 @@ function calcCellWidth($xeTable) {
|
|
|
2478
2673
|
}
|
|
2479
2674
|
function handleUpdateColResize($xeTable, evnt, params) {
|
|
2480
2675
|
$xeTable.analyColumnWidth();
|
|
2481
|
-
$xeTable.recalculate(
|
|
2676
|
+
$xeTable.recalculate().then(() => {
|
|
2482
2677
|
$xeTable.saveCustomStore('update:width');
|
|
2483
2678
|
$xeTable.updateCellAreas();
|
|
2484
2679
|
$xeTable.dispatchEvent('column-resizable-change', params, evnt);
|
|
@@ -2490,7 +2685,7 @@ function handleUpdateColResize($xeTable, evnt, params) {
|
|
|
2490
2685
|
function handleUpdateRowResize($xeTable, evnt, params) {
|
|
2491
2686
|
const reactData = $xeTable;
|
|
2492
2687
|
reactData.resizeHeightFlag++;
|
|
2493
|
-
$xeTable.recalculate(
|
|
2688
|
+
$xeTable.recalculate().then(() => {
|
|
2494
2689
|
$xeTable.updateCellAreas();
|
|
2495
2690
|
$xeTable.dispatchEvent('row-resizable-change', params, evnt);
|
|
2496
2691
|
setTimeout(() => $xeTable.recalculate(true), 300);
|
|
@@ -2515,21 +2710,24 @@ function updateRowOffsetTop($xeTable) {
|
|
|
2515
2710
|
const reactData = $xeTable;
|
|
2516
2711
|
const internalData = $xeTable;
|
|
2517
2712
|
const {
|
|
2518
|
-
expandColumn
|
|
2519
|
-
rowExpandedMaps
|
|
2713
|
+
expandColumn
|
|
2520
2714
|
} = reactData;
|
|
2521
2715
|
const {
|
|
2522
2716
|
afterFullData,
|
|
2523
|
-
fullAllDataRowIdData
|
|
2717
|
+
fullAllDataRowIdData,
|
|
2718
|
+
rowExpandedMaps
|
|
2524
2719
|
} = internalData;
|
|
2525
2720
|
const expandOpts = $xeTable.computeExpandOpts;
|
|
2526
2721
|
const rowOpts = $xeTable.computeRowOpts;
|
|
2527
2722
|
const cellOpts = $xeTable.computeCellOpts;
|
|
2528
2723
|
const defaultRowHeight = $xeTable.computeDefaultRowHeight;
|
|
2724
|
+
const {
|
|
2725
|
+
handleGetRowId
|
|
2726
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
2529
2727
|
let offsetTop = 0;
|
|
2530
2728
|
for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
|
|
2531
2729
|
const row = afterFullData[rIndex];
|
|
2532
|
-
const rowid = (
|
|
2730
|
+
const rowid = handleGetRowId(row);
|
|
2533
2731
|
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
2534
2732
|
rowRest.oTop = offsetTop;
|
|
2535
2733
|
offsetTop += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
|
|
@@ -2545,7 +2743,8 @@ function updateRowExpandStyle($xeTable) {
|
|
|
2545
2743
|
const {
|
|
2546
2744
|
expandColumn,
|
|
2547
2745
|
scrollYLoad,
|
|
2548
|
-
|
|
2746
|
+
scrollYTop,
|
|
2747
|
+
isScrollYBig
|
|
2549
2748
|
} = reactData;
|
|
2550
2749
|
const expandOpts = $xeTable.computeExpandOpts;
|
|
2551
2750
|
const rowOpts = $xeTable.computeRowOpts;
|
|
@@ -2557,41 +2756,35 @@ function updateRowExpandStyle($xeTable) {
|
|
|
2557
2756
|
if (expandColumn && mode === 'fixed') {
|
|
2558
2757
|
const {
|
|
2559
2758
|
elemStore,
|
|
2560
|
-
afterFullData,
|
|
2561
2759
|
fullAllDataRowIdData
|
|
2562
2760
|
} = internalData;
|
|
2563
2761
|
const rowExpandEl = $xeTable.$refs.refRowExpandElem;
|
|
2564
2762
|
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
2565
2763
|
if (rowExpandEl && bodyScrollElem) {
|
|
2566
2764
|
let isUpdateHeight = false;
|
|
2567
|
-
if (scrollYLoad) {
|
|
2568
|
-
let offsetTop = 0;
|
|
2569
|
-
for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
|
|
2570
|
-
const row = afterFullData[rIndex];
|
|
2571
|
-
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
2572
|
-
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
2573
|
-
rowRest.oTop = offsetTop;
|
|
2574
|
-
offsetTop += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
|
|
2575
|
-
// 是否展开行
|
|
2576
|
-
if (expandColumn && rowExpandedMaps[rowid]) {
|
|
2577
|
-
offsetTop += rowRest.expandHeight || expandOpts.height || 0;
|
|
2578
|
-
}
|
|
2579
|
-
}
|
|
2580
|
-
}
|
|
2581
2765
|
_xeUtils.default.arrayEach(rowExpandEl.children, reEl => {
|
|
2582
2766
|
const expandEl = reEl;
|
|
2583
2767
|
const rowid = expandEl.getAttribute('rowid') || '';
|
|
2584
2768
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
2585
2769
|
if (rowRest) {
|
|
2586
2770
|
const expandHeight = expandEl.offsetHeight + 1;
|
|
2771
|
+
const trEl = bodyScrollElem.querySelector(`.vxe-body--row[rowid="${rowid}"]`);
|
|
2772
|
+
let offsetTop = 0;
|
|
2587
2773
|
if (scrollYLoad) {
|
|
2588
|
-
|
|
2774
|
+
if (isScrollYBig && trEl) {
|
|
2775
|
+
offsetTop = trEl.offsetTop + trEl.offsetHeight;
|
|
2776
|
+
} else {
|
|
2777
|
+
offsetTop = rowRest.oTop + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight);
|
|
2778
|
+
}
|
|
2589
2779
|
} else {
|
|
2590
|
-
const trEl = bodyScrollElem.querySelector(`.vxe-body--row[rowid="${rowid}"]`);
|
|
2591
2780
|
if (trEl) {
|
|
2592
|
-
|
|
2781
|
+
offsetTop = trEl.offsetTop + trEl.offsetHeight;
|
|
2593
2782
|
}
|
|
2594
2783
|
}
|
|
2784
|
+
if (isScrollYBig) {
|
|
2785
|
+
offsetTop += scrollYTop;
|
|
2786
|
+
}
|
|
2787
|
+
expandEl.style.top = (0, _dom.toCssUnit)(offsetTop);
|
|
2595
2788
|
if (!isUpdateHeight) {
|
|
2596
2789
|
if (rowRest.expandHeight !== expandHeight) {
|
|
2597
2790
|
isUpdateHeight = true;
|
|
@@ -2602,6 +2795,9 @@ function updateRowExpandStyle($xeTable) {
|
|
|
2602
2795
|
});
|
|
2603
2796
|
if (isUpdateHeight) {
|
|
2604
2797
|
reactData.rowExpandHeightFlag++;
|
|
2798
|
+
$xeTable.$nextTick(() => {
|
|
2799
|
+
updateRowOffsetTop($xeTable);
|
|
2800
|
+
});
|
|
2605
2801
|
}
|
|
2606
2802
|
}
|
|
2607
2803
|
}
|
|
@@ -2619,12 +2815,11 @@ function handleRowExpandScroll($xeTable) {
|
|
|
2619
2815
|
}
|
|
2620
2816
|
const Methods = {
|
|
2621
2817
|
callSlot(slotFunc, params, h, vNodes) {
|
|
2818
|
+
const $xeTable = this;
|
|
2819
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
2622
2820
|
if (slotFunc) {
|
|
2623
|
-
|
|
2624
|
-
$
|
|
2625
|
-
} = this;
|
|
2626
|
-
if ($xegrid) {
|
|
2627
|
-
return $xegrid.callSlot(slotFunc, params, h, vNodes);
|
|
2821
|
+
if ($xeGrid) {
|
|
2822
|
+
return $xeGrid.callSlot(slotFunc, params, h, vNodes);
|
|
2628
2823
|
}
|
|
2629
2824
|
if (_xeUtils.default.isFunction(slotFunc)) {
|
|
2630
2825
|
return (0, _vn.getSlotVNs)(slotFunc.call(this, params, h, vNodes));
|
|
@@ -2640,11 +2835,12 @@ const Methods = {
|
|
|
2640
2835
|
* 获取父容器元素
|
|
2641
2836
|
*/
|
|
2642
2837
|
getParentElem() {
|
|
2838
|
+
const $xeTable = this;
|
|
2839
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
2643
2840
|
const {
|
|
2644
|
-
$el
|
|
2645
|
-
$xegrid
|
|
2841
|
+
$el
|
|
2646
2842
|
} = this;
|
|
2647
|
-
return $
|
|
2843
|
+
return $xeGrid ? $xeGrid.$el.parentNode : $el.parentNode;
|
|
2648
2844
|
},
|
|
2649
2845
|
/**
|
|
2650
2846
|
* 获取父容器的高度
|
|
@@ -2678,10 +2874,9 @@ const Methods = {
|
|
|
2678
2874
|
* 如果存在表尾合计滚动条,则需要排除滚动条高度
|
|
2679
2875
|
*/
|
|
2680
2876
|
getExcludeHeight() {
|
|
2681
|
-
const
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
return $xegrid ? $xegrid.getExcludeHeight() : 0;
|
|
2877
|
+
const $xeTable = this;
|
|
2878
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
2879
|
+
return $xeGrid ? $xeGrid.getExcludeHeight() : 0;
|
|
2685
2880
|
},
|
|
2686
2881
|
/**
|
|
2687
2882
|
* 重置表格的一切数据状态
|
|
@@ -2780,6 +2975,9 @@ const Methods = {
|
|
|
2780
2975
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
2781
2976
|
let treeData = [];
|
|
2782
2977
|
let fullData = datas ? datas.slice(0) : [];
|
|
2978
|
+
if (fullData.length > supportMaxRow) {
|
|
2979
|
+
(0, _log.errLog)('vxe.error.errMaxRow', [supportMaxRow]);
|
|
2980
|
+
}
|
|
2783
2981
|
if (treeConfig) {
|
|
2784
2982
|
// 树结构自动转换
|
|
2785
2983
|
if (treeOpts.transform) {
|
|
@@ -3022,13 +3220,11 @@ const Methods = {
|
|
|
3022
3220
|
const {
|
|
3023
3221
|
treeConfig
|
|
3024
3222
|
} = props;
|
|
3025
|
-
const {
|
|
3026
|
-
treeExpandedMaps
|
|
3027
|
-
} = reactData;
|
|
3028
3223
|
const {
|
|
3029
3224
|
fullAllDataRowIdData,
|
|
3030
3225
|
tableFullData,
|
|
3031
|
-
tableFullTreeData
|
|
3226
|
+
tableFullTreeData,
|
|
3227
|
+
treeExpandedMaps
|
|
3032
3228
|
} = internalData;
|
|
3033
3229
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
3034
3230
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
@@ -3036,12 +3232,11 @@ const Methods = {
|
|
|
3036
3232
|
const {
|
|
3037
3233
|
lazy
|
|
3038
3234
|
} = treeOpts;
|
|
3039
|
-
const rowkey = (0, _util.getRowkey)($xeTable);
|
|
3040
|
-
const isDeepKey = rowkey.indexOf('.') > -1;
|
|
3041
3235
|
const fullAllDataRowIdMaps = Object.assign({}, fullAllDataRowIdData); // 存在已删除数据
|
|
3042
3236
|
const fullDataRowIdMaps = {};
|
|
3043
|
-
const
|
|
3044
|
-
|
|
3237
|
+
const {
|
|
3238
|
+
handleUpdateRowId
|
|
3239
|
+
} = (0, _util.createHandleUpdateRowId)($xeTable);
|
|
3045
3240
|
const handleRowCache = (row, index, items, currIndex, parentRow, rowid, level, seq) => {
|
|
3046
3241
|
let rowRest = fullAllDataRowIdMaps[rowid];
|
|
3047
3242
|
if (!rowRest) {
|
|
@@ -3061,8 +3256,6 @@ const Methods = {
|
|
|
3061
3256
|
oTop: 0,
|
|
3062
3257
|
expandHeight: 0
|
|
3063
3258
|
};
|
|
3064
|
-
fullDataRowIdMaps[rowid] = rowRest;
|
|
3065
|
-
fullAllDataRowIdMaps[rowid] = rowRest;
|
|
3066
3259
|
}
|
|
3067
3260
|
rowRest.treeLoaded = false;
|
|
3068
3261
|
rowRest.expandLoaded = false;
|
|
@@ -3072,18 +3265,19 @@ const Methods = {
|
|
|
3072
3265
|
rowRest.level = level;
|
|
3073
3266
|
rowRest.index = currIndex;
|
|
3074
3267
|
rowRest.treeIndex = index;
|
|
3268
|
+
fullDataRowIdMaps[rowid] = rowRest;
|
|
3269
|
+
fullAllDataRowIdMaps[rowid] = rowRest;
|
|
3075
3270
|
};
|
|
3076
3271
|
if (treeConfig) {
|
|
3077
3272
|
_xeUtils.default.eachTree(tableFullTreeData, (row, index, items, path, parentRow, nodes) => {
|
|
3078
|
-
const rowid =
|
|
3273
|
+
const rowid = handleUpdateRowId(row);
|
|
3079
3274
|
if (treeConfig && lazy) {
|
|
3080
|
-
const treeExpRest = treeTempExpandedMaps[rowid];
|
|
3081
3275
|
if (row[hasChildField] && row[childrenField] === undefined) {
|
|
3082
3276
|
row[childrenField] = null;
|
|
3083
3277
|
}
|
|
3084
|
-
if (
|
|
3278
|
+
if (treeExpandedMaps[rowid]) {
|
|
3085
3279
|
if (!row[childrenField] || !row[childrenField].length) {
|
|
3086
|
-
delete
|
|
3280
|
+
delete treeExpandedMaps[rowid];
|
|
3087
3281
|
}
|
|
3088
3282
|
}
|
|
3089
3283
|
}
|
|
@@ -3093,32 +3287,29 @@ const Methods = {
|
|
|
3093
3287
|
});
|
|
3094
3288
|
} else {
|
|
3095
3289
|
tableFullData.forEach((row, index, items) => {
|
|
3096
|
-
handleRowCache(row, index, items, index, null,
|
|
3290
|
+
handleRowCache(row, index, items, index, null, handleUpdateRowId(row), 0, index + 1);
|
|
3097
3291
|
});
|
|
3098
3292
|
}
|
|
3099
3293
|
internalData.fullDataRowIdData = fullDataRowIdMaps;
|
|
3100
3294
|
internalData.fullAllDataRowIdData = fullAllDataRowIdMaps;
|
|
3101
|
-
reactData.
|
|
3295
|
+
reactData.treeExpandedFlag++;
|
|
3102
3296
|
},
|
|
3103
3297
|
cacheSourceMap(fullData) {
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3298
|
+
const $xeTable = this;
|
|
3299
|
+
const props = $xeTable;
|
|
3300
|
+
const internalData = $xeTable;
|
|
3301
|
+
const {
|
|
3302
|
+
treeConfig
|
|
3303
|
+
} = props;
|
|
3304
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
3109
3305
|
const sourceData = _xeUtils.default.clone(fullData, true);
|
|
3110
|
-
const
|
|
3111
|
-
|
|
3306
|
+
const {
|
|
3307
|
+
handleUpdateRowId
|
|
3308
|
+
} = (0, _util.createHandleUpdateRowId)($xeTable);
|
|
3309
|
+
const sourceRowIdData = {};
|
|
3112
3310
|
const handleSourceRow = row => {
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
rowid = (0, _util.getRowUniqueId)();
|
|
3116
|
-
_xeUtils.default.set(row, rowkey, rowid);
|
|
3117
|
-
}
|
|
3118
|
-
sourceDataRowIdData[rowid] = {
|
|
3119
|
-
row,
|
|
3120
|
-
rowid
|
|
3121
|
-
};
|
|
3311
|
+
const rowid = handleUpdateRowId(row);
|
|
3312
|
+
sourceRowIdData[rowid] = row;
|
|
3122
3313
|
};
|
|
3123
3314
|
// 源数据缓存
|
|
3124
3315
|
if (treeConfig) {
|
|
@@ -3129,7 +3320,8 @@ const Methods = {
|
|
|
3129
3320
|
} else {
|
|
3130
3321
|
sourceData.forEach(handleSourceRow);
|
|
3131
3322
|
}
|
|
3132
|
-
|
|
3323
|
+
internalData.sourceDataRowIdData = sourceRowIdData;
|
|
3324
|
+
internalData.tableSourceData = sourceData;
|
|
3133
3325
|
},
|
|
3134
3326
|
getParams() {
|
|
3135
3327
|
return this.params;
|
|
@@ -3249,76 +3441,28 @@ const Methods = {
|
|
|
3249
3441
|
* 根据 row 获取序号
|
|
3250
3442
|
* @param {Row} row 行对象
|
|
3251
3443
|
*/
|
|
3252
|
-
getRowSeq(
|
|
3253
|
-
const {
|
|
3254
|
-
fullAllDataRowIdData
|
|
3255
|
-
} = this;
|
|
3256
|
-
if (row) {
|
|
3257
|
-
const rowid = (0, _util.getRowid)(this, row);
|
|
3258
|
-
const rest = fullAllDataRowIdData[rowid];
|
|
3259
|
-
if (rest) {
|
|
3260
|
-
return rest.seq;
|
|
3261
|
-
}
|
|
3262
|
-
}
|
|
3263
|
-
return -1;
|
|
3264
|
-
},
|
|
3444
|
+
getRowSeq: createGetRowCacheProp('seq'),
|
|
3265
3445
|
/**
|
|
3266
3446
|
* 根据 row 获取相对于 data 中的索引
|
|
3267
3447
|
* @param {Row} row 行对象
|
|
3268
3448
|
*/
|
|
3269
|
-
getRowIndex(
|
|
3270
|
-
const {
|
|
3271
|
-
fullAllDataRowIdData
|
|
3272
|
-
} = this;
|
|
3273
|
-
if (row) {
|
|
3274
|
-
const rowid = (0, _util.getRowid)(this, row);
|
|
3275
|
-
const rest = fullAllDataRowIdData[rowid];
|
|
3276
|
-
if (rest) {
|
|
3277
|
-
return rest.index;
|
|
3278
|
-
}
|
|
3279
|
-
}
|
|
3280
|
-
return -1;
|
|
3281
|
-
},
|
|
3449
|
+
getRowIndex: createGetRowCacheProp('index'),
|
|
3282
3450
|
/**
|
|
3283
3451
|
* 根据 row 获取相对于当前数据中的索引
|
|
3284
3452
|
* @param {Row} row 行对象
|
|
3285
3453
|
*/
|
|
3286
|
-
getVTRowIndex(
|
|
3287
|
-
const {
|
|
3288
|
-
fullAllDataRowIdData
|
|
3289
|
-
} = this;
|
|
3290
|
-
if (row) {
|
|
3291
|
-
const rowid = (0, _util.getRowid)(this, row);
|
|
3292
|
-
const rest = fullAllDataRowIdData[rowid];
|
|
3293
|
-
if (rest) {
|
|
3294
|
-
return rest._index;
|
|
3295
|
-
}
|
|
3296
|
-
}
|
|
3297
|
-
return -1;
|
|
3298
|
-
},
|
|
3299
|
-
// 在 v3 中废弃
|
|
3300
|
-
_getRowIndex(row) {
|
|
3301
|
-
if (process.env.NODE_ENV === 'development') {
|
|
3302
|
-
(0, _log.warnLog)('vxe.error.delFunc', ['_getRowIndex', 'getVTRowIndex']);
|
|
3303
|
-
}
|
|
3304
|
-
return this.getVTRowIndex(row);
|
|
3305
|
-
},
|
|
3454
|
+
getVTRowIndex: createGetRowCacheProp('_index'),
|
|
3306
3455
|
/**
|
|
3307
|
-
* 根据 row 获取渲染中的虚拟索引
|
|
3308
|
-
* @param {Row} row 行对象
|
|
3309
|
-
*/
|
|
3310
|
-
getVMRowIndex(
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
const rowid = (0, _util.getRowid)(this, row);
|
|
3316
|
-
const rest = fullAllDataRowIdData[rowid];
|
|
3317
|
-
if (rest) {
|
|
3318
|
-
return rest.$index;
|
|
3319
|
-
}
|
|
3456
|
+
* 根据 row 获取渲染中的虚拟索引
|
|
3457
|
+
* @param {Row} row 行对象
|
|
3458
|
+
*/
|
|
3459
|
+
getVMRowIndex: createGetRowCacheProp('$index'),
|
|
3460
|
+
// 在 v3 中废弃
|
|
3461
|
+
_getRowIndex(row) {
|
|
3462
|
+
if (process.env.NODE_ENV === 'development') {
|
|
3463
|
+
(0, _log.warnLog)('vxe.error.delFunc', ['_getRowIndex', 'getVTRowIndex']);
|
|
3320
3464
|
}
|
|
3321
|
-
return
|
|
3465
|
+
return this.getVTRowIndex(row);
|
|
3322
3466
|
},
|
|
3323
3467
|
// 在 v3 中废弃
|
|
3324
3468
|
$getRowIndex(row) {
|
|
@@ -3331,34 +3475,17 @@ const Methods = {
|
|
|
3331
3475
|
* 根据 column 获取相对于 columns 中的索引
|
|
3332
3476
|
* @param {ColumnInfo} column 列配置
|
|
3333
3477
|
*/
|
|
3334
|
-
getColumnIndex(
|
|
3335
|
-
const {
|
|
3336
|
-
fullColumnIdData
|
|
3337
|
-
} = this;
|
|
3338
|
-
if (column) {
|
|
3339
|
-
const rest = fullColumnIdData[column.id];
|
|
3340
|
-
if (rest) {
|
|
3341
|
-
return rest.index;
|
|
3342
|
-
}
|
|
3343
|
-
}
|
|
3344
|
-
return -1;
|
|
3345
|
-
},
|
|
3478
|
+
getColumnIndex: createGetColumnCacheProp('index'),
|
|
3346
3479
|
/**
|
|
3347
3480
|
* 根据 column 获取相对于当前表格列中的索引
|
|
3348
3481
|
* @param {ColumnInfo} column 列配置
|
|
3349
3482
|
*/
|
|
3350
|
-
getVTColumnIndex(
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
if (rest) {
|
|
3357
|
-
return rest._index;
|
|
3358
|
-
}
|
|
3359
|
-
}
|
|
3360
|
-
return -1;
|
|
3361
|
-
},
|
|
3483
|
+
getVTColumnIndex: createGetColumnCacheProp('_index'),
|
|
3484
|
+
/**
|
|
3485
|
+
* 根据 column 获取渲染中的虚拟索引
|
|
3486
|
+
* @param {ColumnInfo} column 列配置
|
|
3487
|
+
*/
|
|
3488
|
+
getVMColumnIndex: createGetColumnCacheProp('$index'),
|
|
3362
3489
|
// 在 v3 中废弃
|
|
3363
3490
|
_getColumnIndex(column) {
|
|
3364
3491
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -3366,22 +3493,6 @@ const Methods = {
|
|
|
3366
3493
|
}
|
|
3367
3494
|
return this.getVTColumnIndex(column);
|
|
3368
3495
|
},
|
|
3369
|
-
/**
|
|
3370
|
-
* 根据 column 获取渲染中的虚拟索引
|
|
3371
|
-
* @param {ColumnInfo} column 列配置
|
|
3372
|
-
*/
|
|
3373
|
-
getVMColumnIndex(column) {
|
|
3374
|
-
const {
|
|
3375
|
-
fullColumnIdData
|
|
3376
|
-
} = this;
|
|
3377
|
-
if (column) {
|
|
3378
|
-
const rest = fullColumnIdData[column.id];
|
|
3379
|
-
if (rest) {
|
|
3380
|
-
return rest.$index;
|
|
3381
|
-
}
|
|
3382
|
-
}
|
|
3383
|
-
return -1;
|
|
3384
|
-
},
|
|
3385
3496
|
// 在 v3 中废弃
|
|
3386
3497
|
$getColumnIndex(column) {
|
|
3387
3498
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -3490,6 +3601,9 @@ const Methods = {
|
|
|
3490
3601
|
keepSource,
|
|
3491
3602
|
treeConfig
|
|
3492
3603
|
} = props;
|
|
3604
|
+
const {
|
|
3605
|
+
editStore
|
|
3606
|
+
} = reactData;
|
|
3493
3607
|
const {
|
|
3494
3608
|
fullAllDataRowIdData,
|
|
3495
3609
|
fullDataRowIdData,
|
|
@@ -3498,10 +3612,14 @@ const Methods = {
|
|
|
3498
3612
|
tableFullData,
|
|
3499
3613
|
afterFullData
|
|
3500
3614
|
} = internalData;
|
|
3615
|
+
const removeTempMaps = Object.assign({}, editStore.removeMaps);
|
|
3501
3616
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
3502
3617
|
const {
|
|
3503
3618
|
transform
|
|
3504
3619
|
} = treeOpts;
|
|
3620
|
+
const {
|
|
3621
|
+
handleGetRowId
|
|
3622
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
3505
3623
|
if (!keepSource) {
|
|
3506
3624
|
if (process.env.NODE_ENV === 'development') {
|
|
3507
3625
|
(0, _log.errLog)('vxe.error.reqProp', ['keep-source']);
|
|
@@ -3519,7 +3637,7 @@ const Methods = {
|
|
|
3519
3637
|
let reDelFlag = false;
|
|
3520
3638
|
if (targetRows.length) {
|
|
3521
3639
|
targetRows.forEach(item => {
|
|
3522
|
-
const rowid = (
|
|
3640
|
+
const rowid = handleGetRowId(item);
|
|
3523
3641
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
3524
3642
|
if (rowRest) {
|
|
3525
3643
|
const row = rowRest.row;
|
|
@@ -3532,6 +3650,7 @@ const Methods = {
|
|
|
3532
3650
|
_xeUtils.default.destructuring(row, _xeUtils.default.clone(oRow, true));
|
|
3533
3651
|
}
|
|
3534
3652
|
if (!fullDataRowIdData[rowid] && $xeTable.isRemoveByRow(row)) {
|
|
3653
|
+
delete removeTempMaps[rowid];
|
|
3535
3654
|
tableFullData.unshift(row);
|
|
3536
3655
|
afterFullData.unshift(row);
|
|
3537
3656
|
reDelFlag = true;
|
|
@@ -3543,6 +3662,7 @@ const Methods = {
|
|
|
3543
3662
|
}
|
|
3544
3663
|
if (rows) {
|
|
3545
3664
|
if (reDelFlag) {
|
|
3665
|
+
editStore.removeMaps = removeTempMaps;
|
|
3546
3666
|
$xeTable.updateFooter();
|
|
3547
3667
|
$xeTable.cacheRowMap(false);
|
|
3548
3668
|
$xeTable.handleTableData(treeConfig && transform);
|
|
@@ -3939,21 +4059,18 @@ const Methods = {
|
|
|
3939
4059
|
getCheckboxRecords(isFull) {
|
|
3940
4060
|
const $xeTable = this;
|
|
3941
4061
|
const props = $xeTable;
|
|
3942
|
-
const reactData = $xeTable;
|
|
3943
4062
|
const internalData = $xeTable;
|
|
3944
4063
|
const {
|
|
3945
4064
|
treeConfig
|
|
3946
4065
|
} = props;
|
|
3947
|
-
const {
|
|
3948
|
-
selectCheckboxMaps
|
|
3949
|
-
} = reactData;
|
|
3950
4066
|
const {
|
|
3951
4067
|
tableFullData,
|
|
3952
4068
|
afterFullData,
|
|
3953
4069
|
afterTreeFullData,
|
|
3954
4070
|
tableFullTreeData,
|
|
3955
4071
|
fullDataRowIdData,
|
|
3956
|
-
afterFullRowMaps
|
|
4072
|
+
afterFullRowMaps,
|
|
4073
|
+
selectCheckboxMaps
|
|
3957
4074
|
} = internalData;
|
|
3958
4075
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
3959
4076
|
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
@@ -4018,6 +4135,7 @@ const Methods = {
|
|
|
4018
4135
|
mapChildrenField
|
|
4019
4136
|
} = treeOpts;
|
|
4020
4137
|
const {
|
|
4138
|
+
isEvery,
|
|
4021
4139
|
remote: allRemoteFilter,
|
|
4022
4140
|
filterMethod: allFilterMethod
|
|
4023
4141
|
} = filterOpts;
|
|
@@ -4130,7 +4248,7 @@ const Methods = {
|
|
|
4130
4248
|
// 筛选虚拟树
|
|
4131
4249
|
tableTree = _xeUtils.default.searchTree(tableFullTreeData, handleFilter, {
|
|
4132
4250
|
original: true,
|
|
4133
|
-
isEvery
|
|
4251
|
+
isEvery,
|
|
4134
4252
|
children: mapChildrenField,
|
|
4135
4253
|
mapChildren: childrenField
|
|
4136
4254
|
});
|
|
@@ -4144,7 +4262,7 @@ const Methods = {
|
|
|
4144
4262
|
// 还原虚拟树
|
|
4145
4263
|
tableTree = _xeUtils.default.searchTree(tableFullTreeData, () => true, {
|
|
4146
4264
|
original: true,
|
|
4147
|
-
isEvery
|
|
4265
|
+
isEvery,
|
|
4148
4266
|
children: mapChildrenField,
|
|
4149
4267
|
mapChildren: childrenField
|
|
4150
4268
|
});
|
|
@@ -4221,7 +4339,7 @@ const Methods = {
|
|
|
4221
4339
|
// 还原虚拟树
|
|
4222
4340
|
tableTree = _xeUtils.default.searchTree(tableFullTreeData, () => true, {
|
|
4223
4341
|
original: true,
|
|
4224
|
-
isEvery
|
|
4342
|
+
isEvery,
|
|
4225
4343
|
children: treeOpts.mapChildrenField,
|
|
4226
4344
|
mapChildren: childrenField
|
|
4227
4345
|
});
|
|
@@ -4395,6 +4513,7 @@ const Methods = {
|
|
|
4395
4513
|
* 默认执行一次,除非被重置
|
|
4396
4514
|
*/
|
|
4397
4515
|
handleLoadDefaults() {
|
|
4516
|
+
const $xeTable = this;
|
|
4398
4517
|
if (this.checkboxConfig) {
|
|
4399
4518
|
this.handleDefaultSelectionChecked();
|
|
4400
4519
|
}
|
|
@@ -4405,7 +4524,7 @@ const Methods = {
|
|
|
4405
4524
|
this.handleDefaultRowExpand();
|
|
4406
4525
|
}
|
|
4407
4526
|
if (this.treeConfig) {
|
|
4408
|
-
|
|
4527
|
+
handleDefaultTreeExpand($xeTable);
|
|
4409
4528
|
}
|
|
4410
4529
|
if (this.mergeCells) {
|
|
4411
4530
|
this.handleDefaultMergeCells();
|
|
@@ -4603,9 +4722,9 @@ const Methods = {
|
|
|
4603
4722
|
return this.refreshColumn(true);
|
|
4604
4723
|
},
|
|
4605
4724
|
handleCustomRestore(storeData) {
|
|
4606
|
-
const $
|
|
4607
|
-
const reactData = $
|
|
4608
|
-
const internalData = $
|
|
4725
|
+
const $xeTable = this;
|
|
4726
|
+
const reactData = $xeTable;
|
|
4727
|
+
const internalData = $xeTable;
|
|
4609
4728
|
let {
|
|
4610
4729
|
collectColumn
|
|
4611
4730
|
} = internalData;
|
|
@@ -4690,14 +4809,26 @@ const Methods = {
|
|
|
4690
4809
|
}
|
|
4691
4810
|
},
|
|
4692
4811
|
getCustomStoreData() {
|
|
4812
|
+
const $xeTable = this;
|
|
4813
|
+
const props = $xeTable;
|
|
4814
|
+
const internalData = $xeTable;
|
|
4815
|
+
const {
|
|
4816
|
+
id
|
|
4817
|
+
} = props;
|
|
4818
|
+
const customOpts = $xeTable.computeCustomOpts;
|
|
4693
4819
|
const {
|
|
4694
|
-
id,
|
|
4695
|
-
customOpts,
|
|
4696
4820
|
collectColumn
|
|
4697
|
-
} =
|
|
4821
|
+
} = internalData;
|
|
4698
4822
|
const {
|
|
4823
|
+
storage,
|
|
4699
4824
|
checkMethod
|
|
4700
4825
|
} = customOpts;
|
|
4826
|
+
const isAllCustom = storage === true;
|
|
4827
|
+
const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {});
|
|
4828
|
+
const isCustomResizable = isAllCustom || storageOpts.resizable;
|
|
4829
|
+
const isCustomVisible = isAllCustom || storageOpts.visible;
|
|
4830
|
+
const isCustomFixed = isAllCustom || storageOpts.fixed;
|
|
4831
|
+
const isCustomSort = isAllCustom || storageOpts.sort;
|
|
4701
4832
|
const resizableData = {};
|
|
4702
4833
|
const sortData = {};
|
|
4703
4834
|
const visibleData = {};
|
|
@@ -4714,48 +4845,38 @@ const Methods = {
|
|
|
4714
4845
|
}
|
|
4715
4846
|
let hasResizable = 0;
|
|
4716
4847
|
let hasSort = 0;
|
|
4717
|
-
let
|
|
4848
|
+
let hasFixed = 0;
|
|
4718
4849
|
let hasVisible = 0;
|
|
4719
4850
|
_xeUtils.default.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
4851
|
+
const colKey = column.getKey();
|
|
4852
|
+
if (!colKey) {
|
|
4853
|
+
(0, _log.errLog)('vxe.error.reqProp', [`${column.getTitle() || column.type || ''} -> column.field=?`]);
|
|
4854
|
+
return;
|
|
4855
|
+
}
|
|
4720
4856
|
// 只支持一级
|
|
4721
4857
|
if (!parentColumn) {
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
hasSort = 1;
|
|
4726
|
-
sortData[colKey] = column.renderSortNumber;
|
|
4727
|
-
}
|
|
4728
|
-
});
|
|
4729
|
-
if (column.fixed !== column.defaultFixed) {
|
|
4730
|
-
const colKey = column.getKey();
|
|
4731
|
-
if (colKey) {
|
|
4732
|
-
hasFixedt = 1;
|
|
4733
|
-
fixedData[colKey] = column.fixed;
|
|
4734
|
-
}
|
|
4858
|
+
if (isCustomSort) {
|
|
4859
|
+
hasSort = 1;
|
|
4860
|
+
sortData[colKey] = column.renderSortNumber;
|
|
4735
4861
|
}
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
if (colKey) {
|
|
4740
|
-
hasResizable = 1;
|
|
4741
|
-
resizableData[colKey] = column.renderWidth;
|
|
4862
|
+
if (isCustomFixed && column.fixed !== column.defaultFixed) {
|
|
4863
|
+
hasFixed = 1;
|
|
4864
|
+
fixedData[colKey] = column.fixed;
|
|
4742
4865
|
}
|
|
4743
4866
|
}
|
|
4744
|
-
if (
|
|
4867
|
+
if (isCustomResizable && column.resizeWidth) {
|
|
4868
|
+
hasResizable = 1;
|
|
4869
|
+
resizableData[colKey] = column.renderWidth;
|
|
4870
|
+
}
|
|
4871
|
+
if (isCustomVisible && (!checkMethod || checkMethod({
|
|
4745
4872
|
column
|
|
4746
|
-
})) {
|
|
4873
|
+
}))) {
|
|
4747
4874
|
if (!column.visible && column.defaultVisible) {
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
hasVisible = 1;
|
|
4751
|
-
visibleData[colKey] = false;
|
|
4752
|
-
}
|
|
4875
|
+
hasVisible = 1;
|
|
4876
|
+
visibleData[colKey] = false;
|
|
4753
4877
|
} else if (column.visible && !column.defaultVisible) {
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
hasVisible = 1;
|
|
4757
|
-
visibleData[colKey] = true;
|
|
4758
|
-
}
|
|
4878
|
+
hasVisible = 1;
|
|
4879
|
+
visibleData[colKey] = true;
|
|
4759
4880
|
}
|
|
4760
4881
|
}
|
|
4761
4882
|
});
|
|
@@ -4765,7 +4886,7 @@ const Methods = {
|
|
|
4765
4886
|
if (hasSort) {
|
|
4766
4887
|
storeData.sortData = sortData;
|
|
4767
4888
|
}
|
|
4768
|
-
if (
|
|
4889
|
+
if (hasFixed) {
|
|
4769
4890
|
storeData.fixedData = fixedData;
|
|
4770
4891
|
}
|
|
4771
4892
|
if (hasVisible) {
|
|
@@ -5313,12 +5434,15 @@ const Methods = {
|
|
|
5313
5434
|
fullAllDataRowIdData,
|
|
5314
5435
|
afterFullData
|
|
5315
5436
|
} = internalData;
|
|
5437
|
+
const {
|
|
5438
|
+
handleGetRowId
|
|
5439
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
5316
5440
|
const rowOpts = $xeTable.computeRowOpts;
|
|
5317
5441
|
const cellOpts = $xeTable.computeCellOpts;
|
|
5318
5442
|
const defaultRowHeight = $xeTable.computeDefaultRowHeight;
|
|
5319
5443
|
const rest = {};
|
|
5320
5444
|
afterFullData.forEach(row => {
|
|
5321
|
-
const rowid = (
|
|
5445
|
+
const rowid = handleGetRowId(row);
|
|
5322
5446
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
5323
5447
|
if (rowRest) {
|
|
5324
5448
|
const resizeHeight = rowRest.resizeHeight;
|
|
@@ -5347,8 +5471,11 @@ const Methods = {
|
|
|
5347
5471
|
rHeight = Math.floor(rHeight * bodyHeight);
|
|
5348
5472
|
}
|
|
5349
5473
|
if (rHeight) {
|
|
5474
|
+
const {
|
|
5475
|
+
handleGetRowId
|
|
5476
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
5350
5477
|
rows.forEach(row => {
|
|
5351
|
-
const rowid = _xeUtils.default.isString(row) || _xeUtils.default.isNumber(row) ? row : (
|
|
5478
|
+
const rowid = _xeUtils.default.isString(row) || _xeUtils.default.isNumber(row) ? row : handleGetRowId(row);
|
|
5352
5479
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
5353
5480
|
if (rowRest) {
|
|
5354
5481
|
rowRest.resizeHeight = rHeight;
|
|
@@ -5496,6 +5623,8 @@ const Methods = {
|
|
|
5496
5623
|
}
|
|
5497
5624
|
},
|
|
5498
5625
|
preventEvent(evnt, type, args, next, end) {
|
|
5626
|
+
const $xeTable = this;
|
|
5627
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
5499
5628
|
let evntList = interceptor.get(type);
|
|
5500
5629
|
// 兼容老版本
|
|
5501
5630
|
if (!evntList.length && type === 'event.clearEdit') {
|
|
@@ -5507,12 +5636,25 @@ const Methods = {
|
|
|
5507
5636
|
}
|
|
5508
5637
|
}
|
|
5509
5638
|
// 兼容老版本
|
|
5510
|
-
let rest;
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5639
|
+
let rest = null;
|
|
5640
|
+
let isStop = false;
|
|
5641
|
+
for (let i = 0; i < evntList.length; i++) {
|
|
5642
|
+
const func = evntList[i];
|
|
5643
|
+
const fnRest = func(Object.assign({
|
|
5644
|
+
$grid: $xeGrid,
|
|
5645
|
+
$table: $xeTable,
|
|
5646
|
+
$event: evnt
|
|
5647
|
+
}, args));
|
|
5648
|
+
if (fnRest === false) {
|
|
5649
|
+
isStop = true;
|
|
5650
|
+
break;
|
|
5651
|
+
} else if (fnRest && fnRest.status === false) {
|
|
5652
|
+
rest = fnRest.result;
|
|
5653
|
+
isStop = true;
|
|
5654
|
+
break;
|
|
5655
|
+
}
|
|
5656
|
+
}
|
|
5657
|
+
if (!isStop) {
|
|
5516
5658
|
if (next) {
|
|
5517
5659
|
rest = next();
|
|
5518
5660
|
}
|
|
@@ -5526,10 +5668,11 @@ const Methods = {
|
|
|
5526
5668
|
* 全局按下事件处理
|
|
5527
5669
|
*/
|
|
5528
5670
|
handleGlobalMousedownEvent(evnt) {
|
|
5671
|
+
const $xeTable = this;
|
|
5672
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
5529
5673
|
const {
|
|
5530
5674
|
$el,
|
|
5531
5675
|
$refs,
|
|
5532
|
-
$xegrid,
|
|
5533
5676
|
$toolbar,
|
|
5534
5677
|
mouseConfig,
|
|
5535
5678
|
editStore,
|
|
@@ -5629,7 +5772,7 @@ const Methods = {
|
|
|
5629
5772
|
}
|
|
5630
5773
|
}
|
|
5631
5774
|
} else if (mouseConfig) {
|
|
5632
|
-
if (!(0, _dom.getEventTargetNode)(evnt, $el).flag && !($
|
|
5775
|
+
if (!(0, _dom.getEventTargetNode)(evnt, $el).flag && !($xeGrid && (0, _dom.getEventTargetNode)(evnt, $xeGrid.$el).flag) && !(tableMenu && (0, _dom.getEventTargetNode)(evnt, tableMenu.$el).flag) && !($toolbar && (0, _dom.getEventTargetNode)(evnt, $toolbar.$el).flag)) {
|
|
5633
5776
|
if (this.clearSelected) {
|
|
5634
5777
|
this.clearSelected();
|
|
5635
5778
|
}
|
|
@@ -5653,7 +5796,7 @@ const Methods = {
|
|
|
5653
5796
|
if (ctxMenuStore.visible && tableMenu && !(0, _dom.getEventTargetNode)(evnt, tableMenu.$el).flag) {
|
|
5654
5797
|
this.closeMenu();
|
|
5655
5798
|
}
|
|
5656
|
-
const isActivated = (0, _dom.getEventTargetNode)(evnt, ($
|
|
5799
|
+
const isActivated = (0, _dom.getEventTargetNode)(evnt, ($xeGrid || this).$el).flag;
|
|
5657
5800
|
// 如果存在校验,点击了表格之外则清除
|
|
5658
5801
|
if (!isActivated && editRules && validOpts.autoClear) {
|
|
5659
5802
|
this.validErrorMaps = {};
|
|
@@ -5728,6 +5871,7 @@ const Methods = {
|
|
|
5728
5871
|
handleGlobalKeydownEvent(evnt) {
|
|
5729
5872
|
const $xeTable = this;
|
|
5730
5873
|
const internalData = $xeTable;
|
|
5874
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
5731
5875
|
// 该行为只对当前激活的表格有效
|
|
5732
5876
|
if (this.isActivated) {
|
|
5733
5877
|
this.preventEvent(evnt, 'event.keydown', null, () => {
|
|
@@ -5845,7 +5989,7 @@ const Methods = {
|
|
|
5845
5989
|
if (keyboardOpts.enterToTab) {
|
|
5846
5990
|
this.moveTabSelected(activeParams, hasShiftKey, evnt);
|
|
5847
5991
|
} else {
|
|
5848
|
-
this.
|
|
5992
|
+
this.moveEnterSelected(activeParams, isLeftArrow, true, isRightArrow, false, evnt);
|
|
5849
5993
|
}
|
|
5850
5994
|
} else {
|
|
5851
5995
|
if (keyboardOpts.enterToTab) {
|
|
@@ -5881,7 +6025,7 @@ const Methods = {
|
|
|
5881
6025
|
return;
|
|
5882
6026
|
}
|
|
5883
6027
|
}
|
|
5884
|
-
this.
|
|
6028
|
+
this.moveEnterSelected(activeParams, isLeftArrow, false, isRightArrow, true, evnt);
|
|
5885
6029
|
if (enterMethod) {
|
|
5886
6030
|
enterMethod(etrParams);
|
|
5887
6031
|
}
|
|
@@ -5906,10 +6050,7 @@ const Methods = {
|
|
|
5906
6050
|
if (!isEditStatus) {
|
|
5907
6051
|
// 如果按下了方向键
|
|
5908
6052
|
if (selected.row && selected.column) {
|
|
5909
|
-
|
|
5910
|
-
} else if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
|
|
5911
|
-
// 当前行按键上下移动
|
|
5912
|
-
this.moveCurrentRow(isUpArrow, isDwArrow, evnt);
|
|
6053
|
+
$xeTable.moveArrowSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt);
|
|
5913
6054
|
}
|
|
5914
6055
|
}
|
|
5915
6056
|
} else if (isTab && keyboardConfig && keyboardOpts.isTab) {
|
|
@@ -5931,7 +6072,7 @@ const Methods = {
|
|
|
5931
6072
|
column: selected.column,
|
|
5932
6073
|
columnIndex: this.getColumnIndex(selected.column),
|
|
5933
6074
|
$table: this,
|
|
5934
|
-
$grid:
|
|
6075
|
+
$grid: $xeGrid
|
|
5935
6076
|
};
|
|
5936
6077
|
// 是否被禁用
|
|
5937
6078
|
if (!beforeEditMethod || beforeEditMethod(params)) {
|
|
@@ -5959,7 +6100,7 @@ const Methods = {
|
|
|
5959
6100
|
column: selected.column,
|
|
5960
6101
|
columnIndex: this.getColumnIndex(selected.column),
|
|
5961
6102
|
$table: this,
|
|
5962
|
-
$grid:
|
|
6103
|
+
$grid: $xeGrid
|
|
5963
6104
|
};
|
|
5964
6105
|
// 是否被禁用
|
|
5965
6106
|
if (!beforeEditMethod || beforeEditMethod(params)) {
|
|
@@ -5990,7 +6131,7 @@ const Methods = {
|
|
|
5990
6131
|
rowIndex: this.getRowIndex(parentRow),
|
|
5991
6132
|
$rowIndex: this.getVMRowIndex(parentRow),
|
|
5992
6133
|
$table: this,
|
|
5993
|
-
$grid:
|
|
6134
|
+
$grid: $xeGrid
|
|
5994
6135
|
};
|
|
5995
6136
|
this.setTreeExpand(parentRow, false).then(() => this.scrollToRow(parentRow)).then(() => this.triggerCurrentRowEvent(evnt, params));
|
|
5996
6137
|
}
|
|
@@ -6011,7 +6152,7 @@ const Methods = {
|
|
|
6011
6152
|
column: selected.column,
|
|
6012
6153
|
columnIndex: this.getColumnIndex(selected.column),
|
|
6013
6154
|
$table: this,
|
|
6014
|
-
$grid:
|
|
6155
|
+
$grid: $xeGrid
|
|
6015
6156
|
};
|
|
6016
6157
|
if (!beforeEditMethod || beforeEditMethod(params)) {
|
|
6017
6158
|
if (editMethod) {
|
|
@@ -6168,7 +6309,7 @@ const Methods = {
|
|
|
6168
6309
|
return;
|
|
6169
6310
|
}
|
|
6170
6311
|
if (tooltipStore.column !== column || !tooltipStore.visible) {
|
|
6171
|
-
handleTooltip($xeTable, evnt, thEl, cellEl,
|
|
6312
|
+
handleTooltip($xeTable, evnt, thEl, thEl.querySelector('.vxe-cell--title') || cellEl, params);
|
|
6172
6313
|
}
|
|
6173
6314
|
},
|
|
6174
6315
|
/**
|
|
@@ -6209,7 +6350,7 @@ const Methods = {
|
|
|
6209
6350
|
}
|
|
6210
6351
|
}
|
|
6211
6352
|
if (tooltipStore.column !== column || tooltipStore.row !== row || !tooltipStore.visible) {
|
|
6212
|
-
handleTooltip($xeTable, evnt, tdEl, tdEl.querySelector('.vxe-cell--wrapper'),
|
|
6353
|
+
handleTooltip($xeTable, evnt, tdEl, tdEl.querySelector('.vxe-cell--label') || tdEl.querySelector('.vxe-cell--wrapper'), params);
|
|
6213
6354
|
}
|
|
6214
6355
|
},
|
|
6215
6356
|
/**
|
|
@@ -6224,10 +6365,10 @@ const Methods = {
|
|
|
6224
6365
|
const {
|
|
6225
6366
|
tooltipStore
|
|
6226
6367
|
} = reactData;
|
|
6227
|
-
const
|
|
6368
|
+
const tdEl = evnt.currentTarget;
|
|
6228
6369
|
handleTargetEnterEvent($xeTable, tooltipStore.column !== column || !!tooltipStore.row);
|
|
6229
6370
|
if (tooltipStore.column !== column || !tooltipStore.visible) {
|
|
6230
|
-
handleTooltip($xeTable, evnt,
|
|
6371
|
+
handleTooltip($xeTable, evnt, tdEl, tdEl.querySelector('.vxe-cell--label') || tdEl.querySelector('.vxe-cell--wrapper'), params);
|
|
6231
6372
|
}
|
|
6232
6373
|
},
|
|
6233
6374
|
openTooltip(target, content) {
|
|
@@ -6288,15 +6429,20 @@ const Methods = {
|
|
|
6288
6429
|
* 获取复选框半选状态的行数据
|
|
6289
6430
|
*/
|
|
6290
6431
|
getCheckboxIndeterminateRecords(isFull) {
|
|
6432
|
+
const $xeTable = this;
|
|
6433
|
+
const props = $xeTable;
|
|
6434
|
+
const internalData = $xeTable;
|
|
6291
6435
|
const {
|
|
6292
|
-
treeConfig
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6436
|
+
treeConfig
|
|
6437
|
+
} = props;
|
|
6438
|
+
const {
|
|
6439
|
+
fullDataRowIdData,
|
|
6440
|
+
treeIndeterminateRowMaps
|
|
6441
|
+
} = internalData;
|
|
6296
6442
|
if (treeConfig) {
|
|
6297
6443
|
const fullRest = [];
|
|
6298
6444
|
const defRest = [];
|
|
6299
|
-
_xeUtils.default.each(
|
|
6445
|
+
_xeUtils.default.each(treeIndeterminateRowMaps, (item, rowid) => {
|
|
6300
6446
|
if (item) {
|
|
6301
6447
|
fullRest.push(item);
|
|
6302
6448
|
if (fullDataRowIdData[rowid]) {
|
|
@@ -6373,9 +6519,13 @@ const Methods = {
|
|
|
6373
6519
|
isCheckedByCheckboxRow(row) {
|
|
6374
6520
|
const $xeTable = this;
|
|
6375
6521
|
const reactData = $xeTable;
|
|
6522
|
+
const internalData = $xeTable;
|
|
6376
6523
|
const {
|
|
6377
|
-
|
|
6524
|
+
updateCheckboxFlag
|
|
6378
6525
|
} = reactData;
|
|
6526
|
+
const {
|
|
6527
|
+
selectCheckboxMaps
|
|
6528
|
+
} = internalData;
|
|
6379
6529
|
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
6380
6530
|
const {
|
|
6381
6531
|
checkField
|
|
@@ -6383,17 +6533,18 @@ const Methods = {
|
|
|
6383
6533
|
if (checkField) {
|
|
6384
6534
|
return _xeUtils.default.get(row, checkField);
|
|
6385
6535
|
}
|
|
6386
|
-
return !!selectCheckboxMaps[(0, _util.getRowid)($xeTable, row)];
|
|
6536
|
+
return !!updateCheckboxFlag && !!selectCheckboxMaps[(0, _util.getRowid)($xeTable, row)];
|
|
6387
6537
|
},
|
|
6388
6538
|
isCheckedByCheckboxRowKey(rowid) {
|
|
6389
6539
|
const $xeTable = this;
|
|
6390
6540
|
const reactData = $xeTable;
|
|
6391
6541
|
const internalData = $xeTable;
|
|
6392
6542
|
const {
|
|
6393
|
-
|
|
6543
|
+
updateCheckboxFlag
|
|
6394
6544
|
} = reactData;
|
|
6395
6545
|
const {
|
|
6396
|
-
fullAllDataRowIdData
|
|
6546
|
+
fullAllDataRowIdData,
|
|
6547
|
+
selectCheckboxMaps
|
|
6397
6548
|
} = internalData;
|
|
6398
6549
|
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
6399
6550
|
const {
|
|
@@ -6406,23 +6557,23 @@ const Methods = {
|
|
|
6406
6557
|
}
|
|
6407
6558
|
return false;
|
|
6408
6559
|
}
|
|
6409
|
-
return !!selectCheckboxMaps[rowid];
|
|
6560
|
+
return !!updateCheckboxFlag && !!selectCheckboxMaps[rowid];
|
|
6410
6561
|
},
|
|
6411
6562
|
isIndeterminateByCheckboxRow(row) {
|
|
6412
6563
|
const $xeTable = this;
|
|
6413
|
-
const
|
|
6564
|
+
const internalData = $xeTable;
|
|
6414
6565
|
const {
|
|
6415
|
-
|
|
6416
|
-
} =
|
|
6417
|
-
return !!
|
|
6566
|
+
treeIndeterminateRowMaps
|
|
6567
|
+
} = internalData;
|
|
6568
|
+
return !!treeIndeterminateRowMaps[(0, _util.getRowid)($xeTable, row)] && !$xeTable.isCheckedByCheckboxRow(row);
|
|
6418
6569
|
},
|
|
6419
6570
|
isIndeterminateByCheckboxRowKey(rowid) {
|
|
6420
6571
|
const $xeTable = this;
|
|
6421
|
-
const
|
|
6572
|
+
const internalData = $xeTable;
|
|
6422
6573
|
const {
|
|
6423
|
-
|
|
6424
|
-
} =
|
|
6425
|
-
return !!
|
|
6574
|
+
treeIndeterminateRowMaps
|
|
6575
|
+
} = internalData;
|
|
6576
|
+
return !!treeIndeterminateRowMaps[rowid] && !$xeTable.isCheckedByCheckboxRowKey(rowid);
|
|
6426
6577
|
},
|
|
6427
6578
|
/**
|
|
6428
6579
|
* 切换选中
|
|
@@ -6432,13 +6583,13 @@ const Methods = {
|
|
|
6432
6583
|
const $xeTable = this;
|
|
6433
6584
|
const props = $xeTable;
|
|
6434
6585
|
const reactData = $xeTable;
|
|
6586
|
+
const internalData = $xeTable;
|
|
6435
6587
|
const {
|
|
6436
6588
|
treeConfig
|
|
6437
6589
|
} = props;
|
|
6438
6590
|
const {
|
|
6439
6591
|
selectCheckboxMaps
|
|
6440
|
-
} =
|
|
6441
|
-
const selectRowMaps = Object.assign({}, selectCheckboxMaps);
|
|
6592
|
+
} = internalData;
|
|
6442
6593
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
6443
6594
|
const {
|
|
6444
6595
|
transform,
|
|
@@ -6451,6 +6602,9 @@ const Methods = {
|
|
|
6451
6602
|
checkStrictly,
|
|
6452
6603
|
checkMethod
|
|
6453
6604
|
} = checkboxOpts;
|
|
6605
|
+
const {
|
|
6606
|
+
handleGetRowId
|
|
6607
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
6454
6608
|
// indeterminateField 仅支持读取
|
|
6455
6609
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
6456
6610
|
if (checkField) {
|
|
@@ -6470,35 +6624,34 @@ const Methods = {
|
|
|
6470
6624
|
}, {
|
|
6471
6625
|
children: transform ? mapChildrenField : childrenField
|
|
6472
6626
|
});
|
|
6473
|
-
reactData.
|
|
6627
|
+
reactData.updateCheckboxFlag++;
|
|
6474
6628
|
return;
|
|
6475
|
-
} else {
|
|
6476
|
-
// 列表
|
|
6477
|
-
rows.forEach(row => {
|
|
6478
|
-
if (isForce || !checkMethod || checkMethod({
|
|
6479
|
-
row
|
|
6480
|
-
})) {
|
|
6481
|
-
_xeUtils.default.set(row, checkField, checked);
|
|
6482
|
-
handleCheckboxReserveRow($xeTable, row, checked);
|
|
6483
|
-
}
|
|
6484
|
-
});
|
|
6485
6629
|
}
|
|
6486
|
-
|
|
6630
|
+
// 列表
|
|
6631
|
+
rows.forEach(row => {
|
|
6632
|
+
if (isForce || !checkMethod || checkMethod({
|
|
6633
|
+
row
|
|
6634
|
+
})) {
|
|
6635
|
+
_xeUtils.default.set(row, checkField, checked);
|
|
6636
|
+
handleCheckboxReserveRow($xeTable, row, checked);
|
|
6637
|
+
}
|
|
6638
|
+
});
|
|
6639
|
+
reactData.updateCheckboxFlag++;
|
|
6487
6640
|
return;
|
|
6488
6641
|
}
|
|
6489
6642
|
// 树结构
|
|
6490
6643
|
if (treeConfig && !checkStrictly) {
|
|
6491
6644
|
// 更新子节点状态
|
|
6492
6645
|
_xeUtils.default.eachTree(rows, row => {
|
|
6493
|
-
const rowid = (
|
|
6646
|
+
const rowid = handleGetRowId(row);
|
|
6494
6647
|
if (isForce || !checkMethod || checkMethod({
|
|
6495
6648
|
row
|
|
6496
6649
|
})) {
|
|
6497
6650
|
if (checked) {
|
|
6498
|
-
|
|
6651
|
+
selectCheckboxMaps[rowid] = row;
|
|
6499
6652
|
} else {
|
|
6500
|
-
if (
|
|
6501
|
-
delete
|
|
6653
|
+
if (selectCheckboxMaps[rowid]) {
|
|
6654
|
+
delete selectCheckboxMaps[rowid];
|
|
6502
6655
|
}
|
|
6503
6656
|
}
|
|
6504
6657
|
handleCheckboxReserveRow($xeTable, row, checked);
|
|
@@ -6506,28 +6659,28 @@ const Methods = {
|
|
|
6506
6659
|
}, {
|
|
6507
6660
|
children: transform ? mapChildrenField : childrenField
|
|
6508
6661
|
});
|
|
6509
|
-
reactData.
|
|
6662
|
+
reactData.updateCheckboxFlag++;
|
|
6510
6663
|
return;
|
|
6511
6664
|
}
|
|
6512
6665
|
// 列表
|
|
6513
6666
|
rows.forEach(row => {
|
|
6514
|
-
const rowid = (
|
|
6667
|
+
const rowid = handleGetRowId(row);
|
|
6515
6668
|
if (isForce || !checkMethod || checkMethod({
|
|
6516
6669
|
row
|
|
6517
6670
|
})) {
|
|
6518
6671
|
if (checked) {
|
|
6519
|
-
if (!
|
|
6520
|
-
|
|
6672
|
+
if (!selectCheckboxMaps[rowid]) {
|
|
6673
|
+
selectCheckboxMaps[rowid] = row;
|
|
6521
6674
|
}
|
|
6522
6675
|
} else {
|
|
6523
|
-
if (
|
|
6524
|
-
delete
|
|
6676
|
+
if (selectCheckboxMaps[rowid]) {
|
|
6677
|
+
delete selectCheckboxMaps[rowid];
|
|
6525
6678
|
}
|
|
6526
6679
|
}
|
|
6527
6680
|
handleCheckboxReserveRow($xeTable, row, checked);
|
|
6681
|
+
reactData.updateCheckboxFlag++;
|
|
6528
6682
|
}
|
|
6529
6683
|
});
|
|
6530
|
-
reactData.selectCheckboxMaps = selectRowMaps;
|
|
6531
6684
|
},
|
|
6532
6685
|
/**
|
|
6533
6686
|
* 即将移除
|
|
@@ -6540,10 +6693,12 @@ const Methods = {
|
|
|
6540
6693
|
$xeTable.handleBatchSelectRows([row], checked, isForce);
|
|
6541
6694
|
},
|
|
6542
6695
|
handleToggleCheckRowEvent(evnt, params) {
|
|
6696
|
+
const $xeTable = this;
|
|
6697
|
+
const internalData = $xeTable;
|
|
6543
6698
|
const {
|
|
6544
|
-
selectCheckboxMaps
|
|
6545
|
-
|
|
6546
|
-
|
|
6699
|
+
selectCheckboxMaps
|
|
6700
|
+
} = internalData;
|
|
6701
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
6547
6702
|
const {
|
|
6548
6703
|
checkField,
|
|
6549
6704
|
trigger
|
|
@@ -6558,43 +6713,47 @@ const Methods = {
|
|
|
6558
6713
|
if (checkField) {
|
|
6559
6714
|
checked = !_xeUtils.default.get(row, checkField);
|
|
6560
6715
|
} else {
|
|
6561
|
-
checked = !selectCheckboxMaps[(0, _util.getRowid)(
|
|
6716
|
+
checked = !selectCheckboxMaps[(0, _util.getRowid)($xeTable, row)];
|
|
6562
6717
|
}
|
|
6563
6718
|
if (evnt) {
|
|
6564
|
-
|
|
6719
|
+
$xeTable.triggerCheckRowEvent(evnt, params, checked);
|
|
6565
6720
|
} else {
|
|
6566
|
-
|
|
6567
|
-
|
|
6721
|
+
$xeTable.handleBatchSelectRows([row], checked);
|
|
6722
|
+
$xeTable.checkSelectionStatus();
|
|
6568
6723
|
}
|
|
6569
6724
|
},
|
|
6570
6725
|
triggerCheckRowEvent(evnt, params, checked) {
|
|
6571
6726
|
const $xeTable = this;
|
|
6727
|
+
const props = $xeTable;
|
|
6728
|
+
const internalData = $xeTable;
|
|
6729
|
+
const {
|
|
6730
|
+
row
|
|
6731
|
+
} = params;
|
|
6572
6732
|
const {
|
|
6573
|
-
checkboxOpts,
|
|
6574
6733
|
afterFullData
|
|
6575
|
-
} =
|
|
6734
|
+
} = internalData;
|
|
6735
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
6576
6736
|
const {
|
|
6577
6737
|
checkMethod,
|
|
6578
6738
|
trigger
|
|
6579
6739
|
} = checkboxOpts;
|
|
6580
|
-
const {
|
|
6581
|
-
row
|
|
6582
|
-
} = params;
|
|
6583
6740
|
if (trigger === 'manual') {
|
|
6584
6741
|
return;
|
|
6585
6742
|
}
|
|
6586
6743
|
evnt.stopPropagation();
|
|
6587
|
-
if (checkboxOpts.isShiftKey && evnt.shiftKey && !
|
|
6588
|
-
const checkboxRecords =
|
|
6744
|
+
if (checkboxOpts.isShiftKey && evnt.shiftKey && !props.treeConfig) {
|
|
6745
|
+
const checkboxRecords = $xeTable.getCheckboxRecords();
|
|
6589
6746
|
if (checkboxRecords.length) {
|
|
6590
6747
|
const firstRow = checkboxRecords[0];
|
|
6591
|
-
const _rowIndex =
|
|
6592
|
-
const _firstRowIndex =
|
|
6748
|
+
const _rowIndex = $xeTable.getVTRowIndex(row);
|
|
6749
|
+
const _firstRowIndex = $xeTable.getVTRowIndex(firstRow);
|
|
6593
6750
|
if (_rowIndex !== _firstRowIndex) {
|
|
6594
|
-
|
|
6751
|
+
$xeTable.setAllCheckboxRow(false);
|
|
6595
6752
|
const rangeRows = _rowIndex < _firstRowIndex ? afterFullData.slice(_rowIndex, _firstRowIndex + 1) : afterFullData.slice(_firstRowIndex, _rowIndex + 1);
|
|
6596
|
-
|
|
6597
|
-
|
|
6753
|
+
$xeTable.$nextTick(() => {
|
|
6754
|
+
handleCheckedCheckboxRow($xeTable, rangeRows, true, false);
|
|
6755
|
+
});
|
|
6756
|
+
$xeTable.dispatchEvent('checkbox-range-select', Object.assign({
|
|
6598
6757
|
rangeRecords: rangeRows
|
|
6599
6758
|
}, params), evnt);
|
|
6600
6759
|
return;
|
|
@@ -6604,12 +6763,12 @@ const Methods = {
|
|
|
6604
6763
|
if (!checkMethod || checkMethod({
|
|
6605
6764
|
row
|
|
6606
6765
|
})) {
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
records:
|
|
6611
|
-
reserves:
|
|
6612
|
-
indeterminates:
|
|
6766
|
+
$xeTable.handleBatchSelectRows([row], checked);
|
|
6767
|
+
$xeTable.checkSelectionStatus();
|
|
6768
|
+
$xeTable.dispatchEvent('checkbox-change', Object.assign({
|
|
6769
|
+
records: () => $xeTable.getCheckboxRecords(),
|
|
6770
|
+
reserves: () => $xeTable.getCheckboxReserveRecords(),
|
|
6771
|
+
indeterminates: () => $xeTable.getCheckboxIndeterminateRecords(),
|
|
6613
6772
|
checked
|
|
6614
6773
|
}, params), evnt);
|
|
6615
6774
|
}
|
|
@@ -6619,10 +6778,11 @@ const Methods = {
|
|
|
6619
6778
|
*/
|
|
6620
6779
|
toggleCheckboxRow(row) {
|
|
6621
6780
|
const $xeTable = this;
|
|
6781
|
+
const internalData = $xeTable;
|
|
6622
6782
|
const {
|
|
6623
|
-
selectCheckboxMaps
|
|
6624
|
-
|
|
6625
|
-
|
|
6783
|
+
selectCheckboxMaps
|
|
6784
|
+
} = internalData;
|
|
6785
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
6626
6786
|
const {
|
|
6627
6787
|
checkField
|
|
6628
6788
|
} = checkboxOpts;
|
|
@@ -6649,10 +6809,8 @@ const Methods = {
|
|
|
6649
6809
|
} = props;
|
|
6650
6810
|
const {
|
|
6651
6811
|
selectCheckboxMaps,
|
|
6652
|
-
|
|
6653
|
-
} =
|
|
6654
|
-
const selectRowMaps = Object.assign({}, selectCheckboxMaps);
|
|
6655
|
-
const halfRowMaps = Object.assign({}, treeIndeterminateMaps);
|
|
6812
|
+
treeIndeterminateRowMaps
|
|
6813
|
+
} = internalData;
|
|
6656
6814
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
6657
6815
|
const {
|
|
6658
6816
|
transform,
|
|
@@ -6673,10 +6831,13 @@ const Methods = {
|
|
|
6673
6831
|
}
|
|
6674
6832
|
// 树结构
|
|
6675
6833
|
if (treeConfig) {
|
|
6834
|
+
const {
|
|
6835
|
+
handleGetRowId
|
|
6836
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
6676
6837
|
const childRowMaps = {};
|
|
6677
6838
|
const childRowList = [];
|
|
6678
6839
|
_xeUtils.default.eachTree(afterTreeFullData, row => {
|
|
6679
|
-
const rowid = (
|
|
6840
|
+
const rowid = handleGetRowId(row);
|
|
6680
6841
|
const childList = row[transform ? mapChildrenField : childrenField];
|
|
6681
6842
|
if (childList && childList.length && !childRowMaps[rowid]) {
|
|
6682
6843
|
childRowMaps[rowid] = 1;
|
|
@@ -6693,30 +6854,30 @@ const Methods = {
|
|
|
6693
6854
|
let hLen = 0; // 半选
|
|
6694
6855
|
let vLen = 0; // 有效行
|
|
6695
6856
|
childList.forEach(checkMethod ? item => {
|
|
6696
|
-
const childRowid = (
|
|
6697
|
-
const isSelect = checkField ? _xeUtils.default.get(item, checkField) :
|
|
6857
|
+
const childRowid = handleGetRowId(item);
|
|
6858
|
+
const isSelect = checkField ? _xeUtils.default.get(item, checkField) : selectCheckboxMaps[childRowid];
|
|
6698
6859
|
if (checkMethod({
|
|
6699
6860
|
row: item
|
|
6700
6861
|
})) {
|
|
6701
6862
|
if (isSelect) {
|
|
6702
6863
|
sLen++;
|
|
6703
|
-
} else if (
|
|
6864
|
+
} else if (treeIndeterminateRowMaps[childRowid]) {
|
|
6704
6865
|
hLen++;
|
|
6705
6866
|
}
|
|
6706
6867
|
vLen++;
|
|
6707
6868
|
} else {
|
|
6708
6869
|
if (isSelect) {
|
|
6709
6870
|
sLen++;
|
|
6710
|
-
} else if (
|
|
6871
|
+
} else if (treeIndeterminateRowMaps[childRowid]) {
|
|
6711
6872
|
hLen++;
|
|
6712
6873
|
}
|
|
6713
6874
|
}
|
|
6714
6875
|
} : item => {
|
|
6715
|
-
const childRowid = (
|
|
6716
|
-
const isSelect = checkField ? _xeUtils.default.get(item, checkField) :
|
|
6876
|
+
const childRowid = handleGetRowId(item);
|
|
6877
|
+
const isSelect = checkField ? _xeUtils.default.get(item, checkField) : selectCheckboxMaps[childRowid];
|
|
6717
6878
|
if (isSelect) {
|
|
6718
6879
|
sLen++;
|
|
6719
|
-
} else if (
|
|
6880
|
+
} else if (treeIndeterminateRowMaps[childRowid]) {
|
|
6720
6881
|
hLen++;
|
|
6721
6882
|
}
|
|
6722
6883
|
vLen++;
|
|
@@ -6728,29 +6889,28 @@ const Methods = {
|
|
|
6728
6889
|
}
|
|
6729
6890
|
if (isSelected) {
|
|
6730
6891
|
if (!checkField) {
|
|
6731
|
-
|
|
6892
|
+
selectCheckboxMaps[rowid] = row;
|
|
6732
6893
|
}
|
|
6733
|
-
if (
|
|
6734
|
-
delete
|
|
6894
|
+
if (treeIndeterminateRowMaps[rowid]) {
|
|
6895
|
+
delete treeIndeterminateRowMaps[rowid];
|
|
6735
6896
|
}
|
|
6736
6897
|
} else {
|
|
6737
6898
|
if (!checkField) {
|
|
6738
|
-
if (
|
|
6739
|
-
delete
|
|
6899
|
+
if (selectCheckboxMaps[rowid]) {
|
|
6900
|
+
delete selectCheckboxMaps[rowid];
|
|
6740
6901
|
}
|
|
6741
6902
|
}
|
|
6742
6903
|
if (halfSelect) {
|
|
6743
|
-
|
|
6904
|
+
treeIndeterminateRowMaps[rowid] = row;
|
|
6744
6905
|
} else {
|
|
6745
|
-
if (
|
|
6746
|
-
delete
|
|
6906
|
+
if (treeIndeterminateRowMaps[rowid]) {
|
|
6907
|
+
delete treeIndeterminateRowMaps[rowid];
|
|
6747
6908
|
}
|
|
6748
6909
|
}
|
|
6749
6910
|
}
|
|
6750
6911
|
});
|
|
6751
6912
|
}
|
|
6752
|
-
reactData.
|
|
6753
|
-
reactData.treeIndeterminateMaps = halfRowMaps;
|
|
6913
|
+
reactData.updateCheckboxFlag++;
|
|
6754
6914
|
},
|
|
6755
6915
|
updateAllCheckboxStatus() {
|
|
6756
6916
|
const $xeTable = this;
|
|
@@ -6761,9 +6921,12 @@ const Methods = {
|
|
|
6761
6921
|
treeConfig
|
|
6762
6922
|
} = props;
|
|
6763
6923
|
const {
|
|
6924
|
+
afterFullData,
|
|
6925
|
+
afterTreeFullData,
|
|
6926
|
+
checkboxReserveRowMap,
|
|
6764
6927
|
selectCheckboxMaps,
|
|
6765
|
-
|
|
6766
|
-
} =
|
|
6928
|
+
treeIndeterminateRowMaps
|
|
6929
|
+
} = internalData;
|
|
6767
6930
|
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
6768
6931
|
const {
|
|
6769
6932
|
checkField,
|
|
@@ -6771,39 +6934,37 @@ const Methods = {
|
|
|
6771
6934
|
showReserveStatus
|
|
6772
6935
|
} = checkboxOpts;
|
|
6773
6936
|
const {
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
checkboxReserveRowMap
|
|
6777
|
-
} = internalData;
|
|
6937
|
+
handleGetRowId
|
|
6938
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
6778
6939
|
let sLen = 0; // 已选
|
|
6779
6940
|
let hLen = 0; // 半选
|
|
6780
6941
|
let vLen = 0; // 有效行
|
|
6781
6942
|
const rootList = treeConfig ? afterTreeFullData : afterFullData;
|
|
6782
6943
|
rootList.forEach(checkMethod ? row => {
|
|
6783
|
-
const childRowid = (
|
|
6944
|
+
const childRowid = handleGetRowId(row);
|
|
6784
6945
|
const selected = checkField ? _xeUtils.default.get(row, checkField) : selectCheckboxMaps[childRowid];
|
|
6785
6946
|
if (checkMethod({
|
|
6786
6947
|
row
|
|
6787
6948
|
})) {
|
|
6788
6949
|
if (selected) {
|
|
6789
6950
|
sLen++;
|
|
6790
|
-
} else if (
|
|
6951
|
+
} else if (treeIndeterminateRowMaps[childRowid]) {
|
|
6791
6952
|
hLen++;
|
|
6792
6953
|
}
|
|
6793
6954
|
vLen++;
|
|
6794
6955
|
} else {
|
|
6795
6956
|
if (selected) {
|
|
6796
6957
|
sLen++;
|
|
6797
|
-
} else if (
|
|
6958
|
+
} else if (treeIndeterminateRowMaps[childRowid]) {
|
|
6798
6959
|
hLen++;
|
|
6799
6960
|
}
|
|
6800
6961
|
}
|
|
6801
6962
|
} : row => {
|
|
6802
|
-
const childRowid = (
|
|
6963
|
+
const childRowid = handleGetRowId(row);
|
|
6803
6964
|
const selected = checkField ? _xeUtils.default.get(row, checkField) : selectCheckboxMaps[childRowid];
|
|
6804
6965
|
if (selected) {
|
|
6805
6966
|
sLen++;
|
|
6806
|
-
} else if (
|
|
6967
|
+
} else if (treeIndeterminateRowMaps[childRowid]) {
|
|
6807
6968
|
hLen++;
|
|
6808
6969
|
}
|
|
6809
6970
|
vLen++;
|
|
@@ -6867,27 +7028,35 @@ const Methods = {
|
|
|
6867
7028
|
* 获取复选框保留选中的行
|
|
6868
7029
|
*/
|
|
6869
7030
|
getCheckboxReserveRecords(isFull) {
|
|
7031
|
+
const $xeTable = this;
|
|
7032
|
+
const props = $xeTable;
|
|
7033
|
+
const internalData = $xeTable;
|
|
7034
|
+
const {
|
|
7035
|
+
treeConfig
|
|
7036
|
+
} = props;
|
|
6870
7037
|
const {
|
|
6871
|
-
fullDataRowIdData,
|
|
6872
7038
|
afterFullData,
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
7039
|
+
fullDataRowIdData,
|
|
7040
|
+
checkboxReserveRowMap
|
|
7041
|
+
} = internalData;
|
|
7042
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
7043
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
6878
7044
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
6879
7045
|
const reserveSelection = [];
|
|
6880
7046
|
if (checkboxOpts.reserve) {
|
|
7047
|
+
const {
|
|
7048
|
+
handleGetRowId
|
|
7049
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
6881
7050
|
const afterFullIdMaps = {};
|
|
6882
7051
|
if (treeConfig) {
|
|
6883
7052
|
_xeUtils.default.eachTree(afterFullData, row => {
|
|
6884
|
-
afterFullIdMaps[(
|
|
7053
|
+
afterFullIdMaps[handleGetRowId(row)] = 1;
|
|
6885
7054
|
}, {
|
|
6886
7055
|
children: childrenField
|
|
6887
7056
|
});
|
|
6888
7057
|
} else {
|
|
6889
7058
|
afterFullData.forEach(row => {
|
|
6890
|
-
afterFullIdMaps[(
|
|
7059
|
+
afterFullIdMaps[handleGetRowId(row)] = 1;
|
|
6891
7060
|
});
|
|
6892
7061
|
}
|
|
6893
7062
|
_xeUtils.default.each(checkboxReserveRowMap, (oldRow, oldRowid) => {
|
|
@@ -6929,9 +7098,9 @@ const Methods = {
|
|
|
6929
7098
|
handleCheckedAllCheckboxRow($xeTable, value);
|
|
6930
7099
|
if (evnt) {
|
|
6931
7100
|
$xeTable.dispatchEvent('checkbox-all', {
|
|
6932
|
-
records: $xeTable.getCheckboxRecords(),
|
|
6933
|
-
reserves: $xeTable.getCheckboxReserveRecords(),
|
|
6934
|
-
indeterminates: $xeTable.getCheckboxIndeterminateRecords(),
|
|
7101
|
+
records: () => $xeTable.getCheckboxRecords(),
|
|
7102
|
+
reserves: () => $xeTable.getCheckboxReserveRecords(),
|
|
7103
|
+
indeterminates: () => $xeTable.getCheckboxIndeterminateRecords(),
|
|
6935
7104
|
checked: value
|
|
6936
7105
|
}, evnt);
|
|
6937
7106
|
}
|
|
@@ -6967,17 +7136,23 @@ const Methods = {
|
|
|
6967
7136
|
* 清空行为不管是否被禁用还是保留记录,都将彻底清空选中状态
|
|
6968
7137
|
*/
|
|
6969
7138
|
clearCheckboxRow() {
|
|
7139
|
+
const $xeTable = this;
|
|
7140
|
+
const props = $xeTable;
|
|
7141
|
+
const reactData = $xeTable;
|
|
7142
|
+
const internalData = $xeTable;
|
|
6970
7143
|
const {
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
} =
|
|
7144
|
+
treeConfig
|
|
7145
|
+
} = props;
|
|
7146
|
+
const {
|
|
7147
|
+
tableFullData
|
|
7148
|
+
} = internalData;
|
|
7149
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
7150
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
7151
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
6976
7152
|
const {
|
|
6977
7153
|
checkField,
|
|
6978
7154
|
reserve
|
|
6979
7155
|
} = checkboxOpts;
|
|
6980
|
-
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
6981
7156
|
// indeterminateField 仅支持读取
|
|
6982
7157
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
6983
7158
|
if (checkField) {
|
|
@@ -6998,10 +7173,11 @@ const Methods = {
|
|
|
6998
7173
|
if (reserve) {
|
|
6999
7174
|
tableFullData.forEach(row => this.handleCheckboxReserveRow(row, false));
|
|
7000
7175
|
}
|
|
7001
|
-
|
|
7002
|
-
|
|
7003
|
-
|
|
7004
|
-
|
|
7176
|
+
reactData.isAllSelected = false;
|
|
7177
|
+
reactData.isIndeterminate = false;
|
|
7178
|
+
internalData.selectCheckboxMaps = {};
|
|
7179
|
+
internalData.treeIndeterminateRowMaps = {};
|
|
7180
|
+
reactData.updateCheckboxFlag++;
|
|
7005
7181
|
return this.$nextTick();
|
|
7006
7182
|
},
|
|
7007
7183
|
/**
|
|
@@ -7252,12 +7428,14 @@ const Methods = {
|
|
|
7252
7428
|
},
|
|
7253
7429
|
triggerHeaderCellClickEvent(evnt, params) {
|
|
7254
7430
|
const $xeTable = this;
|
|
7431
|
+
const props = $xeTable;
|
|
7255
7432
|
const internalData = $xeTable;
|
|
7256
7433
|
const {
|
|
7257
7434
|
_lastResizeTime
|
|
7258
7435
|
} = internalData;
|
|
7259
7436
|
const sortOpts = $xeTable.computeSortOpts;
|
|
7260
7437
|
const columnOpts = $xeTable.computeColumnOpts;
|
|
7438
|
+
const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
|
|
7261
7439
|
const {
|
|
7262
7440
|
column
|
|
7263
7441
|
} = params;
|
|
@@ -7274,7 +7452,7 @@ const Methods = {
|
|
|
7274
7452
|
triggerFilter,
|
|
7275
7453
|
cell
|
|
7276
7454
|
}, params), evnt);
|
|
7277
|
-
if (columnOpts.isCurrent ||
|
|
7455
|
+
if ((columnOpts.isCurrent || props.highlightCurrentColumn) && (!currentColumnOpts.trigger || ['header', 'default'].includes(currentColumnOpts.trigger))) {
|
|
7278
7456
|
$xeTable.triggerCurrentColumnEvent(evnt, params);
|
|
7279
7457
|
}
|
|
7280
7458
|
return $xeTable.$nextTick();
|
|
@@ -7292,35 +7470,32 @@ const Methods = {
|
|
|
7292
7470
|
* @param {ColumnInfo} fieldOrColumn 列配置
|
|
7293
7471
|
*/
|
|
7294
7472
|
setCurrentColumn(fieldOrColumn) {
|
|
7295
|
-
const
|
|
7473
|
+
const $xeTable = this;
|
|
7474
|
+
const props = $xeTable;
|
|
7475
|
+
const reactData = $xeTable;
|
|
7476
|
+
const {
|
|
7477
|
+
mouseConfig
|
|
7478
|
+
} = props;
|
|
7479
|
+
const mouseOpts = $xeTable.computeMouseOpts;
|
|
7480
|
+
const isMouseSelected = mouseConfig && mouseOpts.selected;
|
|
7481
|
+
const column = (0, _util.handleFieldOrColumn)($xeTable, fieldOrColumn);
|
|
7296
7482
|
if (column) {
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
this.currentColumn = column;
|
|
7483
|
+
$xeTable.clearCurrentColumn();
|
|
7484
|
+
reactData.currentColumn = column;
|
|
7300
7485
|
}
|
|
7301
|
-
return
|
|
7486
|
+
return $xeTable.$nextTick().then(() => {
|
|
7487
|
+
// 更新状选中态
|
|
7488
|
+
if (isMouseSelected) {
|
|
7489
|
+
$xeTable.addCellSelectedClass();
|
|
7490
|
+
}
|
|
7491
|
+
});
|
|
7302
7492
|
},
|
|
7303
7493
|
/**
|
|
7304
7494
|
* 用于当前列,手动清空当前高亮的状态
|
|
7305
7495
|
*/
|
|
7306
|
-
clearCurrentColumn() {
|
|
7307
|
-
this.currentColumn = null;
|
|
7308
|
-
return this.$nextTick();
|
|
7309
|
-
},
|
|
7310
|
-
checkValidate(type) {
|
|
7311
|
-
if (this.triggerValidate) {
|
|
7312
|
-
return this.triggerValidate(type);
|
|
7313
|
-
}
|
|
7314
|
-
return this.$nextTick();
|
|
7315
|
-
},
|
|
7316
|
-
/**
|
|
7317
|
-
* 当单元格发生改变时
|
|
7318
|
-
* 如果存在规则,则校验
|
|
7319
|
-
*/
|
|
7320
|
-
handleChangeCell(evnt, params) {
|
|
7321
|
-
this.checkValidate('blur').catch(e => e).then(() => {
|
|
7322
|
-
this.handleEdit(params, evnt).then(() => this.checkValidate('change')).catch(e => e);
|
|
7323
|
-
});
|
|
7496
|
+
clearCurrentColumn() {
|
|
7497
|
+
this.currentColumn = null;
|
|
7498
|
+
return this.$nextTick();
|
|
7324
7499
|
},
|
|
7325
7500
|
/**
|
|
7326
7501
|
* 列点击事件
|
|
@@ -7333,6 +7508,7 @@ const Methods = {
|
|
|
7333
7508
|
const reactData = $xeTable;
|
|
7334
7509
|
const {
|
|
7335
7510
|
highlightCurrentRow,
|
|
7511
|
+
highlightCurrentColumn,
|
|
7336
7512
|
editConfig
|
|
7337
7513
|
} = props;
|
|
7338
7514
|
const {
|
|
@@ -7349,6 +7525,8 @@ const Methods = {
|
|
|
7349
7525
|
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
7350
7526
|
const keyboardOpts = $xeTable.computeKeyboardOpts;
|
|
7351
7527
|
const rowOpts = $xeTable.computeRowOpts;
|
|
7528
|
+
const columnOpts = $xeTable.computeColumnOpts;
|
|
7529
|
+
const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
|
|
7352
7530
|
const {
|
|
7353
7531
|
actived,
|
|
7354
7532
|
focused
|
|
@@ -7379,11 +7557,11 @@ const Methods = {
|
|
|
7379
7557
|
if (!triggerCheckbox && !triggerRadio) {
|
|
7380
7558
|
// 如果是展开行
|
|
7381
7559
|
if (!triggerExpandNode && (expandOpts.trigger === 'row' || isExpandType && expandOpts.trigger === 'cell')) {
|
|
7382
|
-
|
|
7560
|
+
$xeTable.triggerRowExpandEvent(evnt, params);
|
|
7383
7561
|
}
|
|
7384
7562
|
// 如果是树形表格
|
|
7385
7563
|
if (treeOpts.trigger === 'row' || treeNode && treeOpts.trigger === 'cell') {
|
|
7386
|
-
|
|
7564
|
+
$xeTable.triggerTreeExpandEvent(evnt, params);
|
|
7387
7565
|
}
|
|
7388
7566
|
}
|
|
7389
7567
|
// 如果点击了树节点
|
|
@@ -7392,16 +7570,22 @@ const Methods = {
|
|
|
7392
7570
|
// 如果是高亮行
|
|
7393
7571
|
if (rowOpts.isCurrent || highlightCurrentRow) {
|
|
7394
7572
|
if (!triggerCheckbox && !triggerRadio) {
|
|
7395
|
-
|
|
7573
|
+
$xeTable.triggerCurrentRowEvent(evnt, params);
|
|
7574
|
+
}
|
|
7575
|
+
}
|
|
7576
|
+
// 如果是当前列
|
|
7577
|
+
if ((columnOpts.isCurrent || highlightCurrentColumn) && (!currentColumnOpts.trigger || ['cell', 'default'].includes(currentColumnOpts.trigger))) {
|
|
7578
|
+
if (!triggerCheckbox && !triggerRadio) {
|
|
7579
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params);
|
|
7396
7580
|
}
|
|
7397
7581
|
}
|
|
7398
7582
|
// 如果是单选框
|
|
7399
7583
|
if (!triggerRadio && (radioOpts.trigger === 'row' || isRadioType && radioOpts.trigger === 'cell')) {
|
|
7400
|
-
|
|
7584
|
+
$xeTable.triggerRadioRowEvent(evnt, params);
|
|
7401
7585
|
}
|
|
7402
7586
|
// 如果是复选框
|
|
7403
7587
|
if (!triggerCheckbox && (checkboxOpts.trigger === 'row' || isCheckboxType && checkboxOpts.trigger === 'cell')) {
|
|
7404
|
-
|
|
7588
|
+
$xeTable.handleToggleCheckRowEvent(evnt, params);
|
|
7405
7589
|
}
|
|
7406
7590
|
}
|
|
7407
7591
|
// 如果设置了单元格选中功能,则不会使用点击事件去处理(只能支持双击模式)
|
|
@@ -7413,14 +7597,14 @@ const Methods = {
|
|
|
7413
7597
|
}
|
|
7414
7598
|
if (editOpts.trigger === 'manual') {
|
|
7415
7599
|
if (actived.args && actived.row === row && column !== actived.column) {
|
|
7416
|
-
|
|
7600
|
+
handleChangeCell($xeTable, evnt, params);
|
|
7417
7601
|
}
|
|
7418
7602
|
} else if (!actived.args || row !== actived.row || column !== actived.column) {
|
|
7419
7603
|
if (editOpts.trigger === 'click') {
|
|
7420
|
-
|
|
7604
|
+
handleChangeCell($xeTable, evnt, params);
|
|
7421
7605
|
} else if (editOpts.trigger === 'dblclick') {
|
|
7422
7606
|
if (editOpts.mode === 'row' && actived.row === row) {
|
|
7423
|
-
|
|
7607
|
+
handleChangeCell($xeTable, evnt, params);
|
|
7424
7608
|
}
|
|
7425
7609
|
}
|
|
7426
7610
|
}
|
|
@@ -7440,7 +7624,7 @@ const Methods = {
|
|
|
7440
7624
|
}
|
|
7441
7625
|
}
|
|
7442
7626
|
}
|
|
7443
|
-
|
|
7627
|
+
$xeTable.dispatchEvent('cell-click', params, evnt);
|
|
7444
7628
|
},
|
|
7445
7629
|
/**
|
|
7446
7630
|
* 列双击点击事件
|
|
@@ -7471,11 +7655,11 @@ const Methods = {
|
|
|
7471
7655
|
if ((0, _utils.isEnableConf)(editConfig) && editOpts.trigger === 'dblclick') {
|
|
7472
7656
|
if (!actived.args || evnt.currentTarget !== actived.args.cell) {
|
|
7473
7657
|
if (editOpts.mode === 'row') {
|
|
7474
|
-
|
|
7475
|
-
this.handleEdit(params, evnt).then(() =>
|
|
7658
|
+
checkValidate($xeTable, 'blur').catch(e => e).then(() => {
|
|
7659
|
+
this.handleEdit(params, evnt).then(() => checkValidate($xeTable, 'change')).catch(e => e);
|
|
7476
7660
|
});
|
|
7477
7661
|
} else if (editOpts.mode === 'cell') {
|
|
7478
|
-
this.handleEdit(params, evnt).then(() =>
|
|
7662
|
+
this.handleEdit(params, evnt).then(() => checkValidate($xeTable, 'change')).catch(e => e);
|
|
7479
7663
|
}
|
|
7480
7664
|
}
|
|
7481
7665
|
}
|
|
@@ -7727,6 +7911,8 @@ const Methods = {
|
|
|
7727
7911
|
} = props;
|
|
7728
7912
|
const rowDragOpts = $xeTable.computeRowDragOpts;
|
|
7729
7913
|
const {
|
|
7914
|
+
afterFullData,
|
|
7915
|
+
tableFullData,
|
|
7730
7916
|
fullAllDataRowIdData
|
|
7731
7917
|
} = internalData;
|
|
7732
7918
|
const {
|
|
@@ -7744,10 +7930,6 @@ const Methods = {
|
|
|
7744
7930
|
parentField
|
|
7745
7931
|
} = treeOpts;
|
|
7746
7932
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
7747
|
-
const {
|
|
7748
|
-
afterFullData,
|
|
7749
|
-
tableFullData
|
|
7750
|
-
} = internalData;
|
|
7751
7933
|
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
|
|
7752
7934
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
|
|
7753
7935
|
const errRest = {
|
|
@@ -8415,46 +8597,58 @@ const Methods = {
|
|
|
8415
8597
|
setPendingRow(rows, status) {
|
|
8416
8598
|
const $xeTable = this;
|
|
8417
8599
|
const reactData = $xeTable;
|
|
8418
|
-
const
|
|
8600
|
+
const internalData = $xeTable;
|
|
8601
|
+
const {
|
|
8602
|
+
handleGetRowId
|
|
8603
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
8604
|
+
const {
|
|
8605
|
+
pendingRowMaps
|
|
8606
|
+
} = internalData;
|
|
8419
8607
|
if (rows && !_xeUtils.default.isArray(rows)) {
|
|
8420
8608
|
rows = [rows];
|
|
8421
8609
|
}
|
|
8422
8610
|
if (status) {
|
|
8423
8611
|
rows.forEach(row => {
|
|
8424
|
-
const rowid = (
|
|
8425
|
-
if (rowid && !
|
|
8426
|
-
|
|
8612
|
+
const rowid = handleGetRowId(row);
|
|
8613
|
+
if (rowid && !pendingRowMaps[rowid]) {
|
|
8614
|
+
pendingRowMaps[rowid] = row;
|
|
8427
8615
|
}
|
|
8428
8616
|
});
|
|
8429
8617
|
} else {
|
|
8430
8618
|
rows.forEach(row => {
|
|
8431
|
-
const rowid = (
|
|
8432
|
-
if (rowid &&
|
|
8433
|
-
delete
|
|
8619
|
+
const rowid = handleGetRowId(row);
|
|
8620
|
+
if (rowid && pendingRowMaps[rowid]) {
|
|
8621
|
+
delete pendingRowMaps[rowid];
|
|
8434
8622
|
}
|
|
8435
8623
|
});
|
|
8436
8624
|
}
|
|
8437
|
-
reactData.
|
|
8625
|
+
reactData.pendingRowFlag++;
|
|
8438
8626
|
return $xeTable.$nextTick();
|
|
8439
8627
|
},
|
|
8440
8628
|
togglePendingRow(rows) {
|
|
8441
8629
|
const $xeTable = this;
|
|
8442
8630
|
const reactData = $xeTable;
|
|
8443
|
-
const
|
|
8631
|
+
const internalData = $xeTable;
|
|
8632
|
+
const {
|
|
8633
|
+
handleGetRowId
|
|
8634
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
8635
|
+
const {
|
|
8636
|
+
pendingRowMaps
|
|
8637
|
+
} = internalData;
|
|
8444
8638
|
if (rows && !_xeUtils.default.isArray(rows)) {
|
|
8445
8639
|
rows = [rows];
|
|
8446
8640
|
}
|
|
8447
8641
|
rows.forEach(row => {
|
|
8448
|
-
const rowid = (
|
|
8642
|
+
const rowid = handleGetRowId(row);
|
|
8449
8643
|
if (rowid) {
|
|
8450
|
-
if (
|
|
8451
|
-
delete
|
|
8644
|
+
if (pendingRowMaps[rowid]) {
|
|
8645
|
+
delete pendingRowMaps[rowid];
|
|
8452
8646
|
} else {
|
|
8453
|
-
|
|
8647
|
+
pendingRowMaps[rowid] = row;
|
|
8454
8648
|
}
|
|
8455
8649
|
}
|
|
8456
8650
|
});
|
|
8457
|
-
reactData.
|
|
8651
|
+
reactData.pendingRowFlag++;
|
|
8458
8652
|
return $xeTable.$nextTick();
|
|
8459
8653
|
},
|
|
8460
8654
|
hasPendingByRow(row) {
|
|
@@ -8472,13 +8666,10 @@ const Methods = {
|
|
|
8472
8666
|
},
|
|
8473
8667
|
getPendingRecords() {
|
|
8474
8668
|
const $xeTable = this;
|
|
8475
|
-
const reactData = $xeTable;
|
|
8476
8669
|
const internalData = $xeTable;
|
|
8477
8670
|
const {
|
|
8671
|
+
fullAllDataRowIdData,
|
|
8478
8672
|
pendingRowMaps
|
|
8479
|
-
} = reactData;
|
|
8480
|
-
const {
|
|
8481
|
-
fullAllDataRowIdData
|
|
8482
8673
|
} = internalData;
|
|
8483
8674
|
const insertRecords = [];
|
|
8484
8675
|
_xeUtils.default.each(pendingRowMaps, (row, rowid) => {
|
|
@@ -8489,8 +8680,12 @@ const Methods = {
|
|
|
8489
8680
|
return insertRecords;
|
|
8490
8681
|
},
|
|
8491
8682
|
clearPendingRow() {
|
|
8492
|
-
|
|
8493
|
-
|
|
8683
|
+
const $xeTable = this;
|
|
8684
|
+
const reactData = $xeTable;
|
|
8685
|
+
const internalData = $xeTable;
|
|
8686
|
+
internalData.pendingRowMaps = {};
|
|
8687
|
+
reactData.pendingRowFlag++;
|
|
8688
|
+
return $xeTable.$nextTick();
|
|
8494
8689
|
},
|
|
8495
8690
|
sort(sortConfs, sortOrder) {
|
|
8496
8691
|
const $xeTable = this;
|
|
@@ -8671,9 +8866,11 @@ const Methods = {
|
|
|
8671
8866
|
* @param {Event} evnt 事件
|
|
8672
8867
|
*/
|
|
8673
8868
|
closeFilter() {
|
|
8869
|
+
const $xeTable = this;
|
|
8870
|
+
const reactData = $xeTable;
|
|
8674
8871
|
const {
|
|
8675
8872
|
filterStore
|
|
8676
|
-
} =
|
|
8873
|
+
} = reactData;
|
|
8677
8874
|
const {
|
|
8678
8875
|
column,
|
|
8679
8876
|
visible
|
|
@@ -8685,15 +8882,15 @@ const Methods = {
|
|
|
8685
8882
|
visible: false
|
|
8686
8883
|
});
|
|
8687
8884
|
if (visible) {
|
|
8688
|
-
|
|
8885
|
+
$xeTable.dispatchEvent('filter-visible', {
|
|
8689
8886
|
column,
|
|
8690
8887
|
field: column.field,
|
|
8691
8888
|
property: column.field,
|
|
8692
|
-
filterList:
|
|
8889
|
+
filterList: () => $xeTable.getCheckedFilters(),
|
|
8693
8890
|
visible: false
|
|
8694
8891
|
}, null);
|
|
8695
8892
|
}
|
|
8696
|
-
return
|
|
8893
|
+
return $xeTable.$nextTick();
|
|
8697
8894
|
},
|
|
8698
8895
|
/**
|
|
8699
8896
|
* 判断指定列是否为筛选状态,如果为空则判断所有列
|
|
@@ -8726,9 +8923,9 @@ const Methods = {
|
|
|
8726
8923
|
const $xeTable = this;
|
|
8727
8924
|
const reactData = $xeTable;
|
|
8728
8925
|
const internalData = $xeTable;
|
|
8729
|
-
const rExpandLazyLoadedMaps = Object.assign({}, reactData.rowExpandLazyLoadedMaps);
|
|
8730
8926
|
const {
|
|
8731
|
-
fullAllDataRowIdData
|
|
8927
|
+
fullAllDataRowIdData,
|
|
8928
|
+
rowExpandLazyLoadedMaps
|
|
8732
8929
|
} = internalData;
|
|
8733
8930
|
const expandOpts = $xeTable.computeExpandOpts;
|
|
8734
8931
|
const {
|
|
@@ -8738,9 +8935,9 @@ const Methods = {
|
|
|
8738
8935
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
8739
8936
|
if (lazy && rowRest) {
|
|
8740
8937
|
rowRest.expandLoaded = false;
|
|
8741
|
-
delete
|
|
8938
|
+
delete rowExpandLazyLoadedMaps[rowid];
|
|
8742
8939
|
}
|
|
8743
|
-
reactData.
|
|
8940
|
+
reactData.rowExpandedFlag++;
|
|
8744
8941
|
return $xeTable.$nextTick();
|
|
8745
8942
|
},
|
|
8746
8943
|
/**
|
|
@@ -8748,18 +8945,20 @@ const Methods = {
|
|
|
8748
8945
|
* @param {Row} row 行对象
|
|
8749
8946
|
*/
|
|
8750
8947
|
reloadRowExpand(row) {
|
|
8948
|
+
const $xeTable = this;
|
|
8949
|
+
const internalData = $xeTable;
|
|
8751
8950
|
const {
|
|
8752
|
-
expandOpts,
|
|
8753
8951
|
rowExpandLazyLoadedMaps
|
|
8754
|
-
} =
|
|
8952
|
+
} = internalData;
|
|
8953
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
8755
8954
|
const {
|
|
8756
8955
|
lazy
|
|
8757
8956
|
} = expandOpts;
|
|
8758
8957
|
const rowid = (0, _util.getRowid)(this, row);
|
|
8759
8958
|
if (lazy && !rowExpandLazyLoadedMaps[rowid]) {
|
|
8760
|
-
|
|
8959
|
+
$xeTable.clearRowExpandLoaded(row).then(() => handleAsyncRowExpand($xeTable, row));
|
|
8761
8960
|
}
|
|
8762
|
-
return
|
|
8961
|
+
return $xeTable.$nextTick();
|
|
8763
8962
|
},
|
|
8764
8963
|
reloadExpandContent(row) {
|
|
8765
8964
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -8772,11 +8971,16 @@ const Methods = {
|
|
|
8772
8971
|
* 展开行事件
|
|
8773
8972
|
*/
|
|
8774
8973
|
triggerRowExpandEvent(evnt, params) {
|
|
8974
|
+
const $xeTable = this;
|
|
8975
|
+
const reactData = $xeTable;
|
|
8976
|
+
const internalData = $xeTable;
|
|
8775
8977
|
const {
|
|
8776
|
-
expandOpts,
|
|
8777
|
-
rowExpandLazyLoadedMaps,
|
|
8778
8978
|
expandColumn: column
|
|
8779
|
-
} =
|
|
8979
|
+
} = reactData;
|
|
8980
|
+
const {
|
|
8981
|
+
rowExpandLazyLoadedMaps
|
|
8982
|
+
} = internalData;
|
|
8983
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
8780
8984
|
const {
|
|
8781
8985
|
row
|
|
8782
8986
|
} = params;
|
|
@@ -8788,20 +8992,20 @@ const Methods = {
|
|
|
8788
8992
|
return;
|
|
8789
8993
|
}
|
|
8790
8994
|
evnt.stopPropagation();
|
|
8791
|
-
const rowid = (0, _util.getRowid)(
|
|
8995
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
8792
8996
|
if (!lazy || !rowExpandLazyLoadedMaps[rowid]) {
|
|
8793
|
-
const expanded =
|
|
8794
|
-
const columnIndex =
|
|
8795
|
-
const $columnIndex =
|
|
8796
|
-
|
|
8797
|
-
|
|
8997
|
+
const expanded = !$xeTable.isRowExpandByRow(row);
|
|
8998
|
+
const columnIndex = $xeTable.getColumnIndex(column);
|
|
8999
|
+
const $columnIndex = $xeTable.getVMColumnIndex(column);
|
|
9000
|
+
$xeTable.setRowExpand(row, expanded);
|
|
9001
|
+
$xeTable.dispatchEvent('toggle-row-expand', {
|
|
8798
9002
|
expanded,
|
|
8799
9003
|
column,
|
|
8800
9004
|
columnIndex,
|
|
8801
9005
|
$columnIndex,
|
|
8802
9006
|
row,
|
|
8803
|
-
rowIndex:
|
|
8804
|
-
$rowIndex:
|
|
9007
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
9008
|
+
$rowIndex: $xeTable.getVMRowIndex(row)
|
|
8805
9009
|
}, evnt);
|
|
8806
9010
|
}
|
|
8807
9011
|
},
|
|
@@ -8859,55 +9063,6 @@ const Methods = {
|
|
|
8859
9063
|
}
|
|
8860
9064
|
return this.setRowExpand(expandedRows, expanded);
|
|
8861
9065
|
},
|
|
8862
|
-
handleAsyncRowExpand(row) {
|
|
8863
|
-
const $xeTable = this;
|
|
8864
|
-
const reactData = $xeTable;
|
|
8865
|
-
const internalData = $xeTable;
|
|
8866
|
-
return new Promise(resolve => {
|
|
8867
|
-
const {
|
|
8868
|
-
expandOpts
|
|
8869
|
-
} = this;
|
|
8870
|
-
const {
|
|
8871
|
-
loadMethod
|
|
8872
|
-
} = expandOpts;
|
|
8873
|
-
if (loadMethod) {
|
|
8874
|
-
const {
|
|
8875
|
-
fullAllDataRowIdData
|
|
8876
|
-
} = internalData;
|
|
8877
|
-
const rExpandLazyLoadedMaps = Object.assign({}, reactData.rowExpandLazyLoadedMaps);
|
|
8878
|
-
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
8879
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
8880
|
-
rExpandLazyLoadedMaps[rowid] = row;
|
|
8881
|
-
reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps;
|
|
8882
|
-
loadMethod({
|
|
8883
|
-
$table: $xeTable,
|
|
8884
|
-
row,
|
|
8885
|
-
rowIndex: $xeTable.getRowIndex(row),
|
|
8886
|
-
$rowIndex: $xeTable.getVMRowIndex(row)
|
|
8887
|
-
}).then(() => {
|
|
8888
|
-
const rExpandedMaps = Object.assign({}, reactData.rowExpandedMaps);
|
|
8889
|
-
if (rowRest) {
|
|
8890
|
-
rowRest.expandLoaded = true;
|
|
8891
|
-
}
|
|
8892
|
-
rExpandedMaps[rowid] = row;
|
|
8893
|
-
reactData.rowExpandedMaps = rExpandedMaps;
|
|
8894
|
-
}).catch(() => {
|
|
8895
|
-
if (rowRest) {
|
|
8896
|
-
rowRest.expandLoaded = false;
|
|
8897
|
-
}
|
|
8898
|
-
}).finally(() => {
|
|
8899
|
-
const rExpandLazyLoadedMaps = Object.assign({}, reactData.rowExpandLazyLoadedMaps);
|
|
8900
|
-
if (rExpandLazyLoadedMaps[rowid]) {
|
|
8901
|
-
delete rExpandLazyLoadedMaps[rowid];
|
|
8902
|
-
}
|
|
8903
|
-
reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps;
|
|
8904
|
-
$xeTable.$nextTick().then(() => $xeTable.recalculate()).then(() => $xeTable.updateCellAreas()).then(() => resolve());
|
|
8905
|
-
});
|
|
8906
|
-
} else {
|
|
8907
|
-
resolve();
|
|
8908
|
-
}
|
|
8909
|
-
});
|
|
8910
|
-
},
|
|
8911
9066
|
/**
|
|
8912
9067
|
* 设置展开行,二个参数设置这一行展开与否
|
|
8913
9068
|
* 支持单行
|
|
@@ -8917,14 +9072,20 @@ const Methods = {
|
|
|
8917
9072
|
*/
|
|
8918
9073
|
setRowExpand(rows, expanded) {
|
|
8919
9074
|
const $xeTable = this;
|
|
9075
|
+
const reactData = $xeTable;
|
|
9076
|
+
const internalData = $xeTable;
|
|
8920
9077
|
const {
|
|
8921
|
-
rowExpandedMaps,
|
|
8922
|
-
fullAllDataRowIdData,
|
|
8923
|
-
rowExpandLazyLoadedMaps,
|
|
8924
|
-
expandOpts,
|
|
8925
9078
|
expandColumn
|
|
8926
|
-
} =
|
|
8927
|
-
let
|
|
9079
|
+
} = reactData;
|
|
9080
|
+
let {
|
|
9081
|
+
fullAllDataRowIdData,
|
|
9082
|
+
rowExpandedMaps,
|
|
9083
|
+
rowExpandLazyLoadedMaps
|
|
9084
|
+
} = internalData;
|
|
9085
|
+
const {
|
|
9086
|
+
handleGetRowId
|
|
9087
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
9088
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
8928
9089
|
const {
|
|
8929
9090
|
reserve,
|
|
8930
9091
|
lazy,
|
|
@@ -8940,10 +9101,12 @@ const Methods = {
|
|
|
8940
9101
|
}
|
|
8941
9102
|
if (accordion) {
|
|
8942
9103
|
// 只能同时展开一个
|
|
8943
|
-
|
|
9104
|
+
rowExpandedMaps = {};
|
|
9105
|
+
internalData.rowExpandedMaps = rowExpandedMaps;
|
|
8944
9106
|
rows = rows.slice(rows.length - 1, rows.length);
|
|
8945
9107
|
}
|
|
8946
9108
|
const validRows = toggleMethod ? rows.filter(row => toggleMethod({
|
|
9109
|
+
$table: $xeTable,
|
|
8947
9110
|
expanded,
|
|
8948
9111
|
column: expandColumn,
|
|
8949
9112
|
columnIndex,
|
|
@@ -8954,22 +9117,22 @@ const Methods = {
|
|
|
8954
9117
|
})) : rows;
|
|
8955
9118
|
if (expanded) {
|
|
8956
9119
|
validRows.forEach(row => {
|
|
8957
|
-
const rowid = (
|
|
8958
|
-
if (!
|
|
9120
|
+
const rowid = handleGetRowId(row);
|
|
9121
|
+
if (!rowExpandedMaps[rowid]) {
|
|
8959
9122
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
8960
9123
|
const isLoad = lazy && !rowRest.expandLoaded && !rowExpandLazyLoadedMaps[rowid];
|
|
8961
9124
|
if (isLoad) {
|
|
8962
|
-
lazyRests.push(
|
|
9125
|
+
lazyRests.push(handleAsyncRowExpand($xeTable, row));
|
|
8963
9126
|
} else {
|
|
8964
|
-
|
|
9127
|
+
rowExpandedMaps[rowid] = row;
|
|
8965
9128
|
}
|
|
8966
9129
|
}
|
|
8967
9130
|
});
|
|
8968
9131
|
} else {
|
|
8969
9132
|
validRows.forEach(item => {
|
|
8970
|
-
const rowid = (
|
|
8971
|
-
if (
|
|
8972
|
-
delete
|
|
9133
|
+
const rowid = handleGetRowId(item);
|
|
9134
|
+
if (rowExpandedMaps[rowid]) {
|
|
9135
|
+
delete rowExpandedMaps[rowid];
|
|
8973
9136
|
}
|
|
8974
9137
|
});
|
|
8975
9138
|
}
|
|
@@ -8977,7 +9140,7 @@ const Methods = {
|
|
|
8977
9140
|
validRows.forEach(row => handleRowExpandReserve($xeTable, row, expanded));
|
|
8978
9141
|
}
|
|
8979
9142
|
}
|
|
8980
|
-
|
|
9143
|
+
reactData.rowExpandedFlag++;
|
|
8981
9144
|
return Promise.all(lazyRests).then(() => $xeTable.$nextTick()).then(() => $xeTable.recalculate(true)).then(() => {
|
|
8982
9145
|
updateRowOffsetTop($xeTable);
|
|
8983
9146
|
updateRowExpandStyle($xeTable);
|
|
@@ -8990,11 +9153,17 @@ const Methods = {
|
|
|
8990
9153
|
* @param {Row} row 行对象
|
|
8991
9154
|
*/
|
|
8992
9155
|
isRowExpandByRow(row) {
|
|
9156
|
+
const $xeTable = this;
|
|
9157
|
+
const reactData = $xeTable;
|
|
9158
|
+
const internalData = $xeTable;
|
|
9159
|
+
const {
|
|
9160
|
+
rowExpandedFlag
|
|
9161
|
+
} = reactData;
|
|
8993
9162
|
const {
|
|
8994
9163
|
rowExpandedMaps
|
|
8995
|
-
} =
|
|
9164
|
+
} = internalData;
|
|
8996
9165
|
const rowid = (0, _util.getRowid)(this, row);
|
|
8997
|
-
return !!rowExpandedMaps[rowid];
|
|
9166
|
+
return !!rowExpandedFlag && !!rowExpandedMaps[rowid];
|
|
8998
9167
|
},
|
|
8999
9168
|
isExpandByRow(row) {
|
|
9000
9169
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -9018,7 +9187,8 @@ const Methods = {
|
|
|
9018
9187
|
reserve
|
|
9019
9188
|
} = expandOpts;
|
|
9020
9189
|
const expList = $xeTable.getRowExpandRecords();
|
|
9021
|
-
|
|
9190
|
+
internalData.rowExpandedMaps = {};
|
|
9191
|
+
reactData.rowExpandedFlag++;
|
|
9022
9192
|
if (reserve) {
|
|
9023
9193
|
tableFullData.forEach(row => handleRowExpandReserve($xeTable, row, false));
|
|
9024
9194
|
}
|
|
@@ -9038,8 +9208,10 @@ const Methods = {
|
|
|
9038
9208
|
return this.$nextTick();
|
|
9039
9209
|
},
|
|
9040
9210
|
getRowExpandRecords() {
|
|
9211
|
+
const $xeTable = this;
|
|
9212
|
+
const internalData = $xeTable;
|
|
9041
9213
|
const rest = [];
|
|
9042
|
-
_xeUtils.default.each(
|
|
9214
|
+
_xeUtils.default.each(internalData.rowExpandedMaps, item => {
|
|
9043
9215
|
if (item) {
|
|
9044
9216
|
rest.push(item);
|
|
9045
9217
|
}
|
|
@@ -9047,8 +9219,10 @@ const Methods = {
|
|
|
9047
9219
|
return rest;
|
|
9048
9220
|
},
|
|
9049
9221
|
getTreeExpandRecords() {
|
|
9222
|
+
const $xeTable = this;
|
|
9223
|
+
const internalData = $xeTable;
|
|
9050
9224
|
const rest = [];
|
|
9051
|
-
_xeUtils.default.each(
|
|
9225
|
+
_xeUtils.default.each(internalData.treeExpandedMaps, item => {
|
|
9052
9226
|
if (item) {
|
|
9053
9227
|
rest.push(item);
|
|
9054
9228
|
}
|
|
@@ -9084,15 +9258,14 @@ const Methods = {
|
|
|
9084
9258
|
const reactData = $xeTable;
|
|
9085
9259
|
const internalData = $xeTable;
|
|
9086
9260
|
const {
|
|
9087
|
-
fullAllDataRowIdData
|
|
9261
|
+
fullAllDataRowIdData,
|
|
9262
|
+
treeExpandedMaps
|
|
9088
9263
|
} = internalData;
|
|
9089
9264
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
9090
9265
|
const {
|
|
9091
9266
|
transform
|
|
9092
9267
|
} = treeOpts;
|
|
9093
|
-
let tExpandedMaps = {};
|
|
9094
9268
|
if (rows) {
|
|
9095
|
-
tExpandedMaps = Object.assign({}, reactData.treeExpandedMaps);
|
|
9096
9269
|
if (!_xeUtils.default.isArray(rows)) {
|
|
9097
9270
|
rows = [rows];
|
|
9098
9271
|
}
|
|
@@ -9101,8 +9274,8 @@ const Methods = {
|
|
|
9101
9274
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
9102
9275
|
if (rowRest) {
|
|
9103
9276
|
rowRest.treeLoaded = false;
|
|
9104
|
-
if (
|
|
9105
|
-
delete
|
|
9277
|
+
if (treeExpandedMaps[rowid]) {
|
|
9278
|
+
delete treeExpandedMaps[rowid];
|
|
9106
9279
|
}
|
|
9107
9280
|
}
|
|
9108
9281
|
});
|
|
@@ -9111,7 +9284,8 @@ const Methods = {
|
|
|
9111
9284
|
rowRest.treeLoaded = false;
|
|
9112
9285
|
});
|
|
9113
9286
|
}
|
|
9114
|
-
|
|
9287
|
+
internalData.treeExpandedMaps = {};
|
|
9288
|
+
reactData.treeExpandedFlag++;
|
|
9115
9289
|
if (transform) {
|
|
9116
9290
|
handleVirtualTreeToList($xeTable);
|
|
9117
9291
|
return $xeTable.handleTableData();
|
|
@@ -9124,45 +9298,49 @@ const Methods = {
|
|
|
9124
9298
|
*/
|
|
9125
9299
|
reloadTreeExpand(row) {
|
|
9126
9300
|
const $xeTable = this;
|
|
9301
|
+
const internalData = $xeTable;
|
|
9127
9302
|
const {
|
|
9128
|
-
treeOpts,
|
|
9129
9303
|
treeExpandLazyLoadedMaps
|
|
9130
|
-
} =
|
|
9304
|
+
} = internalData;
|
|
9305
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
9131
9306
|
const {
|
|
9132
9307
|
transform,
|
|
9133
9308
|
lazy
|
|
9134
9309
|
} = treeOpts;
|
|
9135
9310
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
9136
|
-
const rowid = (0, _util.getRowid)(
|
|
9311
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
9137
9312
|
if (lazy && row[hasChildField] && !treeExpandLazyLoadedMaps[rowid]) {
|
|
9138
|
-
return
|
|
9139
|
-
return
|
|
9313
|
+
return $xeTable.clearTreeExpandLoaded(row).then(() => {
|
|
9314
|
+
return handleAsyncTreeExpandChilds($xeTable, row);
|
|
9140
9315
|
}).then(() => {
|
|
9141
9316
|
if (transform) {
|
|
9142
9317
|
handleVirtualTreeToList($xeTable);
|
|
9143
|
-
return
|
|
9318
|
+
return $xeTable.handleTableData();
|
|
9144
9319
|
}
|
|
9145
9320
|
}).then(() => {
|
|
9146
|
-
return
|
|
9321
|
+
return $xeTable.recalculate();
|
|
9147
9322
|
});
|
|
9148
9323
|
}
|
|
9149
|
-
return
|
|
9324
|
+
return $xeTable.$nextTick();
|
|
9150
9325
|
},
|
|
9151
9326
|
reloadTreeChilds(row) {
|
|
9327
|
+
const $xeTable = this;
|
|
9152
9328
|
if (process.env.NODE_ENV === 'development') {
|
|
9153
9329
|
(0, _log.warnLog)('vxe.error.delFunc', ['reloadTreeChilds', 'reloadTreeExpand']);
|
|
9154
9330
|
}
|
|
9155
9331
|
// 即将废弃
|
|
9156
|
-
return
|
|
9332
|
+
return $xeTable.reloadTreeExpand(row);
|
|
9157
9333
|
},
|
|
9158
9334
|
/**
|
|
9159
9335
|
* 展开树节点事件
|
|
9160
9336
|
*/
|
|
9161
9337
|
triggerTreeExpandEvent(evnt, params) {
|
|
9338
|
+
const $xeTable = this;
|
|
9339
|
+
const internalData = $xeTable;
|
|
9162
9340
|
const {
|
|
9163
|
-
treeOpts,
|
|
9164
9341
|
treeExpandLazyLoadedMaps
|
|
9165
|
-
} =
|
|
9342
|
+
} = internalData;
|
|
9343
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
9166
9344
|
const {
|
|
9167
9345
|
row,
|
|
9168
9346
|
column
|
|
@@ -9177,11 +9355,11 @@ const Methods = {
|
|
|
9177
9355
|
evnt.stopPropagation();
|
|
9178
9356
|
const rowid = (0, _util.getRowid)(this, row);
|
|
9179
9357
|
if (!lazy || !treeExpandLazyLoadedMaps[rowid]) {
|
|
9180
|
-
const expanded =
|
|
9181
|
-
const columnIndex =
|
|
9182
|
-
const $columnIndex =
|
|
9183
|
-
|
|
9184
|
-
|
|
9358
|
+
const expanded = !$xeTable.isTreeExpandByRow(row);
|
|
9359
|
+
const columnIndex = $xeTable.getColumnIndex(column);
|
|
9360
|
+
const $columnIndex = $xeTable.getVMColumnIndex(column);
|
|
9361
|
+
$xeTable.setTreeExpand(row, expanded);
|
|
9362
|
+
$xeTable.dispatchEvent('toggle-tree-expand', {
|
|
9185
9363
|
expanded,
|
|
9186
9364
|
column,
|
|
9187
9365
|
columnIndex,
|
|
@@ -9196,112 +9374,6 @@ const Methods = {
|
|
|
9196
9374
|
toggleTreeExpand(row) {
|
|
9197
9375
|
return this.setTreeExpand(row, !this.isTreeExpandByRow(row));
|
|
9198
9376
|
},
|
|
9199
|
-
/**
|
|
9200
|
-
* 处理默认展开树节点
|
|
9201
|
-
*/
|
|
9202
|
-
handleDefaultTreeExpand() {
|
|
9203
|
-
const {
|
|
9204
|
-
treeConfig,
|
|
9205
|
-
treeOpts,
|
|
9206
|
-
tableFullData
|
|
9207
|
-
} = this;
|
|
9208
|
-
if (treeConfig) {
|
|
9209
|
-
const {
|
|
9210
|
-
expandAll,
|
|
9211
|
-
expandRowKeys
|
|
9212
|
-
} = treeOpts;
|
|
9213
|
-
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
9214
|
-
if (expandAll) {
|
|
9215
|
-
this.setAllTreeExpand(true);
|
|
9216
|
-
} else if (expandRowKeys) {
|
|
9217
|
-
const defExpandeds = [];
|
|
9218
|
-
const rowkey = (0, _util.getRowkey)(this);
|
|
9219
|
-
expandRowKeys.forEach(rowid => {
|
|
9220
|
-
const matchObj = _xeUtils.default.findTree(tableFullData, item => rowid === _xeUtils.default.get(item, rowkey), {
|
|
9221
|
-
children: childrenField
|
|
9222
|
-
});
|
|
9223
|
-
if (matchObj) {
|
|
9224
|
-
defExpandeds.push(matchObj.item);
|
|
9225
|
-
}
|
|
9226
|
-
});
|
|
9227
|
-
this.setTreeExpand(defExpandeds, true);
|
|
9228
|
-
}
|
|
9229
|
-
}
|
|
9230
|
-
},
|
|
9231
|
-
handleAsyncTreeExpandChilds(row) {
|
|
9232
|
-
const $xeTable = this;
|
|
9233
|
-
const {
|
|
9234
|
-
treeOpts,
|
|
9235
|
-
checkboxOpts
|
|
9236
|
-
} = this;
|
|
9237
|
-
const {
|
|
9238
|
-
transform,
|
|
9239
|
-
loadMethod
|
|
9240
|
-
} = treeOpts;
|
|
9241
|
-
const {
|
|
9242
|
-
checkStrictly
|
|
9243
|
-
} = checkboxOpts;
|
|
9244
|
-
return new Promise(resolve => {
|
|
9245
|
-
if (loadMethod) {
|
|
9246
|
-
const {
|
|
9247
|
-
treeExpandLazyLoadedMaps,
|
|
9248
|
-
fullAllDataRowIdData
|
|
9249
|
-
} = this;
|
|
9250
|
-
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
9251
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
9252
|
-
treeExpandLazyLoadedMaps[rowid] = row;
|
|
9253
|
-
Promise.resolve(loadMethod({
|
|
9254
|
-
$table: $xeTable,
|
|
9255
|
-
row
|
|
9256
|
-
})).then(childRecords => {
|
|
9257
|
-
if (rowRest) {
|
|
9258
|
-
rowRest.treeLoaded = true;
|
|
9259
|
-
}
|
|
9260
|
-
if (treeExpandLazyLoadedMaps[rowid]) {
|
|
9261
|
-
delete treeExpandLazyLoadedMaps[rowid];
|
|
9262
|
-
}
|
|
9263
|
-
if (!_xeUtils.default.isArray(childRecords)) {
|
|
9264
|
-
childRecords = [];
|
|
9265
|
-
}
|
|
9266
|
-
if (childRecords) {
|
|
9267
|
-
return this.loadTreeChildren(row, childRecords).then(childRows => {
|
|
9268
|
-
const {
|
|
9269
|
-
treeExpandedMaps
|
|
9270
|
-
} = this;
|
|
9271
|
-
if (childRows.length && !treeExpandedMaps[rowid]) {
|
|
9272
|
-
treeExpandedMaps[rowid] = row;
|
|
9273
|
-
}
|
|
9274
|
-
// 如果当前节点已选中,则展开后子节点也被选中
|
|
9275
|
-
if (!checkStrictly && this.isCheckedByCheckboxRow(row)) {
|
|
9276
|
-
handleCheckedCheckboxRow($xeTable, childRows, true);
|
|
9277
|
-
}
|
|
9278
|
-
return this.$nextTick().then(() => {
|
|
9279
|
-
if (transform) {
|
|
9280
|
-
this.handleTableData();
|
|
9281
|
-
updateAfterDataIndex($xeTable);
|
|
9282
|
-
return this.$nextTick();
|
|
9283
|
-
}
|
|
9284
|
-
});
|
|
9285
|
-
});
|
|
9286
|
-
}
|
|
9287
|
-
}).catch(() => {
|
|
9288
|
-
const {
|
|
9289
|
-
treeExpandLazyLoadedMaps
|
|
9290
|
-
} = this;
|
|
9291
|
-
if (rowRest) {
|
|
9292
|
-
rowRest.treeLoaded = false;
|
|
9293
|
-
}
|
|
9294
|
-
if (treeExpandLazyLoadedMaps[rowid]) {
|
|
9295
|
-
delete treeExpandLazyLoadedMaps[rowid];
|
|
9296
|
-
}
|
|
9297
|
-
}).finally(() => {
|
|
9298
|
-
this.$nextTick().then(() => this.recalculate()).then(() => resolve());
|
|
9299
|
-
});
|
|
9300
|
-
} else {
|
|
9301
|
-
resolve();
|
|
9302
|
-
}
|
|
9303
|
-
});
|
|
9304
|
-
},
|
|
9305
9377
|
/**
|
|
9306
9378
|
* 设置所有树节点的展开与否
|
|
9307
9379
|
* @param {Boolean} expanded 是否展开
|
|
@@ -9333,27 +9405,35 @@ const Methods = {
|
|
|
9333
9405
|
* @returns
|
|
9334
9406
|
*/
|
|
9335
9407
|
handleBaseTreeExpand(rows, expanded) {
|
|
9408
|
+
const $xeTable = this;
|
|
9409
|
+
const reactData = $xeTable;
|
|
9410
|
+
const internalData = $xeTable;
|
|
9411
|
+
const {
|
|
9412
|
+
treeNodeColumn
|
|
9413
|
+
} = reactData;
|
|
9336
9414
|
const {
|
|
9337
9415
|
fullAllDataRowIdData,
|
|
9338
9416
|
tableFullData,
|
|
9339
9417
|
treeExpandedMaps,
|
|
9340
|
-
|
|
9341
|
-
|
|
9342
|
-
|
|
9343
|
-
} = this;
|
|
9418
|
+
treeExpandLazyLoadedMaps
|
|
9419
|
+
} = internalData;
|
|
9420
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
9344
9421
|
const {
|
|
9345
9422
|
reserve,
|
|
9346
9423
|
lazy,
|
|
9347
9424
|
accordion,
|
|
9348
9425
|
toggleMethod
|
|
9349
9426
|
} = treeOpts;
|
|
9350
|
-
const treeTempExpandedMaps = Object.assign({}, treeExpandedMaps);
|
|
9351
9427
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
9352
9428
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
9353
9429
|
const result = [];
|
|
9354
|
-
const columnIndex =
|
|
9355
|
-
const $columnIndex =
|
|
9430
|
+
const columnIndex = $xeTable.getColumnIndex(treeNodeColumn);
|
|
9431
|
+
const $columnIndex = $xeTable.getVMColumnIndex(treeNodeColumn);
|
|
9432
|
+
const {
|
|
9433
|
+
handleGetRowId
|
|
9434
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
9356
9435
|
let validRows = toggleMethod ? rows.filter(row => toggleMethod({
|
|
9436
|
+
$table: $xeTable,
|
|
9357
9437
|
expanded,
|
|
9358
9438
|
column: treeNodeColumn,
|
|
9359
9439
|
columnIndex,
|
|
@@ -9368,26 +9448,26 @@ const Methods = {
|
|
|
9368
9448
|
});
|
|
9369
9449
|
if (matchObj) {
|
|
9370
9450
|
matchObj.items.forEach(item => {
|
|
9371
|
-
const rowid = (
|
|
9372
|
-
if (
|
|
9373
|
-
delete
|
|
9451
|
+
const rowid = handleGetRowId(item);
|
|
9452
|
+
if (treeExpandedMaps[rowid]) {
|
|
9453
|
+
delete treeExpandedMaps[rowid];
|
|
9374
9454
|
}
|
|
9375
9455
|
});
|
|
9376
9456
|
}
|
|
9377
9457
|
}
|
|
9378
9458
|
if (expanded) {
|
|
9379
9459
|
validRows.forEach(row => {
|
|
9380
|
-
const rowid = (
|
|
9381
|
-
if (!
|
|
9460
|
+
const rowid = handleGetRowId(row);
|
|
9461
|
+
if (!treeExpandedMaps[rowid]) {
|
|
9382
9462
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
9383
9463
|
if (rowRest) {
|
|
9384
9464
|
const isLoad = lazy && row[hasChildField] && !rowRest.treeLoaded && !treeExpandLazyLoadedMaps[rowid];
|
|
9385
9465
|
// 是否使用懒加载
|
|
9386
9466
|
if (isLoad) {
|
|
9387
|
-
result.push(
|
|
9467
|
+
result.push(handleAsyncTreeExpandChilds($xeTable, row));
|
|
9388
9468
|
} else {
|
|
9389
9469
|
if (row[childrenField] && row[childrenField].length) {
|
|
9390
|
-
|
|
9470
|
+
treeExpandedMaps[rowid] = row;
|
|
9391
9471
|
}
|
|
9392
9472
|
}
|
|
9393
9473
|
}
|
|
@@ -9395,18 +9475,18 @@ const Methods = {
|
|
|
9395
9475
|
});
|
|
9396
9476
|
} else {
|
|
9397
9477
|
validRows.forEach(item => {
|
|
9398
|
-
const rowid = (
|
|
9399
|
-
if (
|
|
9400
|
-
delete
|
|
9478
|
+
const rowid = handleGetRowId(item);
|
|
9479
|
+
if (treeExpandedMaps[rowid]) {
|
|
9480
|
+
delete treeExpandedMaps[rowid];
|
|
9401
9481
|
}
|
|
9402
9482
|
});
|
|
9403
9483
|
}
|
|
9404
9484
|
if (reserve) {
|
|
9405
|
-
validRows.forEach(row =>
|
|
9485
|
+
validRows.forEach(row => handleTreeExpandReserve($xeTable, row, expanded));
|
|
9406
9486
|
}
|
|
9407
|
-
|
|
9487
|
+
reactData.treeExpandedFlag++;
|
|
9408
9488
|
return Promise.all(result).then(() => {
|
|
9409
|
-
return
|
|
9489
|
+
return $xeTable.recalculate();
|
|
9410
9490
|
});
|
|
9411
9491
|
},
|
|
9412
9492
|
/**
|
|
@@ -9463,40 +9543,49 @@ const Methods = {
|
|
|
9463
9543
|
* @param {Row} row 行对象
|
|
9464
9544
|
*/
|
|
9465
9545
|
isTreeExpandByRow(row) {
|
|
9546
|
+
const $xeTable = this;
|
|
9547
|
+
const reactData = $xeTable;
|
|
9548
|
+
const internalData = $xeTable;
|
|
9549
|
+
const {
|
|
9550
|
+
treeExpandedFlag
|
|
9551
|
+
} = reactData;
|
|
9466
9552
|
const {
|
|
9467
9553
|
treeExpandedMaps
|
|
9468
|
-
} =
|
|
9469
|
-
return !!treeExpandedMaps[(0, _util.getRowid)(
|
|
9554
|
+
} = internalData;
|
|
9555
|
+
return !!treeExpandedFlag && !!treeExpandedMaps[(0, _util.getRowid)($xeTable, row)];
|
|
9470
9556
|
},
|
|
9471
9557
|
/**
|
|
9472
9558
|
* 手动清空树形节点的展开状态,数据会恢复成未展开的状态
|
|
9473
9559
|
*/
|
|
9474
9560
|
clearTreeExpand() {
|
|
9475
9561
|
const $xeTable = this;
|
|
9562
|
+
const reactData = $xeTable;
|
|
9563
|
+
const internalData = $xeTable;
|
|
9476
9564
|
const {
|
|
9477
|
-
|
|
9478
|
-
|
|
9479
|
-
|
|
9565
|
+
tableFullTreeData
|
|
9566
|
+
} = internalData;
|
|
9567
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
9568
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
9480
9569
|
const {
|
|
9481
9570
|
transform,
|
|
9482
9571
|
reserve
|
|
9483
9572
|
} = treeOpts;
|
|
9484
|
-
const
|
|
9485
|
-
|
|
9486
|
-
|
|
9573
|
+
const expList = $xeTable.getTreeExpandRecords();
|
|
9574
|
+
internalData.treeExpandedMaps = {};
|
|
9575
|
+
reactData.treeExpandedFlag++;
|
|
9487
9576
|
if (reserve) {
|
|
9488
|
-
_xeUtils.default.eachTree(
|
|
9577
|
+
_xeUtils.default.eachTree(tableFullTreeData, row => handleTreeExpandReserve($xeTable, row, false), {
|
|
9489
9578
|
children: childrenField
|
|
9490
9579
|
});
|
|
9491
9580
|
}
|
|
9492
|
-
return
|
|
9581
|
+
return $xeTable.handleTableData().then(() => {
|
|
9493
9582
|
if (transform) {
|
|
9494
9583
|
handleVirtualTreeToList($xeTable);
|
|
9495
|
-
return
|
|
9584
|
+
return $xeTable.handleTableData();
|
|
9496
9585
|
}
|
|
9497
9586
|
}).then(() => {
|
|
9498
9587
|
if (expList.length) {
|
|
9499
|
-
|
|
9588
|
+
$xeTable.recalculate();
|
|
9500
9589
|
}
|
|
9501
9590
|
});
|
|
9502
9591
|
},
|
|
@@ -9504,20 +9593,6 @@ const Methods = {
|
|
|
9504
9593
|
this.treeExpandedReserveRowMap = {};
|
|
9505
9594
|
return this.$nextTick();
|
|
9506
9595
|
},
|
|
9507
|
-
handleTreeExpandReserve(row, expanded) {
|
|
9508
|
-
const {
|
|
9509
|
-
treeExpandedReserveRowMap,
|
|
9510
|
-
treeOpts
|
|
9511
|
-
} = this;
|
|
9512
|
-
if (treeOpts.reserve) {
|
|
9513
|
-
const rowid = (0, _util.getRowid)(this, row);
|
|
9514
|
-
if (expanded) {
|
|
9515
|
-
treeExpandedReserveRowMap[rowid] = row;
|
|
9516
|
-
} else if (treeExpandedReserveRowMap[rowid]) {
|
|
9517
|
-
delete treeExpandedReserveRowMap[rowid];
|
|
9518
|
-
}
|
|
9519
|
-
}
|
|
9520
|
-
},
|
|
9521
9596
|
/**
|
|
9522
9597
|
* 获取表格的滚动状态
|
|
9523
9598
|
*/
|
|
@@ -9883,11 +9958,12 @@ const Methods = {
|
|
|
9883
9958
|
} = tableProps;
|
|
9884
9959
|
const {
|
|
9885
9960
|
scrollXLoad,
|
|
9886
|
-
scrollYLoad
|
|
9961
|
+
scrollYLoad,
|
|
9962
|
+
expandColumn
|
|
9887
9963
|
} = reactData;
|
|
9888
9964
|
const leftFixedWidth = $xeTable.computeLeftFixedWidth;
|
|
9889
9965
|
const rightFixedWidth = $xeTable.computeRightFixedWidth;
|
|
9890
|
-
if (!(
|
|
9966
|
+
if (!(leftFixedWidth || rightFixedWidth || expandColumn)) {
|
|
9891
9967
|
return;
|
|
9892
9968
|
}
|
|
9893
9969
|
const {
|
|
@@ -10179,15 +10255,15 @@ const Methods = {
|
|
|
10179
10255
|
const {
|
|
10180
10256
|
isAllOverflow,
|
|
10181
10257
|
scrollYLoad,
|
|
10182
|
-
expandColumn
|
|
10183
|
-
rowExpandedMaps
|
|
10258
|
+
expandColumn
|
|
10184
10259
|
} = reactData;
|
|
10185
10260
|
const {
|
|
10186
10261
|
scrollYStore,
|
|
10187
10262
|
elemStore,
|
|
10188
10263
|
isResizeCellHeight,
|
|
10189
10264
|
afterFullData,
|
|
10190
|
-
fullAllDataRowIdData
|
|
10265
|
+
fullAllDataRowIdData,
|
|
10266
|
+
rowExpandedMaps
|
|
10191
10267
|
} = internalData;
|
|
10192
10268
|
const {
|
|
10193
10269
|
startIndex
|
|
@@ -10449,6 +10525,8 @@ const Methods = {
|
|
|
10449
10525
|
* 更新表尾合计
|
|
10450
10526
|
*/
|
|
10451
10527
|
updateFooter() {
|
|
10528
|
+
const $xeTable = this;
|
|
10529
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
10452
10530
|
const {
|
|
10453
10531
|
showFooter,
|
|
10454
10532
|
visibleColumn,
|
|
@@ -10462,8 +10540,8 @@ const Methods = {
|
|
|
10462
10540
|
footData = visibleColumn.length ? footerMethod({
|
|
10463
10541
|
columns: visibleColumn,
|
|
10464
10542
|
data: this.afterFullData,
|
|
10465
|
-
$table:
|
|
10466
|
-
$grid:
|
|
10543
|
+
$table: $xeTable,
|
|
10544
|
+
$grid: $xeGrid
|
|
10467
10545
|
}) : [];
|
|
10468
10546
|
}
|
|
10469
10547
|
this.footerTableData = footData;
|
|
@@ -10544,7 +10622,7 @@ const Methods = {
|
|
|
10544
10622
|
if (this.footerSpanMethod) {
|
|
10545
10623
|
(0, _log.errLog)('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method']);
|
|
10546
10624
|
}
|
|
10547
|
-
setMerges(this, merges, this.mergeFooterList
|
|
10625
|
+
setMerges(this, merges, this.mergeFooterList);
|
|
10548
10626
|
return this.$nextTick().then(() => {
|
|
10549
10627
|
this.updateCellAreas();
|
|
10550
10628
|
return updateStyle($xeTable);
|
|
@@ -10599,16 +10677,19 @@ const Methods = {
|
|
|
10599
10677
|
},
|
|
10600
10678
|
dispatchEvent(type, params, evnt) {
|
|
10601
10679
|
const $xeTable = this;
|
|
10680
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
10602
10681
|
$xeTable.$emit(type, createEvent(evnt, {
|
|
10603
10682
|
$table: $xeTable,
|
|
10604
|
-
$grid: $
|
|
10683
|
+
$grid: $xeGrid
|
|
10605
10684
|
}, params));
|
|
10606
10685
|
},
|
|
10607
10686
|
// 已废弃,使用 dispatchEvent
|
|
10608
10687
|
emitEvent(type, params, evnt) {
|
|
10688
|
+
const $xeTable = this;
|
|
10689
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
10609
10690
|
this.$emit(type, Object.assign({
|
|
10610
|
-
$table:
|
|
10611
|
-
$grid:
|
|
10691
|
+
$table: $xeTable,
|
|
10692
|
+
$grid: $xeGrid,
|
|
10612
10693
|
$event: evnt
|
|
10613
10694
|
}, params));
|
|
10614
10695
|
},
|