@odoo/o-spreadsheet 16.2.0-alpha.3 → 16.2.0-alpha.4

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.
@@ -350,11 +350,16 @@ interface SelectionProcessor {
350
350
  }
351
351
  declare type SelectionStreamProcessor = SelectionProcessor & StatefulStream<SelectionEvent, AnchorZone>;
352
352
 
353
- interface XLSXExportFile {
353
+ declare type XLSXExportFile = XLSXExportImageFile | XLSXExportXMLFile;
354
+ interface XLSXExportXMLFile {
354
355
  path: string;
355
356
  content: string;
356
357
  contentType?: string;
357
358
  }
359
+ interface XLSXExportImageFile {
360
+ path: string;
361
+ imagePath: string;
362
+ }
358
363
  interface XLSXExport {
359
364
  name: string;
360
365
  files: XLSXExportFile[];
@@ -613,6 +618,25 @@ interface IconSetRule {
613
618
  declare type ConditionalFormattingOperatorValues = "BeginsWith" | "Between" | "ContainsText" | "IsEmpty" | "IsNotEmpty" | "EndsWith" | "Equal" | "GreaterThan" | "GreaterThanOrEqual" | "LessThan" | "LessThanOrEqual" | "NotBetween" | "NotContains" | "NotEqual";
614
619
  declare type UpDown = "up" | "down";
615
620
 
621
+ interface Figure {
622
+ id: UID;
623
+ x: Pixel;
624
+ y: Pixel;
625
+ width: Pixel;
626
+ height: Pixel;
627
+ tag: string;
628
+ }
629
+ interface FigureSize {
630
+ width: Pixel;
631
+ height: Pixel;
632
+ }
633
+ declare type ResizeDirection = -1 | 0 | 1;
634
+
635
+ interface Image {
636
+ path: string;
637
+ size: FigureSize;
638
+ }
639
+
616
640
  interface CellData {
617
641
  content?: string;
618
642
  style?: number;
@@ -686,6 +710,7 @@ interface ExcelSheetData extends Omit<SheetData, "figureTables"> {
686
710
  [key: string]: ExcelCellData | undefined;
687
711
  };
688
712
  charts: FigureData<ExcelChartDefinition>[];
713
+ images: FigureData<Image>[];
689
714
  filterTables: ExcelFilterTableData[];
690
715
  }
691
716
  interface FilterTableData {
@@ -835,25 +860,6 @@ interface TransportService<T = any> {
835
860
  leave: (id: UID) => void;
836
861
  }
837
862
 
838
- interface Figure {
839
- id: UID;
840
- x: Pixel;
841
- y: Pixel;
842
- width: Pixel;
843
- height: Pixel;
844
- tag: string;
845
- }
846
- interface FigureSize {
847
- width: Pixel;
848
- height: Pixel;
849
- }
850
- declare type ResizeDirection = -1 | 0 | 1;
851
-
852
- interface Image {
853
- path: string;
854
- size: FigureSize;
855
- }
856
-
857
863
  declare type FilePath = string;
858
864
  /**
859
865
  * FileStore manage the transfer of file with the server.
@@ -1351,12 +1357,6 @@ declare class EditionPlugin extends UIPlugin {
1351
1357
  private getTokensInSelection;
1352
1358
  }
1353
1359
 
1354
- declare type Rect = {
1355
- x: Pixel;
1356
- y: Pixel;
1357
- width: Pixel;
1358
- height: Pixel;
1359
- };
1360
1360
  /**
1361
1361
  * Coordinate in pixels
1362
1362
  */
@@ -1368,6 +1368,7 @@ interface DOMDimension {
1368
1368
  width: Pixel;
1369
1369
  height: Pixel;
1370
1370
  }
1371
+ declare type Rect = DOMCoordinates & DOMDimension;
1371
1372
  /**
1372
1373
  * The viewport is the visible area of a sheet.
1373
1374
  * Column and row headers are not included in the viewport.
@@ -2216,8 +2217,8 @@ interface UnboundedZone {
2216
2217
  hasHeader?: boolean;
2217
2218
  }
2218
2219
  interface ZoneDimension {
2219
- height: HeaderIndex;
2220
- width: HeaderIndex;
2220
+ numberOfRows: HeaderIndex;
2221
+ numberOfCols: HeaderIndex;
2221
2222
  }
2222
2223
  declare type Align = "left" | "right" | "center" | undefined;
2223
2224
  declare type VerticalAlign = "top" | "middle" | "bottom" | undefined;
@@ -3420,6 +3421,7 @@ declare class ImagePlugin extends CorePlugin<ImageState> implements ImageState {
3420
3421
  private addFigure;
3421
3422
  import(data: WorkbookData): void;
3422
3423
  export(data: WorkbookData): void;
3424
+ exportForExcel(data: ExcelWorkbookData): void;
3423
3425
  private getAllImages;
3424
3426
  }
3425
3427
 
@@ -3818,7 +3820,7 @@ declare class InternalViewport {
3818
3820
  x: Pixel;
3819
3821
  y: Pixel;
3820
3822
  });
3821
- getMaxSize(): ZoneDimension;
3823
+ getMaxSize(): DOMDimension;
3822
3824
  /**
3823
3825
  * Return the index of a column given an offset x, based on the pane left
3824
3826
  * visible cell.
@@ -3946,8 +3948,8 @@ declare class SheetViewPlugin extends UIPlugin {
3946
3948
  * It returns -1 if no row is found.
3947
3949
  */
3948
3950
  getRowIndex(y: Pixel): HeaderIndex;
3949
- getSheetViewDimensionWithHeaders(): ZoneDimension;
3950
- getSheetViewDimension(): ZoneDimension;
3951
+ getSheetViewDimensionWithHeaders(): DOMDimension;
3952
+ getSheetViewDimension(): DOMDimension;
3951
3953
  /** type as pane, not viewport but basically pane extends viewport */
3952
3954
  getActiveMainViewport(): Viewport;
3953
3955
  /**
@@ -5148,26 +5150,6 @@ interface ChartSidePanel {
5148
5150
  design: new (...args: any) => Component;
5149
5151
  }
5150
5152
 
5151
- /**
5152
- * This registry is intended to map a type of figure (tag) to a class of
5153
- * component, that will be used in the UI to represent the figure.
5154
- *
5155
- * The most important type of figure will be the Chart
5156
- */
5157
- interface FigureContent {
5158
- Component: any;
5159
- SidePanelComponent?: string;
5160
- keepRatio?: boolean;
5161
- minFigSize?: number;
5162
- borderWidth?: number;
5163
- }
5164
-
5165
- interface SidePanelContent {
5166
- title: string | ((env: SpreadsheetChildEnv) => string);
5167
- Body: any;
5168
- Footer?: any;
5169
- }
5170
-
5171
5153
  /**
5172
5154
  * An ActionMenuItem represent a menu item for the menus of the topbar.
5173
5155
  * and the context menu in the grid.
@@ -5235,6 +5217,27 @@ declare class MenuItemRegistry extends Registry<MenuItemSpec> {
5235
5217
  getMenuItems(): MenuItem[];
5236
5218
  }
5237
5219
 
5220
+ /**
5221
+ * This registry is intended to map a type of figure (tag) to a class of
5222
+ * component, that will be used in the UI to represent the figure.
5223
+ *
5224
+ * The most important type of figure will be the Chart
5225
+ */
5226
+ interface FigureContent {
5227
+ Component: any;
5228
+ menuBuilder: (figureId: UID, onFigureDeleted: () => void, env: SpreadsheetChildEnv) => MenuItem[];
5229
+ SidePanelComponent?: string;
5230
+ keepRatio?: boolean;
5231
+ minFigSize?: number;
5232
+ borderWidth?: number;
5233
+ }
5234
+
5235
+ interface SidePanelContent {
5236
+ title: string | ((env: SpreadsheetChildEnv) => string);
5237
+ Body: any;
5238
+ Footer?: any;
5239
+ }
5240
+
5238
5241
  /**
5239
5242
  * An AutofillRule is used to generate what to do when we need to autofill
5240
5243
  * a cell. (In a AutofillGenerator, see plugins/autofill.ts)
@@ -5277,7 +5280,7 @@ declare class ScorecardChart extends Component<Props$s, SpreadsheetChildEnv> {
5277
5280
  get baselineArrowDirection(): BaselineArrowDirection;
5278
5281
  get backgroundColor(): string;
5279
5282
  get primaryFontColor(): string;
5280
- get secondaryFontColor(): "#757575" | "#bbbbbb";
5283
+ get secondaryFontColor(): "#525252" | "#C8C8C8";
5281
5284
  get figure(): Figure;
5282
5285
  get chartStyle(): string;
5283
5286
  get chartContentStyle(): string;
@@ -5298,86 +5301,17 @@ declare class ScorecardChart extends Component<Props$s, SpreadsheetChildEnv> {
5298
5301
  }
5299
5302
 
5300
5303
  interface Props$r {
5301
- position: DOMCoordinates;
5302
- menuItems: MenuItem[];
5303
- depth: number;
5304
- maxHeight?: Pixel;
5305
- onClose: () => void;
5306
- onMenuClicked?: (ev: CustomEvent) => void;
5307
- menuId?: UID;
5308
- }
5309
- interface MenuState {
5310
- isOpen: boolean;
5311
- parentMenu?: MenuItem;
5312
- position: null | DOMCoordinates;
5313
- scrollOffset?: Pixel;
5314
- menuItems: MenuItem[];
5315
- }
5316
- declare class Menu extends Component<Props$r, SpreadsheetChildEnv> {
5317
- static template: string;
5318
- static components: {
5319
- Menu: typeof Menu;
5320
- Popover: typeof Popover;
5321
- };
5322
- static defaultProps: {
5323
- depth: number;
5324
- };
5325
- private subMenu;
5326
- private menuRef;
5327
- private position;
5328
- setup(): void;
5329
- get visibleMenuItems(): MenuItem[];
5330
- get subMenuPosition(): DOMCoordinates;
5331
- get menuHeight(): Pixel;
5332
- get popoverProps(): PopoverProps;
5333
- getColor(menu: MenuItem): string | undefined;
5334
- activateMenu(menu: MenuItem): Promise<void>;
5335
- private close;
5336
- /**
5337
- * Return the number of pixels between the top of the menu
5338
- * and the menu item at a given index.
5339
- */
5340
- private subMenuVerticalPosition;
5341
- private onExternalClick;
5342
- private getMenuItemsHeight;
5343
- getName(menu: MenuItem): string;
5344
- isRoot(menu: MenuItem): boolean;
5345
- isEnabled(menu: MenuItem): boolean;
5346
- onScroll(ev: any): void;
5347
- /**
5348
- * If the given menu is not disabled, open it's submenu at the
5349
- * correct position according to available surrounding space.
5350
- */
5351
- openSubMenu(menu: MenuItem, menuIndex: number): void;
5352
- isParentMenu(subMenu: MenuState, menuItem: MenuItem): boolean;
5353
- closeSubMenu(): void;
5354
- onClickMenu(menu: MenuItem, menuIndex: number): void;
5355
- onMouseOver(menu: MenuItem, position: Pixel): void;
5356
- }
5357
-
5358
- interface Props$q {
5359
5304
  figure: Figure;
5360
5305
  onFigureDeleted: () => void;
5361
5306
  }
5362
- declare class ChartFigure extends Component<Props$q, SpreadsheetChildEnv> {
5307
+ declare class ChartFigure extends Component<Props$r, SpreadsheetChildEnv> {
5363
5308
  static template: string;
5364
- static components: {
5365
- Menu: typeof Menu;
5366
- };
5367
- private menuState;
5368
- private chartContainerRef;
5369
- private menuButtonRef;
5370
- private menuButtonRect;
5371
- private position;
5372
- private getMenuItemRegistry;
5309
+ static components: {};
5373
5310
  get chartType(): ChartType;
5374
- onContextMenu(ev: MouseEvent): void;
5375
- showMenu(): void;
5376
- private openContextMenu;
5377
5311
  get chartComponent(): new (...args: any) => Component;
5378
5312
  }
5379
5313
 
5380
- interface Props$p {
5314
+ interface Props$q {
5381
5315
  isVisible: boolean;
5382
5316
  position: Position;
5383
5317
  }
@@ -5389,7 +5323,7 @@ interface State$3 {
5389
5323
  position: Position;
5390
5324
  handler: boolean;
5391
5325
  }
5392
- declare class Autofill extends Component<Props$p, SpreadsheetChildEnv> {
5326
+ declare class Autofill extends Component<Props$q, SpreadsheetChildEnv> {
5393
5327
  static template: string;
5394
5328
  state: State$3;
5395
5329
  get style(): string;
@@ -5463,13 +5397,13 @@ declare class Ripple extends Component<RippleProps, SpreadsheetChildEnv> {
5463
5397
  getRippleEffectProps(id: number): RippleEffectProps;
5464
5398
  }
5465
5399
 
5466
- interface Props$o {
5400
+ interface Props$p {
5467
5401
  sheetId: string;
5468
5402
  openContextMenu: (registry: MenuItemRegistry, ev: MouseEvent) => void;
5469
5403
  style?: string;
5470
5404
  onMouseDown: (ev: MouseEvent) => void;
5471
5405
  }
5472
- declare class BottomBarSheet extends Component<Props$o, SpreadsheetChildEnv> {
5406
+ declare class BottomBarSheet extends Component<Props$p, SpreadsheetChildEnv> {
5473
5407
  static template: string;
5474
5408
  static components: {
5475
5409
  Ripple: typeof Ripple;
@@ -5503,11 +5437,11 @@ declare class BottomBarSheet extends Component<Props$o, SpreadsheetChildEnv> {
5503
5437
  get sheetName(): string;
5504
5438
  }
5505
5439
 
5506
- interface Props$n {
5440
+ interface Props$o {
5507
5441
  openContextMenu: (x: number, y: number, registry: MenuItemRegistry) => void;
5508
5442
  closeContextMenu: () => void;
5509
5443
  }
5510
- declare class BottomBarStatistic extends Component<Props$n, SpreadsheetChildEnv> {
5444
+ declare class BottomBarStatistic extends Component<Props$o, SpreadsheetChildEnv> {
5511
5445
  static template: string;
5512
5446
  static components: {
5513
5447
  Ripple: typeof Ripple;
@@ -5520,6 +5454,64 @@ declare class BottomBarStatistic extends Component<Props$n, SpreadsheetChildEnv>
5520
5454
  private getComposedFnName;
5521
5455
  }
5522
5456
 
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
+
5523
5515
  interface BottomBarSheetItem {
5524
5516
  id: UID;
5525
5517
  name: string;
@@ -5588,14 +5580,19 @@ interface Props$l {
5588
5580
  }
5589
5581
  declare class FigureComponent extends Component<Props$l, SpreadsheetChildEnv> {
5590
5582
  static template: string;
5591
- static components: {};
5583
+ static components: {
5584
+ Menu: typeof Menu;
5585
+ };
5592
5586
  static defaultProps: {
5593
5587
  onFigureDeleted: () => void;
5594
5588
  onMouseDown: () => void;
5595
5589
  onClickAnchor: () => void;
5596
5590
  };
5597
- private borderWidth;
5591
+ private menuState;
5598
5592
  private figureRef;
5593
+ private menuButtonRef;
5594
+ private menuButtonRect;
5595
+ private borderWidth;
5599
5596
  get isSelected(): boolean;
5600
5597
  get figureRegistry(): Registry<FigureContent>;
5601
5598
  private getBorderWidth;
@@ -5606,6 +5603,9 @@ declare class FigureComponent extends Component<Props$l, SpreadsheetChildEnv> {
5606
5603
  clickAnchor(dirX: ResizeDirection, dirY: ResizeDirection, ev: MouseEvent): void;
5607
5604
  onMouseDown(ev: MouseEvent): void;
5608
5605
  onKeyDown(ev: KeyboardEvent): void;
5606
+ onContextMenu(ev: MouseEvent): void;
5607
+ showMenu(): void;
5608
+ private openContextMenu;
5609
5609
  }
5610
5610
 
5611
5611
  declare type ContainerType = "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "dnd";
@@ -6250,7 +6250,7 @@ interface Props$5 {
6250
6250
  focus: ComposerFocusType;
6251
6251
  onComposerUnmounted: () => void;
6252
6252
  onComposerContentFocused: (selection: ComposerSelection) => void;
6253
- gridDims: ZoneDimension;
6253
+ gridDims: DOMDimension;
6254
6254
  }
6255
6255
  /**
6256
6256
  * This component is a composer which positions itself on the grid at the anchor cell.