/** * Official Type definitions for Jspreadsheet Pro v10 * https://jspreadsheet.com/v10 */ declare function jspreadsheet(element: HTMLElement, options: jspreadsheet.Spreadsheet) : Array; declare namespace jspreadsheet { /** License string. Use setLicense to define the license */ let license: string; /** Default row height for a table */ let defaultRowHeight: number | string; /** The container that holds all spreadsheet instances in the screen */ let spreadsheet: Spreadsheet[]; /** The container that holds all extensions loaded */ let extensions: object; /** Advance excel like helpers */ let helpers: Helpers; /** Native editors. You can have extra entries not defined here when working with custom editors */ let editors: Editors; /** Internal method */ let picker: Function; /** History tracker controllers */ let history: History; /** Clipboard controller */ let clipboard: ClipBoard; /** Define the translations from english to any other language. Ex.{ 'hello': 'Ola', 'Successfully Saved': 'Salvo com sucesso' } */ function setDictionary(dictionary: object) : void; /** Set the license */ function setLicense(license: string) : void; /** Set extensions to the JSS spreadsheet. Example { formula, parser, render } */ function setExtensions(extensions: object) : void; /** Destroy the spreadsheet. Full destroy will clear all JSS controllers and it is not possible to re-create a new spreadsheet if true is used, until refresh the page. */ function destroy(element: HTMLElement, fullDestroy?: boolean) : void; /** Jspreadsheet parser extension. More info at: https://jspreadsheet.com/products */ function parser(options: any) : void; /** Jspreadsheet formula extension. More info at: https://jspreadsheet.com/products */ function formula(expression: string, variables: object, x: number, y: number, instance: worksheetInstance) : void; /** Jspreadsheet parser extension. More info at: https://jspreadsheet.com/products */ function render(element: HTMLElement, options: any) : void; /** Jspreadsheet forms extension. More info at: https://jspreadsheet.com/products */ function forms(options: any) : void; /** Jspreadsheet search extension. More info at: https://jspreadsheet.com/products */ function search() : void; /** Jspreadsheet importer extension. More info at: https://jspreadsheet.com/products */ function importer() : void; /** Jspreadsheet validations extension. More info at: https://jspreadsheet.com/products */ function validations() : void; /** Jspreadsheet bar extension. More info at: https://jspreadsheet.com/products */ function bar() : void; /** Get the current version */ function version(): object; interface ClipBoard { worksheet: worksheetInstance, value: string, selection: number[], cut: boolean, hash: string, } /** Images */ interface Image { src: string, top?: number, left?: number, width?: number, height?: number, } /** New column object */ interface newColumn { column?: number, data?: any[], options: Column, } /* New row object */ interface newRow { row?: number, data?: any[], options: Row, } /** Advance comments */ interface Comment { // User unique identification user_id?: number, // User name name?: string, // User image image?: string, // Date of the comments date?: string, } /** Global History */ interface History { /** History index cursor */ index: number; /** History items */ actions: []; /** When true the next item is cascaded in the same existing history element */ cascade: boolean; /** When true no history will be added to the tracker */ ignore: boolean; /** A history redo or undo is in progress */ progress: 'undo' | 'redo' | null; /** Undo last action */ undo: () => void; /** Redo most recent action */ redo: () => void; /** Reset history tracker */ reset: () => void; } /** Only available with the Validations extension */ interface Validation { /** Excel-like range format Sheet1!A1:A6 */ range: string; /** Validation type */ type: 'number' | 'text' | 'date' | 'list' | 'textLength' | 'empty' | 'notEmpty'; /** Validation action can be a warning or reject when the condition are not match or a format when the condition matches */ action: 'warning' | 'reject' | 'format'; /** Criteria to be match */ criteria: | '=' | '!=' | '>=' | '>' | '<=' | '<' | 'between' | 'not between' | 'valid date' | 'valid email' | 'valid url' | 'contains' | 'not contains' | 'begins with' | 'ends with' /** Custom message to the user */ text?: string; /** Ignore blank cells */ allowBlank?: boolean; /** For type: format you can apply some CSS when condition is matched */ format?: { color: string; 'background-color': string; 'font-weight': number; 'font-style': string; } /** For type: format you can add a class when condition is matched */ className?: string; /** Array with two positions, the second position used when criteria is between or not between. */ value?: number[] | string[], } /** Only available with the Validations extension */ interface Validations { // Index position in the array of validations index?: number | null; // The validation definition object value: Validation; } /** Native editors */ interface Editors { // Create a DOM element for a cell edition createEditor: (type: 'input'|'div', cellReference: HTMLElement, value: any, instance: worksheetInstance) => HTMLElement; // Create a DOM for a floating editor container createDialog: (cell: HTMLElement, value: any, x: number, y: number, instance: worksheetInstance) => HTMLElement; // Default editor for text and numbers general: Editor; text: Editor; number: Editor; numeric: Editor; percent: Editor; notes: Editor; dropdown: Editor; autocomplete: Editor; calendar: Editor; color: Editor; checkbox: Editor; radio: Editor; autonumber: Editor; progressbar: Editor; rating: Editor; email: Editor; url: Editor; image: Editor; html: Editor; hidden: Editor; tags: Editor; record: Editor; } /** Helpers */ interface Helpers { // Get caret position for editable dom element getCaretIndex: (element: HTMLElement) => number; // Invert the key and values in an object invert: (obj: object) => object; // Get the excel-like letter based on the index number getColumnName: (index: number) => string; // Get the cell name from its coordinates getCellNameFromCoords: (x: number, y: number) => string; // Aliases or getCellNameFromCoords getColumnNameFromCoords: (x: number, y: number) => string; // Get the coordinates from a cell name getCoordsFromCellName: (name: string) => [number, number]; // Alias for getCoordsFromCellName getCoordsFromColumnName: (name: string) => [number, number]; // Shift the formula by x and y positions in the matrix shiftFormula: (formula: string, x: number, y: number) => string; // Get all the token names from a excel-like range getTokensFromRange: (range: string) => string[]; // Get the range from an array of tokens getRangeFromTokens: (tokens: string[]) => string; // Get the coordinates as a number from a range string getCoordsFromRange: (range: string) => [number,number,number,number]; // Get range string from [x1,y1,x2,y2] getRangeFromCoords: (coords: [number,number,number,number]) => string; // Extract the configuration from JSS from a static HTML table createFromTable: (element: HTMLElement, options?: Worksheet) => Worksheet; // CSV string to JS array. delimiter default ',' parseCSV: (str: string, delimiter?: string) => string[]; } interface Tabs { /** Show the create new tab button */ allowCreate?: boolean; /** Allow drag and drop of the headers to change the tab position */ allowChangePosition?: boolean; /** Allow the header border bottom animation. */ animation?: boolean; /** Hide the tab headers if only one tab is present. */ hideHeaders?: boolean; /** Default padding content */ padding?: number; /** Position of the headers: top | bottom. Default: top */ position?: 'top' | 'bottom'; } interface Toolbar { /** Array of items for the toolbar */ items: Array; /** Responsive toolbar. Default: true. */ responsive?: boolean; } interface ToolbarItem { /** Toolbar item type */ type?: 'icon' | 'divisor' | 'label' | 'select'; /** Content of the toolbar element */ content?: string; /** Tooltip for the toolbar element */ tooltip?: string; /** Toolbar element width */ width?: number; /** The initial selected option for the type: select */ value?: string; /** Render method parser for the elements in the dropdown when type: select */ render?: Function; /** When a item is clicked */ onclick?: (el: HTMLElement, iconObject: object, toolbarItem: HTMLElement) => void; /** For the type select when a new item is selected */ onchange?: (el: HTMLElement, pickerObject: object, reservedValue: any, itemValue: string, itemKey: string, mouseEvent: object) => void; /** To update the state of the toolbar */ updateState?: (toolbarObject: object, toolbarItem: HTMLElement, option: any, extendOption: any) => void; } interface Dropdown { /** Endpoint to fetch data from a remote server */ url?: string; /** Preloaded data items for the dropdown */ data?: DropdownItem[]; /** Format type of the data, typically { id: name } or { value: text } */ format?: number; /** Indicates if multiple item selection is allowed */ multiple?: boolean; /** Enables the autocomplete feature for user input */ autocomplete?: boolean; /** Allows remote search for options */ remoteSearch?: boolean; /** Enables the lazy loading feature for handling a large number of options */ lazyLoading?: boolean; /** Rendering style of the dropdown: 'default', 'picker', or 'searchbar' */ type?: 'default' | 'picker' | 'searchbar', /** Defines the dropdown's width */ width?: number; /** Sets the maximum width of the dropdown */ maxWidth?: number; /** Determines if the dropdown is opened when initialized */ opened?: boolean; /** The initial value of the dropdown */ value?: string; /** Placeholder text for the dropdown */ placeholder?: string; /** Allows the user to add new options */ newOptions?: boolean; /** Internal controller for the dropdown's position */ position?: boolean; /** Event handler for value changes */ onchange?: (el: HTMLElement, obj: object, oldValue: string, newValue: string) => void; /** Event handler for when the dropdown is ready */ onload?: (el: HTMLElement, obj: object, data: any, val: any) => void; /** Event handler for when the dropdown opens */ onopen?: (el: HTMLElement) => void; /** Event handler for when the dropdown closes */ onclose?: (el: HTMLElement) => void; /** Event handler for when the dropdown receives focus */ onfocus?: (el: HTMLElement) => void; /** Event handler for when the dropdown loses focus */ onblur?: (el: HTMLElement) => void; /** Event handler for when a new option is added to the dropdown */ oninsert?: (obj: object, item: DropdownItem, newItem: DropdownItem) => void; /** Event handler for just before a new option is added to the dropdown */ onbeforeinsert?: (obj: object, item: DropdownItem) => void; /** Event handler for before a search on autocomplete is performed */ onbeforesearch?: (obj: object, ajaxRequest: object) => boolean | null; /** Event handler for processing search results */ onsearch?: (obj: object, result: object) => void; /** Toggles the sorting of dropdown elements */ sortResults?: boolean; /** Indicates if the dropdown should automatically receive focus upon creation */ autofocus?: boolean; } interface DropdownItem { /** Value of the selected item. */ id?: string | number; /** Label for the selected item. */ name?: string; /** Description of the item */ title?: string; /** Icon of the item */ image?: string; /** Name of the group where the item belongs to */ group?: string; /** Keywords to help finding one item */ synonym?: string[]; /** Item is disabled */ disabled?: boolean; /** Color for the item */ color?: string; } interface ContextmenuItem { /** Context menu item type: line | divisor | default */ type?: 'line' | 'divisor' | 'default'; /** Context menu item title */ title: string; /** Context menu icon key. (Material icon key icon identification) */ icon?: string; /** HTML id property of the item DOM element */ id?: string; /** Item is disabled */ disabled?: boolean; /** Onclick event for the contextmenu item */ onclick?: (instance: object, e: MouseEvent) => void; /** A short description or instruction for the item. Normally a shortcut. Ex. CTRL + C */ shortcut?: string; /** Show this text when the user mouse over the element */ tooltip?: string; /** Submenu */ submenu?: Array; } interface Contextmenu { /** The contextmenu menu */ (worksheet: worksheetInstance, x: number, y: number, e: MouseEvent, items: Array, section: string, section_argument1?: any, section_argument2?: any) : Array | boolean; } interface Calendar { /** Specifies the type of calendar to render. Default is 'default'. Possible values are 'default' and 'year-month-picker'. */ type?: 'default' | 'year-month-picker'; /** An array of numbers specifying a range of valid dates. Dates outside this range will be disabled. */ validRange?: number[]; /** Specifies the day of the week the calendar starts on, where 0 is Sunday and 6 is Saturday. Default is 0 (Sunday). */ format?: string; /** Specifies whether the calendar input is readonly or not. Default is false. */ readonly?: boolean; /** Specifies whether today's date is automatically selected when no date is defined. Default is false. */ today?: boolean; /** Specifies whether to display a dropdown for selecting hour and minute values. Default is false. */ time?: boolean; /** Specifies whether to display a reset button. Default is true. */ resetButton?: boolean; /** Specifies a placeholder text to display in the calendar input when no date is selected. */ placeholder?: string; /** Auto select confirms the current date as the new value onblur. Default: true */ autoSelect?: boolean; } interface DefinedNames { index: string; value: string; } /** * Cell object */ interface Records { // CELL td element element: HTMLTableCellElement; // Cached value of the cell v: string|number; // Readonly readonly: boolean; // Coordinate X x: number; // Coordinate Y y: number; // Associate to an array of values a?: any[][]; // Part of a merged cells merged?: any[]; // Style s?: number; // Comments c?: string|object; // Meta meta?: object; // Chain chain?: Map; } interface Column { /** Define the type of editor to use for the column. Can be a string to define a native editor, or a method to define a custom editor plugin. */ type?: Editor | 'autocomplete' | 'calendar' | 'checkbox' | 'color' | 'dropdown' | 'hidden' | 'html' | 'image' | 'numeric' | 'radio' | 'text' | 'notes'; /** The title of the column. */ title?: string; /** The name or path of a property when the data is a JSON object. */ name?: string; /** Define the tooltip text to display on mouseover for the column header. */ tooltip?: string; /** The width of the column. Default: 100px */ width?: number; /** Whether the column is visible. */ visible?: boolean, /** The alignment of the column content. Default: center. */ align?: 'center' | 'left' | 'right' | 'justify'; /** A method to overwrite the column definitions in real-time just before the column is edited. */ filterOptions?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, value: number|string, options: Column) => Column; /** The URL to load items from for the dropdown in this column, or when used in a text cell it will be a create a link */ url?: string; /** The items to show in the dropdown or autocomplete. */ source?: Array | Array | Array; /** Whether the column is an autocomplete field. */ autocomplete?: boolean; /** Whether the dropdown or autocomplete can accept multiple options. */ multiple?: boolean; /** The delimiter to use for separating multiple dropdown options. Default: ";". */ delimiter?: string; /** The input mask to apply to the data cell. @see https://jsuites.net/v4/javascript-mask */ mask?: string; /** The character to use as the decimal separator. */ decimal?: '.' | ','; /** The maximum number of characters to display in the cell before truncating. */ truncate?: number, /** Whether to disable the mask when editing. */ disabledMaskOnEdition?: boolean; /** A renderer method or rule for the cell content. */ render?: string | ((td: HTMLElement, value: number|string, x: number, y: number, worksheet: worksheetInstance, options: Column) => void); /** The format of the date or numbers in the cell. Default for the calendar: "DD/MM/YYYY". */ format?: string; /** Whether the column is a primary key. */ primaryKey?: boolean; /** Extended configuration for the column. */ options?: Calendar | Dropdown; /** Whether the column is read-only. */ readOnly?: boolean; /** Whether to process the raw data when copying or downloading. Default: true. */ process?: boolean; /** Whether to try to cast numbers from a cell text. Default: true. */ autoCasting?: boolean; /** Whether to shift the formula when copying and pasting. This option is only valid for custom column types. Default: false. */ shiftFormula?: boolean; /** Whether to wrap the text in the column. */ wrap?: boolean; /** The rotation angle for the text value, between -90 and 90. Default: null. */ rotate?: number; /** Whether to apply CSS odd-even background color to the column. Default: false. */ zebra?: boolean; /** The number of columns to group together. */ group?: number; /** State of the column group. */ state?: boolean; } interface Border { /** HTML Element for the border */ element: HTMLElement; /** Border color */ color: string; /** Used on the marching ants border */ moveLeft?: HTMLElement; /** Used on the marching ants border */ moveTop?: HTMLElement; /** Used on the marching ants border */ moveRight?: HTMLElement; /** Used on the marching ants border */ moveDown?: HTMLElement; /** Current x1 coordinates for the border */ x1: number; /** Current y1 coordinates for the border */ y1: number; /** Current x2 coordinates for the border */ x2: number; /** Current y2 coordinates for the border */ y2: number; /** Border is active in the viewport */ active: boolean; /** Position top of the border */ t: number; /** Position left of the border */ l: number; /** Current border width */ w: number; /** Current border height */ h: number; } interface Row { /** Height of the row in pixels. */ height?: number; /** Title or name of the row. */ title?: string; /** Determines whether the row is visible or not. */ visible?: boolean; /** Inline style for the row element (tr tag). */ style?: string; /** ID number that identifies the row. */ id?: number; /** Number of rows that this row is grouped with. */ group?: number; /** State of the row group (collapsed or expanded). */ state?: boolean; /** Determines whether the row is read-only or not. */ readOnly?: boolean; } interface RowInstance { /** Element */ element?: HTMLElement; /** Row height in pixels. */ height?: number; /** Row identification. */ visible?: boolean; /** RecordID for the row */ id?: number; /** Group row elements */ group?: number; /** Group row state */ state?: boolean; } interface Editor { /** createCell When a new cell is created. */ createCell: (cell: HTMLElement, value: any, x: number, y: number, instance: object, options: object) => any; /** updateCell When the cell value changes. */ updateCell: (cell: HTMLElement, value: any, x: number, y: number, instance: object, options: object) => any; /** openEditor When the user starts the edition of a cell. */ openEditor: (cell: HTMLElement, value: any, x: number, y: number, instance: object, options: object) => any; /** closeEditor When the user finalizes the edition of a cell. */ closeEditor: (cell: HTMLElement, confirmChanges: boolean, x: number, y: number, instance: object, options: object) => any; /** When a cell is destroyed. */ destroyCell: (cell: HTMLElement, x: number, y: number, instance: object) => void; /** Apply updates when the properties of a cell or column is changed. */ updateProperty: (x: number, y: number, instance: object, options: object) => void; /** Transform the raw data into processed data. It will shown a text instead of an id in the type dropdown for example. */ get: (options: object, value: any) => string } interface Plugin { /** When a new worksheet is added. */ beforeinit?: (worksheet: worksheetInstance) => void; /** When a new worksheet is added. */ init?: (worksheet: worksheetInstance) => void; /** It would receive a call for every spreadsheet event. */ onevent?: (event: string, a?: any, b?: any, c?: any, d?: any) => void; /** When the spreadsheet needs to save something in the server. */ persistence?: (method: string, args: object) => void; /** When the user opens the context menu. */ contextMenu?: (instance: worksheetInstance, x: number, y: number, e: MouseEvent, items:Array , section: string, a: any, b?: any) => void; /** When the toolbar is create and clicked. */ toolbar?: (instance: worksheetInstance, toolbar: Toolbar) => void; } interface Nested { /** Nested header title */ title?: string; /** Nested header tooltip */ tooltip?: string; /** Nested header colspan */ colspan?: number; /** Alignment */ align?: 'left' | 'center' | 'right'; /** Frozen */ frozen?: boolean; } interface Spreadsheet { /** Your application name */ application?: string; /** Render a remote spreadsheet from Jspreadsheet Cloud, which is a serveless hosting service. That can be generate at https://jspreadsheet.com/cloud */ cloud?: string; /** DOM element for binding the javascript events. This property is normally used when JSS is running as a web component. */ root?: HTMLElement; /** Global defined names. It defines global range variables. */ definedNames?: Record, /** Global sorting handler. */ sorting?: (direction: boolean, column: number) => (a: any, b: any) => number; /** Remote URL for the persistence server */ server?: string; /** Enable the toolbars */ toolbar?: boolean | 'extended' | Toolbar | Function; /** Allow table edition */ editable?: boolean; /** Allow data export */ allowExport?: boolean; /** Include the table headers in the first row of the data */ includeHeadersOnDownload?: boolean; /** Force update on paste for read-only cells */ forceUpdateOnPaste?: boolean; /** Enable loading spin when loading data. Default: false. */ loadingSpin?: boolean; /** Render jspreadsheet spreadsheet on full screen mode. Default: false */ fullscreen?: boolean; /** Make sure the formulas are capital letter. Default: true */ secureFormulas?: boolean; /** Enable formula debug. Default: false */ debugFormulas?: boolean, /** Execute formulas. Default: true */ parseFormulas?: boolean; /** Disable the formula editor. Default: true */ editorFormulas?: boolean; /** Auto increment cell data when using the corner copy, including formulas, numbers and dates. Default: true */ autoIncrement?: boolean; /** Try to cast numbers from cell values when executing formulas. Default: true */ autoCasting?: boolean; /** Remove any HTML from the data and headers. Default: true */ stripHTML?: boolean; /** Allow tabs. Default: false */ tabs?: boolean | Tabs; /** Allow the user to delete worksheets. Default: true */ allowDeleteWorksheet?: boolean; /** Allow the user to rename worksheets. Default: true */ allowRenameWorksheet?: boolean; /** Allow the user to drag and drop the worksheets. Default: true */ allowMoveWorksheet?: boolean; /** Move the cursor down when pressing enter during edition. Default: true */ moveDownOnEnter?: boolean; /** This method is called when the data in the spreadsheet is ready. */ onload?: (spreadsheet: spreadsheetInstance) => void; /** Spreadsheet is clicked */ onclick?: (worksheet: worksheetInstance, section: string, x: number, y: number, event: object) => void; /** When undo is applied */ onundo?: (worksheet: worksheetInstance, historyRecord: object) => void; /** When redo is applied */ onredo?: (worksheet: worksheetInstance, historyRecord: object) => void; /** Before any data is sent to the backend. Can be used to overwrite the data or to cancel the action when return false. */ onbeforesave?: (spreadsheet: spreadsheetInstance, worksheet: worksheetInstance, data: object) => boolean | object; /** After something is saved */ onsave?: (spreadsheet: spreadsheetInstance, worksheet: worksheetInstance, data: Array, result: object) => void; /** When something goes wrong during a persistence operation */ onerror?: (spreadsheet: spreadsheetInstance, result: object) => void; /** Before a column value is changed. NOTE: It is possible to overwrite the original value, by return a new value on this method. */ onbeforechange?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, value: any) => boolean | any; /** After a column value is changed. */ onchange?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, newValue: any, oldValue: any) => void; /** Event: onafterchanges(jspreadsheetHTMLElement, jspreadsheetInstance) */ onafterchanges?: (worksheet: worksheetInstance, records: Array) => void; /** When a copy is performed in the spreadsheet. Any string returned will overwrite the user data or return null to progress with the default behavior. */ oncopy?: (worksheet: worksheetInstance, selectedCells: Array, data: string) => boolean | string; /** Before the paste action is performed. Can return parsed or filtered data. It is possible to cancel the action when the return is false. */ onbeforepaste?: (worksheet: worksheetInstance, data: Array, x: number, y: number, properties: []) => boolean | []; /** After a paste action is performed in the spreadsheet. */ onpaste?: (worksheet: worksheetInstance, records: Array) => void; /** Before a new row is inserted. You can cancel the insert event by returning false. */ onbeforeinsertrow?: (worksheet: worksheetInstance, newRow: []) => boolean | newRow[] | void; /** After a new row is inserted. */ oninsertrow?: (worksheet: worksheetInstance, newRow: []) => void; /** Before a row is deleted. You can cancel the delete event by returning false. */ onbeforedeleterow?: (worksheet: worksheetInstance, rows: number[]) => number[] | boolean | void; /** After a row is excluded. */ ondeleterow?: (worksheet: worksheetInstance, rows: number[]) => void; /** Before a new column is inserted. You can cancel the insert event by returning false. */ onbeforeinsertcolumn?: (worksheet: worksheetInstance, newColumn: []) => boolean | newColumn[] | void; /** After a new column is inserted. */ oninsertcolumn?: (worksheet: worksheetInstance, affected: []) => void; /** Before a column is excluded. You can cancel the insert event by returning false. */ onbeforedeletecolumn?: (worksheet: worksheetInstance, cols: number[]) => number[] | boolean | void; /** After a column is excluded. */ ondeletecolumn?: (worksheet: worksheetInstance, cols: number[]) => void; /** After a row is moved to a new position. */ onmoverow?: (worksheet: worksheetInstance, origin: number, destination: number) => void; /** After a column is moved to a new position. */ onmovecolumn?: (worksheet: worksheetInstance, origin: number, destination: number) => void; /** After a height change for one or more rows. */ onresizerow?: (worksheet: worksheetInstance, row: number | Array, height: number | Array, oldHeight: number | Array) => void; /** After a column width change for one or more columns. */ onresizecolumn?: (worksheet: worksheetInstance, column: number | Array, width: number | Array, oldWidth: number | Array) => void; /** When the selection is changed. */ onselection?: (worksheet: worksheetInstance, px: number, py: number, ux: number, uy: number, origin?: object) => void; /** Before the comments is added or updated. Return false to cancel the event, void to accept the action or a object. */ onbeforecomments?: (worksheet: worksheetInstance, cells: object) => boolean | object | void; /** After a new comment is added or updated. */ oncomments?: (worksheet: worksheetInstance, newValues: object, previousValues: object) => void; /** It runs before sorting a column. It should return an array with a custom sorting or false to cancel the user action. */ onbeforesort?: (worksheet: worksheetInstance, column: number, direction: number, newOrderValues: []) => boolean | [] | void; /** When a column is sorted. */ onsort?: (worksheet: worksheetInstance, column: number, direction: number, newOrderValues: []) => void; /** When the spreadsheet gets the focus. */ onfocus?: (worksheet: worksheetInstance) => void; /** When the spreadsheet loses the focus. */ onblur?: (worksheet: worksheetInstance) => void; /** When merge cells is executed. */ onmerge?: (worksheet: worksheetInstance, newValue: object, oldValue: object) => void; /** When the header title is changed. */ onchangeheader?: (worksheet: worksheetInstance, column: number, newValue: string, oldValue: string) => void; /** When the footers are created or updated. */ onchangefooter?: (worksheet: worksheetInstance, newValue: string, oldValue: string) => void; /** When the value in a cell footer is changed. */ onchangefootervalue?: (worksheet: worksheetInstance, x: number, y: number, value: string) => void; /** When the footer cell is rendered */ onrenderfootercell?: (worksheet: worksheetInstance, x: number, y: number, value: string, td: HTMLElement) => void; /** On change nested headers */ onchangenested?: (worksheet: worksheetInstance, options: object) => void; /** On change nested cell properties */ onchangenestedcell?: (worksheet: worksheetInstance, x: number, y: number, properties: object) => void; /** When an editor is created. */ oncreateeditor?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, element: HTMLElement, options: object) => void; /** When the editor is opened. */ oneditionstart?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number) => void; /** When the editor is closed. */ oneditionend?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, newValue: any, save: boolean) => void; /** When the style of a cell is changed. */ onchangestyle?: (worksheet: worksheetInstance, newValue: object, oldValue: object) => void; /** When a cell meta information is added or updated. */ onchangemeta?: (worksheet: worksheetInstance, newValue: object) => void; /** Before the page is changed. Can cancel the action when return is false. */ onbeforechangepage?: (worksheet: worksheetInstance, pageNumber: number, oldPage: number, quantityPerPage: number) => boolean | void; /** When pagination is enabled and the user changes the page. */ onchangepage?: (worksheet: worksheetInstance, pageNumber: number, oldPageNumber: number, quantityPerPage: number) => void; /** Add or change the options of a new worksheet. */ onbeforecreateworksheet?: (worksheetOptions: Worksheet, options: object, position: number) => object; /** When the user creates a new worksheet. */ oncreateworksheet?: (worksheet: worksheetInstance, worksheetOptions: Worksheet, position: number) => void; /** When the user renames a worksheet. */ onrenameworksheet?: (worksheet: worksheetInstance, position: number, newValue: string, oldValue: string) => void; /** When the user deletes a worksheet. */ ondeleteworksheet?: (worksheet: worksheetInstance, position: number) => void; /** When the user updates the worksheet tab position. */ onmoveworksheet?: (worksheet: worksheetInstance, from: number, to: number) => void; /** When the user opens a worksheet. */ onopenworksheet?: (worksheet: worksheetInstance, index: number) => void; /** When there is a row id update */ onchangerowid?: (worksheet: worksheetInstance, rows: []) => void; /** Before the search method starts */ onsearchstart?: (worksheet: worksheetInstance, query: string) => void; /** Before the search method starts */ onsearchrow?: (worksheet: worksheetInstance, row: number, query: string) => boolean; /** Action to be executed before searching. The accepted method return would be: null to continue with the default behavior, false to cancel the user action or an array with the row numbers to overwrite the default result. */ onbeforesearch?: (worksheet: worksheetInstance, query: string, results: []) => [] | boolean | void; /** After the search is applied to the rows. */ onsearch?: (worksheet: worksheetInstance, query: string, results: []) => void; /** Action to be executed before filtering rows. It can cancel the action by returning false. */ onbeforefilter?: (worksheet: worksheetInstance, filters: [], data: []) => void; /** After the filter has been applied to the rows. */ onfilter?: (worksheet: worksheetInstance, filters: [], data: []) => void; /** When a new cell is created */ oncreatecell?: (worksheet: worksheetInstance, cell: HTMLElement, x: number, y: number, value: any) => void; /** When a new row is created */ oncreaterow?: (worksheet: worksheetInstance, rowNumber: number, tr: HTMLElement) => void; /** When a new column is created */ oncreatecolumn?: (worksheet: worksheetInstance, columnNumber: number, td: HTMLElement, options: Column) => void; /** A way to change the formula in real-time before execution */ onbeforeformula?: (worksheet: worksheetInstance, expression: string, x: number, y: number) => string | false | void; /** Get the information about the expressions executed from the formula chain */ onformulachain?: (worksheet: worksheetInstance, expressions: Array) => void; /** Customize the items available when filter editor is open. */ onopenfilter?: (worksheet: worksheetInstance, column: number, options: Array) => void | Array; /** When the viewport dimension is updated. */ onresize?: (worksheet: worksheetInstance, w: number, h: number) => void /** Intercept the ajax call before save. XHR ajax object */ onbeforesend?: (worksheet: worksheetInstance, xhr: object) => void /** When defined names is affected */ onchangedefinednames?: (worksheet: object, data: []) => void /** New char is entered on editor. */ oninput?: (worksheet: object, event: object) => void /** When change the row visibility */ onchangerowvisibility?: (worksheet: object, state: boolean, rows: []) => void /** When change the column visibility */ onchangecolumnvisibility?: (worksheet: object, state: boolean, columns: []) => void /** When a new row group is created */ ongrouprow?: (worksheet: object, row: number, numOfItems: number) => void /** When open a row group */ onopenrowgroup?: (worksheet: object, row: number) => void /** When close a row group */ oncloserowgroup?: (worksheet: object, row: number) => void /** When a new column group is created */ ongroupcolumn?: (worksheet: object, column: number, numOfItems: number) => void /** When open a column group */ onopencolumngroup?: (worksheet: object, column: number) => void /** When close a column group */ onclosecolumngroup?: (worksheet: object, column: number) => void /** General event handler */ onevent?: (worksheet: worksheetInstance, method: string, a?: any, b?: any, c?: any, d?: any, e?: any, f?: any) => any /** Return false to cancel the contextMenu event, or return custom elements for the contextmenu. */ contextMenu?: Contextmenu | null; /** The first row is the header titles when parsing a HTML table */ parseTableFirstRowAsHeader?: boolean; /** Try to identify a column type when parsing a HTML table */ parseTableAutoCellType?: boolean; /** Global cell wrapping. Default: false */ wordWrap?: boolean; /** About information */ about?: string | Function, /** License string */ license?: string | null; /** Worksheets */ worksheets?: Array; /** Validations */ validations?: Validation[]; /** Plugins */ plugins?: Record; /** Global style */ style?: string[]; /** Snap the cells to the grid when scrolling. Default: false */ snapToGrid?: boolean; /** Space between the table and the end of the container. Default: 100 */ spacing?: number; /** Pre calculation helps to calculate all formula and cache the results. Default true */ preCalculation?: boolean; } interface Worksheet { /** Logo URL */ logo?: string /** Load the data from an external server URL */ url?: string; /** Persistence URL or true when the URL is the same of the URL of the data source */ persistence?: string | boolean; /** Allow internal sequence for new rows */ sequence?: boolean; /** Load the data into a new spreadsheet from an array of rows or objects */ data?: Array> | Array>; /** Deprecated. Please use the data property. */ json?: Array>; /** Array with the rows properties definitions such as title, height. */ rows?: Row[] | Record; /** The column properties define the behavior of a column and the associated editor */ columns?: Array; /** Define the properties of a cell. This property overwrite the column definitions */ cells?: Record; /** Role of this worksheet */ role?: string, /** Nested headers definition */ nestedHeaders?: Array> | Array; /** Default column width. Default: 50px */ defaultColWidth?: number | string; /** Default row height. Default: null */ defaultRowHeight?: number | string; /** Deprecated. The default alignment of a cell is defined by a CSS class from 8.2.0+ */ defaultColAlign?: 'center' | 'left' | 'right' | 'justify'; /** Minimum number of spare rows. Default: 0 */ minSpareRows?: number; /** Minimum number of spare cols. Default: 0 */ minSpareCols?: number; /** Minimum table dimensions: [numberOfColumns, numberOfRows] */ minDimensions?: [number, number]; /** CSV data source URL */ csv?: string; /** CSV default filename for the jspreadsheet exports. Default: 'jspreadsheet' */ csvFileName?: string; /** Consider first line as header. Default: true */ csvHeaders?: boolean; /** Delimiter to consider when dealing with the CSV data. Default: ',' */ csvDelimiter?: string; /** Allow column sorting */ columnSorting?: boolean; /** Sorting the column on dblclick in the header. Default: true */ columnSortingOnDblClick?: boolean; /** Allow column dragging */ columnDrag?: boolean; /** Allow column resizing */ columnResize?: boolean; /** Allow row resizing */ rowResize?: boolean; /** Allow row dragging */ rowDrag?: boolean; /** Allow table edition */ editable?: boolean; /** Allow new rows */ allowInsertRow?: boolean; /** Allow new rows to be added using tab key. Default: true */ allowManualInsertRow?: boolean; /** Allow new columns to be added using enter key. Default: true */ allowInsertColumn?: boolean; /** Allow new rows to be added via script. Default: true */ allowManualInsertColumn?: boolean; /** Allow rows to be deleted. Default: true */ allowDeleteRow?: boolean; /** Allow all rows to be deleted. Warning: no rows left can lead to undesirabled behavior. Default: false */ allowDeletingAllRows?: boolean; /** Allow columns to be deleted. Default: true */ allowDeleteColumn?: boolean; /** Allow rename column. Default: true */ allowRenameColumn?: boolean; /** Allow users to add comments to the cells. Default: false */ allowComments?: boolean; /** Corner selection and corner data cloning. Default: true */ selectionCopy?: boolean; /** Merged cells. Default: null */ mergeCells?: Record; /** Allow search on the spreadsheet */ search?: boolean; /** Activate pagination and defines the number of records per page. Default: false */ pagination?: number | boolean; /** Dropdown for the user to change the number of records per page. Example: [10,25,50,100]. Default: false */ paginationOptions?: boolean | Array; /** Text Overflow. Default: false */ textOverflow?: boolean; /** Table overflow. Default: false */ tableOverflow?: boolean; /** Define the table overflow height. Example: '300px' */ tableHeight?: number | string; /** Define the table overflow width. Example: '800px' */ tableWidth?: number | string; /** Virtualization for columns. Works only when tableOverflow: true. Default: true */ virtualizationX?: boolean; /** Virtualization for rows. Works only when tableOverflow: true. Default: true */ virtualizationY?: boolean; /** Initial comments. Default: null */ comments?: Record; /** Initial meta information. Default: null */ meta?: Record; /** Style */ style?: Record; /** List of frozen column numbers. Should be a number or an array of consecutive numbers. Example: [4,5,6] */ freezeColumns?: number|number[]; /** List of frozen row numbers. Should be a number or an array of consecutive numbers. Example: [4,5,6] */ freezeRows?: number|number[]; /** Enable freeze column manual control. Default: false */ freezeColumnControl?: boolean, /** Enable freeze row manual control. Default: false */ freezeRowControl?: boolean, /** Deprecated. Call orderBy inside onload. */ orderBy?: [number, boolean]; /** Worksheet Unique Id. */ worksheetId?: string; /** Worksheet Name. */ worksheetName?: string; /** Worksheet state: hidden | null. Hide a worksheet */ worksheetState?: 'hidden' | undefined; /** Enable the column filters */ filters?: boolean; /** Footers */ footers?: Array; /** Apply mask on footers. Default: true */ applyMaskOnFooters?: boolean; /** Define options for the plugins. Each key should be the pluginName. */ pluginOptions?: Record; /** This is a internal controller for the spreadsheet locked properties. Please use editable to make it readonly. */ locked?: boolean; /** Allow the selection of unlocked cells. Default: true. */ selectUnLockedCells?: boolean; /** Allow the selection of locked cells. Default: true. */ selectLockedCells?: boolean; /** Enable resizable worksheet in on or both direction (horizontal | vertical | both). Default: none */ resize?: 'horizontal' | 'vertical' | 'both' | 'none' | undefined; /** Wrap. Default: false */ wrap?: boolean; /** Show the worksheet gridlines. Default: true */ gridline?: boolean; /** Floating images */ images?: Image[]; } interface spreadsheetInstance { /** Spreadsheet configuration */ config: Spreadsheet; /** Contextmenu HTMLElement */ contextmenu: HTMLElement; /** DOM Element */ el: HTMLElement; /** DOM Element. Alias for el */ element: HTMLElement; /** DOM Element container for the filters */ filter: HTMLElement; /** Toggle the full screen mode */ fullscreen: (state: Boolean) => void; /** HTMLElement Helper */ helper: HTMLElement, /** Ignore events */ ignoreEvents: boolean; /** Ignore persistence events */ ignorePersistence: boolean; /** HTMLElement editor container */ input: HTMLElement; /** HTMLElement loading element */ loading: HTMLElement; /** Spreadsheet unique name */ name: string; /** List of plugins loaded to the spreadsheet */ plugins: Record; /** Processing flag. It would be true when the spreadsheet is loading. */ processing: boolean; /** Show progressbar */ progress: (state: boolean) => void; /** Queue of formulas used during the loading */ queue: Map; /** Undo */ undo: () => void; /** Redo */ redo: () => void; /** DOM Textarea helper */ textarea: HTMLElement; /** DOM toolbar */ toolbar: HTMLElement; /** Tools HTMLElement container */ tools: HTMLElement; /** Worksheets container */ worksheets: Array; /** Load plugins into the spreadsheet */ setPlugins: (plugins: Record) => void; /** Internal method: event dispatch controllers. */ dispatch: (...args: string[]) => void; /** Get the spreadsheet configuration */ getConfig: () => Spreadsheet; /** Get the worksheet index by instance or worksheetId */ getWorksheet: (worksheetIdent: worksheetInstance | string) => number; /** Get the worksheet name */ getWorksheetName: (position: number) => string; /** Open a worksheet */ openWorksheet: (position: number) => void; /** Create a new worksheet */ createWorksheet: (worksheetOptions: Worksheet, position?: Number) => worksheetInstance; /** Delete an existing worksheet by its position */ deleteWorksheet: (position: number) => void; /** Rename an existing worksheet by its position */ renameWorksheet: (position: number, title: string) => void; /** Move the position of a worksheet. ignoreDomUpdates: true will block updates to the DOM */ moveWorksheet: (from: number, to: number, ignoreDomUpdates?: boolean) => void; /** Get the active worksheet when applicable */ getWorksheetActive: () => number; /** Get the worksheet instance by its position */ getWorksheetInstance: (position: number) => worksheetInstance; /** Parse the toolbar definitions with defaults */ getToolbar: (toolbar: Toolbar) => object, /** Set the toolbar */ setToolbar: (toolbar: Toolbar) => void; /** Show the toolbar */ showToolbar: () => void; /** Hide the toolbar */ hideToolbar: () => void; /** Refresh the toolbar based on the current worksheet */ refreshToolbar: () => void; /** Internal validations cache */ validations: () => void; } interface worksheetInstance { /** Array with the borders information */ borders: Border[]; /** Close the edition for one cell */ closeEditor: (cell: HTMLElement, save: boolean) => void; /** Close the filters */ closeFilters: (update: boolean) => void; /** Array with the HTML element references that define the columns */ colgroup: HTMLElement[]; /** Hold the colgroup container */ colgroupContainer: HTMLElement; /** DOM Worksheet container */ content: HTMLElement; /** Copy */ copy: (cut?: boolean) => void; /** HTML Element for the handler fill */ corner: HTMLElement; /** Internal selected cell */ cursor: object; /** Cut */ cut: () => void; /** Alias to getData */ data: (highlighted?: boolean, processed?: boolean, delimiter?: string, asJson?: boolean) => Array> | Array> | string | null; /** Internal use control type to defined JSON (1) or ARRAY (0). */ dataType: number, /** Delete one more more columns */ deleteColumn: (columnNumber: number|number[], numOfColumns?: number) => void; /** Delete an existing row or rows */ deleteRow: (rowNumber: number|number[], numOfRows?: number) => void; /** Destroy all merged cells */ destroyMerged: () => void; /** Legacy alias destroyMerged */ destroyMerge: () => void; /** Internal method: event dispatch controllers. */ dispatch: (...args: string[]) => void; /** Navigation down */ down: (shiftKey?: boolean, ctrlKey?: boolean, jump?: boolean) => void; /** If extension render exists, execute render extension else download CSV */ download: (includeHeaders?: boolean, processed?: boolean) => void; /** Download CSV */ downloadCSV: (includeHeaders?: boolean, processed?: boolean) => void; /** Edition controllers */ edition?: []; /** DOM Worksheet. Alias for worksheet */ element: HTMLElement; /** Internal method: Execute a formula. */ executeFormula: (expression: string, x?: number, y?: number, caching?: boolean, basic?: boolean) => void; /** Navigation first */ first: (shiftKey?: boolean, ctrlKey?: boolean) => void; /** Internal footer controllers */ footers: Record; /** Toggle the fullscreen mode */ fullscreen: (state: boolean) => void; /** Get the border */ getBorder: (alias: string) => object; /** Get the cell element from the cellName or via its coordinates x,y */ getCell: (cellNameOrColumnNumber: string|number, y?: number) => HTMLElement | null; /** Alias to getCell */ getCellFromCoords: (x: number, y: number) => HTMLElement | null; /** Get attributes from one cell when applicable */ getCells: (cellName: string) => Column; /** Get the column object by its position */ getColumn: (position: number) => Column; /** Get the column data from its number */ getColumnData: (col: number, processed?: boolean) => Array; /** Get the column position by its name */ getColumnIdByName: (name: string) => number; /** Alias for getProperties */ getColumnOptions: (x: number, y?: number) => Column; /** Get the comments from one cell or multiple cells. Example: getComments('A1') */ getComments: (cellName?: string) => string | object; /** Get the worksheet settings */ getConfig: () => Worksheet; /** * Get the worksheet data * * @param {boolean} only the selected cells * @param {boolean} get the raw or processed data * @param {string} delimiter to get the data as a string with columns separate by the char delimiter. * @param {boolean} get the data as a JSON object. * @return {array|string|null} array or string */ getData: (highlighted?: boolean, processed?: boolean, delimiter?: string, asJson?: boolean) => Array> | Array> | string | null; /** Get the defined name or all defined names when key is null */ getDefinedNames: (key?: string) => object; /** Internal method: Get the editor for one cell */ getEditor: (x: number, y: number) => Column; /** Internal method: Get the filter */ getFilter: (column: number) => Array; /** Get the footers configuration */ getFooter: () => Array; /** Get the footer value */ getFooterValue: (x: number, y: number) => any; /** Get the header title */ getHeader: (columnNumber: number) => string; /** Get all header elements */ getHeaders: (asArray: boolean) => Array; /** Get the height of one row by its position when height is defined. */ getHeight: (row?: number) => Array | number; /** Get the highlighted coordinates */ getHighlighted: () => null | Array; /** Get the data as JSON. */ getJson: (h?: boolean, processed?: boolean, delimiter?: boolean, asJson?: boolean) => any; /** Get the processed data cell shown to the user by the cell name or coordinates. */ getLabel: (cellNameOrColumnNumber: string|number, y?: number, extended?: boolean) => string; /** Aliases for getLabel */ getLabelFromCoords: (cellNameOrColumnNumber: string|number, y?: number, extended?: boolean) => string; /** Get the merged cells. Cell name: A1, A2, etc or null for all cells */ getMerge: (cellName?: string) => object | Array; /** Get one or all meta information for one cell. */ getMeta: (cellName: string, property: string) => object; /** Get the nested cells */ getNestedCell: (x: number, y: number, properties?: any) => object; /** Get the nested headers */ getNestedHeaders: () => []; /** Get the next available number in the sequence */ getNextSequence: () => number; /** Alias to getProperty */ getOptions: (x: number, y?: number) => Column; /** Get the primaryKey column when applicable. */ getPrimaryKey: () => number; /** Get processed data by the coordinates of the cell. Extended process a color, progressbar and rating as raw. */ getProcessed: (x: number, y: number, extended?: boolean) => any; /** Get the properties for one column when only x is present or the cell when x and y is defined. */ getProperties: (x: number, y?: number) => Column; /** Deprecated. Legacy alias to getProperties */ getProperty: (x: number, y?: number) => Column; /** Get the selection in a range format */ getRange: () => string; /** Get a row data or meta information by Id. */ getRowById: (row: number, element: boolean) => Row; /** Get the data from one row */ getRowData: (row: number, processed: boolean) => any[]; /** Get the row id from its position */ getRowId: (row: number) => number; /** * Get the selected cells * @param {boolean?} columnNameOnly - Return an array of cell names or cell DOM elements * @param {boolean?} ignoreHidden - Ignore hidden cells */ getSelected: (columnNameOnly?: boolean, ignoreHidden?: boolean) => any[]; /** Get the coordinates of the main selection */ getSelection: () => null | Array; /** Get the selected columns indexes */ getSelectedColumns: (visibleOnly?: boolean) => number[]; /** Get the selected rows indexes. */ getSelectedRows: (visibleOnly?: boolean) => number[]; /** Get the style from a cell or all cells. getStyle() or getStyle('A1') */ getStyle: (cellName?: string|null, onlyIndexes?: boolean) => string|object; /** Get value by the cell name or object. The value can be the raw or processed value. */ getValue: (cell: string, processed: boolean) => string; /** Get value by the coordinates. The value can be the raw or processed value. */ getValueFromCoords: (x: number, y: number, processed: boolean) => any; /** Get the width of one column by index or all column width as an array when index is null. */ getWidth: (x?: number) => Array | number; /** Go to the row number, [col number] */ goto: (y: number, x?: number) => void; /** Hold the header container */ headerContainer: HTMLElement; /** Array with the header DOM elements */ headers: Array; /** Hide column */ hideColumn: (column: number|number[]) => void; /** Hide the filters from one or all columns. */ hideFilter: (colNumber?: number) => void; /** Hide index column */ hideIndex: () => void; /** Hide row */ hideRow: (row: number|number[]) => void; /** Hide the search container */ hideSearch: () => void; /** * Add new column(s) * @param {number|object[]} column - number of columns or array with column information * @param {number?} columnNumber - reference when the first argument is a number * @param {boolean?} insertBefore - insertBefore when the first argument is a number */ insertColumn: (column?: number | newColumn[], columnNumber?: number, insertBefore?: boolean) => void; /** * Add new row(s) * @param {number|object[]} row - number of rows or array with row information * @param {number?} rowNumber - reference when the first argument is a number * @param {boolean?} insertBefore - insertBefore when the first argument is a number */ insertRow: (row?: number | newRow[], rowNumber?: number, insertBefore?: boolean) => void; /** Check if cell is attached to the DOM */ isAttached: (x: number, y: number) => boolean; /** The worksheet is editable */ isEditable: () => boolean; /** Check if cell is readonly or not. State used to set the state */ isReadOnly: (cellName: string, state?: boolean) => boolean; /** Verify if this coordinates is within a selection or blank for the current selection */ isSelected: (x: number, y: number, selection?: number[]) => boolean; /** Navigation last */ last: (shiftKey?: boolean, ctrlKey?: boolean) => void; /** Navigation left */ left: (shiftKey?: boolean, ctrlKey?: boolean, jump?: boolean) => void; /** Dynamic load data to the spreadsheet. This method does not trigger events or persistence and reset the spreadsheet. To persist use setData. */ loadData: (data: any[]) => void; /** Move one or more columns to another position */ moveColumn: (col: number, to: number, quantityOfColumns?: number) => void; /** Move one or more rows to another position */ moveRow: (row: number, to: number, quantityOfRows?: number) => void; /** Get the column name */ name: (col: number) => string; /** Start the edition for one cell */ openEditor: (cell: HTMLElement, empty?: boolean, mouseEvent?: object) => void; /** Open the filters */ openFilter: (column: number) => void; /** Worksheet configuration */ options: Worksheet; /** Sort one column by its position. ASC (0) or DESC (1) */ orderBy: (column: number, direction: boolean, internalValueController?: any[], internalPreviousStateController?: boolean) => void; /** Change page when using pagination */ page: (pageNumber: number, callBack?: Function) => void; /** Current page number */ pageNumber: number; /** Pagination DOM container */ pagination: HTMLElement; /** Spreadsheet object */ parent: spreadsheetInstance; /** Paste */ paste: (x: number, y: number, data: string | any[]) => void; /** Get the quantity of pages when pagination is active */ quantityOfPages?: () => number; /** Array container for all cell DOM elements */ records: Records[][]; /** Refresh the borders by the border name */ refreshBorders: (border?: string) => void; /** Refresh footers */ refreshFooter: () => void; /** Remove the merged cells by the cell name or a object with all cells to be removed. */ removeMerge: (cellName: string | object) => void; /** Reset the borders by name border name */ resetBorders: (border: string, resetPosition: boolean) => void; /** Reset the filter of one or all columns */ resetFilters: (colNumber?: number) => void; /** Destroy the footers */ resetFooter: () => void; /** Destroy freeze columns */ resetFreezeColumns: () => void; /** Reset meta data of one or multiple cells. Null for all cells */ resetMeta: (cellName?: string[]|string) => void; /** Reset nested headers */ resetNestedHeaders: () => void; /** Reset the search */ resetSearch: () => void; /** Reset the main selection */ resetSelection: () => void; /** Get the style from one cell. Ex. resetStyle('A1') */ resetStyle: (cell?: string) => void; /** DOM array of results */ results: Array | null; /** Navigation right */ right: (shiftKey?: boolean, ctrlKey?: boolean, jump?: boolean) => void; /** Rotate the spreadsheet cell text. cell = A1, B1... etc */ rotate: (cell: string|string[], value:number) => void; /** Array of row objects */ rows: RowInstance[] | Record; /** Persistence helper method. The callback is executed with a JSON from the server */ save: (url: string, data: object, token?: string, callback?: (result: object) => void) => void; /** ScrollX DOM Element */ scrollX: HTMLElement; /** ScrollY DOM Element */ scrollY: HTMLElement; /** Search for something */ search: (str: string) => void; /** Search HTML container */ searchContainer: HTMLElement; /** Search HTML input */ searchInput: HTMLElement; /** Select All */ selectAll: () => void; /** Selected cells */ selectedCell: any[]; /** Internal record id sequence */ sequence: number; /** Set borders with a border name and color. */ setBorder: (x1: number, y1: number, x2: number, y2: number, border?: string, color?: string) => void; /** Set attributes for one cell */ setCells: (cellName: string, settings: Column) => void; /** Set the column data from its number */ setColumnData: (col: number, data: any[], force?: boolean) => void; /** Set the comments for one or multiple cells */ setComments: (cellName: string | Record, comments?: string) => void; /** Change the worksheet settings */ setConfig: (config: Worksheet) => void; /** Set the worksheet data */ setData: (data: any[]) => void; /** Set the defined name */ setDefinedNames: (names: DefinedNames[]) => void; /** Set filter */ setFilter: (colNumber: number, keywords: any[]) => void; /** Set the footers */ setFooter: (data: []) => void; /** Set the footer value */ setFooterValue: (col: number, row: number, value: any) => void; /** List of columns to freeze. Should be a number or an array of consecutive numbers. Example: [4,5,6] */ setFreezeColumns: (num: number|number[]) => void; /** Set the header title. Empty or null to reset to the default header value. */ setHeader: (x: number, title?: string) => void; /** Set the height of one row by its position. currentHeight is for internal use only */ setHeight: (row: number|number[], height: number|number[], currentHeight?: number|number[]) => void; /** Get the merged cells. Cell name: A1, A2, etc */ setMerge: (cellName: string | object, colspan?: number, rowspan?: number) => void; /** Get one or various meta information for one cell. */ setMeta: (cell: string | object, property?: string, value?: string) => void; /** Set the nested headers */ setNestedHeaders: (config: any[]) => void; /** Deprecated. Alias for parent.setPlugins */ setPlugins: (plugins: Record) => void; /** Set the properties for a column or cell */ setProperties: (columnNumber: number, rowNumberOrColumnSettings: number|Column, settings?: Column) => void; /** Set or reset the cell as readonly */ setReadOnly: (cellName: string, state: boolean) => void; /** Set the data from one row */ setRowData: (row: number, data: any[], force: boolean) => void; /** Set the row id from its position */ setRowId: (row: number, newId: number) => void; /** Set the style for one cell. Ex. setStyle('A1', 'background-color', 'red') */ setStyle: (cell: string | object, property?: string, value?: string, forceOverwrite?: boolean) => void; /** * Set a cell value * * @param {string|string[]|object} cell destination cell * @param {string|number} value * @param {boolean} force value over readonly cells * @return void */ setValue: (cell: string|string[]|object, value?: string|number, forceOverwrite?: boolean) => void; /** * Set a cell value * * @param {number} x * @param {number} y * @param {string|number} value value * @param {boolean} force value over readonly cells * @return void */ setValueFromCoords: (x: number, y: number, value: string|number, force?: boolean) => void; /** Set viewport width and height */ setViewport: (width: number, height: number) => void; /** Set the width of one column by its position */ setWidth: (col: number|number[], width: number|number[]) => void; /** Show column */ showColumn: (column: number|number[]) => void; /** Show filter controls for one column or all columns */ showFilter: (column?: number) => void; /** Show index column */ showIndex: () => void; /** Show row */ showRow: (row: number|number[]) => void; /** Hide the search container */ showSearch: () => void; /** DOM Worksheet table */ table: HTMLElement; /** DOM Worksheet table thead */ thead: HTMLElement; /** DOM Worksheet table tbody */ tbody: HTMLElement; /** DOM Worksheet table tfoot */ tfoot: HTMLElement; /** Navigation up */ up: (shiftKey?: boolean, ctrlKey?: boolean, jump?: boolean) => void; /** * Internal method: Internal method: Set a cell value * * @param {number} x * @param {number} y * @param {string} value value * @param {string} force value over readonly cells * @return void */ updateCell: (x: number, y: number, value: string, force?: boolean) => void; /** Internal method: update cells in a batch */ updateCells: (o: Array>) => void; /** Update the selection based on two DOM cell elements */ updateSelection: (el1: HTMLElement, el2?: HTMLElement, origin?: boolean) => void; /** Update the selection based on coordinates */ updateSelectionFromCoords: (x1: number, y1: number, x2?: number, y2?: number, origin?: boolean, type?: string, color?: string) => void; /** Getter/setter the value by coordinates */ value?: (x: number, y: number, value?: any) => void; /** Which page the row number is */ whichPage?: (row: number) => number; /** Create a new group of rows */ setRowGroup: (row: number, numOfItems?: number) => void; /** Open a new group of rows */ openRowGroup: (row: number) => void; /** Close a new group of rows */ closeRowGroup: (row: number) => void; /** Reset a group of rows */ resetRowGroup: (row: number) => void; /** Create a new group of columns */ setColumnGroup: (column: number, numOfItems?: number) => void; /** Open a new group of columns */ openColumnGroup: (column: number) => void; /** Close a new group of columns */ closeColumnGroup: (column: number) => void; /** Reset a group of columns */ resetColumnGroup: (column: number) => void; /** Resize the given column numbers based on their content. */ autoResize: (column: number[]) => void; /** Aliases for jspreadsheet.helpers. Tools to handle spreadsheet data */ helpers: Helpers; /** Internal persistence handler */ persistence: Function; /** Deprecated. Alias for parent.undo */ undo: () => void; /** Deprecated. Alias for parent.redo */ redo: () => void; /** Internal formula tracking */ tracking?: number[]; /** Visible columns on the viewport */ visibleRows?: number[]; /** Visible columns on the viewport */ visibleCols?: number[]; /** Viewport current width */ width?: number; /** Viewport current width */ height?: number; /** Get the row object */ getRow: (row: number) => RowInstance; /** Internal worksheet onload method */ onload?: () => void; /** Internal nested headers DOM container */ nested?: object; /** List of rows to freeze. Should be a number or an array of consecutive numbers. Example: [4,5,6] */ setFreezeRows: (numberOfRows: number|number[]) => void; /** Reset the freeze rows */ resetFreezeRows: () => void; /** Reset the properties of a cell */ resetProperty: (x: number, y: number) => void; /** Internal method */ setFormula: () => void; /** Update nested cell properties */ setNestedCell: (x: number, y: number, properties: Nested) => void; /** Get a validation object. Require the extension Validations. */ getValidations: (validationIndex: number | null) => Validation | Validation[]; /** Insert or update existing validations by index. Require the extension Validations. */ setValidations: (validations: Validations[]) => void; /** Reset validations by validation indexes. Require the extension Validations. Undefined will remove all validations */ resetValidations: (validationIndex?: number | number[]) => void; /** Load all validations rules from a cell based on its coordinates. */ loadValidations: (xOrCell: number|object, y?: number) => object[]; /** This method returns true if a cell fails to meet all the defined validation criteria. If invoked without arguments, this method will scan the entire worksheet and return true if it detects validation errors. */ hasErrors: (col?: number|object, row?: number) => boolean; /** Resize columns to match the visible content */ autoWidth: (columns: number[]) => void; /** Show the column headers */ showHeaders: () => void; /** Hide the column headers */ hideHeaders: () => void; /** Refresh the search on the viewport */ updateSearch: () => void; /** Get the worksheet index by instance or worksheetId */ getWorksheet: (worksheetIdent: worksheetInstance | string) => number; /** Get the worksheet name */ getWorksheetName: (position?: number) => string; /** Open a worksheet */ openWorksheet: (position?: number) => void; /** Create a new worksheet */ createWorksheet: (worksheetOptions: Worksheet, position?: Number) => worksheetInstance; /** Delete an existing worksheet by its position */ deleteWorksheet: (position?: number) => void; /** Rename an existing worksheet by its position */ renameWorksheet: (position: number, title: string) => void; /** Move the position of a worksheet. ignoreDomUpdates: true will block updates to the DOM */ moveWorksheet: (from: number, to: number, ignoreDomUpdates?: boolean) => void; /** Get the active worksheet when applicable */ getWorksheetActive: () => number; /** Get the worksheet instance by its position */ getWorksheetInstance: (position: number) => worksheetInstance; /** Parse the toolbar definitions with defaults */ getToolbar: (toolbar: Toolbar) => object, /** Set the toolbar */ setToolbar: (toolbar: Toolbar) => void; /** Show the toolbar */ showToolbar: () => void; /** Hide the toolbar */ hideToolbar: () => void; /** Refresh the toolbar based on the current worksheet */ refreshToolbar: () => void; /** Add, update or delete a new worksheet floating image */ setImage: (index: number, info: Image) => void; /** Add a global formula to the tracking system. Use from formula pro. Only use if necessary. */ setTracking: () => void; } } export default jspreadsheet;