import { Table } from "../../table-443deac1.js"; import { ColumnReordering } from "../column-reordering/index.js"; import { ColumnVisibility } from "../column-visibility/index.js"; import { Class, Constructor } from "../../-private/private-types.js"; import { Column, Row } from "../../index.js"; import { ColumnMetaFor, ColumnOptionsFor, OptionsFor, Plugin, RowMetaFor, TableMetaFor } from "../../-private/interfaces/index.js"; type InstanceOf = T extends Class ? Instance : T; /** * @public * * list of interfaces by feature name that consumers may provide alternative * implementation for */ interface TableFeatures extends Record { /** * @public * * interface for the table meta of a "column visibility plugin" */ columnVisibility: InstanceOf; /** * @public * * interface for the table meta of a "column order plugin" */ columnOrder: InstanceOf; } /** * @public * * list of interfaces by feature name that consumers may provide alternative * implementation for */ interface ColumnFeatures extends Record { /** * @public * * interface for the column meta of a "column visibility plugin" */ columnVisibility: InstanceOf; /** * @public * * interface for the column meta of a "column order plugin" */ columnOrder: InstanceOf; } /** * @private utility type * */ type SignatureFrom> = Klass extends BasePlugin ? Signature : never; declare const __Signature__: unique symbol; /** * @public * * If your table plugin is a class, you may extend from BasePlugin, which provides * small utility methods and properties for getting the metadata for your plugin * for the table and each column * * One instance of a plugin exists per table */ declare abstract class BasePlugin implements Plugin { protected table: Table; constructor(table: Table); /** * @private (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 */ [__Signature__]: Signature; /** * Helper for specifying plugins on `headlessTable` with the plugin-level options */ /** * Helper for specifying plugins on `headlessTable` with the plugin-level options */ static with>(this: Constructor, configFn: () => OptionsFor>): [Constructor, () => OptionsFor>]; /** * Helper for specifying column-level configurations for a plugin on `headlessTable`'s * columns option */ /** * Helper for specifying column-level configurations for a plugin on `headlessTable`'s * columns option */ static forColumn>(this: Constructor, configFn: () => ColumnOptionsFor>): [Constructor, () => ColumnOptionsFor>]; meta?: { column?: Constructor>; table?: Constructor>; row?: Constructor>; }; abstract name: string; static features?: string[]; static requires?: string[]; } /** * @public * * returns boolean if the passed table has an instance of the configured passed plugin class. * This can be used to help guard against accessing public-specific APIs if those plugins * are not configured for a particular table instance */ declare function hasPlugin

, Data = unknown>(table: Table, klass: Class

): boolean; declare const preferences: { /** * @public * * returns an object for getting and setting preferences data * based on the column (scoped to key) * * Only the provided plugin will have access to these preferences * (though, if other plugins can guess how the underlying plugin access * works, they can access this data, too. No security guaranteed) */ forColumn

, Data = unknown>(column: Column, klass: Class

): { /** * delete an entry on the underlying `Map` used for this column-plugin pair */ delete(key: string): void | undefined; /** * get an entry on the underlying `Map` used for this column-plugin pair */ get(key: string): unknown; /** * set an entry on the underlying `Map` used for this column-plugin pair */ set(key: string, value: unknown): void; }; /** * @public * * returns an object for bulk updating preferences data * for all columns (scoped to key and table) */ forAllColumns, Data_1 = unknown>(table: Table, klass: Class): { /** * delete an entry on every column in the underlying column `Map` for this table-plugin pair */ delete(key: string): void | undefined; }; /** * @public * * returns an object for getting and setting preferences data * based on the table (scoped to the key: "table") * * Only the provided plugin will have access to these preferences * (though, if other plugins can guess how the underlying plugin access * works, they can access this data, too. No security guaranteed) */ forTable, Data_2 = unknown>(table: Table, klass: Class): { /** * delete an entry on the underlying `Map` used for this table-plugin pair */ delete(key: string): void | undefined; /** * get an entry on the underlying `Map` used for this table-plugin pair */ get(key: string): unknown; /** * set an entry on the underlying `Map` used for this table-plugin pair */ set(key: string, value: unknown): void | undefined; }; }; /** * if a `requester` is not provided, * Get the columns for the table, considering any and all plugins that could modify columns. * * If you are an end-consumer of ember-headless-table, this is the function to use. * If you are a plugin-author, you'll want to pass your plugin class as the second parameter. * * For a given plugin, `requester`, determine what columns should be returned. * Since multiple plugins could be used in a table, there is an implicit hierarchy of * column modifications that can occur from each of those plugins. * * If a plugin defines other plugins as either *requirements* or *optional requirements*, * and that upstream plugin defines a `columns` property, then those columns will be returned here. * * This works recursively up the plugin tree up until a plugin has no requirements, and then * all columns from the table are returned. */ declare function columnsFor(table: Table, requester?: Plugin | undefined): Column[]; declare const columns: { for: typeof columnsFor; /** * for a given current or reference column, return the column that * is immediately next, or to the right of that column. * * If a plugin class is provided, the hierarchy of column list modifications * will be respected. */ next: (current: Column, requester?: Plugin) => Column | undefined; /** * for a given current or reference column, return the column that * is immediately previous, or to the left of that column. * * If a plugin class is provided, the hierarchy of column list modifications * will be respected. */ previous: (current: Column, requester?: Plugin) => Column | undefined; /** * for a given current or reference column, return the columns that * should appear before, or to the left of that column. * * if a plugin class is provided, the hierarchy of column list modifications * will be respected. */ before: (current: Column, requester?: Plugin) => Column[]; /** * for a given current or reference column, return the columns that * should appear after, or to the right of that column. * * if a plugin class is provided, the hierarchy of column list modifications * will be respected. */ after: (current: Column, requester?: Plugin) => Column[]; }; declare const meta: { /** * @public * * For a given column and plugin, return the meta / state bucket for the * plugin<->column instance pair. * * Note that this requires the column instance to exist on the table. */ forColumn

, Data = unknown>(column: Column, klass: Class

): ColumnMetaFor>; /** * @public * * For a given row and plugin, return the meta / state bucket for the * plugin<->row instance pair. * * Note that this requires the row instance to exist on the table. */ forRow, Data_1 = unknown>(row: Row, klass: Class): RowMetaFor>; /** * @public * * For a given table and plugin, return the meta / state bucket for the * plugin<->table instance pair. */ forTable, Data_2 = unknown>(table: Table, klass: Class): TableMetaFor>; /** * Instead of finding meta based on column or table instances, * you can search for meta based on feature strings, such as `columnWidth` */ withFeature: { /** * @public * * for a given column and feature name, return the "ColumnMeta" for that feature. * This is useful when plugins may depend on one another but may not necessarily care which * plugin is providing what behavior. * * For example, multiple column-focused plugins may care about width or visibility */ forColumn(column: Column, featureName: FeatureName): ColumnFeatures[FeatureName]; /** * @public * * for a given table and feature name, return the "TableMeta" for that feature. * This is useful when plugins may depend on one another but may not necessarily care * which plugin is providing that behavior. * * For example, multiple column-focused plugins may care about width or visibility. */ forTable(table: Table, featureName: FeatureName_1): TableFeatures[FeatureName_1]; }; }; declare const options: { /** * @public * * For a given table and plugin, return the options, if any were given from the user * during construction of the table. */ forTable

, Data = unknown>(table: Table, klass: Class

): Partial>>; forColumn, Data_1 = unknown>(column: Column, klass: Class): Partial>>; }; export { TableFeatures, ColumnFeatures, SignatureFrom, BasePlugin, hasPlugin, preferences, columns, meta, options };