Interface Plugin<Signature>

Table plugins are stateless objects that optionally provide hooks based on what the plugin wishes to modify.

If state is desired, Metadata classes may be provided to manage that state. As a convenience, when the meta classes are instantiated, they'll be given the same owner as everything else in the application, so service injection will be available within the meta class instances.

A plugin can provide components that the consuming Table can opt in to rendering. (though, often these components will be required to be rendered for the plugin to work)

a Plugin has one type argument:

  • Signature - which can provide optional information about the Meta/State and Options the plugin can take

    Any particular plugin instantiation will have at most 1 instance of their TableMeta and n instances of their ColumnMeta, where n is at most the number of columns.

Type Parameters

  • Signature = unknown

Hierarchy

  • Plugin

Implemented by

Properties

columns?: Column<any>[]

Kind

Table Hook

A plugin may change the columns order, visibility, etc. By implementing this getter, this plugin's columns property will be used by other plugins via the columns.for(table, RequestingPlugin) api.

For the end-consumer, they may choose to do columns.for(table), which will aggregate all column modifications from all plugins.

As always, table.columns is the way to get the unmodified list of columns.

containerModifier?: ((element: HTMLElement, ...args: [Table<any>]) => void | Destructor)

Type declaration

    • (element: HTMLElement, ...args: [Table<any>]): void | Destructor
    • Kind

      Table hook

      Specify a modifier setup/teardown function to attach to the table's containing element

      Parameters

      • element: HTMLElement
      • Rest ...args: [Table<any>]

      Returns void | Destructor

features?: string[]

Some plugins may require that other plugins be present. and because plugins can be interchangeable, the features implemented by those plugins must be declared via strings so that we can have a semi-stable reference that isn't tied to object equality or anything like that.

This enables, for example, the StickyColumns plugin to work with different implementations of the ColumnResizing plugin (such as one might have between an aria-grid and a data table)

headerCellModifier?: ((element: HTMLElement, ...args: [ColumnApi<Table<any>>]) => void | Destructor)

Type declaration

    • (element: HTMLElement, ...args: [ColumnApi<Table<any>>]): void | Destructor
    • Kind

      Column property

      Specify a modifier setup/teardown function to attach to each of the header cells

      Can be used to add / remove attributes, event listeners, etc

      Parameters

      Returns void | Destructor

meta?: {
    column?: Constructor<ColumnMetaFor<Signature>, any[]>;
    row?: Constructor<RowMetaFor<Signature>, any[]>;
    table?: Constructor<TableMetaFor<Signature>, any[]>;
}

Optional state that this plugin may or may not choose to use

columns will each have an instance of meta.column. the table will have only one instance of meta.table.

Type declaration

  • Optional column?: Constructor<ColumnMetaFor<Signature>, any[]>

    Specifies the class definition to use for storing column-related state / behavior for this plugin

  • Optional row?: Constructor<RowMetaFor<Signature>, any[]>

    Specifies the class definition to use for storing the row-related state / behavior for this plugin

  • Optional table?: Constructor<TableMetaFor<Signature>, any[]>

    Specifies the class definition to use for storing table-related state / behavior for this plugin

name: string

Unique name for the plugin.

  • only one plugin of the same name is allowed
  • the name is used for storing preferences / serializable information
requires?: string[]

List of features to lookup "somewhere" in the list of plugins order does not matter.

reset?: (() => void)

Type declaration

    • (): void
    • Kind

      Table Hook

      If the plugin has state, this should be used to reset that state

      Returns void

rowModifier?: ((element: HTMLElement, ...args: [RowApi<Table<any>>]) => void | Destructor)

Type declaration

    • (element: HTMLElement, ...args: [RowApi<Table<any>>]): void | Destructor
    • Kind

      Row property

      Specify a modifier setup/teardown function to attach to each of the rows

      Can be used to add / remove attributes, event listeners, etc

      Parameters

      • element: HTMLElement
      • Rest ...args: [RowApi<Table<any>>]

      Returns void | Destructor

Generated using TypeDoc