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.

Hierarchy

Implements

Constructors

Properties

[___Signature__]: Signature

(secret)

Because classes are kind of like interfaces, we need "something" to help TS know what a Resource is.

This isn't a real API, but does help with type inference with the SignatureFrom utility above

meta: {
    column: typeof ColumnMeta;
    table: typeof TableMeta;
} = ...

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

  • column: typeof ColumnMeta
  • table: typeof TableMeta
name: string = 'column-visibility'

Unique name for the plugin.

  • only one plugin of the same name is allowed
  • the name is used for storing preferences / serializable information
table: Table<unknown>
features: string[] = ...
requires?: string[]

Accessors

  • get columns(): Column<unknown>[]
  • 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.

    Returns Column<unknown>[]

Methods

  • Helper for specifying column-level configurations for a plugin on headlessTable's columns option

    Type Parameters

    Parameters

    • this: Constructor<T, any[]>
    • configFn: (() => ColumnOptionsFor<SignatureFrom<T>>)
        • (): ColumnOptionsFor<SignatureFrom<T>>
        • Returns ColumnOptionsFor<SignatureFrom<T>>

    Returns [Constructor<T, any[]>, (() => ColumnOptionsFor<SignatureFrom<T>>)]

  • Helper for specifying plugins on headlessTable with the plugin-level options

    Type Parameters

    Parameters

    • this: Constructor<T, any[]>
    • configFn: (() => OptionsFor<SignatureFrom<T>>)
        • (): OptionsFor<SignatureFrom<T>>
        • Returns OptionsFor<SignatureFrom<T>>

    Returns [Constructor<T, any[]>, (() => OptionsFor<SignatureFrom<T>>)]

Generated using TypeDoc