@odoo/o-spreadsheet 16.3.1 → 16.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/o-spreadsheet.cjs.js +65 -51
- package/dist/o-spreadsheet.d.ts +9 -10
- package/dist/o-spreadsheet.esm.js +65 -51
- package/dist/o-spreadsheet.iife.js +65 -51
- package/dist/o-spreadsheet.iife.min.js +199 -196
- package/package.json +1 -1
|
@@ -17841,7 +17841,7 @@
|
|
|
17841
17841
|
return !!this.state.labelsDispatchResult?.isCancelledBecause(33 /* CommandResult.InvalidLabelRange */);
|
|
17842
17842
|
}
|
|
17843
17843
|
onUpdateDataSetsHaveTitle(ev) {
|
|
17844
|
-
this.props.updateChart({
|
|
17844
|
+
this.props.updateChart(this.props.figureId, {
|
|
17845
17845
|
dataSetsHaveTitle: ev.target.checked,
|
|
17846
17846
|
});
|
|
17847
17847
|
}
|
|
@@ -17853,7 +17853,7 @@
|
|
|
17853
17853
|
this.dataSeriesRanges = ranges;
|
|
17854
17854
|
}
|
|
17855
17855
|
onDataSeriesConfirmed() {
|
|
17856
|
-
this.state.datasetDispatchResult = this.props.updateChart({
|
|
17856
|
+
this.state.datasetDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
17857
17857
|
dataSets: this.dataSeriesRanges,
|
|
17858
17858
|
});
|
|
17859
17859
|
}
|
|
@@ -17865,12 +17865,12 @@
|
|
|
17865
17865
|
this.labelRange = ranges[0];
|
|
17866
17866
|
}
|
|
17867
17867
|
onLabelRangeConfirmed() {
|
|
17868
|
-
this.state.labelsDispatchResult = this.props.updateChart({
|
|
17868
|
+
this.state.labelsDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
17869
17869
|
labelRange: this.labelRange,
|
|
17870
17870
|
});
|
|
17871
17871
|
}
|
|
17872
17872
|
onUpdateAggregated(ev) {
|
|
17873
|
-
this.props.updateChart({
|
|
17873
|
+
this.props.updateChart(this.props.figureId, {
|
|
17874
17874
|
aggregated: ev.target.checked,
|
|
17875
17875
|
});
|
|
17876
17876
|
}
|
|
@@ -17900,12 +17900,12 @@
|
|
|
17900
17900
|
class BarConfigPanel extends LineBarPieConfigPanel {
|
|
17901
17901
|
static template = "o-spreadsheet-BarConfigPanel";
|
|
17902
17902
|
onUpdateStacked(ev) {
|
|
17903
|
-
this.props.updateChart({
|
|
17903
|
+
this.props.updateChart(this.props.figureId, {
|
|
17904
17904
|
stacked: ev.target.checked,
|
|
17905
17905
|
});
|
|
17906
17906
|
}
|
|
17907
17907
|
onUpdateAggregated(ev) {
|
|
17908
|
-
this.props.updateChart({
|
|
17908
|
+
this.props.updateChart(this.props.figureId, {
|
|
17909
17909
|
aggregated: ev.target.checked,
|
|
17910
17910
|
});
|
|
17911
17911
|
}
|
|
@@ -18242,17 +18242,17 @@
|
|
|
18242
18242
|
this.state.fillColorTool = !this.state.fillColorTool;
|
|
18243
18243
|
}
|
|
18244
18244
|
updateBackgroundColor(color) {
|
|
18245
|
-
this.props.updateChart({
|
|
18245
|
+
this.props.updateChart(this.props.figureId, {
|
|
18246
18246
|
background: color,
|
|
18247
18247
|
});
|
|
18248
18248
|
}
|
|
18249
18249
|
updateTitle(ev) {
|
|
18250
|
-
this.props.updateChart({
|
|
18250
|
+
this.props.updateChart(this.props.figureId, {
|
|
18251
18251
|
title: ev.target.value,
|
|
18252
18252
|
});
|
|
18253
18253
|
}
|
|
18254
18254
|
updateSelect(attr, ev) {
|
|
18255
|
-
this.props.updateChart({
|
|
18255
|
+
this.props.updateChart(this.props.figureId, {
|
|
18256
18256
|
[attr]: ev.target.value,
|
|
18257
18257
|
});
|
|
18258
18258
|
}
|
|
@@ -18285,7 +18285,7 @@
|
|
|
18285
18285
|
this.dataRange = ranges[0];
|
|
18286
18286
|
}
|
|
18287
18287
|
updateDataRange() {
|
|
18288
|
-
this.state.dataRangeDispatchResult = this.props.updateChart({
|
|
18288
|
+
this.state.dataRangeDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
18289
18289
|
dataRange: this.dataRange,
|
|
18290
18290
|
});
|
|
18291
18291
|
}
|
|
@@ -18343,12 +18343,12 @@
|
|
|
18343
18343
|
}
|
|
18344
18344
|
updateBackgroundColor(color) {
|
|
18345
18345
|
this.state.openedMenu = undefined;
|
|
18346
|
-
this.props.updateChart({
|
|
18346
|
+
this.props.updateChart(this.props.figureId, {
|
|
18347
18347
|
background: color,
|
|
18348
18348
|
});
|
|
18349
18349
|
}
|
|
18350
18350
|
updateTitle(ev) {
|
|
18351
|
-
this.props.updateChart({
|
|
18351
|
+
this.props.updateChart(this.props.figureId, {
|
|
18352
18352
|
title: ev.target.value,
|
|
18353
18353
|
});
|
|
18354
18354
|
}
|
|
@@ -18413,7 +18413,7 @@
|
|
|
18413
18413
|
}
|
|
18414
18414
|
}
|
|
18415
18415
|
updateSectionRule(sectionRule) {
|
|
18416
|
-
this.state.sectionRuleDispatchResult = this.props.updateChart({
|
|
18416
|
+
this.state.sectionRuleDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
18417
18417
|
sectionRule,
|
|
18418
18418
|
});
|
|
18419
18419
|
}
|
|
@@ -18437,17 +18437,17 @@
|
|
|
18437
18437
|
return false;
|
|
18438
18438
|
}
|
|
18439
18439
|
onUpdateLabelsAsText(ev) {
|
|
18440
|
-
this.props.updateChart({
|
|
18440
|
+
this.props.updateChart(this.props.figureId, {
|
|
18441
18441
|
labelsAsText: ev.target.checked,
|
|
18442
18442
|
});
|
|
18443
18443
|
}
|
|
18444
18444
|
onUpdateStacked(ev) {
|
|
18445
|
-
this.props.updateChart({
|
|
18445
|
+
this.props.updateChart(this.props.figureId, {
|
|
18446
18446
|
stacked: ev.target.checked,
|
|
18447
18447
|
});
|
|
18448
18448
|
}
|
|
18449
18449
|
onUpdateAggregated(ev) {
|
|
18450
|
-
this.props.updateChart({
|
|
18450
|
+
this.props.updateChart(this.props.figureId, {
|
|
18451
18451
|
aggregated: ev.target.checked,
|
|
18452
18452
|
});
|
|
18453
18453
|
}
|
|
@@ -18483,7 +18483,7 @@
|
|
|
18483
18483
|
this.keyValue = ranges[0];
|
|
18484
18484
|
}
|
|
18485
18485
|
updateKeyValueRange() {
|
|
18486
|
-
this.state.keyValueDispatchResult = this.props.updateChart({
|
|
18486
|
+
this.state.keyValueDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
18487
18487
|
keyValue: this.keyValue,
|
|
18488
18488
|
});
|
|
18489
18489
|
}
|
|
@@ -18491,12 +18491,12 @@
|
|
|
18491
18491
|
this.baseline = ranges[0];
|
|
18492
18492
|
}
|
|
18493
18493
|
updateBaselineRange() {
|
|
18494
|
-
this.state.baselineDispatchResult = this.props.updateChart({
|
|
18494
|
+
this.state.baselineDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
18495
18495
|
baseline: this.baseline,
|
|
18496
18496
|
});
|
|
18497
18497
|
}
|
|
18498
18498
|
updateBaselineMode(ev) {
|
|
18499
|
-
this.props.updateChart({ baselineMode: ev.target.value });
|
|
18499
|
+
this.props.updateChart(this.props.figureId, { baselineMode: ev.target.value });
|
|
18500
18500
|
}
|
|
18501
18501
|
}
|
|
18502
18502
|
ScorecardChartConfigPanel.props = {
|
|
@@ -18515,12 +18515,12 @@
|
|
|
18515
18515
|
owl.useExternalListener(window, "click", this.closeMenus);
|
|
18516
18516
|
}
|
|
18517
18517
|
updateTitle(ev) {
|
|
18518
|
-
this.props.updateChart({
|
|
18518
|
+
this.props.updateChart(this.props.figureId, {
|
|
18519
18519
|
title: ev.target.value,
|
|
18520
18520
|
});
|
|
18521
18521
|
}
|
|
18522
18522
|
updateBaselineDescr(ev) {
|
|
18523
|
-
this.props.updateChart({ baselineDescr: ev.target.value });
|
|
18523
|
+
this.props.updateChart(this.props.figureId, { baselineDescr: ev.target.value });
|
|
18524
18524
|
}
|
|
18525
18525
|
toggleColorPicker(colorPickerId) {
|
|
18526
18526
|
if (this.state.openedColorPicker === colorPickerId) {
|
|
@@ -18533,13 +18533,13 @@
|
|
|
18533
18533
|
setColor(color, colorPickerId) {
|
|
18534
18534
|
switch (colorPickerId) {
|
|
18535
18535
|
case "backgroundColor":
|
|
18536
|
-
this.props.updateChart({ background: color });
|
|
18536
|
+
this.props.updateChart(this.props.figureId, { background: color });
|
|
18537
18537
|
break;
|
|
18538
18538
|
case "baselineColorDown":
|
|
18539
|
-
this.props.updateChart({ baselineColorDown: color });
|
|
18539
|
+
this.props.updateChart(this.props.figureId, { baselineColorDown: color });
|
|
18540
18540
|
break;
|
|
18541
18541
|
case "baselineColorUp":
|
|
18542
|
-
this.props.updateChart({ baselineColorUp: color });
|
|
18542
|
+
this.props.updateChart(this.props.figureId, { baselineColorUp: color });
|
|
18543
18543
|
break;
|
|
18544
18544
|
}
|
|
18545
18545
|
this.closeMenus();
|
|
@@ -18604,13 +18604,9 @@
|
|
|
18604
18604
|
class ChartPanel extends owl.Component {
|
|
18605
18605
|
static template = "o-spreadsheet-ChartPanel";
|
|
18606
18606
|
state;
|
|
18607
|
-
shouldUpdateChart = true;
|
|
18608
18607
|
get figureId() {
|
|
18609
18608
|
return this.state.figureId;
|
|
18610
18609
|
}
|
|
18611
|
-
get sheetId() {
|
|
18612
|
-
return this.state.sheetId;
|
|
18613
|
-
}
|
|
18614
18610
|
setup() {
|
|
18615
18611
|
const selectedFigureId = this.env.model.getters.getSelectedFigureId();
|
|
18616
18612
|
if (!selectedFigureId) {
|
|
@@ -18620,17 +18616,11 @@
|
|
|
18620
18616
|
this.state = owl.useState({
|
|
18621
18617
|
panel: "configuration",
|
|
18622
18618
|
figureId: selectedFigureId,
|
|
18623
|
-
sheetId: this.env.model.getters.getActiveSheetId(),
|
|
18624
18619
|
});
|
|
18625
18620
|
owl.onWillUpdateProps(() => {
|
|
18626
18621
|
const selectedFigureId = this.env.model.getters.getSelectedFigureId();
|
|
18627
18622
|
if (selectedFigureId && selectedFigureId !== this.state.figureId) {
|
|
18628
18623
|
this.state.figureId = selectedFigureId;
|
|
18629
|
-
this.state.sheetId = this.env.model.getters.getActiveSheetId();
|
|
18630
|
-
this.shouldUpdateChart = false;
|
|
18631
|
-
}
|
|
18632
|
-
else {
|
|
18633
|
-
this.shouldUpdateChart = true;
|
|
18634
18624
|
}
|
|
18635
18625
|
if (!this.env.model.getters.isChartDefined(this.figureId)) {
|
|
18636
18626
|
this.props.onCloseSidePanel();
|
|
@@ -18638,8 +18628,8 @@
|
|
|
18638
18628
|
}
|
|
18639
18629
|
});
|
|
18640
18630
|
}
|
|
18641
|
-
updateChart(updateDefinition) {
|
|
18642
|
-
if (
|
|
18631
|
+
updateChart(figureId, updateDefinition) {
|
|
18632
|
+
if (figureId !== this.figureId) {
|
|
18643
18633
|
return;
|
|
18644
18634
|
}
|
|
18645
18635
|
const definition = {
|
|
@@ -18648,8 +18638,8 @@
|
|
|
18648
18638
|
};
|
|
18649
18639
|
return this.env.model.dispatch("UPDATE_CHART", {
|
|
18650
18640
|
definition,
|
|
18651
|
-
id:
|
|
18652
|
-
sheetId: this.
|
|
18641
|
+
id: figureId,
|
|
18642
|
+
sheetId: this.env.model.getters.getFigureSheetId(figureId),
|
|
18653
18643
|
});
|
|
18654
18644
|
}
|
|
18655
18645
|
onTypeChange(type) {
|
|
@@ -18661,7 +18651,7 @@
|
|
|
18661
18651
|
this.env.model.dispatch("UPDATE_CHART", {
|
|
18662
18652
|
definition,
|
|
18663
18653
|
id: this.figureId,
|
|
18664
|
-
sheetId: this.
|
|
18654
|
+
sheetId: this.env.model.getters.getFigureSheetId(this.figureId),
|
|
18665
18655
|
});
|
|
18666
18656
|
}
|
|
18667
18657
|
get chartPanel() {
|
|
@@ -24482,6 +24472,16 @@
|
|
|
24482
24472
|
63: "333333",
|
|
24483
24473
|
64: "000000",
|
|
24484
24474
|
65: "FFFFFF", // system background
|
|
24475
|
+
};
|
|
24476
|
+
const IMAGE_MIMETYPE_EXTENSION_MAPPING = {
|
|
24477
|
+
"image/avif": "avif",
|
|
24478
|
+
"image/bmp": "bmp",
|
|
24479
|
+
"image/gif": "gif",
|
|
24480
|
+
"image/vnd.microsoft.icon": "ico",
|
|
24481
|
+
"image/jpeg": "jpeg",
|
|
24482
|
+
"image/png": "png",
|
|
24483
|
+
"image/tiff": "tiff",
|
|
24484
|
+
"image/webp": "webp",
|
|
24485
24485
|
};
|
|
24486
24486
|
|
|
24487
24487
|
/**
|
|
@@ -26963,6 +26963,11 @@
|
|
|
26963
26963
|
<Override ContentType="${contentType}" PartName="${partName}" />
|
|
26964
26964
|
`;
|
|
26965
26965
|
}
|
|
26966
|
+
function createDefaultXMLElement(extension, contentType) {
|
|
26967
|
+
return escapeXml /*xml*/ `
|
|
26968
|
+
<Default Extension="${extension}" ContentType="${contentType}" />
|
|
26969
|
+
`;
|
|
26970
|
+
}
|
|
26966
26971
|
function joinXmlNodes(xmlNodes) {
|
|
26967
26972
|
return new XMLString(xmlNodes.join("\n"));
|
|
26968
26973
|
}
|
|
@@ -41730,7 +41735,7 @@
|
|
|
41730
41735
|
const file = await this.getImageFromUser();
|
|
41731
41736
|
const path = await this.fileStore.upload(file);
|
|
41732
41737
|
const size = await this.getImageSize(path);
|
|
41733
|
-
return { path, size };
|
|
41738
|
+
return { path, size, mimetype: file.type };
|
|
41734
41739
|
}
|
|
41735
41740
|
getImageFromUser() {
|
|
41736
41741
|
return new Promise((resolve, reject) => {
|
|
@@ -46811,8 +46816,7 @@
|
|
|
46811
46816
|
// Figures and Charts
|
|
46812
46817
|
let drawingNode = escapeXml ``;
|
|
46813
46818
|
const drawingRelIds = [];
|
|
46814
|
-
const
|
|
46815
|
-
for (const chart of charts) {
|
|
46819
|
+
for (const chart of sheet.charts) {
|
|
46816
46820
|
const xlsxChartId = convertChartId(chart.id);
|
|
46817
46821
|
const chartRelId = addRelsToFile(construct.relsFiles, `xl/drawings/_rels/drawing${sheetIndex}.xml.rels`, {
|
|
46818
46822
|
target: `../charts/chart${xlsxChartId}.xml`,
|
|
@@ -46821,20 +46825,27 @@
|
|
|
46821
46825
|
drawingRelIds.push(chartRelId);
|
|
46822
46826
|
files.push(createXMLFile(createChart(chart, sheetIndex, data), `xl/charts/chart${xlsxChartId}.xml`, "chart"));
|
|
46823
46827
|
}
|
|
46824
|
-
const
|
|
46825
|
-
|
|
46828
|
+
for (const image of sheet.images) {
|
|
46829
|
+
const mimeType = image.data.mimetype;
|
|
46830
|
+
if (mimeType === undefined)
|
|
46831
|
+
continue;
|
|
46832
|
+
const extension = IMAGE_MIMETYPE_EXTENSION_MAPPING[mimeType];
|
|
46833
|
+
// only support exporting images with mimetypes specified in the mapping
|
|
46834
|
+
if (extension === undefined)
|
|
46835
|
+
continue;
|
|
46826
46836
|
const xlsxImageId = convertImageId(image.id);
|
|
46837
|
+
let imageFileName = `image${xlsxImageId}.${extension}`;
|
|
46827
46838
|
const imageRelId = addRelsToFile(construct.relsFiles, `xl/drawings/_rels/drawing${sheetIndex}.xml.rels`, {
|
|
46828
|
-
target: `../media
|
|
46839
|
+
target: `../media/${imageFileName}`,
|
|
46829
46840
|
type: XLSX_RELATION_TYPE.image,
|
|
46830
46841
|
});
|
|
46831
46842
|
drawingRelIds.push(imageRelId);
|
|
46832
46843
|
files.push({
|
|
46833
|
-
path: `xl/media
|
|
46834
|
-
|
|
46844
|
+
path: `xl/media/${imageFileName}`,
|
|
46845
|
+
imageSrc: image.data.path,
|
|
46835
46846
|
});
|
|
46836
46847
|
}
|
|
46837
|
-
const drawings = [...charts, ...images];
|
|
46848
|
+
const drawings = [...sheet.charts, ...sheet.images];
|
|
46838
46849
|
if (drawings.length) {
|
|
46839
46850
|
const drawingRelId = addRelsToFile(construct.relsFiles, `xl/worksheets/_rels/sheet${sheetIndex}.xml.rels`, {
|
|
46840
46851
|
target: `../drawings/drawing${sheetIndex}.xml`,
|
|
@@ -46953,6 +46964,8 @@
|
|
|
46953
46964
|
}
|
|
46954
46965
|
function createContentTypes(files) {
|
|
46955
46966
|
const overrideNodes = [];
|
|
46967
|
+
// hard-code supported image mimetypes
|
|
46968
|
+
const imageDefaultNodes = Object.entries(IMAGE_MIMETYPE_EXTENSION_MAPPING).map(([mimetype, extension]) => createDefaultXMLElement(extension, mimetype));
|
|
46956
46969
|
for (const file of files) {
|
|
46957
46970
|
if ("contentType" in file && file.contentType) {
|
|
46958
46971
|
overrideNodes.push(createOverride("/" + file.path, CONTENT_TYPES[file.contentType]));
|
|
@@ -46968,6 +46981,7 @@
|
|
|
46968
46981
|
];
|
|
46969
46982
|
const xml = escapeXml /*xml*/ `
|
|
46970
46983
|
<Types xmlns="${NAMESPACE["Types"]}">
|
|
46984
|
+
${joinXmlNodes(Object.values(imageDefaultNodes))}
|
|
46971
46985
|
<Default ${formatAttributes(relsAttributes)} />
|
|
46972
46986
|
<Default ${formatAttributes(xmlAttributes)} />
|
|
46973
46987
|
${joinXmlNodes(overrideNodes)}
|
|
@@ -47582,9 +47596,9 @@
|
|
|
47582
47596
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
47583
47597
|
|
|
47584
47598
|
|
|
47585
|
-
__info__.version = '16.3.
|
|
47586
|
-
__info__.date = '2023-
|
|
47587
|
-
__info__.hash = '
|
|
47599
|
+
__info__.version = '16.3.2';
|
|
47600
|
+
__info__.date = '2023-06-02T10:13:46.734Z';
|
|
47601
|
+
__info__.hash = '69a4378';
|
|
47588
47602
|
|
|
47589
47603
|
|
|
47590
47604
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|