@odoo/o-spreadsheet 17.1.0-alpha.4 → 17.1.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -776,7 +776,7 @@ interface TransportService<T = any> {
776
776
  }
777
777
 
778
778
  declare class Revision implements RevisionData {
779
- readonly rootCommand?: Command | "SNAPSHOT" | "REMOTE" | undefined;
779
+ readonly rootCommand?: Command | undefined;
780
780
  readonly timestamp?: number | undefined;
781
781
  readonly id: UID;
782
782
  readonly clientId: ClientId;
@@ -791,7 +791,7 @@ declare class Revision implements RevisionData {
791
791
  * - clientId: Client who initiated the action
792
792
  * - changes: List of changes applied on the state.
793
793
  */
794
- constructor(id: UID, clientId: ClientId, commands: readonly CoreCommand[], rootCommand?: Command | "SNAPSHOT" | "REMOTE" | undefined, changes?: readonly HistoryChange[], timestamp?: number | undefined);
794
+ constructor(id: UID, clientId: ClientId, commands: readonly CoreCommand[], rootCommand?: Command | undefined, changes?: readonly HistoryChange[], timestamp?: number | undefined);
795
795
  setChanges(changes: readonly HistoryChange[]): void;
796
796
  get commands(): readonly CoreCommand[];
797
797
  get changes(): readonly HistoryChange[];
@@ -820,6 +820,7 @@ declare class Session extends EventBus<CollaborativeEvent> {
820
820
  private isReplayingInitialRevisions;
821
821
  private processedRevisions;
822
822
  private uuidGenerator;
823
+ private lastLocalOperation;
823
824
  /**
824
825
  * Manages the collaboration between multiple users on the same spreadsheet.
825
826
  * It can forward local state changes to other users to ensure they all eventually
@@ -861,9 +862,9 @@ declare class Session extends EventBus<CollaborativeEvent> {
861
862
  getRevisionId(): UID;
862
863
  isFullySynchronized(): boolean;
863
864
  /**
864
- * Get the last local revision whose root command isn't in the given list of ignored commands
865
+ * Get the last local revision
865
866
  * */
866
- getLastLocalNonEmptyRevision(ignoredRootCommands: CommandTypes[]): Revision | undefined;
867
+ getLastLocalNonEmptyRevision(): Revision | undefined;
867
868
  private _move;
868
869
  /**
869
870
  * Handles messages received from other clients in the collaborative
@@ -1615,7 +1616,7 @@ declare enum ClipboardMIMEType {
1615
1616
  type ClipboardContent = {
1616
1617
  [type in ClipboardMIMEType]?: string;
1617
1618
  };
1618
- type ClipboardPasteOptions = "onlyFormat" | "onlyValue";
1619
+ type ClipboardPasteOptions = "onlyFormat" | "asValue";
1619
1620
 
1620
1621
  interface SearchOptions {
1621
1622
  matchCase: boolean;
@@ -1703,6 +1704,7 @@ interface MoveColumnsRowsCommand extends HeadersDependentCommand {
1703
1704
  type: "MOVE_COLUMNS_ROWS";
1704
1705
  base: HeaderIndex;
1705
1706
  elements: HeaderIndex[];
1707
+ position: "before" | "after";
1706
1708
  }
1707
1709
  interface ResizeColumnsRowsCommand extends HeadersDependentCommand {
1708
1710
  type: "RESIZE_COLUMNS_ROWS";
@@ -1825,10 +1827,7 @@ interface DeleteFigureCommand extends SheetDependentCommand {
1825
1827
  interface CreateChartCommand extends SheetDependentCommand {
1826
1828
  type: "CREATE_CHART";
1827
1829
  id: UID;
1828
- position?: {
1829
- x: Pixel;
1830
- y: Pixel;
1831
- };
1830
+ position?: DOMCoordinates;
1832
1831
  size?: FigureSize;
1833
1832
  definition: ChartDefinition;
1834
1833
  }
@@ -1840,10 +1839,7 @@ interface UpdateChartCommand extends SheetDependentCommand {
1840
1839
  interface CreateImageOverCommand extends SheetDependentCommand {
1841
1840
  type: "CREATE_IMAGE";
1842
1841
  figureId: UID;
1843
- position: {
1844
- x: Pixel;
1845
- y: Pixel;
1846
- };
1842
+ position: DOMCoordinates;
1847
1843
  size: FigureSize;
1848
1844
  definition: Image;
1849
1845
  }
@@ -2599,6 +2595,7 @@ type ValueAndFormat = {
2599
2595
  };
2600
2596
  type Arg = Maybe<ValueAndFormat> | Matrix<ValueAndFormat>;
2601
2597
  type ArgValue = Maybe<CellValue> | Matrix<CellValue>;
2598
+ declare function isMatrix(x: any): x is Matrix<any>;
2602
2599
  interface HeaderDimensions {
2603
2600
  start: Pixel;
2604
2601
  size: Pixel;
@@ -4029,25 +4026,23 @@ declare class CustomColorsPlugin extends UIPlugin<CustomColorState> {
4029
4026
  private tryToAddColor;
4030
4027
  }
4031
4028
 
4029
+ interface EvaluationChartStyle {
4030
+ background: Color;
4031
+ fontColor: Color;
4032
+ }
4032
4033
  interface EvaluationChartState {
4033
4034
  charts: Record<UID, ChartRuntime | undefined>;
4034
4035
  }
4035
4036
  declare class EvaluationChartPlugin extends UIPlugin<EvaluationChartState> {
4036
- static getters: readonly ["getChartRuntime", "getBackgroundOfSingleCellChart"];
4037
+ static getters: readonly ["getChartRuntime", "getStyleOfSingleCellChart"];
4037
4038
  charts: Record<UID, ChartRuntime | undefined>;
4038
4039
  private createRuntimeChart;
4039
4040
  handle(cmd: CoreViewCommand): void;
4040
4041
  getChartRuntime(figureId: UID): ChartRuntime;
4041
4042
  /**
4042
- * Get the background color of a chart based on the color of the first cell of the main range
4043
- * of the chart. In order of priority, it will return :
4044
- *
4045
- * - the chart background color if one is defined
4046
- * - the fill color of the cell if one is defined
4047
- * - the fill color of the cell from conditional formats if one is defined
4048
- * - the default chart color if no other color is defined
4043
+ * Get the background and textColor of a chart based on the color of the first cell of the main range of the chart.
4049
4044
  */
4050
- getBackgroundOfSingleCellChart(chartBackground: Color | undefined, mainRange: Range | undefined): Color;
4045
+ getStyleOfSingleCellChart(chartBackground: Color | undefined, mainRange: Range | undefined): EvaluationChartStyle;
4051
4046
  exportForExcel(data: ExcelWorkbookData): void;
4052
4047
  }
4053
4048
 
@@ -4891,18 +4886,12 @@ declare class InternalViewport {
4891
4886
  canScrollHorizontally: boolean;
4892
4887
  viewportWidth: Pixel;
4893
4888
  viewportHeight: Pixel;
4894
- offsetCorrectionX: Pixel;
4895
- offsetCorrectionY: Pixel;
4896
- constructor(getters: Getters, sheetId: UID, boundaries: Zone, sizeInGrid: {
4897
- width: Pixel;
4898
- height: Pixel;
4899
- }, options: {
4889
+ private offsetCorrectionX;
4890
+ private offsetCorrectionY;
4891
+ constructor(getters: Getters, sheetId: UID, boundaries: Zone, sizeInGrid: DOMDimension, options: {
4900
4892
  canScrollVertically: boolean;
4901
4893
  canScrollHorizontally: boolean;
4902
- }, offsets: {
4903
- x: Pixel;
4904
- y: Pixel;
4905
- });
4894
+ }, offsets: DOMCoordinates);
4906
4895
  /** Returns the maximum size (in Pixels) of the viewport relative to its allocated client size
4907
4896
  * When the viewport grid size is smaller than its client width (resp. height), it will return
4908
4897
  * the client width (resp. height).
@@ -4925,9 +4914,9 @@ declare class InternalViewport {
4925
4914
  * the pane that is actually displayed on the client. We therefore adjust the offset of the pane
4926
4915
  * until it contains the cell completely.
4927
4916
  */
4928
- adjustPosition(position?: Position$1): void;
4929
- adjustPositionX(targetCol: HeaderIndex): void;
4930
- adjustPositionY(targetRow: HeaderIndex): void;
4917
+ adjustPosition(position: Position$1): void;
4918
+ private adjustPositionX;
4919
+ private adjustPositionY;
4931
4920
  setViewportOffset(offsetX: Pixel, offsetY: Pixel): void;
4932
4921
  adjustViewportZone(): void;
4933
4922
  /**
@@ -4938,7 +4927,6 @@ declare class InternalViewport {
4938
4927
  getRect(zone: Zone): Rect | undefined;
4939
4928
  isVisible(col: HeaderIndex, row: HeaderIndex): boolean;
4940
4929
  private searchHeaderIndex;
4941
- private get zone();
4942
4930
  private setViewportOffsetX;
4943
4931
  private setViewportOffsetY;
4944
4932
  /** Corrects the viewport's horizontal offset based on the current structure
@@ -6418,8 +6406,8 @@ interface Props$m {
6418
6406
  onCellHovered: (position: Partial<Position$1>) => void;
6419
6407
  onCellDoubleClicked: (col: HeaderIndex, row: HeaderIndex) => void;
6420
6408
  onCellClicked: (col: HeaderIndex, row: HeaderIndex, modifiers: {
6421
- ctrlKey: boolean;
6422
- shiftKey: boolean;
6409
+ addZone: boolean;
6410
+ expandZone: boolean;
6423
6411
  }) => void;
6424
6412
  onCellRightClicked: (col: HeaderIndex, row: HeaderIndex, coordinates: DOMCoordinates) => void;
6425
6413
  onGridResized: (dimension: Rect) => void;
@@ -6725,6 +6713,7 @@ declare namespace ACTION_EDIT {
6725
6713
  }
6726
6714
 
6727
6715
  declare const formatNumberAutomatic: ActionSpec;
6716
+ declare const formatNumberPlainText: ActionSpec;
6728
6717
  declare const formatNumberNumber: ActionSpec;
6729
6718
  declare const formatPercent: ActionSpec;
6730
6719
  declare const formatNumberPercent: ActionSpec;
@@ -6799,6 +6788,7 @@ declare const ACTION_FORMAT_formatNumberFullMonth: typeof formatNumberFullMonth;
6799
6788
  declare const ACTION_FORMAT_formatNumberFullWeekDayAndMonth: typeof formatNumberFullWeekDayAndMonth;
6800
6789
  declare const ACTION_FORMAT_formatNumberNumber: typeof formatNumberNumber;
6801
6790
  declare const ACTION_FORMAT_formatNumberPercent: typeof formatNumberPercent;
6791
+ declare const ACTION_FORMAT_formatNumberPlainText: typeof formatNumberPlainText;
6802
6792
  declare const ACTION_FORMAT_formatNumberShortMonth: typeof formatNumberShortMonth;
6803
6793
  declare const ACTION_FORMAT_formatNumberShortWeekDay: typeof formatNumberShortWeekDay;
6804
6794
  declare const ACTION_FORMAT_formatNumberTime: typeof formatNumberTime;
@@ -6845,6 +6835,7 @@ declare namespace ACTION_FORMAT {
6845
6835
  ACTION_FORMAT_formatNumberFullWeekDayAndMonth as formatNumberFullWeekDayAndMonth,
6846
6836
  ACTION_FORMAT_formatNumberNumber as formatNumberNumber,
6847
6837
  ACTION_FORMAT_formatNumberPercent as formatNumberPercent,
6838
+ ACTION_FORMAT_formatNumberPlainText as formatNumberPlainText,
6848
6839
  ACTION_FORMAT_formatNumberShortMonth as formatNumberShortMonth,
6849
6840
  ACTION_FORMAT_formatNumberShortWeekDay as formatNumberShortWeekDay,
6850
6841
  ACTION_FORMAT_formatNumberTime as formatNumberTime,
@@ -7420,6 +7411,7 @@ interface ResizerState {
7420
7411
  draggerShadowThickness: number;
7421
7412
  delta: number;
7422
7413
  base: number;
7414
+ position: "before" | "after";
7423
7415
  }
7424
7416
  interface ResizerProps {
7425
7417
  onOpenContextMenu: (type: ContextMenuType, x: Pixel, y: Pixel) => void;
@@ -7442,7 +7434,7 @@ declare abstract class AbstractResizer extends Component<ResizerProps, Spreadshe
7442
7434
  abstract _getMaxSize(): Pixel;
7443
7435
  abstract _updateSize(): void;
7444
7436
  abstract _moveElements(): void;
7445
- abstract _selectElement(index: HeaderIndex, ctrlKey: boolean): void;
7437
+ abstract _selectElement(index: HeaderIndex, addDistinctHeader: boolean): void;
7446
7438
  abstract _increaseSelection(index: HeaderIndex): void;
7447
7439
  abstract _fitElementSize(index: HeaderIndex): void;
7448
7440
  abstract _getType(): ContextMenuType;
@@ -7476,7 +7468,7 @@ declare class ColResizer extends AbstractResizer {
7476
7468
  _getMaxSize(): Pixel;
7477
7469
  _updateSize(): void;
7478
7470
  _moveElements(): void;
7479
- _selectElement(index: HeaderIndex, ctrlKey: boolean): void;
7471
+ _selectElement(index: HeaderIndex, addDistinctHeader: boolean): void;
7480
7472
  _increaseSelection(index: HeaderIndex): void;
7481
7473
  _fitElementSize(index: HeaderIndex): void;
7482
7474
  _getType(): ContextMenuType;
@@ -7501,7 +7493,7 @@ declare class RowResizer extends AbstractResizer {
7501
7493
  _getMaxSize(): Pixel;
7502
7494
  _updateSize(): void;
7503
7495
  _moveElements(): void;
7504
- _selectElement(index: HeaderIndex, ctrlKey: boolean): void;
7496
+ _selectElement(index: HeaderIndex, addDistinctHeader: boolean): void;
7505
7497
  _increaseSelection(index: HeaderIndex): void;
7506
7498
  _fitElementSize(index: HeaderIndex): void;
7507
7499
  _getType(): ContextMenuType;
@@ -7628,9 +7620,9 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
7628
7620
  getClientPositionKey(client: Client): string;
7629
7621
  isCellHovered(col: HeaderIndex, row: HeaderIndex): boolean;
7630
7622
  private getGridRect;
7631
- onCellClicked(col: HeaderIndex, row: HeaderIndex, { ctrlKey, shiftKey }: {
7632
- ctrlKey: boolean;
7633
- shiftKey: boolean;
7623
+ onCellClicked(col: HeaderIndex, row: HeaderIndex, { addZone, expandZone }: {
7624
+ addZone: boolean;
7625
+ expandZone: boolean;
7634
7626
  }): void;
7635
7627
  onCellDoubleClicked(col: HeaderIndex, row: HeaderIndex): void;
7636
7628
  closeOpenedPopover(): void;
@@ -7844,6 +7836,7 @@ declare const helpers: {
7844
7836
  colorToRGBA: typeof colorToRGBA;
7845
7837
  positionToZone: typeof positionToZone;
7846
7838
  isDefined: typeof isDefined;
7839
+ isMatrix: typeof isMatrix;
7847
7840
  lazy: typeof lazy;
7848
7841
  genericRepeat: typeof genericRepeat;
7849
7842
  createAction: typeof createAction;