Skip to content

Commit fe53339

Browse files
committed
fix(disabled): on Row should disable select/tree click
1 parent 4f3a0c1 commit fe53339

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/common/components/Row.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import { Nullish } from '@table-library/react-table-library/types/common';
1010
const getBaseStyle = () => `
1111
display: contents;
1212
13+
&.disabled td {
14+
cursor: auto;
15+
}
16+
1317
${() => {
1418
/* #1 */
1519
// otherwise tree + resize would have overflow icons */

src/table/Row/Row.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,17 @@ export const Row = <T extends TableNode>(props: RowProps<T>) => {
9898

9999
useDoubleClick<T>(ref, onClickByFeature, onDoubleClick, item);
100100

101+
const handleClick = disabled
102+
? () => {}
103+
: onDoubleClick
104+
? () => {}
105+
: (event: Event) => onClickByFeature(item, event);
106+
101107
return (
102108
<RowContainer
103109
role="row"
104110
data-table-library_tr-body=""
105-
onClick={onDoubleClick ? () => {} : (event: Event) => onClickByFeature(item, event)}
111+
onClick={handleClick}
106112
css={css`
107113
${themeByFeature}
108114
${theme?.BaseRow}

0 commit comments

Comments
 (0)