Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/hotfix/v8.2.2' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillovIlya committed Nov 26, 2024
2 parents 23acfa6 + c60a956 commit 25ff4a2
Show file tree
Hide file tree
Showing 59 changed files with 1,968 additions and 309 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ package-lock.json
*/node_modules
*/package-lock.json
connector
tests/package*
9 changes: 6 additions & 3 deletions cell/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3242,7 +3242,7 @@ var editor;
}
}

if (this.isMobileVersion) {
if (this.isUseOldMobileVersion()) {
this.wb.defaults.worksheetView.halfSelection = true;
this.wb.defaults.worksheetView.activeCellBorderColor = new CColor(79, 158, 79);
var _container = document.getElementById(this.HtmlElementName);
Expand All @@ -3258,11 +3258,14 @@ var editor;

if ((typeof AscCommonExcel.CMobileTouchManager) !== "undefined")
{
this.wb.MobileTouchManager = new AscCommonExcel.CMobileTouchManager({eventsElement: "cell_mobile_element", desktopMode : !this.isMobileVersion});
this.wb.MobileTouchManager = new AscCommonExcel.CMobileTouchManager({eventsElement: "cell_mobile_element", desktopMode : !this.isUseOldMobileVersion()});
this.wb.MobileTouchManager.Init(this);

if (this.isMobileVersion)
if (this.isUseOldMobileVersion())
this.wb.MobileTouchManager.initEvents(AscCommon.g_inputContext.HtmlArea.id);

if (this.controller)
this.wb.MobileTouchManager.addClickElement([this.controller.element]);
}

this.asc_CheckGuiControlColors();
Expand Down
52 changes: 51 additions & 1 deletion cell/model/FormulaObjects/parserFormula.js
Original file line number Diff line number Diff line change
Expand Up @@ -9987,8 +9987,12 @@ function parserFormula( formula, parent, _ws ) {
*/
function CalcRecursion() {
this.nLevel = 0;
this.nIterStep = 1;
this.bIsForceBacktracking = false;
this.bIsProcessRecursion = false;
this.aElems = [];
this.aElemsPart = [];

this.nIterStep = 1;
this.oStartCellIndex = null;
this.nRecursionCounter = 0;
this.oGroupChangedCells = null;
Expand Down Expand Up @@ -10022,6 +10026,10 @@ function parserFormula( formula, parent, _ws ) {
* @param {boolean} bIsForceBacktracking
*/
CalcRecursion.prototype.setIsForceBacktracking = function (bIsForceBacktracking) {
if (!this.getIsForceBacktracking()) {
this.aElemsPart = [];
this.aElems.push(this.aElemsPart);
}
this.bIsForceBacktracking = bIsForceBacktracking;
};
/**
Expand All @@ -10033,6 +10041,22 @@ function parserFormula( formula, parent, _ws ) {
CalcRecursion.prototype.getIsForceBacktracking = function () {
return this.bIsForceBacktracking;
};
/**
* Method sets a flag who recognizes work with aElems in _checkDirty method is already in process.
* @memberof CalcRecursion
* @param {boolean} bIsProcessRecursion
*/
CalcRecursion.prototype.setIsProcessRecursion = function (bIsProcessRecursion) {
this.bIsProcessRecursion = bIsProcessRecursion;
};
/**
* Method returns a flag who recognizes work with aElems in _checkDirty method is already in process.
* @memberof CalcRecursion
* @returns {boolean}
*/
CalcRecursion.prototype.getIsProcessRecursion = function () {
return this.bIsProcessRecursion;
}
/**
* Method increases recursion level. Uses for tracking a level of recursion in _checkDirty method.
* @memberof CalcRecursion
Expand Down Expand Up @@ -10074,6 +10098,32 @@ function parserFormula( formula, parent, _ws ) {

return res;
};
/**
* Method inserts cells which need to be processed in _checkDirty method again.
* Uses for formula chains that reached max recursion level.
* @memberof CalcRecursion
* @param {{ws:Worksheet, nRow:number, nCol:number}} oCellCoordinate
*/
CalcRecursion.prototype.insert = function (oCellCoordinate) {
this.aElemsPart.push(oCellCoordinate);
};
/**
* Method executes callback for each cell from aElems in reverse order.
* aElems stores cell coordinates which need to be processed in _checkDirty method again.
* @memberof CalcRecursion
* @param {Function} fCallback
*/
CalcRecursion.prototype.foreachInReverse = function (fCallback) {
for (let i = this.aElems.length - 1; i >= 0; i--) {
let aElemsPart = this.aElems[i];
for (let j = 0, length = aElemsPart.length; j < length; j++) {
fCallback(aElemsPart[j]);
if (this.getIsForceBacktracking()) {
return;
}
}
}
};
/**
* Method increases iteration step.
* @memberof CalcRecursion
Expand Down
29 changes: 24 additions & 5 deletions cell/model/Workbook.js
Original file line number Diff line number Diff line change
Expand Up @@ -2910,7 +2910,7 @@

AscFormat.ExecuteNoHistory(function () {
this.CustomProperties = new AscCommon.CCustomProperties();
}, this, []);
}, this, [], true);

this.theme = null;
this.clrSchemeMap = null;
Expand Down Expand Up @@ -15178,7 +15178,7 @@

if (oSheetListeners.cellMap.hasOwnProperty(nCellIndex)) {
return oSheetListeners.cellMap[nCellIndex];
} else {
} else if (aOutStack && aOutStack.length) {
for (let nIndex in oSheetListeners.areaMap) {
if (oSheetListeners.areaMap[nIndex].bbox.contains(this.nCol, this.nRow)
&& !_isExcludeFormula(aOutStack, oSheetListeners.areaMap[nIndex])) {
Expand Down Expand Up @@ -15607,8 +15607,8 @@
const t = this;
// Checks cell contains formula or formula is not calculated yet
if (this.getIsDirty()) {
g_cCalcRecursion.incLevel();
if (g_cCalcRecursion.checkLevel()) {
g_cCalcRecursion.incLevel();
const isCalc = this.getIsCalc();
this.setIsCalc(true);
const calculatedArrayFormulas = [];
Expand Down Expand Up @@ -15639,8 +15639,27 @@
});

g_cCalcRecursion.decLevel();
this.setIsCalc(false);
this.setIsDirty(false);
if (g_cCalcRecursion.getIsForceBacktracking()) {
g_cCalcRecursion.insert({ws: this.ws, nRow: this.nRow, nCol: this.nCol});
if (g_cCalcRecursion.getLevel() === 0 && !g_cCalcRecursion.getIsProcessRecursion()) {
g_cCalcRecursion.setIsProcessRecursion(true);
do {
g_cCalcRecursion.setIsForceBacktracking(false);
g_cCalcRecursion.foreachInReverse(function(oElem) {
oElem.ws._getCellNoEmpty(oElem.nRow, oElem.nCol, function(oCell) {
if(oCell && oCell.getIsDirty()) {
oCell.setIsCalc(false);
oCell._checkDirty();
}
});
});
} while (g_cCalcRecursion.getIsForceBacktracking());
g_cCalcRecursion.setIsProcessRecursion(false);
}
} else {
this.setIsCalc(false);
this.setIsDirty(false);
}
}
}
};
Expand Down
9 changes: 8 additions & 1 deletion cell/view/EventsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
return;
}

if (this.view.Api.isMobileVersion) {
if (this.view.Api.isUseOldMobileVersion()) {
/*раньше события на ресайз вызывался из меню через контроллер. теперь контроллер в меню не доступен, для ресайза подписываемся на глобальный ресайз от window.*/
window.addEventListener("resize", function () {
self._onWindowResize.apply(self, arguments);
Expand Down Expand Up @@ -1642,6 +1642,8 @@
touchManager.stopTouchingInProcess();
return res;
}
if (touchManager)
touchManager.checkMouseFocus(event);

var t = this;
asc["editor"].checkInterfaceElementBlur();
Expand Down Expand Up @@ -2177,6 +2179,11 @@
}
}

if (event.shiftKey) {
deltaX = deltaY;
deltaY = 0;
}

if (this.smoothWheelCorrector && !wb.smoothScroll) {
deltaX = this.smoothWheelCorrector.get_DeltaX(deltaX);
deltaY = this.smoothWheelCorrector.get_DeltaY(deltaY);
Expand Down
8 changes: 4 additions & 4 deletions cell/view/WorkbookView.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,10 @@
if (null != this.element) {
if (!this.Api.VersionHistory && !this.Api.isEditOleMode) {
this.element.innerHTML = '<div id="ws-canvas-outer">\
<canvas id="ws-canvas"></canvas>\
<canvas id="ws-canvas-overlay"></canvas>\
<canvas id="ws-canvas-graphic"></canvas>\
<canvas id="ws-canvas-graphic-overlay"></canvas>\
<canvas id="ws-canvas" style="touch-action:none;-ms-touch-action: none;-webkit-user-select: none;"></canvas>\
<canvas id="ws-canvas-overlay" style="touch-action:none;-ms-touch-action: none;-webkit-user-select: none;"></canvas>\
<canvas id="ws-canvas-graphic" style="touch-action:none;-ms-touch-action: none;-webkit-user-select: none;"></canvas>\
<canvas id="ws-canvas-graphic-overlay" style="touch-action:none;-ms-touch-action: none;-webkit-user-select: none;"></canvas>\
<div id="id_target_cursor" class="block_elem" width="1" height="1"\
style="width:2px;height:13px;display:none;z-index:9;"></div>\
</div>';
Expand Down
14 changes: 14 additions & 0 deletions cell/view/WorksheetView.js
Original file line number Diff line number Diff line change
Expand Up @@ -1556,6 +1556,20 @@
this.updateResize = false;

this.objectRender.resizeCanvas();
if (this.getRightToLeft()) {
AscFormat.ExecuteNoHistory(function () {
let drawings = this.objectRender.controller.getDrawingObjects();
for (var i = 0; i < drawings.length; ++i) {
if (!drawings[i].group) {
AscFormat.CheckSpPrXfrm3(drawings[i], true);
} else {
AscFormat.CheckSpPrXfrm(drawings[i], true);
}
}
this.objectRender.controller.recalculate(true);
}, this, []);
}

if (editor) {
editor.move();
}
Expand Down
16 changes: 13 additions & 3 deletions cell/view/mobileTouch.js
Original file line number Diff line number Diff line change
Expand Up @@ -941,8 +941,8 @@ function (window, undefined)
this.Api.sendEvent("asc_onTapEvent", e);

var typeMenu = this.delegate.GetContextMenuType();
if (typeMenu == AscCommon.MobileTouchContextMenuType.Target ||
(typeMenu == AscCommon.MobileTouchContextMenuType.Select && this.delegate.IsInObject()))
if (typeMenu === AscCommon.MobileTouchContextMenuType.Target ||
(typeMenu === AscCommon.MobileTouchContextMenuType.Select && this.delegate.IsInObject()))
isPreventDefault = false;
}
else
Expand Down Expand Up @@ -973,6 +973,12 @@ function (window, undefined)
// TODO:
this.delegate.Drawing_OnMouseUp(e.changedTouches ? e.changedTouches[0] : e);
this.Mode = AscCommon.MobileTouchMode.None;

var typeMenu = this.delegate.GetContextMenuType();
if (typeMenu === AscCommon.MobileTouchContextMenuType.Target ||
(typeMenu === AscCommon.MobileTouchContextMenuType.Select && this.delegate.IsInObject()))
isPreventDefault = false;

break;
}
case AscCommon.MobileTouchMode.Select:
Expand Down Expand Up @@ -1008,7 +1014,7 @@ function (window, undefined)
this.delegate.Api.controller._onMouseMove(_e);
}

if (this.CellEditorType == Asc.c_oAscCellEditorState.editFormula)
if (this.CellEditorType === Asc.c_oAscCellEditorState.editFormula)
isPreventDefault = false;

if (this.Api.isViewMode || isPreventDefault)
Expand All @@ -1023,13 +1029,17 @@ function (window, undefined)
if (true !== this.iScroll.isAnimating && (this.CellEditorType != Asc.c_oAscCellEditorState.editFormula))
this.CheckContextMenuTouchEnd(isCheckContextMenuMode, isCheckContextMenuSelect, isCheckContextMenuCursor);

if (!isPreventDefault && this.Api.isMobileVersion && !this.Api.isUseOldMobileVersion())
this.showKeyboard(true);

return false;
};

CMobileTouchManager.prototype.mainOnTouchStart = function(e)
{
if (AscCommon.g_inputContext && AscCommon.g_inputContext.externalChangeFocus())
return;
this.removeHandlersOnClick();
return this.onTouchStart(e);
};
CMobileTouchManager.prototype.mainOnTouchMove = function(e)
Expand Down
12 changes: 9 additions & 3 deletions common/Charts/ChartsDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8678,6 +8678,7 @@ drawLineChart.prototype = {
_calculateLines: function () {
var xPoints = this.catAx.xPoints;
var yPoints = this.valAx.yPoints;
let isLog;

if(!xPoints || !yPoints) {
return;
Expand All @@ -8688,6 +8689,7 @@ drawLineChart.prototype = {

seria = this.chart.series[i];
numCache = this.cChartDrawer.getNumCache(seria.val);
isLog = this.valAx && this.valAx.scaling ? this.valAx.scaling.logBase : false;

if (!numCache) {
continue;
Expand Down Expand Up @@ -8721,7 +8723,7 @@ drawLineChart.prototype = {
compiledMarkerSize = idxPoint && idxPoint.compiledMarker && idxPoint.compiledMarker.size ? idxPoint.compiledMarker.size : null;
compiledMarkerSymbol = idxPoint && idxPoint.compiledMarker && AscFormat.isRealNumber(idxPoint.compiledMarker.symbol) ? idxPoint.compiledMarker.symbol : null;

if (val != null) {
if (val != null && ((isLog && val !== 0) || !isLog)) {
this.paths.points[i][n] = this.cChartDrawer.calculatePoint(x, y, compiledMarkerSize, compiledMarkerSymbol);
let errBars = this.chart.series[i].errBars[0];
if (errBars) {
Expand Down Expand Up @@ -9225,11 +9227,13 @@ drawAreaChart.prototype = {
var y, x, val, seria, dataSeries, numCache;
var pxToMm = this.chartProp.pxToMM;
var nullPositionOX = this.catAx.posY;
let isLog;

for (var i = 0; i < this.chart.series.length; i++) {

seria = this.chart.series[i];
numCache = this.cChartDrawer.getNumCache(seria.val);
isLog = this.valAx && this.valAx.scaling ? this.valAx.scaling.logBase : false;

if (!numCache) {
continue;
Expand All @@ -9241,7 +9245,7 @@ drawAreaChart.prototype = {
//рассчитываем значения
val = this._getYVal(n, i);

if(null === val && this.cChartDrawer.nDimensionCount !== 3) {
if((null === val && this.cChartDrawer.nDimensionCount !== 3) || (isLog && val === 0)) {
continue;
}

Expand Down Expand Up @@ -14241,6 +14245,7 @@ drawScatterChart.prototype = {
_recalculateScatter: function () {
let seria, yVal, xVal, points, yNumCache, compiledMarkerSize, compiledMarkerSymbol, yPoint, idx, xPoint;
let dispBlanksAs = this.cChartSpace.chart.dispBlanksAs;
let isLog;

let t = this;
let _initObjs = function (_index) {
Expand All @@ -14261,6 +14266,7 @@ drawScatterChart.prototype = {
for (let i = 0; i < this.chart.series.length; i++) {
seria = this.chart.series[i];
yNumCache = this.cChartDrawer.getNumCache(seria.yVal);
isLog = this.valAx && this.valAx.scaling ? this.valAx.scaling.logBase : false;

if (!yNumCache) {
continue;
Expand Down Expand Up @@ -14299,7 +14305,7 @@ drawScatterChart.prototype = {

_initObjs(i);

if (yVal != null) {
if (yVal != null && ((isLog && yVal !== 0) || !isLog)) {
let x = this.cChartDrawer.getYPosition(xVal, this.catAx, true);
let y = this.cChartDrawer.getYPosition(yVal, this.valAx, true);
this.paths.points[i].push(this.cChartDrawer.calculatePoint(x, y, compiledMarkerSize, compiledMarkerSymbol));
Expand Down
4 changes: 4 additions & 0 deletions common/CollaborativeEditingBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,10 @@
CCollaborativeEditingBase.prototype.Add_DocumentPosition = function(DocumentPos){
this.m_aDocumentPositions.Add_DocumentPosition(DocumentPos);
};
CCollaborativeEditingBase.prototype.Remove_DocumentPosition = function(docPos)
{
this.m_aDocumentPositions.Remove_DocumentPosition(docPos);
};
CCollaborativeEditingBase.prototype.Add_ForeignCursor = function(UserId, DocumentPos, UserShortId){
this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);
this.m_aForeignCursors[UserId] = DocumentPos;
Expand Down
4 changes: 2 additions & 2 deletions common/Drawings/Format/Format.js
Original file line number Diff line number Diff line change
Expand Up @@ -1316,11 +1316,11 @@
}
}

function ExecuteNoHistory(f, oThis, args) {
function ExecuteNoHistory(f, oThis, args, notOffTableId) {
AscCommon.History.TurnOff && AscCommon.History.TurnOff();

var b_table_id = false;
if (g_oTableId && !g_oTableId.m_bTurnOff) {
if (!notOffTableId && g_oTableId && !g_oTableId.m_bTurnOff) {
g_oTableId.m_bTurnOff = true;
b_table_id = true;
}
Expand Down
Loading

0 comments on commit 25ff4a2

Please sign in to comment.