@vtx/components 3.1.153 → 3.1.155
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/vtx-tree/index.js
CHANGED
|
@@ -21,7 +21,7 @@ var _ahooks = require("ahooks");
|
|
|
21
21
|
|
|
22
22
|
var _utils2 = require("@vtx/utils");
|
|
23
23
|
|
|
24
|
-
var _excluded = ["prefixCls", "showSearch", "treeData", "searchPlaceholder", "renderMenuList", "fieldNames", "titleClassName"];
|
|
24
|
+
var _excluded = ["prefixCls", "showSearch", "treeData", "searchPlaceholder", "renderMenuList", "fieldNames", "titleClassName", "expandAction"];
|
|
25
25
|
|
|
26
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
27
27
|
|
|
@@ -100,6 +100,8 @@ var VtxTree = function VtxTree(_ref, ref) {
|
|
|
100
100
|
renderMenuList = _ref.renderMenuList,
|
|
101
101
|
fieldNames = _ref.fieldNames,
|
|
102
102
|
titleClassName = _ref.titleClassName,
|
|
103
|
+
_ref$expandAction = _ref.expandAction,
|
|
104
|
+
expandAction = _ref$expandAction === void 0 ? 'click' : _ref$expandAction,
|
|
103
105
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
104
106
|
|
|
105
107
|
var treeRef = (0, _react.useRef)();
|
|
@@ -339,7 +341,7 @@ var VtxTree = function VtxTree(_ref, ref) {
|
|
|
339
341
|
selectedKeys: selectedKeys,
|
|
340
342
|
onSelect: onSelect,
|
|
341
343
|
fieldNames: fieldNames,
|
|
342
|
-
expandAction:
|
|
344
|
+
expandAction: expandAction,
|
|
343
345
|
titleRender: function titleRender(nodeData) {
|
|
344
346
|
var titleKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.title) || 'title';
|
|
345
347
|
var title = nodeData[titleKey];
|
|
@@ -386,7 +388,8 @@ VtxTree.propTypes = {
|
|
|
386
388
|
renderMenuList: _propTypes["default"].func,
|
|
387
389
|
titleClassName: _propTypes["default"].func,
|
|
388
390
|
fieldNames: _propTypes["default"].array,
|
|
389
|
-
defaultExpandAll: _propTypes["default"].bool
|
|
391
|
+
defaultExpandAll: _propTypes["default"].bool,
|
|
392
|
+
expandAction: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].bool])
|
|
390
393
|
};
|
|
391
394
|
|
|
392
395
|
var _default = /*#__PURE__*/(0, _react.forwardRef)(VtxTree);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getParentKey","key","tree","parentKey","node","children","found","undefined","VtxTree","ref","prefixCls","showSearch","treeData","searchPlaceholder","renderMenuList","fieldNames","titleClassName","props","treeRef","useRef","useState","height","setHeight","expandedKeys","setExpandedKeys","autoExpandParent","setAutoExpandParent","selectedKeys","defaultSelectedKeys","setSelectedKeys","inputRef","lastSelectedKey","React","cachedSelectedKeys","dataList","useMemo","titleKey","title","generateList","data","i","length","push","useEffect","onExpand","newExpandedKeys","info","newTreeData","setNewTreeData","filterTreeData","current","input","value","useMemoizedFn","searchValue","parseTreeData","renderNode","item","strTitle","index","indexOf","beforeStr","substring","afterStr","slice","className","filterNode","useDebounceFn","map","filter","self","wait","onSearch","run","useImperativeHandle","resizeObserver","ResizeObserver","offsetHeight","observe","box","disconnect","onSelect","keys","event","multiple","nativeEvent","newEvent","selected","ctrlPick","ctrlKey","metaKey","shiftPick","shiftKey","newSelectedKeys","selectedNodes","convertDirectoryKeysToNodes","Array","from","Set","calcRangeKeys","startKey","endKey","marginBottom","e","target","showLeafIcon","defaultExpandAll","nodeData","menuList","visible","label","stopPropagation","onClick","icon","propTypes","PropTypes","bool","string","array","func","forwardRef"],"sources":["vtx-tree/index.jsx"],"sourcesContent":["import React, {\r\n forwardRef,\r\n useEffect,\r\n useImperativeHandle,\r\n useMemo,\r\n useRef,\r\n useState,\r\n} from 'react';\r\nimport PropTypes from 'prop-types';\r\nimport { Input, Tooltip, Tree } from 'antd';\r\nimport { DownOutlined } from '@ant-design/icons';\r\nimport { calcRangeKeys, convertDirectoryKeysToNodes } from './utils';\r\nimport { useDebounceFn, useMemoizedFn } from 'ahooks';\r\nimport { parseTreeData } from '@vtx/utils';\r\n\r\nconst getParentKey = (key, tree, parentKey = null) => {\r\n for (const node of tree) {\r\n if (node.key === key) return parentKey;\r\n if (node.children) {\r\n const found = getParentKey(key, node.children, node.key);\r\n if (found !== undefined) return found;\r\n }\r\n }\r\n return undefined;\r\n};\r\nconst VtxTree = (\r\n {\r\n prefixCls = 'vtx-tree',\r\n showSearch = true,\r\n treeData = [],\r\n searchPlaceholder = '请输入要查询的关键字',\r\n renderMenuList,\r\n fieldNames,\r\n titleClassName,\r\n ...props\r\n },\r\n ref,\r\n) => {\r\n const treeRef = useRef();\r\n const [height, setHeight] = useState(0);\r\n const [expandedKeys, setExpandedKeys] = useState([]);\r\n const [autoExpandParent, setAutoExpandParent] = useState(props.autoExpandParent || false);\r\n const [selectedKeys, setSelectedKeys] = useState(\r\n props.selectedKeys || props.defaultSelectedKeys || [],\r\n );\r\n const inputRef = useRef();\r\n const lastSelectedKey = React.useRef();\r\n\r\n const cachedSelectedKeys = React.useRef();\r\n\r\n const dataList = useMemo(() => {\r\n let dataList = [];\r\n const titleKey = fieldNames?.title || 'title';\r\n const generateList = data => {\r\n for (let i = 0; i < data.length; i++) {\r\n const node = data[i];\r\n const { key } = node;\r\n dataList.push({ key, title: node[titleKey] });\r\n if (node.children) {\r\n generateList(node.children);\r\n }\r\n }\r\n };\r\n generateList(treeData);\r\n return dataList;\r\n }, [treeData]);\r\n\r\n useEffect(() => {\r\n if ('selectedKeys' in props) {\r\n setSelectedKeys(props.selectedKeys);\r\n }\r\n }, [props.selectedKeys]);\r\n\r\n useEffect(() => {\r\n if ('expandedKeys' in props) {\r\n setExpandedKeys(props.expandedKeys);\r\n }\r\n }, [props.expandedKeys]);\r\n\r\n const onExpand = (newExpandedKeys, info) => {\r\n setAutoExpandParent(false);\r\n props.onExpand?.(newExpandedKeys, info);\r\n if (!('expandedKeys' in props)) {\r\n setExpandedKeys(newExpandedKeys);\r\n }\r\n };\r\n\r\n const [newTreeData, setNewTreeData] = useState(treeData);\r\n useEffect(() => {\r\n if (treeData?.length) {\r\n filterTreeData(inputRef.current ? inputRef.current.input.value : '');\r\n }\r\n }, [treeData]);\r\n const filterTreeData = useMemoizedFn((searchValue = '') => {\r\n const newTreeData = parseTreeData(treeData, {\r\n renderNode(item) {\r\n const titleKey = fieldNames?.title || 'title';\r\n const strTitle = item[titleKey] || '';\r\n const index = strTitle.indexOf(searchValue);\r\n const beforeStr = strTitle.substring(0, index);\r\n const afterStr = strTitle.slice(index + searchValue.length);\r\n const className = titleClassName ? titleClassName(item) : '';\r\n const title =\r\n index > -1 ? (\r\n <span className={className}>\r\n {beforeStr}\r\n <span className={`${prefixCls}-search-value`}>{searchValue}</span>\r\n {afterStr}\r\n </span>\r\n ) : (\r\n <span className={className}>{strTitle}</span>\r\n );\r\n\r\n return {\r\n ...item,\r\n [titleKey]: title,\r\n key: item.key,\r\n strTitle,\r\n };\r\n },\r\n filterNode(item) {\r\n return item.strTitle.indexOf(searchValue) > -1;\r\n },\r\n });\r\n return setNewTreeData(newTreeData);\r\n });\r\n const { run: onSearch } = useDebounceFn(\r\n value => {\r\n const newExpandedKeys = dataList\r\n .map(item => {\r\n if (item.title.indexOf(value) > -1) {\r\n return getParentKey(item.key, treeData);\r\n }\r\n return null;\r\n })\r\n .filter((item, i, self) => item && self.indexOf(item) === i);\r\n setAutoExpandParent(true);\r\n filterTreeData(value);\r\n props.onExpand?.(newExpandedKeys);\r\n if (!('expandedKeys' in props)) {\r\n setExpandedKeys(newExpandedKeys);\r\n }\r\n },\r\n {\r\n wait: 300,\r\n },\r\n );\r\n\r\n useImperativeHandle(ref, () => ({\r\n onSearch,\r\n }));\r\n\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(() => {\r\n setHeight(treeRef.current.offsetHeight);\r\n });\r\n if (treeRef.current) {\r\n resizeObserver.observe(treeRef.current, {\r\n box: 'border-box',\r\n });\r\n }\r\n setHeight(treeRef.current.offsetHeight);\r\n return () => {\r\n resizeObserver.disconnect();\r\n };\r\n }, []);\r\n\r\n const onSelect = (keys, event) => {\r\n const { multiple } = props;\r\n const { node, nativeEvent } = event;\r\n const { key = '' } = node;\r\n // const newState: DirectoryTreeState = {};\r\n\r\n // We need wrap this event since some value is not same\r\n const newEvent = {\r\n ...event,\r\n selected: true, // Directory selected always true\r\n };\r\n\r\n // Windows / Mac single pick\r\n const ctrlPick = nativeEvent?.ctrlKey || nativeEvent?.metaKey;\r\n const shiftPick = nativeEvent?.shiftKey;\r\n\r\n // Generate new selected keys\r\n let newSelectedKeys;\r\n if (multiple && ctrlPick) {\r\n // Control click\r\n newSelectedKeys = keys;\r\n lastSelectedKey.current = key;\r\n cachedSelectedKeys.current = newSelectedKeys;\r\n newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData, newSelectedKeys);\r\n } else if (multiple && shiftPick) {\r\n // Shift click\r\n newSelectedKeys = Array.from(\r\n new Set([\r\n ...(cachedSelectedKeys.current || []),\r\n ...calcRangeKeys({\r\n treeData,\r\n expandedKeys,\r\n startKey: key,\r\n endKey: lastSelectedKey.current,\r\n }),\r\n ]),\r\n );\r\n newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData, newSelectedKeys);\r\n } else {\r\n // Single click\r\n newSelectedKeys = [key];\r\n lastSelectedKey.current = key;\r\n cachedSelectedKeys.current = newSelectedKeys;\r\n newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData, newSelectedKeys);\r\n }\r\n\r\n props.onSelect?.(newSelectedKeys, newEvent);\r\n if (!('selectedKeys' in props)) {\r\n setSelectedKeys(newSelectedKeys);\r\n }\r\n };\r\n return (\r\n <div className={`${prefixCls}-wraaper`}>\r\n {showSearch && (\r\n <Input\r\n style={{ marginBottom: 8 }}\r\n placeholder={searchPlaceholder}\r\n onChange={e => onSearch(e.target.value)}\r\n ref={inputRef}\r\n />\r\n )}\r\n <div className={prefixCls} ref={treeRef}>\r\n <Tree\r\n {...props}\r\n height={height}\r\n switcherIcon={<DownOutlined />}\r\n showLine={{ showLeafIcon: false }}\r\n blockNode\r\n treeData={newTreeData}\r\n onExpand={onExpand}\r\n {...(expandedKeys.length === 0 && props.defaultExpandAll\r\n ? {}\r\n : { expandedKeys })}\r\n autoExpandParent={autoExpandParent}\r\n selectedKeys={selectedKeys}\r\n onSelect={onSelect}\r\n fieldNames={fieldNames}\r\n expandAction=\"click\"\r\n titleRender={nodeData => {\r\n const titleKey = fieldNames?.title || 'title';\r\n const title = nodeData[titleKey];\r\n\r\n if (renderMenuList) {\r\n const menuList = renderMenuList(nodeData);\r\n return (\r\n <div className={`${prefixCls}-menu-wrap`}>\r\n <span>{title}</span>\r\n <div className={`${prefixCls}-menu-list`}>\r\n {menuList\r\n .filter(item => item.visible)\r\n .map(item => (\r\n <Tooltip key={item.label} title={item.label}>\r\n <span\r\n className={`${prefixCls}-menu-item-icon`}\r\n onClick={e => {\r\n e.stopPropagation();\r\n item.onClick && item.onClick(nodeData);\r\n }}\r\n >\r\n {item.icon}\r\n </span>\r\n </Tooltip>\r\n ))}\r\n </div>\r\n </div>\r\n );\r\n }\r\n return title;\r\n }}\r\n />\r\n </div>\r\n </div>\r\n );\r\n};\r\n\r\nVtxTree.propTypes = {\r\n showSearch: PropTypes.bool,\r\n prefixCls: PropTypes.string,\r\n treeData: PropTypes.array,\r\n selectedKeys: PropTypes.array,\r\n defaultSelectedKeys: PropTypes.array,\r\n expandedKeys: PropTypes.bool,\r\n onExpand: PropTypes.func,\r\n multiple: PropTypes.bool,\r\n autoExpandParent: PropTypes.bool,\r\n onSelect: PropTypes.func,\r\n searchPlaceholder: PropTypes.string,\r\n renderMenuList: PropTypes.func,\r\n titleClassName: PropTypes.func,\r\n fieldNames: PropTypes.array,\r\n defaultExpandAll: PropTypes.bool,\r\n};\r\n\r\nexport default forwardRef(VtxTree);\r\n"],"mappings":";;;;;;;;;AAAA;;AAQA;;AACA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AUG,KAJR;EAKhB1F,mBAAmB,EAAEuF,qBAAA,CAAUG,KALf;EAMhB/F,YAAY,EAAE4F,qBAAA,CAAUC,IANR;EAOhBxE,QAAQ,EAAEuE,qBAAA,CAAUI,IAPJ;EAQhBnC,QAAQ,EAAE+B,qBAAA,CAAUC,IARJ;EAShB3F,gBAAgB,EAAE0F,qBAAA,CAAUC,IATZ;EAUhBnC,QAAQ,EAAEkC,qBAAA,CAAUI,IAVJ;EAWhB1G,iBAAiB,EAAEsG,qBAAA,CAAUE,MAXb;EAYhBvG,cAAc,EAAEqG,qBAAA,CAAUI,IAZV;EAahBvG,cAAc,EAAEmG,qBAAA,CAAUI,IAbV;EAchBxG,UAAU,EAAEoG,qBAAA,CAAUG,KAdN;EAehBZ,gBAAgB,EAAES,qBAAA,CAAUC;AAfZ,CAApB;;4BAkBe,IAAAI,iBAAA,EAAWhH,OAAX,C"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["getParentKey","key","tree","parentKey","node","children","found","undefined","VtxTree","ref","prefixCls","showSearch","treeData","searchPlaceholder","renderMenuList","fieldNames","titleClassName","expandAction","props","treeRef","useRef","useState","height","setHeight","expandedKeys","setExpandedKeys","autoExpandParent","setAutoExpandParent","selectedKeys","defaultSelectedKeys","setSelectedKeys","inputRef","lastSelectedKey","React","cachedSelectedKeys","dataList","useMemo","titleKey","title","generateList","data","i","length","push","useEffect","onExpand","newExpandedKeys","info","newTreeData","setNewTreeData","filterTreeData","current","input","value","useMemoizedFn","searchValue","parseTreeData","renderNode","item","strTitle","index","indexOf","beforeStr","substring","afterStr","slice","className","filterNode","useDebounceFn","map","filter","self","wait","onSearch","run","useImperativeHandle","resizeObserver","ResizeObserver","offsetHeight","observe","box","disconnect","onSelect","keys","event","multiple","nativeEvent","newEvent","selected","ctrlPick","ctrlKey","metaKey","shiftPick","shiftKey","newSelectedKeys","selectedNodes","convertDirectoryKeysToNodes","Array","from","Set","calcRangeKeys","startKey","endKey","marginBottom","e","target","showLeafIcon","defaultExpandAll","nodeData","menuList","visible","label","stopPropagation","onClick","icon","propTypes","PropTypes","bool","string","array","func","oneOfType","forwardRef"],"sources":["vtx-tree/index.jsx"],"sourcesContent":["import React, {\r\n forwardRef,\r\n useEffect,\r\n useImperativeHandle,\r\n useMemo,\r\n useRef,\r\n useState,\r\n} from 'react';\r\nimport PropTypes from 'prop-types';\r\nimport { Input, Tooltip, Tree } from 'antd';\r\nimport { DownOutlined } from '@ant-design/icons';\r\nimport { calcRangeKeys, convertDirectoryKeysToNodes } from './utils';\r\nimport { useDebounceFn, useMemoizedFn } from 'ahooks';\r\nimport { parseTreeData } from '@vtx/utils';\r\n\r\nconst getParentKey = (key, tree, parentKey = null) => {\r\n for (const node of tree) {\r\n if (node.key === key) return parentKey;\r\n if (node.children) {\r\n const found = getParentKey(key, node.children, node.key);\r\n if (found !== undefined) return found;\r\n }\r\n }\r\n return undefined;\r\n};\r\nconst VtxTree = (\r\n {\r\n prefixCls = 'vtx-tree',\r\n showSearch = true,\r\n treeData = [],\r\n searchPlaceholder = '请输入要查询的关键字',\r\n renderMenuList,\r\n fieldNames,\r\n titleClassName,\r\n expandAction='click',\r\n ...props\r\n },\r\n ref,\r\n) => {\r\n const treeRef = useRef();\r\n const [height, setHeight] = useState(0);\r\n const [expandedKeys, setExpandedKeys] = useState([]);\r\n const [autoExpandParent, setAutoExpandParent] = useState(props.autoExpandParent || false);\r\n const [selectedKeys, setSelectedKeys] = useState(\r\n props.selectedKeys || props.defaultSelectedKeys || [],\r\n );\r\n const inputRef = useRef();\r\n const lastSelectedKey = React.useRef();\r\n\r\n const cachedSelectedKeys = React.useRef();\r\n\r\n const dataList = useMemo(() => {\r\n let dataList = [];\r\n const titleKey = fieldNames?.title || 'title';\r\n const generateList = data => {\r\n for (let i = 0; i < data.length; i++) {\r\n const node = data[i];\r\n const { key } = node;\r\n dataList.push({ key, title: node[titleKey] });\r\n if (node.children) {\r\n generateList(node.children);\r\n }\r\n }\r\n };\r\n generateList(treeData);\r\n return dataList;\r\n }, [treeData]);\r\n\r\n useEffect(() => {\r\n if ('selectedKeys' in props) {\r\n setSelectedKeys(props.selectedKeys);\r\n }\r\n }, [props.selectedKeys]);\r\n\r\n useEffect(() => {\r\n if ('expandedKeys' in props) {\r\n setExpandedKeys(props.expandedKeys);\r\n }\r\n }, [props.expandedKeys]);\r\n\r\n const onExpand = (newExpandedKeys, info) => {\r\n setAutoExpandParent(false);\r\n props.onExpand?.(newExpandedKeys, info);\r\n if (!('expandedKeys' in props)) {\r\n setExpandedKeys(newExpandedKeys);\r\n }\r\n };\r\n\r\n const [newTreeData, setNewTreeData] = useState(treeData);\r\n useEffect(() => {\r\n if (treeData?.length) {\r\n filterTreeData(inputRef.current ? inputRef.current.input.value : '');\r\n }\r\n }, [treeData]);\r\n const filterTreeData = useMemoizedFn((searchValue = '') => {\r\n const newTreeData = parseTreeData(treeData, {\r\n renderNode(item) {\r\n const titleKey = fieldNames?.title || 'title';\r\n const strTitle = item[titleKey] || '';\r\n const index = strTitle.indexOf(searchValue);\r\n const beforeStr = strTitle.substring(0, index);\r\n const afterStr = strTitle.slice(index + searchValue.length);\r\n const className = titleClassName ? titleClassName(item) : '';\r\n const title =\r\n index > -1 ? (\r\n <span className={className}>\r\n {beforeStr}\r\n <span className={`${prefixCls}-search-value`}>{searchValue}</span>\r\n {afterStr}\r\n </span>\r\n ) : (\r\n <span className={className}>{strTitle}</span>\r\n );\r\n\r\n return {\r\n ...item,\r\n [titleKey]: title,\r\n key: item.key,\r\n strTitle,\r\n };\r\n },\r\n filterNode(item) {\r\n return item.strTitle.indexOf(searchValue) > -1;\r\n },\r\n });\r\n return setNewTreeData(newTreeData);\r\n });\r\n const { run: onSearch } = useDebounceFn(\r\n value => {\r\n const newExpandedKeys = dataList\r\n .map(item => {\r\n if (item.title.indexOf(value) > -1) {\r\n return getParentKey(item.key, treeData);\r\n }\r\n return null;\r\n })\r\n .filter((item, i, self) => item && self.indexOf(item) === i);\r\n setAutoExpandParent(true);\r\n filterTreeData(value);\r\n props.onExpand?.(newExpandedKeys);\r\n if (!('expandedKeys' in props)) {\r\n setExpandedKeys(newExpandedKeys);\r\n }\r\n },\r\n {\r\n wait: 300,\r\n },\r\n );\r\n\r\n useImperativeHandle(ref, () => ({\r\n onSearch,\r\n }));\r\n\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(() => {\r\n setHeight(treeRef.current.offsetHeight);\r\n });\r\n if (treeRef.current) {\r\n resizeObserver.observe(treeRef.current, {\r\n box: 'border-box',\r\n });\r\n }\r\n setHeight(treeRef.current.offsetHeight);\r\n return () => {\r\n resizeObserver.disconnect();\r\n };\r\n }, []);\r\n\r\n const onSelect = (keys, event) => {\r\n const { multiple } = props;\r\n const { node, nativeEvent } = event;\r\n const { key = '' } = node;\r\n // const newState: DirectoryTreeState = {};\r\n\r\n // We need wrap this event since some value is not same\r\n const newEvent = {\r\n ...event,\r\n selected: true, // Directory selected always true\r\n };\r\n\r\n // Windows / Mac single pick\r\n const ctrlPick = nativeEvent?.ctrlKey || nativeEvent?.metaKey;\r\n const shiftPick = nativeEvent?.shiftKey;\r\n\r\n // Generate new selected keys\r\n let newSelectedKeys;\r\n if (multiple && ctrlPick) {\r\n // Control click\r\n newSelectedKeys = keys;\r\n lastSelectedKey.current = key;\r\n cachedSelectedKeys.current = newSelectedKeys;\r\n newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData, newSelectedKeys);\r\n } else if (multiple && shiftPick) {\r\n // Shift click\r\n newSelectedKeys = Array.from(\r\n new Set([\r\n ...(cachedSelectedKeys.current || []),\r\n ...calcRangeKeys({\r\n treeData,\r\n expandedKeys,\r\n startKey: key,\r\n endKey: lastSelectedKey.current,\r\n }),\r\n ]),\r\n );\r\n newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData, newSelectedKeys);\r\n } else {\r\n // Single click\r\n newSelectedKeys = [key];\r\n lastSelectedKey.current = key;\r\n cachedSelectedKeys.current = newSelectedKeys;\r\n newEvent.selectedNodes = convertDirectoryKeysToNodes(treeData, newSelectedKeys);\r\n }\r\n\r\n props.onSelect?.(newSelectedKeys, newEvent);\r\n if (!('selectedKeys' in props)) {\r\n setSelectedKeys(newSelectedKeys);\r\n }\r\n };\r\n return (\r\n <div className={`${prefixCls}-wraaper`}>\r\n {showSearch && (\r\n <Input\r\n style={{ marginBottom: 8 }}\r\n placeholder={searchPlaceholder}\r\n onChange={e => onSearch(e.target.value)}\r\n ref={inputRef}\r\n />\r\n )}\r\n <div className={prefixCls} ref={treeRef}>\r\n <Tree\r\n {...props}\r\n height={height}\r\n switcherIcon={<DownOutlined />}\r\n showLine={{ showLeafIcon: false }}\r\n blockNode\r\n treeData={newTreeData}\r\n onExpand={onExpand}\r\n {...(expandedKeys.length === 0 && props.defaultExpandAll\r\n ? {}\r\n : { expandedKeys })}\r\n autoExpandParent={autoExpandParent}\r\n selectedKeys={selectedKeys}\r\n onSelect={onSelect}\r\n fieldNames={fieldNames}\r\n expandAction={expandAction}\r\n titleRender={nodeData => {\r\n const titleKey = fieldNames?.title || 'title';\r\n const title = nodeData[titleKey];\r\n\r\n if (renderMenuList) {\r\n const menuList = renderMenuList(nodeData);\r\n return (\r\n <div className={`${prefixCls}-menu-wrap`}>\r\n <span>{title}</span>\r\n <div className={`${prefixCls}-menu-list`}>\r\n {menuList\r\n .filter(item => item.visible)\r\n .map(item => (\r\n <Tooltip key={item.label} title={item.label}>\r\n <span\r\n className={`${prefixCls}-menu-item-icon`}\r\n onClick={e => {\r\n e.stopPropagation();\r\n item.onClick && item.onClick(nodeData);\r\n }}\r\n >\r\n {item.icon}\r\n </span>\r\n </Tooltip>\r\n ))}\r\n </div>\r\n </div>\r\n );\r\n }\r\n return title;\r\n }}\r\n />\r\n </div>\r\n </div>\r\n );\r\n};\r\n\r\nVtxTree.propTypes = {\r\n showSearch: PropTypes.bool,\r\n prefixCls: PropTypes.string,\r\n treeData: PropTypes.array,\r\n selectedKeys: PropTypes.array,\r\n defaultSelectedKeys: PropTypes.array,\r\n expandedKeys: PropTypes.bool,\r\n onExpand: PropTypes.func,\r\n multiple: PropTypes.bool,\r\n autoExpandParent: PropTypes.bool,\r\n onSelect: PropTypes.func,\r\n searchPlaceholder: PropTypes.string,\r\n renderMenuList: PropTypes.func,\r\n titleClassName: PropTypes.func,\r\n fieldNames: PropTypes.array,\r\n defaultExpandAll: PropTypes.bool,\r\n expandAction: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),\r\n};\r\n\r\nexport default forwardRef(VtxTree);\r\n"],"mappings":";;;;;;;;;AAAA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,YAAY,GAAG,SAAfA,YAAe,CAACC,GAAD,EAAMC,IAAN,EAAiC;EAAA,IAArBC,SAAqB,uEAAT,IAAS;;EAAA,2CAC/BD,IAD+B;EAAA;;EAAA;IAClD,oDAAyB;MAAA,IAAdE,IAAc;MACrB,IAAIA,IAAI,CAACH,GAAL,KAAaA,GAAjB,EAAsB,OAAOE,SAAP;;MACtB,IAAIC,IAAI,CAACC,QAAT,EAAmB;QACf,IAAMC,KAAK,GAAGN,YAAY,CAACC,GAAD,EAAMG,IAAI,CAACC,QAAX,EAAqBD,IAAI,CAACH,GAA1B,CAA1B;QACA,IAAIK,KAAK,KAAKC,SAAd,EAAyB,OAAOD,KAAP;MAC5B;IACJ;EAPiD;IAAA;EAAA;IAAA;EAAA;;EAQlD,OAAOC,SAAP;AACH,CATD;;AAUA,IAAMC,OAAO,GAAG,SAAVA,OAAU,OAYZC,GAZY,EAaX;EAAA,0BAXGC,SAWH;EAAA,IAXGA,SAWH,+BAXe,UAWf;EAAA,2BAVGC,UAUH;EAAA,IAVGA,UAUH,gCAVgB,IAUhB;EAAA,yBATGC,QASH;EAAA,IATGA,QASH,8BATc,EASd;EAAA,iCARGC,iBAQH;EAAA,IARGA,iBAQH,sCARuB,YAQvB;EAAA,IAPGC,cAOH,QAPGA,cAOH;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