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

feat: select弹框长度&nestSelect的弹框长度&文本优化 #6623

Merged
merged 1 commit into from
May 12, 2023

Conversation

sqzhou
Copy link
Collaborator

@sqzhou sqzhou commented Apr 14, 2023

What

🤖 Generated by Copilot at 36d78a4

This pull request enhances the nested select and select components in the form module by improving their styles and functionality. It adds tooltips, adjusts widths, and refactors some code in NestedSelect.tsx and _nested-select.scss. It also sets a minimum width for the select control in _select.scss.

🤖 Generated by Copilot at 36d78a4

NestedSelect styled
Better width and tooltips
Autumn leaves no wrap

Why

How

🤖 Generated by Copilot at 36d78a4

  • Add a minimum width of 100px to the select and nested select controls to avoid text cut-off (link, link)
  • Add a white-space: nowrap property to the nested select option to prevent text wrapping (link)
  • Import the getTreeDepth function from the utils file in NestedSelect.tsx to calculate the menu width based on the tree depth (link)
  • Declare and assign two properties to store the reference and the width of the outer div element of the nested select control in NestedSelect.tsx (link, link)
  • Add a title attribute to the span element that renders the selected value label in NestedSelect.tsx to show the full path of the selected option as a tooltip (link, link)
  • Add a new method getMenuSelectMenuStyle in NestedSelect.tsx to return a style object that sets the width of each menu based on the control width and the tree depth (link)
  • Add a style attribute to the div elements that render the menus in NestedSelect.tsx to apply the getMenuSelectMenuStyle method result as the inline style (link, link)
  • Add a title attribute to the div elements that render the options in NestedSelect.tsx to show the full option label as a tooltip (link, link)
  • Add a ref attribute to the div element that wraps the nested select control in NestedSelect.tsx to assign the outTarget property as the reference to the element (link)

@github-actions github-actions bot added the feat label Apr 14, 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.

const depth = getTreeDepth(options);
let style = {};
if (width) {
style = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

这是要达到一个什么效果?能否不用内联样式实现?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

这个主要是通过计算nestSelect最深的层级,来设置nestSelect每个弹框的长度

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

这样就算nestselect选到最深,也能和输入框长度一致

@hsm-lv hsm-lv merged commit 4c92f35 into baidu:master May 12, 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