@odoo/o-spreadsheet 16.2.7 → 16.2.8
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 -54
- package/dist/o-spreadsheet.d.ts +9 -10
- package/dist/o-spreadsheet.esm.js +65 -54
- package/dist/o-spreadsheet.iife.js +65 -54
- package/dist/o-spreadsheet.iife.min.js +259 -256
- package/package.json +1 -1
|
@@ -16859,7 +16859,7 @@ class LineBarPieConfigPanel extends Component {
|
|
|
16859
16859
|
return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(33 /* CommandResult.InvalidLabelRange */));
|
|
16860
16860
|
}
|
|
16861
16861
|
onUpdateDataSetsHaveTitle(ev) {
|
|
16862
|
-
this.props.updateChart({
|
|
16862
|
+
this.props.updateChart(this.props.figureId, {
|
|
16863
16863
|
dataSetsHaveTitle: ev.target.checked,
|
|
16864
16864
|
});
|
|
16865
16865
|
}
|
|
@@ -16871,7 +16871,7 @@ class LineBarPieConfigPanel extends Component {
|
|
|
16871
16871
|
this.dataSeriesRanges = ranges;
|
|
16872
16872
|
}
|
|
16873
16873
|
onDataSeriesConfirmed() {
|
|
16874
|
-
this.state.datasetDispatchResult = this.props.updateChart({
|
|
16874
|
+
this.state.datasetDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
16875
16875
|
dataSets: this.dataSeriesRanges,
|
|
16876
16876
|
});
|
|
16877
16877
|
}
|
|
@@ -16883,12 +16883,12 @@ class LineBarPieConfigPanel extends Component {
|
|
|
16883
16883
|
this.labelRange = ranges[0];
|
|
16884
16884
|
}
|
|
16885
16885
|
onLabelRangeConfirmed() {
|
|
16886
|
-
this.state.labelsDispatchResult = this.props.updateChart({
|
|
16886
|
+
this.state.labelsDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
16887
16887
|
labelRange: this.labelRange,
|
|
16888
16888
|
});
|
|
16889
16889
|
}
|
|
16890
16890
|
onUpdateAggregated(ev) {
|
|
16891
|
-
this.props.updateChart({
|
|
16891
|
+
this.props.updateChart(this.props.figureId, {
|
|
16892
16892
|
aggregated: ev.target.checked,
|
|
16893
16893
|
});
|
|
16894
16894
|
}
|
|
@@ -16903,12 +16903,12 @@ LineBarPieConfigPanel.props = {
|
|
|
16903
16903
|
|
|
16904
16904
|
class BarConfigPanel extends LineBarPieConfigPanel {
|
|
16905
16905
|
onUpdateStacked(ev) {
|
|
16906
|
-
this.props.updateChart({
|
|
16906
|
+
this.props.updateChart(this.props.figureId, {
|
|
16907
16907
|
stacked: ev.target.checked,
|
|
16908
16908
|
});
|
|
16909
16909
|
}
|
|
16910
16910
|
onUpdateAggregated(ev) {
|
|
16911
|
-
this.props.updateChart({
|
|
16911
|
+
this.props.updateChart(this.props.figureId, {
|
|
16912
16912
|
aggregated: ev.target.checked,
|
|
16913
16913
|
});
|
|
16914
16914
|
}
|
|
@@ -17251,17 +17251,17 @@ class LineBarPieDesignPanel extends Component {
|
|
|
17251
17251
|
this.state.fillColorTool = !this.state.fillColorTool;
|
|
17252
17252
|
}
|
|
17253
17253
|
updateBackgroundColor(color) {
|
|
17254
|
-
this.props.updateChart({
|
|
17254
|
+
this.props.updateChart(this.props.figureId, {
|
|
17255
17255
|
background: color,
|
|
17256
17256
|
});
|
|
17257
17257
|
}
|
|
17258
17258
|
updateTitle(ev) {
|
|
17259
|
-
this.props.updateChart({
|
|
17259
|
+
this.props.updateChart(this.props.figureId, {
|
|
17260
17260
|
title: ev.target.value,
|
|
17261
17261
|
});
|
|
17262
17262
|
}
|
|
17263
17263
|
updateSelect(attr, ev) {
|
|
17264
|
-
this.props.updateChart({
|
|
17264
|
+
this.props.updateChart(this.props.figureId, {
|
|
17265
17265
|
[attr]: ev.target.value,
|
|
17266
17266
|
});
|
|
17267
17267
|
}
|
|
@@ -17299,7 +17299,7 @@ class GaugeChartConfigPanel extends Component {
|
|
|
17299
17299
|
this.dataRange = ranges[0];
|
|
17300
17300
|
}
|
|
17301
17301
|
updateDataRange() {
|
|
17302
|
-
this.state.dataRangeDispatchResult = this.props.updateChart({
|
|
17302
|
+
this.state.dataRangeDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
17303
17303
|
dataRange: this.dataRange,
|
|
17304
17304
|
});
|
|
17305
17305
|
}
|
|
@@ -17361,12 +17361,12 @@ class GaugeChartDesignPanel extends Component {
|
|
|
17361
17361
|
}
|
|
17362
17362
|
updateBackgroundColor(color) {
|
|
17363
17363
|
this.state.openedMenu = undefined;
|
|
17364
|
-
this.props.updateChart({
|
|
17364
|
+
this.props.updateChart(this.props.figureId, {
|
|
17365
17365
|
background: color,
|
|
17366
17366
|
});
|
|
17367
17367
|
}
|
|
17368
17368
|
updateTitle(ev) {
|
|
17369
|
-
this.props.updateChart({
|
|
17369
|
+
this.props.updateChart(this.props.figureId, {
|
|
17370
17370
|
title: ev.target.value,
|
|
17371
17371
|
});
|
|
17372
17372
|
}
|
|
@@ -17435,7 +17435,7 @@ class GaugeChartDesignPanel extends Component {
|
|
|
17435
17435
|
}
|
|
17436
17436
|
}
|
|
17437
17437
|
updateSectionRule(sectionRule) {
|
|
17438
|
-
this.state.sectionRuleDispatchResult = this.props.updateChart({
|
|
17438
|
+
this.state.sectionRuleDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
17439
17439
|
sectionRule,
|
|
17440
17440
|
});
|
|
17441
17441
|
}
|
|
@@ -17460,17 +17460,17 @@ class LineConfigPanel extends LineBarPieConfigPanel {
|
|
|
17460
17460
|
return false;
|
|
17461
17461
|
}
|
|
17462
17462
|
onUpdateLabelsAsText(ev) {
|
|
17463
|
-
this.props.updateChart({
|
|
17463
|
+
this.props.updateChart(this.props.figureId, {
|
|
17464
17464
|
labelsAsText: ev.target.checked,
|
|
17465
17465
|
});
|
|
17466
17466
|
}
|
|
17467
17467
|
onUpdateStacked(ev) {
|
|
17468
|
-
this.props.updateChart({
|
|
17468
|
+
this.props.updateChart(this.props.figureId, {
|
|
17469
17469
|
stacked: ev.target.checked,
|
|
17470
17470
|
});
|
|
17471
17471
|
}
|
|
17472
17472
|
onUpdateAggregated(ev) {
|
|
17473
|
-
this.props.updateChart({
|
|
17473
|
+
this.props.updateChart(this.props.figureId, {
|
|
17474
17474
|
aggregated: ev.target.checked,
|
|
17475
17475
|
});
|
|
17476
17476
|
}
|
|
@@ -17511,7 +17511,7 @@ class ScorecardChartConfigPanel extends Component {
|
|
|
17511
17511
|
this.keyValue = ranges[0];
|
|
17512
17512
|
}
|
|
17513
17513
|
updateKeyValueRange() {
|
|
17514
|
-
this.state.keyValueDispatchResult = this.props.updateChart({
|
|
17514
|
+
this.state.keyValueDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
17515
17515
|
keyValue: this.keyValue,
|
|
17516
17516
|
});
|
|
17517
17517
|
}
|
|
@@ -17519,12 +17519,12 @@ class ScorecardChartConfigPanel extends Component {
|
|
|
17519
17519
|
this.baseline = ranges[0];
|
|
17520
17520
|
}
|
|
17521
17521
|
updateBaselineRange() {
|
|
17522
|
-
this.state.baselineDispatchResult = this.props.updateChart({
|
|
17522
|
+
this.state.baselineDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
17523
17523
|
baseline: this.baseline,
|
|
17524
17524
|
});
|
|
17525
17525
|
}
|
|
17526
17526
|
updateBaselineMode(ev) {
|
|
17527
|
-
this.props.updateChart({ baselineMode: ev.target.value });
|
|
17527
|
+
this.props.updateChart(this.props.figureId, { baselineMode: ev.target.value });
|
|
17528
17528
|
}
|
|
17529
17529
|
}
|
|
17530
17530
|
ScorecardChartConfigPanel.template = "o-spreadsheet-ScorecardChartConfigPanel";
|
|
@@ -17546,12 +17546,12 @@ class ScorecardChartDesignPanel extends Component {
|
|
|
17546
17546
|
useExternalListener(window, "click", this.closeMenus);
|
|
17547
17547
|
}
|
|
17548
17548
|
updateTitle(ev) {
|
|
17549
|
-
this.props.updateChart({
|
|
17549
|
+
this.props.updateChart(this.props.figureId, {
|
|
17550
17550
|
title: ev.target.value,
|
|
17551
17551
|
});
|
|
17552
17552
|
}
|
|
17553
17553
|
updateBaselineDescr(ev) {
|
|
17554
|
-
this.props.updateChart({ baselineDescr: ev.target.value });
|
|
17554
|
+
this.props.updateChart(this.props.figureId, { baselineDescr: ev.target.value });
|
|
17555
17555
|
}
|
|
17556
17556
|
toggleColorPicker(colorPickerId) {
|
|
17557
17557
|
if (this.state.openedColorPicker === colorPickerId) {
|
|
@@ -17564,13 +17564,13 @@ class ScorecardChartDesignPanel extends Component {
|
|
|
17564
17564
|
setColor(color, colorPickerId) {
|
|
17565
17565
|
switch (colorPickerId) {
|
|
17566
17566
|
case "backgroundColor":
|
|
17567
|
-
this.props.updateChart({ background: color });
|
|
17567
|
+
this.props.updateChart(this.props.figureId, { background: color });
|
|
17568
17568
|
break;
|
|
17569
17569
|
case "baselineColorDown":
|
|
17570
|
-
this.props.updateChart({ baselineColorDown: color });
|
|
17570
|
+
this.props.updateChart(this.props.figureId, { baselineColorDown: color });
|
|
17571
17571
|
break;
|
|
17572
17572
|
case "baselineColorUp":
|
|
17573
|
-
this.props.updateChart({ baselineColorUp: color });
|
|
17573
|
+
this.props.updateChart(this.props.figureId, { baselineColorUp: color });
|
|
17574
17574
|
break;
|
|
17575
17575
|
}
|
|
17576
17576
|
this.closeMenus();
|
|
@@ -17635,16 +17635,9 @@ css /* scss */ `
|
|
|
17635
17635
|
}
|
|
17636
17636
|
`;
|
|
17637
17637
|
class ChartPanel extends Component {
|
|
17638
|
-
constructor() {
|
|
17639
|
-
super(...arguments);
|
|
17640
|
-
this.shouldUpdateChart = true;
|
|
17641
|
-
}
|
|
17642
17638
|
get figureId() {
|
|
17643
17639
|
return this.state.figureId;
|
|
17644
17640
|
}
|
|
17645
|
-
get sheetId() {
|
|
17646
|
-
return this.state.sheetId;
|
|
17647
|
-
}
|
|
17648
17641
|
setup() {
|
|
17649
17642
|
const selectedFigureId = this.env.model.getters.getSelectedFigureId();
|
|
17650
17643
|
if (!selectedFigureId) {
|
|
@@ -17653,17 +17646,11 @@ class ChartPanel extends Component {
|
|
|
17653
17646
|
this.state = useState({
|
|
17654
17647
|
panel: "configuration",
|
|
17655
17648
|
figureId: selectedFigureId,
|
|
17656
|
-
sheetId: this.env.model.getters.getActiveSheetId(),
|
|
17657
17649
|
});
|
|
17658
17650
|
onWillUpdateProps(() => {
|
|
17659
17651
|
const selectedFigureId = this.env.model.getters.getSelectedFigureId();
|
|
17660
17652
|
if (selectedFigureId && selectedFigureId !== this.state.figureId) {
|
|
17661
17653
|
this.state.figureId = selectedFigureId;
|
|
17662
|
-
this.state.sheetId = this.env.model.getters.getActiveSheetId();
|
|
17663
|
-
this.shouldUpdateChart = false;
|
|
17664
|
-
}
|
|
17665
|
-
else {
|
|
17666
|
-
this.shouldUpdateChart = true;
|
|
17667
17654
|
}
|
|
17668
17655
|
if (!this.env.model.getters.isChartDefined(this.figureId)) {
|
|
17669
17656
|
this.props.onCloseSidePanel();
|
|
@@ -17671,8 +17658,8 @@ class ChartPanel extends Component {
|
|
|
17671
17658
|
}
|
|
17672
17659
|
});
|
|
17673
17660
|
}
|
|
17674
|
-
updateChart(updateDefinition) {
|
|
17675
|
-
if (
|
|
17661
|
+
updateChart(figureId, updateDefinition) {
|
|
17662
|
+
if (figureId !== this.figureId) {
|
|
17676
17663
|
return;
|
|
17677
17664
|
}
|
|
17678
17665
|
const definition = {
|
|
@@ -17681,8 +17668,8 @@ class ChartPanel extends Component {
|
|
|
17681
17668
|
};
|
|
17682
17669
|
return this.env.model.dispatch("UPDATE_CHART", {
|
|
17683
17670
|
definition,
|
|
17684
|
-
id:
|
|
17685
|
-
sheetId: this.
|
|
17671
|
+
id: figureId,
|
|
17672
|
+
sheetId: this.env.model.getters.getFigureSheetId(figureId),
|
|
17686
17673
|
});
|
|
17687
17674
|
}
|
|
17688
17675
|
onTypeChange(type) {
|
|
@@ -17694,7 +17681,7 @@ class ChartPanel extends Component {
|
|
|
17694
17681
|
this.env.model.dispatch("UPDATE_CHART", {
|
|
17695
17682
|
definition,
|
|
17696
17683
|
id: this.figureId,
|
|
17697
|
-
sheetId: this.
|
|
17684
|
+
sheetId: this.env.model.getters.getFigureSheetId(this.figureId),
|
|
17698
17685
|
});
|
|
17699
17686
|
}
|
|
17700
17687
|
get chartPanel() {
|
|
@@ -23064,6 +23051,16 @@ const XLSX_INDEXED_COLORS = {
|
|
|
23064
23051
|
63: "333333",
|
|
23065
23052
|
64: "000000",
|
|
23066
23053
|
65: "FFFFFF", // system background
|
|
23054
|
+
};
|
|
23055
|
+
const IMAGE_MIMETYPE_EXTENSION_MAPPING = {
|
|
23056
|
+
"image/avif": "avif",
|
|
23057
|
+
"image/bmp": "bmp",
|
|
23058
|
+
"image/gif": "gif",
|
|
23059
|
+
"image/vnd.microsoft.icon": "ico",
|
|
23060
|
+
"image/jpeg": "jpeg",
|
|
23061
|
+
"image/png": "png",
|
|
23062
|
+
"image/tiff": "tiff",
|
|
23063
|
+
"image/webp": "webp",
|
|
23067
23064
|
};
|
|
23068
23065
|
|
|
23069
23066
|
/**
|
|
@@ -25500,6 +25497,11 @@ function createOverride(partName, contentType) {
|
|
|
25500
25497
|
<Override ContentType="${contentType}" PartName="${partName}" />
|
|
25501
25498
|
`;
|
|
25502
25499
|
}
|
|
25500
|
+
function createDefaultXMLElement(extension, contentType) {
|
|
25501
|
+
return escapeXml /*xml*/ `
|
|
25502
|
+
<Default Extension="${extension}" ContentType="${contentType}" />
|
|
25503
|
+
`;
|
|
25504
|
+
}
|
|
25503
25505
|
function joinXmlNodes(xmlNodes) {
|
|
25504
25506
|
return new XMLString(xmlNodes.join("\n"));
|
|
25505
25507
|
}
|
|
@@ -39561,7 +39563,7 @@ class ImageProvider {
|
|
|
39561
39563
|
const file = await this.getImageFromUser();
|
|
39562
39564
|
const path = await this.fileStore.upload(file);
|
|
39563
39565
|
const size = await this.getImageSize(path);
|
|
39564
|
-
return { path, size };
|
|
39566
|
+
return { path, size, mimetype: file.type };
|
|
39565
39567
|
}
|
|
39566
39568
|
getImageFromUser() {
|
|
39567
39569
|
return new Promise((resolve, reject) => {
|
|
@@ -44627,8 +44629,7 @@ function createWorksheets(data, construct) {
|
|
|
44627
44629
|
// Figures and Charts
|
|
44628
44630
|
let drawingNode = escapeXml ``;
|
|
44629
44631
|
const drawingRelIds = [];
|
|
44630
|
-
const
|
|
44631
|
-
for (const chart of charts) {
|
|
44632
|
+
for (const chart of sheet.charts) {
|
|
44632
44633
|
const xlsxChartId = convertChartId(chart.id);
|
|
44633
44634
|
const chartRelId = addRelsToFile(construct.relsFiles, `xl/drawings/_rels/drawing${sheetIndex}.xml.rels`, {
|
|
44634
44635
|
target: `../charts/chart${xlsxChartId}.xml`,
|
|
@@ -44637,20 +44638,27 @@ function createWorksheets(data, construct) {
|
|
|
44637
44638
|
drawingRelIds.push(chartRelId);
|
|
44638
44639
|
files.push(createXMLFile(createChart(chart, sheetIndex, data), `xl/charts/chart${xlsxChartId}.xml`, "chart"));
|
|
44639
44640
|
}
|
|
44640
|
-
const
|
|
44641
|
-
|
|
44641
|
+
for (const image of sheet.images) {
|
|
44642
|
+
const mimeType = image.data.mimetype;
|
|
44643
|
+
if (mimeType === undefined)
|
|
44644
|
+
continue;
|
|
44645
|
+
const extension = IMAGE_MIMETYPE_EXTENSION_MAPPING[mimeType];
|
|
44646
|
+
// only support exporting images with mimetypes specified in the mapping
|
|
44647
|
+
if (extension === undefined)
|
|
44648
|
+
continue;
|
|
44642
44649
|
const xlsxImageId = convertImageId(image.id);
|
|
44650
|
+
let imageFileName = `image${xlsxImageId}.${extension}`;
|
|
44643
44651
|
const imageRelId = addRelsToFile(construct.relsFiles, `xl/drawings/_rels/drawing${sheetIndex}.xml.rels`, {
|
|
44644
|
-
target: `../media
|
|
44652
|
+
target: `../media/${imageFileName}`,
|
|
44645
44653
|
type: XLSX_RELATION_TYPE.image,
|
|
44646
44654
|
});
|
|
44647
44655
|
drawingRelIds.push(imageRelId);
|
|
44648
44656
|
files.push({
|
|
44649
|
-
path: `xl/media
|
|
44650
|
-
|
|
44657
|
+
path: `xl/media/${imageFileName}`,
|
|
44658
|
+
imageSrc: image.data.path,
|
|
44651
44659
|
});
|
|
44652
44660
|
}
|
|
44653
|
-
const drawings = [...charts, ...images];
|
|
44661
|
+
const drawings = [...sheet.charts, ...sheet.images];
|
|
44654
44662
|
if (drawings.length) {
|
|
44655
44663
|
const drawingRelId = addRelsToFile(construct.relsFiles, `xl/worksheets/_rels/sheet${sheetIndex}.xml.rels`, {
|
|
44656
44664
|
target: `../drawings/drawing${sheetIndex}.xml`,
|
|
@@ -44769,6 +44777,8 @@ function createRelsFiles(relsFiles) {
|
|
|
44769
44777
|
}
|
|
44770
44778
|
function createContentTypes(files) {
|
|
44771
44779
|
const overrideNodes = [];
|
|
44780
|
+
// hard-code supported image mimetypes
|
|
44781
|
+
const imageDefaultNodes = Object.entries(IMAGE_MIMETYPE_EXTENSION_MAPPING).map(([mimetype, extension]) => createDefaultXMLElement(extension, mimetype));
|
|
44772
44782
|
for (const file of files) {
|
|
44773
44783
|
if ("contentType" in file && file.contentType) {
|
|
44774
44784
|
overrideNodes.push(createOverride("/" + file.path, CONTENT_TYPES[file.contentType]));
|
|
@@ -44776,6 +44786,7 @@ function createContentTypes(files) {
|
|
|
44776
44786
|
}
|
|
44777
44787
|
const xml = escapeXml /*xml*/ `
|
|
44778
44788
|
<Types xmlns="${NAMESPACE["Types"]}">
|
|
44789
|
+
${joinXmlNodes(Object.values(imageDefaultNodes))}
|
|
44779
44790
|
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
|
|
44780
44791
|
<Default Extension="xml" ContentType="application/xml" />
|
|
44781
44792
|
${joinXmlNodes(overrideNodes)}
|
|
@@ -45307,6 +45318,6 @@ function addFunction(functionName, functionDescription) {
|
|
|
45307
45318
|
export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, links, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
|
|
45308
45319
|
|
|
45309
45320
|
|
|
45310
|
-
__info__.version = '16.2.
|
|
45311
|
-
__info__.date = '2023-
|
|
45312
|
-
__info__.hash = '
|
|
45321
|
+
__info__.version = '16.2.8';
|
|
45322
|
+
__info__.date = '2023-06-02T10:12:43.068Z';
|
|
45323
|
+
__info__.hash = 'b474e62';
|