@odoo/o-spreadsheet 16.0.1 → 16.0.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 +134 -85
- package/dist/o_spreadsheet.d.ts +20 -19
- package/dist/o_spreadsheet.esm.js +134 -85
- package/dist/o_spreadsheet.iife.js +134 -85
- package/dist/o_spreadsheet.iife.min.js +7 -7
- package/package.json +2 -2
|
@@ -2799,7 +2799,7 @@ class ChartJsComponent extends Component {
|
|
|
2799
2799
|
return `background-color: ${this.background}`;
|
|
2800
2800
|
}
|
|
2801
2801
|
get chartRuntime() {
|
|
2802
|
-
const runtime = this.env.model.getters.getChartRuntime(this.
|
|
2802
|
+
const runtime = this.env.model.getters.getChartRuntime(this.props.figure.id);
|
|
2803
2803
|
if (!("chartJsConfig" in runtime)) {
|
|
2804
2804
|
throw new Error("Unsupported chart runtime");
|
|
2805
2805
|
}
|
|
@@ -3168,6 +3168,7 @@ var CommandResult;
|
|
|
3168
3168
|
CommandResult[CommandResult["DuplicatedFigureId"] = 81] = "DuplicatedFigureId";
|
|
3169
3169
|
CommandResult[CommandResult["InvalidSelectionStep"] = 82] = "InvalidSelectionStep";
|
|
3170
3170
|
CommandResult[CommandResult["DuplicatedChartId"] = 83] = "DuplicatedChartId";
|
|
3171
|
+
CommandResult[CommandResult["ChartDoesNotExist"] = 84] = "ChartDoesNotExist";
|
|
3171
3172
|
})(CommandResult || (CommandResult = {}));
|
|
3172
3173
|
|
|
3173
3174
|
var DIRECTION;
|
|
@@ -8636,7 +8637,7 @@ GaugeChartDesignPanel.components = { ColorPicker };
|
|
|
8636
8637
|
|
|
8637
8638
|
class LineConfigPanel extends LineBarPieConfigPanel {
|
|
8638
8639
|
get canTreatLabelsAsText() {
|
|
8639
|
-
const chart = this.env.model.getters.getChart(this.props.
|
|
8640
|
+
const chart = this.env.model.getters.getChart(this.props.figureId);
|
|
8640
8641
|
if (chart && chart instanceof LineChart) {
|
|
8641
8642
|
return canChartParseLabels(chart, this.env.model.getters);
|
|
8642
8643
|
}
|
|
@@ -8829,7 +8830,7 @@ class ChartPanel extends Component {
|
|
|
8829
8830
|
else {
|
|
8830
8831
|
this.shouldUpdateChart = true;
|
|
8831
8832
|
}
|
|
8832
|
-
if (!this.env.model.getters.isChartDefined(this.
|
|
8833
|
+
if (!this.env.model.getters.isChartDefined(this.figureId)) {
|
|
8833
8834
|
this.props.onCloseSidePanel();
|
|
8834
8835
|
return;
|
|
8835
8836
|
}
|
|
@@ -8850,7 +8851,7 @@ class ChartPanel extends Component {
|
|
|
8850
8851
|
});
|
|
8851
8852
|
}
|
|
8852
8853
|
onTypeChange(type) {
|
|
8853
|
-
const context = this.env.model.getters.getContextCreationChart(this.
|
|
8854
|
+
const context = this.env.model.getters.getContextCreationChart(this.figureId);
|
|
8854
8855
|
if (!context) {
|
|
8855
8856
|
throw new Error("Chart not defined.");
|
|
8856
8857
|
}
|
|
@@ -8862,7 +8863,7 @@ class ChartPanel extends Component {
|
|
|
8862
8863
|
});
|
|
8863
8864
|
}
|
|
8864
8865
|
get chartPanel() {
|
|
8865
|
-
const type = this.env.model.getters.getChartType(this.
|
|
8866
|
+
const type = this.env.model.getters.getChartType(this.figureId);
|
|
8866
8867
|
if (!type) {
|
|
8867
8868
|
throw new Error("Chart not defined.");
|
|
8868
8869
|
}
|
|
@@ -8872,8 +8873,8 @@ class ChartPanel extends Component {
|
|
|
8872
8873
|
}
|
|
8873
8874
|
return chartPanel;
|
|
8874
8875
|
}
|
|
8875
|
-
getChartDefinition() {
|
|
8876
|
-
return this.env.model.getters.getChartDefinition(
|
|
8876
|
+
getChartDefinition(figureId = this.figureId) {
|
|
8877
|
+
return this.env.model.getters.getChartDefinition(figureId);
|
|
8877
8878
|
}
|
|
8878
8879
|
get chartTypes() {
|
|
8879
8880
|
return getChartTypes();
|
|
@@ -10009,7 +10010,7 @@ class ScorecardChart extends Component {
|
|
|
10009
10010
|
this.ctx = document.createElement("canvas").getContext("2d");
|
|
10010
10011
|
}
|
|
10011
10012
|
get runtime() {
|
|
10012
|
-
return this.env.model.getters.getChartRuntime(this.
|
|
10013
|
+
return this.env.model.getters.getChartRuntime(this.props.figure.id);
|
|
10013
10014
|
}
|
|
10014
10015
|
get title() {
|
|
10015
10016
|
return this.runtime.title;
|
|
@@ -10239,7 +10240,7 @@ class ChartFigure extends Component {
|
|
|
10239
10240
|
return registry;
|
|
10240
10241
|
}
|
|
10241
10242
|
get chartType() {
|
|
10242
|
-
return this.env.model.getters.getChartType(this.
|
|
10243
|
+
return this.env.model.getters.getChartType(this.props.figure.id);
|
|
10243
10244
|
}
|
|
10244
10245
|
onContextMenu(ev) {
|
|
10245
10246
|
const position = {
|
|
@@ -26266,13 +26267,7 @@ function load(data, verboseImport) {
|
|
|
26266
26267
|
data = migrate(data);
|
|
26267
26268
|
}
|
|
26268
26269
|
}
|
|
26269
|
-
|
|
26270
|
-
// sensible default values
|
|
26271
|
-
data = Object.assign(createEmptyWorkbookData(), data, { version: CURRENT_VERSION });
|
|
26272
|
-
data.sheets = data.sheets.map((s, i) => Object.assign(createEmptySheet(`Sheet${i + 1}`, `Sheet${i + 1}`), s));
|
|
26273
|
-
if (data.sheets.length === 0) {
|
|
26274
|
-
data.sheets.push(createEmptySheet(INITIAL_SHEET_ID, "Sheet1"));
|
|
26275
|
-
}
|
|
26270
|
+
data = repairData(data);
|
|
26276
26271
|
return data;
|
|
26277
26272
|
}
|
|
26278
26273
|
function migrate(data) {
|
|
@@ -26510,6 +26505,48 @@ const MIGRATIONS = [
|
|
|
26510
26505
|
},
|
|
26511
26506
|
},
|
|
26512
26507
|
];
|
|
26508
|
+
/**
|
|
26509
|
+
* This function is used to repair faulty data independently of the migration.
|
|
26510
|
+
*/
|
|
26511
|
+
function repairData(data) {
|
|
26512
|
+
data = forceUnicityOfFigure(data);
|
|
26513
|
+
data = setDefaults(data);
|
|
26514
|
+
return data;
|
|
26515
|
+
}
|
|
26516
|
+
/**
|
|
26517
|
+
* Force the unicity of figure ids accross sheets
|
|
26518
|
+
*/
|
|
26519
|
+
function forceUnicityOfFigure(data) {
|
|
26520
|
+
if (data.uniqueFigureIds) {
|
|
26521
|
+
return data;
|
|
26522
|
+
}
|
|
26523
|
+
const figureIds = new Set();
|
|
26524
|
+
const uuidGenerator = new UuidGenerator();
|
|
26525
|
+
for (const sheet of data.sheets || []) {
|
|
26526
|
+
for (const figure of sheet.figures || []) {
|
|
26527
|
+
if (figureIds.has(figure.id)) {
|
|
26528
|
+
figure.id += uuidGenerator.uuidv4();
|
|
26529
|
+
}
|
|
26530
|
+
figureIds.add(figure.id);
|
|
26531
|
+
}
|
|
26532
|
+
}
|
|
26533
|
+
data.uniqueFigureIds = true;
|
|
26534
|
+
return data;
|
|
26535
|
+
}
|
|
26536
|
+
/**
|
|
26537
|
+
* sanity check: try to fix missing fields/corrupted state by providing
|
|
26538
|
+
* sensible default values
|
|
26539
|
+
*/
|
|
26540
|
+
function setDefaults(data) {
|
|
26541
|
+
data = Object.assign(createEmptyWorkbookData(), data, { version: CURRENT_VERSION });
|
|
26542
|
+
data.sheets = data.sheets
|
|
26543
|
+
? data.sheets.map((s, i) => Object.assign(createEmptySheet(`Sheet${i + 1}`, `Sheet${i + 1}`), s))
|
|
26544
|
+
: [];
|
|
26545
|
+
if (data.sheets.length === 0) {
|
|
26546
|
+
data.sheets.push(createEmptySheet(INITIAL_SHEET_ID, "Sheet1"));
|
|
26547
|
+
}
|
|
26548
|
+
return data;
|
|
26549
|
+
}
|
|
26513
26550
|
/**
|
|
26514
26551
|
* The goal of this function is to repair corrupted/wrong initial messages caused by
|
|
26515
26552
|
* a bug.
|
|
@@ -26648,6 +26685,7 @@ function createEmptyWorkbookData(sheetName = "Sheet1") {
|
|
|
26648
26685
|
formats: {},
|
|
26649
26686
|
borders: {},
|
|
26650
26687
|
revisionId: DEFAULT_REVISION_ID,
|
|
26688
|
+
uniqueFigureIds: true,
|
|
26651
26689
|
};
|
|
26652
26690
|
return data;
|
|
26653
26691
|
}
|
|
@@ -27570,10 +27608,8 @@ class ChartPlugin extends CorePlugin {
|
|
|
27570
27608
|
this.validateChartDefinition = (cmd) => validateChartDefinition(this, cmd.definition);
|
|
27571
27609
|
}
|
|
27572
27610
|
adaptRanges(applyChange) {
|
|
27573
|
-
for (const
|
|
27574
|
-
|
|
27575
|
-
this.history.update("charts", sheetId, chartId, chart === null || chart === void 0 ? void 0 : chart.updateRanges(applyChange));
|
|
27576
|
-
}
|
|
27611
|
+
for (const [chartId, chart] of Object.entries(this.charts)) {
|
|
27612
|
+
this.history.update("charts", chartId, chart === null || chart === void 0 ? void 0 : chart.updateRanges(applyChange));
|
|
27577
27613
|
}
|
|
27578
27614
|
}
|
|
27579
27615
|
// ---------------------------------------------------------------------------
|
|
@@ -27584,20 +27620,20 @@ class ChartPlugin extends CorePlugin {
|
|
|
27584
27620
|
case "CREATE_CHART":
|
|
27585
27621
|
return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartDuplicate));
|
|
27586
27622
|
case "UPDATE_CHART":
|
|
27587
|
-
return this.
|
|
27623
|
+
return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartExists));
|
|
27588
27624
|
default:
|
|
27589
27625
|
return 0 /* CommandResult.Success */;
|
|
27590
27626
|
}
|
|
27591
27627
|
}
|
|
27592
27628
|
handle(cmd) {
|
|
27593
|
-
var _a
|
|
27629
|
+
var _a;
|
|
27594
27630
|
switch (cmd.type) {
|
|
27595
27631
|
case "CREATE_CHART":
|
|
27596
27632
|
this.addFigure(cmd.id, cmd.sheetId, cmd.position, cmd.size);
|
|
27597
|
-
this.addChart(cmd.id, cmd.
|
|
27633
|
+
this.addChart(cmd.id, cmd.definition);
|
|
27598
27634
|
break;
|
|
27599
27635
|
case "UPDATE_CHART": {
|
|
27600
|
-
this.addChart(cmd.id, cmd.
|
|
27636
|
+
this.addChart(cmd.id, cmd.definition);
|
|
27601
27637
|
break;
|
|
27602
27638
|
}
|
|
27603
27639
|
case "DUPLICATE_SHEET": {
|
|
@@ -27606,7 +27642,7 @@ class ChartPlugin extends CorePlugin {
|
|
|
27606
27642
|
if (fig.tag === "chart") {
|
|
27607
27643
|
const figureIdBase = fig.id.split(FIGURE_ID_SPLITTER).pop();
|
|
27608
27644
|
const duplicatedFigureId = `${cmd.sheetIdTo}${FIGURE_ID_SPLITTER}${figureIdBase}`;
|
|
27609
|
-
const chart = (
|
|
27645
|
+
const chart = (_a = this.charts[fig.id]) === null || _a === void 0 ? void 0 : _a.copyForSheetId(cmd.sheetIdTo);
|
|
27610
27646
|
if (chart) {
|
|
27611
27647
|
this.dispatch("CREATE_CHART", {
|
|
27612
27648
|
id: duplicatedFigureId,
|
|
@@ -27621,41 +27657,44 @@ class ChartPlugin extends CorePlugin {
|
|
|
27621
27657
|
break;
|
|
27622
27658
|
}
|
|
27623
27659
|
case "DELETE_FIGURE":
|
|
27624
|
-
this.history.update("charts", cmd.
|
|
27660
|
+
this.history.update("charts", cmd.id, undefined);
|
|
27625
27661
|
break;
|
|
27626
27662
|
case "DELETE_SHEET":
|
|
27627
|
-
this.
|
|
27663
|
+
for (let id of this.getChartIds(cmd.sheetId)) {
|
|
27664
|
+
this.history.update("charts", id, undefined);
|
|
27665
|
+
}
|
|
27628
27666
|
break;
|
|
27629
27667
|
}
|
|
27630
27668
|
}
|
|
27631
27669
|
// ---------------------------------------------------------------------------
|
|
27632
27670
|
// Getters
|
|
27633
27671
|
// ---------------------------------------------------------------------------
|
|
27634
|
-
getContextCreationChart(
|
|
27635
|
-
var _a, _b;
|
|
27636
|
-
return (_b = (_a = this.charts[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId]) === null || _b === void 0 ? void 0 : _b.getContextCreation();
|
|
27637
|
-
}
|
|
27638
|
-
getChart(sheetId, figureId) {
|
|
27672
|
+
getContextCreationChart(figureId) {
|
|
27639
27673
|
var _a;
|
|
27640
|
-
return (_a = this.charts[
|
|
27674
|
+
return (_a = this.charts[figureId]) === null || _a === void 0 ? void 0 : _a.getContextCreation();
|
|
27641
27675
|
}
|
|
27642
|
-
|
|
27643
|
-
|
|
27644
|
-
|
|
27676
|
+
getChart(figureId) {
|
|
27677
|
+
return this.charts[figureId];
|
|
27678
|
+
}
|
|
27679
|
+
getChartType(figureId) {
|
|
27680
|
+
var _a;
|
|
27681
|
+
const type = (_a = this.charts[figureId]) === null || _a === void 0 ? void 0 : _a.type;
|
|
27645
27682
|
if (!type) {
|
|
27646
27683
|
throw new Error("Chart not defined.");
|
|
27647
27684
|
}
|
|
27648
27685
|
return type;
|
|
27649
27686
|
}
|
|
27650
|
-
isChartDefined(
|
|
27651
|
-
return figureId in
|
|
27687
|
+
isChartDefined(figureId) {
|
|
27688
|
+
return figureId in this.charts && this.charts !== undefined;
|
|
27652
27689
|
}
|
|
27653
27690
|
getChartIds(sheetId) {
|
|
27654
|
-
return Object.
|
|
27691
|
+
return Object.entries(this.charts)
|
|
27692
|
+
.filter(([, chart]) => (chart === null || chart === void 0 ? void 0 : chart.sheetId) === sheetId)
|
|
27693
|
+
.map(([id]) => id);
|
|
27655
27694
|
}
|
|
27656
|
-
getChartDefinition(
|
|
27657
|
-
var _a
|
|
27658
|
-
const definition = (
|
|
27695
|
+
getChartDefinition(figureId) {
|
|
27696
|
+
var _a;
|
|
27697
|
+
const definition = (_a = this.charts[figureId]) === null || _a === void 0 ? void 0 : _a.getDefinition();
|
|
27659
27698
|
if (!definition) {
|
|
27660
27699
|
throw new Error(`There is no chart with the given figureId: ${figureId}`);
|
|
27661
27700
|
}
|
|
@@ -27667,28 +27706,35 @@ class ChartPlugin extends CorePlugin {
|
|
|
27667
27706
|
import(data) {
|
|
27668
27707
|
for (let sheet of data.sheets) {
|
|
27669
27708
|
if (sheet.figures) {
|
|
27670
|
-
const charts = {};
|
|
27671
27709
|
for (let figure of sheet.figures) {
|
|
27672
27710
|
// TODO:
|
|
27673
27711
|
// figure data should be external IMO => chart should be in sheet.chart
|
|
27674
27712
|
// instead of in figure.data
|
|
27675
27713
|
if (figure.tag === "chart") {
|
|
27676
|
-
charts[figure.id] = this.createChart(figure.id, figure.data, sheet.id);
|
|
27714
|
+
this.charts[figure.id] = this.createChart(figure.id, figure.data, sheet.id);
|
|
27677
27715
|
}
|
|
27678
27716
|
}
|
|
27679
|
-
this.charts[sheet.id] = charts;
|
|
27680
27717
|
}
|
|
27681
27718
|
}
|
|
27682
27719
|
}
|
|
27683
27720
|
export(data) {
|
|
27721
|
+
var _a;
|
|
27684
27722
|
if (data.sheets) {
|
|
27685
27723
|
for (let sheet of data.sheets) {
|
|
27686
27724
|
// TODO This code is false, if two plugins want ot insert figures on the sheet, it will crash !
|
|
27687
27725
|
const sheetFigures = this.getters.getFigures(sheet.id);
|
|
27688
|
-
const figures =
|
|
27689
|
-
for (let
|
|
27726
|
+
const figures = [];
|
|
27727
|
+
for (let sheetFigure of sheetFigures) {
|
|
27728
|
+
const figure = sheetFigure;
|
|
27690
27729
|
if (figure && figure.tag === "chart") {
|
|
27691
|
-
|
|
27730
|
+
const data = (_a = this.charts[figure.id]) === null || _a === void 0 ? void 0 : _a.getDefinition();
|
|
27731
|
+
if (data) {
|
|
27732
|
+
figure.data = data;
|
|
27733
|
+
figures.push(figure);
|
|
27734
|
+
}
|
|
27735
|
+
}
|
|
27736
|
+
else {
|
|
27737
|
+
figures.push(figure);
|
|
27692
27738
|
}
|
|
27693
27739
|
}
|
|
27694
27740
|
sheet.figures = figures;
|
|
@@ -27696,13 +27742,13 @@ class ChartPlugin extends CorePlugin {
|
|
|
27696
27742
|
}
|
|
27697
27743
|
}
|
|
27698
27744
|
exportForExcel(data) {
|
|
27699
|
-
var _a
|
|
27745
|
+
var _a;
|
|
27700
27746
|
for (let sheet of data.sheets) {
|
|
27701
27747
|
const sheetFigures = this.getters.getFigures(sheet.id);
|
|
27702
27748
|
const figures = [];
|
|
27703
27749
|
for (let figure of sheetFigures) {
|
|
27704
27750
|
if (figure && figure.tag === "chart") {
|
|
27705
|
-
const figureData = (
|
|
27751
|
+
const figureData = (_a = this.charts[figure.id]) === null || _a === void 0 ? void 0 : _a.getDefinitionForExcel();
|
|
27706
27752
|
if (figureData) {
|
|
27707
27753
|
figures.push({
|
|
27708
27754
|
...figure,
|
|
@@ -27741,15 +27787,21 @@ class ChartPlugin extends CorePlugin {
|
|
|
27741
27787
|
* Add a chart in the local state. If a chart already exists, this chart is
|
|
27742
27788
|
* replaced
|
|
27743
27789
|
*/
|
|
27744
|
-
addChart(id,
|
|
27745
|
-
|
|
27790
|
+
addChart(id, definition) {
|
|
27791
|
+
const sheetId = this.getters.getFigureSheetId(id);
|
|
27792
|
+
if (sheetId) {
|
|
27793
|
+
this.history.update("charts", id, this.createChart(id, definition, sheetId));
|
|
27794
|
+
}
|
|
27746
27795
|
}
|
|
27747
27796
|
checkChartDuplicate(cmd) {
|
|
27748
|
-
|
|
27749
|
-
|
|
27750
|
-
|
|
27751
|
-
|
|
27752
|
-
|
|
27797
|
+
return this.getters.getFigureSheetId(cmd.id)
|
|
27798
|
+
? 83 /* CommandResult.DuplicatedChartId */
|
|
27799
|
+
: 0 /* CommandResult.Success */;
|
|
27800
|
+
}
|
|
27801
|
+
checkChartExists(cmd) {
|
|
27802
|
+
return this.getters.getFigureSheetId(cmd.id)
|
|
27803
|
+
? 0 /* CommandResult.Success */
|
|
27804
|
+
: 84 /* CommandResult.ChartDoesNotExist */;
|
|
27753
27805
|
}
|
|
27754
27806
|
}
|
|
27755
27807
|
ChartPlugin.getters = [
|
|
@@ -28130,7 +28182,7 @@ class FigurePlugin extends CorePlugin {
|
|
|
28130
28182
|
allowDispatch(cmd) {
|
|
28131
28183
|
switch (cmd.type) {
|
|
28132
28184
|
case "CREATE_FIGURE":
|
|
28133
|
-
return this.checkFigureDuplicate(cmd.
|
|
28185
|
+
return this.checkFigureDuplicate(cmd.figure.id);
|
|
28134
28186
|
case "UPDATE_FIGURE":
|
|
28135
28187
|
case "DELETE_FIGURE":
|
|
28136
28188
|
return this.checkFigureExists(cmd.sheetId, cmd.id);
|
|
@@ -28196,9 +28248,8 @@ class FigurePlugin extends CorePlugin {
|
|
|
28196
28248
|
}
|
|
28197
28249
|
return 0 /* CommandResult.Success */;
|
|
28198
28250
|
}
|
|
28199
|
-
checkFigureDuplicate(
|
|
28200
|
-
|
|
28201
|
-
if ((_a = this.figures[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId]) {
|
|
28251
|
+
checkFigureDuplicate(figureId) {
|
|
28252
|
+
if (Object.values(this.figures).find((sheet) => sheet === null || sheet === void 0 ? void 0 : sheet[figureId])) {
|
|
28202
28253
|
return 81 /* CommandResult.DuplicatedFigureId */;
|
|
28203
28254
|
}
|
|
28204
28255
|
return 0 /* CommandResult.Success */;
|
|
@@ -28213,6 +28264,9 @@ class FigurePlugin extends CorePlugin {
|
|
|
28213
28264
|
var _a;
|
|
28214
28265
|
return (_a = this.figures[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId];
|
|
28215
28266
|
}
|
|
28267
|
+
getFigureSheetId(figureId) {
|
|
28268
|
+
return Object.keys(this.figures).find((sheetId) => { var _a; return ((_a = this.figures[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId]) !== undefined; });
|
|
28269
|
+
}
|
|
28216
28270
|
// ---------------------------------------------------------------------------
|
|
28217
28271
|
// Import/Export
|
|
28218
28272
|
// ---------------------------------------------------------------------------
|
|
@@ -28237,7 +28291,7 @@ class FigurePlugin extends CorePlugin {
|
|
|
28237
28291
|
this.export(data);
|
|
28238
28292
|
}
|
|
28239
28293
|
}
|
|
28240
|
-
FigurePlugin.getters = ["getFigures", "getFigure"];
|
|
28294
|
+
FigurePlugin.getters = ["getFigures", "getFigure", "getFigureSheetId"];
|
|
28241
28295
|
|
|
28242
28296
|
class FilterTable {
|
|
28243
28297
|
constructor(zone) {
|
|
@@ -31529,7 +31583,7 @@ class ClipboardFigureState {
|
|
|
31529
31583
|
throw new Error(`No figure for the given id: ${copiedFigureId}`);
|
|
31530
31584
|
}
|
|
31531
31585
|
this.copiedFigure = { ...figure };
|
|
31532
|
-
const chart = getters.getChart(
|
|
31586
|
+
const chart = getters.getChart(copiedFigureId);
|
|
31533
31587
|
if (!chart) {
|
|
31534
31588
|
throw new Error(`No chart for the given id: ${copiedFigureId}`);
|
|
31535
31589
|
}
|
|
@@ -31981,9 +32035,7 @@ class CustomColorsPlugin extends UIPlugin {
|
|
|
31981
32035
|
return formatColors.filter(isDefined$1);
|
|
31982
32036
|
}
|
|
31983
32037
|
getChartColors(sheetId) {
|
|
31984
|
-
const charts = this.getters
|
|
31985
|
-
.getChartIds(sheetId)
|
|
31986
|
-
.map((cid) => this.getters.getChart(sheetId, cid));
|
|
32038
|
+
const charts = this.getters.getChartIds(sheetId).map((cid) => this.getters.getChart(cid));
|
|
31987
32039
|
let chartsColors = new Set();
|
|
31988
32040
|
for (let chart of charts) {
|
|
31989
32041
|
if (chart === undefined) {
|
|
@@ -32250,37 +32302,34 @@ class EvaluationChartPlugin extends UIPlugin {
|
|
|
32250
32302
|
invalidateCFEvaluationCommands.has(cmd.type) ||
|
|
32251
32303
|
cmd.type === "EVALUATE_CELLS" ||
|
|
32252
32304
|
cmd.type === "UPDATE_CELL") {
|
|
32253
|
-
for (const
|
|
32254
|
-
|
|
32255
|
-
this.charts[sheetId][chartId] = undefined;
|
|
32256
|
-
}
|
|
32305
|
+
for (const chartId in this.charts) {
|
|
32306
|
+
this.charts[chartId] = undefined;
|
|
32257
32307
|
}
|
|
32258
32308
|
}
|
|
32259
32309
|
switch (cmd.type) {
|
|
32260
32310
|
case "UPDATE_CHART":
|
|
32261
32311
|
case "CREATE_CHART":
|
|
32262
32312
|
case "DELETE_FIGURE":
|
|
32263
|
-
|
|
32264
|
-
this.charts[cmd.sheetId][cmd.id] = undefined;
|
|
32265
|
-
}
|
|
32313
|
+
this.charts[cmd.id] = undefined;
|
|
32266
32314
|
break;
|
|
32267
32315
|
case "DELETE_SHEET":
|
|
32268
|
-
|
|
32316
|
+
for (let chartId in this.charts) {
|
|
32317
|
+
if (!this.getters.isChartDefined(chartId)) {
|
|
32318
|
+
this.charts[chartId] = undefined;
|
|
32319
|
+
}
|
|
32320
|
+
}
|
|
32269
32321
|
break;
|
|
32270
32322
|
}
|
|
32271
32323
|
}
|
|
32272
|
-
getChartRuntime(
|
|
32273
|
-
|
|
32274
|
-
|
|
32275
|
-
const chart = this.getters.getChart(sheetId, figureId);
|
|
32324
|
+
getChartRuntime(figureId) {
|
|
32325
|
+
if (!this.charts[figureId]) {
|
|
32326
|
+
const chart = this.getters.getChart(figureId);
|
|
32276
32327
|
if (!chart) {
|
|
32277
32328
|
throw new Error(`No chart for the given id: ${figureId}`);
|
|
32278
32329
|
}
|
|
32279
|
-
|
|
32280
|
-
this.charts[sheetId] = {};
|
|
32281
|
-
this.charts[sheetId][figureId] = this.createRuntimeChart(chart);
|
|
32330
|
+
this.charts[figureId] = this.createRuntimeChart(chart);
|
|
32282
32331
|
}
|
|
32283
|
-
return this.charts[
|
|
32332
|
+
return this.charts[figureId];
|
|
32284
32333
|
}
|
|
32285
32334
|
/**
|
|
32286
32335
|
* Get the background color of a chart based on the color of the first cell of the main range
|
|
@@ -42374,6 +42423,6 @@ function addFunction(functionName, functionDescription) {
|
|
|
42374
42423
|
export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
|
|
42375
42424
|
|
|
42376
42425
|
|
|
42377
|
-
__info__.version = '16.0.
|
|
42378
|
-
__info__.date = '2023-03-
|
|
42379
|
-
__info__.hash = '
|
|
42426
|
+
__info__.version = '16.0.2';
|
|
42427
|
+
__info__.date = '2023-03-06T07:17:51.313Z';
|
|
42428
|
+
__info__.hash = '6b4d816';
|