@tripian/react 9.1.41 → 9.1.42
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.js +17 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -33029,6 +33029,19 @@ const GPlacesAutocomplete2 = ({ onSelectedChanged, initialText, boundry, placeho
|
|
|
33029
33029
|
const [initialized, setInitialized] = (0, react_1.useState)(false);
|
|
33030
33030
|
const [hasSelection, setHasSelection] = (0, react_1.useState)(false);
|
|
33031
33031
|
const placesAutocomplete = (0, react_1.useRef)();
|
|
33032
|
+
const isPacItemClick = (0, react_1.useRef)(false);
|
|
33033
|
+
(0, react_1.useEffect)(() => {
|
|
33034
|
+
const handleMouseDown = (e) => {
|
|
33035
|
+
const target = e.target;
|
|
33036
|
+
if (target && target.classList && target.classList.contains('pac-item')) {
|
|
33037
|
+
isPacItemClick.current = true;
|
|
33038
|
+
}
|
|
33039
|
+
};
|
|
33040
|
+
window.addEventListener('mousedown', handleMouseDown);
|
|
33041
|
+
return () => {
|
|
33042
|
+
window.removeEventListener('mousedown', handleMouseDown);
|
|
33043
|
+
};
|
|
33044
|
+
}, []);
|
|
33032
33045
|
const handleEnterKey = (event) => {
|
|
33033
33046
|
if (event.key === 'Enter') {
|
|
33034
33047
|
event.preventDefault();
|
|
@@ -33043,8 +33056,11 @@ const GPlacesAutocomplete2 = ({ onSelectedChanged, initialText, boundry, placeho
|
|
|
33043
33056
|
}
|
|
33044
33057
|
};
|
|
33045
33058
|
const handleBlur = () => {
|
|
33046
|
-
// Kısa bir timeout kullanıyoruz çünkü place_changed eventi blur'dan sonra tetiklenebilir
|
|
33047
33059
|
setTimeout(() => {
|
|
33060
|
+
if (isPacItemClick.current) {
|
|
33061
|
+
isPacItemClick.current = false;
|
|
33062
|
+
return;
|
|
33063
|
+
}
|
|
33048
33064
|
if (!hasSelection) {
|
|
33049
33065
|
setText('');
|
|
33050
33066
|
onSelectedChanged({ name: '' });
|