Class Spreadsheet

Hierarchy

Constructors

Properties

Accessors

Methods

Constructors

Properties

#m_timers: Map<string, Function>
m_auto_row_count: boolean
m_autoedit: boolean
m_cells_data: Map<number, CellData>
m_columns: ColProp[]
m_itemHeight: number
m_lockupdate: number
m_row_count: number
m_row_limit: number
m_rows_data: Map<number, string>
m_selection: {
    col: number;
    row: number;
}

Type declaration

  • col: number
  • row: number
m_topIndex: number
m_used_cells: Component<CProps<CEventMap>, CEventMap>[]
m_visible_cells: Map<number, Component<CProps<CEventMap>, CEventMap>>

Accessors

  • get dom(): HTMLElement
  • return the DOM associated with the Component (if any)

    Returns HTMLElement

Methods

  • build cells of the spreadsheet cells are recycled when scrolling, only visibles cells exists

    Returns void

  • compute columns widths use col.width for fixed size columns if col.width < 0 that mean that this is a proportion of the remaining space

    Parameters

    • width: number

    Returns Int32Array

  • compute misc dimensions

    • item height
    • scroll width

    Returns void

  • Parameters

    • row: number
    • col: number
    • raw: boolean = false

    Returns CellData

  • Parameters

    • sensy: number
    • sensx: number

    Returns void

  • Parameters

    • col: any
    • width: any

    Returns void

  • Parameters

    • row: number
    • col: number

    Returns void

  • Parameters

    • rowIdx: number
    • colIdx: number
    • Optional scrollIntoView: boolean

    Returns void

  • a some classnames to the component classes can be separated by a space

    Example

    addClass( 'my class name @flex' );
    

    Parameters

    • name: string

    Returns void

  • add an application shortcut

    Parameters

    • sequence: string | string[]

      key sequence Shift+Ctrl+Alt+K

    • name: string
    • callback: EventHandler<KeyboardEvent> = null

      callback to call

    • immediate: boolean = false

    Returns void

  • remove a column

    Parameters

    • coltodel: number

    Returns void

  • remove a row

    Parameters

    • rowtodel: number

      row number to remove

    Returns void

  • Parameters

    • row: number
    • col: number
    • Optional forcedText: string

    Returns void

  • Parameters

    • Optional forceText: string

    Returns void

  • enum all children recursively

    Parameters

    • cb: ((child) => boolean | void)

      callback return true to stop enumeration

    • recursive: boolean = false

      if true do a full sub-child search

    Returns boolean

  • get an attribute value

    Example

    let chk = el.getAttribute( 'checked' );
    @review double cache

    Parameters

    • name: string

      attribute name

    Returns string

    attribute value

  • Example

    let rc = el.getBoundingRect( );
    console.log( rc.left, rc.top, rc.right, rc.bottom );

    Parameters

    • withMargins: boolean = false

    Returns Rect

    the bounding rectangle

  • Parameters

    • row: number
    • col: number

    Returns number

  • Parameters

    • row: number
    • col: number

    Returns string

  • return the maximum row index filled with something

    Returns number

  • return the selection { row, col }

    Returns {
        col: number;
        row: number;
    }

    • col: number
    • row: number
  • check if the element has an attribute

    Example

    if( el.hasAttribute('checked') ) {
    }

    Parameters

    • name: string

      attribute name

    Returns boolean

    true is attribute is present

  • insert a new column

    Parameters

    • before: number

      column index before to insert the new column or <0 to append

    • column: ColProp

    Returns void

  • insert a row

    Parameters

    • before: number

      row number before wich insert the new row

    Returns void

  • handle an event one time

    Type Parameters

    Parameters

    • type: K
    • callback: ((ev) => any)

      callback to call when event is signaled

    Returns void

    Promise if callback is null

    take care with that because if the event is never fired and you await it, the system may overflow

  • Remove a class from the element

    Example

    el.removeClass( 'myclass' );
    el.removeClass( 'myclass1 myclass2' );

    Parameters

    • name: string

      classes in string form can be space separated

    Returns void

  • ensure the component is visible @param: alignToTop

    Parameters

    • Optional arg: boolean | ScrollIntoViewOptions

    Returns void

  • Parameters

    • row: number
    • col: number
    • scrollIntoView: boolean = true

    Returns void

  • change a single attribute

    Parameters

    • name: string

      attribute name

    • value: any

      new value

    Returns void

  • Parameters

    • row: number
    • col: number
    • cls: string

    Returns void

  • Parameters

    • row: number
    • col: number
    • value: string

    Returns void

  • Parameters

    • col: number
    • title: string

    Returns void

  • Parameters

    • col: number
    • width: number

    Returns void

  • set the Component data value

    Parameters

    • name: string | Symbol

      name to get

    • value: any

    Returns void

  • set the event default handler

    Parameters

    • eventName: string

      name of the event

    • callback: EventCallback<BasicEvent>

      callback to call when the event is not handled (and preventDeault has not been called)

    Returns void

  • append a new dom event handler

    Example

    this.setDomEvent( 'drag drop', this._handleDrag, this );
    this.setDomEvent( 'dblclick', this._handleDblClick, this );

    Type Parameters

    Parameters

    • type: K
    • listener: ((this, ev) => void)
        • (this, ev): void
        • Parameters

          Returns void

    • Optional passive: boolean

    Returns void

  • change the object style

    Example

    el.setStyle( {left:100} );
    

    Parameters

    • style: object

      style to add

    Returns void

  • change a style value

    Parameters

    • name: string

      string style nale

    • value: any

      any style value or null to remove style

    Returns void

  • start a new timer

    Parameters

    • name: string

      timer name

    • timeout: number

      time out in ms

    • repeat: boolean = true

      if true this is an auto repeat timer

    • callback: TimerCallback = null

      if !null, the callback to call else a EvTimer is fired

    Returns void

  • Toggle a class from the element (if present remove, if absent add)

    Example

    el.toggleClass( 'myclass' );
    el.toggleClass( 'myclass1 myclass2');
    el.toggleClass( ['myclass1','myclass2']);

    Parameters

    • name: string

      classes in string form can be space separated

    Returns void

  • get a component from a DOM element move up to the hierarchy to find the request class type.

    Example

    with a DOM like that:
    Button
    Label
    Icon <- the DOM you have (dom-icon)

    let btn = Component.getElement( dom-icon, Button );

    Type Parameters

    Parameters

    • dom: Element | HTMLElement
    • Optional classname: string | Constructor<T>

    Returns T

  • capture mouse events

    Example

    Component.setCapture( this, ( ev: MouseEvent, initiator: Component ) => {
    if( ev.type=='mousemove' ) {
    this.setStyle( {
    left: ev.clientX,
    top: ev.clientY
    } );
    }
    else if( ev.type=='mouseup' ) {
    Component.releaseCapture( );
    }
    } );

    Parameters

    Returns void

Generated using TypeDoc