@odoo/o-spreadsheet 16.3.22 → 16.3.25

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.
@@ -1519,7 +1519,7 @@ declare class EditionPlugin extends UIPlugin {
1519
1519
  getEditionMode(): EditionMode;
1520
1520
  getCurrentContent(): string;
1521
1521
  getComposerSelection(): ComposerSelection;
1522
- getCurrentEditedCell(): CellPosition;
1522
+ getCurrentEditedCell(): CellPosition | undefined;
1523
1523
  isSelectingForComposer(): boolean;
1524
1524
  showSelectionIndicator(): boolean;
1525
1525
  getCurrentTokens(): EnrichedToken[];
@@ -2326,69 +2326,70 @@ declare const enum CommandResult {
2326
2326
  InvalidFigureId = 28,
2327
2327
  InputAlreadyFocused = 29,
2328
2328
  MaximumRangesReached = 30,
2329
- InvalidChartDefinition = 31,
2330
- InvalidDataSet = 32,
2331
- InvalidLabelRange = 33,
2332
- InvalidScorecardKeyValue = 34,
2333
- InvalidScorecardBaseline = 35,
2334
- InvalidGaugeDataRange = 36,
2335
- EmptyGaugeRangeMin = 37,
2336
- GaugeRangeMinNaN = 38,
2337
- EmptyGaugeRangeMax = 39,
2338
- GaugeRangeMaxNaN = 40,
2339
- GaugeRangeMinBiggerThanRangeMax = 41,
2340
- GaugeLowerInflectionPointNaN = 42,
2341
- GaugeUpperInflectionPointNaN = 43,
2342
- GaugeLowerBiggerThanUpper = 44,
2343
- InvalidAutofillSelection = 45,
2344
- WrongComposerSelection = 46,
2345
- MinBiggerThanMax = 47,
2346
- LowerBiggerThanUpper = 48,
2347
- MidBiggerThanMax = 49,
2348
- MinBiggerThanMid = 50,
2349
- FirstArgMissing = 51,
2350
- SecondArgMissing = 52,
2351
- MinNaN = 53,
2352
- MidNaN = 54,
2353
- MaxNaN = 55,
2354
- ValueUpperInflectionNaN = 56,
2355
- ValueLowerInflectionNaN = 57,
2356
- MinInvalidFormula = 58,
2357
- MidInvalidFormula = 59,
2358
- MaxInvalidFormula = 60,
2359
- ValueUpperInvalidFormula = 61,
2360
- ValueLowerInvalidFormula = 62,
2361
- InvalidSortZone = 63,
2362
- WaitingSessionConfirmation = 64,
2363
- MergeOverlap = 65,
2364
- TooManyHiddenElements = 66,
2365
- Readonly = 67,
2366
- InvalidViewportSize = 68,
2367
- InvalidScrollingDirection = 69,
2368
- FigureDoesNotExist = 70,
2369
- InvalidConditionalFormatId = 71,
2370
- InvalidCellPopover = 72,
2371
- EmptyTarget = 73,
2372
- InvalidFreezeQuantity = 74,
2373
- FrozenPaneOverlap = 75,
2374
- ValuesNotChanged = 76,
2375
- InvalidFilterZone = 77,
2376
- FilterOverlap = 78,
2377
- FilterNotFound = 79,
2378
- MergeInFilter = 80,
2379
- NonContinuousTargets = 81,
2380
- DuplicatedFigureId = 82,
2381
- InvalidSelectionStep = 83,
2382
- DuplicatedChartId = 84,
2383
- ChartDoesNotExist = 85,
2384
- InvalidHeaderIndex = 86,
2385
- InvalidQuantity = 87,
2386
- MoreThanOneColumnSelected = 88,
2387
- EmptySplitSeparator = 89,
2388
- SplitWillOverwriteContent = 90,
2389
- NoSplitSeparatorInSelection = 91,
2390
- NoActiveSheet = 92,
2391
- NoChanges = 93
2329
+ InvalidInputId = 31,
2330
+ InvalidChartDefinition = 32,
2331
+ InvalidDataSet = 33,
2332
+ InvalidLabelRange = 34,
2333
+ InvalidScorecardKeyValue = 35,
2334
+ InvalidScorecardBaseline = 36,
2335
+ InvalidGaugeDataRange = 37,
2336
+ EmptyGaugeRangeMin = 38,
2337
+ GaugeRangeMinNaN = 39,
2338
+ EmptyGaugeRangeMax = 40,
2339
+ GaugeRangeMaxNaN = 41,
2340
+ GaugeRangeMinBiggerThanRangeMax = 42,
2341
+ GaugeLowerInflectionPointNaN = 43,
2342
+ GaugeUpperInflectionPointNaN = 44,
2343
+ GaugeLowerBiggerThanUpper = 45,
2344
+ InvalidAutofillSelection = 46,
2345
+ WrongComposerSelection = 47,
2346
+ MinBiggerThanMax = 48,
2347
+ LowerBiggerThanUpper = 49,
2348
+ MidBiggerThanMax = 50,
2349
+ MinBiggerThanMid = 51,
2350
+ FirstArgMissing = 52,
2351
+ SecondArgMissing = 53,
2352
+ MinNaN = 54,
2353
+ MidNaN = 55,
2354
+ MaxNaN = 56,
2355
+ ValueUpperInflectionNaN = 57,
2356
+ ValueLowerInflectionNaN = 58,
2357
+ MinInvalidFormula = 59,
2358
+ MidInvalidFormula = 60,
2359
+ MaxInvalidFormula = 61,
2360
+ ValueUpperInvalidFormula = 62,
2361
+ ValueLowerInvalidFormula = 63,
2362
+ InvalidSortZone = 64,
2363
+ WaitingSessionConfirmation = 65,
2364
+ MergeOverlap = 66,
2365
+ TooManyHiddenElements = 67,
2366
+ Readonly = 68,
2367
+ InvalidViewportSize = 69,
2368
+ InvalidScrollingDirection = 70,
2369
+ FigureDoesNotExist = 71,
2370
+ InvalidConditionalFormatId = 72,
2371
+ InvalidCellPopover = 73,
2372
+ EmptyTarget = 74,
2373
+ InvalidFreezeQuantity = 75,
2374
+ FrozenPaneOverlap = 76,
2375
+ ValuesNotChanged = 77,
2376
+ InvalidFilterZone = 78,
2377
+ FilterOverlap = 79,
2378
+ FilterNotFound = 80,
2379
+ MergeInFilter = 81,
2380
+ NonContinuousTargets = 82,
2381
+ DuplicatedFigureId = 83,
2382
+ InvalidSelectionStep = 84,
2383
+ DuplicatedChartId = 85,
2384
+ ChartDoesNotExist = 86,
2385
+ InvalidHeaderIndex = 87,
2386
+ InvalidQuantity = 88,
2387
+ MoreThanOneColumnSelected = 89,
2388
+ EmptySplitSeparator = 90,
2389
+ SplitWillOverwriteContent = 91,
2390
+ NoSplitSeparatorInSelection = 92,
2391
+ NoActiveSheet = 93,
2392
+ NoChanges = 94
2392
2393
  }
2393
2394
  interface CommandHandler<T> {
2394
2395
  allowDispatch(command: T): CommandResult | CommandResult[];
@@ -2807,6 +2808,12 @@ interface ClipboardInterface {
2807
2808
  readText(): Promise<ClipboardReadResult>;
2808
2809
  }
2809
2810
 
2811
+ declare class FocusableElement {
2812
+ private focusableElement;
2813
+ setFocusableElement(element: HTMLElement): void;
2814
+ focus(): void;
2815
+ }
2816
+
2810
2817
  type TranslationFunction = (string: string, ...values: string[] | [{
2811
2818
  [key: string]: string;
2812
2819
  }]) => string;
@@ -2840,6 +2847,7 @@ interface SpreadsheetChildEnv extends SpreadsheetEnv {
2840
2847
  _t: TranslationFunction;
2841
2848
  startCellEdition: (content: string) => void;
2842
2849
  loadCurrencies?: () => Promise<Currency[]>;
2850
+ focusableElement: FocusableElement;
2843
2851
  }
2844
2852
 
2845
2853
  type ArgType = "ANY" | "BOOLEAN" | "NUMBER" | "STRING" | "DATE" | "RANGE" | "RANGE<BOOLEAN>" | "RANGE<NUMBER>" | "RANGE<DATE>" | "RANGE<STRING>" | "META";
@@ -2922,8 +2930,9 @@ declare class RangeAdapter implements CommandHandler<CoreCommand> {
2922
2930
  *
2923
2931
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
2924
2932
  * @param forSheetId the id of the sheet where the range string is supposed to be used.
2933
+ * @param [useFixedZone=false] if true, the range will be returned with fixed row and column
2925
2934
  */
2926
- getRangeString(range: Range, forSheetId: UID): string;
2935
+ getRangeString(range: Range, forSheetId: UID, useFixedZone?: boolean): string;
2927
2936
  getRangeDataFromXc(sheetId: UID, xc: string): RangeData;
2928
2937
  getRangeDataFromZone(sheetId: UID, zone: Zone): RangeData;
2929
2938
  getRangeFromRangeData(data: RangeData): Range;
@@ -3142,7 +3151,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3142
3151
  * starting an async evaluation even if it has been moved or re-allocated
3143
3152
  */
3144
3153
  getCellById(cellId: UID): Cell | undefined;
3145
- buildFormulaContent(sheetId: UID, cell: Pick<FormulaCell, "dependencies" | "compiledFormula">, dependencies?: Range[]): string;
3154
+ buildFormulaContent(sheetId: UID, cell: Pick<FormulaCell, "dependencies" | "compiledFormula">, dependencies?: Range[], useFixedZone?: boolean): string;
3146
3155
  getFormulaCellContent(sheetId: UID, cell: FormulaCell): string;
3147
3156
  getCellStyle(position: CellPosition): Style;
3148
3157
  /**
@@ -4413,7 +4422,7 @@ interface RangeInputValue {
4413
4422
  * This plugin handles this internal state.
4414
4423
  */
4415
4424
  declare class SelectionInputPlugin extends UIPlugin implements StreamCallbacks<SelectionEvent> {
4416
- private readonly inputHasSingleRange;
4425
+ readonly inputHasSingleRange: boolean;
4417
4426
  static layers: LAYERS[];
4418
4427
  static getters: never[];
4419
4428
  ranges: RangeInputValue[];
@@ -4421,7 +4430,6 @@ declare class SelectionInputPlugin extends UIPlugin implements StreamCallbacks<S
4421
4430
  private activeSheet;
4422
4431
  private willAddNewRange;
4423
4432
  constructor(config: UIPluginConfig, initialRanges: string[], inputHasSingleRange: boolean);
4424
- allowDispatch(cmd: LocalCommand): CommandResult;
4425
4433
  handleEvent(event: SelectionEvent): void;
4426
4434
  handle(cmd: Command): void;
4427
4435
  getSelectionInputValue(): string[];
@@ -6555,11 +6563,12 @@ interface AutocompleteValue {
6555
6563
  }
6556
6564
  interface ComposerProps {
6557
6565
  focus: ComposerFocusType;
6558
- onComposerContentFocused: (selection: ComposerSelection) => void;
6559
6566
  inputStyle?: string;
6560
6567
  rect?: Rect;
6561
6568
  delimitation?: DOMDimension;
6562
- onComposerUnmounted?: () => void;
6569
+ onComposerContentFocused: () => void;
6570
+ onComposerCellFocused?: (content: String) => void;
6571
+ isDefaultFocus?: boolean;
6563
6572
  }
6564
6573
  interface ComposerState$1 {
6565
6574
  positionStart: number;
@@ -6584,6 +6593,7 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
6584
6593
  };
6585
6594
  static defaultProps: {
6586
6595
  inputStyle: string;
6596
+ isDefaultFocus: boolean;
6587
6597
  };
6588
6598
  composerRef: {
6589
6599
  el: HTMLElement | null;
@@ -6611,7 +6621,8 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
6611
6621
  onCompositionEnd(): void;
6612
6622
  onKeydown(ev: KeyboardEvent): void;
6613
6623
  private updateCursorIfNeeded;
6614
- onInput(): void;
6624
+ onPaste(ev: ClipboardEvent): void;
6625
+ onInput(ev: InputEvent): void;
6615
6626
  onKeyup(ev: KeyboardEvent): void;
6616
6627
  showAutocomplete(searchTerm: string): void;
6617
6628
  onMousedown(ev: MouseEvent): void;
@@ -6770,7 +6781,7 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
6770
6781
  focusGrid(): void;
6771
6782
  onKeydown(ev: KeyboardEvent): void;
6772
6783
  onTopBarComposerFocused(selection: ComposerSelection): void;
6773
- onGridComposerContentFocused(): void;
6784
+ onGridComposerContentFocused(selection: ComposerSelection): void;
6774
6785
  onGridComposerCellFocused(content?: string, selection?: ComposerSelection): void;
6775
6786
  /**
6776
6787
  * Start the edition or update the content if it's already started.
@@ -6781,8 +6792,8 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
6781
6792
 
6782
6793
  interface Props$5 {
6783
6794
  focus: ComposerFocusType;
6784
- onComposerUnmounted: () => void;
6785
- onComposerContentFocused: (selection: ComposerSelection) => void;
6795
+ onComposerContentFocused: () => void;
6796
+ onComposerCellFocused: () => void;
6786
6797
  gridDims: DOMDimension;
6787
6798
  }
6788
6799
  /**
@@ -6794,17 +6805,23 @@ declare class GridComposer extends Component<Props$5, SpreadsheetChildEnv> {
6794
6805
  static components: {
6795
6806
  Composer: typeof Composer;
6796
6807
  };
6797
- private gridComposerRef;
6798
- private zone;
6799
6808
  private rect;
6809
+ private isEditing;
6800
6810
  private isCellReferenceVisible;
6801
- private composerState;
6811
+ get defaultRect(): {
6812
+ x: number;
6813
+ y: number;
6814
+ width: number;
6815
+ height: number;
6816
+ };
6802
6817
  setup(): void;
6803
6818
  get shouldDisplayCellReference(): boolean;
6804
6819
  get cellReference(): string;
6805
6820
  get cellReferenceStyle(): string;
6821
+ get composerProps(): ComposerProps;
6806
6822
  get containerStyle(): string;
6807
- get composerStyle(): string;
6823
+ private updateComponentPosition;
6824
+ private updateCellReferenceVisibility;
6808
6825
  }
6809
6826
 
6810
6827
  interface ResizerState {
@@ -7004,7 +7021,6 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
7004
7021
  readonly HEADER_WIDTH = 48;
7005
7022
  private menuState;
7006
7023
  private gridRef;
7007
- private hiddenInput;
7008
7024
  onMouseWheel: (ev: WheelEvent) => void;
7009
7025
  canvasPosition: DOMCoordinates;
7010
7026
  hoveredCell: Partial<Position$1>;
@@ -7016,7 +7032,7 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
7016
7032
  get gridOverlayDimensions(): string;
7017
7033
  onClosePopover(): void;
7018
7034
  private keyDownMapping;
7019
- focus(): void;
7035
+ focusDefaultElement(): void;
7020
7036
  get gridEl(): HTMLElement;
7021
7037
  getAutofillPosition(): {
7022
7038
  left: number;
@@ -7036,7 +7052,6 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
7036
7052
  closeOpenedPopover(): void;
7037
7053
  processArrows(ev: KeyboardEvent): void;
7038
7054
  onKeydown(ev: KeyboardEvent): void;
7039
- onInput(ev: InputEvent): void;
7040
7055
  onInputContextMenu(ev: MouseEvent): void;
7041
7056
  onCellRightClicked(col: HeaderIndex, row: HeaderIndex, { x, y }: DOMCoordinates): void;
7042
7057
  toggleContextMenu(type: ContextMenuType, x: Pixel, y: Pixel): void;