@danikokonn/yarik-frontend-lib 2.0.58-test20 → 2.0.58-test25

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,KAKN,MAAM,OAAO,CAAC;AAUf,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAKlE,QAAA,MAAM,mBAAmB,GAAI,4HAS1B,wBAAwB,sBAwR1B,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"RichFilterTextField.d.ts","sourceRoot":"","sources":["../../../src/components/RichFilterTextField/RichFilterTextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAUf,OAAO,wBAAwB,MAAM,4BAA4B,CAAC;AAKlE,QAAA,MAAM,mBAAmB,GAAI,4HAS1B,wBAAwB,sBA8R1B,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -12,7 +12,8 @@ import { Stack } from "@mui/material";
12
12
  const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, additionalComponents, instant: _instant, onChange, onSelectFromHistory, }) => {
13
13
  const { enqueueSnackbar } = useSnackbarContext();
14
14
  const [search, setSearch] = useState(filterExpr);
15
- const [searchHist, setSearchHist] = useState(filterExprHist);
15
+ // const [searchHist, setSearchHist] = useState<string[]>(filterExprHist);
16
+ const searchHist = filterExprHist;
16
17
  const [cursorPos, setCursorPos] = useState(null);
17
18
  const [focusIdx, setFocusIdx] = useState(0);
18
19
  const inputRef = useRef(null);
@@ -40,7 +41,7 @@ const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, ad
40
41
  if (cursorPos &&
41
42
  getHints(value, cursorPos, fields, operators) !== currentHintOptions)
42
43
  setFocusIdx(0);
43
- onChange(value, (v) => setSearchHist(v));
44
+ onChange(value /*(v: unknown) => setSearchHist(v as string[])*/);
44
45
  };
45
46
  const insertHint = (hint) => {
46
47
  if (cursorPos == null)
@@ -56,7 +57,6 @@ const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, ad
56
57
  }
57
58
  const { newSearch, newPos } = insertInStrPos(search, cursorPos, hint, fields);
58
59
  setSearch(newSearch);
59
- onChange(newSearch, (v) => setSearchHist(v));
60
60
  let newCursorPos = newPos;
61
61
  if (hint.includes("[") || hint.includes("(") || hint.includes("/")) {
62
62
  newCursorPos--;
@@ -84,7 +84,8 @@ const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, ad
84
84
  insertHint(focusedHint);
85
85
  }
86
86
  else {
87
- onChange(search, (v) => setSearchHist(v));
87
+ onChange(search);
88
+ inputRef.current?.blur();
88
89
  }
89
90
  break;
90
91
  }
@@ -94,7 +95,12 @@ const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, ad
94
95
  break;
95
96
  }
96
97
  default: {
97
- setCursorPos(inputRef.current?.selectionStart ?? null);
98
+ const newCursorPos = inputRef.current?.selectionStart ?? null;
99
+ setCursorPos(newCursorPos);
100
+ if (newCursorPos &&
101
+ getHints(search, newCursorPos, fields, operators) !==
102
+ currentHintOptions)
103
+ setFocusIdx(0);
98
104
  }
99
105
  }
100
106
  };
@@ -182,7 +188,7 @@ const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, ad
182
188
  startAdornment: (React.createElement(InputAdornment, { position: "start" },
183
189
  React.createElement(Stack, { direction: "row", sx: { alignItems: "center" } },
184
190
  !instant && (React.createElement(IconButton, { onClick: (e) => {
185
- onChange(search, (v) => setSearchHist(v));
191
+ onChange(search);
186
192
  e.stopPropagation();
187
193
  }, title: "\u041F\u043E\u0438\u0441\u043A" },
188
194
  React.createElement(SearchRoundedIcon, null))),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danikokonn/yarik-frontend-lib",
3
- "version": "2.0.58-test20",
3
+ "version": "2.0.58-test25",
4
4
  "license": "Apache-2.0",
5
5
  "description": "",
6
6
  "author": "",