@odoo/o-spreadsheet 16.3.18 → 16.3.24

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.
@@ -911,6 +911,34 @@ declare function toCartesian(xc: string): Position$1;
911
911
  */
912
912
  declare function toXC(col: HeaderIndex, row: HeaderIndex, rangePart?: RangePart): string;
913
913
 
914
+ /**
915
+ * A DateTime object that can be used to manipulate spreadsheet dates.
916
+ * Conceptually, a spreadsheet date is simply a number with a date format,
917
+ * and it is timezone-agnostic.
918
+ * This DateTime object consistently uses UTC time to represent a naive date and time.
919
+ */
920
+ declare class DateTime {
921
+ private jsDate;
922
+ constructor(year: number, month: number, day: number, hours?: number, minutes?: number, seconds?: number);
923
+ static fromTimestamp(timestamp: number): DateTime;
924
+ static now(): DateTime;
925
+ toString(): string;
926
+ toLocaleDateString(): string;
927
+ getTime(): number;
928
+ getFullYear(): number;
929
+ getMonth(): number;
930
+ getDate(): number;
931
+ getDay(): number;
932
+ getHours(): number;
933
+ getMinutes(): number;
934
+ getSeconds(): number;
935
+ setFullYear(year: number): void;
936
+ setDate(date: number): void;
937
+ setHours(hours: number): void;
938
+ setMinutes(minutes: number): void;
939
+ setSeconds(seconds: number): void;
940
+ }
941
+
914
942
  /**
915
943
  * Formats a cell value with its format.
916
944
  */
@@ -1709,6 +1737,7 @@ interface MoveColumnsRowsCommand extends GridDependentCommand {
1709
1737
  type: "MOVE_COLUMNS_ROWS";
1710
1738
  base: HeaderIndex;
1711
1739
  elements: HeaderIndex[];
1740
+ position: "before" | "after";
1712
1741
  }
