@odoo/o-spreadsheet 16.5.0-alpha.11 → 16.5.0-alpha.12

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 16.5.0-alpha.11
6
- * @date 2023-10-19T14:26:01.790Z
7
- * @hash 4b42059
5
+ * @version 16.5.0-alpha.12
6
+ * @date 2023-10-20T15:12:28.296Z
7
+ * @hash 430f090
8
8
  */
9
9
 
10
10
  import { Component, useRef, onMounted, useEffect, onWillPatch, useState, onWillUpdateProps, onPatched, useComponent, useExternalListener, onWillUnmount, onWillStart, xml, useChildSubEnv, useSubEnv, markRaw } from '@odoo/owl';
@@ -2058,6 +2058,7 @@ var CommandResult;
2058
2058
  CommandResult["InvalidDataValidationCriterionValue"] = "InvalidDataValidationCriterionValue";
2059
2059
  CommandResult["InvalidNumberOfCriterionValues"] = "InvalidNumberOfCriterionValues";
2060
2060
  CommandResult["BlockingValidationRule"] = "BlockingValidationRule";
2061
+ CommandResult["InvalidCopyPasteSelection"] = "InvalidCopyPasteSelection";
2061
2062
  })(CommandResult || (CommandResult = {}));
2062
2063
 
2063
2064
  const DEFAULT_LOCALES = [
@@ -4659,7 +4660,7 @@ class ChartJsComponent extends Component {
4659
4660
  return `background-color: ${this.background}`;
4660
4661
  }
4661
4662
  get chartRuntime() {
4662
- const runtime = this.env.model.getters.getChartRuntime(this.props.figureId);
4663
+ const runtime = this.env.model.getters.getChartRuntime(this.props.figure.id);
4663
4664
  if (!("chartJsConfig" in runtime)) {
4664
4665
  throw new Error("Unsupported chart runtime");
4665
4666
  }
@@ -4703,7 +4704,7 @@ class ChartJsComponent extends Component {
4703
4704
  }
4704
4705
  }
4705
4706
  ChartJsComponent.props = {
4706
- figureId: String,
4707
+ figure: Object,
4707
4708
  };
4708
4709
 
4709
4710
  /**
@@ -5105,6 +5106,8 @@ function checkBaseline(definition) {
5105
5106
  ? "InvalidScorecardBaseline" /* CommandResult.InvalidScorecardBaseline */
5106
5107
  : "Success" /* CommandResult.Success */;
5107
5108
  }
