vxe-table 3.4.7-beta.0 → 3.4.7-beta.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/lib/edit/src/mixin.js +14 -25
- package/lib/edit/src/mixin.min.js +1 -1
- package/lib/filter/src/mixin.js +1 -1
- package/lib/filter/src/mixin.min.js +1 -1
- package/lib/index.umd.js +381 -296
- package/lib/index.umd.min.js +1 -1
- package/lib/select/src/select.js +1 -1
- package/lib/select/src/select.min.js +1 -1
- package/lib/table/src/body.js +1 -1
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/methods.js +306 -268
- package/lib/table/src/methods.min.js +1 -1
- package/lib/tools/src/utils.js +1 -1
- package/lib/tools/src/utils.min.js +1 -1
- package/lib/v-x-e-table/src/conf.js +2 -1
- package/lib/v-x-e-table/src/conf.min.js +1 -1
- package/package.json +3 -3
- package/packages/edit/src/mixin.js +14 -19
- package/packages/filter/src/mixin.js +1 -1
- package/packages/select/src/select.js +1 -1
- package/packages/table/src/body.js +1 -1
- package/packages/table/src/methods.js +65 -34
- package/packages/tools/src/utils.js +1 -1
- package/packages/v-x-e-table/src/conf.js +2 -1
package/lib/table/src/methods.js
CHANGED
|
@@ -439,10 +439,46 @@ var Methods = {
|
|
|
439
439
|
return this.handleTableData(true).then(this.updateFooter).then(this.recalculate);
|
|
440
440
|
},
|
|
441
441
|
handleTableData: function handleTableData(force) {
|
|
442
|
-
var
|
|
443
|
-
|
|
444
|
-
var
|
|
445
|
-
|
|
442
|
+
var _this2 = this;
|
|
443
|
+
|
|
444
|
+
var treeConfig = this.treeConfig,
|
|
445
|
+
scrollYLoad = this.scrollYLoad,
|
|
446
|
+
scrollYStore = this.scrollYStore,
|
|
447
|
+
fullDataRowIdData = this.fullDataRowIdData,
|
|
448
|
+
treeExpandeds = this.treeExpandeds,
|
|
449
|
+
treeOpts = this.treeOpts;
|
|
450
|
+
var fullList = []; // 是否进行数据处理
|
|
451
|
+
|
|
452
|
+
if (force) {
|
|
453
|
+
this.updateAfterFullData();
|
|
454
|
+
} // 如果为虚拟树,将树结构拍平
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
if (treeConfig && treeOpts.transform) {
|
|
458
|
+
var expandMaps = new Map();
|
|
459
|
+
|
|
460
|
+
_xeUtils.default.eachTree(this.afterTreeFullData, function (row, index, items, path, parent) {
|
|
461
|
+
if (!parent || expandMaps.has(parent) && treeExpandeds.indexOf(parent) > -1) {
|
|
462
|
+
expandMaps.set(row, 1);
|
|
463
|
+
fullList.push(row);
|
|
464
|
+
}
|
|
465
|
+
}, {
|
|
466
|
+
children: treeOpts.mapChildren
|
|
467
|
+
});
|
|
468
|
+
} else {
|
|
469
|
+
fullList = this.afterFullData;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
var tableData = scrollYLoad ? fullList.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullList.slice(0);
|
|
473
|
+
tableData.forEach(function (row, $index) {
|
|
474
|
+
var rowid = getRowid(_this2, row);
|
|
475
|
+
var rest = fullDataRowIdData[rowid];
|
|
476
|
+
|
|
477
|
+
if (rest) {
|
|
478
|
+
rest.$index = $index;
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
this.tableData = tableData;
|
|
446
482
|
return this.$nextTick();
|
|
447
483
|
},
|
|
448
484
|
updateScrollYStatus: function updateScrollYStatus(fullData) {
|
|
@@ -460,7 +496,7 @@ var Methods = {
|
|
|
460
496
|
* @param {Array} datas 数据
|
|
461
497
|
*/
|
|
462
498
|
loadTableData: function loadTableData(datas) {
|
|
463
|
-
var
|
|
499
|
+
var _this3 = this;
|
|
464
500
|
|
|
465
501
|
var keepSource = this.keepSource,
|
|
466
502
|
treeConfig = this.treeConfig,
|
|
@@ -490,6 +526,14 @@ var Methods = {
|
|
|
490
526
|
_tools.UtilTools.error('vxe.error.reqProp', ['tree-config.children']);
|
|
491
527
|
}
|
|
492
528
|
|
|
529
|
+
if (!treeOpts.mapChildren) {
|
|
530
|
+
_tools.UtilTools.error('vxe.error.reqProp', ['tree-config.mapChildren']);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
if (treeOpts.children === treeOpts.mapChildren) {
|
|
534
|
+
_tools.UtilTools.error('vxe.error.errConflicts', ['tree-config.children', 'tree-config.mapChildren']);
|
|
535
|
+
}
|
|
536
|
+
|
|
493
537
|
fullData.forEach(function (row) {
|
|
494
538
|
if (row[treeOpts.children] && row[treeOpts.children].length) {
|
|
495
539
|
_tools.UtilTools.warn('vxe.error.errConflicts', ['tree-config.transform', "row.".concat(treeOpts.children)]);
|
|
@@ -500,7 +544,8 @@ var Methods = {
|
|
|
500
544
|
treeData = _xeUtils.default.toArrayTree(fullData, {
|
|
501
545
|
key: treeOpts.rowField,
|
|
502
546
|
parentKey: treeOpts.parentField,
|
|
503
|
-
children: treeOpts.children
|
|
547
|
+
children: treeOpts.children,
|
|
548
|
+
mapChildren: treeOpts.mapChildren
|
|
504
549
|
});
|
|
505
550
|
fullData = treeData.slice(0);
|
|
506
551
|
} else {
|
|
@@ -518,7 +563,7 @@ var Methods = {
|
|
|
518
563
|
this.scrollYLoad = sYLoad; // 全量数据
|
|
519
564
|
|
|
520
565
|
this.tableFullData = fullData;
|
|
521
|
-
this.
|
|
566
|
+
this.tableFullTreeData = treeData; // 缓存数据
|
|
522
567
|
|
|
523
568
|
this.cacheRowMap(true); // 原始数据
|
|
524
569
|
|
|
@@ -554,31 +599,31 @@ var Methods = {
|
|
|
554
599
|
this.handleTableData(true);
|
|
555
600
|
this.updateFooter();
|
|
556
601
|
return this.$nextTick().then(function () {
|
|
557
|
-
|
|
602
|
+
_this3.updateHeight();
|
|
558
603
|
|
|
559
|
-
|
|
604
|
+
_this3.updateStyle();
|
|
560
605
|
}).then(function () {
|
|
561
|
-
|
|
606
|
+
_this3.computeScrollLoad();
|
|
562
607
|
}).then(function () {
|
|
563
608
|
// 是否启用了虚拟滚动
|
|
564
609
|
if (sYLoad) {
|
|
565
610
|
scrollYStore.endIndex = scrollYStore.visibleSize;
|
|
566
611
|
}
|
|
567
612
|
|
|
568
|
-
|
|
613
|
+
_this3.handleReserveStatus();
|
|
569
614
|
|
|
570
|
-
|
|
615
|
+
_this3.checkSelectionStatus();
|
|
571
616
|
|
|
572
617
|
return new Promise(function (resolve) {
|
|
573
|
-
|
|
574
|
-
return
|
|
618
|
+
_this3.$nextTick().then(function () {
|
|
619
|
+
return _this3.recalculate();
|
|
575
620
|
}).then(function () {
|
|
576
621
|
// 是否变更虚拟滚动
|
|
577
622
|
if (oldScrollYLoad === sYLoad) {
|
|
578
|
-
(0, _util.restoreScrollLocation)(
|
|
623
|
+
(0, _util.restoreScrollLocation)(_this3, lastScrollLeft, lastScrollTop).then(resolve);
|
|
579
624
|
} else {
|
|
580
625
|
setTimeout(function () {
|
|
581
|
-
return (0, _util.restoreScrollLocation)(
|
|
626
|
+
return (0, _util.restoreScrollLocation)(_this3, lastScrollLeft, lastScrollTop).then(resolve);
|
|
582
627
|
});
|
|
583
628
|
}
|
|
584
629
|
});
|
|
@@ -591,23 +636,23 @@ var Methods = {
|
|
|
591
636
|
* @param {Array} datas 数据
|
|
592
637
|
*/
|
|
593
638
|
loadData: function loadData(datas) {
|
|
594
|
-
var
|
|
639
|
+
var _this4 = this;
|
|
595
640
|
|
|
596
641
|
var inited = this.inited,
|
|
597
642
|
initStatus = this.initStatus;
|
|
598
643
|
return this.loadTableData(datas).then(function () {
|
|
599
|
-
|
|
600
|
-
|
|
644
|
+
_this4.inited = true;
|
|
645
|
+
_this4.initStatus = true;
|
|
601
646
|
|
|
602
647
|
if (!initStatus) {
|
|
603
|
-
|
|
648
|
+
_this4.handleLoadDefaults();
|
|
604
649
|
}
|
|
605
650
|
|
|
606
651
|
if (!inited) {
|
|
607
|
-
|
|
652
|
+
_this4.handleInitDefaults();
|
|
608
653
|
}
|
|
609
654
|
|
|
610
|
-
return
|
|
655
|
+
return _this4.recalculate();
|
|
611
656
|
});
|
|
612
657
|
},
|
|
613
658
|
|
|
@@ -616,21 +661,21 @@ var Methods = {
|
|
|
616
661
|
* @param {Array} datas 数据
|
|
617
662
|
*/
|
|
618
663
|
reloadData: function reloadData(datas) {
|
|
619
|
-
var
|
|
664
|
+
var _this5 = this;
|
|
620
665
|
|
|
621
666
|
var inited = this.inited;
|
|
622
667
|
return this.clearAll().then(function () {
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
return
|
|
668
|
+
_this5.inited = true;
|
|
669
|
+
_this5.initStatus = true;
|
|
670
|
+
return _this5.loadTableData(datas);
|
|
626
671
|
}).then(function () {
|
|
627
|
-
|
|
672
|
+
_this5.handleLoadDefaults();
|
|
628
673
|
|
|
629
674
|
if (!inited) {
|
|
630
|
-
|
|
675
|
+
_this5.handleInitDefaults();
|
|
631
676
|
}
|
|
632
677
|
|
|
633
|
-
return
|
|
678
|
+
return _this5.recalculate();
|
|
634
679
|
});
|
|
635
680
|
},
|
|
636
681
|
|
|
@@ -680,10 +725,10 @@ var Methods = {
|
|
|
680
725
|
* @param {ColumnInfo} columns 列配置
|
|
681
726
|
*/
|
|
682
727
|
loadColumn: function loadColumn(columns) {
|
|
683
|
-
var
|
|
728
|
+
var _this6 = this;
|
|
684
729
|
|
|
685
730
|
var collectColumn = _xeUtils.default.mapTree(columns, function (column) {
|
|
686
|
-
return _cell.default.createColumn(
|
|
731
|
+
return _cell.default.createColumn(_this6, column);
|
|
687
732
|
}, {
|
|
688
733
|
children: 'children'
|
|
689
734
|
});
|
|
@@ -697,14 +742,14 @@ var Methods = {
|
|
|
697
742
|
* @param {ColumnInfo} columns 列配置
|
|
698
743
|
*/
|
|
699
744
|
reloadColumn: function reloadColumn(columns) {
|
|
700
|
-
var
|
|
745
|
+
var _this7 = this;
|
|
701
746
|
|
|
702
747
|
return this.clearAll().then(function () {
|
|
703
|
-
return
|
|
748
|
+
return _this7.loadColumn(columns);
|
|
704
749
|
});
|
|
705
750
|
},
|
|
706
751
|
handleColumn: function handleColumn(collectColumn) {
|
|
707
|
-
var
|
|
752
|
+
var _this8 = this;
|
|
708
753
|
|
|
709
754
|
this.collectColumn = collectColumn;
|
|
710
755
|
var tableFullColumn = getColumnList(collectColumn);
|
|
@@ -712,8 +757,8 @@ var Methods = {
|
|
|
712
757
|
this.cacheColumnMap();
|
|
713
758
|
this.restoreCustomStorage();
|
|
714
759
|
this.parseColumns().then(function () {
|
|
715
|
-
if (
|
|
716
|
-
|
|
760
|
+
if (_this8.scrollXLoad) {
|
|
761
|
+
_this8.loadScrollXData(true);
|
|
717
762
|
}
|
|
718
763
|
});
|
|
719
764
|
this.clearMergeCells();
|
|
@@ -727,14 +772,14 @@ var Methods = {
|
|
|
727
772
|
}
|
|
728
773
|
|
|
729
774
|
return this.$nextTick().then(function () {
|
|
730
|
-
if (
|
|
731
|
-
|
|
775
|
+
if (_this8.$toolbar) {
|
|
776
|
+
_this8.$toolbar.syncUpdate({
|
|
732
777
|
collectColumn: collectColumn,
|
|
733
|
-
$table:
|
|
778
|
+
$table: _this8
|
|
734
779
|
});
|
|
735
780
|
}
|
|
736
781
|
|
|
737
|
-
return
|
|
782
|
+
return _this8.recalculate();
|
|
738
783
|
});
|
|
739
784
|
},
|
|
740
785
|
|
|
@@ -743,20 +788,21 @@ var Methods = {
|
|
|
743
788
|
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
744
789
|
*/
|
|
745
790
|
cacheRowMap: function cacheRowMap(source) {
|
|
746
|
-
var
|
|
791
|
+
var _this9 = this;
|
|
747
792
|
|
|
748
793
|
var treeConfig = this.treeConfig,
|
|
749
794
|
treeOpts = this.treeOpts,
|
|
750
795
|
tableFullData = this.tableFullData,
|
|
751
796
|
fullDataRowMap = this.fullDataRowMap,
|
|
752
|
-
fullAllDataRowMap = this.fullAllDataRowMap
|
|
797
|
+
fullAllDataRowMap = this.fullAllDataRowMap,
|
|
798
|
+
tableFullTreeData = this.tableFullTreeData;
|
|
753
799
|
var fullDataRowIdData = this.fullDataRowIdData,
|
|
754
800
|
fullAllDataRowIdData = this.fullAllDataRowIdData;
|
|
755
801
|
var rowkey = getRowkey(this);
|
|
756
802
|
var isLazy = treeConfig && treeOpts.lazy;
|
|
757
803
|
|
|
758
804
|
var handleCache = function handleCache(row, index, items, path, parent, nodes) {
|
|
759
|
-
var rowid = getRowid(
|
|
805
|
+
var rowid = getRowid(_this9, row);
|
|
760
806
|
var seq = treeConfig && path ? (0, _util.toTreePathSeq)(path) : index + 1;
|
|
761
807
|
var level = nodes ? nodes.length - 1 : 0;
|
|
762
808
|
|
|
@@ -800,13 +846,13 @@ var Methods = {
|
|
|
800
846
|
fullAllDataRowMap.clear();
|
|
801
847
|
|
|
802
848
|
if (treeConfig) {
|
|
803
|
-
_xeUtils.default.eachTree(
|
|
849
|
+
_xeUtils.default.eachTree(tableFullTreeData, handleCache, treeOpts);
|
|
804
850
|
} else {
|
|
805
851
|
tableFullData.forEach(handleCache);
|
|
806
852
|
}
|
|
807
853
|
},
|
|
808
854
|
loadTreeChildren: function loadTreeChildren(row, childRecords) {
|
|
809
|
-
var
|
|
855
|
+
var _this10 = this;
|
|
810
856
|
|
|
811
857
|
var keepSource = this.keepSource,
|
|
812
858
|
tableSourceData = this.tableSourceData,
|
|
@@ -820,10 +866,10 @@ var Methods = {
|
|
|
820
866
|
var parentLevel = rest ? rest.level : 0;
|
|
821
867
|
return this.createData(childRecords).then(function (rows) {
|
|
822
868
|
if (keepSource) {
|
|
823
|
-
var rowid = getRowid(
|
|
869
|
+
var rowid = getRowid(_this10, row);
|
|
824
870
|
|
|
825
871
|
var matchObj = _xeUtils.default.findTree(tableSourceData, function (item) {
|
|
826
|
-
return rowid === getRowid(
|
|
872
|
+
return rowid === getRowid(_this10, item);
|
|
827
873
|
}, treeOpts);
|
|
828
874
|
|
|
829
875
|
if (matchObj) {
|
|
@@ -832,7 +878,7 @@ var Methods = {
|
|
|
832
878
|
}
|
|
833
879
|
|
|
834
880
|
_xeUtils.default.eachTree(rows, function (childRow, index, items, path, parent, nodes) {
|
|
835
|
-
var rowid = getRowid(
|
|
881
|
+
var rowid = getRowid(_this10, childRow);
|
|
836
882
|
var rest = {
|
|
837
883
|
row: childRow,
|
|
838
884
|
rowid: rowid,
|
|
@@ -860,7 +906,7 @@ var Methods = {
|
|
|
860
906
|
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
861
907
|
*/
|
|
862
908
|
cacheColumnMap: function cacheColumnMap() {
|
|
863
|
-
var
|
|
909
|
+
var _this11 = this;
|
|
864
910
|
|
|
865
911
|
var tableFullColumn = this.tableFullColumn,
|
|
866
912
|
collectColumn = this.collectColumn,
|
|
@@ -947,16 +993,16 @@ var Methods = {
|
|
|
947
993
|
}
|
|
948
994
|
|
|
949
995
|
if (process.env.NODE_ENV === 'development') {
|
|
950
|
-
if (
|
|
951
|
-
_tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-overflow=".concat(
|
|
996
|
+
if (_this11.showOverflow && column.showOverflow === false) {
|
|
997
|
+
_tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-overflow=".concat(_this11.showOverflow), "column.show-overflow=".concat(column.showOverflow)]);
|
|
952
998
|
}
|
|
953
999
|
|
|
954
|
-
if (
|
|
955
|
-
_tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-header-overflow=".concat(
|
|
1000
|
+
if (_this11.showHeaderOverflow && column.showHeaderOverflow === false) {
|
|
1001
|
+
_tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-header-overflow=".concat(_this11.showHeaderOverflow), "column.show-header-overflow=".concat(column.showHeaderOverflow)]);
|
|
956
1002
|
}
|
|
957
1003
|
|
|
958
|
-
if (
|
|
959
|
-
_tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-footer-overflow=".concat(
|
|
1004
|
+
if (_this11.showFooterOverflow && column.showFooterOverflow === false) {
|
|
1005
|
+
_tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-footer-overflow=".concat(_this11.showFooterOverflow), "column.show-footer-overflow=".concat(column.showFooterOverflow)]);
|
|
960
1006
|
}
|
|
961
1007
|
}
|
|
962
1008
|
|
|
@@ -1208,13 +1254,13 @@ var Methods = {
|
|
|
1208
1254
|
* @param {Array} records 新数据
|
|
1209
1255
|
*/
|
|
1210
1256
|
createData: function createData(records) {
|
|
1211
|
-
var
|
|
1257
|
+
var _this12 = this;
|
|
1212
1258
|
|
|
1213
1259
|
var treeConfig = this.treeConfig,
|
|
1214
1260
|
treeOpts = this.treeOpts;
|
|
1215
1261
|
|
|
1216
1262
|
var handleRrecord = function handleRrecord(record) {
|
|
1217
|
-
return
|
|
1263
|
+
return _this12.defineField(Object.assign({}, record));
|
|
1218
1264
|
};
|
|
1219
1265
|
|
|
1220
1266
|
var rows = treeConfig ? _xeUtils.default.mapTree(records, handleRrecord, treeOpts) : records.map(handleRrecord);
|
|
@@ -1229,7 +1275,7 @@ var Methods = {
|
|
|
1229
1275
|
* @param {Array/Object} records 新数据
|
|
1230
1276
|
*/
|
|
1231
1277
|
createRow: function createRow(records) {
|
|
1232
|
-
var
|
|
1278
|
+
var _this13 = this;
|
|
1233
1279
|
|
|
1234
1280
|
var isArr = _xeUtils.default.isArray(records);
|
|
1235
1281
|
|
|
@@ -1238,7 +1284,7 @@ var Methods = {
|
|
|
1238
1284
|
}
|
|
1239
1285
|
|
|
1240
1286
|
return this.$nextTick().then(function () {
|
|
1241
|
-
return
|
|
1287
|
+
return _this13.createData(records).then(function (rows) {
|
|
1242
1288
|
return isArr ? rows : rows[0];
|
|
1243
1289
|
});
|
|
1244
1290
|
});
|
|
@@ -1252,7 +1298,7 @@ var Methods = {
|
|
|
1252
1298
|
* 如果还额外传了 field 则还原指定的单元格数据
|
|
1253
1299
|
*/
|
|
1254
1300
|
revertData: function revertData(rows, field) {
|
|
1255
|
-
var
|
|
1301
|
+
var _this14 = this;
|
|
1256
1302
|
|
|
1257
1303
|
var keepSource = this.keepSource,
|
|
1258
1304
|
tableSourceData = this.tableSourceData,
|
|
@@ -1278,8 +1324,8 @@ var Methods = {
|
|
|
1278
1324
|
|
|
1279
1325
|
if (targetRows.length) {
|
|
1280
1326
|
targetRows.forEach(function (row) {
|
|
1281
|
-
if (!
|
|
1282
|
-
var rowIndex =
|
|
1327
|
+
if (!_this14.isInsertByRow(row)) {
|
|
1328
|
+
var rowIndex = _this14.getRowIndex(row);
|
|
1283
1329
|
|
|
1284
1330
|
if (treeConfig && rowIndex === -1) {
|
|
1285
1331
|
throw new Error(_tools.UtilTools.getLog('vxe.error.noTree', ['revertData']));
|
|
@@ -1363,7 +1409,7 @@ var Methods = {
|
|
|
1363
1409
|
* @param {String} field 字段名
|
|
1364
1410
|
*/
|
|
1365
1411
|
isUpdateByRow: function isUpdateByRow(row, field) {
|
|
1366
|
-
var
|
|
1412
|
+
var _this15 = this;
|
|
1367
1413
|
|
|
1368
1414
|
var visibleColumn = this.visibleColumn,
|
|
1369
1415
|
keepSource = this.keepSource,
|
|
@@ -1384,7 +1430,7 @@ var Methods = {
|
|
|
1384
1430
|
var children = treeOpts.children;
|
|
1385
1431
|
|
|
1386
1432
|
var matchObj = _xeUtils.default.findTree(tableSourceData, function (item) {
|
|
1387
|
-
return rowid === getRowid(
|
|
1433
|
+
return rowid === getRowid(_this15, item);
|
|
1388
1434
|
}, treeOpts);
|
|
1389
1435
|
|
|
1390
1436
|
row = Object.assign({}, row, _defineProperty({}, children, null));
|
|
@@ -1508,18 +1554,23 @@ var Methods = {
|
|
|
1508
1554
|
* 如果存在筛选条件,继续处理
|
|
1509
1555
|
*/
|
|
1510
1556
|
updateAfterFullData: function updateAfterFullData() {
|
|
1511
|
-
var
|
|
1557
|
+
var _this16 = this;
|
|
1512
1558
|
|
|
1513
1559
|
var tableFullColumn = this.tableFullColumn,
|
|
1514
1560
|
tableFullData = this.tableFullData,
|
|
1515
1561
|
filterOpts = this.filterOpts,
|
|
1516
|
-
sortOpts = this.sortOpts
|
|
1562
|
+
sortOpts = this.sortOpts,
|
|
1563
|
+
treeConfig = this.treeConfig,
|
|
1564
|
+
treeOpts = this.treeOpts,
|
|
1565
|
+
tableFullTreeData = this.tableFullTreeData;
|
|
1517
1566
|
var allRemoteFilter = filterOpts.remote,
|
|
1518
1567
|
allFilterMethod = filterOpts.filterMethod;
|
|
1519
1568
|
var allRemoteSort = sortOpts.remote,
|
|
1520
1569
|
allSortMethod = sortOpts.sortMethod,
|
|
1521
1570
|
sortMultiple = sortOpts.multiple;
|
|
1522
|
-
var
|
|
1571
|
+
var transform = treeOpts.transform;
|
|
1572
|
+
var tableData = [];
|
|
1573
|
+
var tableTree = [];
|
|
1523
1574
|
var filterColumns = [];
|
|
1524
1575
|
var orderColumns = [];
|
|
1525
1576
|
tableFullColumn.forEach(function (column) {
|
|
@@ -1556,7 +1607,7 @@ var Methods = {
|
|
|
1556
1607
|
});
|
|
1557
1608
|
|
|
1558
1609
|
if (filterColumns.length) {
|
|
1559
|
-
|
|
1610
|
+
var handleFilter = function handleFilter(row) {
|
|
1560
1611
|
return filterColumns.every(function (_ref) {
|
|
1561
1612
|
var column = _ref.column,
|
|
1562
1613
|
valueList = _ref.valueList,
|
|
@@ -1579,7 +1630,7 @@ var Methods = {
|
|
|
1579
1630
|
cellValue: cellValue,
|
|
1580
1631
|
row: row,
|
|
1581
1632
|
column: column,
|
|
1582
|
-
$table:
|
|
1633
|
+
$table: _this16
|
|
1583
1634
|
});
|
|
1584
1635
|
});
|
|
1585
1636
|
} else if (compFilterMethod) {
|
|
@@ -1590,7 +1641,7 @@ var Methods = {
|
|
|
1590
1641
|
cellValue: cellValue,
|
|
1591
1642
|
row: row,
|
|
1592
1643
|
column: column,
|
|
1593
|
-
$table:
|
|
1644
|
+
$table: _this16
|
|
1594
1645
|
});
|
|
1595
1646
|
});
|
|
1596
1647
|
} else if (allFilterMethod) {
|
|
@@ -1609,7 +1660,7 @@ var Methods = {
|
|
|
1609
1660
|
cellValue: cellValue,
|
|
1610
1661
|
row: row,
|
|
1611
1662
|
column: column,
|
|
1612
|
-
$table:
|
|
1663
|
+
$table: _this16
|
|
1613
1664
|
});
|
|
1614
1665
|
});
|
|
1615
1666
|
}
|
|
@@ -1619,7 +1670,19 @@ var Methods = {
|
|
|
1619
1670
|
|
|
1620
1671
|
return true;
|
|
1621
1672
|
});
|
|
1622
|
-
}
|
|
1673
|
+
};
|
|
1674
|
+
|
|
1675
|
+
if (treeConfig && transform) {
|
|
1676
|
+
tableTree = _xeUtils.default.searchTree(tableFullTreeData, handleFilter, _objectSpread(_objectSpread({}, treeOpts), {}, {
|
|
1677
|
+
original: true
|
|
1678
|
+
}));
|
|
1679
|
+
} else {
|
|
1680
|
+
tableData = treeConfig ? tableFullTreeData.filter(handleFilter) : tableFullData.filter(handleFilter);
|
|
1681
|
+
tableTree = tableData;
|
|
1682
|
+
}
|
|
1683
|
+
} else {
|
|
1684
|
+
tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0);
|
|
1685
|
+
tableTree = tableData;
|
|
1623
1686
|
}
|
|
1624
1687
|
|
|
1625
1688
|
var firstOrderColumn = orderColumns[0];
|
|
@@ -1641,7 +1704,7 @@ var Methods = {
|
|
|
1641
1704
|
tableData = _xeUtils.default.orderBy(tableData, orderColumns.map(function (_ref2) {
|
|
1642
1705
|
var column = _ref2.column,
|
|
1643
1706
|
order = _ref2.order;
|
|
1644
|
-
return [getOrderField(
|
|
1707
|
+
return [getOrderField(_this16, column), order];
|
|
1645
1708
|
}));
|
|
1646
1709
|
} else {
|
|
1647
1710
|
// 兼容 v2,在 v4 中废弃, sortBy 不能为数组
|
|
@@ -1656,14 +1719,17 @@ var Methods = {
|
|
|
1656
1719
|
tableData = _xeUtils.default.orderBy(tableData, sortByConfs || [firstOrderColumn].map(function (_ref3) {
|
|
1657
1720
|
var column = _ref3.column,
|
|
1658
1721
|
order = _ref3.order;
|
|
1659
|
-
return [getOrderField(
|
|
1722
|
+
return [getOrderField(_this16, column), order];
|
|
1660
1723
|
}));
|
|
1661
1724
|
}
|
|
1662
1725
|
}
|
|
1726
|
+
|
|
1727
|
+
tableTree = tableData;
|
|
1663
1728
|
}
|
|
1664
1729
|
|
|
1665
1730
|
this.afterFullData = tableData;
|
|
1666
|
-
|
|
1731
|
+
this.afterTreeFullData = tableTree;
|
|
1732
|
+
this.updateAfterDataIndex();
|
|
1667
1733
|
},
|
|
1668
1734
|
|
|
1669
1735
|
/**
|
|
@@ -1671,18 +1737,18 @@ var Methods = {
|
|
|
1671
1737
|
* 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
|
|
1672
1738
|
*/
|
|
1673
1739
|
updateAfterDataIndex: function updateAfterDataIndex() {
|
|
1674
|
-
var
|
|
1740
|
+
var _this17 = this;
|
|
1675
1741
|
|
|
1676
1742
|
var treeConfig = this.treeConfig,
|
|
1677
1743
|
afterFullData = this.afterFullData,
|
|
1678
1744
|
fullDataRowIdData = this.fullDataRowIdData,
|
|
1679
1745
|
fullAllDataRowIdData = this.fullAllDataRowIdData,
|
|
1680
|
-
|
|
1746
|
+
afterTreeFullData = this.afterTreeFullData,
|
|
1681
1747
|
treeOpts = this.treeOpts;
|
|
1682
1748
|
|
|
1683
1749
|
if (treeConfig) {
|
|
1684
|
-
_xeUtils.default.eachTree(
|
|
1685
|
-
var rowid = getRowid(
|
|
1750
|
+
_xeUtils.default.eachTree(afterTreeFullData, function (row, index, items, path) {
|
|
1751
|
+
var rowid = getRowid(_this17, row);
|
|
1686
1752
|
var allrest = fullAllDataRowIdData[rowid];
|
|
1687
1753
|
var fullrest = fullDataRowIdData[rowid];
|
|
1688
1754
|
var seq = path.map(function (num, i) {
|
|
@@ -1722,7 +1788,7 @@ var Methods = {
|
|
|
1722
1788
|
}, treeOpts);
|
|
1723
1789
|
} else {
|
|
1724
1790
|
afterFullData.forEach(function (row, index) {
|
|
1725
|
-
var rowid = getRowid(
|
|
1791
|
+
var rowid = getRowid(_this17, row);
|
|
1726
1792
|
var allrest = fullAllDataRowIdData[rowid];
|
|
1727
1793
|
var fullrest = fullDataRowIdData[rowid];
|
|
1728
1794
|
var seq = index + 1;
|
|
@@ -1803,7 +1869,7 @@ var Methods = {
|
|
|
1803
1869
|
* 默认执行一次,除非被重置
|
|
1804
1870
|
*/
|
|
1805
1871
|
handleLoadDefaults: function handleLoadDefaults() {
|
|
1806
|
-
var
|
|
1872
|
+
var _this18 = this;
|
|
1807
1873
|
|
|
1808
1874
|
if (this.checkboxConfig) {
|
|
1809
1875
|
this.handleDefaultSelectionChecked();
|
|
@@ -1830,7 +1896,7 @@ var Methods = {
|
|
|
1830
1896
|
}
|
|
1831
1897
|
|
|
1832
1898
|
this.$nextTick(function () {
|
|
1833
|
-
return setTimeout(
|
|
1899
|
+
return setTimeout(_this18.recalculate);
|
|
1834
1900
|
});
|
|
1835
1901
|
},
|
|
1836
1902
|
|
|
@@ -2087,12 +2153,12 @@ var Methods = {
|
|
|
2087
2153
|
* 刷新列配置
|
|
2088
2154
|
*/
|
|
2089
2155
|
refreshColumn: function refreshColumn() {
|
|
2090
|
-
var
|
|
2156
|
+
var _this19 = this;
|
|
2091
2157
|
|
|
2092
2158
|
return this.parseColumns().then(function () {
|
|
2093
|
-
return
|
|
2159
|
+
return _this19.refreshScroll();
|
|
2094
2160
|
}).then(function () {
|
|
2095
|
-
return
|
|
2161
|
+
return _this19.recalculate();
|
|
2096
2162
|
});
|
|
2097
2163
|
},
|
|
2098
2164
|
|
|
@@ -2101,7 +2167,7 @@ var Methods = {
|
|
|
2101
2167
|
* 将固定的列左边、右边分别靠边
|
|
2102
2168
|
*/
|
|
2103
2169
|
parseColumns: function parseColumns() {
|
|
2104
|
-
var
|
|
2170
|
+
var _this20 = this;
|
|
2105
2171
|
|
|
2106
2172
|
var leftList = [];
|
|
2107
2173
|
var centerList = [];
|
|
@@ -2228,11 +2294,11 @@ var Methods = {
|
|
|
2228
2294
|
this.visibleColumn = visibleColumn;
|
|
2229
2295
|
this.handleTableColumn();
|
|
2230
2296
|
return this.updateFooter().then(function () {
|
|
2231
|
-
return
|
|
2297
|
+
return _this20.recalculate();
|
|
2232
2298
|
}).then(function () {
|
|
2233
|
-
|
|
2299
|
+
_this20.updateCellAreas();
|
|
2234
2300
|
|
|
2235
|
-
return
|
|
2301
|
+
return _this20.recalculate();
|
|
2236
2302
|
});
|
|
2237
2303
|
},
|
|
2238
2304
|
|
|
@@ -2316,7 +2382,7 @@ var Methods = {
|
|
|
2316
2382
|
* 支持 width=? width=?px width=?% min-width=? min-width=?px min-width=?%
|
|
2317
2383
|
*/
|
|
2318
2384
|
recalculate: function recalculate(refull) {
|
|
2319
|
-
var
|
|
2385
|
+
var _this21 = this;
|
|
2320
2386
|
|
|
2321
2387
|
var $refs = this.$refs;
|
|
2322
2388
|
var tableBody = $refs.tableBody,
|
|
@@ -2332,9 +2398,9 @@ var Methods = {
|
|
|
2332
2398
|
if (refull === true) {
|
|
2333
2399
|
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
2334
2400
|
return this.computeScrollLoad().then(function () {
|
|
2335
|
-
|
|
2401
|
+
_this21.autoCellWidth(headerElem, bodyElem, footerElem);
|
|
2336
2402
|
|
|
2337
|
-
return
|
|
2403
|
+
return _this21.computeScrollLoad();
|
|
2338
2404
|
});
|
|
2339
2405
|
}
|
|
2340
2406
|
}
|
|
@@ -2482,7 +2548,7 @@ var Methods = {
|
|
|
2482
2548
|
this.customMaxHeight = calcHeight(this, 'maxHeight');
|
|
2483
2549
|
},
|
|
2484
2550
|
updateStyle: function updateStyle() {
|
|
2485
|
-
var
|
|
2551
|
+
var _this22 = this;
|
|
2486
2552
|
|
|
2487
2553
|
var $refs = this.$refs,
|
|
2488
2554
|
isGroup = this.isGroup,
|
|
@@ -2586,7 +2652,7 @@ var Methods = {
|
|
|
2586
2652
|
|
|
2587
2653
|
if (isGroup && listElem) {
|
|
2588
2654
|
_xeUtils.default.arrayEach(listElem.querySelectorAll('.col--group'), function (thElem) {
|
|
2589
|
-
var colNode =
|
|
2655
|
+
var colNode = _this22.getColumnNode(thElem);
|
|
2590
2656
|
|
|
2591
2657
|
if (colNode) {
|
|
2592
2658
|
var column = colNode.item;
|
|
@@ -2767,10 +2833,10 @@ var Methods = {
|
|
|
2767
2833
|
|
|
2768
2834
|
if (cellElem) {
|
|
2769
2835
|
if (colspan > 1) {
|
|
2770
|
-
var columnIndex =
|
|
2836
|
+
var columnIndex = _this22.getColumnIndex(column);
|
|
2771
2837
|
|
|
2772
2838
|
for (var _index = 1; _index < colspan; _index++) {
|
|
2773
|
-
var nextColumn =
|
|
2839
|
+
var nextColumn = _this22.getColumns(columnIndex + _index);
|
|
2774
2840
|
|
|
2775
2841
|
if (nextColumn) {
|
|
2776
2842
|
colWidth += nextColumn.renderWidth;
|
|
@@ -2820,7 +2886,7 @@ var Methods = {
|
|
|
2820
2886
|
}
|
|
2821
2887
|
},
|
|
2822
2888
|
preventEvent: function preventEvent(evnt, type, args, next, end) {
|
|
2823
|
-
var
|
|
2889
|
+
var _this23 = this;
|
|
2824
2890
|
|
|
2825
2891
|
var evntList = _vXETable.default.interceptor.get(type);
|
|
2826
2892
|
|
|
@@ -2828,8 +2894,8 @@ var Methods = {
|
|
|
2828
2894
|
|
|
2829
2895
|
if (!evntList.some(function (func) {
|
|
2830
2896
|
return func(Object.assign({
|
|
2831
|
-
$grid:
|
|
2832
|
-
$table:
|
|
2897
|
+
$grid: _this23.$xegrid,
|
|
2898
|
+
$table: _this23,
|
|
2833
2899
|
$event: evnt
|
|
2834
2900
|
}, args)) === false;
|
|
2835
2901
|
})) {
|
|
@@ -2849,7 +2915,7 @@ var Methods = {
|
|
|
2849
2915
|
* 全局按下事件处理
|
|
2850
2916
|
*/
|
|
2851
2917
|
handleGlobalMousedownEvent: function handleGlobalMousedownEvent(evnt) {
|
|
2852
|
-
var
|
|
2918
|
+
var _this24 = this;
|
|
2853
2919
|
|
|
2854
2920
|
var $el = this.$el,
|
|
2855
2921
|
$refs = this.$refs,
|
|
@@ -2910,7 +2976,7 @@ var Methods = {
|
|
|
2910
2976
|
} // 如果固定了高度且点击了行之外的空白处,则清除激活状态
|
|
2911
2977
|
|
|
2912
2978
|
|
|
2913
|
-
if (!isClearActived &&
|
|
2979
|
+
if (!isClearActived && _this24.height && !_this24.overflowY) {
|
|
2914
2980
|
var bodyWrapperElem = evnt.target;
|
|
2915
2981
|
|
|
2916
2982
|
if (hasClass(bodyWrapperElem, 'vxe-table--body-wrapper')) {
|
|
@@ -2921,7 +2987,7 @@ var Methods = {
|
|
|
2921
2987
|
if (isClearActived || // 如果点击了当前表格之外
|
|
2922
2988
|
!getEventTargetNode(evnt, $el).flag) {
|
|
2923
2989
|
setTimeout(function () {
|
|
2924
|
-
return
|
|
2990
|
+
return _this24.clearActived(evnt);
|
|
2925
2991
|
});
|
|
2926
2992
|
}
|
|
2927
2993
|
});
|
|
@@ -2935,9 +3001,9 @@ var Methods = {
|
|
|
2935
3001
|
|
|
2936
3002
|
if (!getEventTargetNode(evnt, document.body, 'vxe-table--ignore-areas-clear').flag) {
|
|
2937
3003
|
this.preventEvent(evnt, 'event.clearAreas', {}, function () {
|
|
2938
|
-
|
|
3004
|
+
_this24.clearCellAreas();
|
|
2939
3005
|
|
|
2940
|
-
|
|
3006
|
+
_this24.clearCopyCellArea();
|
|
2941
3007
|
});
|
|
2942
3008
|
}
|
|
2943
3009
|
}
|
|
@@ -2972,7 +3038,7 @@ var Methods = {
|
|
|
2972
3038
|
* 表格键盘事件
|
|
2973
3039
|
*/
|
|
2974
3040
|
keydownEvent: function keydownEvent(evnt) {
|
|
2975
|
-
var
|
|
3041
|
+
var _this25 = this;
|
|
2976
3042
|
|
|
2977
3043
|
var filterStore = this.filterStore,
|
|
2978
3044
|
ctxMenuStore = this.ctxMenuStore,
|
|
@@ -2987,33 +3053,33 @@ var Methods = {
|
|
|
2987
3053
|
|
|
2988
3054
|
if (isEsc) {
|
|
2989
3055
|
this.preventEvent(evnt, 'event.keydown', null, function () {
|
|
2990
|
-
if (keyboardConfig && mouseConfig && mouseOpts.area &&
|
|
2991
|
-
|
|
3056
|
+
if (keyboardConfig && mouseConfig && mouseOpts.area && _this25.handleKeyboardEvent) {
|
|
3057
|
+
_this25.handleKeyboardEvent(evnt);
|
|
2992
3058
|
} else if (actived.row || filterStore.visible || ctxMenuStore.visible) {
|
|
2993
3059
|
evnt.stopPropagation(); // 如果按下了 Esc 键,关闭快捷菜单、筛选
|
|
2994
3060
|
|
|
2995
|
-
|
|
3061
|
+
_this25.closeFilter();
|
|
2996
3062
|
|
|
2997
|
-
|
|
3063
|
+
_this25.closeMenu();
|
|
2998
3064
|
|
|
2999
3065
|
if (keyboardConfig && keyboardOpts.isEsc) {
|
|
3000
3066
|
// 如果是激活编辑状态,则取消编辑
|
|
3001
3067
|
if (actived.row) {
|
|
3002
3068
|
var params = actived.args;
|
|
3003
3069
|
|
|
3004
|
-
|
|
3070
|
+
_this25.clearActived(evnt); // 如果配置了选中功能,则为选中状态
|
|
3005
3071
|
|
|
3006
3072
|
|
|
3007
3073
|
if (mouseConfig && mouseOpts.selected) {
|
|
3008
|
-
|
|
3009
|
-
return
|
|
3074
|
+
_this25.$nextTick(function () {
|
|
3075
|
+
return _this25.handleSelected(params, evnt);
|
|
3010
3076
|
});
|
|
3011
3077
|
}
|
|
3012
3078
|
}
|
|
3013
3079
|
}
|
|
3014
3080
|
}
|
|
3015
3081
|
|
|
3016
|
-
|
|
3082
|
+
_this25.emitEvent('keydown', {}, evnt);
|
|
3017
3083
|
});
|
|
3018
3084
|
}
|
|
3019
3085
|
},
|
|
@@ -3022,27 +3088,27 @@ var Methods = {
|
|
|
3022
3088
|
* 全局键盘事件
|
|
3023
3089
|
*/
|
|
3024
3090
|
handleGlobalKeydownEvent: function handleGlobalKeydownEvent(evnt) {
|
|
3025
|
-
var
|
|
3091
|
+
var _this26 = this;
|
|
3026
3092
|
|
|
3027
3093
|
// 该行为只对当前激活的表格有效
|
|
3028
3094
|
if (this.isActivated) {
|
|
3029
3095
|
this.preventEvent(evnt, 'event.keydown', null, function () {
|
|
3030
|
-
var filterStore =
|
|
3031
|
-
isCtxMenu =
|
|
3032
|
-
ctxMenuStore =
|
|
3033
|
-
editStore =
|
|
3034
|
-
editOpts =
|
|
3035
|
-
editConfig =
|
|
3036
|
-
mouseConfig =
|
|
3037
|
-
mouseOpts =
|
|
3038
|
-
keyboardConfig =
|
|
3039
|
-
keyboardOpts =
|
|
3040
|
-
treeConfig =
|
|
3041
|
-
treeOpts =
|
|
3042
|
-
highlightCurrentRow =
|
|
3043
|
-
currentRow =
|
|
3044
|
-
bodyCtxMenu =
|
|
3045
|
-
rowOpts =
|
|
3096
|
+
var filterStore = _this26.filterStore,
|
|
3097
|
+
isCtxMenu = _this26.isCtxMenu,
|
|
3098
|
+
ctxMenuStore = _this26.ctxMenuStore,
|
|
3099
|
+
editStore = _this26.editStore,
|
|
3100
|
+
editOpts = _this26.editOpts,
|
|
3101
|
+
editConfig = _this26.editConfig,
|
|
3102
|
+
mouseConfig = _this26.mouseConfig,
|
|
3103
|
+
mouseOpts = _this26.mouseOpts,
|
|
3104
|
+
keyboardConfig = _this26.keyboardConfig,
|
|
3105
|
+
keyboardOpts = _this26.keyboardOpts,
|
|
3106
|
+
treeConfig = _this26.treeConfig,
|
|
3107
|
+
treeOpts = _this26.treeOpts,
|
|
3108
|
+
highlightCurrentRow = _this26.highlightCurrentRow,
|
|
3109
|
+
currentRow = _this26.currentRow,
|
|
3110
|
+
bodyCtxMenu = _this26.bodyCtxMenu,
|
|
3111
|
+
rowOpts = _this26.rowOpts;
|
|
3046
3112
|
var selected = editStore.selected,
|
|
3047
3113
|
actived = editStore.actived;
|
|
3048
3114
|
var keyCode = evnt.keyCode;
|
|
@@ -3069,7 +3135,7 @@ var Methods = {
|
|
|
3069
3135
|
|
|
3070
3136
|
if (filterStore.visible) {
|
|
3071
3137
|
if (isEsc) {
|
|
3072
|
-
|
|
3138
|
+
_this26.closeFilter();
|
|
3073
3139
|
}
|
|
3074
3140
|
|
|
3075
3141
|
return;
|
|
@@ -3080,20 +3146,20 @@ var Methods = {
|
|
|
3080
3146
|
evnt.preventDefault();
|
|
3081
3147
|
|
|
3082
3148
|
if (ctxMenuStore.showChild && hasChildrenList(ctxMenuStore.selected)) {
|
|
3083
|
-
|
|
3149
|
+
_this26.moveCtxMenu(evnt, keyCode, ctxMenuStore, 'selectChild', 37, false, ctxMenuStore.selected.children);
|
|
3084
3150
|
} else {
|
|
3085
|
-
|
|
3151
|
+
_this26.moveCtxMenu(evnt, keyCode, ctxMenuStore, 'selected', 39, true, _this26.ctxMenuList);
|
|
3086
3152
|
}
|
|
3087
|
-
} else if (keyboardConfig && mouseConfig && mouseOpts.area &&
|
|
3088
|
-
|
|
3153
|
+
} else if (keyboardConfig && mouseConfig && mouseOpts.area && _this26.handleKeyboardEvent) {
|
|
3154
|
+
_this26.handleKeyboardEvent(evnt);
|
|
3089
3155
|
} else if (keyboardConfig && isSpacebar && keyboardOpts.isChecked && selected.row && selected.column && (selected.column.type === 'checkbox' || selected.column.type === 'radio')) {
|
|
3090
3156
|
// 空格键支持选中复选框
|
|
3091
3157
|
evnt.preventDefault();
|
|
3092
3158
|
|
|
3093
3159
|
if (selected.column.type === 'checkbox') {
|
|
3094
|
-
|
|
3160
|
+
_this26.handleToggleCheckRowEvent(evnt, selected.args);
|
|
3095
3161
|
} else {
|
|
3096
|
-
|
|
3162
|
+
_this26.triggerRadioRowEvent(evnt, selected.args);
|
|
3097
3163
|
}
|
|
3098
3164
|
} else if (isF2 && (0, _utils.isEnableConf)(editConfig)) {
|
|
3099
3165
|
if (!isEditStatus) {
|
|
@@ -3102,15 +3168,15 @@ var Methods = {
|
|
|
3102
3168
|
evnt.stopPropagation();
|
|
3103
3169
|
evnt.preventDefault();
|
|
3104
3170
|
|
|
3105
|
-
|
|
3171
|
+
_this26.handleActived(selected.args, evnt);
|
|
3106
3172
|
}
|
|
3107
3173
|
}
|
|
3108
3174
|
} else if (isContextMenu) {
|
|
3109
3175
|
// 如果按下上下文键
|
|
3110
|
-
|
|
3111
|
-
clearTimeout(
|
|
3112
|
-
|
|
3113
|
-
|
|
3176
|
+
_this26._keyCtx = selected.row && selected.column && bodyCtxMenu.length;
|
|
3177
|
+
clearTimeout(_this26.keyCtxTimeout);
|
|
3178
|
+
_this26.keyCtxTimeout = setTimeout(function () {
|
|
3179
|
+
_this26._keyCtx = false;
|
|
3114
3180
|
}, 1000);
|
|
3115
3181
|
} else if (isEnter && !hasAltKey && keyboardConfig && keyboardOpts.isEnter && (selected.row || actived.row || treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow)) {
|
|
3116
3182
|
// 退出选中
|
|
@@ -3119,12 +3185,12 @@ var Methods = {
|
|
|
3119
3185
|
if (actived.row) {
|
|
3120
3186
|
params = actived.args;
|
|
3121
3187
|
|
|
3122
|
-
|
|
3188
|
+
_this26.clearActived(evnt); // 如果配置了选中功能,则为选中状态
|
|
3123
3189
|
|
|
3124
3190
|
|
|
3125
3191
|
if (mouseConfig && mouseOpts.selected) {
|
|
3126
|
-
|
|
3127
|
-
return
|
|
3192
|
+
_this26.$nextTick(function () {
|
|
3193
|
+
return _this26.handleSelected(params, evnt);
|
|
3128
3194
|
});
|
|
3129
3195
|
}
|
|
3130
3196
|
}
|
|
@@ -3135,15 +3201,15 @@ var Methods = {
|
|
|
3135
3201
|
|
|
3136
3202
|
if (hasShiftKey) {
|
|
3137
3203
|
if (keyboardOpts.enterToTab) {
|
|
3138
|
-
|
|
3204
|
+
_this26.moveTabSelected(targetArgs, hasShiftKey, evnt);
|
|
3139
3205
|
} else {
|
|
3140
|
-
|
|
3206
|
+
_this26.moveSelected(targetArgs, isLeftArrow, true, isRightArrow, false, evnt);
|
|
3141
3207
|
}
|
|
3142
3208
|
} else {
|
|
3143
3209
|
if (keyboardOpts.enterToTab) {
|
|
3144
|
-
|
|
3210
|
+
_this26.moveTabSelected(targetArgs, hasShiftKey, evnt);
|
|
3145
3211
|
} else {
|
|
3146
|
-
|
|
3212
|
+
_this26.moveSelected(targetArgs, isLeftArrow, false, isRightArrow, true, evnt);
|
|
3147
3213
|
}
|
|
3148
3214
|
}
|
|
3149
3215
|
} else if (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
|
|
@@ -3154,14 +3220,14 @@ var Methods = {
|
|
|
3154
3220
|
evnt.preventDefault();
|
|
3155
3221
|
var targetRow = childrens[0];
|
|
3156
3222
|
params = {
|
|
3157
|
-
$table:
|
|
3223
|
+
$table: _this26,
|
|
3158
3224
|
row: targetRow
|
|
3159
3225
|
};
|
|
3160
3226
|
|
|
3161
|
-
|
|
3162
|
-
return
|
|
3227
|
+
_this26.setTreeExpand(currentRow, true).then(function () {
|
|
3228
|
+
return _this26.scrollToRow(targetRow);
|
|
3163
3229
|
}).then(function () {
|
|
3164
|
-
return
|
|
3230
|
+
return _this26.triggerCurrentRowEvent(evnt, params);
|
|
3165
3231
|
});
|
|
3166
3232
|
}
|
|
3167
3233
|
}
|
|
@@ -3170,18 +3236,18 @@ var Methods = {
|
|
|
3170
3236
|
if (!isEditStatus) {
|
|
3171
3237
|
// 如果按下了方向键
|
|
3172
3238
|
if (selected.row && selected.column) {
|
|
3173
|
-
|
|
3239
|
+
_this26.moveSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt);
|
|
3174
3240
|
} else if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
|
|
3175
3241
|
// 当前行按键上下移动
|
|
3176
|
-
|
|
3242
|
+
_this26.moveCurrentRow(isUpArrow, isDwArrow, evnt);
|
|
3177
3243
|
}
|
|
3178
3244
|
}
|
|
3179
3245
|
} else if (isTab && keyboardConfig && keyboardOpts.isTab) {
|
|
3180
3246
|
// 如果按下了 Tab 键切换
|
|
3181
3247
|
if (selected.row || selected.column) {
|
|
3182
|
-
|
|
3248
|
+
_this26.moveTabSelected(selected.args, hasShiftKey, evnt);
|
|
3183
3249
|
} else if (actived.row || actived.column) {
|
|
3184
|
-
|
|
3250
|
+
_this26.moveTabSelected(actived.args, hasShiftKey, evnt);
|
|
3185
3251
|
}
|
|
3186
3252
|
} else if (keyboardConfig && (isDel || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow ? isBack && keyboardOpts.isArrow : isBack))) {
|
|
3187
3253
|
if (!isEditStatus) {
|
|
@@ -3192,10 +3258,10 @@ var Methods = {
|
|
|
3192
3258
|
if (delMethod) {
|
|
3193
3259
|
delMethod({
|
|
3194
3260
|
row: selected.row,
|
|
3195
|
-
rowIndex:
|
|
3261
|
+
rowIndex: _this26.getRowIndex(selected.row),
|
|
3196
3262
|
column: selected.column,
|
|
3197
|
-
columnIndex:
|
|
3198
|
-
$table:
|
|
3263
|
+
columnIndex: _this26.getColumnIndex(selected.column),
|
|
3264
|
+
$table: _this26
|
|
3199
3265
|
});
|
|
3200
3266
|
} else {
|
|
3201
3267
|
setCellValue(selected.row, selected.column, null);
|
|
@@ -3205,21 +3271,21 @@ var Methods = {
|
|
|
3205
3271
|
if (backMethod) {
|
|
3206
3272
|
backMethod({
|
|
3207
3273
|
row: selected.row,
|
|
3208
|
-
rowIndex:
|
|
3274
|
+
rowIndex: _this26.getRowIndex(selected.row),
|
|
3209
3275
|
column: selected.column,
|
|
3210
|
-
columnIndex:
|
|
3211
|
-
$table:
|
|
3276
|
+
columnIndex: _this26.getColumnIndex(selected.column),
|
|
3277
|
+
$table: _this26
|
|
3212
3278
|
});
|
|
3213
3279
|
} else {
|
|
3214
|
-
|
|
3280
|
+
_this26.handleActived(selected.args, evnt);
|
|
3215
3281
|
}
|
|
3216
3282
|
} else if (isDel) {
|
|
3217
3283
|
// 如果按下 del 键,更新表尾数据
|
|
3218
|
-
|
|
3284
|
+
_this26.updateFooter();
|
|
3219
3285
|
}
|
|
3220
3286
|
} else if (isBack && keyboardOpts.isArrow && treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
|
|
3221
3287
|
// 如果树形表格回退键关闭当前行返回父节点
|
|
3222
|
-
var _XEUtils$findTree = _xeUtils.default.findTree(
|
|
3288
|
+
var _XEUtils$findTree = _xeUtils.default.findTree(_this26.afterFullData, function (item) {
|
|
3223
3289
|
return item === currentRow;
|
|
3224
3290
|
}, treeOpts),
|
|
3225
3291
|
parentRow = _XEUtils$findTree.parent;
|
|
@@ -3227,14 +3293,14 @@ var Methods = {
|
|
|
3227
3293
|
if (parentRow) {
|
|
3228
3294
|
evnt.preventDefault();
|
|
3229
3295
|
params = {
|
|
3230
|
-
$table:
|
|
3296
|
+
$table: _this26,
|
|
3231
3297
|
row: parentRow
|
|
3232
3298
|
};
|
|
3233
3299
|
|
|
3234
|
-
|
|
3235
|
-
return
|
|
3300
|
+
_this26.setTreeExpand(parentRow, false).then(function () {
|
|
3301
|
+
return _this26.scrollToRow(parentRow);
|
|
3236
3302
|
}).then(function () {
|
|
3237
|
-
return
|
|
3303
|
+
return _this26.triggerCurrentRowEvent(evnt, params);
|
|
3238
3304
|
});
|
|
3239
3305
|
}
|
|
3240
3306
|
}
|
|
@@ -3251,21 +3317,21 @@ var Methods = {
|
|
|
3251
3317
|
if (editMethod) {
|
|
3252
3318
|
editMethod({
|
|
3253
3319
|
row: selected.row,
|
|
3254
|
-
rowIndex:
|
|
3320
|
+
rowIndex: _this26.getRowIndex(selected.row),
|
|
3255
3321
|
column: selected.column,
|
|
3256
|
-
columnIndex:
|
|
3257
|
-
$table:
|
|
3322
|
+
columnIndex: _this26.getColumnIndex(selected.column),
|
|
3323
|
+
$table: _this26
|
|
3258
3324
|
});
|
|
3259
3325
|
} else {
|
|
3260
3326
|
setCellValue(selected.row, selected.column, null);
|
|
3261
3327
|
|
|
3262
|
-
|
|
3328
|
+
_this26.handleActived(selected.args, evnt);
|
|
3263
3329
|
}
|
|
3264
3330
|
}
|
|
3265
3331
|
}
|
|
3266
3332
|
}
|
|
3267
3333
|
|
|
3268
|
-
|
|
3334
|
+
_this26.emitEvent('keydown', {}, evnt);
|
|
3269
3335
|
});
|
|
3270
3336
|
}
|
|
3271
3337
|
},
|
|
@@ -3335,12 +3401,12 @@ var Methods = {
|
|
|
3335
3401
|
this.recalculate(true);
|
|
3336
3402
|
},
|
|
3337
3403
|
handleTooltipLeaveMethod: function handleTooltipLeaveMethod() {
|
|
3338
|
-
var
|
|
3404
|
+
var _this27 = this;
|
|
3339
3405
|
|
|
3340
3406
|
var tooltipOpts = this.tooltipOpts;
|
|
3341
3407
|
setTimeout(function () {
|
|
3342
|
-
if (!
|
|
3343
|
-
|
|
3408
|
+
if (!_this27.tooltipActive) {
|
|
3409
|
+
_this27.closeTooltip();
|
|
3344
3410
|
}
|
|
3345
3411
|
}, tooltipOpts.leaveDelay);
|
|
3346
3412
|
return false;
|
|
@@ -3351,17 +3417,17 @@ var Methods = {
|
|
|
3351
3417
|
this.closeTooltip();
|
|
3352
3418
|
},
|
|
3353
3419
|
handleTargetLeaveEvent: function handleTargetLeaveEvent() {
|
|
3354
|
-
var
|
|
3420
|
+
var _this28 = this;
|
|
3355
3421
|
|
|
3356
3422
|
var tooltipOpts = this.tooltipOpts;
|
|
3357
3423
|
this.tooltipActive = false;
|
|
3358
3424
|
|
|
3359
3425
|
if (tooltipOpts.enterable) {
|
|
3360
3426
|
this.tooltipTimeout = setTimeout(function () {
|
|
3361
|
-
var tooltip =
|
|
3427
|
+
var tooltip = _this28.$refs.tooltip;
|
|
3362
3428
|
|
|
3363
3429
|
if (tooltip && !tooltip.isHover) {
|
|
3364
|
-
|
|
3430
|
+
_this28.closeTooltip();
|
|
3365
3431
|
}
|
|
3366
3432
|
}, tooltipOpts.leaveDelay);
|
|
3367
3433
|
} else {
|
|
@@ -3594,14 +3660,14 @@ var Methods = {
|
|
|
3594
3660
|
* @param {Boolean} value 是否选中
|
|
3595
3661
|
*/
|
|
3596
3662
|
setCheckboxRow: function setCheckboxRow(rows, value) {
|
|
3597
|
-
var
|
|
3663
|
+
var _this29 = this;
|
|
3598
3664
|
|
|
3599
3665
|
if (rows && !_xeUtils.default.isArray(rows)) {
|
|
3600
3666
|
rows = [rows];
|
|
3601
3667
|
}
|
|
3602
3668
|
|
|
3603
3669
|
rows.forEach(function (row) {
|
|
3604
|
-
return
|
|
3670
|
+
return _this29.handleSelectRow({
|
|
3605
3671
|
row: row
|
|
3606
3672
|
}, !!value);
|
|
3607
3673
|
});
|
|
@@ -3625,7 +3691,7 @@ var Methods = {
|
|
|
3625
3691
|
* value 选中true 不选false 半选-1
|
|
3626
3692
|
*/
|
|
3627
3693
|
handleSelectRow: function handleSelectRow(_ref5, value) {
|
|
3628
|
-
var
|
|
3694
|
+
var _this30 = this;
|
|
3629
3695
|
|
|
3630
3696
|
var row = _ref5.row;
|
|
3631
3697
|
var selection = this.selection,
|
|
@@ -3658,7 +3724,7 @@ var Methods = {
|
|
|
3658
3724
|
return half === item;
|
|
3659
3725
|
});
|
|
3660
3726
|
|
|
3661
|
-
|
|
3727
|
+
_this30.handleCheckboxReserveRow(row, value);
|
|
3662
3728
|
}
|
|
3663
3729
|
}, treeOpts);
|
|
3664
3730
|
} // 如果存在父节点,更新父节点状态
|
|
@@ -3732,7 +3798,7 @@ var Methods = {
|
|
|
3732
3798
|
return half === item;
|
|
3733
3799
|
});
|
|
3734
3800
|
|
|
3735
|
-
|
|
3801
|
+
_this30.handleCheckboxReserveRow(row, value);
|
|
3736
3802
|
}
|
|
3737
3803
|
}, treeOpts);
|
|
3738
3804
|
} // 如果存在父节点,更新父节点状态
|
|
@@ -3836,7 +3902,7 @@ var Methods = {
|
|
|
3836
3902
|
* @param {Boolean} value 是否选中
|
|
3837
3903
|
*/
|
|
3838
3904
|
setAllCheckboxRow: function setAllCheckboxRow(value) {
|
|
3839
|
-
var
|
|
3905
|
+
var _this31 = this;
|
|
3840
3906
|
|
|
3841
3907
|
var afterFullData = this.afterFullData,
|
|
3842
3908
|
treeConfig = this.treeConfig,
|
|
@@ -3949,11 +4015,11 @@ var Methods = {
|
|
|
3949
4015
|
if (reserve) {
|
|
3950
4016
|
if (value) {
|
|
3951
4017
|
selectRows.forEach(function (row) {
|
|
3952
|
-
checkboxReserveRowMap[getRowid(
|
|
4018
|
+
checkboxReserveRowMap[getRowid(_this31, row)] = row;
|
|
3953
4019
|
});
|
|
3954
4020
|
} else {
|
|
3955
4021
|
afterFullData.forEach(function (row) {
|
|
3956
|
-
return
|
|
4022
|
+
return _this31.handleCheckboxReserveRow(row, false);
|
|
3957
4023
|
});
|
|
3958
4024
|
}
|
|
3959
4025
|
}
|
|
@@ -4148,7 +4214,7 @@ var Methods = {
|
|
|
4148
4214
|
* 获取复选框保留选中的行
|
|
4149
4215
|
*/
|
|
4150
4216
|
getCheckboxReserveRecords: function getCheckboxReserveRecords(isFull) {
|
|
4151
|
-
var
|
|
4217
|
+
var _this32 = this;
|
|
4152
4218
|
|
|
4153
4219
|
var fullDataRowIdData = this.fullDataRowIdData,
|
|
4154
4220
|
afterFullData = this.afterFullData,
|
|
@@ -4163,11 +4229,11 @@ var Methods = {
|
|
|
4163
4229
|
|
|
4164
4230
|
if (treeConfig) {
|
|
4165
4231
|
_xeUtils.default.eachTree(afterFullData, function (row) {
|
|
4166
|
-
afterFullIdMaps[getRowid(
|
|
4232
|
+
afterFullIdMaps[getRowid(_this32, row)] = 1;
|
|
4167
4233
|
}, treeOpts);
|
|
4168
4234
|
} else {
|
|
4169
4235
|
afterFullData.forEach(function (row) {
|
|
4170
|
-
afterFullIdMaps[getRowid(
|
|
4236
|
+
afterFullIdMaps[getRowid(_this32, row)] = 1;
|
|
4171
4237
|
});
|
|
4172
4238
|
}
|
|
4173
4239
|
|
|
@@ -4233,7 +4299,7 @@ var Methods = {
|
|
|
4233
4299
|
* 清空行为不管是否被禁用还是保留记录,都将彻底清空选中状态
|
|
4234
4300
|
*/
|
|
4235
4301
|
clearCheckboxRow: function clearCheckboxRow() {
|
|
4236
|
-
var
|
|
4302
|
+
var _this33 = this;
|
|
4237
4303
|
|
|
4238
4304
|
var tableFullData = this.tableFullData,
|
|
4239
4305
|
treeConfig = this.treeConfig,
|
|
@@ -4256,7 +4322,7 @@ var Methods = {
|
|
|
4256
4322
|
|
|
4257
4323
|
if (reserve) {
|
|
4258
4324
|
tableFullData.forEach(function (row) {
|
|
4259
|
-
return
|
|
4325
|
+
return _this33.handleCheckboxReserveRow(row, false);
|
|
4260
4326
|
});
|
|
4261
4327
|
}
|
|
4262
4328
|
|
|
@@ -4548,13 +4614,13 @@ var Methods = {
|
|
|
4548
4614
|
* 如果存在规则,则校验
|
|
4549
4615
|
*/
|
|
4550
4616
|
handleChangeCell: function handleChangeCell(evnt, params) {
|
|
4551
|
-
var
|
|
4617
|
+
var _this34 = this;
|
|
4552
4618
|
|
|
4553
4619
|
this.checkValidate('blur').catch(function (e) {
|
|
4554
4620
|
return e;
|
|
4555
4621
|
}).then(function () {
|
|
4556
|
-
|
|
4557
|
-
return
|
|
4622
|
+
_this34.handleActived(params, evnt).then(function () {
|
|
4623
|
+
return _this34.checkValidate('change');
|
|
4558
4624
|
}).catch(function (e) {
|
|
4559
4625
|
return e;
|
|
4560
4626
|
});
|
|
@@ -4657,7 +4723,7 @@ var Methods = {
|
|
|
4657
4723
|
* 如果是双击模式,则激活为编辑状态
|
|
4658
4724
|
*/
|
|
4659
4725
|
triggerCellDblclickEvent: function triggerCellDblclickEvent(evnt, params) {
|
|
4660
|
-
var
|
|
4726
|
+
var _this35 = this;
|
|
4661
4727
|
|
|
4662
4728
|
var editStore = this.editStore,
|
|
4663
4729
|
editConfig = this.editConfig,
|
|
@@ -4672,15 +4738,15 @@ var Methods = {
|
|
|
4672
4738
|
this.checkValidate('blur').catch(function (e) {
|
|
4673
4739
|
return e;
|
|
4674
4740
|
}).then(function () {
|
|
4675
|
-
|
|
4676
|
-
return
|
|
4741
|
+
_this35.handleActived(params, evnt).then(function () {
|
|
4742
|
+
return _this35.checkValidate('change');
|
|
4677
4743
|
}).catch(function (e) {
|
|
4678
4744
|
return e;
|
|
4679
4745
|
});
|
|
4680
4746
|
});
|
|
4681
4747
|
} else if (editOpts.mode === 'cell') {
|
|
4682
4748
|
this.handleActived(params, evnt).then(function () {
|
|
4683
|
-
return
|
|
4749
|
+
return _this35.checkValidate('change');
|
|
4684
4750
|
}).catch(function (e) {
|
|
4685
4751
|
return e;
|
|
4686
4752
|
});
|
|
@@ -4691,7 +4757,7 @@ var Methods = {
|
|
|
4691
4757
|
this.emitEvent('cell-dblclick', params, evnt);
|
|
4692
4758
|
},
|
|
4693
4759
|
handleDefaultSort: function handleDefaultSort() {
|
|
4694
|
-
var
|
|
4760
|
+
var _this36 = this;
|
|
4695
4761
|
|
|
4696
4762
|
var sortConfig = this.sortConfig,
|
|
4697
4763
|
sortOpts = this.sortOpts;
|
|
@@ -4708,7 +4774,7 @@ var Methods = {
|
|
|
4708
4774
|
order = item.order;
|
|
4709
4775
|
|
|
4710
4776
|
if (field && order) {
|
|
4711
|
-
var column =
|
|
4777
|
+
var column = _this36.getColumnByField(field);
|
|
4712
4778
|
|
|
4713
4779
|
if (column && column.sortable) {
|
|
4714
4780
|
column.order = order;
|
|
@@ -4751,7 +4817,7 @@ var Methods = {
|
|
|
4751
4817
|
}
|
|
4752
4818
|
},
|
|
4753
4819
|
sort: function sort(sortConfs, sortOrder) {
|
|
4754
|
-
var
|
|
4820
|
+
var _this37 = this;
|
|
4755
4821
|
|
|
4756
4822
|
var sortOpts = this.sortOpts;
|
|
4757
4823
|
var multiple = sortOpts.multiple,
|
|
@@ -4784,7 +4850,7 @@ var Methods = {
|
|
|
4784
4850
|
var column = field;
|
|
4785
4851
|
|
|
4786
4852
|
if (_xeUtils.default.isString(field)) {
|
|
4787
|
-
column =
|
|
4853
|
+
column = _this37.getColumnByField(field);
|
|
4788
4854
|
}
|
|
4789
4855
|
|
|
4790
4856
|
if (column && (column.sortable || column.remoteSort)) {
|
|
@@ -4793,7 +4859,7 @@ var Methods = {
|
|
|
4793
4859
|
}
|
|
4794
4860
|
|
|
4795
4861
|
if (orders.indexOf(order) === -1) {
|
|
4796
|
-
order = getNextSortOrder(
|
|
4862
|
+
order = getNextSortOrder(_this37, column);
|
|
4797
4863
|
}
|
|
4798
4864
|
|
|
4799
4865
|
if (column.order !== order) {
|
|
@@ -4944,7 +5010,7 @@ var Methods = {
|
|
|
4944
5010
|
* @param {Row} row 行对象
|
|
4945
5011
|
*/
|
|
4946
5012
|
reloadRowExpand: function reloadRowExpand(row) {
|
|
4947
|
-
var
|
|
5013
|
+
var _this38 = this;
|
|
4948
5014
|
|
|
4949
5015
|
var expandOpts = this.expandOpts,
|
|
4950
5016
|
expandLazyLoadeds = this.expandLazyLoadeds;
|
|
@@ -4952,7 +5018,7 @@ var Methods = {
|
|
|
4952
5018
|
|
|
4953
5019
|
if (lazy && expandLazyLoadeds.indexOf(row) === -1) {
|
|
4954
5020
|
this.clearRowExpandLoaded(row).then(function () {
|
|
4955
|
-
return
|
|
5021
|
+
return _this38.handleAsyncRowExpand(row);
|
|
4956
5022
|
});
|
|
4957
5023
|
}
|
|
4958
5024
|
|
|
@@ -5031,29 +5097,29 @@ var Methods = {
|
|
|
5031
5097
|
return this.setRowExpand(this.expandOpts.lazy ? this.tableData : this.tableFullData, expanded);
|
|
5032
5098
|
},
|
|
5033
5099
|
handleAsyncRowExpand: function handleAsyncRowExpand(row) {
|
|
5034
|
-
var
|
|
5100
|
+
var _this39 = this;
|
|
5035
5101
|
|
|
5036
5102
|
var rest = this.fullAllDataRowMap.get(row);
|
|
5037
5103
|
return new Promise(function (resolve) {
|
|
5038
|
-
|
|
5104
|
+
_this39.expandLazyLoadeds.push(row);
|
|
5039
5105
|
|
|
5040
|
-
|
|
5041
|
-
$table:
|
|
5106
|
+
_this39.expandOpts.loadMethod({
|
|
5107
|
+
$table: _this39,
|
|
5042
5108
|
row: row,
|
|
5043
|
-
rowIndex:
|
|
5044
|
-
$rowIndex:
|
|
5109
|
+
rowIndex: _this39.getRowIndex(row),
|
|
5110
|
+
$rowIndex: _this39.getVMRowIndex(row)
|
|
5045
5111
|
}).catch(function (e) {
|
|
5046
5112
|
return e;
|
|
5047
5113
|
}).then(function () {
|
|
5048
5114
|
rest.expandLoaded = true;
|
|
5049
5115
|
|
|
5050
|
-
_xeUtils.default.remove(
|
|
5116
|
+
_xeUtils.default.remove(_this39.expandLazyLoadeds, function (item) {
|
|
5051
5117
|
return item === row;
|
|
5052
5118
|
});
|
|
5053
5119
|
|
|
5054
|
-
|
|
5120
|
+
_this39.rowExpandeds.push(row);
|
|
5055
5121
|
|
|
5056
|
-
resolve(
|
|
5122
|
+
resolve(_this39.$nextTick().then(_this39.recalculate));
|
|
5057
5123
|
});
|
|
5058
5124
|
});
|
|
5059
5125
|
},
|
|
@@ -5066,7 +5132,7 @@ var Methods = {
|
|
|
5066
5132
|
* @param {Boolean} expanded 是否展开
|
|
5067
5133
|
*/
|
|
5068
5134
|
setRowExpand: function setRowExpand(rows, expanded) {
|
|
5069
|
-
var
|
|
5135
|
+
var _this40 = this;
|
|
5070
5136
|
|
|
5071
5137
|
var fullAllDataRowMap = this.fullAllDataRowMap,
|
|
5072
5138
|
expandLazyLoadeds = this.expandLazyLoadeds,
|
|
@@ -5099,8 +5165,8 @@ var Methods = {
|
|
|
5099
5165
|
columnIndex: columnIndex,
|
|
5100
5166
|
$columnIndex: $columnIndex,
|
|
5101
5167
|
row: row,
|
|
5102
|
-
rowIndex:
|
|
5103
|
-
$rowIndex:
|
|
5168
|
+
rowIndex: _this40.getRowIndex(row),
|
|
5169
|
+
$rowIndex: _this40.getVMRowIndex(row)
|
|
5104
5170
|
});
|
|
5105
5171
|
}) : rows;
|
|
5106
5172
|
|
|
@@ -5111,7 +5177,7 @@ var Methods = {
|
|
|
5111
5177
|
var isLoad = lazy && !rest.expandLoaded && expandLazyLoadeds.indexOf(row) === -1;
|
|
5112
5178
|
|
|
5113
5179
|
if (isLoad) {
|
|
5114
|
-
lazyRests.push(
|
|
5180
|
+
lazyRests.push(_this40.handleAsyncRowExpand(row));
|
|
5115
5181
|
} else {
|
|
5116
5182
|
rowExpandeds.push(row);
|
|
5117
5183
|
}
|
|
@@ -5125,7 +5191,7 @@ var Methods = {
|
|
|
5125
5191
|
|
|
5126
5192
|
if (reserve) {
|
|
5127
5193
|
validRows.forEach(function (row) {
|
|
5128
|
-
return
|
|
5194
|
+
return _this40.handleRowExpandReserve(row, expanded);
|
|
5129
5195
|
});
|
|
5130
5196
|
}
|
|
5131
5197
|
}
|
|
@@ -5146,7 +5212,7 @@ var Methods = {
|
|
|
5146
5212
|
* 手动清空展开行状态,数据会恢复成未展开的状态
|
|
5147
5213
|
*/
|
|
5148
5214
|
clearRowExpand: function clearRowExpand() {
|
|
5149
|
-
var
|
|
5215
|
+
var _this41 = this;
|
|
5150
5216
|
|
|
5151
5217
|
var expandOpts = this.expandOpts,
|
|
5152
5218
|
rowExpandeds = this.rowExpandeds,
|
|
@@ -5157,13 +5223,13 @@ var Methods = {
|
|
|
5157
5223
|
|
|
5158
5224
|
if (reserve) {
|
|
5159
5225
|
tableFullData.forEach(function (row) {
|
|
5160
|
-
return
|
|
5226
|
+
return _this41.handleRowExpandReserve(row, false);
|
|
5161
5227
|
});
|
|
5162
5228
|
}
|
|
5163
5229
|
|
|
5164
5230
|
return this.$nextTick().then(function () {
|
|
5165
5231
|
if (isExists) {
|
|
5166
|
-
|
|
5232
|
+
_this41.recalculate();
|
|
5167
5233
|
}
|
|
5168
5234
|
});
|
|
5169
5235
|
},
|
|
@@ -5237,7 +5303,7 @@ var Methods = {
|
|
|
5237
5303
|
* @param {Row} row 行对象
|
|
5238
5304
|
*/
|
|
5239
5305
|
reloadTreeExpand: function reloadTreeExpand(row) {
|
|
5240
|
-
var
|
|
5306
|
+
var _this42 = this;
|
|
5241
5307
|
|
|
5242
5308
|
var treeOpts = this.treeOpts,
|
|
5243
5309
|
treeLazyLoadeds = this.treeLazyLoadeds;
|
|
@@ -5247,13 +5313,13 @@ var Methods = {
|
|
|
5247
5313
|
|
|
5248
5314
|
if (lazy && row[hasChild] && treeLazyLoadeds.indexOf(row) === -1) {
|
|
5249
5315
|
this.clearTreeExpandLoaded(row).then(function () {
|
|
5250
|
-
return
|
|
5316
|
+
return _this42.handleAsyncTreeExpandChilds(row);
|
|
5251
5317
|
}).then(function () {
|
|
5252
5318
|
if (transform) {
|
|
5253
|
-
return
|
|
5319
|
+
return _this42.handleTableData();
|
|
5254
5320
|
}
|
|
5255
5321
|
}).then(function () {
|
|
5256
|
-
return
|
|
5322
|
+
return _this42.recalculate();
|
|
5257
5323
|
});
|
|
5258
5324
|
}
|
|
5259
5325
|
|
|
@@ -5331,7 +5397,7 @@ var Methods = {
|
|
|
5331
5397
|
}
|
|
5332
5398
|
},
|
|
5333
5399
|
handleAsyncTreeExpandChilds: function handleAsyncTreeExpandChilds(row) {
|
|
5334
|
-
var
|
|
5400
|
+
var _this43 = this;
|
|
5335
5401
|
|
|
5336
5402
|
var fullAllDataRowMap = this.fullAllDataRowMap,
|
|
5337
5403
|
treeExpandeds = this.treeExpandeds,
|
|
@@ -5344,7 +5410,7 @@ var Methods = {
|
|
|
5344
5410
|
return new Promise(function (resolve) {
|
|
5345
5411
|
treeLazyLoadeds.push(row);
|
|
5346
5412
|
loadMethod({
|
|
5347
|
-
$table:
|
|
5413
|
+
$table: _this43,
|
|
5348
5414
|
row: row
|
|
5349
5415
|
}).catch(function () {
|
|
5350
5416
|
return [];
|
|
@@ -5360,19 +5426,19 @@ var Methods = {
|
|
|
5360
5426
|
}
|
|
5361
5427
|
|
|
5362
5428
|
if (childRecords) {
|
|
5363
|
-
|
|
5429
|
+
_this43.loadTreeChildren(row, childRecords).then(function (childRows) {
|
|
5364
5430
|
if (childRows.length && treeExpandeds.indexOf(row) === -1) {
|
|
5365
5431
|
treeExpandeds.push(row);
|
|
5366
5432
|
} // 如果当前节点已选中,则展开后子节点也被选中
|
|
5367
5433
|
|
|
5368
5434
|
|
|
5369
|
-
if (!checkStrictly &&
|
|
5370
|
-
|
|
5435
|
+
if (!checkStrictly && _this43.isCheckedByCheckboxRow(row)) {
|
|
5436
|
+
_this43.setCheckboxRow(childRows, true);
|
|
5371
5437
|
}
|
|
5372
5438
|
});
|
|
5373
5439
|
}
|
|
5374
5440
|
|
|
5375
|
-
resolve(
|
|
5441
|
+
resolve(_this43.$nextTick().then(_this43.recalculate));
|
|
5376
5442
|
});
|
|
5377
5443
|
});
|
|
5378
5444
|
},
|
|
@@ -5406,7 +5472,7 @@ var Methods = {
|
|
|
5406
5472
|
* @returns
|
|
5407
5473
|
*/
|
|
5408
5474
|
handleBaseTreeExpand: function handleBaseTreeExpand(rows, expanded) {
|
|
5409
|
-
var
|
|
5475
|
+
var _this44 = this;
|
|
5410
5476
|
|
|
5411
5477
|
var fullAllDataRowMap = this.fullAllDataRowMap,
|
|
5412
5478
|
tableFullData = this.tableFullData,
|
|
@@ -5454,7 +5520,7 @@ var Methods = {
|
|
|
5454
5520
|
var isLoad = lazy && row[hasChild] && !rest.treeLoaded && treeLazyLoadeds.indexOf(row) === -1; // 是否使用懒加载
|
|
5455
5521
|
|
|
5456
5522
|
if (isLoad) {
|
|
5457
|
-
result.push(
|
|
5523
|
+
result.push(_this44.handleAsyncTreeExpandChilds(row));
|
|
5458
5524
|
} else {
|
|
5459
5525
|
if (row[children] && row[children].length) {
|
|
5460
5526
|
treeExpandeds.push(row);
|
|
@@ -5470,40 +5536,12 @@ var Methods = {
|
|
|
5470
5536
|
|
|
5471
5537
|
if (reserve) {
|
|
5472
5538
|
validRows.forEach(function (row) {
|
|
5473
|
-
return
|
|
5539
|
+
return _this44.handleTreeExpandReserve(row, expanded);
|
|
5474
5540
|
});
|
|
5475
5541
|
}
|
|
5476
5542
|
|
|
5477
5543
|
return Promise.all(result).then(this.recalculate);
|
|
5478
5544
|
},
|
|
5479
|
-
updateVirtualTreeData: function updateVirtualTreeData() {
|
|
5480
|
-
var _this44 = this;
|
|
5481
|
-
|
|
5482
|
-
var oldScrollYLoad = this.scrollYLoad,
|
|
5483
|
-
treeExpandeds = this.treeExpandeds,
|
|
5484
|
-
treeOpts = this.treeOpts,
|
|
5485
|
-
treeFullData = this.treeFullData;
|
|
5486
|
-
var fullData = [];
|
|
5487
|
-
var expandMaps = new Map();
|
|
5488
|
-
|
|
5489
|
-
_xeUtils.default.eachTree(treeFullData, function (row, index, items, path, parent) {
|
|
5490
|
-
if (!parent || expandMaps.has(parent) && treeExpandeds.indexOf(parent) > -1) {
|
|
5491
|
-
expandMaps.set(row, 1);
|
|
5492
|
-
fullData.push(row);
|
|
5493
|
-
}
|
|
5494
|
-
}, treeOpts);
|
|
5495
|
-
|
|
5496
|
-
var scrollYLoad = this.updateScrollYStatus(fullData);
|
|
5497
|
-
this.tableFullData = scrollYLoad ? fullData : treeFullData;
|
|
5498
|
-
|
|
5499
|
-
if (scrollYLoad || oldScrollYLoad !== scrollYLoad) {
|
|
5500
|
-
return this.handleTableData(true).then(function () {
|
|
5501
|
-
return _this44.recalculate();
|
|
5502
|
-
});
|
|
5503
|
-
}
|
|
5504
|
-
|
|
5505
|
-
return this.$nextTick();
|
|
5506
|
-
},
|
|
5507
5545
|
|
|
5508
5546
|
/**
|
|
5509
5547
|
* 虚拟树的展开与收起
|
|
@@ -5515,7 +5553,7 @@ var Methods = {
|
|
|
5515
5553
|
var _this45 = this;
|
|
5516
5554
|
|
|
5517
5555
|
return this.handleBaseTreeExpand(rows, expanded).then(function () {
|
|
5518
|
-
return _this45.
|
|
5556
|
+
return _this45.handleTableData();
|
|
5519
5557
|
}).then(function () {
|
|
5520
5558
|
return _this45.recalculate();
|
|
5521
5559
|
});
|
|
@@ -5577,7 +5615,7 @@ var Methods = {
|
|
|
5577
5615
|
}, treeOpts);
|
|
5578
5616
|
}
|
|
5579
5617
|
|
|
5580
|
-
return this.
|
|
5618
|
+
return this.handleTableData().then(function () {
|
|
5581
5619
|
if (isExists) {
|
|
5582
5620
|
_this46.recalculate();
|
|
5583
5621
|
}
|