@odoo/o-spreadsheet 17.1.0 → 17.1.2

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.
@@ -2,17 +2,6 @@ import * as _odoo_owl from '@odoo/owl';
2
2
  import { ComponentConstructor, Component } from '@odoo/owl';
3
3
  import { ChartConfiguration, ChartData, ChartDataset, ChartOptions } from 'chart.js';
4
4
 
5
- declare enum CellErrorLevel {
6
- silent = 0,
7
- error = 1
8
- }
9
- declare class EvaluationError extends Error {
10
- readonly errorType: string;
11
- readonly logLevel: number;
12
- constructor(errorType: string, message: string, logLevel?: number);
13
- get isVerbose(): boolean;
14
- }
15
-
16
5
  declare const functionCache: {
17
6
  [key: string]: Omit<CompiledFormula, "dependencies" | "tokens">;
18
7
  };
@@ -2459,7 +2448,8 @@ declare const enum CommandResult {
2459
2448
  InvalidNumberOfCriterionValues = "InvalidNumberOfCriterionValues",
2460
2449
  BlockingValidationRule = "BlockingValidationRule",
2461
2450
  InvalidCopyPasteSelection = "InvalidCopyPasteSelection",
2462
- NoChanges = "NoChanges"
2451
+ NoChanges = "NoChanges",
2452
+ InvalidInputId = "InvalidInputId"
2463
2453
  }
