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

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;
@@ -5355,29 +5358,56 @@ declare class Menu extends Component<Props$r, SpreadsheetChildEnv> {
5355
5358
  onMouseOver(menu: MenuItem, position: Pixel): void;
5356
5359
  }
5357
5360
 
5361
+ declare type ResizeAnchor = "top left" | "top" | "top right" | "right" | "bottom right" | "bottom" | "bottom left" | "left";
5358
5362
  interface Props$q {
5359
5363
  figure: Figure;
5364
+ style: string;
5360
5365
  onFigureDeleted: () => void;
5366
+ onMouseDown: (ev: MouseEvent) => void;
5367
+ onClickAnchor(dirX: ResizeDirection, dirY: ResizeDirection, ev: MouseEvent): void;
5361
5368
  }
5362
- declare class ChartFigure extends Component<Props$q, SpreadsheetChildEnv> {
5369
+ declare class FigureComponent extends Component<Props$q, SpreadsheetChildEnv> {
5363
5370
  static template: string;
5364
5371
  static components: {
5365
5372
  Menu: typeof Menu;
5366
5373
  };
5374
+ static defaultProps: {
5375
+ onFigureDeleted: () => void;
5376
+ onMouseDown: () => void;
5377
+ onClickAnchor: () => void;
5378
+ };
5367
5379
  private menuState;
5368
- private chartContainerRef;
5380
+ private figureRef;
5369
5381
  private menuButtonRef;
5370
5382
  private menuButtonRect;
5371
- private position;
5372
- private getMenuItemRegistry;
5373
- get chartType(): ChartType;
5383
+ private borderWidth;
5384
+ get isSelected(): boolean;
5385
+ get figureRegistry(): Registry<FigureContent>;
5386
+ private getBorderWidth;
5387
+ get borderStyle(): string;
5388
+ get wrapperStyle(): string;
5389
+ getResizerPosition(resizer: ResizeAnchor): string;
5390
+ setup(): void;
5391
+ clickAnchor(dirX: ResizeDirection, dirY: ResizeDirection, ev: MouseEvent): void;
5392
+ onMouseDown(ev: MouseEvent): void;
5393
+ onKeyDown(ev: KeyboardEvent): void;
5374
5394
  onContextMenu(ev: MouseEvent): void;
5375
5395
  showMenu(): void;
5376
5396
  private openContextMenu;
5377
- get chartComponent(): new (...args: any) => Component;
5378
5397
  }
5379
5398
 
5380
5399
  interface Props$p {
5400
+ figure: Figure;
5401
+ onFigureDeleted: () => void;
5402
+ }
5403
+ declare class ChartFigure extends Component<Props$p, SpreadsheetChildEnv> {
5404
+ static template: string;
5405
+ static components: {};
5406
+ get chartType(): ChartType;
5407
+ get chartComponent(): new (...args: any) => Component;
5408
+ }
5409
+
5410
+ interface Props$o {
5381
5411
  isVisible: boolean;
5382
5412
  position: Position;
5383
5413
  }
@@ -5389,7 +5419,7 @@ interface State$3 {
5389
5419
  position: Position;
5390
5420
  handler: boolean;
5391
5421
  }
5392
- declare class Autofill extends Component<Props$p, SpreadsheetChildEnv> {
5422
+ declare class Autofill extends Component<Props$o, SpreadsheetChildEnv> {
5393
5423
  static template: string;
5394
5424
  state: State$3;
5395
5425
  get style(): string;
@@ -5463,13 +5493,13 @@ declare class Ripple extends Component<RippleProps, SpreadsheetChildEnv> {
5463
5493
  getRippleEffectProps(id: number): RippleEffectProps;
5464
5494
  }
5465
5495
 
5466
- interface Props$o {
5496
+ interface Props$n {
5467
5497
  sheetId: string;
5468
5498
  openContextMenu: (registry: MenuItemRegistry, ev: MouseEvent) => void;
5469
5499
  style?: string;
5470
5500
  onMouseDown: (ev: MouseEvent) => void;
5471
5501
  }
5472
- declare class BottomBarSheet extends Component<Props$o, SpreadsheetChildEnv> {
5502
+ declare class BottomBarSheet extends Component<Props$n, SpreadsheetChildEnv> {
5473
5503
  static template: string;
5474
5504
  static components: {
5475
5505
  Ripple: typeof Ripple;
@@ -5503,11 +5533,11 @@ declare class BottomBarSheet extends Component<Props$o, SpreadsheetChildEnv> {
5503
5533
  get sheetName(): string;
5504
5534
  }
5505
5535
 
5506
- interface Props$n {
5536
+ interface Props$m {
5507
5537
  openContextMenu: (x: number, y: number, registry: MenuItemRegistry) => void;
5508
5538
  closeContextMenu: () => void;
5509
5539
  }
5510
- declare class BottomBarStatistic extends Component<Props$n, SpreadsheetChildEnv> {
5540
+ declare class BottomBarStatistic extends Component<Props$m, SpreadsheetChildEnv> {
5511
5541
  static template: string;
5512
5542
  static components: {
5513
5543
  Ripple: typeof Ripple;
@@ -5529,13 +5559,13 @@ interface SheetState {
5529
5559
  isDnd: boolean;
5530
5560
  sheetDndPositions: Record<UID, number> | undefined;
5531
5561
  }
5532
- interface Props$m {
5562
+ interface Props$l {
5533
5563
  onClick: () => void;
5534
5564
  }
5535
5565
  interface BottomBarMenuState extends MenuState {
5536
5566
  menuId: UID | undefined;
5537
5567
  }
5538
- declare class BottomBar extends Component<Props$m, SpreadsheetChildEnv> {
5568
+ declare class BottomBar extends Component<Props$l, SpreadsheetChildEnv> {
5539
5569
  static template: string;
5540
5570
  static components: {
5541
5571
  Menu: typeof Menu;
@@ -5578,36 +5608,6 @@ declare class BottomBar extends Component<Props$m, SpreadsheetChildEnv> {
5578
5608
  get sheetListMaxScroll(): number;
5579
5609
  }
5580
5610
 
5581
- declare type ResizeAnchor = "top left" | "top" | "top right" | "right" | "bottom right" | "bottom" | "bottom left" | "left";
5582
- interface Props$l {
5583
- figure: Figure;
5584
- style: string;
5585
- onFigureDeleted: () => void;
5586
- onMouseDown: (ev: MouseEvent) => void;
5587
- onClickAnchor(dirX: ResizeDirection, dirY: ResizeDirection, ev: MouseEvent): void;
5588
- }
5589
- declare class FigureComponent extends Component<Props$l, SpreadsheetChildEnv> {
5590
- static template: string;
5591
- static components: {};
5592
- static defaultProps: {
5593
- onFigureDeleted: () => void;
5594
- onMouseDown: () => void;
5595
- onClickAnchor: () => void;
5596
- };
5597
- private borderWidth;
5598
- private figureRef;
5599
- get isSelected(): boolean;
5600
- get figureRegistry(): Registry<FigureContent>;
5601
- private getBorderWidth;
5602
- get borderStyle(): string;
5603
- get wrapperStyle(): string;
5604
- getResizerPosition(resizer: ResizeAnchor): string;
5605
- setup(): void;
5606
- clickAnchor(dirX: ResizeDirection, dirY: ResizeDirection, ev: MouseEvent): void;
5607
- onMouseDown(ev: MouseEvent): void;
5608
- onKeyDown(ev: KeyboardEvent): void;
5609
- }
5610
-
5611
5611
  declare type ContainerType = "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "dnd";
5612
5612
  interface DndState {
5613
5613
  figId: string | undefined;
@@ -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.
@@ -6689,6 +6689,7 @@ declare const components: {
6689
6689
  GaugeChartDesignPanel: typeof GaugeChartDesignPanel;
6690
6690
  ScorecardChartConfigPanel: typeof ScorecardChartConfigPanel;
6691
6691
  ScorecardChartDesignPanel: typeof ScorecardChartDesignPanel;
6692
+ FigureComponent: typeof FigureComponent;
6692
6693
  };
6693
6694
  declare function addFunction(functionName: string, functionDescription: FunctionDescription): void;
6694
6695