@odoo/o-spreadsheet 18.5.0-alpha.0 → 18.5.0-alpha.1
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 +95 -29
- package/dist/o-spreadsheet.d.ts +1 -0
- package/dist/o-spreadsheet.esm.js +95 -29
- package/dist/o-spreadsheet.iife.js +95 -29
- package/dist/o-spreadsheet.iife.min.js +160 -160
- package/dist/o_spreadsheet.xml +3 -3
- 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.5.0-alpha.
|
|
6
|
-
* @date 2025-06-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.5.0-alpha.1
|
|
6
|
+
* @date 2025-06-27T09:12:49.245Z
|
|
7
|
+
* @hash 756e75b
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -26509,6 +26509,51 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
26509
26509
|
Object.assign(animatedBox.style, style);
|
|
26510
26510
|
},
|
|
26511
26511
|
});
|
|
26512
|
+
cellAnimationRegistry.add("iconFadeIn", {
|
|
26513
|
+
id: "iconFadeIn",
|
|
26514
|
+
easingFn: "easeInCubic",
|
|
26515
|
+
hasAnimation: (oldBox, newBox) => {
|
|
26516
|
+
return Boolean((!oldBox?.icons?.left && newBox?.icons?.left) ||
|
|
26517
|
+
(!oldBox?.icons?.right && newBox?.icons?.right) ||
|
|
26518
|
+
(!oldBox?.icons?.center && newBox?.icons?.center));
|
|
26519
|
+
},
|
|
26520
|
+
updateAnimation: function (progress, animatedBox, oldBox, newBox) {
|
|
26521
|
+
const iconOpacity = EASING_FN[this.easingFn](progress);
|
|
26522
|
+
if (animatedBox.icons.left && newBox.icons.left && !oldBox.icons.left) {
|
|
26523
|
+
animatedBox.icons.left.opacity = iconOpacity;
|
|
26524
|
+
}
|
|
26525
|
+
if (animatedBox.icons.right && newBox.icons.right && !oldBox.icons.right) {
|
|
26526
|
+
animatedBox.icons.right.opacity = iconOpacity;
|
|
26527
|
+
}
|
|
26528
|
+
if (animatedBox.icons.center && newBox.icons.center && !oldBox.icons.center) {
|
|
26529
|
+
animatedBox.icons.center.opacity = iconOpacity;
|
|
26530
|
+
}
|
|
26531
|
+
},
|
|
26532
|
+
});
|
|
26533
|
+
cellAnimationRegistry.add("iconFadeOut", {
|
|
26534
|
+
id: "iconFadeOut",
|
|
26535
|
+
easingFn: "easeOutCubic",
|
|
26536
|
+
hasAnimation: (oldBox, newBox) => {
|
|
26537
|
+
return Boolean((oldBox?.icons?.left && !newBox?.icons?.left) ||
|
|
26538
|
+
(oldBox?.icons?.right && !newBox?.icons?.right) ||
|
|
26539
|
+
(oldBox?.icons?.center && !newBox?.icons?.center));
|
|
26540
|
+
},
|
|
26541
|
+
updateAnimation: function (progress, animatedBox, oldBox, newBox) {
|
|
26542
|
+
const iconOpacity = 1 - EASING_FN[this.easingFn](progress);
|
|
26543
|
+
if (!animatedBox.icons) {
|
|
26544
|
+
animatedBox.icons = {};
|
|
26545
|
+
}
|
|
26546
|
+
if (oldBox.icons.left && !newBox.icons.left) {
|
|
26547
|
+
animatedBox.icons.left = { ...oldBox.icons.left, opacity: iconOpacity };
|
|
26548
|
+
}
|
|
26549
|
+
if (oldBox.icons.right && !newBox.icons.right) {
|
|
26550
|
+
animatedBox.icons.right = { ...oldBox.icons.right, opacity: iconOpacity };
|
|
26551
|
+
}
|
|
26552
|
+
if (oldBox.icons.center && !newBox.icons.center) {
|
|
26553
|
+
animatedBox.icons.center = { ...oldBox.icons.center, opacity: iconOpacity };
|
|
26554
|
+
}
|
|
26555
|
+
},
|
|
26556
|
+
});
|
|
26512
26557
|
cellAnimationRegistry.add("textChange", {
|
|
26513
26558
|
id: "textChange",
|
|
26514
26559
|
easingFn: "easeOutCubic",
|
|
@@ -26517,7 +26562,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
26517
26562
|
const newText = newBox?.content?.textLines?.join("\n");
|
|
26518
26563
|
// Note: here, we also animate changes to icons layout (margins/size change, or icon appearing/disappearing)
|
|
26519
26564
|
// because a change to the icon layout will impact where the text is positioned.
|
|
26520
|
-
return
|
|
26565
|
+
return Boolean(oldText && newText && (oldText !== newText || hasIconLayoutChange(newBox, oldBox)));
|
|
26521
26566
|
},
|
|
26522
26567
|
updateAnimation: function (progress, animatedBox, oldBox, newBox) {
|
|
26523
26568
|
const value = EASING_FN[this.easingFn](progress);
|
|
@@ -26532,7 +26577,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
26532
26577
|
height: newBox.height,
|
|
26533
26578
|
style: { ...newBox.style },
|
|
26534
26579
|
skipCellGridLines: true,
|
|
26535
|
-
content: newBox.content,
|
|
26580
|
+
content: newBox.content ? { ...newBox.content } : undefined,
|
|
26536
26581
|
clipRect: newBox.clipRect || {
|
|
26537
26582
|
...newBox,
|
|
26538
26583
|
// large width to avoid clipping the text it it didn't have a clipRect before,
|
|
@@ -26552,7 +26597,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
26552
26597
|
height: newBox.height,
|
|
26553
26598
|
style: { ...oldBox.style },
|
|
26554
26599
|
skipCellGridLines: true,
|
|
26555
|
-
content: oldBox.content,
|
|
26600
|
+
content: oldBox.content ? { ...oldBox.content } : undefined,
|
|
26556
26601
|
clipRect: oldBox.clipRect || {
|
|
26557
26602
|
...newBox,
|
|
26558
26603
|
x: Math.max(0, newBox.x - (oldBox.content?.width || 0)),
|
|
@@ -32664,7 +32709,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
32664
32709
|
}
|
|
32665
32710
|
captureSelection(zone, col, row) {
|
|
32666
32711
|
this.model.selection.capture(this, {
|
|
32667
|
-
cell: { col: col
|
|
32712
|
+
cell: { col: col ?? zone.left, row: row ?? zone.right },
|
|
32668
32713
|
zone,
|
|
32669
32714
|
}, {
|
|
32670
32715
|
handleEvent: this.handleEvent.bind(this),
|
|
@@ -47944,6 +47989,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
47944
47989
|
continue;
|
|
47945
47990
|
}
|
|
47946
47991
|
ctx.save();
|
|
47992
|
+
ctx.globalAlpha = icon.opacity ?? 1;
|
|
47947
47993
|
ctx.beginPath();
|
|
47948
47994
|
const clipRect = icon.clipRect || box;
|
|
47949
47995
|
ctx.rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
|
|
@@ -52332,6 +52378,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52332
52378
|
this.switchToList();
|
|
52333
52379
|
}
|
|
52334
52380
|
}
|
|
52381
|
+
else if (!this.editedCF) {
|
|
52382
|
+
this.switchToList();
|
|
52383
|
+
}
|
|
52335
52384
|
});
|
|
52336
52385
|
}
|
|
52337
52386
|
get conditionalFormats() {
|
|
@@ -68431,9 +68480,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
68431
68480
|
.add("ALPHANUMERIC_INCREMENT_MODIFIER", {
|
|
68432
68481
|
apply: (rule, data) => {
|
|
68433
68482
|
rule.current += rule.increment;
|
|
68434
|
-
|
|
68435
|
-
|
|
68436
|
-
|
|
68483
|
+
let value = Math.abs(rule.current).toString();
|
|
68484
|
+
value = "0".repeat(Math.max(rule.numberPostfixLength - value.length, 0)) + value;
|
|
68485
|
+
const content = `${rule.prefix}${value}`;
|
|
68437
68486
|
return {
|
|
68438
68487
|
cellData: {
|
|
68439
68488
|
border: data.border,
|
|
@@ -68551,6 +68600,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
68551
68600
|
const numberPostfixRegExp = /(\d+)$/;
|
|
68552
68601
|
const stringPrefixRegExp = /^(.*\D+)/;
|
|
68553
68602
|
const alphaNumericValueRegExp = /^(.*\D+)(\d+)$/;
|
|
68603
|
+
const leadingZerosRegex = /^0*/;
|
|
68554
68604
|
/**
|
|
68555
68605
|
* Get the consecutive evaluated cells that can pass the filter function (e.g. certain type filter).
|
|
68556
68606
|
* Return the one which contains the given cell
|
|
@@ -68682,12 +68732,18 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
68682
68732
|
generateRule: (cell, cells, direction) => {
|
|
68683
68733
|
const numberPostfix = parseInt(cell.content.match(numberPostfixRegExp)[0]);
|
|
68684
68734
|
const prefix = cell.content.match(stringPrefixRegExp)[0];
|
|
68685
|
-
const numberPostfixLength = cell.content.length - prefix.length;
|
|
68686
68735
|
const group = getGroup(cell, cells, (evaluatedCell) => evaluatedCell.type === CellValueType.text &&
|
|
68687
|
-
alphaNumericValueRegExp.test(evaluatedCell.value))
|
|
68736
|
+
alphaNumericValueRegExp.test(evaluatedCell.value))
|
|
68737
|
+
// get consecutive alphanumeric cells, no matter what the prefix is
|
|
68688
68738
|
.filter((cell) => prefix === (cell.value ?? "").toString().match(stringPrefixRegExp)[0])
|
|
68689
|
-
.map((cell) =>
|
|
68690
|
-
|
|
68739
|
+
.map((cell) => (cell.value ?? "").toString().match(numberPostfixRegExp)[0]);
|
|
68740
|
+
// find the length of number with the most leading zeros
|
|
68741
|
+
const mostLeadingZeros = group.reduce((candidate, current) => {
|
|
68742
|
+
const currentLength = current.match(leadingZerosRegex)[0].length;
|
|
68743
|
+
return currentLength > candidate[1] ? [current, currentLength] : candidate;
|
|
68744
|
+
}, [group[0], 0]);
|
|
68745
|
+
const numberPostfixLength = mostLeadingZeros[1] ? mostLeadingZeros[0].length : 0;
|
|
68746
|
+
let increment = calculateIncrementBasedOnGroup(group.map((x) => parseInt(x)));
|
|
68691
68747
|
if (["up", "left"].includes(direction) && group.length === 1) {
|
|
68692
68748
|
increment = -increment;
|
|
68693
68749
|
}
|
|
@@ -80982,26 +81038,28 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
80982
81038
|
bottom: Math.min(this.getters.getNumberRows(sheetId) - 1, bottom),
|
|
80983
81039
|
};
|
|
80984
81040
|
};
|
|
80985
|
-
const {
|
|
81041
|
+
const { cell: refCell, zone: refZone } = this.getReferenceAnchor();
|
|
81042
|
+
const { col: refCol, row: refRow } = refCell;
|
|
80986
81043
|
// check if we can shrink selection
|
|
80987
81044
|
let n = 0;
|
|
80988
81045
|
while (result !== null) {
|
|
80989
81046
|
n++;
|
|
80990
81047
|
if (deltaCol < 0) {
|
|
80991
81048
|
const newRight = this.getNextAvailableCol(deltaCol, right - (n - 1), refRow);
|
|
80992
|
-
result =
|
|
81049
|
+
result = refZone.right <= right - n ? expand({ top, left, bottom, right: newRight }) : null;
|
|
80993
81050
|
}
|
|
80994
81051
|
if (deltaCol > 0) {
|
|
80995
81052
|
const newLeft = this.getNextAvailableCol(deltaCol, left + (n - 1), refRow);
|
|
80996
|
-
result = left + n <=
|
|
81053
|
+
result = left + n <= refZone.left ? expand({ top, left: newLeft, bottom, right }) : null;
|
|
80997
81054
|
}
|
|
80998
81055
|
if (deltaRow < 0) {
|
|
80999
81056
|
const newBottom = this.getNextAvailableRow(deltaRow, refCol, bottom - (n - 1));
|
|
81000
|
-
result =
|
|
81057
|
+
result =
|
|
81058
|
+
refZone.bottom <= bottom - n ? expand({ top, left, bottom: newBottom, right }) : null;
|
|
81001
81059
|
}
|
|
81002
81060
|
if (deltaRow > 0) {
|
|
81003
81061
|
const newTop = this.getNextAvailableRow(deltaRow, refCol, top + (n - 1));
|
|
81004
|
-
result = top + n <=
|
|
81062
|
+
result = top + n <= refZone.top ? expand({ top: newTop, left, bottom, right }) : null;
|
|
81005
81063
|
}
|
|
81006
81064
|
result = result ? reorderZone(result) : result;
|
|
81007
81065
|
if (result && !isEqual(result, anchor.zone)) {
|
|
@@ -81231,18 +81289,26 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
81231
81289
|
* If the anchor is hidden, browses from left to right and top to bottom to
|
|
81232
81290
|
* find a visible cell.
|
|
81233
81291
|
*/
|
|
81234
|
-
|
|
81292
|
+
getReferenceAnchor() {
|
|
81235
81293
|
const sheetId = this.getters.getActiveSheetId();
|
|
81236
81294
|
const anchor = this.anchor;
|
|
81237
81295
|
const { left, right, top, bottom } = anchor.zone;
|
|
81238
81296
|
const { col: anchorCol, row: anchorRow } = anchor.cell;
|
|
81297
|
+
const col = this.getters.isColHidden(sheetId, anchorCol)
|
|
81298
|
+
? this.getters.findVisibleHeader(sheetId, "COL", left, right) || anchorCol
|
|
81299
|
+
: anchorCol;
|
|
81300
|
+
const row = this.getters.isRowHidden(sheetId, anchorRow)
|
|
81301
|
+
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
81302
|
+
: anchorRow;
|
|
81303
|
+
const zone = this.getters.expandZone(sheetId, {
|
|
81304
|
+
left: col,
|
|
81305
|
+
right: col,
|
|
81306
|
+
top: row,
|
|
81307
|
+
bottom: row,
|
|
81308
|
+
});
|
|
81239
81309
|
return {
|
|
81240
|
-
|
|
81241
|
-
|
|
81242
|
-
: anchorCol,
|
|
81243
|
-
row: this.getters.isRowHidden(sheetId, anchorRow)
|
|
81244
|
-
? this.getters.findVisibleHeader(sheetId, "ROW", top, bottom) || anchorRow
|
|
81245
|
-
: anchorRow,
|
|
81310
|
+
cell: { col, row },
|
|
81311
|
+
zone,
|
|
81246
81312
|
};
|
|
81247
81313
|
}
|
|
81248
81314
|
deltaToTarget(position, direction, step) {
|
|
@@ -84464,9 +84530,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
84464
84530
|
exports.tokenize = tokenize;
|
|
84465
84531
|
|
|
84466
84532
|
|
|
84467
|
-
__info__.version = "18.5.0-alpha.
|
|
84468
|
-
__info__.date = "2025-06-
|
|
84469
|
-
__info__.hash = "
|
|
84533
|
+
__info__.version = "18.5.0-alpha.1";
|
|
84534
|
+
__info__.date = "2025-06-27T09:12:49.245Z";
|
|
84535
|
+
__info__.hash = "756e75b";
|
|
84470
84536
|
|
|
84471
84537
|
|
|
84472
84538
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|