@odoo/o-spreadsheet 16.1.33 → 16.1.37

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.
@@ -341,6 +341,10 @@ type SelectionEvent = Readonly<ZonesSelected | HeadersSelected | AlterZoneCorner
341
341
 
342
342
  interface StreamCallbacks<Event> {
343
343
  handleEvent: (event: Event) => void;
344
+ /** this callback will only be called when another consumer captures the stream,
345
+ * not when the current consumer decides to release the stream itself as it could
346
+ * have react differently to both situations.
347
+ * */
344
348
  release?: () => void;
345
349
  }
346
350
 
@@ -479,8 +483,13 @@ declare class SelectionStreamProcessor implements SelectionProcessor, StatefulSt
479
483
  */
480
484
  private getEndOfCluster;
481
485
  /**
482
- * Check if a cell is empty or undefined in the model. If the cell is part of a merge,
483
- * check if the merge containing the cell is empty.
486
+ * Check if a cell evaluated value is empty. If the cell is part of a merge,
487
+ * the check applies to the main cell of the merge.
488
+ */
489
+ private isEvaluatedCellEmpty;
490
+ /**
491
+ * Checks if a cell is empty (i.e. does not have a content). If the cell is part of a merge,
492
+ * the check applies to the main cell of the merge.
484
493
  */
485
494
  private isCellEmpty;
486
495
  /** Computes the next cell position in the given direction by crossing through merges and skipping hidden cells.
@@ -1426,7 +1435,6 @@ declare class EditionPlugin extends UIPlugin {
1426
1435
  allowDispatch(cmd: Command): CommandResult;
1427
1436
  private handleEvent;
1428
1437
  handle(cmd: Command): void;
1429
- unsubscribe(): void;
1430
1438
  getEditionMode(): EditionMode;
1431
1439
  getCurrentContent(): string;
1432
1440
  getEditionSheet(): string;
@@ -2679,6 +2687,12 @@ interface ClipboardInterface {
2679
2687
  readText(): Promise<ClipboardReadResult>;
2680
2688
  }
2681
2689
 
2690
+ declare class FocusableElement {
2691
+ private focusableElement;
2692
+ setFocusableElement(element: HTMLElement): void;
2693
+ focus(): void;
2694
+ }
2695
+
2682
2696
  type TranslationFunction = (string: string, ...values: string[] | [{
2683
2697
  [key: string]: string;
2684
2698
  }]) => string;
@@ -2711,6 +2725,7 @@ interface SpreadsheetChildEnv extends SpreadsheetEnv {
2711
2725
  clipboard: ClipboardInterface;
2712
2726
  _t: TranslationFunction;
2713
2727
  loadCurrencies?: () => Promise<Currency[]>;
2728
+ focusableElement: FocusableElement;
2714
2729
  }
2715
2730
 
2716
2731
  type ArgType = "ANY" | "BOOLEAN" | "NUMBER" | "STRING" | "DATE" | "RANGE" | "RANGE<BOOLEAN>" | "RANGE<NUMBER>" | "RANGE<DATE>" | "RANGE<STRING>" | "META";
@@ -3005,8 +3020,9 @@ declare class RangeAdapter implements CommandHandler<CoreCommand> {
3005
3020
  *
3006
3021
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
3007
3022
  * @param forSheetId the id of the sheet where the range string is supposed to be used.
3023
+ * @param [useFixedZone=false] if true, the range will be returned with fixed row and column
3008
3024
  */
3009
- getRangeString(range: Range, forSheetId: UID): string;
3025
+ getRangeString(range: Range, forSheetId: UID, useFixedZone?: boolean): string;
3010
3026
  getRangeDataFromXc(sheetId: UID, xc: string): RangeData;
3011
3027
  getRangeDataFromZone(sheetId: UID, zone: Zone): RangeData;
3012
3028
  getRangeFromRangeData(data: RangeData): Range;
@@ -3224,7 +3240,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3224
3240
  * starting an async evaluation even if it has been moved or re-allocated
