diff --git a/src/components/CheckBoxTree/index.tsx b/src/components/CheckBoxTree/index.tsx index 2b2c5e3f9..dfda62c00 100644 --- a/src/components/CheckBoxTree/index.tsx +++ b/src/components/CheckBoxTree/index.tsx @@ -48,7 +48,6 @@ interface CheckBoxTreeProps { setRecentColors: ActionCreator; } const CHECKBOX_SPAN_NO = 2; -const LABEL_SPAN_NO = 6; import styles from "./style.css"; class CheckBoxTree extends React.Component { @@ -124,11 +123,10 @@ class CheckBoxTree extends React.Component { value.length ? key : "" ) ); - return (
{ ); }; - renderRowWithNoChildren = (nodeData: AgentDisplayNode) => { - const { agentsChecked, agentsHighlighted } = this.props; + renderHighlightNoChildren = (nodeData: AgentDisplayNode) => { + const { agentsHighlighted } = this.props; const isHighlighted = isEmpty(agentsHighlighted) || !agentsHighlighted[nodeData.title] ? false : agentsHighlighted[nodeData.title].includes(nodeData.title); + + return ( + + this.onAgentWithNoTagsChangeHighlight(event, nodeData.title) + } + /> + ); + }; + + renderCheckBoxNoChildren = (nodeData: AgentDisplayNode) => { + const { agentsChecked } = this.props; + const isVisible = isEmpty(agentsChecked) || !agentsChecked[nodeData.title] ? false : agentsChecked[nodeData.title].includes(nodeData.title); return ( - - - - this.onAgentWithNoTagsChangeHighlight( - event, - nodeData.title - ) - } - /> - - - - this.onAgentWithNoTagsChangeVisible( - event, - nodeData.title - ) - } - /> - - + + this.onAgentWithNoTagsChangeVisible(event, nodeData.title) + } + /> ); }; - renderSharedCheckboxes = (nodeData: AgentDisplayNode) => ( - - + renderSharedCheckboxes = ( + nodeData: AgentDisplayNode, + type: CHECKBOX_TYPE_STAR | undefined + ) => { + if (type === CHECKBOX_TYPE_STAR) { + return ( { } isHeader={true} /> - - + ); + } else { + return ( { checkedList={this.props.agentsChecked[nodeData.title] || []} isHeader={true} /> - - - ); + ); + } + }; render() { const { agentsHighlighted, @@ -226,22 +222,6 @@ class CheckBoxTree extends React.Component { } = this.props; return treeData.length > 0 ? (
- - - {treeData.map((nodeData) => { const childrenHaveDifferentColors = @@ -253,8 +233,11 @@ class CheckBoxTree extends React.Component { headerContent={ <> {nodeData.children.length - ? this.renderSharedCheckboxes(nodeData) - : this.renderRowWithNoChildren( + ? this.renderSharedCheckboxes( + nodeData, + CHECKBOX_TYPE_STAR + ) + : this.renderHighlightNoChildren( nodeData )}{" "} { setColorChange={setColorChange} setRecentColors={setRecentColors} /> + {nodeData.children.length + ? this.renderSharedCheckboxes( + nodeData, + undefined + ) + : this.renderCheckBoxNoChildren( + nodeData + )}{" "} { } /> + + + {nodeData.children.map((value) => { + return ( +
+ +
+ ); + })} + +
{ styles.rowLabelContainer } > -