Skip to content

Commit

Permalink
Merge 27b966b into 423a5e4
Browse files Browse the repository at this point in the history
  • Loading branch information
Bulletninja committed Dec 19, 2019
2 parents 423a5e4 + 27b966b commit 5ac7a1b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
3 changes: 3 additions & 0 deletions src/tree-node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class TreeNode extends PureComponent {
showPartiallySelected: PropTypes.bool,
readOnly: PropTypes.bool,
clientId: PropTypes.string,
selectable: PropTypes.bool,
}

getAriaAttributes = () => {
Expand Down Expand Up @@ -113,6 +114,7 @@ class TreeNode extends PureComponent {
showPartiallySelected,
readOnly,
clientId,
selectable,
} = this.props
const liCx = getNodeCx(this.props)
const style = keepTreeOnSearch || !searchModeOn ? { paddingLeft: `${(_depth || 0) * 20}px` } : {}
Expand All @@ -135,6 +137,7 @@ class TreeNode extends PureComponent {
showPartiallySelected={showPartiallySelected}
readOnly={readOnly}
clientId={clientId}
selectable={selectable}
/>
<Actions actions={actions} onAction={onAction} id={_id} readOnly={readOnly} />
</li>
Expand Down
19 changes: 11 additions & 8 deletions src/tree-node/node-label.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class NodeLabel extends PureComponent {
onCheckboxChange: PropTypes.func,
readOnly: PropTypes.bool,
clientId: PropTypes.string,
selectable: PropTypes.bool,
}

handleCheckboxChange = e => {
Expand All @@ -42,7 +43,7 @@ class NodeLabel extends PureComponent {
}

render() {
const { mode, title, label, id, partial, checked } = this.props
const { mode, title, label, id, partial, checked, selectable = true } = this.props
const { value, disabled, showPartiallySelected, readOnly, clientId } = this.props
const nodeLabelProps = { className: 'node-label' }

Expand All @@ -61,13 +62,15 @@ class NodeLabel extends PureComponent {
{mode === 'radioSelect' ? (
<RadioButton name={clientId} className="radio-item" onChange={this.handleCheckboxChange} {...sharedProps} />
) : (
<Checkbox
name={id}
className={cx('checkbox-item', { 'simple-select': mode === 'simpleSelect' })}
indeterminate={showPartiallySelected && partial}
onChange={this.handleCheckboxChange}
{...sharedProps}
/>
selectable && (
<Checkbox
name={id}
className={cx('checkbox-item', { 'simple-select': mode === 'simpleSelect' })}
indeterminate={showPartiallySelected && partial}
onChange={this.handleCheckboxChange}
{...sharedProps}
/>
)
)}
<span {...nodeLabelProps}>{label}</span>
</label>
Expand Down

0 comments on commit 5ac7a1b

Please sign in to comment.