@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
|
@@ -2800,7 +2800,7 @@
|
|
|
2800
2800
|
return `background-color: ${this.background}`;
|
|
2801
2801
|
}
|
|
2802
2802
|
get chartRuntime() {
|
|
2803
|
-
const runtime = this.env.model.getters.getChartRuntime(this.
|
|
2803
|
+
const runtime = this.env.model.getters.getChartRuntime(this.props.figure.id);
|
|
2804
2804
|
if (!("chartJsConfig" in runtime)) {
|
|
2805
2805
|
throw new Error("Unsupported chart runtime");
|
|
2806
2806
|
}
|
|
@@ -3169,6 +3169,7 @@
|
|
|
3169
3169
|
CommandResult[CommandResult["DuplicatedFigureId"] = 81] = "DuplicatedFigureId";
|
|
3170
3170
|
CommandResult[CommandResult["InvalidSelectionStep"] = 82] = "InvalidSelectionStep";
|
|
3171
3171
|
CommandResult[CommandResult["DuplicatedChartId"] = 83] = "DuplicatedChartId";
|
|
3172
|
+
CommandResult[CommandResult["ChartDoesNotExist"] = 84] = "ChartDoesNotExist";
|
|
3172
3173
|
})(exports.CommandResult || (exports.CommandResult = {}));
|
|
3173
3174
|
|
|
3174
3175
|
var DIRECTION;
|
|
@@ -8637,7 +8638,7 @@
|
|
|
8637
8638
|
|
|
8638
8639
|
class LineConfigPanel extends LineBarPieConfigPanel {
|
|
8639
8640
|
get canTreatLabelsAsText() {
|
|
8640
|
-
const chart = this.env.model.getters.getChart(this.props.
|
|
8641
|
+
const chart = this.env.model.getters.getChart(this.props.figureId);
|
|
8641
8642
|
if (chart && chart instanceof LineChart) {
|
|
8642
8643
|
return canChartParseLabels(chart, this.env.model.getters);
|
|
8643
8644
|
}
|
|
@@ -8830,7 +8831,7 @@
|
|
|
8830
8831
|
else {
|
|
8831
8832
|
this.shouldUpdateChart = true;
|
|
8832
8833
|
}
|
|
8833
|
-
if (!this.env.model.getters.isChartDefined(this.
|
|
8834
|
+
if (!this.env.model.getters.isChartDefined(this.figureId)) {
|
|
8834
8835
|
this.props.onCloseSidePanel();
|
|
8835
8836
|
return;
|
|
8836
8837
|
}
|
|
@@ -8844,7 +8845,6 @@
|
|
|
8844
8845
|
...this.getChartDefinition(),
|
|
8845
8846
|
...updateDefinition,
|
|
8846
8847
|
};
|
|
8847
|
-
// TODORAR add a putain de test - c'est faux de nouveau ...
|
|
8848
8848
|
return this.env.model.dispatch("UPDATE_CHART", {
|
|
8849
8849
|
definition,
|
|
8850
8850
|
id: this.figureId,
|
|
@@ -8852,12 +8852,11 @@
|
|
|
8852
8852
|
});
|
|
8853
8853
|
}
|
|
8854
8854
|
onTypeChange(type) {
|
|
8855
|
-
const context = this.env.model.getters.getContextCreationChart(this.
|
|
8855
|
+
const context = this.env.model.getters.getContextCreationChart(this.figureId);
|
|
8856
8856
|
if (!context) {
|
|
8857
8857
|
throw new Error("Chart not defined.");
|
|
8858
8858
|
}
|
|
8859
8859
|
const definition = getChartDefinitionFromContextCreation(context, type);
|
|
8860
|
-
// TODORAR add a putain de test - c'est faux de nouveau ...
|
|
8861
8860
|
this.env.model.dispatch("UPDATE_CHART", {
|
|
8862
8861
|
definition,
|
|
8863
8862
|
id: this.figureId,
|
|
@@ -8865,7 +8864,7 @@
|
|
|
8865
8864
|
});
|
|
8866
8865
|
}
|
|
8867
8866
|
get chartPanel() {
|
|
8868
|
-
const type = this.env.model.getters.getChartType(this.
|
|
8867
|
+
const type = this.env.model.getters.getChartType(this.figureId);
|
|
8869
8868
|
if (!type) {
|
|
8870
8869
|
throw new Error("Chart not defined.");
|
|
8871
8870
|
}
|
|
@@ -8875,8 +8874,8 @@
|
|
|
8875
8874
|
}
|
|
8876
8875
|
return chartPanel;
|
|
8877
8876
|
}
|
|
8878
|
-
getChartDefinition() {
|
|
8879
|
-
return this.env.model.getters.getChartDefinition(
|
|
8877
|
+
getChartDefinition(figureId = this.figureId) {
|
|
8878
|
+
return this.env.model.getters.getChartDefinition(figureId);
|
|
8880
8879
|
}
|
|
8881
8880
|
get chartTypes() {
|
|
8882
8881
|
return getChartTypes();
|
|
@@ -10012,7 +10011,7 @@
|
|
|
10012
10011
|
this.ctx = document.createElement("canvas").getContext("2d");
|
|
10013
10012
|
}
|
|
10014
10013
|
get runtime() {
|
|
10015
|
-
return this.env.model.getters.getChartRuntime(this.
|
|
10014
|
+
return this.env.model.getters.getChartRuntime(this.props.figure.id);
|
|
10016
10015
|
}
|
|
10017
10016
|
get title() {
|
|
10018
10017
|
return this.runtime.title;
|
|
@@ -10242,7 +10241,7 @@
|
|
|
10242
10241
|
return registry;
|
|
10243
10242
|
}
|
|
10244
10243
|
get chartType() {
|
|
10245
|
-
return this.env.model.getters.getChartType(this.
|
|
10244
|
+
return this.env.model.getters.getChartType(this.props.figure.id);
|
|
10246
10245
|
}
|
|
10247
10246
|
onContextMenu(ev) {
|
|
10248
10247
|
const position = {
|
|
@@ -26269,13 +26268,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
26269
26268
|
data = migrate(data);
|
|
26270
26269
|
}
|
|
26271
26270
|
}
|
|
26272
|
-
|
|
26273
|
-
// sensible default values
|
|
26274
|
-
data = Object.assign(createEmptyWorkbookData(), data, { version: CURRENT_VERSION });
|
|
26275
|
-
data.sheets = data.sheets.map((s, i) => Object.assign(createEmptySheet(`Sheet${i + 1}`, `Sheet${i + 1}`), s));
|
|
26276
|
-
if (data.sheets.length === 0) {
|
|
26277
|
-
data.sheets.push(createEmptySheet(INITIAL_SHEET_ID, "Sheet1"));
|
|
26278
|
-
}
|
|
26271
|
+
data = repairData(data);
|
|
26279
26272
|
return data;
|
|
26280
26273
|
}
|
|
26281
26274
|
function migrate(data) {
|
|
@@ -26513,6 +26506,48 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
26513
26506
|
},
|
|
26514
26507
|
},
|
|
26515
26508
|
];
|
|
26509
|
+
/**
|
|
26510
|
+
* This function is used to repair faulty data independently of the migration.
|
|
26511
|
+
*/
|
|
26512
|
+
function repairData(data) {
|
|
26513
|
+
data = forceUnicityOfFigure(data);
|
|
26514
|
+
data = setDefaults(data);
|
|
26515
|
+
return data;
|
|
26516
|
+
}
|
|
26517
|
+
/**
|
|
26518
|
+
* Force the unicity of figure ids accross sheets
|
|
26519
|
+
*/
|
|
26520
|
+
function forceUnicityOfFigure(data) {
|
|
26521
|
+
if (data.uniqueFigureIds) {
|
|
26522
|
+
return data;
|
|
26523
|
+
}
|
|
26524
|
+
const figureIds = new Set();
|
|
26525
|
+
const uuidGenerator = new UuidGenerator();
|
|
26526
|
+
for (const sheet of data.sheets || []) {
|
|
26527
|
+
for (const figure of sheet.figures || []) {
|
|
26528
|
+
if (figureIds.has(figure.id)) {
|
|
26529
|
+
figure.id += uuidGenerator.uuidv4();
|
|
26530
|
+
}
|
|
26531
|
+
figureIds.add(figure.id);
|
|
26532
|
+
}
|
|
26533
|
+
}
|
|
26534
|
+
data.uniqueFigureIds = true;
|
|
26535
|
+
return data;
|
|
26536
|
+
}
|
|
26537
|
+
/**
|
|
26538
|
+
* sanity check: try to fix missing fields/corrupted state by providing
|
|
26539
|
+
* sensible default values
|
|
26540
|
+
*/
|
|
26541
|
+
function setDefaults(data) {
|
|
26542
|
+
data = Object.assign(createEmptyWorkbookData(), data, { version: CURRENT_VERSION });
|
|
26543
|
+
data.sheets = data.sheets
|
|
26544
|
+
? data.sheets.map((s, i) => Object.assign(createEmptySheet(`Sheet${i + 1}`, `Sheet${i + 1}`), s))
|
|
26545
|
+
: [];
|
|
26546
|
+
if (data.sheets.length === 0) {
|
|
26547
|
+
data.sheets.push(createEmptySheet(INITIAL_SHEET_ID, "Sheet1"));
|
|
26548
|
+
}
|
|
26549
|
+
return data;
|
|
26550
|
+
}
|
|
26516
26551
|
/**
|
|
26517
26552
|
* The goal of this function is to repair corrupted/wrong initial messages caused by
|
|
26518
26553
|
* a bug.
|
|
@@ -26651,6 +26686,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
26651
26686
|
formats: {},
|
|
26652
26687
|
borders: {},
|
|
26653
26688
|
revisionId: DEFAULT_REVISION_ID,
|
|
26689
|
+
uniqueFigureIds: true,
|
|
26654
26690
|
};
|
|
26655
26691
|
return data;
|
|
26656
26692
|
}
|
|
@@ -27573,10 +27609,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27573
27609
|
this.validateChartDefinition = (cmd) => validateChartDefinition(this, cmd.definition);
|
|
27574
27610
|
}
|
|
27575
27611
|
adaptRanges(applyChange) {
|
|
27576
|
-
for (const
|
|
27577
|
-
|
|
27578
|
-
this.history.update("charts", sheetId, chartId, chart === null || chart === void 0 ? void 0 : chart.updateRanges(applyChange));
|
|
27579
|
-
}
|
|
27612
|
+
for (const [chartId, chart] of Object.entries(this.charts)) {
|
|
27613
|
+
this.history.update("charts", chartId, chart === null || chart === void 0 ? void 0 : chart.updateRanges(applyChange));
|
|
27580
27614
|
}
|
|
27581
27615
|
}
|
|
27582
27616
|
// ---------------------------------------------------------------------------
|
|
@@ -27587,20 +27621,20 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27587
27621
|
case "CREATE_CHART":
|
|
27588
27622
|
return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartDuplicate));
|
|
27589
27623
|
case "UPDATE_CHART":
|
|
27590
|
-
return this.
|
|
27624
|
+
return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartExists));
|
|
27591
27625
|
default:
|
|
27592
27626
|
return 0 /* CommandResult.Success */;
|
|
27593
27627
|
}
|
|
27594
27628
|
}
|
|
27595
27629
|
handle(cmd) {
|
|
27596
|
-
var _a
|
|
27630
|
+
var _a;
|
|
27597
27631
|
switch (cmd.type) {
|
|
27598
27632
|
case "CREATE_CHART":
|
|
27599
27633
|
this.addFigure(cmd.id, cmd.sheetId, cmd.position, cmd.size);
|
|
27600
|
-
this.addChart(cmd.id, cmd.
|
|
27634
|
+
this.addChart(cmd.id, cmd.definition);
|
|
27601
27635
|
break;
|
|
27602
27636
|
case "UPDATE_CHART": {
|
|
27603
|
-
this.addChart(cmd.id, cmd.
|
|
27637
|
+
this.addChart(cmd.id, cmd.definition);
|
|
27604
27638
|
break;
|
|
27605
27639
|
}
|
|
27606
27640
|
case "DUPLICATE_SHEET": {
|
|
@@ -27609,7 +27643,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27609
27643
|
if (fig.tag === "chart") {
|
|
27610
27644
|
const figureIdBase = fig.id.split(FIGURE_ID_SPLITTER).pop();
|
|
27611
27645
|
const duplicatedFigureId = `${cmd.sheetIdTo}${FIGURE_ID_SPLITTER}${figureIdBase}`;
|
|
27612
|
-
const chart = (
|
|
27646
|
+
const chart = (_a = this.charts[fig.id]) === null || _a === void 0 ? void 0 : _a.copyForSheetId(cmd.sheetIdTo);
|
|
27613
27647
|
if (chart) {
|
|
27614
27648
|
this.dispatch("CREATE_CHART", {
|
|
27615
27649
|
id: duplicatedFigureId,
|
|
@@ -27624,44 +27658,44 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27624
27658
|
break;
|
|
27625
27659
|
}
|
|
27626
27660
|
case "DELETE_FIGURE":
|
|
27627
|
-
this.history.update("charts", cmd.
|
|
27661
|
+
this.history.update("charts", cmd.id, undefined);
|
|
27628
27662
|
break;
|
|
27629
27663
|
case "DELETE_SHEET":
|
|
27630
|
-
this.
|
|
27664
|
+
for (let id of this.getChartIds(cmd.sheetId)) {
|
|
27665
|
+
this.history.update("charts", id, undefined);
|
|
27666
|
+
}
|
|
27631
27667
|
break;
|
|
27632
27668
|
}
|
|
27633
27669
|
}
|
|
27634
27670
|
// ---------------------------------------------------------------------------
|
|
27635
27671
|
// Getters
|
|
27636
27672
|
// ---------------------------------------------------------------------------
|
|
27637
|
-
getContextCreationChart(
|
|
27638
|
-
var _a, _b;
|
|
27639
|
-
return (_b = (_a = this.charts[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId]) === null || _b === void 0 ? void 0 : _b.getContextCreation();
|
|
27640
|
-
}
|
|
27641
|
-
getChart(sheetId, figureId) {
|
|
27673
|
+
getContextCreationChart(figureId) {
|
|
27642
27674
|
var _a;
|
|
27643
|
-
return (_a = this.charts[
|
|
27675
|
+
return (_a = this.charts[figureId]) === null || _a === void 0 ? void 0 : _a.getContextCreation();
|
|
27644
27676
|
}
|
|
27645
|
-
|
|
27646
|
-
|
|
27647
|
-
|
|
27677
|
+
getChart(figureId) {
|
|
27678
|
+
return this.charts[figureId];
|
|
27679
|
+
}
|
|
27680
|
+
getChartType(figureId) {
|
|
27681
|
+
var _a;
|
|
27682
|
+
const type = (_a = this.charts[figureId]) === null || _a === void 0 ? void 0 : _a.type;
|
|
27648
27683
|
if (!type) {
|
|
27649
27684
|
throw new Error("Chart not defined.");
|
|
27650
27685
|
}
|
|
27651
27686
|
return type;
|
|
27652
27687
|
}
|
|
27653
|
-
isChartDefined(
|
|
27654
|
-
return figureId in
|
|
27688
|
+
isChartDefined(figureId) {
|
|
27689
|
+
return figureId in this.charts && this.charts !== undefined;
|
|
27655
27690
|
}
|
|
27656
27691
|
getChartIds(sheetId) {
|
|
27657
|
-
|
|
27658
|
-
|
|
27659
|
-
|
|
27660
|
-
return Object.keys(this.charts[sheetId] || {});
|
|
27692
|
+
return Object.entries(this.charts)
|
|
27693
|
+
.filter(([, chart]) => (chart === null || chart === void 0 ? void 0 : chart.sheetId) === sheetId)
|
|
27694
|
+
.map(([id]) => id);
|
|
27661
27695
|
}
|
|
27662
|
-
getChartDefinition(
|
|
27663
|
-
var _a
|
|
27664
|
-
const definition = (
|
|
27696
|
+
getChartDefinition(figureId) {
|
|
27697
|
+
var _a;
|
|
27698
|
+
const definition = (_a = this.charts[figureId]) === null || _a === void 0 ? void 0 : _a.getDefinition();
|
|
27665
27699
|
if (!definition) {
|
|
27666
27700
|
throw new Error(`There is no chart with the given figureId: ${figureId}`);
|
|
27667
27701
|
}
|
|
@@ -27673,28 +27707,35 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27673
27707
|
import(data) {
|
|
27674
27708
|
for (let sheet of data.sheets) {
|
|
27675
27709
|
if (sheet.figures) {
|
|
27676
|
-
const charts = {};
|
|
27677
27710
|
for (let figure of sheet.figures) {
|
|
27678
27711
|
// TODO:
|
|
27679
27712
|
// figure data should be external IMO => chart should be in sheet.chart
|
|
27680
27713
|
// instead of in figure.data
|
|
27681
27714
|
if (figure.tag === "chart") {
|
|
27682
|
-
charts[figure.id] = this.createChart(figure.id, figure.data, sheet.id);
|
|
27715
|
+
this.charts[figure.id] = this.createChart(figure.id, figure.data, sheet.id);
|
|
27683
27716
|
}
|
|
27684
27717
|
}
|
|
27685
|
-
this.charts[sheet.id] = charts;
|
|
27686
27718
|
}
|
|
27687
27719
|
}
|
|
27688
27720
|
}
|
|
27689
27721
|
export(data) {
|
|
27722
|
+
var _a;
|
|
27690
27723
|
if (data.sheets) {
|
|
27691
27724
|
for (let sheet of data.sheets) {
|
|
27692
27725
|
// TODO This code is false, if two plugins want ot insert figures on the sheet, it will crash !
|
|
27693
27726
|
const sheetFigures = this.getters.getFigures(sheet.id);
|
|
27694
|
-
const figures =
|
|
27695
|
-
for (let
|
|
27727
|
+
const figures = [];
|
|
27728
|
+
for (let sheetFigure of sheetFigures) {
|
|
27729
|
+
const figure = sheetFigure;
|
|
27696
27730
|
if (figure && figure.tag === "chart") {
|
|
27697
|
-
|
|
27731
|
+
const data = (_a = this.charts[figure.id]) === null || _a === void 0 ? void 0 : _a.getDefinition();
|
|
27732
|
+
if (data) {
|
|
27733
|
+
figure.data = data;
|
|
27734
|
+
figures.push(figure);
|
|
27735
|
+
}
|
|
27736
|
+
}
|
|
27737
|
+
else {
|
|
27738
|
+
figures.push(figure);
|
|
27698
27739
|
}
|
|
27699
27740
|
}
|
|
27700
27741
|
sheet.figures = figures;
|
|
@@ -27702,13 +27743,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27702
27743
|
}
|
|
27703
27744
|
}
|
|
27704
27745
|
exportForExcel(data) {
|
|
27705
|
-
var _a
|
|
27746
|
+
var _a;
|
|
27706
27747
|
for (let sheet of data.sheets) {
|
|
27707
27748
|
const sheetFigures = this.getters.getFigures(sheet.id);
|
|
27708
27749
|
const figures = [];
|
|
27709
27750
|
for (let figure of sheetFigures) {
|
|
27710
27751
|
if (figure && figure.tag === "chart") {
|
|
27711
|
-
const figureData = (
|
|
27752
|
+
const figureData = (_a = this.charts[figure.id]) === null || _a === void 0 ? void 0 : _a.getDefinitionForExcel();
|
|
27712
27753
|
if (figureData) {
|
|
27713
27754
|
figures.push({
|
|
27714
27755
|
...figure,
|
|
@@ -27747,15 +27788,21 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27747
27788
|
* Add a chart in the local state. If a chart already exists, this chart is
|
|
27748
27789
|
* replaced
|
|
27749
27790
|
*/
|
|
27750
|
-
addChart(id,
|
|
27751
|
-
|
|
27791
|
+
addChart(id, definition) {
|
|
27792
|
+
const sheetId = this.getters.getFigureSheetId(id);
|
|
27793
|
+
if (sheetId) {
|
|
27794
|
+
this.history.update("charts", id, this.createChart(id, definition, sheetId));
|
|
27795
|
+
}
|
|
27752
27796
|
}
|
|
27753
27797
|
checkChartDuplicate(cmd) {
|
|
27754
|
-
|
|
27755
|
-
|
|
27756
|
-
|
|
27757
|
-
|
|
27758
|
-
|
|
27798
|
+
return this.getters.getFigureSheetId(cmd.id)
|
|
27799
|
+
? 83 /* CommandResult.DuplicatedChartId */
|
|
27800
|
+
: 0 /* CommandResult.Success */;
|
|
27801
|
+
}
|
|
27802
|
+
checkChartExists(cmd) {
|
|
27803
|
+
return this.getters.getFigureSheetId(cmd.id)
|
|
27804
|
+
? 0 /* CommandResult.Success */
|
|
27805
|
+
: 84 /* CommandResult.ChartDoesNotExist */;
|
|
27759
27806
|
}
|
|
27760
27807
|
}
|
|
27761
27808
|
ChartPlugin.getters = [
|
|
@@ -28136,7 +28183,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28136
28183
|
allowDispatch(cmd) {
|
|
28137
28184
|
switch (cmd.type) {
|
|
28138
28185
|
case "CREATE_FIGURE":
|
|
28139
|
-
return this.checkFigureDuplicate(cmd.
|
|
28186
|
+
return this.checkFigureDuplicate(cmd.figure.id);
|
|
28140
28187
|
case "UPDATE_FIGURE":
|
|
28141
28188
|
case "DELETE_FIGURE":
|
|
28142
28189
|
return this.checkFigureExists(cmd.sheetId, cmd.id);
|
|
@@ -28202,9 +28249,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28202
28249
|
}
|
|
28203
28250
|
return 0 /* CommandResult.Success */;
|
|
28204
28251
|
}
|
|
28205
|
-
checkFigureDuplicate(
|
|
28206
|
-
|
|
28207
|
-
if ((_a = this.figures[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId]) {
|
|
28252
|
+
checkFigureDuplicate(figureId) {
|
|
28253
|
+
if (Object.values(this.figures).find((sheet) => sheet === null || sheet === void 0 ? void 0 : sheet[figureId])) {
|
|
28208
28254
|
return 81 /* CommandResult.DuplicatedFigureId */;
|
|
28209
28255
|
}
|
|
28210
28256
|
return 0 /* CommandResult.Success */;
|
|
@@ -28219,6 +28265,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28219
28265
|
var _a;
|
|
28220
28266
|
return (_a = this.figures[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId];
|
|
28221
28267
|
}
|
|
28268
|
+
getFigureSheetId(figureId) {
|
|
28269
|
+
return Object.keys(this.figures).find((sheetId) => { var _a; return ((_a = this.figures[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId]) !== undefined; });
|
|
28270
|
+
}
|
|
28222
28271
|
// ---------------------------------------------------------------------------
|
|
28223
28272
|
// Import/Export
|
|
28224
28273
|
// ---------------------------------------------------------------------------
|
|
@@ -28243,7 +28292,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28243
28292
|
this.export(data);
|
|
28244
28293
|
}
|
|
28245
28294
|
}
|
|
28246
|
-
FigurePlugin.getters = ["getFigures", "getFigure"];
|
|
28295
|
+
FigurePlugin.getters = ["getFigures", "getFigure", "getFigureSheetId"];
|
|
28247
28296
|
|
|
28248
28297
|
class FilterTable {
|
|
28249
28298
|
constructor(zone) {
|
|
@@ -31535,7 +31584,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
31535
31584
|
throw new Error(`No figure for the given id: ${copiedFigureId}`);
|
|
31536
31585
|
}
|
|
31537
31586
|
this.copiedFigure = { ...figure };
|
|
31538
|
-
const chart = getters.getChart(
|
|
31587
|
+
const chart = getters.getChart(copiedFigureId);
|
|
31539
31588
|
if (!chart) {
|
|
31540
31589
|
throw new Error(`No chart for the given id: ${copiedFigureId}`);
|
|
31541
31590
|
}
|
|
@@ -31987,9 +32036,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
31987
32036
|
return formatColors.filter(isDefined$1);
|
|
31988
32037
|
}
|
|
31989
32038
|
getChartColors(sheetId) {
|
|
31990
|
-
const charts = this.getters
|
|
31991
|
-
.getChartIds(sheetId)
|
|
31992
|
-
.map((cid) => this.getters.getChart(sheetId, cid));
|
|
32039
|
+
const charts = this.getters.getChartIds(sheetId).map((cid) => this.getters.getChart(cid));
|
|
31993
32040
|
let chartsColors = new Set();
|
|
31994
32041
|
for (let chart of charts) {
|
|
31995
32042
|
if (chart === undefined) {
|
|
@@ -32256,37 +32303,34 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
32256
32303
|
invalidateCFEvaluationCommands.has(cmd.type) ||
|
|
32257
32304
|
cmd.type === "EVALUATE_CELLS" ||
|
|
32258
32305
|
cmd.type === "UPDATE_CELL") {
|
|
32259
|
-
for (const
|
|
32260
|
-
|
|
32261
|
-
this.charts[sheetId][chartId] = undefined;
|
|
32262
|
-
}
|
|
32306
|
+
for (const chartId in this.charts) {
|
|
32307
|
+
this.charts[chartId] = undefined;
|
|
32263
32308
|
}
|
|
32264
32309
|
}
|
|
32265
32310
|
switch (cmd.type) {
|
|
32266
32311
|
case "UPDATE_CHART":
|
|
32267
32312
|
case "CREATE_CHART":
|
|
32268
32313
|
case "DELETE_FIGURE":
|
|
32269
|
-
|
|
32270
|
-
this.charts[cmd.sheetId][cmd.id] = undefined;
|
|
32271
|
-
}
|
|
32314
|
+
this.charts[cmd.id] = undefined;
|
|
32272
32315
|
break;
|
|
32273
32316
|
case "DELETE_SHEET":
|
|
32274
|
-
|
|
32317
|
+
for (let chartId in this.charts) {
|
|
32318
|
+
if (!this.getters.isChartDefined(chartId)) {
|
|
32319
|
+
this.charts[chartId] = undefined;
|
|
32320
|
+
}
|
|
32321
|
+
}
|
|
32275
32322
|
break;
|
|
32276
32323
|
}
|
|
32277
32324
|
}
|
|
32278
|
-
getChartRuntime(
|
|
32279
|
-
|
|
32280
|
-
|
|
32281
|
-
const chart = this.getters.getChart(sheetId, figureId);
|
|
32325
|
+
getChartRuntime(figureId) {
|
|
32326
|
+
if (!this.charts[figureId]) {
|
|
32327
|
+
const chart = this.getters.getChart(figureId);
|
|
32282
32328
|
if (!chart) {
|
|
32283
32329
|
throw new Error(`No chart for the given id: ${figureId}`);
|
|
32284
32330
|
}
|
|
32285
|
-
|
|
32286
|
-
this.charts[sheetId] = {};
|
|
32287
|
-
this.charts[sheetId][figureId] = this.createRuntimeChart(chart);
|
|
32331
|
+
this.charts[figureId] = this.createRuntimeChart(chart);
|
|
32288
32332
|
}
|
|
32289
|
-
return this.charts[
|
|
32333
|
+
return this.charts[figureId];
|
|
32290
32334
|
}
|
|
32291
32335
|
/**
|
|
32292
32336
|
* Get the background color of a chart based on the color of the first cell of the main range
|
|
@@ -42410,9 +42454,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
42410
42454
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
42411
42455
|
|
|
42412
42456
|
|
|
42413
|
-
__info__.version = '16.0.
|
|
42414
|
-
__info__.date = '2023-
|
|
42415
|
-
__info__.hash = '
|
|
42457
|
+
__info__.version = '16.0.2';
|
|
42458
|
+
__info__.date = '2023-03-06T07:17:51.313Z';
|
|
42459
|
+
__info__.hash = '6b4d816';
|
|
42416
42460
|
|
|
42417
42461
|
|
|
42418
42462
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|