@odoo/o-spreadsheet 16.0.0 → 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 -90
- package/dist/o_spreadsheet.d.ts +20 -19
- package/dist/o_spreadsheet.esm.js +134 -90
- package/dist/o_spreadsheet.iife.js +134 -90
- package/dist/o_spreadsheet.iife.min.js +7 -7
- package/package.json +7 -4
|
@@ -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
|
}
|
|
@@ -8843,7 +8844,6 @@ class ChartPanel extends Component {
|
|
|
8843
8844
|
...this.getChartDefinition(),
|
|
8844
8845
|
...updateDefinition,
|
|
8845
8846
|
};
|
|
8846
|
-
// TODORAR add a putain de test - c'est faux de nouveau ...
|
|
8847
8847
|
return this.env.model.dispatch("UPDATE_CHART", {
|
|
8848
8848
|
definition,
|
|
8849
8849
|
id: this.figureId,
|
|
@@ -8851,12 +8851,11 @@ class ChartPanel extends Component {
|
|
|
8851
8851
|
});
|
|
8852
8852
|
}
|
|
8853
8853
|
onTypeChange(type) {
|
|
8854
|
-
const context = this.env.model.getters.getContextCreationChart(this.
|
|
8854
|
+
const context = this.env.model.getters.getContextCreationChart(this.figureId);
|
|
8855
8855
|
if (!context) {
|
|
8856
8856
|
throw new Error("Chart not defined.");
|
|
8857
8857
|
}
|
|
8858
8858
|
const definition = getChartDefinitionFromContextCreation(context, type);
|
|
8859
|
-
// TODORAR add a putain de test - c'est faux de nouveau ...
|
|
8860
8859
|
this.env.model.dispatch("UPDATE_CHART", {
|
|
8861
8860
|
definition,
|
|
8862
8861
|
id: this.figureId,
|
|
@@ -8864,7 +8863,7 @@ class ChartPanel extends Component {
|
|
|
8864
8863
|
});
|
|
8865
8864
|
}
|
|
8866
8865
|
get chartPanel() {
|
|
8867
|
-
const type = this.env.model.getters.getChartType(this.
|
|
8866
|
+
const type = this.env.model.getters.getChartType(this.figureId);
|
|
8868
8867
|
if (!type) {
|
|
8869
8868
|
throw new Error("Chart not defined.");
|
|
8870
8869
|
}
|
|
@@ -8874,8 +8873,8 @@ class ChartPanel extends Component {
|
|
|
8874
8873
|
}
|
|
8875
8874
|
return chartPanel;
|
|
8876
8875
|
}
|
|
8877
|
-
getChartDefinition() {
|
|
8878
|
-
return this.env.model.getters.getChartDefinition(
|
|
8876
|
+
getChartDefinition(figureId = this.figureId) {
|
|
8877
|
+
return this.env.model.getters.getChartDefinition(figureId);
|
|
8879
8878
|
}
|
|
8880
8879
|
get chartTypes() {
|
|
8881
8880
|
return getChartTypes();
|
|
@@ -10011,7 +10010,7 @@ class ScorecardChart extends Component {
|
|
|
10011
10010
|
this.ctx = document.createElement("canvas").getContext("2d");
|
|
10012
10011
|
}
|
|
10013
10012
|
get runtime() {
|
|
10014
|
-
return this.env.model.getters.getChartRuntime(this.
|
|
10013
|
+
return this.env.model.getters.getChartRuntime(this.props.figure.id);
|
|
10015
10014
|
}
|
|
10016
10015
|
get title() {
|
|
10017
10016
|
return this.runtime.title;
|
|
@@ -10241,7 +10240,7 @@ class ChartFigure extends Component {
|
|
|
10241
10240
|
return registry;
|
|
10242
10241
|
}
|
|
10243
10242
|
get chartType() {
|
|
10244
|
-
return this.env.model.getters.getChartType(this.
|
|
10243
|
+
return this.env.model.getters.getChartType(this.props.figure.id);
|
|
10245
10244
|
}
|
|
10246
10245
|
onContextMenu(ev) {
|
|
10247
10246
|
const position = {
|
|
@@ -26268,13 +26267,7 @@ function load(data, verboseImport) {
|
|
|
26268
26267
|
data = migrate(data);
|
|
26269
26268
|
}
|
|
26270
26269
|
}
|
|
26271
|
-
|
|
26272
|
-
// sensible default values
|
|
26273
|
-
data = Object.assign(createEmptyWorkbookData(), data, { version: CURRENT_VERSION });
|
|
26274
|
-
data.sheets = data.sheets.map((s, i) => Object.assign(createEmptySheet(`Sheet${i + 1}`, `Sheet${i + 1}`), s));
|
|
26275
|
-
if (data.sheets.length === 0) {
|
|
26276
|
-
data.sheets.push(createEmptySheet(INITIAL_SHEET_ID, "Sheet1"));
|
|
26277
|
-
}
|
|
26270
|
+
data = repairData(data);
|
|
26278
26271
|
return data;
|
|
26279
26272
|
}
|
|
26280
26273
|
function migrate(data) {
|
|
@@ -26512,6 +26505,48 @@ const MIGRATIONS = [
|
|
|
26512
26505
|
},
|
|
26513
26506
|
},
|
|
26514
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
|
+
}
|
|
26515
26550
|
/**
|
|
26516
26551
|
* The goal of this function is to repair corrupted/wrong initial messages caused by
|
|
26517
26552
|
* a bug.
|
|
@@ -26650,6 +26685,7 @@ function createEmptyWorkbookData(sheetName = "Sheet1") {
|
|
|
26650
26685
|
formats: {},
|
|
26651
26686
|
borders: {},
|
|
26652
26687
|
revisionId: DEFAULT_REVISION_ID,
|
|
26688
|
+
uniqueFigureIds: true,
|
|
26653
26689
|
};
|
|
26654
26690
|
return data;
|
|
26655
26691
|
}
|
|
@@ -27572,10 +27608,8 @@ class ChartPlugin extends CorePlugin {
|
|
|
27572
27608
|
this.validateChartDefinition = (cmd) => validateChartDefinition(this, cmd.definition);
|
|
27573
27609
|
}
|
|
27574
27610
|
adaptRanges(applyChange) {
|
|
27575
|
-
for (const
|
|
27576
|
-
|
|
27577
|
-
this.history.update("charts", sheetId, chartId, chart === null || chart === void 0 ? void 0 : chart.updateRanges(applyChange));
|
|
27578
|
-
}
|
|
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));
|
|
27579
27613
|
}
|
|
27580
27614
|
}
|
|
27581
27615
|
// ---------------------------------------------------------------------------
|
|
@@ -27586,20 +27620,20 @@ class ChartPlugin extends CorePlugin {
|
|
|
27586
27620
|
case "CREATE_CHART":
|
|
27587
27621
|
return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartDuplicate));
|
|
27588
27622
|
case "UPDATE_CHART":
|
|
27589
|
-
return this.
|
|
27623
|
+
return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartExists));
|
|
27590
27624
|
default:
|
|
27591
27625
|
return 0 /* CommandResult.Success */;
|
|
27592
27626
|
}
|
|
27593
27627
|
}
|
|
27594
27628
|
handle(cmd) {
|
|
27595
|
-
var _a
|
|
27629
|
+
var _a;
|
|
27596
27630
|
switch (cmd.type) {
|
|
27597
27631
|
case "CREATE_CHART":
|
|
27598
27632
|
this.addFigure(cmd.id, cmd.sheetId, cmd.position, cmd.size);
|
|
27599
|
-
this.addChart(cmd.id, cmd.
|
|
27633
|
+
this.addChart(cmd.id, cmd.definition);
|
|
27600
27634
|
break;
|
|
27601
27635
|
case "UPDATE_CHART": {
|
|
27602
|
-
this.addChart(cmd.id, cmd.
|
|
27636
|
+
this.addChart(cmd.id, cmd.definition);
|
|
27603
27637
|
break;
|
|
27604
27638
|
}
|
|
27605
27639
|
case "DUPLICATE_SHEET": {
|
|
@@ -27608,7 +27642,7 @@ class ChartPlugin extends CorePlugin {
|
|
|
27608
27642
|
if (fig.tag === "chart") {
|
|
27609
27643
|
const figureIdBase = fig.id.split(FIGURE_ID_SPLITTER).pop();
|
|
27610
27644
|
const duplicatedFigureId = `${cmd.sheetIdTo}${FIGURE_ID_SPLITTER}${figureIdBase}`;
|
|
27611
|
-
const chart = (
|
|
27645
|
+
const chart = (_a = this.charts[fig.id]) === null || _a === void 0 ? void 0 : _a.copyForSheetId(cmd.sheetIdTo);
|
|
27612
27646
|
if (chart) {
|
|
27613
27647
|
this.dispatch("CREATE_CHART", {
|
|
27614
27648
|
id: duplicatedFigureId,
|
|
@@ -27623,44 +27657,44 @@ class ChartPlugin extends CorePlugin {
|
|
|
27623
27657
|
break;
|
|
27624
27658
|
}
|
|
27625
27659
|
case "DELETE_FIGURE":
|
|
27626
|
-
this.history.update("charts", cmd.
|
|
27660
|
+
this.history.update("charts", cmd.id, undefined);
|
|
27627
27661
|
break;
|
|
27628
27662
|
case "DELETE_SHEET":
|
|
27629
|
-
this.
|
|
27663
|
+
for (let id of this.getChartIds(cmd.sheetId)) {
|
|
27664
|
+
this.history.update("charts", id, undefined);
|
|
27665
|
+
}
|
|
27630
27666
|
break;
|
|
27631
27667
|
}
|
|
27632
27668
|
}
|
|
27633
27669
|
// ---------------------------------------------------------------------------
|
|
27634
27670
|
// Getters
|
|
27635
27671
|
// ---------------------------------------------------------------------------
|
|
27636
|
-
getContextCreationChart(
|
|
27637
|
-
var _a, _b;
|
|
27638
|
-
return (_b = (_a = this.charts[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId]) === null || _b === void 0 ? void 0 : _b.getContextCreation();
|
|
27639
|
-
}
|
|
27640
|
-
getChart(sheetId, figureId) {
|
|
27672
|
+
getContextCreationChart(figureId) {
|
|
27641
27673
|
var _a;
|
|
27642
|
-
return (_a = this.charts[
|
|
27674
|
+
return (_a = this.charts[figureId]) === null || _a === void 0 ? void 0 : _a.getContextCreation();
|
|
27643
27675
|
}
|
|
27644
|
-
|
|
27645
|
-
|
|
27646
|
-
|
|
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;
|
|
27647
27682
|
if (!type) {
|
|
27648
27683
|
throw new Error("Chart not defined.");
|
|
27649
27684
|
}
|
|
27650
27685
|
return type;
|
|
27651
27686
|
}
|
|
27652
|
-
isChartDefined(
|
|
27653
|
-
return figureId in
|
|
27687
|
+
isChartDefined(figureId) {
|
|
27688
|
+
return figureId in this.charts && this.charts !== undefined;
|
|
27654
27689
|
}
|
|
27655
27690
|
getChartIds(sheetId) {
|
|
27656
|
-
|
|
27657
|
-
|
|
27658
|
-
|
|
27659
|
-
return Object.keys(this.charts[sheetId] || {});
|
|
27691
|
+
return Object.entries(this.charts)
|
|
27692
|
+
.filter(([, chart]) => (chart === null || chart === void 0 ? void 0 : chart.sheetId) === sheetId)
|
|
27693
|
+
.map(([id]) => id);
|
|
27660
27694
|
}
|
|
27661
|
-
getChartDefinition(
|
|
27662
|
-
var _a
|
|
27663
|
-
const definition = (
|
|
27695
|
+
getChartDefinition(figureId) {
|
|
27696
|
+
var _a;
|
|
27697
|
+
const definition = (_a = this.charts[figureId]) === null || _a === void 0 ? void 0 : _a.getDefinition();
|
|
27664
27698
|
if (!definition) {
|
|
27665
27699
|
throw new Error(`There is no chart with the given figureId: ${figureId}`);
|
|
27666
27700
|
}
|
|
@@ -27672,28 +27706,35 @@ class ChartPlugin extends CorePlugin {
|
|
|
27672
27706
|
import(data) {
|
|
27673
27707
|
for (let sheet of data.sheets) {
|
|
27674
27708
|
if (sheet.figures) {
|
|
27675
|
-
const charts = {};
|
|
27676
27709
|
for (let figure of sheet.figures) {
|
|
27677
27710
|
// TODO:
|
|
27678
27711
|
// figure data should be external IMO => chart should be in sheet.chart
|
|
27679
27712
|
// instead of in figure.data
|
|
27680
27713
|
if (figure.tag === "chart") {
|
|
27681
|
-
charts[figure.id] = this.createChart(figure.id, figure.data, sheet.id);
|
|
27714
|
+
this.charts[figure.id] = this.createChart(figure.id, figure.data, sheet.id);
|
|
27682
27715
|
}
|
|
27683
27716
|
}
|
|
27684
|
-
this.charts[sheet.id] = charts;
|
|
27685
27717
|
}
|
|
27686
27718
|
}
|
|
27687
27719
|
}
|
|
27688
27720
|
export(data) {
|
|
27721
|
+
var _a;
|
|
27689
27722
|
if (data.sheets) {
|
|
27690
27723
|
for (let sheet of data.sheets) {
|
|
27691
27724
|
// TODO This code is false, if two plugins want ot insert figures on the sheet, it will crash !
|
|
27692
27725
|
const sheetFigures = this.getters.getFigures(sheet.id);
|
|
27693
|
-
const figures =
|
|
27694
|
-
for (let
|
|
27726
|
+
const figures = [];
|
|
27727
|
+
for (let sheetFigure of sheetFigures) {
|
|
27728
|
+
const figure = sheetFigure;
|
|
27695
27729
|
if (figure && figure.tag === "chart") {
|
|
27696
|
-
|
|
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);
|
|
27697
27738
|
}
|
|
27698
27739
|
}
|
|
27699
27740
|
sheet.figures = figures;
|
|
@@ -27701,13 +27742,13 @@ class ChartPlugin extends CorePlugin {
|
|
|
27701
27742
|
}
|
|
27702
27743
|
}
|
|
27703
27744
|
exportForExcel(data) {
|
|
27704
|
-
var _a
|
|
27745
|
+
var _a;
|
|
27705
27746
|
for (let sheet of data.sheets) {
|
|
27706
27747
|
const sheetFigures = this.getters.getFigures(sheet.id);
|
|
27707
27748
|
const figures = [];
|
|
27708
27749
|
for (let figure of sheetFigures) {
|
|
27709
27750
|
if (figure && figure.tag === "chart") {
|
|
27710
|
-
const figureData = (
|
|
27751
|
+
const figureData = (_a = this.charts[figure.id]) === null || _a === void 0 ? void 0 : _a.getDefinitionForExcel();
|
|
27711
27752
|
if (figureData) {
|
|
27712
27753
|
figures.push({
|
|
27713
27754
|
...figure,
|
|
@@ -27746,15 +27787,21 @@ class ChartPlugin extends CorePlugin {
|
|
|
27746
27787
|
* Add a chart in the local state. If a chart already exists, this chart is
|
|
27747
27788
|
* replaced
|
|
27748
27789
|
*/
|
|
27749
|
-
addChart(id,
|
|
27750
|
-
|
|
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
|
+
}
|
|
27751
27795
|
}
|
|
27752
27796
|
checkChartDuplicate(cmd) {
|
|
27753
|
-
|
|
27754
|
-
|
|
27755
|
-
|
|
27756
|
-
|
|
27757
|
-
|
|
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 */;
|
|
27758
27805
|
}
|
|
27759
27806
|
}
|
|
27760
27807
|
ChartPlugin.getters = [
|
|
@@ -28135,7 +28182,7 @@ class FigurePlugin extends CorePlugin {
|
|
|
28135
28182
|
allowDispatch(cmd) {
|
|
28136
28183
|
switch (cmd.type) {
|
|
28137
28184
|
case "CREATE_FIGURE":
|
|
28138
|
-
return this.checkFigureDuplicate(cmd.
|
|
28185
|
+
return this.checkFigureDuplicate(cmd.figure.id);
|
|
28139
28186
|
case "UPDATE_FIGURE":
|
|
28140
28187
|
case "DELETE_FIGURE":
|
|
28141
28188
|
return this.checkFigureExists(cmd.sheetId, cmd.id);
|
|
@@ -28201,9 +28248,8 @@ class FigurePlugin extends CorePlugin {
|
|
|
28201
28248
|
}
|
|
28202
28249
|
return 0 /* CommandResult.Success */;
|
|
28203
28250
|
}
|
|
28204
|
-
checkFigureDuplicate(
|
|
28205
|
-
|
|
28206
|
-
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])) {
|
|
28207
28253
|
return 81 /* CommandResult.DuplicatedFigureId */;
|
|
28208
28254
|
}
|
|
28209
28255
|
return 0 /* CommandResult.Success */;
|
|
@@ -28218,6 +28264,9 @@ class FigurePlugin extends CorePlugin {
|
|
|
28218
28264
|
var _a;
|
|
28219
28265
|
return (_a = this.figures[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId];
|
|
28220
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
|
+
}
|
|
28221
28270
|
// ---------------------------------------------------------------------------
|
|
28222
28271
|
// Import/Export
|
|
28223
28272
|
// ---------------------------------------------------------------------------
|
|
@@ -28242,7 +28291,7 @@ class FigurePlugin extends CorePlugin {
|
|
|
28242
28291
|
this.export(data);
|
|
28243
28292
|
}
|
|
28244
28293
|
}
|
|
28245
|
-
FigurePlugin.getters = ["getFigures", "getFigure"];
|
|
28294
|
+
FigurePlugin.getters = ["getFigures", "getFigure", "getFigureSheetId"];
|
|
28246
28295
|
|
|
28247
28296
|
class FilterTable {
|
|
28248
28297
|
constructor(zone) {
|
|
@@ -31534,7 +31583,7 @@ class ClipboardFigureState {
|
|
|
31534
31583
|
throw new Error(`No figure for the given id: ${copiedFigureId}`);
|
|
31535
31584
|
}
|
|
31536
31585
|
this.copiedFigure = { ...figure };
|
|
31537
|
-
const chart = getters.getChart(
|
|
31586
|
+
const chart = getters.getChart(copiedFigureId);
|
|
31538
31587
|
if (!chart) {
|
|
31539
31588
|
throw new Error(`No chart for the given id: ${copiedFigureId}`);
|
|
31540
31589
|
}
|
|
@@ -31986,9 +32035,7 @@ class CustomColorsPlugin extends UIPlugin {
|
|
|
31986
32035
|
return formatColors.filter(isDefined$1);
|
|
31987
32036
|
}
|
|
31988
32037
|
getChartColors(sheetId) {
|
|
31989
|
-
const charts = this.getters
|
|
31990
|
-
.getChartIds(sheetId)
|
|
31991
|
-
.map((cid) => this.getters.getChart(sheetId, cid));
|
|
32038
|
+
const charts = this.getters.getChartIds(sheetId).map((cid) => this.getters.getChart(cid));
|
|
31992
32039
|
let chartsColors = new Set();
|
|
31993
32040
|
for (let chart of charts) {
|
|
31994
32041
|
if (chart === undefined) {
|
|
@@ -32255,37 +32302,34 @@ class EvaluationChartPlugin extends UIPlugin {
|
|
|
32255
32302
|
invalidateCFEvaluationCommands.has(cmd.type) ||
|
|
32256
32303
|
cmd.type === "EVALUATE_CELLS" ||
|
|
32257
32304
|
cmd.type === "UPDATE_CELL") {
|
|
32258
|
-
for (const
|
|
32259
|
-
|
|
32260
|
-
this.charts[sheetId][chartId] = undefined;
|
|
32261
|
-
}
|
|
32305
|
+
for (const chartId in this.charts) {
|
|
32306
|
+
this.charts[chartId] = undefined;
|
|
32262
32307
|
}
|
|
32263
32308
|
}
|
|
32264
32309
|
switch (cmd.type) {
|
|
32265
32310
|
case "UPDATE_CHART":
|
|
32266
32311
|
case "CREATE_CHART":
|
|
32267
32312
|
case "DELETE_FIGURE":
|
|
32268
|
-
|
|
32269
|
-
this.charts[cmd.sheetId][cmd.id] = undefined;
|
|
32270
|
-
}
|
|
32313
|
+
this.charts[cmd.id] = undefined;
|
|
32271
32314
|
break;
|
|
32272
32315
|
case "DELETE_SHEET":
|
|
32273
|
-
|
|
32316
|
+
for (let chartId in this.charts) {
|
|
32317
|
+
if (!this.getters.isChartDefined(chartId)) {
|
|
32318
|
+
this.charts[chartId] = undefined;
|
|
32319
|
+
}
|
|
32320
|
+
}
|
|
32274
32321
|
break;
|
|
32275
32322
|
}
|
|
32276
32323
|
}
|
|
32277
|
-
getChartRuntime(
|
|
32278
|
-
|
|
32279
|
-
|
|
32280
|
-
const chart = this.getters.getChart(sheetId, figureId);
|
|
32324
|
+
getChartRuntime(figureId) {
|
|
32325
|
+
if (!this.charts[figureId]) {
|
|
32326
|
+
const chart = this.getters.getChart(figureId);
|
|
32281
32327
|
if (!chart) {
|
|
32282
32328
|
throw new Error(`No chart for the given id: ${figureId}`);
|
|
32283
32329
|
}
|
|
32284
|
-
|
|
32285
|
-
this.charts[sheetId] = {};
|
|
32286
|
-
this.charts[sheetId][figureId] = this.createRuntimeChart(chart);
|
|
32330
|
+
this.charts[figureId] = this.createRuntimeChart(chart);
|
|
32287
32331
|
}
|
|
32288
|
-
return this.charts[
|
|
32332
|
+
return this.charts[figureId];
|
|
32289
32333
|
}
|
|
32290
32334
|
/**
|
|
32291
32335
|
* Get the background color of a chart based on the color of the first cell of the main range
|
|
@@ -42379,6 +42423,6 @@ function addFunction(functionName, functionDescription) {
|
|
|
42379
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 };
|
|
42380
42424
|
|
|
42381
42425
|
|
|
42382
|
-
__info__.version = '16.0.
|
|
42383
|
-
__info__.date = '2023-
|
|
42384
|
-
__info__.hash = '
|
|
42426
|
+
__info__.version = '16.0.2';
|
|
42427
|
+
__info__.date = '2023-03-06T07:17:51.313Z';
|
|
42428
|
+
__info__.hash = '6b4d816';
|