UNPKG

epn-ui

Version:

Дизайн система кабинета ВМ

32 lines (29 loc) 4.02 kB
import React from 'react'; import clsx from 'clsx'; import TreeSelectAnt from 'antd/lib/tree-select'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faChevronDown } from '@fortawesome/pro-regular-svg-icons/faChevronDown'; import { faTimes } from '@fortawesome/pro-regular-svg-icons/faTimes'; import Loader from '../Loader/index.js'; import Empty from '../Empty/index.js'; function TreeSelect(_a) { var treeData = _a.treeData, treeDefaultExpandAll = _a.treeDefaultExpandAll, allowClear = _a.allowClear, treeLine = _a.treeLine, placeholder = _a.placeholder, value = _a.value, defaultValue = _a.defaultValue, open = _a.open, disabled = _a.disabled, loading = _a.loading, notFoundContent = _a.notFoundContent, fieldNames = _a.fieldNames, className = _a.className, style = _a.style, status = _a.status, id = _a.id, dropdownStyle = _a.dropdownStyle, dropdownClassName = _a.dropdownClassName, treeCheckable = _a.treeCheckable, showCheckedStrategy = _a.showCheckedStrategy, children = _a.children, maxTagCount = _a.maxTagCount, filterTreeNode = _a.filterTreeNode, _b = _a.treeNodeFilterProp, treeNodeFilterProp = _b === void 0 ? 'title' : _b, multiple = _a.multiple, placement = _a.placement, showSearch = _a.showSearch, searchValue = _a.searchValue, treeExpandAction = _a.treeExpandAction, treeLoadedKeys = _a.treeLoadedKeys, treeIcon = _a.treeIcon, dropdownMatchSelectWidth = _a.dropdownMatchSelectWidth, loadData = _a.loadData, getPopupContainer = _a.getPopupContainer, onSearch = _a.onSearch, onSelect = _a.onSelect, onTreeExpand = _a.onTreeExpand, onDropdownVisibleChange = _a.onDropdownVisibleChange, onChange = _a.onChange; return (React.createElement(TreeSelectAnt, { id: id, fieldNames: fieldNames, className: clsx('epn-treeSelect', className), style: style, dropdownClassName: dropdownClassName, dropdownStyle: dropdownStyle, status: status, treeData: treeData, treeDefaultExpandAll: treeDefaultExpandAll, placeholder: placeholder, value: value, defaultValue: defaultValue, loading: loading, open: open, maxTagCount: maxTagCount, removeIcon: React.createElement(FontAwesomeIcon, { icon: faTimes }), disabled: disabled, allowClear: allowClear, treeLine: treeLine, treeCheckable: treeCheckable, showCheckedStrategy: showCheckedStrategy, treeLoadedKeys: treeLoadedKeys, treeExpandAction: treeExpandAction, searchValue: searchValue, showSearch: showSearch, placement: placement, multiple: multiple, filterTreeNode: filterTreeNode, treeNodeFilterProp: treeNodeFilterProp, suffixIcon: !loading ? React.createElement(FontAwesomeIcon, { icon: faChevronDown }) : undefined, switcherIcon: React.createElement(FontAwesomeIcon, { icon: faChevronDown }), notFoundContent: notFoundContent || React.createElement(Empty, { locale: "ru" }), treeIcon: treeIcon, dropdownMatchSelectWidth: dropdownMatchSelectWidth, loadData: loadData, onChange: onChange, onDropdownVisibleChange: onDropdownVisibleChange, onTreeExpand: onTreeExpand, onSelect: onSelect, onSearch: onSearch, getPopupContainer: getPopupContainer, tagRender: function (_a) { var label = _a.label; return React.createElement("div", { className: "epn-select-customTag" }, label); }, dropdownRender: loading ? function (tree) { if (Array.isArray(treeData) && (treeData === null || treeData === void 0 ? void 0 : treeData.length) === 0) return (React.createElement("div", { className: "epn-select-dropdown-loading" }, React.createElement(Loader, null))); return (React.createElement(React.Fragment, null, tree, React.createElement(Loader, null))); } : undefined, virtual: false, showArrow: true }, children)); } TreeSelect.TreeNode = TreeSelectAnt.TreeNode; TreeSelect.SHOW_ALL = TreeSelectAnt.SHOW_ALL; TreeSelect.SHOW_PARENT = TreeSelectAnt.SHOW_PARENT; TreeSelect.SHOW_CHILD = TreeSelectAnt.SHOW_CHILD; export { TreeSelect as default };