@quillsql/react 1.6.1 → 1.6.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/lib/AddToDashboardButton.d.ts +1 -0
- package/lib/AddToDashboardButton.js +2 -0
- package/lib/AddToDashboardButton.js.map +1 -0
- package/lib/AddToDashboardModal.d.ts +22 -0
- package/lib/AddToDashboardModal.js +638 -0
- package/lib/AddToDashboardModal.js.map +1 -0
- package/lib/BarList.js +28 -28
- package/lib/BarList.js.map +1 -1
- package/lib/Chart.js +30 -114
- package/lib/Chart.js.map +1 -1
- package/lib/Context.d.ts +3 -3
- package/lib/Context.js +3 -3
- package/lib/Context.js.map +1 -1
- package/lib/Dashboard.js +31 -16
- package/lib/Dashboard.js.map +1 -1
- package/lib/Dialog.d.ts +68 -0
- package/lib/Dialog.js +407 -0
- package/lib/Dialog.js.map +1 -0
- package/lib/Portal.d.ts +32 -0
- package/lib/Portal.js +171 -0
- package/lib/Portal.js.map +1 -0
- package/lib/Props.d.ts +0 -0
- package/lib/Props.js +2 -0
- package/lib/Props.js.map +1 -0
- package/lib/QuillProvider.d.ts +32 -14
- package/lib/QuillProvider.js +15 -2
- package/lib/QuillProvider.js.map +1 -1
- package/lib/ReportBuilder.d.ts +26 -2
- package/lib/ReportBuilder.js +210 -486
- package/lib/ReportBuilder.js.map +1 -1
- package/lib/SQLEditor.d.ts +38 -1
- package/lib/SQLEditor.js +385 -210
- package/lib/SQLEditor.js.map +1 -1
- package/lib/Table.js +12 -14
- package/lib/Table.js.map +1 -1
- package/lib/components/BigModal/BigModal.d.ts +14 -0
- package/lib/components/BigModal/BigModal.js +85 -0
- package/lib/components/BigModal/BigModal.js.map +1 -0
- package/lib/components/BigModal/Modal.d.ts +14 -0
- package/lib/components/BigModal/Modal.js +109 -0
- package/lib/components/BigModal/Modal.js.map +1 -0
- package/lib/components/Modal/Modal.d.ts +1 -1
- package/lib/hooks/useQuill.js +14 -24
- package/lib/hooks/useQuill.js.map +1 -1
- package/lib/hooks/useSyncRefs.d.ts +5 -0
- package/lib/hooks/useSyncRefs.js +38 -0
- package/lib/hooks/useSyncRefs.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types/Props.d.ts +0 -0
- package/lib/types/Props.js +2 -0
- package/lib/types/Props.js.map +1 -0
- package/lib/types.d.ts +27 -0
- package/lib/types.js +6 -0
- package/lib/types.js.map +1 -0
- package/package.json +2 -1
- package/src/AddToDashboardModal.tsx +1213 -0
- package/src/BarList.tsx +28 -28
- package/src/Chart.tsx +31 -107
- package/src/Context.tsx +8 -5
- package/src/Dashboard.tsx +29 -2
- package/src/QuillProvider.tsx +52 -10
- package/src/ReportBuilder.tsx +420 -649
- package/src/SQLEditor.tsx +805 -235
- package/src/Table.tsx +20 -26
- package/src/components/BigModal/BigModal.tsx +108 -0
- package/src/components/Modal/Modal.tsx +1 -1
- package/src/continue_logs.txt +75 -0
- package/src/hooks/useQuill.ts +2 -16
- package/src/index.ts +1 -0
package/src/ReportBuilder.tsx
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
useState,
|
|
3
|
-
useContext,
|
|
4
|
-
useCallback,
|
|
5
|
-
useEffect,
|
|
6
|
-
useRef,
|
|
7
|
-
} from 'react';
|
|
1
|
+
import React, { useState, useContext, useCallback, useEffect } from 'react';
|
|
8
2
|
// import './nightOwlLight.css';
|
|
9
3
|
import axios from 'axios';
|
|
10
4
|
import { TailSpin } from 'react-loader-spinner';
|
|
@@ -19,6 +13,7 @@ import {
|
|
|
19
13
|
} from '@heroicons/react/20/solid';
|
|
20
14
|
import { convertPostgresColumn } from './SQLEditor';
|
|
21
15
|
import { format } from 'date-fns';
|
|
16
|
+
import { QuillTheme } from './QuillProvider';
|
|
22
17
|
|
|
23
18
|
interface Option {
|
|
24
19
|
value: string;
|
|
@@ -31,6 +26,29 @@ interface SelectComponentProps {
|
|
|
31
26
|
options: Option[];
|
|
32
27
|
}
|
|
33
28
|
|
|
29
|
+
interface ButtonComponentProps {
|
|
30
|
+
onClick: () => void;
|
|
31
|
+
label: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface ModalTriggerComponentProps {
|
|
35
|
+
onClick: () => void;
|
|
36
|
+
label: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface ModalComponentProps {
|
|
40
|
+
children: any;
|
|
41
|
+
isOpen: boolean;
|
|
42
|
+
onClose: () => void;
|
|
43
|
+
title: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface TextInputComponentProps {
|
|
47
|
+
onChange: (e: any) => void;
|
|
48
|
+
value: string;
|
|
49
|
+
id: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
34
52
|
interface ReportBuilderProps {
|
|
35
53
|
onChangeQuery: (query: string) => void;
|
|
36
54
|
onChangeData: (data: object[]) => void;
|
|
@@ -38,6 +56,11 @@ interface ReportBuilderProps {
|
|
|
38
56
|
onChangeLoading: (loading: boolean) => void;
|
|
39
57
|
onError: (error: string) => void;
|
|
40
58
|
SelectComponent: (props: SelectComponentProps) => JSX.Element;
|
|
59
|
+
ButtonComponent: (props: ButtonComponentProps) => JSX.Element;
|
|
60
|
+
ModalComponent: (props: ModalComponentProps) => JSX.Element;
|
|
61
|
+
ModalTriggerComponent: (props: ModalTriggerComponentProps) => JSX.Element;
|
|
62
|
+
TextInputComponent: (props: TextInputComponentProps) => JSX.Element;
|
|
63
|
+
tagStyle: React.CSSProperties;
|
|
41
64
|
}
|
|
42
65
|
|
|
43
66
|
export default function ReportBuilder({
|
|
@@ -47,11 +70,17 @@ export default function ReportBuilder({
|
|
|
47
70
|
onChangeLoading,
|
|
48
71
|
onError,
|
|
49
72
|
SelectComponent,
|
|
73
|
+
ButtonComponent,
|
|
74
|
+
ModalComponent,
|
|
75
|
+
ModalTriggerComponent,
|
|
76
|
+
TextInputComponent,
|
|
77
|
+
tagStyle,
|
|
50
78
|
}: ReportBuilderProps) {
|
|
51
79
|
const [data, setData] = useState([]);
|
|
52
80
|
const [client] = useContext(ClientContext);
|
|
53
81
|
const [schema, setSchema] = useContext(SchemaContext);
|
|
54
|
-
const [theme] =
|
|
82
|
+
const [theme] =
|
|
83
|
+
useContext<[QuillTheme, (theme: QuillTheme) => void]>(ThemeContext);
|
|
55
84
|
const [columns, setColumns] = useState([]);
|
|
56
85
|
const [fields, setFields] = useState([]);
|
|
57
86
|
|
|
@@ -107,23 +136,34 @@ export default function ReportBuilder({
|
|
|
107
136
|
}, []);
|
|
108
137
|
|
|
109
138
|
const runQuery = async query => {
|
|
110
|
-
const { publicKey, customerId, environment } =
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
139
|
+
const { publicKey, customerId, environment, queryEndpoint, queryHeaders } =
|
|
140
|
+
client;
|
|
141
|
+
|
|
142
|
+
let response;
|
|
143
|
+
if (queryEndpoint) {
|
|
144
|
+
response = await axios.post(
|
|
145
|
+
queryEndpoint,
|
|
146
|
+
{ metadata: { query, task: 'query' } },
|
|
147
|
+
{ headers: queryHeaders }
|
|
148
|
+
);
|
|
149
|
+
} else {
|
|
150
|
+
response = await axios.post(
|
|
151
|
+
`https://quill-344421.uc.r.appspot.com/dashquery`,
|
|
152
|
+
{
|
|
153
|
+
query,
|
|
124
154
|
},
|
|
125
|
-
|
|
126
|
-
|
|
155
|
+
{
|
|
156
|
+
params: {
|
|
157
|
+
orgId: customerId,
|
|
158
|
+
publicKey,
|
|
159
|
+
},
|
|
160
|
+
headers: {
|
|
161
|
+
Authorization: `Bearer `,
|
|
162
|
+
environment: environment || undefined,
|
|
163
|
+
},
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
}
|
|
127
167
|
if (response && response.data && response.data.errorMessage) {
|
|
128
168
|
onError(response.data.errorMessage);
|
|
129
169
|
setData([]);
|
|
@@ -154,6 +194,11 @@ export default function ReportBuilder({
|
|
|
154
194
|
onChangeQuery={onChangeQuery}
|
|
155
195
|
runQuery={runQuery}
|
|
156
196
|
SelectComponent={SelectComponent}
|
|
197
|
+
ButtonComponent={ButtonComponent}
|
|
198
|
+
ModalComponent={ModalComponent}
|
|
199
|
+
ModalTriggerComponent={ModalTriggerComponent}
|
|
200
|
+
TextInputComponent={TextInputComponent}
|
|
201
|
+
tagStyle={tagStyle}
|
|
157
202
|
/>
|
|
158
203
|
);
|
|
159
204
|
}
|
|
@@ -213,8 +258,13 @@ function ReportingTool({
|
|
|
213
258
|
data,
|
|
214
259
|
runQuery,
|
|
215
260
|
SelectComponent,
|
|
261
|
+
ButtonComponent,
|
|
216
262
|
onChangeQuery,
|
|
217
263
|
theme,
|
|
264
|
+
ModalComponent,
|
|
265
|
+
ModalTriggerComponent,
|
|
266
|
+
TextInputComponent,
|
|
267
|
+
tagStyle,
|
|
218
268
|
}) {
|
|
219
269
|
const [selectedTable, setSelectedTable] = useState(schema[0]);
|
|
220
270
|
const [selectedColumn, setSelectedColumn] = useState(schema[0].columns[0]);
|
|
@@ -1008,66 +1058,34 @@ function ReportingTool({
|
|
|
1008
1058
|
|
|
1009
1059
|
return (
|
|
1010
1060
|
<div style={{ marginLeft: '25px' }}>
|
|
1011
|
-
<div
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
>
|
|
1020
|
-
Table
|
|
1021
|
-
</div>
|
|
1022
|
-
{/* <br />
|
|
1023
|
-
<div>what ast should be</div>
|
|
1024
|
-
<div>{JSON.stringify(lmao)}</div>
|
|
1025
|
-
<br /> */}
|
|
1026
|
-
{/* <div>actual ast</div>
|
|
1027
|
-
<div>{JSON.stringify(AST)}</div>
|
|
1028
|
-
<br /> */}
|
|
1029
|
-
{/* <div>actual sql query</div>
|
|
1030
|
-
<div>{sqlQuery}</div>
|
|
1031
|
-
<br /> */}
|
|
1032
|
-
{/* <div>group bys</div>
|
|
1033
|
-
<div>{JSON.stringify(groupBys)}</div>
|
|
1034
|
-
<div>aggregations</div>
|
|
1035
|
-
<div>{JSON.stringify(aggregations)}</div> */}
|
|
1036
|
-
|
|
1037
|
-
{/* <Dropdown
|
|
1038
|
-
value={selectedTable.name}
|
|
1039
|
-
onChange={(e) => {
|
|
1040
|
-
const table = schema.find((t) => t.name === e);
|
|
1041
|
-
setSelectedTable(table);
|
|
1061
|
+
<div style={{ maxWidth: 245 }}>
|
|
1062
|
+
<div
|
|
1063
|
+
style={{
|
|
1064
|
+
fontSize: 14,
|
|
1065
|
+
marginBottom: '6px',
|
|
1066
|
+
fontWeight: '600',
|
|
1067
|
+
color: theme.secondaryTextColor,
|
|
1068
|
+
fontFamily: theme?.fontFamily,
|
|
1042
1069
|
}}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
setSelectedTable(table);
|
|
1052
|
-
}}
|
|
1053
|
-
options={
|
|
1054
|
-
schema?.length
|
|
1055
|
-
? schema.map(elem => {
|
|
1056
|
-
return { label: elem.displayName, value: elem.displayName };
|
|
1057
|
-
})
|
|
1058
|
-
: []
|
|
1059
|
-
}
|
|
1060
|
-
/>
|
|
1061
|
-
{/* <SelectComponent
|
|
1062
|
-
value={selectedTable.name}
|
|
1063
|
-
onChange={(e) => {
|
|
1064
|
-
const table = schema.find((t) => t.name === e);
|
|
1070
|
+
>
|
|
1071
|
+
Table
|
|
1072
|
+
</div>
|
|
1073
|
+
<SelectComponent
|
|
1074
|
+
label="Table"
|
|
1075
|
+
value={selectedTable.displayName}
|
|
1076
|
+
onChange={e => {
|
|
1077
|
+
const table = schema.find(t => t.displayName === e);
|
|
1065
1078
|
setSelectedTable(table);
|
|
1066
1079
|
}}
|
|
1067
|
-
options={
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1080
|
+
options={
|
|
1081
|
+
schema?.length
|
|
1082
|
+
? schema.map(elem => {
|
|
1083
|
+
return { label: elem.displayName, value: elem.displayName };
|
|
1084
|
+
})
|
|
1085
|
+
: []
|
|
1086
|
+
}
|
|
1087
|
+
/>
|
|
1088
|
+
</div>
|
|
1071
1089
|
<div
|
|
1072
1090
|
style={{ display: 'flex', flexDirection: 'column', marginTop: '12px' }}
|
|
1073
1091
|
>
|
|
@@ -1120,6 +1138,11 @@ function ReportingTool({
|
|
|
1120
1138
|
indexBeingEdited={indexBeingEdited}
|
|
1121
1139
|
updateFilter={updateFilter}
|
|
1122
1140
|
SelectComponent={SelectComponent}
|
|
1141
|
+
ButtonComponent={ButtonComponent}
|
|
1142
|
+
ModalComponent={ModalComponent}
|
|
1143
|
+
ModalTriggerComponent={ModalTriggerComponent}
|
|
1144
|
+
TextInputComponent={TextInputComponent}
|
|
1145
|
+
tagStyle={tagStyle}
|
|
1123
1146
|
theme={theme}
|
|
1124
1147
|
/>
|
|
1125
1148
|
|
|
@@ -1140,6 +1163,11 @@ function ReportingTool({
|
|
|
1140
1163
|
setAggregationColumn={setAggregationColumn}
|
|
1141
1164
|
setAggregationType={setAggregationType}
|
|
1142
1165
|
SelectComponent={SelectComponent}
|
|
1166
|
+
ButtonComponent={ButtonComponent}
|
|
1167
|
+
ModalComponent={ModalComponent}
|
|
1168
|
+
ModalTriggerComponent={ModalTriggerComponent}
|
|
1169
|
+
TextInputComponent={TextInputComponent}
|
|
1170
|
+
tagStyle={tagStyle}
|
|
1143
1171
|
addAggregation={addAggregation}
|
|
1144
1172
|
dateBucket={dateBucket}
|
|
1145
1173
|
setDateBucket={setDateBucket}
|
|
@@ -1160,6 +1188,10 @@ function ReportingTool({
|
|
|
1160
1188
|
sortByIndexBeingEdited={sortByIndexBeingEdited}
|
|
1161
1189
|
updateSortBy={updateSortBy}
|
|
1162
1190
|
SelectComponent={SelectComponent}
|
|
1191
|
+
ButtonComponent={ButtonComponent}
|
|
1192
|
+
ModalComponent={ModalComponent}
|
|
1193
|
+
ModalTriggerComponent={ModalTriggerComponent}
|
|
1194
|
+
tagStyle={tagStyle}
|
|
1163
1195
|
theme={theme}
|
|
1164
1196
|
/>
|
|
1165
1197
|
</div>
|
|
@@ -1167,46 +1199,53 @@ function ReportingTool({
|
|
|
1167
1199
|
);
|
|
1168
1200
|
}
|
|
1169
1201
|
|
|
1170
|
-
function FilterTag({
|
|
1202
|
+
function FilterTag({
|
|
1203
|
+
id,
|
|
1204
|
+
label,
|
|
1205
|
+
removeFilter,
|
|
1206
|
+
index,
|
|
1207
|
+
setIsOpen,
|
|
1208
|
+
selectFilter,
|
|
1209
|
+
theme,
|
|
1210
|
+
tagStyle,
|
|
1211
|
+
}) {
|
|
1171
1212
|
const handleRemoveFilter = () => {
|
|
1172
1213
|
removeFilter(index);
|
|
1173
1214
|
};
|
|
1174
1215
|
const handleSelectFilter = () => {
|
|
1175
1216
|
selectFilter(index);
|
|
1217
|
+
setIsOpen(true);
|
|
1176
1218
|
};
|
|
1177
1219
|
return (
|
|
1178
1220
|
<div
|
|
1179
1221
|
id={id}
|
|
1180
1222
|
onClick={handleSelectFilter}
|
|
1181
|
-
style={
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
// ring: "2",
|
|
1200
|
-
// ringColor: "white",
|
|
1201
|
-
// ringOpacity: "75",
|
|
1202
|
-
}}
|
|
1223
|
+
style={
|
|
1224
|
+
tagStyle || {
|
|
1225
|
+
marginLeft: '12px',
|
|
1226
|
+
cursor: 'pointer',
|
|
1227
|
+
borderRadius: 8,
|
|
1228
|
+
backgroundColor: '#EFF0FC',
|
|
1229
|
+
paddingLeft: '12px',
|
|
1230
|
+
paddingRight: '8px',
|
|
1231
|
+
height: 30,
|
|
1232
|
+
display: 'flex',
|
|
1233
|
+
alignItems: 'center',
|
|
1234
|
+
fontSize: 13,
|
|
1235
|
+
fontWeight: 'medium',
|
|
1236
|
+
color: theme?.primaryTextColor,
|
|
1237
|
+
fontFamily: theme?.fontFamily,
|
|
1238
|
+
outline: 'none',
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1203
1241
|
>
|
|
1204
1242
|
<div
|
|
1205
1243
|
id={id}
|
|
1206
1244
|
style={{
|
|
1207
1245
|
textOverflow: 'ellipsis',
|
|
1208
1246
|
whiteSpace: 'nowrap',
|
|
1209
|
-
|
|
1247
|
+
overflow: 'hidden',
|
|
1248
|
+
maxWidth: '80px',
|
|
1210
1249
|
}}
|
|
1211
1250
|
>
|
|
1212
1251
|
{label}
|
|
@@ -1222,14 +1261,14 @@ function FilterTag({ id, label, removeFilter, index, selectFilter, theme }) {
|
|
|
1222
1261
|
flexDirection: 'row',
|
|
1223
1262
|
alignItems: 'center',
|
|
1224
1263
|
cursor: 'pointer',
|
|
1225
|
-
paddingLeft: '
|
|
1264
|
+
paddingLeft: '6px',
|
|
1226
1265
|
}}
|
|
1227
1266
|
>
|
|
1228
1267
|
<XMarkIcon
|
|
1229
1268
|
style={{
|
|
1230
|
-
height: '
|
|
1231
|
-
width: '
|
|
1232
|
-
color: theme?.primaryTextColor,
|
|
1269
|
+
height: '20px',
|
|
1270
|
+
width: '20px',
|
|
1271
|
+
color: tagStyle?.color || theme?.primaryTextColor,
|
|
1233
1272
|
}}
|
|
1234
1273
|
aria-hidden="true"
|
|
1235
1274
|
/>
|
|
@@ -1251,43 +1290,24 @@ const SortByModal = ({
|
|
|
1251
1290
|
addSortBy,
|
|
1252
1291
|
sortBys,
|
|
1253
1292
|
SelectComponent,
|
|
1293
|
+
ButtonComponent,
|
|
1294
|
+
ModalComponent,
|
|
1295
|
+
tagStyle,
|
|
1296
|
+
ModalTriggerComponent,
|
|
1254
1297
|
sortByIndexBeingEdited,
|
|
1255
1298
|
theme,
|
|
1256
1299
|
}) => {
|
|
1257
|
-
const dropdownRef = useRef(null);
|
|
1258
1300
|
const [isOpen, setIsOpen] = useState(false);
|
|
1259
|
-
|
|
1260
|
-
useEffect(() => {
|
|
1261
|
-
// Event listener to close the dropdown menu when clicking outside
|
|
1262
|
-
const handleOutsideClick = event => {
|
|
1263
|
-
if (
|
|
1264
|
-
event.target.id === 'sort-toggle-button' ||
|
|
1265
|
-
event.target.id === 'sort-tag'
|
|
1266
|
-
) {
|
|
1267
|
-
setIsOpen(isOpen => !isOpen);
|
|
1268
|
-
return;
|
|
1269
|
-
}
|
|
1270
|
-
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
1271
|
-
setIsOpen(false);
|
|
1272
|
-
}
|
|
1273
|
-
};
|
|
1274
|
-
|
|
1275
|
-
// Attach the event listener to the document
|
|
1276
|
-
document.addEventListener('click', handleOutsideClick);
|
|
1277
|
-
|
|
1278
|
-
// Clean up the event listener on component unmount
|
|
1279
|
-
return () => {
|
|
1280
|
-
document.removeEventListener('click', handleOutsideClick);
|
|
1281
|
-
};
|
|
1282
|
-
}, []);
|
|
1283
1301
|
return (
|
|
1284
1302
|
<div style={{ display: 'flex', flexDirection: 'column', marginTop: 12 }}>
|
|
1285
1303
|
<div
|
|
1286
|
-
style={
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1304
|
+
style={
|
|
1305
|
+
{
|
|
1306
|
+
// position: 'relative',
|
|
1307
|
+
// display: 'inline-block',
|
|
1308
|
+
// textAlign: 'left',
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1291
1311
|
>
|
|
1292
1312
|
<div
|
|
1293
1313
|
style={{
|
|
@@ -1296,31 +1316,10 @@ const SortByModal = ({
|
|
|
1296
1316
|
alignItems: 'center',
|
|
1297
1317
|
}}
|
|
1298
1318
|
>
|
|
1299
|
-
<
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
aria-haspopup="menu"
|
|
1304
|
-
aria-expanded="true"
|
|
1305
|
-
data-headlessui-state="open"
|
|
1306
|
-
style={{
|
|
1307
|
-
display: 'inline-flex',
|
|
1308
|
-
boxShadow: 'rgba(231, 231, 231, 0.5) 0px 1px 2px 0px',
|
|
1309
|
-
borderRadius: '0.375rem',
|
|
1310
|
-
backgroundColor: 'rgba(0, 0, 0, 0)',
|
|
1311
|
-
padding: '0.375rem 0.75rem',
|
|
1312
|
-
fontSize: '0.875rem',
|
|
1313
|
-
fontWeight: '500',
|
|
1314
|
-
color: theme?.primaryTextColor,
|
|
1315
|
-
fontFamily: theme?.fontFamily,
|
|
1316
|
-
borderWidth: 1,
|
|
1317
|
-
borderStyle: 'solid',
|
|
1318
|
-
borderColor: theme.borderColor,
|
|
1319
|
-
cursor: 'pointer',
|
|
1320
|
-
}}
|
|
1321
|
-
>
|
|
1322
|
-
Sort
|
|
1323
|
-
</button>
|
|
1319
|
+
<ModalTriggerComponent
|
|
1320
|
+
onClick={() => setIsOpen(isOpen => !isOpen)}
|
|
1321
|
+
label="Add sort +"
|
|
1322
|
+
/>
|
|
1324
1323
|
<div
|
|
1325
1324
|
style={{
|
|
1326
1325
|
overflowX: 'scroll',
|
|
@@ -1335,70 +1334,65 @@ const SortByModal = ({
|
|
|
1335
1334
|
label={elem.column}
|
|
1336
1335
|
removeFilter={removeSortBy}
|
|
1337
1336
|
selectFilter={selectSortBy}
|
|
1337
|
+
setIsOpen={setIsOpen}
|
|
1338
1338
|
index={index}
|
|
1339
1339
|
theme={theme}
|
|
1340
|
+
tagStyle={tagStyle}
|
|
1341
|
+
key={'sort' + index}
|
|
1340
1342
|
/>
|
|
1341
1343
|
))}
|
|
1342
1344
|
</div>
|
|
1343
1345
|
</div>
|
|
1344
|
-
|
|
1346
|
+
|
|
1347
|
+
<ModalComponent
|
|
1348
|
+
isOpen={isOpen}
|
|
1349
|
+
onClose={() => setIsOpen(false)}
|
|
1350
|
+
title="Add sort"
|
|
1351
|
+
>
|
|
1345
1352
|
<div
|
|
1346
|
-
ref={dropdownRef}
|
|
1347
|
-
role="menu"
|
|
1348
|
-
tabindex="0"
|
|
1349
|
-
data-headlessui-state="open"
|
|
1350
1353
|
style={{
|
|
1351
|
-
zIndex: 120,
|
|
1352
|
-
position: 'absolute',
|
|
1353
|
-
left: '0px',
|
|
1354
|
-
marginTop: '12px',
|
|
1355
|
-
transformOrigin: 'right top',
|
|
1356
1354
|
display: 'flex',
|
|
1357
1355
|
flexDirection: 'column',
|
|
1358
|
-
padding: '1rem',
|
|
1359
|
-
borderRadius: '0.375rem',
|
|
1360
|
-
backgroundColor: 'rgb(255, 255, 255)',
|
|
1361
|
-
boxShadow: 'rgba(0, 0, 0, 0.2) 0px 1px 5px 0px',
|
|
1362
1356
|
}}
|
|
1363
|
-
className="transform opacity-100 scale-100"
|
|
1357
|
+
// className="transform opacity-100 scale-100"
|
|
1364
1358
|
>
|
|
1365
|
-
<div
|
|
1359
|
+
{/* <div
|
|
1366
1360
|
style={{
|
|
1367
1361
|
display: 'flex',
|
|
1368
1362
|
flexDirection: 'row',
|
|
1369
1363
|
alignItems: 'center',
|
|
1370
1364
|
}}
|
|
1371
|
-
>
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
</div>
|
|
1384
|
-
{/* select column */}
|
|
1385
|
-
<SelectComponent
|
|
1386
|
-
value={selectedSortByColumn}
|
|
1387
|
-
onChange={e => {
|
|
1388
|
-
setSelectedSortByColumn(e);
|
|
1389
|
-
}}
|
|
1390
|
-
options={sortableColumns.map(elem => {
|
|
1391
|
-
return { label: elem, value: elem };
|
|
1392
|
-
})}
|
|
1393
|
-
/>
|
|
1365
|
+
> */}
|
|
1366
|
+
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
|
1367
|
+
<div
|
|
1368
|
+
style={{
|
|
1369
|
+
fontSize: '14px',
|
|
1370
|
+
marginBottom: '6px',
|
|
1371
|
+
fontWeight: '600',
|
|
1372
|
+
color: theme.secondaryTextColor,
|
|
1373
|
+
fontFamily: theme?.fontFamily,
|
|
1374
|
+
}}
|
|
1375
|
+
>
|
|
1376
|
+
Column
|
|
1394
1377
|
</div>
|
|
1378
|
+
{/* select column */}
|
|
1379
|
+
<SelectComponent
|
|
1380
|
+
value={selectedSortByColumn}
|
|
1381
|
+
onChange={e => {
|
|
1382
|
+
setSelectedSortByColumn(e);
|
|
1383
|
+
}}
|
|
1384
|
+
options={sortableColumns.map(elem => {
|
|
1385
|
+
return { label: elem, value: elem };
|
|
1386
|
+
})}
|
|
1387
|
+
/>
|
|
1395
1388
|
</div>
|
|
1389
|
+
{/* </div> */}
|
|
1396
1390
|
{/* Select bucket (if date) */}
|
|
1397
1391
|
|
|
1398
1392
|
{/* Select aggregations */}
|
|
1399
1393
|
<div
|
|
1400
1394
|
style={{
|
|
1401
|
-
fontSize: '
|
|
1395
|
+
fontSize: '14px',
|
|
1402
1396
|
marginBottom: '6px',
|
|
1403
1397
|
fontWeight: '600',
|
|
1404
1398
|
color: theme.secondaryTextColor,
|
|
@@ -1419,25 +1413,9 @@ const SortByModal = ({
|
|
|
1419
1413
|
{ label: 'descending', value: 'descending' },
|
|
1420
1414
|
]}
|
|
1421
1415
|
/>
|
|
1422
|
-
<
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
marginTop: '1.25rem',
|
|
1426
|
-
paddingTop: '0.5rem',
|
|
1427
|
-
paddingBottom: '0.5rem',
|
|
1428
|
-
paddingLeft: '0.75rem',
|
|
1429
|
-
paddingRight: '0.75rem',
|
|
1430
|
-
backgroundColor: theme.primaryButtonColor,
|
|
1431
|
-
fontFamily: theme?.fontFamily,
|
|
1432
|
-
// hover: { opacity: "90" },
|
|
1433
|
-
color: 'white',
|
|
1434
|
-
fontWeight: '500',
|
|
1435
|
-
borderRadius: '0.375rem',
|
|
1436
|
-
boxShadow: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
|
|
1437
|
-
outline: 'none',
|
|
1438
|
-
border: 'none',
|
|
1439
|
-
cursor: 'pointer',
|
|
1440
|
-
}}
|
|
1416
|
+
<div style={{ height: 20 }} />
|
|
1417
|
+
<ButtonComponent
|
|
1418
|
+
id="custom-button"
|
|
1441
1419
|
onClick={() => {
|
|
1442
1420
|
if (sortByIndexBeingEdited > -1) {
|
|
1443
1421
|
updateSortBy(sortByIndexBeingEdited);
|
|
@@ -1449,11 +1427,10 @@ const SortByModal = ({
|
|
|
1449
1427
|
setIsOpen(false);
|
|
1450
1428
|
// close();
|
|
1451
1429
|
}}
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
</button>
|
|
1430
|
+
label={sortByIndexBeingEdited > -1 ? 'Edit sort' : 'Add sort'}
|
|
1431
|
+
/>
|
|
1455
1432
|
</div>
|
|
1456
|
-
|
|
1433
|
+
</ModalComponent>
|
|
1457
1434
|
</div>
|
|
1458
1435
|
</div>
|
|
1459
1436
|
);
|
|
@@ -1471,6 +1448,7 @@ const GroupByModal2 = ({
|
|
|
1471
1448
|
removeGroupBy,
|
|
1472
1449
|
selectGroupBy,
|
|
1473
1450
|
SelectComponent,
|
|
1451
|
+
ButtonComponent,
|
|
1474
1452
|
aggregations,
|
|
1475
1453
|
setAggregationColumn,
|
|
1476
1454
|
setAggregationType,
|
|
@@ -1478,266 +1456,184 @@ const GroupByModal2 = ({
|
|
|
1478
1456
|
dateBucket,
|
|
1479
1457
|
setDateBucket,
|
|
1480
1458
|
theme,
|
|
1459
|
+
ModalComponent,
|
|
1460
|
+
theme,
|
|
1461
|
+
ModalTriggerComponent,
|
|
1462
|
+
TextInputComponent,
|
|
1463
|
+
tagStyle,
|
|
1481
1464
|
}) => {
|
|
1482
|
-
const dropdownRef = useRef(null);
|
|
1483
1465
|
const [isOpen, setIsOpen] = useState(false);
|
|
1484
|
-
|
|
1485
|
-
useEffect(() => {
|
|
1486
|
-
// Event listener to close the dropdown menu when clicking outside
|
|
1487
|
-
const handleOutsideClick = event => {
|
|
1488
|
-
if (
|
|
1489
|
-
event.target.id === 'group-toggle-button' ||
|
|
1490
|
-
event.target.id === 'group-tag'
|
|
1491
|
-
) {
|
|
1492
|
-
setIsOpen(isOpen => !isOpen);
|
|
1493
|
-
return;
|
|
1494
|
-
}
|
|
1495
|
-
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
1496
|
-
setIsOpen(false);
|
|
1497
|
-
}
|
|
1498
|
-
};
|
|
1499
|
-
|
|
1500
|
-
// Attach the event listener to the document
|
|
1501
|
-
document.addEventListener('click', handleOutsideClick);
|
|
1502
|
-
|
|
1503
|
-
// Clean up the event listener on component unmount
|
|
1504
|
-
return () => {
|
|
1505
|
-
document.removeEventListener('click', handleOutsideClick);
|
|
1506
|
-
};
|
|
1507
|
-
}, []);
|
|
1508
1466
|
return (
|
|
1509
1467
|
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
|
1510
1468
|
<div
|
|
1511
1469
|
style={{
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1470
|
+
display: 'flex',
|
|
1471
|
+
flexDirection: 'row',
|
|
1472
|
+
alignItems: 'center',
|
|
1515
1473
|
}}
|
|
1516
1474
|
>
|
|
1475
|
+
<ModalTriggerComponent
|
|
1476
|
+
onClick={() => setIsOpen(isOpen => !isOpen)}
|
|
1477
|
+
label="Add group by +"
|
|
1478
|
+
/>
|
|
1517
1479
|
<div
|
|
1518
1480
|
style={{
|
|
1481
|
+
overflowX: 'scroll',
|
|
1519
1482
|
display: 'flex',
|
|
1520
1483
|
flexDirection: 'row',
|
|
1521
1484
|
alignItems: 'center',
|
|
1522
1485
|
}}
|
|
1523
1486
|
>
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
fontSize: '0.875rem',
|
|
1538
|
-
fontWeight: '500',
|
|
1539
|
-
color: theme.primaryButtonColor,
|
|
1540
|
-
borderWidth: 1,
|
|
1541
|
-
borderStyle: 'solid',
|
|
1542
|
-
borderColor: theme.borderColor,
|
|
1543
|
-
fontFamily: theme?.fontFamily,
|
|
1544
|
-
cursor: 'pointer',
|
|
1545
|
-
}}
|
|
1546
|
-
>
|
|
1547
|
-
Groups
|
|
1548
|
-
</button>
|
|
1549
|
-
<div
|
|
1550
|
-
style={{
|
|
1551
|
-
overflowX: 'scroll',
|
|
1552
|
-
display: 'flex',
|
|
1553
|
-
flexDirection: 'row',
|
|
1554
|
-
alignItems: 'center',
|
|
1555
|
-
}}
|
|
1556
|
-
>
|
|
1557
|
-
{groupBys.map((elem, index) => (
|
|
1558
|
-
<FilterTag
|
|
1559
|
-
id="group-tag"
|
|
1560
|
-
label={elem.tag}
|
|
1561
|
-
removeFilter={removeGroupBy}
|
|
1562
|
-
selectFilter={selectGroupBy}
|
|
1563
|
-
index={index}
|
|
1564
|
-
theme={theme}
|
|
1565
|
-
/>
|
|
1566
|
-
))}
|
|
1567
|
-
</div>
|
|
1487
|
+
{groupBys.map((elem, index) => (
|
|
1488
|
+
<FilterTag
|
|
1489
|
+
id="group-tag"
|
|
1490
|
+
label={elem.tag}
|
|
1491
|
+
removeFilter={removeGroupBy}
|
|
1492
|
+
selectFilter={selectGroupBy}
|
|
1493
|
+
setIsOpen={setIsOpen}
|
|
1494
|
+
index={index}
|
|
1495
|
+
theme={theme}
|
|
1496
|
+
tagStyle={tagStyle}
|
|
1497
|
+
key={'groupby' + index}
|
|
1498
|
+
/>
|
|
1499
|
+
))}
|
|
1568
1500
|
</div>
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
left: '0px',
|
|
1579
|
-
marginTop: '12px',
|
|
1580
|
-
transformOrigin: 'right top',
|
|
1581
|
-
padding: '1rem',
|
|
1582
|
-
borderRadius: '0.375rem',
|
|
1583
|
-
backgroundColor: 'rgb(255, 255, 255)',
|
|
1584
|
-
boxShadow: 'rgba(0, 0, 0, 0.2) 0px 1px 5px 0px',
|
|
1585
|
-
}}
|
|
1586
|
-
// className="transform opacity-100 scale-100"
|
|
1587
|
-
>
|
|
1501
|
+
</div>
|
|
1502
|
+
<ModalComponent
|
|
1503
|
+
isOpen={isOpen}
|
|
1504
|
+
onClose={() => setIsOpen(false)}
|
|
1505
|
+
title="Add group by"
|
|
1506
|
+
>
|
|
1507
|
+
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
|
1508
|
+
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
|
1509
|
+
{/* select column */}
|
|
1588
1510
|
<div
|
|
1589
1511
|
style={{
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1512
|
+
fontSize: '14px',
|
|
1513
|
+
marginBottom: '6px',
|
|
1514
|
+
fontWeight: '600',
|
|
1515
|
+
fontFamily: theme?.fontFamily,
|
|
1516
|
+
color: theme.secondaryTextColor,
|
|
1593
1517
|
}}
|
|
1594
1518
|
>
|
|
1595
|
-
|
|
1596
|
-
<div
|
|
1597
|
-
style={{
|
|
1598
|
-
fontSize: '0.875rem',
|
|
1599
|
-
marginBottom: '6px',
|
|
1600
|
-
fontWeight: '600',
|
|
1601
|
-
fontFamily: theme?.fontFamily,
|
|
1602
|
-
color: theme.secondaryTextColor,
|
|
1603
|
-
}}
|
|
1604
|
-
>
|
|
1605
|
-
Column
|
|
1606
|
-
</div>
|
|
1607
|
-
{/* select column */}
|
|
1608
|
-
<SelectComponent
|
|
1609
|
-
value={selectedGroupByColumn.name}
|
|
1610
|
-
onChange={e => {
|
|
1611
|
-
const column = selectedTable.columns.find(
|
|
1612
|
-
c => c.name === e
|
|
1613
|
-
);
|
|
1614
|
-
setSelectedGroupByColumn(column);
|
|
1615
|
-
}}
|
|
1616
|
-
options={selectedTable.columns.map(elem => {
|
|
1617
|
-
return { label: elem.name, value: elem.name };
|
|
1618
|
-
})}
|
|
1619
|
-
/>
|
|
1620
|
-
</div>
|
|
1621
|
-
{groupByColumnType === 'date' && (
|
|
1622
|
-
<div
|
|
1623
|
-
style={{
|
|
1624
|
-
display: 'flex',
|
|
1625
|
-
flexDirection: 'column',
|
|
1626
|
-
marginLeft: 12,
|
|
1627
|
-
}}
|
|
1628
|
-
>
|
|
1629
|
-
<div
|
|
1630
|
-
style={{
|
|
1631
|
-
fontSize: '0.875rem',
|
|
1632
|
-
marginBottom: '6px',
|
|
1633
|
-
fontWeight: '600',
|
|
1634
|
-
color: theme.secondaryTextColor,
|
|
1635
|
-
fontFamily: theme?.fontFamily,
|
|
1636
|
-
}}
|
|
1637
|
-
>
|
|
1638
|
-
Bucket
|
|
1639
|
-
</div>
|
|
1640
|
-
<SelectComponent
|
|
1641
|
-
value={dateBucket}
|
|
1642
|
-
onChange={e => {
|
|
1643
|
-
setDateBucket(e);
|
|
1644
|
-
}}
|
|
1645
|
-
options={[
|
|
1646
|
-
{ label: 'month', value: 'month' },
|
|
1647
|
-
{ label: 'day', value: 'day' },
|
|
1648
|
-
{ label: 'week', value: 'week' },
|
|
1649
|
-
]}
|
|
1650
|
-
/>
|
|
1651
|
-
</div>
|
|
1652
|
-
)}
|
|
1519
|
+
Column
|
|
1653
1520
|
</div>
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1521
|
+
<SelectComponent
|
|
1522
|
+
label="Column"
|
|
1523
|
+
value={selectedGroupByColumn.name}
|
|
1524
|
+
onChange={e => {
|
|
1525
|
+
const column = selectedTable.columns.find(c => c.name === e);
|
|
1526
|
+
setSelectedGroupByColumn(column);
|
|
1527
|
+
}}
|
|
1528
|
+
options={selectedTable.columns.map(elem => {
|
|
1529
|
+
return { label: elem.name, value: elem.name };
|
|
1530
|
+
})}
|
|
1531
|
+
/>
|
|
1532
|
+
</div>
|
|
1533
|
+
{groupByColumnType === 'date' && (
|
|
1657
1534
|
<div
|
|
1658
1535
|
style={{
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
marginTop: 20,
|
|
1663
|
-
color: theme.secondaryTextColor,
|
|
1664
|
-
fontFamily: theme?.fontFamily,
|
|
1536
|
+
display: 'flex',
|
|
1537
|
+
flexDirection: 'column',
|
|
1538
|
+
// marginLeft: 12,
|
|
1665
1539
|
}}
|
|
1666
1540
|
>
|
|
1667
|
-
Aggregations
|
|
1668
|
-
</div>
|
|
1669
|
-
{/* select column */}
|
|
1670
|
-
{aggregations.map((aggregation, index) => (
|
|
1671
|
-
// setAggregationType
|
|
1672
1541
|
<div
|
|
1673
1542
|
style={{
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1543
|
+
fontSize: '14px',
|
|
1544
|
+
marginBottom: '6px',
|
|
1545
|
+
fontWeight: '600',
|
|
1546
|
+
color: theme.secondaryTextColor,
|
|
1547
|
+
fontFamily: theme?.fontFamily,
|
|
1548
|
+
marginTop: 20,
|
|
1677
1549
|
}}
|
|
1678
1550
|
>
|
|
1679
|
-
|
|
1680
|
-
value={aggregation.column?.name}
|
|
1681
|
-
onChange={e => {
|
|
1682
|
-
const column = selectedTable.columns.find(
|
|
1683
|
-
c => c.name === e
|
|
1684
|
-
);
|
|
1685
|
-
setAggregationColumn(column, index);
|
|
1686
|
-
}}
|
|
1687
|
-
options={selectedTable.columns.map(elem => {
|
|
1688
|
-
return { label: elem.name, value: elem.name };
|
|
1689
|
-
})}
|
|
1690
|
-
/>
|
|
1691
|
-
<div style={{ width: 12 }} />
|
|
1692
|
-
<SelectComponent
|
|
1693
|
-
value={aggregation.aggregationType}
|
|
1694
|
-
onChange={e => {
|
|
1695
|
-
setAggregationType(e, index);
|
|
1696
|
-
}}
|
|
1697
|
-
options={[
|
|
1698
|
-
{ label: 'sum', value: 'sum' },
|
|
1699
|
-
{ label: 'average', value: 'average' },
|
|
1700
|
-
{ label: 'count', value: 'count' },
|
|
1701
|
-
]}
|
|
1702
|
-
/>
|
|
1551
|
+
Bucket
|
|
1703
1552
|
</div>
|
|
1704
|
-
|
|
1705
|
-
|
|
1553
|
+
<SelectComponent
|
|
1554
|
+
label="Bucket"
|
|
1555
|
+
value={dateBucket}
|
|
1556
|
+
onChange={e => {
|
|
1557
|
+
setDateBucket(e);
|
|
1558
|
+
}}
|
|
1559
|
+
options={[
|
|
1560
|
+
{ label: 'month', value: 'month' },
|
|
1561
|
+
{ label: 'day', value: 'day' },
|
|
1562
|
+
{ label: 'week', value: 'week' },
|
|
1563
|
+
]}
|
|
1564
|
+
/>
|
|
1565
|
+
</div>
|
|
1566
|
+
)}
|
|
1567
|
+
{/* Select bucket (if date) */}
|
|
1568
|
+
|
|
1569
|
+
{/* Select aggregations */}
|
|
1570
|
+
<div
|
|
1571
|
+
style={{
|
|
1572
|
+
fontSize: 14,
|
|
1573
|
+
marginBottom: '6px',
|
|
1574
|
+
fontWeight: '600',
|
|
1575
|
+
marginTop: 20,
|
|
1576
|
+
color: theme.secondaryTextColor,
|
|
1577
|
+
fontFamily: theme?.fontFamily,
|
|
1578
|
+
}}
|
|
1579
|
+
>
|
|
1580
|
+
Aggregations
|
|
1581
|
+
</div>
|
|
1582
|
+
{/* select column */}
|
|
1583
|
+
{aggregations.map((aggregation, index) => (
|
|
1584
|
+
// setAggregationType
|
|
1585
|
+
<div
|
|
1586
|
+
key={'agg' + index}
|
|
1706
1587
|
style={{
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
paddingBottom: '0.5rem',
|
|
1711
|
-
paddingLeft: '0.75rem',
|
|
1712
|
-
paddingRight: '0.75rem',
|
|
1713
|
-
backgroundColor: theme.primaryButtonColor,
|
|
1714
|
-
// hover: { opacity: "90" },
|
|
1715
|
-
color: 'white',
|
|
1716
|
-
fontWeight: '500',
|
|
1717
|
-
borderRadius: '0.375rem',
|
|
1718
|
-
boxShadow: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
|
|
1719
|
-
fontFamily: theme?.fontFamily,
|
|
1720
|
-
border: 'none',
|
|
1721
|
-
outline: 'none',
|
|
1722
|
-
cursor: 'pointer',
|
|
1588
|
+
display: 'flex',
|
|
1589
|
+
flexDirection: 'row',
|
|
1590
|
+
alignItems: 'center',
|
|
1723
1591
|
}}
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
}
|
|
1731
|
-
|
|
1592
|
+
>
|
|
1593
|
+
<SelectComponent
|
|
1594
|
+
value={aggregation.column?.name}
|
|
1595
|
+
onChange={e => {
|
|
1596
|
+
const column = selectedTable.columns.find(c => c.name === e);
|
|
1597
|
+
setAggregationColumn(column, index);
|
|
1598
|
+
}}
|
|
1599
|
+
options={selectedTable.columns.map(elem => {
|
|
1600
|
+
return { label: elem.name, value: elem.name };
|
|
1601
|
+
})}
|
|
1602
|
+
/>
|
|
1603
|
+
<div style={{ width: 16 }} />
|
|
1604
|
+
<SelectComponent
|
|
1605
|
+
value={aggregation.aggregationType}
|
|
1606
|
+
onChange={e => {
|
|
1607
|
+
setAggregationType(e, index);
|
|
1608
|
+
}}
|
|
1609
|
+
options={[
|
|
1610
|
+
{ label: 'sum', value: 'sum' },
|
|
1611
|
+
{ label: 'average', value: 'average' },
|
|
1612
|
+
{ label: 'count', value: 'count' },
|
|
1613
|
+
]}
|
|
1614
|
+
/>
|
|
1615
|
+
</div>
|
|
1616
|
+
))}
|
|
1617
|
+
<div style={{ height: 20 }} />
|
|
1618
|
+
<ButtonComponent
|
|
1619
|
+
id="custom-button"
|
|
1620
|
+
onClick={() => {
|
|
1621
|
+
if (groupByIndexBeingEdited > -1) {
|
|
1622
|
+
updateGroupBy(groupByIndexBeingEdited);
|
|
1732
1623
|
setIsOpen(false);
|
|
1733
1624
|
// close();
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1625
|
+
return;
|
|
1626
|
+
}
|
|
1627
|
+
addGroupBy();
|
|
1628
|
+
setIsOpen(false);
|
|
1629
|
+
// close();
|
|
1630
|
+
}}
|
|
1631
|
+
label={
|
|
1632
|
+
groupByIndexBeingEdited > -1 ? 'Edit group by' : 'Add group by'
|
|
1633
|
+
}
|
|
1634
|
+
/>
|
|
1635
|
+
</div>
|
|
1636
|
+
</ModalComponent>
|
|
1741
1637
|
</div>
|
|
1742
1638
|
);
|
|
1743
1639
|
};
|
|
@@ -1765,35 +1661,15 @@ const AddFilterModal2 = ({
|
|
|
1765
1661
|
indexBeingEdited,
|
|
1766
1662
|
updateFilter,
|
|
1767
1663
|
SelectComponent,
|
|
1664
|
+
ButtonComponent,
|
|
1665
|
+
ModalComponent,
|
|
1768
1666
|
theme,
|
|
1667
|
+
ModalTriggerComponent,
|
|
1668
|
+
TextInputComponent,
|
|
1669
|
+
tagStyle,
|
|
1769
1670
|
}) => {
|
|
1770
|
-
const dropdownRef = useRef(null);
|
|
1771
1671
|
const [isOpen, setIsOpen] = useState(false);
|
|
1772
1672
|
|
|
1773
|
-
useEffect(() => {
|
|
1774
|
-
// Event listener to close the dropdown menu when clicking outside
|
|
1775
|
-
const handleOutsideClick = event => {
|
|
1776
|
-
if (
|
|
1777
|
-
event.target.id === 'toggle-button' ||
|
|
1778
|
-
event.target.id === 'filter-tag'
|
|
1779
|
-
) {
|
|
1780
|
-
setIsOpen(isOpen => !isOpen);
|
|
1781
|
-
return;
|
|
1782
|
-
}
|
|
1783
|
-
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
1784
|
-
setIsOpen(false);
|
|
1785
|
-
}
|
|
1786
|
-
};
|
|
1787
|
-
|
|
1788
|
-
// Attach the event listener to the document
|
|
1789
|
-
document.addEventListener('click', handleOutsideClick);
|
|
1790
|
-
|
|
1791
|
-
// Clean up the event listener on component unmount
|
|
1792
|
-
return () => {
|
|
1793
|
-
document.removeEventListener('click', handleOutsideClick);
|
|
1794
|
-
};
|
|
1795
|
-
}, []);
|
|
1796
|
-
|
|
1797
1673
|
return (
|
|
1798
1674
|
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
|
1799
1675
|
<div
|
|
@@ -1810,31 +1686,10 @@ const AddFilterModal2 = ({
|
|
|
1810
1686
|
alignItems: 'center',
|
|
1811
1687
|
}}
|
|
1812
1688
|
>
|
|
1813
|
-
<
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
aria-haspopup="menu"
|
|
1818
|
-
aria-expanded="true"
|
|
1819
|
-
data-headlessui-state="open"
|
|
1820
|
-
style={{
|
|
1821
|
-
display: 'inline-flex',
|
|
1822
|
-
borderWidth: '1px',
|
|
1823
|
-
borderStyle: 'solid',
|
|
1824
|
-
borderColor: theme.borderColor,
|
|
1825
|
-
boxShadow: 'rgba(231, 231, 231, 0.5) 0px 1px 2px 0px',
|
|
1826
|
-
borderRadius: '0.375rem',
|
|
1827
|
-
backgroundColor: theme.backgroundColor,
|
|
1828
|
-
padding: '0.375rem 0.75rem',
|
|
1829
|
-
fontSize: '0.875rem',
|
|
1830
|
-
fontWeight: '500',
|
|
1831
|
-
color: theme?.primaryTextColor,
|
|
1832
|
-
fontFamily: theme?.fontFamily,
|
|
1833
|
-
cursor: 'pointer',
|
|
1834
|
-
}}
|
|
1835
|
-
>
|
|
1836
|
-
Filters
|
|
1837
|
-
</button>
|
|
1689
|
+
<ModalTriggerComponent
|
|
1690
|
+
onClick={() => setIsOpen(isOpen => !isOpen)}
|
|
1691
|
+
label="Add filter +"
|
|
1692
|
+
/>
|
|
1838
1693
|
<div
|
|
1839
1694
|
style={{
|
|
1840
1695
|
overflowX: 'scroll',
|
|
@@ -1851,44 +1706,38 @@ const AddFilterModal2 = ({
|
|
|
1851
1706
|
selectFilter={selectFilter}
|
|
1852
1707
|
index={index}
|
|
1853
1708
|
theme={theme}
|
|
1709
|
+
setIsOpen={setIsOpen}
|
|
1710
|
+
key={'filter' + index}
|
|
1711
|
+
tagStyle={tagStyle}
|
|
1854
1712
|
/>
|
|
1855
1713
|
))}
|
|
1856
1714
|
</div>
|
|
1857
1715
|
</div>
|
|
1858
|
-
|
|
1716
|
+
<ModalComponent
|
|
1717
|
+
isOpen={isOpen}
|
|
1718
|
+
onClose={() => setIsOpen(false)}
|
|
1719
|
+
title="Add filter"
|
|
1720
|
+
>
|
|
1859
1721
|
<div
|
|
1860
|
-
ref={dropdownRef}
|
|
1861
|
-
role="menu"
|
|
1862
|
-
tabindex="0"
|
|
1863
|
-
data-headlessui-state="open"
|
|
1864
1722
|
style={{
|
|
1865
|
-
zIndex: 120,
|
|
1866
|
-
position: 'absolute',
|
|
1867
|
-
left: '0px',
|
|
1868
|
-
marginTop: '12px',
|
|
1869
|
-
transformOrigin: 'right top',
|
|
1870
|
-
padding: '1rem',
|
|
1871
|
-
borderRadius: '0.375rem',
|
|
1872
1723
|
backgroundColor: 'rgb(255, 255, 255)',
|
|
1873
|
-
boxShadow: 'rgba(0, 0, 0, 0.2) 0px 1px 5px 0px',
|
|
1874
1724
|
display: 'flex',
|
|
1875
1725
|
flexDirection: 'column',
|
|
1876
1726
|
}}
|
|
1877
|
-
// className="transform opacity-100 scale-100"
|
|
1878
1727
|
>
|
|
1879
1728
|
<div
|
|
1880
1729
|
style={{
|
|
1881
|
-
fontSize:
|
|
1730
|
+
fontSize: 14,
|
|
1882
1731
|
marginBottom: '6px',
|
|
1883
1732
|
fontWeight: '600',
|
|
1884
1733
|
color: theme.secondaryTextColor,
|
|
1885
1734
|
fontFamily: theme?.fontFamily,
|
|
1886
|
-
// opacity: 0.7,
|
|
1887
1735
|
}}
|
|
1888
1736
|
>
|
|
1889
1737
|
Column
|
|
1890
1738
|
</div>
|
|
1891
1739
|
<SelectComponent
|
|
1740
|
+
id="custom-select"
|
|
1892
1741
|
value={selectedColumn.name}
|
|
1893
1742
|
onChange={e => {
|
|
1894
1743
|
const column = selectedTable.columns.find(c => c.name === e);
|
|
@@ -1900,36 +1749,7 @@ const AddFilterModal2 = ({
|
|
|
1900
1749
|
/>
|
|
1901
1750
|
|
|
1902
1751
|
{columnType === 'number' && (
|
|
1903
|
-
<div
|
|
1904
|
-
style={{
|
|
1905
|
-
width: '245px',
|
|
1906
|
-
maxWidth: '245px',
|
|
1907
|
-
zIndex: 50,
|
|
1908
|
-
}}
|
|
1909
|
-
>
|
|
1910
|
-
{/* <MultiRangeSlider
|
|
1911
|
-
style={{
|
|
1912
|
-
border: "none",
|
|
1913
|
-
boxShadow: "none",
|
|
1914
|
-
padding: 0,
|
|
1915
|
-
marginTop: 28,
|
|
1916
|
-
}}
|
|
1917
|
-
min={0}
|
|
1918
|
-
max={1000000}
|
|
1919
|
-
// step={5}
|
|
1920
|
-
minValue={numberStart}
|
|
1921
|
-
maxValue={numberEnd}
|
|
1922
|
-
ruler={false}
|
|
1923
|
-
label={false}
|
|
1924
|
-
preventWheel
|
|
1925
|
-
barLeftColor="transparent"
|
|
1926
|
-
barRightColor="transparent"
|
|
1927
|
-
barInnerColor="#384151"
|
|
1928
|
-
onInput={(e) => {
|
|
1929
|
-
setNumberStart(e.minValue);
|
|
1930
|
-
setNumberEnd(e.maxValue);
|
|
1931
|
-
}}
|
|
1932
|
-
/> */}
|
|
1752
|
+
<div>
|
|
1933
1753
|
<div
|
|
1934
1754
|
style={{
|
|
1935
1755
|
display: 'flex',
|
|
@@ -1947,34 +1767,22 @@ const AddFilterModal2 = ({
|
|
|
1947
1767
|
>
|
|
1948
1768
|
<div
|
|
1949
1769
|
style={{
|
|
1950
|
-
fontSize: '
|
|
1770
|
+
fontSize: '14px',
|
|
1951
1771
|
fontWeight: '600',
|
|
1952
1772
|
color: theme.secondaryTextColor,
|
|
1953
1773
|
fontFamily: theme?.fontFamily,
|
|
1774
|
+
marginBottom: 6,
|
|
1954
1775
|
}}
|
|
1955
1776
|
>
|
|
1956
1777
|
Minimum
|
|
1957
1778
|
</div>
|
|
1958
|
-
<
|
|
1959
|
-
|
|
1779
|
+
<TextInputComponent
|
|
1780
|
+
id="min-input"
|
|
1960
1781
|
value={numberStart}
|
|
1961
1782
|
onChange={e => setNumberStart(e.target.value)}
|
|
1962
|
-
placeholder=""
|
|
1963
|
-
style={{
|
|
1964
|
-
textAlign: 'right',
|
|
1965
|
-
width: '100px',
|
|
1966
|
-
border: '1px solid #E7E7E7',
|
|
1967
|
-
color: theme?.primaryTextColor,
|
|
1968
|
-
marginTop: '4px',
|
|
1969
|
-
height: 38,
|
|
1970
|
-
paddingRight: 8,
|
|
1971
|
-
backgroundColor: 'white',
|
|
1972
|
-
borderRadius: '0.375rem',
|
|
1973
|
-
boxShadow: '0 1px 3px 0 rgba(0, 0, 0, 0.1)',
|
|
1974
|
-
fontFamily: theme?.fontFamily,
|
|
1975
|
-
}}
|
|
1976
1783
|
/>
|
|
1977
1784
|
</div>
|
|
1785
|
+
<div style={{ width: 16 }} />
|
|
1978
1786
|
<div
|
|
1979
1787
|
style={{
|
|
1980
1788
|
display: 'flex',
|
|
@@ -1984,32 +1792,19 @@ const AddFilterModal2 = ({
|
|
|
1984
1792
|
>
|
|
1985
1793
|
<div
|
|
1986
1794
|
style={{
|
|
1987
|
-
fontSize: '
|
|
1795
|
+
fontSize: '14px',
|
|
1988
1796
|
fontWeight: '600',
|
|
1989
1797
|
color: theme.secondaryTextColor,
|
|
1990
1798
|
fontFamily: theme?.fontFamily,
|
|
1799
|
+
marginBottom: 6,
|
|
1991
1800
|
}}
|
|
1992
1801
|
>
|
|
1993
1802
|
Maximum
|
|
1994
1803
|
</div>
|
|
1995
|
-
<
|
|
1996
|
-
|
|
1804
|
+
<TextInputComponent
|
|
1805
|
+
id="max-input"
|
|
1997
1806
|
value={numberEnd}
|
|
1998
1807
|
onChange={e => setNumberEnd(e.target.value)}
|
|
1999
|
-
placeholder=""
|
|
2000
|
-
style={{
|
|
2001
|
-
textAlign: 'right',
|
|
2002
|
-
width: '100px',
|
|
2003
|
-
border: '1px solid #E7E7E7',
|
|
2004
|
-
color: theme?.primaryTextColor,
|
|
2005
|
-
fontFamily: theme?.fontFamily,
|
|
2006
|
-
marginTop: '4px',
|
|
2007
|
-
paddingRight: 8,
|
|
2008
|
-
height: 38,
|
|
2009
|
-
backgroundColor: 'white',
|
|
2010
|
-
borderRadius: '0.375rem',
|
|
2011
|
-
boxShadow: '0 1px 3px 0 rgba(0, 0, 0, 0.1)',
|
|
2012
|
-
}}
|
|
2013
1808
|
/>
|
|
2014
1809
|
</div>
|
|
2015
1810
|
</div>
|
|
@@ -2034,7 +1829,7 @@ const AddFilterModal2 = ({
|
|
|
2034
1829
|
>
|
|
2035
1830
|
<div
|
|
2036
1831
|
style={{
|
|
2037
|
-
fontSize:
|
|
1832
|
+
fontSize: 14,
|
|
2038
1833
|
fontWeight: '600',
|
|
2039
1834
|
color: 'rgba(56, 65, 81, 0.7)',
|
|
2040
1835
|
fontFamily: theme?.fontFamily,
|
|
@@ -2047,22 +1842,22 @@ const AddFilterModal2 = ({
|
|
|
2047
1842
|
value={dateStart}
|
|
2048
1843
|
onChange={e => setDateStart(e.target.value)}
|
|
2049
1844
|
placeholder="Start date"
|
|
2050
|
-
style={{
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
}}
|
|
1845
|
+
// style={{
|
|
1846
|
+
// width: '115px',
|
|
1847
|
+
// fontSize: '0.8rem',
|
|
1848
|
+
// color: theme?.primaryTextColor,
|
|
1849
|
+
// borderWidth: '1px',
|
|
1850
|
+
// marginTop: '4px',
|
|
1851
|
+
// borderColor: '#E7E7E7',
|
|
1852
|
+
// backgroundColor: 'white',
|
|
1853
|
+
// borderRadius: '0.375rem',
|
|
1854
|
+
// boxShadow: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
|
|
1855
|
+
// paddingLeft: '0.5rem',
|
|
1856
|
+
// paddingRight: '0.5rem',
|
|
1857
|
+
// paddingTop: '0.375rem',
|
|
1858
|
+
// paddingBottom: '0.375rem',
|
|
1859
|
+
// fontFamily: theme?.fontFamily,
|
|
1860
|
+
// }}
|
|
2066
1861
|
/>
|
|
2067
1862
|
</div>
|
|
2068
1863
|
<div
|
|
@@ -2074,7 +1869,7 @@ const AddFilterModal2 = ({
|
|
|
2074
1869
|
>
|
|
2075
1870
|
<div
|
|
2076
1871
|
style={{
|
|
2077
|
-
fontSize:
|
|
1872
|
+
fontSize: 14,
|
|
2078
1873
|
fontWeight: '600',
|
|
2079
1874
|
color: 'rgba(56, 65, 81, 0.7)',
|
|
2080
1875
|
fontFamily: theme?.fontFamily,
|
|
@@ -2087,22 +1882,22 @@ const AddFilterModal2 = ({
|
|
|
2087
1882
|
value={dateEnd}
|
|
2088
1883
|
onChange={e => setDateEnd(e.target.value)}
|
|
2089
1884
|
placeholder="End date"
|
|
2090
|
-
style={{
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
}}
|
|
1885
|
+
// style={{
|
|
1886
|
+
// width: '115px',
|
|
1887
|
+
// fontSize: '0.8rem',
|
|
1888
|
+
// color: theme?.primaryTextColor,
|
|
1889
|
+
// borderWidth: '1px',
|
|
1890
|
+
// marginTop: '4px',
|
|
1891
|
+
// borderColor: '#E7E7E7',
|
|
1892
|
+
// backgroundColor: 'white',
|
|
1893
|
+
// borderRadius: '0.375rem',
|
|
1894
|
+
// boxShadow: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
|
|
1895
|
+
// paddingLeft: '0.5rem',
|
|
1896
|
+
// paddingRight: '0.5rem',
|
|
1897
|
+
// paddingTop: '0.375rem',
|
|
1898
|
+
// paddingBottom: '0.375rem',
|
|
1899
|
+
// fontFamily: theme?.fontFamily,
|
|
1900
|
+
// }}
|
|
2106
1901
|
/>
|
|
2107
1902
|
</div>
|
|
2108
1903
|
</div>
|
|
@@ -2116,6 +1911,7 @@ const AddFilterModal2 = ({
|
|
|
2116
1911
|
flex: 'flex',
|
|
2117
1912
|
flexDirection: 'column',
|
|
2118
1913
|
marginTop: '14px',
|
|
1914
|
+
overflow: 'hidden',
|
|
2119
1915
|
}}
|
|
2120
1916
|
>
|
|
2121
1917
|
{columnStats.map(value => (
|
|
@@ -2127,7 +1923,6 @@ const AddFilterModal2 = ({
|
|
|
2127
1923
|
}}
|
|
2128
1924
|
key={value}
|
|
2129
1925
|
>
|
|
2130
|
-
{/* Rest of the code */}
|
|
2131
1926
|
<div
|
|
2132
1927
|
style={{
|
|
2133
1928
|
display: 'flex',
|
|
@@ -2139,18 +1934,6 @@ const AddFilterModal2 = ({
|
|
|
2139
1934
|
key={value}
|
|
2140
1935
|
>
|
|
2141
1936
|
<DivCheckbox
|
|
2142
|
-
// type="checkbox"
|
|
2143
|
-
// style={{
|
|
2144
|
-
// border: "1px solid red",
|
|
2145
|
-
// borderRadius: "4px",
|
|
2146
|
-
// boxSizing: "border-box",
|
|
2147
|
-
// color: "#fff",
|
|
2148
|
-
// height: "18px",
|
|
2149
|
-
// minWidth: "18px",
|
|
2150
|
-
// position: "relative",
|
|
2151
|
-
// width: "18px",
|
|
2152
|
-
// }}
|
|
2153
|
-
// className="border-[#E7E7E7] border-[1px] shadow-sm rounded-sm bg-white cursor-pointer"
|
|
2154
1937
|
theme={theme}
|
|
2155
1938
|
checked={stringFilterValues.includes(value)}
|
|
2156
1939
|
onChange={() => {
|
|
@@ -2179,21 +1962,9 @@ const AddFilterModal2 = ({
|
|
|
2179
1962
|
))}
|
|
2180
1963
|
</div>
|
|
2181
1964
|
)}
|
|
2182
|
-
<
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
marginTop: '20px',
|
|
2186
|
-
padding: '0.5rem 0.75rem',
|
|
2187
|
-
backgroundColor: 'rgb(56, 65, 81)',
|
|
2188
|
-
color: 'rgb(255, 255, 255)',
|
|
2189
|
-
fontWeight: '500',
|
|
2190
|
-
borderRadius: '0.375rem',
|
|
2191
|
-
boxShadow: 'rgba(0, 0, 0, 0.05) 0px 1px 2px 0px',
|
|
2192
|
-
fontFamily: theme?.fontFamily,
|
|
2193
|
-
border: 'none',
|
|
2194
|
-
outline: 'none',
|
|
2195
|
-
cursor: 'pointer',
|
|
2196
|
-
}}
|
|
1965
|
+
<div style={{ height: 20 }} />
|
|
1966
|
+
<ButtonComponent
|
|
1967
|
+
id="custom-button"
|
|
2197
1968
|
onClick={() => {
|
|
2198
1969
|
if (indexBeingEdited > -1) {
|
|
2199
1970
|
updateFilter(indexBeingEdited);
|
|
@@ -2203,11 +1974,11 @@ const AddFilterModal2 = ({
|
|
|
2203
1974
|
addFilter();
|
|
2204
1975
|
setIsOpen(false);
|
|
2205
1976
|
}}
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
</button>
|
|
1977
|
+
label={indexBeingEdited > -1 ? 'Edit filter' : 'Add filter'}
|
|
1978
|
+
/>
|
|
2209
1979
|
</div>
|
|
2210
|
-
|
|
1980
|
+
</ModalComponent>
|
|
1981
|
+
{/* )} */}
|
|
2211
1982
|
</div>
|
|
2212
1983
|
<div style={{ height: '12px' }}></div>
|
|
2213
1984
|
</div>
|