@danikokonn/yarik-frontend-lib 2.0.58-test25 → 2.0.58-test27
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,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import RichFilterTextFieldProps from "./RichFilterTextFieldProps";
|
|
3
|
-
declare const RichFilterTextField: ({ filterExpr, filterExprHist, fields, operators, additionalComponents, instant: _instant, onChange, onSelectFromHistory, }: RichFilterTextFieldProps) => React.JSX.Element;
|
|
3
|
+
declare const RichFilterTextField: ({ filterExpr, filterExprHist: searchHist, fields, operators, additionalComponents, instant: _instant, onChange, onSelectFromHistory, }: RichFilterTextFieldProps) => React.JSX.Element;
|
|
4
4
|
export default RichFilterTextField;
|
|
5
5
|
//# sourceMappingURL=RichFilterTextField.d.ts.map
|
|
@@ -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,
|
|
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,wIAS1B,wBAAwB,sBA+R1B,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -9,11 +9,9 @@ import { getHints, insertInStrPos } from "./utils";
|
|
|
9
9
|
import { useSnackbarContext } from "../../providers";
|
|
10
10
|
import FilterHistoryMenu from "./FilterHistoryMenu";
|
|
11
11
|
import { Stack } from "@mui/material";
|
|
12
|
-
const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, additionalComponents, instant: _instant, onChange, onSelectFromHistory, }) => {
|
|
12
|
+
const RichFilterTextField = ({ filterExpr, filterExprHist: searchHist, fields, operators, additionalComponents, instant: _instant, onChange, onSelectFromHistory, }) => {
|
|
13
13
|
const { enqueueSnackbar } = useSnackbarContext();
|
|
14
14
|
const [search, setSearch] = useState(filterExpr);
|
|
15
|
-
// const [searchHist, setSearchHist] = useState<string[]>(filterExprHist);
|
|
16
|
-
const searchHist = filterExprHist;
|
|
17
15
|
const [cursorPos, setCursorPos] = useState(null);
|
|
18
16
|
const [focusIdx, setFocusIdx] = useState(0);
|
|
19
17
|
const inputRef = useRef(null);
|
|
@@ -57,6 +55,8 @@ const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, ad
|
|
|
57
55
|
}
|
|
58
56
|
const { newSearch, newPos } = insertInStrPos(search, cursorPos, hint, fields);
|
|
59
57
|
setSearch(newSearch);
|
|
58
|
+
if (instant)
|
|
59
|
+
onChange(newSearch);
|
|
60
60
|
let newCursorPos = newPos;
|
|
61
61
|
if (hint.includes("[") || hint.includes("(") || hint.includes("/")) {
|
|
62
62
|
newCursorPos--;
|
|
@@ -197,6 +197,8 @@ const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, ad
|
|
|
197
197
|
endAdornment: (React.createElement(InputAdornment, { position: "end" },
|
|
198
198
|
React.createElement(IconButton, { title: "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440\u044B", disabled: !search, onClick: (e) => {
|
|
199
199
|
handleChange("");
|
|
200
|
+
setCursorPos(null);
|
|
201
|
+
setFocusIdx(0);
|
|
200
202
|
e.stopPropagation();
|
|
201
203
|
} },
|
|
202
204
|
React.createElement(ClearIcon, null)))),
|