@odoo/o-spreadsheet 18.2.34 → 18.2.36

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.2.34
6
- * @date 2025-11-12T14:15:32.431Z
7
- * @hash 9ca0c4c
5
+ * @version 18.2.36
6
+ * @date 2025-12-02T05:31:10.558Z
7
+ * @hash d385099
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -3447,7 +3447,6 @@
3447
3447
  "REDO",
3448
3448
  "ADD_MERGE",
3449
3449
  "REMOVE_MERGE",
3450
- "DUPLICATE_SHEET",
3451
3450
  "UPDATE_LOCALE",
3452
3451
  "ADD_PIVOT",
3453
3452
  "UPDATE_PIVOT",
@@ -21165,6 +21164,7 @@ stores.inject(MyMetaStore, storeInstance);
21165
21164
  }
21166
21165
  this.selectionStart = start;
21167
21166
  this.selectionEnd = end;
21167
+ this.stopComposerRangeSelection();
21168
21168
  this.computeFormulaCursorContext();
21169
21169
  this.computeParenthesisRelatedToCursor();
21170
21170
  }
@@ -22209,7 +22209,6 @@ stores.inject(MyMetaStore, storeInstance);
22209
22209
  // replace the whole token
22210
22210
  start = tokenAtCursor.start;
22211
22211
  }
22212
- this.composer.stopComposerRangeSelection();
22213
22212
  this.composer.changeComposerCursorSelection(start, end);
22214
22213
  this.composer.replaceComposerCursorSelection(value);
22215
22214
  }
@@ -22227,7 +22226,6 @@ stores.inject(MyMetaStore, storeInstance);
22227
22226
  // replace the whole token
22228
22227
  start = tokenAtCursor.start;
22229
22228
  }
22230
- this.composer.stopComposerRangeSelection();
22231
22229
  this.composer.changeComposerCursorSelection(start, end);
22232
22230
  this.composer.replaceComposerCursorSelection(value);
22233
22231
  }
@@ -23353,29 +23351,34 @@ stores.inject(MyMetaStore, storeInstance);
23353
23351
  canvas.setAttribute("height", figure.height.toString());
23354
23352
  // we have to add the canvas to the DOM otherwise it won't be rendered
23355
23353
  document.body.append(div);
23354
+ let imgContent = undefined;
23356
23355
  if ("chartJsConfig" in runtime) {
23356
+ const extensionsLoaded = areChartJSExtensionsLoaded();
23357
+ if (!extensionsLoaded) {
23358
+ registerChartJSExtensions();
23359
+ }
23357
23360
  const config = deepCopy(runtime.chartJsConfig);
23358
23361
  config.plugins = [backgroundColorChartJSPlugin];
23359
23362
  const chart = new window.Chart(canvas, config);
23360
- const imgContent = chart.toBase64Image();
23363
+ imgContent = chart.toBase64Image();
23361
23364
  chart.destroy();
23362
23365
  div.remove();
23363
- return imgContent;
23366
+ if (!extensionsLoaded) {
23367
+ unregisterChartJsExtensions();
23368
+ }
23364
23369
  }
23365
23370
  else if (type === "scorecard") {
23366
23371
  const design = getScorecardConfiguration(figure, runtime);
23367
23372
  drawScoreChart(design, canvas);
23368
- const imgContent = canvas.toDataURL();
23373
+ imgContent = canvas.toDataURL();
23369
23374
  div.remove();
23370
- return imgContent;
23371
23375
  }
23372
23376
  else if (type === "gauge") {
23373
23377
  drawGaugeChart(canvas, runtime);
23374
- const imgContent = canvas.toDataURL();
23378
+ imgContent = canvas.toDataURL();
23375
23379
  div.remove();
23376
- return imgContent;
23377
23380
  }
23378
- return undefined;
23381
+ return imgContent;
23379
23382
  }
