react-select-table
Version:
React table component with selectable items
58 lines (57 loc) • 2.63 kB
TypeScript
export const handlersSymbol: unique symbol;
export function noopEventHandler(): void;
export function getNoopHandlers(): any;
export default class Events {
constructor(selectors: any);
/** @private */
private selectors;
/**
* Returns whether there is a handler for the given event
*
* @param {string} event The name of the event
* @returns {boolean} True, if the handler exists
*/
hasListener(event: string): boolean;
/**
* Calls the {@link TableProps.onSelectionChange} event handler with {@link EventsTypes.SelectionArg} as the argument
*
* @param {StateType} state The table's state
*/
selectionChange(state: StateType): void;
/**
* Calls the {@link TableProps.onContextMenu} event handler with {@link EventsTypes.ContextMenuArg} as the argument
*
* @param {StateType} state Passed to {@link Selectors.getContextMenuArg}
* @param {boolean} [forceEmpty] Passed to {@link Selectors.getContextMenuArg}
* @param {boolean} [forceSelection] Passed to {@link Selectors.getContextMenuArg}
*/
contextMenu(state: StateType, forceEmpty?: boolean | undefined, forceSelection?: boolean | undefined): void;
/**
* Calls the {@link TableProps.onActionDispatched} event handler
*
* @param {boolean} internal Passed through to the handler as the first argument
*/
actionDispatched(internal?: boolean): void;
[handlersSymbol]: any;
}
export namespace EventsTypes {
export type EventsClass = Events;
/**
* When {@link Options.multiSelect } is true:
* A {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set|Set}
* containing the keys of all selected rows.
*
* When Options.multiSelect is false: The key of the selected row, or null if no row is selected.
*/
export type SelectionArg = (RowKeyType | Set<RowKeyType>) | null;
/**
* The argument of onContextMenu varies a lot based on the modifier keys pressed and the table options,
* but the type is either a {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set|Set}
* of {@link StoreTypes.RowKey } when {@link Options.multiSelect } is true,
* or just {@link StoreTypes.RowKey } when {@link Options.multiSelect } is false.
* You can find details for the value of the argument in the readme.
*/
export type ContextMenuArg = (RowKeyType | Set<RowKeyType>) | null;
type RowKeyType = import('../store/store').StoreTypes.RowKey;
}
export type StateType = import('../store/store').StoreTypes.State;