Repository navigation
feat: Cascader.Panel support default expand cells #515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
bf253d7
f18f6f3
99e1125
fdcadbb
fc2bc36
5966e56
cecd044
b854548
6765c25
a438e92
a75df6f
7ed02d2
7dc164c
ce2e86e
273f613
2ad949e
e1a0426
0d4290e
67cef8a
07f5596
6c5c1c5
3f03912
f0c9f4c
0b2c795
e83b662
be8679f
bee7389
fa3d22e
7c7f117
5e15a6c
19823ee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,10 +22,10 @@ import useKeyboard from './useKeyboard'; | |
| export type RawOptionListProps = Pick< | ||
| ReturnType<typeof useBaseProps>, | ||
| 'prefixCls' | 'multiple' | 'searchValue' | 'toggleOpen' | 'notFoundContent' | 'direction' | 'open' | ||
| >; | ||
| > & { defaultActiveValueCells?: React.Key[]; }; | ||
|
|
||
| const RawOptionList = React.forwardRef<RefOptionListProps, RawOptionListProps>((props, ref) => { | ||
| const { prefixCls, multiple, searchValue, toggleOpen, notFoundContent, direction, open } = props; | ||
| const { prefixCls, multiple, searchValue, toggleOpen, notFoundContent, direction, open, defaultActiveValueCells } = props; | ||
|
|
||
| const containerRef = React.useRef<HTMLDivElement>(null); | ||
| const rtl = direction === 'rtl'; | ||
|
|
@@ -99,6 +99,12 @@ const RawOptionList = React.forwardRef<RefOptionListProps, RawOptionListProps>(( | |
| internalLoadData(nextValueCells); | ||
| }; | ||
|
|
||
| React.useEffect(() => { | ||
| if (defaultActiveValueCells && defaultActiveValueCells?.length > 0) { | ||
| setActiveValueCells(defaultActiveValueCells) | ||
| } | ||
| }, [defaultActiveValueCells]); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不能用 effect,
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
已改 0b2c795 |
||
|
|
||
| const isSelectable = (option: DefaultOptionType) => { | ||
| const { disabled } = option; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个名字改一下?active value cells 是内部命名。如果是要默认展开的话最好是
defaultActiveKey: Key[]