@odoo/o-spreadsheet 18.0.1 → 18.1.0-alpha.1
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 +180 -191
- package/dist/o-spreadsheet.d.ts +16 -12
- package/dist/o-spreadsheet.esm.js +180 -191
- package/dist/o-spreadsheet.iife.js +180 -191
- package/dist/o-spreadsheet.iife.min.js +345 -345
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +13 -13
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
4
4
|
* @see https://github.com/odoo/o-spreadsheet
|
|
5
|
-
* @version 18.0.1
|
|
6
|
-
* @date 2024-10-14T07:
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.1.0-alpha.1
|
|
6
|
+
* @date 2024-10-14T07:53:17.717Z
|
|
7
|
+
* @hash e9ce3aa
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -6076,18 +6076,9 @@ function drawDecoratedText(context, text, position, underline = false, strikethr
|
|
|
6076
6076
|
* https://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
|
|
6077
6077
|
* */
|
|
6078
6078
|
class UuidGenerator {
|
|
6079
|
-
isFastIdStrategy = false;
|
|
6080
|
-
fastIdStart = 0;
|
|
6081
|
-
setIsFastStrategy(isFast) {
|
|
6082
|
-
this.isFastIdStrategy = isFast;
|
|
6083
|
-
}
|
|
6084
6079
|
uuidv4() {
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
return String(this.fastIdStart);
|
|
6088
|
-
//@ts-ignore
|
|
6089
|
-
}
|
|
6090
|
-
else if (window.crypto && window.crypto.getRandomValues) {
|
|
6080
|
+
//@ts-ignore
|
|
6081
|
+
if (window.crypto && window.crypto.getRandomValues) {
|
|
6091
6082
|
//@ts-ignore
|
|
6092
6083
|
return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) => (c ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4)))).toString(16));
|
|
6093
6084
|
}
|
|
@@ -9290,6 +9281,49 @@ function getDefinedAxis(definition) {
|
|
|
9290
9281
|
useLeftAxis ||= !useRightAxis;
|
|
9291
9282
|
return { useLeftAxis, useRightAxis };
|
|
9292
9283
|
}
|
|
9284
|
+
function getChartAxis(definition, position, type, options) {
|
|
9285
|
+
const { useLeftAxis, useRightAxis } = getDefinedAxis(definition);
|
|
9286
|
+
if ((position === "left" && !useLeftAxis) || (position === "right" && !useRightAxis)) {
|
|
9287
|
+
return undefined;
|
|
9288
|
+
}
|
|
9289
|
+
const fontColor = chartFontColor(definition.background);
|
|
9290
|
+
let design;
|
|
9291
|
+
if (position === "bottom") {
|
|
9292
|
+
design = definition.axesDesign?.x;
|
|
9293
|
+
}
|
|
9294
|
+
else if (position === "left") {
|
|
9295
|
+
design = definition.axesDesign?.y;
|
|
9296
|
+
}
|
|
9297
|
+
else {
|
|
9298
|
+
design = definition.axesDesign?.y1;
|
|
9299
|
+
}
|
|
9300
|
+
if (type === "values") {
|
|
9301
|
+
const displayGridLines = position === "left" || (position === "right" && !useLeftAxis);
|
|
9302
|
+
return {
|
|
9303
|
+
position: position,
|
|
9304
|
+
title: getChartAxisTitleRuntime(design),
|
|
9305
|
+
grid: {
|
|
9306
|
+
display: displayGridLines,
|
|
9307
|
+
},
|
|
9308
|
+
beginAtZero: true,
|
|
9309
|
+
stacked: options?.stacked,
|
|
9310
|
+
ticks: {
|
|
9311
|
+
color: fontColor,
|
|
9312
|
+
callback: formatTickValue(options),
|
|
9313
|
+
},
|
|
9314
|
+
};
|
|
9315
|
+
}
|
|
9316
|
+
else {
|
|
9317
|
+
return {
|
|
9318
|
+
ticks: {
|
|
9319
|
+
padding: 5,
|
|
9320
|
+
color: fontColor,
|
|
9321
|
+
},
|
|
9322
|
+
stacked: options?.stacked,
|
|
9323
|
+
title: getChartAxisTitleRuntime(design),
|
|
9324
|
+
};
|
|
9325
|
+
}
|
|
9326
|
+
}
|
|
9293
9327
|
function computeChartPadding({ displayTitle, displayLegend, }) {
|
|
9294
9328
|
let top = 25;
|
|
9295
9329
|
if (displayTitle) {
|
|
@@ -9376,6 +9410,12 @@ function interpolateData(config, values, labels, newLabels) {
|
|
|
9376
9410
|
return [];
|
|
9377
9411
|
}
|
|
9378
9412
|
}
|
|
9413
|
+
function formatChartDatasetValue(axisFormats, locale) {
|
|
9414
|
+
return (value, axisId) => {
|
|
9415
|
+
const format = axisId ? axisFormats?.[axisId] : undefined;
|
|
9416
|
+
return formatTickValue({ format, locale })(value);
|
|
9417
|
+
};
|
|
9418
|
+
}
|
|
9379
9419
|
function formatTickValue(localeFormat) {
|
|
9380
9420
|
return (value) => {
|
|
9381
9421
|
value = Number(value);
|
|
@@ -9438,10 +9478,12 @@ const chartShowValuesPlugin = {
|
|
|
9438
9478
|
case "bar":
|
|
9439
9479
|
case "line": {
|
|
9440
9480
|
const yOffset = dataset.type === "bar" && !options.horizontal ? 0 : 3;
|
|
9481
|
+
const horizontalChart = dataset.type === "bar" && options.horizontal;
|
|
9482
|
+
const axisId = horizontalChart ? dataset.xAxisID : dataset.yAxisID;
|
|
9441
9483
|
for (let i = 0; i < dataset._parsed.length; i++) {
|
|
9442
9484
|
const point = dataset.data[i];
|
|
9443
9485
|
const value = options.horizontal ? dataset._parsed[i].x : dataset._parsed[i].y;
|
|
9444
|
-
const displayedValue = options.callback(value - 0);
|
|
9486
|
+
const displayedValue = options.callback(value - 0, axisId);
|
|
9445
9487
|
let xPosition = 0, yPosition = 0;
|
|
9446
9488
|
if (options.horizontal) {
|
|
9447
9489
|
yPosition = point.y;
|
|
@@ -20172,7 +20214,7 @@ class ContentEditableHelper {
|
|
|
20172
20214
|
let startNode = this.findChildAtCharacterIndex(start);
|
|
20173
20215
|
let endNode = this.findChildAtCharacterIndex(end);
|
|
20174
20216
|
range.setStart(startNode.node, startNode.offset);
|
|
20175
|
-
|
|
20217
|
+
range.setEnd(endNode.node, endNode.offset);
|
|
20176
20218
|
}
|
|
20177
20219
|
}
|
|
20178
20220
|
/**
|
|
@@ -20670,7 +20712,7 @@ class Composer extends owl.Component {
|
|
|
20670
20712
|
"Alt+Enter": this.processNewLineEvent,
|
|
20671
20713
|
"Ctrl+Enter": this.processNewLineEvent,
|
|
20672
20714
|
Escape: this.processEscapeKey,
|
|
20673
|
-
F2: () =>
|
|
20715
|
+
F2: (ev) => this.toggleEditionMode(ev),
|
|
20674
20716
|
F4: (ev) => this.processF4Key(ev),
|
|
20675
20717
|
Tab: (ev) => this.processTabKey(ev, "right"),
|
|
20676
20718
|
"Shift+Tab": (ev) => this.processTabKey(ev, "left"),
|
|
@@ -20789,6 +20831,11 @@ class Composer extends owl.Component {
|
|
|
20789
20831
|
this.props.composerStore.cycleReferences();
|
|
20790
20832
|
this.processContent();
|
|
20791
20833
|
}
|
|
20834
|
+
toggleEditionMode(ev) {
|
|
20835
|
+
ev.stopPropagation();
|
|
20836
|
+
this.props.composerStore.toggleEditionMode();
|
|
20837
|
+
this.processContent();
|
|
20838
|
+
}
|
|
20792
20839
|
processNumpadDecimal(ev) {
|
|
20793
20840
|
ev.stopPropagation();
|
|
20794
20841
|
ev.preventDefault();
|
|
@@ -21014,7 +21061,13 @@ class Composer extends owl.Component {
|
|
|
21014
21061
|
break;
|
|
21015
21062
|
case "REFERENCE":
|
|
21016
21063
|
const { xc, sheetName } = splitReference(token.value);
|
|
21017
|
-
result.push({
|
|
21064
|
+
result.push({
|
|
21065
|
+
value: token.value,
|
|
21066
|
+
color: this.rangeColor(xc, sheetName) || "#000",
|
|
21067
|
+
class: tokenAtCursor === token && this.props.composerStore.editionMode === "selecting"
|
|
21068
|
+
? "text-decoration-underline"
|
|
21069
|
+
: undefined,
|
|
21070
|
+
});
|
|
21018
21071
|
break;
|
|
21019
21072
|
case "SYMBOL":
|
|
21020
21073
|
const value = token.value;
|
|
@@ -28040,9 +28093,9 @@ function truncateLabel(label) {
|
|
|
28040
28093
|
/**
|
|
28041
28094
|
* Get a default chart js configuration
|
|
28042
28095
|
*/
|
|
28043
|
-
function getDefaultChartJsRuntime(chart, labels, fontColor, {
|
|
28096
|
+
function getDefaultChartJsRuntime(chart, labels, fontColor, { axisFormats, locale, truncateLabels = true, horizontalChart }) {
|
|
28044
28097
|
const chartTitle = chart.title.text ? chart.title : { ...chart.title, content: "" };
|
|
28045
|
-
const
|
|
28098
|
+
const chartOptions = {
|
|
28046
28099
|
// https://www.chartjs.org/docs/latest/general/responsive.html
|
|
28047
28100
|
responsive: true, // will resize when its container is resized
|
|
28048
28101
|
maintainAspectRatio: false, // doesn't maintain the aspect ration (width/height =2 by default) so the user has the choice of the exact layout
|
|
@@ -28089,8 +28142,10 @@ function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, tr
|
|
|
28089
28142
|
if (!yLabel) {
|
|
28090
28143
|
yLabel = tooltipItem.parsed;
|
|
28091
28144
|
}
|
|
28092
|
-
const
|
|
28093
|
-
|
|
28145
|
+
const axisId = horizontalChart
|
|
28146
|
+
? tooltipItem.dataset.xAxisID
|
|
28147
|
+
: tooltipItem.dataset.yAxisID;
|
|
28148
|
+
const yLabelStr = formatChartDatasetValue(axisFormats, locale)(yLabel, axisId);
|
|
28094
28149
|
return xLabel ? `${xLabel}: ${yLabelStr}` : yLabelStr;
|
|
28095
28150
|
},
|
|
28096
28151
|
},
|
|
@@ -28099,7 +28154,7 @@ function getDefaultChartJsRuntime(chart, labels, fontColor, { format, locale, tr
|
|
|
28099
28154
|
};
|
|
28100
28155
|
return {
|
|
28101
28156
|
type: chart.type,
|
|
28102
|
-
options,
|
|
28157
|
+
options: chartOptions,
|
|
28103
28158
|
data: {
|
|
28104
28159
|
labels: truncateLabels ? labels.map(truncateLabel) : labels,
|
|
28105
28160
|
datasets: [],
|
|
@@ -28158,7 +28213,8 @@ function getChartLabelValues(getters, dataSets, labelRange) {
|
|
|
28158
28213
|
* Get the format to apply to the the dataset values. This format is defined as the first format
|
|
28159
28214
|
* found in the dataset ranges that isn't a date format.
|
|
28160
28215
|
*/
|
|
28161
|
-
function getChartDatasetFormat(getters,
|
|
28216
|
+
function getChartDatasetFormat(getters, allDataSets, axis) {
|
|
28217
|
+
const dataSets = allDataSets.filter((ds) => (axis === "right") === !!ds.rightYAxis);
|
|
28162
28218
|
for (const ds of dataSets) {
|
|
28163
28219
|
const formatsInDataset = getters.getRangeFormats(ds.dataRange);
|
|
28164
28220
|
const format = formatsInDataset.find((f) => f !== undefined && !isDateTimeFormat(f));
|
|
@@ -28412,12 +28468,16 @@ function createBarChartRuntime(chart, getters) {
|
|
|
28412
28468
|
if (chart.aggregated) {
|
|
28413
28469
|
({ labels, dataSetsValues } = aggregateDataForLabels(labels, dataSetsValues));
|
|
28414
28470
|
}
|
|
28415
|
-
const
|
|
28471
|
+
const leftAxisFormat = getChartDatasetFormat(getters, chart.dataSets, "left");
|
|
28472
|
+
const rightAxisFormat = getChartDatasetFormat(getters, chart.dataSets, "right");
|
|
28416
28473
|
const locale = getters.getLocale();
|
|
28417
|
-
const localeFormat = { format: dataSetFormat, locale };
|
|
28418
28474
|
const fontColor = chartFontColor(chart.background);
|
|
28475
|
+
const axisFormats = chart.horizontal
|
|
28476
|
+
? { x: leftAxisFormat || rightAxisFormat }
|
|
28477
|
+
: { y: leftAxisFormat, y1: rightAxisFormat };
|
|
28419
28478
|
const config = getDefaultChartJsRuntime(chart, labels, fontColor, {
|
|
28420
|
-
|
|
28479
|
+
locale,
|
|
28480
|
+
axisFormats,
|
|
28421
28481
|
horizontalChart: chart.horizontal,
|
|
28422
28482
|
});
|
|
28423
28483
|
const legend = {
|
|
@@ -28438,51 +28498,27 @@ function createBarChartRuntime(chart, getters) {
|
|
|
28438
28498
|
};
|
|
28439
28499
|
config.options.indexAxis = chart.horizontal ? "y" : "x";
|
|
28440
28500
|
config.options.scales = {};
|
|
28441
|
-
const
|
|
28442
|
-
const
|
|
28443
|
-
|
|
28444
|
-
|
|
28445
|
-
|
|
28446
|
-
|
|
28447
|
-
},
|
|
28448
|
-
};
|
|
28449
|
-
const xAxis = chart.horizontal ? valuesAxis : labelsAxis;
|
|
28450
|
-
const yAxis = chart.horizontal ? labelsAxis : valuesAxis;
|
|
28451
|
-
const { useLeftAxis, useRightAxis } = getDefinedAxis(chart.getDefinition());
|
|
28452
|
-
config.options.scales.x = { ...xAxis, title: getChartAxisTitleRuntime(chart.axesDesign?.x) };
|
|
28453
|
-
if (useLeftAxis) {
|
|
28454
|
-
config.options.scales.y = {
|
|
28455
|
-
...yAxis,
|
|
28456
|
-
position: "left",
|
|
28457
|
-
title: getChartAxisTitleRuntime(chart.axesDesign?.y),
|
|
28458
|
-
};
|
|
28459
|
-
}
|
|
28460
|
-
if (useRightAxis) {
|
|
28461
|
-
config.options.scales.y1 = {
|
|
28462
|
-
...yAxis,
|
|
28463
|
-
position: "right",
|
|
28464
|
-
title: getChartAxisTitleRuntime(chart.axesDesign?.y1),
|
|
28465
|
-
};
|
|
28501
|
+
const definition = chart.getDefinition();
|
|
28502
|
+
const options = { stacked: chart.stacked, locale };
|
|
28503
|
+
if (chart.horizontal) {
|
|
28504
|
+
const format = leftAxisFormat || rightAxisFormat;
|
|
28505
|
+
config.options.scales.x = getChartAxis(definition, "bottom", "values", { ...options, format });
|
|
28506
|
+
config.options.scales.y = getChartAxis(definition, "left", "labels", options);
|
|
28466
28507
|
}
|
|
28467
|
-
|
|
28468
|
-
|
|
28469
|
-
|
|
28470
|
-
|
|
28471
|
-
|
|
28472
|
-
|
|
28473
|
-
}
|
|
28474
|
-
if (useRightAxis) {
|
|
28475
|
-
// @ts-ignore chart.js type is broken
|
|
28476
|
-
config.options.scales.y1.stacked = true;
|
|
28477
|
-
}
|
|
28508
|
+
else {
|
|
28509
|
+
config.options.scales.x = getChartAxis(definition, "bottom", "labels", options);
|
|
28510
|
+
const leftAxisOptions = { ...options, format: leftAxisFormat };
|
|
28511
|
+
config.options.scales.y = getChartAxis(definition, "left", "values", leftAxisOptions);
|
|
28512
|
+
const rightAxisOptions = { ...options, format: rightAxisFormat };
|
|
28513
|
+
config.options.scales.y1 = getChartAxis(definition, "right", "values", rightAxisOptions);
|
|
28478
28514
|
}
|
|
28515
|
+
config.options.scales = removeFalsyAttributes(config.options.scales);
|
|
28479
28516
|
config.options.plugins.chartShowValuesPlugin = {
|
|
28480
28517
|
showValues: chart.showValues,
|
|
28481
28518
|
background: chart.background,
|
|
28482
28519
|
horizontal: chart.horizontal,
|
|
28483
|
-
callback:
|
|
28520
|
+
callback: formatChartDatasetValue(axisFormats, locale),
|
|
28484
28521
|
};
|
|
28485
|
-
const definition = chart.getDefinition();
|
|
28486
28522
|
const colors = getChartColorsGenerator(definition, dataSetsValues.length);
|
|
28487
28523
|
const trendDatasets = [];
|
|
28488
28524
|
for (const index in dataSetsValues) {
|
|
@@ -28500,9 +28536,8 @@ function createBarChartRuntime(chart, getters) {
|
|
|
28500
28536
|
const label = definition.dataSets[index].label;
|
|
28501
28537
|
dataset.label = label;
|
|
28502
28538
|
}
|
|
28503
|
-
|
|
28504
|
-
|
|
28505
|
-
}
|
|
28539
|
+
dataset.yAxisID = chart.horizontal ? "y" : definition.dataSets[index].yAxisId || "y";
|
|
28540
|
+
dataset.xAxisID = "x";
|
|
28506
28541
|
const trend = definition.dataSets?.[index].trend;
|
|
28507
28542
|
if (!trend?.display || chart.horizontal) {
|
|
28508
28543
|
continue;
|
|
@@ -28518,7 +28553,7 @@ function createBarChartRuntime(chart, getters) {
|
|
|
28518
28553
|
*/
|
|
28519
28554
|
const maxLength = Math.max(...trendDatasets.map((trendDataset) => trendDataset.data.length));
|
|
28520
28555
|
config.options.scales[TREND_LINE_XAXIS_ID] = {
|
|
28521
|
-
...
|
|
28556
|
+
...config.options.scales.x,
|
|
28522
28557
|
labels: Array(maxLength).fill(""),
|
|
28523
28558
|
offset: false,
|
|
28524
28559
|
display: false,
|
|
@@ -28808,8 +28843,10 @@ function createLineOrScatterChartRuntime(chart, getters) {
|
|
|
28808
28843
|
}
|
|
28809
28844
|
const locale = getters.getLocale();
|
|
28810
28845
|
const truncateLabels = axisType === "category";
|
|
28811
|
-
const
|
|
28812
|
-
const
|
|
28846
|
+
const leftAxisFormat = getChartDatasetFormat(getters, chart.dataSets, "left");
|
|
28847
|
+
const rightAxisFormat = getChartDatasetFormat(getters, chart.dataSets, "right");
|
|
28848
|
+
const axisFormats = { y: leftAxisFormat, y1: rightAxisFormat };
|
|
28849
|
+
const options = { locale, truncateLabels, axisFormats };
|
|
28813
28850
|
const fontColor = chartFontColor(chart.background);
|
|
28814
28851
|
const config = getDefaultChartJsRuntime(chart, labels, fontColor, options);
|
|
28815
28852
|
const legend = {
|
|
@@ -28839,52 +28876,18 @@ function createLineOrScatterChartRuntime(chart, getters) {
|
|
|
28839
28876
|
displayLegend: chart.legendPosition === "top",
|
|
28840
28877
|
}),
|
|
28841
28878
|
};
|
|
28842
|
-
const
|
|
28843
|
-
|
|
28844
|
-
padding: 5,
|
|
28845
|
-
color: fontColor,
|
|
28846
|
-
},
|
|
28847
|
-
title: getChartAxisTitleRuntime(chart.axesDesign?.x),
|
|
28848
|
-
};
|
|
28879
|
+
const definition = chart.getDefinition();
|
|
28880
|
+
const stacked = "stacked" in chart && chart.stacked;
|
|
28849
28881
|
config.options.scales = {
|
|
28850
|
-
x:
|
|
28882
|
+
x: getChartAxis(definition, "bottom", "labels", { locale }),
|
|
28883
|
+
y: getChartAxis(definition, "left", "values", { locale, stacked, format: leftAxisFormat }),
|
|
28884
|
+
y1: getChartAxis(definition, "right", "values", { locale, stacked, format: rightAxisFormat }),
|
|
28851
28885
|
};
|
|
28852
|
-
|
|
28853
|
-
beginAtZero: true, // the origin of the y axis is always zero
|
|
28854
|
-
ticks: {
|
|
28855
|
-
color: fontColor,
|
|
28856
|
-
callback: formatTickValue(options),
|
|
28857
|
-
},
|
|
28858
|
-
};
|
|
28859
|
-
const { useLeftAxis, useRightAxis } = getDefinedAxis(chart.getDefinition());
|
|
28860
|
-
if (useLeftAxis) {
|
|
28861
|
-
config.options.scales.y = {
|
|
28862
|
-
...yAxis,
|
|
28863
|
-
position: "left",
|
|
28864
|
-
title: getChartAxisTitleRuntime(chart.axesDesign?.y),
|
|
28865
|
-
};
|
|
28866
|
-
}
|
|
28867
|
-
if (useRightAxis) {
|
|
28868
|
-
config.options.scales.y1 = {
|
|
28869
|
-
...yAxis,
|
|
28870
|
-
position: "right",
|
|
28871
|
-
title: getChartAxisTitleRuntime(chart.axesDesign?.y1),
|
|
28872
|
-
};
|
|
28873
|
-
}
|
|
28874
|
-
if ("stacked" in chart && chart.stacked) {
|
|
28875
|
-
if (useLeftAxis) {
|
|
28876
|
-
// @ts-ignore chart.js type is broken
|
|
28877
|
-
config.options.scales.y.stacked = true;
|
|
28878
|
-
}
|
|
28879
|
-
if (useRightAxis) {
|
|
28880
|
-
// @ts-ignore chart.js type is broken
|
|
28881
|
-
config.options.scales.y1.stacked = true;
|
|
28882
|
-
}
|
|
28883
|
-
}
|
|
28886
|
+
config.options.scales = removeFalsyAttributes(config.options.scales);
|
|
28884
28887
|
config.options.plugins.chartShowValuesPlugin = {
|
|
28885
28888
|
showValues: chart.showValues,
|
|
28886
28889
|
background: chart.background,
|
|
28887
|
-
callback:
|
|
28890
|
+
callback: formatChartDatasetValue(axisFormats, locale),
|
|
28888
28891
|
};
|
|
28889
28892
|
if (chart.dataSetsHaveTitle &&
|
|
28890
28893
|
dataSetsValues[0] &&
|
|
@@ -28911,7 +28914,7 @@ function createLineOrScatterChartRuntime(chart, getters) {
|
|
|
28911
28914
|
label = toNumber(label, locale);
|
|
28912
28915
|
}
|
|
28913
28916
|
const formattedX = formatValue(label, { locale, format: labelFormat });
|
|
28914
|
-
const formattedY = formatValue(dataSetPoint, { locale, format:
|
|
28917
|
+
const formattedY = formatValue(dataSetPoint, { locale, format: leftAxisFormat });
|
|
28915
28918
|
const dataSetTitle = tooltipItem.dataset.label;
|
|
28916
28919
|
return formattedX
|
|
28917
28920
|
? `${dataSetTitle}: (${formattedX}, ${formattedY})`
|
|
@@ -28921,7 +28924,6 @@ function createLineOrScatterChartRuntime(chart, getters) {
|
|
|
28921
28924
|
const areaChart = "fillArea" in chart ? chart.fillArea : false;
|
|
28922
28925
|
const stackedChart = "stacked" in chart ? chart.stacked : false;
|
|
28923
28926
|
const cumulative = "cumulative" in chart ? chart.cumulative : false;
|
|
28924
|
-
const definition = chart.getDefinition();
|
|
28925
28927
|
const colors = getChartColorsGenerator(definition, dataSetsValues.length);
|
|
28926
28928
|
for (let [index, { label, data }] of dataSetsValues.entries()) {
|
|
28927
28929
|
const color = colors.next();
|
|
@@ -28962,9 +28964,7 @@ function createLineOrScatterChartRuntime(chart, getters) {
|
|
|
28962
28964
|
const label = definition.dataSets[index].label;
|
|
28963
28965
|
dataset.label = label;
|
|
28964
28966
|
}
|
|
28965
|
-
|
|
28966
|
-
dataset["yAxisID"] = definition.dataSets[index].yAxisId;
|
|
28967
|
-
}
|
|
28967
|
+
dataset["yAxisID"] = definition.dataSets[index].yAxisId || "y";
|
|
28968
28968
|
const trend = definition.dataSets?.[index].trend;
|
|
28969
28969
|
if (!trend?.display) {
|
|
28970
28970
|
continue;
|
|
@@ -28981,7 +28981,7 @@ function createLineOrScatterChartRuntime(chart, getters) {
|
|
|
28981
28981
|
* set so that the second axis points match the classical x axis
|
|
28982
28982
|
*/
|
|
28983
28983
|
config.options.scales[TREND_LINE_XAXIS_ID] = {
|
|
28984
|
-
...
|
|
28984
|
+
...config.options.scales.x,
|
|
28985
28985
|
type: "category",
|
|
28986
28986
|
labels: range(0, maxLength).map((x) => x.toString()),
|
|
28987
28987
|
offset: false,
|
|
@@ -29003,10 +29003,6 @@ function createLineOrScatterChartRuntime(chart, getters) {
|
|
|
29003
29003
|
return {
|
|
29004
29004
|
chartJsConfig: config,
|
|
29005
29005
|
background: chart.background || BACKGROUND_CHART_COLOR,
|
|
29006
|
-
dataSetsValues,
|
|
29007
|
-
labelValues,
|
|
29008
|
-
dataSetFormat,
|
|
29009
|
-
labelFormat,
|
|
29010
29006
|
};
|
|
29011
29007
|
}
|
|
29012
29008
|
|
|
@@ -29139,10 +29135,8 @@ class ComboChart extends AbstractChart {
|
|
|
29139
29135
|
}
|
|
29140
29136
|
}
|
|
29141
29137
|
function createComboChartRuntime(chart, getters) {
|
|
29142
|
-
const mainDataSetFormat = chart.dataSets
|
|
29143
|
-
|
|
29144
|
-
: undefined;
|
|
29145
|
-
const lineDataSetsFormat = getChartDatasetFormat(getters, chart.dataSets.slice(1));
|
|
29138
|
+
const mainDataSetFormat = getChartDatasetFormat(getters, chart.dataSets, "left");
|
|
29139
|
+
const lineDataSetsFormat = getChartDatasetFormat(getters, chart.dataSets, "right");
|
|
29146
29140
|
const locale = getters.getLocale();
|
|
29147
29141
|
const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
|
|
29148
29142
|
let labels = labelValues.formattedValues;
|
|
@@ -29156,9 +29150,9 @@ function createComboChartRuntime(chart, getters) {
|
|
|
29156
29150
|
if (chart.aggregated) {
|
|
29157
29151
|
({ labels, dataSetsValues } = aggregateDataForLabels(labels, dataSetsValues));
|
|
29158
29152
|
}
|
|
29159
|
-
const localeFormat = { format: mainDataSetFormat, locale };
|
|
29160
29153
|
const fontColor = chartFontColor(chart.background);
|
|
29161
|
-
const
|
|
29154
|
+
const axisFormats = { y: mainDataSetFormat, y1: lineDataSetsFormat };
|
|
29155
|
+
const config = getDefaultChartJsRuntime(chart, labels, fontColor, { locale, axisFormats });
|
|
29162
29156
|
const legend = {
|
|
29163
29157
|
labels: { color: fontColor },
|
|
29164
29158
|
};
|
|
@@ -29175,52 +29169,17 @@ function createComboChartRuntime(chart, getters) {
|
|
|
29175
29169
|
displayLegend: chart.legendPosition === "top",
|
|
29176
29170
|
}),
|
|
29177
29171
|
};
|
|
29172
|
+
const definition = chart.getDefinition();
|
|
29178
29173
|
config.options.scales = {
|
|
29179
|
-
x: {
|
|
29180
|
-
|
|
29181
|
-
|
|
29182
|
-
color: fontColor,
|
|
29183
|
-
},
|
|
29184
|
-
title: getChartAxisTitleRuntime(chart.axesDesign?.x),
|
|
29185
|
-
},
|
|
29186
|
-
};
|
|
29187
|
-
const leftVerticalAxis = {
|
|
29188
|
-
beginAtZero: true, // the origin of the y axis is always zero
|
|
29189
|
-
ticks: {
|
|
29190
|
-
color: fontColor,
|
|
29191
|
-
callback: formatTickValue({ format: mainDataSetFormat, locale }),
|
|
29192
|
-
},
|
|
29174
|
+
x: getChartAxis(definition, "bottom", "labels", { locale }),
|
|
29175
|
+
y: getChartAxis(definition, "left", "values", { locale, format: mainDataSetFormat }),
|
|
29176
|
+
y1: getChartAxis(definition, "right", "values", { locale, format: lineDataSetsFormat }),
|
|
29193
29177
|
};
|
|
29194
|
-
|
|
29195
|
-
beginAtZero: true, // the origin of the y axis is always zero
|
|
29196
|
-
ticks: {
|
|
29197
|
-
color: fontColor,
|
|
29198
|
-
callback: formatTickValue({ format: lineDataSetsFormat, locale }),
|
|
29199
|
-
},
|
|
29200
|
-
};
|
|
29201
|
-
const definition = chart.getDefinition();
|
|
29202
|
-
const { useLeftAxis, useRightAxis } = getDefinedAxis(definition);
|
|
29203
|
-
if (useLeftAxis) {
|
|
29204
|
-
config.options.scales.y = {
|
|
29205
|
-
...leftVerticalAxis,
|
|
29206
|
-
position: "left",
|
|
29207
|
-
title: getChartAxisTitleRuntime(chart.axesDesign?.y),
|
|
29208
|
-
};
|
|
29209
|
-
}
|
|
29210
|
-
if (useRightAxis) {
|
|
29211
|
-
config.options.scales.y1 = {
|
|
29212
|
-
...rightVerticalAxis,
|
|
29213
|
-
position: "right",
|
|
29214
|
-
grid: {
|
|
29215
|
-
display: false,
|
|
29216
|
-
},
|
|
29217
|
-
title: getChartAxisTitleRuntime(chart.axesDesign?.y1),
|
|
29218
|
-
};
|
|
29219
|
-
}
|
|
29178
|
+
config.options.scales = removeFalsyAttributes(config.options.scales);
|
|
29220
29179
|
config.options.plugins.chartShowValuesPlugin = {
|
|
29221
29180
|
showValues: chart.showValues,
|
|
29222
29181
|
background: chart.background,
|
|
29223
|
-
callback:
|
|
29182
|
+
callback: formatChartDatasetValue(axisFormats, locale),
|
|
29224
29183
|
};
|
|
29225
29184
|
const colors = getChartColorsGenerator(definition, dataSetsValues.length);
|
|
29226
29185
|
let maxLength = 0;
|
|
@@ -29849,7 +29808,7 @@ function createPieChartRuntime(chart, getters) {
|
|
|
29849
29808
|
({ labels, dataSetsValues } = aggregateDataForLabels(labels, dataSetsValues));
|
|
29850
29809
|
}
|
|
29851
29810
|
({ dataSetsValues, labels } = filterNegativeValues(labels, dataSetsValues));
|
|
29852
|
-
const dataSetFormat = getChartDatasetFormat(getters, chart.dataSets);
|
|
29811
|
+
const dataSetFormat = getChartDatasetFormat(getters, chart.dataSets, "left");
|
|
29853
29812
|
const locale = getters.getLocale();
|
|
29854
29813
|
const config = getPieConfiguration(chart, labels, { format: dataSetFormat, locale });
|
|
29855
29814
|
const dataSetsLength = Math.max(0, ...dataSetsValues.map((ds) => ds?.data?.length ?? 0));
|
|
@@ -30004,7 +29963,7 @@ function createPyramidChartRuntime(chart, getters) {
|
|
|
30004
29963
|
return tooltipLabelCallback(tooltipItem);
|
|
30005
29964
|
};
|
|
30006
29965
|
const callback = config.options.plugins.chartShowValuesPlugin.callback;
|
|
30007
|
-
config.options.plugins.chartShowValuesPlugin.callback = (x) => callback(Math.abs(x));
|
|
29966
|
+
config.options.plugins.chartShowValuesPlugin.callback = (x, axisId) => callback(Math.abs(x), axisId);
|
|
30008
29967
|
return { chartJsConfig: config, background: chart.background || BACKGROUND_CHART_COLOR };
|
|
30009
29968
|
}
|
|
30010
29969
|
|
|
@@ -30395,7 +30354,8 @@ function createWaterfallChartRuntime(chart, getters) {
|
|
|
30395
30354
|
if (chart.showSubTotals) {
|
|
30396
30355
|
labels.push(_t("Subtotal"));
|
|
30397
30356
|
}
|
|
30398
|
-
const dataSetFormat = getChartDatasetFormat(getters, chart.dataSets)
|
|
30357
|
+
const dataSetFormat = getChartDatasetFormat(getters, chart.dataSets, "left") ||
|
|
30358
|
+
getChartDatasetFormat(getters, chart.dataSets, "right");
|
|
30399
30359
|
const locale = getters.getLocale();
|
|
30400
30360
|
const dataSeriesLabels = dataSetsValues.map((dataSet) => dataSet.label);
|
|
30401
30361
|
const config = getWaterfallConfiguration(chart, labels, dataSeriesLabels, {
|
|
@@ -38122,6 +38082,7 @@ class AbstractComposerStore extends SpreadsheetStore {
|
|
|
38122
38082
|
"stopComposerRangeSelection",
|
|
38123
38083
|
"cancelEdition",
|
|
38124
38084
|
"cycleReferences",
|
|
38085
|
+
"toggleEditionMode",
|
|
38125
38086
|
"changeComposerCursorSelection",
|
|
38126
38087
|
"replaceComposerCursorSelection",
|
|
38127
38088
|
];
|
|
@@ -38277,6 +38238,42 @@ class AbstractComposerStore extends SpreadsheetStore {
|
|
|
38277
38238
|
}
|
|
38278
38239
|
this.setCurrentContent(updated.content, updated.selection);
|
|
38279
38240
|
}
|
|
38241
|
+
toggleEditionMode() {
|
|
38242
|
+
if (this.editionMode === "inactive")
|
|
38243
|
+
return;
|
|
38244
|
+
const start = Math.min(this.selectionStart, this.selectionEnd);
|
|
38245
|
+
const end = Math.max(this.selectionStart, this.selectionEnd);
|
|
38246
|
+
const refToken = [...this.currentTokens]
|
|
38247
|
+
.reverse()
|
|
38248
|
+
.find((tk) => tk.end >= start && end >= tk.start && tk.type === "REFERENCE");
|
|
38249
|
+
if (this.editionMode === "editing" && refToken) {
|
|
38250
|
+
const currentSheetId = this.getters.getActiveSheetId();
|
|
38251
|
+
const { sheetName, xc } = splitReference(refToken.value);
|
|
38252
|
+
const sheetId = this.getters.getSheetIdByName(sheetName);
|
|
38253
|
+
if (sheetId && sheetId !== currentSheetId) {
|
|
38254
|
+
this.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom: currentSheetId, sheetIdTo: sheetId });
|
|
38255
|
+
}
|
|
38256
|
+
// move cursor to the right part of the token
|
|
38257
|
+
this.selectionStart = this.selectionEnd = refToken.end;
|
|
38258
|
+
const zone = this.getters.getRangeFromSheetXC(this.sheetId, xc).zone;
|
|
38259
|
+
this.captureSelection(zone);
|
|
38260
|
+
this.editionMode = "selecting";
|
|
38261
|
+
}
|
|
38262
|
+
else {
|
|
38263
|
+
this.editionMode = "editing";
|
|
38264
|
+
}
|
|
38265
|
+
}
|
|
38266
|
+
captureSelection(zone, col, row) {
|
|
38267
|
+
this.model.selection.capture(this, {
|
|
38268
|
+
cell: { col: col || zone.left, row: row || zone.right },
|
|
38269
|
+
zone,
|
|
38270
|
+
}, {
|
|
38271
|
+
handleEvent: this.handleEvent.bind(this),
|
|
38272
|
+
release: () => {
|
|
38273
|
+
this._stopEdition();
|
|
38274
|
+
},
|
|
38275
|
+
});
|
|
38276
|
+
}
|
|
38280
38277
|
isSelectionValid(length, start, end) {
|
|
38281
38278
|
return start >= 0 && start <= length && end >= 0 && end <= length;
|
|
38282
38279
|
}
|
|
@@ -38315,12 +38312,7 @@ class AbstractComposerStore extends SpreadsheetStore {
|
|
|
38315
38312
|
this.setContent(str || this.initialContent, selection);
|
|
38316
38313
|
this.colorIndexByRange = {};
|
|
38317
38314
|
const zone = positionToZone({ col: this.col, row: this.row });
|
|
38318
|
-
this.
|
|
38319
|
-
handleEvent: this.handleEvent.bind(this),
|
|
38320
|
-
release: () => {
|
|
38321
|
-
this._stopEdition();
|
|
38322
|
-
},
|
|
38323
|
-
});
|
|
38315
|
+
this.captureSelection(zone, col, row);
|
|
38324
38316
|
}
|
|
38325
38317
|
_stopEdition() {
|
|
38326
38318
|
if (this.editionMode !== "inactive") {
|
|
@@ -50003,12 +49995,10 @@ class BasePlugin {
|
|
|
50003
49995
|
*/
|
|
50004
49996
|
class CorePlugin extends BasePlugin {
|
|
50005
49997
|
getters;
|
|
50006
|
-
|
|
50007
|
-
constructor({ getters, stateObserver, range, dispatch, canDispatch, uuidGenerator, }) {
|
|
49998
|
+
constructor({ getters, stateObserver, range, dispatch, canDispatch }) {
|
|
50008
49999
|
super(stateObserver, dispatch, canDispatch);
|
|
50009
50000
|
range.addRangeProvider(this.adaptRanges.bind(this));
|
|
50010
50001
|
this.getters = getters;
|
|
50011
|
-
this.uuidGenerator = uuidGenerator;
|
|
50012
50002
|
}
|
|
50013
50003
|
// ---------------------------------------------------------------------------
|
|
50014
50004
|
// Import/Export
|
|
@@ -54506,6 +54496,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
54506
54496
|
}
|
|
54507
54497
|
}
|
|
54508
54498
|
|
|
54499
|
+
let nextTableId = 1;
|
|
54509
54500
|
class TablePlugin extends CorePlugin {
|
|
54510
54501
|
static getters = ["getCoreTable", "getCoreTables", "getCoreTableMatchingTopLeft"];
|
|
54511
54502
|
tables = {};
|
|
@@ -54573,7 +54564,7 @@ class TablePlugin extends CorePlugin {
|
|
|
54573
54564
|
const union = this.getters.getRangesUnion(ranges);
|
|
54574
54565
|
const mergesInTarget = this.getters.getMergesInZone(cmd.sheetId, union.zone);
|
|
54575
54566
|
this.dispatch("REMOVE_MERGE", { sheetId: cmd.sheetId, target: mergesInTarget });
|
|
54576
|
-
const id =
|
|
54567
|
+
const id = `${nextTableId++}`;
|
|
54577
54568
|
const config = cmd.config || DEFAULT_TABLE_CONFIG;
|
|
54578
54569
|
const newTable = cmd.tableType === "dynamic"
|
|
54579
54570
|
? this.createDynamicTable(id, union, config)
|
|
@@ -54726,7 +54717,7 @@ class TablePlugin extends CorePlugin {
|
|
|
54726
54717
|
filters = [];
|
|
54727
54718
|
for (const i of range(zone.left, zone.right + 1)) {
|
|
54728
54719
|
const filterZone = { ...zone, left: i, right: i };
|
|
54729
|
-
const uid =
|
|
54720
|
+
const uid = `${nextTableId++}`;
|
|
54730
54721
|
filters.push(this.createFilterFromZone(uid, tableRange.sheetId, filterZone, config));
|
|
54731
54722
|
}
|
|
54732
54723
|
}
|
|
@@ -54791,7 +54782,7 @@ class TablePlugin extends CorePlugin {
|
|
|
54791
54782
|
? table.filters.find((f) => f.col === i)
|
|
54792
54783
|
: undefined;
|
|
54793
54784
|
const filterZone = { ...tableZone, left: i, right: i };
|
|
54794
|
-
const filterId = oldFilter?.id ||
|
|
54785
|
+
const filterId = oldFilter?.id || `${nextTableId++}`;
|
|
54795
54786
|
filters.push(this.createFilterFromZone(filterId, tableRange.sheetId, filterZone, config));
|
|
54796
54787
|
}
|
|
54797
54788
|
}
|
|
@@ -54892,7 +54883,7 @@ class TablePlugin extends CorePlugin {
|
|
|
54892
54883
|
if (filters.length < zoneToDimension(tableZone).numberOfCols) {
|
|
54893
54884
|
for (let col = tableZone.left; col <= tableZone.right; col++) {
|
|
54894
54885
|
if (!filters.find((filter) => filter.col === col)) {
|
|
54895
|
-
const uid =
|
|
54886
|
+
const uid = `${nextTableId++}`;
|
|
54896
54887
|
const filterZone = { ...tableZone, left: col, right: col };
|
|
54897
54888
|
filters.push(this.createFilterFromZone(uid, sheetId, filterZone, table.config));
|
|
54898
54889
|
}
|
|
@@ -54908,7 +54899,7 @@ class TablePlugin extends CorePlugin {
|
|
|
54908
54899
|
import(data) {
|
|
54909
54900
|
for (const sheet of data.sheets) {
|
|
54910
54901
|
for (const tableData of sheet.tables || []) {
|
|
54911
|
-
const uuid =
|
|
54902
|
+
const uuid = `${nextTableId++}`;
|
|
54912
54903
|
const tableConfig = tableData.config || DEFAULT_TABLE_CONFIG;
|
|
54913
54904
|
const range = this.getters.getRangeFromSheetXC(sheet.id, tableData.range);
|
|
54914
54905
|
const tableType = tableData.type || "static";
|
|
@@ -71757,7 +71748,6 @@ class Model extends EventBus {
|
|
|
71757
71748
|
this.handlers.push(plugin);
|
|
71758
71749
|
this.uiHandlers.push(plugin);
|
|
71759
71750
|
}
|
|
71760
|
-
this.uuidGenerator.setIsFastStrategy(false);
|
|
71761
71751
|
// starting plugins
|
|
71762
71752
|
this.dispatch("START");
|
|
71763
71753
|
// Model should be the last permanent subscriber in the list since he should render
|
|
@@ -71905,7 +71895,6 @@ class Model extends EventBus {
|
|
|
71905
71895
|
range: this.range,
|
|
71906
71896
|
dispatch: this.dispatchFromCorePlugin,
|
|
71907
71897
|
canDispatch: this.canDispatch,
|
|
71908
|
-
uuidGenerator: this.uuidGenerator,
|
|
71909
71898
|
custom: this.config.custom,
|
|
71910
71899
|
external: this.config.external,
|
|
71911
71900
|
};
|
|
@@ -72399,6 +72388,6 @@ exports.tokenColors = tokenColors;
|
|
|
72399
72388
|
exports.tokenize = tokenize;
|
|
72400
72389
|
|
|
72401
72390
|
|
|
72402
|
-
__info__.version = "18.0.1";
|
|
72403
|
-
__info__.date = "2024-10-14T07:
|
|
72404
|
-
__info__.hash = "
|
|
72391
|
+
__info__.version = "18.1.0-alpha.1";
|
|
72392
|
+
__info__.date = "2024-10-14T07:53:17.717Z";
|
|
72393
|
+
__info__.hash = "e9ce3aa";
|