@odoo/o-spreadsheet 16.1.33 → 16.1.37

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.
@@ -204,7 +204,7 @@
204
204
  const BOTTOMBAR_HEIGHT = 36;
205
205
  const DEFAULT_CELL_WIDTH = 96;
206
206
  const DEFAULT_CELL_HEIGHT = 23;
207
- const SCROLLBAR_WIDTH$1 = 15;
207
+ const SCROLLBAR_WIDTH = 15;
208
208
  const AUTOFILL_EDGE_LENGTH = 8;
209
209
  const ICON_EDGE_LENGTH = 18;
210
210
  const UNHIDE_ICON_EDGE_LENGTH = 14;
@@ -1673,6 +1673,9 @@
1673
1673
  function formatValue(value, format) {
1674
1674
  switch (typeof value) {
1675
1675
  case "string":
1676
+ if (value.includes('\\"')) {
1677
+ return value.replace(/\\"/g, '"');
1678
+ }
1676
1679
  return value;
1677
1680
  case "boolean":
1678
1681
  return value ? "TRUE" : "FALSE";
@@ -3875,14 +3878,8 @@
3875
3878
  : undefined));
3876
3879
  }
3877
3880
  }
3878
- else if (zone.left === zone.right && zone.top === zone.bottom) {
3879
- // A single cell. If it's only the title, the dataset is not added.
3880
- if (!dataSetsHaveTitle) {
3881
- dataSets.push(createDataSet(getters, dataSetSheetId, zone, undefined));
3882
- }
3883
- }
3884
3881
  else {
3885
- /* 1 row or 1 column */
3882
+ /* 1 cell, 1 row or 1 column */
3886
3883
  dataSets.push(createDataSet(getters, dataSetSheetId, zone, dataSetsHaveTitle
3887
3884
  ? {
3888
3885
  top: zone.top,
@@ -3932,8 +3929,10 @@
3932
3929
  }
3933
3930
  const dataRange = ds.dataRange.clone({ zone: dataZone });
3934
3931
  return {
3935
- label: ds.labelCell ? getters.getRangeString(ds.labelCell, "forceSheetReference") : undefined,
3936
- range: getters.getRangeString(dataRange, "forceSheetReference"),
3932
+ label: ds.labelCell
3933
+ ? getters.getRangeString(ds.labelCell, "forceSheetReference", true)
3934
+ : undefined,
3935
+ range: getters.getRangeString(dataRange, "forceSheetReference", true),
3937
3936
  };
3938
3937
  }
3939
3938
  /**
@@ -4430,6 +4429,9 @@
4430
4429
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
4431
4430
  return {
4432
4431
  ...this.getDefinition(),
4432
+ labelRange: this.labelRange
4433
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
4434
+ : undefined,
4433
4435
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
4434
4436
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
4435
4437
  dataSets,
@@ -4988,6 +4990,9 @@
4988
4990
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
4989
4991
  return {
4990
4992
  ...this.getDefinition(),
4993
+ labelRange: this.labelRange
4994
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
4995
+ : undefined,
4991
4996
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
4992
4997
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
4993
4998
  dataSets,
@@ -5251,6 +5256,9 @@
5251
5256
  .filter((ds) => ds.range !== ""); // && range !== INCORRECT_RANGE_STRING ? show incorrect #ref ?
5252
5257
  return {
5253
5258
  ...this.getDefinition(),
5259
+ labelRange: this.labelRange
5260
+ ? this.getters.getRangeString(this.labelRange, this.sheetId, true)
5261
+ : undefined,
5254
5262
  backgroundColor: toXlsxHexColor(this.background || BACKGROUND_CHART_COLOR),
5255
5263
  fontColor: toXlsxHexColor(chartFontColor(this.background)),
5256
5264
  verticalAxisPosition: "left",
@@ -7256,6 +7264,12 @@
7256
7264
  let { col, row } = env.model.getters.getActivePosition();
7257
7265
  env.model.dispatch("OPEN_CELL_POPOVER", { col, row, popoverType: "LinkEditor" });
7258
7266
  };
7267
+ const INSERT_LINK_NAME = (env) => {
7268
+ const sheetId = env.model.getters.getActiveSheetId();
7269
+ const { col, row } = env.model.getters.getActivePosition();
7270
+ const cell = env.model.getters.getEvaluatedCell({ sheetId, col, row });
7271
+ return cell && cell.link ? _lt("Edit link") : _lt("Insert link");
7272
+ };
7259
7273
  //------------------------------------------------------------------------------
7260
7274
  // Filters action
7261
7275
  //------------------------------------------------------------------------------
@@ -7393,7 +7407,7 @@
7393
7407
  action: DELETE_CELL_SHIFT_LEFT,
7394
7408
  })
7395
7409
  .add("insert_link", {
7396
- name: _lt("Insert link"),
7410
+ name: INSERT_LINK_NAME,
7397
7411
  separator: true,
7398
7412
  sequence: 150,
7399
7413
  action: INSERT_LINK,
@@ -16552,9 +16566,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
16552
16566
  break;
16553
16567
  }
16554
16568
  }
16555
- unsubscribe() {
16556
- this.mode = "inactive";
16557
- }
16558
16569
  // ---------------------------------------------------------------------------
16559
16570
  // Getters
16560
16571
  // ---------------------------------------------------------------------------
@@ -17447,13 +17458,12 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17447
17458
  setup() {
17448
17459
  owl.onMounted(() => {
17449
17460
  const el = this.composerRef.el;
17461
+ if (this.props.isDefaultFocus) {
17462
+ this.env.focusableElement.setFocusableElement(el);
17463
+ }
17450
17464
  this.contentHelper.updateEl(el);
17451
17465
  this.processContent();
17452
17466
  });
17453
- owl.onWillUnmount(() => {
17454
- var _a, _b;
17455
- (_b = (_a = this.props).onComposerUnmounted) === null || _b === void 0 ? void 0 : _b.call(_a);
17456
- });
17457
17467
  owl.onPatched(() => {
17458
17468
  if (!this.isKeyStillDown) {
17459
17469
  this.processContent();
@@ -17464,7 +17474,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17464
17474
  // Handlers
17465
17475
  // ---------------------------------------------------------------------------
17466
17476
  processArrowKeys(ev) {
17467
- if (this.env.model.getters.isSelectingForComposer()) {
17477
+ if (this.env.model.getters.isSelectingForComposer() ||
17478
+ this.env.model.getters.getEditionMode() === "inactive") {
17468
17479
  this.functionDescriptionState.showDescription = false;
17469
17480
  // Prevent the default content editable behavior which moves the cursor
17470
17481
  ev.preventDefault();
@@ -17505,21 +17516,23 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17505
17516
  var _a;
17506
17517
  ev.preventDefault();
17507
17518
  ev.stopPropagation();
17508
- if (this.autoCompleteState.showProvider) {
17509
- const autoCompleteValue = (_a = this.autoCompleteState.values[this.autoCompleteState.selectedIndex]) === null || _a === void 0 ? void 0 : _a.text;
17510
- if (autoCompleteValue) {
17511
- this.autoComplete(autoCompleteValue);
17512
- return;
17519
+ if (this.env.model.getters.getEditionMode() !== "inactive") {
17520
+ if (this.autoCompleteState.showProvider) {
17521
+ const autoCompleteValue = (_a = this.autoCompleteState.values[this.autoCompleteState.selectedIndex]) === null || _a === void 0 ? void 0 : _a.text;
17522
+ if (autoCompleteValue) {
17523
+ this.autoComplete(autoCompleteValue);
17524
+ return;
17525
+ }
17513
17526
  }
17514
- }
17515
- else {
17516
- // when completing with tab, if there is no value to complete, the active cell will be moved to the right.
17517
- // we can't let the model think that it is for a ref selection.
17518
- // todo: check if this can be removed someday
17519
- this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
17527
+ else {
17528
+ // when completing with tab, if there is no value to complete, the active cell will be moved to the right.
17529
+ // we can't let the model think that it is for a ref selection.
17530
+ // todo: check if this can be removed someday
17531
+ this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
17532
+ }
17533
+ this.env.model.dispatch("STOP_EDITION");
17520
17534
  }
17521
17535
  const direction = ev.shiftKey ? "left" : "right";
17522
- this.env.model.dispatch("STOP_EDITION");
17523
17536
  this.env.model.selection.moveAnchorCell(direction, 1);
17524
17537
  }
17525
17538
  processEnterKey(ev) {
@@ -17552,6 +17565,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17552
17565
  this.compositionActive = false;
17553
17566
  }
17554
17567
  onKeydown(ev) {
17568
+ if (this.env.model.getters.getEditionMode() === "inactive") {
17569
+ return;
17570
+ }
17555
17571
  let handler = this.keyMapping[ev.key];
17556
17572
  if (handler) {
17557
17573
  handler.call(this, ev);
@@ -17562,23 +17578,46 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17562
17578
  }
17563
17579
  }
17564
17580
  updateCursorIfNeeded() {
17565
- if (!this.env.model.getters.isSelectingForComposer()) {
17581
+ const moveCursor = !this.env.model.getters.isSelectingForComposer() &&
17582
+ !(this.env.model.getters.getEditionMode() === "inactive");
17583
+ if (moveCursor) {
17566
17584
  const { start, end } = this.contentHelper.getCurrentSelection();
17567
17585
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
17568
17586
  this.isKeyStillDown = true;
17569
17587
  }
17570
17588
  }
17589
+ onPaste(ev) {
17590
+ if (this.env.model.getters.getEditionMode() !== "inactive") {
17591
+ ev.stopPropagation();
17592
+ }
17593
+ }
17571
17594
  /*
17572
17595
  * Triggered automatically by the content-editable between the keydown and key up
17573
17596
  * */
17574
- onInput() {
17575
- if (this.props.focus === "inactive" || !this.shouldProcessInputEvents) {
17597
+ onInput(ev) {
17598
+ var _a, _b;
17599
+ if (!this.shouldProcessInputEvents) {
17576
17600
  return;
17577
17601
  }
17602
+ if (ev.inputType === "insertFromPaste" &&
17603
+ this.env.model.getters.getEditionMode() === "inactive") {
17604
+ return;
17605
+ }
17606
+ ev.stopPropagation();
17607
+ let content;
17608
+ if (this.env.model.getters.getEditionMode() === "inactive") {
17609
+ content = ev.data || "";
17610
+ }
17611
+ else {
17612
+ const el = this.composerRef.el;
17613
+ content = el.childNodes.length ? el.textContent : "";
17614
+ }
17615
+ if (this.props.focus === "inactive") {
17616
+ return (_b = (_a = this.props).onComposerCellFocused) === null || _b === void 0 ? void 0 : _b.call(_a, content);
17617
+ }
17578
17618
  this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
17579
- const el = this.composerRef.el;
17580
17619
  this.env.model.dispatch("SET_CURRENT_CONTENT", {
17581
- content: el.childNodes.length ? el.textContent : "",
17620
+ content,
17582
17621
  selection: this.contentHelper.getCurrentSelection(),
17583
17622
  });
17584
17623
  }
@@ -17638,9 +17677,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17638
17677
  }
17639
17678
  const newSelection = this.contentHelper.getCurrentSelection();
17640
17679
  this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
17641
- if (this.props.focus === "inactive") {
17642
- this.props.onComposerContentFocused(newSelection);
17643
- }
17680
+ this.props.onComposerContentFocused();
17681
+ if (this.props.focus === "inactive") ;
17644
17682
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", newSelection);
17645
17683
  this.processTokenAtCursor();
17646
17684
  }
@@ -17657,6 +17695,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17657
17695
  this.contentHelper.removeAll(); // removes the content of the composer, to be added just after
17658
17696
  this.shouldProcessInputEvents = false;
17659
17697
  if (this.props.focus !== "inactive") {
17698
+ this.contentHelper.el.focus();
17660
17699
  this.contentHelper.selectRange(0, 0); // move the cursor inside the composer at 0 0.
17661
17700
  }
17662
17701
  const content = this.getContent();
@@ -17823,18 +17862,18 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17823
17862
  Composer.components = { TextValueProvider, FunctionDescriptionProvider };
17824
17863
  Composer.defaultProps = {
17825
17864
  inputStyle: "",
17865
+ isDefaultFocus: false,
17826
17866
  };
17827
17867
  Composer.props = {
17828
17868
  inputStyle: { type: String, optional: true },
17829
17869
  rect: { type: Object, optional: true },
17830
17870
  delimitation: { type: Object, optional: true },
17831
17871
  focus: { validate: (value) => ["inactive", "cellFocus", "contentFocus"].includes(value) },
17832
- onComposerUnmounted: { type: Function, optional: true },
17872
+ onComposerCellFocused: { type: Function, optional: true },
17833
17873
  onComposerContentFocused: Function,
17874
+ isDefaultFocus: { type: Boolean, optional: true },
17834
17875
  };
17835
17876
 
17836
- const SCROLLBAR_WIDTH = 14;
17837
- const SCROLLBAR_HIGHT = 15;
17838
17877
  const COMPOSER_BORDER_WIDTH = 3 * 0.4 * window.devicePixelRatio || 1;
17839
17878
  css /* scss */ `
17840
17879
  div.o-grid-composer {
@@ -17849,35 +17888,52 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17849
17888
  * It also applies the style of the cell to the composer input.
17850
17889
  */
17851
17890
  class GridComposer extends owl.Component {
17891
+ constructor() {
17892
+ super(...arguments);
17893
+ this.rect = undefined;
17894
+ this.isEditing = false;
17895
+ }
17896
+ get defaultRect() {
17897
+ return { x: 0, y: 0, width: 0, height: 0 };
17898
+ }
17852
17899
  setup() {
17853
- this.gridComposerRef = owl.useRef("gridComposer");
17854
- this.composerState = owl.useState({
17855
- rect: undefined,
17856
- delimitation: undefined,
17857
- });
17858
- const { sheetId, col, row } = this.env.model.getters.getActivePosition();
17859
- this.zone = this.env.model.getters.expandZone(sheetId, positionToZone({ col, row }));
17860
- this.rect = this.env.model.getters.getVisibleRect(this.zone);
17861
- owl.onMounted(() => {
17862
- const el = this.gridComposerRef.el;
17863
- //TODO Should be more correct to have a props that give the parent's clientHeight and clientWidth
17864
- const maxHeight = el.parentElement.clientHeight - this.rect.y - SCROLLBAR_HIGHT;
17865
- el.style.maxHeight = (maxHeight + "px");
17866
- const maxWidth = el.parentElement.clientWidth - this.rect.x - SCROLLBAR_WIDTH;
17867
- el.style.maxWidth = (maxWidth + "px");
17868
- this.composerState.rect = {
17869
- x: this.rect.x,
17870
- y: this.rect.y,
17871
- width: el.clientWidth,
17872
- height: el.clientHeight,
17873
- };
17874
- this.composerState.delimitation = {
17875
- width: el.parentElement.clientWidth,
17876
- height: el.parentElement.clientHeight,
17877
- };
17900
+ owl.onWillUpdateProps(() => {
17901
+ const isEditing = this.env.model.getters.getEditionMode() !== "inactive";
17902
+ if (this.isEditing !== isEditing) {
17903
+ this.isEditing = isEditing;
17904
+ if (!isEditing) {
17905
+ this.rect = undefined;
17906
+ this.env.focusableElement.focus();
17907
+ return;
17908
+ }
17909
+ const position = this.env.model.getters.getActivePosition();
17910
+ const zone = this.env.model.getters.expandZone(position.sheetId, positionToZone(position));
17911
+ this.rect = this.env.model.getters.getVisibleRect(zone);
17912
+ }
17878
17913
  });
17879
17914
  }
17915
+ get composerProps() {
17916
+ const { width, height } = this.env.model.getters.getSheetViewDimensionWithHeaders();
17917
+ return {
17918
+ rect: this.rect && { ...this.rect },
17919
+ delimitation: {
17920
+ width,
17921
+ height,
17922
+ },
17923
+ inputStyle: this.composerStyle,
17924
+ focus: this.props.focus,
17925
+ isDefaultFocus: true,
17926
+ onComposerContentFocused: this.props.onComposerContentFocused,
17927
+ onComposerCellFocused: this.props.onComposerCellFocused,
17928
+ };
17929
+ }
17880
17930
  get containerStyle() {
17931
+ if (this.env.model.getters.getEditionMode() === "inactive" || !this.rect) {
17932
+ return `
17933
+ position: absolute;
17934
+ z-index: -1000;
17935
+ `;
17936
+ }
17881
17937
  const isFormula = this.env.model.getters.getCurrentContent().startsWith("=");
17882
17938
  const cell = this.env.model.getters.getActiveCell();
17883
17939
  const position = this.env.model.getters.getActivePosition();
@@ -17897,12 +17953,18 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17897
17953
  if (!isFormula) {
17898
17954
  textAlign = style.align || cell.defaultAlign;
17899
17955
  }
17956
+ const sheetDimensions = this.env.model.getters.getSheetViewDimensionWithHeaders();
17957
+ const maxWidth = sheetDimensions.width - this.rect.x;
17958
+ const maxHeight = sheetDimensions.height - this.rect.y;
17900
17959
  return `
17901
17960
  left: ${left - 1}px;
17902
17961
  top: ${top}px;
17903
17962
  min-width: ${width + 2}px;
17904
17963
  min-height: ${height + 1}px;
17905
17964
 
17965
+ max-width: ${maxWidth}px;
17966
+ max-height: ${maxHeight}px;
17967
+
17906
17968
  background: ${background};
17907
17969
  color: ${color};
17908
17970
 
@@ -17926,8 +17988,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
17926
17988
  GridComposer.components = { Composer };
17927
17989
  GridComposer.props = {
17928
17990
  focus: { validate: (value) => ["inactive", "cellFocus", "contentFocus"].includes(value) },
17929
- onComposerUnmounted: Function,
17930
17991
  onComposerContentFocused: Function,
17992
+ onComposerCellFocused: Function,
17931
17993
  };
17932
17994
 
17933
17995
  const CSS$2 = css /* scss */ `
@@ -18339,8 +18401,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
18339
18401
  if (x === cell) {
18340
18402
  found = true;
18341
18403
  }
18342
- const cellValue = evaluateLiteral(x === null || x === void 0 ? void 0 : x.content);
18343
- if (cellValue.type === CellValueType.number) {
18404
+ const cellValue = (x === null || x === void 0 ? void 0 : x.isFormula) ? undefined : evaluateLiteral(x === null || x === void 0 ? void 0 : x.content);
18405
+ if ((cellValue === null || cellValue === void 0 ? void 0 : cellValue.type) === CellValueType.number) {
18344
18406
  group.push(cellValue.value);
18345
18407
  }
18346
18408
  else {
@@ -22689,7 +22751,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
22689
22751
  this.props.onCellDoubleClicked(col, row);
22690
22752
  }
22691
22753
  onContextMenu(ev) {
22692
- ev.preventDefault();
22693
22754
  const [col, row] = this.getCartesianCoordinates(ev);
22694
22755
  this.props.onCellRightClicked(col, row, { x: ev.clientX, y: ev.clientY });
22695
22756
  }
@@ -23623,8 +23684,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
23623
23684
  &.corner {
23624
23685
  right: 0px;
23625
23686
  bottom: 0px;
23626
- height: ${SCROLLBAR_WIDTH$1}px;
23627
- width: ${SCROLLBAR_WIDTH$1}px;
23687
+ height: ${SCROLLBAR_WIDTH}px;
23688
+ width: ${SCROLLBAR_WIDTH}px;
23628
23689
  border-top: 1px solid #e2e3e3;
23629
23690
  border-left: 1px solid #e2e3e3;
23630
23691
  }
@@ -23697,7 +23758,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
23697
23758
  return {
23698
23759
  left: `${this.props.leftOffset + x}px`,
23699
23760
  bottom: "0px",
23700
- height: `${SCROLLBAR_WIDTH$1}px`,
23761
+ height: `${SCROLLBAR_WIDTH}px`,
23701
23762
  right: `0px`,
23702
23763
  };
23703
23764
  }
@@ -23742,7 +23803,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
23742
23803
  return {
23743
23804
  top: `${this.props.topOffset + y}px`,
23744
23805
  right: "0px",
23745
- width: `${SCROLLBAR_WIDTH$1}px`,
23806
+ width: `${SCROLLBAR_WIDTH}px`,
23746
23807
  bottom: `0px`,
23747
23808
  };
23748
23809
  }
@@ -23916,17 +23977,16 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
23916
23977
  menuItems: [],
23917
23978
  });
23918
23979
  this.gridRef = owl.useRef("grid");
23919
- this.hiddenInput = owl.useRef("hiddenInput");
23920
23980
  this.canvasPosition = useAbsoluteBoundingRect(this.gridRef);
23921
23981
  this.hoveredCell = owl.useState({ col: undefined, row: undefined });
23922
23982
  owl.useChildSubEnv({ getPopoverContainerRect: () => this.getGridRect() });
23923
23983
  owl.useExternalListener(document.body, "cut", this.copy.bind(this, true));
23924
23984
  owl.useExternalListener(document.body, "copy", this.copy.bind(this, false));
23925
23985
  owl.useExternalListener(document.body, "paste", this.paste);
23926
- owl.onMounted(() => this.focus());
23927
- this.props.exposeFocus(() => this.focus());
23986
+ owl.onMounted(() => this.focusDefaultElement());
23987
+ this.props.exposeFocus(() => this.focusDefaultElement());
23928
23988
  useGridDrawing("canvas", this.env.model, () => this.env.model.getters.getSheetViewDimensionWithHeaders());
23929
- owl.useEffect(() => this.focus(), () => [this.env.model.getters.getActiveSheetId()]);
23989
+ owl.useEffect(() => this.focusDefaultElement(), () => [this.env.model.getters.getActiveSheetId()]);
23930
23990
  this.onMouseWheel = useWheelHandler((deltaX, deltaY) => {
23931
23991
  this.moveCanvas(deltaX, deltaY);
23932
23992
  this.hoveredCell.col = undefined;
@@ -23941,21 +24001,20 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
23941
24001
  return `
23942
24002
  top: ${HEADER_HEIGHT}px;
23943
24003
  left: ${HEADER_WIDTH}px;
23944
- height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH$1}px);
23945
- width: calc(100% - ${HEADER_WIDTH + SCROLLBAR_WIDTH$1}px);
24004
+ height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH}px);
24005
+ width: calc(100% - ${HEADER_WIDTH + SCROLLBAR_WIDTH}px);
23946
24006
  `;
23947
24007
  }
23948
24008
  onClosePopover() {
23949
24009
  if (this.env.model.getters.hasOpenedPopover()) {
23950
24010
  this.closeOpenedPopover();
23951
24011
  }
23952
- this.focus();
24012
+ this.focusDefaultElement();
23953
24013
  }
23954
- focus() {
23955
- var _a;
24014
+ focusDefaultElement() {
23956
24015
  if (!this.env.model.getters.getSelectedFigureId() &&
23957
24016
  this.env.model.getters.getEditionMode() === "inactive") {
23958
- (_a = this.hiddenInput.el) === null || _a === void 0 ? void 0 : _a.focus();
24017
+ this.env.focusableElement.focus();
23959
24018
  }
23960
24019
  }
23961
24020
  get gridEl() {
@@ -24100,19 +24159,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
24100
24159
  return;
24101
24160
  }
24102
24161
  }
24103
- onInput(ev) {
24104
- // the user meant to paste in the sheet, not open the composer with the pasted content
24105
- if (!ev.isComposing && ev.inputType === "insertFromPaste") {
24106
- return;
24107
- }
24108
- if (ev.data) {
24109
- // if the user types a character on the grid, it means he wants to start composing the selected cell with that
24110
- // character
24111
- ev.preventDefault();
24112
- ev.stopPropagation();
24113
- this.props.onGridComposerCellFocused(ev.data);
24114
- }
24115
- }
24116
24162
  // ---------------------------------------------------------------------------
24117
24163
  // Context Menu
24118
24164
  // ---------------------------------------------------------------------------
@@ -24209,7 +24255,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
24209
24255
  }
24210
24256
  closeMenu() {
24211
24257
  this.menuState.isOpen = false;
24212
- this.focus();
24258
+ this.focusDefaultElement();
24213
24259
  }
24214
24260
  }
24215
24261
  Grid.template = "o-spreadsheet-Grid";
@@ -27522,7 +27568,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
27522
27568
  * a breaking change is made in the way the state is handled, and an upgrade
27523
27569
  * function should be defined
27524
27570
  */
27525
- const CURRENT_VERSION = 12;
27571
+ const CURRENT_VERSION = 12.5;
27526
27572
  const INITIAL_SHEET_ID = "Sheet1";
27527
27573
  /**
27528
27574
  * This function tries to load anything that could look like a valid
@@ -27788,6 +27834,31 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
27788
27834
  return data;
27789
27835
  },
27790
27836
  },
27837
+ {
27838
+ description: "Fix datafilter duplication",
27839
+ from: 12,
27840
+ to: 12.5,
27841
+ applyMigration(data) {
27842
+ for (let sheet of data.sheets || []) {
27843
+ let knownDataFilterZones = [];
27844
+ for (let filterTable of sheet.filterTables || []) {
27845
+ const zone = toZone(filterTable.range);
27846
+ // See commit message for the details
27847
+ const intersectZoneIndex = knownDataFilterZones.findIndex((knownZone) => overlap(knownZone, zone));
27848
+ if (intersectZoneIndex !== -1) {
27849
+ knownDataFilterZones[intersectZoneIndex] = zone;
27850
+ }
27851
+ else {
27852
+ knownDataFilterZones.push(zone);
27853
+ }
27854
+ }
27855
+ sheet.filterTables = knownDataFilterZones.map((zone) => ({
27856
+ range: zoneToXc(zone),
27857
+ }));
27858
+ }
27859
+ return data;
27860
+ },
27861
+ },
27791
27862
  ];
27792
27863
  /**
27793
27864
  * This function is used to repair faulty data independently of the migration.
@@ -28552,9 +28623,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
28552
28623
  allowDispatch(cmd) {
28553
28624
  switch (cmd.type) {
28554
28625
  case "UPDATE_CELL":
28555
- return this.checkCellOutOfSheet(cmd);
28626
+ return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessUpdateCell);
28556
28627
  case "CLEAR_CELL":
28557
- return this.checkValidations(cmd, this.chainValidations(this.checkCellOutOfSheet, this.checkUselessClearCell));
28628
+ return this.checkValidations(cmd, this.checkCellOutOfSheet, this.checkUselessClearCell);
28558
28629
  default:
28559
28630
  return 0 /* CommandResult.Success */;
28560
28631
  }
@@ -28720,13 +28791,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
28720
28791
  /*
28721
28792
  * Reconstructs the original formula string based on a normalized form and its dependencies
28722
28793
  */
28723
- buildFormulaContent(sheetId, cell, dependencies) {
28794
+ buildFormulaContent(sheetId, cell, dependencies, useFixedZone = false) {
28724
28795
  const ranges = dependencies || cell.dependencies;
28725
28796
  let rangeIndex = 0;
28726
28797
  return concat(cell.compiledFormula.tokens.map((token) => {
28727
28798
  if (token.type === "REFERENCE") {
28728
28799
  const range = ranges[rangeIndex++];
28729
- return this.getters.getRangeString(range, sheetId);
28800
+ return this.getters.getRangeString(range, sheetId, useFixedZone);
28730
28801
  }
28731
28802
  return token.value;
28732
28803
  }));
@@ -28973,6 +29044,18 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
28973
29044
  }
28974
29045
  return 0 /* CommandResult.Success */;
28975
29046
  }
29047
+ checkUselessUpdateCell(cmd) {
29048
+ const cell = this.getters.getCell(cmd);
29049
+ const hasContent = "content" in cmd || "formula" in cmd;
29050
+ const hasStyle = "style" in cmd;
29051
+ const hasFormat = "format" in cmd;
29052
+ if ((!hasContent || (cell === null || cell === void 0 ? void 0 : cell.content) === cmd.content) &&
29053
+ (!hasStyle || deepEquals(cell === null || cell === void 0 ? void 0 : cell.style, cmd.style)) &&
29054
+ (!hasFormat || (cell === null || cell === void 0 ? void 0 : cell.format) === cmd.format)) {
29055
+ return 89 /* CommandResult.NoChanges */;
29056
+ }
29057
+ return 0 /* CommandResult.Success */;
29058
+ }
28976
29059
  }
28977
29060
  CellPlugin.getters = [
28978
29061
  "zoneToXC",
@@ -29299,7 +29382,13 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29299
29382
  }
29300
29383
  }
29301
29384
  exportForExcel(data) {
29302
- this.export(data);
29385
+ if (data.sheets) {
29386
+ for (let sheet of data.sheets) {
29387
+ if (this.cfRules[sheet.id]) {
29388
+ sheet.conditionalFormats = this.cfRules[sheet.id].map((rule) => this.mapToConditionalFormat(sheet.id, rule, { useFixedReference: true }));
29389
+ }
29390
+ }
29391
+ }
29303
29392
  }
29304
29393
  // ---------------------------------------------------------------------------
29305
29394
  // Getters
@@ -29349,11 +29438,11 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
29349
29438
  // ---------------------------------------------------------------------------
29350
29439
  // Private
29351
29440
  // ---------------------------------------------------------------------------
29352
- mapToConditionalFormat(sheetId, cf) {
29441
+ mapToConditionalFormat(sheetId, cf, options = { useFixedReference: false }) {
29353
29442
  return {
29354
29443
  ...cf,
29355
29444
  ranges: cf.ranges.map((range) => {
29356
- return this.getters.getRangeString(range, sheetId);
29445
+ return this.getters.getRangeString(range, sheetId, options.useFixedReference);
29357
29446
  }),
29358
29447
  };
29359
29448
  }
@@ -31264,8 +31353,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31264
31353
  *
31265
31354
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
31266
31355
  * @param forSheetId the id of the sheet where the range string is supposed to be used.
31356
+ * @param [useFixedZone=false] if true, the range will be returned with fixed row and column
31267
31357
  */
31268
- getRangeString(range, forSheetId) {
31358
+ getRangeString(range, forSheetId, useFixedZone = false) {
31269
31359
  if (!range) {
31270
31360
  return INCORRECT_RANGE_STRING;
31271
31361
  }
@@ -31292,7 +31382,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31292
31382
  if (prefixSheet && !sheetName) {
31293
31383
  return INCORRECT_RANGE_STRING;
31294
31384
  }
31295
- let rangeString = this.getRangePartString(rangeImpl, 0);
31385
+ let rangeString = this.getRangePartString(rangeImpl, 0, useFixedZone);
31296
31386
  if (rangeImpl.parts && rangeImpl.parts.length === 2) {
31297
31387
  // this if converts A2:A2 into A2 except if any part of the original range had fixed row or column (with $)
31298
31388
  if (rangeImpl.zone.top !== rangeImpl.zone.bottom ||
@@ -31302,7 +31392,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31302
31392
  rangeImpl.parts[1].rowFixed ||
31303
31393
  rangeImpl.parts[1].colFixed) {
31304
31394
  rangeString += ":";
31305
- rangeString += this.getRangePartString(rangeImpl, 1);
31395
+ rangeString += this.getRangePartString(rangeImpl, 1, useFixedZone);
31306
31396
  }
31307
31397
  }
31308
31398
  return `${prefixSheet ? sheetName + "!" : ""}${rangeString}`;
@@ -31332,14 +31422,14 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31332
31422
  /**
31333
31423
  * Get a Xc string that represent a part of a range
31334
31424
  */
31335
- getRangePartString(range, part) {
31425
+ getRangePartString(range, part, useFixedZone = false) {
31336
31426
  var _a, _b;
31337
31427
  const colFixed = range.parts && ((_a = range.parts[part]) === null || _a === void 0 ? void 0 : _a.colFixed) ? "$" : "";
31338
31428
  const col = part === 0 ? numberToLetters(range.zone.left) : numberToLetters(range.zone.right);
31339
31429
  const rowFixed = range.parts && ((_b = range.parts[part]) === null || _b === void 0 ? void 0 : _b.rowFixed) ? "$" : "";
31340
31430
  const row = part === 0 ? String(range.zone.top + 1) : String(range.zone.bottom + 1);
31341
31431
  let str = "";
31342
- if (range.isFullCol) {
31432
+ if (range.isFullCol && !useFixedZone) {
31343
31433
  if (part === 0 && range.unboundedZone.hasHeader) {
31344
31434
  str = colFixed + col + rowFixed + row;
31345
31435
  }
@@ -31347,7 +31437,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
31347
31437
  str = colFixed + col;
31348
31438
  }
31349
31439
  }
31350
- else if (range.isFullRow) {
31440
+ else if (range.isFullRow && !useFixedZone) {
31351
31441
  if (part === 0 && range.unboundedZone.hasHeader) {
31352
31442
  str = colFixed + col + rowFixed + row;
31353
31443
  }
@@ -32722,6 +32812,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
32722
32812
  if (cell.format !== evaluatedCell.format) {
32723
32813
  exportedCellData.computedFormat = evaluatedCell.format;
32724
32814
  }
32815
+ // if there is a formula but no dependencies (maybe because the cell is in error), no need to recompute the formula text
32816
+ if (cell.isFormula && cell.dependencies.length) {
32817
+ exportedCellData.content = this.getters.buildFormulaContent(sheet.id, cell, cell.dependencies, true);
32818
+ }
32725
32819
  }
32726
32820
  }
32727
32821
  }
@@ -34582,8 +34676,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
34582
34676
  let row = zone.bottom;
34583
34677
  if (col > 0) {
34584
34678
  let leftPosition = { sheetId, col: col - 1, row };
34585
- while (this.getters.getEvaluatedCell(leftPosition).type !== CellValueType.empty ||
34586
- ((_a = this.getters.getCell(leftPosition)) === null || _a === void 0 ? void 0 : _a.content)) {
34679
+ while ((_a = this.getters.getCell(leftPosition)) === null || _a === void 0 ? void 0 : _a.content) {
34587
34680
  row += 1;
34588
34681
  leftPosition = { sheetId, col: col - 1, row };
34589
34682
  }
@@ -34592,8 +34685,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
34592
34685
  col = zone.right;
34593
34686
  if (col <= this.getters.getNumberCols(sheetId)) {
34594
34687
  let rightPosition = { sheetId, col: col + 1, row };
34595
- while (this.getters.getEvaluatedCell(rightPosition).type !== CellValueType.empty ||
34596
- ((_b = this.getters.getCell(rightPosition)) === null || _b === void 0 ? void 0 : _b.content)) {
34688
+ while ((_b = this.getters.getCell(rightPosition)) === null || _b === void 0 ? void 0 : _b.content) {
34597
34689
  row += 1;
34598
34690
  rightPosition = { sheetId, col: col + 1, row };
34599
34691
  }
@@ -36285,9 +36377,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
36285
36377
  }
36286
36378
  }
36287
36379
  }
36288
- unsubscribe() {
36289
- this.unfocus();
36290
- }
36291
36380
  // ---------------------------------------------------------------------------
36292
36381
  // Getters || only callable by the parent
36293
36382
  // ---------------------------------------------------------------------------
@@ -36494,9 +36583,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
36494
36583
  break;
36495
36584
  case "FOCUS_RANGE":
36496
36585
  case "CHANGE_RANGE":
36497
- if (cmd.id !== this.focusedInputId) {
36498
- const input = this.inputs[cmd.id];
36499
- const range = input.ranges.find((range) => range.id === cmd.rangeId);
36586
+ const input = this.inputs[cmd.id];
36587
+ const range = input.ranges.find((range) => range.id === cmd.rangeId);
36588
+ if (range) {
36500
36589
  const sheetId = this.getters.getActiveSheetId();
36501
36590
  const zone = this.getters.getRangeFromSheetXC(sheetId, (range === null || range === void 0 ? void 0 : range.xc) || "A1").zone;
36502
36591
  this.selection.capture(input, { cell: { col: zone.left, row: zone.top }, zone }, { handleEvent: input.handleEvent.bind(input) });
@@ -36506,9 +36595,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
36506
36595
  }
36507
36596
  (_a = this.currentInput) === null || _a === void 0 ? void 0 : _a.handle(cmd);
36508
36597
  }
36509
- unsubscribe() {
36510
- this.unfocus();
36511
- }
36512
36598
  // ---------------------------------------------------------------------------
36513
36599
  // Getters
36514
36600
  // ---------------------------------------------------------------------------
@@ -39579,6 +39665,19 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
39579
39665
  }
39580
39666
  }
39581
39667
 
39668
+ class FocusableElement {
39669
+ constructor() {
39670
+ this.focusableElement = undefined;
39671
+ }
39672
+ setFocusableElement(element) {
39673
+ this.focusableElement = element;
39674
+ }
39675
+ focus() {
39676
+ var _a;
39677
+ (_a = this.focusableElement) === null || _a === void 0 ? void 0 : _a.focus();
39678
+ }
39679
+ }
39680
+
39582
39681
  // -----------------------------------------------------------------------------
39583
39682
  // SpreadSheet
39584
39683
  // -----------------------------------------------------------------------------
@@ -40822,8 +40921,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
40822
40921
  &.corner {
40823
40922
  right: 0px;
40824
40923
  bottom: 0px;
40825
- height: ${SCROLLBAR_WIDTH$1}px;
40826
- width: ${SCROLLBAR_WIDTH$1}px;
40924
+ height: ${SCROLLBAR_WIDTH}px;
40925
+ width: ${SCROLLBAR_WIDTH}px;
40827
40926
  border-top: 1px solid #e2e3e3;
40828
40927
  border-left: 1px solid #e2e3e3;
40829
40928
  }
@@ -40870,6 +40969,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
40870
40969
  toggleSidePanel: this.toggleSidePanel.bind(this),
40871
40970
  _t: Spreadsheet._t,
40872
40971
  clipboard: this.env.clipboard || instantiateClipboard(),
40972
+ focusableElement: new FocusableElement(),
40873
40973
  });
40874
40974
  owl.useExternalListener(window, "resize", () => this.render(true));
40875
40975
  owl.useExternalListener(window, "beforeunload", this.unbindModelEvents.bind(this));
@@ -40968,17 +41068,18 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
40968
41068
  this.model.dispatch("UNFOCUS_SELECTION_INPUT");
40969
41069
  this.composer.topBarFocus = "contentFocus";
40970
41070
  this.composer.gridFocusMode = "inactive";
40971
- this.setComposerContent({ selection } || {});
41071
+ this.setComposerContent({ selection });
40972
41072
  }
40973
- onGridComposerContentFocused() {
41073
+ onGridComposerContentFocused(selection) {
40974
41074
  if (this.model.getters.isReadonly()) {
40975
41075
  return;
40976
41076
  }
40977
41077
  this.model.dispatch("UNFOCUS_SELECTION_INPUT");
40978
41078
  this.composer.topBarFocus = "inactive";
40979
41079
  this.composer.gridFocusMode = "contentFocus";
40980
- this.setComposerContent({});
41080
+ this.setComposerContent({ selection });
40981
41081
  }
41082
+ // TODO: either both are defined or none of them. change those args to an object
40982
41083
  onGridComposerCellFocused(content, selection) {
40983
41084
  if (this.model.getters.isReadonly()) {
40984
41085
  return;
@@ -41959,18 +42060,17 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
41959
42060
  if (this.observers.find((sub) => sub.owner === owner)) {
41960
42061
  throw new Error("You are already subscribed forever");
41961
42062
  }
41962
- if ((_a = this.mainSubscription) === null || _a === void 0 ? void 0 : _a.owner) {
42063
+ if (((_a = this.mainSubscription) === null || _a === void 0 ? void 0 : _a.owner) && this.mainSubscription.owner !== owner) {
41963
42064
  (_c = (_b = this.mainSubscription.callbacks).release) === null || _c === void 0 ? void 0 : _c.call(_b);
41964
42065
  }
41965
42066
  this.mainSubscription = { owner, callbacks };
41966
42067
  }
41967
42068
  release(owner) {
41968
- var _a, _b, _c, _d;
42069
+ var _a;
41969
42070
  if (((_a = this.mainSubscription) === null || _a === void 0 ? void 0 : _a.owner) !== owner ||
41970
42071
  this.observers.find((sub) => sub.owner === owner)) {
41971
42072
  return;
41972
42073
  }
41973
- (_d = (_b = this.mainSubscription) === null || _b === void 0 ? void 0 : (_c = _b.callbacks).release) === null || _d === void 0 ? void 0 : _d.call(_c);
41974
42074
  this.mainSubscription = this.defaultSubscription;
41975
42075
  }
41976
42076
  /**
@@ -42438,11 +42538,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
42438
42538
  * next cluster if the given cell is outside a cluster or at the border of a cluster in the given direction.
42439
42539
  */
42440
42540
  getEndOfCluster(startPosition, dim, dir) {
42441
- const sheet = this.getters.getActiveSheet();
42442
42541
  let currentPosition = startPosition;
42443
42542
  // If both the current cell and the next cell are not empty, we want to go to the end of the cluster
42444
42543
  const nextCellPosition = this.getNextCellPosition(startPosition, dim, dir);
42445
- let mode = !this.isCellEmpty(currentPosition, sheet.id) && !this.isCellEmpty(nextCellPosition, sheet.id)
42544
+ let mode = !this.isEvaluatedCellEmpty(currentPosition) && !this.isEvaluatedCellEmpty(nextCellPosition)
42446
42545
  ? "endOfCluster"
42447
42546
  : "nextCluster";
42448
42547
  while (true) {
@@ -42452,7 +42551,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
42452
42551
  currentPosition.row === nextCellPosition.row) {
42453
42552
  break;
42454
42553
  }
42455
- const isNextCellEmpty = this.isCellEmpty(nextCellPosition, sheet.id);
42554
+ const isNextCellEmpty = this.isEvaluatedCellEmpty(nextCellPosition);
42456
42555
  if (mode === "endOfCluster" && isNextCellEmpty) {
42457
42556
  break;
42458
42557
  }
@@ -42466,14 +42565,25 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
42466
42565
  return dim === "cols" ? currentPosition.col : currentPosition.row;
42467
42566
  }
42468
42567
  /**
42469
- * Check if a cell is empty or undefined in the model. If the cell is part of a merge,
42470
- * check if the merge containing the cell is empty.
42568
+ * Check if a cell evaluated value is empty. If the cell is part of a merge,
42569
+ * the check applies to the main cell of the merge.
42471
42570
  */
42472
- isCellEmpty({ col, row }, sheetId = this.getters.getActiveSheetId()) {
42571
+ isEvaluatedCellEmpty({ col, row }) {
42572
+ const sheetId = this.getters.getActiveSheetId();
42473
42573
  const position = this.getters.getMainCellPosition({ sheetId, col, row });
42474
42574
  const cell = this.getters.getEvaluatedCell(position);
42475
42575
  return cell.type === CellValueType.empty;
42476
42576
  }
42577
+ /**
42578
+ * Checks if a cell is empty (i.e. does not have a content). If the cell is part of a merge,
42579
+ * the check applies to the main cell of the merge.
42580
+ */
42581
+ isCellEmpty({ col, row }) {
42582
+ var _a;
42583
+ const sheetId = this.getters.getActiveSheetId();
42584
+ const position = this.getters.getMainCellPosition({ sheetId, col, row });
42585
+ return !((_a = this.getters.getCell(position)) === null || _a === void 0 ? void 0 : _a.content);
42586
+ }
42477
42587
  /** Computes the next cell position in the given direction by crossing through merges and skipping hidden cells.
42478
42588
  *
42479
42589
  * This has the same behaviour as getNextAvailablePosition() for certain arguments, but use this method instead
@@ -42952,12 +43062,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
42952
43062
  attrs.push(["t", "str"]);
42953
43063
  cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
42954
43064
  }
42955
- node = escapeXml /*xml*/ `
42956
- <f>
42957
- ${XlsxFormula}
42958
- </f>
42959
- ${cycle}
42960
- `;
43065
+ node = escapeXml /*xml*/ `<f> ${XlsxFormula} </f> ${cycle}`;
42961
43066
  return { attrs, node };
42962
43067
  }
42963
43068
  else {
@@ -43698,11 +43803,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
43698
43803
  ({ attrs: additionalAttrs, node: cellNode } = addContent(cell.content, construct.sharedStrings, isTableHeader));
43699
43804
  }
43700
43805
  attributes.push(...additionalAttrs);
43701
- cellNodes.push(escapeXml /*xml*/ `
43702
- <c ${formatAttributes(attributes)}>
43703
- ${cellNode}
43704
- </c>
43705
- `);
43806
+ // prettier-ignore
43807
+ cellNodes.push(escapeXml /*xml*/ `<c ${formatAttributes(attributes)}>
43808
+ ${cellNode}
43809
+ </c>`);
43706
43810
  }
43707
43811
  }
43708
43812
  if (cellNodes.length || row.size !== DEFAULT_CELL_HEIGHT || row.isHidden) {
@@ -44459,7 +44563,7 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
44459
44563
  BOTTOMBAR_HEIGHT,
44460
44564
  DEFAULT_CELL_WIDTH,
44461
44565
  DEFAULT_CELL_HEIGHT,
44462
- SCROLLBAR_WIDTH: SCROLLBAR_WIDTH$1,
44566
+ SCROLLBAR_WIDTH,
44463
44567
  };
44464
44568
  const registries = {
44465
44569
  autofillModifiersRegistry,
@@ -44576,9 +44680,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
44576
44680
  Object.defineProperty(exports, '__esModule', { value: true });
44577
44681
 
44578
44682
 
44579
- __info__.version = '16.1.33';
44580
- __info__.date = '2024-01-29T13:49:43.259Z';
44581
- __info__.hash = 'd3b27dd';
44683
+ __info__.version = '16.1.37';
44684
+ __info__.date = '2024-02-28T12:25:26.784Z';
44685
+ __info__.hash = '499b3b2';
44582
44686
 
44583
44687
 
44584
44688
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);