@odoo/o-spreadsheet 18.1.15 → 18.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 18.1.15
6
- * @date 2025-04-14T17:17:30.890Z
7
- * @hash ddaea83
5
+ * @version 18.1.16
6
+ * @date 2025-04-18T16:24:16.854Z
7
+ * @hash 19f6de2
8
8
  */
9
9
 
10
10
  'use strict';
@@ -6891,6 +6891,12 @@ function tokenizeString(chars) {
6891
6891
  }
6892
6892
  return null;
6893
6893
  }
6894
+ /**
6895
+ - \p{L} is for any letter (from any language)
6896
+ - \p{N} is for any number
6897
+ - the u flag at the end is for unicode, which enables the `\p{...}` syntax
6898
+ */
6899
+ const unicodeSymbolCharRegexp = /\p{L}|\p{N}|_|\.|!|\$/u;
6894
6900
  const SYMBOL_CHARS = new Set("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.!$");
6895
6901
  /**
6896
6902
  * A "Symbol" is just basically any word-like element that can appear in a
@@ -6931,7 +6937,8 @@ function tokenizeSymbol(chars) {
6931
6937
  };
6932
6938
  }
6933
6939
  }
6934
- while (chars.current && SYMBOL_CHARS.has(chars.current)) {
6940
+ while (chars.current &&
6941
+ (SYMBOL_CHARS.has(chars.current) || chars.current.match(unicodeSymbolCharRegexp))) {
6935
6942
  result += chars.shift();
6936
6943
  }
6937
6944
  if (result.length) {
@@ -9237,7 +9244,7 @@ function transformZone(zone, executed) {
9237
9244
  if (executed.type === "ADD_COLUMNS_ROWS") {
9238
9245
  return expandZoneOnInsertion(zone, executed.dimension === "COL" ? "left" : "top", executed.base, executed.position, executed.quantity);
9239
9246
  }
9240
- return { ...zone };
9247
+ return zone;
9241
9248
  }
9242
9249
  function transformRangeData(range, executed) {
9243
9250
  const deletedSheet = executed.type === "DELETE_SHEET" && executed.sheetId;
@@ -50107,39 +50114,6 @@ function useCellHovered(env, gridRef, callback) {
50107
50114
  }
50108
50115
  return hoveredPosition;
50109
50116
  }
50110
- function useTouchMove(gridRef, handler, canMoveUp) {
50111
- let x = null;
50112
- let y = null;
50113
- function onTouchStart(ev) {
50114
- if (ev.touches.length !== 1)
50115
- return;
50116
- x = ev.touches[0].clientX;
50117
- y = ev.touches[0].clientY;
50118
- }
50119
- function onTouchEnd() {
50120
- x = null;
50121
- y = null;
50122
- }
50123
- function onTouchMove(ev) {
50124
- if (ev.touches.length !== 1)
50125
- return;
50126
- // On mobile browsers, swiping down is often associated with "pull to refresh".
50127
- // We only want this behavior if the grid is already at the top.
50128
- // Otherwise we only want to move the canvas up, without triggering any refresh.
50129
- if (canMoveUp()) {
50130
- ev.preventDefault();
50131
- ev.stopPropagation();
50132
- }
50133
- const currentX = ev.touches[0].clientX;
50134
- const currentY = ev.touches[0].clientY;
50135
- handler(x - currentX, y - currentY);
50136
- x = currentX;
50137
- y = currentY;
50138
- }
50139
- useRefListener(gridRef, "touchstart", onTouchStart);
50140
- useRefListener(gridRef, "touchend", onTouchEnd);
50141
- useRefListener(gridRef, "touchmove", onTouchMove);
50142
- }
50143
50117
  class GridOverlay extends owl.Component {
50144
50118
  static template = "o-spreadsheet-GridOverlay";
50145
50119
  static props = {
@@ -50187,10 +50161,6 @@ class GridOverlay extends owl.Component {
50187
50161
  owl.onWillUnmount(() => {
50188
50162
  resizeObserver.disconnect();
50189
50163
  });
50190
- useTouchMove(this.gridOverlay, this.props.onGridMoved, () => {
50191
- const { scrollY } = this.env.model.getters.getActiveSheetDOMScrollInfo();
50192
- return scrollY > 0;
50193
- });
50194
50164
  this.cellPopovers = useStore(CellPopoverStore);
50195
50165
  this.paintFormatStore = useStore(PaintFormatStore);
50196
50166
  }
@@ -51548,6 +51518,73 @@ function useGridDrawing(refName, model, canvasSize) {
51548
51518
  }
51549
51519
  }
51550
51520
 
51521
+ const friction = 0.95;
51522
+ const verticalScrollFactor = 1;
51523
+ const horizontalScrollFactor = 1;
51524
+ function useTouchScroll(ref, updateScroll, canMoveUp) {
51525
+ let lastX = 0;
51526
+ let lastY = 0;
51527
+ let velocityX = 0;
51528
+ let velocityY = 0;
51529
+ let isMouseDown = false;
51530
+ let lastTime = 0;
51531
+ useRefListener(ref, "touchstart", onTouchStart, { capture: false });
51532
+ useRefListener(ref, "touchmove", onTouchMove, { capture: false });
51533
+ useRefListener(ref, "touchend", onTouchEnd, { capture: false });
51534
+ function onTouchStart(event) {
51535
+ isMouseDown = true;
51536
+ ({ clientX: lastX, clientY: lastY } = event.touches[0]);
51537
+ velocityX = 0;
51538
+ velocityY = 0;
51539
+ }
51540
+ function onTouchMove(event) {
51541
+ if (!isMouseDown)
51542
+ return;
51543
+ const currentTime = Date.now();
51544
+ const { clientX, clientY } = event.touches[0];
51545
+ let deltaX = lastX - clientX;
51546
+ let deltaY = lastY - clientY;
51547
+ const elapsedTime = currentTime - lastTime;
51548
+ velocityX = deltaX / elapsedTime;
51549
+ velocityY = deltaY / elapsedTime;
51550
+ lastX = clientX;
51551
+ lastY = clientY;
51552
+ lastTime = currentTime;
51553
+ if (canMoveUp()) {
51554
+ if (event.cancelable) {
51555
+ event.preventDefault();
51556
+ }
51557
+ event.stopPropagation();
51558
+ }
51559
+ updateScroll(deltaX * horizontalScrollFactor, deltaY * verticalScrollFactor);
51560
+ }
51561
+ function onTouchEnd(ev) {
51562
+ isMouseDown = false;
51563
+ lastX = lastY = 0;
51564
+ requestAnimationFrame(scroll);
51565
+ }
51566
+ function scroll() {
51567
+ if (Math.abs(velocityX) < 0.05) {
51568
+ velocityX = 0;
51569
+ }
51570
+ if (Math.abs(velocityY) < 0.05) {
51571
+ velocityY = 0;
51572
+ }
51573
+ if (!velocityX && !velocityY) {
51574
+ return;
51575
+ }
51576
+ const currentTime = Date.now();
51577
+ const elapsedTime = Math.abs(currentTime - lastTime);
51578
+ const deltaX = velocityX * elapsedTime;
51579
+ const deltaY = velocityY * elapsedTime;
51580
+ updateScroll(deltaX * horizontalScrollFactor, deltaY * verticalScrollFactor);
51581
+ lastTime = currentTime;
51582
+ velocityX *= friction;
51583
+ velocityY *= friction;
51584
+ requestAnimationFrame(scroll);
51585
+ }
51586
+ }
51587
+
51551
51588
  function useWheelHandler(handler) {
51552
51589
  function normalize(val, deltaMode) {
51553
51590
  return val * (deltaMode === 0 ? 1 : DEFAULT_CELL_HEIGHT);
@@ -52168,6 +52205,10 @@ class Grid extends owl.Component {
52168
52205
  this.DOMFocusableElementStore.focusableElement?.focus();
52169
52206
  }
52170
52207
  }, () => [this.sidePanel.isOpen]);
52208
+ useTouchScroll(this.gridRef, this.moveCanvas.bind(this), () => {
52209
+ const { scrollY } = this.env.model.getters.getActiveSheetScrollInfo();
52210
+ return scrollY > 0;
52211
+ });
52171
52212
  }
52172
52213
  onCellHovered({ col, row }) {
52173
52214
  this.hoveredCell.hover({ col, row });
@@ -63377,10 +63418,8 @@ function mergeTransformation(toTransform, executed) {
63377
63418
  }
63378
63419
  const target = [];
63379
63420
  for (const zone1 of toTransform.target) {
63380
- for (const zone2 of executed.target) {
63381
- if (!overlap(zone1, zone2)) {
63382
- target.push({ ...zone1 });
63383
- }
63421
+ if (executed.target.every((zone2) => !overlap(zone1, zone2))) {
63422
+ target.push(zone1);
63384
63423
  }
63385
63424
  }
63386
63425
  if (target.length) {
@@ -69652,6 +69691,10 @@ class SpreadsheetDashboard extends owl.Component {
69652
69691
  this.hoveredCell.clear();
69653
69692
  });
69654
69693
  this.cellPopovers = useStore(CellPopoverStore);
69694
+ useTouchScroll(gridRef, this.moveCanvas.bind(this), () => {
69695
+ const { scrollY } = this.env.model.getters.getActiveSheetScrollInfo();
69696
+ return scrollY > 0;
69697
+ });
69655
69698
  }
69656
69699
  onCellHovered({ col, row }) {
69657
69700
  this.hoveredCell.hover({ col, row });
@@ -75726,6 +75769,6 @@ exports.tokenColors = tokenColors;
75726
75769
  exports.tokenize = tokenize;
75727
75770
 
75728
75771
 
75729
- __info__.version = "18.1.15";
75730
- __info__.date = "2025-04-14T17:17:30.890Z";
75731
- __info__.hash = "ddaea83";
75772
+ __info__.version = "18.1.16";
75773
+ __info__.date = "2025-04-18T16:24:16.854Z";
75774
+ __info__.hash = "19f6de2";
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 18.1.15
6
- * @date 2025-04-14T17:17:30.890Z
7
- * @hash ddaea83
5
+ * @version 18.1.16
6
+ * @date 2025-04-18T16:24:16.854Z
7
+ * @hash 19f6de2
8
8
  */
