@odoo/o-spreadsheet 16.2.24 → 16.2.26
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 +68 -58
- package/dist/o-spreadsheet.d.ts +9 -9
- package/dist/o-spreadsheet.esm.js +68 -58
- package/dist/o-spreadsheet.iife.js +68 -58
- package/dist/o-spreadsheet.iife.min.js +232 -232
- package/dist/o_spreadsheet.xml +3 -3
- package/package.json +1 -1
|
@@ -5045,6 +5045,7 @@
|
|
|
5045
5045
|
},
|
|
5046
5046
|
};
|
|
5047
5047
|
|
|
5048
|
+
const macRegex = /Mac/i;
|
|
5048
5049
|
/**
|
|
5049
5050
|
* Return true if the event was triggered from
|
|
5050
5051
|
* a child element.
|
|
@@ -5092,7 +5093,15 @@
|
|
|
5092
5093
|
return Array.from(document.querySelectorAll(".o-spreadsheet .o-menu"));
|
|
5093
5094
|
}
|
|
5094
5095
|
function isMacOS() {
|
|
5095
|
-
return navigator.userAgent
|
|
5096
|
+
return Boolean(macRegex.test(navigator.userAgent));
|
|
5097
|
+
}
|
|
5098
|
+
/**
|
|
5099
|
+
* @param {KeyboardEvent | MouseEvent} ev
|
|
5100
|
+
* @returns Returns true if the event was triggered with the "ctrl" modifier pressed.
|
|
5101
|
+
* On Mac, this is the "meta" or "command" key.
|
|
5102
|
+
*/
|
|
5103
|
+
function isCtrlKey(ev) {
|
|
5104
|
+
return isMacOS() ? ev.metaKey : ev.ctrlKey;
|
|
5096
5105
|
}
|
|
5097
5106
|
|
|
5098
5107
|
/**
|
|
@@ -16710,10 +16719,10 @@
|
|
|
16710
16719
|
function updateSelectionWithArrowKeys(ev, selection) {
|
|
16711
16720
|
const direction = arrowMap[ev.key];
|
|
16712
16721
|
if (ev.shiftKey) {
|
|
16713
|
-
selection.resizeAnchorZone(direction, ev
|
|
16722
|
+
selection.resizeAnchorZone(direction, isCtrlKey(ev) ? "end" : 1);
|
|
16714
16723
|
}
|
|
16715
16724
|
else {
|
|
16716
|
-
selection.moveAnchorCell(direction, ev
|
|
16725
|
+
selection.moveAnchorCell(direction, isCtrlKey(ev) ? "end" : 1);
|
|
16717
16726
|
}
|
|
16718
16727
|
}
|
|
16719
16728
|
|
|
@@ -21048,7 +21057,10 @@
|
|
|
21048
21057
|
return;
|
|
21049
21058
|
}
|
|
21050
21059
|
const [col, row] = this.getCartesianCoordinates(ev);
|
|
21051
|
-
this.props.onCellClicked(col, row, {
|
|
21060
|
+
this.props.onCellClicked(col, row, {
|
|
21061
|
+
expandZone: ev.shiftKey,
|
|
21062
|
+
addZone: isCtrlKey(ev),
|
|
21063
|
+
});
|
|
21052
21064
|
}
|
|
21053
21065
|
onDoubleClick(ev) {
|
|
21054
21066
|
const [col, row] = this.getCartesianCoordinates(ev);
|
|
@@ -21292,7 +21304,7 @@
|
|
|
21292
21304
|
this._increaseSelection(index);
|
|
21293
21305
|
}
|
|
21294
21306
|
else {
|
|
21295
|
-
this._selectElement(index, ev
|
|
21307
|
+
this._selectElement(index, isCtrlKey(ev));
|
|
21296
21308
|
}
|
|
21297
21309
|
this.lastSelectedElementIndex = index;
|
|
21298
21310
|
const mouseMoveSelect = (col, row) => {
|
|
@@ -21305,7 +21317,7 @@
|
|
|
21305
21317
|
const mouseUpSelect = () => {
|
|
21306
21318
|
this.state.isSelecting = false;
|
|
21307
21319
|
this.lastSelectedElementIndex = null;
|
|
21308
|
-
this.env.model.dispatch(ev
|
|
21320
|
+
this.env.model.dispatch(isCtrlKey(ev) ? "PREPARE_SELECTION_INPUT_EXPANSION" : "STOP_SELECTION_INPUT");
|
|
21309
21321
|
this._computeGrabDisplay(ev);
|
|
21310
21322
|
};
|
|
21311
21323
|
dragAndDropBeyondTheViewport(this.env, mouseMoveSelect, mouseUpSelect);
|
|
@@ -21455,8 +21467,8 @@
|
|
|
21455
21467
|
this.env.raiseError(MergeErrorMessage);
|
|
21456
21468
|
}
|
|
21457
21469
|
}
|
|
21458
|
-
_selectElement(index,
|
|
21459
|
-
this.env.model.selection.selectColumn(index,
|
|
21470
|
+
_selectElement(index, addDistinctHeader) {
|
|
21471
|
+
this.env.model.selection.selectColumn(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
21460
21472
|
}
|
|
21461
21473
|
_increaseSelection(index) {
|
|
21462
21474
|
this.env.model.selection.selectColumn(index, "updateAnchor");
|
|
@@ -21628,8 +21640,8 @@
|
|
|
21628
21640
|
this.env.raiseError(MergeErrorMessage);
|
|
21629
21641
|
}
|
|
21630
21642
|
}
|
|
21631
|
-
_selectElement(index,
|
|
21632
|
-
this.env.model.selection.selectRow(index,
|
|
21643
|
+
_selectElement(index, addDistinctHeader) {
|
|
21644
|
+
this.env.model.selection.selectRow(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
21633
21645
|
}
|
|
21634
21646
|
_increaseSelection(index) {
|
|
21635
21647
|
this.env.model.selection.selectRow(index, "updateAnchor");
|
|
@@ -22376,8 +22388,8 @@
|
|
|
22376
22388
|
// ---------------------------------------------------------------------------
|
|
22377
22389
|
// Zone selection with mouse
|
|
22378
22390
|
// ---------------------------------------------------------------------------
|
|
22379
|
-
onCellClicked(col, row, {
|
|
22380
|
-
if (
|
|
22391
|
+
onCellClicked(col, row, { addZone, expandZone }) {
|
|
22392
|
+
if (addZone) {
|
|
22381
22393
|
this.env.model.dispatch("PREPARE_SELECTION_INPUT_EXPANSION");
|
|
22382
22394
|
}
|
|
22383
22395
|
if (this.env.model.getters.hasOpenedPopover()) {
|
|
@@ -22386,10 +22398,10 @@
|
|
|
22386
22398
|
if (this.env.model.getters.getEditionMode() === "editing") {
|
|
22387
22399
|
this.env.model.dispatch("STOP_EDITION");
|
|
22388
22400
|
}
|
|
22389
|
-
if (
|
|
22401
|
+
if (expandZone) {
|
|
22390
22402
|
this.env.model.selection.setAnchorCorner(col, row);
|
|
22391
22403
|
}
|
|
22392
|
-
else if (
|
|
22404
|
+
else if (addZone) {
|
|
22393
22405
|
this.env.model.selection.addCellToSelection(col, row);
|
|
22394
22406
|
}
|
|
22395
22407
|
else {
|
|
@@ -22451,9 +22463,7 @@
|
|
|
22451
22463
|
return;
|
|
22452
22464
|
}
|
|
22453
22465
|
let keyDownString = "";
|
|
22454
|
-
if (ev
|
|
22455
|
-
keyDownString += "CTRL+";
|
|
22456
|
-
if (ev.metaKey)
|
|
22466
|
+
if (isCtrlKey(ev))
|
|
22457
22467
|
keyDownString += "CTRL+";
|
|
22458
22468
|
if (ev.altKey)
|
|
22459
22469
|
keyDownString += "ALT+";
|
|
@@ -31971,13 +31981,18 @@
|
|
|
31971
31981
|
// Getters
|
|
31972
31982
|
// ---------------------------------------------------------------------------
|
|
31973
31983
|
evaluateFormula(formulaString, sheetId = this.getters.getActiveSheetId()) {
|
|
31974
|
-
|
|
31975
|
-
|
|
31976
|
-
|
|
31977
|
-
|
|
31978
|
-
|
|
31984
|
+
try {
|
|
31985
|
+
const compiledFormula = compile(formulaString);
|
|
31986
|
+
const params = this.getCompilationParameters((cell) => this.getEvaluatedCell(this.getters.getCellPosition(cell.id)));
|
|
31987
|
+
const ranges = [];
|
|
31988
|
+
for (let xc of compiledFormula.dependencies) {
|
|
31989
|
+
ranges.push(this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
31990
|
+
}
|
|
31991
|
+
return compiledFormula.execute(ranges, ...params).value;
|
|
31992
|
+
}
|
|
31993
|
+
catch (error) {
|
|
31994
|
+
return error instanceof EvaluationError ? error.errorType : CellErrorType.GenericError;
|
|
31979
31995
|
}
|
|
31980
|
-
return compiledFormula.execute(ranges, ...params).value;
|
|
31981
31996
|
}
|
|
31982
31997
|
/**
|
|
31983
31998
|
* Return the value of each cell in the range as they are displayed in the grid.
|
|
@@ -32479,39 +32494,34 @@
|
|
|
32479
32494
|
this.computedIcons[sheetId] = {};
|
|
32480
32495
|
const computedStyle = this.computedStyles[sheetId];
|
|
32481
32496
|
for (let cf of this.getters.getConditionalFormats(sheetId).reverse()) {
|
|
32482
|
-
|
|
32483
|
-
|
|
32484
|
-
|
|
32485
|
-
|
|
32486
|
-
|
|
32487
|
-
|
|
32488
|
-
|
|
32489
|
-
|
|
32490
|
-
|
|
32491
|
-
|
|
32492
|
-
|
|
32493
|
-
|
|
32494
|
-
|
|
32495
|
-
|
|
32496
|
-
|
|
32497
|
-
for (let
|
|
32498
|
-
|
|
32499
|
-
|
|
32500
|
-
|
|
32501
|
-
if (
|
|
32502
|
-
|
|
32503
|
-
|
|
32504
|
-
|
|
32505
|
-
computedStyle[col][row] = Object.assign(((_a = computedStyle[col]) === null || _a === void 0 ? void 0 : _a[row]) || {}, cf.rule.style);
|
|
32506
|
-
}
|
|
32497
|
+
switch (cf.rule.type) {
|
|
32498
|
+
case "ColorScaleRule":
|
|
32499
|
+
for (let range of cf.ranges) {
|
|
32500
|
+
this.applyColorScale(range, cf.rule);
|
|
32501
|
+
}
|
|
32502
|
+
break;
|
|
32503
|
+
case "IconSetRule":
|
|
32504
|
+
for (let range of cf.ranges) {
|
|
32505
|
+
this.applyIcon(range, cf.rule);
|
|
32506
|
+
}
|
|
32507
|
+
break;
|
|
32508
|
+
default:
|
|
32509
|
+
for (let ref of cf.ranges) {
|
|
32510
|
+
const zone = this.getters.getRangeFromSheetXC(sheetId, ref).zone;
|
|
32511
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
32512
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
32513
|
+
const pr = this.rulePredicate[cf.rule.type];
|
|
32514
|
+
let cell = this.getters.getEvaluatedCell({ sheetId, col, row });
|
|
32515
|
+
if (pr && pr(cell, cf.rule)) {
|
|
32516
|
+
if (!computedStyle[col])
|
|
32517
|
+
computedStyle[col] = [];
|
|
32518
|
+
// we must combine all the properties of all the CF rules applied to the given cell
|
|
32519
|
+
computedStyle[col][row] = Object.assign(((_a = computedStyle[col]) === null || _a === void 0 ? void 0 : _a[row]) || {}, cf.rule.style);
|
|
32507
32520
|
}
|
|
32508
32521
|
}
|
|
32509
32522
|
}
|
|
32510
|
-
|
|
32511
|
-
|
|
32512
|
-
}
|
|
32513
|
-
catch (_) {
|
|
32514
|
-
// we don't care about the errors within the evaluation of a rule
|
|
32523
|
+
}
|
|
32524
|
+
break;
|
|
32515
32525
|
}
|
|
32516
32526
|
}
|
|
32517
32527
|
}
|
|
@@ -32536,7 +32546,7 @@
|
|
|
32536
32546
|
return percentile(rangeValues, Number(threshold.value) / 100, true);
|
|
32537
32547
|
case "formula":
|
|
32538
32548
|
const value = threshold.value && this.getters.evaluateFormula(threshold.value);
|
|
32539
|
-
return
|
|
32549
|
+
return typeof value === "number" ? value : null;
|
|
32540
32550
|
default:
|
|
32541
32551
|
return null;
|
|
32542
32552
|
}
|
|
@@ -41884,7 +41894,7 @@
|
|
|
41884
41894
|
}
|
|
41885
41895
|
onKeydown(ev) {
|
|
41886
41896
|
let keyDownString = "";
|
|
41887
|
-
if (ev
|
|
41897
|
+
if (isCtrlKey(ev)) {
|
|
41888
41898
|
keyDownString += "CTRL+";
|
|
41889
41899
|
}
|
|
41890
41900
|
keyDownString += ev.key.toUpperCase();
|
|
@@ -45590,9 +45600,9 @@
|
|
|
45590
45600
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
45591
45601
|
|
|
45592
45602
|
|
|
45593
|
-
__info__.version = '16.2.
|
|
45594
|
-
__info__.date = '
|
|
45595
|
-
__info__.hash = '
|
|
45603
|
+
__info__.version = '16.2.26';
|
|
45604
|
+
__info__.date = '2024-01-04T16:19:52.806Z';
|
|
45605
|
+
__info__.hash = 'ef51232';
|
|
45596
45606
|
|
|
45597
45607
|
|
|
45598
45608
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|