@odoo/o-spreadsheet 17.1.0-alpha.2 → 17.1.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.
@@ -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.
@@ -1428,80 +1430,6 @@ declare class UIPlugin<State = any> extends BasePlugin<State, Command> {
1428
1430
  drawGrid(ctx: GridRenderingContext, layer: LAYERS): void;
1429
1431
  }
1430
1432
 
1431
- interface SearchOptions {
1432
- matchCase: boolean;
1433
- exactMatch: boolean;
1434
- searchFormulas: boolean;
1435
- }
1436
- interface SearchMatch {
1437
- selected: boolean;
1438
- col: HeaderIndex;
1439
- row: HeaderIndex;
1440
- }
1441
- /**
1442
- * Find and Replace Plugin
1443
- *
1444
- * This plugin is used in combination with the find_and_replace sidePanel
1445
- * It is used to 'highlight' cells that match an input string according to
1446
- * the given searchOptions. The second part of this plugin makes it possible
1447
- * (again with the find_and_replace sidePanel), to replace the values that match
1448
- * the search with a new value.
1449
- */
1450
- declare class FindAndReplacePlugin extends UIPlugin {
1451
- static layers: LAYERS[];
1452
- static getters: readonly ["getSearchMatches", "getCurrentSelectedMatchIndex"];
1453
- private searchMatches;
1454
- private selectedMatchIndex;
1455
- private currentSearchRegex;
1456
- private searchOptions;
1457
- private toSearch;
1458
- private isSearchDirty;
1459
- handle(cmd: Command): void;
1460
- finalize(): void;
1461
- getSearchMatches(): SearchMatch[];
1462
- getCurrentSelectedMatchIndex(): number | null;
1463
- /**
1464
- * Will update the current searchOptions and accordingly update the regex.
1465
- * It will then search for matches using the regex and store them.
1466
- */
1467
- private updateSearch;
1468
- /**
1469
- * refresh the matches according to the current search options
1470
- */
1471
- private refreshSearch;
1472
- /**
1473
- * Updates the regex based on the current searchOptions and
1474
- * the value toSearch
1475
- */
1476
- private updateRegex;
1477
- /**
1478
- * Find matches using the current regex
1479
- */
1480
- private findMatches;
1481
- private sortByRowThenColumn;
1482
- /**
1483
- * Changes the selected search cell. Given a direction it will
1484
- * Change the selection to the previous, current or nextCell,
1485
- * if it exists otherwise it will set the selectedMatchIndex to null.
1486
- * It will also reset the index to 0 if the search has changed.
1487
- * It is also used to keep coherence between the selected searchMatch
1488
- * and selectedMatchIndex.
1489
- */
1490
- private selectNextCell;
1491
- private clearSearch;
1492
- private replaceMatch;
1493
- /**
1494
- * Replace the value of the currently selected match
1495
- */
1496
- private replace;
1497
- /**
1498
- * Apply the replace function to all the matches one time.
1499
- */
1500
- private replaceAll;
1501
- private getSearchableString;
1502
- drawGrid(renderingContext: GridRenderingContext): void;
1503
- }
1504
-
1505
1433
  type EditionMode = "editing" | "selecting" | "inactive";
