mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 20:09:08 +08:00
form 也支持 feedback
This commit is contained in:
parent
20c56d654e
commit
e8c13f94aa
@ -49,6 +49,7 @@ import {
|
||||
} from '../../Schema';
|
||||
import {ActionSchema} from '../Action';
|
||||
import {ButtonGroupControlSchema} from './ButtonGroup';
|
||||
import {DialogSchemaBase} from '../Dialog';
|
||||
|
||||
export interface FormSchemaHorizontal {
|
||||
left?: number;
|
||||
@ -161,6 +162,11 @@ export interface FormSchema extends BaseSchema {
|
||||
*/
|
||||
api?: SchemaApi;
|
||||
|
||||
/**
|
||||
* Form 也可以配置 feedback。
|
||||
*/
|
||||
feedback?: DialogSchemaBase;
|
||||
|
||||
/**
|
||||
* 设置此属性后,表单提交发送保存接口后,还会继续轮询请求该接口,直到返回 finished 属性为 true 才 结束。
|
||||
*/
|
||||
@ -889,16 +895,14 @@ export default class Form extends React.Component<FormProps, object> {
|
||||
})
|
||||
.then(async response => {
|
||||
onSaved && onSaved(values, response);
|
||||
const feedback = action.feedback || this.props.feedback;
|
||||
|
||||
// submit 也支持 feedback
|
||||
if (action.feedback && isVisible(action.feedback, store.data)) {
|
||||
const confirmed = await this.openFeedback(
|
||||
action.feedback,
|
||||
store.data
|
||||
);
|
||||
if (feedback && isVisible(feedback, store.data)) {
|
||||
const confirmed = await this.openFeedback(feedback, store.data);
|
||||
|
||||
// 如果 feedback 配置了,取消就跳过原有逻辑。
|
||||
if (action.feedback.skipRestOnCancel && !confirmed) {
|
||||
if (feedback.skipRestOnCancel && !confirmed) {
|
||||
throw new SkipOperation();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user