@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
|
(function (exports, owl) {
|
|
@@ -4485,6 +4485,25 @@
|
|
|
4485
4485
|
})
|
|
4486
4486
|
.filter(isDefined$1);
|
|
4487
4487
|
}
|
|
4488
|
+
function getNextSheetName(existingNames, baseName = "Sheet") {
|
|
4489
|
+
let i = 1;
|
|
4490
|
+
let name = `${baseName}${i}`;
|
|
4491
|
+
while (existingNames.includes(name)) {
|
|
4492
|
+
name = `${baseName}${i}`;
|
|
4493
|
+
i++;
|
|
4494
|
+
}
|
|
4495
|
+
return name;
|
|
4496
|
+
}
|
|
4497
|
+
function getDuplicateSheetName(nameToDuplicate, existingNames) {
|
|
4498
|
+
let i = 1;
|
|
4499
|
+
const baseName = _t("Copy of %s", nameToDuplicate);
|
|
4500
|
+
let name = baseName.toString();
|
|
4501
|
+
while (existingNames.includes(name)) {
|
|
4502
|
+
name = `${baseName} (${i})`;
|
|
4503
|
+
i++;
|
|
4504
|
+
}
|
|
4505
|
+
return name;
|
|
4506
|
+
}
|
|
4488
4507
|
|
|
4489
4508
|
function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
|
|
4490
4509
|
return numberOfLines * (textLineHeight + MIN_CELL_TEXT_MARGIN) - MIN_CELL_TEXT_MARGIN;
|
|
@@ -8027,10 +8046,13 @@
|
|
|
8027
8046
|
name: _t("Duplicate"),
|
|
8028
8047
|
execute: (env) => {
|
|
8029
8048
|
const sheetIdFrom = env.model.getters.getActiveSheetId();
|
|
8049
|
+
const sheetNameFrom = env.model.getters.getSheetName(sheetIdFrom);
|
|
8030
8050
|
const sheetIdTo = env.model.uuidGenerator.smallUuid();
|
|
8051
|
+
const sheetNameTo = env.model.getters.getDuplicateSheetName(sheetNameFrom);
|
|
8031
8052
|
env.model.dispatch("DUPLICATE_SHEET", {
|
|
8032
8053
|
sheetId: sheetIdFrom,
|
|
8033
8054
|
sheetIdTo,
|
|
8055
|
+
sheetNameTo,
|
|
8034
8056
|
});
|
|
8035
8057
|
env.model.dispatch("ACTIVATE_SHEET", { sheetIdFrom, sheetIdTo });
|
|
8036
8058
|
},
|
|
@@ -8790,9 +8812,6 @@
|
|
|
8790
8812
|
};
|
|
8791
8813
|
}
|
|
8792
8814
|
getDefinitionForExcel() {
|
|
8793
|
-
// Excel does not support aggregating labels
|
|
8794
|
-
if (this.aggregated)
|
|
8795
|
-
return undefined;
|
|
8796
8815
|
const dataSets = this.dataSets
|
|
8797
8816
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
8798
8817
|
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
@@ -9369,9 +9388,6 @@
|
|
|
9369
9388
|
return new LineChart(definition, this.sheetId, this.getters);
|
|
9370
9389
|
}
|
|
9371
9390
|
getDefinitionForExcel() {
|
|
9372
|
-
// Excel does not support aggregating labels
|
|
9373
|
-
if (this.aggregated)
|
|
9374
|
-
return undefined;
|
|
9375
9391
|
const dataSets = this.dataSets
|
|
9376
9392
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
9377
9393
|
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
@@ -9677,9 +9693,6 @@
|
|
|
9677
9693
|
return new PieChart(definition, sheetId, this.getters);
|
|
9678
9694
|
}
|
|
9679
9695
|
getDefinitionForExcel() {
|
|
9680
|
-
// Excel does not support aggregating labels
|
|
9681
|
-
if (this.aggregated)
|
|
9682
|
-
return undefined;
|
|
9683
9696
|
const dataSets = this.dataSets
|
|
9684
9697
|
.map((ds) => toExcelDataset(this.getters, ds))
|
|
9685
9698
|
.filter((ds) => ds.range !== "" && ds.range !== INCORRECT_RANGE_STRING);
|
|
@@ -27157,6 +27170,13 @@
|
|
|
27157
27170
|
this.props.onInputContextMenu?.(ev);
|
|
27158
27171
|
}
|
|
27159
27172
|
}
|
|
27173
|
+
onWheel(event) {
|
|
27174
|
+
// detect if scrollbar is available
|
|
27175
|
+
if (this.composerRef.el &&
|
|
27176
|
+
this.composerRef.el.scrollHeight > this.composerRef.el.clientHeight) {
|
|
27177
|
+
event.stopPropagation();
|
|
27178
|
+
}
|
|
27179
|
+
}
|
|
27160
27180
|
// ---------------------------------------------------------------------------
|
|
27161
27181
|
// Private
|
|
27162
27182
|
// ---------------------------------------------------------------------------
|
|
@@ -27465,12 +27485,15 @@
|
|
|
27465
27485
|
});
|
|
27466
27486
|
}
|
|
27467
27487
|
get composerProps() {
|
|
27488
|
+
// Remove the wrapper border width
|
|
27489
|
+
const maxHeight = this.props.gridDims.height - this.rect.y - 2 * COMPOSER_BORDER_WIDTH;
|
|
27468
27490
|
return {
|
|
27469
27491
|
focus: this.props.focus,
|
|
27470
27492
|
isDefaultFocus: true,
|
|
27471
27493
|
onComposerContentFocused: this.props.onComposerContentFocused,
|
|
27472
27494
|
onComposerCellFocused: this.props.onComposerCellFocused,
|
|
27473
27495
|
onInputContextMenu: this.props.onInputContextMenu,
|
|
27496
|
+
inputStyle: `max-height: ${maxHeight}px;`,
|
|
27474
27497
|
};
|
|
27475
27498
|
}
|
|
27476
27499
|
get containerStyle() {
|
|
@@ -28483,18 +28506,28 @@
|
|
|
28483
28506
|
function useInterval(callback, delay) {
|
|
28484
28507
|
let intervalId;
|
|
28485
28508
|
const { setInterval, clearInterval } = window;
|
|
28509
|
+
const pause = () => {
|
|
28510
|
+
clearInterval(intervalId);
|
|
28511
|
+
intervalId = undefined;
|
|
28512
|
+
};
|
|
28513
|
+
const safeCallback = () => {
|
|
28514
|
+
try {
|
|
28515
|
+
callback();
|
|
28516
|
+
}
|
|
28517
|
+
catch (e) {
|
|
28518
|
+
pause();
|
|
28519
|
+
throw e;
|
|
28520
|
+
}
|
|
28521
|
+
};
|
|
28486
28522
|
owl.useEffect(() => {
|
|
28487
|
-
intervalId = setInterval(
|
|
28523
|
+
intervalId = setInterval(safeCallback, delay);
|
|
28488
28524
|
return () => clearInterval(intervalId);
|
|
28489
28525
|
}, () => [delay]);
|
|
28490
28526
|
return {
|
|
28491
|
-
pause
|
|
28492
|
-
clearInterval(intervalId);
|
|
28493
|
-
intervalId = undefined;
|
|
28494
|
-
},
|
|
28527
|
+
pause,
|
|
28495
28528
|
resume: () => {
|
|
28496
28529
|
if (intervalId === undefined) {
|
|
28497
|
-
intervalId = setInterval(
|
|
28530
|
+
intervalId = setInterval(safeCallback, delay);
|
|
28498
28531
|
}
|
|
28499
28532
|
},
|
|
28500
28533
|
};
|
|
@@ -28939,7 +28972,7 @@
|
|
|
28939
28972
|
position: absolute;
|
|
28940
28973
|
top: 0;
|
|
28941
28974
|
left: ${HEADER_WIDTH}px;
|
|
28942
|
-
right:
|
|
28975
|
+
right: ${SCROLLBAR_WIDTH}px;
|
|
28943
28976
|
height: ${HEADER_HEIGHT}px;
|
|
28944
28977
|
&.o-dragging {
|
|
28945
28978
|
cursor: grabbing;
|
|
@@ -29114,9 +29147,8 @@
|
|
|
29114
29147
|
position: absolute;
|
|
29115
29148
|
top: ${HEADER_HEIGHT}px;
|
|
29116
29149
|
left: 0;
|
|
29117
|
-
|
|
29150
|
+
bottom: ${SCROLLBAR_WIDTH}px;
|
|
29118
29151
|
width: ${HEADER_WIDTH}px;
|
|
29119
|
-
height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH}px);
|
|
29120
29152
|
&.o-dragging {
|
|
29121
29153
|
cursor: grabbing;
|
|
29122
29154
|
}
|
|
@@ -34354,6 +34386,7 @@
|
|
|
34354
34386
|
initialMessages = dropCommands(initialMessages, "SORT_CELLS");
|
|
34355
34387
|
initialMessages = dropCommands(initialMessages, "SET_DECIMAL");
|
|
34356
34388
|
initialMessages = fixChartDefinitions(data, initialMessages);
|
|
34389
|
+
initialMessages = fixTranslatedDuplicateSheetName(data, initialMessages);
|
|
34357
34390
|
return initialMessages;
|
|
34358
34391
|
}
|
|
34359
34392
|
/**
|
|
@@ -34473,6 +34506,40 @@
|
|
|
34473
34506
|
}
|
|
34474
34507
|
return data;
|
|
34475
34508
|
}
|
|
34509
|
+
function fixTranslatedDuplicateSheetName(data, initialMessages) {
|
|
34510
|
+
const sheetNames = {};
|
|
34511
|
+
for (const sheet of data.sheets || []) {
|
|
34512
|
+
sheetNames[sheet.id] = sheet.name;
|
|
34513
|
+
}
|
|
34514
|
+
const messages = [];
|
|
34515
|
+
for (const message of initialMessages) {
|
|
34516
|
+
if (message.type === "REMOTE_REVISION") {
|
|
34517
|
+
const commands = [];
|
|
34518
|
+
for (const cmd of message.commands) {
|
|
34519
|
+
switch (cmd.type) {
|
|
34520
|
+
case "DUPLICATE_SHEET":
|
|
34521
|
+
cmd.sheetNameTo =
|
|
34522
|
+
cmd.sheetNameTo ??
|
|
34523
|
+
getDuplicateSheetName(sheetNames[cmd.sheetId], Object.values(sheetNames));
|
|
34524
|
+
break;
|
|
34525
|
+
case "CREATE_SHEET":
|
|
34526
|
+
case "RENAME_SHEET":
|
|
34527
|
+
sheetNames[cmd.sheetId] = cmd.name || getNextSheetName(Object.values(sheetNames));
|
|
34528
|
+
break;
|
|
34529
|
+
}
|
|
34530
|
+
commands.push(cmd);
|
|
34531
|
+
}
|
|
34532
|
+
messages.push({
|
|
34533
|
+
...message,
|
|
34534
|
+
commands,
|
|
34535
|
+
});
|
|
34536
|
+
}
|
|
34537
|
+
else {
|
|
34538
|
+
messages.push(message);
|
|
34539
|
+
}
|
|
34540
|
+
}
|
|
34541
|
+
return initialMessages;
|
|
34542
|
+
}
|
|
34476
34543
|
// -----------------------------------------------------------------------------
|
|
34477
34544
|
// Helpers
|
|
34478
34545
|
// -----------------------------------------------------------------------------
|
|
@@ -36703,9 +36770,7 @@
|
|
|
36703
36770
|
: "Success" /* CommandResult.Success */;
|
|
36704
36771
|
}
|
|
36705
36772
|
checkChartExists(cmd) {
|
|
36706
|
-
return this.
|
|
36707
|
-
? "Success" /* CommandResult.Success */
|
|
36708
|
-
: "ChartDoesNotExist" /* CommandResult.ChartDoesNotExist */;
|
|
36773
|
+
return this.isChartDefined(cmd.id) ? "Success" /* CommandResult.Success */ : "ChartDoesNotExist" /* CommandResult.ChartDoesNotExist */;
|
|
36709
36774
|
}
|
|
36710
36775
|
}
|
|
36711
36776
|
|
|
@@ -39504,6 +39569,7 @@
|
|
|
39504
39569
|
"getCommandZones",
|
|
39505
39570
|
"getUnboundedZone",
|
|
39506
39571
|
"checkElementsIncludeAllNonFrozenHeaders",
|
|
39572
|
+
"getDuplicateSheetName",
|
|
39507
39573
|
];
|
|
39508
39574
|
sheetIdsMapName = {};
|
|
39509
39575
|
orderedSheetIds = [];
|
|
@@ -39528,7 +39594,11 @@
|
|
|
39528
39594
|
return this.checkValidations(cmd, this.checkSheetName, this.checkSheetPosition);
|
|
39529
39595
|
}
|
|
39530
39596
|
case "DUPLICATE_SHEET": {
|
|
39531
|
-
|
|
39597
|
+
if (this.sheets[cmd.sheetIdTo])
|
|
39598
|
+
return "DuplicatedSheetId" /* CommandResult.DuplicatedSheetId */;
|
|
39599
|
+
if (this.orderedSheetIds.map(this.getSheetName.bind(this)).includes(cmd.sheetNameTo))
|
|
39600
|
+
return "DuplicatedSheetName" /* CommandResult.DuplicatedSheetName */;
|
|
39601
|
+
return "Success" /* CommandResult.Success */;
|
|
39532
39602
|
}
|
|
39533
39603
|
case "MOVE_SHEET":
|
|
39534
39604
|
try {
|
|
@@ -39601,7 +39671,7 @@
|
|
|
39601
39671
|
this.showSheet(cmd.sheetId);
|
|
39602
39672
|
break;
|
|
39603
39673
|
case "DUPLICATE_SHEET":
|
|
39604
|
-
this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo);
|
|
39674
|
+
this.duplicateSheet(cmd.sheetId, cmd.sheetIdTo, cmd.sheetNameTo);
|
|
39605
39675
|
break;
|
|
39606
39676
|
case "DELETE_SHEET":
|
|
39607
39677
|
this.deleteSheet(this.sheets[cmd.sheetId]);
|
|
@@ -39811,14 +39881,8 @@
|
|
|
39811
39881
|
return dimension === "COL" ? this.getNumberCols(sheetId) : this.getNumberRows(sheetId);
|
|
39812
39882
|
}
|
|
39813
39883
|
getNextSheetName(baseName = "Sheet") {
|
|
39814
|
-
let i = 1;
|
|
39815
39884
|
const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
|
|
39816
|
-
|
|
39817
|
-
while (names.includes(name)) {
|
|
39818
|
-
name = `${baseName}${i}`;
|
|
39819
|
-
i++;
|
|
39820
|
-
}
|
|
39821
|
-
return name;
|
|
39885
|
+
return getNextSheetName(names, baseName);
|
|
39822
39886
|
}
|
|
39823
39887
|
getSheetSize(sheetId) {
|
|
39824
39888
|
return {
|
|
@@ -40078,9 +40142,8 @@
|
|
|
40078
40142
|
showSheet(sheetId) {
|
|
40079
40143
|
this.history.update("sheets", sheetId, "isVisible", true);
|
|
40080
40144
|
}
|
|
40081
|
-
duplicateSheet(fromId, toId) {
|
|
40145
|
+
duplicateSheet(fromId, toId, toName) {
|
|
40082
40146
|
const sheet = this.getSheet(fromId);
|
|
40083
|
-
const toName = this.getDuplicateSheetName(sheet.name);
|
|
40084
40147
|
const newSheet = deepCopy(sheet);
|
|
40085
40148
|
newSheet.id = toId;
|
|
40086
40149
|
newSheet.name = toName;
|
|
@@ -40112,15 +40175,8 @@
|
|
|
40112
40175
|
this.history.update("sheetIdsMapName", sheetIdsMapName);
|
|
40113
40176
|
}
|
|
40114
40177
|
getDuplicateSheetName(sheetName) {
|
|
40115
|
-
let i = 1;
|
|
40116
40178
|
const names = this.orderedSheetIds.map(this.getSheetName.bind(this));
|
|
40117
|
-
|
|
40118
|
-
let name = baseName.toString();
|
|
40119
|
-
while (names.includes(name)) {
|
|
40120
|
-
name = `${baseName} (${i})`;
|
|
40121
|
-
i++;
|
|
40122
|
-
}
|
|
40123
|
-
return name;
|
|
40179
|
+
return getDuplicateSheetName(sheetName, names);
|
|
40124
40180
|
}
|
|
40125
40181
|
deleteSheet(sheet) {
|
|
40126
40182
|
const name = sheet.name;
|
|
@@ -50604,6 +50660,8 @@
|
|
|
50604
50660
|
});
|
|
50605
50661
|
this.selectCell(col, row);
|
|
50606
50662
|
}
|
|
50663
|
+
const { col, row } = this.gridSelection.anchor.cell;
|
|
50664
|
+
this.moveClient({ sheetId: this.activeSheet.id, col, row });
|
|
50607
50665
|
}
|
|
50608
50666
|
/**
|
|
50609
50667
|
* Ensure selections are not outside sheet boundaries.
|
|
@@ -51343,8 +51401,11 @@
|
|
|
51343
51401
|
}
|
|
51344
51402
|
case "REMOVE_FILTER_TABLE":
|
|
51345
51403
|
case "UPDATE_FILTER":
|
|
51346
|
-
|
|
51347
|
-
|
|
51404
|
+
case "UNFREEZE_ROWS":
|
|
51405
|
+
case "UNFREEZE_COLUMNS":
|
|
51406
|
+
case "FREEZE_COLUMNS":
|
|
51407
|
+
case "FREEZE_ROWS":
|
|
51408
|
+
case "UNFREEZE_COLUMNS_ROWS":
|
|
51348
51409
|
case "REMOVE_COLUMNS_ROWS":
|
|
51349
51410
|
case "RESIZE_COLUMNS_ROWS":
|
|
51350
51411
|
case "HIDE_COLUMNS_ROWS":
|
|
@@ -51357,11 +51418,9 @@
|
|
|
51357
51418
|
case "FOLD_HEADER_GROUPS_IN_ZONE":
|
|
51358
51419
|
case "UNFOLD_HEADER_GROUPS_IN_ZONE":
|
|
51359
51420
|
case "UNFOLD_ALL_HEADER_GROUPS":
|
|
51360
|
-
case "FOLD_ALL_HEADER_GROUPS":
|
|
51361
|
-
|
|
51362
|
-
this.sheetsWithDirtyViewports.add(sheetId);
|
|
51421
|
+
case "FOLD_ALL_HEADER_GROUPS":
|
|
51422
|
+
this.sheetsWithDirtyViewports.add(cmd.sheetId);
|
|
51363
51423
|
break;
|
|
51364
|
-
}
|
|
51365
51424
|
case "UPDATE_CELL":
|
|
51366
51425
|
// update cell content or format can change hidden rows because of data filters
|
|
51367
51426
|
if ("content" in cmd || "format" in cmd || cmd.style?.fontSize !== undefined) {
|
|
@@ -51377,13 +51436,6 @@
|
|
|
51377
51436
|
case "ACTIVATE_SHEET":
|
|
51378
51437
|
this.sheetsWithDirtyViewports.add(cmd.sheetIdTo);
|
|
51379
51438
|
break;
|
|
51380
|
-
case "UNFREEZE_ROWS":
|
|
51381
|
-
case "UNFREEZE_COLUMNS":
|
|
51382
|
-
case "FREEZE_COLUMNS":
|
|
51383
|
-
case "FREEZE_ROWS":
|
|
51384
|
-
case "UNFREEZE_COLUMNS_ROWS":
|
|
51385
|
-
this.resetViewports(this.getters.getActiveSheetId());
|
|
51386
|
-
break;
|
|
51387
51439
|
case "DELETE_SHEET":
|
|
51388
51440
|
this.sheetsWithDirtyViewports.delete(cmd.sheetId);
|
|
51389
51441
|
break;
|
|
@@ -58255,9 +58307,9 @@
|
|
|
58255
58307
|
exports.tokenize = tokenize;
|
|
58256
58308
|
|
|
58257
58309
|
|
|
58258
|
-
__info__.version = "17.0.
|
|
58259
|
-
__info__.date = "2025-
|
|
58260
|
-
__info__.hash = "
|
|
58310
|
+
__info__.version = "17.0.61";
|
|
58311
|
+
__info__.date = "2025-05-12T05:21:02.159Z";
|
|
58312
|
+
__info__.hash = "0368641";
|
|
58261
58313
|
|
|
58262
58314
|
|
|
58263
58315
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|