mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Closes https://github.com/elastic/kibana/issues/190379 ## Summary This PR switches the example grid layout app to render embeddables as panels rather than the simplified mock panel we were using previously. In doing so, I had to add the ability for custom panels to add a custom drag handle via the `renderPanelContents` callback - this required adding a `setDragHandles` callback to the `ReactEmbeddableRenderer` that could be passed down to the `PresentationPanel` component. https://github.com/user-attachments/assets/9e2c68f9-34af-4360-a978-9113701a5ea2 #### New scroll behaviour In https://github.com/elastic/kibana/pull/201867, I introduced a small "ease" to the auto-scroll effect that happens when you drag a panel to the top or bottom of the window. However, in that PR, I was using the `smooth` scrolling behaviour, which unfortunately became **very** jittery once I switched to embeddables rather than simple panels (specifically in Chrome - it worked fine in Firefox). The only way to prevent this jittery scroll was to switch to the default scroll behaviour, but this lead to a very **abrupt** stop when the scrollbar reached the top and/or bottom of the page - so, to give the same "gentle" stop that the `smooth` scroll had, I decided to recreate this effect by adding a slow down "ease" when close to the top or bottom of the page: https://github.com/user-attachments/assets/cb7bf03f-4a9e-4446-be4f-8f54c0bc88ac This effect is accomplished via the parabola formula `y = a(x-h)2 + k` and can be roughly visualized with the following, which shows that the "speed up" ease happens at a much slower pace than the "slow down" ease:  #### Notes about parent changes As I investigated improving the efficiency of the grid layout with embeddables, one of the main things I noticed was that the grid panel was **always** remounted when moving a panel from one collapsible section to another. This lead me (and @ThomThomson) down a rabbit hole of React-reparenting, and we explored a few different options to see if we could change the parent of a component **without** having it remount. In summary, after various experiments and a whole bunch of research, we determined that, due to the reconciliation of the React tree, this is unfortunately impossible. So our priorities will instead have to move to making the remount of `ReactEmbeddableRenderer` **as efficient as possible** via caching, since the remount is inevitable. ### Checklist - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks There are no risks to this PR, since the most significant work is contained in the `examples` plugin. Some changes were made to the presentation panel to allow for custom drag handles, but this isn't actually used in Dashboard - so for now, this code is only called in the example plugin, as well. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> |
||
---|---|---|
.. | ||
bfetch_explorer | ||
content_management_examples | ||
controls_example | ||
data_view_field_editor_example | ||
developer_examples | ||
discover_customization_examples | ||
embeddable_examples | ||
error_boundary | ||
eso_model_version_example | ||
esql_ast_inspector | ||
esql_validation_example | ||
expressions_explorer | ||
feature_control_examples | ||
feature_flags_example | ||
field_formats_example | ||
files_example | ||
grid_example | ||
guided_onboarding_example | ||
hello_world | ||
locator_examples | ||
locator_explorer | ||
partial_results_example | ||
portable_dashboards_example | ||
preboot_example | ||
resizable_layout_examples | ||
response_stream | ||
routing_example | ||
screenshot_mode_example | ||
search_examples | ||
share_examples | ||
state_containers_examples | ||
ui_action_examples | ||
ui_actions_explorer | ||
unified_doc_viewer | ||
unified_field_list_examples | ||
user_profile_examples | ||
v8_profiler_examples | ||
README.asciidoc |
[[example-plugins]] == Example plugins This folder contains example plugins. To run the plugins in this folder, use the `--run-examples` flag (without a basepath), via [source,bash] ---- yarn start --run-examples ----