@odoo/o-spreadsheet 16.0.4 → 16.0.6

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.
@@ -324,10 +324,10 @@ declare function toZone(xc: string): Zone;
324
324
  */
325
325
  declare function findCellInNewZone(oldZone: Zone, currentZone: Zone): Position$1;
326
326
  declare function positionToZone(position: Position$1): {
327
- left: number;
328
- right: number;
329
- top: number;
330
- bottom: number;
327
+ left: HeaderIndex;
328
+ right: HeaderIndex;
329
+ top: HeaderIndex;
330
+ bottom: HeaderIndex;
331
331
  };
332
332
 
333
333
  interface SelectionEventPayload {
@@ -541,9 +541,9 @@ interface SectionRule {
541
541
  readonly upperInflectionPoint: SectionThreshold;
542
542
  }
543
543
  interface ColorSet {
544
- readonly lowerColor: string;
545
- readonly middleColor: string;
546
- readonly upperColor: string;
544
+ readonly lowerColor: Color;
545
+ readonly middleColor: Color;
546
+ readonly upperColor: Color;
547
547
  }
548
548
  interface SectionThreshold {
549
549
  readonly type: "number" | "percentage";
@@ -570,13 +570,13 @@ interface GaugeChartOptions extends ChartOptions {
570
570
  radiusPercentage: number;
571
571
  widthPercentage: number;
572
572
  lengthPercentage: number;
573
- color: string;
573
+ color: Color;
574
574
  };
575
575
  valueLabel?: {
576
576
  formatter: (() => string) | null;
577
577
  display: boolean;
578
- color: string;
579
- backgroundColor: string;
578
+ color: Color;
579
+ backgroundColor: Color;
580
580
  borderRadius: number;
581
581
  fontSize: number;
582
582
  padding: {
@@ -1677,12 +1677,12 @@ interface CreateChartCommand extends SheetDependentCommand {
1677
1677
  type: "CREATE_CHART";
1678
1678
  id: UID;
1679
1679
  position?: {
1680
- x: number;
1681
- y: number;
1680
+ x: Pixel;
1681
+ y: Pixel;
1682
1682
  };
1683
1683
  size?: {
1684
- width: number;
1685
- height: number;
1684
+ width: Pixel;
1685
+ height: Pixel;
1686
1686
  };
1687
1687
  definition: ChartDefinition;
1688
1688
  }
@@ -1787,7 +1787,7 @@ interface StopSelectionCommand {
1787
1787
  */
1788
1788
  interface SetColorCommand {
1789
1789
  type: "SET_HIGHLIGHT_COLOR";
1790
- color: string;
1790
+ color: Color;
1791
1791
  }
1792
1792
  interface EvaluateCellsCommand {
1793
1793
  type: "EVALUATE_CELLS";
@@ -2209,7 +2209,7 @@ declare type CoreCommandTypes = CoreCommand["type"];
2209
2209
  * Intellisense from resolving it.
2210
2210
  * See https://github.com/microsoft/TypeScript/issues/31940#issuecomment-841712377
2211
2211
  */
2212
- declare type Alias = {};
2212
+ declare type Alias = {} & {};
2213
2213
  declare type HeaderIndex = number & Alias;
2214
2214
  declare type Pixel = number & Alias;
2215
2215
  declare type UID = string & Alias;
@@ -2270,8 +2270,8 @@ interface Style {
2270
2270
  underline?: boolean;
2271
2271
  align?: Align;
2272
2272
  wrapping?: Wrapping;
2273
- fillColor?: string;
2274
- textColor?: string;
2273
+ fillColor?: Color;
2274
+ textColor?: Color;
2275
2275
  fontSize?: number;
2276
2276
  }
2277
2277
  interface UpdateCellData {
@@ -2350,7 +2350,7 @@ interface Merge extends Zone {
2350
2350
  interface Highlight$1 {
2351
2351
  zone: Zone;
2352
2352
  sheetId: UID;
2353
- color: string | null;
2353
+ color: Color | null;
2354
2354
  }
2355
2355
  interface PaneDivision {
2356
2356
  /** Represents the number of frozen columns */
@@ -2894,6 +2894,7 @@ declare class RangeAdapter implements CommandHandler<CoreCommand> {
2894
2894
  * Get a Xc string that represent a part of a range
2895
2895
  */
2896
2896
  private getRangePartString;
2897
+ private getInvalidRange;
2897
2898
  }
2898
2899
 
2899
2900
  interface CorePluginConstructor {
@@ -3302,7 +3303,7 @@ declare class Filter {
3302
3303
  readonly id: UID;
3303
3304
  readonly zoneWithHeaders: Zone;
3304
3305
  constructor(id: UID, zone: Zone);
3305
- get col(): number;
3306
+ get col(): HeaderIndex;
3306
3307
  /** Filtered zone, ie. zone of the filter without the header */
3307
3308
  get filteredZone(): Zone | undefined;
3308
3309
  }
@@ -4096,7 +4097,7 @@ declare class GridSelectionPlugin extends UIPlugin {
4096
4097
  interface RangeInputValue {
4097
4098
  id: UID;
4098
4099
  xc: string;
4099
- color: string;
4100
+ color: Color;
4100
4101
  }
4101
4102
  /**
4102
4103
  * Selection input Plugin
@@ -4195,7 +4196,7 @@ declare class SelectionInputsManagerPlugin extends UIPlugin {
4195
4196
  }
4196
4197
 
4197
4198
  interface ClientToDisplay extends Required<Client> {
4198
- color: string;
4199
+ color: Color;
4199
4200
  }
4200
4201
  declare class SelectionMultiUserPlugin extends UIPlugin {
4201
4202
  static getters: readonly ["getClientsToDisplay"];
@@ -4226,8 +4227,8 @@ declare class InternalViewport {
4226
4227
  offsetScrollbarY: Pixel;
4227
4228
  canScrollVertically: boolean;
4228
4229
  canScrollHorizontally: boolean;
4229
- width: Pixel;
4230
- height: Pixel;
4230
+ viewportWidth: Pixel;
4231
+ viewportHeight: Pixel;
4231
4232
  offsetCorrectionX: Pixel;
4232
4233
  offsetCorrectionY: Pixel;
4233
4234
  constructor(getters: Getters, sheetId: UID, boundaries: Zone, sizeInGrid: {
@@ -4240,7 +4241,14 @@ declare class InternalViewport {
4240
4241
  x: Pixel;
4241
4242
  y: Pixel;
4242
4243
  });
4243
- getMaxSize(): ZoneDimension;
4244
+ /** Returns the maximum size (in Pixels) of the viewport relative to its allocated client size
4245
+ * When the viewport grid size is smaller than its client width (resp. height), it will return
4246
+ * the client width (resp. height).
4247
+ */
4248
+ getMaxSize(): {
4249
+ width: Pixel;
4250
+ height: Pixel;
4251
+ };
4244
4252
  /**
4245
4253
  * Return the index of a column given an offset x, based on the pane left
4246
4254
  * visible cell.
@@ -4385,8 +4393,7 @@ declare class SheetViewPlugin extends UIPlugin {
4385
4393
  getSheetViewVisibleCols(): HeaderIndex[];
4386
4394
  getSheetViewVisibleRows(): HeaderIndex[];
4387
4395
  /**
4388
- * Return the main viewport maximum size. That is the zone dimension
4389
- * with some bottom and right padding.
4396
+ * Return the main viewport maximum size relative to the client size.
4390
4397
  */
4391
4398
  getMainViewportRect(): Rect;
4392
4399
  private getMaximumSheetOffset;
@@ -4818,7 +4825,7 @@ interface Props$y {
4818
4825
  interface SelectionRange extends Omit<RangeInputValue, "color"> {
4819
4826
  isFocused: boolean;
4820
4827
  isValidRange: boolean;
4821
- color?: string;
4828
+ color?: Color;
4822
4829
  }
4823
4830
  /**
4824
4831
  * This component can be used when the user needs to input some
@@ -4896,7 +4903,7 @@ interface ColorPickerProps {
4896
4903
  }
4897
4904
  declare class ColorPicker extends Component<ColorPickerProps, SpreadsheetChildEnv> {
4898
4905
  static template: string;
4899
- COLORS: string[];
4906
+ COLORS: Color[];
4900
4907
  private state;
4901
4908
  get colorPickerStyle(): string;
4902
4909
  onColorClick(color: Color): void;
@@ -4909,6 +4916,7 @@ declare class ColorPicker extends Component<ColorPickerProps, SpreadsheetChildEn
4909
4916
  showMagnifier(_ev: MouseEvent): void;
4910
4917
  moveMagnifier(ev: MouseEvent): void;
4911
4918
  get magnifyingGlassStyle(): string;
4919
+ isSameColor(color1: Color, color2: Color): boolean;
4912
4920
  }
4913
4921
 
4914
4922
  interface Props$w {
@@ -4925,7 +4933,7 @@ declare class LineBarPieDesignPanel extends Component<Props$w, SpreadsheetChildE
4925
4933
  onClick(ev: MouseEvent): void;
4926
4934
  setup(): void;
4927
4935
  toggleColorPicker(): void;
4928
- updateBackgroundColor(color: string): void;
4936
+ updateBackgroundColor(color: Color): void;
4929
4937
  updateTitle(ev: any): void;
4930
4938
  updateSelect(attr: string, ev: any): void;
4931
4939
  }
@@ -4961,7 +4969,9 @@ declare class GaugeChartDesignPanel extends Component<Props$u, SpreadsheetChildE
4961
4969
  };
4962
4970
  private state;
4963
4971
  get designErrorMessages(): string[];
4964
- updateBackgroundColor(color: string): void;
4972
+ onClick(ev: MouseEvent): void;
4973
+ setup(): void;
4974
+ updateBackgroundColor(color: Color): void;
4965
4975
  updateTitle(ev: any): void;
4966
4976
  isRangeMinInvalid(): boolean;
4967
4977
  isRangeMaxInvalid(): boolean;
@@ -4969,7 +4979,7 @@ declare class GaugeChartDesignPanel extends Component<Props$u, SpreadsheetChildE
4969
4979
  get isUpperInflectionPointInvalid(): boolean;
4970
4980
  updateInflectionPointValue(attr: string, ev: any): void;
4971
4981
  updateInflectionPointType(attr: string, ev: any): void;
4972
- updateSectionColor(target: string, color: string): void;
4982
+ updateSectionColor(target: string, color: Color): void;
4973
4983
  updateRangeMin(ev: any): void;
4974
4984
  updateRangeMax(ev: any): void;
4975
4985
  toggleMenu(menu: GaugeMenu): void;
@@ -5019,10 +5029,12 @@ declare class ScorecardChartDesignPanel extends Component<Props$s, SpreadsheetCh
5019
5029
  ColorPicker: typeof ColorPicker;
5020
5030
  };
5021
5031
  private state;
5032
+ onClick(ev: MouseEvent): void;
5033
+ setup(): void;
5022
5034
  updateTitle(ev: any): void;
5023
5035
  updateBaselineDescr(ev: any): void;
5024
5036
  openColorPicker(colorPickerId: ColorPickerId): void;
5025
- setColor(color: string, colorPickerId: ColorPickerId): void;
5037
+ setColor(color: Color, colorPickerId: ColorPickerId): void;
5026
5038
  }
5027
5039
 
5028
5040
  interface ChartSidePanel {
@@ -5078,7 +5090,7 @@ interface MenuItem {
5078
5090
  children?: menuChildren;
5079
5091
  separator?: boolean;
5080
5092
  icon?: string;
5081
- textColor?: string;
5093
+ textColor?: Color;
5082
5094
  }
5083
5095
  declare type FullMenuItem = Required<MenuItem>;
5084
5096
  declare type MenuItemsBuilder = (env: SpreadsheetChildEnv) => FullMenuItem[];
@@ -5146,8 +5158,8 @@ declare class ScorecardChart extends Component<Props$q, SpreadsheetChildEnv> {
5146
5158
  get baseline(): string;
5147
5159
  get baselineDescr(): string;
5148
5160
  get baselineArrowDirection(): BaselineArrowDirection;
5149
- get backgroundColor(): string;
5150
- get primaryFontColor(): string;
5161
+ get backgroundColor(): Color;
5162
+ get primaryFontColor(): Color;
5151
5163
  get secondaryFontColor(): "#525252" | "#C8C8C8";
5152
5164
  get figure(): Figure;
5153
5165
  get chartStyle(): string;
@@ -5168,6 +5180,22 @@ declare class ScorecardChart extends Component<Props$q, SpreadsheetChildEnv> {
5168
5180
  private getWidestElement;
5169
5181
  }
5170
5182
 
5183
+ declare const DATETIME_FORMAT: RegExp;
5184
+ declare enum ComponentsImportance {
5185
+ Grid = 0,
5186
+ Highlight = 5,
5187
+ Figure = 10,
5188
+ ScrollBar = 15,
5189
+ GridPopover = 19,
5190
+ GridComposer = 20,
5191
+ Dropdown = 21,
5192
+ ColorPicker = 25,
5193
+ IconPicker = 25,
5194
+ TopBarComposer = 30,
5195
+ Popover = 35,
5196
+ ChartAnchor = 1000
5197
+ }
5198
+
5171
5199
  interface Props$p {
5172
5200
  /**
5173
5201
  * Coordinates are expressed relative to the "body" element.
@@ -5187,6 +5215,7 @@ interface Props$p {
5187
5215
  */
5188
5216
  flipVerticalOffset: Pixel;
5189
5217
  onMouseWheel: (ev: WheelEvent) => void;
5218
+ zIndex: Number;
5190
5219
  }
5191
5220
  declare class Popover extends Component<Props$p, SpreadsheetChildEnv> {
5192
5221
  static template: string;
@@ -5196,6 +5225,7 @@ declare class Popover extends Component<Props$p, SpreadsheetChildEnv> {
5196
5225
  verticalOffset: number;
5197
5226
  marginTop: number;
5198
5227
  onMouseWheel: () => void;
5228
+ zIndex: ComponentsImportance;
5199
5229
  };
5200
5230
  private spreadsheetPosition;
5201
5231
  get style(): string;
@@ -5321,7 +5351,7 @@ declare class Autofill extends Component<Props$m, SpreadsheetChildEnv> {
5321
5351
  interface ClientTagProps {
5322
5352
  active: boolean;
5323
5353
  name: string;
5324
- color: string;
5354
+ color: Color;
5325
5355
  col: HeaderIndex;
5326
5356
  row: HeaderIndex;
5327
5357
  viewport: Viewport;
@@ -5422,7 +5452,7 @@ declare class FunctionDescriptionProvider extends Component<Props$k> {
5422
5452
 
5423
5453
  declare type HtmlContent = {
5424
5454
  value: string;
5425
- color?: string;
5455
+ color?: Color;
5426
5456
  class?: string;
5427
5457
  };
5428
5458
  interface Props$j {
@@ -5734,6 +5764,7 @@ declare class GridPopover extends Component<Props$c, SpreadsheetChildEnv> {
5734
5764
  static components: {
5735
5765
  Popover: typeof Popover;
5736
5766
  };
5767
+ zIndex: ComponentsImportance;
5737
5768
  get cellPopover(): PositionedCellPopover | ClosedCellPopover;
5738
5769
  }
5739
5770
 
@@ -5864,7 +5895,7 @@ declare class Border extends Component<Props$b, SpreadsheetChildEnv> {
5864
5895
  declare type Orientation = "nw" | "ne" | "sw" | "se";
5865
5896
  interface Props$a {
5866
5897
  zone: Zone;
5867
- color: string;
5898
+ color: Color;
5868
5899
  orientation: Orientation;
5869
5900
  isResizing: boolean;
5870
5901
  onResizeHighlight: (isLeft: boolean, isRight: boolean) => void;
@@ -5879,7 +5910,7 @@ declare class Corner extends Component<Props$a, SpreadsheetChildEnv> {
5879
5910
 
5880
5911
  interface Props$9 {
5881
5912
  zone: Zone;
5882
- color: string;
5913
+ color: Color;
5883
5914
  }
5884
5915
  interface HighlightState {
5885
5916
  shiftingMode: "isMoving" | "isResizing" | "none";
@@ -5934,8 +5965,8 @@ declare class HorizontalScrollBar extends Component<Props$7, SpreadsheetChildEnv
5934
5965
  left: number;
5935
5966
  };
5936
5967
  };
5937
- get offset(): number;
5938
- get width(): number;
5968
+ get offset(): Pixel;
5969
+ get width(): Pixel;
5939
5970
  get isDisplayed(): boolean;
5940
5971
  get position(): {
5941
5972
  left: string;
@@ -5961,8 +5992,8 @@ declare class VerticalScrollBar extends Component<Props$6, SpreadsheetChildEnv>
5961
5992
  top: number;
5962
5993
  };
5963
5994
  };
5964
- get offset(): number;
5965
- get height(): number;
5995
+ get offset(): Pixel;
5996
+ get height(): Pixel;
5966
5997
  get isDisplayed(): boolean;
5967
5998
  get position(): {
5968
5999
  top: string;
@@ -6098,7 +6129,7 @@ declare abstract class AbstractCell<T extends CellEvaluation = CellEvaluation> i
6098
6129
  isLink(): this is LinkCell$1;
6099
6130
  isEmpty(): boolean;
6100
6131
  get evaluated(): T;
6101
- get formattedValue(): string;
6132
+ get formattedValue(): FormattedValue;
6102
6133
  get composerContent(): string;
6103
6134
  get defaultAlign(): "center" | "left" | "right";
6104
6135
  /**
@@ -6286,8 +6317,8 @@ declare class TopBar extends Component<Props, SpreadsheetChildEnv> {
6286
6317
  undoTool: boolean;
6287
6318
  redoTool: boolean;
6288
6319
  paintFormatTool: boolean;
6289
- fillColor: string;
6290
- textColor: string;
6320
+ fillColor: Color;
6321
+ textColor: Color;
6291
6322
  menus: FullMenuItem[];
6292
6323
  composerStyle: string;
6293
6324
  setup(): void;
@@ -6303,7 +6334,7 @@ declare class TopBar extends Component<Props, SpreadsheetChildEnv> {
6303
6334
  updateCellState(): void;
6304
6335
  getMenuName(menu: FullMenuItem): string;
6305
6336
  toggleMerge(): void;
6306
- setColor(target: string, color: string): void;
6337
+ setColor(target: string, color: Color): void;
6307
6338
  setBorder(command: BorderCommand): void;
6308
6339
  setFormat(ev: MouseEvent): void;
6309
6340
  openCustomFormatSidePanel(custom: string): void;
@@ -6376,8 +6407,6 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
6376
6407
  get gridHeight(): Pixel;
6377
6408
  }
6378
6409
 
6379
- declare const DATETIME_FORMAT: RegExp;
6380
-
6381
6410
  /**
6382
6411
  * We export here all entities that needs to be accessed publicly by Odoo.
6383
6412
  *