jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
63 lines (62 loc) • 2.29 kB
TypeScript
/**
* @file Alert
* @author fex
*/
import React from 'react';
import type { LocaleProps, PlainObject, ThemeProps } from 'jamis-core';
import type { ButtonLevel } from '../types';
export interface AlertProps extends ThemeProps, LocaleProps {
container?: any;
confirmText?: string;
cancelText?: string;
title?: string;
confirmBtnLevel?: ButtonLevel;
alertBtnLevel?: ButtonLevel;
}
export interface AlertState {
show: boolean;
title?: string;
content: string;
confirm: boolean;
prompt?: boolean;
controls?: any;
value?: any;
confirmText?: string;
}
declare class Alert extends React.Component<AlertProps, AlertState> {
static instance: any;
static getInstance(): any;
_resolve: (value: any) => void;
_modal: any;
_body: any;
state: AlertState;
constructor(props: AlertProps);
static defaultProps: {
confirmText: string;
cancelText: string;
title: string;
alertBtnLevel: "primary";
confirmBtnLevel: "danger";
};
componentDidMount(): void;
componentDidUpdate(prevProps: AlertProps, prevState: AlertState): void;
componentWillUnmount(): void;
schemaSope: any;
scopeRef(schemaSope: any): void;
handleConfirm(): void;
handleCancel(): void;
close(confirmed: boolean): void;
alert(content: string, title?: string): void;
confirm(content: string, title?: string, confirmText?: string): Promise<unknown>;
prompt(controls: any, defaultValue?: any, title?: string, confirmText?: string): Promise<unknown>;
modalRef(ref: any): void;
handleFormSubmit(values: any): void;
render(): JSX.Element;
}
export type renderSchemaFn = (controls: Array<any>, value: PlainObject, callback?: (values: PlainObject) => void, scopeRef?: (value: any) => void, theme?: string) => JSX.Element;
export declare function setRenderSchemaFn(fn: renderSchemaFn): void;
export declare const alert: (content: string, title?: string) => void;
export declare const confirm: (content: string, title?: string, confirmText?: string) => Promise<any>;
export declare const prompt: (controls: any, defaultvalue?: any, title?: string, confirmText?: string) => Promise<any>;
export declare const FinnalAlert: typeof Alert;
export default FinnalAlert;