vxe-table 3.14.0-beta.9 → 3.14.1
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 +62 -42
- 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 +103 -68
- 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 -5
- package/es/table/render/index.js +2 -2
- package/es/table/src/body.js +43 -25
- 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 +1047 -971
- package/es/table/src/props.js +4 -0
- package/es/table/src/table.js +100 -64
- 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 +69 -59
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +2006 -1686
- 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 +119 -105
- 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 +4 -10
- 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 +51 -25
- 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 +1219 -1151
- 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 +108 -67
- 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 +75 -51
- 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 +139 -95
- 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 +3 -6
- package/packages/table/render/index.ts +2 -2
- package/packages/table/src/body.ts +43 -25
- 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 +1174 -1027
- package/packages/table/src/props.ts +16 -12
- package/packages/table/src/table.ts +117 -70
- package/packages/table/src/util.ts +65 -23
- package/packages/toolbar/src/toolbar.ts +3 -3
- package/packages/ui/index.ts +1 -0
- /package/es/{iconfont.1741336976538.ttf → iconfont.1743045564244.ttf} +0 -0
- /package/es/{iconfont.1741336976538.woff → iconfont.1743045564244.woff} +0 -0
- /package/es/{iconfont.1741336976538.woff2 → iconfont.1743045564244.woff2} +0 -0
- /package/lib/{iconfont.1741336976538.ttf → iconfont.1743045564244.ttf} +0 -0
- /package/lib/{iconfont.1741336976538.woff → iconfont.1743045564244.woff} +0 -0
- /package/lib/{iconfont.1741336976538.woff2 → iconfont.1743045564244.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) {
|
|
@@ -371,14 +372,14 @@ const updateScrollYStatus = ($xeTable, fullData) => {
|
|
|
371
372
|
const {
|
|
372
373
|
treeConfig
|
|
373
374
|
} = props;
|
|
374
|
-
const
|
|
375
|
+
const virtualYOpts = $xeTable.computeVirtualYOpts;
|
|
375
376
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
376
377
|
const {
|
|
377
378
|
transform
|
|
378
379
|
} = treeOpts;
|
|
379
380
|
const allList = fullData || internalData.tableFullData;
|
|
380
381
|
// 如果gt为0,则总是启用
|
|
381
|
-
const scrollYLoad = (transform || !treeConfig) && !!
|
|
382
|
+
const scrollYLoad = (transform || !treeConfig) && !!virtualYOpts.enabled && virtualYOpts.gt > -1 && (virtualYOpts.gt === 0 || virtualYOpts.gt < allList.length);
|
|
382
383
|
reactData.scrollYLoad = scrollYLoad;
|
|
383
384
|
return scrollYLoad;
|
|
384
385
|
};
|
|
@@ -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) {
|
|
@@ -533,7 +540,6 @@ function updateStyle($xeTable) {
|
|
|
533
540
|
const reactData = $xeTable;
|
|
534
541
|
const internalData = $xeTable;
|
|
535
542
|
const {
|
|
536
|
-
border,
|
|
537
543
|
showHeaderOverflow: allColumnHeaderOverflow,
|
|
538
544
|
showFooterOverflow: allColumnFooterOverflow,
|
|
539
545
|
mouseConfig,
|
|
@@ -558,7 +564,6 @@ function updateStyle($xeTable) {
|
|
|
558
564
|
} = reactData;
|
|
559
565
|
const {
|
|
560
566
|
visibleColumn,
|
|
561
|
-
fullColumnIdData,
|
|
562
567
|
tableHeight,
|
|
563
568
|
headerHeight,
|
|
564
569
|
footerHeight,
|
|
@@ -575,7 +580,6 @@ function updateStyle($xeTable) {
|
|
|
575
580
|
const osbWidth = overflowY ? scrollbarWidth : 0;
|
|
576
581
|
const osbHeight = overflowX ? scrollbarHeight : 0;
|
|
577
582
|
const emptyPlaceholderElem = $xeTable.$refs.refEmptyPlaceholder;
|
|
578
|
-
const cellOffsetWidth = $xeTable.computeCellOffsetWidth;
|
|
579
583
|
const mouseOpts = $xeTable.computeMouseOpts;
|
|
580
584
|
const expandOpts = $xeTable.computeExpandOpts;
|
|
581
585
|
const bodyWrapperElem = (0, _util.getRefElem)(elemStore['main-body-wrapper']);
|
|
@@ -714,36 +718,6 @@ function updateStyle($xeTable) {
|
|
|
714
718
|
if (tableElem) {
|
|
715
719
|
tableElem.style.width = tWidth ? `${tWidth}px` : '';
|
|
716
720
|
}
|
|
717
|
-
const listElem = (0, _util.getRefElem)(elemStore[`${name}-${layout}-list`]);
|
|
718
|
-
if (isGroup && listElem) {
|
|
719
|
-
_xeUtils.default.arrayEach(listElem.querySelectorAll('.col--group'), thElem => {
|
|
720
|
-
const colNode = $xeTable.getColumnNode(thElem);
|
|
721
|
-
if (colNode) {
|
|
722
|
-
const column = colNode.item;
|
|
723
|
-
const {
|
|
724
|
-
showHeaderOverflow
|
|
725
|
-
} = column;
|
|
726
|
-
const cellOverflow = _xeUtils.default.isBoolean(showHeaderOverflow) ? showHeaderOverflow : allColumnHeaderOverflow;
|
|
727
|
-
const showEllipsis = cellOverflow === 'ellipsis';
|
|
728
|
-
const showTitle = cellOverflow === 'title';
|
|
729
|
-
const showTooltip = cellOverflow === true || cellOverflow === 'tooltip';
|
|
730
|
-
const hasEllipsis = showTitle || showTooltip || showEllipsis;
|
|
731
|
-
let childWidth = 0;
|
|
732
|
-
let countChild = 0;
|
|
733
|
-
if (hasEllipsis) {
|
|
734
|
-
_xeUtils.default.eachTree(column.children, item => {
|
|
735
|
-
if (!item.children || !column.children.length) {
|
|
736
|
-
countChild++;
|
|
737
|
-
}
|
|
738
|
-
childWidth += item.renderWidth;
|
|
739
|
-
}, {
|
|
740
|
-
children: 'children'
|
|
741
|
-
});
|
|
742
|
-
}
|
|
743
|
-
thElem.style.width = hasEllipsis ? `${childWidth - countChild - (border ? 2 : 0)}px` : '';
|
|
744
|
-
}
|
|
745
|
-
});
|
|
746
|
-
}
|
|
747
721
|
} else if (layout === 'body') {
|
|
748
722
|
if (currScrollElem) {
|
|
749
723
|
currScrollElem.style.maxHeight = customMaxHeight ? `${bodyMaxHeight}px` : '';
|
|
@@ -837,58 +811,6 @@ function updateStyle($xeTable) {
|
|
|
837
811
|
tableElem.style.width = tWidth ? `${tWidth}px` : '';
|
|
838
812
|
}
|
|
839
813
|
}
|
|
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
814
|
});
|
|
893
815
|
});
|
|
894
816
|
if (currentRow) {
|
|
@@ -899,6 +821,149 @@ function updateStyle($xeTable) {
|
|
|
899
821
|
}
|
|
900
822
|
return $xeTable.$nextTick();
|
|
901
823
|
}
|
|
824
|
+
function checkValidate($xeTable, type) {
|
|
825
|
+
if ($xeTable.triggerValidate) {
|
|
826
|
+
return $xeTable.triggerValidate(type);
|
|
827
|
+
}
|
|
828
|
+
return $xeTable.$nextTick();
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* 当单元格发生改变时
|
|
832
|
+
* 如果存在规则,则校验
|
|
833
|
+
*/
|
|
834
|
+
function handleChangeCell($xeTable, evnt, params) {
|
|
835
|
+
checkValidate($xeTable, 'blur').catch(e => e).then(() => {
|
|
836
|
+
$xeTable.handleEdit(params, evnt).then(() => checkValidate($xeTable, 'change')).catch(e => e);
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
function handleDefaultSort($xeTable) {
|
|
840
|
+
const props = $xeTable;
|
|
841
|
+
const {
|
|
842
|
+
sortConfig
|
|
843
|
+
} = props;
|
|
844
|
+
if (sortConfig) {
|
|
845
|
+
const sortOpts = $xeTable.computeSortOpts;
|
|
846
|
+
let {
|
|
847
|
+
defaultSort
|
|
848
|
+
} = sortOpts;
|
|
849
|
+
if (defaultSort) {
|
|
850
|
+
if (!_xeUtils.default.isArray(defaultSort)) {
|
|
851
|
+
defaultSort = [defaultSort];
|
|
852
|
+
}
|
|
853
|
+
if (defaultSort.length) {
|
|
854
|
+
(sortConfig.multiple ? defaultSort : defaultSort.slice(0, 1)).forEach((item, index) => {
|
|
855
|
+
const {
|
|
856
|
+
field,
|
|
857
|
+
order
|
|
858
|
+
} = item;
|
|
859
|
+
if (field && order) {
|
|
860
|
+
const column = $xeTable.getColumnByField(field);
|
|
861
|
+
if (column && column.sortable) {
|
|
862
|
+
column.order = order;
|
|
863
|
+
column.sortTime = Date.now() + index;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
});
|
|
867
|
+
if (!sortOpts.remote) {
|
|
868
|
+
$xeTable.handleTableData(true).then(updateStyle);
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* 处理默认勾选
|
|
876
|
+
*/
|
|
877
|
+
function handleDefaultSelectionChecked($xeTable) {
|
|
878
|
+
const props = $xeTable;
|
|
879
|
+
const internalData = $xeTable;
|
|
880
|
+
const {
|
|
881
|
+
checkboxConfig
|
|
882
|
+
} = props;
|
|
883
|
+
if (checkboxConfig) {
|
|
884
|
+
const {
|
|
885
|
+
fullDataRowIdData
|
|
886
|
+
} = internalData;
|
|
887
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
888
|
+
const {
|
|
889
|
+
checkAll,
|
|
890
|
+
checkRowKeys
|
|
891
|
+
} = checkboxOpts;
|
|
892
|
+
if (checkAll) {
|
|
893
|
+
handleCheckedAllCheckboxRow($xeTable, true, true);
|
|
894
|
+
} else if (checkRowKeys) {
|
|
895
|
+
const defSelection = [];
|
|
896
|
+
checkRowKeys.forEach(rowid => {
|
|
897
|
+
if (fullDataRowIdData[rowid]) {
|
|
898
|
+
defSelection.push(fullDataRowIdData[rowid].row);
|
|
899
|
+
}
|
|
900
|
+
});
|
|
901
|
+
handleCheckedCheckboxRow($xeTable, defSelection, true, true);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
* 处理单选框默认勾选
|
|
907
|
+
*/
|
|
908
|
+
function handleDefaultRadioChecked($xeTable) {
|
|
909
|
+
const props = $xeTable;
|
|
910
|
+
const internalData = $xeTable;
|
|
911
|
+
const {
|
|
912
|
+
radioConfig
|
|
913
|
+
} = props;
|
|
914
|
+
if (radioConfig) {
|
|
915
|
+
const {
|
|
916
|
+
fullDataRowIdData
|
|
917
|
+
} = internalData;
|
|
918
|
+
const radioOpts = $xeTable.computeRadioOpts;
|
|
919
|
+
const {
|
|
920
|
+
checkRowKey: rowid,
|
|
921
|
+
reserve
|
|
922
|
+
} = radioOpts;
|
|
923
|
+
if (rowid) {
|
|
924
|
+
if (fullDataRowIdData[rowid]) {
|
|
925
|
+
handleCheckedRadioRow(fullDataRowIdData[rowid].row, true);
|
|
926
|
+
}
|
|
927
|
+
if (reserve) {
|
|
928
|
+
const rowkey = (0, _util.getRowkey)($xeTable);
|
|
929
|
+
internalData.radioReserveRow = {
|
|
930
|
+
[rowkey]: rowid
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* 处理默认展开行
|
|
938
|
+
*/
|
|
939
|
+
function handleDefaultRowExpand($xeTable) {
|
|
940
|
+
const props = $xeTable;
|
|
941
|
+
const internalData = $xeTable;
|
|
942
|
+
const {
|
|
943
|
+
expandConfig
|
|
944
|
+
} = props;
|
|
945
|
+
if (expandConfig) {
|
|
946
|
+
const {
|
|
947
|
+
fullDataRowIdData
|
|
948
|
+
} = internalData;
|
|
949
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
950
|
+
const {
|
|
951
|
+
expandAll,
|
|
952
|
+
expandRowKeys
|
|
953
|
+
} = expandOpts;
|
|
954
|
+
if (expandAll) {
|
|
955
|
+
$xeTable.setAllRowExpand(true);
|
|
956
|
+
} else if (expandRowKeys) {
|
|
957
|
+
const defExpandeds = [];
|
|
958
|
+
expandRowKeys.forEach(rowid => {
|
|
959
|
+
if (fullDataRowIdData[rowid]) {
|
|
960
|
+
defExpandeds.push(fullDataRowIdData[rowid].row);
|
|
961
|
+
}
|
|
962
|
+
});
|
|
963
|
+
$xeTable.setRowExpand(defExpandeds, true);
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
}
|
|
902
967
|
function handleRadioReserveRow($xeTable, row) {
|
|
903
968
|
const internalData = $xeTable;
|
|
904
969
|
const radioOpts = $xeTable.computeRadioOpts;
|
|
@@ -950,12 +1015,10 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
|
|
|
950
1015
|
const {
|
|
951
1016
|
treeConfig
|
|
952
1017
|
} = props;
|
|
953
|
-
const {
|
|
954
|
-
selectCheckboxMaps
|
|
955
|
-
} = reactData;
|
|
956
1018
|
const {
|
|
957
1019
|
afterFullData,
|
|
958
|
-
checkboxReserveRowMap
|
|
1020
|
+
checkboxReserveRowMap,
|
|
1021
|
+
selectCheckboxMaps
|
|
959
1022
|
} = internalData;
|
|
960
1023
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
961
1024
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
@@ -965,6 +1028,9 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
|
|
|
965
1028
|
reserve,
|
|
966
1029
|
checkMethod
|
|
967
1030
|
} = checkboxOpts;
|
|
1031
|
+
const {
|
|
1032
|
+
handleGetRowId
|
|
1033
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
968
1034
|
// indeterminateField 仅支持读取
|
|
969
1035
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
970
1036
|
const selectRowMaps = {};
|
|
@@ -978,7 +1044,7 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
|
|
|
978
1044
|
row
|
|
979
1045
|
})) {
|
|
980
1046
|
if (checked) {
|
|
981
|
-
selectRowMaps[(
|
|
1047
|
+
selectRowMaps[handleGetRowId(row)] = row;
|
|
982
1048
|
}
|
|
983
1049
|
_xeUtils.default.set(row, checkField, checked);
|
|
984
1050
|
}
|
|
@@ -1010,7 +1076,8 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
|
|
|
1010
1076
|
if (isForce || !checkMethod || checkMethod({
|
|
1011
1077
|
row
|
|
1012
1078
|
})) {
|
|
1013
|
-
|
|
1079
|
+
const rowid = handleGetRowId(row);
|
|
1080
|
+
selectRowMaps[rowid] = row;
|
|
1014
1081
|
}
|
|
1015
1082
|
}, {
|
|
1016
1083
|
children: childrenField
|
|
@@ -1022,7 +1089,7 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
|
|
|
1022
1089
|
*/
|
|
1023
1090
|
if (!isForce && checkMethod) {
|
|
1024
1091
|
_xeUtils.default.eachTree(afterFullData, row => {
|
|
1025
|
-
const rowid = (
|
|
1092
|
+
const rowid = handleGetRowId(row);
|
|
1026
1093
|
if (checkMethod({
|
|
1027
1094
|
row
|
|
1028
1095
|
}) ? 0 : selectCheckboxMaps[rowid]) {
|
|
@@ -1042,7 +1109,7 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
|
|
|
1042
1109
|
*/
|
|
1043
1110
|
if (!isForce && checkMethod) {
|
|
1044
1111
|
afterFullData.forEach(row => {
|
|
1045
|
-
const rowid = (
|
|
1112
|
+
const rowid = handleGetRowId(row);
|
|
1046
1113
|
if (selectCheckboxMaps[rowid] || checkMethod({
|
|
1047
1114
|
row
|
|
1048
1115
|
})) {
|
|
@@ -1051,7 +1118,8 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
|
|
|
1051
1118
|
});
|
|
1052
1119
|
} else {
|
|
1053
1120
|
afterFullData.forEach(row => {
|
|
1054
|
-
|
|
1121
|
+
const rowid = handleGetRowId(row);
|
|
1122
|
+
selectRowMaps[rowid] = row;
|
|
1055
1123
|
});
|
|
1056
1124
|
}
|
|
1057
1125
|
} else {
|
|
@@ -1062,7 +1130,7 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
|
|
|
1062
1130
|
*/
|
|
1063
1131
|
if (!isForce && checkMethod) {
|
|
1064
1132
|
afterFullData.forEach(row => {
|
|
1065
|
-
const rowid = (
|
|
1133
|
+
const rowid = handleGetRowId(row);
|
|
1066
1134
|
if (checkMethod({
|
|
1067
1135
|
row
|
|
1068
1136
|
}) ? 0 : selectCheckboxMaps[rowid]) {
|
|
@@ -1082,10 +1150,10 @@ function handleCheckedAllCheckboxRow($xeTable, checked, isForce) {
|
|
|
1082
1150
|
afterFullData.forEach(row => handleCheckboxReserveRow($xeTable, row, false));
|
|
1083
1151
|
}
|
|
1084
1152
|
}
|
|
1085
|
-
reactData.
|
|
1153
|
+
reactData.updateCheckboxFlag++;
|
|
1154
|
+
internalData.selectCheckboxMaps = checkField ? {} : selectRowMaps;
|
|
1086
1155
|
reactData.isAllSelected = checked;
|
|
1087
1156
|
reactData.isIndeterminate = false;
|
|
1088
|
-
reactData.treeIndeterminateMaps = {};
|
|
1089
1157
|
internalData.treeIndeterminateRowMaps = {};
|
|
1090
1158
|
$xeTable.checkSelectionStatus();
|
|
1091
1159
|
return $xeTable.$nextTick();
|
|
@@ -1101,15 +1169,15 @@ function handleReserveStatus($xeTable) {
|
|
|
1101
1169
|
const {
|
|
1102
1170
|
expandColumn,
|
|
1103
1171
|
currentRow,
|
|
1104
|
-
|
|
1105
|
-
selectRadioRow,
|
|
1106
|
-
rowExpandedMaps,
|
|
1107
|
-
treeExpandedMaps
|
|
1172
|
+
selectRadioRow
|
|
1108
1173
|
} = reactData;
|
|
1109
1174
|
const {
|
|
1110
1175
|
fullDataRowIdData,
|
|
1111
1176
|
fullAllDataRowIdData,
|
|
1112
|
-
radioReserveRow
|
|
1177
|
+
radioReserveRow,
|
|
1178
|
+
selectCheckboxMaps,
|
|
1179
|
+
treeExpandedMaps,
|
|
1180
|
+
rowExpandedMaps
|
|
1113
1181
|
} = internalData;
|
|
1114
1182
|
const expandOpts = $xeTable.computeExpandOpts;
|
|
1115
1183
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
@@ -1127,7 +1195,8 @@ function handleReserveStatus($xeTable) {
|
|
|
1127
1195
|
}
|
|
1128
1196
|
}
|
|
1129
1197
|
// 复选框
|
|
1130
|
-
|
|
1198
|
+
internalData.selectCheckboxMaps = getRecoverRowMaps($xeTable, selectCheckboxMaps); // 刷新多选行状态
|
|
1199
|
+
reactData.updateCheckboxFlag++;
|
|
1131
1200
|
// 还原保留选中状态
|
|
1132
1201
|
if (checkboxOpts.reserve) {
|
|
1133
1202
|
handleCheckedCheckboxRow($xeTable, handleReserveRow($xeTable, internalData.checkboxReserveRowMap), true, true);
|
|
@@ -1136,17 +1205,194 @@ function handleReserveStatus($xeTable) {
|
|
|
1136
1205
|
reactData.currentRow = null; // 刷新当前行状态
|
|
1137
1206
|
}
|
|
1138
1207
|
// 行展开
|
|
1139
|
-
|
|
1208
|
+
internalData.rowExpandedMaps = expandColumn ? getRecoverRowMaps($xeTable, rowExpandedMaps) : {}; // 刷新行展开状态
|
|
1209
|
+
reactData.rowExpandedFlag++;
|
|
1140
1210
|
// 还原保留状态
|
|
1141
1211
|
if (expandColumn && expandOpts.reserve) {
|
|
1142
1212
|
$xeTable.setRowExpand(handleReserveRow($xeTable, internalData.rowExpandedReserveRowMap), true);
|
|
1143
1213
|
}
|
|
1144
1214
|
// 树展开
|
|
1145
|
-
|
|
1215
|
+
internalData.treeExpandedMaps = treeConfig ? getRecoverRowMaps($xeTable, treeExpandedMaps) : {}; // 刷新树展开状态
|
|
1216
|
+
reactData.treeExpandedFlag++;
|
|
1146
1217
|
if (treeConfig && treeOpts.reserve) {
|
|
1147
1218
|
$xeTable.setTreeExpand(handleReserveRow($xeTable, internalData.treeExpandedReserveRowMap), true);
|
|
1148
1219
|
}
|
|
1149
1220
|
}
|
|
1221
|
+
/**
|
|
1222
|
+
* 处理默认展开树节点
|
|
1223
|
+
*/
|
|
1224
|
+
const handleDefaultTreeExpand = $xeTable => {
|
|
1225
|
+
const props = $xeTable;
|
|
1226
|
+
const internalData = $xeTable;
|
|
1227
|
+
const {
|
|
1228
|
+
treeConfig
|
|
1229
|
+
} = props;
|
|
1230
|
+
if (treeConfig) {
|
|
1231
|
+
const {
|
|
1232
|
+
tableFullData
|
|
1233
|
+
} = internalData;
|
|
1234
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
1235
|
+
const {
|
|
1236
|
+
expandAll,
|
|
1237
|
+
expandRowKeys
|
|
1238
|
+
} = treeOpts;
|
|
1239
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
1240
|
+
if (expandAll) {
|
|
1241
|
+
$xeTable.setAllTreeExpand(true);
|
|
1242
|
+
} else if (expandRowKeys) {
|
|
1243
|
+
const defExpandeds = [];
|
|
1244
|
+
const rowkey = (0, _util.getRowkey)($xeTable);
|
|
1245
|
+
expandRowKeys.forEach(rowid => {
|
|
1246
|
+
const matchObj = _xeUtils.default.findTree(tableFullData, item => rowid === _xeUtils.default.get(item, rowkey), {
|
|
1247
|
+
children: childrenField
|
|
1248
|
+
});
|
|
1249
|
+
if (matchObj) {
|
|
1250
|
+
defExpandeds.push(matchObj.item);
|
|
1251
|
+
}
|
|
1252
|
+
});
|
|
1253
|
+
$xeTable.setTreeExpand(defExpandeds, true);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
};
|
|
1257
|
+
const handleAsyncTreeExpandChilds = ($xeTable, row) => {
|
|
1258
|
+
const reactData = $xeTable;
|
|
1259
|
+
const internalData = $xeTable;
|
|
1260
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
1261
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
1262
|
+
const {
|
|
1263
|
+
transform,
|
|
1264
|
+
loadMethod
|
|
1265
|
+
} = treeOpts;
|
|
1266
|
+
const {
|
|
1267
|
+
checkStrictly
|
|
1268
|
+
} = checkboxOpts;
|
|
1269
|
+
return new Promise(resolve => {
|
|
1270
|
+
if (loadMethod) {
|
|
1271
|
+
const {
|
|
1272
|
+
fullAllDataRowIdData,
|
|
1273
|
+
treeExpandLazyLoadedMaps
|
|
1274
|
+
} = internalData;
|
|
1275
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
1276
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
1277
|
+
treeExpandLazyLoadedMaps[rowid] = row;
|
|
1278
|
+
Promise.resolve(loadMethod({
|
|
1279
|
+
$table: $xeTable,
|
|
1280
|
+
row
|
|
1281
|
+
})).then(childRecords => {
|
|
1282
|
+
if (rowRest) {
|
|
1283
|
+
rowRest.treeLoaded = true;
|
|
1284
|
+
}
|
|
1285
|
+
if (treeExpandLazyLoadedMaps[rowid]) {
|
|
1286
|
+
delete treeExpandLazyLoadedMaps[rowid];
|
|
1287
|
+
}
|
|
1288
|
+
if (!_xeUtils.default.isArray(childRecords)) {
|
|
1289
|
+
childRecords = [];
|
|
1290
|
+
}
|
|
1291
|
+
if (childRecords) {
|
|
1292
|
+
return $xeTable.loadTreeChildren(row, childRecords).then(childRows => {
|
|
1293
|
+
const {
|
|
1294
|
+
treeExpandedMaps
|
|
1295
|
+
} = internalData;
|
|
1296
|
+
if (childRows.length && !treeExpandedMaps[rowid]) {
|
|
1297
|
+
treeExpandedMaps[rowid] = row;
|
|
1298
|
+
}
|
|
1299
|
+
reactData.treeExpandedFlag++;
|
|
1300
|
+
// 如果当前节点已选中,则展开后子节点也被选中
|
|
1301
|
+
if (!checkStrictly && $xeTable.isCheckedByCheckboxRow(row)) {
|
|
1302
|
+
handleCheckedCheckboxRow($xeTable, childRows, true);
|
|
1303
|
+
}
|
|
1304
|
+
return $xeTable.$nextTick().then(() => {
|
|
1305
|
+
if (transform) {
|
|
1306
|
+
$xeTable.handleTableData();
|
|
1307
|
+
updateAfterDataIndex($xeTable);
|
|
1308
|
+
return $xeTable.$nextTick();
|
|
1309
|
+
}
|
|
1310
|
+
});
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1313
|
+
}).catch(() => {
|
|
1314
|
+
const {
|
|
1315
|
+
treeExpandLazyLoadedMaps
|
|
1316
|
+
} = internalData;
|
|
1317
|
+
if (rowRest) {
|
|
1318
|
+
rowRest.treeLoaded = false;
|
|
1319
|
+
}
|
|
1320
|
+
if (treeExpandLazyLoadedMaps[rowid]) {
|
|
1321
|
+
delete treeExpandLazyLoadedMaps[rowid];
|
|
1322
|
+
}
|
|
1323
|
+
}).finally(() => {
|
|
1324
|
+
reactData.treeExpandedFlag++;
|
|
1325
|
+
$xeTable.$nextTick().then(() => $xeTable.recalculate()).then(() => resolve());
|
|
1326
|
+
});
|
|
1327
|
+
} else {
|
|
1328
|
+
resolve();
|
|
1329
|
+
}
|
|
1330
|
+
});
|
|
1331
|
+
};
|
|
1332
|
+
const handleTreeExpandReserve = ($xeTable, row, expanded) => {
|
|
1333
|
+
const internalData = $xeTable;
|
|
1334
|
+
const {
|
|
1335
|
+
treeExpandedReserveRowMap
|
|
1336
|
+
} = internalData;
|
|
1337
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
1338
|
+
if (treeOpts.reserve) {
|
|
1339
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
1340
|
+
if (expanded) {
|
|
1341
|
+
treeExpandedReserveRowMap[rowid] = row;
|
|
1342
|
+
} else if (treeExpandedReserveRowMap[rowid]) {
|
|
1343
|
+
delete treeExpandedReserveRowMap[rowid];
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
const handleAsyncRowExpand = ($xeTable, row) => {
|
|
1348
|
+
const reactData = $xeTable;
|
|
1349
|
+
const internalData = $xeTable;
|
|
1350
|
+
return new Promise(resolve => {
|
|
1351
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
1352
|
+
const {
|
|
1353
|
+
loadMethod
|
|
1354
|
+
} = expandOpts;
|
|
1355
|
+
if (loadMethod) {
|
|
1356
|
+
const {
|
|
1357
|
+
fullAllDataRowIdData,
|
|
1358
|
+
rowExpandLazyLoadedMaps
|
|
1359
|
+
} = internalData;
|
|
1360
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
1361
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
1362
|
+
rowExpandLazyLoadedMaps[rowid] = row;
|
|
1363
|
+
loadMethod({
|
|
1364
|
+
$table: $xeTable,
|
|
1365
|
+
row,
|
|
1366
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
1367
|
+
$rowIndex: $xeTable.getVMRowIndex(row)
|
|
1368
|
+
}).then(() => {
|
|
1369
|
+
const {
|
|
1370
|
+
rowExpandedMaps
|
|
1371
|
+
} = internalData;
|
|
1372
|
+
if (rowRest) {
|
|
1373
|
+
rowRest.expandLoaded = true;
|
|
1374
|
+
}
|
|
1375
|
+
rowExpandedMaps[rowid] = row;
|
|
1376
|
+
reactData.rowExpandedFlag++;
|
|
1377
|
+
}).catch(() => {
|
|
1378
|
+
if (rowRest) {
|
|
1379
|
+
rowRest.expandLoaded = false;
|
|
1380
|
+
}
|
|
1381
|
+
}).finally(() => {
|
|
1382
|
+
const {
|
|
1383
|
+
rowExpandLazyLoadedMaps
|
|
1384
|
+
} = internalData;
|
|
1385
|
+
if (rowExpandLazyLoadedMaps[rowid]) {
|
|
1386
|
+
delete rowExpandLazyLoadedMaps[rowid];
|
|
1387
|
+
}
|
|
1388
|
+
reactData.rowExpandedFlag++;
|
|
1389
|
+
$xeTable.$nextTick().then(() => $xeTable.recalculate()).then(() => $xeTable.updateCellAreas()).then(() => resolve());
|
|
1390
|
+
});
|
|
1391
|
+
} else {
|
|
1392
|
+
resolve();
|
|
1393
|
+
}
|
|
1394
|
+
});
|
|
1395
|
+
};
|
|
1150
1396
|
function calcVarRowHeightConfig($xeTable, sizeKey, sizeEl) {
|
|
1151
1397
|
const reactData = $xeTable;
|
|
1152
1398
|
const {
|
|
@@ -1221,12 +1467,15 @@ function handleVirtualYVisible($xeTable) {
|
|
|
1221
1467
|
toVisibleIndex = Math.floor(startTop / defaultRowHeight) - 1;
|
|
1222
1468
|
visibleSize = Math.ceil(clientHeight / defaultRowHeight) + 1;
|
|
1223
1469
|
} else {
|
|
1470
|
+
const {
|
|
1471
|
+
handleGetRowId
|
|
1472
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
1224
1473
|
let leftIndex = 0;
|
|
1225
1474
|
let rightIndex = afterFullData.length;
|
|
1226
1475
|
while (leftIndex < rightIndex) {
|
|
1227
1476
|
const rIndex = Math.floor((leftIndex + rightIndex) / 2);
|
|
1228
1477
|
const row = afterFullData[rIndex];
|
|
1229
|
-
const rowid = (
|
|
1478
|
+
const rowid = handleGetRowId(row);
|
|
1230
1479
|
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
1231
1480
|
if (rowRest.oTop <= startTop) {
|
|
1232
1481
|
leftIndex = rIndex + 1;
|
|
@@ -1237,7 +1486,7 @@ function handleVirtualYVisible($xeTable) {
|
|
|
1237
1486
|
toVisibleIndex = Math.max(0, leftIndex < afterFullData.length ? leftIndex - 2 : 0);
|
|
1238
1487
|
for (let rIndex = toVisibleIndex, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
|
|
1239
1488
|
const row = afterFullData[rIndex];
|
|
1240
|
-
const rowid = (
|
|
1489
|
+
const rowid = handleGetRowId(row);
|
|
1241
1490
|
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
1242
1491
|
visibleSize++;
|
|
1243
1492
|
if (rowRest.oTop > endTop || visibleSize >= 100) {
|
|
@@ -1276,18 +1525,20 @@ function calculateMergerOffsetIndex(list, offsetItem, type) {
|
|
|
1276
1525
|
}
|
|
1277
1526
|
}
|
|
1278
1527
|
}
|
|
1279
|
-
function setMerges(
|
|
1528
|
+
function setMerges($xeTable, merges, mList, rowList) {
|
|
1529
|
+
// const props = $xeTable
|
|
1530
|
+
const internalData = $xeTable;
|
|
1280
1531
|
if (merges) {
|
|
1532
|
+
// const { treeConfig } = props
|
|
1281
1533
|
const {
|
|
1282
|
-
treeConfig,
|
|
1283
1534
|
visibleColumn
|
|
1284
|
-
} =
|
|
1535
|
+
} = internalData;
|
|
1285
1536
|
if (!_xeUtils.default.isArray(merges)) {
|
|
1286
1537
|
merges = [merges];
|
|
1287
1538
|
}
|
|
1288
|
-
if (treeConfig && merges.length) {
|
|
1289
|
-
|
|
1290
|
-
}
|
|
1539
|
+
// if (treeConfig && merges.length) {
|
|
1540
|
+
// errLog('vxe.error.noTree', ['merge-cells | merge-footer-items'])
|
|
1541
|
+
// }
|
|
1291
1542
|
merges.forEach(item => {
|
|
1292
1543
|
let {
|
|
1293
1544
|
row,
|
|
@@ -1331,19 +1582,21 @@ function setMerges(_vm, merges, mList, rowList) {
|
|
|
1331
1582
|
});
|
|
1332
1583
|
}
|
|
1333
1584
|
}
|
|
1334
|
-
function removeMerges(
|
|
1585
|
+
function removeMerges($xeTable, merges, mList, rowList) {
|
|
1586
|
+
// const props = $xeTable
|
|
1587
|
+
const internalData = $xeTable;
|
|
1335
1588
|
const rest = [];
|
|
1336
1589
|
if (merges) {
|
|
1590
|
+
// const { treeConfig } = props
|
|
1337
1591
|
const {
|
|
1338
|
-
treeConfig,
|
|
1339
1592
|
visibleColumn
|
|
1340
|
-
} =
|
|
1593
|
+
} = internalData;
|
|
1341
1594
|
if (!_xeUtils.default.isArray(merges)) {
|
|
1342
1595
|
merges = [merges];
|
|
1343
1596
|
}
|
|
1344
|
-
if (treeConfig && merges.length) {
|
|
1345
|
-
|
|
1346
|
-
}
|
|
1597
|
+
// if (treeConfig && merges.length) {
|
|
1598
|
+
// errLog('vxe.error.noTree', ['merge-cells | merge-footer-items'])
|
|
1599
|
+
// }
|
|
1347
1600
|
merges.forEach(item => {
|
|
1348
1601
|
let {
|
|
1349
1602
|
row,
|
|
@@ -1534,6 +1787,7 @@ function autoCellWidth($xeTable) {
|
|
|
1534
1787
|
internalData.headerHeight = headerHeight;
|
|
1535
1788
|
internalData.footerHeight = footerHeight;
|
|
1536
1789
|
reactData.overflowX = overflowX;
|
|
1790
|
+
reactData.resizeWidthFlag++;
|
|
1537
1791
|
updateColumnOffsetLeft($xeTable);
|
|
1538
1792
|
updateHeight($xeTable);
|
|
1539
1793
|
reactData.parentHeight = Math.max(internalData.headerHeight + footerHeight + 20, $xeTable.getParentHeight());
|
|
@@ -1568,8 +1822,11 @@ const calcCellHeight = $xeTable => {
|
|
|
1568
1822
|
const defaultRowHeight = $xeTable.computeDefaultRowHeight;
|
|
1569
1823
|
const el = $xeTable.$refs.refElem;
|
|
1570
1824
|
if (!isAllOverflow && scrollYLoad && el) {
|
|
1825
|
+
const {
|
|
1826
|
+
handleGetRowId
|
|
1827
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
1571
1828
|
tableData.forEach(row => {
|
|
1572
|
-
const rowid = (
|
|
1829
|
+
const rowid = handleGetRowId(row);
|
|
1573
1830
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
1574
1831
|
if (rowRest) {
|
|
1575
1832
|
const height = calcCellAutoHeight(rowRest, el);
|
|
@@ -1826,9 +2083,10 @@ function hideDropTip($xeTable) {
|
|
|
1826
2083
|
* @param {Event} evnt 事件
|
|
1827
2084
|
* @param {Row} row 行对象
|
|
1828
2085
|
*/
|
|
1829
|
-
function handleTooltip($xeTable, evnt, tdEl, overflowElem,
|
|
2086
|
+
function handleTooltip($xeTable, evnt, tdEl, overflowElem, params) {
|
|
1830
2087
|
const reactData = $xeTable;
|
|
1831
|
-
|
|
2088
|
+
const tipOverEl = overflowElem || tdEl;
|
|
2089
|
+
if (!tipOverEl) {
|
|
1832
2090
|
return $xeTable.$nextTick();
|
|
1833
2091
|
}
|
|
1834
2092
|
params.cell = tdEl;
|
|
@@ -1846,9 +2104,8 @@ function handleTooltip($xeTable, evnt, tdEl, overflowElem, tipElem, params) {
|
|
|
1846
2104
|
} = tooltipOpts;
|
|
1847
2105
|
const customContent = contentMethod ? contentMethod(params) : null;
|
|
1848
2106
|
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)) {
|
|
2107
|
+
const content = useCustom ? customContent : _xeUtils.default.toString(column.type === 'html' ? tipOverEl.innerText : tipOverEl.textContent).trim();
|
|
2108
|
+
if (content && (showAll || useCustom || tipOverEl.scrollWidth > tipOverEl.clientWidth)) {
|
|
1852
2109
|
Object.assign(tooltipStore, {
|
|
1853
2110
|
row,
|
|
1854
2111
|
column,
|
|
@@ -1858,7 +2115,7 @@ function handleTooltip($xeTable, evnt, tdEl, overflowElem, tipElem, params) {
|
|
|
1858
2115
|
$xeTable.$nextTick(() => {
|
|
1859
2116
|
const $tooltip = $xeTable.$refs.refTooltip;
|
|
1860
2117
|
if ($tooltip && $tooltip.open) {
|
|
1861
|
-
$tooltip.open(
|
|
2118
|
+
$tooltip.open(tipOverEl, (0, _utils.formatText)(content));
|
|
1862
2119
|
}
|
|
1863
2120
|
});
|
|
1864
2121
|
}
|
|
@@ -1875,7 +2132,7 @@ function handleScrollToRowColumn($xeTable, fieldOrColumn, row) {
|
|
|
1875
2132
|
}
|
|
1876
2133
|
return $xeTable.$nextTick();
|
|
1877
2134
|
}
|
|
1878
|
-
|
|
2135
|
+
function handleRowExpandReserve($xeTable, row, expanded) {
|
|
1879
2136
|
const internalData = $xeTable;
|
|
1880
2137
|
const {
|
|
1881
2138
|
rowExpandedReserveRowMap
|
|
@@ -1889,7 +2146,25 @@ const handleRowExpandReserve = ($xeTable, row, expanded) => {
|
|
|
1889
2146
|
delete rowExpandedReserveRowMap[rowid];
|
|
1890
2147
|
}
|
|
1891
2148
|
}
|
|
1892
|
-
}
|
|
2149
|
+
}
|
|
2150
|
+
function handleDefaultMergeCells($xeTable) {
|
|
2151
|
+
const props = $xeTable;
|
|
2152
|
+
const {
|
|
2153
|
+
mergeCells
|
|
2154
|
+
} = props;
|
|
2155
|
+
if (mergeCells) {
|
|
2156
|
+
$xeTable.setMergeCells(mergeCells);
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
function handleDefaultMergeFooterItems($xeTable) {
|
|
2160
|
+
const props = $xeTable;
|
|
2161
|
+
const {
|
|
2162
|
+
mergeFooterItems
|
|
2163
|
+
} = props;
|
|
2164
|
+
if (mergeFooterItems) {
|
|
2165
|
+
$xeTable.setMergeFooterItems(mergeFooterItems);
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
1893
2168
|
// 计算可视渲染相关数据
|
|
1894
2169
|
function computeScrollLoad($xeTable) {
|
|
1895
2170
|
const reactData = $xeTable;
|
|
@@ -1987,6 +2262,26 @@ function handleRecalculateLayout($xeTable, reFull) {
|
|
|
1987
2262
|
}
|
|
1988
2263
|
});
|
|
1989
2264
|
}
|
|
2265
|
+
/**
|
|
2266
|
+
* 处理数据加载默认行为
|
|
2267
|
+
* 默认执行一次,除非被重置
|
|
2268
|
+
*/
|
|
2269
|
+
function handleLoadDefaults($xeTable) {
|
|
2270
|
+
handleDefaultSelectionChecked($xeTable);
|
|
2271
|
+
handleDefaultRadioChecked($xeTable);
|
|
2272
|
+
handleDefaultRowExpand($xeTable);
|
|
2273
|
+
handleDefaultTreeExpand($xeTable);
|
|
2274
|
+
handleDefaultMergeCells($xeTable);
|
|
2275
|
+
handleDefaultMergeFooterItems($xeTable);
|
|
2276
|
+
$xeTable.$nextTick(() => setTimeout(() => $xeTable.recalculate()));
|
|
2277
|
+
}
|
|
2278
|
+
/**
|
|
2279
|
+
* 处理初始化的默认行为
|
|
2280
|
+
* 只会执行一次
|
|
2281
|
+
*/
|
|
2282
|
+
function handleInitDefaults($xeTable) {
|
|
2283
|
+
handleDefaultSort($xeTable);
|
|
2284
|
+
}
|
|
1990
2285
|
function handleTableColumn($xeTable) {
|
|
1991
2286
|
const reactData = $xeTable;
|
|
1992
2287
|
const internalData = $xeTable;
|
|
@@ -2069,10 +2364,8 @@ function parseColumns($xeTable, isReset) {
|
|
|
2069
2364
|
const props = $xeTable;
|
|
2070
2365
|
const reactData = $xeTable;
|
|
2071
2366
|
const internalData = $xeTable;
|
|
2072
|
-
const {
|
|
2073
|
-
|
|
2074
|
-
} = props;
|
|
2075
|
-
const rowOpts = $xeTable.computeRowOpts;
|
|
2367
|
+
// const { showOverflow } = props
|
|
2368
|
+
// const rowOpts = $xeTable.computeRowOpts
|
|
2076
2369
|
const leftList = [];
|
|
2077
2370
|
const centerList = [];
|
|
2078
2371
|
const rightList = [];
|
|
@@ -2080,7 +2373,7 @@ function parseColumns($xeTable, isReset) {
|
|
|
2080
2373
|
isGroup,
|
|
2081
2374
|
columnStore
|
|
2082
2375
|
} = reactData;
|
|
2083
|
-
const
|
|
2376
|
+
const virtualXOpts = $xeTable.computeVirtualXOpts;
|
|
2084
2377
|
const {
|
|
2085
2378
|
collectColumn,
|
|
2086
2379
|
tableFullColumn,
|
|
@@ -2141,7 +2434,7 @@ function parseColumns($xeTable, isReset) {
|
|
|
2141
2434
|
}
|
|
2142
2435
|
const visibleColumn = leftList.concat(centerList).concat(rightList);
|
|
2143
2436
|
// 如果gt为0,则总是启用
|
|
2144
|
-
const scrollXLoad = !!
|
|
2437
|
+
const scrollXLoad = !!virtualXOpts.enabled && virtualXOpts.gt > -1 && (virtualXOpts.gt === 0 || virtualXOpts.gt < tableFullColumn.length);
|
|
2145
2438
|
reactData.hasFixedColumn = leftList.length > 0 || rightList.length > 0;
|
|
2146
2439
|
Object.assign(columnStore, {
|
|
2147
2440
|
leftList,
|
|
@@ -2149,28 +2442,28 @@ function parseColumns($xeTable, isReset) {
|
|
|
2149
2442
|
rightList
|
|
2150
2443
|
});
|
|
2151
2444
|
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
|
-
}
|
|
2445
|
+
// if (showOverflow) {
|
|
2446
|
+
// if (!rowOpts.height) {
|
|
2447
|
+
// const errColumn = internalData.tableFullColumn.find(column => column.showOverflow === false)
|
|
2448
|
+
// if (errColumn) {
|
|
2449
|
+
// errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
|
|
2450
|
+
// }
|
|
2451
|
+
// }
|
|
2452
|
+
// }
|
|
2453
|
+
// if (process.env.NODE_ENV === 'development') {
|
|
2454
|
+
// if (props.showHeader && !props.showHeaderOverflow) {
|
|
2455
|
+
// warnLog('vxe.error.reqProp', ['show-header-overflow'])
|
|
2456
|
+
// }
|
|
2457
|
+
// if (props.showFooter && !props.showFooterOverflow) {
|
|
2458
|
+
// warnLog('vxe.error.reqProp', ['show-footer-overflow'])
|
|
2459
|
+
// }
|
|
2460
|
+
if (props.spanMethod) {
|
|
2461
|
+
(0, _log.warnLog)('vxe.error.scrollErrProp', ['span-method']);
|
|
2462
|
+
}
|
|
2463
|
+
if (props.footerSpanMethod) {
|
|
2464
|
+
(0, _log.warnLog)('vxe.error.scrollErrProp', ['footer-span-method']);
|
|
2465
|
+
}
|
|
2466
|
+
// }
|
|
2174
2467
|
if (isReset) {
|
|
2175
2468
|
const {
|
|
2176
2469
|
visibleSize
|
|
@@ -2307,6 +2600,39 @@ function loadScrollYData($xeTable) {
|
|
|
2307
2600
|
}
|
|
2308
2601
|
}
|
|
2309
2602
|
}
|
|
2603
|
+
const createGetRowCacheProp = prop => {
|
|
2604
|
+
return function (row) {
|
|
2605
|
+
const $xeTable = this;
|
|
2606
|
+
const internalData = $xeTable;
|
|
2607
|
+
const {
|
|
2608
|
+
fullAllDataRowIdData
|
|
2609
|
+
} = internalData;
|
|
2610
|
+
if (row) {
|
|
2611
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
2612
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
2613
|
+
if (rowRest) {
|
|
2614
|
+
return rowRest[prop];
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
return -1;
|
|
2618
|
+
};
|
|
2619
|
+
};
|
|
2620
|
+
const createGetColumnCacheProp = prop => {
|
|
2621
|
+
return function (column) {
|
|
2622
|
+
const $xeTable = this;
|
|
2623
|
+
const internalData = $xeTable;
|
|
2624
|
+
const {
|
|
2625
|
+
fullColumnIdData
|
|
2626
|
+
} = internalData;
|
|
2627
|
+
if (column) {
|
|
2628
|
+
const colRest = fullColumnIdData[column.id];
|
|
2629
|
+
if (colRest) {
|
|
2630
|
+
return colRest[prop];
|
|
2631
|
+
}
|
|
2632
|
+
}
|
|
2633
|
+
return -1;
|
|
2634
|
+
};
|
|
2635
|
+
};
|
|
2310
2636
|
function lazyScrollXData($xeTable) {
|
|
2311
2637
|
const internalData = $xeTable;
|
|
2312
2638
|
const {
|
|
@@ -2478,7 +2804,7 @@ function calcCellWidth($xeTable) {
|
|
|
2478
2804
|
}
|
|
2479
2805
|
function handleUpdateColResize($xeTable, evnt, params) {
|
|
2480
2806
|
$xeTable.analyColumnWidth();
|
|
2481
|
-
$xeTable.recalculate(
|
|
2807
|
+
$xeTable.recalculate().then(() => {
|
|
2482
2808
|
$xeTable.saveCustomStore('update:width');
|
|
2483
2809
|
$xeTable.updateCellAreas();
|
|
2484
2810
|
$xeTable.dispatchEvent('column-resizable-change', params, evnt);
|
|
@@ -2490,7 +2816,7 @@ function handleUpdateColResize($xeTable, evnt, params) {
|
|
|
2490
2816
|
function handleUpdateRowResize($xeTable, evnt, params) {
|
|
2491
2817
|
const reactData = $xeTable;
|
|
2492
2818
|
reactData.resizeHeightFlag++;
|
|
2493
|
-
$xeTable.recalculate(
|
|
2819
|
+
$xeTable.recalculate().then(() => {
|
|
2494
2820
|
$xeTable.updateCellAreas();
|
|
2495
2821
|
$xeTable.dispatchEvent('row-resizable-change', params, evnt);
|
|
2496
2822
|
setTimeout(() => $xeTable.recalculate(true), 300);
|
|
@@ -2515,21 +2841,24 @@ function updateRowOffsetTop($xeTable) {
|
|
|
2515
2841
|
const reactData = $xeTable;
|
|
2516
2842
|
const internalData = $xeTable;
|
|
2517
2843
|
const {
|
|
2518
|
-
expandColumn
|
|
2519
|
-
rowExpandedMaps
|
|
2844
|
+
expandColumn
|
|
2520
2845
|
} = reactData;
|
|
2521
2846
|
const {
|
|
2522
2847
|
afterFullData,
|
|
2523
|
-
fullAllDataRowIdData
|
|
2848
|
+
fullAllDataRowIdData,
|
|
2849
|
+
rowExpandedMaps
|
|
2524
2850
|
} = internalData;
|
|
2525
2851
|
const expandOpts = $xeTable.computeExpandOpts;
|
|
2526
2852
|
const rowOpts = $xeTable.computeRowOpts;
|
|
2527
2853
|
const cellOpts = $xeTable.computeCellOpts;
|
|
2528
2854
|
const defaultRowHeight = $xeTable.computeDefaultRowHeight;
|
|
2855
|
+
const {
|
|
2856
|
+
handleGetRowId
|
|
2857
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
2529
2858
|
let offsetTop = 0;
|
|
2530
2859
|
for (let rIndex = 0, rLen = afterFullData.length; rIndex < rLen; rIndex++) {
|
|
2531
2860
|
const row = afterFullData[rIndex];
|
|
2532
|
-
const rowid = (
|
|
2861
|
+
const rowid = handleGetRowId(row);
|
|
2533
2862
|
const rowRest = fullAllDataRowIdData[rowid] || {};
|
|
2534
2863
|
rowRest.oTop = offsetTop;
|
|
2535
2864
|
offsetTop += rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
|
|
@@ -2545,7 +2874,8 @@ function updateRowExpandStyle($xeTable) {
|
|
|
2545
2874
|
const {
|
|
2546
2875
|
expandColumn,
|
|
2547
2876
|
scrollYLoad,
|
|
2548
|
-
|
|
2877
|
+
scrollYTop,
|
|
2878
|
+
isScrollYBig
|
|
2549
2879
|
} = reactData;
|
|
2550
2880
|
const expandOpts = $xeTable.computeExpandOpts;
|
|
2551
2881
|
const rowOpts = $xeTable.computeRowOpts;
|
|
@@ -2557,41 +2887,35 @@ function updateRowExpandStyle($xeTable) {
|
|
|
2557
2887
|
if (expandColumn && mode === 'fixed') {
|
|
2558
2888
|
const {
|
|
2559
2889
|
elemStore,
|
|
2560
|
-
afterFullData,
|
|
2561
2890
|
fullAllDataRowIdData
|
|
2562
2891
|
} = internalData;
|
|
2563
2892
|
const rowExpandEl = $xeTable.$refs.refRowExpandElem;
|
|
2564
2893
|
const bodyScrollElem = (0, _util.getRefElem)(elemStore['main-body-scroll']);
|
|
2565
2894
|
if (rowExpandEl && bodyScrollElem) {
|
|
2566
2895
|
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
2896
|
_xeUtils.default.arrayEach(rowExpandEl.children, reEl => {
|
|
2582
2897
|
const expandEl = reEl;
|
|
2583
2898
|
const rowid = expandEl.getAttribute('rowid') || '';
|
|
2584
2899
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
2585
2900
|
if (rowRest) {
|
|
2586
2901
|
const expandHeight = expandEl.offsetHeight + 1;
|
|
2902
|
+
const trEl = bodyScrollElem.querySelector(`.vxe-body--row[rowid="${rowid}"]`);
|
|
2903
|
+
let offsetTop = 0;
|
|
2587
2904
|
if (scrollYLoad) {
|
|
2588
|
-
|
|
2905
|
+
if (isScrollYBig && trEl) {
|
|
2906
|
+
offsetTop = trEl.offsetTop + trEl.offsetHeight;
|
|
2907
|
+
} else {
|
|
2908
|
+
offsetTop = rowRest.oTop + (rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight);
|
|
2909
|
+
}
|
|
2589
2910
|
} else {
|
|
2590
|
-
const trEl = bodyScrollElem.querySelector(`.vxe-body--row[rowid="${rowid}"]`);
|
|
2591
2911
|
if (trEl) {
|
|
2592
|
-
|
|
2912
|
+
offsetTop = trEl.offsetTop + trEl.offsetHeight;
|
|
2593
2913
|
}
|
|
2594
2914
|
}
|
|
2915
|
+
if (isScrollYBig) {
|
|
2916
|
+
offsetTop += scrollYTop;
|
|
2917
|
+
}
|
|
2918
|
+
expandEl.style.top = (0, _dom.toCssUnit)(offsetTop);
|
|
2595
2919
|
if (!isUpdateHeight) {
|
|
2596
2920
|
if (rowRest.expandHeight !== expandHeight) {
|
|
2597
2921
|
isUpdateHeight = true;
|
|
@@ -2602,6 +2926,9 @@ function updateRowExpandStyle($xeTable) {
|
|
|
2602
2926
|
});
|
|
2603
2927
|
if (isUpdateHeight) {
|
|
2604
2928
|
reactData.rowExpandHeightFlag++;
|
|
2929
|
+
$xeTable.$nextTick(() => {
|
|
2930
|
+
updateRowOffsetTop($xeTable);
|
|
2931
|
+
});
|
|
2605
2932
|
}
|
|
2606
2933
|
}
|
|
2607
2934
|
}
|
|
@@ -2619,12 +2946,11 @@ function handleRowExpandScroll($xeTable) {
|
|
|
2619
2946
|
}
|
|
2620
2947
|
const Methods = {
|
|
2621
2948
|
callSlot(slotFunc, params, h, vNodes) {
|
|
2949
|
+
const $xeTable = this;
|
|
2950
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
2622
2951
|
if (slotFunc) {
|
|
2623
|
-
|
|
2624
|
-
$
|
|
2625
|
-
} = this;
|
|
2626
|
-
if ($xegrid) {
|
|
2627
|
-
return $xegrid.callSlot(slotFunc, params, h, vNodes);
|
|
2952
|
+
if ($xeGrid) {
|
|
2953
|
+
return $xeGrid.callSlot(slotFunc, params, h, vNodes);
|
|
2628
2954
|
}
|
|
2629
2955
|
if (_xeUtils.default.isFunction(slotFunc)) {
|
|
2630
2956
|
return (0, _vn.getSlotVNs)(slotFunc.call(this, params, h, vNodes));
|
|
@@ -2640,11 +2966,12 @@ const Methods = {
|
|
|
2640
2966
|
* 获取父容器元素
|
|
2641
2967
|
*/
|
|
2642
2968
|
getParentElem() {
|
|
2969
|
+
const $xeTable = this;
|
|
2970
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
2643
2971
|
const {
|
|
2644
|
-
$el
|
|
2645
|
-
$xegrid
|
|
2972
|
+
$el
|
|
2646
2973
|
} = this;
|
|
2647
|
-
return $
|
|
2974
|
+
return $xeGrid ? $xeGrid.$el.parentNode : $el.parentNode;
|
|
2648
2975
|
},
|
|
2649
2976
|
/**
|
|
2650
2977
|
* 获取父容器的高度
|
|
@@ -2678,10 +3005,9 @@ const Methods = {
|
|
|
2678
3005
|
* 如果存在表尾合计滚动条,则需要排除滚动条高度
|
|
2679
3006
|
*/
|
|
2680
3007
|
getExcludeHeight() {
|
|
2681
|
-
const
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
return $xegrid ? $xegrid.getExcludeHeight() : 0;
|
|
3008
|
+
const $xeTable = this;
|
|
3009
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
3010
|
+
return $xeGrid ? $xeGrid.getExcludeHeight() : 0;
|
|
2685
3011
|
},
|
|
2686
3012
|
/**
|
|
2687
3013
|
* 重置表格的一切数据状态
|
|
@@ -2762,27 +3088,35 @@ const Methods = {
|
|
|
2762
3088
|
*/
|
|
2763
3089
|
loadTableData(datas, isReset) {
|
|
2764
3090
|
const $xeTable = this;
|
|
3091
|
+
const props = $xeTable;
|
|
2765
3092
|
const reactData = $xeTable;
|
|
2766
3093
|
const internalData = $xeTable;
|
|
2767
3094
|
const {
|
|
2768
3095
|
keepSource,
|
|
2769
|
-
treeConfig
|
|
2770
|
-
|
|
2771
|
-
|
|
3096
|
+
treeConfig
|
|
3097
|
+
} = props;
|
|
3098
|
+
const {
|
|
3099
|
+
scrollYLoad: oldScrollYLoad
|
|
3100
|
+
} = reactData;
|
|
3101
|
+
const {
|
|
2772
3102
|
scrollYStore,
|
|
2773
3103
|
scrollXStore,
|
|
2774
3104
|
lastScrollLeft,
|
|
2775
|
-
lastScrollTop
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
3105
|
+
lastScrollTop
|
|
3106
|
+
} = internalData;
|
|
3107
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
3108
|
+
const {
|
|
3109
|
+
transform
|
|
3110
|
+
} = treeOpts;
|
|
2780
3111
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
2781
3112
|
let treeData = [];
|
|
2782
3113
|
let fullData = datas ? datas.slice(0) : [];
|
|
3114
|
+
if (fullData.length > supportMaxRow) {
|
|
3115
|
+
(0, _log.errLog)('vxe.error.errMaxRow', [supportMaxRow]);
|
|
3116
|
+
}
|
|
2783
3117
|
if (treeConfig) {
|
|
2784
3118
|
// 树结构自动转换
|
|
2785
|
-
if (
|
|
3119
|
+
if (transform) {
|
|
2786
3120
|
if (!treeOpts.rowField) {
|
|
2787
3121
|
(0, _log.errLog)('vxe.error.reqProp', ['table.tree-config.rowField']);
|
|
2788
3122
|
}
|
|
@@ -2820,8 +3154,8 @@ const Methods = {
|
|
|
2820
3154
|
scrollXStore.endIndex = 1;
|
|
2821
3155
|
reactData.isRowLoading = true;
|
|
2822
3156
|
reactData.scrollVMLoading = false;
|
|
2823
|
-
|
|
2824
|
-
|
|
3157
|
+
internalData.insertRowMaps = {};
|
|
3158
|
+
internalData.removeRowMaps = {};
|
|
2825
3159
|
const sYLoad = updateScrollYStatus($xeTable, fullData);
|
|
2826
3160
|
reactData.isDragColMove = false;
|
|
2827
3161
|
reactData.isDragRowMove = false;
|
|
@@ -2839,15 +3173,15 @@ const Methods = {
|
|
|
2839
3173
|
if (keepSource) {
|
|
2840
3174
|
$xeTable.cacheSourceMap(fullData);
|
|
2841
3175
|
}
|
|
2842
|
-
if (
|
|
2843
|
-
|
|
2844
|
-
|
|
3176
|
+
if ($xeTable.clearCellAreas && props.mouseConfig) {
|
|
3177
|
+
$xeTable.clearCellAreas();
|
|
3178
|
+
$xeTable.clearCopyCellArea();
|
|
2845
3179
|
}
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
return
|
|
3180
|
+
$xeTable.clearMergeCells();
|
|
3181
|
+
$xeTable.clearMergeFooterItems();
|
|
3182
|
+
$xeTable.handleTableData(true);
|
|
3183
|
+
$xeTable.updateFooter();
|
|
3184
|
+
return $xeTable.$nextTick().then(() => {
|
|
2851
3185
|
updateHeight($xeTable);
|
|
2852
3186
|
updateStyle($xeTable);
|
|
2853
3187
|
}).then(() => {
|
|
@@ -2860,45 +3194,47 @@ const Methods = {
|
|
|
2860
3194
|
if (sYLoad) {
|
|
2861
3195
|
// if (showOverflow) {
|
|
2862
3196
|
// if (!rowOpts.height) {
|
|
2863
|
-
// const errColumn =
|
|
3197
|
+
// const errColumn = internalData.tableFullColumn.find((column: any) => column.showOverflow === false)
|
|
2864
3198
|
// if (errColumn) {
|
|
2865
3199
|
// errLog('vxe.error.errProp', [`column[field="${errColumn.field}"].show-overflow=false`, 'show-overflow=true'])
|
|
2866
3200
|
// }
|
|
2867
3201
|
// }
|
|
2868
3202
|
// }
|
|
2869
|
-
if (!(
|
|
3203
|
+
if (!(props.height || props.maxHeight)) {
|
|
2870
3204
|
(0, _log.errLog)('vxe.error.reqProp', ['table.height | table.max-height | table.scroll-y={enabled: false}']);
|
|
2871
3205
|
}
|
|
2872
|
-
// if (!
|
|
3206
|
+
// if (!props.showOverflow) {
|
|
2873
3207
|
// warnLog('vxe.error.reqProp', ['table.show-overflow'])
|
|
2874
3208
|
// }
|
|
2875
|
-
if (
|
|
3209
|
+
if (props.spanMethod) {
|
|
2876
3210
|
(0, _log.errLog)('vxe.error.scrollErrProp', ['table.span-method']);
|
|
2877
3211
|
}
|
|
2878
3212
|
}
|
|
2879
3213
|
handleReserveStatus($xeTable);
|
|
2880
|
-
|
|
3214
|
+
$xeTable.checkSelectionStatus();
|
|
2881
3215
|
return new Promise(resolve => {
|
|
2882
|
-
this.$nextTick().then(() =>
|
|
3216
|
+
this.$nextTick().then(() => $xeTable.recalculate()).then(() => {
|
|
2883
3217
|
let targetScrollLeft = lastScrollLeft;
|
|
2884
3218
|
let targetScrollTop = lastScrollTop;
|
|
3219
|
+
const virtualXOpts = $xeTable.computeVirtualXOpts;
|
|
3220
|
+
const virtualYOpts = $xeTable.computeVirtualYOpts;
|
|
2885
3221
|
// 是否在更新数据之后自动滚动重置滚动条
|
|
2886
|
-
if (
|
|
3222
|
+
if (virtualXOpts.scrollToLeftOnChange) {
|
|
2887
3223
|
targetScrollLeft = 0;
|
|
2888
3224
|
}
|
|
2889
|
-
if (
|
|
3225
|
+
if (virtualYOpts.scrollToTopOnChange) {
|
|
2890
3226
|
targetScrollTop = 0;
|
|
2891
3227
|
}
|
|
2892
3228
|
reactData.isRowLoading = false;
|
|
2893
3229
|
calcCellHeight($xeTable);
|
|
2894
3230
|
// 是否变更虚拟滚动
|
|
2895
3231
|
if (oldScrollYLoad === sYLoad) {
|
|
2896
|
-
(0, _util.restoreScrollLocation)(
|
|
3232
|
+
(0, _util.restoreScrollLocation)($xeTable, targetScrollLeft, targetScrollTop).then(() => {
|
|
2897
3233
|
resolve();
|
|
2898
3234
|
});
|
|
2899
3235
|
} else {
|
|
2900
3236
|
setTimeout(() => {
|
|
2901
|
-
(0, _util.restoreScrollLocation)(
|
|
3237
|
+
(0, _util.restoreScrollLocation)($xeTable, targetScrollLeft, targetScrollTop).then(() => {
|
|
2902
3238
|
resolve();
|
|
2903
3239
|
});
|
|
2904
3240
|
});
|
|
@@ -2912,6 +3248,7 @@ const Methods = {
|
|
|
2912
3248
|
* @param {Array} datas 数据
|
|
2913
3249
|
*/
|
|
2914
3250
|
loadData(datas) {
|
|
3251
|
+
const $xeTable = this;
|
|
2915
3252
|
const {
|
|
2916
3253
|
initStatus
|
|
2917
3254
|
} = this;
|
|
@@ -2919,7 +3256,7 @@ const Methods = {
|
|
|
2919
3256
|
this.inited = true;
|
|
2920
3257
|
this.initStatus = true;
|
|
2921
3258
|
if (!initStatus) {
|
|
2922
|
-
|
|
3259
|
+
handleLoadDefaults($xeTable);
|
|
2923
3260
|
}
|
|
2924
3261
|
return this.recalculate();
|
|
2925
3262
|
});
|
|
@@ -2929,12 +3266,13 @@ const Methods = {
|
|
|
2929
3266
|
* @param {Array} datas 数据
|
|
2930
3267
|
*/
|
|
2931
3268
|
reloadData(datas) {
|
|
3269
|
+
const $xeTable = this;
|
|
2932
3270
|
return this.clearAll().then(() => {
|
|
2933
3271
|
this.inited = true;
|
|
2934
3272
|
this.initStatus = true;
|
|
2935
3273
|
return this.loadTableData(datas, true);
|
|
2936
3274
|
}).then(() => {
|
|
2937
|
-
|
|
3275
|
+
handleLoadDefaults($xeTable);
|
|
2938
3276
|
return this.recalculate();
|
|
2939
3277
|
});
|
|
2940
3278
|
},
|
|
@@ -3022,13 +3360,11 @@ const Methods = {
|
|
|
3022
3360
|
const {
|
|
3023
3361
|
treeConfig
|
|
3024
3362
|
} = props;
|
|
3025
|
-
const {
|
|
3026
|
-
treeExpandedMaps
|
|
3027
|
-
} = reactData;
|
|
3028
3363
|
const {
|
|
3029
3364
|
fullAllDataRowIdData,
|
|
3030
3365
|
tableFullData,
|
|
3031
|
-
tableFullTreeData
|
|
3366
|
+
tableFullTreeData,
|
|
3367
|
+
treeExpandedMaps
|
|
3032
3368
|
} = internalData;
|
|
3033
3369
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
3034
3370
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
@@ -3036,12 +3372,11 @@ const Methods = {
|
|
|
3036
3372
|
const {
|
|
3037
3373
|
lazy
|
|
3038
3374
|
} = treeOpts;
|
|
3039
|
-
const rowkey = (0, _util.getRowkey)($xeTable);
|
|
3040
|
-
const isDeepKey = rowkey.indexOf('.') > -1;
|
|
3041
3375
|
const fullAllDataRowIdMaps = Object.assign({}, fullAllDataRowIdData); // 存在已删除数据
|
|
3042
3376
|
const fullDataRowIdMaps = {};
|
|
3043
|
-
const
|
|
3044
|
-
|
|
3377
|
+
const {
|
|
3378
|
+
handleUpdateRowId
|
|
3379
|
+
} = (0, _util.createHandleUpdateRowId)($xeTable);
|
|
3045
3380
|
const handleRowCache = (row, index, items, currIndex, parentRow, rowid, level, seq) => {
|
|
3046
3381
|
let rowRest = fullAllDataRowIdMaps[rowid];
|
|
3047
3382
|
if (!rowRest) {
|
|
@@ -3075,15 +3410,14 @@ const Methods = {
|
|
|
3075
3410
|
};
|
|
3076
3411
|
if (treeConfig) {
|
|
3077
3412
|
_xeUtils.default.eachTree(tableFullTreeData, (row, index, items, path, parentRow, nodes) => {
|
|
3078
|
-
const rowid =
|
|
3413
|
+
const rowid = handleUpdateRowId(row);
|
|
3079
3414
|
if (treeConfig && lazy) {
|
|
3080
|
-
const treeExpRest = treeTempExpandedMaps[rowid];
|
|
3081
3415
|
if (row[hasChildField] && row[childrenField] === undefined) {
|
|
3082
3416
|
row[childrenField] = null;
|
|
3083
3417
|
}
|
|
3084
|
-
if (
|
|
3418
|
+
if (treeExpandedMaps[rowid]) {
|
|
3085
3419
|
if (!row[childrenField] || !row[childrenField].length) {
|
|
3086
|
-
delete
|
|
3420
|
+
delete treeExpandedMaps[rowid];
|
|
3087
3421
|
}
|
|
3088
3422
|
}
|
|
3089
3423
|
}
|
|
@@ -3093,12 +3427,12 @@ const Methods = {
|
|
|
3093
3427
|
});
|
|
3094
3428
|
} else {
|
|
3095
3429
|
tableFullData.forEach((row, index, items) => {
|
|
3096
|
-
handleRowCache(row, index, items, index, null,
|
|
3430
|
+
handleRowCache(row, index, items, index, null, handleUpdateRowId(row), 0, index + 1);
|
|
3097
3431
|
});
|
|
3098
3432
|
}
|
|
3099
3433
|
internalData.fullDataRowIdData = fullDataRowIdMaps;
|
|
3100
3434
|
internalData.fullAllDataRowIdData = fullAllDataRowIdMaps;
|
|
3101
|
-
reactData.
|
|
3435
|
+
reactData.treeExpandedFlag++;
|
|
3102
3436
|
},
|
|
3103
3437
|
cacheSourceMap(fullData) {
|
|
3104
3438
|
const $xeTable = this;
|
|
@@ -3108,19 +3442,14 @@ const Methods = {
|
|
|
3108
3442
|
treeConfig
|
|
3109
3443
|
} = props;
|
|
3110
3444
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
3111
|
-
let {
|
|
3112
|
-
sourceDataRowIdData
|
|
3113
|
-
} = internalData;
|
|
3114
3445
|
const sourceData = _xeUtils.default.clone(fullData, true);
|
|
3115
|
-
const
|
|
3116
|
-
|
|
3446
|
+
const {
|
|
3447
|
+
handleUpdateRowId
|
|
3448
|
+
} = (0, _util.createHandleUpdateRowId)($xeTable);
|
|
3449
|
+
const sourceRowIdData = {};
|
|
3117
3450
|
const handleSourceRow = row => {
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
rowid = (0, _util.getRowUniqueId)();
|
|
3121
|
-
_xeUtils.default.set(row, rowkey, rowid);
|
|
3122
|
-
}
|
|
3123
|
-
sourceDataRowIdData[rowid] = row;
|
|
3451
|
+
const rowid = handleUpdateRowId(row);
|
|
3452
|
+
sourceRowIdData[rowid] = row;
|
|
3124
3453
|
};
|
|
3125
3454
|
// 源数据缓存
|
|
3126
3455
|
if (treeConfig) {
|
|
@@ -3131,21 +3460,28 @@ const Methods = {
|
|
|
3131
3460
|
} else {
|
|
3132
3461
|
sourceData.forEach(handleSourceRow);
|
|
3133
3462
|
}
|
|
3463
|
+
internalData.sourceDataRowIdData = sourceRowIdData;
|
|
3134
3464
|
internalData.tableSourceData = sourceData;
|
|
3135
3465
|
},
|
|
3136
3466
|
getParams() {
|
|
3137
|
-
|
|
3467
|
+
const $xeTable = this;
|
|
3468
|
+
const props = $xeTable;
|
|
3469
|
+
return props.params;
|
|
3138
3470
|
},
|
|
3139
3471
|
loadTreeChildren(row, childRecords) {
|
|
3140
3472
|
const $xeTable = this;
|
|
3473
|
+
const props = $xeTable;
|
|
3474
|
+
const internalData = $xeTable;
|
|
3475
|
+
const {
|
|
3476
|
+
keepSource
|
|
3477
|
+
} = props;
|
|
3141
3478
|
const {
|
|
3142
|
-
keepSource,
|
|
3143
3479
|
tableSourceData,
|
|
3144
|
-
treeOpts,
|
|
3145
3480
|
fullDataRowIdData,
|
|
3146
3481
|
fullAllDataRowIdData,
|
|
3147
3482
|
sourceDataRowIdData
|
|
3148
|
-
} =
|
|
3483
|
+
} = internalData;
|
|
3484
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
3149
3485
|
const {
|
|
3150
3486
|
transform,
|
|
3151
3487
|
mapChildrenField
|
|
@@ -3204,20 +3540,24 @@ const Methods = {
|
|
|
3204
3540
|
* @param {Element} tr 元素
|
|
3205
3541
|
*/
|
|
3206
3542
|
getRowNode(tr) {
|
|
3543
|
+
const $xeTable = this;
|
|
3544
|
+
const internalData = $xeTable;
|
|
3207
3545
|
if (tr) {
|
|
3208
3546
|
const {
|
|
3209
3547
|
fullAllDataRowIdData
|
|
3210
|
-
} =
|
|
3548
|
+
} = internalData;
|
|
3211
3549
|
const rowid = tr.getAttribute('rowid');
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3550
|
+
if (rowid) {
|
|
3551
|
+
const rowRest = fullAllDataRowIdData[rowid];
|
|
3552
|
+
if (rowRest) {
|
|
3553
|
+
return {
|
|
3554
|
+
rowid: rowRest.rowid,
|
|
3555
|
+
item: rowRest.row,
|
|
3556
|
+
index: rowRest.index,
|
|
3557
|
+
items: rowRest.items,
|
|
3558
|
+
parent: rowRest.parent
|
|
3559
|
+
};
|
|
3560
|
+
}
|
|
3221
3561
|
}
|
|
3222
3562
|
}
|
|
3223
3563
|
return null;
|
|
@@ -3227,10 +3567,12 @@ const Methods = {
|
|
|
3227
3567
|
* @param {Element} cell 元素
|
|
3228
3568
|
*/
|
|
3229
3569
|
getColumnNode(cell) {
|
|
3570
|
+
const $xeTable = this;
|
|
3571
|
+
const internalData = $xeTable;
|
|
3230
3572
|
if (cell) {
|
|
3231
3573
|
const {
|
|
3232
3574
|
fullColumnIdData
|
|
3233
|
-
} =
|
|
3575
|
+
} = internalData;
|
|
3234
3576
|
const colid = cell.getAttribute('colid');
|
|
3235
3577
|
if (colid) {
|
|
3236
3578
|
const colRest = fullColumnIdData[colid];
|
|
@@ -3251,53 +3593,22 @@ const Methods = {
|
|
|
3251
3593
|
* 根据 row 获取序号
|
|
3252
3594
|
* @param {Row} row 行对象
|
|
3253
3595
|
*/
|
|
3254
|
-
getRowSeq(
|
|
3255
|
-
const {
|
|
3256
|
-
fullAllDataRowIdData
|
|
3257
|
-
} = this;
|
|
3258
|
-
if (row) {
|
|
3259
|
-
const rowid = (0, _util.getRowid)(this, row);
|
|
3260
|
-
const rest = fullAllDataRowIdData[rowid];
|
|
3261
|
-
if (rest) {
|
|
3262
|
-
return rest.seq;
|
|
3263
|
-
}
|
|
3264
|
-
}
|
|
3265
|
-
return -1;
|
|
3266
|
-
},
|
|
3596
|
+
getRowSeq: createGetRowCacheProp('seq'),
|
|
3267
3597
|
/**
|
|
3268
3598
|
* 根据 row 获取相对于 data 中的索引
|
|
3269
3599
|
* @param {Row} row 行对象
|
|
3270
3600
|
*/
|
|
3271
|
-
getRowIndex(
|
|
3272
|
-
const {
|
|
3273
|
-
fullAllDataRowIdData
|
|
3274
|
-
} = this;
|
|
3275
|
-
if (row) {
|
|
3276
|
-
const rowid = (0, _util.getRowid)(this, row);
|
|
3277
|
-
const rest = fullAllDataRowIdData[rowid];
|
|
3278
|
-
if (rest) {
|
|
3279
|
-
return rest.index;
|
|
3280
|
-
}
|
|
3281
|
-
}
|
|
3282
|
-
return -1;
|
|
3283
|
-
},
|
|
3601
|
+
getRowIndex: createGetRowCacheProp('index'),
|
|
3284
3602
|
/**
|
|
3285
3603
|
* 根据 row 获取相对于当前数据中的索引
|
|
3286
3604
|
* @param {Row} row 行对象
|
|
3287
3605
|
*/
|
|
3288
|
-
getVTRowIndex(
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
const rest = fullAllDataRowIdData[rowid];
|
|
3295
|
-
if (rest) {
|
|
3296
|
-
return rest._index;
|
|
3297
|
-
}
|
|
3298
|
-
}
|
|
3299
|
-
return -1;
|
|
3300
|
-
},
|
|
3606
|
+
getVTRowIndex: createGetRowCacheProp('_index'),
|
|
3607
|
+
/**
|
|
3608
|
+
* 根据 row 获取渲染中的虚拟索引
|
|
3609
|
+
* @param {Row} row 行对象
|
|
3610
|
+
*/
|
|
3611
|
+
getVMRowIndex: createGetRowCacheProp('$index'),
|
|
3301
3612
|
// 在 v3 中废弃
|
|
3302
3613
|
_getRowIndex(row) {
|
|
3303
3614
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -3305,23 +3616,6 @@ const Methods = {
|
|
|
3305
3616
|
}
|
|
3306
3617
|
return this.getVTRowIndex(row);
|
|
3307
3618
|
},
|
|
3308
|
-
/**
|
|
3309
|
-
* 根据 row 获取渲染中的虚拟索引
|
|
3310
|
-
* @param {Row} row 行对象
|
|
3311
|
-
*/
|
|
3312
|
-
getVMRowIndex(row) {
|
|
3313
|
-
const {
|
|
3314
|
-
fullAllDataRowIdData
|
|
3315
|
-
} = this;
|
|
3316
|
-
if (row) {
|
|
3317
|
-
const rowid = (0, _util.getRowid)(this, row);
|
|
3318
|
-
const rest = fullAllDataRowIdData[rowid];
|
|
3319
|
-
if (rest) {
|
|
3320
|
-
return rest.$index;
|
|
3321
|
-
}
|
|
3322
|
-
}
|
|
3323
|
-
return -1;
|
|
3324
|
-
},
|
|
3325
3619
|
// 在 v3 中废弃
|
|
3326
3620
|
$getRowIndex(row) {
|
|
3327
3621
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -3333,34 +3627,17 @@ const Methods = {
|
|
|
3333
3627
|
* 根据 column 获取相对于 columns 中的索引
|
|
3334
3628
|
* @param {ColumnInfo} column 列配置
|
|
3335
3629
|
*/
|
|
3336
|
-
getColumnIndex(
|
|
3337
|
-
const {
|
|
3338
|
-
fullColumnIdData
|
|
3339
|
-
} = this;
|
|
3340
|
-
if (column) {
|
|
3341
|
-
const rest = fullColumnIdData[column.id];
|
|
3342
|
-
if (rest) {
|
|
3343
|
-
return rest.index;
|
|
3344
|
-
}
|
|
3345
|
-
}
|
|
3346
|
-
return -1;
|
|
3347
|
-
},
|
|
3630
|
+
getColumnIndex: createGetColumnCacheProp('index'),
|
|
3348
3631
|
/**
|
|
3349
3632
|
* 根据 column 获取相对于当前表格列中的索引
|
|
3350
3633
|
* @param {ColumnInfo} column 列配置
|
|
3351
3634
|
*/
|
|
3352
|
-
getVTColumnIndex(
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
if (rest) {
|
|
3359
|
-
return rest._index;
|
|
3360
|
-
}
|
|
3361
|
-
}
|
|
3362
|
-
return -1;
|
|
3363
|
-
},
|
|
3635
|
+
getVTColumnIndex: createGetColumnCacheProp('_index'),
|
|
3636
|
+
/**
|
|
3637
|
+
* 根据 column 获取渲染中的虚拟索引
|
|
3638
|
+
* @param {ColumnInfo} column 列配置
|
|
3639
|
+
*/
|
|
3640
|
+
getVMColumnIndex: createGetColumnCacheProp('$index'),
|
|
3364
3641
|
// 在 v3 中废弃
|
|
3365
3642
|
_getColumnIndex(column) {
|
|
3366
3643
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -3368,22 +3645,6 @@ const Methods = {
|
|
|
3368
3645
|
}
|
|
3369
3646
|
return this.getVTColumnIndex(column);
|
|
3370
3647
|
},
|
|
3371
|
-
/**
|
|
3372
|
-
* 根据 column 获取渲染中的虚拟索引
|
|
3373
|
-
* @param {ColumnInfo} column 列配置
|
|
3374
|
-
*/
|
|
3375
|
-
getVMColumnIndex(column) {
|
|
3376
|
-
const {
|
|
3377
|
-
fullColumnIdData
|
|
3378
|
-
} = this;
|
|
3379
|
-
if (column) {
|
|
3380
|
-
const rest = fullColumnIdData[column.id];
|
|
3381
|
-
if (rest) {
|
|
3382
|
-
return rest.$index;
|
|
3383
|
-
}
|
|
3384
|
-
}
|
|
3385
|
-
return -1;
|
|
3386
|
-
},
|
|
3387
3648
|
// 在 v3 中废弃
|
|
3388
3649
|
$getColumnIndex(column) {
|
|
3389
3650
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -3403,20 +3664,23 @@ const Methods = {
|
|
|
3403
3664
|
* @param {Row} records 行数据
|
|
3404
3665
|
*/
|
|
3405
3666
|
defineField(records) {
|
|
3667
|
+
const $xeTable = this;
|
|
3668
|
+
const props = $xeTable;
|
|
3669
|
+
const internalData = $xeTable;
|
|
3406
3670
|
const {
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3671
|
+
treeConfig
|
|
3672
|
+
} = props;
|
|
3673
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
3674
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
3675
|
+
const radioOpts = $xeTable.computeRadioOpts;
|
|
3676
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
3413
3677
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
3414
|
-
const rowkey = (0, _util.getRowkey)(
|
|
3678
|
+
const rowkey = (0, _util.getRowkey)($xeTable);
|
|
3415
3679
|
if (!_xeUtils.default.isArray(records)) {
|
|
3416
3680
|
records = [records || {}];
|
|
3417
3681
|
}
|
|
3418
3682
|
return records.map(record => {
|
|
3419
|
-
|
|
3683
|
+
internalData.tableFullColumn.forEach(column => {
|
|
3420
3684
|
const {
|
|
3421
3685
|
field,
|
|
3422
3686
|
editRender
|
|
@@ -3460,8 +3724,9 @@ const Methods = {
|
|
|
3460
3724
|
* @param {Array} records 新数据
|
|
3461
3725
|
*/
|
|
3462
3726
|
createData(records) {
|
|
3463
|
-
|
|
3464
|
-
|
|
3727
|
+
const $xeTable = this;
|
|
3728
|
+
return $xeTable.$nextTick().then(() => {
|
|
3729
|
+
return $xeTable.defineField(records);
|
|
3465
3730
|
});
|
|
3466
3731
|
},
|
|
3467
3732
|
/**
|
|
@@ -3470,11 +3735,12 @@ const Methods = {
|
|
|
3470
3735
|
* @param {Array/Object} records 新数据
|
|
3471
3736
|
*/
|
|
3472
3737
|
createRow(records) {
|
|
3738
|
+
const $xeTable = this;
|
|
3473
3739
|
const isArr = _xeUtils.default.isArray(records);
|
|
3474
3740
|
if (!isArr) {
|
|
3475
3741
|
records = [records];
|
|
3476
3742
|
}
|
|
3477
|
-
return
|
|
3743
|
+
return $xeTable.createData(records).then(rows => isArr ? rows : rows[0]);
|
|
3478
3744
|
},
|
|
3479
3745
|
/**
|
|
3480
3746
|
* 还原数据
|
|
@@ -3492,22 +3758,22 @@ const Methods = {
|
|
|
3492
3758
|
keepSource,
|
|
3493
3759
|
treeConfig
|
|
3494
3760
|
} = props;
|
|
3495
|
-
const {
|
|
3496
|
-
editStore
|
|
3497
|
-
} = reactData;
|
|
3498
3761
|
const {
|
|
3499
3762
|
fullAllDataRowIdData,
|
|
3500
3763
|
fullDataRowIdData,
|
|
3501
3764
|
tableSourceData,
|
|
3502
3765
|
sourceDataRowIdData,
|
|
3503
3766
|
tableFullData,
|
|
3504
|
-
afterFullData
|
|
3767
|
+
afterFullData,
|
|
3768
|
+
removeRowMaps
|
|
3505
3769
|
} = internalData;
|
|
3506
|
-
const removeTempMaps = Object.assign({}, editStore.removeMaps);
|
|
3507
3770
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
3508
3771
|
const {
|
|
3509
3772
|
transform
|
|
3510
3773
|
} = treeOpts;
|
|
3774
|
+
const {
|
|
3775
|
+
handleGetRowId
|
|
3776
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
3511
3777
|
if (!keepSource) {
|
|
3512
3778
|
if (process.env.NODE_ENV === 'development') {
|
|
3513
3779
|
(0, _log.errLog)('vxe.error.reqProp', ['keep-source']);
|
|
@@ -3525,7 +3791,7 @@ const Methods = {
|
|
|
3525
3791
|
let reDelFlag = false;
|
|
3526
3792
|
if (targetRows.length) {
|
|
3527
3793
|
targetRows.forEach(item => {
|
|
3528
|
-
const rowid = (
|
|
3794
|
+
const rowid = handleGetRowId(item);
|
|
3529
3795
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
3530
3796
|
if (rowRest) {
|
|
3531
3797
|
const row = rowRest.row;
|
|
@@ -3538,7 +3804,9 @@ const Methods = {
|
|
|
3538
3804
|
_xeUtils.default.destructuring(row, _xeUtils.default.clone(oRow, true));
|
|
3539
3805
|
}
|
|
3540
3806
|
if (!fullDataRowIdData[rowid] && $xeTable.isRemoveByRow(row)) {
|
|
3541
|
-
|
|
3807
|
+
if (removeRowMaps[rowid]) {
|
|
3808
|
+
delete removeRowMaps[rowid];
|
|
3809
|
+
}
|
|
3542
3810
|
tableFullData.unshift(row);
|
|
3543
3811
|
afterFullData.unshift(row);
|
|
3544
3812
|
reDelFlag = true;
|
|
@@ -3550,7 +3818,7 @@ const Methods = {
|
|
|
3550
3818
|
}
|
|
3551
3819
|
if (rows) {
|
|
3552
3820
|
if (reDelFlag) {
|
|
3553
|
-
|
|
3821
|
+
reactData.removeRowFlag++;
|
|
3554
3822
|
$xeTable.updateFooter();
|
|
3555
3823
|
$xeTable.cacheRowMap(false);
|
|
3556
3824
|
$xeTable.handleTableData(treeConfig && transform);
|
|
@@ -3579,10 +3847,12 @@ const Methods = {
|
|
|
3579
3847
|
* @param {String} field 字段名
|
|
3580
3848
|
*/
|
|
3581
3849
|
clearData(rows, field) {
|
|
3850
|
+
const $xeTable = this;
|
|
3851
|
+
const internalData = $xeTable;
|
|
3582
3852
|
const {
|
|
3583
3853
|
tableFullData,
|
|
3584
3854
|
visibleColumn
|
|
3585
|
-
} =
|
|
3855
|
+
} = internalData;
|
|
3586
3856
|
if (!arguments.length) {
|
|
3587
3857
|
rows = tableFullData;
|
|
3588
3858
|
} else if (rows && !_xeUtils.default.isArray(rows)) {
|
|
@@ -3599,7 +3869,7 @@ const Methods = {
|
|
|
3599
3869
|
});
|
|
3600
3870
|
});
|
|
3601
3871
|
}
|
|
3602
|
-
return
|
|
3872
|
+
return $xeTable.$nextTick();
|
|
3603
3873
|
},
|
|
3604
3874
|
getCellElement(row, fieldOrColumn) {
|
|
3605
3875
|
const $xeTable = this;
|
|
@@ -3700,20 +3970,16 @@ const Methods = {
|
|
|
3700
3970
|
isInsertByRow(row) {
|
|
3701
3971
|
const $xeTable = this;
|
|
3702
3972
|
const reactData = $xeTable;
|
|
3703
|
-
const
|
|
3704
|
-
editStore
|
|
3705
|
-
} = reactData;
|
|
3973
|
+
const internalData = $xeTable;
|
|
3706
3974
|
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
3707
|
-
return !!
|
|
3975
|
+
return !!reactData.insertRowFlag && !!internalData.insertRowMaps[rowid];
|
|
3708
3976
|
},
|
|
3709
3977
|
isRemoveByRow(row) {
|
|
3710
3978
|
const $xeTable = this;
|
|
3711
3979
|
const reactData = $xeTable;
|
|
3712
|
-
const
|
|
3713
|
-
editStore
|
|
3714
|
-
} = reactData;
|
|
3980
|
+
const internalData = $xeTable;
|
|
3715
3981
|
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
3716
|
-
return !!
|
|
3982
|
+
return !!reactData.removeRowFlag && !!internalData.removeRowMaps[rowid];
|
|
3717
3983
|
},
|
|
3718
3984
|
/**
|
|
3719
3985
|
* 删除所有新增的临时数据
|
|
@@ -3721,11 +3987,8 @@ const Methods = {
|
|
|
3721
3987
|
*/
|
|
3722
3988
|
removeInsertRow() {
|
|
3723
3989
|
const $xeTable = this;
|
|
3724
|
-
const
|
|
3725
|
-
|
|
3726
|
-
editStore
|
|
3727
|
-
} = reactData;
|
|
3728
|
-
editStore.insertMaps = {};
|
|
3990
|
+
const internalData = $xeTable;
|
|
3991
|
+
internalData.insertRowMaps = {};
|
|
3729
3992
|
return $xeTable.remove($xeTable.getInsertRecords());
|
|
3730
3993
|
},
|
|
3731
3994
|
/**
|
|
@@ -3773,14 +4036,19 @@ const Methods = {
|
|
|
3773
4036
|
* @param {Number} columnIndex 索引
|
|
3774
4037
|
*/
|
|
3775
4038
|
getColumns(columnIndex) {
|
|
3776
|
-
const
|
|
3777
|
-
|
|
4039
|
+
const $xeTable = this;
|
|
4040
|
+
const internalData = $xeTable;
|
|
4041
|
+
const {
|
|
4042
|
+
visibleColumn
|
|
4043
|
+
} = internalData;
|
|
4044
|
+
return _xeUtils.default.isUndefined(columnIndex) ? visibleColumn.slice(0) : visibleColumn[columnIndex];
|
|
3778
4045
|
},
|
|
3779
4046
|
/**
|
|
3780
4047
|
* 根据列获取列的唯一主键
|
|
3781
4048
|
*/
|
|
3782
4049
|
getColid(fieldOrColumn) {
|
|
3783
|
-
const
|
|
4050
|
+
const $xeTable = this;
|
|
4051
|
+
const column = (0, _util.handleFieldOrColumn)($xeTable, fieldOrColumn);
|
|
3784
4052
|
return column ? column.id : null;
|
|
3785
4053
|
},
|
|
3786
4054
|
/**
|
|
@@ -3788,7 +4056,11 @@ const Methods = {
|
|
|
3788
4056
|
* @param {String} colid 列主键
|
|
3789
4057
|
*/
|
|
3790
4058
|
getColumnById(colid) {
|
|
3791
|
-
const
|
|
4059
|
+
const $xeTable = this;
|
|
4060
|
+
const internalData = $xeTable;
|
|
4061
|
+
const {
|
|
4062
|
+
fullColumnIdData
|
|
4063
|
+
} = internalData;
|
|
3792
4064
|
return fullColumnIdData[colid] ? fullColumnIdData[colid].column : null;
|
|
3793
4065
|
},
|
|
3794
4066
|
/**
|
|
@@ -3796,7 +4068,11 @@ const Methods = {
|
|
|
3796
4068
|
* @param {String} field 字段名
|
|
3797
4069
|
*/
|
|
3798
4070
|
getColumnByField(field) {
|
|
3799
|
-
const
|
|
4071
|
+
const $xeTable = this;
|
|
4072
|
+
const internalData = $xeTable;
|
|
4073
|
+
const {
|
|
4074
|
+
fullColumnFieldData
|
|
4075
|
+
} = internalData;
|
|
3800
4076
|
return fullColumnFieldData[field] ? fullColumnFieldData[field].column : null;
|
|
3801
4077
|
},
|
|
3802
4078
|
getParentColumn(fieldOrColumn) {
|
|
@@ -3809,11 +4085,14 @@ const Methods = {
|
|
|
3809
4085
|
* 收集到的全量列、全量表头列、处理条件之后的全量表头列、当前渲染中的表头列
|
|
3810
4086
|
*/
|
|
3811
4087
|
getTableColumn() {
|
|
4088
|
+
const $xeTable = this;
|
|
4089
|
+
const reactData = $xeTable;
|
|
4090
|
+
const internalData = $xeTable;
|
|
3812
4091
|
return {
|
|
3813
|
-
collectColumn:
|
|
3814
|
-
fullColumn:
|
|
3815
|
-
visibleColumn:
|
|
3816
|
-
tableColumn:
|
|
4092
|
+
collectColumn: internalData.collectColumn.slice(0),
|
|
4093
|
+
fullColumn: internalData.tableFullColumn.slice(0),
|
|
4094
|
+
visibleColumn: internalData.visibleColumn.slice(0),
|
|
4095
|
+
tableColumn: reactData.tableColumn.slice(0)
|
|
3817
4096
|
};
|
|
3818
4097
|
},
|
|
3819
4098
|
/**
|
|
@@ -3947,21 +4226,18 @@ const Methods = {
|
|
|
3947
4226
|
getCheckboxRecords(isFull) {
|
|
3948
4227
|
const $xeTable = this;
|
|
3949
4228
|
const props = $xeTable;
|
|
3950
|
-
const reactData = $xeTable;
|
|
3951
4229
|
const internalData = $xeTable;
|
|
3952
4230
|
const {
|
|
3953
4231
|
treeConfig
|
|
3954
4232
|
} = props;
|
|
3955
|
-
const {
|
|
3956
|
-
selectCheckboxMaps
|
|
3957
|
-
} = reactData;
|
|
3958
4233
|
const {
|
|
3959
4234
|
tableFullData,
|
|
3960
4235
|
afterFullData,
|
|
3961
4236
|
afterTreeFullData,
|
|
3962
4237
|
tableFullTreeData,
|
|
3963
4238
|
fullDataRowIdData,
|
|
3964
|
-
afterFullRowMaps
|
|
4239
|
+
afterFullRowMaps,
|
|
4240
|
+
selectCheckboxMaps
|
|
3965
4241
|
} = internalData;
|
|
3966
4242
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
3967
4243
|
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
@@ -4026,6 +4302,7 @@ const Methods = {
|
|
|
4026
4302
|
mapChildrenField
|
|
4027
4303
|
} = treeOpts;
|
|
4028
4304
|
const {
|
|
4305
|
+
isEvery,
|
|
4029
4306
|
remote: allRemoteFilter,
|
|
4030
4307
|
filterMethod: allFilterMethod
|
|
4031
4308
|
} = filterOpts;
|
|
@@ -4138,7 +4415,7 @@ const Methods = {
|
|
|
4138
4415
|
// 筛选虚拟树
|
|
4139
4416
|
tableTree = _xeUtils.default.searchTree(tableFullTreeData, handleFilter, {
|
|
4140
4417
|
original: true,
|
|
4141
|
-
isEvery
|
|
4418
|
+
isEvery,
|
|
4142
4419
|
children: mapChildrenField,
|
|
4143
4420
|
mapChildren: childrenField
|
|
4144
4421
|
});
|
|
@@ -4152,7 +4429,7 @@ const Methods = {
|
|
|
4152
4429
|
// 还原虚拟树
|
|
4153
4430
|
tableTree = _xeUtils.default.searchTree(tableFullTreeData, () => true, {
|
|
4154
4431
|
original: true,
|
|
4155
|
-
isEvery
|
|
4432
|
+
isEvery,
|
|
4156
4433
|
children: mapChildrenField,
|
|
4157
4434
|
mapChildren: childrenField
|
|
4158
4435
|
});
|
|
@@ -4229,7 +4506,7 @@ const Methods = {
|
|
|
4229
4506
|
// 还原虚拟树
|
|
4230
4507
|
tableTree = _xeUtils.default.searchTree(tableFullTreeData, () => true, {
|
|
4231
4508
|
original: true,
|
|
4232
|
-
isEvery
|
|
4509
|
+
isEvery,
|
|
4233
4510
|
children: treeOpts.mapChildrenField,
|
|
4234
4511
|
mapChildren: childrenField
|
|
4235
4512
|
});
|
|
@@ -4346,16 +4623,21 @@ const Methods = {
|
|
|
4346
4623
|
* 如果存在排序,继续处理
|
|
4347
4624
|
*/
|
|
4348
4625
|
getTableData() {
|
|
4626
|
+
const $xeTable = this;
|
|
4627
|
+
const props = $xeTable;
|
|
4628
|
+
const reactData = $xeTable;
|
|
4629
|
+
const internalData = $xeTable;
|
|
4630
|
+
const {
|
|
4631
|
+
tableData,
|
|
4632
|
+
footerTableData
|
|
4633
|
+
} = reactData;
|
|
4349
4634
|
const {
|
|
4350
|
-
treeConfig,
|
|
4351
4635
|
tableFullData,
|
|
4352
4636
|
afterFullData,
|
|
4353
|
-
tableData,
|
|
4354
|
-
footerTableData,
|
|
4355
4637
|
tableFullTreeData
|
|
4356
|
-
} =
|
|
4638
|
+
} = internalData;
|
|
4357
4639
|
return {
|
|
4358
|
-
fullData: treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0),
|
|
4640
|
+
fullData: props.treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0),
|
|
4359
4641
|
visibleData: afterFullData.slice(0),
|
|
4360
4642
|
tableData: tableData.slice(0),
|
|
4361
4643
|
footerData: footerTableData.slice(0)
|
|
@@ -4403,37 +4685,16 @@ const Methods = {
|
|
|
4403
4685
|
* 默认执行一次,除非被重置
|
|
4404
4686
|
*/
|
|
4405
4687
|
handleLoadDefaults() {
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
}
|
|
4409
|
-
if (this.radioConfig) {
|
|
4410
|
-
this.handleDefaultRadioChecked();
|
|
4411
|
-
}
|
|
4412
|
-
if (this.expandConfig) {
|
|
4413
|
-
this.handleDefaultRowExpand();
|
|
4414
|
-
}
|
|
4415
|
-
if (this.treeConfig) {
|
|
4416
|
-
this.handleDefaultTreeExpand();
|
|
4417
|
-
}
|
|
4418
|
-
if (this.mergeCells) {
|
|
4419
|
-
this.handleDefaultMergeCells();
|
|
4420
|
-
}
|
|
4421
|
-
if (this.mergeFooterItems) {
|
|
4422
|
-
this.handleDefaultMergeFooterItems();
|
|
4423
|
-
}
|
|
4424
|
-
this.$nextTick(() => setTimeout(this.recalculate));
|
|
4688
|
+
const $xeTable = this;
|
|
4689
|
+
handleLoadDefaults($xeTable);
|
|
4425
4690
|
},
|
|
4426
4691
|
/**
|
|
4427
4692
|
* 处理初始化的默认行为
|
|
4428
4693
|
* 只会执行一次
|
|
4429
4694
|
*/
|
|
4430
4695
|
handleInitDefaults() {
|
|
4431
|
-
const
|
|
4432
|
-
|
|
4433
|
-
} = this;
|
|
4434
|
-
if (sortConfig) {
|
|
4435
|
-
this.handleDefaultSort();
|
|
4436
|
-
}
|
|
4696
|
+
const $xeTable = this;
|
|
4697
|
+
handleInitDefaults($xeTable);
|
|
4437
4698
|
},
|
|
4438
4699
|
/**
|
|
4439
4700
|
* 设置为固定列
|
|
@@ -4595,76 +4856,34 @@ const Methods = {
|
|
|
4595
4856
|
return this.resetCustom(options);
|
|
4596
4857
|
},
|
|
4597
4858
|
handleCustom() {
|
|
4859
|
+
const $xeTable = this;
|
|
4860
|
+
const props = $xeTable;
|
|
4598
4861
|
const {
|
|
4599
4862
|
mouseConfig
|
|
4600
|
-
} =
|
|
4863
|
+
} = props;
|
|
4601
4864
|
if (mouseConfig) {
|
|
4602
|
-
if (
|
|
4603
|
-
|
|
4604
|
-
}
|
|
4605
|
-
if (this.clearCellAreas) {
|
|
4606
|
-
this.clearCellAreas();
|
|
4607
|
-
this.clearCopyCellArea();
|
|
4865
|
+
if ($xeTable.clearSelected) {
|
|
4866
|
+
$xeTable.clearSelected();
|
|
4608
4867
|
}
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
},
|
|
4613
|
-
handleCustomRestore(storeData) {
|
|
4614
|
-
const $xetable = this;
|
|
4615
|
-
const reactData = $xetable;
|
|
4616
|
-
const internalData = $xetable;
|
|
4617
|
-
let {
|
|
4618
|
-
collectColumn
|
|
4619
|
-
} = internalData;
|
|
4620
|
-
const {
|
|
4621
|
-
resizableData,
|
|
4622
|
-
sortData,
|
|
4623
|
-
visibleData,
|
|
4624
|
-
fixedData
|
|
4625
|
-
} = storeData;
|
|
4626
|
-
let hasCustomSort = false;
|
|
4627
|
-
// 处理还原
|
|
4628
|
-
if (resizableData || sortData || visibleData || fixedData) {
|
|
4629
|
-
_xeUtils.default.eachTree(collectColumn, (column, index, items, path, parentRow) => {
|
|
4630
|
-
const colKey = column.getKey();
|
|
4631
|
-
// 支持一级
|
|
4632
|
-
if (!parentRow) {
|
|
4633
|
-
if (fixedData && fixedData[colKey] !== undefined) {
|
|
4634
|
-
column.fixed = fixedData[colKey];
|
|
4635
|
-
}
|
|
4636
|
-
if (sortData && _xeUtils.default.isNumber(sortData[colKey])) {
|
|
4637
|
-
hasCustomSort = true;
|
|
4638
|
-
column.renderSortNumber = sortData[colKey];
|
|
4639
|
-
}
|
|
4640
|
-
}
|
|
4641
|
-
if (resizableData && _xeUtils.default.isNumber(resizableData[colKey])) {
|
|
4642
|
-
column.resizeWidth = resizableData[colKey];
|
|
4643
|
-
}
|
|
4644
|
-
if (visibleData && _xeUtils.default.isBoolean(visibleData[colKey])) {
|
|
4645
|
-
column.visible = visibleData[colKey];
|
|
4646
|
-
}
|
|
4647
|
-
});
|
|
4648
|
-
// 如果自定义了顺序
|
|
4649
|
-
if (hasCustomSort) {
|
|
4650
|
-
collectColumn = _xeUtils.default.orderBy(collectColumn, 'renderSortNumber');
|
|
4651
|
-
internalData.collectColumn = collectColumn;
|
|
4652
|
-
internalData.tableFullColumn = getColumnList(collectColumn);
|
|
4868
|
+
if ($xeTable.clearCellAreas) {
|
|
4869
|
+
$xeTable.clearCellAreas();
|
|
4870
|
+
$xeTable.clearCopyCellArea();
|
|
4653
4871
|
}
|
|
4654
|
-
reactData.isCustomStatus = true;
|
|
4655
|
-
} else {
|
|
4656
|
-
reactData.isCustomStatus = false;
|
|
4657
4872
|
}
|
|
4873
|
+
$xeTable.analyColumnWidth();
|
|
4874
|
+
return $xeTable.refreshColumn(true);
|
|
4658
4875
|
},
|
|
4659
4876
|
/**
|
|
4660
4877
|
* 还原自定义列操作状态
|
|
4661
4878
|
*/
|
|
4662
4879
|
restoreCustomStorage() {
|
|
4880
|
+
const $xeTable = this;
|
|
4881
|
+
const props = $xeTable;
|
|
4663
4882
|
const {
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4883
|
+
customConfig
|
|
4884
|
+
} = props;
|
|
4885
|
+
const tableId = $xeTable.computeTableId;
|
|
4886
|
+
const customOpts = $xeTable.computeCustomOpts;
|
|
4668
4887
|
const {
|
|
4669
4888
|
storage,
|
|
4670
4889
|
restoreStore
|
|
@@ -4690,22 +4909,34 @@ const Methods = {
|
|
|
4690
4909
|
if (!storeData) {
|
|
4691
4910
|
return;
|
|
4692
4911
|
}
|
|
4693
|
-
return
|
|
4912
|
+
return handleCustomRestore($xeTable, storeData);
|
|
4694
4913
|
}).catch(e => e);
|
|
4695
4914
|
} else {
|
|
4696
|
-
return
|
|
4915
|
+
return handleCustomRestore($xeTable, storeData);
|
|
4697
4916
|
}
|
|
4698
4917
|
}
|
|
4699
4918
|
},
|
|
4700
4919
|
getCustomStoreData() {
|
|
4920
|
+
const $xeTable = this;
|
|
4921
|
+
const props = $xeTable;
|
|
4922
|
+
const internalData = $xeTable;
|
|
4923
|
+
const {
|
|
4924
|
+
id
|
|
4925
|
+
} = props;
|
|
4926
|
+
const customOpts = $xeTable.computeCustomOpts;
|
|
4701
4927
|
const {
|
|
4702
|
-
id,
|
|
4703
|
-
customOpts,
|
|
4704
4928
|
collectColumn
|
|
4705
|
-
} =
|
|
4929
|
+
} = internalData;
|
|
4706
4930
|
const {
|
|
4931
|
+
storage,
|
|
4707
4932
|
checkMethod
|
|
4708
4933
|
} = customOpts;
|
|
4934
|
+
const isAllCustom = storage === true;
|
|
4935
|
+
const storageOpts = isAllCustom ? {} : Object.assign({}, storage || {});
|
|
4936
|
+
const isCustomResizable = isAllCustom || storageOpts.resizable;
|
|
4937
|
+
const isCustomVisible = isAllCustom || storageOpts.visible;
|
|
4938
|
+
const isCustomFixed = isAllCustom || storageOpts.fixed;
|
|
4939
|
+
const isCustomSort = isAllCustom || storageOpts.sort;
|
|
4709
4940
|
const resizableData = {};
|
|
4710
4941
|
const sortData = {};
|
|
4711
4942
|
const visibleData = {};
|
|
@@ -4722,48 +4953,38 @@ const Methods = {
|
|
|
4722
4953
|
}
|
|
4723
4954
|
let hasResizable = 0;
|
|
4724
4955
|
let hasSort = 0;
|
|
4725
|
-
let
|
|
4956
|
+
let hasFixed = 0;
|
|
4726
4957
|
let hasVisible = 0;
|
|
4727
4958
|
_xeUtils.default.eachTree(collectColumn, (column, index, items, path, parentColumn) => {
|
|
4959
|
+
const colKey = column.getKey();
|
|
4960
|
+
if (!colKey) {
|
|
4961
|
+
(0, _log.errLog)('vxe.error.reqProp', [`${column.getTitle() || column.type || ''} -> column.field=?`]);
|
|
4962
|
+
return;
|
|
4963
|
+
}
|
|
4728
4964
|
// 只支持一级
|
|
4729
4965
|
if (!parentColumn) {
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
hasSort = 1;
|
|
4734
|
-
sortData[colKey] = column.renderSortNumber;
|
|
4735
|
-
}
|
|
4736
|
-
});
|
|
4737
|
-
if (column.fixed !== column.defaultFixed) {
|
|
4738
|
-
const colKey = column.getKey();
|
|
4739
|
-
if (colKey) {
|
|
4740
|
-
hasFixedt = 1;
|
|
4741
|
-
fixedData[colKey] = column.fixed;
|
|
4742
|
-
}
|
|
4966
|
+
if (isCustomSort) {
|
|
4967
|
+
hasSort = 1;
|
|
4968
|
+
sortData[colKey] = column.renderSortNumber;
|
|
4743
4969
|
}
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
if (colKey) {
|
|
4748
|
-
hasResizable = 1;
|
|
4749
|
-
resizableData[colKey] = column.renderWidth;
|
|
4970
|
+
if (isCustomFixed && column.fixed !== column.defaultFixed) {
|
|
4971
|
+
hasFixed = 1;
|
|
4972
|
+
fixedData[colKey] = column.fixed;
|
|
4750
4973
|
}
|
|
4751
4974
|
}
|
|
4752
|
-
if (
|
|
4975
|
+
if (isCustomResizable && column.resizeWidth) {
|
|
4976
|
+
hasResizable = 1;
|
|
4977
|
+
resizableData[colKey] = column.renderWidth;
|
|
4978
|
+
}
|
|
4979
|
+
if (isCustomVisible && (!checkMethod || checkMethod({
|
|
4753
4980
|
column
|
|
4754
|
-
})) {
|
|
4981
|
+
}))) {
|
|
4755
4982
|
if (!column.visible && column.defaultVisible) {
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
hasVisible = 1;
|
|
4759
|
-
visibleData[colKey] = false;
|
|
4760
|
-
}
|
|
4983
|
+
hasVisible = 1;
|
|
4984
|
+
visibleData[colKey] = false;
|
|
4761
4985
|
} else if (column.visible && !column.defaultVisible) {
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
hasVisible = 1;
|
|
4765
|
-
visibleData[colKey] = true;
|
|
4766
|
-
}
|
|
4986
|
+
hasVisible = 1;
|
|
4987
|
+
visibleData[colKey] = true;
|
|
4767
4988
|
}
|
|
4768
4989
|
}
|
|
4769
4990
|
});
|
|
@@ -4773,7 +4994,7 @@ const Methods = {
|
|
|
4773
4994
|
if (hasSort) {
|
|
4774
4995
|
storeData.sortData = sortData;
|
|
4775
4996
|
}
|
|
4776
|
-
if (
|
|
4997
|
+
if (hasFixed) {
|
|
4777
4998
|
storeData.fixedData = fixedData;
|
|
4778
4999
|
}
|
|
4779
5000
|
if (hasVisible) {
|
|
@@ -5321,12 +5542,15 @@ const Methods = {
|
|
|
5321
5542
|
fullAllDataRowIdData,
|
|
5322
5543
|
afterFullData
|
|
5323
5544
|
} = internalData;
|
|
5545
|
+
const {
|
|
5546
|
+
handleGetRowId
|
|
5547
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
5324
5548
|
const rowOpts = $xeTable.computeRowOpts;
|
|
5325
5549
|
const cellOpts = $xeTable.computeCellOpts;
|
|
5326
5550
|
const defaultRowHeight = $xeTable.computeDefaultRowHeight;
|
|
5327
5551
|
const rest = {};
|
|
5328
5552
|
afterFullData.forEach(row => {
|
|
5329
|
-
const rowid = (
|
|
5553
|
+
const rowid = handleGetRowId(row);
|
|
5330
5554
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
5331
5555
|
if (rowRest) {
|
|
5332
5556
|
const resizeHeight = rowRest.resizeHeight;
|
|
@@ -5355,8 +5579,11 @@ const Methods = {
|
|
|
5355
5579
|
rHeight = Math.floor(rHeight * bodyHeight);
|
|
5356
5580
|
}
|
|
5357
5581
|
if (rHeight) {
|
|
5582
|
+
const {
|
|
5583
|
+
handleGetRowId
|
|
5584
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
5358
5585
|
rows.forEach(row => {
|
|
5359
|
-
const rowid = _xeUtils.default.isString(row) || _xeUtils.default.isNumber(row) ? row : (
|
|
5586
|
+
const rowid = _xeUtils.default.isString(row) || _xeUtils.default.isNumber(row) ? row : handleGetRowId(row);
|
|
5360
5587
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
5361
5588
|
if (rowRest) {
|
|
5362
5589
|
rowRest.resizeHeight = rHeight;
|
|
@@ -5504,6 +5731,8 @@ const Methods = {
|
|
|
5504
5731
|
}
|
|
5505
5732
|
},
|
|
5506
5733
|
preventEvent(evnt, type, args, next, end) {
|
|
5734
|
+
const $xeTable = this;
|
|
5735
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
5507
5736
|
let evntList = interceptor.get(type);
|
|
5508
5737
|
// 兼容老版本
|
|
5509
5738
|
if (!evntList.length && type === 'event.clearEdit') {
|
|
@@ -5515,12 +5744,25 @@ const Methods = {
|
|
|
5515
5744
|
}
|
|
5516
5745
|
}
|
|
5517
5746
|
// 兼容老版本
|
|
5518
|
-
let rest;
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5747
|
+
let rest = null;
|
|
5748
|
+
let isStop = false;
|
|
5749
|
+
for (let i = 0; i < evntList.length; i++) {
|
|
5750
|
+
const func = evntList[i];
|
|
5751
|
+
const fnRest = func(Object.assign({
|
|
5752
|
+
$grid: $xeGrid,
|
|
5753
|
+
$table: $xeTable,
|
|
5754
|
+
$event: evnt
|
|
5755
|
+
}, args));
|
|
5756
|
+
if (fnRest === false) {
|
|
5757
|
+
isStop = true;
|
|
5758
|
+
break;
|
|
5759
|
+
} else if (fnRest && fnRest.status === false) {
|
|
5760
|
+
rest = fnRest.result;
|
|
5761
|
+
isStop = true;
|
|
5762
|
+
break;
|
|
5763
|
+
}
|
|
5764
|
+
}
|
|
5765
|
+
if (!isStop) {
|
|
5524
5766
|
if (next) {
|
|
5525
5767
|
rest = next();
|
|
5526
5768
|
}
|
|
@@ -5534,10 +5776,11 @@ const Methods = {
|
|
|
5534
5776
|
* 全局按下事件处理
|
|
5535
5777
|
*/
|
|
5536
5778
|
handleGlobalMousedownEvent(evnt) {
|
|
5779
|
+
const $xeTable = this;
|
|
5780
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
5537
5781
|
const {
|
|
5538
5782
|
$el,
|
|
5539
5783
|
$refs,
|
|
5540
|
-
$xegrid,
|
|
5541
5784
|
$toolbar,
|
|
5542
5785
|
mouseConfig,
|
|
5543
5786
|
editStore,
|
|
@@ -5637,7 +5880,7 @@ const Methods = {
|
|
|
5637
5880
|
}
|
|
5638
5881
|
}
|
|
5639
5882
|
} else if (mouseConfig) {
|
|
5640
|
-
if (!(0, _dom.getEventTargetNode)(evnt, $el).flag && !($
|
|
5883
|
+
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)) {
|
|
5641
5884
|
if (this.clearSelected) {
|
|
5642
5885
|
this.clearSelected();
|
|
5643
5886
|
}
|
|
@@ -5661,7 +5904,7 @@ const Methods = {
|
|
|
5661
5904
|
if (ctxMenuStore.visible && tableMenu && !(0, _dom.getEventTargetNode)(evnt, tableMenu.$el).flag) {
|
|
5662
5905
|
this.closeMenu();
|
|
5663
5906
|
}
|
|
5664
|
-
const isActivated = (0, _dom.getEventTargetNode)(evnt, ($
|
|
5907
|
+
const isActivated = (0, _dom.getEventTargetNode)(evnt, ($xeGrid || this).$el).flag;
|
|
5665
5908
|
// 如果存在校验,点击了表格之外则清除
|
|
5666
5909
|
if (!isActivated && editRules && validOpts.autoClear) {
|
|
5667
5910
|
this.validErrorMaps = {};
|
|
@@ -5736,6 +5979,7 @@ const Methods = {
|
|
|
5736
5979
|
handleGlobalKeydownEvent(evnt) {
|
|
5737
5980
|
const $xeTable = this;
|
|
5738
5981
|
const internalData = $xeTable;
|
|
5982
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
5739
5983
|
// 该行为只对当前激活的表格有效
|
|
5740
5984
|
if (this.isActivated) {
|
|
5741
5985
|
this.preventEvent(evnt, 'event.keydown', null, () => {
|
|
@@ -5853,7 +6097,7 @@ const Methods = {
|
|
|
5853
6097
|
if (keyboardOpts.enterToTab) {
|
|
5854
6098
|
this.moveTabSelected(activeParams, hasShiftKey, evnt);
|
|
5855
6099
|
} else {
|
|
5856
|
-
this.
|
|
6100
|
+
this.moveEnterSelected(activeParams, isLeftArrow, true, isRightArrow, false, evnt);
|
|
5857
6101
|
}
|
|
5858
6102
|
} else {
|
|
5859
6103
|
if (keyboardOpts.enterToTab) {
|
|
@@ -5889,7 +6133,7 @@ const Methods = {
|
|
|
5889
6133
|
return;
|
|
5890
6134
|
}
|
|
5891
6135
|
}
|
|
5892
|
-
this.
|
|
6136
|
+
this.moveEnterSelected(activeParams, isLeftArrow, false, isRightArrow, true, evnt);
|
|
5893
6137
|
if (enterMethod) {
|
|
5894
6138
|
enterMethod(etrParams);
|
|
5895
6139
|
}
|
|
@@ -5914,10 +6158,7 @@ const Methods = {
|
|
|
5914
6158
|
if (!isEditStatus) {
|
|
5915
6159
|
// 如果按下了方向键
|
|
5916
6160
|
if (selected.row && selected.column) {
|
|
5917
|
-
|
|
5918
|
-
} else if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
|
|
5919
|
-
// 当前行按键上下移动
|
|
5920
|
-
this.moveCurrentRow(isUpArrow, isDwArrow, evnt);
|
|
6161
|
+
$xeTable.moveArrowSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt);
|
|
5921
6162
|
}
|
|
5922
6163
|
}
|
|
5923
6164
|
} else if (isTab && keyboardConfig && keyboardOpts.isTab) {
|
|
@@ -5939,7 +6180,7 @@ const Methods = {
|
|
|
5939
6180
|
column: selected.column,
|
|
5940
6181
|
columnIndex: this.getColumnIndex(selected.column),
|
|
5941
6182
|
$table: this,
|
|
5942
|
-
$grid:
|
|
6183
|
+
$grid: $xeGrid
|
|
5943
6184
|
};
|
|
5944
6185
|
// 是否被禁用
|
|
5945
6186
|
if (!beforeEditMethod || beforeEditMethod(params)) {
|
|
@@ -5967,7 +6208,7 @@ const Methods = {
|
|
|
5967
6208
|
column: selected.column,
|
|
5968
6209
|
columnIndex: this.getColumnIndex(selected.column),
|
|
5969
6210
|
$table: this,
|
|
5970
|
-
$grid:
|
|
6211
|
+
$grid: $xeGrid
|
|
5971
6212
|
};
|
|
5972
6213
|
// 是否被禁用
|
|
5973
6214
|
if (!beforeEditMethod || beforeEditMethod(params)) {
|
|
@@ -5998,7 +6239,7 @@ const Methods = {
|
|
|
5998
6239
|
rowIndex: this.getRowIndex(parentRow),
|
|
5999
6240
|
$rowIndex: this.getVMRowIndex(parentRow),
|
|
6000
6241
|
$table: this,
|
|
6001
|
-
$grid:
|
|
6242
|
+
$grid: $xeGrid
|
|
6002
6243
|
};
|
|
6003
6244
|
this.setTreeExpand(parentRow, false).then(() => this.scrollToRow(parentRow)).then(() => this.triggerCurrentRowEvent(evnt, params));
|
|
6004
6245
|
}
|
|
@@ -6019,7 +6260,7 @@ const Methods = {
|
|
|
6019
6260
|
column: selected.column,
|
|
6020
6261
|
columnIndex: this.getColumnIndex(selected.column),
|
|
6021
6262
|
$table: this,
|
|
6022
|
-
$grid:
|
|
6263
|
+
$grid: $xeGrid
|
|
6023
6264
|
};
|
|
6024
6265
|
if (!beforeEditMethod || beforeEditMethod(params)) {
|
|
6025
6266
|
if (editMethod) {
|
|
@@ -6176,7 +6417,7 @@ const Methods = {
|
|
|
6176
6417
|
return;
|
|
6177
6418
|
}
|
|
6178
6419
|
if (tooltipStore.column !== column || !tooltipStore.visible) {
|
|
6179
|
-
handleTooltip($xeTable, evnt, thEl, cellEl,
|
|
6420
|
+
handleTooltip($xeTable, evnt, thEl, thEl.querySelector('.vxe-cell--title') || cellEl, params);
|
|
6180
6421
|
}
|
|
6181
6422
|
},
|
|
6182
6423
|
/**
|
|
@@ -6217,7 +6458,7 @@ const Methods = {
|
|
|
6217
6458
|
}
|
|
6218
6459
|
}
|
|
6219
6460
|
if (tooltipStore.column !== column || tooltipStore.row !== row || !tooltipStore.visible) {
|
|
6220
|
-
handleTooltip($xeTable, evnt, tdEl, tdEl.querySelector('.vxe-cell--wrapper'),
|
|
6461
|
+
handleTooltip($xeTable, evnt, tdEl, tdEl.querySelector('.vxe-cell--label') || tdEl.querySelector('.vxe-cell--wrapper'), params);
|
|
6221
6462
|
}
|
|
6222
6463
|
},
|
|
6223
6464
|
/**
|
|
@@ -6232,10 +6473,10 @@ const Methods = {
|
|
|
6232
6473
|
const {
|
|
6233
6474
|
tooltipStore
|
|
6234
6475
|
} = reactData;
|
|
6235
|
-
const
|
|
6476
|
+
const tdEl = evnt.currentTarget;
|
|
6236
6477
|
handleTargetEnterEvent($xeTable, tooltipStore.column !== column || !!tooltipStore.row);
|
|
6237
6478
|
if (tooltipStore.column !== column || !tooltipStore.visible) {
|
|
6238
|
-
handleTooltip($xeTable, evnt,
|
|
6479
|
+
handleTooltip($xeTable, evnt, tdEl, tdEl.querySelector('.vxe-cell--label') || tdEl.querySelector('.vxe-cell--wrapper'), params);
|
|
6239
6480
|
}
|
|
6240
6481
|
},
|
|
6241
6482
|
openTooltip(target, content) {
|
|
@@ -6296,15 +6537,20 @@ const Methods = {
|
|
|
6296
6537
|
* 获取复选框半选状态的行数据
|
|
6297
6538
|
*/
|
|
6298
6539
|
getCheckboxIndeterminateRecords(isFull) {
|
|
6540
|
+
const $xeTable = this;
|
|
6541
|
+
const props = $xeTable;
|
|
6542
|
+
const internalData = $xeTable;
|
|
6299
6543
|
const {
|
|
6300
|
-
treeConfig
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6544
|
+
treeConfig
|
|
6545
|
+
} = props;
|
|
6546
|
+
const {
|
|
6547
|
+
fullDataRowIdData,
|
|
6548
|
+
treeIndeterminateRowMaps
|
|
6549
|
+
} = internalData;
|
|
6304
6550
|
if (treeConfig) {
|
|
6305
6551
|
const fullRest = [];
|
|
6306
6552
|
const defRest = [];
|
|
6307
|
-
_xeUtils.default.each(
|
|
6553
|
+
_xeUtils.default.each(treeIndeterminateRowMaps, (item, rowid) => {
|
|
6308
6554
|
if (item) {
|
|
6309
6555
|
fullRest.push(item);
|
|
6310
6556
|
if (fullDataRowIdData[rowid]) {
|
|
@@ -6319,31 +6565,6 @@ const Methods = {
|
|
|
6319
6565
|
}
|
|
6320
6566
|
return [];
|
|
6321
6567
|
},
|
|
6322
|
-
/**
|
|
6323
|
-
* 处理默认勾选
|
|
6324
|
-
*/
|
|
6325
|
-
handleDefaultSelectionChecked() {
|
|
6326
|
-
const $xeTable = this;
|
|
6327
|
-
const {
|
|
6328
|
-
fullDataRowIdData,
|
|
6329
|
-
checkboxOpts
|
|
6330
|
-
} = this;
|
|
6331
|
-
const {
|
|
6332
|
-
checkAll,
|
|
6333
|
-
checkRowKeys
|
|
6334
|
-
} = checkboxOpts;
|
|
6335
|
-
if (checkAll) {
|
|
6336
|
-
handleCheckedAllCheckboxRow($xeTable, true, true);
|
|
6337
|
-
} else if (checkRowKeys) {
|
|
6338
|
-
const defSelection = [];
|
|
6339
|
-
checkRowKeys.forEach(rowid => {
|
|
6340
|
-
if (fullDataRowIdData[rowid]) {
|
|
6341
|
-
defSelection.push(fullDataRowIdData[rowid].row);
|
|
6342
|
-
}
|
|
6343
|
-
});
|
|
6344
|
-
handleCheckedCheckboxRow($xeTable, defSelection, true, true);
|
|
6345
|
-
}
|
|
6346
|
-
},
|
|
6347
6568
|
handleCheckedCheckboxRow(rows, value, isForce) {
|
|
6348
6569
|
const $xeTable = this;
|
|
6349
6570
|
return handleCheckedCheckboxRow($xeTable, rows, value, isForce);
|
|
@@ -6381,9 +6602,13 @@ const Methods = {
|
|
|
6381
6602
|
isCheckedByCheckboxRow(row) {
|
|
6382
6603
|
const $xeTable = this;
|
|
6383
6604
|
const reactData = $xeTable;
|
|
6605
|
+
const internalData = $xeTable;
|
|
6384
6606
|
const {
|
|
6385
|
-
|
|
6607
|
+
updateCheckboxFlag
|
|
6386
6608
|
} = reactData;
|
|
6609
|
+
const {
|
|
6610
|
+
selectCheckboxMaps
|
|
6611
|
+
} = internalData;
|
|
6387
6612
|
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
6388
6613
|
const {
|
|
6389
6614
|
checkField
|
|
@@ -6391,17 +6616,18 @@ const Methods = {
|
|
|
6391
6616
|
if (checkField) {
|
|
6392
6617
|
return _xeUtils.default.get(row, checkField);
|
|
6393
6618
|
}
|
|
6394
|
-
return !!selectCheckboxMaps[(0, _util.getRowid)($xeTable, row)];
|
|
6619
|
+
return !!updateCheckboxFlag && !!selectCheckboxMaps[(0, _util.getRowid)($xeTable, row)];
|
|
6395
6620
|
},
|
|
6396
6621
|
isCheckedByCheckboxRowKey(rowid) {
|
|
6397
6622
|
const $xeTable = this;
|
|
6398
6623
|
const reactData = $xeTable;
|
|
6399
6624
|
const internalData = $xeTable;
|
|
6400
6625
|
const {
|
|
6401
|
-
|
|
6626
|
+
updateCheckboxFlag
|
|
6402
6627
|
} = reactData;
|
|
6403
6628
|
const {
|
|
6404
|
-
fullAllDataRowIdData
|
|
6629
|
+
fullAllDataRowIdData,
|
|
6630
|
+
selectCheckboxMaps
|
|
6405
6631
|
} = internalData;
|
|
6406
6632
|
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
6407
6633
|
const {
|
|
@@ -6414,23 +6640,23 @@ const Methods = {
|
|
|
6414
6640
|
}
|
|
6415
6641
|
return false;
|
|
6416
6642
|
}
|
|
6417
|
-
return !!selectCheckboxMaps[rowid];
|
|
6643
|
+
return !!updateCheckboxFlag && !!selectCheckboxMaps[rowid];
|
|
6418
6644
|
},
|
|
6419
6645
|
isIndeterminateByCheckboxRow(row) {
|
|
6420
6646
|
const $xeTable = this;
|
|
6421
|
-
const
|
|
6647
|
+
const internalData = $xeTable;
|
|
6422
6648
|
const {
|
|
6423
|
-
|
|
6424
|
-
} =
|
|
6425
|
-
return !!
|
|
6649
|
+
treeIndeterminateRowMaps
|
|
6650
|
+
} = internalData;
|
|
6651
|
+
return !!treeIndeterminateRowMaps[(0, _util.getRowid)($xeTable, row)] && !$xeTable.isCheckedByCheckboxRow(row);
|
|
6426
6652
|
},
|
|
6427
6653
|
isIndeterminateByCheckboxRowKey(rowid) {
|
|
6428
6654
|
const $xeTable = this;
|
|
6429
|
-
const
|
|
6655
|
+
const internalData = $xeTable;
|
|
6430
6656
|
const {
|
|
6431
|
-
|
|
6432
|
-
} =
|
|
6433
|
-
return !!
|
|
6657
|
+
treeIndeterminateRowMaps
|
|
6658
|
+
} = internalData;
|
|
6659
|
+
return !!treeIndeterminateRowMaps[rowid] && !$xeTable.isCheckedByCheckboxRowKey(rowid);
|
|
6434
6660
|
},
|
|
6435
6661
|
/**
|
|
6436
6662
|
* 切换选中
|
|
@@ -6440,13 +6666,13 @@ const Methods = {
|
|
|
6440
6666
|
const $xeTable = this;
|
|
6441
6667
|
const props = $xeTable;
|
|
6442
6668
|
const reactData = $xeTable;
|
|
6669
|
+
const internalData = $xeTable;
|
|
6443
6670
|
const {
|
|
6444
6671
|
treeConfig
|
|
6445
6672
|
} = props;
|
|
6446
6673
|
const {
|
|
6447
6674
|
selectCheckboxMaps
|
|
6448
|
-
} =
|
|
6449
|
-
const selectRowMaps = Object.assign({}, selectCheckboxMaps);
|
|
6675
|
+
} = internalData;
|
|
6450
6676
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
6451
6677
|
const {
|
|
6452
6678
|
transform,
|
|
@@ -6459,6 +6685,9 @@ const Methods = {
|
|
|
6459
6685
|
checkStrictly,
|
|
6460
6686
|
checkMethod
|
|
6461
6687
|
} = checkboxOpts;
|
|
6688
|
+
const {
|
|
6689
|
+
handleGetRowId
|
|
6690
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
6462
6691
|
// indeterminateField 仅支持读取
|
|
6463
6692
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
6464
6693
|
if (checkField) {
|
|
@@ -6478,35 +6707,34 @@ const Methods = {
|
|
|
6478
6707
|
}, {
|
|
6479
6708
|
children: transform ? mapChildrenField : childrenField
|
|
6480
6709
|
});
|
|
6481
|
-
reactData.
|
|
6710
|
+
reactData.updateCheckboxFlag++;
|
|
6482
6711
|
return;
|
|
6483
|
-
} else {
|
|
6484
|
-
// 列表
|
|
6485
|
-
rows.forEach(row => {
|
|
6486
|
-
if (isForce || !checkMethod || checkMethod({
|
|
6487
|
-
row
|
|
6488
|
-
})) {
|
|
6489
|
-
_xeUtils.default.set(row, checkField, checked);
|
|
6490
|
-
handleCheckboxReserveRow($xeTable, row, checked);
|
|
6491
|
-
}
|
|
6492
|
-
});
|
|
6493
6712
|
}
|
|
6494
|
-
|
|
6713
|
+
// 列表
|
|
6714
|
+
rows.forEach(row => {
|
|
6715
|
+
if (isForce || !checkMethod || checkMethod({
|
|
6716
|
+
row
|
|
6717
|
+
})) {
|
|
6718
|
+
_xeUtils.default.set(row, checkField, checked);
|
|
6719
|
+
handleCheckboxReserveRow($xeTable, row, checked);
|
|
6720
|
+
}
|
|
6721
|
+
});
|
|
6722
|
+
reactData.updateCheckboxFlag++;
|
|
6495
6723
|
return;
|
|
6496
6724
|
}
|
|
6497
6725
|
// 树结构
|
|
6498
6726
|
if (treeConfig && !checkStrictly) {
|
|
6499
6727
|
// 更新子节点状态
|
|
6500
6728
|
_xeUtils.default.eachTree(rows, row => {
|
|
6501
|
-
const rowid = (
|
|
6729
|
+
const rowid = handleGetRowId(row);
|
|
6502
6730
|
if (isForce || !checkMethod || checkMethod({
|
|
6503
6731
|
row
|
|
6504
6732
|
})) {
|
|
6505
6733
|
if (checked) {
|
|
6506
|
-
|
|
6734
|
+
selectCheckboxMaps[rowid] = row;
|
|
6507
6735
|
} else {
|
|
6508
|
-
if (
|
|
6509
|
-
delete
|
|
6736
|
+
if (selectCheckboxMaps[rowid]) {
|
|
6737
|
+
delete selectCheckboxMaps[rowid];
|
|
6510
6738
|
}
|
|
6511
6739
|
}
|
|
6512
6740
|
handleCheckboxReserveRow($xeTable, row, checked);
|
|
@@ -6514,28 +6742,28 @@ const Methods = {
|
|
|
6514
6742
|
}, {
|
|
6515
6743
|
children: transform ? mapChildrenField : childrenField
|
|
6516
6744
|
});
|
|
6517
|
-
reactData.
|
|
6745
|
+
reactData.updateCheckboxFlag++;
|
|
6518
6746
|
return;
|
|
6519
6747
|
}
|
|
6520
6748
|
// 列表
|
|
6521
6749
|
rows.forEach(row => {
|
|
6522
|
-
const rowid = (
|
|
6750
|
+
const rowid = handleGetRowId(row);
|
|
6523
6751
|
if (isForce || !checkMethod || checkMethod({
|
|
6524
6752
|
row
|
|
6525
6753
|
})) {
|
|
6526
6754
|
if (checked) {
|
|
6527
|
-
if (!
|
|
6528
|
-
|
|
6755
|
+
if (!selectCheckboxMaps[rowid]) {
|
|
6756
|
+
selectCheckboxMaps[rowid] = row;
|
|
6529
6757
|
}
|
|
6530
6758
|
} else {
|
|
6531
|
-
if (
|
|
6532
|
-
delete
|
|
6759
|
+
if (selectCheckboxMaps[rowid]) {
|
|
6760
|
+
delete selectCheckboxMaps[rowid];
|
|
6533
6761
|
}
|
|
6534
6762
|
}
|
|
6535
6763
|
handleCheckboxReserveRow($xeTable, row, checked);
|
|
6764
|
+
reactData.updateCheckboxFlag++;
|
|
6536
6765
|
}
|
|
6537
6766
|
});
|
|
6538
|
-
reactData.selectCheckboxMaps = selectRowMaps;
|
|
6539
6767
|
},
|
|
6540
6768
|
/**
|
|
6541
6769
|
* 即将移除
|
|
@@ -6548,10 +6776,12 @@ const Methods = {
|
|
|
6548
6776
|
$xeTable.handleBatchSelectRows([row], checked, isForce);
|
|
6549
6777
|
},
|
|
6550
6778
|
handleToggleCheckRowEvent(evnt, params) {
|
|
6779
|
+
const $xeTable = this;
|
|
6780
|
+
const internalData = $xeTable;
|
|
6551
6781
|
const {
|
|
6552
|
-
selectCheckboxMaps
|
|
6553
|
-
|
|
6554
|
-
|
|
6782
|
+
selectCheckboxMaps
|
|
6783
|
+
} = internalData;
|
|
6784
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
6555
6785
|
const {
|
|
6556
6786
|
checkField,
|
|
6557
6787
|
trigger
|
|
@@ -6566,43 +6796,47 @@ const Methods = {
|
|
|
6566
6796
|
if (checkField) {
|
|
6567
6797
|
checked = !_xeUtils.default.get(row, checkField);
|
|
6568
6798
|
} else {
|
|
6569
|
-
checked = !selectCheckboxMaps[(0, _util.getRowid)(
|
|
6799
|
+
checked = !selectCheckboxMaps[(0, _util.getRowid)($xeTable, row)];
|
|
6570
6800
|
}
|
|
6571
6801
|
if (evnt) {
|
|
6572
|
-
|
|
6802
|
+
$xeTable.triggerCheckRowEvent(evnt, params, checked);
|
|
6573
6803
|
} else {
|
|
6574
|
-
|
|
6575
|
-
|
|
6804
|
+
$xeTable.handleBatchSelectRows([row], checked);
|
|
6805
|
+
$xeTable.checkSelectionStatus();
|
|
6576
6806
|
}
|
|
6577
6807
|
},
|
|
6578
6808
|
triggerCheckRowEvent(evnt, params, checked) {
|
|
6579
6809
|
const $xeTable = this;
|
|
6810
|
+
const props = $xeTable;
|
|
6811
|
+
const internalData = $xeTable;
|
|
6812
|
+
const {
|
|
6813
|
+
row
|
|
6814
|
+
} = params;
|
|
6580
6815
|
const {
|
|
6581
|
-
checkboxOpts,
|
|
6582
6816
|
afterFullData
|
|
6583
|
-
} =
|
|
6817
|
+
} = internalData;
|
|
6818
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
6584
6819
|
const {
|
|
6585
6820
|
checkMethod,
|
|
6586
6821
|
trigger
|
|
6587
6822
|
} = checkboxOpts;
|
|
6588
|
-
const {
|
|
6589
|
-
row
|
|
6590
|
-
} = params;
|
|
6591
6823
|
if (trigger === 'manual') {
|
|
6592
6824
|
return;
|
|
6593
6825
|
}
|
|
6594
6826
|
evnt.stopPropagation();
|
|
6595
|
-
if (checkboxOpts.isShiftKey && evnt.shiftKey && !
|
|
6596
|
-
const checkboxRecords =
|
|
6827
|
+
if (checkboxOpts.isShiftKey && evnt.shiftKey && !props.treeConfig) {
|
|
6828
|
+
const checkboxRecords = $xeTable.getCheckboxRecords();
|
|
6597
6829
|
if (checkboxRecords.length) {
|
|
6598
6830
|
const firstRow = checkboxRecords[0];
|
|
6599
|
-
const _rowIndex =
|
|
6600
|
-
const _firstRowIndex =
|
|
6831
|
+
const _rowIndex = $xeTable.getVTRowIndex(row);
|
|
6832
|
+
const _firstRowIndex = $xeTable.getVTRowIndex(firstRow);
|
|
6601
6833
|
if (_rowIndex !== _firstRowIndex) {
|
|
6602
|
-
|
|
6834
|
+
$xeTable.setAllCheckboxRow(false);
|
|
6603
6835
|
const rangeRows = _rowIndex < _firstRowIndex ? afterFullData.slice(_rowIndex, _firstRowIndex + 1) : afterFullData.slice(_firstRowIndex, _rowIndex + 1);
|
|
6604
|
-
|
|
6605
|
-
|
|
6836
|
+
$xeTable.$nextTick(() => {
|
|
6837
|
+
handleCheckedCheckboxRow($xeTable, rangeRows, true, false);
|
|
6838
|
+
});
|
|
6839
|
+
$xeTable.dispatchEvent('checkbox-range-select', Object.assign({
|
|
6606
6840
|
rangeRecords: rangeRows
|
|
6607
6841
|
}, params), evnt);
|
|
6608
6842
|
return;
|
|
@@ -6612,12 +6846,12 @@ const Methods = {
|
|
|
6612
6846
|
if (!checkMethod || checkMethod({
|
|
6613
6847
|
row
|
|
6614
6848
|
})) {
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
records:
|
|
6619
|
-
reserves:
|
|
6620
|
-
indeterminates:
|
|
6849
|
+
$xeTable.handleBatchSelectRows([row], checked);
|
|
6850
|
+
$xeTable.checkSelectionStatus();
|
|
6851
|
+
$xeTable.dispatchEvent('checkbox-change', Object.assign({
|
|
6852
|
+
records: () => $xeTable.getCheckboxRecords(),
|
|
6853
|
+
reserves: () => $xeTable.getCheckboxReserveRecords(),
|
|
6854
|
+
indeterminates: () => $xeTable.getCheckboxIndeterminateRecords(),
|
|
6621
6855
|
checked
|
|
6622
6856
|
}, params), evnt);
|
|
6623
6857
|
}
|
|
@@ -6627,10 +6861,11 @@ const Methods = {
|
|
|
6627
6861
|
*/
|
|
6628
6862
|
toggleCheckboxRow(row) {
|
|
6629
6863
|
const $xeTable = this;
|
|
6864
|
+
const internalData = $xeTable;
|
|
6630
6865
|
const {
|
|
6631
|
-
selectCheckboxMaps
|
|
6632
|
-
|
|
6633
|
-
|
|
6866
|
+
selectCheckboxMaps
|
|
6867
|
+
} = internalData;
|
|
6868
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
6634
6869
|
const {
|
|
6635
6870
|
checkField
|
|
6636
6871
|
} = checkboxOpts;
|
|
@@ -6657,10 +6892,8 @@ const Methods = {
|
|
|
6657
6892
|
} = props;
|
|
6658
6893
|
const {
|
|
6659
6894
|
selectCheckboxMaps,
|
|
6660
|
-
|
|
6661
|
-
} =
|
|
6662
|
-
const selectRowMaps = Object.assign({}, selectCheckboxMaps);
|
|
6663
|
-
const halfRowMaps = Object.assign({}, treeIndeterminateMaps);
|
|
6895
|
+
treeIndeterminateRowMaps
|
|
6896
|
+
} = internalData;
|
|
6664
6897
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
6665
6898
|
const {
|
|
6666
6899
|
transform,
|
|
@@ -6681,10 +6914,13 @@ const Methods = {
|
|
|
6681
6914
|
}
|
|
6682
6915
|
// 树结构
|
|
6683
6916
|
if (treeConfig) {
|
|
6917
|
+
const {
|
|
6918
|
+
handleGetRowId
|
|
6919
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
6684
6920
|
const childRowMaps = {};
|
|
6685
6921
|
const childRowList = [];
|
|
6686
6922
|
_xeUtils.default.eachTree(afterTreeFullData, row => {
|
|
6687
|
-
const rowid = (
|
|
6923
|
+
const rowid = handleGetRowId(row);
|
|
6688
6924
|
const childList = row[transform ? mapChildrenField : childrenField];
|
|
6689
6925
|
if (childList && childList.length && !childRowMaps[rowid]) {
|
|
6690
6926
|
childRowMaps[rowid] = 1;
|
|
@@ -6701,30 +6937,30 @@ const Methods = {
|
|
|
6701
6937
|
let hLen = 0; // 半选
|
|
6702
6938
|
let vLen = 0; // 有效行
|
|
6703
6939
|
childList.forEach(checkMethod ? item => {
|
|
6704
|
-
const childRowid = (
|
|
6705
|
-
const isSelect = checkField ? _xeUtils.default.get(item, checkField) :
|
|
6940
|
+
const childRowid = handleGetRowId(item);
|
|
6941
|
+
const isSelect = checkField ? _xeUtils.default.get(item, checkField) : selectCheckboxMaps[childRowid];
|
|
6706
6942
|
if (checkMethod({
|
|
6707
6943
|
row: item
|
|
6708
6944
|
})) {
|
|
6709
6945
|
if (isSelect) {
|
|
6710
6946
|
sLen++;
|
|
6711
|
-
} else if (
|
|
6947
|
+
} else if (treeIndeterminateRowMaps[childRowid]) {
|
|
6712
6948
|
hLen++;
|
|
6713
6949
|
}
|
|
6714
6950
|
vLen++;
|
|
6715
6951
|
} else {
|
|
6716
6952
|
if (isSelect) {
|
|
6717
6953
|
sLen++;
|
|
6718
|
-
} else if (
|
|
6954
|
+
} else if (treeIndeterminateRowMaps[childRowid]) {
|
|
6719
6955
|
hLen++;
|
|
6720
6956
|
}
|
|
6721
6957
|
}
|
|
6722
6958
|
} : item => {
|
|
6723
|
-
const childRowid = (
|
|
6724
|
-
const isSelect = checkField ? _xeUtils.default.get(item, checkField) :
|
|
6959
|
+
const childRowid = handleGetRowId(item);
|
|
6960
|
+
const isSelect = checkField ? _xeUtils.default.get(item, checkField) : selectCheckboxMaps[childRowid];
|
|
6725
6961
|
if (isSelect) {
|
|
6726
6962
|
sLen++;
|
|
6727
|
-
} else if (
|
|
6963
|
+
} else if (treeIndeterminateRowMaps[childRowid]) {
|
|
6728
6964
|
hLen++;
|
|
6729
6965
|
}
|
|
6730
6966
|
vLen++;
|
|
@@ -6736,29 +6972,28 @@ const Methods = {
|
|
|
6736
6972
|
}
|
|
6737
6973
|
if (isSelected) {
|
|
6738
6974
|
if (!checkField) {
|
|
6739
|
-
|
|
6975
|
+
selectCheckboxMaps[rowid] = row;
|
|
6740
6976
|
}
|
|
6741
|
-
if (
|
|
6742
|
-
delete
|
|
6977
|
+
if (treeIndeterminateRowMaps[rowid]) {
|
|
6978
|
+
delete treeIndeterminateRowMaps[rowid];
|
|
6743
6979
|
}
|
|
6744
6980
|
} else {
|
|
6745
6981
|
if (!checkField) {
|
|
6746
|
-
if (
|
|
6747
|
-
delete
|
|
6982
|
+
if (selectCheckboxMaps[rowid]) {
|
|
6983
|
+
delete selectCheckboxMaps[rowid];
|
|
6748
6984
|
}
|
|
6749
6985
|
}
|
|
6750
6986
|
if (halfSelect) {
|
|
6751
|
-
|
|
6987
|
+
treeIndeterminateRowMaps[rowid] = row;
|
|
6752
6988
|
} else {
|
|
6753
|
-
if (
|
|
6754
|
-
delete
|
|
6989
|
+
if (treeIndeterminateRowMaps[rowid]) {
|
|
6990
|
+
delete treeIndeterminateRowMaps[rowid];
|
|
6755
6991
|
}
|
|
6756
6992
|
}
|
|
6757
6993
|
}
|
|
6758
6994
|
});
|
|
6759
6995
|
}
|
|
6760
|
-
reactData.
|
|
6761
|
-
reactData.treeIndeterminateMaps = halfRowMaps;
|
|
6996
|
+
reactData.updateCheckboxFlag++;
|
|
6762
6997
|
},
|
|
6763
6998
|
updateAllCheckboxStatus() {
|
|
6764
6999
|
const $xeTable = this;
|
|
@@ -6769,9 +7004,12 @@ const Methods = {
|
|
|
6769
7004
|
treeConfig
|
|
6770
7005
|
} = props;
|
|
6771
7006
|
const {
|
|
7007
|
+
afterFullData,
|
|
7008
|
+
afterTreeFullData,
|
|
7009
|
+
checkboxReserveRowMap,
|
|
6772
7010
|
selectCheckboxMaps,
|
|
6773
|
-
|
|
6774
|
-
} =
|
|
7011
|
+
treeIndeterminateRowMaps
|
|
7012
|
+
} = internalData;
|
|
6775
7013
|
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
6776
7014
|
const {
|
|
6777
7015
|
checkField,
|
|
@@ -6779,39 +7017,37 @@ const Methods = {
|
|
|
6779
7017
|
showReserveStatus
|
|
6780
7018
|
} = checkboxOpts;
|
|
6781
7019
|
const {
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
checkboxReserveRowMap
|
|
6785
|
-
} = internalData;
|
|
7020
|
+
handleGetRowId
|
|
7021
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
6786
7022
|
let sLen = 0; // 已选
|
|
6787
7023
|
let hLen = 0; // 半选
|
|
6788
7024
|
let vLen = 0; // 有效行
|
|
6789
7025
|
const rootList = treeConfig ? afterTreeFullData : afterFullData;
|
|
6790
7026
|
rootList.forEach(checkMethod ? row => {
|
|
6791
|
-
const childRowid = (
|
|
7027
|
+
const childRowid = handleGetRowId(row);
|
|
6792
7028
|
const selected = checkField ? _xeUtils.default.get(row, checkField) : selectCheckboxMaps[childRowid];
|
|
6793
7029
|
if (checkMethod({
|
|
6794
7030
|
row
|
|
6795
7031
|
})) {
|
|
6796
7032
|
if (selected) {
|
|
6797
7033
|
sLen++;
|
|
6798
|
-
} else if (
|
|
7034
|
+
} else if (treeIndeterminateRowMaps[childRowid]) {
|
|
6799
7035
|
hLen++;
|
|
6800
7036
|
}
|
|
6801
7037
|
vLen++;
|
|
6802
7038
|
} else {
|
|
6803
7039
|
if (selected) {
|
|
6804
7040
|
sLen++;
|
|
6805
|
-
} else if (
|
|
7041
|
+
} else if (treeIndeterminateRowMaps[childRowid]) {
|
|
6806
7042
|
hLen++;
|
|
6807
7043
|
}
|
|
6808
7044
|
}
|
|
6809
7045
|
} : row => {
|
|
6810
|
-
const childRowid = (
|
|
7046
|
+
const childRowid = handleGetRowId(row);
|
|
6811
7047
|
const selected = checkField ? _xeUtils.default.get(row, checkField) : selectCheckboxMaps[childRowid];
|
|
6812
7048
|
if (selected) {
|
|
6813
7049
|
sLen++;
|
|
6814
|
-
} else if (
|
|
7050
|
+
} else if (treeIndeterminateRowMaps[childRowid]) {
|
|
6815
7051
|
hLen++;
|
|
6816
7052
|
}
|
|
6817
7053
|
vLen++;
|
|
@@ -6875,27 +7111,35 @@ const Methods = {
|
|
|
6875
7111
|
* 获取复选框保留选中的行
|
|
6876
7112
|
*/
|
|
6877
7113
|
getCheckboxReserveRecords(isFull) {
|
|
7114
|
+
const $xeTable = this;
|
|
7115
|
+
const props = $xeTable;
|
|
7116
|
+
const internalData = $xeTable;
|
|
7117
|
+
const {
|
|
7118
|
+
treeConfig
|
|
7119
|
+
} = props;
|
|
6878
7120
|
const {
|
|
6879
|
-
fullDataRowIdData,
|
|
6880
7121
|
afterFullData,
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
7122
|
+
fullDataRowIdData,
|
|
7123
|
+
checkboxReserveRowMap
|
|
7124
|
+
} = internalData;
|
|
7125
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
7126
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
6886
7127
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
6887
7128
|
const reserveSelection = [];
|
|
6888
7129
|
if (checkboxOpts.reserve) {
|
|
7130
|
+
const {
|
|
7131
|
+
handleGetRowId
|
|
7132
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
6889
7133
|
const afterFullIdMaps = {};
|
|
6890
7134
|
if (treeConfig) {
|
|
6891
7135
|
_xeUtils.default.eachTree(afterFullData, row => {
|
|
6892
|
-
afterFullIdMaps[(
|
|
7136
|
+
afterFullIdMaps[handleGetRowId(row)] = 1;
|
|
6893
7137
|
}, {
|
|
6894
7138
|
children: childrenField
|
|
6895
7139
|
});
|
|
6896
7140
|
} else {
|
|
6897
7141
|
afterFullData.forEach(row => {
|
|
6898
|
-
afterFullIdMaps[(
|
|
7142
|
+
afterFullIdMaps[handleGetRowId(row)] = 1;
|
|
6899
7143
|
});
|
|
6900
7144
|
}
|
|
6901
7145
|
_xeUtils.default.each(checkboxReserveRowMap, (oldRow, oldRowid) => {
|
|
@@ -6937,9 +7181,9 @@ const Methods = {
|
|
|
6937
7181
|
handleCheckedAllCheckboxRow($xeTable, value);
|
|
6938
7182
|
if (evnt) {
|
|
6939
7183
|
$xeTable.dispatchEvent('checkbox-all', {
|
|
6940
|
-
records: $xeTable.getCheckboxRecords(),
|
|
6941
|
-
reserves: $xeTable.getCheckboxReserveRecords(),
|
|
6942
|
-
indeterminates: $xeTable.getCheckboxIndeterminateRecords(),
|
|
7184
|
+
records: () => $xeTable.getCheckboxRecords(),
|
|
7185
|
+
reserves: () => $xeTable.getCheckboxReserveRecords(),
|
|
7186
|
+
indeterminates: () => $xeTable.getCheckboxIndeterminateRecords(),
|
|
6943
7187
|
checked: value
|
|
6944
7188
|
}, evnt);
|
|
6945
7189
|
}
|
|
@@ -6975,17 +7219,23 @@ const Methods = {
|
|
|
6975
7219
|
* 清空行为不管是否被禁用还是保留记录,都将彻底清空选中状态
|
|
6976
7220
|
*/
|
|
6977
7221
|
clearCheckboxRow() {
|
|
7222
|
+
const $xeTable = this;
|
|
7223
|
+
const props = $xeTable;
|
|
7224
|
+
const reactData = $xeTable;
|
|
7225
|
+
const internalData = $xeTable;
|
|
6978
7226
|
const {
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
} =
|
|
7227
|
+
treeConfig
|
|
7228
|
+
} = props;
|
|
7229
|
+
const {
|
|
7230
|
+
tableFullData
|
|
7231
|
+
} = internalData;
|
|
7232
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
7233
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
7234
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
6984
7235
|
const {
|
|
6985
7236
|
checkField,
|
|
6986
7237
|
reserve
|
|
6987
7238
|
} = checkboxOpts;
|
|
6988
|
-
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
6989
7239
|
// indeterminateField 仅支持读取
|
|
6990
7240
|
const indeterminateField = checkboxOpts.indeterminateField || checkboxOpts.halfField;
|
|
6991
7241
|
if (checkField) {
|
|
@@ -7006,37 +7256,13 @@ const Methods = {
|
|
|
7006
7256
|
if (reserve) {
|
|
7007
7257
|
tableFullData.forEach(row => this.handleCheckboxReserveRow(row, false));
|
|
7008
7258
|
}
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7259
|
+
reactData.isAllSelected = false;
|
|
7260
|
+
reactData.isIndeterminate = false;
|
|
7261
|
+
internalData.selectCheckboxMaps = {};
|
|
7262
|
+
internalData.treeIndeterminateRowMaps = {};
|
|
7263
|
+
reactData.updateCheckboxFlag++;
|
|
7013
7264
|
return this.$nextTick();
|
|
7014
7265
|
},
|
|
7015
|
-
/**
|
|
7016
|
-
* 处理单选框默认勾选
|
|
7017
|
-
*/
|
|
7018
|
-
handleDefaultRadioChecked() {
|
|
7019
|
-
const $xeTable = this;
|
|
7020
|
-
const {
|
|
7021
|
-
radioOpts,
|
|
7022
|
-
fullDataRowIdData
|
|
7023
|
-
} = this;
|
|
7024
|
-
const {
|
|
7025
|
-
checkRowKey: rowid,
|
|
7026
|
-
reserve
|
|
7027
|
-
} = radioOpts;
|
|
7028
|
-
if (rowid) {
|
|
7029
|
-
if (fullDataRowIdData[rowid]) {
|
|
7030
|
-
handleCheckedRadioRow($xeTable, fullDataRowIdData[rowid].row, true);
|
|
7031
|
-
}
|
|
7032
|
-
if (reserve) {
|
|
7033
|
-
const rowkey = (0, _util.getRowkey)(this);
|
|
7034
|
-
this.radioReserveRow = {
|
|
7035
|
-
[rowkey]: rowid
|
|
7036
|
-
};
|
|
7037
|
-
}
|
|
7038
|
-
}
|
|
7039
|
-
},
|
|
7040
7266
|
/**
|
|
7041
7267
|
* 单选,行选中事件
|
|
7042
7268
|
*/
|
|
@@ -7260,12 +7486,14 @@ const Methods = {
|
|
|
7260
7486
|
},
|
|
7261
7487
|
triggerHeaderCellClickEvent(evnt, params) {
|
|
7262
7488
|
const $xeTable = this;
|
|
7489
|
+
const props = $xeTable;
|
|
7263
7490
|
const internalData = $xeTable;
|
|
7264
7491
|
const {
|
|
7265
7492
|
_lastResizeTime
|
|
7266
7493
|
} = internalData;
|
|
7267
7494
|
const sortOpts = $xeTable.computeSortOpts;
|
|
7268
7495
|
const columnOpts = $xeTable.computeColumnOpts;
|
|
7496
|
+
const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
|
|
7269
7497
|
const {
|
|
7270
7498
|
column
|
|
7271
7499
|
} = params;
|
|
@@ -7282,7 +7510,7 @@ const Methods = {
|
|
|
7282
7510
|
triggerFilter,
|
|
7283
7511
|
cell
|
|
7284
7512
|
}, params), evnt);
|
|
7285
|
-
if (columnOpts.isCurrent ||
|
|
7513
|
+
if ((columnOpts.isCurrent || props.highlightCurrentColumn) && (!currentColumnOpts.trigger || ['header', 'default'].includes(currentColumnOpts.trigger))) {
|
|
7286
7514
|
$xeTable.triggerCurrentColumnEvent(evnt, params);
|
|
7287
7515
|
}
|
|
7288
7516
|
return $xeTable.$nextTick();
|
|
@@ -7300,13 +7528,25 @@ const Methods = {
|
|
|
7300
7528
|
* @param {ColumnInfo} fieldOrColumn 列配置
|
|
7301
7529
|
*/
|
|
7302
7530
|
setCurrentColumn(fieldOrColumn) {
|
|
7303
|
-
const
|
|
7531
|
+
const $xeTable = this;
|
|
7532
|
+
const props = $xeTable;
|
|
7533
|
+
const reactData = $xeTable;
|
|
7534
|
+
const {
|
|
7535
|
+
mouseConfig
|
|
7536
|
+
} = props;
|
|
7537
|
+
const mouseOpts = $xeTable.computeMouseOpts;
|
|
7538
|
+
const isMouseSelected = mouseConfig && mouseOpts.selected;
|
|
7539
|
+
const column = (0, _util.handleFieldOrColumn)($xeTable, fieldOrColumn);
|
|
7304
7540
|
if (column) {
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
this.currentColumn = column;
|
|
7541
|
+
$xeTable.clearCurrentColumn();
|
|
7542
|
+
reactData.currentColumn = column;
|
|
7308
7543
|
}
|
|
7309
|
-
return
|
|
7544
|
+
return $xeTable.$nextTick().then(() => {
|
|
7545
|
+
// 更新状选中态
|
|
7546
|
+
if (isMouseSelected) {
|
|
7547
|
+
$xeTable.addCellSelectedClass();
|
|
7548
|
+
}
|
|
7549
|
+
});
|
|
7310
7550
|
},
|
|
7311
7551
|
/**
|
|
7312
7552
|
* 用于当前列,手动清空当前高亮的状态
|
|
@@ -7315,21 +7555,6 @@ const Methods = {
|
|
|
7315
7555
|
this.currentColumn = null;
|
|
7316
7556
|
return this.$nextTick();
|
|
7317
7557
|
},
|
|
7318
|
-
checkValidate(type) {
|
|
7319
|
-
if (this.triggerValidate) {
|
|
7320
|
-
return this.triggerValidate(type);
|
|
7321
|
-
}
|
|
7322
|
-
return this.$nextTick();
|
|
7323
|
-
},
|
|
7324
|
-
/**
|
|
7325
|
-
* 当单元格发生改变时
|
|
7326
|
-
* 如果存在规则,则校验
|
|
7327
|
-
*/
|
|
7328
|
-
handleChangeCell(evnt, params) {
|
|
7329
|
-
this.checkValidate('blur').catch(e => e).then(() => {
|
|
7330
|
-
this.handleEdit(params, evnt).then(() => this.checkValidate('change')).catch(e => e);
|
|
7331
|
-
});
|
|
7332
|
-
},
|
|
7333
7558
|
/**
|
|
7334
7559
|
* 列点击事件
|
|
7335
7560
|
* 如果是单击模式,则激活为编辑状态
|
|
@@ -7341,6 +7566,7 @@ const Methods = {
|
|
|
7341
7566
|
const reactData = $xeTable;
|
|
7342
7567
|
const {
|
|
7343
7568
|
highlightCurrentRow,
|
|
7569
|
+
highlightCurrentColumn,
|
|
7344
7570
|
editConfig
|
|
7345
7571
|
} = props;
|
|
7346
7572
|
const {
|
|
@@ -7357,6 +7583,8 @@ const Methods = {
|
|
|
7357
7583
|
const checkboxOpts = $xeTable.computeCheckboxOpts;
|
|
7358
7584
|
const keyboardOpts = $xeTable.computeKeyboardOpts;
|
|
7359
7585
|
const rowOpts = $xeTable.computeRowOpts;
|
|
7586
|
+
const columnOpts = $xeTable.computeColumnOpts;
|
|
7587
|
+
const currentColumnOpts = $xeTable.computeCurrentColumnOpts;
|
|
7360
7588
|
const {
|
|
7361
7589
|
actived,
|
|
7362
7590
|
focused
|
|
@@ -7387,11 +7615,11 @@ const Methods = {
|
|
|
7387
7615
|
if (!triggerCheckbox && !triggerRadio) {
|
|
7388
7616
|
// 如果是展开行
|
|
7389
7617
|
if (!triggerExpandNode && (expandOpts.trigger === 'row' || isExpandType && expandOpts.trigger === 'cell')) {
|
|
7390
|
-
|
|
7618
|
+
$xeTable.triggerRowExpandEvent(evnt, params);
|
|
7391
7619
|
}
|
|
7392
7620
|
// 如果是树形表格
|
|
7393
7621
|
if (treeOpts.trigger === 'row' || treeNode && treeOpts.trigger === 'cell') {
|
|
7394
|
-
|
|
7622
|
+
$xeTable.triggerTreeExpandEvent(evnt, params);
|
|
7395
7623
|
}
|
|
7396
7624
|
}
|
|
7397
7625
|
// 如果点击了树节点
|
|
@@ -7400,16 +7628,22 @@ const Methods = {
|
|
|
7400
7628
|
// 如果是高亮行
|
|
7401
7629
|
if (rowOpts.isCurrent || highlightCurrentRow) {
|
|
7402
7630
|
if (!triggerCheckbox && !triggerRadio) {
|
|
7403
|
-
|
|
7631
|
+
$xeTable.triggerCurrentRowEvent(evnt, params);
|
|
7632
|
+
}
|
|
7633
|
+
}
|
|
7634
|
+
// 如果是当前列
|
|
7635
|
+
if ((columnOpts.isCurrent || highlightCurrentColumn) && (!currentColumnOpts.trigger || ['cell', 'default'].includes(currentColumnOpts.trigger))) {
|
|
7636
|
+
if (!triggerCheckbox && !triggerRadio) {
|
|
7637
|
+
$xeTable.triggerCurrentColumnEvent(evnt, params);
|
|
7404
7638
|
}
|
|
7405
7639
|
}
|
|
7406
7640
|
// 如果是单选框
|
|
7407
7641
|
if (!triggerRadio && (radioOpts.trigger === 'row' || isRadioType && radioOpts.trigger === 'cell')) {
|
|
7408
|
-
|
|
7642
|
+
$xeTable.triggerRadioRowEvent(evnt, params);
|
|
7409
7643
|
}
|
|
7410
7644
|
// 如果是复选框
|
|
7411
7645
|
if (!triggerCheckbox && (checkboxOpts.trigger === 'row' || isCheckboxType && checkboxOpts.trigger === 'cell')) {
|
|
7412
|
-
|
|
7646
|
+
$xeTable.handleToggleCheckRowEvent(evnt, params);
|
|
7413
7647
|
}
|
|
7414
7648
|
}
|
|
7415
7649
|
// 如果设置了单元格选中功能,则不会使用点击事件去处理(只能支持双击模式)
|
|
@@ -7421,14 +7655,14 @@ const Methods = {
|
|
|
7421
7655
|
}
|
|
7422
7656
|
if (editOpts.trigger === 'manual') {
|
|
7423
7657
|
if (actived.args && actived.row === row && column !== actived.column) {
|
|
7424
|
-
|
|
7658
|
+
handleChangeCell($xeTable, evnt, params);
|
|
7425
7659
|
}
|
|
7426
7660
|
} else if (!actived.args || row !== actived.row || column !== actived.column) {
|
|
7427
7661
|
if (editOpts.trigger === 'click') {
|
|
7428
|
-
|
|
7662
|
+
handleChangeCell($xeTable, evnt, params);
|
|
7429
7663
|
} else if (editOpts.trigger === 'dblclick') {
|
|
7430
7664
|
if (editOpts.mode === 'row' && actived.row === row) {
|
|
7431
|
-
|
|
7665
|
+
handleChangeCell($xeTable, evnt, params);
|
|
7432
7666
|
}
|
|
7433
7667
|
}
|
|
7434
7668
|
}
|
|
@@ -7448,7 +7682,7 @@ const Methods = {
|
|
|
7448
7682
|
}
|
|
7449
7683
|
}
|
|
7450
7684
|
}
|
|
7451
|
-
|
|
7685
|
+
$xeTable.dispatchEvent('cell-click', params, evnt);
|
|
7452
7686
|
},
|
|
7453
7687
|
/**
|
|
7454
7688
|
* 列双击点击事件
|
|
@@ -7479,49 +7713,16 @@ const Methods = {
|
|
|
7479
7713
|
if ((0, _utils.isEnableConf)(editConfig) && editOpts.trigger === 'dblclick') {
|
|
7480
7714
|
if (!actived.args || evnt.currentTarget !== actived.args.cell) {
|
|
7481
7715
|
if (editOpts.mode === 'row') {
|
|
7482
|
-
|
|
7483
|
-
this.handleEdit(params, evnt).then(() =>
|
|
7716
|
+
checkValidate($xeTable, 'blur').catch(e => e).then(() => {
|
|
7717
|
+
this.handleEdit(params, evnt).then(() => checkValidate($xeTable, 'change')).catch(e => e);
|
|
7484
7718
|
});
|
|
7485
7719
|
} else if (editOpts.mode === 'cell') {
|
|
7486
|
-
this.handleEdit(params, evnt).then(() =>
|
|
7720
|
+
this.handleEdit(params, evnt).then(() => checkValidate($xeTable, 'change')).catch(e => e);
|
|
7487
7721
|
}
|
|
7488
7722
|
}
|
|
7489
7723
|
}
|
|
7490
7724
|
this.emitEvent('cell-dblclick', params, evnt);
|
|
7491
7725
|
},
|
|
7492
|
-
handleDefaultSort() {
|
|
7493
|
-
const $xeTable = this;
|
|
7494
|
-
const {
|
|
7495
|
-
sortConfig,
|
|
7496
|
-
sortOpts
|
|
7497
|
-
} = this;
|
|
7498
|
-
let {
|
|
7499
|
-
defaultSort
|
|
7500
|
-
} = sortOpts;
|
|
7501
|
-
if (defaultSort) {
|
|
7502
|
-
if (!_xeUtils.default.isArray(defaultSort)) {
|
|
7503
|
-
defaultSort = [defaultSort];
|
|
7504
|
-
}
|
|
7505
|
-
if (defaultSort.length) {
|
|
7506
|
-
(sortConfig.multiple ? defaultSort : defaultSort.slice(0, 1)).forEach((item, index) => {
|
|
7507
|
-
const {
|
|
7508
|
-
field,
|
|
7509
|
-
order
|
|
7510
|
-
} = item;
|
|
7511
|
-
if (field && order) {
|
|
7512
|
-
const column = this.getColumnByField(field);
|
|
7513
|
-
if (column && column.sortable) {
|
|
7514
|
-
column.order = order;
|
|
7515
|
-
column.sortTime = Date.now() + index;
|
|
7516
|
-
}
|
|
7517
|
-
}
|
|
7518
|
-
});
|
|
7519
|
-
if (!sortOpts.remote) {
|
|
7520
|
-
this.handleTableData(true).then(() => updateStyle($xeTable));
|
|
7521
|
-
}
|
|
7522
|
-
}
|
|
7523
|
-
}
|
|
7524
|
-
},
|
|
7525
7726
|
handleColumnSortEvent(evnt, column) {
|
|
7526
7727
|
const $xeTable = this;
|
|
7527
7728
|
const props = $xeTable;
|
|
@@ -7735,6 +7936,8 @@ const Methods = {
|
|
|
7735
7936
|
} = props;
|
|
7736
7937
|
const rowDragOpts = $xeTable.computeRowDragOpts;
|
|
7737
7938
|
const {
|
|
7939
|
+
afterFullData,
|
|
7940
|
+
tableFullData,
|
|
7738
7941
|
fullAllDataRowIdData
|
|
7739
7942
|
} = internalData;
|
|
7740
7943
|
const {
|
|
@@ -7752,10 +7955,6 @@ const Methods = {
|
|
|
7752
7955
|
parentField
|
|
7753
7956
|
} = treeOpts;
|
|
7754
7957
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
7755
|
-
const {
|
|
7756
|
-
afterFullData,
|
|
7757
|
-
tableFullData
|
|
7758
|
-
} = internalData;
|
|
7759
7958
|
const dEndMethod = dragEndMethod || (dragConfig ? dragConfig.dragEndMethod : null);
|
|
7760
7959
|
const dragOffsetIndex = prevDragPos === 'bottom' ? 1 : 0;
|
|
7761
7960
|
const errRest = {
|
|
@@ -8423,46 +8622,58 @@ const Methods = {
|
|
|
8423
8622
|
setPendingRow(rows, status) {
|
|
8424
8623
|
const $xeTable = this;
|
|
8425
8624
|
const reactData = $xeTable;
|
|
8426
|
-
const
|
|
8625
|
+
const internalData = $xeTable;
|
|
8626
|
+
const {
|
|
8627
|
+
handleGetRowId
|
|
8628
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
8629
|
+
const {
|
|
8630
|
+
pendingRowMaps
|
|
8631
|
+
} = internalData;
|
|
8427
8632
|
if (rows && !_xeUtils.default.isArray(rows)) {
|
|
8428
8633
|
rows = [rows];
|
|
8429
8634
|
}
|
|
8430
8635
|
if (status) {
|
|
8431
8636
|
rows.forEach(row => {
|
|
8432
|
-
const rowid = (
|
|
8433
|
-
if (rowid && !
|
|
8434
|
-
|
|
8637
|
+
const rowid = handleGetRowId(row);
|
|
8638
|
+
if (rowid && !pendingRowMaps[rowid]) {
|
|
8639
|
+
pendingRowMaps[rowid] = row;
|
|
8435
8640
|
}
|
|
8436
8641
|
});
|
|
8437
8642
|
} else {
|
|
8438
8643
|
rows.forEach(row => {
|
|
8439
|
-
const rowid = (
|
|
8440
|
-
if (rowid &&
|
|
8441
|
-
delete
|
|
8644
|
+
const rowid = handleGetRowId(row);
|
|
8645
|
+
if (rowid && pendingRowMaps[rowid]) {
|
|
8646
|
+
delete pendingRowMaps[rowid];
|
|
8442
8647
|
}
|
|
8443
8648
|
});
|
|
8444
8649
|
}
|
|
8445
|
-
reactData.
|
|
8650
|
+
reactData.pendingRowFlag++;
|
|
8446
8651
|
return $xeTable.$nextTick();
|
|
8447
8652
|
},
|
|
8448
8653
|
togglePendingRow(rows) {
|
|
8449
8654
|
const $xeTable = this;
|
|
8450
8655
|
const reactData = $xeTable;
|
|
8451
|
-
const
|
|
8656
|
+
const internalData = $xeTable;
|
|
8657
|
+
const {
|
|
8658
|
+
handleGetRowId
|
|
8659
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
8660
|
+
const {
|
|
8661
|
+
pendingRowMaps
|
|
8662
|
+
} = internalData;
|
|
8452
8663
|
if (rows && !_xeUtils.default.isArray(rows)) {
|
|
8453
8664
|
rows = [rows];
|
|
8454
8665
|
}
|
|
8455
8666
|
rows.forEach(row => {
|
|
8456
|
-
const rowid = (
|
|
8667
|
+
const rowid = handleGetRowId(row);
|
|
8457
8668
|
if (rowid) {
|
|
8458
|
-
if (
|
|
8459
|
-
delete
|
|
8669
|
+
if (pendingRowMaps[rowid]) {
|
|
8670
|
+
delete pendingRowMaps[rowid];
|
|
8460
8671
|
} else {
|
|
8461
|
-
|
|
8672
|
+
pendingRowMaps[rowid] = row;
|
|
8462
8673
|
}
|
|
8463
8674
|
}
|
|
8464
8675
|
});
|
|
8465
|
-
reactData.
|
|
8676
|
+
reactData.pendingRowFlag++;
|
|
8466
8677
|
return $xeTable.$nextTick();
|
|
8467
8678
|
},
|
|
8468
8679
|
hasPendingByRow(row) {
|
|
@@ -8480,13 +8691,10 @@ const Methods = {
|
|
|
8480
8691
|
},
|
|
8481
8692
|
getPendingRecords() {
|
|
8482
8693
|
const $xeTable = this;
|
|
8483
|
-
const reactData = $xeTable;
|
|
8484
8694
|
const internalData = $xeTable;
|
|
8485
8695
|
const {
|
|
8696
|
+
fullAllDataRowIdData,
|
|
8486
8697
|
pendingRowMaps
|
|
8487
|
-
} = reactData;
|
|
8488
|
-
const {
|
|
8489
|
-
fullAllDataRowIdData
|
|
8490
8698
|
} = internalData;
|
|
8491
8699
|
const insertRecords = [];
|
|
8492
8700
|
_xeUtils.default.each(pendingRowMaps, (row, rowid) => {
|
|
@@ -8497,8 +8705,12 @@ const Methods = {
|
|
|
8497
8705
|
return insertRecords;
|
|
8498
8706
|
},
|
|
8499
8707
|
clearPendingRow() {
|
|
8500
|
-
|
|
8501
|
-
|
|
8708
|
+
const $xeTable = this;
|
|
8709
|
+
const reactData = $xeTable;
|
|
8710
|
+
const internalData = $xeTable;
|
|
8711
|
+
internalData.pendingRowMaps = {};
|
|
8712
|
+
reactData.pendingRowFlag++;
|
|
8713
|
+
return $xeTable.$nextTick();
|
|
8502
8714
|
},
|
|
8503
8715
|
sort(sortConfs, sortOrder) {
|
|
8504
8716
|
const $xeTable = this;
|
|
@@ -8679,9 +8891,11 @@ const Methods = {
|
|
|
8679
8891
|
* @param {Event} evnt 事件
|
|
8680
8892
|
*/
|
|
8681
8893
|
closeFilter() {
|
|
8894
|
+
const $xeTable = this;
|
|
8895
|
+
const reactData = $xeTable;
|
|
8682
8896
|
const {
|
|
8683
8897
|
filterStore
|
|
8684
|
-
} =
|
|
8898
|
+
} = reactData;
|
|
8685
8899
|
const {
|
|
8686
8900
|
column,
|
|
8687
8901
|
visible
|
|
@@ -8693,15 +8907,15 @@ const Methods = {
|
|
|
8693
8907
|
visible: false
|
|
8694
8908
|
});
|
|
8695
8909
|
if (visible) {
|
|
8696
|
-
|
|
8910
|
+
$xeTable.dispatchEvent('filter-visible', {
|
|
8697
8911
|
column,
|
|
8698
8912
|
field: column.field,
|
|
8699
8913
|
property: column.field,
|
|
8700
|
-
filterList:
|
|
8914
|
+
filterList: () => $xeTable.getCheckedFilters(),
|
|
8701
8915
|
visible: false
|
|
8702
8916
|
}, null);
|
|
8703
8917
|
}
|
|
8704
|
-
return
|
|
8918
|
+
return $xeTable.$nextTick();
|
|
8705
8919
|
},
|
|
8706
8920
|
/**
|
|
8707
8921
|
* 判断指定列是否为筛选状态,如果为空则判断所有列
|
|
@@ -8734,9 +8948,9 @@ const Methods = {
|
|
|
8734
8948
|
const $xeTable = this;
|
|
8735
8949
|
const reactData = $xeTable;
|
|
8736
8950
|
const internalData = $xeTable;
|
|
8737
|
-
const rExpandLazyLoadedMaps = Object.assign({}, reactData.rowExpandLazyLoadedMaps);
|
|
8738
8951
|
const {
|
|
8739
|
-
fullAllDataRowIdData
|
|
8952
|
+
fullAllDataRowIdData,
|
|
8953
|
+
rowExpandLazyLoadedMaps
|
|
8740
8954
|
} = internalData;
|
|
8741
8955
|
const expandOpts = $xeTable.computeExpandOpts;
|
|
8742
8956
|
const {
|
|
@@ -8746,9 +8960,9 @@ const Methods = {
|
|
|
8746
8960
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
8747
8961
|
if (lazy && rowRest) {
|
|
8748
8962
|
rowRest.expandLoaded = false;
|
|
8749
|
-
delete
|
|
8963
|
+
delete rowExpandLazyLoadedMaps[rowid];
|
|
8750
8964
|
}
|
|
8751
|
-
reactData.
|
|
8965
|
+
reactData.rowExpandedFlag++;
|
|
8752
8966
|
return $xeTable.$nextTick();
|
|
8753
8967
|
},
|
|
8754
8968
|
/**
|
|
@@ -8756,18 +8970,20 @@ const Methods = {
|
|
|
8756
8970
|
* @param {Row} row 行对象
|
|
8757
8971
|
*/
|
|
8758
8972
|
reloadRowExpand(row) {
|
|
8973
|
+
const $xeTable = this;
|
|
8974
|
+
const internalData = $xeTable;
|
|
8759
8975
|
const {
|
|
8760
|
-
expandOpts,
|
|
8761
8976
|
rowExpandLazyLoadedMaps
|
|
8762
|
-
} =
|
|
8977
|
+
} = internalData;
|
|
8978
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
8763
8979
|
const {
|
|
8764
8980
|
lazy
|
|
8765
8981
|
} = expandOpts;
|
|
8766
8982
|
const rowid = (0, _util.getRowid)(this, row);
|
|
8767
8983
|
if (lazy && !rowExpandLazyLoadedMaps[rowid]) {
|
|
8768
|
-
|
|
8984
|
+
$xeTable.clearRowExpandLoaded(row).then(() => handleAsyncRowExpand($xeTable, row));
|
|
8769
8985
|
}
|
|
8770
|
-
return
|
|
8986
|
+
return $xeTable.$nextTick();
|
|
8771
8987
|
},
|
|
8772
8988
|
reloadExpandContent(row) {
|
|
8773
8989
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -8780,11 +8996,16 @@ const Methods = {
|
|
|
8780
8996
|
* 展开行事件
|
|
8781
8997
|
*/
|
|
8782
8998
|
triggerRowExpandEvent(evnt, params) {
|
|
8999
|
+
const $xeTable = this;
|
|
9000
|
+
const reactData = $xeTable;
|
|
9001
|
+
const internalData = $xeTable;
|
|
8783
9002
|
const {
|
|
8784
|
-
expandOpts,
|
|
8785
|
-
rowExpandLazyLoadedMaps,
|
|
8786
9003
|
expandColumn: column
|
|
8787
|
-
} =
|
|
9004
|
+
} = reactData;
|
|
9005
|
+
const {
|
|
9006
|
+
rowExpandLazyLoadedMaps
|
|
9007
|
+
} = internalData;
|
|
9008
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
8788
9009
|
const {
|
|
8789
9010
|
row
|
|
8790
9011
|
} = params;
|
|
@@ -8796,20 +9017,20 @@ const Methods = {
|
|
|
8796
9017
|
return;
|
|
8797
9018
|
}
|
|
8798
9019
|
evnt.stopPropagation();
|
|
8799
|
-
const rowid = (0, _util.getRowid)(
|
|
9020
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
8800
9021
|
if (!lazy || !rowExpandLazyLoadedMaps[rowid]) {
|
|
8801
|
-
const expanded =
|
|
8802
|
-
const columnIndex =
|
|
8803
|
-
const $columnIndex =
|
|
8804
|
-
|
|
8805
|
-
|
|
9022
|
+
const expanded = !$xeTable.isRowExpandByRow(row);
|
|
9023
|
+
const columnIndex = $xeTable.getColumnIndex(column);
|
|
9024
|
+
const $columnIndex = $xeTable.getVMColumnIndex(column);
|
|
9025
|
+
$xeTable.setRowExpand(row, expanded);
|
|
9026
|
+
$xeTable.dispatchEvent('toggle-row-expand', {
|
|
8806
9027
|
expanded,
|
|
8807
9028
|
column,
|
|
8808
9029
|
columnIndex,
|
|
8809
9030
|
$columnIndex,
|
|
8810
9031
|
row,
|
|
8811
|
-
rowIndex:
|
|
8812
|
-
$rowIndex:
|
|
9032
|
+
rowIndex: $xeTable.getRowIndex(row),
|
|
9033
|
+
$rowIndex: $xeTable.getVMRowIndex(row)
|
|
8813
9034
|
}, evnt);
|
|
8814
9035
|
}
|
|
8815
9036
|
},
|
|
@@ -8819,30 +9040,6 @@ const Methods = {
|
|
|
8819
9040
|
toggleRowExpand(row) {
|
|
8820
9041
|
return this.setRowExpand(row, !this.isRowExpandByRow(row));
|
|
8821
9042
|
},
|
|
8822
|
-
/**
|
|
8823
|
-
* 处理默认展开行
|
|
8824
|
-
*/
|
|
8825
|
-
handleDefaultRowExpand() {
|
|
8826
|
-
const {
|
|
8827
|
-
expandOpts,
|
|
8828
|
-
fullDataRowIdData
|
|
8829
|
-
} = this;
|
|
8830
|
-
const {
|
|
8831
|
-
expandAll,
|
|
8832
|
-
expandRowKeys
|
|
8833
|
-
} = expandOpts;
|
|
8834
|
-
if (expandAll) {
|
|
8835
|
-
this.setAllRowExpand(true);
|
|
8836
|
-
} else if (expandRowKeys) {
|
|
8837
|
-
const defExpandeds = [];
|
|
8838
|
-
expandRowKeys.forEach(rowid => {
|
|
8839
|
-
if (fullDataRowIdData[rowid]) {
|
|
8840
|
-
defExpandeds.push(fullDataRowIdData[rowid].row);
|
|
8841
|
-
}
|
|
8842
|
-
});
|
|
8843
|
-
this.setRowExpand(defExpandeds, true);
|
|
8844
|
-
}
|
|
8845
|
-
},
|
|
8846
9043
|
/**
|
|
8847
9044
|
* 设置所有行的展开与否
|
|
8848
9045
|
* @param {Boolean} expanded 是否展开
|
|
@@ -8867,55 +9064,6 @@ const Methods = {
|
|
|
8867
9064
|
}
|
|
8868
9065
|
return this.setRowExpand(expandedRows, expanded);
|
|
8869
9066
|
},
|
|
8870
|
-
handleAsyncRowExpand(row) {
|
|
8871
|
-
const $xeTable = this;
|
|
8872
|
-
const reactData = $xeTable;
|
|
8873
|
-
const internalData = $xeTable;
|
|
8874
|
-
return new Promise(resolve => {
|
|
8875
|
-
const {
|
|
8876
|
-
expandOpts
|
|
8877
|
-
} = this;
|
|
8878
|
-
const {
|
|
8879
|
-
loadMethod
|
|
8880
|
-
} = expandOpts;
|
|
8881
|
-
if (loadMethod) {
|
|
8882
|
-
const {
|
|
8883
|
-
fullAllDataRowIdData
|
|
8884
|
-
} = internalData;
|
|
8885
|
-
const rExpandLazyLoadedMaps = Object.assign({}, reactData.rowExpandLazyLoadedMaps);
|
|
8886
|
-
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
8887
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
8888
|
-
rExpandLazyLoadedMaps[rowid] = row;
|
|
8889
|
-
reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps;
|
|
8890
|
-
loadMethod({
|
|
8891
|
-
$table: $xeTable,
|
|
8892
|
-
row,
|
|
8893
|
-
rowIndex: $xeTable.getRowIndex(row),
|
|
8894
|
-
$rowIndex: $xeTable.getVMRowIndex(row)
|
|
8895
|
-
}).then(() => {
|
|
8896
|
-
const rExpandedMaps = Object.assign({}, reactData.rowExpandedMaps);
|
|
8897
|
-
if (rowRest) {
|
|
8898
|
-
rowRest.expandLoaded = true;
|
|
8899
|
-
}
|
|
8900
|
-
rExpandedMaps[rowid] = row;
|
|
8901
|
-
reactData.rowExpandedMaps = rExpandedMaps;
|
|
8902
|
-
}).catch(() => {
|
|
8903
|
-
if (rowRest) {
|
|
8904
|
-
rowRest.expandLoaded = false;
|
|
8905
|
-
}
|
|
8906
|
-
}).finally(() => {
|
|
8907
|
-
const rExpandLazyLoadedMaps = Object.assign({}, reactData.rowExpandLazyLoadedMaps);
|
|
8908
|
-
if (rExpandLazyLoadedMaps[rowid]) {
|
|
8909
|
-
delete rExpandLazyLoadedMaps[rowid];
|
|
8910
|
-
}
|
|
8911
|
-
reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps;
|
|
8912
|
-
$xeTable.$nextTick().then(() => $xeTable.recalculate()).then(() => $xeTable.updateCellAreas()).then(() => resolve());
|
|
8913
|
-
});
|
|
8914
|
-
} else {
|
|
8915
|
-
resolve();
|
|
8916
|
-
}
|
|
8917
|
-
});
|
|
8918
|
-
},
|
|
8919
9067
|
/**
|
|
8920
9068
|
* 设置展开行,二个参数设置这一行展开与否
|
|
8921
9069
|
* 支持单行
|
|
@@ -8925,14 +9073,20 @@ const Methods = {
|
|
|
8925
9073
|
*/
|
|
8926
9074
|
setRowExpand(rows, expanded) {
|
|
8927
9075
|
const $xeTable = this;
|
|
9076
|
+
const reactData = $xeTable;
|
|
9077
|
+
const internalData = $xeTable;
|
|
8928
9078
|
const {
|
|
8929
|
-
rowExpandedMaps,
|
|
8930
|
-
fullAllDataRowIdData,
|
|
8931
|
-
rowExpandLazyLoadedMaps,
|
|
8932
|
-
expandOpts,
|
|
8933
9079
|
expandColumn
|
|
8934
|
-
} =
|
|
8935
|
-
let
|
|
9080
|
+
} = reactData;
|
|
9081
|
+
let {
|
|
9082
|
+
fullAllDataRowIdData,
|
|
9083
|
+
rowExpandedMaps,
|
|
9084
|
+
rowExpandLazyLoadedMaps
|
|
9085
|
+
} = internalData;
|
|
9086
|
+
const {
|
|
9087
|
+
handleGetRowId
|
|
9088
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
9089
|
+
const expandOpts = $xeTable.computeExpandOpts;
|
|
8936
9090
|
const {
|
|
8937
9091
|
reserve,
|
|
8938
9092
|
lazy,
|
|
@@ -8948,10 +9102,12 @@ const Methods = {
|
|
|
8948
9102
|
}
|
|
8949
9103
|
if (accordion) {
|
|
8950
9104
|
// 只能同时展开一个
|
|
8951
|
-
|
|
9105
|
+
rowExpandedMaps = {};
|
|
9106
|
+
internalData.rowExpandedMaps = rowExpandedMaps;
|
|
8952
9107
|
rows = rows.slice(rows.length - 1, rows.length);
|
|
8953
9108
|
}
|
|
8954
9109
|
const validRows = toggleMethod ? rows.filter(row => toggleMethod({
|
|
9110
|
+
$table: $xeTable,
|
|
8955
9111
|
expanded,
|
|
8956
9112
|
column: expandColumn,
|
|
8957
9113
|
columnIndex,
|
|
@@ -8962,22 +9118,22 @@ const Methods = {
|
|
|
8962
9118
|
})) : rows;
|
|
8963
9119
|
if (expanded) {
|
|
8964
9120
|
validRows.forEach(row => {
|
|
8965
|
-
const rowid = (
|
|
8966
|
-
if (!
|
|
9121
|
+
const rowid = handleGetRowId(row);
|
|
9122
|
+
if (!rowExpandedMaps[rowid]) {
|
|
8967
9123
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
8968
9124
|
const isLoad = lazy && !rowRest.expandLoaded && !rowExpandLazyLoadedMaps[rowid];
|
|
8969
9125
|
if (isLoad) {
|
|
8970
|
-
lazyRests.push(
|
|
9126
|
+
lazyRests.push(handleAsyncRowExpand($xeTable, row));
|
|
8971
9127
|
} else {
|
|
8972
|
-
|
|
9128
|
+
rowExpandedMaps[rowid] = row;
|
|
8973
9129
|
}
|
|
8974
9130
|
}
|
|
8975
9131
|
});
|
|
8976
9132
|
} else {
|
|
8977
9133
|
validRows.forEach(item => {
|
|
8978
|
-
const rowid = (
|
|
8979
|
-
if (
|
|
8980
|
-
delete
|
|
9134
|
+
const rowid = handleGetRowId(item);
|
|
9135
|
+
if (rowExpandedMaps[rowid]) {
|
|
9136
|
+
delete rowExpandedMaps[rowid];
|
|
8981
9137
|
}
|
|
8982
9138
|
});
|
|
8983
9139
|
}
|
|
@@ -8985,7 +9141,7 @@ const Methods = {
|
|
|
8985
9141
|
validRows.forEach(row => handleRowExpandReserve($xeTable, row, expanded));
|
|
8986
9142
|
}
|
|
8987
9143
|
}
|
|
8988
|
-
|
|
9144
|
+
reactData.rowExpandedFlag++;
|
|
8989
9145
|
return Promise.all(lazyRests).then(() => $xeTable.$nextTick()).then(() => $xeTable.recalculate(true)).then(() => {
|
|
8990
9146
|
updateRowOffsetTop($xeTable);
|
|
8991
9147
|
updateRowExpandStyle($xeTable);
|
|
@@ -8998,11 +9154,17 @@ const Methods = {
|
|
|
8998
9154
|
* @param {Row} row 行对象
|
|
8999
9155
|
*/
|
|
9000
9156
|
isRowExpandByRow(row) {
|
|
9157
|
+
const $xeTable = this;
|
|
9158
|
+
const reactData = $xeTable;
|
|
9159
|
+
const internalData = $xeTable;
|
|
9160
|
+
const {
|
|
9161
|
+
rowExpandedFlag
|
|
9162
|
+
} = reactData;
|
|
9001
9163
|
const {
|
|
9002
9164
|
rowExpandedMaps
|
|
9003
|
-
} =
|
|
9165
|
+
} = internalData;
|
|
9004
9166
|
const rowid = (0, _util.getRowid)(this, row);
|
|
9005
|
-
return !!rowExpandedMaps[rowid];
|
|
9167
|
+
return !!rowExpandedFlag && !!rowExpandedMaps[rowid];
|
|
9006
9168
|
},
|
|
9007
9169
|
isExpandByRow(row) {
|
|
9008
9170
|
if (process.env.NODE_ENV === 'development') {
|
|
@@ -9026,7 +9188,8 @@ const Methods = {
|
|
|
9026
9188
|
reserve
|
|
9027
9189
|
} = expandOpts;
|
|
9028
9190
|
const expList = $xeTable.getRowExpandRecords();
|
|
9029
|
-
|
|
9191
|
+
internalData.rowExpandedMaps = {};
|
|
9192
|
+
reactData.rowExpandedFlag++;
|
|
9030
9193
|
if (reserve) {
|
|
9031
9194
|
tableFullData.forEach(row => handleRowExpandReserve($xeTable, row, false));
|
|
9032
9195
|
}
|
|
@@ -9046,8 +9209,10 @@ const Methods = {
|
|
|
9046
9209
|
return this.$nextTick();
|
|
9047
9210
|
},
|
|
9048
9211
|
getRowExpandRecords() {
|
|
9212
|
+
const $xeTable = this;
|
|
9213
|
+
const internalData = $xeTable;
|
|
9049
9214
|
const rest = [];
|
|
9050
|
-
_xeUtils.default.each(
|
|
9215
|
+
_xeUtils.default.each(internalData.rowExpandedMaps, item => {
|
|
9051
9216
|
if (item) {
|
|
9052
9217
|
rest.push(item);
|
|
9053
9218
|
}
|
|
@@ -9055,8 +9220,10 @@ const Methods = {
|
|
|
9055
9220
|
return rest;
|
|
9056
9221
|
},
|
|
9057
9222
|
getTreeExpandRecords() {
|
|
9223
|
+
const $xeTable = this;
|
|
9224
|
+
const internalData = $xeTable;
|
|
9058
9225
|
const rest = [];
|
|
9059
|
-
_xeUtils.default.each(
|
|
9226
|
+
_xeUtils.default.each(internalData.treeExpandedMaps, item => {
|
|
9060
9227
|
if (item) {
|
|
9061
9228
|
rest.push(item);
|
|
9062
9229
|
}
|
|
@@ -9092,15 +9259,14 @@ const Methods = {
|
|
|
9092
9259
|
const reactData = $xeTable;
|
|
9093
9260
|
const internalData = $xeTable;
|
|
9094
9261
|
const {
|
|
9095
|
-
fullAllDataRowIdData
|
|
9262
|
+
fullAllDataRowIdData,
|
|
9263
|
+
treeExpandedMaps
|
|
9096
9264
|
} = internalData;
|
|
9097
9265
|
const treeOpts = $xeTable.computeTreeOpts;
|
|
9098
9266
|
const {
|
|
9099
9267
|
transform
|
|
9100
9268
|
} = treeOpts;
|
|
9101
|
-
let tExpandedMaps = {};
|
|
9102
9269
|
if (rows) {
|
|
9103
|
-
tExpandedMaps = Object.assign({}, reactData.treeExpandedMaps);
|
|
9104
9270
|
if (!_xeUtils.default.isArray(rows)) {
|
|
9105
9271
|
rows = [rows];
|
|
9106
9272
|
}
|
|
@@ -9109,8 +9275,8 @@ const Methods = {
|
|
|
9109
9275
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
9110
9276
|
if (rowRest) {
|
|
9111
9277
|
rowRest.treeLoaded = false;
|
|
9112
|
-
if (
|
|
9113
|
-
delete
|
|
9278
|
+
if (treeExpandedMaps[rowid]) {
|
|
9279
|
+
delete treeExpandedMaps[rowid];
|
|
9114
9280
|
}
|
|
9115
9281
|
}
|
|
9116
9282
|
});
|
|
@@ -9119,7 +9285,8 @@ const Methods = {
|
|
|
9119
9285
|
rowRest.treeLoaded = false;
|
|
9120
9286
|
});
|
|
9121
9287
|
}
|
|
9122
|
-
|
|
9288
|
+
internalData.treeExpandedMaps = {};
|
|
9289
|
+
reactData.treeExpandedFlag++;
|
|
9123
9290
|
if (transform) {
|
|
9124
9291
|
handleVirtualTreeToList($xeTable);
|
|
9125
9292
|
return $xeTable.handleTableData();
|
|
@@ -9132,45 +9299,49 @@ const Methods = {
|
|
|
9132
9299
|
*/
|
|
9133
9300
|
reloadTreeExpand(row) {
|
|
9134
9301
|
const $xeTable = this;
|
|
9302
|
+
const internalData = $xeTable;
|
|
9135
9303
|
const {
|
|
9136
|
-
treeOpts,
|
|
9137
9304
|
treeExpandLazyLoadedMaps
|
|
9138
|
-
} =
|
|
9305
|
+
} = internalData;
|
|
9306
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
9139
9307
|
const {
|
|
9140
9308
|
transform,
|
|
9141
9309
|
lazy
|
|
9142
9310
|
} = treeOpts;
|
|
9143
9311
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
9144
|
-
const rowid = (0, _util.getRowid)(
|
|
9312
|
+
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
9145
9313
|
if (lazy && row[hasChildField] && !treeExpandLazyLoadedMaps[rowid]) {
|
|
9146
|
-
return
|
|
9147
|
-
return
|
|
9314
|
+
return $xeTable.clearTreeExpandLoaded(row).then(() => {
|
|
9315
|
+
return handleAsyncTreeExpandChilds($xeTable, row);
|
|
9148
9316
|
}).then(() => {
|
|
9149
9317
|
if (transform) {
|
|
9150
9318
|
handleVirtualTreeToList($xeTable);
|
|
9151
|
-
return
|
|
9319
|
+
return $xeTable.handleTableData();
|
|
9152
9320
|
}
|
|
9153
9321
|
}).then(() => {
|
|
9154
|
-
return
|
|
9322
|
+
return $xeTable.recalculate();
|
|
9155
9323
|
});
|
|
9156
9324
|
}
|
|
9157
|
-
return
|
|
9325
|
+
return $xeTable.$nextTick();
|
|
9158
9326
|
},
|
|
9159
9327
|
reloadTreeChilds(row) {
|
|
9328
|
+
const $xeTable = this;
|
|
9160
9329
|
if (process.env.NODE_ENV === 'development') {
|
|
9161
9330
|
(0, _log.warnLog)('vxe.error.delFunc', ['reloadTreeChilds', 'reloadTreeExpand']);
|
|
9162
9331
|
}
|
|
9163
9332
|
// 即将废弃
|
|
9164
|
-
return
|
|
9333
|
+
return $xeTable.reloadTreeExpand(row);
|
|
9165
9334
|
},
|
|
9166
9335
|
/**
|
|
9167
9336
|
* 展开树节点事件
|
|
9168
9337
|
*/
|
|
9169
9338
|
triggerTreeExpandEvent(evnt, params) {
|
|
9339
|
+
const $xeTable = this;
|
|
9340
|
+
const internalData = $xeTable;
|
|
9170
9341
|
const {
|
|
9171
|
-
treeOpts,
|
|
9172
9342
|
treeExpandLazyLoadedMaps
|
|
9173
|
-
} =
|
|
9343
|
+
} = internalData;
|
|
9344
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
9174
9345
|
const {
|
|
9175
9346
|
row,
|
|
9176
9347
|
column
|
|
@@ -9185,11 +9356,11 @@ const Methods = {
|
|
|
9185
9356
|
evnt.stopPropagation();
|
|
9186
9357
|
const rowid = (0, _util.getRowid)(this, row);
|
|
9187
9358
|
if (!lazy || !treeExpandLazyLoadedMaps[rowid]) {
|
|
9188
|
-
const expanded =
|
|
9189
|
-
const columnIndex =
|
|
9190
|
-
const $columnIndex =
|
|
9191
|
-
|
|
9192
|
-
|
|
9359
|
+
const expanded = !$xeTable.isTreeExpandByRow(row);
|
|
9360
|
+
const columnIndex = $xeTable.getColumnIndex(column);
|
|
9361
|
+
const $columnIndex = $xeTable.getVMColumnIndex(column);
|
|
9362
|
+
$xeTable.setTreeExpand(row, expanded);
|
|
9363
|
+
$xeTable.dispatchEvent('toggle-tree-expand', {
|
|
9193
9364
|
expanded,
|
|
9194
9365
|
column,
|
|
9195
9366
|
columnIndex,
|
|
@@ -9204,112 +9375,6 @@ const Methods = {
|
|
|
9204
9375
|
toggleTreeExpand(row) {
|
|
9205
9376
|
return this.setTreeExpand(row, !this.isTreeExpandByRow(row));
|
|
9206
9377
|
},
|
|
9207
|
-
/**
|
|
9208
|
-
* 处理默认展开树节点
|
|
9209
|
-
*/
|
|
9210
|
-
handleDefaultTreeExpand() {
|
|
9211
|
-
const {
|
|
9212
|
-
treeConfig,
|
|
9213
|
-
treeOpts,
|
|
9214
|
-
tableFullData
|
|
9215
|
-
} = this;
|
|
9216
|
-
if (treeConfig) {
|
|
9217
|
-
const {
|
|
9218
|
-
expandAll,
|
|
9219
|
-
expandRowKeys
|
|
9220
|
-
} = treeOpts;
|
|
9221
|
-
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
9222
|
-
if (expandAll) {
|
|
9223
|
-
this.setAllTreeExpand(true);
|
|
9224
|
-
} else if (expandRowKeys) {
|
|
9225
|
-
const defExpandeds = [];
|
|
9226
|
-
const rowkey = (0, _util.getRowkey)(this);
|
|
9227
|
-
expandRowKeys.forEach(rowid => {
|
|
9228
|
-
const matchObj = _xeUtils.default.findTree(tableFullData, item => rowid === _xeUtils.default.get(item, rowkey), {
|
|
9229
|
-
children: childrenField
|
|
9230
|
-
});
|
|
9231
|
-
if (matchObj) {
|
|
9232
|
-
defExpandeds.push(matchObj.item);
|
|
9233
|
-
}
|
|
9234
|
-
});
|
|
9235
|
-
this.setTreeExpand(defExpandeds, true);
|
|
9236
|
-
}
|
|
9237
|
-
}
|
|
9238
|
-
},
|
|
9239
|
-
handleAsyncTreeExpandChilds(row) {
|
|
9240
|
-
const $xeTable = this;
|
|
9241
|
-
const {
|
|
9242
|
-
treeOpts,
|
|
9243
|
-
checkboxOpts
|
|
9244
|
-
} = this;
|
|
9245
|
-
const {
|
|
9246
|
-
transform,
|
|
9247
|
-
loadMethod
|
|
9248
|
-
} = treeOpts;
|
|
9249
|
-
const {
|
|
9250
|
-
checkStrictly
|
|
9251
|
-
} = checkboxOpts;
|
|
9252
|
-
return new Promise(resolve => {
|
|
9253
|
-
if (loadMethod) {
|
|
9254
|
-
const {
|
|
9255
|
-
treeExpandLazyLoadedMaps,
|
|
9256
|
-
fullAllDataRowIdData
|
|
9257
|
-
} = this;
|
|
9258
|
-
const rowid = (0, _util.getRowid)($xeTable, row);
|
|
9259
|
-
const rowRest = fullAllDataRowIdData[rowid];
|
|
9260
|
-
treeExpandLazyLoadedMaps[rowid] = row;
|
|
9261
|
-
Promise.resolve(loadMethod({
|
|
9262
|
-
$table: $xeTable,
|
|
9263
|
-
row
|
|
9264
|
-
})).then(childRecords => {
|
|
9265
|
-
if (rowRest) {
|
|
9266
|
-
rowRest.treeLoaded = true;
|
|
9267
|
-
}
|
|
9268
|
-
if (treeExpandLazyLoadedMaps[rowid]) {
|
|
9269
|
-
delete treeExpandLazyLoadedMaps[rowid];
|
|
9270
|
-
}
|
|
9271
|
-
if (!_xeUtils.default.isArray(childRecords)) {
|
|
9272
|
-
childRecords = [];
|
|
9273
|
-
}
|
|
9274
|
-
if (childRecords) {
|
|
9275
|
-
return this.loadTreeChildren(row, childRecords).then(childRows => {
|
|
9276
|
-
const {
|
|
9277
|
-
treeExpandedMaps
|
|
9278
|
-
} = this;
|
|
9279
|
-
if (childRows.length && !treeExpandedMaps[rowid]) {
|
|
9280
|
-
treeExpandedMaps[rowid] = row;
|
|
9281
|
-
}
|
|
9282
|
-
// 如果当前节点已选中,则展开后子节点也被选中
|
|
9283
|
-
if (!checkStrictly && this.isCheckedByCheckboxRow(row)) {
|
|
9284
|
-
handleCheckedCheckboxRow($xeTable, childRows, true);
|
|
9285
|
-
}
|
|
9286
|
-
return this.$nextTick().then(() => {
|
|
9287
|
-
if (transform) {
|
|
9288
|
-
this.handleTableData();
|
|
9289
|
-
updateAfterDataIndex($xeTable);
|
|
9290
|
-
return this.$nextTick();
|
|
9291
|
-
}
|
|
9292
|
-
});
|
|
9293
|
-
});
|
|
9294
|
-
}
|
|
9295
|
-
}).catch(() => {
|
|
9296
|
-
const {
|
|
9297
|
-
treeExpandLazyLoadedMaps
|
|
9298
|
-
} = this;
|
|
9299
|
-
if (rowRest) {
|
|
9300
|
-
rowRest.treeLoaded = false;
|
|
9301
|
-
}
|
|
9302
|
-
if (treeExpandLazyLoadedMaps[rowid]) {
|
|
9303
|
-
delete treeExpandLazyLoadedMaps[rowid];
|
|
9304
|
-
}
|
|
9305
|
-
}).finally(() => {
|
|
9306
|
-
this.$nextTick().then(() => this.recalculate()).then(() => resolve());
|
|
9307
|
-
});
|
|
9308
|
-
} else {
|
|
9309
|
-
resolve();
|
|
9310
|
-
}
|
|
9311
|
-
});
|
|
9312
|
-
},
|
|
9313
9378
|
/**
|
|
9314
9379
|
* 设置所有树节点的展开与否
|
|
9315
9380
|
* @param {Boolean} expanded 是否展开
|
|
@@ -9341,27 +9406,35 @@ const Methods = {
|
|
|
9341
9406
|
* @returns
|
|
9342
9407
|
*/
|
|
9343
9408
|
handleBaseTreeExpand(rows, expanded) {
|
|
9409
|
+
const $xeTable = this;
|
|
9410
|
+
const reactData = $xeTable;
|
|
9411
|
+
const internalData = $xeTable;
|
|
9412
|
+
const {
|
|
9413
|
+
treeNodeColumn
|
|
9414
|
+
} = reactData;
|
|
9344
9415
|
const {
|
|
9345
9416
|
fullAllDataRowIdData,
|
|
9346
9417
|
tableFullData,
|
|
9347
9418
|
treeExpandedMaps,
|
|
9348
|
-
|
|
9349
|
-
|
|
9350
|
-
|
|
9351
|
-
} = this;
|
|
9419
|
+
treeExpandLazyLoadedMaps
|
|
9420
|
+
} = internalData;
|
|
9421
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
9352
9422
|
const {
|
|
9353
9423
|
reserve,
|
|
9354
9424
|
lazy,
|
|
9355
9425
|
accordion,
|
|
9356
9426
|
toggleMethod
|
|
9357
9427
|
} = treeOpts;
|
|
9358
|
-
const treeTempExpandedMaps = Object.assign({}, treeExpandedMaps);
|
|
9359
9428
|
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
9360
9429
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField;
|
|
9361
9430
|
const result = [];
|
|
9362
|
-
const columnIndex =
|
|
9363
|
-
const $columnIndex =
|
|
9431
|
+
const columnIndex = $xeTable.getColumnIndex(treeNodeColumn);
|
|
9432
|
+
const $columnIndex = $xeTable.getVMColumnIndex(treeNodeColumn);
|
|
9433
|
+
const {
|
|
9434
|
+
handleGetRowId
|
|
9435
|
+
} = (0, _util.createHandleGetRowId)($xeTable);
|
|
9364
9436
|
let validRows = toggleMethod ? rows.filter(row => toggleMethod({
|
|
9437
|
+
$table: $xeTable,
|
|
9365
9438
|
expanded,
|
|
9366
9439
|
column: treeNodeColumn,
|
|
9367
9440
|
columnIndex,
|
|
@@ -9376,26 +9449,26 @@ const Methods = {
|
|
|
9376
9449
|
});
|
|
9377
9450
|
if (matchObj) {
|
|
9378
9451
|
matchObj.items.forEach(item => {
|
|
9379
|
-
const rowid = (
|
|
9380
|
-
if (
|
|
9381
|
-
delete
|
|
9452
|
+
const rowid = handleGetRowId(item);
|
|
9453
|
+
if (treeExpandedMaps[rowid]) {
|
|
9454
|
+
delete treeExpandedMaps[rowid];
|
|
9382
9455
|
}
|
|
9383
9456
|
});
|
|
9384
9457
|
}
|
|
9385
9458
|
}
|
|
9386
9459
|
if (expanded) {
|
|
9387
9460
|
validRows.forEach(row => {
|
|
9388
|
-
const rowid = (
|
|
9389
|
-
if (!
|
|
9461
|
+
const rowid = handleGetRowId(row);
|
|
9462
|
+
if (!treeExpandedMaps[rowid]) {
|
|
9390
9463
|
const rowRest = fullAllDataRowIdData[rowid];
|
|
9391
9464
|
if (rowRest) {
|
|
9392
9465
|
const isLoad = lazy && row[hasChildField] && !rowRest.treeLoaded && !treeExpandLazyLoadedMaps[rowid];
|
|
9393
9466
|
// 是否使用懒加载
|
|
9394
9467
|
if (isLoad) {
|
|
9395
|
-
result.push(
|
|
9468
|
+
result.push(handleAsyncTreeExpandChilds($xeTable, row));
|
|
9396
9469
|
} else {
|
|
9397
9470
|
if (row[childrenField] && row[childrenField].length) {
|
|
9398
|
-
|
|
9471
|
+
treeExpandedMaps[rowid] = row;
|
|
9399
9472
|
}
|
|
9400
9473
|
}
|
|
9401
9474
|
}
|
|
@@ -9403,18 +9476,18 @@ const Methods = {
|
|
|
9403
9476
|
});
|
|
9404
9477
|
} else {
|
|
9405
9478
|
validRows.forEach(item => {
|
|
9406
|
-
const rowid = (
|
|
9407
|
-
if (
|
|
9408
|
-
delete
|
|
9479
|
+
const rowid = handleGetRowId(item);
|
|
9480
|
+
if (treeExpandedMaps[rowid]) {
|
|
9481
|
+
delete treeExpandedMaps[rowid];
|
|
9409
9482
|
}
|
|
9410
9483
|
});
|
|
9411
9484
|
}
|
|
9412
9485
|
if (reserve) {
|
|
9413
|
-
validRows.forEach(row =>
|
|
9486
|
+
validRows.forEach(row => handleTreeExpandReserve($xeTable, row, expanded));
|
|
9414
9487
|
}
|
|
9415
|
-
|
|
9488
|
+
reactData.treeExpandedFlag++;
|
|
9416
9489
|
return Promise.all(result).then(() => {
|
|
9417
|
-
return
|
|
9490
|
+
return $xeTable.recalculate();
|
|
9418
9491
|
});
|
|
9419
9492
|
},
|
|
9420
9493
|
/**
|
|
@@ -9471,40 +9544,49 @@ const Methods = {
|
|
|
9471
9544
|
* @param {Row} row 行对象
|
|
9472
9545
|
*/
|
|
9473
9546
|
isTreeExpandByRow(row) {
|
|
9547
|
+
const $xeTable = this;
|
|
9548
|
+
const reactData = $xeTable;
|
|
9549
|
+
const internalData = $xeTable;
|
|
9550
|
+
const {
|
|
9551
|
+
treeExpandedFlag
|
|
9552
|
+
} = reactData;
|
|
9474
9553
|
const {
|
|
9475
9554
|
treeExpandedMaps
|
|
9476
|
-
} =
|
|
9477
|
-
return !!treeExpandedMaps[(0, _util.getRowid)(
|
|
9555
|
+
} = internalData;
|
|
9556
|
+
return !!treeExpandedFlag && !!treeExpandedMaps[(0, _util.getRowid)($xeTable, row)];
|
|
9478
9557
|
},
|
|
9479
9558
|
/**
|
|
9480
9559
|
* 手动清空树形节点的展开状态,数据会恢复成未展开的状态
|
|
9481
9560
|
*/
|
|
9482
9561
|
clearTreeExpand() {
|
|
9483
9562
|
const $xeTable = this;
|
|
9563
|
+
const reactData = $xeTable;
|
|
9564
|
+
const internalData = $xeTable;
|
|
9484
9565
|
const {
|
|
9485
|
-
|
|
9486
|
-
|
|
9487
|
-
|
|
9566
|
+
tableFullTreeData
|
|
9567
|
+
} = internalData;
|
|
9568
|
+
const treeOpts = $xeTable.computeTreeOpts;
|
|
9569
|
+
const childrenField = treeOpts.children || treeOpts.childrenField;
|
|
9488
9570
|
const {
|
|
9489
9571
|
transform,
|
|
9490
9572
|
reserve
|
|
9491
9573
|
} = treeOpts;
|
|
9492
|
-
const
|
|
9493
|
-
|
|
9494
|
-
|
|
9574
|
+
const expList = $xeTable.getTreeExpandRecords();
|
|
9575
|
+
internalData.treeExpandedMaps = {};
|
|
9576
|
+
reactData.treeExpandedFlag++;
|
|
9495
9577
|
if (reserve) {
|
|
9496
|
-
_xeUtils.default.eachTree(
|
|
9578
|
+
_xeUtils.default.eachTree(tableFullTreeData, row => handleTreeExpandReserve($xeTable, row, false), {
|
|
9497
9579
|
children: childrenField
|
|
9498
9580
|
});
|
|
9499
9581
|
}
|
|
9500
|
-
return
|
|
9582
|
+
return $xeTable.handleTableData().then(() => {
|
|
9501
9583
|
if (transform) {
|
|
9502
9584
|
handleVirtualTreeToList($xeTable);
|
|
9503
|
-
return
|
|
9585
|
+
return $xeTable.handleTableData();
|
|
9504
9586
|
}
|
|
9505
9587
|
}).then(() => {
|
|
9506
9588
|
if (expList.length) {
|
|
9507
|
-
|
|
9589
|
+
$xeTable.recalculate();
|
|
9508
9590
|
}
|
|
9509
9591
|
});
|
|
9510
9592
|
},
|
|
@@ -9512,20 +9594,6 @@ const Methods = {
|
|
|
9512
9594
|
this.treeExpandedReserveRowMap = {};
|
|
9513
9595
|
return this.$nextTick();
|
|
9514
9596
|
},
|
|
9515
|
-
handleTreeExpandReserve(row, expanded) {
|
|
9516
|
-
const {
|
|
9517
|
-
treeExpandedReserveRowMap,
|
|
9518
|
-
treeOpts
|
|
9519
|
-
} = this;
|
|
9520
|
-
if (treeOpts.reserve) {
|
|
9521
|
-
const rowid = (0, _util.getRowid)(this, row);
|
|
9522
|
-
if (expanded) {
|
|
9523
|
-
treeExpandedReserveRowMap[rowid] = row;
|
|
9524
|
-
} else if (treeExpandedReserveRowMap[rowid]) {
|
|
9525
|
-
delete treeExpandedReserveRowMap[rowid];
|
|
9526
|
-
}
|
|
9527
|
-
}
|
|
9528
|
-
},
|
|
9529
9597
|
/**
|
|
9530
9598
|
* 获取表格的滚动状态
|
|
9531
9599
|
*/
|
|
@@ -9659,8 +9727,8 @@ const Methods = {
|
|
|
9659
9727
|
*/
|
|
9660
9728
|
triggerScrollXEvent() {
|
|
9661
9729
|
const $xeTable = this;
|
|
9662
|
-
const
|
|
9663
|
-
if (
|
|
9730
|
+
const virtualXOpts = $xeTable.computeVirtualXOpts;
|
|
9731
|
+
if (virtualXOpts.immediate) {
|
|
9664
9732
|
loadScrollXData($xeTable);
|
|
9665
9733
|
} else {
|
|
9666
9734
|
lazyScrollXData($xeTable);
|
|
@@ -9671,8 +9739,8 @@ const Methods = {
|
|
|
9671
9739
|
*/
|
|
9672
9740
|
triggerScrollYEvent() {
|
|
9673
9741
|
const $xeTable = this;
|
|
9674
|
-
const
|
|
9675
|
-
if (
|
|
9742
|
+
const virtualYOpts = $xeTable.computeVirtualYOpts;
|
|
9743
|
+
if (virtualYOpts.immediate) {
|
|
9676
9744
|
loadScrollYData($xeTable);
|
|
9677
9745
|
} else {
|
|
9678
9746
|
lazyScrollYData($xeTable);
|
|
@@ -9891,11 +9959,12 @@ const Methods = {
|
|
|
9891
9959
|
} = tableProps;
|
|
9892
9960
|
const {
|
|
9893
9961
|
scrollXLoad,
|
|
9894
|
-
scrollYLoad
|
|
9962
|
+
scrollYLoad,
|
|
9963
|
+
expandColumn
|
|
9895
9964
|
} = reactData;
|
|
9896
9965
|
const leftFixedWidth = $xeTable.computeLeftFixedWidth;
|
|
9897
9966
|
const rightFixedWidth = $xeTable.computeRightFixedWidth;
|
|
9898
|
-
if (!(
|
|
9967
|
+
if (!(leftFixedWidth || rightFixedWidth || expandColumn)) {
|
|
9899
9968
|
return;
|
|
9900
9969
|
}
|
|
9901
9970
|
const {
|
|
@@ -9922,8 +9991,8 @@ const Methods = {
|
|
|
9922
9991
|
return;
|
|
9923
9992
|
}
|
|
9924
9993
|
const wheelSpeed = getWheelSpeed(reactData.lastScrollTime);
|
|
9925
|
-
const deltaTop =
|
|
9926
|
-
const deltaLeft = Math.ceil((shiftKey ? deltaY : deltaX) * wheelSpeed);
|
|
9994
|
+
const deltaTop = shiftKey ? 0 : Math.ceil(deltaY * wheelSpeed);
|
|
9995
|
+
const deltaLeft = Math.ceil((shiftKey ? deltaY || deltaX : deltaX) * wheelSpeed);
|
|
9927
9996
|
const isTopWheel = deltaTop < 0;
|
|
9928
9997
|
const currScrollTop = bodyScrollElem.scrollTop;
|
|
9929
9998
|
// 如果滚动位置已经是顶部或底部,则不需要触发
|
|
@@ -10187,15 +10256,15 @@ const Methods = {
|
|
|
10187
10256
|
const {
|
|
10188
10257
|
isAllOverflow,
|
|
10189
10258
|
scrollYLoad,
|
|
10190
|
-
expandColumn
|
|
10191
|
-
rowExpandedMaps
|
|
10259
|
+
expandColumn
|
|
10192
10260
|
} = reactData;
|
|
10193
10261
|
const {
|
|
10194
10262
|
scrollYStore,
|
|
10195
10263
|
elemStore,
|
|
10196
10264
|
isResizeCellHeight,
|
|
10197
10265
|
afterFullData,
|
|
10198
|
-
fullAllDataRowIdData
|
|
10266
|
+
fullAllDataRowIdData,
|
|
10267
|
+
rowExpandedMaps
|
|
10199
10268
|
} = internalData;
|
|
10200
10269
|
const {
|
|
10201
10270
|
startIndex
|
|
@@ -10457,6 +10526,8 @@ const Methods = {
|
|
|
10457
10526
|
* 更新表尾合计
|
|
10458
10527
|
*/
|
|
10459
10528
|
updateFooter() {
|
|
10529
|
+
const $xeTable = this;
|
|
10530
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
10460
10531
|
const {
|
|
10461
10532
|
showFooter,
|
|
10462
10533
|
visibleColumn,
|
|
@@ -10470,8 +10541,8 @@ const Methods = {
|
|
|
10470
10541
|
footData = visibleColumn.length ? footerMethod({
|
|
10471
10542
|
columns: visibleColumn,
|
|
10472
10543
|
data: this.afterFullData,
|
|
10473
|
-
$table:
|
|
10474
|
-
$grid:
|
|
10544
|
+
$table: $xeTable,
|
|
10545
|
+
$grid: $xeGrid
|
|
10475
10546
|
}) : [];
|
|
10476
10547
|
}
|
|
10477
10548
|
this.footerTableData = footData;
|
|
@@ -10494,9 +10565,6 @@ const Methods = {
|
|
|
10494
10565
|
}
|
|
10495
10566
|
});
|
|
10496
10567
|
},
|
|
10497
|
-
handleDefaultMergeCells() {
|
|
10498
|
-
this.setMergeCells(this.mergeCells);
|
|
10499
|
-
},
|
|
10500
10568
|
/**
|
|
10501
10569
|
* 设置合并单元格
|
|
10502
10570
|
* @param {TableMergeConfig[]} merges { row: Row|number, column: ColumnInfo|number, rowspan: number, colspan: number }
|
|
@@ -10544,15 +10612,12 @@ const Methods = {
|
|
|
10544
10612
|
return updateStyle($xeTable);
|
|
10545
10613
|
});
|
|
10546
10614
|
},
|
|
10547
|
-
handleDefaultMergeFooterItems() {
|
|
10548
|
-
this.setMergeFooterItems(this.mergeFooterItems);
|
|
10549
|
-
},
|
|
10550
10615
|
setMergeFooterItems(merges) {
|
|
10551
10616
|
const $xeTable = this;
|
|
10552
10617
|
if (this.footerSpanMethod) {
|
|
10553
10618
|
(0, _log.errLog)('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method']);
|
|
10554
10619
|
}
|
|
10555
|
-
setMerges(this, merges, this.mergeFooterList
|
|
10620
|
+
setMerges(this, merges, this.mergeFooterList);
|
|
10556
10621
|
return this.$nextTick().then(() => {
|
|
10557
10622
|
this.updateCellAreas();
|
|
10558
10623
|
return updateStyle($xeTable);
|
|
@@ -10607,16 +10672,19 @@ const Methods = {
|
|
|
10607
10672
|
},
|
|
10608
10673
|
dispatchEvent(type, params, evnt) {
|
|
10609
10674
|
const $xeTable = this;
|
|
10675
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
10610
10676
|
$xeTable.$emit(type, createEvent(evnt, {
|
|
10611
10677
|
$table: $xeTable,
|
|
10612
|
-
$grid: $
|
|
10678
|
+
$grid: $xeGrid
|
|
10613
10679
|
}, params));
|
|
10614
10680
|
},
|
|
10615
10681
|
// 已废弃,使用 dispatchEvent
|
|
10616
10682
|
emitEvent(type, params, evnt) {
|
|
10683
|
+
const $xeTable = this;
|
|
10684
|
+
const $xeGrid = $xeTable.$xeGrid;
|
|
10617
10685
|
this.$emit(type, Object.assign({
|
|
10618
|
-
$table:
|
|
10619
|
-
$grid:
|
|
10686
|
+
$table: $xeTable,
|
|
10687
|
+
$grid: $xeGrid,
|
|
10620
10688
|
$event: evnt
|
|
10621
10689
|
}, params));
|
|
10622
10690
|
},
|