@odoo/o-spreadsheet 16.0.31 → 16.0.33

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