intelicoreact 1.0.94 → 1.0.96
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.
|
@@ -32,6 +32,9 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
32
32
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
33
|
|
|
34
34
|
var RC = 'dropdown-live-search';
|
|
35
|
+
var notReact = {
|
|
36
|
+
searchValue: ''
|
|
37
|
+
};
|
|
35
38
|
|
|
36
39
|
var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
37
40
|
var value = _ref.value,
|
|
@@ -75,7 +78,12 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
75
78
|
var _useState5 = (0, _react.useState)(labelByValue),
|
|
76
79
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
77
80
|
searchValue = _useState6[0],
|
|
78
|
-
|
|
81
|
+
setSV = _useState6[1];
|
|
82
|
+
|
|
83
|
+
var setSearchValue = function setSearchValue(val) {
|
|
84
|
+
setSV(val);
|
|
85
|
+
notReact.searchValue = val;
|
|
86
|
+
};
|
|
79
87
|
|
|
80
88
|
var dropdownLiveSearchRef = (0, _react.useRef)(null);
|
|
81
89
|
var dropdownListBoxRef = (0, _react.useRef)(null);
|
|
@@ -169,6 +177,9 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
169
177
|
return document.getElementById(dropdownId);
|
|
170
178
|
};
|
|
171
179
|
|
|
180
|
+
(0, _react.useEffect)(function () {
|
|
181
|
+
if (!value) setSearchValue('');
|
|
182
|
+
}, [value]);
|
|
172
183
|
(0, _react.useEffect)(function () {
|
|
173
184
|
document.addEventListener('click', handleClickOutside, true);
|
|
174
185
|
return function () {
|
|
@@ -225,7 +236,7 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
225
236
|
var doScrollCallback = (0, _react.useCallback)(function (e) {
|
|
226
237
|
if (doRequest && typeof doRequest === 'function') {
|
|
227
238
|
if (Math.round(e.target.clientHeight + e.target.scrollTop) == e.target.scrollHeight) {
|
|
228
|
-
doRequest(searchValue);
|
|
239
|
+
doRequest(notReact.searchValue, true);
|
|
229
240
|
}
|
|
230
241
|
}
|
|
231
242
|
}, [options]);
|
|
@@ -258,7 +269,7 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
258
269
|
}, isSearchable ? /*#__PURE__*/_react.default.createElement("input", {
|
|
259
270
|
ref: searchInputRef,
|
|
260
271
|
className: "".concat(RC, "__input"),
|
|
261
|
-
value: searchValue,
|
|
272
|
+
value: searchValue || labelByValue,
|
|
262
273
|
onChange: handle.onInputChange,
|
|
263
274
|
placeholder: placeholder,
|
|
264
275
|
onFocus: searchableInputFocus,
|
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
box-sizing: border-box;
|
|
59
59
|
min-width: 100%;
|
|
60
60
|
max-height: 320px;
|
|
61
|
-
margin-top: 4px;
|
|
62
61
|
padding: 5px 0;
|
|
63
62
|
border: 1px solid #E2E5EC;
|
|
64
63
|
background: #FFF;
|
|
@@ -121,6 +120,7 @@
|
|
|
121
120
|
}
|
|
122
121
|
|
|
123
122
|
&--no-options {
|
|
123
|
+
padding-left: 8px;
|
|
124
124
|
box-sizing: border-box;
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -190,7 +190,8 @@
|
|
|
190
190
|
z-index: 99999;
|
|
191
191
|
display: block;
|
|
192
192
|
box-sizing: border-box;
|
|
193
|
-
top:
|
|
193
|
+
top: 30px;
|
|
194
|
+
background-color: #ffffff;
|
|
194
195
|
}
|
|
195
196
|
|
|
196
197
|
&.disabled {
|