Commit c7c3854b authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

для Bug 24727 - [XLSX] Таблица открывается с ошибкой в консоли eCell is not defined

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56640 954022d7-b5bf-4e40-9824-e11837661b57
parent 7cb94c02
...@@ -967,12 +967,13 @@ var gUndoInsDelCellsFlag = true; ...@@ -967,12 +967,13 @@ var gUndoInsDelCellsFlag = true;
var startCol = allFil.c1; var startCol = allFil.c1;
var endCol = allFil.c2; var endCol = allFil.c2;
var endRow = allFil.r2;
//проверяем диапазон //проверяем диапазон
if(ws.cols.length < eCell.first.col) if (ws.cols.length < endCol)
ws.expandColsOnScroll(false,true,eCell.first.col); ws.expandColsOnScroll(false, true, endCol);
if(ws.rows.length < eCell.first.row) if (ws.rows.length < endRow)
ws.expandColsOnScroll(false,true,eCell.first.row); ws.expandRowsOnScroll(false, true, endRow);
for(var col = startCol; col <= endCol; col++) for(var col = startCol; col <= endCol; col++)
{ {
var idCell = new CellAddress(allFil.r1, col, 0); var idCell = new CellAddress(allFil.r1, col, 0);
...@@ -4940,7 +4941,7 @@ var gUndoInsDelCellsFlag = true; ...@@ -4940,7 +4941,7 @@ var gUndoInsDelCellsFlag = true;
//change current filter after insert column //change current filter after insert column
_editFilterAfterInsertColumn: function(cRange,val,col,type,activeCells) _editFilterAfterInsertColumn: function(cRange,val,col,type,activeCells)
{ {
console.time("test"); console.time("test");
var bUndoChanges = this.worksheet.model.workbook.bUndoChanges; var bUndoChanges = this.worksheet.model.workbook.bUndoChanges;
var bRedoChanges = this.worksheet.model.workbook.bRedoChanges; var bRedoChanges = this.worksheet.model.workbook.bRedoChanges;
var ws = this.worksheet; var ws = this.worksheet;
...@@ -4958,7 +4959,7 @@ var gUndoInsDelCellsFlag = true; ...@@ -4958,7 +4959,7 @@ var gUndoInsDelCellsFlag = true;
filter = aWs.TableParts[cRange.index].clone(aWs); filter = aWs.TableParts[cRange.index].clone(aWs);
if(filter.AutoFilter) if(filter.AutoFilter)
filterColums = filter.AutoFilter.FilterColumns; filterColums = filter.AutoFilter.FilterColumns;
}; };
var oldFilter = filter.clone(aWs); var oldFilter = filter.clone(aWs);
...@@ -5095,10 +5096,10 @@ var gUndoInsDelCellsFlag = true; ...@@ -5095,10 +5096,10 @@ var gUndoInsDelCellsFlag = true;
else else
cRange.end.c1 = cRange.end.c1 + val; cRange.end.c1 = cRange.end.c1 + val;
//filter.Ref = this._rangeToId(cRange.start) + ":" + this._rangeToId(cRange.end); //filter.Ref = this._rangeToId(cRange.start) + ":" + this._rangeToId(cRange.end);
//change result into filter and change info in button //change result into filter and change info in button
filter = this._changeInfoFilterAfterInsertCols(filter, type, col, cRange, val, filterColums, activeCells); filter = this._changeInfoFilterAfterInsertCols(filter, type, col, cRange, val, filterColums, activeCells);
//записываем в историю, если активная область касается данных фильтров //записываем в историю, если активная область касается данных фильтров
if(!bUndoChanges && !bRedoChanges && val < 0) if(!bUndoChanges && !bRedoChanges && val < 0)
...@@ -5113,275 +5114,275 @@ var gUndoInsDelCellsFlag = true; ...@@ -5113,275 +5114,275 @@ var gUndoInsDelCellsFlag = true;
this._addHistoryObj(changeElement, null, null, true); this._addHistoryObj(changeElement, null, null, true);
History.EndTransaction(); History.EndTransaction();
} }
}; };
if(cRange.index == 'all') if(cRange.index == 'all')
{ {
aWs.AutoFilter = filter; aWs.AutoFilter = filter;
} }
else else
{ {
aWs.TableParts[cRange.index] = filter; aWs.TableParts[cRange.index] = filter;
}; };
console.timeEnd("test"); console.timeEnd("test");
}, },
_changeInfoFilterAfterInsertCols: function(filter, type, col, cRange, val, filterColums, activeCells) _changeInfoFilterAfterInsertCols: function(filter, type, col, cRange, val, filterColums, activeCells)
{ {
var ws = this.worksheet; var ws = this.worksheet;
var inFilter = Asc.Range(cRange.start.c1, cRange.start.r1, cRange.end.c1, cRange.end.r1); var inFilter = Asc.Range(cRange.start.c1, cRange.start.r1, cRange.end.c1, cRange.end.r1);
var cloneFilterColums = []; var cloneFilterColums = [];
if(filterColums) if(filterColums)
{ {
for(var k = 0; k < filterColums.length; k++) for(var k = 0; k < filterColums.length; k++)
{ {
cloneFilterColums[k] = filterColums[k].clone(); cloneFilterColums[k] = filterColums[k].clone();
} }
}; };
if(filter.result && filter.result.length > 0) if(filter.result && filter.result.length > 0)
{ {
//change array //change array
var changeNum = []; var changeNum = [];
var newResult = []; var newResult = [];
var n = 0; var n = 0;
var isChangeColumn = false; var isChangeColumn = false;
var insertIndexes = []; var insertIndexes = [];
for(var filR = 0; filR < filter.result.length; filR++) for(var filR = 0; filR < filter.result.length; filR++)
{ {
var endCount = 0; var endCount = 0;
var curFilter = filter.result[filR]; var curFilter = filter.result[filR];
var newFirstCol = this._idToRange(curFilter.id); var newFirstCol = this._idToRange(curFilter.id);
var newFirstColCell = newFirstCol.c1; var newFirstColCell = newFirstCol.c1;
if(type == 'insRow') if(type == 'insRow')
newFirstColCell = newFirstCol.r1; newFirstColCell = newFirstCol.r1;
//добавляем колонку(колонки), вставляем новый фильтр //добавляем колонку(колонки), вставляем новый фильтр
if(newFirstColCell == col) if(newFirstColCell == col)
{ {
for(var insCol = 1; insCol <= val; insCol++) for(var insCol = 1; insCol <= val; insCol++)
{ {
var localChangeCol = this._idToRange(curFilter.id); var localChangeCol = this._idToRange(curFilter.id);
var localNextCol = this._idToRange(curFilter.idNext); var localNextCol = this._idToRange(curFilter.idNext);
if(type == 'insRow') if(type == 'insRow')
{ {
localChangeCol.r1 = localChangeCol.r1 + insCol - 1; localChangeCol.r1 = localChangeCol.r1 + insCol - 1;
localNextCol.r1 = localNextCol.r1 + insCol - 1; localNextCol.r1 = localNextCol.r1 + insCol - 1;
} }
else else
{ {
localChangeCol.c1 = localChangeCol.c1 + insCol - 1; localChangeCol.c1 = localChangeCol.c1 + insCol - 1;
localNextCol.c1 = localNextCol.c1 + insCol - 1; localNextCol.c1 = localNextCol.c1 + insCol - 1;
} }
var id = this._rangeToId(localChangeCol); var id = this._rangeToId(localChangeCol);
var nextId = this._rangeToId(localNextCol); var nextId = this._rangeToId(localNextCol);
newResult[n] = new Result(); newResult[n] = new Result();
newResult[n].x =curFilter.x; newResult[n].x =curFilter.x;
newResult[n].y = curFilter.y; newResult[n].y = curFilter.y;
newResult[n].width = curFilter.width; newResult[n].width = curFilter.width;
newResult[n].height = curFilter.height; newResult[n].height = curFilter.height;
newResult[n].id = id; newResult[n].id = id;
newResult[n].idNext = nextId; newResult[n].idNext = nextId;
newResult[n].hiddenRows = []; newResult[n].hiddenRows = [];
var num = 1; var num = 1;
this._changeContentButton(newResult[n],num,'add',inFilter); this._changeContentButton(newResult[n],num,'add',inFilter);
//changeNum[insCol - 1] = n; //changeNum[insCol - 1] = n;
n++; n++;
} }
if(val < 0)//удаляем кнопки в случае удаления ячеек if(val < 0)//удаляем кнопки в случае удаления ячеек
{ {
this._changeContentButton(curFilter,Math.abs(val),'del',inFilter); this._changeContentButton(curFilter,Math.abs(val),'del',inFilter);
//убираем примененный фильтр //убираем примененный фильтр
if(filterColums) if(filterColums)
{ {
for(var zF = filR; zF < filR + Math.abs(val); zF++) for(var zF = filR; zF < filR + Math.abs(val); zF++)
{ {
for(var s = 0; s < cloneFilterColums.length; s++) for(var s = 0; s < cloneFilterColums.length; s++)
{ {
if(zF == cloneFilterColums[s].ColId) if(zF == cloneFilterColums[s].ColId)
cloneFilterColums.splice(s,1); cloneFilterColums.splice(s,1);
} }
} }
} }
filR = filR + Math.abs(val) - 1; filR = filR + Math.abs(val) - 1;
} }
else else
{ {
var newNextCol = this._idToRange(curFilter.idNext); var newNextCol = this._idToRange(curFilter.idNext);
if(type == 'insRow') if(type == 'insRow')
{ {
newFirstCol.r1 = newFirstCol.r1 + val; newFirstCol.r1 = newFirstCol.r1 + val;
newNextCol.r1 = newNextCol.r1 + val; newNextCol.r1 = newNextCol.r1 + val;
} }
else else
{ {
newFirstCol.c1 = newFirstCol.c1 + val; newFirstCol.c1 = newFirstCol.c1 + val;
newNextCol.c1 = newNextCol.c1 + val; newNextCol.c1 = newNextCol.c1 + val;
} }
var id = this._rangeToId(newFirstCol); var id = this._rangeToId(newFirstCol);
var nextId = this._rangeToId(newNextCol); var nextId = this._rangeToId(newNextCol);
curFilter.inFilter = inFilter; curFilter.inFilter = inFilter;
curFilter.id = id; curFilter.id = id;
curFilter.idNext = nextId; curFilter.idNext = nextId;
newResult[n] = curFilter; newResult[n] = curFilter;
//смещаем примененный фильтр(у filter.FilterColumns просматриваем colId) //смещаем примененный фильтр(у filter.FilterColumns просматриваем colId)
if(filterColums) if(filterColums)
{ {
for(var s = 0; s < filterColums.length; s++) for(var s = 0; s < filterColums.length; s++)
{ {
if(filterColums[s].ColId == filR && filR > endCount) if(filterColums[s].ColId == filR && filR > endCount)
{ {
cloneFilterColums[s].ColId = filR + val; cloneFilterColums[s].ColId = filR + val;
endCount = filR + val; endCount = filR + val;
break; break;
} }
} }
} }
n++; n++;
} }
} }
else if(newFirstColCell < col) else if(newFirstColCell < col)
{ {
if(type == 'insRow') if(type == 'insRow')
{ {
var newNextCol = this._idToRange(curFilter.idNext); var newNextCol = this._idToRange(curFilter.idNext);
newNextCol.r1 = newNextCol.r1 + val; newNextCol.r1 = newNextCol.r1 + val;
var nextId = this._rangeToId(newNextCol); var nextId = this._rangeToId(newNextCol);
curFilter.idNext = nextId; curFilter.idNext = nextId;
} }
curFilter.inFilter = inFilter; curFilter.inFilter = inFilter;
newResult[n] = curFilter; newResult[n] = curFilter;
n++; n++;
} }
else else
{ {
var newNextCol = this._idToRange(curFilter.idNext); var newNextCol = this._idToRange(curFilter.idNext);
if(type == 'insRow') if(type == 'insRow')
{ {
newFirstCol.r1 = newFirstCol.r1 + val; newFirstCol.r1 = newFirstCol.r1 + val;
newNextCol.r1 = newNextCol.r1 + val; newNextCol.r1 = newNextCol.r1 + val;
} }
else else
{ {
newFirstCol.c1 = newFirstCol.c1 + val; newFirstCol.c1 = newFirstCol.c1 + val;
newNextCol.c1 = newNextCol.c1 + val; newNextCol.c1 = newNextCol.c1 + val;
} }
var id = this._rangeToId(newFirstCol); var id = this._rangeToId(newFirstCol);
var nextId = this._rangeToId(newNextCol); var nextId = this._rangeToId(newNextCol);
var oldId = curFilter.id; var oldId = curFilter.id;
curFilter.inFilter = inFilter; curFilter.inFilter = inFilter;
curFilter.id = id; curFilter.id = id;
curFilter.idNext = nextId; curFilter.idNext = nextId;
newResult[n] = curFilter; newResult[n] = curFilter;
if(type == 'insCol') if(type == 'insCol')
this._changeContentButton(newResult[n], null,'change', null, oldId); this._changeContentButton(newResult[n], null,'change', null, oldId);
//смещаем примененный фильтр(у filter.FilterColumns просматриваем colId) //смещаем примененный фильтр(у filter.FilterColumns просматриваем colId)
if(filterColums) if(filterColums)
{ {
for(var s = 0; s < filterColums.length; s++) for(var s = 0; s < filterColums.length; s++)
{ {
if(filterColums[s].ColId == filR && filR > endCount) if(filterColums[s].ColId == filR && filR > endCount)
{ {
cloneFilterColums[s].ColId = filR + val; cloneFilterColums[s].ColId = filR + val;
endCount = filR + val; endCount = filR + val;
break; break;
} }
} }
} }
n++; n++;
} }
}; };
if(type == 'insCol') if(type == 'insCol')
{ {
for(var n = 0; n < newResult.length; n++) for(var n = 0; n < newResult.length; n++)
{ {
this._changeContentButton(newResult[n], 1, 'add', inFilter); this._changeContentButton(newResult[n], 1, 'add', inFilter);
} }
}; };
if(cloneFilterColums) if(cloneFilterColums)
{ {
if(cRange.index == 'all') if(cRange.index == 'all')
{ {
filter.FilterColumns = cloneFilterColums; filter.FilterColumns = cloneFilterColums;
filter.Ref = inFilter; filter.Ref = inFilter;
} }
else else
{ {
if(filter.AutoFilter) if(filter.AutoFilter)
filter.AutoFilter.FilterColumns = cloneFilterColums; filter.AutoFilter.FilterColumns = cloneFilterColums;
filter.AutoFilter.Ref = inFilter; filter.AutoFilter.Ref = inFilter;
} }
}; };
//change tableColumn //change tableColumn
if(filter.TableColumns && type != 'insRow') if(filter.TableColumns && type != 'insRow')
{ {
var newTableColumn = []; var newTableColumn = [];
var startCell = col - inFilter.c1; var startCell = col - inFilter.c1;
var isN = 0; var isN = 0;
if(newResult.length < filter.TableColumns.length) if(newResult.length < filter.TableColumns.length)
{ {
filter.TableColumns.splice(startCell,filter.TableColumns.length - newResult.length) filter.TableColumns.splice(startCell,filter.TableColumns.length - newResult.length)
} }
else else
{ {
for(var l = 0; l < newResult.length; l++) for(var l = 0; l < newResult.length; l++)
{ {
if(startCell == l) if(startCell == l)
{ {
for(var s = 0; s < val; s++) for(var s = 0; s < val; s++)
{ {
var range2 = this._idToRange(newResult[0].id); var range2 = this._idToRange(newResult[0].id);
if(s != 0) if(s != 0)
l = l + 1; l = l + 1;
var tempArray = newTableColumn.concat(filter.TableColumns); var tempArray = newTableColumn.concat(filter.TableColumns);
var newNameColumn = this._generateColumnName(tempArray, startCell - 1); var newNameColumn = this._generateColumnName(tempArray, startCell - 1);
newTableColumn[l] = new TableColumn(); newTableColumn[l] = new TableColumn();
newTableColumn[l].Name = newNameColumn; newTableColumn[l].Name = newNameColumn;
ws.model.getCell(new CellAddress(range2.r1,range2.c1 + l,0)).setValue(newNameColumn); ws.model.getCell(new CellAddress(range2.r1,range2.c1 + l,0)).setValue(newNameColumn);
} }
} }
else else
{ {
var columnValue = filter.TableColumns[isN].Name; var columnValue = filter.TableColumns[isN].Name;
newTableColumn[l] = new TableColumn(); newTableColumn[l] = new TableColumn();
newTableColumn[l].Name = columnValue; newTableColumn[l].Name = columnValue;
isN++; isN++;
} }
} }
filter.TableColumns = newTableColumn; filter.TableColumns = newTableColumn;
} }
}; };
filter.result = newResult; filter.result = newResult;
filter.Ref = inFilter; filter.Ref = inFilter;
if(val > 0) if(val > 0)
this._addButtonAF(newResult); this._addButtonAF(newResult);
return filter; return filter;
}; };
}, },
_changeContentButton: function(array, val, type, inFilter, oldId) _changeContentButton: function(array, val, type, inFilter, oldId)
{ {
...@@ -5446,21 +5447,21 @@ var gUndoInsDelCellsFlag = true; ...@@ -5446,21 +5447,21 @@ var gUndoInsDelCellsFlag = true;
} }
} }
} }
} }
else if(type == 'change') else if(type == 'change')
{ {
var isChange = false; var isChange = false;
for(var j = 0; j < buttons.length; j++) for(var j = 0; j < buttons.length; j++)
{ {
if(oldId == buttons[j].id) if(oldId == buttons[j].id)
{ {
buttons[j] = array; buttons[j] = array;
isChange = true; isChange = true;
}; };
if(!isChange) if(!isChange)
buttons[buttons.length] = array; buttons[buttons.length] = array;
} }
}; };
}, },
...@@ -6442,9 +6443,9 @@ var gUndoInsDelCellsFlag = true; ...@@ -6442,9 +6443,9 @@ var gUndoInsDelCellsFlag = true;
} }
if(!data) if(!data)
this._addHistoryObj(oCurFilter, historyitem_AutoFilter_Move, {worksheet: ws, arnTo: arnTo, arnFrom: arnFrom, activeCells: ws.activeRange}) this._addHistoryObj(oCurFilter, historyitem_AutoFilter_Move, {worksheet: ws, arnTo: arnTo, arnFrom: arnFrom, activeCells: ws.activeRange})
} }
this._cleanStyleTable(aWs, arnFrom); this._cleanStyleTable(aWs, arnFrom);
this._reDrawFilters(null, true); this._reDrawFilters(null, true);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment