import { ReactElement } from 'react'; import { NestedTableState } from '../../state'; import { ToolbarBaseProps } from '../ToolbarCollection'; import { DragAndDropBulkSubmit, DragAndDropCancel, DragAndDropSubmit } from '../DragAndDrop'; import { NestedTableDragAndDrop } from '../NestedTableDragAndDrop'; export interface NestedTableProps extends ToolbarBaseProps { /** * A state object created with [`useNestedTable`](/pages/cairo/?path=/story/common-hooks--usenestedtable) */ state: NestedTableState; /** * A render function to be rendered when there's an error fetching data from the server.
* The function accepts the following parameters * * `err`: The error thrown by the [fetchData](/pages/cairo/?path=/story/common-hooks--usecollection) function * * `isOnline`: Indicates whether internet connection is available * * `retry`: Retry fetch on failed response */ renderError?: (params: { err: unknown; isOnline: boolean; retry: () => void; }) => ReactElement; /** A render function to be rendered when there's no items to show in the table */ renderEmptyState?: () => ReactElement; horizontalScroll?: boolean; dataHook?: string; rowHeight?: number; estimatedRowHeight?: number; /** * Width for the column that contains the `actionsCell` component */ actionsCellWidth?: string | number; /** * Drag and drop implementation: `import { NestedTableDragAndDrop } from '@wix/cairo';` * > In order to make the drag and drop also re-order the collection after drop, also add [OptimisticActions](/pages/cairo/?path=/story/components-collection-features--optimistic-actions). */ dragAndDrop?: typeof NestedTableDragAndDrop; /** * A function that submits a drop event to the server. The function accepts the following arguments:
* - `from: {item: T; index: number}` - Item that was dragged * - `after: null | {item: T; index: number}` - Item that the dragged item was dropped after. If dropped at the head of the collection, this argument will be `null` * - `filters` - Currently applied filters, for cases your server holds a unique ordering per filtering (see `dragAndDropCategories` prop) * * @returns Promise */ dragAndDropSubmit?: DragAndDropSubmit; /** * A function that submits a drop event to the server. The function accepts the array of following objects:
* - `from: {item: T; index: number}` - Item that was dragged * - `after: null | {item: T; index: number}` - Item that the dragged item was dropped after. If dropped at the head of the collection, this argument will be `null` * - `filters` - Currently applied filters, for cases your server holds a unique ordering per filtering (see `dragAndDropCategories` prop) * * @returns Promise */ dragAndDropBulkSubmit?: DragAndDropBulkSubmit; /** * A function that cancels a drop event. The function accepts the following arguments:
* - `from: {item: T; index: number}` - Item that was dragged * - `after: null | {item: T; index: number}` - Item that the dragged item was dropped after. If dropped at the head of the collection, this argument will be `null` * - `filters` - Currently applied filters, for cases your server holds a unique ordering per filtering (see `dragAndDropCategories` prop) * * If the move should be cancelled, the function should return a toast config object with a message explaining why the move was cancelled. Otherwise, the function should return nullish value. */ dragAndDropCancel?: DragAndDropCancel; /** * List of filter names combinations that your server holds a unique ordering for. If this prop is not passed, drag and drop will be enabled only when no filters are applied.
* If you pass this prop, you should explicitly pass `[]` as one of the combinations in order to enable drag and drop when no filters are applied, for example: `dragAndDropCategories={[[], ['status']]}` */ dragAndDropCategories?: (keyof any)[][] | null; /** * Indicates whether the table should have an internal scroll (instead of the default page scroll) */ internalScroll?: boolean; } declare function _NestedTable(props: NestedTableProps): JSX.Element; export declare const NestedTable: typeof _NestedTable & { displayName: string; }; export {}; //# sourceMappingURL=NestedTable.d.ts.map