|
148 | 148 |
|
149 | 149 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
|
150 | 150 |
|
151 |
| - Object.defineProperty(exports, "__esModule", { |
152 |
| - value: true |
153 |
| - }); |
154 |
| - |
155 | 151 | var _createClass = function () {
|
156 | 152 | function defineProperties(target, props) {
|
157 | 153 | for (var i = 0; i < props.length; i++) {
|
|
162 | 158 | };
|
163 | 159 | }();
|
164 | 160 |
|
| 161 | + Object.defineProperty(exports, "__esModule", { |
| 162 | + value: true |
| 163 | + }); |
| 164 | + |
165 | 165 | var _react = __webpack_require__(2);
|
166 | 166 |
|
167 | 167 | var _react2 = _interopRequireDefault(_react);
|
|
282 | 282 | }, {
|
283 | 283 | key: 'render',
|
284 | 284 | value: function render() {
|
285 |
| - if (!this.state.editing) { |
| 285 | + if (this.props.isDisabled) { |
| 286 | + var Element = this.props.element || this.props.staticElement; |
| 287 | + return _react2.default.createElement(Element, { |
| 288 | + className: this.props.className, |
| 289 | + style: this.props.style }, this.state.text || this.props.placeholder); |
| 290 | + } else if (!this.state.editing) { |
286 | 291 | var Element = this.props.element || this.props.staticElement;
|
287 | 292 | return _react2.default.createElement(Element, {
|
288 | 293 | className: this.props.className,
|
289 | 294 | onClick: this.startEditing,
|
290 | 295 | tabIndex: this.props.tabIndex,
|
291 | 296 | style: this.props.style }, this.state.text || this.props.placeholder);
|
292 | 297 | } else {
|
293 |
| -<<<<<<< HEAD |
294 |
| - var _Element = this.props.element || this.props.editingElement; |
295 |
| - return _react2.default.createElement(_Element, { |
296 |
| -======= |
297 | 298 | var Element = this.props.element || this.props.editingElement;
|
298 | 299 | return _react2.default.createElement(Element, {
|
299 |
| ->>>>>>> b141e64... Add stopPropagation option |
300 | 300 | onClick: this.clickWhenEditing,
|
301 | 301 | onKeyDown: this.keyDown,
|
302 | 302 | onBlur: this.finishEditing,
|
|
327 | 327 | style: _react2.default.PropTypes.object,
|
328 | 328 | editingElement: _react2.default.PropTypes.string,
|
329 | 329 | staticElement: _react2.default.PropTypes.string,
|
330 |
| - tabIndex: _react2.default.PropTypes.number |
| 330 | + tabIndex: _react2.default.PropTypes.number, |
| 331 | + isDisabled: _react2.default.PropTypes.bool |
331 | 332 | };
|
332 | 333 | InlineEdit.defaultProps = {
|
333 | 334 | minLength: 1,
|
334 | 335 | maxLength: 256,
|
335 | 336 | editingElement: 'input',
|
336 | 337 | staticElement: 'span',
|
337 |
| - tabIndex: 0 |
| 338 | + tabIndex: 0, |
| 339 | + isDisabled: false |
338 | 340 | };
|
339 | 341 | exports.default = InlineEdit;
|
340 | 342 |
|
|
0 commit comments