@sparser/au2-data-grid
Version:
A data grid for Aurelia 2
65 lines • 3.12 kB
TypeScript
import { Constructable } from '@aurelia/kernel';
import { CustomElementType, ICustomElementController, ICustomElementViewModel, IPlatform } from '@aurelia/runtime-html';
import { ContentModel } from './content-model.js';
import { GridHeader } from './grid-header.js';
import { ChangeType, ExportableGridState, GridStateChangeSubscriber, OrderChangeData } from './grid-state.js';
import { SortOption } from './sorting-options.js';
/**
* Default implementation of the data-grid.
*/
export declare class DataGrid implements ICustomElementViewModel, GridStateChangeSubscriber {
private static id;
/**
* The content model (data).
*/
model: ContentModel<Record<string, unknown>>;
/**
* Any bound state is read only once in the binding stage.
* Any 'incoming' changes from the consumer side thereafter is disregarded.
* In the post-binding phase this property is treated as a write-only property to provide the consumer side with any changes in the exportable grid state.
*/
state?: ExportableGridState;
/**
* Callback when a item is
* - clicked with the 'None' selection mode, or
* - double-clicked with 'Single' or 'Multiple' selection mode.
*/
itemClicked?: (data: {
item: unknown;
index: number;
}) => void;
/**
* This is a one-time bindable array of string columnIds that needs to be hidden from the current instance of the grid.
*/
hiddenColumns: string[];
private stateModel;
readonly $controller?: ICustomElementController<this>;
private readonly containerEl;
private lastClickedRow;
private selectionUpdateSignal;
private readonly hydrationContext;
private readonly node;
private readonly signaler;
private readonly logger;
created(controller: ICustomElementController<this>): void;
binding(): void;
attaching(): void;
unbinding(): void;
exportState(): ExportableGridState | undefined;
handleGridStateChange(type: ChangeType.Width): void;
handleGridStateChange(type: ChangeType.Order, value: OrderChangeData): void;
handleGridStateChange(type: ChangeType.Sort, newValue: SortOption<Record<string, unknown>>, oldValue: SortOption<Record<string, unknown>> | null): void;
protected adjustColumnWidth(): void;
protected handleDblClick(item: Record<string, unknown>, index: number): void;
protected handleClick(event: MouseEvent, item: Record<string, unknown>, index: number): void;
static processContent(content: HTMLElement, platform: IPlatform): void;
}
export declare const DefaultDataGrid: CustomElementType<Constructable<DataGrid>>;
/**
* Creates data-grid custom element registration.
* @param {CustomElementType<THeader>} header The grid-header custom element registration.
* @returns {CustomElementType<Constructable<DataGrid>>} Data grid custom element registration.
* @template THeader
*/
export declare function defineDataGridCustomElement<THeader extends Constructable<GridHeader>>(header: CustomElementType<THeader>): CustomElementType<Constructable<DataGrid>>;
//# sourceMappingURL=data-grid.d.ts.map