@odoo/o-spreadsheet 18.1.22 → 18.1.24
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 +377 -377
- 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.1.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.1.24
|
|
6
|
+
* @date 2025-06-06T09:31:57.011Z
|
|
7
|
+
* @hash 0e386b2
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -8294,9 +8294,10 @@
|
|
|
8294
8294
|
avg: _t("Average"),
|
|
8295
8295
|
sum: _t("Sum"),
|
|
8296
8296
|
};
|
|
8297
|
+
const NUMBER_CHAR_AGGREGATORS = ["max", "min", "avg", "sum", "count_distinct", "count"];
|
|
8297
8298
|
const AGGREGATORS_BY_FIELD_TYPE = {
|
|
8298
|
-
integer:
|
|
8299
|
-
char:
|
|
8299
|
+
integer: NUMBER_CHAR_AGGREGATORS,
|
|
8300
|
+
char: NUMBER_CHAR_AGGREGATORS,
|
|
8300
8301
|
boolean: ["count_distinct", "count", "bool_and", "bool_or"],
|
|
8301
8302
|
};
|
|
8302
8303
|
const AGGREGATORS = {};
|
|
@@ -10206,8 +10207,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10206
10207
|
if (isNaN(value)) {
|
|
10207
10208
|
continue;
|
|
10208
10209
|
}
|
|
10209
|
-
const axisId = chart.config.type === "radar" ? dataset.rAxisID : dataset.yAxisID;
|
|
10210
|
-
const displayValue = options.callback(Number(value), axisId);
|
|
10211
10210
|
const point = dataset.data[i];
|
|
10212
10211
|
const xPosition = point.x;
|
|
10213
10212
|
let yPosition = 0;
|
|
@@ -10231,7 +10230,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10231
10230
|
textsPositions[xPosition].push(yPosition);
|
|
10232
10231
|
ctx.fillStyle = point.options.backgroundColor;
|
|
10233
10232
|
ctx.strokeStyle = options.background || "#ffffff";
|
|
10234
|
-
|
|
10233
|
+
const valueToDisplay = options.callback(Number(value), dataset, i);
|
|
10234
|
+
drawTextWithBackground(valueToDisplay, xPosition, yPosition, ctx);
|
|
10235
10235
|
}
|
|
10236
10236
|
}
|
|
10237
10237
|
}
|
|
@@ -10248,7 +10248,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10248
10248
|
if (isNaN(value)) {
|
|
10249
10249
|
continue;
|
|
10250
10250
|
}
|
|
10251
|
-
const displayValue = options.callback(value, dataset
|
|
10251
|
+
const displayValue = options.callback(value, dataset, i);
|
|
10252
10252
|
const point = dataset.data[i];
|
|
10253
10253
|
const yPosition = point.y;
|
|
10254
10254
|
let xPosition = value < 0 ? point.x + point.width / 2 : point.x - point.width / 2;
|
|
@@ -10286,7 +10286,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10286
10286
|
const y = bar.y + midRadius * Math.sin(midAngle) + 7;
|
|
10287
10287
|
ctx.fillStyle = chartFontColor(options.background);
|
|
10288
10288
|
ctx.strokeStyle = options.background || "#ffffff";
|
|
10289
|
-
const displayValue = options.callback(value,
|
|
10289
|
+
const displayValue = options.callback(value, dataset, i);
|
|
10290
10290
|
drawTextWithBackground(displayValue, x, y, ctx);
|
|
10291
10291
|
}
|
|
10292
10292
|
}
|
|
@@ -30051,9 +30051,51 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
30051
30051
|
horizontal: "horizontal" in definition && definition.horizontal,
|
|
30052
30052
|
showValues: "showValues" in definition ? !!definition.showValues : false,
|
|
30053
30053
|
background: definition.background,
|
|
30054
|
-
callback:
|
|
30054
|
+
callback: (value, dataset) => {
|
|
30055
|
+
const axisId = getDatasetAxisId(definition, dataset);
|
|
30056
|
+
return formatChartDatasetValue(axisFormats, locale)(value, axisId);
|
|
30057
|
+
},
|
|
30058
|
+
};
|
|
30059
|
+
}
|
|
30060
|
+
function getPyramidChartShowValues(definition, args) {
|
|
30061
|
+
const { axisFormats, locale } = args;
|
|
30062
|
+
return {
|
|
30063
|
+
horizontal: true,
|
|
30064
|
+
showValues: "showValues" in definition ? !!definition.showValues : false,
|
|
30065
|
+
background: definition.background,
|
|
30066
|
+
callback: (value, dataset) => {
|
|
30067
|
+
value = Math.abs(Number(value));
|
|
30068
|
+
return formatChartDatasetValue(axisFormats, locale)(value, dataset.xAxisID || "x");
|
|
30069
|
+
},
|
|
30070
|
+
};
|
|
30071
|
+
}
|
|
30072
|
+
function getWaterfallChartShowValues(definition, args) {
|
|
30073
|
+
const { axisFormats, locale, dataSetsValues } = args;
|
|
30074
|
+
const subtotalIndexes = dataSetsValues.reduce((subtotalIndexes, ds) => {
|
|
30075
|
+
subtotalIndexes.push((subtotalIndexes.at(-1) || -1) + ds.data.length + 1);
|
|
30076
|
+
return subtotalIndexes;
|
|
30077
|
+
}, []);
|
|
30078
|
+
return {
|
|
30079
|
+
showValues: "showValues" in definition ? !!definition.showValues : false,
|
|
30080
|
+
background: definition.background,
|
|
30081
|
+
callback: (value, dataset, index) => {
|
|
30082
|
+
const raw = dataset._dataset.data[index];
|
|
30083
|
+
const delta = raw[1] - raw[0];
|
|
30084
|
+
let sign = delta >= 0 ? "+" : "";
|
|
30085
|
+
if (definition.showSubTotals && subtotalIndexes.includes(index) && sign === "+") {
|
|
30086
|
+
sign = "";
|
|
30087
|
+
}
|
|
30088
|
+
return `${sign}${formatChartDatasetValue(axisFormats, locale)(delta, dataset.yAxisID)}`;
|
|
30089
|
+
},
|
|
30055
30090
|
};
|
|
30056
30091
|
}
|
|
30092
|
+
function getDatasetAxisId(definition, dataset) {
|
|
30093
|
+
if (dataset.rAxisID) {
|
|
30094
|
+
return dataset.rAxisID;
|
|
30095
|
+
}
|
|
30096
|
+
const axisId = "horizontal" in definition && definition.horizontal ? dataset.xAxisID : dataset.yAxisID;
|
|
30097
|
+
return axisId || "y";
|
|
30098
|
+
}
|
|
30057
30099
|
|
|
30058
30100
|
function getChartTitle(definition) {
|
|
30059
30101
|
const chartTitle = definition.title;
|
|
@@ -30262,6 +30304,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
30262
30304
|
getPieChartTooltip: getPieChartTooltip,
|
|
30263
30305
|
getPyramidChartData: getPyramidChartData,
|
|
30264
30306
|
getPyramidChartScales: getPyramidChartScales,
|
|
30307
|
+
getPyramidChartShowValues: getPyramidChartShowValues,
|
|
30265
30308
|
getPyramidChartTooltip: getPyramidChartTooltip,
|
|
30266
30309
|
getRadarChartData: getRadarChartData,
|
|
30267
30310
|
getRadarChartDatasets: getRadarChartDatasets,
|
|
@@ -30275,6 +30318,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
30275
30318
|
getTrendDatasetForLineChart: getTrendDatasetForLineChart,
|
|
30276
30319
|
getWaterfallChartLegend: getWaterfallChartLegend,
|
|
30277
30320
|
getWaterfallChartScales: getWaterfallChartScales,
|
|
30321
|
+
getWaterfallChartShowValues: getWaterfallChartShowValues,
|
|
30278
30322
|
getWaterfallChartTooltip: getWaterfallChartTooltip,
|
|
30279
30323
|
getWaterfallDatasetAndLabels: getWaterfallDatasetAndLabels
|
|
30280
30324
|
});
|
|
@@ -31373,7 +31417,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
31373
31417
|
title: getChartTitle(definition),
|
|
31374
31418
|
legend: getBarChartLegend(definition),
|
|
31375
31419
|
tooltip: getPyramidChartTooltip(definition, chartData),
|
|
31376
|
-
chartShowValuesPlugin:
|
|
31420
|
+
chartShowValuesPlugin: getPyramidChartShowValues(definition, chartData),
|
|
31377
31421
|
},
|
|
31378
31422
|
},
|
|
31379
31423
|
};
|
|
@@ -31836,7 +31880,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
31836
31880
|
title: getChartTitle(definition),
|
|
31837
31881
|
legend: getWaterfallChartLegend(definition),
|
|
31838
31882
|
tooltip: getWaterfallChartTooltip(definition, chartData),
|
|
31839
|
-
chartShowValuesPlugin:
|
|
31883
|
+
chartShowValuesPlugin: getWaterfallChartShowValues(definition, chartData),
|
|
31840
31884
|
waterfallLinesPlugin: { showConnectorLines: definition.showConnectorLines },
|
|
31841
31885
|
},
|
|
31842
31886
|
},
|
|
@@ -44319,13 +44363,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
44319
44363
|
if (this.selectedMatchIndex === null) {
|
|
44320
44364
|
return;
|
|
44321
44365
|
}
|
|
44366
|
+
this.preserveSelectedMatchIndex = true;
|
|
44367
|
+
this.shouldFinalizeUpdateSelection = true;
|
|
44322
44368
|
this.model.dispatch("REPLACE_SEARCH", {
|
|
44323
44369
|
searchString: this.toSearch,
|
|
44324
44370
|
replaceWith: this.toReplace,
|
|
44325
44371
|
matches: [this.searchMatches[this.selectedMatchIndex]],
|
|
44326
44372
|
searchOptions: this.searchOptions,
|
|
44327
44373
|
});
|
|
44328
|
-
this.
|
|
44374
|
+
this.preserveSelectedMatchIndex = false;
|
|
44329
44375
|
}
|
|
44330
44376
|
/**
|
|
44331
44377
|
* Apply the replace function to all the matches one time.
|
|
@@ -46755,12 +46801,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
46755
46801
|
entry[field.name] = { value: null, type: CellValueType.empty, formattedValue: "" };
|
|
46756
46802
|
}
|
|
46757
46803
|
else {
|
|
46758
|
-
|
|
46759
|
-
entry[field.name] = { ...cell, value: cell.formattedValue || null };
|
|
46760
|
-
}
|
|
46761
|
-
else {
|
|
46762
|
-
entry[field.name] = cell;
|
|
46763
|
-
}
|
|
46804
|
+
entry[field.name] = cell;
|
|
46764
46805
|
}
|
|
46765
46806
|
}
|
|
46766
46807
|
entry["__count"] = { value: 1, type: CellValueType.number, formattedValue: "1" };
|
|
@@ -51826,6 +51867,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51826
51867
|
let deltaX = lastX - clientX;
|
|
51827
51868
|
let deltaY = lastY - clientY;
|
|
51828
51869
|
const elapsedTime = currentTime - lastTime;
|
|
51870
|
+
if (!elapsedTime) {
|
|
51871
|
+
return;
|
|
51872
|
+
}
|
|
51829
51873
|
velocityX = deltaX / elapsedTime;
|
|
51830
51874
|
velocityY = deltaY / elapsedTime;
|
|
51831
51875
|
lastX = clientX;
|
|
@@ -51846,6 +51890,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51846
51890
|
function onTouchEnd(ev) {
|
|
51847
51891
|
isMouseDown = false;
|
|
51848
51892
|
lastX = lastY = 0;
|
|
51893
|
+
if (resetTimeout) {
|
|
51894
|
+
clearTimeout(resetTimeout);
|
|
51895
|
+
}
|
|
51896
|
+
velocityX *= 1.2;
|
|
51897
|
+
velocityY *= 1.2;
|
|
51849
51898
|
requestAnimationFrame(scroll);
|
|
51850
51899
|
}
|
|
51851
51900
|
function scroll() {
|
|
@@ -58947,7 +58996,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
58947
58996
|
break;
|
|
58948
58997
|
}
|
|
58949
58998
|
case "UPDATE_PIVOT": {
|
|
58950
|
-
this.history.update("pivots", cmd.pivotId, "definition", deepCopy(cmd.pivot));
|
|
58999
|
+
this.history.update("pivots", cmd.pivotId, "definition", this.repairSortedColumn(deepCopy(cmd.pivot)));
|
|
58951
59000
|
this.compileCalculatedMeasures(cmd.pivot.measures);
|
|
58952
59001
|
break;
|
|
58953
59002
|
}
|
|
@@ -59018,7 +59067,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59018
59067
|
// Private
|
|
59019
59068
|
// -------------------------------------------------------------------------
|
|
59020
59069
|
addPivot(pivotId, pivot, formulaId = this.nextFormulaId.toString()) {
|
|
59021
|
-
this.history.update("pivots", pivotId, {
|
|
59070
|
+
this.history.update("pivots", pivotId, {
|
|
59071
|
+
definition: this.repairSortedColumn(deepCopy(pivot)),
|
|
59072
|
+
formulaId,
|
|
59073
|
+
});
|
|
59022
59074
|
this.compileCalculatedMeasures(pivot.measures);
|
|
59023
59075
|
this.history.update("formulaIds", formulaId, pivotId);
|
|
59024
59076
|
this.history.update("nextFormulaId", this.nextFormulaId + 1);
|
|
@@ -59111,6 +59163,26 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59111
59163
|
}
|
|
59112
59164
|
return "Success" /* CommandResult.Success */;
|
|
59113
59165
|
}
|
|
59166
|
+
repairSortedColumn(definition) {
|
|
59167
|
+
if (definition.sortedColumn) {
|
|
59168
|
+
// Fix for an upgrade issue: the sortedColumn measure was not updated
|
|
59169
|
+
// from using fieldName to using id. If the sortedColumn measure matches
|
|
59170
|
+
// a measure fieldName in the definition, update it to use the measure's id instead
|
|
59171
|
+
// of its fieldName.
|
|
59172
|
+
// TODO: add an upgrade step to fix this in master and remove this code
|
|
59173
|
+
const sortedMeasure = definition.measures.find((measure) => measure.fieldName === definition.sortedColumn?.measure);
|
|
59174
|
+
if (sortedMeasure) {
|
|
59175
|
+
return {
|
|
59176
|
+
...definition,
|
|
59177
|
+
sortedColumn: {
|
|
59178
|
+
...definition.sortedColumn,
|
|
59179
|
+
measure: sortedMeasure.id,
|
|
59180
|
+
},
|
|
59181
|
+
};
|
|
59182
|
+
}
|
|
59183
|
+
}
|
|
59184
|
+
return definition;
|
|
59185
|
+
}
|
|
59114
59186
|
// ---------------------------------------------------------------------
|
|
59115
59187
|
// Import/Export
|
|
59116
59188
|
// ---------------------------------------------------------------------
|
|
@@ -68019,11 +68091,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
68019
68091
|
},
|
|
68020
68092
|
];
|
|
68021
68093
|
const sheetId = this.getActiveSheetId();
|
|
68022
|
-
const handler = new CellClipboardHandler(this.getters, this.dispatch);
|
|
68023
|
-
const data = handler.copy(getClipboardDataPositions(sheetId, target));
|
|
68024
|
-
if (!data) {
|
|
68025
|
-
return;
|
|
68026
|
-
}
|
|
68027
68094
|
const base = isBasedBefore ? cmd.base : cmd.base + 1;
|
|
68028
68095
|
const pasteTarget = [
|
|
68029
68096
|
{
|
|
@@ -68033,7 +68100,14 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
68033
68100
|
bottom: !isCol ? base + thickness - 1 : this.getters.getNumberRows(cmd.sheetId) - 1,
|
|
68034
68101
|
},
|
|
68035
68102
|
];
|
|
68036
|
-
|
|
68103
|
+
for (const Handler of clipboardHandlersRegistries.cellHandlers.getAll()) {
|
|
68104
|
+
const handler = new Handler(this.getters, this.dispatch);
|
|
68105
|
+
const data = handler.copy(getClipboardDataPositions(sheetId, target));
|
|
68106
|
+
if (!data) {
|
|
68107
|
+
continue;
|
|
68108
|
+
}
|
|
68109
|
+
handler.paste({ zones: pasteTarget, sheetId }, data, { isCutOperation: true });
|
|
68110
|
+
}
|
|
68037
68111
|
const selection = pasteTarget[0];
|
|
68038
68112
|
const col = selection.left;
|
|
68039
68113
|
const row = selection.top;
|
|
@@ -76436,9 +76510,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
76436
76510
|
exports.tokenize = tokenize;
|
|
76437
76511
|
|
|
76438
76512
|
|
|
76439
|
-
__info__.version = "18.1.
|
|
76440
|
-
__info__.date = "2025-
|
|
76441
|
-
__info__.hash = "
|
|
76513
|
+
__info__.version = "18.1.24";
|
|
76514
|
+
__info__.date = "2025-06-06T09:31:57.011Z";
|
|
76515
|
+
__info__.hash = "0e386b2";
|
|
76442
76516
|
|
|
76443
76517
|
|
|
76444
76518
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|