slick-table 1.2.3 → 1.2.4
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/dist/index.cjs.js +100 -100
- package/dist/index.es.js +6429 -6370
- package/dist/types/entities/drawer-run-query/index.d.ts +1 -0
- package/dist/types/entities/drawer-run-query/index.d.ts.map +1 -1
- package/dist/types/entities/drawer-run-query/lib/table/tableQuery.d.ts.map +1 -1
- package/dist/types/entities/drawer-run-query/model/consts/consts.d.ts +1 -0
- package/dist/types/entities/drawer-run-query/model/consts/consts.d.ts.map +1 -1
- package/dist/types/entities/drawer-run-query/model/consts/index.d.ts +1 -1
- package/dist/types/entities/drawer-run-query/model/consts/index.d.ts.map +1 -1
- package/dist/types/entities/drawer-run-query/model/index.d.ts +1 -1
- package/dist/types/entities/drawer-run-query/model/index.d.ts.map +1 -1
- package/dist/types/entities/drawer-run-query/ui/ButtonExecuteQuery/ButtonExecuteQuery.d.ts +8 -0
- package/dist/types/entities/drawer-run-query/ui/ButtonExecuteQuery/ButtonExecuteQuery.d.ts.map +1 -0
- package/dist/types/entities/drawer-run-query/ui/ButtonExecuteQuery/ButtonExecuteQuery.style.d.ts +9 -0
- package/dist/types/entities/drawer-run-query/ui/ButtonExecuteQuery/ButtonExecuteQuery.style.d.ts.map +1 -0
- package/dist/types/entities/drawer-run-query/ui/ButtonExecuteQuery/index.d.ts +2 -0
- package/dist/types/entities/drawer-run-query/ui/ButtonExecuteQuery/index.d.ts.map +1 -0
- package/dist/types/entities/drawer-run-query/ui/ColumnTags/ColumnTags.d.ts +11 -0
- package/dist/types/entities/drawer-run-query/ui/ColumnTags/ColumnTags.d.ts.map +1 -0
- package/dist/types/entities/drawer-run-query/ui/ColumnTags/ColumnTags.style.d.ts +13 -0
- package/dist/types/entities/drawer-run-query/ui/ColumnTags/ColumnTags.style.d.ts.map +1 -0
- package/dist/types/entities/drawer-run-query/ui/ColumnTags/index.d.ts +2 -0
- package/dist/types/entities/drawer-run-query/ui/ColumnTags/index.d.ts.map +1 -0
- package/dist/types/entities/drawer-run-query/ui/DrawerRunQuery.d.ts.map +1 -1
- package/dist/types/entities/drawer-run-query/ui/DrawerRunQuery.style.d.ts +1 -14
- package/dist/types/entities/drawer-run-query/ui/DrawerRunQuery.style.d.ts.map +1 -1
- package/dist/types/entities/drawer-run-query/ui/IconButtonClose/IconButtonClose.d.ts +7 -0
- package/dist/types/entities/drawer-run-query/ui/IconButtonClose/IconButtonClose.d.ts.map +1 -0
- package/dist/types/entities/drawer-run-query/ui/IconButtonClose/index.d.ts +2 -0
- package/dist/types/entities/drawer-run-query/ui/IconButtonClose/index.d.ts.map +1 -0
- package/dist/types/entities/drawer-run-query/ui/IconButtonCollapse/IconButtonCollapse.d.ts +8 -0
- package/dist/types/entities/drawer-run-query/ui/IconButtonCollapse/IconButtonCollapse.d.ts.map +1 -0
- package/dist/types/entities/drawer-run-query/ui/IconButtonCollapse/index.d.ts +2 -0
- package/dist/types/entities/drawer-run-query/ui/IconButtonCollapse/index.d.ts.map +1 -0
- package/dist/types/entities/drawer-run-query/ui/IconButtonExpand/IconButtonExpand.d.ts +8 -0
- package/dist/types/entities/drawer-run-query/ui/IconButtonExpand/IconButtonExpand.d.ts.map +1 -0
- package/dist/types/entities/drawer-run-query/ui/IconButtonExpand/index.d.ts +2 -0
- package/dist/types/entities/drawer-run-query/ui/IconButtonExpand/index.d.ts.map +1 -0
- package/dist/types/entities/drawer-run-query/ui/TextAreaQuery/TextAreaQuery.d.ts +10 -0
- package/dist/types/entities/drawer-run-query/ui/TextAreaQuery/TextAreaQuery.d.ts.map +1 -0
- package/dist/types/entities/drawer-run-query/ui/TextAreaQuery/TextAreaQuery.style.d.ts +19 -0
- package/dist/types/entities/drawer-run-query/ui/TextAreaQuery/TextAreaQuery.style.d.ts.map +1 -0
- package/dist/types/entities/drawer-run-query/ui/TextAreaQuery/index.d.ts +2 -0
- package/dist/types/entities/drawer-run-query/ui/TextAreaQuery/index.d.ts.map +1 -0
- package/dist/types/entities/drawer-run-query/ui/Title/Title.d.ts +3 -0
- package/dist/types/entities/drawer-run-query/ui/Title/Title.d.ts.map +1 -0
- package/dist/types/entities/drawer-run-query/ui/Title/Title.style.d.ts +9 -0
- package/dist/types/entities/drawer-run-query/ui/Title/Title.style.d.ts.map +1 -0
- package/dist/types/entities/drawer-run-query/ui/Title/index.d.ts +2 -0
- package/dist/types/entities/drawer-run-query/ui/Title/index.d.ts.map +1 -0
- package/dist/types/entities/popup-summary/ui/PopupSummary.style.d.ts +1 -1
- package/dist/types/features/column-filters/ui/ButtonReset/ButtonReset.style.d.ts +1 -1
- package/dist/types/features/context-menu/ui/ButtonQuery/ui/ButtonQuery.d.ts.map +1 -1
- package/dist/types/features/header-context-menu/ui/Item/Item.style.d.ts +1 -1
- package/dist/types/features/header-context-menu/ui/Title/Title.style.d.ts +3 -3
- package/dist/types/features/header-context-menu/ui/Title/Title.style.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/entities/drawer-run-query/index.ts +1 -0
- package/src/entities/drawer-run-query/lib/table/getColumsHash.ts +18 -18
- package/src/entities/drawer-run-query/lib/table/tableQuery.ts +3 -1
- package/src/entities/drawer-run-query/model/consts/consts.ts +1 -0
- package/src/entities/drawer-run-query/model/consts/index.ts +1 -1
- package/src/entities/drawer-run-query/model/index.ts +1 -1
- package/src/entities/drawer-run-query/ui/ButtonExecuteQuery/ButtonExecuteQuery.style.ts +13 -0
- package/src/entities/drawer-run-query/ui/ButtonExecuteQuery/ButtonExecuteQuery.tsx +21 -0
- package/src/entities/drawer-run-query/ui/ButtonExecuteQuery/index.ts +1 -0
- package/src/entities/drawer-run-query/ui/ColumnTags/ColumnTags.style.ts +18 -0
- package/src/entities/drawer-run-query/ui/ColumnTags/ColumnTags.tsx +44 -0
- package/src/entities/drawer-run-query/ui/ColumnTags/index.ts +1 -0
- package/src/entities/drawer-run-query/ui/DrawerRunQuery.style.ts +2 -55
- package/src/entities/drawer-run-query/ui/DrawerRunQuery.tsx +45 -87
- package/src/entities/drawer-run-query/ui/IconButtonClose/IconButtonClose.tsx +14 -0
- package/src/entities/drawer-run-query/ui/IconButtonClose/index.ts +1 -0
- package/src/entities/drawer-run-query/ui/IconButtonCollapse/IconButtonCollapse.tsx +24 -0
- package/src/entities/drawer-run-query/ui/IconButtonCollapse/index.ts +1 -0
- package/src/entities/drawer-run-query/ui/IconButtonExpand/IconButtonExpand.tsx +21 -0
- package/src/entities/drawer-run-query/ui/IconButtonExpand/index.ts +1 -0
- package/src/entities/drawer-run-query/ui/QueryHistory/QueryHistory.tsx +62 -62
- package/src/entities/drawer-run-query/ui/TextAreaQuery/TextAreaQuery.style.ts +30 -0
- package/src/entities/drawer-run-query/ui/TextAreaQuery/TextAreaQuery.tsx +50 -0
- package/src/entities/drawer-run-query/ui/TextAreaQuery/index.ts +1 -0
- package/src/entities/drawer-run-query/ui/Title/Title.style.ts +13 -0
- package/src/entities/drawer-run-query/ui/Title/Title.tsx +9 -0
- package/src/entities/drawer-run-query/ui/Title/index.ts +1 -0
- package/src/features/context-menu/ui/ButtonQuery/ui/ButtonQuery.tsx +4 -0
- package/src/features/header-context-menu/ui/Title/Title.style.ts +3 -4
- package/src/features/header-context-menu/ui/Title/Title.tsx +3 -3
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Dispatch, FC, MouseEvent, RefObject, SetStateAction } from "react";
|
|
2
|
+
|
|
3
|
+
import { IColumn } from "shared/model/types";
|
|
4
|
+
|
|
5
|
+
import Styled from "./ColumnTags.style";
|
|
6
|
+
|
|
7
|
+
export const ColumnTags: FC<Props> = ({
|
|
8
|
+
columnsHash,
|
|
9
|
+
query,
|
|
10
|
+
queryInputRef,
|
|
11
|
+
setQuery,
|
|
12
|
+
}) => {
|
|
13
|
+
function pasteColumnId(event: MouseEvent<HTMLSpanElement>) {
|
|
14
|
+
const columnId = event.currentTarget.id;
|
|
15
|
+
if (!columnId) return;
|
|
16
|
+
const input = queryInputRef.current;
|
|
17
|
+
if (!input) return;
|
|
18
|
+
const start = input.selectionStart ?? query.length;
|
|
19
|
+
const end = input.selectionEnd ?? query.length;
|
|
20
|
+
setQuery(query.slice(0, start) + columnId + query.slice(end));
|
|
21
|
+
const caret = start + columnId.length;
|
|
22
|
+
requestAnimationFrame(() => {
|
|
23
|
+
input.focus();
|
|
24
|
+
input.setSelectionRange(caret, caret);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Styled.Wrapper className={"column-drawer-tags"}>
|
|
30
|
+
{Object.values(columnsHash).map(({ id, name }) => (
|
|
31
|
+
<Styled.ColumnName key={id} id={id as string} onClick={pasteColumnId}>
|
|
32
|
+
{`#${name}`}
|
|
33
|
+
</Styled.ColumnName>
|
|
34
|
+
))}
|
|
35
|
+
</Styled.Wrapper>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
interface Props {
|
|
40
|
+
columnsHash: Record<string, IColumn>;
|
|
41
|
+
query: string;
|
|
42
|
+
queryInputRef: RefObject<HTMLTextAreaElement>;
|
|
43
|
+
setQuery: Dispatch<SetStateAction<string>>;
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ColumnTags } from "./ColumnTags";
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Box,
|
|
3
|
-
Button,
|
|
4
|
-
Drawer,
|
|
5
|
-
IconButton,
|
|
6
|
-
InputAdornment,
|
|
7
|
-
TextField,
|
|
8
|
-
Typography,
|
|
9
|
-
styled,
|
|
10
|
-
} from "@mui/material";
|
|
1
|
+
import { Box, Drawer, IconButton, styled } from "@mui/material";
|
|
11
2
|
|
|
12
3
|
import { doNotForwardProps } from "shared/lib/dom";
|
|
13
4
|
|
|
@@ -36,37 +27,15 @@ const StyledDrawer = styled(Drawer, {
|
|
|
36
27
|
}));
|
|
37
28
|
|
|
38
29
|
const Header = styled(Box)({
|
|
30
|
+
alignItems: "center",
|
|
39
31
|
display: "flex",
|
|
40
32
|
justifyContent: "space-between",
|
|
41
33
|
});
|
|
42
34
|
|
|
43
|
-
const Title = styled(Typography)({
|
|
44
|
-
color: "#235B95",
|
|
45
|
-
marginBottom: "0.5em",
|
|
46
|
-
fontWeight: "600",
|
|
47
|
-
fontSize: "16px",
|
|
48
|
-
letterSpacing: "-2%",
|
|
49
|
-
minWidth: "14em",
|
|
50
|
-
});
|
|
51
|
-
|
|
52
35
|
const RowsNumber = styled(Box)({
|
|
53
36
|
color: "#1E456F",
|
|
54
37
|
});
|
|
55
38
|
|
|
56
|
-
const StyledTextField = styled(TextField)({
|
|
57
|
-
width: "100%",
|
|
58
|
-
"& .MuiInputBase-root": {
|
|
59
|
-
borderRadius: "10px",
|
|
60
|
-
padding: "11px 14px",
|
|
61
|
-
color: "#235B95",
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
const EndAdornment = styled(InputAdornment)({
|
|
66
|
-
alignSelf: "flex-start",
|
|
67
|
-
marginTop: "-2px",
|
|
68
|
-
});
|
|
69
|
-
|
|
70
39
|
const ClearButton = styled(IconButton)({
|
|
71
40
|
color: "#808080",
|
|
72
41
|
padding: "4px",
|
|
@@ -87,14 +56,6 @@ const ContainerInput = styled(Box)({
|
|
|
87
56
|
marginBottom: "1em",
|
|
88
57
|
});
|
|
89
58
|
|
|
90
|
-
const ColumnName = styled("span")({
|
|
91
|
-
fontSize: "0.875rem",
|
|
92
|
-
cursor: "pointer",
|
|
93
|
-
backgroundColor: "aliceblue",
|
|
94
|
-
borderRadius: "10px",
|
|
95
|
-
padding: "5px",
|
|
96
|
-
});
|
|
97
|
-
|
|
98
59
|
const ContainerTable = styled(Box, {
|
|
99
60
|
shouldForwardProp: doNotForwardProps(["isExpanded"]),
|
|
100
61
|
})<{ isExpanded: boolean }>(({ isExpanded }) => ({
|
|
@@ -105,25 +66,11 @@ const ContainerTable = styled(Box, {
|
|
|
105
66
|
: "0vh",
|
|
106
67
|
}));
|
|
107
68
|
|
|
108
|
-
const StyledButton = styled(Button)({
|
|
109
|
-
backgroundColor: "#2FAF7D",
|
|
110
|
-
color: "#FBFBFB",
|
|
111
|
-
textTransform: "none",
|
|
112
|
-
width: "229px",
|
|
113
|
-
height: "45px",
|
|
114
|
-
borderRadius: "10px",
|
|
115
|
-
});
|
|
116
|
-
|
|
117
69
|
export default {
|
|
118
|
-
Button: StyledButton,
|
|
119
70
|
ClearButton,
|
|
120
|
-
ColumnName,
|
|
121
71
|
ContainerInput,
|
|
122
72
|
ContainerTable,
|
|
123
73
|
Drawer: StyledDrawer,
|
|
124
|
-
EndAdornment,
|
|
125
74
|
Header,
|
|
126
75
|
RowsNumber,
|
|
127
|
-
TextField: StyledTextField,
|
|
128
|
-
Title,
|
|
129
76
|
};
|
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
import { Box
|
|
1
|
+
import { Box } from "@mui/material";
|
|
2
2
|
import { GvizTable } from "myworkql";
|
|
3
|
-
import {
|
|
3
|
+
import { FC, useRef, useState } from "react";
|
|
4
4
|
import { SlickDataView } from "slickgrid";
|
|
5
5
|
|
|
6
6
|
import { localStore } from "shared/lib/localStrore";
|
|
7
7
|
import { SlickgridTable, eventRunQuery } from "shared/lib/slickgrid";
|
|
8
8
|
import { IColumn } from "shared/model/types";
|
|
9
9
|
|
|
10
|
+
import { Title } from "features/header-context-menu/ui/Title";
|
|
11
|
+
|
|
10
12
|
import {
|
|
11
13
|
getColumsHash,
|
|
12
14
|
tableQuery,
|
|
13
15
|
useResizeCanvas,
|
|
14
16
|
useSubscribeToEvent,
|
|
15
17
|
} from "../lib";
|
|
18
|
+
import { ButtonExecuteQuery } from "./ButtonExecuteQuery";
|
|
19
|
+
import { ColumnTags } from "./ColumnTags";
|
|
20
|
+
import { IconButtonClose } from "./IconButtonClose";
|
|
21
|
+
import { IconButtonCollapse } from "./IconButtonCollapse";
|
|
22
|
+
import { IconButtonExpand } from "./IconButtonExpand";
|
|
16
23
|
import { QueryHistory } from "./QueryHistory";
|
|
24
|
+
import { TextAreaQuery } from "./TextAreaQuery";
|
|
17
25
|
|
|
18
26
|
import Styled from "./DrawerRunQuery.style";
|
|
19
27
|
|
|
@@ -30,31 +38,12 @@ export const DrawerRunQuery: FC<Props> = ({ tableId }) => {
|
|
|
30
38
|
eventRunQuery.open = false;
|
|
31
39
|
}
|
|
32
40
|
|
|
33
|
-
function updateQuery(event: ChangeEvent<HTMLTextAreaElement>) {
|
|
34
|
-
setQuery(event.target.value);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
41
|
function clearQuery() {
|
|
38
42
|
const input = queryInputRef.current;
|
|
39
43
|
setQuery("");
|
|
40
44
|
requestAnimationFrame(() => input?.focus());
|
|
41
45
|
}
|
|
42
46
|
|
|
43
|
-
function pasteColumnId(event: MouseEvent<HTMLSpanElement>) {
|
|
44
|
-
const columnId = event.currentTarget.id;
|
|
45
|
-
if (!columnId) return;
|
|
46
|
-
const input = queryInputRef.current;
|
|
47
|
-
if (!input) return;
|
|
48
|
-
const start = input.selectionStart ?? query.length;
|
|
49
|
-
const end = input.selectionEnd ?? query.length;
|
|
50
|
-
setQuery(query.slice(0, start) + columnId + query.slice(end));
|
|
51
|
-
const caret = start + columnId.length;
|
|
52
|
-
requestAnimationFrame(() => {
|
|
53
|
-
input.focus();
|
|
54
|
-
input.setSelectionRange(caret, caret);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
47
|
function executeQuery(query: string) {
|
|
59
48
|
const table = eventRunQuery.table;
|
|
60
49
|
if (!table) return;
|
|
@@ -78,11 +67,13 @@ export const DrawerRunQuery: FC<Props> = ({ tableId }) => {
|
|
|
78
67
|
setColumns(
|
|
79
68
|
Object.keys(newItems[0] || {}).map(
|
|
80
69
|
(key): IColumn => ({
|
|
81
|
-
|
|
70
|
+
cssClass: columnsHash[key].cssClass,
|
|
82
71
|
field: columnsHash[key].field,
|
|
83
|
-
|
|
72
|
+
id: columnsHash[key].id,
|
|
84
73
|
formatter: columnsHash[key].formatter,
|
|
85
|
-
|
|
74
|
+
forPrint: columnsHash[key].forPrint,
|
|
75
|
+
name: columnsHash[key].name,
|
|
76
|
+
printer: columnsHash[key].printer,
|
|
86
77
|
}),
|
|
87
78
|
),
|
|
88
79
|
);
|
|
@@ -98,10 +89,11 @@ export const DrawerRunQuery: FC<Props> = ({ tableId }) => {
|
|
|
98
89
|
return (
|
|
99
90
|
<Styled.Drawer
|
|
100
91
|
anchor={"bottom"}
|
|
101
|
-
open={isOpened}
|
|
102
|
-
onClose={closeDrawer}
|
|
103
92
|
disablePortal
|
|
93
|
+
id={"query-drawer"}
|
|
104
94
|
isExpanded={isExpanded}
|
|
95
|
+
onClose={closeDrawer}
|
|
96
|
+
open={isOpened}
|
|
105
97
|
>
|
|
106
98
|
<QueryHistory
|
|
107
99
|
executeQuery={executeQuery}
|
|
@@ -110,72 +102,38 @@ export const DrawerRunQuery: FC<Props> = ({ tableId }) => {
|
|
|
110
102
|
/>
|
|
111
103
|
<Box>
|
|
112
104
|
<Styled.Header>
|
|
113
|
-
<
|
|
114
|
-
Run query across table data
|
|
115
|
-
</Styled.Title>
|
|
105
|
+
<Title />
|
|
116
106
|
<Box>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
)}
|
|
127
|
-
<IconButton onClick={closeDrawer}>
|
|
128
|
-
<span className={"sgi sgi-close"}></span>
|
|
129
|
-
</IconButton>
|
|
107
|
+
<IconButtonCollapse
|
|
108
|
+
isExpanded={isExpanded}
|
|
109
|
+
setIsExpanded={setIsExpanded}
|
|
110
|
+
/>
|
|
111
|
+
<IconButtonExpand
|
|
112
|
+
isExpanded={isExpanded}
|
|
113
|
+
setIsExpanded={setIsExpanded}
|
|
114
|
+
/>
|
|
115
|
+
<IconButtonClose closeDrawer={closeDrawer} />
|
|
130
116
|
</Box>
|
|
131
117
|
</Styled.Header>
|
|
132
|
-
<Styled.ContainerInput>
|
|
133
|
-
<
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
onChange={updateQuery}
|
|
139
|
-
inputRef={queryInputRef}
|
|
140
|
-
slotProps={{
|
|
141
|
-
input: {
|
|
142
|
-
endAdornment: !!query && (
|
|
143
|
-
<Styled.EndAdornment position={"end"}>
|
|
144
|
-
<Tooltip title={"Clear query"}>
|
|
145
|
-
<Styled.ClearButton
|
|
146
|
-
aria-label={"Clear query"}
|
|
147
|
-
onClick={clearQuery}
|
|
148
|
-
size={"small"}
|
|
149
|
-
>
|
|
150
|
-
<span className={"sgi sgi-close"}></span>
|
|
151
|
-
</Styled.ClearButton>
|
|
152
|
-
</Tooltip>
|
|
153
|
-
</Styled.EndAdornment>
|
|
154
|
-
),
|
|
155
|
-
},
|
|
156
|
-
}}
|
|
157
|
-
value={query}
|
|
118
|
+
<Styled.ContainerInput className={"query-drawer-textfield"}>
|
|
119
|
+
<TextAreaQuery
|
|
120
|
+
clearQuery={clearQuery}
|
|
121
|
+
query={query}
|
|
122
|
+
queryInputRef={queryInputRef}
|
|
123
|
+
setQuery={setQuery}
|
|
158
124
|
/>
|
|
159
|
-
<
|
|
160
|
-
disabled={!query.trim()}
|
|
161
|
-
onClick={() => executeQuery(query)}
|
|
162
|
-
variant={"contained"}
|
|
163
|
-
>
|
|
164
|
-
Execute
|
|
165
|
-
</Styled.Button>
|
|
125
|
+
<ButtonExecuteQuery executeQuery={executeQuery} query={query} />
|
|
166
126
|
</Styled.ContainerInput>
|
|
167
|
-
<
|
|
168
|
-
{
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
</Box>
|
|
178
|
-
<Styled.ContainerTable isExpanded={isExpanded}>
|
|
127
|
+
<ColumnTags
|
|
128
|
+
columnsHash={columnsHash}
|
|
129
|
+
query={query}
|
|
130
|
+
queryInputRef={queryInputRef}
|
|
131
|
+
setQuery={setQuery}
|
|
132
|
+
/>
|
|
133
|
+
<Styled.ContainerTable
|
|
134
|
+
isExpanded={isExpanded}
|
|
135
|
+
className={"query-drawer-table-container"}
|
|
136
|
+
>
|
|
179
137
|
{!!columns.length && (
|
|
180
138
|
<SlickgridTable
|
|
181
139
|
assignIds={true}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IconButton } from "@mui/material";
|
|
2
|
+
import { FC } from "react";
|
|
3
|
+
|
|
4
|
+
export const IconButtonClose: FC<Props> = ({ closeDrawer }) => {
|
|
5
|
+
return (
|
|
6
|
+
<IconButton onClick={closeDrawer}>
|
|
7
|
+
<span className={"sgi sgi-close"}></span>
|
|
8
|
+
</IconButton>
|
|
9
|
+
);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
closeDrawer(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { IconButtonClose } from "./IconButtonClose";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IconButton } from "@mui/material";
|
|
2
|
+
import { Dispatch, FC, SetStateAction } from "react";
|
|
3
|
+
|
|
4
|
+
export const IconButtonCollapse: FC<Props> = ({
|
|
5
|
+
isExpanded,
|
|
6
|
+
setIsExpanded,
|
|
7
|
+
}) => {
|
|
8
|
+
function collapse() {
|
|
9
|
+
setIsExpanded(false);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (!isExpanded) return null;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<IconButton onClick={collapse}>
|
|
16
|
+
<span className={"sgi sgi-minus"}></span>
|
|
17
|
+
</IconButton>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
interface Props {
|
|
22
|
+
isExpanded: boolean;
|
|
23
|
+
setIsExpanded: Dispatch<SetStateAction<boolean>>;
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { IconButtonCollapse } from "./IconButtonCollapse";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { IconButton } from "@mui/material";
|
|
2
|
+
import { Dispatch, FC, SetStateAction } from "react";
|
|
3
|
+
|
|
4
|
+
export const IconButtonExpand: FC<Props> = ({ isExpanded, setIsExpanded }) => {
|
|
5
|
+
function expand() {
|
|
6
|
+
setIsExpanded(true);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
if (isExpanded) return null;
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<IconButton onClick={expand}>
|
|
13
|
+
<span className={"sgi sgi-arrow-expand"}></span>
|
|
14
|
+
</IconButton>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
interface Props {
|
|
19
|
+
isExpanded: boolean;
|
|
20
|
+
setIsExpanded: Dispatch<SetStateAction<boolean>>;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { IconButtonExpand } from "./IconButtonExpand";
|
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
import { IconButton, Tooltip } from "@mui/material";
|
|
2
|
-
import { Dispatch, FC, Fragment, SetStateAction, useState } from "react";
|
|
3
|
-
|
|
4
|
-
import { localStore } from "shared/lib/localStrore";
|
|
5
|
-
import { eventRunQuery } from "shared/lib/slickgrid";
|
|
6
|
-
|
|
7
|
-
import { groupQueriesByDate } from "../../lib";
|
|
8
|
-
|
|
9
|
-
import Styled from "./QueryHistory.style";
|
|
10
|
-
|
|
11
|
-
export const QueryHistory: FC<Props> = ({ executeQuery, query, setQuery }) => {
|
|
12
|
-
const [count, setCount] = useState(0);
|
|
13
|
-
const tableId = eventRunQuery.table?.id || "";
|
|
14
|
-
const history = localStore.queries.get(tableId);
|
|
15
|
-
const groups = groupQueriesByDate(history ?? []);
|
|
16
|
-
|
|
17
|
-
function useQuery(recentQuery: string) {
|
|
18
|
-
setQuery(recentQuery);
|
|
19
|
-
executeQuery(recentQuery);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<Styled.Wrapper>
|
|
24
|
-
{groups.map(({ label, queries }) => (
|
|
25
|
-
<Fragment key={label}>
|
|
26
|
-
<Styled.GroupLabel>{label}</Styled.GroupLabel>
|
|
27
|
-
{queries.map((recentQuery) => (
|
|
28
|
-
<Styled.Item
|
|
29
|
-
key={recentQuery.time}
|
|
30
|
-
className={recentQuery.query === query ? "active" : ""}
|
|
31
|
-
onClick={() => {
|
|
32
|
-
if (recentQuery.query === query) return;
|
|
33
|
-
useQuery(recentQuery.query);
|
|
34
|
-
}}
|
|
35
|
-
title={recentQuery.query}
|
|
36
|
-
>
|
|
37
|
-
<Styled.Title>{recentQuery.query}</Styled.Title>
|
|
38
|
-
<Tooltip title={"Delete from history"}>
|
|
39
|
-
<IconButton
|
|
40
|
-
onClick={(event) => {
|
|
41
|
-
event.stopPropagation();
|
|
42
|
-
localStore.queries.reset(tableId, recentQuery.query);
|
|
43
|
-
// refresh history
|
|
44
|
-
setCount(count + 1);
|
|
45
|
-
}}
|
|
46
|
-
>
|
|
47
|
-
<span className="sgi sgi-close"></span>
|
|
48
|
-
</IconButton>
|
|
49
|
-
</Tooltip>
|
|
50
|
-
</Styled.Item>
|
|
51
|
-
))}
|
|
52
|
-
</Fragment>
|
|
53
|
-
))}
|
|
54
|
-
</Styled.Wrapper>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
interface Props {
|
|
59
|
-
executeQuery(query: string): void;
|
|
60
|
-
query: string;
|
|
61
|
-
setQuery: Dispatch<SetStateAction<string>>;
|
|
62
|
-
}
|
|
1
|
+
import { IconButton, Tooltip } from "@mui/material";
|
|
2
|
+
import { Dispatch, FC, Fragment, SetStateAction, useState } from "react";
|
|
3
|
+
|
|
4
|
+
import { localStore } from "shared/lib/localStrore";
|
|
5
|
+
import { eventRunQuery } from "shared/lib/slickgrid";
|
|
6
|
+
|
|
7
|
+
import { groupQueriesByDate } from "../../lib";
|
|
8
|
+
|
|
9
|
+
import Styled from "./QueryHistory.style";
|
|
10
|
+
|
|
11
|
+
export const QueryHistory: FC<Props> = ({ executeQuery, query, setQuery }) => {
|
|
12
|
+
const [count, setCount] = useState(0);
|
|
13
|
+
const tableId = eventRunQuery.table?.id || "";
|
|
14
|
+
const history = localStore.queries.get(tableId);
|
|
15
|
+
const groups = groupQueriesByDate(history ?? []);
|
|
16
|
+
|
|
17
|
+
function useQuery(recentQuery: string) {
|
|
18
|
+
setQuery(recentQuery);
|
|
19
|
+
executeQuery(recentQuery);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Styled.Wrapper className={"query-drawer-history"}>
|
|
24
|
+
{groups.map(({ label, queries }) => (
|
|
25
|
+
<Fragment key={label}>
|
|
26
|
+
<Styled.GroupLabel>{label}</Styled.GroupLabel>
|
|
27
|
+
{queries.map((recentQuery) => (
|
|
28
|
+
<Styled.Item
|
|
29
|
+
key={recentQuery.time}
|
|
30
|
+
className={recentQuery.query === query ? "active" : ""}
|
|
31
|
+
onClick={() => {
|
|
32
|
+
if (recentQuery.query === query) return;
|
|
33
|
+
useQuery(recentQuery.query);
|
|
34
|
+
}}
|
|
35
|
+
title={recentQuery.query}
|
|
36
|
+
>
|
|
37
|
+
<Styled.Title>{recentQuery.query}</Styled.Title>
|
|
38
|
+
<Tooltip title={"Delete from history"}>
|
|
39
|
+
<IconButton
|
|
40
|
+
onClick={(event) => {
|
|
41
|
+
event.stopPropagation();
|
|
42
|
+
localStore.queries.reset(tableId, recentQuery.query);
|
|
43
|
+
// refresh history
|
|
44
|
+
setCount(count + 1);
|
|
45
|
+
}}
|
|
46
|
+
>
|
|
47
|
+
<span className="sgi sgi-close"></span>
|
|
48
|
+
</IconButton>
|
|
49
|
+
</Tooltip>
|
|
50
|
+
</Styled.Item>
|
|
51
|
+
))}
|
|
52
|
+
</Fragment>
|
|
53
|
+
))}
|
|
54
|
+
</Styled.Wrapper>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
interface Props {
|
|
59
|
+
executeQuery(query: string): void;
|
|
60
|
+
query: string;
|
|
61
|
+
setQuery: Dispatch<SetStateAction<string>>;
|
|
62
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { IconButton, InputAdornment, TextField } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
const StyledTextField = styled(TextField)({
|
|
5
|
+
width: "100%",
|
|
6
|
+
"& .MuiInputBase-root": {
|
|
7
|
+
borderRadius: "10px",
|
|
8
|
+
padding: "11px 14px",
|
|
9
|
+
color: "#235B95",
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const EndAdornment = styled(InputAdornment)({
|
|
14
|
+
alignSelf: "flex-start",
|
|
15
|
+
marginTop: "-2px",
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const IconButtonClear = styled(IconButton)({
|
|
19
|
+
color: "#808080",
|
|
20
|
+
padding: "4px",
|
|
21
|
+
"& .sgi": {
|
|
22
|
+
display: "block",
|
|
23
|
+
},
|
|
24
|
+
"&:hover": {
|
|
25
|
+
backgroundColor: "#E8F4FE",
|
|
26
|
+
color: "#235B95",
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export default { TextField: StyledTextField, EndAdornment, IconButtonClear };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Tooltip } from "@mui/material";
|
|
2
|
+
import { ChangeEvent, Dispatch, FC, RefObject, SetStateAction } from "react";
|
|
3
|
+
|
|
4
|
+
import Styled from "./TextAreaQuery.style";
|
|
5
|
+
|
|
6
|
+
export const TextAreaQuery: FC<Props> = ({
|
|
7
|
+
clearQuery,
|
|
8
|
+
query,
|
|
9
|
+
queryInputRef,
|
|
10
|
+
setQuery,
|
|
11
|
+
}) => {
|
|
12
|
+
function updateQuery(event: ChangeEvent<HTMLTextAreaElement>) {
|
|
13
|
+
setQuery(event.target.value);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Styled.TextField
|
|
18
|
+
label="Query"
|
|
19
|
+
maxRows={10}
|
|
20
|
+
multiline
|
|
21
|
+
onChange={updateQuery}
|
|
22
|
+
inputRef={queryInputRef}
|
|
23
|
+
slotProps={{
|
|
24
|
+
input: {
|
|
25
|
+
endAdornment: !!query && (
|
|
26
|
+
<Styled.EndAdornment position={"end"}>
|
|
27
|
+
<Tooltip title={"Clear query"}>
|
|
28
|
+
<Styled.IconButtonClear
|
|
29
|
+
aria-label={"Clear query"}
|
|
30
|
+
onClick={clearQuery}
|
|
31
|
+
size={"small"}
|
|
32
|
+
>
|
|
33
|
+
<span className={"sgi sgi-close"}></span>
|
|
34
|
+
</Styled.IconButtonClear>
|
|
35
|
+
</Tooltip>
|
|
36
|
+
</Styled.EndAdornment>
|
|
37
|
+
),
|
|
38
|
+
},
|
|
39
|
+
}}
|
|
40
|
+
value={query}
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
interface Props {
|
|
46
|
+
clearQuery(): void;
|
|
47
|
+
query: string;
|
|
48
|
+
queryInputRef: RefObject<HTMLTextAreaElement>;
|
|
49
|
+
setQuery: Dispatch<SetStateAction<string>>;
|
|
50
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { TextAreaQuery } from "./TextAreaQuery";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { Typography } from "@mui/material";
|
|
3
|
+
|
|
4
|
+
const Title = styled(Typography)({
|
|
5
|
+
color: "#235B95",
|
|
6
|
+
marginBottom: "0.5em",
|
|
7
|
+
fontWeight: "600",
|
|
8
|
+
fontSize: "16px",
|
|
9
|
+
letterSpacing: "-2%",
|
|
10
|
+
minWidth: "14em",
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export default { Title };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Title } from "./Title";
|
|
@@ -2,6 +2,8 @@ import { Dispatch, FC, SetStateAction } from "react";
|
|
|
2
2
|
|
|
3
3
|
import { eventContextMenu, eventRunQuery } from "shared/lib/slickgrid";
|
|
4
4
|
|
|
5
|
+
import { TABLE_QUERY_ID } from "entities/drawer-run-query";
|
|
6
|
+
|
|
5
7
|
import Styled from "../../ContextMenu.style";
|
|
6
8
|
|
|
7
9
|
export const ButtonQuery: FC<Props> = ({ setIsOpened }) => {
|
|
@@ -13,6 +15,8 @@ export const ButtonQuery: FC<Props> = ({ setIsOpened }) => {
|
|
|
13
15
|
eventRunQuery.open = true;
|
|
14
16
|
}
|
|
15
17
|
|
|
18
|
+
if (table?.id === TABLE_QUERY_ID) return null;
|
|
19
|
+
|
|
16
20
|
return (
|
|
17
21
|
<Styled.Li onClick={openModalWindow}>
|
|
18
22
|
<Styled.Icon className={"sgi sgi-table-large"}></Styled.Icon>
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Typography, styled } from "@mui/material";
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const StyledTypography = styled(Typography)({
|
|
4
4
|
color: "#1e456f",
|
|
5
|
-
marginBottom: "0.6em",
|
|
6
5
|
fontSize: "1rem",
|
|
7
6
|
});
|
|
8
7
|
|
|
9
|
-
export default {
|
|
8
|
+
export default { Typography: StyledTypography };
|