5109
+ const arrowDownPath = new window.Path2D("M8.6 4.8a.5.5 0 0 1 0 .75l-3.9 3.9a.5 .5 0 0 1 -.75 0l-3.8 -3.9a.5 .5 0 0 1 0 -.75l.4-.4a.5.5 0 0 1 .75 0l2.3 2.4v-5.7c0-.25.25-.5.5-.5h.6c.25 0 .5.25.5.5v5.8l2.3 -2.4a.5.5 0 0 1 .75 0z");
5110
+ const arrowUpPath = new window.Path2D("M8.7 5.5a.5.5 0 0 0 0-.75l-3.8-4a.5.5 0 0 0-.75 0l-3.8 4a.5.5 0 0 0 0 .75l.4.4a.5.5 0 0 0 .75 0l2.3-2.4v5.8c0 .25.25.5.5.5h.6c.25 0 .5-.25.5-.5v-5.8l2.2 2.4a.5.5 0 0 0 .75 0z");
5108
5111
  let ScorecardChart$1 = class ScorecardChart extends AbstractChart {
5109
5112
  keyValue;
5110
5113
  baseline;
@@ -5225,10 +5228,24 @@ function drawScoreChart(structure, canvas) {
5225
5228
  ctx.fillStyle = structure.baseline.style.color;
5226
5229
  drawDecoratedText(ctx, structure.baseline.text, structure.baseline.position, structure.baseline.style.underline, structure.baseline.style.strikethrough);
5227
5230
  }
5228
- if (structure.baselineArrow) {
5229
- ctx.font = structure.baselineArrow.style.font;
5231
+ if (structure.baselineArrow && structure.baselineArrow.style.size > 0) {
5232
+ ctx.save();
5230
5233
  ctx.fillStyle = structure.baselineArrow.style.color;
5231
- ctx.fillText(structure.baselineArrow.text, structure.baselineArrow.position.x, structure.baselineArrow.position.y);
5234
+ ctx.translate(structure.baselineArrow.position.x, structure.baselineArrow.position.y);
5235
+ // This ratio is computed according to the original svg size and the final size we want
5236
+ const ratio = structure.baselineArrow.style.size / 10;
5237
+ ctx.scale(ratio, ratio);
5238
+ switch (structure.baselineArrow.direction) {
5239
+ case "down": {
5240
+ ctx.fill(arrowDownPath);
5241
+ break;
5242
+ }
5243
+ case "up": {
5244
+ ctx.fill(arrowUpPath);
5245
+ break;
5246
+ }
5247
+ }
5248
+ ctx.restore();
5232
5249
  }
5233
5250
  if (structure.baselineDescr) {
5234
5251
  ctx.font = structure.baselineDescr.style.font;
@@ -5351,25 +5368,29 @@ class ScorecardChartConfigBuilder {
5351
5368
  },
5352
5369
  };
5353
5370
  }
5354
- const { height: baselineArrowHeight, width: baselineArrowWidth } = this.getTextDimensions(this.baselineArrow, style.baselineArrow.font);
5371
+ const baselineArrowSize = style.baselineArrow?.size ?? 0;
5355
5372
  const { height: baselineHeight, width: baselineWidth } = this.getTextDimensions(this.baseline, style.baselineValue.font);
5356
5373
  const { width: baselineDescrWidth } = this.getTextDimensions(this.baselineDescr, style.baselineDescr.font);
5357
5374
  structure.baseline = {
5358
5375
  text: this.baseline,
5359
5376
  style: style.baselineValue,
5360
5377
  position: {
5361
- x: (this.width - baselineWidth - baselineDescrWidth + baselineArrowWidth) / 2,
5362
- y: this.height - 2 * this.chartPadding,
5363
- },
5364
- };
5365
- structure.baselineArrow = {
5366
- text: this.baselineArrow,
5367
- style: style.baselineArrow,
5368
- position: {
5369
- x: structure.baseline.position.x - baselineArrowWidth,
5370
- y: structure.baseline.position.y - (baselineHeight - baselineArrowHeight) / 2,
5378
+ x: (this.width - baselineWidth - baselineDescrWidth + baselineArrowSize) / 2,
5379
+ y: this.keyValue
5380
+ ? this.height - 2 * this.chartPadding
5381
+ : this.height - (this.height - titleHeight - baselineHeight) / 2 - this.chartPadding,
5371
5382
  },
5372
5383
  };
5384
+ if (style.baselineArrow) {
5385
+ structure.baselineArrow = {
5386
+ direction: this.baselineArrow,
5387
+ style: style.baselineArrow,
5388
+ position: {
5389
+ x: structure.baseline.position.x - baselineArrowSize,
5390
+ y: structure.baseline.position.y - (baselineHeight + baselineArrowSize) / 2,
5391
+ },
5392
+ };
5393
+ }
5373
5394
  if (this.baselineDescr) {
5374
5395
  structure.baselineDescr = {
5375
5396
  text: this.baselineDescr,
@@ -5406,13 +5427,7 @@ class ScorecardChartConfigBuilder {
5406
5427
  return formatBaselineDescr(this.runtime.baselineDescr, this.baseline);
5407
5428
  }
5408
5429
  get baselineArrow() {
5409
- switch (this.runtime.baselineArrow) {
5410
- case "up":
5411
- return "\u{1F871}";
5412
- case "down":
5413
- return "\u{1F873}";
5414
- }
5415
- return "";
5430
+ return this.runtime.baselineArrow;
5416
5431
  }
5417
5432
  get backgroundColor() {
5418
5433
  return this.runtime.background;
@@ -5464,10 +5479,12 @@ class ScorecardChartConfigBuilder {
5464
5479
  font: getDefaultContextFont(baselineFontSize * BASELINE_DESCR_FONT_RATIO),
5465
5480
  color: this.secondaryFontColor,
5466
5481
  },
5467
- baselineArrow: {
5468
- font: getDefaultContextFont(0.8 * baselineFontSize),
5469
- color: this.runtime.baselineColor || this.secondaryFontColor,
5470
- },
5482
+ baselineArrow: this.baselineArrow === "neutral"
5483
+ ? undefined
5484
+ : {
5485
+ size: this.keyValue ? 0.8 * baselineFontSize : 0,
5486
+ color: this.runtime.baselineColor || this.secondaryFontColor,
5487
+ },
5471
5488
  };
5472
5489
  }
5473
5490
  /** Get the height of the chart minus all the vertical paddings */
@@ -5504,7 +5521,7 @@ class BaselineElement extends ScorecardScalableElement {
5504
5521
  }
5505
5522
  const baselineStr = chart.baseline;
5506
5523
  // Put mock text to simulate the width of the up/down arrow
5507
- const largeText = chart.baselineArrow !== "" ? "A " + baselineStr : baselineStr;
5524
+ const largeText = chart.baselineArrow !== "neutral" ? "A " + baselineStr : baselineStr;
5508
5525
  let textWidth = this.measureTextWidth(ctx, largeText, fontSize);
5509
5526
  // Baseline descr font size should be smaller than baseline font size
5510
5527
  textWidth += this.measureTextWidth(ctx, chart.baselineDescr, fontSize * BASELINE_DESCR_FONT_RATIO);
@@ -5541,7 +5558,7 @@ class ScorecardChart extends Component {
5541
5558
  static template = "o-spreadsheet-ScorecardChart";
5542
5559
  canvas = useRef("chartContainer");
5543
5560
  get runtime() {
5544
- return this.env.model.getters.getChartRuntime(this.props.figureId);
5561
+ return this.env.model.getters.getChartRuntime(this.props.figure.id);
5545
5562
  }
5546
5563
  setup() {
5547
5564
  useEffect(this.createChart.bind(this), () => {
@@ -5557,7 +5574,7 @@ class ScorecardChart extends Component {
5557
5574
  }
5558
5575
  }
5559
5576
  ScorecardChart.props = {
5560
- figureId: String,
5577
+ figure: Object,
5561
5578
  };
5562
5579
 
5563
5580
  /**
@@ -17087,7 +17104,7 @@ const PasteInteractiveContent = {
17087
17104
  wrongPasteSelection: _t("This operation is not allowed with multiple selections."),
17088
17105
  willRemoveExistingMerge: _t("This operation is not possible due to a merge. Please remove the merges first than try again."),
17089
17106
  wrongFigurePasteOption: _t("Cannot do a special paste of a figure."),
17090
- frozenPaneOverlap: _t("Cannot paste merged cells over a frozen pane."),
17107
+ frozenPaneOverlap: _t("This operation is not allowed due to an overlapping frozen pane."),
17091
17108
  };
17092
17109
  function handlePasteResult(env, result) {
17093
17110
  if (!result.isSuccessful) {
@@ -18627,11 +18644,11 @@ class ChartFigure extends Component {
18627
18644
  static template = "o-spreadsheet-ChartFigure";
18628
18645
  static components = {};
18629
18646
  onDoubleClick() {
18630
- this.env.model.dispatch("SELECT_FIGURE", { id: this.props.figureId });
18647
+ this.env.model.dispatch("SELECT_FIGURE", { id: this.props.figure.id });
18631
18648
  this.env.openSidePanel("ChartPanel");
18632
18649
  }
18633
18650
  get chartType() {
18634
- return this.env.model.getters.getChartType(this.props.figureId);
18651
+ return this.env.model.getters.getChartType(this.props.figure.id);
18635
18652
  }
18636
18653
  get chartComponent() {
18637
18654
  const type = this.chartType;
@@ -18643,7 +18660,7 @@ class ChartFigure extends Component {
18643
18660
  }
18644
18661
  }
18645
18662
  ChartFigure.props = {
18646
- figureId: String,
18663
+ figure: Object,
18647
18664
  onFigureDeleted: Function,
18648
18665
  };
18649
18666
 
@@ -18654,14 +18671,14 @@ class ImageFigure extends Component {
18654
18671
  // Getters
18655
18672
  // ---------------------------------------------------------------------------
18656
18673
  get figureId() {
18657
- return this.props.figureId;
18674
+ return this.props.figure.id;
18658
18675
  }
18659
18676
  get getImagePath() {
18660
18677
  return this.env.model.getters.getImagePath(this.figureId);
18661
18678
  }
18662
18679
  }
18663
18680
  ImageFigure.props = {
18664
- figureId: String,
18681
+ figure: Object,
18665
18682
  onFigureDeleted: Function,
18666
18683
  };
18667
18684
 
@@ -30113,6 +30130,8 @@ class Grid extends Component {
30113
30130
  const position = this.env.model.getters.getActivePosition();
30114
30131
  this.env.model.selection.selectZone({ cell: position, zone: newZone });
30115
30132
  },
30133
+ "CTRL+D": async () => this.env.model.dispatch("COPY_PASTE_CELLS_ABOVE"),
30134
+ "CTRL+R": async () => this.env.model.dispatch("COPY_PASTE_CELLS_ON_LEFT"),
30116
30135
  "CTRL+SHIFT+E": () => this.setHorizontalAlign("center"),
30117
30136
  "CTRL+SHIFT+L": () => this.setHorizontalAlign("left"),
30118
30137
  "CTRL+SHIFT+R": () => this.setHorizontalAlign("right"),
@@ -46515,6 +46534,20 @@ class ClipboardPlugin extends UIPlugin {
46515
46534
  const state = new ClipboardOsState(cmd.text, this.getters, this.dispatch, this.selection);
46516
46535
  return state.isPasteAllowed(cmd.target, { pasteOption: cmd.pasteOption });
46517
46536
  }
46537
+ case "COPY_PASTE_CELLS_ABOVE": {
46538
+ const zones = this.getters.getSelectedZones();
46539
+ if (zones.length > 1 || (zones[0].top === 0 && zones[0].bottom === 0)) {
46540
+ return "InvalidCopyPasteSelection" /* CommandResult.InvalidCopyPasteSelection */;
46541
+ }
46542
+ break;
46543
+ }
46544
+ case "COPY_PASTE_CELLS_ON_LEFT": {
46545
+ const zones = this.getters.getSelectedZones();
46546
+ if (zones.length > 1 || (zones[0].left === 0 && zones[0].right === 0)) {
46547
+ return "InvalidCopyPasteSelection" /* CommandResult.InvalidCopyPasteSelection */;
46548
+ }
46549
+ break;
46550
+ }
46518
46551
  case "INSERT_CELL": {
46519
46552
  const { cut, paste } = this.getInsertCellsTargets(cmd.zone, cmd.shiftDimension);
46520
46553
  const state = this.getClipboardStateForCopyCells(cut, "CUT");
@@ -46554,6 +46587,40 @@ class ClipboardPlugin extends UIPlugin {
46554
46587
  this.status = "invisible";
46555
46588
  }
46556
46589
  break;
46590
+ case "COPY_PASTE_CELLS_ABOVE":
46591
+ {
46592
+ const zone = this.getters.getSelectedZone();
46593
+ const multipleRowsInSelection = zone.top !== zone.bottom;
46594
+ const copyTarget = {
46595
+ ...zone,
46596
+ bottom: multipleRowsInSelection ? zone.top : zone.top - 1,
46597
+ top: multipleRowsInSelection ? zone.top : zone.top - 1,
46598
+ };
46599
+ const state = this.getClipboardStateForCopyCells([copyTarget], "COPY");
46600
+ state.paste([zone], {
46601
+ pasteOption: undefined,
46602
+ shouldPasteCF: true,
46603
+ selectTarget: true,
46604
+ });
46605
+ }
46606
+ break;
46607
+ case "COPY_PASTE_CELLS_ON_LEFT":
46608
+ {
46609
+ const zone = this.getters.getSelectedZone();
46610
+ const multipleColsInSelection = zone.left !== zone.right;
46611
+ const copyTarget = {
46612
+ ...zone,
46613
+ right: multipleColsInSelection ? zone.left : zone.left - 1,
46614
+ left: multipleColsInSelection ? zone.left : zone.left - 1,
46615
+ };
46616
+ const state = this.getClipboardStateForCopyCells([copyTarget], "COPY");
46617
+ state.paste([zone], {
46618
+ pasteOption: undefined,
46619
+ shouldPasteCF: true,
46620
+ selectTarget: true,
46621
+ });
46622
+ }
46623
+ break;
46557
46624
  case "CLEAN_CLIPBOARD_HIGHLIGHT":
46558
46625
  this.status = "invisible";
46559
46626
  break;
@@ -48093,11 +48160,19 @@ class GridSelectionPlugin extends UIPlugin {
48093
48160
  }
48094
48161
  }
48095
48162
  getStatisticFnResults() {
48096
- // get deduplicated cells in zones
48097
- const cells = new Set(this.gridSelection.zones
48098
- .map((zone) => this.getters.getEvaluatedCellsInZone(this.getters.getActiveSheetId(), zone))
48099
- .flat()
48100
- .filter((cell) => cell.type !== CellValueType.empty));
48163
+ const sheetId = this.getters.getActiveSheetId();
48164
+ const cells = new Set();
48165
+ for (const zone of this.gridSelection.zones) {
48166
+ for (const { col, row } of positions(zone)) {
48167
+ if (this.getters.isRowHidden(sheetId, row) || this.getters.isColHidden(sheetId, col)) {
48168
+ continue; // Skip hidden cells
48169
+ }
48170
+ const evaluatedCell = this.getters.getEvaluatedCell({ sheetId, col, row });
48171
+ if (evaluatedCell.type !== CellValueType.empty) {
48172
+ cells.add(evaluatedCell);
48173
+ }
48174
+ }
48175
+ }
48101
48176
  let cellsTypes = new Set();
48102
48177
  let cellsValues = [];
48103
48178
  for (let cell of cells) {
@@ -55420,6 +55495,6 @@ const constants = {
55420
55495
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
55421
55496
 
55422
55497
 
55423
- __info__.version = "16.5.0-alpha.11";
55424
- __info__.date = "2023-10-19T14:26:01.790Z";
55425
- __info__.hash = "4b42059";
55498
+ __info__.version = "16.5.0-alpha.12";
55499
+ __info__.date = "2023-10-20T15:12:28.296Z";
55500
+ __info__.hash = "430f090";
@@ -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 16.5.0-alpha.11
6
- * @date 2023-10-19T14:26:01.790Z
7
- * @hash 4b42059
5
+ * @version 16.5.0-alpha.12
6
+ * @date 2023-10-20T15:12:28.296Z
7
+ * @hash 430f090
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -2059,6 +2059,7 @@
2059
2059
  CommandResult["InvalidDataValidationCriterionValue"] = "InvalidDataValidationCriterionValue";
2060
2060
  CommandResult["InvalidNumberOfCriterionValues"] = "InvalidNumberOfCriterionValues";
2061
2061
  CommandResult["BlockingValidationRule"] = "BlockingValidationRule";
2062
+ CommandResult["InvalidCopyPasteSelection"] = "InvalidCopyPasteSelection";
2062
2063
  })(exports.CommandResult || (exports.CommandResult = {}));
2063
2064
 
2064
2065
  const DEFAULT_LOCALES = [
@@ -4660,7 +4661,7 @@
4660
4661
  return `background-color: ${this.background}`;
4661
4662
  }
4662
4663
  get chartRuntime() {
4663
- const runtime = this.env.model.getters.getChartRuntime(this.props.figureId);
4664
+ const runtime = this.env.model.getters.getChartRuntime(this.props.figure.id);
4664
4665
  if (!("chartJsConfig" in runtime)) {
4665
4666
  throw new Error("Unsupported chart runtime");
4666
4667
  }
@@ -4704,7 +4705,7 @@
4704
4705
  }
4705
4706
  }
4706
4707
  ChartJsComponent.props = {
4707
- figureId: String,
4708
+ figure: Object,
4708
4709
  };
4709
4710
 
4710
4711
  /**
@@ -5106,6 +5107,8 @@
5106
5107
  ? "InvalidScorecardBaseline" /* CommandResult.InvalidScorecardBaseline */
5107
5108
  : "Success" /* CommandResult.Success */;
5108
5109
  }
5110
+ const arrowDownPath = new window.Path2D("M8.6 4.8a.5.5 0 0 1 0 .75l-3.9 3.9a.5 .5 0 0 1 -.75 0l-3.8 -3.9a.5 .5 0 0 1 0 -.75l.4-.4a.5.5 0 0 1 .75 0l2.3 2.4v-5.7c0-.25.25-.5.5-.5h.6c.25 0 .5.25.5.5v5.8l2.3 -2.4a.5.5 0 0 1 .75 0z");
5111
+ const arrowUpPath = new window.Path2D("M8.7 5.5a.5.5 0 0 0 0-.75l-3.8-4a.5.5 0 0 0-.75 0l-3.8 4a.5.5 0 0 0 0 .75l.4.4a.5.5 0 0 0 .75 0l2.3-2.4v5.8c0 .25.25.5.5.5h.6c.25 0 .5-.25.5-.5v-5.8l2.2 2.4a.5.5 0 0 0 .75 0z");
5109
5112
  let ScorecardChart$1 = class ScorecardChart extends AbstractChart {
5110
5113
  keyValue;
5111
5114
  baseline;
@@ -5226,10 +5229,24 @@
5226
5229
  ctx.fillStyle = structure.baseline.style.color;
5227
5230
  drawDecoratedText(ctx, structure.baseline.text, structure.baseline.position, structure.baseline.style.underline, structure.baseline.style.strikethrough);
5228
5231
  }
5229
- if (structure.baselineArrow) {
5230
- ctx.font = structure.baselineArrow.style.font;
5232
+ if (structure.baselineArrow && structure.baselineArrow.style.size > 0) {
5233
+ ctx.save();
5231
5234
  ctx.fillStyle = structure.baselineArrow.style.color;
5232
- ctx.fillText(structure.baselineArrow.text, structure.baselineArrow.position.x, structure.baselineArrow.position.y);
5235
+ ctx.translate(structure.baselineArrow.position.x, structure.baselineArrow.position.y);
5236
+ // This ratio is computed according to the original svg size and the final size we want
5237
+ const ratio = structure.baselineArrow.style.size / 10;
5238
+ ctx.scale(ratio, ratio);
5239
+ switch (structure.baselineArrow.direction) {
5240
+ case "down": {
5241
+ ctx.fill(arrowDownPath);
5242
+ break;
5243
+ }
5244
+ case "up": {
5245
+ ctx.fill(arrowUpPath);
5246
+ break;
5247
+ }
5248
+ }
5249
+ ctx.restore();
5233
5250
  }
5234
5251
  if (structure.baselineDescr) {
5235
5252
  ctx.font = structure.baselineDescr.style.font;
@@ -5352,25 +5369,29 @@
5352
5369
  },
5353
5370
  };
5354
5371
  }
5355
- const { height: baselineArrowHeight, width: baselineArrowWidth } = this.getTextDimensions(this.baselineArrow, style.baselineArrow.font);
5372
+ const baselineArrowSize = style.baselineArrow?.size ?? 0;
5356
5373
  const { height: baselineHeight, width: baselineWidth } = this.getTextDimensions(this.baseline, style.baselineValue.font);
5357
5374
  const { width: baselineDescrWidth } = this.getTextDimensions(this.baselineDescr, style.baselineDescr.font);
5358
5375
  structure.baseline = {
5359
5376
  text: this.baseline,
5360
5377
  style: style.baselineValue,
5361
5378
  position: {
5362
- x: (this.width - baselineWidth - baselineDescrWidth + baselineArrowWidth) / 2,
5363
- y: this.height - 2 * this.chartPadding,
5364
- },
5365
- };
5366
- structure.baselineArrow = {
5367
- text: this.baselineArrow,
5368
- style: style.baselineArrow,
5369
- position: {
5370
- x: structure.baseline.position.x - baselineArrowWidth,
5371
- y: structure.baseline.position.y - (baselineHeight - baselineArrowHeight) / 2,
5379
+ x: (this.width - baselineWidth - baselineDescrWidth + baselineArrowSize) / 2,
5380
+ y: this.keyValue
5381
+ ? this.height - 2 * this.chartPadding
5382
+ : this.height - (this.height - titleHeight - baselineHeight) / 2 - this.chartPadding,
5372
5383
  },
5373
5384
  };
5385
+ if (style.baselineArrow) {
5386
+ structure.baselineArrow = {
5387
+ direction: this.baselineArrow,
5388
+ style: style.baselineArrow,
5389
+ position: {
5390
+ x: structure.baseline.position.x - baselineArrowSize,
5391
+ y: structure.baseline.position.y - (baselineHeight + baselineArrowSize) / 2,
5392
+ },
5393
+ };
5394
+ }
5374
5395
  if (this.baselineDescr) {
5375
5396
  structure.baselineDescr = {
5376
5397
  text: this.baselineDescr,
@@ -5407,13 +5428,7 @@
5407
5428
  return formatBaselineDescr(this.runtime.baselineDescr, this.baseline);
5408
5429
  }
5409
5430
  get baselineArrow() {
5410
- switch (this.runtime.baselineArrow) {
5411
- case "up":
5412
- return "\u{1F871}";
5413
- case "down":
5414
- return "\u{1F873}";
5415
- }
5416
- return "";
5431
+ return this.runtime.baselineArrow;
5417
5432
  }
5418
5433
  get backgroundColor() {
5419
5434
  return this.runtime.background;
@@ -5465,10 +5480,12 @@
5465
5480
  font: getDefaultContextFont(baselineFontSize * BASELINE_DESCR_FONT_RATIO),
5466
5481
  color: this.secondaryFontColor,
5467
5482
  },
5468
- baselineArrow: {
5469
- font: getDefaultContextFont(0.8 * baselineFontSize),
5470
- color: this.runtime.baselineColor || this.secondaryFontColor,
5471
- },
5483
+ baselineArrow: this.baselineArrow === "neutral"
5484
+ ? undefined
5485
+ : {
5486
+ size: this.keyValue ? 0.8 * baselineFontSize : 0,
5487
+ color: this.runtime.baselineColor || this.secondaryFontColor,
5488
+ },
5472
5489
  };
5473
5490
  }
