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

[EuiSelectable] Add configurable truncation #7388

Merged
merged 11 commits into from
Nov 29, 2023

Commits on Nov 25, 2023

  1. [docs] Set up basic truncation demo

    - documentating `textWrap` for now, will also demo `truncationProps` once we add that
    cee-chen committed Nov 25, 2023
    Configuration menu
    Copy the full SHA
    e942628 View commit details
    Browse the repository at this point in the history
  2. Set up logic for rendering truncated vs non-truncated text

    + add logic for conditionally rendering `<EuiHighlight>` if no search is present (removes a `<span>` wrapper and extra logic)
    
    + add tests
    cee-chen committed Nov 25, 2023
    Configuration menu
    Copy the full SHA
    b6c51af View commit details
    Browse the repository at this point in the history
  3. [optional] Allow configuring textWrap per-option

    not super sure how useful this is, since it requires virtualization to be off, but I want this API to match the upcoming `truncationProps`
    cee-chen committed Nov 25, 2023
    Configuration menu
    Copy the full SHA
    fff157a View commit details
    Browse the repository at this point in the history
  4. Add truncationProps configuration

    + configurable at the option level as well
    
    + bonus grammar/link fix on combobox truncationProps docs
    cee-chen committed Nov 25, 2023
    Configuration menu
    Copy the full SHA
    3dafd5b View commit details
    Browse the repository at this point in the history
  5. [docs] Add truncation props configuration

    + fix broken link on combobox page
    cee-chen committed Nov 25, 2023
    Configuration menu
    Copy the full SHA
    09cfbfd View commit details
    Browse the repository at this point in the history
  6. [setup] Add a data attr to text truncate components w/ resize obser…

    …vers
    
    - to help analyze downstream component performance
    cee-chen committed Nov 25, 2023
    Configuration menu
    Copy the full SHA
    d815cdb View commit details
    Browse the repository at this point in the history
  7. [workaround] Fix bizarre cross-browser issue where truncation calcula…

    …tion is slightly off
    
    the `width` is correct but canvas's `measureText` API is off very slightly on mount for some very frustrating reason
    
    the best solution/workaround I came up with was adding a configurable tick/wait (and yes, 1 doesn't work either, has to be 2 for EuiSelectable :/)
    cee-chen committed Nov 25, 2023
    Configuration menu
    Copy the full SHA
    5a1fe1b View commit details
    Browse the repository at this point in the history
  8. [perf] Reduce individual resize observer instantiations for each trun…

    …cated line
    
    - by using `EuiAutoSizer` and attempting to guesstimate the default available width for options that don't have custom `append` or `prepend` nodes
    
    [cleanup] Move several `options` based vars to state, to more explicitly limit the amount of times they fire/cause rerenders
    
    + fix `EuiAutoSizer` test mock to fire `onResize` on mount (same behavior as actual prod)
    cee-chen committed Nov 25, 2023
    Configuration menu
    Copy the full SHA
    0a58bd8 View commit details
    Browse the repository at this point in the history
  9. Add E2E Cypress specs

    - some tests copied from EuiComboBox, but EuiSelectable also has extra affordances that need to be tested for (resizing etc)
    cee-chen committed Nov 25, 2023
    Configuration menu
    Copy the full SHA
    901c697 View commit details
    Browse the repository at this point in the history
  10. changelog

    cee-chen committed Nov 25, 2023
    Configuration menu
    Copy the full SHA
    cc72686 View commit details
    Browse the repository at this point in the history

Commits on Nov 29, 2023

  1. [PR feedback] DRYing

    Co-authored-by: Tomasz Kajtoch <tomek@kajto.ch>
    cee-chen and tkajtoch authored Nov 29, 2023
    Configuration menu
    Copy the full SHA
    6cef78b View commit details
    Browse the repository at this point in the history