@danikokonn/yarik-frontend-lib 2.0.58-test5 → 2.0.58-test7

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,sBAkP1B,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;AAKlE,QAAA,MAAM,mBAAmB,GAAI,4HAS1B,wBAAwB,sBAsP1B,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -13,6 +13,7 @@ const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, ad
13
13
  const { enqueueSnackbar } = useSnackbarContext();
14
14
  const [search, setSearch] = useState(filterExpr);
15
15
  const instant = _instant ?? true;
16
+ // Принудительное изменение состояния, если изменился пропс
16
17
  useEffect(() => setSearch(filterExpr), [filterExpr]);
17
18
  const [searchHist, setSearchHist] = useState(filterExprHist);
18
19
  const [inputAnchor, setInputAnchor] = useState(null);
@@ -27,9 +28,13 @@ const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, ad
27
28
  ? getHints(search, cursorPos, fields, operators)
28
29
  : null) ?? new Map();
29
30
  useEffect(() => {
31
+ if (cursorPos == null)
32
+ return;
33
+ if (currentHintOptions === getHints(search, cursorPos, fields, operators))
34
+ return;
30
35
  setFocusIdx(0);
31
36
  setInputAnchor(currentHintOptions?.size > 0 ? textFieldRef.current : null);
32
- }, [currentHintOptions]);
37
+ }, [search, cursorPos]);
33
38
  useEffect(() => {
34
39
  if (cursorPos == null)
35
40
  return;
@@ -101,7 +106,6 @@ const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, ad
101
106
  case "ArrowRight":
102
107
  case "Space":
103
108
  case "Backspace": {
104
- setInputAnchor(null);
105
109
  setCursorPos(inputRef.current?.selectionStart ?? null);
106
110
  return;
107
111
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danikokonn/yarik-frontend-lib",
3
- "version": "2.0.58-test5",
3
+ "version": "2.0.58-test7",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "author": "",