dtable-ui-component 7.0.13-beta.2 → 7.0.13

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.
@@ -46,11 +46,6 @@ class ParticipantSelect extends _react.Component {
46
46
  participants: updatedValue
47
47
  });
48
48
  };
49
- this.clearSearchValue = () => {
50
- this.setState({
51
- searchVal: ''
52
- });
53
- };
54
49
  this.onChangeSearch = event => {
55
50
  let searchVal = this.state.searchVal;
56
51
  if (searchVal === event.target.value) {
@@ -163,22 +158,12 @@ class ParticipantSelect extends _react.Component {
163
158
  ref: ref => this.participantsRef = ref,
164
159
  children: [this.renderParticipantList(), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
165
160
  className: "dtable-ui-participants-editor-search",
166
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
167
- className: "seatable-input-wrapper",
168
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
169
- className: "form-control form-control-clear-icon",
170
- type: "text",
171
- placeholder: (0, _lang.getLocale)('Search_collaborator'),
172
- value: this.state.searchVal,
173
- onChange: this.onChangeSearch
174
- }), this.state.searchVal && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
175
- className: "search-icon-right",
176
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
177
- className: " dtable-font dtable-icon-x",
178
- "aria-hidden": "true",
179
- onClick: this.clearSearchValue
180
- })
181
- })]
161
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
162
+ className: "form-control",
163
+ type: "text",
164
+ placeholder: (0, _lang.getLocale)('Search_collaborator'),
165
+ value: this.state.searchVal,
166
+ onChange: this.onChangeSearch
182
167
  })
183
168
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
184
169
  className: "dtable-ui-participants-editor-participants-container",
@@ -27,7 +27,7 @@
27
27
  font-size: .875rem;
28
28
  line-height: 1.6;
29
29
  width: 100%;
30
- padding: .375rem 1rem;
30
+ padding: 6px 40px 6px 12px;
31
31
  border-top-left-radius: 4px;
32
32
  border-top-right-radius: 4px;
33
33
  }
@@ -60,7 +60,7 @@
60
60
  min-width: 20px;
61
61
  pointer-events: auto;
62
62
  color: var(--bs-icon-color);
63
- right: 13px;
63
+ right: 6px;
64
64
  top: 6px;
65
65
  z-index: 1;
66
66
  height: 20px;
