Skip to content

Commit

Permalink
Merge branch 'feature/pivot-header-details' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	cell/model/PivotTables.js
  • Loading branch information
konovalovsergey committed Aug 25, 2023
2 parents a77c835 + 988b6fd commit a853421
Show file tree
Hide file tree
Showing 4 changed files with 302 additions and 23 deletions.
2 changes: 1 addition & 1 deletion build/build-develop.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CD /D %~dp0
call npm install -g grunt-cli
call npm install
call npm ci

REM call grunt --level=ADVANCED --addon=sdkjs-forms --addon=sdkjs-ooxml --desktop=true
REM call grunt --level=ADVANCED --addon=sdkjs-forms --addon=sdkjs-ooxml
Expand Down
34 changes: 26 additions & 8 deletions cell/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -6971,15 +6971,15 @@ var editor;
}
});
};
spreadsheet_api.prototype._updatePivotTable = function(pivot, changed, wsModel, ws, dataRow, needUpdateView, canModifyDocument) {
spreadsheet_api.prototype._updatePivotTable = function(pivot, changed, wsModel, ws, dataRow, needUpdateView, canModifyDocument, doNotAutoFitColumnsWidth) {
var ranges = wsModel.updatePivotTable(pivot, changed, dataRow, canModifyDocument);
if (needUpdateView) {
if (changed.oldRanges) {
ws.updateRanges(changed.oldRanges);
}
if (ranges) {
ws.updateRanges(ranges);
if (pivot.useAutoFormatting) {
if (pivot.useAutoFormatting && !doNotAutoFitColumnsWidth) {
ws._autoFitColumnsWidth(ranges);
}
}
Expand Down Expand Up @@ -7119,6 +7119,23 @@ var editor;
});
return true;
};
/**
* @param {number} fld pivotFields index
* @param {boolean} isAll expand/collapse all
*/
spreadsheet_api.prototype.asc_pivotShowDetailsHeader = function(fld, isAll) {
if (this.collaborativeEditing.getGlobalLock() || !this.canEdit()) {
return false;
}
let t = this;
let ws = this.wbModel.getActiveWs();
let activeCell = ws.selectionRange.activeCell;
let pivotTable = ws.getPivotTable(activeCell.col, activeCell.row);
if (!pivotTable) {
return false;
}
pivotTable.showDetailsHeaderByCell(this, activeCell.row, activeCell.col, fld, isAll);
};

spreadsheet_api.prototype.asc_getAddPivotTableOptions = function(range) {
var ws = this.wb.getWorksheet();
Expand Down Expand Up @@ -7274,10 +7291,10 @@ var editor;
});
this.collaborativeEditing.lock(lockInfos, callback);
};
spreadsheet_api.prototype._changePivotWithLock = function (pivot, onAction, doNotCheckUnderlyingData) {
this._changePivotWithLockExt(pivot, false, true, onAction, doNotCheckUnderlyingData);
spreadsheet_api.prototype._changePivotWithLock = function (pivot, onAction, doNotCheckUnderlyingData, doNotAutoFitColumnsWidth) {
this._changePivotWithLockExt(pivot, false, true, onAction, doNotCheckUnderlyingData, doNotAutoFitColumnsWidth);
};
spreadsheet_api.prototype._changePivotWithLockExt = function (pivot, confirmation, updateSelection, onAction, doNotCheckUnderlyingData) {
spreadsheet_api.prototype._changePivotWithLockExt = function (pivot, confirmation, updateSelection, onAction, doNotCheckUnderlyingData, doNotAutoFitColumnsWidth) {
// Проверка глобального лока
if (this.collaborativeEditing.getGlobalLock() || !this.canEdit()) {
return;
Expand All @@ -7291,7 +7308,7 @@ var editor;
History.Create_NewPoint();
History.StartTransaction();
t.wbModel.dependencyFormulas.lockRecal();
var changeRes = t._changePivot(pivot, confirmation, updateSelection, onAction, doNotCheckUnderlyingData);
var changeRes = t._changePivot(pivot, confirmation, updateSelection, onAction, doNotCheckUnderlyingData, doNotAutoFitColumnsWidth);
t.wbModel.dependencyFormulas.unlockRecal();
History.EndTransaction();
t._changePivotEndCheckError(changeRes, function () {
Expand Down Expand Up @@ -7332,7 +7349,7 @@ var editor;
t._changePivotEndCheckError(changeRes, onRepeat);
});
};
spreadsheet_api.prototype._changePivot = function(pivot, confirmation, updateSelection, onAction, doNotCheckUnderlyingData) {
spreadsheet_api.prototype._changePivot = function(pivot, confirmation, updateSelection, onAction, doNotCheckUnderlyingData, doNotAutoFitColumnsWidth) {
if (!doNotCheckUnderlyingData && !pivot.checkPivotUnderlyingData()) {
return {error: c_oAscError.ID.PivotWithoutUnderlyingData, warning: c_oAscError.ID.No, updateRes: undefined};
}
Expand Down Expand Up @@ -7360,7 +7377,7 @@ var editor;
var isSuccess = c_oAscError.ID.No === error && c_oAscError.ID.No === warning;
if (isSuccess) {
var ws = this.wb.getWorksheet(wsModel.getIndex());
this._updatePivotTable(pivot, pivotChanged, wsModel, ws, updateRes && updateRes.dataRow, true, true);
this._updatePivotTable(pivot, pivotChanged, wsModel, ws, updateRes && updateRes.dataRow, true, true, doNotAutoFitColumnsWidth);
if (updateSelection) {
pivot.updateSelection(ws);
}
Expand Down Expand Up @@ -9342,6 +9359,7 @@ var editor;
prot["asc_getPivotInfo"] = prot.asc_getPivotInfo;
prot["asc_getPivotShowValueAsInfo"] = prot.asc_getPivotShowValueAsInfo;
prot["asc_pivotShowDetails"] = prot.asc_pivotShowDetails;
prot["asc_pivotShowDetailsHeader"] = prot.asc_pivotShowDetailsHeader;
// signatures
prot["asc_addSignatureLine"] = prot.asc_addSignatureLine;
prot["asc_CallSignatureDblClickEvent"] = prot.asc_CallSignatureDblClickEvent;
Expand Down
Loading

0 comments on commit a853421

Please sign in to comment.