Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Icon - Still show loading icon when loading without showIcon
let $icon;
if (showIcon) {
const currentIcon = icon || treeIcon;
$icon = currentIcon ? (
<span>
{typeof currentIcon === 'function' ?
omi.createElement(currentIcon, {
...this.props,
}) : currentIcon}
</span>
) : this.renderIcon();
} else if (loadData && loading) {
$icon = this.renderIcon();
}
// Title
const $title = <span>{title}</span>;
return (
switcherIcon: switcherIconFromProps,
} = this.props;
const {
omiTree: {
prefixCls,
switcherIcon: switcherIconFromCtx,
}
} = this.store;
const switcherIcon = switcherIconFromProps || switcherIconFromCtx;
if (this.isLeaf()) {
return (
<span>
{typeof switcherIcon === 'function' ?
omi.createElement(switcherIcon, { ...this.props, isLeaf: true }) : switcherIcon}
</span>
);
}
const switcherCls = classNames(`${prefixCls}-switcher`, `${prefixCls}-switcher_${expanded ? ICON_OPEN : ICON_CLOSE}`);
return (
<span>
{typeof switcherIcon === 'function' ?
omi.createElement(switcherIcon, { ...this.props, isLeaf: false }) : switcherIcon}
</span>
);
}