@quillsql/react 1.6.0 → 1.6.3
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 +220 -492
- package/lib/ReportBuilder.js.map +1 -1
- package/lib/SQLEditor.d.ts +35 -1
- package/lib/SQLEditor.js +264 -211
- package/lib/SQLEditor.js.map +1 -1
- package/lib/Table.js +2 -10
- 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 +433 -652
- package/src/SQLEditor.tsx +578 -235
- package/src/Table.tsx +9 -21
- 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/lib/ReportBuilder.js
CHANGED
|
@@ -55,7 +55,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
55
55
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
56
56
|
};
|
|
57
57
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
58
|
-
import { useState, useContext, useCallback, useEffect
|
|
58
|
+
import { useState, useContext, useCallback, useEffect } from 'react';
|
|
59
59
|
// import './nightOwlLight.css';
|
|
60
60
|
import axios from 'axios';
|
|
61
61
|
import { ClientContext, SchemaContext, ThemeContext } from './Context';
|
|
@@ -64,7 +64,7 @@ import { convertPostgresColumn } from './SQLEditor';
|
|
|
64
64
|
import { format } from 'date-fns';
|
|
65
65
|
export default function ReportBuilder(_a) {
|
|
66
66
|
var _this = this;
|
|
67
|
-
var onChangeQuery = _a.onChangeQuery, onChangeData = _a.onChangeData, onChangeColumns = _a.onChangeColumns, onChangeLoading = _a.onChangeLoading, onError = _a.onError, SelectComponent = _a.SelectComponent;
|
|
67
|
+
var onChangeQuery = _a.onChangeQuery, onChangeData = _a.onChangeData, onChangeColumns = _a.onChangeColumns, onChangeLoading = _a.onChangeLoading, onError = _a.onError, SelectComponent = _a.SelectComponent, ButtonComponent = _a.ButtonComponent, ModalComponent = _a.ModalComponent, ModalTriggerComponent = _a.ModalTriggerComponent, TextInputComponent = _a.TextInputComponent, tagStyle = _a.tagStyle;
|
|
68
68
|
var _b = useState([]), data = _b[0], setData = _b[1];
|
|
69
69
|
var client = useContext(ClientContext)[0];
|
|
70
70
|
var _c = useContext(SchemaContext), schema = _c[0], setSchema = _c[1];
|
|
@@ -136,25 +136,32 @@ export default function ReportBuilder(_a) {
|
|
|
136
136
|
};
|
|
137
137
|
}, []);
|
|
138
138
|
var runQuery = function (query) { return __awaiter(_this, void 0, void 0, function () {
|
|
139
|
-
var publicKey, customerId, environment, response;
|
|
139
|
+
var publicKey, customerId, environment, queryEndpoint, queryHeaders, response;
|
|
140
140
|
return __generator(this, function (_a) {
|
|
141
141
|
switch (_a.label) {
|
|
142
142
|
case 0:
|
|
143
|
-
publicKey = client.publicKey, customerId = client.customerId, environment = client.environment;
|
|
144
|
-
return [
|
|
145
|
-
|
|
146
|
-
}, {
|
|
147
|
-
params: {
|
|
148
|
-
orgId: customerId,
|
|
149
|
-
publicKey: publicKey,
|
|
150
|
-
},
|
|
151
|
-
headers: {
|
|
152
|
-
Authorization: "Bearer ",
|
|
153
|
-
environment: environment || undefined,
|
|
154
|
-
},
|
|
155
|
-
})];
|
|
143
|
+
publicKey = client.publicKey, customerId = client.customerId, environment = client.environment, queryEndpoint = client.queryEndpoint, queryHeaders = client.queryHeaders;
|
|
144
|
+
if (!queryEndpoint) return [3 /*break*/, 2];
|
|
145
|
+
return [4 /*yield*/, axios.post(queryEndpoint, { metadata: { query: query, task: 'query' } }, { headers: queryHeaders })];
|
|
156
146
|
case 1:
|
|
157
147
|
response = _a.sent();
|
|
148
|
+
return [3 /*break*/, 4];
|
|
149
|
+
case 2: return [4 /*yield*/, axios.post("https://quill-344421.uc.r.appspot.com/dashquery", {
|
|
150
|
+
query: query,
|
|
151
|
+
}, {
|
|
152
|
+
params: {
|
|
153
|
+
orgId: customerId,
|
|
154
|
+
publicKey: publicKey,
|
|
155
|
+
},
|
|
156
|
+
headers: {
|
|
157
|
+
Authorization: "Bearer ",
|
|
158
|
+
environment: environment || undefined,
|
|
159
|
+
},
|
|
160
|
+
})];
|
|
161
|
+
case 3:
|
|
162
|
+
response = _a.sent();
|
|
163
|
+
_a.label = 4;
|
|
164
|
+
case 4:
|
|
158
165
|
if (response && response.data && response.data.errorMessage) {
|
|
159
166
|
onError(response.data.errorMessage);
|
|
160
167
|
setData([]);
|
|
@@ -176,7 +183,7 @@ export default function ReportBuilder(_a) {
|
|
|
176
183
|
if (!schema.length) {
|
|
177
184
|
return null;
|
|
178
185
|
}
|
|
179
|
-
return (_jsx(ReportingTool, { theme: theme, data: data, schema: schema, onChangeQuery: onChangeQuery, runQuery: runQuery, SelectComponent: SelectComponent }));
|
|
186
|
+
return (_jsx(ReportingTool, { theme: theme, data: data, schema: schema, onChangeQuery: onChangeQuery, runQuery: runQuery, SelectComponent: SelectComponent, ButtonComponent: ButtonComponent, ModalComponent: ModalComponent, ModalTriggerComponent: ModalTriggerComponent, TextInputComponent: TextInputComponent, tagStyle: tagStyle }));
|
|
180
187
|
}
|
|
181
188
|
export function getPostgresBasicType(column) {
|
|
182
189
|
var format;
|
|
@@ -228,7 +235,7 @@ export function getPostgresBasicType(column) {
|
|
|
228
235
|
}
|
|
229
236
|
function ReportingTool(_a) {
|
|
230
237
|
var _this = this;
|
|
231
|
-
var schema = _a.schema, data = _a.data, runQuery = _a.runQuery, SelectComponent = _a.SelectComponent, onChangeQuery = _a.onChangeQuery, theme = _a.theme;
|
|
238
|
+
var schema = _a.schema, data = _a.data, runQuery = _a.runQuery, SelectComponent = _a.SelectComponent, ButtonComponent = _a.ButtonComponent, onChangeQuery = _a.onChangeQuery, theme = _a.theme, ModalComponent = _a.ModalComponent, ModalTriggerComponent = _a.ModalTriggerComponent, TextInputComponent = _a.TextInputComponent, tagStyle = _a.tagStyle;
|
|
232
239
|
var _b = useState(schema[0]), selectedTable = _b[0], setSelectedTable = _b[1];
|
|
233
240
|
var _c = useState(schema[0].columns[0]), selectedColumn = _c[0], setSelectedColumn = _c[1];
|
|
234
241
|
var _d = useState([]), filters = _d[0], setFilters = _d[1];
|
|
@@ -946,54 +953,50 @@ function ReportingTool(_a) {
|
|
|
946
953
|
if (!schema || !schema.length) {
|
|
947
954
|
return null;
|
|
948
955
|
}
|
|
949
|
-
return (_jsxs("div", __assign({ style: { marginLeft: '25px' } }, { children: [_jsx("div", __assign({ style: {
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
956
|
+
return (_jsxs("div", __assign({ style: { marginLeft: '25px' } }, { children: [_jsxs("div", __assign({ style: { maxWidth: 245 } }, { children: [_jsx("div", __assign({ style: {
|
|
957
|
+
fontSize: 14,
|
|
958
|
+
marginBottom: '6px',
|
|
959
|
+
fontWeight: '600',
|
|
960
|
+
color: theme.secondaryTextColor,
|
|
961
|
+
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
962
|
+
} }, { children: "Table" })), _jsx(SelectComponent, { label: "Table", value: selectedTable.displayName, onChange: function (e) {
|
|
963
|
+
var table = schema.find(function (t) { return t.displayName === e; });
|
|
964
|
+
setSelectedTable(table);
|
|
965
|
+
}, options: (schema === null || schema === void 0 ? void 0 : schema.length)
|
|
966
|
+
? schema.map(function (elem) {
|
|
967
|
+
return { label: elem.displayName, value: elem.displayName };
|
|
968
|
+
})
|
|
969
|
+
: [] })] })), _jsxs("div", __assign({ style: { display: 'flex', flexDirection: 'column', marginTop: '12px' } }, { children: [_jsx(AddFilterModal2, { filters: filters, selectedColumn: selectedColumn, numberStart: numberStart, numberEnd: numberEnd, dateStart: dateStart, setDateStart: setDateStart, columnStats: columnStats, stringFilterValues: stringFilterValues, setStringFilterValues: setStringFilterValues, addFilter: addFilter, setSelectedColumn: setSelectedColumn, setNumberStart: setNumberStart, setNumberEnd: setNumberEnd, selectedTable: selectedTable, columnType: columnType, dateEnd: dateEnd, setDateEnd: setDateEnd, removeFilter: removeFilter, selectFilter: selectFilter, indexBeingEdited: indexBeingEdited, updateFilter: updateFilter, SelectComponent: SelectComponent, ButtonComponent: ButtonComponent, ModalComponent: ModalComponent, ModalTriggerComponent: ModalTriggerComponent, TextInputComponent: TextInputComponent, tagStyle: tagStyle, theme: theme }), _jsx(GroupByModal2, { selectedTable: selectedTable, groupBys: groupBys, selectedGroupByColumn: selectedGroupByColumn, setSelectedGroupByColumn: setSelectedGroupByColumn, addGroupBy: addGroupBy, groupByColumnType: groupByColumnType, removeGroupBy: removeGroupBy, selectGroupBy: selectGroupBy, groupByIndexBeingEdited: groupByIndexBeingEdited, updateGroupBy: updateGroupBy, aggregations: aggregations, setAggregationColumn: setAggregationColumn, setAggregationType: setAggregationType, SelectComponent: SelectComponent, ButtonComponent: ButtonComponent, ModalComponent: ModalComponent, ModalTriggerComponent: ModalTriggerComponent, TextInputComponent: TextInputComponent, tagStyle: tagStyle, addAggregation: addAggregation, dateBucket: dateBucket, setDateBucket: setDateBucket, theme: theme }), _jsx(SortByModal, { selectedTable: selectedTable, sortableColumns: sortableColumns, sortBys: sortBys, selectedSortByColumn: selectedSortByColumn, setSelectedSortByColumn: setSelectedSortByColumn, selectedSortByDirection: selectedSortByDirection, setSelectedSortByDirection: setSelectedSortByDirection, addSortBy: addSortBy, removeSortBy: removeSortBy, selectSortBy: selectSortBy, sortByIndexBeingEdited: sortByIndexBeingEdited, updateSortBy: updateSortBy, SelectComponent: SelectComponent, ButtonComponent: ButtonComponent, ModalComponent: ModalComponent, ModalTriggerComponent: ModalTriggerComponent, tagStyle: tagStyle, theme: theme })] }))] })));
|
|
963
970
|
}
|
|
964
971
|
function FilterTag(_a) {
|
|
965
|
-
var id = _a.id, label = _a.label, removeFilter = _a.removeFilter, index = _a.index, selectFilter = _a.selectFilter, theme = _a.theme;
|
|
972
|
+
var id = _a.id, label = _a.label, removeFilter = _a.removeFilter, index = _a.index, setIsOpen = _a.setIsOpen, selectFilter = _a.selectFilter, theme = _a.theme, tagStyle = _a.tagStyle;
|
|
966
973
|
var handleRemoveFilter = function () {
|
|
967
974
|
removeFilter(index);
|
|
968
975
|
};
|
|
969
976
|
var handleSelectFilter = function () {
|
|
970
977
|
selectFilter(index);
|
|
978
|
+
setIsOpen(true);
|
|
971
979
|
};
|
|
972
|
-
return (_jsxs("div", __assign({ id: id, onClick: handleSelectFilter, style: {
|
|
980
|
+
return (_jsxs("div", __assign({ id: id, onClick: handleSelectFilter, style: tagStyle || {
|
|
973
981
|
marginLeft: '12px',
|
|
974
982
|
cursor: 'pointer',
|
|
975
|
-
|
|
976
|
-
borderColor: '#EFF0FC',
|
|
977
|
-
borderRadius: 6,
|
|
983
|
+
borderRadius: 8,
|
|
978
984
|
backgroundColor: '#EFF0FC',
|
|
979
|
-
paddingLeft: '
|
|
980
|
-
paddingRight: '
|
|
981
|
-
|
|
982
|
-
// paddingBottom: "0.44rem",
|
|
983
|
-
height: 35,
|
|
985
|
+
paddingLeft: '12px',
|
|
986
|
+
paddingRight: '8px',
|
|
987
|
+
height: 30,
|
|
984
988
|
display: 'flex',
|
|
985
989
|
alignItems: 'center',
|
|
986
|
-
fontSize:
|
|
990
|
+
fontSize: 13,
|
|
987
991
|
fontWeight: 'medium',
|
|
988
|
-
color: theme.primaryTextColor,
|
|
992
|
+
color: theme === null || theme === void 0 ? void 0 : theme.primaryTextColor,
|
|
993
|
+
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
989
994
|
outline: 'none',
|
|
990
|
-
// ring: "2",
|
|
991
|
-
// ringColor: "white",
|
|
992
|
-
// ringOpacity: "75",
|
|
993
995
|
} }, { children: [_jsx("div", __assign({ id: id, style: {
|
|
994
996
|
textOverflow: 'ellipsis',
|
|
995
997
|
whiteSpace: 'nowrap',
|
|
996
|
-
|
|
998
|
+
overflow: 'hidden',
|
|
999
|
+
maxWidth: '80px',
|
|
997
1000
|
} }, { children: label })), _jsx("div", __assign({
|
|
998
1001
|
// onClick={handleRemoveFilter}
|
|
999
1002
|
onClick: function (e) {
|
|
@@ -1004,83 +1007,34 @@ function FilterTag(_a) {
|
|
|
1004
1007
|
flexDirection: 'row',
|
|
1005
1008
|
alignItems: 'center',
|
|
1006
1009
|
cursor: 'pointer',
|
|
1007
|
-
paddingLeft: '
|
|
1010
|
+
paddingLeft: '6px',
|
|
1008
1011
|
} }, { children: _jsx(XMarkIcon, { style: {
|
|
1009
|
-
height: '
|
|
1010
|
-
width: '
|
|
1011
|
-
color: theme.primaryTextColor,
|
|
1012
|
+
height: '20px',
|
|
1013
|
+
width: '20px',
|
|
1014
|
+
color: (tagStyle === null || tagStyle === void 0 ? void 0 : tagStyle.color) || (theme === null || theme === void 0 ? void 0 : theme.primaryTextColor),
|
|
1012
1015
|
}, "aria-hidden": "true" }) }))] })));
|
|
1013
1016
|
}
|
|
1014
1017
|
var SortByModal = function (_a) {
|
|
1015
|
-
var selectedSortByColumn = _a.selectedSortByColumn, selectedSortByDirection = _a.selectedSortByDirection, setSelectedSortByColumn = _a.setSelectedSortByColumn, setSelectedSortByDirection = _a.setSelectedSortByDirection, selectedTable = _a.selectedTable, sortableColumns = _a.sortableColumns, removeSortBy = _a.removeSortBy, selectSortBy = _a.selectSortBy, updateSortBy = _a.updateSortBy, addSortBy = _a.addSortBy, sortBys = _a.sortBys, SelectComponent = _a.SelectComponent, sortByIndexBeingEdited = _a.sortByIndexBeingEdited, theme = _a.theme;
|
|
1016
|
-
var dropdownRef = useRef(null);
|
|
1018
|
+
var selectedSortByColumn = _a.selectedSortByColumn, selectedSortByDirection = _a.selectedSortByDirection, setSelectedSortByColumn = _a.setSelectedSortByColumn, setSelectedSortByDirection = _a.setSelectedSortByDirection, selectedTable = _a.selectedTable, sortableColumns = _a.sortableColumns, removeSortBy = _a.removeSortBy, selectSortBy = _a.selectSortBy, updateSortBy = _a.updateSortBy, addSortBy = _a.addSortBy, sortBys = _a.sortBys, SelectComponent = _a.SelectComponent, ButtonComponent = _a.ButtonComponent, ModalComponent = _a.ModalComponent, tagStyle = _a.tagStyle, ModalTriggerComponent = _a.ModalTriggerComponent, sortByIndexBeingEdited = _a.sortByIndexBeingEdited, theme = _a.theme;
|
|
1017
1019
|
var _b = useState(false), isOpen = _b[0], setIsOpen = _b[1];
|
|
1018
|
-
useEffect(function () {
|
|
1019
|
-
// Event listener to close the dropdown menu when clicking outside
|
|
1020
|
-
var handleOutsideClick = function (event) {
|
|
1021
|
-
if (event.target.id === 'sort-toggle-button' ||
|
|
1022
|
-
event.target.id === 'sort-tag') {
|
|
1023
|
-
setIsOpen(function (isOpen) { return !isOpen; });
|
|
1024
|
-
return;
|
|
1025
|
-
}
|
|
1026
|
-
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
1027
|
-
setIsOpen(false);
|
|
1028
|
-
}
|
|
1029
|
-
};
|
|
1030
|
-
// Attach the event listener to the document
|
|
1031
|
-
document.addEventListener('click', handleOutsideClick);
|
|
1032
|
-
// Clean up the event listener on component unmount
|
|
1033
|
-
return function () {
|
|
1034
|
-
document.removeEventListener('click', handleOutsideClick);
|
|
1035
|
-
};
|
|
1036
|
-
}, []);
|
|
1037
1020
|
return (_jsx("div", __assign({ style: { display: 'flex', flexDirection: 'column', marginTop: 12 } }, { children: _jsxs("div", __assign({ style: {
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1021
|
+
// position: 'relative',
|
|
1022
|
+
// display: 'inline-block',
|
|
1023
|
+
// textAlign: 'left',
|
|
1041
1024
|
} }, { children: [_jsxs("div", __assign({ style: {
|
|
1042
1025
|
display: 'flex',
|
|
1043
1026
|
flexDirection: 'row',
|
|
1044
1027
|
alignItems: 'center',
|
|
1045
|
-
} }, { children: [_jsx(
|
|
1046
|
-
// onClick={() => setIsOpen((isOpen) => !isOpen)}
|
|
1047
|
-
type: "button", "aria-haspopup": "menu", "aria-expanded": "true", "data-headlessui-state": "open", style: {
|
|
1048
|
-
display: 'inline-flex',
|
|
1049
|
-
boxShadow: 'rgba(231, 231, 231, 0.5) 0px 1px 2px 0px',
|
|
1050
|
-
borderRadius: '0.375rem',
|
|
1051
|
-
backgroundColor: 'rgba(0, 0, 0, 0)',
|
|
1052
|
-
padding: '0.375rem 0.75rem',
|
|
1053
|
-
fontSize: '0.875rem',
|
|
1054
|
-
fontWeight: '500',
|
|
1055
|
-
color: theme.primaryTextColor,
|
|
1056
|
-
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1057
|
-
borderWidth: 1,
|
|
1058
|
-
borderStyle: 'solid',
|
|
1059
|
-
borderColor: theme.borderColor,
|
|
1060
|
-
cursor: 'pointer',
|
|
1061
|
-
} }, { children: "Sort" })), _jsx("div", __assign({ style: {
|
|
1028
|
+
} }, { children: [_jsx(ModalTriggerComponent, { onClick: function () { return setIsOpen(function (isOpen) { return !isOpen; }); }, label: "Add sort +" }), _jsx("div", __assign({ style: {
|
|
1062
1029
|
overflowX: 'scroll',
|
|
1063
1030
|
display: 'flex',
|
|
1064
1031
|
flexDirection: 'row',
|
|
1065
1032
|
alignItems: 'center',
|
|
1066
|
-
} }, { children: sortBys.map(function (elem, index) { return (_jsx(FilterTag, { id: "sort-tag", label: elem.column, removeFilter: removeSortBy, selectFilter: selectSortBy, index: index, theme: theme })); }) }))] })),
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
transformOrigin: 'right top',
|
|
1072
|
-
display: 'flex',
|
|
1073
|
-
flexDirection: 'column',
|
|
1074
|
-
padding: '1rem',
|
|
1075
|
-
borderRadius: '0.375rem',
|
|
1076
|
-
backgroundColor: 'rgb(255, 255, 255)',
|
|
1077
|
-
boxShadow: 'rgba(0, 0, 0, 0.2) 0px 1px 5px 0px',
|
|
1078
|
-
}, className: "transform opacity-100 scale-100" }, { children: [_jsx("div", __assign({ style: {
|
|
1079
|
-
display: 'flex',
|
|
1080
|
-
flexDirection: 'row',
|
|
1081
|
-
alignItems: 'center',
|
|
1082
|
-
} }, { children: _jsxs("div", __assign({ style: { display: 'flex', flexDirection: 'column' } }, { children: [_jsx("div", __assign({ style: {
|
|
1083
|
-
fontSize: '0.875rem',
|
|
1033
|
+
} }, { children: sortBys.map(function (elem, index) { return (_jsx(FilterTag, { id: "sort-tag", label: elem.column, removeFilter: removeSortBy, selectFilter: selectSortBy, setIsOpen: setIsOpen, index: index, theme: theme, tagStyle: tagStyle }, 'sort' + index)); }) }))] })), _jsx(ModalComponent, __assign({ isOpen: isOpen, onClose: function () { return setIsOpen(false); }, title: "Add sort" }, { children: _jsxs("div", __assign({ style: {
|
|
1034
|
+
display: 'flex',
|
|
1035
|
+
flexDirection: 'column',
|
|
1036
|
+
} }, { children: [_jsxs("div", __assign({ style: { display: 'flex', flexDirection: 'column' } }, { children: [_jsx("div", __assign({ style: {
|
|
1037
|
+
fontSize: '14px',
|
|
1084
1038
|
marginBottom: '6px',
|
|
1085
1039
|
fontWeight: '600',
|
|
1086
1040
|
color: theme.secondaryTextColor,
|
|
@@ -1089,142 +1043,72 @@ var SortByModal = function (_a) {
|
|
|
1089
1043
|
setSelectedSortByColumn(e);
|
|
1090
1044
|
}, options: sortableColumns.map(function (elem) {
|
|
1091
1045
|
return { label: elem, value: elem };
|
|
1092
|
-
}) })] }))
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1113
|
-
// hover: { opacity: "90" },
|
|
1114
|
-
color: 'white',
|
|
1115
|
-
fontWeight: '500',
|
|
1116
|
-
borderRadius: '0.375rem',
|
|
1117
|
-
boxShadow: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
|
|
1118
|
-
outline: 'none',
|
|
1119
|
-
border: 'none',
|
|
1120
|
-
cursor: 'pointer',
|
|
1121
|
-
}, onClick: function () {
|
|
1122
|
-
if (sortByIndexBeingEdited > -1) {
|
|
1123
|
-
updateSortBy(sortByIndexBeingEdited);
|
|
1046
|
+
}) })] })), _jsx("div", __assign({ style: {
|
|
1047
|
+
fontSize: '14px',
|
|
1048
|
+
marginBottom: '6px',
|
|
1049
|
+
fontWeight: '600',
|
|
1050
|
+
color: theme.secondaryTextColor,
|
|
1051
|
+
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1052
|
+
marginTop: 20,
|
|
1053
|
+
} }, { children: "Direction" })), _jsx(SelectComponent, { value: selectedSortByDirection, onChange: function (e) {
|
|
1054
|
+
setSelectedSortByDirection(e);
|
|
1055
|
+
}, options: [
|
|
1056
|
+
{ label: 'ascending', value: 'ascending' },
|
|
1057
|
+
{ label: 'descending', value: 'descending' },
|
|
1058
|
+
] }), _jsx("div", { style: { height: 20 } }), _jsx(ButtonComponent, { id: "custom-button", onClick: function () {
|
|
1059
|
+
if (sortByIndexBeingEdited > -1) {
|
|
1060
|
+
updateSortBy(sortByIndexBeingEdited);
|
|
1061
|
+
setIsOpen(false);
|
|
1062
|
+
// close();
|
|
1063
|
+
return;
|
|
1064
|
+
}
|
|
1065
|
+
addSortBy();
|
|
1124
1066
|
setIsOpen(false);
|
|
1125
1067
|
// close();
|
|
1126
|
-
|
|
1127
|
-
}
|
|
1128
|
-
addSortBy();
|
|
1129
|
-
setIsOpen(false);
|
|
1130
|
-
// close();
|
|
1131
|
-
} }, { children: sortByIndexBeingEdited > -1 ? 'Edit sort' : 'Add sort' }))] })))] })) })));
|
|
1068
|
+
}, label: sortByIndexBeingEdited > -1 ? 'Edit sort' : 'Add sort' })] })) }))] })) })));
|
|
1132
1069
|
};
|
|
1133
1070
|
var GroupByModal2 = function (_a) {
|
|
1134
|
-
var selectedGroupByColumn = _a.selectedGroupByColumn, addGroupBy = _a.addGroupBy, setSelectedGroupByColumn = _a.setSelectedGroupByColumn, selectedTable = _a.selectedTable, groupByColumnType = _a.groupByColumnType, groupByIndexBeingEdited = _a.groupByIndexBeingEdited, updateGroupBy = _a.updateGroupBy, groupBys = _a.groupBys, removeGroupBy = _a.removeGroupBy, selectGroupBy = _a.selectGroupBy, SelectComponent = _a.SelectComponent, aggregations = _a.aggregations, setAggregationColumn = _a.setAggregationColumn, setAggregationType = _a.setAggregationType, addAggregation = _a.addAggregation, dateBucket = _a.dateBucket, setDateBucket = _a.setDateBucket, theme = _a.theme;
|
|
1135
|
-
var dropdownRef = useRef(null);
|
|
1071
|
+
var selectedGroupByColumn = _a.selectedGroupByColumn, addGroupBy = _a.addGroupBy, setSelectedGroupByColumn = _a.setSelectedGroupByColumn, selectedTable = _a.selectedTable, groupByColumnType = _a.groupByColumnType, groupByIndexBeingEdited = _a.groupByIndexBeingEdited, updateGroupBy = _a.updateGroupBy, groupBys = _a.groupBys, removeGroupBy = _a.removeGroupBy, selectGroupBy = _a.selectGroupBy, SelectComponent = _a.SelectComponent, ButtonComponent = _a.ButtonComponent, aggregations = _a.aggregations, setAggregationColumn = _a.setAggregationColumn, setAggregationType = _a.setAggregationType, addAggregation = _a.addAggregation, dateBucket = _a.dateBucket, setDateBucket = _a.setDateBucket, theme = _a.theme, ModalComponent = _a.ModalComponent, theme = _a.theme, ModalTriggerComponent = _a.ModalTriggerComponent, TextInputComponent = _a.TextInputComponent, tagStyle = _a.tagStyle;
|
|
1136
1072
|
var _b = useState(false), isOpen = _b[0], setIsOpen = _b[1];
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
display: 'inline-block',
|
|
1159
|
-
textAlign: 'left',
|
|
1160
|
-
} }, { children: [_jsxs("div", __assign({ style: {
|
|
1161
|
-
display: 'flex',
|
|
1162
|
-
flexDirection: 'row',
|
|
1163
|
-
alignItems: 'center',
|
|
1164
|
-
} }, { children: [_jsx("button", __assign({ id: "group-toggle-button",
|
|
1165
|
-
// onClick={() => setIsOpen((isOpen) => !isOpen)}
|
|
1166
|
-
type: "button", "aria-haspopup": "menu", "aria-expanded": "true", "data-headlessui-state": "open", style: {
|
|
1167
|
-
display: 'inline-flex',
|
|
1168
|
-
boxShadow: 'rgba(231, 231, 231, 0.5) 0px 1px 2px 0px',
|
|
1169
|
-
borderRadius: '0.375rem',
|
|
1170
|
-
backgroundColor: 'rgba(0, 0, 0, 0)',
|
|
1171
|
-
padding: '0.375rem 0.75rem',
|
|
1172
|
-
fontSize: '0.875rem',
|
|
1173
|
-
fontWeight: '500',
|
|
1174
|
-
color: theme.primaryButtonColor,
|
|
1175
|
-
borderWidth: 1,
|
|
1176
|
-
borderStyle: 'solid',
|
|
1177
|
-
borderColor: theme.borderColor,
|
|
1178
|
-
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1179
|
-
cursor: 'pointer',
|
|
1180
|
-
} }, { children: "Groups" })), _jsx("div", __assign({ style: {
|
|
1181
|
-
overflowX: 'scroll',
|
|
1182
|
-
display: 'flex',
|
|
1183
|
-
flexDirection: 'row',
|
|
1184
|
-
alignItems: 'center',
|
|
1185
|
-
} }, { children: groupBys.map(function (elem, index) { return (_jsx(FilterTag, { id: "group-tag", label: elem.tag, removeFilter: removeGroupBy, selectFilter: selectGroupBy, index: index, theme: theme })); }) }))] })), isOpen && (_jsxs("div", __assign({ ref: dropdownRef, role: "menu", tabindex: "0", "data-headlessui-state": "open", style: {
|
|
1186
|
-
zIndex: 120,
|
|
1187
|
-
position: 'absolute',
|
|
1188
|
-
left: '0px',
|
|
1189
|
-
marginTop: '12px',
|
|
1190
|
-
transformOrigin: 'right top',
|
|
1191
|
-
padding: '1rem',
|
|
1192
|
-
borderRadius: '0.375rem',
|
|
1193
|
-
backgroundColor: 'rgb(255, 255, 255)',
|
|
1194
|
-
boxShadow: 'rgba(0, 0, 0, 0.2) 0px 1px 5px 0px',
|
|
1195
|
-
} }, { children: [_jsxs("div", __assign({ style: {
|
|
1073
|
+
return (_jsxs("div", __assign({ style: { display: 'flex', flexDirection: 'column' } }, { children: [_jsxs("div", __assign({ style: {
|
|
1074
|
+
display: 'flex',
|
|
1075
|
+
flexDirection: 'row',
|
|
1076
|
+
alignItems: 'center',
|
|
1077
|
+
} }, { children: [_jsx(ModalTriggerComponent, { onClick: function () { return setIsOpen(function (isOpen) { return !isOpen; }); }, label: "Add group by +" }), _jsx("div", __assign({ style: {
|
|
1078
|
+
overflowX: 'scroll',
|
|
1079
|
+
display: 'flex',
|
|
1080
|
+
flexDirection: 'row',
|
|
1081
|
+
alignItems: 'center',
|
|
1082
|
+
} }, { children: groupBys.map(function (elem, index) { return (_jsx(FilterTag, { id: "group-tag", label: elem.tag, removeFilter: removeGroupBy, selectFilter: selectGroupBy, setIsOpen: setIsOpen, index: index, theme: theme, tagStyle: tagStyle }, 'groupby' + index)); }) }))] })), _jsx(ModalComponent, __assign({ isOpen: isOpen, onClose: function () { return setIsOpen(false); }, title: "Add group by" }, { children: _jsxs("div", __assign({ style: { display: 'flex', flexDirection: 'column' } }, { children: [_jsxs("div", __assign({ style: { display: 'flex', flexDirection: 'column' } }, { children: [_jsx("div", __assign({ style: {
|
|
1083
|
+
fontSize: '14px',
|
|
1084
|
+
marginBottom: '6px',
|
|
1085
|
+
fontWeight: '600',
|
|
1086
|
+
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1087
|
+
color: theme.secondaryTextColor,
|
|
1088
|
+
} }, { children: "Column" })), _jsx(SelectComponent, { label: "Column", value: selectedGroupByColumn.name, onChange: function (e) {
|
|
1089
|
+
var column = selectedTable.columns.find(function (c) { return c.name === e; });
|
|
1090
|
+
setSelectedGroupByColumn(column);
|
|
1091
|
+
}, options: selectedTable.columns.map(function (elem) {
|
|
1092
|
+
return { label: elem.name, value: elem.name };
|
|
1093
|
+
}) })] })), groupByColumnType === 'date' && (_jsxs("div", __assign({ style: {
|
|
1196
1094
|
display: 'flex',
|
|
1197
|
-
flexDirection: '
|
|
1198
|
-
|
|
1199
|
-
} }, { children: [
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
} }, { children: [_jsx("div", __assign({ style: {
|
|
1215
|
-
fontSize: '0.875rem',
|
|
1216
|
-
marginBottom: '6px',
|
|
1217
|
-
fontWeight: '600',
|
|
1218
|
-
color: theme.secondaryTextColor,
|
|
1219
|
-
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1220
|
-
} }, { children: "Bucket" })), _jsx(SelectComponent, { value: dateBucket, onChange: function (e) {
|
|
1221
|
-
setDateBucket(e);
|
|
1222
|
-
}, options: [
|
|
1223
|
-
{ label: 'month', value: 'month' },
|
|
1224
|
-
{ label: 'day', value: 'day' },
|
|
1225
|
-
{ label: 'week', value: 'week' },
|
|
1226
|
-
] })] })))] })), _jsx("div", __assign({ style: {
|
|
1227
|
-
fontSize: '0.875rem',
|
|
1095
|
+
flexDirection: 'column',
|
|
1096
|
+
// marginLeft: 12,
|
|
1097
|
+
} }, { children: [_jsx("div", __assign({ style: {
|
|
1098
|
+
fontSize: '14px',
|
|
1099
|
+
marginBottom: '6px',
|
|
1100
|
+
fontWeight: '600',
|
|
1101
|
+
color: theme.secondaryTextColor,
|
|
1102
|
+
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1103
|
+
marginTop: 20,
|
|
1104
|
+
} }, { children: "Bucket" })), _jsx(SelectComponent, { label: "Bucket", value: dateBucket, onChange: function (e) {
|
|
1105
|
+
setDateBucket(e);
|
|
1106
|
+
}, options: [
|
|
1107
|
+
{ label: 'month', value: 'month' },
|
|
1108
|
+
{ label: 'day', value: 'day' },
|
|
1109
|
+
{ label: 'week', value: 'week' },
|
|
1110
|
+
] })] }))), _jsx("div", __assign({ style: {
|
|
1111
|
+
fontSize: 14,
|
|
1228
1112
|
marginBottom: '6px',
|
|
1229
1113
|
fontWeight: '600',
|
|
1230
1114
|
marginTop: 20,
|
|
@@ -1243,31 +1127,14 @@ var GroupByModal2 = function (_a) {
|
|
|
1243
1127
|
setAggregationColumn(column, index);
|
|
1244
1128
|
}, options: selectedTable.columns.map(function (elem) {
|
|
1245
1129
|
return { label: elem.name, value: elem.name };
|
|
1246
|
-
}) }), _jsx("div", { style: { width:
|
|
1130
|
+
}) }), _jsx("div", { style: { width: 16 } }), _jsx(SelectComponent, { value: aggregation.aggregationType, onChange: function (e) {
|
|
1247
1131
|
setAggregationType(e, index);
|
|
1248
1132
|
}, options: [
|
|
1249
1133
|
{ label: 'sum', value: 'sum' },
|
|
1250
1134
|
{ label: 'average', value: 'average' },
|
|
1251
1135
|
{ label: 'count', value: 'count' },
|
|
1252
|
-
] })] })));
|
|
1253
|
-
}), _jsx("
|
|
1254
|
-
width: '100%',
|
|
1255
|
-
marginTop: '1.25rem',
|
|
1256
|
-
paddingTop: '0.5rem',
|
|
1257
|
-
paddingBottom: '0.5rem',
|
|
1258
|
-
paddingLeft: '0.75rem',
|
|
1259
|
-
paddingRight: '0.75rem',
|
|
1260
|
-
backgroundColor: theme.primaryButtonColor,
|
|
1261
|
-
// hover: { opacity: "90" },
|
|
1262
|
-
color: 'white',
|
|
1263
|
-
fontWeight: '500',
|
|
1264
|
-
borderRadius: '0.375rem',
|
|
1265
|
-
boxShadow: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
|
|
1266
|
-
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1267
|
-
border: 'none',
|
|
1268
|
-
outline: 'none',
|
|
1269
|
-
cursor: 'pointer',
|
|
1270
|
-
}, onClick: function () {
|
|
1136
|
+
] })] }), 'agg' + index));
|
|
1137
|
+
}), _jsx("div", { style: { height: 20 } }), _jsx(ButtonComponent, { id: "custom-button", onClick: function () {
|
|
1271
1138
|
if (groupByIndexBeingEdited > -1) {
|
|
1272
1139
|
updateGroupBy(groupByIndexBeingEdited);
|
|
1273
1140
|
setIsOpen(false);
|
|
@@ -1277,31 +1144,11 @@ var GroupByModal2 = function (_a) {
|
|
|
1277
1144
|
addGroupBy();
|
|
1278
1145
|
setIsOpen(false);
|
|
1279
1146
|
// close();
|
|
1280
|
-
}
|
|
1147
|
+
}, label: groupByIndexBeingEdited > -1 ? 'Edit group by' : 'Add group by' })] })) }))] })));
|
|
1281
1148
|
};
|
|
1282
1149
|
var AddFilterModal2 = function (_a) {
|
|
1283
|
-
var filters = _a.filters, selectedColumn = _a.selectedColumn, numberStart = _a.numberStart, numberEnd = _a.numberEnd, dateStart = _a.dateStart, setDateStart = _a.setDateStart, columnStats = _a.columnStats, stringFilterValues = _a.stringFilterValues, setStringFilterValues = _a.setStringFilterValues, addFilter = _a.addFilter, setSelectedColumn = _a.setSelectedColumn, setNumberStart = _a.setNumberStart, setNumberEnd = _a.setNumberEnd, selectedTable = _a.selectedTable, columnType = _a.columnType, setDateEnd = _a.setDateEnd, dateEnd = _a.dateEnd, removeFilter = _a.removeFilter, selectFilter = _a.selectFilter, indexBeingEdited = _a.indexBeingEdited, updateFilter = _a.updateFilter, SelectComponent = _a.SelectComponent, theme = _a.theme;
|
|
1284
|
-
var dropdownRef = useRef(null);
|
|
1150
|
+
var filters = _a.filters, selectedColumn = _a.selectedColumn, numberStart = _a.numberStart, numberEnd = _a.numberEnd, dateStart = _a.dateStart, setDateStart = _a.setDateStart, columnStats = _a.columnStats, stringFilterValues = _a.stringFilterValues, setStringFilterValues = _a.setStringFilterValues, addFilter = _a.addFilter, setSelectedColumn = _a.setSelectedColumn, setNumberStart = _a.setNumberStart, setNumberEnd = _a.setNumberEnd, selectedTable = _a.selectedTable, columnType = _a.columnType, setDateEnd = _a.setDateEnd, dateEnd = _a.dateEnd, removeFilter = _a.removeFilter, selectFilter = _a.selectFilter, indexBeingEdited = _a.indexBeingEdited, updateFilter = _a.updateFilter, SelectComponent = _a.SelectComponent, ButtonComponent = _a.ButtonComponent, ModalComponent = _a.ModalComponent, theme = _a.theme, ModalTriggerComponent = _a.ModalTriggerComponent, TextInputComponent = _a.TextInputComponent, tagStyle = _a.tagStyle;
|
|
1285
1151
|
var _b = useState(false), isOpen = _b[0], setIsOpen = _b[1];
|
|
1286
|
-
useEffect(function () {
|
|
1287
|
-
// Event listener to close the dropdown menu when clicking outside
|
|
1288
|
-
var handleOutsideClick = function (event) {
|
|
1289
|
-
if (event.target.id === 'toggle-button' ||
|
|
1290
|
-
event.target.id === 'filter-tag') {
|
|
1291
|
-
setIsOpen(function (isOpen) { return !isOpen; });
|
|
1292
|
-
return;
|
|
1293
|
-
}
|
|
1294
|
-
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
1295
|
-
setIsOpen(false);
|
|
1296
|
-
}
|
|
1297
|
-
};
|
|
1298
|
-
// Attach the event listener to the document
|
|
1299
|
-
document.addEventListener('click', handleOutsideClick);
|
|
1300
|
-
// Clean up the event listener on component unmount
|
|
1301
|
-
return function () {
|
|
1302
|
-
document.removeEventListener('click', handleOutsideClick);
|
|
1303
|
-
};
|
|
1304
|
-
}, []);
|
|
1305
1152
|
return (_jsxs("div", __assign({ style: { display: 'flex', flexDirection: 'column' } }, { children: [_jsxs("div", __assign({ style: {
|
|
1306
1153
|
position: 'relative',
|
|
1307
1154
|
display: 'inline-block',
|
|
@@ -1310,56 +1157,52 @@ var AddFilterModal2 = function (_a) {
|
|
|
1310
1157
|
display: 'flex',
|
|
1311
1158
|
flexDirection: 'row',
|
|
1312
1159
|
alignItems: 'center',
|
|
1313
|
-
} }, { children: [_jsx(
|
|
1314
|
-
// onClick={() => setIsOpen((isOpen) => !isOpen)}
|
|
1315
|
-
type: "button", "aria-haspopup": "menu", "aria-expanded": "true", "data-headlessui-state": "open", style: {
|
|
1316
|
-
display: 'inline-flex',
|
|
1317
|
-
borderWidth: '1px',
|
|
1318
|
-
borderStyle: 'solid',
|
|
1319
|
-
borderColor: theme.borderColor,
|
|
1320
|
-
boxShadow: 'rgba(231, 231, 231, 0.5) 0px 1px 2px 0px',
|
|
1321
|
-
borderRadius: '0.375rem',
|
|
1322
|
-
backgroundColor: theme.backgroundColor,
|
|
1323
|
-
padding: '0.375rem 0.75rem',
|
|
1324
|
-
fontSize: '0.875rem',
|
|
1325
|
-
fontWeight: '500',
|
|
1326
|
-
color: theme.primaryTextColor,
|
|
1327
|
-
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1328
|
-
cursor: 'pointer',
|
|
1329
|
-
} }, { children: "Filters" })), _jsx("div", __assign({ style: {
|
|
1160
|
+
} }, { children: [_jsx(ModalTriggerComponent, { onClick: function () { return setIsOpen(function (isOpen) { return !isOpen; }); }, label: "Add filter +" }), _jsx("div", __assign({ style: {
|
|
1330
1161
|
overflowX: 'scroll',
|
|
1331
1162
|
display: 'flex',
|
|
1332
1163
|
flexDirection: 'row',
|
|
1333
1164
|
alignItems: 'center',
|
|
1334
|
-
} }, { children: filters.map(function (elem, index) { return (_jsx(FilterTag, { id: "filter-tag", label: elem.tag, removeFilter: removeFilter, selectFilter: selectFilter, index: index, theme: theme })); }) }))] })),
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1165
|
+
} }, { children: filters.map(function (elem, index) { return (_jsx(FilterTag, { id: "filter-tag", label: elem.tag, removeFilter: removeFilter, selectFilter: selectFilter, index: index, theme: theme, setIsOpen: setIsOpen, tagStyle: tagStyle }, 'filter' + index)); }) }))] })), _jsx(ModalComponent, __assign({ isOpen: isOpen, onClose: function () { return setIsOpen(false); }, title: "Add filter" }, { children: _jsxs("div", __assign({ style: {
|
|
1166
|
+
backgroundColor: 'rgb(255, 255, 255)',
|
|
1167
|
+
display: 'flex',
|
|
1168
|
+
flexDirection: 'column',
|
|
1169
|
+
} }, { children: [_jsx("div", __assign({ style: {
|
|
1170
|
+
fontSize: 14,
|
|
1171
|
+
marginBottom: '6px',
|
|
1172
|
+
fontWeight: '600',
|
|
1173
|
+
color: theme.secondaryTextColor,
|
|
1174
|
+
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1175
|
+
} }, { children: "Column" })), _jsx(SelectComponent, { id: "custom-select", value: selectedColumn.name, onChange: function (e) {
|
|
1176
|
+
var column = selectedTable.columns.find(function (c) { return c.name === e; });
|
|
1177
|
+
setSelectedColumn(column);
|
|
1178
|
+
}, options: selectedTable.columns.map(function (elem) {
|
|
1179
|
+
return { label: elem.name, value: elem.name };
|
|
1180
|
+
}) }), columnType === 'number' && (_jsx("div", { children: _jsxs("div", __assign({ style: {
|
|
1181
|
+
display: 'flex',
|
|
1182
|
+
flexDirection: 'row',
|
|
1183
|
+
alignItems: 'center',
|
|
1184
|
+
justifyContent: 'space-between',
|
|
1185
|
+
} }, { children: [_jsxs("div", __assign({ style: {
|
|
1186
|
+
display: 'flex',
|
|
1187
|
+
flexDirection: 'column',
|
|
1188
|
+
marginTop: '20px',
|
|
1189
|
+
} }, { children: [_jsx("div", __assign({ style: {
|
|
1190
|
+
fontSize: '14px',
|
|
1191
|
+
fontWeight: '600',
|
|
1192
|
+
color: theme.secondaryTextColor,
|
|
1193
|
+
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1194
|
+
marginBottom: 6,
|
|
1195
|
+
} }, { children: "Minimum" })), _jsx(TextInputComponent, { id: "min-input", value: numberStart, onChange: function (e) { return setNumberStart(e.target.value); } })] })), _jsx("div", { style: { width: 16 } }), _jsxs("div", __assign({ style: {
|
|
1196
|
+
display: 'flex',
|
|
1197
|
+
flexDirection: 'column',
|
|
1198
|
+
marginTop: '20px',
|
|
1199
|
+
} }, { children: [_jsx("div", __assign({ style: {
|
|
1200
|
+
fontSize: '14px',
|
|
1201
|
+
fontWeight: '600',
|
|
1202
|
+
color: theme.secondaryTextColor,
|
|
1203
|
+
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1204
|
+
marginBottom: 6,
|
|
1205
|
+
} }, { children: "Maximum" })), _jsx(TextInputComponent, { id: "max-input", value: numberEnd, onChange: function (e) { return setNumberEnd(e.target.value); } })] }))] })) })), columnType === 'date' && (_jsxs("div", __assign({ style: {
|
|
1363
1206
|
display: 'flex',
|
|
1364
1207
|
flexDirection: 'row',
|
|
1365
1208
|
alignItems: 'center',
|
|
@@ -1369,188 +1212,69 @@ var AddFilterModal2 = function (_a) {
|
|
|
1369
1212
|
flexDirection: 'column',
|
|
1370
1213
|
marginTop: '20px',
|
|
1371
1214
|
} }, { children: [_jsx("div", __assign({ style: {
|
|
1372
|
-
fontSize:
|
|
1215
|
+
fontSize: 14,
|
|
1373
1216
|
fontWeight: '600',
|
|
1374
|
-
color:
|
|
1375
|
-
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1376
|
-
} }, { children: "Minimum" })), _jsx("input", {
|
|
1377
|
-
// type="number"
|
|
1378
|
-
value: numberStart, onChange: function (e) { return setNumberStart(e.target.value); }, placeholder: "", style: {
|
|
1379
|
-
textAlign: 'right',
|
|
1380
|
-
width: '100px',
|
|
1381
|
-
border: '1px solid #E7E7E7',
|
|
1382
|
-
color: theme.primaryTextColor,
|
|
1383
|
-
marginTop: '4px',
|
|
1384
|
-
height: 38,
|
|
1385
|
-
paddingRight: 8,
|
|
1386
|
-
backgroundColor: 'white',
|
|
1387
|
-
borderRadius: '0.375rem',
|
|
1388
|
-
boxShadow: '0 1px 3px 0 rgba(0, 0, 0, 0.1)',
|
|
1217
|
+
color: 'rgba(56, 65, 81, 0.7)',
|
|
1389
1218
|
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1390
|
-
} })] })), _jsxs("div", __assign({ style: {
|
|
1219
|
+
} }, { children: "Start date" })), _jsx("input", { type: "date", value: dateStart, onChange: function (e) { return setDateStart(e.target.value); }, placeholder: "Start date" })] })), _jsxs("div", __assign({ style: {
|
|
1391
1220
|
display: 'flex',
|
|
1392
1221
|
flexDirection: 'column',
|
|
1393
1222
|
marginTop: '20px',
|
|
1394
1223
|
} }, { children: [_jsx("div", __assign({ style: {
|
|
1395
|
-
fontSize:
|
|
1224
|
+
fontSize: 14,
|
|
1396
1225
|
fontWeight: '600',
|
|
1397
|
-
color:
|
|
1398
|
-
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1399
|
-
} }, { children: "Maximum" })), _jsx("input", {
|
|
1400
|
-
// type="number"
|
|
1401
|
-
value: numberEnd, onChange: function (e) { return setNumberEnd(e.target.value); }, placeholder: "", style: {
|
|
1402
|
-
textAlign: 'right',
|
|
1403
|
-
width: '100px',
|
|
1404
|
-
border: '1px solid #E7E7E7',
|
|
1405
|
-
color: theme.primaryTextColor,
|
|
1226
|
+
color: 'rgba(56, 65, 81, 0.7)',
|
|
1406
1227
|
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
flexDirection: 'row',
|
|
1416
|
-
alignItems: 'center',
|
|
1417
|
-
justifyContent: 'space-between',
|
|
1418
|
-
} }, { children: [_jsxs("div", __assign({ style: {
|
|
1419
|
-
display: 'flex',
|
|
1420
|
-
flexDirection: 'column',
|
|
1421
|
-
marginTop: '20px',
|
|
1422
|
-
} }, { children: [_jsx("div", __assign({ style: {
|
|
1423
|
-
fontSize: '0.8rem',
|
|
1424
|
-
fontWeight: '600',
|
|
1425
|
-
color: 'rgba(56, 65, 81, 0.7)',
|
|
1426
|
-
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1427
|
-
} }, { children: "Start date" })), _jsx("input", { type: "date", value: dateStart, onChange: function (e) { return setDateStart(e.target.value); }, placeholder: "Start date", style: {
|
|
1428
|
-
width: '115px',
|
|
1429
|
-
fontSize: '0.8rem',
|
|
1430
|
-
color: theme.primaryTextColor,
|
|
1431
|
-
borderWidth: '1px',
|
|
1432
|
-
marginTop: '4px',
|
|
1433
|
-
borderColor: '#E7E7E7',
|
|
1434
|
-
backgroundColor: 'white',
|
|
1435
|
-
borderRadius: '0.375rem',
|
|
1436
|
-
boxShadow: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
|
|
1437
|
-
paddingLeft: '0.5rem',
|
|
1438
|
-
paddingRight: '0.5rem',
|
|
1439
|
-
paddingTop: '0.375rem',
|
|
1440
|
-
paddingBottom: '0.375rem',
|
|
1441
|
-
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1442
|
-
} })] })), _jsxs("div", __assign({ style: {
|
|
1443
|
-
display: 'flex',
|
|
1444
|
-
flexDirection: 'column',
|
|
1445
|
-
marginTop: '20px',
|
|
1446
|
-
} }, { children: [_jsx("div", __assign({ style: {
|
|
1447
|
-
fontSize: '0.8rem',
|
|
1448
|
-
fontWeight: '600',
|
|
1449
|
-
color: 'rgba(56, 65, 81, 0.7)',
|
|
1450
|
-
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1451
|
-
} }, { children: "End date" })), _jsx("input", { type: "date", value: dateEnd, onChange: function (e) { return setDateEnd(e.target.value); }, placeholder: "End date", style: {
|
|
1452
|
-
width: '115px',
|
|
1453
|
-
fontSize: '0.8rem',
|
|
1454
|
-
color: theme.primaryTextColor,
|
|
1455
|
-
borderWidth: '1px',
|
|
1456
|
-
marginTop: '4px',
|
|
1457
|
-
borderColor: '#E7E7E7',
|
|
1458
|
-
backgroundColor: 'white',
|
|
1459
|
-
borderRadius: '0.375rem',
|
|
1460
|
-
boxShadow: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
|
|
1461
|
-
paddingLeft: '0.5rem',
|
|
1462
|
-
paddingRight: '0.5rem',
|
|
1463
|
-
paddingTop: '0.375rem',
|
|
1464
|
-
paddingBottom: '0.375rem',
|
|
1465
|
-
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1466
|
-
} })] }))] }))), columnType === 'string' &&
|
|
1467
|
-
columnStats &&
|
|
1468
|
-
columnStats.length > 0 && (_jsx("div", __assign({ style: {
|
|
1469
|
-
flex: 'flex',
|
|
1470
|
-
flexDirection: 'column',
|
|
1471
|
-
marginTop: '14px',
|
|
1472
|
-
} }, { children: columnStats.map(function (value) { return (_jsx("div", __assign({ style: {
|
|
1473
|
-
display: 'flex',
|
|
1474
|
-
flexDirection: 'row',
|
|
1475
|
-
alignItems: 'center',
|
|
1476
|
-
} }, { children: _jsxs("div", __assign({ style: {
|
|
1228
|
+
} }, { children: "End date" })), _jsx("input", { type: "date", value: dateEnd, onChange: function (e) { return setDateEnd(e.target.value); }, placeholder: "End date" })] }))] }))), columnType === 'string' &&
|
|
1229
|
+
columnStats &&
|
|
1230
|
+
columnStats.length > 0 && (_jsx("div", __assign({ style: {
|
|
1231
|
+
flex: 'flex',
|
|
1232
|
+
flexDirection: 'column',
|
|
1233
|
+
marginTop: '14px',
|
|
1234
|
+
overflow: 'hidden',
|
|
1235
|
+
} }, { children: columnStats.map(function (value) { return (_jsx("div", __assign({ style: {
|
|
1477
1236
|
display: 'flex',
|
|
1478
1237
|
flexDirection: 'row',
|
|
1479
1238
|
alignItems: 'center',
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
// className="border-[#E7E7E7] border-[1px] shadow-sm rounded-sm bg-white cursor-pointer"
|
|
1508
|
-
checked: stringFilterValues.includes(value), onChange: function () {
|
|
1509
|
-
setStringFilterValues(function (prev) {
|
|
1510
|
-
return prev.includes(value)
|
|
1511
|
-
? prev.filter(function (v) { return v !== value; })
|
|
1512
|
-
: __spreadArray(__spreadArray([], prev, true), [value], false);
|
|
1513
|
-
});
|
|
1514
|
-
} }), _jsx("div", __assign({ style: {
|
|
1515
|
-
marginLeft: 6,
|
|
1516
|
-
display: 'block',
|
|
1517
|
-
overflow: 'hidden',
|
|
1518
|
-
textOverflow: 'ellipsis',
|
|
1519
|
-
whiteSpace: 'nowrap',
|
|
1520
|
-
color: theme.primaryTextColor,
|
|
1521
|
-
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1522
|
-
} }, { children: value }))] }), value) }), value)); }) }))), _jsx("button", __assign({ style: {
|
|
1523
|
-
width: '245px',
|
|
1524
|
-
marginTop: '20px',
|
|
1525
|
-
padding: '0.5rem 0.75rem',
|
|
1526
|
-
backgroundColor: 'rgb(56, 65, 81)',
|
|
1527
|
-
color: 'rgb(255, 255, 255)',
|
|
1528
|
-
fontWeight: '500',
|
|
1529
|
-
borderRadius: '0.375rem',
|
|
1530
|
-
boxShadow: 'rgba(0, 0, 0, 0.05) 0px 1px 2px 0px',
|
|
1531
|
-
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1532
|
-
border: 'none',
|
|
1533
|
-
outline: 'none',
|
|
1534
|
-
cursor: 'pointer',
|
|
1535
|
-
}, onClick: function () {
|
|
1536
|
-
if (indexBeingEdited > -1) {
|
|
1537
|
-
updateFilter(indexBeingEdited);
|
|
1239
|
+
} }, { children: _jsxs("div", __assign({ style: {
|
|
1240
|
+
display: 'flex',
|
|
1241
|
+
flexDirection: 'row',
|
|
1242
|
+
alignItems: 'center',
|
|
1243
|
+
paddingTop: 6,
|
|
1244
|
+
paddingBottom: 6,
|
|
1245
|
+
} }, { children: [_jsx(DivCheckbox, { theme: theme, checked: stringFilterValues.includes(value), onChange: function () {
|
|
1246
|
+
setStringFilterValues(function (prev) {
|
|
1247
|
+
return prev.includes(value)
|
|
1248
|
+
? prev.filter(function (v) { return v !== value; })
|
|
1249
|
+
: __spreadArray(__spreadArray([], prev, true), [value], false);
|
|
1250
|
+
});
|
|
1251
|
+
} }), _jsx("div", __assign({ style: {
|
|
1252
|
+
marginLeft: 6,
|
|
1253
|
+
display: 'block',
|
|
1254
|
+
overflow: 'hidden',
|
|
1255
|
+
textOverflow: 'ellipsis',
|
|
1256
|
+
whiteSpace: 'nowrap',
|
|
1257
|
+
color: theme === null || theme === void 0 ? void 0 : theme.primaryTextColor,
|
|
1258
|
+
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1259
|
+
} }, { children: value }))] }), value) }), value)); }) }))), _jsx("div", { style: { height: 20 } }), _jsx(ButtonComponent, { id: "custom-button", onClick: function () {
|
|
1260
|
+
if (indexBeingEdited > -1) {
|
|
1261
|
+
updateFilter(indexBeingEdited);
|
|
1262
|
+
setIsOpen(false);
|
|
1263
|
+
return;
|
|
1264
|
+
}
|
|
1265
|
+
addFilter();
|
|
1538
1266
|
setIsOpen(false);
|
|
1539
|
-
|
|
1540
|
-
}
|
|
1541
|
-
addFilter();
|
|
1542
|
-
setIsOpen(false);
|
|
1543
|
-
} }, { children: indexBeingEdited > -1 ? 'Edit filter' : 'Add filter' }))] })))] })), _jsx("div", { style: { height: '12px' } })] })));
|
|
1267
|
+
}, label: indexBeingEdited > -1 ? 'Edit filter' : 'Add filter' })] })) }))] })), _jsx("div", { style: { height: '12px' } })] })));
|
|
1544
1268
|
};
|
|
1545
1269
|
var DivCheckbox = function (_a) {
|
|
1546
|
-
var onChange = _a.onChange, checked = _a.checked;
|
|
1270
|
+
var onChange = _a.onChange, checked = _a.checked, theme = _a.theme;
|
|
1547
1271
|
var toggleCheckbox = function () {
|
|
1548
1272
|
if (onChange) {
|
|
1549
1273
|
onChange(!checked);
|
|
1550
1274
|
}
|
|
1551
1275
|
};
|
|
1552
1276
|
var style = {
|
|
1553
|
-
display: 'inline-block',
|
|
1277
|
+
// display: 'inline-block',
|
|
1554
1278
|
width: '18px',
|
|
1555
1279
|
height: '18px',
|
|
1556
1280
|
background: checked ? '#384151' : '#fff',
|
|
@@ -1560,9 +1284,13 @@ var DivCheckbox = function (_a) {
|
|
|
1560
1284
|
cursor: 'pointer',
|
|
1561
1285
|
boxShadow: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
|
|
1562
1286
|
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
1287
|
+
display: 'flex',
|
|
1288
|
+
flexDirection: 'column',
|
|
1289
|
+
alignItems: 'center',
|
|
1290
|
+
justifyContent: 'center',
|
|
1563
1291
|
};
|
|
1564
1292
|
return (_jsx("div", __assign({ style: style, onClick: toggleCheckbox, "aria-checked": checked,
|
|
1565
1293
|
// className="shadow-sm"
|
|
1566
|
-
role: "checkbox" }, { children: checked && _jsx(CheckIcon, { className: "text-white", "aria-hidden": "true" }) })));
|
|
1294
|
+
role: "checkbox" }, { children: checked && (_jsx(CheckIcon, { style: { color: theme === null || theme === void 0 ? void 0 : theme.backgroundColor, height: 16, width: 16 }, className: "text-white", "aria-hidden": "true" })) })));
|
|
1567
1295
|
};
|
|
1568
1296
|
//# sourceMappingURL=ReportBuilder.js.map
|