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

feat(Table) : adding context menu for table row to example and prototype #12253

Merged
merged 7 commits into from
Mar 12, 2020
Merged

feat(Table) : adding context menu for table row to example and prototype #12253

merged 7 commits into from
Mar 12, 2020

Conversation

kolaps33
Copy link
Contributor

@kolaps33 kolaps33 commented Mar 10, 2020

Pull request checklist

  • Addresses an existing issue: Fixes #0000

Description of changes

Adding usage of context menu for table row.

Focus areas to test

Added into:

  • table USAGE, into the table "Nested navigation in table by row and cell"
  • table prototype, into the table "Table with popover and context menu"
Microsoft Reviewers: Open in CodeFlow

@size-auditor
Copy link

size-auditor bot commented Mar 10, 2020

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: fd45f9cd4a8649a2f39f5af5829a91ce6c649f00 (build)

@msft-github-bot
Copy link
Contributor

msft-github-bot commented Mar 10, 2020

Perf Analysis

No significant results to display.

All results

Scenario Master Ticks PR Ticks Status
BaseButton 730 675
BaseButton (experiments) 886 839
DefaultButton 945 939
DefaultButton (experiments) 1844 1757
DetailsRow 3213 3215
DetailsRow (fast icons) 3177 3260
DetailsRow without styles 3036 2981
DocumentCardTitle with truncation 1586 1560
MenuButton 1224 1293
MenuButton (experiments) 3314 3302
PrimaryButton 1151 1087
PrimaryButton (experiments) 1799 1897
SplitButton 2667 2698
SplitButton (experiments) 6645 6569
Stack 433 422
Stack with Intrinsic children 1007 1024
Stack with Text children 3747 3784
Text 337 342
Toggle 802 743
Toggle (experiments) 2043 2065
button 80 65

Perf Analysis (Fluent)

Perf comparison
Status Scenario Fluent TPI Fabric TPI Ratio Iterations Ticks
🔧 Avatar.Fluent 0.54 0.47 1.15:1 2000 1075
🎯 Button.Fluent 0.16 0.22 0.73:1 1000 164
🔧 Checkbox.Fluent 0.76 0.4 1.9:1 1000 760
🔧 Dialog.Fluent 0.39 0.22 1.77:1 5000 1936
🔧 Dropdown.Fluent 3.7 0.49 7.55:1 1000 3695
🔧 Icon.Fluent 0.17 0.05 3.4:1 5000 854
🎯 Image.Fluent 0.07 0.1 0.7:1 5000 337
🔧 Slider.Fluent 1.64 0.41 4:1 1000 1643
🔧 Text.Fluent 0.08 0.02 4:1 5000 385
🦄 Tooltip.Fluent 0.12 17.74 0.01:1 5000 610

