v0.7.3
This commit is contained in:
Vendored
+152
@@ -0,0 +1,152 @@
|
||||
import * as React from 'react';
|
||||
import React__default from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
/** 空状态占位组件 */
|
||||
declare function Empty(): React__default.JSX.Element;
|
||||
|
||||
/** 加载中占位组件 */
|
||||
declare function Loading(): React__default.JSX.Element;
|
||||
|
||||
/** 未找到占位组件 */
|
||||
declare function NotFound(): React__default.JSX.Element;
|
||||
|
||||
/**
|
||||
* 为页面级布局提供 SlotContext,把子元素(通常是 FFContainer)挂载的
|
||||
* title/subTitle/actions/extras 等插槽内容收集起来,再作为 props 传回给这个子元素
|
||||
* @param {Object} props
|
||||
* @param {import('react').ReactElement} props.children 单个子元素(字符串类型的元素会跳过插槽逻辑,原样返回)
|
||||
*/
|
||||
declare function FFPageRender({ children }: {
|
||||
children: React.ReactElement;
|
||||
}): React__default.JSX.Element;
|
||||
declare namespace FFPageRender {
|
||||
namespace propTypes {
|
||||
let children: PropTypes.Validator<PropTypes.ReactElementLike>;
|
||||
}
|
||||
}
|
||||
|
||||
/** FFContainer 内部用来把 title/subTitle/actions/extras 等具名插槽挂载到外层布局的 context */
|
||||
declare const SlotContext: React__default.Context<{
|
||||
ele: {};
|
||||
mount: () => void;
|
||||
unmount: () => void;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* 页面级容器,通过 SlotContext 把 title/subTitle/actions/extras 挂载到外层布局的对应插槽位置
|
||||
* @param {Object} props
|
||||
* @param {string} [props.rootClassName] 挂载到外层布局根节点的 className
|
||||
* @param {string} [props.className] 容器自身的 className
|
||||
* @param {*} [props.children] 容器内容
|
||||
* @param {*} [props.actions] 挂载到 actions 插槽的内容
|
||||
* @param {*} [props.title] 挂载到 title 插槽的内容
|
||||
* @param {*} [props.subTitle] 挂载到 sub-title 插槽的内容
|
||||
* @param {*} [props.extras] 挂载到 extras 插槽的内容
|
||||
* @param {Object} [props.style] 容器行内样式
|
||||
*/
|
||||
declare function FFContainer({ rootClassName, className, children, actions, title, subTitle, extras, style }: {
|
||||
rootClassName?: string;
|
||||
className?: string;
|
||||
children?: any;
|
||||
actions?: any;
|
||||
title?: any;
|
||||
subTitle?: any;
|
||||
extras?: any;
|
||||
style?: any;
|
||||
}): React__default.JSX.Element;
|
||||
declare namespace FFContainer {
|
||||
function Action({ children, className }: {
|
||||
children: any;
|
||||
className: any;
|
||||
}): any;
|
||||
function Title({ children, className }: {
|
||||
children: any;
|
||||
className: any;
|
||||
}): any;
|
||||
function SubTitle({ children, className }: {
|
||||
children: any;
|
||||
className: any;
|
||||
}): any;
|
||||
function Extra({ children, className }: {
|
||||
children: any;
|
||||
className: any;
|
||||
}): any;
|
||||
namespace propTypes {
|
||||
let className: PropTypes.Requireable<string>;
|
||||
let style: PropTypes.Requireable<object>;
|
||||
let title: PropTypes.Requireable<any>;
|
||||
let subTitle: PropTypes.Requireable<any>;
|
||||
let actions: PropTypes.Requireable<any>;
|
||||
let extras: PropTypes.Requireable<any>;
|
||||
}
|
||||
}
|
||||
|
||||
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>;
|
||||
/**
|
||||
* 弹层渲染出口(通常挂载一份到页面根部);负责渲染 FFPopup 触发的所有弹窗/模态框和 notification。
|
||||
* 在挂载前调用 FFPopup 的方法会被排队,挂载后统一渲染出来
|
||||
*/
|
||||
declare function FFPopupRender(): React__default.JSX.Element;
|
||||
declare namespace FFPopupRender {
|
||||
let $popups: Map<any, any>;
|
||||
let $index: number;
|
||||
let $queue: any[];
|
||||
function $onClick(...args: any[]): Promise<any>;
|
||||
}
|
||||
|
||||
export { SlotContext as Context, Empty, Loading, NotFound, FFPageRender as PageRender, FFPopup as Popup, FFPopupRender as PopupRender, FFContainer as default };
|
||||
Reference in New Issue
Block a user