2464
2454
  interface CommandHandler<T> {
2465
2455
  allowDispatch(command: T): CommandResult | CommandResult[];
@@ -2606,9 +2596,9 @@ interface Border$1 {
2606
2596
  bottom?: BorderDescr;
2607
2597
  right?: BorderDescr;
2608
2598
  }
2609
- type ReferenceDenormalizer = (range: Range, isMeta: boolean, functionName: string, paramNumber: number) => any | any[][];
2610
- type EnsureRange = (range: Range) => Matrix<ValueAndFormat>;
2611
- type _CompiledFormula = (deps: Range[], refFn: ReferenceDenormalizer, range: EnsureRange, ctx: {}) => Matrix<ValueAndFormat> | ValueAndFormat;
2599
+ type ReferenceDenormalizer = (range: Range, isMeta: boolean, functionName: string, paramNumber: number) => FPayload;
2600
+ type EnsureRange = (range: Range) => Matrix<FPayload>;
2601
+ type _CompiledFormula = (deps: Range[], refFn: ReferenceDenormalizer, range: EnsureRange, ctx: {}) => Matrix<FPayload> | FPayload;
2612
2602
  interface CompiledFormula {
2613
2603
  execute: _CompiledFormula;
2614
2604
  tokens: Token[];
@@ -2618,12 +2608,12 @@ interface RangeCompiledFormula extends Omit<CompiledFormula, "dependencies"> {
2618
2608
  dependencies: Range[];
2619
2609
  }
2620
2610
  type Matrix<T = unknown> = T[][];
2621
- type ValueAndFormat = {
2611
+ type FPayload = {
2622
2612
  value: CellValue;
2623
2613
  format?: Format;
2614
+ message?: string;
2624
2615
  };
2625
- type Arg = Maybe<ValueAndFormat> | Matrix<ValueAndFormat>;
2626
- type ArgValue = Maybe<CellValue> | Matrix<CellValue>;
2616
+ type Arg = Maybe<FPayload> | Matrix<FPayload>;
2627
2617
  declare function isMatrix(x: any): x is Matrix<any>;
2628
2618
  interface HeaderDimensions {
2629
2619
  start: Pixel;
@@ -2806,7 +2796,7 @@ interface EmptyCell extends EvaluatedCellProperties {
2806
2796
  interface ErrorCell extends EvaluatedCellProperties {
2807
2797
  readonly type: CellValueType.error;
2808
2798
  readonly value: string;
2809
- readonly error: EvaluationError;
2799
+ readonly message?: string;
2810
2800
  }
2811
2801
  declare enum CellValueType {
2812
2802
  boolean = "boolean",
@@ -4559,14 +4549,13 @@ interface RangeInputValue {
4559
4549
  * This plugin handles this internal state.
4560
4550
  */
4561
4551
  declare class SelectionInputPlugin extends UIPlugin implements StreamCallbacks<SelectionEvent> {
4562
- private readonly inputHasSingleRange;
4552
+ readonly inputHasSingleRange: boolean;
4563
4553
  static layers: LAYERS[];
4564
4554
  static getters: never[];
4565
4555
  ranges: RangeInputValue[];
4566
4556
  focusedRangeIndex: number | null;
4567
4557
  private inputSheetId;
4568
4558
  constructor(config: UIPluginConfig, initialRanges: string[], inputHasSingleRange: boolean);
4569
- allowDispatch(cmd: LocalCommand): CommandResult;
4570
4559
  handleEvent(event: SelectionEvent): void;
4571
4560
  handle(cmd: Command): void;
4572
4561
  getSelectionInputValue(): string[];
@@ -5192,16 +5181,15 @@ type ArgType = "ANY" | "BOOLEAN" | "NUMBER" | "STRING" | "DATE" | "RANGE" | "RAN
5192
5181
  interface ArgDefinition {
5193
5182
  repeating?: boolean;
5194
5183
  optional?: boolean;
5195
- lazy?: boolean;
5196
5184
  description: string;
5197
5185
  name: string;
5198
5186
  type: ArgType[];
5199
5187
  default?: boolean;
5200
5188
  defaultValue?: any;
5201
5189
  }
5202
- type ComputeFunctionArg<T> = T | (() => T);
5203
- type ComputeFunction<T, R> = (this: EvalContext, ...args: ComputeFunctionArg<T>[]) => R;
5204
- interface AddFunctionDescriptionBase {
5190
+ type ComputeFunction<R> = (this: EvalContext, ...args: Arg[]) => R;
5191
+ interface AddFunctionDescription {
5192
+ compute: ComputeFunction<FPayload | Matrix<FPayload> | CellValue | Matrix<CellValue>>;
5205
5193
  description: string;
5206
5194
  category?: string;
5207
5195
  args: ArgDefinition[];
@@ -5209,16 +5197,6 @@ interface AddFunctionDescriptionBase {
5209
5197
  isExported?: boolean;
5210
5198
  hidden?: boolean;
5211
5199
  }
5212
- interface ComputeValue {
5213
- compute: ComputeFunction<ArgValue, CellValue | Matrix<CellValue>>;
5214
- }
5215
- interface ComputeFormat {
5216
- computeFormat: ComputeFunction<Arg, Format | undefined | Matrix<Format | undefined>>;
5217
- }
5218
- interface ComputeValueAndFormat {
5219
- computeValueAndFormat: ComputeFunction<Arg, Matrix<ValueAndFormat> | ValueAndFormat>;
5220
- }
5221
- type AddFunctionDescription = (AddFunctionDescriptionBase & ComputeValue & Partial<ComputeFormat>) | (AddFunctionDescriptionBase & ComputeValueAndFormat);
5222
5200
  type FunctionDescription = AddFunctionDescription & {
5223
5201
  minArgRequired: number;
5224
5202
  maxArgPossible: number;
@@ -5226,7 +5204,6 @@ type FunctionDescription = AddFunctionDescription & {
5226
5204
  getArgToFocus: (argPosition: number) => number;
5227
5205
  };
5228
5206
  type EvalContext = {
5229
- __lastFnCalled?: string;
5230
5207
  __originSheetId: UID;
5231
5208
  __originCellXC: () => string | undefined;
5232
5209
  locale: Locale;
@@ -5601,7 +5578,7 @@ interface Props$L {
5601
5578
  name: string;
5602
5579
  label: string;
5603
5580
  value: boolean;
5604
- update: (value: boolean) => void;
5581
+ onChange: (value: boolean) => void;
5605
5582
  }>;
5606
5583
  }
5607
5584
  declare class ChartLabelRange extends Component<Props$L, SpreadsheetChildEnv> {
@@ -8494,10 +8471,11 @@ declare class ChartPanel extends Component<Props, SpreadsheetChildEnv> {
8494
8471
  activatePanel(panel: "configuration" | "design"): void;
8495
8472
  }
8496
8473
 
8497
- declare function toNumber(value: string | number | boolean | null | undefined, locale: Locale): number;
8498
- declare function toString(value: string | number | boolean | null | undefined): string;
8499
- declare function toBoolean(value: string | number | boolean | null | undefined): boolean;
8500
- declare function toJsDate(value: string | number | boolean | null | undefined, locale: Locale): DateTime;
8474
+ declare function isEvaluationError(error: Maybe<CellValue>): boolean;
8475
+ declare function toNumber(data: FPayload | CellValue | undefined, locale: Locale): number;
8476
+ declare function toString(data: FPayload | CellValue | undefined): string;
8477
+ declare function toBoolean(data: FPayload | CellValue | undefined): boolean;
8478
+ declare function toJsDate(data: FPayload | CellValue | undefined, locale: Locale): DateTime;
8501
8479
 
8502
8480
  declare function arg(definition: string, description?: string): ArgDefinition;
8503
8481
 
@@ -8543,6 +8521,19 @@ type TranslationFunction = (string: string, ...values: SprintfValues) => string;
8543
8521
  */
8544
8522
  declare function setTranslationMethod(tfn: TranslationFunction, loaded?: () => boolean): void;
8545
8523
 
8524
+ declare const CellErrorType: {
8525
+ readonly NotAvailable: "#N/A";
8526
+ readonly InvalidReference: "#REF";
8527
+ readonly BadExpression: "#BAD_EXPR";
8528
+ readonly CircularDependency: "#CYCLE";
8529
+ readonly UnknownFunction: "#NAME?";
8530
+ readonly GenericError: "#ERROR";
8531
+ };
8532
+ declare class EvaluationError extends Error {
8533
+ readonly value: string;
8534
+ constructor(message?: string, value?: string);
8535
+ }
8536
+
8546
8537
  /**
8547
8538
  * We export here all entities that needs to be accessed publicly by Odoo.
8548
8539
  *
@@ -8567,10 +8558,11 @@ declare const registries: {
8567
8558
  autofillRulesRegistry: Registry<AutofillRule>;
8568
8559
  cellMenuRegistry: MenuItemRegistry;
8569
8560
  colMenuRegistry: MenuItemRegistry;
8561
+ errorTypes: Set<string>;
8570
8562
  linkMenuRegistry: MenuItemRegistry;
8571
8563
  functionRegistry: {
8572
8564
  mapping: {
8573
- [key: string]: ComputeFunction<Arg, ValueAndFormat | Matrix<ValueAndFormat>>;
8565
+ [key: string]: ComputeFunction<FPayload | Matrix<FPayload>>;
8574
8566
  };
8575
8567
  add(name: string, addDescr: AddFunctionDescription): any;
8576
8568
  content: {
@@ -8619,6 +8611,7 @@ declare const registries: {
8619
8611
  };
8620
8612
  declare const helpers: {
8621
8613
  arg: typeof arg;
8614
+ isEvaluationError: typeof isEvaluationError;
8622
8615
  toBoolean: typeof toBoolean;
8623
8616
  toJsDate: typeof toJsDate;
8624
8617
  toNumber: typeof toNumber;
@@ -8639,8 +8632,6 @@ declare const helpers: {
8639
8632
  getDefaultChartJsRuntime: typeof getDefaultChartJsRuntime;
8640
8633
  chartFontColor: typeof chartFontColor;
8641
8634
  ChartColors: typeof ChartColors;
8642
- EvaluationError: typeof EvaluationError;
8643
- CellErrorLevel: typeof CellErrorLevel;
8644
8635
  getFillingMode: typeof getFillingMode;
8645
8636
  rgbaToHex: typeof rgbaToHex;
8646
8637
  colorToRGBA: typeof colorToRGBA;
@@ -8661,6 +8652,13 @@ declare const links: {
8661
8652
  urlRepresentation: typeof urlRepresentation;
8662
8653
  };
8663
8654
  declare const components: {
8655
+ Checkbox: typeof Checkbox;
8656
+ Section: typeof Section;
8657
+ ChartColor: typeof ChartColor;
8658
+ ChartDataSeries: typeof ChartDataSeries;
8659
+ ChartErrorSection: typeof ChartErrorSection;
8660
+ ChartLabelRange: typeof ChartLabelRange;
8661
+ ChartTitle: typeof ChartTitle;
8664
8662
  ChartPanel: typeof ChartPanel;
8665
8663
  ChartFigure: typeof ChartFigure;
8666
8664
  ChartJsComponent: typeof ChartJsComponent;
@@ -8690,4 +8688,4 @@ declare const constants: {
8690
8688
  DEFAULT_LOCALE: Locale;
8691
8689
  };
8692
8690
 
8693
- export { AbstractChart, CancelledReason, Client, ClientJoinedMessage, ClientLeftMessage, ClientMovedMessage, CollaborationMessage, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, RemoteRevisionMessage, Revision, RevisionRedoneMessage, RevisionUndoneMessage, SPREADSHEET_DIMENSIONS, Spreadsheet, TransportService, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
8691
+ export { AbstractChart, CancelledReason, CellErrorType, Client, ClientJoinedMessage, ClientLeftMessage, ClientMovedMessage, CollaborationMessage, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, RemoteRevisionMessage, Revision, RevisionRedoneMessage, RevisionUndoneMessage, SPREADSHEET_DIMENSIONS, Spreadsheet, TransportService, UIPlugin, __info__, addFunction, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };