@odoo/o-spreadsheet 17.2.21 → 17.2.23

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.
@@ -3,9 +3,9 @@
3
3
  /**
4
4
  * This file is generated by o-spreadsheet build tools. Do not edit it.
5
5
  * @see https://github.com/odoo/o-spreadsheet
6
- * @version 17.2.21
7
- * @date 2024-08-19T08:10:10.580Z
8
- * @hash fb17f9c
6
+ * @version 17.2.23
7
+ * @date 2024-09-05T09:32:03.325Z
8
+ * @hash e5e2be8
9
9
  */
10
10
 
11
11
  (function (exports, owl) {
@@ -5786,9 +5786,11 @@
5786
5786
  const targetCell = this.getters.getEvaluatedCell(target);
5787
5787
  const originFormat = origin.cell?.format ?? origin.evaluatedCell.format;
5788
5788
  if (clipboardOption?.pasteOption === "asValue") {
5789
- const locale = this.getters.getLocale();
5790
- const content = formatValue(origin.evaluatedCell.value, { locale });
5791
- this.dispatch("UPDATE_CELL", { ...target, content, format: originFormat });
5789
+ this.dispatch("UPDATE_CELL", {
5790
+ ...target,
5791
+ content: origin.evaluatedCell.value?.toString() || "",
5792
+ format: originFormat,
5793
+ });
5792
5794
  return;
5793
5795
  }
5794
5796
  if (clipboardOption?.pasteOption === "onlyFormat") {
@@ -29877,7 +29879,6 @@ stores.inject(MyMetaStore, storeInstance);
29877
29879
  searchScope: "allSheets",
29878
29880
  specificRange: undefined,
29879
29881
  };
29880
- updateSearchContent = debounce(this._updateSearchContent.bind(this), 200);
29881
29882
  constructor(get) {
29882
29883
  super(get);
29883
29884
  this.initialShowFormulaState = this.model.getters.shouldShowFormulas();
@@ -29886,7 +29887,6 @@ stores.inject(MyMetaStore, storeInstance);
29886
29887
  highlightStore.register(this);
29887
29888
  this.onDispose(() => {
29888
29889
  this.model.dispatch("SET_FORMULA_VISIBILITY", { show: this.initialShowFormulaState });
29889
- this.updateSearchContent.stopDebounce();
29890
29890
  highlightStore.unRegister(this);
29891
29891
  });
29892
29892
  }
@@ -29900,7 +29900,7 @@ stores.inject(MyMetaStore, storeInstance);
29900
29900
  return this.specificRangeMatches;
29901
29901
  }
29902
29902
  }
