@odoo/o-spreadsheet 17.1.7 → 17.1.9

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 17.1.7
6
- * @date 2024-03-12T07:56:10.783Z
7
- * @hash 3a9f334
5
+ * @version 17.1.9
6
+ * @date 2024-03-25T09:43:27.017Z
7
+ * @hash 5fb076e
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -11128,6 +11128,9 @@
11128
11128
  result.default = true;
11129
11129
  result.defaultValue = defaultValue;
11130
11130
  }
11131
+ if (types.some((t) => t.startsWith("RANGE"))) {
11132
+ result.acceptMatrix = true;
11133
+ }
11131
11134
  return result;
11132
11135
  }
11133
11136
  /**
@@ -19723,11 +19726,27 @@
19723
19726
  }
19724
19727
  const descr = addMetaInfoFromArg(addDescr);
19725
19728
  validateArguments(descr.args);
19726
- this.mapping[name] = addErrorHandling(addResultHandling(descr.compute), name);
19729
+ this.mapping[name] = addErrorHandling(addResultHandling(addInputHandling(descr)), name);
19727
19730
  super.add(name, descr);
19728
19731
  return this;
19729
19732
  }
19730
19733
  }
19734
+ function addInputHandling(descr) {
19735
+ function computeWithInputHandling(...args) {
19736
+ for (let i = 0; i < args.length; i++) {
19737
+ const argDefinition = descr.args[descr.getArgToFocus(i + 1) - 1];
19738
+ const arg = args[i];
19739
+ if (isMatrix(arg) && !argDefinition.acceptMatrix) {
19740
+ if (arg.length !== 1 || arg[0].length !== 1) {
19741
+ throw new EvaluationError(_t("Function [[FUNCTION_NAME]] expects the parameter '%s' to be a single value or a single cell reference, not a range.", argDefinition.name));
19742
+ }
19743
+ args[i] = arg[0][0];
19744
+ }
19745
+ }
19746
+ return descr.compute.apply(this, args);
19747
+ }
19748
+ return computeWithInputHandling;
19749
+ }
19731
19750
  function addErrorHandling(compute, functionName) {
19732
19751
  return function (...args) {
19733
19752
  try {
@@ -19978,14 +19997,19 @@
19978
19997
  children: [allFunctionListMenuBuilder],
19979
19998
  };
19980
19999
  function allFunctionListMenuBuilder() {
19981
- const fnNames = functionRegistry.getKeys();
20000
+ const fnNames = functionRegistry.getKeys().filter((key) => !functionRegistry.get(key).hidden);
19982
20001
  return createFormulaFunctions(fnNames);
19983
20002
  }
19984
20003
  const categoriesFunctionListMenuBuilder = () => {
19985
20004
  const functions = functionRegistry.content;
19986
- const categories = [...new Set(functionRegistry.getAll().map((fn) => fn.category))].filter(isDefined$1);
20005
+ const categories = [
20006
+ ...new Set(functionRegistry
20007
+ .getAll()
20008
+ .filter((fn) => !fn.hidden)
20009
+ .map((fn) => fn.category)),
20010
+ ].filter(isDefined$1);
19987
20011
  return categories.sort().map((category, i) => {
19988
- const functionsInCategory = Object.keys(functions).filter((key) => functions[key].category === category);
20012
+ const functionsInCategory = Object.keys(functions).filter((key) => functions[key].category === category && !functions[key].hidden);
19989
20013
  return {
19990
20014
  name: category,
19991
20015
  children: createFormulaFunctions(functionsInCategory),
@@ -23774,11 +23798,9 @@
23774
23798
  }
23775
23799
  .o-cell-is-operator {
23776
23800
  margin-bottom: 5px;
23777
- width: 96%;
23778
23801
  }
23779
23802
  .o-cell-is-value {
23780
23803
  margin-bottom: 5px;
23781
- width: 96%;
23782
23804
  }
23783
23805
  .o-color-picker-widget .o-color-picker-button {
23784
23806
  pointer-events: all;
@@ -26198,6 +26220,9 @@
26198
26220
  el?.focus({ preventScroll: true });
26199
26221
  }
26200
26222
  }, () => [this.env.model.getters.getSelectedFigureId(), this.props.figure.id, this.figureRef.el]);
26223
+ owl.onWillUnmount(() => {
26224
+ this.props.onFigureDeleted();
26225
+ });
26201
26226
  }
26202
26227
  clickAnchor(dirX, dirY, ev) {
26203
26228
  this.props.onClickAnchor(dirX, dirY, ev);
@@ -26216,6 +26241,7 @@
26216
26241
  this.props.onFigureDeleted();
26217
26242
  ev.stopPropagation();
26218
26243
  ev.preventDefault();
26244
+ ev.stopPropagation();
26219
26245
  break;
26220
26246
  case "ArrowDown":
26221
26247
  case "ArrowLeft":
@@ -26236,6 +26262,7 @@
26236
26262
  });
26237
26263
  ev.stopPropagation();
26238
26264
  ev.preventDefault();
26265
+ ev.stopPropagation();
26239
26266
  break;
26240
26267
  }
26241
26268
  }
@@ -26910,6 +26937,7 @@
26910
26937
  // -----------------------------------------------------------------------------
26911
26938
  css /* scss */ `
26912
26939
  .o-formula-assistant {
26940
+ background: #ffffff;
26913
26941
  .o-formula-assistant-head {
26914
26942
  background-color: #f2f2f2;
26915
26943
  padding: 10px;
@@ -26965,6 +26993,9 @@
26965
26993
  this.assistantState.allowCellSelectionBehind = false;
26966
26994
  }, 2000);
26967
26995
  }
26996
+ get formulaArgSeparator() {
26997
+ return this.env.model.getters.getLocale().formulaArgSeparator + " ";
26998
+ }
26968
26999
  }
26969
27000
 
26970
27001
  const functions$2 = functionRegistry.content;
@@ -27122,6 +27153,12 @@
27122
27153
  owl.useEffect(() => {
27123
27154
  this.processContent();
27124
27155
  });
27156
+ owl.onPatched(() => {
27157
+ // Required because typing '=SUM' and double-clicking another cell leaves ShowProvider/ShowDescription true
27158
+ if (this.env.model.getters.getEditionMode() === "inactive") {
27159
+ this.processTokenAtCursor();
27160
+ }
27161
+ });
27125
27162
  }
27126
27163
  // ---------------------------------------------------------------------------
27127
27164
  // Handlers
@@ -28037,7 +28074,7 @@
28037
28074
  function clamp(value, min, max) {
28038
28075
  return Math.min(Math.max(value, min), max);
28039
28076
  }
28040
- function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize) {
28077
+ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize, { scrollX, scrollY }) {
28041
28078
  let { x, y, width, height } = initialFigure;
28042
28079
  if (keepRatio && dirX != 0 && dirY != 0) {
28043
28080
  const deltaX = Math.min(dirX * (mouseInitialX - mouseX), initialFigure.width - minFigSize);
@@ -28064,14 +28101,14 @@
28064
28101
  y = initialFigure.y - deltaY;
28065
28102
  }
28066
28103
  }
28067
- // Restrict resizing if x or y reaches header boundaries
28068
- if (x < 0) {
28069
- width += x;
28070
- x = 0;
28104
+ // Adjusts figure dimensions to ensure it remains within header boundaries and viewport during resizing.
28105
+ if (x + scrollX <= 0) {
28106
+ width = width + x + scrollX;
28107
+ x = -scrollX;
28071
28108
  }
28072
- if (y < 0) {
28073
- height += y;
28074
- y = 0;
28109
+ if (y + scrollY <= 0) {
28110
+ height = height + y + scrollY;
28111
+ y = -scrollY;
28075
28112
  }
28076
28113
  return { ...initialFigure, x, y, width, height };
28077
28114
  }
@@ -28491,7 +28528,7 @@
28491
28528
  const minFigSize = figureRegistry.get(figure.tag).minFigSize || MIN_FIG_SIZE;
28492
28529
  const onMouseMove = (ev) => {
28493
28530
  const currentMousePosition = { x: ev.clientX, y: ev.clientY };
28494
- const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize);
28531
+ const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize, this.env.model.getters.getActiveSheetScrollInfo());
28495
28532
  const otherFigures = this.getOtherFigures(figure.id);
28496
28533
  const snapResult = snapForResize(this.env.model.getters, dirX, dirY, draggedFigure, otherFigures);
28497
28534
  this.dnd.draggedFigure = snapResult.snappedFigure;
@@ -37307,6 +37344,15 @@
37307
37344
  return "Success" /* CommandResult.Success */;
37308
37345
  }
37309
37346
  }
37347
+ beforeHandle(cmd) {
37348
+ switch (cmd.type) {
37349
+ case "DELETE_SHEET":
37350
+ this.getters.getFigures(cmd.sheetId).forEach((figure) => {
37351
+ this.dispatch("DELETE_FIGURE", { id: figure.id, sheetId: cmd.sheetId });
37352
+ });
37353
+ break;
37354
+ }
37355
+ }
37310
37356
  handle(cmd) {
37311
37357
  switch (cmd.type) {
37312
37358
  case "CREATE_SHEET":
@@ -49676,6 +49722,7 @@
49676
49722
  this.gridSelection.zones = this.gridSelection.zones.map((z) => this.getters.expandZone(sheetId, z));
49677
49723
  this.gridSelection.anchor.zone = this.getters.expandZone(sheetId, this.gridSelection.anchor.zone);
49678
49724
  this.setSelectionMixin(this.gridSelection.anchor, this.gridSelection.zones);
49725
+ this.selectedFigureId = null;
49679
49726
  break;
49680
49727
  }
49681
49728
  /** Any change to the selection has to be reflected in the selection processor. */
@@ -51545,6 +51592,9 @@
51545
51592
  this.scrollToSheet();
51546
51593
  }
51547
51594
  onDblClick() {
51595
+ if (this.env.model.getters.isReadonly()) {
51596
+ return;
51597
+ }
51548
51598
  this.startEdition();
51549
51599
  }
51550
51600
  onKeyDown(ev) {
@@ -53213,9 +53263,6 @@
53213
53263
  .text-muted {
53214
53264
  color: grey !important;
53215
53265
  }
53216
- button {
53217
- color: #333;
53218
- }
53219
53266
  .o-disabled {
53220
53267
  opacity: 0.4;
53221
53268
  pointer: default;
@@ -53336,17 +53383,17 @@
53336
53383
  }
53337
53384
 
53338
53385
  .o-button {
53339
- border: 1px solid lightgrey;
53386
+ border: 1px solid;
53340
53387
  padding: 0px 20px 0px 20px;
53341
53388
  border-radius: 4px;
53342
53389
  font-weight: 500;
53343
53390
  font-size: 14px;
53344
53391
  height: 30px;
53345
53392
  line-height: 16px;
53346
- background: white;
53347
53393
  margin-right: 8px;
53348
- &:hover:enabled {
53349
- background-color: rgba(0, 0, 0, 0.08);
53394
+
53395
+ &:not(:hover) {
53396
+ background-color: transparent;
53350
53397
  }
53351
53398
 
53352
53399
  &:enabled {
@@ -53360,6 +53407,15 @@
53360
53407
  &:last-child {
53361
53408
  margin-right: 0px;
53362
53409
  }
53410
+
53411
+ &.o-button-grey {
53412
+ border-color: lightgrey;
53413
+ background: #ffffff;
53414
+ color: #333;
53415
+ &:hover:enabled {
53416
+ background-color: rgba(0, 0, 0, 0.08);
53417
+ }
53418
+ }
53363
53419
  }
53364
53420
 
53365
53421
  .o-input {
@@ -57275,9 +57331,9 @@
57275
57331
  exports.tokenize = tokenize;
57276
57332
 
57277
57333
 
57278
- __info__.version = "17.1.7";
57279
- __info__.date = "2024-03-12T07:56:10.783Z";
57280
- __info__.hash = "3a9f334";
57334
+ __info__.version = "17.1.9";
57335
+ __info__.date = "2024-03-25T09:43:27.017Z";
57336
+ __info__.hash = "5fb076e";
57281
57337
 
57282
57338
 
57283
57339
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);