@odoo/o-spreadsheet 17.4.31 → 17.4.33
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 +73 -48
- package/dist/o-spreadsheet.d.ts +3 -1
- package/dist/o-spreadsheet.esm.js +73 -48
- package/dist/o-spreadsheet.iife.js +73 -48
- package/dist/o-spreadsheet.iife.min.js +9 -10
- package/dist/o_spreadsheet.xml +61 -54
- 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 17.4.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.4.33
|
|
6
|
+
* @date 2025-05-02T12:30:31.263Z
|
|
7
|
+
* @hash 3ba00e6
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -2361,6 +2361,7 @@
|
|
|
2361
2361
|
CommandResult["InvalidTableResize"] = "InvalidTableResize";
|
|
2362
2362
|
CommandResult["PivotIdNotFound"] = "PivotIdNotFound";
|
|
2363
2363
|
CommandResult["EmptyName"] = "EmptyName";
|
|
2364
|
+
CommandResult["InvalidPivotDataSet"] = "InvalidPivotDataSet";
|
|
2364
2365
|
})(exports.CommandResult || (exports.CommandResult = {}));
|
|
2365
2366
|
|
|
2366
2367
|
const PLAIN_TEXT_FORMAT = "@"; // see OpenXML spec §18.8.31
|
|
@@ -10946,9 +10947,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10946
10947
|
const GAUGE_TITLE_PADDING_TOP = DEFAULT_CHART_PADDING;
|
|
10947
10948
|
function drawGaugeChart(canvas, runtime) {
|
|
10948
10949
|
const canvasBoundingRect = canvas.getBoundingClientRect();
|
|
10949
|
-
|
|
10950
|
-
canvas.
|
|
10950
|
+
const dpr = window.devicePixelRatio || 1;
|
|
10951
|
+
canvas.width = dpr * canvasBoundingRect.width;
|
|
10952
|
+
canvas.height = dpr * canvasBoundingRect.height;
|
|
10951
10953
|
const ctx = canvas.getContext("2d");
|
|
10954
|
+
ctx.scale(dpr, dpr);
|
|
10952
10955
|
const config = getGaugeRenderingConfig(canvasBoundingRect, runtime, ctx);
|
|
10953
10956
|
drawBackground(ctx, config);
|
|
10954
10957
|
drawGauge(ctx, config);
|
|
@@ -11505,9 +11508,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
11505
11508
|
};
|
|
11506
11509
|
function drawScoreChart(structure, canvas) {
|
|
11507
11510
|
const ctx = canvas.getContext("2d");
|
|
11508
|
-
|
|
11509
|
-
|
|
11510
|
-
canvas.height = structure.canvas.height;
|
|
11511
|
+
const dpr = window.devicePixelRatio || 1;
|
|
11512
|
+
canvas.width = dpr * structure.canvas.width;
|
|
11513
|
+
canvas.height = dpr * structure.canvas.height;
|
|
11514
|
+
ctx.scale(dpr, dpr);
|
|
11515
|
+
const availableWidth = structure.canvas.width - DEFAULT_CHART_PADDING;
|
|
11511
11516
|
ctx.fillStyle = structure.canvas.backgroundColor;
|
|
11512
11517
|
ctx.fillRect(0, 0, structure.canvas.width, structure.canvas.height);
|
|
11513
11518
|
if (structure.title) {
|
|
@@ -12238,6 +12243,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
12238
12243
|
canvas = owl.useRef("graphContainer");
|
|
12239
12244
|
chart;
|
|
12240
12245
|
currentRuntime;
|
|
12246
|
+
currentDevicePixelRatio = window.devicePixelRatio;
|
|
12241
12247
|
get background() {
|
|
12242
12248
|
return this.chartRuntime.background;
|
|
12243
12249
|
}
|
|
@@ -12271,6 +12277,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
12271
12277
|
}
|
|
12272
12278
|
this.currentRuntime = runtime;
|
|
12273
12279
|
}
|
|
12280
|
+
else if (this.currentDevicePixelRatio !== window.devicePixelRatio) {
|
|
12281
|
+
this.currentDevicePixelRatio = window.devicePixelRatio;
|
|
12282
|
+
this.updateChartJs(deepCopy(this.currentRuntime));
|
|
12283
|
+
}
|
|
12274
12284
|
});
|
|
12275
12285
|
}
|
|
12276
12286
|
createChart(chartData) {
|
|
@@ -12313,7 +12323,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
12313
12323
|
owl.useEffect(this.createChart.bind(this), () => {
|
|
12314
12324
|
const canvas = this.canvas.el;
|
|
12315
12325
|
const rect = canvas.getBoundingClientRect();
|
|
12316
|
-
return [rect.width, rect.height, this.runtime, this.canvas.el];
|
|
12326
|
+
return [rect.width, rect.height, this.runtime, this.canvas.el, window.devicePixelRatio];
|
|
12317
12327
|
});
|
|
12318
12328
|
}
|
|
12319
12329
|
createChart() {
|
|
@@ -22733,18 +22743,28 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
22733
22743
|
function useInterval(callback, delay) {
|
|
22734
22744
|
let intervalId;
|
|
22735
22745
|
const { setInterval, clearInterval } = window;
|
|
22746
|
+
const pause = () => {
|
|
22747
|
+
clearInterval(intervalId);
|
|
22748
|
+
intervalId = undefined;
|
|
22749
|
+
};
|
|
22750
|
+
const safeCallback = () => {
|
|
22751
|
+
try {
|
|
22752
|
+
callback();
|
|
22753
|
+
}
|
|
22754
|
+
catch (e) {
|
|
22755
|
+
pause();
|
|
22756
|
+
throw e;
|
|
22757
|
+
}
|
|
22758
|
+
};
|
|
22736
22759
|
owl.useEffect(() => {
|
|
22737
|
-
intervalId = setInterval(
|
|
22760
|
+
intervalId = setInterval(safeCallback, delay);
|
|
22738
22761
|
return () => clearInterval(intervalId);
|
|
22739
22762
|
}, () => [delay]);
|
|
22740
22763
|
return {
|
|
22741
|
-
pause
|
|
22742
|
-
clearInterval(intervalId);
|
|
22743
|
-
intervalId = undefined;
|
|
22744
|
-
},
|
|
22764
|
+
pause,
|
|
22745
22765
|
resume: () => {
|
|
22746
22766
|
if (intervalId === undefined) {
|
|
22747
|
-
intervalId = setInterval(
|
|
22767
|
+
intervalId = setInterval(safeCallback, delay);
|
|
22748
22768
|
}
|
|
22749
22769
|
},
|
|
22750
22770
|
};
|
|
@@ -25202,7 +25222,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
25202
25222
|
owl.useEffect(() => drawGaugeChart(this.canvas.el, this.runtime), () => {
|
|
25203
25223
|
const canvas = this.canvas.el;
|
|
25204
25224
|
const rect = canvas.getBoundingClientRect();
|
|
25205
|
-
return [rect.width, rect.height, this.runtime, this.canvas.el];
|
|
25225
|
+
return [rect.width, rect.height, this.runtime, this.canvas.el, window.devicePixelRatio];
|
|
25206
25226
|
});
|
|
25207
25227
|
}
|
|
25208
25228
|
}
|
|
@@ -25327,9 +25347,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
25327
25347
|
};
|
|
25328
25348
|
}
|
|
25329
25349
|
getDefinitionForExcel() {
|
|
25330
|
-
// Excel does not support aggregating labels
|
|
25331
|
-
if (this.aggregated)
|
|
25332
|
-
return undefined;
|
|
25333
25350
|
const dataSets = this.dataSets
|
|
25334
25351
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
25335
25352
|
.filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
|
|
@@ -26406,9 +26423,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
26406
26423
|
return new LineChart(definition, this.sheetId, this.getters);
|
|
26407
26424
|
}
|
|
26408
26425
|
getDefinitionForExcel() {
|
|
26409
|
-
// Excel does not support aggregating labels
|
|
26410
|
-
if (this.aggregated)
|
|
26411
|
-
return undefined;
|
|
26412
26426
|
const dataSets = this.dataSets
|
|
26413
26427
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
26414
26428
|
.filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
|
|
@@ -26519,9 +26533,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
26519
26533
|
return new PieChart(definition, sheetId, this.getters);
|
|
26520
26534
|
}
|
|
26521
26535
|
getDefinitionForExcel() {
|
|
26522
|
-
// Excel does not support aggregating labels
|
|
26523
|
-
if (this.aggregated)
|
|
26524
|
-
return undefined;
|
|
26525
26536
|
const dataSets = this.dataSets
|
|
26526
26537
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
26527
26538
|
.filter((ds) => ds.range !== "" && ds.range !== CellErrorType.InvalidReference);
|
|
@@ -32368,7 +32379,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
32368
32379
|
}
|
|
32369
32380
|
setHexColor(ev) {
|
|
32370
32381
|
// only support HEX code input
|
|
32371
|
-
const val = ev.target.value.slice(0, 7);
|
|
32382
|
+
const val = ev.target.value.replace("##", "#").slice(0, 7);
|
|
32372
32383
|
this.state.customHexColor = val;
|
|
32373
32384
|
if (!isColorValid(val)) ;
|
|
32374
32385
|
else {
|
|
@@ -40991,7 +41002,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
40991
41002
|
position: absolute;
|
|
40992
41003
|
top: 0;
|
|
40993
41004
|
left: ${HEADER_WIDTH}px;
|
|
40994
|
-
right:
|
|
41005
|
+
right: ${SCROLLBAR_WIDTH}px;
|
|
40995
41006
|
height: ${HEADER_HEIGHT}px;
|
|
40996
41007
|
&.o-dragging {
|
|
40997
41008
|
cursor: grabbing;
|
|
@@ -41157,9 +41168,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
41157
41168
|
position: absolute;
|
|
41158
41169
|
top: ${HEADER_HEIGHT}px;
|
|
41159
41170
|
left: 0;
|
|
41160
|
-
|
|
41171
|
+
bottom: ${SCROLLBAR_WIDTH}px;
|
|
41161
41172
|
width: ${HEADER_WIDTH}px;
|
|
41162
|
-
height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH}px);
|
|
41163
41173
|
&.o-dragging {
|
|
41164
41174
|
cursor: grabbing;
|
|
41165
41175
|
}
|
|
@@ -53124,6 +53134,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53124
53134
|
}
|
|
53125
53135
|
}
|
|
53126
53136
|
class SpreadsheetPivotCorePlugin extends CorePlugin {
|
|
53137
|
+
allowDispatch(cmd) {
|
|
53138
|
+
switch (cmd.type) {
|
|
53139
|
+
case "ADD_PIVOT":
|
|
53140
|
+
case "UPDATE_PIVOT":
|
|
53141
|
+
const definition = cmd.pivot;
|
|
53142
|
+
return this.checkDataSetValidity(definition);
|
|
53143
|
+
}
|
|
53144
|
+
return "Success" /* CommandResult.Success */;
|
|
53145
|
+
}
|
|
53127
53146
|
adaptRanges(applyChange) {
|
|
53128
53147
|
for (const pivotId of this.getters.getPivotIds()) {
|
|
53129
53148
|
const definition = this.getters.getPivotCoreDefinition(pivotId);
|
|
@@ -53142,6 +53161,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53142
53161
|
}
|
|
53143
53162
|
}
|
|
53144
53163
|
}
|
|
53164
|
+
checkDataSetValidity(definition) {
|
|
53165
|
+
if (definition.type === "SPREADSHEET" && definition.dataSet) {
|
|
53166
|
+
const { zone, sheetId } = definition.dataSet;
|
|
53167
|
+
if (!sheetId || !this.getters.tryGetSheet(sheetId) || !zone || !isZoneValid(zone)) {
|
|
53168
|
+
return "InvalidDataSet" /* CommandResult.InvalidDataSet */;
|
|
53169
|
+
}
|
|
53170
|
+
return this.getters.checkZonesExistInSheet(sheetId, [zone]);
|
|
53171
|
+
}
|
|
53172
|
+
return "Success" /* CommandResult.Success */;
|
|
53173
|
+
}
|
|
53145
53174
|
}
|
|
53146
53175
|
|
|
53147
53176
|
class TableStylePlugin extends CorePlugin {
|
|
@@ -55977,7 +56006,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
55977
56006
|
tables = {};
|
|
55978
56007
|
handle(cmd) {
|
|
55979
56008
|
if (invalidateEvaluationCommands.has(cmd.type) ||
|
|
55980
|
-
(cmd.type === "UPDATE_CELL" && "content" in cmd) ||
|
|
56009
|
+
(cmd.type === "UPDATE_CELL" && ("content" in cmd || "format" in cmd)) ||
|
|
55981
56010
|
cmd.type === "EVALUATE_CELLS") {
|
|
55982
56011
|
this.tables = {};
|
|
55983
56012
|
return;
|
|
@@ -59114,7 +59143,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
59114
59143
|
tableStyles = {};
|
|
59115
59144
|
handle(cmd) {
|
|
59116
59145
|
if (invalidateEvaluationCommands.has(cmd.type) ||
|
|
59117
|
-
(cmd.type === "UPDATE_CELL" && "content" in cmd) ||
|
|
59146
|
+
(cmd.type === "UPDATE_CELL" && ("content" in cmd || "format" in cmd)) ||
|
|
59118
59147
|
cmd.type === "EVALUATE_CELLS") {
|
|
59119
59148
|
this.tableStyles = {};
|
|
59120
59149
|
return;
|
|
@@ -61085,6 +61114,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61085
61114
|
});
|
|
61086
61115
|
this.selectCell(col, row);
|
|
61087
61116
|
}
|
|
61117
|
+
const { col, row } = this.gridSelection.anchor.cell;
|
|
61118
|
+
this.moveClient({ sheetId: this.activeSheet.id, col, row });
|
|
61088
61119
|
}
|
|
61089
61120
|
/**
|
|
61090
61121
|
* Ensure selections are not outside sheet boundaries.
|
|
@@ -61817,8 +61848,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61817
61848
|
case "REMOVE_TABLE":
|
|
61818
61849
|
case "UPDATE_TABLE":
|
|
61819
61850
|
case "UPDATE_FILTER":
|
|
61820
|
-
|
|
61821
|
-
|
|
61851
|
+
case "UNFREEZE_ROWS":
|
|
61852
|
+
case "UNFREEZE_COLUMNS":
|
|
61853
|
+
case "FREEZE_COLUMNS":
|
|
61854
|
+
case "FREEZE_ROWS":
|
|
61855
|
+
case "UNFREEZE_COLUMNS_ROWS":
|
|
61822
61856
|
case "REMOVE_COLUMNS_ROWS":
|
|
61823
61857
|
case "RESIZE_COLUMNS_ROWS":
|
|
61824
61858
|
case "HIDE_COLUMNS_ROWS":
|
|
@@ -61831,11 +61865,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61831
61865
|
case "FOLD_HEADER_GROUPS_IN_ZONE":
|
|
61832
61866
|
case "UNFOLD_HEADER_GROUPS_IN_ZONE":
|
|
61833
61867
|
case "UNFOLD_ALL_HEADER_GROUPS":
|
|
61834
|
-
case "FOLD_ALL_HEADER_GROUPS":
|
|
61835
|
-
|
|
61836
|
-
this.sheetsWithDirtyViewports.add(sheetId);
|
|
61868
|
+
case "FOLD_ALL_HEADER_GROUPS":
|
|
61869
|
+
this.sheetsWithDirtyViewports.add(cmd.sheetId);
|
|
61837
61870
|
break;
|
|
61838
|
-
}
|
|
61839
61871
|
case "UPDATE_CELL":
|
|
61840
61872
|
// update cell content or format can change hidden rows because of data filters
|
|
61841
61873
|
if ("content" in cmd || "format" in cmd || cmd.style?.fontSize !== undefined) {
|
|
@@ -61851,13 +61883,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
61851
61883
|
case "ACTIVATE_SHEET":
|
|
61852
61884
|
this.sheetsWithDirtyViewports.add(cmd.sheetIdTo);
|
|
61853
61885
|
break;
|
|
61854
|
-
case "UNFREEZE_ROWS":
|
|
61855
|
-
case "UNFREEZE_COLUMNS":
|
|
61856
|
-
case "FREEZE_COLUMNS":
|
|
61857
|
-
case "FREEZE_ROWS":
|
|
61858
|
-
case "UNFREEZE_COLUMNS_ROWS":
|
|
61859
|
-
this.resetViewports(this.getters.getActiveSheetId());
|
|
61860
|
-
break;
|
|
61861
61886
|
case "DELETE_SHEET":
|
|
61862
61887
|
this.sheetsWithDirtyViewports.delete(cmd.sheetId);
|
|
61863
61888
|
break;
|
|
@@ -63013,7 +63038,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63013
63038
|
}
|
|
63014
63039
|
handle(cmd) {
|
|
63015
63040
|
if (invalidateEvaluationCommands.has(cmd.type) ||
|
|
63016
|
-
(cmd.type === "UPDATE_CELL" && "content" in cmd)) {
|
|
63041
|
+
(cmd.type === "UPDATE_CELL" && ("content" in cmd || "format" in cmd))) {
|
|
63017
63042
|
this.isDirty = true;
|
|
63018
63043
|
}
|
|
63019
63044
|
switch (cmd.type) {
|
|
@@ -69380,9 +69405,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
69380
69405
|
exports.tokenize = tokenize;
|
|
69381
69406
|
|
|
69382
69407
|
|
|
69383
|
-
__info__.version = "17.4.
|
|
69384
|
-
__info__.date = "2025-
|
|
69385
|
-
__info__.hash = "
|
|
69408
|
+
__info__.version = "17.4.33";
|
|
69409
|
+
__info__.date = "2025-05-02T12:30:31.263Z";
|
|
69410
|
+
__info__.hash = "3ba00e6";
|
|
69386
69411
|
|
|
69387
69412
|
|
|
69388
69413
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|