29903
- _updateSearchContent(toSearch) {
29903
+ updateSearchContent(toSearch) {
29904
29904
  this._updateSearch(toSearch, this.searchOptions);
29905
29905
  }
29906
29906
  updateSearchOptions(searchOptions) {
@@ -29916,9 +29916,6 @@ stores.inject(MyMetaStore, storeInstance);
29916
29916
  selectNextMatch() {
29917
29917
  this.selectNextCell(Direction.next);
29918
29918
  }
29919
- get pendingSearch() {
29920
- return this.updateSearchContent.isDebouncePending();
29921
- }
29922
29919
  handle(cmd) {
29923
29920
  switch (cmd.type) {
29924
29921
  case "SET_FORMULA_VISIBILITY":
@@ -30196,6 +30193,7 @@ stores.inject(MyMetaStore, storeInstance);
30196
30193
  searchInput = owl.useRef("searchInput");
30197
30194
  store;
30198
30195
  state;
30196
+ updateSearchContent;
30199
30197
  get hasSearchResult() {
30200
30198
  return this.store.selectedMatchIndex !== null;
30201
30199
  }
@@ -30227,12 +30225,14 @@ stores.inject(MyMetaStore, storeInstance);
30227
30225
  this.store = useLocalStore(FindAndReplaceStore);
30228
30226
  this.state = owl.useState({ dataRange: "" });
30229
30227
  owl.onMounted(() => this.searchInput.el?.focus());
30228
+ owl.onWillUnmount(() => this.updateSearchContent.stopDebounce());
30229
+ this.updateSearchContent = debounce(this.store.updateSearchContent, 200);
30230
30230
  }
30231
30231
  onFocusSearch() {
30232
30232
  this.updateDataRange();
30233
30233
  }
30234
30234
  onSearchInput(ev) {
30235
- this.store.updateSearchContent(ev.target?.value || "");
30235
+ this.updateSearchContent(ev.target.value);
30236
30236
  }
30237
30237
  onKeydownSearch(ev) {
30238
30238
  if (ev.key === "Enter") {
@@ -30271,6 +30271,9 @@ stores.inject(MyMetaStore, storeInstance);
30271
30271
  const specificRange = this.env.model.getters.getRangeFromSheetXC(this.env.model.getters.getActiveSheetId(), this.state.dataRange);
30272
30272
  this.store.updateSearchOptions({ specificRange });
30273
30273
  }
30274
+ get pendingSearch() {
30275
+ return this.updateSearchContent.isDebouncePending();
30276
+ }
30274
30277
  }
30275
30278
 
30276
30279
  css /* scss */ `
@@ -31073,10 +31076,6 @@ stores.inject(MyMetaStore, storeInstance);
31073
31076
  });
31074
31077
  }
31075
31078
  onRangeChanged(ranges) {
31076
- if (!ranges[0] || !ranges[0].match(rangeReference)) {
31077
- this.state.tableZoneErrors = ["InvalidRange" /* CommandResult.InvalidRange */];
31078
- return;
31079
- }
31080
31079
  const sheetId = this.env.model.getters.getActiveSheetId();
31081
31080
  this.state.tableXc = ranges[0];
31082
31081
  this.state.tableZoneErrors = this.env.model.canDispatch("UPDATE_TABLE", {
@@ -31100,10 +31099,6 @@ stores.inject(MyMetaStore, storeInstance);
31100
31099
  cell: position,
31101
31100
  });
31102
31101
  }
31103
- this.state.tableZoneErrors = [];
31104
- this.state.tableXc = result.isSuccessful
31105
- ? this.state.tableXc
31106
- : this.env.model.getters.getRangeString(this.props.table.range, sheetId);
31107
31102
  }
31108
31103
  deleteTable() {
31109
31104
  const sheetId = this.env.model.getters.getActiveSheetId();
@@ -37596,6 +37591,18 @@ stores.inject(MyMetaStore, storeInstance);
37596
37591
  // -------------------------------------
37597
37592
  // WORKSHEET HELPERS
37598
37593
  // -------------------------------------
37594
+ function getCellType(value) {
37595
+ switch (typeof value) {
37596
+ case "boolean":
37597
+ return "b";
37598
+ case "string":
37599
+ return "str";
37600
+ case "number":
37601
+ return "n";
37602
+ default:
37603
+ return undefined;
37604
+ }
37605
+ }
37599
37606
  function convertHeightToExcel(height) {
37600
37607
  return Math.round(HEIGHT_FACTOR * height * 100) / 100;
37601
37608
  }
@@ -42997,7 +43004,10 @@ stores.inject(MyMetaStore, storeInstance);
42997
43004
  handle(cmd) {
42998
43005
  switch (cmd.type) {
42999
43006
  case "CREATE_SHEET": {
43000
- this.history.update("sizes", cmd.sheetId, { COL: [], ROW: [] });
43007
+ this.history.update("sizes", cmd.sheetId, {
43008
+ COL: Array(this.getters.getNumberCols(cmd.sheetId)).fill(undefined),
43009
+ ROW: Array(this.getters.getNumberRows(cmd.sheetId)).fill(undefined),
43010
+ });
43001
43011
  break;
43002
43012
  }
43003
43013
  case "DUPLICATE_SHEET":
@@ -50428,9 +50438,9 @@ stores.inject(MyMetaStore, storeInstance);
50428
50438
  /**
50429
50439
  * Notify the server that the user client left the collaborative session
50430
50440
  */
50431
- leave(data) {
50441
+ async leave(data) {
50432
50442
  if (Object.keys(this.clients).length === 1 && this.processedRevisions.size) {
50433
- this.snapshot(data());
50443
+ await this.snapshot(data());
50434
50444
  }
50435
50445
  delete this.clients[this.clientId];
50436
50446
  this.transportService.leave(this.clientId);
@@ -50443,12 +50453,12 @@ stores.inject(MyMetaStore, storeInstance);
50443
50453
  /**
50444
50454
  * Send a snapshot of the spreadsheet to the collaboration server
50445
50455
  */
50446
- snapshot(data) {
50456
+ async snapshot(data) {
50447
50457
  if (this.pendingMessages.length !== 0) {
50448
50458
  return;
50449
50459
  }
50450
50460
  const snapshotId = this.uuidGenerator.uuidv4();
50451
- this.transportService.sendMessage({
50461
+ await this.transportService.sendMessage({
50452
50462
  type: "SNAPSHOT",
50453
50463
  nextRevisionId: snapshotId,
50454
50464
  serverRevisionId: this.serverRevisionId,
@@ -52363,6 +52373,7 @@ stores.inject(MyMetaStore, storeInstance);
52363
52373
  this.status = "invisible";
52364
52374
  if (this._isCutOperation) {
52365
52375
  this.copiedData = undefined;
52376
+ this._isCutOperation = false;
52366
52377
  }
52367
52378
  break;
52368
52379
  }
@@ -52460,6 +52471,7 @@ stores.inject(MyMetaStore, storeInstance);
52460
52471
  }
52461
52472
  case "ACTIVATE_PAINT_FORMAT": {
52462
52473
  const zones = this.getters.getSelectedZones();
52474
+ this._isCutOperation = false;
52463
52475
  this.copiedData = this.copy(zones);
52464
52476
  this.status = "visible";
52465
52477
  if (cmd.persistent) {
@@ -53215,6 +53227,8 @@ stores.inject(MyMetaStore, storeInstance);
53215
53227
  this.selectedFigureId = null;
53216
53228
  break;
53217
53229
  }
53230
+ }
53231
+ finalize() {
53218
53232
  /** Any change to the selection has to be reflected in the selection processor. */
53219
53233
  this.selection.resetDefaultAnchor(this, deepCopy(this.gridSelection.anchor));
53220
53234
  }
@@ -54043,7 +54057,6 @@ stores.inject(MyMetaStore, storeInstance);
54043
54057
  }
54044
54058
  }
54045
54059
  handle(cmd) {
54046
- this.cleanViewports();
54047
54060
  // changing the evaluation can hide/show rows because of data filters
54048
54061
  if (invalidateEvaluationCommands.has(cmd.type)) {
54049
54062
  for (const sheetId of this.getters.getSheetIds()) {
@@ -54059,6 +54072,7 @@ stores.inject(MyMetaStore, storeInstance);
54059
54072
  break;
54060
54073
  case "UNDO":
54061
54074
  case "REDO":
54075
+ this.cleanViewports();
54062
54076
  for (const sheetId of this.getters.getSheetIds()) {
54063
54077
  this.sheetsWithDirtyViewports.add(sheetId);
54064
54078
  }
@@ -54113,6 +54127,9 @@ stores.inject(MyMetaStore, storeInstance);
54113
54127
  }
54114
54128
  }
54115
54129
  break;
54130
+ case "DELETE_SHEET":
54131
+ this.cleanViewports();
54132
+ break;
54116
54133
  case "ACTIVATE_SHEET":
54117
54134
  this.sheetsWithDirtyViewports.add(cmd.sheetIdTo);
54118
54135
  break;
@@ -55273,6 +55290,17 @@ stores.inject(MyMetaStore, storeInstance);
55273
55290
  .o-bottom-bar-fade-in {
55274
55291
  background-image: linear-gradient(90deg, #cfcfcf, transparent 1%);
55275
55292
  }
55293
+
55294
+ .o-sheet-list {
55295
+ overflow-y: hidden;
55296
+ overflow-x: auto;
55297
+
55298
+ &::-webkit-scrollbar {
55299
+ display: none; /* Chrome */
55300
+ }
55301
+ -ms-overflow-style: none; /* IE and Edge */
55302
+ scrollbar-width: none; /* Firefox */
55303
+ }
55276
55304
  }
55277
55305
 
55278
55306
  .o-bottom-bar-arrows {
@@ -57169,7 +57197,7 @@ stores.inject(MyMetaStore, storeInstance);
57169
57197
 
57170
57198
  class LocalTransportService {
57171
57199
  listeners = [];
57172
- sendMessage(message) {
57200
+ async sendMessage(message) {
57173
57201
  for (const { callback } of this.listeners) {
57174
57202
  callback(message);
57175
57203
  }
@@ -59006,17 +59034,13 @@ stores.inject(MyMetaStore, storeInstance);
59006
59034
  if (!formula) {
59007
59035
  return { attrs: [], node: escapeXml `` };
59008
59036
  }
59009
- const attrs = [];
59010
- let node = escapeXml ``;
59011
- let cycle = escapeXml ``;
59012
- const XlsxFormula = adaptFormulaToExcel(formula);
59013
- // hack for cycles : if we don't set a value (be it 0 or #VALUE!), it will appear as invisible on excel,
59014
- // Making it very hard for the client to find where the recursion is.
59015
- if (cell.value === CellErrorType.CircularDependency) {
59016
- attrs.push(["t", "str"]);
59017
- cycle = escapeXml /*xml*/ `<v>${cell.value}</v>`;
59037
+ const type = getCellType(cell.value);
59038
+ if (type === undefined) {
59039
+ return { attrs: [], node: escapeXml `` };
59018
59040
  }
59019
- node = escapeXml /*xml*/ `<f>${XlsxFormula}</f>${cycle}`;
59041
+ const attrs = [["t", type]];
59042
+ const XlsxFormula = adaptFormulaToExcel(formula);
59043
+ const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${cell.value}</v>`;
59020
59044
  return { attrs, node };
59021
59045
  }
59022
59046
  function addContent(content, sharedStrings, forceString = false) {
@@ -60368,8 +60392,8 @@ stores.inject(MyMetaStore, storeInstance);
60368
60392
  joinSession() {
60369
60393
  this.session.join(this.config.client);
60370
60394
  }
60371
- leaveSession() {
60372
- this.session.leave(lazy(() => this.exportData()));
60395
+ async leaveSession() {
60396
+ await this.session.leave(lazy(() => this.exportData()));
60373
60397
  }
60374
60398
  setupUiPlugin(Plugin) {
60375
60399
  const plugin = new Plugin(this.uiPluginConfig);
@@ -60923,9 +60947,9 @@ stores.inject(MyMetaStore, storeInstance);
60923
60947
  exports.tokenize = tokenize;
60924
60948
 
60925
60949
 
60926
- __info__.version = "17.2.21";
60927
- __info__.date = "2024-08-19T08:10:10.580Z";
60928
- __info__.hash = "fb17f9c";
60950
+ __info__.version = "17.2.23";
60951
+ __info__.date = "2024-09-05T09:32:03.325Z";
60952
+ __info__.hash = "e5e2be8";
60929
60953
 
60930
60954
 
60931
60955
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);