5474
5491
  /** Get the height of the chart minus all the vertical paddings */
@@ -5505,7 +5522,7 @@
5505
5522
  }
5506
5523
  const baselineStr = chart.baseline;
5507
5524
  // Put mock text to simulate the width of the up/down arrow
5508
- const largeText = chart.baselineArrow !== "" ? "A " + baselineStr : baselineStr;
5525
+ const largeText = chart.baselineArrow !== "neutral" ? "A " + baselineStr : baselineStr;
5509
5526
  let textWidth = this.measureTextWidth(ctx, largeText, fontSize);
5510
5527
  // Baseline descr font size should be smaller than baseline font size
5511
5528
  textWidth += this.measureTextWidth(ctx, chart.baselineDescr, fontSize * BASELINE_DESCR_FONT_RATIO);
@@ -5542,7 +5559,7 @@
5542
5559
  static template = "o-spreadsheet-ScorecardChart";
5543
5560
  canvas = owl.useRef("chartContainer");
5544
5561
  get runtime() {
5545
- return this.env.model.getters.getChartRuntime(this.props.figureId);
5562
+ return this.env.model.getters.getChartRuntime(this.props.figure.id);
5546
5563
  }
5547
5564
  setup() {
5548
5565
  owl.useEffect(this.createChart.bind(this), () => {
@@ -5558,7 +5575,7 @@
5558
5575
  }
5559
5576
  }
5560
5577
  ScorecardChart.props = {
5561
- figureId: String,
5578
+ figure: Object,
5562
5579
  };
5563
5580
 
5564
5581
  /**
@@ -17088,7 +17105,7 @@
17088
17105
  wrongPasteSelection: _t("This operation is not allowed with multiple selections."),
17089
17106
  willRemoveExistingMerge: _t("This operation is not possible due to a merge. Please remove the merges first than try again."),
17090
17107
  wrongFigurePasteOption: _t("Cannot do a special paste of a figure."),
17091
- frozenPaneOverlap: _t("Cannot paste merged cells over a frozen pane."),
17108
+ frozenPaneOverlap: _t("This operation is not allowed due to an overlapping frozen pane."),
17092
17109
  };
17093
17110
  function handlePasteResult(env, result) {
17094
17111
  if (!result.isSuccessful) {
@@ -18628,11 +18645,11 @@
18628
18645
  static template = "o-spreadsheet-ChartFigure";
18629
18646
  static components = {};
18630
18647
  onDoubleClick() {
18631
- this.env.model.dispatch("SELECT_FIGURE", { id: this.props.figureId });
18648
+ this.env.model.dispatch("SELECT_FIGURE", { id: this.props.figure.id });
18632
18649
  this.env.openSidePanel("ChartPanel");
18633
18650
  }
18634
18651
  get chartType() {
18635
- return this.env.model.getters.getChartType(this.props.figureId);
18652
+ return this.env.model.getters.getChartType(this.props.figure.id);
18636
18653
  }
18637
18654
  get chartComponent() {
18638
18655
  const type = this.chartType;
@@ -18644,7 +18661,7 @@
18644
18661
  }
18645
18662
  }
18646
18663
  ChartFigure.props = {
18647
- figureId: String,
18664
+ figure: Object,
18648
18665
  onFigureDeleted: Function,
18649
18666
  };
18650
18667
 
@@ -18655,14 +18672,14 @@
18655
18672
  // Getters
18656
18673
  // ---------------------------------------------------------------------------
18657
18674
  get figureId() {
18658
- return this.props.figureId;
18675
+ return this.props.figure.id;
18659
18676
  }
18660
18677
  get getImagePath() {
18661
18678
  return this.env.model.getters.getImagePath(this.figureId);
18662
18679
  }
18663
18680
  }
18664
18681
  ImageFigure.props = {
18665
- figureId: String,
18682
+ figure: Object,
18666
18683
  onFigureDeleted: Function,
18667
18684
  };
18668
18685
 
@@ -30114,6 +30131,8 @@
30114
30131
  const position = this.env.model.getters.getActivePosition();
30115
30132
  this.env.model.selection.selectZone({ cell: position, zone: newZone });
30116
30133
  },
30134
+ "CTRL+D": async () => this.env.model.dispatch("COPY_PASTE_CELLS_ABOVE"),
30135
+ "CTRL+R": async () => this.env.model.dispatch("COPY_PASTE_CELLS_ON_LEFT"),
30117
30136
  "CTRL+SHIFT+E": () => this.setHorizontalAlign("center"),
30118
30137
  "CTRL+SHIFT+L": () => this.setHorizontalAlign("left"),
30119
30138
  "CTRL+SHIFT+R": () => this.setHorizontalAlign("right"),
@@ -46516,6 +46535,20 @@
46516
46535
  const state = new ClipboardOsState(cmd.text, this.getters, this.dispatch, this.selection);
46517
46536
  return state.isPasteAllowed(cmd.target, { pasteOption: cmd.pasteOption });
46518
46537
  }
46538
+ case "COPY_PASTE_CELLS_ABOVE": {
46539
+ const zones = this.getters.getSelectedZones();
46540
+ if (zones.length > 1 || (zones[0].top === 0 && zones[0].bottom === 0)) {
46541
+ return "InvalidCopyPasteSelection" /* CommandResult.InvalidCopyPasteSelection */;
46542
+ }
46543
+ break;
46544
+ }
46545
+ case "COPY_PASTE_CELLS_ON_LEFT": {
46546
+ const zones = this.getters.getSelectedZones();
46547
+ if (zones.length > 1 || (zones[0].left === 0 && zones[0].right === 0)) {
46548
+ return "InvalidCopyPasteSelection" /* CommandResult.InvalidCopyPasteSelection */;
46549
+ }
46550
+ break;
46551
+ }
46519
46552
  case "INSERT_CELL": {
46520
46553
  const { cut, paste } = this.getInsertCellsTargets(cmd.zone, cmd.shiftDimension);
46521
46554
  const state = this.getClipboardStateForCopyCells(cut, "CUT");
@@ -46555,6 +46588,40 @@
46555
46588
  this.status = "invisible";
46556
46589
  }