1713
1742
  interface ResizeColumnsRowsCommand extends GridDependentCommand {
1714
1743
  type: "RESIZE_COLUMNS_ROWS";
@@ -2297,69 +2326,70 @@ declare const enum CommandResult {
2297
2326
  InvalidFigureId = 28,
2298
2327
  InputAlreadyFocused = 29,
2299
2328
  MaximumRangesReached = 30,
2300
- InvalidChartDefinition = 31,
2301
- InvalidDataSet = 32,
2302
- InvalidLabelRange = 33,
2303
- InvalidScorecardKeyValue = 34,
2304
- InvalidScorecardBaseline = 35,
2305
- InvalidGaugeDataRange = 36,
2306
- EmptyGaugeRangeMin = 37,
2307
- GaugeRangeMinNaN = 38,
2308
- EmptyGaugeRangeMax = 39,
2309
- GaugeRangeMaxNaN = 40,
2310
- GaugeRangeMinBiggerThanRangeMax = 41,
2311
- GaugeLowerInflectionPointNaN = 42,
2312
- GaugeUpperInflectionPointNaN = 43,
2313
- GaugeLowerBiggerThanUpper = 44,
2314
- InvalidAutofillSelection = 45,
2315
- WrongComposerSelection = 46,
2316
- MinBiggerThanMax = 47,
2317
- LowerBiggerThanUpper = 48,
2318
- MidBiggerThanMax = 49,
2319
- MinBiggerThanMid = 50,
2320
- FirstArgMissing = 51,
2321
- SecondArgMissing = 52,
2322
- MinNaN = 53,
2323
- MidNaN = 54,
2324
- MaxNaN = 55,
2325
- ValueUpperInflectionNaN = 56,
2326
- ValueLowerInflectionNaN = 57,
2327
- MinInvalidFormula = 58,
2328
- MidInvalidFormula = 59,
2329
- MaxInvalidFormula = 60,
2330
- ValueUpperInvalidFormula = 61,
2331
- ValueLowerInvalidFormula = 62,
2332
- InvalidSortZone = 63,
2333
- WaitingSessionConfirmation = 64,
2334
- MergeOverlap = 65,
2335
- TooManyHiddenElements = 66,
2336
- Readonly = 67,
2337
- InvalidViewportSize = 68,
2338
- InvalidScrollingDirection = 69,
2339
- FigureDoesNotExist = 70,
2340
- InvalidConditionalFormatId = 71,
2341
- InvalidCellPopover = 72,
2342
- EmptyTarget = 73,
2343
- InvalidFreezeQuantity = 74,
2344
- FrozenPaneOverlap = 75,
2345
- ValuesNotChanged = 76,
2346
- InvalidFilterZone = 77,
2347
- FilterOverlap = 78,
2348
- FilterNotFound = 79,
2349
- MergeInFilter = 80,
2350
- NonContinuousTargets = 81,
2351
- DuplicatedFigureId = 82,
2352
- InvalidSelectionStep = 83,
2353
- DuplicatedChartId = 84,
2354
- ChartDoesNotExist = 85,
2355
- InvalidHeaderIndex = 86,
2356
- InvalidQuantity = 87,
2357
- MoreThanOneColumnSelected = 88,
2358
- EmptySplitSeparator = 89,
2359
- SplitWillOverwriteContent = 90,
2360
- NoSplitSeparatorInSelection = 91,
2361
- NoActiveSheet = 92,
2362
- 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
2363
2393
  }
2364
2394
  interface CommandHandler<T> {
2365
2395
  allowDispatch(command: T): CommandResult | CommandResult[];
@@ -2893,8 +2923,9 @@ declare class RangeAdapter implements CommandHandler<CoreCommand> {
2893
2923
  *
2894
2924
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
2895
2925
  * @param forSheetId the id of the sheet where the range string is supposed to be used.
2926
+ * @param [useFixedZone=false] if true, the range will be returned with fixed row and column
2896
2927
  */
2897
- getRangeString(range: Range, forSheetId: UID): string;
2928
+ getRangeString(range: Range, forSheetId: UID, useFixedZone?: boolean): string;
2898
2929
  getRangeDataFromXc(sheetId: UID, xc: string): RangeData;
2899
2930
  getRangeDataFromZone(sheetId: UID, zone: Zone): RangeData;
2900
2931
  getRangeFromRangeData(data: RangeData): Range;
@@ -3113,7 +3144,7 @@ declare class CellPlugin extends CorePlugin<CoreState> implements CoreState {
3113
3144
  * starting an async evaluation even if it has been moved or re-allocated
3114
3145
  */
3115
3146
  getCellById(cellId: UID): Cell | undefined;
3116
- buildFormulaContent(sheetId: UID, cell: Pick<FormulaCell, "dependencies" | "compiledFormula">, dependencies?: Range[]): string;
3147
+ buildFormulaContent(sheetId: UID, cell: Pick<FormulaCell, "dependencies" | "compiledFormula">, dependencies?: Range[], useFixedZone?: boolean): string;
3117
3148
  getFormulaCellContent(sheetId: UID, cell: FormulaCell): string;
3118
3149
  getCellStyle(position: CellPosition): Style;
3119
3150
  /**
@@ -3723,7 +3754,7 @@ declare class EvaluationPlugin extends UIPlugin {
3723
3754
  constructor(config: UIPluginConfig);
3724
3755
  handle(cmd: Command): void;
3725
3756
  finalize(): void;
3726
- evaluateFormula(formulaString: string, sheetId?: UID): any;
3757
+ evaluateFormula(formulaString: string, sheetId?: UID): FunctionReturnValue | null;
3727
3758
  /**
3728
3759
  * Return the value of each cell in the range as they are displayed in the grid.
3729
3760
  */
@@ -4384,7 +4415,7 @@ interface RangeInputValue {
4384
4415
  * This plugin handles this internal state.
4385
4416
  */
4386
4417
  declare class SelectionInputPlugin extends UIPlugin implements StreamCallbacks<SelectionEvent> {
4387
- private readonly inputHasSingleRange;
4418
+ readonly inputHasSingleRange: boolean;
4388
4419
  static layers: LAYERS[];
4389
4420
  static getters: never[];
4390
4421
  ranges: RangeInputValue[];
@@ -4392,7 +4423,6 @@ declare class SelectionInputPlugin extends UIPlugin implements StreamCallbacks<S
4392
4423
  private activeSheet;
4393
4424
  private willAddNewRange;
4394
4425
  constructor(config: UIPluginConfig, initialRanges: string[], inputHasSingleRange: boolean);
4395
- allowDispatch(cmd: LocalCommand): CommandResult;
4396
4426
  handleEvent(event: SelectionEvent): void;
4397
4427
  handle(cmd: Command): void;
4398
4428
  getSelectionInputValue(): string[];
@@ -5932,8 +5962,8 @@ interface Props$j {
5932
5962
  onCellHovered: (position: Partial<Position$1>) => void;
5933
5963
  onCellDoubleClicked: (col: HeaderIndex, row: HeaderIndex) => void;
5934
5964
  onCellClicked: (col: HeaderIndex, row: HeaderIndex, modifiers: {
5935
- ctrlKey: boolean;
5936
- shiftKey: boolean;
5965
+ addZone: boolean;
5966
+ expandZone: boolean;
5937
5967
  }) => void;
5938
5968
  onCellRightClicked: (col: HeaderIndex, row: HeaderIndex, coordinates: DOMCoordinates) => void;
5939
5969
  onGridResized: (dimension: DOMDimension) => void;
@@ -6790,6 +6820,7 @@ interface ResizerState {
6790
6820
  draggerShadowThickness: number;
6791
6821
  delta: number;
6792
6822
  base: number;
6823
+ position: "before" | "after";
6793
6824
  }
6794
6825
  interface ResizerProps {
6795
6826
  onOpenContextMenu: (type: ContextMenuType, x: Pixel, y: Pixel) => void;
@@ -6812,7 +6843,7 @@ declare abstract class AbstractResizer extends Component<ResizerProps, Spreadshe
6812
6843
  abstract _getMaxSize(): Pixel;
6813
6844
  abstract _updateSize(): void;
6814
6845
  abstract _moveElements(): void;
6815
- abstract _selectElement(index: HeaderIndex, ctrlKey: boolean): void;
6846
+ abstract _selectElement(index: HeaderIndex, addDistinctHeader: boolean): void;
6816
6847
  abstract _increaseSelection(index: HeaderIndex): void;
6817
6848
  abstract _fitElementSize(index: HeaderIndex): void;
6818
6849
  abstract _getType(): ContextMenuType;
@@ -6846,7 +6877,7 @@ declare class ColResizer extends AbstractResizer {
6846
6877
  _getMaxSize(): Pixel;
6847
6878
  _updateSize(): void;
6848
6879
  _moveElements(): void;
6849
- _selectElement(index: HeaderIndex, ctrlKey: boolean): void;
6880
+ _selectElement(index: HeaderIndex, addDistinctHeader: boolean): void;
6850
6881
  _increaseSelection(index: HeaderIndex): void;
6851
6882
  _fitElementSize(index: HeaderIndex): void;
6852
6883
  _getType(): ContextMenuType;
@@ -6871,7 +6902,7 @@ declare class RowResizer extends AbstractResizer {
6871
6902
  _getMaxSize(): Pixel;
6872
6903
  _updateSize(): void;
6873
6904
  _moveElements(): void;
6874
- _selectElement(index: HeaderIndex, ctrlKey: boolean): void;
6905
+ _selectElement(index: HeaderIndex, addDistinctHeader: boolean): void;
6875
6906
  _increaseSelection(index: HeaderIndex): void;
6876
6907
  _fitElementSize(index: HeaderIndex): void;
6877
6908
  _getType(): ContextMenuType;
@@ -6998,9 +7029,9 @@ declare class Grid extends Component<Props$1, SpreadsheetChildEnv> {
6998
7029
  getClientPositionKey(client: Client): string;
6999
7030
  isCellHovered(col: HeaderIndex, row: HeaderIndex): boolean;
7000
7031
  private getGridRect;
7001
- onCellClicked(col: HeaderIndex, row: HeaderIndex, { ctrlKey, shiftKey }: {
7002
- ctrlKey: boolean;
7003
- shiftKey: boolean;
7032
+ onCellClicked(col: HeaderIndex, row: HeaderIndex, { addZone, expandZone }: {
7033
+ addZone: boolean;
7034
+ expandZone: boolean;
7004
7035
  }): void;
7005
7036
  onCellDoubleClicked(col: HeaderIndex, row: HeaderIndex): void;
7006
7037
  closeOpenedPopover(): void;
@@ -7037,7 +7068,7 @@ declare class ChartPanel extends Component<Props, SpreadsheetChildEnv> {
7037
7068
  declare function toNumber(value: string | number | boolean | null | undefined): number;
7038
7069
  declare function toString(value: string | number | boolean | null | undefined): string;
7039
7070
  declare function toBoolean(value: string | number | boolean | null | undefined): boolean;
7040
- declare function toJsDate(value: string | number | boolean | null | undefined): Date;
7071
+ declare function toJsDate(value: string | number | boolean | null | undefined): DateTime;
7041
7072
 
7042
7073
  declare function arg(definition: string, description?: string): ArgDefinition;
7043
7074