@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
|
@@ -17840,7 +17840,7 @@ class LineBarPieConfigPanel extends Component {
|
|
|
17840
17840
|
return !!this.state.labelsDispatchResult?.isCancelledBecause(33 /* CommandResult.InvalidLabelRange */);
|
|
17841
17841
|
}
|
|
17842
17842
|
onUpdateDataSetsHaveTitle(ev) {
|
|
17843
|
-
this.props.updateChart({
|
|
17843
|
+
this.props.updateChart(this.props.figureId, {
|
|
17844
17844
|
dataSetsHaveTitle: ev.target.checked,
|
|
17845
17845
|
});
|
|
17846
17846
|
}
|
|
@@ -17852,7 +17852,7 @@ class LineBarPieConfigPanel extends Component {
|
|
|
17852
17852
|
this.dataSeriesRanges = ranges;
|
|
17853
17853
|
}
|
|
17854
17854
|
onDataSeriesConfirmed() {
|
|
17855
|
-
this.state.datasetDispatchResult = this.props.updateChart({
|
|
17855
|
+
this.state.datasetDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
17856
17856
|
dataSets: this.dataSeriesRanges,
|
|
17857
17857
|
});
|
|
17858
17858
|
}
|
|
@@ -17864,12 +17864,12 @@ class LineBarPieConfigPanel extends Component {
|
|
|
17864
17864
|
this.labelRange = ranges[0];
|
|
17865
17865
|
}
|
|
17866
17866
|
onLabelRangeConfirmed() {
|
|
17867
|
-
this.state.labelsDispatchResult = this.props.updateChart({
|
|
17867
|
+
this.state.labelsDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
17868
17868
|
labelRange: this.labelRange,
|
|
17869
17869
|
});
|
|
17870
17870
|
}
|
|
17871
17871
|
onUpdateAggregated(ev) {
|
|
17872
|
-
this.props.updateChart({
|
|
17872
|
+
this.props.updateChart(this.props.figureId, {
|
|
17873
17873
|
aggregated: ev.target.checked,
|
|
17874
17874
|
});
|
|
17875
17875
|
}
|
|
@@ -17899,12 +17899,12 @@ LineBarPieConfigPanel.props = {
|
|
|
17899
17899
|
class BarConfigPanel extends LineBarPieConfigPanel {
|
|
17900
17900
|
static template = "o-spreadsheet-BarConfigPanel";
|
|
17901
17901
|
onUpdateStacked(ev) {
|
|
17902
|
-
this.props.updateChart({
|
|
17902
|
+
this.props.updateChart(this.props.figureId, {
|
|
17903
17903
|
stacked: ev.target.checked,
|
|
17904
17904
|
});
|
|
17905
17905
|
}
|
|
17906
17906
|
onUpdateAggregated(ev) {
|
|
17907
|
-
this.props.updateChart({
|
|
17907
|
+
this.props.updateChart(this.props.figureId, {
|
|
17908
17908
|
aggregated: ev.target.checked,
|
|
17909
17909
|
});
|
|
17910
17910
|
}
|
|
@@ -18241,17 +18241,17 @@ class LineBarPieDesignPanel extends Component {
|
|
|
18241
18241
|
this.state.fillColorTool = !this.state.fillColorTool;
|
|
18242
18242
|
}
|
|
18243
18243
|
updateBackgroundColor(color) {
|
|
18244
|
-
this.props.updateChart({
|
|
18244
|
+
this.props.updateChart(this.props.figureId, {
|
|
18245
18245
|
background: color,
|
|
18246
18246
|
});
|
|
18247
18247
|
}
|
|
18248
18248
|
updateTitle(ev) {
|
|
18249
|
-
this.props.updateChart({
|
|
18249
|
+
this.props.updateChart(this.props.figureId, {
|
|
18250
18250
|
title: ev.target.value,
|
|
18251
18251
|
});
|
|
18252
18252
|
}
|
|
18253
18253
|
updateSelect(attr, ev) {
|
|
18254
|
-
this.props.updateChart({
|
|
18254
|
+
this.props.updateChart(this.props.figureId, {
|
|
18255
18255
|
[attr]: ev.target.value,
|
|
18256
18256
|
});
|
|
18257
18257
|
}
|
|
@@ -18284,7 +18284,7 @@ class GaugeChartConfigPanel extends Component {
|
|
|
18284
18284
|
this.dataRange = ranges[0];
|
|
18285
18285
|
}
|
|
18286
18286
|
updateDataRange() {
|
|
18287
|
-
this.state.dataRangeDispatchResult = this.props.updateChart({
|
|
18287
|
+
this.state.dataRangeDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
18288
18288
|
dataRange: this.dataRange,
|
|
18289
18289
|
});
|
|
18290
18290
|
}
|
|
@@ -18342,12 +18342,12 @@ class GaugeChartDesignPanel extends Component {
|
|
|
18342
18342
|
}
|
|
18343
18343
|
updateBackgroundColor(color) {
|
|
18344
18344
|
this.state.openedMenu = undefined;
|
|
18345
|
-
this.props.updateChart({
|
|
18345
|
+
this.props.updateChart(this.props.figureId, {
|
|
18346
18346
|
background: color,
|
|
18347
18347
|
});
|
|
18348
18348
|
}
|
|
18349
18349
|
updateTitle(ev) {
|
|
18350
|
-
this.props.updateChart({
|
|
18350
|
+
this.props.updateChart(this.props.figureId, {
|
|
18351
18351
|
title: ev.target.value,
|
|
18352
18352
|
});
|
|
18353
18353
|
}
|
|
@@ -18412,7 +18412,7 @@ class GaugeChartDesignPanel extends Component {
|
|
|
18412
18412
|
}
|
|
18413
18413
|
}
|
|
18414
18414
|
updateSectionRule(sectionRule) {
|
|
18415
|
-
this.state.sectionRuleDispatchResult = this.props.updateChart({
|
|
18415
|
+
this.state.sectionRuleDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
18416
18416
|
sectionRule,
|
|
18417
18417
|
});
|
|
18418
18418
|
}
|
|
@@ -18436,17 +18436,17 @@ class LineConfigPanel extends LineBarPieConfigPanel {
|
|
|
18436
18436
|
return false;
|
|
18437
18437
|
}
|
|
18438
18438
|
onUpdateLabelsAsText(ev) {
|
|
18439
|
-
this.props.updateChart({
|
|
18439
|
+
this.props.updateChart(this.props.figureId, {
|
|
18440
18440
|
labelsAsText: ev.target.checked,
|
|
18441
18441
|
});
|
|
18442
18442
|
}
|
|
18443
18443
|
onUpdateStacked(ev) {
|
|
18444
|
-
this.props.updateChart({
|
|
18444
|
+
this.props.updateChart(this.props.figureId, {
|
|
18445
18445
|
stacked: ev.target.checked,
|
|
18446
18446
|
});
|
|
18447
18447
|
}
|
|
18448
18448
|
onUpdateAggregated(ev) {
|
|
18449
|
-
this.props.updateChart({
|
|
18449
|
+
this.props.updateChart(this.props.figureId, {
|
|
18450
18450
|
aggregated: ev.target.checked,
|
|
18451
18451
|
});
|
|
18452
18452
|
}
|
|
@@ -18482,7 +18482,7 @@ class ScorecardChartConfigPanel extends Component {
|
|
|
18482
18482
|
this.keyValue = ranges[0];
|
|
18483
18483
|
}
|
|
18484
18484
|
updateKeyValueRange() {
|
|
18485
|
-
this.state.keyValueDispatchResult = this.props.updateChart({
|
|
18485
|
+
this.state.keyValueDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
18486
18486
|
keyValue: this.keyValue,
|
|
18487
18487
|
});
|
|
18488
18488
|
}
|
|
@@ -18490,12 +18490,12 @@ class ScorecardChartConfigPanel extends Component {
|
|
|
18490
18490
|
this.baseline = ranges[0];
|
|
18491
18491
|
}
|
|
18492
18492
|
updateBaselineRange() {
|
|
18493
|
-
this.state.baselineDispatchResult = this.props.updateChart({
|
|
18493
|
+
this.state.baselineDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
18494
18494
|
baseline: this.baseline,
|
|
18495
18495
|
});
|
|
18496
18496
|
}
|
|
18497
18497
|
updateBaselineMode(ev) {
|
|
18498
|
-
this.props.updateChart({ baselineMode: ev.target.value });
|
|
18498
|
+
this.props.updateChart(this.props.figureId, { baselineMode: ev.target.value });
|
|
18499
18499
|
}
|
|
18500
18500
|
}
|
|
18501
18501
|
ScorecardChartConfigPanel.props = {
|
|
@@ -18514,12 +18514,12 @@ class ScorecardChartDesignPanel extends Component {
|
|
|
18514
18514
|
useExternalListener(window, "click", this.closeMenus);
|
|
18515
18515
|
}
|
|
18516
18516
|
updateTitle(ev) {
|
|
18517
|
-
this.props.updateChart({
|
|
18517
|
+
this.props.updateChart(this.props.figureId, {
|
|
18518
18518
|
title: ev.target.value,
|
|
18519
18519
|
});
|
|
18520
18520
|
}
|
|
18521
18521
|
updateBaselineDescr(ev) {
|
|
18522
|
-
this.props.updateChart({ baselineDescr: ev.target.value });
|
|
18522
|
+
this.props.updateChart(this.props.figureId, { baselineDescr: ev.target.value });
|
|
18523
18523
|
}
|
|
18524
18524
|
toggleColorPicker(colorPickerId) {
|
|
18525
18525
|
if (this.state.openedColorPicker === colorPickerId) {
|
|
@@ -18532,13 +18532,13 @@ class ScorecardChartDesignPanel extends Component {
|
|
|
18532
18532
|
setColor(color, colorPickerId) {
|
|
18533
18533
|
switch (colorPickerId) {
|
|
18534
18534
|
case "backgroundColor":
|
|
18535
|
-
this.props.updateChart({ background: color });
|
|
18535
|
+
this.props.updateChart(this.props.figureId, { background: color });
|
|
18536
18536
|
break;
|
|
18537
18537
|
case "baselineColorDown":
|
|
18538
|
-
this.props.updateChart({ baselineColorDown: color });
|
|
18538
|
+
this.props.updateChart(this.props.figureId, { baselineColorDown: color });
|
|
18539
18539
|
break;
|
|
18540
18540
|
case "baselineColorUp":
|
|
18541
|
-
this.props.updateChart({ baselineColorUp: color });
|
|
18541
|
+
this.props.updateChart(this.props.figureId, { baselineColorUp: color });
|
|
18542
18542
|
break;
|
|
18543
18543
|
}
|
|
18544
18544
|
this.closeMenus();
|
|
@@ -18603,13 +18603,9 @@ css /* scss */ `
|
|
|
18603
18603
|
class ChartPanel extends Component {
|
|
18604
18604
|
static template = "o-spreadsheet-ChartPanel";
|
|
18605
18605
|
state;
|
|
18606
|
-
shouldUpdateChart = true;
|
|
18607
18606
|
get figureId() {
|
|
18608
18607
|
return this.state.figureId;
|
|
18609
18608
|
}
|
|
18610
|
-
get sheetId() {
|
|
18611
|
-
return this.state.sheetId;
|
|
18612
|
-
}
|
|
18613
18609
|
setup() {
|
|
18614
18610
|
const selectedFigureId = this.env.model.getters.getSelectedFigureId();
|
|
18615
18611
|
if (!selectedFigureId) {
|
|
@@ -18619,17 +18615,11 @@ class ChartPanel extends Component {
|
|
|
18619
18615
|
this.state = useState({
|
|
18620
18616
|
panel: "configuration",
|
|
18621
18617
|
figureId: selectedFigureId,
|
|
18622
|
-
sheetId: this.env.model.getters.getActiveSheetId(),
|
|
18623
18618
|
});
|
|
18624
18619
|
onWillUpdateProps(() => {
|
|
18625
18620
|
const selectedFigureId = this.env.model.getters.getSelectedFigureId();
|
|
18626
18621
|
if (selectedFigureId && selectedFigureId !== this.state.figureId) {
|
|
18627
18622
|
this.state.figureId = selectedFigureId;
|
|
18628
|
-
this.state.sheetId = this.env.model.getters.getActiveSheetId();
|
|
18629
|
-
this.shouldUpdateChart = false;
|
|
18630
|
-
}
|
|
18631
|
-
else {
|
|
18632
|
-
this.shouldUpdateChart = true;
|
|
18633
18623
|
}
|
|
18634
18624
|
if (!this.env.model.getters.isChartDefined(this.figureId)) {
|
|
18635
18625
|
this.props.onCloseSidePanel();
|
|
@@ -18637,8 +18627,8 @@ class ChartPanel extends Component {
|
|
|
18637
18627
|
}
|
|
18638
18628
|
});
|
|
18639
18629
|
}
|
|
18640
|
-
updateChart(updateDefinition) {
|
|
18641
|
-
if (
|
|
18630
|
+
updateChart(figureId, updateDefinition) {
|
|
18631
|
+
if (figureId !== this.figureId) {
|
|
18642
18632
|
return;
|
|
18643
18633
|
}
|
|
18644
18634
|
const definition = {
|
|
@@ -18647,8 +18637,8 @@ class ChartPanel extends Component {
|
|
|
18647
18637
|
};
|
|
18648
18638
|
return this.env.model.dispatch("UPDATE_CHART", {
|
|
18649
18639
|
definition,
|
|
18650
|
-
id:
|
|
18651
|
-
sheetId: this.
|
|
18640
|
+
id: figureId,
|
|
18641
|
+
sheetId: this.env.model.getters.getFigureSheetId(figureId),
|
|
18652
18642
|
});
|
|
18653
18643
|
}
|
|
18654
18644
|
onTypeChange(type) {
|
|
@@ -18660,7 +18650,7 @@ class ChartPanel extends Component {
|
|
|
18660
18650
|
this.env.model.dispatch("UPDATE_CHART", {
|
|
18661
18651
|
definition,
|
|
18662
18652
|
id: this.figureId,
|
|
18663
|
-
sheetId: this.
|
|
18653
|
+
sheetId: this.env.model.getters.getFigureSheetId(this.figureId),
|
|
18664
18654
|
});
|
|
18665
18655
|
}
|
|
18666
18656
|
get chartPanel() {
|
|
@@ -24481,6 +24471,16 @@ const XLSX_INDEXED_COLORS = {
|
|
|
24481
24471
|
63: "333333",
|
|
24482
24472
|
64: "000000",
|
|
24483
24473
|
65: "FFFFFF", // system background
|
|
24474
|
+
};
|
|
24475
|
+
const IMAGE_MIMETYPE_EXTENSION_MAPPING = {
|
|
24476
|
+
"image/avif": "avif",
|
|
24477
|
+
"image/bmp": "bmp",
|
|
24478
|
+
"image/gif": "gif",
|
|
24479
|
+
"image/vnd.microsoft.icon": "ico",
|
|
24480
|
+
"image/jpeg": "jpeg",
|
|
24481
|
+
"image/png": "png",
|
|
24482
|
+
"image/tiff": "tiff",
|
|
24483
|
+
"image/webp": "webp",
|
|
24484
24484
|
};
|
|
24485
24485
|
|
|
24486
24486
|
/**
|
|
@@ -26962,6 +26962,11 @@ function createOverride(partName, contentType) {
|
|
|
26962
26962
|
<Override ContentType="${contentType}" PartName="${partName}" />
|
|
26963
26963
|
`;
|
|
26964
26964
|
}
|
|
26965
|
+
function createDefaultXMLElement(extension, contentType) {
|
|
26966
|
+
return escapeXml /*xml*/ `
|
|
26967
|
+
<Default Extension="${extension}" ContentType="${contentType}" />
|
|
26968
|
+
`;
|
|
26969
|
+
}
|
|
26965
26970
|
function joinXmlNodes(xmlNodes) {
|
|
26966
26971
|
return new XMLString(xmlNodes.join("\n"));
|
|
26967
26972
|
}
|
|
@@ -41729,7 +41734,7 @@ class ImageProvider {
|
|
|
41729
41734
|
const file = await this.getImageFromUser();
|
|
41730
41735
|
const path = await this.fileStore.upload(file);
|
|
41731
41736
|
const size = await this.getImageSize(path);
|
|
41732
|
-
return { path, size };
|
|
41737
|
+
return { path, size, mimetype: file.type };
|
|
41733
41738
|
}
|
|
41734
41739
|
getImageFromUser() {
|
|
41735
41740
|
return new Promise((resolve, reject) => {
|
|
@@ -46810,8 +46815,7 @@ function createWorksheets(data, construct) {
|
|
|
46810
46815
|
// Figures and Charts
|
|
46811
46816
|
let drawingNode = escapeXml ``;
|
|
46812
46817
|
const drawingRelIds = [];
|
|
46813
|
-
const
|
|
46814
|
-
for (const chart of charts) {
|
|
46818
|
+
for (const chart of sheet.charts) {
|
|
46815
46819
|
const xlsxChartId = convertChartId(chart.id);
|
|
46816
46820
|
const chartRelId = addRelsToFile(construct.relsFiles, `xl/drawings/_rels/drawing${sheetIndex}.xml.rels`, {
|
|
46817
46821
|
target: `../charts/chart${xlsxChartId}.xml`,
|
|
@@ -46820,20 +46824,27 @@ function createWorksheets(data, construct) {
|
|
|
46820
46824
|
drawingRelIds.push(chartRelId);
|
|
46821
46825
|
files.push(createXMLFile(createChart(chart, sheetIndex, data), `xl/charts/chart${xlsxChartId}.xml`, "chart"));
|
|
46822
46826
|
}
|
|
46823
|
-
const
|
|
46824
|
-
|
|
46827
|
+
for (const image of sheet.images) {
|
|
46828
|
+
const mimeType = image.data.mimetype;
|
|
46829
|
+
if (mimeType === undefined)
|
|
46830
|
+
continue;
|
|
46831
|
+
const extension = IMAGE_MIMETYPE_EXTENSION_MAPPING[mimeType];
|
|
46832
|
+
// only support exporting images with mimetypes specified in the mapping
|
|
46833
|
+
if (extension === undefined)
|
|
46834
|
+
continue;
|
|
46825
46835
|
const xlsxImageId = convertImageId(image.id);
|
|
46836
|
+
let imageFileName = `image${xlsxImageId}.${extension}`;
|
|
46826
46837
|
const imageRelId = addRelsToFile(construct.relsFiles, `xl/drawings/_rels/drawing${sheetIndex}.xml.rels`, {
|
|
46827
|
-
target: `../media
|
|
46838
|
+
target: `../media/${imageFileName}`,
|
|
46828
46839
|
type: XLSX_RELATION_TYPE.image,
|
|
46829
46840
|
});
|
|
46830
46841
|
drawingRelIds.push(imageRelId);
|
|
46831
46842
|
files.push({
|
|
46832
|
-
path: `xl/media
|
|
46833
|
-
|
|
46843
|
+
path: `xl/media/${imageFileName}`,
|
|
46844
|
+
imageSrc: image.data.path,
|
|
46834
46845
|
});
|
|
46835
46846
|
}
|
|
46836
|
-
const drawings = [...charts, ...images];
|
|
46847
|
+
const drawings = [...sheet.charts, ...sheet.images];
|
|
46837
46848
|
if (drawings.length) {
|
|
46838
46849
|
const drawingRelId = addRelsToFile(construct.relsFiles, `xl/worksheets/_rels/sheet${sheetIndex}.xml.rels`, {
|
|
46839
46850
|
target: `../drawings/drawing${sheetIndex}.xml`,
|
|
@@ -46952,6 +46963,8 @@ function createRelsFiles(relsFiles) {
|
|
|
46952
46963
|
}
|
|
46953
46964
|
function createContentTypes(files) {
|
|
46954
46965
|
const overrideNodes = [];
|
|
46966
|
+
// hard-code supported image mimetypes
|
|
46967
|
+
const imageDefaultNodes = Object.entries(IMAGE_MIMETYPE_EXTENSION_MAPPING).map(([mimetype, extension]) => createDefaultXMLElement(extension, mimetype));
|
|
46955
46968
|
for (const file of files) {
|
|
46956
46969
|
if ("contentType" in file && file.contentType) {
|
|
46957
46970
|
overrideNodes.push(createOverride("/" + file.path, CONTENT_TYPES[file.contentType]));
|
|
@@ -46967,6 +46980,7 @@ function createContentTypes(files) {
|
|
|
46967
46980
|
];
|
|
46968
46981
|
const xml = escapeXml /*xml*/ `
|
|
46969
46982
|
<Types xmlns="${NAMESPACE["Types"]}">
|
|
46983
|
+
${joinXmlNodes(Object.values(imageDefaultNodes))}
|
|
46970
46984
|
<Default ${formatAttributes(relsAttributes)} />
|
|
46971
46985
|
<Default ${formatAttributes(xmlAttributes)} />
|
|
46972
46986
|
${joinXmlNodes(overrideNodes)}
|
|
@@ -47551,6 +47565,6 @@ function addFunction(functionName, functionDescription) {
|
|
|
47551
47565
|
export { AbstractChart, CommandResult, CorePlugin, 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, setDefaultSheetViewSize, setTranslationMethod, tokenize };
|
|
47552
47566
|
|
|
47553
47567
|
|
|
47554
|
-
__info__.version = '16.3.
|
|
47555
|
-
__info__.date = '2023-
|
|
47556
|
-
__info__.hash = '
|
|
47568
|
+
__info__.version = '16.3.2';
|
|
47569
|
+
__info__.date = '2023-06-02T10:13:46.734Z';
|
|
47570
|
+
__info__.hash = '69a4378';
|