@odoo/o-spreadsheet 17.0.2 → 17.0.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.
@@ -17,6 +17,7 @@ declare const functionCache: {
17
17
  [key: string]: Omit<CompiledFormula, "dependencies" | "tokens">;
18
18
  };
19
19
  declare function compile(formula: string): CompiledFormula;
20
+ declare function compileTokens(tokens: Token[]): CompiledFormula;
20
21
 
21
22
  interface FunctionContext {
22
23
  parent: string;
@@ -93,6 +94,7 @@ type AST = ASTOperation | ASTUnaryOperation | ASTFuncall | ASTNumber | ASTBoolea
93
94
  * Parse an expression (as a string) into an AST.
94
95
  */
95
96
  declare function parse(str: string): AST;
97
+ declare function parseTokens(tokens: Token[]): AST;
96
98
  /**
97
99
  * Allows to visit all nodes of an AST and apply a mapping function
98
100
  * to nodes of a specific type.
@@ -2497,7 +2499,8 @@ declare const enum CommandResult {
2497
2499
  InvalidDataValidationCriterionValue = "InvalidDataValidationCriterionValue",
2498
2500
  InvalidNumberOfCriterionValues = "InvalidNumberOfCriterionValues",
2499
2501
  BlockingValidationRule = "BlockingValidationRule",
2500
- InvalidCopyPasteSelection = "InvalidCopyPasteSelection"
2502
+ InvalidCopyPasteSelection = "InvalidCopyPasteSelection",
2503
+ NoChanges = "NoChanges"
2501
2504
  }
2502
2505
  interface CommandHandler<T> {
2503
2506
  allowDispatch(command: T): CommandResult | CommandResult[];
@@ -2652,6 +2655,9 @@ interface CompiledFormula {
2652
2655
  tokens: Token[];
2653
2656
  dependencies: string[];
2654
2657
  }
2658
+ interface RangeCompiledFormula extends Omit<CompiledFormula, "dependencies"> {
2659
+ dependencies: Range[];
2660
+ }
2655
2661
  type Matrix<T = unknown> = T[][];
2656
2662
  type ValueAndFormat = {
2657
2663
  value: CellValue;
@@ -2803,8 +2809,7 @@ interface LiteralCell extends CellAttributes {
2803
2809
  }
2804
2810
  interface FormulaCell extends CellAttributes {
2805
2811
  readonly isFormula: true;
2806
- readonly compiledFormula: CompiledFormula;
2807
- readonly dependencies: Range[];
2812
+ readonly compiledFormula: RangeCompiledFormula;
2808
2813
  }
2809
2814
  type Cell = LiteralCell | FormulaCell;
2810
2815
  interface EvaluatedCellProperties {
@@ -3227,7 +3232,8 @@ interface BordersPluginState {
3227
3232
  declare class BordersPlugin extends CorePlugin<BordersPluginState> implements BordersPluginState {
3228
3233
  static getters: readonly ["getCellBorder", "getBordersColors"];
3229
3234
  readonly borders: BordersPluginState["borders"];
3230
- handle(cmd: Command): void;
3235
+ allowDispatch(cmd: CoreCommand): CommandResult.Success | CommandResult.NoChanges;
3236
+ handle(cmd: CoreCommand): void;
3231
3237
  /**
3232
3238
  * Move borders according to the inserted columns.
3233
3239
  * Ensure borders continuity.
@@ -3325,6 +3331,7 @@ declare class BordersPlugin extends CorePlugin<BordersPluginState> implements Bo
3325
3331
  * Compute the borders to add to the given zone merged.
3326
3332
  */
3327
3333
  private addBordersToMerge;
3334
+ private checkBordersUnchanged;
3328
3335
  import(data: WorkbookData): void;
3329
3336
  export(data: WorkbookData): void;
3330
3337
  exportForExcel(data: ExcelWorkbookData): void;
@@ -3349,7 +3356,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3349
3356
  };
3350
3357
  };
3351
3358
  adaptRanges(applyChange: ApplyRangeChange, sheetId?: UID): void;
3352
- allowDispatch(cmd: CoreCommand): CommandResult;
3359
+ allowDispatch(cmd: CoreCommand): CommandResult | CommandResult[];
3353
3360
  handle(cmd: CoreCommand): void;
3354
3361
  /**
3355
3362
  * Set a format to all the cells in a zone
@@ -3378,8 +3385,8 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3378
3385
  * starting an async evaluation even if it has been moved or re-allocated
3379
3386
  */
3380
3387
  getCellById(cellId: UID): Cell | undefined;
3381
- getFormulaCellContent(sheetId: UID, cell: Pick<FormulaCell, "dependencies" | "compiledFormula">, dependencies?: Range[]): string;
3382
- getTranslatedCellFormula(sheetId: UID, offsetX: number, offsetY: number, compiledFormula: CompiledFormula, dependencies: Range[]): string;
3388
+ getFormulaCellContent(sheetId: UID, compiledFormula: RangeCompiledFormula, dependencies?: Range[]): string;
3389
+ getTranslatedCellFormula(sheetId: UID, offsetX: number, offsetY: number, compiledFormula: RangeCompiledFormula): string;
3383
3390
  getCellStyle(position: CellPosition): Style;
