dtable-ui-component 0.1.93 → 0.1.94-test

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,7 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
6
  import isHotkey from 'is-hotkey';
7
+ import { Input } from 'reactstrap';
7
8
 
8
9
  var TextEditor = /*#__PURE__*/function (_React$Component) {
9
10
  _inherits(TextEditor, _React$Component);
@@ -24,10 +25,6 @@ var TextEditor = /*#__PURE__*/function (_React$Component) {
24
25
  updated[column.key] = newValue ? newValue.trim() : '';
25
26
 
26
27
  _this.props.onCommit(updated);
27
-
28
- _this.setState({
29
- isEditorShow: false
30
- });
31
28
  };
32
29
 
33
30
  _this.onBlur = function () {
@@ -42,18 +39,6 @@ var TextEditor = /*#__PURE__*/function (_React$Component) {
42
39
  });
43
40
  };
44
41
 
45
- _this.onEditorHandle = function () {
46
- if (_this.props.isReadOnly) {
47
- return;
48
- }
49
-
50
- _this.setState({
51
- isEditorShow: true
52
- }, function () {
53
- _this.input.focus();
54
- });
55
- };
56
-
57
42
  _this.onKeyDown = function (event) {
58
43
  var _event$currentTarget = event.currentTarget,
59
44
  selectionStart = _event$currentTarget.selectionStart,
@@ -82,8 +67,7 @@ var TextEditor = /*#__PURE__*/function (_React$Component) {
82
67
  };
83
68
 
84
69
  _this.state = {
85
- newValue: props.value,
86
- isEditorShow: false
70
+ newValue: props.value
87
71
  };
88
72
  return _this;
89
73
  }
@@ -91,18 +75,16 @@ var TextEditor = /*#__PURE__*/function (_React$Component) {
91
75
  _createClass(TextEditor, [{
92
76
  key: "render",
93
77
  value: function render() {
78
+ var isReadOnly = this.props.isReadOnly;
94
79
  return /*#__PURE__*/React.createElement("div", {
95
80
  className: "cell-editor text-editor"
96
81
  }, /*#__PURE__*/React.createElement("div", {
97
82
  className: "text-editor-container"
98
- }, !this.state.isEditorShow && /*#__PURE__*/React.createElement("div", {
99
- className: "form-control",
100
- onClick: this.onEditorHandle
101
- }, this.state.newValue), this.state.isEditorShow && /*#__PURE__*/React.createElement("input", {
83
+ }, /*#__PURE__*/React.createElement(Input, {
102
84
  ref: this.setInputRef,
103
85
  type: "text",
104
- className: "form-control",
105
86
  value: this.state.newValue,
87
+ readOnly: isReadOnly,
106
88
  onChange: this.onChange,
107
89
  onKeyDown: this.onKeyDown,
108
90
  onBlur: this.onBlur,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "0.1.93",
3
+ "version": "0.1.94-test",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "0.0.9",