@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
package/lib/SQLEditor.js CHANGED
@@ -1,63 +1,21 @@
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
- });
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
20
4
  };
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
- }
47
- };
48
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.convertPostgresColumn = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
49
8
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
50
9
  // @ts-ignore
51
- import { useState, useContext, useEffect } from 'react';
52
- import MonacoEditor from '@monaco-editor/react';
10
+ const react_1 = require("react");
11
+ const react_2 = __importDefault(require("@monaco-editor/react"));
53
12
  // import './nightOwlLight.css';
54
- import axios from 'axios';
55
- import { ClientContext, SchemaContext, ThemeContext } from './Context';
56
- import { ChevronDownIcon, ChevronRightIcon, } from '@heroicons/react/20/solid';
57
- import { SpecialTable } from './Table';
58
- import { TailSpin } from 'react-loader-spinner';
59
- export function convertPostgresColumn(column) {
60
- var format;
13
+ const axios_1 = __importDefault(require("axios"));
14
+ const Context_1 = require("./Context");
15
+ const solid_1 = require("@heroicons/react/20/solid");
16
+ const Table_1 = require("./Table");
17
+ function convertPostgresColumn(column) {
18
+ let format;
61
19
  switch (column.dataTypeID) {
62
20
  case 20: // int8
63
21
  case 21: // int2
@@ -85,6 +43,7 @@ export function convertPostgresColumn(column) {
85
43
  format: format,
86
44
  };
87
45
  }
46
+ exports.convertPostgresColumn = convertPostgresColumn;
88
47
  function defineEditorTheme(monaco, theme) {
89
48
  monaco.editor.defineTheme('onedark', {
90
49
  base: theme.darkMode ? 'vs-dark' : 'vs',
@@ -110,30 +69,26 @@ function setEditorTheme(editor, monaco) {
110
69
  console.log('ERROR: ', e);
111
70
  }
112
71
  }
113
- var QuillButton = function (_a) {
114
- var onClick = _a.onClick, label = _a.label, theme = _a.theme, secondary = _a.secondary;
115
- return (_jsx("button", __assign({ style: {
116
- borderRadius: '6px',
117
- backgroundColor: secondary
118
- ? (theme === null || theme === void 0 ? void 0 : theme.secondaryButtonColor) || '#FFFFFF'
119
- : theme === null || theme === void 0 ? void 0 : theme.primaryButtonColor,
120
- opacity: 1,
121
- paddingLeft: '16px',
122
- paddingRight: '16px',
123
- paddingTop: '10px',
124
- paddingBottom: '10px',
125
- fontSize: '14px',
126
- fontWeight: 600,
127
- color: secondary ? theme === null || theme === void 0 ? void 0 : theme.primaryTextColor : '#FFFFFF',
128
- cursor: 'pointer',
129
- outline: 'none',
130
- border: 'none',
131
- fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
132
- }, onClick: onClick }, { children: label })));
133
- };
134
- var QuillTextInput = function (_a) {
135
- var onChange = _a.onChange, value = _a.value, id = _a.id, placeholder = _a.placeholder, theme = _a.theme;
136
- return (_jsx("input", { style: {
72
+ const QuillButton = ({ onClick, label, theme, secondary, }) => ((0, jsx_runtime_1.jsx)("button", { style: {
73
+ borderRadius: '6px',
74
+ backgroundColor: secondary
75
+ ? theme?.secondaryButtonColor || '#FFFFFF'
76
+ : theme?.primaryButtonColor,
77
+ opacity: 1,
78
+ paddingLeft: '16px',
79
+ paddingRight: '16px',
80
+ paddingTop: '10px',
81
+ paddingBottom: '10px',
82
+ fontSize: '14px',
83
+ fontWeight: 600,
84
+ color: secondary ? theme?.primaryTextColor : '#FFFFFF',
85
+ cursor: 'pointer',
86
+ outline: 'none',
87
+ border: 'none',
88
+ fontFamily: theme?.fontFamily,
89
+ }, onClick: onClick, children: label }));
90
+ const QuillTextInput = ({ onChange, value, id, placeholder, theme, }) => {
91
+ return ((0, jsx_runtime_1.jsx)("input", { style: {
137
92
  display: 'flex',
138
93
  flexDirection: 'row',
139
94
  alignItems: 'center',
@@ -143,173 +98,134 @@ var QuillTextInput = function (_a) {
143
98
  height: 36,
144
99
  boxShadow: 'rgba(0, 0, 0, 0.1) 0px 1px 5px 0px',
145
100
  width: '445px',
146
- backgroundColor: (theme === null || theme === void 0 ? void 0 : theme.backgroundColor) || 'white',
147
- color: theme === null || theme === void 0 ? void 0 : theme.primaryTextColor,
101
+ backgroundColor: theme?.backgroundColor || 'white',
102
+ color: theme?.primaryTextColor,
148
103
  borderWidth: '1px',
149
- borderColor: (theme === null || theme === void 0 ? void 0 : theme.borderColor) || '#E7E7E7',
104
+ borderColor: theme?.borderColor || '#E7E7E7',
150
105
  borderStyle: 'solid',
151
106
  borderRadius: '6px',
152
107
  }, id: id, onChange: onChange, value: value, placeholder: placeholder }));
153
108
  };
154
- export default function QueryEditor(_a) {
155
- var _this = this;
156
- var _b = _a.containerStyle, containerStyle = _b === void 0 ? { height: '100vh' } : _b, ButtonComponent = _a.ButtonComponent, SecondaryButtonComponent = _a.SecondaryButtonComponent, TextInputComponent = _a.TextInputComponent, TableComponent = _a.TableComponent, AddToDashboardButton = _a.AddToDashboardButton, LoadingComponent = _a.LoadingComponent;
157
- var _c = useState(''), sqlPrompt = _c[0], setSqlPrompt = _c[1];
158
- var _d = useState(false), isOpen = _d[0], setIsOpen = _d[1];
159
- var client = useContext(ClientContext)[0];
160
- var theme = useContext(ThemeContext)[0];
161
- var _e = useState(''), query = _e[0], setQuery = _e[1];
162
- var _f = useState([]), rows = _f[0], setRows = _f[1];
163
- var _g = useState([]), columns = _g[0], setColumns = _g[1];
164
- var _h = useState([]), fields = _h[0], setFields = _h[1];
165
- var _j = useContext(SchemaContext), schema = _j[0], setSchema = _j[1];
166
- var _k = useState(''), errorMessage = _k[0], setErrorMessage = _k[1];
167
- var _l = useState(false), sqlResponseLoading = _l[0], setSqlResponseLoading = _l[1];
168
- var _m = useState(false), sqlQueryLoading = _m[0], setSqlQueryLoading = _m[1];
169
- var _o = useState(false), schemaLoading = _o[0], setSchemaLoading = _o[1];
170
- useEffect(function () {
171
- var isSubscribed = true;
172
- function getSchema() {
173
- return __awaiter(this, void 0, void 0, function () {
174
- var publicKey, environment, response3;
175
- return __generator(this, function (_a) {
176
- switch (_a.label) {
177
- case 0:
178
- publicKey = client.publicKey, environment = client.environment;
179
- setSchemaLoading(true);
180
- return [4 /*yield*/, axios.get("https://quill-344421.uc.r.appspot.com/schema2/".concat(publicKey, "/"), {
181
- headers: {
182
- Authorization: "Bearer ",
183
- environment: environment || undefined,
184
- },
185
- })];
186
- case 1:
187
- response3 = _a.sent();
188
- if (isSubscribed) {
189
- setSchema(response3.data.tables);
190
- setSchemaLoading(false);
191
- }
192
- return [2 /*return*/];
193
- }
194
- });
109
+ function QueryEditor({ containerStyle = { height: '100vh' }, ButtonComponent, SecondaryButtonComponent, TextInputComponent, TableComponent, AddToDashboardButton, LoadingComponent, }) {
110
+ const [sqlPrompt, setSqlPrompt] = (0, react_1.useState)('');
111
+ const [isOpen, setIsOpen] = (0, react_1.useState)(false);
112
+ const [client] = (0, react_1.useContext)(Context_1.ClientContext);
113
+ const [theme] = (0, react_1.useContext)(Context_1.ThemeContext);
114
+ const [query, setQuery] = (0, react_1.useState)('');
115
+ const [rows, setRows] = (0, react_1.useState)([]);
116
+ const [columns, setColumns] = (0, react_1.useState)([]);
117
+ const [fields, setFields] = (0, react_1.useState)([]);
118
+ const [schema, setSchema] = (0, react_1.useContext)(Context_1.SchemaContext);
119
+ const [errorMessage, setErrorMessage] = (0, react_1.useState)('');
120
+ const [sqlResponseLoading, setSqlResponseLoading] = (0, react_1.useState)(false);
121
+ const [sqlQueryLoading, setSqlQueryLoading] = (0, react_1.useState)(false);
122
+ const [schemaLoading, setSchemaLoading] = (0, react_1.useState)(false);
123
+ (0, react_1.useEffect)(() => {
124
+ let isSubscribed = true;
125
+ async function getSchema() {
126
+ const { publicKey, environment } = client;
127
+ setSchemaLoading(true);
128
+ const response3 = await axios_1.default.get(`https://quill-344421.uc.r.appspot.com/schema2/${publicKey}/`, {
129
+ headers: {
130
+ Authorization: `Bearer `,
131
+ environment: environment || undefined,
132
+ },
195
133
  });
134
+ if (isSubscribed) {
135
+ setSchema(response3.data.tables);
136
+ setSchemaLoading(false);
137
+ }
196
138
  }
197
139
  if (isSubscribed) {
198
140
  getSchema();
199
141
  }
200
- return function () {
142
+ return () => {
201
143
  isSubscribed = false;
202
144
  };
203
145
  }, []);
204
- var handleRunSqlPrompt = function () { return __awaiter(_this, void 0, void 0, function () {
205
- var publicKey, environment, response;
206
- return __generator(this, function (_a) {
207
- switch (_a.label) {
208
- case 0:
209
- publicKey = client.publicKey, environment = client.environment;
210
- setSqlResponseLoading(true);
211
- return [4 /*yield*/, axios.post("https://quill-344421.uc.r.appspot.com/quillai", {
212
- initialQuestion: sqlPrompt,
213
- publicKey: publicKey,
214
- }, {
215
- headers: {
216
- Authorization: "Bearer ",
217
- environment: environment || undefined,
218
- },
219
- })];
220
- case 1:
221
- response = _a.sent();
222
- setQuery(response.data.message);
223
- setSqlResponseLoading(false);
224
- return [2 /*return*/];
225
- }
146
+ const handleRunSqlPrompt = async () => {
147
+ const { publicKey, environment } = client;
148
+ setSqlResponseLoading(true);
149
+ const response = await axios_1.default.post(`https://quill-344421.uc.r.appspot.com/quillai`, {
150
+ initialQuestion: sqlPrompt,
151
+ publicKey: publicKey,
152
+ }, {
153
+ headers: {
154
+ Authorization: `Bearer `,
155
+ environment: environment || undefined,
156
+ },
226
157
  });
227
- }); };
228
- var handleRunQuery = function () { return __awaiter(_this, void 0, void 0, function () {
229
- var publicKey, customerId, environment, queryEndpoint, queryHeaders, withCredentials, response, e_1;
230
- return __generator(this, function (_a) {
231
- switch (_a.label) {
232
- case 0:
233
- publicKey = client.publicKey, customerId = client.customerId, environment = client.environment, queryEndpoint = client.queryEndpoint, queryHeaders = client.queryHeaders, withCredentials = client.withCredentials;
234
- _a.label = 1;
235
- case 1:
236
- _a.trys.push([1, 6, , 7]);
237
- response = void 0;
238
- setSqlQueryLoading(true);
239
- if (!queryEndpoint) return [3 /*break*/, 3];
240
- return [4 /*yield*/, axios.post(queryEndpoint, { metadata: { query: query, task: 'query' } }, { headers: queryHeaders, withCredentials: withCredentials })];
241
- case 2:
242
- response = _a.sent();
243
- return [3 /*break*/, 5];
244
- case 3: return [4 /*yield*/, axios.post("https://quill-344421.uc.r.appspot.com/dashquery", {
245
- query: query,
246
- }, {
247
- params: {
248
- orgId: customerId,
249
- publicKey: publicKey,
250
- },
251
- headers: {
252
- Authorization: "Bearer ",
253
- environment: environment || undefined,
254
- },
255
- })];
256
- case 4:
257
- response = _a.sent();
258
- _a.label = 5;
259
- case 5:
260
- if (response && response.data && response.data.errorMessage) {
261
- setSqlQueryLoading(false);
262
- setErrorMessage('Failed to run SQL query: ' + response.data.errorMessage);
263
- setRows([]);
264
- setColumns([]);
265
- setFields([]);
266
- return [2 /*return*/];
267
- }
268
- setSqlQueryLoading(false);
269
- setErrorMessage('');
270
- setRows(response.data.rows && response.data.rows.length
271
- ? response.data.rows
272
- : []);
273
- setColumns(response.data.fields.map(function (elem) { return convertPostgresColumn(elem); }));
274
- setFields(response.data.fields);
275
- return [3 /*break*/, 7];
276
- case 6:
277
- e_1 = _a.sent();
278
- console.log('ERROR: ', e_1);
279
- return [2 /*return*/];
280
- case 7: return [2 /*return*/];
158
+ setQuery(response.data.message);
159
+ setSqlResponseLoading(false);
160
+ };
161
+ const handleRunQuery = async () => {
162
+ const { publicKey, customerId, environment, queryEndpoint, queryHeaders } = client;
163
+ try {
164
+ let response;
165
+ setSqlQueryLoading(true);
166
+ if (queryEndpoint) {
167
+ response = await axios_1.default.post(queryEndpoint, { metadata: { query, task: 'query' } }, { headers: queryHeaders });
281
168
  }
282
- });
283
- }); };
284
- var handleAddToDashboard = function () {
169
+ else {
170
+ response = await axios_1.default.post(`https://quill-344421.uc.r.appspot.com/dashquery`, {
171
+ query,
172
+ }, {
173
+ params: {
174
+ orgId: customerId,
175
+ publicKey: publicKey,
176
+ },
177
+ headers: {
178
+ Authorization: `Bearer `,
179
+ environment: environment || undefined,
180
+ },
181
+ });
182
+ }
183
+ if (response && response.data && response.data.errorMessage) {
184
+ setSqlQueryLoading(false);
185
+ setErrorMessage('Failed to run SQL query: ' + response.data.errorMessage);
186
+ setRows([]);
187
+ setColumns([]);
188
+ setFields([]);
189
+ return;
190
+ }
191
+ setSqlQueryLoading(false);
192
+ setErrorMessage('');
193
+ setRows(response.data.rows && response.data.rows.length
194
+ ? response.data.rows
195
+ : []);
196
+ setColumns(response.data.fields.map(elem => convertPostgresColumn(elem)));
197
+ setFields(response.data.fields);
198
+ }
199
+ catch (e) {
200
+ console.log('ERROR: ', e);
201
+ return;
202
+ }
203
+ };
204
+ const handleAddToDashboard = () => {
285
205
  setIsOpen(true);
286
206
  };
287
207
  /* all your useState and useContext calls and your useEffect hooks */
288
- var downloadCSV = function () {
208
+ const downloadCSV = () => {
289
209
  // report.rows
290
210
  if (!rows.length) {
291
211
  return;
292
212
  }
293
- var json = rows; // JSON data passed as a prop
294
- var fields = Object.keys(json[0]); // Assumes all objects have same keys
295
- var csvRows = [];
213
+ const json = rows; // JSON data passed as a prop
214
+ const fields = Object.keys(json[0]); // Assumes all objects have same keys
215
+ const csvRows = [];
296
216
  // Header row
297
217
  csvRows.push(fields.join(','));
298
- var _loop_1 = function (row) {
299
- var values = fields.map(function (field) { return JSON.stringify(row[field] || ''); });
300
- csvRows.push(values.join(','));
301
- };
302
218
  // Data rows
303
- for (var _i = 0, json_1 = json; _i < json_1.length; _i++) {
304
- var row = json_1[_i];
305
- _loop_1(row);
219
+ for (const row of json) {
220
+ const values = fields.map(field => JSON.stringify(row[field] || ''));
221
+ csvRows.push(values.join(','));
306
222
  }
307
223
  // Create CSV string and create a 'blob' with it
308
- var csvString = csvRows.join('\r\n');
309
- var csvBlob = new Blob([csvString], { type: 'text/csv' });
224
+ const csvString = csvRows.join('\r\n');
225
+ const csvBlob = new Blob([csvString], { type: 'text/csv' });
310
226
  // Create a download link and click it
311
- var downloadLink = document.createElement('a');
312
- downloadLink.download = "".concat(query, ".csv");
227
+ const downloadLink = document.createElement('a');
228
+ downloadLink.download = `${query}.csv`;
313
229
  downloadLink.href = URL.createObjectURL(csvBlob);
314
230
  downloadLink.style.display = 'none';
315
231
  document.body.appendChild(downloadLink);
@@ -317,28 +233,28 @@ export default function QueryEditor(_a) {
317
233
  document.body.removeChild(downloadLink);
318
234
  };
319
235
  /* rest of your methods */
320
- return (_jsx("div", __assign({ style: containerStyle }, { children: _jsx("div", __assign({ style: {
236
+ return ((0, jsx_runtime_1.jsx)("div", { style: containerStyle, children: (0, jsx_runtime_1.jsx)("div", { style: {
321
237
  height: 'calc(100%)',
322
238
  display: 'flex',
323
239
  flexDirection: 'column',
324
240
  padding: 0,
325
- } }, { children: _jsx("div", __assign({ style: { height: '100%', display: 'flex', flexDirection: 'column' } }, { children: _jsxs("div", __assign({ style: {
241
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: { height: '100%', display: 'flex', flexDirection: 'column' }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
326
242
  width: '100%',
327
243
  display: 'flex',
328
244
  height: '100%',
329
245
  flexDirection: 'row',
330
- } }, { children: [_jsx(SchemaListComponent, { schema: schema, theme: theme, LoadingComponent: LoadingComponent, loading: schemaLoading }), _jsxs("div", __assign({ style: {
246
+ }, children: [(0, jsx_runtime_1.jsx)(SchemaListComponent, { schema: schema, theme: theme, LoadingComponent: LoadingComponent, loading: schemaLoading }), (0, jsx_runtime_1.jsxs)("div", { style: {
331
247
  display: 'flex',
332
248
  flexDirection: 'column',
333
249
  width: 'calc(100% - 250px)',
334
- } }, { children: [_jsxs("div", __assign({ style: {
250
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
335
251
  // TODO: change color
336
252
  height: 80,
337
253
  background: 'white',
338
254
  display: 'flex',
339
255
  flexDirection: 'row',
340
256
  alignItems: 'center',
341
- } }, { children: [_jsx("div", __assign({ style: { minWidth: 440, marginRight: 10 } }, { children: (TextInputComponent && (_jsx(TextInputComponent, { id: "ai-search", value: sqlPrompt, onChange: function (e) { return setSqlPrompt(e.target.value); }, placeholder: "Ask a question..." }))) || (_jsx(QuillTextInput, { id: "ai-search", value: sqlPrompt, onChange: function (e) { return setSqlPrompt(e.target.value); }, placeholder: "Ask a question...", theme: theme })) })), (ButtonComponent && (_jsx(ButtonComponent, { onClick: handleRunSqlPrompt, label: "Ask AI" }))) || (_jsx(QuillButton, { theme: theme, onClick: handleRunSqlPrompt, label: "Ask AI" }))] })), _jsx("div", __assign({ style: { height: 'calc(50% - 40px)' } }, { children: _jsx(SQLEditorComponent, { query: query, setQuery: setQuery, handleRunQuery: handleRunQuery, theme: theme, defineEditorTheme: defineEditorTheme, setEditorTheme: setEditorTheme, ButtonComponent: ButtonComponent, loading: sqlResponseLoading, LoadingComponent: LoadingComponent }) })), _jsxs("div", __assign({ style: {
257
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: { minWidth: 440, marginRight: 10 }, children: (TextInputComponent && ((0, jsx_runtime_1.jsx)(TextInputComponent, { id: "ai-search", value: sqlPrompt, onChange: e => setSqlPrompt(e.target.value), placeholder: "Ask a question..." }))) || ((0, jsx_runtime_1.jsx)(QuillTextInput, { id: "ai-search", value: sqlPrompt, onChange: e => setSqlPrompt(e.target.value), placeholder: "Ask a question...", theme: theme })) }), (ButtonComponent && ((0, jsx_runtime_1.jsx)(ButtonComponent, { onClick: handleRunSqlPrompt, label: "Ask AI" }))) || ((0, jsx_runtime_1.jsx)(QuillButton, { theme: theme, onClick: handleRunSqlPrompt, label: "Ask AI" }))] }), (0, jsx_runtime_1.jsx)("div", { style: { height: 'calc(50% - 40px)' }, children: (0, jsx_runtime_1.jsx)(SQLEditorComponent, { query: query, setQuery: setQuery, handleRunQuery: handleRunQuery, theme: theme, defineEditorTheme: defineEditorTheme, setEditorTheme: setEditorTheme, ButtonComponent: ButtonComponent, loading: sqlResponseLoading, LoadingComponent: LoadingComponent }) }), (0, jsx_runtime_1.jsxs)("div", { style: {
342
258
  height: 'calc(50% - 40px)',
343
259
  display: 'flex',
344
260
  flexDirection: 'column',
@@ -346,52 +262,52 @@ export default function QueryEditor(_a) {
346
262
  margin: 0,
347
263
  border: 'none',
348
264
  outline: 'none',
349
- } }, { children: [errorMessage && (_jsx("div", __assign({ style: {
350
- fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
351
- color: theme === null || theme === void 0 ? void 0 : theme.primaryTextColor,
265
+ }, children: [errorMessage && ((0, jsx_runtime_1.jsx)("div", { style: {
266
+ fontFamily: theme?.fontFamily,
267
+ color: theme?.primaryTextColor,
352
268
  fontSize: 15,
353
269
  fontWeight: '400',
354
- } }, { children: _jsx("div", __assign({ style: {
270
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: {
355
271
  padding: 30,
356
272
  // TODO: change color
357
273
  background: 'rgba(0,0,0,0.02)',
358
274
  display: 'inline-block',
359
275
  flex: 0,
360
276
  borderRadius: 6,
361
- color: theme === null || theme === void 0 ? void 0 : theme.primaryTextColor,
362
- fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
363
- } }, { children: errorMessage })) }))), errorMessage
277
+ color: theme?.primaryTextColor,
278
+ fontFamily: theme?.fontFamily,
279
+ }, children: errorMessage }) })), errorMessage
364
280
  ? null
365
- : (TableComponent && (_jsx(TableComponent, { rows: rows, columns: columns, height: "calc(100% - 70px)" }))) || (_jsx(SpecialTable, { rows: rows, columns: columns, height: "calc(100% - 70px)", LoadingComponent: LoadingComponent, loading: sqlQueryLoading, theme: theme })), _jsx("div", __assign({ style: {
281
+ : (TableComponent && ((0, jsx_runtime_1.jsx)(TableComponent, { rows: rows, columns: columns, height: "calc(100% - 70px)" }))) || ((0, jsx_runtime_1.jsx)(Table_1.SpecialTable, { rows: rows, columns: columns, height: "calc(100% - 70px)", LoadingComponent: LoadingComponent, loading: sqlQueryLoading, theme: theme })), (0, jsx_runtime_1.jsx)("div", { style: {
366
282
  height: 70,
367
283
  // TODO: change color
368
- background: theme === null || theme === void 0 ? void 0 : theme.backgroundColor,
369
- } }, { children: rows.length ? (_jsxs("div", __assign({ style: {
284
+ background: theme?.backgroundColor,
285
+ }, children: rows.length ? ((0, jsx_runtime_1.jsxs)("div", { style: {
370
286
  display: 'flex',
371
287
  flexDirection: 'column',
372
288
  height: 70,
373
289
  border: 'none',
374
- } }, { children: [_jsx("div", { style: {
290
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
375
291
  height: 1,
376
292
  width: '100%',
377
293
  // TODO: change color
378
294
  // background: theme.borderColor,
379
- } }), _jsxs("div", __assign({ style: {
295
+ } }), (0, jsx_runtime_1.jsxs)("div", { style: {
380
296
  marginLeft: 0,
381
297
  height: 69,
382
298
  display: 'flex',
383
299
  alignItems: 'center',
384
300
  justifyContent: 'flex-end',
385
301
  paddingRight: 20,
386
- } }, { children: [(SecondaryButtonComponent && (_jsx(SecondaryButtonComponent, { onClick: downloadCSV, label: "Download CSV" }))) || (_jsx(QuillButton, { theme: theme, onClick: downloadCSV, label: "Download CSV", secondary: true })), AddToDashboardButton && _jsx("div", { style: { width: 10 } }), AddToDashboardButton && (_jsx(AddToDashboardButton
302
+ }, children: [(SecondaryButtonComponent && ((0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: downloadCSV, label: "Download CSV" }))) || ((0, jsx_runtime_1.jsx)(QuillButton, { theme: theme, onClick: downloadCSV, label: "Download CSV", secondary: true })), AddToDashboardButton && (0, jsx_runtime_1.jsx)("div", { style: { width: 10 } }), AddToDashboardButton && ((0, jsx_runtime_1.jsx)(AddToDashboardButton
387
303
  // @ts-ignore
388
304
  , {
389
305
  // @ts-ignore
390
- rows: rows, columns: columns, query: query })), _jsx("div", {})] }))] }))) : null }))] }))] }))] })) })) })) })));
306
+ rows: rows, columns: columns, query: query })), (0, jsx_runtime_1.jsx)("div", {})] })] })) : null })] })] })] }) }) }) }));
391
307
  }
392
- var SQLEditorComponent = function (_a) {
393
- var query = _a.query, setQuery = _a.setQuery, handleRunQuery = _a.handleRunQuery, defineEditorTheme = _a.defineEditorTheme, setEditorTheme = _a.setEditorTheme, ButtonComponent = _a.ButtonComponent, theme = _a.theme, loading = _a.loading, LoadingComponent = _a.LoadingComponent;
394
- return (_jsxs("div", __assign({ style: {
308
+ exports.default = QueryEditor;
309
+ const SQLEditorComponent = ({ query, setQuery, handleRunQuery, defineEditorTheme, setEditorTheme, ButtonComponent, theme, loading, LoadingComponent, }) => {
310
+ return ((0, jsx_runtime_1.jsxs)("div", { style: {
395
311
  background: theme.backgroundColor,
396
312
  // maxHeight: 700,
397
313
  width: '100%',
@@ -405,27 +321,27 @@ var SQLEditorComponent = function (_a) {
405
321
  borderTopRightRadius: 0,
406
322
  borderBottomRightRadius: 0,
407
323
  overflow: 'hidden',
408
- } }, { children: [loading ? (_jsxs("div", __assign({ style: {
324
+ }, children: [loading ? ((0, jsx_runtime_1.jsxs)("div", { style: {
409
325
  height: 'calc(100% - 70px)',
410
326
  width: '100%',
411
327
  display: 'flex',
412
328
  alignItems: 'center',
413
329
  justifyContent: 'center',
414
330
  background: '#F9F9F9',
415
- } }, { children: [LoadingComponent && _jsx(LoadingComponent, {}), !LoadingComponent && (_jsx(TailSpin, { height: 36, width: 36, color: "#364153" }))] }))) : (_jsx(MonacoEditor, { height: "calc(100% - 70px)", width: "100%", defaultLanguage: "pgsql", defaultValue: "", value: query, loading: _jsx("div", {}), options: {
331
+ }, children: [LoadingComponent && (0, jsx_runtime_1.jsx)(LoadingComponent, {}), !LoadingComponent && ((0, jsx_runtime_1.jsxs)("svg", { width: "24", height: "24", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsxs)("defs", { children: [(0, jsx_runtime_1.jsxs)("linearGradient", { id: "circleGradient", gradientUnits: "objectBoundingBox", children: [(0, jsx_runtime_1.jsx)("stop", { offset: "0%", "stop-color": "#F9F9FA" }), (0, jsx_runtime_1.jsx)("stop", { offset: "5%", "stop-color": "#F9F9FA" }), (0, jsx_runtime_1.jsx)("stop", { offset: "100%", "stop-color": "#D1D1D1" })] }), (0, jsx_runtime_1.jsxs)("mask", { id: "mask", children: [(0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "12", r: "12", fill: "white" }), (0, jsx_runtime_1.jsx)("path", { id: "sector", fill: "black", d: "M15,15 L15,1.8 A13.2,13.2 0 0,1 15,1.8 Z", children: (0, jsx_runtime_1.jsx)("animate", { attributeName: "d", from: "M15,15 L15,1.8 A13.2,13.2 0 0,0 15,1.8 Z", to: "M15,15 L15,1.8 A13.2,13.2 0 1,1 15,1.8 Z", dur: "2s", repeatCount: "indefinite" }) })] })] }), (0, jsx_runtime_1.jsxs)("g", { transform: "rotate(0 15 15)", children: [(0, jsx_runtime_1.jsx)("animateTransform", { attributeName: "transform", attributeType: "XML", type: "rotate", from: "0 12 12", to: "360 12 12", dur: "2s", repeatCount: "indefinite" }), (0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "12", r: "12", fill: "none", stroke: "url(#circleGradient)", "stroke-width": "8", mask: "url(#mask)" })] })] }))] })) : ((0, jsx_runtime_1.jsx)(react_2.default, { height: "calc(100% - 70px)", width: "100%", defaultLanguage: "pgsql", defaultValue: "", value: query, loading: (0, jsx_runtime_1.jsx)("div", {}), options: {
416
332
  wordWrap: 'on',
417
333
  minimap: {
418
334
  enabled: false,
419
335
  },
420
336
  padding: { top: 16 },
421
- }, onChange: function (query) { return setQuery(query); }, beforeMount: function (monaco) { return defineEditorTheme(monaco, theme); }, onMount: setEditorTheme })), _jsx("div", __assign({ style: {
337
+ }, onChange: query => setQuery(query), beforeMount: monaco => defineEditorTheme(monaco, theme), onMount: setEditorTheme })), (0, jsx_runtime_1.jsx)("div", { style: {
422
338
  display: 'flex',
423
339
  flexDirection: 'row',
424
340
  alignItems: 'center',
425
341
  height: 70,
426
- } }, { children: (ButtonComponent && (_jsx(ButtonComponent, { onClick: handleRunQuery, label: "Run query" }))) || (_jsx(QuillButton, { onClick: handleRunQuery, label: "Run query", theme: theme })) }))] })));
342
+ }, children: (ButtonComponent && ((0, jsx_runtime_1.jsx)(ButtonComponent, { onClick: handleRunQuery, label: "Run query" }))) || ((0, jsx_runtime_1.jsx)(QuillButton, { onClick: handleRunQuery, label: "Run query", theme: theme })) })] }));
427
343
  };
428
- var styles = {
344
+ const styles = {
429
345
  columnHeader: {
430
346
  boxSizing: 'border-box',
431
347
  flex: '150 0 auto',
@@ -457,10 +373,9 @@ var styles = {
457
373
  overflow: 'hidden',
458
374
  },
459
375
  };
460
- var SchemaListComponent = function (_a) {
461
- var schema = _a.schema, theme = _a.theme, loading = _a.loading, LoadingComponent = _a.LoadingComponent;
376
+ const SchemaListComponent = ({ schema, theme, loading, LoadingComponent }) => {
462
377
  if (loading) {
463
- return (_jsxs("div", __assign({ style: {
378
+ return ((0, jsx_runtime_1.jsxs)("div", { style: {
464
379
  background: theme.backgroundColor,
465
380
  // maxHeight: 700,
466
381
  width: 250,
@@ -474,9 +389,9 @@ var SchemaListComponent = function (_a) {
474
389
  display: 'flex',
475
390
  // alignItems: 'center',
476
391
  justifyContent: 'center',
477
- } }, { children: [_jsx("div", { style: { height: 100 } }), LoadingComponent && _jsx(LoadingComponent, {}), !LoadingComponent && (_jsx(TailSpin, { height: 36, width: 36, color: "#364153" }))] })));
392
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: { height: 100 } }), LoadingComponent && (0, jsx_runtime_1.jsx)(LoadingComponent, {}), !LoadingComponent && ((0, jsx_runtime_1.jsxs)("svg", { width: "24", height: "24", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsxs)("defs", { children: [(0, jsx_runtime_1.jsxs)("linearGradient", { id: "circleGradient", gradientUnits: "objectBoundingBox", children: [(0, jsx_runtime_1.jsx)("stop", { offset: "0%", "stop-color": "#F9F9FA" }), (0, jsx_runtime_1.jsx)("stop", { offset: "5%", "stop-color": "#F9F9FA" }), (0, jsx_runtime_1.jsx)("stop", { offset: "100%", "stop-color": "#D1D1D1" })] }), (0, jsx_runtime_1.jsxs)("mask", { id: "mask", children: [(0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "12", r: "12", fill: "white" }), (0, jsx_runtime_1.jsx)("path", { id: "sector", fill: "black", d: "M15,15 L15,1.8 A13.2,13.2 0 0,1 15,1.8 Z", children: (0, jsx_runtime_1.jsx)("animate", { attributeName: "d", from: "M15,15 L15,1.8 A13.2,13.2 0 0,0 15,1.8 Z", to: "M15,15 L15,1.8 A13.2,13.2 0 1,1 15,1.8 Z", dur: "2s", repeatCount: "indefinite" }) })] })] }), (0, jsx_runtime_1.jsxs)("g", { transform: "rotate(0 15 15)", children: [(0, jsx_runtime_1.jsx)("animateTransform", { attributeName: "transform", attributeType: "XML", type: "rotate", from: "0 12 12", to: "360 12 12", dur: "2s", repeatCount: "indefinite" }), (0, jsx_runtime_1.jsx)("circle", { cx: "12", cy: "12", r: "12", fill: "none", stroke: "url(#circleGradient)", "stroke-width": "8", mask: "url(#mask)" })] })] }))] }));
478
393
  }
479
- return (_jsx("div", __assign({ style: {
394
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
480
395
  background: theme.backgroundColor,
481
396
  // maxHeight: 700,
482
397
  width: 250,
@@ -486,12 +401,11 @@ var SchemaListComponent = function (_a) {
486
401
  // maxHeight: "100%",
487
402
  paddingLeft: 20,
488
403
  paddingRight: 30,
489
- } }, { children: schema.map(function (elem, index) { return (_jsx(SchemaItem, { elem: elem, theme: theme, index: index }, elem.displayName + index)); }) })));
404
+ }, children: schema.map((elem, index) => ((0, jsx_runtime_1.jsx)(SchemaItem, { elem: elem, theme: theme, index: index }, elem.displayName + index))) }));
490
405
  };
491
- function SchemaItem(_a) {
492
- var elem = _a.elem, theme = _a.theme, index = _a.index;
493
- var _b = useState(index === 0), isOpen = _b[0], setIsOpen = _b[1];
494
- var schemaContainerStyle = {
406
+ function SchemaItem({ elem, theme, index }) {
407
+ const [isOpen, setIsOpen] = (0, react_1.useState)(index === 0);
408
+ const schemaContainerStyle = {
495
409
  display: 'flex',
496
410
  flexDirection: 'column',
497
411
  // WebkitTouchCallout: "none",
@@ -501,7 +415,7 @@ function SchemaItem(_a) {
501
415
  // msUserSelect: "none",
502
416
  // userSelect: "none",
503
417
  };
504
- var schemaRowStyle = {
418
+ const schemaRowStyle = {
505
419
  display: 'flex',
506
420
  flexDirection: 'row',
507
421
  alignItems: 'center',
@@ -509,10 +423,10 @@ function SchemaItem(_a) {
509
423
  justifyContent: 'space-between',
510
424
  cursor: 'pointer',
511
425
  };
512
- var schemaRowHoverStyle = {
426
+ const schemaRowHoverStyle = {
513
427
  background: theme.selectUnderlayColor,
514
428
  };
515
- return (_jsxs("div", __assign({ style: schemaContainerStyle }, { children: [_jsxs("div", __assign({ style: __assign(__assign({}, schemaRowStyle), (isOpen && schemaRowHoverStyle)), onClick: function () { return setIsOpen(!isOpen); } }, { children: [_jsx("p", __assign({ style: {
429
+ return ((0, jsx_runtime_1.jsxs)("div", { style: schemaContainerStyle, children: [(0, jsx_runtime_1.jsxs)("div", { style: { ...schemaRowStyle, ...(isOpen && schemaRowHoverStyle) }, onClick: () => setIsOpen(!isOpen), children: [(0, jsx_runtime_1.jsx)("p", { style: {
516
430
  marginLeft: theme.padding,
517
431
  fontSize: 13,
518
432
  color: '#384151',
@@ -522,8 +436,8 @@ function SchemaItem(_a) {
522
436
  margin: 0,
523
437
  textOverflow: 'ellipsis',
524
438
  overflow: 'hidden',
525
- fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
526
- }, title: elem.displayName }, { children: elem.displayName })), _jsx("div", __assign({ style: {
439
+ fontFamily: theme?.fontFamily,
440
+ }, title: elem.displayName, children: elem.displayName }), (0, jsx_runtime_1.jsx)("div", { style: {
527
441
  display: 'flex',
528
442
  alignItems: 'center',
529
443
  justifyContent: 'center',
@@ -532,19 +446,19 @@ function SchemaItem(_a) {
532
446
  paddingBottom: 12,
533
447
  paddingLeft: 0,
534
448
  cursor: 'pointer',
535
- } }, { children: isOpen ? (_jsx(ChevronDownIcon, { style: { height: 13, width: 13, color: theme.secondaryTextColor }, "aria-hidden": "true" })) : (_jsx(ChevronRightIcon, { style: { height: 13, width: 13, color: theme.secondaryTextColor }, "aria-hidden": "true" })) }))] })), isOpen ? (_jsx("div", __assign({ style: {
449
+ }, children: isOpen ? ((0, jsx_runtime_1.jsx)(solid_1.ChevronDownIcon, { style: { height: 13, width: 13, color: theme.secondaryTextColor }, "aria-hidden": "true" })) : ((0, jsx_runtime_1.jsx)(solid_1.ChevronRightIcon, { style: { height: 13, width: 13, color: theme.secondaryTextColor }, "aria-hidden": "true" })) })] }), isOpen ? ((0, jsx_runtime_1.jsx)("div", { style: {
536
450
  paddingBottom: theme.padding,
537
451
  display: 'flex',
538
452
  flexDirection: 'column',
539
453
  paddingLeft: theme.padding,
540
454
  paddingRight: theme.padding,
541
- } }, { children: elem.columns.map(function (elem, index) { return (_jsxs("div", __assign({ style: {
455
+ }, children: elem.columns.map((elem, index) => ((0, jsx_runtime_1.jsxs)("div", { style: {
542
456
  paddingTop: theme.padding,
543
457
  display: 'flex',
544
458
  flexDirection: 'row',
545
459
  alignItems: 'center',
546
460
  justifyContent: 'space-between',
547
- } }, { children: [_jsx("div", __assign({ title: elem.displayName,
461
+ }, children: [(0, jsx_runtime_1.jsx)("div", { title: elem.displayName,
548
462
  // className="text-gray-500"
549
463
  style: {
550
464
  fontSize: 12,
@@ -558,8 +472,8 @@ function SchemaItem(_a) {
558
472
  overflow: 'hidden',
559
473
  width: 200,
560
474
  maxWidth: 200,
561
- fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
562
- } }, { children: elem.displayName })), _jsx("div", __assign({
475
+ fontFamily: theme?.fontFamily,
476
+ }, children: elem.displayName }), (0, jsx_runtime_1.jsx)("div", {
563
477
  // className="text-gray-500"
564
478
  title: elem.displayName, style: {
565
479
  fontSize: 12,
@@ -567,7 +481,7 @@ function SchemaItem(_a) {
567
481
  color: theme.secondaryTextColor,
568
482
  padding: 0,
569
483
  margin: 0,
570
- fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
571
- } }, { children: elem.fieldType }))] }), elem.displayName + elem.index)); }) }))) : null] })));
484
+ fontFamily: theme?.fontFamily,
485
+ }, children: elem.fieldType })] }, elem.displayName + elem.index))) })) : null] }));
572
486
  }
573
487
  //# sourceMappingURL=SQLEditor.js.map