Prompt 的 form 主题保持一致
This commit is contained in:
parent
b4819a7a5a
commit
9744ff5ba6
|
@ -201,7 +201,8 @@ export class Alert extends React.Component<AlertProps, AlertState> {
|
||||||
title,
|
title,
|
||||||
confirmBtnLevel,
|
confirmBtnLevel,
|
||||||
alertBtnLevel,
|
alertBtnLevel,
|
||||||
classnames: cx
|
classnames: cx,
|
||||||
|
theme
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const __ = this.props.translate;
|
const __ = this.props.translate;
|
||||||
const finalTitle = __(this.state.title ?? title);
|
const finalTitle = __(this.state.title ?? title);
|
||||||
|
@ -226,7 +227,8 @@ export class Alert extends React.Component<AlertProps, AlertState> {
|
||||||
this.state.controls,
|
this.state.controls,
|
||||||
this.state.value,
|
this.state.value,
|
||||||
this.handleFormSubmit,
|
this.handleFormSubmit,
|
||||||
this.scopeRef
|
this.scopeRef,
|
||||||
|
theme
|
||||||
)
|
)
|
||||||
) : (
|
) : (
|
||||||
<Html html={this.state.content} />
|
<Html html={this.state.content} />
|
||||||
|
@ -258,7 +260,8 @@ function renderForm(
|
||||||
controls: Array<any>,
|
controls: Array<any>,
|
||||||
value: PlainObject = {},
|
value: PlainObject = {},
|
||||||
callback?: (values: PlainObject) => void,
|
callback?: (values: PlainObject) => void,
|
||||||
scopeRef?: (value: any) => void
|
scopeRef?: (value: any) => void,
|
||||||
|
theme?: string
|
||||||
) {
|
) {
|
||||||
return renderSchema(
|
return renderSchema(
|
||||||
{
|
{
|
||||||
|
@ -271,7 +274,8 @@ function renderForm(
|
||||||
{
|
{
|
||||||
data: value,
|
data: value,
|
||||||
onFinished: callback,
|
onFinished: callback,
|
||||||
scopeRef
|
scopeRef,
|
||||||
|
theme
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
session: 'prompt'
|
session: 'prompt'
|
||||||
|
|
|
@ -120,10 +120,11 @@ export interface ThemeProps {
|
||||||
className?: string;
|
className?: string;
|
||||||
classPrefix: string;
|
classPrefix: string;
|
||||||
classnames: ClassNamesFn;
|
classnames: ClassNamesFn;
|
||||||
|
theme?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ThemeContext = React.createContext('theme');
|
|
||||||
export let defaultTheme: string = 'default';
|
export let defaultTheme: string = 'default';
|
||||||
|
export const ThemeContext = React.createContext(undefined);
|
||||||
|
|
||||||
export function themeable<
|
export function themeable<
|
||||||
T extends React.ComponentType<React.ComponentProps<T> & ThemeProps> & {
|
T extends React.ComponentType<React.ComponentProps<T> & ThemeProps> & {
|
||||||
|
@ -156,9 +157,11 @@ export function themeable<
|
||||||
const injectedProps: {
|
const injectedProps: {
|
||||||
classPrefix: string;
|
classPrefix: string;
|
||||||
classnames: ClassNamesFn;
|
classnames: ClassNamesFn;
|
||||||
|
theme: string;
|
||||||
} = {
|
} = {
|
||||||
classPrefix: config.classPrefix as string,
|
classPrefix: config.classPrefix as string,
|
||||||
classnames: config.classnames
|
classnames: config.classnames,
|
||||||
|
theme
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in New Issue