@odoo/o-spreadsheet 16.2.29 → 16.2.32

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.
@@ -1316,7 +1316,7 @@ declare class EditionPlugin extends UIPlugin {
1316
1316
  getCurrentContent(): string;
1317
1317
  getEditionSheet(): string;
1318
1318
  getComposerSelection(): ComposerSelection;
1319
- getCurrentEditedCell(): CellPosition;
1319
+ getCurrentEditedCell(): CellPosition | undefined;
1320
1320
  isSelectingForComposer(): boolean;
1321
1321
  showSelectionIndicator(): boolean;
1322
1322
  getCurrentTokens(): EnrichedToken[];
@@ -2567,6 +2567,12 @@ interface ClipboardInterface {
2567
2567
  readText(): Promise<ClipboardReadResult>;
2568
2568
  }
2569
2569
 
2570
+ declare class FocusableElement {
2571
+ private focusableElement;
2572
+ setFocusableElement(element: HTMLElement): void;
2573
+ focus(): void;
2574
+ }
2575
+
2570
2576
  type TranslationFunction = (string: string, ...values: string[] | [{
2571
2577
  [key: string]: string;
2572
2578
  }]) => string;
@@ -2600,6 +2606,7 @@ interface SpreadsheetChildEnv extends SpreadsheetEnv {
2600
2606
  _t: TranslationFunction;
2601
2607
  startCellEdition: (content: string) => void;
2602
2608
  loadCurrencies?: () => Promise<Currency[]>;
2609
+ focusableElement: FocusableElement;
2603
2610
  }
2604
2611
 
2605
2612
  type ArgType = "ANY" | "BOOLEAN" | "NUMBER" | "STRING" | "DATE" | "RANGE" | "RANGE<BOOLEAN>" | "RANGE<NUMBER>" | "RANGE<DATE>" | "RANGE<STRING>" | "META";
@@ -2895,8 +2902,9 @@ declare class RangeAdapter implements CommandHandler<CoreCommand> {
2895
2902
  *
2896
2903
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
2897
2904
  * @param forSheetId the id of the sheet where the range string is supposed to be used.
2905
+ * @param [useFixedZone=false] if true, the range will be returned with fixed row and column
2898
2906
  */
2899
- getRangeString(range: Range, forSheetId: UID): string;
2907
+ getRangeString(range: Range, forSheetId: UID, useFixedZone?: boolean): string;
2900
2908
  getRangeDataFromXc(sheetId: UID, xc: string): RangeData;
2901
2909
  getRangeDataFromZone(sheetId: UID, zone: Zone): RangeData;
2902
2910
  getRangeFromRangeData(data: RangeData): Range;
@@ -3114,7 +3122,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3114
3122
  * starting an async evaluation even if it has been moved or re-allocated
3115
3123
  */
3116
3124
  getCellById(cellId: UID): Cell | undefined;
3117
- buildFormulaContent(sheetId: UID, cell: Pick<FormulaCell, "dependencies" | "compiledFormula">, dependencies?: Range[]): string;
3125
+ buildFormulaContent(sheetId: UID, cell: Pick<FormulaCell, "dependencies" | "compiledFormula">, dependencies?: Range[], useFixedZone?: boolean): string;
3118
3126
  getFormulaCellContent(sheetId: UID, cell: FormulaCell): string;
3119
3127
  getCellStyle(position: CellPosition): Style;
3120
3128
  /**
@@ -3160,6 +3168,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3160
3168
  private createErrorFormula;
3161
3169
  private checkCellOutOfSheet;
3162
3170
  private checkUselessClearCell;
3171
+ private checkUselessUpdateCell;
3163
3172
  }
3164
3173
 
3165
3174
  /**
@@ -6075,11 +6084,12 @@ interface AutocompleteValue {
6075
6084
  }
6076
6085
  interface ComposerProps {
6077
6086
  focus: ComposerFocusType;
6078
- onComposerContentFocused: (selection: ComposerSelection) => void;
6079
6087
  inputStyle?: string;
6080
6088
  rect?: Rect;
6081
6089
  delimitation?: DOMDimension;
6082
- onComposerUnmounted?: () => void;
6090
+ onComposerContentFocused: () => void;
6091
+ onComposerCellFocused?: (content: String) => void;
6092
+ isDefaultFocus?: boolean;
6083
6093
  }
6084
6094
  interface ComposerState$1 {
6085
6095
  positionStart: number;
@@ -6104,6 +6114,7 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
6104
6114
  };
6105
6115
  static defaultProps: {
6106
6116
  inputStyle: string;
6117
+ isDefaultFocus: boolean;
6107
6118
  };
6108
6119
  composerRef: {
6109
6120
  el: HTMLElement | null;
@@ -6131,7 +6142,8 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
6131
6142
  onCompositionEnd(): void;
6132
6143
  onKeydown(ev: KeyboardEvent): void;
6133
6144
  private updateCursorIfNeeded;
6134
- onInput(): void;
6145
+ onPaste(ev: ClipboardEvent): void;
6146
+ onInput(ev: InputEvent): void;
6135
6147
  onKeyup(ev: KeyboardEvent): void;
6136
6148
  showAutocomplete(searchTerm: string): void;
6137
6149
  onMousedown(ev: MouseEvent): void;
@@ -6324,7 +6336,7 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
6324
6336
  focusGrid(): void;
6325
6337
  onKeydown(ev: KeyboardEvent): void;
6326
6338
  onTopBarComposerFocused(selection: ComposerSelection): void;
6327
- onGridComposerContentFocused(): void;
6339
+ onGridComposerContentFocused(selection: ComposerSelection): void;
6328
6340
  onGridComposerCellFocused(content?: string, selection?: ComposerSelection): void;
6329
6341
  /**
6330
6342
  * Start the edition or update the content if it's already started.
@@ -6335,8 +6347,8 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
6335
6347
 
6336
6348
  interface Props$5 {
6337
6349
  focus: ComposerFocusType;
6338
- onComposerUnmounted: () => void;
6339
- onComposerContentFocused: (selection: ComposerSelection) => void;
6350
+ onComposerContentFocused: () => void;
6351
+ onComposerCellFocused: () => void;
6340
6352
  gridDims: DOMDimension;
6341
6353
  }
6342
6354
  /**
@@ -6348,17 +6360,23 @@ declare class GridComposer extends Component<Props$5, SpreadsheetChildEnv> {
6348
6360
  static components: {
6349
6361
  Composer: typeof Composer;
6350
6362
  };
6351
- private gridComposerRef;
6352
- private zone;
6353
6363
  private rect;
6364
+ private isEditing;
6354
6365
  private isCellReferenceVisible;
6355
- private composerState;
6366
+ get defaultRect(): {
6367
+ x: number;
6368
+ y: number;
6369
+ width: number;
6370
+ height: number;
6371
+ };
6356
6372
  setup(): void;
6357
6373
  get shouldDisplayCellReference(): boolean;
6358
6374
  get cellReference(): string;
6359
6375
  get cellReferenceStyle(): string;
6376
+ get composerProps(): ComposerProps;
6360
6377
  get containerStyle(): string;
6361
- get composerStyle(): string;
6378
+ private updateComponentPosition;
6379
+ private updateCellReferenceVisibility;
6362
6380
  }
6363
6381
 
6364
6382
  interface ResizerState {
@@ -6558,7 +6576,6 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
6558
6576
  readonly HEADER_WIDTH = 48;
6559
6577
  private menuState;
6560
6578
  private gridRef;
6561
- private hiddenInput;
6562
6579
  onMouseWheel: (ev: WheelEvent) => void;
6563
6580
  canvasPosition: DOMCoordinates;
6564
6581
  hoveredCell: Partial<Position$1>;
@@ -6570,7 +6587,7 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
6570
6587
  get gridOverlayDimensions(): string;
6571
6588
  onClosePopover(): void;
6572
6589
  private keyDownMapping;
6573
- focus(): void;
6590
+ focusDefaultElement(): void;
6574
6591
  get gridEl(): HTMLElement;
6575
6592
  getAutofillPosition(): {
6576
6593
  left: number;
@@ -6590,7 +6607,6 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
6590
6607
  closeOpenedPopover(): void;
6591
6608
  processArrows(ev: KeyboardEvent): void;
6592
6609
  onKeydown(ev: KeyboardEvent): void;
6593
- onInput(ev: InputEvent): void;
6594
6610
  onInputContextMenu(ev: MouseEvent): void;
6595
6611
  onCellRightClicked(col: HeaderIndex, row: HeaderIndex, { x, y }: DOMCoordinates): void;
6596
6612
  toggleContextMenu(type: ContextMenuType, x: Pixel, y: Pixel): void;