@odoo/o-spreadsheet 18.2.0-alpha.2 → 18.2.0-alpha.4

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.
@@ -1186,6 +1186,7 @@ declare class Session extends EventBus<CollaborativeEvent> {
1186
1186
  private waitingUndoRedoAck;
1187
1187
  private isReplayingInitialRevisions;
1188
1188
  private processedRevisions;
1189
+ private lastRevisionMessage;
1189
1190
  private uuidGenerator;
1190
1191
  private lastLocalOperation;
1191
1192
  /**
@@ -2111,10 +2112,16 @@ declare class InternalViewport {
2111
2112
  adjustViewportZone(): void;
2112
2113
  /**
2113
2114
  *
2114
- * @param zone
2115
- * @returns Computes the absolute coordinate of a given zone inside the viewport
2115
+ * Computes the visible coordinates & dimensions of a given zone inside the viewport
2116
+ *
2117
+ */
2118
+ getVisibleRect(zone: Zone): Rect | undefined;
2119
+ /**
2120
+ *
2121
+ * @returns Computes the absolute coordinates & dimensions of a given zone inside the viewport
2122
+ *
2116
2123
  */
2117
- getRect(zone: Zone): Rect | undefined;
2124
+ getFullRect(zone: Zone): Rect | undefined;
2118
2125
  isVisible(col: HeaderIndex, row: HeaderIndex): boolean;
2119
2126
  private searchHeaderIndex;
2120
2127
  private setViewportOffsetX;
@@ -2183,7 +2190,7 @@ type SheetViewports = {
2183
2190
  *
2184
2191
  */
2185
2192
  declare class SheetViewPlugin extends UIPlugin {
2186
- static getters: readonly ["getColIndex", "getRowIndex", "getActiveMainViewport", "getSheetViewDimension", "getSheetViewDimensionWithHeaders", "getMainViewportRect", "isVisibleInViewport", "getEdgeScrollCol", "getEdgeScrollRow", "getVisibleFigures", "getVisibleRect", "getVisibleRectWithoutHeaders", "getVisibleCellPositions", "getColRowOffsetInViewport", "getMainViewportCoordinates", "getActiveSheetScrollInfo", "getActiveSheetDOMScrollInfo", "getSheetViewVisibleCols", "getSheetViewVisibleRows", "getFrozenSheetViewRatio", "isPositionVisible", "getColDimensionsInViewport", "getRowDimensionsInViewport"];
2193
+ static getters: readonly ["getColIndex", "getRowIndex", "getActiveMainViewport", "getSheetViewDimension", "getSheetViewDimensionWithHeaders", "getMainViewportRect", "isVisibleInViewport", "getEdgeScrollCol", "getEdgeScrollRow", "getVisibleFigures", "getVisibleRect", "getVisibleRectWithoutHeaders", "getVisibleCellPositions", "getColRowOffsetInViewport", "getMainViewportCoordinates", "getActiveSheetScrollInfo", "getActiveSheetDOMScrollInfo", "getSheetViewVisibleCols", "getSheetViewVisibleRows", "getFrozenSheetViewRatio", "isPositionVisible", "getColDimensionsInViewport", "getRowDimensionsInViewport", "getAllActiveViewportsZones", "getRect"];
2187
2194
  readonly viewports: Record<UID, SheetViewports | undefined>;
2188
2195
  /**
2189
2196
  * The viewport dimensions are usually set by one of the components
@@ -2254,6 +2261,11 @@ declare class SheetViewPlugin extends UIPlugin {
2254
2261
  * Computes the coordinates and size to draw the zone without taking the grid offset into account
2255
2262
  */
2256
2263
  getVisibleRectWithoutHeaders(zone: Zone): Rect;
2264
+ /**
2265
+ * Computes the actual size and position (:Rect) of the zone on the canvas
2266
+ * regardless of the viewport dimensions.
2267
+ */
2268
+ getRect(zone: Zone): Rect;
2257
2269
  /**
2258
2270
  * Returns the position of the MainViewport relatively to the start of the grid (without headers)
2259
2271
  * It corresponds to the summed dimensions of the visible cols/rows (in x/y respectively)
@@ -2270,6 +2282,7 @@ declare class SheetViewPlugin extends UIPlugin {
2270
2282
  * of the current viewport
2271
2283
  */
2272
2284
  getRowDimensionsInViewport(sheetId: UID, row: HeaderIndex): HeaderDimensions;
2285
+ getAllActiveViewportsZones(): Zone[];
2273
2286
  private ensureMainViewportExist;
2274
2287
  private getSubViewports;
2275
2288
  private checkPositiveDimension;
@@ -2301,6 +2314,7 @@ declare class SheetViewPlugin extends UIPlugin {
2301
2314
  xRatio: number;
2302
2315
  yRatio: number;
2303
2316
  };
2317
+ private recomposeRect;
2304
2318
  }
2305
2319
 
2306
2320
  declare enum ClipboardMIMEType {
@@ -3972,6 +3986,10 @@ interface SpreadsheetChildEnv extends NotificationStoreMethods {
3972
3986
  getStore: Get;
3973
3987
  }
3974
3988
 
3989
+ interface RangeStringOptions {
3990
+ useBoundedReference?: boolean;
3991
+ useFixedReference?: boolean;
3992
+ }
3975
3993
  declare class RangeAdapter implements CommandHandler<CoreCommand> {
3976
3994
  private getters;
3977
3995
  private providers;
@@ -4019,11 +4037,10 @@ declare class RangeAdapter implements CommandHandler<CoreCommand> {
4019
4037
  * @param range the range (received from getRangeFromXC or getRangeFromZone)
4020
4038
  * @param forSheetId the id of the sheet where the range string is supposed to be used.
4021
4039
  * @param options
4040
+ * @param options.useBoundedReference if true, the range will be returned with bounded row and column
4022
4041
  * @param options.useFixedReference if true, the range will be returned with fixed row and column
4023
4042
  */
4024
- getRangeString(range: Range, forSheetId: UID, options?: {
4025
- useFixedReference: boolean;
4026
- }): string;
4043
+ getRangeString(range: Range, forSheetId: UID, options?: RangeStringOptions): string;
4027
4044
  getRangeDataFromXc(sheetId: UID, xc: string): RangeData;
4028
4045
  getRangeDataFromZone(sheetId: UID, zone: Zone | UnboundedZone): RangeData;
4029
4046
  getRangeFromZone(sheetId: UID, zone: Zone | UnboundedZone): Range;
@@ -4259,7 +4276,7 @@ declare class CellPlugin extends CorePlugin<CoreState$1> implements CoreState$1
4259
4276
  * starting an async evaluation even if it has been moved or re-allocated
4260
4277
  */
4261
4278
  getCellById(cellId: UID): Cell | undefined;
4262
- getFormulaString(sheetId: UID, tokens: Token[], dependencies: Range[], useFixedReference?: boolean): string;
4279
+ getFormulaString(sheetId: UID, tokens: Token[], dependencies: Range[], useBoundedReference?: boolean): string;
4263
4280
  getTranslatedCellFormula(sheetId: UID, offsetX: number, offsetY: number, tokens: Token[]): string;
4264
4281
  getFormulaMovedInSheet(originSheetId: UID, targetSheetId: UID, tokens: Token[]): string;
4265
4282
  getCellStyle(position: CellPosition): Style;
@@ -6807,8 +6824,8 @@ interface RangeInputValue {
6807
6824
  declare class SelectionInputStore extends SpreadsheetStore {
6808
6825
  private initialRanges;
6809
6826
  private readonly inputHasSingleRange;
6810
- private readonly colors;
6811
- mutators: readonly ["resetWithRanges", "focusById", "unfocus", "addEmptyRange", "removeRange", "changeRange", "reset", "confirm"];
6827
+ colors: Color[];
6828
+ mutators: readonly ["resetWithRanges", "focusById", "unfocus", "addEmptyRange", "removeRange", "changeRange", "reset", "confirm", "updateColors"];
6812
6829
  ranges: RangeInputValue[];
6813
6830
  focusedRangeIndex: number | null;
6814
6831
  private inputSheetId;
@@ -6826,6 +6843,7 @@ declare class SelectionInputStore extends SpreadsheetStore {
6826
6843
  changeRange(rangeId: number, value: string): void;
6827
6844
  addEmptyRange(): void;
6828
6845
  removeRange(rangeId: number): void;
6846
+ updateColors(colors: Color[]): void;
6829
6847
  confirm(): void;
6830
6848
  reset(): void;
6831
6849
  get selectionInputValues(): string[];
@@ -6892,6 +6910,8 @@ interface Props$1a {
6892
6910
  isInvalid?: boolean;
6893
6911
  class?: string;
6894
6912
  onSelectionChanged?: (ranges: string[]) => void;
6913
+ onSelectionReordered?: (indexes: number[]) => void;
6914
+ onSelectionRemoved?: (index: number) => void;
6895
6915
  onSelectionConfirmed?: () => void;
6896
6916
  colors?: Color[];
6897
6917
  }
@@ -6936,6 +6956,14 @@ declare class SelectionInput extends Component<Props$1a, SpreadsheetChildEnv> {
6936
6956
  type: FunctionConstructor;
6937
6957
  optional: boolean;
6938
6958
  };
6959
+ onSelectionReordered: {
6960
+ type: FunctionConstructor;
6961
+ optional: boolean;
6962
+ };
6963
+ onSelectionRemoved: {
6964
+ type: FunctionConstructor;
6965
+ optional: boolean;
6966
+ };
6939
6967
  colors: {
6940
6968
  type: ArrayConstructor;
6941
6969
  optional: boolean;
@@ -6943,7 +6971,9 @@ declare class SelectionInput extends Component<Props$1a, SpreadsheetChildEnv> {
6943
6971
  };
6944
6972
  };
6945
6973
  private state;
6974
+ private dragAndDrop;
6946
6975
  private focusedInput;
6976
+ private selectionRef;
6947
6977
  private store;
6948
6978
  get ranges(): SelectionRange[];
6949
6979
  get canAddRange(): boolean;
@@ -6951,6 +6981,8 @@ declare class SelectionInput extends Component<Props$1a, SpreadsheetChildEnv> {
6951
6981
  get isConfirmable(): boolean;
6952
6982
  get isResettable(): boolean;
6953
6983
  setup(): void;
6984
+ startDragAndDrop(rangeId: number, event: MouseEvent): void;
6985
+ getRangeElementsRects(): DOMRect[];
6954
6986
  getColor(range: SelectionRange): string;
6955
6987
  private triggerChange;
6956
6988
  onKeydown(ev: KeyboardEvent): void;
@@ -6967,6 +6999,8 @@ interface Props$19 {
6967
6999
  ranges: CustomizedDataSet[];
6968
7000
  hasSingleRange?: boolean;
6969
7001
  onSelectionChanged: (ranges: string[]) => void;
7002
+ onSelectionReordered?: (indexes: number[]) => void;
7003
+ onSelectionRemoved?: (index: number) => void;
6970
7004
  onSelectionConfirmed: () => void;
6971
7005
  }
6972
7006
  declare class ChartDataSeries extends Component<Props$19, SpreadsheetChildEnv> {
@@ -6982,6 +7016,14 @@ declare class ChartDataSeries extends Component<Props$19, SpreadsheetChildEnv> {
6982
7016
  optional: boolean;
6983
7017
  };
6984
7018
  onSelectionChanged: FunctionConstructor;
7019
+ onSelectionReordered: {
7020
+ type: FunctionConstructor;
7021
+ optional: boolean;
7022
+ };
7023
+ onSelectionRemoved: {
7024
+ type: FunctionConstructor;
7025
+ optional: boolean;
7026
+ };
6985
7027
  onSelectionConfirmed: FunctionConstructor;
6986
7028
  };
6987
7029
  get ranges(): string[];
@@ -7088,7 +7130,7 @@ declare class GenericChartConfigPanel extends Component<Props$15, SpreadsheetChi
7088
7130
  canUpdateChart: FunctionConstructor;
7089
7131
  };
7090
7132
  protected state: ChartPanelState;
7091
- protected dataSeriesRanges: CustomizedDataSet[];
7133
+ protected dataSets: CustomizedDataSet[];
7092
7134
  private labelRange;
7093
7135
  protected chartTerms: {
7094
7136
  [key: string]: any;
@@ -7113,6 +7155,8 @@ declare class GenericChartConfigPanel extends Component<Props$15, SpreadsheetChi
7113
7155
  * button "confirm" is clicked
7114
7156
  */
7115
7157
  onDataSeriesRangesChanged(ranges: string[]): void;
7158
+ onDataSeriesReordered(indexes: number[]): void;
7159
+ onDataSeriesRemoved(index: number): void;
7116
7160
  onDataSeriesConfirmed(): void;
7117
7161
  getDataSeriesRanges(): CustomizedDataSet[];
7118
7162
  /**
@@ -9595,7 +9639,7 @@ declare function useHighlights(highlightProvider: HighlightProvider): void;
9595
9639
  declare class MainChartPanelStore extends SpreadsheetStore {
9596
9640
  mutators: readonly ["activatePanel", "changeChartType"];
9597
9641
  panel: "configuration" | "design";
9598
- private creationContext;
9642
+ private creationContexts;
9599
9643
  activatePanel(panel: "configuration" | "design"): void;
9600
9644
  changeChartType(figureId: UID, newDisplayType: string): void;
9601
9645
  private getChartDefinitionFromContextCreation;
@@ -11199,7 +11243,7 @@ declare class BorderEditor extends Component<BorderEditorProps, SpreadsheetChild
11199
11243
  }
11200
11244
 
11201
11245
  interface Props$3 {
11202
- toggleBorderEditor: () => void;
11246
+ toggleBorderEditor: (ev: MouseEvent) => void;
11203
11247
  showBorderEditor: boolean;
11204
11248
  disabled?: boolean;
11205
11249
  dropdownMaxHeight?: Pixel;
@@ -11235,6 +11279,7 @@ declare class BorderEditorWidget extends Component<Props$3, SpreadsheetChildEnv>
11235
11279
  el: HTMLElement | null;
11236
11280
  };
11237
11281
  state: State$3;
11282
+ setup(): void;
11238
11283
  get borderEditorAnchorRect(): Rect;
11239
11284
  onBorderPositionPicked(position: BorderPosition): void;
11240
11285
  onBorderColorPicked(color: Color): void;
@@ -12699,6 +12744,7 @@ declare const chartHelpers: {
12699
12744
  getComboChartDatasets(definition: GenericDefinition<ComboChartDefinition>, args: ChartRuntimeGenerationArgs): chart_js.ChartDataset<"line" | "bar">[];
12700
12745
  getRadarChartDatasets(definition: GenericDefinition<RadarChartDefinition>, args: ChartRuntimeGenerationArgs): chart_js.ChartDataset<"radar">[];
12701
12746
  getGeoChartDatasets(definition: GenericDefinition<GeoChartDefinition>, args: GeoChartRuntimeGenerationArgs): chart_js.ChartDataset[];
12747
+ getChartColorsGenerator(definition: GenericDefinition<ChartWithDataSetDefinition>, dataSetsSize: number): ColorGenerator;
12702
12748
  getChartLayout(definition: GenericDefinition<ChartWithDataSetDefinition>): chart_js_dist_types_utils._DeepPartialObject<Partial<{
12703
12749
  autoPadding: boolean;
12704
12750
  padding: chart_js.Scriptable<chart_js_dist_types_geometric.Padding, chart_js.ScriptableContext<keyof chart_js.ChartTypeRegistry>>;