@odoo/o-spreadsheet 17.4.34 → 17.4.35
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 +92 -44
- package/dist/o-spreadsheet.d.ts +8 -8
- package/dist/o-spreadsheet.esm.js +92 -44
- package/dist/o-spreadsheet.iife.js +92 -44
- package/dist/o-spreadsheet.iife.min.js +347 -347
- package/dist/o_spreadsheet.xml +5 -5
- 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-05-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 17.4.35
|
|
6
|
+
* @date 2025-05-13T17:49:44.553Z
|
|
7
|
+
* @hash 534c5f4
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -1915,7 +1915,7 @@
|
|
|
1915
1915
|
*/
|
|
1916
1916
|
const getFormulaNumberRegex = memoize(function getFormulaNumberRegex(decimalSeparator) {
|
|
1917
1917
|
decimalSeparator = escapeRegExp(decimalSeparator);
|
|
1918
|
-
return new RegExp(`(?:^-?\\d+(?:${decimalSeparator}?\\d*(?:e
|
|
1918
|
+
return new RegExp(`(?:^-?\\d+(?:${decimalSeparator}?\\d*(?:e(\\+|-)?\\d+)?)?|^-?${decimalSeparator}\\d+)(?!\\w|!)`);
|
|
1919
1919
|
});
|
|
1920
1920
|
const getNumberRegex = memoize(function getNumberRegex(locale) {
|
|
1921
1921
|
const decimalSeparator = escapeRegExp(locale.decimalSeparator);
|
|
@@ -5210,6 +5210,13 @@
|
|
|
5210
5210
|
}
|
|
5211
5211
|
return name;
|
|
5212
5212
|
}
|
|
5213
|
+
function isSheetNameEqual(name1, name2) {
|
|
5214
|
+
if (name1 === undefined || name2 === undefined) {
|
|
5215
|
+
return false;
|
|
5216
|
+
}
|
|
5217
|
+
return (getUnquotedSheetName(name1.trim().toUpperCase()) ===
|
|
5218
|
+
getUnquotedSheetName(name2.trim().toUpperCase()));
|
|
5219
|
+
}
|
|
5213
5220
|
|
|
5214
5221
|
function computeTextLinesHeight(textLineHeight, numberOfLines = 1) {
|
|
5215
5222
|
return numberOfLines * (textLineHeight + MIN_CELL_TEXT_MARGIN) - MIN_CELL_TEXT_MARGIN;
|
|
@@ -6511,10 +6518,9 @@
|
|
|
6511
6518
|
avg: _t("Average"),
|
|
6512
6519
|
sum: _t("Sum"),
|
|
6513
6520
|
};
|
|
6514
|
-
const NUMBER_CHAR_AGGREGATORS = ["max", "min", "avg", "sum", "count_distinct", "count"];
|
|
6515
6521
|
const AGGREGATORS_BY_FIELD_TYPE = {
|
|
6516
|
-
integer:
|
|
6517
|
-
char:
|
|
6522
|
+
integer: ["max", "min", "avg", "sum", "count_distinct", "count"],
|
|
6523
|
+
char: ["count_distinct", "count"],
|
|
6518
6524
|
boolean: ["count_distinct", "count", "bool_and", "bool_or"],
|
|
6519
6525
|
};
|
|
6520
6526
|
const AGGREGATORS = {};
|
|
@@ -6728,8 +6734,11 @@
|
|
|
6728
6734
|
const evaluatedCell = this.getters.getEvaluatedCell(position);
|
|
6729
6735
|
const pivotId = this.getters.getPivotIdFromPosition(position);
|
|
6730
6736
|
const spreader = this.getters.getArrayFormulaSpreadingOn(position);
|
|
6731
|
-
if (pivotId) {
|
|
6732
|
-
|
|
6737
|
+
if (pivotId && spreader) {
|
|
6738
|
+
const pivotZone = this.getters.getSpreadZone(spreader);
|
|
6739
|
+
if ((!deepEquals(spreader, position) || !isCopyingOneCell) &&
|
|
6740
|
+
pivotZone &&
|
|
6741
|
+
!data.zones.some((z) => isZoneInside(pivotZone, z))) {
|
|
6733
6742
|
const pivotCell = this.getters.getPivotCellFromPosition(position);
|
|
6734
6743
|
const formulaPivotId = this.getters.getPivotFormulaId(pivotId);
|
|
6735
6744
|
const pivotFormula = createPivotFormula(formulaPivotId, pivotCell);
|
|
@@ -9451,7 +9460,10 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
9451
9460
|
const functionProxy = new Proxy(value, {
|
|
9452
9461
|
// trap the function call
|
|
9453
9462
|
apply(target, thisArg, argArray) {
|
|
9454
|
-
Reflect.apply(target, thisStore, argArray);
|
|
9463
|
+
const res = Reflect.apply(target, thisStore, argArray);
|
|
9464
|
+
if (res === "noStateChange") {
|
|
9465
|
+
return;
|
|
9466
|
+
}
|
|
9455
9467
|
callback();
|
|
9456
9468
|
},
|
|
9457
9469
|
});
|
|
@@ -9473,7 +9485,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
9473
9485
|
const ModelStore = createAbstractStore("Model");
|
|
9474
9486
|
|
|
9475
9487
|
class RendererStore {
|
|
9476
|
-
mutators = ["register", "unRegister"];
|
|
9488
|
+
mutators = ["register", "unRegister", "drawLayer"];
|
|
9477
9489
|
renderers = {};
|
|
9478
9490
|
register(renderer) {
|
|
9479
9491
|
if (!renderer.renderingLayers.length) {
|
|
@@ -9493,14 +9505,14 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
9493
9505
|
}
|
|
9494
9506
|
drawLayer(context, layer) {
|
|
9495
9507
|
const renderers = this.renderers[layer];
|
|
9496
|
-
if (
|
|
9497
|
-
|
|
9498
|
-
|
|
9499
|
-
|
|
9500
|
-
|
|
9501
|
-
|
|
9502
|
-
context.ctx.restore();
|
|
9508
|
+
if (renderers) {
|
|
9509
|
+
for (const renderer of renderers) {
|
|
9510
|
+
context.ctx.save();
|
|
9511
|
+
renderer.drawLayer(context, layer);
|
|
9512
|
+
context.ctx.restore();
|
|
9513
|
+
}
|
|
9503
9514
|
}
|
|
9515
|
+
return "noStateChange";
|
|
9504
9516
|
}
|
|
9505
9517
|
}
|
|
9506
9518
|
|
|
@@ -10113,7 +10125,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10113
10125
|
.find((token) => {
|
|
10114
10126
|
const { xc, sheetName: sheet } = splitReference(token.value);
|
|
10115
10127
|
const sheetName = sheet || this.getters.getSheetName(this.sheetId);
|
|
10116
|
-
if (this.getters.getSheetName(activeSheetId)
|
|
10128
|
+
if (!isSheetNameEqual(this.getters.getSheetName(activeSheetId), sheetName)) {
|
|
10117
10129
|
return false;
|
|
10118
10130
|
}
|
|
10119
10131
|
const refRange = this.getters.getRangeFromSheetXC(activeSheetId, xc);
|
|
@@ -10418,27 +10430,30 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
10418
10430
|
}
|
|
10419
10431
|
focusTopBarComposer(selection) {
|
|
10420
10432
|
if (this.getters.isReadonly()) {
|
|
10421
|
-
return;
|
|
10433
|
+
return "noStateChange";
|
|
10422
10434
|
}
|
|
10423
10435
|
this.topBarFocus = "contentFocus";
|
|
10424
10436
|
this.gridFocusMode = "inactive";
|
|
10425
|
-
this.setComposerContent({ selection }
|
|
10437
|
+
this.setComposerContent({ selection });
|
|
10438
|
+
return;
|
|
10426
10439
|
}
|
|
10427
10440
|
focusGridComposerContent() {
|
|
10428
10441
|
if (this.getters.isReadonly()) {
|
|
10429
|
-
return;
|
|
10442
|
+
return "noStateChange";
|
|
10430
10443
|
}
|
|
10431
10444
|
this.topBarFocus = "inactive";
|
|
10432
10445
|
this.gridFocusMode = "contentFocus";
|
|
10433
10446
|
this.setComposerContent({});
|
|
10447
|
+
return;
|
|
10434
10448
|
}
|
|
10435
10449
|
focusGridComposerCell(content, selection) {
|
|
10436
10450
|
if (this.getters.isReadonly()) {
|
|
10437
|
-
return;
|
|
10451
|
+
return "noStateChange";
|
|
10438
10452
|
}
|
|
10439
10453
|
this.topBarFocus = "inactive";
|
|
10440
10454
|
this.gridFocusMode = "cellFocus";
|
|
10441
|
-
this.setComposerContent({ content, selection }
|
|
10455
|
+
this.setComposerContent({ content, selection });
|
|
10456
|
+
return;
|
|
10442
10457
|
}
|
|
10443
10458
|
/**
|
|
10444
10459
|
* Start the edition or update the content if it's already started.
|
|
@@ -20323,6 +20338,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
20323
20338
|
return data === undefined || data.value === null;
|
|
20324
20339
|
}
|
|
20325
20340
|
const getNeutral = { number: 0, string: "", boolean: false };
|
|
20341
|
+
function areAlmostEqual(value1, value2, epsilon = 2e-16) {
|
|
20342
|
+
return Math.abs(value1 - value2) < epsilon;
|
|
20343
|
+
}
|
|
20326
20344
|
const EQ = {
|
|
20327
20345
|
description: _t("Equal."),
|
|
20328
20346
|
args: [
|
|
@@ -20344,6 +20362,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
20344
20362
|
if (isEvaluationError(_value2)) {
|
|
20345
20363
|
throw value2;
|
|
20346
20364
|
}
|
|
20365
|
+
if (typeof _value1 === "number" && typeof _value2 === "number") {
|
|
20366
|
+
return areAlmostEqual(_value1, _value2);
|
|
20367
|
+
}
|
|
20347
20368
|
return _value1 === _value2;
|
|
20348
20369
|
},
|
|
20349
20370
|
};
|
|
@@ -20383,6 +20404,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
20383
20404
|
],
|
|
20384
20405
|
compute: function (value1, value2) {
|
|
20385
20406
|
return applyRelationalOperator(value1, value2, (v1, v2) => {
|
|
20407
|
+
if (typeof v1 === "number" && typeof v2 === "number") {
|
|
20408
|
+
return !areAlmostEqual(v1, v2) && v1 > v2;
|
|
20409
|
+
}
|
|
20386
20410
|
return v1 > v2;
|
|
20387
20411
|
});
|
|
20388
20412
|
},
|
|
@@ -20398,6 +20422,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
20398
20422
|
],
|
|
20399
20423
|
compute: function (value1, value2) {
|
|
20400
20424
|
return applyRelationalOperator(value1, value2, (v1, v2) => {
|
|
20425
|
+
if (typeof v1 === "number" && typeof v2 === "number") {
|
|
20426
|
+
return areAlmostEqual(v1, v2) || v1 > v2;
|
|
20427
|
+
}
|
|
20401
20428
|
return v1 >= v2;
|
|
20402
20429
|
});
|
|
20403
20430
|
},
|
|
@@ -21498,10 +21525,18 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
21498
21525
|
});
|
|
21499
21526
|
|
|
21500
21527
|
class DOMFocusableElementStore {
|
|
21501
|
-
mutators = ["setFocusableElement"];
|
|
21528
|
+
mutators = ["setFocusableElement", "focus"];
|
|
21502
21529
|
focusableElement = undefined;
|
|
21503
21530
|
setFocusableElement(element) {
|
|
21504
21531
|
this.focusableElement = element;
|
|
21532
|
+
return "noStateChange";
|
|
21533
|
+
}
|
|
21534
|
+
focus() {
|
|
21535
|
+
if (this.focusableElement === document.activeElement) {
|
|
21536
|
+
return "noStateChange";
|
|
21537
|
+
}
|
|
21538
|
+
this.focusableElement?.focus();
|
|
21539
|
+
return;
|
|
21505
21540
|
}
|
|
21506
21541
|
}
|
|
21507
21542
|
|
|
@@ -21758,12 +21793,20 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
21758
21793
|
}
|
|
21759
21794
|
}
|
|
21760
21795
|
hover(position) {
|
|
21796
|
+
if (position.col === this.col && position.row === this.row) {
|
|
21797
|
+
return "noStateChange";
|
|
21798
|
+
}
|
|
21761
21799
|
this.col = position.col;
|
|
21762
21800
|
this.row = position.row;
|
|
21801
|
+
return;
|
|
21763
21802
|
}
|
|
21764
21803
|
clear() {
|
|
21804
|
+
if (this.col === undefined && this.row === undefined) {
|
|
21805
|
+
return "noStateChange";
|
|
21806
|
+
}
|
|
21765
21807
|
this.col = undefined;
|
|
21766
21808
|
this.row = undefined;
|
|
21809
|
+
return;
|
|
21767
21810
|
}
|
|
21768
21811
|
}
|
|
21769
21812
|
|
|
@@ -21785,7 +21828,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
21785
21828
|
this.persistentPopover = { col, row, sheetId, type };
|
|
21786
21829
|
}
|
|
21787
21830
|
close() {
|
|
21831
|
+
if (!this.persistentPopover) {
|
|
21832
|
+
return "noStateChange";
|
|
21833
|
+
}
|
|
21788
21834
|
this.persistentPopover = undefined;
|
|
21835
|
+
return;
|
|
21789
21836
|
}
|
|
21790
21837
|
get persistentCellPopover() {
|
|
21791
21838
|
return ((this.persistentPopover && { isOpen: true, ...this.persistentPopover }) || { isOpen: false });
|
|
@@ -37461,7 +37508,12 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
37461
37508
|
entry[field.name] = { value: null, type: CellValueType.empty };
|
|
37462
37509
|
}
|
|
37463
37510
|
else {
|
|
37464
|
-
|
|
37511
|
+
if (field.type === "char") {
|
|
37512
|
+
entry[field.name] = { ...cell, value: cell.formattedValue || null };
|
|
37513
|
+
}
|
|
37514
|
+
else {
|
|
37515
|
+
entry[field.name] = cell;
|
|
37516
|
+
}
|
|
37465
37517
|
}
|
|
37466
37518
|
}
|
|
37467
37519
|
entry["__count"] = { value: 1, type: CellValueType.number };
|
|
@@ -39656,7 +39708,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
39656
39708
|
this.isEditing = isEditing;
|
|
39657
39709
|
if (!isEditing) {
|
|
39658
39710
|
this.rect = this.defaultRect;
|
|
39659
|
-
this.DOMFocusableElementStore.
|
|
39711
|
+
this.DOMFocusableElementStore.focus();
|
|
39660
39712
|
return;
|
|
39661
39713
|
}
|
|
39662
39714
|
const position = this.env.model.getters.getActivePosition();
|
|
@@ -42092,10 +42144,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
42092
42144
|
ctx.scale(dpr, dpr);
|
|
42093
42145
|
for (const layer of OrderedLayers()) {
|
|
42094
42146
|
model.drawLayer(renderingContext, layer);
|
|
42095
|
-
// @ts-ignore 'drawLayer' is not declated as a mutator because:
|
|
42096
|
-
// it does not mutate anything. Most importantly it's used
|
|
42097
|
-
// during rendering. Invoking a mutator during rendering would
|
|
42098
|
-
// trigger another rendering, ultimately resulting in an infinite loop.
|
|
42099
42147
|
rendererStore.drawLayer(renderingContext, layer);
|
|
42100
42148
|
}
|
|
42101
42149
|
}
|
|
@@ -42718,7 +42766,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
42718
42766
|
this.cellPopovers = useStore(CellPopoverStore);
|
|
42719
42767
|
owl.useEffect(() => {
|
|
42720
42768
|
if (!this.sidePanel.isOpen) {
|
|
42721
|
-
this.DOMFocusableElementStore.
|
|
42769
|
+
this.DOMFocusableElementStore.focus();
|
|
42722
42770
|
}
|
|
42723
42771
|
}, () => [this.sidePanel.isOpen]);
|
|
42724
42772
|
}
|
|
@@ -42922,7 +42970,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
42922
42970
|
focusDefaultElement() {
|
|
42923
42971
|
if (!this.env.model.getters.getSelectedFigureId() &&
|
|
42924
42972
|
this.composerStore.editionMode === "inactive") {
|
|
42925
|
-
this.DOMFocusableElementStore.
|
|
42973
|
+
this.DOMFocusableElementStore.focus();
|
|
42926
42974
|
}
|
|
42927
42975
|
}
|
|
42928
42976
|
get gridEl() {
|
|
@@ -44659,7 +44707,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
44659
44707
|
({ xc, sheetName } = splitReference(reference));
|
|
44660
44708
|
let rangeSheetIndex;
|
|
44661
44709
|
if (sheetName) {
|
|
44662
|
-
const index = data.sheets.findIndex((sheet) => sheet.name
|
|
44710
|
+
const index = data.sheets.findIndex((sheet) => isSheetNameEqual(sheet.name, sheetName));
|
|
44663
44711
|
if (index < 0) {
|
|
44664
44712
|
throw new Error("Unable to find a sheet with the name " + sheetName);
|
|
44665
44713
|
}
|
|
@@ -44880,7 +44928,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
44880
44928
|
formula = formula.replace(externalReferenceRegex, (match, externalRefId, sheetName, cellRef) => {
|
|
44881
44929
|
externalRefId = Number(externalRefId) - 1;
|
|
44882
44930
|
cellRef = cellRef.replace(/\$/g, "");
|
|
44883
|
-
const sheetIndex = data.externalBooks[externalRefId].sheetNames.findIndex((name) => name
|
|
44931
|
+
const sheetIndex = data.externalBooks[externalRefId].sheetNames.findIndex((name) => isSheetNameEqual(name, sheetName));
|
|
44884
44932
|
if (sheetIndex === -1) {
|
|
44885
44933
|
return match;
|
|
44886
44934
|
}
|
|
@@ -45209,7 +45257,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
45209
45257
|
*/
|
|
45210
45258
|
function convertTableFormulaReferences(convertedSheets, xlsxSheets) {
|
|
45211
45259
|
for (let tableSheet of convertedSheets) {
|
|
45212
|
-
const tables = xlsxSheets.find((s) => s.sheetName
|
|
45260
|
+
const tables = xlsxSheets.find((s) => isSheetNameEqual(s.sheetName, tableSheet.name)).tables;
|
|
45213
45261
|
for (let table of tables) {
|
|
45214
45262
|
const tabRef = table.name + "[";
|
|
45215
45263
|
for (let sheet of convertedSheets) {
|
|
@@ -50886,7 +50934,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
50886
50934
|
if (range.sheetId === cmd.sheetId) {
|
|
50887
50935
|
return { changeType: "CHANGE", range };
|
|
50888
50936
|
}
|
|
50889
|
-
if (
|
|
50937
|
+
if (isSheetNameEqual(range.invalidSheetName, cmd.name)) {
|
|
50890
50938
|
const invalidSheetName = undefined;
|
|
50891
50939
|
const sheetId = cmd.sheetId;
|
|
50892
50940
|
const newRange = range.clone({ sheetId, invalidSheetName });
|
|
@@ -51457,7 +51505,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51457
51505
|
if (name) {
|
|
51458
51506
|
const unquotedName = getUnquotedSheetName(name);
|
|
51459
51507
|
for (const key in this.sheetIdsMapName) {
|
|
51460
|
-
if (key
|
|
51508
|
+
if (isSheetNameEqual(key, unquotedName)) {
|
|
51461
51509
|
return this.sheetIdsMapName[key];
|
|
51462
51510
|
}
|
|
51463
51511
|
}
|
|
@@ -51705,7 +51753,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51705
51753
|
}
|
|
51706
51754
|
const { orderedSheetIds, sheets } = this;
|
|
51707
51755
|
const name = cmd.name && cmd.name.trim().toLowerCase();
|
|
51708
|
-
if (orderedSheetIds.find((id) => sheets[id]?.name
|
|
51756
|
+
if (orderedSheetIds.find((id) => isSheetNameEqual(sheets[id]?.name, name) && id !== cmd.sheetId)) {
|
|
51709
51757
|
return "DuplicatedSheetName" /* CommandResult.DuplicatedSheetName */;
|
|
51710
51758
|
}
|
|
51711
51759
|
if (FORBIDDEN_SHEETNAME_CHARS_IN_EXCEL_REGEX.test(name)) {
|
|
@@ -63037,11 +63085,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
63037
63085
|
if (ev.key === "Enter") {
|
|
63038
63086
|
ev.preventDefault();
|
|
63039
63087
|
this.stopEdition();
|
|
63040
|
-
this.DOMFocusableElementStore.
|
|
63088
|
+
this.DOMFocusableElementStore.focus();
|
|
63041
63089
|
}
|
|
63042
63090
|
if (ev.key === "Escape") {
|
|
63043
63091
|
this.cancelEdition();
|
|
63044
|
-
this.DOMFocusableElementStore.
|
|
63092
|
+
this.DOMFocusableElementStore.focus();
|
|
63045
63093
|
}
|
|
63046
63094
|
}
|
|
63047
63095
|
onMouseEventSheetName(ev) {
|
|
@@ -69514,9 +69562,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
69514
69562
|
exports.tokenize = tokenize;
|
|
69515
69563
|
|
|
69516
69564
|
|
|
69517
|
-
__info__.version = "17.4.
|
|
69518
|
-
__info__.date = "2025-05-
|
|
69519
|
-
__info__.hash = "
|
|
69565
|
+
__info__.version = "17.4.35";
|
|
69566
|
+
__info__.date = "2025-05-13T17:49:44.553Z";
|
|
69567
|
+
__info__.hash = "534c5f4";
|
|
69520
69568
|
|
|
69521
69569
|
|
|
69522
69570
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|