|
@@ -200,6 +200,58 @@ var projectObj = {
|
|
|
return this.checkCommonField(editingText, colSetting);
|
|
|
}
|
|
|
},
|
|
|
+ getVisibleRows: function (sRow, count) {
|
|
|
+ let rst = [];
|
|
|
+ let nodes = projectObj.project.mainTree.items;
|
|
|
+ for(let i = sRow, len = nodes.length; i < len; i++){
|
|
|
+ if(count <= 0){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if(nodes[i].visible){
|
|
|
+ rst.push(i);
|
|
|
+ count--;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return rst;
|
|
|
+ },
|
|
|
+ //获取更改的单元格(复制粘贴时,跳过隐藏行)
|
|
|
+ checkSpreadChangedCells: function (info) {
|
|
|
+ let rst = {refreshRows: [], changedCells: []};
|
|
|
+ //获取显示行号
|
|
|
+ let nodes = projectObj.project.mainTree.items;
|
|
|
+ /*let rCount = info.rowCount;
|
|
|
+ let vRows = [];
|
|
|
+ for(let i = info.row, len = nodes.length; i < len; i++){
|
|
|
+ if(rCount <= 0){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if(nodes[i].visible){
|
|
|
+ vRows.push(i);
|
|
|
+ rCount--;
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+ let vRows = projectObj.getVisibleRows(info.row, info.rowCount);
|
|
|
+ let vCount = vRows.length;
|
|
|
+ let lastRow = null, count = 0;
|
|
|
+ for(let cell of info.changedCells){
|
|
|
+ cell.text = info.sheet.getCell(cell.row, cell.col).text();
|
|
|
+ if(cell.row !== lastRow){
|
|
|
+ count++;
|
|
|
+ lastRow = cell.row;
|
|
|
+ }
|
|
|
+ if(count <= vCount){
|
|
|
+ if(vRows[count - 1] !== cell.row){
|
|
|
+ rst.refreshRows.push(cell.row);
|
|
|
+ }
|
|
|
+ rst.changedCells.push({row: vRows[count - 1], col: cell.col, text: cell.text});
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ rst.refreshRows.push(cell.row);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ rst.refreshRows = Array.from(new Set(rst.refreshRows));
|
|
|
+ return rst;
|
|
|
+ },
|
|
|
updateBillsCode: function (node, value) {
|
|
|
let project = projectObj.project;
|
|
|
let stdMatchCode, formatCode, matchs;
|
|
@@ -401,18 +453,29 @@ var projectObj = {
|
|
|
projectObj.mainSpread.getActiveSheet().autoFitRow(info.row);
|
|
|
}
|
|
|
},
|
|
|
+ msClipboardChanged: function (sender, info) {
|
|
|
+ let cDatas = sheetCommonObj.getTableData(info.sheet);
|
|
|
+ sheetCommonObj.copyTextToClipboard(cDatas);
|
|
|
+ return;
|
|
|
+ },
|
|
|
mainSpreadRangeChanged: function (sender, info) {
|
|
|
let project = projectObj.project, setting = projectObj.mainController.setting;
|
|
|
- if (info.changedCells.length > 0) {
|
|
|
- for (let changedCell of info.changedCells) {
|
|
|
- let cell = info.sheet.getCell(changedCell.row, changedCell.col);
|
|
|
+ let changedObj = projectObj.checkSpreadChangedCells(info);
|
|
|
+ let refreshNodes = [];
|
|
|
+ for(let row of changedObj.refreshRows){
|
|
|
+ refreshNodes.push(project.mainTree.items[row]);
|
|
|
+ }
|
|
|
+ if(changedObj.changedCells.length > 0){
|
|
|
+ for (let changedCell of changedObj.changedCells) {
|
|
|
let node = project.mainTree.items[changedCell.row];
|
|
|
let colSetting = setting.cols[changedCell.col];
|
|
|
- let value = projectObj.checkSpreadEditingText(cell.text(), colSetting);
|
|
|
-
|
|
|
+ let value = projectObj.checkSpreadEditingText(changedCell.text, colSetting);
|
|
|
projectObj.updateCellValue(node, value, colSetting);
|
|
|
}
|
|
|
}
|
|
|
+ if(refreshNodes.length > 0){
|
|
|
+ projectObj.mainController.refreshTreeNode(refreshNodes);
|
|
|
+ }
|
|
|
},
|
|
|
checkMainSpread: function () {
|
|
|
if (!this.mainSpread) {
|
|
@@ -500,7 +563,7 @@ var projectObj = {
|
|
|
that.mainSpread.bind(GC.Spread.Sheets.Events.EditStarting, that.mainSpreadEditStarting);
|
|
|
that.mainSpread.bind(GC.Spread.Sheets.Events.EditEnded, that.mainSpreadEditEnded);
|
|
|
that.mainSpread.bind(GC.Spread.Sheets.Events.RangeChanged, that.mainSpreadRangeChanged);
|
|
|
- that.mainSpread.bind(GC.Spread.Sheets.Events.SelectionChanged, that.amountAreaNumber);
|
|
|
+ that.mainSpread.bind(GC.Spread.Sheets.Events.ClipboardChanged, that.msClipboardChanged);
|
|
|
that.mainSpread.bind(GC.Spread.Sheets.Events.ButtonClicked, that.onButtonClick);
|
|
|
that.loadMainSpreadContextMenu();
|
|
|
that.loadFocusLocation();
|