Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/external data diagrams #4244

Closed
wants to merge 135 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
876f647
Start refactor working with frame editors
Mar 20, 2023
79f6907
Add read/write binary data for diagrams
Mar 21, 2023
2562688
Open diagram editor with spreadsheet data
Mar 21, 2023
1c13283
Add XLSX ChartSpace field to history
Mar 22, 2023
9e63909
Update general chart from frame editor
Mar 22, 2023
80c9bc7
Added new chart addition
Mar 23, 2023
406a6df
Merge branch 'develop' of https://github.com/ONLYOFFICE/sdkjs into fe…
Mar 24, 2023
3c84932
Update chart range selection in chart editor
Mar 24, 2023
9f55bfa
Develop external charts
Mar 30, 2023
e45f45f
Fix problem with coauthoring
Apr 4, 2023
be2e4dd
add external path to copy method for chart
Apr 4, 2023
d261ade
Fix open local file on desktop
Apr 4, 2023
329cdb7
Add method for update chart cache
Apr 5, 2023
a67f123
Fix writing external path for charts
Apr 11, 2023
19336c1
Merge branch 'develop' of https://github.com/ONLYOFFICE/sdkjs into fe…
Jun 7, 2023
4ace2cf
Develop external references
Jun 9, 2023
828d7df
Refactor external data for charts
Jun 9, 2023
30403b1
Merge branch 'develop' of https://github.com/ONLYOFFICE/sdkjs into fe…
Jun 14, 2023
d65a85d
Add available setting props for charts from general editor
Jun 16, 2023
03dc8e6
[PE]New scheme for open chart editor
Jun 26, 2023
cccad44
[DE]New scheme for open chart editor
Jun 26, 2023
12e2f25
Developing
Jun 26, 2023
2384379
Init external worksheet from dataset on getting
Jun 30, 2023
60f146d
Fix copy external reference in charts
Jun 30, 2023
24e493b
Add copypaste between presentation and word
Jun 30, 2023
a52b05d
Merge branch 'develop' of https://github.com/ONLYOFFICE/sdkjs into fe…
Jun 30, 2023
7c68600
Add copy workbook on copy/paste
Jul 3, 2023
f632b8b
[SSE]Add copy/paste external charts
Jul 3, 2023
db606f0
Some fixes for chart editor logic
Jul 3, 2023
46f848d
Fix add chart object by type
Jul 6, 2023
86feebb
Fix edit chart and show preview
Jul 6, 2023
9d95c73
Add missing methods and events for working with charts
Jul 6, 2023
67c4e47
Passing tests
Jul 6, 2023
2af8a70
Merge branch 'develop' of https://github.com/ONLYOFFICE/sdkjs into fe…
Jul 6, 2023
376e1c2
Warning about leaving from page with open frame
Jul 6, 2023
2c13689
Rework frame manager
Jul 6, 2023
0ed55cf
Add ability load images to chart editor
Jul 6, 2023
75a83ef
Fix saving documents in desktop editors
Jul 7, 2023
e11a072
Fix permanent block of chart editor after opening external file
Jul 7, 2023
4483f47
Select chart range after end changing range
Jul 7, 2023
534bf6b
Fix updating refs with external refs
Jul 7, 2023
dcb0e31
Remove duplicate frameManager.js
Jul 7, 2023
436fd6f
Merge branch 'develop' of https://github.com/ONLYOFFICE/sdkjs into fe…
Jul 31, 2023
46d6719
Remove unusual event
Aug 2, 2023
7e9efbb
Change event asc_onOleEditorReady -> asc_onFrameEditorReady
Aug 2, 2023
e1322a3
Merge branch 'release/v7.5.0' of https://github.com/ONLYOFFICE/sdkjs …
Aug 3, 2023
3b7ec9c
Add methods in base api for setting label format from general editor
Aug 4, 2023
e34aca9
Fix drawing old chart on undo
Aug 4, 2023
2767f82
Fix opening label format options for charts
Aug 4, 2023
26c0980
Add read/write portal data for external charts
Aug 6, 2023
9aab91f
Remove unusual parameters
Aug 6, 2023
4762dd6
Merge branch 'release/v7.5.0' of https://github.com/ONLYOFFICE/sdkjs …
Coolcooo Aug 14, 2023
e2431c4
Fix creating field object
Coolcooo Aug 14, 2023
fcd6f1b
[se]Fix several paste external charts
Coolcooo Aug 14, 2023
4fc748f
Improve preview chart drawing
Coolcooo Aug 14, 2023
0606752
[pe][de] Change regional settings with locale
Coolcooo Aug 15, 2023
341588d
Unlock saving on apply chart settings
Coolcooo Aug 15, 2023
52a61cb
Fix content type for embedding xlsx files
Coolcooo Aug 21, 2023
6efff91
Remove unusual code
Coolcooo Aug 21, 2023
679a89f
Refactoring
Coolcooo Aug 21, 2023
33d65b4
Add support embedding files for client opening
Coolcooo Aug 21, 2023
fdae1f6
Fix api constant
Coolcooo Aug 22, 2023
39fb36b
Open ole editor with chart editor logic
Coolcooo Aug 23, 2023
ca5914c
Fix opening ole objects
Coolcooo Aug 24, 2023
2c0b508
Fix saving preview of ole objects after editing
Coolcooo Aug 24, 2023
8f70e0e
Fix opening ole object with images
Coolcooo Aug 24, 2023
f0cc445
Merge branch 'release/v7.5.0' of https://github.com/ONLYOFFICE/sdkjs …
Coolcooo Aug 30, 2023
70ffea2
Fix adding external reference in same sheet
Coolcooo Aug 30, 2023
ead3484
Disable selecting frame chart
Coolcooo Aug 31, 2023
2ec75b0
Merge branch 'release/v7.5.0' of https://github.com/ONLYOFFICE/sdkjs …
Coolcooo Sep 1, 2023
1284f9f
Fix copy externalData
Coolcooo Sep 1, 2023
b5dd3f2
Fix problems with history for preview
Coolcooo Sep 1, 2023
5936983
Refactor
Coolcooo Sep 1, 2023
94dd9cb
Refactor
Coolcooo Sep 2, 2023
7a57198
Fix update chart with client opening
Coolcooo Sep 2, 2023
e38f713
Fix blocking chart on updating data
Coolcooo Sep 2, 2023
9c829f5
Fix var naming
Coolcooo Sep 2, 2023
5cc050a
Fix set locale before loading full api
Coolcooo Sep 4, 2023
4bafa02
Move constants
Coolcooo Sep 4, 2023
b169126
Fix crashing chart drawing with noHistory
Coolcooo Sep 4, 2023
3fa4373
Merge branch 'release/v7.5.0' of https://github.com/ONLYOFFICE/sdkjs …
Coolcooo Sep 15, 2023
3fcfad1
Add chart external reference information to settings
Coolcooo Sep 15, 2023
239ebfb
Merge remote-tracking branch 'remotes/origin/develop' into feature/ex…
SergeyLuzyanin Oct 3, 2023
3f90d94
Merge branch 'release/v7.5.0' of https://github.com/ONLYOFFICE/sdkjs …
Coolcooo Oct 4, 2023
b08504d
Set filename for external references
Coolcooo Oct 4, 2023
1f3bf82
Remove unannounced variable
Coolcooo Oct 4, 2023
d9405b4
Update chart if cache and external data are not equal
Coolcooo Oct 4, 2023
2ba1d0d
Merge branch 'release/v7.5.0' of https://github.com/ONLYOFFICE/sdkjs …
Coolcooo Oct 4, 2023
07ff0af
Merge branch 'develop' of https://github.com/ONLYOFFICE/sdkjs into fe…
Coolcooo Oct 16, 2023
87799f3
Add the ability to change the external link
Coolcooo Oct 16, 2023
f009481
Merge branch 'develop' of https://github.com/ONLYOFFICE/sdkjs into fe…
Coolcooo Oct 20, 2023
3833d02
Fix api method calling
Coolcooo Oct 20, 2023
3290ae0
Move opening workbook for external reference on client to base api
Coolcooo Oct 23, 2023
0430c41
Remove unusual methods for external references
Coolcooo Oct 23, 2023
2893355
Update base methods for exernal references after merge
Coolcooo Oct 23, 2023
135a040
Add ability for recalculate references with history
Coolcooo Oct 23, 2023
103bb84
Add common methods for working with external references
Coolcooo Oct 23, 2023
b6ccf0d
Merge branch 'develop' of https://github.com/ONLYOFFICE/sdkjs into fe…
Coolcooo Oct 23, 2023
daf3b24
Add init external chart collector
Coolcooo Oct 23, 2023
6ff0e82
Fix collecting external charts
Coolcooo Oct 23, 2023
1599b50
Some fixes
Coolcooo Oct 23, 2023
f1caf6d
[de]Add recalculate for updating
Coolcooo Oct 24, 2023
a2f58e0
Add lock for references in co-edit
Coolcooo Oct 24, 2023
aa559aa
Add repair several sheets from chart's cache
Coolcooo Oct 25, 2023
f2df591
Fix saving binary data on paste
Coolcooo Oct 25, 2023
a46d4d2
Remove unusual methods
Coolcooo Oct 25, 2023
04459ed
Fix flags for ooxml
Coolcooo Oct 25, 2023
227aa31
Merge branch 'develop' of https://github.com/ONLYOFFICE/sdkjs into fe…
Coolcooo Oct 25, 2023
9dda801
Update interface state after actions with charts
Coolcooo Oct 25, 2023
5301e7d
Add event for updating external references on opening
Coolcooo Oct 25, 2023
3c65ec4
Remove unusual files after merge
Coolcooo Oct 25, 2023
86e5fc6
Add zip writing for charts
Coolcooo Oct 26, 2023
0cab172
Fix sending event for updating after document is ready
Coolcooo Oct 26, 2023
fd0a3bf
Move method for getting external sheets from zip to workbook
Coolcooo Oct 26, 2023
8aae9bf
Check chart availability after downloading an external workbook
Coolcooo Oct 26, 2023
2138614
Add repair chart workbook from cache on writing
Coolcooo Oct 27, 2023
b1f5281
[feature] Add a list of Excel-like date formats by locale; for bug 35804
konovalovsergey Nov 23, 2023
325a741
Merge branch 'release/v7.6.0' of https://github.com/ONLYOFFICE/sdkjs …
Coolcooo Nov 23, 2023
96e29a4
Fix after merge
Coolcooo Nov 23, 2023
e638575
Mock external chart collector
Coolcooo Nov 23, 2023
0f2cae9
[feature] Add a list of Excel-like time formats by lcid; for bug 35804
konovalovsergey Nov 26, 2023
140afc4
Merge branch 'develop' of https://github.com/ONLYOFFICE/sdkjs into fe…
Coolcooo Feb 13, 2024
a9bfef7
Fix name of method
Coolcooo Feb 13, 2024
6ef211c
Check class availability
Coolcooo Feb 14, 2024
69c3659
Update worksheet indexes after ooxml reading
Coolcooo Feb 14, 2024
331f42a
Merge branch 'release/v8.1.0' of https://github.com/ONLYOFFICE/sdkjs …
Coolcooo Apr 10, 2024
92f1dc6
Fix getPastedLinkInfo method after merge
Coolcooo Apr 10, 2024
7fba0c8
Fix getPastedLinkInfo call
Coolcooo Apr 10, 2024
5c6eb78
Set wb and wbModel to null on closing file
Coolcooo Apr 11, 2024
84b33e7
Fix getting editor from Asc
Coolcooo Apr 11, 2024
f525fc9
Don't show special paste button for empty options
Coolcooo Apr 11, 2024
d96451a
[se]Fix multiple paste of external diagrams
Coolcooo Apr 12, 2024
dae5a05
Lock recal for external references
Coolcooo Apr 12, 2024
5f84445
Add import for constants
Coolcooo Apr 12, 2024
665ac25
Add change external reference for charts in desktop editors
Coolcooo Apr 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
435 changes: 80 additions & 355 deletions cell/api.js