9
9
 
10
10
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -6889,6 +6889,12 @@ function tokenizeString(chars) {
6889
6889
  }
6890
6890
  return null;
6891
6891
  }
6892
+ /**
6893
+ - \p{L} is for any letter (from any language)
6894
+ - \p{N} is for any number
6895
+ - the u flag at the end is for unicode, which enables the `\p{...}` syntax
6896
+ */
6897
+ const unicodeSymbolCharRegexp = /\p{L}|\p{N}|_|\.|!|\$/u;
6892
6898
  const SYMBOL_CHARS = new Set("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.!$");
6893
6899
  /**
6894
6900
  * A "Symbol" is just basically any word-like element that can appear in a
@@ -6929,7 +6935,8 @@ function tokenizeSymbol(chars) {
6929
6935
  };
6930
6936
  }
6931
6937
  }
6932
- while (chars.current && SYMBOL_CHARS.has(chars.current)) {
6938
+ while (chars.current &&
6939
+ (SYMBOL_CHARS.has(chars.current) || chars.current.match(unicodeSymbolCharRegexp))) {
6933
6940
  result += chars.shift();
6934
6941
  }
6935
6942
  if (result.length) {
@@ -9235,7 +9242,7 @@ function transformZone(zone, executed) {
9235
9242
  if (executed.type === "ADD_COLUMNS_ROWS") {
9236
9243
  return expandZoneOnInsertion(zone, executed.dimension === "COL" ? "left" : "top", executed.base, executed.position, executed.quantity);
9237
9244
  }
9238
- return { ...zone };
9245
+ return zone;
9239
9246
  }
9240
9247
  function transformRangeData(range, executed) {
9241
9248
  const deletedSheet = executed.type === "DELETE_SHEET" && executed.sheetId;
@@ -50105,39 +50112,6 @@ function useCellHovered(env, gridRef, callback) {
50105
50112
  }
50106
50113
  return hoveredPosition;
50107
50114
  }
50108
- function useTouchMove(gridRef, handler, canMoveUp) {
50109
- let x = null;
50110
- let y = null;
50111
- function onTouchStart(ev) {
50112
- if (ev.touches.length !== 1)
50113
- return;
50114
- x = ev.touches[0].clientX;
50115
- y = ev.touches[0].clientY;
50116
- }
50117
- function onTouchEnd() {
50118
- x = null;
50119
- y = null;
50120
- }
50121
- function onTouchMove(ev) {
50122
- if (ev.touches.length !== 1)
50123
- return;
50124
- // On mobile browsers, swiping down is often associated with "pull to refresh".
50125
- // We only want this behavior if the grid is already at the top.
50126
- // Otherwise we only want to move the canvas up, without triggering any refresh.
50127
- if (canMoveUp()) {
50128
- ev.preventDefault();
50129
- ev.stopPropagation();
50130
- }
50131
- const currentX = ev.touches[0].clientX;
50132
- const currentY = ev.touches[0].clientY;
50133
- handler(x - currentX, y - currentY);
50134
- x = currentX;
50135
- y = currentY;
50136
- }
50137
- useRefListener(gridRef, "touchstart", onTouchStart);
50138
- useRefListener(gridRef, "touchend", onTouchEnd);
50139
- useRefListener(gridRef, "touchmove", onTouchMove);
50140
- }
50141
50115
  class GridOverlay extends Component {
50142
50116
  static template = "o-spreadsheet-GridOverlay";
50143
50117
  static props = {
@@ -50185,10 +50159,6 @@ class GridOverlay extends Component {
50185
50159
  onWillUnmount(() => {
50186
50160
  resizeObserver.disconnect();
50187
50161
  });
50188
- useTouchMove(this.gridOverlay, this.props.onGridMoved, () => {
50189
- const { scrollY } = this.env.model.getters.getActiveSheetDOMScrollInfo();
50190
- return scrollY > 0;
50191
- });
50192
50162
  this.cellPopovers = useStore(CellPopoverStore);
50193
50163
  this.paintFormatStore = useStore(PaintFormatStore);
50194
50164
  }
@@ -51546,6 +51516,73 @@ function useGridDrawing(refName, model, canvasSize) {
51546
51516
  }
51547
51517
  }
51548
51518
 
51519
+ const friction = 0.95;
51520
+ const verticalScrollFactor = 1;
51521
+ const horizontalScrollFactor = 1;
51522
+ function useTouchScroll(ref, updateScroll, canMoveUp) {
51523
+ let lastX = 0;
51524
+ let lastY = 0;
51525
+ let velocityX = 0;
51526
+ let velocityY = 0;
51527
+ let isMouseDown = false;
51528
+ let lastTime = 0;
51529
+ useRefListener(ref, "touchstart", onTouchStart, { capture: false });
51530
+ useRefListener(ref, "touchmove", onTouchMove, { capture: false });
51531
+ useRefListener(ref, "touchend", onTouchEnd, { capture: false });
51532
+ function onTouchStart(event) {
51533
+ isMouseDown = true;
51534
+ ({ clientX: lastX, clientY: lastY } = event.touches[0]);
51535
+ velocityX = 0;
51536
+ velocityY = 0;
51537
+ }
51538
+ function onTouchMove(event) {
51539
+ if (!isMouseDown)
51540
+ return;
51541
+ const currentTime = Date.now();
51542
+ const { clientX, clientY } = event.touches[0];
51543
+ let deltaX = lastX - clientX;
51544
+ let deltaY = lastY - clientY;
51545
+ const elapsedTime = currentTime - lastTime;
51546
+ velocityX = deltaX / elapsedTime;
51547
+ velocityY = deltaY / elapsedTime;
51548
+ lastX = clientX;
51549
+ lastY = clientY;
51550
+ lastTime = currentTime;
51551
+ if (canMoveUp()) {
51552
+ if (event.cancelable) {
51553
+ event.preventDefault();
51554
+ }
51555
+ event.stopPropagation();
51556
+ }
51557
+ updateScroll(deltaX * horizontalScrollFactor, deltaY * verticalScrollFactor);
51558
+ }
51559
+ function onTouchEnd(ev) {
51560
+ isMouseDown = false;
51561
+ lastX = lastY = 0;
51562
+ requestAnimationFrame(scroll);
51563
+ }
51564
+ function scroll() {
51565
+ if (Math.abs(velocityX) < 0.05) {
51566
+ velocityX = 0;
51567
+ }
51568
+ if (Math.abs(velocityY) < 0.05) {
51569
+ velocityY = 0;
51570
+ }
51571
+ if (!velocityX && !velocityY) {
51572
+ return;
51573
+ }
51574
+ const currentTime = Date.now();
51575
+ const elapsedTime = Math.abs(currentTime - lastTime);
51576
+ const deltaX = velocityX * elapsedTime;
51577
+ const deltaY = velocityY * elapsedTime;
51578
+ updateScroll(deltaX * horizontalScrollFactor, deltaY * verticalScrollFactor);
51579
+ lastTime = currentTime;
51580
+ velocityX *= friction;
51581
+ velocityY *= friction;
51582
+ requestAnimationFrame(scroll);
51583
+ }
51584
+ }
51585
+
51549
51586
  function useWheelHandler(handler) {
51550
51587
  function normalize(val, deltaMode) {
51551
51588
  return val * (deltaMode === 0 ? 1 : DEFAULT_CELL_HEIGHT);
@@ -52166,6 +52203,10 @@ class Grid extends Component {
52166
52203
  this.DOMFocusableElementStore.focusableElement?.focus();
52167
52204
  }
52168
52205
  }, () => [this.sidePanel.isOpen]);
52206
+ useTouchScroll(this.gridRef, this.moveCanvas.bind(this), () => {
52207
+ const { scrollY } = this.env.model.getters.getActiveSheetScrollInfo();
52208
+ return scrollY > 0;
52209
+ });
52169
52210
  }
52170
52211
  onCellHovered({ col, row }) {
52171
52212
  this.hoveredCell.hover({ col, row });
@@ -63375,10 +63416,8 @@ function mergeTransformation(toTransform, executed) {
63375
63416
  }
63376
63417
  const target = [];
63377
63418
  for (const zone1 of toTransform.target) {
63378
- for (const zone2 of executed.target) {
63379
- if (!overlap(zone1, zone2)) {
63380
- target.push({ ...zone1 });
63381
- }
63419
+ if (executed.target.every((zone2) => !overlap(zone1, zone2))) {
63420
+ target.push(zone1);
63382
63421
  }
63383
63422
  }
63384
63423
  if (target.length) {
@@ -69650,6 +69689,10 @@ class SpreadsheetDashboard extends Component {
69650
69689
  this.hoveredCell.clear();
69651
69690
  });
69652
69691
  this.cellPopovers = useStore(CellPopoverStore);
69692
+ useTouchScroll(gridRef, this.moveCanvas.bind(this), () => {
69693
+ const { scrollY } = this.env.model.getters.getActiveSheetScrollInfo();
69694
+ return scrollY > 0;
69695
+ });
69653
69696
  }
69654
69697
  onCellHovered({ col, row }) {
69655
69698
  this.hoveredCell.hover({ col, row });
@@ -75680,6 +75723,6 @@ const chartHelpers = { ...CHART_HELPERS, ...CHART_RUNTIME_HELPERS };
75680
75723
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, chartHelpers, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
75681
75724
 
75682
75725
 
75683
- __info__.version = "18.1.15";
75684
- __info__.date = "2025-04-14T17:17:30.890Z";
75685
- __info__.hash = "ddaea83";
75726
+ __info__.version = "18.1.16";
75727
+ __info__.date = "2025-04-18T16:24:16.854Z";
75728
+ __info__.hash = "19f6de2";
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 18.1.15
6
- * @date 2025-04-14T17:17:30.890Z
7
- * @hash ddaea83
5
+ * @version 18.1.16
6
+ * @date 2025-04-18T16:24:16.854Z
7
+ * @hash 19f6de2
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -6890,6 +6890,12 @@
6890
6890
  }
6891
6891
  return null;
6892
6892
  }
6893
+ /**
6894
+ - \p{L} is for any letter (from any language)
6895
+ - \p{N} is for any number
6896
+ - the u flag at the end is for unicode, which enables the `\p{...}` syntax
6897
+ */
6898
+ const unicodeSymbolCharRegexp = /\p{L}|\p{N}|_|\.|!|\$/u;
6893
6899
  const SYMBOL_CHARS = new Set("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.!$");
