acud
Version:
acg react 组件库
29 lines • 945 B
JavaScript
import React from 'react';
import OutlinedDown from "acud-icon/es/icons/OutlinedDown";
import classNames from 'classnames';
import { cloneElement, isValidElement } from '../../_util/reactNode';
export function renderSwitcherIcon(prefixCls, switcherIcon, showLine, nodeProps) {
var isLeaf = nodeProps.isLeaf;
if (isLeaf) {
if (!showLine) {
return null;
}
return /*#__PURE__*/React.createElement("span", {
className: "".concat(prefixCls, "-switcher-leaf-line")
});
}
var switcherCls = "".concat(prefixCls, "-switcher-icon");
var switcher = typeof switcherIcon === 'function' ? switcherIcon(nodeProps) : switcherIcon;
if (isValidElement(switcher)) {
return cloneElement(switcher, {
className: classNames(switcher.props.className || '', switcherCls)
});
}
if (switcher) {
return switcher;
}
return /*#__PURE__*/React.createElement(OutlinedDown, {
className: switcherCls
});
}
;