@odoo/o-spreadsheet 16.2.17 → 16.2.18

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.
@@ -302,7 +302,16 @@ const DATE_JS_1900_OFFSET = INITIAL_JS_DAY - INITIAL_1900_DAY;
302
302
  const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
303
303
  const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
304
304
  const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
305
+ const CACHE = {};
305
306
  function parseDateTime(str) {
307
+ if (str in CACHE) {
308
+ return CACHE[str];
309
+ }
310
+ const date = _parseDateTime(str);
311
+ CACHE[str] = date;
312
+ return date;
313
+ }
314
+ function _parseDateTime(str) {
306
315
  str = str.trim();
307
316
  let time;
308
317
  const timeMatch = str.match(timeRegexp);
@@ -2144,8 +2153,9 @@ class RangeImpl {
2144
2153
  }
2145
2154
  get zone() {
2146
2155
  const { left, top, bottom, right } = this._zone;
2147
- if (right !== undefined && bottom !== undefined)
2148
- return { left, top, right, bottom };
2156
+ if (right !== undefined && bottom !== undefined) {
2157
+ return this._zone;
2158
+ }
2149
2159
  else if (bottom === undefined && right !== undefined) {
2150
2160
  return { right, top, left, bottom: this.getSheetSize(this.sheetId).numberOfRows - 1 };
2151
2161
  }
@@ -21176,7 +21186,14 @@ class AbstractResizer extends owl.Component {
21176
21186
  return;
21177
21187
  }
21178
21188
  if (this.state.waitingForMove === true) {
21179
- this.startMovement(ev);
21189
+ if (!this.env.model.getters.isGridSelectionActive()) {
21190
+ this._selectElement(index, false);
21191
+ }
21192
+ else {
21193
+ // FIXME: Consider reintroducing this feature for all type of selection if we find
21194
+ // a way to have the grid selection follow the other selections evolution
21195
+ this.startMovement(ev);
21196
+ }
21180
21197
  return;
21181
21198
  }
21182
21199
  if (this.env.model.getters.getEditionMode() === "editing") {
@@ -28136,10 +28153,11 @@ class CellPlugin extends CorePlugin {
28136
28153
  * Reconstructs the original formula string based on a normalized form and its dependencies
28137
28154
  */
28138
28155
  buildFormulaContent(sheetId, cell, dependencies) {
28139
- const ranges = dependencies || [...cell.dependencies];
28156
+ const ranges = dependencies || cell.dependencies;
28157
+ let rangeIndex = 0;
28140
28158
  return concat(cell.compiledFormula.tokens.map((token) => {
28141
28159
  if (token.type === "REFERENCE") {
28142
- const range = ranges.shift();
28160
+ const range = ranges[rangeIndex++];
28143
28161
  return this.getters.getRangeString(range, sheetId);
28144
28162
  }
28145
28163
  return token.value;
@@ -39245,6 +39263,9 @@ class GridSelectionPlugin extends UIPlugin {
39245
39263
  // ---------------------------------------------------------------------------
39246
39264
  // Getters
39247
39265
  // ---------------------------------------------------------------------------
39266
+ isGridSelectionActive() {
39267
+ return this.selection.isListening(this);
39268
+ }
39248
39269
  getActiveSheet() {
39249
39270
  return this.activeSheet;
39250
39271
  }
@@ -39619,6 +39640,7 @@ GridSelectionPlugin.getters = [
39619
39640
  "getSheetPosition",
39620
39641
  "isSelected",
39621
39642
  "getElementsFromSelection",
39643
+ "isGridSelectionActive",
39622
39644
  ];
39623
39645
 
39624
39646
  const corePluginRegistry = new Registry()
@@ -43097,6 +43119,9 @@ class SelectionStreamProcessorImpl {
43097
43119
  anchor: { zone, cell: this.anchor.cell },
43098
43120
  });
43099
43121
  }
43122
+ isListening(owner) {
43123
+ return this.stream.isListening(owner);
43124
+ }
43100
43125
  /**
43101
43126
  * Process a new anchor selection event. If the new anchor is inside
43102
43127
  * the sheet boundaries, the event is pushed to the event stream to
@@ -45460,6 +45485,6 @@ exports.setTranslationMethod = setTranslationMethod;
45460
45485
  exports.tokenize = tokenize;
45461
45486
 
45462
45487
 
45463
- __info__.version = '16.2.17';
45464
- __info__.date = '2023-10-03T12:42:54.642Z';
45465
- __info__.hash = '146867a';
45488
+ __info__.version = '16.2.18';
45489
+ __info__.date = '2023-10-10T07:29:40.321Z';
45490
+ __info__.hash = '451fa09';
@@ -249,7 +249,7 @@ declare class RangeImpl implements Range {
249
249
  constructor(args: ConstructorArgs, getSheetSize: (sheetId: UID) => ZoneDimension);
250
250
  static fromRange(range: Range, getters: CoreGetters): RangeImpl;
251
251
  get unboundedZone(): UnboundedZone;
252
- get zone(): Zone;
252
+ get zone(): Readonly<Zone>;
253
253
  static getRangeParts(xc: string, zone: UnboundedZone): RangePart[];
254
254
  get isFullCol(): boolean;
255
255
  get isFullRow(): boolean;
@@ -347,6 +347,7 @@ interface SelectionProcessor {
347
347
  selectAll(): DispatchResult;
348
348
  loopSelection(): DispatchResult;
349
349
  selectTableAroundSelection(): DispatchResult;
350
+ isListening(owner: unknown): boolean;
350
351
  }
351
352
  type SelectionStreamProcessor = SelectionProcessor & StatefulStream<SelectionEvent, AnchorZone>;
352
353
 
@@ -4554,7 +4555,7 @@ declare class ClipboardPlugin extends UIPlugin {
4554
4555
  */
4555
4556
  declare class GridSelectionPlugin extends UIPlugin {
4556
4557
  static layers: LAYERS[];
4557
- static getters: readonly ["getActiveSheet", "getActiveSheetId", "getActiveCell", "getActiveCols", "getActiveRows", "getCurrentStyle", "getSelectedZones", "getSelectedZone", "getStatisticFnResults", "getAggregate", "getSelectedFigureId", "getSelection", "getActivePosition", "getSheetPosition", "isSelected", "getElementsFromSelection"];
4558
+ static getters: readonly ["getActiveSheet", "getActiveSheetId", "getActiveCell", "getActiveCols", "getActiveRows", "getCurrentStyle", "getSelectedZones", "getSelectedZone", "getStatisticFnResults", "getAggregate", "getSelectedFigureId", "getSelection", "getActivePosition", "getSheetPosition", "isSelected", "getElementsFromSelection", "isGridSelectionActive"];
4558
4559
  private gridSelection;
4559
4560
  private selectedFigureId;
4560
4561
  private sheetsData;
@@ -4564,6 +4565,7 @@ declare class GridSelectionPlugin extends UIPlugin {
4564
4565
  allowDispatch(cmd: Command): CommandResult;
4565
4566
  private handleEvent;
4566
4567
  handle(cmd: Command): void;
4568
+ isGridSelectionActive(): boolean;
4567
4569
  getActiveSheet(): Readonly<Sheet>;
4568
4570
  getActiveSheetId(): UID;
4569
4571
  getActiveCell(): EvaluatedCell;
@@ -298,7 +298,16 @@ const DATE_JS_1900_OFFSET = INITIAL_JS_DAY - INITIAL_1900_DAY;
298
298
  const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
299
299
  const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
300
300
  const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
301
+ const CACHE = {};
301
302
  function parseDateTime(str) {
303
+ if (str in CACHE) {
304
+ return CACHE[str];
305
+ }
306
+ const date = _parseDateTime(str);
307
+ CACHE[str] = date;
308
+ return date;
309
+ }
310
+ function _parseDateTime(str) {
302
311
  str = str.trim();
303
312
  let time;
304
313
  const timeMatch = str.match(timeRegexp);
@@ -2140,8 +2149,9 @@ class RangeImpl {
2140
2149
  }
2141
2150
  get zone() {
2142
2151
  const { left, top, bottom, right } = this._zone;
2143
- if (right !== undefined && bottom !== undefined)
2144
- return { left, top, right, bottom };
2152
+ if (right !== undefined && bottom !== undefined) {
2153
+ return this._zone;
2154
+ }
2145
2155
  else if (bottom === undefined && right !== undefined) {
2146
2156
  return { right, top, left, bottom: this.getSheetSize(this.sheetId).numberOfRows - 1 };
2147
2157
  }
@@ -21172,7 +21182,14 @@ class AbstractResizer extends Component {
21172
21182
  return;
21173
21183
  }
21174
21184
  if (this.state.waitingForMove === true) {
21175
- this.startMovement(ev);
21185
+ if (!this.env.model.getters.isGridSelectionActive()) {
21186
+ this._selectElement(index, false);
21187
+ }
21188
+ else {
21189
+ // FIXME: Consider reintroducing this feature for all type of selection if we find
21190
+ // a way to have the grid selection follow the other selections evolution
21191
+ this.startMovement(ev);
21192
+ }
21176
21193
  return;
21177
21194
  }
21178
21195
  if (this.env.model.getters.getEditionMode() === "editing") {
@@ -28132,10 +28149,11 @@ class CellPlugin extends CorePlugin {
28132
28149
  * Reconstructs the original formula string based on a normalized form and its dependencies
28133
28150
  */
28134
28151
  buildFormulaContent(sheetId, cell, dependencies) {
28135
- const ranges = dependencies || [...cell.dependencies];
28152
+ const ranges = dependencies || cell.dependencies;
28153
+ let rangeIndex = 0;
28136
28154
  return concat(cell.compiledFormula.tokens.map((token) => {
28137
28155
  if (token.type === "REFERENCE") {
28138
- const range = ranges.shift();
28156
+ const range = ranges[rangeIndex++];
28139
28157
  return this.getters.getRangeString(range, sheetId);
28140
28158
  }
28141
28159
  return token.value;
@@ -39241,6 +39259,9 @@ class GridSelectionPlugin extends UIPlugin {
39241
39259
  // ---------------------------------------------------------------------------
39242
39260
  // Getters
39243
39261
  // ---------------------------------------------------------------------------
39262
+ isGridSelectionActive() {
39263
+ return this.selection.isListening(this);
39264
+ }
39244
39265
  getActiveSheet() {
39245
39266
  return this.activeSheet;
39246
39267
  }
@@ -39615,6 +39636,7 @@ GridSelectionPlugin.getters = [
39615
39636
  "getSheetPosition",
39616
39637
  "isSelected",
39617
39638
  "getElementsFromSelection",
39639
+ "isGridSelectionActive",
39618
39640
  ];
39619
39641
 
39620
39642
  const corePluginRegistry = new Registry()
@@ -43093,6 +43115,9 @@ class SelectionStreamProcessorImpl {
43093
43115
  anchor: { zone, cell: this.anchor.cell },
43094
43116
  });
43095
43117
  }
43118
+ isListening(owner) {
43119
+ return this.stream.isListening(owner);
43120
+ }
43096
43121
  /**
43097
43122
  * Process a new anchor selection event. If the new anchor is inside
43098
43123
  * the sheet boundaries, the event is pushed to the event stream to
@@ -45428,6 +45453,6 @@ function addFunction(functionName, functionDescription) {
45428
45453
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, 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, setTranslationMethod, tokenize };
45429
45454
 
45430
45455
 
45431
- __info__.version = '16.2.17';
45432
- __info__.date = '2023-10-03T12:42:54.642Z';
45433
- __info__.hash = '146867a';
45456
+ __info__.version = '16.2.18';
45457
+ __info__.date = '2023-10-10T07:29:40.321Z';
45458
+ __info__.hash = '451fa09';
@@ -299,7 +299,16 @@
299
299
  const mdyDateRegexp = /^\d{1,2}(\/|-|\s)\d{1,2}((\/|-|\s)\d{1,4})?$/;
300
300
  const ymdDateRegexp = /^\d{3,4}(\/|-|\s)\d{1,2}(\/|-|\s)\d{1,2}$/;
301
301
  const timeRegexp = /((\d+(:\d+)?(:\d+)?\s*(AM|PM))|(\d+:\d+(:\d+)?))$/;
302
+ const CACHE = {};
302
303
  function parseDateTime(str) {
304
+ if (str in CACHE) {
305
+ return CACHE[str];
306
+ }
307
+ const date = _parseDateTime(str);
308
+ CACHE[str] = date;
309
+ return date;
310
+ }
311
+ function _parseDateTime(str) {
303
312
  str = str.trim();
304
313
  let time;
305
314
  const timeMatch = str.match(timeRegexp);
@@ -2141,8 +2150,9 @@
2141
2150
  }
2142
2151
  get zone() {
2143
2152
  const { left, top, bottom, right } = this._zone;
2144
- if (right !== undefined && bottom !== undefined)
2145
- return { left, top, right, bottom };
2153
+ if (right !== undefined && bottom !== undefined) {
2154
+ return this._zone;
2155
+ }
2146
2156
  else if (bottom === undefined && right !== undefined) {
2147
2157
  return { right, top, left, bottom: this.getSheetSize(this.sheetId).numberOfRows - 1 };
2148
2158
  }
@@ -21173,7 +21183,14 @@
21173
21183
  return;
21174
21184
  }
21175
21185
  if (this.state.waitingForMove === true) {
21176
- this.startMovement(ev);
21186
+ if (!this.env.model.getters.isGridSelectionActive()) {
21187
+ this._selectElement(index, false);
21188
+ }
21189
+ else {
21190
+ // FIXME: Consider reintroducing this feature for all type of selection if we find
21191
+ // a way to have the grid selection follow the other selections evolution
21192
+ this.startMovement(ev);
21193
+ }
21177
21194
  return;
21178
21195
  }
21179
21196
  if (this.env.model.getters.getEditionMode() === "editing") {
@@ -28133,10 +28150,11 @@
28133
28150
  * Reconstructs the original formula string based on a normalized form and its dependencies
28134
28151
  */
28135
28152
  buildFormulaContent(sheetId, cell, dependencies) {
28136
- const ranges = dependencies || [...cell.dependencies];
28153
+ const ranges = dependencies || cell.dependencies;
28154
+ let rangeIndex = 0;
28137
28155
  return concat(cell.compiledFormula.tokens.map((token) => {
28138
28156
  if (token.type === "REFERENCE") {
28139
- const range = ranges.shift();
28157
+ const range = ranges[rangeIndex++];
28140
28158
  return this.getters.getRangeString(range, sheetId);
28141
28159
  }
28142
28160
  return token.value;
@@ -39242,6 +39260,9 @@
39242
39260
  // ---------------------------------------------------------------------------
39243
39261
  // Getters
39244
39262
  // ---------------------------------------------------------------------------
39263
+ isGridSelectionActive() {
39264
+ return this.selection.isListening(this);
39265
+ }
39245
39266
  getActiveSheet() {
39246
39267
  return this.activeSheet;
39247
39268
  }
@@ -39616,6 +39637,7 @@
39616
39637
  "getSheetPosition",
39617
39638
  "isSelected",
39618
39639
  "getElementsFromSelection",
39640
+ "isGridSelectionActive",
39619
39641
  ];
39620
39642
 
39621
39643
  const corePluginRegistry = new Registry()
@@ -43094,6 +43116,9 @@
43094
43116
  anchor: { zone, cell: this.anchor.cell },
43095
43117
  });
43096
43118
  }
43119
+ isListening(owner) {
43120
+ return this.stream.isListening(owner);
43121
+ }
43097
43122
  /**
43098
43123
  * Process a new anchor selection event. If the new anchor is inside
43099
43124
  * the sheet boundaries, the event is pushed to the event stream to
@@ -45459,9 +45484,9 @@
45459
45484
  Object.defineProperty(exports, '__esModule', { value: true });
45460
45485
 
45461
45486
 
45462
- __info__.version = '16.2.17';
45463
- __info__.date = '2023-10-03T12:42:54.642Z';
45464
- __info__.hash = '146867a';
45487
+ __info__.version = '16.2.18';
45488
+ __info__.date = '2023-10-10T07:29:40.321Z';
45489
+ __info__.hash = '451fa09';
45465
45490
 
45466
45491
 
45467
45492
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);