46557
46590
  break;
46591
+ case "COPY_PASTE_CELLS_ABOVE":
46592
+ {
46593
+ const zone = this.getters.getSelectedZone();
46594
+ const multipleRowsInSelection = zone.top !== zone.bottom;
46595
+ const copyTarget = {
46596
+ ...zone,
46597
+ bottom: multipleRowsInSelection ? zone.top : zone.top - 1,
46598
+ top: multipleRowsInSelection ? zone.top : zone.top - 1,
46599
+ };
46600
+ const state = this.getClipboardStateForCopyCells([copyTarget], "COPY");
46601
+ state.paste([zone], {
46602
+ pasteOption: undefined,
46603
+ shouldPasteCF: true,
46604
+ selectTarget: true,
46605
+ });
46606
+ }
46607
+ break;
46608
+ case "COPY_PASTE_CELLS_ON_LEFT":
46609
+ {
46610
+ const zone = this.getters.getSelectedZone();
46611
+ const multipleColsInSelection = zone.left !== zone.right;
46612
+ const copyTarget = {
46613
+ ...zone,
46614
+ right: multipleColsInSelection ? zone.left : zone.left - 1,
46615
+ left: multipleColsInSelection ? zone.left : zone.left - 1,
46616
+ };
46617
+ const state = this.getClipboardStateForCopyCells([copyTarget], "COPY");
46618
+ state.paste([zone], {
46619
+ pasteOption: undefined,
46620
+ shouldPasteCF: true,
46621
+ selectTarget: true,
46622
+ });
46623
+ }
46624
+ break;
46558
46625
  case "CLEAN_CLIPBOARD_HIGHLIGHT":
