@majoo-ui/react 1.59.9-rc.3 → 1.59.9-rc.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.
- package/index.esm.js +13 -4
- package/index.umd.js +13 -4
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -13055,16 +13055,24 @@ const InputSelect = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
13055
13055
|
const selectBoxRef = useRef(null);
|
|
13056
13056
|
const scrollerRef = useRef(null);
|
|
13057
13057
|
useEffect(() => {
|
|
13058
|
-
var _a
|
|
13058
|
+
var _a;
|
|
13059
13059
|
if (search && Boolean(query)) {
|
|
13060
13060
|
(_a = scrollerRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
|
|
13061
13061
|
top: 0
|
|
13062
13062
|
});
|
|
13063
13063
|
return;
|
|
13064
13064
|
}
|
|
13065
|
-
|
|
13066
|
-
|
|
13067
|
-
|
|
13065
|
+
const scrollToSelectedElement = () => {
|
|
13066
|
+
const element = document.querySelector(`[data-index="${selectedIndex}"]`);
|
|
13067
|
+
if (element) {
|
|
13068
|
+
const scrollContainer = scrollerRef.current;
|
|
13069
|
+
//@ts-ignore
|
|
13070
|
+
const elementPosition = element.offsetTop - scrollContainer.offsetTop;
|
|
13071
|
+
//@ts-ignore
|
|
13072
|
+
scrollContainer.scrollTop = elementPosition;
|
|
13073
|
+
}
|
|
13074
|
+
};
|
|
13075
|
+
scrollToSelectedElement();
|
|
13068
13076
|
}, [query, search, openOptions, open, selectedIndex]);
|
|
13069
13077
|
const handleInputValue = (value, isReset = false) => {
|
|
13070
13078
|
if (onSearch && !isReset) onSearch(value);
|
|
@@ -13388,6 +13396,7 @@ const InputSelect = /*#__PURE__*/React.forwardRef((_a, ref) => {
|
|
|
13388
13396
|
key: (_a = item.value) !== null && _a !== void 0 ? _a : index,
|
|
13389
13397
|
hasGroup: !!item.group,
|
|
13390
13398
|
isGroup: item.isGroup,
|
|
13399
|
+
"data-index": index,
|
|
13391
13400
|
css: Object.assign({}, !item.isGroup ? item.isDisabled ? {
|
|
13392
13401
|
backgroundColor: 'unset',
|
|
13393
13402
|
cursor: 'not-allowed',
|
package/index.umd.js
CHANGED
|
@@ -13172,16 +13172,24 @@
|
|
|
13172
13172
|
var selectBoxRef = React.useRef(null);
|
|
13173
13173
|
var scrollerRef = React.useRef(null);
|
|
13174
13174
|
React.useEffect(function () {
|
|
13175
|
-
var _a
|
|
13175
|
+
var _a;
|
|
13176
13176
|
if (search && Boolean(query)) {
|
|
13177
13177
|
(_a = scrollerRef.current) === null || _a === void 0 ? void 0 : _a.scrollTo({
|
|
13178
13178
|
top: 0
|
|
13179
13179
|
});
|
|
13180
13180
|
return;
|
|
13181
13181
|
}
|
|
13182
|
-
|
|
13183
|
-
|
|
13184
|
-
|
|
13182
|
+
var scrollToSelectedElement = function scrollToSelectedElement() {
|
|
13183
|
+
var element = document.querySelector("[data-index=\"".concat(selectedIndex, "\"]"));
|
|
13184
|
+
if (element) {
|
|
13185
|
+
var scrollContainer = scrollerRef.current;
|
|
13186
|
+
//@ts-ignore
|
|
13187
|
+
var elementPosition = element.offsetTop - scrollContainer.offsetTop;
|
|
13188
|
+
//@ts-ignore
|
|
13189
|
+
scrollContainer.scrollTop = elementPosition;
|
|
13190
|
+
}
|
|
13191
|
+
};
|
|
13192
|
+
scrollToSelectedElement();
|
|
13185
13193
|
}, [query, search, openOptions, open, selectedIndex]);
|
|
13186
13194
|
var handleInputValue = function handleInputValue(value, isReset) {
|
|
13187
13195
|
if (isReset === void 0) {
|
|
@@ -13536,6 +13544,7 @@
|
|
|
13536
13544
|
key: (_a = item.value) !== null && _a !== void 0 ? _a : index,
|
|
13537
13545
|
hasGroup: !!item.group,
|
|
13538
13546
|
isGroup: item.isGroup,
|
|
13547
|
+
"data-index": index,
|
|
13539
13548
|
css: __assign({}, !item.isGroup ? item.isDisabled ? {
|
|
13540
13549
|
backgroundColor: 'unset',
|
|
13541
13550
|
cursor: 'not-allowed',
|