@@ -9,7 +9,7 @@ import { getBase16Theme } from 'react-base16-styling';
9
9
import { reducer , updateMonitorState } from './redux' ;
10
10
import { ActionCreators } from 'redux-devtools' ;
11
11
12
- const { commit, sweep, toggleAction, jumpToAction, jumpToState } = ActionCreators ;
12
+ const { commit, sweep, toggleAction, jumpToAction, jumpToState, reorderAction } = ActionCreators ;
13
13
14
14
function getLastActionId ( props ) {
15
15
return props . stagedActionIds [ props . stagedActionIds . length - 1 ] ;
@@ -86,6 +86,7 @@ export default class DevtoolsInspector extends Component {
86
86
initialScrollTop : PropTypes . number
87
87
} ) ,
88
88
preserveScrollTop : PropTypes . bool ,
89
+ draggableActions : PropTypes . bool ,
89
90
stagedActions : PropTypes . array ,
90
91
select : PropTypes . func . isRequired ,
91
92
theme : PropTypes . oneOfType ( [
@@ -100,6 +101,7 @@ export default class DevtoolsInspector extends Component {
100
101
static defaultProps = {
101
102
select : ( state ) => state ,
102
103
supportImmutable : false ,
104
+ draggableActions : true ,
103
105
theme : 'inspector' ,
104
106
invertTheme : true
105
107
} ;
@@ -136,7 +138,9 @@ export default class DevtoolsInspector extends Component {
136
138
getCurrentActionId ( nextProps , nextMonitorState ) ||
137
139
monitorState . startActionId !== nextMonitorState . startActionId ||
138
140
monitorState . inspectedStatePath !== nextMonitorState . inspectedStatePath ||
139
- monitorState . inspectedActionPath !== nextMonitorState . inspectedActionPath
141
+ monitorState . inspectedActionPath !== nextMonitorState . inspectedActionPath ||
142
+ this . props . computedStates !== nextProps . computedStates ||
143
+ this . props . stagedActionIds !== nextProps . stagedActionIds
140
144
) {
141
145
this . setState ( createIntermediateState ( nextProps , nextMonitorState ) ) ;
142
146
}
@@ -148,7 +152,7 @@ export default class DevtoolsInspector extends Component {
148
152
}
149
153
150
154
render ( ) {
151
- const { stagedActionIds : actionIds , actionsById : actions , computedStates,
155
+ const { stagedActionIds : actionIds , actionsById : actions , computedStates, draggableActions ,
152
156
tabs, invertTheme, skippedActionIds, currentStateIndex, monitorState } = this . props ;
153
157
const { selectedActionId, startActionId, searchValue, tabName } = monitorState ;
154
158
const inspectedPathType = tabName === 'Action' ? 'inspectedActionPath' : 'inspectedStatePath' ;
@@ -162,16 +166,16 @@ export default class DevtoolsInspector extends Component {
162
166
ref = 'inspector'
163
167
{ ...styling ( [ 'inspector' , isWideLayout && 'inspectorWide' ] , isWideLayout ) } >
164
168
< ActionList { ...{
165
- actions, actionIds, isWideLayout, searchValue, selectedActionId, startActionId
169
+ actions, actionIds, isWideLayout, searchValue, selectedActionId, startActionId,
170
+ skippedActionIds, draggableActions, styling
166
171
} }
167
- styling = { styling }
168
172
onSearch = { this . handleSearch }
169
173
onSelect = { this . handleSelectAction }
170
174
onToggleAction = { this . handleToggleAction }
171
175
onJumpToState = { this . handleJumpToState }
172
176
onCommit = { this . handleCommit }
173
177
onSweep = { this . handleSweep }
174
- skippedActionIds = { skippedActionIds }
178
+ onReorderAction = { this . handleReorderAction }
175
179
currentActionId = { actionIds [ currentStateIndex ] }
176
180
lastActionId = { getLastActionId ( this . props ) } />
177
181
< ActionPreview { ...{
@@ -199,6 +203,10 @@ export default class DevtoolsInspector extends Component {
199
203
}
200
204
} ;
201
205
206
+ handleReorderAction = ( actionId , beforeActionId ) => {
207
+ if ( reorderAction ) this . props . dispatch ( reorderAction ( actionId , beforeActionId ) ) ;
208
+ } ;
209
+
202
210
handleCommit = ( ) => {
203
211
this . props . dispatch ( commit ( ) ) ;
204
212
} ;
0 commit comments