23380
23383
  /**
23381
23384
  * Custom chart.js plugin to set the background color of the canvas
@@ -41384,7 +41387,6 @@ stores.inject(MyMetaStore, storeInstance);
41384
41387
  return;
41385
41388
  }
41386
41389
  const newSelection = this.contentHelper.getCurrentSelection();
41387
- this.props.composerStore.stopComposerRangeSelection();
41388
41390
  this.props.onComposerContentFocused();
41389
41391
  this.props.composerStore.changeComposerCursorSelection(newSelection.start, newSelection.end);
41390
41392
  this.processTokenAtCursor();
@@ -47513,7 +47515,6 @@ stores.inject(MyMetaStore, storeInstance);
47513
47515
  pivotRegistry.add("SPREADSHEET", {
47514
47516
  ui: SpreadsheetPivot,
47515
47517
  definition: SpreadsheetPivotRuntimeDefinition,
47516
- externalData: false,
47517
47518
  dateGranularities: [...dateGranularities],
47518
47519
  datetimeGranularities: [...dateGranularities, "hour_number", "minute_number", "second_number"],
47519
47520
  isMeasureCandidate: (field) => field.type !== "boolean",
@@ -51373,7 +51374,10 @@ stores.inject(MyMetaStore, storeInstance);
51373
51374
  this.state.waitingForMove = false;
51374
51375
  }
51375
51376
  onMouseMove(ev) {
51376
- if (this.state.isResizing || this.state.isMoving || this.state.isSelecting) {
51377
+ if (this.env.model.getters.isReadonly() ||
51378
+ this.state.isResizing ||
51379
+ this.state.isMoving ||
51380
+ this.state.isSelecting) {
51377
51381
  return;
51378
51382
  }
51379
51383
  this._computeHandleDisplay(ev);
@@ -51426,6 +51430,10 @@ stores.inject(MyMetaStore, storeInstance);
51426
51430
  if (index < 0) {
51427
51431
  return;
51428
51432
  }
51433
+ if (this.env.model.getters.isReadonly()) {
51434
+ this._selectElement(index, false);
51435
+ return;
51436
+ }
51429
51437
  if (this.state.waitingForMove) {
51430
51438
  if (!this.env.model.getters.isGridSelectionActive()) {
51431
51439
  this._selectElement(index, false);
@@ -53127,24 +53135,24 @@ stores.inject(MyMetaStore, storeInstance);
53127
53135
  const MIN_SHEET_VIEW_WIDTH = 150;
53128
53136
  class SidePanelStore extends SpreadsheetStore {
53129
53137
  mutators = ["open", "toggle", "close", "changePanelSize", "resetPanelSize"];
53130
- initialPanelProps = {};
53138
+ currentPanelProps = {};
53131
53139
  componentTag = "";
53132
53140
  panelSize = DEFAULT_SIDE_PANEL_SIZE;
53133
53141
  get isOpen() {
53134
53142
  if (!this.componentTag) {
53135
53143
  return false;
53136
53144
  }
53137
- return this.computeState(this.componentTag, this.initialPanelProps).isOpen;
53145
+ return this.computeState(this.componentTag, this.currentPanelProps).isOpen;
53138
53146
  }
53139
53147
  get panelProps() {
53140
- const state = this.computeState(this.componentTag, this.initialPanelProps);
53148
+ const state = this.computeState(this.componentTag, this.currentPanelProps);
53141
53149
  if (state.isOpen) {
53142
53150
  return state.props ?? {};
53143
53151
  }
53144
53152
  return {};
53145
53153
  }
53146
53154
  get panelKey() {
53147
- const state = this.computeState(this.componentTag, this.initialPanelProps);
53155
+ const state = this.computeState(this.componentTag, this.currentPanelProps);
53148
53156
  if (state.isOpen) {
53149
53157
  return state.key;
53150
53158
  }
@@ -53156,10 +53164,10 @@ stores.inject(MyMetaStore, storeInstance);
53156
53164
  return;
53157
53165
  }
53158
53166
  if (this.isOpen && componentTag !== this.componentTag) {
53159
- this.initialPanelProps?.onCloseSidePanel?.();
53167
+ this.currentPanelProps?.onCloseSidePanel?.();
53160
53168
  }
53161
53169
  this.componentTag = componentTag;
53162
- this.initialPanelProps = state.props ?? {};
53170
+ this.currentPanelProps = state.props ?? {};
53163
53171
  }
53164
53172
  toggle(componentTag, panelProps) {
53165
53173
  if (this.isOpen && componentTag === this.componentTag) {
@@ -53170,8 +53178,8 @@ stores.inject(MyMetaStore, storeInstance);
53170
53178
  }
53171
53179
  }
53172
53180
  close() {
53173
- this.initialPanelProps.onCloseSidePanel?.();
53174
- this.initialPanelProps = {};
53181
+ this.currentPanelProps.onCloseSidePanel?.();
53182
+ this.currentPanelProps = {};
53175
53183
  this.componentTag = "";
53176
53184
  }
53177
53185
  changePanelSize(size, spreadsheetElWidth) {
@@ -53197,7 +53205,11 @@ stores.inject(MyMetaStore, storeInstance);
53197
53205
  };
53198
53206
  }
53199
53207
  else {
53200
- return customComputeState(this.getters, panelProps);
53208
+ const state = customComputeState(this.getters, panelProps);
53209
+ if (state.isOpen) {
53210
+ this.currentPanelProps = state.props ?? this.currentPanelProps;
53211
+ }
53212
+ return state;
53201
53213
  }
53202
53214
  }
53203
53215
  }
@@ -60000,10 +60012,17 @@ stores.inject(MyMetaStore, storeInstance);
60000
60012
  if (!pivot) {
60001
60013
  continue;
60002
60014
  }
60003
- for (const measure of pivot.definition.measures) {
60015
+ const def = deepCopy(pivot.definition);
60016
+ for (const measure of def.measures) {
60004
60017
  if (measure.computedBy?.formula === formulaString) {
60005
- const measureIndex = pivot.definition.measures.indexOf(measure);
60006
- this.history.update("pivots", pivotId, "definition", "measures", measureIndex, "computedBy", { formula: newFormulaString, sheetId });
60018
+ const measureIndex = def.measures.indexOf(measure);
60019
+ if (measureIndex !== -1) {
60020
+ def.measures[measureIndex].computedBy = {
60021
+ formula: newFormulaString,
60022
+ sheetId,
60023
+ };
60024
+ }
60025
+ this.dispatch("UPDATE_PIVOT", { pivotId, pivot: def });
60007
60026
  }
60008
60027
  }
60009
60028
  }
@@ -60156,6 +60175,9 @@ stores.inject(MyMetaStore, storeInstance);
60156
60175
  const { sheetId, zone } = definition.dataSet;
60157
60176
  const range = this.getters.getRangeFromZone(sheetId, zone);
60158
60177
  const adaptedRange = adaptPivotRange(range, applyChange);
60178
+ if (adaptedRange === range) {
60179
+ return;
60180
+ }
60159
60181
  const dataSet = adaptedRange && {
60160
60182
  sheetId: adaptedRange.sheetId,
60161
60183
  zone: adaptedRange.zone,
@@ -63878,9 +63900,7 @@ stores.inject(MyMetaStore, storeInstance);
63878
63900
  handle(cmd) {
63879
63901
  if (invalidateEvaluationCommands.has(cmd.type)) {
63880
63902
  for (const pivotId of this.getters.getPivotIds()) {
63881
- if (!pivotRegistry.get(this.getters.getPivotCoreDefinition(pivotId).type).externalData) {
63882
- this.setupPivot(pivotId, { recreate: true });
63883
- }
63903
+ this.setupPivot(pivotId, { recreate: true });
63884
63904
  }
63885
63905
  }
63886
63906
  switch (cmd.type) {
@@ -64081,7 +64101,7 @@ stores.inject(MyMetaStore, storeInstance);
64081
64101
  pivot.init({ reload: true });
64082
64102
  }
64083
64103
  setupPivot(pivotId, { recreate } = { recreate: false }) {
64084
- const definition = this.getters.getPivotCoreDefinition(pivotId);
64104
+ const definition = deepCopy(this.getters.getPivotCoreDefinition(pivotId));
64085
64105
  if (!(pivotId in this.pivots)) {
64086
64106
  const Pivot = withPivotPresentationLayer(pivotRegistry.get(definition.type).ui);
64087
64107
  this.pivots[pivotId] = new Pivot(this.custom, { definition, getters: this.getters });
@@ -72679,7 +72699,7 @@ stores.inject(MyMetaStore, storeInstance);
72679
72699
  border-radius: 4px;
72680
72700
  font-weight: 500;
72681
72701
  font-size: 14px;
72682
- height: 32px;
72702
+ min-height: 32px;
72683
72703
  line-height: 16px;
72684
72704
  flex-grow: 1;
72685
72705
  background-color: ${BUTTON_BG};
@@ -77384,9 +77404,9 @@ stores.inject(MyMetaStore, storeInstance);
77384
77404
  exports.tokenize = tokenize;
77385
77405
 
77386
77406
 
77387
- __info__.version = "18.2.34";
77388
- __info__.date = "2025-11-12T14:15:32.431Z";
77389
- __info__.hash = "9ca0c4c";
77407
+ __info__.version = "18.2.36";
77408
+ __info__.date = "2025-12-02T05:31:10.558Z";
77409
+ __info__.hash = "d385099";
77390
77410
 
77391
77411
 
77392
77412
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);