@odoo/o-spreadsheet 17.0.14 → 17.0.16

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.0.14
6
- * @date 2024-03-12T07:56:15.364Z
7
- * @hash 6f6e1b9
5
+ * @version 17.0.16
6
+ * @date 2024-03-25T09:42:01.717Z
7
+ * @hash 9b128f8
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -11056,6 +11056,9 @@
11056
11056
  result.default = true;
11057
11057
  result.defaultValue = defaultValue;
11058
11058
  }
11059
+ if (types.some((t) => t.startsWith("RANGE"))) {
11060
+ result.acceptMatrix = true;
11061
+ }
11059
11062
  return result;
11060
11063
  }
11061
11064
  /**
@@ -19421,11 +19424,27 @@
19421
19424
  }
19422
19425
  const descr = addMetaInfoFromArg(addDescr);
19423
19426
  validateArguments(descr.args);
19424
- this.mapping[name] = createComputeFunctionFromDescription(descr);
19427
+ this.mapping[name] = addInputHandling(descr, createComputeFunctionFromDescription(descr));
19425
19428
  super.add(name, descr);
19426
19429
  return this;
19427
19430
  }
19428
19431
  }
19432
+ function addInputHandling(descr, computeFunction) {
19433
+ function computeWithInputHandling(...args) {
19434
+ for (let i = 0; i < args.length; i++) {
19435
+ const argDefinition = descr.args[descr.getArgToFocus(i + 1) - 1];
19436
+ const arg = args[i];
19437
+ if (isMatrix(arg) && !argDefinition.acceptMatrix) {
19438
+ if (arg.length !== 1 || arg[0].length !== 1) {
19439
+ throw new EvaluationError(CellErrorType.GenericError, _t("Function [[FUNCTION_NAME]] expects the parameter '%s' to be a single value or a single cell reference, not a range.", argDefinition.name));
19440
+ }
19441
+ args[i] = arg[0][0];
19442
+ }
19443
+ }
19444
+ return computeFunction.apply(this, args);
19445
+ }
19446
+ return computeWithInputHandling;
19447
+ }
19429
19448
  function createComputeFunctionFromDescription(descr) {
19430
19449
  const computeValueAndFormat = "computeValueAndFormat" in descr;
19431
19450
  const computeValue = "compute" in descr;
@@ -19676,14 +19695,19 @@
19676
19695
  children: [allFunctionListMenuBuilder],
19677
19696
  };
19678
19697
  function allFunctionListMenuBuilder() {
19679
- const fnNames = functionRegistry.getKeys();
19698
+ const fnNames = functionRegistry.getKeys().filter((key) => !functionRegistry.get(key).hidden);
19680
19699
  return createFormulaFunctions(fnNames);
19681
19700
  }
19682
19701
  const categoriesFunctionListMenuBuilder = () => {
19683
19702
  const functions = functionRegistry.content;
19684
- const categories = [...new Set(functionRegistry.getAll().map((fn) => fn.category))].filter(isDefined$1);
19703
+ const categories = [
19704
+ ...new Set(functionRegistry
19705
+ .getAll()
19706
+ .filter((fn) => !fn.hidden)
19707
+ .map((fn) => fn.category)),
19708
+ ].filter(isDefined$1);
19685
19709
  return categories.sort().map((category, i) => {
19686
- const functionsInCategory = Object.keys(functions).filter((key) => functions[key].category === category);
19710
+ const functionsInCategory = Object.keys(functions).filter((key) => functions[key].category === category && !functions[key].hidden);
19687
19711
  return {
19688
19712
  name: category,
19689
19713
  children: createFormulaFunctions(functionsInCategory),
@@ -23336,11 +23360,9 @@
23336
23360
  }
23337
23361
  .o-cell-is-operator {
23338
23362
  margin-bottom: 5px;
23339
- width: 96%;
23340
23363
  }
23341
23364
  .o-cell-is-value {
23342
23365
  margin-bottom: 5px;
23343
- width: 96%;
23344
23366
  }
23345
23367
  .o-color-picker-widget .o-color-picker-button {
23346
23368
  pointer-events: all;
@@ -25706,6 +25728,9 @@
25706
25728
  el?.focus({ preventScroll: true });
25707
25729
  }
25708
25730
  }, () => [this.env.model.getters.getSelectedFigureId(), this.props.figure.id, this.figureRef.el]);
25731
+ owl.onWillUnmount(() => {
25732
+ this.props.onFigureDeleted();
25733
+ });
25709
25734
  }
25710
25735
  clickAnchor(dirX, dirY, ev) {
25711
25736
  this.props.onClickAnchor(dirX, dirY, ev);
@@ -25724,6 +25749,7 @@
25724
25749
  this.props.onFigureDeleted();
25725
25750
  ev.stopPropagation();
25726
25751
  ev.preventDefault();
25752
+ ev.stopPropagation();
25727
25753
  break;
25728
25754
  case "ArrowDown":
25729
25755
  case "ArrowLeft":
@@ -25744,6 +25770,7 @@
25744
25770
  });
25745
25771
  ev.stopPropagation();
25746
25772
  ev.preventDefault();
25773
+ ev.stopPropagation();
25747
25774
  break;
25748
25775
  }
25749
25776
  }
@@ -26425,6 +26452,7 @@
26425
26452
  // -----------------------------------------------------------------------------
26426
26453
  css /* scss */ `
26427
26454
  .o-formula-assistant {
26455
+ background: #ffffff;
26428
26456
  .o-formula-assistant-head {
26429
26457
  background-color: #f2f2f2;
26430
26458
  padding: 10px;
@@ -26475,6 +26503,9 @@
26475
26503
  this.assistantState.allowCellSelectionBehind = false;
26476
26504
  }, 2000);
26477
26505
  }
26506
+ get formulaArgSeparator() {
26507
+ return this.env.model.getters.getLocale().formulaArgSeparator + " ";
26508
+ }
26478
26509
  }
26479
26510
  FunctionDescriptionProvider.props = {
26480
26511
  functionName: String,
@@ -26626,6 +26657,12 @@
26626
26657
  owl.useEffect(() => {
26627
26658
  this.processContent();
26628
26659
  });
26660
+ owl.onPatched(() => {
26661
+ // Required because typing '=SUM' and double-clicking another cell leaves ShowProvider/ShowDescription true
26662
+ if (this.env.model.getters.getEditionMode() === "inactive") {
26663
+ this.processTokenAtCursor();
26664
+ }
26665
+ });
26629
26666
  }
26630
26667
  // ---------------------------------------------------------------------------
26631
26668
  // Handlers
@@ -27543,7 +27580,7 @@
27543
27580
  function clamp(value, min, max) {
27544
27581
  return Math.min(Math.max(value, min), max);
27545
27582
  }
27546
- function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize) {
27583
+ function dragFigureForResize(initialFigure, dirX, dirY, { x: mouseX, y: mouseY }, { x: mouseInitialX, y: mouseInitialY }, keepRatio, minFigSize, { scrollX, scrollY }) {
27547
27584
  let { x, y, width, height } = initialFigure;
27548
27585
  if (keepRatio && dirX != 0 && dirY != 0) {
27549
27586
  const deltaX = Math.min(dirX * (mouseInitialX - mouseX), initialFigure.width - minFigSize);
@@ -27570,14 +27607,14 @@
27570
27607
  y = initialFigure.y - deltaY;
27571
27608
  }
27572
27609
  }
27573
- // Restrict resizing if x or y reaches header boundaries
27574
- if (x < 0) {
27575
- width += x;
27576
- x = 0;
27610
+ // Adjusts figure dimensions to ensure it remains within header boundaries and viewport during resizing.
27611
+ if (x + scrollX <= 0) {
27612
+ width = width + x + scrollX;
27613
+ x = -scrollX;
27577
27614
  }
27578
- if (y < 0) {
27579
- height += y;
27580
- y = 0;
27615
+ if (y + scrollY <= 0) {
27616
+ height = height + y + scrollY;
27617
+ y = -scrollY;
27581
27618
  }
27582
27619
  return { ...initialFigure, x, y, width, height };
27583
27620
  }
@@ -27994,7 +28031,7 @@
27994
28031
  const minFigSize = figureRegistry.get(figure.tag).minFigSize || MIN_FIG_SIZE;
27995
28032
  const onMouseMove = (ev) => {
27996
28033
  const currentMousePosition = { x: ev.clientX, y: ev.clientY };
27997
- const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize);
28034
+ const draggedFigure = dragFigureForResize(initialFig, dirX, dirY, currentMousePosition, initialMousePosition, keepRatio, minFigSize, this.env.model.getters.getActiveSheetScrollInfo());
27998
28035
  const otherFigures = this.getOtherFigures(figure.id);
27999
28036
  const snapResult = snapForResize(this.env.model.getters, dirX, dirY, draggedFigure, otherFigures);
28000
28037
  this.dnd.draggedFigure = snapResult.snappedFigure;
@@ -36824,6 +36861,15 @@
36824
36861
  return "Success" /* CommandResult.Success */;
36825
36862
  }
36826
36863
  }
36864
+ beforeHandle(cmd) {
36865
+ switch (cmd.type) {
36866
+ case "DELETE_SHEET":
36867
+ this.getters.getFigures(cmd.sheetId).forEach((figure) => {
36868
+ this.dispatch("DELETE_FIGURE", { id: figure.id, sheetId: cmd.sheetId });
36869
+ });
36870
+ break;
36871
+ }
36872
+ }
36827
36873
  handle(cmd) {
36828
36874
  switch (cmd.type) {
36829
36875
  case "CREATE_SHEET":
@@ -41577,7 +41623,7 @@
41577
41623
  ? getItemId(newFormat, data.formats)
41578
41624
  : exportedCellData.format;
41579
41625
  let content;
41580
- if (formulaCell instanceof FormulaCellWithDependencies) {
41626
+ if (isFormula && formulaCell instanceof FormulaCellWithDependencies) {
41581
41627
  content = this.getters.getFormulaCellContent(exportedSheetData.id, formulaCell.compiledFormula, formulaCell.compiledFormula.dependencies, true);
41582
41628
  }
41583
41629
  else {
@@ -49287,6 +49333,7 @@
49287
49333
  this.gridSelection.zones = this.gridSelection.zones.map((z) => this.getters.expandZone(sheetId, z));
49288
49334
  this.gridSelection.anchor.zone = this.getters.expandZone(sheetId, this.gridSelection.anchor.zone);
49289
49335
  this.setSelectionMixin(this.gridSelection.anchor, this.gridSelection.zones);
49336
+ this.selectedFigureId = null;
49290
49337
  break;
49291
49338
  }
49292
49339
  /** Any change to the selection has to be reflected in the selection processor. */
@@ -51181,6 +51228,9 @@
51181
51228
  this.scrollToSheet();
51182
51229
  }
51183
51230
  onDblClick() {
51231
+ if (this.env.model.getters.isReadonly()) {
51232
+ return;
51233
+ }
51184
51234
  this.startEdition();
51185
51235
  }
51186
51236
  onKeyDown(ev) {
@@ -52861,9 +52911,6 @@
52861
52911
  .text-muted {
52862
52912
  color: grey !important;
52863
52913
  }
52864
- button {
52865
- color: #333;
52866
- }
52867
52914
  .o-disabled {
52868
52915
  opacity: 0.4;
52869
52916
  pointer: default;
@@ -52984,17 +53031,17 @@
52984
53031
  }
52985
53032
 
52986
53033
  .o-button {
52987
- border: 1px solid lightgrey;
53034
+ border: 1px solid;
52988
53035
  padding: 0px 20px 0px 20px;
52989
53036
  border-radius: 4px;
52990
53037
  font-weight: 500;
52991
53038
  font-size: 14px;
52992
53039
  height: 30px;
52993
53040
  line-height: 16px;
52994
- background: white;
52995
53041
  margin-right: 8px;
52996
- &:hover:enabled {
52997
- background-color: rgba(0, 0, 0, 0.08);
53042
+
53043
+ &:not(:hover) {
53044
+ background-color: transparent;
52998
53045
  }
52999
53046
 
53000
53047
  &:enabled {
@@ -53008,6 +53055,15 @@
53008
53055
  &:last-child {
53009
53056
  margin-right: 0px;
53010
53057
  }
53058
+
53059
+ &.o-button-grey {
53060
+ border-color: lightgrey;
53061
+ background: #ffffff;
53062
+ color: #333;
53063
+ &:hover:enabled {
53064
+ background-color: rgba(0, 0, 0, 0.08);
53065
+ }
53066
+ }
53011
53067
  }
53012
53068
 
53013
53069
  .o-input {
@@ -56955,9 +57011,9 @@
56955
57011
  exports.tokenize = tokenize;
56956
57012
 
56957
57013
 
56958
- __info__.version = "17.0.14";
56959
- __info__.date = "2024-03-12T07:56:15.364Z";
56960
- __info__.hash = "6f6e1b9";
57014
+ __info__.version = "17.0.16";
57015
+ __info__.date = "2024-03-25T09:42:01.717Z";
57016
+ __info__.hash = "9b128f8";
56961
57017
 
56962
57018
 
56963
57019
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);