@quillsql/react 1.7.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AddToDashboardModal.js +369 -249
- package/lib/AddToDashboardModal.js.map +1 -1
- package/lib/BarList.js +109 -92
- package/lib/BarList.js.map +1 -1
- package/lib/Chart.js +414 -364
- package/lib/Chart.js.map +1 -1
- package/lib/Context.js +84 -92
- package/lib/Context.js.map +1 -1
- package/lib/Dashboard.js +209 -181
- package/lib/Dashboard.js.map +1 -1
- package/lib/DateRangePicker/Calendar.js +91 -87
- package/lib/DateRangePicker/Calendar.js.map +1 -1
- package/lib/DateRangePicker/DateRangePicker.js +68 -70
- package/lib/DateRangePicker/DateRangePicker.js.map +1 -1
- package/lib/DateRangePicker/DateRangePickerButton.js +57 -46
- package/lib/DateRangePicker/DateRangePickerButton.js.map +1 -1
- package/lib/DateRangePicker/dateRangePickerUtils.js +99 -105
- package/lib/DateRangePicker/dateRangePickerUtils.js.map +1 -1
- package/lib/DateRangePicker/index.js +1 -8
- package/lib/DateRangePicker/index.js.map +1 -1
- package/lib/PieChart.js +225 -221
- package/lib/PieChart.js.map +1 -1
- package/lib/QuillProvider.js +18 -8
- package/lib/QuillProvider.js.map +1 -1
- package/lib/ReportBuilder.js +526 -430
- package/lib/ReportBuilder.js.map +1 -1
- package/lib/SQLEditor.js +268 -183
- package/lib/SQLEditor.js.map +1 -1
- package/lib/Table.js +256 -213
- package/lib/Table.js.map +1 -1
- package/lib/TableChart.js +75 -76
- package/lib/TableChart.js.map +1 -1
- package/lib/assets/ArrowDownHeadIcon.js +28 -5
- package/lib/assets/ArrowDownHeadIcon.js.map +1 -1
- package/lib/assets/ArrowDownIcon.js +28 -5
- package/lib/assets/ArrowDownIcon.js.map +1 -1
- package/lib/assets/ArrowDownRightIcon.js +28 -5
- package/lib/assets/ArrowDownRightIcon.js.map +1 -1
- package/lib/assets/ArrowLeftHeadIcon.js +28 -5
- package/lib/assets/ArrowLeftHeadIcon.js.map +1 -1
- package/lib/assets/ArrowRightHeadIcon.js +28 -5
- package/lib/assets/ArrowRightHeadIcon.js.map +1 -1
- package/lib/assets/ArrowRightIcon.js +28 -5
- package/lib/assets/ArrowRightIcon.js.map +1 -1
- package/lib/assets/ArrowUpHeadIcon.js +28 -5
- package/lib/assets/ArrowUpHeadIcon.js.map +1 -1
- package/lib/assets/ArrowUpIcon.js +28 -5
- package/lib/assets/ArrowUpIcon.js.map +1 -1
- package/lib/assets/ArrowUpRightIcon.js +28 -5
- package/lib/assets/ArrowUpRightIcon.js.map +1 -1
- package/lib/assets/CalendarIcon.js +28 -5
- package/lib/assets/CalendarIcon.js.map +1 -1
- package/lib/assets/DoubleArrowLeftHeadIcon.js +28 -5
- package/lib/assets/DoubleArrowLeftHeadIcon.js.map +1 -1
- package/lib/assets/DoubleArrowRightHeadIcon.js +28 -5
- package/lib/assets/DoubleArrowRightHeadIcon.js.map +1 -1
- package/lib/assets/ExclamationFilledIcon.js +28 -5
- package/lib/assets/ExclamationFilledIcon.js.map +1 -1
- package/lib/assets/LoadingSpinner.js +28 -5
- package/lib/assets/LoadingSpinner.js.map +1 -1
- package/lib/assets/SearchIcon.js +28 -5
- package/lib/assets/SearchIcon.js.map +1 -1
- package/lib/assets/XCircleIcon.js +28 -5
- package/lib/assets/XCircleIcon.js.map +1 -1
- package/lib/assets/index.js +16 -38
- package/lib/assets/index.js.map +1 -1
- package/lib/components/BigModal/BigModal.js +43 -45
- package/lib/components/BigModal/BigModal.js.map +1 -1
- package/lib/components/Dropdown/Dropdown.js +53 -57
- package/lib/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/components/Dropdown/DropdownItem.js +40 -43
- package/lib/components/Dropdown/DropdownItem.js.map +1 -1
- package/lib/components/Dropdown/index.js +2 -10
- package/lib/components/Dropdown/index.js.map +1 -1
- package/lib/components/Modal/Modal.js +43 -45
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/components/Modal/index.js +1 -8
- package/lib/components/Modal/index.js.map +1 -1
- package/lib/components/selectUtils.js +15 -20
- package/lib/components/selectUtils.js.map +1 -1
- package/lib/contexts/BaseColorContext.js +3 -5
- package/lib/contexts/BaseColorContext.js.map +1 -1
- package/lib/contexts/HoveredValueContext.js +3 -5
- package/lib/contexts/HoveredValueContext.js.map +1 -1
- package/lib/contexts/RootStylesContext.js +3 -5
- package/lib/contexts/RootStylesContext.js.map +1 -1
- package/lib/contexts/SelectedValueContext.js +3 -5
- package/lib/contexts/SelectedValueContext.js.map +1 -1
- package/lib/contexts/index.js +4 -14
- package/lib/contexts/index.js.map +1 -1
- package/lib/hooks/index.js +4 -14
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useInternalState.js +7 -9
- package/lib/hooks/useInternalState.js.map +1 -1
- package/lib/hooks/useOnClickOutside.js +6 -8
- package/lib/hooks/useOnClickOutside.js.map +1 -1
- package/lib/hooks/useOnWindowResize.js +7 -9
- package/lib/hooks/useOnWindowResize.js.map +1 -1
- package/lib/hooks/useQuill.js +111 -60
- package/lib/hooks/useQuill.js.map +1 -1
- package/lib/hooks/useSelectOnKeyDown.js +15 -17
- package/lib/hooks/useSelectOnKeyDown.js.map +1 -1
- package/lib/index.js +8 -22
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/lib/Table.js
CHANGED
|
@@ -1,43 +1,89 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
4
47
|
};
|
|
5
|
-
|
|
6
|
-
exports.SpecialTable = void 0;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
48
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
49
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
9
50
|
// @ts-nocheck
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
51
|
+
import { useContext, useEffect, useMemo, useState } from 'react';
|
|
52
|
+
import axios from 'axios';
|
|
53
|
+
import { ClientContext, DashboardContext, ThemeContext, } from './Context';
|
|
54
|
+
import Skeleton from 'react-loading-skeleton';
|
|
55
|
+
import { valueFormatter } from './Chart';
|
|
56
|
+
import { TailSpin } from 'react-loader-spinner';
|
|
57
|
+
var Table = function (_a) {
|
|
58
|
+
var chartId = _a.chartId, columns = _a.columns, rows = _a.rows, containerStyle = _a.containerStyle, csvFilename = _a.csvFilename;
|
|
59
|
+
var _b = useContext(DashboardContext), dispatch = _b.dispatch, dashboard = _b.dashboard;
|
|
60
|
+
var _c = useContext(ClientContext), client = _c[0], _ = _c[1];
|
|
61
|
+
var theme = useContext(ThemeContext)[0];
|
|
62
|
+
var downloadCSV = function (rows, name) {
|
|
21
63
|
// report.rows
|
|
22
64
|
if (!rows.length) {
|
|
23
65
|
return;
|
|
24
66
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
67
|
+
var json = rows; // JSON data passed as a prop
|
|
68
|
+
var fields = Object.keys(json[0]); // Assumes all objects have same keys
|
|
69
|
+
var csvRows = [];
|
|
28
70
|
// Header row
|
|
29
71
|
csvRows.push(fields.join(','));
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const values = fields.map(field => JSON.stringify(row[field] || ''));
|
|
72
|
+
var _loop_1 = function (row) {
|
|
73
|
+
var values = fields.map(function (field) { return JSON.stringify(row[field] || ''); });
|
|
33
74
|
csvRows.push(values.join(','));
|
|
75
|
+
};
|
|
76
|
+
// Data rows
|
|
77
|
+
for (var _i = 0, json_1 = json; _i < json_1.length; _i++) {
|
|
78
|
+
var row = json_1[_i];
|
|
79
|
+
_loop_1(row);
|
|
34
80
|
}
|
|
35
81
|
// Create CSV string and create a 'blob' with it
|
|
36
|
-
|
|
37
|
-
|
|
82
|
+
var csvString = csvRows.join('\r\n');
|
|
83
|
+
var csvBlob = new Blob([csvString], { type: 'text/csv' });
|
|
38
84
|
// Create a download link and click it
|
|
39
|
-
|
|
40
|
-
downloadLink.download =
|
|
85
|
+
var downloadLink = document.createElement('a');
|
|
86
|
+
downloadLink.download = "".concat(name, ".csv");
|
|
41
87
|
downloadLink.href = URL.createObjectURL(csvBlob);
|
|
42
88
|
downloadLink.style.display = 'none';
|
|
43
89
|
document.body.appendChild(downloadLink);
|
|
@@ -45,32 +91,37 @@ const Table = ({ chartId, columns, rows, containerStyle, csvFilename, }) => {
|
|
|
45
91
|
document.body.removeChild(downloadLink);
|
|
46
92
|
};
|
|
47
93
|
if (!chartId && rows && columns) {
|
|
48
|
-
return ((
|
|
94
|
+
return (_jsx(SpecialTable, { showDownloadCsvButton: true, csvFilename: csvFilename || 'table', columns: columns, rows: rows, height: (containerStyle === null || containerStyle === void 0 ? void 0 : containerStyle.height) || '100%', theme: theme }));
|
|
49
95
|
}
|
|
50
|
-
return ((
|
|
96
|
+
return (_jsx(ChartUpdater, { dispatch: dispatch, dashboard: dashboard, chartId: chartId, containerStyle: containerStyle, client: client, theme: theme, downloadCSV: downloadCSV, csvFilename: csvFilename }));
|
|
51
97
|
};
|
|
52
|
-
function SpecialTable(
|
|
53
|
-
|
|
98
|
+
export function SpecialTable(_a) {
|
|
99
|
+
var columns = _a.columns, rows = _a.rows, height = _a.height, containerStyle = _a.containerStyle, loading = _a.loading, LoadingComponent = _a.LoadingComponent, theme = _a.theme, showDownloadCsvButton = _a.showDownloadCsvButton, csvFilename = _a.csvFilename, DownloadCSVButtonComponent = _a.DownloadCSVButtonComponent, AddToDashboardButtonComponent = _a.AddToDashboardButtonComponent;
|
|
100
|
+
var downloadCSV = function () {
|
|
54
101
|
// report.rows
|
|
55
102
|
if (!rows.length) {
|
|
56
103
|
return;
|
|
57
104
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
105
|
+
var json = rows; // JSON data passed as a prop
|
|
106
|
+
var fields = Object.keys(json[0]); // Assumes all objects have same keys
|
|
107
|
+
var csvRows = [];
|
|
61
108
|
// Header row
|
|
62
109
|
csvRows.push(fields.join(','));
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const values = fields.map(field => JSON.stringify(row[field] || ''));
|
|
110
|
+
var _loop_2 = function (row) {
|
|
111
|
+
var values = fields.map(function (field) { return JSON.stringify(row[field] || ''); });
|
|
66
112
|
csvRows.push(values.join(','));
|
|
113
|
+
};
|
|
114
|
+
// Data rows
|
|
115
|
+
for (var _i = 0, json_2 = json; _i < json_2.length; _i++) {
|
|
116
|
+
var row = json_2[_i];
|
|
117
|
+
_loop_2(row);
|
|
67
118
|
}
|
|
68
119
|
// Create CSV string and create a 'blob' with it
|
|
69
|
-
|
|
70
|
-
|
|
120
|
+
var csvString = csvRows.join('\r\n');
|
|
121
|
+
var csvBlob = new Blob([csvString], { type: 'text/csv' });
|
|
71
122
|
// Create a download link and click it
|
|
72
|
-
|
|
73
|
-
downloadLink.download =
|
|
123
|
+
var downloadLink = document.createElement('a');
|
|
124
|
+
downloadLink.download = "".concat(csvFilename, ".csv");
|
|
74
125
|
downloadLink.href = URL.createObjectURL(csvBlob);
|
|
75
126
|
downloadLink.style.display = 'none';
|
|
76
127
|
document.body.appendChild(downloadLink);
|
|
@@ -78,19 +129,13 @@ function SpecialTable({ columns, rows, height, containerStyle, loading, LoadingC
|
|
|
78
129
|
document.body.removeChild(downloadLink);
|
|
79
130
|
};
|
|
80
131
|
if (loading) {
|
|
81
|
-
return ((
|
|
82
|
-
...containerStyle,
|
|
132
|
+
return (_jsx("div", __assign({ style: __assign(__assign({}, containerStyle), {
|
|
83
133
|
// paddingLeft: 25,
|
|
84
134
|
// paddingRight: 25,
|
|
85
135
|
// borderRadius: 8,
|
|
86
136
|
// marginTop: 25,
|
|
87
137
|
// overflow: 'visible',
|
|
88
|
-
width: '100%',
|
|
89
|
-
height: height,
|
|
90
|
-
// overflow: 'hidden',
|
|
91
|
-
// @ts-ignore
|
|
92
|
-
// boxShadow: 'rgba(231, 231, 231, 0.5) 0px 1px 2px 0px',
|
|
93
|
-
}, children: (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
138
|
+
width: '100%', height: height }) }, { children: _jsxs("div", __assign({ style: {
|
|
94
139
|
height: '100%',
|
|
95
140
|
overflow: 'scroll',
|
|
96
141
|
borderRadius: 6,
|
|
@@ -105,24 +150,18 @@ function SpecialTable({ columns, rows, height, containerStyle, loading, LoadingC
|
|
|
105
150
|
justifyContent: 'center',
|
|
106
151
|
alignItems: 'center',
|
|
107
152
|
// maxHeight: 600,
|
|
108
|
-
}, children: [LoadingComponent && (
|
|
153
|
+
} }, { children: [LoadingComponent && _jsx(LoadingComponent, {}), !LoadingComponent && (_jsx(TailSpin, { height: 36, width: 36, color: "#364153" }))] })) })));
|
|
109
154
|
}
|
|
110
155
|
if (!columns || !columns.length || !rows) {
|
|
111
156
|
return null;
|
|
112
157
|
}
|
|
113
158
|
if (showDownloadCsvButton) {
|
|
114
|
-
return ((
|
|
115
|
-
...containerStyle,
|
|
159
|
+
return (_jsxs("div", __assign({ style: __assign(__assign({}, containerStyle), {
|
|
116
160
|
// paddingLeft: 25,
|
|
117
161
|
// paddingRight: 25,
|
|
118
162
|
// borderRadius: 8,
|
|
119
163
|
// marginTop: 25,
|
|
120
|
-
overflow: 'visible',
|
|
121
|
-
height: height,
|
|
122
|
-
// overflow: 'hidden',
|
|
123
|
-
// @ts-ignore
|
|
124
|
-
// boxShadow: 'rgba(231, 231, 231, 0.5) 0px 1px 2px 0px',
|
|
125
|
-
}, children: [(0, jsx_runtime_1.jsx)("div", { style: { height: 50, background: 'white' }, className: "thead", children: (0, jsx_runtime_1.jsxs)("div", { role: "row", className: "tr", style: {
|
|
164
|
+
overflow: 'visible', height: height }) }, { children: [_jsx("div", __assign({ style: { height: 50, background: 'white' }, className: "thead" }, { children: _jsxs("div", __assign({ role: "row", className: "tr", style: {
|
|
126
165
|
display: 'flex',
|
|
127
166
|
flex: '1 0 auto',
|
|
128
167
|
minWidth: '100px',
|
|
@@ -131,20 +170,20 @@ function SpecialTable({ columns, rows, height, containerStyle, loading, LoadingC
|
|
|
131
170
|
height: 50,
|
|
132
171
|
// position: 'absolute',
|
|
133
172
|
// bottom: 0,
|
|
134
|
-
}, children: [DownloadCSVButtonComponent && ((
|
|
173
|
+
} }, { children: [DownloadCSVButtonComponent && (_jsx(DownloadCSVButtonComponent, { onClick: downloadCSV })), !DownloadCSVButtonComponent && (_jsx("div", __assign({ onClick: downloadCSV, style: {
|
|
135
174
|
height: 40,
|
|
136
175
|
minHeight: 40,
|
|
137
|
-
color: theme
|
|
176
|
+
color: theme === null || theme === void 0 ? void 0 : theme.primaryTextColor,
|
|
138
177
|
boxSizing: 'content-box',
|
|
139
|
-
fontFamily: theme
|
|
140
|
-
fontSize: theme
|
|
141
|
-
fontWeight: theme
|
|
178
|
+
fontFamily: (theme === null || theme === void 0 ? void 0 : theme.chartLabelFontFamily) || (theme === null || theme === void 0 ? void 0 : theme.fontFamily),
|
|
179
|
+
fontSize: (theme === null || theme === void 0 ? void 0 : theme.fontSizeSmall) || '14px',
|
|
180
|
+
fontWeight: (theme === null || theme === void 0 ? void 0 : theme.fontWeightMedium) || '500',
|
|
142
181
|
// marginTop: 8,
|
|
143
182
|
marginLeft: 20,
|
|
144
183
|
alignItems: 'center',
|
|
145
184
|
display: 'flex',
|
|
146
185
|
cursor: 'pointer',
|
|
147
|
-
}, children: "Download CSV" }))] }) }), (
|
|
186
|
+
} }, { children: "Download CSV" })))] })) })), _jsx("div", __assign({ style: {
|
|
148
187
|
height: 'calc(100% - 50px)',
|
|
149
188
|
overflow: 'scroll',
|
|
150
189
|
borderRadius: 6,
|
|
@@ -155,12 +194,12 @@ function SpecialTable({ columns, rows, height, containerStyle, loading, LoadingC
|
|
|
155
194
|
boxSizing: 'border-box',
|
|
156
195
|
outline: 'none',
|
|
157
196
|
// maxHeight: 600,
|
|
158
|
-
}, children: (
|
|
197
|
+
} }, { children: _jsxs("div", __assign({ role: "table", className: "table", style: { minWidth: '0px' } }, { children: [_jsx("div", __assign({ className: "thead" }, { children: _jsx("div", __assign({ role: "row", className: "tr", style: {
|
|
159
198
|
display: 'flex',
|
|
160
199
|
flex: '1 0 auto',
|
|
161
200
|
minWidth: '100px',
|
|
162
201
|
boxSizing: 'border-box',
|
|
163
|
-
}, children: columns.map((column, index)
|
|
202
|
+
} }, { children: columns.map(function (column, index) { return (_jsxs("div", __assign({
|
|
164
203
|
// @ts-ignore
|
|
165
204
|
style: {
|
|
166
205
|
boxSizing: 'border-box',
|
|
@@ -178,28 +217,28 @@ function SpecialTable({ columns, rows, height, containerStyle, loading, LoadingC
|
|
|
178
217
|
margin: '0px',
|
|
179
218
|
textOverflow: 'ellipsis',
|
|
180
219
|
minHeight: '36px',
|
|
181
|
-
}, children: [(
|
|
220
|
+
} }, { children: [_jsx("div", { style: { width: 16 } }), _jsx("div", __assign({ "aria-haspopup": "dialog", "aria-expanded": "false", "aria-controls": "mantine-r6-dropdown",
|
|
182
221
|
// @ts-ignore
|
|
183
222
|
style: {
|
|
184
223
|
// fontFamily:
|
|
185
224
|
// 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',
|
|
186
225
|
WebkitTapHighlightColor: 'transparent',
|
|
187
|
-
fontFamily: theme
|
|
226
|
+
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
188
227
|
// color: 'rgb(55, 65, 81)',
|
|
189
|
-
color: theme
|
|
228
|
+
color: theme === null || theme === void 0 ? void 0 : theme.primaryTextColor,
|
|
190
229
|
textDecoration: 'none',
|
|
191
|
-
fontSize: theme
|
|
192
|
-
fontWeight: theme
|
|
230
|
+
fontSize: (theme === null || theme === void 0 ? void 0 : theme.fontSizeSmall) || '14px',
|
|
231
|
+
fontWeight: (theme === null || theme === void 0 ? void 0 : theme.fontWeightMedium) || '500',
|
|
193
232
|
lineHeight: '20px',
|
|
194
233
|
textOverflow: 'ellipsis',
|
|
195
234
|
whiteSpace: 'nowrap',
|
|
196
235
|
overflow: 'hidden',
|
|
197
|
-
}, children: column.label })] }, 'sqlcol' + index))) }) }), (
|
|
236
|
+
} }, { children: column.label }))] }), 'sqlcol' + index)); }) })) })), _jsx("div", __assign({ role: "rowgroup", className: "tbody" }, { children: !rows.length ? (_jsx("div", __assign({ role: "row", className: "tr", style: {
|
|
198
237
|
display: 'flex',
|
|
199
238
|
flex: '1 0 auto',
|
|
200
239
|
minWidth: '100px',
|
|
201
240
|
boxSizing: 'border-box',
|
|
202
|
-
}, children: (
|
|
241
|
+
} }, { children: _jsx("div", __assign({ role: "cell", className: "td airplane-1h7muk6", style: {
|
|
203
242
|
boxSizing: 'border-box',
|
|
204
243
|
flex: '150 0 auto',
|
|
205
244
|
minWidth: '50px',
|
|
@@ -211,32 +250,32 @@ function SpecialTable({ columns, rows, height, containerStyle, loading, LoadingC
|
|
|
211
250
|
borderRight: '1px solid rgb(229, 231, 235)',
|
|
212
251
|
overflow: 'hidden',
|
|
213
252
|
borderTop: '1px solid rgb(229, 231, 235)',
|
|
214
|
-
}, children: (
|
|
253
|
+
} }, { children: _jsx("div", __assign({ style: {
|
|
215
254
|
lineHeight: '24px',
|
|
216
255
|
width: '100%',
|
|
217
256
|
display: 'flex',
|
|
218
257
|
cursor: 'default',
|
|
219
258
|
position: 'relative',
|
|
220
|
-
}, className: "airplane-gowkln", "data-testid": "static-cell", children: (
|
|
221
|
-
fontFamily: theme
|
|
259
|
+
}, className: "airplane-gowkln", "data-testid": "static-cell" }, { children: _jsx("div", __assign({ className: "airplane-Text-root airplane-mzqt6k", "aria-haspopup": "dialog", "aria-expanded": "false", "aria-controls": "mantine-r8-dropdown", id: "mantine-r8-target", style: {
|
|
260
|
+
fontFamily: (theme === null || theme === void 0 ? void 0 : theme.fontFamily) ||
|
|
222
261
|
'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',
|
|
223
262
|
WebkitTapHighlightColor: 'transparent',
|
|
224
263
|
// color: 'rgb(55, 65, 81)',
|
|
225
|
-
color: theme
|
|
264
|
+
color: (theme === null || theme === void 0 ? void 0 : theme.secondaryTextColor) || 'rgb(55, 65, 81)',
|
|
226
265
|
textDecoration: 'none',
|
|
227
266
|
fontWeight: 400,
|
|
228
|
-
fontSize: theme
|
|
267
|
+
fontSize: (theme === null || theme === void 0 ? void 0 : theme.fontSizeSmall) || '14px',
|
|
229
268
|
lineHeight: '20px',
|
|
230
269
|
textOverflow: 'ellipsis',
|
|
231
270
|
whiteSpace: 'nowrap',
|
|
232
271
|
overflow: 'hidden',
|
|
233
272
|
padding: '8px 16px',
|
|
234
|
-
}, children: "No rows returned" }) }) }, 'sqlcell0') }, 'sqlrow0')) : (rows.map((row, rowIndex)
|
|
273
|
+
} }, { children: "No rows returned" })) })) }), 'sqlcell0') }), 'sqlrow0')) : (rows.map(function (row, rowIndex) { return (_jsx("div", __assign({ role: "row", className: "tr", style: {
|
|
235
274
|
display: 'flex',
|
|
236
275
|
flex: '1 0 auto',
|
|
237
276
|
minWidth: '100px',
|
|
238
277
|
boxSizing: 'border-box',
|
|
239
|
-
}, children: columns.map((column, columnIndex)
|
|
278
|
+
} }, { children: columns.map(function (column, columnIndex) { return (_jsx("div", __assign({ role: "cell", className: "td airplane-1h7muk6", style: {
|
|
240
279
|
boxSizing: 'border-box',
|
|
241
280
|
flex: '150 0 auto',
|
|
242
281
|
minWidth: '50px',
|
|
@@ -251,46 +290,40 @@ function SpecialTable({ columns, rows, height, containerStyle, loading, LoadingC
|
|
|
251
290
|
borderBottom: rowIndex === rows.length - 1
|
|
252
291
|
? '1px solid rgb(229, 231, 235)'
|
|
253
292
|
: undefined,
|
|
254
|
-
}, children: (
|
|
293
|
+
} }, { children: _jsx("div", __assign({ style: {
|
|
255
294
|
lineHeight: '24px',
|
|
256
295
|
width: '100%',
|
|
257
296
|
display: 'flex',
|
|
258
297
|
cursor: 'default',
|
|
259
298
|
position: 'relative',
|
|
260
|
-
}, className: "airplane-gowkln", "data-testid": "static-cell", children: (
|
|
261
|
-
fontFamily: theme
|
|
299
|
+
}, className: "airplane-gowkln", "data-testid": "static-cell" }, { children: _jsx("div", __assign({ className: "airplane-Text-root airplane-mzqt6k", "aria-haspopup": "dialog", "aria-expanded": "false", "aria-controls": "mantine-r8-dropdown", id: "mantine-r8-target", style: {
|
|
300
|
+
fontFamily: (theme === null || theme === void 0 ? void 0 : theme.fontFamily) ||
|
|
262
301
|
'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',
|
|
263
302
|
WebkitTapHighlightColor: 'transparent',
|
|
264
303
|
// color: 'rgb(55, 65, 81)',
|
|
265
|
-
color: theme
|
|
304
|
+
color: (theme === null || theme === void 0 ? void 0 : theme.secondaryTextColor) || 'rgb(55, 65, 81)',
|
|
266
305
|
textDecoration: 'none',
|
|
267
306
|
fontWeight: 400,
|
|
268
|
-
fontSize: theme
|
|
307
|
+
fontSize: (theme === null || theme === void 0 ? void 0 : theme.fontSizeSmall) || '14px',
|
|
269
308
|
lineHeight: '20px',
|
|
270
309
|
textOverflow: 'ellipsis',
|
|
271
310
|
whiteSpace: 'nowrap',
|
|
272
311
|
overflow: 'hidden',
|
|
273
312
|
padding: '8px 16px',
|
|
274
|
-
}, children: typeof row[column.field] === 'object'
|
|
313
|
+
} }, { children: typeof row[column.field] === 'object'
|
|
275
314
|
? JSON.stringify(row[column.field]).length > 55
|
|
276
315
|
? JSON.stringify(row[column.field]).substring(0, 52) + '...'
|
|
277
316
|
: JSON.stringify(row[column.field])
|
|
278
317
|
: row[column.field].length > 55
|
|
279
318
|
? row[column.field].substring(0, 52) + '...'
|
|
280
|
-
: row[column.field] }) }) }, 'sqlcell' + columnIndex))) }, 'sqlrow' + rowIndex)))) })] }) })] }));
|
|
319
|
+
: row[column.field] })) })) }), 'sqlcell' + columnIndex)); }) }), 'sqlrow' + rowIndex)); })) }))] })) }))] })));
|
|
281
320
|
}
|
|
282
|
-
return ((
|
|
283
|
-
...containerStyle,
|
|
321
|
+
return (_jsx("div", __assign({ style: __assign(__assign({}, containerStyle), {
|
|
284
322
|
// paddingLeft: 25,
|
|
285
323
|
// paddingRight: 25,
|
|
286
324
|
// borderRadius: 8,
|
|
287
325
|
// marginTop: 25,
|
|
288
|
-
overflow: 'visible',
|
|
289
|
-
height: height,
|
|
290
|
-
// overflow: 'hidden',
|
|
291
|
-
// @ts-ignore
|
|
292
|
-
// boxShadow: 'rgba(231, 231, 231, 0.5) 0px 1px 2px 0px',
|
|
293
|
-
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
326
|
+
overflow: 'visible', height: height }) }, { children: _jsx("div", __assign({ style: {
|
|
294
327
|
height: '100%',
|
|
295
328
|
overflow: 'scroll',
|
|
296
329
|
borderRadius: 6,
|
|
@@ -301,12 +334,12 @@ function SpecialTable({ columns, rows, height, containerStyle, loading, LoadingC
|
|
|
301
334
|
boxSizing: 'border-box',
|
|
302
335
|
outline: 'none',
|
|
303
336
|
// maxHeight: 600,
|
|
304
|
-
}, children: (
|
|
337
|
+
} }, { children: _jsxs("div", __assign({ role: "table", className: "table", style: { minWidth: '0px' } }, { children: [_jsx("div", __assign({ className: "thead" }, { children: _jsx("div", __assign({ role: "row", className: "tr", style: {
|
|
305
338
|
display: 'flex',
|
|
306
339
|
flex: '1 0 auto',
|
|
307
340
|
minWidth: '100px',
|
|
308
341
|
boxSizing: 'border-box',
|
|
309
|
-
}, children: columns.map((column, index)
|
|
342
|
+
} }, { children: columns.map(function (column, index) { return (_jsxs("div", __assign({
|
|
310
343
|
// @ts-ignore
|
|
311
344
|
style: {
|
|
312
345
|
boxSizing: 'border-box',
|
|
@@ -324,28 +357,28 @@ function SpecialTable({ columns, rows, height, containerStyle, loading, LoadingC
|
|
|
324
357
|
margin: '0px',
|
|
325
358
|
textOverflow: 'ellipsis',
|
|
326
359
|
minHeight: '36px',
|
|
327
|
-
}, children: [(
|
|
360
|
+
} }, { children: [_jsx("div", { style: { width: 16 } }), _jsx("div", __assign({ "aria-haspopup": "dialog", "aria-expanded": "false", "aria-controls": "mantine-r6-dropdown",
|
|
328
361
|
// @ts-ignore
|
|
329
362
|
style: {
|
|
330
363
|
// fontFamily:
|
|
331
364
|
// 'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',
|
|
332
365
|
WebkitTapHighlightColor: 'transparent',
|
|
333
|
-
fontFamily: theme
|
|
366
|
+
fontFamily: theme === null || theme === void 0 ? void 0 : theme.fontFamily,
|
|
334
367
|
// color: 'rgb(55, 65, 81)',
|
|
335
|
-
color: theme
|
|
368
|
+
color: theme === null || theme === void 0 ? void 0 : theme.primaryTextColor,
|
|
336
369
|
textDecoration: 'none',
|
|
337
|
-
fontSize: theme
|
|
338
|
-
fontWeight: theme
|
|
370
|
+
fontSize: (theme === null || theme === void 0 ? void 0 : theme.fontSizeSmall) || '14px',
|
|
371
|
+
fontWeight: (theme === null || theme === void 0 ? void 0 : theme.fontWeightMedium) || '500',
|
|
339
372
|
lineHeight: '20px',
|
|
340
373
|
textOverflow: 'ellipsis',
|
|
341
374
|
whiteSpace: 'nowrap',
|
|
342
375
|
overflow: 'hidden',
|
|
343
|
-
}, children: column.label })] }, 'sqlcol' + index))) }) }), (
|
|
376
|
+
} }, { children: column.label }))] }), 'sqlcol' + index)); }) })) })), _jsx("div", __assign({ role: "rowgroup", className: "tbody" }, { children: rows.map(function (row, rowIndex) { return (_jsx("div", __assign({ role: "row", className: "tr", style: {
|
|
344
377
|
display: 'flex',
|
|
345
378
|
flex: '1 0 auto',
|
|
346
379
|
minWidth: '100px',
|
|
347
380
|
boxSizing: 'border-box',
|
|
348
|
-
}, children: columns.map((column, columnIndex)
|
|
381
|
+
} }, { children: columns.map(function (column, columnIndex) { return (_jsx("div", __assign({ role: "cell", className: "td airplane-1h7muk6", style: {
|
|
349
382
|
boxSizing: 'border-box',
|
|
350
383
|
flex: '150 0 auto',
|
|
351
384
|
minWidth: '50px',
|
|
@@ -357,105 +390,118 @@ function SpecialTable({ columns, rows, height, containerStyle, loading, LoadingC
|
|
|
357
390
|
borderRight: '1px solid rgb(229, 231, 235)',
|
|
358
391
|
overflow: 'hidden',
|
|
359
392
|
borderTop: '1px solid rgb(229, 231, 235)',
|
|
360
|
-
}, children: (
|
|
393
|
+
} }, { children: _jsx("div", __assign({ style: {
|
|
361
394
|
lineHeight: '24px',
|
|
362
395
|
width: '100%',
|
|
363
396
|
display: 'flex',
|
|
364
397
|
cursor: 'default',
|
|
365
398
|
position: 'relative',
|
|
366
|
-
}, className: "airplane-gowkln", "data-testid": "static-cell", children: (
|
|
367
|
-
fontFamily: theme
|
|
399
|
+
}, className: "airplane-gowkln", "data-testid": "static-cell" }, { children: _jsx("div", __assign({ className: "airplane-Text-root airplane-mzqt6k", "aria-haspopup": "dialog", "aria-expanded": "false", "aria-controls": "mantine-r8-dropdown", id: "mantine-r8-target", style: {
|
|
400
|
+
fontFamily: (theme === null || theme === void 0 ? void 0 : theme.fontFamily) ||
|
|
368
401
|
'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"',
|
|
369
402
|
WebkitTapHighlightColor: 'transparent',
|
|
370
403
|
// color: 'rgb(55, 65, 81)',
|
|
371
|
-
color: theme
|
|
404
|
+
color: (theme === null || theme === void 0 ? void 0 : theme.secondaryTextColor) || 'rgb(55, 65, 81)',
|
|
372
405
|
textDecoration: 'none',
|
|
373
406
|
fontWeight: 400,
|
|
374
|
-
fontSize: theme
|
|
407
|
+
fontSize: (theme === null || theme === void 0 ? void 0 : theme.fontSizeSmall) || '14px',
|
|
375
408
|
lineHeight: '20px',
|
|
376
409
|
textOverflow: 'ellipsis',
|
|
377
410
|
whiteSpace: 'nowrap',
|
|
378
411
|
overflow: 'hidden',
|
|
379
412
|
padding: '8px 16px',
|
|
380
|
-
}, children: typeof row[column.field] === 'object'
|
|
413
|
+
} }, { children: typeof row[column.field] === 'object'
|
|
381
414
|
? JSON.stringify(row[column.field]).length > 55
|
|
382
415
|
? JSON.stringify(row[column.field]).substring(0, 52) + '...'
|
|
383
416
|
: JSON.stringify(row[column.field])
|
|
384
417
|
: row[column.field].length > 55
|
|
385
418
|
? row[column.field].substring(0, 52) + '...'
|
|
386
|
-
: row[column.field] }) }) }, 'sqlcell' + columnIndex))) }, 'sqlrow' + rowIndex))) })] }) }) }));
|
|
419
|
+
: row[column.field] })) })) }), 'sqlcell' + columnIndex)); }) }), 'sqlrow' + rowIndex)); }) }))] })) })) })));
|
|
387
420
|
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
(
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
421
|
+
var ChartUpdater = function (_a) {
|
|
422
|
+
var chartId = _a.chartId, containerStyle = _a.containerStyle, dashboard = _a.dashboard, dispatch = _a.dispatch, client = _a.client, theme = _a.theme, downloadCSV = _a.downloadCSV, csvFilename = _a.csvFilename;
|
|
423
|
+
var _b = useState(null), chartConfig = _b[0], setChartConfig = _b[1];
|
|
424
|
+
var _c = useState(true), loading = _c[0], setLoading = _c[1];
|
|
425
|
+
useEffect(function () {
|
|
426
|
+
var isSubscribed = true;
|
|
427
|
+
function getChartOptions(id) {
|
|
428
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
429
|
+
var _a, columns, rows, name_1, publicKey, customerId, environment, resp, _b, columns, rows, name_2, e_1;
|
|
430
|
+
return __generator(this, function (_c) {
|
|
431
|
+
switch (_c.label) {
|
|
432
|
+
case 0:
|
|
433
|
+
if (!isSubscribed) return [3 /*break*/, 4];
|
|
434
|
+
// @ts-ignore
|
|
435
|
+
if (dashboard && dashboard[id]) {
|
|
436
|
+
_a = dashboard[id], columns = _a.columns, rows = _a.rows, name_1 = _a.name;
|
|
437
|
+
setChartConfig({
|
|
438
|
+
columns: columns,
|
|
439
|
+
rows: rows,
|
|
440
|
+
name: name_1,
|
|
441
|
+
});
|
|
442
|
+
setLoading(false);
|
|
443
|
+
return [2 /*return*/];
|
|
444
|
+
}
|
|
445
|
+
publicKey = client.publicKey, customerId = client.customerId, environment = client.environment;
|
|
446
|
+
setLoading(true);
|
|
447
|
+
_c.label = 1;
|
|
448
|
+
case 1:
|
|
449
|
+
_c.trys.push([1, 3, , 4]);
|
|
450
|
+
return [4 /*yield*/, axios.get('https://quill-344421.uc.r.appspot.com/item', {
|
|
451
|
+
params: {
|
|
452
|
+
id: chartId,
|
|
453
|
+
orgId: customerId,
|
|
454
|
+
publicKey: publicKey,
|
|
455
|
+
},
|
|
456
|
+
headers: {
|
|
457
|
+
environment: environment || undefined,
|
|
458
|
+
},
|
|
459
|
+
})];
|
|
460
|
+
case 2:
|
|
461
|
+
resp = _c.sent();
|
|
462
|
+
_b = resp.data, columns = _b.columns, rows = _b.rows, name_2 = _b.name;
|
|
463
|
+
setChartConfig({
|
|
464
|
+
columns: columns,
|
|
465
|
+
rows: rows,
|
|
466
|
+
name: name_2,
|
|
467
|
+
});
|
|
468
|
+
setLoading(false);
|
|
469
|
+
return [3 /*break*/, 4];
|
|
470
|
+
case 3:
|
|
471
|
+
e_1 = _c.sent();
|
|
472
|
+
console.log('Error fetching chart: ', e_1);
|
|
473
|
+
setLoading(false);
|
|
474
|
+
return [3 /*break*/, 4];
|
|
475
|
+
case 4: return [2 /*return*/];
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
});
|
|
434
479
|
}
|
|
435
480
|
if (chartId && !chartConfig) {
|
|
436
481
|
getChartOptions(chartId);
|
|
437
482
|
}
|
|
438
|
-
return ()
|
|
483
|
+
return function () {
|
|
439
484
|
isSubscribed = false;
|
|
440
485
|
};
|
|
441
486
|
}, [chartConfig]);
|
|
442
|
-
|
|
487
|
+
var NUM_TO_SHOW = (containerStyle === null || containerStyle === void 0 ? void 0 : containerStyle.height)
|
|
443
488
|
? Math.floor(containerStyle.height / 40) - 1
|
|
444
489
|
: 6;
|
|
445
|
-
|
|
490
|
+
var memoizedData = useMemo(function () {
|
|
446
491
|
if (!chartConfig || !chartConfig.rows || !chartConfig.rows.length) {
|
|
447
492
|
return [];
|
|
448
493
|
}
|
|
449
494
|
// Deep copy of data
|
|
450
|
-
|
|
495
|
+
var copiedData = JSON.parse(JSON.stringify(chartConfig && chartConfig.rows && chartConfig.rows.length
|
|
451
496
|
? chartConfig.rows
|
|
452
497
|
: []));
|
|
453
|
-
return copiedData.map(item
|
|
454
|
-
|
|
455
|
-
for (
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
498
|
+
return copiedData.map(function (item) {
|
|
499
|
+
var fieldsWithFormattedValues = {};
|
|
500
|
+
for (var _i = 0, _a = chartConfig.columns; _i < _a.length; _i++) {
|
|
501
|
+
var field = _a[_i];
|
|
502
|
+
var value = item[field.field];
|
|
503
|
+
fieldsWithFormattedValues[field.field] = valueFormatter({
|
|
504
|
+
value: value,
|
|
459
505
|
field: field.field,
|
|
460
506
|
fields: chartConfig.columns,
|
|
461
507
|
});
|
|
@@ -463,101 +509,98 @@ const ChartUpdater = ({ chartId, containerStyle, dashboard, dispatch, client, th
|
|
|
463
509
|
return fieldsWithFormattedValues;
|
|
464
510
|
});
|
|
465
511
|
}, [chartConfig]);
|
|
466
|
-
|
|
512
|
+
var handleDownloadCSV = function () {
|
|
467
513
|
downloadCSV(memoizedData, chartConfig.name);
|
|
468
514
|
};
|
|
469
515
|
if (!chartConfig || loading) {
|
|
470
|
-
return ((
|
|
516
|
+
return (_jsx("div", __assign({
|
|
471
517
|
// className="flex flex-col flex-1 h-[100%]"
|
|
472
|
-
style: {
|
|
473
|
-
...containerStyle,
|
|
518
|
+
style: __assign(__assign({}, containerStyle), {
|
|
474
519
|
// marginLeft: 25,
|
|
475
520
|
// marginRight: 25,
|
|
476
|
-
boxSizing: 'content-box',
|
|
477
|
-
|
|
478
|
-
display: 'flex',
|
|
479
|
-
flexDirection: 'column',
|
|
480
|
-
flex: 1,
|
|
481
|
-
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
482
|
-
height: containerStyle?.height || 300,
|
|
521
|
+
boxSizing: 'content-box', height: '100%', display: 'flex', flexDirection: 'column', flex: 1 }) }, { children: _jsx("div", __assign({ style: {
|
|
522
|
+
height: (containerStyle === null || containerStyle === void 0 ? void 0 : containerStyle.height) || 300,
|
|
483
523
|
width: '100%',
|
|
484
524
|
boxSizing: 'content-box',
|
|
485
|
-
}, children: (
|
|
525
|
+
} }, { children: _jsx(Skeleton, { count: 1,
|
|
486
526
|
// height={containerStyle?.height}
|
|
487
|
-
height: containerStyle
|
|
488
|
-
? containerStyle
|
|
489
|
-
: containerStyle
|
|
490
|
-
? containerStyle
|
|
527
|
+
height: (containerStyle === null || containerStyle === void 0 ? void 0 : containerStyle.height) && (containerStyle === null || containerStyle === void 0 ? void 0 : containerStyle.marginTop)
|
|
528
|
+
? (containerStyle === null || containerStyle === void 0 ? void 0 : containerStyle.height) + (containerStyle === null || containerStyle === void 0 ? void 0 : containerStyle.marginTop)
|
|
529
|
+
: (containerStyle === null || containerStyle === void 0 ? void 0 : containerStyle.height)
|
|
530
|
+
? containerStyle === null || containerStyle === void 0 ? void 0 : containerStyle.height
|
|
491
531
|
: 300, borderRadius: 8,
|
|
492
532
|
// highlightColor="#F7F7F8"
|
|
493
533
|
highlightColor: "#FDFDFD",
|
|
494
534
|
// baseColor="#F3F4F6"
|
|
495
|
-
baseColor: "#F9F9FA", width: "100%" }) }) }));
|
|
535
|
+
baseColor: "#F9F9FA", width: "100%" }) })) })));
|
|
496
536
|
}
|
|
497
|
-
return ((
|
|
537
|
+
return (_jsx(SpecialTable, { showDownloadCsvButton: true, csvFilename: csvFilename || chartConfig.name, columns: chartConfig.columns, rows: memoizedData, height: (containerStyle === null || containerStyle === void 0 ? void 0 : containerStyle.height) || '100%', theme: theme }));
|
|
498
538
|
};
|
|
499
|
-
function Columns(
|
|
500
|
-
|
|
539
|
+
function Columns(_a) {
|
|
540
|
+
var columns = _a.columns, data = _a.data, theme = _a.theme, handleDownloadCSV = _a.handleDownloadCSV, numToShow = _a.numToShow;
|
|
541
|
+
return (_jsxs("div", __assign({ style: { display: 'flex', flexDirection: 'column', height: '100%' } }, { children: [_jsx("div", __assign({ style: {
|
|
501
542
|
display: 'flex',
|
|
502
543
|
flexDirection: 'row',
|
|
503
544
|
// overflowX: 'scroll',
|
|
504
545
|
// overflowY: 'hidden',
|
|
505
546
|
overflow: 'scroll',
|
|
506
547
|
height: '100%',
|
|
507
|
-
}, children: columns.map(elem
|
|
548
|
+
} }, { children: columns.map(function (elem) { return (_jsx(Column, { column: elem, data: data, theme: theme }, elem.field)); }) })), _jsxs("div", __assign({ style: {
|
|
508
549
|
display: 'flex',
|
|
509
550
|
flexDirection: 'row',
|
|
510
551
|
alignItems: 'center',
|
|
511
552
|
justifyContent: 'space-between',
|
|
512
553
|
// background: 'black',
|
|
513
|
-
}, children: [data.length > numToShow && ((
|
|
514
|
-
color: theme
|
|
554
|
+
} }, { children: [data.length > numToShow && (_jsxs("div", __assign({ style: {
|
|
555
|
+
color: theme === null || theme === void 0 ? void 0 : theme.chartLabelColor,
|
|
515
556
|
boxSizing: 'content-box',
|
|
516
|
-
fontFamily: theme
|
|
517
|
-
fontSize: theme
|
|
557
|
+
fontFamily: (theme === null || theme === void 0 ? void 0 : theme.chartLabelFontFamily) || (theme === null || theme === void 0 ? void 0 : theme.fontFamily),
|
|
558
|
+
fontSize: (theme === null || theme === void 0 ? void 0 : theme.fontSizeSmall) || '0.875rem',
|
|
518
559
|
marginLeft: 12,
|
|
519
560
|
marginTop: 8,
|
|
520
|
-
}, children: ["...", data.length - numToShow, " more"] })), (
|
|
561
|
+
} }, { children: ["...", data.length - numToShow, " more"] }))), _jsx("div", __assign({ onClick: handleDownloadCSV, style: {
|
|
521
562
|
height: 40,
|
|
522
563
|
minHeight: 40,
|
|
523
|
-
color: theme
|
|
564
|
+
color: theme === null || theme === void 0 ? void 0 : theme.primaryTextColor,
|
|
524
565
|
boxSizing: 'content-box',
|
|
525
|
-
fontFamily: theme
|
|
526
|
-
fontSize: theme
|
|
527
|
-
fontWeight: theme
|
|
566
|
+
fontFamily: (theme === null || theme === void 0 ? void 0 : theme.chartLabelFontFamily) || (theme === null || theme === void 0 ? void 0 : theme.fontFamily),
|
|
567
|
+
fontSize: (theme === null || theme === void 0 ? void 0 : theme.fontSizeSmall) || '0.875rem',
|
|
568
|
+
fontWeight: (theme === null || theme === void 0 ? void 0 : theme.fontWeightMedium) || '500',
|
|
528
569
|
marginTop: 8,
|
|
529
570
|
marginLeft: 20,
|
|
530
571
|
cursor: 'pointer',
|
|
531
|
-
}, children: "Download CSV" })] })] }));
|
|
572
|
+
} }, { children: "Download CSV" }))] }))] })));
|
|
532
573
|
}
|
|
533
|
-
function Column(
|
|
534
|
-
|
|
574
|
+
function Column(_a) {
|
|
575
|
+
var column = _a.column, data = _a.data, theme = _a.theme;
|
|
576
|
+
return (_jsxs("div", __assign({ style: {
|
|
535
577
|
paddingLeft: 20,
|
|
536
578
|
paddingRight: 20,
|
|
537
579
|
// width: 'max-content',
|
|
538
580
|
display: 'inline-flex',
|
|
539
581
|
flexDirection: 'column',
|
|
540
582
|
whiteSpace: 'nowrap',
|
|
541
|
-
}, children: [(
|
|
583
|
+
} }, { children: [_jsx("div", __assign({ style: {
|
|
542
584
|
height: 40,
|
|
543
585
|
minHeight: 40,
|
|
544
|
-
color: theme
|
|
586
|
+
color: theme === null || theme === void 0 ? void 0 : theme.primaryTextColor,
|
|
545
587
|
boxSizing: 'content-box',
|
|
546
|
-
fontFamily: theme
|
|
547
|
-
fontSize: theme
|
|
548
|
-
fontWeight: theme
|
|
549
|
-
}, children: column.label }), data.map(elem
|
|
588
|
+
fontFamily: (theme === null || theme === void 0 ? void 0 : theme.chartLabelFontFamily) || (theme === null || theme === void 0 ? void 0 : theme.fontFamily),
|
|
589
|
+
fontSize: (theme === null || theme === void 0 ? void 0 : theme.fontSizeSmall) || '0.875rem',
|
|
590
|
+
fontWeight: (theme === null || theme === void 0 ? void 0 : theme.fontWeightMedium) || '500',
|
|
591
|
+
} }, { children: column.label })), data.map(function (elem) { return (_jsx(Cell, { item: elem[column.field], theme: theme })); })] })));
|
|
550
592
|
}
|
|
551
|
-
function Cell(
|
|
552
|
-
|
|
593
|
+
function Cell(_a) {
|
|
594
|
+
var item = _a.item, theme = _a.theme;
|
|
595
|
+
return (_jsx("div", __assign({ style: {
|
|
553
596
|
height: 40,
|
|
554
597
|
minHeight: 40,
|
|
555
598
|
whiteSpace: 'nowrap',
|
|
556
599
|
width: '100%',
|
|
557
|
-
fontFamily: theme
|
|
558
|
-
fontSize: theme
|
|
559
|
-
color: theme
|
|
560
|
-
}, children: item }));
|
|
600
|
+
fontFamily: (theme === null || theme === void 0 ? void 0 : theme.chartLabelFontFamily) || (theme === null || theme === void 0 ? void 0 : theme.fontFamily),
|
|
601
|
+
fontSize: (theme === null || theme === void 0 ? void 0 : theme.fontSizeSmall) || '0.875rem',
|
|
602
|
+
color: theme === null || theme === void 0 ? void 0 : theme.chartLabelColor,
|
|
603
|
+
} }, { children: item })));
|
|
561
604
|
}
|
|
562
|
-
|
|
605
|
+
export default Table;
|
|
563
606
|
//# sourceMappingURL=Table.js.map
|