import type { IObject } from '@newgrand/udp-core'; import { CSSProperties, ReactNode, RefObject } from 'react'; import { IPanel } from '../../functionalComponent'; import { FormInstance } from 'antd/es/form'; interface ItemProps { name?: string; clientSqlFilter?: string | IObject | Function; helpId?: string; valueField?: string; displayField?: string; } export interface IQueryPanelProps { /** * @description 获取内嵌查询元数据接口的重要参数 */ pageId?: string; /** * @description 重写内嵌查询的fields信息,用于注入额外的内嵌查询字段 */ transferFields?: (fields: IObject[]) => IObject[]; /** * @description 配置固定的的内嵌查询信息,优先级高于pageId */ items?: Array<{ xtype?: string | ((props: any) => ReactNode); label?: string; name: string; helpId?: string; colSpan?: number; itemId?: string; [key: string]: any; }>; id?: string; /** * @description 重写对应name的item属性 */ fieldProps?: { [key: string]: ItemProps | ((item: ItemProps) => ItemProps); }; /** * @description 按钮的样式属性 */ buttonProps?: any; /** * @description 查询组件外部样式 */ style?: CSSProperties; /** * @description 关联的列表组件实例或者id */ gridRef?: string | RefObject; /** * @description 查询字段的size属性 * @default default */ size?: 'small' | 'default'; /** * @description 点击查询事件 */ onSearch?: (...args: any[]) => void; /** * @description 点击重置事件 */ onReset?: (...args: any[]) => void; /** * @description 组件元数据加载完成后的事件 */ onLoad?: (...args: any[]) => void | Promise; /** * @description 设置字段的只读id集合 */ readonlyItems?: Array; /** * @description 重写字段组件 */ fieldInput?: (field: any, disabled: boolean, placeholder: string) => React.ReactNode; /** * @description 设置一行显示列数 * @default 4 */ columns?: 1 | 2 | 3 | 4 | 6; /** * @description 是否显示所有字段,设置true不显示收起展开按钮 * @default false */ showAll?: boolean; /** * @description 是否默认展开所有 * @default false */ defaultExpand?: boolean; /** * @description 是否显示记忆搜索选项框 * @default true */ needRemember?: boolean; /** * @description 是否显示设置按钮 * @default true */ needSetting?: Boolean; /** * @description 是否隐藏设置界面的表名和字段 * @default true */ hiddenTableField?: boolean; /** * @description 字段值改变后执行事件 */ onValuesChange?: (...args: any[]) => any; /** * @description 记忆搜索回填事件 */ onGetRememberData?: (rememberData: IObject) => any; /** * @description 自定义多语言配置 */ locale?: { [key in LocaleKeys]?: string; }; /** * @description 是否显示label文案 * @default true */ showLabel?: boolean; /** * @description 查询表单控件的外部受控values,优先级大于记忆值 */ values?: IObject; /** * @description 查询方案所在容器id */ querySchemeContainer?: string; /** * @description 查询容器的属性 */ panelProps?: IPanel; /** * @description label文案的位置 * @default left */ labelPosition?: 'top' | 'left'; } export interface IQueryInfo { fields: Array; values: any; langInfo: IObject; isChecked: boolean; } export interface IQueryInstance extends FormInstance { getSearchValues: () => any; getItem: (name: string) => any; setFieldValue: (name: any, value: any) => void; query: () => void; getQueryInfo: () => void; } export {};