UiComponent#56555
Merged
streamich merged 12 commits intoelastic:masterfrom Feb 5, 2020
streamich:ui-component
Merged
Conversation
Contributor
|
Pinging @elastic/kibana-app-arch (Team:AppArch) |
Contributor
Author
|
@elasticmachine merge upstream |
stacey-gammon
approved these changes
Feb 3, 2020
src/plugins/ui_actions/public/context_menu/build_eui_context_menu_panels.tsx
Show resolved
Hide resolved
mattkime
reviewed
Feb 3, 2020
|
|
||
| export * from './defer'; | ||
| export * from './of'; | ||
| export * from './ui'; |
Contributor
There was a problem hiding this comment.
nit: would prefer explicit exports
Contributor
|
I've read through the code buy should probably talk to @streamich to make sure my understanding of the code is correct. I'm a little fuzzy on why the interfaces are configured as they are although I see what they do. |
mattkime
approved these changes
Feb 4, 2020
Contributor
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
streamich
added a commit
that referenced
this pull request
Feb 6, 2020
* UiComponent (#56555) * feat: 🎸 add UiComponent and adapters * feat: 🎸 improve UiComponent * feat: 🎸 add MenuItem to IAction * test: 💍 add uiToReactComponent() tests * test: 💍 add reactToUiComponent() tests * feat: 🎸 allow specifying wrapper tag in uiToReactComponent() * style: 💄 format according to ESLint * docs: ✏️ improve JSDocs Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Matthew Kime <matt@mattki.me> * chore: 🤖 remove missing exports * style: add comma Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Matthew Kime <matt@mattki.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
UiComponentinterface.uiToReactComponentfunction.reactToUiComponentfunction.IActionto render arbitrary HTML in context menu.Run embeddable test samples:
Open context menu, see
secretbadge next toHello world!action:This will also allow us to render
Editbutton in drilldowns:Dev Docs
UiComponentinterface was added tokibana_utilsplugin.UiComponentrepresents a user interface building block, like a React component, butUiComponentdoes not have to be implemented in React—it can be implemented in plain JS or React, or Angular, etc.In many places in Kibana we want to be agnostic to frontend view library, i.e. instead of exposing React-specific APIs we want to expose APIs that are orthogonal to any rendering library.
UiComponentinterface represents such UI components. UI component receives a DOM element andpropsthroughrender()method, therender()method can be called many times.Although Kibana aims to be library agnostic, Kibana itself is written in React, therefore
UiComponentis designed such that it maps directly to a functional React component:UiCompnentinterface corresponds toReact.ComponentTypetype andUiCompnentprops map to React component props.To help use
UiComponentinterface in the codebaseuiToReactComponentandreactToUiComponenthelper functions were added tokibana_reactplugin, they transform aUiComponentinto a React component and vice versa, respectively.