@odoo/o-spreadsheet 16.0.1 → 16.0.3
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 → o-spreadsheet.cjs.js} +150 -89
- package/dist/{o_spreadsheet.d.ts → o-spreadsheet.d.ts} +21 -20
- package/dist/{o_spreadsheet.esm.js → o-spreadsheet.esm.js} +150 -89
- package/dist/{o_spreadsheet.iife.js → o-spreadsheet.iife.js} +150 -89
- package/dist/{o_spreadsheet.iife.min.js → o-spreadsheet.iife.min.js} +8 -8
- package/package.json +10 -9
- package/readme.md +3 -1
|
@@ -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;
|
|
@@ -8382,7 +8383,7 @@
|
|
|
8382
8383
|
}
|
|
8383
8384
|
onColorClick(color) {
|
|
8384
8385
|
if (color) {
|
|
8385
|
-
this.props.onColorPicked(color);
|
|
8386
|
+
this.props.onColorPicked(toHex(color));
|
|
8386
8387
|
}
|
|
8387
8388
|
}
|
|
8388
8389
|
getCheckMarkColor() {
|
|
@@ -8397,8 +8398,10 @@
|
|
|
8397
8398
|
this.state.isCurrentColorInvalid = true;
|
|
8398
8399
|
return;
|
|
8399
8400
|
}
|
|
8401
|
+
const color = toHex(this.state.currentColor);
|
|
8400
8402
|
this.state.isCurrentColorInvalid = false;
|
|
8401
|
-
this.props.onColorPicked(
|
|
8403
|
+
this.props.onColorPicked(color);
|
|
8404
|
+
this.state.currentColor = color;
|
|
8402
8405
|
}
|
|
8403
8406
|
toggleColorPicker() {
|
|
8404
8407
|
this.state.showGradient = !this.state.showGradient;
|
|
@@ -8637,7 +8640,7 @@
|
|
|
8637
8640
|
|
|
8638
8641
|
class LineConfigPanel extends LineBarPieConfigPanel {
|
|
8639
8642
|
get canTreatLabelsAsText() {
|
|
8640
|
-
const chart = this.env.model.getters.getChart(this.props.
|
|
8643
|
+
const chart = this.env.model.getters.getChart(this.props.figureId);
|
|
8641
8644
|
if (chart && chart instanceof LineChart) {
|
|
8642
8645
|
return canChartParseLabels(chart, this.env.model.getters);
|
|
8643
8646
|
}
|
|
@@ -8830,7 +8833,7 @@
|
|
|
8830
8833
|
else {
|
|
8831
8834
|
this.shouldUpdateChart = true;
|
|
8832
8835
|
}
|
|
8833
|
-
if (!this.env.model.getters.isChartDefined(this.
|
|
8836
|
+
if (!this.env.model.getters.isChartDefined(this.figureId)) {
|
|
8834
8837
|
this.props.onCloseSidePanel();
|
|
8835
8838
|
return;
|
|
8836
8839
|
}
|
|
@@ -8851,7 +8854,7 @@
|
|
|
8851
8854
|
});
|
|
8852
8855
|
}
|
|
8853
8856
|
onTypeChange(type) {
|
|
8854
|
-
const context = this.env.model.getters.getContextCreationChart(this.
|
|
8857
|
+
const context = this.env.model.getters.getContextCreationChart(this.figureId);
|
|
8855
8858
|
if (!context) {
|
|
8856
8859
|
throw new Error("Chart not defined.");
|
|
8857
8860
|
}
|
|
@@ -8863,7 +8866,7 @@
|
|
|
8863
8866
|
});
|
|
8864
8867
|
}
|
|
8865
8868
|
get chartPanel() {
|
|
8866
|
-
const type = this.env.model.getters.getChartType(this.
|
|
8869
|
+
const type = this.env.model.getters.getChartType(this.figureId);
|
|
8867
8870
|
if (!type) {
|
|
8868
8871
|
throw new Error("Chart not defined.");
|
|
8869
8872
|
}
|
|
@@ -8873,8 +8876,8 @@
|
|
|
8873
8876
|
}
|
|
8874
8877
|
return chartPanel;
|
|
8875
8878
|
}
|
|
8876
|
-
getChartDefinition() {
|
|
8877
|
-
return this.env.model.getters.getChartDefinition(
|
|
8879
|
+
getChartDefinition(figureId = this.figureId) {
|
|
8880
|
+
return this.env.model.getters.getChartDefinition(figureId);
|
|
8878
8881
|
}
|
|
8879
8882
|
get chartTypes() {
|
|
8880
8883
|
return getChartTypes();
|
|
@@ -10010,7 +10013,7 @@
|
|
|
10010
10013
|
this.ctx = document.createElement("canvas").getContext("2d");
|
|
10011
10014
|
}
|
|
10012
10015
|
get runtime() {
|
|
10013
|
-
return this.env.model.getters.getChartRuntime(this.
|
|
10016
|
+
return this.env.model.getters.getChartRuntime(this.props.figure.id);
|
|
10014
10017
|
}
|
|
10015
10018
|
get title() {
|
|
10016
10019
|
return this.runtime.title;
|
|
@@ -10035,7 +10038,7 @@
|
|
|
10035
10038
|
return this.runtime.fontColor;
|
|
10036
10039
|
}
|
|
10037
10040
|
get secondaryFontColor() {
|
|
10038
|
-
return relativeLuminance(this.
|
|
10041
|
+
return relativeLuminance(this.backgroundColor) > 0.3 ? "#525252" : "#C8C8C8";
|
|
10039
10042
|
}
|
|
10040
10043
|
get figure() {
|
|
10041
10044
|
return this.props.figure;
|
|
@@ -10240,7 +10243,7 @@
|
|
|
10240
10243
|
return registry;
|
|
10241
10244
|
}
|
|
10242
10245
|
get chartType() {
|
|
10243
|
-
return this.env.model.getters.getChartType(this.
|
|
10246
|
+
return this.env.model.getters.getChartType(this.props.figure.id);
|
|
10244
10247
|
}
|
|
10245
10248
|
onContextMenu(ev) {
|
|
10246
10249
|
const position = {
|
|
@@ -26267,13 +26270,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
26267
26270
|
data = migrate(data);
|
|
26268
26271
|
}
|
|
26269
26272
|
}
|
|
26270
|
-
|
|
26271
|
-
// sensible default values
|
|
26272
|
-
data = Object.assign(createEmptyWorkbookData(), data, { version: CURRENT_VERSION });
|
|
26273
|
-
data.sheets = data.sheets.map((s, i) => Object.assign(createEmptySheet(`Sheet${i + 1}`, `Sheet${i + 1}`), s));
|
|
26274
|
-
if (data.sheets.length === 0) {
|
|
26275
|
-
data.sheets.push(createEmptySheet(INITIAL_SHEET_ID, "Sheet1"));
|
|
26276
|
-
}
|
|
26273
|
+
data = repairData(data);
|
|
26277
26274
|
return data;
|
|
26278
26275
|
}
|
|
26279
26276
|
function migrate(data) {
|
|
@@ -26511,6 +26508,48 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
26511
26508
|
},
|
|
26512
26509
|
},
|
|
26513
26510
|
];
|
|
26511
|
+
/**
|
|
26512
|
+
* This function is used to repair faulty data independently of the migration.
|
|
26513
|
+
*/
|
|
26514
|
+
function repairData(data) {
|
|
26515
|
+
data = forceUnicityOfFigure(data);
|
|
26516
|
+
data = setDefaults(data);
|
|
26517
|
+
return data;
|
|
26518
|
+
}
|
|
26519
|
+
/**
|
|
26520
|
+
* Force the unicity of figure ids accross sheets
|
|
26521
|
+
*/
|
|
26522
|
+
function forceUnicityOfFigure(data) {
|
|
26523
|
+
if (data.uniqueFigureIds) {
|
|
26524
|
+
return data;
|
|
26525
|
+
}
|
|
26526
|
+
const figureIds = new Set();
|
|
26527
|
+
const uuidGenerator = new UuidGenerator();
|
|
26528
|
+
for (const sheet of data.sheets || []) {
|
|
26529
|
+
for (const figure of sheet.figures || []) {
|
|
26530
|
+
if (figureIds.has(figure.id)) {
|
|
26531
|
+
figure.id += uuidGenerator.uuidv4();
|
|
26532
|
+
}
|
|
26533
|
+
figureIds.add(figure.id);
|
|
26534
|
+
}
|
|
26535
|
+
}
|
|
26536
|
+
data.uniqueFigureIds = true;
|
|
26537
|
+
return data;
|
|
26538
|
+
}
|
|
26539
|
+
/**
|
|
26540
|
+
* sanity check: try to fix missing fields/corrupted state by providing
|
|
26541
|
+
* sensible default values
|
|
26542
|
+
*/
|
|
26543
|
+
function setDefaults(data) {
|
|
26544
|
+
data = Object.assign(createEmptyWorkbookData(), data, { version: CURRENT_VERSION });
|
|
26545
|
+
data.sheets = data.sheets
|
|
26546
|
+
? data.sheets.map((s, i) => Object.assign(createEmptySheet(`Sheet${i + 1}`, `Sheet${i + 1}`), s))
|
|
26547
|
+
: [];
|
|
26548
|
+
if (data.sheets.length === 0) {
|
|
26549
|
+
data.sheets.push(createEmptySheet(INITIAL_SHEET_ID, "Sheet1"));
|
|
26550
|
+
}
|
|
26551
|
+
return data;
|
|
26552
|
+
}
|
|
26514
26553
|
/**
|
|
26515
26554
|
* The goal of this function is to repair corrupted/wrong initial messages caused by
|
|
26516
26555
|
* a bug.
|
|
@@ -26649,6 +26688,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
26649
26688
|
formats: {},
|
|
26650
26689
|
borders: {},
|
|
26651
26690
|
revisionId: DEFAULT_REVISION_ID,
|
|
26691
|
+
uniqueFigureIds: true,
|
|
26652
26692
|
};
|
|
26653
26693
|
return data;
|
|
26654
26694
|
}
|
|
@@ -27571,10 +27611,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27571
27611
|
this.validateChartDefinition = (cmd) => validateChartDefinition(this, cmd.definition);
|
|
27572
27612
|
}
|
|
27573
27613
|
adaptRanges(applyChange) {
|
|
27574
|
-
for (const
|
|
27575
|
-
|
|
27576
|
-
this.history.update("charts", sheetId, chartId, chart === null || chart === void 0 ? void 0 : chart.updateRanges(applyChange));
|
|
27577
|
-
}
|
|
27614
|
+
for (const [chartId, chart] of Object.entries(this.charts)) {
|
|
27615
|
+
this.history.update("charts", chartId, chart === null || chart === void 0 ? void 0 : chart.updateRanges(applyChange));
|
|
27578
27616
|
}
|
|
27579
27617
|
}
|
|
27580
27618
|
// ---------------------------------------------------------------------------
|
|
@@ -27585,20 +27623,20 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27585
27623
|
case "CREATE_CHART":
|
|
27586
27624
|
return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartDuplicate));
|
|
27587
27625
|
case "UPDATE_CHART":
|
|
27588
|
-
return this.
|
|
27626
|
+
return this.checkValidations(cmd, this.chainValidations(this.validateChartDefinition, this.checkChartExists));
|
|
27589
27627
|
default:
|
|
27590
27628
|
return 0 /* CommandResult.Success */;
|
|
27591
27629
|
}
|
|
27592
27630
|
}
|
|
27593
27631
|
handle(cmd) {
|
|
27594
|
-
var _a
|
|
27632
|
+
var _a;
|
|
27595
27633
|
switch (cmd.type) {
|
|
27596
27634
|
case "CREATE_CHART":
|
|
27597
27635
|
this.addFigure(cmd.id, cmd.sheetId, cmd.position, cmd.size);
|
|
27598
|
-
this.addChart(cmd.id, cmd.
|
|
27636
|
+
this.addChart(cmd.id, cmd.definition);
|
|
27599
27637
|
break;
|
|
27600
27638
|
case "UPDATE_CHART": {
|
|
27601
|
-
this.addChart(cmd.id, cmd.
|
|
27639
|
+
this.addChart(cmd.id, cmd.definition);
|
|
27602
27640
|
break;
|
|
27603
27641
|
}
|
|
27604
27642
|
case "DUPLICATE_SHEET": {
|
|
@@ -27607,7 +27645,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27607
27645
|
if (fig.tag === "chart") {
|
|
27608
27646
|
const figureIdBase = fig.id.split(FIGURE_ID_SPLITTER).pop();
|
|
27609
27647
|
const duplicatedFigureId = `${cmd.sheetIdTo}${FIGURE_ID_SPLITTER}${figureIdBase}`;
|
|
27610
|
-
const chart = (
|
|
27648
|
+
const chart = (_a = this.charts[fig.id]) === null || _a === void 0 ? void 0 : _a.copyForSheetId(cmd.sheetIdTo);
|
|
27611
27649
|
if (chart) {
|
|
27612
27650
|
this.dispatch("CREATE_CHART", {
|
|
27613
27651
|
id: duplicatedFigureId,
|
|
@@ -27622,41 +27660,44 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27622
27660
|
break;
|
|
27623
27661
|
}
|
|
27624
27662
|
case "DELETE_FIGURE":
|
|
27625
|
-
this.history.update("charts", cmd.
|
|
27663
|
+
this.history.update("charts", cmd.id, undefined);
|
|
27626
27664
|
break;
|
|
27627
27665
|
case "DELETE_SHEET":
|
|
27628
|
-
this.
|
|
27666
|
+
for (let id of this.getChartIds(cmd.sheetId)) {
|
|
27667
|
+
this.history.update("charts", id, undefined);
|
|
27668
|
+
}
|
|
27629
27669
|
break;
|
|
27630
27670
|
}
|
|
27631
27671
|
}
|
|
27632
27672
|
// ---------------------------------------------------------------------------
|
|
27633
27673
|
// Getters
|
|
27634
27674
|
// ---------------------------------------------------------------------------
|
|
27635
|
-
getContextCreationChart(
|
|
27636
|
-
var _a, _b;
|
|
27637
|
-
return (_b = (_a = this.charts[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId]) === null || _b === void 0 ? void 0 : _b.getContextCreation();
|
|
27638
|
-
}
|
|
27639
|
-
getChart(sheetId, figureId) {
|
|
27675
|
+
getContextCreationChart(figureId) {
|
|
27640
27676
|
var _a;
|
|
27641
|
-
return (_a = this.charts[
|
|
27677
|
+
return (_a = this.charts[figureId]) === null || _a === void 0 ? void 0 : _a.getContextCreation();
|
|
27642
27678
|
}
|
|
27643
|
-
|
|
27644
|
-
|
|
27645
|
-
|
|
27679
|
+
getChart(figureId) {
|
|
27680
|
+
return this.charts[figureId];
|
|
27681
|
+
}
|
|
27682
|
+
getChartType(figureId) {
|
|
27683
|
+
var _a;
|
|
27684
|
+
const type = (_a = this.charts[figureId]) === null || _a === void 0 ? void 0 : _a.type;
|
|
27646
27685
|
if (!type) {
|
|
27647
27686
|
throw new Error("Chart not defined.");
|
|
27648
27687
|
}
|
|
27649
27688
|
return type;
|
|
27650
27689
|
}
|
|
27651
|
-
isChartDefined(
|
|
27652
|
-
return figureId in
|
|
27690
|
+
isChartDefined(figureId) {
|
|
27691
|
+
return figureId in this.charts && this.charts !== undefined;
|
|
27653
27692
|
}
|
|
27654
27693
|
getChartIds(sheetId) {
|
|
27655
|
-
return Object.
|
|
27694
|
+
return Object.entries(this.charts)
|
|
27695
|
+
.filter(([, chart]) => (chart === null || chart === void 0 ? void 0 : chart.sheetId) === sheetId)
|
|
27696
|
+
.map(([id]) => id);
|
|
27656
27697
|
}
|
|
27657
|
-
getChartDefinition(
|
|
27658
|
-
var _a
|
|
27659
|
-
const definition = (
|
|
27698
|
+
getChartDefinition(figureId) {
|
|
27699
|
+
var _a;
|
|
27700
|
+
const definition = (_a = this.charts[figureId]) === null || _a === void 0 ? void 0 : _a.getDefinition();
|
|
27660
27701
|
if (!definition) {
|
|
27661
27702
|
throw new Error(`There is no chart with the given figureId: ${figureId}`);
|
|
27662
27703
|
}
|
|
@@ -27668,28 +27709,35 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27668
27709
|
import(data) {
|
|
27669
27710
|
for (let sheet of data.sheets) {
|
|
27670
27711
|
if (sheet.figures) {
|
|
27671
|
-
const charts = {};
|
|
27672
27712
|
for (let figure of sheet.figures) {
|
|
27673
27713
|
// TODO:
|
|
27674
27714
|
// figure data should be external IMO => chart should be in sheet.chart
|
|
27675
27715
|
// instead of in figure.data
|
|
27676
27716
|
if (figure.tag === "chart") {
|
|
27677
|
-
charts[figure.id] = this.createChart(figure.id, figure.data, sheet.id);
|
|
27717
|
+
this.charts[figure.id] = this.createChart(figure.id, figure.data, sheet.id);
|
|
27678
27718
|
}
|
|
27679
27719
|
}
|
|
27680
|
-
this.charts[sheet.id] = charts;
|
|
27681
27720
|
}
|
|
27682
27721
|
}
|
|
27683
27722
|
}
|
|
27684
27723
|
export(data) {
|
|
27724
|
+
var _a;
|
|
27685
27725
|
if (data.sheets) {
|
|
27686
27726
|
for (let sheet of data.sheets) {
|
|
27687
27727
|
// TODO This code is false, if two plugins want ot insert figures on the sheet, it will crash !
|
|
27688
27728
|
const sheetFigures = this.getters.getFigures(sheet.id);
|
|
27689
|
-
const figures =
|
|
27690
|
-
for (let
|
|
27729
|
+
const figures = [];
|
|
27730
|
+
for (let sheetFigure of sheetFigures) {
|
|
27731
|
+
const figure = sheetFigure;
|
|
27691
27732
|
if (figure && figure.tag === "chart") {
|
|
27692
|
-
|
|
27733
|
+
const data = (_a = this.charts[figure.id]) === null || _a === void 0 ? void 0 : _a.getDefinition();
|
|
27734
|
+
if (data) {
|
|
27735
|
+
figure.data = data;
|
|
27736
|
+
figures.push(figure);
|
|
27737
|
+
}
|
|
27738
|
+
}
|
|
27739
|
+
else {
|
|
27740
|
+
figures.push(figure);
|
|
27693
27741
|
}
|
|
27694
27742
|
}
|
|
27695
27743
|
sheet.figures = figures;
|
|
@@ -27697,13 +27745,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27697
27745
|
}
|
|
27698
27746
|
}
|
|
27699
27747
|
exportForExcel(data) {
|
|
27700
|
-
var _a
|
|
27748
|
+
var _a;
|
|
27701
27749
|
for (let sheet of data.sheets) {
|
|
27702
27750
|
const sheetFigures = this.getters.getFigures(sheet.id);
|
|
27703
27751
|
const figures = [];
|
|
27704
27752
|
for (let figure of sheetFigures) {
|
|
27705
27753
|
if (figure && figure.tag === "chart") {
|
|
27706
|
-
const figureData = (
|
|
27754
|
+
const figureData = (_a = this.charts[figure.id]) === null || _a === void 0 ? void 0 : _a.getDefinitionForExcel();
|
|
27707
27755
|
if (figureData) {
|
|
27708
27756
|
figures.push({
|
|
27709
27757
|
...figure,
|
|
@@ -27742,15 +27790,21 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
27742
27790
|
* Add a chart in the local state. If a chart already exists, this chart is
|
|
27743
27791
|
* replaced
|
|
27744
27792
|
*/
|
|
27745
|
-
addChart(id,
|
|
27746
|
-
|
|
27793
|
+
addChart(id, definition) {
|
|
27794
|
+
const sheetId = this.getters.getFigureSheetId(id);
|
|
27795
|
+
if (sheetId) {
|
|
27796
|
+
this.history.update("charts", id, this.createChart(id, definition, sheetId));
|
|
27797
|
+
}
|
|
27747
27798
|
}
|
|
27748
27799
|
checkChartDuplicate(cmd) {
|
|
27749
|
-
|
|
27750
|
-
|
|
27751
|
-
|
|
27752
|
-
|
|
27753
|
-
|
|
27800
|
+
return this.getters.getFigureSheetId(cmd.id)
|
|
27801
|
+
? 83 /* CommandResult.DuplicatedChartId */
|
|
27802
|
+
: 0 /* CommandResult.Success */;
|
|
27803
|
+
}
|
|
27804
|
+
checkChartExists(cmd) {
|
|
27805
|
+
return this.getters.getFigureSheetId(cmd.id)
|
|
27806
|
+
? 0 /* CommandResult.Success */
|
|
27807
|
+
: 84 /* CommandResult.ChartDoesNotExist */;
|
|
27754
27808
|
}
|
|
27755
27809
|
}
|
|
27756
27810
|
ChartPlugin.getters = [
|
|
@@ -28131,7 +28185,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28131
28185
|
allowDispatch(cmd) {
|
|
28132
28186
|
switch (cmd.type) {
|
|
28133
28187
|
case "CREATE_FIGURE":
|
|
28134
|
-
return this.checkFigureDuplicate(cmd.
|
|
28188
|
+
return this.checkFigureDuplicate(cmd.figure.id);
|
|
28135
28189
|
case "UPDATE_FIGURE":
|
|
28136
28190
|
case "DELETE_FIGURE":
|
|
28137
28191
|
return this.checkFigureExists(cmd.sheetId, cmd.id);
|
|
@@ -28197,9 +28251,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28197
28251
|
}
|
|
28198
28252
|
return 0 /* CommandResult.Success */;
|
|
28199
28253
|
}
|
|
28200
|
-
checkFigureDuplicate(
|
|
28201
|
-
|
|
28202
|
-
if ((_a = this.figures[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId]) {
|
|
28254
|
+
checkFigureDuplicate(figureId) {
|
|
28255
|
+
if (Object.values(this.figures).find((sheet) => sheet === null || sheet === void 0 ? void 0 : sheet[figureId])) {
|
|
28203
28256
|
return 81 /* CommandResult.DuplicatedFigureId */;
|
|
28204
28257
|
}
|
|
28205
28258
|
return 0 /* CommandResult.Success */;
|
|
@@ -28214,6 +28267,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28214
28267
|
var _a;
|
|
28215
28268
|
return (_a = this.figures[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId];
|
|
28216
28269
|
}
|
|
28270
|
+
getFigureSheetId(figureId) {
|
|
28271
|
+
return Object.keys(this.figures).find((sheetId) => { var _a; return ((_a = this.figures[sheetId]) === null || _a === void 0 ? void 0 : _a[figureId]) !== undefined; });
|
|
28272
|
+
}
|
|
28217
28273
|
// ---------------------------------------------------------------------------
|
|
28218
28274
|
// Import/Export
|
|
28219
28275
|
// ---------------------------------------------------------------------------
|
|
@@ -28238,7 +28294,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
28238
28294
|
this.export(data);
|
|
28239
28295
|
}
|
|
28240
28296
|
}
|
|
28241
|
-
FigurePlugin.getters = ["getFigures", "getFigure"];
|
|
28297
|
+
FigurePlugin.getters = ["getFigures", "getFigure", "getFigureSheetId"];
|
|
28242
28298
|
|
|
28243
28299
|
class FilterTable {
|
|
28244
28300
|
constructor(zone) {
|
|
@@ -31530,7 +31586,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
31530
31586
|
throw new Error(`No figure for the given id: ${copiedFigureId}`);
|
|
31531
31587
|
}
|
|
31532
31588
|
this.copiedFigure = { ...figure };
|
|
31533
|
-
const chart = getters.getChart(
|
|
31589
|
+
const chart = getters.getChart(copiedFigureId);
|
|
31534
31590
|
if (!chart) {
|
|
31535
31591
|
throw new Error(`No chart for the given id: ${copiedFigureId}`);
|
|
31536
31592
|
}
|
|
@@ -31982,9 +32038,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
31982
32038
|
return formatColors.filter(isDefined$1);
|
|
31983
32039
|
}
|
|
31984
32040
|
getChartColors(sheetId) {
|
|
31985
|
-
const charts = this.getters
|
|
31986
|
-
.getChartIds(sheetId)
|
|
31987
|
-
.map((cid) => this.getters.getChart(sheetId, cid));
|
|
32041
|
+
const charts = this.getters.getChartIds(sheetId).map((cid) => this.getters.getChart(cid));
|
|
31988
32042
|
let chartsColors = new Set();
|
|
31989
32043
|
for (let chart of charts) {
|
|
31990
32044
|
if (chart === undefined) {
|
|
@@ -32251,37 +32305,34 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
32251
32305
|
invalidateCFEvaluationCommands.has(cmd.type) ||
|
|
32252
32306
|
cmd.type === "EVALUATE_CELLS" ||
|
|
32253
32307
|
cmd.type === "UPDATE_CELL") {
|
|
32254
|
-
for (const
|
|
32255
|
-
|
|
32256
|
-
this.charts[sheetId][chartId] = undefined;
|
|
32257
|
-
}
|
|
32308
|
+
for (const chartId in this.charts) {
|
|
32309
|
+
this.charts[chartId] = undefined;
|
|
32258
32310
|
}
|
|
32259
32311
|
}
|
|
32260
32312
|
switch (cmd.type) {
|
|
32261
32313
|
case "UPDATE_CHART":
|
|
32262
32314
|
case "CREATE_CHART":
|
|
32263
32315
|
case "DELETE_FIGURE":
|
|
32264
|
-
|
|
32265
|
-
this.charts[cmd.sheetId][cmd.id] = undefined;
|
|
32266
|
-
}
|
|
32316
|
+
this.charts[cmd.id] = undefined;
|
|
32267
32317
|
break;
|
|
32268
32318
|
case "DELETE_SHEET":
|
|
32269
|
-
|
|
32319
|
+
for (let chartId in this.charts) {
|
|
32320
|
+
if (!this.getters.isChartDefined(chartId)) {
|
|
32321
|
+
this.charts[chartId] = undefined;
|
|
32322
|
+
}
|
|
32323
|
+
}
|
|
32270
32324
|
break;
|
|
32271
32325
|
}
|
|
32272
32326
|
}
|
|
32273
|
-
getChartRuntime(
|
|
32274
|
-
|
|
32275
|
-
|
|
32276
|
-
const chart = this.getters.getChart(sheetId, figureId);
|
|
32327
|
+
getChartRuntime(figureId) {
|
|
32328
|
+
if (!this.charts[figureId]) {
|
|
32329
|
+
const chart = this.getters.getChart(figureId);
|
|
32277
32330
|
if (!chart) {
|
|
32278
32331
|
throw new Error(`No chart for the given id: ${figureId}`);
|
|
32279
32332
|
}
|
|
32280
|
-
|
|
32281
|
-
this.charts[sheetId] = {};
|
|
32282
|
-
this.charts[sheetId][figureId] = this.createRuntimeChart(chart);
|
|
32333
|
+
this.charts[figureId] = this.createRuntimeChart(chart);
|
|
32283
32334
|
}
|
|
32284
|
-
return this.charts[
|
|
32335
|
+
return this.charts[figureId];
|
|
32285
32336
|
}
|
|
32286
32337
|
/**
|
|
32287
32338
|
* Get the background color of a chart based on the color of the first cell of the main range
|
|
@@ -32718,6 +32769,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
32718
32769
|
case "CREATE_SHEET":
|
|
32719
32770
|
this.filterValues[cmd.sheetId] = {};
|
|
32720
32771
|
break;
|
|
32772
|
+
case "HIDE_COLUMNS_ROWS":
|
|
32773
|
+
this.updateHiddenRows();
|
|
32774
|
+
break;
|
|
32721
32775
|
case "UPDATE_FILTER":
|
|
32722
32776
|
this.updateFilter(cmd);
|
|
32723
32777
|
this.updateHiddenRows();
|
|
@@ -32819,9 +32873,16 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
32819
32873
|
updateHiddenRows() {
|
|
32820
32874
|
var _a, _b;
|
|
32821
32875
|
const sheetId = this.getters.getActiveSheetId();
|
|
32822
|
-
const filters = this.getters
|
|
32876
|
+
const filters = this.getters
|
|
32877
|
+
.getFilters(sheetId)
|
|
32878
|
+
.sort((filter1, filter2) => filter1.zoneWithHeaders.top - filter2.zoneWithHeaders.top);
|
|
32823
32879
|
const hiddenRows = new Set();
|
|
32824
32880
|
for (let filter of filters) {
|
|
32881
|
+
// Disable filters whose header are hidden
|
|
32882
|
+
if (this.getters.isRowHiddenByUser(sheetId, filter.zoneWithHeaders.top))
|
|
32883
|
+
continue;
|
|
32884
|
+
if (hiddenRows.has(filter.zoneWithHeaders.top))
|
|
32885
|
+
continue;
|
|
32825
32886
|
const filteredValues = (_b = (_a = this.filterValues[sheetId]) === null || _a === void 0 ? void 0 : _a[filter.id]) === null || _b === void 0 ? void 0 : _b.map(toLowerCase);
|
|
32826
32887
|
if (!filteredValues || !filter.filteredZone)
|
|
32827
32888
|
continue;
|
|
@@ -42405,9 +42466,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
|
|
|
42405
42466
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
42406
42467
|
|
|
42407
42468
|
|
|
42408
|
-
__info__.version = '16.0.
|
|
42409
|
-
__info__.date = '2023-03-
|
|
42410
|
-
__info__.hash = '
|
|
42469
|
+
__info__.version = '16.0.3';
|
|
42470
|
+
__info__.date = '2023-03-14T09:22:56.932Z';
|
|
42471
|
+
__info__.hash = '4deeca9';
|
|
42411
42472
|
|
|
42412
42473
|
|
|
42413
42474
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|