Skip to content

Commit

Permalink
<DataTable />チェックまわりのバグ改修 (#401)
Browse files Browse the repository at this point in the history
* tweak

* tweak
  • Loading branch information
Yutaro Hayashi authored Jun 29, 2021
1 parent 1056a9f commit 57bfe13
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/components/DataTable/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,9 @@ const DataTable = <T extends DataTableBaseData>({
<CellCheckbox
selected={selectedRows.includes(item.id)}
rowSpan={calculateRowSpan(displayData, index)}
{...(disableCheckWhenClickRow && {
onClick: handleSelectCheckbox(item.id),
})}
/>
)}
{columns.map((column) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export const CellCheckbox: React.FunctionComponent<Props> = ({
...rest
}) => {
const handleClick = (event: React.MouseEvent<HTMLInputElement>) => {
if (onClick) return onClick(event);
return event.stopPropagation();
event.stopPropagation();
if (onClick) onClick(event);
};
const Component = header ? Styled.HeaderCell : Styled.StandardCell;
return (
Expand Down
6 changes: 5 additions & 1 deletion src/components/DataTable/internal/CellRadio/CellRadio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ export const CellRadio: React.FunctionComponent<Props> = ({
onClick,
...rest
}) => {
const handleClick = (event: React.MouseEvent<HTMLInputElement>) => {
event.stopPropagation();
if (onClick) onClick(event);
};
const Component = header ? Styled.HeaderCell : Styled.StandardCell;
return (
<Component {...rest}>
{!header && <RadioButton checked={selected} onClick={onClick} />}
{!header && <RadioButton checked={selected} onClick={handleClick} />}
</Component>
);
};

0 comments on commit 57bfe13

Please sign in to comment.