@odoo/o-spreadsheet 18.2.14 → 18.2.16
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 +105 -31
- package/dist/o-spreadsheet.d.ts +5 -2
- package/dist/o-spreadsheet.esm.js +105 -31
- package/dist/o-spreadsheet.iife.js +105 -31
- package/dist/o-spreadsheet.iife.min.js +382 -382
- package/dist/o_spreadsheet.xml +4 -4
- package/package.json +1 -1
|
@@ -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.2.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.2.16
|
|
6
|
+
* @date 2025-06-06T09:32:04.909Z
|
|
7
|
+
* @hash 7ee118c
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -8303,9 +8303,10 @@
|
|
|
8303
8303
|
avg: _t("Average"),
|
|
8304
8304
|
sum: _t("Sum"),
|
|
8305
8305
|
};
|
|
8306
|
+
const NUMBER_CHAR_AGGREGATORS = ["max", "min", "avg", "sum", "count_distinct", "count"];
|
|
8306
8307
|
const AGGREGATORS_BY_FIELD_TYPE = {
|
|
8307
|
-
integer:
|
|
8308
|
-
char:
|
|
8308
|
+
integer: NUMBER_CHAR_AGGREGATORS,
|
|
8309
|
+
char: NUMBER_CHAR_AGGREGATORS,
|
|
8309
8310
|
boolean: ["count_distinct", "count", "bool_and", "bool_or"],
|
|
8310
8311
|
datetime: ["max", "min", "count_distinct", "count"],
|
|
8311
8312
|
};
|
|
@@ -10370,8 +10371,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10370
10371
|
if (isNaN(value)) {
|
|
10371
10372
|
continue;
|
|
10372
10373
|
}
|
|
10373
|
-
const axisId = chart.config.type === "radar" ? dataset.rAxisID : dataset.yAxisID;
|
|
10374
|
-
const displayValue = options.callback(Number(value), axisId);
|
|
10375
10374
|
const point = dataset.data[i];
|
|
10376
10375
|
const xPosition = point.x;
|
|
10377
10376
|
let yPosition = 0;
|
|
@@ -10395,7 +10394,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10395
10394
|
textsPositions[xPosition].push(yPosition);
|
|
10396
10395
|
ctx.fillStyle = point.options.backgroundColor;
|
|
10397
10396
|
ctx.strokeStyle = options.background || "#ffffff";
|
|
10398
|
-
|
|
10397
|
+
const valueToDisplay = options.callback(Number(value), dataset, i);
|
|
10398
|
+
drawTextWithBackground(valueToDisplay, xPosition, yPosition, ctx);
|
|
10399
10399
|
}
|
|
10400
10400
|
}
|
|
10401
10401
|
}
|
|
@@ -10412,7 +10412,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10412
10412
|
if (isNaN(value)) {
|
|
10413
10413
|
continue;
|
|
10414
10414
|
}
|
|
10415
|
-
const displayValue = options.callback(value, dataset
|
|
10415
|
+
const displayValue = options.callback(value, dataset, i);
|
|
10416
10416
|
const point = dataset.data[i];
|
|
10417
10417
|
const yPosition = point.y;
|
|
10418
10418
|
let xPosition = value < 0 ? point.x + point.width / 2 : point.x - point.width / 2;
|
|
@@ -10450,7 +10450,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10450
10450
|
const y = bar.y + midRadius * Math.sin(midAngle) + 7;
|
|
10451
10451
|
ctx.fillStyle = chartFontColor(options.background);
|
|
10452
10452
|
ctx.strokeStyle = options.background || "#ffffff";
|
|
10453
|
-
const displayValue = options.callback(value,
|
|
10453
|
+
const displayValue = options.callback(value, dataset, i);
|
|
10454
10454
|
drawTextWithBackground(displayValue, x, y, ctx);
|
|
10455
10455
|
}
|
|
10456
10456
|
}
|
|
@@ -30083,9 +30083,51 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
30083
30083
|
horizontal: "horizontal" in definition && definition.horizontal,
|
|
30084
30084
|
showValues: "showValues" in definition ? !!definition.showValues : false,
|
|
30085
30085
|
background: definition.background,
|
|
30086
|
-
callback:
|
|
30086
|
+
callback: (value, dataset) => {
|
|
30087
|
+
const axisId = getDatasetAxisId(definition, dataset);
|
|
30088
|
+
return formatChartDatasetValue(axisFormats, locale)(value, axisId);
|
|
30089
|
+
},
|
|
30090
|
+
};
|
|
30091
|
+
}
|
|
30092
|
+
function getPyramidChartShowValues(definition, args) {
|
|
30093
|
+
const { axisFormats, locale } = args;
|
|
30094
|
+
return {
|
|
30095
|
+
horizontal: true,
|
|
30096
|
+
showValues: "showValues" in definition ? !!definition.showValues : false,
|
|
30097
|
+
background: definition.background,
|
|
30098
|
+
callback: (value, dataset) => {
|
|
30099
|
+
value = Math.abs(Number(value));
|
|
30100
|
+
return formatChartDatasetValue(axisFormats, locale)(value, dataset.xAxisID || "x");
|
|
30101
|
+
},
|
|
30102
|
+
};
|
|
30103
|
+
}
|
|
30104
|
+
function getWaterfallChartShowValues(definition, args) {
|
|
30105
|
+
const { axisFormats, locale, dataSetsValues } = args;
|
|
30106
|
+
const subtotalIndexes = dataSetsValues.reduce((subtotalIndexes, ds) => {
|
|
30107
|
+
subtotalIndexes.push((subtotalIndexes.at(-1) || -1) + ds.data.length + 1);
|
|
30108
|
+
return subtotalIndexes;
|
|
30109
|
+
}, []);
|
|
30110
|
+
return {
|
|
30111
|
+
showValues: "showValues" in definition ? !!definition.showValues : false,
|
|
30112
|
+
background: definition.background,
|
|
30113
|
+
callback: (value, dataset, index) => {
|
|
30114
|
+
const raw = dataset._dataset.data[index];
|
|
30115
|
+
const delta = raw[1] - raw[0];
|
|
30116
|
+
let sign = delta >= 0 ? "+" : "";
|
|
30117
|
+
if (definition.showSubTotals && subtotalIndexes.includes(index) && sign === "+") {
|
|
30118
|
+
sign = "";
|
|
30119
|
+
}
|
|
30120
|
+
return `${sign}${formatChartDatasetValue(axisFormats, locale)(delta, dataset.yAxisID)}`;
|
|
30121
|
+
},
|
|
30087
30122
|
};
|
|
30088
30123
|
}
|
|
30124
|
+
function getDatasetAxisId(definition, dataset) {
|
|
30125
|
+
if (dataset.rAxisID) {
|
|
30126
|
+
return dataset.rAxisID;
|
|
30127
|
+
}
|
|
30128
|
+
const axisId = "horizontal" in definition && definition.horizontal ? dataset.xAxisID : dataset.yAxisID;
|
|
30129
|
+
return axisId || "y";
|
|
30130
|
+
}
|
|
30089
30131
|
|
|
30090
30132
|
function getChartTitle(definition) {
|
|
30091
30133
|
const chartTitle = definition.title;
|
|
@@ -30409,6 +30451,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
30409
30451
|
getPieChartTooltip: getPieChartTooltip,
|
|
30410
30452
|
getPyramidChartData: getPyramidChartData,
|
|
30411
30453
|
getPyramidChartScales: getPyramidChartScales,
|
|
30454
|
+
getPyramidChartShowValues: getPyramidChartShowValues,
|
|
30412
30455
|
getPyramidChartTooltip: getPyramidChartTooltip,
|
|
30413
30456
|
getRadarChartData: getRadarChartData,
|
|
30414
30457
|
getRadarChartDatasets: getRadarChartDatasets,
|
|
@@ -30422,6 +30465,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
30422
30465
|
getTrendDatasetForLineChart: getTrendDatasetForLineChart,
|
|
30423
30466
|
getWaterfallChartLegend: getWaterfallChartLegend,
|
|
30424
30467
|
getWaterfallChartScales: getWaterfallChartScales,
|
|
30468
|
+
getWaterfallChartShowValues: getWaterfallChartShowValues,
|
|
30425
30469
|
getWaterfallChartTooltip: getWaterfallChartTooltip,
|
|
30426
30470
|
getWaterfallDatasetAndLabels: getWaterfallDatasetAndLabels
|
|
30427
30471
|
});
|
|
@@ -31554,7 +31598,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
31554
31598
|
title: getChartTitle(definition),
|
|
31555
31599
|
legend: getBarChartLegend(definition),
|
|
31556
31600
|
tooltip: getPyramidChartTooltip(definition, chartData),
|
|
31557
|
-
chartShowValuesPlugin:
|
|
31601
|
+
chartShowValuesPlugin: getPyramidChartShowValues(definition, chartData),
|
|
31558
31602
|
},
|
|
31559
31603
|
},
|
|
31560
31604
|
};
|
|
@@ -32017,7 +32061,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
32017
32061
|
title: getChartTitle(definition),
|
|
32018
32062
|
legend: getWaterfallChartLegend(definition),
|
|
32019
32063
|
tooltip: getWaterfallChartTooltip(definition, chartData),
|
|
32020
|
-
chartShowValuesPlugin:
|
|
32064
|
+
chartShowValuesPlugin: getWaterfallChartShowValues(definition, chartData),
|
|
32021
32065
|
waterfallLinesPlugin: { showConnectorLines: definition.showConnectorLines },
|
|
32022
32066
|
},
|
|
32023
32067
|
},
|
|
@@ -44663,13 +44707,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
44663
44707
|
if (this.selectedMatchIndex === null) {
|
|
44664
44708
|
return;
|
|
44665
44709
|
}
|
|
44710
|
+
this.preserveSelectedMatchIndex = true;
|
|
44711
|
+
this.shouldFinalizeUpdateSelection = true;
|
|
44666
44712
|
this.model.dispatch("REPLACE_SEARCH", {
|
|
44667
44713
|
searchString: this.toSearch,
|
|
44668
44714
|
replaceWith: this.toReplace,
|
|
44669
44715
|
matches: [this.searchMatches[this.selectedMatchIndex]],
|
|
44670
44716
|
searchOptions: this.searchOptions,
|
|
44671
44717
|
});
|
|
44672
|
-
this.
|
|
44718
|
+
this.preserveSelectedMatchIndex = false;
|
|
44673
44719
|
}
|
|
44674
44720
|
/**
|
|
44675
44721
|
* Apply the replace function to all the matches one time.
|
|
@@ -47095,12 +47141,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47095
47141
|
entry[field.name] = { value: null, type: CellValueType.empty, formattedValue: "" };
|
|
47096
47142
|
}
|
|
47097
47143
|
else {
|
|
47098
|
-
|
|
47099
|
-
entry[field.name] = { ...cell, value: cell.formattedValue || null };
|
|
47100
|
-
}
|
|
47101
|
-
else {
|
|
47102
|
-
entry[field.name] = cell;
|
|
47103
|
-
}
|
|
47144
|
+
entry[field.name] = cell;
|
|
47104
47145
|
}
|
|
47105
47146
|
}
|
|
47106
47147
|
entry["__count"] = { value: 1, type: CellValueType.number, formattedValue: "1" };
|
|
@@ -52275,6 +52316,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52275
52316
|
let deltaX = lastX - clientX;
|
|
52276
52317
|
let deltaY = lastY - clientY;
|
|
52277
52318
|
const elapsedTime = currentTime - lastTime;
|
|
52319
|
+
if (!elapsedTime) {
|
|
52320
|
+
return;
|
|
52321
|
+
}
|
|
52278
52322
|
velocityX = deltaX / elapsedTime;
|
|
52279
52323
|
velocityY = deltaY / elapsedTime;
|
|
52280
52324
|
lastX = clientX;
|
|
@@ -52295,6 +52339,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52295
52339
|
function onTouchEnd(ev) {
|
|
52296
52340
|
isMouseDown = false;
|
|
52297
52341
|
lastX = lastY = 0;
|
|
52342
|
+
if (resetTimeout) {
|
|
52343
|
+
clearTimeout(resetTimeout);
|
|
52344
|
+
}
|
|
52345
|
+
velocityX *= 1.2;
|
|
52346
|
+
velocityY *= 1.2;
|
|
52298
52347
|
requestAnimationFrame(scroll);
|
|
52299
52348
|
}
|
|
52300
52349
|
function scroll() {
|
|
@@ -59435,7 +59484,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59435
59484
|
break;
|
|
59436
59485
|
}
|
|
59437
59486
|
case "UPDATE_PIVOT": {
|
|
59438
|
-
this.history.update("pivots", cmd.pivotId, "definition", deepCopy(cmd.pivot));
|
|
59487
|
+
this.history.update("pivots", cmd.pivotId, "definition", this.repairSortedColumn(deepCopy(cmd.pivot)));
|
|
59439
59488
|
this.compileCalculatedMeasures(cmd.pivot.measures);
|
|
59440
59489
|
break;
|
|
59441
59490
|
}
|
|
@@ -59506,7 +59555,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59506
59555
|
// Private
|
|
59507
59556
|
// -------------------------------------------------------------------------
|
|
59508
59557
|
addPivot(pivotId, pivot, formulaId = this.nextFormulaId.toString()) {
|
|
59509
|
-
this.history.update("pivots", pivotId, {
|
|
59558
|
+
this.history.update("pivots", pivotId, {
|
|
59559
|
+
definition: this.repairSortedColumn(deepCopy(pivot)),
|
|
59560
|
+
formulaId,
|
|
59561
|
+
});
|
|
59510
59562
|
this.compileCalculatedMeasures(pivot.measures);
|
|
59511
59563
|
this.history.update("formulaIds", formulaId, pivotId);
|
|
59512
59564
|
this.history.update("nextFormulaId", this.nextFormulaId + 1);
|
|
@@ -59599,6 +59651,26 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59599
59651
|
}
|
|
59600
59652
|
return "Success" /* CommandResult.Success */;
|
|
59601
59653
|
}
|
|
59654
|
+
repairSortedColumn(definition) {
|
|
59655
|
+
if (definition.sortedColumn) {
|
|
59656
|
+
// Fix for an upgrade issue: the sortedColumn measure was not updated
|
|
59657
|
+
// from using fieldName to using id. If the sortedColumn measure matches
|
|
59658
|
+
// a measure fieldName in the definition, update it to use the measure's id instead
|
|
59659
|
+
// of its fieldName.
|
|
59660
|
+
// TODO: add an upgrade step to fix this in master and remove this code
|
|
59661
|
+
const sortedMeasure = definition.measures.find((measure) => measure.fieldName === definition.sortedColumn?.measure);
|
|
59662
|
+
if (sortedMeasure) {
|
|
59663
|
+
return {
|
|
59664
|
+
...definition,
|
|
59665
|
+
sortedColumn: {
|
|
59666
|
+
...definition.sortedColumn,
|
|
59667
|
+
measure: sortedMeasure.id,
|
|
59668
|
+
},
|
|
59669
|
+
};
|
|
59670
|
+
}
|
|
59671
|
+
}
|
|
59672
|
+
return definition;
|
|
59673
|
+
}
|
|
59602
59674
|
// ---------------------------------------------------------------------
|
|
59603
59675
|
// Import/Export
|
|
59604
59676
|
// ---------------------------------------------------------------------
|
|
@@ -68510,11 +68582,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
68510
68582
|
},
|
|
68511
68583
|
];
|
|
68512
68584
|
const sheetId = this.getActiveSheetId();
|
|
68513
|
-
const handler = new CellClipboardHandler(this.getters, this.dispatch);
|
|
68514
|
-
const data = handler.copy(getClipboardDataPositions(sheetId, target));
|
|
68515
|
-
if (!data) {
|
|
68516
|
-
return;
|
|
68517
|
-
}
|
|
68518
68585
|
const base = isBasedBefore ? cmd.base : cmd.base + 1;
|
|
68519
68586
|
const pasteTarget = [
|
|
68520
68587
|
{
|
|
@@ -68524,7 +68591,14 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
68524
68591
|
bottom: !isCol ? base + thickness - 1 : this.getters.getNumberRows(cmd.sheetId) - 1,
|
|
68525
68592
|
},
|
|
68526
68593
|
];
|
|
68527
|
-
|
|
68594
|
+
for (const Handler of clipboardHandlersRegistries.cellHandlers.getAll()) {
|
|
68595
|
+
const handler = new Handler(this.getters, this.dispatch);
|
|
68596
|
+
const data = handler.copy(getClipboardDataPositions(sheetId, target));
|
|
68597
|
+
if (!data) {
|
|
68598
|
+
continue;
|
|
68599
|
+
}
|
|
68600
|
+
handler.paste({ zones: pasteTarget, sheetId }, data, { isCutOperation: true });
|
|
68601
|
+
}
|
|
68528
68602
|
const selection = pasteTarget[0];
|
|
68529
68603
|
const col = selection.left;
|
|
68530
68604
|
const row = selection.top;
|
|
@@ -76914,9 +76988,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
76914
76988
|
exports.tokenize = tokenize;
|
|
76915
76989
|
|
|
76916
76990
|
|
|
76917
|
-
__info__.version = "18.2.
|
|
76918
|
-
__info__.date = "2025-
|
|
76919
|
-
__info__.hash = "
|
|
76991
|
+
__info__.version = "18.2.16";
|
|
76992
|
+
__info__.date = "2025-06-06T09:32:04.909Z";
|
|
76993
|
+
__info__.hash = "7ee118c";
|
|
76920
76994
|
|
|
76921
76995
|
|
|
76922
76996
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|