@odoo/o-spreadsheet 16.4.0-alpha.5 → 16.4.0-alpha.7

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.
@@ -40,12 +40,12 @@ interface EnrichedToken extends Token {
40
40
  functionContext?: FunctionContext;
41
41
  }
42
42
 
43
- type TokenType = "OPERATOR" | "NUMBER" | "STRING" | "BOOLEAN" | "FUNCTION" | "SYMBOL" | "SPACE" | "DEBUGGER" | "COMMA" | "LEFT_PAREN" | "RIGHT_PAREN" | "REFERENCE" | "INVALID_REFERENCE" | "UNKNOWN";
43
+ type TokenType = "OPERATOR" | "NUMBER" | "STRING" | "SYMBOL" | "SPACE" | "DEBUGGER" | "ARG_SEPARATOR" | "LEFT_PAREN" | "RIGHT_PAREN" | "REFERENCE" | "INVALID_REFERENCE" | "UNKNOWN";
44
44
  interface Token {
45
45
  type: TokenType;
46
46
  value: string;
47
47
  }
48
- declare function tokenize(str: string): Token[];
48
+ declare function tokenize(str: string, locale?: Locale): Token[];
49
49
 
50
50
  interface ASTBase {
51
51
  debug?: boolean;
@@ -97,19 +97,18 @@ declare function parse(str: string): AST;
97
97
  * to nodes of a specific type.
98
98
  * Useful if you want to convert some part of a formula.
99
99
  *
100
- * e.g.
101
- * ```ts
100
+ * @example
102
101
  * convertAstNodes(ast, "FUNCALL", convertFormulaToExcel)
103
102
  *
104
103
  * function convertFormulaToExcel(ast: ASTFuncall) {
105
104
  * // ...
106
105
  * return modifiedAst
107
106
  * }
108
- * ```
109
107
  */
110
108
  declare function convertAstNodes<T extends AST["type"]>(ast: AST, type: T, fn: (ast: Extract<AST, {
111
109
  type: T;
112
- }>) => AST): any;
110
+ }>) => AST): AST;
111
+ declare function iterateAstNodes(ast: AST): AST[];
113
112
  /**
114
113
  * Converts an ast formula to the corresponding string
115
114
  */
@@ -289,6 +288,26 @@ interface SnapshotEvent {
289
288
  }
290
289
  type CollaborativeEvent = NewLocalStateUpdateEvent | UnexpectedRevisionIdEvent | RemoteRevisionReceivedEvent | RevisionAcknowledgedEvent | RevisionUndone | RevisionRedone | RevisionsDroppedEvent | SnapshotEvent | CollaborativeEventReceived;
291
290
 
291
+ interface Figure {
292
+ id: UID;
293
+ x: Pixel;
294
+ y: Pixel;
295
+ width: Pixel;
296
+ height: Pixel;
297
+ tag: string;
298
+ }
299
+ interface FigureSize {
300
+ width: Pixel;
301
+ height: Pixel;
302
+ }
303
+ type ResizeDirection = -1 | 0 | 1;
304
+
305
+ interface Image {
306
+ path: string;
307
+ size: FigureSize;
308
+ mimetype?: string;
309
+ }
310
+
292
311
  type XLSXExportFile = XLSXExportImageFile | XLSXExportXMLFile;
