vxe-table 3.4.5 → 3.4.7-beta.2
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/README.en.md +1 -1
- package/README.md +1 -1
- package/README.zh-TW.md +1 -1
- package/lib/button/src/button.js +15 -14
- package/lib/button/src/button.min.js +1 -1
- package/lib/edit/src/mixin.js +19 -25
- package/lib/edit/src/mixin.min.js +1 -1
- package/lib/export/src/mixin.js +25 -10
- package/lib/export/src/mixin.min.js +1 -1
- package/lib/filter/src/mixin.js +25 -1
- package/lib/filter/src/mixin.min.js +1 -1
- package/lib/grid/src/grid.js +6 -3
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/index.umd.js +713 -423
- 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 +9 -17
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +16 -17
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/methods.js +503 -317
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +6 -6
- package/lib/table/src/util.js +7 -0
- package/lib/table/src/util.min.js +1 -1
- package/lib/tools/src/dom.js +2 -9
- package/lib/tools/src/dom.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 +5 -1
- package/lib/v-x-e-table/src/conf.min.js +1 -1
- package/package.json +3 -3
- package/packages/button/src/button.js +14 -14
- package/packages/edit/src/mixin.js +18 -21
- package/packages/export/src/mixin.js +17 -6
- package/packages/filter/src/mixin.js +20 -1
- package/packages/grid/src/grid.js +6 -2
- package/packages/select/src/select.js +1 -1
- package/packages/table/src/body.js +12 -16
- package/packages/table/src/cell.js +15 -15
- package/packages/table/src/methods.js +149 -47
- package/packages/table/src/table.js +6 -6
- package/packages/table/src/util.js +4 -0
- package/packages/tools/src/dom.js +2 -7
- package/packages/tools/src/utils.js +1 -1
- package/packages/v-x-e-table/src/conf.js +5 -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,23 @@ 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);
|
|
806
|
+
var seq = treeConfig && path ? (0, _util.toTreePathSeq)(path) : index + 1;
|
|
807
|
+
var level = nodes ? nodes.length - 1 : 0;
|
|
760
808
|
|
|
761
809
|
if ((0, _utils.eqEmptyValue)(rowid)) {
|
|
762
810
|
rowid = getRowUniqueId();
|
|
@@ -771,10 +819,13 @@ var Methods = {
|
|
|
771
819
|
var rest = {
|
|
772
820
|
row: row,
|
|
773
821
|
rowid: rowid,
|
|
822
|
+
seq: seq,
|
|
774
823
|
index: treeConfig && parent ? -1 : index,
|
|
824
|
+
_index: -1,
|
|
825
|
+
$index: -1,
|
|
775
826
|
items: items,
|
|
776
827
|
parent: parent,
|
|
777
|
-
level:
|
|
828
|
+
level: level
|
|
778
829
|
};
|
|
779
830
|
|
|
780
831
|
if (source) {
|
|
@@ -795,13 +846,13 @@ var Methods = {
|
|
|
795
846
|
fullAllDataRowMap.clear();
|
|
796
847
|
|
|
797
848
|
if (treeConfig) {
|
|
798
|
-
_xeUtils.default.eachTree(
|
|
849
|
+
_xeUtils.default.eachTree(tableFullTreeData, handleCache, treeOpts);
|
|
799
850
|
} else {
|
|
800
851
|
tableFullData.forEach(handleCache);
|
|
801
852
|
}
|
|
802
853
|
},
|
|
803
854
|
loadTreeChildren: function loadTreeChildren(row, childRecords) {
|
|
804
|
-
var
|
|
855
|
+
var _this10 = this;
|
|
805
856
|
|
|
806
857
|
var keepSource = this.keepSource,
|
|
807
858
|
tableSourceData = this.tableSourceData,
|
|
@@ -810,15 +861,17 @@ var Methods = {
|
|
|
810
861
|
fullDataRowMap = this.fullDataRowMap,
|
|
811
862
|
fullAllDataRowMap = this.fullAllDataRowMap,
|
|
812
863
|
fullAllDataRowIdData = this.fullAllDataRowIdData;
|
|
813
|
-
var
|
|
864
|
+
var transform = treeOpts.transform,
|
|
865
|
+
children = treeOpts.children,
|
|
866
|
+
mapChildren = treeOpts.mapChildren;
|
|
814
867
|
var rest = fullAllDataRowIdData[getRowid(this, row)];
|
|
815
868
|
var parentLevel = rest ? rest.level : 0;
|
|
816
869
|
return this.createData(childRecords).then(function (rows) {
|
|
817
870
|
if (keepSource) {
|
|
818
|
-
var rowid = getRowid(
|
|
871
|
+
var rowid = getRowid(_this10, row);
|
|
819
872
|
|
|
820
873
|
var matchObj = _xeUtils.default.findTree(tableSourceData, function (item) {
|
|
821
|
-
return rowid === getRowid(
|
|
874
|
+
return rowid === getRowid(_this10, item);
|
|
822
875
|
}, treeOpts);
|
|
823
876
|
|
|
824
877
|
if (matchObj) {
|
|
@@ -827,11 +880,14 @@ var Methods = {
|
|
|
827
880
|
}
|
|
828
881
|
|
|
829
882
|
_xeUtils.default.eachTree(rows, function (childRow, index, items, path, parent, nodes) {
|
|
830
|
-
var rowid = getRowid(
|
|
883
|
+
var rowid = getRowid(_this10, childRow);
|
|
831
884
|
var rest = {
|
|
832
885
|
row: childRow,
|
|
833
886
|
rowid: rowid,
|
|
887
|
+
seq: -1,
|
|
834
888
|
index: -1,
|
|
889
|
+
_index: -1,
|
|
890
|
+
$index: -1,
|
|
835
891
|
items: items,
|
|
836
892
|
parent: parent,
|
|
837
893
|
level: parentLevel + nodes.length
|
|
@@ -843,6 +899,11 @@ var Methods = {
|
|
|
843
899
|
}, treeOpts);
|
|
844
900
|
|
|
845
901
|
row[children] = rows;
|
|
902
|
+
|
|
903
|
+
if (transform) {
|
|
904
|
+
row[mapChildren] = rows;
|
|
905
|
+
}
|
|
906
|
+
|
|
846
907
|
return rows;
|
|
847
908
|
});
|
|
848
909
|
},
|
|
@@ -852,7 +913,7 @@ var Methods = {
|
|
|
852
913
|
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
853
914
|
*/
|
|
854
915
|
cacheColumnMap: function cacheColumnMap() {
|
|
855
|
-
var
|
|
916
|
+
var _this11 = this;
|
|
856
917
|
|
|
857
918
|
var tableFullColumn = this.tableFullColumn,
|
|
858
919
|
collectColumn = this.collectColumn,
|
|
@@ -939,16 +1000,16 @@ var Methods = {
|
|
|
939
1000
|
}
|
|
940
1001
|
|
|
941
1002
|
if (process.env.NODE_ENV === 'development') {
|
|
942
|
-
if (
|
|
943
|
-
_tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-overflow=".concat(
|
|
1003
|
+
if (_this11.showOverflow && column.showOverflow === false) {
|
|
1004
|
+
_tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-overflow=".concat(_this11.showOverflow), "column.show-overflow=".concat(column.showOverflow)]);
|
|
944
1005
|
}
|
|
945
1006
|
|
|
946
|
-
if (
|
|
947
|
-
_tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-header-overflow=".concat(
|
|
1007
|
+
if (_this11.showHeaderOverflow && column.showHeaderOverflow === false) {
|
|
1008
|
+
_tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-header-overflow=".concat(_this11.showHeaderOverflow), "column.show-header-overflow=".concat(column.showHeaderOverflow)]);
|
|
948
1009
|
}
|
|
949
1010
|
|
|
950
|
-
if (
|
|
951
|
-
_tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-footer-overflow=".concat(
|
|
1011
|
+
if (_this11.showFooterOverflow && column.showFooterOverflow === false) {
|
|
1012
|
+
_tools.UtilTools.warn('vxe.error.errConflicts', ["table.show-footer-overflow=".concat(_this11.showFooterOverflow), "column.show-footer-overflow=".concat(column.showFooterOverflow)]);
|
|
952
1013
|
}
|
|
953
1014
|
}
|
|
954
1015
|
|
|
@@ -1035,6 +1096,25 @@ var Methods = {
|
|
|
1035
1096
|
return null;
|
|
1036
1097
|
},
|
|
1037
1098
|
|
|
1099
|
+
/**
|
|
1100
|
+
* 根据 row 获取序号
|
|
1101
|
+
* @param {Row} row 行对象
|
|
1102
|
+
*/
|
|
1103
|
+
getRowSeq: function getRowSeq(row) {
|
|
1104
|
+
var fullDataRowIdData = this.fullDataRowIdData;
|
|
1105
|
+
|
|
1106
|
+
if (row) {
|
|
1107
|
+
var rowid = getRowid(this, row);
|
|
1108
|
+
var rest = fullDataRowIdData[rowid];
|
|
1109
|
+
|
|
1110
|
+
if (rest) {
|
|
1111
|
+
return rest.seq;
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
return -1;
|
|
1116
|
+
},
|
|
1117
|
+
|
|
1038
1118
|
/**
|
|
1039
1119
|
* 根据 row 获取相对于 data 中的索引
|
|
1040
1120
|
* @param {Row} row 行对象
|
|
@@ -1181,13 +1261,13 @@ var Methods = {
|
|
|
1181
1261
|
* @param {Array} records 新数据
|
|
1182
1262
|
*/
|
|
1183
1263
|
createData: function createData(records) {
|
|
1184
|
-
var
|
|
1264
|
+
var _this12 = this;
|
|
1185
1265
|
|
|
1186
1266
|
var treeConfig = this.treeConfig,
|
|
1187
1267
|
treeOpts = this.treeOpts;
|
|
1188
1268
|
|
|
1189
1269
|
var handleRrecord = function handleRrecord(record) {
|
|
1190
|
-
return
|
|
1270
|
+
return _this12.defineField(Object.assign({}, record));
|
|
1191
1271
|
};
|
|
1192
1272
|
|
|
1193
1273
|
var rows = treeConfig ? _xeUtils.default.mapTree(records, handleRrecord, treeOpts) : records.map(handleRrecord);
|
|
@@ -1202,7 +1282,7 @@ var Methods = {
|
|
|
1202
1282
|
* @param {Array/Object} records 新数据
|
|
1203
1283
|
*/
|
|
1204
1284
|
createRow: function createRow(records) {
|
|
1205
|
-
var
|
|
1285
|
+
var _this13 = this;
|
|
1206
1286
|
|
|
1207
1287
|
var isArr = _xeUtils.default.isArray(records);
|
|
1208
1288
|
|
|
@@ -1211,7 +1291,7 @@ var Methods = {
|
|
|
1211
1291
|
}
|
|
1212
1292
|
|
|
1213
1293
|
return this.$nextTick().then(function () {
|
|
1214
|
-
return
|
|
1294
|
+
return _this13.createData(records).then(function (rows) {
|
|
1215
1295
|
return isArr ? rows : rows[0];
|
|
1216
1296
|
});
|
|
1217
1297
|
});
|
|
@@ -1225,7 +1305,7 @@ var Methods = {
|
|
|
1225
1305
|
* 如果还额外传了 field 则还原指定的单元格数据
|
|
1226
1306
|
*/
|
|
1227
1307
|
revertData: function revertData(rows, field) {
|
|
1228
|
-
var
|
|
1308
|
+
var _this14 = this;
|
|
1229
1309
|
|
|
1230
1310
|
var keepSource = this.keepSource,
|
|
1231
1311
|
tableSourceData = this.tableSourceData,
|
|
@@ -1251,8 +1331,8 @@ var Methods = {
|
|
|
1251
1331
|
|
|
1252
1332
|
if (targetRows.length) {
|
|
1253
1333
|
targetRows.forEach(function (row) {
|
|
1254
|
-
if (!
|
|
1255
|
-
var rowIndex =
|
|
1334
|
+
if (!_this14.isInsertByRow(row)) {
|
|
1335
|
+
var rowIndex = _this14.getRowIndex(row);
|
|
1256
1336
|
|
|
1257
1337
|
if (treeConfig && rowIndex === -1) {
|
|
1258
1338
|
throw new Error(_tools.UtilTools.getLog('vxe.error.noTree', ['revertData']));
|
|
@@ -1336,7 +1416,7 @@ var Methods = {
|
|
|
1336
1416
|
* @param {String} field 字段名
|
|
1337
1417
|
*/
|
|
1338
1418
|
isUpdateByRow: function isUpdateByRow(row, field) {
|
|
1339
|
-
var
|
|
1419
|
+
var _this15 = this;
|
|
1340
1420
|
|
|
1341
1421
|
var visibleColumn = this.visibleColumn,
|
|
1342
1422
|
keepSource = this.keepSource,
|
|
@@ -1357,7 +1437,7 @@ var Methods = {
|
|
|
1357
1437
|
var children = treeOpts.children;
|
|
1358
1438
|
|
|
1359
1439
|
var matchObj = _xeUtils.default.findTree(tableSourceData, function (item) {
|
|
1360
|
-
return rowid === getRowid(
|
|
1440
|
+
return rowid === getRowid(_this15, item);
|
|
1361
1441
|
}, treeOpts);
|
|
1362
1442
|
|
|
1363
1443
|
row = Object.assign({}, row, _defineProperty({}, children, null));
|
|
@@ -1481,18 +1561,23 @@ var Methods = {
|
|
|
1481
1561
|
* 如果存在筛选条件,继续处理
|
|
1482
1562
|
*/
|
|
1483
1563
|
updateAfterFullData: function updateAfterFullData() {
|
|
1484
|
-
var
|
|
1564
|
+
var _this16 = this;
|
|
1485
1565
|
|
|
1486
1566
|
var tableFullColumn = this.tableFullColumn,
|
|
1487
1567
|
tableFullData = this.tableFullData,
|
|
1488
1568
|
filterOpts = this.filterOpts,
|
|
1489
|
-
sortOpts = this.sortOpts
|
|
1569
|
+
sortOpts = this.sortOpts,
|
|
1570
|
+
treeConfig = this.treeConfig,
|
|
1571
|
+
treeOpts = this.treeOpts,
|
|
1572
|
+
tableFullTreeData = this.tableFullTreeData;
|
|
1490
1573
|
var allRemoteFilter = filterOpts.remote,
|
|
1491
1574
|
allFilterMethod = filterOpts.filterMethod;
|
|
1492
1575
|
var allRemoteSort = sortOpts.remote,
|
|
1493
1576
|
allSortMethod = sortOpts.sortMethod,
|
|
1494
1577
|
sortMultiple = sortOpts.multiple;
|
|
1495
|
-
var
|
|
1578
|
+
var transform = treeOpts.transform;
|
|
1579
|
+
var tableData = [];
|
|
1580
|
+
var tableTree = [];
|
|
1496
1581
|
var filterColumns = [];
|
|
1497
1582
|
var orderColumns = [];
|
|
1498
1583
|
tableFullColumn.forEach(function (column) {
|
|
@@ -1529,7 +1614,7 @@ var Methods = {
|
|
|
1529
1614
|
});
|
|
1530
1615
|
|
|
1531
1616
|
if (filterColumns.length) {
|
|
1532
|
-
|
|
1617
|
+
var handleFilter = function handleFilter(row) {
|
|
1533
1618
|
return filterColumns.every(function (_ref) {
|
|
1534
1619
|
var column = _ref.column,
|
|
1535
1620
|
valueList = _ref.valueList,
|
|
@@ -1552,7 +1637,7 @@ var Methods = {
|
|
|
1552
1637
|
cellValue: cellValue,
|
|
1553
1638
|
row: row,
|
|
1554
1639
|
column: column,
|
|
1555
|
-
$table:
|
|
1640
|
+
$table: _this16
|
|
1556
1641
|
});
|
|
1557
1642
|
});
|
|
1558
1643
|
} else if (compFilterMethod) {
|
|
@@ -1563,7 +1648,7 @@ var Methods = {
|
|
|
1563
1648
|
cellValue: cellValue,
|
|
1564
1649
|
row: row,
|
|
1565
1650
|
column: column,
|
|
1566
|
-
$table:
|
|
1651
|
+
$table: _this16
|
|
1567
1652
|
});
|
|
1568
1653
|
});
|
|
1569
1654
|
} else if (allFilterMethod) {
|
|
@@ -1582,7 +1667,7 @@ var Methods = {
|
|
|
1582
1667
|
cellValue: cellValue,
|
|
1583
1668
|
row: row,
|
|
1584
1669
|
column: column,
|
|
1585
|
-
$table:
|
|
1670
|
+
$table: _this16
|
|
1586
1671
|
});
|
|
1587
1672
|
});
|
|
1588
1673
|
}
|
|
@@ -1592,7 +1677,19 @@ var Methods = {
|
|
|
1592
1677
|
|
|
1593
1678
|
return true;
|
|
1594
1679
|
});
|
|
1595
|
-
}
|
|
1680
|
+
};
|
|
1681
|
+
|
|
1682
|
+
if (treeConfig && transform) {
|
|
1683
|
+
tableTree = _xeUtils.default.searchTree(tableFullTreeData, handleFilter, _objectSpread(_objectSpread({}, treeOpts), {}, {
|
|
1684
|
+
original: true
|
|
1685
|
+
}));
|
|
1686
|
+
} else {
|
|
1687
|
+
tableData = treeConfig ? tableFullTreeData.filter(handleFilter) : tableFullData.filter(handleFilter);
|
|
1688
|
+
tableTree = tableData;
|
|
1689
|
+
}
|
|
1690
|
+
} else {
|
|
1691
|
+
tableData = treeConfig ? tableFullTreeData.slice(0) : tableFullData.slice(0);
|
|
1692
|
+
tableTree = tableData;
|
|
1596
1693
|
}
|
|
1597
1694
|
|
|
1598
1695
|
var firstOrderColumn = orderColumns[0];
|
|
@@ -1614,7 +1711,7 @@ var Methods = {
|
|
|
1614
1711
|
tableData = _xeUtils.default.orderBy(tableData, orderColumns.map(function (_ref2) {
|
|
1615
1712
|
var column = _ref2.column,
|
|
1616
1713
|
order = _ref2.order;
|
|
1617
|
-
return [getOrderField(
|
|
1714
|
+
return [getOrderField(_this16, column), order];
|
|
1618
1715
|
}));
|
|
1619
1716
|
} else {
|
|
1620
1717
|
// 兼容 v2,在 v4 中废弃, sortBy 不能为数组
|
|
@@ -1629,14 +1726,113 @@ var Methods = {
|
|
|
1629
1726
|
tableData = _xeUtils.default.orderBy(tableData, sortByConfs || [firstOrderColumn].map(function (_ref3) {
|
|
1630
1727
|
var column = _ref3.column,
|
|
1631
1728
|
order = _ref3.order;
|
|
1632
|
-
return [getOrderField(
|
|
1729
|
+
return [getOrderField(_this16, column), order];
|
|
1633
1730
|
}));
|
|
1634
1731
|
}
|
|
1635
1732
|
}
|
|
1733
|
+
|
|
1734
|
+
tableTree = tableData;
|
|
1636
1735
|
}
|
|
1637
1736
|
|
|
1638
1737
|
this.afterFullData = tableData;
|
|
1639
|
-
|
|
1738
|
+
this.afterTreeFullData = tableTree;
|
|
1739
|
+
this.updateAfterDataIndex();
|
|
1740
|
+
},
|
|
1741
|
+
|
|
1742
|
+
/**
|
|
1743
|
+
* 预编译
|
|
1744
|
+
* 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
|
|
1745
|
+
*/
|
|
1746
|
+
updateAfterDataIndex: function updateAfterDataIndex() {
|
|
1747
|
+
var _this17 = this;
|
|
1748
|
+
|
|
1749
|
+
var treeConfig = this.treeConfig,
|
|
1750
|
+
afterFullData = this.afterFullData,
|
|
1751
|
+
fullDataRowIdData = this.fullDataRowIdData,
|
|
1752
|
+
fullAllDataRowIdData = this.fullAllDataRowIdData,
|
|
1753
|
+
afterTreeFullData = this.afterTreeFullData,
|
|
1754
|
+
treeOpts = this.treeOpts;
|
|
1755
|
+
|
|
1756
|
+
if (treeConfig) {
|
|
1757
|
+
_xeUtils.default.eachTree(afterTreeFullData, function (row, index, items, path) {
|
|
1758
|
+
var rowid = getRowid(_this17, row);
|
|
1759
|
+
var allrest = fullAllDataRowIdData[rowid];
|
|
1760
|
+
var fullrest = fullDataRowIdData[rowid];
|
|
1761
|
+
var seq = path.map(function (num, i) {
|
|
1762
|
+
return i % 2 === 0 ? Number(num) + 1 : '.';
|
|
1763
|
+
}).join('');
|
|
1764
|
+
|
|
1765
|
+
if (allrest) {
|
|
1766
|
+
allrest.seq = seq;
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
if (fullrest) {
|
|
1770
|
+
fullrest.seq = seq;
|
|
1771
|
+
} else {
|
|
1772
|
+
fullAllDataRowIdData[rowid] = {
|
|
1773
|
+
row: row,
|
|
1774
|
+
rowid: rowid,
|
|
1775
|
+
seq: seq,
|
|
1776
|
+
index: -1,
|
|
1777
|
+
$index: -1,
|
|
1778
|
+
_index: index,
|
|
1779
|
+
items: [],
|
|
1780
|
+
parent: null,
|
|
1781
|
+
level: 0
|
|
1782
|
+
};
|
|
1783
|
+
fullDataRowIdData[rowid] = {
|
|
1784
|
+
row: row,
|
|
1785
|
+
rowid: rowid,
|
|
1786
|
+
seq: seq,
|
|
1787
|
+
index: -1,
|
|
1788
|
+
$index: -1,
|
|
1789
|
+
_index: index,
|
|
1790
|
+
items: [],
|
|
1791
|
+
parent: null,
|
|
1792
|
+
level: 0
|
|
1793
|
+
};
|
|
1794
|
+
}
|
|
1795
|
+
}, treeOpts);
|
|
1796
|
+
} else {
|
|
1797
|
+
afterFullData.forEach(function (row, index) {
|
|
1798
|
+
var rowid = getRowid(_this17, row);
|
|
1799
|
+
var allrest = fullAllDataRowIdData[rowid];
|
|
1800
|
+
var fullrest = fullDataRowIdData[rowid];
|
|
1801
|
+
var seq = index + 1;
|
|
1802
|
+
|
|
1803
|
+
if (allrest) {
|
|
1804
|
+
allrest.seq = seq;
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
if (fullrest) {
|
|
1808
|
+
fullrest.seq = seq;
|
|
1809
|
+
fullrest._index = index;
|
|
1810
|
+
} else {
|
|
1811
|
+
fullAllDataRowIdData[rowid] = {
|
|
1812
|
+
row: row,
|
|
1813
|
+
rowid: rowid,
|
|
1814
|
+
seq: seq,
|
|
1815
|
+
index: -1,
|
|
1816
|
+
$index: -1,
|
|
1817
|
+
_index: index,
|
|
1818
|
+
items: [],
|
|
1819
|
+
parent: null,
|
|
1820
|
+
level: 0
|
|
1821
|
+
};
|
|
1822
|
+
fullDataRowIdData[rowid] = {
|
|
1823
|
+
row: row,
|
|
1824
|
+
rowid: rowid,
|
|
1825
|
+
seq: seq,
|
|
1826
|
+
index: -1,
|
|
1827
|
+
$index: -1,
|
|
1828
|
+
_index: index,
|
|
1829
|
+
items: [],
|
|
1830
|
+
parent: null,
|
|
1831
|
+
level: 0
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1834
|
+
});
|
|
1835
|
+
}
|
|
1640
1836
|
},
|
|
1641
1837
|
|
|
1642
1838
|
/**
|
|
@@ -1680,7 +1876,7 @@ var Methods = {
|
|
|
1680
1876
|
* 默认执行一次,除非被重置
|
|
1681
1877
|
*/
|
|
1682
1878
|
handleLoadDefaults: function handleLoadDefaults() {
|
|
1683
|
-
var
|
|
1879
|
+
var _this18 = this;
|
|
1684
1880
|
|
|
1685
1881
|
if (this.checkboxConfig) {
|
|
1686
1882
|
this.handleDefaultSelectionChecked();
|
|
@@ -1707,7 +1903,7 @@ var Methods = {
|
|
|
1707
1903
|
}
|
|
1708
1904
|
|
|
1709
1905
|
this.$nextTick(function () {
|
|
1710
|
-
return setTimeout(
|
|
1906
|
+
return setTimeout(_this18.recalculate);
|
|
1711
1907
|
});
|
|
1712
1908
|
},
|
|
1713
1909
|
|
|
@@ -1964,12 +2160,12 @@ var Methods = {
|
|
|
1964
2160
|
* 刷新列配置
|
|
1965
2161
|
*/
|
|
1966
2162
|
refreshColumn: function refreshColumn() {
|
|
1967
|
-
var
|
|
2163
|
+
var _this19 = this;
|
|
1968
2164
|
|
|
1969
2165
|
return this.parseColumns().then(function () {
|
|
1970
|
-
return
|
|
2166
|
+
return _this19.refreshScroll();
|
|
1971
2167
|
}).then(function () {
|
|
1972
|
-
return
|
|
2168
|
+
return _this19.recalculate();
|
|
1973
2169
|
});
|
|
1974
2170
|
},
|
|
1975
2171
|
|
|
@@ -1978,7 +2174,7 @@ var Methods = {
|
|
|
1978
2174
|
* 将固定的列左边、右边分别靠边
|
|
1979
2175
|
*/
|
|
1980
2176
|
parseColumns: function parseColumns() {
|
|
1981
|
-
var
|
|
2177
|
+
var _this20 = this;
|
|
1982
2178
|
|
|
1983
2179
|
var leftList = [];
|
|
1984
2180
|
var centerList = [];
|
|
@@ -2105,11 +2301,11 @@ var Methods = {
|
|
|
2105
2301
|
this.visibleColumn = visibleColumn;
|
|
2106
2302
|
this.handleTableColumn();
|
|
2107
2303
|
return this.updateFooter().then(function () {
|
|
2108
|
-
return
|
|
2304
|
+
return _this20.recalculate();
|
|
2109
2305
|
}).then(function () {
|
|
2110
|
-
|
|
2306
|
+
_this20.updateCellAreas();
|
|
2111
2307
|
|
|
2112
|
-
return
|
|
2308
|
+
return _this20.recalculate();
|
|
2113
2309
|
});
|
|
2114
2310
|
},
|
|
2115
2311
|
|
|
@@ -2193,7 +2389,7 @@ var Methods = {
|
|
|
2193
2389
|
* 支持 width=? width=?px width=?% min-width=? min-width=?px min-width=?%
|
|
2194
2390
|
*/
|
|
2195
2391
|
recalculate: function recalculate(refull) {
|
|
2196
|
-
var
|
|
2392
|
+
var _this21 = this;
|
|
2197
2393
|
|
|
2198
2394
|
var $refs = this.$refs;
|
|
2199
2395
|
var tableBody = $refs.tableBody,
|
|
@@ -2209,9 +2405,9 @@ var Methods = {
|
|
|
2209
2405
|
if (refull === true) {
|
|
2210
2406
|
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
2211
2407
|
return this.computeScrollLoad().then(function () {
|
|
2212
|
-
|
|
2408
|
+
_this21.autoCellWidth(headerElem, bodyElem, footerElem);
|
|
2213
2409
|
|
|
2214
|
-
return
|
|
2410
|
+
return _this21.computeScrollLoad();
|
|
2215
2411
|
});
|
|
2216
2412
|
}
|
|
2217
2413
|
}
|
|
@@ -2359,7 +2555,7 @@ var Methods = {
|
|
|
2359
2555
|
this.customMaxHeight = calcHeight(this, 'maxHeight');
|
|
2360
2556
|
},
|
|
2361
2557
|
updateStyle: function updateStyle() {
|
|
2362
|
-
var
|
|
2558
|
+
var _this22 = this;
|
|
2363
2559
|
|
|
2364
2560
|
var $refs = this.$refs,
|
|
2365
2561
|
isGroup = this.isGroup,
|
|
@@ -2463,7 +2659,7 @@ var Methods = {
|
|
|
2463
2659
|
|
|
2464
2660
|
if (isGroup && listElem) {
|
|
2465
2661
|
_xeUtils.default.arrayEach(listElem.querySelectorAll('.col--group'), function (thElem) {
|
|
2466
|
-
var colNode =
|
|
2662
|
+
var colNode = _this22.getColumnNode(thElem);
|
|
2467
2663
|
|
|
2468
2664
|
if (colNode) {
|
|
2469
2665
|
var column = colNode.item;
|
|
@@ -2644,10 +2840,10 @@ var Methods = {
|
|
|
2644
2840
|
|
|
2645
2841
|
if (cellElem) {
|
|
2646
2842
|
if (colspan > 1) {
|
|
2647
|
-
var columnIndex =
|
|
2843
|
+
var columnIndex = _this22.getColumnIndex(column);
|
|
2648
2844
|
|
|
2649
2845
|
for (var _index = 1; _index < colspan; _index++) {
|
|
2650
|
-
var nextColumn =
|
|
2846
|
+
var nextColumn = _this22.getColumns(columnIndex + _index);
|
|
2651
2847
|
|
|
2652
2848
|
if (nextColumn) {
|
|
2653
2849
|
colWidth += nextColumn.renderWidth;
|
|
@@ -2697,7 +2893,7 @@ var Methods = {
|
|
|
2697
2893
|
}
|
|
2698
2894
|
},
|
|
2699
2895
|
preventEvent: function preventEvent(evnt, type, args, next, end) {
|
|
2700
|
-
var
|
|
2896
|
+
var _this23 = this;
|
|
2701
2897
|
|
|
2702
2898
|
var evntList = _vXETable.default.interceptor.get(type);
|
|
2703
2899
|
|
|
@@ -2705,8 +2901,8 @@ var Methods = {
|
|
|
2705
2901
|
|
|
2706
2902
|
if (!evntList.some(function (func) {
|
|
2707
2903
|
return func(Object.assign({
|
|
2708
|
-
$grid:
|
|
2709
|
-
$table:
|
|
2904
|
+
$grid: _this23.$xegrid,
|
|
2905
|
+
$table: _this23,
|
|
2710
2906
|
$event: evnt
|
|
2711
2907
|
}, args)) === false;
|
|
2712
2908
|
})) {
|
|
@@ -2726,7 +2922,7 @@ var Methods = {
|
|
|
2726
2922
|
* 全局按下事件处理
|
|
2727
2923
|
*/
|
|
2728
2924
|
handleGlobalMousedownEvent: function handleGlobalMousedownEvent(evnt) {
|
|
2729
|
-
var
|
|
2925
|
+
var _this24 = this;
|
|
2730
2926
|
|
|
2731
2927
|
var $el = this.$el,
|
|
2732
2928
|
$refs = this.$refs,
|
|
@@ -2787,7 +2983,7 @@ var Methods = {
|
|
|
2787
2983
|
} // 如果固定了高度且点击了行之外的空白处,则清除激活状态
|
|
2788
2984
|
|
|
2789
2985
|
|
|
2790
|
-
if (!isClearActived &&
|
|
2986
|
+
if (!isClearActived && _this24.height && !_this24.overflowY) {
|
|
2791
2987
|
var bodyWrapperElem = evnt.target;
|
|
2792
2988
|
|
|
2793
2989
|
if (hasClass(bodyWrapperElem, 'vxe-table--body-wrapper')) {
|
|
@@ -2798,7 +2994,7 @@ var Methods = {
|
|
|
2798
2994
|
if (isClearActived || // 如果点击了当前表格之外
|
|
2799
2995
|
!getEventTargetNode(evnt, $el).flag) {
|
|
2800
2996
|
setTimeout(function () {
|
|
2801
|
-
return
|
|
2997
|
+
return _this24.clearActived(evnt);
|
|
2802
2998
|
});
|
|
2803
2999
|
}
|
|
2804
3000
|
});
|
|
@@ -2812,9 +3008,9 @@ var Methods = {
|
|
|
2812
3008
|
|
|
2813
3009
|
if (!getEventTargetNode(evnt, document.body, 'vxe-table--ignore-areas-clear').flag) {
|
|
2814
3010
|
this.preventEvent(evnt, 'event.clearAreas', {}, function () {
|
|
2815
|
-
|
|
3011
|
+
_this24.clearCellAreas();
|
|
2816
3012
|
|
|
2817
|
-
|
|
3013
|
+
_this24.clearCopyCellArea();
|
|
2818
3014
|
});
|
|
2819
3015
|
}
|
|
2820
3016
|
}
|
|
@@ -2849,45 +3045,48 @@ var Methods = {
|
|
|
2849
3045
|
* 表格键盘事件
|
|
2850
3046
|
*/
|
|
2851
3047
|
keydownEvent: function keydownEvent(evnt) {
|
|
2852
|
-
var
|
|
3048
|
+
var _this25 = this;
|
|
2853
3049
|
|
|
2854
3050
|
var filterStore = this.filterStore,
|
|
2855
3051
|
ctxMenuStore = this.ctxMenuStore,
|
|
2856
3052
|
editStore = this.editStore,
|
|
2857
3053
|
keyboardConfig = this.keyboardConfig,
|
|
2858
3054
|
mouseConfig = this.mouseConfig,
|
|
2859
|
-
mouseOpts = this.mouseOpts
|
|
3055
|
+
mouseOpts = this.mouseOpts,
|
|
3056
|
+
keyboardOpts = this.keyboardOpts;
|
|
2860
3057
|
var actived = editStore.actived;
|
|
2861
3058
|
var keyCode = evnt.keyCode;
|
|
2862
3059
|
var isEsc = keyCode === 27;
|
|
2863
3060
|
|
|
2864
3061
|
if (isEsc) {
|
|
2865
3062
|
this.preventEvent(evnt, 'event.keydown', null, function () {
|
|
2866
|
-
if (keyboardConfig && mouseConfig && mouseOpts.area &&
|
|
2867
|
-
|
|
3063
|
+
if (keyboardConfig && mouseConfig && mouseOpts.area && _this25.handleKeyboardEvent) {
|
|
3064
|
+
_this25.handleKeyboardEvent(evnt);
|
|
2868
3065
|
} else if (actived.row || filterStore.visible || ctxMenuStore.visible) {
|
|
2869
3066
|
evnt.stopPropagation(); // 如果按下了 Esc 键,关闭快捷菜单、筛选
|
|
2870
3067
|
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
_this23.closeMenu(); // 如果是激活编辑状态,则取消编辑
|
|
3068
|
+
_this25.closeFilter();
|
|
2874
3069
|
|
|
3070
|
+
_this25.closeMenu();
|
|
2875
3071
|
|
|
2876
|
-
if (
|
|
2877
|
-
|
|
3072
|
+
if (keyboardConfig && keyboardOpts.isEsc) {
|
|
3073
|
+
// 如果是激活编辑状态,则取消编辑
|
|
3074
|
+
if (actived.row) {
|
|
3075
|
+
var params = actived.args;
|
|
2878
3076
|
|
|
2879
|
-
|
|
3077
|
+
_this25.clearActived(evnt); // 如果配置了选中功能,则为选中状态
|
|
2880
3078
|
|
|
2881
3079
|
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
3080
|
+
if (mouseConfig && mouseOpts.selected) {
|
|
3081
|
+
_this25.$nextTick(function () {
|
|
3082
|
+
return _this25.handleSelected(params, evnt);
|
|
3083
|
+
});
|
|
3084
|
+
}
|
|
2886
3085
|
}
|
|
2887
3086
|
}
|
|
2888
3087
|
}
|
|
2889
3088
|
|
|
2890
|
-
|
|
3089
|
+
_this25.emitEvent('keydown', {}, evnt);
|
|
2891
3090
|
});
|
|
2892
3091
|
}
|
|
2893
3092
|
},
|
|
@@ -2896,27 +3095,27 @@ var Methods = {
|
|
|
2896
3095
|
* 全局键盘事件
|
|
2897
3096
|
*/
|
|
2898
3097
|
handleGlobalKeydownEvent: function handleGlobalKeydownEvent(evnt) {
|
|
2899
|
-
var
|
|
3098
|
+
var _this26 = this;
|
|
2900
3099
|
|
|
2901
3100
|
// 该行为只对当前激活的表格有效
|
|
2902
3101
|
if (this.isActivated) {
|
|
2903
3102
|
this.preventEvent(evnt, 'event.keydown', null, function () {
|
|
2904
|
-
var filterStore =
|
|
2905
|
-
isCtxMenu =
|
|
2906
|
-
ctxMenuStore =
|
|
2907
|
-
editStore =
|
|
2908
|
-
editOpts =
|
|
2909
|
-
editConfig =
|
|
2910
|
-
mouseConfig =
|
|
2911
|
-
mouseOpts =
|
|
2912
|
-
keyboardConfig =
|
|
2913
|
-
keyboardOpts =
|
|
2914
|
-
treeConfig =
|
|
2915
|
-
treeOpts =
|
|
2916
|
-
highlightCurrentRow =
|
|
2917
|
-
currentRow =
|
|
2918
|
-
bodyCtxMenu =
|
|
2919
|
-
rowOpts =
|
|
3103
|
+
var filterStore = _this26.filterStore,
|
|
3104
|
+
isCtxMenu = _this26.isCtxMenu,
|
|
3105
|
+
ctxMenuStore = _this26.ctxMenuStore,
|
|
3106
|
+
editStore = _this26.editStore,
|
|
3107
|
+
editOpts = _this26.editOpts,
|
|
3108
|
+
editConfig = _this26.editConfig,
|
|
3109
|
+
mouseConfig = _this26.mouseConfig,
|
|
3110
|
+
mouseOpts = _this26.mouseOpts,
|
|
3111
|
+
keyboardConfig = _this26.keyboardConfig,
|
|
3112
|
+
keyboardOpts = _this26.keyboardOpts,
|
|
3113
|
+
treeConfig = _this26.treeConfig,
|
|
3114
|
+
treeOpts = _this26.treeOpts,
|
|
3115
|
+
highlightCurrentRow = _this26.highlightCurrentRow,
|
|
3116
|
+
currentRow = _this26.currentRow,
|
|
3117
|
+
bodyCtxMenu = _this26.bodyCtxMenu,
|
|
3118
|
+
rowOpts = _this26.rowOpts;
|
|
2920
3119
|
var selected = editStore.selected,
|
|
2921
3120
|
actived = editStore.actived;
|
|
2922
3121
|
var keyCode = evnt.keyCode;
|
|
@@ -2943,7 +3142,7 @@ var Methods = {
|
|
|
2943
3142
|
|
|
2944
3143
|
if (filterStore.visible) {
|
|
2945
3144
|
if (isEsc) {
|
|
2946
|
-
|
|
3145
|
+
_this26.closeFilter();
|
|
2947
3146
|
}
|
|
2948
3147
|
|
|
2949
3148
|
return;
|
|
@@ -2954,20 +3153,20 @@ var Methods = {
|
|
|
2954
3153
|
evnt.preventDefault();
|
|
2955
3154
|
|
|
2956
3155
|
if (ctxMenuStore.showChild && hasChildrenList(ctxMenuStore.selected)) {
|
|
2957
|
-
|
|
3156
|
+
_this26.moveCtxMenu(evnt, keyCode, ctxMenuStore, 'selectChild', 37, false, ctxMenuStore.selected.children);
|
|
2958
3157
|
} else {
|
|
2959
|
-
|
|
3158
|
+
_this26.moveCtxMenu(evnt, keyCode, ctxMenuStore, 'selected', 39, true, _this26.ctxMenuList);
|
|
2960
3159
|
}
|
|
2961
|
-
} else if (keyboardConfig && mouseConfig && mouseOpts.area &&
|
|
2962
|
-
|
|
3160
|
+
} else if (keyboardConfig && mouseConfig && mouseOpts.area && _this26.handleKeyboardEvent) {
|
|
3161
|
+
_this26.handleKeyboardEvent(evnt);
|
|
2963
3162
|
} else if (keyboardConfig && isSpacebar && keyboardOpts.isChecked && selected.row && selected.column && (selected.column.type === 'checkbox' || selected.column.type === 'radio')) {
|
|
2964
3163
|
// 空格键支持选中复选框
|
|
2965
3164
|
evnt.preventDefault();
|
|
2966
3165
|
|
|
2967
3166
|
if (selected.column.type === 'checkbox') {
|
|
2968
|
-
|
|
3167
|
+
_this26.handleToggleCheckRowEvent(evnt, selected.args);
|
|
2969
3168
|
} else {
|
|
2970
|
-
|
|
3169
|
+
_this26.triggerRadioRowEvent(evnt, selected.args);
|
|
2971
3170
|
}
|
|
2972
3171
|
} else if (isF2 && (0, _utils.isEnableConf)(editConfig)) {
|
|
2973
3172
|
if (!isEditStatus) {
|
|
@@ -2976,15 +3175,15 @@ var Methods = {
|
|
|
2976
3175
|
evnt.stopPropagation();
|
|
2977
3176
|
evnt.preventDefault();
|
|
2978
3177
|
|
|
2979
|
-
|
|
3178
|
+
_this26.handleActived(selected.args, evnt);
|
|
2980
3179
|
}
|
|
2981
3180
|
}
|
|
2982
3181
|
} else if (isContextMenu) {
|
|
2983
3182
|
// 如果按下上下文键
|
|
2984
|
-
|
|
2985
|
-
clearTimeout(
|
|
2986
|
-
|
|
2987
|
-
|
|
3183
|
+
_this26._keyCtx = selected.row && selected.column && bodyCtxMenu.length;
|
|
3184
|
+
clearTimeout(_this26.keyCtxTimeout);
|
|
3185
|
+
_this26.keyCtxTimeout = setTimeout(function () {
|
|
3186
|
+
_this26._keyCtx = false;
|
|
2988
3187
|
}, 1000);
|
|
2989
3188
|
} else if (isEnter && !hasAltKey && keyboardConfig && keyboardOpts.isEnter && (selected.row || actived.row || treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow)) {
|
|
2990
3189
|
// 退出选中
|
|
@@ -2993,12 +3192,12 @@ var Methods = {
|
|
|
2993
3192
|
if (actived.row) {
|
|
2994
3193
|
params = actived.args;
|
|
2995
3194
|
|
|
2996
|
-
|
|
3195
|
+
_this26.clearActived(evnt); // 如果配置了选中功能,则为选中状态
|
|
2997
3196
|
|
|
2998
3197
|
|
|
2999
3198
|
if (mouseConfig && mouseOpts.selected) {
|
|
3000
|
-
|
|
3001
|
-
return
|
|
3199
|
+
_this26.$nextTick(function () {
|
|
3200
|
+
return _this26.handleSelected(params, evnt);
|
|
3002
3201
|
});
|
|
3003
3202
|
}
|
|
3004
3203
|
}
|
|
@@ -3009,15 +3208,15 @@ var Methods = {
|
|
|
3009
3208
|
|
|
3010
3209
|
if (hasShiftKey) {
|
|
3011
3210
|
if (keyboardOpts.enterToTab) {
|
|
3012
|
-
|
|
3211
|
+
_this26.moveTabSelected(targetArgs, hasShiftKey, evnt);
|
|
3013
3212
|
} else {
|
|
3014
|
-
|
|
3213
|
+
_this26.moveSelected(targetArgs, isLeftArrow, true, isRightArrow, false, evnt);
|
|
3015
3214
|
}
|
|
3016
3215
|
} else {
|
|
3017
3216
|
if (keyboardOpts.enterToTab) {
|
|
3018
|
-
|
|
3217
|
+
_this26.moveTabSelected(targetArgs, hasShiftKey, evnt);
|
|
3019
3218
|
} else {
|
|
3020
|
-
|
|
3219
|
+
_this26.moveSelected(targetArgs, isLeftArrow, false, isRightArrow, true, evnt);
|
|
3021
3220
|
}
|
|
3022
3221
|
}
|
|
3023
3222
|
} else if (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
|
|
@@ -3028,14 +3227,14 @@ var Methods = {
|
|
|
3028
3227
|
evnt.preventDefault();
|
|
3029
3228
|
var targetRow = childrens[0];
|
|
3030
3229
|
params = {
|
|
3031
|
-
$table:
|
|
3230
|
+
$table: _this26,
|
|
3032
3231
|
row: targetRow
|
|
3033
3232
|
};
|
|
3034
3233
|
|
|
3035
|
-
|
|
3036
|
-
return
|
|
3234
|
+
_this26.setTreeExpand(currentRow, true).then(function () {
|
|
3235
|
+
return _this26.scrollToRow(targetRow);
|
|
3037
3236
|
}).then(function () {
|
|
3038
|
-
return
|
|
3237
|
+
return _this26.triggerCurrentRowEvent(evnt, params);
|
|
3039
3238
|
});
|
|
3040
3239
|
}
|
|
3041
3240
|
}
|
|
@@ -3044,18 +3243,18 @@ var Methods = {
|
|
|
3044
3243
|
if (!isEditStatus) {
|
|
3045
3244
|
// 如果按下了方向键
|
|
3046
3245
|
if (selected.row && selected.column) {
|
|
3047
|
-
|
|
3246
|
+
_this26.moveSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt);
|
|
3048
3247
|
} else if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
|
|
3049
3248
|
// 当前行按键上下移动
|
|
3050
|
-
|
|
3249
|
+
_this26.moveCurrentRow(isUpArrow, isDwArrow, evnt);
|
|
3051
3250
|
}
|
|
3052
3251
|
}
|
|
3053
3252
|
} else if (isTab && keyboardConfig && keyboardOpts.isTab) {
|
|
3054
3253
|
// 如果按下了 Tab 键切换
|
|
3055
3254
|
if (selected.row || selected.column) {
|
|
3056
|
-
|
|
3255
|
+
_this26.moveTabSelected(selected.args, hasShiftKey, evnt);
|
|
3057
3256
|
} else if (actived.row || actived.column) {
|
|
3058
|
-
|
|
3257
|
+
_this26.moveTabSelected(actived.args, hasShiftKey, evnt);
|
|
3059
3258
|
}
|
|
3060
3259
|
} else if (keyboardConfig && (isDel || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow ? isBack && keyboardOpts.isArrow : isBack))) {
|
|
3061
3260
|
if (!isEditStatus) {
|
|
@@ -3066,10 +3265,10 @@ var Methods = {
|
|
|
3066
3265
|
if (delMethod) {
|
|
3067
3266
|
delMethod({
|
|
3068
3267
|
row: selected.row,
|
|
3069
|
-
rowIndex:
|
|
3268
|
+
rowIndex: _this26.getRowIndex(selected.row),
|
|
3070
3269
|
column: selected.column,
|
|
3071
|
-
columnIndex:
|
|
3072
|
-
$table:
|
|
3270
|
+
columnIndex: _this26.getColumnIndex(selected.column),
|
|
3271
|
+
$table: _this26
|
|
3073
3272
|
});
|
|
3074
3273
|
} else {
|
|
3075
3274
|
setCellValue(selected.row, selected.column, null);
|
|
@@ -3079,21 +3278,21 @@ var Methods = {
|
|
|
3079
3278
|
if (backMethod) {
|
|
3080
3279
|
backMethod({
|
|
3081
3280
|
row: selected.row,
|
|
3082
|
-
rowIndex:
|
|
3281
|
+
rowIndex: _this26.getRowIndex(selected.row),
|
|
3083
3282
|
column: selected.column,
|
|
3084
|
-
columnIndex:
|
|
3085
|
-
$table:
|
|
3283
|
+
columnIndex: _this26.getColumnIndex(selected.column),
|
|
3284
|
+
$table: _this26
|
|
3086
3285
|
});
|
|
3087
3286
|
} else {
|
|
3088
|
-
|
|
3287
|
+
_this26.handleActived(selected.args, evnt);
|
|
3089
3288
|
}
|
|
3090
3289
|
} else if (isDel) {
|
|
3091
3290
|
// 如果按下 del 键,更新表尾数据
|
|
3092
|
-
|
|
3291
|
+
_this26.updateFooter();
|
|
3093
3292
|
}
|
|
3094
3293
|
} else if (isBack && keyboardOpts.isArrow && treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
|
|
3095
3294
|
// 如果树形表格回退键关闭当前行返回父节点
|
|
3096
|
-
var _XEUtils$findTree = _xeUtils.default.findTree(
|
|
3295
|
+
var _XEUtils$findTree = _xeUtils.default.findTree(_this26.afterFullData, function (item) {
|
|
3097
3296
|
return item === currentRow;
|
|
3098
3297
|
}, treeOpts),
|
|
3099
3298
|
parentRow = _XEUtils$findTree.parent;
|
|
@@ -3101,14 +3300,14 @@ var Methods = {
|
|
|
3101
3300
|
if (parentRow) {
|
|
3102
3301
|
evnt.preventDefault();
|
|
3103
3302
|
params = {
|
|
3104
|
-
$table:
|
|
3303
|
+
$table: _this26,
|
|
3105
3304
|
row: parentRow
|
|
3106
3305
|
};
|
|
3107
3306
|
|
|
3108
|
-
|
|
3109
|
-
return
|
|
3307
|
+
_this26.setTreeExpand(parentRow, false).then(function () {
|
|
3308
|
+
return _this26.scrollToRow(parentRow);
|
|
3110
3309
|
}).then(function () {
|
|
3111
|
-
return
|
|
3310
|
+
return _this26.triggerCurrentRowEvent(evnt, params);
|
|
3112
3311
|
});
|
|
3113
3312
|
}
|
|
3114
3313
|
}
|
|
@@ -3125,21 +3324,21 @@ var Methods = {
|
|
|
3125
3324
|
if (editMethod) {
|
|
3126
3325
|
editMethod({
|
|
3127
3326
|
row: selected.row,
|
|
3128
|
-
rowIndex:
|
|
3327
|
+
rowIndex: _this26.getRowIndex(selected.row),
|
|
3129
3328
|
column: selected.column,
|
|
3130
|
-
columnIndex:
|
|
3131
|
-
$table:
|
|
3329
|
+
columnIndex: _this26.getColumnIndex(selected.column),
|
|
3330
|
+
$table: _this26
|
|
3132
3331
|
});
|
|
3133
3332
|
} else {
|
|
3134
3333
|
setCellValue(selected.row, selected.column, null);
|
|
3135
3334
|
|
|
3136
|
-
|
|
3335
|
+
_this26.handleActived(selected.args, evnt);
|
|
3137
3336
|
}
|
|
3138
3337
|
}
|
|
3139
3338
|
}
|
|
3140
3339
|
}
|
|
3141
3340
|
|
|
3142
|
-
|
|
3341
|
+
_this26.emitEvent('keydown', {}, evnt);
|
|
3143
3342
|
});
|
|
3144
3343
|
}
|
|
3145
3344
|
},
|
|
@@ -3209,12 +3408,12 @@ var Methods = {
|
|
|
3209
3408
|
this.recalculate(true);
|
|
3210
3409
|
},
|
|
3211
3410
|
handleTooltipLeaveMethod: function handleTooltipLeaveMethod() {
|
|
3212
|
-
var
|
|
3411
|
+
var _this27 = this;
|
|
3213
3412
|
|
|
3214
3413
|
var tooltipOpts = this.tooltipOpts;
|
|
3215
3414
|
setTimeout(function () {
|
|
3216
|
-
if (!
|
|
3217
|
-
|
|
3415
|
+
if (!_this27.tooltipActive) {
|
|
3416
|
+
_this27.closeTooltip();
|
|
3218
3417
|
}
|
|
3219
3418
|
}, tooltipOpts.leaveDelay);
|
|
3220
3419
|
return false;
|
|
@@ -3225,17 +3424,17 @@ var Methods = {
|
|
|
3225
3424
|
this.closeTooltip();
|
|
3226
3425
|
},
|
|
3227
3426
|
handleTargetLeaveEvent: function handleTargetLeaveEvent() {
|
|
3228
|
-
var
|
|
3427
|
+
var _this28 = this;
|
|
3229
3428
|
|
|
3230
3429
|
var tooltipOpts = this.tooltipOpts;
|
|
3231
3430
|
this.tooltipActive = false;
|
|
3232
3431
|
|
|
3233
3432
|
if (tooltipOpts.enterable) {
|
|
3234
3433
|
this.tooltipTimeout = setTimeout(function () {
|
|
3235
|
-
var tooltip =
|
|
3434
|
+
var tooltip = _this28.$refs.tooltip;
|
|
3236
3435
|
|
|
3237
3436
|
if (tooltip && !tooltip.isHover) {
|
|
3238
|
-
|
|
3437
|
+
_this28.closeTooltip();
|
|
3239
3438
|
}
|
|
3240
3439
|
}, tooltipOpts.leaveDelay);
|
|
3241
3440
|
} else {
|
|
@@ -3468,14 +3667,14 @@ var Methods = {
|
|
|
3468
3667
|
* @param {Boolean} value 是否选中
|
|
3469
3668
|
*/
|
|
3470
3669
|
setCheckboxRow: function setCheckboxRow(rows, value) {
|
|
3471
|
-
var
|
|
3670
|
+
var _this29 = this;
|
|
3472
3671
|
|
|
3473
3672
|
if (rows && !_xeUtils.default.isArray(rows)) {
|
|
3474
3673
|
rows = [rows];
|
|
3475
3674
|
}
|
|
3476
3675
|
|
|
3477
3676
|
rows.forEach(function (row) {
|
|
3478
|
-
return
|
|
3677
|
+
return _this29.handleSelectRow({
|
|
3479
3678
|
row: row
|
|
3480
3679
|
}, !!value);
|
|
3481
3680
|
});
|
|
@@ -3499,7 +3698,7 @@ var Methods = {
|
|
|
3499
3698
|
* value 选中true 不选false 半选-1
|
|
3500
3699
|
*/
|
|
3501
3700
|
handleSelectRow: function handleSelectRow(_ref5, value) {
|
|
3502
|
-
var
|
|
3701
|
+
var _this30 = this;
|
|
3503
3702
|
|
|
3504
3703
|
var row = _ref5.row;
|
|
3505
3704
|
var selection = this.selection,
|
|
@@ -3532,7 +3731,7 @@ var Methods = {
|
|
|
3532
3731
|
return half === item;
|
|
3533
3732
|
});
|
|
3534
3733
|
|
|
3535
|
-
|
|
3734
|
+
_this30.handleCheckboxReserveRow(row, value);
|
|
3536
3735
|
}
|
|
3537
3736
|
}, treeOpts);
|
|
3538
3737
|
} // 如果存在父节点,更新父节点状态
|
|
@@ -3606,7 +3805,7 @@ var Methods = {
|
|
|
3606
3805
|
return half === item;
|
|
3607
3806
|
});
|
|
3608
3807
|
|
|
3609
|
-
|
|
3808
|
+
_this30.handleCheckboxReserveRow(row, value);
|
|
3610
3809
|
}
|
|
3611
3810
|
}, treeOpts);
|
|
3612
3811
|
} // 如果存在父节点,更新父节点状态
|
|
@@ -3710,7 +3909,7 @@ var Methods = {
|
|
|
3710
3909
|
* @param {Boolean} value 是否选中
|
|
3711
3910
|
*/
|
|
3712
3911
|
setAllCheckboxRow: function setAllCheckboxRow(value) {
|
|
3713
|
-
var
|
|
3912
|
+
var _this31 = this;
|
|
3714
3913
|
|
|
3715
3914
|
var afterFullData = this.afterFullData,
|
|
3716
3915
|
treeConfig = this.treeConfig,
|
|
@@ -3823,11 +4022,11 @@ var Methods = {
|
|
|
3823
4022
|
if (reserve) {
|
|
3824
4023
|
if (value) {
|
|
3825
4024
|
selectRows.forEach(function (row) {
|
|
3826
|
-
checkboxReserveRowMap[getRowid(
|
|
4025
|
+
checkboxReserveRowMap[getRowid(_this31, row)] = row;
|
|
3827
4026
|
});
|
|
3828
4027
|
} else {
|
|
3829
4028
|
afterFullData.forEach(function (row) {
|
|
3830
|
-
return
|
|
4029
|
+
return _this31.handleCheckboxReserveRow(row, false);
|
|
3831
4030
|
});
|
|
3832
4031
|
}
|
|
3833
4032
|
}
|
|
@@ -4022,7 +4221,7 @@ var Methods = {
|
|
|
4022
4221
|
* 获取复选框保留选中的行
|
|
4023
4222
|
*/
|
|
4024
4223
|
getCheckboxReserveRecords: function getCheckboxReserveRecords(isFull) {
|
|
4025
|
-
var
|
|
4224
|
+
var _this32 = this;
|
|
4026
4225
|
|
|
4027
4226
|
var fullDataRowIdData = this.fullDataRowIdData,
|
|
4028
4227
|
afterFullData = this.afterFullData,
|
|
@@ -4037,11 +4236,11 @@ var Methods = {
|
|
|
4037
4236
|
|
|
4038
4237
|
if (treeConfig) {
|
|
4039
4238
|
_xeUtils.default.eachTree(afterFullData, function (row) {
|
|
4040
|
-
afterFullIdMaps[getRowid(
|
|
4239
|
+
afterFullIdMaps[getRowid(_this32, row)] = 1;
|
|
4041
4240
|
}, treeOpts);
|
|
4042
4241
|
} else {
|
|
4043
4242
|
afterFullData.forEach(function (row) {
|
|
4044
|
-
afterFullIdMaps[getRowid(
|
|
4243
|
+
afterFullIdMaps[getRowid(_this32, row)] = 1;
|
|
4045
4244
|
});
|
|
4046
4245
|
}
|
|
4047
4246
|
|
|
@@ -4107,7 +4306,7 @@ var Methods = {
|
|
|
4107
4306
|
* 清空行为不管是否被禁用还是保留记录,都将彻底清空选中状态
|
|
4108
4307
|
*/
|
|
4109
4308
|
clearCheckboxRow: function clearCheckboxRow() {
|
|
4110
|
-
var
|
|
4309
|
+
var _this33 = this;
|
|
4111
4310
|
|
|
4112
4311
|
var tableFullData = this.tableFullData,
|
|
4113
4312
|
treeConfig = this.treeConfig,
|
|
@@ -4130,7 +4329,7 @@ var Methods = {
|
|
|
4130
4329
|
|
|
4131
4330
|
if (reserve) {
|
|
4132
4331
|
tableFullData.forEach(function (row) {
|
|
4133
|
-
return
|
|
4332
|
+
return _this33.handleCheckboxReserveRow(row, false);
|
|
4134
4333
|
});
|
|
4135
4334
|
}
|
|
4136
4335
|
|
|
@@ -4422,13 +4621,13 @@ var Methods = {
|
|
|
4422
4621
|
* 如果存在规则,则校验
|
|
4423
4622
|
*/
|
|
4424
4623
|
handleChangeCell: function handleChangeCell(evnt, params) {
|
|
4425
|
-
var
|
|
4624
|
+
var _this34 = this;
|
|
4426
4625
|
|
|
4427
4626
|
this.checkValidate('blur').catch(function (e) {
|
|
4428
4627
|
return e;
|
|
4429
4628
|
}).then(function () {
|
|
4430
|
-
|
|
4431
|
-
return
|
|
4629
|
+
_this34.handleActived(params, evnt).then(function () {
|
|
4630
|
+
return _this34.checkValidate('change');
|
|
4432
4631
|
}).catch(function (e) {
|
|
4433
4632
|
return e;
|
|
4434
4633
|
});
|
|
@@ -4531,7 +4730,7 @@ var Methods = {
|
|
|
4531
4730
|
* 如果是双击模式,则激活为编辑状态
|
|
4532
4731
|
*/
|
|
4533
4732
|
triggerCellDblclickEvent: function triggerCellDblclickEvent(evnt, params) {
|
|
4534
|
-
var
|
|
4733
|
+
var _this35 = this;
|
|
4535
4734
|
|
|
4536
4735
|
var editStore = this.editStore,
|
|
4537
4736
|
editConfig = this.editConfig,
|
|
@@ -4546,15 +4745,15 @@ var Methods = {
|
|
|
4546
4745
|
this.checkValidate('blur').catch(function (e) {
|
|
4547
4746
|
return e;
|
|
4548
4747
|
}).then(function () {
|
|
4549
|
-
|
|
4550
|
-
return
|
|
4748
|
+
_this35.handleActived(params, evnt).then(function () {
|
|
4749
|
+
return _this35.checkValidate('change');
|
|
4551
4750
|
}).catch(function (e) {
|
|
4552
4751
|
return e;
|
|
4553
4752
|
});
|
|
4554
4753
|
});
|
|
4555
4754
|
} else if (editOpts.mode === 'cell') {
|
|
4556
4755
|
this.handleActived(params, evnt).then(function () {
|
|
4557
|
-
return
|
|
4756
|
+
return _this35.checkValidate('change');
|
|
4558
4757
|
}).catch(function (e) {
|
|
4559
4758
|
return e;
|
|
4560
4759
|
});
|
|
@@ -4565,7 +4764,7 @@ var Methods = {
|
|
|
4565
4764
|
this.emitEvent('cell-dblclick', params, evnt);
|
|
4566
4765
|
},
|
|
4567
4766
|
handleDefaultSort: function handleDefaultSort() {
|
|
4568
|
-
var
|
|
4767
|
+
var _this36 = this;
|
|
4569
4768
|
|
|
4570
4769
|
var sortConfig = this.sortConfig,
|
|
4571
4770
|
sortOpts = this.sortOpts;
|
|
@@ -4582,7 +4781,7 @@ var Methods = {
|
|
|
4582
4781
|
order = item.order;
|
|
4583
4782
|
|
|
4584
4783
|
if (field && order) {
|
|
4585
|
-
var column =
|
|
4784
|
+
var column = _this36.getColumnByField(field);
|
|
4586
4785
|
|
|
4587
4786
|
if (column && column.sortable) {
|
|
4588
4787
|
column.order = order;
|
|
@@ -4625,7 +4824,7 @@ var Methods = {
|
|
|
4625
4824
|
}
|
|
4626
4825
|
},
|
|
4627
4826
|
sort: function sort(sortConfs, sortOrder) {
|
|
4628
|
-
var
|
|
4827
|
+
var _this37 = this;
|
|
4629
4828
|
|
|
4630
4829
|
var sortOpts = this.sortOpts;
|
|
4631
4830
|
var multiple = sortOpts.multiple,
|
|
@@ -4658,7 +4857,7 @@ var Methods = {
|
|
|
4658
4857
|
var column = field;
|
|
4659
4858
|
|
|
4660
4859
|
if (_xeUtils.default.isString(field)) {
|
|
4661
|
-
column =
|
|
4860
|
+
column = _this37.getColumnByField(field);
|
|
4662
4861
|
}
|
|
4663
4862
|
|
|
4664
4863
|
if (column && (column.sortable || column.remoteSort)) {
|
|
@@ -4667,7 +4866,7 @@ var Methods = {
|
|
|
4667
4866
|
}
|
|
4668
4867
|
|
|
4669
4868
|
if (orders.indexOf(order) === -1) {
|
|
4670
|
-
order = getNextSortOrder(
|
|
4869
|
+
order = getNextSortOrder(_this37, column);
|
|
4671
4870
|
}
|
|
4672
4871
|
|
|
4673
4872
|
if (column.order !== order) {
|
|
@@ -4818,7 +5017,7 @@ var Methods = {
|
|
|
4818
5017
|
* @param {Row} row 行对象
|
|
4819
5018
|
*/
|
|
4820
5019
|
reloadRowExpand: function reloadRowExpand(row) {
|
|
4821
|
-
var
|
|
5020
|
+
var _this38 = this;
|
|
4822
5021
|
|
|
4823
5022
|
var expandOpts = this.expandOpts,
|
|
4824
5023
|
expandLazyLoadeds = this.expandLazyLoadeds;
|
|
@@ -4826,7 +5025,7 @@ var Methods = {
|
|
|
4826
5025
|
|
|
4827
5026
|
if (lazy && expandLazyLoadeds.indexOf(row) === -1) {
|
|
4828
5027
|
this.clearRowExpandLoaded(row).then(function () {
|
|
4829
|
-
return
|
|
5028
|
+
return _this38.handleAsyncRowExpand(row);
|
|
4830
5029
|
});
|
|
4831
5030
|
}
|
|
4832
5031
|
|
|
@@ -4905,29 +5104,29 @@ var Methods = {
|
|
|
4905
5104
|
return this.setRowExpand(this.expandOpts.lazy ? this.tableData : this.tableFullData, expanded);
|
|
4906
5105
|
},
|
|
4907
5106
|
handleAsyncRowExpand: function handleAsyncRowExpand(row) {
|
|
4908
|
-
var
|
|
5107
|
+
var _this39 = this;
|
|
4909
5108
|
|
|
4910
5109
|
var rest = this.fullAllDataRowMap.get(row);
|
|
4911
5110
|
return new Promise(function (resolve) {
|
|
4912
|
-
|
|
5111
|
+
_this39.expandLazyLoadeds.push(row);
|
|
4913
5112
|
|
|
4914
|
-
|
|
4915
|
-
$table:
|
|
5113
|
+
_this39.expandOpts.loadMethod({
|
|
5114
|
+
$table: _this39,
|
|
4916
5115
|
row: row,
|
|
4917
|
-
rowIndex:
|
|
4918
|
-
$rowIndex:
|
|
5116
|
+
rowIndex: _this39.getRowIndex(row),
|
|
5117
|
+
$rowIndex: _this39.getVMRowIndex(row)
|
|
4919
5118
|
}).catch(function (e) {
|
|
4920
5119
|
return e;
|
|
4921
5120
|
}).then(function () {
|
|
4922
5121
|
rest.expandLoaded = true;
|
|
4923
5122
|
|
|
4924
|
-
_xeUtils.default.remove(
|
|
5123
|
+
_xeUtils.default.remove(_this39.expandLazyLoadeds, function (item) {
|
|
4925
5124
|
return item === row;
|
|
4926
5125
|
});
|
|
4927
5126
|
|
|
4928
|
-
|
|
5127
|
+
_this39.rowExpandeds.push(row);
|
|
4929
5128
|
|
|
4930
|
-
resolve(
|
|
5129
|
+
resolve(_this39.$nextTick().then(_this39.recalculate));
|
|
4931
5130
|
});
|
|
4932
5131
|
});
|
|
4933
5132
|
},
|
|
@@ -4940,7 +5139,7 @@ var Methods = {
|
|
|
4940
5139
|
* @param {Boolean} expanded 是否展开
|
|
4941
5140
|
*/
|
|
4942
5141
|
setRowExpand: function setRowExpand(rows, expanded) {
|
|
4943
|
-
var
|
|
5142
|
+
var _this40 = this;
|
|
4944
5143
|
|
|
4945
5144
|
var fullAllDataRowMap = this.fullAllDataRowMap,
|
|
4946
5145
|
expandLazyLoadeds = this.expandLazyLoadeds,
|
|
@@ -4973,8 +5172,8 @@ var Methods = {
|
|
|
4973
5172
|
columnIndex: columnIndex,
|
|
4974
5173
|
$columnIndex: $columnIndex,
|
|
4975
5174
|
row: row,
|
|
4976
|
-
rowIndex:
|
|
4977
|
-
$rowIndex:
|
|
5175
|
+
rowIndex: _this40.getRowIndex(row),
|
|
5176
|
+
$rowIndex: _this40.getVMRowIndex(row)
|
|
4978
5177
|
});
|
|
4979
5178
|
}) : rows;
|
|
4980
5179
|
|
|
@@ -4985,7 +5184,7 @@ var Methods = {
|
|
|
4985
5184
|
var isLoad = lazy && !rest.expandLoaded && expandLazyLoadeds.indexOf(row) === -1;
|
|
4986
5185
|
|
|
4987
5186
|
if (isLoad) {
|
|
4988
|
-
lazyRests.push(
|
|
5187
|
+
lazyRests.push(_this40.handleAsyncRowExpand(row));
|
|
4989
5188
|
} else {
|
|
4990
5189
|
rowExpandeds.push(row);
|
|
4991
5190
|
}
|
|
@@ -4999,7 +5198,7 @@ var Methods = {
|
|
|
4999
5198
|
|
|
5000
5199
|
if (reserve) {
|
|
5001
5200
|
validRows.forEach(function (row) {
|
|
5002
|
-
return
|
|
5201
|
+
return _this40.handleRowExpandReserve(row, expanded);
|
|
5003
5202
|
});
|
|
5004
5203
|
}
|
|
5005
5204
|
}
|
|
@@ -5020,7 +5219,7 @@ var Methods = {
|
|
|
5020
5219
|
* 手动清空展开行状态,数据会恢复成未展开的状态
|
|
5021
5220
|
*/
|
|
5022
5221
|
clearRowExpand: function clearRowExpand() {
|
|
5023
|
-
var
|
|
5222
|
+
var _this41 = this;
|
|
5024
5223
|
|
|
5025
5224
|
var expandOpts = this.expandOpts,
|
|
5026
5225
|
rowExpandeds = this.rowExpandeds,
|
|
@@ -5031,13 +5230,13 @@ var Methods = {
|
|
|
5031
5230
|
|
|
5032
5231
|
if (reserve) {
|
|
5033
5232
|
tableFullData.forEach(function (row) {
|
|
5034
|
-
return
|
|
5233
|
+
return _this41.handleRowExpandReserve(row, false);
|
|
5035
5234
|
});
|
|
5036
5235
|
}
|
|
5037
5236
|
|
|
5038
5237
|
return this.$nextTick().then(function () {
|
|
5039
5238
|
if (isExists) {
|
|
5040
|
-
|
|
5239
|
+
_this41.recalculate();
|
|
5041
5240
|
}
|
|
5042
5241
|
});
|
|
5043
5242
|
},
|
|
@@ -5111,7 +5310,7 @@ var Methods = {
|
|
|
5111
5310
|
* @param {Row} row 行对象
|
|
5112
5311
|
*/
|
|
5113
5312
|
reloadTreeExpand: function reloadTreeExpand(row) {
|
|
5114
|
-
var
|
|
5313
|
+
var _this42 = this;
|
|
5115
5314
|
|
|
5116
5315
|
var treeOpts = this.treeOpts,
|
|
5117
5316
|
treeLazyLoadeds = this.treeLazyLoadeds;
|
|
@@ -5121,13 +5320,13 @@ var Methods = {
|
|
|
5121
5320
|
|
|
5122
5321
|
if (lazy && row[hasChild] && treeLazyLoadeds.indexOf(row) === -1) {
|
|
5123
5322
|
this.clearTreeExpandLoaded(row).then(function () {
|
|
5124
|
-
return
|
|
5323
|
+
return _this42.handleAsyncTreeExpandChilds(row);
|
|
5125
5324
|
}).then(function () {
|
|
5126
5325
|
if (transform) {
|
|
5127
|
-
return
|
|
5326
|
+
return _this42.handleTableData();
|
|
5128
5327
|
}
|
|
5129
5328
|
}).then(function () {
|
|
5130
|
-
return
|
|
5329
|
+
return _this42.recalculate();
|
|
5131
5330
|
});
|
|
5132
5331
|
}
|
|
5133
5332
|
|
|
@@ -5205,20 +5404,21 @@ var Methods = {
|
|
|
5205
5404
|
}
|
|
5206
5405
|
},
|
|
5207
5406
|
handleAsyncTreeExpandChilds: function handleAsyncTreeExpandChilds(row) {
|
|
5208
|
-
var
|
|
5407
|
+
var _this43 = this;
|
|
5209
5408
|
|
|
5210
5409
|
var fullAllDataRowMap = this.fullAllDataRowMap,
|
|
5211
5410
|
treeExpandeds = this.treeExpandeds,
|
|
5212
5411
|
treeOpts = this.treeOpts,
|
|
5213
5412
|
treeLazyLoadeds = this.treeLazyLoadeds,
|
|
5214
5413
|
checkboxOpts = this.checkboxOpts;
|
|
5215
|
-
var
|
|
5414
|
+
var transform = treeOpts.transform,
|
|
5415
|
+
loadMethod = treeOpts.loadMethod;
|
|
5216
5416
|
var checkStrictly = checkboxOpts.checkStrictly;
|
|
5217
5417
|
var rest = fullAllDataRowMap.get(row);
|
|
5218
5418
|
return new Promise(function (resolve) {
|
|
5219
5419
|
treeLazyLoadeds.push(row);
|
|
5220
5420
|
loadMethod({
|
|
5221
|
-
$table:
|
|
5421
|
+
$table: _this43,
|
|
5222
5422
|
row: row
|
|
5223
5423
|
}).catch(function () {
|
|
5224
5424
|
return [];
|
|
@@ -5234,19 +5434,33 @@ var Methods = {
|
|
|
5234
5434
|
}
|
|
5235
5435
|
|
|
5236
5436
|
if (childRecords) {
|
|
5237
|
-
|
|
5437
|
+
_this43.loadTreeChildren(row, childRecords).then(function (childRows) {
|
|
5238
5438
|
if (childRows.length && treeExpandeds.indexOf(row) === -1) {
|
|
5239
5439
|
treeExpandeds.push(row);
|
|
5240
5440
|
} // 如果当前节点已选中,则展开后子节点也被选中
|
|
5241
5441
|
|
|
5242
5442
|
|
|
5243
|
-
if (!checkStrictly &&
|
|
5244
|
-
|
|
5443
|
+
if (!checkStrictly && _this43.isCheckedByCheckboxRow(row)) {
|
|
5444
|
+
_this43.setCheckboxRow(childRows, true);
|
|
5245
5445
|
}
|
|
5446
|
+
|
|
5447
|
+
_this43.$nextTick().then(function () {
|
|
5448
|
+
if (transform) {
|
|
5449
|
+
return _this43.handleTableData();
|
|
5450
|
+
}
|
|
5451
|
+
}).then(function () {
|
|
5452
|
+
return _this43.recalculate();
|
|
5453
|
+
}).then(function () {
|
|
5454
|
+
return resolve();
|
|
5455
|
+
});
|
|
5456
|
+
});
|
|
5457
|
+
} else {
|
|
5458
|
+
_this43.$nextTick().then(function () {
|
|
5459
|
+
return _this43.recalculate();
|
|
5460
|
+
}).then(function () {
|
|
5461
|
+
return resolve();
|
|
5246
5462
|
});
|
|
5247
5463
|
}
|
|
5248
|
-
|
|
5249
|
-
resolve(_this41.$nextTick().then(_this41.recalculate));
|
|
5250
5464
|
});
|
|
5251
5465
|
});
|
|
5252
5466
|
},
|
|
@@ -5280,7 +5494,7 @@ var Methods = {
|
|
|
5280
5494
|
* @returns
|
|
5281
5495
|
*/
|
|
5282
5496
|
handleBaseTreeExpand: function handleBaseTreeExpand(rows, expanded) {
|
|
5283
|
-
var
|
|
5497
|
+
var _this44 = this;
|
|
5284
5498
|
|
|
5285
5499
|
var fullAllDataRowMap = this.fullAllDataRowMap,
|
|
5286
5500
|
tableFullData = this.tableFullData,
|
|
@@ -5328,7 +5542,7 @@ var Methods = {
|
|
|
5328
5542
|
var isLoad = lazy && row[hasChild] && !rest.treeLoaded && treeLazyLoadeds.indexOf(row) === -1; // 是否使用懒加载
|
|
5329
5543
|
|
|
5330
5544
|
if (isLoad) {
|
|
5331
|
-
result.push(
|
|
5545
|
+
result.push(_this44.handleAsyncTreeExpandChilds(row));
|
|
5332
5546
|
} else {
|
|
5333
5547
|
if (row[children] && row[children].length) {
|
|
5334
5548
|
treeExpandeds.push(row);
|
|
@@ -5344,40 +5558,12 @@ var Methods = {
|
|
|
5344
5558
|
|
|
5345
5559
|
if (reserve) {
|
|
5346
5560
|
validRows.forEach(function (row) {
|
|
5347
|
-
return
|
|
5561
|
+
return _this44.handleTreeExpandReserve(row, expanded);
|
|
5348
5562
|
});
|
|
5349
5563
|
}
|
|
5350
5564
|
|
|
5351
5565
|
return Promise.all(result).then(this.recalculate);
|
|
5352
5566
|
},
|
|
5353
|
-
updateVirtualTreeData: function updateVirtualTreeData() {
|
|
5354
|
-
var _this43 = this;
|
|
5355
|
-
|
|
5356
|
-
var oldScrollYLoad = this.scrollYLoad,
|
|
5357
|
-
treeExpandeds = this.treeExpandeds,
|
|
5358
|
-
treeOpts = this.treeOpts,
|
|
5359
|
-
treeFullData = this.treeFullData;
|
|
5360
|
-
var fullData = [];
|
|
5361
|
-
var expandMaps = new Map();
|
|
5362
|
-
|
|
5363
|
-
_xeUtils.default.eachTree(treeFullData, function (row, index, items, path, parent) {
|
|
5364
|
-
if (!parent || expandMaps.has(parent) && treeExpandeds.indexOf(parent) > -1) {
|
|
5365
|
-
expandMaps.set(row, 1);
|
|
5366
|
-
fullData.push(row);
|
|
5367
|
-
}
|
|
5368
|
-
}, treeOpts);
|
|
5369
|
-
|
|
5370
|
-
var scrollYLoad = this.updateScrollYStatus(fullData);
|
|
5371
|
-
this.tableFullData = scrollYLoad ? fullData : treeFullData;
|
|
5372
|
-
|
|
5373
|
-
if (scrollYLoad || oldScrollYLoad !== scrollYLoad) {
|
|
5374
|
-
return this.handleTableData(true).then(function () {
|
|
5375
|
-
return _this43.recalculate();
|
|
5376
|
-
});
|
|
5377
|
-
}
|
|
5378
|
-
|
|
5379
|
-
return this.$nextTick();
|
|
5380
|
-
},
|
|
5381
5567
|
|
|
5382
5568
|
/**
|
|
5383
5569
|
* 虚拟树的展开与收起
|
|
@@ -5386,12 +5572,12 @@ var Methods = {
|
|
|
5386
5572
|
* @returns
|
|
5387
5573
|
*/
|
|
5388
5574
|
handleVirtualTreeExpand: function handleVirtualTreeExpand(rows, expanded) {
|
|
5389
|
-
var
|
|
5575
|
+
var _this45 = this;
|
|
5390
5576
|
|
|
5391
5577
|
return this.handleBaseTreeExpand(rows, expanded).then(function () {
|
|
5392
|
-
return
|
|
5578
|
+
return _this45.handleTableData();
|
|
5393
5579
|
}).then(function () {
|
|
5394
|
-
return
|
|
5580
|
+
return _this45.recalculate();
|
|
5395
5581
|
});
|
|
5396
5582
|
},
|
|
5397
5583
|
|
|
@@ -5436,7 +5622,7 @@ var Methods = {
|
|
|
5436
5622
|
* 手动清空树形节点的展开状态,数据会恢复成未展开的状态
|
|
5437
5623
|
*/
|
|
5438
5624
|
clearTreeExpand: function clearTreeExpand() {
|
|
5439
|
-
var
|
|
5625
|
+
var _this46 = this;
|
|
5440
5626
|
|
|
5441
5627
|
var treeOpts = this.treeOpts,
|
|
5442
5628
|
treeExpandeds = this.treeExpandeds,
|
|
@@ -5447,13 +5633,13 @@ var Methods = {
|
|
|
5447
5633
|
|
|
5448
5634
|
if (reserve) {
|
|
5449
5635
|
_xeUtils.default.eachTree(tableFullData, function (row) {
|
|
5450
|
-
return
|
|
5636
|
+
return _this46.handleTreeExpandReserve(row, false);
|
|
5451
5637
|
}, treeOpts);
|
|
5452
5638
|
}
|
|
5453
5639
|
|
|
5454
|
-
return this.
|
|
5640
|
+
return this.handleTableData().then(function () {
|
|
5455
5641
|
if (isExists) {
|
|
5456
|
-
|
|
5642
|
+
_this46.recalculate();
|
|
5457
5643
|
}
|
|
5458
5644
|
});
|
|
5459
5645
|
},
|
|
@@ -5583,18 +5769,18 @@ var Methods = {
|
|
|
5583
5769
|
},
|
|
5584
5770
|
// 计算可视渲染相关数据
|
|
5585
5771
|
computeScrollLoad: function computeScrollLoad() {
|
|
5586
|
-
var
|
|
5772
|
+
var _this47 = this;
|
|
5587
5773
|
|
|
5588
5774
|
return this.$nextTick().then(function () {
|
|
5589
|
-
var sYOpts =
|
|
5590
|
-
sXOpts =
|
|
5591
|
-
scrollXLoad =
|
|
5592
|
-
scrollYLoad =
|
|
5593
|
-
scrollXStore =
|
|
5594
|
-
scrollYStore =
|
|
5775
|
+
var sYOpts = _this47.sYOpts,
|
|
5776
|
+
sXOpts = _this47.sXOpts,
|
|
5777
|
+
scrollXLoad = _this47.scrollXLoad,
|
|
5778
|
+
scrollYLoad = _this47.scrollYLoad,
|
|
5779
|
+
scrollXStore = _this47.scrollXStore,
|
|
5780
|
+
scrollYStore = _this47.scrollYStore; // 计算 X 逻辑
|
|
5595
5781
|
|
|
5596
5782
|
if (scrollXLoad) {
|
|
5597
|
-
var _computeVirtualX3 = computeVirtualX(
|
|
5783
|
+
var _computeVirtualX3 = computeVirtualX(_this47),
|
|
5598
5784
|
visibleXSize = _computeVirtualX3.visibleSize;
|
|
5599
5785
|
|
|
5600
5786
|
var offsetXSize = sXOpts.oSize ? _xeUtils.default.toNumber(sXOpts.oSize) : _dom.browse.msie ? 10 : _dom.browse.edge ? 5 : 0;
|
|
@@ -5602,13 +5788,13 @@ var Methods = {
|
|
|
5602
5788
|
scrollXStore.visibleSize = visibleXSize;
|
|
5603
5789
|
scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
|
|
5604
5790
|
|
|
5605
|
-
|
|
5791
|
+
_this47.updateScrollXData();
|
|
5606
5792
|
} else {
|
|
5607
|
-
|
|
5793
|
+
_this47.updateScrollXSpace();
|
|
5608
5794
|
} // 计算 Y 逻辑
|
|
5609
5795
|
|
|
5610
5796
|
|
|
5611
|
-
var _computeVirtualY = computeVirtualY(
|
|
5797
|
+
var _computeVirtualY = computeVirtualY(_this47),
|
|
5612
5798
|
rowHeight = _computeVirtualY.rowHeight,
|
|
5613
5799
|
visibleYSize = _computeVirtualY.visibleSize;
|
|
5614
5800
|
|
|
@@ -5620,14 +5806,14 @@ var Methods = {
|
|
|
5620
5806
|
scrollYStore.visibleSize = visibleYSize;
|
|
5621
5807
|
scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
|
|
5622
5808
|
|
|
5623
|
-
|
|
5809
|
+
_this47.updateScrollYData();
|
|
5624
5810
|
} else {
|
|
5625
|
-
|
|
5811
|
+
_this47.updateScrollYSpace();
|
|
5626
5812
|
}
|
|
5627
5813
|
|
|
5628
|
-
|
|
5814
|
+
_this47.rowHeight = rowHeight;
|
|
5629
5815
|
|
|
5630
|
-
|
|
5816
|
+
_this47.$nextTick(_this47.updateStyle);
|
|
5631
5817
|
});
|
|
5632
5818
|
},
|
|
5633
5819
|
handleTableColumn: function handleTableColumn() {
|
|
@@ -5741,7 +5927,7 @@ var Methods = {
|
|
|
5741
5927
|
* @param {Number} scrollTop 上距离
|
|
5742
5928
|
*/
|
|
5743
5929
|
scrollTo: function scrollTo(scrollLeft, scrollTop) {
|
|
5744
|
-
var
|
|
5930
|
+
var _this48 = this;
|
|
5745
5931
|
|
|
5746
5932
|
var $refs = this.$refs;
|
|
5747
5933
|
var tableBody = $refs.tableBody,
|
|
@@ -5762,7 +5948,7 @@ var Methods = {
|
|
|
5762
5948
|
if (this.scrollXLoad || this.scrollYLoad) {
|
|
5763
5949
|
return new Promise(function (resolve) {
|
|
5764
5950
|
return setTimeout(function () {
|
|
5765
|
-
return resolve(
|
|
5951
|
+
return resolve(_this48.$nextTick());
|
|
5766
5952
|
}, 50);
|
|
5767
5953
|
});
|
|
5768
5954
|
}
|
|
@@ -5813,7 +5999,7 @@ var Methods = {
|
|
|
5813
5999
|
* @param {Row} row 行对象
|
|
5814
6000
|
*/
|
|
5815
6001
|
scrollToTreeRow: function scrollToTreeRow(row) {
|
|
5816
|
-
var
|
|
6002
|
+
var _this49 = this;
|
|
5817
6003
|
|
|
5818
6004
|
var tableFullData = this.tableFullData,
|
|
5819
6005
|
treeConfig = this.treeConfig,
|
|
@@ -5828,15 +6014,15 @@ var Methods = {
|
|
|
5828
6014
|
if (matchObj) {
|
|
5829
6015
|
var nodes = matchObj.nodes;
|
|
5830
6016
|
nodes.forEach(function (row, index) {
|
|
5831
|
-
if (index < nodes.length - 1 && !
|
|
5832
|
-
rests.push(
|
|
6017
|
+
if (index < nodes.length - 1 && !_this49.isTreeExpandByRow(row)) {
|
|
6018
|
+
rests.push(_this49.setTreeExpand(row, true));
|
|
5833
6019
|
}
|
|
5834
6020
|
});
|
|
5835
6021
|
}
|
|
5836
6022
|
}
|
|
5837
6023
|
|
|
5838
6024
|
return Promise.all(rests).then(function () {
|
|
5839
|
-
return _tools.DomTools.rowToVisible(
|
|
6025
|
+
return _tools.DomTools.rowToVisible(_this49, row);
|
|
5840
6026
|
});
|
|
5841
6027
|
},
|
|
5842
6028
|
|
|
@@ -5900,29 +6086,29 @@ var Methods = {
|
|
|
5900
6086
|
* 如果单元格配置了校验规则,则会进行校验
|
|
5901
6087
|
*/
|
|
5902
6088
|
updateStatus: function updateStatus(scope, cellValue) {
|
|
5903
|
-
var
|
|
6089
|
+
var _this50 = this;
|
|
5904
6090
|
|
|
5905
6091
|
var customVal = !_xeUtils.default.isUndefined(cellValue);
|
|
5906
6092
|
return this.$nextTick().then(function () {
|
|
5907
|
-
var $refs =
|
|
5908
|
-
editRules =
|
|
5909
|
-
validStore =
|
|
6093
|
+
var $refs = _this50.$refs,
|
|
6094
|
+
editRules = _this50.editRules,
|
|
6095
|
+
validStore = _this50.validStore;
|
|
5910
6096
|
|
|
5911
6097
|
if (scope && $refs.tableBody && editRules) {
|
|
5912
6098
|
var row = scope.row,
|
|
5913
6099
|
column = scope.column;
|
|
5914
6100
|
var type = 'change';
|
|
5915
6101
|
|
|
5916
|
-
if (
|
|
5917
|
-
var cell =
|
|
6102
|
+
if (_this50.hasCellRules(type, row, column)) {
|
|
6103
|
+
var cell = _this50.getCell(row, column);
|
|
5918
6104
|
|
|
5919
6105
|
if (cell) {
|
|
5920
|
-
return
|
|
6106
|
+
return _this50.validCellRules(type, row, column, cellValue).then(function () {
|
|
5921
6107
|
if (customVal && validStore.visible) {
|
|
5922
6108
|
setCellValue(row, column, cellValue);
|
|
5923
6109
|
}
|
|
5924
6110
|
|
|
5925
|
-
|
|
6111
|
+
_this50.clearValidate();
|
|
5926
6112
|
}).catch(function (_ref7) {
|
|
5927
6113
|
var rule = _ref7.rule;
|
|
5928
6114
|
|
|
@@ -5930,7 +6116,7 @@ var Methods = {
|
|
|
5930
6116
|
setCellValue(row, column, cellValue);
|
|
5931
6117
|
}
|
|
5932
6118
|
|
|
5933
|
-
|
|
6119
|
+
_this50.showValidTooltip({
|
|
5934
6120
|
rule: rule,
|
|
5935
6121
|
row: row,
|
|
5936
6122
|
column: column,
|
|
@@ -5951,7 +6137,7 @@ var Methods = {
|
|
|
5951
6137
|
* @param {TableMergeConfig[]} merges { row: Row|number, column: ColumnInfo|number, rowspan: number, colspan: number }
|
|
5952
6138
|
*/
|
|
5953
6139
|
setMergeCells: function setMergeCells(merges) {
|
|
5954
|
-
var
|
|
6140
|
+
var _this51 = this;
|
|
5955
6141
|
|
|
5956
6142
|
if (this.spanMethod) {
|
|
5957
6143
|
_tools.UtilTools.error('vxe.error.errConflicts', ['merge-cells', 'span-method']);
|
|
@@ -5959,7 +6145,7 @@ var Methods = {
|
|
|
5959
6145
|
|
|
5960
6146
|
setMerges(this, merges, this.mergeList, this.afterFullData);
|
|
5961
6147
|
return this.$nextTick().then(function () {
|
|
5962
|
-
return
|
|
6148
|
+
return _this51.updateCellAreas();
|
|
5963
6149
|
});
|
|
5964
6150
|
},
|
|
5965
6151
|
|
|
@@ -5968,7 +6154,7 @@ var Methods = {
|
|
|
5968
6154
|
* @param {TableMergeConfig[]} merges 多个或数组 [{row:Row|number, col:ColumnInfo|number}]
|
|
5969
6155
|
*/
|
|
5970
6156
|
removeMergeCells: function removeMergeCells(merges) {
|
|
5971
|
-
var
|
|
6157
|
+
var _this52 = this;
|
|
5972
6158
|
|
|
5973
6159
|
if (this.spanMethod) {
|
|
5974
6160
|
_tools.UtilTools.error('vxe.error.errConflicts', ['merge-cells', 'span-method']);
|
|
@@ -5976,7 +6162,7 @@ var Methods = {
|
|
|
5976
6162
|
|
|
5977
6163
|
var rest = removeMerges(this, merges, this.mergeList, this.afterFullData);
|
|
5978
6164
|
return this.$nextTick().then(function () {
|
|
5979
|
-
|
|
6165
|
+
_this52.updateCellAreas();
|
|
5980
6166
|
|
|
5981
6167
|
return rest;
|
|
5982
6168
|
});
|
|
@@ -6000,7 +6186,7 @@ var Methods = {
|
|
|
6000
6186
|
this.setMergeFooterItems(this.mergeFooterItems);
|
|
6001
6187
|
},
|
|
6002
6188
|
setMergeFooterItems: function setMergeFooterItems(merges) {
|
|
6003
|
-
var
|
|
6189
|
+
var _this53 = this;
|
|
6004
6190
|
|
|
6005
6191
|
if (this.footerSpanMethod) {
|
|
6006
6192
|
_tools.UtilTools.error('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method']);
|
|
@@ -6008,11 +6194,11 @@ var Methods = {
|
|
|
6008
6194
|
|
|
6009
6195
|
setMerges(this, merges, this.mergeFooterList, null);
|
|
6010
6196
|
return this.$nextTick().then(function () {
|
|
6011
|
-
return
|
|
6197
|
+
return _this53.updateCellAreas();
|
|
6012
6198
|
});
|
|
6013
6199
|
},
|
|
6014
6200
|
removeMergeFooterItems: function removeMergeFooterItems(merges) {
|
|
6015
|
-
var
|
|
6201
|
+
var _this54 = this;
|
|
6016
6202
|
|
|
6017
6203
|
if (this.footerSpanMethod) {
|
|
6018
6204
|
_tools.UtilTools.error('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method']);
|
|
@@ -6020,7 +6206,7 @@ var Methods = {
|
|
|
6020
6206
|
|
|
6021
6207
|
var rest = removeMerges(this, merges, this.mergeFooterList, null);
|
|
6022
6208
|
return this.$nextTick().then(function () {
|
|
6023
|
-
|
|
6209
|
+
_this54.updateCellAreas();
|
|
6024
6210
|
|
|
6025
6211
|
return rest;
|
|
6026
6212
|
});
|
|
@@ -6160,7 +6346,7 @@ var Methods = {
|
|
|
6160
6346
|
|
|
6161
6347
|
}; // Module methods
|
|
6162
6348
|
|
|
6163
|
-
var funcs = 'setFilter,clearFilter,getCheckedFilters,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,clearCopyCellArea,setCellAreas,openFind,openReplace,getSelectedCell,clearSelected,insert,insertAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearActived,getActiveRecord,isActiveByRow,setActiveRow,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',');
|
|
6349
|
+
var funcs = 'setFilter,openFilter,clearFilter,getCheckedFilters,closeMenu,setActiveCellArea,getActiveCellArea,getCellAreas,clearCellAreas,copyCellArea,cutCellArea,pasteCellArea,getCopyCellArea,clearCopyCellArea,setCellAreas,openFind,openReplace,getSelectedCell,clearSelected,insert,insertAt,remove,removeCheckboxRow,removeRadioRow,removeCurrentRow,getRecordset,getInsertRecords,getRemoveRecords,getUpdateRecords,clearActived,getActiveRecord,isActiveByRow,setActiveRow,setActiveCell,setSelectCell,clearValidate,fullValidate,validate,openExport,openPrint,exportData,openImport,importData,saveFile,readFile,importByFile,print'.split(',');
|
|
6164
6350
|
funcs.forEach(function (name) {
|
|
6165
6351
|
Methods[name] = function () {
|
|
6166
6352
|
if (process.env.NODE_ENV === 'development') {
|