This commit is contained in:
2026-08-11 13:47:48 +08:00
parent f9ee6d1e04
commit 993909cef7
36 changed files with 1916 additions and 21 deletions
+115
View File
@@ -0,0 +1,115 @@
import * as React from 'react';
import React__default from 'react';
import PropTypes from 'prop-types';
/**
* 渲染一个 iconfont symbol 图标(依赖 Iconfont.init 注入的 SVG symbol 脚本)
* @param {Object} props
* @param {string} [props.className] 额外的 class 名
* @param {string} props.type 图标名,对应 svg symbol 的 id
* @param {Object} [props.style] 行内样式
*/
declare function Iconfont({ className, type, style, ...props }: {
className?: string;
type: string;
style?: any;
}): React__default.JSX.Element;
declare namespace Iconfont {
export namespace propTypes {
let className: PropTypes.Requireable<string>;
let type: PropTypes.Validator<string>;
let style: PropTypes.Requireable<object>;
}
export { createScriptUrlElements as init };
}
/**
* 依次注入 iconfont symbol 的 script 地址(单个 url 只会注入一次);
* 也是 Iconfont.init 挂载的实现,支持传入多个 url 按顺序加载(前一个 load/error 后再加载下一个)
* @param {string[]} [scriptUrls] iconfont symbol 脚本地址列表
* @param {number} [index] 内部递归用的当前下标
*/
declare function createScriptUrlElements(scriptUrls?: string[], index?: number): void;
/**
* 包装一个弹窗内容组件,让它可以通过 $setProps 更新自己的 props(与外部传入的 widgetProps 做浅合并),
* 同时注入 $close 用于关闭弹窗
* @param {Object} props
* @param {import('react').ReactElement|Function} props.widget 要渲染的元素或组件
* @param {Object} [props.widgetProps] 外部传入的初始 props,变化时会合并进内部状态
* @param {(result?: *) => void} props.$close 关闭弹窗的函数,会透传给 widget
* @param {(patch: Object) => void} [props.onSetProps] $setProps 被调用时的回调,用于同步外部状态
*/
declare function SetPropsWrapper({ widget, widgetProps: externalProps, $close, onSetProps }: {
widget: React.ReactElement | Function;
widgetProps?: any;
$close: (result?: any) => void;
onSetProps?: (patch: any) => void;
}): Function | React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>>;
/** 空状态占位组件 */
declare function Empty(): React__default.JSX.Element;
/** 加载中占位组件 */
declare function Loading(): React__default.JSX.Element;
/** 未找到占位组件 */
declare function NotFound(): React__default.JSX.Element;
declare namespace FFPopup {
export { modal };
export { confirm };
export { form };
export { notification };
export { success };
export { error };
}
/**
* 打开一个任意组件的弹窗
* @param {Function} widget 要渲染的组件
* @param {Object} [widgetData] 传给组件的 props
* @param {Object} [widgetContainerProps] 传给弹窗容器(PopupContainer)的 props
* @returns {Promise<*>&{update: Function}} resolve 弹窗关闭时传入的值;promise.update(patch, containerPatch) 可用来更新弹窗内容
*/
declare function modal(widget: Function, widgetData?: any, widgetContainerProps?: any): Promise<any> & {
update: Function;
};
/**
* 弹出一个确认框
* @param {*} content 确认框内容
* @param {Object} [opts] 其余透传给 Confirm 组件的 props
* @returns {Promise<*>} 点击确认时 resolve,点击取消/关闭时按 modal 的语义处理
*/
declare function confirm(content: any, opts?: any): Promise<any>;
/**
* 弹出一个模态表单;取消时 reject(false)
* @param {Array} fields 表单字段配置(传给 FormModal 的 fields)
* @param {Object} [widgetContainerProps] 传给弹窗容器的 props
* @param {Object} [formProps] 传给表单的额外 props
* @returns {Promise<Object>} 提交后的表单数据
*/
declare function form(fields: any[], widgetContainerProps?: any, formProps?: any): Promise<any>;
/**
* 弹出一条消息提示
* @param {*} content 提示内容
* @param {Object} [opts] 其余透传给 Notification 组件的 props,duration/showProgress 会转发到容器 props
* @returns {Promise<*>}
*/
declare function notification(content: any, { showProgress, duration, ...opts }?: any): Promise<any>;
/**
* 成功提示(绿色图标样式的 notification)
* @param {*} content 提示内容
* @param {Object} [opts] 其余透传给 notification 的选项
* @returns {Promise<*>}
*/
declare function success(content: any, opts?: any): Promise<any>;
/**
* 错误提示(红色图标样式的 notification)
* @param {*} content 提示内容
* @param {Object} [opts] 其余透传给 notification 的选项
* @returns {Promise<*>}
*/
declare function error(content: any, opts?: any): Promise<any>;
export { Empty, Iconfont as Icon, Loading, NotFound, FFPopup as Popup, SetPropsWrapper };