@@ -2,6 +2,7 @@ import { useBaseProps } from 'rc-select';
2
2
import type { RefOptionListProps } from 'rc-select/lib/OptionList' ;
3
3
import type { TreeProps } from 'rc-tree' ;
4
4
import Tree from 'rc-tree' ;
5
+ import { InternalContext } from 'rc-tree' ;
5
6
import type { EventDataNode , ScrollTo } from 'rc-tree/lib/interface' ;
6
7
import KeyCode from 'rc-util/lib/KeyCode' ;
7
8
import useMemo from 'rc-util/lib/hooks/useMemo' ;
@@ -158,8 +159,7 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
158
159
// eslint-disable-next-line react-hooks/exhaustive-deps
159
160
} , [ searchValue ] ) ;
160
161
161
- // >>> Disabled Strategy
162
- const disabledStrategy = ( node : DataNode ) => {
162
+ const nodeDisabled = ( node : DataNode ) => {
163
163
if ( isOverMaxCount ) {
164
164
const selectedValues = memoDisplayValues ;
165
165
if ( ! selectedValues . includes ( node [ fieldNames . value ] ) ) {
@@ -342,43 +342,43 @@ const OptionList: React.ForwardRefRenderFunction<ReviseRefOptionListProps> = (_,
342
342
{ activeEntity . node . value }
343
343
</ span >
344
344
) }
345
-
346
- < Tree
347
- ref = { treeRef }
348
- focusable = { false }
349
- prefixCls = { `${ prefixCls } -tree` }
350
- treeData = { memoTreeData }
351
- height = { listHeight }
352
- itemHeight = { listItemHeight }
353
- itemScrollOffset = { listItemScrollOffset }
354
- virtual = { virtual !== false && dropdownMatchSelectWidth !== false }
355
- multiple = { multiple }
356
- icon = { treeIcon }
357
- showIcon = { showTreeIcon }
358
- switcherIcon = { switcherIcon }
359
- showLine = { treeLine }
360
- loadData = { syncLoadData }
361
- motion = { treeMotion }
362
- activeKey = { activeKey }
363
- // We handle keys by out instead tree self
364
- checkable = { checkable }
365
- checkStrictly
366
- checkedKeys = { mergedCheckedKeys }
367
- selectedKeys = { ! checkable ? checkedKeys : [ ] }
368
- defaultExpandAll = { treeDefaultExpandAll }
369
- titleRender = { treeTitleRender }
370
- { ...treeProps }
371
- // Proxy event out
372
- onActiveChange = { setActiveKey }
373
- onSelect = { onInternalSelect }
374
- onCheck = { onInternalSelect }
375
- onExpand = { onInternalExpand }
376
- onLoad = { onTreeLoad }
377
- filterTreeNode = { filterTreeNode }
378
- expandAction = { treeExpandAction }
379
- onScroll = { onPopupScroll }
380
- disabledStrategy = { disabledStrategy }
381
- / >
345
+ < InternalContext . Provider value = { { nodeDisabled } } >
346
+ < Tree
347
+ ref = { treeRef }
348
+ focusable = { false }
349
+ prefixCls = { `${ prefixCls } -tree` }
350
+ treeData = { memoTreeData }
351
+ height = { listHeight }
352
+ itemHeight = { listItemHeight }
353
+ itemScrollOffset = { listItemScrollOffset }
354
+ virtual = { virtual !== false && dropdownMatchSelectWidth !== false }
355
+ multiple = { multiple }
356
+ icon = { treeIcon }
357
+ showIcon = { showTreeIcon }
358
+ switcherIcon = { switcherIcon }
359
+ showLine = { treeLine }
360
+ loadData = { syncLoadData }
361
+ motion = { treeMotion }
362
+ activeKey = { activeKey }
363
+ // We handle keys by out instead tree self
364
+ checkable = { checkable }
365
+ checkStrictly
366
+ checkedKeys = { mergedCheckedKeys }
367
+ selectedKeys = { ! checkable ? checkedKeys : [ ] }
368
+ defaultExpandAll = { treeDefaultExpandAll }
369
+ titleRender = { treeTitleRender }
370
+ { ...treeProps }
371
+ // Proxy event out
372
+ onActiveChange = { setActiveKey }
373
+ onSelect = { onInternalSelect }
374
+ onCheck = { onInternalSelect }
375
+ onExpand = { onInternalExpand }
376
+ onLoad = { onTreeLoad }
377
+ filterTreeNode = { filterTreeNode }
378
+ expandAction = { treeExpandAction }
379
+ onScroll = { onPopupScroll }
380
+ />
381
+ </ InternalContext . Provider >
382
382
</ div >
383
383
) ;
384
384
} ;
0 commit comments