1506
1434
  interface ComposerSelection {
1507
1435
  start: number;
@@ -1689,6 +1617,14 @@ type ClipboardContent = {
1689
1617
  };
1690
1618
  type ClipboardPasteOptions = "onlyFormat" | "onlyValue";
1691
1619
 
1620
+ interface SearchOptions {
1621
+ matchCase: boolean;
1622
+ exactMatch: boolean;
1623
+ searchFormulas: boolean;
1624
+ searchScope: "allSheets" | "activeSheet" | "specificRange";
1625
+ specificRange?: RangeData;
1626
+ }
1627
+
1692
1628
  /**
1693
1629
  * There are two kinds of commands: CoreCommands and LocalCommands
1694
1630
  *
@@ -2497,7 +2433,8 @@ declare const enum CommandResult {
2497
2433
  InvalidDataValidationCriterionValue = "InvalidDataValidationCriterionValue",
2498
2434
  InvalidNumberOfCriterionValues = "InvalidNumberOfCriterionValues",
2499
2435
  BlockingValidationRule = "BlockingValidationRule",
2500
- InvalidCopyPasteSelection = "InvalidCopyPasteSelection"
2436
+ InvalidCopyPasteSelection = "InvalidCopyPasteSelection",
2437
+ NoChanges = "NoChanges"
2501
2438
  }
2502
2439
  interface CommandHandler<T> {
2503
2440
  allowDispatch(command: T): CommandResult | CommandResult[];
@@ -2652,6 +2589,9 @@ interface CompiledFormula {
2652
2589
  tokens: Token[];
2653
2590
  dependencies: string[];
2654
2591
  }
2592
+ interface RangeCompiledFormula extends Omit<CompiledFormula, "dependencies"> {
2593
+ dependencies: Range[];
2594
+ }
2655
2595
  type Matrix<T = unknown> = T[][];
2656
2596
  type ValueAndFormat = {
2657
2597
  value: CellValue;
@@ -2803,8 +2743,7 @@ interface LiteralCell extends CellAttributes {
2803
2743
  }
2804
2744
  interface FormulaCell extends CellAttributes {
2805
2745
  readonly isFormula: true;
2806
- readonly compiledFormula: CompiledFormula;
2807
- readonly dependencies: Range[];
2746
+ readonly compiledFormula: RangeCompiledFormula;
2808
2747
  }
2809
2748
  type Cell = LiteralCell | FormulaCell;
2810
2749
  interface EvaluatedCellProperties {
@@ -3074,50 +3013,6 @@ interface SpreadsheetChildEnv extends SpreadsheetEnv {
3074
3013
  loadLocales: () => Promise<Locale[]>;
3075
3014
  }
3076
3015
 
3077
- type ArgType = "ANY" | "BOOLEAN" | "NUMBER" | "STRING" | "DATE" | "RANGE" | "RANGE<BOOLEAN>" | "RANGE<NUMBER>" | "RANGE<DATE>" | "RANGE<STRING>" | "RANGE<ANY>" | "META";
3078
- interface ArgDefinition {
3079
- repeating?: boolean;
3080
- optional?: boolean;
3081
- lazy?: boolean;
3082
- description: string;
3083
- name: string;
3084
- type: ArgType[];
3085
- default?: boolean;
3086
- defaultValue?: any;
3087
- }
3088
- type ComputeFunctionArg<T> = T | (() => T);
3089
- type ComputeFunction<T, R> = (this: EvalContext, ...args: ComputeFunctionArg<T>[]) => R;
3090
- interface AddFunctionDescriptionBase {
3091
- description: string;
3092
- category?: string;
3093
- args: ArgDefinition[];
3094
- returns: [ArgType];
3095
- isExported?: boolean;
3096
- hidden?: boolean;
3097
- }
3098
- interface ComputeValue {
3099
- compute: ComputeFunction<ArgValue, CellValue | Matrix<CellValue>>;
3100
- }
3101
- interface ComputeFormat {
3102
- computeFormat: ComputeFunction<Arg, Format | undefined | Matrix<Format | undefined>>;
3103
- }
3104
- interface ComputeValueAndFormat {
3105
- computeValueAndFormat: ComputeFunction<Arg, Matrix<ValueAndFormat> | ValueAndFormat>;
3106
- }
3107
- type AddFunctionDescription = (AddFunctionDescriptionBase & ComputeValue & Partial<ComputeFormat>) | (AddFunctionDescriptionBase & ComputeValueAndFormat);
3108
- type FunctionDescription = AddFunctionDescription & {
3109
- minArgRequired: number;
3110
- maxArgPossible: number;
3111
- nbrArgRepeating: number;
3112
- getArgToFocus: (argPosition: number) => number;
3113
- };
3114
- type EvalContext = {
3115
- __lastFnCalled?: string;
3116
- __originCellXC?: () => string;
3117
- locale: Locale;
3118
- [key: string]: any;
3119
- };
3120
-
3121
3016
  declare class RangeAdapter implements CommandHandler<CoreCommand> {
3122
3017
  private getters;
3123
3018
  private providers;
@@ -3227,7 +3122,8 @@ interface BordersPluginState {
3227
3122
  declare class BordersPlugin extends CorePlugin<BordersPluginState> implements BordersPluginState {
3228
3123
  static getters: readonly ["getCellBorder", "getBordersColors"];
3229
3124
  readonly borders: BordersPluginState["borders"];
3230
- handle(cmd: Command): void;
3125
+ allowDispatch(cmd: CoreCommand): CommandResult.Success | CommandResult.NoChanges;
3126
+ handle(cmd: CoreCommand): void;
3231
3127
  /**
3232
3128
  * Move borders according to the inserted columns.
3233
3129
  * Ensure borders continuity.
@@ -3325,6 +3221,7 @@ declare class BordersPlugin extends CorePlugin<BordersPluginState> implements Bo
3325
3221
  * Compute the borders to add to the given zone merged.
3326
3222
  */
3327
3223
  private addBordersToMerge;
3224
+ private checkBordersUnchanged;
3328
3225
  import(data: WorkbookData): void;
3329
3226
  export(data: WorkbookData): void;
3330
3227
  exportForExcel(data: ExcelWorkbookData): void;
@@ -3341,7 +3238,7 @@ interface CoreState {
3341
3238
  * cell and sheet content.
3342
3239
  */
3343
3240
  declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3344
- static getters: readonly ["zoneToXC", "getCells", "getFormulaCellContent", "getTranslatedCellFormula", "getCellStyle", "getCellById"];
3241
+ static getters: readonly ["zoneToXC", "getCells", "getTranslatedCellFormula", "getCellStyle", "getCellById"];
3345
3242
  readonly nextId = 1;
3346
3243
  readonly cells: {
3347
3244
  [sheetId: string]: {
@@ -3349,7 +3246,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3349
3246
  };
3350
3247
  };
3351
3248
  adaptRanges(applyChange: ApplyRangeChange, sheetId?: UID): void;
3352
- allowDispatch(cmd: CoreCommand): CommandResult;
3249
+ allowDispatch(cmd: CoreCommand): CommandResult | CommandResult[];
3353
3250
  handle(cmd: CoreCommand): void;
3354
3251
  /**
3355
3252
  * Set a format to all the cells in a zone
@@ -3378,8 +3275,8 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3378
3275
  * starting an async evaluation even if it has been moved or re-allocated
3379
3276
  */
3380
3277
  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;
3278
+ private getFormulaCellContent;
3279
+ getTranslatedCellFormula(sheetId: UID, offsetX: number, offsetY: number, compiledFormula: RangeCompiledFormula): string;
3383
3280
  getCellStyle(position: CellPosition): Style;
3384
3281
  /**
3385
3282
  * Converts a zone to a XC coordinate system
@@ -3423,6 +3320,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3423
3320
  private createFormulaCellWithDependencies;
3424
3321
  private createErrorFormula;
3425
3322
  private checkCellOutOfSheet;
3323
+ private checkUselessClearCell;
3426
3324
  }
3427
3325
 
3428
3326
  /**
@@ -4053,15 +3951,6 @@ declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
4053
3951
  */
4054
3952
  private moveCellOnRowsDeletion;
4055
3953
  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
3954
  /**
4066
3955
  * Add empty rows at the end of the rows
4067
3956
  *
@@ -4083,11 +3972,9 @@ declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
4083
3972
  }
4084
3973
 
4085
3974
  declare class EvaluationPlugin extends UIPlugin {
4086
- private config;
4087
- static getters: readonly ["evaluateFormula", "getCorrespondingFormulaCell", "getRangeFormattedValues", "getRangeValues", "getRangeFormats", "getEvaluatedCell", "getEvaluatedCells", "getEvaluatedCellsInZone"];
3975
+ static getters: readonly ["evaluateFormula", "getCorrespondingFormulaCell", "getRangeFormattedValues", "getRangeValues", "getRangeFormats", "getEvaluatedCell", "getEvaluatedCells", "getEvaluatedCellsInZone", "getSpreadPositionsOf", "getArrayFormulaSpreadingOn"];
4088
3976
  private shouldRebuildDependenciesGraph;
4089
3977
  private evaluator;
4090
- private compilationParams;
4091
3978
  private positionsToUpdate;
4092
3979
  constructor(config: UIPluginConfig);
4093
3980
  beforeHandle(cmd: Command): void;
@@ -4109,6 +3996,8 @@ declare class EvaluationPlugin extends UIPlugin {
4109
3996
  getEvaluatedCell(position: CellPosition): EvaluatedCell;
4110
3997
  getEvaluatedCells(sheetId: UID): Record<UID, EvaluatedCell>;
4111
3998
  getEvaluatedCellsInZone(sheetId: UID, zone: Zone): EvaluatedCell[];
3999
+ getSpreadPositionsOf(position: CellPosition): CellPosition[];
4000
+ getArrayFormulaSpreadingOn(position: CellPosition): CellPosition | undefined;
4112
4001
  exportForExcel(data: ExcelWorkbookData): void;
4113
4002
  /**
4114
4003
  * Returns the corresponding formula cell of a given cell
@@ -4116,7 +4005,6 @@ declare class EvaluationPlugin extends UIPlugin {
4116
4005
  * formula of the array formula that spreads to the cell
4117
4006
  */
4118
4007
  getCorrespondingFormulaCell(position: CellPosition): FormulaCell | undefined;
4119
- private getCompilationParameters;
4120
4008
  }
4121
4009
 
4122
4010
  interface CustomColorState {
@@ -4142,11 +4030,11 @@ declare class CustomColorsPlugin extends UIPlugin<CustomColorState> {
4142
4030
  }
4143
4031
 
4144
4032
  interface EvaluationChartState {
4145
- readonly charts: Immutable<Record<UID, ChartRuntime | undefined>>;
4033
+ charts: Record<UID, ChartRuntime | undefined>;
4146
4034
  }
4147
4035
  declare class EvaluationChartPlugin extends UIPlugin<EvaluationChartState> {
4148
4036
  static getters: readonly ["getChartRuntime", "getBackgroundOfSingleCellChart"];
4149
- readonly charts: Immutable<Record<UID, ChartRuntime | undefined>>;
4037
+ charts: Record<UID, ChartRuntime | undefined>;
4150
4038
  private createRuntimeChart;
4151
4039
  handle(cmd: CoreViewCommand): void;
4152
4040
  getChartRuntime(figureId: UID): ChartRuntime;
@@ -4453,6 +4341,78 @@ declare class CollaborativePlugin extends UIPlugin {
4453
4341
  drawGrid(renderingContext: GridRenderingContext): void;
4454
4342
  }
4455
4343
 
4344
+ /**
4345
+ * Find and Replace Plugin
4346
+ *
4347
+ * This plugin is used in combination with the find_and_replace sidePanel
4348
+ * It is used to 'highlight' cells that match an input string according to
4349
+ * the given searchOptions. The second part of this plugin makes it possible
4350
+ * (again with the find_and_replace sidePanel), to replace the values that match
4351
+ * the search with a new value.
4352
+ */
4353
+ declare class FindAndReplacePlugin extends UIPlugin {
4354
+ static layers: LAYERS[];
4355
+ static getters: readonly ["getSearchMatches", "getCurrentSelectedMatchIndex", "getSearchOptions", "getAllSheetMatchesCount", "getActiveSheetMatchesCount", "getSpecificRangeMatchesCount"];
4356
+ private allSheetsMatches;
4357
+ private activeSheetMatches;
4358
+ private specificRangeMatches;
4359
+ private selectedMatchIndex;
4360
+ private currentSearchRegex;
4361
+ private searchOptions;
4362
+ private toSearch;
4363
+ private isSearchDirty;
4364
+ get searchMatches(): CellPosition[];
4365
+ handle(cmd: Command): void;
4366
+ finalize(): void;
4367
+ getSearchMatches(): CellPosition[];
4368
+ getCurrentSelectedMatchIndex(): number | null;
4369
+ getSearchOptions(): SearchOptions;
4370
+ getAllSheetMatchesCount(): number;
4371
+ getActiveSheetMatchesCount(): number;
4372
+ getSpecificRangeMatchesCount(): number;
4373
+ /**
4374
+ * Will update the current searchOptions and accordingly update the regex.
4375
+ * It will then search for matches using the regex and store them.
4376
+ */
4377
+ private updateSearch;
4378
+ /**
4379
+ * refresh the matches according to the current search options
4380
+ */
4381
+ private refreshSearch;
4382
+ /**
4383
+ * Updates the regex based on the current searchOptions and
4384
+ * the value toSearch
4385
+ */
4386
+ private updateRegex;
4387
+ private getSheetsInSearchOrder;
4388
+ /**
4389
+ * Find matches using the current regex
4390
+ */
4391
+ private findMatches;
4392
+ private findMatchesInSheet;
4393
+ /**
4394
+ * Changes the selected search cell. Given a direction it will
4395
+ * Change the selection to the previous, current or nextCell,
4396
+ * if it exists otherwise it will set the selectedMatchIndex to null.
4397
+ * It will also reset the index to 0 if the search has changed.
4398
+ * It is also used to keep coherence between the selected searchMatch
4399
+ * and selectedMatchIndex.
4400
+ */
4401
+ private selectNextCell;
4402
+ private clearSearch;
4403
+ private replaceMatch;
4404
+ /**
4405
+ * Replace the value of the currently selected match
4406
+ */
4407
+ private replace;
4408
+ /**
4409
+ * Apply the replace function to all the matches one time.
4410
+ */
4411
+ private replaceAll;
4412
+ private getSearchableString;
4413
+ drawGrid(renderingContext: GridRenderingContext): void;
4414
+ }
4415
+
4456
4416
  declare class HeaderVisibilityUIPlugin extends UIPlugin {
4457
4417
  static getters: readonly ["getNextVisibleCellPosition", "findVisibleHeader", "findLastVisibleColRowIndex", "findFirstVisibleColRowIndex", "isRowHidden", "isColHidden", "isHeaderHidden"];
4458
4418
  isRowHidden(sheetId: UID, index: number): boolean;
@@ -4659,56 +4619,10 @@ declare class SelectionInputsManagerPlugin extends UIPlugin {
4659
4619
  }
4660
4620
 
4661
4621
  declare class SortPlugin extends UIPlugin {
4662
- static getters: readonly ["getContiguousZone"];
4663
4622
  allowDispatch(cmd: LocalCommand): CommandResult | CommandResult[];
4664
4623
  handle(cmd: Command): void;
4665
4624
  private checkMerge;
4666
4625
  private checkMergeSizes;
4667
- /**
4668
- * safe-version of expandZone to make sure we don't get out of the grid
4669
- */
4670
- private expand;
4671
- /**
4672
- * verifies the presence of at least one non-empty cell in the given zone
4673
- */
4674
- private checkExpandedValues;
4675
- /**
4676
- * This function will expand the provided zone in directions (top, bottom, left, right) for which there
4677
- * are non-null cells on the external boundary of the zone in the given direction.
4678
- *
4679
- * Example:
4680
- * A B C D E
4681
- * ___ ___ ___ ___ ___
4682
- * 1 | | D | | | |
4683
- * ___ ___ ___ ___ ___
4684
- * 2 | 5 | | 1 | D | |
4685
- * ___ ___ ___ ___ ___
4686
- * 3 | | | A | X | |
4687
- * ___ ___ ___ ___ ___
4688
- * 4 | | | | | |
4689
- * ___ ___ ___ ___ ___
4690
- *
4691
- * Let's consider a provided zone corresponding to (C2:D3) - (left:2, right: 3, top:1, bottom:2)
4692
- * - the top external boundary is (B1:E1)
4693
- * Since we have B1='D' != "", we expand to the top: => (C1:D3)
4694
- * The top boundary having reached the top of the grid, we cannot expand in that direction anymore
4695
- *
4696
- * - the left boundary is (B1:B4)
4697
- * since we have B1 again, we expand to the left => (B1:D3)
4698
- *
4699
- * - the right and bottom boundaries are a dead end for now as (E1:E4) and (A4:E4) are empty.
4700
- *
4701
- * - the left boundary is now (A1:A4)
4702
- * Since we have A2=5 != "", we can therefore expand to the left => (A1:D3)
4703
- *
4704
- * This will be the final zone as left and top have reached the boundaries of the grid and
4705
- * the other boundaries (E1:E4) and (A4:E4) are empty.
4706
- *
4707
- * @param sheetId UID of concerned sheet
4708
- * @param zone Zone
4709
- *
4710
- */
4711
- getContiguousZone(sheetId: UID, zone: Zone): Zone;
4712
4626
  /**
4713
4627
  * This function evaluates if the top row of a provided zone can be considered as a `header`
4714
4628
  * by checking the following criteria:
@@ -4760,7 +4674,7 @@ declare class UIOptionsPlugin extends UIPlugin {
4760
4674
  }
4761
4675
 
4762
4676
  declare class SheetUIPlugin extends UIPlugin {
4763
- static getters: readonly ["doesCellHaveGridIcon", "getCellWidth", "getTextWidth", "getCellText", "getCellMultiLineText"];
4677
+ static getters: readonly ["doesCellHaveGridIcon", "getCellWidth", "getTextWidth", "getCellText", "getCellMultiLineText", "getContiguousZone", "isCellEmpty"];
4764
4678
  private ctx;
4765
4679
  allowDispatch(cmd: LocalCommand): CommandResult | CommandResult[];
4766
4680
  handle(cmd: Command): void;
@@ -4773,6 +4687,15 @@ declare class SheetUIPlugin extends UIPlugin {
4773
4687
  */
4774
4688
  getCellMultiLineText(position: CellPosition, width: number | undefined): string[];
4775
4689
  doesCellHaveGridIcon(position: CellPosition): boolean;
4690
+ /**
4691
+ * Expands the given zone until bordered by empty cells or reached the sheet boundaries.
4692
+ */
4693
+ getContiguousZone(sheetId: UID, zoneToExpand: Zone): Zone;
4694
+ /**
4695
+ * Check if a cell is empty. If the cell is part of a merge,
4696
+ * check if the merge containing the cell is empty.
4697
+ */
4698
+ isCellEmpty(position: CellPosition): boolean;
4776
4699
  private getColMaxWidth;
4777
4700
  /**
4778
4701
  * Check that any "sheetId" in the command matches an existing
@@ -5248,6 +5171,52 @@ type Getters = {
5248
5171
  isDashboard: () => boolean;
5249
5172
  } & CoreGetters & PluginGetters<typeof AutofillPlugin> & PluginGetters<typeof AutomaticSumPlugin> & PluginGetters<typeof HistoryPlugin> & PluginGetters<typeof ClipboardPlugin> & PluginGetters<typeof EditionPlugin> & PluginGetters<typeof EvaluationPlugin> & PluginGetters<typeof EvaluationChartPlugin> & PluginGetters<typeof EvaluationConditionalFormatPlugin> & PluginGetters<typeof FindAndReplacePlugin> & PluginGetters<typeof HeaderVisibilityUIPlugin> & PluginGetters<typeof HighlightPlugin> & PluginGetters<typeof CustomColorsPlugin> & PluginGetters<typeof AutomaticSumPlugin> & PluginGetters<typeof RendererPlugin> & PluginGetters<typeof GridSelectionPlugin> & PluginGetters<typeof SelectionInputsManagerPlugin> & PluginGetters<typeof CollaborativePlugin> & PluginGetters<typeof SortPlugin> & PluginGetters<typeof UIOptionsPlugin> & PluginGetters<typeof SheetUIPlugin> & PluginGetters<typeof SheetViewPlugin> & PluginGetters<typeof CellPopoverPlugin> & PluginGetters<typeof FilterEvaluationPlugin> & PluginGetters<typeof SplitToColumnsPlugin> & PluginGetters<typeof HeaderSizeUIPlugin> & PluginGetters<typeof EvaluationDataValidationPlugin> & PluginGetters<typeof HeaderPositionsUIPlugin>;
5250
5173
 
5174
+ type ArgType = "ANY" | "BOOLEAN" | "NUMBER" | "STRING" | "DATE" | "RANGE" | "RANGE<BOOLEAN>" | "RANGE<NUMBER>" | "RANGE<DATE>" | "RANGE<STRING>" | "RANGE<ANY>" | "META";
5175
+ interface ArgDefinition {
5176
+ repeating?: boolean;
5177
+ optional?: boolean;
5178
+ lazy?: boolean;
5179
+ description: string;
5180
+ name: string;
5181
+ type: ArgType[];
5182
+ default?: boolean;
5183
+ defaultValue?: any;
5184
+ }
5185
+ type ComputeFunctionArg<T> = T | (() => T);
5186
+ type ComputeFunction<T, R> = (this: EvalContext, ...args: ComputeFunctionArg<T>[]) => R;
5187
+ interface AddFunctionDescriptionBase {
5188
+ description: string;
5189
+ category?: string;
5190
+ args: ArgDefinition[];
5191
+ returns: [ArgType];
5192
+ isExported?: boolean;
5193
+ hidden?: boolean;
5194
+ }
5195
+ interface ComputeValue {
5196
+ compute: ComputeFunction<ArgValue, CellValue | Matrix<CellValue>>;
5197
+ }
5198
+ interface ComputeFormat {
5199
+ computeFormat: ComputeFunction<Arg, Format | undefined | Matrix<Format | undefined>>;
5200
+ }
5201
+ interface ComputeValueAndFormat {
5202
+ computeValueAndFormat: ComputeFunction<Arg, Matrix<ValueAndFormat> | ValueAndFormat>;
5203
+ }
5204
+ type AddFunctionDescription = (AddFunctionDescriptionBase & ComputeValue & Partial<ComputeFormat>) | (AddFunctionDescriptionBase & ComputeValueAndFormat);
5205
+ type FunctionDescription = AddFunctionDescription & {
5206
+ minArgRequired: number;
5207
+ maxArgPossible: number;
5208
+ nbrArgRepeating: number;
5209
+ getArgToFocus: (argPosition: number) => number;
5210
+ };
5211
+ type EvalContext = {
5212
+ __lastFnCalled?: string;
5213
+ __originSheetId: UID;
5214
+ __originCellXC: () => string | undefined;
5215
+ locale: Locale;
5216
+ getters: Getters;
5217
+ [key: string]: any;
5218
+ };
5219
+
5251
5220
  interface HistoryChange {
5252
5221
  path: [any, ...(number | string)[]];
5253
5222
  before: any;
@@ -5806,6 +5775,10 @@ interface ActionSpec {
5806
5775
  * Can be defined to display an icon
5807
5776
  */
5808
5777
  icon?: string | ((env: SpreadsheetChildEnv) => string);
5778
+ /**
5779
+ * Can be defined to display another icon on the right of the item.
5780
+ */
5781
+ secondaryIcon?: string | ((env: SpreadsheetChildEnv) => string);
5809
5782
  /**
5810
5783
  * is the action allowed when running spreadsheet in readonly mode
5811
5784
  */
@@ -5836,6 +5809,7 @@ interface Action {
5836
5809
  isEnabled: (env: SpreadsheetChildEnv) => boolean;
5837
5810
  isActive?: (env: SpreadsheetChildEnv) => boolean;
5838
5811
  icon: (env: SpreadsheetChildEnv) => string;
5812
+ secondaryIcon: (env: SpreadsheetChildEnv) => string;
5839
5813
  isReadonlyAllowed: boolean;
5840
5814
  execute?: (env: SpreadsheetChildEnv) => unknown;
5841
5815
  children: (env: SpreadsheetChildEnv) => Action[];
@@ -7374,6 +7348,9 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
7374
7348
  };
7375
7349
  sidePanel: SidePanelState;
7376
7350
  composer: ComposerState;
7351
+ spreadsheetRef: {
7352
+ el: HTMLElement | null;
7353
+ };
7377
7354
  private _focusGrid?;
7378
7355
  private keyDownMapping;
7379
7356
  private isViewportTooSmall;
@@ -7506,7 +7483,7 @@ declare class ColResizer extends AbstractResizer {
7506
7483
  _getActiveElements(): Set<HeaderIndex>;
7507
7484
  _getPreviousVisibleElement(index: HeaderIndex): HeaderIndex;
7508
7485
  unhide(hiddenElements: HeaderIndex[]): void;
7509
- unhideStyleValue(hiddenIndex: HeaderIndex): Pixel;
7486
+ getUnhideButtonStyle(hiddenIndex: HeaderIndex): string;
7510
7487
  }
7511
7488
  declare class RowResizer extends AbstractResizer {
7512
7489
  static template: string;
@@ -7531,7 +7508,7 @@ declare class RowResizer extends AbstractResizer {
7531
7508
  _getActiveElements(): Set<HeaderIndex>;
7532
7509
  _getPreviousVisibleElement(index: HeaderIndex): HeaderIndex;
7533
7510
  unhide(hiddenElements: HeaderIndex[]): void;
7534
- unhideStyleValue(hiddenIndex: HeaderIndex): Pixel;
7511
+ getUnhideButtonStyle(hiddenIndex: HeaderIndex): string;
7535
7512
  }
7536
7513
  declare class HeadersOverlay extends Component<any, SpreadsheetChildEnv> {
7537
7514
  static template: string;
@@ -7898,6 +7875,7 @@ declare const components: {
7898
7875
  FigureComponent: typeof FigureComponent;
7899
7876
  Menu: typeof Menu;
7900
7877
  SelectionInput: typeof SelectionInput;
7878
+ ValidationMessages: typeof ValidationMessages;
7901
7879
  };
7902
7880
  declare const hooks: {
7903
7881
  useDragAndDropListItems: typeof useDragAndDropListItems;
@@ -7909,4 +7887,4 @@ declare const constants: {
7909
7887
  DEFAULT_LOCALE: Locale;
7910
7888
  };
7911
7889
 
7912
- 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 };
7890
+ 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 };