@odoo/o-spreadsheet 16.3.12 → 16.3.13

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.
@@ -314,7 +314,16 @@ const DATE_JS_1900_OFFSET = INITIAL_JS_DAY - INITIAL_1900_DAY;
314
314
  const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
315
315
  const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
316
316
  const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
317
+ const CACHE = {};
317
318
  function parseDateTime(str) {
319
+ if (str in CACHE) {
320
+ return CACHE[str];
321
+ }
322
+ const date = _parseDateTime(str);
323
+ CACHE[str] = date;
324
+ return date;
325
+ }
326
+ function _parseDateTime(str) {
318
327
  str = str.trim();
319
328
  let time;
320
329
  const timeMatch = str.match(timeRegexp);
@@ -2251,8 +2260,9 @@ class RangeImpl {
2251
2260
  }
2252
2261
  get zone() {
2253
2262
  const { left, top, bottom, right } = this._zone;
2254
- if (right !== undefined && bottom !== undefined)
2255
- return { left, top, right, bottom };
2263
+ if (right !== undefined && bottom !== undefined) {
2264
+ return this._zone;
2265
+ }
2256
2266
  else if (bottom === undefined && right !== undefined) {
2257
2267
  return { right, top, left, bottom: this.getSheetSize(this.sheetId).numberOfRows - 1 };
2258
2268
  }
@@ -22517,7 +22527,14 @@ class AbstractResizer extends owl.Component {
22517
22527
  return;
22518
22528
  }
22519
22529
  if (this.state.waitingForMove === true) {
22520
- this.startMovement(ev);
22530
+ if (!this.env.model.getters.isGridSelectionActive()) {
22531
+ this._selectElement(index, false);
22532
+ }
22533
+ else {
22534
+ // FIXME: Consider reintroducing this feature for all type of selection if we find
22535
+ // a way to have the grid selection follow the other selections evolution
22536
+ this.startMovement(ev);
22537
+ }
22521
22538
  return;
22522
22539
  }
22523
22540
  if (this.env.model.getters.getEditionMode() === "editing") {
@@ -29642,10 +29659,11 @@ class CellPlugin extends CorePlugin {
29642
29659
  * Reconstructs the original formula string based on a normalized form and its dependencies
29643
29660
  */
29644
29661
  buildFormulaContent(sheetId, cell, dependencies) {
29645
- const ranges = dependencies || [...cell.dependencies];
29662
+ const ranges = dependencies || cell.dependencies;
29663
+ let rangeIndex = 0;
29646
29664
  return concat(cell.compiledFormula.tokens.map((token) => {
29647
29665
  if (token.type === "REFERENCE") {
29648
- const range = ranges.shift();
29666
+ const range = ranges[rangeIndex++];
29649
29667
  return this.getters.getRangeString(range, sheetId);
29650
29668
  }
29651
29669
  return token.value;
@@ -41197,6 +41215,7 @@ class GridSelectionPlugin extends UIPlugin {
41197
41215
  "isSingleColSelected",
41198
41216
  "getElementsFromSelection",
41199
41217
  "tryGetActiveSheetId",
41218
+ "isGridSelectionActive",
41200
41219
  ];
41201
41220
  gridSelection = {
41202
41221
  anchor: {
@@ -41406,6 +41425,9 @@ class GridSelectionPlugin extends UIPlugin {
41406
41425
  // ---------------------------------------------------------------------------
41407
41426
  // Getters
41408
41427
  // ---------------------------------------------------------------------------
41428
+ isGridSelectionActive() {
41429
+ return this.selection.isListening(this);
41430
+ }
41409
41431
  getActiveSheet() {
41410
41432
  return this.activeSheet;
41411
41433
  }
@@ -45261,6 +45283,9 @@ class SelectionStreamProcessorImpl {
45261
45283
  anchor: { zone, cell: this.anchor.cell },
45262
45284
  });
45263
45285
  }
45286
+ isListening(owner) {
45287
+ return this.stream.isListening(owner);
45288
+ }
45264
45289
  /**
45265
45290
  * Process a new anchor selection event. If the new anchor is inside
45266
45291
  * the sheet boundaries, the event is pushed to the event stream to
@@ -47721,6 +47746,6 @@ exports.setTranslationMethod = setTranslationMethod;
47721
47746
  exports.tokenize = tokenize;
47722
47747
 
47723
47748
 
47724
- __info__.version = '16.3.12';
47725
- __info__.date = '2023-10-03T12:43:02.230Z';
47726
- __info__.hash = '70a91d9';
47749
+ __info__.version = '16.3.13';
47750
+ __info__.date = '2023-10-10T07:28:39.702Z';
47751
+ __info__.hash = '67b6363';
@@ -958,7 +958,7 @@ declare class RangeImpl implements Range {
958
958
  constructor(args: ConstructorArgs, getSheetSize: (sheetId: UID) => ZoneDimension);
959
959
  static fromRange(range: Range, getters: CoreGetters): RangeImpl;
960
960
  get unboundedZone(): UnboundedZone;
961
- get zone(): Zone;
961
+ get zone(): Readonly<Zone>;
962
962
  static getRangeParts(xc: string, zone: UnboundedZone): RangePart[];
963
963
  get isFullCol(): boolean;
964
964
  get isFullRow(): boolean;
@@ -1056,6 +1056,7 @@ interface SelectionProcessor {
1056
1056
  selectAll(): DispatchResult;
1057
1057
  loopSelection(): DispatchResult;
1058
1058
  selectTableAroundSelection(): DispatchResult;
1059
+ isListening(owner: unknown): boolean;
1059
1060
  }
1060
1061
  type SelectionStreamProcessor = SelectionProcessor & StatefulStream<SelectionEvent, AnchorZone>;
1061
1062
 
@@ -4664,7 +4665,7 @@ declare class ClipboardPlugin extends UIPlugin {
4664
4665
  */
4665
4666
  declare class GridSelectionPlugin extends UIPlugin {
4666
4667
  static layers: LAYERS[];
4667
- static getters: readonly ["getActiveSheet", "getActiveSheetId", "getActiveCell", "getActiveCols", "getActiveRows", "getCurrentStyle", "getSelectedZones", "getSelectedZone", "getSelectedCells", "getStatisticFnResults", "getAggregate", "getSelectedFigureId", "getSelection", "getActivePosition", "getSheetPosition", "isSelected", "isSingleColSelected", "getElementsFromSelection", "tryGetActiveSheetId"];
4668
+ static getters: readonly ["getActiveSheet", "getActiveSheetId", "getActiveCell", "getActiveCols", "getActiveRows", "getCurrentStyle", "getSelectedZones", "getSelectedZone", "getSelectedCells", "getStatisticFnResults", "getAggregate", "getSelectedFigureId", "getSelection", "getActivePosition", "getSheetPosition", "isSelected", "isSingleColSelected", "getElementsFromSelection", "tryGetActiveSheetId", "isGridSelectionActive"];
4668
4669
  private gridSelection;
4669
4670
  private selectedFigureId;
4670
4671
  private sheetsData;
@@ -4674,6 +4675,7 @@ declare class GridSelectionPlugin extends UIPlugin {
4674
4675
  allowDispatch(cmd: LocalCommand): CommandResult;
4675
4676
  private handleEvent;
4676
4677
  handle(cmd: Command): void;
4678
+ isGridSelectionActive(): boolean;
4677
4679
  getActiveSheet(): Readonly<Sheet>;
4678
4680
  getActiveSheetId(): UID;
4679
4681
  tryGetActiveSheetId(): UID | undefined;
@@ -310,7 +310,16 @@ const DATE_JS_1900_OFFSET = INITIAL_JS_DAY - INITIAL_1900_DAY;
310
310
  const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
311
311
  const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
312
312
  const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
313
+ const CACHE = {};
313
314
  function parseDateTime(str) {
315
+ if (str in CACHE) {
316
+ return CACHE[str];
317
+ }
318
+ const date = _parseDateTime(str);
319
+ CACHE[str] = date;
320
+ return date;
321
+ }
322
+ function _parseDateTime(str) {
314
323
  str = str.trim();
315
324
  let time;
316
325
  const timeMatch = str.match(timeRegexp);
@@ -2247,8 +2256,9 @@ class RangeImpl {
2247
2256
  }
2248
2257
  get zone() {
2249
2258
  const { left, top, bottom, right } = this._zone;
2250
- if (right !== undefined && bottom !== undefined)
2251
- return { left, top, right, bottom };
2259
+ if (right !== undefined && bottom !== undefined) {
2260
+ return this._zone;
2261
+ }
2252
2262
  else if (bottom === undefined && right !== undefined) {
2253
2263
  return { right, top, left, bottom: this.getSheetSize(this.sheetId).numberOfRows - 1 };
2254
2264
  }
@@ -22513,7 +22523,14 @@ class AbstractResizer extends Component {
22513
22523
  return;
22514
22524
  }
22515
22525
  if (this.state.waitingForMove === true) {
22516
- this.startMovement(ev);
22526
+ if (!this.env.model.getters.isGridSelectionActive()) {
22527
+ this._selectElement(index, false);
22528
+ }
22529
+ else {
22530
+ // FIXME: Consider reintroducing this feature for all type of selection if we find
22531
+ // a way to have the grid selection follow the other selections evolution
22532
+ this.startMovement(ev);
22533
+ }
22517
22534
  return;
22518
22535
  }
22519
22536
  if (this.env.model.getters.getEditionMode() === "editing") {
@@ -29638,10 +29655,11 @@ class CellPlugin extends CorePlugin {
29638
29655
  * Reconstructs the original formula string based on a normalized form and its dependencies
29639
29656
  */
29640
29657
  buildFormulaContent(sheetId, cell, dependencies) {
29641
- const ranges = dependencies || [...cell.dependencies];
29658
+ const ranges = dependencies || cell.dependencies;
29659
+ let rangeIndex = 0;
29642
29660
  return concat(cell.compiledFormula.tokens.map((token) => {
29643
29661
  if (token.type === "REFERENCE") {
29644
- const range = ranges.shift();
29662
+ const range = ranges[rangeIndex++];
29645
29663
  return this.getters.getRangeString(range, sheetId);
29646
29664
  }
29647
29665
  return token.value;
@@ -41193,6 +41211,7 @@ class GridSelectionPlugin extends UIPlugin {
41193
41211
  "isSingleColSelected",
41194
41212
  "getElementsFromSelection",
41195
41213
  "tryGetActiveSheetId",
41214
+ "isGridSelectionActive",
41196
41215
  ];
41197
41216
  gridSelection = {
41198
41217
  anchor: {
@@ -41402,6 +41421,9 @@ class GridSelectionPlugin extends UIPlugin {
41402
41421
  // ---------------------------------------------------------------------------
41403
41422
  // Getters
41404
41423
  // ---------------------------------------------------------------------------
41424
+ isGridSelectionActive() {
41425
+ return this.selection.isListening(this);
41426
+ }
41405
41427
  getActiveSheet() {
41406
41428
  return this.activeSheet;
41407
41429
  }
@@ -45257,6 +45279,9 @@ class SelectionStreamProcessorImpl {
45257
45279
  anchor: { zone, cell: this.anchor.cell },
45258
45280
  });
45259
45281
  }
45282
+ isListening(owner) {
45283
+ return this.stream.isListening(owner);
45284
+ }
45260
45285
  /**
45261
45286
  * Process a new anchor selection event. If the new anchor is inside
45262
45287
  * the sheet boundaries, the event is pushed to the event stream to
@@ -47689,6 +47714,6 @@ function addFunction(functionName, functionDescription) {
47689
47714
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
47690
47715
 
47691
47716
 
47692
- __info__.version = '16.3.12';
47693
- __info__.date = '2023-10-03T12:43:02.230Z';
47694
- __info__.hash = '70a91d9';
47717
+ __info__.version = '16.3.13';
47718
+ __info__.date = '2023-10-10T07:28:39.702Z';
47719
+ __info__.hash = '67b6363';
@@ -311,7 +311,16 @@
311
311
  const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
312
312
  const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
313
313
  const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
314
+ const CACHE = {};
314
315
  function parseDateTime(str) {
316
+ if (str in CACHE) {
317
+ return CACHE[str];
318
+ }
319
+ const date = _parseDateTime(str);
320
+ CACHE[str] = date;
321
+ return date;
322
+ }
323
+ function _parseDateTime(str) {
315
324
  str = str.trim();
316
325
  let time;
317
326
  const timeMatch = str.match(timeRegexp);
@@ -2248,8 +2257,9 @@
2248
2257
  }
2249
2258
  get zone() {
2250
2259
  const { left, top, bottom, right } = this._zone;
2251
- if (right !== undefined && bottom !== undefined)
2252
- return { left, top, right, bottom };
2260
+ if (right !== undefined && bottom !== undefined) {
2261
+ return this._zone;
2262
+ }
2253
2263
  else if (bottom === undefined && right !== undefined) {
2254
2264
  return { right, top, left, bottom: this.getSheetSize(this.sheetId).numberOfRows - 1 };
2255
2265
  }
@@ -22514,7 +22524,14 @@
22514
22524
  return;
22515
22525
  }
22516
22526
  if (this.state.waitingForMove === true) {
22517
- this.startMovement(ev);
22527
+ if (!this.env.model.getters.isGridSelectionActive()) {
22528
+ this._selectElement(index, false);
22529
+ }
22530
+ else {
22531
+ // FIXME: Consider reintroducing this feature for all type of selection if we find
22532
+ // a way to have the grid selection follow the other selections evolution
22533
+ this.startMovement(ev);
22534
+ }
22518
22535
  return;
22519
22536
  }
22520
22537
  if (this.env.model.getters.getEditionMode() === "editing") {
@@ -29639,10 +29656,11 @@
29639
29656
  * Reconstructs the original formula string based on a normalized form and its dependencies
29640
29657
  */
29641
29658
  buildFormulaContent(sheetId, cell, dependencies) {
29642
- const ranges = dependencies || [...cell.dependencies];
29659
+ const ranges = dependencies || cell.dependencies;
29660
+ let rangeIndex = 0;
29643
29661
  return concat(cell.compiledFormula.tokens.map((token) => {
29644
29662
  if (token.type === "REFERENCE") {
29645
- const range = ranges.shift();
29663
+ const range = ranges[rangeIndex++];
29646
29664
  return this.getters.getRangeString(range, sheetId);
29647
29665
  }
29648
29666
  return token.value;
@@ -41194,6 +41212,7 @@
41194
41212
  "isSingleColSelected",
41195
41213
  "getElementsFromSelection",
41196
41214
  "tryGetActiveSheetId",
41215
+ "isGridSelectionActive",
41197
41216
  ];
41198
41217
  gridSelection = {
41199
41218
  anchor: {
@@ -41403,6 +41422,9 @@
41403
41422
  // ---------------------------------------------------------------------------
41404
41423
  // Getters
41405
41424
  // ---------------------------------------------------------------------------
41425
+ isGridSelectionActive() {
41426
+ return this.selection.isListening(this);
41427
+ }
41406
41428
  getActiveSheet() {
41407
41429
  return this.activeSheet;
41408
41430
  }
@@ -45258,6 +45280,9 @@
45258
45280
  anchor: { zone, cell: this.anchor.cell },
45259
45281
  });
45260
45282
  }
45283
+ isListening(owner) {
45284
+ return this.stream.isListening(owner);
45285
+ }
45261
45286
  /**
45262
45287
  * Process a new anchor selection event. If the new anchor is inside
45263
45288
  * the sheet boundaries, the event is pushed to the event stream to
@@ -47720,9 +47745,9 @@
47720
47745
  Object.defineProperty(exports, '__esModule', { value: true });
47721
47746
 
47722
47747
 
47723
- __info__.version = '16.3.12';
47724
- __info__.date = '2023-10-03T12:43:02.230Z';
47725
- __info__.hash = '70a91d9';
47748
+ __info__.version = '16.3.13';
47749
+ __info__.date = '2023-10-10T07:28:39.702Z';
47750
+ __info__.hash = '67b6363';
47726
47751
 
47727
47752
 
47728
47753
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);