@odoo/o-spreadsheet 16.3.0-alpha.0 → 16.3.0-alpha.2

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.
@@ -2304,6 +2304,10 @@ interface Position$1 {
2304
2304
  col: HeaderIndex;
2305
2305
  row: HeaderIndex;
2306
2306
  }
2307
+ interface PixelPosition {
2308
+ x: Pixel;
2309
+ y: Pixel;
2310
+ }
2307
2311
  interface Merge extends Zone {
2308
2312
  id: number;
2309
2313
  topLeft: Position$1;
@@ -2868,6 +2872,7 @@ declare class RangeAdapter implements CommandHandler<CoreCommand> {
2868
2872
  * Get a Xc string that represent a part of a range
2869
2873
  */
2870
2874
  private getRangePartString;
2875
+ private getInvalidRange;
2871
2876
  }
2872
2877
 
2873
2878
  interface CorePluginConfig {
@@ -3918,7 +3923,7 @@ declare type SheetViewports = {
3918
3923
  *
3919
3924
  */
3920
3925
  declare class SheetViewPlugin extends UIPlugin {
3921
- static getters: readonly ["getColIndex", "getRowIndex", "getActiveMainViewport", "getSheetViewDimension", "getSheetViewDimensionWithHeaders", "getMainViewportRect", "isVisibleInViewport", "getEdgeScrollCol", "getEdgeScrollRow", "getVisibleFigures", "getVisibleRect", "getColRowOffsetInViewport", "getMainViewportCoordinates", "getActiveSheetScrollInfo", "getActiveSheetDOMScrollInfo", "getSheetViewVisibleCols", "getSheetViewVisibleRows", "getFrozenSheetViewRatio"];
3926
+ static getters: readonly ["getColIndex", "getRowIndex", "getActiveMainViewport", "getSheetViewDimension", "getSheetViewDimensionWithHeaders", "getMainViewportRect", "isVisibleInViewport", "getEdgeScrollCol", "getEdgeScrollRow", "getVisibleFigures", "getVisibleRect", "getColRowOffsetInViewport", "getMainViewportCoordinates", "getActiveSheetScrollInfo", "getActiveSheetDOMScrollInfo", "getSheetViewVisibleCols", "getSheetViewVisibleRows", "getFrozenSheetViewRatio", "isPositionVisible"];
3922
3927
  readonly viewports: Record<UID, SheetViewports | undefined>;
3923
3928
  /**
3924
3929
  * The viewport dimensions are usually set by one of the components
@@ -4018,6 +4023,7 @@ declare class SheetViewPlugin extends UIPlugin {
4018
4023
  */
4019
4024
  private shiftVertically;
4020
4025
  getVisibleFigures(): Figure[];
4026
+ isPositionVisible(position: PixelPosition): boolean;
4021
4027
  getFrozenSheetViewRatio(sheetId: UID): {
4022
4028
  xRatio: number;
4023
4029
  yRatio: number;
@@ -5301,17 +5307,114 @@ declare class ScorecardChart extends Component<Props$s, SpreadsheetChildEnv> {
5301
5307
  }
5302
5308
 
5303
5309
  interface Props$r {
5310
+ position: DOMCoordinates;
5311
+ menuItems: MenuItem[];
5312
+ depth: number;
5313
+ maxHeight?: Pixel;
5314
+ onClose: () => void;
5315
+ onMenuClicked?: (ev: CustomEvent) => void;
5316
+ menuId?: UID;
5317
+ }
5318
+ interface MenuState {
5319
+ isOpen: boolean;
5320
+ parentMenu?: MenuItem;
5321
+ position: null | DOMCoordinates;
5322
+ scrollOffset?: Pixel;
5323
+ menuItems: MenuItem[];
5324
+ }
5325
+ declare class Menu extends Component<Props$r, SpreadsheetChildEnv> {
5326
+ static template: string;
5327
+ static components: {
5328
+ Menu: typeof Menu;
5329
+ Popover: typeof Popover;
5330
+ };
5331
+ static defaultProps: {
5332
+ depth: number;
5333
+ };
5334
+ private subMenu;
5335
+ private menuRef;
5336
+ private position;
5337
+ setup(): void;
5338
+ get visibleMenuItems(): MenuItem[];
5339
+ get subMenuPosition(): DOMCoordinates;
5340
+ get menuHeight(): Pixel;
5341
+ get popoverProps(): PopoverProps;
5342
+ getColor(menu: MenuItem): string | undefined;
5343
+ activateMenu(menu: MenuItem): Promise<void>;
5344
+ private close;
5345
+ /**
5346
+ * Return the number of pixels between the top of the menu
5347
+ * and the menu item at a given index.
5348
+ */
5349
+ private subMenuVerticalPosition;
5350
+ private onExternalClick;
5351
+ private getMenuItemsHeight;
5352
+ getName(menu: MenuItem): string;
5353
+ isRoot(menu: MenuItem): boolean;
5354
+ isEnabled(menu: MenuItem): boolean;
5355
+ onScroll(ev: any): void;
5356
+ /**
5357
+ * If the given menu is not disabled, open it's submenu at the
5358
+ * correct position according to available surrounding space.
5359
+ */
5360
+ openSubMenu(menu: MenuItem, menuIndex: number): void;
5361
+ isParentMenu(subMenu: MenuState, menuItem: MenuItem): boolean;
5362
+ closeSubMenu(): void;
5363
+ onClickMenu(menu: MenuItem, menuIndex: number): void;
5364
+ onMouseOver(menu: MenuItem, position: Pixel): void;
5365
+ }
5366
+
5367
+ declare type ResizeAnchor = "top left" | "top" | "top right" | "right" | "bottom right" | "bottom" | "bottom left" | "left";
5368
+ interface Props$q {
5369
+ figure: Figure;
5370
+ style: string;
5371
+ onFigureDeleted: () => void;
5372
+ onMouseDown: (ev: MouseEvent) => void;
5373
+ onClickAnchor(dirX: ResizeDirection, dirY: ResizeDirection, ev: MouseEvent): void;
5374
+ }
5375
+ declare class FigureComponent extends Component<Props$q, SpreadsheetChildEnv> {
5376
+ static template: string;
5377
+ static components: {
5378
+ Menu: typeof Menu;
5379
+ };
5380
+ static defaultProps: {
5381
+ onFigureDeleted: () => void;
5382
+ onMouseDown: () => void;
5383
+ onClickAnchor: () => void;
5384
+ };
5385
+ private menuState;
5386
+ private figureRef;
5387
+ private menuButtonRef;
5388
+ private menuButtonRect;
5389
+ private borderWidth;
5390
+ get isSelected(): boolean;
5391
+ get figureRegistry(): Registry<FigureContent>;
5392
+ private getBorderWidth;
5393
+ get borderStyle(): string;
5394
+ get wrapperStyle(): string;
5395
+ getResizerPosition(resizer: ResizeAnchor): string;
5396
+ setup(): void;
5397
+ clickAnchor(dirX: ResizeDirection, dirY: ResizeDirection, ev: MouseEvent): void;
5398
+ onMouseDown(ev: MouseEvent): void;
5399
+ onKeyDown(ev: KeyboardEvent): void;
5400
+ onContextMenu(ev: MouseEvent): void;
5401
+ showMenu(): void;
5402
+ private openContextMenu;
5403
+ }
5404
+
5405
+ interface Props$p {
5304
5406
  figure: Figure;
5305
5407
  onFigureDeleted: () => void;
5306
5408
  }
5307
- declare class ChartFigure extends Component<Props$r, SpreadsheetChildEnv> {
5409
+ declare class ChartFigure extends Component<Props$p, SpreadsheetChildEnv> {
5308
5410
  static template: string;
5309
5411
  static components: {};
5412
+ onDoubleClick(): void;
5310
5413
  get chartType(): ChartType;
5311
5414
  get chartComponent(): new (...args: any) => Component;
5312
5415
  }
5313
5416
 
5314
- interface Props$q {
5417
+ interface Props$o {
5315
5418
  isVisible: boolean;
5316
5419
  position: Position;
5317
5420
  }
@@ -5323,7 +5426,7 @@ interface State$3 {
5323
5426
  position: Position;
5324
5427
  handler: boolean;
5325
5428
  }
5326
- declare class Autofill extends Component<Props$q, SpreadsheetChildEnv> {
5429
+ declare class Autofill extends Component<Props$o, SpreadsheetChildEnv> {
5327
5430
  static template: string;
5328
5431
  state: State$3;
5329
5432
  get style(): string;
@@ -5397,13 +5500,13 @@ declare class Ripple extends Component<RippleProps, SpreadsheetChildEnv> {
5397
5500
  getRippleEffectProps(id: number): RippleEffectProps;
5398
5501
  }
5399
5502
 
5400
- interface Props$p {
5503
+ interface Props$n {
5401
5504
  sheetId: string;
5402
5505
  openContextMenu: (registry: MenuItemRegistry, ev: MouseEvent) => void;
5403
5506
  style?: string;
5404
5507
  onMouseDown: (ev: MouseEvent) => void;
5405
5508
  }
5406
- declare class BottomBarSheet extends Component<Props$p, SpreadsheetChildEnv> {
5509
+ declare class BottomBarSheet extends Component<Props$n, SpreadsheetChildEnv> {
5407
5510
  static template: string;
5408
5511
  static components: {
5409
5512
  Ripple: typeof Ripple;
@@ -5437,11 +5540,11 @@ declare class BottomBarSheet extends Component<Props$p, SpreadsheetChildEnv> {
5437
5540
  get sheetName(): string;
5438
5541
  }
5439
5542
 
5440
- interface Props$o {
5543
+ interface Props$m {
5441
5544
  openContextMenu: (x: number, y: number, registry: MenuItemRegistry) => void;
5442
5545
  closeContextMenu: () => void;
5443
5546
  }
5444
- declare class BottomBarStatistic extends Component<Props$o, SpreadsheetChildEnv> {
5547
+ declare class BottomBarStatistic extends Component<Props$m, SpreadsheetChildEnv> {
5445
5548
  static template: string;
5446
5549
  static components: {
5447
5550
  Ripple: typeof Ripple;
@@ -5454,64 +5557,6 @@ declare class BottomBarStatistic extends Component<Props$o, SpreadsheetChildEnv>
5454
5557
  private getComposedFnName;
5455
5558
  }
5456
5559
 
5457
- interface Props$n {
5458
- position: DOMCoordinates;
5459
- menuItems: MenuItem[];
5460
- depth: number;
5461
- maxHeight?: Pixel;
5462
- onClose: () => void;
5463
- onMenuClicked?: (ev: CustomEvent) => void;
5464
- menuId?: UID;
5465
- }
5466
- interface MenuState {
5467
- isOpen: boolean;
5468
- parentMenu?: MenuItem;
5469
- position: null | DOMCoordinates;
5470
- scrollOffset?: Pixel;
5471
- menuItems: MenuItem[];
5472
- }
5473
- declare class Menu extends Component<Props$n, SpreadsheetChildEnv> {
5474
- static template: string;
5475
- static components: {
5476
- Menu: typeof Menu;
5477
- Popover: typeof Popover;
5478
- };
5479
- static defaultProps: {
5480
- depth: number;
5481
- };
5482
- private subMenu;
5483
- private menuRef;
5484
- private position;
5485
- setup(): void;
5486
- get visibleMenuItems(): MenuItem[];
5487
- get subMenuPosition(): DOMCoordinates;
5488
- get menuHeight(): Pixel;
5489
- get popoverProps(): PopoverProps;
5490
- getColor(menu: MenuItem): string | undefined;
5491
- activateMenu(menu: MenuItem): Promise<void>;
5492
- private close;
5493
- /**
5494
- * Return the number of pixels between the top of the menu
5495
- * and the menu item at a given index.
5496
- */
5497
- private subMenuVerticalPosition;
5498
- private onExternalClick;
5499
- private getMenuItemsHeight;
5500
- getName(menu: MenuItem): string;
5501
- isRoot(menu: MenuItem): boolean;
5502
- isEnabled(menu: MenuItem): boolean;
5503
- onScroll(ev: any): void;
5504
- /**
5505
- * If the given menu is not disabled, open it's submenu at the
5506
- * correct position according to available surrounding space.
5507
- */
5508
- openSubMenu(menu: MenuItem, menuIndex: number): void;
5509
- isParentMenu(subMenu: MenuState, menuItem: MenuItem): boolean;
5510
- closeSubMenu(): void;
5511
- onClickMenu(menu: MenuItem, menuIndex: number): void;
5512
- onMouseOver(menu: MenuItem, position: Pixel): void;
5513
- }
5514
-
5515
5560
  interface BottomBarSheetItem {
5516
5561
  id: UID;
5517
5562
  name: string;
@@ -5521,13 +5566,13 @@ interface SheetState {
5521
5566
  isDnd: boolean;
5522
5567
  sheetDndPositions: Record<UID, number> | undefined;
5523
5568
  }
5524
- interface Props$m {
5569
+ interface Props$l {
5525
5570
  onClick: () => void;
5526
5571
  }
5527
5572
  interface BottomBarMenuState extends MenuState {
5528
5573
  menuId: UID | undefined;
5529
5574
  }
5530
- declare class BottomBar extends Component<Props$m, SpreadsheetChildEnv> {
5575
+ declare class BottomBar extends Component<Props$l, SpreadsheetChildEnv> {
5531
5576
  static template: string;
5532
5577
  static components: {
5533
5578
  Menu: typeof Menu;
@@ -5570,52 +5615,16 @@ declare class BottomBar extends Component<Props$m, SpreadsheetChildEnv> {
5570
5615
  get sheetListMaxScroll(): number;
5571
5616
  }
5572
5617
 
5573
- declare type ResizeAnchor = "top left" | "top" | "top right" | "right" | "bottom right" | "bottom" | "bottom left" | "left";
5574
- interface Props$l {
5575
- figure: Figure;
5576
- style: string;
5577
- onFigureDeleted: () => void;
5578
- onMouseDown: (ev: MouseEvent) => void;
5579
- onClickAnchor(dirX: ResizeDirection, dirY: ResizeDirection, ev: MouseEvent): void;
5580
- }
5581
- declare class FigureComponent extends Component<Props$l, SpreadsheetChildEnv> {
5582
- static template: string;
5583
- static components: {
5584
- Menu: typeof Menu;
5585
- };
5586
- static defaultProps: {
5587
- onFigureDeleted: () => void;
5588
- onMouseDown: () => void;
5589
- onClickAnchor: () => void;
5590
- };
5591
- private menuState;
5592
- private figureRef;
5593
- private menuButtonRef;
5594
- private menuButtonRect;
5595
- private borderWidth;
5596
- get isSelected(): boolean;
5597
- get figureRegistry(): Registry<FigureContent>;
5598
- private getBorderWidth;
5599
- get borderStyle(): string;
5600
- get wrapperStyle(): string;
5601
- getResizerPosition(resizer: ResizeAnchor): string;
5602
- setup(): void;
5603
- clickAnchor(dirX: ResizeDirection, dirY: ResizeDirection, ev: MouseEvent): void;
5604
- onMouseDown(ev: MouseEvent): void;
5605
- onKeyDown(ev: KeyboardEvent): void;
5606
- onContextMenu(ev: MouseEvent): void;
5607
- showMenu(): void;
5608
- private openContextMenu;
5618
+ declare type HFigureAxisType = "top" | "bottom" | "vCenter";
5619
+ declare type VFigureAxisType = "right" | "left" | "hCenter";
5620
+ interface SnapLine<T extends HFigureAxisType | VFigureAxisType> {
5621
+ matchedFigIds: UID[];
5622
+ snapOffset: number;
5623
+ snappedAxisType: T;
5624
+ position: Pixel;
5609
5625
  }
5610
5626
 
5611
5627
  declare type ContainerType = "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "dnd";
5612
- interface DndState {
5613
- figId: string | undefined;
5614
- x: Pixel;
5615
- y: Pixel;
5616
- width: Pixel;
5617
- height: Pixel;
5618
- }
5619
5628
  interface Props$k {
5620
5629
  onFigureDeleted: () => void;
5621
5630
  }
@@ -5625,6 +5634,16 @@ interface Container {
5625
5634
  style: string;
5626
5635
  inverseViewportStyle: string;
5627
5636
  }
5637
+ interface Snap<T extends HFigureAxisType | VFigureAxisType> {
5638
+ line: SnapLine<T>;
5639
+ lineStyle: string;
5640
+ containerStyle: string;
5641
+ }
5642
+ interface DndState {
5643
+ draggedFigure?: Figure;
5644
+ horizontalSnap?: Snap<HFigureAxisType>;
5645
+ verticalSnap?: Snap<VFigureAxisType>;
5646
+ }
5628
5647
  /**
5629
5648
  * Each figure ⭐ is positioned inside a container `div` placed and sized
5630
5649
  * according to the split pane the figure is part of, or a separate container for the figure
@@ -5695,14 +5714,26 @@ declare class FiguresContainer extends Component<Props$k, SpreadsheetChildEnv> {
5695
5714
  private getVisibleFigures;
5696
5715
  get containers(): Container[];
5697
5716
  private getContainerStyle;
5717
+ private rectToCss;
5718
+ private getContainerRect;
5698
5719
  private getInverseViewportPositionStyle;
5699
5720
  private getFigureContainer;
5700
5721
  startDraggingFigure(figure: Figure, ev: MouseEvent): void;
5722
+ /**
5723
+ * Initialize the resize of a figure with mouse movements
5724
+ *
5725
+ * @param dirX X direction of the resize. -1 : resize from the left border of the figure, 0 : no resize in X, 1 :
5726
+ * resize from the right border of the figure
5727
+ * @param dirY Y direction of the resize. -1 : resize from the top border of the figure, 0 : no resize in Y, 1 :
5728
+ * resize from the bottom border of the figure
5729
+ * @param ev Mouse Event
5730
+ */
5701
5731
  startResize(figure: Figure, dirX: ResizeDirection, dirY: ResizeDirection, ev: MouseEvent): void;
5732
+ private getOtherFigures;
5702
5733
  private getDndFigure;
5703
5734
  getFigureStyle(figure: Figure): string;
5704
- private internalToScreenCoordinates;
5705
- private screenCoordinatesToInternal;
5735
+ private getSnap;
5736
+ private getSnapLineStyle;
5706
5737
  }
5707
5738
 
5708
5739
  interface Props$j {
@@ -6689,6 +6720,7 @@ declare const components: {
6689
6720
  GaugeChartDesignPanel: typeof GaugeChartDesignPanel;
6690
6721
  ScorecardChartConfigPanel: typeof ScorecardChartConfigPanel;
6691
6722
  ScorecardChartDesignPanel: typeof ScorecardChartDesignPanel;
6723
+ FigureComponent: typeof FigureComponent;
6692
6724
  };
6693
6725
  declare function addFunction(functionName: string, functionDescription: FunctionDescription): void;
6694
6726