@quillsql/react 1.7.1 → 1.7.2

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.
Files changed (105) hide show
  1. package/lib/AddToDashboardModal.js +369 -249
  2. package/lib/AddToDashboardModal.js.map +1 -1
  3. package/lib/BarList.js +109 -92
  4. package/lib/BarList.js.map +1 -1
  5. package/lib/Chart.js +414 -364
  6. package/lib/Chart.js.map +1 -1
  7. package/lib/Context.js +84 -92
  8. package/lib/Context.js.map +1 -1
  9. package/lib/Dashboard.js +209 -181
  10. package/lib/Dashboard.js.map +1 -1
  11. package/lib/DateRangePicker/Calendar.js +91 -87
  12. package/lib/DateRangePicker/Calendar.js.map +1 -1
  13. package/lib/DateRangePicker/DateRangePicker.js +68 -70
  14. package/lib/DateRangePicker/DateRangePicker.js.map +1 -1
  15. package/lib/DateRangePicker/DateRangePickerButton.js +57 -46
  16. package/lib/DateRangePicker/DateRangePickerButton.js.map +1 -1
  17. package/lib/DateRangePicker/dateRangePickerUtils.js +99 -105
  18. package/lib/DateRangePicker/dateRangePickerUtils.js.map +1 -1
  19. package/lib/DateRangePicker/index.js +1 -8
  20. package/lib/DateRangePicker/index.js.map +1 -1
  21. package/lib/PieChart.js +225 -221
  22. package/lib/PieChart.js.map +1 -1
  23. package/lib/QuillProvider.js +18 -8
  24. package/lib/QuillProvider.js.map +1 -1
  25. package/lib/ReportBuilder.js +526 -430
  26. package/lib/ReportBuilder.js.map +1 -1
  27. package/lib/SQLEditor.js +268 -183
  28. package/lib/SQLEditor.js.map +1 -1
  29. package/lib/Table.js +256 -213
  30. package/lib/Table.js.map +1 -1
  31. package/lib/TableChart.js +75 -76
  32. package/lib/TableChart.js.map +1 -1
  33. package/lib/assets/ArrowDownHeadIcon.js +28 -5
  34. package/lib/assets/ArrowDownHeadIcon.js.map +1 -1
  35. package/lib/assets/ArrowDownIcon.js +28 -5
  36. package/lib/assets/ArrowDownIcon.js.map +1 -1
  37. package/lib/assets/ArrowDownRightIcon.js +28 -5
  38. package/lib/assets/ArrowDownRightIcon.js.map +1 -1
  39. package/lib/assets/ArrowLeftHeadIcon.js +28 -5
  40. package/lib/assets/ArrowLeftHeadIcon.js.map +1 -1
  41. package/lib/assets/ArrowRightHeadIcon.js +28 -5
  42. package/lib/assets/ArrowRightHeadIcon.js.map +1 -1
  43. package/lib/assets/ArrowRightIcon.js +28 -5
  44. package/lib/assets/ArrowRightIcon.js.map +1 -1
  45. package/lib/assets/ArrowUpHeadIcon.js +28 -5
  46. package/lib/assets/ArrowUpHeadIcon.js.map +1 -1
  47. package/lib/assets/ArrowUpIcon.js +28 -5
  48. package/lib/assets/ArrowUpIcon.js.map +1 -1
  49. package/lib/assets/ArrowUpRightIcon.js +28 -5
  50. package/lib/assets/ArrowUpRightIcon.js.map +1 -1
  51. package/lib/assets/CalendarIcon.js +28 -5
  52. package/lib/assets/CalendarIcon.js.map +1 -1
  53. package/lib/assets/DoubleArrowLeftHeadIcon.js +28 -5
  54. package/lib/assets/DoubleArrowLeftHeadIcon.js.map +1 -1
  55. package/lib/assets/DoubleArrowRightHeadIcon.js +28 -5
  56. package/lib/assets/DoubleArrowRightHeadIcon.js.map +1 -1
  57. package/lib/assets/ExclamationFilledIcon.js +28 -5
  58. package/lib/assets/ExclamationFilledIcon.js.map +1 -1
  59. package/lib/assets/LoadingSpinner.js +28 -5
  60. package/lib/assets/LoadingSpinner.js.map +1 -1
  61. package/lib/assets/SearchIcon.js +28 -5
  62. package/lib/assets/SearchIcon.js.map +1 -1
  63. package/lib/assets/XCircleIcon.js +28 -5
  64. package/lib/assets/XCircleIcon.js.map +1 -1
  65. package/lib/assets/index.js +16 -38
  66. package/lib/assets/index.js.map +1 -1
  67. package/lib/components/BigModal/BigModal.js +43 -45
  68. package/lib/components/BigModal/BigModal.js.map +1 -1
  69. package/lib/components/Dropdown/Dropdown.js +53 -57
  70. package/lib/components/Dropdown/Dropdown.js.map +1 -1
  71. package/lib/components/Dropdown/DropdownItem.js +40 -43
  72. package/lib/components/Dropdown/DropdownItem.js.map +1 -1
  73. package/lib/components/Dropdown/index.js +2 -10
  74. package/lib/components/Dropdown/index.js.map +1 -1
  75. package/lib/components/Modal/Modal.js +43 -45
  76. package/lib/components/Modal/Modal.js.map +1 -1
  77. package/lib/components/Modal/index.js +1 -8
  78. package/lib/components/Modal/index.js.map +1 -1
  79. package/lib/components/selectUtils.js +15 -20
  80. package/lib/components/selectUtils.js.map +1 -1
  81. package/lib/contexts/BaseColorContext.js +3 -5
  82. package/lib/contexts/BaseColorContext.js.map +1 -1
  83. package/lib/contexts/HoveredValueContext.js +3 -5
  84. package/lib/contexts/HoveredValueContext.js.map +1 -1
  85. package/lib/contexts/RootStylesContext.js +3 -5
  86. package/lib/contexts/RootStylesContext.js.map +1 -1
  87. package/lib/contexts/SelectedValueContext.js +3 -5
  88. package/lib/contexts/SelectedValueContext.js.map +1 -1
  89. package/lib/contexts/index.js +4 -14
  90. package/lib/contexts/index.js.map +1 -1
  91. package/lib/hooks/index.js +4 -14
  92. package/lib/hooks/index.js.map +1 -1
  93. package/lib/hooks/useInternalState.js +7 -9
  94. package/lib/hooks/useInternalState.js.map +1 -1
  95. package/lib/hooks/useOnClickOutside.js +6 -8
  96. package/lib/hooks/useOnClickOutside.js.map +1 -1
  97. package/lib/hooks/useOnWindowResize.js +7 -9
  98. package/lib/hooks/useOnWindowResize.js.map +1 -1
  99. package/lib/hooks/useQuill.js +111 -60
  100. package/lib/hooks/useQuill.js.map +1 -1
  101. package/lib/hooks/useSelectOnKeyDown.js +15 -17
  102. package/lib/hooks/useSelectOnKeyDown.js.map +1 -1
  103. package/lib/index.js +8 -22
  104. package/lib/index.js.map +1 -1
  105. package/package.json +1 -1
@@ -1,22 +1,73 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
4
47
  };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getPostgresBasicType = void 0;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
8
- const react_1 = require("react");
48
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
49
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
50
+ if (ar || !(i in from)) {
51
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
52
+ ar[i] = from[i];
53
+ }
54
+ }
55
+ return to.concat(ar || Array.prototype.slice.call(from));
56
+ };
57
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
58
+ import { useState, useContext, useCallback, useEffect } from 'react';
9
59
  // import './nightOwlLight.css';
