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

A Plugin may either be a class or plain object

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 three type arguments:

  • ColumnMeta - optional state for storing and managing information per column

  • TableMeta - optional state for storing and managing information about the table

    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

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

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 options(): undefined | Options
  • Utility property that returns the resulting options passed during table creation for this specific plugin.

    Returns undefined | Options

Methods

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

    Type Parameters

    • T extends BasePlugin<unknown, unknown, unknown, unknown, T>

    Parameters

    • this: Constructor<T, any[]>
    • configFn: (() => ReturnType<InstanceOf<T>["getColumnOptions"]>)
        • (): ReturnType<InstanceOf<T>["getColumnOptions"]>
        • Returns ReturnType<InstanceOf<T>["getColumnOptions"]>

    Returns [Constructor<T, any[]>, (() => ReturnType<InstanceOf<T>["getColumnOptions"]>)]

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

    Type Parameters

    • T extends BasePlugin<unknown, unknown, unknown, unknown, T>

    Parameters

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

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

Generated using TypeDoc