JssHelpers
createFromTable
Extract the configuration to create a new spreadsheet from a static HTML element. 来自 JssHelpers
/**
* Extract the configuration to create a new spreadsheet from a static HTML element.
* @param element - Table element.
* @param options - Worksheet options.
*/
createFromTable: (element: HTMLTableElement, options: WorksheetOptions) => WorksheetOptions;
getCaretIndex
Internal method. 来自 JssHelpers
/**
* Internal method.
*/
getCaretIndex: (e: any) => number;
getColumnName
Get the column letter(s) based on its index. 来自 JssHelpers
/**
* Get the column letter(s) based on its index.
* @param i - Column index.
*/
getColumnName: (i: number) => string;
getCellNameFromCoords
Get "A1" style coordinates based on column and row indices. 来自 JssHelpers
/**
* Get "A1" style coordinates based on column and row indices.
* @param x - Column index.
* @param y - Row index.
*/
getCellNameFromCoords: (x: number, y: number) => string;
getCoordsFromCellName
Get column and row indices based on coordinate in "A1" style. 来自 JssHelpers
/**
* Get column and row indices based on coordinate in "A1" style.
* @param columnName - Coordinate in "A1" style.
*/
getCoordsFromCellName: (columnName: string) => [number, number | null] | undefined;
getCoordsFromRange
Get coordinates from a range. 来自 JssHelpers
/**
* Get coordinates from a range.
* @param range - Range in "A1:B2" style.
* @returns Array filled with the x and y coordinates of the first and last cells in the range.
*/
getCoordsFromRange: (range: string) => [number, number, number, number];
invert
Internal method. 来自 JssHelpers
/**
* Internal method.
*/
invert: (o: object) => any[] & Record<string, any>;
parseCSV
Parse CSV string to JS array. 来自 JssHelpers
/**
* Parse CSV string to JS array.
* @param str - Text in csv format.
* @param delimiter - Csv delimiter.
*/
parseCSV: (str: string, delimiter?: string) => string[][];
CustomEditor
closeEditor
Event responsible for closing the editor of a cell with a custom editor. 来自 CustomEditor
/**
* Event responsible for closing the editor of a cell with a custom editor.
* @param cell - Td tag whose editor should close.
* @param save - If true, the value returned by this event will be the cell's new value. Otherwise, the value returned by this event is ignored.
* @param x - Cell column index.
* @param y - Cell row index.
* @param instance - Worksheet instance.
* @param options - Column configuration object.
* @returns New cell value.
*/
closeEditor?: (cell: HTMLTableCellElement, save: boolean, x: number, y: number, instance: WorksheetInstance, options: Column) => CellValue | void;
createCell
Event called when creating new cells. 来自 CustomEditor
/**
* Event called when creating new cells.
* @param cell - HTML element prepared to be the new cell.
* @param value - Cell value.
* @param x - Cell column index.
* @param y - Cell row index.
* @param instance - Worksheet instance.
* @param options - Column configuration object.
* @returns HTML element that will be the new cell.
*/
createCell?: (cell: HTMLTableCellElement, value: CellValue, x: number, y: number, instance: WorksheetInstance, options: Column) => HTMLTableCellElement | void;
openEditor
Event responsible for opening the editor of a cell with a custom editor. 来自 CustomEditor
/**
* Event responsible for opening the editor of a cell with a custom editor.
* @param cell - Td tag whose editor should open.
* @param value - Cell value.
* @param x - Cell column index.
* @param y - Cell row index.
* @param instance - Worksheet instance.
* @param options - Column configuration object.
* @param e - Event that called this method.
*/
openEditor?: (
cell: HTMLTableCellElement,
value: CellValue,
x: number,
y: number,
instance: WorksheetInstance,
options: Column,
e: KeyboardEvent | MouseEvent | TouchEvent | undefined
) => void;
updateCell
Event called before changing the value of a cell. 来自 CustomEditor
/**
* Event called before changing the value of a cell.
*
* The returned value will be the cell's new value.
* @param cell - Cell whose value has changed.
* @param value - New value.
* @param x - Cell column index.
* @param y - Cell row index.
* @param instance - Worksheet instance.
* @param options - Column configuration object.
*/
updateCell?: (
cell: HTMLTableCellElement,
value: CellValue | undefined,
x: number,
y: number,
instance: WorksheetInstance,
options: Column
) => CellValue | void;
WorksheetInstance
ads
来自WorksheetInstance
ads: HTMLDivElement;
closeEditor
来自WorksheetInstance
/**
* Close a cell editor.
* @param cell - HTML td tag whose editor must be closed.
* @param save - Whether or not to save editor content in cell.
*/
closeEditor: (cell: HTMLTableCellElement, save: boolean) => void;
cols
来自WorksheetInstance
/**
* List of "col" tags for this spreadsheet's table
*/
cols: {
colElement: HTMLTableColElement,
x: number,
}[];
colgroupContainer
来自WorksheetInstance
/**
* Colgroup tag for this spreadsheet's table
*/
colgroupContainer: HTMLElement;
content
来自WorksheetInstance
content: HTMLDivElement;
copy
来自WorksheetInstance
/**
* Copies or cuts the contents of selected cells in the worksheet.
* @param cut - If true, the operation is cut, if not, it is copy.
*/
copy: (cut?: boolean) => void;
corner
来自WorksheetInstance
/**
* HTML element that sits in the lower-right corner of selections.
*/
corner: HTMLDivElement;
createWorksheet
来自WorksheetInstance
/**
* Create a new worksheet.
* @param options - Worksheet options.
*/
createWorksheet: (options: WorksheetOptions) => void;
cursor
来自WorksheetInstance
cursor: null | HTMLElement;
data
来自WorksheetInstance
/**
* Last content copied.
*/
data: string;
deleteColumn
来自WorksheetInstance
/**
* Remove columns.
*
* This method returns false if the {@link SpreadsheetOptions.onbeforedeletecolumn} event returns false or if the "This action will destroy any existing merged cells. Are you sure?" dialog receives a negative response.
* @param columnNumber - Column index from which removal starts.
* @param numOfColumns - Number of columns to be removed.
*/
deleteColumn: (
columnNumber?: number,
numOfColumns?: number
) => false | undefined;
deleteRow
来自WorksheetInstance
/**
* Remove rows.
*
* This method returns false if the {@link SpreadsheetOptions.onbeforedeleterow} event returns false or if the dialog cases "This action will destroy any existing merged cells. Are you sure?" or "This action will clear your search results. Are you sure?" receive a negative response.
* @param rowNumber - Row index from which removal starts.
* @param numOfRows - Number of rows to be removed.
*/
deleteRow: (rowNumber?: number, numOfRows?: number) => false | undefined;
deleteWorksheet
来自WorksheetInstance
/**
* Delete a worksheet.
* @param position - Worksheet index.
*/
deleteWorksheet: (position: number) => void;
destroyMerge
来自WorksheetInstance
/**
* Remove all merged cells.
*/
destroyMerge: () => void;
dispatch
来自WorksheetInstance
/**
* Emit an event.
* @param event - Event name.
* @param args - Arguments that should be passed to the event.
*/
dispatch: (event: string, ...args: any[]) => any;
down
来自WorksheetInstance
/**
* Simulates the action of the "arrow down" key.
* @param shiftKey - If true, the method simulates the action of the "arrow down" key while the Shift key is pressed.
* @param ctrlKey - If true, the method simulates the action of the "arrow down" key while the Ctrl key is pressed.
*/
down: (shiftKey?: boolean, ctrlKey?: boolean) => void;
download
来自WorksheetInstance
/**
* Get the current data as a CSV file.
* @param includeHeaders - If true, include the header regardless of the {@link SpreadsheetOptions.includeHeadersOnDownload} property value.
* @param processed - If true, the result will contain the displayed cell values. Otherwise, the result will contain the actual cell values.
*/
download: (
includeHeaders?: boolean,
processed?: boolean,
) => void;
dragging
来自WorksheetInstance
/**
* Stores information about the row or column being moved.
*/
dragging: null | DragColumnInfo | DragRowInfo;
edition
来自WorksheetInstance
/**
* Currently open editor information. Respectively the cell whose editor is open, its initial value, its column index and its row index.
*/
edition: null | [HTMLTableCellElement, string, string, string];
element
来自WorksheetInstance
/**
* Root HTML element of this worksheet instance.
*/
element: JworksheetInstanceElement;
executeFormula
来自WorksheetInstance
/**
* Execute a formula.
* @param expression - Formula to be executed.
* @param x - Column index of the cell where the formula is.
* @param y - Row index of the cell where the formula is.
*/
executeFormula: (expression: string, x?: number, y?: number) => any;
filter
来自WorksheetInstance
/**
* Table row containing filter inputs.
*/
filter: null | HTMLTableRowElement;
filters
来自WorksheetInstance
/**
* Active filters.
*/
filters: (string[] | null)[];
first
来自WorksheetInstance
/**
* Simulates the action of the Home key.
* @param shiftKey - If true, the method simulates the action of the Home key while the Shift key is pressed.
* @param ctrlKey - If true, the method simulates the action of the Home key while the Ctrl key is pressed.
*/
first: (shiftKey?: boolean, ctrlKey?: boolean) => void;
formula
来自WorksheetInstance
/**
* List of formulas that are used within other formulas. Each key is the name of a cell containing a formula, and each value is a list of cells whose formulas use the cell specified in the key.
*/
formula: Record<string, string[]>;
getCell
来自WorksheetInstance
/**
* Get cell DOM element by cell name.
* @param cell - Cell name.
*/
getCell(cell: string): HTMLTableCellElement;
getCell
来自WorksheetInstance
/**
* Get cell DOM element by cell coords.
* @param x - Cell column index.
* @param y - Cell row index.
*/
getCell(x: number, y: number): HTMLTableCellElement;
getCellFromCoords
来自WorksheetInstance
/**
* Get cell DOM element by cell coordinates.
* @param x - Column index of the cell.
* @param y - Row index of the cell.
*/
getCellFromCoords: (x: number, y: number) => HTMLTableCellElement;
getColumnData
来自WorksheetInstance
/**
* Get the data from one column by its index.
* @param columnNumber - Column index.
* @param processed - If true, the return is constructed using the innerHTML of the cells. Otherwise, it is constructed using the {@link WorksheetOptions.data} property. Default: false.
*/
getColumnData: (columnNumber: number, processed?: boolean) => CellValue[];
getComments
来自WorksheetInstance
/**
* Get comments from one or all cells.
* @param cell - Cell name. If it is a falsy value, the comments of all cells are returned.
*/
getComments: (
cell?: string
) => Record<string, string> | string;
getConfig
来自WorksheetInstance
/**
* Get worksheet config information.
*/
getConfig: () => WorksheetOptions;
getData
来自WorksheetInstance
/**
* Get the full or partial table data.
* @param highlighted - If true, get only data from highlighted cells. If false, get data from all cells. Default: false.
* @param processed - If false, the return is constructed using the innerHTML of the cells. Otherwise, it is constructed using the {@link WorksheetOptions.data} property. Default: false.
* @param delimiter - Column delimiter. If this property is specified, the result will be formatted like a csv.
* @param asJson - If this property is true, the result will be formatted as json.
*/
getData: (
highlighted?: boolean,
processed?: boolean,
delimiter?: string,
asJson?: boolean,
) => CellValue[][];
getDataFromRange
来自WorksheetInstance
/**
* Get data from a range.
* @param range - Range of cells whose values are to be returned.
* @param processed - If true, the method returns the values of the HTML elements of the cells. Otherwise, the method returns the values of the cells in the options.data array.
*/
getDataFromRange: (range: string, processed: true) => CellValue[][];
getHeader
来自WorksheetInstance
/**
* Get the column title.
* @param column - Column index.
*/
getHeader: (column: number) => string;
getHeaders
来自WorksheetInstance
/**
* Get all header titles.
* @param asArray - If true, returns the items in an array, if false, returns them separated by ";" within a single string.
*/
getHeaders: (asArray?: boolean) => string | string[];
getHeight
来自WorksheetInstance
/**
* Get height of all rows.
*/
getHeight(row?: undefined): string[];
getHeight
来自WorksheetInstance
/**
* Get height of one row.
* @param row - Column index.
*/
getHeight(row: number): string;
getHighlighted
来自WorksheetInstance
/**
* Get the coordinates of the highlighted selections.
*/
getHighlighted: () => [number, number, number, number][]
getLabel
来自WorksheetInstance
/**
* Get the innerHTML of a cell.
* @param cell - Cell name.
*/
getLabel(cell: string): string;
getLabel
来自WorksheetInstance
/**
* Get the innerHTML of a cell.
* @param x - Cell column index.
* @param y - Cell row index.
*/
getLabel(x: number, y: number): string;
getMerge
来自WorksheetInstance
/**
* Get information from one or all merged cells
* @param cellName - Cell name. If it is a falsy value, it returns the information of all merges. If the given cell is not the anchor of a merge, it returns null.
*/
getMerge(
cellName?: string
): Record<string, [number, number]> | [number, number] | null;
getMeta
来自WorksheetInstance
/**
* Get meta information from one or all cells.
* @param cell - Cell name. If it is a falsy value, the metadata of all cells is returned.
*/
getMeta: (cell?: string) => any;
getRange
来自WorksheetInstance
/**
* Get the range description of the selected cells.
*/
getRange: () => string;
getRowData
来自WorksheetInstance
/**
* Get data from a row by its index.
* @param rowNumber - Row index.
* @param processed - If true, the return is constructed using the innerHTML of the cells. Otherwise, it is constructed using the {@link WorksheetOptions.data} property. Default: false.
*/
getRowData: (
rowNumber: number,
processed?: boolean,
) => CellValue[] | undefined;
getSelected
来自WorksheetInstance
/**
* Get information from selected cells in the worksheet.
* @param columnNameOnly - If true, the method returns the names of the selected cells. Otherwise, the method returns the records of the selected cells.
*/
getSelected: (columnNameOnly?: boolean) => {
element: HTMLTableCellElement[][],
x: number,
y: number,
}[] | string[];
getSelectedColumns
来自WorksheetInstance
/**
* Get indexes of the columns that have highlighted cells.
* @param visibleOnly - If true, the method returns only visible columns.
*/
getSelectedColumns: (visibleOnly?: boolean) => number[];
getSelectedRows
来自WorksheetInstance
/**
* Get indexes of the rows that have highlighted cells.
* @param visibleOnly - If true, the method returns only visible rows.
*/
getSelectedRows: (visibleOnly?: boolean) => number[];
getSelection
来自WorksheetInstance
/**
* Get the coordinates of the range that is selected in the worksheet.
*/
getSelection: () => [number, number, number, number];
getStyle
来自WorksheetInstance
/**
* Get styles from one or all cells.
* @param cell - Name or coordinate of a cell. If omitted, returns styles for all cells.
* @param key - Style property. if specified, returns only that property. Otherwise, it returns all the cell's style properties.
*/
getStyle: (
cell?: string | [number, number],
key?: string
) => string | Record<string, string>;
getValue
来自WorksheetInstance
/**
* Get the value of a cell.
* @param cell - Cell name.
* @param processedValue - If true, it returns the cell's innerHTML. Otherwise, it returns the value of the cell in the {@link WorksheetOptions.data} property.
*/
getValue: (
cell: string,
processedValue?: boolean
) => CellValue | null;
getValueFromCoords
来自WorksheetInstance
/**
* Get the value of a cell by its coordinates.
* @param x - Column index.
* @param y - Row index.
* @param processedValue - If true, it returns the cell's innerHTML. Otherwise, it returns the value of the cell in the {@link WorksheetOptions.data} property.
*/
getValueFromCoords: (
x: number,
y: number,
processedValue?: boolean
) => CellValue | null;
getWidth
来自WorksheetInstance
/**
* Get the width of one or all columns.
* @param column - Index of the column. If omitted, returns the widths of all columns.
*/
getWidth: (column?: number) => number | (number | string)[];
getWorksheetActive
来自WorksheetInstance
/**
* Get the index of the currently active worksheet
*/
getWorksheetActive: () => number;
hashString
来自WorksheetInstance
/**
* @deprecated
*/
hashString: null | number;
headerContainer
来自WorksheetInstance
/**
* HTML element that corresponds to the header row.
*/
headerContainer: HTMLTableRowElement;
headers
来自WorksheetInstance
/**
* List of cells that make up the header.
*/
headers: HTMLTableCellElement[];
hideColumn
来自WorksheetInstance
/**
* Hide a column.
* @param colNumber - Column indexes.
*/
hideColumn: (colNumber: number | number[]) => void;
hideIndex
来自WorksheetInstance
/**
* Hide row count column.
*/
hideIndex: () => void;
hideRow
来自WorksheetInstance
/**
* Hide Row.
* @param rowNumber - Row indexes.
*/
hideRow: (rowNumber: number | number[]) => void;
highlighted
来自WorksheetInstance
/**
* List of highlighted cells.
*/
highlighted: {
element: HTMLTableCellElement,
x: number,
y: number,
}[];
history
来自WorksheetInstance
/**
* List of actions performed on the worksheet.
*/
history: HistoryRecord[];
historyIndex
来自WorksheetInstance
/**
* Current position of the {@link WorksheetInstance.history} property. Used to control movement through history.
*/
historyIndex: number;
ignoreHistory
来自WorksheetInstance
/**
* If true, the "setHistory" method does not create new records in the history.
*/
ignoreHistory: boolean;
isSelected
来自WorksheetInstance
/**
* Check if a cell is within the current selection.
* @param x - Cell column index.
* @param y - Cell row index.
*/
isSelected: (x: number, y: number) => boolean;
insertColumn
来自WorksheetInstance
/**
* Insert one or more columns.
*
* This method returns false if the {@link SpreadsheetOptions.onbeforeinsertcolumn} event returns false or if the "This action will destroy any existing merged cells. Are you sure?" dialog receives a negative response.
* @param mixed - Number of columns to insert. It can also be an array of values, but in this case, only one column is inserted, whose data is based on the array items. Default: 1.
* @param columnNumber - Index of the column used as reference for the insertion. Default: last column.
* @param insertBefore - Insert new columns before or after the reference column. Default: false.
* @param properties - New column properties.
*/
insertColumn: (
mixed?: number | CellValue[],
columnNumber?: number,
insertBefore?: boolean,
properties?: Column[]
) => false | undefined;
insertRow
来自WorksheetInstance
/**
* Insert one or more rows.
*
* This method returns false if the {@link SpreadsheetOptions.onbeforeinsertrow} event returns false or if the "This action will destroy any existing merged cells. Are you sure?" or "This action will clear your search results. Are you sure?" dialogs receive a negative response.
* @param mixed - Number of rows to insert. It can also be an array of values, but in this case, only one row is inserted, whose data is based on the array items. Default: 1.
* @param rowNumber - Index of the row used as reference for the insertion. Default: last row.
* @param insertBefore - Insert new rows before or after the reference row. Default: false.
*/
insertRow: (
mixed?: number | CellValue[],
rowNumber?: number,
insertBefore?: number
) => false | undefined;
isReadOnly
来自WorksheetInstance
/**
* Check if a cell is read only.
* @param x - Cell column index.
* @param y - Cell row index.
*/
isReadOnly(x: number, y: number): boolean;
isReadOnly
来自WorksheetInstance
/**
* Check if a cell is read only.
* @param cellName - Cell name.
*/
isReadOnly(cellName: string): boolean;
last
来自WorksheetInstance
/**
* Simulates the action of the End key.
* @param shiftKey - If true, the method simulates the action of the End key while the Shift key is pressed.
* @param ctrlKey - If true, the method simulates the action of the End key while the Ctrl key is pressed.
*/
last: (shiftKey?: boolean, ctrlKey?: boolean) => void;
left
来自WorksheetInstance
/**
* Simulates the action of the "arrow left" key.
* @param shiftKey - If true, the method simulates the action of the "arrow left" key while the Shift key is pressed.
* @param ctrlKey - If true, the method simulates the action of the "arrow left" key while the Ctrl key is pressed.
*/
left: (shiftKey?: boolean, ctrlKey?: boolean) => void;
moveColumn
来自WorksheetInstance
/**
* Move a column.
*
* This method returns false if the "This action will destroy any existing merged cells. Are you sure?" dialog receives a negative response.
* @param o - Column index.
* @param d - New column index.
*/
moveColumn: (o: number, d: number) => false | undefined;
moveRow
来自WorksheetInstance
/**
* Move a row.
*
* This method returns false if the "This action will destroy any existing merged cells. Are you sure?" or "This action will clear your search results. Are you sure?" dialogs receive a negative response.
* @param o - Row index.
* @param d - New row index.
*/
moveRow: (o: number, d: number) => false | undefined;
openEditor
来自WorksheetInstance
/**
* Start the edition for one cell.
* @param cell - Cell HTML Element.
* @param empty - If true, the editor opens without content even if the cell had content.
* @param event - Js event that triggered the editor opening. This argument is passed to the "openEditor" method of custom editors.
*/
openEditor: (cell: HTMLTableCellElement, empty?: boolean, event?: KeyboardEvent | MouseEvent | TouchEvent) => void;
openFilter
来自WorksheetInstance
/**
* Open the column filter.
*
* This method only runs if the {@link WorksheetOptions.filters} property is true.
* @param columnId - Column index.
*/
openFilter: (columnId: number) => void;
openWorksheet
来自WorksheetInstance
/**
* Open the worksheet by index.
* @param position - Worksheet index.
*/
openWorksheet: (position: number) => void;
options
来自WorksheetInstance
/**
* Spreadsheet settings.
*/
options: WorksheetOptions;
orderBy
来自WorksheetInstance
/**
* Reorder rows based on values in a column.
*
* This method returns false if the "This action will destroy any existing merged cells. Are you sure?" dialog receives a negative response, or returns true if the sort is successful.
* @param column - Column index. If the value of this parameter is less than 0, the method returns false and does not perform sorting.
* @param order - Sorting direction. 0 for ascending and 1 for descending.
*/
orderBy: (column: number, order: 0 | 1) => boolean | undefined;
page
来自WorksheetInstance
/**
* Go to page. Valid only when {@link WorksheetOptions.pagination} is true.
* @param pageNumber - Page number (starting at 0).
*/
page: (pageNumber: number) => void;
pageNumber
来自WorksheetInstance
/**
* Current spreadsheet page.
*/
pageNumber: undefined | number;
pagination
来自WorksheetInstance
/**
* Div with pagination controls.
*/
pagination: HTMLDivElement;
parent
来自WorksheetInstance
/**
* Spreadsheet of which this worksheet is part.
*/
parent: SpreadsheetInstance;
paste
来自WorksheetInstance
/**
* Pastes content into one or more cells.
* @param x - Column index of the cell from which the content will be pasted.
* @param y - Row index of the cell from which the content will be pasted.
* @param data - Content to be pasted.
*/
paste: (x: number, y: number, data: string) => false | undefined;
quantiyOfPages
来自WorksheetInstance
/**
* Get the number of pages of the worksheet.
*/
quantiyOfPages: () => number;
records
来自WorksheetInstance
/**
* List of HTML elements representing table cells.
*/
records: {
element: HTMLTableCellElement,
x: number,
y: number,
}[][];
redo
来自WorksheetInstance
/**
* Redo previously undone action
*/
redo: () => void;
removeMerge
来自WorksheetInstance
/**
* Remove a merge.
* @param cellName - Merge anchor cell.
* @param data - Data to be placed in cells released from the merge.
*/
removeMerge: (
cellName: string,
data?: CellValue[],
) => void;
resetFilters
来自WorksheetInstance
/**
* Reset all filters.
*/
resetFilters: () => void;
resetSearch
来自WorksheetInstance
/**
* Reset search
*/
resetSearch: () => void;
resetSelection
来自WorksheetInstance
/**
* Reset highlighted cell selection.
* @returns If there were highlighted cells, it returns 1, otherwise it returns 0.
*/
resetSelection: () => 0 | 1;
resetStyle
来自WorksheetInstance
/**
* Reset styles of one or more cells.
* @param o - Object whose keys are the names of the cells that must have their styles reset.
* @param ignoreHistoryAndEvents - If true, do not add this action to history.
*/
resetStyle: (
o: Record<string, any>,
ignoreHistoryAndEvents?: boolean
) => void;
resizing
来自WorksheetInstance
/**
* Information about the row or column currently being resized.
*/
resizing: undefined | null | ResizeRowInfo | ResizeColumnInfo;
results
来自WorksheetInstance
/**
* Indices of the rows that include the searched text.
*/
results: null | number[];
right
来自WorksheetInstance
/**
* Simulates the action of the "arrow right" key.
* @param shiftKey - If true, the method simulates the action of the "arrow right" key while the Shift key is pressed.
* @param ctrlKey - If true, the method simulates the action of the "arrow right" key while the Ctrl key is pressed.
*/
right: (shiftKey?: boolean, ctrlKey?: boolean) => void;
rows
来自WorksheetInstance
/**
* List of rows that make up the table.
*/
rows: {
element: HTMLTableRowElement,
y: number,
}[];
search
来自WorksheetInstance
/**
* Search for some text.
* @param query - Text to be searched.
*/
search: (query: string) => void;
searchInput
来自WorksheetInstance
/**
* Text field used to perform searches.
*/
searchInput: HTMLInputElement;
selectAll
来自WorksheetInstance
/**
* Select all table cells.
*/
selectAll: () => void;
selectedCell
来自WorksheetInstance
/**
* Current selection coordinates.
*
* The array is composed respectively by the indices of the leftmost column of the selection [0], the topmost row of the selection [1], the rightmost column of the selection [2] and the bottommost row selection [3].
*/
selectedCell:
| undefined
| null
| [number, number, number, number]
| [string, string, string, string];
selectedContainer
来自WorksheetInstance
selectedContainer: undefined | null | [number, number, number, number];
selection
来自WorksheetInstance
/**
* Cells that currently have "autocomplete selection".
*/
selection: HTMLTableCellElement[];
setColumnData
来自WorksheetInstance
/**
* Set the data from one column by index.
* @param colNumber - Column index.
* @param data - New data. Positions with the null value are not changed in the table.
* @param force - If true, the method also changes the contents of readonly columns.
*/
setColumnData: (colNumber: number, data: (CellValue | null)[], force?: boolean) => void;
setComments
来自WorksheetInstance
/**
* Set or remove a comment.
* @param cellId - Name of the cell.
* @param comments - New comment. If it is a falsy value, the method just uncomments the cell.
*/
setComments(
cellId: string,
comments: string,
): void;
setComments
来自WorksheetInstance
/**
* Set or remove comments.
* @param cellId - Object whose keys are cell names and values are cell comments. If the value of a key is a falsy value, the cell comment is removed.
*/
setComments(
cellId: Record<string, string>,
): void;
setConfig
来自WorksheetInstance
/**
* Change the worksheet or spreadsheet settings.
* @param config - New settings.
* @param spreadsheetLevel - If true, the settings are applied to the spreadsheet. If not, they are applied to the worksheet.
*/
setConfig: (config: SpreadsheetOptions, spreadsheetLevel?: boolean) => void;
setData
来自WorksheetInstance
/**
* Set data.
* @param data - New data. It can be an array of cell values or an array of objects whose values are cell values.
*/
setData: (
data?: CellValue[][] | Record<string, CellValue>[]
) => void;
setHeader
来自WorksheetInstance
/**
* Set a column title.
* @param column - Column index.
* @param newValue - New title. Empty string or undefined to reset the header title.
*/
setHeader: (column: number, newValue?: string) => void;
setHeight
来自WorksheetInstance
/**
* Change row height.
* @param row - Row index.
* @param height - New height. An integer greater than zero.
*/
setHeight: (
row: number,
height: number,
) => void;
setMerge
来自WorksheetInstance
/**
* Merge cells.
* @param cellName - Name of a cell. If it is a falsy value, this method merges the selected cells in the table and ignores all parameters of this method.
* @param colspan - Number of columns this merge occupies.
* @param rowspan - Number of rows this merge occupies.
* @returns If the "cellName" parameter is a falsy value, and there are no cells selected in the table, this method returns null.
*/
setMerge: (
cellName?: string,
colspan?: number,
rowspan?: number,
) => null | undefined;
setMeta
来自WorksheetInstance
/**
* Set a property on a cell's meta information.
* @param o - Cell name.
* @param k - Property name.
* @param v - Property value.
*/
setMeta(o: string, k: string, v: string): void;
setMeta
来自WorksheetInstance
/**
* Remove current and define new meta information for one or more cells.
* @param o - Object with the new meta information.
*/
setMeta(o: Record<string, Record<string, any>>): void;
setReadOnly
来自WorksheetInstance
/**
* Change the read only state of a cell.
* @param cell - Cell HTML element or its name.
* @param state - New read only state.
*/
setReadOnly: (cell: string | HTMLTableCellElement, state: boolean) => void;
setRowData
来自WorksheetInstance
/**
* Set a row data by index.
* @param rowNumber - Row index.
* @param data - New data. Positions with the null value are not changed in the table.
* @param force - If true, the method also changes the contents of readonly columns.
*/
setRowData: (rowNumber: number, data: (CellValue | null)[], force?: boolean) => void;
setStyle
来自WorksheetInstance
/**
* Change a single style of one or more cells.
* @param o - Name of a cell.
* @param k - property to be changed.
* @param v - New property value. If equal to the property's current value and the "force" parameter is false, removes that property from the style.
* @param force - If true, changes the value of the property even if the cell is read-only. Also, if true, even if the new value of the property is the same as the current one, the property is not removed.
*/
setStyle(
o: string,
k: string,
v: string,
force?: boolean,
): void;
setStyle
来自WorksheetInstance
/**
* Change cell styles.
* @param o - Object where each key is the name of a cell and each value is the style changes for that cell. Each value can be a string with css styles separated by semicolons or an array where each item is a string with a css style.
* @param k - It is not used.
* @param v - It is not used.
* @param force - If true, changes the value of the property even if the cell is read-only. Also, if true, even if the new value of the property is the same as the current one, the property is not removed.
*/
setStyle(
o: Record<string, string | string[]>,
k?: null | undefined,
v?: null | undefined,
force?: boolean,
): void;
setValue
来自WorksheetInstance
/**
* Change the value of one or more cells.
* @param cell - Name of a cell, HTML element that represents a cell or an array whose items can be any of the previous alternatives or objects. When an array item is an object, it must have the cell coordinates ("x" and "y") and can have the cell's new value ("value"), but if does not have it, the "value" parameter is used instead.
* @param value - New cell value.
* @param force - If true, changes the value of even read-only cells.
*/
setValue: (
cell:
| string
| HTMLTableCellElement
| (
| string
| { x: number; y: number; value?: CellValue }
| HTMLTableCellElement
)[],
value?: CellValue,
force?: boolean
) => void;
setValueFromCoords
来自WorksheetInstance
/**
* Set a cell value based on its coordinates.
* @param x - Cell column index.
* @param y - Cell row index.
* @param value - New value.
* @param force - If true, changes the value of even read-only cells.
*/
setValueFromCoords: (
x: number,
y: number,
value: CellValue,
force?: boolean
) => void;
setWidth
来自WorksheetInstance
/**
* Set the width of a column.
* @param column - Column index.
* @param width - New width.
*/
setWidth(column: number, width: number): void;
setWidth
来自WorksheetInstance
/**
* Set the width of one or more columns.
* @param column - Column indexes.
* @param width - New widths.
*/
setWidth(
column: number[],
width: number | number[],
): void;
showColumn
来自WorksheetInstance
/**
* Show hidden column.
* @param colNumber - Column index.
*/
showColumn: (colNumber: number | number[]) => void;
showIndex
来自WorksheetInstance
/**
* Show row count column.
*/
showIndex: () => void;
showRow
来自WorksheetInstance
/**
* Show hidden row.
* @param rowNumber - Row index.
*/
showRow: (rowNumber: number | number[]) => void;
style
来自WorksheetInstance
/**
* Styles of the cells that were copied.
*/
style: string[];
table
来自WorksheetInstance
/**
* HTML table tag of this jss instance.
*/
table: HTMLTableElement;
tbody
来自WorksheetInstance
/**
* HTML tbody tag of this jss instance.
*/
tbody: HTMLTableSectionElement;
textarea
来自WorksheetInstance
/**
* HTML textarea tag used internally when copying cells.
*/
textarea: HTMLTextAreaElement;
thead
来自WorksheetInstance
/**
* HTML thead tag of this jss instance.
*/
thead: HTMLTableSectionElement;
undo
来自WorksheetInstance
/**
* Undo last action.
*/
undo: () => void;
up
来自WorksheetInstance
/**
* Simulates the action of the "arrow up" key.
* @param shiftKey - If true, the method simulates the action of the "arrow up" key while the Shift key is pressed.
* @param ctrlKey - If true, the method simulates the action of the "arrow up" key while the Ctrl key is pressed.
*/
up: (shiftKey?: boolean, ctrlKey?: boolean) => void;
updateSelectionFromCoords
来自WorksheetInstance
/**
* Select cells.
* @param x1 - Column index of the first cell of the selection. If omitted or null, rows "y1" through "y2" are selected.
* @param y1 - Row index of the first cell of the selection. If omitted or null, columns "x1" through "x2" are selected.
* @param x2 - Column index of the last cell of the selection. Default: Parameter "x1".
* @param y2 - Row index of the last cell of the selection. Default: Parameter "y1".
*/
updateSelectionFromCoords: (
x1: number | null,
y1: number | null,
x2?: number | null,
y2?: number | null,
) => false | undefined;
whichPage
来自WorksheetInstance
/**
* Get the page index of a row.
* @param cell - Row index.
*/
whichPage: (cell: number) => number;
SpreadsheetInstance
config
来自SpreadsheetInstance
Spreadsheet settings.
config: SpreadsheetOptions;
contextMenu
来自SpreadsheetInstance
Jsuites contextmenu of this jss instance
contextMenu: HTMLDivElement;
el
来自SpreadsheetInstance
Root HTML element of this jss instance.
el: JspreadsheetInstanceElement;
element
来自SpreadsheetInstance
Alias for el.
element: JspreadsheetInstanceElement;
fullscreen
来自SpreadsheetInstance
Toogle table fullscreen mode.
@param activate - Desired mode. Default: The opposite of the current mode.
fullscreen: (activate?: boolean) => void;
getWorksheetActive
来自SpreadsheetInstance
Get the index of the currently active worksheet
getWorksheetActive: () => number;
hideToolbar
来自SpreadsheetInstance
Hide the toolbar.
hideToolbar: () => void;
ignoreEvents
来自SpreadsheetInstance
If true, the spreadsheet does not emit events.
ignoreEvents?: boolean;
plugins
来自SpreadsheetInstance
Spreadsheet plugins.
plugins: Record<string, Plugin>;
setConfig
来自SpreadsheetInstance
Change the spreadsheet settings.
@param config - New settings.
setConfig: (config: SpreadsheetOptions) => void;
setPlugins
来自SpreadsheetInstance
Add new plugins to the spreadsheet.
@param plugins - New plugins.
setPlugins: (plugins: Record<string, () => Plugin>) => void;
showToolbar
来自SpreadsheetInstance
Show the toolbar using the current settings.
showToolbar: () => void;
toolbar
来自SpreadsheetInstance
HTML div tag used as the toolbar of this jss instance.
toolbar: HTMLDivElement;
worksheets
来自SpreadsheetInstance
Instances of the worksheets that make up this spreadsheet.
worksheets: WorksheetInstance[];
SpreadsheetOptions
about
来自SpreadsheetOptions
/**
* Show or not the "about" item in the context menu.
* @default true
*/
about?: boolean;
allowExport
来自SpreadsheetOptions
/**
* Allow table export as csv.
* @default true
*/
allowExport?: boolean;
autoCasting
来自SpreadsheetOptions
/**
* If true, Jss will try to convert cell contents used in formulas to numbers
* @default true
*/
autoCasting?: boolean;
autoIncrement
来自SpreadsheetOptions
/**
* Auto increment actions when using the dragging corner.
* @default true
*/
autoIncrement?: boolean;
contextMenu
来自SpreadsheetOptions
/**
* Creates context menu when user clicks with secondary mouse button.
* @param instance - Instance of the worksheet on which the click was made.
* @param colIndex - Horizontal index of the element that was clicked. The meaning of this value depends on the {@link role} argument.
* @param rowIndex - Vertical index of the element that was clicked. The meaning of this value depends on the {@link role} argument.
* @param event - pointer event that triggered this event.
* @param items - jss default context menu.
* @param role - indicates in which part of the spreadsheet the click occurred.
* @param x - Horizontal index of the element that was clicked. The meaning of this value depends on the {@link role} argument.
* @param y - Vertical index of the element that was clicked. The meaning of this value depends on the {@link role} argument.
* @returns Context menu configuration that should be created.
*/
contextMenu?: (
instance: WorksheetInstance,
colIndex: string | number | null,
rowIndex: string | number | null,
event: PointerEvent,
items: ContextMenuItem[],
role: ContextMenuRole,
x: string | number | null,
y: string | number | null,
) => ContextMenuItem[] | null | undefined;
debugFormulas
来自SpreadsheetOptions
/**
* Enable the formula debug notices.
* @default false
*/
debugFormulas?: boolean;
fullscreen
来自SpreadsheetOptions
/**
* Fullscreen mode.
* @default false
*/
fullscreen?: boolean;
includeHeadersOnDownload
来自SpreadsheetOptions
/**
* Include header titles on download.
* @default false
*/
includeHeadersOnDownload?: boolean;
namespace
来自SpreadsheetOptions
/** Spreadsheet namespace */
namespace?: string;
onafterchanges
来自SpreadsheetOptions
/**
* Occurs after all changes are applied in the tables.
* @param instance - Instance of the worksheet where the change occurred.
* @param changes - list of changes.
*/
onafterchanges?: (
instance: WorksheetInstance,
changes: CellChange[]
) => void;
onbeforechange
来自SpreadsheetOptions
/**
* Occurs before a column value is changed. If any value is returned, it will be the cell's new value.
* @param instance - Instance of the worksheet where the changes will occur.
* @param cell - HTML element that represents the cell being changed.
* @param colIndex - Cell column index being changed.
* @param rowIndex - Cell row index being changed.
* @param newValue - Value being applied to the cell.
*/
onbeforechange?: (
instance: WorksheetInstance,
cell: HTMLTableCellElement,
colIndex: string | number,
rowIndex: string | number,
newValue: CellValue
) => undefined | CellValue;
onbeforedeletecolumn
来自SpreadsheetOptions
/**
* Occurs before a column is excluded. If this method returns false, the removal will be canceled.
* @param instance - Instance of the worksheet where columns will be removed.
* @param removedColumns - Indexes of the columns to be removed.
*/
onbeforedeletecolumn?: (
instance: WorksheetInstance,
removedColumns: number[],
) => undefined | boolean;
onbeforedeleterow
来自SpreadsheetOptions
/**
* Occurs before a row is deleted. If this method returns false, the removal will be canceled.
* @param instance - Instance of the worksheet where rows will be removed.
* @param removedRows - Indexes of the rows to be removed.
*/
onbeforedeleterow?: (
instance: WorksheetInstance,
removedRows: number[]
) => undefined | boolean;
onbeforeformula
来自SpreadsheetOptions
/**
* Intercept and parse a formula just before the execution.
* @param instance - Instance of the worksheet.
* @param expression - Formula that triggered the event.
* @param x - Column index of the cell whose formula triggered the event.
* @param y - Row index of the cell whose formula triggered the event
*/
onbeforeformula?: (instance: WorksheetInstance, expression: string, x?: number, y?: number) => false | string | undefined;
onbeforeinsertcolumn
来自SpreadsheetOptions
/**
* Occurs before a new column is inserted. If this method returns false, the insertion will be canceled.
* @param instance - Instance of the worksheet where columns will be added.
* @param columns - Settings for columns to be added.
*/
onbeforeinsertcolumn?: (
instance: WorksheetInstance,
columns: {
column: number,
options: Column,
data?: CellValue[]
}[],
) => undefined | boolean;
onbeforeinsertrow
来自SpreadsheetOptions
/**
* Occurs before a new row is inserted. If this method returns false, the insertion will be canceled.
* @param instance - Instance of the worksheet where rows will be added.
* @param rows - Settings for rows to be added.
*/
onbeforeinsertrow?: (
instance: WorksheetInstance,
rows: {
row: number,
data: CellValue[],
}[],
) => undefined | boolean;
onbeforepaste
来自SpreadsheetOptions
/**
* Occurs before the paste action is performed.
*
* If it returns false, the jss cancels the paste.
* If it returns a string, it will be the content pasted into the worksheet.
*
* @param instance - Instance of the worksheet where data will be pasted.
* @param copiedText - Text being pasted to the spreadsheet.
* @param colIndex - Column index where it will start the paste.
* @param rowIndex - Row index where it will start the paste.
*/
onbeforepaste?: (
instance: WorksheetInstance,
copiedText: { value: CellValue }[][],
colIndex: number | string,
rowIndex: number | string
) => undefined | boolean | string;
onbeforesave
来自SpreadsheetOptions
/**
* Occurs before persisting any changes to the server.
*
* This event is only called when the spreadsheet has the {@link WorksheetOptions.persistence} property set.
*
* If this event returns false, the change is not persisted on the server.
* If it returns a truthy value, that value is persisted instead of the initial value.
* @param spreadsheetInstance - Spreadsheet instance.
* @param worksheetInstance - Instance of the worksheet to be saved.
* @param data - Changed data.
*/
onbeforesave?: (
spreadsheetInstance: SpreadsheetInstance,
worksheetInstance: WorksheetInstance,
data: { row: number; data: Record<number, CellValue> }[]
) => any;
onbeforeselection
来自SpreadsheetOptions
/**
* Occurs before the selection is changed.
* @param instance - Worksheet instance where the selection will occur.
* @param borderLeftIndex - Index of the first column contained by the selection.
* @param borderTopIndex - Index of the first row contained by the selection.
* @param borderRightIndex - Index of the last column contained by the selection.
* @param borderBottomIndex - Index of the last row contained by the selection.
* @param origin - Javascript event that triggered this jss event.
*/
onbeforeselection?: (
instance: WorksheetInstance,
borderLeftIndex: number,
borderTopIndex: number,
borderRightIndex: number,
borderBottomIndex: number,
origin: Event | undefined,
) => false | undefined;
onblur
来自SpreadsheetOptions
/**
* Occurs when the table is blurred.
* @param instance - Instance of the worksheet that was blurred.
*/
onblur?: (instance: WorksheetInstance) => void;
onchange
来自SpreadsheetOptions
/**
* Occurs after a column value is changed.
* @param instance - Instance of the worksheet where the change occurred.
* @param cell - HTML element that represents the cell being changed.
* @param colIndex - Cell column index being changed.
* @param rowIndex - Cell row index being changed.
* @param newValue - New cell value.
* @param oldValue - Old cell value.
*/
onchange?: (
instance: WorksheetInstance,
cell: HTMLTableCellElement,
colIndex: string | number,
rowIndex: string | number,
newValue: CellValue,
oldValue: CellValue
) => void;
onchangeheader
来自SpreadsheetOptions
/**
* Occurs when a column heading is changed.
* @param instance - Instance of the worksheet where the change occurred.
* @param colIndex - Index of the column that was renamed.
* @param newValue - New column title.
* @param oldValue - Old column title.
*/
onchangeheader?: (
instance: WorksheetInstance,
colIndex: number,
newValue: string,
oldValue: string,
) => void;
onchangemeta
来自SpreadsheetOptions
/**
* Occurs when a "setMeta" is called.
*
* @param instance - Instance of the worksheet where the change occurred.
* @param cellName - An object with the metadata changes.
*/
onchangemeta?: (
instance: WorksheetInstance,
cellName: Record<string, any>,
) => void;
onchangepage
来自SpreadsheetOptions
/**
* Occurs when the page is changed.
* @param instance - Instance of the worksheet where the change occurred.
* @param newPageNumber - Page the worksheet is on.
* @param oldPageNumber - Page the worksheet was on.
* @param quantityPerPage - Maximum number of lines on pages.
*/
onchangepage?: (
instance: WorksheetInstance,
newPageNumber: number,
oldPageNumber: number,
quantityPerPage: number,
) => void;
onchangestyle
来自SpreadsheetOptions
/**
* Occurs when a "setStyle" is called.
*
* @param instance - Instance of the worksheet where the change occurred.
* @param cellName - An object with the changes.
*/
onchangestyle?: (
instance: WorksheetInstance,
changes: Record<string, string>,
) => void;
oncomments
来自SpreadsheetOptions
/**
* Occurs when a comment is changed.
* @param instance - Instance of the worksheet where the change occurred.
* @param newComments - New comments.
* @param oldComments - Old comments.
*/
oncomments?: (
instance: WorksheetInstance,
newComments: Record<string, string | null>,
oldComments: Record<string, string | null>,
) => void;
oncopy
来自SpreadsheetOptions
/**
* Occurs when the contents of one or more cells are copied.
* @param instance - Instance of the worksheet where the change occurred.
* @param selectedRange - Copied cell range.
* @param copiedData - Data from copied cell range.
* @param cut - If true, the action was cut. Otherwise, the action was copy.
*/
oncopy?: (
instance: WorksheetInstance,
selectedRange: [number, number, number, number],
copiedData: string,
cut: boolean | undefined,
) => string | false | undefined;
oncreatecell
来自SpreadsheetOptions
/**
* Occurs when a cell is created.
* @param instance - Instance of the worksheet where the cell was created.
* @param cell - Cell HTML element.
* @param colIndex - Cell column index.
* @param rowIndex - Cell row index.
* @param newValue - Cell value.
*/
oncreatecell?: (
instance: WorksheetInstance,
cell: HTMLTableCellElement,
colIndex: number,
rowIndex: number,
newValue: CellValue
) => void;
oncreateeditor
来自SpreadsheetOptions
/**
* Occurs when an editor is opened.
* @param instance - Instance of the worksheet where the change occurred.
* @param td - Td tag of the cell whose editor was opened.
* @param colIndex - Column index of the cell whose editor was opened.
* @param rowIndex - Row index of the cell whose editor was opened.
* @param input - Input of the editor that was opened.
* @param options - Column settings.
*/
oncreateeditor?: (
instance: WorksheetInstance,
td: HTMLTableCellElement,
colIndex: number,
rowIndex: number,
input: null,
options: Column,
) => void;
ondeletecolumn
来自SpreadsheetOptions
/**
* Occurs after a column is excluded.
* @param instance - Instance of the worksheet where the change occurred.
* @param removedColumns - Indexes of the columns that were removed.
*/
ondeletecolumn?: (
instance: WorksheetInstance,
removedColumns: number[],
) => void;
ondeleterow
来自SpreadsheetOptions
/**
* Occurs after a row is excluded.
* @param instance - Instance of the worksheet where the change occurred.
* @param removedRows - Indexes of the rows that were removed.
*/
ondeleterow?: (
instance: WorksheetInstance,
removedRows: number[],
) => void;
oncreateworksheet
来自SpreadsheetOptions
/**
* Occurs when a worksheet is created.
* @param worksheet - Instance of the new worksheet.
* @param worksheetOptions - Options of the new worksheet.
* @param index - Index of the new worksheet.
*/
oncreateworksheet?: (
worksheet: WorksheetInstance,
worksheetOptions: WorksheetOptions,
index: number,
) => void;
ondeleteworksheet
来自SpreadsheetOptions
/**
* Occurs when a worksheet is deleted.
* @param worksheet - Instance of the deleted worksheet.
* @param index - Index of the deleted worksheet.
*/
ondeleteworksheet?: (
worksheet: WorksheetInstance,
index: number,
) => void;
oneditionend
来自SpreadsheetOptions
/**
* Occurs when a closeEditor is called.
* @param instance - Instance of the worksheet where the change occurred.
* @param td - Td tag of the cell whose editor was opened.
* @param colIndex - Column index of the cell whose editor was opened.
* @param rowIndex - Row index of the cell whose editor was opened.
* @param editorValue - Value that was in the editor.
* @param wasSaved - Whether the value which was in the editor was saved in the cell or not.
*/
oneditionend?: (
instance: WorksheetInstance,
td: HTMLTableCellElement,
colIndex: number,
rowIndex: number,
editorValue: CellValue,
wasSaved: boolean
) => void;
oneditionstart
来自SpreadsheetOptions
/**
* Occurs when a openEditor is called.
* @param instance - Instance of the worksheet where the change occurred.
* @param td - Td tag of the cell whose editor was opened.
* @param colIndex - Column index of the cell whose editor was opened.
* @param rowIndex - Row index of the cell whose editor was opened.
*/
oneditionstart?: (
instance: WorksheetInstance,
td: HTMLTableCellElement,
colIndex: number,
rowIndex: number
) => void;
onevent
来自SpreadsheetOptions
/**
* Event fired when any other event fires. It runs before the event that was called.
*
* If the called event has not been defined, the jss considers the value returned by onevent as the value returned by the called event.
* @param event - Name of the event that was called.
* @param rest - Arguments of the event that was called.
*/
onevent?: (event: string, ...rest: any[]) => any;
onfocus
来自SpreadsheetOptions
/**
* Occurs when the table is focused.
* @param instance - Instance of the worksheet that was focused on.
*/
onfocus?: (instance: WorksheetInstance) => void;
oninsertcolumn
来自SpreadsheetOptions
/**
* Occurs after a new column is inserted.
* @param instance - Instance of the worksheet where the change occurred.
* @param columns - Columns that have been added.
*/
oninsertcolumn?: (
instance: WorksheetInstance,
columns: {
column: number,
options: Column,
data?: CellValue[]
}[],
) => void;
oninsertrow
来自SpreadsheetOptions
/**
* Occurs after a new row is inserted.
* @param instance - Instance of the worksheet where the change occurred.
* @param rows - Rows that have been added.
*/
oninsertrow?: (
instance: WorksheetInstance,
rows: {
row: number,
data: CellValue[],
}[]
) => void;
onload
来自SpreadsheetOptions
/**
* Event fired when a spreadsheet is created.
* @param instance - Jspreadsheet instance.
*/
onload?: (
instance: SpreadsheetInstance
) => void;
onmerge
来自SpreadsheetOptions
/**
* Occurs when a group of cells is merged.
* @param instance - Instance of the worksheet where the change occurred.
* @param merges - Merges that were created.
*/
onmerge?: (
instance: WorksheetInstance,
merges: Record<string, [number, number]>,
) => void;
onmovecolumn
来自SpreadsheetOptions
/**
* Occurs after a column is moved to a new position.
* @param instance - Instance of the worksheet where the change occurred.
* @param oldPosition - Column index before movement.
* @param newPosition - Column index after movement.
* @param quantity - Number of columns that were moved.
*/
onmovecolumn?: (
instance: WorksheetInstance,
oldPosition: number,
newPosition: number,
quantity: number,
) => void;
onmoverow
来自SpreadsheetOptions
/**
* Occurs after a row is moved to a new position.
* @param instance - Instance of the worksheet where the change occurred.
* @param oldPosition - Row index before movement.
* @param newPosition - Row index after movement.
* @param quantity - Number of rows that were moved.
*/
onmoverow?: (
instance: WorksheetInstance,
oldPosition: number,
newPosition: number,
quantity: number,
) => void;
onpaste
来自SpreadsheetOptions
/**
* Occurs after a paste action is performed in the javascript table.
* @param instance - Instance of the worksheet where the change occurred.
* @param pastedInfo - Information that was pasted into the worksheet.
*/
onpaste?: (
instance: WorksheetInstance,
pastedInfo: {
x: number,
y: number,
value: CellValue,
}[][]
) => void;
onredo
来自SpreadsheetOptions
/**
* Occurs when a change is redone.
* @param instance - Instance of the worksheet where the change occurred.
* @param historyRecord - History item that was redone. If there are no more actions to redo, it takes the value undefined.
*/
onredo?: (
instance: WorksheetInstance,
historyRecord: HistoryRecord | undefined
) => void;
onresizecolumn
来自SpreadsheetOptions
/**
* Occurs after a change in column width.
* @param instance - Instance of the worksheet where the change occurred.
* @param colIndex - Index of columns that were resized.
* @param newWidth - New column widths.
* @param oldWidth - Old column widths.
*/
onresizecolumn?: (
instance: WorksheetInstance,
colIndex: number | number[],
newWidth: number | number[],
oldWidth: number | number[],
) => void;
onresizerow
来自SpreadsheetOptions
/**
* Occurs after a change in row height.
* @param instance - Instance of the worksheet where the change occurred.
* @param rowIndex - Index of row being resized.
* @param newHeight - New row height.
* @param oldHeight - Old row height.
*/
onresizerow?: (
instance: WorksheetInstance,
rowIndex: number,
newHeight: number,
oldHeight: number
) => void;
onsave
来自SpreadsheetOptions
/**
* Occurs when persistence on the server succeeds.
* @param spreadsheetInstance - Spreadsheet instance.
* @param worksheetInstance - Instance of the worksheet to be saved.
* @param data - Data that has been sent to the server.
*/
onsave?: (
spreadsheetInstance: SpreadsheetInstance,
worksheetInstance: WorksheetInstance,
data: any
) => void;
onselection
来自SpreadsheetOptions
/**
* Occurs when selection is changed.
* @param instance - Instance of the worksheet where the change occurred.
* @param borderLeftIndex - Index of the first column contained by the selection.
* @param borderTopIndex - Index of the first row contained by the selection.
* @param borderRightIndex - Index of the last column contained by the selection.
* @param borderBottomIndex - Index of the last row contained by the selection.
* @param origin - Javascript event that triggered this jss event.
*/
onselection?: (
instance: WorksheetInstance,
borderLeftIndex: number,
borderTopIndex: number,
borderRightIndex: number,
borderBottomIndex: number,
origin: Event | undefined,
) => void;
onsort
来自SpreadsheetOptions
/**
* Occurs after a colum is sorted.
* @param instance - Instance of the worksheet where the change occurred.
* @param colIndex - Index of the column that was sorted.
* @param order - Sorting direction. 0 for ascending and 1 for descending.
* @param newOrderValues - The new order of the rows.
*/
onsort?: (
instance: WorksheetInstance,
colIndex: number,
order: 0 | 1,
newOrderValues: number[],
) => void;
onundo
来自SpreadsheetOptions
/**
* Occurs when a change is undone.
* @param instance - Instance of the worksheet where the change occurred.
* @param historyRecord - History item that was undone. If there are no more actions to undo, it takes the value undefined.
*/
onundo?: (
instance: WorksheetInstance,
historyRecord: HistoryRecord | undefined
) => void;
parseFormulas
来自SpreadsheetOptions
/**
* Enable execution of formulas inside the table.
* @default true
*/
parseFormulas?: boolean;
sorting
来自SpreadsheetOptions
/**
* Function used in sorting columns. If not specified, the default function will be used.
* @param order - Sorting direction. 0 for ascending and 1 for descending.
*/
sorting?: (
order: 0 | 1
) => (itemA: SortingItem, itemB: SortingItem) => number;
parseHTML
来自SpreadsheetOptions
/**
* If false, HTML inside cell values will be treated as regular text. If true, the HTML will be treated as HTML.
* @default false
*/
parseHTML?: boolean;
tabs
来自SpreadsheetOptions
/**
* If true, the button to create new worksheets is shown.
* @default false
*/
tabs?: boolean;
toolbar
来自SpreadsheetOptions
/** Add custom toolbars. */
toolbar?: boolean | ToolbarItem[] | ((defaultToolbar: ToolbarItem[]) => ToolbarItem[]) | Record<string, any>;
worksheets
来自SpreadsheetOptions
/**
* Worksheet settings.
*/
worksheets: WorksheetOptions[];
WorksheetOptions
allowComments
来自WorksheetOptions
/**
* Allow comments over the cells.
* @default true
*/
allowComments?: boolean;
allowDeleteColumn
来自WorksheetOptions
/**
* Allow delete a column.
* @default true
*/
allowDeleteColumn?: boolean;
allowDeleteRow
来自WorksheetOptions
/**
* Allow delete a row.
* @default true
*/
allowDeleteRow?: boolean;
allowDeletingAllRows
来自WorksheetOptions
/**
* Allow remove all rows. Otherwise, at least one row will be kept.
* @default false
*/
allowDeletingAllRows?: boolean;
allowInsertColumn
来自WorksheetOptions
/**
* Allow insert a new column.
* @default true
*/
allowInsertColumn?: boolean;
allowInsertRow
来自WorksheetOptions
/**
* Allow insert a new row.
* @default true
*/
allowInsertRow?: boolean;
allowManualInsertColumn
来自WorksheetOptions
/**
* Allow user to insert a new column using tab key on last column.
* @default true
*/
allowManualInsertColumn?: boolean;
allowManualInsertRow
来自WorksheetOptions
/**
* Allow user to insert a new row using space key on last row.
* @default true
*/
allowManualInsertRow?: boolean;
allowRenameColumn
来自WorksheetOptions
/**
* Allow rename a column.
* @default true
*/
allowRenameColumn?: boolean;
classes
来自WorksheetOptions
/**
* Css classes to apply to cells. Only one class per cell is accepted.
* @example
* {
* A1: "some-class",
* B3: "another-class"
* }
*/
classes?: Record<string, string>;
columnDrag
来自WorksheetOptions
/**
* Allow column dragging.
* @default true
*/
columnDrag?: boolean;
columnResize
来自WorksheetOptions
/**
* Allow column resizing.
* @default true
*/
columnResize?: boolean;
columns
来自WorksheetOptions
/** Column settings. */
columns?: Column[];
columnSorting
来自WorksheetOptions
/**
* Allow column sorting.
* @default true
*/
columnSorting?: boolean;
comments
来自WorksheetOptions
/**
* Worksheet comments. Each object key is a cell name and its value is its comment.
*/
comments?: Record<string, string>;
csv
来自WorksheetOptions
/**
* Load a external CSV file from this URL.
*/
csv?: string;
csvDelimiter
来自WorksheetOptions
/**
* Default delimiter for the CSV file. This value is used for both import and export.
* @default ","
*/
csvDelimiter?: string;
csvFileName
来自WorksheetOptions
/**
* Default filename for a download method.
* @default "jspreadsheet"
*/
csvFileName?: string;
csvHeaders
来自WorksheetOptions
/**
* Load header titles from the CSV file.
* @default false
*/
csvHeaders?: boolean;
data
来自WorksheetOptions
/** Data loaded into the spreadsheet. */
data?: CellValue[][] | Record<string, CellValue>[];
defaultColAlign
来自WorksheetOptions
/**
* Default horizontal alignment used when a column does not have its alignment specified.
* @default "center"
*/
defaultColAlign?: HorizontalAlign;
defaultColWidth
来自WorksheetOptions
/**
* Default width for columns with no specified width.
* @default 100
*/
defaultColWidth?: number;
defaultRowHeight
来自WorksheetOptions
/**
* Default row height.
*/
defaultRowHeight?: number;
editable
来自WorksheetOptions
/**
* Allow table edition.
* @default true
*/
editable?: boolean;
filters
来自WorksheetOptions
/**
* Enable column filters.
* @default false
*/
filters?: boolean;
footers
来自WorksheetOptions
/**
* Set the initial footer of the spreadsheet
*/
footers?: string[][];
freezeColumns
来自WorksheetOptions
/**
* Number of columns frozen at the top of the spreadsheet.
*/
freezeColumns?: number;
lazyLoading
来自WorksheetOptions
/** Activate the table lazyloading. */
lazyLoading?: boolean;
mergeCells
来自WorksheetOptions
/** Cells to be merged in the table innitialization. */
mergeCells?: Record<string, [number, number]>;
meta
来自WorksheetOptions
/**
* Meta information.
*/
meta?: Record<string, MetaInformation>;
minDimensions
来自WorksheetOptions
/**
* Minimum table dimensions: [cols, rows].
* @default [0, 0]
*/
minDimensions?: [number, number];
minSpareCols
来自WorksheetOptions
/**
* Minimum number of spare cols.
* @default 0
*/
minSpareCols?: number;
minSpareRows
来自WorksheetOptions
/**
* Minimum number of spare rows.
* @default 0
*/
minSpareRows?: number;
nestedHeaders
来自WorksheetOptions
/** Define the nested headers. */
nestedHeaders?: NestedHeaderCell[][];
pagination
来自WorksheetOptions
/** Number of rows per page. */
pagination?: number;
paginationOptions
来自WorksheetOptions
/**
* Values available in the dropdown for choosing the number of rows per page.
*
* This dropdown is only visible when the {@link WorksheetOptions.search} option is true and the {@link WorksheetOptions.pagination} option is greater than 0.
*/
paginationOptions?: number[];
parseTableAutoCellType
来自WorksheetOptions
/**
* Try to identify the column type when the instance is created with a table tag.
* @default false
*/
parseTableAutoCellType?: boolean;
parseTableFirstRowAsHeader
来自WorksheetOptions
/**
* If creating the instance with a table tag, if this tag has no header, transform the first line into the header.
* @default false
*/
parseTableFirstRowAsHeader?: boolean;
persistence
来自WorksheetOptions
/**
* Route where requests for data persistence will be sent. If true, the {@link WorksheetOptions.url} property value will be used instead.
*/
persistence?: boolean | string;
plugins
来自WorksheetOptions
/**
* Spreadsheet plugins.
*/
plugins?: Record<string, () => Plugin>;
root
来自WorksheetOptions
/**
* DOM element for binding the javascript events. This property is normally used when JSS is running as a web component.
*/
root?: HTMLElement;
rowDrag
来自WorksheetOptions
/**
* Allow row dragging.
* @default true
*/
rowDrag?: boolean;
rowResize
来自WorksheetOptions
/**
* Allow row resizing.
* @default true
*/
rowResize?: boolean;
rows
来自WorksheetOptions
/** Row settings. */
rows?: Row[] | Record<number, Row>;
search
来自WorksheetOptions
/**
* Allow search in the table.
* @default false
*/
search?: boolean;
secureFormulas
来自WorksheetOptions
/**
* If true, Jss will capitalize characters that are part of formulas. This does not apply to characters enclosed in double quotes, which represent text within formulas.
* @default true
*/
secureFormulas?: boolean;
selectionCopy
来自WorksheetOptions
/**
* Display the copy icon in the lower right corner of the selection.
* @default true
*/
selectionCopy?: boolean;
style
来自WorksheetOptions
/**
* Cell styles.
*/
style?: Record<string, string>;
tableHeight
来自WorksheetOptions
/**
* Set the max height of the table.
* This property is only used when {@link WorksheetOptions.tableOverflow} is allowed.
*/
tableHeight?: string | number;
tableOverflow
来自WorksheetOptions
/**
* Allow table overflow.
* @default false
*/
tableOverflow?: boolean;
tableWidth
来自WorksheetOptions
/**
* Set the max width of the table.
* This property is only used when {@link WorksheetOptions.tableOverflow} is allowed.
*/
tableWidth?: string | number;
textOverflow
来自WorksheetOptions
/**
* If true, cell contents may overflow over empty cells.
* @default false
*/
textOverflow?: boolean;
url
来自WorksheetOptions
/** Load a external json file from this URL. */
url?: string;
wordWrap
来自WorksheetOptions
/**
* Global text wrapping.
* @default false
*/
wordWrap?: boolean;
worksheetName
来自WorksheetOptions
/**
* Worksheet name.
*/
worksheetName?: string;