11import { Component , ReactNode , createElement } from "react" ;
22import { observer } from "mobx-react" ;
33import classNames from "classnames" ;
4- import { FaExpandAlt , FaCompressAlt } from "react-icons/fa" ;
5- import Table , { TableRowSelection , ColumnProps } from "antd/es/table" ;
4+
5+ import { ExpandIcon , CompressIcon } from "./Icons" ;
6+
7+ import Table , { ColumnProps } from "antd/es/table" ;
8+ import { TableRowSelection } from "antd/es/table/interface" ;
69
710// Importing seperate so we don't pollute the CSS too much
811import "../ui/MxTreeTable.scss" ;
@@ -93,9 +96,16 @@ export class TreeTable extends Component<TreeTableProps> {
9396 }
9497 } ;
9598
96- const onRow = ( record : TableRecord ) : { [ name : string ] : ( ) => void } => {
99+ const onRow = ( record : TableRecord ) : { [ name : string ] : ( event : MouseEvent ) => void } => {
97100 return {
98- onClick : ( ) => {
101+ onClick : ( event : MouseEvent ) => {
102+ // When we click the checkbox, we also fire onClick. We check if it is the checkbox, if so, stop this
103+ if ( event . target !== null ) {
104+ const className = ( event . target as HTMLElement ) . className ;
105+ if ( className . includes ( "ant-checkbox" ) ) {
106+ return ;
107+ }
108+ }
99109 clearDebounce ( ) ;
100110 this . debounce = window . setTimeout ( ( ) => {
101111 this . onRowClick ( record ) ;
@@ -117,7 +127,14 @@ export class TreeTable extends Component<TreeTableProps> {
117127 }
118128 } , DEBOUNCE ) ;
119129 } ,
120- onDoubleClick : ( ) => {
130+ onDoubleClick : ( event : MouseEvent ) => {
131+ // When we click the checkbox, we also fire onClick. We check if it is the checkbox, if so, stop this
132+ if ( event . target !== null ) {
133+ const className = ( event . target as HTMLElement ) . className ;
134+ if ( className . includes ( "ant-checkbox" ) ) {
135+ return ;
136+ }
137+ }
121138 clearDebounce ( ) ;
122139 this . debounce = window . setTimeout ( ( ) => {
123140 this . onRowDblClick ( record ) ; // double click row
@@ -228,13 +245,13 @@ export class TreeTable extends Component<TreeTableProps> {
228245 if ( expanded ) {
229246 return (
230247 < div role = "button" className = { className } onClick = { this . collapseAll } >
231- < FaCompressAlt />
248+ < CompressIcon />
232249 </ div >
233250 ) ;
234251 }
235252 return (
236253 < div role = "button" className = { className } onClick = { this . expandAll } >
237- < FaExpandAlt />
254+ < ExpandIcon />
238255 </ div >
239256 ) ;
240257 }
0 commit comments