@odoo/o-spreadsheet 16.4.20 → 16.4.23

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.
@@ -1523,7 +1523,7 @@ declare class EditionPlugin extends UIPlugin {
1523
1523
  getEditionMode(): EditionMode;
1524
1524
  getCurrentContent(): string;
1525
1525
  getComposerSelection(): ComposerSelection;
1526
- getCurrentEditedCell(): CellPosition;
1526
+ getCurrentEditedCell(): CellPosition | undefined;
1527
1527
  isSelectingForComposer(): boolean;
1528
1528
  showSelectionIndicator(): boolean;
1529
1529
  getCurrentTokens(): EnrichedToken[];
@@ -2866,6 +2866,12 @@ interface ClipboardInterface {
2866
2866
  readText(): Promise<ClipboardReadResult>;
2867
2867
  }
2868
2868
 
2869
+ declare class FocusableElement {
2870
+ private focusableElement;
2871
+ setFocusableElement(element: HTMLElement): void;
2872
+ focus(): void;
2873
+ }
2874
+
2869
2875
  type TranslationFunction = (string: string, ...values: string[] | [{
2870
2876
  [key: string]: string;
2871
2877
  }]) => string;
@@ -2900,6 +2906,7 @@ interface SpreadsheetChildEnv extends SpreadsheetEnv {
2900
2906
  startCellEdition: (content: string) => void;
2901
2907
  loadCurrencies?: () => Promise<Currency[]>;
2902
2908
  loadLocales: () => Promise<Locale[]>;
2909
+ focusableElement: FocusableElement;
2903
2910
  }
2904
2911
 
2905
2912
  type ArgType = "ANY" | "BOOLEAN" | "NUMBER" | "STRING" | "DATE" | "RANGE" | "RANGE<BOOLEAN>" | "RANGE<NUMBER>" | "RANGE<DATE>" | "RANGE<STRING>" | "RANGE<ANY>" | "META";
@@ -2979,8 +2986,9 @@ declare class RangeAdapter implements CommandHandler<CoreCommand> {
2979
2986
  *
2980
2987
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
2981
2988
  * @param forSheetId the id of the sheet where the range string is supposed to be used.
2989
+ * @param [useFixedZone=false] if true, the range will be returned with fixed row and column
2982
2990
  */
2983
- getRangeString(range: Range, forSheetId: UID): string;
2991
+ getRangeString(range: Range, forSheetId: UID, useFixedZone?: boolean): string;
2984
2992
  getRangeDataFromXc(sheetId: UID, xc: string): RangeData;
2985
2993
  getRangeDataFromZone(sheetId: UID, zone: Zone | UnboundedZone): RangeData;
2986
2994
  getRangeFromZone(sheetId: UID, zone: Zone | UnboundedZone): Range;
@@ -3199,7 +3207,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3199
3207
  * starting an async evaluation even if it has been moved or re-allocated
3200
3208
  */
3201
3209
  getCellById(cellId: UID): Cell | undefined;
3202
- buildFormulaContent(sheetId: UID, cell: Pick<FormulaCell, "dependencies" | "compiledFormula">, dependencies?: Range[]): string;
3210
+ buildFormulaContent(sheetId: UID, cell: Pick<FormulaCell, "dependencies" | "compiledFormula">, dependencies?: Range[], useFixedZone?: boolean): string;
3203
3211
  getFormulaCellContent(sheetId: UID, cell: FormulaCell): string;
3204
3212
  getCellStyle(position: CellPosition): Style;
3205
3213
  /**
@@ -3245,6 +3253,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3245
3253
  private createErrorFormula;
3246
3254
  private checkCellOutOfSheet;
3247
3255
  private checkUselessClearCell;
3256
+ private checkUselessUpdateCell;
3248
3257
  }
3249
3258
 
3250
3259
  /**
@@ -6673,11 +6682,12 @@ interface AutocompleteValue {
6673
6682
  }
6674
6683
  interface ComposerProps {
6675
6684
  focus: ComposerFocusType;
6676
- onComposerContentFocused: (selection: ComposerSelection) => void;
6677
6685
  inputStyle?: string;
6678
6686
  rect?: Rect;
6679
6687
  delimitation?: DOMDimension;
6680
- onComposerUnmounted?: () => void;
6688
+ onComposerContentFocused: () => void;
6689
+ onComposerCellFocused?: (content: String) => void;
6690
+ isDefaultFocus?: boolean;
6681
6691
  }
6682
6692
  interface ComposerState$1 {
6683
6693
  positionStart: number;
@@ -6702,6 +6712,7 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
6702
6712
  };
6703
6713
  static defaultProps: {
6704
6714
  inputStyle: string;
6715
+ isDefaultFocus: boolean;
6705
6716
  };
6706
6717
  composerRef: {
6707
6718
  el: HTMLElement | null;
@@ -6724,7 +6735,6 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
6724
6735
  private processArrowKeys;
6725
6736
  private handleArrowKeysForAutocomplete;
6726
6737
  private processTabKey;
6727
- processSpaceKey(ev: KeyboardEvent): void;
6728
6738
  private processEnterKey;
6729
6739
  private processEscapeKey;
6730
6740
  private processF4Key;
@@ -6732,6 +6742,7 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
6732
6742
  onCompositionStart(): void;
6733
6743
  onCompositionEnd(): void;
6734
6744
  onKeydown(ev: KeyboardEvent): void;
6745
+ onPaste(ev: ClipboardEvent): void;
6735
6746
  onInput(ev: InputEvent): void;
6736
6747
  onKeyup(ev: KeyboardEvent): void;
6737
6748
  showAutocomplete(searchTerm: string): void;
@@ -6910,7 +6921,7 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
6910
6921
  focusGrid(): void;
6911
6922
  onKeydown(ev: KeyboardEvent): void;
6912
6923
  onTopBarComposerFocused(selection: ComposerSelection): void;
6913
- onGridComposerContentFocused(): void;
6924
+ onGridComposerContentFocused(selection: ComposerSelection): void;
6914
6925
  onGridComposerCellFocused(content?: string, selection?: ComposerSelection): void;
6915
6926
  /**
6916
6927
  * Start the edition or update the content if it's already started.
@@ -6921,8 +6932,8 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
6921
6932
 
6922
6933
  interface Props$5 {
6923
6934
  focus: ComposerFocusType;
6924
- onComposerUnmounted: () => void;
6925
- onComposerContentFocused: (selection: ComposerSelection) => void;
6935
+ onComposerContentFocused: () => void;
6936
+ onComposerCellFocused: () => void;
6926
6937
  gridDims: DOMDimension;
6927
6938
  }
6928
6939
  /**
@@ -6934,17 +6945,23 @@ declare class GridComposer extends Component<Props$5, SpreadsheetChildEnv> {
6934
6945
  static components: {
6935
6946
  Composer: typeof Composer;
6936
6947
  };
6937
- private gridComposerRef;
6938
- private zone;
6939
6948
  private rect;
6949
+ private isEditing;
6940
6950
  private isCellReferenceVisible;
6941
- private composerState;
6951
+ get defaultRect(): {
6952
+ x: number;
6953
+ y: number;
6954
+ width: number;
6955
+ height: number;
6956
+ };
6942
6957
  setup(): void;
6943
6958
  get shouldDisplayCellReference(): boolean;
6944
6959
  get cellReference(): string;
6945
6960
  get cellReferenceStyle(): string;
6961
+ get composerProps(): ComposerProps;
6946
6962
  get containerStyle(): string;
6947
- get composerStyle(): string;
6963
+ private updateComponentPosition;
6964
+ private updateCellReferenceVisibility;
6948
6965
  }
6949
6966
 
6950
6967
  interface ResizerState {
@@ -7144,7 +7161,6 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
7144
7161
  readonly HEADER_WIDTH = 48;
7145
7162
  private menuState;
7146
7163
  private gridRef;
7147
- private hiddenInput;
7148
7164
  onMouseWheel: (ev: WheelEvent) => void;
7149
7165
  canvasPosition: DOMCoordinates;
7150
7166
  hoveredCell: Partial<Position$1>;
@@ -7156,7 +7172,7 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
7156
7172
  get gridOverlayDimensions(): string;
7157
7173
  onClosePopover(): void;
7158
7174
  private keyDownMapping;
7159
- focus(): void;
7175
+ focusDefaultElement(): void;
7160
7176
  get gridEl(): HTMLElement;
7161
7177
  getAutofillPosition(): {
7162
7178
  left: number;
@@ -7176,7 +7192,6 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
7176
7192
  closeOpenedPopover(): void;
7177
7193
  processArrows(ev: KeyboardEvent): void;
7178
7194
  onKeydown(ev: KeyboardEvent): void;
7179
- onInput(ev: InputEvent): void;
7180
7195
  onInputContextMenu(ev: MouseEvent): void;
7181
7196
  onCellRightClicked(col: HeaderIndex, row: HeaderIndex, { x, y }: DOMCoordinates): void;
7182
7197
  toggleContextMenu(type: ContextMenuType, x: Pixel, y: Pixel): void;