snowy-designer
Version:
基于Epic-Designer-Pro版本的设计器,可视化开发页面表单
47 lines (46 loc) • 1.33 kB
TypeScript
/**
* 数据项接口
* 用于表示下拉选择等组件中的选项数据
*/
export interface DataItem {
/** 是否禁用该选项 */
disabled?: boolean;
/** 选项显示文本 */
label: string;
/** 选项对应的值 */
value: number | string;
}
/**
* 请求处理器类型
* 返回数据项数组的异步函数
*/
export type RequestHandler = () => DataItem[] | Promise<DataItem[]>;
/**
* 请求配置接口
* 定义了内置请求的基本配置信息
*/
export interface RequestConfig {
/** 请求描述信息 */
description?: string;
/** 请求处理器函数 */
handler: RequestHandler;
/** 请求显示标签 */
label: string;
/** 请求唯一名称 */
name: string;
}
/**
* 内置请求管理组合式函数
* 提供对内置请求的注册、执行、缓存等管理功能
* @returns 请求注册表实例,包含各种请求管理方法
*/
export declare const useBuiltInRequests: () => {
clear: () => void;
execute: (name: string) => Promise<DataItem[]>;
getConfig: (name: string) => RequestConfig;
getHandler: (name: string) => RequestHandler;
has: (name: string) => boolean;
register: (config: RequestConfig) => void;
registerMultiple: (configs: RequestConfig[]) => void;
requests: Record<string, RequestConfig>;
};