rc-tree-select
Advanced tools
Comparing version 5.15.0 to 5.16.0
@@ -39,3 +39,4 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
dropdownMatchSelectWidth = _React$useContext.dropdownMatchSelectWidth, | ||
treeExpandAction = _React$useContext.treeExpandAction; | ||
treeExpandAction = _React$useContext.treeExpandAction, | ||
treeTitleRender = _React$useContext.treeTitleRender; | ||
var _React$useContext2 = React.useContext(LegacyContext), | ||
@@ -242,3 +243,4 @@ checkable = _React$useContext2.checkable, | ||
selectedKeys: !checkable ? checkedKeys : [], | ||
defaultExpandAll: treeDefaultExpandAll | ||
defaultExpandAll: treeDefaultExpandAll, | ||
titleRender: treeTitleRender | ||
}, treeProps, { | ||
@@ -245,0 +247,0 @@ // Proxy event out |
@@ -107,2 +107,3 @@ import type { BaseSelectPropsWithoutPrivate, BaseSelectRef, SelectProps } from 'rc-select'; | ||
onDropdownVisibleChange?: (open: boolean) => void; | ||
treeTitleRender?: (node: ValueType) => React.ReactNode; | ||
treeLine?: boolean; | ||
@@ -109,0 +110,0 @@ treeIcon?: IconType; |
@@ -7,3 +7,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import _typeof from "@babel/runtime/helpers/esm/typeof"; | ||
var _excluded = ["id", "prefixCls", "value", "defaultValue", "onChange", "onSelect", "onDeselect", "searchValue", "inputValue", "onSearch", "autoClearSearchValue", "filterTreeNode", "treeNodeFilterProp", "showCheckedStrategy", "treeNodeLabelProp", "multiple", "treeCheckable", "treeCheckStrictly", "labelInValue", "fieldNames", "treeDataSimpleMode", "treeData", "children", "loadData", "treeLoadedKeys", "onTreeLoad", "treeDefaultExpandAll", "treeExpandedKeys", "treeDefaultExpandedKeys", "onTreeExpand", "treeExpandAction", "virtual", "listHeight", "listItemHeight", "listItemScrollOffset", "onDropdownVisibleChange", "dropdownMatchSelectWidth", "treeLine", "treeIcon", "showTreeIcon", "switcherIcon", "treeMotion"]; | ||
var _excluded = ["id", "prefixCls", "value", "defaultValue", "onChange", "onSelect", "onDeselect", "searchValue", "inputValue", "onSearch", "autoClearSearchValue", "filterTreeNode", "treeNodeFilterProp", "showCheckedStrategy", "treeNodeLabelProp", "multiple", "treeCheckable", "treeCheckStrictly", "labelInValue", "fieldNames", "treeDataSimpleMode", "treeData", "children", "loadData", "treeLoadedKeys", "onTreeLoad", "treeDefaultExpandAll", "treeExpandedKeys", "treeDefaultExpandedKeys", "onTreeExpand", "treeExpandAction", "virtual", "listHeight", "listItemHeight", "listItemScrollOffset", "onDropdownVisibleChange", "dropdownMatchSelectWidth", "treeLine", "treeIcon", "showTreeIcon", "switcherIcon", "treeMotion", "treeTitleRender"]; | ||
import { BaseSelect } from 'rc-select'; | ||
@@ -85,2 +85,3 @@ import useId from "rc-select/es/hooks/useId"; | ||
treeMotion = props.treeMotion, | ||
treeTitleRender = props.treeTitleRender, | ||
restProps = _objectWithoutProperties(props, _excluded); | ||
@@ -280,5 +281,12 @@ var mergedId = useId(id); | ||
}); | ||
var label; | ||
// Ensure that when labelInValue is true, if label is undefined, it remains undefined. | ||
if (labelInValue && targetItem.label !== undefined) { | ||
label = targetItem.label; | ||
} else if (!labelInValue && treeTitleRender) { | ||
label = treeTitleRender(targetItem); | ||
} | ||
return { | ||
value: val, | ||
label: targetItem === null || targetItem === void 0 ? void 0 : targetItem.label | ||
label: label | ||
}; | ||
@@ -474,5 +482,6 @@ }); | ||
onSelect: onOptionSelect, | ||
treeExpandAction: treeExpandAction | ||
treeExpandAction: treeExpandAction, | ||
treeTitleRender: treeTitleRender | ||
}; | ||
}, [virtual, dropdownMatchSelectWidth, listHeight, listItemHeight, listItemScrollOffset, filteredTreeData, mergedFieldNames, onOptionSelect, treeExpandAction]); | ||
}, [virtual, dropdownMatchSelectWidth, listHeight, listItemHeight, listItemScrollOffset, filteredTreeData, mergedFieldNames, onOptionSelect, treeExpandAction, treeTitleRender]); | ||
@@ -479,0 +488,0 @@ // ======================= Legacy Context ======================= |
@@ -14,4 +14,5 @@ import * as React from 'react'; | ||
treeExpandAction?: ExpandAction; | ||
treeTitleRender?: (node: any) => React.ReactNode; | ||
} | ||
declare const TreeSelectContext: React.Context<TreeSelectContextProps>; | ||
export default TreeSelectContext; |
@@ -49,3 +49,4 @@ "use strict"; | ||
dropdownMatchSelectWidth = _React$useContext.dropdownMatchSelectWidth, | ||
treeExpandAction = _React$useContext.treeExpandAction; | ||
treeExpandAction = _React$useContext.treeExpandAction, | ||
treeTitleRender = _React$useContext.treeTitleRender; | ||
var _React$useContext2 = React.useContext(_LegacyContext.default), | ||
@@ -252,3 +253,4 @@ checkable = _React$useContext2.checkable, | ||
selectedKeys: !checkable ? checkedKeys : [], | ||
defaultExpandAll: treeDefaultExpandAll | ||
defaultExpandAll: treeDefaultExpandAll, | ||
titleRender: treeTitleRender | ||
}, treeProps, { | ||
@@ -255,0 +257,0 @@ // Proxy event out |
@@ -107,2 +107,3 @@ import type { BaseSelectPropsWithoutPrivate, BaseSelectRef, SelectProps } from 'rc-select'; | ||
onDropdownVisibleChange?: (open: boolean) => void; | ||
treeTitleRender?: (node: ValueType) => React.ReactNode; | ||
treeLine?: boolean; | ||
@@ -109,0 +110,0 @@ treeIcon?: IconType; |
@@ -35,3 +35,3 @@ "use strict"; | ||
var _warningPropsUtil = _interopRequireDefault(require("./utils/warningPropsUtil")); | ||
var _excluded = ["id", "prefixCls", "value", "defaultValue", "onChange", "onSelect", "onDeselect", "searchValue", "inputValue", "onSearch", "autoClearSearchValue", "filterTreeNode", "treeNodeFilterProp", "showCheckedStrategy", "treeNodeLabelProp", "multiple", "treeCheckable", "treeCheckStrictly", "labelInValue", "fieldNames", "treeDataSimpleMode", "treeData", "children", "loadData", "treeLoadedKeys", "onTreeLoad", "treeDefaultExpandAll", "treeExpandedKeys", "treeDefaultExpandedKeys", "onTreeExpand", "treeExpandAction", "virtual", "listHeight", "listItemHeight", "listItemScrollOffset", "onDropdownVisibleChange", "dropdownMatchSelectWidth", "treeLine", "treeIcon", "showTreeIcon", "switcherIcon", "treeMotion"]; | ||
var _excluded = ["id", "prefixCls", "value", "defaultValue", "onChange", "onSelect", "onDeselect", "searchValue", "inputValue", "onSearch", "autoClearSearchValue", "filterTreeNode", "treeNodeFilterProp", "showCheckedStrategy", "treeNodeLabelProp", "multiple", "treeCheckable", "treeCheckStrictly", "labelInValue", "fieldNames", "treeDataSimpleMode", "treeData", "children", "loadData", "treeLoadedKeys", "onTreeLoad", "treeDefaultExpandAll", "treeExpandedKeys", "treeDefaultExpandedKeys", "onTreeExpand", "treeExpandAction", "virtual", "listHeight", "listItemHeight", "listItemScrollOffset", "onDropdownVisibleChange", "dropdownMatchSelectWidth", "treeLine", "treeIcon", "showTreeIcon", "switcherIcon", "treeMotion", "treeTitleRender"]; | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); } | ||
@@ -94,2 +94,3 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
treeMotion = props.treeMotion, | ||
treeTitleRender = props.treeTitleRender, | ||
restProps = (0, _objectWithoutProperties2.default)(props, _excluded); | ||
@@ -289,5 +290,12 @@ var mergedId = (0, _useId.default)(id); | ||
}); | ||
var label; | ||
// Ensure that when labelInValue is true, if label is undefined, it remains undefined. | ||
if (labelInValue && targetItem.label !== undefined) { | ||
label = targetItem.label; | ||
} else if (!labelInValue && treeTitleRender) { | ||
label = treeTitleRender(targetItem); | ||
} | ||
return { | ||
value: val, | ||
label: targetItem === null || targetItem === void 0 ? void 0 : targetItem.label | ||
label: label | ||
}; | ||
@@ -483,5 +491,6 @@ }); | ||
onSelect: onOptionSelect, | ||
treeExpandAction: treeExpandAction | ||
treeExpandAction: treeExpandAction, | ||
treeTitleRender: treeTitleRender | ||
}; | ||
}, [virtual, dropdownMatchSelectWidth, listHeight, listItemHeight, listItemScrollOffset, filteredTreeData, mergedFieldNames, onOptionSelect, treeExpandAction]); | ||
}, [virtual, dropdownMatchSelectWidth, listHeight, listItemHeight, listItemScrollOffset, filteredTreeData, mergedFieldNames, onOptionSelect, treeExpandAction, treeTitleRender]); | ||
@@ -488,0 +497,0 @@ // ======================= Legacy Context ======================= |
@@ -14,4 +14,5 @@ import * as React from 'react'; | ||
treeExpandAction?: ExpandAction; | ||
treeTitleRender?: (node: any) => React.ReactNode; | ||
} | ||
declare const TreeSelectContext: React.Context<TreeSelectContextProps>; | ||
export default TreeSelectContext; |
{ | ||
"name": "rc-tree-select", | ||
"version": "5.15.0", | ||
"version": "5.16.0", | ||
"description": "tree-select ui component for react", | ||
@@ -36,2 +36,3 @@ "keywords": [ | ||
"compile": "father build", | ||
"prepare": "dumi setup", | ||
"prepublishOnly": "npm run compile && np --yolo --no-publish --any-branch", | ||
@@ -52,2 +53,3 @@ "lint": "eslint src/ examples/ --ext .tsx,.ts,.jsx,.js", | ||
"@types/jest": "^26.0.5", | ||
"@types/node": "^20.9.0", | ||
"@types/react": "^16.8.19", | ||
@@ -58,3 +60,3 @@ "@types/react-dom": "^16.8.4", | ||
"cross-env": "^7.0.2", | ||
"dumi": "^1.1.12", | ||
"dumi": "^2.0.0", | ||
"enzyme": "^3.10.0", | ||
@@ -73,3 +75,3 @@ "enzyme-adapter-react-16": "^1.1.1", | ||
"react-dom": "^16.8.0", | ||
"typescript": "^3.5.2" | ||
"typescript": "^5.0.0" | ||
}, | ||
@@ -76,0 +78,0 @@ "dependencies": { |
160700
3159
25