10
- const axios_1 = __importDefault(require("axios"));
11
- const Context_1 = require("./Context");
12
- const solid_1 = require("@heroicons/react/20/solid");
13
- const SQLEditor_1 = require("./SQLEditor");
14
- const date_fns_1 = require("date-fns");
15
- function QuillModal({ children, isOpen, onClose, title, theme }) {
60
+ import axios from 'axios';
61
+ import { ClientContext, SchemaContext, ThemeContext } from './Context';
62
+ import { XMarkIcon, CheckIcon, } from '@heroicons/react/20/solid';
63
+ import { convertPostgresColumn } from './SQLEditor';
64
+ import { format } from 'date-fns';
65
+ function QuillModal(_a) {
66
+ var children = _a.children, isOpen = _a.isOpen, onClose = _a.onClose, title = _a.title, theme = _a.theme;
16
67
  if (!isOpen) {
17
68
  return null;
18
69
  }
19
- return ((0, jsx_runtime_1.jsx)("div", { style: {
70
+ return (_jsx("div", __assign({ style: {
20
71
  position: 'absolute',
21
72
  top: 45,
22
73
  minWidth: 300,
@@ -29,99 +80,134 @@ function QuillModal({ children, isOpen, onClose, title, theme }) {
29
80
  borderWidth: theme.borderWidth,
30
81
  borderStyle: 'solid',
31
82
  borderColor: theme.borderColor,
32
- }, children: children }));
83
+ } }, { children: children })));
33
84
  }
34
- function ReportBuilder({ onChangeQuery, onChangeData, onChangeColumns, onChangeLoading, onError, SelectComponent, ButtonComponent, ModalComponent, ModalTriggerComponent, TextInputComponent, tagStyle, }) {
35
- const [data, setData] = (0, react_1.useState)([]);
36
- const [client] = (0, react_1.useContext)(Context_1.ClientContext);
37
- const [schema, setSchema] = (0, react_1.useContext)(Context_1.SchemaContext);
38
- const [theme] = (0, react_1.useContext)(Context_1.ThemeContext);
39
- const [columns, setColumns] = (0, react_1.useState)([]);
40
- const [fields, setFields] = (0, react_1.useState)([]);
41
- (0, react_1.useEffect)(() => {
42
- async function getData(schema) {
43
- if (schema.length && !data.length) {
44
- const { publicKey, customerId, environment } = client;
45
- const response = await axios_1.default.post(`https://quill-344421.uc.r.appspot.com/dashquery`, {
46
- query: `select * from ${schema[0].displayName} limit 10;`,
47
- }, {
48
- params: {
49
- orgId: customerId,
50
- publicKey,
51
- },
52
- headers: {
53
- Authorization: `Bearer `,
54
- environment: environment || undefined,
55
- },
85
+ export default function ReportBuilder(_a) {
86
+ var _this = this;
87
+ 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;
88
+ var _b = useState([]), data = _b[0], setData = _b[1];
89
+ var client = useContext(ClientContext)[0];
90
+ var _c = useContext(SchemaContext), schema = _c[0], setSchema = _c[1];
91
+ var theme = useContext(ThemeContext)[0];
92
+ var _d = useState([]), columns = _d[0], setColumns = _d[1];
93
+ var _e = useState([]), fields = _e[0], setFields = _e[1];
94
+ useEffect(function () {
95
+ function getData(schema) {
96
+ return __awaiter(this, void 0, void 0, function () {
97
+ var publicKey, customerId, environment, response;
98
+ return __generator(this, function (_a) {
99
+ switch (_a.label) {
100
+ case 0:
101
+ if (!(schema.length && !data.length)) return [3 /*break*/, 2];
102
+ publicKey = client.publicKey, customerId = client.customerId, environment = client.environment;
103
+ return [4 /*yield*/, axios.post("https://quill-344421.uc.r.appspot.com/dashquery", {
104
+ query: "select * from ".concat(schema[0].displayName, " limit 10;"),
105
+ }, {
106
+ params: {
107
+ orgId: customerId,
108
+ publicKey: publicKey,
109
+ },
110
+ headers: {
111
+ Authorization: "Bearer ",
112
+ environment: environment || undefined,
113
+ },
114
+ })];
115
+ case 1:
116
+ response = _a.sent();
117
+ setData(response.data.rows);
118
+ _a.label = 2;
119
+ case 2: return [2 /*return*/];
120
+ }
56
121
  });
57
- setData(response.data.rows);
58
- }
122
+ });
59
123
  }
60
124
  getData(schema);
61
125
  }, [schema]);
62
- (0, react_1.useEffect)(() => {
63
- let isSubscribed = true;
64
- async function getSchema() {
65
- const { publicKey, environment } = client;
66
- const response3 = await axios_1.default.get(`https://quill-344421.uc.r.appspot.com/schema2/${publicKey}/`, {
67
- headers: {
68
- Authorization: `Bearer `,
69
- environment: environment || undefined,
70
- },
126
+ useEffect(function () {
127
+ var isSubscribed = true;
128
+ function getSchema() {
129
+ return __awaiter(this, void 0, void 0, function () {
130
+ var publicKey, environment, response3;
131
+ return __generator(this, function (_a) {
132
+ switch (_a.label) {
133
+ case 0:
134
+ publicKey = client.publicKey, environment = client.environment;
135
+ return [4 /*yield*/, axios.get("https://quill-344421.uc.r.appspot.com/schema2/".concat(publicKey, "/"), {
136
+ headers: {
137
+ Authorization: "Bearer ",
138
+ environment: environment || undefined,
139
+ },
140
+ })];
141
+ case 1:
142
+ response3 = _a.sent();
143
+ if (isSubscribed) {
144
+ setSchema(response3.data.tables);
145
+ }
146
+ return [2 /*return*/];
147
+ }
148
+ });
71
149
  });
72
- if (isSubscribed) {
73
- setSchema(response3.data.tables);
74
- }
75
150
  }
76
151
  if (isSubscribed) {
77
152
  getSchema();
78
153
  }
79
- return () => {
154
+ return function () {
80
155
  isSubscribed = false;
81
156
  };
82
157
  }, []);
83
- const runQuery = async (query) => {
84
- const { publicKey, customerId, environment, queryEndpoint, queryHeaders, withCredentials, } = client;
85
- let response;
86
- if (queryEndpoint) {
87
- response = await axios_1.default.post(queryEndpoint, { metadata: { query, task: 'query' } }, { headers: queryHeaders, withCredentials });
88
- }
89
- else {
90
- response = await axios_1.default.post(`https://quill-344421.uc.r.appspot.com/dashquery`, {
91
- query,
92
- }, {
93
- params: {
94
- orgId: customerId,
95
- publicKey,
96
- },
97
- headers: {
98
- Authorization: `Bearer `,
99
- environment: environment || undefined,
100
- },
101
- });
102
- }
103
- if (response && response.data && response.data.errorMessage) {
104
- onError(response.data.errorMessage);
105
- setData([]);
106
- onChangeData([]);
107
- setColumns([]);
108
- onChangeColumns([]);
109
- setFields([]);
110
- return;
111
- }
112
- setData(response.data.rows);
113
- onChangeData(response.data.rows);
114
- setColumns(response.data.fields.map(elem => (0, SQLEditor_1.convertPostgresColumn)(elem)));
115
- onChangeColumns(response.data.fields.map(elem => (0, SQLEditor_1.convertPostgresColumn)(elem)));
116
- setFields(response.data.fields);
117
- };
158
+ var runQuery = function (query) { return __awaiter(_this, void 0, void 0, function () {
159
+ var publicKey, customerId, environment, queryEndpoint, queryHeaders, withCredentials, response;
160
+ return __generator(this, function (_a) {
161
+ switch (_a.label) {
162
+ case 0:
163
+ publicKey = client.publicKey, customerId = client.customerId, environment = client.environment, queryEndpoint = client.queryEndpoint, queryHeaders = client.queryHeaders, withCredentials = client.withCredentials;
164
+ if (!queryEndpoint) return [3 /*break*/, 2];
165
+ return [4 /*yield*/, axios.post(queryEndpoint, { metadata: { query: query, task: 'query' } }, { headers: queryHeaders, withCredentials: withCredentials })];
166
+ case 1:
167
+ response = _a.sent();
168
+ return [3 /*break*/, 4];
169
+ case 2: return [4 /*yield*/, axios.post("https://quill-344421.uc.r.appspot.com/dashquery", {
170
+ query: query,
171
+ }, {
172
+ params: {
173
+ orgId: customerId,
174
+ publicKey: publicKey,
175
+ },
176
+ headers: {
177
+ Authorization: "Bearer ",
178
+ environment: environment || undefined,
179
+ },
180
+ })];
181
+ case 3:
182
+ response = _a.sent();
183
+ _a.label = 4;
184
+ case 4:
185
+ if (response && response.data && response.data.errorMessage) {
186
+ onError(response.data.errorMessage);
187
+ setData([]);
188
+ onChangeData([]);
189
+ setColumns([]);
190
+ onChangeColumns([]);
191
+ setFields([]);
192
+ return [2 /*return*/];
193
+ }
194
+ setData(response.data.rows);
195
+ onChangeData(response.data.rows);
196
+ setColumns(response.data.fields.map(function (elem) { return convertPostgresColumn(elem); }));
197
+ onChangeColumns(response.data.fields.map(function (elem) { return convertPostgresColumn(elem); }));
198
+ setFields(response.data.fields);
199
+ return [2 /*return*/];
200
+ }
201
+ });
202
+ }); };
118
203
  if (!schema.length) {
119
204
  return null;
120
205
  }
121
- return ((0, jsx_runtime_1.jsx)(ReportingTool, { theme: theme, data: data, schema: schema, onChangeQuery: onChangeQuery, runQuery: runQuery, SelectComponent: SelectComponent
206
+ return (_jsx(ReportingTool, { theme: theme, data: data, schema: schema, onChangeQuery: onChangeQuery, runQuery: runQuery, SelectComponent: SelectComponent
122
207
  ? SelectComponent
123
- : ({ onChange, value, options }) => {
124
- return ((0, jsx_runtime_1.jsx)("select", { onChange: event => onChange(event.target.value), value: value, id: 'reportbuilderdropdown', style: {
208
+ : function (_a) {
209
+ var onChange = _a.onChange, value = _a.value, options = _a.options;
210
+ return (_jsx("select", __assign({ onChange: function (event) { return onChange(event.target.value); }, value: value, id: 'reportbuilderdropdown', style: {
125
211
  width: '100%',
126
212
  minWidth: 230,
127
213
  outline: 'none',
@@ -139,11 +225,12 @@ function ReportBuilder({ onChangeQuery, onChangeData, onChangeColumns, onChangeL
139
225
  color: theme.primaryTextColor,
140
226
  boxShadow: '0 1px 2px 0 rgba(0,0,0,.05)',
141
227
  fontFamily: theme.fontFamily,
142
- }, children: options.map((option, index) => ((0, jsx_runtime_1.jsx)("option", { value: option.value, children: option.label }, option.label + index))) }));
228
+ } }, { children: options.map(function (option, index) { return (_jsx("option", __assign({ value: option.value }, { children: option.label }), option.label + index)); }) })));
143
229
  }, ButtonComponent: ButtonComponent
144
230
  ? ButtonComponent
145
- : ({ onClick, label }) => {
146
- return ((0, jsx_runtime_1.jsx)("div", { style: {
231
+ : function (_a) {
232
+ var onClick = _a.onClick, label = _a.label;
233
+ return (_jsx("div", __assign({ style: {
147
234
  height: 32,
148
235
  background: theme.primaryButtonColor,
149
236
  borderWidth: theme.borderWidth,
@@ -157,15 +244,17 @@ function ReportBuilder({ onChangeQuery, onChangeData, onChangeColumns, onChangeL
157
244
  cursor: 'pointer',
158
245
  fontFamily: theme.fontFamily,
159
246
  fontWeight: theme.buttonFontWeight || 600,
160
- }, onClick: onClick, children: label }));
247
+ }, onClick: onClick }, { children: label })));
161
248
  }, ModalComponent: ModalComponent
162
249
  ? ModalComponent
163
- : ({ children, isOpen, onClose, title }) => {
164
- return ((0, jsx_runtime_1.jsx)(QuillModal, { isOpen: isOpen, theme: theme, onClose: onClose, title: title, children: children }));
250
+ : function (_a) {
251
+ var children = _a.children, isOpen = _a.isOpen, onClose = _a.onClose, title = _a.title;
252
+ return (_jsx(QuillModal, __assign({ isOpen: isOpen, theme: theme, onClose: onClose, title: title }, { children: children })));
165
253
  }, ModalTriggerComponent: ModalTriggerComponent
166
254
  ? ModalTriggerComponent
167
- : ({ onClick, label }) => {
168
- return ((0, jsx_runtime_1.jsx)("div", { style: {
255
+ : function (_a) {
256
+ var onClick = _a.onClick, label = _a.label;
257
+ return (_jsx("div", __assign({ style: {
169
258
  height: 32,
170
259
  background: theme.backgroundColor,
171
260
  borderWidth: theme.borderWidth,
@@ -184,11 +273,12 @@ function ReportBuilder({ onChangeQuery, onChangeData, onChangeColumns, onChangeL
184
273
  color: theme.primaryTextColor,
185
274
  fontWeight: theme.buttonFontWeight || 600,
186
275
  fontFamily: theme.fontFamily,
187
- }, onClick: onClick, children: label }));
276
+ }, onClick: onClick }, { children: label })));
188
277
  }, TextInputComponent: TextInputComponent
189
278
  ? TextInputComponent
190
- : ({ onChange, value, id }) => {
191
- return ((0, jsx_runtime_1.jsx)("input", { style: {
279
+ : function (_a) {
280
+ var onChange = _a.onChange, value = _a.value, id = _a.id;
281
+ return (_jsx("input", { style: {
192
282
  outline: 'none',
193
283
  textAlign: 'left',
194
284
  whiteSpace: 'nowrap',
@@ -208,9 +298,8 @@ function ReportBuilder({ onChangeQuery, onChangeData, onChangeColumns, onChangeL
208
298
  }, id: id, onChange: onChange, value: value }));
209
299
  }, tagStyle: tagStyle }));
210
300
  }
211
- exports.default = ReportBuilder;
212
- function getPostgresBasicType(column) {
213
- let format;
301
+ export function getPostgresBasicType(column) {
302
+ var format;
214
303
  // first check if column.dataTypeID exists
215
304
  if (column.dataTypeID) {
216
305
  switch (column.dataTypeID) {
@@ -257,12 +346,13 @@ function getPostgresBasicType(column) {
257
346
  }
258
347
  return format;
259
348
  }
260
- exports.getPostgresBasicType = getPostgresBasicType;
261
- function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponent, onChangeQuery, theme, ModalComponent, ModalTriggerComponent, TextInputComponent, tagStyle, }) {
262
- const [selectedTable, setSelectedTable] = (0, react_1.useState)(schema[0]);
263
- const [selectedColumn, setSelectedColumn] = (0, react_1.useState)(schema[0].columns[0]);
264
- const [filters, setFilters] = (0, react_1.useState)([]);
265
- const [AST, setAST] = (0, react_1.useState)({
349
+ function ReportingTool(_a) {
350
+ var _this = this;
351
+ 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;
352
+ var _b = useState(schema[0]), selectedTable = _b[0], setSelectedTable = _b[1];
353
+ var _c = useState(schema[0].columns[0]), selectedColumn = _c[0], setSelectedColumn = _c[1];
354
+ var _d = useState([]), filters = _d[0], setFilters = _d[1];
355
+ var _e = useState({
266
356
  with: null,
267
357
  type: 'select',
268
358
  options: null,
@@ -276,40 +366,39 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
276
366
  orderby: null,
277
367
  limit: { seperator: '', value: [] },
278
368
  window: null,
279
- });
280
- const [numberStart, setNumberStart] = (0, react_1.useState)(0);
281
- const [numberEnd, setNumberEnd] = (0, react_1.useState)(0);
282
- const [dateStart, setDateStart] = (0, react_1.useState)('');
283
- const [dateEnd, setDateEnd] = (0, react_1.useState)('');
284
- const [computedColumns, setComputedColumns] = (0, react_1.useState)({});
285
- const [stringFilterValues, setStringFilterValues] = (0, react_1.useState)([]);
286
- const [columnType, setColumnType] = (0, react_1.useState)(getPostgresBasicType(schema[0].columns[0]));
287
- const [sqlQuery, setSqlQuery] = (0, react_1.useState)('');
369
+ }), AST = _e[0], setAST = _e[1];
370
+ var _f = useState(0), numberStart = _f[0], setNumberStart = _f[1];
371
+ var _g = useState(0), numberEnd = _g[0], setNumberEnd = _g[1];
372
+ var _h = useState(''), dateStart = _h[0], setDateStart = _h[1];
373
+ var _j = useState(''), dateEnd = _j[0], setDateEnd = _j[1];
374
+ var _k = useState({}), computedColumns = _k[0], setComputedColumns = _k[1];
375
+ var _l = useState([]), stringFilterValues = _l[0], setStringFilterValues = _l[1];
376
+ var _m = useState(getPostgresBasicType(schema[0].columns[0])), columnType = _m[0], setColumnType = _m[1];
377
+ var _o = useState(''), sqlQuery = _o[0], setSqlQuery = _o[1];
288
378
  // month | week | day | quarter
289
- const [dateBucket, setDateBucket] = (0, react_1.useState)('month');
290
- const [indexBeingEdited, setIndexBeingEdited] = (0, react_1.useState)(-1);
291
- const [groupBys, setGroupBys] = (0, react_1.useState)([]);
292
- const [aggregations, setAggregations] = (0, react_1.useState)([]);
293
- const [selectedGroupByColumn, setSelectedGroupByColumn] = (0, react_1.useState)(schema[0].columns[0]);
294
- const [groupByColumnType, setGroupByColumnType] = (0, react_1.useState)(getPostgresBasicType(schema[0].columns[0]));
295
- const [selectedSortByColumn, setSelectedSortByColumn] = (0, react_1.useState)(schema[0].columns[0].name);
296
- const [sortBys, setSortBys] = (0, react_1.useState)([]);
297
- const [selectedSortByDirection, setSelectedSortByDirection] = (0, react_1.useState)('ascending');
298
- const [groupByIndexBeingEdited, setGroupByIndexBeingEdited] = (0, react_1.useState)(-1);
299
- const [sortByIndexBeingEdited, setSortByIndexBeingEdited] = (0, react_1.useState)(-1);
300
- const [sortableColumns, setSortableColumns] = (0, react_1.useState)(schema[0].columns.map(col => col.name));
301
- const addGroupBy = () => {
379
+ var _p = useState('month'), dateBucket = _p[0], setDateBucket = _p[1];
380
+ var _q = useState(-1), indexBeingEdited = _q[0], setIndexBeingEdited = _q[1];
381
+ var _r = useState([]), groupBys = _r[0], setGroupBys = _r[1];
382
+ var _s = useState([]), aggregations = _s[0], setAggregations = _s[1];
383
+ var _t = useState(schema[0].columns[0]), selectedGroupByColumn = _t[0], setSelectedGroupByColumn = _t[1];
384
+ var _u = useState(getPostgresBasicType(schema[0].columns[0])), groupByColumnType = _u[0], setGroupByColumnType = _u[1];
385
+ var _v = useState(schema[0].columns[0].name), selectedSortByColumn = _v[0], setSelectedSortByColumn = _v[1];
386
+ var _w = useState([]), sortBys = _w[0], setSortBys = _w[1];
387
+ var _x = useState('ascending'), selectedSortByDirection = _x[0], setSelectedSortByDirection = _x[1];
388
+ var _y = useState(-1), groupByIndexBeingEdited = _y[0], setGroupByIndexBeingEdited = _y[1];
389
+ var _z = useState(-1), sortByIndexBeingEdited = _z[0], setSortByIndexBeingEdited = _z[1];
390
+ var _0 = useState(schema[0].columns.map(function (col) { return col.name; })), sortableColumns = _0[0], setSortableColumns = _0[1];
391
+ var addGroupBy = function () {
302
392
  if (selectedGroupByColumn && groupByColumnType) {
303
393
  if (groupByColumnType === 'string') {
304
- setGroupBys(groupBys => {
305
- return [
306
- ...groupBys,
394
+ setGroupBys(function (groupBys) {
395
+ return __spreadArray(__spreadArray([], groupBys, true), [
307
396
  {
308
397
  column: selectedGroupByColumn.name,
309
398
  columnType: groupByColumnType,
310
399
  tag: selectedGroupByColumn.name,
311
400
  },
312
- ];
401
+ ], false);
313
402
  });
314
403
  return;
315
404
  }
@@ -318,59 +407,55 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
318
407
  return;
319
408
  }
320
409
  else if (groupByColumnType === 'date') {
321
- setGroupBys(groupBys => {
322
- return [
323
- ...groupBys,
410
+ setGroupBys(function (groupBys) {
411
+ return __spreadArray(__spreadArray([], groupBys, true), [
324
412
  {
325
413
  column: selectedGroupByColumn.name,
326
414
  columnType: groupByColumnType,
327
415
  bucket: dateBucket,
328
416
  tag: dateBucket,
329
417
  },
330
- ];
418
+ ], false);
331
419
  });
332
420
  return;
333
421
  }
334
422
  }
335
423
  };
336
- const addSortBy = () => {
337
- setSortBys(sortBys => {
338
- return [
339
- ...sortBys,
424
+ var addSortBy = function () {
425
+ setSortBys(function (sortBys) {
426
+ return __spreadArray(__spreadArray([], sortBys, true), [
340
427
  {
341
428
  column: selectedSortByColumn,
342
429
  direction: selectedSortByDirection,
343
430
  },
344
- ];
431
+ ], false);
345
432
  });
346
433
  };
347
- const removeSortBy = index => {
348
- setSortBys(oldSortBys => {
349
- const newSortBys = [...oldSortBys];
434
+ var removeSortBy = function (index) {
435
+ setSortBys(function (oldSortBys) {
436
+ var newSortBys = __spreadArray([], oldSortBys, true);
350
437
  newSortBys.splice(index, 1);
351
438
  return newSortBys;
352
439
  });
353
440
  setSortByIndexBeingEdited(-1);
354
441
  };
355
- const removeGroupBy = index => {
356
- const columnBeingDeleted = groupBys[index].tag;
357
- setSortBys(oldSortBys => {
358
- const newSortBys = [
359
- ...oldSortBys.filter(sortBy => sortBy.column !== columnBeingDeleted),
360
- ];
442
+ var removeGroupBy = function (index) {
443
+ var columnBeingDeleted = groupBys[index].tag;
444
+ setSortBys(function (oldSortBys) {
445
+ var newSortBys = __spreadArray([], oldSortBys.filter(function (sortBy) { return sortBy.column !== columnBeingDeleted; }), true);
361
446
  return newSortBys;
362
447
  });
363
- setGroupBys(oldGroupBys => {
364
- const newGroupBys = [...oldGroupBys];
448
+ setGroupBys(function (oldGroupBys) {
449
+ var newGroupBys = __spreadArray([], oldGroupBys, true);
365
450
  newGroupBys.splice(index, 1);
366
451
  return newGroupBys;
367
452
  });
368
453
  setGroupByIndexBeingEdited(-1);
369
454
  };
370
- const updateSortBy = index => {
455
+ var updateSortBy = function (index) {
371
456
  if (selectedSortByColumn && selectedSortByDirection) {
372
- setSortBys(sortBys => {
373
- const newSortBys = [...sortBys];
457
+ setSortBys(function (sortBys) {
458
+ var newSortBys = __spreadArray([], sortBys, true);
374
459
  newSortBys[index] = {
375
460
  column: selectedSortByColumn,
376
461
  direction: selectedSortByDirection,
@@ -381,16 +466,16 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
381
466
  return;
382
467
  }
383
468
  };
384
- (0, react_1.useEffect)(() => {
469
+ useEffect(function () {
385
470
  setColumnType(getPostgresBasicType(selectedColumn));
386
471
  // console.log("WTF: ", selectedColumn);
387
472
  }, [selectedColumn]);
388
- (0, react_1.useEffect)(() => {
473
+ useEffect(function () {
389
474
  setGroupByColumnType(getPostgresBasicType(selectedGroupByColumn));
390
475
  }, [selectedGroupByColumn]);
391
- const selectFilter = index => {
392
- const filter = filters[index];
393
- const matchingColumn = selectedTable.columns.find(column => column.name === filter.column);
476
+ var selectFilter = function (index) {
477
+ var filter = filters[index];
478
+ var matchingColumn = selectedTable.columns.find(function (column) { return column.name === filter.column; });
394
479
  setSelectedColumn(matchingColumn);
395
480
  if (filter.columnType === 'string') {
396
481
  setStringFilterValues(filter.stringFilterValues);
@@ -407,36 +492,34 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
407
492
  setIndexBeingEdited(index);
408
493
  }
409
494
  };
410
- const selectSortBy = index => {
411
- const sortBy = sortBys[index];
495
+ var selectSortBy = function (index) {
496
+ var sortBy = sortBys[index];
412
497
  setSelectedSortByColumn(sortBy.column);
413
498
  setSelectedSortByDirection(sortBy.direction);
414
499
  setSortByIndexBeingEdited(index);
415
500
  };
416
- const selectGroupBy = index => {
417
- const groupBy = groupBys[index];
418
- const matchingColumn = selectedTable.columns.find(column => column.name === groupBy.column);
501
+ var selectGroupBy = function (index) {
502
+ var groupBy = groupBys[index];
503
+ var matchingColumn = selectedTable.columns.find(function (column) { return column.name === groupBy.column; });
419
504
  setSelectedGroupByColumn(matchingColumn);
420
505
  if (groupBy.bucket) {
421
506
  setDateBucket(groupBy.bucket);
422
507
  }
423
508
  setGroupByIndexBeingEdited(index);
424
509
  };
425
- const updateGroupBy = index => {
510
+ var updateGroupBy = function (index) {
426
511
  if (selectedGroupByColumn && groupByColumnType) {
427
512
  // if column changed, then auto delete the sort using that column
428
- const columnBeingDeleted = selectedGroupByColumn.name !== groupBys[index].column
513
+ var columnBeingDeleted_1 = selectedGroupByColumn.name !== groupBys[index].column
429
514
  ? groupBys[index].tag
430
515
  : 'nocolumnbeingdeleted';
431
- setSortBys(oldSortBys => {
432
- const newSortBys = [
433
- ...oldSortBys.filter(sortBy => sortBy.column !== columnBeingDeleted),
434
- ];
516
+ setSortBys(function (oldSortBys) {
517
+ var newSortBys = __spreadArray([], oldSortBys.filter(function (sortBy) { return sortBy.column !== columnBeingDeleted_1; }), true);
435
518
  return newSortBys;
436
519
  });
437
520
  if (groupByColumnType === 'date') {
438
- setGroupBys(groupBys => {
439
- const newGroupBys = [...groupBys];
521
+ setGroupBys(function (groupBys) {
522
+ var newGroupBys = __spreadArray([], groupBys, true);
440
523
  newGroupBys[index] = {
441
524
  column: selectedGroupByColumn.name,
442
525
  columnType: groupByColumnType,
@@ -447,8 +530,8 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
447
530
  });
448
531
  }
449
532
  else {
450
- setGroupBys(groupBys => {
451
- const newGroupBys = [...groupBys];
533
+ setGroupBys(function (groupBys) {
534
+ var newGroupBys = __spreadArray([], groupBys, true);
452
535
  newGroupBys[index] = {
453
536
  column: selectedGroupByColumn.name,
454
537
  columnType: groupByColumnType,
@@ -461,42 +544,42 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
461
544
  return;
462
545
  }
463
546
  };
464
- const updateFilter = index => {
547
+ var updateFilter = function (index) {
465
548
  if (selectedColumn && columnType) {
466
549
  if (columnType === 'string') {
467
- setFilters(filters => {
468
- const newFilters = [...filters];
550
+ setFilters(function (filters) {
551
+ var newFilters = __spreadArray([], filters, true);
469
552
  newFilters[index] = {
470
553
  column: selectedColumn.name,
471
- columnType,
472
- stringFilterValues,
473
- tag: `${selectedColumn.name} (${stringFilterValues.join(', ')})`,
554
+ columnType: columnType,
555
+ stringFilterValues: stringFilterValues,
556
+ tag: "".concat(selectedColumn.name, " (").concat(stringFilterValues.join(', '), ")"),
474
557
  };
475
558
  return newFilters;
476
559
  });
477
560
  }
478
561
  else if (columnType === 'number') {
479
- setFilters(filters => {
480
- const newFilters = [...filters];
562
+ setFilters(function (filters) {
563
+ var newFilters = __spreadArray([], filters, true);
481
564
  newFilters[index] = {
482
565
  column: selectedColumn.name,
483
- columnType,
484
- numberStart,
485
- numberEnd,
486
- tag: `${numberStart} < ${selectedColumn.name} < ${numberEnd}`,
566
+ columnType: columnType,
567
+ numberStart: numberStart,
568
+ numberEnd: numberEnd,
569
+ tag: "".concat(numberStart, " < ").concat(selectedColumn.name, " < ").concat(numberEnd),
487
570
  };
488
571
  return newFilters;
489
572
  });
490
573
  }
491
574
  else if (columnType === 'date') {
492
- setFilters(filters => {
493
- const newFilters = [...filters];
575
+ setFilters(function (filters) {
576
+ var newFilters = __spreadArray([], filters, true);
494
577
  newFilters[index] = {
495
578
  column: selectedColumn.name,
496
- columnType,
497
- dateStart,
498
- dateEnd,
499
- tag: `${selectedColumn.name} (${(0, date_fns_1.format)(new Date(dateStart), 'MMM dd')} - ${(0, date_fns_1.format)(new Date(dateEnd), 'MMM dd')})`,
579
+ columnType: columnType,
580
+ dateStart: dateStart,
581
+ dateEnd: dateEnd,
582
+ tag: "".concat(selectedColumn.name, " (").concat(format(new Date(dateStart), 'MMM dd'), " - ").concat(format(new Date(dateEnd), 'MMM dd'), ")"),
500
583
  };
501
584
  return newFilters;
502
585
  });
@@ -511,21 +594,20 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
511
594
  }
512
595
  };
513
596
  // ADD FILTER TO "FILTERS" ARRAY
514
- const addFilter = () => {
597
+ var addFilter = function () {
515
598
  if (selectedColumn && columnType) {
516
599
  // const type = getPostgresBasicType(selectedColumn);
517
- let newCondition;
600
+ var newCondition = void 0;
518
601
  if (columnType === 'string') {
519
- setFilters(filters => {
520
- return [
521
- ...filters,
602
+ setFilters(function (filters) {
603
+ return __spreadArray(__spreadArray([], filters, true), [
522
604
  {
523
605
  column: selectedColumn.name,
524
- columnType,
525
- stringFilterValues,
526
- tag: `${selectedColumn.name} (${stringFilterValues.join(', ')})`,
606
+ columnType: columnType,
607
+ stringFilterValues: stringFilterValues,
608
+ tag: "".concat(selectedColumn.name, " (").concat(stringFilterValues.join(', '), ")"),
527
609
  },
528
- ];
610
+ ], false);
529
611
  });
530
612
  setStringFilterValues([]);
531
613
  setNumberStart(0);
@@ -535,17 +617,16 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
535
617
  return;
536
618
  }
537
619
  else if (columnType === 'number') {
538
- setFilters(filters => {
539
- return [
540
- ...filters,
620
+ setFilters(function (filters) {
621
+ return __spreadArray(__spreadArray([], filters, true), [
541
622
  {
542
623
  column: selectedColumn.name,
543
- columnType,
544
- numberStart,
545
- numberEnd,
546
- tag: `${numberStart} < ${selectedColumn.name} < ${numberEnd}`,
624
+ columnType: columnType,
625
+ numberStart: numberStart,
626
+ numberEnd: numberEnd,
627
+ tag: "".concat(numberStart, " < ").concat(selectedColumn.name, " < ").concat(numberEnd),
547
628
  },
548
- ];
629
+ ], false);
549
630
  });
550
631
  setStringFilterValues([]);
551
632
  setNumberStart(0);
@@ -555,17 +636,16 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
555
636
  return;
556
637
  }
557
638
  else if (columnType === 'date') {
558
- setFilters(filters => {
559
- return [
560
- ...filters,
639
+ setFilters(function (filters) {
640
+ return __spreadArray(__spreadArray([], filters, true), [
561
641
  {
562
642
  column: selectedColumn.name,
563
- columnType,
564
- dateStart,
565
- dateEnd,
566
- tag: `${selectedColumn.name} (${(0, date_fns_1.format)(new Date(dateStart), 'MMM dd')} - ${(0, date_fns_1.format)(new Date(dateEnd), 'MMM dd')})`,
643
+ columnType: columnType,
644
+ dateStart: dateStart,
645
+ dateEnd: dateEnd,
646
+ tag: "".concat(selectedColumn.name, " (").concat(format(new Date(dateStart), 'MMM dd'), " - ").concat(format(new Date(dateEnd), 'MMM dd'), ")"),
567
647
  },
568
- ];
648
+ ], false);
569
649
  });
570
650
  setStringFilterValues([]);
571
651
  setNumberStart(0);
@@ -575,29 +655,23 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
575
655
  }
576
656
  }
577
657
  };
578
- const setAggregationColumn = (column, index) => {
658
+ var setAggregationColumn = function (column, index) {
579
659
  // ex
580
- setAggregations(aggregations => {
581
- const newAggregations = [...aggregations];
582
- newAggregations[index] = {
583
- ...newAggregations[index],
584
- column: column,
585
- };
660
+ setAggregations(function (aggregations) {
661
+ var newAggregations = __spreadArray([], aggregations, true);
662
+ newAggregations[index] = __assign(__assign({}, newAggregations[index]), { column: column });
586
663
  return newAggregations;
587
664
  });
588
665
  };
589
- const setAggregationType = (aggregationType, index) => {
666
+ var setAggregationType = function (aggregationType, index) {
590
667
  // ex
591
- setAggregations(aggregations => {
592
- const newAggregations = [...aggregations];
593
- newAggregations[index] = {
594
- ...newAggregations[index],
595
- aggregationType: aggregationType,
596
- };
668
+ setAggregations(function (aggregations) {
669
+ var newAggregations = __spreadArray([], aggregations, true);
670
+ newAggregations[index] = __assign(__assign({}, newAggregations[index]), { aggregationType: aggregationType });
597
671
  return newAggregations;
598
672
  });
599
673
  };
600
- const addAggregation = () => {
674
+ var addAggregation = function () {
601
675
  // setAggregations([
602
676
  // {
603
677
  // column: selectedTable.columns.filter(
@@ -606,23 +680,24 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
606
680
  // aggregationType: "sum",
607
681
  // },
608
682
  // ]);
609
- setAggregations(aggregations => {
610
- const newAggregations = [
611
- ...aggregations,
683
+ setAggregations(function (aggregations) {
684
+ var newAggregations = __spreadArray(__spreadArray([], aggregations, true), [
612
685
  {
613
- column: selectedTable.columns.filter(col => getPostgresBasicType(col) === 'number' &&
614
- !aggregations.map(elem => elem.name).includes(col.name))[0],
686
+ column: selectedTable.columns.filter(function (col) {
687
+ return getPostgresBasicType(col) === 'number' &&
688
+ !aggregations.map(function (elem) { return elem.name; }).includes(col.name);
689
+ })[0],
615
690
  aggregationType: 'sum',
616
691
  },
617
- ];
692
+ ], false);
618
693
  return newAggregations;
619
694
  });
620
695
  };
621
- (0, react_1.useEffect)(() => {
696
+ useEffect(function () {
622
697
  // if selected table changes, clear everything
623
698
  if (selectedTable.displayName !== AST.from.table) {
624
699
  setSelectedColumn(selectedTable.columns[0]);
625
- setSortableColumns(selectedTable.columns.map(col => col.name));
700
+ setSortableColumns(selectedTable.columns.map(function (col) { return col.name; }));
626
701
  setGroupBys([]);
627
702
  setSortBys([]);
628
703
  setFilters([]);
@@ -647,9 +722,9 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
647
722
  }
648
723
  }, [selectedTable]);
649
724
  // USE EFFECT HOOK THAT TRANSFORMS "FILTERS ARRAY INTO AST"
650
- (0, react_1.useEffect)(() => {
725
+ useEffect(function () {
651
726
  if (filters.length || groupBys.length || aggregations.length) {
652
- const newAST = {
727
+ var newAST = {
653
728
  with: null,
654
729
  type: 'select',
655
730
  options: null,
@@ -665,11 +740,11 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
665
740
  window: null,
666
741
  };
667
742
  // FILTERS
668
- for (let i = 0; i < filters.length; i++) {
669
- const filter = filters[i];
670
- const { column, columnType, stringFilterValues, numberStart, numberEnd, dateStart, dateEnd, } = filter;
671
- let newCondition;
672
- if (columnType === 'string') {
743
+ for (var i = 0; i < filters.length; i++) {
744
+ var filter = filters[i];
745
+ var column = filter.column, columnType_1 = filter.columnType, stringFilterValues_1 = filter.stringFilterValues, numberStart_1 = filter.numberStart, numberEnd_1 = filter.numberEnd, dateStart_1 = filter.dateStart, dateEnd_1 = filter.dateEnd;
746
+ var newCondition = void 0;
747
+ if (columnType_1 === 'string') {
673
748
  newCondition = {
674
749
  type: 'binary_expr',
675
750
  operator: 'IN',
@@ -680,14 +755,14 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
680
755
  },
681
756
  right: {
682
757
  type: 'expr_list',
683
- value: stringFilterValues.map(value => ({
758
+ value: stringFilterValues_1.map(function (value) { return ({
684
759
  type: 'single_quote_string',
685
- value,
686
- })),
760
+ value: value,
761
+ }); }),
687
762
  },
688
763
  };
689
764
  }
690
- else if (columnType === 'number') {
765
+ else if (columnType_1 === 'number') {
691
766
  newCondition = {
692
767
  type: 'binary_expr',
693
768
  operator: 'BETWEEN',
@@ -699,13 +774,13 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
699
774
  right: {
700
775
  type: 'expr_list',
701
776
  value: [
702
- { type: 'number', value: numberStart },
703
- { type: 'number', value: numberEnd },
777
+ { type: 'number', value: numberStart_1 },
778
+ { type: 'number', value: numberEnd_1 },
704
779
  ],
705
780
  },
706
781
  };
707
782
  }
708
- else if (columnType === 'date') {
783
+ else if (columnType_1 === 'date') {
709
784
  newCondition = {
710
785
  type: 'binary_expr',
711
786
  operator: 'BETWEEN',
@@ -719,11 +794,11 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
719
794
  value: [
720
795
  {
721
796
  type: 'single_quote_string',
722
- value: (0, date_fns_1.format)(new Date(dateStart), 'MM/dd/yyyy'),
797
+ value: format(new Date(dateStart_1), 'MM/dd/yyyy'),
723
798
  },
724
799
  {
725
800
  type: 'single_quote_string',
726
- value: (0, date_fns_1.format)(new Date(dateEnd), 'MM/dd/yyyy'),
801
+ value: format(new Date(dateEnd_1), 'MM/dd/yyyy'),
727
802
  },
728
803
  ],
729
804
  },
@@ -792,8 +867,8 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
792
867
  if (groupBys.length > 0) {
793
868
  newAST.columns = [];
794
869
  newAST.groupby = [];
795
- for (let i = 0; i < groupBys.length; i++) {
796
- const groupBy = groupBys[i];
870
+ for (var i = 0; i < groupBys.length; i++) {
871
+ var groupBy = groupBys[i];
797
872
  if (groupBy.columnType === 'date') {
798
873
  newAST.columns.push({
799
874
  expr: {
@@ -841,8 +916,8 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
841
916
  }
842
917
  // AGGREGATIONS
843
918
  if (aggregations.length > 0) {
844
- for (let i = 0; i < aggregations.length; i++) {
845
- const aggregation = aggregations[i];
919
+ for (var i = 0; i < aggregations.length; i++) {
920
+ var aggregation = aggregations[i];
846
921
  newAST.columns.push({
847
922
  expr: {
848
923
  type: 'aggr_func',
@@ -867,8 +942,8 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
867
942
  }
868
943
  if (sortBys.length > 0) {
869
944
  newAST.orderby = [];
870
- for (let i = 0; i < sortBys.length; i++) {
871
- const sortBy = sortBys[i];
945
+ for (var i = 0; i < sortBys.length; i++) {
946
+ var sortBy = sortBys[i];
872
947
  newAST.orderby.push({
873
948
  expr: { type: 'column_ref', table: null, column: sortBy.column },
874
949
  type: sortBy.direction === 'descending' ? 'DESC' : 'ASC',
@@ -879,53 +954,54 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
879
954
  setAST(newAST);
880
955
  }
881
956
  }, [filters, groupBys, aggregations, sortBys]);
882
- const removeFilter = index => {
883
- setFilters(oldFilters => {
884
- const newFilters = [...oldFilters];
957
+ var removeFilter = function (index) {
958
+ setFilters(function (oldFilters) {
959
+ var newFilters = __spreadArray([], oldFilters, true);
885
960
  newFilters.splice(index, 1);
886
961
  return newFilters;
887
962
  });
888
963
  setIndexBeingEdited(-1);
889
964
  };
890
- const computeStats = (0, react_1.useCallback)(column => {
965
+ var computeStats = useCallback(function (column) {
966
+ var _a;
891
967
  if (!computedColumns[column.name] && data) {
892
- const basicType = getPostgresBasicType(column);
893
- let result;
968
+ var basicType = getPostgresBasicType(column);
969
+ var result = void 0;
894
970
  if (basicType === 'number') {
895
- let min = Infinity, max = -Infinity;
896
- data.forEach(row => {
897
- const value = row[column.name];
898
- min = Math.min(min, value);
899
- max = Math.max(max, value);
971
+ var min_1 = Infinity, max_1 = -Infinity;
972
+ data.forEach(function (row) {
973
+ var value = row[column.name];
974
+ min_1 = Math.min(min_1, value);
975
+ max_1 = Math.max(max_1, value);
900
976
  });
901
- result = { min, max };
977
+ result = { min: min_1, max: max_1 };
902
978
  }
903
979
  else if (basicType === 'string') {
904
- const freqMap = {};
905
- data.forEach(row => {
906
- const value = row[column.name];
907
- freqMap[value] = (freqMap[value] || 0) + 1;
980
+ var freqMap_1 = {};
981
+ data.forEach(function (row) {
982
+ var value = row[column.name];
983
+ freqMap_1[value] = (freqMap_1[value] || 0) + 1;
908
984
  });
909
- result = Object.entries(freqMap)
910
- .sort((a, b) => b[1] - a[1])
985
+ result = Object.entries(freqMap_1)
986
+ .sort(function (a, b) { return b[1] - a[1]; })
911
987
  .slice(0, 6)
912
- .map(([key]) => key);
988
+ .map(function (_a) {
989
+ var key = _a[0];
990
+ return key;
991
+ });
913
992
  }
914
993
  else {
915
994
  // Handle other column types if necessary
916
995
  }
917
- setComputedColumns({
918
- ...computedColumns,
919
- [column.name]: result,
920
- });
996
+ setComputedColumns(__assign(__assign({}, computedColumns), (_a = {}, _a[column.name] = result, _a)));
921
997
  }
922
998
  }, [data, computedColumns]);
923
999
  // Call this function whenever the selected column changes
924
- (0, react_1.useEffect)(() => {
1000
+ useEffect(function () {
925
1001
  computeStats(selectedColumn);
926
1002
  }, [selectedColumn]);
927
1003
  // Use the results directly in your component
928
- const columnStats = computedColumns[selectedColumn.name];
1004
+ var columnStats = computedColumns[selectedColumn.name];
929
1005
  // useEffect(() => {
930
1006
  // if (AST && AST.from[0].table) {
931
1007
  // const parser = new Parser();
@@ -936,43 +1012,53 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
936
1012
  // }
937
1013
  // }
938
1014
  // }, [AST]);
939
- (0, react_1.useEffect)(() => {
1015
+ useEffect(function () {
940
1016
  if (!aggregations.length) {
941
1017
  setAggregations([
942
1018
  {
943
- column: selectedTable.columns.filter(col => getPostgresBasicType(col) === 'number')[0],
1019
+ column: selectedTable.columns.filter(function (col) { return getPostgresBasicType(col) === 'number'; })[0],
944
1020
  aggregationType: 'sum',
945
1021
  },
946
1022
  ]);
947
1023
  }
948
1024
  }, [selectedGroupByColumn]);
949
- (0, react_1.useEffect)(() => {
950
- const getSqlQueryFromAST = async () => {
951
- try {
952
- if (AST && AST.from[0].table) {
953
- const response = await axios_1.default.post('https://quill-344421.uc.r.appspot.com/sqlify', { ast: AST });
954
- const sqlQuery = response.data.query; // assuming the response contains the SQL query
955
- // alert(sqlQuery);
956
- if (sqlQuery) {
957
- onChangeQuery(sqlQuery);
958
- runQuery(sqlQuery);
959
- setSqlQuery(sqlQuery);
960
- if (AST.columns === '*') {
961
- setSortableColumns(selectedTable.columns.map(col => col.name));
962
- }
963
- else if (AST.columns.length) {
964
- setSortableColumns(AST.columns.map(elem => elem.as || elem.expr.name));
1025
+ useEffect(function () {
1026
+ var getSqlQueryFromAST = function () { return __awaiter(_this, void 0, void 0, function () {
1027
+ var response, sqlQuery_1, err_1;
1028
+ return __generator(this, function (_a) {
1029
+ switch (_a.label) {
1030
+ case 0:
1031
+ _a.trys.push([0, 3, , 4]);
1032
+ if (!(AST && AST.from[0].table)) return [3 /*break*/, 2];
1033
+ return [4 /*yield*/, axios.post('https://quill-344421.uc.r.appspot.com/sqlify', { ast: AST })];
1034
+ case 1:
1035
+ response = _a.sent();
1036
+ sqlQuery_1 = response.data.query;
1037
+ // alert(sqlQuery);
1038
+ if (sqlQuery_1) {
1039
+ onChangeQuery(sqlQuery_1);
1040
+ runQuery(sqlQuery_1);
1041
+ setSqlQuery(sqlQuery_1);
1042
+ if (AST.columns === '*') {
1043
+ setSortableColumns(selectedTable.columns.map(function (col) { return col.name; }));
1044
+ }
1045
+ else if (AST.columns.length) {
1046
+ setSortableColumns(AST.columns.map(function (elem) { return elem.as || elem.expr.name; }));
1047
+ }
965
1048
  }
966
- }
1049
+ _a.label = 2;
1050
+ case 2: return [3 /*break*/, 4];
1051
+ case 3:
1052
+ err_1 = _a.sent();
1053
+ console.error(err_1);
1054
+ return [3 /*break*/, 4];
1055
+ case 4: return [2 /*return*/];
967
1056
  }
968
- }
969
- catch (err) {
970
- console.error(err);
971
- }
972
- };
1057
+ });
1058
+ }); };
973
1059
  getSqlQueryFromAST();
974
1060
  }, [AST]);
975
- (0, react_1.useEffect)(() => {
1061
+ useEffect(function () {
976
1062
  if (sortableColumns.length) {
977
1063
  setSelectedSortByColumn(sortableColumns[0]);
978
1064
  }
@@ -980,30 +1066,31 @@ function ReportingTool({ schema, data, runQuery, SelectComponent, ButtonComponen
980
1066
  if (!schema || !schema.length) {
981
1067
  return null;
982
1068
  }
983
- return ((0, jsx_runtime_1.jsxs)("div", { style: { marginLeft: '25px' }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { maxWidth: 245 }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
1069
+ return (_jsxs("div", __assign({ style: { marginLeft: '25px' } }, { children: [_jsxs("div", __assign({ style: { maxWidth: 245 } }, { children: [_jsx("div", __assign({ style: {
984
1070
  fontSize: 14,
985
1071
  marginBottom: '6px',
986
1072
  fontWeight: '600',
987
1073
  color: theme.secondaryTextColor,
988
- fontFamily: theme?.fontFamily,
989
- }, children: "Table" }), (0, jsx_runtime_1.jsx)(SelectComponent, { label: "Table", value: selectedTable.displayName, onChange: e => {
990
- const table = schema.find(t => t.displayName === e);
1074
+ fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
1075
+ } }, { children: "Table" })), _jsx(SelectComponent, { label: "Table", value: selectedTable.displayName, onChange: function (e) {
1076
+ var table = schema.find(function (t) { return t.displayName === e; });
991
1077
  setSelectedTable(table);
992
- }, options: schema?.length
993
- ? schema.map(elem => {
1078
+ }, options: (schema === null || schema === void 0 ? void 0 : schema.length)
1079
+ ? schema.map(function (elem) {
994
1080
  return { label: elem.displayName, value: elem.displayName };
995
1081
  })
996
- : [] })] }), (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', marginTop: '12px' }, children: [(0, jsx_runtime_1.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 }), (0, jsx_runtime_1.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 }), (0, jsx_runtime_1.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 })] })] }));
1082
+ : [] })] })), _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 })] }))] })));
997
1083
  }
998
- function FilterTag({ id, label, removeFilter, index, setIsOpen, selectFilter, theme, tagStyle, }) {
999
- const handleRemoveFilter = () => {
1084
+ function FilterTag(_a) {
1085
+ 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;
1086
+ var handleRemoveFilter = function () {
1000
1087
  removeFilter(index);
1001
1088
  };
1002
- const handleSelectFilter = () => {
1089
+ var handleSelectFilter = function () {
1003
1090
  selectFilter(index);
1004
1091
  setIsOpen(true);
1005
1092
  };
1006
- return ((0, jsx_runtime_1.jsxs)("div", { id: id, onClick: handleSelectFilter, style: tagStyle || {
1093
+ return (_jsxs("div", __assign({ id: id, onClick: handleSelectFilter, style: tagStyle || {
1007
1094
  marginLeft: '12px',
1008
1095
  cursor: 'pointer',
1009
1096
  borderRadius: 8,
@@ -1015,17 +1102,17 @@ function FilterTag({ id, label, removeFilter, index, setIsOpen, selectFilter, th
1015
1102
  alignItems: 'center',
1016
1103
  fontSize: 13,
1017
1104
  fontWeight: 'medium',
1018
- color: theme?.primaryTextColor,
1019
- fontFamily: theme?.fontFamily,
1105
+ color: theme === null || theme === void 0 ? void 0 : theme.primaryTextColor,
1106
+ fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
1020
1107
  outline: 'none',
1021
- }, children: [(0, jsx_runtime_1.jsx)("div", { id: id, style: {
1108
+ } }, { children: [_jsx("div", __assign({ id: id, style: {
1022
1109
  textOverflow: 'ellipsis',
1023
1110
  whiteSpace: 'nowrap',
1024
1111
  overflow: 'hidden',
1025
1112
  maxWidth: '80px',
1026
- }, children: label }), (0, jsx_runtime_1.jsx)("div", {
1113
+ } }, { children: label })), _jsx("div", __assign({
1027
1114
  // onClick={handleRemoveFilter}
1028
- onClick: e => {
1115
+ onClick: function (e) {
1029
1116
  e.stopPropagation(); // Prevents the event from bubbling up to the parent
1030
1117
  handleRemoveFilter();
1031
1118
  }, style: {
@@ -1034,53 +1121,54 @@ function FilterTag({ id, label, removeFilter, index, setIsOpen, selectFilter, th
1034
1121
  alignItems: 'center',
1035
1122
  cursor: 'pointer',
1036
1123
  paddingLeft: '6px',
1037
- }, children: (0, jsx_runtime_1.jsx)(solid_1.XMarkIcon, { style: {
1124
+ } }, { children: _jsx(XMarkIcon, { style: {
1038
1125
  height: '20px',
1039
1126
  width: '20px',
1040
- color: tagStyle?.color || theme?.primaryTextColor,
1041
- }, "aria-hidden": "true" }) })] }));
1127
+ color: (tagStyle === null || tagStyle === void 0 ? void 0 : tagStyle.color) || (theme === null || theme === void 0 ? void 0 : theme.primaryTextColor),
1128
+ }, "aria-hidden": "true" }) }))] })));
1042
1129
  }
1043
- const SortByModal = ({ selectedSortByColumn, selectedSortByDirection, setSelectedSortByColumn, setSelectedSortByDirection, selectedTable, sortableColumns, removeSortBy, selectSortBy, updateSortBy, addSortBy, sortBys, SelectComponent, ButtonComponent, ModalComponent, tagStyle, ModalTriggerComponent, sortByIndexBeingEdited, theme, }) => {
1044
- const [isOpen, setIsOpen] = (0, react_1.useState)(false);
1045
- return ((0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'column', marginTop: 12 }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
1130
+ var SortByModal = function (_a) {
1131
+ 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;
1132
+ var _b = useState(false), isOpen = _b[0], setIsOpen = _b[1];
1133
+ return (_jsx("div", __assign({ style: { display: 'flex', flexDirection: 'column', marginTop: 12 } }, { children: _jsxs("div", __assign({ style: {
1046
1134
  position: 'relative',
1047
1135
  display: 'inline-block',
1048
1136
  textAlign: 'left',
1049
- }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
1137
+ } }, { children: [_jsxs("div", __assign({ style: {
1050
1138
  display: 'flex',
1051
1139
  flexDirection: 'row',
1052
1140
  alignItems: 'center',
1053
- }, children: [(0, jsx_runtime_1.jsx)(ModalTriggerComponent, { onClick: () => setIsOpen(isOpen => !isOpen), label: "Sort" }), (0, jsx_runtime_1.jsx)("div", { style: {
1141
+ } }, { children: [_jsx(ModalTriggerComponent, { onClick: function () { return setIsOpen(function (isOpen) { return !isOpen; }); }, label: "Sort" }), _jsx("div", __assign({ style: {
1054
1142
  overflowX: 'scroll',
1055
1143
  display: 'flex',
1056
1144
  flexDirection: 'row',
1057
1145
  alignItems: 'center',
1058
- }, children: sortBys.map((elem, index) => ((0, jsx_runtime_1.jsx)(FilterTag, { id: "sort-tag", label: elem.column, removeFilter: removeSortBy, selectFilter: selectSortBy, setIsOpen: setIsOpen, index: index, theme: theme, tagStyle: tagStyle }, 'sort' + index))) })] }), (0, jsx_runtime_1.jsx)(ModalComponent, { isOpen: isOpen, onClose: () => setIsOpen(false), title: "Add sort", children: (0, jsx_runtime_1.jsxs)("div", { style: {
1146
+ } }, { 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: {
1059
1147
  display: 'flex',
1060
1148
  flexDirection: 'column',
1061
- }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
1149
+ } }, { children: [_jsxs("div", __assign({ style: { display: 'flex', flexDirection: 'column' } }, { children: [_jsx("div", __assign({ style: {
1062
1150
  fontSize: '14px',
1063
1151
  marginBottom: '6px',
1064
1152
  fontWeight: '600',
1065
1153
  color: theme.secondaryTextColor,
1066
- fontFamily: theme?.fontFamily,
1067
- }, children: "Column" }), (0, jsx_runtime_1.jsx)(SelectComponent, { value: selectedSortByColumn, onChange: e => {
1154
+ fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
1155
+ } }, { children: "Column" })), _jsx(SelectComponent, { value: selectedSortByColumn, onChange: function (e) {
1068
1156
  setSelectedSortByColumn(e);
1069
- }, options: sortableColumns.map(elem => {
1157
+ }, options: sortableColumns.map(function (elem) {
1070
1158
  return { label: elem, value: elem };
1071
- }) })] }), (0, jsx_runtime_1.jsx)("div", { style: {
1159
+ }) })] })), _jsx("div", __assign({ style: {
1072
1160
  fontSize: '14px',
1073
1161
  marginBottom: '6px',
1074
1162
  fontWeight: '600',
1075
1163
  color: theme.secondaryTextColor,
1076
- fontFamily: theme?.fontFamily,
1164
+ fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
1077
1165
  marginTop: 20,
1078
- }, children: "Direction" }), (0, jsx_runtime_1.jsx)(SelectComponent, { value: selectedSortByDirection, onChange: e => {
1166
+ } }, { children: "Direction" })), _jsx(SelectComponent, { value: selectedSortByDirection, onChange: function (e) {
1079
1167
  setSelectedSortByDirection(e);
1080
1168
  }, options: [
1081
1169
  { label: 'ascending', value: 'ascending' },
1082
1170
  { label: 'descending', value: 'descending' },
1083
- ] }), (0, jsx_runtime_1.jsx)("div", { style: { height: 20 } }), (0, jsx_runtime_1.jsx)(ButtonComponent, { id: "custom-button", onClick: () => {
1171
+ ] }), _jsx("div", { style: { height: 20 } }), _jsx(ButtonComponent, { id: "custom-button", onClick: function () {
1084
1172
  if (sortByIndexBeingEdited > -1) {
1085
1173
  updateSortBy(sortByIndexBeingEdited);
1086
1174
  setIsOpen(false);
@@ -1090,76 +1178,80 @@ const SortByModal = ({ selectedSortByColumn, selectedSortByDirection, setSelecte
1090
1178
  addSortBy();
1091
1179
  setIsOpen(false);
1092
1180
  // close();
1093
- }, label: sortByIndexBeingEdited > -1 ? 'Edit sort' : 'Add sort' })] }) })] }) }));
1181
+ }, label: sortByIndexBeingEdited > -1 ? 'Edit sort' : 'Add sort' })] })) }))] })) })));
1094
1182
  };
1095
- const GroupByModal2 = ({ selectedGroupByColumn, addGroupBy, setSelectedGroupByColumn, selectedTable, groupByColumnType, groupByIndexBeingEdited, updateGroupBy, groupBys, removeGroupBy, selectGroupBy, SelectComponent, ButtonComponent, aggregations, setAggregationColumn, setAggregationType, addAggregation, dateBucket, setDateBucket, ModalComponent, theme, ModalTriggerComponent, TextInputComponent, tagStyle, }) => {
1096
- const [isOpen, setIsOpen] = (0, react_1.useState)(false);
1097
- return ((0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'column' }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
1183
+ var GroupByModal2 = function (_a) {
1184
+ 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, ModalComponent = _a.ModalComponent, theme = _a.theme, ModalTriggerComponent = _a.ModalTriggerComponent, TextInputComponent = _a.TextInputComponent, tagStyle = _a.tagStyle;
1185
+ var _b = useState(false), isOpen = _b[0], setIsOpen = _b[1];
1186
+ return (_jsx("div", __assign({ style: { display: 'flex', flexDirection: 'column' } }, { children: _jsxs("div", __assign({ style: {
1098
1187
  position: 'relative',
1099
1188
  display: 'inline-block',
1100
1189
  textAlign: 'left',
1101
- }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
1190
+ } }, { children: [_jsxs("div", __assign({ style: {
1102
1191
  display: 'flex',
1103
1192
  flexDirection: 'row',
1104
1193
  alignItems: 'center',
1105
- }, children: [(0, jsx_runtime_1.jsx)(ModalTriggerComponent, { onClick: () => setIsOpen(isOpen => !isOpen), label: "Group by" }), (0, jsx_runtime_1.jsx)("div", { style: {
1194
+ } }, { children: [_jsx(ModalTriggerComponent, { onClick: function () { return setIsOpen(function (isOpen) { return !isOpen; }); }, label: "Group by" }), _jsx("div", __assign({ style: {
1106
1195
  overflowX: 'scroll',
1107
1196
  display: 'flex',
1108
1197
  flexDirection: 'row',
1109
1198
  alignItems: 'center',
1110
- }, children: groupBys.map((elem, index) => ((0, jsx_runtime_1.jsx)(FilterTag, { id: "group-tag", label: elem.tag, removeFilter: removeGroupBy, selectFilter: selectGroupBy, setIsOpen: setIsOpen, index: index, theme: theme, tagStyle: tagStyle }, 'groupby' + index))) })] }), (0, jsx_runtime_1.jsx)(ModalComponent, { isOpen: isOpen, onClose: () => setIsOpen(false), title: "Add group by", children: (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
1199
+ } }, { 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: {
1111
1200
  fontSize: '14px',
1112
1201
  marginBottom: '6px',
1113
1202
  fontWeight: '600',
1114
- fontFamily: theme?.fontFamily,
1203
+ fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
1115
1204
  color: theme.secondaryTextColor,
1116
- }, children: "Column" }), (0, jsx_runtime_1.jsx)(SelectComponent, { label: "Column", value: selectedGroupByColumn.name, onChange: e => {
1117
- const column = selectedTable.columns.find(c => c.name === e);
1205
+ } }, { children: "Column" })), _jsx(SelectComponent, { label: "Column", value: selectedGroupByColumn.name, onChange: function (e) {
1206
+ var column = selectedTable.columns.find(function (c) { return c.name === e; });
1118
1207
  setSelectedGroupByColumn(column);
1119
- }, options: selectedTable.columns.map(elem => {
1208
+ }, options: selectedTable.columns.map(function (elem) {
1120
1209
  return { label: elem.name, value: elem.name };
1121
- }) })] }), groupByColumnType === 'date' && ((0, jsx_runtime_1.jsxs)("div", { style: {
1210
+ }) })] })), groupByColumnType === 'date' && (_jsxs("div", __assign({ style: {
1122
1211
  display: 'flex',
1123
1212
  flexDirection: 'column',
1124
1213
  // marginLeft: 12,
1125
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
1214
+ } }, { children: [_jsx("div", __assign({ style: {
1126
1215
  fontSize: '14px',
1127
1216
  marginBottom: '6px',
1128
1217
  fontWeight: '600',
1129
1218
  color: theme.secondaryTextColor,
1130
- fontFamily: theme?.fontFamily,
1219
+ fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
1131
1220
  marginTop: 20,
1132
- }, children: "Bucket" }), (0, jsx_runtime_1.jsx)(SelectComponent, { label: "Bucket", value: dateBucket, onChange: e => {
1221
+ } }, { children: "Bucket" })), _jsx(SelectComponent, { label: "Bucket", value: dateBucket, onChange: function (e) {
1133
1222
  setDateBucket(e);
1134
1223
  }, options: [
1135
1224
  { label: 'month', value: 'month' },
1136
1225
  { label: 'day', value: 'day' },
1137
1226
  { label: 'week', value: 'week' },
1138
- ] })] })), (0, jsx_runtime_1.jsx)("div", { style: {
1227
+ ] })] }))), _jsx("div", __assign({ style: {
1139
1228
  fontSize: 14,
1140
1229
  marginBottom: '6px',
1141
1230
  fontWeight: '600',
1142
1231
  marginTop: 20,
1143
1232
  color: theme.secondaryTextColor,
1144
- fontFamily: theme?.fontFamily,
1145
- }, children: "Aggregations" }), aggregations.map((aggregation, index) => (
1146
- // setAggregationType
1147
- (0, jsx_runtime_1.jsxs)("div", { style: {
1148
- display: 'flex',
1149
- flexDirection: 'row',
1150
- alignItems: 'center',
1151
- }, children: [(0, jsx_runtime_1.jsx)(SelectComponent, { value: aggregation.column?.name, onChange: e => {
1152
- const column = selectedTable.columns.find(c => c.name === e);
1153
- setAggregationColumn(column, index);
1154
- }, options: selectedTable.columns.map(elem => {
1155
- return { label: elem.name, value: elem.name };
1156
- }) }), (0, jsx_runtime_1.jsx)("div", { style: { width: 16 } }), (0, jsx_runtime_1.jsx)(SelectComponent, { value: aggregation.aggregationType, onChange: e => {
1157
- setAggregationType(e, index);
1158
- }, options: [
1159
- { label: 'sum', value: 'sum' },
1160
- { label: 'average', value: 'average' },
1161
- { label: 'count', value: 'count' },
1162
- ] })] }, 'agg' + index))), (0, jsx_runtime_1.jsx)("div", { style: { height: 20 } }), (0, jsx_runtime_1.jsx)(ButtonComponent, { id: "custom-button", onClick: () => {
1233
+ fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
1234
+ } }, { children: "Aggregations" })), aggregations.map(function (aggregation, index) {
1235
+ var _a;
1236
+ return (
1237
+ // setAggregationType
1238
+ _jsxs("div", __assign({ style: {
1239
+ display: 'flex',
1240
+ flexDirection: 'row',
1241
+ alignItems: 'center',
1242
+ } }, { children: [_jsx(SelectComponent, { value: (_a = aggregation.column) === null || _a === void 0 ? void 0 : _a.name, onChange: function (e) {
1243
+ var column = selectedTable.columns.find(function (c) { return c.name === e; });
1244
+ setAggregationColumn(column, index);
1245
+ }, options: selectedTable.columns.map(function (elem) {
1246
+ return { label: elem.name, value: elem.name };
1247
+ }) }), _jsx("div", { style: { width: 16 } }), _jsx(SelectComponent, { value: aggregation.aggregationType, onChange: function (e) {
1248
+ setAggregationType(e, index);
1249
+ }, options: [
1250
+ { label: 'sum', value: 'sum' },
1251
+ { label: 'average', value: 'average' },
1252
+ { label: 'count', value: 'count' },
1253
+ ] })] }), 'agg' + index));
1254
+ }), _jsx("div", { style: { height: 20 } }), _jsx(ButtonComponent, { id: "custom-button", onClick: function () {
1163
1255
  if (groupByIndexBeingEdited > -1) {
1164
1256
  updateGroupBy(groupByIndexBeingEdited);
1165
1257
  setIsOpen(false);
@@ -1169,116 +1261,119 @@ const GroupByModal2 = ({ selectedGroupByColumn, addGroupBy, setSelectedGroupByCo
1169
1261
  addGroupBy();
1170
1262
  setIsOpen(false);
1171
1263
  // close();
1172
- }, label: groupByIndexBeingEdited > -1 ? 'Edit group by' : 'Add group by' })] }) })] }) }));
1264
+ }, label: groupByIndexBeingEdited > -1 ? 'Edit group by' : 'Add group by' })] })) }))] })) })));
1173
1265
  };
1174
- const AddFilterModal2 = ({ filters, selectedColumn, numberStart, numberEnd, dateStart, setDateStart, columnStats, stringFilterValues, setStringFilterValues, addFilter, setSelectedColumn, setNumberStart, setNumberEnd, selectedTable, columnType, setDateEnd, dateEnd, removeFilter, selectFilter, indexBeingEdited, updateFilter, SelectComponent, ButtonComponent, ModalComponent, theme, ModalTriggerComponent, TextInputComponent, tagStyle, }) => {
1175
- const [isOpen, setIsOpen] = (0, react_1.useState)(false);
1176
- return ((0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column' }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
1266
+ var AddFilterModal2 = function (_a) {
1267
+ 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;
1268
+ var _b = useState(false), isOpen = _b[0], setIsOpen = _b[1];
1269
+ return (_jsxs("div", __assign({ style: { display: 'flex', flexDirection: 'column' } }, { children: [_jsxs("div", __assign({ style: {
1177
1270
  position: 'relative',
1178
1271
  display: 'inline-block',
1179
1272
  textAlign: 'left',
1180
- }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
1273
+ } }, { children: [_jsxs("div", __assign({ style: {
1181
1274
  display: 'flex',
1182
1275
  flexDirection: 'row',
1183
1276
  alignItems: 'center',
1184
- }, children: [(0, jsx_runtime_1.jsx)(ModalTriggerComponent, { onClick: () => setIsOpen(isOpen => !isOpen), label: "Filter" }), (0, jsx_runtime_1.jsx)("div", { style: {
1277
+ } }, { children: [_jsx(ModalTriggerComponent, { onClick: function () { return setIsOpen(function (isOpen) { return !isOpen; }); }, label: "Filter" }), _jsx("div", __assign({ style: {
1185
1278
  overflowX: 'scroll',
1186
1279
  display: 'flex',
1187
1280
  flexDirection: 'row',
1188
1281
  alignItems: 'center',
1189
- }, children: filters.map((elem, index) => ((0, jsx_runtime_1.jsx)(FilterTag, { id: "filter-tag", label: elem.tag, removeFilter: removeFilter, selectFilter: selectFilter, index: index, theme: theme, setIsOpen: setIsOpen, tagStyle: tagStyle }, 'filter' + index))) })] }), (0, jsx_runtime_1.jsx)(ModalComponent, { isOpen: isOpen, onClose: () => setIsOpen(false), title: "Add filter", children: (0, jsx_runtime_1.jsxs)("div", { style: {
1282
+ } }, { 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: {
1190
1283
  backgroundColor: 'rgb(255, 255, 255)',
1191
1284
  display: 'flex',
1192
1285
  flexDirection: 'column',
1193
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
1286
+ } }, { children: [_jsx("div", __assign({ style: {
1194
1287
  fontSize: 14,
1195
1288
  marginBottom: '6px',
1196
1289
  fontWeight: '600',
1197
1290
  color: theme.secondaryTextColor,
1198
- fontFamily: theme?.fontFamily,
1199
- }, children: "Column" }), (0, jsx_runtime_1.jsx)(SelectComponent, { id: "custom-select", value: selectedColumn.name, onChange: e => {
1200
- const column = selectedTable.columns.find(c => c.name === e);
1291
+ fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
1292
+ } }, { children: "Column" })), _jsx(SelectComponent, { id: "custom-select", value: selectedColumn.name, onChange: function (e) {
1293
+ var column = selectedTable.columns.find(function (c) { return c.name === e; });
1201
1294
  setSelectedColumn(column);
1202
- }, options: selectedTable.columns.map(elem => {
1295
+ }, options: selectedTable.columns.map(function (elem) {
1203
1296
  return { label: elem.name, value: elem.name };
1204
- }) }), columnType === 'number' && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("div", { style: {
1297
+ }) }), columnType === 'number' && (_jsx("div", { children: _jsxs("div", __assign({ style: {
1205
1298
  display: 'flex',
1206
1299
  flexDirection: 'row',
1207
1300
  alignItems: 'center',
1208
1301
  justifyContent: 'space-between',
1209
- }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
1302
+ } }, { children: [_jsxs("div", __assign({ style: {
1210
1303
  display: 'flex',
1211
1304
  flexDirection: 'column',
1212
1305
  marginTop: '20px',
1213
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
1306
+ } }, { children: [_jsx("div", __assign({ style: {
1214
1307
  fontSize: '14px',
1215
1308
  fontWeight: '600',
1216
1309
  color: theme.secondaryTextColor,
1217
- fontFamily: theme?.fontFamily,
1310
+ fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
1218
1311
  marginBottom: 6,
1219
- }, children: "Minimum" }), (0, jsx_runtime_1.jsx)(TextInputComponent, { id: "min-input", value: numberStart, onChange: e => setNumberStart(e.target.value) })] }), (0, jsx_runtime_1.jsx)("div", { style: { width: 16 } }), (0, jsx_runtime_1.jsxs)("div", { style: {
1312
+ } }, { 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: {
1220
1313
  display: 'flex',
1221
1314
  flexDirection: 'column',
1222
1315
  marginTop: '20px',
1223
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
1316
+ } }, { children: [_jsx("div", __assign({ style: {
1224
1317
  fontSize: '14px',
1225
1318
  fontWeight: '600',
1226
1319
  color: theme.secondaryTextColor,
1227
- fontFamily: theme?.fontFamily,
1320
+ fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
1228
1321
  marginBottom: 6,
1229
- }, children: "Maximum" }), (0, jsx_runtime_1.jsx)(TextInputComponent, { id: "max-input", value: numberEnd, onChange: e => setNumberEnd(e.target.value) })] })] }) })), columnType === 'date' && ((0, jsx_runtime_1.jsxs)("div", { style: {
1322
+ } }, { children: "Maximum" })), _jsx(TextInputComponent, { id: "max-input", value: numberEnd, onChange: function (e) { return setNumberEnd(e.target.value); } })] }))] })) })), columnType === 'date' && (_jsxs("div", __assign({ style: {
1230
1323
  display: 'flex',
1231
1324
  flexDirection: 'row',
1232
1325
  alignItems: 'center',
1233
1326
  justifyContent: 'space-between',
1234
- }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
1327
+ } }, { children: [_jsxs("div", __assign({ style: {
1235
1328
  display: 'flex',
1236
1329
  flexDirection: 'column',
1237
1330
  marginTop: '20px',
1238
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
1331
+ } }, { children: [_jsx("div", __assign({ style: {
1239
1332
  fontSize: 14,
1240
1333
  fontWeight: '600',
1241
1334
  color: 'rgba(56, 65, 81, 0.7)',
1242
- fontFamily: theme?.fontFamily,
1243
- }, children: "Start date" }), (0, jsx_runtime_1.jsx)("input", { type: "date", value: dateStart, onChange: e => setDateStart(e.target.value), placeholder: "Start date" })] }), (0, jsx_runtime_1.jsxs)("div", { style: {
1335
+ fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
1336
+ } }, { children: "Start date" })), _jsx("input", { type: "date", value: dateStart, onChange: function (e) { return setDateStart(e.target.value); }, placeholder: "Start date" })] })), _jsxs("div", __assign({ style: {
1244
1337
  display: 'flex',
1245
1338
  flexDirection: 'column',
1246
1339
  marginTop: '20px',
1247
- }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
1340
+ } }, { children: [_jsx("div", __assign({ style: {
1248
1341
  fontSize: 14,
1249
1342
  fontWeight: '600',
1250
1343
  color: 'rgba(56, 65, 81, 0.7)',
1251
- fontFamily: theme?.fontFamily,
1252
- }, children: "End date" }), (0, jsx_runtime_1.jsx)("input", { type: "date", value: dateEnd, onChange: e => setDateEnd(e.target.value), placeholder: "End date" })] })] })), columnType === 'string' &&
1344
+ fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
1345
+ } }, { children: "End date" })), _jsx("input", { type: "date", value: dateEnd, onChange: function (e) { return setDateEnd(e.target.value); }, placeholder: "End date" })] }))] }))), columnType === 'string' &&
1253
1346
  columnStats &&
1254
- columnStats.length > 0 && ((0, jsx_runtime_1.jsx)("div", { style: {
1347
+ columnStats.length > 0 && (_jsx("div", __assign({ style: {
1255
1348
  flex: 'flex',
1256
1349
  flexDirection: 'column',
1257
1350
  marginTop: '14px',
1258
1351
  overflow: 'hidden',
1259
- }, children: columnStats.map(value => ((0, jsx_runtime_1.jsx)("div", { style: {
1352
+ } }, { children: columnStats.map(function (value) { return (_jsx("div", __assign({ style: {
1260
1353
  display: 'flex',
1261
1354
  flexDirection: 'row',
1262
1355
  alignItems: 'center',
1263
- }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
1356
+ } }, { children: _jsxs("div", __assign({ style: {
1264
1357
  display: 'flex',
1265
1358
  flexDirection: 'row',
1266
1359
  alignItems: 'center',
1267
1360
  paddingTop: 6,
1268
1361
  paddingBottom: 6,
1269
- }, children: [(0, jsx_runtime_1.jsx)(DivCheckbox, { theme: theme, checked: stringFilterValues.includes(value), onChange: () => {
1270
- setStringFilterValues(prev => prev.includes(value)
1271
- ? prev.filter(v => v !== value)
1272
- : [...prev, value]);
1273
- } }), (0, jsx_runtime_1.jsx)("div", { style: {
1362
+ } }, { children: [_jsx(DivCheckbox, { theme: theme, checked: stringFilterValues.includes(value), onChange: function () {
1363
+ setStringFilterValues(function (prev) {
1364
+ return prev.includes(value)
1365
+ ? prev.filter(function (v) { return v !== value; })
1366
+ : __spreadArray(__spreadArray([], prev, true), [value], false);
1367
+ });
1368
+ } }), _jsx("div", __assign({ style: {
1274
1369
  marginLeft: 6,
1275
1370
  display: 'block',
1276
1371
  overflow: 'hidden',
1277
1372
  textOverflow: 'ellipsis',
1278
1373
  whiteSpace: 'nowrap',
1279
- color: theme?.primaryTextColor,
1280
- fontFamily: theme?.fontFamily,
1281
- }, children: value })] }, value) }, value))) })), (0, jsx_runtime_1.jsx)("div", { style: { height: 20 } }), (0, jsx_runtime_1.jsx)(ButtonComponent, { id: "custom-button", onClick: () => {
1374
+ color: theme === null || theme === void 0 ? void 0 : theme.primaryTextColor,
1375
+ fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
1376
+ } }, { children: value }))] }), value) }), value)); }) }))), _jsx("div", { style: { height: 20 } }), _jsx(ButtonComponent, { id: "custom-button", onClick: function () {
1282
1377
  if (indexBeingEdited > -1) {
1283
1378
  updateFilter(indexBeingEdited);
1284
1379
  setIsOpen(false);
@@ -1286,15 +1381,16 @@ const AddFilterModal2 = ({ filters, selectedColumn, numberStart, numberEnd, date
1286
1381
  }
1287
1382
  addFilter();
1288
1383
  setIsOpen(false);
1289
- }, label: indexBeingEdited > -1 ? 'Edit filter' : 'Add filter' })] }) })] }), (0, jsx_runtime_1.jsx)("div", { style: { height: '12px' } })] }));
1384
+ }, label: indexBeingEdited > -1 ? 'Edit filter' : 'Add filter' })] })) }))] })), _jsx("div", { style: { height: '12px' } })] })));
1290
1385
  };
1291
- const DivCheckbox = ({ onChange, checked, theme }) => {
1292
- const toggleCheckbox = () => {
1386
+ var DivCheckbox = function (_a) {
1387
+ var onChange = _a.onChange, checked = _a.checked, theme = _a.theme;
1388
+ var toggleCheckbox = function () {
1293
1389
  if (onChange) {
1294
1390
  onChange(!checked);
1295
1391
  }
1296
1392
  };
1297
- const style = {
1393
+ var style = {
1298
1394
  // display: 'inline-block',
1299
1395
  width: '18px',
1300
1396
  height: '18px',
@@ -1304,14 +1400,14 @@ const DivCheckbox = ({ onChange, checked, theme }) => {
1304
1400
  position: 'relative',
1305
1401
  cursor: 'pointer',
1306
1402
  boxShadow: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
1307
- fontFamily: theme?.fontFamily,
1403
+ fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
1308
1404
  display: 'flex',
1309
1405
  flexDirection: 'column',
1310
1406
  alignItems: 'center',
1311
1407
  justifyContent: 'center',
1312
1408
  };
1313
- return ((0, jsx_runtime_1.jsx)("div", { style: style, onClick: toggleCheckbox, "aria-checked": checked,
1409
+ return (_jsx("div", __assign({ style: style, onClick: toggleCheckbox, "aria-checked": checked,
1314
1410
  // className="shadow-sm"
1315
- role: "checkbox", children: checked && ((0, jsx_runtime_1.jsx)(solid_1.CheckIcon, { style: { color: theme?.backgroundColor, height: 16, width: 16 }, className: "text-white", "aria-hidden": "true" })) }));
1411
+ 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" })) })));
1316
1412
  };
1317
1413
  //# sourceMappingURL=ReportBuilder.js.map