hplx-react-elements-dev 1.0.59 → 1.0.61
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/dist/esm/index.js +62 -18
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -2135,7 +2135,7 @@ var DropdownItems = function DropdownItems(_a) {
|
|
|
2135
2135
|
onMouseDown: function onMouseDown(e) {
|
|
2136
2136
|
!disabled && handleOnSelect(e);
|
|
2137
2137
|
},
|
|
2138
|
-
className: "hplxt-h-10 hplxt-flex hplxt-items-center hplxt-px-2 ".concat(disabled ? "hplxt-cursor-not-allowed" : "hover:hplxt-bg-Blue_gray-100 hplxt-cursor-pointer"),
|
|
2138
|
+
className: "hplxt-h-10 hplxt-flex hplxt-items-center hplxt-px-2 ".concat(disabled ? "hplxt-cursor-not-allowed" : "hover:hplxt-bg-Blue_gray-100 hplxt-cursor-pointer", " ").concat(className),
|
|
2139
2139
|
onMouseEnter: onMouseEnterHandler,
|
|
2140
2140
|
onMouseLeave: onMouseLeaveHandler
|
|
2141
2141
|
}, {
|
|
@@ -17625,7 +17625,7 @@ var InputTag = function InputTag(_a) {
|
|
|
17625
17625
|
var wrapperRef = useRef(null);
|
|
17626
17626
|
var inputRef = useRef(null);
|
|
17627
17627
|
|
|
17628
|
-
var _q = useState(),
|
|
17628
|
+
var _q = useState([]),
|
|
17629
17629
|
dropdownArr = _q[0],
|
|
17630
17630
|
setDropdownArr = _q[1];
|
|
17631
17631
|
|
|
@@ -17641,6 +17641,10 @@ var InputTag = function InputTag(_a) {
|
|
|
17641
17641
|
setTags = _s[1]; // tag array
|
|
17642
17642
|
|
|
17643
17643
|
|
|
17644
|
+
var _t = useState(-1),
|
|
17645
|
+
focusIndex = _t[0],
|
|
17646
|
+
setFocusIndex = _t[1];
|
|
17647
|
+
|
|
17644
17648
|
var handleValueChange = function handleValueChange(e) {
|
|
17645
17649
|
var sug = [];
|
|
17646
17650
|
setShowDropdown(true);
|
|
@@ -17660,6 +17664,7 @@ var InputTag = function InputTag(_a) {
|
|
|
17660
17664
|
|
|
17661
17665
|
if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
|
|
17662
17666
|
setShowDropdown(false);
|
|
17667
|
+
setFocusIndex(-1);
|
|
17663
17668
|
}
|
|
17664
17669
|
};
|
|
17665
17670
|
|
|
@@ -17674,6 +17679,7 @@ var InputTag = function InputTag(_a) {
|
|
|
17674
17679
|
onDropdownClick && onDropdownClick(selectedItem);
|
|
17675
17680
|
handleValChange && handleValChange(value);
|
|
17676
17681
|
setShowDropdown(false);
|
|
17682
|
+
setFocusIndex(-1);
|
|
17677
17683
|
};
|
|
17678
17684
|
|
|
17679
17685
|
useEffect(function () {
|
|
@@ -17681,17 +17687,7 @@ var InputTag = function InputTag(_a) {
|
|
|
17681
17687
|
setTags(tagString.split(",").filter(Boolean).map(function (item) {
|
|
17682
17688
|
return item.trim();
|
|
17683
17689
|
}));
|
|
17684
|
-
}, [tagString]);
|
|
17685
|
-
// let incomingTags=value.split("\\s*,\\s*");
|
|
17686
|
-
// incomingTags = incomingTags.filter(Boolean)
|
|
17687
|
-
// setTags(tagList)
|
|
17688
|
-
// }, [tagList]);
|
|
17689
|
-
// useEffect(() => {
|
|
17690
|
-
// let incomingTags=value.split("\\s*,\\s*");
|
|
17691
|
-
// incomingTags = incomingTags.filter(Boolean)
|
|
17692
|
-
// setTags(incomingTags)
|
|
17693
|
-
// }, [value]);
|
|
17694
|
-
|
|
17690
|
+
}, [tagString]);
|
|
17695
17691
|
useEffect(function () {
|
|
17696
17692
|
document.addEventListener("mousedown", handleClickOutside);
|
|
17697
17693
|
return function () {
|
|
@@ -17706,8 +17702,14 @@ var InputTag = function InputTag(_a) {
|
|
|
17706
17702
|
};
|
|
17707
17703
|
|
|
17708
17704
|
var handleBlur = function handleBlur(event) {
|
|
17709
|
-
|
|
17705
|
+
if (tagInputValue) {
|
|
17706
|
+
setTags(__spreadArray(__spreadArray([], tags, true), [tagInputValue], false));
|
|
17707
|
+
setValue(tags.filter(Boolean).join(", "));
|
|
17708
|
+
setTagInputValue("");
|
|
17709
|
+
}
|
|
17710
|
+
|
|
17710
17711
|
setShowDropdown(false);
|
|
17712
|
+
setFocusIndex(-1);
|
|
17711
17713
|
setActive(false);
|
|
17712
17714
|
onBlur && onBlur(event);
|
|
17713
17715
|
};
|
|
@@ -17717,9 +17719,51 @@ var InputTag = function InputTag(_a) {
|
|
|
17717
17719
|
setTags(__spreadArray(__spreadArray([], tags, true), [tagInputValue], false));
|
|
17718
17720
|
setValue(tags.filter(Boolean).join(", "));
|
|
17719
17721
|
setTagInputValue("");
|
|
17720
|
-
|
|
17722
|
+
setFocusIndex(-1);
|
|
17723
|
+
handleValChange && handleValChange(value);
|
|
17724
|
+
} // on key down
|
|
17721
17725
|
|
|
17722
|
-
|
|
17726
|
+
|
|
17727
|
+
if (e.keyCode === 40) {
|
|
17728
|
+
if (focusIndex < dropdownArr.length - 1) {
|
|
17729
|
+
var focusI = focusIndex + 1;
|
|
17730
|
+
|
|
17731
|
+
if (wrapperRef && wrapperRef.current) {
|
|
17732
|
+
wrapperRef.current.scrollBy(0, 18);
|
|
17733
|
+
}
|
|
17734
|
+
|
|
17735
|
+
setFocusIndex(focusI); // setTagInputValue(dropdownArr[focusI].value);
|
|
17736
|
+
}
|
|
17737
|
+
} // on key up
|
|
17738
|
+
|
|
17739
|
+
|
|
17740
|
+
if (e.keyCode === 38) {
|
|
17741
|
+
if (focusIndex !== 0) {
|
|
17742
|
+
var focusI = focusIndex - 1;
|
|
17743
|
+
|
|
17744
|
+
if (wrapperRef && wrapperRef.current) {
|
|
17745
|
+
wrapperRef.current.scrollBy(0, -18);
|
|
17746
|
+
}
|
|
17747
|
+
|
|
17748
|
+
setFocusIndex(focusI); // setTagInputValue(dropdownArr[focusI].value);
|
|
17749
|
+
}
|
|
17750
|
+
} // on key left
|
|
17751
|
+
|
|
17752
|
+
|
|
17753
|
+
if (e.keyCode === 37) {
|
|
17754
|
+
if (focusIndex >= 0) {
|
|
17755
|
+
setFocusIndex(focusIndex);
|
|
17756
|
+
setTagInputValue(dropdownArr[focusIndex].value);
|
|
17757
|
+
}
|
|
17758
|
+
} // on key right
|
|
17759
|
+
|
|
17760
|
+
|
|
17761
|
+
if (e.keyCode === 39) {
|
|
17762
|
+
if (focusIndex !== 0) {
|
|
17763
|
+
setFocusIndex(focusIndex);
|
|
17764
|
+
setTagInputValue(dropdownArr[focusIndex].value);
|
|
17765
|
+
}
|
|
17766
|
+
}
|
|
17723
17767
|
};
|
|
17724
17768
|
|
|
17725
17769
|
var deleteTag = function deleteTag(_, del_index) {
|
|
@@ -17785,11 +17829,11 @@ var InputTag = function InputTag(_a) {
|
|
|
17785
17829
|
}
|
|
17786
17830
|
}, {
|
|
17787
17831
|
children: dropdownArr && dropdownArr.length > 0 && jsxRuntime.exports.jsx("div", {
|
|
17788
|
-
children: dropdownArr.map(function (option) {
|
|
17832
|
+
children: dropdownArr.map(function (option, index) {
|
|
17789
17833
|
var restOptions = __rest(option || {}, []);
|
|
17790
17834
|
|
|
17791
17835
|
return jsxRuntime.exports.jsx(DropdownItems, __assign({
|
|
17792
|
-
className: "hplxt-text-Primary-700"
|
|
17836
|
+
className: "hplxt-text-Primary-700 ".concat(index === focusIndex ? "hplxt-bg-Blue_gray-100 hplxt-font-inter-1" : "")
|
|
17793
17837
|
}, restOptions, {
|
|
17794
17838
|
onSelect: function onSelect() {
|
|
17795
17839
|
return handleDropdownClick(restOptions);
|