@danikokonn/yarik-frontend-lib 2.0.2-test3
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.
- package/LICENSE +201 -0
- package/README.md +1 -0
- package/dist/components/ActionDialog/ActionDialog.d.ts +23 -0
- package/dist/components/ActionDialog/ActionDialog.d.ts.map +1 -0
- package/dist/components/ActionDialog/ActionDialog.js +48 -0
- package/dist/components/ActionDialog/ActionDialogProps.d.ts +32 -0
- package/dist/components/ActionDialog/ActionDialogProps.d.ts.map +1 -0
- package/dist/components/ActionDialog/ActionDialogProps.js +1 -0
- package/dist/components/ActionDialog/index.d.ts +5 -0
- package/dist/components/ActionDialog/index.d.ts.map +1 -0
- package/dist/components/ActionDialog/index.js +3 -0
- package/dist/components/ColumnSearchInput/ColumnSearchInput.d.ts +16 -0
- package/dist/components/ColumnSearchInput/ColumnSearchInput.d.ts.map +1 -0
- package/dist/components/ColumnSearchInput/ColumnSearchInput.js +30 -0
- package/dist/components/ColumnSearchInput/ColumnSearchInputProps.d.ts +18 -0
- package/dist/components/ColumnSearchInput/ColumnSearchInputProps.d.ts.map +1 -0
- package/dist/components/ColumnSearchInput/ColumnSearchInputProps.js +1 -0
- package/dist/components/ColumnSearchInput/index.d.ts +5 -0
- package/dist/components/ColumnSearchInput/index.d.ts.map +1 -0
- package/dist/components/ColumnSearchInput/index.js +3 -0
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.d.ts +5 -0
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -0
- package/dist/components/DateTimeRangePicker/DateTimeRangePicker.js +51 -0
- package/dist/components/DateTimeRangePicker/DateTimeRangePickerProps.d.ts +11 -0
- package/dist/components/DateTimeRangePicker/DateTimeRangePickerProps.d.ts.map +1 -0
- package/dist/components/DateTimeRangePicker/DateTimeRangePickerProps.js +1 -0
- package/dist/components/DateTimeRangePicker/index.d.ts +5 -0
- package/dist/components/DateTimeRangePicker/index.d.ts.map +1 -0
- package/dist/components/DateTimeRangePicker/index.js +3 -0
- package/dist/components/DatetimeRangeInput/DatetimeRangeInput.d.ts +23 -0
- package/dist/components/DatetimeRangeInput/DatetimeRangeInput.d.ts.map +1 -0
- package/dist/components/DatetimeRangeInput/DatetimeRangeInput.js +80 -0
- package/dist/components/DatetimeRangeInput/DatetimeRangeInputProps.d.ts +43 -0
- package/dist/components/DatetimeRangeInput/DatetimeRangeInputProps.d.ts.map +1 -0
- package/dist/components/DatetimeRangeInput/DatetimeRangeInputProps.js +1 -0
- package/dist/components/DatetimeRangeInput/index.d.ts +5 -0
- package/dist/components/DatetimeRangeInput/index.d.ts.map +1 -0
- package/dist/components/DatetimeRangeInput/index.js +3 -0
- package/dist/components/Footer/Footer.d.ts +7 -0
- package/dist/components/Footer/Footer.d.ts.map +1 -0
- package/dist/components/Footer/Footer.js +22 -0
- package/dist/components/Footer/index.d.ts +3 -0
- package/dist/components/Footer/index.d.ts.map +1 -0
- package/dist/components/Footer/index.js +2 -0
- package/dist/components/IpAddressInput/IpAddressInput.d.ts +5 -0
- package/dist/components/IpAddressInput/IpAddressInput.d.ts.map +1 -0
- package/dist/components/IpAddressInput/IpAddressInput.js +21 -0
- package/dist/components/IpAddressInput/IpAddressInputProps.d.ts +13 -0
- package/dist/components/IpAddressInput/IpAddressInputProps.d.ts.map +1 -0
- package/dist/components/IpAddressInput/IpAddressInputProps.js +1 -0
- package/dist/components/IpAddressInput/index.d.ts +5 -0
- package/dist/components/IpAddressInput/index.d.ts.map +1 -0
- package/dist/components/IpAddressInput/index.js +3 -0
- package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInput.d.ts +5 -0
- package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInput.d.ts.map +1 -0
- package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInput.js +11 -0
- package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInputProps.d.ts +10 -0
- package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInputProps.d.ts.map +1 -0
- package/dist/components/IpAddressSwitchableInput/IpAddressSwitchableInputProps.js +1 -0
- package/dist/components/IpAddressSwitchableInput/index.d.ts +5 -0
- package/dist/components/IpAddressSwitchableInput/index.d.ts.map +1 -0
- package/dist/components/IpAddressSwitchableInput/index.js +3 -0
- package/dist/components/LocalizedDatetimePicker/LocalizedDatetimePicker.d.ts +5 -0
- package/dist/components/LocalizedDatetimePicker/LocalizedDatetimePicker.d.ts.map +1 -0
- package/dist/components/LocalizedDatetimePicker/LocalizedDatetimePicker.js +29 -0
- package/dist/components/LocalizedDatetimePicker/LocalizedDatetimePickerProps.d.ts +10 -0
- package/dist/components/LocalizedDatetimePicker/LocalizedDatetimePickerProps.d.ts.map +1 -0
- package/dist/components/LocalizedDatetimePicker/LocalizedDatetimePickerProps.js +1 -0
- package/dist/components/LocalizedDatetimePicker/index.d.ts +5 -0
- package/dist/components/LocalizedDatetimePicker/index.d.ts.map +1 -0
- package/dist/components/LocalizedDatetimePicker/index.js +3 -0
- package/dist/components/Navigation/NavMenu.d.ts +19 -0
- package/dist/components/Navigation/NavMenu.d.ts.map +1 -0
- package/dist/components/Navigation/NavMenu.js +44 -0
- package/dist/components/Navigation/Navigation.d.ts +4 -0
- package/dist/components/Navigation/Navigation.d.ts.map +1 -0
- package/dist/components/Navigation/Navigation.js +188 -0
- package/dist/components/Navigation/NavigationProps.d.ts +30 -0
- package/dist/components/Navigation/NavigationProps.d.ts.map +1 -0
- package/dist/components/Navigation/NavigationProps.js +1 -0
- package/dist/components/Navigation/index.d.ts +5 -0
- package/dist/components/Navigation/index.d.ts.map +1 -0
- package/dist/components/Navigation/index.js +3 -0
- package/dist/components/NumberRangeInput/NumberRangeInput.d.ts +5 -0
- package/dist/components/NumberRangeInput/NumberRangeInput.d.ts.map +1 -0
- package/dist/components/NumberRangeInput/NumberRangeInput.js +51 -0
- package/dist/components/NumberRangeInput/NumberRangeInputProps.d.ts +11 -0
- package/dist/components/NumberRangeInput/NumberRangeInputProps.d.ts.map +1 -0
- package/dist/components/NumberRangeInput/NumberRangeInputProps.js +1 -0
- package/dist/components/NumberRangeInput/index.d.ts +5 -0
- package/dist/components/NumberRangeInput/index.d.ts.map +1 -0
- package/dist/components/NumberRangeInput/index.js +3 -0
- package/dist/components/PageWrapper/PageWrapper.d.ts +4 -0
- package/dist/components/PageWrapper/PageWrapper.d.ts.map +1 -0
- package/dist/components/PageWrapper/PageWrapper.js +16 -0
- package/dist/components/PageWrapper/PageWrapperProps.d.ts +10 -0
- package/dist/components/PageWrapper/PageWrapperProps.d.ts.map +1 -0
- package/dist/components/PageWrapper/PageWrapperProps.js +1 -0
- package/dist/components/PageWrapper/index.d.ts +5 -0
- package/dist/components/PageWrapper/index.d.ts.map +1 -0
- package/dist/components/PageWrapper/index.js +3 -0
- package/dist/components/RichFilterTextField/FilterHistoryMenu.d.ts +8 -0
- package/dist/components/RichFilterTextField/FilterHistoryMenu.d.ts.map +1 -0
- package/dist/components/RichFilterTextField/FilterHistoryMenu.js +43 -0
- package/dist/components/RichFilterTextField/HintOptionsMenu.d.ts +12 -0
- package/dist/components/RichFilterTextField/HintOptionsMenu.d.ts.map +1 -0
- package/dist/components/RichFilterTextField/HintOptionsMenu.js +50 -0
- package/dist/components/RichFilterTextField/RichFilterTextField.d.ts +5 -0
- package/dist/components/RichFilterTextField/RichFilterTextField.d.ts.map +1 -0
- package/dist/components/RichFilterTextField/RichFilterTextField.js +177 -0
- package/dist/components/RichFilterTextField/RichFilterTextFieldProps.d.ts +71 -0
- package/dist/components/RichFilterTextField/RichFilterTextFieldProps.d.ts.map +1 -0
- package/dist/components/RichFilterTextField/RichFilterTextFieldProps.js +1 -0
- package/dist/components/RichFilterTextField/index.d.ts +5 -0
- package/dist/components/RichFilterTextField/index.d.ts.map +1 -0
- package/dist/components/RichFilterTextField/index.js +3 -0
- package/dist/components/RichFilterTextField/utils.d.ts +7 -0
- package/dist/components/RichFilterTextField/utils.d.ts.map +1 -0
- package/dist/components/RichFilterTextField/utils.js +131 -0
- package/dist/components/SmartTable/RowContent.d.ts +14 -0
- package/dist/components/SmartTable/RowContent.d.ts.map +1 -0
- package/dist/components/SmartTable/RowContent.js +29 -0
- package/dist/components/SmartTable/RuleRow.d.ts +22 -0
- package/dist/components/SmartTable/RuleRow.d.ts.map +1 -0
- package/dist/components/SmartTable/RuleRow.js +35 -0
- package/dist/components/SmartTable/SmartTable.d.ts +4 -0
- package/dist/components/SmartTable/SmartTable.d.ts.map +1 -0
- package/dist/components/SmartTable/SmartTable.js +175 -0
- package/dist/components/SmartTable/SmartTableProps.d.ts +40 -0
- package/dist/components/SmartTable/SmartTableProps.d.ts.map +1 -0
- package/dist/components/SmartTable/SmartTableProps.js +1 -0
- package/dist/components/SmartTable/TableHeader.d.ts +5 -0
- package/dist/components/SmartTable/TableHeader.d.ts.map +1 -0
- package/dist/components/SmartTable/TableHeader.js +13 -0
- package/dist/components/SmartTable/index.d.ts +5 -0
- package/dist/components/SmartTable/index.d.ts.map +1 -0
- package/dist/components/SmartTable/index.js +3 -0
- package/dist/components/SortBtn/SortBtn.d.ts +4 -0
- package/dist/components/SortBtn/SortBtn.d.ts.map +1 -0
- package/dist/components/SortBtn/SortBtn.js +23 -0
- package/dist/components/SortBtn/SortBtnProps.d.ts +7 -0
- package/dist/components/SortBtn/SortBtnProps.d.ts.map +1 -0
- package/dist/components/SortBtn/SortBtnProps.js +1 -0
- package/dist/components/SortBtn/index.d.ts +5 -0
- package/dist/components/SortBtn/index.d.ts.map +1 -0
- package/dist/components/SortBtn/index.js +3 -0
- package/dist/components/SubtaskItem/SubtaskItem.d.ts +4 -0
- package/dist/components/SubtaskItem/SubtaskItem.d.ts.map +1 -0
- package/dist/components/SubtaskItem/SubtaskItem.js +66 -0
- package/dist/components/SubtaskItem/SubtaskItemProps.d.ts +10 -0
- package/dist/components/SubtaskItem/SubtaskItemProps.d.ts.map +1 -0
- package/dist/components/SubtaskItem/SubtaskItemProps.js +1 -0
- package/dist/components/SubtaskItem/index.d.ts +5 -0
- package/dist/components/SubtaskItem/index.d.ts.map +1 -0
- package/dist/components/SubtaskItem/index.js +3 -0
- package/dist/components/TaskLoader/TaskLoader.d.ts +4 -0
- package/dist/components/TaskLoader/TaskLoader.d.ts.map +1 -0
- package/dist/components/TaskLoader/TaskLoader.js +333 -0
- package/dist/components/TaskLoader/TaskLoaderProps.d.ts +5 -0
- package/dist/components/TaskLoader/TaskLoaderProps.d.ts.map +1 -0
- package/dist/components/TaskLoader/TaskLoaderProps.js +1 -0
- package/dist/components/TaskLoader/index.d.ts +5 -0
- package/dist/components/TaskLoader/index.d.ts.map +1 -0
- package/dist/components/TaskLoader/index.js +3 -0
- package/dist/components/TaskStateDialog/TaskStateDialog.d.ts +4 -0
- package/dist/components/TaskStateDialog/TaskStateDialog.d.ts.map +1 -0
- package/dist/components/TaskStateDialog/TaskStateDialog.js +106 -0
- package/dist/components/TaskStateDialog/TaskStateDialogProps.d.ts +18 -0
- package/dist/components/TaskStateDialog/TaskStateDialogProps.d.ts.map +1 -0
- package/dist/components/TaskStateDialog/TaskStateDialogProps.js +1 -0
- package/dist/components/TaskStateDialog/index.d.ts +5 -0
- package/dist/components/TaskStateDialog/index.d.ts.map +1 -0
- package/dist/components/TaskStateDialog/index.js +3 -0
- package/dist/components/icons/GenerateAndRunIcon.d.ts +8 -0
- package/dist/components/icons/GenerateAndRunIcon.d.ts.map +1 -0
- package/dist/components/icons/GenerateAndRunIcon.js +29 -0
- package/dist/components/icons/GenerateIcon.d.ts +8 -0
- package/dist/components/icons/GenerateIcon.d.ts.map +1 -0
- package/dist/components/icons/GenerateIcon.js +27 -0
- package/dist/components/icons/IntegerIcon.d.ts +8 -0
- package/dist/components/icons/IntegerIcon.d.ts.map +1 -0
- package/dist/components/icons/IntegerIcon.js +15 -0
- package/dist/components/icons/ProcessingIcon.d.ts +3 -0
- package/dist/components/icons/ProcessingIcon.d.ts.map +1 -0
- package/dist/components/icons/ProcessingIcon.js +15 -0
- package/dist/components/icons/QueueIcon.d.ts +8 -0
- package/dist/components/icons/QueueIcon.d.ts.map +1 -0
- package/dist/components/icons/QueueIcon.js +15 -0
- package/dist/components/icons/RangeIcon.d.ts +8 -0
- package/dist/components/icons/RangeIcon.d.ts.map +1 -0
- package/dist/components/icons/RangeIcon.js +15 -0
- package/dist/components/icons/RunIcon.d.ts +8 -0
- package/dist/components/icons/RunIcon.d.ts.map +1 -0
- package/dist/components/icons/RunIcon.js +18 -0
- package/dist/components/icons/TextModeIcon.d.ts +5 -0
- package/dist/components/icons/TextModeIcon.d.ts.map +1 -0
- package/dist/components/icons/TextModeIcon.js +8 -0
- package/dist/components/icons/TreeModeIcon.d.ts +5 -0
- package/dist/components/icons/TreeModeIcon.d.ts.map +1 -0
- package/dist/components/icons/TreeModeIcon.js +8 -0
- package/dist/components/icons/index.d.ts +10 -0
- package/dist/components/icons/index.d.ts.map +1 -0
- package/dist/components/icons/index.js +9 -0
- package/dist/components/index.d.ts +36 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +35 -0
- package/dist/http.d.ts +25 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +101 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/providers/AirflowProvider.d.ts +14 -0
- package/dist/providers/AirflowProvider.d.ts.map +1 -0
- package/dist/providers/AirflowProvider.js +80 -0
- package/dist/providers/DagStateProvider.d.ts +25 -0
- package/dist/providers/DagStateProvider.d.ts.map +1 -0
- package/dist/providers/DagStateProvider.js +115 -0
- package/dist/providers/SessionProvider.d.ts +11 -0
- package/dist/providers/SessionProvider.d.ts.map +1 -0
- package/dist/providers/SessionProvider.js +37 -0
- package/dist/providers/SnackBarProvider.d.ts +10 -0
- package/dist/providers/SnackBarProvider.d.ts.map +1 -0
- package/dist/providers/SnackBarProvider.js +35 -0
- package/dist/providers/index.d.ts +9 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +8 -0
- package/dist/types.d.ts +80 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +26 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +193 -0
- package/package.json +94 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState, } from "react";
|
|
2
|
+
import IconButton from "@mui/material/IconButton";
|
|
3
|
+
import InputAdornment from "@mui/material/InputAdornment";
|
|
4
|
+
import TextField from "@mui/material/TextField";
|
|
5
|
+
import ClearIcon from "@mui/icons-material/Clear";
|
|
6
|
+
import SearchRoundedIcon from "@mui/icons-material/SearchRounded";
|
|
7
|
+
import HintOptionsMenu from "./HintOptionsMenu";
|
|
8
|
+
import { getHints, insertInStrPos } from "./utils";
|
|
9
|
+
import { useSnackbarContext } from "../../providers";
|
|
10
|
+
import { useDebounce } from "../../utils";
|
|
11
|
+
import FilterHistoryMenu from "./FilterHistoryMenu";
|
|
12
|
+
import { Stack } from "@mui/material";
|
|
13
|
+
const RichFilterTextField = ({ filterExpr, filterExprHist, fields, operators, additionalComponents, instant: _instant, onChange, onSelectFromHistory, }) => {
|
|
14
|
+
const { enqueueSnackbar } = useSnackbarContext();
|
|
15
|
+
const [search, setSearch] = useState(filterExpr);
|
|
16
|
+
const instant = _instant ?? true;
|
|
17
|
+
useEffect(() => setSearch(filterExpr), [filterExpr]);
|
|
18
|
+
const [searchHist, setSearchHist] = useState(filterExprHist);
|
|
19
|
+
const [inputAnchor, setInputAnchor] = useState(null);
|
|
20
|
+
const [cursorPos, setCursorPos] = useState(null);
|
|
21
|
+
const [currentHintOptions, setCurrentHintOptions] = useState(() => new Map());
|
|
22
|
+
const [focusIdx, setFocusIdx] = useState(0);
|
|
23
|
+
const inputRef = useRef(null);
|
|
24
|
+
const textFieldRef = useRef(null);
|
|
25
|
+
const updateHints = useDebounce(() => {
|
|
26
|
+
if (cursorPos == null)
|
|
27
|
+
return;
|
|
28
|
+
const hints = getHints(search, cursorPos, fields, operators);
|
|
29
|
+
setCurrentHintOptions(hints);
|
|
30
|
+
setFocusIdx(0);
|
|
31
|
+
setInputAnchor(hints?.size > 0 ? textFieldRef.current : null);
|
|
32
|
+
}, 20);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (cursorPos == null)
|
|
35
|
+
return;
|
|
36
|
+
if (inputRef.current && cursorPos !== inputRef.current.selectionStart) {
|
|
37
|
+
inputRef.current.selectionStart = cursorPos;
|
|
38
|
+
inputRef.current.selectionEnd = cursorPos;
|
|
39
|
+
}
|
|
40
|
+
updateHints();
|
|
41
|
+
}, [cursorPos]);
|
|
42
|
+
const handleChange = (value, _idx) => {
|
|
43
|
+
setSearch(value);
|
|
44
|
+
onChange(value, (v) => setSearchHist(v));
|
|
45
|
+
};
|
|
46
|
+
const insertHint = (hint) => {
|
|
47
|
+
if (cursorPos == null)
|
|
48
|
+
return;
|
|
49
|
+
if (hint.includes("[")) {
|
|
50
|
+
hint = "[]";
|
|
51
|
+
}
|
|
52
|
+
else if (hint.includes("(")) {
|
|
53
|
+
hint = "()";
|
|
54
|
+
}
|
|
55
|
+
else if (hint.includes("regex")) {
|
|
56
|
+
hint = hint.replace("regex", "");
|
|
57
|
+
}
|
|
58
|
+
const { newSearch, newPos } = insertInStrPos(search, cursorPos, hint, fields);
|
|
59
|
+
handleChange(newSearch);
|
|
60
|
+
if (hint.includes("[") || hint.includes("(") || hint.includes("/")) {
|
|
61
|
+
setCursorPos(newPos - 1);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
setCursorPos(newPos);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
const handleKeyUp = (e) => {
|
|
68
|
+
switch (e.code) {
|
|
69
|
+
case "ArrowDown": {
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
case "ArrowUp": {
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
case "Enter": {
|
|
78
|
+
e.preventDefault();
|
|
79
|
+
if (inputAnchor) {
|
|
80
|
+
const focusedHint = currentHintOptions.entries().toArray()[focusIdx][0];
|
|
81
|
+
insertHint(focusedHint);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
onChange(search, (v) => setSearchHist(v));
|
|
85
|
+
}
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
case "Escape":
|
|
89
|
+
case "Tab": {
|
|
90
|
+
setInputAnchor(null);
|
|
91
|
+
setCursorPos(null);
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
default: {
|
|
95
|
+
setCursorPos(inputRef.current?.selectionStart ?? null);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const handleKeyDown = (e) => {
|
|
100
|
+
switch (e.code) {
|
|
101
|
+
case "ArrowLeft":
|
|
102
|
+
case "ArrowRight":
|
|
103
|
+
case "Space":
|
|
104
|
+
case "Backspace": {
|
|
105
|
+
setInputAnchor(null);
|
|
106
|
+
setCursorPos(inputRef.current?.selectionStart ?? null);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
case "ArrowDown": {
|
|
110
|
+
if (inputAnchor) {
|
|
111
|
+
if (focusIdx + 1 < currentHintOptions.size) {
|
|
112
|
+
setFocusIdx(focusIdx + 1);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
setFocusIdx(0);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
e.preventDefault();
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
case "ArrowUp": {
|
|
122
|
+
if (inputAnchor) {
|
|
123
|
+
if (focusIdx - 1 >= 0) {
|
|
124
|
+
setFocusIdx(focusIdx - 1);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
setFocusIdx(currentHintOptions.size - 1);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
e.preventDefault();
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
case "Enter": {
|
|
134
|
+
e.preventDefault();
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
case "Escape":
|
|
138
|
+
case "Tab": {
|
|
139
|
+
setInputAnchor(null);
|
|
140
|
+
setCursorPos(null);
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
default: {
|
|
144
|
+
setCursorPos(inputRef.current?.selectionStart ?? null);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
return (React.createElement(React.Fragment, null,
|
|
149
|
+
React.createElement(TextField, { ref: textFieldRef, inputRef: inputRef, fullWidth: true, size: "small", value: search, title: search, multiline: true, maxRows: 1, onChange: (e) => (instant ? handleChange : setSearch)(e.target.value), onClick: (e) => {
|
|
150
|
+
if (e.target !== e.currentTarget)
|
|
151
|
+
return;
|
|
152
|
+
setCursorPos(inputRef.current?.selectionStart ?? null);
|
|
153
|
+
}, onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, slotProps: {
|
|
154
|
+
input: {
|
|
155
|
+
startAdornment: (React.createElement(InputAdornment, { position: "start" },
|
|
156
|
+
React.createElement(Stack, { direction: "row", sx: { alignItems: "center" } },
|
|
157
|
+
!instant && (React.createElement(IconButton, { onClick: (e) => {
|
|
158
|
+
onChange(search, (v) => setSearchHist(v));
|
|
159
|
+
e.stopPropagation();
|
|
160
|
+
}, title: "\u041F\u043E\u0438\u0441\u043A" },
|
|
161
|
+
React.createElement(SearchRoundedIcon, null))),
|
|
162
|
+
React.createElement(FilterHistoryMenu, { searchHist: searchHist, onChange: onSelectFromHistory || handleChange, onCopy: () => enqueueSnackbar("Предустановка фильтра скопирована в буфер обмена", "default") }),
|
|
163
|
+
additionalComponents))),
|
|
164
|
+
endAdornment: (React.createElement(InputAdornment, { position: "end" },
|
|
165
|
+
React.createElement(IconButton, { title: "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440\u044B", disabled: !search, onClick: (e) => {
|
|
166
|
+
handleChange("");
|
|
167
|
+
e.stopPropagation();
|
|
168
|
+
} },
|
|
169
|
+
React.createElement(ClearIcon, null)))),
|
|
170
|
+
},
|
|
171
|
+
} }),
|
|
172
|
+
React.createElement(HintOptionsMenu, { inputAnchor: inputAnchor, inputRef: inputRef, textFieldRef: textFieldRef, options: currentHintOptions, focusIdx: focusIdx, onSelectHint: insertHint, onClose: () => {
|
|
173
|
+
setInputAnchor(null);
|
|
174
|
+
setCursorPos(null);
|
|
175
|
+
} })));
|
|
176
|
+
};
|
|
177
|
+
export default RichFilterTextField;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface FilterField {
|
|
3
|
+
/**
|
|
4
|
+
* Название поля. Используется при подстановке. Должно оканчиваться двоеточием
|
|
5
|
+
*/
|
|
6
|
+
name: string;
|
|
7
|
+
/**
|
|
8
|
+
* Дополнительный текст с описанием поля
|
|
9
|
+
*/
|
|
10
|
+
desc?: string;
|
|
11
|
+
type: "datetime" | "bool" | "text" | "number";
|
|
12
|
+
/**
|
|
13
|
+
* Определяет задаётся ли `opList` в режиме черного списка либо белого списка. По умолчанию - `false` (черный список)
|
|
14
|
+
*/
|
|
15
|
+
denyAll?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Список допустимых либо запрещённых идентификаторов операторов. Вид фильтрации задаётся в пропсе `denyAll`
|
|
18
|
+
*/
|
|
19
|
+
opList?: string[];
|
|
20
|
+
/**
|
|
21
|
+
* Список допустимых значений поля
|
|
22
|
+
*/
|
|
23
|
+
values?: FilterValue[];
|
|
24
|
+
}
|
|
25
|
+
export interface FilterOperator {
|
|
26
|
+
/**
|
|
27
|
+
* Идентификатор оператора. Идентификаторы используются для связки со списком допустимых или запрещённых операторов полей `opList`
|
|
28
|
+
*/
|
|
29
|
+
id: string;
|
|
30
|
+
/**
|
|
31
|
+
* Название оператора. Используется при подстановке
|
|
32
|
+
*/
|
|
33
|
+
name: string;
|
|
34
|
+
/**
|
|
35
|
+
* Дополнительный текст с описанием оператора
|
|
36
|
+
*/
|
|
37
|
+
desc?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface FilterValue {
|
|
40
|
+
/**
|
|
41
|
+
* Название значения. Используется при подстановке
|
|
42
|
+
*/
|
|
43
|
+
name: string;
|
|
44
|
+
/**
|
|
45
|
+
* Дополнительный текст с описанием значения
|
|
46
|
+
*/
|
|
47
|
+
desc?: string;
|
|
48
|
+
}
|
|
49
|
+
export default interface RichFilterTextFieldProps {
|
|
50
|
+
/**
|
|
51
|
+
* Строковое выражение фильтра
|
|
52
|
+
*/
|
|
53
|
+
filterExpr: string;
|
|
54
|
+
/**
|
|
55
|
+
* Список предыдущих значений выражений строкового фильтра
|
|
56
|
+
*/
|
|
57
|
+
filterExprHist: string[];
|
|
58
|
+
/**
|
|
59
|
+
* Список полей фильтрации
|
|
60
|
+
*/
|
|
61
|
+
fields: FilterField[];
|
|
62
|
+
/**
|
|
63
|
+
* Список операторов фильтрации
|
|
64
|
+
*/
|
|
65
|
+
operators: FilterOperator[];
|
|
66
|
+
instant?: boolean;
|
|
67
|
+
additionalComponents?: React.JSX.Element[];
|
|
68
|
+
onChange(value: string, onSuccess?: (v: unknown) => void): void;
|
|
69
|
+
onSelectFromHistory?(value: string, idx: number): void;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=RichFilterTextFieldProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RichFilterTextFieldProps.d.ts","sourceRoot":"","sources":["../../../src/components/RichFilterTextField/RichFilterTextFieldProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;IAC9C;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,CAAC,OAAO,WAAW,wBAAwB;IAC/C;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB;;OAEG;IACH,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB;;OAEG;IACH,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oBAAoB,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,GAAG,IAAI,CAAC;IAChE,mBAAmB,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACxD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/RichFilterTextField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,cAAc,uBAAuB,CAAC;AAEtC,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACjF,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FilterField, FilterOperator } from "./RichFilterTextFieldProps";
|
|
2
|
+
export declare const getHints: (search: string, cursorPos: number, fields: FilterField[], operators: FilterOperator[]) => Map<string, string | undefined>;
|
|
3
|
+
export declare const insertInStrPos: (search: string, cursorPos: number, hint: string, fields: FilterField[]) => {
|
|
4
|
+
newSearch: string;
|
|
5
|
+
newPos: number;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/RichFilterTextField/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,cAAc,EAEf,MAAM,4BAA4B,CAAC;AAapC,eAAO,MAAM,QAAQ,GACnB,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,QAAQ,WAAW,EAAE,EACrB,WAAW,cAAc,EAAE,oCAqE5B,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,QAAQ,MAAM,EACd,WAAW,MAAM,EACjB,MAAM,MAAM,EACZ,QAAQ,WAAW,EAAE;;;CAoFtB,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
const getSingleMatch = (token, fields) => {
|
|
2
|
+
const matchedFields = fields.filter((v) => v.name.startsWith(token));
|
|
3
|
+
if (matchedFields.length !== 1)
|
|
4
|
+
return undefined;
|
|
5
|
+
return matchedFields[0];
|
|
6
|
+
};
|
|
7
|
+
const getMapOf = (list) => new Map(list.map((v) => [v.name, v.desc]));
|
|
8
|
+
export const getHints = (search, cursorPos, fields, operators) => {
|
|
9
|
+
if (search.length === 0) {
|
|
10
|
+
return getMapOf(fields);
|
|
11
|
+
}
|
|
12
|
+
const charBefore = search[cursorPos - 1];
|
|
13
|
+
const charAfter = search[cursorPos];
|
|
14
|
+
const tokensBeforeCursor = search.substring(0, cursorPos).split(" ");
|
|
15
|
+
// Ближайший токен слева от курсора
|
|
16
|
+
const token = tokensBeforeCursor[tokensBeforeCursor.length - 1];
|
|
17
|
+
switch (charBefore) {
|
|
18
|
+
case " ": {
|
|
19
|
+
if (typeof charAfter === "undefined" || charAfter === " ")
|
|
20
|
+
return getMapOf(fields);
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
case ":": {
|
|
24
|
+
// Все поля, которые начинаются с значения токена
|
|
25
|
+
const nextWhiteSpace = typeof charAfter === "undefined" || charAfter === " ";
|
|
26
|
+
const matchedField = getSingleMatch(token, fields);
|
|
27
|
+
if (nextWhiteSpace && matchedField) {
|
|
28
|
+
const availableOps = matchedField.opList;
|
|
29
|
+
const denyAll = matchedField.denyAll;
|
|
30
|
+
if (denyAll) {
|
|
31
|
+
return getMapOf((availableOps &&
|
|
32
|
+
operators.filter((v) => availableOps.includes(v.id))) ||
|
|
33
|
+
[]);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
return getMapOf((availableOps &&
|
|
37
|
+
operators.filter((v) => !availableOps.includes(v.id))) ||
|
|
38
|
+
operators);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
default: {
|
|
44
|
+
if (typeof charAfter === "undefined" || charAfter === " ") {
|
|
45
|
+
const tokensBeforeCursor = search.substring(0, cursorPos).split(" ");
|
|
46
|
+
const token = tokensBeforeCursor[tokensBeforeCursor.length - 1];
|
|
47
|
+
const [tokenField, tokenOperator] = token.split(":");
|
|
48
|
+
const matchedField = getSingleMatch(`${tokenField}:`, fields);
|
|
49
|
+
const fieldHasValues = Boolean(matchedField?.values);
|
|
50
|
+
const validToken = Boolean(tokenOperator &&
|
|
51
|
+
operators.find((v) => v.name === tokenOperator) != null);
|
|
52
|
+
if (fieldHasValues && validToken) {
|
|
53
|
+
return getMapOf(matchedField?.values || []);
|
|
54
|
+
}
|
|
55
|
+
return getMapOf(fields.filter((v) => v.name.startsWith(token)));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return getMapOf([]);
|
|
60
|
+
};
|
|
61
|
+
export const insertInStrPos = (search, cursorPos, hint, fields) => {
|
|
62
|
+
if (search.length === 0) {
|
|
63
|
+
return {
|
|
64
|
+
newSearch: hint,
|
|
65
|
+
newPos: hint.length,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
const charBefore = search[cursorPos - 1];
|
|
69
|
+
const tokensBeforeCursor = search.substring(0, cursorPos).split(" ");
|
|
70
|
+
const token = tokensBeforeCursor[tokensBeforeCursor.length - 1];
|
|
71
|
+
const [tokenField, _tokenOperator] = token.split(":");
|
|
72
|
+
const matchedField = getSingleMatch(tokenField, fields);
|
|
73
|
+
switch (charBefore) {
|
|
74
|
+
case " ":
|
|
75
|
+
case ":": {
|
|
76
|
+
if (matchedField?.type === "datetime" && !hint.endsWith("/")) {
|
|
77
|
+
const formatDate = "YYYY-MM-DD HH:MM:SS";
|
|
78
|
+
const rangeHint = `("${formatDate}","${formatDate}")`;
|
|
79
|
+
if (hint.startsWith("(")) {
|
|
80
|
+
const newSearch = search.substring(0, cursorPos) +
|
|
81
|
+
rangeHint +
|
|
82
|
+
search.substring(cursorPos, search.length);
|
|
83
|
+
return {
|
|
84
|
+
newSearch: newSearch,
|
|
85
|
+
newPos: cursorPos + rangeHint.length + 1,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
else if (hint.startsWith("[")) {
|
|
89
|
+
const newSearch = search.substring(0, cursorPos) +
|
|
90
|
+
`["${formatDate}",]` +
|
|
91
|
+
search.substring(cursorPos, search.length);
|
|
92
|
+
return {
|
|
93
|
+
newSearch: newSearch,
|
|
94
|
+
newPos: cursorPos + rangeHint.length + 1,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
const dateHint = `${hint}"${formatDate}"`;
|
|
98
|
+
const newSearch = search.substring(0, cursorPos) +
|
|
99
|
+
dateHint +
|
|
100
|
+
search.substring(cursorPos, search.length);
|
|
101
|
+
return {
|
|
102
|
+
newSearch: newSearch,
|
|
103
|
+
newPos: cursorPos + dateHint.length,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
const newSearch = search.substring(0, cursorPos) +
|
|
107
|
+
hint +
|
|
108
|
+
search.substring(cursorPos, search.length);
|
|
109
|
+
return {
|
|
110
|
+
newSearch: newSearch,
|
|
111
|
+
newPos: cursorPos + hint.length,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
default: {
|
|
115
|
+
const fieldHasValues = Boolean(matchedField?.values);
|
|
116
|
+
const hintIsValue = matchedField?.values?.find((v) => v.name === hint);
|
|
117
|
+
if (fieldHasValues && hintIsValue) {
|
|
118
|
+
tokensBeforeCursor[tokensBeforeCursor.length - 1] += hint;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
tokensBeforeCursor[tokensBeforeCursor.length - 1] = hint;
|
|
122
|
+
}
|
|
123
|
+
const subsBeforeCursor = tokensBeforeCursor.join(" ");
|
|
124
|
+
const newSearch = subsBeforeCursor + search.substring(cursorPos, search.length);
|
|
125
|
+
return {
|
|
126
|
+
newSearch: newSearch,
|
|
127
|
+
newPos: subsBeforeCursor.length,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { Column } from "../../types";
|
|
3
|
+
import { SxProps, Theme } from "@mui/material";
|
|
4
|
+
interface RowContentProps<T> {
|
|
5
|
+
row: T;
|
|
6
|
+
columns: Column<T>[];
|
|
7
|
+
onDoubleClick?(rowId: string | null): void;
|
|
8
|
+
onSelectRow(rowId: string | null): void;
|
|
9
|
+
controlComponent?(row: T): ReactNode;
|
|
10
|
+
controlComponentColSx?: SxProps<Theme>;
|
|
11
|
+
}
|
|
12
|
+
export default function RowContent<T>({ row, columns, onSelectRow, onDoubleClick, controlComponent, controlComponentColSx, }: RowContentProps<T>): React.JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=RowContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RowContent.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/RowContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE/C,UAAU,eAAe,CAAC,CAAC;IACzB,GAAG,EAAE,CAAC,CAAC;IACP,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IAC3C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IACxC,gBAAgB,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC;IACrC,qBAAqB,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACxC;AAUD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,CAAC,EAAE,EACpC,GAAG,EACH,OAAO,EACP,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,qBAAqB,GACtB,EAAE,eAAe,CAAC,CAAC,CAAC,qBAoCpB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import TableCell from "@mui/material/TableCell";
|
|
3
|
+
const hiddenTextStyle = {
|
|
4
|
+
whiteSpace: "nowrap",
|
|
5
|
+
overflow: "hidden",
|
|
6
|
+
textOverflow: "ellipsis",
|
|
7
|
+
paddingTop: "0.25rem",
|
|
8
|
+
paddingBottom: "0.25rem",
|
|
9
|
+
};
|
|
10
|
+
export default function RowContent({ row, columns, onSelectRow, onDoubleClick, controlComponent, controlComponentColSx, }) {
|
|
11
|
+
return (React.createElement(React.Fragment, null,
|
|
12
|
+
columns.map((col, idx) => (React.createElement(TableCell, { sx: {
|
|
13
|
+
...hiddenTextStyle,
|
|
14
|
+
...col.colSx,
|
|
15
|
+
}, key: idx, onClick: (_) => {
|
|
16
|
+
const selection = window.getSelection();
|
|
17
|
+
if (selection && selection.toString().length > 0)
|
|
18
|
+
return;
|
|
19
|
+
onSelectRow(Object(row).id);
|
|
20
|
+
}, onDoubleClick: (_) => (onDoubleClick || (() => { }))(Object(row).id) }, col.cellContentComponent
|
|
21
|
+
? col.cellContentComponent(row)
|
|
22
|
+
: Object(row)[col.name] || "N/A"))),
|
|
23
|
+
controlComponent && (React.createElement(TableCell, { sx: {
|
|
24
|
+
textAlign: "center",
|
|
25
|
+
cursor: "default",
|
|
26
|
+
p: 0,
|
|
27
|
+
...controlComponentColSx,
|
|
28
|
+
} }, controlComponent(row)))));
|
|
29
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { TableRowProps } from "@mui/material/TableRow";
|
|
3
|
+
import { Column } from "../../types";
|
|
4
|
+
import { SxProps, Theme } from "@mui/material";
|
|
5
|
+
interface RowProps<T> {
|
|
6
|
+
row: T;
|
|
7
|
+
columns: Column<T>[];
|
|
8
|
+
sx?: SxProps<Theme>;
|
|
9
|
+
selectedRow?: string | null;
|
|
10
|
+
ContentWrapper?({ children, dagId, rowProps, }: {
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
dagId: string;
|
|
13
|
+
rowProps: TableRowProps;
|
|
14
|
+
}): React.JSX.Element;
|
|
15
|
+
onDoubleClick?(rowId: string | null): void;
|
|
16
|
+
onSelectRow(rowId: string | null): void;
|
|
17
|
+
controlComponent?(row: T): ReactNode;
|
|
18
|
+
controlComponentColSx?: SxProps<Theme>;
|
|
19
|
+
}
|
|
20
|
+
export default function RuleRow<T>({ row, columns, sx, selectedRow, onSelectRow, onDoubleClick, controlComponent, ContentWrapper, controlComponentColSx, }: RowProps<T>): React.JSX.Element;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=RuleRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuleRow.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/RuleRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAiB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE/C,UAAU,QAAQ,CAAC,CAAC;IAClB,GAAG,EAAE,CAAC,CAAC;IACP,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrB,EAAE,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,cAAc,CAAC,CAAC,EACd,QAAQ,EACR,KAAK,EACL,QAAQ,GACT,EAAE;QACD,QAAQ,CAAC,EAAE,SAAS,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,aAAa,CAAC;KACzB,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC;IACtB,aAAa,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IAC3C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IACxC,gBAAgB,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC;IACrC,qBAAqB,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;CACxC;AAgDD,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,CAAC,EAAE,EACjC,GAAG,EACH,OAAO,EACP,EAAE,EACF,WAAW,EACX,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,qBAAqB,GACtB,EAAE,QAAQ,CAAC,CAAC,CAAC,qBAoCb"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import TableCell from "@mui/material/TableCell";
|
|
3
|
+
const hiddenTextStyle = {
|
|
4
|
+
whiteSpace: "nowrap",
|
|
5
|
+
overflow: "hidden",
|
|
6
|
+
textOverflow: "ellipsis",
|
|
7
|
+
paddingTop: "0.25rem",
|
|
8
|
+
paddingBottom: "0.25rem",
|
|
9
|
+
};
|
|
10
|
+
function RowContent({ row, columns, onSelectRow, onDoubleClick, }) {
|
|
11
|
+
return (React.createElement(React.Fragment, null, columns.map((col, idx) => (React.createElement(TableCell, { sx: {
|
|
12
|
+
...hiddenTextStyle,
|
|
13
|
+
...col.colSx,
|
|
14
|
+
}, key: idx, onClick: (_) => {
|
|
15
|
+
const selection = window.getSelection();
|
|
16
|
+
if (selection && selection.toString().length > 0)
|
|
17
|
+
return;
|
|
18
|
+
onSelectRow(Object(row).id);
|
|
19
|
+
}, onDoubleClick: (_) => onDoubleClick(Object(row).id) }, col.cellContentComponent
|
|
20
|
+
? col.cellContentComponent(row)
|
|
21
|
+
: Object(row)[col.name] || "N/A")))));
|
|
22
|
+
}
|
|
23
|
+
export default function RuleRow({ row, columns, sx, selectedRow, onSelectRow, onDoubleClick, controlComponent, ContentWrapper, controlComponentColSx, }) {
|
|
24
|
+
const content = (React.createElement(React.Fragment, null,
|
|
25
|
+
React.createElement(RowContent, { onSelectRow: onSelectRow, onDoubleClick: onDoubleClick || (() => { }), row: row, columns: columns }),
|
|
26
|
+
controlComponent && (React.createElement(TableCell, { sx: {
|
|
27
|
+
textAlign: "center",
|
|
28
|
+
cursor: "default",
|
|
29
|
+
p: 0,
|
|
30
|
+
...controlComponentColSx,
|
|
31
|
+
} }, controlComponent(row)))));
|
|
32
|
+
return ContentWrapper ? (React.createElement(ContentWrapper, { dagId: Object(row).id, rowProps: {
|
|
33
|
+
selected: Object(row).id === selectedRow,
|
|
34
|
+
} }, content)) : (content);
|
|
35
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import SmartTableProps from "./SmartTableProps";
|
|
3
|
+
export default function SmartTable<T>({ rows, columns, pageN, numPages, perPage, loading, minWidth, width, rowStyles, selectable, selectedRow, sx, disablePerPageSelector, globalSearch, columnAutoWidth, error, globalSearchComponent, ContentWrapper, onRowDoubleClick, onSelectRow, controlComponent: ControlComponent, onToggleSort, onInputSearch, onPageSelect, onChangePerPage, controlComponentColSx, perPageOptions, }: SmartTableProps<T>): React.JSX.Element;
|
|
4
|
+
//# sourceMappingURL=SmartTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartTable.d.ts","sourceRoot":"","sources":["../../../src/components/SmartTable/SmartTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAsBlD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAiHhD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,CAAC,EAAE,EACpC,IAAI,EACJ,OAAO,EACP,KAAK,EACL,QAAQ,EACR,OAAO,EACP,OAAO,EACP,QAAQ,EACR,KAAK,EACL,SAAS,EACT,UAAU,EACV,WAAW,EACX,EAAE,EACF,sBAAsB,EACtB,YAAY,EACZ,eAAe,EACf,KAAK,EACL,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAAE,gBAAgB,EAClC,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,cAAc,GACf,EAAE,eAAe,CAAC,CAAC,CAAC,qBA4TpB"}
|