@odoo/o-spreadsheet 17.1.3 → 17.1.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.
@@ -33,8 +33,8 @@ interface EnrichedToken extends Token {
33
33
 
34
34
  type TokenType = "OPERATOR" | "NUMBER" | "STRING" | "SYMBOL" | "SPACE" | "DEBUGGER" | "ARG_SEPARATOR" | "LEFT_PAREN" | "RIGHT_PAREN" | "REFERENCE" | "INVALID_REFERENCE" | "UNKNOWN";
35
35
  interface Token {
36
- type: TokenType;
37
- value: string;
36
+ readonly type: TokenType;
37
+ readonly value: string;
38
38
  }
39
39
  declare function tokenize(str: string, locale?: Locale): Token[];
40
40
 
@@ -3007,6 +3007,12 @@ interface ClipboardInterface {
3007
3007
  readText(): Promise<ClipboardReadResult>;
3008
3008
  }
3009
3009
 
3010
+ declare class FocusableElement {
3011
+ private focusableElement;
3012
+ setFocusableElement(element: HTMLElement): void;
3013
+ focus(): void;
3014
+ }
3015
+
3010
3016
  type NotificationType = "danger" | "info" | "success" | "warning";
3011
3017
  interface InformationNotification {
3012
3018
  text: string;
@@ -3028,6 +3034,7 @@ interface SpreadsheetChildEnv extends SpreadsheetEnv {
3028
3034
  startCellEdition: (content?: string) => void;
3029
3035
  loadCurrencies?: () => Promise<Currency[]>;
3030
3036
  loadLocales: () => Promise<Locale[]>;
3037
+ focusableElement: FocusableElement;
3031
3038
  }
3032
3039
 
3033
3040
  declare class RangeAdapter implements CommandHandler<CoreCommand> {
@@ -3342,6 +3349,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3342
3349
  private createErrorFormula;
3343
3350
  private checkCellOutOfSheet;
3344
3351
  private checkUselessClearCell;
3352
+ private checkUselessUpdateCell;
3345
3353
  }
3346
3354
 
3347
3355
  /**
@@ -4692,7 +4700,7 @@ declare class UIOptionsPlugin extends UIPlugin {
4692
4700
  }
4693
4701
 
4694
4702
  declare class SheetUIPlugin extends UIPlugin {
4695
- static getters: readonly ["doesCellHaveGridIcon", "getCellWidth", "getTextWidth", "getCellText", "getCellMultiLineText", "getContiguousZone", "isCellEmpty"];
4703
+ static getters: readonly ["doesCellHaveGridIcon", "getCellWidth", "getTextWidth", "getCellText", "getCellMultiLineText", "getContiguousZone", "isEvaluatedCellEmpty"];
4696
4704
  private ctx;
4697
4705
  allowDispatch(cmd: LocalCommand): CommandResult | CommandResult[];
4698
4706
  handle(cmd: Command): void;
@@ -4710,10 +4718,15 @@ declare class SheetUIPlugin extends UIPlugin {
4710
4718
  */
4711
4719
  getContiguousZone(sheetId: UID, zoneToExpand: Zone): Zone;
4712
4720
  /**
4713
- * Check if a cell is empty. If the cell is part of a merge,
4714
- * check if the merge containing the cell is empty.
4721
+ * Checks if a cell evaluated value is empty. If the cell is part of a merge,
4722
+ * the check applies to the main cell of the merge.
4723
+ */
4724
+ isEvaluatedCellEmpty(position: CellPosition): boolean;
4725
+ /**
4726
+ * Checks if a cell is empty (i.e. does not have a content or a formula does not spread over it).
4727
+ * If the cell is part of a merge, the check applies to the main cell of the merge.
4715
4728
  */
4716
- isCellEmpty(position: CellPosition): boolean;
4729
+ private isCellEmpty;
4717
4730
  private getColMaxWidth;
4718
4731
  /**
4719
4732
  * Check that any "sheetId" in the command matches an existing
@@ -7714,6 +7727,8 @@ declare class TextValueProvider extends Component<Props$b> {
7714
7727
  onValueSelected: FunctionConstructor;
7715
7728
  onValueHovered: FunctionConstructor;
7716
7729
  };
7730
+ private autoCompleteListRef;
7731
+ setup(): void;
7717
7732
  }
7718
7733
 
7719
7734
  declare class ContentEditableHelper {
@@ -7809,11 +7824,12 @@ interface AutocompleteValue {
7809
7824
  }
7810
7825
  interface ComposerProps {
7811
7826
  focus: ComposerFocusType;
7812
- onComposerContentFocused: (selection: ComposerSelection) => void;
7813
7827
  inputStyle?: string;
7814
7828
  rect?: Rect;
7815
7829
  delimitation?: DOMDimension;
7816
- onComposerUnmounted?: () => void;
7830
+ onComposerContentFocused: () => void;
7831
+ onComposerCellFocused?: (content: String) => void;
7832
+ isDefaultFocus?: boolean;
7817
7833
  }
7818
7834
  interface ComposerState$1 {
7819
7835
  positionStart: number;
@@ -7838,7 +7854,6 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
7838
7854
  focus: {
7839
7855
  validate: (value: string) => boolean;
7840
7856
  };
7841
- onComposerContentFocused: FunctionConstructor;
7842
7857
  inputStyle: {
7843
7858
  type: StringConstructor;
7844
7859
  optional: boolean;
@@ -7851,10 +7866,15 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
7851
7866
  type: ObjectConstructor;
7852
7867
  optional: boolean;
7853
7868
  };
7854
- onComposerUnmounted: {
7869
+ onComposerCellFocused: {
7855
7870
  type: FunctionConstructor;
7856
7871
  optional: boolean;
7857
7872
  };
7873
+ onComposerContentFocused: FunctionConstructor;
7874
+ isDefaultFocus: {
7875
+ type: BooleanConstructor;
7876
+ optional: boolean;
7877
+ };
7858
7878
  };
7859
7879
  static components: {
7860
7880
  TextValueProvider: typeof TextValueProvider;
@@ -7862,6 +7882,7 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
7862
7882
  };
7863
7883
  static defaultProps: {
7864
7884
  inputStyle: string;
7885
+ isDefaultFocus: boolean;
7865
7886
  };
7866
7887
  composerRef: {
7867
7888
  el: HTMLElement | null;
@@ -7884,7 +7905,6 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
7884
7905
  private processArrowKeys;
7885
7906
  private handleArrowKeysForAutocomplete;
7886
7907
  private processTabKey;
7887
- processSpaceKey(ev: KeyboardEvent): void;
7888
7908
  private processEnterKey;
7889
7909
  private processNewLineEvent;
7890
7910
  private processEscapeKey;
@@ -7893,6 +7913,7 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
7893
7913
  onCompositionStart(): void;
7894
7914
  onCompositionEnd(): void;
7895
7915
  onKeydown(ev: KeyboardEvent): void;
7916
+ onPaste(ev: ClipboardEvent): void;
7896
7917
  onInput(ev: InputEvent): void;
7897
7918
  onKeyup(ev: KeyboardEvent): void;
7898
7919
  showFunctionAutocomplete(searchTerm: string): void;
@@ -8101,7 +8122,7 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
8101
8122
  focusGrid(): void;
8102
8123
  onKeydown(ev: KeyboardEvent): void;
8103
8124
  onTopBarComposerFocused(selection: ComposerSelection): void;
8104
- onGridComposerContentFocused(): void;
8125
+ onGridComposerContentFocused(selection: ComposerSelection): void;
8105
8126
  onGridComposerCellFocused(content?: string, selection?: ComposerSelection): void;
8106
8127
  /**
8107
8128
  * Start the edition or update the content if it's already started.
@@ -8115,8 +8136,8 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
8115
8136
 
8116
8137
  interface Props$5 {
8117
8138
  focus: ComposerFocusType;
8118
- onComposerUnmounted: () => void;
8119
- onComposerContentFocused: (selection: ComposerSelection) => void;
8139
+ onComposerContentFocused: () => void;
8140
+ onComposerCellFocused: () => void;
8120
8141
  gridDims: DOMDimension;
8121
8142
  }
8122
8143
  /**
@@ -8129,24 +8150,30 @@ declare class GridComposer extends Component<Props$5, SpreadsheetChildEnv> {
8129
8150
  focus: {
8130
8151
  validate: (value: string) => boolean;
8131
8152
  };
8132
- onComposerUnmounted: FunctionConstructor;
8153
+ onComposerCellFocused: FunctionConstructor;
8133
8154
  onComposerContentFocused: FunctionConstructor;
8134
8155
  gridDims: ObjectConstructor;
8135
8156
  };
8136
8157
  static components: {
8137
8158
  Composer: typeof Composer;
8138
8159
  };
8139
- private gridComposerRef;
8140
- private zone;
8141
8160
  private rect;
8161
+ private isEditing;
8142
8162
  private isCellReferenceVisible;
8143
- private composerState;
8163
+ get defaultRect(): {
8164
+ x: number;
8165
+ y: number;
8166
+ width: number;
8167
+ height: number;
8168
+ };
8144
8169
  setup(): void;
8145
8170
  get shouldDisplayCellReference(): boolean;
8146
8171
  get cellReference(): string;
8147
8172
  get cellReferenceStyle(): string;
8173
+ get composerProps(): ComposerProps;
8148
8174
  get containerStyle(): string;
8149
- get composerStyle(): string;
8175
+ private updateComponentPosition;
8176
+ private updateCellReferenceVisibility;
8150
8177
  }
8151
8178
 
8152
8179
  interface ResizerState {
@@ -8382,7 +8409,6 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
8382
8409
  readonly HEADER_WIDTH = 48;
8383
8410
  private menuState;
8384
8411
  private gridRef;
8385
- private hiddenInput;
8386
8412
  onMouseWheel: (ev: WheelEvent) => void;
8387
8413
  canvasPosition: DOMCoordinates;
8388
8414
  hoveredCell: Partial<Position$1>;
@@ -8394,7 +8420,7 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
8394
8420
  get gridOverlayDimensions(): string;
8395
8421
  onClosePopover(): void;
8396
8422
  private keyDownMapping;
8397
- focus(): void;
8423
+ focusDefaultElement(): void;
8398
8424
  get gridEl(): HTMLElement;
8399
8425
  getAutofillPosition(): {
8400
8426
  left: number;
@@ -8414,7 +8440,6 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
8414
8440
  closeOpenedPopover(): void;
8415
8441
  processArrows(ev: KeyboardEvent): void;
8416
8442
  onKeydown(ev: KeyboardEvent): void;
8417
- onInput(ev: InputEvent): void;
8418
8443
  onInputContextMenu(ev: MouseEvent): void;
8419
8444
  onCellRightClicked(col: HeaderIndex, row: HeaderIndex, { x, y }: DOMCoordinates): void;
8420
8445
  toggleContextMenu(type: ContextMenuType, x: Pixel, y: Pixel): void;