Large diffs are not rendered by default.

11 changes: 1 addition & 10 deletions cell/apiDefines.js
Original file line number Diff line number Diff line change
Expand Up @@ -572,11 +572,7 @@ var c_oAscPopUpSelectorType = {
};

var c_nAscMaxAddCellWatchesCount = 10000;
var c_oAscExternalReferenceType = {
referenceData: 0,
link: 1,
path: 2
};


var c_oAscPageBreaksDisableType = {
none: 0,
Expand Down Expand Up @@ -1030,11 +1026,6 @@ var c_oAscPopUpSelectorType = {
prot['Range'] = prot.Range;

window['Asc']['c_nAscMaxAddCellWatchesCount'] = window['Asc'].c_nAscMaxAddCellWatchesCount = c_nAscMaxAddCellWatchesCount;
window['Asc']['c_oAscExternalReferenceType'] = window['Asc'].c_oAscExternalReferenceType = c_oAscExternalReferenceType;
prot = c_oAscExternalReferenceType;
prot['referenceData'] = prot.referenceData;
prot['link'] = prot.link;
prot['path'] = prot.path;

window['Asc']['c_oAscPageBreaksDisableType'] = window['Asc'].c_oAscPageBreaksDisableType = c_oAscPageBreaksDisableType;
prot = c_oAscPageBreaksDisableType;
Expand Down
7 changes: 3 additions & 4 deletions cell/model/CollaborativeEditing.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,14 @@

asc_applyFunction(callback, true);
} else if (result["error"]) {
if (Asc.editor && Asc.editor.isOleEditor && !Asc.editor.isEditOleMode) {
if (Asc.editor.frameManager.isLoadingOleEditor) {
Asc.editor.sync_closeOleEditor();
}

asc_applyFunction(callback, false);
}
if (Asc.editor && !Asc.editor.isEditOleMode) {
Asc.editor.isOleEditor = false;
}

Asc.editor.frameManager.endLoadOleEditor();
};
CCollaborativeEditing.prototype.addUnlock = function (LockClass) {
this.m_arrNeedUnlock.push(LockClass);
Expand Down
185 changes: 183 additions & 2 deletions cell/model/DrawingObjects/Format/ChartSpacePrototype.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,12 @@ CChartSpace.prototype.recalculateBounds = function()

CChartSpace.prototype.recalculate = function()
{
if(this.bDeleted)
if(this.bDeleted && !this.isFrameChart)
return;

var oController = this.getDrawingObjectsController();
//Use this check to prevent charts recalculation on not initialized sheets bug 50467
if(!oController) {
if(!oController && !this.isFrameChart) {
return;
}
//---------------------------------------------------
Expand Down Expand Up @@ -435,4 +435,185 @@ CChartSpace.prototype.Get_ColorMap = CShape.prototype.Get_ColorMap;
this.worksheet.contentChanges.Refresh();
}
};

CChartSpace.prototype.addExternalReferenceToEditor = function (oPastedWb)
{
if (!oPastedWb)
return;

const oApi = Asc.editor;

const oWbModel = oApi.wbModel;
const oWs = oApi.wb.getWorksheet();
if (!oWs)
return;

const oCellPasteHelper = oWs.cellPasteHelper;

const oMockWb = oWbModel.getTemporaryExternalWb();
//todo: do we want to read already created links when copy-pasting?
//const oConvertedExternalReference = oExternalReference.convertToExternalReference();
const oCachedWorksheets = this.getWorksheetsFromCache(oMockWb);
let bNeedConvert = false;

let oMainExternalReference;
const sChartRange = this.getCommonRange();
const arrChartRanges = AscFormat.fParseChartFormulaExternal(sChartRange);
if (!(arrChartRanges && arrChartRanges.length)) {
return;
}
const mapRangeWorksheets = {};
for (let i = 0; i < arrChartRanges.length; i++) {
const oRange = arrChartRanges[i];
const oRangeWorksheet = oRange.worksheet;
const sWorksheetName = oRangeWorksheet.getName();
if (!mapRangeWorksheets[sWorksheetName]) {
mapRangeWorksheets[sWorksheetName] = [];
}
mapRangeWorksheets[sWorksheetName].push(oRange.bbox);
}
for (let sSheetName in oCachedWorksheets)
{
const arrRanges = mapRangeWorksheets[sSheetName];
if (!arrRanges) {
continue;
}
const oPastedWS = oCachedWorksheets[sSheetName].ws;
const oPastedLinkInfo = oCellPasteHelper.getPastedLinkInfo(oPastedWb, oPastedWS);

if (oPastedLinkInfo)
{
if (oPastedLinkInfo.type === -1)
{
const pasteSheetLinkName = oPastedLinkInfo.sheet;
//необходимо положить нужные данные в SheetDataSet
oMainExternalReference = oWbModel.externalReferences[oPastedLinkInfo.index - 1];
if (oMainExternalReference)
{
oMainExternalReference.updateSheetData(pasteSheetLinkName, oPastedWS, arrRanges);
oWbModel.changeExternalReference(oPastedLinkInfo.index, oMainExternalReference);
}
bNeedConvert = true;
}
else if (oPastedLinkInfo.type === -2)
{
if (!oMainExternalReference)
{
var referenceData;
var name = oPastedWb.Core.title;
if (window["AscDesktopEditor"] && window["AscDesktopEditor"]["IsLocalFile"]())
{
name = oPastedLinkInfo.path;
}
else
{
if (oPastedWb && oPastedWb.Core)
{
referenceData = {};
referenceData["fileKey"] = oPastedWb.Core.contentStatus;
referenceData["instanceId"] = oPastedWb.Core.category;
}
}

oMainExternalReference = new AscCommonExcel.ExternalReference();
oMainExternalReference.referenceData = referenceData;
oMainExternalReference.Id = name;
}

oMainExternalReference.addSheet(oPastedWS, arrRanges);
oWbModel.addExternalReferences([oMainExternalReference]);
bNeedConvert = true;
}
}
}
if (bNeedConvert)
{
this.convertRefsToExternal(oMainExternalReference, oPastedWb.externalReferences);
}
}
CChartSpace.prototype.convertRefsToExternal = function (oMainExternalReference, arrPastedExternalReferences)
{
const aSeries = this.getAllSeries();
for (let i = 0; i < aSeries.length; i += 1)
{
const oSeria = aSeries[i];
const oVal = oSeria.val || oSeria.yVal;
if (oVal && oVal.numRef)
{
oVal.numRef.updateToExternal(oMainExternalReference, arrPastedExternalReferences);
}
const oCat = oSeria.cat || oSeria.xVal;
if (oCat)
{
if (oCat.numRef)
{
oCat.numRef.updateToExternal(oMainExternalReference, arrPastedExternalReferences);
}
if (oCat.strRef)
{
oCat.strRef.updateToExternal(oMainExternalReference, arrPastedExternalReferences);
}
}
if (oSeria.tx && oSeria.tx.strRef)
{
oSeria.tx.strRef.updateToExternal(oMainExternalReference, arrPastedExternalReferences);
}
}
this.onDataUpdateRecalc();
};
CChartSpace.prototype.applySpecialPasteProps = function (oExternalWb)
{
if (!(this.XLSX && this.XLSX.length))
{
this.setXLSX(new Uint8Array(0));
}
if (oExternalWb)
{
this.addExternalReferenceToEditor(oExternalWb);
}
else
{
this.setExternalReference(null);
}
}
CChartSpace.prototype.canPasteExternal = function ()
{
const oExternalReference = this.getExternalReference();
if (oExternalReference)
{
const oReferenceData = oExternalReference.referenceData;
if (oReferenceData)
{
const oApi = Asc.editor || editor;
const oDocInfo = oApi.DocInfo;
const oDocumentReferenceData = oDocInfo && oDocInfo.ReferenceData;
if (oDocumentReferenceData)
{
return oDocumentReferenceData['fileKey'] === oReferenceData['fileKey'] && oDocumentReferenceData['instanceId'] === oReferenceData['instanceId'];
}
}
return true;
}
return false;

};
CChartSpace.prototype.getSpecialPasteProps = function ()
{
const oSpecialProps = Asc.c_oSpecialPasteProps;
const mapProps = {};

mapProps[oSpecialProps.destinationFormatting] = [];
mapProps[oSpecialProps.sourceformatting] = [];
mapProps[oSpecialProps.picture] = [oSpecialProps.picture];
if (this.canPasteExternal())
{
mapProps[oSpecialProps.destinationFormatting].push(oSpecialProps.destinationFormattingLink);
mapProps[oSpecialProps.sourceformatting].push(oSpecialProps.sourceFormattingLink);
}
return mapProps;
};
CChartSpace.prototype.isWorkbookChart = function () {
return true;
};

})(window);
Loading
Loading