-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[Menu] Flexify menu items #1136
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
Conversation
Update Classes.ts and usagePreview: documentation | table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
definitely going to need to add some docs about this... the MenuItem
API is unchanged as it automatically wraps text in this element, but we should note the HTML change somewhere
{labelElement} | ||
{this.props.text} | ||
<span className={Classes.MENU_ITEM_TEXT}>{this.props.text}</span> | ||
{label != null && <span className={Classes.MENU_ITEM_LABEL}>{label}</span>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in this codebase, we prefer to use ternary condition ? <el /> : undefined
instead of boolean coercion.
NOTE: this PR targets the |
Proper ternaryPreview: documentation | table |
* Don't show regions that aren't in the table * Add more tests, name variables * Fix indent * Update indentation
* Don't close popover if only the time changed * Add unit tests * Fix logic that's causing broken test * Oops, delete .only * Write a failing test for an edge-case * Fix the failing test * Clarify the boolean logic * Change !== to !=
* move empty content check from Tooltip to Popover * remove now unused things * add empty content option to Popover example
- Put dialog example first (_finally_...) - Document the default behavior correctly (`inline={false}` by default)
…place (#1154) * Clean up navbar styles, rename pages * Add sidebar to hold toggles eventually * Add toggle for ghost cells * Add toggle for 'Show focus cell', with slight refactors * Enable context menu * Enable full-table selection * Enable multiple selections * Enable row and column selection * Enable row and column resizing * Enable row and column reordering * Show column menus * Enable column name editing * Show inline, better styles * Change row and column counts * Make sidebar scrollable * Show row and column headers loading * Show row headers * Enable most features by default * Increase default row count * Show cells loading * Enable cell selection * Enable cell editing * Enable zebra striping * Custom regions * Better styles * Focus style control * Sync focus style on componentDidMount too
- Upgrade to Chai 4.0 to get includeDeepMembers assertion - Remove tests that were mostly tautological and relied on old lenient APIs
…component (#1140) * Write AbstractHeader and AbstractHeaderCell * Refactor RowHeader to extend from AbstractHeader * Move IColumnHeaderRenderer into columnHeader.tsx * Extend IHeaderProps in ColumnHeader * Refactor ColumnHeader to extend from AbstractHeader * Refactor {Row,Column}HeaderCell to extend from AbstractHeaderCell * Fix lint * Respond to self-CR feedback * Various cleanups - Reorder protected methods alphabetically - Delete unneeded onResizeGuide from IColumnHeaderProps - Rename handleDoubleClick to handleResizeHandleDoubleClick * Write abstractHeader2.tsx using composition this time * Use AbstractHeader2 in ColumnHeader2 and RowHeader2 * Make AbstractHeaderCell a component, not a superclass * Delete old inheritance-approach files * Fix file path references * Fix bug: pass classname to AbstractHeaderCell * Rename *2.tsx to *.tsx * Respond to self CR * Respond to Adi CR feedback * Rename to Header and HeaderCell * Spread props * Spread props in header cell components * Oops, add 'from'
* Rename perf.html, make it the home page for the table preview * Change page titles * Fix lint
…false (#1171) * Have focused cell follow selection if allowMultipleSelection=false * Add test * Fix broken test
* Move focus cell to (0,0) on FULL_TABLE selection * Add test
* Row => Rows * Fix name renderFocuStyleSelectMenu => renderFocusStyleSelectMenu * Fix console errors * Reorder stuff in the sidebar * Rename multi-selection option * Respond to Gilad CR feedback
Add support for a portal classname from the react context
* initial TagInput implementation * docs + polish * tests! sufficient coverage 👍 * move code to subdirectory, use "fake" names * add Tag active prop and .pt-active style support * left/right arrows to navigate through tags list and remove _any_ (not just last) * fix lint * refactor keyboard logic and introduce NONE constant * set explicit width to break long words * notes, remove commented code * 🌳 remove logs * rename dir to tag-input * add docs about keyboard interactions
…1239) * Have EditableCell fully control value in child EditableText * Respond to CR feedback * Add test
@llorca what's the story on this PR? |
@cmslewis I suspect it hasn't been looked at because it's not a priority. It's ready to go though, there's one question I want feedback on (see description) and I still need full review over code/docs/approach. |
* Add cell-content menu, refactor * Change cell content based on selection * Add option for long text * Delete 'Fill with random text' option * Use Utils.times instead of for loop * CR feedback * Respond to CR feedback * More CR feedback * Add basic truncation * Add default value for zebra striping to fix warning * Add select menu for truncated popover mode * Move to switch statement * Fix lint * Clearer [title] tooltip message * Show disabled child elements in sidebar, use Classes everywhere
* Add Utils.some * [Temporary] Change feature flags in Table example * Add new classes for reorder handle * Add ignoredSelector prop to DragSelectable * Add preliminary styles for reorder handle * Add reorder handle to column interaction bar * Ignore reorder handle selector * Reorder handle works * Renable drag-reordering on rows * Delete commented code * Show column grab cursor only over reorder handle * Move selection only if it existed before reorder * Don't disable drage selection for column headers * Different handle colors on :hover and :active * Delete console.logs * Select clicked handle's column if not selected * Reenable old reordering interaction if useInteractionBar={false} * Delete reorderHandle.tsx, put Orientation back in resizeHandle.tsx * Code cleanups * Rename to isEntireCellTargetReorderable * Delete orientation.ts * Have Header apply the TABLE_HEADER_REORDERABLE class * Reply to CR feedback * Fix tests * Write new tests, fix bug * Add deprecation warning to HeaderCell#isReorderable * Fix lint * Fix deprecation version * Fix deprecation message
`<thead>` can only have `<tr>` elements as children: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/thead
* Rename existing store * Add new store for dense grid * Column reordering works * Move column-reorder handling into store * Row reordering works * Fix bug with row-count changing, clean up code * Fix row and column counts * Delete commented code * Fix column-count updating * Have column names reorder along with column content * Fix editing of column names * Fix description for setOrderedColumnKeys * Fix row insertion
* passes all Tag props to its onRemove handler * PR feedback, renamed argument for clarity * Fixes lint
* Adds focus cell tab and enter microinteraction behavior * Comments, refactor common code * Add tests
* Add Utils.some * [Temporary] Change feature flags in Table example * Add new classes for reorder handle * Add ignoredSelector prop to DragSelectable * Add preliminary styles for reorder handle * Add reorder handle to column interaction bar * Ignore reorder handle selector * Reorder handle works * Renable drag-reordering on rows * Delete commented code * Show column grab cursor only over reorder handle * Move selection only if it existed before reorder * Don't disable drage selection for column headers * Different handle colors on :hover and :active * Delete console.logs * Select clicked handle's column if not selected * Reenable old reordering interaction if useInteractionBar={false} * Delete reorderHandle.tsx, put Orientation back in resizeHandle.tsx * Code cleanups * Rename to isEntireCellTargetReorderable * Delete orientation.ts * Have Header apply the TABLE_HEADER_REORDERABLE class * Reply to CR feedback * Fix tests * Write new tests, fix bug * Add deprecation warning to HeaderCell#isReorderable * Fix lint * Fix deprecation version * Fix deprecation message * Add reorderable example to site-docs
* Prepare Release 1.21.0 * [Table] Add docs about reorderable content (#1271) * Add Utils.some * [Temporary] Change feature flags in Table example * Add new classes for reorder handle * Add ignoredSelector prop to DragSelectable * Add preliminary styles for reorder handle * Add reorder handle to column interaction bar * Ignore reorder handle selector * Reorder handle works * Renable drag-reordering on rows * Delete commented code * Show column grab cursor only over reorder handle * Move selection only if it existed before reorder * Don't disable drage selection for column headers * Different handle colors on :hover and :active * Delete console.logs * Select clicked handle's column if not selected * Reenable old reordering interaction if useInteractionBar={false} * Delete reorderHandle.tsx, put Orientation back in resizeHandle.tsx * Code cleanups * Rename to isEntireCellTargetReorderable * Delete orientation.ts * Have Header apply the TABLE_HEADER_REORDERABLE class * Reply to CR feedback * Fix tests * Write new tests, fix bug * Add deprecation warning to HeaderCell#isReorderable * Fix lint * Fix deprecation version * Fix deprecation message * Add reorderable example to site-docs
* Add failing test * Use basic for loop to fix text * Change describe.only => describe
* Add and wire up the onVisibleCellsChange prop * Add tests * Invoke callback when grid changes also * Fix lint, tests * Expose rowIndices and columnIndices instead of four params * Add logger switch to table example * Fix lint * Fix lint again * Response to CR feedback
@llorca the optimal approach to me is to widen the menu to fit each item on one line provided there's enough horizontal space. But for a simple default, I'd prefer to see the full list item with line wrapping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving the code changes, but looks like we should still add documentation about the change before merging.
Docs added ✅ |
Add docs about new `pt-menu-item-text` classPreview: documentation | table |
Messed up branching -- gonna open a new PR. Sorry! |
Fixes #984
Changes proposed in this pull request:
Use flex for menu items for better truncation.
Screenshots
Menu items no longer truncate by default:

Menu items with buttons still work but no longer truncate:

For perfectly truncated one-liner menu items, a new class is now required for the menu item text itself (

span.pt-menu-item-text
):