o-spreadsheet API
- AbstractChart
- CorePlugin
- DispatchResult
- EvaluationError
- Model
- Registry
- Revision
- Spreadsheet
- UIPlugin
- Client
- ClientJoinedMessage
- ClientLeftMessage
- ClientMovedMessage
- RemoteRevisionMessage
- RevisionRedoneMessage
- RevisionUndoneMessage
- TransportService
- DATETIME_FORMAT
- SPREADSHEET_DIMENSIONS
- __info__
- cellTypes
- components
- coreTypes
- functionCache
- helpers
- invalidateEvaluationCommands
- readonlyAllowedCommands
- registries
Ƭ CancelledReason: Exclude
<CommandResult
, Success
>
Ƭ CollaborationMessage: RevisionUndoneMessage
| RevisionRedoneMessage
| RemoteRevisionMessage
| SnapshotMessage
| SnapshotCreatedMessage
| ClientMovedMessage
| ClientJoinedMessage
| ClientLeftMessage
• DATETIME_FORMAT: RegExp
• SPREADSHEET_DIMENSIONS: Object
Name | Type |
---|---|
BOTTOMBAR_HEIGHT |
number |
DEFAULT_CELL_HEIGHT |
number |
DEFAULT_CELL_WIDTH |
number |
HEADER_HEIGHT |
number |
HEADER_WIDTH |
number |
MIN_COL_WIDTH |
number |
MIN_ROW_HEIGHT |
number |
SCROLLBAR_WIDTH |
number |
TOPBAR_HEIGHT |
number |
• __info__: Object
= {}
We export here all entities that needs to be accessed publicly by Odoo.
Note that the info key is actually completed by the build process (see the rollup.config.js file)
• cellTypes: Object
Name | Type |
---|---|
LinkCell |
typeof LinkCell |
• components: Object
Name | Type |
---|---|
BarConfigPanel |
typeof BarConfigPanel |
ChartFigure |
typeof ChartFigure |
ChartJsComponent |
typeof ChartJsComponent |
ChartPanel |
typeof ChartPanel |
GaugeChartConfigPanel |
typeof GaugeChartConfigPanel |
GaugeChartDesignPanel |
typeof GaugeChartDesignPanel |
Grid |
typeof Grid |
GridOverlay |
typeof GridOverlay |
LineBarPieConfigPanel |
typeof LineBarPieConfigPanel |
LineBarPieDesignPanel |
typeof LineBarPieDesignPanel |
LineConfigPanel |
typeof LineConfigPanel |
ScorecardChart |
typeof ScorecardChart |
ScorecardChartConfigPanel |
typeof ScorecardChartConfigPanel |
ScorecardChartDesignPanel |
typeof ScorecardChartDesignPanel |
• coreTypes: Set
<"UPDATE_CELL"
| "UPDATE_CELL_POSITION"
| "CLEAR_CELL"
| "DELETE_CONTENT"
| "SET_DECIMAL"
| "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_BORDER"
| "CREATE_CHART"
| "UPDATE_CHART"
>
• functionCache: Object
= {}
▪ [key: string
]: Omit
<CompiledFormula
, "dependencies"
| "tokens"
>
• helpers: Object
Name | Type |
---|---|
CellErrorLevel |
typeof CellErrorLevel |
ChartColors |
typeof ChartColors |
EvaluationError |
typeof EvaluationError |
UuidGenerator |
typeof UuidGenerator |
args |
(strings : string ) => ArgDefinition [] |
chartFontColor |
(backgroundColor : undefined | Color ) => Color |
colorToRGBA |
(color : Color ) => RGBA |
computeTextWidth |
(context : CanvasRenderingContext2D , text : string , style : Style ) => number |
createEmptyWorkbookData |
(sheetName : string ) => WorkbookData |
createFullMenuItem |
(key : string , value : MenuItem ) => FullMenuItem |
formatValue |
(value : CellValue , format? : Format ) => FormattedValue |
getDefaultChartJsRuntime |
(chart : AbstractChart , labels : string [], fontColor : Color ) => ChartConfiguration |
getFillingMode |
(index : number ) => "origin" | number |
getMenuChildren |
(node : Required <MenuItem >, env : SpreadsheetChildEnv ) => FullMenuItem [] |
isMarkdownLink |
(str : string ) => boolean |
markdownLink |
(label : string , url : string ) => string |
numberToLetters |
(n : number ) => string |
parseMarkdownLink |
(str : string ) => Link |
positionToZone |
(position : Position ) => { bottom : HeaderIndex ; left : HeaderIndex ; right : HeaderIndex ; top : HeaderIndex } |
rgbaToHex |
(rgba : RGBA ) => Color |
toBoolean |
(value : undefined | null | string | number | boolean ) => boolean |
toCartesian |
(xc : string ) => Position |
toJsDate |
(value : undefined | null | string | number | boolean ) => Date |
toNumber |
(value : undefined | null | string | number | boolean ) => number |
toString |
(value : undefined | null | string | number | boolean ) => string |
toXC |
(col : HeaderIndex , row : HeaderIndex , rangePart : RangePart ) => string |
toZone |
(xc : string ) => Zone |
• invalidateEvaluationCommands: Set
<"UPDATE_CELL"
| "UPDATE_CELL_POSITION"
| "CLEAR_CELL"
| "DELETE_CONTENT"
| "SET_DECIMAL"
| "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_BORDER"
| "CREATE_CHART"
| "UPDATE_CHART"
| "REQUEST_UNDO"
| "REQUEST_REDO"
| "UNDO"
| "REDO"
| "ENABLE_NEW_SELECTION_INPUT"
| "DISABLE_SELECTION_INPUT"
| "UNFOCUS_SELECTION_INPUT"
| "FOCUS_RANGE"
| "ADD_EMPTY_RANGE"
| "REMOVE_RANGE"
| "CHANGE_RANGE"
| "COPY"
| "CUT"
| "PASTE"
| "AUTOFILL_CELL"
| "PASTE_FROM_OS_CLIPBOARD"
| "ACTIVATE_PAINT_FORMAT"
| "PASTE_CONDITIONAL_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"
| "SORT_CELLS"
| "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"
>
• readonlyAllowedCommands: Set
<"UPDATE_CELL"
| "UPDATE_CELL_POSITION"
| "CLEAR_CELL"
| "DELETE_CONTENT"
| "SET_DECIMAL"
| "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_BORDER"
| "CREATE_CHART"
| "UPDATE_CHART"
| "REQUEST_UNDO"
| "REQUEST_REDO"
| "UNDO"
| "REDO"
| "ENABLE_NEW_SELECTION_INPUT"
| "DISABLE_SELECTION_INPUT"
| "UNFOCUS_SELECTION_INPUT"
| "FOCUS_RANGE"
| "ADD_EMPTY_RANGE"
| "REMOVE_RANGE"
| "CHANGE_RANGE"
| "COPY"
| "CUT"
| "PASTE"
| "AUTOFILL_CELL"
| "PASTE_FROM_OS_CLIPBOARD"
| "ACTIVATE_PAINT_FORMAT"
| "PASTE_CONDITIONAL_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"
| "SORT_CELLS"
| "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"
>
• registries: Object
Name | Type |
---|---|
autofillModifiersRegistry |
Registry <AutofillModifierImplementation > |
autofillRulesRegistry |
Registry <AutofillRule > |
cellMenuRegistry |
MenuItemRegistry |
cellPopoverRegistry |
Registry <PopoverBuilders > |
cellRegistry |
Registry <CellBuilder > |
chartComponentRegistry |
Registry <fn > |
chartRegistry |
Registry <ChartBuilder > |
chartSidePanelComponentRegistry |
Registry <ChartSidePanel > |
clickableCellRegistry |
Registry <CellClickableItem > |
colMenuRegistry |
MenuItemRegistry |
corePluginRegistry |
Registry <CorePluginConstructor > |
figureRegistry |
Registry <FigureContent > |
functionRegistry |
FunctionRegistry |
inverseCommandRegistry |
Registry <InverseFunction > |
linkMenuRegistry |
MenuItemRegistry |
otRegistry |
OTRegistry |
rowMenuRegistry |
MenuItemRegistry |
sheetMenuRegistry |
MenuItemRegistry |
sidePanelRegistry |
Registry <SidePanelContent > |
topbarComponentRegistry |
TopBarComponentRegistry |
topbarMenuRegistry |
MenuItemRegistry |
uiPluginRegistry |
Registry <UIPluginConstructor > |
▸ astToFormula(ast
): string
Converts an ast formula to the corresponding string
Name | Type |
---|---|
ast |
AST |
string
▸ compile(formula
): CompiledFormula
Name | Type |
---|---|
formula |
string |
CompiledFormula
▸ convertAstNodes<T
>(ast
, type
, fn
): any
Allows to visit all nodes of an AST and apply a mapping function to nodes of a specific type. Useful if you want to convert some part of a formula.
e.g.
convertAstNodes(ast, "FUNCALL", convertFormulaToExcel)
function convertFormulaToExcel(ast: ASTFuncall) {
// ...
return modifiedAst
}
Name | Type |
---|---|
T |
extends "BIN_OPERATION" | "UNARY_OPERATION" | "FUNCALL" | "NUMBER" | "BOOLEAN" | "STRING" | "REFERENCE" | "UNKNOWN" |
Name | Type |
---|---|
ast |
AST |
type |
T |
fn |
(ast : Extract <ASTOperation , Object > | Extract <ASTUnaryOperation , Object > | Extract <ASTFuncall , Object > | Extract <ASTNumber , Object > | Extract <ASTBoolean , Object > | Extract <ASTString , Object > | Extract <ASTReference , Object > | Extract <ASTUnknown , Object >) => AST |
any
▸ findCellInNewZone(oldZone
, currentZone
): Position
This function will compare the modifications of selection to determine a cell that is part of the new zone and not the previous one.
Name | Type |
---|---|
oldZone |
Zone |
currentZone |
Zone |
Position
▸ load(data?
, verboseImport?
): WorkbookData
This function tries to load anything that could look like a valid workbookData object. It applies any migrations, if needed, and return a current, complete workbookData object.
It also ensures that there is at least one sheet.
Name | Type |
---|---|
data? |
any |
verboseImport? |
boolean |
WorkbookData
▸ parse(str
): AST
Parse an expression (as a string) into an AST.
Name | Type |
---|---|
str |
string |
AST
▸ setTranslationMethod(tfn
): void
Allow to inject a translation function from outside o-spreadsheet.
Name | Type | Description |
---|---|---|
tfn |
TranslationFunction |
the function that will do the translation |
void
▸ tokenize(str
): Token
[]
Name | Type |
---|---|
str |
string |
Token
[]