ve.Spreadsheet

ve.Component. ve.Spreadsheet

Refer to ve.Component for methods or fields inherited from this Component's parent such as .options.attributes or .element.

Spreadsheet editor that returns a 2D array list/object using iframes for encapsulation. Excel/Google Sheets/HTML compatible with formulas and limited styling options. Note that there might be a slight initialisation delay due to lazy-loading.

The reason this does not always serialise to an Array is so that formulas and format data can be preserved.

  • Functional binding: veSpreadsheet().
Constructor:
  • arg0_value: Array<Array<Array<any>>>|Object
    • Nested arrays: [n1] - Container, [n2] - Sheet, [n3] - Row
  • arg1_options: Object
    • .dark_mode=false: boolean - Whether the spreadsheet editor should launch in dark mode.
Instance:
Methods:
  • convertToArray() | Array<Array<Array<any>>>
  • convertToSpreadsheet() | ve.Spreadsheet
  • convertToTable() | ve.Table
  • fromArray(arg0_array:Array<Array<Array<any>>>, arg1_do_not_display=false:boolean) | Object
  • fromJSON(arg0_json:Object)
  • getCellData(arg0_sheet_index:number|string, arg1_x:number, arg2_y:number) | {f:string, v:number}
  • getSelectedRange() | [[number, number, number], [number, number, number]]
  • getSheetNames() | Array<{@string}>
  • setCellData(arg0_sheet_index:number|string, arg1_x:number, arg2_y:number, arg3_value:{f:string, v:number})
  • setDarkMode(arg0_value=false:boolean)
  • setSelectedRange(arg0_sheet_index:number|string, arg1_start_coords:[number, number, number], arg2_end_coords:[number, number, number])
  • toJSON() | Object
Static Fields:
  • .instances: Array<this:ve.Spreadsheet>
Static Methods:
  • fireToBinding(arg0_table_id:string)

Extends

Members

v :Object

Returns the current Object value, including both formulas/cells.

  • Accessor of: ve.Spreadsheet
Source:
Type:

v

Sets the Object value contained in the Component, including both formulas/cells.

  • Accessor of: ve.Spreadsheet
Source:

from_binding

Internal .from_binding setter for handling .options.from_binding. Accepts a string literal that is then parsed to a variable reference.

.to_binding counterparts are manually handled child-side.

Overrides:
Source:

limit

Tests the current this.limit by calling this.limit_function(this.v, this). Otherwise resolves to true if no .options.limit is set.

Overrides:
Source:

name

Returns the visual name of the present ve.Component,

Overrides:
Source:

Methods

#fireToBinding(arg0_table_id)

Fires to_binding statically, used by the embedded iframe since it has no this context.

  • Static method of: ve.Spreadsheet
Source:
Parameters:
Name Type Description
arg0_table_id string

convertToArray() → {Array}

Converts the present value to a 3D array.

  • Method of: ve.Spreadsheet
Source:
Returns:
Type:
Array

convertToSpreadsheet() → {ve.Spreadsheet}

Restores the Spreadsheet view. If the Table is currently active, it syncs the data back from the Table before swapping.

  • Method of: ve.Spreadsheet
Source:
Returns:
Type:
ve.Spreadsheet

fromArray(arg0_array, arg1_do_not_displayopt) → {Object}

Sets the present component value from an exported 3D array.

  • Method of: ve.Spreadsheet
Source:
Parameters:
Name Type Attributes Default Description
arg0_array Array
arg1_do_not_display boolean <optional>
false
Returns:
Type:
Object

fromJSON(arg0_json)

Loads a complete JSON snapshot into the workbook, restoring all sheets, styles, and cell dimensions.

  • Method of: ve.Spreadsheet
Source:
Parameters:
Name Type Description
arg0_json Object

getCellData(arg0_sheet_index, arg1_x, arg2_y) → {Object}

Returns cell data as an Object. Coords are 1-indexed.

Source:
Parameters:
Name Type Description
arg0_sheet_index number | string
arg1_x number
arg2_y number
Returns:
Type:
Object

getRangeName(arg0_coords) → {string}

Returns the range name given a set of coordinates.

Source:
Parameters:
Name Type Description
arg0_coords Array.<Array.<number>>
Returns:
Type:
string

getSelectedRange() → {Array.<Array.<number>>}

Returns the currently selected range as a 2D array of [[sheet_index, start_x, start_y], [sheet_index, end_x, end_y]]. Coords are 1-indexed.

Source:
Returns:
Type:
Array.<Array.<number>>

getSelectedRangeName() → {string}

Returns the name of the currently selected range.

Source:
Returns:
Type:
string

getSheetNames() → {Array.<string>}

Returns all current sheet names.

Source:
Returns:
Type:
Array.<string>

setCellData(arg0_sheet_index, arg1_x, arg2_y, arg3_value)

Sets cell data at a target coordinate to a given Object value. Coords are 1-indexed.

Source:
Parameters:
Name Type Description
arg0_sheet_index number | string
arg1_x number
arg2_y number
arg3_value Object

setDarkMode(arg0_valueopt)

Sets the theme of the current Table component, either to dark mode or light mode.

  • Method of: ve.Spreadsheet
Source:
Parameters:
Name Type Attributes Default Description
arg0_value boolean <optional>
false

setSelectedRange(arg0_start_coords, arg1_end_coords)

Sets the currently selected range to a target coordinate range. Coords are 1-indexed.

Source:
Parameters:
Name Type Description
arg0_start_coords Array.<number>
arg1_end_coords Array.<number>

toJSON() → {Object}

Returns a complete JSON snapshot of the workbook, including styles, formatting, column widths, and row heights for all sheets.

  • Method of: ve.Spreadsheet
Source:
Returns:
Type:
Object

addComponent()

Adds the current component to this.parent_el should it exist.

Overrides:
Source:

bind(arg0_container_el)

Manually binds/mounts the present ve.Component into the visual DOM.

Overrides:
Source:
Parameters:
Name Type Description
arg0_container_el HTMLElement

fireFromBinding()

Pseudo-setter from binding. Fires only upon program-driven changes to .v directly, which means that this has to be monitored manually component-side in set v(). This should always come last in set v().

Overrides:
Source:

fireToBinding()

Pseudo-setter to binding. Fires only upon user-driven changes, which means that this has to be monitored manually component-side.

Overrides:
Source:

remove()

Removes the component/element from the DOM.

Overrides:
Source:

removeComponent()

Removes the current component from this.parent_el should it exist.

Overrides:
Source:

setOwner(arg0_value, arg1_owner_array)

Sets the root parent and ownership tree. Influences this.parent_el, this.owner, this.owners.

Overrides:
Source:
Parameters:
Name Type Description
arg0_value
arg1_owner_array

setValueFromObject(arg0_object, arg1_object)

Destructures Object values and transfers them into the .v instance fields of each Vercengen component.

Overrides:
Source:
Parameters:
Name Type Description
arg0_object Object

The Vercengen object to transfer to.

arg1_object Object

The other object to transfer from.