import { crudProps, crudEmits } from './props'; import type { ButtonProps } from 'element-plus'; import type { IDefineProps, IDefineEmits, UnknownObject, ExternalParam, FormColumnChildren } from '../types/index'; import type { FormColumn, GroupFormColumn, IFormMenuColumns, IFormExpose, IFormSubmit, InvalidFields } from '../Form/index'; import type { ISearchProps } from '../Search/type'; import type { TableColumn, ITableMenuColumns, ITableExpose } from '../Table/index'; import type { DescriptionsColumn } from '../Descriptions/type'; interface CommonCrudColumn extends Omit, 'children'>, Omit, 'span'> { /** sub-form and multi-level header */ children?: ICrudColumns>; /** whether to display in the add form */ add?: boolean; /** whether to display in the edit form */ edit?: boolean; /** whether to display in the add and edit form */ form?: boolean; /** whether to display in the detail descriptions */ detail?: boolean; /** whether to display in the search form */ search?: boolean; /** rename the descriptions column prop `span` to `detailSpan` */ detailSpan?: DescriptionsColumn['span']; } export type CrudColumn = Omit, 'children'> & CommonCrudColumn; export type CrudGroupFormColumn = Omit, 'children'> & CommonCrudColumn; /** Crud Columns Options */ export type ICrudColumns = Array<(CrudColumn | CrudGroupFormColumn) & UnknownObject>; export interface CrudMenu { /** show add button */ add?: boolean; /** text of add button */ addText?: string; /** props of add button */ addProps?: Partial; /** show edit button */ edit?: boolean | ((row: T) => boolean); /** text of edit button */ editText?: string; /** props of edit button */ editProps?: Partial; /** show detail button */ detail?: boolean | ((row: T) => boolean); /** text of detail button */ detailText?: string; /** props of detail button */ detailProps?: Partial; /** show del button */ del?: boolean | ((row: T) => boolean); /** text of del button */ delText?: string; /** props of del button */ delProps?: Partial; /** show search button */ search?: boolean; /** text of search button */ searchText?: string; /** props of search button */ searchProps?: Partial; /** show search reset button */ searchReset?: boolean; /** text of search reset button */ searchResetText?: string; /** props of search reset button */ searchResetProps?: Partial; /** text of prev button in search form */ searchPrevText?: string; /** props of prev button in search form */ searchPrevProps?: Partial; /** text of next button in search form */ searchNextText?: string; /** props of next button in search form */ searchNextProps?: Partial; } export type ICrudMenuColumns = CrudMenu & ITableMenuColumns & IFormMenuColumns; export type ICrudDialogType = 'add' | 'edit' | 'detail'; export type ICrudBeforeOpen = (done: () => void, type: ICrudDialogType, row?: T) => void; export type ICrudBeforeClose = (done: () => void) => void; export type ICrudSearch = IFormSubmit; export type ICrudSearchProps = Partial>; export type ICrudSubmit = (close: () => void, done: () => void, type: ICrudDialogType, isValid: boolean, invalidFields?: InvalidFields) => void; export type ICrudProps = IDefineProps; export type ICrudEmits = IDefineEmits; export interface ICrudExpose extends IFormExpose, ITableExpose { searchRef: IFormExpose; formRef: IFormExpose; /** open the dialog */ openDialog: (type: ICrudDialogType, row?: UnknownObject) => void; /** close the dialog */ closeDialog: () => void; } /** * Type helper to make it easier to define columns * @param columns the columns of Crud */ export declare function defineCrudColumns(columns: ICrudColumns): ICrudColumns; /** * Type helper to make it easier to define menu columns * @param columns the columns of Menu */ export declare function defineCrudMenuColumns(columns: ICrudMenuColumns): ICrudMenuColumns; /** * Type helper to make it easier to define function (before the dialog is opened) * @param fun function */ export declare function defineCrudBeforeOpen(fun: ICrudBeforeOpen): ICrudBeforeOpen; /** * Type helper to make it easier to define function (before the dialog is closed) * @param fun function */ export declare function defineCrudBeforeClose(fun: ICrudBeforeClose): ICrudBeforeClose; /** * Type helper to make it easier to define search function * @param fun search function */ export declare function defineCrudSearch(fun: ICrudSearch): ICrudSearch; /** * Type helper to make it easier to define submit function * @param fun submit function */ export declare function defineCrudSubmit(fun: ICrudSubmit): ICrudSubmit; export {};