@odoo/o-spreadsheet 16.0.30 → 16.0.32

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.
@@ -203,7 +203,7 @@ const TOPBAR_HEIGHT = 63;
203
203
  const BOTTOMBAR_HEIGHT = 36;
204
204
  const DEFAULT_CELL_WIDTH = 96;
205
205
  const DEFAULT_CELL_HEIGHT = 23;
206
- const SCROLLBAR_WIDTH$1 = 15;
206
+ const SCROLLBAR_WIDTH = 15;
207
207
  const AUTOFILL_EDGE_LENGTH = 8;
208
208
  const ICON_EDGE_LENGTH = 18;
209
209
  const UNHIDE_ICON_EDGE_LENGTH = 14;
@@ -1607,6 +1607,9 @@ function parseFormat(formatString) {
1607
1607
  function formatValue(value, format) {
1608
1608
  switch (typeof value) {
1609
1609
  case "string":
1610
+ if (value.includes('\\"')) {
1611
+ return value.replace(/\\"/g, '"');
1612
+ }
1610
1613
  return value;
1611
1614
  case "boolean":
1612
1615
  return value ? "TRUE" : "FALSE";
@@ -4071,7 +4074,7 @@ class Popover extends Component {
4071
4074
  this.spreadsheetPosition = useSpreadsheetPosition();
4072
4075
  }
4073
4076
  get maxHeight() {
4074
- return Math.max(0, this.viewportDimension.height - BOTTOMBAR_HEIGHT - SCROLLBAR_WIDTH$1);
4077
+ return Math.max(0, this.viewportDimension.height - BOTTOMBAR_HEIGHT - SCROLLBAR_WIDTH);
4075
4078
  }
4076
4079
  get style() {
4077
4080
  // the props's position is expressed relative to the "body" element
@@ -5579,6 +5582,12 @@ const INSERT_LINK = (env) => {
5579
5582
  let { col, row } = env.model.getters.getPosition();
5580
5583
  env.model.dispatch("OPEN_CELL_POPOVER", { col, row, popoverType: "LinkEditor" });
5581
5584
  };
5585
+ const INSERT_LINK_NAME = (env) => {
5586
+ const sheetId = env.model.getters.getActiveSheetId();
5587
+ const { col, row } = env.model.getters.getPosition();
5588
+ const cell = env.model.getters.getCell(sheetId, col, row);
5589
+ return cell && cell.isLink() ? _lt("Edit link") : _lt("Insert link");
5590
+ };
5582
5591
  //------------------------------------------------------------------------------
5583
5592
  // Filters action
5584
5593
  //------------------------------------------------------------------------------
@@ -5716,7 +5725,7 @@ cellMenuRegistry
5716
5725
  action: DELETE_CELL_SHIFT_LEFT,
5717
5726
  })
5718
5727
  .add("insert_link", {
5719
- name: _lt("Insert link"),
5728
+ name: INSERT_LINK_NAME,
5720
5729
  separator: true,
5721
5730
  sequence: 150,
5722
5731
  action: INSERT_LINK,
@@ -19511,9 +19520,6 @@ class EditionPlugin extends UIPlugin {
19511
19520
  break;
19512
19521
  }
19513
19522
  }
19514
- unsubscribe() {
19515
- this.mode = "inactive";
19516
- }
19517
19523
  // ---------------------------------------------------------------------------
19518
19524
  // Getters
19519
19525
  // ---------------------------------------------------------------------------
@@ -20414,13 +20420,12 @@ class Composer extends Component {
20414
20420
  setup() {
20415
20421
  onMounted(() => {
20416
20422
  const el = this.composerRef.el;
20423
+ if (this.props.isDefaultFocus) {
20424
+ this.env.focusableElement.setFocusableElement(el);
20425
+ }
20417
20426
  this.contentHelper.updateEl(el);
20418
20427
  this.processContent();
20419
20428
  });
20420
- onWillUnmount(() => {
20421
- var _a, _b;
20422
- (_b = (_a = this.props).onComposerUnmounted) === null || _b === void 0 ? void 0 : _b.call(_a);
20423
- });
20424
20429
  onPatched(() => {
20425
20430
  if (!this.isKeyStillDown) {
20426
20431
  this.processContent();
@@ -20431,7 +20436,8 @@ class Composer extends Component {
20431
20436
  // Handlers
20432
20437
  // ---------------------------------------------------------------------------
20433
20438
  processArrowKeys(ev) {
20434
- if (this.env.model.getters.isSelectingForComposer()) {
20439
+ if (this.env.model.getters.isSelectingForComposer() ||
20440
+ this.env.model.getters.getEditionMode() === "inactive") {
20435
20441
  this.functionDescriptionState.showDescription = false;
20436
20442
  // Prevent the default content editable behavior which moves the cursor
20437
20443
  // but don't stop the event and let it bubble to the grid which will
@@ -20464,21 +20470,23 @@ class Composer extends Component {
20464
20470
  processTabKey(ev) {
20465
20471
  ev.preventDefault();
20466
20472
  ev.stopPropagation();
20467
- if (this.autoCompleteState.showProvider && this.autocompleteAPI) {
20468
- const autoCompleteValue = this.autocompleteAPI.getValueToFill();
20469
- if (autoCompleteValue) {
20470
- this.autoComplete(autoCompleteValue);
20471
- return;
20473
+ if (this.env.model.getters.getEditionMode() !== "inactive") {
20474
+ if (this.autoCompleteState.showProvider && this.autocompleteAPI) {
20475
+ const autoCompleteValue = this.autocompleteAPI.getValueToFill();
20476
+ if (autoCompleteValue) {
20477
+ this.autoComplete(autoCompleteValue);
20478
+ return;
20479
+ }
20472
20480
  }
20473
- }
20474
- else {
20475
- // when completing with tab, if there is no value to complete, the active cell will be moved to the right.
20476
- // we can't let the model think that it is for a ref selection.
20477
- // todo: check if this can be removed someday
20478
- this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
20481
+ else {
20482
+ // when completing with tab, if there is no value to complete, the active cell will be moved to the right.
20483
+ // we can't let the model think that it is for a ref selection.
20484
+ // todo: check if this can be removed someday
20485
+ this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
20486
+ }
20487
+ this.env.model.dispatch("STOP_EDITION");
20479
20488
  }
20480
20489
  const direction = ev.shiftKey ? "left" : "right";
20481
- this.env.model.dispatch("STOP_EDITION");
20482
20490
  this.env.model.selection.moveAnchorCell(direction, 1);
20483
20491
  }
20484
20492
  processEnterKey(ev) {
@@ -20510,6 +20518,9 @@ class Composer extends Component {
20510
20518
  this.compositionActive = false;
20511
20519
  }
20512
20520
  onKeydown(ev) {
20521
+ if (this.env.model.getters.getEditionMode() === "inactive") {
20522
+ return;
20523
+ }
20513
20524
  let handler = this.keyMapping[ev.key];
20514
20525
  if (handler) {
20515
20526
  handler.call(this, ev);
@@ -20520,23 +20531,46 @@ class Composer extends Component {
20520
20531
  }
20521
20532
  }
20522
20533
  updateCursorIfNeeded() {
20523
- if (!this.env.model.getters.isSelectingForComposer()) {
20534
+ const moveCursor = !this.env.model.getters.isSelectingForComposer() &&
20535
+ !(this.env.model.getters.getEditionMode() === "inactive");
20536
+ if (moveCursor) {
20524
20537
  const { start, end } = this.contentHelper.getCurrentSelection();
20525
20538
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
20526
20539
  this.isKeyStillDown = true;
20527
20540
  }
20528
20541
  }
20542
+ onPaste(ev) {
20543
+ if (this.env.model.getters.getEditionMode() !== "inactive") {
20544
+ ev.stopPropagation();
20545
+ }
20546
+ }
20529
20547
  /*
20530
20548
  * Triggered automatically by the content-editable between the keydown and key up
20531
20549
  * */
20532
- onInput() {
20533
- if (this.props.focus === "inactive" || !this.shouldProcessInputEvents) {
20550
+ onInput(ev) {
20551
+ var _a, _b;
20552
+ if (!this.shouldProcessInputEvents) {
20553
+ return;
20554
+ }
20555
+ if (ev.inputType === "insertFromPaste" &&
20556
+ this.env.model.getters.getEditionMode() === "inactive") {
20534
20557
  return;
20535
20558
  }
20559
+ ev.stopPropagation();
20560
+ let content;
20561
+ if (this.env.model.getters.getEditionMode() === "inactive") {
20562
+ content = ev.data || "";
20563
+ }
20564
+ else {
20565
+ const el = this.composerRef.el;
20566
+ content = el.childNodes.length ? el.textContent : "";
20567
+ }
20568
+ if (this.props.focus === "inactive") {
20569
+ return (_b = (_a = this.props).onComposerCellFocused) === null || _b === void 0 ? void 0 : _b.call(_a, content);
20570
+ }
20536
20571
  this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
20537
- const el = this.composerRef.el;
20538
20572
  this.env.model.dispatch("SET_CURRENT_CONTENT", {
20539
- content: el.childNodes.length ? el.textContent : "",
20573
+ content,
20540
20574
  selection: this.contentHelper.getCurrentSelection(),
20541
20575
  });
20542
20576
  }
@@ -20583,9 +20617,8 @@ class Composer extends Component {
20583
20617
  }
20584
20618
  const newSelection = this.contentHelper.getCurrentSelection();
20585
20619
  this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
20586
- if (this.props.focus === "inactive") {
20587
- this.props.onComposerContentFocused(newSelection);
20588
- }
20620
+ this.props.onComposerContentFocused();
20621
+ if (this.props.focus === "inactive") ;
20589
20622
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", newSelection);
20590
20623
  this.processTokenAtCursor();
20591
20624
  }
@@ -20605,6 +20638,7 @@ class Composer extends Component {
20605
20638
  this.contentHelper.removeAll(); // removes the content of the composer, to be added just after
20606
20639
  this.shouldProcessInputEvents = false;
20607
20640
  if (this.props.focus !== "inactive") {
20641
+ this.contentHelper.el.focus();
20608
20642
  this.contentHelper.selectRange(0, 0); // move the cursor inside the composer at 0 0.
20609
20643
  }
20610
20644
  const content = this.getContent();
@@ -20773,10 +20807,9 @@ Composer.components = { TextValueProvider, FunctionDescriptionProvider };
20773
20807
  Composer.defaultProps = {
20774
20808
  inputStyle: "",
20775
20809
  focus: "inactive",
20810
+ isDefaultFocus: false,
20776
20811
  };
20777
20812
 
20778
- const SCROLLBAR_WIDTH = 14;
20779
- const SCROLLBAR_HIGHT = 15;
20780
20813
  const COMPOSER_BORDER_WIDTH = 3 * 0.4 * window.devicePixelRatio || 1;
20781
20814
  css /* scss */ `
20782
20815
  div.o-grid-composer {
@@ -20791,40 +20824,52 @@ css /* scss */ `
20791
20824
  * It also applies the style of the cell to the composer input.
20792
20825
  */
20793
20826
  class GridComposer extends Component {
20827
+ constructor() {
20828
+ super(...arguments);
20829
+ this.rect = undefined;
20830
+ this.isEditing = false;
20831
+ }
20832
+ get defaultRect() {
20833
+ return { x: 0, y: 0, width: 0, height: 0 };
20834
+ }
20794
20835
  setup() {
20795
- this.gridComposerRef = useRef("gridComposer");
20796
- this.composerState = useState({
20797
- rect: null,
20798
- delimitation: null,
20799
- });
20800
- const { col, row } = this.env.model.getters.getPosition();
20801
- this.zone = this.env.model.getters.expandZone(this.env.model.getters.getActiveSheetId(), {
20802
- left: col,
20803
- right: col,
20804
- top: row,
20805
- bottom: row,
20806
- });
20807
- this.rect = this.env.model.getters.getVisibleRect(this.zone);
20808
- onMounted(() => {
20809
- const el = this.gridComposerRef.el;
20810
- //TODO Should be more correct to have a props that give the parent's clientHeight and clientWidth
20811
- const maxHeight = el.parentElement.clientHeight - this.rect.y - SCROLLBAR_HIGHT;
20812
- el.style.maxHeight = (maxHeight + "px");
20813
- const maxWidth = el.parentElement.clientWidth - this.rect.x - SCROLLBAR_WIDTH;
20814
- el.style.maxWidth = (maxWidth + "px");
20815
- this.composerState.rect = {
20816
- x: this.rect.x,
20817
- y: this.rect.y,
20818
- width: el.clientWidth,
20819
- height: el.clientHeight,
20820
- };
20821
- this.composerState.delimitation = {
20822
- width: el.parentElement.clientWidth,
20823
- height: el.parentElement.clientHeight,
20824
- };
20836
+ onWillUpdateProps(() => {
20837
+ const isEditing = this.env.model.getters.getEditionMode() !== "inactive";
20838
+ if (this.isEditing !== isEditing) {
20839
+ this.isEditing = isEditing;
20840
+ if (!isEditing) {
20841
+ this.rect = undefined;
20842
+ this.env.focusableElement.focus();
20843
+ return;
20844
+ }
20845
+ const position = this.env.model.getters.getPosition();
20846
+ const zone = this.env.model.getters.expandZone(this.env.model.getters.getActiveSheetId(), positionToZone(position));
20847
+ this.rect = this.env.model.getters.getVisibleRect(zone);
20848
+ }
20825
20849
  });
20826
20850
  }
20851
+ get composerProps() {
20852
+ const { width, height } = this.env.model.getters.getSheetViewDimensionWithHeaders();
20853
+ return {
20854
+ rect: this.rect && { ...this.rect },
20855
+ delimitation: {
20856
+ width,
20857
+ height,
20858
+ },
20859
+ inputStyle: this.composerStyle,
20860
+ focus: this.props.focus,
20861
+ isDefaultFocus: true,
20862
+ onComposerContentFocused: this.props.onComposerContentFocused,
20863
+ onComposerCellFocused: this.props.onComposerCellFocused,
20864
+ };
20865
+ }
20827
20866
  get containerStyle() {
20867
+ if (this.env.model.getters.getEditionMode() === "inactive" || !this.rect) {
20868
+ return `
20869
+ position: absolute;
20870
+ z-index: -1000;
20871
+ `;
20872
+ }
20828
20873
  const isFormula = this.env.model.getters.getCurrentContent().startsWith("=");
20829
20874
  const cell = this.env.model.getters.getActiveCell();
20830
20875
  let style = {};
@@ -20847,12 +20892,18 @@ class GridComposer extends Component {
20847
20892
  if (!isFormula) {
20848
20893
  textAlign = style.align || (cell === null || cell === void 0 ? void 0 : cell.defaultAlign) || "left";
20849
20894
  }
20895
+ const sheetDimensions = this.env.model.getters.getSheetViewDimensionWithHeaders();
20896
+ const maxWidth = sheetDimensions.width - this.rect.x;
20897
+ const maxHeight = sheetDimensions.height - this.rect.y;
20850
20898
  return `
20851
20899
  left: ${left - 1}px;
20852
20900
  top: ${top}px;
20853
20901
  min-width: ${width + 2}px;
20854
20902
  min-height: ${height + 1}px;
20855
20903
 
20904
+ max-width: ${maxWidth}px;
20905
+ max-height: ${maxHeight}px;
20906
+
20856
20907
  background: ${background};
20857
20908
  color: ${color};
20858
20909
 
@@ -22489,8 +22540,8 @@ css /* scss */ `
22489
22540
  &.corner {
22490
22541
  right: 0px;
22491
22542
  bottom: 0px;
22492
- height: ${SCROLLBAR_WIDTH$1}px;
22493
- width: ${SCROLLBAR_WIDTH$1}px;
22543
+ height: ${SCROLLBAR_WIDTH}px;
22544
+ width: ${SCROLLBAR_WIDTH}px;
22494
22545
  border-top: 1px solid #e2e3e3;
22495
22546
  border-left: 1px solid #e2e3e3;
22496
22547
  }
@@ -22555,7 +22606,7 @@ class HorizontalScrollBar extends Component {
22555
22606
  return {
22556
22607
  left: `${this.props.position.left + x}px`,
22557
22608
  bottom: "0px",
22558
- height: `${SCROLLBAR_WIDTH$1}px`,
22609
+ height: `${SCROLLBAR_WIDTH}px`,
22559
22610
  right: `0px`,
22560
22611
  };
22561
22612
  }
@@ -22597,7 +22648,7 @@ class VerticalScrollBar extends Component {
22597
22648
  return {
22598
22649
  top: `${this.props.position.top + y}px`,
22599
22650
  right: "0px",
22600
- width: `${SCROLLBAR_WIDTH$1}px`,
22651
+ width: `${SCROLLBAR_WIDTH}px`,
22601
22652
  bottom: `0px`,
22602
22653
  };
22603
22654
  }
@@ -22755,16 +22806,15 @@ class Grid extends Component {
22755
22806
  menuItems: [],
22756
22807
  });
22757
22808
  this.gridRef = useRef("grid");
22758
- this.hiddenInput = useRef("hiddenInput");
22759
22809
  this.canvasPosition = useAbsolutePosition(this.gridRef);
22760
22810
  this.hoveredCell = useState({ col: undefined, row: undefined });
22761
22811
  useExternalListener(document.body, "cut", this.copy.bind(this, true));
22762
22812
  useExternalListener(document.body, "copy", this.copy.bind(this, false));
22763
22813
  useExternalListener(document.body, "paste", this.paste);
22764
- onMounted(() => this.focus());
22765
- this.props.exposeFocus(() => this.focus());
22814
+ onMounted(() => this.focusDefaultElement());
22815
+ this.props.exposeFocus(() => this.focusDefaultElement());
22766
22816
  useGridDrawing("canvas", this.env.model, () => this.env.model.getters.getSheetViewDimensionWithHeaders());
22767
- useEffect(() => this.focus(), () => [this.env.model.getters.getActiveSheetId()]);
22817
+ useEffect(() => this.focusDefaultElement(), () => [this.env.model.getters.getActiveSheetId()]);
22768
22818
  this.onMouseWheel = useWheelHandler((deltaX, deltaY) => {
22769
22819
  this.moveCanvas(deltaX, deltaY);
22770
22820
  this.hoveredCell.col = undefined;
@@ -22779,19 +22829,18 @@ class Grid extends Component {
22779
22829
  return `
22780
22830
  top: ${HEADER_HEIGHT}px;
22781
22831
  left: ${HEADER_WIDTH}px;
22782
- height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH$1}px);
22783
- width: calc(100% - ${HEADER_WIDTH + SCROLLBAR_WIDTH$1}px);
22832
+ height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH}px);
22833
+ width: calc(100% - ${HEADER_WIDTH + SCROLLBAR_WIDTH}px);
22784
22834
  `;
22785
22835
  }
22786
22836
  onClosePopover() {
22787
22837
  this.closeOpenedPopover();
22788
- this.focus();
22838
+ this.focusDefaultElement();
22789
22839
  }
22790
- focus() {
22791
- var _a;
22840
+ focusDefaultElement() {
22792
22841
  if (!this.env.model.getters.getSelectedFigureId() &&
22793
22842
  this.env.model.getters.getEditionMode() === "inactive") {
22794
- (_a = this.hiddenInput.el) === null || _a === void 0 ? void 0 : _a.focus();
22843
+ this.env.focusableElement.focus();
22795
22844
  }
22796
22845
  }
22797
22846
  get gridEl() {
@@ -22940,19 +22989,6 @@ class Grid extends Component {
22940
22989
  return;
22941
22990
  }
22942
22991
  }
22943
- onInput(ev) {
22944
- // the user meant to paste in the sheet, not open the composer with the pasted content
22945
- if (!ev.isComposing && ev.inputType === "insertFromPaste") {
22946
- return;
22947
- }
22948
- if (ev.data) {
22949
- // if the user types a character on the grid, it means he wants to start composing the selected cell with that
22950
- // character
22951
- ev.preventDefault();
22952
- ev.stopPropagation();
22953
- this.props.onGridComposerCellFocused(ev.data);
22954
- }
22955
- }
22956
22992
  // ---------------------------------------------------------------------------
22957
22993
  // Context Menu
22958
22994
  // ---------------------------------------------------------------------------
@@ -23033,7 +23069,7 @@ class Grid extends Component {
23033
23069
  }
23034
23070
  closeMenu() {
23035
23071
  this.menuState.isOpen = false;
23036
- this.focus();
23072
+ this.focusDefaultElement();
23037
23073
  }
23038
23074
  }
23039
23075
  Grid.template = "o-spreadsheet-Grid";
@@ -26729,7 +26765,7 @@ function normalizeV9(formula) {
26729
26765
  * a breaking change is made in the way the state is handled, and an upgrade
26730
26766
  * function should be defined
26731
26767
  */
26732
- const CURRENT_VERSION = 12;
26768
+ const CURRENT_VERSION = 12.5;
26733
26769
  const INITIAL_SHEET_ID = "Sheet1";
26734
26770
  /**
26735
26771
  * This function tries to load anything that could look like a valid
@@ -26995,6 +27031,31 @@ const MIGRATIONS = [
26995
27031
  return data;
26996
27032
  },
26997
27033
  },
27034
+ {
27035
+ description: "Fix datafilter duplication",
27036
+ from: 12,
27037
+ to: 12.5,
27038
+ applyMigration(data) {
27039
+ for (let sheet of data.sheets || []) {
27040
+ let knownDataFilterZones = [];
27041
+ for (let filterTable of sheet.filterTables || []) {
27042
+ const zone = toZone(filterTable.range);
27043
+ // See commit message for the details
27044
+ const intersectZoneIndex = knownDataFilterZones.findIndex((knownZone) => overlap(knownZone, zone));
27045
+ if (intersectZoneIndex !== -1) {
27046
+ knownDataFilterZones[intersectZoneIndex] = zone;
27047
+ }
27048
+ else {
27049
+ knownDataFilterZones.push(zone);
27050
+ }
27051
+ }
27052
+ sheet.filterTables = knownDataFilterZones.map((zone) => ({
27053
+ range: zoneToXc(zone),
27054
+ }));
27055
+ }
27056
+ return data;
27057
+ },
27058
+ },
26998
27059
  ];
26999
27060
  /**
27000
27061
  * This function is used to repair faulty data independently of the migration.
@@ -27890,9 +27951,6 @@ class CellPlugin extends CorePlugin {
27890
27951
  format: cell.format ? getItemId(cell.format, formats) : undefined,
27891
27952
  content: cell.content || undefined,
27892
27953
  };
27893
- if (cell.isFormula()) {
27894
- cells[xc].content = this.buildFormulaContent(_sheet.id, cell, cell.dependencies, true);
27895
- }
27896
27954
  }
27897
27955
  _sheet.cells = cells;
27898
27956
  }
@@ -27915,6 +27973,9 @@ class CellPlugin extends CorePlugin {
27915
27973
  const exportedCellData = sheet.cells[xc];
27916
27974
  exportedCellData.value = cell.evaluated.value;
27917
27975
  exportedCellData.isFormula = cell.isFormula();
27976
+ if (cell.isFormula()) {
27977
+ exportedCellData.content = this.buildFormulaContent(sheet.id, cell, cell.dependencies, true);
27978
+ }
27918
27979
  if (cell.format !== cell.evaluated.format) {
27919
27980
  exportedCellData.computedFormat = cell.evaluated.format;
27920
27981
  }
@@ -35357,9 +35418,6 @@ class SelectionInputPlugin extends UIPlugin {
35357
35418
  }
35358
35419
  }
35359
35420
  }
35360
- unsubscribe() {
35361
- this.unfocus();
35362
- }
35363
35421
  // ---------------------------------------------------------------------------
35364
35422
  // Getters || only callable by the parent
35365
35423
  // ---------------------------------------------------------------------------
@@ -35571,9 +35629,6 @@ class SelectionInputsManagerPlugin extends UIPlugin {
35571
35629
  }
35572
35630
  (_a = this.currentInput) === null || _a === void 0 ? void 0 : _a.handle(cmd);
35573
35631
  }
35574
- unsubscribe() {
35575
- this.unfocus();
35576
- }
35577
35632
  // ---------------------------------------------------------------------------
35578
35633
  // Getters
35579
35634
  // ---------------------------------------------------------------------------
@@ -37972,6 +38027,19 @@ clickableCellRegistry.add("link", {
37972
38027
  sequence: 5,
37973
38028
  });
37974
38029
 
38030
+ class FocusableElement {
38031
+ constructor() {
38032
+ this.focusableElement = undefined;
38033
+ }
38034
+ setFocusableElement(element) {
38035
+ this.focusableElement = element;
38036
+ }
38037
+ focus() {
38038
+ var _a;
38039
+ (_a = this.focusableElement) === null || _a === void 0 ? void 0 : _a.focus();
38040
+ }
38041
+ }
38042
+
37975
38043
  // -----------------------------------------------------------------------------
37976
38044
  // SpreadSheet
37977
38045
  // -----------------------------------------------------------------------------
@@ -39115,8 +39183,8 @@ css /* scss */ `
39115
39183
  &.corner {
39116
39184
  right: 0px;
39117
39185
  bottom: 0px;
39118
- height: ${SCROLLBAR_WIDTH$1}px;
39119
- width: ${SCROLLBAR_WIDTH$1}px;
39186
+ height: ${SCROLLBAR_WIDTH}px;
39187
+ width: ${SCROLLBAR_WIDTH}px;
39120
39188
  border-top: 1px solid #e2e3e3;
39121
39189
  border-left: 1px solid #e2e3e3;
39122
39190
  }
@@ -39160,6 +39228,7 @@ class Spreadsheet extends Component {
39160
39228
  toggleSidePanel: this.toggleSidePanel.bind(this),
39161
39229
  _t: Spreadsheet._t,
39162
39230
  clipboard: navigator.clipboard,
39231
+ focusableElement: new FocusableElement(),
39163
39232
  });
39164
39233
  useExternalListener(window, "resize", () => this.render(true));
39165
39234
  useExternalListener(window, "beforeunload", this.unbindModelEvents.bind(this));
@@ -39262,17 +39331,18 @@ class Spreadsheet extends Component {
39262
39331
  this.model.dispatch("UNFOCUS_SELECTION_INPUT");
39263
39332
  this.composer.topBarFocus = "contentFocus";
39264
39333
  this.composer.gridFocusMode = "inactive";
39265
- this.setComposerContent({ selection } || {});
39334
+ this.setComposerContent({ selection });
39266
39335
  }
39267
- onGridComposerContentFocused() {
39336
+ onGridComposerContentFocused(selection) {
39268
39337
  if (this.model.getters.isReadonly()) {
39269
39338
  return;
39270
39339
  }
39271
39340
  this.model.dispatch("UNFOCUS_SELECTION_INPUT");
39272
39341
  this.composer.topBarFocus = "inactive";
39273
39342
  this.composer.gridFocusMode = "contentFocus";
39274
- this.setComposerContent({});
39343
+ this.setComposerContent({ selection });
39275
39344
  }
39345
+ // TODO: either both are defined or none of them. change those args to an object
39276
39346
  onGridComposerCellFocused(content, selection) {
39277
39347
  if (this.model.getters.isReadonly()) {
39278
39348
  return;
@@ -40645,18 +40715,17 @@ class EventStream {
40645
40715
  if (this.observers.find((sub) => sub.owner === owner)) {
40646
40716
  throw new Error("You are already subscribed forever");
40647
40717
  }
40648
- if ((_a = this.mainSubscription) === null || _a === void 0 ? void 0 : _a.owner) {
40718
+ if (((_a = this.mainSubscription) === null || _a === void 0 ? void 0 : _a.owner) && this.mainSubscription.owner !== owner) {
40649
40719
  (_c = (_b = this.mainSubscription.callbacks).release) === null || _c === void 0 ? void 0 : _c.call(_b);
40650
40720
  }
40651
40721
  this.mainSubscription = { owner, callbacks };
40652
40722
  }
40653
40723
  release(owner) {
40654
- var _a, _b, _c, _d;
40724
+ var _a;
40655
40725
  if (((_a = this.mainSubscription) === null || _a === void 0 ? void 0 : _a.owner) !== owner ||
40656
40726
  this.observers.find((sub) => sub.owner === owner)) {
40657
40727
  return;
40658
40728
  }
40659
- (_d = (_b = this.mainSubscription) === null || _b === void 0 ? void 0 : (_c = _b.callbacks).release) === null || _d === void 0 ? void 0 : _d.call(_c);
40660
40729
  this.mainSubscription = this.defaultSubscription;
40661
40730
  }
40662
40731
  /**
@@ -43075,7 +43144,7 @@ const SPREADSHEET_DIMENSIONS = {
43075
43144
  BOTTOMBAR_HEIGHT,
43076
43145
  DEFAULT_CELL_WIDTH,
43077
43146
  DEFAULT_CELL_HEIGHT,
43078
- SCROLLBAR_WIDTH: SCROLLBAR_WIDTH$1,
43147
+ SCROLLBAR_WIDTH,
43079
43148
  };
43080
43149
  const registries = {
43081
43150
  autofillModifiersRegistry,
@@ -43158,6 +43227,6 @@ function addFunction(functionName, functionDescription) {
43158
43227
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
43159
43228
 
43160
43229
 
43161
- __info__.version = '16.0.30';
43162
- __info__.date = '2024-01-29T13:49:32.243Z';
43163
- __info__.hash = '49966d6';
43230
+ __info__.version = '16.0.32';
43231
+ __info__.date = '2024-02-09T13:05:36.074Z';
43232
+ __info__.hash = '452dce2';