@odoo/o-spreadsheet 16.4.0-alpha.0 → 16.4.0-alpha.1

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.
@@ -1132,7 +1132,6 @@ interface ModelConfig {
1132
1132
  readonly client: Client;
1133
1133
  readonly snapshotRequested: boolean;
1134
1134
  readonly notifyUI: (payload: NotifyUIEvent) => void;
1135
- readonly lazyEvaluation: boolean;
1136
1135
  }
1137
1136
  declare class Model extends EventBus<any> implements CommandDispatcher {
1138
1137
  private corePlugins;
@@ -1365,7 +1364,6 @@ interface UIPluginConfig {
1365
1364
  readonly moveClient: (position: ClientPosition) => void;
1366
1365
  readonly uiActions: UIActions;
1367
1366
  readonly custom: ModelConfig["custom"];
1368
- readonly lazyEvaluation: boolean;
1369
1367
  readonly session: Session;
1370
1368
  }
1371
1369
  interface UIPluginConstructor {
@@ -2502,34 +2500,44 @@ interface Border$1 {
2502
2500
  right?: BorderDescr;
2503
2501
  }
2504
2502
  declare type ReferenceDenormalizer = (range: Range, isMeta: boolean, functionName: string, paramNumber: number) => any | any[][];
2505
- declare type EnsureRange = (range: Range) => any[][];
2503
+ declare type EnsureRange = (range: Range) => MatrixArg;
2506
2504
  declare type _CompiledFormula = (deps: Range[], refFn: ReferenceDenormalizer, range: EnsureRange, ctx: {}) => FormulaReturn;
2507
2505
  interface CompiledFormula {
2508
2506
  execute: _CompiledFormula;
2509
2507
  tokens: Token[];
2510
2508
  dependencies: string[];
2511
2509
  }
2510
+ declare type Matrix<T = unknown> = T[][];
2512
2511
  declare type Arg = MatrixArg | PrimitiveArg;
2513
- declare type MatrixArg = ({
2514
- value: CellValue;
2515
- format?: Format;
2516
- } | undefined)[][];
2512
+ declare type MatrixArg = {
2513
+ value: MatrixArgValue;
2514
+ format?: MatrixArgFormat;
2515
+ };
2517
2516
  declare type PrimitiveArg = {
2518
2517
  value: PrimitiveArgValue;
2519
- format?: Format;
2518
+ format?: PrimitiveFormat;
2520
2519
  };
2521
2520
  declare type ArgValue = PrimitiveArgValue | MatrixArgValue;
2522
- declare type MatrixArgValue = (CellValue | undefined)[][];
2523
- declare type PrimitiveArgValue = string | number | boolean | null;
2524
- declare type FunctionReturn = {
2525
- value: FunctionReturnValue;
2526
- format?: Format;
2521
+ declare type MatrixArgValue = Matrix<CellValue | undefined>;
2522
+ declare type PrimitiveArgValue = CellValue | null;
2523
+ declare type MatrixArgFormat = Matrix<PrimitiveFormat>;
2524
+ declare type PrimitiveFormat = Format | undefined;
2525
+ declare type FunctionReturn = MatrixFunctionReturn | PrimitiveFunctionReturn;
2526
+ declare type FunctionReturnValue = CellValue | Matrix<CellValue>;
2527
+ declare type FunctionReturnFormat = PrimitiveFormat | MatrixArgFormat;
2528
+ declare type MatrixFunctionReturn = {
2529
+ value: Matrix<CellValue>;
2530
+ format?: FunctionReturnFormat;
2531
+ };
2532
+ declare type PrimitiveFunctionReturn = {
2533
+ value: CellValue;
2534
+ format?: PrimitiveFormat;
2535
+ };
2536
+ declare type FormulaReturn = MatrixFunctionReturn | PrimitiveFormulaReturn;
2537
+ declare type PrimitiveFormulaReturn = {
2538
+ value: CellValue | null;
2539
+ format?: PrimitiveFormat;
2527
2540
  };
2528
- interface FormulaReturn extends Omit<FunctionReturn, "value"> {
2529
- value: FunctionReturnValue | null;
2530
- format?: Format;
2531
- }
2532
- declare type FunctionReturnValue = string | number | boolean;
2533
2541
  interface HeaderDimensions {
2534
2542
  start: Pixel;
2535
2543
  size: Pixel;
@@ -2825,7 +2833,7 @@ declare type ComputeFunction<T, R> = (this: EvalContext, ...args: ComputeFunctio
2825
2833
  interface AddFunctionDescription {
2826
2834
  description: string;
2827
2835
  compute: ComputeFunction<ArgValue, FunctionReturnValue>;
2828
- computeFormat?: ComputeFunction<Arg, Format | undefined>;
2836
+ computeFormat?: ComputeFunction<Arg, FunctionReturnFormat>;
2829
2837
  category?: string;
2830
2838
  args: ArgDefinition[];
2831
2839
  returns: [ArgType];
@@ -3693,31 +3701,14 @@ declare class SheetPlugin extends CorePlugin<SheetState$1> implements SheetState
3693
3701
  private checkZonesAreInSheet;
3694
3702
  }
3695
3703
 
3696
- /**
3697
- * CustomColors plugin
3698
- * This plugins aims to compute and keep to custom colors used in the
3699
- * current spreadsheet
3700
- */
3701
- declare class CustomColorsPlugin extends UIPlugin {
3702
- private customColors;
3703
- private shouldUpdateColors;
3704
- static getters: readonly ["getCustomColors"];
3705
- handle(cmd: Command): void;
3706
- finalize(): void;
3707
- getCustomColors(): Color[];
3708
- private getColorsFromCells;
3709
- private getFormattingColors;
3710
- private getChartColors;
3711
- private tryToAddColor;
3712
- }
3713
-
3714
3704
  declare class EvaluationPlugin extends UIPlugin {
3715
- static getters: readonly ["evaluateFormula", "getRangeFormattedValues", "getRangeValues", "getRangeFormats", "getEvaluatedCell", "getEvaluatedCells", "getColEvaluatedCells", "getEvaluatedCellsInZone"];
3716
- private isUpToDate;
3717
- private evaluatedCells;
3718
- private readonly evalContext;
3719
- private readonly lazyEvaluation;
3705
+ static getters: readonly ["evaluateFormula", "getRangeFormattedValues", "getRangeValues", "getRangeFormats", "getEvaluatedCell", "getEvaluatedCells", "getEvaluatedCellsInZone"];
3706
+ private shouldRebuildDependenciesGraph;
3707
+ private evaluator;
3708
+ private compilationParams;
3709
+ private positionsToUpdate;
3720
3710
  constructor(config: UIPluginConfig);
3711
+ beforeHandle(cmd: Command): void;
3721
3712
  handle(cmd: Command): void;
3722
3713
  finalize(): void;
3723
3714
  evaluateFormula(formulaString: string, sheetId?: UID): any;
@@ -3733,25 +3724,34 @@ declare class EvaluationPlugin extends UIPlugin {
3733
3724
  * Return the format of each cell in the range.
3734
3725
  */
3735
3726
  getRangeFormats(range: Range): (Format | undefined)[];
3736
- getEvaluatedCell({ sheetId, col, row }: CellPosition): EvaluatedCell;
3727
+ getEvaluatedCell(position: CellPosition): EvaluatedCell;
3737
3728
  getEvaluatedCells(sheetId: UID): Record<UID, EvaluatedCell>;
3738
- /**
3739
- * Returns all the evaluated cells of a col
3740
- */
3741
- getColEvaluatedCells(sheetId: UID, col: HeaderIndex): EvaluatedCell[];
3742
3729
  getEvaluatedCellsInZone(sheetId: UID, zone: Zone): EvaluatedCell[];
3743
- private setEvaluatedCell;
3744
- private getAllCells;
3745
- private evaluate;
3730
+ exportForExcel(data: ExcelWorkbookData): void;
3746
3731
  /**
3747
- * Return all functions necessary to properly evaluate a formula:
3748
- * - a refFn function to read any reference, cell or range of a normalized formula
3749
- * - a range function to convert any reference to a proper value array
3750
- * - an evaluation context
3732
+ * Returns the corresponding formula cell of a given cell
3733
+ * It could be the formula present in the cell itself or the
3734
+ * formula of the array formula that spreads to the cell
3751
3735
  */
3752
- private getCompilationParameters;
3753
- exportForExcel(data: ExcelWorkbookData): void;
3754
- private isBadExpression;
3736
+ private getCorrespondingFormulaCell;
3737
+ }
3738
+
3739
+ /**
3740
+ * CustomColors plugin
3741
+ * This plugins aims to compute and keep to custom colors used in the
3742
+ * current spreadsheet
3743
+ */
3744
+ declare class CustomColorsPlugin extends UIPlugin {
3745
+ private customColors;
3746
+ private shouldUpdateColors;
3747
+ static getters: readonly ["getCustomColors"];
3748
+ handle(cmd: Command): void;
3749
+ finalize(): void;
3750
+ getCustomColors(): Color[];
3751
+ private getColorsFromCells;
3752
+ private getFormattingColors;
3753
+ private getChartColors;
3754
+ private tryToAddColor;
3755
3755
  }
3756
3756
 
3757
3757
  declare class EvaluationChartPlugin extends UIPlugin {