@odoo/o-spreadsheet 16.2.28 → 16.2.31

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[];
@@ -2112,64 +2112,65 @@ declare const enum CommandResult {
2112
2112
  InvalidFigureId = 28,
2113
2113
  InputAlreadyFocused = 29,
2114
2114
  MaximumRangesReached = 30,
2115
- InvalidChartDefinition = 31,
2116
- InvalidDataSet = 32,
2117
- InvalidLabelRange = 33,
2118
- InvalidScorecardKeyValue = 34,
2119
- InvalidScorecardBaseline = 35,
2120
- InvalidGaugeDataRange = 36,
2121
- EmptyGaugeRangeMin = 37,
2122
- GaugeRangeMinNaN = 38,
2123
- EmptyGaugeRangeMax = 39,
2124
- GaugeRangeMaxNaN = 40,
2125
- GaugeRangeMinBiggerThanRangeMax = 41,
2126
- GaugeLowerInflectionPointNaN = 42,
2127
- GaugeUpperInflectionPointNaN = 43,
2128
- GaugeLowerBiggerThanUpper = 44,
2129
- InvalidAutofillSelection = 45,
2130
- WrongComposerSelection = 46,
2131
- MinBiggerThanMax = 47,
2132
- LowerBiggerThanUpper = 48,
2133
- MidBiggerThanMax = 49,
2134
- MinBiggerThanMid = 50,
2135
- FirstArgMissing = 51,
2136
- SecondArgMissing = 52,
2137
- MinNaN = 53,
2138
- MidNaN = 54,
2139
- MaxNaN = 55,
2140
- ValueUpperInflectionNaN = 56,
2141
- ValueLowerInflectionNaN = 57,
2142
- MinInvalidFormula = 58,
2143
- MidInvalidFormula = 59,
2144
- MaxInvalidFormula = 60,
2145
- ValueUpperInvalidFormula = 61,
2146
- ValueLowerInvalidFormula = 62,
2147
- InvalidSortZone = 63,
2148
- WaitingSessionConfirmation = 64,
2149
- MergeOverlap = 65,
2150
- TooManyHiddenElements = 66,
2151
- Readonly = 67,
2152
- InvalidViewportSize = 68,
2153
- InvalidScrollingDirection = 69,
2154
- FigureDoesNotExist = 70,
2155
- InvalidConditionalFormatId = 71,
2156
- InvalidCellPopover = 72,
2157
- EmptyTarget = 73,
2158
- InvalidFreezeQuantity = 74,
2159
- FrozenPaneOverlap = 75,
2160
- ValuesNotChanged = 76,
2161
- InvalidFilterZone = 77,
2162
- FilterOverlap = 78,
2163
- FilterNotFound = 79,
2164
- MergeInFilter = 80,
2165
- NonContinuousTargets = 81,
2166
- DuplicatedFigureId = 82,
2167
- InvalidSelectionStep = 83,
2168
- DuplicatedChartId = 84,
2169
- ChartDoesNotExist = 85,
2170
- InvalidHeaderIndex = 86,
2171
- InvalidQuantity = 87,
2172
- NoChanges = 88
2115
+ InvalidInputId = 31,
2116
+ InvalidChartDefinition = 32,
2117
+ InvalidDataSet = 33,
2118
+ InvalidLabelRange = 34,
2119
+ InvalidScorecardKeyValue = 35,
2120
+ InvalidScorecardBaseline = 36,
2121
+ InvalidGaugeDataRange = 37,
2122
+ EmptyGaugeRangeMin = 38,
2123
+ GaugeRangeMinNaN = 39,
2124
+ EmptyGaugeRangeMax = 40,
2125
+ GaugeRangeMaxNaN = 41,
2126
+ GaugeRangeMinBiggerThanRangeMax = 42,
2127
+ GaugeLowerInflectionPointNaN = 43,
2128
+ GaugeUpperInflectionPointNaN = 44,
2129
+ GaugeLowerBiggerThanUpper = 45,
2130
+ InvalidAutofillSelection = 46,
2131
+ WrongComposerSelection = 47,
2132
+ MinBiggerThanMax = 48,
2133
+ LowerBiggerThanUpper = 49,
2134
+ MidBiggerThanMax = 50,
2135
+ MinBiggerThanMid = 51,
2136
+ FirstArgMissing = 52,
2137
+ SecondArgMissing = 53,
2138
+ MinNaN = 54,
2139
+ MidNaN = 55,
2140
+ MaxNaN = 56,
2141
+ ValueUpperInflectionNaN = 57,
2142
+ ValueLowerInflectionNaN = 58,
2143
+ MinInvalidFormula = 59,
2144
+ MidInvalidFormula = 60,
2145
+ MaxInvalidFormula = 61,
2146
+ ValueUpperInvalidFormula = 62,
2147
+ ValueLowerInvalidFormula = 63,
2148
+ InvalidSortZone = 64,
2149
+ WaitingSessionConfirmation = 65,
2150
+ MergeOverlap = 66,
2151
+ TooManyHiddenElements = 67,
2152
+ Readonly = 68,
2153
+ InvalidViewportSize = 69,
2154
+ InvalidScrollingDirection = 70,
2155
+ FigureDoesNotExist = 71,
2156
+ InvalidConditionalFormatId = 72,
2157
+ InvalidCellPopover = 73,
2158
+ EmptyTarget = 74,
2159
+ InvalidFreezeQuantity = 75,
2160
+ FrozenPaneOverlap = 76,
2161
+ ValuesNotChanged = 77,
2162
+ InvalidFilterZone = 78,
2163
+ FilterOverlap = 79,
2164
+ FilterNotFound = 80,
2165
+ MergeInFilter = 81,
2166
+ NonContinuousTargets = 82,
2167
+ DuplicatedFigureId = 83,
2168
+ InvalidSelectionStep = 84,
2169
+ DuplicatedChartId = 85,
2170
+ ChartDoesNotExist = 86,
2171
+ InvalidHeaderIndex = 87,
2172
+ InvalidQuantity = 88,
2173
+ NoChanges = 89
2173
2174
  }
