@odoo/o-spreadsheet 17.0.9 → 17.0.12

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.
@@ -44,8 +44,8 @@ interface EnrichedToken extends Token {
44
44
 
45
45
  type TokenType = "OPERATOR" | "NUMBER" | "STRING" | "SYMBOL" | "SPACE" | "DEBUGGER" | "ARG_SEPARATOR" | "LEFT_PAREN" | "RIGHT_PAREN" | "REFERENCE" | "INVALID_REFERENCE" | "UNKNOWN";
46
46
  interface Token {
47
- type: TokenType;
48
- value: string;
47
+ readonly type: TokenType;
48
+ readonly value: string;
49
49
  }
50
50
  declare function tokenize(str: string, locale?: Locale): Token[];
51
51
 
@@ -1190,7 +1190,7 @@ interface ModelConfig {
1190
1190
  readonly custom: Readonly<{
1191
1191
  [key: string]: any;
1192
1192
  }>;
1193
- readonly defaultCurrencyFormat: Format;
1193
+ readonly defaultCurrencyFormat?: Format;
1194
1194
  /**
1195
1195
  * External dependencies required to enable some features
1196
1196
  * such as uploading images.
@@ -1441,6 +1441,7 @@ interface UIPluginConfig {
1441
1441
  readonly uiActions: UIActions;
1442
1442
  readonly custom: ModelConfig["custom"];
1443
1443
  readonly session: Session;
1444
+ readonly defaultCurrencyFormat?: Format;
1444
1445
  }
1445
1446
  interface UIPluginConstructor {
1446
1447
  new (config: UIPluginConfig): UIPlugin;
@@ -3089,6 +3090,12 @@ interface ClipboardInterface {
3089
3090
  readText(): Promise<ClipboardReadResult>;
3090
3091
  }
3091
3092
 
3093
+ declare class FocusableElement {
3094
+ private focusableElement;
3095
+ setFocusableElement(element: HTMLElement): void;
3096
+ focus(): void;
3097
+ }
3098
+
3092
3099
  type NotificationType = "danger" | "info" | "success" | "warning";
3093
3100
  interface InformationNotification {
3094
3101
  text: string;
@@ -3110,6 +3117,7 @@ interface SpreadsheetChildEnv extends SpreadsheetEnv {
3110
3117
  startCellEdition: (content?: string) => void;
3111
3118
  loadCurrencies?: () => Promise<Currency[]>;
3112
3119
  loadLocales: () => Promise<Locale[]>;
3120
+ focusableElement: FocusableElement;
3113
3121
  }
3114
3122
 
3115
3123
  type ArgType = "ANY" | "BOOLEAN" | "NUMBER" | "STRING" | "DATE" | "RANGE" | "RANGE<BOOLEAN>" | "RANGE<NUMBER>" | "RANGE<DATE>" | "RANGE<STRING>" | "RANGE<ANY>" | "META";
@@ -3197,8 +3205,12 @@ declare class RangeAdapter implements CommandHandler<CoreCommand> {
3197
3205
  *
3198
3206
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
3199
3207
  * @param forSheetId the id of the sheet where the range string is supposed to be used.
3208
+ * @param options
3209
+ * @param options.useFixedReference if true, the range will be returned with fixed row and column
3200
3210
  */
3201
- getRangeString(range: Range, forSheetId: UID): string;
3211
+ getRangeString(range: Range, forSheetId: UID, options?: {
3212
+ useFixedReference: boolean;
3213
+ }): string;
3202
3214
  getRangeDataFromXc(sheetId: UID, xc: string): RangeData;
3203
3215
  getRangeDataFromZone(sheetId: UID, zone: Zone | UnboundedZone): RangeData;
3204
3216
  getRangeFromZone(sheetId: UID, zone: Zone | UnboundedZone): Range;
@@ -3418,7 +3430,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3418
3430
  * starting an async evaluation even if it has been moved or re-allocated
3419
3431
  */
3420
3432
  getCellById(cellId: UID): Cell | undefined;
3421
- getFormulaCellContent(sheetId: UID, compiledFormula: RangeCompiledFormula, dependencies?: Range[]): string;
3433
+ getFormulaCellContent(sheetId: UID, compiledFormula: RangeCompiledFormula, dependencies?: Range[], useFixedReference?: boolean): string;
3422
3434
  getTranslatedCellFormula(sheetId: UID, offsetX: number, offsetY: number, compiledFormula: RangeCompiledFormula): string;
3423
3435
  getCellStyle(position: CellPosition): Style;
3424
3436
  /**
@@ -3464,6 +3476,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3464
3476
  private createErrorFormula;
3465
3477
  private checkCellOutOfSheet;
3466
3478
  private checkUselessClearCell;
3479
+ private checkUselessUpdateCell;
3467
3480
  }
3468
3481
 
3469
3482
  /**
@@ -7088,6 +7101,8 @@ interface Props$b {
7088
7101
  }
7089
7102
  declare class TextValueProvider extends Component<Props$b> {
7090
7103
  static template: string;
7104
+ private autoCompleteListRef;
7105
+ setup(): void;
7091
7106
  }
7092
7107
 
7093
7108
  declare class ContentEditableHelper {
@@ -7178,11 +7193,12 @@ interface AutocompleteValue {
7178
7193
  }
7179
7194
  interface ComposerProps {
7180
7195
  focus: ComposerFocusType;
7181
- onComposerContentFocused: (selection: ComposerSelection) => void;
7182
7196
  inputStyle?: string;
7183
7197
  rect?: Rect;
7184
7198
  delimitation?: DOMDimension;
7185
- onComposerUnmounted?: () => void;
7199
+ onComposerContentFocused: () => void;
7200
+ onComposerCellFocused?: (content: String) => void;
7201
+ isDefaultFocus?: boolean;
7186
7202
  }
7187
7203
  interface ComposerState$1 {
7188
7204
  positionStart: number;
@@ -7209,6 +7225,7 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
7209
7225
  };
7210
7226
  static defaultProps: {
7211
7227
  inputStyle: string;
7228
+ isDefaultFocus: boolean;
7212
7229
  };
7213
7230
  composerRef: {
7214
7231
  el: HTMLElement | null;
@@ -7231,7 +7248,6 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
7231
7248
  private processArrowKeys;
7232
7249
  private handleArrowKeysForAutocomplete;
7233
7250
  private processTabKey;
7234
- processSpaceKey(ev: KeyboardEvent): void;
7235
7251
  private processEnterKey;
7236
7252
  private processEscapeKey;
7237
7253
  private processF4Key;
@@ -7239,6 +7255,7 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
7239
7255
  onCompositionStart(): void;
7240
7256
  onCompositionEnd(): void;
7241
7257
  onKeydown(ev: KeyboardEvent): void;
7258
+ onPaste(ev: ClipboardEvent): void;
7242
7259
  onInput(ev: InputEvent): void;
7243
7260
  onKeyup(ev: KeyboardEvent): void;
7244
7261
  showFunctionAutocomplete(searchTerm: string): void;
@@ -7418,7 +7435,7 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
7418
7435
  focusGrid(): void;
7419
7436
  onKeydown(ev: KeyboardEvent): void;
7420
7437
  onTopBarComposerFocused(selection: ComposerSelection): void;
7421
- onGridComposerContentFocused(): void;
7438
+ onGridComposerContentFocused(selection: ComposerSelection): void;
7422
7439
  onGridComposerCellFocused(content?: string, selection?: ComposerSelection): void;
7423
7440
  /**
7424
7441
  * Start the edition or update the content if it's already started.
@@ -7432,8 +7449,8 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
7432
7449
 
7433
7450
  interface Props$5 {
7434
7451
  focus: ComposerFocusType;
7435
- onComposerUnmounted: () => void;
7436
- onComposerContentFocused: (selection: ComposerSelection) => void;
7452
+ onComposerContentFocused: () => void;
7453
+ onComposerCellFocused: () => void;
7437
7454
  gridDims: DOMDimension;
7438
7455
  }
7439
7456
  /**
@@ -7445,17 +7462,23 @@ declare class GridComposer extends Component<Props$5, SpreadsheetChildEnv> {
7445
7462
  static components: {
7446
7463
  Composer: typeof Composer;
7447
7464
  };
7448
- private gridComposerRef;
7449
- private zone;
7450
7465
  private rect;
7466
+ private isEditing;
7451
7467
  private isCellReferenceVisible;
7452
- private composerState;
7468
+ get defaultRect(): {
7469
+ x: number;
7470
+ y: number;
7471
+ width: number;
7472
+ height: number;
7473
+ };
7453
7474
  setup(): void;
7454
7475
  get shouldDisplayCellReference(): boolean;
7455
7476
  get cellReference(): string;
7456
7477
  get cellReferenceStyle(): string;
7478
+ get composerProps(): ComposerProps;
7457
7479
  get containerStyle(): string;
7458
- get composerStyle(): string;
7480
+ private updateComponentPosition;
7481
+ private updateCellReferenceVisibility;
7459
7482
  }
7460
7483
 
7461
7484
  interface ResizerState {
@@ -7655,7 +7678,6 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
7655
7678
  readonly HEADER_WIDTH = 48;
7656
7679
  private menuState;
7657
7680
  private gridRef;
7658
- private hiddenInput;
7659
7681
  onMouseWheel: (ev: WheelEvent) => void;
7660
7682
  canvasPosition: DOMCoordinates;
7661
7683
  hoveredCell: Partial<Position$1>;
@@ -7667,7 +7689,7 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
7667
7689
  get gridOverlayDimensions(): string;
7668
7690
  onClosePopover(): void;
7669
7691
  private keyDownMapping;
7670
- focus(): void;
7692
+ focusDefaultElement(): void;
7671
7693
  get gridEl(): HTMLElement;
7672
7694
  getAutofillPosition(): {
7673
7695
  left: number;
@@ -7687,7 +7709,6 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
7687
7709
  closeOpenedPopover(): void;
7688
7710
  processArrows(ev: KeyboardEvent): void;
7689
7711
  onKeydown(ev: KeyboardEvent): void;
7690
- onInput(ev: InputEvent): void;
7691
7712
  onInputContextMenu(ev: MouseEvent): void;
7692
7713
  onCellRightClicked(col: HeaderIndex, row: HeaderIndex, { x, y }: DOMCoordinates): void;
7693
7714
  toggleContextMenu(type: ContextMenuType, x: Pixel, y: Pixel): void;