sccoreui 6.3.82 → 6.3.83
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.
|
@@ -13,15 +13,13 @@ const ListBoxDropdown = (props) => {
|
|
|
13
13
|
const boxRef = (0, react_1.useRef)();
|
|
14
14
|
const { selectAll,
|
|
15
15
|
// onSelectAll,
|
|
16
|
-
onChange, footeTemplate, headerTemplate, labelIcon, labelIconPos, label, labelIconSize, listItems, filter, multiple, filterPlaceholder, optionLabel, listClassName, menuClassName, listBoxParentClassName, listBoxclassName, optionTemplate, values, link, className,
|
|
17
|
-
// scrollElementId,
|
|
18
|
-
optionsMenuRef = boxRef,
|
|
16
|
+
onChange, footeTemplate, headerTemplate, labelIcon, labelIconPos, label, labelIconSize, listItems, filter, multiple, filterPlaceholder, optionLabel, listClassName, menuClassName, listBoxParentClassName, listBoxclassName, optionTemplate, values, link, className, scrollElementId, optionsMenuRef = boxRef,
|
|
19
17
|
// buttonClassName,
|
|
20
18
|
showChips, chipTemplate, chipClassName, chipsParentClassName, showRemoveIcon, removeIconSize, removeIconClassName, onRemoveItem, isDraggable, onDranghandle, onShow, onHide, onFocus, confirmationOption, selectedOptionNone, type, emptyFilterMessage, emptyMessage, } = props;
|
|
21
19
|
const [selectedItems, setSelectedItems] = (0, react_1.useState)([]);
|
|
22
20
|
// const [inpValue, setInpValue] = useState<any>();
|
|
23
21
|
// const [checked, setChecked] = useState<boolean>(false);
|
|
24
|
-
|
|
22
|
+
const [buttonPosition, setButtonPosition] = (0, react_1.useState)(null);
|
|
25
23
|
const buttonRef = (0, react_1.useRef)(null);
|
|
26
24
|
const onSelectOption = (e) => {
|
|
27
25
|
if (confirmationOption === true)
|
|
@@ -34,15 +32,17 @@ const ListBoxDropdown = (props) => {
|
|
|
34
32
|
(0, react_1.useEffect)(() => {
|
|
35
33
|
setSelectedItems(values);
|
|
36
34
|
}, [values]);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
const handleScroll = (e) => {
|
|
36
|
+
if (optionsMenuRef === null || optionsMenuRef === void 0 ? void 0 : optionsMenuRef.current)
|
|
37
|
+
optionsMenuRef.current.hide(e);
|
|
38
|
+
};
|
|
39
|
+
(0, react_1.useEffect)(() => {
|
|
40
|
+
if (scrollElementId) {
|
|
41
|
+
let elm = document.getElementById(`${scrollElementId}`);
|
|
42
|
+
if (elm)
|
|
43
|
+
elm.addEventListener("scroll", handleScroll);
|
|
44
|
+
}
|
|
45
|
+
}, []);
|
|
46
46
|
const handleDragStart = (e, index) => {
|
|
47
47
|
e.dataTransfer.setData("text/plain", index);
|
|
48
48
|
};
|
|
@@ -80,26 +80,28 @@ const ListBoxDropdown = (props) => {
|
|
|
80
80
|
// optionsMenuRef?.current.hide(e)
|
|
81
81
|
// }
|
|
82
82
|
// }
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
83
|
+
(0, react_1.useEffect)(() => {
|
|
84
|
+
const handleScroll = (e) => {
|
|
85
|
+
var _a;
|
|
86
|
+
if (buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current) {
|
|
87
|
+
const newPosition = (_a = buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().top;
|
|
88
|
+
// Hide overlay if the button position changes from the top
|
|
89
|
+
if (buttonPosition !== null && newPosition !== buttonPosition) {
|
|
90
|
+
if (optionsMenuRef === null || optionsMenuRef === void 0 ? void 0 : optionsMenuRef.current)
|
|
91
|
+
optionsMenuRef.current.hide(e);
|
|
92
|
+
}
|
|
93
|
+
// Update the button position
|
|
94
|
+
setButtonPosition(newPosition);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
window.addEventListener("scroll", handleScroll);
|
|
98
|
+
return () => {
|
|
99
|
+
window.removeEventListener("scroll", handleScroll);
|
|
100
|
+
};
|
|
101
|
+
}, [buttonPosition]);
|
|
100
102
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `${className}` }, { children: [(0, jsx_runtime_1.jsx)(menu_1.Menu, { onShow: (e) => onShow && onShow(e), onHide: (e) => onHide && onHide(e), onFocus: (e) => onFocus && onFocus(e), popup: true, ref: optionsMenuRef,
|
|
101
103
|
// onMouseLeave={onMouseLeaveMenu}
|
|
102
|
-
id: "popup_menu_bottom", className: menuClassName ? menuClassName : "",
|
|
104
|
+
id: "popup_menu_bottom", className: menuClassName ? menuClassName : "", model: [
|
|
103
105
|
{
|
|
104
106
|
template: () => ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: listBoxParentClassName
|
|
105
107
|
? listBoxParentClassName +
|