intelicoreact 1.2.67 → 1.2.68
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.
|
@@ -88,7 +88,6 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
88
88
|
isMobileProp = _useIsMobile.isMobile;
|
|
89
89
|
|
|
90
90
|
var isMobile = isMobileProp && withMobileLogic;
|
|
91
|
-
if (isMobile) isSearchable = true;
|
|
92
91
|
var dropdownId = id || fieldKey;
|
|
93
92
|
|
|
94
93
|
var _useState = (0, _react.useState)(false),
|
|
@@ -142,6 +141,20 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
142
141
|
setScrollHeight = _useState18[1];
|
|
143
142
|
|
|
144
143
|
if (!options) return null;
|
|
144
|
+
var getTotalOptions = (0, _react.useCallback)(function () {
|
|
145
|
+
return options === null || options === void 0 ? void 0 : options.reduce(function (result, item) {
|
|
146
|
+
if (item !== null && item !== void 0 && item.list) {
|
|
147
|
+
var _item$list;
|
|
148
|
+
|
|
149
|
+
result += (item === null || item === void 0 ? void 0 : (_item$list = item.list) === null || _item$list === void 0 ? void 0 : _item$list.length) || 0;
|
|
150
|
+
} else {
|
|
151
|
+
++result;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return result;
|
|
155
|
+
}, 0);
|
|
156
|
+
}, [options]);
|
|
157
|
+
if (isMobile) isSearchable = getTotalOptions() > (minItemsForShowMobileSearch || MIN_ITEMS_FOR_SHOW_MOBILE_SEARCH);
|
|
145
158
|
|
|
146
159
|
var moveOtherToEnd = function moveOtherToEnd(options) {
|
|
147
160
|
var otherIndex = options === null || options === void 0 ? void 0 : options.findIndex(function (option) {
|
|
@@ -427,20 +440,6 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
427
440
|
return newData;
|
|
428
441
|
};
|
|
429
442
|
|
|
430
|
-
var getTotalOptions = (0, _react.useCallback)(function () {
|
|
431
|
-
return options === null || options === void 0 ? void 0 : options.reduce(function (result, item) {
|
|
432
|
-
if (item !== null && item !== void 0 && item.list) {
|
|
433
|
-
var _item$list;
|
|
434
|
-
|
|
435
|
-
result += (item === null || item === void 0 ? void 0 : (_item$list = item.list) === null || _item$list === void 0 ? void 0 : _item$list.length) || 0;
|
|
436
|
-
} else {
|
|
437
|
-
++result;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
return result;
|
|
441
|
-
}, 0);
|
|
442
|
-
}, [options]);
|
|
443
|
-
|
|
444
443
|
var getListMarkUp = function getListMarkUp() {
|
|
445
444
|
var _cn3, _cn4, _getSortedOptions;
|
|
446
445
|
|
|
@@ -462,7 +461,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
462
461
|
onClick: function onClick() {
|
|
463
462
|
return setIsOpen(false);
|
|
464
463
|
}
|
|
465
|
-
}))),
|
|
464
|
+
}))), isSearchable && /*#__PURE__*/_react.default.createElement("div", {
|
|
466
465
|
className: (0, _classnames.default)("".concat(RC, "__list-header-row"))
|
|
467
466
|
}, /*#__PURE__*/_react.default.createElement(_Input.default, (0, _extends2.default)({
|
|
468
467
|
ref: searchInputRef,
|