Skip to content

Commit

Permalink
fix: 修复弹窗中表单内再弹窗新弹窗按钮不可点问题 (baidu#10481)
Browse files Browse the repository at this point in the history
  • Loading branch information
2betop authored Jun 19, 2024
1 parent 46aef7e commit 4941ca0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 7 additions & 3 deletions packages/amis/src/renderers/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ export default class Dialog extends React.Component<DialogProps> {
onInit: this.handleFormInit,
onSaved: this.handleFormSaved,
onActionSensor: this.handleActionSensor,
btnDisabled: store.loading,
syncLocation: false // 弹框中的 crud 一般不需要同步地址栏
};

Expand Down Expand Up @@ -559,6 +560,7 @@ export default class Dialog extends React.Component<DialogProps> {
// 弹窗观察内部的动作执行,不需要观察到子弹窗里面去
// 所以这里传递了 undefined
onActionSensor: undefined,
btnDisabled: store.loading,
key,
disabled: action.disabled || store.loading || !show
})
Expand Down Expand Up @@ -720,7 +722,8 @@ export default class Dialog extends React.Component<DialogProps> {
{render('title', title, {
data: store.formData,
onAction: this.handleAction,
onActionSensor: undefined
onActionSensor: undefined,
btnDisabled: store.loading
})}
</div>
) : showCloseButton !== false && !store.loading ? (
Expand All @@ -737,7 +740,8 @@ export default class Dialog extends React.Component<DialogProps> {
? render('header', header, {
data: store.formData,
onAction: this.handleAction,
onActionSensor: undefined
onActionSensor: undefined,
btnDisabled: store.loading
})
: null}

Expand Down Expand Up @@ -804,7 +808,7 @@ export default class Dialog extends React.Component<DialogProps> {
</div>
) : null}

{this.renderFooter()}
{body ? this.renderFooter() : null}

{body
? render(
Expand Down
8 changes: 6 additions & 2 deletions packages/amis/src/renderers/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ export default class Drawer extends React.Component<DrawerProps> {
onInit: this.handleFormInit,
onSaved: this.handleFormSaved,
onActionSensor: this.handleActionSensor,
btnDisabled: store.loading,
syncLocation: false
};

Expand Down Expand Up @@ -551,6 +552,7 @@ export default class Drawer extends React.Component<DrawerProps> {
render(`action/${key}`, action, {
onAction: this.handleAction,
onActionSensor: undefined,
btnDisabled: store.loading,
data: store.formData,
key,
disabled: action.disabled || store.loading
Expand Down Expand Up @@ -686,7 +688,8 @@ export default class Drawer extends React.Component<DrawerProps> {
onConfirm: this.handleDrawerConfirm,
onClose: this.handleDrawerClose,
onAction: this.handleAction,
onActionSensor: undefined
onActionSensor: undefined,
btnDisabled: store.loading
})}
</div>
) : null}
Expand All @@ -696,7 +699,8 @@ export default class Drawer extends React.Component<DrawerProps> {
onConfirm: this.handleDrawerConfirm,
onClose: this.handleDrawerClose,
onAction: this.handleAction,
onActionSensor: undefined
onActionSensor: undefined,
btnDisabled: store.loading
})
: null}
</div>
Expand Down

0 comments on commit 4941ca0

Please sign in to comment.