v0.7.10
This commit is contained in:
Vendored
+37
-1
@@ -47,6 +47,42 @@ declare function SetPropsWrapper({ widget, widgetProps: externalProps, $close, o
|
||||
onSetProps?: (patch: any) => void;
|
||||
}): Function | React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>>;
|
||||
|
||||
/**
|
||||
* 通用错误边界组件
|
||||
* @param {Object} props
|
||||
* @param {*} props.children
|
||||
* @param {ReactNode|((error: Error, reset: () => void) => ReactNode)} [props.fallback]
|
||||
* 错误时的 UI。函数形式可接收 error 和 reset,不传则显示错误字符串。
|
||||
* @param {Function} [props.onError] 错误回调 (error, info) => void
|
||||
* @param {Function} [props.onReset] 重置回调 () => void
|
||||
* @param {any[]} [props.resetKeys] 任一值变化时自动重置(类似 react-error-boundary)
|
||||
*/
|
||||
declare class ErrorBoundary extends React__default.Component<any, any, any> {
|
||||
static getDerivedStateFromError(error: any): {
|
||||
error: any;
|
||||
};
|
||||
constructor(props: any);
|
||||
constructor(props: any, context: any);
|
||||
state: {
|
||||
error: any;
|
||||
};
|
||||
componentDidCatch(error: any, info: any): void;
|
||||
componentDidUpdate(prevProps: any): void;
|
||||
reset: () => void;
|
||||
render(): any;
|
||||
}
|
||||
|
||||
/**
|
||||
* 按组件名动态加载并渲染组件
|
||||
* @param {string} [props.widget] 组件名(@pkg/xxx 格式)
|
||||
* @param {Object} [props.widgetSetting] 传给目标组件的 $setting
|
||||
* @param {Object} [props.widgetProps] props 来源配置(经 useWidgetProps 解析)
|
||||
* @param {*} [props.fallback] Suspense fallback,不传则为 null
|
||||
* @param {ReactNode|((error, reset) => ReactNode)} [props.fallbackOnError] ErrorBoundary 错误时的 UI
|
||||
* @param {Function} [props.onError] 错误回调 (error, info) => void
|
||||
*/
|
||||
declare function ImportWidgetComponent({ widget, widgetSetting, widgetProps, fallback, fallbackOnError, onError }?: string): React__default.JSX.Element;
|
||||
|
||||
/** 空状态占位组件 */
|
||||
declare function Empty(): React__default.JSX.Element;
|
||||
|
||||
@@ -112,4 +148,4 @@ declare function success(content: any, opts?: any): Promise<any>;
|
||||
*/
|
||||
declare function error(content: any, opts?: any): Promise<any>;
|
||||
|
||||
export { Empty, Iconfont as Icon, Loading, NotFound, FFPopup as Popup, SetPropsWrapper };
|
||||
export { Empty, ErrorBoundary, Iconfont as Icon, ImportWidgetComponent, Loading, NotFound, FFPopup as Popup, SetPropsWrapper };
|
||||
|
||||
Reference in New Issue
Block a user