1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | 'use strict';
|
8 |
|
9 | Object.defineProperty(exports, '__esModule', {
|
10 | value: true
|
11 | });
|
12 |
|
13 | var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
|
14 |
|
15 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
16 |
|
17 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
|
18 |
|
19 | var _blessed = require('blessed');
|
20 |
|
21 | var _blessed2 = _interopRequireDefault(_blessed);
|
22 |
|
23 | var _ReactBlessedIDOperations = require('./ReactBlessedIDOperations');
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | var _ReactBlessedIDOperations2 = _interopRequireDefault(_ReactBlessedIDOperations);
|
32 |
|
33 | var ReactBlessedTextComponent = (function () {
|
34 | function ReactBlessedTextComponent(props) {
|
35 | _classCallCheck(this, ReactBlessedTextComponent);
|
36 | }
|
37 |
|
38 | |
39 |
|
40 |
|
41 |
|
42 |
|
43 | _createClass(ReactBlessedTextComponent, [{
|
44 | key: 'construct',
|
45 | value: function construct(text) {
|
46 | this._currentElement = text;
|
47 | this._rootNodeID = null;
|
48 | this._stringText = '' + text;
|
49 | }
|
50 |
|
51 | |
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 | }, {
|
60 | key: 'mountComponent',
|
61 | value: function mountComponent(rootID, transaction, context) {
|
62 | this._rootNodeID = rootID;
|
63 |
|
64 | var parent = _ReactBlessedIDOperations2['default'].getParent(rootID);
|
65 |
|
66 |
|
67 | parent.setContent(this._stringText);
|
68 | }
|
69 |
|
70 | |
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 | }, {
|
78 | key: 'receiveComponent',
|
79 | value: function receiveComponent(nextText, transaction) {
|
80 | this._currentElement = nextText;
|
81 | var nextStringText = '' + nextText;
|
82 |
|
83 | if (nextStringText !== this._stringText) {
|
84 |
|
85 | this._stringText = nextStringText;
|
86 |
|
87 | var _parent = _ReactBlessedIDOperations2['default'].getParent(this._rootNodeID);
|
88 |
|
89 |
|
90 | _parent.setContent(this._stringText);
|
91 | }
|
92 | }
|
93 |
|
94 | |
95 |
|
96 |
|
97 | }, {
|
98 | key: 'unmountComponent',
|
99 | value: function unmountComponent() {
|
100 | var parent = _ReactBlessedIDOperations2['default'].getParent(this._rootNodeID);
|
101 |
|
102 |
|
103 | parent.setContent('');
|
104 | }
|
105 | }]);
|
106 |
|
107 | return ReactBlessedTextComponent;
|
108 | })();
|
109 |
|
110 | exports['default'] = ReactBlessedTextComponent;
|
111 | module.exports = exports['default']; |
\ | No newline at end of file |