Skip to content

Conversation

@joshualamusga1
Copy link
Contributor

Cherrypicking this PR to version 7. Necessary to complete an a11y scenario. Original PR description below.

Pull request checklist

Description of changes

Adds proportional columns in DetailsList. They skip initial layout, so cannot be used with skipViewportMeasures. Here's how it works:

  • viewport width is measured and maxWidth || minWidth is subtracted for each fixed column
  • minWidth is subtracted for each proportional column
  • column paddings and grouplist indent / select checkbox row column width is subtracted appropriately
  • 32 pixels is subtracted to account for rapid layout changes or the presence of a vertical scrollbar
  • the remaining extra width is divided by the sum of each column's proportional value (called width fraction)
  • each column gets extra width equal to the width fraction * that column's proportional value
  • if a column hits maxWidth before using all its allotted extra width, that's redistributed to remaining proportional columns

This also allows rendering custom column header content in place of normal text. This only affects the text, so you can still have a sort icon, the bar that appears between columns when moving them will still show up, etc. There was previously no decent way of changing the header content for a DetailsList column header.

Both of these changes are required by my team's design. Topic opened earlier today at #16872

Example of proportional columns with spacing of 1, 1, 2:
image

Example with proportional spacing of 1 and 2 with a non-proportional middle column of minWidth 100:
image

Example of button rendered in custom header:
image

Focus areas to test

DetailsList

* Allows DetailsList to render custom content in header cells, and makes columns respect proportional dimensions. They size to at least minWidth, then expand according to available space and their relative proportions.
@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 26, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 159bf25:

Sandbox Source
Fluent UI Button Configuration
codesandbox-react-template Configuration

@size-auditor
Copy link

size-auditor bot commented Apr 26, 2021

Asset size changes

Project Bundle Baseline Size New Size Difference
office-ui-fabric-react office-ui-fabric-react-ShimmeredDetailsList 227.169 kB 228.071 kB ExceedsBaseline     902 bytes
office-ui-fabric-react office-ui-fabric-react-DetailsList 216.713 kB 217.614 kB ExceedsBaseline     901 bytes

ExceedsTolerance Over Tolerance (1024 B) ExceedsBaseline Over Baseline BelowBaseline Below Baseline New New Deleted  Removed 1 kB = 1000 B

Baseline commit: ac2f319d76db747f0d0b1d76cbf4d63ae8864794 (build)

@fabricteam
Copy link
Collaborator

fabricteam commented Apr 27, 2021

Perf Analysis

No significant results to display.

All results

Scenario Render type 7.0 Ticks PR Ticks Iterations Status
BaseButton mount 985 984 5000
Breadcrumb mount 44070 43965 5000
Checkbox mount 1675 1735 5000
CheckboxBase mount 1390 1503 5000
ChoiceGroup mount 5461 5454 5000
ComboBox mount 957 1048 1000
CommandBar mount 8088 8185 1000
ContextualMenu mount 14773 14815 1000
DefaultButton mount 1227 1253 5000
DetailsRow mount 4021 3981 5000
DetailsRowFast mount 3998 3974 5000
DetailsRowNoStyles mount 3860 3745 5000
Dialog mount 1857 1876 1000
DocumentCardTitle mount 1953 1863 1000
Dropdown mount 2867 2711 5000
FocusTrapZone mount 1877 1862 5000
FocusZone mount 1880 1986 5000
IconButton mount 1885 2022 5000
Label mount 416 361 5000
Layer mount 2147 2179 5000
Link mount 488 477 5000
MenuButton mount 1627 1628 5000
MessageBar mount 2260 2188 5000
Nav mount 3667 3687 1000
OverflowSet mount 1559 1551 5000
Panel mount 1610 1590 1000
Persona mount 844 858 1000
Pivot mount 1518 1632 1000
PrimaryButton mount 1430 1439 5000
Rating mount 8468 8672 5000
SearchBox mount 1327 1409 5000
Shimmer mount 2751 2854 5000
Slider mount 1645 1709 5000
SpinButton mount 5493 5501 5000
Spinner mount 434 446 5000
SplitButton mount 3446 3449 5000
Stack mount 553 599 5000
StackWithIntrinsicChildren mount 1816 1742 5000
StackWithTextChildren mount 5266 5317 5000
SwatchColorPicker mount 11229 11385 5000
TagPicker mount 3056 3001 5000
TeachingBubble mount 53527 53784 5000
Text mount 459 506 5000
TextField mount 1536 1548 5000
Toggle mount 882 891 5000
button mount 120 118 5000

@joshualamusga1 joshualamusga1 force-pushed the cherry-pick-7d2a0ee3af7ab8a13f4cf007bfed6aeebde35b23 branch from a825aea to 159bf25 Compare April 27, 2021 17:39
@JustSlone JustSlone merged commit edd575c into microsoft:7.0 Apr 30, 2021
@msft-fluent-ui-bot
Copy link
Collaborator

🎉@uifabric/tsx-editor@v0.14.37 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉office-ui-fabric-react@v7.170.0 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@uifabric/theme-samples@v7.2.36 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@uifabric/fabric-website@v7.16.65 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@uifabric/react-cards@v0.115.48 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@uifabric/mdl2-theme@v0.4.36 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@uifabric/charting@v4.15.24 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@uifabric/fabric-website-resources@v7.9.64 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@uifabric/fluent-theme@v7.4.36 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@uifabric/experiments@v7.39.27 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@uifabric/api-docs@v7.6.39 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@uifabric/azure-themes@v7.7.34 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@uifabric/date-time@v7.19.42 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@uifabric/example-app-base@v7.19.11 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@fluentui/storybook@v0.6.44 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@fluentui/react-examples@v0.14.0 has been released which incorporates this pull request.:tada:

Handy links:

@msft-fluent-ui-bot
Copy link
Collaborator

🎉@fluentui/react@v7.170.0 has been released which incorporates this pull request.:tada:

Handy links:

@joshualamusga1 joshualamusga1 deleted the cherry-pick-7d2a0ee3af7ab8a13f4cf007bfed6aeebde35b23 branch May 3, 2021 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants