@odoo/o-spreadsheet 19.1.3 → 19.1.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.
@@ -431,7 +431,7 @@ declare class CellPlugin extends CorePlugin<CoreState$1> implements CoreState$1
431
431
  [id: string]: Cell;
432
432
  };
433
433
  };
434
- adaptRanges(applyChange: ApplyRangeChange, sheetId: UID, sheetName: AdaptSheetName): void;
434
+ adaptRanges({ applyChange }: RangeAdapterFunctions, sheetId: UID, sheetName: AdaptSheetName): void;
435
435
  allowDispatch(cmd: CoreCommand): CommandResult | CommandResult[];
436
436
  handle(cmd: CoreCommand): void;
437
437
  private clearZones;
@@ -561,7 +561,7 @@ declare abstract class AbstractChart {
561
561
  * This function should be used to update all the ranges of the chart after
562
562
  * a grid change (add/remove col/row, rename sheet, ...)
563
563
  */
564
- abstract updateRanges(applyChange: ApplyRangeChange, sheetId: UID, adaptSheetName: AdaptSheetName): AbstractChart;
564
+ abstract updateRanges(rangeAdapters: RangeAdapterFunctions): AbstractChart;
565
565
  /**
566
566
  * Duplicate the chart when a sheet is duplicated.
567
567
  * The ranges that are in the same sheet as the chart are adapted to the new sheetId.
@@ -594,7 +594,7 @@ declare class ChartPlugin extends CorePlugin<ChartState> implements ChartState {
594
594
  readonly charts: Record<UID, FigureChart | undefined>;
595
595
  private createChart;
596
596
  private validateChartDefinition;
597
- adaptRanges(applyChange: ApplyRangeChange, sheetId: UID, adaptSheetName: AdaptSheetName): void;
597
+ adaptRanges(rangeAdapters: RangeAdapterFunctions): void;
598
598
  allowDispatch(cmd: Command): CommandResult | CommandResult[];
599
599
  handle(cmd: CoreCommand): void;
600
600
  getContextCreationChart(chartId: UID): ChartCreationContext | undefined;
@@ -701,9 +701,9 @@ declare class ConditionalFormatPlugin extends CorePlugin<ConditionalFormatState>
701
701
  readonly cfRules: {
702
702
  [sheet: string]: ConditionalFormatInternal[];
703
703
  };
704
- adaptCFFormulas(applyChange: ApplyRangeChange): void;
705
- adaptCFRanges(sheetId: UID, applyChange: ApplyRangeChange): void;
706
- adaptRanges(applyChange: ApplyRangeChange, sheetId: UID): void;
704
+ adaptCFFormulas({ applyChange, adaptFormulaString }: RangeAdapterFunctions): void;
705
+ adaptCFRanges(sheetId: UID, { applyChange }: RangeAdapterFunctions): void;
706
+ adaptRanges(rangeAdapters: RangeAdapterFunctions, sheetId: UID): void;
707
707
  allowDispatch(cmd: Command): CommandResult | CommandResult[];
708
708
  handle(cmd: CoreCommand): void;
709
709
  import(data: WorkbookData): void;
@@ -872,7 +872,7 @@ declare class DataValidationPlugin extends CorePlugin<DataValidationState> imple
872
872
  readonly rules: {
873
873
  [sheet: string]: DataValidationRule[];
874
874
  };
875
- adaptRanges(applyChange: ApplyRangeChange, sheetId: UID): void;
875
+ adaptRanges(rangeAdapters: RangeAdapterFunctions, sheetId: UID): void;
876
876
  private adaptDVFormulas;
877
877
  private adaptDVRanges;
878
878
  allowDispatch(cmd: Command): CommandResult | CommandResult[];
@@ -907,7 +907,7 @@ declare class FigurePlugin extends CorePlugin<FigureState> implements FigureStat
907
907
  [sheet: string]: Record<UID, Figure | undefined> | undefined;
908
908
  };
909
909
  readonly insertionOrders: UID[];
910
- adaptRanges(applyChange: ApplyRangeChange, sheetId: UID): void;
910
+ adaptRanges({ applyChange }: RangeAdapterFunctions, sheetId: UID): void;
911
911
  allowDispatch(cmd: CoreCommand): CommandResult | CommandResult[];
912
912
  beforeHandle(cmd: CoreCommand): void;
913
913
  handle(cmd: CoreCommand): void;
@@ -1124,7 +1124,7 @@ declare class MergePlugin extends CorePlugin<MergeState> implements MergeState {
1124
1124
  readonly mergeCellMap: Record<UID, SheetMergeCellMap | undefined>;
1125
1125
  allowDispatch(cmd: CoreCommand): CommandResult | CommandResult[];
1126
1126
  handle(cmd: CoreCommand): void;
1127
- adaptRanges(applyChange: ApplyRangeChange, sheetId: UID): void;
1127
+ adaptRanges(rangeAdapters: RangeAdapterFunctions, sheetId: UID): void;
1128
1128
  getMerges(sheetId: UID): Merge[];
1129
1129
  getMerge({ sheetId, col, row }: CellPosition): Merge | undefined;
1130
1130
  getMergesInZone(sheetId: UID, zone: Zone): Merge[];
@@ -1375,7 +1375,7 @@ declare class PivotCorePlugin extends CorePlugin<CoreState> implements CoreState
1375
1375
  readonly compiledMeasureFormulas: Record<UID, Record<string, MeasureState>>;
1376
1376
  allowDispatch(cmd: CoreCommand): CommandResult | CommandResult[];
1377
1377
  handle(cmd: CoreCommand): void;
1378
- adaptRanges(applyChange: ApplyRangeChange): void;
1378
+ adaptRanges({ applyChange, adaptFormulaString }: RangeAdapterFunctions): void;
1379
1379
  getPivotDisplayName(pivotId: UID): string;
1380
1380
  getPivotName(pivotId: UID): string;
1381
1381
  /**
@@ -1414,12 +1414,12 @@ declare class PivotCorePlugin extends CorePlugin<CoreState> implements CoreState
1414
1414
  export(data: WorkbookData): void;
1415
1415
  }
1416
1416
 
1417
- declare class RangeAdapter$1 implements CommandHandler<CoreCommand> {
1417
+ declare class RangeAdapterPlugin implements CommandHandler<CoreCommand> {
1418
1418
  private getters;
1419
1419
  private providers;
1420
1420
  private isAdaptingRanges;
1421
1421
  constructor(getters: CoreGetters);
1422
- static getters: readonly ["adaptFormulaStringDependencies", "copyFormulaStringForSheet", "extendRange", "getRangeString", "getRangeFromSheetXC", "createAdaptedRanges", "getRangeData", "getRangeDataFromXc", "getRangeDataFromZone", "getRangeFromRangeData", "getRangeFromZone", "getRangesUnion", "recomputeRanges", "isRangeValid", "removeRangesSheetPrefix"];
1422
+ static getters: readonly ["copyFormulaStringForSheet", "extendRange", "getRangeString", "getRangeFromSheetXC", "createAdaptedRanges", "getRangeData", "getRangeDataFromXc", "getRangeDataFromZone", "getRangeFromRangeData", "getRangeFromZone", "getRangesUnion", "recomputeRanges", "isRangeValid", "removeRangesSheetPrefix"];
1423
1423
  allowDispatch(cmd: CoreCommand): CommandResult;
1424
1424
  beforeHandle(command: Command): void;
1425
1425
  handle(cmd: CoreCommand): void;
@@ -1476,7 +1476,6 @@ declare class RangeAdapter$1 implements CommandHandler<CoreCommand> {
1476
1476
  getRangeFromRangeData(data: RangeData): Range;
1477
1477
  isRangeValid(rangeStr: string): boolean;
1478
1478
  getRangesUnion(ranges: Range[]): Range;
1479
- adaptFormulaStringDependencies(sheetId: UID, formula: string, applyChange: ApplyRangeChange): string;
1480
1479
  /**
1481
1480
  * Copy a formula string to another sheet.
1482
1481
  *
@@ -1657,7 +1656,7 @@ declare class StylePlugin extends CorePlugin<StylePluginState> implements StyleP
1657
1656
  readonly styles: Record<UID, ZoneStyle[] | undefined>;
1658
1657
  allowDispatch(cmd: CoreCommand): CommandResult | CommandResult[];
1659
1658
  handle(cmd: CoreCommand): void;
1660
- adaptRanges(applyChange: ApplyRangeChange, sheetId: UID): void;
1659
+ adaptRanges({ applyChange }: RangeAdapterFunctions, sheetId: UID): void;
1661
1660
  private handleAddColumnn;
1662
1661
  private handleAddRows;
1663
1662
  private styleIsDefault;
@@ -1684,7 +1683,7 @@ declare class TablePlugin extends CorePlugin<TableState> implements TableState {
1684
1683
  static getters: readonly ["getCoreTable", "getCoreTables", "getCoreTableMatchingTopLeft"];
1685
1684
  readonly tables: Record<UID, Record<TableId, CoreTable | undefined>>;
1686
1685
  readonly nextTableId: number;
1687
- adaptRanges(applyChange: ApplyRangeChange, sheetId: UID): void;
1686
+ adaptRanges({ applyChange }: RangeAdapterFunctions, sheetId: UID): void;
1688
1687
  allowDispatch(cmd: CoreCommand): CommandResult | CommandResult[];
1689
1688
  handle(cmd: CoreCommand): void;
1690
1689
  getCoreTables(sheetId: UID): CoreTable[];
@@ -1784,7 +1783,7 @@ type PluginGetters<Plugin extends {
1784
1783
  new (...args: unknown[]): any;
1785
1784
  getters: readonly string[];
1786
1785
  }> = Pick<InstanceType<Plugin>, GetterNames<Plugin>>;
1787
- type RangeAdapterGetters = Pick<RangeAdapter$1, GetterNames<typeof RangeAdapter$1>>;
1786
+ type RangeAdapterGetters = Pick<RangeAdapterPlugin, GetterNames<typeof RangeAdapterPlugin>>;
1788
1787
  type CoreGetters = PluginGetters<typeof SheetPlugin> & PluginGetters<typeof HeaderSizePlugin> & PluginGetters<typeof HeaderVisibilityPlugin> & PluginGetters<typeof CellPlugin> & PluginGetters<typeof StylePlugin> & PluginGetters<typeof MergePlugin> & PluginGetters<typeof BordersPlugin> & PluginGetters<typeof ChartPlugin> & PluginGetters<typeof ImagePlugin> & PluginGetters<typeof CarouselPlugin> & PluginGetters<typeof FigurePlugin> & RangeAdapterGetters & PluginGetters<typeof ConditionalFormatPlugin> & PluginGetters<typeof TablePlugin> & PluginGetters<typeof SettingsPlugin> & PluginGetters<typeof HeaderGroupingPlugin> & PluginGetters<typeof DataValidationPlugin> & PluginGetters<typeof PivotCorePlugin>;
1789
1788
 
1790
1789
  type VerticalAxisPosition = "left" | "right";
@@ -2073,7 +2072,7 @@ declare class BasePlugin<State = any, C = any> implements CommandHandler<C>, Val
2073
2072
  interface CorePluginConfig {
2074
2073
  readonly getters: CoreGetters;
2075
2074
  readonly stateObserver: StateObserver;
2076
- readonly range: RangeAdapter$1;
2075
+ readonly range: RangeAdapterPlugin;
2077
2076
  readonly dispatch: CoreCommandDispatcher["dispatch"];
2078
2077
  readonly canDispatch: CoreCommandDispatcher["dispatch"];
2079
2078
  readonly custom: ModelConfig["custom"];
@@ -2103,7 +2102,7 @@ declare class CorePlugin<State = any> extends BasePlugin<State, CoreCommand> imp
2103
2102
  * @param sheetId an sheetId to adapt either range of that sheet specifically, or ranges pointing to that sheet
2104
2103
  * @param sheetName couple of old and new sheet names to adapt ranges pointing to that sheet
2105
2104
  */
2106
- adaptRanges(applyChange: ApplyRangeChange, sheetId: UID, sheetName: AdaptSheetName): void;
2105
+ adaptRanges(rangeAdapterFunctions: RangeAdapterFunctions, sheetId: UID, sheetName: AdaptSheetName): void;
2107
2106
  }
