Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
classPrefix,
onSelect,
layer,
disabled,
uncheckable,
nodeData,
checkState
} = this.props;
if (disabled || uncheckable) {
return;
}
// 如果点击的是展开 icon 就 return
if (event.target instanceof HTMLElement) {
if (hasClass(event.target.parentNode, `${classPrefix}-node-expand-icon-wrapper`)) {
return;
}
}
let isChecked = false;
if (checkState === CHECK_STATE.UNCHECK || checkState === CHECK_STATE.INDETERMINATE) {
isChecked = true;
}
if (checkState === CHECK_STATE.CHECK) {
isChecked = false;
}
nodeData.check = isChecked;
onSelect && onSelect(nodeData, layer, event);
};
handleSelect = (event: React.SyntheticEvent) => {
const { onSelect, layer, disabled, nodeData } = this.props;
if (disabled) {
return;
}
if (event.target instanceof HTMLElement) {
if (hasClass(event.target.parentNode, this.addPrefix('expand-icon-wrapper'))) {
return;
}
}
onSelect?.(nodeData, layer, event);
};
hasClass: function (className, target = findDOMNode(this)) {
return hasClass(target, className);
},
addClass: function (className, target = findDOMNode(this)) {