3384
3391
  /**
3385
3392
  * Converts a zone to a XC coordinate system
@@ -3423,6 +3430,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3423
3430
  private createFormulaCellWithDependencies;
3424
3431
  private createErrorFormula;
3425
3432
  private checkCellOutOfSheet;
3433
+ private checkUselessClearCell;
3426
3434
  }
3427
3435
 
3428
3436
  /**
@@ -4053,15 +4061,6 @@ declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
4053
4061
  */
4054
4062
  private moveCellOnRowsDeletion;
4055
4063
  private updateRowsStructureOnDeletion;
4056
- /**
4057
- * Update the rows of the sheet after an addition:
4058
- * - Rename the rows
4059
- *
4060
- * @param sheet Sheet on which the deletion occurs
4061
- * @param addedRow Index of the added row
4062
- * @param rowsToAdd Number of the rows to add
4063
- */
4064
- private updateRowsStructureOnAddition;
4065
4064
  /**
4066
4065
  * Add empty rows at the end of the rows
4067
4066
  *
@@ -4083,11 +4082,9 @@ declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
4083
4082
  }
4084
4083
 
4085
4084
  declare class EvaluationPlugin extends UIPlugin {
4086
- private config;
4087
- static getters: readonly ["evaluateFormula", "getCorrespondingFormulaCell", "getRangeFormattedValues", "getRangeValues", "getRangeFormats", "getEvaluatedCell", "getEvaluatedCells", "getEvaluatedCellsInZone"];
4085
+ static getters: readonly ["evaluateFormula", "getCorrespondingFormulaCell", "getRangeFormattedValues", "getRangeValues", "getRangeFormats", "getEvaluatedCell", "getEvaluatedCells", "getEvaluatedCellsInZone", "getSpreadPositionsOf", "getArrayFormulaSpreadingOn"];
4088
4086
  private shouldRebuildDependenciesGraph;
4089
4087
  private evaluator;
4090
- private compilationParams;
4091
4088
  private positionsToUpdate;
4092
4089
  constructor(config: UIPluginConfig);
4093
4090
  beforeHandle(cmd: Command): void;
@@ -4109,6 +4106,8 @@ declare class EvaluationPlugin extends UIPlugin {
4109
4106
  getEvaluatedCell(position: CellPosition): EvaluatedCell;
4110
4107
  getEvaluatedCells(sheetId: UID): Record<UID, EvaluatedCell>;
4111
4108
  getEvaluatedCellsInZone(sheetId: UID, zone: Zone): EvaluatedCell[];
4109
+ getSpreadPositionsOf(position: CellPosition): CellPosition[];
4110
+ getArrayFormulaSpreadingOn(position: CellPosition): CellPosition | undefined;
4112
4111
  exportForExcel(data: ExcelWorkbookData): void;
4113
4112
  /**
4114
4113
  * Returns the corresponding formula cell of a given cell
@@ -4116,7 +4115,6 @@ declare class EvaluationPlugin extends UIPlugin {
4116
4115
  * formula of the array formula that spreads to the cell
4117
4116
  */
4118
4117
  getCorrespondingFormulaCell(position: CellPosition): FormulaCell | undefined;
4119
- private getCompilationParameters;
4120
4118
  }
4121
4119
 
4122
4120
  interface CustomColorState {
@@ -4142,11 +4140,11 @@ declare class CustomColorsPlugin extends UIPlugin<CustomColorState> {
4142
4140
  }
4143
4141
 
4144
4142
  interface EvaluationChartState {
4145
- readonly charts: Immutable<Record<UID, ChartRuntime | undefined>>;
4143
+ charts: Record<UID, ChartRuntime | undefined>;
4146
4144
  }
4147
4145
  declare class EvaluationChartPlugin extends UIPlugin<EvaluationChartState> {
4148
4146
  static getters: readonly ["getChartRuntime", "getBackgroundOfSingleCellChart"];
4149
- readonly charts: Immutable<Record<UID, ChartRuntime | undefined>>;
4147
+ charts: Record<UID, ChartRuntime | undefined>;
4150
4148
  private createRuntimeChart;
4151
4149
  handle(cmd: CoreViewCommand): void;
4152
4150
  getChartRuntime(figureId: UID): ChartRuntime;
@@ -7908,4 +7906,4 @@ declare const constants: {
7908
7906
  DEFAULT_LOCALE: Locale;
7909
7907
  };
7910
7908
 
7911
- export { AbstractChart, CancelledReason, Client, ClientJoinedMessage, ClientLeftMessage, ClientMovedMessage, CollaborationMessage, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, RemoteRevisionMessage, Revision, RevisionRedoneMessage, RevisionUndoneMessage, SPREADSHEET_DIMENSIONS, Spreadsheet, TransportService, UIPlugin, __info__, addFunction, astToFormula, compile, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
7909
+ export { AbstractChart, CancelledReason, Client, ClientJoinedMessage, ClientLeftMessage, ClientMovedMessage, CollaborationMessage, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, RemoteRevisionMessage, Revision, RevisionRedoneMessage, RevisionUndoneMessage, SPREADSHEET_DIMENSIONS, Spreadsheet, TransportService, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };