Skip to content

Commit

Permalink
Merge branch 'develop' into feature/chart-ex
Browse files Browse the repository at this point in the history
  • Loading branch information
GoshaZotov committed Feb 12, 2024
2 parents 6da2ab8 + 1acb3c9 commit bfa465b
Show file tree
Hide file tree
Showing 48 changed files with 18,997 additions and 18,819 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "CodeQL"

on:
push:
branches:
- 'master'
- 'hotfix/**'
- 'release/**'
paths-ignore:
- '**/README.md'
- '**/LICENSE'
- '.github/**'
pull_request:
branches:
- 'master'
- 'hotfix/**'
- 'release/**'
paths-ignore:
- '**/README.md'
- '**/LICENSE'
- '.github/**'
schedule:
- cron: '0 0 * * 6'

jobs:
analyze:
name: Analyze
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript-typescript' ]

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
1 change: 1 addition & 0 deletions cell/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,7 @@ var editor;
if(this.isViewMode) {
this.turnOffSpecialModes();
}
this.checkInputMode();
};

spreadsheet_api.prototype.asc_setFilteringMode = function (mode) {
Expand Down
32 changes: 28 additions & 4 deletions cell/apiBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,9 @@
* @property {Array} Sheets - Returns the Sheets collection that represents all the sheets in the active workbook.
* @property {ApiWorksheet} ActiveSheet - Returns an object that represents the active sheet.
* @property {ApiRange} Selection - Returns an object that represents the selected range.
* @property {ApiComment[]} Comments - Returns an array of ApiComment objects.
* @property {ApiComment[]} Comments - Returns all comments related to the whole workbook.
* @property {FreezePaneType} FreezePanes - Returns or sets the type of freeze panes.
* @property {ApiComment[]} AllComments - Returns all comments from the current workbook including comments from all worksheets.
*/
var Api = window["Asc"]["spreadsheet_api"];

Expand Down Expand Up @@ -82,7 +83,7 @@
* @property {boolean} PrintHeadings - Returns or sets the page PrintHeadings property.
* @property {boolean} PrintGridlines - Returns or sets the page PrintGridlines property.
* @property {Array} Defnames - Returns an array of the ApiName objects.
* @property {Array} Comments - Returns an array of the ApiComment objects.
* @property {Array} Comments - Returns all comments from the current worksheet.
* @property {ApiFreezePanes} FreezePanes - Returns the freeze panes for the current worksheet.
*/
function ApiWorksheet(worksheet) {
Expand Down Expand Up @@ -892,7 +893,7 @@
};

/**
* Returns an array of ApiComment objects.
* Returns all comments related to the whole workbook.
* @memberof Api
* @typeofeditors ["CSE"]
* @returns {ApiComment[]}
Expand All @@ -910,6 +911,28 @@
}
});


/**
* Returns all comments from the current workbook including comments from all worksheets.
* @memberof Api
* @typeofeditors ["CSE"]
* @returns {ApiComment[]}
*/
Api.prototype.GetAllComments = function () {
let aApiComments = this.GetComments();

let aWS = this.GetSheets();
for(let nWS = 0; nWS < aWS.length; ++nWS) {
aApiComments = aApiComments.concat(aWS[nWS].GetComments())
}
return aApiComments;
};
Object.defineProperty(Api.prototype, "AllComments", {
get: function () {
return this.GetAllComments();
}
});

/**
* Specifies a type of freeze panes.
* @typedef {("row" | "column" | "cell" | null )} FreezePaneType
Expand Down Expand Up @@ -1621,7 +1644,7 @@
});

/**
* Returns an array of ApiComment objects.
* Returns all comments from the current worksheet.
* @memberof ApiWorksheet
* @typeofeditors ["CSE"]
* @returns {ApiComment[]}
Expand Down Expand Up @@ -6557,6 +6580,7 @@
Api.prototype["RecalculateAllFormulas"] = Api.prototype.RecalculateAllFormulas;
Api.prototype["AddComment"] = Api.prototype.AddComment;
Api.prototype["GetComments"] = Api.prototype.GetComments;
Api.prototype["GetAllComments"] = Api.prototype.GetAllComments;
Api.prototype["GetCommentById"] = Api.prototype.GetCommentById;
Api.prototype["SetFreezePanesType"] = Api.prototype.SetFreezePanesType;
Api.prototype["GetFreezePanesType"] = Api.prototype.GetFreezePanesType;
Expand Down
45 changes: 22 additions & 23 deletions cell/model/Serialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -1610,7 +1610,7 @@
pageLayout: 2
};

var g_nNumsMaxId = 160;
var g_nNumsMaxId = 164;

var DocumentPageSize = new function() {
this.oSizes = [
Expand Down Expand Up @@ -4086,42 +4086,41 @@
};
this.WriteFileSharing = function(fileSharing)
{
var oThis = this;
if (null != fileSharing.algorithmName) {
this.bs.WriteItem(c_oSerFileSharing.AlgorithmName, function() {
oThis.memory.WriteByte(fileSharing.algorithmName);
});
this.memory.WriteByte(c_oSerFileSharing.AlgorithmName);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteByte(fileSharing.algorithmName);
}
if (null != fileSharing.spinCount) {
this.bs.WriteItem(c_oSerFileSharing.SpinCount, function() {
oThis.memory.WriteLong(fileSharing.spinCount);
});
this.memory.WriteByte(c_oSerFileSharing.SpinCount);
this.memory.WriteByte(c_oSerPropLenType.Long);
this.memory.WriteLong(fileSharing.spinCount);
}
if (null != fileSharing.hashValue) {
this.bs.WriteItem(c_oSerFileSharing.HashValue, function() {
oThis.memory.WriteString3(fileSharing.hashValue);
});
this.memory.WriteByte(c_oSerFileSharing.HashValue);
this.memory.WriteByte(c_oSerPropLenType.Variable);
this.memory.WriteString2(fileSharing.hashValue);
}
if (null != fileSharing.saltValue) {
this.bs.WriteItem(c_oSerFileSharing.SaltValue, function() {
oThis.memory.WriteString3(fileSharing.saltValue);
});
this.memory.WriteByte(c_oSerFileSharing.SaltValue);
this.memory.WriteByte(c_oSerPropLenType.Variable);
this.memory.WriteString2(fileSharing.saltValue);
}

if (null != fileSharing.password) {
this.bs.WriteItem(c_oSerFileSharing.Password, function() {
oThis.memory.WriteString3(fileSharing.password);
});
this.memory.WriteByte(c_oSerFileSharing.Password);
this.memory.WriteByte(c_oSerPropLenType.Variable);
this.memory.WriteString2(fileSharing.password);
}
if (null != fileSharing.userName) {
this.bs.WriteItem(c_oSerFileSharing.UserName, function() {
oThis.memory.WriteString3(fileSharing.userName);
});
this.memory.WriteByte(c_oSerFileSharing.UserName);
this.memory.WriteByte(c_oSerPropLenType.Variable);
this.memory.WriteString2(fileSharing.userName);
}
if (null != fileSharing.readOnly) {
this.bs.WriteItem(c_oSerFileSharing.ReadOnly, function() {
oThis.memory.WriteBool(fileSharing.readOnly);
});
this.memory.WriteByte(c_oSerFileSharing.ReadOnly);
this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(fileSharing.readOnly);
}
};
}
Expand Down
4 changes: 2 additions & 2 deletions cell/view/WorksheetView.js
Original file line number Diff line number Diff line change
Expand Up @@ -7654,9 +7654,9 @@
arnIntersection = activeMoveRange.intersectionSimple(range);
if (arnIntersection) {
// Координаты для перемещения диапазона
_x1 = this._getColLeft(arnIntersection.c1) - offsetX - 2 - 1*isRetinaWidth*bInsertBetweenRowCol;
_x1 = this._getColLeft(arnIntersection.c1) - offsetX - 2 - 1*isRetinaWidth;
_x2 = this._getColLeft(arnIntersection.c2 + 1) - offsetX + 1 + 2;
_y1 = this._getRowTop(arnIntersection.r1) - offsetY - 2 - 1*isRetinaWidth*bInsertBetweenRowCol;
_y1 = this._getRowTop(arnIntersection.r1) - offsetY - 2 - 1*isRetinaWidth;
_y2 = this._getRowTop(arnIntersection.r2 + 1) - offsetY + 1 + 2;

// Выбираем наибольший range для очистки
Expand Down
47 changes: 29 additions & 18 deletions common/Charts/ChartsDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13428,6 +13428,23 @@ drawScatterChart.prototype = {
_recalculateScatter: function () {
let seria, yVal, xVal, points, yNumCache, compiledMarkerSize, compiledMarkerSymbol, yPoint, idx, xPoint;
let dispBlanksAs = this.cChartSpace.chart.dispBlanksAs;

let t = this;
let _initObjs = function (_index) {
if (!t.paths.points) {
t.paths.points = [];
}
if (!t.paths.points[_index]) {
t.paths.points[_index] = [];
}
if (!points) {
points = [];
}
if (!points[_index]) {
points[_index] = [];
}
};

for (let i = 0; i < this.chart.series.length; i++) {
seria = this.chart.series[i];
yNumCache = this.cChartDrawer.getNumCache(seria.yVal);
Expand All @@ -13446,6 +13463,7 @@ drawScatterChart.prototype = {
if (dispBlanksAs === AscFormat.DISP_BLANKS_AS_ZERO || dispBlanksAs === AscFormat.DISP_BLANKS_AS_GAP) {
if (yNumCache.pts[n-1] && yNumCache.pts[n] && yNumCache.pts[n].idx - yNumCache.pts[n-1].idx > 1) {
for (let k = 0; k < yNumCache.pts[n].idx - yNumCache.pts[n-1].idx - 1; k++) {
_initObjs(i);
this.paths.points[i].push(null);
points[i].push(dispBlanksAs === AscFormat.DISP_BLANKS_AS_ZERO ? {x: 0, y: 0} : null);
}
Expand All @@ -13466,19 +13484,7 @@ drawScatterChart.prototype = {
compiledMarkerSymbol = yPoint.compiledMarker.symbol;
}

if (!this.paths.points) {
this.paths.points = [];
}
if (!this.paths.points[i]) {
this.paths.points[i] = [];
}

if (!points) {
points = [];
}
if (!points[i]) {
points[i] = [];
}
_initObjs(i);

if (yVal != null) {
let x = this.cChartDrawer.getYPosition(xVal, this.catAx);
Expand Down Expand Up @@ -16897,7 +16903,7 @@ CColorObj.prototype =
//control trend calculate type
this.bAllowDrawByBezier = true;
this.bAllowDrawByPoints = false;
this.continueAdding = true;
this.stopAdding = false;
}

CTrendline.prototype = {
Expand All @@ -16921,11 +16927,11 @@ CColorObj.prototype =
this.storage[chartId][seriaId] = new CTrendData();
}
if (!this.storage[chartId][seriaId].isEmpty() && xVal === this.storage[chartId][seriaId].coords.catVals[0]) {
this.continueAdding = false;
this.stopAdding = true;
}

// in the case of duplicated data, no further adding should be allowed
if (this.continueAdding) {
if (!this.stopAdding) {
this.storage[chartId][seriaId].addCatVal(xVal);
this.storage[chartId][seriaId].addValVal(yVal);

Expand Down Expand Up @@ -17305,7 +17311,7 @@ CColorObj.prototype =
return true;
};

const mapped = this.continueAdding ? _mapCoordinates() : true;
const mapped = this.stopAdding ? true : _mapCoordinates();

if (mapped) {

Expand Down Expand Up @@ -17509,6 +17515,8 @@ CColorObj.prototype =
return Math.exp(val);
}, bValForward: function (val) {
return Math.log(val);
}, yValBackward: function (val) {
return Math.pow(Math.exp(1), val);
}
}, [AscFormat.TRENDLINE_TYPE_LOG]: {
xVal: function (val) {
Expand All @@ -17523,6 +17531,8 @@ CColorObj.prototype =
return Math.exp(val);
}, bValForward: function (val) {
return Math.log(val);
}, yValBackward: function (val) {
return Math.pow(Math.exp(1), val);
}
}
};
Expand All @@ -17538,6 +17548,7 @@ CColorObj.prototype =
result += (Math.pow(xVal, power) * coefficients[i]);
power++;
}
result = mappingStorage.yValBackward ? mappingStorage.yValBackward(result) : result;
return result;
};

Expand All @@ -17553,8 +17564,8 @@ CColorObj.prototype =
let XSquared = 0;
let YSquared = 0;
for (let i = 0; i < N; i++) {
const yVal = mappingStorage.yValBackward ? mappingStorage.yValBackward(valVals[i]) : valVals[i];
const yValPred = predictY(catVals[i]);
const yVal = valVals[i];
XY += (yVal * yValPred);
X += yVal;
Y += yValPred;
Expand Down
Loading

0 comments on commit bfa465b

Please sign in to comment.