@odoo/o-spreadsheet 16.0.5 → 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 */
@@ -3303,7 +3303,7 @@ declare class Filter {
3303
3303
  readonly id: UID;
3304
3304
  readonly zoneWithHeaders: Zone;
3305
3305
  constructor(id: UID, zone: Zone);
3306
- get col(): number;
3306
+ get col(): HeaderIndex;
3307
3307
  /** Filtered zone, ie. zone of the filter without the header */
3308
3308
  get filteredZone(): Zone | undefined;
3309
3309
  }
@@ -4097,7 +4097,7 @@ declare class GridSelectionPlugin extends UIPlugin {
4097
4097
  interface RangeInputValue {
4098
4098
  id: UID;
4099
4099
  xc: string;
4100
- color: string;
4100
+ color: Color;
4101
4101
  }
4102
4102
  /**
4103
4103
  * Selection input Plugin
@@ -4196,7 +4196,7 @@ declare class SelectionInputsManagerPlugin extends UIPlugin {
4196
4196
  }
4197
4197
 
4198
4198
  interface ClientToDisplay extends Required<Client> {
4199
- color: string;
4199
+ color: Color;
4200
4200
  }
4201
4201
  declare class SelectionMultiUserPlugin extends UIPlugin {
4202
4202
  static getters: readonly ["getClientsToDisplay"];
@@ -4227,8 +4227,8 @@ declare class InternalViewport {
4227
4227
  offsetScrollbarY: Pixel;
4228
4228
  canScrollVertically: boolean;
4229
4229
  canScrollHorizontally: boolean;
4230
- width: Pixel;
4231
- height: Pixel;
4230
+ viewportWidth: Pixel;
4231
+ viewportHeight: Pixel;
4232
4232
  offsetCorrectionX: Pixel;
4233
4233
  offsetCorrectionY: Pixel;
4234
4234
  constructor(getters: Getters, sheetId: UID, boundaries: Zone, sizeInGrid: {
@@ -4241,7 +4241,14 @@ declare class InternalViewport {
4241
4241
  x: Pixel;
4242
4242
  y: Pixel;
4243
4243
  });
4244
- 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
+ };
4245
4252
  /**
4246
4253
  * Return the index of a column given an offset x, based on the pane left
4247
4254
  * visible cell.
@@ -4386,8 +4393,7 @@ declare class SheetViewPlugin extends UIPlugin {
4386
4393
  getSheetViewVisibleCols(): HeaderIndex[];
4387
4394
  getSheetViewVisibleRows(): HeaderIndex[];
4388
4395
  /**
4389
- * Return the main viewport maximum size. That is the zone dimension
4390
- * with some bottom and right padding.
4396
+ * Return the main viewport maximum size relative to the client size.
4391
4397
  */
4392
4398
  getMainViewportRect(): Rect;
4393
4399
  private getMaximumSheetOffset;
@@ -4819,7 +4825,7 @@ interface Props$y {
4819
4825
  interface SelectionRange extends Omit<RangeInputValue, "color"> {
4820
4826
  isFocused: boolean;
4821
4827
  isValidRange: boolean;
4822
- color?: string;
4828
+ color?: Color;
4823
4829
  }
4824
4830
  /**
4825
4831
  * This component can be used when the user needs to input some
@@ -4897,7 +4903,7 @@ interface ColorPickerProps {
4897
4903
  }
4898
4904
  declare class ColorPicker extends Component<ColorPickerProps, SpreadsheetChildEnv> {
4899
4905
  static template: string;
4900
- COLORS: string[];
4906
+ COLORS: Color[];
4901
4907
  private state;
4902
4908
  get colorPickerStyle(): string;
4903
4909
  onColorClick(color: Color): void;
@@ -4910,6 +4916,7 @@ declare class ColorPicker extends Component<ColorPickerProps, SpreadsheetChildEn
4910
4916
  showMagnifier(_ev: MouseEvent): void;
4911
4917
  moveMagnifier(ev: MouseEvent): void;
4912
4918
  get magnifyingGlassStyle(): string;
4919
+ isSameColor(color1: Color, color2: Color): boolean;
4913
4920
  }
4914
4921
 
4915
4922
  interface Props$w {
@@ -4926,7 +4933,7 @@ declare class LineBarPieDesignPanel extends Component<Props$w, SpreadsheetChildE
4926
4933
  onClick(ev: MouseEvent): void;
4927
4934
  setup(): void;
4928
4935
  toggleColorPicker(): void;
4929
- updateBackgroundColor(color: string): void;
4936
+ updateBackgroundColor(color: Color): void;
4930
4937
  updateTitle(ev: any): void;
4931
4938
  updateSelect(attr: string, ev: any): void;
4932
4939
  }
@@ -4962,7 +4969,9 @@ declare class GaugeChartDesignPanel extends Component<Props$u, SpreadsheetChildE
4962
4969
  };
4963
4970
  private state;
4964
4971
  get designErrorMessages(): string[];
4965
- updateBackgroundColor(color: string): void;
4972
+ onClick(ev: MouseEvent): void;
4973
+ setup(): void;
4974
+ updateBackgroundColor(color: Color): void;
4966
4975
  updateTitle(ev: any): void;
4967
4976
  isRangeMinInvalid(): boolean;
4968
4977
  isRangeMaxInvalid(): boolean;
@@ -4970,7 +4979,7 @@ declare class GaugeChartDesignPanel extends Component<Props$u, SpreadsheetChildE
4970
4979
  get isUpperInflectionPointInvalid(): boolean;
4971
4980
  updateInflectionPointValue(attr: string, ev: any): void;
4972
4981
  updateInflectionPointType(attr: string, ev: any): void;
4973
- updateSectionColor(target: string, color: string): void;
4982
+ updateSectionColor(target: string, color: Color): void;
4974
4983
  updateRangeMin(ev: any): void;
4975
4984
  updateRangeMax(ev: any): void;
4976
4985
  toggleMenu(menu: GaugeMenu): void;
@@ -5020,10 +5029,12 @@ declare class ScorecardChartDesignPanel extends Component<Props$s, SpreadsheetCh
5020
5029
  ColorPicker: typeof ColorPicker;
5021
5030
  };
5022
5031
  private state;
5032
+ onClick(ev: MouseEvent): void;
5033
+ setup(): void;
5023
5034
  updateTitle(ev: any): void;
5024
5035
  updateBaselineDescr(ev: any): void;
5025
5036
  openColorPicker(colorPickerId: ColorPickerId): void;
5026
- setColor(color: string, colorPickerId: ColorPickerId): void;
5037
+ setColor(color: Color, colorPickerId: ColorPickerId): void;
5027
5038
  }
5028
5039
 
5029
5040
  interface ChartSidePanel {
@@ -5079,7 +5090,7 @@ interface MenuItem {
5079
5090
  children?: menuChildren;
5080
5091
  separator?: boolean;
5081
5092
  icon?: string;
5082
- textColor?: string;
5093
+ textColor?: Color;
5083
5094
  }
5084
5095
  declare type FullMenuItem = Required<MenuItem>;
5085
5096
  declare type MenuItemsBuilder = (env: SpreadsheetChildEnv) => FullMenuItem[];
@@ -5147,8 +5158,8 @@ declare class ScorecardChart extends Component<Props$q, SpreadsheetChildEnv> {
5147
5158
  get baseline(): string;
5148
5159
  get baselineDescr(): string;
5149
5160
  get baselineArrowDirection(): BaselineArrowDirection;
5150
- get backgroundColor(): string;
5151
- get primaryFontColor(): string;
5161
+ get backgroundColor(): Color;
5162
+ get primaryFontColor(): Color;
5152
5163
  get secondaryFontColor(): "#525252" | "#C8C8C8";
5153
5164
  get figure(): Figure;
5154
5165
  get chartStyle(): string;
@@ -5169,6 +5180,22 @@ declare class ScorecardChart extends Component<Props$q, SpreadsheetChildEnv> {
5169
5180
  private getWidestElement;
5170
5181
  }
5171
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
+
5172
5199
  interface Props$p {
5173
5200
  /**
5174
5201
  * Coordinates are expressed relative to the "body" element.
@@ -5188,6 +5215,7 @@ interface Props$p {
5188
5215
  */
5189
5216
  flipVerticalOffset: Pixel;
5190
5217
  onMouseWheel: (ev: WheelEvent) => void;
5218
+ zIndex: Number;
5191
5219
  }
5192
5220
  declare class Popover extends Component<Props$p, SpreadsheetChildEnv> {
5193
5221
  static template: string;
@@ -5197,6 +5225,7 @@ declare class Popover extends Component<Props$p, SpreadsheetChildEnv> {
5197
5225
  verticalOffset: number;
5198
5226
  marginTop: number;
5199
5227
  onMouseWheel: () => void;
5228
+ zIndex: ComponentsImportance;
5200
5229
  };
5201
5230
  private spreadsheetPosition;
5202
5231
  get style(): string;
@@ -5322,7 +5351,7 @@ declare class Autofill extends Component<Props$m, SpreadsheetChildEnv> {
5322
5351
  interface ClientTagProps {
5323
5352
  active: boolean;
5324
5353
  name: string;
5325
- color: string;
5354
+ color: Color;
5326
5355
  col: HeaderIndex;
5327
5356
  row: HeaderIndex;
5328
5357
  viewport: Viewport;
@@ -5423,7 +5452,7 @@ declare class FunctionDescriptionProvider extends Component<Props$k> {
5423
5452
 
5424
5453
  declare type HtmlContent = {
5425
5454
  value: string;
5426
- color?: string;
5455
+ color?: Color;
5427
5456
  class?: string;
5428
5457
  };
5429
5458
  interface Props$j {
@@ -5735,6 +5764,7 @@ declare class GridPopover extends Component<Props$c, SpreadsheetChildEnv> {
5735
5764
  static components: {
5736
5765
  Popover: typeof Popover;
5737
5766
  };
5767
+ zIndex: ComponentsImportance;
5738
5768
  get cellPopover(): PositionedCellPopover | ClosedCellPopover;
5739
5769
  }
5740
5770
 
@@ -5865,7 +5895,7 @@ declare class Border extends Component<Props$b, SpreadsheetChildEnv> {
5865
5895
  declare type Orientation = "nw" | "ne" | "sw" | "se";
5866
5896
  interface Props$a {
5867
5897
  zone: Zone;
5868
- color: string;
5898
+ color: Color;
5869
5899
  orientation: Orientation;
5870
5900
  isResizing: boolean;
5871
5901
  onResizeHighlight: (isLeft: boolean, isRight: boolean) => void;
@@ -5880,7 +5910,7 @@ declare class Corner extends Component<Props$a, SpreadsheetChildEnv> {
5880
5910
 
5881
5911
  interface Props$9 {
5882
5912
  zone: Zone;
5883
- color: string;
5913
+ color: Color;
5884
5914
  }
5885
5915
  interface HighlightState {
5886
5916
  shiftingMode: "isMoving" | "isResizing" | "none";
@@ -5935,8 +5965,8 @@ declare class HorizontalScrollBar extends Component<Props$7, SpreadsheetChildEnv
5935
5965
  left: number;
5936
5966
  };
5937
5967
  };
5938
- get offset(): number;
5939
- get width(): number;
5968
+ get offset(): Pixel;
5969
+ get width(): Pixel;
5940
5970
  get isDisplayed(): boolean;
5941
5971
  get position(): {
5942
5972
  left: string;
@@ -5962,8 +5992,8 @@ declare class VerticalScrollBar extends Component<Props$6, SpreadsheetChildEnv>
5962
5992
  top: number;
5963
5993
  };
5964
5994
  };
5965
- get offset(): number;
5966
- get height(): number;
5995
+ get offset(): Pixel;
5996
+ get height(): Pixel;
5967
5997
  get isDisplayed(): boolean;
5968
5998
  get position(): {
5969
5999
  top: string;
@@ -6099,7 +6129,7 @@ declare abstract class AbstractCell<T extends CellEvaluation = CellEvaluation> i
6099
6129
  isLink(): this is LinkCell$1;
6100
6130
  isEmpty(): boolean;
6101
6131
  get evaluated(): T;
6102
- get formattedValue(): string;
6132
+ get formattedValue(): FormattedValue;
6103
6133
  get composerContent(): string;
6104
6134
  get defaultAlign(): "center" | "left" | "right";
6105
6135
  /**
@@ -6287,8 +6317,8 @@ declare class TopBar extends Component<Props, SpreadsheetChildEnv> {
6287
6317
  undoTool: boolean;
6288
6318
  redoTool: boolean;
6289
6319
  paintFormatTool: boolean;
6290
- fillColor: string;
6291
- textColor: string;
6320
+ fillColor: Color;
6321
+ textColor: Color;
6292
6322
  menus: FullMenuItem[];
6293
6323
  composerStyle: string;
6294
6324
  setup(): void;
@@ -6304,7 +6334,7 @@ declare class TopBar extends Component<Props, SpreadsheetChildEnv> {
6304
6334
  updateCellState(): void;
6305
6335
  getMenuName(menu: FullMenuItem): string;
6306
6336
  toggleMerge(): void;
6307
- setColor(target: string, color: string): void;
6337
+ setColor(target: string, color: Color): void;
6308
6338
  setBorder(command: BorderCommand): void;
6309
6339
  setFormat(ev: MouseEvent): void;
6310
6340
  openCustomFormatSidePanel(custom: string): void;
@@ -6377,8 +6407,6 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
6377
6407
  get gridHeight(): Pixel;
6378
6408
  }
6379
6409
 
6380
- declare const DATETIME_FORMAT: RegExp;
6381
-
6382
6410
  /**
6383
6411
  * We export here all entities that needs to be accessed publicly by Odoo.
6384
6412
  *