@odoo/o-spreadsheet 16.0.0 → 16.1.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.
@@ -2,47 +2,6 @@ import * as _odoo_owl from '@odoo/owl';
2
2
  import { ComponentConstructor, EventBus as EventBus$1, Component } from '@odoo/owl';
3
3
  import { ChartConfiguration, ChartData, ChartDataSets, ChartOptions } from 'chart.js';
4
4
 
5
- declare type TranslationFunction = (string: string, ...values: string[] | [{
6
- [key: string]: string;
7
- }]) => string;
8
- /***
9
- * Allow to inject a translation function from outside o-spreadsheet.
10
- * @param tfn the function that will do the translation
11
- */
12
- declare function setTranslationMethod(tfn: TranslationFunction): void;
13
-
14
- interface Currency {
15
- name: string;
16
- code: string;
17
- symbol: string;
18
- decimalPlaces: number;
19
- position: "before" | "after";
20
- }
21
-
22
- interface EditTextOptions {
23
- error?: string;
24
- placeholder?: string;
25
- }
26
- interface InformationNotification {
27
- text: string;
28
- tag: string;
29
- }
30
- interface SpreadsheetEnv {
31
- notifyUser: (notification: InformationNotification) => any;
32
- raiseError: (text: string) => any;
33
- askConfirmation: (content: string, confirm: () => any, cancel?: () => any) => any;
34
- editText: (title: string, callback: (text: string | null) => any, options?: EditTextOptions) => any;
35
- loadCurrencies: () => Promise<Currency[]>;
36
- }
37
- interface SpreadsheetChildEnv extends SpreadsheetEnv {
38
- model: Model;
39
- isDashboard: () => boolean;
40
- openSidePanel: (panel: string, panelProps?: any) => void;
41
- toggleSidePanel: (panel: string, panelProps?: any) => void;
42
- clipboard: Clipboard;
43
- _t: TranslationFunction;
44
- }
45
-
46
5
  declare enum CellErrorLevel {
47
6
  silent = 0,
48
7
  error = 1
@@ -254,24 +213,32 @@ declare function isMarkdownLink(str: string): boolean;
254
213
  * Build a markdown link from a label and an url
255
214
  */
256
215
  declare function markdownLink(label: string, url: string): string;
257
- declare function parseMarkdownLink(str: string): Link;
216
+ declare function parseMarkdownLink(str: string): {
217
+ url: string;
218
+ label: string;
219
+ };
220
+ /**
221
+ * This helper function can be used as a type guard when filtering arrays.
222
+ * const foo: number[] = [1, 2, undefined, 4].filter(isDefined)
223
+ */
224
+ declare function isDefined<T>(argument: T | undefined): argument is T;
258
225
 
259
226
  interface ConstructorArgs {
260
- zone: Zone | UnboundedZone;
261
- parts: RangePart[];
262
- invalidXc?: string;
227
+ readonly zone: Readonly<Zone | UnboundedZone>;
228
+ readonly parts: readonly RangePart[];
229
+ readonly invalidXc?: string;
263
230
  /** true if the user provided the range with the sheet name */
264
- prefixSheet: boolean;
231
+ readonly prefixSheet: boolean;
265
232
  /** the name of any sheet that is invalid */
266
- invalidSheetName?: string;
233
+ readonly invalidSheetName?: string;
267
234
  /** the sheet on which the range is defined */
268
- sheetId: UID;
235
+ readonly sheetId: UID;
269
236
  }
270
237
  declare class RangeImpl implements Range {
271
238
  private getSheetSize;
272
239
  private readonly _zone;
273
- readonly parts: RangePart[];
274
- readonly invalidXc?: string | undefined;
240
+ readonly parts: Range["parts"];
241
+ readonly invalidXc?: string;
275
242
  readonly prefixSheet: boolean;
276
243
  readonly sheetId: UID;
277
244
  readonly invalidSheetName?: string;
@@ -287,9 +254,8 @@ declare class RangeImpl implements Range {
287
254
  * Check that a zone is valid regarding the order of top-bottom and left-right.
288
255
  * Left should be smaller than right, top should be smaller than bottom.
289
256
  * If it's not the case, simply invert them, and invert the linked parts
290
- * (in place!)
291
257
  */
292
- orderZone(): void;
258
+ orderZone(): RangeImpl;
293
259
  /**
294
260
  *
295
261
  * @param rangeParams optional, values to put in the cloned range instead of the current values of the range
@@ -370,9 +336,10 @@ interface SelectionProcessor {
370
336
  addCellToSelection(col: number, row: number): DispatchResult;
371
337
  resizeAnchorZone(direction: SelectionDirection, step: SelectionStep): DispatchResult;
372
338
  selectColumn(index: number, mode: SelectionEvent["mode"]): DispatchResult;
373
- selectRow(index: number, mode: "overrideSelection" | "updateAnchor" | "newAnchor"): DispatchResult;
339
+ selectRow(index: number, mode: SelectionEvent["mode"]): DispatchResult;
374
340
  selectAll(): DispatchResult;
375
341
  loopSelection(): DispatchResult;
342
+ selectTableAroundSelection(): DispatchResult;
376
343
  }
377
344
  /**
378
345
  * Processes all selection updates (usually from user inputs) and emits an event
@@ -402,7 +369,7 @@ declare class SelectionStreamProcessor implements SelectionProcessor, StatefulSt
402
369
  /**
403
370
  * Select a new anchor
404
371
  */
405
- selectZone(anchor: AnchorZone): DispatchResult;
372
+ selectZone(anchor: AnchorZone, mode?: SelectionEvent["mode"]): DispatchResult;
406
373
  /**
407
374
  * Select a single cell as the new anchor.
408
375
  */
@@ -427,7 +394,7 @@ declare class SelectionStreamProcessor implements SelectionProcessor, StatefulSt
427
394
  */
428
395
  resizeAnchorZone(direction: SelectionDirection, step?: SelectionStep): DispatchResult;
429
396
  selectColumn(index: HeaderIndex, mode: SelectionEvent["mode"]): DispatchResult;
430
- selectRow(index: HeaderIndex, mode: "overrideSelection" | "updateAnchor" | "newAnchor"): DispatchResult;
397
+ selectRow(index: HeaderIndex, mode: SelectionEvent["mode"]): DispatchResult;
431
398
  /**
432
399
  * Loop the current selection while keeping the same anchor. The selection will loop through:
433
400
  * 1) the smallest zone that contain the anchor and that have only empty cells bordering it
@@ -435,6 +402,12 @@ declare class SelectionStreamProcessor implements SelectionProcessor, StatefulSt
435
402
  * 3) the anchor cell
436
403
  */
437
404
  loopSelection(): DispatchResult;
405
+ /**
406
+ * Select a "table" around the current selection.
407
+ * We define a table by the smallest zone that contain the anchor and that have only empty
408
+ * cells bordering it
409
+ */
410
+ selectTableAroundSelection(): DispatchResult;
438
411
  /**
439
412
  * Select the entire sheet
440
413
  */
@@ -489,6 +462,12 @@ declare class SelectionStreamProcessor implements SelectionProcessor, StatefulSt
489
462
  */
490
463
  private getNextCellPosition;
491
464
  private getPosition;
465
+ /**
466
+ * Expand the given zone to a table.
467
+ * We define a table by the smallest zone that contain the anchor and that have only empty
468
+ * cells bordering it
469
+ */
470
+ private expandZoneToTable;
492
471
  }
493
472
 
494
473
  interface XLSXExportFile {
@@ -520,6 +499,7 @@ interface BarChartDefinition {
520
499
  readonly verticalAxisPosition: VerticalAxisPosition;
521
500
  readonly legendPosition: LegendPosition;
522
501
  readonly stacked: boolean;
502
+ readonly aggregated?: boolean;
523
503
  }
524
504
  declare type BarChartRuntime = {
525
505
  chartJsConfig: ChartConfiguration;
@@ -600,6 +580,7 @@ interface LineChartDefinition {
600
580
  readonly legendPosition: LegendPosition;
601
581
  readonly labelsAsText: boolean;
602
582
  readonly stacked: boolean;
583
+ readonly aggregated?: boolean;
603
584
  }
604
585
  declare type LineChartRuntime = {
605
586
  chartJsConfig: ChartConfiguration;
@@ -614,6 +595,7 @@ interface PieChartDefinition {
614
595
  readonly title: string;
615
596
  readonly background?: Color;
616
597
  readonly legendPosition: LegendPosition;
598
+ readonly aggregated?: boolean;
617
599
  }
618
600
  declare type PieChartRuntime = {
619
601
  chartJsConfig: ChartConfiguration;
@@ -674,19 +656,19 @@ interface ChartCreationContext {
674
656
  }
675
657
 
676
658
  interface RangePart {
677
- colFixed: boolean;
678
- rowFixed: boolean;
659
+ readonly colFixed: boolean;
660
+ readonly rowFixed: boolean;
679
661
  }
680
662
  interface Range extends Cloneable<Range> {
681
- zone: Zone;
682
- parts: RangePart[];
683
- invalidXc?: string;
663
+ readonly zone: Readonly<Zone>;
664
+ readonly parts: readonly RangePart[];
665
+ readonly invalidXc?: string;
684
666
  /** true if the user provided the range with the sheet name */
685
- prefixSheet: boolean;
667
+ readonly prefixSheet: boolean;
686
668
  /** the name of any sheet that is invalid */
687
- invalidSheetName?: string;
669
+ readonly invalidSheetName?: string;
688
670
  /** the sheet on which the range is defined */
689
- sheetId: UID;
671
+ readonly sheetId: UID;
690
672
  }
691
673
  interface RangeData {
692
674
  _zone: Zone | UnboundedZone;
@@ -972,6 +954,49 @@ interface TransportService<T = any> {
972
954
  leave: (id: UID) => void;
973
955
  }
974
956
 
957
+ interface Figure {
958
+ id: UID;
959
+ x: Pixel;
960
+ y: Pixel;
961
+ width: Pixel;
962
+ height: Pixel;
963
+ tag: string;
964
+ }
965
+ interface FigureSize {
966
+ width: Pixel;
967
+ height: Pixel;
968
+ }
969
+ declare type ResizeDirection = -1 | 0 | 1;
970
+
971
+ interface Image {
972
+ path: string;
973
+ size: FigureSize;
974
+ }
975
+
976
+ declare type FilePath = string;
977
+ /**
978
+ * FileStore manage the transfer of file with the server.
979
+ */
980
+ interface FileStore {
981
+ /**
982
+ * Upload a file to a server and returns its path.
983
+ */
984
+ upload(file: File): Promise<FilePath>;
985
+ /**
986
+ * Delete a file from the server
987
+ */
988
+ delete(filePath: FilePath): Promise<void>;
989
+ }
990
+ /**
991
+ * ImageProvider can request the user to input an image file before sending it to a server.
992
+ */
993
+ interface ImageProviderInterface {
994
+ /**
995
+ * RequestImage ask the user to input an image file. Then send it to a server trough an FileStore. Finally it return the path and the size of the image in the server.
996
+ */
997
+ requestImage(): Promise<Image>;
998
+ }
999
+
975
1000
  interface NotifyUIEvent {
976
1001
  type: "ERROR";
977
1002
  text: string;
@@ -1003,17 +1028,35 @@ interface NotifyUIEvent {
1003
1028
  */
1004
1029
  declare type Mode = "normal" | "readonly" | "dashboard";
1005
1030
  interface ModelConfig {
1006
- mode: Mode;
1007
- evalContext: EvalContext;
1008
- moveClient: (position: ClientPosition) => void;
1009
- transportService: TransportService;
1010
- client: Client;
1011
- snapshotRequested: boolean;
1012
- notifyUI: (payload: NotifyUIEvent) => void;
1031
+ readonly mode: Mode;
1032
+ /**
1033
+ * Any external custom dependencies your custom plugins or functions might need.
1034
+ * They are available in plugins config and functions
1035
+ * evaluation context.
1036
+ */
1037
+ readonly custom: Readonly<{
1038
+ [key: string]: any;
1039
+ }>;
1040
+ /**
1041
+ * External dependencies required to enable some features
1042
+ * such as uploading images.
1043
+ */
1044
+ readonly external: Readonly<{
1045
+ readonly fileStore?: FileStore;
1046
+ readonly loadCurrencies?: () => Promise<Currency[]>;
1047
+ }>;
1048
+ readonly moveClient: (position: ClientPosition) => void;
1049
+ readonly transportService: TransportService;
1050
+ readonly client: Client;
1051
+ readonly snapshotRequested: boolean;
1052
+ readonly notifyUI: (payload: NotifyUIEvent) => void;
1053
+ readonly lazyEvaluation: boolean;
1013
1054
  }
1014
1055
  declare class Model extends EventBus<any> implements CommandDispatcher {
1015
1056
  private corePlugins;
1016
- private uiPlugins;
1057
+ private featurePlugins;
1058
+ private statefulUIPlugins;
1059
+ private coreViewsPlugins;
1017
1060
  private history;
1018
1061
  private range;
1019
1062
  private session;
@@ -1037,7 +1080,9 @@ declare class Model extends EventBus<any> implements CommandDispatcher {
1037
1080
  /**
1038
1081
  * The config object contains some configuration flag and callbacks
1039
1082
  */
1040
- private config;
1083
+ readonly config: ModelConfig;
1084
+ private corePluginConfig;
1085
+ private uiPluginConfig;
1041
1086
  private state;
1042
1087
  readonly selection: SelectionStreamProcessor;
1043
1088
  /**
@@ -1054,6 +1099,7 @@ declare class Model extends EventBus<any> implements CommandDispatcher {
1054
1099
  uuidGenerator: UuidGenerator;
1055
1100
  constructor(data?: any, config?: Partial<ModelConfig>, stateUpdateMessages?: StateUpdateMessage[], uuidGenerator?: UuidGenerator, verboseImport?: boolean);
1056
1101
  get handlers(): CommandHandler<Command>[];
1102
+ get allUIPlugins(): UIPlugin[];
1057
1103
  joinSession(): void;
1058
1104
  leaveSession(): void;
1059
1105
  private setupUiPlugin;
@@ -1068,6 +1114,8 @@ declare class Model extends EventBus<any> implements CommandDispatcher {
1068
1114
  private setupSession;
1069
1115
  private setupSessionEvents;
1070
1116
  private setupConfig;
1117
+ private setupCorePluginConfig;
1118
+ private setupUiPluginConfig;
1071
1119
  /**
1072
1120
  * Check if the given command is allowed by all the plugins and the history.
1073
1121
  */
@@ -1125,6 +1173,7 @@ declare class Model extends EventBus<any> implements CommandDispatcher {
1125
1173
  * (e.g. open a document with several sheet and click on download before visiting each sheet)
1126
1174
  */
1127
1175
  exportXLSX(): XLSXExport;
1176
+ garbageCollectExternalResources(): void;
1128
1177
  }
1129
1178
 
1130
1179
  declare class StateObserver {
@@ -1172,7 +1221,7 @@ declare class BasePlugin<State = any, C = any> implements CommandHandler<C>, Val
1172
1221
  static getters: readonly string[];
1173
1222
  protected history: WorkbookHistory<State>;
1174
1223
  protected dispatch: CommandDispatcher["dispatch"];
1175
- constructor(stateObserver: StateObserver, dispatch: CommandDispatcher["dispatch"], config: ModelConfig);
1224
+ constructor(stateObserver: StateObserver, dispatch: CommandDispatcher["dispatch"]);
1176
1225
  /**
1177
1226
  * Export for excel should be available for all plugins, even for the UI.
1178
1227
  * In some case, we need to export evaluated value, which is available from
@@ -1219,8 +1268,18 @@ declare class BasePlugin<State = any, C = any> implements CommandHandler<C>, Val
1219
1268
  }
1220
1269
 
1221
1270
  declare type UIActions = Pick<ModelConfig, "notifyUI">;
1271
+ interface UIPluginConfig {
1272
+ readonly getters: Getters;
1273
+ readonly stateObserver: StateObserver;
1274
+ readonly dispatch: CommandDispatcher["dispatch"];
1275
+ readonly selection: SelectionStreamProcessor;
1276
+ readonly moveClient: (position: ClientPosition) => void;
1277
+ readonly uiActions: UIActions;
1278
+ readonly custom: ModelConfig["custom"];
1279
+ readonly lazyEvaluation: boolean;
1280
+ }
1222
1281
  interface UIPluginConstructor {
1223
- new (getters: Getters, state: StateObserver, dispatch: CommandDispatcher["dispatch"], config: ModelConfig, selection: SelectionStreamProcessor): UIPlugin;
1282
+ new (config: UIPluginConfig): UIPlugin;
1224
1283
  layers: LAYERS[];
1225
1284
  getters: readonly string[];
1226
1285
  }
@@ -1233,10 +1292,81 @@ declare class UIPlugin<State = any, C = Command> extends BasePlugin<State, C> {
1233
1292
  protected getters: Getters;
1234
1293
  protected ui: UIActions;
1235
1294
  protected selection: SelectionStreamProcessor;
1236
- constructor(getters: Getters, state: StateObserver, dispatch: CommandDispatcher["dispatch"], config: ModelConfig, selection: SelectionStreamProcessor);
1295
+ constructor({ getters, stateObserver, dispatch, uiActions, selection }: UIPluginConfig);
1237
1296
  drawGrid(ctx: GridRenderingContext, layer: LAYERS): void;
1238
1297
  }
1239
1298
 
1299
+ interface SearchOptions {
1300
+ matchCase: boolean;
1301
+ exactMatch: boolean;
1302
+ searchFormulas: boolean;
1303
+ }
1304
+ interface SearchMatch {
1305
+ selected: boolean;
1306
+ col: HeaderIndex;
1307
+ row: HeaderIndex;
1308
+ }
1309
+ /**
1310
+ * Find and Replace Plugin
1311
+ *
1312
+ * This plugin is used in combination with the find_and_replace sidePanel
1313
+ * It is used to 'highlight' cells that match an input string according to
1314
+ * the given searchOptions. The second part of this plugin makes it possible
1315
+ * (again with the find_and_replace sidePanel), to replace the values that match
1316
+ * the search with a new value.
1317
+ */
1318
+ declare class FindAndReplacePlugin extends UIPlugin {
1319
+ static layers: LAYERS[];
1320
+ static getters: readonly ["getSearchMatches", "getCurrentSelectedMatchIndex"];
1321
+ private searchMatches;
1322
+ private selectedMatchIndex;
1323
+ private currentSearchRegex;
1324
+ private searchOptions;
1325
+ private toSearch;
1326
+ handle(cmd: Command): void;
1327
+ getSearchMatches(): SearchMatch[];
1328
+ getCurrentSelectedMatchIndex(): number | null;
1329
+ /**
1330
+ * Will update the current searchOptions and accordingly update the regex.
1331
+ * It will then search for matches using the regex and store them.
1332
+ */
1333
+ private updateSearch;
1334
+ /**
1335
+ * refresh the matches according to the current search options
1336
+ */
1337
+ private refreshSearch;
1338
+ /**
1339
+ * Updates the regex based on the current searchOptions and
1340
+ * the value toSearch
1341
+ */
1342
+ private updateRegex;
1343
+ /**
1344
+ * Find matches using the current regex
1345
+ */
1346
+ private findMatches;
1347
+ private sortByRowThenColumn;
1348
+ /**
1349
+ * Changes the selected search cell. Given a direction it will
1350
+ * Change the selection to the previous, current or nextCell,
1351
+ * if it exists otherwise it will set the selectedMatchIndex to null.
1352
+ * It will also reset the index to 0 if the search has changed.
1353
+ * It is also used to keep coherence between the selected searchMatch
1354
+ * and selectedMatchIndex.
1355
+ */
1356
+ private selectNextCell;
1357
+ private clearSearch;
1358
+ /**
1359
+ * Replace the value of the currently selected match
1360
+ */
1361
+ private replace;
1362
+ /**
1363
+ * Apply the replace function to all the matches one time.
1364
+ */
1365
+ private replaceAll;
1366
+ private getSearchableString;
1367
+ drawGrid(renderingContext: GridRenderingContext): void;
1368
+ }
1369
+
1240
1370
  declare type EditionMode = "editing" | "selecting" | "inactive";
1241
1371
  interface ComposerSelection {
1242
1372
  start: number;
@@ -1290,6 +1420,8 @@ declare class EditionPlugin extends UIPlugin {
1290
1420
  private startEdition;
1291
1421
  private stopEdition;
1292
1422
  private cancelEditionAndActivateSheet;
1423
+ private getComposerContent;
1424
+ private numberComposerContent;
1293
1425
  private cancelEdition;
1294
1426
  /**
1295
1427
  * Reset the current content to the active cell content
@@ -1338,81 +1470,6 @@ declare class EditionPlugin extends UIPlugin {
1338
1470
  private getTokensInSelection;
1339
1471
  }
1340
1472
 
1341
- interface SearchOptions {
1342
- matchCase: boolean;
1343
- exactMatch: boolean;
1344
- searchFormulas: boolean;
1345
- }
1346
- interface SearchMatch {
1347
- selected: boolean;
1348
- col: HeaderIndex;
1349
- row: HeaderIndex;
1350
- }
1351
- /**
1352
- * Find and Replace Plugin
1353
- *
1354
- * This plugin is used in combination with the find_and_replace sidePanel
1355
- * It is used to 'highlight' cells that match an input string according to
1356
- * the given searchOptions. The second part of this plugin makes it possible
1357
- * (again with the find_and_replace sidePanel), to replace the values that match
1358
- * the search with a new value.
1359
- */
1360
- declare class FindAndReplacePlugin extends UIPlugin {
1361
- static layers: LAYERS[];
1362
- static getters: readonly ["getSearchMatches", "getCurrentSelectedMatchIndex"];
1363
- private searchMatches;
1364
- private selectedMatchIndex;
1365
- private currentSearchRegex;
1366
- private searchOptions;
1367
- private toSearch;
1368
- handle(cmd: Command): void;
1369
- getSearchMatches(): SearchMatch[];
1370
- getCurrentSelectedMatchIndex(): number | null;
1371
- /**
1372
- * Will update the current searchOptions and accordingly update the regex.
1373
- * It will then search for matches using the regex and store them.
1374
- */
1375
- private updateSearch;
1376
- /**
1377
- * refresh the matches according to the current search options
1378
- */
1379
- private refreshSearch;
1380
- /**
1381
- * Updates the regex based on the current searchOptions and
1382
- * the value toSearch
1383
- */
1384
- private updateRegex;
1385
- /**
1386
- * Find matches using the current regex
1387
- */
1388
- private findMatches;
1389
- private sortByRowThenColumn;
1390
- /**
1391
- * Changes the selected search cell. Given a direction it will
1392
- * Change the selection to the previous, current or nextCell,
1393
- * if it exists otherwise it will set the selectedMatchIndex to null.
1394
- * It will also reset the index to 0 if the search has changed.
1395
- * It is also used to keep coherence between the selected searchMatch
1396
- * and selectedMatchIndex.
1397
- */
1398
- private selectNextCell;
1399
- private clearSearch;
1400
- /**
1401
- * Replace the value of the currently selected match
1402
- */
1403
- private replace;
1404
- /**
1405
- * Apply the replace function to all the matches one time.
1406
- */
1407
- private replaceAll;
1408
- /**
1409
- * Determines if the content, the value or nothing should be replaced,
1410
- * based on the search and replace options
1411
- */
1412
- private toReplace;
1413
- drawGrid(renderingContext: GridRenderingContext): void;
1414
- }
1415
-
1416
1473
  declare type Rect = {
1417
1474
  x: Pixel;
1418
1475
  y: Pixel;
@@ -1470,8 +1527,8 @@ declare const enum LAYERS {
1470
1527
  Clipboard = 2,
1471
1528
  Search = 3,
1472
1529
  Chart = 4,
1473
- Selection = 5,
1474
- Autofill = 6,
1530
+ Autofill = 5,
1531
+ Selection = 6,
1475
1532
  Headers = 7
1476
1533
  }
1477
1534
  interface EdgeScrollInfo {
@@ -1481,6 +1538,13 @@ interface EdgeScrollInfo {
1481
1538
  }
1482
1539
  declare type ScrollDirection$1 = 1 | 0 | -1 | "reset";
1483
1540
 
1541
+ declare enum ClipboardMIMEType {
1542
+ PlainText = "text/plain",
1543
+ Html = "text/html"
1544
+ }
1545
+ declare type ClipboardContent = {
1546
+ [type in ClipboardMIMEType]?: string;
1547
+ };
1484
1548
  declare type ClipboardPasteOptions = "onlyFormat" | "onlyValue";
1485
1549
 
1486
1550
  /**
@@ -1523,9 +1587,9 @@ interface PositionDependentCommand {
1523
1587
  col: number;
1524
1588
  row: number;
1525
1589
  }
1526
- declare const invalidateEvaluationCommands: Set<"UPDATE_CELL" | "UPDATE_CELL_POSITION" | "CLEAR_CELL" | "DELETE_CONTENT" | "ADD_COLUMNS_ROWS" | "REMOVE_COLUMNS_ROWS" | "RESIZE_COLUMNS_ROWS" | "HIDE_COLUMNS_ROWS" | "UNHIDE_COLUMNS_ROWS" | "SET_GRID_LINES_VISIBILITY" | "FREEZE_COLUMNS" | "FREEZE_ROWS" | "UNFREEZE_COLUMNS_ROWS" | "UNFREEZE_COLUMNS" | "UNFREEZE_ROWS" | "ADD_MERGE" | "REMOVE_MERGE" | "CREATE_SHEET" | "DELETE_SHEET" | "DUPLICATE_SHEET" | "MOVE_SHEET" | "RENAME_SHEET" | "HIDE_SHEET" | "SHOW_SHEET" | "MOVE_RANGES" | "ADD_CONDITIONAL_FORMAT" | "REMOVE_CONDITIONAL_FORMAT" | "MOVE_CONDITIONAL_FORMAT" | "CREATE_FIGURE" | "DELETE_FIGURE" | "UPDATE_FIGURE" | "SET_FORMATTING" | "CLEAR_FORMATTING" | "SET_BORDER" | "CREATE_CHART" | "UPDATE_CHART" | "CREATE_FILTER_TABLE" | "REMOVE_FILTER_TABLE" | "REQUEST_UNDO" | "REQUEST_REDO" | "UNDO" | "REDO" | "ENABLE_NEW_SELECTION_INPUT" | "DISABLE_SELECTION_INPUT" | "UNFOCUS_SELECTION_INPUT" | "FOCUS_RANGE" | "ADD_EMPTY_RANGE" | "REMOVE_RANGE" | "CHANGE_RANGE" | "COPY" | "CUT" | "PASTE" | "AUTOFILL_CELL" | "PASTE_FROM_OS_CLIPBOARD" | "ACTIVATE_PAINT_FORMAT" | "PASTE_CONDITIONAL_FORMAT" | "AUTORESIZE_COLUMNS" | "AUTORESIZE_ROWS" | "MOVE_COLUMNS_ROWS" | "ACTIVATE_SHEET" | "PREPARE_SELECTION_INPUT_EXPANSION" | "STOP_SELECTION_INPUT" | "EVALUATE_CELLS" | "CHANGE_HIGHLIGHT" | "START_CHANGE_HIGHLIGHT" | "SET_HIGHLIGHT_COLOR" | "STOP_COMPOSER_RANGE_SELECTION" | "START_EDITION" | "STOP_EDITION" | "SET_CURRENT_CONTENT" | "CHANGE_COMPOSER_CURSOR_SELECTION" | "REPLACE_COMPOSER_CURSOR_SELECTION" | "CYCLE_EDITION_REFERENCES" | "START" | "AUTOFILL" | "AUTOFILL_SELECT" | "SET_FORMULA_VISIBILITY" | "AUTOFILL_AUTO" | "SELECT_FIGURE" | "UPDATE_SEARCH" | "REFRESH_SEARCH" | "CLEAR_SEARCH" | "SELECT_SEARCH_PREVIOUS_MATCH" | "SELECT_SEARCH_NEXT_MATCH" | "REPLACE_SEARCH" | "REPLACE_ALL_SEARCH" | "SORT_CELLS" | "SET_DECIMAL" | "RESIZE_SHEETVIEW" | "SUM_SELECTION" | "DELETE_CELL" | "INSERT_CELL" | "SET_VIEWPORT_OFFSET" | "SHIFT_VIEWPORT_DOWN" | "SHIFT_VIEWPORT_UP" | "OPEN_CELL_POPOVER" | "CLOSE_CELL_POPOVER" | "ACTIVATE_NEXT_SHEET" | "ACTIVATE_PREVIOUS_SHEET" | "UPDATE_FILTER">;
1527
- declare const readonlyAllowedCommands: Set<"UPDATE_CELL" | "UPDATE_CELL_POSITION" | "CLEAR_CELL" | "DELETE_CONTENT" | "ADD_COLUMNS_ROWS" | "REMOVE_COLUMNS_ROWS" | "RESIZE_COLUMNS_ROWS" | "HIDE_COLUMNS_ROWS" | "UNHIDE_COLUMNS_ROWS" | "SET_GRID_LINES_VISIBILITY" | "FREEZE_COLUMNS" | "FREEZE_ROWS" | "UNFREEZE_COLUMNS_ROWS" | "UNFREEZE_COLUMNS" | "UNFREEZE_ROWS" | "ADD_MERGE" | "REMOVE_MERGE" | "CREATE_SHEET" | "DELETE_SHEET" | "DUPLICATE_SHEET" | "MOVE_SHEET" | "RENAME_SHEET" | "HIDE_SHEET" | "SHOW_SHEET" | "MOVE_RANGES" | "ADD_CONDITIONAL_FORMAT" | "REMOVE_CONDITIONAL_FORMAT" | "MOVE_CONDITIONAL_FORMAT" | "CREATE_FIGURE" | "DELETE_FIGURE" | "UPDATE_FIGURE" | "SET_FORMATTING" | "CLEAR_FORMATTING" | "SET_BORDER" | "CREATE_CHART" | "UPDATE_CHART" | "CREATE_FILTER_TABLE" | "REMOVE_FILTER_TABLE" | "REQUEST_UNDO" | "REQUEST_REDO" | "UNDO" | "REDO" | "ENABLE_NEW_SELECTION_INPUT" | "DISABLE_SELECTION_INPUT" | "UNFOCUS_SELECTION_INPUT" | "FOCUS_RANGE" | "ADD_EMPTY_RANGE" | "REMOVE_RANGE" | "CHANGE_RANGE" | "COPY" | "CUT" | "PASTE" | "AUTOFILL_CELL" | "PASTE_FROM_OS_CLIPBOARD" | "ACTIVATE_PAINT_FORMAT" | "PASTE_CONDITIONAL_FORMAT" | "AUTORESIZE_COLUMNS" | "AUTORESIZE_ROWS" | "MOVE_COLUMNS_ROWS" | "ACTIVATE_SHEET" | "PREPARE_SELECTION_INPUT_EXPANSION" | "STOP_SELECTION_INPUT" | "EVALUATE_CELLS" | "CHANGE_HIGHLIGHT" | "START_CHANGE_HIGHLIGHT" | "SET_HIGHLIGHT_COLOR" | "STOP_COMPOSER_RANGE_SELECTION" | "START_EDITION" | "STOP_EDITION" | "SET_CURRENT_CONTENT" | "CHANGE_COMPOSER_CURSOR_SELECTION" | "REPLACE_COMPOSER_CURSOR_SELECTION" | "CYCLE_EDITION_REFERENCES" | "START" | "AUTOFILL" | "AUTOFILL_SELECT" | "SET_FORMULA_VISIBILITY" | "AUTOFILL_AUTO" | "SELECT_FIGURE" | "UPDATE_SEARCH" | "REFRESH_SEARCH" | "CLEAR_SEARCH" | "SELECT_SEARCH_PREVIOUS_MATCH" | "SELECT_SEARCH_NEXT_MATCH" | "REPLACE_SEARCH" | "REPLACE_ALL_SEARCH" | "SORT_CELLS" | "SET_DECIMAL" | "RESIZE_SHEETVIEW" | "SUM_SELECTION" | "DELETE_CELL" | "INSERT_CELL" | "SET_VIEWPORT_OFFSET" | "SHIFT_VIEWPORT_DOWN" | "SHIFT_VIEWPORT_UP" | "OPEN_CELL_POPOVER" | "CLOSE_CELL_POPOVER" | "ACTIVATE_NEXT_SHEET" | "ACTIVATE_PREVIOUS_SHEET" | "UPDATE_FILTER">;
1528
- declare const coreTypes: Set<"UPDATE_CELL" | "UPDATE_CELL_POSITION" | "CLEAR_CELL" | "DELETE_CONTENT" | "ADD_COLUMNS_ROWS" | "REMOVE_COLUMNS_ROWS" | "RESIZE_COLUMNS_ROWS" | "HIDE_COLUMNS_ROWS" | "UNHIDE_COLUMNS_ROWS" | "SET_GRID_LINES_VISIBILITY" | "FREEZE_COLUMNS" | "FREEZE_ROWS" | "UNFREEZE_COLUMNS_ROWS" | "UNFREEZE_COLUMNS" | "UNFREEZE_ROWS" | "ADD_MERGE" | "REMOVE_MERGE" | "CREATE_SHEET" | "DELETE_SHEET" | "DUPLICATE_SHEET" | "MOVE_SHEET" | "RENAME_SHEET" | "HIDE_SHEET" | "SHOW_SHEET" | "MOVE_RANGES" | "ADD_CONDITIONAL_FORMAT" | "REMOVE_CONDITIONAL_FORMAT" | "MOVE_CONDITIONAL_FORMAT" | "CREATE_FIGURE" | "DELETE_FIGURE" | "UPDATE_FIGURE" | "SET_FORMATTING" | "CLEAR_FORMATTING" | "SET_BORDER" | "CREATE_CHART" | "UPDATE_CHART" | "CREATE_FILTER_TABLE" | "REMOVE_FILTER_TABLE">;
1590
+ declare const invalidateEvaluationCommands: Set<"UPDATE_CELL" | "UPDATE_CELL_POSITION" | "CLEAR_CELL" | "DELETE_CONTENT" | "ADD_COLUMNS_ROWS" | "REMOVE_COLUMNS_ROWS" | "RESIZE_COLUMNS_ROWS" | "HIDE_COLUMNS_ROWS" | "UNHIDE_COLUMNS_ROWS" | "SET_GRID_LINES_VISIBILITY" | "FREEZE_COLUMNS" | "FREEZE_ROWS" | "UNFREEZE_COLUMNS_ROWS" | "UNFREEZE_COLUMNS" | "UNFREEZE_ROWS" | "ADD_MERGE" | "REMOVE_MERGE" | "CREATE_SHEET" | "DELETE_SHEET" | "DUPLICATE_SHEET" | "MOVE_SHEET" | "RENAME_SHEET" | "HIDE_SHEET" | "SHOW_SHEET" | "MOVE_RANGES" | "ADD_CONDITIONAL_FORMAT" | "REMOVE_CONDITIONAL_FORMAT" | "MOVE_CONDITIONAL_FORMAT" | "CREATE_FIGURE" | "DELETE_FIGURE" | "UPDATE_FIGURE" | "SET_FORMATTING" | "CLEAR_FORMATTING" | "SET_BORDER" | "CREATE_CHART" | "UPDATE_CHART" | "CREATE_IMAGE" | "CREATE_FILTER_TABLE" | "REMOVE_FILTER_TABLE" | "REQUEST_UNDO" | "REQUEST_REDO" | "UNDO" | "REDO" | "ENABLE_NEW_SELECTION_INPUT" | "DISABLE_SELECTION_INPUT" | "UNFOCUS_SELECTION_INPUT" | "FOCUS_RANGE" | "ADD_EMPTY_RANGE" | "REMOVE_RANGE" | "CHANGE_RANGE" | "COPY" | "CUT" | "PASTE" | "CLEAN_CLIPBOARD_HIGHLIGHT" | "AUTOFILL_CELL" | "PASTE_FROM_OS_CLIPBOARD" | "ACTIVATE_PAINT_FORMAT" | "PASTE_CONDITIONAL_FORMAT" | "AUTORESIZE_COLUMNS" | "AUTORESIZE_ROWS" | "MOVE_COLUMNS_ROWS" | "ACTIVATE_SHEET" | "PREPARE_SELECTION_INPUT_EXPANSION" | "STOP_SELECTION_INPUT" | "EVALUATE_CELLS" | "CHANGE_HIGHLIGHT" | "START_CHANGE_HIGHLIGHT" | "SET_HIGHLIGHT_COLOR" | "STOP_COMPOSER_RANGE_SELECTION" | "START_EDITION" | "STOP_EDITION" | "SET_CURRENT_CONTENT" | "CHANGE_COMPOSER_CURSOR_SELECTION" | "REPLACE_COMPOSER_CURSOR_SELECTION" | "CYCLE_EDITION_REFERENCES" | "START" | "AUTOFILL" | "AUTOFILL_SELECT" | "SET_FORMULA_VISIBILITY" | "AUTOFILL_AUTO" | "SELECT_FIGURE" | "UPDATE_SEARCH" | "REFRESH_SEARCH" | "CLEAR_SEARCH" | "SELECT_SEARCH_PREVIOUS_MATCH" | "SELECT_SEARCH_NEXT_MATCH" | "REPLACE_SEARCH" | "REPLACE_ALL_SEARCH" | "SORT_CELLS" | "SET_DECIMAL" | "RESIZE_SHEETVIEW" | "SUM_SELECTION" | "DELETE_CELL" | "INSERT_CELL" | "SET_VIEWPORT_OFFSET" | "SHIFT_VIEWPORT_DOWN" | "SHIFT_VIEWPORT_UP" | "OPEN_CELL_POPOVER" | "CLOSE_CELL_POPOVER" | "ACTIVATE_NEXT_SHEET" | "ACTIVATE_PREVIOUS_SHEET" | "UPDATE_FILTER">;
1591
+ declare const readonlyAllowedCommands: Set<"UPDATE_CELL" | "UPDATE_CELL_POSITION" | "CLEAR_CELL" | "DELETE_CONTENT" | "ADD_COLUMNS_ROWS" | "REMOVE_COLUMNS_ROWS" | "RESIZE_COLUMNS_ROWS" | "HIDE_COLUMNS_ROWS" | "UNHIDE_COLUMNS_ROWS" | "SET_GRID_LINES_VISIBILITY" | "FREEZE_COLUMNS" | "FREEZE_ROWS" | "UNFREEZE_COLUMNS_ROWS" | "UNFREEZE_COLUMNS" | "UNFREEZE_ROWS" | "ADD_MERGE" | "REMOVE_MERGE" | "CREATE_SHEET" | "DELETE_SHEET" | "DUPLICATE_SHEET" | "MOVE_SHEET" | "RENAME_SHEET" | "HIDE_SHEET" | "SHOW_SHEET" | "MOVE_RANGES" | "ADD_CONDITIONAL_FORMAT" | "REMOVE_CONDITIONAL_FORMAT" | "MOVE_CONDITIONAL_FORMAT" | "CREATE_FIGURE" | "DELETE_FIGURE" | "UPDATE_FIGURE" | "SET_FORMATTING" | "CLEAR_FORMATTING" | "SET_BORDER" | "CREATE_CHART" | "UPDATE_CHART" | "CREATE_IMAGE" | "CREATE_FILTER_TABLE" | "REMOVE_FILTER_TABLE" | "REQUEST_UNDO" | "REQUEST_REDO" | "UNDO" | "REDO" | "ENABLE_NEW_SELECTION_INPUT" | "DISABLE_SELECTION_INPUT" | "UNFOCUS_SELECTION_INPUT" | "FOCUS_RANGE" | "ADD_EMPTY_RANGE" | "REMOVE_RANGE" | "CHANGE_RANGE" | "COPY" | "CUT" | "PASTE" | "CLEAN_CLIPBOARD_HIGHLIGHT" | "AUTOFILL_CELL" | "PASTE_FROM_OS_CLIPBOARD" | "ACTIVATE_PAINT_FORMAT" | "PASTE_CONDITIONAL_FORMAT" | "AUTORESIZE_COLUMNS" | "AUTORESIZE_ROWS" | "MOVE_COLUMNS_ROWS" | "ACTIVATE_SHEET" | "PREPARE_SELECTION_INPUT_EXPANSION" | "STOP_SELECTION_INPUT" | "EVALUATE_CELLS" | "CHANGE_HIGHLIGHT" | "START_CHANGE_HIGHLIGHT" | "SET_HIGHLIGHT_COLOR" | "STOP_COMPOSER_RANGE_SELECTION" | "START_EDITION" | "STOP_EDITION" | "SET_CURRENT_CONTENT" | "CHANGE_COMPOSER_CURSOR_SELECTION" | "REPLACE_COMPOSER_CURSOR_SELECTION" | "CYCLE_EDITION_REFERENCES" | "START" | "AUTOFILL" | "AUTOFILL_SELECT" | "SET_FORMULA_VISIBILITY" | "AUTOFILL_AUTO" | "SELECT_FIGURE" | "UPDATE_SEARCH" | "REFRESH_SEARCH" | "CLEAR_SEARCH" | "SELECT_SEARCH_PREVIOUS_MATCH" | "SELECT_SEARCH_NEXT_MATCH" | "REPLACE_SEARCH" | "REPLACE_ALL_SEARCH" | "SORT_CELLS" | "SET_DECIMAL" | "RESIZE_SHEETVIEW" | "SUM_SELECTION" | "DELETE_CELL" | "INSERT_CELL" | "SET_VIEWPORT_OFFSET" | "SHIFT_VIEWPORT_DOWN" | "SHIFT_VIEWPORT_UP" | "OPEN_CELL_POPOVER" | "CLOSE_CELL_POPOVER" | "ACTIVATE_NEXT_SHEET" | "ACTIVATE_PREVIOUS_SHEET" | "UPDATE_FILTER">;
1592
+ declare const coreTypes: Set<"UPDATE_CELL" | "UPDATE_CELL_POSITION" | "CLEAR_CELL" | "DELETE_CONTENT" | "ADD_COLUMNS_ROWS" | "REMOVE_COLUMNS_ROWS" | "RESIZE_COLUMNS_ROWS" | "HIDE_COLUMNS_ROWS" | "UNHIDE_COLUMNS_ROWS" | "SET_GRID_LINES_VISIBILITY" | "FREEZE_COLUMNS" | "FREEZE_ROWS" | "UNFREEZE_COLUMNS_ROWS" | "UNFREEZE_COLUMNS" | "UNFREEZE_ROWS" | "ADD_MERGE" | "REMOVE_MERGE" | "CREATE_SHEET" | "DELETE_SHEET" | "DUPLICATE_SHEET" | "MOVE_SHEET" | "RENAME_SHEET" | "HIDE_SHEET" | "SHOW_SHEET" | "MOVE_RANGES" | "ADD_CONDITIONAL_FORMAT" | "REMOVE_CONDITIONAL_FORMAT" | "MOVE_CONDITIONAL_FORMAT" | "CREATE_FIGURE" | "DELETE_FIGURE" | "UPDATE_FIGURE" | "SET_FORMATTING" | "CLEAR_FORMATTING" | "SET_BORDER" | "CREATE_CHART" | "UPDATE_CHART" | "CREATE_IMAGE" | "CREATE_FILTER_TABLE" | "REMOVE_FILTER_TABLE">;
1529
1593
  interface UpdateCellCommand extends PositionDependentCommand {
1530
1594
  type: "UPDATE_CELL";
1531
1595
  content?: string;
@@ -1679,10 +1743,7 @@ interface CreateChartCommand extends SheetDependentCommand {
1679
1743
  x: number;
1680
1744
  y: number;
1681
1745
  };
1682
- size?: {
1683
- width: number;
1684
- height: number;
1685
- };
1746
+ size?: FigureSize;
1686
1747
  definition: ChartDefinition;
1687
1748
  }
1688
1749
  interface UpdateChartCommand extends SheetDependentCommand {
@@ -1690,6 +1751,16 @@ interface UpdateChartCommand extends SheetDependentCommand {
1690
1751
  id: UID;
1691
1752
  definition: ChartDefinition;
1692
1753
  }
1754
+ interface CreateImageOverCommand extends SheetDependentCommand {
1755
+ type: "CREATE_IMAGE";
1756
+ figureId: UID;
1757
+ position: {
1758
+ x: number;
1759
+ y: number;
1760
+ };
1761
+ size: FigureSize;
1762
+ definition: Image;
1763
+ }
1693
1764
  interface CreateFilterTableCommand extends TargetDependentCommand {
1694
1765
  type: "CREATE_FILTER_TABLE";
1695
1766
  }
@@ -1730,6 +1801,9 @@ interface PasteCommand {
1730
1801
  target: Zone[];
1731
1802
  pasteOption?: ClipboardPasteOptions;
1732
1803
  }
1804
+ interface CleanClipBoardHighlightCommand {
1805
+ type: "CLEAN_CLIPBOARD_HIGHLIGHT";
1806
+ }
1733
1807
  interface AutoFillCellCommand {
1734
1808
  type: "AUTOFILL_CELL";
1735
1809
  originCol: number;
@@ -2067,9 +2141,11 @@ UpdateCellCommand | UpdateCellPositionCommand | ClearCellCommand | DeleteContent
2067
2141
  | SetFormattingCommand | ClearFormattingCommand | SetBorderCommand
2068
2142
  /** CHART */
2069
2143
  | CreateChartCommand | UpdateChartCommand
2144
+ /** Image */
2145
+ | CreateImageOverCommand
2070
2146
  /** FILTERS */
2071
2147
  | CreateFilterTableCommand | RemoveFilterTableCommand;
2072
- declare type LocalCommand = RequestUndoCommand | RequestRedoCommand | UndoCommand | RedoCommand | NewInputCommand | RemoveInputCommand | UnfocusInputCommand | FocusInputCommand | AddEmptyRangeCommand | RemoveRangeCommand | ChangeRangeCommand | CopyCommand | CutCommand | PasteCommand | AutoFillCellCommand | PasteFromOSClipboardCommand | ActivatePaintFormatCommand | PasteCFCommand | AutoresizeColumnsCommand | AutoresizeRowsCommand | MoveColumnsRowsCommand | ActivateSheetCommand | PrepareExpansionCommand | StopSelectionCommand | EvaluateCellsCommand | ChangeHighlightCommand | StartChangeHighlightCommand | SetColorCommand | StopComposerSelectionCommand | StartEditionCommand | StopEditionCommand | SetCurrentContentCommand | ChangeComposerSelectionCommand | ReplaceComposerSelectionCommand | CycleEditionReferencesCommand | StartCommand | AutofillCommand | AutofillSelectCommand | ShowFormulaCommand | AutofillAutoCommand | SelectFigureCommand | UpdateSearchCommand | RefreshSearchCommand | ClearSearchCommand | SelectSearchPreviousCommand | SelectSearchNextCommand | ReplaceSearchCommand | ReplaceAllSearchCommand | SortCommand | SetDecimalCommand | ResizeViewportCommand | SumSelectionCommand | DeleteCellCommand | InsertCellCommand | SetViewportOffsetCommand | MoveViewportDownCommand | MoveViewportUpCommand | OpenCellPopoverCommand | CloseCellPopoverCommand | ActivateNextSheetCommand | ActivatePreviousSheetCommand | UpdateFilterCommand;
2148
+ declare type LocalCommand = RequestUndoCommand | RequestRedoCommand | UndoCommand | RedoCommand | NewInputCommand | RemoveInputCommand | UnfocusInputCommand | FocusInputCommand | AddEmptyRangeCommand | RemoveRangeCommand | ChangeRangeCommand | CopyCommand | CutCommand | PasteCommand | CleanClipBoardHighlightCommand | AutoFillCellCommand | PasteFromOSClipboardCommand | ActivatePaintFormatCommand | PasteCFCommand | AutoresizeColumnsCommand | AutoresizeRowsCommand | MoveColumnsRowsCommand | ActivateSheetCommand | PrepareExpansionCommand | StopSelectionCommand | EvaluateCellsCommand | ChangeHighlightCommand | StartChangeHighlightCommand | SetColorCommand | StopComposerSelectionCommand | StartEditionCommand | StopEditionCommand | SetCurrentContentCommand | ChangeComposerSelectionCommand | ReplaceComposerSelectionCommand | CycleEditionReferencesCommand | StartCommand | AutofillCommand | AutofillSelectCommand | ShowFormulaCommand | AutofillAutoCommand | SelectFigureCommand | UpdateSearchCommand | RefreshSearchCommand | ClearSearchCommand | SelectSearchPreviousCommand | SelectSearchNextCommand | ReplaceSearchCommand | ReplaceAllSearchCommand | SortCommand | SetDecimalCommand | ResizeViewportCommand | SumSelectionCommand | DeleteCellCommand | InsertCellCommand | SetViewportOffsetCommand | MoveViewportDownCommand | MoveViewportUpCommand | OpenCellPopoverCommand | CloseCellPopoverCommand | ActivateNextSheetCommand | ActivatePreviousSheetCommand | UpdateFilterCommand;
2073
2149
  declare type Command = CoreCommand | LocalCommand;
2074
2150
  /**
2075
2151
  * Holds the result of a command dispatch.
@@ -2120,62 +2196,63 @@ declare const enum CommandResult {
2120
2196
  InvalidRange = 25,
2121
2197
  InvalidZones = 26,
2122
2198
  InvalidSheetId = 27,
2123
- InputAlreadyFocused = 28,
2124
- MaximumRangesReached = 29,
2125
- InvalidChartDefinition = 30,
2126
- InvalidDataSet = 31,
2127
- InvalidLabelRange = 32,
2128
- InvalidScorecardKeyValue = 33,
2129
- InvalidScorecardBaseline = 34,
2130
- InvalidGaugeDataRange = 35,
2131
- EmptyGaugeRangeMin = 36,
2132
- GaugeRangeMinNaN = 37,
2133
- EmptyGaugeRangeMax = 38,
2134
- GaugeRangeMaxNaN = 39,
2135
- GaugeRangeMinBiggerThanRangeMax = 40,
2136
- GaugeLowerInflectionPointNaN = 41,
2137
- GaugeUpperInflectionPointNaN = 42,
2138
- GaugeLowerBiggerThanUpper = 43,
2139
- InvalidAutofillSelection = 44,
2140
- WrongComposerSelection = 45,
2141
- MinBiggerThanMax = 46,
2142
- LowerBiggerThanUpper = 47,
2143
- MidBiggerThanMax = 48,
2144
- MinBiggerThanMid = 49,
2145
- FirstArgMissing = 50,
2146
- SecondArgMissing = 51,
2147
- MinNaN = 52,
2148
- MidNaN = 53,
2149
- MaxNaN = 54,
2150
- ValueUpperInflectionNaN = 55,
2151
- ValueLowerInflectionNaN = 56,
2152
- MinInvalidFormula = 57,
2153
- MidInvalidFormula = 58,
2154
- MaxInvalidFormula = 59,
2155
- ValueUpperInvalidFormula = 60,
2156
- ValueLowerInvalidFormula = 61,
2157
- InvalidSortZone = 62,
2158
- WaitingSessionConfirmation = 63,
2159
- MergeOverlap = 64,
2160
- TooManyHiddenElements = 65,
2161
- Readonly = 66,
2162
- InvalidViewportSize = 67,
2163
- InvalidScrollingDirection = 68,
2164
- FigureDoesNotExist = 69,
2165
- InvalidConditionalFormatId = 70,
2166
- InvalidCellPopover = 71,
2167
- EmptyTarget = 72,
2168
- InvalidFreezeQuantity = 73,
2169
- FrozenPaneOverlap = 74,
2170
- ValuesNotChanged = 75,
2171
- InvalidFilterZone = 76,
2172
- FilterOverlap = 77,
2173
- FilterNotFound = 78,
2174
- MergeInFilter = 79,
2175
- NonContinuousTargets = 80,
2176
- DuplicatedFigureId = 81,
2177
- InvalidSelectionStep = 82,
2178
- DuplicatedChartId = 83
2199
+ DuplicatedImageId = 28,
2200
+ InputAlreadyFocused = 29,
2201
+ MaximumRangesReached = 30,
2202
+ InvalidChartDefinition = 31,
2203
+ InvalidDataSet = 32,
2204
+ InvalidLabelRange = 33,
2205
+ InvalidScorecardKeyValue = 34,
2206
+ InvalidScorecardBaseline = 35,
2207
+ InvalidGaugeDataRange = 36,
2208
+ EmptyGaugeRangeMin = 37,
2209
+ GaugeRangeMinNaN = 38,
2210
+ EmptyGaugeRangeMax = 39,
2211
+ GaugeRangeMaxNaN = 40,
2212
+ GaugeRangeMinBiggerThanRangeMax = 41,
2213
+ GaugeLowerInflectionPointNaN = 42,
2214
+ GaugeUpperInflectionPointNaN = 43,
2215
+ GaugeLowerBiggerThanUpper = 44,
2216
+ InvalidAutofillSelection = 45,
2217
+ WrongComposerSelection = 46,
2218
+ MinBiggerThanMax = 47,
2219
+ LowerBiggerThanUpper = 48,
2220
+ MidBiggerThanMax = 49,
2221
+ MinBiggerThanMid = 50,
2222
+ FirstArgMissing = 51,
2223
+ SecondArgMissing = 52,
2224
+ MinNaN = 53,
2225
+ MidNaN = 54,
2226
+ MaxNaN = 55,
2227
+ ValueUpperInflectionNaN = 56,
2228
+ ValueLowerInflectionNaN = 57,
2229
+ MinInvalidFormula = 58,
2230
+ MidInvalidFormula = 59,
2231
+ MaxInvalidFormula = 60,
2232
+ ValueUpperInvalidFormula = 61,
2233
+ ValueLowerInvalidFormula = 62,
2234
+ InvalidSortZone = 63,
2235
+ WaitingSessionConfirmation = 64,
2236
+ MergeOverlap = 65,
2237
+ TooManyHiddenElements = 66,
2238
+ Readonly = 67,
2239
+ InvalidViewportSize = 68,
2240
+ InvalidScrollingDirection = 69,
2241
+ FigureDoesNotExist = 70,
2242
+ InvalidConditionalFormatId = 71,
2243
+ InvalidCellPopover = 72,
2244
+ EmptyTarget = 73,
2245
+ InvalidFreezeQuantity = 74,
2246
+ FrozenPaneOverlap = 75,
2247
+ ValuesNotChanged = 76,
2248
+ InvalidFilterZone = 77,
2249
+ FilterOverlap = 78,
2250
+ FilterNotFound = 79,
2251
+ MergeInFilter = 80,
2252
+ NonContinuousTargets = 81,
2253
+ DuplicatedFigureId = 82,
2254
+ InvalidSelectionStep = 83,
2255
+ DuplicatedChartId = 84
2179
2256
  }
2180
2257
  interface CommandHandler<T> {
2181
2258
  allowDispatch(command: T): CommandResult | CommandResult[];
@@ -2226,13 +2303,14 @@ interface RGBA {
2226
2303
  b: number;
2227
2304
  }
2228
2305
  interface Link {
2229
- label: string;
2230
- url: string;
2306
+ readonly label: string;
2307
+ readonly url: string;
2308
+ readonly isExternal: boolean;
2231
2309
  /**
2232
- * Specifies if the resource is external and can
2233
- * be opened in a new tab.
2310
+ * Specifies if the URL is editable by the end user.
2311
+ * Special links might not allow it.
2234
2312
  */
2235
- isExternal?: boolean;
2313
+ readonly isUrlEditable: boolean;
2236
2314
  }
2237
2315
  interface Zone {
2238
2316
  left: HeaderIndex;
@@ -2260,6 +2338,7 @@ interface ZoneDimension {
2260
2338
  width: HeaderIndex;
2261
2339
  }
2262
2340
  declare type Align = "left" | "right" | "center" | undefined;
2341
+ declare type VerticalAlign = "top" | "middle" | "bottom" | undefined;
2263
2342
  declare type Wrapping = "overflow" | "wrap" | "clip" | undefined;
2264
2343
  interface Style {
2265
2344
  bold?: boolean;
@@ -2268,6 +2347,7 @@ interface Style {
2268
2347
  underline?: boolean;
2269
2348
  align?: Align;
2270
2349
  wrapping?: Wrapping;
2350
+ verticalAlign?: VerticalAlign;
2271
2351
  fillColor?: string;
2272
2352
  textColor?: string;
2273
2353
  fontSize?: number;
@@ -2424,100 +2504,60 @@ interface MenuMouseEvent extends MouseEvent {
2424
2504
  declare type Format = string & Alias;
2425
2505
  declare type FormattedValue = string & Alias;
2426
2506
 
2427
- declare type Cell = ICell | FormulaCell;
2428
- interface ICell {
2507
+ interface CellAttributes {
2429
2508
  readonly id: UID;
2430
2509
  /**
2431
2510
  * Raw cell content
2432
2511
  */
2433
2512
  readonly content: string;
2434
- /**
2435
- * Cell content displayed in the composer. It defaults to the cell content
2436
- * for most cell types.
2437
- */
2438
- readonly composerContent: string;
2439
- /**
2440
- * Evaluated cell content
2441
- */
2442
- readonly evaluated: CellEvaluation;
2443
- /**
2444
- * Cell value formatted based on the format
2445
- */
2446
- readonly formattedValue: FormattedValue;
2447
2513
  readonly style?: Style;
2448
2514
  readonly format?: Format;
2449
- readonly defaultAlign: "right" | "center" | "left";
2450
- /**
2451
- * Can the cell appear in an automatic sum zone.
2452
- */
2453
- readonly isAutoSummable: boolean;
2454
- isFormula(): this is FormulaCell;
2455
- isLink(): this is LinkCell$1;
2456
- isEmpty(): boolean;
2457
- }
2458
- interface FormulaCell extends ICell {
2459
- assignEvaluation: (evaluationResult: Lazy<{
2460
- value: CellValue | null;
2461
- format?: Format;
2462
- } | EvaluationError>) => void;
2515
+ }
2516
+ interface LiteralCell extends CellAttributes {
2517
+ readonly isFormula: false;
2518
+ }
2519
+ interface FormulaCell extends CellAttributes {
2520
+ readonly isFormula: true;
2463
2521
  readonly compiledFormula: CompiledFormula;
2464
2522
  readonly dependencies: Range[];
2465
2523
  }
2466
- /**
2467
- * A cell that can redirect to a given location which is
2468
- * specified in a link.
2469
- */
2470
- interface LinkCell$1 extends ICell {
2471
- readonly link: Link;
2472
- /**
2473
- * Go to the link destination
2474
- */
2475
- readonly action: (env: SpreadsheetChildEnv) => void;
2524
+ declare type Cell = LiteralCell | FormulaCell;
2525
+ interface EvaluatedCellProperties {
2526
+ readonly format?: Format;
2476
2527
  /**
2477
- * String used to display the URL in components.
2478
- * Particularly useful for special links (sheet, etc.)
2479
- * - a simple web link displays the raw url
2480
- * - a link to a sheet displays the sheet name
2528
+ * Cell value formatted based on the format
2481
2529
  */
2482
- readonly urlRepresentation: string;
2530
+ readonly formattedValue: FormattedValue;
2531
+ readonly defaultAlign: "right" | "center" | "left";
2483
2532
  /**
2484
- * Specifies if the URL is editable by the end user.
2485
- * Special links might not allow it.
2533
+ * Can the cell appear in an automatic sum zone.
2486
2534
  */
2487
- readonly isUrlEditable: boolean;
2535
+ readonly isAutoSummable: boolean;
2536
+ readonly link?: Link;
2488
2537
  }
2489
2538
  declare type CellValue = string | number | boolean;
2490
- interface CellDisplayProperties {
2491
- style?: Style;
2492
- format?: Format;
2493
- }
2494
- declare type CellEvaluation = NumberEvaluation | TextEvaluation | BooleanEvaluation | EmptyEvaluation | InvalidEvaluation;
2495
- declare type NumberEvaluation = {
2539
+ declare type EvaluatedCell = NumberCell | TextCell | BooleanCell | EmptyCell | ErrorCell;
2540
+ interface NumberCell extends EvaluatedCellProperties {
2496
2541
  readonly type: CellValueType.number;
2497
2542
  readonly value: number;
2498
- readonly format?: Format;
2499
- };
2500
- declare type TextEvaluation = {
2543
+ }
2544
+ interface TextCell extends EvaluatedCellProperties {
2501
2545
  readonly type: CellValueType.text;
2502
2546
  readonly value: string;
2503
- readonly format?: Format;
2504
- };
2505
- declare type BooleanEvaluation = {
2547
+ }
2548
+ interface BooleanCell extends EvaluatedCellProperties {
2506
2549
  readonly type: CellValueType.boolean;
2507
2550
  readonly value: boolean;
2508
- readonly format?: Format;
2509
- };
2510
- declare type EmptyEvaluation = {
2551
+ }
2552
+ interface EmptyCell extends EvaluatedCellProperties {
2511
2553
  readonly type: CellValueType.empty;
2512
2554
  readonly value: "";
2513
- readonly format?: Format;
2514
- };
2515
- declare type InvalidEvaluation = {
2555
+ }
2556
+ interface ErrorCell extends EvaluatedCellProperties {
2516
2557
  readonly type: CellValueType.error;
2517
2558
  readonly value: string;
2518
2559
  readonly error: EvaluationError;
2519
- readonly format?: Format;
2520
- };
2560
+ }
2521
2561
  declare enum CellValueType {
2522
2562
  boolean = "boolean",
2523
2563
  number = "number",
@@ -2582,15 +2622,59 @@ interface RevisionData {
2582
2622
  readonly commands: readonly CoreCommand[];
2583
2623
  }
2584
2624
 
2585
- interface Figure {
2586
- id: UID;
2587
- x: Pixel;
2588
- y: Pixel;
2589
- width: Pixel;
2590
- height: Pixel;
2625
+ interface Currency {
2626
+ name: string;
2627
+ code: string;
2628
+ symbol: string;
2629
+ decimalPlaces: number;
2630
+ position: "before" | "after";
2631
+ }
2632
+
2633
+ declare type ClipboardReadResult = {
2634
+ status: "ok";
2635
+ content: string;
2636
+ } | {
2637
+ status: "permissionDenied" | "notImplemented";
2638
+ };
2639
+ interface ClipboardInterface {
2640
+ write(clipboardContent: ClipboardContent): Promise<void>;
2641
+ writeText(text: string): Promise<void>;
2642
+ readText(): Promise<ClipboardReadResult>;
2643
+ }
2644
+
2645
+ declare type TranslationFunction = (string: string, ...values: string[] | [{
2646
+ [key: string]: string;
2647
+ }]) => string;
2648
+ /***
2649
+ * Allow to inject a translation function from outside o-spreadsheet.
2650
+ * @param tfn the function that will do the translation
2651
+ */
2652
+ declare function setTranslationMethod(tfn: TranslationFunction): void;
2653
+
2654
+ interface EditTextOptions {
2655
+ error?: string;
2656
+ placeholder?: string;
2657
+ }
2658
+ interface InformationNotification {
2659
+ text: string;
2591
2660
  tag: string;
2592
2661
  }
2593
- declare type ResizeDirection = -1 | 0 | 1;
2662
+ interface SpreadsheetEnv {
2663
+ notifyUser: (notification: InformationNotification) => any;
2664
+ raiseError: (text: string) => any;
2665
+ askConfirmation: (content: string, confirm: () => any, cancel?: () => any) => any;
2666
+ editText: (title: string, callback: (text: string | null) => any, options?: EditTextOptions) => any;
2667
+ }
2668
+ interface SpreadsheetChildEnv extends SpreadsheetEnv {
2669
+ model: Model;
2670
+ imageProvider?: ImageProviderInterface;
2671
+ isDashboard: () => boolean;
2672
+ openSidePanel: (panel: string, panelProps?: any) => void;
2673
+ toggleSidePanel: (panel: string, panelProps?: any) => void;
2674
+ clipboard: ClipboardInterface;
2675
+ _t: TranslationFunction;
2676
+ loadCurrencies?: () => Promise<Currency[]>;
2677
+ }
2594
2678
 
2595
2679
  declare type ArgType = "ANY" | "BOOLEAN" | "NUMBER" | "STRING" | "DATE" | "RANGE" | "RANGE<BOOLEAN>" | "RANGE<NUMBER>" | "RANGE<DATE>" | "RANGE<STRING>" | "META";
2596
2680
  interface ArgDefinition {
@@ -2894,8 +2978,17 @@ declare class RangeAdapter implements CommandHandler<CoreCommand> {
2894
2978
  private getRangePartString;
2895
2979
  }
2896
2980
 
2981
+ interface CorePluginConfig {
2982
+ readonly getters: CoreGetters;
2983
+ readonly stateObserver: StateObserver;
2984
+ readonly range: RangeAdapter;
2985
+ readonly dispatch: CoreCommandDispatcher["dispatch"];
2986
+ readonly uuidGenerator: UuidGenerator;
2987
+ readonly custom: ModelConfig["custom"];
2988
+ readonly external: ModelConfig["external"];
2989
+ }
2897
2990
  interface CorePluginConstructor {
2898
- new (getters: CoreGetters, stateObserver: StateObserver, range: RangeAdapter, dispatch: CoreCommandDispatcher["dispatch"], config: ModelConfig, uuidGenerator: UuidGenerator): CorePlugin;
2991
+ new (config: CorePluginConfig): CorePlugin;
2899
2992
  getters: readonly string[];
2900
2993
  }
2901
2994
  /**
@@ -2905,11 +2998,10 @@ interface CorePluginConstructor {
2905
2998
  * They should not be concerned about UI parts or transient state.
2906
2999
  */
2907
3000
  declare class CorePlugin<State = any, C = CoreCommand> extends BasePlugin<State, C> implements RangeProvider {
2908
- protected dispatch: CoreCommandDispatcher["dispatch"];
2909
3001
  protected getters: CoreGetters;
2910
3002
  protected range: RangeAdapter;
2911
3003
  protected uuidGenerator: UuidGenerator;
2912
- constructor(getters: CoreGetters, stateObserver: StateObserver, range: RangeAdapter, dispatch: CoreCommandDispatcher["dispatch"], config: ModelConfig, uuidGenerator: UuidGenerator);
3004
+ constructor({ getters, stateObserver, range, dispatch, uuidGenerator }: CorePluginConfig);
2913
3005
  import(data: WorkbookData): void;
2914
3006
  export(data: WorkbookData): void;
2915
3007
  /**
@@ -2923,6 +3015,11 @@ declare class CorePlugin<State = any, C = CoreCommand> extends BasePlugin<State,
2923
3015
  * @param sheetId an optional sheetId to adapt either range of that sheet specifically, or ranges pointing to that sheet
2924
3016
  */
2925
3017
  adaptRanges(applyChange: ApplyRangeChange, sheetId?: UID): void;
3018
+ /**
3019
+ * Implement this method to clean unused external resources, such as images
3020
+ * stored on a server which have been deleted.
3021
+ */
3022
+ garbageCollectExternalResources(): void;
2926
3023
  }
2927
3024
 
2928
3025
  interface BordersPluginState {
@@ -2948,7 +3045,7 @@ declare class BordersPlugin extends CorePlugin<BordersPluginState> implements Bo
2948
3045
  * Ensure borders continuity.
2949
3046
  */
2950
3047
  private handleAddRows;
2951
- getCellBorder(sheetId: UID, col: HeaderIndex, row: HeaderIndex): Border$1 | null;
3048
+ getCellBorder({ sheetId, col, row }: CellPosition): Border$1 | null;
2952
3049
  /**
2953
3050
  * Ensure border continuity between two columns.
2954
3051
  * If the two columns have the same borders (at each row respectively),
@@ -3041,6 +3138,7 @@ declare class BordersPlugin extends CorePlugin<BordersPluginState> implements Bo
3041
3138
 
3042
3139
  interface CoreState {
3043
3140
  cells: Record<UID, Record<UID, Cell | undefined>>;
3141
+ nextId: number;
3044
3142
  }
3045
3143
  /**
3046
3144
  * Core Plugin
@@ -3050,12 +3148,12 @@ interface CoreState {
3050
3148
  */
3051
3149
  declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3052
3150
  static getters: readonly ["zoneToXC", "getCells", "getFormulaCellContent", "getCellStyle", "buildFormulaContent", "getCellById"];
3151
+ readonly nextId = 1;
3053
3152
  readonly cells: {
3054
3153
  [sheetId: string]: {
3055
3154
  [id: string]: Cell;
3056
3155
  };
3057
3156
  };
3058
- private createCell;
3059
3157
  adaptRanges(applyChange: ApplyRangeChange, sheetId?: UID): void;
3060
3158
  allowDispatch(cmd: CoreCommand): CommandResult;
3061
3159
  handle(cmd: CoreCommand): void;
@@ -3085,9 +3183,9 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3085
3183
  * starting an async evaluation even if it has been moved or re-allocated
3086
3184
  */
3087
3185
  getCellById(cellId: UID): Cell | undefined;
3088
- buildFormulaContent(sheetId: UID, cell: FormulaCell, dependencies?: Range[]): string;
3186
+ buildFormulaContent(sheetId: UID, cell: Pick<FormulaCell, "dependencies" | "compiledFormula">, dependencies?: Range[]): string;
3089
3187
  getFormulaCellContent(sheetId: UID, cell: FormulaCell): string;
3090
- getCellStyle(cell?: Cell): Style;
3188
+ getCellStyle(position: CellPosition): Style;
3091
3189
  /**
3092
3190
  * Converts a zone to a XC coordinate system
3093
3191
  *
@@ -3118,7 +3216,17 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3118
3216
  * gets the currently used style/border of a cell based on it's coordinates
3119
3217
  */
3120
3218
  private getFormat;
3219
+ private getNextUid;
3121
3220
  private updateCell;
3221
+ private createCell;
3222
+ private createLiteralCell;
3223
+ private createFormulaCell;
3224
+ /**
3225
+ * Create a new formula cell with the content
3226
+ * being a computed property to rebuild the dependencies XC.
3227
+ */
3228
+ private createFormulaCellWithDependencies;
3229
+ private createErrorFormula;
3122
3230
  private checkCellOutOfSheet;
3123
3231
  }
3124
3232
 
@@ -3313,9 +3421,9 @@ declare class FiltersPlugin extends CorePlugin<FiltersState> implements FiltersS
3313
3421
  handle(cmd: CoreCommand): void;
3314
3422
  getFilters(sheetId: UID): Filter[];
3315
3423
  getFilterTables(sheetId: UID): FilterTable[];
3316
- getFilter(sheetId: UID, col: number, row: number): Filter | undefined;
3317
- getFilterId(sheetId: UID, col: number, row: number): FilterId | undefined;
3318
- getFilterTable(sheetId: UID, col: number, row: number): FilterTable | undefined;
3424
+ getFilter(position: CellPosition): Filter | undefined;
3425
+ getFilterId(position: CellPosition): FilterId | undefined;
3426
+ getFilterTable({ sheetId, col, row }: CellPosition): FilterTable | undefined;
3319
3427
  /** Get the filter tables that are fully inside the given zone */
3320
3428
  getFilterTablesInZone(sheetId: UID, zone: Zone): FilterTable[];
3321
3429
  doesZonesContainFilter(sheetId: UID, zones: Zone[]): boolean;
@@ -3395,6 +3503,31 @@ declare class HeaderVisibilityPlugin extends CorePlugin {
3395
3503
  exportData(data: WorkbookData, exportDefaults?: boolean): void;
3396
3504
  }
3397
3505
 
3506
+ interface ImageState {
3507
+ readonly images: Record<UID, Record<UID, Image | undefined> | undefined>;
3508
+ }
3509
+ declare class ImagePlugin extends CorePlugin<ImageState> implements ImageState {
3510
+ static getters: readonly ["getImage"];
3511
+ readonly fileStore?: FileStore;
3512
+ readonly images: Record<UID, Record<UID, Image | undefined> | undefined>;
3513
+ /**
3514
+ * paths of images synced with the file store server.
3515
+ */
3516
+ readonly syncedImages: Set<Image["path"]>;
3517
+ constructor(config: CorePluginConfig);
3518
+ allowDispatch(cmd: CoreCommand): CommandResult.Success | CommandResult.DuplicatedImageId;
3519
+ handle(cmd: CoreCommand): void;
3520
+ /**
3521
+ * Delete unused images from the file store
3522
+ */
3523
+ garbageCollectExternalResources(): void;
3524
+ getImage(sheetId: UID, figureId: UID): Image;
3525
+ private addFigure;
3526
+ import(data: WorkbookData): void;
3527
+ export(data: WorkbookData): void;
3528
+ private getAllImages;
3529
+ }
3530
+
3398
3531
  declare type SheetMergeCellMap = Record<number, Record<number, number | undefined> | undefined>;
3399
3532
  interface MergeState {
3400
3533
  readonly merges: Record<UID, Record<number, Range | undefined> | undefined>;
@@ -3409,7 +3542,7 @@ declare class MergePlugin extends CorePlugin<MergeState> implements MergeState {
3409
3542
  handle(cmd: CoreCommand): void;
3410
3543
  adaptRanges(applyChange: ApplyRangeChange, sheetId?: UID): void;
3411
3544
  getMerges(sheetId: UID): Merge[];
3412
- getMerge(sheetId: UID, col: HeaderIndex, row: HeaderIndex): Merge | undefined;
3545
+ getMerge({ sheetId, col, row }: CellPosition): Merge | undefined;
3413
3546
  getMergesInZone(sheetId: UID, zone: Zone): Merge[];
3414
3547
  /**
3415
3548
  * Return true if the zone intersects an existing merge:
@@ -3429,9 +3562,9 @@ declare class MergePlugin extends CorePlugin<MergeState> implements MergeState {
3429
3562
  */
3430
3563
  expandZone(sheetId: UID, zone: Zone): Zone;
3431
3564
  isInSameMerge(sheetId: UID, colA: HeaderIndex, rowA: HeaderIndex, colB: HeaderIndex, rowB: HeaderIndex): boolean;
3432
- isInMerge(sheetId: UID, col: HeaderIndex, row: HeaderIndex): boolean;
3433
- getMainCellPosition(sheetId: UID, col: HeaderIndex, row: HeaderIndex): Position$1;
3434
- getBottomLeftCell(sheetId: UID, col: HeaderIndex, row: HeaderIndex): Position$1;
3565
+ isInMerge({ sheetId, col, row }: CellPosition): boolean;
3566
+ getMainCellPosition(position: CellPosition): CellPosition;
3567
+ getBottomLeftCell(position: CellPosition): CellPosition;
3435
3568
  isMergeHidden(sheetId: UID, merge: Merge): boolean;
3436
3569
  /**
3437
3570
  * Check if the zone represents a single cell or a single merge.
@@ -3478,7 +3611,7 @@ interface SheetState {
3478
3611
  readonly cellPosition: Record<UID, CellPosition | undefined>;
3479
3612
  }
3480
3613
  declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
3481
- static getters: readonly ["getSheetName", "tryGetSheetName", "getSheet", "tryGetSheet", "getSheetIdByName", "getSheetIds", "getVisibleSheetIds", "isSheetVisible", "getEvaluationSheets", "doesHeaderExist", "getCell", "getCellsInZone", "getCellPosition", "getColCells", "getColsZone", "getRowCells", "getRowsZone", "getNumberCols", "getNumberRows", "getNumberHeaders", "getGridLinesVisibility", "getNextSheetName", "isEmpty", "getSheetSize", "getSheetZone", "getPaneDivisions"];
3614
+ static getters: readonly ["getSheetName", "tryGetSheetName", "getSheet", "tryGetSheet", "getSheetIdByName", "getSheetIds", "getVisibleSheetIds", "isSheetVisible", "getEvaluationSheets", "doesHeaderExist", "getCell", "getCellPosition", "getColsZone", "getRowCells", "getRowsZone", "getNumberCols", "getNumberRows", "getNumberHeaders", "getGridLinesVisibility", "getNextSheetName", "isEmpty", "getSheetSize", "getSheetZone", "getPaneDivisions"];
3482
3615
  readonly sheetIdsMapName: Record<string, UID | undefined>;
3483
3616
  readonly orderedSheetIds: UID[];
3484
3617
  readonly sheets: Record<UID, Sheet | undefined>;
@@ -3497,7 +3630,6 @@ declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
3497
3630
  * Return the sheet name. Throw if the sheet is not found.
3498
3631
  */
3499
3632
  getSheetName(sheetId: UID): string;
3500
- getCellsInZone(sheetId: UID, zone: Zone): (Cell | undefined)[];
3501
3633
  /**
3502
3634
  * Return the sheet name or undefined if the sheet doesn't exist.
3503
3635
  */
@@ -3508,11 +3640,7 @@ declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
3508
3640
  getEvaluationSheets(): Record<UID, Sheet | undefined>;
3509
3641
  doesHeaderExist(sheetId: UID, dimension: Dimension, index: number): boolean;
3510
3642
  getRow(sheetId: UID, index: HeaderIndex): Row;
3511
- getCell(sheetId: UID, col: HeaderIndex, row: HeaderIndex): Cell | undefined;
3512
- /**
3513
- * Returns all the cells of a col
3514
- */
3515
- getColCells(sheetId: UID, col: HeaderIndex): Cell[];
3643
+ getCell({ sheetId, col, row }: CellPosition): Cell | undefined;
3516
3644
  getColsZone(sheetId: UID, start: HeaderIndex, end: HeaderIndex): Zone;
3517
3645
  getRowCells(sheetId: UID, row: HeaderIndex): UID[];
3518
3646
  getRowsZone(sheetId: UID, start: HeaderIndex, end: HeaderIndex): Zone;
@@ -3627,819 +3755,726 @@ declare class SheetPlugin extends CorePlugin<SheetState> implements SheetState {
3627
3755
  }
3628
3756
 
3629
3757
  /**
3630
- * Autofill Plugin
3631
- *
3758
+ * CustomColors plugin
3759
+ * This plugins aims to compute and keep to custom colors used in the
3760
+ * current spreadsheet
3632
3761
  */
3633
- declare class AutofillPlugin extends UIPlugin {
3634
- static layers: LAYERS[];
3635
- static getters: readonly ["getAutofillTooltip"];
3636
- private autofillZone;
3637
- private steps;
3638
- private lastCellSelected;
3639
- private direction;
3640
- private tooltip;
3641
- allowDispatch(cmd: Command): CommandResult;
3762
+ declare class CustomColorsPlugin extends UIPlugin {
3763
+ private customColors;
3764
+ private shouldUpdateColors;
3765
+ static getters: readonly ["getCustomColors"];
3642
3766
  handle(cmd: Command): void;
3643
- getAutofillTooltip(): Tooltip | undefined;
3767
+ finalize(): void;
3768
+ getCustomColors(): Color[];
3769
+ private getColorsFromCells;
3770
+ private getFormattingColors;
3771
+ private getChartColors;
3772
+ private tryToAddColor;
3773
+ }
3774
+
3775
+ declare class EvaluationPlugin extends UIPlugin {
3776
+ static getters: readonly ["evaluateFormula", "getRangeFormattedValues", "getRangeValues", "getEvaluatedCell", "getEvaluatedCells", "getColEvaluatedCells", "getEvaluatedCellsInZone"];
3777
+ private isUpToDate;
3778
+ private evaluatedCells;
3779
+ private readonly evalContext;
3780
+ private readonly lazyEvaluation;
3781
+ constructor(config: UIPluginConfig);
3782
+ handle(cmd: Command): void;
3783
+ finalize(): void;
3784
+ evaluateFormula(formulaString: string, sheetId?: UID): any;
3644
3785
  /**
3645
- * Autofill the autofillZone from the current selection
3646
- * @param apply Flag set to true to apply the autofill in the model. It's
3647
- * useful to set it to false when we need to fill the tooltip
3786
+ * Return the value of each cell in the range as they are displayed in the grid.
3648
3787
  */
3649
- private autofill;
3788
+ getRangeFormattedValues(range: Range): FormattedValue[];
3650
3789
  /**
3651
- * Select a cell which becomes the last cell of the autofillZone
3790
+ * Return the value of each cell in the range.
3652
3791
  */
3653
- private select;
3792
+ getRangeValues(range: Range): CellValue[];
3793
+ getEvaluatedCell({ sheetId, col, row }: CellPosition): EvaluatedCell;
3794
+ getEvaluatedCells(sheetId: UID): Record<UID, EvaluatedCell>;
3654
3795
  /**
3655
- * Computes the autofillZone to autofill when the user double click on the
3656
- * autofiller
3796
+ * Returns all the evaluated cells of a col
3657
3797
  */
3658
- private autofillAuto;
3798
+ getColEvaluatedCells(sheetId: UID, col: HeaderIndex): EvaluatedCell[];
3799
+ getEvaluatedCellsInZone(sheetId: UID, zone: Zone): EvaluatedCell[];
3800
+ private setEvaluatedCell;
3801
+ private getAllCells;
3802
+ private evaluate;
3659
3803
  /**
3660
- * Generate the next cell
3804
+ * Return all functions necessary to properly evaluate a formula:
3805
+ * - a refFn function to read any reference, cell or range of a normalized formula
3806
+ * - a range function to convert any reference to a proper value array
3807
+ * - an evaluation context
3661
3808
  */
3662
- private computeNewCell;
3809
+ private getCompilationParameters;
3810
+ exportForExcel(data: ExcelWorkbookData): void;
3811
+ private isBadExpression;
3812
+ }
3813
+
3814
+ declare class EvaluationChartPlugin extends UIPlugin {
3815
+ static getters: readonly ["getChartRuntime", "getBackgroundOfSingleCellChart"];
3816
+ readonly charts: {
3817
+ [sheetId: UID]: Record<UID, ChartRuntime | undefined> | undefined;
3818
+ };
3819
+ private createRuntimeChart;
3820
+ handle(cmd: Command): void;
3821
+ getChartRuntime(sheetId: UID, figureId: UID): ChartRuntime;
3663
3822
  /**
3664
- * Get the rule associated to the current cell
3823
+ * Get the background color of a chart based on the color of the first cell of the main range
3824
+ * of the chart. In order of priority, it will return :
3825
+ *
3826
+ * - the chart background color if one is defined
3827
+ * - the fill color of the cell if one is defined
3828
+ * - the fill color of the cell from conditional formats if one is defined
3829
+ * - the default chart color if no other color is defined
3665
3830
  */
3666
- private getRule;
3831
+ getBackgroundOfSingleCellChart(chartBackground: Color | undefined, mainRange: Range | undefined): Color;
3832
+ }
3833
+
3834
+ declare class EvaluationConditionalFormatPlugin extends UIPlugin {
3835
+ static getters: readonly ["getConditionalIcon", "getCellComputedStyle"];
3836
+ private isStale;
3837
+ private computedStyles;
3838
+ private computedIcons;
3839
+ handle(cmd: Command): void;
3840
+ finalize(): void;
3841
+ getCellComputedStyle(position: CellPosition): Style;
3842
+ getConditionalIcon({ col, row }: Position$1): string | undefined;
3667
3843
  /**
3668
- * Create the generator to be able to autofill the next cells.
3844
+ * Compute the styles according to the conditional formatting.
3845
+ * This computation must happen after the cell values are computed if they change
3846
+ *
3847
+ * This result of the computation will be in the state.cell[XC].conditionalStyle and will be the union of all the style
3848
+ * properties of the rules applied (in order).
3849
+ * So if a cell has multiple conditional formatting applied to it, and each affect a different value of the style,
3850
+ * the resulting style will have the combination of all those values.
3851
+ * If multiple conditional formatting use the same style value, they will be applied in order so that the last applied wins
3669
3852
  */
3670
- private createGenerator;
3671
- private saveZone;
3853
+ private computeStyles;
3854
+ private parsePoint;
3855
+ private applyIcon;
3856
+ private computeIcon;
3857
+ private applyColorScale;
3858
+ private computeColorDiffUnits;
3859
+ private colorCell;
3672
3860
  /**
3673
- * Compute the direction of the autofill from the last selected zone and
3674
- * a given cell (col, row)
3861
+ * Execute the predicate to know if a conditional formatting rule should be applied to a cell
3675
3862
  */
3676
- private getDirection;
3677
- private autoFillMerge;
3678
- drawGrid(renderingContext: GridRenderingContext): void;
3863
+ private rulePredicate;
3864
+ /**
3865
+ * Add or remove cells to a given conditional formatting rule.
3866
+ */
3867
+ private adaptRules;
3868
+ private pasteCf;
3679
3869
  }
3680
3870
 
3681
- interface AutomaticSum {
3682
- position: Position$1;
3683
- zone: Zone;
3684
- }
3685
- declare class AutomaticSumPlugin extends UIPlugin {
3686
- static getters: readonly ["getAutomaticSums"];
3871
+ declare class FilterEvaluationPlugin extends UIPlugin {
3872
+ static getters: readonly ["getCellBorderWithFilterBorder", "getFilterHeaders", "getFilterValues", "isFilterHeader", "isRowFiltered", "isFilterActive"];
3873
+ private filterValues;
3874
+ hiddenRows: Set<number>;
3875
+ isEvaluationDirty: boolean;
3876
+ allowDispatch(cmd: Command): CommandResult.Success | CommandResult.FilterNotFound;
3687
3877
  handle(cmd: Command): void;
3688
- getAutomaticSums(sheetId: UID, zone: Zone, anchor: Position$1): AutomaticSum[];
3689
- private sumData;
3690
- private sumAdjacentData;
3878
+ finalize(): void;
3879
+ isRowFiltered(sheetId: UID, row: number): boolean;
3880
+ getCellBorderWithFilterBorder(position: CellPosition): Border$1 | null;
3881
+ getFilterHeaders(sheetId: UID): Position$1[];
3882
+ getFilterValues(position: CellPosition): string[];
3883
+ isFilterHeader({ sheetId, col, row }: CellPosition): boolean;
3884
+ isFilterActive(position: CellPosition): boolean;
3885
+ private intersectZoneWithViewport;
3886
+ private updateFilter;
3887
+ private updateHiddenRows;
3888
+ private getCellValueAsString;
3889
+ exportForExcel(data: ExcelWorkbookData): void;
3691
3890
  /**
3692
- * Find a zone to automatically sum a column or row of numbers.
3693
- *
3694
- * We first decide which direction will be summed (column or row).
3695
- * Here is the strategy:
3696
- * 1. If the left cell is a number and the top cell is not: choose horizontal
3697
- * 2. Try to find a valid vertical zone. If it's valid: choose vertical
3698
- * 3. Try to find a valid horizontal zone. If it's valid: choose horizontal
3699
- * 4. Otherwise, no zone is returned
3700
- *
3701
- * Now, how to find a valid zone?
3702
- * The zone starts directly above or on the left of the starting point
3703
- * (depending on the direction).
3704
- * The zone ends where the first continuous sequence of numbers ends.
3705
- * Empty or text cells can be part of the zone while no number has been found.
3706
- * Other kind of cells (boolean, dates, etc.) are not valid in the zone and the
3707
- * search stops immediately if one is found.
3708
- *
3709
- * ------- -------
3710
- * | 1 | | 1 |
3711
- * ------- -------
3712
- * | | | |
3713
- * ------- <= end of the sequence, stop here -------
3714
- * | 2 | | 2 |
3715
- * ------- -------
3716
- * | 3 | <= start of the number sequence | 3 |
3717
- * ------- -------
3718
- * | | <= ignored | FALSE | <= invalid, no zone is found
3719
- * ------- -------
3720
- * | A | <= ignored | A | <= ignored
3721
- * ------- -------
3722
- */
3723
- private findAdjacentData;
3724
- /**
3725
- * Return the zone to sum if a valid one is found.
3726
- * @see getAutomaticSumZone
3727
- */
3728
- private findSuitableZoneToSum;
3729
- private findVerticalZone;
3730
- private findHorizontalZone;
3731
- /**
3732
- * Reduces a column or row zone to a valid zone for the automatic sum.
3733
- * @see getAutomaticSumZone
3734
- * @param sheet
3735
- * @param zone one dimensional zone (a single row or a single column). The zone is
3736
- * assumed to start at the beginning of the column (top=0) or the row (left=0)
3737
- * @param end end index of the zone (`bottom` or `right` depending on the dimension)
3738
- * @returns the starting position of the valid zone or Infinity if the zone is not valid.
3891
+ * Get an unique column name for the column at colIndex. If the column name is already in the array of used column names,
3892
+ * concatenate a number to the name until we find a new unique name (eg. "ColName" => "ColName1" => "ColName2" ...)
3739
3893
  */
3740
- private reduceZoneStart;
3741
- private shouldFindData;
3742
- private isNumber;
3743
- private isZoneValid;
3744
- private lastColIsEmpty;
3745
- private lastRowIsEmpty;
3894
+ private getUniqueColNameForExcel;
3895
+ }
3896
+
3897
+ declare class InternalViewport {
3898
+ private getters;
3899
+ private sheetId;
3900
+ private boundaries;
3901
+ top: HeaderIndex;
3902
+ bottom: HeaderIndex;
3903
+ left: HeaderIndex;
3904
+ right: HeaderIndex;
3905
+ offsetX: Pixel;
3906
+ offsetY: Pixel;
3907
+ offsetScrollbarX: Pixel;
3908
+ offsetScrollbarY: Pixel;
3909
+ canScrollVertically: boolean;
3910
+ canScrollHorizontally: boolean;
3911
+ width: Pixel;
3912
+ height: Pixel;
3913
+ offsetCorrectionX: Pixel;
3914
+ offsetCorrectionY: Pixel;
3915
+ constructor(getters: Getters, sheetId: UID, boundaries: Zone, sizeInGrid: {
3916
+ width: Pixel;
3917
+ height: Pixel;
3918
+ }, options: {
3919
+ canScrollVertically: boolean;
3920
+ canScrollHorizontally: boolean;
3921
+ }, offsets: {
3922
+ x: Pixel;
3923
+ y: Pixel;
3924
+ });
3925
+ getMaxSize(): ZoneDimension;
3746
3926
  /**
3747
- * Decides which dimensions (columns or rows) should be summed
3748
- * based on its shape and what's inside the zone.
3927
+ * Return the index of a column given an offset x, based on the pane left
3928
+ * visible cell.
3929
+ * It returns -1 if no column is found.
3749
3930
  */
3750
- private dimensionsToSum;
3931
+ getColIndex(x: Pixel, absolute?: boolean): HeaderIndex;
3751
3932
  /**
3752
- * Sum each column and/or row in the zone in the appropriate cells,
3753
- * depending on the available space.
3933
+ * Return the index of a row given an offset y, based on the pane top
3934
+ * visible cell.
3935
+ * It returns -1 if no row is found.
3754
3936
  */
3755
- private sumDimensions;
3937
+ getRowIndex(y: Pixel, absolute?: boolean): HeaderIndex;
3756
3938
  /**
3757
- * Sum the total of the zone in the bottom right cell, assuming
3758
- * the last row contains summed columns.
3939
+ * This function will make sure that the provided cell position (or current selected position) is part of
3940
+ * the pane that is actually displayed on the client. We therefore adjust the offset of the pane
3941
+ * until it contains the cell completely.
3759
3942
  */
3760
- private sumTotal;
3761
- private sumColumns;
3762
- private sumRows;
3763
- private dispatchCellUpdates;
3943
+ adjustPosition(position?: Position$1): void;
3944
+ adjustPositionX(col: HeaderIndex): void;
3945
+ adjustPositionY(row: HeaderIndex): void;
3946
+ setViewportOffset(offsetX: Pixel, offsetY: Pixel): void;
3947
+ adjustViewportZone(): void;
3764
3948
  /**
3765
- * Find the first row where all cells below the zone are empty.
3949
+ *
3950
+ * @param zone
3951
+ * @returns Computes the absolute coordinate of a given zone inside the viewport
3766
3952
  */
3767
- private nextEmptyRow;
3768
- /**
3769
- * Find the first column where all cells right of the zone are empty.
3953
+ getRect(zone: Zone): Rect | undefined;
3954
+ isVisible(col: HeaderIndex, row: HeaderIndex): boolean;
3955
+ private searchHeaderIndex;
3956
+ private get zone();
3957
+ private setViewportOffsetX;
3958
+ private setViewportOffsetY;
3959
+ /** Corrects the viewport's horizontal offset based on the current structure
3960
+ * To make sure that at least on column is visible inside the viewport.
3770
3961
  */
3771
- private nextEmptyCol;
3772
- /**
3773
- * Transpose the given dimensions.
3774
- * COL becomes ROW
3775
- * ROW becomes COL
3962
+ private adjustViewportOffsetX;
3963
+ /** Corrects the viewport's vertical offset based on the current structure
3964
+ * To make sure that at least on row is visible inside the viewport.
3776
3965
  */
3777
- private transpose;
3966
+ private adjustViewportOffsetY;
3967
+ /** Updates the pane zone and snapped offset based on its horizontal
3968
+ * offset (will find Left) and its width (will find Right) */
3969
+ private adjustViewportZoneX;
3970
+ /** Updates the pane zone and snapped offset based on its vertical
3971
+ * offset (will find Top) and its width (will find Bottom) */
3972
+ private adjustViewportZoneY;
3778
3973
  }
3779
3974
 
3975
+ declare type SheetViewports = {
3976
+ topLeft: InternalViewport | undefined;
3977
+ bottomLeft: InternalViewport | undefined;
3978
+ topRight: InternalViewport | undefined;
3979
+ bottomRight: InternalViewport;
3980
+ };
3780
3981
  /**
3781
- * Plugin managing the display of components next to cells.
3982
+ * EdgeScrollCases Schema
3983
+ *
3984
+ * The dots/double dots represent a freeze (= a split of viewports)
3985
+ * In this example, we froze vertically between columns D and E
3986
+ * and horizontally between rows 4 and 5.
3987
+ *
3988
+ * One can see that we scrolled horizontally from column E to G and
3989
+ * vertically from row 5 to 7.
3990
+ *
3991
+ * A B C D G H I J K L M N O P Q R S T
3992
+ * _______________________________________________________
3993
+ * 1 | : |
3994
+ * 2 | : |
3995
+ * 3 | : B ↑ 6 |
3996
+ * 4 | : | | | |
3997
+ * ····················+···+·················+············|
3998
+ * 7 | : | | | |
3999
+ * 8 | : ↓ 2 | |
4000
+ * 9 | : | |
4001
+ * 10 | A --+--→ | |
4002
+ * 11 | : | |
4003
+ * 12 | : | |
4004
+ * 13 | ←--+-- 1 | |
4005
+ * 14 | : | 3 --+--→
4006
+ * 15 | : | |
4007
+ * 16 | : | |
4008
+ * 17 | 5 --+-------------------------------------------+--→
4009
+ * 18 | : | |
4010
+ * 19 | : 4 | |
4011
+ * 20 | : | | |
4012
+ * ______________________________+___________| ____________
4013
+ * | |
4014
+ * ↓ ↓
3782
4015
  */
3783
- declare class CellPopoverPlugin extends UIPlugin {
3784
- static getters: readonly ["getCellPopover", "getPersistentPopoverTypeAtPosition"];
3785
- static modes: Mode[];
3786
- private persistentPopover?;
3787
- allowDispatch(cmd: Command): CommandResult.Success | CommandResult.InvalidCellPopover;
3788
- handle(cmd: Command): void;
3789
- getCellPopover({ col, row }: Partial<Position$1>): ClosedCellPopover | PositionedCellPopover;
3790
- getPersistentPopoverTypeAtPosition({ col, row }: Position$1): CellPopoverType | undefined;
3791
- private computePopoverProps;
3792
- private computePopoverPosition;
3793
- }
3794
-
3795
4016
  /**
3796
- * Clipboard Plugin
4017
+ * Viewport plugin.
4018
+ *
4019
+ * This plugin manages all things related to all viewport states.
3797
4020
  *
3798
- * This clipboard manages all cut/copy/paste interactions internal to the
3799
- * application, and with the OS clipboard as well.
3800
4021
  */
3801
- declare class ClipboardPlugin extends UIPlugin {
3802
- static layers: LAYERS[];
3803
- static getters: readonly ["getClipboardContent", "isCutOperation", "isPaintingFormat"];
3804
- private status;
3805
- private state?;
3806
- private _isPaintingFormat;
3807
- allowDispatch(cmd: Command): CommandResult;
4022
+ declare class SheetViewPlugin extends UIPlugin {
4023
+ static getters: readonly ["getColIndex", "getRowIndex", "getActiveMainViewport", "getSheetViewDimension", "getSheetViewDimensionWithHeaders", "getMainViewportRect", "isVisibleInViewport", "getEdgeScrollCol", "getEdgeScrollRow", "getVisibleFigures", "getVisibleRect", "getColRowOffsetInViewport", "getMainViewportCoordinates", "getActiveSheetScrollInfo", "getActiveSheetDOMScrollInfo", "getSheetViewVisibleCols", "getSheetViewVisibleRows", "getFrozenSheetViewRatio"];
4024
+ readonly viewports: Record<UID, SheetViewports | undefined>;
4025
+ /**
4026
+ * The viewport dimensions are usually set by one of the components
4027
+ * (i.e. when grid component is mounted) to properly reflect its state in the DOM.
4028
+ * In the absence of a component (standalone model), is it mandatory to set reasonable default values
4029
+ * to ensure the correct operation of this plugin.
4030
+ */
4031
+ private sheetViewWidth;
4032
+ private sheetViewHeight;
4033
+ private gridOffsetX;
4034
+ private gridOffsetY;
4035
+ private sheetsWithDirtyViewports;
4036
+ allowDispatch(cmd: Command): CommandResult | CommandResult[];
4037
+ private handleEvent;
3808
4038
  handle(cmd: Command): void;
4039
+ finalize(): void;
4040
+ private setViewports;
3809
4041
  /**
3810
- * Format the current clipboard to a string suitable for being pasted in other
3811
- * programs.
3812
- *
3813
- * - add a tab character between each consecutive cells
3814
- * - add a newline character between each line
3815
- *
3816
- * Note that it returns \t if the clipboard is empty. This is necessary for the
3817
- * clipboard copy event to add it as data, otherwise an empty string is not
3818
- * considered as a copy content.
4042
+ * Return the index of a column given an offset x, based on the viewport left
4043
+ * visible cell.
4044
+ * It returns -1 if no column is found.
3819
4045
  */
3820
- getClipboardContent(): string;
3821
- isCutOperation(): boolean;
3822
- isPaintingFormat(): boolean;
3823
- private getDeleteCellsTargets;
3824
- private getInsertCellsTargets;
3825
- private getClipboardStateForCopyCells;
4046
+ getColIndex(x: Pixel): HeaderIndex;
3826
4047
  /**
3827
- * Get the clipboard state from the given zones.
4048
+ * Return the index of a row given an offset y, based on the viewport top
4049
+ * visible cell.
4050
+ * It returns -1 if no row is found.
3828
4051
  */
3829
- private getClipboardState;
3830
- drawGrid(renderingContext: GridRenderingContext): void;
3831
- }
3832
-
3833
- /**
3834
- * CustomColors plugin
3835
- * This plugins aims to compute and keep to custom colors used in the
3836
- * current spreadsheet
3837
- */
3838
- declare class CustomColorsPlugin extends UIPlugin {
3839
- private customColors;
3840
- private shouldUpdateColors;
3841
- static getters: readonly ["getCustomColors"];
3842
- handle(cmd: Command): void;
3843
- finalize(): void;
3844
- getCustomColors(): Color[];
3845
- private getColorsFromCells;
3846
- private getFormattingColors;
3847
- private getChartColors;
3848
- private tryToAddColor;
3849
- }
3850
-
3851
- declare class EvaluationPlugin extends UIPlugin {
3852
- static getters: readonly ["evaluateFormula", "getRangeFormattedValues", "getRangeValues"];
3853
- private isUpToDate;
3854
- private readonly evalContext;
3855
- constructor(getters: Getters, state: StateObserver, dispatch: CommandDispatcher["dispatch"], config: ModelConfig, selection: SelectionStreamProcessor);
3856
- handle(cmd: Command): void;
3857
- finalize(): void;
3858
- evaluateFormula(formulaString: string, sheetId?: UID): any;
4052
+ getRowIndex(y: Pixel): HeaderIndex;
4053
+ getSheetViewDimensionWithHeaders(): ZoneDimension;
4054
+ getSheetViewDimension(): ZoneDimension;
4055
+ /** type as pane, not viewport but basically pane extends viewport */
4056
+ getActiveMainViewport(): Viewport;
3859
4057
  /**
3860
- * Return the value of each cell in the range as they are displayed in the grid.
4058
+ * Return the scroll info of the active sheet, ie. the offset between the viewport left/top side and
4059
+ * the grid left/top side, snapped to the columns/rows.
3861
4060
  */
3862
- getRangeFormattedValues(range: Range): FormattedValue[];
4061
+ getActiveSheetScrollInfo(): SheetScrollInfo;
3863
4062
  /**
3864
- * Return the value of each cell in the range.
4063
+ * Return the DOM scroll info of the active sheet, ie. the offset between the viewport left/top side and
4064
+ * the grid left/top side, corresponding to the scroll of the scrollbars and not snapped to the grid.
3865
4065
  */
3866
- getRangeValues(range: Range): (CellValue | undefined)[];
3867
- private getAllCells;
3868
- private evaluate;
4066
+ getActiveSheetDOMScrollInfo(): SheetDOMScrollInfo;
4067
+ getSheetViewVisibleCols(): HeaderIndex[];
4068
+ getSheetViewVisibleRows(): HeaderIndex[];
3869
4069
  /**
3870
- * Return all functions necessary to properly evaluate a formula:
3871
- * - a refFn function to read any reference, cell or range of a normalized formula
3872
- * - a range function to convert any reference to a proper value array
3873
- * - an evaluation context
4070
+ * Return the main viewport maximum size. That is the zone dimension
4071
+ * with some bottom and right padding.
3874
4072
  */
3875
- private getCompilationParameters;
3876
- }
3877
-
3878
- declare class EvaluationChartPlugin extends UIPlugin {
3879
- static getters: readonly ["getChartRuntime", "getBackgroundOfSingleCellChart"];
3880
- readonly charts: {
3881
- [sheetId: UID]: Record<UID, ChartRuntime | undefined> | undefined;
3882
- };
3883
- private createRuntimeChart;
3884
- handle(cmd: Command): void;
3885
- getChartRuntime(sheetId: UID, figureId: UID): ChartRuntime;
4073
+ getMainViewportRect(): Rect;
4074
+ private getMaximumSheetOffset;
4075
+ getColRowOffsetInViewport(dimension: Dimension, referenceIndex: HeaderIndex, index: HeaderIndex): Pixel;
3886
4076
  /**
3887
- * Get the background color of a chart based on the color of the first cell of the main range
3888
- * of the chart. In order of priority, it will return :
3889
- *
3890
- * - the chart background color if one is defined
3891
- * - the fill color of the cell if one is defined
3892
- * - the fill color of the cell from conditional formats if one is defined
3893
- * - the default chart color if no other color is defined
4077
+ * Check if a given position is visible in the viewport.
3894
4078
  */
3895
- getBackgroundOfSingleCellChart(chartBackground: Color | undefined, mainRange: Range | undefined): Color;
3896
- }
3897
-
3898
- declare class EvaluationConditionalFormatPlugin extends UIPlugin {
3899
- static getters: readonly ["getConditionalIcon", "getCellComputedStyle"];
3900
- private isStale;
3901
- private computedStyles;
3902
- private computedIcons;
3903
- handle(cmd: Command): void;
3904
- finalize(): void;
3905
- getCellComputedStyle(sheetId: UID, col: HeaderIndex, row: HeaderIndex): Style;
3906
- getConditionalIcon(col: HeaderIndex, row: HeaderIndex): string | undefined;
4079
+ isVisibleInViewport({ sheetId, col, row }: CellPosition): boolean;
4080
+ getEdgeScrollCol(x: number, previousX: number, startingX: number): EdgeScrollInfo;
4081
+ getEdgeScrollRow(y: number, previousY: number, tartingY: number): EdgeScrollInfo;
3907
4082
  /**
3908
- * Compute the styles according to the conditional formatting.
3909
- * This computation must happen after the cell values are computed if they change
3910
- *
3911
- * This result of the computation will be in the state.cell[XC].conditionalStyle and will be the union of all the style
3912
- * properties of the rules applied (in order).
3913
- * So if a cell has multiple conditional formatting applied to it, and each affect a different value of the style,
3914
- * the resulting style will have the combination of all those values.
3915
- * If multiple conditional formatting use the same style value, they will be applied in order so that the last applied wins
4083
+ * Computes the coordinates and size to draw the zone on the canvas
3916
4084
  */
3917
- private computeStyles;
3918
- private parsePoint;
3919
- private applyIcon;
3920
- private computeIcon;
3921
- private applyColorScale;
3922
- private computeColorDiffUnits;
3923
- private colorCell;
4085
+ getVisibleRect(zone: Zone): Rect;
4086
+ /**
4087
+ * Returns the position of the MainViewport relatively to the start of the grid (without headers)
4088
+ * It corresponds to the summed dimensions of the visible cols/rows (in x/y respectively)
4089
+ * situated before the pane divisions.
4090
+ */
4091
+ getMainViewportCoordinates(): DOMCoordinates;
4092
+ private ensureMainViewportExist;
4093
+ private getSubViewports;
4094
+ private checkPositiveDimension;
4095
+ private checkValuesAreDifferent;
4096
+ private checkScrollingDirection;
4097
+ private getMainViewport;
4098
+ private getMainInternalViewport;
4099
+ /** gets rid of deprecated sheetIds */
4100
+ private cleanViewports;
4101
+ private resetSheetViews;
4102
+ private resizeSheetView;
4103
+ private recomputeViewports;
4104
+ private setSheetViewOffset;
3924
4105
  /**
3925
- * Execute the predicate to know if a conditional formatting rule should be applied to a cell
4106
+ * Clip the vertical offset within the allowed range.
4107
+ * Not above the sheet, nor below the sheet.
3926
4108
  */
3927
- private rulePredicate;
4109
+ private clipOffsetY;
4110
+ private getViewportOffset;
4111
+ private resetViewports;
3928
4112
  /**
3929
- * Add or remove cells to a given conditional formatting rule.
4113
+ * Adjust the viewport such that the anchor position is visible
3930
4114
  */
3931
- private adaptRules;
3932
- private pasteCf;
3933
- private isCellValueNumber;
3934
- }
3935
-
3936
- declare class FilterEvaluationPlugin extends UIPlugin {
3937
- static getters: readonly ["getCellBorderWithFilterBorder", "getFilterHeaders", "getFilterValues", "isFilterHeader", "isRowFiltered", "isFilterActive"];
3938
- private filterValues;
3939
- hiddenRows: Set<number>;
3940
- isEvaluationDirty: boolean;
3941
- allowDispatch(cmd: Command): CommandResult.Success | CommandResult.FilterNotFound;
3942
- handle(cmd: Command): void;
3943
- finalize(): void;
3944
- isRowFiltered(sheetId: UID, row: number): boolean;
3945
- getCellBorderWithFilterBorder(sheetId: UID, col: number, row: number): Border$1 | null;
3946
- getFilterHeaders(sheetId: UID): Position$1[];
3947
- getFilterValues(sheetId: UID, col: number, row: number): string[];
3948
- isFilterHeader(sheetId: UID, col: number, row: number): boolean;
3949
- isFilterActive(sheetId: UID, col: number, row: number): boolean;
3950
- private intersectZoneWithViewport;
3951
- private updateFilter;
3952
- private updateHiddenRows;
3953
- private getCellValueAsString;
3954
- exportForExcel(data: ExcelWorkbookData): void;
4115
+ private refreshViewport;
3955
4116
  /**
3956
- * Get an unique column name for the column at colIndex. If the column name is already in the array of used column names,
3957
- * concatenate a number to the name until we find a new unique name (eg. "ColName" => "ColName1" => "ColName2" ...)
4117
+ * Shift the viewport vertically and move the selection anchor
4118
+ * such that it remains at the same place relative to the
4119
+ * viewport top.
3958
4120
  */
3959
- private getUniqueColNameForExcel;
3960
- }
3961
-
3962
- declare class HeaderVisibilityUIPlugin extends UIPlugin {
3963
- static getters: readonly ["getNextVisibleCellPosition", "findVisibleHeader", "findLastVisibleColRowIndex", "findFirstVisibleColRowIndex", "isRowHidden", "isColHidden", "isHeaderHidden"];
3964
- isRowHidden(sheetId: UID, index: number): boolean;
3965
- isColHidden(sheetId: UID, index: number): boolean;
3966
- isHeaderHidden(sheetId: UID, dimension: Dimension, index: number): boolean;
3967
- getNextVisibleCellPosition(sheetId: UID, col: number, row: number): Position$1;
3968
- findVisibleHeader(sheetId: UID, dimension: Dimension, indexes: number[]): number | undefined;
3969
- findLastVisibleColRowIndex(sheetId: UID, dimension: Dimension, indexes: {
3970
- first: number;
3971
- last: number;
3972
- }): HeaderIndex;
3973
- findFirstVisibleColRowIndex(sheetId: UID, dimension: Dimension): number | undefined;
3974
- exportForExcel(data: ExcelWorkbookData): void;
4121
+ private shiftVertically;
4122
+ getVisibleFigures(): Figure[];
4123
+ getFrozenSheetViewRatio(sheetId: UID): {
4124
+ xRatio: number;
4125
+ yRatio: number;
4126
+ };
3975
4127
  }
3976
4128
 
3977
4129
  /**
3978
- * HighlightPlugin
4130
+ * Autofill Plugin
4131
+ *
3979
4132
  */
3980
- declare class HighlightPlugin extends UIPlugin {
3981
- static layers: LAYERS[];
3982
- static getters: readonly ["getHighlights"];
3983
- getHighlights(): Highlight$1[];
3984
- private prepareHighlights;
3985
- drawGrid(renderingContext: GridRenderingContext): void;
3986
- }
3987
-
3988
- declare class RendererPlugin extends UIPlugin {
4133
+ declare class AutofillPlugin extends UIPlugin {
3989
4134
  static layers: LAYERS[];
3990
- static getters: readonly ["getColDimensionsInViewport", "getRowDimensionsInViewport"];
3991
- private boxes;
4135
+ static getters: readonly ["getAutofillTooltip"];
4136
+ private autofillZone;
4137
+ private steps;
4138
+ private lastCellSelected;
4139
+ private direction;
4140
+ private tooltip;
4141
+ allowDispatch(cmd: Command): CommandResult;
4142
+ handle(cmd: Command): void;
4143
+ getAutofillTooltip(): Tooltip | undefined;
3992
4144
  /**
3993
- * Returns the size, start and end coordinates of a column relative to the left
3994
- * column of the current viewport
4145
+ * Autofill the autofillZone from the current selection
4146
+ * @param apply Flag set to true to apply the autofill in the model. It's
4147
+ * useful to set it to false when we need to fill the tooltip
3995
4148
  */
3996
- getColDimensionsInViewport(sheetId: UID, col: HeaderIndex): HeaderDimensions;
4149
+ private autofill;
3997
4150
  /**
3998
- * Returns the size, start and end coordinates of a row relative to the top row
3999
- * of the current viewport
4151
+ * Select a cell which becomes the last cell of the autofillZone
4000
4152
  */
4001
- getRowDimensionsInViewport(sheetId: UID, row: HeaderIndex): HeaderDimensions;
4153
+ private select;
4002
4154
  /**
4003
- * Get the offset of a header (see getColRowOffsetInViewport), adjusted with the header
4004
- * size (HEADER_HEIGHT and HEADER_WIDTH)
4155
+ * Computes the autofillZone to autofill when the user double click on the
4156
+ * autofiller
4005
4157
  */
4006
- private getHeaderOffset;
4007
- drawGrid(renderingContext: GridRenderingContext, layer: LAYERS): void;
4008
- private drawBackground;
4009
- private drawCellBackground;
4010
- private drawBorders;
4011
- private drawTexts;
4012
- private drawIcon;
4013
- private drawHeaders;
4014
- private drawFrozenPanesHeaders;
4015
- private drawFrozenPanes;
4016
- private hasContent;
4017
- private findNextEmptyCol;
4018
- private findPreviousEmptyCol;
4019
- private computeCellAlignment;
4020
- private createZoneBox;
4021
- private getGridBoxes;
4022
- }
4023
-
4024
- /**
4025
- * SelectionPlugin
4026
- */
4027
- declare class GridSelectionPlugin extends UIPlugin {
4028
- static layers: LAYERS[];
4029
- static getters: readonly ["getActiveSheet", "getActiveSheetId", "getActiveCell", "getActiveCols", "getActiveRows", "getCurrentStyle", "getSelectedZones", "getSelectedZone", "getStatisticFnResults", "getAggregate", "getSelectedFigureId", "getSelection", "getPosition", "getSheetPosition", "isSelected", "getElementsFromSelection"];
4030
- private gridSelection;
4031
- private selectedFigureId;
4032
- private sheetsData;
4033
- private moveClient;
4034
- activeSheet: Sheet;
4035
- constructor(getters: Getters, state: StateObserver, dispatch: CommandDispatcher["dispatch"], config: ModelConfig, selection: SelectionStreamProcessor);
4036
- allowDispatch(cmd: Command): CommandResult;
4037
- private handleEvent;
4038
- handle(cmd: Command): void;
4039
- getActiveSheet(): Readonly<Sheet>;
4040
- getActiveSheetId(): UID;
4041
- getActiveCell(): Cell | undefined;
4042
- getActiveCols(): Set<number>;
4043
- getActiveRows(): Set<number>;
4044
- getCurrentStyle(): Style;
4045
- getSelectedZones(): Zone[];
4046
- getSelectedZone(): Zone;
4047
- getSelection(): Selection;
4048
- getSelectedFigureId(): UID | null;
4049
- getPosition(): Position$1;
4050
- getSheetPosition(sheetId: UID): Position$1;
4051
- getStatisticFnResults(): {
4052
- [name: string]: number | undefined;
4053
- };
4054
- getAggregate(): string | null;
4055
- isSelected(zone: Zone): boolean;
4158
+ private autofillAuto;
4056
4159
  /**
4057
- * Returns a sorted array of indexes of all columns (respectively rows depending
4058
- * on the dimension parameter) intersected by the currently selected zones.
4059
- *
4060
- * example:
4061
- * assume selectedZones: [{left:0, right: 2, top :2, bottom: 4}, {left:5, right: 6, top :3, bottom: 5}]
4062
- *
4063
- * if dimension === "COL" => [0,1,2,5,6]
4064
- * if dimension === "ROW" => [2,3,4,5]
4160
+ * Generate the next cell
4065
4161
  */
4066
- getElementsFromSelection(dimension: Dimension): number[];
4162
+ private computeNewCell;
4067
4163
  /**
4068
- * Ensure selections are not outside sheet boundaries.
4069
- * They are clipped to fit inside the sheet if needed.
4164
+ * Get the rule associated to the current cell
4070
4165
  */
4071
- private setSelectionMixin;
4166
+ private getRule;
4072
4167
  /**
4073
- * Change the anchor of the selection active cell to an absolute col and row index.
4074
- *
4075
- * This is a non trivial task. We need to stop the editing process and update
4076
- * properly the current selection. Also, this method can optionally create a new
4077
- * range in the selection.
4168
+ * Create the generator to be able to autofill the next cells.
4078
4169
  */
4079
- private selectCell;
4080
- private setActiveSheet;
4081
- private activateNextSheet;
4082
- private onColumnsRemoved;
4083
- private onRowsRemoved;
4084
- private onAddElements;
4085
- private onMoveElements;
4086
- private isMoveElementAllowed;
4170
+ private createGenerator;
4171
+ private saveZone;
4087
4172
  /**
4088
- * Clip the selection if it spans outside the sheet
4173
+ * Compute the direction of the autofill from the last selected zone and
4174
+ * a given cell (col, row)
4089
4175
  */
4090
- private clipSelection;
4176
+ private getDirection;
4177
+ private autoFillMerge;
4091
4178
  drawGrid(renderingContext: GridRenderingContext): void;
4092
4179
  }
4093
4180
 
4094
- interface RangeInputValue {
4095
- id: UID;
4096
- xc: string;
4097
- color: string;
4181
+ interface AutomaticSum {
4182
+ position: Position$1;
4183
+ zone: Zone;
4098
4184
  }
4099
- /**
4100
- * Selection input Plugin
4101
- *
4102
- * The SelectionInput component input and output are both arrays of strings, but
4103
- * it requires an intermediary internal state to work.
4104
- * This plugin handles this internal state.
4105
- */
4106
- declare class SelectionInputPlugin extends UIPlugin implements StreamCallbacks<SelectionEvent> {
4107
- private readonly inputHasSingleRange;
4108
- static layers: LAYERS[];
4109
- static getters: never[];
4110
- ranges: RangeInputValue[];
4111
- focusedRangeIndex: number | null;
4112
- private activeSheet;
4113
- private willAddNewRange;
4114
- constructor(getters: Getters, state: StateObserver, dispatch: CommandDispatcher["dispatch"], config: ModelConfig, selection: SelectionStreamProcessor, initialRanges: string[], inputHasSingleRange: boolean);
4115
- allowDispatch(cmd: Command): CommandResult;
4116
- handleEvent(event: SelectionEvent): void;
4185
+ declare class AutomaticSumPlugin extends UIPlugin {
4186
+ static getters: readonly ["getAutomaticSums"];
4117
4187
  handle(cmd: Command): void;
4118
- unsubscribe(): void;
4119
- getSelectionInputValue(): string[];
4120
- getSelectionInputHighlights(): Highlight$1[];
4121
- /**
4122
- * Focus a given range or remove the focus.
4123
- */
4124
- private focus;
4125
- private focusLast;
4126
- private unfocus;
4127
- private add;
4128
- private setContent;
4129
- /**
4130
- * Insert new inputs after the given index.
4131
- */
4132
- private insertNewRange;
4133
- /**
4134
- * Set a new value in a given range input. If more than one value is provided,
4135
- * new inputs will be added.
4136
- */
4137
- private setRange;
4138
- private removeRange;
4188
+ getAutomaticSums(sheetId: UID, zone: Zone, anchor: Position$1): AutomaticSum[];
4189
+ private sumData;
4190
+ private sumAdjacentData;
4139
4191
  /**
4140
- * Convert highlights input format to the command format.
4141
- * The first xc in the input range will keep its color.
4142
- * Invalid ranges and ranges from other sheets than the active sheets
4143
- * are ignored.
4192
+ * Find a zone to automatically sum a column or row of numbers.
4193
+ *
4194
+ * We first decide which direction will be summed (column or row).
4195
+ * Here is the strategy:
4196
+ * 1. If the left cell is a number and the top cell is not: choose horizontal
4197
+ * 2. Try to find a valid vertical zone. If it's valid: choose vertical
4198
+ * 3. Try to find a valid horizontal zone. If it's valid: choose horizontal
4199
+ * 4. Otherwise, no zone is returned
4200
+ *
4201
+ * Now, how to find a valid zone?
4202
+ * The zone starts directly above or on the left of the starting point
4203
+ * (depending on the direction).
4204
+ * The zone ends where the first continuous sequence of numbers ends.
4205
+ * Empty or text cells can be part of the zone while no number has been found.
4206
+ * Other kind of cells (boolean, dates, etc.) are not valid in the zone and the
4207
+ * search stops immediately if one is found.
4208
+ *
4209
+ * ------- -------
4210
+ * | 1 | | 1 |
4211
+ * ------- -------
4212
+ * | | | |
4213
+ * ------- <= end of the sequence, stop here -------
4214
+ * | 2 | | 2 |
4215
+ * ------- -------
4216
+ * | 3 | <= start of the number sequence | 3 |
4217
+ * ------- -------
4218
+ * | | <= ignored | FALSE | <= invalid, no zone is found
4219
+ * ------- -------
4220
+ * | A | <= ignored | A | <= ignored
4221
+ * ------- -------
4144
4222
  */
4145
- private inputToHighlights;
4146
- private cleanInputs;
4223
+ private findAdjacentData;
4147
4224
  /**
4148
- * Check if a cell or range reference should be highlighted.
4149
- * It should be highlighted if it references the current active sheet.
4150
- * Note that if no sheet name is given in the reference ("A1"), it refers to the
4151
- * active sheet when the selection input was enabled which might be different from
4152
- * the current active sheet.
4225
+ * Return the zone to sum if a valid one is found.
4226
+ * @see getAutomaticSumZone
4153
4227
  */
4154
- private shouldBeHighlighted;
4228
+ private findSuitableZoneToSum;
4229
+ private findVerticalZone;
4230
+ private findHorizontalZone;
4155
4231
  /**
4156
- * Return the index of a range given its id
4157
- * or `null` if the range is not found.
4232
+ * Reduces a column or row zone to a valid zone for the automatic sum.
4233
+ * @see getAutomaticSumZone
4234
+ * @param sheet
4235
+ * @param zone one dimensional zone (a single row or a single column). The zone is
4236
+ * assumed to start at the beginning of the column (top=0) or the row (left=0)
4237
+ * @param end end index of the zone (`bottom` or `right` depending on the dimension)
4238
+ * @returns the starting position of the valid zone or Infinity if the zone is not valid.
4158
4239
  */
4159
- getIndex(rangeId: string | null): number | null;
4160
- }
4161
-
4162
- /**
4163
- * Selection input Plugin
4164
- *
4165
- * The SelectionInput component input and output are both arrays of strings, but
4166
- * it requires an intermediary internal state to work.
4167
- * This plugin handles this internal state.
4168
- */
4169
- declare class SelectionInputsManagerPlugin extends UIPlugin {
4170
- private state;
4171
- private config;
4172
- static layers: LAYERS[];
4173
- static getters: readonly ["getSelectionInput", "getSelectionInputValue", "isRangeValid", "getSelectionInputHighlights"];
4174
- private inputs;
4175
- private focusedInputId;
4176
- get currentInput(): SelectionInputPlugin | null;
4177
- constructor(getters: Getters, state: StateObserver, dispatch: CommandDispatcher["dispatch"], config: ModelConfig, selection: SelectionStreamProcessor);
4178
- allowDispatch(cmd: Command): CommandResult;
4179
- handle(cmd: Command): void;
4180
- unsubscribe(): void;
4240
+ private reduceZoneStart;
4241
+ private shouldFindData;
4242
+ private isNumber;
4243
+ private isZoneValid;
4244
+ private lastColIsEmpty;
4245
+ private lastRowIsEmpty;
4181
4246
  /**
4182
- * Return a list of all valid XCs.
4183
- * e.g. ["A1", "Sheet2!B3", "E12"]
4247
+ * Decides which dimensions (columns or rows) should be summed
4248
+ * based on its shape and what's inside the zone.
4184
4249
  */
4185
- getSelectionInput(id: UID): (RangeInputValue & {
4186
- isFocused: boolean;
4187
- })[];
4188
- isRangeValid(reference: string): boolean;
4189
- getSelectionInputValue(id: UID): string[];
4190
- getSelectionInputHighlights(): Highlight$1[];
4191
- private initInput;
4192
- private unfocus;
4193
- }
4194
-
4195
- interface ClientToDisplay extends Required<Client> {
4196
- color: string;
4197
- }
4198
- declare class SelectionMultiUserPlugin extends UIPlugin {
4199
- static getters: readonly ["getClientsToDisplay"];
4200
- static layers: LAYERS[];
4201
- private availableColors;
4202
- private colors;
4203
- private isPositionValid;
4204
- private chooseNewColor;
4250
+ private dimensionsToSum;
4205
4251
  /**
4206
- * Get the list of others connected clients which are present in the same sheet
4207
- * and with a valid position
4252
+ * Sum each column and/or row in the zone in the appropriate cells,
4253
+ * depending on the available space.
4208
4254
  */
4209
- getClientsToDisplay(): ClientToDisplay[];
4210
- drawGrid(renderingContext: GridRenderingContext): void;
4211
- }
4212
-
4213
- declare class InternalViewport {
4214
- private getters;
4215
- private sheetId;
4216
- private boundaries;
4217
- top: HeaderIndex;
4218
- bottom: HeaderIndex;
4219
- left: HeaderIndex;
4220
- right: HeaderIndex;
4221
- offsetX: Pixel;
4222
- offsetY: Pixel;
4223
- offsetScrollbarX: Pixel;
4224
- offsetScrollbarY: Pixel;
4225
- canScrollVertically: boolean;
4226
- canScrollHorizontally: boolean;
4227
- width: Pixel;
4228
- height: Pixel;
4229
- offsetCorrectionX: Pixel;
4230
- offsetCorrectionY: Pixel;
4231
- constructor(getters: Getters, sheetId: UID, boundaries: Zone, sizeInGrid: {
4232
- width: Pixel;
4233
- height: Pixel;
4234
- }, options: {
4235
- canScrollVertically: boolean;
4236
- canScrollHorizontally: boolean;
4237
- }, offsets: {
4238
- x: Pixel;
4239
- y: Pixel;
4240
- });
4241
- getMaxSize(): ZoneDimension;
4255
+ private sumDimensions;
4242
4256
  /**
4243
- * Return the index of a column given an offset x, based on the pane left
4244
- * visible cell.
4245
- * It returns -1 if no column is found.
4257
+ * Sum the total of the zone in the bottom right cell, assuming
4258
+ * the last row contains summed columns.
4246
4259
  */
4247
- getColIndex(x: Pixel, absolute?: boolean): HeaderIndex;
4260
+ private sumTotal;
4261
+ private sumColumns;
4262
+ private sumRows;
4263
+ private dispatchCellUpdates;
4248
4264
  /**
4249
- * Return the index of a row given an offset y, based on the pane top
4250
- * visible cell.
4251
- * It returns -1 if no row is found.
4265
+ * Find the first row where all cells below the zone are empty.
4252
4266
  */
4253
- getRowIndex(y: Pixel, absolute?: boolean): HeaderIndex;
4267
+ private nextEmptyRow;
4254
4268
  /**
4255
- * This function will make sure that the provided cell position (or current selected position) is part of
4256
- * the pane that is actually displayed on the client. We therefore adjust the offset of the pane
4257
- * until it contains the cell completely.
4269
+ * Find the first column where all cells right of the zone are empty.
4258
4270
  */
4259
- adjustPosition(position?: Position$1): void;
4260
- adjustPositionX(col: HeaderIndex): void;
4261
- adjustPositionY(row: HeaderIndex): void;
4262
- setViewportOffset(offsetX: Pixel, offsetY: Pixel): void;
4263
- adjustViewportZone(): void;
4271
+ private nextEmptyCol;
4264
4272
  /**
4265
- *
4266
- * @param zone
4267
- * @returns Computes the absolute coordinate of a given zone inside the viewport
4268
- */
4269
- getRect(zone: Zone): Rect | undefined;
4270
- isVisible(col: HeaderIndex, row: HeaderIndex): boolean;
4271
- private searchHeaderIndex;
4272
- private get zone();
4273
- private setViewportOffsetX;
4274
- private setViewportOffsetY;
4275
- /** Corrects the viewport's horizontal offset based on the current structure
4276
- * To make sure that at least on column is visible inside the viewport.
4277
- */
4278
- private adjustViewportOffsetX;
4279
- /** Corrects the viewport's vertical offset based on the current structure
4280
- * To make sure that at least on row is visible inside the viewport.
4273
+ * Transpose the given dimensions.
4274
+ * COL becomes ROW
4275
+ * ROW becomes COL
4281
4276
  */
4282
- private adjustViewportOffsetY;
4283
- /** Updates the pane zone and snapped offset based on its horizontal
4284
- * offset (will find Left) and its width (will find Right) */
4285
- private adjustViewportZoneX;
4286
- /** Updates the pane zone and snapped offset based on its vertical
4287
- * offset (will find Top) and its width (will find Bottom) */
4288
- private adjustViewportZoneY;
4277
+ private transpose;
4289
4278
  }
4290
4279
 
4291
- declare type SheetViewports = {
4292
- topLeft: InternalViewport | undefined;
4293
- bottomLeft: InternalViewport | undefined;
4294
- topRight: InternalViewport | undefined;
4295
- bottomRight: InternalViewport;
4296
- };
4297
4280
  /**
4298
- * EdgeScrollCases Schema
4299
- *
4300
- * The dots/double dots represent a freeze (= a split of viewports)
4301
- * In this example, we froze vertically between columns D and E
4302
- * and horizontally between rows 4 and 5.
4303
- *
4304
- * One can see that we scrolled horizontally from column E to G and
4305
- * vertically from row 5 to 7.
4306
- *
4307
- * A B C D G H I J K L M N O P Q R S T
4308
- * _______________________________________________________
4309
- * 1 | : |
4310
- * 2 | : |
4311
- * 3 | : B ↑ 6 |
4312
- * 4 | : | | | |
4313
- * ····················+···+·················+············|
4314
- * 7 | : | | | |
4315
- * 8 | : ↓ 2 | |
4316
- * 9 | : | |
4317
- * 10 | A --+--→ | |
4318
- * 11 | : | |
4319
- * 12 | : | |
4320
- * 13 | ←--+-- 1 | |
4321
- * 14 | : | 3 --+--→
4322
- * 15 | : | |
4323
- * 16 | : | |
4324
- * 17 | 5 --+-------------------------------------------+--→
4325
- * 18 | : | |
4326
- * 19 | : 4 | |
4327
- * 20 | : | | |
4328
- * ______________________________+___________| ____________
4329
- * | |
4330
- * ↓ ↓
4281
+ * Plugin managing the display of components next to cells.
4331
4282
  */
4283
+ declare class CellPopoverPlugin extends UIPlugin {
4284
+ static getters: readonly ["getCellPopover", "getPersistentPopoverTypeAtPosition", "hasOpenedPopover"];
4285
+ private persistentPopover?;
4286
+ allowDispatch(cmd: Command): CommandResult.Success | CommandResult.InvalidCellPopover;
4287
+ handle(cmd: Command): void;
4288
+ getCellPopover({ col, row }: Partial<Position$1>): ClosedCellPopover | PositionedCellPopover;
4289
+ hasOpenedPopover(): boolean;
4290
+ getPersistentPopoverTypeAtPosition({ col, row }: Position$1): CellPopoverType | undefined;
4291
+ private computePopoverAnchorRect;
4292
+ }
4293
+
4294
+ declare class HeaderVisibilityUIPlugin extends UIPlugin {
4295
+ static getters: readonly ["getNextVisibleCellPosition", "findVisibleHeader", "findLastVisibleColRowIndex", "findFirstVisibleColRowIndex", "isRowHidden", "isColHidden", "isHeaderHidden"];
4296
+ isRowHidden(sheetId: UID, index: number): boolean;
4297
+ isColHidden(sheetId: UID, index: number): boolean;
4298
+ isHeaderHidden(sheetId: UID, dimension: Dimension, index: number): boolean;
4299
+ getNextVisibleCellPosition({ sheetId, col, row }: CellPosition): CellPosition;
4300
+ findVisibleHeader(sheetId: UID, dimension: Dimension, indexes: number[]): number | undefined;
4301
+ findLastVisibleColRowIndex(sheetId: UID, dimension: Dimension, { last, first }: {
4302
+ first: HeaderIndex;
4303
+ last: HeaderIndex;
4304
+ }): HeaderIndex;
4305
+ findFirstVisibleColRowIndex(sheetId: UID, dimension: Dimension): number | undefined;
4306
+ exportForExcel(data: ExcelWorkbookData): void;
4307
+ }
4308
+
4332
4309
  /**
4333
- * Viewport plugin.
4334
- *
4335
- * This plugin manages all things related to all viewport states.
4336
- *
4310
+ * HighlightPlugin
4337
4311
  */
4338
- declare class SheetViewPlugin extends UIPlugin {
4339
- static getters: readonly ["getColIndex", "getRowIndex", "getActiveMainViewport", "getSheetViewDimension", "getSheetViewDimensionWithHeaders", "getMainViewportRect", "isVisibleInViewport", "getEdgeScrollCol", "getEdgeScrollRow", "getVisibleFigures", "getVisibleRect", "getColRowOffsetInViewport", "getMainViewportCoordinates", "getActiveSheetScrollInfo", "getActiveSheetDOMScrollInfo", "getSheetViewVisibleCols", "getSheetViewVisibleRows", "getFrozenSheetViewRatio"];
4340
- readonly viewports: Record<UID, SheetViewports | undefined>;
4341
- /**
4342
- * The viewport dimensions are usually set by one of the components
4343
- * (i.e. when grid component is mounted) to properly reflect its state in the DOM.
4344
- * In the absence of a component (standalone model), is it mandatory to set reasonable default values
4345
- * to ensure the correct operation of this plugin.
4346
- */
4347
- private sheetViewWidth;
4348
- private sheetViewHeight;
4349
- private gridOffsetX;
4350
- private gridOffsetY;
4351
- private sheetsWithDirtyViewports;
4352
- allowDispatch(cmd: Command): CommandResult | CommandResult[];
4353
- private handleEvent;
4354
- handle(cmd: Command): void;
4355
- finalize(): void;
4356
- private setViewports;
4312
+ declare class HighlightPlugin extends UIPlugin {
4313
+ static layers: LAYERS[];
4314
+ static getters: readonly ["getHighlights"];
4315
+ getHighlights(): Highlight$1[];
4316
+ private prepareHighlights;
4317
+ drawGrid(renderingContext: GridRenderingContext): void;
4318
+ }
4319
+
4320
+ declare class RendererPlugin extends UIPlugin {
4321
+ static layers: LAYERS[];
4322
+ static getters: readonly ["getColDimensionsInViewport", "getRowDimensionsInViewport"];
4323
+ private boxes;
4357
4324
  /**
4358
- * Return the index of a column given an offset x, based on the viewport left
4359
- * visible cell.
4360
- * It returns -1 if no column is found.
4325
+ * Returns the size, start and end coordinates of a column relative to the left
4326
+ * column of the current viewport
4361
4327
  */
4362
- getColIndex(x: Pixel): HeaderIndex;
4328
+ getColDimensionsInViewport(sheetId: UID, col: HeaderIndex): HeaderDimensions;
4363
4329
  /**
4364
- * Return the index of a row given an offset y, based on the viewport top
4365
- * visible cell.
4366
- * It returns -1 if no row is found.
4330
+ * Returns the size, start and end coordinates of a row relative to the top row
4331
+ * of the current viewport
4367
4332
  */
4368
- getRowIndex(y: Pixel): HeaderIndex;
4369
- getSheetViewDimensionWithHeaders(): ZoneDimension;
4370
- getSheetViewDimension(): ZoneDimension;
4371
- /** type as pane, not viewport but basically pane extends viewport */
4372
- getActiveMainViewport(): Viewport;
4333
+ getRowDimensionsInViewport(sheetId: UID, row: HeaderIndex): HeaderDimensions;
4373
4334
  /**
4374
- * Return the scroll info of the active sheet, ie. the offset between the viewport left/top side and
4375
- * the grid left/top side, snapped to the columns/rows.
4335
+ * Get the offset of a header (see getColRowOffsetInViewport), adjusted with the header
4336
+ * size (HEADER_HEIGHT and HEADER_WIDTH)
4376
4337
  */
4377
- getActiveSheetScrollInfo(): SheetScrollInfo;
4338
+ private getHeaderOffset;
4339
+ drawGrid(renderingContext: GridRenderingContext, layer: LAYERS): void;
4340
+ private drawBackground;
4341
+ private drawCellBackground;
4342
+ private drawOverflowingCellBackground;
4343
+ private drawBorders;
4344
+ private drawTexts;
4345
+ private drawIcon;
4346
+ /** Compute the vertical start point from which a text line should be draw.
4347
+ *
4348
+ * Note that in case the cell does not have enough spaces to display its text lines,
4349
+ * (wrapping cell case) then the vertical align should be at the top.
4350
+ * */
4351
+ private computeTextYCoordinate;
4352
+ private drawHeaders;
4353
+ private drawFrozenPanesHeaders;
4354
+ private drawFrozenPanes;
4355
+ private findNextEmptyCol;
4356
+ private findPreviousEmptyCol;
4357
+ private computeCellAlignment;
4358
+ private createZoneBox;
4359
+ private getGridBoxes;
4360
+ }
4361
+
4362
+ interface RangeInputValue {
4363
+ id: UID;
4364
+ xc: string;
4365
+ color: string;
4366
+ }
4367
+ /**
4368
+ * Selection input Plugin
4369
+ *
4370
+ * The SelectionInput component input and output are both arrays of strings, but
4371
+ * it requires an intermediary internal state to work.
4372
+ * This plugin handles this internal state.
4373
+ */
4374
+ declare class SelectionInputPlugin extends UIPlugin implements StreamCallbacks<SelectionEvent> {
4375
+ private readonly inputHasSingleRange;
4376
+ static layers: LAYERS[];
4377
+ static getters: never[];
4378
+ ranges: RangeInputValue[];
4379
+ focusedRangeIndex: number | null;
4380
+ private activeSheet;
4381
+ private willAddNewRange;
4382
+ constructor(config: UIPluginConfig, initialRanges: string[], inputHasSingleRange: boolean);
4383
+ allowDispatch(cmd: Command): CommandResult;
4384
+ handleEvent(event: SelectionEvent): void;
4385
+ handle(cmd: Command): void;
4386
+ unsubscribe(): void;
4387
+ getSelectionInputValue(): string[];
4388
+ getSelectionInputHighlights(): Highlight$1[];
4378
4389
  /**
4379
- * Return the DOM scroll info of the active sheet, ie. the offset between the viewport left/top side and
4380
- * the grid left/top side, corresponding to the scroll of the scrollbars and not snapped to the grid.
4390
+ * Focus a given range or remove the focus.
4381
4391
  */
4382
- getActiveSheetDOMScrollInfo(): SheetDOMScrollInfo;
4383
- getSheetViewVisibleCols(): HeaderIndex[];
4384
- getSheetViewVisibleRows(): HeaderIndex[];
4392
+ private focus;
4393
+ private focusLast;
4394
+ private unfocus;
4395
+ private add;
4396
+ private setContent;
4385
4397
  /**
4386
- * Return the main viewport maximum size. That is the zone dimension
4387
- * with some bottom and right padding.
4398
+ * Insert new inputs after the given index.
4388
4399
  */
4389
- getMainViewportRect(): Rect;
4390
- private getMaximumSheetOffset;
4391
- getColRowOffsetInViewport(dimension: Dimension, referenceIndex: HeaderIndex, index: HeaderIndex): Pixel;
4400
+ private insertNewRange;
4392
4401
  /**
4393
- * Check if a given position is visible in the viewport.
4402
+ * Set a new value in a given range input. If more than one value is provided,
4403
+ * new inputs will be added.
4394
4404
  */
4395
- isVisibleInViewport(sheetId: UID, col: number, row: number): boolean;
4396
- getEdgeScrollCol(x: number, previousX: number, startingX: number): EdgeScrollInfo;
4397
- getEdgeScrollRow(y: number, previousY: number, tartingY: number): EdgeScrollInfo;
4405
+ private setRange;
4406
+ private removeRange;
4398
4407
  /**
4399
- * Computes the coordinates and size to draw the zone on the canvas
4408
+ * Convert highlights input format to the command format.
4409
+ * The first xc in the input range will keep its color.
4410
+ * Invalid ranges and ranges from other sheets than the active sheets
4411
+ * are ignored.
4400
4412
  */
4401
- getVisibleRect(zone: Zone): Rect;
4413
+ private inputToHighlights;
4414
+ private cleanInputs;
4402
4415
  /**
4403
- * Returns the position of the MainViewport relatively to the start of the grid (without headers)
4404
- * It corresponds to the summed dimensions of the visible cols/rows (in x/y respectively)
4405
- * situated before the pane divisions.
4416
+ * Check if a cell or range reference should be highlighted.
4417
+ * It should be highlighted if it references the current active sheet.
4418
+ * Note that if no sheet name is given in the reference ("A1"), it refers to the
4419
+ * active sheet when the selection input was enabled which might be different from
4420
+ * the current active sheet.
4406
4421
  */
4407
- getMainViewportCoordinates(): DOMCoordinates;
4408
- private ensureMainViewportExist;
4409
- private getSubViewports;
4410
- private checkPositiveDimension;
4411
- private checkValuesAreDifferent;
4412
- private checkScrollingDirection;
4413
- private getMainViewport;
4414
- private getMainInternalViewport;
4415
- /** gets rid of deprecated sheetIds */
4416
- private cleanViewports;
4417
- private resetSheetViews;
4418
- private resizeSheetView;
4419
- private recomputeViewports;
4420
- private setSheetViewOffset;
4422
+ private shouldBeHighlighted;
4421
4423
  /**
4422
- * Clip the vertical offset within the allowed range.
4423
- * Not above the sheet, nor below the sheet.
4424
+ * Return the index of a range given its id
4425
+ * or `null` if the range is not found.
4424
4426
  */
4425
- private clipOffsetY;
4426
- private getViewportOffset;
4427
- private resetViewports;
4427
+ getIndex(rangeId: string | null): number | null;
4428
+ }
4429
+
4430
+ /**
4431
+ * Selection input Plugin
4432
+ *
4433
+ * The SelectionInput component input and output are both arrays of strings, but
4434
+ * it requires an intermediary internal state to work.
4435
+ * This plugin handles this internal state.
4436
+ */
4437
+ declare class SelectionInputsManagerPlugin extends UIPlugin {
4438
+ private config;
4439
+ static layers: LAYERS[];
4440
+ static getters: readonly ["getSelectionInput", "getSelectionInputValue", "isRangeValid", "getSelectionInputHighlights"];
4441
+ private inputs;
4442
+ private focusedInputId;
4443
+ get currentInput(): SelectionInputPlugin | null;
4444
+ constructor(config: UIPluginConfig);
4445
+ allowDispatch(cmd: Command): CommandResult;
4446
+ handle(cmd: Command): void;
4447
+ unsubscribe(): void;
4428
4448
  /**
4429
- * Adjust the viewport such that the anchor position is visible
4449
+ * Return a list of all valid XCs.
4450
+ * e.g. ["A1", "Sheet2!B3", "E12"]
4430
4451
  */
4431
- private refreshViewport;
4452
+ getSelectionInput(id: UID): (RangeInputValue & {
4453
+ isFocused: boolean;
4454
+ })[];
4455
+ isRangeValid(reference: string): boolean;
4456
+ getSelectionInputValue(id: UID): string[];
4457
+ getSelectionInputHighlights(): Highlight$1[];
4458
+ private initInput;
4459
+ private unfocus;
4460
+ }
4461
+
4462
+ interface ClientToDisplay extends Required<Client> {
4463
+ color: string;
4464
+ }
4465
+ declare class SelectionMultiUserPlugin extends UIPlugin {
4466
+ static getters: readonly ["getClientsToDisplay"];
4467
+ static layers: LAYERS[];
4468
+ private availableColors;
4469
+ private colors;
4470
+ private isPositionValid;
4471
+ private chooseNewColor;
4432
4472
  /**
4433
- * Shift the viewport vertically and move the selection anchor
4434
- * such that it remains at the same place relative to the
4435
- * viewport top.
4473
+ * Get the list of others connected clients which are present in the same sheet
4474
+ * and with a valid position
4436
4475
  */
4437
- private shiftVertically;
4438
- getVisibleFigures(): Figure[];
4439
- getFrozenSheetViewRatio(sheetId: UID): {
4440
- xRatio: number;
4441
- yRatio: number;
4442
- };
4476
+ getClientsToDisplay(): ClientToDisplay[];
4477
+ drawGrid(renderingContext: GridRenderingContext): void;
4443
4478
  }
4444
4479
 
4445
4480
  declare class SortPlugin extends UIPlugin {
@@ -4528,28 +4563,137 @@ declare class SheetUIPlugin extends UIPlugin {
4528
4563
  private ctx;
4529
4564
  allowDispatch(cmd: Command): CommandResult;
4530
4565
  handle(cmd: Command): void;
4531
- getCellWidth(sheetId: UID, { col, row }: Position$1): number;
4532
- getTextWidth(cell: Cell): Pixel;
4533
- getCellText(cell: Cell, showFormula?: boolean): string;
4534
- getCellMultiLineText(cell: Cell, width: number): string[];
4566
+ getCellWidth(position: CellPosition): number;
4567
+ getTextWidth(position: CellPosition): Pixel;
4568
+ getCellText(position: CellPosition, showFormula?: boolean): string;
4569
+ getCellMultiLineText(position: CellPosition, width: number): string[];
4570
+ /**
4571
+ * Returns the size, start and end coordinates of a column on an unfolded sheet
4572
+ */
4573
+ getColDimensions(sheetId: UID, col: HeaderIndex): HeaderDimensions;
4574
+ /**
4575
+ * Returns the size, start and end coordinates of a row an unfolded sheet
4576
+ */
4577
+ getRowDimensions(sheetId: UID, row: HeaderIndex): HeaderDimensions;
4578
+ /**
4579
+ * Returns the offset of a header (determined by the dimension) at the given index
4580
+ * based on the referenceIndex given. If start === 0, this method will return
4581
+ * the start attribute of the header.
4582
+ *
4583
+ * i.e. The size from A to B is the distance between A.start and B.end
4584
+ */
4585
+ getColRowOffset(dimension: Dimension, referenceIndex: HeaderIndex, index: HeaderIndex, sheetId?: UID): Pixel;
4586
+ private getColMaxWidth;
4587
+ private splitWordToSpecificWidth;
4588
+ }
4589
+
4590
+ /**
4591
+ * Clipboard Plugin
4592
+ *
4593
+ * This clipboard manages all cut/copy/paste interactions internal to the
4594
+ * application, and with the OS clipboard as well.
4595
+ */
4596
+ declare class ClipboardPlugin extends UIPlugin {
4597
+ static layers: LAYERS[];
4598
+ static getters: readonly ["getClipboardContent", "getClipboardTextContent", "isCutOperation", "isPaintingFormat"];
4599
+ private status;
4600
+ private state?;
4601
+ private _isPaintingFormat;
4602
+ allowDispatch(cmd: Command): CommandResult;
4603
+ handle(cmd: Command): void;
4604
+ /**
4605
+ * Format the current clipboard to a string suitable for being pasted in other
4606
+ * programs.
4607
+ *
4608
+ * - add a tab character between each consecutive cells
4609
+ * - add a newline character between each line
4610
+ *
4611
+ * Note that it returns \t if the clipboard is empty. This is necessary for the
4612
+ * clipboard copy event to add it as data, otherwise an empty string is not
4613
+ * considered as a copy content.
4614
+ */
4615
+ getClipboardContent(): ClipboardContent;
4616
+ getClipboardTextContent(): string;
4617
+ isCutOperation(): boolean;
4618
+ isPaintingFormat(): boolean;
4619
+ private getDeleteCellsTargets;
4620
+ private getInsertCellsTargets;
4621
+ private getClipboardStateForCopyCells;
4622
+ /**
4623
+ * Get the clipboard state from the given zones.
4624
+ */
4625
+ private getClipboardState;
4626
+ drawGrid(renderingContext: GridRenderingContext): void;
4627
+ }
4628
+
4629
+ /**
4630
+ * SelectionPlugin
4631
+ */
4632
+ declare class GridSelectionPlugin extends UIPlugin {
4633
+ static layers: LAYERS[];
4634
+ static getters: readonly ["getActiveSheet", "getActiveSheetId", "getActiveCell", "getActiveCols", "getActiveRows", "getCurrentStyle", "getSelectedZones", "getSelectedZone", "getStatisticFnResults", "getAggregate", "getSelectedFigureId", "getSelection", "getActivePosition", "getSheetPosition", "isSelected", "getElementsFromSelection"];
4635
+ private gridSelection;
4636
+ private selectedFigureId;
4637
+ private sheetsData;
4638
+ private moveClient;
4639
+ activeSheet: Sheet;
4640
+ constructor(config: UIPluginConfig);
4641
+ allowDispatch(cmd: Command): CommandResult;
4642
+ private handleEvent;
4643
+ handle(cmd: Command): void;
4644
+ getActiveSheet(): Readonly<Sheet>;
4645
+ getActiveSheetId(): UID;
4646
+ getActiveCell(): EvaluatedCell;
4647
+ getActiveCols(): Set<number>;
4648
+ getActiveRows(): Set<number>;
4649
+ getCurrentStyle(): Style;
4650
+ getSelectedZones(): Zone[];
4651
+ getSelectedZone(): Zone;
4652
+ getSelection(): Selection;
4653
+ getSelectedFigureId(): UID | null;
4654
+ getActivePosition(): CellPosition;
4655
+ getSheetPosition(sheetId: UID): CellPosition;
4656
+ getStatisticFnResults(): {
4657
+ [name: string]: number | undefined;
4658
+ };
4659
+ getAggregate(): string | null;
4660
+ isSelected(zone: Zone): boolean;
4535
4661
  /**
4536
- * Returns the size, start and end coordinates of a column on an unfolded sheet
4662
+ * Returns a sorted array of indexes of all columns (respectively rows depending
4663
+ * on the dimension parameter) intersected by the currently selected zones.
4664
+ *
4665
+ * example:
4666
+ * assume selectedZones: [{left:0, right: 2, top :2, bottom: 4}, {left:5, right: 6, top :3, bottom: 5}]
4667
+ *
4668
+ * if dimension === "COL" => [0,1,2,5,6]
4669
+ * if dimension === "ROW" => [2,3,4,5]
4537
4670
  */
4538
- getColDimensions(sheetId: UID, col: HeaderIndex): HeaderDimensions;
4671
+ getElementsFromSelection(dimension: Dimension): number[];
4539
4672
  /**
4540
- * Returns the size, start and end coordinates of a row an unfolded sheet
4673
+ * Ensure selections are not outside sheet boundaries.
4674
+ * They are clipped to fit inside the sheet if needed.
4541
4675
  */
4542
- getRowDimensions(sheetId: UID, row: HeaderIndex): HeaderDimensions;
4676
+ private setSelectionMixin;
4543
4677
  /**
4544
- * Returns the offset of a header (determined by the dimension) at the given index
4545
- * based on the referenceIndex given. If start === 0, this method will return
4546
- * the start attribute of the header.
4678
+ * Change the anchor of the selection active cell to an absolute col and row index.
4547
4679
  *
4548
- * i.e. The size from A to B is the distance between A.start and B.end
4680
+ * This is a non trivial task. We need to stop the editing process and update
4681
+ * properly the current selection. Also, this method can optionally create a new
4682
+ * range in the selection.
4549
4683
  */
4550
- getColRowOffset(dimension: Dimension, referenceIndex: HeaderIndex, index: HeaderIndex, sheetId?: UID): Pixel;
4551
- private getColMaxWidth;
4552
- private splitWordToSpecificWidth;
4684
+ private selectCell;
4685
+ private setActiveSheet;
4686
+ private activateNextSheet;
4687
+ private onColumnsRemoved;
4688
+ private onRowsRemoved;
4689
+ private onAddElements;
4690
+ private onMoveElements;
4691
+ private isMoveElementAllowed;
4692
+ /**
4693
+ * Clip the selection if it spans outside the sheet
4694
+ */
4695
+ private clipSelection;
4696
+ drawGrid(renderingContext: GridRenderingContext): void;
4553
4697
  }
4554
4698
 
4555
4699
  /**
@@ -4590,6 +4734,7 @@ declare type CellGetters = Pick<CellPlugin, GetterNames<typeof CellPlugin>>;
4590
4734
  declare type MergeGetters = Pick<MergePlugin, GetterNames<typeof MergePlugin>>;
4591
4735
  declare type BordersGetters = Pick<BordersPlugin, GetterNames<typeof BordersPlugin>>;
4592
4736
  declare type ChartGetters = Pick<ChartPlugin, GetterNames<typeof ChartPlugin>>;
4737
+ declare type ImageGetters = Pick<ImagePlugin, GetterNames<typeof ImagePlugin>>;
4593
4738
  declare type FigureGetters = Pick<FigurePlugin, GetterNames<typeof FigurePlugin>>;
4594
4739
  declare type RangeAdapterGetters = Pick<RangeAdapter, GetterNames<typeof RangeAdapter>>;
4595
4740
  declare type ConditionalFormatGetters = Pick<ConditionalFormatPlugin, GetterNames<typeof ConditionalFormatPlugin>>;
@@ -4598,7 +4743,7 @@ declare type LocalHistoryGetters = {
4598
4743
  canRedo: LocalHistory["canRedo"];
4599
4744
  };
4600
4745
  declare type FiltersGetters = Pick<FiltersPlugin, GetterNames<typeof FiltersPlugin>>;
4601
- declare type CoreGetters = SheetGetters & HeaderSizeGetters & HeaderVisibilityGetters & CellGetters & MergeGetters & BordersGetters & ChartGetters & ConditionalFormatGetters & FigureGetters & RangeAdapterGetters & FiltersGetters;
4746
+ declare type CoreGetters = SheetGetters & HeaderSizeGetters & HeaderVisibilityGetters & CellGetters & MergeGetters & BordersGetters & ChartGetters & ImageGetters & ConditionalFormatGetters & FigureGetters & RangeAdapterGetters & FiltersGetters;
4602
4747
  declare type AutofillGetters = Pick<AutofillPlugin, GetterNames<typeof AutofillPlugin>>;
4603
4748
  declare type AutomaticSumGetters = Pick<AutomaticSumPlugin, GetterNames<typeof AutomaticSumPlugin>>;
4604
4749
  declare type ClipboardGetters = Pick<ClipboardPlugin, GetterNames<typeof ClipboardPlugin>>;
@@ -4662,17 +4807,18 @@ declare type SelectionDirection = "up" | "down" | "left" | "right";
4662
4807
  declare type SelectionStep = number | "end";
4663
4808
 
4664
4809
  declare type CellPopoverType = "ErrorToolTip" | "LinkDisplay" | "FilterMenu" | "LinkEditor";
4665
- declare type SizedComponentConstructor = ComponentConstructor & {
4666
- size: {
4667
- width: number;
4668
- height: number;
4810
+ declare type PopoverPropsPosition = "TopRight" | "BottomLeft";
4811
+ declare type MaxSizedComponentConstructor = ComponentConstructor & {
4812
+ maxSize?: {
4813
+ maxWidth?: number;
4814
+ maxHeight?: number;
4669
4815
  };
4670
4816
  };
4671
4817
  /**
4672
4818
  * If the cell at the given position have an associated component (linkDisplay, errorTooltip, ...),
4673
4819
  * returns the parameters to display the component
4674
4820
  */
4675
- declare type CellPopoverBuilder = (position: Position$1, getters: Getters) => CellPopoverComponent<SizedComponentConstructor>;
4821
+ declare type CellPopoverBuilder = (position: CellPosition, getters: Getters) => CellPopoverComponent<MaxSizedComponentConstructor>;
4676
4822
  interface PopoverBuilders {
4677
4823
  onOpen?: CellPopoverBuilder;
4678
4824
  onHover?: CellPopoverBuilder;
@@ -4689,16 +4835,15 @@ declare type OpenCellPopover<C extends ComponentConstructor> = {
4689
4835
  isOpen: true;
4690
4836
  Component: C;
4691
4837
  props: PropsOf<C>;
4692
- cellCorner: "TopRight" | "BottomLeft";
4838
+ cellCorner: PopoverPropsPosition;
4693
4839
  };
4694
- declare type CellPopoverComponent<C extends SizedComponentConstructor = SizedComponentConstructor> = ClosedCellPopover | OpenCellPopover<C>;
4695
- declare type PositionedCellPopover<C extends SizedComponentConstructor = SizedComponentConstructor> = {
4840
+ declare type CellPopoverComponent<C extends MaxSizedComponentConstructor = MaxSizedComponentConstructor> = ClosedCellPopover | OpenCellPopover<C>;
4841
+ declare type PositionedCellPopover<C extends MaxSizedComponentConstructor = MaxSizedComponentConstructor> = {
4696
4842
  isOpen: true;
4697
4843
  Component: C;
4698
4844
  props: PropsOf<C>;
4699
- coordinates: DOMCoordinates;
4700
- cellWidth: number;
4701
- cellHeight: number;
4845
+ anchorRect: Rect;
4846
+ cellCorner: PopoverPropsPosition;
4702
4847
  };
4703
4848
 
4704
4849
  /**
@@ -4746,17 +4891,21 @@ declare class Registry<T> {
4746
4891
  remove(key: string): void;
4747
4892
  }
4748
4893
 
4749
- /**
4750
- * Instanciate a cell object based on a raw string content.
4751
- */
4752
- interface CellBuilder {
4753
- sequence: number;
4894
+ interface LinkSpec {
4895
+ readonly match: (url: string) => boolean;
4896
+ readonly createLink: (url: string, label: string) => Link;
4754
4897
  /**
4755
- * Check if this factory should be used
4898
+ * String used to display the URL in components.
4899
+ * Particularly useful for special links (sheet, etc.)
4900
+ * - a simple web link displays the raw url
4901
+ * - a link to a sheet displays the sheet name
4756
4902
  */
4757
- match: (content: string, format: Format | undefined) => boolean;
4758
- createCell: (id: UID, content: string, properties: CellDisplayProperties, sheetId: UID, getters: CoreGetters) => Cell;
4903
+ readonly urlRepresentation: (url: string, getters: Getters) => string;
4904
+ readonly open: (url: string, env: SpreadsheetChildEnv) => void;
4905
+ readonly sequence: number;
4759
4906
  }
4907
+ declare function urlRepresentation(link: Link, getters: Getters): string;
4908
+ declare function openLink(link: Link, env: SpreadsheetChildEnv): void;
4760
4909
 
4761
4910
  declare type TransformationFunction<U extends CoreCommandTypes, V extends CoreCommandTypes> = (toTransform: Extract<CoreCommand, {
4762
4911
  type: U;
@@ -4778,8 +4927,8 @@ declare class OTRegistry extends Registry<Map<CoreCommandTypes, TransformationFu
4778
4927
  }
4779
4928
 
4780
4929
  interface CellClickableItem {
4781
- condition: (cell: Cell, env: SpreadsheetChildEnv) => boolean;
4782
- action: (cell: Cell, env: SpreadsheetChildEnv) => void;
4930
+ condition: (position: CellPosition, env: SpreadsheetChildEnv) => boolean;
4931
+ action: (position: CellPosition, env: SpreadsheetChildEnv) => void;
4783
4932
  sequence: number;
4784
4933
  }
4785
4934
 
@@ -4805,11 +4954,12 @@ interface ChartBuilder {
4805
4954
  name: string;
4806
4955
  }
4807
4956
 
4808
- interface Props$y {
4957
+ interface Props$x {
4809
4958
  ranges: string[];
4810
4959
  hasSingleRange?: boolean;
4811
4960
  required?: boolean;
4812
4961
  isInvalid?: boolean;
4962
+ class?: string;
4813
4963
  onSelectionChanged?: (ranges: string[]) => void;
4814
4964
  onSelectionConfirmed?: () => void;
4815
4965
  }
@@ -4826,7 +4976,7 @@ interface SelectionRange extends Omit<RangeInputValue, "color"> {
4826
4976
  * onSelectionChanged is called every time the input value
4827
4977
  * changes.
4828
4978
  */
4829
- declare class SelectionInput extends Component<Props$y, SpreadsheetChildEnv> {
4979
+ declare class SelectionInput extends Component<Props$x, SpreadsheetChildEnv> {
4830
4980
  static template: string;
4831
4981
  private id;
4832
4982
  private previousRanges;
@@ -4842,6 +4992,7 @@ declare class SelectionInput extends Component<Props$y, SpreadsheetChildEnv> {
4842
4992
  checkChange(): void;
4843
4993
  getColor(range: SelectionRange): string;
4844
4994
  private triggerChange;
4995
+ onKeydown(ev: KeyboardEvent): void;
4845
4996
  focus(rangeId: string): void;
4846
4997
  addEmptyInput(): void;
4847
4998
  removeInput(rangeId: string): void;
@@ -4849,13 +5000,13 @@ declare class SelectionInput extends Component<Props$y, SpreadsheetChildEnv> {
4849
5000
  disable(): void;
4850
5001
  }
4851
5002
 
4852
- interface Props$x {
5003
+ interface Props$w {
4853
5004
  sheetId: UID;
4854
5005
  figureId: UID;
4855
5006
  definition: LineChartDefinition | BarChartDefinition | PieChartDefinition;
4856
5007
  updateChart: (definition: Partial<LineChartDefinition | BarChartDefinition | PieChartDefinition>) => DispatchResult;
4857
5008
  }
4858
- declare class LineBarPieConfigPanel extends Component<Props$x, SpreadsheetChildEnv> {
5009
+ declare class LineBarPieConfigPanel extends Component<Props$w, SpreadsheetChildEnv> {
4859
5010
  static template: string;
4860
5011
  static components: {
4861
5012
  SelectionInput: typeof SelectionInput;
@@ -4880,11 +5031,13 @@ declare class LineBarPieConfigPanel extends Component<Props$x, SpreadsheetChildE
4880
5031
  */
4881
5032
  onLabelRangeChanged(ranges: string[]): void;
4882
5033
  onLabelRangeConfirmed(): void;
5034
+ onUpdateAggregated(ev: any): void;
4883
5035
  }
4884
5036
 
4885
5037
  declare class BarConfigPanel extends LineBarPieConfigPanel {
4886
5038
  static template: string;
4887
5039
  onUpdateStacked(ev: any): void;
5040
+ onUpdateAggregated(ev: any): void;
4888
5041
  }
4889
5042
 
4890
5043
  interface ColorPickerProps {
@@ -4895,6 +5048,9 @@ interface ColorPickerProps {
4895
5048
  }
4896
5049
  declare class ColorPicker extends Component<ColorPickerProps, SpreadsheetChildEnv> {
4897
5050
  static template: string;
5051
+ static defaultProps: {
5052
+ currentColor: string;
5053
+ };
4898
5054
  COLORS: string[];
4899
5055
  private state;
4900
5056
  get colorPickerStyle(): string;
@@ -4910,12 +5066,12 @@ declare class ColorPicker extends Component<ColorPickerProps, SpreadsheetChildEn
4910
5066
  get magnifyingGlassStyle(): string;
4911
5067
  }
4912
5068
 
4913
- interface Props$w {
5069
+ interface Props$v {
4914
5070
  figureId: UID;
4915
5071
  definition: LineChartDefinition | BarChartDefinition | PieChartDefinition;
4916
5072
  updateChart: (definition: Partial<LineChartDefinition | BarChartDefinition | PieChartDefinition>) => CommandResult | CommandResult[];
4917
5073
  }
4918
- declare class LineBarPieDesignPanel extends Component<Props$w, SpreadsheetChildEnv> {
5074
+ declare class LineBarPieDesignPanel extends Component<Props$v, SpreadsheetChildEnv> {
4919
5075
  static template: string;
4920
5076
  static components: {
4921
5077
  ColorPicker: typeof ColorPicker;
@@ -4929,12 +5085,13 @@ declare class LineBarPieDesignPanel extends Component<Props$w, SpreadsheetChildE
4929
5085
  updateSelect(attr: string, ev: any): void;
4930
5086
  }
4931
5087
 
4932
- interface Props$v {
5088
+ interface Props$u {
5089
+ sheetId: UID;
4933
5090
  figureId: UID;
4934
5091
  definition: GaugeChartDefinition;
4935
5092
  updateChart: (definition: Partial<GaugeChartDefinition>) => DispatchResult;
4936
5093
  }
4937
- declare class GaugeChartConfigPanel extends Component<Props$v, SpreadsheetChildEnv> {
5094
+ declare class GaugeChartConfigPanel extends Component<Props$u, SpreadsheetChildEnv> {
4938
5095
  static template: string;
4939
5096
  static components: {
4940
5097
  SelectionInput: typeof SelectionInput;
@@ -4948,12 +5105,12 @@ declare class GaugeChartConfigPanel extends Component<Props$v, SpreadsheetChildE
4948
5105
  }
4949
5106
 
4950
5107
  declare type GaugeMenu = "backgroundColor" | "sectionColor-lowerColor" | "sectionColor-middleColor" | "sectionColor-upperColor";
4951
- interface Props$u {
5108
+ interface Props$t {
4952
5109
  figureId: UID;
4953
5110
  definition: GaugeChartDefinition;
4954
5111
  updateChart: (definition: Partial<GaugeChartDefinition>) => DispatchResult;
4955
5112
  }
4956
- declare class GaugeChartDesignPanel extends Component<Props$u, SpreadsheetChildEnv> {
5113
+ declare class GaugeChartDesignPanel extends Component<Props$t, SpreadsheetChildEnv> {
4957
5114
  static template: string;
4958
5115
  static components: {
4959
5116
  ColorPicker: typeof ColorPicker;
@@ -4981,14 +5138,16 @@ declare class LineConfigPanel extends LineBarPieConfigPanel {
4981
5138
  get canTreatLabelsAsText(): boolean;
4982
5139
  onUpdateLabelsAsText(ev: any): void;
4983
5140
  onUpdateStacked(ev: any): void;
5141
+ onUpdateAggregated(ev: any): void;
4984
5142
  }
4985
5143
 
4986
- interface Props$t {
5144
+ interface Props$s {
5145
+ sheetId: UID;
4987
5146
  figureId: UID;
4988
5147
  definition: ScorecardChartDefinition;
4989
5148
  updateChart: (definition: Partial<ScorecardChartDefinition>) => DispatchResult;
4990
5149
  }
4991
- declare class ScorecardChartConfigPanel extends Component<Props$t, SpreadsheetChildEnv> {
5150
+ declare class ScorecardChartConfigPanel extends Component<Props$s, SpreadsheetChildEnv> {
4992
5151
  static template: string;
4993
5152
  static components: {
4994
5153
  SelectionInput: typeof SelectionInput;
@@ -5007,12 +5166,12 @@ declare class ScorecardChartConfigPanel extends Component<Props$t, SpreadsheetCh
5007
5166
  }
5008
5167
 
5009
5168
  declare type ColorPickerId = undefined | "backgroundColor" | "baselineColorUp" | "baselineColorDown";
5010
- interface Props$s {
5169
+ interface Props$r {
5011
5170
  figureId: UID;
5012
5171
  definition: ScorecardChartDefinition;
5013
5172
  updateChart: (definition: Partial<ScorecardChartDefinition>) => DispatchResult;
5014
5173
  }
5015
- declare class ScorecardChartDesignPanel extends Component<Props$s, SpreadsheetChildEnv> {
5174
+ declare class ScorecardChartDesignPanel extends Component<Props$r, SpreadsheetChildEnv> {
5016
5175
  static template: string;
5017
5176
  static components: {
5018
5177
  ColorPicker: typeof ColorPicker;
@@ -5038,6 +5197,9 @@ interface ChartSidePanel {
5038
5197
  interface FigureContent {
5039
5198
  Component: any;
5040
5199
  SidePanelComponent?: string;
5200
+ keepRatio?: boolean;
5201
+ minFigSize?: number;
5202
+ borderWidth?: number;
5041
5203
  }
5042
5204
 
5043
5205
  interface SidePanelContent {
@@ -5118,10 +5280,10 @@ interface AutofillRule {
5118
5280
  sequence: number;
5119
5281
  }
5120
5282
 
5121
- interface Props$r {
5283
+ interface Props$q {
5122
5284
  figure: Figure;
5123
5285
  }
5124
- declare class ChartJsComponent extends Component<Props$r, SpreadsheetChildEnv> {
5286
+ declare class ChartJsComponent extends Component<Props$q, SpreadsheetChildEnv> {
5125
5287
  static template: string;
5126
5288
  private canvas;
5127
5289
  private chart?;
@@ -5133,10 +5295,10 @@ declare class ChartJsComponent extends Component<Props$r, SpreadsheetChildEnv> {
5133
5295
  private updateChartJs;
5134
5296
  }
5135
5297
 
5136
- interface Props$q {
5298
+ interface Props$p {
5137
5299
  figure: Figure;
5138
5300
  }
5139
- declare class ScorecardChart extends Component<Props$q, SpreadsheetChildEnv> {
5301
+ declare class ScorecardChart extends Component<Props$p, SpreadsheetChildEnv> {
5140
5302
  static template: string;
5141
5303
  private ctx;
5142
5304
  get runtime(): ScorecardChartRuntime;
@@ -5167,42 +5329,37 @@ declare class ScorecardChart extends Component<Props$q, SpreadsheetChildEnv> {
5167
5329
  private getWidestElement;
5168
5330
  }
5169
5331
 
5170
- interface Props$p {
5171
- /**
5172
- * Coordinates are expressed relative to the "body" element.
5173
- */
5174
- position: DOMCoordinates;
5175
- marginTop: Pixel;
5176
- childWidth: Pixel;
5177
- childHeight: Pixel;
5332
+ interface PopoverProps {
5178
5333
  /**
5179
- * The component is moved by this amount to the left when
5180
- * it is rendered on the left.
5334
+ * Rectangle around which the popover is displayed.
5335
+ * Coordinates are expressed as absolute DOM position.
5181
5336
  */
5182
- flipHorizontalOffset: Pixel;
5183
- /**
5184
- * The component is moved by this amount to the top when
5185
- * it is rendered on the top.
5186
- */
5187
- flipVerticalOffset: Pixel;
5188
- onMouseWheel: (ev: WheelEvent) => void;
5337
+ anchorRect: Rect;
5338
+ /** The popover can be positioned below the anchor Rectangle, or to the right of the rectangle */
5339
+ positioning: PopoverPropsPosition;
5340
+ maxWidth?: Pixel;
5341
+ maxHeight?: Pixel;
5342
+ /** Offset to apply to the vertical position of the popover.*/
5343
+ verticalOffset: number;
5344
+ onMouseWheel?: () => void;
5345
+ onPopoverMoved?: () => void;
5346
+ onPopoverHidden?: () => void;
5189
5347
  }
5190
- declare class Popover extends Component<Props$p, SpreadsheetChildEnv> {
5348
+ declare class Popover extends Component<PopoverProps, SpreadsheetChildEnv> {
5191
5349
  static template: string;
5192
5350
  static defaultProps: {
5193
- flipHorizontalOffset: number;
5194
- flipVerticalOffset: number;
5351
+ positioning: string;
5195
5352
  verticalOffset: number;
5196
- marginTop: number;
5197
5353
  onMouseWheel: () => void;
5354
+ onPopoverMoved: () => void;
5355
+ onPopoverHidden: () => void;
5198
5356
  };
5199
- private spreadsheetPosition;
5200
- get style(): string;
5201
- private get viewportDimension();
5202
- private get shouldRenderRight();
5203
- private get shouldRenderBottom();
5204
- private horizontalPosition;
5205
- private verticalPosition;
5357
+ private popoverRef;
5358
+ private currentPosition;
5359
+ private currentDisplayValue;
5360
+ private spreadsheetRect;
5361
+ private containerRect;
5362
+ setup(): void;
5206
5363
  }
5207
5364
 
5208
5365
  interface Props$o {
@@ -5222,7 +5379,6 @@ interface MenuState {
5222
5379
  }
5223
5380
  declare class Menu extends Component<Props$o, SpreadsheetChildEnv> {
5224
5381
  static template: string;
5225
- MENU_WIDTH: number;
5226
5382
  static components: {
5227
5383
  Menu: typeof Menu;
5228
5384
  Popover: typeof Popover;
@@ -5236,12 +5392,7 @@ declare class Menu extends Component<Props$o, SpreadsheetChildEnv> {
5236
5392
  setup(): void;
5237
5393
  get subMenuPosition(): DOMCoordinates;
5238
5394
  get menuHeight(): Pixel;
5239
- get subMenuHeight(): Pixel;
5240
- get popover(): {
5241
- marginTop: number;
5242
- flipHorizontalOffset: number;
5243
- flipVerticalOffset: number;
5244
- };
5395
+ get popoverProps(): PopoverProps;
5245
5396
  getColor(menu: FullMenuItem): string | undefined;
5246
5397
  activateMenu(menu: FullMenuItem): Promise<void>;
5247
5398
  private close;
@@ -5251,11 +5402,7 @@ declare class Menu extends Component<Props$o, SpreadsheetChildEnv> {
5251
5402
  */
5252
5403
  private subMenuVerticalPosition;
5253
5404
  private onExternalClick;
5254
- /**
5255
- * Return the total height (in pixels) needed for some
5256
- * menu items
5257
- */
5258
- private menuComponentHeight;
5405
+ private getMenuItemsHeight;
5259
5406
  getName(menu: FullMenuItem): string;
5260
5407
  getDescription(menu: FullMenuItem): string;
5261
5408
  isRoot(menu: FullMenuItem): boolean;
@@ -5265,16 +5412,15 @@ declare class Menu extends Component<Props$o, SpreadsheetChildEnv> {
5265
5412
  * If the given menu is not disabled, open it's submenu at the
5266
5413
  * correct position according to available surrounding space.
5267
5414
  */
5268
- openSubMenu(menu: FullMenuItem, position: Pixel): void;
5415
+ openSubMenu(menu: FullMenuItem, menuIndex: number): void;
5269
5416
  isParentMenu(subMenu: MenuState, menuItem: FullMenuItem): boolean;
5270
5417
  closeSubMenu(): void;
5271
- onClickMenu(menu: FullMenuItem, position: Pixel): void;
5418
+ onClickMenu(menu: FullMenuItem, menuIndex: number): void;
5272
5419
  onMouseOver(menu: FullMenuItem, position: Pixel): void;
5273
5420
  }
5274
5421
 
5275
5422
  interface Props$n {
5276
5423
  figure: Figure;
5277
- sidePanelIsOpen: boolean;
5278
5424
  onFigureDeleted: () => void;
5279
5425
  }
5280
5426
  declare class ChartFigure extends Component<Props$n, SpreadsheetChildEnv> {
@@ -5285,7 +5431,7 @@ declare class ChartFigure extends Component<Props$n, SpreadsheetChildEnv> {
5285
5431
  private menuState;
5286
5432
  private chartContainerRef;
5287
5433
  private menuButtonRef;
5288
- private menuButtonPosition;
5434
+ private menuButtonRect;
5289
5435
  private position;
5290
5436
  private getMenuItemRegistry;
5291
5437
  get chartType(): ChartType;
@@ -5323,43 +5469,19 @@ interface ClientTagProps {
5323
5469
  color: string;
5324
5470
  col: HeaderIndex;
5325
5471
  row: HeaderIndex;
5326
- viewport: Viewport;
5327
5472
  }
5328
5473
  declare class ClientTag extends Component<ClientTagProps, SpreadsheetChildEnv> {
5329
5474
  static template: string;
5330
5475
  get tagStyle(): string;
5331
5476
  }
5332
5477
 
5333
- interface AutocompleteValue {
5334
- text: string;
5335
- description: string;
5336
- }
5337
5478
  interface Props$l {
5338
- provider: string;
5339
- filter?: (searchTerm: string, vals: AutocompleteValue[]) => AutocompleteValue[];
5340
- search: string;
5341
- borderStyle: string;
5342
- exposeAPI: (api: TextValueProviderApi) => void;
5343
- onCompleted: (text?: string) => void;
5344
- }
5345
- interface TextValueProviderApi {
5346
- moveUp: () => void;
5347
- moveDown: () => void;
5348
- getValueToFill: () => string | undefined;
5349
- }
5350
- declare class TextValueProvider extends Component<Props$l> implements TextValueProviderApi {
5479
+ values: AutocompleteValue[];
5480
+ selectedIndex: number;
5481
+ onValueSelected: (value: string) => void;
5482
+ }
5483
+ declare class TextValueProvider extends Component<Props$l> {
5351
5484
  static template: string;
5352
- state: {
5353
- values: AutocompleteValue[];
5354
- selectedIndex: number;
5355
- };
5356
- setup(): void;
5357
- checkUpdateProps(nextProps: any): void;
5358
- filter(searchTerm: string): Promise<void>;
5359
- fillValue(index: any): void;
5360
- moveDown(): void;
5361
- moveUp(): void;
5362
- getValueToFill(): string | undefined;
5363
5485
  }
5364
5486
 
5365
5487
  declare class ContentEditableHelper {
@@ -5405,7 +5527,6 @@ interface Props$k {
5405
5527
  functionName: string;
5406
5528
  functionDescription: FunctionDescription;
5407
5529
  argToFocus: number;
5408
- borderStyle: string;
5409
5530
  }
5410
5531
  interface AssistantState {
5411
5532
  allowCellSelectionBehind: boolean;
@@ -5424,6 +5545,10 @@ declare type HtmlContent = {
5424
5545
  color?: string;
5425
5546
  class?: string;
5426
5547
  };
5548
+ interface AutocompleteValue {
5549
+ text: string;
5550
+ description: string;
5551
+ }
5427
5552
  interface Props$j {
5428
5553
  inputStyle: string;
5429
5554
  rect?: Rect;
@@ -5438,8 +5563,8 @@ interface ComposerState$1 {
5438
5563
  }
5439
5564
  interface AutoCompleteState {
5440
5565
  showProvider: boolean;
5441
- provider: string;
5442
- search: string;
5566
+ selectedIndex: number;
5567
+ values: AutocompleteValue[];
5443
5568
  }
5444
5569
  interface FunctionDescriptionState {
5445
5570
  showDescription: boolean;
@@ -5455,12 +5580,10 @@ declare class Composer extends Component<Props$j, SpreadsheetChildEnv> {
5455
5580
  };
5456
5581
  static defaultProps: {
5457
5582
  inputStyle: string;
5458
- focus: string;
5459
5583
  };
5460
5584
  composerRef: {
5461
5585
  el: HTMLElement | null;
5462
5586
  };
5463
- private autocompleteAPI?;
5464
5587
  contentHelper: ContentEditableHelper;
5465
5588
  composerState: ComposerState$1;
5466
5589
  autoCompleteState: AutoCompleteState;
@@ -5468,7 +5591,6 @@ declare class Composer extends Component<Props$j, SpreadsheetChildEnv> {
5468
5591
  private isKeyStillDown;
5469
5592
  private compositionActive;
5470
5593
  get assistantStyle(): string;
5471
- borderStyle: string;
5472
5594
  shouldProcessInputEvents: boolean;
5473
5595
  tokens: EnrichedToken[];
5474
5596
  keyMapping: {
@@ -5476,6 +5598,7 @@ declare class Composer extends Component<Props$j, SpreadsheetChildEnv> {
5476
5598
  };
5477
5599
  setup(): void;
5478
5600
  private processArrowKeys;
5601
+ private handleArrowKeysForAutocomplete;
5479
5602
  private processTabKey;
5480
5603
  private processEnterKey;
5481
5604
  private processEscapeKey;
@@ -5485,10 +5608,10 @@ declare class Composer extends Component<Props$j, SpreadsheetChildEnv> {
5485
5608
  onKeydown(ev: KeyboardEvent): void;
5486
5609
  onInput(): void;
5487
5610
  onKeyup(ev: KeyboardEvent): void;
5611
+ showAutocomplete(searchTerm: string): void;
5488
5612
  onMousedown(ev: MouseEvent): void;
5489
5613
  onClick(): void;
5490
5614
  onBlur(): void;
5491
- onCompleted(text: string | undefined): void;
5492
5615
  private processContent;
5493
5616
  private getContent;
5494
5617
  private getColoredTokens;
@@ -5504,8 +5627,8 @@ declare class Composer extends Component<Props$j, SpreadsheetChildEnv> {
5504
5627
 
5505
5628
  interface Props$i {
5506
5629
  focus: "inactive" | "cellFocus" | "contentFocus";
5507
- content: string;
5508
5630
  onComposerUnmounted: () => void;
5631
+ onComposerContentFocused: (selection: ComposerSelection) => void;
5509
5632
  }
5510
5633
  /**
5511
5634
  * This component is a composer which positions itself on the grid at the anchor cell.
@@ -5574,9 +5697,10 @@ declare class FigureComponent extends Component<Props$f, SpreadsheetChildEnv> {
5574
5697
  onMouseDown: () => void;
5575
5698
  onClickAnchor: () => void;
5576
5699
  };
5577
- figureRegistry: Registry<FigureContent>;
5700
+ private borderWidth;
5578
5701
  private figureRef;
5579
5702
  get isSelected(): boolean;
5703
+ get figureRegistry(): Registry<FigureContent>;
5580
5704
  private getBorderWidth;
5581
5705
  get borderStyle(): string;
5582
5706
  get wrapperStyle(): string;
@@ -5596,7 +5720,6 @@ interface DndState {
5596
5720
  height: Pixel;
5597
5721
  }
5598
5722
  interface Props$e {
5599
- sidePanelIsOpen: Boolean;
5600
5723
  onFigureDeleted: () => void;
5601
5724
  }
5602
5725
  interface Container {
@@ -5696,7 +5819,6 @@ interface Props$d {
5696
5819
  onGridResized: (dimension: DOMDimension) => void;
5697
5820
  onGridMoved: (deltaX: Pixel, deltaY: Pixel) => void;
5698
5821
  gridOverlayDimensions: string;
5699
- sidePanelIsOpen: boolean;
5700
5822
  onFigureDeleted: () => void;
5701
5823
  }
5702
5824
  declare class GridOverlay extends Component<Props$d, SpreadsheetChildEnv> {
@@ -5711,7 +5833,6 @@ declare class GridOverlay extends Component<Props$d, SpreadsheetChildEnv> {
5711
5833
  onCellRightClicked: () => void;
5712
5834
  onGridResized: () => void;
5713
5835
  onFigureDeleted: () => void;
5714
- sidePanelIsOpen: boolean;
5715
5836
  };
5716
5837
  private gridOverlay;
5717
5838
  setup(): void;
@@ -5723,8 +5844,8 @@ declare class GridOverlay extends Component<Props$d, SpreadsheetChildEnv> {
5723
5844
  }
5724
5845
 
5725
5846
  interface Props$c {
5726
- gridPosition: DOMCoordinates;
5727
5847
  hoveredCell: Partial<Position$1>;
5848
+ gridRect: Rect;
5728
5849
  onClosePopover: () => void;
5729
5850
  onMouseWheel: (ev: WheelEvent) => void;
5730
5851
  }
@@ -5914,246 +6035,63 @@ declare class ScrollBar extends Component<Props$8> {
5914
6035
  private scrollbar;
5915
6036
  setup(): void;
5916
6037
  get sizeCss(): string;
5917
- get positionCss(): string;
5918
- onScroll(ev: any): void;
5919
- }
5920
-
5921
- interface Props$7 {
5922
- position: {
5923
- left: number;
5924
- };
5925
- }
5926
- declare class HorizontalScrollBar extends Component<Props$7, SpreadsheetChildEnv> {
5927
- static components: {
5928
- ScrollBar: typeof ScrollBar;
5929
- };
5930
- static template: string;
5931
- static defaultProps: {
5932
- position: {
5933
- left: number;
5934
- };
5935
- };
5936
- get offset(): number;
5937
- get width(): number;
5938
- get isDisplayed(): boolean;
5939
- get position(): {
5940
- left: string;
5941
- bottom: string;
5942
- height: string;
5943
- right: string;
5944
- };
5945
- onScroll(offset: any): void;
5946
- }
5947
-
5948
- interface Props$6 {
5949
- position: {
5950
- top: number;
5951
- };
5952
- }
5953
- declare class VerticalScrollBar extends Component<Props$6, SpreadsheetChildEnv> {
5954
- static components: {
5955
- ScrollBar: typeof ScrollBar;
5956
- };
5957
- static template: string;
5958
- static defaultProps: {
5959
- position: {
5960
- top: number;
5961
- };
5962
- };
5963
- get offset(): number;
5964
- get height(): number;
5965
- get isDisplayed(): boolean;
5966
- get position(): {
5967
- top: string;
5968
- right: string;
5969
- width: string;
5970
- bottom: string;
5971
- };
5972
- onScroll(offset: any): void;
5973
- }
5974
-
5975
- /**
5976
- * The Grid component is the main part of the spreadsheet UI. It is responsible
5977
- * for displaying the actual grid, rendering it, managing events, ...
5978
- *
5979
- * The grid is rendered on a canvas. 3 sub components are (sometimes) displayed
5980
- * on top of the canvas:
5981
- * - a composer (to edit the cell content)
5982
- * - a horizontal resizer (to resize columns)
5983
- * - a vertical resizer (same, for rows)
5984
- */
5985
- declare type ContextMenuType = "ROW" | "COL" | "CELL" | "FILTER";
5986
- interface Props$5 {
5987
- sidePanelIsOpen: boolean;
5988
- exposeFocus: (focus: () => void) => void;
5989
- onComposerContentFocused: () => void;
5990
- onGridComposerCellFocused: (content?: string, selection?: ComposerSelection) => void;
5991
- onSaveRequested?: () => void;
5992
- }
5993
- declare class Grid extends Component<Props$5, SpreadsheetChildEnv> {
5994
- static template: string;
5995
- static components: {
5996
- GridComposer: typeof GridComposer;
5997
- GridOverlay: typeof GridOverlay;
5998
- GridPopover: typeof GridPopover;
5999
- HeadersOverlay: typeof HeadersOverlay;
6000
- Menu: typeof Menu;
6001
- Autofill: typeof Autofill;
6002
- ClientTag: typeof ClientTag;
6003
- Highlight: typeof Highlight;
6004
- Popover: typeof Popover;
6005
- VerticalScrollBar: typeof VerticalScrollBar;
6006
- HorizontalScrollBar: typeof HorizontalScrollBar;
6007
- FilterIconsOverlay: typeof FilterIconsOverlay;
6008
- };
6009
- readonly HEADER_HEIGHT = 26;
6010
- readonly HEADER_WIDTH = 48;
6011
- private menuState;
6012
- private gridRef;
6013
- private hiddenInput;
6014
- onMouseWheel: (ev: WheelEvent) => void;
6015
- canvasPosition: DOMCoordinates;
6016
- hoveredCell: Partial<Position$1>;
6017
- setup(): void;
6018
- onCellHovered({ col, row }: {
6019
- col: any;
6020
- row: any;
6021
- }): void;
6022
- get gridOverlayDimensions(): string;
6023
- onClosePopover(): void;
6024
- private keyDownMapping;
6025
- focus(): void;
6026
- get gridEl(): HTMLElement;
6027
- getAutofillPosition(): {
6028
- left: number;
6029
- top: number;
6030
- };
6031
- isAutoFillActive(): boolean;
6032
- onGridResized({ height, width }: DOMDimension): void;
6033
- private moveCanvas;
6034
- getClientPositionKey(client: Client): string;
6035
- isCellHovered(col: HeaderIndex, row: HeaderIndex): boolean;
6036
- onCellClicked(col: HeaderIndex, row: HeaderIndex, { ctrlKey, shiftKey }: {
6037
- ctrlKey: boolean;
6038
- shiftKey: boolean;
6039
- }): void;
6040
- onCellDoubleClicked(col: HeaderIndex, row: HeaderIndex): void;
6041
- closeOpenedPopover(): void;
6042
- processArrows(ev: KeyboardEvent): void;
6043
- onKeydown(ev: KeyboardEvent): void;
6044
- onInput(ev: InputEvent): void;
6045
- onInputContextMenu(ev: MouseEvent): void;
6046
- onCellRightClicked(col: HeaderIndex, row: HeaderIndex, { x, y }: DOMCoordinates): void;
6047
- toggleContextMenu(type: ContextMenuType, x: Pixel, y: Pixel): void;
6048
- copy(cut: boolean, ev: ClipboardEvent): void;
6049
- paste(ev: ClipboardEvent): void;
6050
- closeMenu(): void;
6038
+ get positionCss(): string;
6039
+ onScroll(ev: any): void;
6051
6040
  }
6052
6041
 
6053
- interface Props$4 {
6054
- onCloseSidePanel: () => void;
6042
+ interface Props$7 {
6043
+ leftOffset: number;
6055
6044
  }
6056
- declare class ChartPanel extends Component<Props$4, SpreadsheetChildEnv> {
6045
+ declare class HorizontalScrollBar extends Component<Props$7, SpreadsheetChildEnv> {
6046
+ static components: {
6047
+ ScrollBar: typeof ScrollBar;
6048
+ };
6057
6049
  static template: string;
6058
- private state;
6059
- private shouldUpdateChart;
6060
- get figureId(): UID;
6061
- get sheetId(): UID;
6062
- setup(): void;
6063
- updateChart<T extends ChartDefinition>(updateDefinition: Partial<T>): DispatchResult | undefined;
6064
- onTypeChange(type: ChartType): void;
6065
- get chartPanel(): ChartSidePanel;
6066
- private getChartDefinition;
6067
- get chartTypes(): Record<string, string>;
6068
- activatePanel(panel: "configuration" | "design"): void;
6050
+ static defaultProps: {
6051
+ leftOffset: number;
6052
+ };
6053
+ get offset(): number;
6054
+ get width(): number;
6055
+ get isDisplayed(): boolean;
6056
+ get position(): {
6057
+ left: string;
6058
+ bottom: string;
6059
+ height: string;
6060
+ right: string;
6061
+ };
6062
+ onScroll(offset: any): void;
6069
6063
  }
6070
6064
 
6071
- declare function toNumber(value: string | number | boolean | null | undefined): number;
6072
- declare function toString(value: string | number | boolean | null | undefined): string;
6073
- declare function toBoolean(value: string | number | boolean | null | undefined): boolean;
6074
- declare function toJsDate(value: string | number | boolean | null | undefined): Date;
6075
-
6076
- /**
6077
- * This function is meant to be used as a tag for a template strings.
6078
- *
6079
- * Its job is to convert a textual description of the list of arguments into an
6080
- * actual array of Arg, suitable for consumption.
6081
- */
6082
- declare function args(strings: string): ArgDefinition[];
6083
-
6084
- /**
6085
- * Abstract base implementation of a cell.
6086
- * Concrete cell classes are responsible to build the raw cell `content` based on
6087
- * whatever data they have (formula, string, ...).
6088
- */
6089
- declare abstract class AbstractCell<T extends CellEvaluation = CellEvaluation> implements ICell {
6090
- readonly id: UID;
6091
- readonly style?: Style;
6092
- readonly format?: Format;
6093
- abstract content: string;
6094
- protected lazyEvaluated: Lazy<T>;
6095
- constructor(id: UID, lazyEvaluated: Lazy<T>, properties: CellDisplayProperties);
6096
- isFormula(): this is FormulaCell;
6097
- isLink(): this is LinkCell$1;
6098
- isEmpty(): boolean;
6099
- get evaluated(): T;
6100
- get formattedValue(): string;
6101
- get composerContent(): string;
6102
- get defaultAlign(): "center" | "left" | "right";
6103
- /**
6104
- * Only empty cells, text cells and numbers are valid
6105
- */
6106
- get isAutoSummable(): boolean;
6107
- }
6108
- declare abstract class LinkCell extends AbstractCell<TextEvaluation> implements LinkCell$1 {
6109
- readonly link: Link;
6110
- readonly content: string;
6111
- abstract isUrlEditable: boolean;
6112
- abstract urlRepresentation: string;
6113
- constructor(id: UID, content: string, properties?: CellDisplayProperties);
6114
- abstract action(env: SpreadsheetChildEnv): void;
6115
- isLink(): boolean;
6116
- get composerContent(): string;
6065
+ interface Props$6 {
6066
+ topOffset: number;
6117
6067
  }
6118
-
6119
- declare class ChartColors {
6120
- private graphColorIndex;
6121
- next(): string;
6068
+ declare class VerticalScrollBar extends Component<Props$6, SpreadsheetChildEnv> {
6069
+ static components: {
6070
+ ScrollBar: typeof ScrollBar;
6071
+ };
6072
+ static template: string;
6073
+ static defaultProps: {
6074
+ topOffset: number;
6075
+ };
6076
+ get offset(): number;
6077
+ get height(): number;
6078
+ get isDisplayed(): boolean;
6079
+ get position(): {
6080
+ top: string;
6081
+ right: string;
6082
+ width: string;
6083
+ bottom: string;
6084
+ };
6085
+ onScroll(offset: any): void;
6122
6086
  }
6123
- /**
6124
- * Choose a font color based on a background color.
6125
- * The font is white with a dark background.
6126
- */
6127
- declare function chartFontColor(backgroundColor: Color | undefined): Color;
6128
-
6129
- /**
6130
- * Get a default chart js configuration
6131
- */
6132
- declare function getDefaultChartJsRuntime(chart: AbstractChart, labels: string[], fontColor: Color): ChartConfiguration;
6133
- /** See https://www.chartjs.org/docs/latest/charts/area.html#filling-modes */
6134
- declare function getFillingMode(index: number): "origin" | number;
6135
-
6136
- /**
6137
- * This function tries to load anything that could look like a valid
6138
- * workbookData object. It applies any migrations, if needed, and return a
6139
- * current, complete workbookData object.
6140
- *
6141
- * It also ensures that there is at least one sheet.
6142
- */
6143
- declare function load(data?: any, verboseImport?: boolean): WorkbookData;
6144
- declare function createEmptySheet(sheetId: UID, name: string): SheetData;
6145
- declare function createEmptyWorkbookData(sheetName?: string): WorkbookData;
6146
- declare function createEmptyExcelSheet(sheetId: UID, name: string): ExcelSheetData;
6147
-
6148
- declare function getMenuChildren(node: FullMenuItem, env: SpreadsheetChildEnv): FullMenuItem[];
6149
6087
 
6150
- interface Props$3 {
6088
+ interface Props$5 {
6151
6089
  onClick: () => void;
6152
6090
  }
6153
6091
  interface BottomBarMenuState extends MenuState {
6154
6092
  menuId: UID | undefined;
6155
6093
  }
6156
- declare class BottomBar extends Component<Props$3, SpreadsheetChildEnv> {
6094
+ declare class BottomBar extends Component<Props$5, SpreadsheetChildEnv> {
6157
6095
  static template: string;
6158
6096
  static components: {
6159
6097
  Menu: typeof Menu;
@@ -6176,14 +6114,15 @@ declare class BottomBar extends Component<Props$3, SpreadsheetChildEnv> {
6176
6114
  private getComposedFnName;
6177
6115
  }
6178
6116
 
6179
- interface Props$2 {
6117
+ interface Props$4 {
6180
6118
  }
6181
6119
  interface ClickableCell {
6182
6120
  coordinates: Rect;
6183
- cell: Cell;
6184
- action: (cell: Cell, env: SpreadsheetChildEnv) => void;
6121
+ position: Position$1;
6122
+ action: (position: CellPosition, env: SpreadsheetChildEnv) => void;
6123
+ tKey: string;
6185
6124
  }
6186
- declare class SpreadsheetDashboard extends Component<Props$2, SpreadsheetChildEnv> {
6125
+ declare class SpreadsheetDashboard extends Component<Props$4, SpreadsheetChildEnv> {
6187
6126
  static template: string;
6188
6127
  static components: {
6189
6128
  GridOverlay: typeof GridOverlay;
@@ -6211,14 +6150,15 @@ declare class SpreadsheetDashboard extends Component<Props$2, SpreadsheetChildEn
6211
6150
  *
6212
6151
  */
6213
6152
  getClickableCells(): ClickableCell[];
6214
- getClickableAction(cell: Cell): false | ((cell: Cell, env: SpreadsheetChildEnv) => void);
6153
+ getClickableAction(position: CellPosition): false | ((position: CellPosition, env: SpreadsheetChildEnv) => void);
6215
6154
  selectClickableCell(clickableCell: ClickableCell): void;
6216
6155
  onClosePopover(): void;
6217
6156
  onGridResized({ height, width }: DOMDimension): void;
6218
6157
  private moveCanvas;
6158
+ private getGridRect;
6219
6159
  }
6220
6160
 
6221
- interface Props$1 {
6161
+ interface Props$3 {
6222
6162
  component: string;
6223
6163
  panelProps: any;
6224
6164
  onCloseSidePanel: () => void;
@@ -6226,7 +6166,7 @@ interface Props$1 {
6226
6166
  interface State$1 {
6227
6167
  panel: SidePanelContent;
6228
6168
  }
6229
- declare class SidePanel extends Component<Props$1, SpreadsheetChildEnv> {
6169
+ declare class SidePanel extends Component<Props$3, SpreadsheetChildEnv> {
6230
6170
  static template: string;
6231
6171
  state: State$1;
6232
6172
  setup(): void;
@@ -6243,13 +6183,13 @@ interface State {
6243
6183
  menuState: MenuState;
6244
6184
  activeTool: Tool;
6245
6185
  }
6246
- interface Props {
6186
+ interface Props$2 {
6247
6187
  onClick: () => void;
6248
6188
  focusComposer: Omit<ComposerFocusType, "cellFocus">;
6249
6189
  onComposerContentFocused: (selection: ComposerSelection) => void;
6250
6190
  dropdownMaxHeight: Pixel;
6251
6191
  }
6252
- declare class TopBar extends Component<Props, SpreadsheetChildEnv> {
6192
+ declare class TopBar extends Component<Props$2, SpreadsheetChildEnv> {
6253
6193
  static template: string;
6254
6194
  DEFAULT_FONT_SIZE: number;
6255
6195
  static components: {
@@ -6291,25 +6231,27 @@ declare class TopBar extends Component<Props, SpreadsheetChildEnv> {
6291
6231
  composerStyle: string;
6292
6232
  setup(): void;
6293
6233
  get topbarComponents(): TopbarComponent[];
6294
- onClick(ev: MouseEvent): void;
6295
- toogleStyle(style: string): void;
6296
- toogleFormat(formatName: string): void;
6234
+ onExternalClick(ev: MouseEvent): void;
6235
+ onClick(): void;
6236
+ toggleStyle(style: string): void;
6237
+ toggleFormat(formatName: string): void;
6297
6238
  toggleAlign(align: Align): void;
6298
6239
  onMenuMouseOver(menu: FullMenuItem, ev: MouseEvent): void;
6299
6240
  toggleDropdownTool(tool: Tool, ev: MouseEvent): void;
6300
6241
  toggleContextMenu(menu: FullMenuItem, ev: MouseEvent): void;
6242
+ private openMenu;
6301
6243
  closeMenus(): void;
6302
6244
  updateCellState(): void;
6303
6245
  getMenuName(menu: FullMenuItem): string;
6304
6246
  toggleMerge(): void;
6305
6247
  setColor(target: string, color: string): void;
6306
6248
  setBorder(command: BorderCommand): void;
6307
- setFormat(ev: MouseEvent): void;
6249
+ setFormat(format: Format, custom: boolean): void;
6308
6250
  openCustomFormatSidePanel(custom: string): void;
6309
6251
  setDecimal(step: SetDecimalStep): void;
6310
6252
  paintFormat(): void;
6311
6253
  clearFormatting(): void;
6312
- setSize(ev: MouseEvent): void;
6254
+ setSize(fontSizeStr: string): void;
6313
6255
  doAction(action: (env: SpreadsheetChildEnv) => void): void;
6314
6256
  undo(): void;
6315
6257
  redo(): void;
@@ -6322,9 +6264,6 @@ declare class TopBar extends Component<Props, SpreadsheetChildEnv> {
6322
6264
  declare type ComposerFocusType = "inactive" | "cellFocus" | "contentFocus";
6323
6265
  interface SpreadsheetProps {
6324
6266
  model: Model;
6325
- exposeSpreadsheet?: (spreadsheet: Spreadsheet) => void;
6326
- onUnexpectedRevisionId?: () => void;
6327
- onContentSaved?: (data: WorkbookData) => void;
6328
6267
  }
6329
6268
  interface SidePanelState {
6330
6269
  isOpen: boolean;
@@ -6345,12 +6284,12 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
6345
6284
  SpreadsheetDashboard: typeof SpreadsheetDashboard;
6346
6285
  };
6347
6286
  static _t: (s: string) => string;
6348
- model: Model;
6349
6287
  sidePanel: SidePanelState;
6350
6288
  composer: ComposerState;
6351
6289
  private _focusGrid?;
6352
6290
  private keyDownMapping;
6353
6291
  private isViewportTooSmall;
6292
+ get model(): Model;
6354
6293
  getStyle(): string;
6355
6294
  setup(): void;
6356
6295
  get focusTopBarComposer(): Omit<ComposerFocusType, "cellFocus">;
@@ -6363,7 +6302,6 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
6363
6302
  closeSidePanel(): void;
6364
6303
  toggleSidePanel(panel: string, panelProps: any): void;
6365
6304
  focusGrid(): void;
6366
- save(): void;
6367
6305
  onKeydown(ev: KeyboardEvent): void;
6368
6306
  onTopBarComposerFocused(selection: ComposerSelection): void;
6369
6307
  onGridComposerContentFocused(): void;
@@ -6375,6 +6313,148 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
6375
6313
  get gridHeight(): Pixel;
6376
6314
  }
6377
6315
 
6316
+ /**
6317
+ * The Grid component is the main part of the spreadsheet UI. It is responsible
6318
+ * for displaying the actual grid, rendering it, managing events, ...
6319
+ *
6320
+ * The grid is rendered on a canvas. 3 sub components are (sometimes) displayed
6321
+ * on top of the canvas:
6322
+ * - a composer (to edit the cell content)
6323
+ * - a horizontal resizer (to resize columns)
6324
+ * - a vertical resizer (same, for rows)
6325
+ */
6326
+ declare type ContextMenuType = "ROW" | "COL" | "CELL" | "FILTER";
6327
+ interface Props$1 {
6328
+ sidePanelIsOpen: boolean;
6329
+ exposeFocus: (focus: () => void) => void;
6330
+ focusComposer: ComposerFocusType;
6331
+ onComposerContentFocused: () => void;
6332
+ onGridComposerCellFocused: (content?: string, selection?: ComposerSelection) => void;
6333
+ }
6334
+ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
6335
+ static template: string;
6336
+ static components: {
6337
+ GridComposer: typeof GridComposer;
6338
+ GridOverlay: typeof GridOverlay;
6339
+ GridPopover: typeof GridPopover;
6340
+ HeadersOverlay: typeof HeadersOverlay;
6341
+ Menu: typeof Menu;
6342
+ Autofill: typeof Autofill;
6343
+ ClientTag: typeof ClientTag;
6344
+ Highlight: typeof Highlight;
6345
+ Popover: typeof Popover;
6346
+ VerticalScrollBar: typeof VerticalScrollBar;
6347
+ HorizontalScrollBar: typeof HorizontalScrollBar;
6348
+ FilterIconsOverlay: typeof FilterIconsOverlay;
6349
+ };
6350
+ readonly HEADER_HEIGHT = 26;
6351
+ readonly HEADER_WIDTH = 48;
6352
+ private menuState;
6353
+ private gridRef;
6354
+ private hiddenInput;
6355
+ onMouseWheel: (ev: WheelEvent) => void;
6356
+ canvasPosition: DOMCoordinates;
6357
+ hoveredCell: Partial<Position$1>;
6358
+ setup(): void;
6359
+ onCellHovered({ col, row }: {
6360
+ col: any;
6361
+ row: any;
6362
+ }): void;
6363
+ get gridOverlayDimensions(): string;
6364
+ onClosePopover(): void;
6365
+ private keyDownMapping;
6366
+ focus(): void;
6367
+ get gridEl(): HTMLElement;
6368
+ getAutofillPosition(): {
6369
+ left: number;
6370
+ top: number;
6371
+ };
6372
+ isAutoFillActive(): boolean;
6373
+ onGridResized({ height, width }: DOMDimension): void;
6374
+ private moveCanvas;
6375
+ getClientPositionKey(client: Client): string;
6376
+ isCellHovered(col: HeaderIndex, row: HeaderIndex): boolean;
6377
+ private getGridRect;
6378
+ onCellClicked(col: HeaderIndex, row: HeaderIndex, { ctrlKey, shiftKey }: {
6379
+ ctrlKey: boolean;
6380
+ shiftKey: boolean;
6381
+ }): void;
6382
+ onCellDoubleClicked(col: HeaderIndex, row: HeaderIndex): void;
6383
+ closeOpenedPopover(): void;
6384
+ processArrows(ev: KeyboardEvent): void;
6385
+ onKeydown(ev: KeyboardEvent): void;
6386
+ onInput(ev: InputEvent): void;
6387
+ onInputContextMenu(ev: MouseEvent): void;
6388
+ onCellRightClicked(col: HeaderIndex, row: HeaderIndex, { x, y }: DOMCoordinates): void;
6389
+ toggleContextMenu(type: ContextMenuType, x: Pixel, y: Pixel): void;
6390
+ copy(cut: boolean, ev: ClipboardEvent): void;
6391
+ paste(ev: ClipboardEvent): void;
6392
+ private displayWarningCopyPasteNotSupported;
6393
+ closeMenu(): void;
6394
+ }
6395
+
6396
+ interface Props {
6397
+ onCloseSidePanel: () => void;
6398
+ }
6399
+ declare class ChartPanel extends Component<Props, SpreadsheetChildEnv> {
6400
+ static template: string;
6401
+ private state;
6402
+ private shouldUpdateChart;
6403
+ get figureId(): UID;
6404
+ get sheetId(): UID;
6405
+ setup(): void;
6406
+ updateChart<T extends ChartDefinition>(updateDefinition: Partial<T>): DispatchResult | undefined;
6407
+ onTypeChange(type: ChartType): void;
6408
+ get chartPanel(): ChartSidePanel;
6409
+ private getChartDefinition;
6410
+ get chartTypes(): Record<string, string>;
6411
+ activatePanel(panel: "configuration" | "design"): void;
6412
+ }
6413
+
6414
+ declare function toNumber(value: string | number | boolean | null | undefined): number;
6415
+ declare function toString(value: string | number | boolean | null | undefined): string;
6416
+ declare function toBoolean(value: string | number | boolean | null | undefined): boolean;
6417
+ declare function toJsDate(value: string | number | boolean | null | undefined): Date;
6418
+
6419
+ /**
6420
+ * This function is meant to be used as a tag for a template strings.
6421
+ *
6422
+ * Its job is to convert a textual description of the list of arguments into an
6423
+ * actual array of Arg, suitable for consumption.
6424
+ */
6425
+ declare function args(strings: string): ArgDefinition[];
6426
+
6427
+ declare class ChartColors {
6428
+ private graphColorIndex;
6429
+ next(): string;
6430
+ }
6431
+ /**
6432
+ * Choose a font color based on a background color.
6433
+ * The font is white with a dark background.
6434
+ */
6435
+ declare function chartFontColor(backgroundColor: Color | undefined): Color;
6436
+
6437
+ /**
6438
+ * Get a default chart js configuration
6439
+ */
6440
+ declare function getDefaultChartJsRuntime(chart: AbstractChart, labels: string[], fontColor: Color): ChartConfiguration;
6441
+ /** See https://www.chartjs.org/docs/latest/charts/area.html#filling-modes */
6442
+ declare function getFillingMode(index: number): "origin" | number;
6443
+
6444
+ /**
6445
+ * This function tries to load anything that could look like a valid
6446
+ * workbookData object. It applies any migrations, if needed, and return a
6447
+ * current, complete workbookData object.
6448
+ *
6449
+ * It also ensures that there is at least one sheet.
6450
+ */
6451
+ declare function load(data?: any, verboseImport?: boolean): WorkbookData;
6452
+ declare function createEmptySheet(sheetId: UID, name: string): SheetData;
6453
+ declare function createEmptyWorkbookData(sheetName?: string): WorkbookData;
6454
+ declare function createEmptyExcelSheet(sheetId: UID, name: string): ExcelSheetData;
6455
+
6456
+ declare function getMenuChildren(node: FullMenuItem, env: SpreadsheetChildEnv): FullMenuItem[];
6457
+
6378
6458
  declare const DATETIME_FORMAT: RegExp;
6379
6459
 
6380
6460
  /**
@@ -6406,7 +6486,12 @@ declare const registries: {
6406
6486
  mapping: {
6407
6487
  [key: string]: ComputeFunction<Arg, FunctionReturn>;
6408
6488
  };
6409
- add(name: string, addDescr: AddFunctionDescription): any;
6489
+ add(name: string, addDescr: AddFunctionDescription): any; /**
6490
+ * We export here all entities that needs to be accessed publicly by Odoo.
6491
+ *
6492
+ * Note that the __info__ key is actually completed by the build process (see
6493
+ * the rollup.config.js file)
6494
+ */
6410
6495
  content: {
6411
6496
  [key: string]: FunctionDescription;
6412
6497
  };
@@ -6416,7 +6501,9 @@ declare const registries: {
6416
6501
  getKeys(): string[];
6417
6502
  remove(key: string): void;
6418
6503
  };
6419
- uiPluginRegistry: Registry<UIPluginConstructor>;
6504
+ featurePluginRegistry: Registry<UIPluginConstructor>;
6505
+ statefulUIPluginRegistry: Registry<UIPluginConstructor>;
6506
+ coreViewsPluginRegistry: Registry<UIPluginConstructor>;
6420
6507
  corePluginRegistry: Registry<CorePluginConstructor>;
6421
6508
  rowMenuRegistry: MenuItemRegistry;
6422
6509
  sidePanelRegistry: Registry<SidePanelContent>;
@@ -6444,12 +6531,9 @@ declare const registries: {
6444
6531
  clickableCellRegistry: Registry<CellClickableItem>;
6445
6532
  otRegistry: OTRegistry;
6446
6533
  inverseCommandRegistry: Registry<(cmd: CoreCommand) => CoreCommand[]>;
6447
- cellRegistry: Registry<CellBuilder>;
6534
+ urlRegistry: Registry<LinkSpec>;
6448
6535
  cellPopoverRegistry: Registry<PopoverBuilders>;
6449
6536
  };
6450
- declare const cellTypes: {
6451
- LinkCell: typeof LinkCell;
6452
- };
6453
6537
  declare const helpers: {
6454
6538
  args: typeof args;
6455
6539
  toBoolean: typeof toBoolean;
@@ -6464,9 +6548,6 @@ declare const helpers: {
6464
6548
  UuidGenerator: typeof UuidGenerator;
6465
6549
  formatValue: typeof formatValue;
6466
6550
  computeTextWidth: typeof computeTextWidth;
6467
- isMarkdownLink: typeof isMarkdownLink;
6468
- parseMarkdownLink: typeof parseMarkdownLink;
6469
- markdownLink: typeof markdownLink;
6470
6551
  createEmptyWorkbookData: typeof createEmptyWorkbookData;
6471
6552
  createEmptySheet: typeof createEmptySheet;
6472
6553
  createEmptyExcelSheet: typeof createEmptyExcelSheet;
@@ -6480,6 +6561,14 @@ declare const helpers: {
6480
6561
  rgbaToHex: typeof rgbaToHex;
6481
6562
  colorToRGBA: typeof colorToRGBA;
6482
6563
  positionToZone: typeof positionToZone;
6564
+ isDefined: typeof isDefined;
6565
+ };
6566
+ declare const links: {
6567
+ isMarkdownLink: typeof isMarkdownLink;
6568
+ parseMarkdownLink: typeof parseMarkdownLink;
6569
+ markdownLink: typeof markdownLink;
6570
+ openLink: typeof openLink;
6571
+ urlRepresentation: typeof urlRepresentation;
6483
6572
  };
6484
6573
  declare const components: {
6485
6574
  ChartPanel: typeof ChartPanel;
@@ -6499,4 +6588,4 @@ declare const components: {
6499
6588
  };
6500
6589
  declare function addFunction(functionName: string, functionDescription: FunctionDescription): void;
6501
6590
 
6502
- export { AbstractChart, CancelledReason, Client, ClientJoinedMessage, ClientLeftMessage, ClientMovedMessage, CollaborationMessage, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, RemoteRevisionMessage, Revision, RevisionRedoneMessage, RevisionUndoneMessage, SPREADSHEET_DIMENSIONS, Spreadsheet, TransportService, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
6591
+ export { AbstractChart, CancelledReason, Client, ClientJoinedMessage, ClientLeftMessage, ClientMovedMessage, CollaborationMessage, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, RemoteRevisionMessage, Revision, RevisionRedoneMessage, RevisionUndoneMessage, SPREADSHEET_DIMENSIONS, Spreadsheet, TransportService, UIPlugin, __info__, addFunction, astToFormula, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, links, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };