-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Overflow Set and Resize Group - Init Review #1508
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
Closed
Closed
Changes from 30 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
f16217f
Dropdown button init pass
micahgodbolt 4445a3d
Moved contextual menu carrot into basebutton definition
micahgodbolt 32e7cd3
Removed extra line
micahgodbolt 1fa5b0f
Merge branch 'master' into button-callout
micahgodbolt c9aa7ec
Merge branch 'master' into button-callout
micahgodbolt 83f5f84
Merge branch 'button-callout' of https://github.com/micahgodbolt/offi…
micahgodbolt b0ab44a
Fixed capitalization of ContextualMenu
micahgodbolt f366c2e
Added split button class name to interface, updated comment
micahgodbolt ca21797
OverflowGroup init pass
micahgodbolt 9c6cdad
Button updates
micahgodbolt 4f2eb89
Updated button
micahgodbolt af45a39
Merge branch 'master' into button-callout
micahgodbolt a51c011
Fixed spelling mistake, updated components to supply styles to menuIcon
micahgodbolt 9886101
Merge branch 'master' into overflow-container
micahgodbolt 0c99c0b
Merge branch 'button-callout' into overflow-container
micahgodbolt 99d7eeb
Update overflow group to calc width of elements
micahgodbolt a4ffa64
moved overflow button inside of main section, added support for children
micahgodbolt 8d71ec6
Merged in master
micahgodbolt 47cfaf2
Merged in master, fixed overflow set to work with new build process
micahgodbolt e60b4d3
Merge branch 'master' into overflow-container
micahgodbolt 056fddf
Finished renaming and pulling in mater
micahgodbolt 80c405e
Update overflowSet
micahgodbolt 36f0ab8
Overflow set cleanup
micahgodbolt c6f556b
Merge branch 'master' into overflow-container
micahgodbolt e1a860a
Overflow set work
micahgodbolt 3201e3c
Merge branch 'master' into overflow-container
micahgodbolt c165859
Overflow set updates
micahgodbolt 67a89c6
Added custom 'updatedOverflowState'
micahgodbolt 815b624
Break out to Resize Group
micahgodbolt ef2701c
Removed extra button props
micahgodbolt c68ee95
Remove unnecessary comments
micahgodbolt 78d2261
Fixed linting errors
micahgodbolt 13cfd8b
Merge branch 'master' into overflow-container
micahgodbolt 1913758
add ResizeGroup.ts file
micahgodbolt e62b3e0
Fixed propertiestableset string
micahgodbolt 98ae192
Merge branch 'master' into overflow-container
micahgodbolt 4544a43
Merge branch 'master' into overflow-container
micahgodbolt ad81932
Fixed props links
micahgodbolt b43944b
Merge branch 'overflow-container' of https://github.com/micahgodbolt/…
micahgodbolt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from './components/OverflowSet/index'; |
12 changes: 12 additions & 0 deletions
12
packages/office-ui-fabric-react/src/components/OverflowSet/OverflowSet.Props.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import * as React from 'react'; | ||
| import { OverflowSet } from './OverflowSet'; | ||
| import { IContextualMenuItem } from '../../ContextualMenu'; | ||
|
|
||
| export interface IOverflowSetProps extends React.Props<OverflowSet> { | ||
| items?: any[]; | ||
| overflowItems?: IContextualMenuItem[]; | ||
| overflowIcon?: string; | ||
|
|
||
| /** Method to call when trying to render an item. */ | ||
| onRenderItem?: (item?: any, index?: number) => React.ReactNode; | ||
| } |
12 changes: 12 additions & 0 deletions
12
packages/office-ui-fabric-react/src/components/OverflowSet/OverflowSet.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| @import '../../common/common'; | ||
|
|
||
| .root { | ||
| position: relative; | ||
| display: flex; | ||
| flex-wrap: nowrap; | ||
| } | ||
|
|
||
|
|
||
| .item { | ||
| flex-shrink: 0; | ||
| } |
57 changes: 57 additions & 0 deletions
57
packages/office-ui-fabric-react/src/components/OverflowSet/OverflowSet.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import * as React from 'react'; | ||
| import { | ||
| css, | ||
| autobind, | ||
| BaseComponent | ||
| } from '../../Utilities'; | ||
| import { IOverflowSetProps } from './OverflowSet.Props'; | ||
| import { IconButton } from '../../Button'; | ||
|
|
||
| const styles: any = require('./OverflowSet.scss'); | ||
|
|
||
| export class OverflowSet extends BaseComponent<IOverflowSetProps, null> { | ||
|
|
||
| constructor(props: IOverflowSetProps) { | ||
| super(props); | ||
| } | ||
|
|
||
| public render() { | ||
| let { items, overflowItems } = this.props; | ||
| return ( | ||
| <div className={ css('ms-OverflowSet', styles.root) } > | ||
| { items && this._onRenderItems(items) } | ||
| { overflowItems && this._onRenderOverflowButton(overflowItems) } | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| @autobind | ||
| private _onRenderOverflowButton(items) { | ||
| let { overflowIcon = 'More' } = this.props; | ||
| return ( | ||
| <IconButton | ||
| icon={ overflowIcon } | ||
| menuIconName='none' | ||
| menuProps={ { | ||
| items: items | ||
| } } | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| @autobind | ||
| private _onRenderItems(items) { | ||
| return items.map((item, i) => { | ||
| let key = item.key ? item.key : i; | ||
| let onRender = item.onRender ? item.onRender : this.props.onRenderItem; | ||
| return ( | ||
| <div | ||
| className={ css('ms-OverflowSet-item', styles.item) } | ||
| key={ key } | ||
| ref={ key } > | ||
| { onRender ? onRender(item, i) : item } | ||
| </div> | ||
| ); | ||
| }); | ||
| } | ||
| } |
42 changes: 42 additions & 0 deletions
42
packages/office-ui-fabric-react/src/components/OverflowSet/OverflowSetPage.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import * as React from 'react'; | ||
| import { Link } from 'office-ui-fabric-react/lib/Link'; | ||
| import { LayerHost } from 'office-ui-fabric-react/lib/Layer'; | ||
| import { | ||
| ExampleCard, | ||
| ComponentPage, | ||
| PropertiesTableSet | ||
| } from '@uifabric/example-app-base'; | ||
| import { OverflowSetBasicExample } from './examples/OverflowSet.Basic.Example'; | ||
|
|
||
| const OverflowSetBasicExampleCode = require('!raw-loader!office-ui-fabric-react/src/components/OverflowSet/examples/OverflowSet.Basic.Example.tsx') as string; | ||
|
|
||
| export class OverflowSetPage extends React.Component<any, any> { | ||
| public render() { | ||
| return ( | ||
| <ComponentPage | ||
| title='OverflowSet' | ||
| componentName='OverflowSetExample' | ||
| exampleCards={ | ||
| <LayerHost> | ||
| <ExampleCard title='OverflowSet' code={ OverflowSetBasicExampleCode }> | ||
| <OverflowSetBasicExample /> | ||
| </ExampleCard> | ||
| </LayerHost> | ||
| } | ||
| propertiesTables={ | ||
| <PropertiesTableSet | ||
| sources={ [ | ||
| require<string>('office-ui-fabric-react/lib/components/OverflowSet/OverflowSet.Props.ts') | ||
| ] } | ||
| /> | ||
| } | ||
| overview={ | ||
| <div> | ||
| <Link target='_blank' href='http://dev.office.com/fabric/components/OverflowSet'>OverflowSets</Link> | ||
| <span> supplement content associated with a specific UI component.</span> | ||
| </div> | ||
| } | ||
| /> | ||
| ); | ||
| } | ||
| } |
166 changes: 166 additions & 0 deletions
166
.../office-ui-fabric-react/src/components/OverflowSet/examples/OverflowSet.Basic.Example.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,166 @@ | ||
| /* tslint:disable:no-unused-variable */ | ||
| import * as React from 'react'; | ||
| /* tslint:enable:no-unused-variable */ | ||
| import { BaseComponent } from 'office-ui-fabric-react/lib/Utilities'; | ||
| import { SearchBox } from 'office-ui-fabric-react/lib/SearchBox'; | ||
| import { DefaultButton } from 'office-ui-fabric-react/lib/Button'; | ||
| import { | ||
| OverflowSet | ||
| } from '../index'; | ||
| import { ResizeGroup } from '../../ResizeGroup'; | ||
|
|
||
| /* | ||
| const instructions = [ | ||
| { key: 'A', action: Actions.reduceToIcon}, | ||
| { key: 'B', action: Actions.appendToOverflow, transform: (itemProps) => : ItemProps}, | ||
| [ | ||
| {}, | ||
| {} | ||
| ] | ||
| ]; | ||
|
|
||
|
|
||
| updateOverflowState(prevState, props) => { | ||
| if (!prevState) {} | ||
| return { | ||
| instructionsIndex: 0, | ||
| items: [], | ||
| overflowItems: [] | ||
| }; | ||
| } | ||
|
|
||
|
|
||
| let items = prevState.items.concat([]); | ||
| let overflowItems = prevState.overflowItems.concat([]); | ||
| let inst = instructions[prevState.index]; | ||
| if (inst) { | ||
| applyInstruction(items, overflowItems, inst); | ||
| } | ||
| for (let i = 0; i < items.length; i++) { | ||
| if (items[i].key === inst.key) { | ||
| overflowItems.concat(items.splice(i, 1)); | ||
| break; | ||
| } | ||
| } | ||
| return { | ||
| index: index + 1, | ||
| items, | ||
| overflowItems | ||
| }; | ||
| } | ||
|
|
||
| <VisualResizer | ||
| onReduceProps={ lastReducedProps, props => { | ||
| state.items // [ overflowSetProps1, overflowSetProps2, etc ] | ||
| }} | ||
| onRender={ props => ( | ||
| <div> | ||
| { props.items.map(item => ( | ||
| <OverflowSet items={item.items} overflowItems={items.overflowItems} /> | ||
| )) } | ||
| </div> | ||
| ) } | ||
| /> | ||
|
|
||
|
|
||
| */ | ||
| export class OverflowSetBasicExample extends BaseComponent<any, any> { | ||
|
|
||
| public render() { | ||
| return ( | ||
| <OverflowSet | ||
| items={ [ | ||
| { | ||
| key: 'search', | ||
| 'onRender': () => { | ||
| return ( | ||
| <SearchBox | ||
| onChange={ (newValue) => console.log('SearchBox onChange fired: ' + newValue) } | ||
| onSearch={ (newValue) => console.log('SearchBox onSearch fired: ' + newValue) } | ||
| /> | ||
| ); | ||
| } | ||
| }, | ||
| { | ||
| key: 'newItem', | ||
| name: 'New', | ||
| icon: 'Add', | ||
| ariaLabel: 'New. Use left and right arrow keys to navigate', | ||
| onClick: () => { return; }, | ||
| subMenuProps: { | ||
| items: [ | ||
| { | ||
| key: 'emailMessage', | ||
| name: 'Email message', | ||
| icon: 'Mail', | ||
| }, | ||
| { | ||
| key: 'calendarEvent', | ||
| name: 'Calendar event', | ||
| icon: 'Calendar' | ||
| } | ||
| ], | ||
| }, | ||
| }, | ||
| { | ||
| key: 'upload', | ||
| name: 'Upload', | ||
| icon: 'Upload', | ||
| onClick: () => { return; }, | ||
| }, | ||
| { | ||
| key: 'share', | ||
| name: 'Share', | ||
| icon: 'Share', | ||
| onClick: () => { return; } | ||
| } | ||
| ] } | ||
| overflowItems={ [ | ||
| { | ||
| key: 'newItem', | ||
| name: 'New', | ||
| icon: 'Add', | ||
| ariaLabel: 'New. Use left and right arrow keys to navigate', | ||
| onClick: () => { return; }, | ||
| subMenuProps: { | ||
| items: [ | ||
| { | ||
| key: 'emailMessage', | ||
| name: 'Email message', | ||
| icon: 'Mail', | ||
| }, | ||
| { | ||
| key: 'calendarEvent', | ||
| name: 'Calendar event', | ||
| icon: 'Calendar' | ||
| } | ||
| ], | ||
| }, | ||
| }, | ||
| { | ||
| key: 'upload', | ||
| name: 'Upload', | ||
| icon: 'Upload', | ||
| onClick: () => { return; }, | ||
| }, | ||
| { | ||
| key: 'share', | ||
| name: 'Share', | ||
| icon: 'Share', | ||
| onClick: () => { return; } | ||
| } | ||
| ] | ||
| } | ||
| onRenderItem={ (item, i) => { | ||
| return ( | ||
| <DefaultButton | ||
| icon={ item.icon } | ||
| menuProps={ item.subMenuProps } | ||
| text={ item.small ? null : item.name } | ||
| > </DefaultButton> | ||
| ); | ||
| } } | ||
| /> | ||
| ); | ||
| } | ||
| } | ||
2 changes: 2 additions & 0 deletions
2
packages/office-ui-fabric-react/src/components/OverflowSet/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export * from './OverflowSet'; | ||
| export * from './OverflowSet.Props'; |
8 changes: 8 additions & 0 deletions
8
packages/office-ui-fabric-react/src/components/ResizeGroup/ResizeGroup.Props.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| import * as React from 'react'; | ||
| import { IOverFlowItemState } from './ResizeGroup'; | ||
|
|
||
| export interface IResizeGroupProps extends React.HTMLProps<HTMLElement> { | ||
| items?: any[]; | ||
| onRenderItems?: (items: any[]) => JSX.Element; | ||
| onReduceItems?: (prevItems: IOverFlowItemState, props: IResizeGroupProps) => IOverFlowItemState; | ||
| } |
13 changes: 13 additions & 0 deletions
13
packages/office-ui-fabric-react/src/components/ResizeGroup/ResizeGroup.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| @import '../../common/common'; | ||
|
|
||
| .root { | ||
| display: block; | ||
| } | ||
|
|
||
| .measured { | ||
| flex-direction: horizontal; | ||
| flex-wrap: nowrap; | ||
| display: flex; | ||
| position: absolute; | ||
| visibility: hidden; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
These are notes that I'll eventually remove