Skip to content
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(amis): NestedSelect 级联选择器搜索高亮逻辑重构 #6679

Merged
merged 4 commits into from
Apr 23, 2023

Conversation

wibetter
Copy link
Collaborator

@wibetter wibetter commented Apr 21, 2023

What

🤖 Generated by Copilot at 859466e

This pull request adds a new feature to the NestedSelect component that allows users to see the keyword they searched for highlighted in the option labels. It also refactors some existing code to improve readability and quality. The main changes are in the dom.tsx, NestedSelect.tsx, and base/_common.scss files.

🤖 Generated by Copilot at 859466e

We render the text by keyword
We highlight the span with .is-keyword
We calculate the position with ease
We dominate the NestedSelect with our skills

Why

How

🤖 Generated by Copilot at 859466e

  • Add keyword highlighting feature for NestedSelect component (link, link, link, link)
  • Simplify and format code in dom.tsx (link, link, link)
  • Assign default value to inputValue variable in NestedSelect.tsx (link)

@wibetter wibetter requested review from nwind and 2betop April 21, 2023 10:22
@github-actions github-actions bot added the fix label Apr 21, 2023
@github-actions
Copy link

👍 Thanks for this!
🏷 I have applied any labels matching special text in your issue.

Please review the labels and make any necessary changes.


/** 根据关键字高亮显示文本内容 */
export function renderTextByKeyword(rendererText: string, curKeyword: string) {
if (curKeyword && ~rendererText.indexOf(curKeyword)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

考虑一下多个匹配的情况

@wibetter wibetter requested a review from igrowp April 23, 2023 06:55
@wibetter wibetter merged commit 4a89b2c into baidu:master Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants