@odoo/o-spreadsheet 16.0.31 → 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;
@@ -4074,7 +4074,7 @@ class Popover extends Component {
4074
4074
  this.spreadsheetPosition = useSpreadsheetPosition();
4075
4075
  }
4076
4076
  get maxHeight() {
4077
- return Math.max(0, this.viewportDimension.height - BOTTOMBAR_HEIGHT - SCROLLBAR_WIDTH$1);
4077
+ return Math.max(0, this.viewportDimension.height - BOTTOMBAR_HEIGHT - SCROLLBAR_WIDTH);
4078
4078
  }
4079
4079
  get style() {
4080
4080
  // the props's position is expressed relative to the "body" element
@@ -19520,9 +19520,6 @@ class EditionPlugin extends UIPlugin {
19520
19520
  break;
19521
19521
  }
19522
19522
  }
19523
- unsubscribe() {
19524
- this.mode = "inactive";
19525
- }
19526
19523
  // ---------------------------------------------------------------------------
19527
19524
  // Getters
19528
19525
  // ---------------------------------------------------------------------------
@@ -20423,13 +20420,12 @@ class Composer extends Component {
20423
20420
  setup() {
20424
20421
  onMounted(() => {
20425
20422
  const el = this.composerRef.el;
20423
+ if (this.props.isDefaultFocus) {
20424
+ this.env.focusableElement.setFocusableElement(el);
20425
+ }
20426
20426
  this.contentHelper.updateEl(el);
20427
20427
  this.processContent();
20428
20428
  });
20429
- onWillUnmount(() => {
20430
- var _a, _b;
20431
- (_b = (_a = this.props).onComposerUnmounted) === null || _b === void 0 ? void 0 : _b.call(_a);
20432
- });
20433
20429
  onPatched(() => {
20434
20430
  if (!this.isKeyStillDown) {
20435
20431
  this.processContent();
@@ -20440,7 +20436,8 @@ class Composer extends Component {
20440
20436
  // Handlers
20441
20437
  // ---------------------------------------------------------------------------
20442
20438
  processArrowKeys(ev) {
20443
- if (this.env.model.getters.isSelectingForComposer()) {
20439
+ if (this.env.model.getters.isSelectingForComposer() ||
20440
+ this.env.model.getters.getEditionMode() === "inactive") {
20444
20441
  this.functionDescriptionState.showDescription = false;
20445
20442
  // Prevent the default content editable behavior which moves the cursor
20446
20443
  // but don't stop the event and let it bubble to the grid which will
@@ -20473,21 +20470,23 @@ class Composer extends Component {
20473
20470
  processTabKey(ev) {
20474
20471
  ev.preventDefault();
20475
20472
  ev.stopPropagation();
20476
- if (this.autoCompleteState.showProvider && this.autocompleteAPI) {
20477
- const autoCompleteValue = this.autocompleteAPI.getValueToFill();
20478
- if (autoCompleteValue) {
20479
- this.autoComplete(autoCompleteValue);
20480
- 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
+ }
20481
20480
  }
20482
- }
20483
- else {
20484
- // when completing with tab, if there is no value to complete, the active cell will be moved to the right.
20485
- // we can't let the model think that it is for a ref selection.
20486
- // todo: check if this can be removed someday
20487
- 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");
20488
20488
  }
20489
20489
  const direction = ev.shiftKey ? "left" : "right";
20490
- this.env.model.dispatch("STOP_EDITION");
20491
20490
  this.env.model.selection.moveAnchorCell(direction, 1);
20492
20491
  }
20493
20492
  processEnterKey(ev) {
@@ -20519,6 +20518,9 @@ class Composer extends Component {
20519
20518
  this.compositionActive = false;
20520
20519
  }
20521
20520
  onKeydown(ev) {
20521
+ if (this.env.model.getters.getEditionMode() === "inactive") {
20522
+ return;
20523
+ }
20522
20524
  let handler = this.keyMapping[ev.key];
20523
20525
  if (handler) {
20524
20526
  handler.call(this, ev);
@@ -20529,23 +20531,46 @@ class Composer extends Component {
20529
20531
  }
20530
20532
  }
20531
20533
  updateCursorIfNeeded() {
20532
- if (!this.env.model.getters.isSelectingForComposer()) {
20534
+ const moveCursor = !this.env.model.getters.isSelectingForComposer() &&
20535
+ !(this.env.model.getters.getEditionMode() === "inactive");
20536
+ if (moveCursor) {
20533
20537
  const { start, end } = this.contentHelper.getCurrentSelection();
20534
20538
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
20535
20539
  this.isKeyStillDown = true;
20536
20540
  }
20537
20541
  }
20542
+ onPaste(ev) {
20543
+ if (this.env.model.getters.getEditionMode() !== "inactive") {
20544
+ ev.stopPropagation();
20545
+ }
20546
+ }
20538
20547
  /*
20539
20548
  * Triggered automatically by the content-editable between the keydown and key up
20540
20549
  * */
20541
- onInput() {
20542
- if (this.props.focus === "inactive" || !this.shouldProcessInputEvents) {
20550
+ onInput(ev) {
20551
+ var _a, _b;
20552
+ if (!this.shouldProcessInputEvents) {
20543
20553
  return;
20544
20554
  }
20555
+ if (ev.inputType === "insertFromPaste" &&
20556
+ this.env.model.getters.getEditionMode() === "inactive") {
20557
+ return;
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
+ }
20545
20571
  this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
20546
- const el = this.composerRef.el;
20547
20572
  this.env.model.dispatch("SET_CURRENT_CONTENT", {
20548
- content: el.childNodes.length ? el.textContent : "",
20573
+ content,
20549
20574
  selection: this.contentHelper.getCurrentSelection(),
20550
20575
  });
20551
20576
  }
@@ -20592,9 +20617,8 @@ class Composer extends Component {
20592
20617
  }
20593
20618
  const newSelection = this.contentHelper.getCurrentSelection();
20594
20619
  this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");
20595
- if (this.props.focus === "inactive") {
20596
- this.props.onComposerContentFocused(newSelection);
20597
- }
20620
+ this.props.onComposerContentFocused();
20621
+ if (this.props.focus === "inactive") ;
20598
20622
  this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", newSelection);
20599
20623
  this.processTokenAtCursor();
20600
20624
  }
@@ -20614,6 +20638,7 @@ class Composer extends Component {
20614
20638
  this.contentHelper.removeAll(); // removes the content of the composer, to be added just after
20615
20639
  this.shouldProcessInputEvents = false;
20616
20640
  if (this.props.focus !== "inactive") {
20641
+ this.contentHelper.el.focus();
20617
20642
  this.contentHelper.selectRange(0, 0); // move the cursor inside the composer at 0 0.
20618
20643
  }
20619
20644
  const content = this.getContent();
@@ -20782,10 +20807,9 @@ Composer.components = { TextValueProvider, FunctionDescriptionProvider };
20782
20807
  Composer.defaultProps = {
20783
20808
  inputStyle: "",
20784
20809
  focus: "inactive",
20810
+ isDefaultFocus: false,
20785
20811
  };
20786
20812
 
20787
- const SCROLLBAR_WIDTH = 14;
20788
- const SCROLLBAR_HIGHT = 15;
20789
20813
  const COMPOSER_BORDER_WIDTH = 3 * 0.4 * window.devicePixelRatio || 1;
20790
20814
  css /* scss */ `
20791
20815
  div.o-grid-composer {
@@ -20800,40 +20824,52 @@ css /* scss */ `
20800
20824
  * It also applies the style of the cell to the composer input.
20801
20825
  */
20802
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
+ }
20803
20835
  setup() {
20804
- this.gridComposerRef = useRef("gridComposer");
20805
- this.composerState = useState({
20806
- rect: null,
20807
- delimitation: null,
20808
- });
20809
- const { col, row } = this.env.model.getters.getPosition();
20810
- this.zone = this.env.model.getters.expandZone(this.env.model.getters.getActiveSheetId(), {
20811
- left: col,
20812
- right: col,
20813
- top: row,
20814
- bottom: row,
20815
- });
20816
- this.rect = this.env.model.getters.getVisibleRect(this.zone);
20817
- onMounted(() => {
20818
- const el = this.gridComposerRef.el;
20819
- //TODO Should be more correct to have a props that give the parent's clientHeight and clientWidth
20820
- const maxHeight = el.parentElement.clientHeight - this.rect.y - SCROLLBAR_HIGHT;
20821
- el.style.maxHeight = (maxHeight + "px");
20822
- const maxWidth = el.parentElement.clientWidth - this.rect.x - SCROLLBAR_WIDTH;
20823
- el.style.maxWidth = (maxWidth + "px");
20824
- this.composerState.rect = {
20825
- x: this.rect.x,
20826
- y: this.rect.y,
20827
- width: el.clientWidth,
20828
- height: el.clientHeight,
20829
- };
20830
- this.composerState.delimitation = {
20831
- width: el.parentElement.clientWidth,
20832
- height: el.parentElement.clientHeight,
20833
- };
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
+ }
20834
20849
  });
20835
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
+ }
20836
20866
  get containerStyle() {
20867
+ if (this.env.model.getters.getEditionMode() === "inactive" || !this.rect) {
20868
+ return `
20869
+ position: absolute;
20870
+ z-index: -1000;
20871
+ `;
20872
+ }
20837
20873
  const isFormula = this.env.model.getters.getCurrentContent().startsWith("=");
20838
20874
  const cell = this.env.model.getters.getActiveCell();
20839
20875
  let style = {};
@@ -20856,12 +20892,18 @@ class GridComposer extends Component {
20856
20892
  if (!isFormula) {
20857
20893
  textAlign = style.align || (cell === null || cell === void 0 ? void 0 : cell.defaultAlign) || "left";
20858
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;
20859
20898
  return `
20860
20899
  left: ${left - 1}px;
20861
20900
  top: ${top}px;
20862
20901
  min-width: ${width + 2}px;
20863
20902
  min-height: ${height + 1}px;
20864
20903
 
20904
+ max-width: ${maxWidth}px;
20905
+ max-height: ${maxHeight}px;
20906
+
20865
20907
  background: ${background};
20866
20908
  color: ${color};
20867
20909
 
@@ -22498,8 +22540,8 @@ css /* scss */ `
22498
22540
  &.corner {
22499
22541
  right: 0px;
22500
22542
  bottom: 0px;
22501
- height: ${SCROLLBAR_WIDTH$1}px;
22502
- width: ${SCROLLBAR_WIDTH$1}px;
22543
+ height: ${SCROLLBAR_WIDTH}px;
22544
+ width: ${SCROLLBAR_WIDTH}px;
22503
22545
  border-top: 1px solid #e2e3e3;
22504
22546
  border-left: 1px solid #e2e3e3;
22505
22547
  }
@@ -22564,7 +22606,7 @@ class HorizontalScrollBar extends Component {
22564
22606
  return {
22565
22607
  left: `${this.props.position.left + x}px`,
22566
22608
  bottom: "0px",
22567
- height: `${SCROLLBAR_WIDTH$1}px`,
22609
+ height: `${SCROLLBAR_WIDTH}px`,
22568
22610
  right: `0px`,
22569
22611
  };
22570
22612
  }
@@ -22606,7 +22648,7 @@ class VerticalScrollBar extends Component {
22606
22648
  return {
22607
22649
  top: `${this.props.position.top + y}px`,
22608
22650
  right: "0px",
22609
- width: `${SCROLLBAR_WIDTH$1}px`,
22651
+ width: `${SCROLLBAR_WIDTH}px`,
22610
22652
  bottom: `0px`,
22611
22653
  };
22612
22654
  }
@@ -22764,16 +22806,15 @@ class Grid extends Component {
22764
22806
  menuItems: [],
22765
22807
  });
22766
22808
  this.gridRef = useRef("grid");
22767
- this.hiddenInput = useRef("hiddenInput");
22768
22809
  this.canvasPosition = useAbsolutePosition(this.gridRef);
22769
22810
  this.hoveredCell = useState({ col: undefined, row: undefined });
22770
22811
  useExternalListener(document.body, "cut", this.copy.bind(this, true));
22771
22812
  useExternalListener(document.body, "copy", this.copy.bind(this, false));
22772
22813
  useExternalListener(document.body, "paste", this.paste);
22773
- onMounted(() => this.focus());
22774
- this.props.exposeFocus(() => this.focus());
22814
+ onMounted(() => this.focusDefaultElement());
22815
+ this.props.exposeFocus(() => this.focusDefaultElement());
22775
22816
  useGridDrawing("canvas", this.env.model, () => this.env.model.getters.getSheetViewDimensionWithHeaders());
22776
- useEffect(() => this.focus(), () => [this.env.model.getters.getActiveSheetId()]);
22817
+ useEffect(() => this.focusDefaultElement(), () => [this.env.model.getters.getActiveSheetId()]);
22777
22818
  this.onMouseWheel = useWheelHandler((deltaX, deltaY) => {
22778
22819
  this.moveCanvas(deltaX, deltaY);
22779
22820
  this.hoveredCell.col = undefined;
@@ -22788,19 +22829,18 @@ class Grid extends Component {
22788
22829
  return `
22789
22830
  top: ${HEADER_HEIGHT}px;
22790
22831
  left: ${HEADER_WIDTH}px;
22791
- height: calc(100% - ${HEADER_HEIGHT + SCROLLBAR_WIDTH$1}px);
22792
- 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);
22793
22834
  `;
22794
22835
  }
22795
22836
  onClosePopover() {
22796
22837
  this.closeOpenedPopover();
22797
- this.focus();
22838
+ this.focusDefaultElement();
22798
22839
  }
22799
- focus() {
22800
- var _a;
22840
+ focusDefaultElement() {
22801
22841
  if (!this.env.model.getters.getSelectedFigureId() &&
22802
22842
  this.env.model.getters.getEditionMode() === "inactive") {
22803
- (_a = this.hiddenInput.el) === null || _a === void 0 ? void 0 : _a.focus();
22843
+ this.env.focusableElement.focus();
22804
22844
  }
22805
22845
  }
22806
22846
  get gridEl() {
@@ -22949,19 +22989,6 @@ class Grid extends Component {
22949
22989
  return;
22950
22990
  }
22951
22991
  }
22952
- onInput(ev) {
22953
- // the user meant to paste in the sheet, not open the composer with the pasted content
22954
- if (!ev.isComposing && ev.inputType === "insertFromPaste") {
22955
- return;
22956
- }
22957
- if (ev.data) {
22958
- // if the user types a character on the grid, it means he wants to start composing the selected cell with that
22959
- // character
22960
- ev.preventDefault();
22961
- ev.stopPropagation();
22962
- this.props.onGridComposerCellFocused(ev.data);
22963
- }
22964
- }
22965
22992
  // ---------------------------------------------------------------------------
22966
22993
  // Context Menu
22967
22994
  // ---------------------------------------------------------------------------
@@ -23042,7 +23069,7 @@ class Grid extends Component {
23042
23069
  }
23043
23070
  closeMenu() {
23044
23071
  this.menuState.isOpen = false;
23045
- this.focus();
23072
+ this.focusDefaultElement();
23046
23073
  }
23047
23074
  }
23048
23075
  Grid.template = "o-spreadsheet-Grid";
@@ -26738,7 +26765,7 @@ function normalizeV9(formula) {
26738
26765
  * a breaking change is made in the way the state is handled, and an upgrade
26739
26766
  * function should be defined
26740
26767
  */
26741
- const CURRENT_VERSION = 12;
26768
+ const CURRENT_VERSION = 12.5;
26742
26769
  const INITIAL_SHEET_ID = "Sheet1";
26743
26770
  /**
26744
26771
  * This function tries to load anything that could look like a valid
@@ -27004,6 +27031,31 @@ const MIGRATIONS = [
27004
27031
  return data;
27005
27032
  },
27006
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
+ },
27007
27059
  ];
27008
27060
  /**
27009
27061
  * This function is used to repair faulty data independently of the migration.
@@ -27899,9 +27951,6 @@ class CellPlugin extends CorePlugin {
27899
27951
  format: cell.format ? getItemId(cell.format, formats) : undefined,
27900
27952
  content: cell.content || undefined,
27901
27953
  };
27902
- if (cell.isFormula()) {
27903
- cells[xc].content = this.buildFormulaContent(_sheet.id, cell, cell.dependencies, true);
27904
- }
27905
27954
  }
27906
27955
  _sheet.cells = cells;
27907
27956
  }
@@ -27924,6 +27973,9 @@ class CellPlugin extends CorePlugin {
27924
27973
  const exportedCellData = sheet.cells[xc];
27925
27974
  exportedCellData.value = cell.evaluated.value;
27926
27975
  exportedCellData.isFormula = cell.isFormula();
27976
+ if (cell.isFormula()) {
27977
+ exportedCellData.content = this.buildFormulaContent(sheet.id, cell, cell.dependencies, true);
27978
+ }
27927
27979
  if (cell.format !== cell.evaluated.format) {
27928
27980
  exportedCellData.computedFormat = cell.evaluated.format;
27929
27981
  }
@@ -35366,9 +35418,6 @@ class SelectionInputPlugin extends UIPlugin {
35366
35418
  }
35367
35419
  }
35368
35420
  }
35369
- unsubscribe() {
35370
- this.unfocus();
35371
- }
35372
35421
  // ---------------------------------------------------------------------------
35373
35422
  // Getters || only callable by the parent
35374
35423
  // ---------------------------------------------------------------------------
@@ -35580,9 +35629,6 @@ class SelectionInputsManagerPlugin extends UIPlugin {
35580
35629
  }
35581
35630
  (_a = this.currentInput) === null || _a === void 0 ? void 0 : _a.handle(cmd);
35582
35631
  }
35583
- unsubscribe() {
35584
- this.unfocus();
35585
- }
35586
35632
  // ---------------------------------------------------------------------------
35587
35633
  // Getters
35588
35634
  // ---------------------------------------------------------------------------
@@ -37981,6 +38027,19 @@ clickableCellRegistry.add("link", {
37981
38027
  sequence: 5,
37982
38028
  });
37983
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
+
37984
38043
  // -----------------------------------------------------------------------------
37985
38044
  // SpreadSheet
37986
38045
  // -----------------------------------------------------------------------------
@@ -39124,8 +39183,8 @@ css /* scss */ `
39124
39183
  &.corner {
39125
39184
  right: 0px;
39126
39185
  bottom: 0px;
39127
- height: ${SCROLLBAR_WIDTH$1}px;
39128
- width: ${SCROLLBAR_WIDTH$1}px;
39186
+ height: ${SCROLLBAR_WIDTH}px;
39187
+ width: ${SCROLLBAR_WIDTH}px;
39129
39188
  border-top: 1px solid #e2e3e3;
39130
39189
  border-left: 1px solid #e2e3e3;
39131
39190
  }
@@ -39169,6 +39228,7 @@ class Spreadsheet extends Component {
39169
39228
  toggleSidePanel: this.toggleSidePanel.bind(this),
39170
39229
  _t: Spreadsheet._t,
39171
39230
  clipboard: navigator.clipboard,
39231
+ focusableElement: new FocusableElement(),
39172
39232
  });
39173
39233
  useExternalListener(window, "resize", () => this.render(true));
39174
39234
  useExternalListener(window, "beforeunload", this.unbindModelEvents.bind(this));
@@ -39271,17 +39331,18 @@ class Spreadsheet extends Component {
39271
39331
  this.model.dispatch("UNFOCUS_SELECTION_INPUT");
39272
39332
  this.composer.topBarFocus = "contentFocus";
39273
39333
  this.composer.gridFocusMode = "inactive";
39274
- this.setComposerContent({ selection } || {});
39334
+ this.setComposerContent({ selection });
39275
39335
  }
39276
- onGridComposerContentFocused() {
39336
+ onGridComposerContentFocused(selection) {
39277
39337
  if (this.model.getters.isReadonly()) {
39278
39338
  return;
39279
39339
  }
39280
39340
  this.model.dispatch("UNFOCUS_SELECTION_INPUT");
39281
39341
  this.composer.topBarFocus = "inactive";
39282
39342
  this.composer.gridFocusMode = "contentFocus";
39283
- this.setComposerContent({});
39343
+ this.setComposerContent({ selection });
39284
39344
  }
39345
+ // TODO: either both are defined or none of them. change those args to an object
39285
39346
  onGridComposerCellFocused(content, selection) {
39286
39347
  if (this.model.getters.isReadonly()) {
39287
39348
  return;
@@ -40654,18 +40715,17 @@ class EventStream {
40654
40715
  if (this.observers.find((sub) => sub.owner === owner)) {
40655
40716
  throw new Error("You are already subscribed forever");
40656
40717
  }
40657
- 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) {
40658
40719
  (_c = (_b = this.mainSubscription.callbacks).release) === null || _c === void 0 ? void 0 : _c.call(_b);
40659
40720
  }
40660
40721
  this.mainSubscription = { owner, callbacks };
40661
40722
  }
40662
40723
  release(owner) {
40663
- var _a, _b, _c, _d;
40724
+ var _a;
40664
40725
  if (((_a = this.mainSubscription) === null || _a === void 0 ? void 0 : _a.owner) !== owner ||
40665
40726
  this.observers.find((sub) => sub.owner === owner)) {
40666
40727
  return;
40667
40728
  }
40668
- (_d = (_b = this.mainSubscription) === null || _b === void 0 ? void 0 : (_c = _b.callbacks).release) === null || _d === void 0 ? void 0 : _d.call(_c);
40669
40729
  this.mainSubscription = this.defaultSubscription;
40670
40730
  }
40671
40731
  /**
@@ -43084,7 +43144,7 @@ const SPREADSHEET_DIMENSIONS = {
43084
43144
  BOTTOMBAR_HEIGHT,
43085
43145
  DEFAULT_CELL_WIDTH,
43086
43146
  DEFAULT_CELL_HEIGHT,
43087
- SCROLLBAR_WIDTH: SCROLLBAR_WIDTH$1,
43147
+ SCROLLBAR_WIDTH,
43088
43148
  };
43089
43149
  const registries = {
43090
43150
  autofillModifiersRegistry,
@@ -43167,6 +43227,6 @@ function addFunction(functionName, functionDescription) {
43167
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 };
43168
43228
 
43169
43229
 
43170
- __info__.version = '16.0.31';
43171
- __info__.date = '2024-02-02T13:44:18.740Z';
43172
- __info__.hash = 'a2e40a9';
43230
+ __info__.version = '16.0.32';
43231
+ __info__.date = '2024-02-09T13:05:36.074Z';
43232
+ __info__.hash = '452dce2';