@danikokonn/yarik-frontend-lib 2.0.58-test1 → 2.0.58-test4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"RichFilterTextField.d.ts","sourceRoot":"","sources":["../../../src/components/RichFilterTextField/RichFilterTextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAUf,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAMlE,QAAA,MAAM,mBAAmB,GAAI,4HAS1B,wBAAwB,sBAiP1B,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"RichFilterTextField.d.ts","sourceRoot":"","sources":["../../../src/components/RichFilterTextField/RichFilterTextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAUf,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAMlE,QAAA,MAAM,mBAAmB,GAAI,4HAS1B,wBAAwB,sBAsP1B,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -18,17 +18,22 @@ const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, ad
18
18
  const [searchHist, setSearchHist] = useState(filterExprHist);
19
19
  const [inputAnchor, setInputAnchor] = useState(null);
20
20
  const [cursorPos, setCursorPos] = useState(null);
21
- const [currentHintOptions, setCurrentHintOptions] = useState(() => new Map());
21
+ // const [currentHintOptions, setCurrentHintOptions] = useState<
22
+ // Map<string, string | undefined>
23
+ // >(() => new Map());
22
24
  const [focusIdx, setFocusIdx] = useState(0);
23
25
  const inputRef = useRef(null);
24
26
  const textFieldRef = useRef(null);
27
+ const currentHintOptions = (cursorPos != null
28
+ ? getHints(search, cursorPos, fields, operators)
29
+ : null) ?? new Map();
25
30
  const updateHints = useDebounce(() => {
26
31
  if (cursorPos == null)
27
32
  return;
28
- const hints = getHints(search, cursorPos, fields, operators);
29
- setCurrentHintOptions(hints);
33
+ // const hints = getHints(search, cursorPos, fields, operators);
34
+ // setCurrentHintOptions(hints);
30
35
  setFocusIdx(0);
31
- setInputAnchor(hints?.size > 0 ? textFieldRef.current : null);
36
+ setInputAnchor(currentHintOptions?.size > 0 ? textFieldRef.current : null);
32
37
  }, 20);
33
38
  useEffect(() => {
34
39
  if (cursorPos == null)
@@ -38,7 +43,7 @@ const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, ad
38
43
  inputRef.current.selectionEnd = cursorPos;
39
44
  }
40
45
  updateHints();
41
- }, [cursorPos, search]);
46
+ }, [cursorPos, currentHintOptions]);
42
47
  const handleChange = (value, _idx) => {
43
48
  setSearch(value);
44
49
  onChange(value, (v) => setSearchHist(v));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danikokonn/yarik-frontend-lib",
3
- "version": "2.0.58-test1",
3
+ "version": "2.0.58-test4",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "author": "",