vxe-table 3.4.4 → 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/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 +1472 -426
- package/lib/index.umd.min.js +2 -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 +490 -324
- 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 +6 -2
- package/lib/v-x-e-table/src/conf.min.js +1 -1
- package/lib/validator/src/mixin.js +3 -3
- package/lib/validator/src/mixin.min.js +1 -1
- package/package.json +3 -24
- 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 +147 -52
- 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 +6 -2
- package/packages/validator/src/mixin.js +3 -3
- package/types/v-x-e-table/renderer.d.ts +3 -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,
|
|
@@ -815,10 +866,10 @@ var Methods = {
|
|
|
815
866
|
var parentLevel = rest ? rest.level : 0;
|
|
816
867
|
return this.createData(childRecords).then(function (rows) {
|
|
817
868
|
if (keepSource) {
|
|
818
|
-
var rowid = getRowid(
|
|
869
|
+
var rowid = getRowid(_this10, row);
|
|
819
870
|
|
|
820
871
|
var matchObj = _xeUtils.default.findTree(tableSourceData, function (item) {
|
|
821
|
-
return rowid === getRowid(
|
|
872
|
+
return rowid === getRowid(_this10, item);
|
|
822
873
|
}, treeOpts);
|
|
823
874
|
|
|
824
875
|
if (matchObj) {
|
|
@@ -827,11 +878,14 @@ var Methods = {
|
|
|
827
878
|
}
|
|
828
879
|
|
|
829
880
|
_xeUtils.default.eachTree(rows, function (childRow, index, items, path, parent, nodes) {
|
|
830
|
-
var rowid = getRowid(
|
|
881
|
+
var rowid = getRowid(_this10, childRow);
|
|
831
882
|
var rest = {
|
|
832
883
|
row: childRow,
|
|
833
884
|
rowid: rowid,
|
|
885
|
+
seq: -1,
|
|
834
886
|
index: -1,
|
|
887
|
+
_index: -1,
|
|
888
|
+
$index: -1,
|
|
835
889
|
items: items,
|
|
836
890
|
parent: parent,
|
|
837
891
|
level: parentLevel + nodes.length
|
|
@@ -852,7 +906,7 @@ var Methods = {
|
|
|
852
906
|
* 牺牲数据组装的耗时,用来换取使用过程中的流畅
|
|
853
907
|
*/
|
|
854
908
|
cacheColumnMap: function cacheColumnMap() {
|
|
855
|
-
var
|
|
909
|
+
var _this11 = this;
|
|
856
910
|
|
|
857
911
|
var tableFullColumn = this.tableFullColumn,
|
|
858
912
|
collectColumn = this.collectColumn,
|
|
@@ -939,16 +993,16 @@ var Methods = {
|
|
|
939
993
|
}
|
|
940
994
|
|
|
941
995
|
if (process.env.NODE_ENV === 'development') {
|
|
942
|
-
if (
|
|
943
|
-
_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)]);
|
|
944
998
|
}
|
|
945
999
|
|
|
946
|
-
if (
|
|
947
|
-
_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)]);
|
|
948
1002
|
}
|
|
949
1003
|
|
|
950
|
-
if (
|
|
951
|
-
_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)]);
|
|
952
1006
|
}
|
|
953
1007
|
}
|
|
954
1008
|
|
|
@@ -1035,6 +1089,25 @@ var Methods = {
|
|
|
1035
1089
|
return null;
|
|
1036
1090
|
},
|
|
1037
1091
|
|
|
1092
|
+
/**
|
|
1093
|
+
* 根据 row 获取序号
|
|
1094
|
+
* @param {Row} row 行对象
|
|
1095
|
+
*/
|
|
1096
|
+
getRowSeq: function getRowSeq(row) {
|
|
1097
|
+
var fullDataRowIdData = this.fullDataRowIdData;
|
|
1098
|
+
|
|
1099
|
+
if (row) {
|
|
1100
|
+
var rowid = getRowid(this, row);
|
|
1101
|
+
var rest = fullDataRowIdData[rowid];
|
|
1102
|
+
|
|
1103
|
+
if (rest) {
|
|
1104
|
+
return rest.seq;
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
return -1;
|
|
1109
|
+
},
|
|
1110
|
+
|
|
1038
1111
|
/**
|
|
1039
1112
|
* 根据 row 获取相对于 data 中的索引
|
|
1040
1113
|
* @param {Row} row 行对象
|
|
@@ -1181,13 +1254,13 @@ var Methods = {
|
|
|
1181
1254
|
* @param {Array} records 新数据
|
|
1182
1255
|
*/
|
|
1183
1256
|
createData: function createData(records) {
|
|
1184
|
-
var
|
|
1257
|
+
var _this12 = this;
|
|
1185
1258
|
|
|
1186
1259
|
var treeConfig = this.treeConfig,
|
|
1187
1260
|
treeOpts = this.treeOpts;
|
|
1188
1261
|
|
|
1189
1262
|
var handleRrecord = function handleRrecord(record) {
|
|
1190
|
-
return
|
|
1263
|
+
return _this12.defineField(Object.assign({}, record));
|
|
1191
1264
|
};
|
|
1192
1265
|
|
|
1193
1266
|
var rows = treeConfig ? _xeUtils.default.mapTree(records, handleRrecord, treeOpts) : records.map(handleRrecord);
|
|
@@ -1202,7 +1275,7 @@ var Methods = {
|
|
|
1202
1275
|
* @param {Array/Object} records 新数据
|
|
1203
1276
|
*/
|
|
1204
1277
|
createRow: function createRow(records) {
|
|
1205
|
-
var
|
|
1278
|
+
var _this13 = this;
|
|
1206
1279
|
|
|
1207
1280
|
var isArr = _xeUtils.default.isArray(records);
|
|
1208
1281
|
|
|
@@ -1211,7 +1284,7 @@ var Methods = {
|
|
|
1211
1284
|
}
|
|
1212
1285
|
|
|
1213
1286
|
return this.$nextTick().then(function () {
|
|
1214
|
-
return
|
|
1287
|
+
return _this13.createData(records).then(function (rows) {
|
|
1215
1288
|
return isArr ? rows : rows[0];
|
|
1216
1289
|
});
|
|
1217
1290
|
});
|
|
@@ -1225,7 +1298,7 @@ var Methods = {
|
|
|
1225
1298
|
* 如果还额外传了 field 则还原指定的单元格数据
|
|
1226
1299
|
*/
|
|
1227
1300
|
revertData: function revertData(rows, field) {
|
|
1228
|
-
var
|
|
1301
|
+
var _this14 = this;
|
|
1229
1302
|
|
|
1230
1303
|
var keepSource = this.keepSource,
|
|
1231
1304
|
tableSourceData = this.tableSourceData,
|
|
@@ -1251,8 +1324,8 @@ var Methods = {
|
|
|
1251
1324
|
|
|
1252
1325
|
if (targetRows.length) {
|
|
1253
1326
|
targetRows.forEach(function (row) {
|
|
1254
|
-
if (!
|
|
1255
|
-
var rowIndex =
|
|
1327
|
+
if (!_this14.isInsertByRow(row)) {
|
|
1328
|
+
var rowIndex = _this14.getRowIndex(row);
|
|
1256
1329
|
|
|
1257
1330
|
if (treeConfig && rowIndex === -1) {
|
|
1258
1331
|
throw new Error(_tools.UtilTools.getLog('vxe.error.noTree', ['revertData']));
|
|
@@ -1336,7 +1409,7 @@ var Methods = {
|
|
|
1336
1409
|
* @param {String} field 字段名
|
|
1337
1410
|
*/
|
|
1338
1411
|
isUpdateByRow: function isUpdateByRow(row, field) {
|
|
1339
|
-
var
|
|
1412
|
+
var _this15 = this;
|
|
1340
1413
|
|
|
1341
1414
|
var visibleColumn = this.visibleColumn,
|
|
1342
1415
|
keepSource = this.keepSource,
|
|
@@ -1357,7 +1430,7 @@ var Methods = {
|
|
|
1357
1430
|
var children = treeOpts.children;
|
|
1358
1431
|
|
|
1359
1432
|
var matchObj = _xeUtils.default.findTree(tableSourceData, function (item) {
|
|
1360
|
-
return rowid === getRowid(
|
|
1433
|
+
return rowid === getRowid(_this15, item);
|
|
1361
1434
|
}, treeOpts);
|
|
1362
1435
|
|
|
1363
1436
|
row = Object.assign({}, row, _defineProperty({}, children, null));
|
|
@@ -1481,18 +1554,23 @@ var Methods = {
|
|
|
1481
1554
|
* 如果存在筛选条件,继续处理
|
|
1482
1555
|
*/
|
|
1483
1556
|
updateAfterFullData: function updateAfterFullData() {
|
|
1484
|
-
var
|
|
1557
|
+
var _this16 = this;
|
|
1485
1558
|
|
|
1486
1559
|
var tableFullColumn = this.tableFullColumn,
|
|
1487
1560
|
tableFullData = this.tableFullData,
|
|
1488
1561
|
filterOpts = this.filterOpts,
|
|
1489
|
-
sortOpts = this.sortOpts
|
|
1562
|
+
sortOpts = this.sortOpts,
|
|
1563
|
+
treeConfig = this.treeConfig,
|
|
1564
|
+
treeOpts = this.treeOpts,
|
|
1565
|
+
tableFullTreeData = this.tableFullTreeData;
|
|
1490
1566
|
var allRemoteFilter = filterOpts.remote,
|
|
1491
1567
|
allFilterMethod = filterOpts.filterMethod;
|
|
1492
1568
|
var allRemoteSort = sortOpts.remote,
|
|
1493
1569
|
allSortMethod = sortOpts.sortMethod,
|
|
1494
1570
|
sortMultiple = sortOpts.multiple;
|
|
1495
|
-
var
|
|
1571
|
+
var transform = treeOpts.transform;
|
|
1572
|
+
var tableData = [];
|
|
1573
|
+
var tableTree = [];
|
|
1496
1574
|
var filterColumns = [];
|
|
1497
1575
|
var orderColumns = [];
|
|
1498
1576
|
tableFullColumn.forEach(function (column) {
|
|
@@ -1529,7 +1607,7 @@ var Methods = {
|
|
|
1529
1607
|
});
|
|
1530
1608
|
|
|
1531
1609
|
if (filterColumns.length) {
|
|
1532
|
-
|
|
1610
|
+
var handleFilter = function handleFilter(row) {
|
|
1533
1611
|
return filterColumns.every(function (_ref) {
|
|
1534
1612
|
var column = _ref.column,
|
|
1535
1613
|
valueList = _ref.valueList,
|
|
@@ -1552,7 +1630,7 @@ var Methods = {
|
|
|
1552
1630
|
cellValue: cellValue,
|
|
1553
1631
|
row: row,
|
|
1554
1632
|
column: column,
|
|
1555
|
-
$table:
|
|
1633
|
+
$table: _this16
|
|
1556
1634
|
});
|
|
1557
1635
|
});
|
|
1558
1636
|
} else if (compFilterMethod) {
|
|
@@ -1563,7 +1641,7 @@ var Methods = {
|
|
|
1563
1641
|
cellValue: cellValue,
|
|
1564
1642
|
row: row,
|
|
1565
1643
|
column: column,
|
|
1566
|
-
$table:
|
|
1644
|
+
$table: _this16
|
|
1567
1645
|
});
|
|
1568
1646
|
});
|
|
1569
1647
|
} else if (allFilterMethod) {
|
|
@@ -1582,7 +1660,7 @@ var Methods = {
|
|
|
1582
1660
|
cellValue: cellValue,
|
|
1583
1661
|
row: row,
|
|
1584
1662
|
column: column,
|
|
1585
|
-
$table:
|
|
1663
|
+
$table: _this16
|
|
1586
1664
|
});
|
|
1587
1665
|
});
|
|
1588
1666
|
}
|
|
@@ -1592,7 +1670,19 @@ var Methods = {
|
|
|
1592
1670
|
|
|
1593
1671
|
return true;
|
|
1594
1672
|
});
|
|
1595
|
-
}
|
|
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;
|
|
1596
1686
|
}
|
|
1597
1687
|
|
|
1598
1688
|
var firstOrderColumn = orderColumns[0];
|
|
@@ -1614,7 +1704,7 @@ var Methods = {
|
|
|
1614
1704
|
tableData = _xeUtils.default.orderBy(tableData, orderColumns.map(function (_ref2) {
|
|
1615
1705
|
var column = _ref2.column,
|
|
1616
1706
|
order = _ref2.order;
|
|
1617
|
-
return [getOrderField(
|
|
1707
|
+
return [getOrderField(_this16, column), order];
|
|
1618
1708
|
}));
|
|
1619
1709
|
} else {
|
|
1620
1710
|
// 兼容 v2,在 v4 中废弃, sortBy 不能为数组
|
|
@@ -1629,14 +1719,113 @@ var Methods = {
|
|
|
1629
1719
|
tableData = _xeUtils.default.orderBy(tableData, sortByConfs || [firstOrderColumn].map(function (_ref3) {
|
|
1630
1720
|
var column = _ref3.column,
|
|
1631
1721
|
order = _ref3.order;
|
|
1632
|
-
return [getOrderField(
|
|
1722
|
+
return [getOrderField(_this16, column), order];
|
|
1633
1723
|
}));
|
|
1634
1724
|
}
|
|
1635
1725
|
}
|
|
1726
|
+
|
|
1727
|
+
tableTree = tableData;
|
|
1636
1728
|
}
|
|
1637
1729
|
|
|
1638
1730
|
this.afterFullData = tableData;
|
|
1639
|
-
|
|
1731
|
+
this.afterTreeFullData = tableTree;
|
|
1732
|
+
this.updateAfterDataIndex();
|
|
1733
|
+
},
|
|
1734
|
+
|
|
1735
|
+
/**
|
|
1736
|
+
* 预编译
|
|
1737
|
+
* 对渲染中的数据提前解析序号及索引。牺牲提前编译耗时换取渲染中额外损耗,使运行时更加流畅
|
|
1738
|
+
*/
|
|
1739
|
+
updateAfterDataIndex: function updateAfterDataIndex() {
|
|
1740
|
+
var _this17 = this;
|
|
1741
|
+
|
|
1742
|
+
var treeConfig = this.treeConfig,
|
|
1743
|
+
afterFullData = this.afterFullData,
|
|
1744
|
+
fullDataRowIdData = this.fullDataRowIdData,
|
|
1745
|
+
fullAllDataRowIdData = this.fullAllDataRowIdData,
|
|
1746
|
+
afterTreeFullData = this.afterTreeFullData,
|
|
1747
|
+
treeOpts = this.treeOpts;
|
|
1748
|
+
|
|
1749
|
+
if (treeConfig) {
|
|
1750
|
+
_xeUtils.default.eachTree(afterTreeFullData, function (row, index, items, path) {
|
|
1751
|
+
var rowid = getRowid(_this17, row);
|
|
1752
|
+
var allrest = fullAllDataRowIdData[rowid];
|
|
1753
|
+
var fullrest = fullDataRowIdData[rowid];
|
|
1754
|
+
var seq = path.map(function (num, i) {
|
|
1755
|
+
return i % 2 === 0 ? Number(num) + 1 : '.';
|
|
1756
|
+
}).join('');
|
|
1757
|
+
|
|
1758
|
+
if (allrest) {
|
|
1759
|
+
allrest.seq = seq;
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
if (fullrest) {
|
|
1763
|
+
fullrest.seq = seq;
|
|
1764
|
+
} else {
|
|
1765
|
+
fullAllDataRowIdData[rowid] = {
|
|
1766
|
+
row: row,
|
|
1767
|
+
rowid: rowid,
|
|
1768
|
+
seq: seq,
|
|
1769
|
+
index: -1,
|
|
1770
|
+
$index: -1,
|
|
1771
|
+
_index: index,
|
|
1772
|
+
items: [],
|
|
1773
|
+
parent: null,
|
|
1774
|
+
level: 0
|
|
1775
|
+
};
|
|
1776
|
+
fullDataRowIdData[rowid] = {
|
|
1777
|
+
row: row,
|
|
1778
|
+
rowid: rowid,
|
|
1779
|
+
seq: seq,
|
|
1780
|
+
index: -1,
|
|
1781
|
+
$index: -1,
|
|
1782
|
+
_index: index,
|
|
1783
|
+
items: [],
|
|
1784
|
+
parent: null,
|
|
1785
|
+
level: 0
|
|
1786
|
+
};
|
|
1787
|
+
}
|
|
1788
|
+
}, treeOpts);
|
|
1789
|
+
} else {
|
|
1790
|
+
afterFullData.forEach(function (row, index) {
|
|
1791
|
+
var rowid = getRowid(_this17, row);
|
|
1792
|
+
var allrest = fullAllDataRowIdData[rowid];
|
|
1793
|
+
var fullrest = fullDataRowIdData[rowid];
|
|
1794
|
+
var seq = index + 1;
|
|
1795
|
+
|
|
1796
|
+
if (allrest) {
|
|
1797
|
+
allrest.seq = seq;
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
if (fullrest) {
|
|
1801
|
+
fullrest.seq = seq;
|
|
1802
|
+
fullrest._index = index;
|
|
1803
|
+
} else {
|
|
1804
|
+
fullAllDataRowIdData[rowid] = {
|
|
1805
|
+
row: row,
|
|
1806
|
+
rowid: rowid,
|
|
1807
|
+
seq: seq,
|
|
1808
|
+
index: -1,
|
|
1809
|
+
$index: -1,
|
|
1810
|
+
_index: index,
|
|
1811
|
+
items: [],
|
|
1812
|
+
parent: null,
|
|
1813
|
+
level: 0
|
|
1814
|
+
};
|
|
1815
|
+
fullDataRowIdData[rowid] = {
|
|
1816
|
+
row: row,
|
|
1817
|
+
rowid: rowid,
|
|
1818
|
+
seq: seq,
|
|
1819
|
+
index: -1,
|
|
1820
|
+
$index: -1,
|
|
1821
|
+
_index: index,
|
|
1822
|
+
items: [],
|
|
1823
|
+
parent: null,
|
|
1824
|
+
level: 0
|
|
1825
|
+
};
|
|
1826
|
+
}
|
|
1827
|
+
});
|
|
1828
|
+
}
|
|
1640
1829
|
},
|
|
1641
1830
|
|
|
1642
1831
|
/**
|
|
@@ -1680,7 +1869,7 @@ var Methods = {
|
|
|
1680
1869
|
* 默认执行一次,除非被重置
|
|
1681
1870
|
*/
|
|
1682
1871
|
handleLoadDefaults: function handleLoadDefaults() {
|
|
1683
|
-
var
|
|
1872
|
+
var _this18 = this;
|
|
1684
1873
|
|
|
1685
1874
|
if (this.checkboxConfig) {
|
|
1686
1875
|
this.handleDefaultSelectionChecked();
|
|
@@ -1707,7 +1896,7 @@ var Methods = {
|
|
|
1707
1896
|
}
|
|
1708
1897
|
|
|
1709
1898
|
this.$nextTick(function () {
|
|
1710
|
-
return setTimeout(
|
|
1899
|
+
return setTimeout(_this18.recalculate);
|
|
1711
1900
|
});
|
|
1712
1901
|
},
|
|
1713
1902
|
|
|
@@ -1964,12 +2153,12 @@ var Methods = {
|
|
|
1964
2153
|
* 刷新列配置
|
|
1965
2154
|
*/
|
|
1966
2155
|
refreshColumn: function refreshColumn() {
|
|
1967
|
-
var
|
|
2156
|
+
var _this19 = this;
|
|
1968
2157
|
|
|
1969
2158
|
return this.parseColumns().then(function () {
|
|
1970
|
-
return
|
|
2159
|
+
return _this19.refreshScroll();
|
|
1971
2160
|
}).then(function () {
|
|
1972
|
-
return
|
|
2161
|
+
return _this19.recalculate();
|
|
1973
2162
|
});
|
|
1974
2163
|
},
|
|
1975
2164
|
|
|
@@ -1978,7 +2167,7 @@ var Methods = {
|
|
|
1978
2167
|
* 将固定的列左边、右边分别靠边
|
|
1979
2168
|
*/
|
|
1980
2169
|
parseColumns: function parseColumns() {
|
|
1981
|
-
var
|
|
2170
|
+
var _this20 = this;
|
|
1982
2171
|
|
|
1983
2172
|
var leftList = [];
|
|
1984
2173
|
var centerList = [];
|
|
@@ -2105,11 +2294,11 @@ var Methods = {
|
|
|
2105
2294
|
this.visibleColumn = visibleColumn;
|
|
2106
2295
|
this.handleTableColumn();
|
|
2107
2296
|
return this.updateFooter().then(function () {
|
|
2108
|
-
return
|
|
2297
|
+
return _this20.recalculate();
|
|
2109
2298
|
}).then(function () {
|
|
2110
|
-
|
|
2299
|
+
_this20.updateCellAreas();
|
|
2111
2300
|
|
|
2112
|
-
return
|
|
2301
|
+
return _this20.recalculate();
|
|
2113
2302
|
});
|
|
2114
2303
|
},
|
|
2115
2304
|
|
|
@@ -2193,7 +2382,7 @@ var Methods = {
|
|
|
2193
2382
|
* 支持 width=? width=?px width=?% min-width=? min-width=?px min-width=?%
|
|
2194
2383
|
*/
|
|
2195
2384
|
recalculate: function recalculate(refull) {
|
|
2196
|
-
var
|
|
2385
|
+
var _this21 = this;
|
|
2197
2386
|
|
|
2198
2387
|
var $refs = this.$refs;
|
|
2199
2388
|
var tableBody = $refs.tableBody,
|
|
@@ -2209,9 +2398,9 @@ var Methods = {
|
|
|
2209
2398
|
if (refull === true) {
|
|
2210
2399
|
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
2211
2400
|
return this.computeScrollLoad().then(function () {
|
|
2212
|
-
|
|
2401
|
+
_this21.autoCellWidth(headerElem, bodyElem, footerElem);
|
|
2213
2402
|
|
|
2214
|
-
return
|
|
2403
|
+
return _this21.computeScrollLoad();
|
|
2215
2404
|
});
|
|
2216
2405
|
}
|
|
2217
2406
|
}
|
|
@@ -2359,7 +2548,7 @@ var Methods = {
|
|
|
2359
2548
|
this.customMaxHeight = calcHeight(this, 'maxHeight');
|
|
2360
2549
|
},
|
|
2361
2550
|
updateStyle: function updateStyle() {
|
|
2362
|
-
var
|
|
2551
|
+
var _this22 = this;
|
|
2363
2552
|
|
|
2364
2553
|
var $refs = this.$refs,
|
|
2365
2554
|
isGroup = this.isGroup,
|
|
@@ -2463,7 +2652,7 @@ var Methods = {
|
|
|
2463
2652
|
|
|
2464
2653
|
if (isGroup && listElem) {
|
|
2465
2654
|
_xeUtils.default.arrayEach(listElem.querySelectorAll('.col--group'), function (thElem) {
|
|
2466
|
-
var colNode =
|
|
2655
|
+
var colNode = _this22.getColumnNode(thElem);
|
|
2467
2656
|
|
|
2468
2657
|
if (colNode) {
|
|
2469
2658
|
var column = colNode.item;
|
|
@@ -2644,10 +2833,10 @@ var Methods = {
|
|
|
2644
2833
|
|
|
2645
2834
|
if (cellElem) {
|
|
2646
2835
|
if (colspan > 1) {
|
|
2647
|
-
var columnIndex =
|
|
2836
|
+
var columnIndex = _this22.getColumnIndex(column);
|
|
2648
2837
|
|
|
2649
2838
|
for (var _index = 1; _index < colspan; _index++) {
|
|
2650
|
-
var nextColumn =
|
|
2839
|
+
var nextColumn = _this22.getColumns(columnIndex + _index);
|
|
2651
2840
|
|
|
2652
2841
|
if (nextColumn) {
|
|
2653
2842
|
colWidth += nextColumn.renderWidth;
|
|
@@ -2697,7 +2886,7 @@ var Methods = {
|
|
|
2697
2886
|
}
|
|
2698
2887
|
},
|
|
2699
2888
|
preventEvent: function preventEvent(evnt, type, args, next, end) {
|
|
2700
|
-
var
|
|
2889
|
+
var _this23 = this;
|
|
2701
2890
|
|
|
2702
2891
|
var evntList = _vXETable.default.interceptor.get(type);
|
|
2703
2892
|
|
|
@@ -2705,8 +2894,8 @@ var Methods = {
|
|
|
2705
2894
|
|
|
2706
2895
|
if (!evntList.some(function (func) {
|
|
2707
2896
|
return func(Object.assign({
|
|
2708
|
-
$grid:
|
|
2709
|
-
$table:
|
|
2897
|
+
$grid: _this23.$xegrid,
|
|
2898
|
+
$table: _this23,
|
|
2710
2899
|
$event: evnt
|
|
2711
2900
|
}, args)) === false;
|
|
2712
2901
|
})) {
|
|
@@ -2726,7 +2915,7 @@ var Methods = {
|
|
|
2726
2915
|
* 全局按下事件处理
|
|
2727
2916
|
*/
|
|
2728
2917
|
handleGlobalMousedownEvent: function handleGlobalMousedownEvent(evnt) {
|
|
2729
|
-
var
|
|
2918
|
+
var _this24 = this;
|
|
2730
2919
|
|
|
2731
2920
|
var $el = this.$el,
|
|
2732
2921
|
$refs = this.$refs,
|
|
@@ -2787,7 +2976,7 @@ var Methods = {
|
|
|
2787
2976
|
} // 如果固定了高度且点击了行之外的空白处,则清除激活状态
|
|
2788
2977
|
|
|
2789
2978
|
|
|
2790
|
-
if (!isClearActived &&
|
|
2979
|
+
if (!isClearActived && _this24.height && !_this24.overflowY) {
|
|
2791
2980
|
var bodyWrapperElem = evnt.target;
|
|
2792
2981
|
|
|
2793
2982
|
if (hasClass(bodyWrapperElem, 'vxe-table--body-wrapper')) {
|
|
@@ -2798,7 +2987,7 @@ var Methods = {
|
|
|
2798
2987
|
if (isClearActived || // 如果点击了当前表格之外
|
|
2799
2988
|
!getEventTargetNode(evnt, $el).flag) {
|
|
2800
2989
|
setTimeout(function () {
|
|
2801
|
-
return
|
|
2990
|
+
return _this24.clearActived(evnt);
|
|
2802
2991
|
});
|
|
2803
2992
|
}
|
|
2804
2993
|
});
|
|
@@ -2812,9 +3001,9 @@ var Methods = {
|
|
|
2812
3001
|
|
|
2813
3002
|
if (!getEventTargetNode(evnt, document.body, 'vxe-table--ignore-areas-clear').flag) {
|
|
2814
3003
|
this.preventEvent(evnt, 'event.clearAreas', {}, function () {
|
|
2815
|
-
|
|
3004
|
+
_this24.clearCellAreas();
|
|
2816
3005
|
|
|
2817
|
-
|
|
3006
|
+
_this24.clearCopyCellArea();
|
|
2818
3007
|
});
|
|
2819
3008
|
}
|
|
2820
3009
|
}
|
|
@@ -2849,45 +3038,48 @@ var Methods = {
|
|
|
2849
3038
|
* 表格键盘事件
|
|
2850
3039
|
*/
|
|
2851
3040
|
keydownEvent: function keydownEvent(evnt) {
|
|
2852
|
-
var
|
|
3041
|
+
var _this25 = this;
|
|
2853
3042
|
|
|
2854
3043
|
var filterStore = this.filterStore,
|
|
2855
3044
|
ctxMenuStore = this.ctxMenuStore,
|
|
2856
3045
|
editStore = this.editStore,
|
|
2857
3046
|
keyboardConfig = this.keyboardConfig,
|
|
2858
3047
|
mouseConfig = this.mouseConfig,
|
|
2859
|
-
mouseOpts = this.mouseOpts
|
|
3048
|
+
mouseOpts = this.mouseOpts,
|
|
3049
|
+
keyboardOpts = this.keyboardOpts;
|
|
2860
3050
|
var actived = editStore.actived;
|
|
2861
3051
|
var keyCode = evnt.keyCode;
|
|
2862
3052
|
var isEsc = keyCode === 27;
|
|
2863
3053
|
|
|
2864
3054
|
if (isEsc) {
|
|
2865
3055
|
this.preventEvent(evnt, 'event.keydown', null, function () {
|
|
2866
|
-
if (keyboardConfig && mouseConfig && mouseOpts.area &&
|
|
2867
|
-
|
|
3056
|
+
if (keyboardConfig && mouseConfig && mouseOpts.area && _this25.handleKeyboardEvent) {
|
|
3057
|
+
_this25.handleKeyboardEvent(evnt);
|
|
2868
3058
|
} else if (actived.row || filterStore.visible || ctxMenuStore.visible) {
|
|
2869
3059
|
evnt.stopPropagation(); // 如果按下了 Esc 键,关闭快捷菜单、筛选
|
|
2870
3060
|
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
_this23.closeMenu(); // 如果是激活编辑状态,则取消编辑
|
|
3061
|
+
_this25.closeFilter();
|
|
2874
3062
|
|
|
3063
|
+
_this25.closeMenu();
|
|
2875
3064
|
|
|
2876
|
-
if (
|
|
2877
|
-
|
|
3065
|
+
if (keyboardConfig && keyboardOpts.isEsc) {
|
|
3066
|
+
// 如果是激活编辑状态,则取消编辑
|
|
3067
|
+
if (actived.row) {
|
|
3068
|
+
var params = actived.args;
|
|
2878
3069
|
|
|
2879
|
-
|
|
3070
|
+
_this25.clearActived(evnt); // 如果配置了选中功能,则为选中状态
|
|
2880
3071
|
|
|
2881
3072
|
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
3073
|
+
if (mouseConfig && mouseOpts.selected) {
|
|
3074
|
+
_this25.$nextTick(function () {
|
|
3075
|
+
return _this25.handleSelected(params, evnt);
|
|
3076
|
+
});
|
|
3077
|
+
}
|
|
2886
3078
|
}
|
|
2887
3079
|
}
|
|
2888
3080
|
}
|
|
2889
3081
|
|
|
2890
|
-
|
|
3082
|
+
_this25.emitEvent('keydown', {}, evnt);
|
|
2891
3083
|
});
|
|
2892
3084
|
}
|
|
2893
3085
|
},
|
|
@@ -2896,27 +3088,27 @@ var Methods = {
|
|
|
2896
3088
|
* 全局键盘事件
|
|
2897
3089
|
*/
|
|
2898
3090
|
handleGlobalKeydownEvent: function handleGlobalKeydownEvent(evnt) {
|
|
2899
|
-
var
|
|
3091
|
+
var _this26 = this;
|
|
2900
3092
|
|
|
2901
3093
|
// 该行为只对当前激活的表格有效
|
|
2902
3094
|
if (this.isActivated) {
|
|
2903
3095
|
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 =
|
|
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;
|
|
2920
3112
|
var selected = editStore.selected,
|
|
2921
3113
|
actived = editStore.actived;
|
|
2922
3114
|
var keyCode = evnt.keyCode;
|
|
@@ -2943,7 +3135,7 @@ var Methods = {
|
|
|
2943
3135
|
|
|
2944
3136
|
if (filterStore.visible) {
|
|
2945
3137
|
if (isEsc) {
|
|
2946
|
-
|
|
3138
|
+
_this26.closeFilter();
|
|
2947
3139
|
}
|
|
2948
3140
|
|
|
2949
3141
|
return;
|
|
@@ -2954,20 +3146,20 @@ var Methods = {
|
|
|
2954
3146
|
evnt.preventDefault();
|
|
2955
3147
|
|
|
2956
3148
|
if (ctxMenuStore.showChild && hasChildrenList(ctxMenuStore.selected)) {
|
|
2957
|
-
|
|
3149
|
+
_this26.moveCtxMenu(evnt, keyCode, ctxMenuStore, 'selectChild', 37, false, ctxMenuStore.selected.children);
|
|
2958
3150
|
} else {
|
|
2959
|
-
|
|
3151
|
+
_this26.moveCtxMenu(evnt, keyCode, ctxMenuStore, 'selected', 39, true, _this26.ctxMenuList);
|
|
2960
3152
|
}
|
|
2961
|
-
} else if (keyboardConfig && mouseConfig && mouseOpts.area &&
|
|
2962
|
-
|
|
3153
|
+
} else if (keyboardConfig && mouseConfig && mouseOpts.area && _this26.handleKeyboardEvent) {
|
|
3154
|
+
_this26.handleKeyboardEvent(evnt);
|
|
2963
3155
|
} else if (keyboardConfig && isSpacebar && keyboardOpts.isChecked && selected.row && selected.column && (selected.column.type === 'checkbox' || selected.column.type === 'radio')) {
|
|
2964
3156
|
// 空格键支持选中复选框
|
|
2965
3157
|
evnt.preventDefault();
|
|
2966
3158
|
|
|
2967
3159
|
if (selected.column.type === 'checkbox') {
|
|
2968
|
-
|
|
3160
|
+
_this26.handleToggleCheckRowEvent(evnt, selected.args);
|
|
2969
3161
|
} else {
|
|
2970
|
-
|
|
3162
|
+
_this26.triggerRadioRowEvent(evnt, selected.args);
|
|
2971
3163
|
}
|
|
2972
3164
|
} else if (isF2 && (0, _utils.isEnableConf)(editConfig)) {
|
|
2973
3165
|
if (!isEditStatus) {
|
|
@@ -2976,15 +3168,15 @@ var Methods = {
|
|
|
2976
3168
|
evnt.stopPropagation();
|
|
2977
3169
|
evnt.preventDefault();
|
|
2978
3170
|
|
|
2979
|
-
|
|
3171
|
+
_this26.handleActived(selected.args, evnt);
|
|
2980
3172
|
}
|
|
2981
3173
|
}
|
|
2982
3174
|
} else if (isContextMenu) {
|
|
2983
3175
|
// 如果按下上下文键
|
|
2984
|
-
|
|
2985
|
-
clearTimeout(
|
|
2986
|
-
|
|
2987
|
-
|
|
3176
|
+
_this26._keyCtx = selected.row && selected.column && bodyCtxMenu.length;
|
|
3177
|
+
clearTimeout(_this26.keyCtxTimeout);
|
|
3178
|
+
_this26.keyCtxTimeout = setTimeout(function () {
|
|
3179
|
+
_this26._keyCtx = false;
|
|
2988
3180
|
}, 1000);
|
|
2989
3181
|
} else if (isEnter && !hasAltKey && keyboardConfig && keyboardOpts.isEnter && (selected.row || actived.row || treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow)) {
|
|
2990
3182
|
// 退出选中
|
|
@@ -2993,12 +3185,12 @@ var Methods = {
|
|
|
2993
3185
|
if (actived.row) {
|
|
2994
3186
|
params = actived.args;
|
|
2995
3187
|
|
|
2996
|
-
|
|
3188
|
+
_this26.clearActived(evnt); // 如果配置了选中功能,则为选中状态
|
|
2997
3189
|
|
|
2998
3190
|
|
|
2999
3191
|
if (mouseConfig && mouseOpts.selected) {
|
|
3000
|
-
|
|
3001
|
-
return
|
|
3192
|
+
_this26.$nextTick(function () {
|
|
3193
|
+
return _this26.handleSelected(params, evnt);
|
|
3002
3194
|
});
|
|
3003
3195
|
}
|
|
3004
3196
|
}
|
|
@@ -3009,15 +3201,15 @@ var Methods = {
|
|
|
3009
3201
|
|
|
3010
3202
|
if (hasShiftKey) {
|
|
3011
3203
|
if (keyboardOpts.enterToTab) {
|
|
3012
|
-
|
|
3204
|
+
_this26.moveTabSelected(targetArgs, hasShiftKey, evnt);
|
|
3013
3205
|
} else {
|
|
3014
|
-
|
|
3206
|
+
_this26.moveSelected(targetArgs, isLeftArrow, true, isRightArrow, false, evnt);
|
|
3015
3207
|
}
|
|
3016
3208
|
} else {
|
|
3017
3209
|
if (keyboardOpts.enterToTab) {
|
|
3018
|
-
|
|
3210
|
+
_this26.moveTabSelected(targetArgs, hasShiftKey, evnt);
|
|
3019
3211
|
} else {
|
|
3020
|
-
|
|
3212
|
+
_this26.moveSelected(targetArgs, isLeftArrow, false, isRightArrow, true, evnt);
|
|
3021
3213
|
}
|
|
3022
3214
|
}
|
|
3023
3215
|
} else if (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
|
|
@@ -3028,14 +3220,14 @@ var Methods = {
|
|
|
3028
3220
|
evnt.preventDefault();
|
|
3029
3221
|
var targetRow = childrens[0];
|
|
3030
3222
|
params = {
|
|
3031
|
-
$table:
|
|
3223
|
+
$table: _this26,
|
|
3032
3224
|
row: targetRow
|
|
3033
3225
|
};
|
|
3034
3226
|
|
|
3035
|
-
|
|
3036
|
-
return
|
|
3227
|
+
_this26.setTreeExpand(currentRow, true).then(function () {
|
|
3228
|
+
return _this26.scrollToRow(targetRow);
|
|
3037
3229
|
}).then(function () {
|
|
3038
|
-
return
|
|
3230
|
+
return _this26.triggerCurrentRowEvent(evnt, params);
|
|
3039
3231
|
});
|
|
3040
3232
|
}
|
|
3041
3233
|
}
|
|
@@ -3044,18 +3236,18 @@ var Methods = {
|
|
|
3044
3236
|
if (!isEditStatus) {
|
|
3045
3237
|
// 如果按下了方向键
|
|
3046
3238
|
if (selected.row && selected.column) {
|
|
3047
|
-
|
|
3239
|
+
_this26.moveSelected(selected.args, isLeftArrow, isUpArrow, isRightArrow, isDwArrow, evnt);
|
|
3048
3240
|
} else if ((isUpArrow || isDwArrow) && (rowOpts.isCurrent || highlightCurrentRow)) {
|
|
3049
3241
|
// 当前行按键上下移动
|
|
3050
|
-
|
|
3242
|
+
_this26.moveCurrentRow(isUpArrow, isDwArrow, evnt);
|
|
3051
3243
|
}
|
|
3052
3244
|
}
|
|
3053
3245
|
} else if (isTab && keyboardConfig && keyboardOpts.isTab) {
|
|
3054
3246
|
// 如果按下了 Tab 键切换
|
|
3055
3247
|
if (selected.row || selected.column) {
|
|
3056
|
-
|
|
3248
|
+
_this26.moveTabSelected(selected.args, hasShiftKey, evnt);
|
|
3057
3249
|
} else if (actived.row || actived.column) {
|
|
3058
|
-
|
|
3250
|
+
_this26.moveTabSelected(actived.args, hasShiftKey, evnt);
|
|
3059
3251
|
}
|
|
3060
3252
|
} else if (keyboardConfig && (isDel || (treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow ? isBack && keyboardOpts.isArrow : isBack))) {
|
|
3061
3253
|
if (!isEditStatus) {
|
|
@@ -3066,10 +3258,10 @@ var Methods = {
|
|
|
3066
3258
|
if (delMethod) {
|
|
3067
3259
|
delMethod({
|
|
3068
3260
|
row: selected.row,
|
|
3069
|
-
rowIndex:
|
|
3261
|
+
rowIndex: _this26.getRowIndex(selected.row),
|
|
3070
3262
|
column: selected.column,
|
|
3071
|
-
columnIndex:
|
|
3072
|
-
$table:
|
|
3263
|
+
columnIndex: _this26.getColumnIndex(selected.column),
|
|
3264
|
+
$table: _this26
|
|
3073
3265
|
});
|
|
3074
3266
|
} else {
|
|
3075
3267
|
setCellValue(selected.row, selected.column, null);
|
|
@@ -3079,21 +3271,21 @@ var Methods = {
|
|
|
3079
3271
|
if (backMethod) {
|
|
3080
3272
|
backMethod({
|
|
3081
3273
|
row: selected.row,
|
|
3082
|
-
rowIndex:
|
|
3274
|
+
rowIndex: _this26.getRowIndex(selected.row),
|
|
3083
3275
|
column: selected.column,
|
|
3084
|
-
columnIndex:
|
|
3085
|
-
$table:
|
|
3276
|
+
columnIndex: _this26.getColumnIndex(selected.column),
|
|
3277
|
+
$table: _this26
|
|
3086
3278
|
});
|
|
3087
3279
|
} else {
|
|
3088
|
-
|
|
3280
|
+
_this26.handleActived(selected.args, evnt);
|
|
3089
3281
|
}
|
|
3090
3282
|
} else if (isDel) {
|
|
3091
3283
|
// 如果按下 del 键,更新表尾数据
|
|
3092
|
-
|
|
3284
|
+
_this26.updateFooter();
|
|
3093
3285
|
}
|
|
3094
3286
|
} else if (isBack && keyboardOpts.isArrow && treeConfig && (rowOpts.isCurrent || highlightCurrentRow) && currentRow) {
|
|
3095
3287
|
// 如果树形表格回退键关闭当前行返回父节点
|
|
3096
|
-
var _XEUtils$findTree = _xeUtils.default.findTree(
|
|
3288
|
+
var _XEUtils$findTree = _xeUtils.default.findTree(_this26.afterFullData, function (item) {
|
|
3097
3289
|
return item === currentRow;
|
|
3098
3290
|
}, treeOpts),
|
|
3099
3291
|
parentRow = _XEUtils$findTree.parent;
|
|
@@ -3101,14 +3293,14 @@ var Methods = {
|
|
|
3101
3293
|
if (parentRow) {
|
|
3102
3294
|
evnt.preventDefault();
|
|
3103
3295
|
params = {
|
|
3104
|
-
$table:
|
|
3296
|
+
$table: _this26,
|
|
3105
3297
|
row: parentRow
|
|
3106
3298
|
};
|
|
3107
3299
|
|
|
3108
|
-
|
|
3109
|
-
return
|
|
3300
|
+
_this26.setTreeExpand(parentRow, false).then(function () {
|
|
3301
|
+
return _this26.scrollToRow(parentRow);
|
|
3110
3302
|
}).then(function () {
|
|
3111
|
-
return
|
|
3303
|
+
return _this26.triggerCurrentRowEvent(evnt, params);
|
|
3112
3304
|
});
|
|
3113
3305
|
}
|
|
3114
3306
|
}
|
|
@@ -3125,21 +3317,21 @@ var Methods = {
|
|
|
3125
3317
|
if (editMethod) {
|
|
3126
3318
|
editMethod({
|
|
3127
3319
|
row: selected.row,
|
|
3128
|
-
rowIndex:
|
|
3320
|
+
rowIndex: _this26.getRowIndex(selected.row),
|
|
3129
3321
|
column: selected.column,
|
|
3130
|
-
columnIndex:
|
|
3131
|
-
$table:
|
|
3322
|
+
columnIndex: _this26.getColumnIndex(selected.column),
|
|
3323
|
+
$table: _this26
|
|
3132
3324
|
});
|
|
3133
3325
|
} else {
|
|
3134
3326
|
setCellValue(selected.row, selected.column, null);
|
|
3135
3327
|
|
|
3136
|
-
|
|
3328
|
+
_this26.handleActived(selected.args, evnt);
|
|
3137
3329
|
}
|
|
3138
3330
|
}
|
|
3139
3331
|
}
|
|
3140
3332
|
}
|
|
3141
3333
|
|
|
3142
|
-
|
|
3334
|
+
_this26.emitEvent('keydown', {}, evnt);
|
|
3143
3335
|
});
|
|
3144
3336
|
}
|
|
3145
3337
|
},
|
|
@@ -3209,12 +3401,12 @@ var Methods = {
|
|
|
3209
3401
|
this.recalculate(true);
|
|
3210
3402
|
},
|
|
3211
3403
|
handleTooltipLeaveMethod: function handleTooltipLeaveMethod() {
|
|
3212
|
-
var
|
|
3404
|
+
var _this27 = this;
|
|
3213
3405
|
|
|
3214
3406
|
var tooltipOpts = this.tooltipOpts;
|
|
3215
3407
|
setTimeout(function () {
|
|
3216
|
-
if (!
|
|
3217
|
-
|
|
3408
|
+
if (!_this27.tooltipActive) {
|
|
3409
|
+
_this27.closeTooltip();
|
|
3218
3410
|
}
|
|
3219
3411
|
}, tooltipOpts.leaveDelay);
|
|
3220
3412
|
return false;
|
|
@@ -3225,17 +3417,17 @@ var Methods = {
|
|
|
3225
3417
|
this.closeTooltip();
|
|
3226
3418
|
},
|
|
3227
3419
|
handleTargetLeaveEvent: function handleTargetLeaveEvent() {
|
|
3228
|
-
var
|
|
3420
|
+
var _this28 = this;
|
|
3229
3421
|
|
|
3230
3422
|
var tooltipOpts = this.tooltipOpts;
|
|
3231
3423
|
this.tooltipActive = false;
|
|
3232
3424
|
|
|
3233
3425
|
if (tooltipOpts.enterable) {
|
|
3234
3426
|
this.tooltipTimeout = setTimeout(function () {
|
|
3235
|
-
var tooltip =
|
|
3427
|
+
var tooltip = _this28.$refs.tooltip;
|
|
3236
3428
|
|
|
3237
3429
|
if (tooltip && !tooltip.isHover) {
|
|
3238
|
-
|
|
3430
|
+
_this28.closeTooltip();
|
|
3239
3431
|
}
|
|
3240
3432
|
}, tooltipOpts.leaveDelay);
|
|
3241
3433
|
} else {
|
|
@@ -3468,14 +3660,14 @@ var Methods = {
|
|
|
3468
3660
|
* @param {Boolean} value 是否选中
|
|
3469
3661
|
*/
|
|
3470
3662
|
setCheckboxRow: function setCheckboxRow(rows, value) {
|
|
3471
|
-
var
|
|
3663
|
+
var _this29 = this;
|
|
3472
3664
|
|
|
3473
3665
|
if (rows && !_xeUtils.default.isArray(rows)) {
|
|
3474
3666
|
rows = [rows];
|
|
3475
3667
|
}
|
|
3476
3668
|
|
|
3477
3669
|
rows.forEach(function (row) {
|
|
3478
|
-
return
|
|
3670
|
+
return _this29.handleSelectRow({
|
|
3479
3671
|
row: row
|
|
3480
3672
|
}, !!value);
|
|
3481
3673
|
});
|
|
@@ -3499,7 +3691,7 @@ var Methods = {
|
|
|
3499
3691
|
* value 选中true 不选false 半选-1
|
|
3500
3692
|
*/
|
|
3501
3693
|
handleSelectRow: function handleSelectRow(_ref5, value) {
|
|
3502
|
-
var
|
|
3694
|
+
var _this30 = this;
|
|
3503
3695
|
|
|
3504
3696
|
var row = _ref5.row;
|
|
3505
3697
|
var selection = this.selection,
|
|
@@ -3532,7 +3724,7 @@ var Methods = {
|
|
|
3532
3724
|
return half === item;
|
|
3533
3725
|
});
|
|
3534
3726
|
|
|
3535
|
-
|
|
3727
|
+
_this30.handleCheckboxReserveRow(row, value);
|
|
3536
3728
|
}
|
|
3537
3729
|
}, treeOpts);
|
|
3538
3730
|
} // 如果存在父节点,更新父节点状态
|
|
@@ -3606,7 +3798,7 @@ var Methods = {
|
|
|
3606
3798
|
return half === item;
|
|
3607
3799
|
});
|
|
3608
3800
|
|
|
3609
|
-
|
|
3801
|
+
_this30.handleCheckboxReserveRow(row, value);
|
|
3610
3802
|
}
|
|
3611
3803
|
}, treeOpts);
|
|
3612
3804
|
} // 如果存在父节点,更新父节点状态
|
|
@@ -3710,7 +3902,7 @@ var Methods = {
|
|
|
3710
3902
|
* @param {Boolean} value 是否选中
|
|
3711
3903
|
*/
|
|
3712
3904
|
setAllCheckboxRow: function setAllCheckboxRow(value) {
|
|
3713
|
-
var
|
|
3905
|
+
var _this31 = this;
|
|
3714
3906
|
|
|
3715
3907
|
var afterFullData = this.afterFullData,
|
|
3716
3908
|
treeConfig = this.treeConfig,
|
|
@@ -3823,11 +4015,11 @@ var Methods = {
|
|
|
3823
4015
|
if (reserve) {
|
|
3824
4016
|
if (value) {
|
|
3825
4017
|
selectRows.forEach(function (row) {
|
|
3826
|
-
checkboxReserveRowMap[getRowid(
|
|
4018
|
+
checkboxReserveRowMap[getRowid(_this31, row)] = row;
|
|
3827
4019
|
});
|
|
3828
4020
|
} else {
|
|
3829
4021
|
afterFullData.forEach(function (row) {
|
|
3830
|
-
return
|
|
4022
|
+
return _this31.handleCheckboxReserveRow(row, false);
|
|
3831
4023
|
});
|
|
3832
4024
|
}
|
|
3833
4025
|
}
|
|
@@ -4022,7 +4214,7 @@ var Methods = {
|
|
|
4022
4214
|
* 获取复选框保留选中的行
|
|
4023
4215
|
*/
|
|
4024
4216
|
getCheckboxReserveRecords: function getCheckboxReserveRecords(isFull) {
|
|
4025
|
-
var
|
|
4217
|
+
var _this32 = this;
|
|
4026
4218
|
|
|
4027
4219
|
var fullDataRowIdData = this.fullDataRowIdData,
|
|
4028
4220
|
afterFullData = this.afterFullData,
|
|
@@ -4033,6 +4225,18 @@ var Methods = {
|
|
|
4033
4225
|
var reserveSelection = [];
|
|
4034
4226
|
|
|
4035
4227
|
if (checkboxOpts.reserve) {
|
|
4228
|
+
var afterFullIdMaps = {};
|
|
4229
|
+
|
|
4230
|
+
if (treeConfig) {
|
|
4231
|
+
_xeUtils.default.eachTree(afterFullData, function (row) {
|
|
4232
|
+
afterFullIdMaps[getRowid(_this32, row)] = 1;
|
|
4233
|
+
}, treeOpts);
|
|
4234
|
+
} else {
|
|
4235
|
+
afterFullData.forEach(function (row) {
|
|
4236
|
+
afterFullIdMaps[getRowid(_this32, row)] = 1;
|
|
4237
|
+
});
|
|
4238
|
+
}
|
|
4239
|
+
|
|
4036
4240
|
_xeUtils.default.each(checkboxReserveRowMap, function (oldRow, oldRowid) {
|
|
4037
4241
|
if (oldRow) {
|
|
4038
4242
|
if (isFull) {
|
|
@@ -4040,18 +4244,8 @@ var Methods = {
|
|
|
4040
4244
|
reserveSelection.push(oldRow);
|
|
4041
4245
|
}
|
|
4042
4246
|
} else {
|
|
4043
|
-
if (
|
|
4044
|
-
|
|
4045
|
-
return getRowid(_this30, row) === oldRowid;
|
|
4046
|
-
}, treeOpts)) {
|
|
4047
|
-
reserveSelection.push(oldRow);
|
|
4048
|
-
}
|
|
4049
|
-
} else {
|
|
4050
|
-
if (!afterFullData.some(function (row) {
|
|
4051
|
-
return getRowid(_this30, row) === oldRowid;
|
|
4052
|
-
})) {
|
|
4053
|
-
reserveSelection.push(oldRow);
|
|
4054
|
-
}
|
|
4247
|
+
if (!afterFullIdMaps[oldRowid]) {
|
|
4248
|
+
reserveSelection.push(oldRow);
|
|
4055
4249
|
}
|
|
4056
4250
|
}
|
|
4057
4251
|
}
|
|
@@ -4105,7 +4299,7 @@ var Methods = {
|
|
|
4105
4299
|
* 清空行为不管是否被禁用还是保留记录,都将彻底清空选中状态
|
|
4106
4300
|
*/
|
|
4107
4301
|
clearCheckboxRow: function clearCheckboxRow() {
|
|
4108
|
-
var
|
|
4302
|
+
var _this33 = this;
|
|
4109
4303
|
|
|
4110
4304
|
var tableFullData = this.tableFullData,
|
|
4111
4305
|
treeConfig = this.treeConfig,
|
|
@@ -4128,7 +4322,7 @@ var Methods = {
|
|
|
4128
4322
|
|
|
4129
4323
|
if (reserve) {
|
|
4130
4324
|
tableFullData.forEach(function (row) {
|
|
4131
|
-
return
|
|
4325
|
+
return _this33.handleCheckboxReserveRow(row, false);
|
|
4132
4326
|
});
|
|
4133
4327
|
}
|
|
4134
4328
|
|
|
@@ -4420,13 +4614,13 @@ var Methods = {
|
|
|
4420
4614
|
* 如果存在规则,则校验
|
|
4421
4615
|
*/
|
|
4422
4616
|
handleChangeCell: function handleChangeCell(evnt, params) {
|
|
4423
|
-
var
|
|
4617
|
+
var _this34 = this;
|
|
4424
4618
|
|
|
4425
4619
|
this.checkValidate('blur').catch(function (e) {
|
|
4426
4620
|
return e;
|
|
4427
4621
|
}).then(function () {
|
|
4428
|
-
|
|
4429
|
-
return
|
|
4622
|
+
_this34.handleActived(params, evnt).then(function () {
|
|
4623
|
+
return _this34.checkValidate('change');
|
|
4430
4624
|
}).catch(function (e) {
|
|
4431
4625
|
return e;
|
|
4432
4626
|
});
|
|
@@ -4529,7 +4723,7 @@ var Methods = {
|
|
|
4529
4723
|
* 如果是双击模式,则激活为编辑状态
|
|
4530
4724
|
*/
|
|
4531
4725
|
triggerCellDblclickEvent: function triggerCellDblclickEvent(evnt, params) {
|
|
4532
|
-
var
|
|
4726
|
+
var _this35 = this;
|
|
4533
4727
|
|
|
4534
4728
|
var editStore = this.editStore,
|
|
4535
4729
|
editConfig = this.editConfig,
|
|
@@ -4544,15 +4738,15 @@ var Methods = {
|
|
|
4544
4738
|
this.checkValidate('blur').catch(function (e) {
|
|
4545
4739
|
return e;
|
|
4546
4740
|
}).then(function () {
|
|
4547
|
-
|
|
4548
|
-
return
|
|
4741
|
+
_this35.handleActived(params, evnt).then(function () {
|
|
4742
|
+
return _this35.checkValidate('change');
|
|
4549
4743
|
}).catch(function (e) {
|
|
4550
4744
|
return e;
|
|
4551
4745
|
});
|
|
4552
4746
|
});
|
|
4553
4747
|
} else if (editOpts.mode === 'cell') {
|
|
4554
4748
|
this.handleActived(params, evnt).then(function () {
|
|
4555
|
-
return
|
|
4749
|
+
return _this35.checkValidate('change');
|
|
4556
4750
|
}).catch(function (e) {
|
|
4557
4751
|
return e;
|
|
4558
4752
|
});
|
|
@@ -4563,7 +4757,7 @@ var Methods = {
|
|
|
4563
4757
|
this.emitEvent('cell-dblclick', params, evnt);
|
|
4564
4758
|
},
|
|
4565
4759
|
handleDefaultSort: function handleDefaultSort() {
|
|
4566
|
-
var
|
|
4760
|
+
var _this36 = this;
|
|
4567
4761
|
|
|
4568
4762
|
var sortConfig = this.sortConfig,
|
|
4569
4763
|
sortOpts = this.sortOpts;
|
|
@@ -4580,7 +4774,7 @@ var Methods = {
|
|
|
4580
4774
|
order = item.order;
|
|
4581
4775
|
|
|
4582
4776
|
if (field && order) {
|
|
4583
|
-
var column =
|
|
4777
|
+
var column = _this36.getColumnByField(field);
|
|
4584
4778
|
|
|
4585
4779
|
if (column && column.sortable) {
|
|
4586
4780
|
column.order = order;
|
|
@@ -4623,7 +4817,7 @@ var Methods = {
|
|
|
4623
4817
|
}
|
|
4624
4818
|
},
|
|
4625
4819
|
sort: function sort(sortConfs, sortOrder) {
|
|
4626
|
-
var
|
|
4820
|
+
var _this37 = this;
|
|
4627
4821
|
|
|
4628
4822
|
var sortOpts = this.sortOpts;
|
|
4629
4823
|
var multiple = sortOpts.multiple,
|
|
@@ -4656,7 +4850,7 @@ var Methods = {
|
|
|
4656
4850
|
var column = field;
|
|
4657
4851
|
|
|
4658
4852
|
if (_xeUtils.default.isString(field)) {
|
|
4659
|
-
column =
|
|
4853
|
+
column = _this37.getColumnByField(field);
|
|
4660
4854
|
}
|
|
4661
4855
|
|
|
4662
4856
|
if (column && (column.sortable || column.remoteSort)) {
|
|
@@ -4665,7 +4859,7 @@ var Methods = {
|
|
|
4665
4859
|
}
|
|
4666
4860
|
|
|
4667
4861
|
if (orders.indexOf(order) === -1) {
|
|
4668
|
-
order = getNextSortOrder(
|
|
4862
|
+
order = getNextSortOrder(_this37, column);
|
|
4669
4863
|
}
|
|
4670
4864
|
|
|
4671
4865
|
if (column.order !== order) {
|
|
@@ -4816,7 +5010,7 @@ var Methods = {
|
|
|
4816
5010
|
* @param {Row} row 行对象
|
|
4817
5011
|
*/
|
|
4818
5012
|
reloadRowExpand: function reloadRowExpand(row) {
|
|
4819
|
-
var
|
|
5013
|
+
var _this38 = this;
|
|
4820
5014
|
|
|
4821
5015
|
var expandOpts = this.expandOpts,
|
|
4822
5016
|
expandLazyLoadeds = this.expandLazyLoadeds;
|
|
@@ -4824,7 +5018,7 @@ var Methods = {
|
|
|
4824
5018
|
|
|
4825
5019
|
if (lazy && expandLazyLoadeds.indexOf(row) === -1) {
|
|
4826
5020
|
this.clearRowExpandLoaded(row).then(function () {
|
|
4827
|
-
return
|
|
5021
|
+
return _this38.handleAsyncRowExpand(row);
|
|
4828
5022
|
});
|
|
4829
5023
|
}
|
|
4830
5024
|
|
|
@@ -4903,29 +5097,29 @@ var Methods = {
|
|
|
4903
5097
|
return this.setRowExpand(this.expandOpts.lazy ? this.tableData : this.tableFullData, expanded);
|
|
4904
5098
|
},
|
|
4905
5099
|
handleAsyncRowExpand: function handleAsyncRowExpand(row) {
|
|
4906
|
-
var
|
|
5100
|
+
var _this39 = this;
|
|
4907
5101
|
|
|
4908
5102
|
var rest = this.fullAllDataRowMap.get(row);
|
|
4909
5103
|
return new Promise(function (resolve) {
|
|
4910
|
-
|
|
5104
|
+
_this39.expandLazyLoadeds.push(row);
|
|
4911
5105
|
|
|
4912
|
-
|
|
4913
|
-
$table:
|
|
5106
|
+
_this39.expandOpts.loadMethod({
|
|
5107
|
+
$table: _this39,
|
|
4914
5108
|
row: row,
|
|
4915
|
-
rowIndex:
|
|
4916
|
-
$rowIndex:
|
|
5109
|
+
rowIndex: _this39.getRowIndex(row),
|
|
5110
|
+
$rowIndex: _this39.getVMRowIndex(row)
|
|
4917
5111
|
}).catch(function (e) {
|
|
4918
5112
|
return e;
|
|
4919
5113
|
}).then(function () {
|
|
4920
5114
|
rest.expandLoaded = true;
|
|
4921
5115
|
|
|
4922
|
-
_xeUtils.default.remove(
|
|
5116
|
+
_xeUtils.default.remove(_this39.expandLazyLoadeds, function (item) {
|
|
4923
5117
|
return item === row;
|
|
4924
5118
|
});
|
|
4925
5119
|
|
|
4926
|
-
|
|
5120
|
+
_this39.rowExpandeds.push(row);
|
|
4927
5121
|
|
|
4928
|
-
resolve(
|
|
5122
|
+
resolve(_this39.$nextTick().then(_this39.recalculate));
|
|
4929
5123
|
});
|
|
4930
5124
|
});
|
|
4931
5125
|
},
|
|
@@ -4938,7 +5132,7 @@ var Methods = {
|
|
|
4938
5132
|
* @param {Boolean} expanded 是否展开
|
|
4939
5133
|
*/
|
|
4940
5134
|
setRowExpand: function setRowExpand(rows, expanded) {
|
|
4941
|
-
var
|
|
5135
|
+
var _this40 = this;
|
|
4942
5136
|
|
|
4943
5137
|
var fullAllDataRowMap = this.fullAllDataRowMap,
|
|
4944
5138
|
expandLazyLoadeds = this.expandLazyLoadeds,
|
|
@@ -4971,8 +5165,8 @@ var Methods = {
|
|
|
4971
5165
|
columnIndex: columnIndex,
|
|
4972
5166
|
$columnIndex: $columnIndex,
|
|
4973
5167
|
row: row,
|
|
4974
|
-
rowIndex:
|
|
4975
|
-
$rowIndex:
|
|
5168
|
+
rowIndex: _this40.getRowIndex(row),
|
|
5169
|
+
$rowIndex: _this40.getVMRowIndex(row)
|
|
4976
5170
|
});
|
|
4977
5171
|
}) : rows;
|
|
4978
5172
|
|
|
@@ -4983,7 +5177,7 @@ var Methods = {
|
|
|
4983
5177
|
var isLoad = lazy && !rest.expandLoaded && expandLazyLoadeds.indexOf(row) === -1;
|
|
4984
5178
|
|
|
4985
5179
|
if (isLoad) {
|
|
4986
|
-
lazyRests.push(
|
|
5180
|
+
lazyRests.push(_this40.handleAsyncRowExpand(row));
|
|
4987
5181
|
} else {
|
|
4988
5182
|
rowExpandeds.push(row);
|
|
4989
5183
|
}
|
|
@@ -4997,7 +5191,7 @@ var Methods = {
|
|
|
4997
5191
|
|
|
4998
5192
|
if (reserve) {
|
|
4999
5193
|
validRows.forEach(function (row) {
|
|
5000
|
-
return
|
|
5194
|
+
return _this40.handleRowExpandReserve(row, expanded);
|
|
5001
5195
|
});
|
|
5002
5196
|
}
|
|
5003
5197
|
}
|
|
@@ -5018,7 +5212,7 @@ var Methods = {
|
|
|
5018
5212
|
* 手动清空展开行状态,数据会恢复成未展开的状态
|
|
5019
5213
|
*/
|
|
5020
5214
|
clearRowExpand: function clearRowExpand() {
|
|
5021
|
-
var
|
|
5215
|
+
var _this41 = this;
|
|
5022
5216
|
|
|
5023
5217
|
var expandOpts = this.expandOpts,
|
|
5024
5218
|
rowExpandeds = this.rowExpandeds,
|
|
@@ -5029,13 +5223,13 @@ var Methods = {
|
|
|
5029
5223
|
|
|
5030
5224
|
if (reserve) {
|
|
5031
5225
|
tableFullData.forEach(function (row) {
|
|
5032
|
-
return
|
|
5226
|
+
return _this41.handleRowExpandReserve(row, false);
|
|
5033
5227
|
});
|
|
5034
5228
|
}
|
|
5035
5229
|
|
|
5036
5230
|
return this.$nextTick().then(function () {
|
|
5037
5231
|
if (isExists) {
|
|
5038
|
-
|
|
5232
|
+
_this41.recalculate();
|
|
5039
5233
|
}
|
|
5040
5234
|
});
|
|
5041
5235
|
},
|
|
@@ -5109,7 +5303,7 @@ var Methods = {
|
|
|
5109
5303
|
* @param {Row} row 行对象
|
|
5110
5304
|
*/
|
|
5111
5305
|
reloadTreeExpand: function reloadTreeExpand(row) {
|
|
5112
|
-
var
|
|
5306
|
+
var _this42 = this;
|
|
5113
5307
|
|
|
5114
5308
|
var treeOpts = this.treeOpts,
|
|
5115
5309
|
treeLazyLoadeds = this.treeLazyLoadeds;
|
|
@@ -5119,13 +5313,13 @@ var Methods = {
|
|
|
5119
5313
|
|
|
5120
5314
|
if (lazy && row[hasChild] && treeLazyLoadeds.indexOf(row) === -1) {
|
|
5121
5315
|
this.clearTreeExpandLoaded(row).then(function () {
|
|
5122
|
-
return
|
|
5316
|
+
return _this42.handleAsyncTreeExpandChilds(row);
|
|
5123
5317
|
}).then(function () {
|
|
5124
5318
|
if (transform) {
|
|
5125
|
-
return
|
|
5319
|
+
return _this42.handleTableData();
|
|
5126
5320
|
}
|
|
5127
5321
|
}).then(function () {
|
|
5128
|
-
return
|
|
5322
|
+
return _this42.recalculate();
|
|
5129
5323
|
});
|
|
5130
5324
|
}
|
|
5131
5325
|
|
|
@@ -5203,7 +5397,7 @@ var Methods = {
|
|
|
5203
5397
|
}
|
|
5204
5398
|
},
|
|
5205
5399
|
handleAsyncTreeExpandChilds: function handleAsyncTreeExpandChilds(row) {
|
|
5206
|
-
var
|
|
5400
|
+
var _this43 = this;
|
|
5207
5401
|
|
|
5208
5402
|
var fullAllDataRowMap = this.fullAllDataRowMap,
|
|
5209
5403
|
treeExpandeds = this.treeExpandeds,
|
|
@@ -5216,7 +5410,7 @@ var Methods = {
|
|
|
5216
5410
|
return new Promise(function (resolve) {
|
|
5217
5411
|
treeLazyLoadeds.push(row);
|
|
5218
5412
|
loadMethod({
|
|
5219
|
-
$table:
|
|
5413
|
+
$table: _this43,
|
|
5220
5414
|
row: row
|
|
5221
5415
|
}).catch(function () {
|
|
5222
5416
|
return [];
|
|
@@ -5232,19 +5426,19 @@ var Methods = {
|
|
|
5232
5426
|
}
|
|
5233
5427
|
|
|
5234
5428
|
if (childRecords) {
|
|
5235
|
-
|
|
5429
|
+
_this43.loadTreeChildren(row, childRecords).then(function (childRows) {
|
|
5236
5430
|
if (childRows.length && treeExpandeds.indexOf(row) === -1) {
|
|
5237
5431
|
treeExpandeds.push(row);
|
|
5238
5432
|
} // 如果当前节点已选中,则展开后子节点也被选中
|
|
5239
5433
|
|
|
5240
5434
|
|
|
5241
|
-
if (!checkStrictly &&
|
|
5242
|
-
|
|
5435
|
+
if (!checkStrictly && _this43.isCheckedByCheckboxRow(row)) {
|
|
5436
|
+
_this43.setCheckboxRow(childRows, true);
|
|
5243
5437
|
}
|
|
5244
5438
|
});
|
|
5245
5439
|
}
|
|
5246
5440
|
|
|
5247
|
-
resolve(
|
|
5441
|
+
resolve(_this43.$nextTick().then(_this43.recalculate));
|
|
5248
5442
|
});
|
|
5249
5443
|
});
|
|
5250
5444
|
},
|
|
@@ -5278,7 +5472,7 @@ var Methods = {
|
|
|
5278
5472
|
* @returns
|
|
5279
5473
|
*/
|
|
5280
5474
|
handleBaseTreeExpand: function handleBaseTreeExpand(rows, expanded) {
|
|
5281
|
-
var
|
|
5475
|
+
var _this44 = this;
|
|
5282
5476
|
|
|
5283
5477
|
var fullAllDataRowMap = this.fullAllDataRowMap,
|
|
5284
5478
|
tableFullData = this.tableFullData,
|
|
@@ -5326,7 +5520,7 @@ var Methods = {
|
|
|
5326
5520
|
var isLoad = lazy && row[hasChild] && !rest.treeLoaded && treeLazyLoadeds.indexOf(row) === -1; // 是否使用懒加载
|
|
5327
5521
|
|
|
5328
5522
|
if (isLoad) {
|
|
5329
|
-
result.push(
|
|
5523
|
+
result.push(_this44.handleAsyncTreeExpandChilds(row));
|
|
5330
5524
|
} else {
|
|
5331
5525
|
if (row[children] && row[children].length) {
|
|
5332
5526
|
treeExpandeds.push(row);
|
|
@@ -5342,40 +5536,12 @@ var Methods = {
|
|
|
5342
5536
|
|
|
5343
5537
|
if (reserve) {
|
|
5344
5538
|
validRows.forEach(function (row) {
|
|
5345
|
-
return
|
|
5539
|
+
return _this44.handleTreeExpandReserve(row, expanded);
|
|
5346
5540
|
});
|
|
5347
5541
|
}
|
|
5348
5542
|
|
|
5349
5543
|
return Promise.all(result).then(this.recalculate);
|
|
5350
5544
|
},
|
|
5351
|
-
updateVirtualTreeData: function updateVirtualTreeData() {
|
|
5352
|
-
var _this43 = this;
|
|
5353
|
-
|
|
5354
|
-
var oldScrollYLoad = this.scrollYLoad,
|
|
5355
|
-
treeExpandeds = this.treeExpandeds,
|
|
5356
|
-
treeOpts = this.treeOpts,
|
|
5357
|
-
treeFullData = this.treeFullData;
|
|
5358
|
-
var fullData = [];
|
|
5359
|
-
var expandMaps = new Map();
|
|
5360
|
-
|
|
5361
|
-
_xeUtils.default.eachTree(treeFullData, function (row, index, items, path, parent) {
|
|
5362
|
-
if (!parent || expandMaps.has(parent) && treeExpandeds.indexOf(parent) > -1) {
|
|
5363
|
-
expandMaps.set(row, 1);
|
|
5364
|
-
fullData.push(row);
|
|
5365
|
-
}
|
|
5366
|
-
}, treeOpts);
|
|
5367
|
-
|
|
5368
|
-
var scrollYLoad = this.updateScrollYStatus(fullData);
|
|
5369
|
-
this.tableFullData = scrollYLoad ? fullData : treeFullData;
|
|
5370
|
-
|
|
5371
|
-
if (scrollYLoad || oldScrollYLoad !== scrollYLoad) {
|
|
5372
|
-
return this.handleTableData(true).then(function () {
|
|
5373
|
-
return _this43.recalculate();
|
|
5374
|
-
});
|
|
5375
|
-
}
|
|
5376
|
-
|
|
5377
|
-
return this.$nextTick();
|
|
5378
|
-
},
|
|
5379
5545
|
|
|
5380
5546
|
/**
|
|
5381
5547
|
* 虚拟树的展开与收起
|
|
@@ -5384,12 +5550,12 @@ var Methods = {
|
|
|
5384
5550
|
* @returns
|
|
5385
5551
|
*/
|
|
5386
5552
|
handleVirtualTreeExpand: function handleVirtualTreeExpand(rows, expanded) {
|
|
5387
|
-
var
|
|
5553
|
+
var _this45 = this;
|
|
5388
5554
|
|
|
5389
5555
|
return this.handleBaseTreeExpand(rows, expanded).then(function () {
|
|
5390
|
-
return
|
|
5556
|
+
return _this45.handleTableData();
|
|
5391
5557
|
}).then(function () {
|
|
5392
|
-
return
|
|
5558
|
+
return _this45.recalculate();
|
|
5393
5559
|
});
|
|
5394
5560
|
},
|
|
5395
5561
|
|
|
@@ -5434,7 +5600,7 @@ var Methods = {
|
|
|
5434
5600
|
* 手动清空树形节点的展开状态,数据会恢复成未展开的状态
|
|
5435
5601
|
*/
|
|
5436
5602
|
clearTreeExpand: function clearTreeExpand() {
|
|
5437
|
-
var
|
|
5603
|
+
var _this46 = this;
|
|
5438
5604
|
|
|
5439
5605
|
var treeOpts = this.treeOpts,
|
|
5440
5606
|
treeExpandeds = this.treeExpandeds,
|
|
@@ -5445,13 +5611,13 @@ var Methods = {
|
|
|
5445
5611
|
|
|
5446
5612
|
if (reserve) {
|
|
5447
5613
|
_xeUtils.default.eachTree(tableFullData, function (row) {
|
|
5448
|
-
return
|
|
5614
|
+
return _this46.handleTreeExpandReserve(row, false);
|
|
5449
5615
|
}, treeOpts);
|
|
5450
5616
|
}
|
|
5451
5617
|
|
|
5452
|
-
return this.
|
|
5618
|
+
return this.handleTableData().then(function () {
|
|
5453
5619
|
if (isExists) {
|
|
5454
|
-
|
|
5620
|
+
_this46.recalculate();
|
|
5455
5621
|
}
|
|
5456
5622
|
});
|
|
5457
5623
|
},
|
|
@@ -5581,18 +5747,18 @@ var Methods = {
|
|
|
5581
5747
|
},
|
|
5582
5748
|
// 计算可视渲染相关数据
|
|
5583
5749
|
computeScrollLoad: function computeScrollLoad() {
|
|
5584
|
-
var
|
|
5750
|
+
var _this47 = this;
|
|
5585
5751
|
|
|
5586
5752
|
return this.$nextTick().then(function () {
|
|
5587
|
-
var sYOpts =
|
|
5588
|
-
sXOpts =
|
|
5589
|
-
scrollXLoad =
|
|
5590
|
-
scrollYLoad =
|
|
5591
|
-
scrollXStore =
|
|
5592
|
-
scrollYStore =
|
|
5753
|
+
var sYOpts = _this47.sYOpts,
|
|
5754
|
+
sXOpts = _this47.sXOpts,
|
|
5755
|
+
scrollXLoad = _this47.scrollXLoad,
|
|
5756
|
+
scrollYLoad = _this47.scrollYLoad,
|
|
5757
|
+
scrollXStore = _this47.scrollXStore,
|
|
5758
|
+
scrollYStore = _this47.scrollYStore; // 计算 X 逻辑
|
|
5593
5759
|
|
|
5594
5760
|
if (scrollXLoad) {
|
|
5595
|
-
var _computeVirtualX3 = computeVirtualX(
|
|
5761
|
+
var _computeVirtualX3 = computeVirtualX(_this47),
|
|
5596
5762
|
visibleXSize = _computeVirtualX3.visibleSize;
|
|
5597
5763
|
|
|
5598
5764
|
var offsetXSize = sXOpts.oSize ? _xeUtils.default.toNumber(sXOpts.oSize) : _dom.browse.msie ? 10 : _dom.browse.edge ? 5 : 0;
|
|
@@ -5600,13 +5766,13 @@ var Methods = {
|
|
|
5600
5766
|
scrollXStore.visibleSize = visibleXSize;
|
|
5601
5767
|
scrollXStore.endIndex = Math.max(scrollXStore.startIndex + scrollXStore.visibleSize + offsetXSize, scrollXStore.endIndex);
|
|
5602
5768
|
|
|
5603
|
-
|
|
5769
|
+
_this47.updateScrollXData();
|
|
5604
5770
|
} else {
|
|
5605
|
-
|
|
5771
|
+
_this47.updateScrollXSpace();
|
|
5606
5772
|
} // 计算 Y 逻辑
|
|
5607
5773
|
|
|
5608
5774
|
|
|
5609
|
-
var _computeVirtualY = computeVirtualY(
|
|
5775
|
+
var _computeVirtualY = computeVirtualY(_this47),
|
|
5610
5776
|
rowHeight = _computeVirtualY.rowHeight,
|
|
5611
5777
|
visibleYSize = _computeVirtualY.visibleSize;
|
|
5612
5778
|
|
|
@@ -5618,14 +5784,14 @@ var Methods = {
|
|
|
5618
5784
|
scrollYStore.visibleSize = visibleYSize;
|
|
5619
5785
|
scrollYStore.endIndex = Math.max(scrollYStore.startIndex + visibleYSize + offsetYSize, scrollYStore.endIndex);
|
|
5620
5786
|
|
|
5621
|
-
|
|
5787
|
+
_this47.updateScrollYData();
|
|
5622
5788
|
} else {
|
|
5623
|
-
|
|
5789
|
+
_this47.updateScrollYSpace();
|
|
5624
5790
|
}
|
|
5625
5791
|
|
|
5626
|
-
|
|
5792
|
+
_this47.rowHeight = rowHeight;
|
|
5627
5793
|
|
|
5628
|
-
|
|
5794
|
+
_this47.$nextTick(_this47.updateStyle);
|
|
5629
5795
|
});
|
|
5630
5796
|
},
|
|
5631
5797
|
handleTableColumn: function handleTableColumn() {
|
|
@@ -5739,7 +5905,7 @@ var Methods = {
|
|
|
5739
5905
|
* @param {Number} scrollTop 上距离
|
|
5740
5906
|
*/
|
|
5741
5907
|
scrollTo: function scrollTo(scrollLeft, scrollTop) {
|
|
5742
|
-
var
|
|
5908
|
+
var _this48 = this;
|
|
5743
5909
|
|
|
5744
5910
|
var $refs = this.$refs;
|
|
5745
5911
|
var tableBody = $refs.tableBody,
|
|
@@ -5760,7 +5926,7 @@ var Methods = {
|
|
|
5760
5926
|
if (this.scrollXLoad || this.scrollYLoad) {
|
|
5761
5927
|
return new Promise(function (resolve) {
|
|
5762
5928
|
return setTimeout(function () {
|
|
5763
|
-
return resolve(
|
|
5929
|
+
return resolve(_this48.$nextTick());
|
|
5764
5930
|
}, 50);
|
|
5765
5931
|
});
|
|
5766
5932
|
}
|
|
@@ -5811,7 +5977,7 @@ var Methods = {
|
|
|
5811
5977
|
* @param {Row} row 行对象
|
|
5812
5978
|
*/
|
|
5813
5979
|
scrollToTreeRow: function scrollToTreeRow(row) {
|
|
5814
|
-
var
|
|
5980
|
+
var _this49 = this;
|
|
5815
5981
|
|
|
5816
5982
|
var tableFullData = this.tableFullData,
|
|
5817
5983
|
treeConfig = this.treeConfig,
|
|
@@ -5826,15 +5992,15 @@ var Methods = {
|
|
|
5826
5992
|
if (matchObj) {
|
|
5827
5993
|
var nodes = matchObj.nodes;
|
|
5828
5994
|
nodes.forEach(function (row, index) {
|
|
5829
|
-
if (index < nodes.length - 1 && !
|
|
5830
|
-
rests.push(
|
|
5995
|
+
if (index < nodes.length - 1 && !_this49.isTreeExpandByRow(row)) {
|
|
5996
|
+
rests.push(_this49.setTreeExpand(row, true));
|
|
5831
5997
|
}
|
|
5832
5998
|
});
|
|
5833
5999
|
}
|
|
5834
6000
|
}
|
|
5835
6001
|
|
|
5836
6002
|
return Promise.all(rests).then(function () {
|
|
5837
|
-
return _tools.DomTools.rowToVisible(
|
|
6003
|
+
return _tools.DomTools.rowToVisible(_this49, row);
|
|
5838
6004
|
});
|
|
5839
6005
|
},
|
|
5840
6006
|
|
|
@@ -5898,29 +6064,29 @@ var Methods = {
|
|
|
5898
6064
|
* 如果单元格配置了校验规则,则会进行校验
|
|
5899
6065
|
*/
|
|
5900
6066
|
updateStatus: function updateStatus(scope, cellValue) {
|
|
5901
|
-
var
|
|
6067
|
+
var _this50 = this;
|
|
5902
6068
|
|
|
5903
6069
|
var customVal = !_xeUtils.default.isUndefined(cellValue);
|
|
5904
6070
|
return this.$nextTick().then(function () {
|
|
5905
|
-
var $refs =
|
|
5906
|
-
editRules =
|
|
5907
|
-
validStore =
|
|
6071
|
+
var $refs = _this50.$refs,
|
|
6072
|
+
editRules = _this50.editRules,
|
|
6073
|
+
validStore = _this50.validStore;
|
|
5908
6074
|
|
|
5909
6075
|
if (scope && $refs.tableBody && editRules) {
|
|
5910
6076
|
var row = scope.row,
|
|
5911
6077
|
column = scope.column;
|
|
5912
6078
|
var type = 'change';
|
|
5913
6079
|
|
|
5914
|
-
if (
|
|
5915
|
-
var cell =
|
|
6080
|
+
if (_this50.hasCellRules(type, row, column)) {
|
|
6081
|
+
var cell = _this50.getCell(row, column);
|
|
5916
6082
|
|
|
5917
6083
|
if (cell) {
|
|
5918
|
-
return
|
|
6084
|
+
return _this50.validCellRules(type, row, column, cellValue).then(function () {
|
|
5919
6085
|
if (customVal && validStore.visible) {
|
|
5920
6086
|
setCellValue(row, column, cellValue);
|
|
5921
6087
|
}
|
|
5922
6088
|
|
|
5923
|
-
|
|
6089
|
+
_this50.clearValidate();
|
|
5924
6090
|
}).catch(function (_ref7) {
|
|
5925
6091
|
var rule = _ref7.rule;
|
|
5926
6092
|
|
|
@@ -5928,7 +6094,7 @@ var Methods = {
|
|
|
5928
6094
|
setCellValue(row, column, cellValue);
|
|
5929
6095
|
}
|
|
5930
6096
|
|
|
5931
|
-
|
|
6097
|
+
_this50.showValidTooltip({
|
|
5932
6098
|
rule: rule,
|
|
5933
6099
|
row: row,
|
|
5934
6100
|
column: column,
|
|
@@ -5949,7 +6115,7 @@ var Methods = {
|
|
|
5949
6115
|
* @param {TableMergeConfig[]} merges { row: Row|number, column: ColumnInfo|number, rowspan: number, colspan: number }
|
|
5950
6116
|
*/
|
|
5951
6117
|
setMergeCells: function setMergeCells(merges) {
|
|
5952
|
-
var
|
|
6118
|
+
var _this51 = this;
|
|
5953
6119
|
|
|
5954
6120
|
if (this.spanMethod) {
|
|
5955
6121
|
_tools.UtilTools.error('vxe.error.errConflicts', ['merge-cells', 'span-method']);
|
|
@@ -5957,7 +6123,7 @@ var Methods = {
|
|
|
5957
6123
|
|
|
5958
6124
|
setMerges(this, merges, this.mergeList, this.afterFullData);
|
|
5959
6125
|
return this.$nextTick().then(function () {
|
|
5960
|
-
return
|
|
6126
|
+
return _this51.updateCellAreas();
|
|
5961
6127
|
});
|
|
5962
6128
|
},
|
|
5963
6129
|
|
|
@@ -5966,7 +6132,7 @@ var Methods = {
|
|
|
5966
6132
|
* @param {TableMergeConfig[]} merges 多个或数组 [{row:Row|number, col:ColumnInfo|number}]
|
|
5967
6133
|
*/
|
|
5968
6134
|
removeMergeCells: function removeMergeCells(merges) {
|
|
5969
|
-
var
|
|
6135
|
+
var _this52 = this;
|
|
5970
6136
|
|
|
5971
6137
|
if (this.spanMethod) {
|
|
5972
6138
|
_tools.UtilTools.error('vxe.error.errConflicts', ['merge-cells', 'span-method']);
|
|
@@ -5974,7 +6140,7 @@ var Methods = {
|
|
|
5974
6140
|
|
|
5975
6141
|
var rest = removeMerges(this, merges, this.mergeList, this.afterFullData);
|
|
5976
6142
|
return this.$nextTick().then(function () {
|
|
5977
|
-
|
|
6143
|
+
_this52.updateCellAreas();
|
|
5978
6144
|
|
|
5979
6145
|
return rest;
|
|
5980
6146
|
});
|
|
@@ -5998,7 +6164,7 @@ var Methods = {
|
|
|
5998
6164
|
this.setMergeFooterItems(this.mergeFooterItems);
|
|
5999
6165
|
},
|
|
6000
6166
|
setMergeFooterItems: function setMergeFooterItems(merges) {
|
|
6001
|
-
var
|
|
6167
|
+
var _this53 = this;
|
|
6002
6168
|
|
|
6003
6169
|
if (this.footerSpanMethod) {
|
|
6004
6170
|
_tools.UtilTools.error('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method']);
|
|
@@ -6006,11 +6172,11 @@ var Methods = {
|
|
|
6006
6172
|
|
|
6007
6173
|
setMerges(this, merges, this.mergeFooterList, null);
|
|
6008
6174
|
return this.$nextTick().then(function () {
|
|
6009
|
-
return
|
|
6175
|
+
return _this53.updateCellAreas();
|
|
6010
6176
|
});
|
|
6011
6177
|
},
|
|
6012
6178
|
removeMergeFooterItems: function removeMergeFooterItems(merges) {
|
|
6013
|
-
var
|
|
6179
|
+
var _this54 = this;
|
|
6014
6180
|
|
|
6015
6181
|
if (this.footerSpanMethod) {
|
|
6016
6182
|
_tools.UtilTools.error('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method']);
|
|
@@ -6018,7 +6184,7 @@ var Methods = {
|
|
|
6018
6184
|
|
|
6019
6185
|
var rest = removeMerges(this, merges, this.mergeFooterList, null);
|
|
6020
6186
|
return this.$nextTick().then(function () {
|
|
6021
|
-
|
|
6187
|
+
_this54.updateCellAreas();
|
|
6022
6188
|
|
|
6023
6189
|
return rest;
|
|
6024
6190
|
});
|
|
@@ -6158,7 +6324,7 @@ var Methods = {
|
|
|
6158
6324
|
|
|
6159
6325
|
}; // Module methods
|
|
6160
6326
|
|
|
6161
|
-
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(',');
|
|
6327
|
+
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(',');
|
|
6162
6328
|
funcs.forEach(function (name) {
|
|
6163
6329
|
Methods[name] = function () {
|
|
6164
6330
|
if (process.env.NODE_ENV === 'development') {
|