2174
2175
  interface CommandHandler<T> {
2175
2176
  allowDispatch(command: T): CommandResult | CommandResult[];
@@ -2566,6 +2567,12 @@ interface ClipboardInterface {
2566
2567
  readText(): Promise<ClipboardReadResult>;
2567
2568
  }
2568
2569
 
2570
+ declare class FocusableElement {
2571
+ private focusableElement;
2572
+ setFocusableElement(element: HTMLElement): void;
2573
+ focus(): void;
2574
+ }
2575
+
2569
2576
  type TranslationFunction = (string: string, ...values: string[] | [{
2570
2577
  [key: string]: string;
2571
2578
  }]) => string;
@@ -2599,6 +2606,7 @@ interface SpreadsheetChildEnv extends SpreadsheetEnv {
2599
2606
  _t: TranslationFunction;
2600
2607
  startCellEdition: (content: string) => void;
2601
2608
  loadCurrencies?: () => Promise<Currency[]>;
2609
+ focusableElement: FocusableElement;
2602
2610
  }
2603
2611
 
2604
2612
  type ArgType = "ANY" | "BOOLEAN" | "NUMBER" | "STRING" | "DATE" | "RANGE" | "RANGE<BOOLEAN>" | "RANGE<NUMBER>" | "RANGE<DATE>" | "RANGE<STRING>" | "META";
@@ -2894,8 +2902,9 @@ declare class RangeAdapter implements CommandHandler<CoreCommand> {
2894
2902
  *
2895
2903
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
2896
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
2897
2906
  */
2898
- getRangeString(range: Range, forSheetId: UID): string;
2907
+ getRangeString(range: Range, forSheetId: UID, useFixedZone?: boolean): string;
2899
2908
  getRangeDataFromXc(sheetId: UID, xc: string): RangeData;
2900
2909
  getRangeDataFromZone(sheetId: UID, zone: Zone): RangeData;
2901
2910
  getRangeFromRangeData(data: RangeData): Range;
@@ -3113,7 +3122,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3113
3122
  * starting an async evaluation even if it has been moved or re-allocated
3114
3123
  */
3115
3124
  getCellById(cellId: UID): Cell | undefined;
3116
- 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;
3117
3126
  getFormulaCellContent(sheetId: UID, cell: FormulaCell): string;
3118
3127
  getCellStyle(position: CellPosition): Style;
3119
3128
  /**
@@ -4315,7 +4324,7 @@ interface RangeInputValue {
4315
4324
  * This plugin handles this internal state.
4316
4325
  */
4317
4326
  declare class SelectionInputPlugin extends UIPlugin implements StreamCallbacks<SelectionEvent> {
4318
- private readonly inputHasSingleRange;
4327
+ readonly inputHasSingleRange: boolean;
4319
4328
  static layers: LAYERS[];
4320
4329
  static getters: never[];
4321
4330
  ranges: RangeInputValue[];
@@ -4323,7 +4332,6 @@ declare class SelectionInputPlugin extends UIPlugin implements StreamCallbacks<S
4323
4332
  private activeSheet;
4324
4333
  private willAddNewRange;
4325
4334
  constructor(config: UIPluginConfig, initialRanges: string[], inputHasSingleRange: boolean);
4326
- allowDispatch(cmd: Command): CommandResult;
4327
4335
  handleEvent(event: SelectionEvent): void;
4328
4336
  handle(cmd: Command): void;
4329
4337
  getSelectionInputValue(): string[];
@@ -6075,11 +6083,12 @@ interface AutocompleteValue {
6075
6083
  }
6076
6084
  interface ComposerProps {
6077
6085
  focus: ComposerFocusType;
6078
- onComposerContentFocused: (selection: ComposerSelection) => void;
6079
6086
  inputStyle?: string;
6080
6087
  rect?: Rect;
6081
6088
  delimitation?: DOMDimension;
6082
- onComposerUnmounted?: () => void;
6089
+ onComposerContentFocused: () => void;
6090
+ onComposerCellFocused?: (content: String) => void;
6091
+ isDefaultFocus?: boolean;
6083
6092
  }
6084
6093
  interface ComposerState$1 {
6085
6094
  positionStart: number;
@@ -6104,6 +6113,7 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
6104
6113
  };
6105
6114
  static defaultProps: {
6106
6115
  inputStyle: string;
6116
+ isDefaultFocus: boolean;
6107
6117
  };
6108
6118
  composerRef: {
6109
6119
  el: HTMLElement | null;
@@ -6131,7 +6141,8 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
6131
6141
  onCompositionEnd(): void;
6132
6142
  onKeydown(ev: KeyboardEvent): void;
6133
6143
  private updateCursorIfNeeded;
6134
- onInput(): void;
6144
+ onPaste(ev: ClipboardEvent): void;
6145
+ onInput(ev: InputEvent): void;
6135
6146
  onKeyup(ev: KeyboardEvent): void;
6136
6147
  showAutocomplete(searchTerm: string): void;
6137
6148
  onMousedown(ev: MouseEvent): void;
@@ -6324,7 +6335,7 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
6324
6335
  focusGrid(): void;
6325
6336
  onKeydown(ev: KeyboardEvent): void;
6326
6337
  onTopBarComposerFocused(selection: ComposerSelection): void;
6327
- onGridComposerContentFocused(): void;
6338
+ onGridComposerContentFocused(selection: ComposerSelection): void;
6328
6339
  onGridComposerCellFocused(content?: string, selection?: ComposerSelection): void;
6329
6340
  /**
6330
6341
  * Start the edition or update the content if it's already started.
@@ -6335,8 +6346,8 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
6335
6346
 
6336
6347
  interface Props$5 {
6337
6348
  focus: ComposerFocusType;
6338
- onComposerUnmounted: () => void;
6339
- onComposerContentFocused: (selection: ComposerSelection) => void;
6349
+ onComposerContentFocused: () => void;
6350
+ onComposerCellFocused: () => void;
6340
6351
  gridDims: DOMDimension;
6341
6352
  }
6342
6353
  /**
@@ -6348,17 +6359,23 @@ declare class GridComposer extends Component<Props$5, SpreadsheetChildEnv> {
6348
6359
  static components: {
6349
6360
  Composer: typeof Composer;
6350
6361
  };
6351
- private gridComposerRef;
6352
- private zone;
6353
6362
  private rect;
6363
+ private isEditing;
6354
6364
  private isCellReferenceVisible;
6355
- private composerState;
6365
+ get defaultRect(): {
6366
+ x: number;
6367
+ y: number;
6368
+ width: number;
6369
+ height: number;
6370
+ };
6356
6371
  setup(): void;
6357
6372
  get shouldDisplayCellReference(): boolean;
6358
6373
  get cellReference(): string;
6359
6374
  get cellReferenceStyle(): string;
6375
+ get composerProps(): ComposerProps;
6360
6376
  get containerStyle(): string;
6361
- get composerStyle(): string;
6377
+ private updateComponentPosition;
6378
+ private updateCellReferenceVisibility;
6362
6379
  }
6363
6380
 
6364
6381
  interface ResizerState {
@@ -6558,7 +6575,6 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
6558
6575
  readonly HEADER_WIDTH = 48;
6559
6576
  private menuState;
6560
6577
  private gridRef;
6561
- private hiddenInput;
6562
6578
  onMouseWheel: (ev: WheelEvent) => void;
6563
6579
  canvasPosition: DOMCoordinates;
6564
6580
  hoveredCell: Partial<Position$1>;
@@ -6570,7 +6586,7 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
6570
6586
  get gridOverlayDimensions(): string;
6571
6587
  onClosePopover(): void;
6572
6588
  private keyDownMapping;
6573
- focus(): void;
6589
+ focusDefaultElement(): void;
6574
6590
  get gridEl(): HTMLElement;
6575
6591
  getAutofillPosition(): {
6576
6592
  left: number;
@@ -6590,7 +6606,6 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
6590
6606
  closeOpenedPopover(): void;
6591
6607
  processArrows(ev: KeyboardEvent): void;
6592
6608
  onKeydown(ev: KeyboardEvent): void;
6593
- onInput(ev: InputEvent): void;
6594
6609
  onInputContextMenu(ev: MouseEvent): void;
6595
6610
  onCellRightClicked(col: HeaderIndex, row: HeaderIndex, { x, y }: DOMCoordinates): void;
6596
6611
  toggleContextMenu(type: ContextMenuType, x: Pixel, y: Pixel): void;