@opencloud-eu/design-system
Version:
OpenCloud Design System is used to design OpenCloud UI components
141 lines (140 loc) • 4.19 kB
TypeScript
import { Item as BaseItem, FieldType, SizeType } from '../../helpers';
type Item = BaseItem & any;
export interface Props {
/**
* @docs The data to be displayed in the table.
*/
data: Item[];
/**
* @docs The fields to be displayed as table headers.
*/
fields: FieldType[];
/**
* @docs The IDs of the rows that should be disabled.
*/
disabled?: Array<string | number>;
/**
* @docs Determines if the table supports dragging and dropping items onto rows.
* @default false
*/
dragDrop?: boolean;
/**
* @docs Determines if the table has a header row.
* @default true
*/
hasHeader?: boolean;
/**
* @docs The position of the sticky header.
* @default 0
*/
headerPosition?: number;
/**
* @docs The IDs of the rows that should be highlighted.
*/
highlighted?: string | string[];
/**
* @docs Determines if the table rows should have a hover effect.
* @default false
*/
hover?: boolean;
/**
* @docs The key to be used as the unique identifier for each row.
* @default 'id'
*/
idKey?: string;
/**
* @docs A function to get the dom selector for each item.
*/
itemDomSelector?: (item: Item) => string;
/**
* @docs Determines if the table should be lazy loaded.
* @default false
*/
lazy?: boolean;
/**
* @docs The horizontal padding size of the table.
* @default small
*/
paddingX?: SizeType | 'remove';
/**
* @docs The default field to sort by.
*/
sortBy?: string;
/**
* @docs The default sort direction.
*/
sortDir?: 'asc' | 'desc';
/**
* @docs Determines if the table header should be sticky. This is helpful when it should still be visible when scrolling.
* @default false
*/
sticky?: boolean;
}
export interface Emits {
/**
* @docs Emitted when an item has been dropped onto a row.
*/
(e: 'itemDropped', selector: string, event: DragEvent): void;
/**
* @docs Emitted when an item has been dragged onto a row.
*/
(e: 'itemDragged', item: Item, event: DragEvent): void;
/**
* @docs Emitted when a table header has been clicked.
*/
(e: 'theadClicked', event: MouseEvent): void;
/**
* @docs Emitted when a table row has been clicked.
*/
(e: 'highlight', args: [Item, MouseEvent]): void;
/**
* @docs Emitted when a table row has been mounted.
*/
(e: 'rowMounted', item: Item, element: HTMLElement): void;
/**
* @docs Emitted when a table row has been right-clicked.
*/
(e: 'contextmenuClicked', element: HTMLElement, event: MouseEvent, item: Item): void;
/**
* @docs Emitted when a column has been sorted.
*/
(e: 'sort', sort: {
sortBy: string;
sortDir: 'asc' | 'desc';
}): void;
/**
* @docs Emitted when an element has entered a drop zone inside the table.
*/
(e: 'dropRowStyling', selector: string, leaving: boolean, event: DragEvent): void;
/**
* @docs Emitted when an item has been scrolled into the view.
*/
(e: 'itemVisible', item: Item): void;
}
export interface Slots {
/**
* @slot The footer of the table.
*/
footer?: () => unknown;
}
declare function __VLS_template(): {
attrs: Partial<{}>;
slots: Readonly<Slots> & Slots;
refs: {};
rootEl: HTMLTableElement;
};
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
[x: string]: any;
} & {
[x: string]: any;
}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
[x: `on${Capitalize<any>}`]: (...args: any) => any;
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLTableElement>;
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
export default _default;
type __VLS_WithTemplateSlots<T, S> = T & {
new (): {
$slots: S;
};
};