Skip to content

Commit

Permalink
fix:crud2中行记录内switch无法change问题 (baidu#9441)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsm-lv committed Jan 17, 2024
1 parent fcf6300 commit 04dfa35
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/amis-core/src/utils/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1901,7 +1901,7 @@ export function isClickOnInput(e: React.MouseEvent<HTMLElement>) {
!e.currentTarget.contains(target) ||
~['INPUT', 'TEXTAREA'].indexOf(target.tagName) ||
((formItem = target.closest(
`button, a, [data-role="form-item"], label[data-role="checkbox"]`
`button, a, [data-role="form-item"], label[data-role="checkbox"], label[data-role="switch"]`
)) &&
e.currentTarget.contains(formItem))
);
Expand Down
1 change: 1 addition & 0 deletions packages/amis-ui/src/components/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export class Switch extends React.PureComponent<SwitchProps, any> {
'is-checked': isChecked,
'is-disabled': isDisabled
})}
data-role="switch"
>
<input
type="checkbox"
Expand Down
3 changes: 0 additions & 3 deletions packages/amis-ui/src/components/table/Row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ class BodyRow extends React.PureComponent<Props> {
return;
}

e.preventDefault();
e.stopPropagation();

const {onClick} = this.props;
onClick && onClick(e, record, rowIndex);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ exports[`Renderer:Switch Switch basic props 1`] = `
>
<label
class="cxd-Switch is-checked"
data-role="switch"
>
<input
checked=""
Expand Down Expand Up @@ -134,6 +135,7 @@ exports[`Renderer:Switch Switch size 1`] = `
>
<label
class="cxd-Switch cxd-Switch--sm"
data-role="switch"
>
<input
theme="cxd"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ exports[`Renderer:inputDate 1`] = `
>
<label
class="cxd-Switch"
data-role="switch"
>
<input
checked=""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7171,6 +7171,7 @@ exports[`Renderer:table list 1`] = `
>
<label
class="cxd-Switch is-checked"
data-role="switch"
>
<input
checked=""
Expand Down Expand Up @@ -7413,6 +7414,7 @@ exports[`Renderer:table list 1`] = `
>
<label
class="cxd-Switch is-checked"
data-role="switch"
>
<input
checked=""
Expand Down Expand Up @@ -7775,6 +7777,7 @@ exports[`Renderer:table list 1`] = `
>
<label
class="cxd-Switch"
data-role="switch"
>
<input
theme="cxd"
Expand Down

0 comments on commit 04dfa35

Please sign in to comment.