🔧 Needs work     🎯 On target     🦄 Amazing

Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
Button.Fluent 164 144 1.14:1
AvatarMinimalPerf.default 594 546 1.09:1
ChatDuplicateMessagesPerf.default 456 427 1.07:1
Icon.Fluent 854 804 1.06:1
ButtonMinimalPerf.default 151 144 1.05:1
ButtonSlotsPerf.default 775 738 1.05:1
FormMinimalPerf.default 976 929 1.05:1
InputMinimalPerf.default 1121 1064 1.05:1
LayoutMinimalPerf.default 689 654 1.05:1
ListCommonPerf.default 1040 993 1.05:1
Slider.Fluent 1643 1563 1.05:1
ListNestedPerf.default 963 922 1.04:1
Checkbox.Fluent 760 731 1.04:1
AttachmentSlotsPerf.default 3814 3695 1.03:1
EmbedMinimalPerf.default 5753 5612 1.03:1
IconMinimalPerf.default 415 404 1.03:1
ListMinimalPerf.default 428 414 1.03:1
MenuButtonMinimalPerf.default 1595 1548 1.03:1
SliderMinimalPerf.default 1612 1572 1.03:1
TableMinimalPerf.default 650 630 1.03:1
TextAreaMinimalPerf.default 3273 3184 1.03:1
Avatar.Fluent 1075 1044 1.03:1
ChatMinimalPerf.default 584 571 1.02:1
CheckboxMinimalPerf.default 3368 3305 1.02:1
DividerMinimalPerf.default 978 960 1.02:1
ProviderMinimalPerf.default 649 634 1.02:1
ReactionMinimalPerf.default 2567 2515 1.02:1
RefMinimalPerf.default 206 201 1.02:1
TreeMinimalPerf.default 1176 1157 1.02:1
Tooltip.Fluent 610 600 1.02:1
HierarchicalTreeMinimalPerf.default 1049 1034 1.01:1
ListWith60ListItems.default 197 195 1.01:1
LoaderMinimalPerf.default 1112 1098 1.01:1
ProviderMergeThemesPerf.default 1388 1376 1.01:1
RadioGroupMinimalPerf.default 527 522 1.01:1
ToolbarMinimalPerf.default 1127 1117 1.01:1
TooltipMinimalPerf.default 890 878 1.01:1
VideoMinimalPerf.default 870 859 1.01:1
AlertMinimalPerf.default 631 629 1:1
ChatWithPopoverPerf.default 608 608 1:1
GridMinimalPerf.default 859 861 1:1
ItemLayoutMinimalPerf.default 2089 2086 1:1
LabelMinimalPerf.default 364 363 1:1
MenuMinimalPerf.default 2063 2058 1:1
SplitButtonMinimalPerf.default 12832 12804 1:1
StatusMinimalPerf.default 337 337 1:1
CustomToolbarPrototype.default 3767 3779 1:1
Dropdown.Fluent 3695 3678 1:1
AnimationMinimalPerf.default 615 622 0.99:1
CarouselMinimalPerf.default 2078 2098 0.99:1
DropdownMinimalPerf.default 3708 3737 0.99:1
FlexMinimalPerf.default 258 260 0.99:1
HeaderMinimalPerf.default 552 560 0.99:1
Dialog.Fluent 1936 1963 0.99:1
DialogMinimalPerf.default 1990 2040 0.98:1
ImageMinimalPerf.default 317 325 0.98:1
PortalMinimalPerf.default 289 296 0.98:1
SegmentMinimalPerf.default 1076 1103 0.98:1
AttachmentMinimalPerf.default 958 984 0.97:1
DropdownManyItemsPerf.default 353 363 0.97:1
PopupMinimalPerf.default 252 260 0.97:1
TreeWith60ListItems.default 231 238 0.97:1
Text.Fluent 385 397 0.97:1
HeaderSlotsPerf.default 1648 1717 0.96:1
TextMinimalPerf.default 352 365 0.96:1
Image.Fluent 337 351 0.96:1
AccordionMinimalPerf.default 242 255 0.95:1
BoxMinimalPerf.default 324 353 0.92:1

@@ -10,6 +19,10 @@ const InteractiveTable = () => {
setPopupOpen(false);
};

const contextMenuItems = ['Add to selection', 'Remove', 'Download'];

const getRowWithContextMenu = tableRow => <MenuButton contextMenu trigger={tableRow} menu={contextMenuItems} />;
Copy link
Contributor

Choose a reason for hiding this comment

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

I would rename this to just withContextMenu

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done :)

packages/fluentui/CHANGELOG.md Outdated Show resolved Hide resolved
@@ -54,7 +56,8 @@ const rowsPlain = [
moreOptionCell
],
onClick: () => handleRowClick(1),
'aria-labelledby': 'name-1 age-1'
'aria-labelledby': 'name-1 age-1',
children: (Component, props) => <MenuButton menu={contextMenuItems} contextMenu trigger={<Component {...props} />} />
Copy link
Member

Choose a reason for hiding this comment

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

I think that this will produce a key error in console as key will be still on a row. The change below will move it to a proper component.

Suggested change
children: (Component, props) => <MenuButton menu={contextMenuItems} contextMenu trigger={<Component {...props} />} />
children: (Component, { key, ...rest }) => <MenuButton menu={contextMenuItems} key={key} contextMenu trigger={<Component {...rest} />} />

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed :)

</Table.Row>
{withContextMenu(
<Table.Row key="1" accessibility={gridRowBehavior}>
<Table.Cell content="1" key="1-1" accessibility={gridCellBehavior} />
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<Table.Cell content="1" key="1-1" accessibility={gridCellBehavior} />
<Table.Cell content="1" accessibility={gridCellBehavior} />

key here and on all other Table.Cell and Table.Roe is redundant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed :)

<Table.Cell content="30000000000000 years" key="1-4" accessibility={gridCellBehavior} />
</Table.Row>
{withContextMenu(
<Table.Row key="1" accessibility={gridRowBehavior}>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<Table.Row key="1" accessibility={gridRowBehavior}>
<Table.Row accessibility={gridRowBehavior}>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed :)

moreActionCell,
moreOptionCell
moreActionCell('1-5'),
moreOptionCell('1-6')
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer an approach with spread:

Suggested change
moreOptionCell('1-6')
{ key: '1-6', ...moreOptionCell },

But it's not blocking

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed :)

@kolaps33 kolaps33 merged commit 2d7d926 into microsoft:master Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fluent UI react-northstar (v0) Work related to Fluent UI V0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants