@quillsql/react 1.4.8 → 1.4.9
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/Chart.js +31 -21
- package/lib/Chart.js.map +1 -1
- package/lib/Context.js +2 -2
- package/lib/Context.js.map +1 -1
- package/lib/Table.js +627 -248
- package/lib/Table.js.map +1 -1
- package/package.json +1 -1
- package/src/Chart.tsx +40 -29
- package/src/Context.tsx +2 -2
- package/src/Table.tsx +0 -1
package/lib/Table.js
CHANGED
|
@@ -1,283 +1,662 @@
|
|
|
1
|
-
var __assign =
|
|
2
|
-
|
|
1
|
+
var __assign =
|
|
2
|
+
(this && this.__assign) ||
|
|
3
|
+
function () {
|
|
4
|
+
__assign =
|
|
5
|
+
Object.assign ||
|
|
6
|
+
function (t) {
|
|
3
7
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
s = arguments[i];
|
|
9
|
+
for (var p in s)
|
|
10
|
+
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
7
11
|
}
|
|
8
12
|
return t;
|
|
9
|
-
|
|
13
|
+
};
|
|
10
14
|
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __awaiter =
|
|
13
|
-
|
|
15
|
+
};
|
|
16
|
+
var __awaiter =
|
|
17
|
+
(this && this.__awaiter) ||
|
|
18
|
+
function (thisArg, _arguments, P, generator) {
|
|
19
|
+
function adopt(value) {
|
|
20
|
+
return value instanceof P
|
|
21
|
+
? value
|
|
22
|
+
: new P(function (resolve) {
|
|
23
|
+
resolve(value);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
14
26
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
27
|
+
function fulfilled(value) {
|
|
28
|
+
try {
|
|
29
|
+
step(generator.next(value));
|
|
30
|
+
} catch (e) {
|
|
31
|
+
reject(e);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function rejected(value) {
|
|
35
|
+
try {
|
|
36
|
+
step(generator['throw'](value));
|
|
37
|
+
} catch (e) {
|
|
38
|
+
reject(e);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function step(result) {
|
|
42
|
+
result.done
|
|
43
|
+
? resolve(result.value)
|
|
44
|
+
: adopt(result.value).then(fulfilled, rejected);
|
|
45
|
+
}
|
|
46
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
47
|
});
|
|
20
|
-
};
|
|
21
|
-
var __generator =
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
48
|
+
};
|
|
49
|
+
var __generator =
|
|
50
|
+
(this && this.__generator) ||
|
|
51
|
+
function (thisArg, body) {
|
|
52
|
+
var _ = {
|
|
53
|
+
label: 0,
|
|
54
|
+
sent: function () {
|
|
55
|
+
if (t[0] & 1) throw t[1];
|
|
56
|
+
return t[1];
|
|
57
|
+
},
|
|
58
|
+
trys: [],
|
|
59
|
+
ops: [],
|
|
60
|
+
},
|
|
61
|
+
f,
|
|
62
|
+
y,
|
|
63
|
+
t,
|
|
64
|
+
g;
|
|
65
|
+
return (
|
|
66
|
+
(g = { next: verb(0), throw: verb(1), return: verb(2) }),
|
|
67
|
+
typeof Symbol === 'function' &&
|
|
68
|
+
(g[Symbol.iterator] = function () {
|
|
69
|
+
return this;
|
|
70
|
+
}),
|
|
71
|
+
g
|
|
72
|
+
);
|
|
73
|
+
function verb(n) {
|
|
74
|
+
return function (v) {
|
|
75
|
+
return step([n, v]);
|
|
76
|
+
};
|
|
77
|
+
}
|
|
25
78
|
function step(op) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
79
|
+
if (f) throw new TypeError('Generator is already executing.');
|
|
80
|
+
while ((g && ((g = 0), op[0] && (_ = 0)), _))
|
|
81
|
+
try {
|
|
82
|
+
if (
|
|
83
|
+
((f = 1),
|
|
84
|
+
y &&
|
|
85
|
+
(t =
|
|
86
|
+
op[0] & 2
|
|
87
|
+
? y['return']
|
|
88
|
+
: op[0]
|
|
89
|
+
? y['throw'] || ((t = y['return']) && t.call(y), 0)
|
|
90
|
+
: y.next) &&
|
|
91
|
+
!(t = t.call(y, op[1])).done)
|
|
92
|
+
)
|
|
93
|
+
return t;
|
|
94
|
+
if (((y = 0), t)) op = [op[0] & 2, t.value];
|
|
95
|
+
switch (op[0]) {
|
|
96
|
+
case 0:
|
|
97
|
+
case 1:
|
|
98
|
+
t = op;
|
|
99
|
+
break;
|
|
100
|
+
case 4:
|
|
101
|
+
_.label++;
|
|
102
|
+
return { value: op[1], done: false };
|
|
103
|
+
case 5:
|
|
104
|
+
_.label++;
|
|
105
|
+
y = op[1];
|
|
106
|
+
op = [0];
|
|
107
|
+
continue;
|
|
108
|
+
case 7:
|
|
109
|
+
op = _.ops.pop();
|
|
110
|
+
_.trys.pop();
|
|
111
|
+
continue;
|
|
112
|
+
default:
|
|
113
|
+
if (
|
|
114
|
+
!((t = _.trys), (t = t.length > 0 && t[t.length - 1])) &&
|
|
115
|
+
(op[0] === 6 || op[0] === 2)
|
|
116
|
+
) {
|
|
117
|
+
_ = 0;
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
121
|
+
_.label = op[1];
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
125
|
+
_.label = t[1];
|
|
126
|
+
t = op;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
if (t && _.label < t[2]) {
|
|
130
|
+
_.label = t[2];
|
|
131
|
+
_.ops.push(op);
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
if (t[2]) _.ops.pop();
|
|
135
|
+
_.trys.pop();
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
op = body.call(thisArg, _);
|
|
139
|
+
} catch (e) {
|
|
140
|
+
op = [6, e];
|
|
141
|
+
y = 0;
|
|
142
|
+
} finally {
|
|
143
|
+
f = t = 0;
|
|
144
|
+
}
|
|
145
|
+
if (op[0] & 5) throw op[1];
|
|
146
|
+
return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
147
|
}
|
|
47
|
-
};
|
|
48
|
-
import { jsx as _jsx, jsxs as _jsxs } from
|
|
148
|
+
};
|
|
149
|
+
import { jsx as _jsx, jsxs as _jsxs } from 'react/jsx-runtime';
|
|
49
150
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
50
151
|
// @ts-nocheck
|
|
51
152
|
import { useContext, useEffect, useMemo, useState } from 'react';
|
|
52
153
|
import axios from 'axios';
|
|
53
|
-
import { ClientContext, DashboardContext, ThemeContext
|
|
154
|
+
import { ClientContext, DashboardContext, ThemeContext } from './Context';
|
|
54
155
|
import Skeleton from 'react-loading-skeleton';
|
|
55
156
|
import { valueFormatter } from './Chart';
|
|
56
157
|
var Table = function (_a) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
var csvString = csvRows.join('\r\n');
|
|
82
|
-
var csvBlob = new Blob([csvString], { type: 'text/csv' });
|
|
83
|
-
// Create a download link and click it
|
|
84
|
-
var downloadLink = document.createElement('a');
|
|
85
|
-
downloadLink.download = "".concat(name, ".csv");
|
|
86
|
-
downloadLink.href = URL.createObjectURL(csvBlob);
|
|
87
|
-
downloadLink.style.display = 'none';
|
|
88
|
-
document.body.appendChild(downloadLink);
|
|
89
|
-
downloadLink.click();
|
|
90
|
-
document.body.removeChild(downloadLink);
|
|
158
|
+
var chartId = _a.chartId,
|
|
159
|
+
containerStyle = _a.containerStyle;
|
|
160
|
+
var _b = useContext(DashboardContext),
|
|
161
|
+
dispatch = _b.dispatch,
|
|
162
|
+
dashboard = _b.dashboard;
|
|
163
|
+
var _c = useContext(ClientContext),
|
|
164
|
+
client = _c[0],
|
|
165
|
+
_ = _c[1];
|
|
166
|
+
var theme = useContext(ThemeContext)[0];
|
|
167
|
+
var downloadCSV = function (rows, name) {
|
|
168
|
+
// report.rows
|
|
169
|
+
if (!rows.length) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
var json = rows; // JSON data passed as a prop
|
|
173
|
+
var fields = Object.keys(json[0]); // Assumes all objects have same keys
|
|
174
|
+
var csvRows = [];
|
|
175
|
+
// Header row
|
|
176
|
+
csvRows.push(fields.join(','));
|
|
177
|
+
var _loop_1 = function (row) {
|
|
178
|
+
var values = fields.map(function (field) {
|
|
179
|
+
return JSON.stringify(row[field] || '');
|
|
180
|
+
});
|
|
181
|
+
csvRows.push(values.join(','));
|
|
91
182
|
};
|
|
92
|
-
|
|
183
|
+
// Data rows
|
|
184
|
+
for (var _i = 0, json_1 = json; _i < json_1.length; _i++) {
|
|
185
|
+
var row = json_1[_i];
|
|
186
|
+
_loop_1(row);
|
|
187
|
+
}
|
|
188
|
+
// Create CSV string and create a 'blob' with it
|
|
189
|
+
var csvString = csvRows.join('\r\n');
|
|
190
|
+
var csvBlob = new Blob([csvString], { type: 'text/csv' });
|
|
191
|
+
// Create a download link and click it
|
|
192
|
+
var downloadLink = document.createElement('a');
|
|
193
|
+
downloadLink.download = ''.concat(name, '.csv');
|
|
194
|
+
downloadLink.href = URL.createObjectURL(csvBlob);
|
|
195
|
+
downloadLink.style.display = 'none';
|
|
196
|
+
document.body.appendChild(downloadLink);
|
|
197
|
+
downloadLink.click();
|
|
198
|
+
document.body.removeChild(downloadLink);
|
|
199
|
+
};
|
|
200
|
+
return _jsx(ChartUpdater, {
|
|
201
|
+
dispatch: dispatch,
|
|
202
|
+
dashboard: dashboard,
|
|
203
|
+
chartId: chartId,
|
|
204
|
+
containerStyle: containerStyle,
|
|
205
|
+
client: client,
|
|
206
|
+
theme: theme,
|
|
207
|
+
downloadCSV: downloadCSV,
|
|
208
|
+
});
|
|
93
209
|
};
|
|
94
210
|
var ChartUpdater = function (_a) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
value: value,
|
|
175
|
-
field: field.field,
|
|
176
|
-
fields: chartConfig.columns,
|
|
211
|
+
var chartId = _a.chartId,
|
|
212
|
+
containerStyle = _a.containerStyle,
|
|
213
|
+
dashboard = _a.dashboard,
|
|
214
|
+
dispatch = _a.dispatch,
|
|
215
|
+
client = _a.client,
|
|
216
|
+
theme = _a.theme,
|
|
217
|
+
downloadCSV = _a.downloadCSV;
|
|
218
|
+
var _b = useState(null),
|
|
219
|
+
chartConfig = _b[0],
|
|
220
|
+
setChartConfig = _b[1];
|
|
221
|
+
var _c = useState(true),
|
|
222
|
+
loading = _c[0],
|
|
223
|
+
setLoading = _c[1];
|
|
224
|
+
useEffect(
|
|
225
|
+
function () {
|
|
226
|
+
var isSubscribed = true;
|
|
227
|
+
function getChartOptions(id) {
|
|
228
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
229
|
+
var _a,
|
|
230
|
+
columns,
|
|
231
|
+
rows,
|
|
232
|
+
name_1,
|
|
233
|
+
publicKey,
|
|
234
|
+
customerId,
|
|
235
|
+
environment,
|
|
236
|
+
resp,
|
|
237
|
+
_b,
|
|
238
|
+
columns,
|
|
239
|
+
rows,
|
|
240
|
+
name_2,
|
|
241
|
+
e_1;
|
|
242
|
+
return __generator(this, function (_c) {
|
|
243
|
+
switch (_c.label) {
|
|
244
|
+
case 0:
|
|
245
|
+
if (!isSubscribed) return [3 /*break*/, 4];
|
|
246
|
+
// @ts-ignore
|
|
247
|
+
if (dashboard && dashboard[id]) {
|
|
248
|
+
(_a = dashboard[id]),
|
|
249
|
+
(columns = _a.columns),
|
|
250
|
+
(rows = _a.rows),
|
|
251
|
+
(name_1 = _a.name);
|
|
252
|
+
setChartConfig({
|
|
253
|
+
columns: columns,
|
|
254
|
+
rows: rows,
|
|
255
|
+
name: name_1,
|
|
256
|
+
});
|
|
257
|
+
setLoading(false);
|
|
258
|
+
return [2 /*return*/];
|
|
259
|
+
}
|
|
260
|
+
(publicKey = client.publicKey),
|
|
261
|
+
(customerId = client.customerId),
|
|
262
|
+
(environment = client.environment);
|
|
263
|
+
setLoading(true);
|
|
264
|
+
_c.label = 1;
|
|
265
|
+
case 1:
|
|
266
|
+
_c.trys.push([1, 3, , 4]);
|
|
267
|
+
return [
|
|
268
|
+
4 /*yield*/,
|
|
269
|
+
axios.get('https://quill-344421.uc.r.appspot.com/item', {
|
|
270
|
+
params: {
|
|
271
|
+
id: chartId,
|
|
272
|
+
orgId: customerId,
|
|
273
|
+
publicKey: publicKey,
|
|
274
|
+
},
|
|
275
|
+
headers: {
|
|
276
|
+
environment: environment || undefined,
|
|
277
|
+
},
|
|
278
|
+
}),
|
|
279
|
+
];
|
|
280
|
+
case 2:
|
|
281
|
+
resp = _c.sent();
|
|
282
|
+
(_b = resp.data),
|
|
283
|
+
(columns = _b.columns),
|
|
284
|
+
(rows = _b.rows),
|
|
285
|
+
(name_2 = _b.name);
|
|
286
|
+
setChartConfig({
|
|
287
|
+
columns: columns,
|
|
288
|
+
rows: rows,
|
|
289
|
+
name: name_2,
|
|
177
290
|
});
|
|
291
|
+
setLoading(false);
|
|
292
|
+
return [3 /*break*/, 4];
|
|
293
|
+
case 3:
|
|
294
|
+
e_1 = _c.sent();
|
|
295
|
+
console.log('Error fetching chart: ', e_1);
|
|
296
|
+
setLoading(false);
|
|
297
|
+
return [3 /*break*/, 4];
|
|
298
|
+
case 4:
|
|
299
|
+
return [2 /*return*/];
|
|
178
300
|
}
|
|
179
|
-
|
|
301
|
+
});
|
|
180
302
|
});
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
303
|
+
}
|
|
304
|
+
if (chartId && !chartConfig) {
|
|
305
|
+
getChartOptions(chartId);
|
|
306
|
+
}
|
|
307
|
+
return function () {
|
|
308
|
+
isSubscribed = false;
|
|
309
|
+
};
|
|
310
|
+
},
|
|
311
|
+
[chartConfig]
|
|
312
|
+
);
|
|
313
|
+
var NUM_TO_SHOW = (
|
|
314
|
+
containerStyle === null || containerStyle === void 0
|
|
315
|
+
? void 0
|
|
316
|
+
: containerStyle.height
|
|
317
|
+
)
|
|
318
|
+
? Math.floor(containerStyle.height / 40) - 1
|
|
319
|
+
: 6;
|
|
320
|
+
var memoizedData = useMemo(
|
|
321
|
+
function () {
|
|
322
|
+
// Deep copy of data
|
|
323
|
+
var copiedData = JSON.parse(
|
|
324
|
+
JSON.stringify(
|
|
325
|
+
chartConfig && chartConfig.rows && chartConfig.rows.length
|
|
326
|
+
? chartConfig.rows
|
|
327
|
+
: []
|
|
328
|
+
)
|
|
329
|
+
);
|
|
330
|
+
return copiedData.slice(0, NUM_TO_SHOW).map(function (item) {
|
|
331
|
+
var fieldsWithFormattedValues = {};
|
|
332
|
+
for (var _i = 0, _a = chartConfig.columns; _i < _a.length; _i++) {
|
|
333
|
+
var field = _a[_i];
|
|
334
|
+
var value = item[field.field];
|
|
335
|
+
fieldsWithFormattedValues[field.field] = valueFormatter({
|
|
336
|
+
value: value,
|
|
337
|
+
field: field.field,
|
|
338
|
+
fields: chartConfig.columns,
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
return fieldsWithFormattedValues;
|
|
342
|
+
});
|
|
343
|
+
},
|
|
344
|
+
[chartConfig, NUM_TO_SHOW]
|
|
345
|
+
);
|
|
346
|
+
var handleDownloadCSV = function () {
|
|
347
|
+
downloadCSV(memoizedData, chartConfig.name);
|
|
348
|
+
};
|
|
349
|
+
if (!chartConfig || loading || !memoizedData.length) {
|
|
350
|
+
return _jsx(
|
|
351
|
+
'div',
|
|
352
|
+
__assign(
|
|
353
|
+
{
|
|
354
|
+
// className="flex flex-col flex-1 h-[100%]"
|
|
355
|
+
style: __assign(__assign({}, containerStyle), {
|
|
356
|
+
marginLeft: 25,
|
|
357
|
+
marginRight: 25,
|
|
205
358
|
boxSizing: 'content-box',
|
|
206
|
-
height:
|
|
207
|
-
marginTop: 20,
|
|
208
|
-
// overflow: 'hidden',
|
|
359
|
+
height: '100%',
|
|
209
360
|
display: 'flex',
|
|
210
|
-
marginLeft: '1rem',
|
|
211
361
|
flexDirection: 'column',
|
|
212
|
-
|
|
213
|
-
|
|
362
|
+
flex: 1,
|
|
363
|
+
}),
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
children: _jsx(
|
|
367
|
+
'div',
|
|
368
|
+
__assign(
|
|
369
|
+
{
|
|
370
|
+
style: {
|
|
371
|
+
height:
|
|
372
|
+
(containerStyle === null || containerStyle === void 0
|
|
373
|
+
? void 0
|
|
374
|
+
: containerStyle.height) || 300,
|
|
375
|
+
width: '100%',
|
|
376
|
+
boxSizing: 'content-box',
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
children: _jsx(Skeleton, {
|
|
381
|
+
count: 1,
|
|
382
|
+
// height={containerStyle?.height}
|
|
383
|
+
height:
|
|
384
|
+
(containerStyle === null || containerStyle === void 0
|
|
385
|
+
? void 0
|
|
386
|
+
: containerStyle.height) &&
|
|
387
|
+
(containerStyle === null || containerStyle === void 0
|
|
388
|
+
? void 0
|
|
389
|
+
: containerStyle.marginTop)
|
|
390
|
+
? (containerStyle === null || containerStyle === void 0
|
|
391
|
+
? void 0
|
|
392
|
+
: containerStyle.height) +
|
|
393
|
+
(containerStyle === null || containerStyle === void 0
|
|
394
|
+
? void 0
|
|
395
|
+
: containerStyle.marginTop)
|
|
396
|
+
: (
|
|
397
|
+
containerStyle === null || containerStyle === void 0
|
|
398
|
+
? void 0
|
|
399
|
+
: containerStyle.height
|
|
400
|
+
)
|
|
401
|
+
? containerStyle === null || containerStyle === void 0
|
|
402
|
+
? void 0
|
|
403
|
+
: containerStyle.height
|
|
404
|
+
: 300,
|
|
405
|
+
borderRadius: 8,
|
|
406
|
+
// highlightColor="#F7F7F8"
|
|
407
|
+
highlightColor: '#FDFDFD',
|
|
408
|
+
// baseColor="#F3F4F6"
|
|
409
|
+
baseColor: '#F9F9FA',
|
|
410
|
+
width: '100%',
|
|
411
|
+
}),
|
|
412
|
+
}
|
|
413
|
+
)
|
|
414
|
+
),
|
|
415
|
+
}
|
|
416
|
+
)
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
return _jsx(
|
|
420
|
+
'div',
|
|
421
|
+
__assign(
|
|
422
|
+
{
|
|
423
|
+
style: {
|
|
424
|
+
boxSizing: 'content-box',
|
|
425
|
+
height:
|
|
426
|
+
(containerStyle === null || containerStyle === void 0
|
|
427
|
+
? void 0
|
|
428
|
+
: containerStyle.height) || '100%',
|
|
429
|
+
marginTop: 20,
|
|
430
|
+
// overflow: 'hidden',
|
|
431
|
+
display: 'flex',
|
|
432
|
+
marginLeft: '1rem',
|
|
433
|
+
flexDirection: 'column',
|
|
434
|
+
// justifyContent: 'space-between',
|
|
435
|
+
},
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
children: _jsx(Columns, {
|
|
439
|
+
columns: chartConfig.columns,
|
|
440
|
+
data: memoizedData,
|
|
441
|
+
theme: theme,
|
|
442
|
+
handleDownloadCSV: handleDownloadCSV,
|
|
443
|
+
numToShow: NUM_TO_SHOW,
|
|
444
|
+
}),
|
|
445
|
+
}
|
|
446
|
+
)
|
|
447
|
+
);
|
|
214
448
|
};
|
|
215
449
|
function Columns(_a) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
450
|
+
var columns = _a.columns,
|
|
451
|
+
data = _a.data,
|
|
452
|
+
theme = _a.theme,
|
|
453
|
+
handleDownloadCSV = _a.handleDownloadCSV,
|
|
454
|
+
numToShow = _a.numToShow;
|
|
455
|
+
return _jsxs(
|
|
456
|
+
'div',
|
|
457
|
+
__assign(
|
|
458
|
+
{ style: { display: 'flex', flexDirection: 'column', height: '100%' } },
|
|
459
|
+
{
|
|
460
|
+
children: [
|
|
461
|
+
_jsx(
|
|
462
|
+
'div',
|
|
463
|
+
__assign(
|
|
464
|
+
{
|
|
465
|
+
style: {
|
|
466
|
+
display: 'flex',
|
|
467
|
+
flexDirection: 'row',
|
|
468
|
+
// overflowX: 'scroll',
|
|
469
|
+
// overflowY: 'hidden',
|
|
470
|
+
overflow: 'scroll',
|
|
471
|
+
height: '100%',
|
|
472
|
+
},
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
children: columns.map(function (elem) {
|
|
476
|
+
return _jsx(
|
|
477
|
+
Column,
|
|
478
|
+
{ column: elem, data: data, theme: theme },
|
|
479
|
+
elem.field
|
|
480
|
+
);
|
|
481
|
+
}),
|
|
482
|
+
}
|
|
483
|
+
)
|
|
484
|
+
),
|
|
485
|
+
_jsxs(
|
|
486
|
+
'div',
|
|
487
|
+
__assign(
|
|
488
|
+
{
|
|
489
|
+
style: {
|
|
490
|
+
display: 'flex',
|
|
491
|
+
flexDirection: 'row',
|
|
492
|
+
alignItems: 'center',
|
|
493
|
+
justifyContent: 'space-between',
|
|
494
|
+
// background: 'black',
|
|
495
|
+
},
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
children: [
|
|
499
|
+
data.length > numToShow &&
|
|
500
|
+
_jsxs(
|
|
501
|
+
'div',
|
|
502
|
+
__assign(
|
|
503
|
+
{
|
|
504
|
+
style: {
|
|
505
|
+
color:
|
|
506
|
+
theme === null || theme === void 0
|
|
507
|
+
? void 0
|
|
508
|
+
: theme.chartLabelColor,
|
|
233
509
|
boxSizing: 'content-box',
|
|
234
|
-
fontFamily:
|
|
235
|
-
|
|
510
|
+
fontFamily:
|
|
511
|
+
(theme === null || theme === void 0
|
|
512
|
+
? void 0
|
|
513
|
+
: theme.chartLabelFontFamily) ||
|
|
514
|
+
(theme === null || theme === void 0
|
|
515
|
+
? void 0
|
|
516
|
+
: theme.fontFamily),
|
|
517
|
+
fontSize:
|
|
518
|
+
(theme === null || theme === void 0
|
|
519
|
+
? void 0
|
|
520
|
+
: theme.fontSizeSmall) || '0.875rem',
|
|
236
521
|
marginLeft: 12,
|
|
237
522
|
marginTop: 8,
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
523
|
+
},
|
|
524
|
+
},
|
|
525
|
+
{ children: ['...', data.length - numToShow, ' more'] }
|
|
526
|
+
)
|
|
527
|
+
),
|
|
528
|
+
_jsx(
|
|
529
|
+
'div',
|
|
530
|
+
__assign(
|
|
531
|
+
{
|
|
532
|
+
onClick: handleDownloadCSV,
|
|
533
|
+
style: {
|
|
534
|
+
height: 40,
|
|
535
|
+
minHeight: 40,
|
|
536
|
+
color:
|
|
537
|
+
theme === null || theme === void 0
|
|
538
|
+
? void 0
|
|
539
|
+
: theme.primaryTextColor,
|
|
540
|
+
boxSizing: 'content-box',
|
|
541
|
+
fontFamily:
|
|
542
|
+
(theme === null || theme === void 0
|
|
543
|
+
? void 0
|
|
544
|
+
: theme.chartLabelFontFamily) ||
|
|
545
|
+
(theme === null || theme === void 0
|
|
546
|
+
? void 0
|
|
547
|
+
: theme.fontFamily),
|
|
548
|
+
fontSize:
|
|
549
|
+
(theme === null || theme === void 0
|
|
550
|
+
? void 0
|
|
551
|
+
: theme.fontSizeSmall) || '0.875rem',
|
|
552
|
+
fontWeight:
|
|
553
|
+
(theme === null || theme === void 0
|
|
554
|
+
? void 0
|
|
555
|
+
: theme.fontWeightMedium) || '500',
|
|
556
|
+
marginTop: 8,
|
|
557
|
+
marginLeft: 20,
|
|
558
|
+
cursor: 'pointer',
|
|
559
|
+
},
|
|
560
|
+
},
|
|
561
|
+
{ children: 'Download CSV' }
|
|
562
|
+
)
|
|
563
|
+
),
|
|
564
|
+
],
|
|
565
|
+
}
|
|
566
|
+
)
|
|
567
|
+
),
|
|
568
|
+
],
|
|
569
|
+
}
|
|
570
|
+
)
|
|
571
|
+
);
|
|
250
572
|
}
|
|
251
573
|
function Column(_a) {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
574
|
+
var column = _a.column,
|
|
575
|
+
data = _a.data,
|
|
576
|
+
theme = _a.theme;
|
|
577
|
+
return _jsxs(
|
|
578
|
+
'div',
|
|
579
|
+
__assign(
|
|
580
|
+
{
|
|
581
|
+
style: {
|
|
582
|
+
paddingLeft: 20,
|
|
583
|
+
paddingRight: 20,
|
|
584
|
+
// width: 'max-content',
|
|
585
|
+
display: 'inline-flex',
|
|
586
|
+
flexDirection: 'column',
|
|
587
|
+
whiteSpace: 'nowrap',
|
|
588
|
+
},
|
|
589
|
+
},
|
|
590
|
+
{
|
|
591
|
+
children: [
|
|
592
|
+
_jsx(
|
|
593
|
+
'div',
|
|
594
|
+
__assign(
|
|
595
|
+
{
|
|
596
|
+
style: {
|
|
597
|
+
height: 40,
|
|
598
|
+
minHeight: 40,
|
|
599
|
+
color:
|
|
600
|
+
theme === null || theme === void 0
|
|
601
|
+
? void 0
|
|
602
|
+
: theme.primaryTextColor,
|
|
603
|
+
boxSizing: 'content-box',
|
|
604
|
+
fontFamily:
|
|
605
|
+
(theme === null || theme === void 0
|
|
606
|
+
? void 0
|
|
607
|
+
: theme.chartLabelFontFamily) ||
|
|
608
|
+
(theme === null || theme === void 0
|
|
609
|
+
? void 0
|
|
610
|
+
: theme.fontFamily),
|
|
611
|
+
fontSize:
|
|
612
|
+
(theme === null || theme === void 0
|
|
613
|
+
? void 0
|
|
614
|
+
: theme.fontSizeSmall) || '0.875rem',
|
|
615
|
+
fontWeight:
|
|
616
|
+
(theme === null || theme === void 0
|
|
617
|
+
? void 0
|
|
618
|
+
: theme.fontWeightMedium) || '500',
|
|
619
|
+
},
|
|
620
|
+
},
|
|
621
|
+
{ children: column.label }
|
|
622
|
+
)
|
|
623
|
+
),
|
|
624
|
+
data.map(function (elem) {
|
|
625
|
+
return _jsx(Cell, { item: elem[column.field], theme: theme });
|
|
626
|
+
}),
|
|
627
|
+
],
|
|
628
|
+
}
|
|
629
|
+
)
|
|
630
|
+
);
|
|
269
631
|
}
|
|
270
632
|
function Cell(_a) {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
633
|
+
var item = _a.item,
|
|
634
|
+
theme = _a.theme;
|
|
635
|
+
return _jsx(
|
|
636
|
+
'div',
|
|
637
|
+
__assign(
|
|
638
|
+
{
|
|
639
|
+
style: {
|
|
640
|
+
height: 40,
|
|
641
|
+
minHeight: 40,
|
|
642
|
+
whiteSpace: 'nowrap',
|
|
643
|
+
width: '100%',
|
|
644
|
+
fontFamily:
|
|
645
|
+
(theme === null || theme === void 0
|
|
646
|
+
? void 0
|
|
647
|
+
: theme.chartLabelFontFamily) ||
|
|
648
|
+
(theme === null || theme === void 0 ? void 0 : theme.fontFamily),
|
|
649
|
+
fontSize:
|
|
650
|
+
(theme === null || theme === void 0
|
|
651
|
+
? void 0
|
|
652
|
+
: theme.fontSizeSmall) || '0.875rem',
|
|
653
|
+
color:
|
|
654
|
+
theme === null || theme === void 0 ? void 0 : theme.chartLabelColor,
|
|
655
|
+
},
|
|
656
|
+
},
|
|
657
|
+
{ children: item }
|
|
658
|
+
)
|
|
659
|
+
);
|
|
281
660
|
}
|
|
282
661
|
export default Table;
|
|
283
|
-
//# sourceMappingURL=Table.js.map
|
|
662
|
+
//# sourceMappingURL=Table.js.map
|