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