@@ -18,24 +18,59 @@ var React = require('react');
1818var react_redux_1 = require ( 'react-redux' ) ;
1919var Stepper_1 = require ( 'material-ui/Stepper' ) ;
2020var index_1 = require ( '../../index' ) ;
21- var AddButton_1 = require ( '../AddButton' ) ;
2221var task_object_1 = require ( './task-object' ) ;
2322var actions_1 = require ( '../../../actions' ) ;
23+ var TextField_1 = require ( 'material-ui/TextField' ) ;
24+ var SelectField_1 = require ( 'material-ui/SelectField' ) ;
25+ var MenuItem_1 = require ( 'material-ui/MenuItem' ) ;
26+ var styles = {
27+ form : {
28+ margin : '10px 15px' ,
29+ display : 'inline-block' ,
30+ } ,
31+ select : {
32+ width : 150 ,
33+ } ,
34+ } ;
2435var TaskActions = ( function ( _super ) {
2536 __extends ( TaskActions , _super ) ;
2637 function TaskActions ( props ) {
2738 _super . call ( this , props ) ;
2839 this . state = {
2940 stepIndex : 0 ,
41+ as : {
42+ action : null ,
43+ content : '' ,
44+ }
3045 } ;
3146 }
47+ TaskActions . prototype . handleSelect = function ( event , index , value ) {
48+ this . setState ( {
49+ stepIndex : this . state . stepIndex ,
50+ as : {
51+ action : value ,
52+ content : this . state . as . content
53+ }
54+ } ) ;
55+ } ;
56+ TaskActions . prototype . handleText = function ( event ) {
57+ console . log ( event ) ;
58+ this . setState ( {
59+ stepIndex : this . state . stepIndex ,
60+ as : {
61+ action : this . state . as . action ,
62+ content : event . target . value ,
63+ }
64+ } ) ;
65+ } ;
3266 TaskActions . prototype . render = function ( ) {
3367 var _this = this ;
3468 var _a = this . props , actions = _a . actions , addAction = _a . addAction ;
3569 var stepIndex = this . state . stepIndex ;
3670 var actionList = actions . map ( function ( a ) { return task_object_1 . default ( a ) ; } ) ;
37- return ( React . createElement ( Stepper_1 . Stepper , { activeStep : stepIndex , linear : false , orientation : 'vertical' } , actionList . map ( function ( a , index ) { return ( React . createElement ( Stepper_1 . Step , null , React . createElement ( Stepper_1 . StepButton , { onClick : function ( ) { return _this . setState ( { stepIndex : index } ) ; } } , a . action + ( a . singleLine ? ' ' + a . content : '' ) ) , React . createElement ( Stepper_1 . StepContent , null , a . singleLine ? ''
38- : React . createElement ( index_1 . Markdown , null , '```js\n' + a . content + '\n```' ) ) ) ) ; } ) , React . createElement ( AddButton_1 . default , { callback : addAction . bind ( this , 'test(`test`)' ) } ) ) ) ;
71+ return ( React . createElement ( Stepper_1 . Stepper , { activeStep : stepIndex , linear : false , orientation : 'vertical' } , actionList . map ( function ( a , index ) { return ( React . createElement ( Stepper_1 . Step , null , React . createElement ( Stepper_1 . StepButton , { onClick : function ( ) { return _this . setState ( {
72+ stepIndex : index , as : _this . state . as } ) ; } } , a . action + ( a . singleLine ? ' ' + a . content : '' ) ) , React . createElement ( Stepper_1 . StepContent , null , a . singleLine ? ''
73+ : React . createElement ( index_1 . Markdown , null , '```js\n' + a . content + '\n```' ) ) ) ) ; } ) , React . createElement ( "span" , { style : styles . form } , React . createElement ( SelectField_1 . default , { value : this . state . as . action , onChange : this . handleSelect . bind ( this ) , style : styles . select } , React . createElement ( MenuItem_1 . default , { value : 'open' , primaryText : 'open' } ) , React . createElement ( MenuItem_1 . default , { value : 'set' , primaryText : 'set' } ) , React . createElement ( MenuItem_1 . default , { value : 'set' , primaryText : 'insert' } ) ) , React . createElement ( TextField_1 . default , { hintText : 'Content' , value : this . state . as . content , onChange : this . handleText . bind ( this ) } ) ) ) ) ;
3974 } ;
4075 TaskActions = __decorate ( [
4176 react_redux_1 . connect ( null , function ( dispatch ) {
0 commit comments