mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-11 23:24:32 +08:00
fix(multiselect-list): Only show loading dots when list source is empty
Fixes T1118
This commit is contained in:
parent
a5f05f52fd
commit
48574ddffa
3 changed files with 12 additions and 9 deletions
|
@ -240,7 +240,7 @@ class ComposerView extends React.Component
|
||||||
# If they're hidden, shift-tab between fields breaks.
|
# If they're hidden, shift-tab between fields breaks.
|
||||||
fields = []
|
fields = []
|
||||||
fields.push(
|
fields.push(
|
||||||
<div>
|
<div key="to">
|
||||||
<div className="composer-participant-actions">
|
<div className="composer-participant-actions">
|
||||||
<span className="header-action"
|
<span className="header-action"
|
||||||
style={display: @state.showcc and 'none' or 'inline'}
|
style={display: @state.showcc and 'none' or 'inline'}
|
||||||
|
@ -265,7 +265,6 @@ class ComposerView extends React.Component
|
||||||
</div>
|
</div>
|
||||||
<ParticipantsTextField
|
<ParticipantsTextField
|
||||||
ref="textFieldTo"
|
ref="textFieldTo"
|
||||||
key="to"
|
|
||||||
field='to'
|
field='to'
|
||||||
change={@_onChangeParticipants}
|
change={@_onChangeParticipants}
|
||||||
participants={to: @state['to'], cc: @state['cc'], bcc: @state['bcc']}
|
participants={to: @state['to'], cc: @state['cc'], bcc: @state['bcc']}
|
||||||
|
|
|
@ -97,11 +97,9 @@ class MultiselectList extends React.Component
|
||||||
# BAD: onSelect={ (item) -> Actions.focusThread(item) }
|
# BAD: onSelect={ (item) -> Actions.focusThread(item) }
|
||||||
# GOOD: onSelect={@_onSelectItem}
|
# GOOD: onSelect={@_onSelectItem}
|
||||||
#
|
#
|
||||||
className = @props.className
|
|
||||||
className += " ready" if @state.ready
|
|
||||||
|
|
||||||
otherProps = _.omit(@props, _.keys(@constructor.propTypes))
|
otherProps = _.omit(@props, _.keys(@constructor.propTypes))
|
||||||
|
|
||||||
|
className = @props.className
|
||||||
if @state.dataView and @state.handler
|
if @state.dataView and @state.handler
|
||||||
className += " " + @state.handler.cssClass()
|
className += " " + @state.handler.cssClass()
|
||||||
|
|
||||||
|
@ -117,9 +115,11 @@ class MultiselectList extends React.Component
|
||||||
emptyElement = []
|
emptyElement = []
|
||||||
if @props.emptyComponent
|
if @props.emptyComponent
|
||||||
emptyElement = <@props.emptyComponent
|
emptyElement = <@props.emptyComponent
|
||||||
visible={@state.ready && @state.dataView.count() is 0}
|
visible={@state.loaded and @state.empty}
|
||||||
dataView={@state.dataView} />
|
dataView={@state.dataView} />
|
||||||
|
|
||||||
|
spinnerElement = <Spinner visible={!@state.loaded and @state.empty} />
|
||||||
|
|
||||||
<div className={className} {...otherProps}>
|
<div className={className} {...otherProps}>
|
||||||
<ListTabular
|
<ListTabular
|
||||||
ref="list"
|
ref="list"
|
||||||
|
@ -130,12 +130,12 @@ class MultiselectList extends React.Component
|
||||||
itemHeight={@props.itemHeight}
|
itemHeight={@props.itemHeight}
|
||||||
onSelect={@_onClickItem}
|
onSelect={@_onClickItem}
|
||||||
onDoubleClick={@props.onDoubleClick} />
|
onDoubleClick={@props.onDoubleClick} />
|
||||||
<Spinner visible={!@state.ready} />
|
{spinnerElement}
|
||||||
{emptyElement}
|
{emptyElement}
|
||||||
</div>
|
</div>
|
||||||
else
|
else
|
||||||
<div className={className} {...otherProps}>
|
<div className={className} {...otherProps}>
|
||||||
<Spinner visible={@state.ready is false} />
|
<Spinner visible={true} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
_onClickItem: (item, event) =>
|
_onClickItem: (item, event) =>
|
||||||
|
@ -210,12 +210,13 @@ class MultiselectList extends React.Component
|
||||||
|
|
||||||
dataView: view
|
dataView: view
|
||||||
handler: handler
|
handler: handler
|
||||||
ready: view.loaded()
|
|
||||||
columns: props.columns
|
columns: props.columns
|
||||||
computedColumns: computedColumns
|
computedColumns: computedColumns
|
||||||
layoutMode: layoutMode
|
layoutMode: layoutMode
|
||||||
selectedIds: view.selection.ids()
|
selectedIds: view.selection.ids()
|
||||||
focusedId: FocusedContentStore.focusedId(props.collection)
|
focusedId: FocusedContentStore.focusedId(props.collection)
|
||||||
keyboardCursorId: FocusedContentStore.keyboardCursorId(props.collection)
|
keyboardCursorId: FocusedContentStore.keyboardCursorId(props.collection)
|
||||||
|
loaded: view.loaded()
|
||||||
|
empty: view.empty()
|
||||||
|
|
||||||
module.exports = MultiselectList
|
module.exports = MultiselectList
|
||||||
|
|
|
@ -30,6 +30,9 @@ class ModelView
|
||||||
return false
|
return false
|
||||||
true
|
true
|
||||||
|
|
||||||
|
empty: ->
|
||||||
|
@count() <= 0
|
||||||
|
|
||||||
get: (idx) ->
|
get: (idx) ->
|
||||||
unless _.isNumber(idx)
|
unless _.isNumber(idx)
|
||||||
throw new Error("ModelView.get() takes a numeric index. Maybe you meant getById()?")
|
throw new Error("ModelView.get() takes a numeric index. Maybe you meant getById()?")
|
||||||
|
|
Loading…
Add table
Reference in a new issue