@odoo/o-spreadsheet 17.0.13 → 17.0.14

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.
@@ -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.13
6
- * @date 2024-02-28T12:28:44.914Z
7
- * @hash ed67be7
5
+ * @version 17.0.14
6
+ * @date 2024-03-12T07:56:15.364Z
7
+ * @hash 6f6e1b9
8
8
  */
9
9
 
10
10
  import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
@@ -6057,8 +6057,10 @@ function getGroup(cell, cells, filter) {
6057
6057
  if (x === cell) {
6058
6058
  found = true;
6059
6059
  }
6060
- const cellValue = evaluateLiteral(x?.content, { locale: DEFAULT_LOCALE });
6061
- if (filter(cellValue)) {
6060
+ const cellValue = x?.isFormula
6061
+ ? undefined
6062
+ : evaluateLiteral(x?.content, { locale: DEFAULT_LOCALE });
6063
+ if (cellValue && filter(cellValue)) {
6062
6064
  group.push(cellValue);
6063
6065
  }
6064
6066
  else {
@@ -19441,10 +19443,8 @@ function createComputeFunctionFromDescription(descr) {
19441
19443
  }
19442
19444
  function buildComputeFunctionFromDescription(descr) {
19443
19445
  return function (...args) {
19444
- const computeValue = descr.compute.bind(this);
19445
- const computeFormat = descr.computeFormat?.bind(this) || (() => undefined);
19446
- const value = computeValue(...extractArgValuesFromArgs(args));
19447
- const format = computeFormat(...args);
19446
+ const value = descr.compute.apply(this, extractArgValuesFromArgs(args));
19447
+ const format = descr.computeFormat?.apply(this, args);
19448
19448
  if (isMatrix(value)) {
19449
19449
  if (format === undefined || isMatrix(format)) {
19450
19450
  return value.map((col, i) => col.map((row, j) => ({ value: row, format: format?.[i]?.[j] })));
@@ -27269,7 +27269,11 @@ class GridComposer extends Component {
27269
27269
  }
27270
27270
  }
27271
27271
  updateCellReferenceVisibility() {
27272
- if (this.isCellReferenceVisible || this.env.model.getters.getEditionMode() === "inactive") {
27272
+ if (this.env.model.getters.getEditionMode() === "inactive") {
27273
+ this.isCellReferenceVisible = false;
27274
+ return;
27275
+ }
27276
+ if (this.isCellReferenceVisible) {
27273
27277
  return;
27274
27278
  }
27275
27279
  const sheetId = this.env.model.getters.getActiveSheetId();
@@ -27298,19 +27302,21 @@ class GridCellIcon extends Component {
27298
27302
  static style = CSS$1;
27299
27303
  static template = "o-spreadsheet-GridCellIcon";
27300
27304
  get iconStyle() {
27301
- const x = this.getIconHorizontalPosition();
27302
- const y = this.getIconVerticalPosition();
27305
+ const cellPosition = this.props.cellPosition;
27306
+ const merge = this.env.model.getters.getMerge(cellPosition);
27307
+ const zone = merge || positionToZone(cellPosition);
27308
+ const rect = this.env.model.getters.getVisibleRectWithoutHeaders(zone);
27309
+ const x = this.getIconHorizontalPosition(rect, cellPosition);
27310
+ const y = this.getIconVerticalPosition(rect, cellPosition);
27303
27311
  return cssPropertiesToCss({
27304
27312
  top: `${y + (this.props.offset?.y || 0)}px`,
27305
27313
  left: `${x + (this.props.offset?.x || 0)}px`,
27306
27314
  });
27307
27315
  }
27308
- getIconVerticalPosition() {
27309
- const { sheetId, row } = this.props.cellPosition;
27310
- const merge = this.env.model.getters.getMerge(this.props.cellPosition);
27311
- const start = this.env.model.getters.getRowDimensionsInViewport(sheetId, row).start;
27312
- const end = this.env.model.getters.getRowDimensionsInViewport(sheetId, merge ? merge.bottom : row).end;
27313
- const cell = this.env.model.getters.getCell(this.props.cellPosition);
27316
+ getIconVerticalPosition(rect, cellPosition) {
27317
+ const start = rect.y;
27318
+ const end = rect.y + rect.height;
27319
+ const cell = this.env.model.getters.getCell(cellPosition);
27314
27320
  const align = this.props.verticalAlign || cell?.style?.verticalAlign || DEFAULT_VERTICAL_ALIGN;
27315
27321
  switch (align) {
27316
27322
  case "bottom":
@@ -27322,13 +27328,11 @@ class GridCellIcon extends Component {
27322
27328
  return end - GRID_ICON_EDGE_LENGTH - centeringOffset;
27323
27329
  }
27324
27330
  }
27325
- getIconHorizontalPosition() {
27326
- const { sheetId, col } = this.props.cellPosition;
27327
- const merge = this.env.model.getters.getMerge(this.props.cellPosition);
27328
- const start = this.env.model.getters.getColDimensionsInViewport(sheetId, col).start;
27329
- const end = this.env.model.getters.getColDimensionsInViewport(sheetId, merge ? merge.right : col).end;
27330
- const cell = this.env.model.getters.getCell(this.props.cellPosition);
27331
- const evaluatedCell = this.env.model.getters.getEvaluatedCell(this.props.cellPosition);
27331
+ getIconHorizontalPosition(rect, cellPosition) {
27332
+ const start = rect.x;
27333
+ const end = rect.x + rect.width;
27334
+ const cell = this.env.model.getters.getCell(cellPosition);
27335
+ const evaluatedCell = this.env.model.getters.getEvaluatedCell(cellPosition);
27332
27336
  const align = this.props.horizontalAlign || cell?.style?.align || evaluatedCell.defaultAlign;
27333
27337
  switch (align) {
27334
27338
  case "right":
@@ -27420,6 +27424,8 @@ css /* scss */ `
27420
27424
  height: ${CHECKBOX_WIDTH}px;
27421
27425
  accent-color: #808080;
27422
27426
  margin: ${MARGIN}px;
27427
+ /** required to prevent the checkbox position to be sensible to the font-size (affects Firefox) */
27428
+ position: absolute;
27423
27429
  }
27424
27430
  `;
27425
27431
  class DataValidationCheckbox extends Component {
@@ -27435,7 +27441,7 @@ class DataValidationCheckbox extends Component {
27435
27441
  }
27436
27442
  get isDisabled() {
27437
27443
  const cell = this.env.model.getters.getCell(this.props.cellPosition);
27438
- return !!cell?.isFormula;
27444
+ return this.env.model.getters.isReadonly() || !!cell?.isFormula;
27439
27445
  }
27440
27446
  }
27441
27447
  DataValidationCheckbox.props = {
@@ -27477,12 +27483,17 @@ class DataValidationOverlay extends Component {
27477
27483
  static template = "o-spreadsheet-DataValidationOverlay";
27478
27484
  static components = { GridCellIcon, DataValidationCheckbox, DataValidationListIcon };
27479
27485
  get checkBoxCellPositions() {
27480
- return this.env.model.getters.getDataValidationCheckBoxCellPositions();
27486
+ return this.env.model.getters
27487
+ .getVisibleCellPositions()
27488
+ .filter(this.env.model.getters.isCellValidCheckbox);
27481
27489
  }
27482
27490
  get listIconsCellPositions() {
27483
- return this.env.model.getters.isReadonly()
27484
- ? []
27485
- : this.env.model.getters.getDataValidationListCellsPositions();
27491
+ if (this.env.model.getters.isReadonly()) {
27492
+ return [];
27493
+ }
27494
+ return this.env.model.getters
27495
+ .getVisibleCellPositions()
27496
+ .filter(this.env.model.getters.cellHasListDataValidationIcon);
27486
27497
  }
27487
27498
  }
27488
27499
  DataValidationOverlay.props = {};
@@ -38598,7 +38609,6 @@ class SheetPlugin extends CorePlugin {
38598
38609
  "getNumberHeaders",
38599
38610
  "getGridLinesVisibility",
38600
38611
  "getNextSheetName",
38601
- "isEmpty",
38602
38612
  "getSheetSize",
38603
38613
  "getSheetZone",
38604
38614
  "getPaneDivisions",
@@ -38973,14 +38983,6 @@ class SheetPlugin extends CorePlugin {
38973
38983
  // ---------------------------------------------------------------------------
38974
38984
  // Row/Col manipulation
38975
38985
  // ---------------------------------------------------------------------------
38976
- /**
38977
- * Check if a zone only contains empty cells
38978
- */
38979
- isEmpty(sheetId, zone) {
38980
- return positions(zone)
38981
- .map(({ col, row }) => this.getCell({ sheetId, col, row }))
38982
- .every((cell) => !cell || cell.content === "");
38983
- }
38984
38986
  getCommandZones(cmd) {
38985
38987
  const zones = [];
38986
38988
  if ("zone" in cmd) {
@@ -41434,6 +41436,7 @@ class EvaluationPlugin extends UIPlugin {
41434
41436
  "getEvaluatedCellsInZone",
41435
41437
  "getSpreadPositionsOf",
41436
41438
  "getArrayFormulaSpreadingOn",
41439
+ "isEmpty",
41437
41440
  ];
41438
41441
  shouldRebuildDependenciesGraph = true;
41439
41442
  evaluator;
@@ -41538,6 +41541,14 @@ class EvaluationPlugin extends UIPlugin {
41538
41541
  getArrayFormulaSpreadingOn(position) {
41539
41542
  return this.evaluator.getArrayFormulaSpreadingOn(position);
41540
41543
  }
41544
+ /**
41545
+ * Check if a zone only contains empty cells
41546
+ */
41547
+ isEmpty(sheetId, zone) {
41548
+ return positions(zone)
41549
+ .map(({ col, row }) => this.getEvaluatedCell({ sheetId, col, row }))
41550
+ .every((cell) => cell.type === CellValueType.empty);
41551
+ }
41541
41552
  // ---------------------------------------------------------------------------
41542
41553
  // Export
41543
41554
  // ---------------------------------------------------------------------------
@@ -42184,8 +42195,6 @@ const VALID_RESULT = { isValid: true };
42184
42195
  class EvaluationDataValidationPlugin extends UIPlugin {
42185
42196
  static getters = [
42186
42197
  "getDataValidationInvalidCriterionValueMessage",
42187
- "getDataValidationCheckBoxCellPositions",
42188
- "getDataValidationListCellsPositions",
42189
42198
  "getInvalidDataValidationMessage",
42190
42199
  "getValidationResultForCellValue",
42191
42200
  "isCellValidCheckbox",
@@ -42249,19 +42258,6 @@ class EvaluationDataValidationPlugin extends UIPlugin {
42249
42258
  const error = this.getRuleErrorForCellValue(cellValue, cellPosition, rule);
42250
42259
  return error ? { error, rule, isValid: false } : VALID_RESULT;
42251
42260
  }
42252
- getDataValidationCheckBoxCellPositions() {
42253
- const rules = this.getters
42254
- .getDataValidationRules(this.getters.getActiveSheetId())
42255
- .filter((rule) => rule.criterion.type === "isBoolean");
42256
- return getCellPositionsInRanges(rules.map((rule) => rule.ranges).flat()).filter((position) => this.isCellValidCheckbox(position));
42257
- }
42258
- getDataValidationListCellsPositions() {
42259
- const rules = this.getters
42260
- .getDataValidationRules(this.getters.getActiveSheetId())
42261
- .filter((rule) => (rule.criterion.type === "isValueInList" || rule.criterion.type === "isValueInRange") &&
42262
- rule.criterion.displayStyle === "arrow");
42263
- return getCellPositionsInRanges(rules.map((rule) => rule.ranges).flat());
42264
- }
42265
42261
  getValidationResultForCell(cellPosition) {
42266
42262
  const { col, row, sheetId } = cellPosition;
42267
42263
  if (!this.validationResults[sheetId]) {
@@ -50084,6 +50080,8 @@ class SheetViewPlugin extends UIPlugin {
50084
50080
  "getEdgeScrollRow",
50085
50081
  "getVisibleFigures",
50086
50082
  "getVisibleRect",
50083
+ "getVisibleRectWithoutHeaders",
50084
+ "getVisibleCellPositions",
50087
50085
  "getColRowOffsetInViewport",
50088
50086
  "getMainViewportCoordinates",
50089
50087
  "getActiveSheetScrollInfo",
@@ -50327,6 +50325,26 @@ class SheetViewPlugin extends UIPlugin {
50327
50325
  const viewports = this.getSubViewports(sheetId);
50328
50326
  return [...new Set(viewports.map((v) => range(v.top, v.bottom + 1)).flat())].filter((row) => !this.getters.isHeaderHidden(sheetId, "ROW", row));
50329
50327
  }
50328
+ /**
50329
+ * Get the positions of all the cells that are visible in the viewport, taking merges into account.
50330
+ */
50331
+ getVisibleCellPositions() {
50332
+ const visibleCols = this.getSheetViewVisibleCols();
50333
+ const visibleRows = this.getSheetViewVisibleRows();
50334
+ const sheetId = this.getters.getActiveSheetId();
50335
+ const positions = [];
50336
+ for (const col of visibleCols) {
50337
+ for (const row of visibleRows) {
50338
+ const position = { sheetId, col, row };
50339
+ const mainPosition = this.getters.getMainCellPosition(position);
50340
+ if (mainPosition.row !== row || mainPosition.col !== col) {
50341
+ continue;
50342
+ }
50343
+ positions.push(position);
50344
+ }
50345
+ }
50346
+ return positions;
50347
+ }
50330
50348
  /**
50331
50349
  * Return the main viewport maximum size relative to the client size.
50332
50350
  */
@@ -50446,6 +50464,13 @@ class SheetViewPlugin extends UIPlugin {
50446
50464
  * Computes the coordinates and size to draw the zone on the canvas
50447
50465
  */
50448
50466
  getVisibleRect(zone) {
50467
+ const rect = this.getVisibleRectWithoutHeaders(zone);
50468
+ return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
50469
+ }
50470
+ /**
50471
+ * Computes the coordinates and size to draw the zone without taking the grid offset into account
50472
+ */
50473
+ getVisibleRectWithoutHeaders(zone) {
50449
50474
  const sheetId = this.getters.getActiveSheetId();
50450
50475
  const viewportRects = this.getSubViewports(sheetId)
50451
50476
  .map((viewport) => viewport.getRect(zone))
@@ -50457,12 +50482,7 @@ class SheetViewPlugin extends UIPlugin {
50457
50482
  const y = Math.min(...viewportRects.map((rect) => rect.y));
50458
50483
  const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
50459
50484
  const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
50460
- return {
50461
- x: x + this.gridOffsetX,
50462
- y: y + this.gridOffsetY,
50463
- width,
50464
- height,
50465
- };
50485
+ return { x, y, width, height };
50466
50486
  }
50467
50487
  /**
50468
50488
  * Returns the position of the MainViewport relatively to the start of the grid (without headers)
@@ -50686,13 +50706,8 @@ class HeaderPositionsUIPlugin extends UIPlugin {
50686
50706
  }
50687
50707
  break;
50688
50708
  case "UPDATE_CELL":
50689
- if ("content" in cmd || "format" in cmd) {
50690
- this.headerPositions = {};
50691
- this.isDirty = true;
50692
- }
50693
- else {
50694
- this.headerPositions[cmd.sheetId] = this.computeHeaderPositionsOfSheet(cmd.sheetId);
50695
- }
50709
+ this.headerPositions = {};
50710
+ this.isDirty = true;
50696
50711
  break;
50697
50712
  case "UPDATE_FILTER":
50698
50713
  case "REMOVE_FILTER_TABLE":
@@ -56904,6 +56919,6 @@ const constants = {
56904
56919
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
56905
56920
 
56906
56921
 
56907
- __info__.version = "17.0.13";
56908
- __info__.date = "2024-02-28T12:28:44.914Z";
56909
- __info__.hash = "ed67be7";
56922
+ __info__.version = "17.0.14";
56923
+ __info__.date = "2024-03-12T07:56:15.364Z";
56924
+ __info__.hash = "6f6e1b9";
@@ -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.13
6
- * @date 2024-02-28T12:28:44.914Z
7
- * @hash ed67be7
5
+ * @version 17.0.14
6
+ * @date 2024-03-12T07:56:15.364Z
7
+ * @hash 6f6e1b9
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -6058,8 +6058,10 @@
6058
6058
  if (x === cell) {
6059
6059
  found = true;
6060
6060
  }
6061
- const cellValue = evaluateLiteral(x?.content, { locale: DEFAULT_LOCALE });
6062
- if (filter(cellValue)) {
6061
+ const cellValue = x?.isFormula
6062
+ ? undefined
6063
+ : evaluateLiteral(x?.content, { locale: DEFAULT_LOCALE });
6064
+ if (cellValue && filter(cellValue)) {
6063
6065
  group.push(cellValue);
6064
6066
  }
6065
6067
  else {
@@ -19442,10 +19444,8 @@
19442
19444
  }
19443
19445
  function buildComputeFunctionFromDescription(descr) {
19444
19446
  return function (...args) {
19445
- const computeValue = descr.compute.bind(this);
19446
- const computeFormat = descr.computeFormat?.bind(this) || (() => undefined);
19447
- const value = computeValue(...extractArgValuesFromArgs(args));
19448
- const format = computeFormat(...args);
19447
+ const value = descr.compute.apply(this, extractArgValuesFromArgs(args));
19448
+ const format = descr.computeFormat?.apply(this, args);
19449
19449
  if (isMatrix(value)) {
19450
19450
  if (format === undefined || isMatrix(format)) {
19451
19451
  return value.map((col, i) => col.map((row, j) => ({ value: row, format: format?.[i]?.[j] })));
@@ -27270,7 +27270,11 @@
27270
27270
  }
27271
27271
  }
27272
27272
  updateCellReferenceVisibility() {
27273
- if (this.isCellReferenceVisible || this.env.model.getters.getEditionMode() === "inactive") {
27273
+ if (this.env.model.getters.getEditionMode() === "inactive") {
27274
+ this.isCellReferenceVisible = false;
27275
+ return;
27276
+ }
27277
+ if (this.isCellReferenceVisible) {
27274
27278
  return;
27275
27279
  }
27276
27280
  const sheetId = this.env.model.getters.getActiveSheetId();
@@ -27299,19 +27303,21 @@
27299
27303
  static style = CSS$1;
27300
27304
  static template = "o-spreadsheet-GridCellIcon";
27301
27305
  get iconStyle() {
27302
- const x = this.getIconHorizontalPosition();
27303
- const y = this.getIconVerticalPosition();
27306
+ const cellPosition = this.props.cellPosition;
27307
+ const merge = this.env.model.getters.getMerge(cellPosition);
27308
+ const zone = merge || positionToZone(cellPosition);
27309
+ const rect = this.env.model.getters.getVisibleRectWithoutHeaders(zone);
27310
+ const x = this.getIconHorizontalPosition(rect, cellPosition);
27311
+ const y = this.getIconVerticalPosition(rect, cellPosition);
27304
27312
  return cssPropertiesToCss({
27305
27313
  top: `${y + (this.props.offset?.y || 0)}px`,
27306
27314
  left: `${x + (this.props.offset?.x || 0)}px`,
27307
27315
  });
27308
27316
  }
27309
- getIconVerticalPosition() {
27310
- const { sheetId, row } = this.props.cellPosition;
27311
- const merge = this.env.model.getters.getMerge(this.props.cellPosition);
27312
- const start = this.env.model.getters.getRowDimensionsInViewport(sheetId, row).start;
27313
- const end = this.env.model.getters.getRowDimensionsInViewport(sheetId, merge ? merge.bottom : row).end;
27314
- const cell = this.env.model.getters.getCell(this.props.cellPosition);
27317
+ getIconVerticalPosition(rect, cellPosition) {
27318
+ const start = rect.y;
27319
+ const end = rect.y + rect.height;
27320
+ const cell = this.env.model.getters.getCell(cellPosition);
27315
27321
  const align = this.props.verticalAlign || cell?.style?.verticalAlign || DEFAULT_VERTICAL_ALIGN;
27316
27322
  switch (align) {
27317
27323
  case "bottom":
@@ -27323,13 +27329,11 @@
27323
27329
  return end - GRID_ICON_EDGE_LENGTH - centeringOffset;
27324
27330
  }
27325
27331
  }
27326
- getIconHorizontalPosition() {
27327
- const { sheetId, col } = this.props.cellPosition;
27328
- const merge = this.env.model.getters.getMerge(this.props.cellPosition);
27329
- const start = this.env.model.getters.getColDimensionsInViewport(sheetId, col).start;
27330
- const end = this.env.model.getters.getColDimensionsInViewport(sheetId, merge ? merge.right : col).end;
27331
- const cell = this.env.model.getters.getCell(this.props.cellPosition);
27332
- const evaluatedCell = this.env.model.getters.getEvaluatedCell(this.props.cellPosition);
27332
+ getIconHorizontalPosition(rect, cellPosition) {
27333
+ const start = rect.x;
27334
+ const end = rect.x + rect.width;
27335
+ const cell = this.env.model.getters.getCell(cellPosition);
27336
+ const evaluatedCell = this.env.model.getters.getEvaluatedCell(cellPosition);
27333
27337
  const align = this.props.horizontalAlign || cell?.style?.align || evaluatedCell.defaultAlign;
27334
27338
  switch (align) {
27335
27339
  case "right":
@@ -27421,6 +27425,8 @@
27421
27425
  height: ${CHECKBOX_WIDTH}px;
27422
27426
  accent-color: #808080;
27423
27427
  margin: ${MARGIN}px;
27428
+ /** required to prevent the checkbox position to be sensible to the font-size (affects Firefox) */
27429
+ position: absolute;
27424
27430
  }
27425
27431
  `;
27426
27432
  class DataValidationCheckbox extends owl.Component {
@@ -27436,7 +27442,7 @@
27436
27442
  }
27437
27443
  get isDisabled() {
27438
27444
  const cell = this.env.model.getters.getCell(this.props.cellPosition);
27439
- return !!cell?.isFormula;
27445
+ return this.env.model.getters.isReadonly() || !!cell?.isFormula;
27440
27446
  }
27441
27447
  }
27442
27448
  DataValidationCheckbox.props = {
@@ -27478,12 +27484,17 @@
27478
27484
  static template = "o-spreadsheet-DataValidationOverlay";
27479
27485
  static components = { GridCellIcon, DataValidationCheckbox, DataValidationListIcon };
27480
27486
  get checkBoxCellPositions() {
27481
- return this.env.model.getters.getDataValidationCheckBoxCellPositions();
27487
+ return this.env.model.getters
27488
+ .getVisibleCellPositions()
27489
+ .filter(this.env.model.getters.isCellValidCheckbox);
27482
27490
  }
27483
27491
  get listIconsCellPositions() {
27484
- return this.env.model.getters.isReadonly()
27485
- ? []
27486
- : this.env.model.getters.getDataValidationListCellsPositions();
27492
+ if (this.env.model.getters.isReadonly()) {
27493
+ return [];
27494
+ }
27495
+ return this.env.model.getters
27496
+ .getVisibleCellPositions()
27497
+ .filter(this.env.model.getters.cellHasListDataValidationIcon);
27487
27498
  }
27488
27499
  }
27489
27500
  DataValidationOverlay.props = {};
@@ -38599,7 +38610,6 @@
38599
38610
  "getNumberHeaders",
38600
38611
  "getGridLinesVisibility",
38601
38612
  "getNextSheetName",
38602
- "isEmpty",
38603
38613
  "getSheetSize",
38604
38614
  "getSheetZone",
38605
38615
  "getPaneDivisions",
@@ -38974,14 +38984,6 @@
38974
38984
  // ---------------------------------------------------------------------------
38975
38985
  // Row/Col manipulation
38976
38986
  // ---------------------------------------------------------------------------
38977
- /**
38978
- * Check if a zone only contains empty cells
38979
- */
38980
- isEmpty(sheetId, zone) {
38981
- return positions(zone)
38982
- .map(({ col, row }) => this.getCell({ sheetId, col, row }))
38983
- .every((cell) => !cell || cell.content === "");
38984
- }
38985
38987
  getCommandZones(cmd) {
38986
38988
  const zones = [];
38987
38989
  if ("zone" in cmd) {
@@ -41435,6 +41437,7 @@
41435
41437
  "getEvaluatedCellsInZone",
41436
41438
  "getSpreadPositionsOf",
41437
41439
  "getArrayFormulaSpreadingOn",
41440
+ "isEmpty",
41438
41441
  ];
41439
41442
  shouldRebuildDependenciesGraph = true;
41440
41443
  evaluator;
@@ -41539,6 +41542,14 @@
41539
41542
  getArrayFormulaSpreadingOn(position) {
41540
41543
  return this.evaluator.getArrayFormulaSpreadingOn(position);
41541
41544
  }
41545
+ /**
41546
+ * Check if a zone only contains empty cells
41547
+ */
41548
+ isEmpty(sheetId, zone) {
41549
+ return positions(zone)
41550
+ .map(({ col, row }) => this.getEvaluatedCell({ sheetId, col, row }))
41551
+ .every((cell) => cell.type === CellValueType.empty);
41552
+ }
41542
41553
  // ---------------------------------------------------------------------------
41543
41554
  // Export
41544
41555
  // ---------------------------------------------------------------------------
@@ -42185,8 +42196,6 @@
42185
42196
  class EvaluationDataValidationPlugin extends UIPlugin {
42186
42197
  static getters = [
42187
42198
  "getDataValidationInvalidCriterionValueMessage",
42188
- "getDataValidationCheckBoxCellPositions",
42189
- "getDataValidationListCellsPositions",
42190
42199
  "getInvalidDataValidationMessage",
42191
42200
  "getValidationResultForCellValue",
42192
42201
  "isCellValidCheckbox",
@@ -42250,19 +42259,6 @@
42250
42259
  const error = this.getRuleErrorForCellValue(cellValue, cellPosition, rule);
42251
42260
  return error ? { error, rule, isValid: false } : VALID_RESULT;
42252
42261
  }
42253
- getDataValidationCheckBoxCellPositions() {
42254
- const rules = this.getters
42255
- .getDataValidationRules(this.getters.getActiveSheetId())
42256
- .filter((rule) => rule.criterion.type === "isBoolean");
42257
- return getCellPositionsInRanges(rules.map((rule) => rule.ranges).flat()).filter((position) => this.isCellValidCheckbox(position));
42258
- }
42259
- getDataValidationListCellsPositions() {
42260
- const rules = this.getters
42261
- .getDataValidationRules(this.getters.getActiveSheetId())
42262
- .filter((rule) => (rule.criterion.type === "isValueInList" || rule.criterion.type === "isValueInRange") &&
42263
- rule.criterion.displayStyle === "arrow");
42264
- return getCellPositionsInRanges(rules.map((rule) => rule.ranges).flat());
42265
- }
42266
42262
  getValidationResultForCell(cellPosition) {
42267
42263
  const { col, row, sheetId } = cellPosition;
42268
42264
  if (!this.validationResults[sheetId]) {
@@ -50085,6 +50081,8 @@
50085
50081
  "getEdgeScrollRow",
50086
50082
  "getVisibleFigures",
50087
50083
  "getVisibleRect",
50084
+ "getVisibleRectWithoutHeaders",
50085
+ "getVisibleCellPositions",
50088
50086
  "getColRowOffsetInViewport",
50089
50087
  "getMainViewportCoordinates",
50090
50088
  "getActiveSheetScrollInfo",
@@ -50328,6 +50326,26 @@
50328
50326
  const viewports = this.getSubViewports(sheetId);
50329
50327
  return [...new Set(viewports.map((v) => range(v.top, v.bottom + 1)).flat())].filter((row) => !this.getters.isHeaderHidden(sheetId, "ROW", row));
50330
50328
  }
50329
+ /**
50330
+ * Get the positions of all the cells that are visible in the viewport, taking merges into account.
50331
+ */
50332
+ getVisibleCellPositions() {
50333
+ const visibleCols = this.getSheetViewVisibleCols();
50334
+ const visibleRows = this.getSheetViewVisibleRows();
50335
+ const sheetId = this.getters.getActiveSheetId();
50336
+ const positions = [];
50337
+ for (const col of visibleCols) {
50338
+ for (const row of visibleRows) {
50339
+ const position = { sheetId, col, row };
50340
+ const mainPosition = this.getters.getMainCellPosition(position);
50341
+ if (mainPosition.row !== row || mainPosition.col !== col) {
50342
+ continue;
50343
+ }
50344
+ positions.push(position);
50345
+ }
50346
+ }
50347
+ return positions;
50348
+ }
50331
50349
  /**
50332
50350
  * Return the main viewport maximum size relative to the client size.
50333
50351
  */
@@ -50447,6 +50465,13 @@
50447
50465
  * Computes the coordinates and size to draw the zone on the canvas
50448
50466
  */
50449
50467
  getVisibleRect(zone) {
50468
+ const rect = this.getVisibleRectWithoutHeaders(zone);
50469
+ return { ...rect, x: rect.x + this.gridOffsetX, y: rect.y + this.gridOffsetY };
50470
+ }
50471
+ /**
50472
+ * Computes the coordinates and size to draw the zone without taking the grid offset into account
50473
+ */
50474
+ getVisibleRectWithoutHeaders(zone) {
50450
50475
  const sheetId = this.getters.getActiveSheetId();
50451
50476
  const viewportRects = this.getSubViewports(sheetId)
50452
50477
  .map((viewport) => viewport.getRect(zone))
@@ -50458,12 +50483,7 @@
50458
50483
  const y = Math.min(...viewportRects.map((rect) => rect.y));
50459
50484
  const width = Math.max(...viewportRects.map((rect) => rect.x + rect.width)) - x;
50460
50485
  const height = Math.max(...viewportRects.map((rect) => rect.y + rect.height)) - y;
50461
- return {
50462
- x: x + this.gridOffsetX,
50463
- y: y + this.gridOffsetY,
50464
- width,
50465
- height,
50466
- };
50486
+ return { x, y, width, height };
50467
50487
  }
50468
50488
  /**
50469
50489
  * Returns the position of the MainViewport relatively to the start of the grid (without headers)
@@ -50687,13 +50707,8 @@
50687
50707
  }
50688
50708
  break;
50689
50709
  case "UPDATE_CELL":
50690
- if ("content" in cmd || "format" in cmd) {
50691
- this.headerPositions = {};
50692
- this.isDirty = true;
50693
- }
50694
- else {
50695
- this.headerPositions[cmd.sheetId] = this.computeHeaderPositionsOfSheet(cmd.sheetId);
50696
- }
50710
+ this.headerPositions = {};
50711
+ this.isDirty = true;
50697
50712
  break;
50698
50713
  case "UPDATE_FILTER":
50699
50714
  case "REMOVE_FILTER_TABLE":
@@ -56940,9 +56955,9 @@
56940
56955
  exports.tokenize = tokenize;
56941
56956
 
56942
56957
 
56943
- __info__.version = "17.0.13";
56944
- __info__.date = "2024-02-28T12:28:44.914Z";
56945
- __info__.hash = "ed67be7";
56958
+ __info__.version = "17.0.14";
56959
+ __info__.date = "2024-03-12T07:56:15.364Z";
56960
+ __info__.hash = "6f6e1b9";
56946
56961
 
56947
56962
 
56948
56963
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);