|
1 | 1 | "use strict";
|
| 2 | +var __extends = (this && this.__extends) || function (d, b) { |
| 3 | + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; |
| 4 | + function __() { this.constructor = d; } |
| 5 | + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); |
| 6 | +}; |
2 | 7 | var React = require('react');
|
3 | 8 | var Stepper_1 = require('material-ui/Stepper');
|
4 | 9 | var index_1 = require('../../index');
|
5 |
| -var TaskActions = function (_a) { |
6 |
| - var actions = _a.actions; |
7 |
| - var actionsList = actions.map(function (a) { |
8 |
| - return { |
9 |
| - action: a.substring(0, a.indexOf('(')), |
10 |
| - content: a.substring(a.indexOf('(') + 2, a.length - 2) |
| 10 | +var TaskActions = (function (_super) { |
| 11 | + __extends(TaskActions, _super); |
| 12 | + function TaskActions(props) { |
| 13 | + _super.call(this, props); |
| 14 | + this.state = { |
| 15 | + stepIndex: 0, |
11 | 16 | };
|
12 |
| - }); |
13 |
| - return (React.createElement(index_1.DynamicStepper, {status: actions.map(function (action) { return false; })}, actionsList.map(function (a) { return (React.createElement(Stepper_1.Step, null, React.createElement(Stepper_1.StepLabel, null, a.action), React.createElement(Stepper_1.StepContent, null, React.createElement("p", null, a.content)))); }))); |
14 |
| -}; |
| 17 | + } |
| 18 | + TaskActions.prototype.render = function () { |
| 19 | + var _this = this; |
| 20 | + var actions = this.props.actions; |
| 21 | + var stepIndex = this.state.stepIndex; |
| 22 | + var actionList = actions.map(function (a) { |
| 23 | + var obj = { |
| 24 | + action: a.substring(0, a.indexOf('(')), |
| 25 | + content: a.substring(a.indexOf('(') + 2, a.length - 2) |
| 26 | + }; |
| 27 | + if (obj.action === 'open') { |
| 28 | + obj.singleLine = true; |
| 29 | + } |
| 30 | + return obj; |
| 31 | + }); |
| 32 | + 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 ? '' |
| 33 | + : React.createElement(index_1.Markdown, null, a.content)))); }))); |
| 34 | + }; |
| 35 | + return TaskActions; |
| 36 | +}(React.Component)); |
15 | 37 | Object.defineProperty(exports, "__esModule", { value: true });
|
16 | 38 | exports.default = TaskActions;
|
0 commit comments