@odoo/o-spreadsheet 16.2.7 → 16.2.9
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 +91 -62
- package/dist/o-spreadsheet.d.ts +10 -10
- package/dist/o-spreadsheet.esm.js +91 -62
- package/dist/o-spreadsheet.iife.js +91 -62
- package/dist/o-spreadsheet.iife.min.js +283 -279
- package/package.json +1 -1
|
@@ -1726,27 +1726,36 @@ function removeTrailingZeroes(numberString) {
|
|
|
1726
1726
|
}
|
|
1727
1727
|
return numberString.slice(0, i + 1) || undefined;
|
|
1728
1728
|
}
|
|
1729
|
+
const leadingZeroesRegexp = /^0+/;
|
|
1729
1730
|
/**
|
|
1730
1731
|
* Limit the size of the decimal part of a number to the given number of digits.
|
|
1731
1732
|
*/
|
|
1732
1733
|
function limitDecimalDigits(decimalDigits, maxDecimals) {
|
|
1734
|
+
var _a;
|
|
1733
1735
|
let integerDigits = "0";
|
|
1734
1736
|
let resultDecimalDigits = decimalDigits;
|
|
1735
1737
|
// Note : we'd want to simply use number.toFixed() to handle the max digits & rounding,
|
|
1736
1738
|
// but it has very strange behaviour. Ex: 12.345.toFixed(2) => "12.35", but 1.345.toFixed(2) => "1.34"
|
|
1737
1739
|
let slicedDecimalDigits = decimalDigits.slice(0, maxDecimals);
|
|
1738
1740
|
const i = maxDecimals;
|
|
1739
|
-
if (Number(
|
|
1741
|
+
if (Number(decimalDigits[i]) < 5) {
|
|
1740
1742
|
return { integerDigits, decimalDigits: slicedDecimalDigits };
|
|
1741
1743
|
}
|
|
1742
1744
|
// round up
|
|
1745
|
+
const leadingZeroes = ((_a = slicedDecimalDigits.match(leadingZeroesRegexp)) === null || _a === void 0 ? void 0 : _a[0]) || "";
|
|
1743
1746
|
const slicedRoundedUp = (Number(slicedDecimalDigits) + 1).toString();
|
|
1744
|
-
|
|
1745
|
-
|
|
1747
|
+
const withoutLeadingZeroes = slicedDecimalDigits.slice(leadingZeroes.length);
|
|
1748
|
+
// e.g. carry over from 99 to 100
|
|
1749
|
+
const carryOver = slicedRoundedUp.length > withoutLeadingZeroes.length;
|
|
1750
|
+
if (carryOver && !leadingZeroes) {
|
|
1751
|
+
integerDigits = "1";
|
|
1746
1752
|
resultDecimalDigits = undefined;
|
|
1747
1753
|
}
|
|
1754
|
+
else if (carryOver) {
|
|
1755
|
+
resultDecimalDigits = leadingZeroes.slice(0, -1) + slicedRoundedUp;
|
|
1756
|
+
}
|
|
1748
1757
|
else {
|
|
1749
|
-
resultDecimalDigits = slicedRoundedUp;
|
|
1758
|
+
resultDecimalDigits = leadingZeroes + slicedRoundedUp;
|
|
1750
1759
|
}
|
|
1751
1760
|
return { integerDigits, decimalDigits: resultDecimalDigits };
|
|
1752
1761
|
}
|
|
@@ -16863,7 +16872,7 @@ class LineBarPieConfigPanel extends owl.Component {
|
|
|
16863
16872
|
return !!((_a = this.state.labelsDispatchResult) === null || _a === void 0 ? void 0 : _a.isCancelledBecause(33 /* CommandResult.InvalidLabelRange */));
|
|
16864
16873
|
}
|
|
16865
16874
|
onUpdateDataSetsHaveTitle(ev) {
|
|
16866
|
-
this.props.updateChart({
|
|
16875
|
+
this.props.updateChart(this.props.figureId, {
|
|
16867
16876
|
dataSetsHaveTitle: ev.target.checked,
|
|
16868
16877
|
});
|
|
16869
16878
|
}
|
|
@@ -16875,7 +16884,7 @@ class LineBarPieConfigPanel extends owl.Component {
|
|
|
16875
16884
|
this.dataSeriesRanges = ranges;
|
|
16876
16885
|
}
|
|
16877
16886
|
onDataSeriesConfirmed() {
|
|
16878
|
-
this.state.datasetDispatchResult = this.props.updateChart({
|
|
16887
|
+
this.state.datasetDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
16879
16888
|
dataSets: this.dataSeriesRanges,
|
|
16880
16889
|
});
|
|
16881
16890
|
}
|
|
@@ -16887,12 +16896,12 @@ class LineBarPieConfigPanel extends owl.Component {
|
|
|
16887
16896
|
this.labelRange = ranges[0];
|
|
16888
16897
|
}
|
|
16889
16898
|
onLabelRangeConfirmed() {
|
|
16890
|
-
this.state.labelsDispatchResult = this.props.updateChart({
|
|
16899
|
+
this.state.labelsDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
16891
16900
|
labelRange: this.labelRange,
|
|
16892
16901
|
});
|
|
16893
16902
|
}
|
|
16894
16903
|
onUpdateAggregated(ev) {
|
|
16895
|
-
this.props.updateChart({
|
|
16904
|
+
this.props.updateChart(this.props.figureId, {
|
|
16896
16905
|
aggregated: ev.target.checked,
|
|
16897
16906
|
});
|
|
16898
16907
|
}
|
|
@@ -16907,12 +16916,12 @@ LineBarPieConfigPanel.props = {
|
|
|
16907
16916
|
|
|
16908
16917
|
class BarConfigPanel extends LineBarPieConfigPanel {
|
|
16909
16918
|
onUpdateStacked(ev) {
|
|
16910
|
-
this.props.updateChart({
|
|
16919
|
+
this.props.updateChart(this.props.figureId, {
|
|
16911
16920
|
stacked: ev.target.checked,
|
|
16912
16921
|
});
|
|
16913
16922
|
}
|
|
16914
16923
|
onUpdateAggregated(ev) {
|
|
16915
|
-
this.props.updateChart({
|
|
16924
|
+
this.props.updateChart(this.props.figureId, {
|
|
16916
16925
|
aggregated: ev.target.checked,
|
|
16917
16926
|
});
|
|
16918
16927
|
}
|
|
@@ -16953,6 +16962,7 @@ css /* scss */ `
|
|
|
16953
16962
|
.o-color-picker-toggler {
|
|
16954
16963
|
display: flex;
|
|
16955
16964
|
.o-color-picker-toggler-sign {
|
|
16965
|
+
display: flex;
|
|
16956
16966
|
margin: auto auto;
|
|
16957
16967
|
width: 55%;
|
|
16958
16968
|
height: 55%;
|
|
@@ -17255,17 +17265,17 @@ class LineBarPieDesignPanel extends owl.Component {
|
|
|
17255
17265
|
this.state.fillColorTool = !this.state.fillColorTool;
|
|
17256
17266
|
}
|
|
17257
17267
|
updateBackgroundColor(color) {
|
|
17258
|
-
this.props.updateChart({
|
|
17268
|
+
this.props.updateChart(this.props.figureId, {
|
|
17259
17269
|
background: color,
|
|
17260
17270
|
});
|
|
17261
17271
|
}
|
|
17262
17272
|
updateTitle(ev) {
|
|
17263
|
-
this.props.updateChart({
|
|
17273
|
+
this.props.updateChart(this.props.figureId, {
|
|
17264
17274
|
title: ev.target.value,
|
|
17265
17275
|
});
|
|
17266
17276
|
}
|
|
17267
17277
|
updateSelect(attr, ev) {
|
|
17268
|
-
this.props.updateChart({
|
|
17278
|
+
this.props.updateChart(this.props.figureId, {
|
|
17269
17279
|
[attr]: ev.target.value,
|
|
17270
17280
|
});
|
|
17271
17281
|
}
|
|
@@ -17303,7 +17313,7 @@ class GaugeChartConfigPanel extends owl.Component {
|
|
|
17303
17313
|
this.dataRange = ranges[0];
|
|
17304
17314
|
}
|
|
17305
17315
|
updateDataRange() {
|
|
17306
|
-
this.state.dataRangeDispatchResult = this.props.updateChart({
|
|
17316
|
+
this.state.dataRangeDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
17307
17317
|
dataRange: this.dataRange,
|
|
17308
17318
|
});
|
|
17309
17319
|
}
|
|
@@ -17365,12 +17375,12 @@ class GaugeChartDesignPanel extends owl.Component {
|
|
|
17365
17375
|
}
|
|
17366
17376
|
updateBackgroundColor(color) {
|
|
17367
17377
|
this.state.openedMenu = undefined;
|
|
17368
|
-
this.props.updateChart({
|
|
17378
|
+
this.props.updateChart(this.props.figureId, {
|
|
17369
17379
|
background: color,
|
|
17370
17380
|
});
|
|
17371
17381
|
}
|
|
17372
17382
|
updateTitle(ev) {
|
|
17373
|
-
this.props.updateChart({
|
|
17383
|
+
this.props.updateChart(this.props.figureId, {
|
|
17374
17384
|
title: ev.target.value,
|
|
17375
17385
|
});
|
|
17376
17386
|
}
|
|
@@ -17439,7 +17449,7 @@ class GaugeChartDesignPanel extends owl.Component {
|
|
|
17439
17449
|
}
|
|
17440
17450
|
}
|
|
17441
17451
|
updateSectionRule(sectionRule) {
|
|
17442
|
-
this.state.sectionRuleDispatchResult = this.props.updateChart({
|
|
17452
|
+
this.state.sectionRuleDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
17443
17453
|
sectionRule,
|
|
17444
17454
|
});
|
|
17445
17455
|
}
|
|
@@ -17464,17 +17474,17 @@ class LineConfigPanel extends LineBarPieConfigPanel {
|
|
|
17464
17474
|
return false;
|
|
17465
17475
|
}
|
|
17466
17476
|
onUpdateLabelsAsText(ev) {
|
|
17467
|
-
this.props.updateChart({
|
|
17477
|
+
this.props.updateChart(this.props.figureId, {
|
|
17468
17478
|
labelsAsText: ev.target.checked,
|
|
17469
17479
|
});
|
|
17470
17480
|
}
|
|
17471
17481
|
onUpdateStacked(ev) {
|
|
17472
|
-
this.props.updateChart({
|
|
17482
|
+
this.props.updateChart(this.props.figureId, {
|
|
17473
17483
|
stacked: ev.target.checked,
|
|
17474
17484
|
});
|
|
17475
17485
|
}
|
|
17476
17486
|
onUpdateAggregated(ev) {
|
|
17477
|
-
this.props.updateChart({
|
|
17487
|
+
this.props.updateChart(this.props.figureId, {
|
|
17478
17488
|
aggregated: ev.target.checked,
|
|
17479
17489
|
});
|
|
17480
17490
|
}
|
|
@@ -17515,7 +17525,7 @@ class ScorecardChartConfigPanel extends owl.Component {
|
|
|
17515
17525
|
this.keyValue = ranges[0];
|
|
17516
17526
|
}
|
|
17517
17527
|
updateKeyValueRange() {
|
|
17518
|
-
this.state.keyValueDispatchResult = this.props.updateChart({
|
|
17528
|
+
this.state.keyValueDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
17519
17529
|
keyValue: this.keyValue,
|
|
17520
17530
|
});
|
|
17521
17531
|
}
|
|
@@ -17523,12 +17533,12 @@ class ScorecardChartConfigPanel extends owl.Component {
|
|
|
17523
17533
|
this.baseline = ranges[0];
|
|
17524
17534
|
}
|
|
17525
17535
|
updateBaselineRange() {
|
|
17526
|
-
this.state.baselineDispatchResult = this.props.updateChart({
|
|
17536
|
+
this.state.baselineDispatchResult = this.props.updateChart(this.props.figureId, {
|
|
17527
17537
|
baseline: this.baseline,
|
|
17528
17538
|
});
|
|
17529
17539
|
}
|
|
17530
17540
|
updateBaselineMode(ev) {
|
|
17531
|
-
this.props.updateChart({ baselineMode: ev.target.value });
|
|
17541
|
+
this.props.updateChart(this.props.figureId, { baselineMode: ev.target.value });
|
|
17532
17542
|
}
|
|
17533
17543
|
}
|
|
17534
17544
|
ScorecardChartConfigPanel.template = "o-spreadsheet-ScorecardChartConfigPanel";
|
|
@@ -17550,12 +17560,12 @@ class ScorecardChartDesignPanel extends owl.Component {
|
|
|
17550
17560
|
owl.useExternalListener(window, "click", this.closeMenus);
|
|
17551
17561
|
}
|
|
17552
17562
|
updateTitle(ev) {
|
|
17553
|
-
this.props.updateChart({
|
|
17563
|
+
this.props.updateChart(this.props.figureId, {
|
|
17554
17564
|
title: ev.target.value,
|
|
17555
17565
|
});
|
|
17556
17566
|
}
|
|
17557
17567
|
updateBaselineDescr(ev) {
|
|
17558
|
-
this.props.updateChart({ baselineDescr: ev.target.value });
|
|
17568
|
+
this.props.updateChart(this.props.figureId, { baselineDescr: ev.target.value });
|
|
17559
17569
|
}
|
|
17560
17570
|
toggleColorPicker(colorPickerId) {
|
|
17561
17571
|
if (this.state.openedColorPicker === colorPickerId) {
|
|
@@ -17568,13 +17578,13 @@ class ScorecardChartDesignPanel extends owl.Component {
|
|
|
17568
17578
|
setColor(color, colorPickerId) {
|
|
17569
17579
|
switch (colorPickerId) {
|
|
17570
17580
|
case "backgroundColor":
|
|
17571
|
-
this.props.updateChart({ background: color });
|
|
17581
|
+
this.props.updateChart(this.props.figureId, { background: color });
|
|
17572
17582
|
break;
|
|
17573
17583
|
case "baselineColorDown":
|
|
17574
|
-
this.props.updateChart({ baselineColorDown: color });
|
|
17584
|
+
this.props.updateChart(this.props.figureId, { baselineColorDown: color });
|
|
17575
17585
|
break;
|
|
17576
17586
|
case "baselineColorUp":
|
|
17577
|
-
this.props.updateChart({ baselineColorUp: color });
|
|
17587
|
+
this.props.updateChart(this.props.figureId, { baselineColorUp: color });
|
|
17578
17588
|
break;
|
|
17579
17589
|
}
|
|
17580
17590
|
this.closeMenus();
|
|
@@ -17639,16 +17649,9 @@ css /* scss */ `
|
|
|
17639
17649
|
}
|
|
17640
17650
|
`;
|
|
17641
17651
|
class ChartPanel extends owl.Component {
|
|
17642
|
-
constructor() {
|
|
17643
|
-
super(...arguments);
|
|
17644
|
-
this.shouldUpdateChart = true;
|
|
17645
|
-
}
|
|
17646
17652
|
get figureId() {
|
|
17647
17653
|
return this.state.figureId;
|
|
17648
17654
|
}
|
|
17649
|
-
get sheetId() {
|
|
17650
|
-
return this.state.sheetId;
|
|
17651
|
-
}
|
|
17652
17655
|
setup() {
|
|
17653
17656
|
const selectedFigureId = this.env.model.getters.getSelectedFigureId();
|
|
17654
17657
|
if (!selectedFigureId) {
|
|
@@ -17657,17 +17660,11 @@ class ChartPanel extends owl.Component {
|
|
|
17657
17660
|
this.state = owl.useState({
|
|
17658
17661
|
panel: "configuration",
|
|
17659
17662
|
figureId: selectedFigureId,
|
|
17660
|
-
sheetId: this.env.model.getters.getActiveSheetId(),
|
|
17661
17663
|
});
|
|
17662
17664
|
owl.onWillUpdateProps(() => {
|
|
17663
17665
|
const selectedFigureId = this.env.model.getters.getSelectedFigureId();
|
|
17664
17666
|
if (selectedFigureId && selectedFigureId !== this.state.figureId) {
|
|
17665
17667
|
this.state.figureId = selectedFigureId;
|
|
17666
|
-
this.state.sheetId = this.env.model.getters.getActiveSheetId();
|
|
17667
|
-
this.shouldUpdateChart = false;
|
|
17668
|
-
}
|
|
17669
|
-
else {
|
|
17670
|
-
this.shouldUpdateChart = true;
|
|
17671
17668
|
}
|
|
17672
17669
|
if (!this.env.model.getters.isChartDefined(this.figureId)) {
|
|
17673
17670
|
this.props.onCloseSidePanel();
|
|
@@ -17675,8 +17672,8 @@ class ChartPanel extends owl.Component {
|
|
|
17675
17672
|
}
|
|
17676
17673
|
});
|
|
17677
17674
|
}
|
|
17678
|
-
updateChart(updateDefinition) {
|
|
17679
|
-
if (
|
|
17675
|
+
updateChart(figureId, updateDefinition) {
|
|
17676
|
+
if (figureId !== this.figureId) {
|
|
17680
17677
|
return;
|
|
17681
17678
|
}
|
|
17682
17679
|
const definition = {
|
|
@@ -17685,8 +17682,8 @@ class ChartPanel extends owl.Component {
|
|
|
17685
17682
|
};
|
|
17686
17683
|
return this.env.model.dispatch("UPDATE_CHART", {
|
|
17687
17684
|
definition,
|
|
17688
|
-
id:
|
|
17689
|
-
sheetId: this.
|
|
17685
|
+
id: figureId,
|
|
17686
|
+
sheetId: this.env.model.getters.getFigureSheetId(figureId),
|
|
17690
17687
|
});
|
|
17691
17688
|
}
|
|
17692
17689
|
onTypeChange(type) {
|
|
@@ -17698,7 +17695,7 @@ class ChartPanel extends owl.Component {
|
|
|
17698
17695
|
this.env.model.dispatch("UPDATE_CHART", {
|
|
17699
17696
|
definition,
|
|
17700
17697
|
id: this.figureId,
|
|
17701
|
-
sheetId: this.
|
|
17698
|
+
sheetId: this.env.model.getters.getFigureSheetId(this.figureId),
|
|
17702
17699
|
});
|
|
17703
17700
|
}
|
|
17704
17701
|
get chartPanel() {
|
|
@@ -19860,6 +19857,7 @@ class Composer extends owl.Component {
|
|
|
19860
19857
|
(this.autoCompleteState.selectedIndex + 1) % this.autoCompleteState.values.length;
|
|
19861
19858
|
}
|
|
19862
19859
|
}
|
|
19860
|
+
this.updateCursorIfNeeded();
|
|
19863
19861
|
}
|
|
19864
19862
|
processTabKey(ev) {
|
|
19865
19863
|
var _a;
|
|
@@ -19930,10 +19928,12 @@ class Composer extends owl.Component {
|
|
|
19930
19928
|
}
|
|
19931
19929
|
else {
|
|
19932
19930
|
ev.stopPropagation();
|
|
19931
|
+
this.updateCursorIfNeeded();
|
|
19933
19932
|
}
|
|
19934
|
-
|
|
19935
|
-
|
|
19936
|
-
|
|
19933
|
+
}
|
|
19934
|
+
updateCursorIfNeeded() {
|
|
19935
|
+
if (!this.env.model.getters.isSelectingForComposer()) {
|
|
19936
|
+
const { start, end } = this.contentHelper.getCurrentSelection();
|
|
19937
19937
|
this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
|
|
19938
19938
|
this.isKeyStillDown = true;
|
|
19939
19939
|
}
|
|
@@ -19991,7 +19991,12 @@ class Composer extends owl.Component {
|
|
|
19991
19991
|
};
|
|
19992
19992
|
});
|
|
19993
19993
|
if (searchTerm) {
|
|
19994
|
-
|
|
19994
|
+
if (searchTerm.toLowerCase() === "true" || searchTerm.toLowerCase() === "false") {
|
|
19995
|
+
values = [];
|
|
19996
|
+
}
|
|
19997
|
+
else {
|
|
19998
|
+
values = fuzzyLookup(searchTerm, values, (t) => t.text);
|
|
19999
|
+
}
|
|
19995
20000
|
}
|
|
19996
20001
|
else {
|
|
19997
20002
|
// alphabetical order
|
|
@@ -23068,6 +23073,16 @@ const XLSX_INDEXED_COLORS = {
|
|
|
23068
23073
|
63: "333333",
|
|
23069
23074
|
64: "000000",
|
|
23070
23075
|
65: "FFFFFF", // system background
|
|
23076
|
+
};
|
|
23077
|
+
const IMAGE_MIMETYPE_EXTENSION_MAPPING = {
|
|
23078
|
+
"image/avif": "avif",
|
|
23079
|
+
"image/bmp": "bmp",
|
|
23080
|
+
"image/gif": "gif",
|
|
23081
|
+
"image/vnd.microsoft.icon": "ico",
|
|
23082
|
+
"image/jpeg": "jpeg",
|
|
23083
|
+
"image/png": "png",
|
|
23084
|
+
"image/tiff": "tiff",
|
|
23085
|
+
"image/webp": "webp",
|
|
23071
23086
|
};
|
|
23072
23087
|
|
|
23073
23088
|
/**
|
|
@@ -25504,6 +25519,11 @@ function createOverride(partName, contentType) {
|
|
|
25504
25519
|
<Override ContentType="${contentType}" PartName="${partName}" />
|
|
25505
25520
|
`;
|
|
25506
25521
|
}
|
|
25522
|
+
function createDefaultXMLElement(extension, contentType) {
|
|
25523
|
+
return escapeXml /*xml*/ `
|
|
25524
|
+
<Default Extension="${extension}" ContentType="${contentType}" />
|
|
25525
|
+
`;
|
|
25526
|
+
}
|
|
25507
25527
|
function joinXmlNodes(xmlNodes) {
|
|
25508
25528
|
return new XMLString(xmlNodes.join("\n"));
|
|
25509
25529
|
}
|
|
@@ -39565,7 +39585,7 @@ class ImageProvider {
|
|
|
39565
39585
|
const file = await this.getImageFromUser();
|
|
39566
39586
|
const path = await this.fileStore.upload(file);
|
|
39567
39587
|
const size = await this.getImageSize(path);
|
|
39568
|
-
return { path, size };
|
|
39588
|
+
return { path, size, mimetype: file.type };
|
|
39569
39589
|
}
|
|
39570
39590
|
getImageFromUser() {
|
|
39571
39591
|
return new Promise((resolve, reject) => {
|
|
@@ -44631,8 +44651,7 @@ function createWorksheets(data, construct) {
|
|
|
44631
44651
|
// Figures and Charts
|
|
44632
44652
|
let drawingNode = escapeXml ``;
|
|
44633
44653
|
const drawingRelIds = [];
|
|
44634
|
-
const
|
|
44635
|
-
for (const chart of charts) {
|
|
44654
|
+
for (const chart of sheet.charts) {
|
|
44636
44655
|
const xlsxChartId = convertChartId(chart.id);
|
|
44637
44656
|
const chartRelId = addRelsToFile(construct.relsFiles, `xl/drawings/_rels/drawing${sheetIndex}.xml.rels`, {
|
|
44638
44657
|
target: `../charts/chart${xlsxChartId}.xml`,
|
|
@@ -44641,20 +44660,27 @@ function createWorksheets(data, construct) {
|
|
|
44641
44660
|
drawingRelIds.push(chartRelId);
|
|
44642
44661
|
files.push(createXMLFile(createChart(chart, sheetIndex, data), `xl/charts/chart${xlsxChartId}.xml`, "chart"));
|
|
44643
44662
|
}
|
|
44644
|
-
const
|
|
44645
|
-
|
|
44663
|
+
for (const image of sheet.images) {
|
|
44664
|
+
const mimeType = image.data.mimetype;
|
|
44665
|
+
if (mimeType === undefined)
|
|
44666
|
+
continue;
|
|
44667
|
+
const extension = IMAGE_MIMETYPE_EXTENSION_MAPPING[mimeType];
|
|
44668
|
+
// only support exporting images with mimetypes specified in the mapping
|
|
44669
|
+
if (extension === undefined)
|
|
44670
|
+
continue;
|
|
44646
44671
|
const xlsxImageId = convertImageId(image.id);
|
|
44672
|
+
let imageFileName = `image${xlsxImageId}.${extension}`;
|
|
44647
44673
|
const imageRelId = addRelsToFile(construct.relsFiles, `xl/drawings/_rels/drawing${sheetIndex}.xml.rels`, {
|
|
44648
|
-
target: `../media
|
|
44674
|
+
target: `../media/${imageFileName}`,
|
|
44649
44675
|
type: XLSX_RELATION_TYPE.image,
|
|
44650
44676
|
});
|
|
44651
44677
|
drawingRelIds.push(imageRelId);
|
|
44652
44678
|
files.push({
|
|
44653
|
-
path: `xl/media
|
|
44654
|
-
|
|
44679
|
+
path: `xl/media/${imageFileName}`,
|
|
44680
|
+
imageSrc: image.data.path,
|
|
44655
44681
|
});
|
|
44656
44682
|
}
|
|
44657
|
-
const drawings = [...charts, ...images];
|
|
44683
|
+
const drawings = [...sheet.charts, ...sheet.images];
|
|
44658
44684
|
if (drawings.length) {
|
|
44659
44685
|
const drawingRelId = addRelsToFile(construct.relsFiles, `xl/worksheets/_rels/sheet${sheetIndex}.xml.rels`, {
|
|
44660
44686
|
target: `../drawings/drawing${sheetIndex}.xml`,
|
|
@@ -44773,6 +44799,8 @@ function createRelsFiles(relsFiles) {
|
|
|
44773
44799
|
}
|
|
44774
44800
|
function createContentTypes(files) {
|
|
44775
44801
|
const overrideNodes = [];
|
|
44802
|
+
// hard-code supported image mimetypes
|
|
44803
|
+
const imageDefaultNodes = Object.entries(IMAGE_MIMETYPE_EXTENSION_MAPPING).map(([mimetype, extension]) => createDefaultXMLElement(extension, mimetype));
|
|
44776
44804
|
for (const file of files) {
|
|
44777
44805
|
if ("contentType" in file && file.contentType) {
|
|
44778
44806
|
overrideNodes.push(createOverride("/" + file.path, CONTENT_TYPES[file.contentType]));
|
|
@@ -44780,6 +44808,7 @@ function createContentTypes(files) {
|
|
|
44780
44808
|
}
|
|
44781
44809
|
const xml = escapeXml /*xml*/ `
|
|
44782
44810
|
<Types xmlns="${NAMESPACE["Types"]}">
|
|
44811
|
+
${joinXmlNodes(Object.values(imageDefaultNodes))}
|
|
44783
44812
|
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
|
|
44784
44813
|
<Default Extension="xml" ContentType="application/xml" />
|
|
44785
44814
|
${joinXmlNodes(overrideNodes)}
|
|
@@ -45339,6 +45368,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
45339
45368
|
exports.tokenize = tokenize;
|
|
45340
45369
|
|
|
45341
45370
|
|
|
45342
|
-
__info__.version = '16.2.
|
|
45343
|
-
__info__.date = '2023-
|
|
45344
|
-
__info__.hash = '
|
|
45371
|
+
__info__.version = '16.2.9';
|
|
45372
|
+
__info__.date = '2023-06-12T13:49:57.216Z';
|
|
45373
|
+
__info__.hash = '37e2719';
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -358,7 +358,7 @@ interface XLSXExportXMLFile {
|
|
|
358
358
|
}
|
|
359
359
|
interface XLSXExportImageFile {
|
|
360
360
|
path: string;
|
|
361
|
-
|
|
361
|
+
imageSrc: string;
|
|
362
362
|
}
|
|
363
363
|
interface XLSXExport {
|
|
364
364
|
name: string;
|
|
@@ -635,6 +635,7 @@ declare type ResizeDirection = -1 | 0 | 1;
|
|
|
635
635
|
interface Image {
|
|
636
636
|
path: string;
|
|
637
637
|
size: FigureSize;
|
|
638
|
+
mimetype?: string;
|
|
638
639
|
}
|
|
639
640
|
|
|
640
641
|
interface CellData {
|
|
@@ -4920,7 +4921,7 @@ declare class SelectionInput extends Component<Props$B, SpreadsheetChildEnv> {
|
|
|
4920
4921
|
interface Props$A {
|
|
4921
4922
|
figureId: UID;
|
|
4922
4923
|
definition: LineChartDefinition | BarChartDefinition | PieChartDefinition;
|
|
4923
|
-
updateChart: (definition: Partial<LineChartDefinition | BarChartDefinition | PieChartDefinition>) => DispatchResult;
|
|
4924
|
+
updateChart: (figureId: UID, definition: Partial<LineChartDefinition | BarChartDefinition | PieChartDefinition>) => DispatchResult;
|
|
4924
4925
|
}
|
|
4925
4926
|
declare class LineBarPieConfigPanel extends Component<Props$A, SpreadsheetChildEnv> {
|
|
4926
4927
|
static template: string;
|
|
@@ -5065,7 +5066,7 @@ declare class ColorPickerWidget extends Component<Props$z, SpreadsheetChildEnv>
|
|
|
5065
5066
|
interface Props$y {
|
|
5066
5067
|
figureId: UID;
|
|
5067
5068
|
definition: LineChartDefinition | BarChartDefinition | PieChartDefinition;
|
|
5068
|
-
updateChart: (definition: Partial<LineChartDefinition | BarChartDefinition | PieChartDefinition>) => CommandResult | CommandResult[];
|
|
5069
|
+
updateChart: (figureId: UID, definition: Partial<LineChartDefinition | BarChartDefinition | PieChartDefinition>) => CommandResult | CommandResult[];
|
|
5069
5070
|
}
|
|
5070
5071
|
declare class LineBarPieDesignPanel extends Component<Props$y, SpreadsheetChildEnv> {
|
|
5071
5072
|
static template: string;
|
|
@@ -5084,7 +5085,7 @@ declare class LineBarPieDesignPanel extends Component<Props$y, SpreadsheetChildE
|
|
|
5084
5085
|
interface Props$x {
|
|
5085
5086
|
figureId: UID;
|
|
5086
5087
|
definition: GaugeChartDefinition;
|
|
5087
|
-
updateChart: (definition: Partial<GaugeChartDefinition>) => DispatchResult;
|
|
5088
|
+
updateChart: (figureId: UID, definition: Partial<GaugeChartDefinition>) => DispatchResult;
|
|
5088
5089
|
}
|
|
5089
5090
|
declare class GaugeChartConfigPanel extends Component<Props$x, SpreadsheetChildEnv> {
|
|
5090
5091
|
static template: string;
|
|
@@ -5103,7 +5104,7 @@ declare type GaugeMenu = "backgroundColor" | "sectionColor-lowerColor" | "sectio
|
|
|
5103
5104
|
interface Props$w {
|
|
5104
5105
|
figureId: UID;
|
|
5105
5106
|
definition: GaugeChartDefinition;
|
|
5106
|
-
updateChart: (definition: Partial<GaugeChartDefinition>) => DispatchResult;
|
|
5107
|
+
updateChart: (figureId: UID, definition: Partial<GaugeChartDefinition>) => DispatchResult;
|
|
5107
5108
|
}
|
|
5108
5109
|
declare class GaugeChartDesignPanel extends Component<Props$w, SpreadsheetChildEnv> {
|
|
5109
5110
|
static template: string;
|
|
@@ -5140,7 +5141,7 @@ declare class LineConfigPanel extends LineBarPieConfigPanel {
|
|
|
5140
5141
|
interface Props$v {
|
|
5141
5142
|
figureId: UID;
|
|
5142
5143
|
definition: ScorecardChartDefinition;
|
|
5143
|
-
updateChart: (definition: Partial<ScorecardChartDefinition>) => DispatchResult;
|
|
5144
|
+
updateChart: (figureId: UID, definition: Partial<ScorecardChartDefinition>) => DispatchResult;
|
|
5144
5145
|
}
|
|
5145
5146
|
declare class ScorecardChartConfigPanel extends Component<Props$v, SpreadsheetChildEnv> {
|
|
5146
5147
|
static template: string;
|
|
@@ -5164,7 +5165,7 @@ declare type ColorPickerId = undefined | "backgroundColor" | "baselineColorUp" |
|
|
|
5164
5165
|
interface Props$u {
|
|
5165
5166
|
figureId: UID;
|
|
5166
5167
|
definition: ScorecardChartDefinition;
|
|
5167
|
-
updateChart: (definition: Partial<ScorecardChartDefinition>) => DispatchResult;
|
|
5168
|
+
updateChart: (figureId: UID, definition: Partial<ScorecardChartDefinition>) => DispatchResult;
|
|
5168
5169
|
}
|
|
5169
5170
|
declare class ScorecardChartDesignPanel extends Component<Props$u, SpreadsheetChildEnv> {
|
|
5170
5171
|
static template: string;
|
|
@@ -6098,6 +6099,7 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
|
|
|
6098
6099
|
onCompositionStart(): void;
|
|
6099
6100
|
onCompositionEnd(): void;
|
|
6100
6101
|
onKeydown(ev: KeyboardEvent): void;
|
|
6102
|
+
private updateCursorIfNeeded;
|
|
6101
6103
|
onInput(): void;
|
|
6102
6104
|
onKeyup(ev: KeyboardEvent): void;
|
|
6103
6105
|
showAutocomplete(searchTerm: string): void;
|
|
@@ -6571,11 +6573,9 @@ interface Props {
|
|
|
6571
6573
|
declare class ChartPanel extends Component<Props, SpreadsheetChildEnv> {
|
|
6572
6574
|
static template: string;
|
|
6573
6575
|
private state;
|
|
6574
|
-
private shouldUpdateChart;
|
|
6575
6576
|
get figureId(): UID;
|
|
6576
|
-
get sheetId(): UID;
|
|
6577
6577
|
setup(): void;
|
|
6578
|
-
updateChart<T extends ChartDefinition>(updateDefinition: Partial<T>): DispatchResult | undefined;
|
|
6578
|
+
updateChart<T extends ChartDefinition>(figureId: UID, updateDefinition: Partial<T>): DispatchResult | undefined;
|
|
6579
6579
|
onTypeChange(type: ChartType): void;
|
|
6580
6580
|
get chartPanel(): ChartSidePanel;
|
|
6581
6581
|
private getChartDefinition;
|