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

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;
@@ -9,37 +9,48 @@ exports.default = void 0;
9
9
  var _react = _interopRequireWildcard(require("react"));
10
10
  var _classnames = _interopRequireDefault(require("classnames"));
11
11
  var _DTableIcon = _interopRequireDefault(require("../DTableIcon"));
12
+ var _lang = require("../lang");
13
+ var _DTableToolTip = _interopRequireDefault(require("../DTableToolTip"));
12
14
  require("./index.css");
13
15
  var _jsxRuntime = require("react/jsx-runtime");
14
16
  class DTableCustomizeSearchInput extends _react.Component {
15
17
  constructor(props) {
16
18
  super(props);
17
- this.onCompositionStart = () => {
18
- this.isInputtingChinese = true;
19
+ this.handleCompositionStart = () => {
20
+ this.isComposing = true;
19
21
  };
20
- this.onChange = e => {
21
- this.timer && clearTimeout(this.timer);
22
+ this.clearChangeTimer = () => {
23
+ if (this.timer === null) return;
24
+ clearTimeout(this.timer);
25
+ this.timer = null;
26
+ };
27
+ this.scheduleSearchChange = searchValue => {
22
28
  const _this$props = this.props,
23
29
  onChange = _this$props.onChange,
24
30
  _this$props$wait = _this$props.wait,
25
31
  wait = _this$props$wait === void 0 ? 100 : _this$props$wait;
26
- let text = e.target.value;
32
+ this.timer = setTimeout(() => {
33
+ this.timer = null;
34
+ onChange(searchValue.trim());
35
+ }, wait);
36
+ };
37
+ this.handleInputChange = event => {
38
+ const searchValue = event.target.value || '';
39
+ this.clearChangeTimer();
27
40
  this.setState({
28
- searchValue: text || ''
29
- }, () => {
30
- if (this.isInputtingChinese) return;
31
- this.timer = setTimeout(() => {
32
- onChange && onChange(this.state.searchValue.trim());
33
- }, wait);
41
+ searchValue
34
42
  });
43
+ if (this.isComposing) return;
44
+ this.scheduleSearchChange(searchValue);
35
45
  };
36
- this.onCompositionEnd = e => {
37
- this.isInputtingChinese = false;
38
- this.onChange(e);
46
+ this.handleCompositionEnd = event => {
47
+ this.isComposing = false;
48
+ this.handleInputChange(event);
39
49
  };
40
- this.clearSearch = e => {
41
- e && e.stopPropagation && e.stopPropagation();
50
+ this.clearSearch = event => {
51
+ event && event.stopPropagation && event.stopPropagation();
42
52
  const clearValue = this.props.clearValue;
53
+ this.clearChangeTimer();
43
54
  this.setState({
44
55
  searchValue: ''
45
56
  }, () => {
@@ -60,19 +71,26 @@ class DTableCustomizeSearchInput extends _react.Component {
60
71
  clearClassName = _this$props2.clearClassName;
61
72
  const searchValue = this.state.searchValue;
62
73
  if (!isClearable || !searchValue) return null;
63
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
64
- className: (0, _classnames.default)('clear-icon-x', clearClassName),
65
- onClick: this.clearSearch,
66
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableIcon.default, {
67
- symbol: "close",
68
- color: "var(--bs-icon-color)"
69
- })
74
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
75
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
76
+ className: (0, _classnames.default)('clear-icon-x', clearClassName),
77
+ onClick: this.clearSearch,
78
+ id: "customize-search-clear",
79
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableIcon.default, {
80
+ symbol: "close",
81
+ color: "var(--bs-icon-color)"
82
+ })
83
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableToolTip.default, {
84
+ placement: "bottom",
85
+ target: "customize-search-clear",
86
+ children: (0, _lang.getLocale)('Clear')
87
+ })]
70
88
  });
71
89
  };
72
90
  this.state = {
73
91
  searchValue: props.value || ''
74
92
  };
75
- this.isInputtingChinese = false;
93
+ this.isComposing = false;
76
94
  this.timer = null;
77
95
  this.inputRef = null;
78
96
  }
@@ -85,14 +103,14 @@ class DTableCustomizeSearchInput extends _react.Component {
85
103
  }
86
104
  UNSAFE_componentWillReceiveProps(nextProps) {
87
105
  if (nextProps.value !== this.props.value) {
106
+ this.clearChangeTimer();
88
107
  this.setState({
89
108
  searchValue: nextProps.value
90
109
  });
91
110
  }
92
111
  }
93
112
  componentWillUnmount() {
94
- this.timer && clearTimeout(this.timer);
95
- this.timer = null;
113
+ this.clearChangeTimer();
96
114
  this.inputRef = null;
97
115
  }
98
116
  render() {
@@ -104,24 +122,19 @@ class DTableCustomizeSearchInput extends _react.Component {
104
122
  _this$props3$disabled = _this$props3.disabled,
105
123
  disabled = _this$props3$disabled === void 0 ? false : _this$props3$disabled,
106
124
  _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;
125
+ style = _this$props3$style === void 0 ? {} : _this$props3$style;
111
126
  const searchValue = this.state.searchValue;
112
- const inputWidth = isClearable && searchValue && !isMultiple ? 'calc(100% - 40px)' : '100%';
113
- style.width = inputWidth;
114
127
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.Fragment, {
115
128
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
116
129
  type: "text",
117
130
  name: "search-input",
118
131
  value: searchValue,
119
132
  className: (0, _classnames.default)('select-search-control', className),
120
- onChange: this.onChange,
133
+ onChange: this.handleInputChange,
121
134
  autoFocus: autoFocus,
122
135
  placeholder: placeholder,
123
- onCompositionStart: this.onCompositionStart,
124
- onCompositionEnd: this.onCompositionEnd,
136
+ onCompositionStart: this.handleCompositionStart,
137
+ onCompositionEnd: this.handleCompositionEnd,
125
138
  onKeyDown: onKeyDown,
126
139
  disabled: disabled,
127
140
  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.13isa.4",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "5.0.9",