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