2108
2107
 
2109
2108
  type ZoneBorderData = {
@@ -2127,7 +2126,7 @@ declare class BordersPlugin extends CorePlugin<BordersPluginState> implements Bo
2127
2126
  allowDispatch(cmd: CoreCommand): CommandResult | CommandResult[];
2128
2127
  handle(cmd: CoreCommand): void;
2129
2128
  beforeHandle(cmd: CoreCommand): void;
2130
- adaptRanges(applyChange: ApplyRangeChange, sheetId: UID): void;
2129
+ adaptRanges({ applyChange }: RangeAdapterFunctions, sheetId: UID): void;
2131
2130
  private onRowRemove;
2132
2131
  private onColRemove;
2133
2132
  getCellBorder(position: CellPosition): Border;
@@ -6348,13 +6347,15 @@ declare const enum DIRECTION {
6348
6347
  RIGHT = "right"
6349
6348
  }
6350
6349
  type ChangeType = "REMOVE" | "RESIZE" | "MOVE" | "CHANGE" | "NONE";
6351
- type ApplyRangeChangeResult = {
6352
- changeType: Exclude<ChangeType, "NONE">;
6353
- range: Range;
6354
- } | {
6355
- changeType: "NONE";
6350
+ type ApplyRangeChangeResult<T> = {
6351
+ changeType: ChangeType;
6352
+ range: T;
6353
+ };
6354
+ type ApplyFormulaRangeChangeResult = {
6355
+ changeType: ChangeType;
6356
+ formula: string;
6356
6357
  };
6357
- type ApplyRangeChange = (range: Range) => ApplyRangeChangeResult;
6358
+ type ApplyRangeChange = (range: Range) => ApplyRangeChangeResult<Range>;
6358
6359
  type AdaptSheetName = {
6359
6360
  old: string;
6360
6361
  current: string;
@@ -6364,10 +6365,15 @@ type RangeAdapter = {
6364
6365
  sheetName: AdaptSheetName;
6365
6366
  applyChange: ApplyRangeChange;
6366
6367
  };
6368
+ type RangeAdapterFunctions = {
6369
+ applyChange: ApplyRangeChange;
6370
+ adaptRangeString: (defaultSheetId: UID, sheetXC: string) => ApplyRangeChangeResult<string>;
6371
+ adaptFormulaString: (defaultSheetId: UID, formula: string) => string;
6372
+ };
6367
6373
  type Dimension = "COL" | "ROW";
6368
6374
  type ConsecutiveIndexes = HeaderIndex[];
6369
6375
  interface RangeProvider {
6370
- adaptRanges: (applyChange: ApplyRangeChange, sheetId: UID, sheetName: AdaptSheetName) => void;
6376
+ adaptRanges: (adapterFunctions: RangeAdapterFunctions, sheetId: UID, sheetName: AdaptSheetName) => void;
6371
6377
  }
6372
6378
  type Validation<T> = (toValidate: T) => CommandResult | CommandResult[];
6373
6379
  type Increment = 1 | -1 | 0;
@@ -6722,4 +6728,4 @@ declare class NumberTooLargeError extends EvaluationError {
6722
6728
 
6723
6729
  declare const __info__: {};
6724
6730
 
6725
- export { AST, ASTFuncall, ASTOperation, ASTString, ASTSymbol, ASTUnaryOperation, AdaptSheetName, AdjacentEdge, Alias, Align, AnchorZone, ApplyRangeChange, ApplyRangeChangeResult, Arg, BadExpressionError, BasePlugin, Border, BorderData, BorderDescr, BorderDescrWithOpacity, BorderPosition, BorderStyle, Box, BoxTextContent, CSSProperties, CellErrorType, CellPosition, CellValue, ChangeType, CircularDependencyError, ClipboardCell, Cloneable, Color, CompiledFormula, ComposerFocusType, ConsecutiveIndexes, CoreGetters, CreateRevisionOptions, DEFAULT_LOCALE, DEFAULT_LOCALES, DIRECTION, DOMCoordinates, DOMDimension, DataBarFill, DebouncedFunction, Dimension, Direction, DivisionByZeroError, EdgeScrollInfo, EditionMode, EnsureRange, ErrorValue, EvaluationError, FilterId, Format, FormulaToExecute, FunctionCode, FunctionCodeBuilder, FunctionRegistry, FunctionResultNumber, FunctionResultObject, GetSymbolValue, GlobalChart, GridClickModifiers, GridRenderingContext, HSLA, HeaderDimensions, HeaderGroup, HeaderIndex, Highlight, HistoryChange, Image, Immutable, Increment, InvalidReferenceError, LayerName, Lazy, Link, Locale, LocaleCode, Matrix, Maybe, MenuMouseEvent, Merge, Model, NotAvailableError, NumberTooLargeError, OPERATOR_MAP, OP_PRIORITY, Offset, OperationSequenceNode, OrderedLayers, POSTFIX_UNARY_OPERATORS, PaneDivision, Pixel, PixelPosition, PluginGetters, Position, RGBA, RangeAdapter, RangeCompiledFormula, RangeProvider, Rect, Ref, ReferenceDenormalizer, Registry, RenderingBorder, RenderingBox, RenderingGridIcon, Row, Scope, ScrollDirection, Selection, SelectionStep, SetDecimalStep, Sheet, SheetDOMScrollInfo, SortDirection, SortOptions, SplillBlockedError, SpreadsheetClipboardData, StateObserver, Style, TableId, Token, TokenizingChars, Transformation, TransformationFactory, TranslationFunction, UID, UNARY_OPERATOR_MAP, UnboundedZone, UnknownFunctionError, UpdateCellData, UuidGenerator, Validation, Validator, ValueAndLabel, VerticalAlign, Viewport, WorkbookHistory, Wrapping, Zone, ZoneDimension, __info__, _t, addRenderingLayer, batched, borderStyles, buildSheetLink, categories, cellReference, chartStyleToCellStyle, clip, compile, compileTokens, concat, convertAstNodes, createEmptyStructure, debounce, deepCopy, deepEquals, deepEqualsArray, errorTypes, escapeRegExp, findNextDefinedValue, functionCache, getAddHeaderStartIndex, getCanonicalSymbolName, getFormulaNumberRegex, getFullReference, getSearchRegex, getUniqueText, getUnquotedSheetName, groupConsecutive, includesAll, insertItemsAtIndex, isBoolean, isColHeader, isColReference, isConsecutive, isDefined, isFormula, isMarkdownLink, isMatrix, isNotNull, isNumber, isNumberBetween, isObjectEmptyRecursive, isRowHeader, isRowReference, isSheetUrl, isSingleCellReference, isWebLink, iterateAstNodes, largeMax, largeMin, lazy, linkNext, loopThroughReferenceType, mapAst, markdownLink, memoize, parse, parseMarkdownLink, parseNumber, parseSheetUrl, parseTokens, percentile, range, rangeReference, rangeTokenize, removeDuplicates, removeFalsyAttributes, removeIndexesFromArray, replaceItemAtIndex, replaceNewLines, sanitizeSheetName, setDefaultTranslationMethod, setTranslationMethod, setXcToFixedReferenceType, specialWhiteSpaceRegexp, splitReference, tokenize, transpose2dPOJO, trimContent, unquote, whiteSpaceCharacters };
6731
+ export { AST, ASTFuncall, ASTOperation, ASTString, ASTSymbol, ASTUnaryOperation, AdaptSheetName, AdjacentEdge, Alias, Align, AnchorZone, ApplyFormulaRangeChangeResult, ApplyRangeChange, ApplyRangeChangeResult, Arg, BadExpressionError, BasePlugin, Border, BorderData, BorderDescr, BorderDescrWithOpacity, BorderPosition, BorderStyle, Box, BoxTextContent, CSSProperties, CellErrorType, CellPosition, CellValue, ChangeType, CircularDependencyError, ClipboardCell, Cloneable, Color, CompiledFormula, ComposerFocusType, ConsecutiveIndexes, CoreGetters, CreateRevisionOptions, DEFAULT_LOCALE, DEFAULT_LOCALES, DIRECTION, DOMCoordinates, DOMDimension, DataBarFill, DebouncedFunction, Dimension, Direction, DivisionByZeroError, EdgeScrollInfo, EditionMode, EnsureRange, ErrorValue, EvaluationError, FilterId, Format, FormulaToExecute, FunctionCode, FunctionCodeBuilder, FunctionRegistry, FunctionResultNumber, FunctionResultObject, GetSymbolValue, GlobalChart, GridClickModifiers, GridRenderingContext, HSLA, HeaderDimensions, HeaderGroup, HeaderIndex, Highlight, HistoryChange, Image, Immutable, Increment, InvalidReferenceError, LayerName, Lazy, Link, Locale, LocaleCode, Matrix, Maybe, MenuMouseEvent, Merge, Model, NotAvailableError, NumberTooLargeError, OPERATOR_MAP, OP_PRIORITY, Offset, OperationSequenceNode, OrderedLayers, POSTFIX_UNARY_OPERATORS, PaneDivision, Pixel, PixelPosition, PluginGetters, Position, RGBA, RangeAdapter, RangeAdapterFunctions, RangeCompiledFormula, RangeProvider, Rect, Ref, ReferenceDenormalizer, Registry, RenderingBorder, RenderingBox, RenderingGridIcon, Row, Scope, ScrollDirection, Selection, SelectionStep, SetDecimalStep, Sheet, SheetDOMScrollInfo, SortDirection, SortOptions, SplillBlockedError, SpreadsheetClipboardData, StateObserver, Style, TableId, Token, TokenizingChars, Transformation, TransformationFactory, TranslationFunction, UID, UNARY_OPERATOR_MAP, UnboundedZone, UnknownFunctionError, UpdateCellData, UuidGenerator, Validation, Validator, ValueAndLabel, VerticalAlign, Viewport, WorkbookHistory, Wrapping, Zone, ZoneDimension, __info__, _t, addRenderingLayer, batched, borderStyles, buildSheetLink, categories, cellReference, chartStyleToCellStyle, clip, compile, compileTokens, concat, convertAstNodes, createEmptyStructure, debounce, deepCopy, deepEquals, deepEqualsArray, errorTypes, escapeRegExp, findNextDefinedValue, functionCache, getAddHeaderStartIndex, getCanonicalSymbolName, getFormulaNumberRegex, getFullReference, getSearchRegex, getUniqueText, getUnquotedSheetName, groupConsecutive, includesAll, insertItemsAtIndex, isBoolean, isColHeader, isColReference, isConsecutive, isDefined, isFormula, isMarkdownLink, isMatrix, isNotNull, isNumber, isNumberBetween, isObjectEmptyRecursive, isRowHeader, isRowReference, isSheetUrl, isSingleCellReference, isWebLink, iterateAstNodes, largeMax, largeMin, lazy, linkNext, loopThroughReferenceType, mapAst, markdownLink, memoize, parse, parseMarkdownLink, parseNumber, parseSheetUrl, parseTokens, percentile, range, rangeReference, rangeTokenize, removeDuplicates, removeFalsyAttributes, removeIndexesFromArray, replaceItemAtIndex, replaceNewLines, sanitizeSheetName, setDefaultTranslationMethod, setTranslationMethod, setXcToFixedReferenceType, specialWhiteSpaceRegexp, splitReference, tokenize, transpose2dPOJO, trimContent, unquote, whiteSpaceCharacters };