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(components): [select-v2] add props attribute #14536

Merged
merged 4 commits into from
Oct 25, 2023

Conversation

tolking
Copy link
Member

@tolking tolking commented Oct 13, 2023

This is a replica of #9817. related with #13263. close #11088

after

Please make sure these boxes are checked before submitting your PR, thank you!

  • Make sure you follow contributing guide English | (中文 | Español | Français).
  • Make sure you are merging your commits to dev branch.
  • Add some descriptions and refer to relative issues for your PR.

Description

🤖 Generated by Copilot at a63f47a

This pull request adds a new feature to the SelectV2 component that allows users to customize the alias of the options sub-attributes (value, label, and disabled) using the props attribute. It also refactors the select-v2 component and its sub-components to use common utilities and hooks to handle the custom alias and improve the type inference and readability. It updates the documentation and the examples to reflect the new feature. It also simplifies some types and removes some redundant code.

Related Issue

Fixes #___.

Explanation of Changes

🤖 Generated by Copilot at a63f47a

  • Add props attribute to SelectV2 component to customize the alias of the options sub-attributes (link, link, link, link)
  • Use useProps hook to access the options data using the custom alias in various functions and components (link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link)
  • Use getValueKey function to generate unique keys for the options using the custom alias of the value attribute (link, link, link, link, link)
  • Simplify Option type to extend Record<string, any> and remove OptionCommon and OptionGroup types (link, link, link)
  • Use buildProps utility to wrap the SelectProps and OptionProps objects and improve type inference and readability (link)
  • Use iconPropType utility for the clearIcon prop type (link)
  • Use definePropType utility for the modelValue, options, and popperOptions prop types (link, link, link)
  • Use useSizeProp hook for the size prop instead of the custom validator (link, link)
  • Replace flattenOptions function with a reduce method to add a title and a group type for each option group (link)
  • Use String constructor instead of toString method to avoid potential errors when the value is null or undefined (link, link)
  • Remove getLabel function from useSelect as it is redundant with the useProps hook (link)
  • Add docs/examples/select-v2/props.vue file to show an example of using the props attribute (link)
  • Update docs/en-US/component/select-v2.md file to reflect the changes and add the props table (link, link)
  • Delete packages/components/select-v2/src/util.ts file as it is no longer needed (link)

@github-actions
Copy link

github-actions bot commented Oct 13, 2023

@github-actions github-actions bot added the CommitMessage::Qualified Qualified commit message label Oct 13, 2023
@github-actions
Copy link

github-actions bot commented Oct 13, 2023

🧪 Playground Preview: https://element-plus.run/?pr=14536
Please comment the example via this playground if needed.

@tolking tolking requested a review from btea October 13, 2023 07:28
docs/en-US/component/select-v2.md Outdated Show resolved Hide resolved
docs/en-US/component/select-v2.md Show resolved Hide resolved
@tolking tolking merged commit 941966f into dev Oct 25, 2023
10 checks passed
@tolking tolking deleted the feat/select-v2-props-attr branch October 25, 2023 12:33
@element-bot element-bot mentioned this pull request Nov 3, 2023
3 tasks
consultation-applio pushed a commit to consultation-applio/element-plus that referenced this pull request Nov 10, 2023
* feat(components): [select-v2] add props attribute

* docs: updata

* docs: updata

* docs: updata
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CommitMessage::Qualified Qualified commit message
Projects
None yet
2 participants