dtable-ui-component 0.1.94-test7 → 0.1.94-test8
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.
- package/lib/TextEditor/index.js +18 -18
- package/package.json +1 -1
package/lib/TextEditor/index.js
CHANGED
|
@@ -18,25 +18,24 @@ var TextEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
18
18
|
|
|
19
19
|
_this = _super.call(this, props);
|
|
20
20
|
|
|
21
|
-
_this.onCommit = function () {
|
|
21
|
+
_this.onCommit = function (newValue) {
|
|
22
22
|
var updated = {};
|
|
23
|
-
var
|
|
24
|
-
|
|
23
|
+
var _this$props = _this.props,
|
|
24
|
+
column = _this$props.column,
|
|
25
|
+
value = _this$props.value;
|
|
26
|
+
|
|
27
|
+
if (newValue == value) {
|
|
28
|
+
return;
|
|
29
|
+
} //let { newValue } = this.state;
|
|
30
|
+
|
|
31
|
+
|
|
25
32
|
updated[column.name] = newValue ? newValue.trim() : '';
|
|
26
33
|
|
|
27
34
|
_this.props.onCommit(updated);
|
|
28
35
|
};
|
|
29
36
|
|
|
30
|
-
_this.onBlur = function () {
|
|
31
|
-
_this.onCommit();
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
_this.onChange = function (event) {
|
|
35
|
-
var value = event.target.value;
|
|
36
|
-
|
|
37
|
-
_this.setState({
|
|
38
|
-
newValue: value
|
|
39
|
-
});
|
|
37
|
+
_this.onBlur = function (e) {
|
|
38
|
+
_this.onCommit(e.target.value);
|
|
40
39
|
};
|
|
41
40
|
|
|
42
41
|
_this.onKeyDown = function (event) {
|
|
@@ -65,8 +64,7 @@ var TextEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
65
64
|
_this.input = input;
|
|
66
65
|
};
|
|
67
66
|
|
|
68
|
-
_this.state = {
|
|
69
|
-
newValue: props.value
|
|
67
|
+
_this.state = {//newValue: props.value
|
|
70
68
|
};
|
|
71
69
|
return _this;
|
|
72
70
|
}
|
|
@@ -74,7 +72,10 @@ var TextEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
74
72
|
_createClass(TextEditor, [{
|
|
75
73
|
key: "render",
|
|
76
74
|
value: function render() {
|
|
77
|
-
var
|
|
75
|
+
var _this$props2 = this.props,
|
|
76
|
+
isReadOnly = _this$props2.isReadOnly,
|
|
77
|
+
value = _this$props2.value; //onChange={this.onChange}
|
|
78
|
+
|
|
78
79
|
return /*#__PURE__*/React.createElement("div", {
|
|
79
80
|
className: "cell-editor text-editor"
|
|
80
81
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -82,9 +83,8 @@ var TextEditor = /*#__PURE__*/function (_React$Component) {
|
|
|
82
83
|
}, /*#__PURE__*/React.createElement(Input, {
|
|
83
84
|
ref: this.setInputRef,
|
|
84
85
|
type: "text",
|
|
85
|
-
|
|
86
|
+
defaultValue: value,
|
|
86
87
|
readOnly: isReadOnly,
|
|
87
|
-
onChange: this.onChange,
|
|
88
88
|
onKeyDown: this.onKeyDown,
|
|
89
89
|
onBlur: this.onBlur,
|
|
90
90
|
onCut: this.onCut,
|