6894
6900
  /**
6895
6901
  * A "Symbol" is just basically any word-like element that can appear in a
@@ -6930,7 +6936,8 @@
6930
6936
  };
6931
6937
  }
6932
6938
  }
6933
- while (chars.current && SYMBOL_CHARS.has(chars.current)) {
6939
+ while (chars.current &&
6940
+ (SYMBOL_CHARS.has(chars.current) || chars.current.match(unicodeSymbolCharRegexp))) {
6934
6941
  result += chars.shift();
6935
6942
  }
6936
6943
  if (result.length) {
@@ -9236,7 +9243,7 @@
9236
9243
  if (executed.type === "ADD_COLUMNS_ROWS") {
9237
9244
  return expandZoneOnInsertion(zone, executed.dimension === "COL" ? "left" : "top", executed.base, executed.position, executed.quantity);
9238
9245
  }
9239
- return { ...zone };
9246
+ return zone;
9240
9247
  }
9241
9248
  function transformRangeData(range, executed) {
9242
9249
  const deletedSheet = executed.type === "DELETE_SHEET" && executed.sheetId;
@@ -50106,39 +50113,6 @@ stores.inject(MyMetaStore, storeInstance);
50106
50113
  }
50107
50114
  return hoveredPosition;
50108
50115
  }
50109
- function useTouchMove(gridRef, handler, canMoveUp) {
50110
- let x = null;
50111
- let y = null;
50112
- function onTouchStart(ev) {
50113
- if (ev.touches.length !== 1)
50114
- return;
50115
- x = ev.touches[0].clientX;
50116
- y = ev.touches[0].clientY;
50117
- }
50118
- function onTouchEnd() {
50119
- x = null;
50120
- y = null;
50121
- }
50122
- function onTouchMove(ev) {
50123
- if (ev.touches.length !== 1)
50124
- return;
50125
- // On mobile browsers, swiping down is often associated with "pull to refresh".
50126
- // We only want this behavior if the grid is already at the top.
50127
- // Otherwise we only want to move the canvas up, without triggering any refresh.
50128
- if (canMoveUp()) {
50129
- ev.preventDefault();
50130
- ev.stopPropagation();
50131
- }
50132
- const currentX = ev.touches[0].clientX;
50133
- const currentY = ev.touches[0].clientY;
50134
- handler(x - currentX, y - currentY);
50135
- x = currentX;
50136
- y = currentY;
50137
- }
50138
- useRefListener(gridRef, "touchstart", onTouchStart);
50139
- useRefListener(gridRef, "touchend", onTouchEnd);
50140
- useRefListener(gridRef, "touchmove", onTouchMove);
50141
- }
50142
50116
  class GridOverlay extends owl.Component {
50143
50117
  static template = "o-spreadsheet-GridOverlay";
50144
50118
  static props = {
@@ -50186,10 +50160,6 @@ stores.inject(MyMetaStore, storeInstance);
50186
50160
  owl.onWillUnmount(() => {
50187
50161
  resizeObserver.disconnect();
50188
50162
  });
50189
- useTouchMove(this.gridOverlay, this.props.onGridMoved, () => {
50190
- const { scrollY } = this.env.model.getters.getActiveSheetDOMScrollInfo();
50191
- return scrollY > 0;
50192
- });
50193
50163
  this.cellPopovers = useStore(CellPopoverStore);
50194
50164
  this.paintFormatStore = useStore(PaintFormatStore);
50195
50165
  }
@@ -51547,6 +51517,73 @@ stores.inject(MyMetaStore, storeInstance);
51547
51517
  }
51548
51518
  }
51549
51519
 
51520
+ const friction = 0.95;
51521
+ const verticalScrollFactor = 1;
51522
+ const horizontalScrollFactor = 1;
51523
+ function useTouchScroll(ref, updateScroll, canMoveUp) {
51524
+ let lastX = 0;
51525
+ let lastY = 0;
51526
+ let velocityX = 0;
51527
+ let velocityY = 0;
51528
+ let isMouseDown = false;
51529
+ let lastTime = 0;
51530
+ useRefListener(ref, "touchstart", onTouchStart, { capture: false });
51531
+ useRefListener(ref, "touchmove", onTouchMove, { capture: false });
51532
+ useRefListener(ref, "touchend", onTouchEnd, { capture: false });
51533
+ function onTouchStart(event) {
51534
+ isMouseDown = true;
51535
+ ({ clientX: lastX, clientY: lastY } = event.touches[0]);
51536
+ velocityX = 0;
51537
+ velocityY = 0;
51538
+ }
51539
+ function onTouchMove(event) {
51540
+ if (!isMouseDown)
51541
+ return;
51542
+ const currentTime = Date.now();
51543
+ const { clientX, clientY } = event.touches[0];
51544
+ let deltaX = lastX - clientX;
51545
+ let deltaY = lastY - clientY;
51546
+ const elapsedTime = currentTime - lastTime;
51547
+ velocityX = deltaX / elapsedTime;
51548
+ velocityY = deltaY / elapsedTime;
51549
+ lastX = clientX;
51550
+ lastY = clientY;
51551
+ lastTime = currentTime;
51552
+ if (canMoveUp()) {
51553
+ if (event.cancelable) {
51554
+ event.preventDefault();
51555
+ }
51556
+ event.stopPropagation();
51557
+ }
51558
+ updateScroll(deltaX * horizontalScrollFactor, deltaY * verticalScrollFactor);
51559
+ }
51560
+ function onTouchEnd(ev) {
51561
+ isMouseDown = false;
51562
+ lastX = lastY = 0;
51563
+ requestAnimationFrame(scroll);
51564
+ }
51565
+ function scroll() {
51566
+ if (Math.abs(velocityX) < 0.05) {
51567
+ velocityX = 0;
51568
+ }
51569
+ if (Math.abs(velocityY) < 0.05) {
51570
+ velocityY = 0;
51571
+ }
51572
+ if (!velocityX && !velocityY) {
51573
+ return;
51574
+ }
51575
+ const currentTime = Date.now();
51576
+ const elapsedTime = Math.abs(currentTime - lastTime);
51577
+ const deltaX = velocityX * elapsedTime;
51578
+ const deltaY = velocityY * elapsedTime;
51579
+ updateScroll(deltaX * horizontalScrollFactor, deltaY * verticalScrollFactor);
51580
+ lastTime = currentTime;
51581
+ velocityX *= friction;
51582
+ velocityY *= friction;
51583
+ requestAnimationFrame(scroll);
51584
+ }
51585
+ }
51586
+
51550
51587
  function useWheelHandler(handler) {
51551
51588
  function normalize(val, deltaMode) {
51552
51589
  return val * (deltaMode === 0 ? 1 : DEFAULT_CELL_HEIGHT);
@@ -52167,6 +52204,10 @@ stores.inject(MyMetaStore, storeInstance);
52167
52204
  this.DOMFocusableElementStore.focusableElement?.focus();
52168
52205
  }
52169
52206
  }, () => [this.sidePanel.isOpen]);
52207
+ useTouchScroll(this.gridRef, this.moveCanvas.bind(this), () => {
52208
+ const { scrollY } = this.env.model.getters.getActiveSheetScrollInfo();
52209
+ return scrollY > 0;
52210
+ });
52170
52211
  }
52171
52212
  onCellHovered({ col, row }) {
52172
52213
  this.hoveredCell.hover({ col, row });
@@ -63376,10 +63417,8 @@ stores.inject(MyMetaStore, storeInstance);
63376
63417
  }
63377
63418
  const target = [];
63378
63419
  for (const zone1 of toTransform.target) {
63379
- for (const zone2 of executed.target) {
63380
- if (!overlap(zone1, zone2)) {
63381
- target.push({ ...zone1 });
63382
- }
63420
+ if (executed.target.every((zone2) => !overlap(zone1, zone2))) {
63421
+ target.push(zone1);
63383
63422
  }
63384
63423
  }
63385
63424
  if (target.length) {
@@ -69651,6 +69690,10 @@ stores.inject(MyMetaStore, storeInstance);
69651
69690
  this.hoveredCell.clear();
69652
69691
  });
69653
69692
  this.cellPopovers = useStore(CellPopoverStore);
69693
+ useTouchScroll(gridRef, this.moveCanvas.bind(this), () => {
69694
+ const { scrollY } = this.env.model.getters.getActiveSheetScrollInfo();
69695
+ return scrollY > 0;
69696
+ });
69654
69697
  }
69655
69698
  onCellHovered({ col, row }) {
69656
69699
  this.hoveredCell.hover({ col, row });
@@ -75725,9 +75768,9 @@ stores.inject(MyMetaStore, storeInstance);
75725
75768
  exports.tokenize = tokenize;
75726
75769
 
75727
75770
 
75728
- __info__.version = "18.1.15";
75729
- __info__.date = "2025-04-14T17:17:30.890Z";
75730
- __info__.hash = "ddaea83";
75771
+ __info__.version = "18.1.16";
75772
+ __info__.date = "2025-04-18T16:24:16.854Z";
75773
+ __info__.hash = "19f6de2";
75731
75774
 
75732
75775
 
75733
75776
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);