mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 20:09:08 +08:00
优化 picker embed 模式
This commit is contained in:
parent
b75f7b76ab
commit
7de4e9e501
@ -60,11 +60,13 @@ export class Card extends React.Component<CardProps> {
|
||||
handleClick(e: React.MouseEvent<HTMLDivElement>) {
|
||||
const target: HTMLElement = e.target as HTMLElement;
|
||||
const ns = this.props.classPrefix;
|
||||
let formItem;
|
||||
|
||||
if (
|
||||
!e.currentTarget.contains(target) ||
|
||||
~['INPUT', 'TEXTAREA'].indexOf(target.tagName) ||
|
||||
target.closest(`button, a, .${ns}Form-item`)
|
||||
!e.currentTarget.contains(target)
|
||||
|| ~['INPUT', 'TEXTAREA'].indexOf(target.tagName)
|
||||
|| (formItem = target.closest(`button, a, .${ns}Form-item`))
|
||||
&& e.currentTarget.contains(formItem)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
@ -613,11 +613,13 @@ export default class Form extends React.Component<FormProps, object> {
|
||||
|
||||
handleDialogConfirm(values: object[], action:Action, ctx:any, targets:Array<any>) {
|
||||
const {
|
||||
store
|
||||
store,
|
||||
onChange,
|
||||
} = this.props;
|
||||
|
||||
if (action.mergeData && values.length === 1 && values[0] && targets[0].props.type === 'form') {
|
||||
if ((action.mergeData || store.action.mergeData) && values.length === 1 && values[0] && targets[0].props.type === 'form') {
|
||||
store.updateData(values[0]);
|
||||
onChange && onChange(store.data, difference(store.data, store.pristine));
|
||||
}
|
||||
|
||||
store.closeDialog(true);
|
||||
@ -632,11 +634,13 @@ export default class Form extends React.Component<FormProps, object> {
|
||||
|
||||
handleDrawerConfirm(values: object[], action:Action, ctx:any, targets:Array<any>) {
|
||||
const {
|
||||
store
|
||||
store,
|
||||
onChange
|
||||
} = this.props;
|
||||
|
||||
if (action.mergeData && values.length === 1 && values[0] && targets[0].props.type === 'form') {
|
||||
if ((action.mergeData || store.action.mergeData) && values.length === 1 && values[0] && targets[0].props.type === 'form') {
|
||||
store.updateData(values[0]);
|
||||
onChange && onChange(store.data, difference(store.data, store.pristine));
|
||||
}
|
||||
|
||||
store.closeDrawer(true);
|
||||
|
@ -721,11 +721,13 @@ export class ListItem extends React.Component<ListItemProps> {
|
||||
handleClick(e: React.MouseEvent<HTMLDivElement>) {
|
||||
const target: HTMLElement = e.target as HTMLElement;
|
||||
const ns = this.props.classPrefix;
|
||||
let formItem;
|
||||
|
||||
if (
|
||||
!e.currentTarget.contains(target) ||
|
||||
~['INPUT', 'TEXTAREA'].indexOf(target.tagName) ||
|
||||
target.closest(`button, a, .${ns}Form-item`)
|
||||
!e.currentTarget.contains(target)
|
||||
|| ~['INPUT', 'TEXTAREA'].indexOf(target.tagName)
|
||||
|| (formItem = target.closest(`button, a, .${ns}Form-item`))
|
||||
&& e.currentTarget.contains(formItem)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
@ -1455,12 +1455,13 @@ class TableRow extends React.Component<TableRowProps> {
|
||||
handleClick(e: React.MouseEvent<HTMLTableRowElement>) {
|
||||
const target: HTMLElement = e.target as HTMLElement;
|
||||
const ns = this.props.classPrefix;
|
||||
let formItem;
|
||||
|
||||
if (
|
||||
!e.currentTarget.contains(target) ||
|
||||
~['INPUT', 'TEXTAREA'].indexOf(target.tagName) ||
|
||||
// target.closest(`button, a, .${ns}Form-item`)
|
||||
target.closest(`button, a`) // 兼容Picker的embed模式,所以去掉了.${ns}Form-item
|
||||
!e.currentTarget.contains(target)
|
||||
|| ~['INPUT', 'TEXTAREA'].indexOf(target.tagName)
|
||||
|| (formItem = target.closest(`button, a, .${ns}Form-item`))
|
||||
&& e.currentTarget.contains(formItem)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user