@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
|
@@ -5048,6 +5048,7 @@ const FilterMenuPopoverBuilder = {
|
|
|
5048
5048
|
},
|
|
5049
5049
|
};
|
|
5050
5050
|
|
|
5051
|
+
const macRegex = /Mac/i;
|
|
5051
5052
|
/**
|
|
5052
5053
|
* Return true if the event was triggered from
|
|
5053
5054
|
* a child element.
|
|
@@ -5095,7 +5096,15 @@ function getOpenedMenus() {
|
|
|
5095
5096
|
return Array.from(document.querySelectorAll(".o-spreadsheet .o-menu"));
|
|
5096
5097
|
}
|
|
5097
5098
|
function isMacOS() {
|
|
5098
|
-
return navigator.userAgent
|
|
5099
|
+
return Boolean(macRegex.test(navigator.userAgent));
|
|
5100
|
+
}
|
|
5101
|
+
/**
|
|
5102
|
+
* @param {KeyboardEvent | MouseEvent} ev
|
|
5103
|
+
* @returns Returns true if the event was triggered with the "ctrl" modifier pressed.
|
|
5104
|
+
* On Mac, this is the "meta" or "command" key.
|
|
5105
|
+
*/
|
|
5106
|
+
function isCtrlKey(ev) {
|
|
5107
|
+
return isMacOS() ? ev.metaKey : ev.ctrlKey;
|
|
5099
5108
|
}
|
|
5100
5109
|
|
|
5101
5110
|
/**
|
|
@@ -16713,10 +16722,10 @@ const arrowMap = {
|
|
|
16713
16722
|
function updateSelectionWithArrowKeys(ev, selection) {
|
|
16714
16723
|
const direction = arrowMap[ev.key];
|
|
16715
16724
|
if (ev.shiftKey) {
|
|
16716
|
-
selection.resizeAnchorZone(direction, ev
|
|
16725
|
+
selection.resizeAnchorZone(direction, isCtrlKey(ev) ? "end" : 1);
|
|
16717
16726
|
}
|
|
16718
16727
|
else {
|
|
16719
|
-
selection.moveAnchorCell(direction, ev
|
|
16728
|
+
selection.moveAnchorCell(direction, isCtrlKey(ev) ? "end" : 1);
|
|
16720
16729
|
}
|
|
16721
16730
|
}
|
|
16722
16731
|
|
|
@@ -21051,7 +21060,10 @@ class GridOverlay extends owl.Component {
|
|
|
21051
21060
|
return;
|
|
21052
21061
|
}
|
|
21053
21062
|
const [col, row] = this.getCartesianCoordinates(ev);
|
|
21054
|
-
this.props.onCellClicked(col, row, {
|
|
21063
|
+
this.props.onCellClicked(col, row, {
|
|
21064
|
+
expandZone: ev.shiftKey,
|
|
21065
|
+
addZone: isCtrlKey(ev),
|
|
21066
|
+
});
|
|
21055
21067
|
}
|
|
21056
21068
|
onDoubleClick(ev) {
|
|
21057
21069
|
const [col, row] = this.getCartesianCoordinates(ev);
|
|
@@ -21295,7 +21307,7 @@ class AbstractResizer extends owl.Component {
|
|
|
21295
21307
|
this._increaseSelection(index);
|
|
21296
21308
|
}
|
|
21297
21309
|
else {
|
|
21298
|
-
this._selectElement(index, ev
|
|
21310
|
+
this._selectElement(index, isCtrlKey(ev));
|
|
21299
21311
|
}
|
|
21300
21312
|
this.lastSelectedElementIndex = index;
|
|
21301
21313
|
const mouseMoveSelect = (col, row) => {
|
|
@@ -21308,7 +21320,7 @@ class AbstractResizer extends owl.Component {
|
|
|
21308
21320
|
const mouseUpSelect = () => {
|
|
21309
21321
|
this.state.isSelecting = false;
|
|
21310
21322
|
this.lastSelectedElementIndex = null;
|
|
21311
|
-
this.env.model.dispatch(ev
|
|
21323
|
+
this.env.model.dispatch(isCtrlKey(ev) ? "PREPARE_SELECTION_INPUT_EXPANSION" : "STOP_SELECTION_INPUT");
|
|
21312
21324
|
this._computeGrabDisplay(ev);
|
|
21313
21325
|
};
|
|
21314
21326
|
dragAndDropBeyondTheViewport(this.env, mouseMoveSelect, mouseUpSelect);
|
|
@@ -21458,8 +21470,8 @@ class ColResizer extends AbstractResizer {
|
|
|
21458
21470
|
this.env.raiseError(MergeErrorMessage);
|
|
21459
21471
|
}
|
|
21460
21472
|
}
|
|
21461
|
-
_selectElement(index,
|
|
21462
|
-
this.env.model.selection.selectColumn(index,
|
|
21473
|
+
_selectElement(index, addDistinctHeader) {
|
|
21474
|
+
this.env.model.selection.selectColumn(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
21463
21475
|
}
|
|
21464
21476
|
_increaseSelection(index) {
|
|
21465
21477
|
this.env.model.selection.selectColumn(index, "updateAnchor");
|
|
@@ -21631,8 +21643,8 @@ class RowResizer extends AbstractResizer {
|
|
|
21631
21643
|
this.env.raiseError(MergeErrorMessage);
|
|
21632
21644
|
}
|
|
21633
21645
|
}
|
|
21634
|
-
_selectElement(index,
|
|
21635
|
-
this.env.model.selection.selectRow(index,
|
|
21646
|
+
_selectElement(index, addDistinctHeader) {
|
|
21647
|
+
this.env.model.selection.selectRow(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
21636
21648
|
}
|
|
21637
21649
|
_increaseSelection(index) {
|
|
21638
21650
|
this.env.model.selection.selectRow(index, "updateAnchor");
|
|
@@ -22379,8 +22391,8 @@ class Grid extends owl.Component {
|
|
|
22379
22391
|
// ---------------------------------------------------------------------------
|
|
22380
22392
|
// Zone selection with mouse
|
|
22381
22393
|
// ---------------------------------------------------------------------------
|
|
22382
|
-
onCellClicked(col, row, {
|
|
22383
|
-
if (
|
|
22394
|
+
onCellClicked(col, row, { addZone, expandZone }) {
|
|
22395
|
+
if (addZone) {
|
|
22384
22396
|
this.env.model.dispatch("PREPARE_SELECTION_INPUT_EXPANSION");
|
|
22385
22397
|
}
|
|
22386
22398
|
if (this.env.model.getters.hasOpenedPopover()) {
|
|
@@ -22389,10 +22401,10 @@ class Grid extends owl.Component {
|
|
|
22389
22401
|
if (this.env.model.getters.getEditionMode() === "editing") {
|
|
22390
22402
|
this.env.model.dispatch("STOP_EDITION");
|
|
22391
22403
|
}
|
|
22392
|
-
if (
|
|
22404
|
+
if (expandZone) {
|
|
22393
22405
|
this.env.model.selection.setAnchorCorner(col, row);
|
|
22394
22406
|
}
|
|
22395
|
-
else if (
|
|
22407
|
+
else if (addZone) {
|
|
22396
22408
|
this.env.model.selection.addCellToSelection(col, row);
|
|
22397
22409
|
}
|
|
22398
22410
|
else {
|
|
@@ -22454,9 +22466,7 @@ class Grid extends owl.Component {
|
|
|
22454
22466
|
return;
|
|
22455
22467
|
}
|
|
22456
22468
|
let keyDownString = "";
|
|
22457
|
-
if (ev
|
|
22458
|
-
keyDownString += "CTRL+";
|
|
22459
|
-
if (ev.metaKey)
|
|
22469
|
+
if (isCtrlKey(ev))
|
|
22460
22470
|
keyDownString += "CTRL+";
|
|
22461
22471
|
if (ev.altKey)
|
|
22462
22472
|
keyDownString += "ALT+";
|
|
@@ -31974,13 +31984,18 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
31974
31984
|
// Getters
|
|
31975
31985
|
// ---------------------------------------------------------------------------
|
|
31976
31986
|
evaluateFormula(formulaString, sheetId = this.getters.getActiveSheetId()) {
|
|
31977
|
-
|
|
31978
|
-
|
|
31979
|
-
|
|
31980
|
-
|
|
31981
|
-
|
|
31987
|
+
try {
|
|
31988
|
+
const compiledFormula = compile(formulaString);
|
|
31989
|
+
const params = this.getCompilationParameters((cell) => this.getEvaluatedCell(this.getters.getCellPosition(cell.id)));
|
|
31990
|
+
const ranges = [];
|
|
31991
|
+
for (let xc of compiledFormula.dependencies) {
|
|
31992
|
+
ranges.push(this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
31993
|
+
}
|
|
31994
|
+
return compiledFormula.execute(ranges, ...params).value;
|
|
31995
|
+
}
|
|
31996
|
+
catch (error) {
|
|
31997
|
+
return error instanceof EvaluationError ? error.errorType : CellErrorType.GenericError;
|
|
31982
31998
|
}
|
|
31983
|
-
return compiledFormula.execute(ranges, ...params).value;
|
|
31984
31999
|
}
|
|
31985
32000
|
/**
|
|
31986
32001
|
* Return the value of each cell in the range as they are displayed in the grid.
|
|
@@ -32482,39 +32497,34 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
32482
32497
|
this.computedIcons[sheetId] = {};
|
|
32483
32498
|
const computedStyle = this.computedStyles[sheetId];
|
|
32484
32499
|
for (let cf of this.getters.getConditionalFormats(sheetId).reverse()) {
|
|
32485
|
-
|
|
32486
|
-
|
|
32487
|
-
|
|
32488
|
-
|
|
32489
|
-
|
|
32490
|
-
|
|
32491
|
-
|
|
32492
|
-
|
|
32493
|
-
|
|
32494
|
-
|
|
32495
|
-
|
|
32496
|
-
|
|
32497
|
-
|
|
32498
|
-
|
|
32499
|
-
|
|
32500
|
-
for (let
|
|
32501
|
-
|
|
32502
|
-
|
|
32503
|
-
|
|
32504
|
-
if (
|
|
32505
|
-
|
|
32506
|
-
|
|
32507
|
-
|
|
32508
|
-
computedStyle[col][row] = Object.assign(((_a = computedStyle[col]) === null || _a === void 0 ? void 0 : _a[row]) || {}, cf.rule.style);
|
|
32509
|
-
}
|
|
32500
|
+
switch (cf.rule.type) {
|
|
32501
|
+
case "ColorScaleRule":
|
|
32502
|
+
for (let range of cf.ranges) {
|
|
32503
|
+
this.applyColorScale(range, cf.rule);
|
|
32504
|
+
}
|
|
32505
|
+
break;
|
|
32506
|
+
case "IconSetRule":
|
|
32507
|
+
for (let range of cf.ranges) {
|
|
32508
|
+
this.applyIcon(range, cf.rule);
|
|
32509
|
+
}
|
|
32510
|
+
break;
|
|
32511
|
+
default:
|
|
32512
|
+
for (let ref of cf.ranges) {
|
|
32513
|
+
const zone = this.getters.getRangeFromSheetXC(sheetId, ref).zone;
|
|
32514
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
32515
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
32516
|
+
const pr = this.rulePredicate[cf.rule.type];
|
|
32517
|
+
let cell = this.getters.getEvaluatedCell({ sheetId, col, row });
|
|
32518
|
+
if (pr && pr(cell, cf.rule)) {
|
|
32519
|
+
if (!computedStyle[col])
|
|
32520
|
+
computedStyle[col] = [];
|
|
32521
|
+
// we must combine all the properties of all the CF rules applied to the given cell
|
|
32522
|
+
computedStyle[col][row] = Object.assign(((_a = computedStyle[col]) === null || _a === void 0 ? void 0 : _a[row]) || {}, cf.rule.style);
|
|
32510
32523
|
}
|
|
32511
32524
|
}
|
|
32512
32525
|
}
|
|
32513
|
-
|
|
32514
|
-
|
|
32515
|
-
}
|
|
32516
|
-
catch (_) {
|
|
32517
|
-
// we don't care about the errors within the evaluation of a rule
|
|
32526
|
+
}
|
|
32527
|
+
break;
|
|
32518
32528
|
}
|
|
32519
32529
|
}
|
|
32520
32530
|
}
|
|
@@ -32539,7 +32549,7 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
32539
32549
|
return percentile(rangeValues, Number(threshold.value) / 100, true);
|
|
32540
32550
|
case "formula":
|
|
32541
32551
|
const value = threshold.value && this.getters.evaluateFormula(threshold.value);
|
|
32542
|
-
return
|
|
32552
|
+
return typeof value === "number" ? value : null;
|
|
32543
32553
|
default:
|
|
32544
32554
|
return null;
|
|
32545
32555
|
}
|
|
@@ -41887,7 +41897,7 @@ class Spreadsheet extends owl.Component {
|
|
|
41887
41897
|
}
|
|
41888
41898
|
onKeydown(ev) {
|
|
41889
41899
|
let keyDownString = "";
|
|
41890
|
-
if (ev
|
|
41900
|
+
if (isCtrlKey(ev)) {
|
|
41891
41901
|
keyDownString += "CTRL+";
|
|
41892
41902
|
}
|
|
41893
41903
|
keyDownString += ev.key.toUpperCase();
|
|
@@ -45591,6 +45601,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
45591
45601
|
exports.tokenize = tokenize;
|
|
45592
45602
|
|
|
45593
45603
|
|
|
45594
|
-
__info__.version = '16.2.
|
|
45595
|
-
__info__.date = '
|
|
45596
|
-
__info__.hash = '
|
|
45604
|
+
__info__.version = '16.2.26';
|
|
45605
|
+
__info__.date = '2024-01-04T16:19:52.806Z';
|
|
45606
|
+
__info__.hash = 'ef51232';
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -3687,7 +3687,7 @@ declare class EvaluationPlugin extends UIPlugin {
|
|
|
3687
3687
|
constructor(config: UIPluginConfig);
|
|
3688
3688
|
handle(cmd: Command): void;
|
|
3689
3689
|
finalize(): void;
|
|
3690
|
-
evaluateFormula(formulaString: string, sheetId?: UID):
|
|
3690
|
+
evaluateFormula(formulaString: string, sheetId?: UID): FunctionReturnValue | null;
|
|
3691
3691
|
/**
|
|
3692
3692
|
* Return the value of each cell in the range as they are displayed in the grid.
|
|
3693
3693
|
*/
|
|
@@ -5782,8 +5782,8 @@ interface Props$h {
|
|
|
5782
5782
|
onCellHovered: (position: Partial<Position$1>) => void;
|
|
5783
5783
|
onCellDoubleClicked: (col: HeaderIndex, row: HeaderIndex) => void;
|
|
5784
5784
|
onCellClicked: (col: HeaderIndex, row: HeaderIndex, modifiers: {
|
|
5785
|
-
|
|
5786
|
-
|
|
5785
|
+
addZone: boolean;
|
|
5786
|
+
expandZone: boolean;
|
|
5787
5787
|
}) => void;
|
|
5788
5788
|
onCellRightClicked: (col: HeaderIndex, row: HeaderIndex, coordinates: DOMCoordinates) => void;
|
|
5789
5789
|
onGridResized: (dimension: DOMDimension) => void;
|
|
@@ -6369,7 +6369,7 @@ declare abstract class AbstractResizer extends Component<ResizerProps, Spreadshe
|
|
|
6369
6369
|
abstract _getMaxSize(): Pixel;
|
|
6370
6370
|
abstract _updateSize(): void;
|
|
6371
6371
|
abstract _moveElements(): void;
|
|
6372
|
-
abstract _selectElement(index: HeaderIndex,
|
|
6372
|
+
abstract _selectElement(index: HeaderIndex, addDistinctHeader: boolean): void;
|
|
6373
6373
|
abstract _increaseSelection(index: HeaderIndex): void;
|
|
6374
6374
|
abstract _fitElementSize(index: HeaderIndex): void;
|
|
6375
6375
|
abstract _getType(): ContextMenuType;
|
|
@@ -6403,7 +6403,7 @@ declare class ColResizer extends AbstractResizer {
|
|
|
6403
6403
|
_getMaxSize(): Pixel;
|
|
6404
6404
|
_updateSize(): void;
|
|
6405
6405
|
_moveElements(): void;
|
|
6406
|
-
_selectElement(index: HeaderIndex,
|
|
6406
|
+
_selectElement(index: HeaderIndex, addDistinctHeader: boolean): void;
|
|
6407
6407
|
_increaseSelection(index: HeaderIndex): void;
|
|
6408
6408
|
_fitElementSize(index: HeaderIndex): void;
|
|
6409
6409
|
_getType(): ContextMenuType;
|
|
@@ -6428,7 +6428,7 @@ declare class RowResizer extends AbstractResizer {
|
|
|
6428
6428
|
_getMaxSize(): Pixel;
|
|
6429
6429
|
_updateSize(): void;
|
|
6430
6430
|
_moveElements(): void;
|
|
6431
|
-
_selectElement(index: HeaderIndex,
|
|
6431
|
+
_selectElement(index: HeaderIndex, addDistinctHeader: boolean): void;
|
|
6432
6432
|
_increaseSelection(index: HeaderIndex): void;
|
|
6433
6433
|
_fitElementSize(index: HeaderIndex): void;
|
|
6434
6434
|
_getType(): ContextMenuType;
|
|
@@ -6555,9 +6555,9 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
|
|
|
6555
6555
|
getClientPositionKey(client: Client): string;
|
|
6556
6556
|
isCellHovered(col: HeaderIndex, row: HeaderIndex): boolean;
|
|
6557
6557
|
private getGridRect;
|
|
6558
|
-
onCellClicked(col: HeaderIndex, row: HeaderIndex, {
|
|
6559
|
-
|
|
6560
|
-
|
|
6558
|
+
onCellClicked(col: HeaderIndex, row: HeaderIndex, { addZone, expandZone }: {
|
|
6559
|
+
addZone: boolean;
|
|
6560
|
+
expandZone: boolean;
|
|
6561
6561
|
}): void;
|
|
6562
6562
|
onCellDoubleClicked(col: HeaderIndex, row: HeaderIndex): void;
|
|
6563
6563
|
closeOpenedPopover(): void;
|
|
@@ -5044,6 +5044,7 @@ const FilterMenuPopoverBuilder = {
|
|
|
5044
5044
|
},
|
|
5045
5045
|
};
|
|
5046
5046
|
|
|
5047
|
+
const macRegex = /Mac/i;
|
|
5047
5048
|
/**
|
|
5048
5049
|
* Return true if the event was triggered from
|
|
5049
5050
|
* a child element.
|
|
@@ -5091,7 +5092,15 @@ function getOpenedMenus() {
|
|
|
5091
5092
|
return Array.from(document.querySelectorAll(".o-spreadsheet .o-menu"));
|
|
5092
5093
|
}
|
|
5093
5094
|
function isMacOS() {
|
|
5094
|
-
return navigator.userAgent
|
|
5095
|
+
return Boolean(macRegex.test(navigator.userAgent));
|
|
5096
|
+
}
|
|
5097
|
+
/**
|
|
5098
|
+
* @param {KeyboardEvent | MouseEvent} ev
|
|
5099
|
+
* @returns Returns true if the event was triggered with the "ctrl" modifier pressed.
|
|
5100
|
+
* On Mac, this is the "meta" or "command" key.
|
|
5101
|
+
*/
|
|
5102
|
+
function isCtrlKey(ev) {
|
|
5103
|
+
return isMacOS() ? ev.metaKey : ev.ctrlKey;
|
|
5095
5104
|
}
|
|
5096
5105
|
|
|
5097
5106
|
/**
|
|
@@ -16709,10 +16718,10 @@ const arrowMap = {
|
|
|
16709
16718
|
function updateSelectionWithArrowKeys(ev, selection) {
|
|
16710
16719
|
const direction = arrowMap[ev.key];
|
|
16711
16720
|
if (ev.shiftKey) {
|
|
16712
|
-
selection.resizeAnchorZone(direction, ev
|
|
16721
|
+
selection.resizeAnchorZone(direction, isCtrlKey(ev) ? "end" : 1);
|
|
16713
16722
|
}
|
|
16714
16723
|
else {
|
|
16715
|
-
selection.moveAnchorCell(direction, ev
|
|
16724
|
+
selection.moveAnchorCell(direction, isCtrlKey(ev) ? "end" : 1);
|
|
16716
16725
|
}
|
|
16717
16726
|
}
|
|
16718
16727
|
|
|
@@ -21047,7 +21056,10 @@ class GridOverlay extends Component {
|
|
|
21047
21056
|
return;
|
|
21048
21057
|
}
|
|
21049
21058
|
const [col, row] = this.getCartesianCoordinates(ev);
|
|
21050
|
-
this.props.onCellClicked(col, row, {
|
|
21059
|
+
this.props.onCellClicked(col, row, {
|
|
21060
|
+
expandZone: ev.shiftKey,
|
|
21061
|
+
addZone: isCtrlKey(ev),
|
|
21062
|
+
});
|
|
21051
21063
|
}
|
|
21052
21064
|
onDoubleClick(ev) {
|
|
21053
21065
|
const [col, row] = this.getCartesianCoordinates(ev);
|
|
@@ -21291,7 +21303,7 @@ class AbstractResizer extends Component {
|
|
|
21291
21303
|
this._increaseSelection(index);
|
|
21292
21304
|
}
|
|
21293
21305
|
else {
|
|
21294
|
-
this._selectElement(index, ev
|
|
21306
|
+
this._selectElement(index, isCtrlKey(ev));
|
|
21295
21307
|
}
|
|
21296
21308
|
this.lastSelectedElementIndex = index;
|
|
21297
21309
|
const mouseMoveSelect = (col, row) => {
|
|
@@ -21304,7 +21316,7 @@ class AbstractResizer extends Component {
|
|
|
21304
21316
|
const mouseUpSelect = () => {
|
|
21305
21317
|
this.state.isSelecting = false;
|
|
21306
21318
|
this.lastSelectedElementIndex = null;
|
|
21307
|
-
this.env.model.dispatch(ev
|
|
21319
|
+
this.env.model.dispatch(isCtrlKey(ev) ? "PREPARE_SELECTION_INPUT_EXPANSION" : "STOP_SELECTION_INPUT");
|
|
21308
21320
|
this._computeGrabDisplay(ev);
|
|
21309
21321
|
};
|
|
21310
21322
|
dragAndDropBeyondTheViewport(this.env, mouseMoveSelect, mouseUpSelect);
|
|
@@ -21454,8 +21466,8 @@ class ColResizer extends AbstractResizer {
|
|
|
21454
21466
|
this.env.raiseError(MergeErrorMessage);
|
|
21455
21467
|
}
|
|
21456
21468
|
}
|
|
21457
|
-
_selectElement(index,
|
|
21458
|
-
this.env.model.selection.selectColumn(index,
|
|
21469
|
+
_selectElement(index, addDistinctHeader) {
|
|
21470
|
+
this.env.model.selection.selectColumn(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
21459
21471
|
}
|
|
21460
21472
|
_increaseSelection(index) {
|
|
21461
21473
|
this.env.model.selection.selectColumn(index, "updateAnchor");
|
|
@@ -21627,8 +21639,8 @@ class RowResizer extends AbstractResizer {
|
|
|
21627
21639
|
this.env.raiseError(MergeErrorMessage);
|
|
21628
21640
|
}
|
|
21629
21641
|
}
|
|
21630
|
-
_selectElement(index,
|
|
21631
|
-
this.env.model.selection.selectRow(index,
|
|
21642
|
+
_selectElement(index, addDistinctHeader) {
|
|
21643
|
+
this.env.model.selection.selectRow(index, addDistinctHeader ? "newAnchor" : "overrideSelection");
|
|
21632
21644
|
}
|
|
21633
21645
|
_increaseSelection(index) {
|
|
21634
21646
|
this.env.model.selection.selectRow(index, "updateAnchor");
|
|
@@ -22375,8 +22387,8 @@ class Grid extends Component {
|
|
|
22375
22387
|
// ---------------------------------------------------------------------------
|
|
22376
22388
|
// Zone selection with mouse
|
|
22377
22389
|
// ---------------------------------------------------------------------------
|
|
22378
|
-
onCellClicked(col, row, {
|
|
22379
|
-
if (
|
|
22390
|
+
onCellClicked(col, row, { addZone, expandZone }) {
|
|
22391
|
+
if (addZone) {
|
|
22380
22392
|
this.env.model.dispatch("PREPARE_SELECTION_INPUT_EXPANSION");
|
|
22381
22393
|
}
|
|
22382
22394
|
if (this.env.model.getters.hasOpenedPopover()) {
|
|
@@ -22385,10 +22397,10 @@ class Grid extends Component {
|
|
|
22385
22397
|
if (this.env.model.getters.getEditionMode() === "editing") {
|
|
22386
22398
|
this.env.model.dispatch("STOP_EDITION");
|
|
22387
22399
|
}
|
|
22388
|
-
if (
|
|
22400
|
+
if (expandZone) {
|
|
22389
22401
|
this.env.model.selection.setAnchorCorner(col, row);
|
|
22390
22402
|
}
|
|
22391
|
-
else if (
|
|
22403
|
+
else if (addZone) {
|
|
22392
22404
|
this.env.model.selection.addCellToSelection(col, row);
|
|
22393
22405
|
}
|
|
22394
22406
|
else {
|
|
@@ -22450,9 +22462,7 @@ class Grid extends Component {
|
|
|
22450
22462
|
return;
|
|
22451
22463
|
}
|
|
22452
22464
|
let keyDownString = "";
|
|
22453
|
-
if (ev
|
|
22454
|
-
keyDownString += "CTRL+";
|
|
22455
|
-
if (ev.metaKey)
|
|
22465
|
+
if (isCtrlKey(ev))
|
|
22456
22466
|
keyDownString += "CTRL+";
|
|
22457
22467
|
if (ev.altKey)
|
|
22458
22468
|
keyDownString += "ALT+";
|
|
@@ -31970,13 +31980,18 @@ class EvaluationPlugin extends UIPlugin {
|
|
|
31970
31980
|
// Getters
|
|
31971
31981
|
// ---------------------------------------------------------------------------
|
|
31972
31982
|
evaluateFormula(formulaString, sheetId = this.getters.getActiveSheetId()) {
|
|
31973
|
-
|
|
31974
|
-
|
|
31975
|
-
|
|
31976
|
-
|
|
31977
|
-
|
|
31983
|
+
try {
|
|
31984
|
+
const compiledFormula = compile(formulaString);
|
|
31985
|
+
const params = this.getCompilationParameters((cell) => this.getEvaluatedCell(this.getters.getCellPosition(cell.id)));
|
|
31986
|
+
const ranges = [];
|
|
31987
|
+
for (let xc of compiledFormula.dependencies) {
|
|
31988
|
+
ranges.push(this.getters.getRangeFromSheetXC(sheetId, xc));
|
|
31989
|
+
}
|
|
31990
|
+
return compiledFormula.execute(ranges, ...params).value;
|
|
31991
|
+
}
|
|
31992
|
+
catch (error) {
|
|
31993
|
+
return error instanceof EvaluationError ? error.errorType : CellErrorType.GenericError;
|
|
31978
31994
|
}
|
|
31979
|
-
return compiledFormula.execute(ranges, ...params).value;
|
|
31980
31995
|
}
|
|
31981
31996
|
/**
|
|
31982
31997
|
* Return the value of each cell in the range as they are displayed in the grid.
|
|
@@ -32478,39 +32493,34 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
32478
32493
|
this.computedIcons[sheetId] = {};
|
|
32479
32494
|
const computedStyle = this.computedStyles[sheetId];
|
|
32480
32495
|
for (let cf of this.getters.getConditionalFormats(sheetId).reverse()) {
|
|
32481
|
-
|
|
32482
|
-
|
|
32483
|
-
|
|
32484
|
-
|
|
32485
|
-
|
|
32486
|
-
|
|
32487
|
-
|
|
32488
|
-
|
|
32489
|
-
|
|
32490
|
-
|
|
32491
|
-
|
|
32492
|
-
|
|
32493
|
-
|
|
32494
|
-
|
|
32495
|
-
|
|
32496
|
-
for (let
|
|
32497
|
-
|
|
32498
|
-
|
|
32499
|
-
|
|
32500
|
-
if (
|
|
32501
|
-
|
|
32502
|
-
|
|
32503
|
-
|
|
32504
|
-
computedStyle[col][row] = Object.assign(((_a = computedStyle[col]) === null || _a === void 0 ? void 0 : _a[row]) || {}, cf.rule.style);
|
|
32505
|
-
}
|
|
32496
|
+
switch (cf.rule.type) {
|
|
32497
|
+
case "ColorScaleRule":
|
|
32498
|
+
for (let range of cf.ranges) {
|
|
32499
|
+
this.applyColorScale(range, cf.rule);
|
|
32500
|
+
}
|
|
32501
|
+
break;
|
|
32502
|
+
case "IconSetRule":
|
|
32503
|
+
for (let range of cf.ranges) {
|
|
32504
|
+
this.applyIcon(range, cf.rule);
|
|
32505
|
+
}
|
|
32506
|
+
break;
|
|
32507
|
+
default:
|
|
32508
|
+
for (let ref of cf.ranges) {
|
|
32509
|
+
const zone = this.getters.getRangeFromSheetXC(sheetId, ref).zone;
|
|
32510
|
+
for (let row = zone.top; row <= zone.bottom; row++) {
|
|
32511
|
+
for (let col = zone.left; col <= zone.right; col++) {
|
|
32512
|
+
const pr = this.rulePredicate[cf.rule.type];
|
|
32513
|
+
let cell = this.getters.getEvaluatedCell({ sheetId, col, row });
|
|
32514
|
+
if (pr && pr(cell, cf.rule)) {
|
|
32515
|
+
if (!computedStyle[col])
|
|
32516
|
+
computedStyle[col] = [];
|
|
32517
|
+
// we must combine all the properties of all the CF rules applied to the given cell
|
|
32518
|
+
computedStyle[col][row] = Object.assign(((_a = computedStyle[col]) === null || _a === void 0 ? void 0 : _a[row]) || {}, cf.rule.style);
|
|
32506
32519
|
}
|
|
32507
32520
|
}
|
|
32508
32521
|
}
|
|
32509
|
-
|
|
32510
|
-
|
|
32511
|
-
}
|
|
32512
|
-
catch (_) {
|
|
32513
|
-
// we don't care about the errors within the evaluation of a rule
|
|
32522
|
+
}
|
|
32523
|
+
break;
|
|
32514
32524
|
}
|
|
32515
32525
|
}
|
|
32516
32526
|
}
|
|
@@ -32535,7 +32545,7 @@ class EvaluationConditionalFormatPlugin extends UIPlugin {
|
|
|
32535
32545
|
return percentile(rangeValues, Number(threshold.value) / 100, true);
|
|
32536
32546
|
case "formula":
|
|
32537
32547
|
const value = threshold.value && this.getters.evaluateFormula(threshold.value);
|
|
32538
|
-
return
|
|
32548
|
+
return typeof value === "number" ? value : null;
|
|
32539
32549
|
default:
|
|
32540
32550
|
return null;
|
|
32541
32551
|
}
|
|
@@ -41883,7 +41893,7 @@ class Spreadsheet extends Component {
|
|
|
41883
41893
|
}
|
|
41884
41894
|
onKeydown(ev) {
|
|
41885
41895
|
let keyDownString = "";
|
|
41886
|
-
if (ev
|
|
41896
|
+
if (isCtrlKey(ev)) {
|
|
41887
41897
|
keyDownString += "CTRL+";
|
|
41888
41898
|
}
|
|
41889
41899
|
keyDownString += ev.key.toUpperCase();
|
|
@@ -45559,6 +45569,6 @@ function addFunction(functionName, functionDescription) {
|
|
|
45559
45569
|
export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, links, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
|
|
45560
45570
|
|
|
45561
45571
|
|
|
45562
|
-
__info__.version = '16.2.
|
|
45563
|
-
__info__.date = '
|
|
45564
|
-
__info__.hash = '
|
|
45572
|
+
__info__.version = '16.2.26';
|
|
45573
|
+
__info__.date = '2024-01-04T16:19:52.806Z';
|
|
45574
|
+
__info__.hash = 'ef51232';
|