@odoo/o-spreadsheet 17.0.59 → 17.0.61
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 +111 -59
- package/dist/o-spreadsheet.d.ts +4 -2
- package/dist/o-spreadsheet.esm.js +111 -59
- package/dist/o-spreadsheet.iife.js +111 -59
- package/dist/o-spreadsheet.iife.min.js +264 -265
- package/dist/o_spreadsheet.xml +66 -57
- 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.0.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.0.61
|
|
6
|
+
* @date 2025-05-12T05:21:02.159Z
|
|
7
|
+
* @hash 0368641
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
|
|
@@ -4484,6 +4484,25 @@ function moveHeaderIndexesOnHeaderDeletion(deletedHeaders, headers) {
|
|
|
4484
4484
|
})
|
|
4485
4485
|
.filter(isDefined$1);
|
|
4486
4486
|
}
|
|
4487
|
+
function getNextSheetName(existingNames, baseName = "Sheet") {
|
|
4488
|
+
let i = 1;
|
|
4489
|
+
let name = `${baseName}${i}`;
|
|
4490
|
+
while (existingNames.includes(name)) {
|
|
4491
|
+
name = `${baseName}${i}`;
|
|
4492
|
+
i++;
|
|
4493
|
+
}
|
|
4494
|
+
return name;
|
|
4495
|
+
}
|
|
4496
|
+
function getDuplicateSheetName(nameToDuplicate, existingNames) {
|
|
4497
|
+
let i = 1;
|
|
4498
|
+
const baseName = _t("Copy of %s", nameToDuplicate);
|
|
4499
|
+
let name = baseName.toString();
|
|
4500
|
+
while (existingNames.includes(name)) {
|
|
4501
|
+
name = `${baseName} (${i})`;
|
|
4502
|
+
i++;
|
|
4503
|
+
}
|
|
4504
|
+
return name;
|
|
4505
|
+
}
|
|
4487
4506
|
|
|
4488
4507
|
function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
|
|
4489
4508
|
return numberOfLines * (textLineHeight + MIN_CELL_TEXT_MARGIN) - MIN_CELL_TEXT_MARGIN;
|
|
@@ -8026,10 +8045,13 @@ const duplicateSheet = {
|
|
|
8026
8045
|
name: _t("Duplicate"),
|
|
8027
8046
|
execute: (env) => {
|
|
8028
8047
|
const sheetIdFrom = env.model.getters.getActiveSheetId();
|
|
8048
|
+
const sheetNameFrom = env.model.getters.getSheetName(sheetIdFrom);
|
|
8029
8049
|
const sheetIdTo = env.model.uuidGenerator.smallUuid();
|
|
8050
|
+
const sheetNameTo = env.model.getters.getDuplicateSheetName(sheetNameFrom);
|
|
8030
8051
|
env.model.dispatch("DUPLICATE_SHEET", {
|
|
8031
8052
|
sheetId: sheetIdFrom,
|
|
8032
8053
|
sheetIdTo,
|
|
8054
|
+
sheetNameTo,
|
|
8033
8055
|
});
|
|
8034
8056
|
env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom, sheetIdTo });
|
|
8035
8057
|
},
|
|
@@ -8789,9 +8811,6 @@ class BarChart extends AbstractChart {
|
|
|
8789
8811
|
};
|
|
8790
8812
|
}
|
|
8791
8813
|
getDefinitionForExcel() {
|
|
8792
|
-
// Excel does not support aggregating labels
|
|
8793
|
-
if (this.aggregated)
|
|
8794
|
-
return undefined;
|
|
8795
8814
|
const dataSets = this.dataSets
|
|
8796
8815
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
8797
8816
|
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
@@ -9368,9 +9387,6 @@ class LineChart extends AbstractChart {
|
|
|
9368
9387
|
return new LineChart(definition, this.sheetId, this.getters);
|
|
9369
9388
|
}
|
|
9370
9389
|
getDefinitionForExcel() {
|
|
9371
|
-
// Excel does not support aggregating labels
|
|
9372
|
-
if (this.aggregated)
|
|
9373
|
-
return undefined;
|
|
9374
9390
|
const dataSets = this.dataSets
|
|
9375
9391
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
9376
9392
|
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
@@ -9676,9 +9692,6 @@ class PieChart extends AbstractChart {
|
|
|
9676
9692
|
return new PieChart(definition, sheetId, this.getters);
|
|
9677
9693
|
}
|
|
9678
9694
|
getDefinitionForExcel() {
|
|
9679
|
-
// Excel does not support aggregating labels
|
|
9680
|
-
if (this.aggregated)
|
|
9681
|
-
return undefined;
|
|
9682
9695
|
const dataSets = this.dataSets
|
|
9683
9696
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
9684
9697
|
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
@@ -27156,6 +27169,13 @@ class Composer extends Component {
|
|
|
27156
27169
|
this.props.onInputContextMenu?.(ev);
|
|
27157
27170
|
}
|
|
27158
27171
|
}
|
|
27172
|
+
onWheel(event) {
|
|
27173
|
+
// detect if scrollbar is available
|
|
27174
|
+
if (this.composerRef.el &&
|
|
27175
|
+
this.composerRef.el.scrollHeight > this.composerRef.el.clientHeight) {
|
|
27176
|
+
event.stopPropagation();
|
|
27177
|
+
}
|
|
27178
|
+
}
|
|
27159
27179
|
// ---------------------------------------------------------------------------
|
|
27160
27180
|
// Private
|
|
27161
27181
|
// ---------------------------------------------------------------------------
|
|
@@ -27464,12 +27484,15 @@ class GridComposer extends Component {
|
|
|
27464
27484
|
});
|
|
27465
27485
|
}
|
|
27466
27486
|
get composerProps() {
|
|
27487
|
+
// Remove the wrapper border width
|
|
27488
|
+
const maxHeight = this.props.gridDims.height - this.rect.y - 2 * COMPOSER_BORDER_WIDTH;
|
|
27467
27489
|
return {
|
|
27468
27490
|
focus: this.props.focus,
|
|
27469
27491
|
isDefaultFocus: true,
|
|
27470
27492
|
onComposerContentFocused: this.props.onComposerContentFocused,
|
|
27471
27493
|
onComposerCellFocused: this.props.onComposerCellFocused,
|
|
27472
27494
|
onInputContextMenu: this.props.onInputContextMenu,
|
|
27495
|
+
inputStyle: `max-height: ${maxHeight}px;`,
|
|
27473
27496
|
};
|
|
27474
27497
|
}
|
|
27475
27498
|
get containerStyle() {
|
|
@@ -28482,18 +28505,28 @@ function useRefListener(ref, ...listener) {
|
|
|
28482
28505
|
function useInterval(callback, delay) {
|
|
28483
28506
|
let intervalId;
|
|
28484
28507
|
const { setInterval, clearInterval } = window;
|
|
28508
|
+
const pause = () => {
|
|
28509
|
+
clearInterval(intervalId);
|
|
28510
|
+
intervalId = undefined;
|
|
28511
|
+
};
|
|
28512
|
+
const safeCallback = () => {
|
|
28513
|
+
try {
|
|
28514
|
+
callback();
|
|
28515
|
+
}
|
|
28516
|
+
catch (e) {
|
|
28517
|
+
pause();
|
|
28518
|
+
throw e;
|
|
28519
|
+
}
|
|
28520
|
+
};
|
|
28485
28521
|
useEffect(() => {
|
|
28486
|
-
intervalId = setInterval(
|
|
28522
|
+
intervalId = setInterval(safeCallback, delay);
|
|
28487
28523
|
return () => clearInterval(intervalId);
|
|
28488
28524
|
}, () => [delay]);
|
|
28489
28525
|
return {
|
|
28490
|
-
pause
|
|
28491
|
-
clearInterval(intervalId);
|
|
28492
|
-
intervalId = undefined;
|
|
28493
|
-
},
|
|
28526
|
+
pause,
|
|
28494
28527
|
resume: () => {
|
|
28495
28528
|
if (intervalId === undefined) {
|
|
28496
|
-
intervalId = setInterval(
|
|
28529
|
+
intervalId = setInterval(safeCallback, delay);
|
|
28497
28530
|
}
|
|
28498
28531
|
},
|
|
28499
28532
|
};
|
|
@@ -28938,7 +28971,7 @@ css /* scss */ `
|
|
|
28938
28971
|
position: absolute;
|
|
28939
28972
|
top: 0;
|
|
28940
28973
|
left: ${HEADER_WIDTH}px;
|
|
28941
|
-
right:
|
|
28974
|
+
right: ${SCROLLBAR_WIDTH}px;
|
|
28942
28975
|
height: ${HEADER_HEIGHT}px;
|
|
28943
28976
|
&.o-dragging {
|
|
28944
28977
|
cursor: grabbing;
|
|
@@ -29113,9 +29146,8 @@ css /* scss */ `
|
|
|
29113
29146
|
position: absolute;
|
|
29114
29147
|
top: ${HEADER_HEIGHT}px;
|
|
29115
29148
|
left: 0;
|
|
29116
|
-
|
|
29149
|
+
bottom: ${SCROLLBAR_WIDTH}px;
|
|
29117
29150
|
width: ${HEADER_WIDTH}px;
|
|
29118
|
-
height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH}px);
|
|
29119
29151
|
&.o-dragging {
|
|
29120
29152
|
cursor: grabbing;
|
|
29121
29153
|
}
|
|
@@ -34353,6 +34385,7 @@ function repairInitialMessages(data, initialMessages) {
|
|
|
34353
34385
|
initialMessages = dropCommands(initialMessages, "SORT_CELLS");
|
|
34354
34386
|
initialMessages = dropCommands(initialMessages, "SET_DECIMAL");
|
|
34355
34387
|
initialMessages = fixChartDefinitions(data, initialMessages);
|
|
34388
|
+
initialMessages = fixTranslatedDuplicateSheetName(data, initialMessages);
|
|
34356
34389
|
return initialMessages;
|
|
34357
34390
|
}
|
|
34358
34391
|
/**
|
|
@@ -34472,6 +34505,40 @@ function fixOverlappingFilters(data) {
|
|
|
34472
34505
|
}
|
|
34473
34506
|
return data;
|
|
34474
34507
|
}
|
|
34508
|
+
function fixTranslatedDuplicateSheetName(data, initialMessages) {
|
|
34509
|
+
const sheetNames = {};
|
|
34510
|
+
for (const sheet of data.sheets || []) {
|
|
34511
|
+
sheetNames[sheet.id] = sheet.name;
|
|
34512
|
+
}
|
|
34513
|
+
const messages = [];
|
|
34514
|
+
for (const message of initialMessages) {
|
|
34515
|
+
if (message.type === "REMOTE_REVISION") {
|
|
34516
|
+
const commands = [];
|
|
34517
|
+
for (const cmd of message.commands) {
|
|
34518
|
+
switch (cmd.type) {
|
|
34519
|
+
case "DUPLICATE_SHEET":
|
|
34520
|
+
cmd.sheetNameTo =
|
|
34521
|
+
cmd.sheetNameTo ??
|
|
34522
|
+
getDuplicateSheetName(sheetNames[cmd.sheetId], Object.values(sheetNames));
|
|
34523
|
+
break;
|
|
34524
|
+
case "CREATE_SHEET":
|
|
34525
|
+
case "RENAME_SHEET":
|
|
34526
|
+
sheetNames[cmd.sheetId] = cmd.name || getNextSheetName(Object.values(sheetNames));
|
|
34527
|
+
break;
|
|
34528
|
+
}
|
|
34529
|
+
commands.push(cmd);
|
|
34530
|
+
}
|
|
34531
|
+
messages.push({
|
|
34532
|
+
...message,
|
|
34533
|
+
commands,
|
|
34534
|
+
});
|
|
34535
|
+
}
|
|
34536
|
+
else {
|
|
34537
|
+
messages.push(message);
|
|
34538
|
+
}
|
|
34539
|
+
}
|
|
34540
|
+
return initialMessages;
|
|
34541
|
+
}
|
|
34475
34542
|
// -----------------------------------------------------------------------------
|
|
34476
34543
|
// Helpers
|
|
34477
34544
|
// -----------------------------------------------------------------------------
|
|
@@ -36702,9 +36769,7 @@ class ChartPlugin extends CorePlugin {
|
|
|
36702
36769
|
: "Success" /* CommandResult.Success */;
|
|
36703
36770
|
}
|
|
36704
36771
|
checkChartExists(cmd) {
|
|
36705
|
-
return this.
|
|
36706
|
-
? "Success" /* CommandResult.Success */
|
|
36707
|
-
: "ChartDoesNotExist" /* CommandResult.ChartDoesNotExist */;
|
|
36772
|
+
return this.isChartDefined(cmd.id) ? "Success" /* CommandResult.Success */ : "ChartDoesNotExist" /* CommandResult.ChartDoesNotExist */;
|
|
36708
36773
|
}
|
|
36709
36774
|
}
|
|
36710
36775
|
|
|
@@ -39503,6 +39568,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
39503
39568
|
"getCommandZones",
|
|
39504
39569
|
"getUnboundedZone",
|
|
39505
39570
|
"checkElementsIncludeAllNonFrozenHeaders",
|
|
39571
|
+
"getDuplicateSheetName",
|
|
39506
39572
|
];
|
|
39507
39573
|
sheetIdsMapName = {};
|
|
39508
39574
|
orderedSheetIds = [];
|
|
@@ -39527,7 +39593,11 @@ class SheetPlugin extends CorePlugin {
|
|
|
39527
39593
|
return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
|
|
39528
39594
|
}
|
|
39529
39595
|
case "DUPLICATE_SHEET": {
|
|
39530
|
-
|
|
39596
|
+
if (this.sheets[cmd.sheetIdTo])
|
|
39597
|
+
return "DuplicatedSheetId" /* CommandResult.DuplicatedSheetId */;
|
|
39598
|
+
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo))
|
|
39599
|
+
return "DuplicatedSheetName" /* CommandResult.DuplicatedSheetName */;
|
|
39600
|
+
return "Success" /* CommandResult.Success */;
|
|
39531
39601
|
}
|
|
39532
39602
|
case "MOVE_SHEET":
|
|
39533
39603
|
try {
|
|
@@ -39600,7 +39670,7 @@ class SheetPlugin extends CorePlugin {
|
|
|
39600
39670
|
this.showSheet(cmd.sheetId);
|
|
39601
39671
|
break;
|
|
39602
39672
|
case "DUPLICATE_SHEET":
|
|
39603
|
-
this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo);
|
|
39673
|
+
this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo, cmd.sheetNameTo);
|
|
39604
39674
|
break;
|
|
39605
39675
|
case "DELETE_SHEET":
|
|
39606
39676
|
this.deleteSheet(this.sheets[cmd.sheetId]);
|
|
@@ -39810,14 +39880,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
39810
39880
|
return dimension === "COL" ? this.getNumberCols(sheetId) : this.getNumberRows(sheetId);
|
|
39811
39881
|
}
|
|
39812
39882
|
getNextSheetName(baseName = "Sheet") {
|
|
39813
|
-
let i = 1;
|
|
39814
39883
|
const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
|
|
39815
|
-
|
|
39816
|
-
while (names.includes(name)) {
|
|
39817
|
-
name = `${baseName}${i}`;
|
|
39818
|
-
i++;
|
|
39819
|
-
}
|
|
39820
|
-
return name;
|
|
39884
|
+
return getNextSheetName(names, baseName);
|
|
39821
39885
|
}
|
|
39822
39886
|
getSheetSize(sheetId) {
|
|
39823
39887
|
return {
|
|
@@ -40077,9 +40141,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
40077
40141
|
showSheet(sheetId) {
|
|
40078
40142
|
this.history.update("sheets", sheetId, "isVisible", true);
|
|
40079
40143
|
}
|
|
40080
|
-
duplicateSheet(fromId, toId) {
|
|
40144
|
+
duplicateSheet(fromId, toId, toName) {
|
|
40081
40145
|
const sheet = this.getSheet(fromId);
|
|
40082
|
-
const toName = this.getDuplicateSheetName(sheet.name);
|
|
40083
40146
|
const newSheet = deepCopy(sheet);
|
|
40084
40147
|
newSheet.id = toId;
|
|
40085
40148
|
newSheet.name = toName;
|
|
@@ -40111,15 +40174,8 @@ class SheetPlugin extends CorePlugin {
|
|
|
40111
40174
|
this.history.update("sheetIdsMapName", sheetIdsMapName);
|
|
40112
40175
|
}
|
|
40113
40176
|
getDuplicateSheetName(sheetName) {
|
|
40114
|
-
let i = 1;
|
|
40115
40177
|
const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
|
|
40116
|
-
|
|
40117
|
-
let name = baseName.toString();
|
|
40118
|
-
while (names.includes(name)) {
|
|
40119
|
-
name = `${baseName} (${i})`;
|
|
40120
|
-
i++;
|
|
40121
|
-
}
|
|
40122
|
-
return name;
|
|
40178
|
+
return getDuplicateSheetName(sheetName, names);
|
|
40123
40179
|
}
|
|
40124
40180
|
deleteSheet(sheet) {
|
|
40125
40181
|
const name = sheet.name;
|
|
@@ -50603,6 +50659,8 @@ class GridSelectionPlugin extends UIPlugin {
|
|
|
50603
50659
|
});
|
|
50604
50660
|
this.selectCell(col, row);
|
|
50605
50661
|
}
|
|
50662
|
+
const { col, row } = this.gridSelection.anchor.cell;
|
|
50663
|
+
this.moveClient({ sheetId: this.activeSheet.id, col, row });
|
|
50606
50664
|
}
|
|
50607
50665
|
/**
|
|
50608
50666
|
* Ensure selections are not outside sheet boundaries.
|
|
@@ -51342,8 +51400,11 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
51342
51400
|
}
|
|
51343
51401
|
case "REMOVE_FILTER_TABLE":
|
|
51344
51402
|
case "UPDATE_FILTER":
|
|
51345
|
-
|
|
51346
|
-
|
|
51403
|
+
case "UNFREEZE_ROWS":
|
|
51404
|
+
case "UNFREEZE_COLUMNS":
|
|
51405
|
+
case "FREEZE_COLUMNS":
|
|
51406
|
+
case "FREEZE_ROWS":
|
|
51407
|
+
case "UNFREEZE_COLUMNS_ROWS":
|
|
51347
51408
|
case "REMOVE_COLUMNS_ROWS":
|
|
51348
51409
|
case "RESIZE_COLUMNS_ROWS":
|
|
51349
51410
|
case "HIDE_COLUMNS_ROWS":
|
|
@@ -51356,11 +51417,9 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
51356
51417
|
case "FOLD_HEADER_GROUPS_IN_ZONE":
|
|
51357
51418
|
case "UNFOLD_HEADER_GROUPS_IN_ZONE":
|
|
51358
51419
|
case "UNFOLD_ALL_HEADER_GROUPS":
|
|
51359
|
-
case "FOLD_ALL_HEADER_GROUPS":
|
|
51360
|
-
|
|
51361
|
-
this.sheetsWithDirtyViewports.add(sheetId);
|
|
51420
|
+
case "FOLD_ALL_HEADER_GROUPS":
|
|
51421
|
+
this.sheetsWithDirtyViewports.add(cmd.sheetId);
|
|
51362
51422
|
break;
|
|
51363
|
-
}
|
|
51364
51423
|
case "UPDATE_CELL":
|
|
51365
51424
|
// update cell content or format can change hidden rows because of data filters
|
|
51366
51425
|
if ("content" in cmd || "format" in cmd || cmd.style?.fontSize !== undefined) {
|
|
@@ -51376,13 +51435,6 @@ class SheetViewPlugin extends UIPlugin {
|
|
|
51376
51435
|
case "ACTIVATE_SHEET":
|
|
51377
51436
|
this.sheetsWithDirtyViewports.add(cmd.sheetIdTo);
|
|
51378
51437
|
break;
|
|
51379
|
-
case "UNFREEZE_ROWS":
|
|
51380
|
-
case "UNFREEZE_COLUMNS":
|
|
51381
|
-
case "FREEZE_COLUMNS":
|
|
51382
|
-
case "FREEZE_ROWS":
|
|
51383
|
-
case "UNFREEZE_COLUMNS_ROWS":
|
|
51384
|
-
this.resetViewports(this.getters.getActiveSheetId());
|
|
51385
|
-
break;
|
|
51386
51438
|
case "DELETE_SHEET":
|
|
51387
51439
|
this.sheetsWithDirtyViewports.delete(cmd.sheetId);
|
|
51388
51440
|
break;
|
|
@@ -58219,6 +58271,6 @@ const constants = {
|
|
|
58219
58271
|
export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
|
|
58220
58272
|
|
|
58221
58273
|
|
|
58222
|
-
__info__.version = "17.0.
|
|
58223
|
-
__info__.date = "2025-
|
|
58224
|
-
__info__.hash = "
|
|
58274
|
+
__info__.version = "17.0.61";
|
|
58275
|
+
__info__.date = "2025-05-12T05:21:02.159Z";
|
|
58276
|
+
__info__.hash = "0368641";
|