-
Notifications
You must be signed in to change notification settings - Fork 140
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
fix(pro:search): name select label not rendering #1493
Changes from all commits
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 |
---|---|---|
|
@@ -7,8 +7,8 @@ title: | |
|
||
## zh | ||
|
||
`'select'`,`'treeSelect'` 类型搜索项支持服务端搜索。 | ||
`'select'`,`'treeSelect'`,`'cascader'` 类型搜索项支持服务端搜索。 | ||
|
||
## en | ||
|
||
Server-side searching is supported under field type of `'select'`, `'treeSelect'`. | ||
Server-side searching is supported under field type of `'select'`, `'treeSelect'`, `'cascader'`. | ||
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. the code review: This patch seems to be adding support for server-side searching for 'cascader' field type. The code looks correct, but it is best to add a unit test to ensure that the code works as expected. Additionally, it may be beneficial to add a comment before the code change to explain why the change was made and the purpose of the code. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,21 +35,18 @@ export function createNameSegment( | |
return | ||
} | ||
|
||
const renderNameLabel = (key: VKey, renderer?: (searchField: SearchField) => VNodeChild) => { | ||
if (!renderer) { | ||
return undefined | ||
} | ||
|
||
const renderNameLabel = (key: VKey, renderer: (searchField: SearchField) => VNodeChild) => { | ||
const searchField = searchFields!.find(field => field.key === key)! | ||
return renderer(searchField) | ||
} | ||
|
||
const _customNameLabel = customNameLabel ?? 'nameLabel' | ||
const customNameLabelRender = isString(_customNameLabel) ? slots[_customNameLabel] : _customNameLabel | ||
|
||
const panelSlots = { | ||
optionLabel: isString(_customNameLabel) | ||
? (option: SelectPanelData) => renderNameLabel(option.key, slots[_customNameLabel]) | ||
: (option: SelectPanelData) => renderNameLabel(option.key, _customNameLabel), | ||
optionLabel: customNameLabelRender | ||
? (option: SelectPanelData) => renderNameLabel(option.key, customNameLabelRender) | ||
: undefined, | ||
} | ||
|
||
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. the code review
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. the code review:
|
||
return ( | ||
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. ! Code Review :
Updated Code : const renderNameLabel = (key: VKey, renderer: (searchField: SearchField) => VNodeChild) => { const customNameLabelRender = customNameLabel && isString(customNameLabel) ? slots[customNameLabel] : customNameLabel const panelSlots = { return ( |
||
|
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.
the review:
The patch adds
'cascader'
to the list of supported field types. This should provide no risk, but it might be worth double-checking that the server-side search is properly implemented for this new field type.It would also be beneficial to provide an example of how to use this feature, as well as any potential limitations or caveats associated with its use.