3225
3241
  */
3226
3242
  getCellById(cellId: UID): Cell | undefined;
3227
- buildFormulaContent(sheetId: UID, cell: Pick<FormulaCell, "dependencies" | "compiledFormula">, dependencies?: Range[]): string;
3243
+ buildFormulaContent(sheetId: UID, cell: Pick<FormulaCell, "dependencies" | "compiledFormula">, dependencies?: Range[], useFixedZone?: boolean): string;
3228
3244
  getFormulaCellContent(sheetId: UID, cell: FormulaCell): string;
3229
3245
  getCellStyle(position: CellPosition): Style;
3230
3246
  /**
@@ -3270,6 +3286,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3270
3286
  private createErrorFormula;
3271
3287
  private checkCellOutOfSheet;
3272
3288
  private checkUselessClearCell;
3289
+ private checkUselessUpdateCell;
3273
3290
  }
3274
3291
 
3275
3292
  /**
@@ -4435,7 +4452,6 @@ declare class SelectionInputPlugin extends UIPlugin implements StreamCallbacks<S
4435
4452
  constructor(config: UIPluginConfig, initialRanges: string[], inputHasSingleRange: boolean);
4436
4453
  handleEvent(event: SelectionEvent): void;
4437
4454
  handle(cmd: Command): void;
4438
- unsubscribe(): void;
4439
4455
  getSelectionInputValue(): string[];
4440
4456
  getSelectionInputHighlights(): Highlight$1[];
4441
4457
  /**
@@ -4496,7 +4512,6 @@ declare class SelectionInputsManagerPlugin extends UIPlugin {
4496
4512
  constructor(config: UIPluginConfig);
4497
4513
  allowDispatch(cmd: Command): CommandResult;
4498
4514
  handle(cmd: Command): void;
4499
- unsubscribe(): void;
4500
4515
  /**
4501
4516
  * Return a list of all valid XCs.
4502
4517
  * e.g. ["A1", "Sheet2!B3", "E12"]
@@ -5006,7 +5021,7 @@ interface ChartBuilder {
5006
5021
  name: string;
5007
5022
  }
5008
5023
 
5009
- interface Props$x {
5024
+ interface Props$w {
5010
5025
  ranges: string[];
5011
5026
  hasSingleRange?: boolean;
5012
5027
  required?: boolean;
@@ -5028,7 +5043,7 @@ interface SelectionRange extends Omit<RangeInputValue, "color"> {
5028
5043
  * onSelectionChanged is called every time the input value
5029
5044
  * changes.
5030
5045
  */