@@ -14,32 +14,41 @@ var _jsxRuntime = require("react/jsx-runtime");
14
14
  class DTableCustomizeSearchInput extends _react.Component {
15
15
  constructor(props) {
16
16
  super(props);
17
- this.onCompositionStart = () => {
18
- this.isInputtingChinese = true;
17
+ this.handleCompositionStart = () => {
18
+ this.isComposing = true;
19
19
  };
20
- this.onChange = e => {
21
- this.timer && clearTimeout(this.timer);
20
+ this.clearChangeTimer = () => {
21
+ if (this.timer === null) return;
22
+ clearTimeout(this.timer);
23
+ this.timer = null;
24
+ };
25
+ this.scheduleSearchChange = searchValue => {
22
26
  const _this$props = this.props,
23
27
  onChange = _this$props.onChange,
24
28
  _this$props$wait = _this$props.wait,
25
29
  wait = _this$props$wait === void 0 ? 100 : _this$props$wait;
26
- let text = e.target.value;
30
+ this.timer = setTimeout(() => {
31
+ this.timer = null;
32
+ onChange(searchValue.trim());
33
+ }, wait);
34
+ };
35
+ this.handleInputChange = event => {
36
+ const searchValue = event.target.value || '';
37
+ this.clearChangeTimer();
27
38
  this.setState({
28
- searchValue: text || ''
29
- }, () => {
30
- if (this.isInputtingChinese) return;
31
- this.timer = setTimeout(() => {
32
- onChange && onChange(this.state.searchValue.trim());
33
- }, wait);
39
+ searchValue
34
40
  });
41
+ if (this.isComposing) return;
42
+ this.scheduleSearchChange(searchValue);
35
43
  };
36
- this.onCompositionEnd = e => {
37
- this.isInputtingChinese = false;
38
- this.onChange(e);
44
+ this.handleCompositionEnd = event => {
45
+ this.isComposing = false;
46
+ this.handleInputChange(event);
39
47
  };
40
- this.clearSearch = e => {
41
- e && e.stopPropagation && e.stopPropagation();
48
+ this.clearSearch = event => {
49
+ event && event.stopPropagation && event.stopPropagation();
42
50
  const clearValue = this.props.clearValue;
51
+ this.clearChangeTimer();
43
52
  this.setState({
44
53
  searchValue: ''
45
54
  }, () => {
@@ -72,7 +81,7 @@ class DTableCustomizeSearchInput extends _react.Component {
72
81
  this.state = {
73
82
  searchValue: props.value || ''
74
83
  };
75
- this.isInputtingChinese = false;
84
+ this.isComposing = false;
76
85
  this.timer = null;
77
86
  this.inputRef = null;
78
87
  }
@@ -85,14 +94,14 @@ class DTableCustomizeSearchInput extends _react.Component {
85
94
  }
86
95
  UNSAFE_componentWillReceiveProps(nextProps) {
87
96
  if (nextProps.value !== this.props.value) {
97
+ this.clearChangeTimer();
88
98
  this.setState({
89
99
  searchValue: nextProps.value
90
100
  });
91
101
  }
92
102
  }
93
103
  componentWillUnmount() {
94
- this.timer && clearTimeout(this.timer);
95
- this.timer = null;
104
+ this.clearChangeTimer();
96
105
  this.inputRef = null;
97
106
  }
98
107
  render() {
@@ -104,24 +113,19 @@ class DTableCustomizeSearchInput extends _react.Component {
104
113
  _this$props3$disabled = _this$props3.disabled,
105
114
  disabled = _this$props3$disabled === void 0 ? false : _this$props3$disabled,
106
115
  _this$props3$style = _this$props3.style,
107
- style = _this$props3$style === void 0 ? {} : _this$props3$style,
108
- isClearable = _this$props3.isClearable,
109
- _this$props3$isMultip = _this$props3.isMultiple,
110
- isMultiple = _this$props3$isMultip === void 0 ? false : _this$props3$isMultip;
116
+ style = _this$props3$style === void 0 ? {} : _this$props3$style;
111
117
  const searchValue = this.state.searchValue;
112
- const inputWidth = isClearable && searchValue && !isMultiple ? 'calc(100% - 40px)' : '100%';
113
- style.width = inputWidth;
114
118
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
115
119
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
116
120
  type: "text",
117
121
  name: "search-input",
118
122
  value: searchValue,
119
123
  className: (0, _classnames.default)('select-search-control', className),
120
- onChange: this.onChange,
124
+ onChange: this.handleInputChange,
121
125
  autoFocus: autoFocus,
122
126
  placeholder: placeholder,
123
- onCompositionStart: this.onCompositionStart,
124
- onCompositionEnd: this.onCompositionEnd,
127
+ onCompositionStart: this.handleCompositionStart,
128
+ onCompositionEnd: this.handleCompositionEnd,
125
129
  onKeyDown: onKeyDown,
126
130
  disabled: disabled,
127
131
  style: style,
@@ -19,11 +19,6 @@ class PCLinkEditorPopover extends _react.default.Component {
19
19
  searchValue: value
20
20
  });
21
21
  };
22
- this.clearSearchValue = () => {
23
- this.setState({
24
- searchValue: ''
25
- });
26
- };
27
22
  this.onInputClick = event => {
28
23
  event.nativeEvent.stopImmediatePropagation();
29
24
  event.stopPropagation();
@@ -59,22 +54,12 @@ class PCLinkEditorPopover extends _react.default.Component {
59
54
  style: popoverStyle,
60
55
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
61
56
  className: "link-options-search",
62
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
63
- className: "seatable-input-wrapper",
64
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
65
- className: "form-control form-control-clear-icon",
66
- value: searchValue,
67
- onChange: this.onValueChanged,
68
- onClick: this.onInputClick,
69
- placeholder: (0, _lang.getLocale)('Search_option')
70
- }), searchValue && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
71
- className: "search-icon-right",
72
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
73
- className: " dtable-font dtable-icon-x",
74
- "aria-hidden": "true",
75
- onClick: this.clearSearchValue
76
- })
77
- })]
57
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
58
+ className: "form-control",
59
+ value: searchValue,
60
+ onChange: this.onValueChanged,
61
+ onClick: this.onInputClick,
62
+ placeholder: (0, _lang.getLocale)('Search_option')
78
63
  })
79
64
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
80
65
  className: "link-options-container",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "7.0.13-beta.2",
3
+ "version": "7.0.13",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "5.0.9",