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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import * as _odoo_owl from '@odoo/owl';
2
- import { ComponentConstructor, EventBus as EventBus$1, Component } from '@odoo/owl';
2
+ import { ComponentConstructor, Component } from '@odoo/owl';
3
3
  import { ChartConfiguration, ChartData, ChartDataSets, ChartOptions } from 'chart.js';
4
4
 
5
5
  declare enum CellErrorLevel {
@@ -160,195 +160,129 @@ interface Subscription {
160
160
  callback: Callback;
161
161
  }
162
162
 
163
- /**
164
- * RGBA to HEX representation (#RRGGBBAA).
165
- *
166
- * https://css-tricks.com/converting-color-spaces-in-javascript/
167
- */
168
- declare function rgbaToHex(rgba: RGBA): Color;
169
- /**
170
- * Color string to RGBA representation
171
- */
172
- declare function colorToRGBA(color: Color): RGBA;
173
-
174
- /**
175
- * Convert a (col) number to the corresponding letter.
176
- *
177
- * Examples:
178
- * 0 => 'A'
179
- * 25 => 'Z'
180
- * 26 => 'AA'
181
- * 27 => 'AB'
182
- */
183
- declare function numberToLetters(n: number): string;
184
- /**
185
- * Convert a "XC" coordinate to cartesian coordinates.
186
- *
187
- * Examples:
188
- * A1 => [0,0]
189
- * B3 => [1,2]
190
- *
191
- * Note: it also accepts lowercase coordinates, but not fixed references
192
- */
193
- declare function toCartesian(xc: string): Position$1;
194
- /**
195
- * Convert from cartesian coordinate to the "XC" coordinate system.
196
- *
197
- * Examples:
198
- * - 0,0 => A1
199
- * - 1,2 => B3
200
- * - 0,0, {colFixed: false, rowFixed: true} => A$1
201
- * - 1,2, {colFixed: true, rowFixed: false} => $B3
202
- */
203
- declare function toXC(col: HeaderIndex, row: HeaderIndex, rangePart?: RangePart): string;
204
-
205
- /**
206
- * Formats a cell value with its format.
207
- */
208
- declare function formatValue(value: CellValue, format?: Format): FormattedValue;
209
-
210
- declare function computeTextWidth(context: CanvasRenderingContext2D, text: string, style: Style): number;
211
- declare function isMarkdownLink(str: string): boolean;
212
- /**
213
- * Build a markdown link from a label and an url
214
- */
215
- declare function markdownLink(label: string, url: string): string;
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;
225
- /**
226
- * Lazy value computed by the provided function.
227
- */
228
- declare function lazy<T>(fn: (() => T) | T): Lazy<T>;
229
-
230
- interface ConstructorArgs {
231
- readonly zone: Readonly<Zone | UnboundedZone>;
232
- readonly parts: readonly RangePart[];
233
- readonly invalidXc?: string;
234
- /** true if the user provided the range with the sheet name */
235
- readonly prefixSheet: boolean;
236
- /** the name of any sheet that is invalid */
237
- readonly invalidSheetName?: string;
238
- /** the sheet on which the range is defined */
239
- readonly sheetId: UID;
240
- }
241
- declare class RangeImpl implements Range {
242
- private getSheetSize;
243
- private readonly _zone;
244
- readonly parts: Range["parts"];
245
- readonly invalidXc?: string;
246
- readonly prefixSheet: boolean;
247
- readonly sheetId: UID;
248
- readonly invalidSheetName?: string;
249
- constructor(args: ConstructorArgs, getSheetSize: (sheetId: UID) => ZoneDimension);
250
- static fromRange(range: Range, getters: CoreGetters): RangeImpl;
251
- get unboundedZone(): UnboundedZone;
252
- get zone(): Zone;
253
- static getRangeParts(xc: string, zone: UnboundedZone): RangePart[];
254
- get isFullCol(): boolean;
255
- get isFullRow(): boolean;
256
- get rangeData(): RangeData;
163
+ declare class SelectiveHistory<T = unknown> {
164
+ private applyOperation;
165
+ private revertOperation;
166
+ private buildEmpty;
167
+ private readonly buildTransformation;
168
+ private HEAD_BRANCH;
169
+ private HEAD_OPERATION;
170
+ private tree;
257
171
  /**
258
- * Check that a zone is valid regarding the order of top-bottom and left-right.
259
- * Left should be smaller than right, top should be smaller than bottom.
260
- * If it's not the case, simply invert them, and invert the linked parts
172
+ * The selective history is a data structure used to register changes/updates of a state.
173
+ * Each change/update is called an "operation".
174
+ * The data structure allows to easily cancel (and redo) any operation individually.
175
+ * An operation can be represented by any data structure. It can be a "command", a "diff", etc.
176
+ * However it must have the following properties:
177
+ * - it can be applied to modify the state
178
+ * - it can be reverted on the state such that it was never executed.
179
+ * - it can be transformed given other operation (Operational Transformation)
180
+ *
181
+ * Since this data structure doesn't know anything about the state nor the structure of
182
+ * operations, the actual work must be performed by external functions given as parameters.
183
+ * @param initialOperationId
184
+ * @param applyOperation a function which can apply an operation to the state
185
+ * @param revertOperation a function which can revert an operation from the state
186
+ * @param buildEmpty a function returning an "empty" operation.
187
+ * i.e an operation that leaves the state unmodified once applied or reverted
188
+ * (used for internal implementation)
189
+ * @param buildTransformation Factory used to build transformations
261
190
  */
262
- orderZone(): RangeImpl;
191
+ constructor(initialOperationId: UID, applyOperation: (data: T) => void, revertOperation: (data: T) => void, buildEmpty: (id: UID) => T, buildTransformation: TransformationFactory<T>);
263
192
  /**
264
- *
265
- * @param rangeParams optional, values to put in the cloned range instead of the current values of the range
193
+ * Return the operation identified by its id.
266
194
  */
267
- clone(rangeParams?: Partial<ConstructorArgs>): RangeImpl;
195
+ get(operationId: UID): T;
196
+ /**
197
+ * Append a new operation as the last one
198
+ */
199
+ append(operationId: UID, data: T): void;
200
+ /**
201
+ * Insert a new operation after a specific operation (may not be the last operation).
202
+ * Following operations will be transformed according
203
+ * to the new operation.
204
+ */
205
+ insert(operationId: UID, data: T, insertAfter: UID): void;
206
+ /**
207
+ * @param operationId operation to undo
208
+ * @param undoId the id of the "undo operation"
209
+ * @param insertAfter the id of the operation after which to insert the undo
210
+ */
211
+ undo(operationId: UID, undoId: UID, insertAfter: UID): void;
212
+ /**
213
+ * @param operationId operation to redo
214
+ * @param redoId the if of the "redo operation"
215
+ * @param insertAfter the id of the operation after which to insert the redo
216
+ */
217
+ redo(operationId: UID, redoId: UID, insertAfter: UID): void;
218
+ drop(operationId: UID): void;
219
+ getRevertedExecution(): T[];
220
+ /**
221
+ * Revert the state as it was *before* the given operation was executed.
222
+ */
223
+ private revertBefore;
224
+ /**
225
+ * Revert the state as it was *after* the given operation was executed.
226
+ */
227
+ private revertTo;
228
+ /**
229
+ * Revert an execution
230
+ */
231
+ private revert;
232
+ /**
233
+ * Replay the operations between the current HEAD_BRANCH and the end of the tree
234
+ */
235
+ private fastForward;
268
236
  }
269
237
 
270
- declare class UuidGenerator {
271
- private isFastIdStrategy;
272
- private fastIdStart;
273
- setIsFastStrategy(isFast: boolean): void;
274
- uuidv4(): string;
238
+ declare type ClientId = string;
239
+ interface Client {
240
+ id: ClientId;
241
+ name: string;
242
+ position?: ClientPosition;
275
243
  }
276
-
277
- /**
278
- * Convert from a cartesian reference to a Zone.
279
- * Will return throw an error if given a unbounded zone (eg : A:A).
280
- *
281
- * Examples:
282
- * "A1" ==> Top 0, Bottom 0, Left: 0, Right: 0
283
- * "B1:B3" ==> Top 0, Bottom 3, Left: 1, Right: 1
284
- * "Sheet1!A1" ==> Top 0, Bottom 0, Left: 0, Right: 0
285
- * "Sheet1!B1:B3" ==> Top 0, Bottom 3, Left: 1, Right: 1
286
- *
287
- * @param xc the string reference to convert
288
- *
289
- */
290
- declare function toZone(xc: string): Zone;
291
- /**
292
- * This function will compare the modifications of selection to determine
293
- * a cell that is part of the new zone and not the previous one.
294
- */
295
- declare function findCellInNewZone(oldZone: Zone, currentZone: Zone): Position$1;
296
- declare function positionToZone(position: Position$1): {
297
- left: HeaderIndex;
298
- right: HeaderIndex;
299
- top: HeaderIndex;
300
- bottom: HeaderIndex;
301
- };
302
-
303
- interface SelectionEventPayload {
304
- anchor: AnchorZone;
305
- previousAnchor: AnchorZone;
306
- mode: "newAnchor" | "overrideSelection" | "updateAnchor";
244
+ interface ClientPosition {
245
+ sheetId: UID;
246
+ col: HeaderIndex;
247
+ row: HeaderIndex;
307
248
  }
308
- interface ZonesSelected extends SelectionEventPayload {
309
- type: "ZonesSelected";
249
+ interface RemoteRevisionReceivedEvent {
250
+ type: "remote-revision-received";
251
+ commands: readonly CoreCommand[];
310
252
  }
311
- interface HeadersSelected extends SelectionEventPayload {
312
- type: "HeadersSelected";
253
+ interface RevisionAcknowledgedEvent {
254
+ type: "revision-acknowledged";
255
+ revisionId: UID;
313
256
  }
314
- interface AlterZone extends SelectionEventPayload {
315
- type: "AlterZone";
257
+ interface RevisionUndone {
258
+ type: "revision-undone";
259
+ revisionId: UID;
260
+ commands: readonly CoreCommand[];
316
261
  }
317
- declare type SelectionEvent = Readonly<ZonesSelected | HeadersSelected | AlterZone>;
318
-
319
- interface StreamCallbacks<Event> {
320
- handleEvent: (event: Event) => void;
321
- /** this callback will only be called when another consumer captures the stream,
322
- * not when the current consumer decides to release itself */
323
- release?: () => void;
262
+ interface RevisionRedone {
263
+ type: "revision-redone";
264
+ revisionId: UID;
265
+ commands: readonly CoreCommand[];
324
266
  }
325
-
326
- declare type StatefulStream<Event, State> = {
327
- capture(owner: unknown, state: State, callbacks: StreamCallbacks<Event>): void;
328
- registerAsDefault: (owner: unknown, state: State, callbacks: StreamCallbacks<Event>) => void;
329
- resetDefaultAnchor: (owner: unknown, state: State) => void;
330
- resetAnchor: (owner: unknown, state: State) => void;
331
- observe: (owner: unknown, callbacks: StreamCallbacks<Event>) => void;
332
- release: (owner: unknown) => void;
333
- getBackToDefault(): void;
334
- };
335
- /**
336
- * Allows to select cells in the grid and update the selection
337
- */
338
- interface SelectionProcessor {
339
- selectZone(anchor: AnchorZone): DispatchResult;
340
- selectCell(col: number, row: number): DispatchResult;
341
- moveAnchorCell(direction: SelectionDirection, step: SelectionStep): DispatchResult;
342
- setAnchorCorner(col: number, row: number): DispatchResult;
343
- addCellToSelection(col: number, row: number): DispatchResult;
344
- resizeAnchorZone(direction: SelectionDirection, step: SelectionStep): DispatchResult;
345
- selectColumn(index: number, mode: SelectionEvent["mode"]): DispatchResult;
346
- selectRow(index: number, mode: SelectionEvent["mode"]): DispatchResult;
347
- selectAll(): DispatchResult;
348
- loopSelection(): DispatchResult;
349
- selectTableAroundSelection(): DispatchResult;
267
+ interface CollaborativeEventReceived {
268
+ type: "collaborative-event-received";
350
269
  }
351
- declare type SelectionStreamProcessor = SelectionProcessor & StatefulStream<SelectionEvent, AnchorZone>;
270
+ interface UnexpectedRevisionIdEvent {
271
+ type: "unexpected-revision-id";
272
+ revisionId: UID;
273
+ }
274
+ interface NewLocalStateUpdateEvent {
275
+ type: "new-local-state-update";
276
+ id: UID;
277
+ }
278
+ interface RevisionsDroppedEvent {
279
+ type: "pending-revisions-dropped";
280
+ revisionIds: UID[];
281
+ }
282
+ interface SnapshotEvent {
283
+ type: "snapshot";
284
+ }
285
+ declare type CollaborativeEvent = NewLocalStateUpdateEvent | UnexpectedRevisionIdEvent | RemoteRevisionReceivedEvent | RevisionAcknowledgedEvent | RevisionUndone | RevisionRedone | RevisionsDroppedEvent | SnapshotEvent | CollaborativeEventReceived;
352
286
 
353
287
  declare type XLSXExportFile = XLSXExportImageFile | XLSXExportXMLFile;
354
288
  interface XLSXExportXMLFile {
@@ -725,140 +659,392 @@ interface ExcelFilterData {
725
659
  filteredValues: string[];
726
660
  }
727
661
 
728
- declare type ClientId = string;
729
- interface Client {
730
- id: ClientId;
731
- name: string;
732
- position?: ClientPosition;
733
- }
734
- interface ClientPosition {
735
- sheetId: UID;
736
- col: HeaderIndex;
737
- row: HeaderIndex;
662
+ interface AbstractMessage {
663
+ version: number;
738
664
  }
739
- interface RemoteRevisionReceivedEvent {
740
- type: "remote-revision-received";
665
+ interface RemoteRevisionMessage extends AbstractMessage {
666
+ type: "REMOTE_REVISION";
667
+ clientId: ClientId;
741
668
  commands: readonly CoreCommand[];
669
+ nextRevisionId: UID;
670
+ serverRevisionId: UID;
742
671
  }
743
- interface RevisionAcknowledgedEvent {
744
- type: "revision-acknowledged";
745
- revisionId: UID;
672
+ interface RevisionUndoneMessage extends AbstractMessage {
673
+ type: "REVISION_UNDONE";
674
+ undoneRevisionId: UID;
675
+ nextRevisionId: UID;
676
+ serverRevisionId: UID;
746
677
  }
747
- interface RevisionUndone {
748
- type: "revision-undone";
749
- revisionId: UID;
750
- commands: readonly CoreCommand[];
678
+ interface RevisionRedoneMessage extends AbstractMessage {
679
+ type: "REVISION_REDONE";
680
+ redoneRevisionId: UID;
681
+ nextRevisionId: UID;
682
+ serverRevisionId: UID;
751
683
  }
752
- interface RevisionRedone {
753
- type: "revision-redone";
754
- revisionId: UID;
755
- commands: readonly CoreCommand[];
684
+ interface ClientJoinedMessage extends AbstractMessage {
685
+ type: "CLIENT_JOINED";
686
+ client: Required<Client>;
756
687
  }
757
- interface CollaborativeEventReceived {
758
- type: "collaborative-event-received";
688
+ interface ClientLeftMessage extends AbstractMessage {
689
+ type: "CLIENT_LEFT";
690
+ clientId: ClientId;
759
691
  }
760
- interface UnexpectedRevisionIdEvent {
761
- type: "unexpected-revision-id";
762
- revisionId: UID;
692
+ interface ClientMovedMessage extends AbstractMessage {
693
+ type: "CLIENT_MOVED";
694
+ client: Required<Client>;
763
695
  }
764
- interface NewLocalStateUpdateEvent {
765
- type: "new-local-state-update";
766
- id: UID;
696
+ /**
697
+ * Send a snapshot of the spreadsheet to the collaborative server
698
+ */
699
+ interface SnapshotMessage extends AbstractMessage {
700
+ type: "SNAPSHOT";
701
+ data: WorkbookData;
702
+ serverRevisionId: UID;
703
+ nextRevisionId: UID;
767
704
  }
768
- interface RevisionsDroppedEvent {
769
- type: "pending-revisions-dropped";
770
- revisionIds: UID[];
705
+ /**
706
+ * Notify all clients that the server has a new snapshot of the
707
+ * spreadsheet and that the previous history may be lost.
708
+ */
709
+ interface SnapshotCreatedMessage extends AbstractMessage {
710
+ type: "SNAPSHOT_CREATED";
711
+ serverRevisionId: UID;
712
+ nextRevisionId: UID;
771
713
  }
772
- interface SnapshotEvent {
773
- type: "snapshot";
714
+ declare type CollaborationMessage = RevisionUndoneMessage | RevisionRedoneMessage | RemoteRevisionMessage | SnapshotMessage | SnapshotCreatedMessage | ClientMovedMessage | ClientJoinedMessage | ClientLeftMessage;
715
+ declare type StateUpdateMessage = Extract<CollaborationMessage, {
716
+ nextRevisionId: UID;
717
+ }>;
718
+ declare type NewMessageCallback<T = any> = (message: T) => void;
719
+ /**
720
+ * The transport service allows to communicate between multiple clients.
721
+ * A client can send any message to others.
722
+ * The service will handle all networking details internally.
723
+ */
724
+ interface TransportService<T = any> {
725
+ /**
726
+ * Send a message to all clients
727
+ */
728
+ sendMessage: (message: T) => void;
729
+ /**
730
+ * Register a callback function which will be called each time
731
+ * a new message is received.
732
+ * The new message is given to the callback.
733
+ *
734
+ * ```js
735
+ * transportService.onNewMessage(id, (message) => {
736
+ * // ... handle the new message
737
+ * })
738
+ * ```
739
+ * The `id` is used to unregister this callback when the session is closed.
740
+ */
741
+ onNewMessage: (id: UID, callback: NewMessageCallback<T>) => void;
742
+ /**
743
+ * Unregister a callback linked to the given id
744
+ */
745
+ leave: (id: UID) => void;
746
+ }
747
+
748
+ declare class Revision implements RevisionData {
749
+ readonly rootCommand?: "SNAPSHOT" | Command | "REMOTE" | undefined;
750
+ readonly id: UID;
751
+ readonly clientId: ClientId;
752
+ private _commands;
753
+ private _changes;
754
+ /**
755
+ * A revision represents a whole client action (Create a sheet, merge a Zone, Undo, ...).
756
+ * A revision contains the following information:
757
+ * - id: ID of the revision
758
+ * - commands: CoreCommands that are linked to the action, and should be
759
+ * dispatched in other clients
760
+ * - clientId: Client who initiated the action
761
+ * - changes: List of changes applied on the state.
762
+ */
763
+ constructor(id: UID, clientId: ClientId, commands: readonly CoreCommand[], rootCommand?: "SNAPSHOT" | Command | "REMOTE" | undefined, changes?: readonly HistoryChange[]);
764
+ setChanges(changes: readonly HistoryChange[]): void;
765
+ get commands(): readonly CoreCommand[];
766
+ get changes(): readonly HistoryChange[];
767
+ }
768
+
769
+ declare class Session extends EventBus<CollaborativeEvent> {
770
+ private revisions;
771
+ private transportService;
772
+ private serverRevisionId;
773
+ /**
774
+ * Positions of the others client.
775
+ */
776
+ private clients;
777
+ private clientId;
778
+ /**
779
+ * Id of the server revision
780
+ */
781
+ private debouncedMove;
782
+ private pendingMessages;
783
+ private waitingAck;
784
+ /**
785
+ * Flag used to block all commands when an undo or redo is triggered, until
786
+ * it is accepted on the server
787
+ */
788
+ private waitingUndoRedoAck;
789
+ private isReplayingInitialRevisions;
790
+ private processedRevisions;
791
+ private uuidGenerator;
792
+ /**
793
+ * Manages the collaboration between multiple users on the same spreadsheet.
794
+ * It can forward local state changes to other users to ensure they all eventually
795
+ * reach the same state.
796
+ * It also manages the positions of each clients in the spreadsheet to provide
797
+ * a visual indication of what other users are doing in the spreadsheet.
798
+ *
799
+ * @param revisions
800
+ * @param transportService communication channel used to send and receive messages
801
+ * between all connected clients
802
+ * @param client the client connected locally
803
+ * @param serverRevisionId
804
+ */
805
+ constructor(revisions: SelectiveHistory<Revision>, transportService: TransportService<CollaborationMessage>, serverRevisionId?: UID);
806
+ canApplyOptimisticUpdate(): boolean;
807
+ /**
808
+ * Add a new revision to the collaborative session.
809
+ * It will be transmitted to all other connected clients.
810
+ */
811
+ save(rootCommand: Command, commands: CoreCommand[], changes: HistoryChange[]): void;
812
+ undo(revisionId: UID): void;
813
+ redo(revisionId: UID): void;
814
+ /**
815
+ * Notify that the position of the client has changed
816
+ */
817
+ move(position: ClientPosition): void;
818
+ join(client?: Client): void;
819
+ loadInitialMessages(messages: StateUpdateMessage[]): void;
820
+ /**
821
+ * Notify the server that the user client left the collaborative session
822
+ */
823
+ leave(): void;
824
+ /**
825
+ * Send a snapshot of the spreadsheet to the collaboration server
826
+ */
827
+ snapshot(data: WorkbookData): void;
828
+ getClient(): Client;
829
+ getConnectedClients(): Set<Client>;
830
+ getRevisionId(): UID;
831
+ isFullySynchronized(): boolean;
832
+ /**
833
+ * Get the last local revision whose root command isn't in the given list of ignored commands
834
+ * */
835
+ getLastLocalNonEmptyRevision(ignoredRootCommands: CommandTypes[]): Revision | undefined;
836
+ private _move;
837
+ /**
838
+ * Handles messages received from other clients in the collaborative
839
+ * session.
840
+ */
841
+ private onMessageReceived;
842
+ private onClientMoved;
843
+ /**
844
+ * Register the new client and send your
845
+ * own position back.
846
+ */
847
+ private onClientJoined;
848
+ private onClientLeft;
849
+ private sendUpdateMessage;
850
+ /**
851
+ * Send the next pending message
852
+ */
853
+ private sendPendingMessage;
854
+ private acknowledge;
855
+ private isAlreadyProcessed;
856
+ private dropPendingHistoryMessages;
774
857
  }
775
- declare type CollaborativeEvent = NewLocalStateUpdateEvent | UnexpectedRevisionIdEvent | RemoteRevisionReceivedEvent | RevisionAcknowledgedEvent | RevisionUndone | RevisionRedone | RevisionsDroppedEvent | SnapshotEvent | CollaborativeEventReceived;
776
858
 
777
- interface AbstractMessage {
778
- version: number;
779
- }
780
- interface RemoteRevisionMessage extends AbstractMessage {
781
- type: "REMOTE_REVISION";
782
- clientId: ClientId;
783
- commands: readonly CoreCommand[];
784
- nextRevisionId: UID;
785
- serverRevisionId: UID;
786
- }
787
- interface RevisionUndoneMessage extends AbstractMessage {
788
- type: "REVISION_UNDONE";
789
- undoneRevisionId: UID;
790
- nextRevisionId: UID;
791
- serverRevisionId: UID;
792
- }
793
- interface RevisionRedoneMessage extends AbstractMessage {
794
- type: "REVISION_REDONE";
795
- redoneRevisionId: UID;
796
- nextRevisionId: UID;
797
- serverRevisionId: UID;
798
- }
799
- interface ClientJoinedMessage extends AbstractMessage {
800
- type: "CLIENT_JOINED";
801
- client: Required<Client>;
802
- }
803
- interface ClientLeftMessage extends AbstractMessage {
804
- type: "CLIENT_LEFT";
805
- clientId: ClientId;
806
- }
807
- interface ClientMovedMessage extends AbstractMessage {
808
- type: "CLIENT_MOVED";
809
- client: Required<Client>;
810
- }
811
859
  /**
812
- * Send a snapshot of the spreadsheet to the collaborative server
860
+ * RGBA to HEX representation (#RRGGBBAA).
861
+ *
862
+ * https://css-tricks.com/converting-color-spaces-in-javascript/
813
863
  */
814
- interface SnapshotMessage extends AbstractMessage {
815
- type: "SNAPSHOT";
816
- data: WorkbookData;
817
- serverRevisionId: UID;
818
- nextRevisionId: UID;
819
- }
864
+ declare function rgbaToHex(rgba: RGBA): Color;
820
865
  /**
821
- * Notify all clients that the server has a new snapshot of the
822
- * spreadsheet and that the previous history may be lost.
866
+ * Color string to RGBA representation
823
867
  */
824
- interface SnapshotCreatedMessage extends AbstractMessage {
825
- type: "SNAPSHOT_CREATED";
826
- serverRevisionId: UID;
827
- nextRevisionId: UID;
828
- }
829
- declare type CollaborationMessage = RevisionUndoneMessage | RevisionRedoneMessage | RemoteRevisionMessage | SnapshotMessage | SnapshotCreatedMessage | ClientMovedMessage | ClientJoinedMessage | ClientLeftMessage;
830
- declare type StateUpdateMessage = Extract<CollaborationMessage, {
831
- nextRevisionId: UID;
832
- }>;
833
- declare type NewMessageCallback<T = any> = (message: T) => void;
868
+ declare function colorToRGBA(color: Color): RGBA;
869
+
834
870
  /**
835
- * The transport service allows to communicate between multiple clients.
836
- * A client can send any message to others.
837
- * The service will handle all networking details internally.
871
+ * Convert a (col) number to the corresponding letter.
872
+ *
873
+ * Examples:
874
+ * 0 => 'A'
875
+ * 25 => 'Z'
876
+ * 26 => 'AA'
877
+ * 27 => 'AB'
838
878
  */
839
- interface TransportService<T = any> {
879
+ declare function numberToLetters(n: number): string;
880
+ /**
881
+ * Convert a "XC" coordinate to cartesian coordinates.
882
+ *
883
+ * Examples:
884
+ * A1 => [0,0]
885
+ * B3 => [1,2]
886
+ *
887
+ * Note: it also accepts lowercase coordinates, but not fixed references
888
+ */
889
+ declare function toCartesian(xc: string): Position$1;
890
+ /**
891
+ * Convert from cartesian coordinate to the "XC" coordinate system.
892
+ *
893
+ * Examples:
894
+ * - 0,0 => A1
895
+ * - 1,2 => B3
896
+ * - 0,0, {colFixed: false, rowFixed: true} => A$1
897
+ * - 1,2, {colFixed: true, rowFixed: false} => $B3
898
+ */
899
+ declare function toXC(col: HeaderIndex, row: HeaderIndex, rangePart?: RangePart): string;
900
+
901
+ /**
902
+ * Formats a cell value with its format.
903
+ */
904
+ declare function formatValue(value: CellValue, format?: Format): FormattedValue;
905
+
906
+ declare function computeTextWidth(context: CanvasRenderingContext2D, text: string, style: Style): number;
907
+ declare function isMarkdownLink(str: string): boolean;
908
+ /**
909
+ * Build a markdown link from a label and an url
910
+ */
911
+ declare function markdownLink(label: string, url: string): string;
912
+ declare function parseMarkdownLink(str: string): {
913
+ url: string;
914
+ label: string;
915
+ };
916
+ /**
917
+ * This helper function can be used as a type guard when filtering arrays.
918
+ * const foo: number[] = [1, 2, undefined, 4].filter(isDefined)
919
+ */
920
+ declare function isDefined<T>(argument: T | undefined): argument is T;
921
+ /**
922
+ * Lazy value computed by the provided function.
923
+ */
924
+ declare function lazy<T>(fn: (() => T) | T): Lazy<T>;
925
+
926
+ interface ConstructorArgs {
927
+ readonly zone: Readonly<Zone | UnboundedZone>;
928
+ readonly parts: readonly RangePart[];
929
+ readonly invalidXc?: string;
930
+ /** true if the user provided the range with the sheet name */
931
+ readonly prefixSheet: boolean;
932
+ /** the name of any sheet that is invalid */
933
+ readonly invalidSheetName?: string;
934
+ /** the sheet on which the range is defined */
935
+ readonly sheetId: UID;
936
+ }
937
+ declare class RangeImpl implements Range {
938
+ private getSheetSize;
939
+ private readonly _zone;
940
+ readonly parts: Range["parts"];
941
+ readonly invalidXc?: string;
942
+ readonly prefixSheet: boolean;
943
+ readonly sheetId: UID;
944
+ readonly invalidSheetName?: string;
945
+ constructor(args: ConstructorArgs, getSheetSize: (sheetId: UID) => ZoneDimension);
946
+ static fromRange(range: Range, getters: CoreGetters): RangeImpl;
947
+ get unboundedZone(): UnboundedZone;
948
+ get zone(): Zone;
949
+ static getRangeParts(xc: string, zone: UnboundedZone): RangePart[];
950
+ get isFullCol(): boolean;
951
+ get isFullRow(): boolean;
952
+ get rangeData(): RangeData;
840
953
  /**
841
- * Send a message to all clients
954
+ * Check that a zone is valid regarding the order of top-bottom and left-right.
955
+ * Left should be smaller than right, top should be smaller than bottom.
956
+ * If it's not the case, simply invert them, and invert the linked parts
842
957
  */
843
- sendMessage: (message: T) => void;
958
+ orderZone(): RangeImpl;
844
959
  /**
845
- * Register a callback function which will be called each time
846
- * a new message is received.
847
- * The new message is given to the callback.
848
960
  *
849
- * ```js
850
- * transportService.onNewMessage(id, (message) => {
851
- * // ... handle the new message
852
- * })
853
- * ```
854
- * The `id` is used to unregister this callback when the session is closed.
855
- */
856
- onNewMessage: (id: UID, callback: NewMessageCallback<T>) => void;
857
- /**
858
- * Unregister a callback linked to the given id
961
+ * @param rangeParams optional, values to put in the cloned range instead of the current values of the range
859
962
  */
860
- leave: (id: UID) => void;
963
+ clone(rangeParams?: Partial<ConstructorArgs>): RangeImpl;
964
+ }
965
+
966
+ declare class UuidGenerator {
967
+ private isFastIdStrategy;
968
+ private fastIdStart;
969
+ setIsFastStrategy(isFast: boolean): void;
970
+ uuidv4(): string;
971
+ }
972
+
973
+ /**
974
+ * Convert from a cartesian reference to a Zone.
975
+ * Will return throw an error if given a unbounded zone (eg : A:A).
976
+ *
977
+ * Examples:
978
+ * "A1" ==> Top 0, Bottom 0, Left: 0, Right: 0
979
+ * "B1:B3" ==> Top 0, Bottom 3, Left: 1, Right: 1
980
+ * "Sheet1!A1" ==> Top 0, Bottom 0, Left: 0, Right: 0
981
+ * "Sheet1!B1:B3" ==> Top 0, Bottom 3, Left: 1, Right: 1
982
+ *
983
+ * @param xc the string reference to convert
984
+ *
985
+ */
986
+ declare function toZone(xc: string): Zone;
987
+ /**
988
+ * This function will compare the modifications of selection to determine
989
+ * a cell that is part of the new zone and not the previous one.
990
+ */
991
+ declare function findCellInNewZone(oldZone: Zone, currentZone: Zone): Position$1;
992
+ declare function positionToZone(position: Position$1): {
993
+ left: HeaderIndex;
994
+ right: HeaderIndex;
995
+ top: HeaderIndex;
996
+ bottom: HeaderIndex;
997
+ };
998
+
999
+ interface SelectionEventPayload {
1000
+ anchor: AnchorZone;
1001
+ previousAnchor: AnchorZone;
1002
+ mode: "newAnchor" | "overrideSelection" | "updateAnchor";
1003
+ }
1004
+ interface ZonesSelected extends SelectionEventPayload {
1005
+ type: "ZonesSelected";
1006
+ }
1007
+ interface HeadersSelected extends SelectionEventPayload {
1008
+ type: "HeadersSelected";
1009
+ }
1010
+ interface AlterZone extends SelectionEventPayload {
1011
+ type: "AlterZone";
1012
+ }
1013
+ declare type SelectionEvent = Readonly<ZonesSelected | HeadersSelected | AlterZone>;
1014
+
1015
+ interface StreamCallbacks<Event> {
1016
+ handleEvent: (event: Event) => void;
1017
+ /** this callback will only be called when another consumer captures the stream,
1018
+ * not when the current consumer decides to release itself */
1019
+ release?: () => void;
1020
+ }
1021
+
1022
+ declare type StatefulStream<Event, State> = {
1023
+ capture(owner: unknown, state: State, callbacks: StreamCallbacks<Event>): void;
1024
+ registerAsDefault: (owner: unknown, state: State, callbacks: StreamCallbacks<Event>) => void;
1025
+ resetDefaultAnchor: (owner: unknown, state: State) => void;
1026
+ resetAnchor: (owner: unknown, state: State) => void;
1027
+ observe: (owner: unknown, callbacks: StreamCallbacks<Event>) => void;
1028
+ release: (owner: unknown) => void;
1029
+ getBackToDefault(): void;
1030
+ };
1031
+ /**
1032
+ * Allows to select cells in the grid and update the selection
1033
+ */
1034
+ interface SelectionProcessor {
1035
+ selectZone(anchor: AnchorZone): DispatchResult;
1036
+ selectCell(col: number, row: number): DispatchResult;
1037
+ moveAnchorCell(direction: SelectionDirection, step: SelectionStep): DispatchResult;
1038
+ setAnchorCorner(col: number, row: number): DispatchResult;
1039
+ addCellToSelection(col: number, row: number): DispatchResult;
1040
+ resizeAnchorZone(direction: SelectionDirection, step: SelectionStep): DispatchResult;
1041
+ selectColumn(index: number, mode: SelectionEvent["mode"]): DispatchResult;
1042
+ selectRow(index: number, mode: SelectionEvent["mode"]): DispatchResult;
1043
+ selectAll(): DispatchResult;
1044
+ loopSelection(): DispatchResult;
1045
+ selectTableAroundSelection(): DispatchResult;
861
1046
  }
1047
+ declare type SelectionStreamProcessor = SelectionProcessor & StatefulStream<SelectionEvent, AnchorZone>;
862
1048
 
863
1049
  declare type FilePath = string;
864
1050
  /**
@@ -944,7 +1130,6 @@ declare class Model extends EventBus<any> implements CommandDispatcher {
944
1130
  private featurePlugins;
945
1131
  private statefulUIPlugins;
946
1132
  private coreViewsPlugins;
947
- private history;
948
1133
  private range;
949
1134
  private session;
950
1135
  /**
@@ -984,10 +1169,9 @@ declare class Model extends EventBus<any> implements CommandDispatcher {
984
1169
  */
985
1170
  private coreGetters;
986
1171
  uuidGenerator: UuidGenerator;
1172
+ private readonly handlers;
1173
+ private readonly coreHandlers;
987
1174
  constructor(data?: any, config?: Partial<ModelConfig>, stateUpdateMessages?: StateUpdateMessage[], uuidGenerator?: UuidGenerator, verboseImport?: boolean);
988
- get handlers(): CommandHandler<Command>[];
989
- get coreHandlers(): CommandHandler<Command>[];
990
- get allUIPlugins(): UIPlugin[];
991
1175
  joinSession(): void;
992
1176
  leaveSession(): void;
993
1177
  private setupUiPlugin;
@@ -1172,6 +1356,7 @@ interface UIPluginConfig {
1172
1356
  readonly uiActions: UIActions;
1173
1357
  readonly custom: ModelConfig["custom"];
1174
1358
  readonly lazyEvaluation: boolean;
1359
+ readonly session: Session;
1175
1360
  }
1176
1361
  interface UIPluginConstructor {
1177
1362
  new (config: UIPluginConfig): UIPlugin;
@@ -1476,8 +1661,8 @@ interface PositionDependentCommand {
1476
1661
  col: number;
1477
1662
  row: number;
1478
1663
  }
1479
- 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">;
1480
- 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">;
1664
+ 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" | "SORT_CELLS" | "SET_DECIMAL" | "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" | "REPEAT_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" | "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">;
1665
+ 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" | "SORT_CELLS" | "SET_DECIMAL" | "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" | "REPEAT_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" | "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">;
1481
1666
  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">;
1482
1667
  interface UpdateCellCommand extends PositionDependentCommand {
1483
1668
  type: "UPDATE_CELL";
@@ -1690,6 +1875,11 @@ interface PasteCommand {
1690
1875
  target: Zone[];
1691
1876
  pasteOption?: ClipboardPasteOptions;
1692
1877
  }
1878
+ interface RepeatPasteCommand {
1879
+ type: "REPEAT_PASTE";
1880
+ target: Zone[];
1881
+ pasteOption?: ClipboardPasteOptions;
1882
+ }
1693
1883
  interface CleanClipBoardHighlightCommand {
1694
1884
  type: "CLEAN_CLIPBOARD_HIGHLIGHT";
1695
1885
  }
@@ -1800,11 +1990,8 @@ interface DeleteContentCommand {
1800
1990
  sheetId: UID;
1801
1991
  target: Zone[];
1802
1992
  }
1803
- interface ClearCellCommand {
1993
+ interface ClearCellCommand extends PositionDependentCommand {
1804
1994
  type: "CLEAR_CELL";
1805
- sheetId: UID;
1806
- col: HeaderIndex;
1807
- row: HeaderIndex;
1808
1995
  }
1809
1996
  interface UndoCommand {
1810
1997
  type: "UNDO";
@@ -2034,7 +2221,7 @@ UpdateCellCommand | UpdateCellPositionCommand | ClearCellCommand | DeleteContent
2034
2221
  | CreateImageOverCommand
2035
2222
  /** FILTERS */
2036
2223
  | CreateFilterTableCommand | RemoveFilterTableCommand;
2037
- 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;
2224
+ declare type LocalCommand = RequestUndoCommand | RequestRedoCommand | UndoCommand | RedoCommand | NewInputCommand | RemoveInputCommand | UnfocusInputCommand | FocusInputCommand | AddEmptyRangeCommand | RemoveRangeCommand | ChangeRangeCommand | CopyCommand | CutCommand | PasteCommand | RepeatPasteCommand | 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;
2038
2225
  declare type Command = CoreCommand | LocalCommand;
2039
2226
  /**
2040
2227
  * Holds the result of a command dispatch.
@@ -2555,281 +2742,69 @@ declare type TranslationFunction = (string: string, ...values: string[] | [{
2555
2742
  /***
2556
2743
  * Allow to inject a translation function from outside o-spreadsheet.
2557
2744
  * @param tfn the function that will do the translation
2558
- */
2559
- declare function setTranslationMethod(tfn: TranslationFunction): void;
2560
-
2561
- interface EditTextOptions {
2562
- error?: string;
2563
- placeholder?: string;
2564
- }
2565
- interface InformationNotification {
2566
- text: string;
2567
- tag: string;
2568
- }
2569
- interface SpreadsheetEnv {
2570
- notifyUser: (notification: InformationNotification) => any;
2571
- raiseError: (text: string, callback?: () => void) => any;
2572
- askConfirmation: (content: string, confirm: () => any, cancel?: () => any) => any;
2573
- editText: (title: string, callback: (text: string | null) => any, options?: EditTextOptions) => any;
2574
- }
2575
- interface SpreadsheetChildEnv extends SpreadsheetEnv {
2576
- model: Model;
2577
- imageProvider?: ImageProviderInterface;
2578
- isDashboard: () => boolean;
2579
- openSidePanel: (panel: string, panelProps?: any) => void;
2580
- toggleSidePanel: (panel: string, panelProps?: any) => void;
2581
- clipboard: ClipboardInterface;
2582
- _t: TranslationFunction;
2583
- startCellEdition: (content: string) => void;
2584
- loadCurrencies?: () => Promise<Currency[]>;
2585
- }
2586
-
2587
- declare type ArgType = "ANY" | "BOOLEAN" | "NUMBER" | "STRING" | "DATE" | "RANGE" | "RANGE<BOOLEAN>" | "RANGE<NUMBER>" | "RANGE<DATE>" | "RANGE<STRING>" | "META";
2588
- interface ArgDefinition {
2589
- repeating?: boolean;
2590
- optional?: boolean;
2591
- lazy?: boolean;
2592
- description: string;
2593
- name: string;
2594
- type: ArgType[];
2595
- default?: boolean;
2596
- defaultValue?: any;
2597
- }
2598
- declare type ComputeFunctionArg<T> = T | (() => T) | undefined;
2599
- declare type ComputeFunction<T, R> = (this: EvalContext, ...args: ComputeFunctionArg<T>[]) => R;
2600
- interface AddFunctionDescription {
2601
- description: string;
2602
- compute: ComputeFunction<ArgValue, FunctionReturnValue>;
2603
- computeFormat?: ComputeFunction<Arg, Format | undefined>;
2604
- category?: string;
2605
- args: ArgDefinition[];
2606
- returns: [ArgType];
2607
- isExported?: boolean;
2608
- hidden?: boolean;
2609
- }
2610
- interface FunctionDescription extends AddFunctionDescription {
2611
- minArgRequired: number;
2612
- maxArgPossible: number;
2613
- nbrArgRepeating: number;
2614
- getArgToFocus: (argPosition: number) => number;
2615
- }
2616
- declare type EvalContext = {
2617
- __lastFnCalled?: string;
2618
- __originCellXC?: () => string;
2619
- [key: string]: any;
2620
- };
2621
-
2622
- declare class SelectiveHistory<T = unknown> {
2623
- private applyOperation;
2624
- private revertOperation;
2625
- private buildEmpty;
2626
- private readonly buildTransformation;
2627
- private HEAD_BRANCH;
2628
- private HEAD_OPERATION;
2629
- private tree;
2630
- /**
2631
- * The selective history is a data structure used to register changes/updates of a state.
2632
- * Each change/update is called an "operation".
2633
- * The data structure allows to easily cancel (and redo) any operation individually.
2634
- * An operation can be represented by any data structure. It can be a "command", a "diff", etc.
2635
- * However it must have the following properties:
2636
- * - it can be applied to modify the state
2637
- * - it can be reverted on the state such that it was never executed.
2638
- * - it can be transformed given other operation (Operational Transformation)
2639
- *
2640
- * Since this data structure doesn't know anything about the state nor the structure of
2641
- * operations, the actual work must be performed by external functions given as parameters.
2642
- * @param initialOperationId
2643
- * @param applyOperation a function which can apply an operation to the state
2644
- * @param revertOperation a function which can revert an operation from the state
2645
- * @param buildEmpty a function returning an "empty" operation.
2646
- * i.e an operation that leaves the state unmodified once applied or reverted
2647
- * (used for internal implementation)
2648
- * @param buildTransformation Factory used to build transformations
2649
- */
2650
- constructor(initialOperationId: UID, applyOperation: (data: T) => void, revertOperation: (data: T) => void, buildEmpty: (id: UID) => T, buildTransformation: TransformationFactory<T>);
2651
- /**
2652
- * Return the operation identified by its id.
2653
- */
2654
- get(operationId: UID): T;
2655
- /**
2656
- * Append a new operation as the last one
2657
- */
2658
- append(operationId: UID, data: T): void;
2659
- /**
2660
- * Insert a new operation after a specific operation (may not be the last operation).
2661
- * Following operations will be transformed according
2662
- * to the new operation.
2663
- */
2664
- insert(operationId: UID, data: T, insertAfter: UID): void;
2665
- /**
2666
- * @param operationId operation to undo
2667
- * @param undoId the id of the "undo operation"
2668
- * @param insertAfter the id of the operation after which to insert the undo
2669
- */
2670
- undo(operationId: UID, undoId: UID, insertAfter: UID): void;
2671
- /**
2672
- * @param operationId operation to redo
2673
- * @param redoId the if of the "redo operation"
2674
- * @param insertAfter the id of the operation after which to insert the redo
2675
- */
2676
- redo(operationId: UID, redoId: UID, insertAfter: UID): void;
2677
- drop(operationId: UID): void;
2678
- /**
2679
- * Revert the state as it was *before* the given operation was executed.
2680
- */
2681
- private revertBefore;
2682
- /**
2683
- * Revert the state as it was *after* the given operation was executed.
2684
- */
2685
- private revertTo;
2686
- /**
2687
- * Revert an execution
2688
- */
2689
- private revert;
2690
- /**
2691
- * Replay the operations between the current HEAD_BRANCH and the end of the tree
2692
- */
2693
- private fastForward;
2694
- }
2695
-
2696
- declare class Revision implements RevisionData {
2697
- readonly id: UID;
2698
- readonly clientId: ClientId;
2699
- private _commands;
2700
- private _changes;
2701
- /**
2702
- * A revision represents a whole client action (Create a sheet, merge a Zone, Undo, ...).
2703
- * A revision contains the following information:
2704
- * - id: ID of the revision
2705
- * - commands: CoreCommands that are linked to the action, and should be
2706
- * dispatched in other clients
2707
- * - clientId: Client who initiated the action
2708
- * - changes: List of changes applied on the state.
2709
- */
2710
- constructor(id: UID, clientId: ClientId, commands: readonly CoreCommand[], changes?: readonly HistoryChange[]);
2711
- setChanges(changes: readonly HistoryChange[]): void;
2712
- get commands(): readonly CoreCommand[];
2713
- get changes(): readonly HistoryChange[];
2714
- }
2715
-
2716
- declare class Session extends EventBus<CollaborativeEvent> {
2717
- private revisions;
2718
- private transportService;
2719
- private serverRevisionId;
2720
- /**
2721
- * Positions of the others client.
2722
- */
2723
- private clients;
2724
- private clientId;
2725
- /**
2726
- * Id of the server revision
2727
- */
2728
- private debouncedMove;
2729
- private pendingMessages;
2730
- private waitingAck;
2731
- /**
2732
- * Flag used to block all commands when an undo or redo is triggered, until
2733
- * it is accepted on the server
2734
- */
2735
- private waitingUndoRedoAck;
2736
- private isReplayingInitialRevisions;
2737
- private processedRevisions;
2738
- private uuidGenerator;
2739
- /**
2740
- * Manages the collaboration between multiple users on the same spreadsheet.
2741
- * It can forward local state changes to other users to ensure they all eventually
2742
- * reach the same state.
2743
- * It also manages the positions of each clients in the spreadsheet to provide
2744
- * a visual indication of what other users are doing in the spreadsheet.
2745
- *
2746
- * @param revisions
2747
- * @param transportService communication channel used to send and receive messages
2748
- * between all connected clients
2749
- * @param client the client connected locally
2750
- * @param serverRevisionId
2751
- */
2752
- constructor(revisions: SelectiveHistory<Revision>, transportService: TransportService<CollaborationMessage>, serverRevisionId?: UID);
2753
- canApplyOptimisticUpdate(): boolean;
2754
- /**
2755
- * Add a new revision to the collaborative session.
2756
- * It will be transmitted to all other connected clients.
2757
- */
2758
- save(commands: CoreCommand[], changes: HistoryChange[]): void;
2759
- undo(revisionId: UID): void;
2760
- redo(revisionId: UID): void;
2761
- /**
2762
- * Notify that the position of the client has changed
2763
- */
2764
- move(position: ClientPosition): void;
2765
- join(client?: Client): void;
2766
- loadInitialMessages(messages: StateUpdateMessage[]): void;
2767
- /**
2768
- * Notify the server that the user client left the collaborative session
2769
- */
2770
- leave(): void;
2771
- /**
2772
- * Send a snapshot of the spreadsheet to the collaboration server
2773
- */
2774
- snapshot(data: WorkbookData): void;
2775
- getClient(): Client;
2776
- getConnectedClients(): Set<Client>;
2777
- getRevisionId(): UID;
2778
- isFullySynchronized(): boolean;
2779
- private _move;
2780
- /**
2781
- * Handles messages received from other clients in the collaborative
2782
- * session.
2783
- */
2784
- private onMessageReceived;
2785
- private onClientMoved;
2786
- /**
2787
- * Register the new client and send your
2788
- * own position back.
2789
- */
2790
- private onClientJoined;
2791
- private onClientLeft;
2792
- private sendUpdateMessage;
2793
- /**
2794
- * Send the next pending message
2795
- */
2796
- private sendPendingMessage;
2797
- private acknowledge;
2798
- private isAlreadyProcessed;
2799
- private dropPendingHistoryMessages;
2745
+ */
2746
+ declare function setTranslationMethod(tfn: TranslationFunction): void;
2747
+
2748
+ interface EditTextOptions {
2749
+ error?: string;
2750
+ placeholder?: string;
2751
+ }
2752
+ interface InformationNotification {
2753
+ text: string;
2754
+ tag: string;
2755
+ }
2756
+ interface SpreadsheetEnv {
2757
+ notifyUser: (notification: InformationNotification) => any;
2758
+ raiseError: (text: string, callback?: () => void) => any;
2759
+ askConfirmation: (content: string, confirm: () => any, cancel?: () => any) => any;
2760
+ editText: (title: string, callback: (text: string | null) => any, options?: EditTextOptions) => any;
2761
+ }
2762
+ interface SpreadsheetChildEnv extends SpreadsheetEnv {
2763
+ model: Model;
2764
+ imageProvider?: ImageProviderInterface;
2765
+ isDashboard: () => boolean;
2766
+ openSidePanel: (panel: string, panelProps?: any) => void;
2767
+ toggleSidePanel: (panel: string, panelProps?: any) => void;
2768
+ clipboard: ClipboardInterface;
2769
+ _t: TranslationFunction;
2770
+ startCellEdition: (content: string) => void;
2771
+ loadCurrencies?: () => Promise<Currency[]>;
2800
2772
  }
2801
2773
 
2802
- /**
2803
- * Local History
2804
- *
2805
- * The local history is responsible of tracking the locally state updates
2806
- * It maintains the local undo and redo stack to allow to undo/redo only local
2807
- * changes
2808
- */
2809
- declare class LocalHistory extends EventBus$1 implements CommandHandler<Command> {
2810
- protected dispatch: CommandDispatcher["dispatch"];
2811
- private session;
2812
- /**
2813
- * Ids of the revisions which can be undone
2814
- */
2815
- private undoStack;
2816
- /**
2817
- * Ids of the revisions which can be redone
2818
- */
2819
- private redoStack;
2820
- constructor(dispatch: CommandDispatcher["dispatch"], session: Session);
2821
- allowDispatch(cmd: Command): CommandResult;
2822
- beforeHandle(cmd: Command): void;
2823
- handle(cmd: Command): void;
2824
- finalize(): void;
2825
- private requestHistoryChange;
2826
- canUndo(): boolean;
2827
- canRedo(): boolean;
2828
- private drop;
2829
- private onNewLocalStateUpdate;
2830
- private selectiveUndo;
2831
- private selectiveRedo;
2774
+ declare type ArgType = "ANY" | "BOOLEAN" | "NUMBER" | "STRING" | "DATE" | "RANGE" | "RANGE<BOOLEAN>" | "RANGE<NUMBER>" | "RANGE<DATE>" | "RANGE<STRING>" | "META";
2775
+ interface ArgDefinition {
2776
+ repeating?: boolean;
2777
+ optional?: boolean;
2778
+ lazy?: boolean;
2779
+ description: string;
2780
+ name: string;
2781
+ type: ArgType[];
2782
+ default?: boolean;
2783
+ defaultValue?: any;
2784
+ }
2785
+ declare type ComputeFunctionArg<T> = T | (() => T) | undefined;
2786
+ declare type ComputeFunction<T, R> = (this: EvalContext, ...args: ComputeFunctionArg<T>[]) => R;
2787
+ interface AddFunctionDescription {
2788
+ description: string;
2789
+ compute: ComputeFunction<ArgValue, FunctionReturnValue>;
2790
+ computeFormat?: ComputeFunction<Arg, Format | undefined>;
2791
+ category?: string;
2792
+ args: ArgDefinition[];
2793
+ returns: [ArgType];
2794
+ isExported?: boolean;
2795
+ hidden?: boolean;
2796
+ }
2797
+ interface FunctionDescription extends AddFunctionDescription {
2798
+ minArgRequired: number;
2799
+ maxArgPossible: number;
2800
+ nbrArgRepeating: number;
2801
+ getArgToFocus: (argPosition: number) => number;
2832
2802
  }
2803
+ declare type EvalContext = {
2804
+ __lastFnCalled?: string;
2805
+ __originCellXC?: () => string;
2806
+ [key: string]: any;
2807
+ };
2833
2808
 
2834
2809
  declare class RangeAdapter implements CommandHandler<CoreCommand> {
2835
2810
  private getters;
@@ -3864,8 +3839,8 @@ declare class InternalViewport {
3864
3839
  * until it contains the cell completely.
3865
3840
  */
3866
3841
  adjustPosition(position?: Position$1): void;
3867
- adjustPositionX(col: HeaderIndex): void;
3868
- adjustPositionY(row: HeaderIndex): void;
3842
+ adjustPositionX(targetCol: HeaderIndex): void;
3843
+ adjustPositionY(targetRow: HeaderIndex): void;
3869
3844
  setViewportOffset(offsetX: Pixel, offsetY: Pixel): void;
3870
3845
  adjustViewportZone(): void;
3871
3846
  /**
@@ -4220,7 +4195,12 @@ declare class HeaderVisibilityUIPlugin extends UIPlugin {
4220
4195
  isColHidden(sheetId: UID, index: number): boolean;
4221
4196
  isHeaderHidden(sheetId: UID, dimension: Dimension, index: number): boolean;
4222
4197
  getNextVisibleCellPosition({ sheetId, col, row }: CellPosition): CellPosition;
4223
- findVisibleHeader(sheetId: UID, dimension: Dimension, indexes: number[]): number | undefined;
4198
+ /**
4199
+ * Find the first visible header in the range [`from` => `to`].
4200
+ *
4201
+ * Both `from` and `to` are inclusive.
4202
+ */
4203
+ findVisibleHeader(sheetId: UID, dimension: Dimension, from: number, to: number): number | undefined;
4224
4204
  findLastVisibleColRowIndex(sheetId: UID, dimension: Dimension, { last, first }: {
4225
4205
  first: HeaderIndex;
4226
4206
  last: HeaderIndex;
@@ -4240,6 +4220,42 @@ declare class HighlightPlugin extends UIPlugin {
4240
4220
  drawGrid(renderingContext: GridRenderingContext): void;
4241
4221
  }
4242
4222
 
4223
+ /**
4224
+ * Local History
4225
+ *
4226
+ * The local history is responsible of tracking the locally state updates
4227
+ * It maintains the local undo and redo stack to allow to undo/redo only local
4228
+ * changes
4229
+ */
4230
+ declare class HistoryPlugin extends UIPlugin {
4231
+ static getters: readonly ["canUndo", "canRedo"];
4232
+ /**
4233
+ * Ids of the revisions which can be undone
4234
+ */
4235
+ private undoStack;
4236
+ /**
4237
+ * Ids of the revisions which can be redone
4238
+ */
4239
+ private redoStack;
4240
+ private session;
4241
+ constructor(config: UIPluginConfig);
4242
+ allowDispatch(cmd: Command): CommandResult;
4243
+ handle(cmd: Command): void;
4244
+ finalize(): void;
4245
+ private requestHistoryChange;
4246
+ canUndo(): boolean;
4247
+ canRedo(): boolean;
4248
+ private drop;
4249
+ private onNewLocalStateUpdate;
4250
+ /**
4251
+ * Fetch the last revision which is not empty and not a repeated command
4252
+ *
4253
+ * Ignore repeated commands (REQUEST_REDO command as root command)
4254
+ * Ignore standard undo/redo revisions (that are empty)
4255
+ */
4256
+ private getPossibleRevisionToRepeat;
4257
+ }
4258
+
4243
4259
  declare class RendererPlugin extends UIPlugin {
4244
4260
  static layers: LAYERS[];
4245
4261
  static getters: readonly ["getColDimensionsInViewport", "getRowDimensionsInViewport"];
@@ -4523,6 +4539,7 @@ declare class ClipboardPlugin extends UIPlugin {
4523
4539
  static getters: readonly ["getClipboardContent", "getClipboardTextContent", "isCutOperation", "isPaintingFormat"];
4524
4540
  private status;
4525
4541
  private state?;
4542
+ private lastPasteState?;
4526
4543
  private _isPaintingFormat;
4527
4544
  allowDispatch(cmd: LocalCommand): CommandResult;
4528
4545
  handle(cmd: Command): void;
@@ -4663,10 +4680,7 @@ declare type ImageGetters = Pick<ImagePlugin, GetterNames<typeof ImagePlugin>>;
4663
4680
  declare type FigureGetters = Pick<FigurePlugin, GetterNames<typeof FigurePlugin>>;
4664
4681
  declare type RangeAdapterGetters = Pick<RangeAdapter, GetterNames<typeof RangeAdapter>>;
4665
4682
  declare type ConditionalFormatGetters = Pick<ConditionalFormatPlugin, GetterNames<typeof ConditionalFormatPlugin>>;
4666
- declare type LocalHistoryGetters = {
4667
- canUndo: LocalHistory["canUndo"];
4668
- canRedo: LocalHistory["canRedo"];
4669
- };
4683
+ declare type LocalHistoryGetters = Pick<HistoryPlugin, GetterNames<typeof HistoryPlugin>>;
4670
4684
  declare type FiltersGetters = Pick<FiltersPlugin, GetterNames<typeof FiltersPlugin>>;
4671
4685
  declare type CoreGetters = SheetGetters & HeaderSizeGetters & HeaderVisibilityGetters & CellGetters & MergeGetters & BordersGetters & ChartGetters & ImageGetters & ConditionalFormatGetters & FigureGetters & RangeAdapterGetters & FiltersGetters;
4672
4686
  declare type AutofillGetters = Pick<AutofillPlugin, GetterNames<typeof AutofillPlugin>>;
@@ -4853,7 +4867,7 @@ declare class OTRegistry extends Registry<Map<CoreCommandTypes, TransformationFu
4853
4867
 
4854
4868
  interface CellClickableItem {
4855
4869
  condition: (position: CellPosition, env: SpreadsheetChildEnv) => boolean;
4856
- action: (position: CellPosition, env: SpreadsheetChildEnv) => void;
4870
+ execute: (position: CellPosition, env: SpreadsheetChildEnv) => void;
4857
4871
  sequence: number;
4858
4872
  }
4859
4873
 
@@ -4880,7 +4894,7 @@ interface ChartBuilder {
4880
4894
  sequence: number;
4881
4895
  }
4882
4896
 
4883
- interface Props$B {
4897
+ interface Props$C {
4884
4898
  ranges: string[];
4885
4899
  hasSingleRange?: boolean;
4886
4900
  required?: boolean;
@@ -4902,7 +4916,7 @@ interface SelectionRange extends Omit<RangeInputValue, "color"> {
4902
4916
  * onSelectionChanged is called every time the input value
4903
4917
  * changes.
4904
4918
  */
4905
- declare class SelectionInput extends Component<Props$B, SpreadsheetChildEnv> {
4919
+ declare class SelectionInput extends Component<Props$C, SpreadsheetChildEnv> {
4906
4920
  static template: string;
4907
4921
  private id;
4908
4922
  private previousRanges;
@@ -4927,12 +4941,12 @@ declare class SelectionInput extends Component<Props$B, SpreadsheetChildEnv> {
4927
4941
  confirm(): void;
4928
4942
  }
4929
4943
 
4930
- interface Props$A {
4944
+ interface Props$B {
4931
4945
  figureId: UID;
4932
4946
  definition: LineChartDefinition | BarChartDefinition | PieChartDefinition;
4933
4947
  updateChart: (definition: Partial<LineChartDefinition | BarChartDefinition | PieChartDefinition>) => DispatchResult;
4934
4948
  }
4935
- declare class LineBarPieConfigPanel extends Component<Props$A, SpreadsheetChildEnv> {
4949
+ declare class LineBarPieConfigPanel extends Component<Props$B, SpreadsheetChildEnv> {
4936
4950
  static template: string;
4937
4951
  static components: {
4938
4952
  SelectionInput: typeof SelectionInput;
@@ -4967,6 +4981,23 @@ declare class BarConfigPanel extends LineBarPieConfigPanel {
4967
4981
  onUpdateAggregated(ev: any): void;
4968
4982
  }
4969
4983
 
4984
+ declare const DATETIME_FORMAT: RegExp;
4985
+ declare enum ComponentsImportance {
4986
+ Grid = 0,
4987
+ Highlight = 5,
4988
+ Figure = 10,
4989
+ ScrollBar = 15,
4990
+ GridPopover = 19,
4991
+ GridComposer = 20,
4992
+ Dropdown = 21,
4993
+ IconPicker = 25,
4994
+ TopBarComposer = 30,
4995
+ Popover = 35,
4996
+ FigureAnchor = 1000,
4997
+ FigureSnapLine = 1001
4998
+ }
4999
+ declare function setDefaultSheetViewSize(size: number): void;
5000
+
4970
5001
  interface PopoverProps {
4971
5002
  /**
4972
5003
  * Rectangle around which the popover is displayed.
@@ -4982,6 +5013,8 @@ interface PopoverProps {
4982
5013
  onMouseWheel?: () => void;
4983
5014
  onPopoverMoved?: () => void;
4984
5015
  onPopoverHidden?: () => void;
5016
+ /** Setting popover to allow dynamic zIndex */
5017
+ zIndex?: Number;
4985
5018
  }
4986
5019
  declare class Popover extends Component<PopoverProps, SpreadsheetChildEnv> {
4987
5020
  static template: string;
@@ -4991,6 +5024,7 @@ declare class Popover extends Component<PopoverProps, SpreadsheetChildEnv> {
4991
5024
  onMouseWheel: () => void;
4992
5025
  onPopoverMoved: () => void;
4993
5026
  onPopoverHidden: () => void;
5027
+ zIndex: ComponentsImportance;
4994
5028
  };
4995
5029
  private popoverRef;
4996
5030
  private currentPosition;
@@ -4998,6 +5032,7 @@ declare class Popover extends Component<PopoverProps, SpreadsheetChildEnv> {
4998
5032
  private spreadsheetRect;
4999
5033
  private containerRect;
5000
5034
  setup(): void;
5035
+ get popoverStyle(): string;
5001
5036
  }
5002
5037
 
5003
5038
  interface ColorPickerProps {
@@ -5031,7 +5066,7 @@ declare class ColorPicker extends Component<ColorPickerProps, SpreadsheetChildEn
5031
5066
  isSameColor(color1: Color, color2: Color): boolean;
5032
5067
  }
5033
5068
 
5034
- interface Props$z {
5069
+ interface Props$A {
5035
5070
  currentColor: string | undefined;
5036
5071
  toggleColorPicker: () => void;
5037
5072
  showColorPicker: boolean;
@@ -5042,7 +5077,7 @@ interface Props$z {
5042
5077
  dropdownMaxHeight?: Pixel;
5043
5078
  class?: string;
5044
5079
  }
5045
- declare class ColorPickerWidget extends Component<Props$z, SpreadsheetChildEnv> {
5080
+ declare class ColorPickerWidget extends Component<Props$A, SpreadsheetChildEnv> {
5046
5081
  static template: string;
5047
5082
  static components: {
5048
5083
  ColorPicker: typeof ColorPicker;
@@ -5054,12 +5089,12 @@ declare class ColorPickerWidget extends Component<Props$z, SpreadsheetChildEnv>
5054
5089
  get colorPickerAnchorRect(): Rect;
5055
5090
  }
5056
5091
 
5057
- interface Props$y {
5092
+ interface Props$z {
5058
5093
  figureId: UID;
5059
5094
  definition: LineChartDefinition | BarChartDefinition | PieChartDefinition;
5060
5095
  updateChart: (definition: Partial<LineChartDefinition | BarChartDefinition | PieChartDefinition>) => CommandResult | CommandResult[];
5061
5096
  }
5062
- declare class LineBarPieDesignPanel extends Component<Props$y, SpreadsheetChildEnv> {
5097
+ declare class LineBarPieDesignPanel extends Component<Props$z, SpreadsheetChildEnv> {
5063
5098
  static template: string;
5064
5099
  static components: {
5065
5100
  ColorPickerWidget: typeof ColorPickerWidget;
@@ -5073,12 +5108,12 @@ declare class LineBarPieDesignPanel extends Component<Props$y, SpreadsheetChildE
5073
5108
  updateSelect(attr: string, ev: any): void;
5074
5109
  }
5075
5110
 
5076
- interface Props$x {
5111
+ interface Props$y {
5077
5112
  figureId: UID;
5078
5113
  definition: GaugeChartDefinition;
5079
5114
  updateChart: (definition: Partial<GaugeChartDefinition>) => DispatchResult;
5080
5115
  }
5081
- declare class GaugeChartConfigPanel extends Component<Props$x, SpreadsheetChildEnv> {
5116
+ declare class GaugeChartConfigPanel extends Component<Props$y, SpreadsheetChildEnv> {
5082
5117
  static template: string;
5083
5118
  static components: {
5084
5119
  SelectionInput: typeof SelectionInput;
@@ -5092,12 +5127,12 @@ declare class GaugeChartConfigPanel extends Component<Props$x, SpreadsheetChildE
5092
5127
  }
5093
5128
 
5094
5129
  declare type GaugeMenu = "backgroundColor" | "sectionColor-lowerColor" | "sectionColor-middleColor" | "sectionColor-upperColor";
5095
- interface Props$w {
5130
+ interface Props$x {
5096
5131
  figureId: UID;
5097
5132
  definition: GaugeChartDefinition;
5098
5133
  updateChart: (definition: Partial<GaugeChartDefinition>) => DispatchResult;
5099
5134
  }
5100
- declare class GaugeChartDesignPanel extends Component<Props$w, SpreadsheetChildEnv> {
5135
+ declare class GaugeChartDesignPanel extends Component<Props$x, SpreadsheetChildEnv> {
5101
5136
  static template: string;
5102
5137
  static components: {
5103
5138
  ColorPickerWidget: typeof ColorPickerWidget;
@@ -5129,12 +5164,12 @@ declare class LineConfigPanel extends LineBarPieConfigPanel {
5129
5164
  onUpdateAggregated(ev: any): void;
5130
5165
  }
5131
5166
 
5132
- interface Props$v {
5167
+ interface Props$w {
5133
5168
  figureId: UID;
5134
5169
  definition: ScorecardChartDefinition;
5135
5170
  updateChart: (definition: Partial<ScorecardChartDefinition>) => DispatchResult;
5136
5171
  }
5137
- declare class ScorecardChartConfigPanel extends Component<Props$v, SpreadsheetChildEnv> {
5172
+ declare class ScorecardChartConfigPanel extends Component<Props$w, SpreadsheetChildEnv> {
5138
5173
  static template: string;
5139
5174
  static components: {
5140
5175
  SelectionInput: typeof SelectionInput;
@@ -5153,12 +5188,12 @@ declare class ScorecardChartConfigPanel extends Component<Props$v, SpreadsheetCh
5153
5188
  }
5154
5189
 
5155
5190
  declare type ColorPickerId = undefined | "backgroundColor" | "baselineColorUp" | "baselineColorDown";
5156
- interface Props$u {
5191
+ interface Props$v {
5157
5192
  figureId: UID;
5158
5193
  definition: ScorecardChartDefinition;
5159
5194
  updateChart: (definition: Partial<ScorecardChartDefinition>) => DispatchResult;
5160
5195
  }
5161
- declare class ScorecardChartDesignPanel extends Component<Props$u, SpreadsheetChildEnv> {
5196
+ declare class ScorecardChartDesignPanel extends Component<Props$v, SpreadsheetChildEnv> {
5162
5197
  static template: string;
5163
5198
  static components: {
5164
5199
  ColorPickerWidget: typeof ColorPickerWidget;
@@ -5177,72 +5212,75 @@ interface ChartSidePanel {
5177
5212
  design: new (...args: any) => Component;
5178
5213
  }
5179
5214
 
5180
- /**
5181
- * An ActionMenuItem represent a menu item for the menus of the topbar.
5182
- * and the context menu in the grid.
5183
- *
5184
- * An ActionMenuItem has:
5185
- * - id, used for example to add child
5186
- * - name, which can be a string or a function to compute it
5187
- * - sequence, which represents its position inside the
5188
- * menus (the lower sequence it has, the upper it is in the menu)
5189
- * - isVisible, which can be defined to compute the visibility of the item
5190
- * - isReadonlyAllowed: is the action allowed when running spreadsheet in readonly mode
5191
- * - action, the action associated to this item. The action can return a result.
5192
- * The result will be carried by a `menu-clicked` event to the menu parent component.
5193
- * - children, subitems associated to this item
5194
- * NB: an item without action or children is not displayed !
5195
- * - separator, whether it should add a separator below the item
5196
- * NB: a separator defined on the last item is not displayed !
5197
- *
5198
- */
5199
- interface MenuItemSpec {
5215
+ interface ActionSpec {
5216
+ /**
5217
+ * String or a function to compute the name
5218
+ */
5200
5219
  name: string | ((env: SpreadsheetChildEnv) => string);
5201
5220
  description?: string;
5221
+ /**
5222
+ * which represents its position inside the
5223
+ * menus (the lower sequence it has, the upper it is in the menu)
5224
+ */
5202
5225
  sequence?: number;
5226
+ /**
5227
+ * used for example to add child
5228
+ */
5203
5229
  id?: string;
5230
+ /**
5231
+ * Can be defined to compute the visibility of the item
5232
+ */
5204
5233
  isVisible?: (env: SpreadsheetChildEnv) => boolean;
5234
+ /**
5235
+ * Can be defined to compute if the user can click on the action
5236
+ */
5205
5237
  isEnabled?: (env: SpreadsheetChildEnv) => boolean;
5238
+ /**
5239
+ * Can be defined to compute if the action is active
5240
+ */
5241
+ isActive?: (env: SpreadsheetChildEnv) => boolean;
5242
+ /**
5243
+ * Can be defined to display an icon
5244
+ */
5245
+ icon?: string;
5246
+ /**
5247
+ * is the action allowed when running spreadsheet in readonly mode
5248
+ */
5206
5249
  isReadonlyAllowed?: boolean;
5207
- action?: (env: SpreadsheetChildEnv) => unknown;
5208
- children?: MenuChildren;
5250
+ /**
5251
+ * Execute the action. The action can return a result.
5252
+ * The result will be carried by a `menu-clicked` event to the menu parent component.
5253
+ */
5254
+ execute?: (env: SpreadsheetChildEnv) => unknown;
5255
+ /**
5256
+ * subitems associated to this item
5257
+ * NB: an action without an execute function or children is not displayed !
5258
+ */
5259
+ children?: ActionChildren;
5260
+ /**
5261
+ * whether it should add a separator below the item in menus
5262
+ * NB: a separator defined on the last item is not displayed !
5263
+ */
5209
5264
  separator?: boolean;
5210
- icon?: string;
5211
5265
  textColor?: Color;
5212
5266
  }
5213
- interface MenuItem {
5214
- id: string;
5215
- sequence: number;
5267
+ interface Action {
5216
5268
  name: (env: SpreadsheetChildEnv) => string;
5269
+ description: string;
5270
+ sequence: number;
5271
+ id: string;
5217
5272
  isVisible: (env: SpreadsheetChildEnv) => boolean;
5218
5273
  isEnabled: (env: SpreadsheetChildEnv) => boolean;
5274
+ isActive?: (env: SpreadsheetChildEnv) => boolean;
5275
+ icon: string;
5219
5276
  isReadonlyAllowed: boolean;
5220
- action?: (env: SpreadsheetChildEnv) => unknown;
5221
- children: (env: SpreadsheetChildEnv) => MenuItem[];
5277
+ execute?: (env: SpreadsheetChildEnv) => unknown;
5278
+ children: (env: SpreadsheetChildEnv) => Action[];
5222
5279
  separator: boolean;
5223
- description: string;
5224
- textColor?: string;
5225
- icon?: string;
5226
- }
5227
- declare type MenuItemsBuilder = (env: SpreadsheetChildEnv) => MenuItemSpec[];
5228
- declare type MenuChildren = (MenuItemSpec | MenuItemsBuilder)[];
5229
- /**
5230
- * The class Registry is extended in order to add the function addChild
5231
- *
5232
- */
5233
- declare class MenuItemRegistry extends Registry<MenuItemSpec> {
5234
- /**
5235
- * @override
5236
- */
5237
- add(key: string, value: MenuItemSpec): MenuItemRegistry;
5238
- /**
5239
- * Add a subitem to an existing item
5240
- * @param path Path of items to add this subitem
5241
- * @param value Subitem to add
5242
- */
5243
- addChild(key: string, path: string[], value: MenuItemSpec | MenuItemsBuilder): MenuItemRegistry;
5244
- getMenuItems(): MenuItem[];
5280
+ textColor?: Color;
5245
5281
  }
5282
+ declare type ActionBuilder = (env: SpreadsheetChildEnv) => ActionSpec[];
5283
+ declare type ActionChildren = (ActionSpec | ActionBuilder)[];
5246
5284
 
5247
5285
  /**
5248
5286
  * This registry is intended to map a type of figure (tag) to a class of
@@ -5252,7 +5290,7 @@ declare class MenuItemRegistry extends Registry<MenuItemSpec> {
5252
5290
  */
5253
5291
  interface FigureContent {
5254
5292
  Component: any;
5255
- menuBuilder: (figureId: UID, onFigureDeleted: () => void, env: SpreadsheetChildEnv) => MenuItem[];
5293
+ menuBuilder: (figureId: UID, onFigureDeleted: () => void, env: SpreadsheetChildEnv) => Action[];
5256
5294
  SidePanelComponent?: string;
5257
5295
  keepRatio?: boolean;
5258
5296
  minFigSize?: number;
@@ -5265,6 +5303,24 @@ interface SidePanelContent {
5265
5303
  Footer?: any;
5266
5304
  }
5267
5305
 
5306
+ /**
5307
+ * The class Registry is extended in order to add the function addChild
5308
+ *
5309
+ */
5310
+ declare class MenuItemRegistry extends Registry<ActionSpec> {
5311
+ /**
5312
+ * @override
5313
+ */
5314
+ add(key: string, value: ActionSpec): MenuItemRegistry;
5315
+ /**
5316
+ * Add a subitem to an existing item
5317
+ * @param path Path of items to add this subitem
5318
+ * @param value Subitem to add
5319
+ */
5320
+ addChild(key: string, path: string[], value: ActionSpec | ActionBuilder): MenuItemRegistry;
5321
+ getMenuItems(): Action[];
5322
+ }
5323
+
5268
5324
  /**
5269
5325
  * An AutofillRule is used to generate what to do when we need to autofill
5270
5326
  * a cell. (In a AutofillGenerator, see plugins/autofill.ts)
@@ -5278,10 +5334,10 @@ interface AutofillRule {
5278
5334
  sequence: number;
5279
5335
  }
5280
5336
 
5281
- interface Props$t {
5337
+ interface Props$u {
5282
5338
  figure: Figure;
5283
5339
  }
5284
- declare class ChartJsComponent extends Component<Props$t, SpreadsheetChildEnv> {
5340
+ declare class ChartJsComponent extends Component<Props$u, SpreadsheetChildEnv> {
5285
5341
  static template: string;
5286
5342
  private canvas;
5287
5343
  private chart?;
@@ -5293,10 +5349,10 @@ declare class ChartJsComponent extends Component<Props$t, SpreadsheetChildEnv> {
5293
5349
  private updateChartJs;
5294
5350
  }
5295
5351
 
5296
- interface Props$s {
5352
+ interface Props$t {
5297
5353
  figure: Figure;
5298
5354
  }
5299
- declare class ScorecardChart extends Component<Props$s, SpreadsheetChildEnv> {
5355
+ declare class ScorecardChart extends Component<Props$t, SpreadsheetChildEnv> {
5300
5356
  static template: string;
5301
5357
  private ctx;
5302
5358
  get runtime(): ScorecardChartRuntime;
@@ -5327,10 +5383,10 @@ declare class ScorecardChart extends Component<Props$s, SpreadsheetChildEnv> {
5327
5383
  private getWidestElement;
5328
5384
  }
5329
5385
 
5330
- declare type MenuItemOrSeparator = MenuItem | "separator";
5331
- interface Props$r {
5386
+ declare type MenuItemOrSeparator = Action | "separator";
5387
+ interface Props$s {
5332
5388
  position: DOMCoordinates;
5333
- menuItems: MenuItem[];
5389
+ menuItems: Action[];
5334
5390
  depth: number;
5335
5391
  maxHeight?: Pixel;
5336
5392
  onClose: () => void;
@@ -5339,12 +5395,12 @@ interface Props$r {
5339
5395
  }
5340
5396
  interface MenuState {
5341
5397
  isOpen: boolean;
5342
- parentMenu?: MenuItem;
5398
+ parentMenu?: Action;
5343
5399
  position: null | DOMCoordinates;
5344
5400
  scrollOffset?: Pixel;
5345
- menuItems: MenuItem[];
5401
+ menuItems: Action[];
5346
5402
  }
5347
- declare class Menu extends Component<Props$r, SpreadsheetChildEnv> {
5403
+ declare class Menu extends Component<Props$s, SpreadsheetChildEnv> {
5348
5404
  static template: string;
5349
5405
  static components: {
5350
5406
  Menu: typeof Menu;
@@ -5360,34 +5416,36 @@ declare class Menu extends Component<Props$r, SpreadsheetChildEnv> {
5360
5416
  get menuItemsAndSeparators(): MenuItemOrSeparator[];
5361
5417
  get subMenuPosition(): DOMCoordinates;
5362
5418
  get popoverProps(): PopoverProps;
5363
- getColor(menu: MenuItem): string | undefined;
5364
- activateMenu(menu: MenuItem): Promise<void>;
5419
+ get childrenHaveIcon(): boolean;
5420
+ getIconName(menu: Action): "" | "o-spreadsheet-Icon.CHECK";
5421
+ getColor(menu: Action): string | undefined;
5422
+ activateMenu(menu: Action): Promise<void>;
5365
5423
  private close;
5366
5424
  private onExternalClick;
5367
- getName(menu: MenuItem): string;
5368
- isRoot(menu: MenuItem): boolean;
5369
- isEnabled(menu: MenuItem): boolean;
5425
+ getName(menu: Action): string;
5426
+ isRoot(menu: Action): boolean;
5427
+ isEnabled(menu: Action): boolean;
5370
5428
  onScroll(ev: any): void;
5371
5429
  /**
5372
5430
  * If the given menu is not disabled, open it's submenu at the
5373
5431
  * correct position according to available surrounding space.
5374
5432
  */
5375
- openSubMenu(menu: MenuItem, menuIndex: number, ev: MouseEvent): void;
5376
- isParentMenu(subMenu: MenuState, menuItem: MenuItem): boolean;
5433
+ openSubMenu(menu: Action, menuIndex: number, ev: MouseEvent): void;
5434
+ isParentMenu(subMenu: MenuState, menuItem: Action): boolean;
5377
5435
  closeSubMenu(): void;
5378
- onClickMenu(menu: MenuItem, menuIndex: number, ev: MouseEvent): void;
5379
- onMouseOver(menu: MenuItem, position: Pixel, ev: MouseEvent): void;
5436
+ onClickMenu(menu: Action, menuIndex: number, ev: MouseEvent): void;
5437
+ onMouseOver(menu: Action, position: Pixel, ev: MouseEvent): void;
5380
5438
  }
5381
5439
 
5382
5440
  declare type ResizeAnchor = "top left" | "top" | "top right" | "right" | "bottom right" | "bottom" | "bottom left" | "left";
5383
- interface Props$q {
5441
+ interface Props$r {
5384
5442
  figure: Figure;
5385
5443
  style: string;
5386
5444
  onFigureDeleted: () => void;
5387
5445
  onMouseDown: (ev: MouseEvent) => void;
5388
5446
  onClickAnchor(dirX: ResizeDirection, dirY: ResizeDirection, ev: MouseEvent): void;
5389
5447
  }
5390
- declare class FigureComponent extends Component<Props$q, SpreadsheetChildEnv> {
5448
+ declare class FigureComponent extends Component<Props$r, SpreadsheetChildEnv> {
5391
5449
  static template: string;
5392
5450
  static components: {
5393
5451
  Menu: typeof Menu;
@@ -5417,11 +5475,11 @@ declare class FigureComponent extends Component<Props$q, SpreadsheetChildEnv> {
5417
5475
  private openContextMenu;
5418
5476
  }
5419
5477
 
5420
- interface Props$p {
5478
+ interface Props$q {
5421
5479
  figure: Figure;
5422
5480
  onFigureDeleted: () => void;
5423
5481
  }
5424
- declare class ChartFigure extends Component<Props$p, SpreadsheetChildEnv> {
5482
+ declare class ChartFigure extends Component<Props$q, SpreadsheetChildEnv> {
5425
5483
  static template: string;
5426
5484
  static components: {};
5427
5485
  onDoubleClick(): void;
@@ -5429,7 +5487,7 @@ declare class ChartFigure extends Component<Props$p, SpreadsheetChildEnv> {
5429
5487
  get chartComponent(): new (...args: any) => Component;
5430
5488
  }
5431
5489
 
5432
- interface Props$o {
5490
+ interface Props$p {
5433
5491
  isVisible: boolean;
5434
5492
  position: Position;
5435
5493
  }
@@ -5441,7 +5499,7 @@ interface State$3 {
5441
5499
  position: Position;
5442
5500
  handler: boolean;
5443
5501
  }
5444
- declare class Autofill extends Component<Props$o, SpreadsheetChildEnv> {
5502
+ declare class Autofill extends Component<Props$p, SpreadsheetChildEnv> {
5445
5503
  static template: string;
5446
5504
  state: State$3;
5447
5505
  get style(): string;
@@ -5515,13 +5573,13 @@ declare class Ripple extends Component<RippleProps, SpreadsheetChildEnv> {
5515
5573
  getRippleEffectProps(id: number): RippleEffectProps;
5516
5574
  }
5517
5575
 
5518
- interface Props$n {
5576
+ interface Props$o {
5519
5577
  sheetId: string;
5520
5578
  openContextMenu: (registry: MenuItemRegistry, ev: MouseEvent) => void;
5521
5579
  style?: string;
5522
5580
  onMouseDown: (ev: MouseEvent) => void;
5523
5581
  }
5524
- declare class BottomBarSheet extends Component<Props$n, SpreadsheetChildEnv> {
5582
+ declare class BottomBarSheet extends Component<Props$o, SpreadsheetChildEnv> {
5525
5583
  static template: string;
5526
5584
  static components: {
5527
5585
  Ripple: typeof Ripple;
@@ -5555,11 +5613,11 @@ declare class BottomBarSheet extends Component<Props$n, SpreadsheetChildEnv> {
5555
5613
  get sheetName(): string;
5556
5614
  }
5557
5615
 
5558
- interface Props$m {
5616
+ interface Props$n {
5559
5617
  openContextMenu: (x: number, y: number, registry: MenuItemRegistry) => void;
5560
5618
  closeContextMenu: () => void;
5561
5619
  }
5562
- declare class BottomBarStatistic extends Component<Props$m, SpreadsheetChildEnv> {
5620
+ declare class BottomBarStatistic extends Component<Props$n, SpreadsheetChildEnv> {
5563
5621
  static template: string;
5564
5622
  static components: {
5565
5623
  Ripple: typeof Ripple;
@@ -5581,13 +5639,13 @@ interface SheetState {
5581
5639
  isDnd: boolean;
5582
5640
  sheetDndPositions: Record<UID, number> | undefined;
5583
5641
  }
5584
- interface Props$l {
5642
+ interface Props$m {
5585
5643
  onClick: () => void;
5586
5644
  }
5587
5645
  interface BottomBarMenuState extends MenuState {
5588
5646
  menuId: UID | undefined;
5589
5647
  }
5590
- declare class BottomBar extends Component<Props$l, SpreadsheetChildEnv> {
5648
+ declare class BottomBar extends Component<Props$m, SpreadsheetChildEnv> {
5591
5649
  static template: string;
5592
5650
  static components: {
5593
5651
  Menu: typeof Menu;
@@ -5630,21 +5688,21 @@ declare class BottomBar extends Component<Props$l, SpreadsheetChildEnv> {
5630
5688
  get sheetListMaxScroll(): number;
5631
5689
  }
5632
5690
 
5633
- interface Props$k {
5691
+ interface Props$l {
5634
5692
  position: DOMCoordinates;
5635
5693
  isActive: boolean;
5636
5694
  onClick: () => void;
5637
5695
  }
5638
- declare class FilterIcon extends Component<Props$k, SpreadsheetEnv> {
5696
+ declare class FilterIcon extends Component<Props$l, SpreadsheetEnv> {
5639
5697
  static style: string;
5640
5698
  static template: string;
5641
5699
  get style(): string;
5642
5700
  }
5643
5701
 
5644
- interface Props$j {
5702
+ interface Props$k {
5645
5703
  gridPosition: DOMCoordinates;
5646
5704
  }
5647
- declare class FilterIconsOverlay extends Component<Props$j, SpreadsheetChildEnv> {
5705
+ declare class FilterIconsOverlay extends Component<Props$k, SpreadsheetChildEnv> {
5648
5706
  static style: string;
5649
5707
  static template: string;
5650
5708
  static components: {
@@ -5658,6 +5716,7 @@ declare class FilterIconsOverlay extends Component<Props$j, SpreadsheetChildEnv>
5658
5716
  };
5659
5717
  getVisibleFilterHeaders(): Position$1[];
5660
5718
  getFilterHeaderPosition(position: Position$1): DOMCoordinates;
5719
+ private getIconVerticalPosition;
5661
5720
  isFilterActive(position: Position$1): boolean;
5662
5721
  toggleFilterMenu(position: Position$1): void;
5663
5722
  private isPositionVisible;
@@ -5673,7 +5732,7 @@ interface SnapLine<T extends HFigureAxisType | VFigureAxisType> {
5673
5732
  }
5674
5733
 
5675
5734
  declare type ContainerType = "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | "dnd";
5676
- interface Props$i {
5735
+ interface Props$j {
5677
5736
  onFigureDeleted: () => void;
5678
5737
  }
5679
5738
  interface Container {
@@ -5752,7 +5811,7 @@ interface DndState {
5752
5811
  * that occurred during the drag & drop, and to position the figure on the correct pane.
5753
5812
  *
5754
5813
  */
5755
- declare class FiguresContainer extends Component<Props$i, SpreadsheetChildEnv> {
5814
+ declare class FiguresContainer extends Component<Props$j, SpreadsheetChildEnv> {
5756
5815
  static template: string;
5757
5816
  static components: {
5758
5817
  FigureComponent: typeof FigureComponent;
@@ -5784,7 +5843,7 @@ declare class FiguresContainer extends Component<Props$i, SpreadsheetChildEnv> {
5784
5843
  private getSnapLineStyle;
5785
5844
  }
5786
5845
 
5787
- interface Props$h {
5846
+ interface Props$i {
5788
5847
  onCellHovered: (position: Partial<Position$1>) => void;
5789
5848
  onCellDoubleClicked: (col: HeaderIndex, row: HeaderIndex) => void;
5790
5849
  onCellClicked: (col: HeaderIndex, row: HeaderIndex, modifiers: {
@@ -5797,7 +5856,7 @@ interface Props$h {
5797
5856
  gridOverlayDimensions: string;
5798
5857
  onFigureDeleted: () => void;
5799
5858
  }
5800
- declare class GridOverlay extends Component<Props$h, SpreadsheetChildEnv> {
5859
+ declare class GridOverlay extends Component<Props$i, SpreadsheetChildEnv> {
5801
5860
  static template: string;
5802
5861
  static components: {
5803
5862
  FiguresContainer: typeof FiguresContainer;
@@ -5819,23 +5878,24 @@ declare class GridOverlay extends Component<Props$h, SpreadsheetChildEnv> {
5819
5878
  private getCartesianCoordinates;
5820
5879
  }
5821
5880
 
5822
- interface Props$g {
5881
+ interface Props$h {
5823
5882
  hoveredCell: Partial<Position$1>;
5824
5883
  gridRect: Rect;
5825
5884
  onClosePopover: () => void;
5826
5885
  onMouseWheel: (ev: WheelEvent) => void;
5827
5886
  }
5828
- declare class GridPopover extends Component<Props$g, SpreadsheetChildEnv> {
5887
+ declare class GridPopover extends Component<Props$h, SpreadsheetChildEnv> {
5829
5888
  static template: string;
5830
5889
  static components: {
5831
5890
  Popover: typeof Popover;
5832
5891
  };
5892
+ zIndex: ComponentsImportance;
5833
5893
  get cellPopover(): PositionedCellPopover | ClosedCellPopover;
5834
5894
  }
5835
5895
 
5836
5896
  declare type ScrollDirection = "horizontal" | "vertical";
5837
5897
 
5838
- interface Props$f {
5898
+ interface Props$g {
5839
5899
  width: Pixel;
5840
5900
  height: Pixel;
5841
5901
  direction: ScrollDirection;
@@ -5843,7 +5903,7 @@ interface Props$f {
5843
5903
  offset: Pixel;
5844
5904
  onScroll: (offset: Pixel) => void;
5845
5905
  }
5846
- declare class ScrollBar extends Component<Props$f> {
5906
+ declare class ScrollBar extends Component<Props$g> {
5847
5907
  static template: string;
5848
5908
  static defaultProps: {
5849
5909
  width: number;
@@ -5857,10 +5917,10 @@ declare class ScrollBar extends Component<Props$f> {
5857
5917
  onScroll(ev: any): void;
5858
5918
  }
5859
5919
 
5860
- interface Props$e {
5920
+ interface Props$f {
5861
5921
  leftOffset: number;
5862
5922
  }
5863
- declare class HorizontalScrollBar extends Component<Props$e, SpreadsheetChildEnv> {
5923
+ declare class HorizontalScrollBar extends Component<Props$f, SpreadsheetChildEnv> {
5864
5924
  static components: {
5865
5925
  ScrollBar: typeof ScrollBar;
5866
5926
  };
@@ -5880,10 +5940,10 @@ declare class HorizontalScrollBar extends Component<Props$e, SpreadsheetChildEnv
5880
5940
  onScroll(offset: any): void;
5881
5941
  }
5882
5942
 
5883
- interface Props$d {
5943
+ interface Props$e {
5884
5944
  topOffset: number;
5885
5945
  }
5886
- declare class VerticalScrollBar extends Component<Props$d, SpreadsheetChildEnv> {
5946
+ declare class VerticalScrollBar extends Component<Props$e, SpreadsheetChildEnv> {
5887
5947
  static components: {
5888
5948
  ScrollBar: typeof ScrollBar;
5889
5949
  };
@@ -5903,7 +5963,7 @@ declare class VerticalScrollBar extends Component<Props$d, SpreadsheetChildEnv>
5903
5963
  onScroll(offset: any): void;
5904
5964
  }
5905
5965
 
5906
- interface Props$c {
5966
+ interface Props$d {
5907
5967
  }
5908
5968
  interface ClickableCell {
5909
5969
  coordinates: Rect;
@@ -5911,7 +5971,7 @@ interface ClickableCell {
5911
5971
  action: (position: CellPosition, env: SpreadsheetChildEnv) => void;
5912
5972
  tKey: string;
5913
5973
  }
5914
- declare class SpreadsheetDashboard extends Component<Props$c, SpreadsheetChildEnv> {
5974
+ declare class SpreadsheetDashboard extends Component<Props$d, SpreadsheetChildEnv> {
5915
5975
  static template: string;
5916
5976
  static components: {
5917
5977
  GridOverlay: typeof GridOverlay;
@@ -5947,7 +6007,7 @@ declare class SpreadsheetDashboard extends Component<Props$c, SpreadsheetChildEn
5947
6007
  private getGridRect;
5948
6008
  }
5949
6009
 
5950
- interface Props$b {
6010
+ interface Props$c {
5951
6011
  component: string;
5952
6012
  panelProps: any;
5953
6013
  onCloseSidePanel: () => void;
@@ -5955,13 +6015,309 @@ interface Props$b {
5955
6015
  interface State$2 {
5956
6016
  panel: SidePanelContent;
5957
6017
  }
5958
- declare class SidePanel extends Component<Props$b, SpreadsheetChildEnv> {
6018
+ declare class SidePanel extends Component<Props$c, SpreadsheetChildEnv> {
5959
6019
  static template: string;
5960
6020
  state: State$2;
5961
6021
  setup(): void;
5962
6022
  getTitle(): string;
5963
6023
  }
5964
6024
 
6025
+ declare const undo: ActionSpec;
6026
+ declare const redo: ActionSpec;
6027
+ declare const copy: ActionSpec;
6028
+ declare const cut: ActionSpec;
6029
+ declare const paste: ActionSpec;
6030
+ declare const pasteSpecial: ActionSpec;
6031
+ declare const pasteSpecialValue: ActionSpec;
6032
+ declare const pasteSpecialFormat: ActionSpec;
6033
+ declare const findAndReplace: ActionSpec;
6034
+ declare const deleteValues: ActionSpec;
6035
+ declare const deleteRows: ActionSpec;
6036
+ declare const deleteRow: ActionSpec;
6037
+ declare const clearRows: ActionSpec;
6038
+ declare const deleteCols: ActionSpec;
6039
+ declare const deleteCol: ActionSpec;
6040
+ declare const clearCols: ActionSpec;
6041
+ declare const deleteCells: ActionSpec;
6042
+ declare const deleteCellShiftUp: ActionSpec;
6043
+ declare const deleteCellShiftLeft: ActionSpec;
6044
+ declare const mergeCells: ActionSpec;
6045
+
6046
+ declare const ACTION_EDIT_undo: typeof undo;
6047
+ declare const ACTION_EDIT_redo: typeof redo;
6048
+ declare const ACTION_EDIT_copy: typeof copy;
6049
+ declare const ACTION_EDIT_cut: typeof cut;
6050
+ declare const ACTION_EDIT_paste: typeof paste;
6051
+ declare const ACTION_EDIT_pasteSpecial: typeof pasteSpecial;
6052
+ declare const ACTION_EDIT_pasteSpecialValue: typeof pasteSpecialValue;
6053
+ declare const ACTION_EDIT_pasteSpecialFormat: typeof pasteSpecialFormat;
6054
+ declare const ACTION_EDIT_findAndReplace: typeof findAndReplace;
6055
+ declare const ACTION_EDIT_deleteValues: typeof deleteValues;
6056
+ declare const ACTION_EDIT_deleteRows: typeof deleteRows;
6057
+ declare const ACTION_EDIT_deleteRow: typeof deleteRow;
6058
+ declare const ACTION_EDIT_clearRows: typeof clearRows;
6059
+ declare const ACTION_EDIT_deleteCols: typeof deleteCols;
6060
+ declare const ACTION_EDIT_deleteCol: typeof deleteCol;
6061
+ declare const ACTION_EDIT_clearCols: typeof clearCols;
6062
+ declare const ACTION_EDIT_deleteCells: typeof deleteCells;
6063
+ declare const ACTION_EDIT_deleteCellShiftUp: typeof deleteCellShiftUp;
6064
+ declare const ACTION_EDIT_deleteCellShiftLeft: typeof deleteCellShiftLeft;
6065
+ declare const ACTION_EDIT_mergeCells: typeof mergeCells;
6066
+ declare namespace ACTION_EDIT {
6067
+ export {
6068
+ ACTION_EDIT_undo as undo,
6069
+ ACTION_EDIT_redo as redo,
6070
+ ACTION_EDIT_copy as copy,
6071
+ ACTION_EDIT_cut as cut,
6072
+ ACTION_EDIT_paste as paste,
6073
+ ACTION_EDIT_pasteSpecial as pasteSpecial,
6074
+ ACTION_EDIT_pasteSpecialValue as pasteSpecialValue,
6075
+ ACTION_EDIT_pasteSpecialFormat as pasteSpecialFormat,
6076
+ ACTION_EDIT_findAndReplace as findAndReplace,
6077
+ ACTION_EDIT_deleteValues as deleteValues,
6078
+ ACTION_EDIT_deleteRows as deleteRows,
6079
+ ACTION_EDIT_deleteRow as deleteRow,
6080
+ ACTION_EDIT_clearRows as clearRows,
6081
+ ACTION_EDIT_deleteCols as deleteCols,
6082
+ ACTION_EDIT_deleteCol as deleteCol,
6083
+ ACTION_EDIT_clearCols as clearCols,
6084
+ ACTION_EDIT_deleteCells as deleteCells,
6085
+ ACTION_EDIT_deleteCellShiftUp as deleteCellShiftUp,
6086
+ ACTION_EDIT_deleteCellShiftLeft as deleteCellShiftLeft,
6087
+ ACTION_EDIT_mergeCells as mergeCells,
6088
+ };
6089
+ }
6090
+
6091
+ declare const formatNumberAutomatic: ActionSpec;
6092
+ declare const formatNumberNumber: ActionSpec;
6093
+ declare const formatPercent: ActionSpec;
6094
+ declare const formatNumberPercent: ActionSpec;
6095
+ declare const formatNumberCurrency: ActionSpec;
6096
+ declare const formatNumberCurrencyRounded: ActionSpec;
6097
+ declare const formatCustomCurrency: ActionSpec;
6098
+ declare const formatNumberDate: ActionSpec;
6099
+ declare const formatNumberTime: ActionSpec;
6100
+ declare const formatNumberDateTime: ActionSpec;
6101
+ declare const formatNumberDuration: ActionSpec;
6102
+ declare const incraseDecimalPlaces: ActionSpec;
6103
+ declare const decraseDecimalPlaces: ActionSpec;
6104
+ declare const formatBold: ActionSpec;
6105
+ declare const formatItalic: ActionSpec;
6106
+ declare const formatUnderline: ActionSpec;
6107
+ declare const formatStrikethrough: ActionSpec;
6108
+ declare const formatFontSize: ActionSpec;
6109
+ declare const formatAlignment: ActionSpec;
6110
+ declare const formatAlignmentHorizontal: ActionSpec;
6111
+ declare const formatAlignmentLeft: ActionSpec;
6112
+ declare const formatAlignmentCenter: ActionSpec;
6113
+ declare const formatAlignmentRight: ActionSpec;
6114
+ declare const formatAlignmentVertical: ActionSpec;
6115
+ declare const formatAlignmentTop: ActionSpec;
6116
+ declare const formatAlignmentMiddle: ActionSpec;
6117
+ declare const formatAlignmentBottom: ActionSpec;
6118
+ declare const formatWrapping: ActionSpec;
6119
+ declare const formatWrappingOverflow: ActionSpec;
6120
+ declare const formatWrappingWrap: ActionSpec;
6121
+ declare const formatWrappingClip: ActionSpec;
6122
+ declare const textColor: ActionSpec;
6123
+ declare const fillColor: ActionSpec;
6124
+ declare const formatCF: ActionSpec;
6125
+ declare const paintFormat: ActionSpec;
6126
+ declare const clearFormat: ActionSpec;
6127
+ declare const borders: ActionSpec;
6128
+ declare const bordersAll: ActionSpec;
6129
+ declare const bordersInner: ActionSpec;
6130
+ declare const bordersHorizontal: ActionSpec;
6131
+ declare const bordersVertical: ActionSpec;
6132
+ declare const bordersExternal: ActionSpec;
6133
+ declare const bordersLeft: ActionSpec;
6134
+ declare const bordersTop: ActionSpec;
6135
+ declare const bordersRight: ActionSpec;
6136
+ declare const bordersBottom: ActionSpec;
6137
+ declare const bordersClear: ActionSpec;
6138
+
6139
+ declare const ACTION_FORMAT_formatNumberAutomatic: typeof formatNumberAutomatic;
6140
+ declare const ACTION_FORMAT_formatNumberNumber: typeof formatNumberNumber;
6141
+ declare const ACTION_FORMAT_formatPercent: typeof formatPercent;
6142
+ declare const ACTION_FORMAT_formatNumberPercent: typeof formatNumberPercent;
6143
+ declare const ACTION_FORMAT_formatNumberCurrency: typeof formatNumberCurrency;
6144
+ declare const ACTION_FORMAT_formatNumberCurrencyRounded: typeof formatNumberCurrencyRounded;
6145
+ declare const ACTION_FORMAT_formatCustomCurrency: typeof formatCustomCurrency;
6146
+ declare const ACTION_FORMAT_formatNumberDate: typeof formatNumberDate;
6147
+ declare const ACTION_FORMAT_formatNumberTime: typeof formatNumberTime;
6148
+ declare const ACTION_FORMAT_formatNumberDateTime: typeof formatNumberDateTime;
6149
+ declare const ACTION_FORMAT_formatNumberDuration: typeof formatNumberDuration;
6150
+ declare const ACTION_FORMAT_incraseDecimalPlaces: typeof incraseDecimalPlaces;
6151
+ declare const ACTION_FORMAT_decraseDecimalPlaces: typeof decraseDecimalPlaces;
6152
+ declare const ACTION_FORMAT_formatBold: typeof formatBold;
6153
+ declare const ACTION_FORMAT_formatItalic: typeof formatItalic;
6154
+ declare const ACTION_FORMAT_formatUnderline: typeof formatUnderline;
6155
+ declare const ACTION_FORMAT_formatStrikethrough: typeof formatStrikethrough;
6156
+ declare const ACTION_FORMAT_formatFontSize: typeof formatFontSize;
6157
+ declare const ACTION_FORMAT_formatAlignment: typeof formatAlignment;
6158
+ declare const ACTION_FORMAT_formatAlignmentHorizontal: typeof formatAlignmentHorizontal;
6159
+ declare const ACTION_FORMAT_formatAlignmentLeft: typeof formatAlignmentLeft;
6160
+ declare const ACTION_FORMAT_formatAlignmentCenter: typeof formatAlignmentCenter;
6161
+ declare const ACTION_FORMAT_formatAlignmentRight: typeof formatAlignmentRight;
6162
+ declare const ACTION_FORMAT_formatAlignmentVertical: typeof formatAlignmentVertical;
6163
+ declare const ACTION_FORMAT_formatAlignmentTop: typeof formatAlignmentTop;
6164
+ declare const ACTION_FORMAT_formatAlignmentMiddle: typeof formatAlignmentMiddle;
6165
+ declare const ACTION_FORMAT_formatAlignmentBottom: typeof formatAlignmentBottom;
6166
+ declare const ACTION_FORMAT_formatWrapping: typeof formatWrapping;
6167
+ declare const ACTION_FORMAT_formatWrappingOverflow: typeof formatWrappingOverflow;
6168
+ declare const ACTION_FORMAT_formatWrappingWrap: typeof formatWrappingWrap;
6169
+ declare const ACTION_FORMAT_formatWrappingClip: typeof formatWrappingClip;
6170
+ declare const ACTION_FORMAT_textColor: typeof textColor;
6171
+ declare const ACTION_FORMAT_fillColor: typeof fillColor;
6172
+ declare const ACTION_FORMAT_formatCF: typeof formatCF;
6173
+ declare const ACTION_FORMAT_paintFormat: typeof paintFormat;
6174
+ declare const ACTION_FORMAT_clearFormat: typeof clearFormat;
6175
+ declare const ACTION_FORMAT_borders: typeof borders;
6176
+ declare const ACTION_FORMAT_bordersAll: typeof bordersAll;
6177
+ declare const ACTION_FORMAT_bordersInner: typeof bordersInner;
6178
+ declare const ACTION_FORMAT_bordersHorizontal: typeof bordersHorizontal;
6179
+ declare const ACTION_FORMAT_bordersVertical: typeof bordersVertical;
6180
+ declare const ACTION_FORMAT_bordersExternal: typeof bordersExternal;
6181
+ declare const ACTION_FORMAT_bordersLeft: typeof bordersLeft;
6182
+ declare const ACTION_FORMAT_bordersTop: typeof bordersTop;
6183
+ declare const ACTION_FORMAT_bordersRight: typeof bordersRight;
6184
+ declare const ACTION_FORMAT_bordersBottom: typeof bordersBottom;
6185
+ declare const ACTION_FORMAT_bordersClear: typeof bordersClear;
6186
+ declare namespace ACTION_FORMAT {
6187
+ export {
6188
+ ACTION_FORMAT_formatNumberAutomatic as formatNumberAutomatic,
6189
+ ACTION_FORMAT_formatNumberNumber as formatNumberNumber,
6190
+ ACTION_FORMAT_formatPercent as formatPercent,
6191
+ ACTION_FORMAT_formatNumberPercent as formatNumberPercent,
6192
+ ACTION_FORMAT_formatNumberCurrency as formatNumberCurrency,
6193
+ ACTION_FORMAT_formatNumberCurrencyRounded as formatNumberCurrencyRounded,
6194
+ ACTION_FORMAT_formatCustomCurrency as formatCustomCurrency,
6195
+ ACTION_FORMAT_formatNumberDate as formatNumberDate,
6196
+ ACTION_FORMAT_formatNumberTime as formatNumberTime,
6197
+ ACTION_FORMAT_formatNumberDateTime as formatNumberDateTime,
6198
+ ACTION_FORMAT_formatNumberDuration as formatNumberDuration,
6199
+ ACTION_FORMAT_incraseDecimalPlaces as incraseDecimalPlaces,
6200
+ ACTION_FORMAT_decraseDecimalPlaces as decraseDecimalPlaces,
6201
+ ACTION_FORMAT_formatBold as formatBold,
6202
+ ACTION_FORMAT_formatItalic as formatItalic,
6203
+ ACTION_FORMAT_formatUnderline as formatUnderline,
6204
+ ACTION_FORMAT_formatStrikethrough as formatStrikethrough,
6205
+ ACTION_FORMAT_formatFontSize as formatFontSize,
6206
+ ACTION_FORMAT_formatAlignment as formatAlignment,
6207
+ ACTION_FORMAT_formatAlignmentHorizontal as formatAlignmentHorizontal,
6208
+ ACTION_FORMAT_formatAlignmentLeft as formatAlignmentLeft,
6209
+ ACTION_FORMAT_formatAlignmentCenter as formatAlignmentCenter,
6210
+ ACTION_FORMAT_formatAlignmentRight as formatAlignmentRight,
6211
+ ACTION_FORMAT_formatAlignmentVertical as formatAlignmentVertical,
6212
+ ACTION_FORMAT_formatAlignmentTop as formatAlignmentTop,
6213
+ ACTION_FORMAT_formatAlignmentMiddle as formatAlignmentMiddle,
6214
+ ACTION_FORMAT_formatAlignmentBottom as formatAlignmentBottom,
6215
+ ACTION_FORMAT_formatWrapping as formatWrapping,
6216
+ ACTION_FORMAT_formatWrappingOverflow as formatWrappingOverflow,
6217
+ ACTION_FORMAT_formatWrappingWrap as formatWrappingWrap,
6218
+ ACTION_FORMAT_formatWrappingClip as formatWrappingClip,
6219
+ ACTION_FORMAT_textColor as textColor,
6220
+ ACTION_FORMAT_fillColor as fillColor,
6221
+ ACTION_FORMAT_formatCF as formatCF,
6222
+ ACTION_FORMAT_paintFormat as paintFormat,
6223
+ ACTION_FORMAT_clearFormat as clearFormat,
6224
+ ACTION_FORMAT_borders as borders,
6225
+ ACTION_FORMAT_bordersAll as bordersAll,
6226
+ ACTION_FORMAT_bordersInner as bordersInner,
6227
+ ACTION_FORMAT_bordersHorizontal as bordersHorizontal,
6228
+ ACTION_FORMAT_bordersVertical as bordersVertical,
6229
+ ACTION_FORMAT_bordersExternal as bordersExternal,
6230
+ ACTION_FORMAT_bordersLeft as bordersLeft,
6231
+ ACTION_FORMAT_bordersTop as bordersTop,
6232
+ ACTION_FORMAT_bordersRight as bordersRight,
6233
+ ACTION_FORMAT_bordersBottom as bordersBottom,
6234
+ ACTION_FORMAT_bordersClear as bordersClear,
6235
+ };
6236
+ }
6237
+
6238
+ declare const hideCols: ActionSpec;
6239
+ declare const unhideCols: ActionSpec;
6240
+ declare const unhideAllCols: ActionSpec;
6241
+ declare const hideRows: ActionSpec;
6242
+ declare const unhideRows: ActionSpec;
6243
+ declare const unhideAllRows: ActionSpec;
6244
+ declare const unFreezePane: ActionSpec;
6245
+ declare const freezePane: ActionSpec;
6246
+ declare const unFreezeRows: ActionSpec;
6247
+ declare const freezeFirstRow: ActionSpec;
6248
+ declare const freezeSecondRow: ActionSpec;
6249
+ declare const freezeCurrentRow: ActionSpec;
6250
+ declare const unFreezeCols: ActionSpec;
6251
+ declare const freezeFirstCol: ActionSpec;
6252
+ declare const freezeSecondCol: ActionSpec;
6253
+ declare const freezeCurrentCol: ActionSpec;
6254
+ declare const viewGridlines: ActionSpec;
6255
+ declare const viewFormulas: ActionSpec;
6256
+ declare const createRemoveFilter: ActionSpec;
6257
+
6258
+ declare const ACTION_VIEW_hideCols: typeof hideCols;
6259
+ declare const ACTION_VIEW_unhideCols: typeof unhideCols;
6260
+ declare const ACTION_VIEW_unhideAllCols: typeof unhideAllCols;
6261
+ declare const ACTION_VIEW_hideRows: typeof hideRows;
6262
+ declare const ACTION_VIEW_unhideRows: typeof unhideRows;
6263
+ declare const ACTION_VIEW_unhideAllRows: typeof unhideAllRows;
6264
+ declare const ACTION_VIEW_unFreezePane: typeof unFreezePane;
6265
+ declare const ACTION_VIEW_freezePane: typeof freezePane;
6266
+ declare const ACTION_VIEW_unFreezeRows: typeof unFreezeRows;
6267
+ declare const ACTION_VIEW_freezeFirstRow: typeof freezeFirstRow;
6268
+ declare const ACTION_VIEW_freezeSecondRow: typeof freezeSecondRow;
6269
+ declare const ACTION_VIEW_freezeCurrentRow: typeof freezeCurrentRow;
6270
+ declare const ACTION_VIEW_unFreezeCols: typeof unFreezeCols;
6271
+ declare const ACTION_VIEW_freezeFirstCol: typeof freezeFirstCol;
6272
+ declare const ACTION_VIEW_freezeSecondCol: typeof freezeSecondCol;
6273
+ declare const ACTION_VIEW_freezeCurrentCol: typeof freezeCurrentCol;
6274
+ declare const ACTION_VIEW_viewGridlines: typeof viewGridlines;
6275
+ declare const ACTION_VIEW_viewFormulas: typeof viewFormulas;
6276
+ declare const ACTION_VIEW_createRemoveFilter: typeof createRemoveFilter;
6277
+ declare namespace ACTION_VIEW {
6278
+ export {
6279
+ ACTION_VIEW_hideCols as hideCols,
6280
+ ACTION_VIEW_unhideCols as unhideCols,
6281
+ ACTION_VIEW_unhideAllCols as unhideAllCols,
6282
+ ACTION_VIEW_hideRows as hideRows,
6283
+ ACTION_VIEW_unhideRows as unhideRows,
6284
+ ACTION_VIEW_unhideAllRows as unhideAllRows,
6285
+ ACTION_VIEW_unFreezePane as unFreezePane,
6286
+ ACTION_VIEW_freezePane as freezePane,
6287
+ ACTION_VIEW_unFreezeRows as unFreezeRows,
6288
+ ACTION_VIEW_freezeFirstRow as freezeFirstRow,
6289
+ ACTION_VIEW_freezeSecondRow as freezeSecondRow,
6290
+ ACTION_VIEW_freezeCurrentRow as freezeCurrentRow,
6291
+ ACTION_VIEW_unFreezeCols as unFreezeCols,
6292
+ ACTION_VIEW_freezeFirstCol as freezeFirstCol,
6293
+ ACTION_VIEW_freezeSecondCol as freezeSecondCol,
6294
+ ACTION_VIEW_freezeCurrentCol as freezeCurrentCol,
6295
+ ACTION_VIEW_viewGridlines as viewGridlines,
6296
+ ACTION_VIEW_viewFormulas as viewFormulas,
6297
+ ACTION_VIEW_createRemoveFilter as createRemoveFilter,
6298
+ };
6299
+ }
6300
+
6301
+ interface Props$b {
6302
+ action: ActionSpec;
6303
+ hasTriangleDownIcon?: boolean;
6304
+ selectedColor?: string;
6305
+ class?: string;
6306
+ onClick?: (ev: MouseEvent) => void;
6307
+ }
6308
+ declare class ActionButton extends Component<Props$b, SpreadsheetChildEnv> {
6309
+ static template: string;
6310
+ private actionButton;
6311
+ setup(): void;
6312
+ get isVisible(): boolean;
6313
+ get isEnabled(): boolean;
6314
+ get isActive(): boolean | undefined;
6315
+ get title(): string;
6316
+ get iconTitle(): string;
6317
+ onClick(ev: MouseEvent): void;
6318
+ get buttonStyle(): string;
6319
+ }
6320
+
5965
6321
  interface Props$a {
5966
6322
  values: AutocompleteValue[];
5967
6323
  selectedIndex: number;
@@ -6158,10 +6514,11 @@ declare class FontSizeEditor extends Component<Props$7, SpreadsheetChildEnv> {
6158
6514
  onInputKeydown(ev: KeyboardEvent): void;
6159
6515
  }
6160
6516
 
6161
- declare type Tool = "" | "formatTool" | "alignTool" | "textColorTool" | "fillColorTool" | "borderTool";
6162
6517
  interface State {
6163
6518
  menuState: MenuState;
6164
- activeTool: Tool;
6519
+ activeTool: string;
6520
+ fillColor: string;
6521
+ textColor: string;
6165
6522
  }
6166
6523
  interface Props$6 {
6167
6524
  onClick: () => void;
@@ -6171,73 +6528,37 @@ interface Props$6 {
6171
6528
  }
6172
6529
  declare class TopBar extends Component<Props$6, SpreadsheetChildEnv> {
6173
6530
  static template: string;
6531
+ get dropdownStyle(): string;
6174
6532
  static components: {
6175
6533
  ColorPickerWidget: typeof ColorPickerWidget;
6534
+ ColorPicker: typeof ColorPicker;
6176
6535
  Menu: typeof Menu;
6177
6536
  TopBarComposer: typeof TopBarComposer;
6178
6537
  FontSizeEditor: typeof FontSizeEditor;
6538
+ ActionButton: typeof ActionButton;
6179
6539
  };
6180
- commonFormats: ({
6181
- name: string;
6182
- text: string;
6183
- description?: undefined;
6184
- value?: undefined;
6185
- } | {
6186
- name: string;
6187
- text: string;
6188
- description: string;
6189
- value: string;
6190
- })[];
6191
- customFormats: {
6192
- name: string;
6193
- text: string;
6194
- sidePanel: string;
6195
- }[];
6196
- currentFormatName: string;
6197
- get dropdownStyle(): string;
6198
- style: Style;
6199
6540
  state: State;
6200
6541
  isSelectingMenu: boolean;
6201
6542
  openedEl: HTMLElement | null;
6202
- inMerge: boolean;
6203
- cannotMerge: boolean;
6204
- undoTool: boolean;
6205
- redoTool: boolean;
6206
- paintFormatTool: boolean;
6207
- fillColor: Color;
6208
- textColor: Color;
6209
- menus: MenuItem[];
6543
+ menus: Action[];
6544
+ EDIT: typeof ACTION_EDIT;
6545
+ FORMAT: typeof ACTION_FORMAT;
6546
+ VIEW: typeof ACTION_VIEW;
6547
+ formatNumberMenuItemSpec: ActionSpec;
6548
+ isntToolbarMenu: boolean;
6210
6549
  setup(): void;
6211
6550
  get topbarComponents(): TopbarComponent[];
6212
6551
  onExternalClick(ev: MouseEvent): void;
6213
6552
  onClick(): void;
6214
- toggleStyle(style: string): void;
6215
- toggleFormat(formatName: string): void;
6216
- toggleHorizontalAlign(align: Align): void;
6217
- toggleVerticalAlign(verticalAlign: VerticalAlign): void;
6218
- toggleTextWrapping(wrapping: Wrapping): void;
6219
- onMenuMouseOver(menu: MenuItem, ev: MouseEvent): void;
6220
- toggleDropdownTool(tool: Tool, ev: MouseEvent): void;
6221
- toggleContextMenu(menu: MenuItem, ev: MouseEvent): void;
6553
+ onMenuMouseOver(menu: Action, ev: MouseEvent): void;
6554
+ toggleDropdownTool(tool: string, ev: MouseEvent): void;
6555
+ toggleContextMenu(menu: Action, ev: MouseEvent): void;
6556
+ toggleToolbarContextMenu(menuSpec: ActionSpec, ev: MouseEvent): void;
6222
6557
  private openMenu;
6223
6558
  closeMenus(): void;
6224
6559
  updateCellState(): void;
6225
- getMenuName(menu: MenuItem): string;
6226
- toggleMerge(): void;
6560
+ getMenuName(menu: Action): string;
6227
6561
  setColor(target: string, color: Color): void;
6228
- setBorder(command: BorderCommand): void;
6229
- setFormat(format: Format, custom: boolean): void;
6230
- openCustomFormatSidePanel(custom: string): void;
6231
- setDecimal(step: SetDecimalStep): void;
6232
- paintFormat(): void;
6233
- clearFormatting(): void;
6234
- doAction(action: (env: SpreadsheetChildEnv) => void): void;
6235
- undo(): void;
6236
- redo(): void;
6237
- get selectionContainsFilter(): boolean;
6238
- get cannotCreateFilter(): boolean;
6239
- createFilter(): void;
6240
- removeFilter(): void;
6241
6562
  }
6242
6563
 
6243
6564
  declare type ComposerFocusType = "inactive" | "cellFocus" | "contentFocus";
@@ -6612,7 +6933,7 @@ declare function createEmptySheet(sheetId: UID, name: string): SheetData;
6612
6933
  declare function createEmptyWorkbookData(sheetName?: string): WorkbookData;
6613
6934
  declare function createEmptyExcelSheet(sheetId: UID, name: string): ExcelSheetData;
6614
6935
 
6615
- declare const DATETIME_FORMAT: RegExp;
6936
+ declare function genericRepeat<T extends Command>(getters: Getters, command: T): T;
6616
6937
 
6617
6938
  /**
6618
6939
  * We export here all entities that needs to be accessed publicly by Odoo.
@@ -6684,6 +7005,9 @@ declare const registries: {
6684
7005
  inverseCommandRegistry: Registry<(cmd: CoreCommand) => CoreCommand[]>;
6685
7006
  urlRegistry: Registry<LinkSpec>;
6686
7007
  cellPopoverRegistry: Registry<PopoverBuilders>;
7008
+ numberFormatMenuRegistry: MenuItemRegistry;
7009
+ repeatLocalCommandTransformRegistry: Registry<(getters: Getters, cmd: LocalCommand, childCommands: readonly CoreCommand[]) => LocalCommand | CoreCommand[] | undefined>;
7010
+ repeatCommandTransformRegistry: Registry<(getters: Getters, cmd: CoreCommand) => CoreCommand | undefined>;
6687
7011
  };
6688
7012
  declare const helpers: {
6689
7013
  arg: typeof arg;
@@ -6712,6 +7036,7 @@ declare const helpers: {
6712
7036
  positionToZone: typeof positionToZone;
6713
7037
  isDefined: typeof isDefined;
6714
7038
  lazy: typeof lazy;
7039
+ genericRepeat: typeof genericRepeat;
6715
7040
  };
6716
7041
  declare const links: {
6717
7042
  isMarkdownLink: typeof isMarkdownLink;
@@ -6739,4 +7064,4 @@ declare const components: {
6739
7064
  };
6740
7065
  declare function addFunction(functionName: string, functionDescription: FunctionDescription): void;
6741
7066
 
6742
- 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 };
7067
+ 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, setDefaultSheetViewSize, setTranslationMethod, tokenize };