dtable-ui-component 4.3.6 → 4.3.7

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.
@@ -36,16 +36,12 @@
36
36
  border-color: rgb(179, 179, 179);
37
37
  }
38
38
 
39
- .dtable-select .select-option-name {
40
- color: #212529;
41
- }
42
-
43
39
  .dtable-select .dtable-icon-drop-down {
44
40
  display: inline-block;
45
41
  font-size: 12px;
46
- color: #949494;
47
- transform: scale(.8) translateY(2px);
48
- transition: all .1s;
42
+ color: #999;
43
+ transform: scale(0.8) translateY(2px);
44
+ transition: all 0.1s;
49
45
  }
50
46
 
51
47
  .dtable-select .dtable-icon-drop-down:hover {
@@ -62,67 +58,34 @@
62
58
  background: #fff;
63
59
  }
64
60
 
65
- .dtable-select .option-group {
66
- position: absolute;
67
- left: 0;
68
- min-height: 60px;
69
- max-height: 300px;
70
- min-width: 100%;
71
- max-width: 15rem;
72
- padding: .5rem 0;
73
- box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
74
- background: #fff;
75
- border: 1px solid rgba(0, 40, 100, 0.12);
76
- border-radius: 3px;
77
- z-index: 10001;
78
- }
79
-
80
- .dtable-select .option-group .option-group-search {
81
- width: 100%;
82
- padding: 0 10px 6px 10px;
83
- min-width: 170px;
84
- }
85
-
86
- .dtable-select .option-group-search .form-control {
87
- height: 31px;
61
+ .dtable-select.selector-collaborator .option-group .option-group-content,
62
+ .dtable-select.selector-group .option-group .option-group-content {
63
+ padding: 10px;
88
64
  }
89
65
 
90
- .dtable-select .option-group .none-search-result {
91
- height: 100px;
92
- width: 100%;
93
- padding: 10px;
94
- opacity: .5;
66
+ .dtable-select.custom-select.selector-collaborator .option-group .option-group-content {
67
+ padding: 10px 0;
95
68
  }
96
69
 
97
- .dtable-select .option-group .option-group-content {
98
- max-height: 252px;
99
- overflow-y: auto;
70
+ .dtable-select.custom-select.selector-collaborator .option {
71
+ padding: 5px 0 5px 10px !important;
72
+ line-height: 20px;
100
73
  }
101
74
 
102
- .dtable-select .option {
103
- display: block;
104
- width: 100%;
105
- line-height: 24px;
106
- padding: .25rem 10px;
107
- clear: both;
108
- font-weight: 400;
109
- color: #212529;
110
- text-align: inherit;
111
- background-color: transparent;
112
- border: 0;
113
- overflow: hidden;
114
- text-overflow: ellipsis;
115
- white-space: nowrap;
75
+ .dtable-select.selector-group .option {
76
+ height: 30px;
77
+ display: flex;
78
+ align-items: center;
116
79
  }
117
80
 
118
- .dtable-select .option.option-active {
119
- background-color: #20a0ff;
120
- color: #fff;
121
- cursor: pointer;
81
+ .dtable-select.selector-group .select-group-option {
82
+ justify-content: space-between;
122
83
  }
123
84
 
124
- .dtable-select .option.option-active .select-option-name {
125
- color: #fff;
85
+ .dtable-select.selector-group .selected-option .selected-group {
86
+ padding: 0 2px;
87
+ background: #eceff4;
88
+ border-radius: 3px;
126
89
  }
127
90
 
128
91
  .dtable-select .selected-option-show {
@@ -134,6 +97,6 @@
134
97
  .dtable-select .select-placeholder {
135
98
  line-height: 1;
136
99
  font-size: 14px;
137
- color: #949494;
100
+ color: #999;
138
101
  white-space: nowrap;
139
102
  }
@@ -5,6 +5,7 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React, { Component } from 'react';
6
6
  import SelectOptionGroup from '../SelectOptionGroup';
7
7
  import classnames from 'classnames';
8
+ import ModalPortal from '../common/modal-portal';
8
9
  import './index.css';
9
10
  var DTableCustomizeSelect = /*#__PURE__*/function (_Component) {
10
11
  _inherits(DTableCustomizeSelect, _Component);
@@ -19,7 +20,7 @@ var DTableCustomizeSelect = /*#__PURE__*/function (_Component) {
19
20
  if select is showing, click events do not need to be monitored by other click events,
20
21
  so it can be closed when other select is clicked.
21
22
  */
22
- if (_this.state.isShowSelectOptions) event.nativeEvent.stopImmediatePropagation();
23
+ if (_this.state.isShowSelectOptions) event.stopPropagation();
23
24
  var eventClassName = event.target.className;
24
25
  if (_this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === 'option-group-search') return;
25
26
  //Prevent closing by pressing the spacebar in the search input
@@ -28,7 +29,7 @@ var DTableCustomizeSelect = /*#__PURE__*/function (_Component) {
28
29
  isShowSelectOptions: !_this.state.isShowSelectOptions
29
30
  });
30
31
  };
31
- _this.onMousedown = function (event) {
32
+ _this.onClick = function (event) {
32
33
  if (_this.props.isShowSelected && event.target.className.includes('icon-fork-number')) {
33
34
  return;
34
35
  }
@@ -61,6 +62,12 @@ var DTableCustomizeSelect = /*#__PURE__*/function (_Component) {
61
62
  return name.toLowerCase().indexOf(validSearchVal) > -1;
62
63
  }
63
64
  if (typeof value === 'object') {
65
+ if (value.column) {
66
+ return value.column.name.toLowerCase().indexOf(validSearchVal) > -1;
67
+ }
68
+ if (value.name) {
69
+ return value.name.toLowerCase().indexOf(validSearchVal) > -1;
70
+ }
64
71
  return value.columnOption && value.columnOption.name.toLowerCase().indexOf(validSearchVal) > -1;
65
72
  }
66
73
  return false;
@@ -72,16 +79,6 @@ var DTableCustomizeSelect = /*#__PURE__*/function (_Component) {
72
79
  return _this;
73
80
  }
74
81
  _createClass(DTableCustomizeSelect, [{
75
- key: "componentDidMount",
76
- value: function componentDidMount() {
77
- document.addEventListener('mousedown', this.onMousedown);
78
- }
79
- }, {
80
- key: "componentWillUnmount",
81
- value: function componentWillUnmount() {
82
- document.removeEventListener('mousedown', this.onMousedown);
83
- }
84
- }, {
85
82
  key: "render",
86
83
  value: function render() {
87
84
  var _this2 = this;
@@ -93,7 +90,8 @@ var DTableCustomizeSelect = /*#__PURE__*/function (_Component) {
93
90
  searchable = _this$props2.searchable,
94
91
  searchPlaceholder = _this$props2.searchPlaceholder,
95
92
  noOptionsPlaceholder = _this$props2.noOptionsPlaceholder,
96
- isLocked = _this$props2.isLocked;
93
+ isLocked = _this$props2.isLocked,
94
+ isInModal = _this$props2.isInModal;
97
95
  return /*#__PURE__*/React.createElement("div", {
98
96
  ref: function ref(node) {
99
97
  return _this2.selector = node;
@@ -106,25 +104,42 @@ var DTableCustomizeSelect = /*#__PURE__*/function (_Component) {
106
104
  onClick: this.onSelectToggle
107
105
  }, /*#__PURE__*/React.createElement("div", {
108
106
  className: "selected-option"
109
- }, value.label ? /*#__PURE__*/React.createElement("span", {
107
+ }, value && value.label ? /*#__PURE__*/React.createElement("span", {
110
108
  className: "selected-option-show"
111
109
  }, value.label) : /*#__PURE__*/React.createElement("span", {
112
110
  className: "select-placeholder"
113
111
  }, placeholder), !isLocked && /*#__PURE__*/React.createElement("i", {
114
112
  className: "dtable-font dtable-icon-drop-down"
115
- })), this.state.isShowSelectOptions && /*#__PURE__*/React.createElement(SelectOptionGroup, {
113
+ })), this.state.isShowSelectOptions && !isInModal && /*#__PURE__*/React.createElement(SelectOptionGroup, {
114
+ value: value,
115
+ isShowSelected: this.props.isShowSelected,
116
+ top: this.getSelectedOptionTop(),
117
+ options: options,
118
+ onSelectOption: this.props.onSelectOption,
119
+ searchable: searchable,
120
+ searchPlaceholder: searchPlaceholder,
121
+ noOptionsPlaceholder: noOptionsPlaceholder,
122
+ onClickOutside: this.onClick,
123
+ closeSelect: this.closeSelect,
124
+ getFilterOptions: this.getFilterOptions,
125
+ supportMultipleSelect: this.props.supportMultipleSelect
126
+ }), this.state.isShowSelectOptions && isInModal && /*#__PURE__*/React.createElement(ModalPortal, null, /*#__PURE__*/React.createElement(SelectOptionGroup, {
127
+ className: className,
116
128
  value: value,
117
129
  isShowSelected: this.props.isShowSelected,
130
+ position: this.selector.getBoundingClientRect(),
131
+ isInModal: isInModal,
118
132
  top: this.getSelectedOptionTop(),
119
133
  options: options,
120
134
  onSelectOption: this.props.onSelectOption,
121
135
  searchable: searchable,
122
136
  searchPlaceholder: searchPlaceholder,
123
137
  noOptionsPlaceholder: noOptionsPlaceholder,
138
+ onClickOutside: this.onClick,
124
139
  closeSelect: this.closeSelect,
125
140
  getFilterOptions: this.getFilterOptions,
126
141
  supportMultipleSelect: this.props.supportMultipleSelect
127
- }));
142
+ })));
128
143
  }
129
144
  }]);
130
145
  return DTableCustomizeSelect;
@@ -0,0 +1,103 @@
1
+ .option-group {
2
+ position: absolute;
3
+ left: 0;
4
+ min-height: 60px;
5
+ max-height: 300px;
6
+ min-width: 100%;
7
+ max-width: 15rem;
8
+ padding: 0.5rem 0;
9
+ box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
10
+ background: #fff;
11
+ border: 1px solid rgba(0, 40, 100, 0.12);
12
+ border-radius: 3px;
13
+ z-index: 10001;
14
+ }
15
+
16
+ .option-group .option-group-search {
17
+ width: 100%;
18
+ padding: 0 10px 6px 10px;
19
+ min-width: 170px;
20
+ }
21
+
22
+ .option-group-search .form-control {
23
+ height: 31px;
24
+ }
25
+
26
+ .option-group .none-search-result {
27
+ height: 100px;
28
+ width: 100%;
29
+ padding: 10px;
30
+ opacity: 0.5;
31
+ }
32
+
33
+ .option-group .option-group-content {
34
+ max-height: 252px;
35
+ overflow-y: auto;
36
+ }
37
+
38
+ .option {
39
+ display: block;
40
+ width: 100%;
41
+ line-height: 24px;
42
+ padding: 0.25rem 10px;
43
+ clear: both;
44
+ font-weight: 400;
45
+ text-align: inherit;
46
+ background-color: transparent;
47
+ border: 0;
48
+ overflow: hidden;
49
+ text-overflow: ellipsis;
50
+ white-space: nowrap;
51
+ }
52
+
53
+ .option.option-active {
54
+ background-color: #20a0ff;
55
+ color: #fff;
56
+ cursor: pointer;
57
+ }
58
+
59
+ .option:hover .header-icon .dtable-font,
60
+ .option.option-active .select-option-name {
61
+ color: #fff;
62
+ }
63
+
64
+ .option.option-active .header-icon .dtable-font {
65
+ color: #fff;
66
+ }
67
+
68
+ .option:not(.option-active):hover .header-icon .dtable-font {
69
+ color: #aaa;
70
+ }
71
+
72
+ .option .select-option-name .single-select-option {
73
+ margin: 0 0 0 12px;
74
+ }
75
+
76
+ .option .select-option-name .multiple-select-option {
77
+ margin: 0;
78
+ }
79
+
80
+ .option-group-selector-single-select .select-option-name,
81
+ .option-group-selector-multiple-select .multiple-option-name {
82
+ display: flex;
83
+ align-items: center;
84
+ justify-content: space-between;
85
+ }
86
+
87
+ .option-group-selector-multiple-select .multiple-check-icon {
88
+ display: inline-flex;
89
+ width: 20px;
90
+ text-align: center;
91
+ }
92
+
93
+ .option-group-selector-multiple-select .multiple-check-icon .dtable-icon-check-mark {
94
+ font-size: 12px;
95
+ color: #798d99;
96
+ }
97
+
98
+ .option-group-selector-single-select .option:hover,
99
+ .option-group-selector-single-select .option.option-active,
100
+ .option-group-selector-multiple-select .option:hover,
101
+ .option-group-selector-multiple-select .option.option-active {
102
+ background-color: #f7f7f7;
103
+ }
@@ -6,6 +6,8 @@ import React, { Component } from 'react';
6
6
  import Option from './option';
7
7
  import DTableSearchInput from '../DTableSearchInput';
8
8
  import KeyCodes from './KeyCodes';
9
+ import ClickOutside from '../common/ClickOutside';
10
+ import './index.css';
9
11
  var OPTION_HEIGHT = 32;
10
12
  var SelectOptionGroup = /*#__PURE__*/function (_Component) {
11
13
  _inherits(SelectOptionGroup, _Component);
@@ -15,12 +17,22 @@ var SelectOptionGroup = /*#__PURE__*/function (_Component) {
15
17
  _classCallCheck(this, SelectOptionGroup);
16
18
  _this = _super.call(this, props);
17
19
  _this.resetMenuStyle = function () {
20
+ var _this$props = _this.props,
21
+ isInModal = _this$props.isInModal,
22
+ position = _this$props.position;
18
23
  var _this$optionGroupRef$ = _this.optionGroupRef.getBoundingClientRect(),
19
24
  top = _this$optionGroupRef$.top,
20
25
  height = _this$optionGroupRef$.height;
21
- if (height + top > window.innerHeight) {
22
- var borderWidth = 2;
23
- _this.optionGroupRef.style.top = -1 * (height + borderWidth) + 'px';
26
+ if (isInModal) {
27
+ if (position.y + position.height + height > window.innerHeight) {
28
+ _this.optionGroupRef.style.top = position.y - height + 'px';
29
+ }
30
+ _this.optionGroupRef.style.opacity = 1;
31
+ } else {
32
+ if (height + top > window.innerHeight) {
33
+ var borderWidth = 2;
34
+ _this.optionGroupRef.style.top = -1 * (height + borderWidth) + 'px';
35
+ }
24
36
  }
25
37
  };
26
38
  _this.onHotKey = function (event) {
@@ -59,15 +71,22 @@ var SelectOptionGroup = /*#__PURE__*/function (_Component) {
59
71
  });
60
72
  }
61
73
  };
62
- _this.onClick = function (e) {
63
- if (_this.props.stopClickEvent && _this.optionGroupRef.contains(e.target) && !e.target.className.includes('dtable-font')) {
64
- e.stopPropagation();
65
- }
66
- };
67
74
  _this.scrollContent = function () {
68
75
  var _this$optionGroupCont = _this.optionGroupContentRef,
69
76
  offsetHeight = _this$optionGroupCont.offsetHeight,
70
77
  scrollTop = _this$optionGroupCont.scrollTop;
78
+ _this.setState({
79
+ disableHover: true
80
+ });
81
+ _this.timer = setTimeout(function () {
82
+ _this.setState({
83
+ disableHover: false
84
+ });
85
+ }, 500);
86
+ if (_this.state.activeIndex * OPTION_HEIGHT === 0) {
87
+ _this.optionGroupContentRef.scrollTop = 0;
88
+ return;
89
+ }
71
90
  if (_this.state.activeIndex * OPTION_HEIGHT < scrollTop) {
72
91
  _this.optionGroupContentRef.scrollTop = scrollTop - OPTION_HEIGHT;
73
92
  } else if (_this.state.activeIndex * OPTION_HEIGHT > offsetHeight + scrollTop) {
@@ -89,11 +108,12 @@ var SelectOptionGroup = /*#__PURE__*/function (_Component) {
89
108
  }
90
109
  };
91
110
  _this.renderOptGroup = function (searchVal) {
92
- var _this$props = _this.props,
93
- noOptionsPlaceholder = _this$props.noOptionsPlaceholder,
94
- onSelectOption = _this$props.onSelectOption;
111
+ var _this$props2 = _this.props,
112
+ noOptionsPlaceholder = _this$props2.noOptionsPlaceholder,
113
+ onSelectOption = _this$props2.onSelectOption,
114
+ isInModal = _this$props2.isInModal;
95
115
  _this.filterOptions = _this.props.getFilterOptions(searchVal);
96
- if (_this.filterOptions === 0) {
116
+ if (_this.filterOptions.length === 0) {
97
117
  return /*#__PURE__*/React.createElement("div", {
98
118
  className: "none-search-result"
99
119
  }, noOptionsPlaceholder);
@@ -105,46 +125,55 @@ var SelectOptionGroup = /*#__PURE__*/function (_Component) {
105
125
  key: key,
106
126
  index: i,
107
127
  isActive: isActive,
128
+ isInModal: isInModal,
108
129
  value: opt.value,
109
130
  onSelectOption: onSelectOption,
110
131
  changeIndex: _this.changeIndex,
111
- supportMultipleSelect: _this.props.supportMultipleSelect
132
+ supportMultipleSelect: _this.props.supportMultipleSelect,
133
+ disableHover: _this.state.disableHover
112
134
  }, opt.label);
113
135
  });
114
136
  };
115
137
  _this.state = {
116
138
  searchVal: '',
117
- activeIndex: -1
139
+ activeIndex: -1,
140
+ disableHover: false
118
141
  };
119
142
  _this.filterOptions = null;
143
+ _this.timer = null;
120
144
  return _this;
121
145
  }
122
146
  _createClass(SelectOptionGroup, [{
123
147
  key: "componentDidMount",
124
148
  value: function componentDidMount() {
149
+ var _this2 = this;
125
150
  window.addEventListener('keydown', this.onHotKey);
126
- window.addEventListener('click', this.onClick, true);
127
- this.resetMenuStyle();
151
+ setTimeout(function () {
152
+ _this2.resetMenuStyle();
153
+ }, 1);
128
154
  }
129
155
  }, {
130
156
  key: "componentWillUnmount",
131
157
  value: function componentWillUnmount() {
132
158
  this.filterOptions = null;
133
- window.removeEventListener('click', this.onClick, true);
159
+ this.timer && clearTimeout(this.timer);
134
160
  window.removeEventListener('keydown', this.onHotKey);
135
161
  }
136
162
  }, {
137
163
  key: "render",
138
164
  value: function render() {
139
- var _this2 = this;
140
- var _this$props2 = this.props,
141
- searchable = _this$props2.searchable,
142
- searchPlaceholder = _this$props2.searchPlaceholder,
143
- top = _this$props2.top,
144
- left = _this$props2.left,
145
- minWidth = _this$props2.minWidth,
146
- value = _this$props2.value,
147
- isShowSelected = _this$props2.isShowSelected;
165
+ var _this3 = this;
166
+ var _this$props3 = this.props,
167
+ searchable = _this$props3.searchable,
168
+ searchPlaceholder = _this$props3.searchPlaceholder,
169
+ top = _this$props3.top,
170
+ left = _this$props3.left,
171
+ minWidth = _this$props3.minWidth,
172
+ value = _this$props3.value,
173
+ isShowSelected = _this$props3.isShowSelected,
174
+ isInModal = _this$props3.isInModal,
175
+ position = _this$props3.position,
176
+ className = _this$props3.className;
148
177
  var searchVal = this.state.searchVal;
149
178
  var style = {
150
179
  top: top || 0,
@@ -157,10 +186,21 @@ var SelectOptionGroup = /*#__PURE__*/function (_Component) {
157
186
  minWidth: minWidth
158
187
  };
159
188
  }
160
- return /*#__PURE__*/React.createElement("div", {
161
- className: "option-group ".concat(isShowSelected ? 'pt-0' : ''),
189
+ if (isInModal) {
190
+ style = {
191
+ position: 'fixed',
192
+ left: position.x,
193
+ top: position.y + position.height,
194
+ minWidth: position.width,
195
+ opacity: 0
196
+ };
197
+ }
198
+ return /*#__PURE__*/React.createElement(ClickOutside, {
199
+ onClickOutside: this.props.onClickOutside
200
+ }, /*#__PURE__*/React.createElement("div", {
201
+ className: "option-group ".concat(isShowSelected ? 'pt-0' : '', " ").concat(className ? 'option-group-' + className : ''),
162
202
  ref: function ref(_ref2) {
163
- return _this2.optionGroupRef = _ref2;
203
+ return _this3.optionGroupRef = _ref2;
164
204
  },
165
205
  style: style
166
206
  }, isShowSelected && /*#__PURE__*/React.createElement("div", {
@@ -178,9 +218,9 @@ var SelectOptionGroup = /*#__PURE__*/function (_Component) {
178
218
  })), /*#__PURE__*/React.createElement("div", {
179
219
  className: "option-group-content",
180
220
  ref: function ref(_ref) {
181
- return _this2.optionGroupContentRef = _ref;
221
+ return _this3.optionGroupContentRef = _ref;
182
222
  }
183
- }, this.renderOptGroup(searchVal)));
223
+ }, this.renderOptGroup(searchVal))));
184
224
  }
185
225
  }]);
186
226
  return SelectOptionGroup;
@@ -14,18 +14,27 @@ var Option = /*#__PURE__*/function (_Component) {
14
14
  }
15
15
  _this = _super.call.apply(_super, [this].concat(args));
16
16
  _this.onSelectOption = function (value, event) {
17
- _this.props.onSelectOption(value, event);
18
- };
19
- _this.onClick = function (event) {
20
17
  if (_this.props.supportMultipleSelect) {
21
18
  event.stopPropagation();
22
19
  }
20
+ _this.props.onSelectOption(value, event);
23
21
  };
24
22
  _this.onMouseEnter = function () {
25
- _this.props.changeIndex(_this.props.index);
23
+ if (!_this.props.disableHover) {
24
+ _this.props.changeIndex(_this.props.index);
25
+ }
26
26
  };
27
27
  _this.onMouseLeave = function () {
28
- _this.props.changeIndex(-1);
28
+ if (!_this.props.disableHover) {
29
+ _this.props.changeIndex(-1);
30
+ }
31
+ };
32
+ _this.onMouseDown = function (event) {
33
+ if (_this.props.isInModal) {
34
+ // prevent close modal via select option
35
+ event.stopPropagation();
36
+ event.nativeEvent.stopImmediatePropagation();
37
+ }
29
38
  };
30
39
  return _this;
31
40
  }
@@ -34,8 +43,8 @@ var Option = /*#__PURE__*/function (_Component) {
34
43
  value: function render() {
35
44
  return /*#__PURE__*/React.createElement("div", {
36
45
  className: this.props.isActive ? 'option option-active' : 'option',
37
- onMouseDown: this.onSelectOption.bind(this, this.props.value),
38
- onClick: this.onClick,
46
+ onClick: this.onSelectOption.bind(this, this.props.value),
47
+ onMouseDown: this.onMouseDown,
39
48
  onMouseEnter: this.onMouseEnter,
40
49
  onMouseLeave: this.onMouseLeave
41
50
  }, this.props.children);
@@ -0,0 +1,49 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
+ import React from 'react';
6
+ var ClickOutside = /*#__PURE__*/function (_React$Component) {
7
+ _inherits(ClickOutside, _React$Component);
8
+ var _super = _createSuper(ClickOutside);
9
+ function ClickOutside() {
10
+ var _this;
11
+ _classCallCheck(this, ClickOutside);
12
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
13
+ args[_key] = arguments[_key];
14
+ }
15
+ _this = _super.call.apply(_super, [this].concat(args));
16
+ _this.isClickedInside = false;
17
+ _this.handleDocumentClick = function (e) {
18
+ if (_this.isClickedInside) {
19
+ _this.isClickedInside = false;
20
+ return;
21
+ }
22
+ _this.props.onClickOutside(e);
23
+ };
24
+ _this.handleMouseDown = function () {
25
+ _this.isClickedInside = true;
26
+ };
27
+ return _this;
28
+ }
29
+ _createClass(ClickOutside, [{
30
+ key: "componentDidMount",
31
+ value: function componentDidMount() {
32
+ document.addEventListener('mousedown', this.handleDocumentClick);
33
+ }
34
+ }, {
35
+ key: "componentWillUnmount",
36
+ value: function componentWillUnmount() {
37
+ document.removeEventListener('mousedown', this.handleDocumentClick);
38
+ }
39
+ }, {
40
+ key: "render",
41
+ value: function render() {
42
+ return React.cloneElement(React.Children.only(this.props.children), {
43
+ onMouseDownCapture: this.handleMouseDown
44
+ });
45
+ }
46
+ }]);
47
+ return ClickOutside;
48
+ }(React.Component);
49
+ export { ClickOutside as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "4.3.6",
3
+ "version": "4.3.7",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "2.0.5",