2015-02-21 05:17:11 +08:00
|
|
|
React = require 'react'
|
2015-05-20 07:06:59 +08:00
|
|
|
_ = require 'underscore'
|
2015-05-15 08:08:30 +08:00
|
|
|
{Actions,ComponentRegistry, WorkspaceStore} = require "nylas-exports"
|
2015-03-21 08:51:49 +08:00
|
|
|
RetinaImg = require './components/retina-img'
|
|
|
|
Flexbox = require './components/flexbox'
|
feat(unsafe-components): Wrap injected components, catch exceptions, clean up ComponentRegistry
Summary:
This diff gives the ComponentRegistry a cleaner, smaller API. Instead of querying by name, location or role,
it's now just location and role, and you can register components for one or more location and one or more
roles without assigning the entries in the registry separate names.
When you register with the ComponentRegistry, the syntax is also cleaner and uses the component's displayName
instead of requiring you to provide a name. You also provide the actual component when unregistering, ensuring
that you can't unregister someone else's component.
InjectedComponent and InjectedComponentSet now wrap their children in UnsafeComponent, which prevents
render/component lifecycle problems from propogating.
Existing components have been updated:
1. maxWidth / minWidth are now containerStyles.maxWidth/minWidth
2. displayName is now required to use the CR.
3. containerRequired = false can be provided to exempt a component from being wrapped in an UnsafeComponent.
This is useful because it's slightly faster and keeps DOM flat.
This diff also makes the "Show Component Regions" more awesome. It displays column regions, since they now
use the InjectedComponentSet, and also shows for InjectedComponent as well as InjectedComponentSet.
Change ComponentRegistry syntax, lots more work on safely wrapping items. See description.
Fix for inline flexbox scenarios (message actions)
Allow ~/.inbox/packages to be symlinked to a github repo
Test Plan: Run tests!
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1457
2015-05-01 07:10:15 +08:00
|
|
|
InjectedComponentSet = require './components/injected-component-set'
|
2015-03-21 08:51:49 +08:00
|
|
|
ResizableRegion = require './components/resizable-region'
|
2015-02-21 05:17:11 +08:00
|
|
|
|
2015-03-21 05:52:10 +08:00
|
|
|
FLEX = 10000
|
|
|
|
|
2015-04-25 02:33:10 +08:00
|
|
|
class Sheet extends React.Component
|
|
|
|
@displayName = 'Sheet'
|
2015-02-21 05:17:11 +08:00
|
|
|
|
2015-04-25 02:33:10 +08:00
|
|
|
@propTypes =
|
2015-03-21 05:52:10 +08:00
|
|
|
data: React.PropTypes.object.isRequired
|
2015-02-21 05:17:11 +08:00
|
|
|
depth: React.PropTypes.number.isRequired
|
2015-03-13 06:07:38 +08:00
|
|
|
onColumnSizeChanged: React.PropTypes.func
|
2015-02-21 05:17:11 +08:00
|
|
|
|
2015-07-24 02:47:46 +08:00
|
|
|
@childContextTypes:
|
|
|
|
sheetDepth: React.PropTypes.number
|
|
|
|
getChildContext: =>
|
|
|
|
sheetDepth: @props.depth
|
|
|
|
|
2015-04-25 02:33:10 +08:00
|
|
|
constructor: (@props) ->
|
|
|
|
@state = @_getStateFromStores()
|
2015-02-21 05:17:11 +08:00
|
|
|
|
2015-04-25 02:33:10 +08:00
|
|
|
componentDidMount: =>
|
2015-03-14 04:11:24 +08:00
|
|
|
@unlisteners ?= []
|
|
|
|
@unlisteners.push ComponentRegistry.listen (event) =>
|
|
|
|
@setState(@_getStateFromStores())
|
|
|
|
@unlisteners.push WorkspaceStore.listen (event) =>
|
|
|
|
@setState(@_getStateFromStores())
|
2015-02-21 05:17:11 +08:00
|
|
|
|
2015-04-25 02:33:10 +08:00
|
|
|
componentDidUpdate: =>
|
2015-03-19 09:21:04 +08:00
|
|
|
@props.onColumnSizeChanged(@) if @props.onColumnSizeChanged
|
2015-09-05 06:31:03 +08:00
|
|
|
minWidth = 0
|
|
|
|
minWidth += col.minWidth for col in @state.columns
|
2015-09-05 03:27:05 +08:00
|
|
|
atom.setMinimumWidth(minWidth)
|
2015-03-19 09:21:04 +08:00
|
|
|
|
2015-04-25 02:33:10 +08:00
|
|
|
shouldComponentUpdate: (nextProps, nextState) =>
|
2015-03-19 09:21:04 +08:00
|
|
|
not _.isEqual(nextProps, @props) or not _.isEqual(nextState, @state)
|
|
|
|
|
2015-04-25 02:33:10 +08:00
|
|
|
componentWillUnmount: =>
|
2015-03-14 04:11:24 +08:00
|
|
|
unlisten() for unlisten in @unlisteners
|
2015-02-21 05:17:11 +08:00
|
|
|
|
2015-04-25 02:33:10 +08:00
|
|
|
render: =>
|
2015-02-21 05:17:11 +08:00
|
|
|
style =
|
|
|
|
position:'absolute'
|
|
|
|
width:'100%'
|
|
|
|
height:'100%'
|
2015-03-14 04:11:24 +08:00
|
|
|
zIndex: 1
|
|
|
|
|
|
|
|
# Note - setting the z-index of the sheet is important, even though it's
|
|
|
|
# always 1. Assigning a z-index creates a "stacking context" in the browser,
|
|
|
|
# so z-indexes inside the sheet are relative to each other, but something in
|
|
|
|
# one sheet cannot be on top of something in another sheet.
|
|
|
|
# http://philipwalton.com/articles/what-no-one-told-you-about-z-index/
|
2015-02-21 05:17:11 +08:00
|
|
|
|
2015-03-13 06:07:38 +08:00
|
|
|
<div name={"Sheet"}
|
|
|
|
style={style}
|
2015-04-09 10:25:00 +08:00
|
|
|
className={"sheet mode-#{@state.mode}"}
|
refactor(*): Thread list fixes, flexible workspace store, multiple root sheets
Summary:
Remember to remove all the event listeners added to email frame
New files tab, queryable filename, not attribute
Rename ThreadSelectionBar to RootSelectionBar to go with RootCenterComponent, make it appear for draft selection and file selection as well
Initial file list and file list store, File Location
Remove unnecessary shouldComponentUpdate
Always track whether new requests have happened since ours to prevent out of order triggers
Always scroll to the current [focused/keyboard-cursor] in lists
So goodbye to the trash tag
Only scroll to current item if focus or keyboard has moved
Show message snippet in notification if no subject line
Make the RootSelectionBar pull items from Component Registry
New Archive button (prettier than the other one)
Refactor event additions to iframe so iframe can be used for file display also
Thread List is no longer the uber root package - drafts and files moved to separate packages
WorkspaceStore now allows packages to register sheets, "view" concept replaced with "root sheet" concept, "mode" may not be observed by all sheets, and is now called "preferred mode"
Don't animate transitions between two root sheets
Mode switch is only visible on root sheets that support multiple modes
Account sidebar now shows "Views" that have registered themselves: drafts and files for now
Model Selection Bar is now a component, just like ModelList. Meant to be in the toolbar above a Model List
Misc supporting changes
New files package which registers it's views and components
Rename files package to `file-list`
Move checkmark column down into model list
Don't throw exception if shift-down arrow and nothing selected
Takes a long time on login to fetch first page of threads, make pages smaller
Displaynames, spec fixes
Test Plan: Run tests
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1412
2015-04-11 05:33:05 +08:00
|
|
|
data-id={@props.data.id}>
|
2015-02-21 05:17:11 +08:00
|
|
|
<Flexbox direction="row">
|
2015-03-21 05:52:10 +08:00
|
|
|
{@_columnFlexboxElements()}
|
2015-02-21 05:17:11 +08:00
|
|
|
</Flexbox>
|
|
|
|
</div>
|
|
|
|
|
2015-04-25 02:33:10 +08:00
|
|
|
_columnFlexboxElements: =>
|
feat(unsafe-components): Wrap injected components, catch exceptions, clean up ComponentRegistry
Summary:
This diff gives the ComponentRegistry a cleaner, smaller API. Instead of querying by name, location or role,
it's now just location and role, and you can register components for one or more location and one or more
roles without assigning the entries in the registry separate names.
When you register with the ComponentRegistry, the syntax is also cleaner and uses the component's displayName
instead of requiring you to provide a name. You also provide the actual component when unregistering, ensuring
that you can't unregister someone else's component.
InjectedComponent and InjectedComponentSet now wrap their children in UnsafeComponent, which prevents
render/component lifecycle problems from propogating.
Existing components have been updated:
1. maxWidth / minWidth are now containerStyles.maxWidth/minWidth
2. displayName is now required to use the CR.
3. containerRequired = false can be provided to exempt a component from being wrapped in an UnsafeComponent.
This is useful because it's slightly faster and keeps DOM flat.
This diff also makes the "Show Component Regions" more awesome. It displays column regions, since they now
use the InjectedComponentSet, and also shows for InjectedComponent as well as InjectedComponentSet.
Change ComponentRegistry syntax, lots more work on safely wrapping items. See description.
Fix for inline flexbox scenarios (message actions)
Allow ~/.inbox/packages to be symlinked to a github repo
Test Plan: Run tests!
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1457
2015-05-01 07:10:15 +08:00
|
|
|
@state.columns.map ({maxWidth, minWidth, handle, location}, idx) =>
|
2015-03-21 05:52:10 +08:00
|
|
|
if minWidth != maxWidth and maxWidth < FLEX
|
refactor(*): Thread list fixes, flexible workspace store, multiple root sheets
Summary:
Remember to remove all the event listeners added to email frame
New files tab, queryable filename, not attribute
Rename ThreadSelectionBar to RootSelectionBar to go with RootCenterComponent, make it appear for draft selection and file selection as well
Initial file list and file list store, File Location
Remove unnecessary shouldComponentUpdate
Always track whether new requests have happened since ours to prevent out of order triggers
Always scroll to the current [focused/keyboard-cursor] in lists
So goodbye to the trash tag
Only scroll to current item if focus or keyboard has moved
Show message snippet in notification if no subject line
Make the RootSelectionBar pull items from Component Registry
New Archive button (prettier than the other one)
Refactor event additions to iframe so iframe can be used for file display also
Thread List is no longer the uber root package - drafts and files moved to separate packages
WorkspaceStore now allows packages to register sheets, "view" concept replaced with "root sheet" concept, "mode" may not be observed by all sheets, and is now called "preferred mode"
Don't animate transitions between two root sheets
Mode switch is only visible on root sheets that support multiple modes
Account sidebar now shows "Views" that have registered themselves: drafts and files for now
Model Selection Bar is now a component, just like ModelList. Meant to be in the toolbar above a Model List
Misc supporting changes
New files package which registers it's views and components
Rename files package to `file-list`
Move checkmark column down into model list
Don't throw exception if shift-down arrow and nothing selected
Takes a long time on login to fetch first page of threads, make pages smaller
Displaynames, spec fixes
Test Plan: Run tests
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1412
2015-04-11 05:33:05 +08:00
|
|
|
<ResizableRegion key={"#{@props.data.id}:#{idx}"}
|
|
|
|
name={"#{@props.data.id}:#{idx}"}
|
feat(unsafe-components): Wrap injected components, catch exceptions, clean up ComponentRegistry
Summary:
This diff gives the ComponentRegistry a cleaner, smaller API. Instead of querying by name, location or role,
it's now just location and role, and you can register components for one or more location and one or more
roles without assigning the entries in the registry separate names.
When you register with the ComponentRegistry, the syntax is also cleaner and uses the component's displayName
instead of requiring you to provide a name. You also provide the actual component when unregistering, ensuring
that you can't unregister someone else's component.
InjectedComponent and InjectedComponentSet now wrap their children in UnsafeComponent, which prevents
render/component lifecycle problems from propogating.
Existing components have been updated:
1. maxWidth / minWidth are now containerStyles.maxWidth/minWidth
2. displayName is now required to use the CR.
3. containerRequired = false can be provided to exempt a component from being wrapped in an UnsafeComponent.
This is useful because it's slightly faster and keeps DOM flat.
This diff also makes the "Show Component Regions" more awesome. It displays column regions, since they now
use the InjectedComponentSet, and also shows for InjectedComponent as well as InjectedComponentSet.
Change ComponentRegistry syntax, lots more work on safely wrapping items. See description.
Fix for inline flexbox scenarios (message actions)
Allow ~/.inbox/packages to be symlinked to a github repo
Test Plan: Run tests!
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1457
2015-05-01 07:10:15 +08:00
|
|
|
className={"column-#{location.id}"}
|
2015-05-09 07:36:48 +08:00
|
|
|
style={height:'100%'}
|
2015-03-21 05:52:10 +08:00
|
|
|
data-column={idx}
|
2015-03-19 09:21:04 +08:00
|
|
|
onResize={ => @props.onColumnSizeChanged(@) }
|
2015-03-13 06:07:38 +08:00
|
|
|
minWidth={minWidth}
|
|
|
|
maxWidth={maxWidth}
|
|
|
|
handle={handle}>
|
feat(unsafe-components): Wrap injected components, catch exceptions, clean up ComponentRegistry
Summary:
This diff gives the ComponentRegistry a cleaner, smaller API. Instead of querying by name, location or role,
it's now just location and role, and you can register components for one or more location and one or more
roles without assigning the entries in the registry separate names.
When you register with the ComponentRegistry, the syntax is also cleaner and uses the component's displayName
instead of requiring you to provide a name. You also provide the actual component when unregistering, ensuring
that you can't unregister someone else's component.
InjectedComponent and InjectedComponentSet now wrap their children in UnsafeComponent, which prevents
render/component lifecycle problems from propogating.
Existing components have been updated:
1. maxWidth / minWidth are now containerStyles.maxWidth/minWidth
2. displayName is now required to use the CR.
3. containerRequired = false can be provided to exempt a component from being wrapped in an UnsafeComponent.
This is useful because it's slightly faster and keeps DOM flat.
This diff also makes the "Show Component Regions" more awesome. It displays column regions, since they now
use the InjectedComponentSet, and also shows for InjectedComponent as well as InjectedComponentSet.
Change ComponentRegistry syntax, lots more work on safely wrapping items. See description.
Fix for inline flexbox scenarios (message actions)
Allow ~/.inbox/packages to be symlinked to a github repo
Test Plan: Run tests!
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1457
2015-05-01 07:10:15 +08:00
|
|
|
<InjectedComponentSet direction="column" matching={location: location, mode: @state.mode}/>
|
2015-02-28 07:34:37 +08:00
|
|
|
</ResizableRegion>
|
2015-02-21 05:17:11 +08:00
|
|
|
else
|
feat(accounts): Kill namespaces, long live accounts
Summary:
This diff replaces the Namespace object with the Account object, and changes all references to namespace_id => account_id, etc. The endpoints are now `/threads` instead of `/n/<id>/threads`.
This diff also adds preliminary support for multiple accounts. When you log in, we now log you in to all the attached accounts on edgehill server. From the preferences panel, you can auth with / unlink additional accounts. Shockingly, this all seems to pretty much work.
When replying to a thread, you cannot switch from addresses. However, when creating a new message in a popout composer, you can change the from address and the SaveDraftTask will delete/re-root the draft on the new account.
Search bar doesn't need to do full refresh on clear if it never committed
Allow drafts to be switched to a different account when not in reply to an existing thread
Fix edge case where ChangeMailTask throws exception if no models are modified during performLocal
Show many dots for many accounts in long polling status bar
add/remove accounts from prefs
Spec fixes!
Test Plan: Run tests, none broken!
Reviewers: evan, dillon
Reviewed By: evan, dillon
Differential Revision: https://phab.nylas.com/D1928
2015-08-22 06:29:58 +08:00
|
|
|
style =
|
|
|
|
height: '100%'
|
2015-09-05 03:27:05 +08:00
|
|
|
minWidth: minWidth
|
feat(accounts): Kill namespaces, long live accounts
Summary:
This diff replaces the Namespace object with the Account object, and changes all references to namespace_id => account_id, etc. The endpoints are now `/threads` instead of `/n/<id>/threads`.
This diff also adds preliminary support for multiple accounts. When you log in, we now log you in to all the attached accounts on edgehill server. From the preferences panel, you can auth with / unlink additional accounts. Shockingly, this all seems to pretty much work.
When replying to a thread, you cannot switch from addresses. However, when creating a new message in a popout composer, you can change the from address and the SaveDraftTask will delete/re-root the draft on the new account.
Search bar doesn't need to do full refresh on clear if it never committed
Allow drafts to be switched to a different account when not in reply to an existing thread
Fix edge case where ChangeMailTask throws exception if no models are modified during performLocal
Show many dots for many accounts in long polling status bar
add/remove accounts from prefs
Spec fixes!
Test Plan: Run tests, none broken!
Reviewers: evan, dillon
Reviewed By: evan, dillon
Differential Revision: https://phab.nylas.com/D1928
2015-08-22 06:29:58 +08:00
|
|
|
if maxWidth < FLEX
|
|
|
|
style.width = maxWidth
|
|
|
|
else
|
|
|
|
style.flex = 1
|
feat(unsafe-components): Wrap injected components, catch exceptions, clean up ComponentRegistry
Summary:
This diff gives the ComponentRegistry a cleaner, smaller API. Instead of querying by name, location or role,
it's now just location and role, and you can register components for one or more location and one or more
roles without assigning the entries in the registry separate names.
When you register with the ComponentRegistry, the syntax is also cleaner and uses the component's displayName
instead of requiring you to provide a name. You also provide the actual component when unregistering, ensuring
that you can't unregister someone else's component.
InjectedComponent and InjectedComponentSet now wrap their children in UnsafeComponent, which prevents
render/component lifecycle problems from propogating.
Existing components have been updated:
1. maxWidth / minWidth are now containerStyles.maxWidth/minWidth
2. displayName is now required to use the CR.
3. containerRequired = false can be provided to exempt a component from being wrapped in an UnsafeComponent.
This is useful because it's slightly faster and keeps DOM flat.
This diff also makes the "Show Component Regions" more awesome. It displays column regions, since they now
use the InjectedComponentSet, and also shows for InjectedComponent as well as InjectedComponentSet.
Change ComponentRegistry syntax, lots more work on safely wrapping items. See description.
Fix for inline flexbox scenarios (message actions)
Allow ~/.inbox/packages to be symlinked to a github repo
Test Plan: Run tests!
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1457
2015-05-01 07:10:15 +08:00
|
|
|
<InjectedComponentSet direction="column"
|
|
|
|
key={"#{@props.data.id}:#{idx}"}
|
|
|
|
name={"#{@props.data.id}:#{idx}"}
|
|
|
|
className={"column-#{location.id}"}
|
|
|
|
data-column={idx}
|
feat(accounts): Kill namespaces, long live accounts
Summary:
This diff replaces the Namespace object with the Account object, and changes all references to namespace_id => account_id, etc. The endpoints are now `/threads` instead of `/n/<id>/threads`.
This diff also adds preliminary support for multiple accounts. When you log in, we now log you in to all the attached accounts on edgehill server. From the preferences panel, you can auth with / unlink additional accounts. Shockingly, this all seems to pretty much work.
When replying to a thread, you cannot switch from addresses. However, when creating a new message in a popout composer, you can change the from address and the SaveDraftTask will delete/re-root the draft on the new account.
Search bar doesn't need to do full refresh on clear if it never committed
Allow drafts to be switched to a different account when not in reply to an existing thread
Fix edge case where ChangeMailTask throws exception if no models are modified during performLocal
Show many dots for many accounts in long polling status bar
add/remove accounts from prefs
Spec fixes!
Test Plan: Run tests, none broken!
Reviewers: evan, dillon
Reviewed By: evan, dillon
Differential Revision: https://phab.nylas.com/D1928
2015-08-22 06:29:58 +08:00
|
|
|
style={style}
|
feat(unsafe-components): Wrap injected components, catch exceptions, clean up ComponentRegistry
Summary:
This diff gives the ComponentRegistry a cleaner, smaller API. Instead of querying by name, location or role,
it's now just location and role, and you can register components for one or more location and one or more
roles without assigning the entries in the registry separate names.
When you register with the ComponentRegistry, the syntax is also cleaner and uses the component's displayName
instead of requiring you to provide a name. You also provide the actual component when unregistering, ensuring
that you can't unregister someone else's component.
InjectedComponent and InjectedComponentSet now wrap their children in UnsafeComponent, which prevents
render/component lifecycle problems from propogating.
Existing components have been updated:
1. maxWidth / minWidth are now containerStyles.maxWidth/minWidth
2. displayName is now required to use the CR.
3. containerRequired = false can be provided to exempt a component from being wrapped in an UnsafeComponent.
This is useful because it's slightly faster and keeps DOM flat.
This diff also makes the "Show Component Regions" more awesome. It displays column regions, since they now
use the InjectedComponentSet, and also shows for InjectedComponent as well as InjectedComponentSet.
Change ComponentRegistry syntax, lots more work on safely wrapping items. See description.
Fix for inline flexbox scenarios (message actions)
Allow ~/.inbox/packages to be symlinked to a github repo
Test Plan: Run tests!
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1457
2015-05-01 07:10:15 +08:00
|
|
|
matching={location: location, mode: @state.mode}/>
|
2015-02-21 05:17:11 +08:00
|
|
|
|
2015-04-25 02:33:10 +08:00
|
|
|
_getStateFromStores: =>
|
2015-03-24 07:33:28 +08:00
|
|
|
state =
|
refactor(*): Thread list fixes, flexible workspace store, multiple root sheets
Summary:
Remember to remove all the event listeners added to email frame
New files tab, queryable filename, not attribute
Rename ThreadSelectionBar to RootSelectionBar to go with RootCenterComponent, make it appear for draft selection and file selection as well
Initial file list and file list store, File Location
Remove unnecessary shouldComponentUpdate
Always track whether new requests have happened since ours to prevent out of order triggers
Always scroll to the current [focused/keyboard-cursor] in lists
So goodbye to the trash tag
Only scroll to current item if focus or keyboard has moved
Show message snippet in notification if no subject line
Make the RootSelectionBar pull items from Component Registry
New Archive button (prettier than the other one)
Refactor event additions to iframe so iframe can be used for file display also
Thread List is no longer the uber root package - drafts and files moved to separate packages
WorkspaceStore now allows packages to register sheets, "view" concept replaced with "root sheet" concept, "mode" may not be observed by all sheets, and is now called "preferred mode"
Don't animate transitions between two root sheets
Mode switch is only visible on root sheets that support multiple modes
Account sidebar now shows "Views" that have registered themselves: drafts and files for now
Model Selection Bar is now a component, just like ModelList. Meant to be in the toolbar above a Model List
Misc supporting changes
New files package which registers it's views and components
Rename files package to `file-list`
Move checkmark column down into model list
Don't throw exception if shift-down arrow and nothing selected
Takes a long time on login to fetch first page of threads, make pages smaller
Displaynames, spec fixes
Test Plan: Run tests
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1412
2015-04-11 05:33:05 +08:00
|
|
|
mode: WorkspaceStore.layoutMode()
|
2015-03-21 05:52:10 +08:00
|
|
|
columns: []
|
|
|
|
|
|
|
|
widest = -1
|
|
|
|
widestWidth = -1
|
|
|
|
|
2015-03-27 02:46:26 +08:00
|
|
|
if @props.data?.columns[state.mode]?
|
|
|
|
for location, idx in @props.data.columns[state.mode]
|
2015-07-24 02:18:42 +08:00
|
|
|
continue if WorkspaceStore.isLocationHidden(location)
|
feat(unsafe-components): Wrap injected components, catch exceptions, clean up ComponentRegistry
Summary:
This diff gives the ComponentRegistry a cleaner, smaller API. Instead of querying by name, location or role,
it's now just location and role, and you can register components for one or more location and one or more
roles without assigning the entries in the registry separate names.
When you register with the ComponentRegistry, the syntax is also cleaner and uses the component's displayName
instead of requiring you to provide a name. You also provide the actual component when unregistering, ensuring
that you can't unregister someone else's component.
InjectedComponent and InjectedComponentSet now wrap their children in UnsafeComponent, which prevents
render/component lifecycle problems from propogating.
Existing components have been updated:
1. maxWidth / minWidth are now containerStyles.maxWidth/minWidth
2. displayName is now required to use the CR.
3. containerRequired = false can be provided to exempt a component from being wrapped in an UnsafeComponent.
This is useful because it's slightly faster and keeps DOM flat.
This diff also makes the "Show Component Regions" more awesome. It displays column regions, since they now
use the InjectedComponentSet, and also shows for InjectedComponent as well as InjectedComponentSet.
Change ComponentRegistry syntax, lots more work on safely wrapping items. See description.
Fix for inline flexbox scenarios (message actions)
Allow ~/.inbox/packages to be symlinked to a github repo
Test Plan: Run tests!
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1457
2015-05-01 07:10:15 +08:00
|
|
|
entries = ComponentRegistry.findComponentsMatching({location: location, mode: state.mode})
|
|
|
|
maxWidth = _.reduce entries, ((m,component) -> Math.min(component.containerStyles?.maxWidth ? 10000, m)), 10000
|
|
|
|
minWidth = _.reduce entries, ((m,component) -> Math.max(component.containerStyles?.minWidth ? 0, m)), 0
|
|
|
|
col = {maxWidth, minWidth, location}
|
2015-03-27 02:46:26 +08:00
|
|
|
state.columns.push(col)
|
|
|
|
|
|
|
|
if maxWidth > widestWidth
|
|
|
|
widestWidth = maxWidth
|
|
|
|
widest = idx
|
|
|
|
|
|
|
|
if state.columns.length > 0
|
|
|
|
# Once we've accumulated all the React components for the columns,
|
|
|
|
# ensure that at least one column has a huge max-width so that the columns
|
|
|
|
# expand to fill the window. This may make items in the column unhappy, but
|
|
|
|
# we pick the column with the highest max-width so the effect is minimal.
|
|
|
|
state.columns[widest].maxWidth = FLEX
|
|
|
|
|
|
|
|
# Assign flexible edges based on whether items are to the left or right
|
|
|
|
# of the flexible column (which has no edges)
|
|
|
|
state.columns[i].handle = ResizableRegion.Handle.Right for i in [0..widest-1] by 1
|
|
|
|
state.columns[i].handle = ResizableRegion.Handle.Left for i in [widest..state.columns.length-1] by 1
|
2015-02-21 05:17:11 +08:00
|
|
|
state
|
|
|
|
|
2015-04-25 02:33:10 +08:00
|
|
|
_pop: =>
|
2015-02-21 05:17:11 +08:00
|
|
|
Actions.popSheet()
|
2015-04-25 02:33:10 +08:00
|
|
|
|
feat(unsafe-components): Wrap injected components, catch exceptions, clean up ComponentRegistry
Summary:
This diff gives the ComponentRegistry a cleaner, smaller API. Instead of querying by name, location or role,
it's now just location and role, and you can register components for one or more location and one or more
roles without assigning the entries in the registry separate names.
When you register with the ComponentRegistry, the syntax is also cleaner and uses the component's displayName
instead of requiring you to provide a name. You also provide the actual component when unregistering, ensuring
that you can't unregister someone else's component.
InjectedComponent and InjectedComponentSet now wrap their children in UnsafeComponent, which prevents
render/component lifecycle problems from propogating.
Existing components have been updated:
1. maxWidth / minWidth are now containerStyles.maxWidth/minWidth
2. displayName is now required to use the CR.
3. containerRequired = false can be provided to exempt a component from being wrapped in an UnsafeComponent.
This is useful because it's slightly faster and keeps DOM flat.
This diff also makes the "Show Component Regions" more awesome. It displays column regions, since they now
use the InjectedComponentSet, and also shows for InjectedComponent as well as InjectedComponentSet.
Change ComponentRegistry syntax, lots more work on safely wrapping items. See description.
Fix for inline flexbox scenarios (message actions)
Allow ~/.inbox/packages to be symlinked to a github repo
Test Plan: Run tests!
Reviewers: evan
Reviewed By: evan
Differential Revision: https://review.inboxapp.com/D1457
2015-05-01 07:10:15 +08:00
|
|
|
module.exports = Sheet
|