@odoo/o-spreadsheet 17.1.0-alpha.3 → 17.1.0-alpha.5

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.
@@ -776,7 +776,7 @@ interface TransportService<T = any> {
776
776
  }
777
777
 
778
778
  declare class Revision implements RevisionData {
779
- readonly rootCommand?: Command | "SNAPSHOT" | "REMOTE" | undefined;
779
+ readonly rootCommand?: Command | undefined;
780
780
  readonly timestamp?: number | undefined;
781
781
  readonly id: UID;
782
782
  readonly clientId: ClientId;
@@ -791,7 +791,7 @@ declare class Revision implements RevisionData {
791
791
  * - clientId: Client who initiated the action
792
792
  * - changes: List of changes applied on the state.
793
793
  */
794
- constructor(id: UID, clientId: ClientId, commands: readonly CoreCommand[], rootCommand?: Command | "SNAPSHOT" | "REMOTE" | undefined, changes?: readonly HistoryChange[], timestamp?: number | undefined);
794
+ constructor(id: UID, clientId: ClientId, commands: readonly CoreCommand[], rootCommand?: Command | undefined, changes?: readonly HistoryChange[], timestamp?: number | undefined);
795
795
  setChanges(changes: readonly HistoryChange[]): void;
796
796
  get commands(): readonly CoreCommand[];
797
797
  get changes(): readonly HistoryChange[];
@@ -820,6 +820,7 @@ declare class Session extends EventBus<CollaborativeEvent> {
820
820
  private isReplayingInitialRevisions;
821
821
  private processedRevisions;
822
822
  private uuidGenerator;
823
+ private lastLocalOperation;
823
824
  /**
824
825
  * Manages the collaboration between multiple users on the same spreadsheet.
825
826
  * It can forward local state changes to other users to ensure they all eventually
@@ -861,9 +862,9 @@ declare class Session extends EventBus<CollaborativeEvent> {
861
862
  getRevisionId(): UID;
862
863
  isFullySynchronized(): boolean;
863
864
  /**
864
- * Get the last local revision whose root command isn't in the given list of ignored commands
865
+ * Get the last local revision
865
866
  * */
866
- getLastLocalNonEmptyRevision(ignoredRootCommands: CommandTypes[]): Revision | undefined;
867
+ getLastLocalNonEmptyRevision(): Revision | undefined;
867
868
  private _move;
868
869
  /**
869
870
  * Handles messages received from other clients in the collaborative
@@ -1430,80 +1431,6 @@ declare class UIPlugin<State = any> extends BasePlugin<State, Command> {
1430
1431
  drawGrid(ctx: GridRenderingContext, layer: LAYERS): void;
1431
1432
  }
1432
1433
 
1433
- interface SearchOptions {
1434
- matchCase: boolean;
1435
- exactMatch: boolean;
1436
- searchFormulas: boolean;
1437
- }
1438
- interface SearchMatch {
1439
- selected: boolean;
1440
- col: HeaderIndex;
1441
- row: HeaderIndex;
1442
- }
1443
- /**
1444
- * Find and Replace Plugin
1445
- *
1446
- * This plugin is used in combination with the find_and_replace sidePanel
1447
- * It is used to 'highlight' cells that match an input string according to
1448
- * the given searchOptions. The second part of this plugin makes it possible
1449
- * (again with the find_and_replace sidePanel), to replace the values that match
1450
- * the search with a new value.
1451
- */
1452
- declare class FindAndReplacePlugin extends UIPlugin {
1453
- static layers: LAYERS[];
1454
- static getters: readonly ["getSearchMatches", "getCurrentSelectedMatchIndex"];
1455
- private searchMatches;
1456
- private selectedMatchIndex;
1457
- private currentSearchRegex;
1458
- private searchOptions;
1459
- private toSearch;
1460
- private isSearchDirty;
1461
- handle(cmd: Command): void;
1462
- finalize(): void;
1463
- getSearchMatches(): SearchMatch[];
1464
- getCurrentSelectedMatchIndex(): number | null;
1465
- /**
1466
- * Will update the current searchOptions and accordingly update the regex.
1467
- * It will then search for matches using the regex and store them.
1468
- */
1469
- private updateSearch;
1470
- /**
1471
- * refresh the matches according to the current search options
1472
- */
1473
- private refreshSearch;
1474
- /**
1475
- * Updates the regex based on the current searchOptions and
1476
- * the value toSearch
1477
- */
1478
- private updateRegex;
1479
- /**
1480
- * Find matches using the current regex
1481
- */
1482
- private findMatches;
1483
- private sortByRowThenColumn;
1484
- /**
1485
- * Changes the selected search cell. Given a direction it will
1486
- * Change the selection to the previous, current or nextCell,
1487
- * if it exists otherwise it will set the selectedMatchIndex to null.
1488
- * It will also reset the index to 0 if the search has changed.
1489
- * It is also used to keep coherence between the selected searchMatch
1490
- * and selectedMatchIndex.
1491
- */
1492
- private selectNextCell;
1493
- private clearSearch;
1494
- private replaceMatch;
1495
- /**
1496
- * Replace the value of the currently selected match
1497
- */
1498
- private replace;
1499
- /**
1500
- * Apply the replace function to all the matches one time.
1501
- */
1502
- private replaceAll;
1503
- private getSearchableString;
1504
- drawGrid(renderingContext: GridRenderingContext): void;
1505
- }
1506
-
1507
1434
  type EditionMode = "editing" | "selecting" | "inactive";
1508
1435
  interface ComposerSelection {
1509
1436
  start: number;
@@ -1691,6 +1618,14 @@ type ClipboardContent = {
1691
1618
  };
1692
1619
  type ClipboardPasteOptions = "onlyFormat" | "onlyValue";
1693
1620
 
1621
+ interface SearchOptions {
1622
+ matchCase: boolean;
1623
+ exactMatch: boolean;
1624
+ searchFormulas: boolean;
1625
+ searchScope: "allSheets" | "activeSheet" | "specificRange";
1626
+ specificRange?: RangeData;
1627
+ }
1628
+
1694
1629
  /**
1695
1630
  * There are two kinds of commands: CoreCommands and LocalCommands
1696
1631
  *
@@ -1769,6 +1704,7 @@ interface MoveColumnsRowsCommand extends HeadersDependentCommand {
1769
1704
  type: "MOVE_COLUMNS_ROWS";
1770
1705
  base: HeaderIndex;
1771
1706
  elements: HeaderIndex[];
1707
+ position: "before" | "after";
1772
1708
  }
1773
1709
  interface ResizeColumnsRowsCommand extends HeadersDependentCommand {
1774
1710
  type: "RESIZE_COLUMNS_ROWS";
@@ -1891,10 +1827,7 @@ interface DeleteFigureCommand extends SheetDependentCommand {
1891
1827
  interface CreateChartCommand extends SheetDependentCommand {
1892
1828
  type: "CREATE_CHART";
1893
1829
  id: UID;
1894
- position?: {
1895
- x: Pixel;
1896
- y: Pixel;
1897
- };
1830
+ position?: DOMCoordinates;
1898
1831
  size?: FigureSize;
1899
1832
  definition: ChartDefinition;
1900
1833
  }
@@ -1906,10 +1839,7 @@ interface UpdateChartCommand extends SheetDependentCommand {
1906
1839
  interface CreateImageOverCommand extends SheetDependentCommand {
1907
1840
  type: "CREATE_IMAGE";
1908
1841
  figureId: UID;
1909
- position: {
1910
- x: Pixel;
1911
- y: Pixel;
1912
- };
1842
+ position: DOMCoordinates;
1913
1843
  size: FigureSize;
1914
1844
  definition: Image;
1915
1845
  }
@@ -2499,7 +2429,8 @@ declare const enum CommandResult {
2499
2429
  InvalidDataValidationCriterionValue = "InvalidDataValidationCriterionValue",
2500
2430
  InvalidNumberOfCriterionValues = "InvalidNumberOfCriterionValues",
2501
2431
  BlockingValidationRule = "BlockingValidationRule",
2502
- InvalidCopyPasteSelection = "InvalidCopyPasteSelection"
2432
+ InvalidCopyPasteSelection = "InvalidCopyPasteSelection",
2433
+ NoChanges = "NoChanges"
2503
2434
  }
2504
2435
  interface CommandHandler<T> {
2505
2436
  allowDispatch(command: T): CommandResult | CommandResult[];
@@ -3078,50 +3009,6 @@ interface SpreadsheetChildEnv extends SpreadsheetEnv {
3078
3009
  loadLocales: () => Promise<Locale[]>;
3079
3010
  }
3080
3011
 
3081
- type ArgType = "ANY" | "BOOLEAN" | "NUMBER" | "STRING" | "DATE" | "RANGE" | "RANGE<BOOLEAN>" | "RANGE<NUMBER>" | "RANGE<DATE>" | "RANGE<STRING>" | "RANGE<ANY>" | "META";
3082
- interface ArgDefinition {
3083
- repeating?: boolean;
3084
- optional?: boolean;
3085
- lazy?: boolean;
3086
- description: string;
3087
- name: string;
3088
- type: ArgType[];
3089
- default?: boolean;
3090
- defaultValue?: any;
3091
- }
3092
- type ComputeFunctionArg<T> = T | (() => T);
3093
- type ComputeFunction<T, R> = (this: EvalContext, ...args: ComputeFunctionArg<T>[]) => R;
3094
- interface AddFunctionDescriptionBase {
3095
- description: string;
3096
- category?: string;
3097
- args: ArgDefinition[];
3098
- returns: [ArgType];
3099
- isExported?: boolean;
3100
- hidden?: boolean;
3101
- }
3102
- interface ComputeValue {
3103
- compute: ComputeFunction<ArgValue, CellValue | Matrix<CellValue>>;
3104
- }
3105
- interface ComputeFormat {
3106
- computeFormat: ComputeFunction<Arg, Format | undefined | Matrix<Format | undefined>>;
3107
- }
3108
- interface ComputeValueAndFormat {
3109
- computeValueAndFormat: ComputeFunction<Arg, Matrix<ValueAndFormat> | ValueAndFormat>;
3110
- }
3111
- type AddFunctionDescription = (AddFunctionDescriptionBase & ComputeValue & Partial<ComputeFormat>) | (AddFunctionDescriptionBase & ComputeValueAndFormat);
3112
- type FunctionDescription = AddFunctionDescription & {
3113
- minArgRequired: number;
3114
- maxArgPossible: number;
3115
- nbrArgRepeating: number;
3116
- getArgToFocus: (argPosition: number) => number;
3117
- };
3118
- type EvalContext = {
3119
- __lastFnCalled?: string;
3120
- __originCellXC?: () => string;
3121
- locale: Locale;
3122
- [key: string]: any;
3123
- };
3124
-
3125
3012
  declare class RangeAdapter implements CommandHandler<CoreCommand> {
3126
3013
  private getters;
3127
3014
  private providers;
@@ -3231,7 +3118,8 @@ interface BordersPluginState {
3231
3118
  declare class BordersPlugin extends CorePlugin<BordersPluginState> implements BordersPluginState {
3232
3119
  static getters: readonly ["getCellBorder", "getBordersColors"];
3233
3120
  readonly borders: BordersPluginState["borders"];
3234
- handle(cmd: Command): void;
3121
+ allowDispatch(cmd: CoreCommand): CommandResult.Success | CommandResult.NoChanges;
3122
+ handle(cmd: CoreCommand): void;
3235
3123
  /**
3236
3124
  * Move borders according to the inserted columns.
3237
3125
  * Ensure borders continuity.
@@ -3329,6 +3217,7 @@ declare class BordersPlugin extends CorePlugin<BordersPluginState> implements Bo
3329
3217
  * Compute the borders to add to the given zone merged.
3330
3218
  */
3331
3219
  private addBordersToMerge;
3220
+ private checkBordersUnchanged;
3332
3221
  import(data: WorkbookData): void;
3333
3222
  export(data: WorkbookData): void;
3334
3223
  exportForExcel(data: ExcelWorkbookData): void;
@@ -3345,7 +3234,7 @@ interface CoreState {
3345
3234
  * cell and sheet content.
3346
3235
  */
3347
3236
  declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3348
- static getters: readonly ["zoneToXC", "getCells", "getFormulaCellContent", "getTranslatedCellFormula", "getCellStyle", "getCellById"];
3237
+ static getters: readonly ["zoneToXC", "getCells", "getTranslatedCellFormula", "getCellStyle", "getCellById"];
3349
3238
  readonly nextId = 1;
3350
3239
  readonly cells: {
3351
3240
  [sheetId: string]: {
@@ -3353,7 +3242,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3353
3242
  };
3354
3243
  };
3355
3244
  adaptRanges(applyChange: ApplyRangeChange, sheetId?: UID): void;
3356
- allowDispatch(cmd: CoreCommand): CommandResult;
3245
+ allowDispatch(cmd: CoreCommand): CommandResult | CommandResult[];
3357
3246
  handle(cmd: CoreCommand): void;
3358
3247
  /**
3359
3248
  * Set a format to all the cells in a zone
@@ -3382,7 +3271,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3382
3271
  * starting an async evaluation even if it has been moved or re-allocated
3383
3272
  */
3384
3273
  getCellById(cellId: UID): Cell | undefined;
3385
- getFormulaCellContent(sheetId: UID, compiledFormula: RangeCompiledFormula, dependencies?: Range[]): string;
3274
+ private getFormulaCellContent;
3386
3275
  getTranslatedCellFormula(sheetId: UID, offsetX: number, offsetY: number, compiledFormula: RangeCompiledFormula): string;
3387
3276
  getCellStyle(position: CellPosition): Style;
3388
3277
  /**
@@ -3427,6 +3316,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3427
3316
  private createFormulaCellWithDependencies;
3428
3317
  private createErrorFormula;
3429
3318
  private checkCellOutOfSheet;
3319
+ private checkUselessClearCell;
3430
3320
  }
3431
3321
 
3432
3322
  /**
@@ -4057,15 +3947,6 @@ declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
4057
3947
  */
4058
3948
  private moveCellOnRowsDeletion;
4059
3949
  private updateRowsStructureOnDeletion;
4060
- /**
4061
- * Update the rows of the sheet after an addition:
4062
- * - Rename the rows
4063
- *
4064
- * @param sheet Sheet on which the deletion occurs
4065
- * @param addedRow Index of the added row
4066
- * @param rowsToAdd Number of the rows to add
4067
- */
4068
- private updateRowsStructureOnAddition;
4069
3950
  /**
4070
3951
  * Add empty rows at the end of the rows
4071
3952
  *
@@ -4087,11 +3968,9 @@ declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
4087
3968
  }
4088
3969
 
4089
3970
  declare class EvaluationPlugin extends UIPlugin {
4090
- private config;
4091
- static getters: readonly ["evaluateFormula", "getCorrespondingFormulaCell", "getRangeFormattedValues", "getRangeValues", "getRangeFormats", "getEvaluatedCell", "getEvaluatedCells", "getEvaluatedCellsInZone", "getSpreadPositionsOf"];
3971
+ static getters: readonly ["evaluateFormula", "getCorrespondingFormulaCell", "getRangeFormattedValues", "getRangeValues", "getRangeFormats", "getEvaluatedCell", "getEvaluatedCells", "getEvaluatedCellsInZone", "getSpreadPositionsOf", "getArrayFormulaSpreadingOn"];
4092
3972
  private shouldRebuildDependenciesGraph;
4093
3973
  private evaluator;
4094
- private compilationParams;
4095
3974
  private positionsToUpdate;
4096
3975
  constructor(config: UIPluginConfig);
4097
3976
  beforeHandle(cmd: Command): void;
@@ -4114,6 +3993,7 @@ declare class EvaluationPlugin extends UIPlugin {
4114
3993
  getEvaluatedCells(sheetId: UID): Record<UID, EvaluatedCell>;
4115
3994
  getEvaluatedCellsInZone(sheetId: UID, zone: Zone): EvaluatedCell[];
4116
3995
  getSpreadPositionsOf(position: CellPosition): CellPosition[];
3996
+ getArrayFormulaSpreadingOn(position: CellPosition): CellPosition | undefined;
4117
3997
  exportForExcel(data: ExcelWorkbookData): void;
4118
3998
  /**
4119
3999
  * Returns the corresponding formula cell of a given cell
@@ -4121,7 +4001,6 @@ declare class EvaluationPlugin extends UIPlugin {
4121
4001
  * formula of the array formula that spreads to the cell
4122
4002
  */
4123
4003
  getCorrespondingFormulaCell(position: CellPosition): FormulaCell | undefined;
4124
- private getCompilationParameters;
4125
4004
  }
4126
4005
 
4127
4006
  interface CustomColorState {
@@ -4458,6 +4337,78 @@ declare class CollaborativePlugin extends UIPlugin {
4458
4337
  drawGrid(renderingContext: GridRenderingContext): void;
4459
4338
  }
4460
4339
 
4340
+ /**
4341
+ * Find and Replace Plugin
4342
+ *
4343
+ * This plugin is used in combination with the find_and_replace sidePanel
4344
+ * It is used to 'highlight' cells that match an input string according to
4345
+ * the given searchOptions. The second part of this plugin makes it possible
4346
+ * (again with the find_and_replace sidePanel), to replace the values that match
4347
+ * the search with a new value.
4348
+ */
4349
+ declare class FindAndReplacePlugin extends UIPlugin {
4350
+ static layers: LAYERS[];
4351
+ static getters: readonly ["getSearchMatches", "getCurrentSelectedMatchIndex", "getSearchOptions", "getAllSheetMatchesCount", "getActiveSheetMatchesCount", "getSpecificRangeMatchesCount"];
4352
+ private allSheetsMatches;
4353
+ private activeSheetMatches;
4354
+ private specificRangeMatches;
4355
+ private selectedMatchIndex;
4356
+ private currentSearchRegex;
4357
+ private searchOptions;
4358
+ private toSearch;
4359
+ private isSearchDirty;
4360
+ get searchMatches(): CellPosition[];
4361
+ handle(cmd: Command): void;
4362
+ finalize(): void;
4363
+ getSearchMatches(): CellPosition[];
4364
+ getCurrentSelectedMatchIndex(): number | null;
4365
+ getSearchOptions(): SearchOptions;
4366
+ getAllSheetMatchesCount(): number;
4367
+ getActiveSheetMatchesCount(): number;
4368
+ getSpecificRangeMatchesCount(): number;
4369
+ /**
4370
+ * Will update the current searchOptions and accordingly update the regex.
4371
+ * It will then search for matches using the regex and store them.
4372
+ */
4373
+ private updateSearch;
4374
+ /**
4375
+ * refresh the matches according to the current search options
4376
+ */
4377
+ private refreshSearch;
4378
+ /**
4379
+ * Updates the regex based on the current searchOptions and
4380
+ * the value toSearch
4381
+ */
4382
+ private updateRegex;
4383
+ private getSheetsInSearchOrder;
4384
+ /**
4385
+ * Find matches using the current regex
4386
+ */
4387
+ private findMatches;
4388
+ private findMatchesInSheet;
4389
+ /**
4390
+ * Changes the selected search cell. Given a direction it will
4391
+ * Change the selection to the previous, current or nextCell,
4392
+ * if it exists otherwise it will set the selectedMatchIndex to null.
4393
+ * It will also reset the index to 0 if the search has changed.
4394
+ * It is also used to keep coherence between the selected searchMatch
4395
+ * and selectedMatchIndex.
4396
+ */
4397
+ private selectNextCell;
4398
+ private clearSearch;
4399
+ private replaceMatch;
4400
+ /**
4401
+ * Replace the value of the currently selected match
4402
+ */
4403
+ private replace;
4404
+ /**
4405
+ * Apply the replace function to all the matches one time.
4406
+ */
4407
+ private replaceAll;
4408
+ private getSearchableString;
4409
+ drawGrid(renderingContext: GridRenderingContext): void;
4410
+ }
4411
+
4461
4412
  declare class HeaderVisibilityUIPlugin extends UIPlugin {
4462
4413
  static getters: readonly ["getNextVisibleCellPosition", "findVisibleHeader", "findLastVisibleColRowIndex", "findFirstVisibleColRowIndex", "isRowHidden", "isColHidden", "isHeaderHidden"];
4463
4414
  isRowHidden(sheetId: UID, index: number): boolean;
@@ -4936,18 +4887,12 @@ declare class InternalViewport {
4936
4887
  canScrollHorizontally: boolean;
4937
4888
  viewportWidth: Pixel;
4938
4889
  viewportHeight: Pixel;
4939
- offsetCorrectionX: Pixel;
4940
- offsetCorrectionY: Pixel;
4941
- constructor(getters: Getters, sheetId: UID, boundaries: Zone, sizeInGrid: {
4942
- width: Pixel;
4943
- height: Pixel;
4944
- }, options: {
4890
+ private offsetCorrectionX;
4891
+ private offsetCorrectionY;
4892
+ constructor(getters: Getters, sheetId: UID, boundaries: Zone, sizeInGrid: DOMDimension, options: {
4945
4893
  canScrollVertically: boolean;
4946
4894
  canScrollHorizontally: boolean;
4947
- }, offsets: {
4948
- x: Pixel;
4949
- y: Pixel;
4950
- });
4895
+ }, offsets: DOMCoordinates);
4951
4896
  /** Returns the maximum size (in Pixels) of the viewport relative to its allocated client size
4952
4897
  * When the viewport grid size is smaller than its client width (resp. height), it will return
4953
4898
  * the client width (resp. height).
@@ -4970,9 +4915,9 @@ declare class InternalViewport {
4970
4915
  * the pane that is actually displayed on the client. We therefore adjust the offset of the pane
4971
4916
  * until it contains the cell completely.
4972
4917
  */
4973
- adjustPosition(position?: Position$1): void;
4974
- adjustPositionX(targetCol: HeaderIndex): void;
4975
- adjustPositionY(targetRow: HeaderIndex): void;
4918
+ adjustPosition(position: Position$1): void;
4919
+ private adjustPositionX;
4920
+ private adjustPositionY;
4976
4921
  setViewportOffset(offsetX: Pixel, offsetY: Pixel): void;
4977
4922
  adjustViewportZone(): void;
4978
4923
  /**
@@ -4983,7 +4928,6 @@ declare class InternalViewport {
4983
4928
  getRect(zone: Zone): Rect | undefined;
4984
4929
  isVisible(col: HeaderIndex, row: HeaderIndex): boolean;
4985
4930
  private searchHeaderIndex;
4986
- private get zone();
4987
4931
  private setViewportOffsetX;
4988
4932
  private setViewportOffsetY;
4989
4933
  /** Corrects the viewport's horizontal offset based on the current structure
@@ -5216,6 +5160,52 @@ type Getters = {
5216
5160
  isDashboard: () => boolean;
5217
5161
  } & 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>;
5218
5162
 
5163
+ type ArgType = "ANY" | "BOOLEAN" | "NUMBER" | "STRING" | "DATE" | "RANGE" | "RANGE<BOOLEAN>" | "RANGE<NUMBER>" | "RANGE<DATE>" | "RANGE<STRING>" | "RANGE<ANY>" | "META";
5164
+ interface ArgDefinition {
5165
+ repeating?: boolean;
5166
+ optional?: boolean;
5167
+ lazy?: boolean;
5168
+ description: string;
5169
+ name: string;
5170
+ type: ArgType[];
5171
+ default?: boolean;
5172
+ defaultValue?: any;
5173
+ }
5174
+ type ComputeFunctionArg<T> = T | (() => T);
5175
+ type ComputeFunction<T, R> = (this: EvalContext, ...args: ComputeFunctionArg<T>[]) => R;
5176
+ interface AddFunctionDescriptionBase {
5177
+ description: string;
5178
+ category?: string;
5179
+ args: ArgDefinition[];
5180
+ returns: [ArgType];
5181
+ isExported?: boolean;
5182
+ hidden?: boolean;
5183
+ }
5184
+ interface ComputeValue {
5185
+ compute: ComputeFunction<ArgValue, CellValue | Matrix<CellValue>>;
5186
+ }
5187
+ interface ComputeFormat {
5188
+ computeFormat: ComputeFunction<Arg, Format | undefined | Matrix<Format | undefined>>;
5189
+ }
5190
+ interface ComputeValueAndFormat {
5191
+ computeValueAndFormat: ComputeFunction<Arg, Matrix<ValueAndFormat> | ValueAndFormat>;
5192
+ }
5193
+ type AddFunctionDescription = (AddFunctionDescriptionBase & ComputeValue & Partial<ComputeFormat>) | (AddFunctionDescriptionBase & ComputeValueAndFormat);
5194
+ type FunctionDescription = AddFunctionDescription & {
5195
+ minArgRequired: number;
5196
+ maxArgPossible: number;
5197
+ nbrArgRepeating: number;
5198
+ getArgToFocus: (argPosition: number) => number;
5199
+ };
5200
+ type EvalContext = {
5201
+ __lastFnCalled?: string;
5202
+ __originSheetId: UID;
5203
+ __originCellXC: () => string | undefined;
5204
+ locale: Locale;
5205
+ getters: Getters;
5206
+ [key: string]: any;
5207
+ };
5208
+
5219
5209
  interface HistoryChange {
5220
5210
  path: [any, ...(number | string)[]];
5221
5211
  before: any;
@@ -5774,6 +5764,10 @@ interface ActionSpec {
5774
5764
  * Can be defined to display an icon
5775
5765
  */
5776
5766
  icon?: string | ((env: SpreadsheetChildEnv) => string);
5767
+ /**
5768
+ * Can be defined to display another icon on the right of the item.
5769
+ */
5770
+ secondaryIcon?: string | ((env: SpreadsheetChildEnv) => string);
5777
5771
  /**
5778
5772
  * is the action allowed when running spreadsheet in readonly mode
5779
5773
  */
@@ -5804,6 +5798,7 @@ interface Action {
5804
5798
  isEnabled: (env: SpreadsheetChildEnv) => boolean;
5805
5799
  isActive?: (env: SpreadsheetChildEnv) => boolean;
5806
5800
  icon: (env: SpreadsheetChildEnv) => string;
5801
+ secondaryIcon: (env: SpreadsheetChildEnv) => string;
5807
5802
  isReadonlyAllowed: boolean;
5808
5803
  execute?: (env: SpreadsheetChildEnv) => unknown;
5809
5804
  children: (env: SpreadsheetChildEnv) => Action[];
@@ -7342,6 +7337,9 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
7342
7337
  };
7343
7338
  sidePanel: SidePanelState;
7344
7339
  composer: ComposerState;
7340
+ spreadsheetRef: {
7341
+ el: HTMLElement | null;
7342
+ };
7345
7343
  private _focusGrid?;
7346
7344
  private keyDownMapping;
7347
7345
  private isViewportTooSmall;
@@ -7411,6 +7409,7 @@ interface ResizerState {
7411
7409
  draggerShadowThickness: number;
7412
7410
  delta: number;
7413
7411
  base: number;
7412
+ position: "before" | "after";
7414
7413
  }
7415
7414
  interface ResizerProps {
7416
7415
  onOpenContextMenu: (type: ContextMenuType, x: Pixel, y: Pixel) => void;
@@ -7474,7 +7473,7 @@ declare class ColResizer extends AbstractResizer {
7474
7473
  _getActiveElements(): Set<HeaderIndex>;
7475
7474
  _getPreviousVisibleElement(index: HeaderIndex): HeaderIndex;
7476
7475
  unhide(hiddenElements: HeaderIndex[]): void;
7477
- unhideStyleValue(hiddenIndex: HeaderIndex): Pixel;
7476
+ getUnhideButtonStyle(hiddenIndex: HeaderIndex): string;
7478
7477
  }
7479
7478
  declare class RowResizer extends AbstractResizer {
7480
7479
  static template: string;
@@ -7499,7 +7498,7 @@ declare class RowResizer extends AbstractResizer {
7499
7498
  _getActiveElements(): Set<HeaderIndex>;
7500
7499
  _getPreviousVisibleElement(index: HeaderIndex): HeaderIndex;
7501
7500
  unhide(hiddenElements: HeaderIndex[]): void;
7502
- unhideStyleValue(hiddenIndex: HeaderIndex): Pixel;
7501
+ getUnhideButtonStyle(hiddenIndex: HeaderIndex): string;
7503
7502
  }
7504
7503
  declare class HeadersOverlay extends Component<any, SpreadsheetChildEnv> {
7505
7504
  static template: string;
@@ -7866,6 +7865,7 @@ declare const components: {
7866
7865
  FigureComponent: typeof FigureComponent;
7867
7866
  Menu: typeof Menu;
7868
7867
  SelectionInput: typeof SelectionInput;
7868
+ ValidationMessages: typeof ValidationMessages;
7869
7869
  };
7870
7870
  declare const hooks: {
7871
7871
  useDragAndDropListItems: typeof useDragAndDropListItems;