Commit 2bfeac48 authored by GoshaZotov's avatar GoshaZotov

add rename total row changes into history

parent d504524c
...@@ -143,6 +143,7 @@ function (window, undefined) { ...@@ -143,6 +143,7 @@ function (window, undefined) {
window['AscCH'].historyitem_AutoFilter_ChangeTableName = 14; window['AscCH'].historyitem_AutoFilter_ChangeTableName = 14;
window['AscCH'].historyitem_AutoFilter_ClearFilterColumn = 15; window['AscCH'].historyitem_AutoFilter_ClearFilterColumn = 15;
window['AscCH'].historyitem_AutoFilter_ChangeColumnName = 16; window['AscCH'].historyitem_AutoFilter_ChangeColumnName = 16;
window['AscCH'].historyitem_AutoFilter_ChangeTotalRow = 17;
function CHistory() function CHistory()
......
...@@ -1765,7 +1765,8 @@ var g_oUndoRedoData_AutoFilterProperties = { ...@@ -1765,7 +1765,8 @@ var g_oUndoRedoData_AutoFilterProperties = {
color : 17, color : 17,
tablePart : 18, tablePart : 18,
nCol : 19, nCol : 19,
nRow : 20 nRow : 20,
formula : 21
}; };
function UndoRedoData_AutoFilter() { function UndoRedoData_AutoFilter() {
this.Properties = g_oUndoRedoData_AutoFilterProperties; this.Properties = g_oUndoRedoData_AutoFilterProperties;
...@@ -1795,6 +1796,7 @@ function UndoRedoData_AutoFilter() { ...@@ -1795,6 +1796,7 @@ function UndoRedoData_AutoFilter() {
this.tablePart = null; this.tablePart = null;
this.nCol = null; this.nCol = null;
this.nRow = null; this.nRow = null;
this.formula = null;
} }
UndoRedoData_AutoFilter.prototype = { UndoRedoData_AutoFilter.prototype = {
getType : function () getType : function ()
...@@ -1842,6 +1844,7 @@ UndoRedoData_AutoFilter.prototype = { ...@@ -1842,6 +1844,7 @@ UndoRedoData_AutoFilter.prototype = {
} }
case this.Properties.nCol: return this.nCol; break; case this.Properties.nCol: return this.nCol; break;
case this.Properties.nRow: return this.nRow; break; case this.Properties.nRow: return this.nRow; break;
case this.Properties.formula: return this.formula; break;
} }
return null; return null;
...@@ -1905,6 +1908,7 @@ UndoRedoData_AutoFilter.prototype = { ...@@ -1905,6 +1908,7 @@ UndoRedoData_AutoFilter.prototype = {
} }
case this.Properties.nCol: this.nCol = value;break; case this.Properties.nCol: this.nCol = value;break;
case this.Properties.nRow: this.nRow = value;break; case this.Properties.nRow: this.nRow = value;break;
case this.Properties.formula: this.formula = value;break;
} }
return null; return null;
}, },
...@@ -3884,7 +3888,7 @@ UndoRedoAutoFilters.prototype = { ...@@ -3884,7 +3888,7 @@ UndoRedoAutoFilters.prototype = {
} }
else else
{ {
if(AscCH.historyitem_AutoFilter_ChangeColumnName === Type) if(AscCH.historyitem_AutoFilter_ChangeColumnName === Type || AscCH.historyitem_AutoFilter_ChangeTotalRow === Type)
{ {
if(false != this.wb.bCollaborativeChanges) if(false != this.wb.bCollaborativeChanges)
{ {
......
...@@ -899,6 +899,9 @@ ...@@ -899,6 +899,9 @@
case AscCH.historyitem_AutoFilter_ChangeColumnName: case AscCH.historyitem_AutoFilter_ChangeColumnName:
this.renameTableColumn(null, null, data); this.renameTableColumn(null, null, data);
break; break;
case AscCH.historyitem_AutoFilter_ChangeTotalRow:
this.renameTableColumn(null, null, data);
break;
} }
History.TurnOn(); History.TurnOn();
}, },
...@@ -926,7 +929,7 @@ ...@@ -926,7 +929,7 @@
delete cloneData.insCells; delete cloneData.insCells;
//TODO переделать undo, по типам //TODO переделать undo, по типам
if(type === AscCH.historyitem_AutoFilter_ChangeColumnName)//перемещение if(type === AscCH.historyitem_AutoFilter_ChangeColumnName || type === AscCH.historyitem_AutoFilter_ChangeTotalRow)//перемещение
{ {
this.renameTableColumn(null, null, undoData); this.renameTableColumn(null, null, undoData);
} }
...@@ -2838,6 +2841,7 @@ ...@@ -2838,6 +2841,7 @@
oHistoryObject.tablePart = redoObject.tablePart; oHistoryObject.tablePart = redoObject.tablePart;
oHistoryObject.nCol = redoObject.nCol; oHistoryObject.nCol = redoObject.nCol;
oHistoryObject.nRow = redoObject.nRow; oHistoryObject.nRow = redoObject.nRow;
oHistoryObject.formula = redoObject.formula;
} }
else else
{ {
...@@ -2955,13 +2959,13 @@ ...@@ -2955,13 +2959,13 @@
} }
else else
{ {
this._changeTotalsRowData(filter, range); this._changeTotalsRowData(filter, range, props);
} }
} }
} }
}, },
_changeTotalsRowData: function(tablePart, range) _changeTotalsRowData: function(tablePart, range, props)
{ {
if(!tablePart || !range || !tablePart.TotalsRowCount) if(!tablePart || !range || !tablePart.TotalsRowCount)
{ {
...@@ -2981,16 +2985,44 @@ ...@@ -2981,16 +2985,44 @@
var cell = worksheet.getCell3(tableRange.r2, j); var cell = worksheet.getCell3(tableRange.r2, j);
var tableColumn = tablePart.TableColumns[j - tableRange.c1]; var tableColumn = tablePart.TableColumns[j - tableRange.c1];
if(cell.isFormula()) var formula = null;
var label = null;
if(props)
{
if(props.formula)
{
formula = props.formula;
}
else
{
label = props.val;
}
}
else
{
if(cell.isFormula())
{
formula = cell.getFormula();
}
else
{
label = cell.getValue();
}
}
var oldLabel = tableColumn.TotalsRowLabel;
var oldFormula = tableColumn.TotalsRowFormula ? tableColumn.TotalsRowFormula.Formula : null;
if(null !== formula)
{ {
var val = cell.getFormula(); tableColumn.setTotalsRowFormula(formula, worksheet);
tableColumn.setTotalsRowFormula(val, worksheet);
} }
else else
{ {
var val = cell.getValue(); tableColumn.setTotalsRowLabel(label);
tableColumn.setTotalsRowLabel(val);
} }
this._addHistoryObj({nCol: cell.bbox.c1, nRow: cell.bbox.r1, formula: oldFormula, val: oldLabel}, AscCH.historyitem_AutoFilter_ChangeTotalRow, {activeCells: range, nCol: cell.bbox.c1, nRow: cell.bbox.r1, formula: formula, val: label});
} }
} }
}, },
......
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