@danikokonn/yarik-frontend-lib 2.0.58-test4 → 2.0.58-test6
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.
|
@@ -7,7 +7,6 @@ import SearchRoundedIcon from "@mui/icons-material/SearchRounded";
|
|
|
7
7
|
import HintOptionsMenu from "./HintOptionsMenu";
|
|
8
8
|
import { getHints, insertInStrPos } from "./utils";
|
|
9
9
|
import { useSnackbarContext } from "../../providers";
|
|
10
|
-
import { useDebounce } from "../../utils";
|
|
11
10
|
import FilterHistoryMenu from "./FilterHistoryMenu";
|
|
12
11
|
import { Stack } from "@mui/material";
|
|
13
12
|
const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, additionalComponents, instant: _instant, onChange, onSelectFromHistory, }) => {
|
|
@@ -27,14 +26,14 @@ const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, ad
|
|
|
27
26
|
const currentHintOptions = (cursorPos != null
|
|
28
27
|
? getHints(search, cursorPos, fields, operators)
|
|
29
28
|
: null) ?? new Map();
|
|
30
|
-
|
|
29
|
+
useEffect(() => {
|
|
31
30
|
if (cursorPos == null)
|
|
32
31
|
return;
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
if (currentHintOptions === getHints(search, cursorPos, fields, operators))
|
|
33
|
+
return;
|
|
35
34
|
setFocusIdx(0);
|
|
36
35
|
setInputAnchor(currentHintOptions?.size > 0 ? textFieldRef.current : null);
|
|
37
|
-
},
|
|
36
|
+
}, [search, cursorPos]);
|
|
38
37
|
useEffect(() => {
|
|
39
38
|
if (cursorPos == null)
|
|
40
39
|
return;
|
|
@@ -42,8 +41,7 @@ const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, ad
|
|
|
42
41
|
inputRef.current.selectionStart = cursorPos;
|
|
43
42
|
inputRef.current.selectionEnd = cursorPos;
|
|
44
43
|
}
|
|
45
|
-
|
|
46
|
-
}, [cursorPos, currentHintOptions]);
|
|
44
|
+
}, [cursorPos]);
|
|
47
45
|
const handleChange = (value, _idx) => {
|
|
48
46
|
setSearch(value);
|
|
49
47
|
onChange(value, (v) => setSearchHist(v));
|