UNPKG

@nodeject/ui-components

Version:

UI library for non-trivial components

118 lines (117 loc) 3.1 kB
/// <reference types="react" /> export interface ListBasicType { id: string; isDragDisabled?: boolean; itemIds: string[]; } export interface ListType extends ListBasicType { footer?: React.ReactNode; header?: React.ReactNode; title?: string; } export interface ItemType { id: string; [key: string]: any; } export interface ItemProps extends ItemType { classNameItem?: string; events?: { onItemClick?: (id: string) => void; onItemDelete?: (id: string) => void; }; Item?: React.ElementType<ItemProps>; newCardIsVisible: boolean; isVisible: boolean; isVisiblePerformance?: boolean; } export interface OnNewItemClickedArgs { listId: string; data: any; index: number; } export declare type OnItemDeleteArgs = { id: string; listId: string; }; export interface State extends DragDropData { itemsBasicProps: ItemListBasicType; } export declare type ItemListType = { [key: string]: ItemType; }; export declare type ItemListBasicType = { [key: string]: { id: string; }; }; export interface DragDropData { listOrder: string[]; lists: { [key: string]: ListType; }; items: ItemListType; filter: { isFiltered: boolean; visibleItems?: string[]; }; } export interface StateBeforeEvent { listOrder: string[]; lists: { [key: string]: ListBasicType; }; items: ItemListBasicType; } export declare enum ServerEventStatus { Error = "error", Loading = "loading", Success = "success" } export interface OptimisticLocalState { event: { itemId: ItemId; type: BoardEvent; stateBeforeEvent: StateBeforeEvent; serverEventStatus: ServerEventStatus; }[]; } declare type ItemId = string; export declare enum BoardEvent { create = "create", delete = "delete", move = "move" } export interface NewItemArgs { id: string; listId: string; [key: string]: any; position: number | ('start' | 'end'); } export declare type OnSaveNewItemFunction = (args: OnNewItemClickedArgs) => NewItemArgs; export interface DragDropListsEvents { onItemClick?: (id: string) => void; onItemDelete?: (args: OnItemDeleteArgs) => Promise<any>; onItemMove?: (args: OnItemMoveArgs) => Promise<any>; onDataChanged?: (data: DragDropData) => void; onNewItemAdd?: (args: NewItemArgs) => Promise<any>; } export declare type Position = 'start' | 'end' | 'none'; export interface NewItemButtonProps { className?: string; isDisabled?: boolean; onNewItemClicked?: (position: Position) => void; position: Position; title?: string; } export declare type OnItemMoveArgs = { id?: string; targetNodeId: string; targetId?: string; targetIndex: number; sourceId?: string; sourceIndex: number; type?: string; }; export declare const DroppableListType = "list"; export declare const DroppableItemType = "item"; export {};