import { RenderFunction, SetupContext, Ref, ComputedRef } from 'vue' import { DefineVxeComponentApp, DefineVxeComponentOptions, DefineVxeComponentInstance, VxeComponentBaseOptions, VxeComponentEventParams, ValueOf, VxeComponentSizeType } from '@vxe-ui/core' import { VxeListDesignDefines } from './list-design' import { VxeGridInstance, VxeGridPropTypes, VxeGridProps, VxeGridListeners } from './grid' import { VxeTablePropTypes } from './table' import { VxeColumnSlotTypes } from './column' import { VxeButtonProps } from './button' /* eslint-disable no-use-before-define,@typescript-eslint/ban-types */ export declare const VxeListView: DefineVxeComponentApp export type VxeListViewComponent = DefineVxeComponentOptions export type VxeListViewInstance = DefineVxeComponentInstance export interface VxeListViewConstructor extends VxeComponentBaseOptions, VxeListViewMethods { props: VxeListViewProps context: SetupContext reactData: ListViewReactData getRefMaps(): ListViewPrivateRef getComputeMaps(): ListViewPrivateComputed renderVN: RenderFunction } export interface ListViewPrivateRef { refElem: Ref refGrid: Ref | undefined> } export interface VxeListViewPrivateRef extends ListViewPrivateRef {} export namespace VxeListViewPropTypes { export type Config = null | VxeListDesignDefines.ListDesignConfig export type Size = VxeComponentSizeType export type Loading = boolean export type Height = string | number export type FormData = Record export type ActionButtons = VxeListDesignDefines.DefaultSettingFormActionButton[] export type GridOptions = Omit, 'columns'> export type GridEvents = VxeGridListeners export type ViewRender = { name?: string } } export interface VxeListViewProps { config?: VxeListViewPropTypes.Config size?: VxeListViewPropTypes.Size loading?: VxeListViewPropTypes.Loading height?: VxeListViewPropTypes.Height formData?: VxeListViewPropTypes.FormData gridOptions?: VxeListViewPropTypes.GridOptions gridEvents?: VxeListViewPropTypes.GridEvents viewRender?: VxeListViewPropTypes.ViewRender } export interface ListViewPrivateComputed { computeSize: ComputedRef } export interface VxeListViewPrivateComputed extends ListViewPrivateComputed {} export interface ListViewReactData { formConfig: D searchFormData: any searchFormItems: VxeListDesignDefines.SearchItemObjItem[] listTableColumns: VxeListDesignDefines.ListColumnObjItem[] tableColumns: VxeGridPropTypes.Columns footerData: VxeTablePropTypes.FooterData } export interface ListViewMethods { dispatchEvent(type: ValueOf, params: Record, evnt: Event | null): void /** * 清除所有配置 */ clearConfig(): Promise /** * 加载配置 */ loadConfig(config: VxeListDesignDefines.ListDesignConfig): Promise /** * 解析配置 */ parseConfig(config: VxeListDesignDefines.ListDesignConfig): { formData: Record formItems: VxeListDesignDefines.SearchItemObjItem[] tableColumns: VxeGridPropTypes.Columns tableRecord: Record actionButtons: VxeListViewPropTypes.ActionButtons } /** * 获取表格行记录对象 * 根据 config 配置获取行记录对象 * 根据 listColumns 配置获取行记录对象 */ getTableRecord(configOrListColumns: Partial | VxeListDesignDefines.ListColumnObjItem[] | null | undefined): Record /** * 获取表单查询条件 */ getQueryFilter(): VxeListViewDefines.QueryFilterResult /** * 给 Grid 数据代理提交指令 * @param code 指令编码 */ commitProxy(code: string, ...args: any[]): Promise } export interface VxeListViewMethods extends ListViewMethods {} export interface ListViewPrivateMethods {} export interface VxeListViewPrivateMethods extends ListViewPrivateMethods {} export type VxeListViewEmits = ['cell-action', 'update:formData', 'update:actionButtons'] export namespace VxeListViewDefines { export interface ListViewEventParams extends VxeComponentEventParams { $listView: VxeListViewConstructor } export interface CellActionEventParams extends VxeColumnSlotTypes.DefaultSlotParams, ListViewEventParams { button: VxeButtonProps } export interface QueryFilterCondition { /** * 字段名 */ field: string /** * 值 */ value: any /** * 匹配方式 */ match: '' | 'fuzzy' | 'exact' /** * 值类型 */ type: 'array' | '' } export interface QueryFilterItem { /** * 字段多个查询条件 */ condition: QueryFilterCondition[] /** * 查询类型 */ type: 'and' | 'or' | '' } export interface QueryFilterResult { /** * 筛选字段列表 */ items: QueryFilterItem[] /** * 查询类型 */ type: 'and' | 'or' | '' } } export interface VxeListViewEventProps { onCellAction?: VxeListViewEvents.CellAction } export interface VxeListViewListeners { cellAction?: VxeListViewEvents.CellAction } export namespace VxeListViewEvents { export type CellAction = (params: VxeListViewDefines.CellActionEventParams) => void } export namespace VxeListViewSlotTypes { export interface DefaultSlotParams {} export interface GridSlotParams {} export interface CellActionSlotParams { // buttons: VxeButtonProps[] } } export interface VxeListViewSlots { [key: string]: ((params: { [key: string]: any }) => any) | undefined default?: (params: VxeListViewSlotTypes.DefaultSlotParams) => any grid?: (params: VxeListViewSlotTypes.GridSlotParams) => any cellAction?: (params: VxeListViewSlotTypes.CellActionSlotParams) => any } export const ListView: typeof VxeListView export default VxeListView