5031
- declare class SelectionInput extends Component<Props$x, SpreadsheetChildEnv> {
5046
+ declare class SelectionInput extends Component<Props$w, SpreadsheetChildEnv> {
5032
5047
  static template: string;
5033
5048
  private id;
5034
5049
  private previousRanges;
@@ -5053,12 +5068,12 @@ declare class SelectionInput extends Component<Props$x, SpreadsheetChildEnv> {
5053
5068
  confirm(): void;
5054
5069
  }
5055
5070
 
5056
- interface Props$w {
5071
+ interface Props$v {
5057
5072
  figureId: UID;
5058
5073
  definition: LineChartDefinition | BarChartDefinition | PieChartDefinition;
5059
5074
  updateChart: (figureId: UID, definition: Partial<LineChartDefinition | BarChartDefinition | PieChartDefinition>) => DispatchResult;
5060
5075
  }
5061
- declare class LineBarPieConfigPanel extends Component<Props$w, SpreadsheetChildEnv> {
5076
+ declare class LineBarPieConfigPanel extends Component<Props$v, SpreadsheetChildEnv> {
5062
5077
  static template: string;
5063
5078
  static components: {
5064
5079
  SelectionInput: typeof SelectionInput;
@@ -5119,12 +5134,12 @@ declare class ColorPicker extends Component<ColorPickerProps, SpreadsheetChildEn
5119
5134
  isSameColor(color1: Color, color2: Color): boolean;
5120
5135
  }
5121
5136
 
5122
- interface Props$v {
5137
+ interface Props$u {
5123
5138
  figureId: UID;
5124
5139
  definition: LineChartDefinition | BarChartDefinition | PieChartDefinition;
5125
5140
  updateChart: (figureId: UID, definition: Partial<LineChartDefinition | BarChartDefinition | PieChartDefinition>) => CommandResult | CommandResult[];
5126
5141
  }
5127
- declare class LineBarPieDesignPanel extends Component<Props$v, SpreadsheetChildEnv> {
5142
+ declare class LineBarPieDesignPanel extends Component<Props$u, SpreadsheetChildEnv> {
5128
5143
  static template: string;
5129
5144
  static components: {
5130
5145
  ColorPicker: typeof ColorPicker;
@@ -5138,12 +5153,12 @@ declare class LineBarPieDesignPanel extends Component<Props$v, SpreadsheetChildE
5138
5153
  updateSelect(attr: string, ev: any): void;
5139
5154
  }
5140
5155
 
5141
- interface Props$u {
5156
+ interface Props$t {
5142
5157
  figureId: UID;
5143
5158
  definition: GaugeChartDefinition;
5144
5159
  updateChart: (figureId: UID, definition: Partial<GaugeChartDefinition>) => DispatchResult;
5145
5160
  }
5146
- declare class GaugeChartConfigPanel extends Component<Props$u, SpreadsheetChildEnv> {
5161
+ declare class GaugeChartConfigPanel extends Component<Props$t, SpreadsheetChildEnv> {
5147
5162
  static template: string;
5148
5163
  static components: {
5149
5164
  SelectionInput: typeof SelectionInput;
@@ -5157,12 +5172,12 @@ declare class GaugeChartConfigPanel extends Component<Props$u, SpreadsheetChildE
5157
5172
  }
5158
5173
 
5159
5174
  type GaugeMenu = "backgroundColor" | "sectionColor-lowerColor" | "sectionColor-middleColor" | "sectionColor-upperColor";
5160
- interface Props$t {
5175
+ interface Props$s {
5161
5176
  figureId: UID;
5162
5177
  definition: GaugeChartDefinition;
5163
5178
  updateChart: (figureId: UID, definition: Partial<GaugeChartDefinition>) => DispatchResult;
5164
5179
  }
5165
- declare class GaugeChartDesignPanel extends Component<Props$t, SpreadsheetChildEnv> {
5180
+ declare class GaugeChartDesignPanel extends Component<Props$s, SpreadsheetChildEnv> {
5166
5181
  static template: string;
5167
5182
  static components: {
5168
5183
  ColorPicker: typeof ColorPicker;
@@ -5196,12 +5211,12 @@ declare class LineConfigPanel extends LineBarPieConfigPanel {
5196
5211
  onUpdateCumulative(ev: any): void;
5197
5212
  }
5198
5213
 
5199
- interface Props$s {
5214
+ interface Props$r {
5200
5215
  figureId: UID;
5201
5216
  definition: ScorecardChartDefinition;
5202
5217
  updateChart: (figureId: UID, definition: Partial<ScorecardChartDefinition>) => DispatchResult;
5203
5218
  }
5204
- declare class ScorecardChartConfigPanel extends Component<Props$s, SpreadsheetChildEnv> {
5219
+ declare class ScorecardChartConfigPanel extends Component<Props$r, SpreadsheetChildEnv> {
5205
5220
  static template: string;
5206
5221
  static components: {
5207
5222
  SelectionInput: typeof SelectionInput;
@@ -5220,12 +5235,12 @@ declare class ScorecardChartConfigPanel extends Component<Props$s, SpreadsheetCh
5220
5235
  }
5221
5236
 
5222
5237
  type ColorPickerId = undefined | "backgroundColor" | "baselineColorUp" | "baselineColorDown";
5223
- interface Props$r {
5238
+ interface Props$q {
5224
5239
  figureId: UID;
5225
5240
  definition: ScorecardChartDefinition;
5226
5241
  updateChart: (figureId: UID, definition: Partial<ScorecardChartDefinition>) => DispatchResult;
5227
5242
  }
5228
- declare class ScorecardChartDesignPanel extends Component<Props$r, SpreadsheetChildEnv> {
5243
+ declare class ScorecardChartDesignPanel extends Component<Props$q, SpreadsheetChildEnv> {
5229
5244
  static template: string;
5230
5245
  static components: {
5231
5246
  ColorPicker: typeof ColorPicker;
@@ -5336,10 +5351,10 @@ interface AutofillRule {
5336
5351
  sequence: number;
5337
5352
  }
5338
5353
 
5339
- interface Props$q {
5354
+ interface Props$p {
5340
5355
  figure: Figure;
5341
5356
  }
5342
- declare class ChartJsComponent extends Component<Props$q, SpreadsheetChildEnv> {
5357
+ declare class ChartJsComponent extends Component<Props$p, SpreadsheetChildEnv> {
5343
5358
  static template: string;
5344
5359
  private canvas;
5345
5360
  private chart?;
@@ -5351,10 +5366,10 @@ declare class ChartJsComponent extends Component<Props$q, SpreadsheetChildEnv> {
5351
5366
  private updateChartJs;
5352
5367
  }
5353
5368
 
5354
- interface Props$p {
5369
+ interface Props$o {
5355
5370
  figure: Figure;
5356
5371
  }
5357
- declare class ScorecardChart extends Component<Props$p, SpreadsheetChildEnv> {
5372
+ declare class ScorecardChart extends Component<Props$o, SpreadsheetChildEnv> {
5358
5373
  static template: string;
5359
5374
  private ctx;
5360
5375
  get runtime(): ScorecardChartRuntime;
@@ -5438,7 +5453,7 @@ declare class Popover extends Component<PopoverProps, SpreadsheetChildEnv> {
5438
5453
  get popoverStyle(): string;
5439
5454
  }
5440
5455
 
5441
- interface Props$o {
5456
+ interface Props$n {
5442
5457
  position: DOMCoordinates;
5443
5458
  menuItems: FullMenuItem[];
5444
5459
  depth: number;
@@ -5453,7 +5468,7 @@ interface MenuState {
5453
5468
  scrollOffset?: Pixel;
5454
5469
  menuItems: FullMenuItem[];
5455
5470
  }
5456
- declare class Menu extends Component<Props$o, SpreadsheetChildEnv> {
5471
+ declare class Menu extends Component<Props$n, SpreadsheetChildEnv> {
5457
5472
  static template: string;
5458
5473
  static components: {
5459
5474
  Menu: typeof Menu;
@@ -5496,11 +5511,11 @@ declare class Menu extends Component<Props$o, SpreadsheetChildEnv> {
5496
5511
  onMouseOver(menu: FullMenuItem, position: Pixel): void;
5497
5512
  }
5498
5513
 
5499
- interface Props$n {
5514
+ interface Props$m {
5500
5515
  figure: Figure;
5501
5516
  onFigureDeleted: () => void;
5502
5517
  }
5503
- declare class ChartFigure extends Component<Props$n, SpreadsheetChildEnv> {
5518
+ declare class ChartFigure extends Component<Props$m, SpreadsheetChildEnv> {
5504
5519
  static template: string;
5505
5520
  static components: {
5506
5521
  Menu: typeof Menu;
@@ -5518,7 +5533,7 @@ declare class ChartFigure extends Component<Props$n, SpreadsheetChildEnv> {
5518
5533
  get chartComponent(): new (...args: any) => Component;
5519
5534
  }
5520
5535
 
5521
- interface Props$m {
5536
+ interface Props$l {
5522
5537
  position: Position;
5523
5538
  }
5524
5539
  interface Position {
@@ -5529,7 +5544,7 @@ interface State$2 {
5529
5544
  position: Position;
5530
5545
  handler: boolean;
5531
5546
  }
5532
- declare class Autofill extends Component<Props$m, SpreadsheetChildEnv> {
5547
+ declare class Autofill extends Component<Props$l, SpreadsheetChildEnv> {
5533
5548
  static template: string;
5534
5549
  state: State$2;
5535
5550
  get style(): string;
@@ -5552,18 +5567,18 @@ declare class ClientTag extends Component<ClientTagProps, SpreadsheetChildEnv> {
5552
5567
  get tagStyle(): string;
5553
5568
  }
5554
5569
 
5555
- interface Props$l {
5570
+ interface Props$k {
5556
5571
  values: AutocompleteValue[];
5557
5572
  selectedIndex: number;
5558
5573
  onValueSelected: (value: string) => void;
5559
5574
  }
5560
- declare class TextValueProvider extends Component<Props$l> {
5575
+ declare class TextValueProvider extends Component<Props$k> {
5561
5576
  static template: string;
5562
5577
  }
5563
5578
 
5564
5579
  declare class ContentEditableHelper {
5565
5580
  el: HTMLElement;
5566
- constructor(el: HTMLElement | null);
5581
+ constructor(el: HTMLElement);
5567
5582
  updateEl(el: HTMLElement): void;
5568
5583
  /**
5569
5584
  * select the text at position start to end, no matter the children
@@ -5617,7 +5632,7 @@ declare class ContentEditableHelper {
5617
5632
  private getStartAndEndSelection;
5618
5633
  }
5619
5634
 
5620
- interface Props$k {
5635
+ interface Props$j {
5621
5636
  functionName: string;
5622
5637
  functionDescription: FunctionDescription;
5623
5638
  argToFocus: number;
@@ -5625,12 +5640,12 @@ interface Props$k {
5625
5640
  interface AssistantState {
5626
5641
  allowCellSelectionBehind: boolean;
5627
5642
  }
5628
- declare class FunctionDescriptionProvider extends Component<Props$k> {
5643
+ declare class FunctionDescriptionProvider extends Component<Props$j> {
5629
5644
  static template: string;
5630
5645
  assistantState: AssistantState;
5631
5646
  private timeOutId;
5632
5647
  setup(): void;
5633
- getContext(): Props$k;
5648
+ getContext(): Props$j;
5634
5649
  onMouseMove(): void;
5635
5650
  }
5636
5651
 
@@ -5643,13 +5658,14 @@ interface AutocompleteValue {
5643
5658
  text: string;
5644
5659
  description: string;
5645
5660
  }
5646
- interface Props$j {
5661
+ interface ComposerProps {
5647
5662
  inputStyle: string;
5648
5663
  rect?: Rect;
5649
5664
  delimitation?: DOMDimension;
5650
5665
  focus: "inactive" | "cellFocus" | "contentFocus";
5651
- onComposerUnmounted?: () => void;
5652
- onComposerContentFocused: (selection: ComposerSelection) => void;
5666
+ onComposerContentFocused: () => void;
5667
+ onComposerCellFocused?: (content: String) => void;
5668
+ isDefaultFocus?: boolean;
5653
5669
  }
5654
5670
  interface ComposerState$1 {
5655
5671
  positionStart: number;
@@ -5666,7 +5682,7 @@ interface FunctionDescriptionState {
5666
5682
  functionDescription: FunctionDescription;
5667
5683
  argToFocus: number;
5668
5684
  }
5669
- declare class Composer extends Component<Props$j, SpreadsheetChildEnv> {
5685
+ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
5670
5686
  static template: string;
5671
5687
  static components: {
5672
5688
  TextValueProvider: typeof TextValueProvider;
@@ -5674,6 +5690,7 @@ declare class Composer extends Component<Props$j, SpreadsheetChildEnv> {
5674
5690
  };
5675
5691
  static defaultProps: {
5676
5692
  inputStyle: string;
5693
+ isDefaultFocus: boolean;
5677
5694
  };
5678
5695
  composerRef: {
5679
5696
  el: HTMLElement | null;
@@ -5701,7 +5718,8 @@ declare class Composer extends Component<Props$j, SpreadsheetChildEnv> {
5701
5718
  onCompositionEnd(): void;
5702
5719
  onKeydown(ev: KeyboardEvent): void;
5703
5720
  private updateCursorIfNeeded;
5704
- onInput(): void;
5721
+ onPaste(ev: ClipboardEvent): void;
5722
+ onInput(ev: InputEvent): void;
5705
5723
  onKeyup(ev: KeyboardEvent): void;
5706
5724
  showAutocomplete(searchTerm: string): void;
5707
5725
  onMousedown(ev: MouseEvent): void;
@@ -5722,8 +5740,8 @@ declare class Composer extends Component<Props$j, SpreadsheetChildEnv> {
5722
5740
 
5723
5741
  interface Props$i {
5724
5742
  focus: "inactive" | "cellFocus" | "contentFocus";
5725
- onComposerUnmounted: () => void;
5726
- onComposerContentFocused: (selection: ComposerSelection) => void;
5743
+ onComposerContentFocused: () => void;
5744
+ onComposerCellFocused: () => void;
5727
5745
  }
5728
5746
  /**
5729
5747
  * This component is a composer which positions itself on the grid at the anchor cell.
@@ -5734,11 +5752,16 @@ declare class GridComposer extends Component<Props$i, SpreadsheetChildEnv> {
5734
5752
  static components: {
5735
5753
  Composer: typeof Composer;
5736
5754
  };
5737
- private gridComposerRef;
5738
- private zone;
5739
5755
  private rect;
5740
- private composerState;
5756
+ private isEditing;
5757
+ get defaultRect(): {
5758
+ x: number;
5759
+ y: number;
5760
+ width: number;
5761
+ height: number;
5762
+ };
5741
5763
  setup(): void;
5764
+ get composerProps(): ComposerProps;
5742
5765
  get containerStyle(): string;
5743
5766
  get composerStyle(): string;
5744
5767
  }
@@ -6401,7 +6424,7 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
6401
6424
  focusGrid(): void;
6402
6425
  onKeydown(ev: KeyboardEvent): void;
6403
6426
  onTopBarComposerFocused(selection: ComposerSelection): void;
6404
- onGridComposerContentFocused(): void;
6427
+ onGridComposerContentFocused(selection: ComposerSelection): void;
6405
6428
  onGridComposerCellFocused(content?: string, selection?: ComposerSelection): void;
6406
6429
  /**
6407
6430
  * Start the edition or update the content if it's already started.
@@ -6448,7 +6471,6 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
6448
6471
  readonly HEADER_WIDTH = 48;
6449
6472
  private menuState;
6450
6473
  private gridRef;
6451
- private hiddenInput;
6452
6474
  onMouseWheel: (ev: WheelEvent) => void;
6453
6475
  canvasPosition: DOMCoordinates;
6454
6476
  hoveredCell: Partial<Position$1>;
@@ -6460,7 +6482,7 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
6460
6482
  get gridOverlayDimensions(): string;
6461
6483
  onClosePopover(): void;
6462
6484
  private keyDownMapping;
6463
- focus(): void;
6485
+ focusDefaultElement(): void;
6464
6486
  get gridEl(): HTMLElement;
6465
6487
  getAutofillPosition(): {
6466
6488
  left: number;
@@ -6480,7 +6502,6 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
6480
6502
  closeOpenedPopover(): void;
6481
6503
  processArrows(ev: KeyboardEvent): void;
6482
6504
  onKeydown(ev: KeyboardEvent): void;
6483
- onInput(ev: InputEvent): void;
6484
6505
  onInputContextMenu(ev: MouseEvent): void;
6485
6506
  onCellRightClicked(col: HeaderIndex, row: HeaderIndex, { x, y }: DOMCoordinates): void;
6486
6507
  toggleContextMenu(type: ContextMenuType, x: Pixel, y: Pixel): void;