intelicoreact 1.1.77 → 1.1.78
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.
|
@@ -23,6 +23,8 @@ var _useDebounce = require("../../../Functions/useDebounce");
|
|
|
23
23
|
|
|
24
24
|
var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
|
|
25
25
|
|
|
26
|
+
var _utils = require("../../../Functions/utils");
|
|
27
|
+
|
|
26
28
|
var _Spinner = _interopRequireDefault(require("../../Layout/Spinner/Spinner"));
|
|
27
29
|
|
|
28
30
|
require("./DropdownLiveSearch.scss");
|
|
@@ -32,9 +34,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
32
34
|
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
35
|
|
|
34
36
|
var RC = 'dropdown-live-search';
|
|
35
|
-
var notReact = {
|
|
36
|
-
searchValue: ''
|
|
37
|
-
};
|
|
38
37
|
|
|
39
38
|
var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
40
39
|
var value = _ref.value,
|
|
@@ -80,20 +79,26 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
80
79
|
searchValue = _useState6[0],
|
|
81
80
|
setSV = _useState6[1];
|
|
82
81
|
|
|
83
|
-
var
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
var _useState7 = (0, _react.useState)(options),
|
|
83
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
84
|
+
previousOptions = _useState8[0],
|
|
85
|
+
setPreviousOptions = _useState8[1];
|
|
87
86
|
|
|
88
87
|
var dropdownLiveSearchRef = (0, _react.useRef)(null);
|
|
89
88
|
var dropdownListBoxRef = (0, _react.useRef)(null);
|
|
90
89
|
var dropdownListRef = (0, _react.useRef)(null);
|
|
91
90
|
var searchInputRef = (0, _react.useRef)(null);
|
|
91
|
+
var searchValueRef = (0, _react.useRef)(labelByValue);
|
|
92
92
|
|
|
93
|
-
var
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
var setSearchValue = function setSearchValue(val) {
|
|
94
|
+
setSV(val);
|
|
95
|
+
searchValueRef.current = val;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
var _useState9 = (0, _react.useState)(false),
|
|
99
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
100
|
+
isFocusedByClick = _useState10[0],
|
|
101
|
+
setIsFocusedByClick = _useState10[1];
|
|
97
102
|
|
|
98
103
|
var debouncedSearchTerm = (0, _useDebounce.useDebounce)({
|
|
99
104
|
searchValue: searchValue,
|
|
@@ -245,8 +250,8 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
245
250
|
}, [dropdownLiveSearchRef, isOpen]);
|
|
246
251
|
var doScrollCallback = (0, _react.useCallback)(function (e) {
|
|
247
252
|
if (doRequest && typeof doRequest === 'function') {
|
|
248
|
-
if (Math.round(e.target.clientHeight + e.target.scrollTop) == e.target.scrollHeight) {
|
|
249
|
-
doRequest(
|
|
253
|
+
if (Math.round(e.target.clientHeight + e.target.scrollTop) == e.target.scrollHeight && (0, _utils.compare)(options, previousOptions)) {
|
|
254
|
+
doRequest(searchValueRef.current, true);
|
|
250
255
|
}
|
|
251
256
|
}
|
|
252
257
|
}, [options]);
|
|
@@ -261,6 +266,9 @@ var DropdownLiveSearch = function DropdownLiveSearch(_ref) {
|
|
|
261
266
|
removeEventListener('scroll', doScrollCallback);
|
|
262
267
|
};
|
|
263
268
|
}, [isOpen, dropdownListRef]);
|
|
269
|
+
(0, _react.useEffect)(function () {
|
|
270
|
+
setPreviousOptions(options);
|
|
271
|
+
}, [options]);
|
|
264
272
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
265
273
|
className: (0, _classnames.default)(RC, className, disabled),
|
|
266
274
|
ref: dropdownLiveSearchRef
|
|
@@ -130,7 +130,7 @@ var Modal = function Modal(_ref2) {
|
|
|
130
130
|
}, !noHeader && /*#__PURE__*/_react.default.createElement(_ModalTitle.default, {
|
|
131
131
|
variant: variant,
|
|
132
132
|
isForced: forced,
|
|
133
|
-
onClose:
|
|
133
|
+
onClose: handle.decline,
|
|
134
134
|
noHeaderCloseBtn: noHeaderCloseBtn
|
|
135
135
|
}, /*#__PURE__*/_react.default.createElement("span", null, renderModalTitle({
|
|
136
136
|
mode: mode,
|