import type { RowSelectionState } from '@tanstack/table-core'; import type { Ref, VNode } from 'vue'; import { z } from 'zod'; import type { yocoIconSchema } from '@3yourmind/yoco'; import type { KottiI18n } from '../../kotti-i18n/types'; /** * @see {@link ./hooks.ts paramsSchema} */ export type GetRowBehavior = (params: { row: ROW; rowIndex: number; }) => { actions?: { dataTest?: string; icon: z.input; isDisabled?: boolean; onClick: () => Promise | void; tooltip?: string; }[]; classes?: string[]; click?: { /** * For example for opening drawers. Should not be used for navigation. Also consider using normal link with * a query parameter instead. */ component: null; onClick: () => Promise | void; } | 'expand' | ({ /** * This should be used in most use cases and would usually be a `router-link` */ component: ROW_BEHAVIOR_CLICK_COMPONENT; } & (ROW_BEHAVIOR_CLICK_COMPONENT extends 'a' ? { props: { [k: string]: unknown; href: string; }; } : { props?: Record; })); disable?: { actions: boolean; click: boolean; expand: boolean; select: boolean; }; id: string; isLoading?: boolean; }; export declare namespace KottiTable { type Display = { align: 'center' | 'left' | 'right'; disableCellClick: boolean; isNumeric: boolean; render: (value: DATA_TYPE, context: { i18n: KottiI18n.ContextInternal; }) => VNode | string | null; sortBehavior: 'asc-desc' | 'desc-asc'; }; /** * This is the column passed to `useKottiTable`’s `columns` */ type Column = { display: Display; getData: (row: ROW) => DATA; id: COLUMN_ID; isSortable?: boolean; label: string; maxWidth?: string; minWidth?: string; tooltip?: string; width?: string; }; type Ordering = { id: COLUMN_ID; value: 'ascending' | 'descending'; }; type AnyRow = Record; const propsSchema: z.ZodObject<{ emptyText: z.ZodDefault>; isLoading: z.ZodDefault; isNotScrollable: z.ZodDefault; tableId: z.ZodString; }, "strict", z.ZodTypeAny, { isLoading: boolean; emptyText: string | null; isNotScrollable: boolean; tableId: string; }, { tableId: string; emptyText?: string | null | undefined; isLoading?: boolean | undefined; isNotScrollable?: boolean | undefined; }>; namespace Hook { type Returns = { columnOrder: Ref; expandedRows: Ref>; hiddenColumns: Ref>; ordering: Ref[]>; selectedRows: Ref; }; } type Translations = { no: string; noItems: string; yes: string; }; }