@odoo/o-spreadsheet 16.5.0-alpha.2 → 16.5.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.
@@ -1,6 +1,6 @@
1
1
  import * as _odoo_owl from '@odoo/owl';
2
2
  import { ComponentConstructor, Component } from '@odoo/owl';
3
- import { ChartConfiguration, ChartData, ChartDataSets, ChartOptions } from 'chart.js';
3
+ import { ChartConfiguration, ChartData, ChartDataset, ChartOptions } from 'chart.js';
4
4
 
5
5
  declare enum CellErrorLevel {
6
6
  silent = 0,
@@ -374,7 +374,7 @@ interface SectionThreshold {
374
374
  }
375
375
  interface GaugeChartConfiguration extends Omit<ChartConfiguration, "data" | "options"> {
376
376
  data?: GaugeChartData;
377
- options?: GaugeChartOptions;
377
+ options: GaugeChartOptions;
378
378
  }
379
379
  interface GaugeChartRuntime {
380
380
  chartJsConfig: GaugeChartConfiguration;
@@ -383,32 +383,40 @@ interface GaugeChartRuntime {
383
383
  interface GaugeChartData extends Omit<ChartData, "datasets"> {
384
384
  datasets: GaugeChartDataSets[];
385
385
  }
386
- interface GaugeChartDataSets extends ChartDataSets {
386
+ interface GaugeChartDataSets extends ChartDataset<"doughnut"> {
387
387
  readonly minValue?: number;
388
388
  readonly value?: number | undefined;
389
389
  readonly backgroundColor?: string[];
390
390
  }
391
391
  interface GaugeChartOptions extends ChartOptions {
392
- needle?: {
393
- radiusPercentage: number;
394
- widthPercentage: number;
395
- lengthPercentage: number;
396
- color: Color;
392
+ needle?: NeedleOptions;
393
+ valueLabel?: ValueLabelOptions;
394
+ }
395
+ interface NeedleOptions {
396
+ display?: boolean;
397
+ borderColor?: Color;
398
+ backgroundColor?: Color;
399
+ /**
400
+ * Needle width as the percentage of the chart area width
401
+ */
402
+ width?: number;
403
+ }
404
+ interface ValueLabelOptions {
405
+ display?: boolean;
406
+ formatter?: (value: any) => string;
407
+ font?: {
408
+ size?: number;
409
+ family?: string;
410
+ color?: Color;
397
411
  };
398
- valueLabel?: {
399
- formatter: (() => string) | null;
400
- display: boolean;
401
- color: Color;
402
- backgroundColor: Color;
403
- borderRadius: number;
404
- fontSize: number;
405
- padding: {
406
- top: number;
407
- right: number;
408
- bottom: number;
409
- left: number;
410
- };
411
- bottomMarginPercentage: number;
412
+ backgroundColor?: Color;
413
+ borderColor?: Color;
414
+ borderRadius?: number;
415
+ padding?: {
416
+ left: number;
417
+ right: number;
418
+ top: number;
419
+ bottom: number;
412
420
  };
413
421
  }
414
422
 
@@ -1083,11 +1091,6 @@ interface ImageProviderInterface {
1083
1091
  getImageOriginalSize(path: string): Promise<FigureSize>;
1084
1092
  }
1085
1093
 
1086
- interface NotifyUIEvent {
1087
- type: "ERROR";
1088
- text: string;
1089
- }
1090
-
1091
1094
  /**
1092
1095
  * Model
1093
1096
  *
@@ -1133,7 +1136,8 @@ interface ModelConfig {
1133
1136
  readonly transportService: TransportService;
1134
1137
  readonly client: Client;
1135
1138
  readonly snapshotRequested: boolean;
1136
- readonly notifyUI: (payload: NotifyUIEvent) => void;
1139
+ readonly notifyUI: (payload: InformationNotification) => void;
1140
+ readonly raiseBlockingErrorUI: (text: string) => void;
1137
1141
  }
1138
1142
  interface ModelExternalConfig {
1139
1143
  readonly fileStore?: FileStore;
@@ -1363,7 +1367,7 @@ declare class BasePlugin<State = any, C = any> implements CommandHandler<C>, Val
1363
1367
  checkValidations<T>(command: T, ...validations: Validation<T>[]): CommandResult | CommandResult[];
1364
1368
  }
1365
1369
 
1366
- type UIActions = Pick<ModelConfig, "notifyUI">;
1370
+ type UIActions = Pick<ModelConfig, "notifyUI" | "raiseBlockingErrorUI">;
1367
1371
  interface UIPluginConfig {
1368
1372
  readonly getters: Getters;
1369
1373
  readonly stateObserver: StateObserver;
@@ -2828,16 +2832,19 @@ type TranslationFunction = (string: string, ...values: string[] | [{
2828
2832
  /***
2829
2833
  * Allow to inject a translation function from outside o-spreadsheet.
2830
2834
  * @param tfn the function that will do the translation
2835
+ * @param loaded a function that returns true when the translation is loaded
2831
2836
  */
2832
- declare function setTranslationMethod(tfn: TranslationFunction): void;
2837
+ declare function setTranslationMethod(tfn: TranslationFunction, loaded?: () => boolean): void;
2833
2838
 
2834
2839
  interface EditTextOptions {
2835
2840
  error?: string;
2836
2841
  placeholder?: string;
2837
2842
  }
2843
+ type NotificationType = "danger" | "info" | "success" | "warning";
2838
2844
  interface InformationNotification {
2839
2845
  text: string;
2840
- tag: string;
2846
+ type: NotificationType;
2847
+ sticky: boolean;
2841
2848
  }
2842
2849
  interface SpreadsheetEnv {
2843
2850
  notifyUser: (notification: InformationNotification) => any;
@@ -6693,7 +6700,7 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
6693
6700
  onCompositionEnd(): void;
6694
6701
  onKeydown(ev: KeyboardEvent): void;
6695
6702
  onInput(ev: InputEvent): void;
6696
- onKeyup(): void;
6703
+ onKeyup(ev: KeyboardEvent): void;
6697
6704
  showAutocomplete(searchTerm: string): void;
6698
6705
  /**
6699
6706
  * This is required to ensure the content helper selection is
@@ -6863,7 +6870,6 @@ declare class Spreadsheet extends Component<SpreadsheetProps, SpreadsheetChildEn
6863
6870
  private bindModelEvents;
6864
6871
  private unbindModelEvents;
6865
6872
  private checkViewportSize;
6866
- private onNotifyUI;
6867
6873
  openSidePanel(panel: string, panelProps: any): void;
6868
6874
  closeSidePanel(): void;
6869
6875
  toggleSidePanel(panel: string, panelProps: any): void;
@@ -7184,7 +7190,7 @@ declare function chartFontColor(backgroundColor: Color | undefined): Color;
7184
7190
  /**
7185
7191
  * Get a default chart js configuration
7186
7192
  */
7187
- declare function getDefaultChartJsRuntime(chart: AbstractChart, labels: string[], fontColor: Color, { format, locale }: LocaleFormat): ChartConfiguration;
7193
+ declare function getDefaultChartJsRuntime(chart: AbstractChart, labels: string[], fontColor: Color, { format, locale }: LocaleFormat): Required<ChartConfiguration>;
7188
7194
  /** See https://www.chartjs.org/docs/latest/charts/area.html#filling-modes */
7189
7195
  declare function getFillingMode(index: number): "origin" | number;
7190
7196