46559
46626
  this.status = "invisible";
46560
46627
  break;
@@ -48094,11 +48161,19 @@
48094
48161
  }
48095
48162
  }
48096
48163
  getStatisticFnResults() {
48097
- // get deduplicated cells in zones
48098
- const cells = new Set(this.gridSelection.zones
48099
- .map((zone) => this.getters.getEvaluatedCellsInZone(this.getters.getActiveSheetId(), zone))
48100
- .flat()
48101
- .filter((cell) => cell.type !== CellValueType.empty));
48164
+ const sheetId = this.getters.getActiveSheetId();
48165
+ const cells = new Set();
48166
+ for (const zone of this.gridSelection.zones) {
48167
+ for (const { col, row } of positions(zone)) {
48168
+ if (this.getters.isRowHidden(sheetId, row) || this.getters.isColHidden(sheetId, col)) {
48169
+ continue; // Skip hidden cells
48170
+ }
48171
+ const evaluatedCell = this.getters.getEvaluatedCell({ sheetId, col, row });
48172
+ if (evaluatedCell.type !== CellValueType.empty) {
48173
+ cells.add(evaluatedCell);
48174
+ }
48175
+ }
48176
+ }
48102
48177
  let cellsTypes = new Set();
48103
48178
  let cellsValues = [];
48104
48179
  for (let cell of cells) {
@@ -55454,9 +55529,9 @@
55454
55529
  exports.tokenize = tokenize;
55455
55530
 
55456
55531
 
55457
- __info__.version = "16.5.0-alpha.11";
55458
- __info__.date = "2023-10-19T14:26:01.790Z";
55459
- __info__.hash = "4b42059";
55532
+ __info__.version = "16.5.0-alpha.12";
55533
+ __info__.date = "2023-10-20T15:12:28.296Z";
55534
+ __info__.hash = "430f090";
55460
55535
 
55461
55536
 
55462
55537
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);