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

refactor(components): refactor menu #3639

Merged
merged 31 commits into from
Sep 28, 2021
Merged

refactor(components): refactor menu #3639

merged 31 commits into from
Sep 28, 2021

Conversation

sxzz
Copy link
Collaborator

@sxzz sxzz commented Sep 25, 2021

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.

@sxzz sxzz marked this pull request as draft September 25, 2021 22:27
@sxzz sxzz force-pushed the refactor/menu branch 2 times, most recently from 65ffdef to 65bd98f Compare September 25, 2021 22:31
@element-bot
Copy link
Member

element-bot commented Sep 25, 2021

@sxzz sxzz force-pushed the refactor/menu branch 2 times, most recently from 8341c64 to 26b7a13 Compare September 26, 2021 18:17
@sxzz sxzz marked this pull request as ready for review September 27, 2021 19:45
@sxzz sxzz requested a review from a team September 27, 2021 19:45
@sxzz sxzz mentioned this pull request Sep 27, 2021
18 tasks
@jw-foss
Copy link
Member

jw-foss commented Sep 28, 2021

I'm looking into this now

@jw-foss jw-foss self-requested a review September 28, 2021 01:43
@jw-foss jw-foss added the Project::Enhancement New feature or request label Sep 28, 2021
setup() {
const instance = getCurrentInstance()!
const menu = inject<MenuProvider>('rootMenu')
if (!menu) throwError(COMPONENT_NAME, 'can not inject root menu')
Copy link
Member

Choose a reason for hiding this comment

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

Minor: I know this file wasn't originated from you, but the error message here is confusing we might need to change it to:

needs be nested under

Copy link
Member

Choose a reason for hiding this comment

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

We can always create a follow up issue for fixing.

},
} as BaseTransitionProps<HTMLElement> as TransitionProps
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@JeremyWuuuuu I added type here.

Comment on lines +21 to +22
click: (item: MenuItemRegistered) =>
isString(item.index) && Array.isArray(item.indexPath),
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need to implement the actual method here? Since I thought this should only be available for marking the type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is to validate the emit. Since I wrote it, just keep it, and it won't affect production.

Comment on lines +78 to +79
const rootMenu = inject<MenuProvider>('rootMenu')
if (!rootMenu) throwError(COMPONENT_NAME, 'can not inject root menu')
Copy link
Member

Choose a reason for hiding this comment

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

Non-blocking: Maybe we can make rootMenu a symbol as we did for elFormKey, and extract them into @element-plus/tokens

This can be changed in a followup PR. ;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I tried, but @element-plus/token build script seems broken. So I need fix build script first.

Copy link
Member

Choose a reason for hiding this comment

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

Then how did the forms and buttons working 😕

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Only God knows. 😕

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TypeScript emit errors.

Copy link
Member

@jw-foss jw-foss left a comment

Choose a reason for hiding this comment

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

I think for a best practice on Git we should not introduce irrelevant changes into this.

@jw-foss
Copy link
Member

jw-foss commented Sep 28, 2021

Most of my comments were not blocking but I think the changes against withFunctionInstall should go to a separate PR.

@sxzz
Copy link
Collaborator Author

sxzz commented Sep 28, 2021

@JeremyWuuuuu Done.

@jw-foss jw-foss merged commit c68d59c into dev Sep 28, 2021
@jw-foss jw-foss deleted the refactor/menu branch September 28, 2021 02:59
@element-bot element-bot mentioned this pull request Sep 28, 2021
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Project::Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants