dtable-ui-component 0.1.94-test5 → 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.
@@ -12,9 +12,27 @@ var ButtonFormatter = /*#__PURE__*/function (_React$Component) {
12
12
  var _super = _createSuper(ButtonFormatter);
13
13
 
14
14
  function ButtonFormatter() {
15
+ var _this;
16
+
15
17
  _classCallCheck(this, ButtonFormatter);
16
18
 
17
- return _super.apply(this, arguments);
19
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
20
+ args[_key] = arguments[_key];
21
+ }
22
+
23
+ _this = _super.call.apply(_super, [this].concat(args));
24
+
25
+ _this.handleClick = function () {
26
+ var _this$props$data = _this.props.data,
27
+ button_type = _this$props$data.button_type,
28
+ url_address = _this$props$data.url_address;
29
+
30
+ if (button_type == 'open_url' && url_address) {
31
+ window.open(url_address);
32
+ }
33
+ };
34
+
35
+ return _this;
18
36
  }
19
37
 
20
38
  _createClass(ButtonFormatter, [{
@@ -45,7 +63,8 @@ var ButtonFormatter = /*#__PURE__*/function (_React$Component) {
45
63
  };
46
64
  return /*#__PURE__*/React.createElement("div", {
47
65
  className: cn('dtable-ui cell-formatter-container button-formatter', containerClassName),
48
- style: btnStyle
66
+ style: btnStyle,
67
+ onClick: this.handleClick
49
68
  }, button_name);
50
69
  }
51
70
  }]);
@@ -73,7 +73,7 @@ var CollaboratorEditor = /*#__PURE__*/function (_React$Component) {
73
73
  _this.onCommit = function (newValue) {
74
74
  var updated = {};
75
75
  var column = _this.props.column;
76
- updated[column.key] = newValue;
76
+ updated[column.name] = newValue;
77
77
 
78
78
  _this.props.onCommit(updated);
79
79
  };
@@ -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 column = _this.props.column;
24
- var newValue = _this.state.newValue;
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 isReadOnly = this.props.isReadOnly;
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
- value: this.state.newValue,
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "0.1.94-test5",
3
+ "version": "0.1.94-test8",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "0.0.9",