Skip to main content
Glama
deleonio
by deleonio
table-callbacks.ts1.8 kB
import type { Callback } from '../enums'; import type { EventValueOrEventCallback } from '../types/callbacks'; import { watchValidator } from '../utils'; import type { Generic } from 'adopted-style-sheets'; import type { KoliBriSortDirection, KoliBriTableDataType, KoliBriTableSelectionKeys } from '../types'; /* types */ export type SortEventPayload = { key: string; currentSortDirection: KoliBriSortDirection; }; export type SelectionChangeEventPayload = KoliBriTableSelectionKeys; export type StatefulSelectionChangeEventPayload = KoliBriTableDataType[] | null; export type TableCallbacksPropType = { [Callback.onSort]?: EventValueOrEventCallback<MouseEvent, SortEventPayload>; [Callback.onSelectionChange]?: EventValueOrEventCallback<Event, SelectionChangeEventPayload>; }; export type TableStatefulCallbacksPropType = { [Callback.onSelectionChange]?: EventValueOrEventCallback<Event, StatefulSelectionChangeEventPayload>; }; /** * Defines the callback functions for table events. */ export type PropTableCallbacks = { on: TableCallbacksPropType; }; export type StatefulPropTableCallbacks = { on: TableStatefulCallbacksPropType; }; /* validator */ export const validateTableCallbacks = (component: Generic.Element.Component, value?: TableCallbacksPropType): void => { watchValidator( component, `_on`, (value) => typeof value === 'object' && value !== null, new Set(['TableCallbacksPropType {Events.onSort, Events.onSelectionChange}']), value, ); }; export const validateTableStatefulCallbacks = (component: Generic.Element.Component, value?: TableStatefulCallbacksPropType): void => { watchValidator( component, `_on`, (value) => typeof value === 'object' && value !== null, new Set(['TableStatefulCallbacksPropType {Events.onSelectionChange}']), value, ); };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/deleonio/public-ui-kolibri'

If you have feedback or need assistance with the MCP directory API, please join our Discord server