@odoo/o-spreadsheet 16.1.2 → 16.1.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.
@@ -792,6 +792,7 @@ interface WorkbookData {
792
792
  };
793
793
  };
794
794
  revisionId: UID;
795
+ uniqueFigureIds: boolean;
795
796
  }
796
797
  interface ExcelWorkbookData extends WorkbookData {
797
798
  sheets: ExcelSheetData[];
@@ -2196,7 +2197,7 @@ declare const enum CommandResult {
2196
2197
  InvalidRange = 25,
2197
2198
  InvalidZones = 26,
2198
2199
  InvalidSheetId = 27,
2199
- DuplicatedImageId = 28,
2200
+ InvalidFigureId = 28,
2200
2201
  InputAlreadyFocused = 29,
2201
2202
  MaximumRangesReached = 30,
2202
2203
  InvalidChartDefinition = 31,
@@ -2252,7 +2253,8 @@ declare const enum CommandResult {
2252
2253
  NonContinuousTargets = 81,
2253
2254
  DuplicatedFigureId = 82,
2254
2255
  InvalidSelectionStep = 83,
2255
- DuplicatedChartId = 84
2256
+ DuplicatedChartId = 84,
2257
+ ChartDoesNotExist = 85
2256
2258
  }
2257
2259
  interface CommandHandler<T> {
2258
2260
  allowDispatch(command: T): CommandResult | CommandResult[];
@@ -3290,24 +3292,22 @@ declare abstract class AbstractChart {
3290
3292
  * This plugin manages charts
3291
3293
  * */
3292
3294
  interface ChartState {
3293
- readonly charts: {
3294
- [sheetId: UID]: Record<UID, AbstractChart | undefined> | undefined;
3295
- };
3295
+ readonly charts: Record<UID, AbstractChart | undefined>;
3296
3296
  }
3297
3297
  declare class ChartPlugin extends CorePlugin<ChartState> implements ChartState {
3298
3298
  static getters: readonly ["isChartDefined", "getChartDefinition", "getChartType", "getChartIds", "getChart", "getContextCreationChart"];
3299
- readonly charts: ChartState["charts"];
3299
+ readonly charts: Record<UID, AbstractChart | undefined>;
3300
3300
  private createChart;
3301
3301
  private validateChartDefinition;
3302
3302
  adaptRanges(applyChange: ApplyRangeChange): void;
3303
3303
  allowDispatch(cmd: Command): CommandResult | CommandResult[];
3304
3304
  handle(cmd: CoreCommand): void;
3305
- getContextCreationChart(sheetId: UID, figureId: UID): ChartCreationContext | undefined;
3306
- getChart(sheetId: UID, figureId: UID): AbstractChart | undefined;
3307
- getChartType(sheetId: UID, figureId: UID): ChartType;
3308
- isChartDefined(sheetId: UID, figureId: UID): boolean;
3305
+ getContextCreationChart(figureId: UID): ChartCreationContext | undefined;
3306
+ getChart(figureId: UID): AbstractChart | undefined;
3307
+ getChartType(figureId: UID): ChartType;
3308
+ isChartDefined(figureId: UID): boolean;
3309
3309
  getChartIds(sheetId: UID): string[];
3310
- getChartDefinition(sheetId: UID, figureId: UID): ChartDefinition;
3310
+ getChartDefinition(figureId: UID): ChartDefinition;
3311
3311
  import(data: WorkbookData): void;
3312
3312
  export(data: WorkbookData): void;
3313
3313
  exportForExcel(data: ExcelWorkbookData): void;
@@ -3321,6 +3321,7 @@ declare class ChartPlugin extends CorePlugin<ChartState> implements ChartState {
3321
3321
  */
3322
3322
  private addChart;
3323
3323
  private checkChartDuplicate;
3324
+ private checkChartExists;
3324
3325
  }
3325
3326
 
3326
3327
  interface ConditionalFormatState {
@@ -3371,12 +3372,14 @@ declare class ConditionalFormatPlugin extends CorePlugin<ConditionalFormatState>
3371
3372
 
3372
3373
  interface FigureState {
3373
3374
  readonly figures: {
3374
- [sheet: UID]: Record<UID, Figure | undefined> | undefined;
3375
+ [sheet: string]: Record<UID, Figure | undefined> | undefined;
3375
3376
  };
3376
3377
  }
3377
3378
  declare class FigurePlugin extends CorePlugin<FigureState> implements FigureState {
3378
- static getters: readonly ["getFigures", "getFigure"];
3379
- readonly figures: FigureState["figures"];
3379
+ static getters: readonly ["getFigures", "getFigure", "getFigureSheetId"];
3380
+ readonly figures: {
3381
+ [sheet: string]: Record<UID, Figure | undefined> | undefined;
3382
+ };
3380
3383
  allowDispatch(cmd: CoreCommand): CommandResult;
3381
3384
  handle(cmd: CoreCommand): void;
3382
3385
  private updateFigure;
@@ -3387,6 +3390,7 @@ declare class FigurePlugin extends CorePlugin<FigureState> implements FigureStat
3387
3390
  private checkFigureDuplicate;
3388
3391
  getFigures(sheetId: UID): Figure[];
3389
3392
  getFigure(sheetId: string, figureId: string): Figure | undefined;
3393
+ getFigureSheetId(figureId: string): UID | undefined;
3390
3394
  import(data: WorkbookData): void;
3391
3395
  export(data: WorkbookData): void;
3392
3396
  exportForExcel(data: ExcelWorkbookData): void;
@@ -3507,7 +3511,7 @@ interface ImageState {
3507
3511
  readonly images: Record<UID, Record<UID, Image | undefined> | undefined>;
3508
3512
  }
3509
3513
  declare class ImagePlugin extends CorePlugin<ImageState> implements ImageState {
3510
- static getters: readonly ["getImage"];
3514
+ static getters: readonly ["getImage", "getImagePath", "getImageSize"];
3511
3515
  readonly fileStore?: FileStore;
3512
3516
  readonly images: Record<UID, Record<UID, Image | undefined> | undefined>;
3513
3517
  /**
@@ -3515,13 +3519,15 @@ declare class ImagePlugin extends CorePlugin<ImageState> implements ImageState {
3515
3519
  */
3516
3520
  readonly syncedImages: Set<Image["path"]>;
3517
3521
  constructor(config: CorePluginConfig);
3518
- allowDispatch(cmd: CoreCommand): CommandResult.Success | CommandResult.DuplicatedImageId;
3522
+ allowDispatch(cmd: CoreCommand): CommandResult.Success | CommandResult.InvalidFigureId;
3519
3523
  handle(cmd: CoreCommand): void;
3520
3524
  /**
3521
3525
  * Delete unused images from the file store
3522
3526
  */
3523
3527
  garbageCollectExternalResources(): void;
3524
- getImage(sheetId: UID, figureId: UID): Image;
3528
+ getImage(figureId: UID): Image;
3529
+ getImagePath(figureId: UID): string;
3530
+ getImageSize(figureId: UID): FigureSize;
3525
3531
  private addFigure;
3526
3532
  import(data: WorkbookData): void;
3527
3533
  export(data: WorkbookData): void;
@@ -3813,12 +3819,10 @@ declare class EvaluationPlugin extends UIPlugin {
3813
3819
 
3814
3820
  declare class EvaluationChartPlugin extends UIPlugin {
3815
3821
  static getters: readonly ["getChartRuntime", "getBackgroundOfSingleCellChart"];
3816
- readonly charts: {
3817
- [sheetId: UID]: Record<UID, ChartRuntime | undefined> | undefined;
3818
- };
3822
+ readonly charts: Record<UID, ChartRuntime | undefined>;
3819
3823
  private createRuntimeChart;
3820
3824
  handle(cmd: Command): void;
3821
- getChartRuntime(sheetId: UID, figureId: UID): ChartRuntime;
3825
+ getChartRuntime(figureId: UID): ChartRuntime;
3822
3826
  /**
3823
3827
  * Get the background color of a chart based on the color of the first cell of the main range
3824
3828
  * of the chart. In order of priority, it will return :
@@ -5001,7 +5005,6 @@ declare class SelectionInput extends Component<Props$x, SpreadsheetChildEnv> {
5001
5005
  }
5002
5006
 
5003
5007
  interface Props$w {
5004
- sheetId: UID;
5005
5008
  figureId: UID;
5006
5009
  definition: LineChartDefinition | BarChartDefinition | PieChartDefinition;
5007
5010
  updateChart: (definition: Partial<LineChartDefinition | BarChartDefinition | PieChartDefinition>) => DispatchResult;
@@ -5086,7 +5089,6 @@ declare class LineBarPieDesignPanel extends Component<Props$v, SpreadsheetChildE
5086
5089
  }
5087
5090
 
5088
5091
  interface Props$u {
5089
- sheetId: UID;
5090
5092
  figureId: UID;
5091
5093
  definition: GaugeChartDefinition;
5092
5094
  updateChart: (definition: Partial<GaugeChartDefinition>) => DispatchResult;
@@ -5142,7 +5144,6 @@ declare class LineConfigPanel extends LineBarPieConfigPanel {
5142
5144
  }
5143
5145
 
5144
5146
  interface Props$s {
5145
- sheetId: UID;
5146
5147
  figureId: UID;
5147
5148
  definition: ScorecardChartDefinition;
5148
5149
  updateChart: (definition: Partial<ScorecardChartDefinition>) => DispatchResult;
@@ -5287,7 +5288,7 @@ declare class ChartJsComponent extends Component<Props$q, SpreadsheetChildEnv> {
5287
5288
  static template: string;
5288
5289
  private canvas;
5289
5290
  private chart?;
5290
- get background(): Color;
5291
+ get background(): string;
5291
5292
  get canvasStyle(): string;
5292
5293
  get chartRuntime(): ChartJSRuntime;
5293
5294
  setup(): void;