293
312
  interface XLSXExportXMLFile {
294
313
  path: string;
@@ -558,26 +577,6 @@ interface IconSetRule {
558
577
  type ConditionalFormattingOperatorValues = "BeginsWith" | "Between" | "ContainsText" | "IsEmpty" | "IsNotEmpty" | "EndsWith" | "Equal" | "GreaterThan" | "GreaterThanOrEqual" | "LessThan" | "LessThanOrEqual" | "NotBetween" | "NotContains" | "NotEqual";
559
578
  type UpDown = "up" | "down";
560
579
 
561
- interface Figure {
562
- id: UID;
563
- x: Pixel;
564
- y: Pixel;
565
- width: Pixel;
566
- height: Pixel;
567
- tag: string;
568
- }
569
- interface FigureSize {
570
- width: Pixel;
571
- height: Pixel;
572
- }
573
- type ResizeDirection = -1 | 0 | 1;
574
-
575
- interface Image {
576
- path: string;
577
- size: FigureSize;
578
- mimetype?: string;
579
- }
580
-
581
580
  interface CellData {
582
581
  content?: string;
583
582
  style?: number;
@@ -619,6 +618,9 @@ interface SheetData {
619
618
  isVisible: boolean;
620
619
  panes?: PaneDivision;
621
620
  }
621
+ interface WorkbookSettings {
622
+ locale: Locale;
623
+ }
622
624
  interface WorkbookData {
623
625
  version: number;
624
626
  sheets: SheetData[];
@@ -638,6 +640,7 @@ interface WorkbookData {
638
640
  };
639
641
  revisionId: UID;
640
642
  uniqueFigureIds: boolean;
643
+ settings: WorkbookSettings;
641
644
  }
642
645
  interface ExcelWorkbookData extends WorkbookData {
643
646
  sheets: ExcelSheetData[];
@@ -756,7 +759,7 @@ interface TransportService<T = any> {
756
759
  }
757
760
 
758
761
  declare class Revision implements RevisionData {
759
- readonly rootCommand?: "SNAPSHOT" | Command | "REMOTE" | undefined;
762
+ readonly rootCommand?: Command | "SNAPSHOT" | "REMOTE" | undefined;
760
763
  readonly timestamp?: number | undefined;
761
764
  readonly id: UID;
762
765
  readonly clientId: ClientId;
@@ -771,7 +774,7 @@ declare class Revision implements RevisionData {
771
774
  * - clientId: Client who initiated the action
772
775
  * - changes: List of changes applied on the state.
773
776
  */
774
- constructor(id: UID, clientId: ClientId, commands: readonly CoreCommand[], rootCommand?: "SNAPSHOT" | Command | "REMOTE" | undefined, changes?: readonly HistoryChange[], timestamp?: number | undefined);
777
+ constructor(id: UID, clientId: ClientId, commands: readonly CoreCommand[], rootCommand?: Command | "SNAPSHOT" | "REMOTE" | undefined, changes?: readonly HistoryChange[], timestamp?: number | undefined);
775
778
  setChanges(changes: readonly HistoryChange[]): void;
776
779
  get commands(): readonly CoreCommand[];
777
780
  get changes(): readonly HistoryChange[];
@@ -913,7 +916,7 @@ declare function toXC(col: HeaderIndex, row: HeaderIndex, rangePart?: RangePart)
913
916
  /**
914
917
  * Formats a cell value with its format.
915
918
  */
916
- declare function formatValue(value: CellValue, format?: Format): FormattedValue;
919
+ declare function formatValue(value: CellValue, { format, locale }: LocaleFormat): FormattedValue;
917
920
 
918
921
  declare function computeTextWidth(context: CanvasRenderingContext2D, text: string, style: Style): number;
919
922
  declare function isMarkdownLink(str: string): boolean;
@@ -1075,6 +1078,7 @@ interface ImageProviderInterface {
1075
1078
  * RequestImage ask the user to input an image file. Then send it to a server trough an FileStore. Finally it return the path and the size of the image in the server.
1076
1079
  */
1077
1080
  requestImage(): Promise<Image>;
1081
+ getImageOriginalSize(path: string): Promise<FigureSize>;
1078
1082
  }
1079
1083
 
1080
1084
  interface NotifyUIEvent {
@@ -1121,16 +1125,18 @@ interface ModelConfig {
1121
1125
  * External dependencies required to enable some features
1122
1126
  * such as uploading images.
1123
1127
  */
1124
- readonly external: Readonly<{
1125
- readonly fileStore?: FileStore;
1126
- readonly loadCurrencies?: () => Promise<Currency[]>;
1127
- }>;
1128
+ readonly external: Readonly<ModelExternalConfig>;
1128
1129
  readonly moveClient: (position: ClientPosition) => void;
1129
1130
  readonly transportService: TransportService;
1130
1131
  readonly client: Client;
1131
1132
  readonly snapshotRequested: boolean;
1132
1133
  readonly notifyUI: (payload: NotifyUIEvent) => void;
1133
1134
  }
1135
+ interface ModelExternalConfig {
1136
+ readonly fileStore?: FileStore;
1137
+ readonly loadCurrencies?: () => Promise<Currency[]>;
1138
+ readonly loadLocales?: () => Promise<Locale[]>;
1139
+ }
1134
1140
  declare class Model extends EventBus<any> implements CommandDispatcher {
1135
1141
  private corePlugins;
1136
1142
  private featurePlugins;
@@ -1193,6 +1199,7 @@ declare class Model extends EventBus<any> implements CommandDispatcher {
1193
1199
  private setupSession;
1194
1200
  private setupSessionEvents;
1195
1201
  private setupConfig;
1202
+ private setupExternalConfig;
1196
1203
  private setupCorePluginConfig;
1197
1204
  private setupUiPluginConfig;
1198
1205
  /**
@@ -1543,8 +1550,8 @@ declare class EditionPlugin extends UIPlugin {
1543
1550
  /**
1544
1551
  * Function used to determine when composer selection can start.
1545
1552
  * Three conditions are necessary:
1546
- * - the previous token is among ["COMMA", "LEFT_PAREN", "OPERATOR"], and is not a postfix unary operator
1547
- * - the next token is missing or is among ["COMMA", "RIGHT_PAREN", "OPERATOR"]
1553
+ * - the previous token is among ["ARG_SEPARATOR", "LEFT_PAREN", "OPERATOR"], and is not a postfix unary operator
1554
+ * - the next token is missing or is among ["ARG_SEPARATOR", "RIGHT_PAREN", "OPERATOR"]
1548
1555
  * - Previous and next tokens can be separated by spaces
1549
1556
  */
1550
1557
  private canStartComposerRangeSelection;
@@ -1667,11 +1674,11 @@ interface PositionDependentCommand {
1667
1674
  col: number;
1668
1675
  row: number;
1669
1676
  }
1670
- declare const invalidateEvaluationCommands: Set<"UPDATE_CELL" | "UPDATE_CELL_POSITION" | "CLEAR_CELL" | "DELETE_CONTENT" | "ADD_COLUMNS_ROWS" | "REMOVE_COLUMNS_ROWS" | "RESIZE_COLUMNS_ROWS" | "HIDE_COLUMNS_ROWS" | "UNHIDE_COLUMNS_ROWS" | "SET_GRID_LINES_VISIBILITY" | "FREEZE_COLUMNS" | "FREEZE_ROWS" | "UNFREEZE_COLUMNS_ROWS" | "UNFREEZE_COLUMNS" | "UNFREEZE_ROWS" | "ADD_MERGE" | "REMOVE_MERGE" | "CREATE_SHEET" | "DELETE_SHEET" | "DUPLICATE_SHEET" | "MOVE_SHEET" | "RENAME_SHEET" | "HIDE_SHEET" | "SHOW_SHEET" | "MOVE_RANGES" | "ADD_CONDITIONAL_FORMAT" | "REMOVE_CONDITIONAL_FORMAT" | "MOVE_CONDITIONAL_FORMAT" | "CREATE_FIGURE" | "DELETE_FIGURE" | "UPDATE_FIGURE" | "SET_FORMATTING" | "CLEAR_FORMATTING" | "SET_ZONE_BORDERS" | "SET_BORDER" | "CREATE_CHART" | "UPDATE_CHART" | "CREATE_IMAGE" | "CREATE_FILTER_TABLE" | "REMOVE_FILTER_TABLE" | "UNDO" | "REDO" | "EVALUATE_CELLS">;
1671
- declare const invalidateDependenciesCommands: Set<"UPDATE_CELL" | "UPDATE_CELL_POSITION" | "CLEAR_CELL" | "DELETE_CONTENT" | "ADD_COLUMNS_ROWS" | "REMOVE_COLUMNS_ROWS" | "RESIZE_COLUMNS_ROWS" | "HIDE_COLUMNS_ROWS" | "UNHIDE_COLUMNS_ROWS" | "SET_GRID_LINES_VISIBILITY" | "FREEZE_COLUMNS" | "FREEZE_ROWS" | "UNFREEZE_COLUMNS_ROWS" | "UNFREEZE_COLUMNS" | "UNFREEZE_ROWS" | "ADD_MERGE" | "REMOVE_MERGE" | "CREATE_SHEET" | "DELETE_SHEET" | "DUPLICATE_SHEET" | "MOVE_SHEET" | "RENAME_SHEET" | "HIDE_SHEET" | "SHOW_SHEET" | "MOVE_RANGES" | "ADD_CONDITIONAL_FORMAT" | "REMOVE_CONDITIONAL_FORMAT" | "MOVE_CONDITIONAL_FORMAT" | "CREATE_FIGURE" | "DELETE_FIGURE" | "UPDATE_FIGURE" | "SET_FORMATTING" | "CLEAR_FORMATTING" | "SET_ZONE_BORDERS" | "SET_BORDER" | "CREATE_CHART" | "UPDATE_CHART" | "CREATE_IMAGE" | "CREATE_FILTER_TABLE" | "REMOVE_FILTER_TABLE" | "SORT_CELLS" | "SET_DECIMAL" | "REQUEST_UNDO" | "REQUEST_REDO" | "UNDO" | "REDO" | "ENABLE_NEW_SELECTION_INPUT" | "DISABLE_SELECTION_INPUT" | "UNFOCUS_SELECTION_INPUT" | "FOCUS_RANGE" | "ADD_EMPTY_RANGE" | "ADD_RANGE" | "REMOVE_RANGE" | "CHANGE_RANGE" | "COPY" | "CUT" | "PASTE" | "REPEAT_PASTE" | "CLEAN_CLIPBOARD_HIGHLIGHT" | "AUTOFILL_CELL" | "PASTE_FROM_OS_CLIPBOARD" | "ACTIVATE_PAINT_FORMAT" | "AUTORESIZE_COLUMNS" | "AUTORESIZE_ROWS" | "MOVE_COLUMNS_ROWS" | "ACTIVATE_SHEET" | "PREPARE_SELECTION_INPUT_EXPANSION" | "STOP_SELECTION_INPUT" | "EVALUATE_CELLS" | "CHANGE_HIGHLIGHT" | "START_CHANGE_HIGHLIGHT" | "SET_HIGHLIGHT_COLOR" | "STOP_COMPOSER_RANGE_SELECTION" | "START_EDITION" | "STOP_EDITION" | "SET_CURRENT_CONTENT" | "CHANGE_COMPOSER_CURSOR_SELECTION" | "REPLACE_COMPOSER_CURSOR_SELECTION" | "CYCLE_EDITION_REFERENCES" | "START" | "AUTOFILL" | "AUTOFILL_SELECT" | "SET_FORMULA_VISIBILITY" | "AUTOFILL_AUTO" | "SELECT_FIGURE" | "UPDATE_SEARCH" | "REFRESH_SEARCH" | "CLEAR_SEARCH" | "SELECT_SEARCH_PREVIOUS_MATCH" | "SELECT_SEARCH_NEXT_MATCH" | "REPLACE_SEARCH" | "REPLACE_ALL_SEARCH" | "RESIZE_SHEETVIEW" | "SUM_SELECTION" | "DELETE_CELL" | "INSERT_CELL" | "SET_VIEWPORT_OFFSET" | "SHIFT_VIEWPORT_DOWN" | "SHIFT_VIEWPORT_UP" | "OPEN_CELL_POPOVER" | "CLOSE_CELL_POPOVER" | "ACTIVATE_NEXT_SHEET" | "ACTIVATE_PREVIOUS_SHEET" | "UPDATE_FILTER" | "SPLIT_TEXT_INTO_COLUMNS">;
1672
- declare const invalidateCFEvaluationCommands: Set<"UPDATE_CELL" | "UPDATE_CELL_POSITION" | "CLEAR_CELL" | "DELETE_CONTENT" | "ADD_COLUMNS_ROWS" | "REMOVE_COLUMNS_ROWS" | "RESIZE_COLUMNS_ROWS" | "HIDE_COLUMNS_ROWS" | "UNHIDE_COLUMNS_ROWS" | "SET_GRID_LINES_VISIBILITY" | "FREEZE_COLUMNS" | "FREEZE_ROWS" | "UNFREEZE_COLUMNS_ROWS" | "UNFREEZE_COLUMNS" | "UNFREEZE_ROWS" | "ADD_MERGE" | "REMOVE_MERGE" | "CREATE_SHEET" | "DELETE_SHEET" | "DUPLICATE_SHEET" | "MOVE_SHEET" | "RENAME_SHEET" | "HIDE_SHEET" | "SHOW_SHEET" | "MOVE_RANGES" | "ADD_CONDITIONAL_FORMAT" | "REMOVE_CONDITIONAL_FORMAT" | "MOVE_CONDITIONAL_FORMAT" | "CREATE_FIGURE" | "DELETE_FIGURE" | "UPDATE_FIGURE" | "SET_FORMATTING" | "CLEAR_FORMATTING" | "SET_ZONE_BORDERS" | "SET_BORDER" | "CREATE_CHART" | "UPDATE_CHART" | "CREATE_IMAGE" | "CREATE_FILTER_TABLE" | "REMOVE_FILTER_TABLE" | "UNDO" | "REDO" | "EVALUATE_CELLS">;
1673
- declare const readonlyAllowedCommands: Set<"UPDATE_CELL" | "UPDATE_CELL_POSITION" | "CLEAR_CELL" | "DELETE_CONTENT" | "ADD_COLUMNS_ROWS" | "REMOVE_COLUMNS_ROWS" | "RESIZE_COLUMNS_ROWS" | "HIDE_COLUMNS_ROWS" | "UNHIDE_COLUMNS_ROWS" | "SET_GRID_LINES_VISIBILITY" | "FREEZE_COLUMNS" | "FREEZE_ROWS" | "UNFREEZE_COLUMNS_ROWS" | "UNFREEZE_COLUMNS" | "UNFREEZE_ROWS" | "ADD_MERGE" | "REMOVE_MERGE" | "CREATE_SHEET" | "DELETE_SHEET" | "DUPLICATE_SHEET" | "MOVE_SHEET" | "RENAME_SHEET" | "HIDE_SHEET" | "SHOW_SHEET" | "MOVE_RANGES" | "ADD_CONDITIONAL_FORMAT" | "REMOVE_CONDITIONAL_FORMAT" | "MOVE_CONDITIONAL_FORMAT" | "CREATE_FIGURE" | "DELETE_FIGURE" | "UPDATE_FIGURE" | "SET_FORMATTING" | "CLEAR_FORMATTING" | "SET_ZONE_BORDERS" | "SET_BORDER" | "CREATE_CHART" | "UPDATE_CHART" | "CREATE_IMAGE" | "CREATE_FILTER_TABLE" | "REMOVE_FILTER_TABLE" | "SORT_CELLS" | "SET_DECIMAL" | "REQUEST_UNDO" | "REQUEST_REDO" | "UNDO" | "REDO" | "ENABLE_NEW_SELECTION_INPUT" | "DISABLE_SELECTION_INPUT" | "UNFOCUS_SELECTION_INPUT" | "FOCUS_RANGE" | "ADD_EMPTY_RANGE" | "ADD_RANGE" | "REMOVE_RANGE" | "CHANGE_RANGE" | "COPY" | "CUT" | "PASTE" | "REPEAT_PASTE" | "CLEAN_CLIPBOARD_HIGHLIGHT" | "AUTOFILL_CELL" | "PASTE_FROM_OS_CLIPBOARD" | "ACTIVATE_PAINT_FORMAT" | "AUTORESIZE_COLUMNS" | "AUTORESIZE_ROWS" | "MOVE_COLUMNS_ROWS" | "ACTIVATE_SHEET" | "PREPARE_SELECTION_INPUT_EXPANSION" | "STOP_SELECTION_INPUT" | "EVALUATE_CELLS" | "CHANGE_HIGHLIGHT" | "START_CHANGE_HIGHLIGHT" | "SET_HIGHLIGHT_COLOR" | "STOP_COMPOSER_RANGE_SELECTION" | "START_EDITION" | "STOP_EDITION" | "SET_CURRENT_CONTENT" | "CHANGE_COMPOSER_CURSOR_SELECTION" | "REPLACE_COMPOSER_CURSOR_SELECTION" | "CYCLE_EDITION_REFERENCES" | "START" | "AUTOFILL" | "AUTOFILL_SELECT" | "SET_FORMULA_VISIBILITY" | "AUTOFILL_AUTO" | "SELECT_FIGURE" | "UPDATE_SEARCH" | "REFRESH_SEARCH" | "CLEAR_SEARCH" | "SELECT_SEARCH_PREVIOUS_MATCH" | "SELECT_SEARCH_NEXT_MATCH" | "REPLACE_SEARCH" | "REPLACE_ALL_SEARCH" | "RESIZE_SHEETVIEW" | "SUM_SELECTION" | "DELETE_CELL" | "INSERT_CELL" | "SET_VIEWPORT_OFFSET" | "SHIFT_VIEWPORT_DOWN" | "SHIFT_VIEWPORT_UP" | "OPEN_CELL_POPOVER" | "CLOSE_CELL_POPOVER" | "ACTIVATE_NEXT_SHEET" | "ACTIVATE_PREVIOUS_SHEET" | "UPDATE_FILTER" | "SPLIT_TEXT_INTO_COLUMNS">;
1674
- declare const coreTypes: Set<"UPDATE_CELL" | "UPDATE_CELL_POSITION" | "CLEAR_CELL" | "DELETE_CONTENT" | "ADD_COLUMNS_ROWS" | "REMOVE_COLUMNS_ROWS" | "RESIZE_COLUMNS_ROWS" | "HIDE_COLUMNS_ROWS" | "UNHIDE_COLUMNS_ROWS" | "SET_GRID_LINES_VISIBILITY" | "FREEZE_COLUMNS" | "FREEZE_ROWS" | "UNFREEZE_COLUMNS_ROWS" | "UNFREEZE_COLUMNS" | "UNFREEZE_ROWS" | "ADD_MERGE" | "REMOVE_MERGE" | "CREATE_SHEET" | "DELETE_SHEET" | "DUPLICATE_SHEET" | "MOVE_SHEET" | "RENAME_SHEET" | "HIDE_SHEET" | "SHOW_SHEET" | "MOVE_RANGES" | "ADD_CONDITIONAL_FORMAT" | "REMOVE_CONDITIONAL_FORMAT" | "MOVE_CONDITIONAL_FORMAT" | "CREATE_FIGURE" | "DELETE_FIGURE" | "UPDATE_FIGURE" | "SET_FORMATTING" | "CLEAR_FORMATTING" | "SET_ZONE_BORDERS" | "SET_BORDER" | "CREATE_CHART" | "UPDATE_CHART" | "CREATE_IMAGE" | "CREATE_FILTER_TABLE" | "REMOVE_FILTER_TABLE">;
1677
+ declare const invalidateEvaluationCommands: Set<"UPDATE_CELL" | "UPDATE_CELL_POSITION" | "CLEAR_CELL" | "DELETE_CONTENT" | "ADD_COLUMNS_ROWS" | "REMOVE_COLUMNS_ROWS" | "RESIZE_COLUMNS_ROWS" | "HIDE_COLUMNS_ROWS" | "UNHIDE_COLUMNS_ROWS" | "SET_GRID_LINES_VISIBILITY" | "FREEZE_COLUMNS" | "FREEZE_ROWS" | "UNFREEZE_COLUMNS_ROWS" | "UNFREEZE_COLUMNS" | "UNFREEZE_ROWS" | "ADD_MERGE" | "REMOVE_MERGE" | "CREATE_SHEET" | "DELETE_SHEET" | "DUPLICATE_SHEET" | "MOVE_SHEET" | "RENAME_SHEET" | "HIDE_SHEET" | "SHOW_SHEET" | "MOVE_RANGES" | "ADD_CONDITIONAL_FORMAT" | "REMOVE_CONDITIONAL_FORMAT" | "MOVE_CONDITIONAL_FORMAT" | "CREATE_FIGURE" | "DELETE_FIGURE" | "UPDATE_FIGURE" | "SET_FORMATTING" | "CLEAR_FORMATTING" | "SET_ZONE_BORDERS" | "SET_BORDER" | "CREATE_CHART" | "UPDATE_CHART" | "CREATE_IMAGE" | "CREATE_FILTER_TABLE" | "REMOVE_FILTER_TABLE" | "UPDATE_LOCALE" | "UNDO" | "REDO" | "EVALUATE_CELLS">;
1678
+ declare const invalidateDependenciesCommands: Set<"UPDATE_CELL" | "UPDATE_CELL_POSITION" | "CLEAR_CELL" | "DELETE_CONTENT" | "ADD_COLUMNS_ROWS" | "REMOVE_COLUMNS_ROWS" | "RESIZE_COLUMNS_ROWS" | "HIDE_COLUMNS_ROWS" | "UNHIDE_COLUMNS_ROWS" | "SET_GRID_LINES_VISIBILITY" | "FREEZE_COLUMNS" | "FREEZE_ROWS" | "UNFREEZE_COLUMNS_ROWS" | "UNFREEZE_COLUMNS" | "UNFREEZE_ROWS" | "ADD_MERGE" | "REMOVE_MERGE" | "CREATE_SHEET" | "DELETE_SHEET" | "DUPLICATE_SHEET" | "MOVE_SHEET" | "RENAME_SHEET" | "HIDE_SHEET" | "SHOW_SHEET" | "MOVE_RANGES" | "ADD_CONDITIONAL_FORMAT" | "REMOVE_CONDITIONAL_FORMAT" | "MOVE_CONDITIONAL_FORMAT" | "CREATE_FIGURE" | "DELETE_FIGURE" | "UPDATE_FIGURE" | "SET_FORMATTING" | "CLEAR_FORMATTING" | "SET_ZONE_BORDERS" | "SET_BORDER" | "CREATE_CHART" | "UPDATE_CHART" | "CREATE_IMAGE" | "CREATE_FILTER_TABLE" | "REMOVE_FILTER_TABLE" | "UPDATE_LOCALE" | "SORT_CELLS" | "SET_DECIMAL" | "REQUEST_UNDO" | "REQUEST_REDO" | "UNDO" | "REDO" | "ENABLE_NEW_SELECTION_INPUT" | "DISABLE_SELECTION_INPUT" | "UNFOCUS_SELECTION_INPUT" | "FOCUS_RANGE" | "ADD_EMPTY_RANGE" | "ADD_RANGE" | "REMOVE_RANGE" | "CHANGE_RANGE" | "COPY" | "CUT" | "PASTE" | "REPEAT_PASTE" | "CLEAN_CLIPBOARD_HIGHLIGHT" | "AUTOFILL_CELL" | "PASTE_FROM_OS_CLIPBOARD" | "ACTIVATE_PAINT_FORMAT" | "AUTORESIZE_COLUMNS" | "AUTORESIZE_ROWS" | "MOVE_COLUMNS_ROWS" | "ACTIVATE_SHEET" | "PREPARE_SELECTION_INPUT_EXPANSION" | "STOP_SELECTION_INPUT" | "EVALUATE_CELLS" | "CHANGE_HIGHLIGHT" | "START_CHANGE_HIGHLIGHT" | "SET_HIGHLIGHT_COLOR" | "STOP_COMPOSER_RANGE_SELECTION" | "START_EDITION" | "STOP_EDITION" | "SET_CURRENT_CONTENT" | "CHANGE_COMPOSER_CURSOR_SELECTION" | "REPLACE_COMPOSER_CURSOR_SELECTION" | "CYCLE_EDITION_REFERENCES" | "START" | "AUTOFILL" | "AUTOFILL_SELECT" | "SET_FORMULA_VISIBILITY" | "AUTOFILL_AUTO" | "SELECT_FIGURE" | "UPDATE_SEARCH" | "REFRESH_SEARCH" | "CLEAR_SEARCH" | "SELECT_SEARCH_PREVIOUS_MATCH" | "SELECT_SEARCH_NEXT_MATCH" | "REPLACE_SEARCH" | "REPLACE_ALL_SEARCH" | "RESIZE_SHEETVIEW" | "SUM_SELECTION" | "DELETE_CELL" | "INSERT_CELL" | "SET_VIEWPORT_OFFSET" | "SHIFT_VIEWPORT_DOWN" | "SHIFT_VIEWPORT_UP" | "OPEN_CELL_POPOVER" | "CLOSE_CELL_POPOVER" | "ACTIVATE_NEXT_SHEET" | "ACTIVATE_PREVIOUS_SHEET" | "UPDATE_FILTER" | "SPLIT_TEXT_INTO_COLUMNS">;
1679
+ declare const invalidateCFEvaluationCommands: Set<"UPDATE_CELL" | "UPDATE_CELL_POSITION" | "CLEAR_CELL" | "DELETE_CONTENT" | "ADD_COLUMNS_ROWS" | "REMOVE_COLUMNS_ROWS" | "RESIZE_COLUMNS_ROWS" | "HIDE_COLUMNS_ROWS" | "UNHIDE_COLUMNS_ROWS" | "SET_GRID_LINES_VISIBILITY" | "FREEZE_COLUMNS" | "FREEZE_ROWS" | "UNFREEZE_COLUMNS_ROWS" | "UNFREEZE_COLUMNS" | "UNFREEZE_ROWS" | "ADD_MERGE" | "REMOVE_MERGE" | "CREATE_SHEET" | "DELETE_SHEET" | "DUPLICATE_SHEET" | "MOVE_SHEET" | "RENAME_SHEET" | "HIDE_SHEET" | "SHOW_SHEET" | "MOVE_RANGES" | "ADD_CONDITIONAL_FORMAT" | "REMOVE_CONDITIONAL_FORMAT" | "MOVE_CONDITIONAL_FORMAT" | "CREATE_FIGURE" | "DELETE_FIGURE" | "UPDATE_FIGURE" | "SET_FORMATTING" | "CLEAR_FORMATTING" | "SET_ZONE_BORDERS" | "SET_BORDER" | "CREATE_CHART" | "UPDATE_CHART" | "CREATE_IMAGE" | "CREATE_FILTER_TABLE" | "REMOVE_FILTER_TABLE" | "UPDATE_LOCALE" | "UNDO" | "REDO" | "EVALUATE_CELLS">;
1680
+ declare const readonlyAllowedCommands: Set<"UPDATE_CELL" | "UPDATE_CELL_POSITION" | "CLEAR_CELL" | "DELETE_CONTENT" | "ADD_COLUMNS_ROWS" | "REMOVE_COLUMNS_ROWS" | "RESIZE_COLUMNS_ROWS" | "HIDE_COLUMNS_ROWS" | "UNHIDE_COLUMNS_ROWS" | "SET_GRID_LINES_VISIBILITY" | "FREEZE_COLUMNS" | "FREEZE_ROWS" | "UNFREEZE_COLUMNS_ROWS" | "UNFREEZE_COLUMNS" | "UNFREEZE_ROWS" | "ADD_MERGE" | "REMOVE_MERGE" | "CREATE_SHEET" | "DELETE_SHEET" | "DUPLICATE_SHEET" | "MOVE_SHEET" | "RENAME_SHEET" | "HIDE_SHEET" | "SHOW_SHEET" | "MOVE_RANGES" | "ADD_CONDITIONAL_FORMAT" | "REMOVE_CONDITIONAL_FORMAT" | "MOVE_CONDITIONAL_FORMAT" | "CREATE_FIGURE" | "DELETE_FIGURE" | "UPDATE_FIGURE" | "SET_FORMATTING" | "CLEAR_FORMATTING" | "SET_ZONE_BORDERS" | "SET_BORDER" | "CREATE_CHART" | "UPDATE_CHART" | "CREATE_IMAGE" | "CREATE_FILTER_TABLE" | "REMOVE_FILTER_TABLE" | "UPDATE_LOCALE" | "SORT_CELLS" | "SET_DECIMAL" | "REQUEST_UNDO" | "REQUEST_REDO" | "UNDO" | "REDO" | "ENABLE_NEW_SELECTION_INPUT" | "DISABLE_SELECTION_INPUT" | "UNFOCUS_SELECTION_INPUT" | "FOCUS_RANGE" | "ADD_EMPTY_RANGE" | "ADD_RANGE" | "REMOVE_RANGE" | "CHANGE_RANGE" | "COPY" | "CUT" | "PASTE" | "REPEAT_PASTE" | "CLEAN_CLIPBOARD_HIGHLIGHT" | "AUTOFILL_CELL" | "PASTE_FROM_OS_CLIPBOARD" | "ACTIVATE_PAINT_FORMAT" | "AUTORESIZE_COLUMNS" | "AUTORESIZE_ROWS" | "MOVE_COLUMNS_ROWS" | "ACTIVATE_SHEET" | "PREPARE_SELECTION_INPUT_EXPANSION" | "STOP_SELECTION_INPUT" | "EVALUATE_CELLS" | "CHANGE_HIGHLIGHT" | "START_CHANGE_HIGHLIGHT" | "SET_HIGHLIGHT_COLOR" | "STOP_COMPOSER_RANGE_SELECTION" | "START_EDITION" | "STOP_EDITION" | "SET_CURRENT_CONTENT" | "CHANGE_COMPOSER_CURSOR_SELECTION" | "REPLACE_COMPOSER_CURSOR_SELECTION" | "CYCLE_EDITION_REFERENCES" | "START" | "AUTOFILL" | "AUTOFILL_SELECT" | "SET_FORMULA_VISIBILITY" | "AUTOFILL_AUTO" | "SELECT_FIGURE" | "UPDATE_SEARCH" | "REFRESH_SEARCH" | "CLEAR_SEARCH" | "SELECT_SEARCH_PREVIOUS_MATCH" | "SELECT_SEARCH_NEXT_MATCH" | "REPLACE_SEARCH" | "REPLACE_ALL_SEARCH" | "RESIZE_SHEETVIEW" | "SUM_SELECTION" | "DELETE_CELL" | "INSERT_CELL" | "SET_VIEWPORT_OFFSET" | "SHIFT_VIEWPORT_DOWN" | "SHIFT_VIEWPORT_UP" | "OPEN_CELL_POPOVER" | "CLOSE_CELL_POPOVER" | "ACTIVATE_NEXT_SHEET" | "ACTIVATE_PREVIOUS_SHEET" | "UPDATE_FILTER" | "SPLIT_TEXT_INTO_COLUMNS">;
1681
+ declare const coreTypes: Set<"UPDATE_CELL" | "UPDATE_CELL_POSITION" | "CLEAR_CELL" | "DELETE_CONTENT" | "ADD_COLUMNS_ROWS" | "REMOVE_COLUMNS_ROWS" | "RESIZE_COLUMNS_ROWS" | "HIDE_COLUMNS_ROWS" | "UNHIDE_COLUMNS_ROWS" | "SET_GRID_LINES_VISIBILITY" | "FREEZE_COLUMNS" | "FREEZE_ROWS" | "UNFREEZE_COLUMNS_ROWS" | "UNFREEZE_COLUMNS" | "UNFREEZE_ROWS" | "ADD_MERGE" | "REMOVE_MERGE" | "CREATE_SHEET" | "DELETE_SHEET" | "DUPLICATE_SHEET" | "MOVE_SHEET" | "RENAME_SHEET" | "HIDE_SHEET" | "SHOW_SHEET" | "MOVE_RANGES" | "ADD_CONDITIONAL_FORMAT" | "REMOVE_CONDITIONAL_FORMAT" | "MOVE_CONDITIONAL_FORMAT" | "CREATE_FIGURE" | "DELETE_FIGURE" | "UPDATE_FIGURE" | "SET_FORMATTING" | "CLEAR_FORMATTING" | "SET_ZONE_BORDERS" | "SET_BORDER" | "CREATE_CHART" | "UPDATE_CHART" | "CREATE_IMAGE" | "CREATE_FILTER_TABLE" | "REMOVE_FILTER_TABLE" | "UPDATE_LOCALE">;
1675
1682
  interface UpdateCellCommand extends PositionDependentCommand {
1676
1683
  type: "UPDATE_CELL";
1677
1684
  content?: string;
@@ -1873,6 +1880,10 @@ interface SetDecimalCommand extends TargetDependentCommand {
1873
1880
  type: "SET_DECIMAL";
1874
1881
  step: SetDecimalStep;
1875
1882
  }
1883
+ interface UpdateLocaleCommand {
1884
+ type: "UPDATE_LOCALE";
1885
+ locale: Locale;
1886
+ }
1876
1887
  interface CopyCommand {
1877
1888
  type: "COPY";
1878
1889
  }
@@ -2243,7 +2254,7 @@ UpdateCellCommand | UpdateCellPositionCommand | ClearCellCommand | DeleteContent
2243
2254
  /** Image */
2244
2255
  | CreateImageOverCommand
2245
2256
  /** FILTERS */
2246
- | CreateFilterTableCommand | RemoveFilterTableCommand;
2257
+ | CreateFilterTableCommand | RemoveFilterTableCommand | UpdateLocaleCommand;
2247
2258
  type LocalCommand = RequestUndoCommand | RequestRedoCommand | UndoCommand | RedoCommand | NewInputCommand | RemoveInputCommand | UnfocusInputCommand | FocusInputCommand | AddEmptyRangeCommand | AddRangeCommand | RemoveRangeCommand | ChangeRangeCommand | CopyCommand | CutCommand | PasteCommand | RepeatPasteCommand | CleanClipBoardHighlightCommand | AutoFillCellCommand | PasteFromOSClipboardCommand | ActivatePaintFormatCommand | AutoresizeColumnsCommand | AutoresizeRowsCommand | MoveColumnsRowsCommand | ActivateSheetCommand | PrepareExpansionCommand | StopSelectionCommand | EvaluateCellsCommand | ChangeHighlightCommand | StartChangeHighlightCommand | SetColorCommand | StopComposerSelectionCommand | StartEditionCommand | StopEditionCommand | SetCurrentContentCommand | ChangeComposerSelectionCommand | ReplaceComposerSelectionCommand | CycleEditionReferencesCommand | StartCommand | AutofillCommand | AutofillSelectCommand | ShowFormulaCommand | AutofillAutoCommand | SelectFigureCommand | UpdateSearchCommand | RefreshSearchCommand | ClearSearchCommand | SelectSearchPreviousCommand | SelectSearchNextCommand | ReplaceSearchCommand | ReplaceAllSearchCommand | SortCommand | SetDecimalCommand | ResizeViewportCommand | SumSelectionCommand | DeleteCellCommand | InsertCellCommand | SetViewportOffsetCommand | MoveViewportDownCommand | MoveViewportUpCommand | OpenCellPopoverCommand | CloseCellPopoverCommand | ActivateNextSheetCommand | ActivatePreviousSheetCommand | UpdateFilterCommand | SplitTextIntoColumnsCommand;
2248
2259
  type Command = CoreCommand | LocalCommand;
2249
2260
  /**
@@ -2360,7 +2371,8 @@ declare const enum CommandResult {
2360
2371
  EmptySplitSeparator = 90,
2361
2372
  SplitWillOverwriteContent = 91,
2362
2373
  NoSplitSeparatorInSelection = 92,
2363
- NoActiveSheet = 93
2374
+ NoActiveSheet = 93,
2375
+ InvalidLocale = 94
2364
2376
  }
2365
2377
  interface CommandHandler<T> {
2366
2378
  allowDispatch(command: T): CommandResult | CommandResult[];
@@ -2650,8 +2662,23 @@ type ImmutableObject<T> = {
2650
2662
  readonly [K in keyof T]: Immutable<T[K]>;
2651
2663
  };
2652
2664
 
2665
+ type LocaleCode = string & Alias;
2666
+ interface Locale {
2667
+ name: string;
2668
+ code: LocaleCode;
2669
+ thousandsSeparator: string;
2670
+ decimalSeparator: string;
2671
+ dateFormat: string;
2672
+ timeFormat: string;
2673
+ formulaArgSeparator: string;
2674
+ }
2675
+
2653
2676
  type Format = string & Alias;
2654
2677
  type FormattedValue = string & Alias;
2678
+ interface LocaleFormat {
2679
+ locale: Locale;
2680
+ format?: Format;
2681
+ }
2655
2682
 
2656
2683
  interface CellAttributes {
2657
2684
  readonly id: UID;
@@ -2831,6 +2858,7 @@ interface SpreadsheetChildEnv extends SpreadsheetEnv {
2831
2858
  _t: TranslationFunction;
2832
2859
  startCellEdition: (content: string) => void;
2833
2860
  loadCurrencies?: () => Promise<Currency[]>;
2861
+ loadLocales: () => Promise<Locale[]>;
2834
2862
  }
2835
2863
 
2836
2864
  type ArgType = "ANY" | "BOOLEAN" | "NUMBER" | "STRING" | "DATE" | "RANGE" | "RANGE<BOOLEAN>" | "RANGE<NUMBER>" | "RANGE<DATE>" | "RANGE<STRING>" | "RANGE<ANY>" | "META";
@@ -2865,6 +2893,7 @@ interface FunctionDescription extends AddFunctionDescription {
2865
2893
  type EvalContext = {
2866
2894
  __lastFnCalled?: string;
2867
2895
  __originCellXC?: () => string;
2896
+ locale: Locale;
2868
2897
  [key: string]: any;
2869
2898
  };
2870
2899
 
@@ -3481,7 +3510,7 @@ declare class ImagePlugin extends CorePlugin<ImageState> implements ImageState {
3481
3510
  getImage(figureId: UID): Image;
3482
3511
  getImagePath(figureId: UID): string;
3483
3512
  getImageSize(figureId: UID): FigureSize;
3484
- private addFigure;
3513
+ private addImage;
3485
3514
  import(data: WorkbookData): void;
3486
3515
  export(data: WorkbookData): void;
3487
3516
  exportForExcel(data: ExcelWorkbookData): void;
@@ -3568,6 +3597,16 @@ declare class MergePlugin extends CorePlugin<MergeState> implements MergeState {
3568
3597
  exportForExcel(data: ExcelWorkbookData): void;
3569
3598
  }
3570
3599
 
3600
+ declare class SettingsPlugin extends CorePlugin {
3601
+ static getters: readonly ["getLocale"];
3602
+ private locale;
3603
+ allowDispatch(cmd: CoreCommand): CommandResult.Success | CommandResult.InvalidLocale;
3604
+ handle(cmd: CoreCommand): void;
3605
+ getLocale(): Locale;
3606
+ import(data: WorkbookData): void;
3607
+ export(data: WorkbookData): void;
3608
+ }
3609
+
3571
3610
  interface SheetState$1 {
3572
3611
  readonly sheets: Record<UID, Sheet | undefined>;
3573
3612
  readonly orderedSheetIds: UID[];
@@ -3725,6 +3764,7 @@ declare class SheetPlugin extends CorePlugin<SheetState$1> implements SheetState
3725
3764
  }
3726
3765
 
3727
3766
  declare class EvaluationPlugin extends UIPlugin {
3767
+ private config;
3728
3768
  static getters: readonly ["evaluateFormula", "getRangeFormattedValues", "getRangeValues", "getRangeFormats", "getEvaluatedCell", "getEvaluatedCells", "getEvaluatedCellsInZone"];
3729
3769
  private shouldRebuildDependenciesGraph;
3730
3770
  private evaluator;
@@ -3757,6 +3797,7 @@ declare class EvaluationPlugin extends UIPlugin {
3757
3797
  * formula of the array formula that spreads to the cell
3758
3798
  */
3759
3799
  private getCorrespondingFormulaCell;
3800
+ private getCompilationParameters;
3760
3801
  }
3761
3802
 
3762
3803
  interface CustomColorState {
@@ -4795,7 +4836,8 @@ type RangeAdapterGetters = Pick<RangeAdapter, GetterNames<typeof RangeAdapter>>;
4795
4836
  type ConditionalFormatGetters = Pick<ConditionalFormatPlugin, GetterNames<typeof ConditionalFormatPlugin>>;
4796
4837
  type LocalHistoryGetters = Pick<HistoryPlugin, GetterNames<typeof HistoryPlugin>>;
4797
4838
  type FiltersGetters = Pick<FiltersPlugin, GetterNames<typeof FiltersPlugin>>;
4798
- type CoreGetters = SheetGetters & HeaderSizeGetters & HeaderVisibilityGetters & CellGetters & MergeGetters & BordersGetters & ChartGetters & ImageGetters & ConditionalFormatGetters & FigureGetters & RangeAdapterGetters & FiltersGetters;
4839
+ type SettingsGetters = Pick<SettingsPlugin, GetterNames<typeof SettingsPlugin>>;
4840
+ type CoreGetters = SheetGetters & HeaderSizeGetters & HeaderVisibilityGetters & CellGetters & MergeGetters & BordersGetters & ChartGetters & ImageGetters & ConditionalFormatGetters & FigureGetters & RangeAdapterGetters & FiltersGetters & SettingsGetters;
4799
4841
  type AutofillGetters = Pick<AutofillPlugin, GetterNames<typeof AutofillPlugin>>;
4800
4842
  type AutomaticSumGetters = Pick<AutomaticSumPlugin, GetterNames<typeof AutomaticSumPlugin>>;
4801
4843
  type ClipboardGetters = Pick<ClipboardPlugin, GetterNames<typeof ClipboardPlugin>>;
@@ -6630,6 +6672,9 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
6630
6672
  keyMapping: {
6631
6673
  [key: string]: Function;
6632
6674
  };
6675
+ keyCodeMapping: {
6676
+ [keyCode: string]: Function;
6677
+ };
6633
6678
  setup(): void;
6634
6679
  private processArrowKeys;
6635
6680
  private handleArrowKeysForAutocomplete;
@@ -6638,6 +6683,7 @@ declare class Composer extends Component<ComposerProps, SpreadsheetChildEnv> {
6638
6683
  private processEnterKey;
6639
6684
  private processEscapeKey;
6640
6685
  private processF4Key;
6686
+ private processNumpadDecimal;
6641
6687
  onCompositionStart(): void;
6642
6688
  onCompositionEnd(): void;
6643
6689
  onKeydown(ev: KeyboardEvent): void;
@@ -7102,10 +7148,10 @@ declare class ChartPanel extends Component<Props, SpreadsheetChildEnv> {
7102
7148
  activatePanel(panel: "configuration" | "design"): void;
7103
7149
  }
7104
7150
 
7105
- declare function toNumber(value: string | number | boolean | null | undefined): number;
7151
+ declare function toNumber(value: string | number | boolean | null | undefined, locale: Locale): number;
7106
7152
  declare function toString(value: string | number | boolean | null | undefined): string;
7107
7153
  declare function toBoolean(value: string | number | boolean | null | undefined): boolean;
7108
- declare function toJsDate(value: string | number | boolean | null | undefined): Date;
7154
+ declare function toJsDate(value: string | number | boolean | null | undefined, locale: Locale): Date;
7109
7155
 
7110
7156
  declare function arg(definition: string, description?: string): ArgDefinition;
7111
7157
 
@@ -7122,7 +7168,7 @@ declare function chartFontColor(backgroundColor: Color | undefined): Color;
7122
7168
  /**
7123
7169
  * Get a default chart js configuration
7124
7170
  */
7125
- declare function getDefaultChartJsRuntime(chart: AbstractChart, labels: string[], fontColor: Color, dataSetsFormat?: Format | undefined): ChartConfiguration;
7171
+ declare function getDefaultChartJsRuntime(chart: AbstractChart, labels: string[], fontColor: Color, { format, locale }: LocaleFormat): ChartConfiguration;
7126
7172
  /** See https://www.chartjs.org/docs/latest/charts/area.html#filling-modes */
7127
7173
  declare function getFillingMode(index: number): "origin" | number;
7128
7174
 
@@ -7268,5 +7314,8 @@ declare const components: {
7268
7314
  FigureComponent: typeof FigureComponent;
7269
7315
  };
7270
7316
  declare function addFunction(functionName: string, functionDescription: FunctionDescription): void;
7317
+ declare const constants: {
7318
+ DEFAULT_LOCALE: Locale;
7319
+ };
7271
7320
 
7272
- 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, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
7321
+ 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, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };