@odoo/o-spreadsheet 16.0.31 → 16.0.32

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,6 +2,12 @@ import * as _odoo_owl from '@odoo/owl';
2
2
  import { ComponentConstructor, EventBus as EventBus$1, Component } from '@odoo/owl';
3
3
  import { ChartConfiguration, ChartData, ChartDataSets, ChartOptions } from 'chart.js';
4
4
 
5
+ declare class FocusableElement {
6
+ private focusableElement;
7
+ setFocusableElement(element: HTMLElement): void;
8
+ focus(): void;
9
+ }
10
+
5
11
  type TranslationFunction = (string: string, ...values: string[] | [{
6
12
  [key: string]: string;
7
13
  }]) => string;
@@ -41,6 +47,7 @@ interface SpreadsheetChildEnv extends SpreadsheetEnv {
41
47
  toggleSidePanel: (panel: string, panelProps?: any) => void;
42
48
  clipboard: Clipboard;
43
49
  _t: TranslationFunction;
50
+ focusableElement: FocusableElement;
44
51
  }
45
52
 
46
53
  declare enum CellErrorLevel {
@@ -375,6 +382,10 @@ type SelectionEvent = Readonly<ZonesSelected | HeadersSelected | AlterZoneCorner
375
382
 
376
383
  interface StreamCallbacks<Event> {
377
384
  handleEvent: (event: Event) => void;
385
+ /** this callback will only be called when another consumer captures the stream,
386
+ * not when the current consumer decides to release the stream itself as it could
387
+ * have react differently to both situations.
388
+ * */
378
389
  release?: () => void;
379
390
  }
380
391
 
@@ -1294,7 +1305,6 @@ declare class EditionPlugin extends UIPlugin {
1294
1305
  allowDispatch(cmd: Command): CommandResult;
1295
1306
  private handleEvent;
1296
1307
  handle(cmd: Command): void;
1297
- unsubscribe(): void;
1298
1308
  getEditionMode(): EditionMode;
1299
1309
  getCurrentContent(): string;
1300
1310
  getEditionSheet(): string;
@@ -4164,7 +4174,6 @@ declare class SelectionInputPlugin extends UIPlugin implements StreamCallbacks<S
4164
4174
  constructor(getters: Getters, state: StateObserver, dispatch: CommandDispatcher["dispatch"], config: ModelConfig, selection: SelectionStreamProcessor, initialRanges: string[], inputHasSingleRange: boolean);
4165
4175
  handleEvent(event: SelectionEvent): void;
4166
4176
  handle(cmd: Command): void;
4167
- unsubscribe(): void;
4168
4177
  getSelectionInputValue(): string[];
4169
4178
  getSelectionInputHighlights(): Highlight$1[];
4170
4179
  /**
@@ -4226,7 +4235,6 @@ declare class SelectionInputsManagerPlugin extends UIPlugin {
4226
4235
  constructor(getters: Getters, state: StateObserver, dispatch: CommandDispatcher["dispatch"], config: ModelConfig, selection: SelectionStreamProcessor);
4227
4236
  allowDispatch(cmd: Command): CommandResult;
4228
4237
  handle(cmd: Command): void;
4229
- unsubscribe(): void;
4230
4238
  /**
4231
4239
  * Return a list of all valid XCs.
4232
4240
  * e.g. ["A1", "Sheet2!B3", "E12"]
@@ -4859,7 +4867,7 @@ interface ChartBuilder {
4859
4867
  name: string;
4860
4868
  }
4861
4869
 
4862
- interface Props$y {
4870
+ interface Props$x {
4863
4871
  ranges: string[];
4864
4872
  hasSingleRange?: boolean;
4865
4873
  required?: boolean;
@@ -4880,7 +4888,7 @@ interface SelectionRange extends Omit<RangeInputValue, "color"> {
4880
4888
  * onSelectionChanged is called every time the input value
4881
4889
  * changes.
4882
4890
  */
4883
- declare class SelectionInput extends Component<Props$y, SpreadsheetChildEnv> {
4891
+ declare class SelectionInput extends Component<Props$x, SpreadsheetChildEnv> {
4884
4892
  static template: string;
4885
4893
  private id;
4886
4894
  private previousRanges;
@@ -4904,12 +4912,12 @@ declare class SelectionInput extends Component<Props$y, SpreadsheetChildEnv> {
4904
4912
  confirm(): void;
4905
4913
  }
4906
4914
 
4907
- interface Props$x {
4915
+ interface Props$w {
4908
4916
  figureId: UID;
4909
4917
  definition: LineChartDefinition | BarChartDefinition | PieChartDefinition;
4910
4918
  updateChart: (figureId: UID, definition: Partial<LineChartDefinition | BarChartDefinition | PieChartDefinition>) => DispatchResult;
4911
4919
  }
4912
- declare class LineBarPieConfigPanel extends Component<Props$x, SpreadsheetChildEnv> {
4920
+ declare class LineBarPieConfigPanel extends Component<Props$w, SpreadsheetChildEnv> {
4913
4921
  static template: string;
4914
4922
  static components: {
4915
4923
  SelectionInput: typeof SelectionInput;
@@ -4965,12 +4973,12 @@ declare class ColorPicker extends Component<ColorPickerProps, SpreadsheetChildEn
4965
4973
  isSameColor(color1: Color, color2: Color): boolean;
4966
4974
  }
4967
4975
 
4968
- interface Props$w {
4976
+ interface Props$v {
4969
4977
  figureId: UID;
4970
4978
  definition: LineChartDefinition | BarChartDefinition | PieChartDefinition;
4971
4979
  updateChart: (figureId: UID, definition: Partial<LineChartDefinition | BarChartDefinition | PieChartDefinition>) => CommandResult | CommandResult[];
4972
4980
  }
4973
- declare class LineBarPieDesignPanel extends Component<Props$w, SpreadsheetChildEnv> {
4981
+ declare class LineBarPieDesignPanel extends Component<Props$v, SpreadsheetChildEnv> {
4974
4982
  static template: string;
4975
4983
  static components: {
4976
4984
  ColorPicker: typeof ColorPicker;
@@ -4984,12 +4992,12 @@ declare class LineBarPieDesignPanel extends Component<Props$w, SpreadsheetChildE
4984
4992
  updateSelect(attr: string, ev: any): void;
4985
4993
  }
4986
4994
 
4987
- interface Props$v {
4995
+ interface Props$u {
4988
4996
  figureId: UID;
4989
4997
  definition: GaugeChartDefinition;
4990
4998
  updateChart: (figureId: UID, definition: Partial<GaugeChartDefinition>) => DispatchResult;
4991
4999
  }
4992
- declare class GaugeChartConfigPanel extends Component<Props$v, SpreadsheetChildEnv> {
5000
+ declare class GaugeChartConfigPanel extends Component<Props$u, SpreadsheetChildEnv> {
4993
5001
  static template: string;
4994
5002
  static components: {
4995
5003
  SelectionInput: typeof SelectionInput;
@@ -5003,12 +5011,12 @@ declare class GaugeChartConfigPanel extends Component<Props$v, SpreadsheetChildE
5003
5011
  }
5004
5012
 
5005
5013
  type GaugeMenu = "backgroundColor" | "sectionColor-lowerColor" | "sectionColor-middleColor" | "sectionColor-upperColor";
5006
- interface Props$u {
5014
+ interface Props$t {
5007
5015
  figureId: UID;
5008
5016
  definition: GaugeChartDefinition;
5009
5017
  updateChart: (figureId: UID, definition: Partial<GaugeChartDefinition>) => DispatchResult;
5010
5018
  }
5011
- declare class GaugeChartDesignPanel extends Component<Props$u, SpreadsheetChildEnv> {
5019
+ declare class GaugeChartDesignPanel extends Component<Props$t, SpreadsheetChildEnv> {
5012
5020
  static template: string;
5013
5021
  static components: {
5014
5022
  ColorPicker: typeof ColorPicker;
@@ -5041,12 +5049,12 @@ declare class LineConfigPanel extends LineBarPieConfigPanel {
5041
5049
  onUpdateCumulative(ev: any): void;
5042
5050
  }
5043
5051
 
5044
- interface Props$t {
5052
+ interface Props$s {
5045
5053
  figureId: UID;
5046
5054
  definition: ScorecardChartDefinition;
5047
5055
  updateChart: (figureId: UID, definition: Partial<ScorecardChartDefinition>) => DispatchResult;
5048
5056
  }
5049
- declare class ScorecardChartConfigPanel extends Component<Props$t, SpreadsheetChildEnv> {
5057
+ declare class ScorecardChartConfigPanel extends Component<Props$s, SpreadsheetChildEnv> {
5050
5058
  static template: string;
5051
5059
  static components: {
5052
5060
  SelectionInput: typeof SelectionInput;
@@ -5065,12 +5073,12 @@ declare class ScorecardChartConfigPanel extends Component<Props$t, SpreadsheetCh
5065
5073
  }
5066
5074
 
5067
5075
  type ColorPickerId = undefined | "backgroundColor" | "baselineColorUp" | "baselineColorDown";
5068
- interface Props$s {
5076
+ interface Props$r {
5069
5077
  figureId: UID;
5070
5078
  definition: ScorecardChartDefinition;
5071
5079
  updateChart: (figureId: UID, definition: Partial<ScorecardChartDefinition>) => DispatchResult;
5072
5080
  }
5073
- declare class ScorecardChartDesignPanel extends Component<Props$s, SpreadsheetChildEnv> {
5081
+ declare class ScorecardChartDesignPanel extends Component<Props$r, SpreadsheetChildEnv> {
5074
5082
  static template: string;
5075
5083
  static components: {
5076
5084
  ColorPicker: typeof ColorPicker;
@@ -5178,10 +5186,10 @@ interface AutofillRule {
5178
5186
  sequence: number;
5179
5187
  }
5180
5188
 
5181
- interface Props$r {
5189
+ interface Props$q {
5182
5190
  figure: Figure;
5183
5191
  }
5184
- declare class ChartJsComponent extends Component<Props$r, SpreadsheetChildEnv> {
5192
+ declare class ChartJsComponent extends Component<Props$q, SpreadsheetChildEnv> {
5185
5193
  static template: string;
5186
5194
  private canvas;
5187
5195
  private chart?;
@@ -5193,10 +5201,10 @@ declare class ChartJsComponent extends Component<Props$r, SpreadsheetChildEnv> {
5193
5201
  private updateChartJs;
5194
5202
  }
5195
5203
 
5196
- interface Props$q {
5204
+ interface Props$p {
5197
5205
  figure: Figure;
5198
5206
  }
5199
- declare class ScorecardChart extends Component<Props$q, SpreadsheetChildEnv> {
5207
+ declare class ScorecardChart extends Component<Props$p, SpreadsheetChildEnv> {
5200
5208
  static template: string;
5201
5209
  private ctx;
5202
5210
  get runtime(): ScorecardChartRuntime;
@@ -5243,7 +5251,7 @@ declare enum ComponentsImportance {
5243
5251
  ChartAnchor = 1000
5244
5252
  }
5245
5253
 
5246
- interface Props$p {
5254
+ interface Props$o {
5247
5255
  /**
5248
5256
  * Coordinates are expressed relative to the "body" element.
5249
5257
  */
@@ -5264,7 +5272,7 @@ interface Props$p {
5264
5272
  onMouseWheel: (ev: WheelEvent) => void;
5265
5273
  zIndex: Number;
5266
5274
  }
5267
- declare class Popover extends Component<Props$p, SpreadsheetChildEnv> {
5275
+ declare class Popover extends Component<Props$o, SpreadsheetChildEnv> {
5268
5276
  static template: string;
5269
5277
  static defaultProps: {
5270
5278
  flipHorizontalOffset: number;
@@ -5284,7 +5292,7 @@ declare class Popover extends Component<Props$p, SpreadsheetChildEnv> {
5284
5292
  private verticalPosition;
5285
5293
  }
5286
5294
 
5287
- interface Props$o {
5295
+ interface Props$n {
5288
5296
  position: DOMCoordinates;
5289
5297
  menuItems: FullMenuItem[];
5290
5298
  depth: number;
@@ -5299,7 +5307,7 @@ interface MenuState {
5299
5307
  scrollOffset?: Pixel;
5300
5308
  menuItems: FullMenuItem[];
5301
5309
  }
5302
- declare class Menu extends Component<Props$o, SpreadsheetChildEnv> {
5310
+ declare class Menu extends Component<Props$n, SpreadsheetChildEnv> {
5303
5311
  static template: string;
5304
5312
  MENU_WIDTH: number;
5305
5313
  static components: {
@@ -5352,12 +5360,12 @@ declare class Menu extends Component<Props$o, SpreadsheetChildEnv> {
5352
5360
  onMouseOver(menu: FullMenuItem, position: Pixel): void;
5353
5361
  }
5354
5362
 
5355
- interface Props$n {
5363
+ interface Props$m {
5356
5364
  figure: Figure;
5357
5365
  sidePanelIsOpen: boolean;
5358
5366
  onFigureDeleted: () => void;
5359
5367
  }
5360
- declare class ChartFigure extends Component<Props$n, SpreadsheetChildEnv> {
5368
+ declare class ChartFigure extends Component<Props$m, SpreadsheetChildEnv> {
5361
5369
  static template: string;
5362
5370
  static components: {
5363
5371
  Menu: typeof Menu;
@@ -5375,7 +5383,7 @@ declare class ChartFigure extends Component<Props$n, SpreadsheetChildEnv> {
5375
5383
  get chartComponent(): new (...args: any) => Component;
5376
5384
  }
5377
5385
 
5378
- interface Props$m {
5386
+ interface Props$l {
5379
5387
  position: Position;
5380
5388
  }
5381
5389
  interface Position {
@@ -5386,7 +5394,7 @@ interface State$2 {
5386
5394
  position: Position;
5387
5395
  handler: boolean;
5388
5396
  }
5389
- declare class Autofill extends Component<Props$m, SpreadsheetChildEnv> {
5397
+ declare class Autofill extends Component<Props$l, SpreadsheetChildEnv> {
5390
5398
  static template: string;
5391
5399
  state: State$2;
5392
5400
  get style(): string;
@@ -5414,7 +5422,7 @@ interface AutocompleteValue {
5414
5422
  text: string;
5415
5423
  description: string;
5416
5424
  }
5417
- interface Props$l {
5425
+ interface Props$k {
5418
5426
  provider: string;
5419
5427
  filter?: (searchTerm: string, vals: AutocompleteValue[]) => AutocompleteValue[];
5420
5428
  search: string;
@@ -5427,7 +5435,7 @@ interface TextValueProviderApi {
5427
5435
  moveDown: () => void;
5428
5436
  getValueToFill: () => string | undefined;
5429
5437
  }
5430
- declare class TextValueProvider extends Component<Props$l> implements TextValueProviderApi {
5438
+ declare class TextValueProvider extends Component<Props$k> implements TextValueProviderApi {
5431
5439
  static template: string;
5432
5440
  state: {
5433
5441
  values: AutocompleteValue[];
@@ -5444,7 +5452,7 @@ declare class TextValueProvider extends Component<Props$l> implements TextValueP
5444
5452
 
5445
5453
  declare class ContentEditableHelper {
5446
5454
  el: HTMLElement;
5447
- constructor(el: HTMLElement | null);
5455
+ constructor(el: HTMLElement);
5448
5456
  updateEl(el: HTMLElement): void;
5449
5457
  /**
5450
5458
  * select the text at position start to end, no matter the children
@@ -5498,7 +5506,7 @@ declare class ContentEditableHelper {
5498
5506
  private getStartAndEndSelection;
5499
5507
  }
5500
5508
 
5501
- interface Props$k {
5509
+ interface Props$j {
5502
5510
  functionName: string;
5503
5511
  functionDescription: FunctionDescription;
5504
5512
  argToFocus: number;
@@ -5507,12 +5515,12 @@ interface Props$k {
5507
5515
  interface AssistantState {
5508
5516
  allowCellSelectionBehind: boolean;
5509
5517
  }
5510
- declare class FunctionDescriptionProvider extends Component<Props$k> {
5518
+ declare class FunctionDescriptionProvider extends Component<Props$j> {
5511
5519
  static template: string;
5512
5520
  assistantState: AssistantState;
5513
5521
  private timeOutId;
5514
5522
  setup(): void;
5515
- getContext(): Props$k;
5523
+ getContext(): Props$j;
5516
5524
  onMouseMove(): void;
5517
5525
  }
5518
5526
 
@@ -5521,13 +5529,14 @@ type HtmlContent = {
5521
5529
  color?: Color;
5522
5530
  class?: string;
5523
5531
  };
5524
- interface Props$j {
5532
+ interface ComposerProps {
5525
5533
  inputStyle: string;
5526
5534
  rect?: Rect;
5527
5535
  delimitation?: DOMDimension;
5528
5536
  focus: "inactive" | "cellFocus" | "contentFocus";
5529
- onComposerUnmounted?: () => void;
5530
- onComposerContentFocused: (selection: ComposerSelection) => void;
5537
+ onComposerContentFocused: () => void;
5538
+ onComposerCellFocused?: (content: String) => void;
5539
+ isDefaultFocus?: boolean;
5531
5540
  }
5532
5541
  interface ComposerState$1 {
5533
5542
  positionStart: number;
@@ -5544,7 +5553,7 @@ interface FunctionDescriptionState {
5544
5553
  functionDescription: FunctionDescription;
5545
5554
  argToFocus: number;
5546
5555
  }
5547
- declare class Composer extends Component<Props$j, SpreadsheetChildEnv> {
5556
+ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
5548
5557
  static template: string;
5549
5558
  static components: {
5550
5559
  TextValueProvider: typeof TextValueProvider;
@@ -5553,6 +5562,7 @@ declare class Composer extends Component<Props$j, SpreadsheetChildEnv> {
5553
5562
  static defaultProps: {
5554
5563
  inputStyle: string;
5555
5564
  focus: string;
5565
+ isDefaultFocus: boolean;
5556
5566
  };
5557
5567
  composerRef: {
5558
5568
  el: HTMLElement | null;
@@ -5581,7 +5591,8 @@ declare class Composer extends Component<Props$j, SpreadsheetChildEnv> {
5581
5591
  onCompositionEnd(): void;
5582
5592
  onKeydown(ev: KeyboardEvent): void;
5583
5593
  private updateCursorIfNeeded;
5584
- onInput(): void;
5594
+ onPaste(ev: ClipboardEvent): void;
5595
+ onInput(ev: InputEvent): void;
5585
5596
  onKeyup(ev: KeyboardEvent): void;
5586
5597
  onMousedown(ev: MouseEvent): void;
5587
5598
  onClick(): void;
@@ -5603,7 +5614,8 @@ declare class Composer extends Component<Props$j, SpreadsheetChildEnv> {
5603
5614
  interface Props$i {
5604
5615
  focus: "inactive" | "cellFocus" | "contentFocus";
5605
5616
  content: string;
5606
- onComposerUnmounted: () => void;
5617
+ onComposerContentFocused: () => void;
5618
+ onComposerCellFocused: () => void;
5607
5619
  }
5608
5620
  /**
5609
5621
  * This component is a composer which positions itself on the grid at the anchor cell.
@@ -5614,11 +5626,16 @@ declare class GridComposer extends Component<Props$i, SpreadsheetChildEnv> {
5614
5626
  static components: {
5615
5627
  Composer: typeof Composer;
5616
5628
  };
5617
- private gridComposerRef;
5618
- private zone;
5619
5629
  private rect;
5620
- private composerState;
5630
+ private isEditing;
5631
+ get defaultRect(): {
5632
+ x: number;
5633
+ y: number;
5634
+ width: number;
5635
+ height: number;
5636
+ };
5621
5637
  setup(): void;
5638
+ get composerProps(): ComposerProps;
5622
5639
  get containerStyle(): string;
5623
5640
  get composerStyle(): string;
5624
5641
  }
@@ -6110,7 +6127,6 @@ declare class Grid extends Component<Props$5, SpreadsheetChildEnv> {
6110
6127
  readonly HEADER_WIDTH = 48;
6111
6128
  private menuState;
6112
6129
  private gridRef;
6113
- private hiddenInput;
6114
6130
  onMouseWheel: (ev: WheelEvent) => void;
6115
6131
  canvasPosition: DOMCoordinates;
6116
6132
  hoveredCell: Partial<Position$1>;
@@ -6122,7 +6138,7 @@ declare class Grid extends Component<Props$5, SpreadsheetChildEnv> {
6122
6138
  get gridOverlayDimensions(): string;
6123
6139
  onClosePopover(): void;
6124
6140
  private keyDownMapping;
6125
- focus(): void;
6141
+ focusDefaultElement(): void;
6126
6142
  get gridEl(): HTMLElement;
6127
6143
  getAutofillPosition(): {
6128
6144
  left: number;
@@ -6141,7 +6157,6 @@ declare class Grid extends Component<Props$5, SpreadsheetChildEnv> {
6141
6157
  closeOpenedPopover(): void;
6142
6158
  processArrows(ev: KeyboardEvent): void;
6143
6159
  onKeydown(ev: KeyboardEvent): void;
6144
- onInput(ev: InputEvent): void;
6145
6160
  onInputContextMenu(ev: MouseEvent): void;
6146
6161
  onCellRightClicked(col: HeaderIndex, row: HeaderIndex, { x, y }: DOMCoordinates): void;
6147
6162
  toggleContextMenu(type: ContextMenuType, x: Pixel, y: Pixel): void;
@@ -6464,7 +6479,7 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
6464
6479
  save(): void;
6465
6480
  onKeydown(ev: KeyboardEvent): void;
6466
6481
  onTopBarComposerFocused(selection: ComposerSelection): void;
6467
- onGridComposerContentFocused(): void;
6482
+ onGridComposerContentFocused(selection: ComposerSelection): void;
6468
6483
  onGridComposerCellFocused(content?: string, selection?: ComposerSelection): void;
6469
6484
  /**
6470
6485
  * Start the edition or update the content if it's already started.