@quillsql/react 2.11.12 → 2.11.13
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/dist/cjs/ChartBuilder.d.ts.map +1 -1
- package/dist/cjs/ChartBuilder.js +1 -1
- package/dist/cjs/Dashboard.js +1 -1
- package/dist/cjs/ReportBuilder.d.ts.map +1 -1
- package/dist/cjs/ReportBuilder.js +167 -68
- package/dist/cjs/SQLEditor.d.ts.map +1 -1
- package/dist/cjs/SQLEditor.js +1 -0
- package/dist/cjs/components/Chart/ChartTooltipFrame.d.ts.map +1 -1
- package/dist/cjs/components/Chart/ChartTooltipFrame.js +1 -0
- package/dist/cjs/components/Chart/LineChart.d.ts.map +1 -1
- package/dist/cjs/components/Chart/LineChart.js +3 -0
- package/dist/cjs/components/QuillSelect.d.ts.map +1 -1
- package/dist/cjs/components/QuillSelect.js +7 -1
- package/dist/cjs/components/ReportBuilder/AddColumnPopover.js +3 -3
- package/dist/cjs/components/ReportBuilder/AddLimitPopover.d.ts +3 -0
- package/dist/cjs/components/ReportBuilder/AddLimitPopover.d.ts.map +1 -0
- package/dist/cjs/components/ReportBuilder/AddLimitPopover.js +43 -0
- package/dist/cjs/components/ReportBuilder/AddSortPopover.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/AddSortPopover.js +10 -4
- package/dist/cjs/components/ReportBuilder/bigDateMap.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/bigDateMap.js +2 -1
- package/dist/cjs/components/ReportBuilder/ui.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/ui.js +4 -3
- package/dist/cjs/components/ReportBuilder/util.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/util.js +7 -5
- package/dist/cjs/internals/ReportBuilder/PivotModal.d.ts +2 -1
- package/dist/cjs/internals/ReportBuilder/PivotModal.d.ts.map +1 -1
- package/dist/cjs/internals/ReportBuilder/PivotModal.js +26 -29
- package/dist/cjs/utils/getDomain.d.ts.map +1 -1
- package/dist/cjs/utils/getDomain.js +3 -0
- package/dist/esm/ChartBuilder.d.ts.map +1 -1
- package/dist/esm/ChartBuilder.js +1 -1
- package/dist/esm/Dashboard.js +1 -1
- package/dist/esm/ReportBuilder.d.ts.map +1 -1
- package/dist/esm/ReportBuilder.js +167 -68
- package/dist/esm/SQLEditor.d.ts.map +1 -1
- package/dist/esm/SQLEditor.js +1 -0
- package/dist/esm/components/Chart/ChartTooltipFrame.d.ts.map +1 -1
- package/dist/esm/components/Chart/ChartTooltipFrame.js +1 -0
- package/dist/esm/components/Chart/LineChart.d.ts.map +1 -1
- package/dist/esm/components/Chart/LineChart.js +3 -0
- package/dist/esm/components/QuillSelect.d.ts.map +1 -1
- package/dist/esm/components/QuillSelect.js +7 -1
- package/dist/esm/components/ReportBuilder/AddColumnPopover.js +3 -3
- package/dist/esm/components/ReportBuilder/AddLimitPopover.d.ts +3 -0
- package/dist/esm/components/ReportBuilder/AddLimitPopover.d.ts.map +1 -0
- package/dist/esm/components/ReportBuilder/AddLimitPopover.js +38 -0
- package/dist/esm/components/ReportBuilder/AddSortPopover.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/AddSortPopover.js +10 -4
- package/dist/esm/components/ReportBuilder/bigDateMap.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/bigDateMap.js +2 -1
- package/dist/esm/components/ReportBuilder/ui.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/ui.js +4 -3
- package/dist/esm/components/ReportBuilder/util.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/util.js +7 -5
- package/dist/esm/internals/ReportBuilder/PivotModal.d.ts +2 -1
- package/dist/esm/internals/ReportBuilder/PivotModal.d.ts.map +1 -1
- package/dist/esm/internals/ReportBuilder/PivotModal.js +26 -29
- package/dist/esm/utils/getDomain.d.ts.map +1 -1
- package/dist/esm/utils/getDomain.js +3 -0
- package/package.json +2 -2
|
@@ -21,6 +21,8 @@ import { PivotModal, generatePivotTable, } from './internals/ReportBuilder/Pivot
|
|
|
21
21
|
import { PivotCard } from './internals/ReportBuilder/PivotList';
|
|
22
22
|
import QuillTable from './components/QuillTable';
|
|
23
23
|
import { QuillSelectComponent } from './components/QuillSelect';
|
|
24
|
+
import { snakeCaseToTitleCase } from './utils/textProcessing';
|
|
25
|
+
import { AddLimitPopover, LimitSentence, } from './components/ReportBuilder/AddLimitPopover';
|
|
24
26
|
/**
|
|
25
27
|
* Quill Report Builder
|
|
26
28
|
*
|
|
@@ -85,7 +87,7 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
85
87
|
return columns.map((col) => ({
|
|
86
88
|
label: col,
|
|
87
89
|
name: col,
|
|
88
|
-
displayName: col,
|
|
90
|
+
displayName: snakeCaseToTitleCase(col),
|
|
89
91
|
field: col,
|
|
90
92
|
format: getPostgresBasicType(fields.find((f) => f.name === col))?.replace('number', 'whole_number') || 'string',
|
|
91
93
|
fieldType: schemaTables
|
|
@@ -117,6 +119,7 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
117
119
|
// setUniqueValues({});
|
|
118
120
|
setPivot(null);
|
|
119
121
|
setPivotData(null);
|
|
122
|
+
setRecommendedPivots([]);
|
|
120
123
|
}, 0);
|
|
121
124
|
};
|
|
122
125
|
useEffect(() => {
|
|
@@ -268,19 +271,36 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
268
271
|
};
|
|
269
272
|
const fetchSchema = async () => {
|
|
270
273
|
try {
|
|
271
|
-
const response = await fetch(
|
|
274
|
+
const response = await fetch(`${client.queryEndpoint}`, {
|
|
275
|
+
method: 'POST',
|
|
276
|
+
headers: {
|
|
277
|
+
...client.queryHeaders,
|
|
278
|
+
'Content-Type': 'application/json',
|
|
279
|
+
},
|
|
280
|
+
body: JSON.stringify({
|
|
281
|
+
metadata: {
|
|
282
|
+
clientId: client.publicKey,
|
|
283
|
+
publicKey: client.publicKey,
|
|
284
|
+
task: 'schema',
|
|
285
|
+
removeCustomerField: true,
|
|
286
|
+
},
|
|
287
|
+
}),
|
|
288
|
+
});
|
|
289
|
+
const results = await response.json();
|
|
272
290
|
// Filter out hidden columns on tables back from schema2.
|
|
273
|
-
const tables =
|
|
274
|
-
for (const table of tables) {
|
|
275
|
-
table.columns = table.columns.filter((column) =>
|
|
276
|
-
// Quick and dirty fix for removing org ids from response.
|
|
277
|
-
// TODO: Fix this on the backend or something.
|
|
278
|
-
column.isVisible && column.displayName !== 'pm_company_id');
|
|
279
|
-
}
|
|
291
|
+
const tables = results.data.tables || results.data.data.tables;
|
|
280
292
|
setSchemaTables(tables ?? []);
|
|
281
|
-
setOrderedColumnNames((tables ?? [])
|
|
282
|
-
|
|
283
|
-
.
|
|
293
|
+
setOrderedColumnNames((tables ?? []).flatMap((table) => table.columns
|
|
294
|
+
.map((c) => `${table.name}.${c.name}`)
|
|
295
|
+
.sort((a, b) => {
|
|
296
|
+
const aIsId = a.endsWith('.id') || a.endsWith('_id');
|
|
297
|
+
const bIsId = b.endsWith('.id') || b.endsWith('_id');
|
|
298
|
+
if (aIsId && !bIsId)
|
|
299
|
+
return 1;
|
|
300
|
+
if (bIsId && !aIsId)
|
|
301
|
+
return -1;
|
|
302
|
+
return 0;
|
|
303
|
+
})));
|
|
284
304
|
// Fetch all the unique values in parallel
|
|
285
305
|
const pendingFetches = [];
|
|
286
306
|
for (let table of tables ?? []) {
|
|
@@ -305,6 +325,12 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
305
325
|
if (hashCode(uniqueValues) !== hashCode(newUniqueValues)) {
|
|
306
326
|
setUniqueValues(newUniqueValues);
|
|
307
327
|
}
|
|
328
|
+
if (initialTableName) {
|
|
329
|
+
const columnsForTable = tables
|
|
330
|
+
.find((t) => t.name === initialTableName)
|
|
331
|
+
?.columns.map((c) => c.name);
|
|
332
|
+
await handleAsk(`get ${columnsForTable} from ${initialTableName}`);
|
|
333
|
+
}
|
|
308
334
|
}
|
|
309
335
|
catch (error) {
|
|
310
336
|
console.error(error);
|
|
@@ -607,6 +633,9 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
607
633
|
};
|
|
608
634
|
// Function to handle operator changes
|
|
609
635
|
const handleOperatorChange = (value, node, keyPrefix, column = null) => {
|
|
636
|
+
if (!keyPrefix) {
|
|
637
|
+
setTopLevelBinaryOperator(value);
|
|
638
|
+
}
|
|
610
639
|
if (isPending) {
|
|
611
640
|
updateActiveItem([{ path: keyPrefix + 'operator', value }], { column });
|
|
612
641
|
}
|
|
@@ -721,7 +750,7 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
721
750
|
handleReplaceSubtree(keyPrefix, newSubtree);
|
|
722
751
|
}
|
|
723
752
|
}, options: getAllPossibleColumns().map((column) => ({
|
|
724
|
-
label: column.displayName,
|
|
753
|
+
label: snakeCaseToTitleCase(column.displayName),
|
|
725
754
|
value: column.name,
|
|
726
755
|
})) }), _jsx(Select, { theme: theme, value: dateFilterType, onChange: (value) => {
|
|
727
756
|
if (value === dateFilterType)
|
|
@@ -815,7 +844,7 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
815
844
|
else if (isInTheLastInterval(node, client.databaseType)) {
|
|
816
845
|
const { dateColumn, dateFilterType, intervalCount, intervalType } = getDateFilterInfo(node);
|
|
817
846
|
const options = getAllPossibleColumns().map((column) => ({
|
|
818
|
-
label: column.displayName,
|
|
847
|
+
label: snakeCaseToTitleCase(column.displayName),
|
|
819
848
|
value: column.name,
|
|
820
849
|
}));
|
|
821
850
|
const plural = node.right.args.value[1].expr.value > 1 ? 's' : '';
|
|
@@ -866,7 +895,7 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
866
895
|
else if (isTheCurrentInterval(node, client.databaseType)) {
|
|
867
896
|
const { dateFilterType } = getDateFilterInfo(node);
|
|
868
897
|
const options = getAllPossibleColumns().map((column) => ({
|
|
869
|
-
label: column.displayName,
|
|
898
|
+
label: snakeCaseToTitleCase(column.displayName),
|
|
870
899
|
value: column.name,
|
|
871
900
|
}));
|
|
872
901
|
return (_jsxs("div", { style: {
|
|
@@ -911,7 +940,7 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
911
940
|
}
|
|
912
941
|
else if (isThePreviousInterval(node, client.databaseType)) {
|
|
913
942
|
const options = getAllPossibleColumns().map((column) => ({
|
|
914
|
-
label: column.displayName,
|
|
943
|
+
label: snakeCaseToTitleCase(column.displayName),
|
|
915
944
|
value: column.name,
|
|
916
945
|
}));
|
|
917
946
|
return (_jsxs("div", { style: {
|
|
@@ -972,7 +1001,7 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
972
1001
|
}
|
|
973
1002
|
else if (isColumnComparison(node)) {
|
|
974
1003
|
const options = getAllPossibleColumns().map((column) => ({
|
|
975
|
-
label: column.displayName,
|
|
1004
|
+
label: snakeCaseToTitleCase(column.displayName),
|
|
976
1005
|
value: column.name,
|
|
977
1006
|
}));
|
|
978
1007
|
// grab the value of the left child of the column comparison
|
|
@@ -1026,6 +1055,7 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
1026
1055
|
gap: 12,
|
|
1027
1056
|
flexDirection: 'column',
|
|
1028
1057
|
width: '100%',
|
|
1058
|
+
padding: '6px 0px',
|
|
1029
1059
|
}, children: [_jsxs("div", { style: {
|
|
1030
1060
|
display: 'flex',
|
|
1031
1061
|
gap: 20,
|
|
@@ -1121,7 +1151,7 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
1121
1151
|
}
|
|
1122
1152
|
case 'column_ref': {
|
|
1123
1153
|
const options = getAllPossibleColumns().map((column) => ({
|
|
1124
|
-
label: column.displayName,
|
|
1154
|
+
label: snakeCaseToTitleCase(column.displayName),
|
|
1125
1155
|
value: column.name,
|
|
1126
1156
|
}));
|
|
1127
1157
|
return (_jsx(Select, { theme: theme, style: { width: '120px' }, value: node.column ?? options[0]?.value, onChange: (value) => {
|
|
@@ -1248,10 +1278,10 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
1248
1278
|
isInTheCurrentIntervalSentence ??
|
|
1249
1279
|
isInTheLastIntervalSentence ??
|
|
1250
1280
|
isInThePreviousIntervalSentence ?? (_jsxs(_Fragment, { children: [node.left &&
|
|
1251
|
-
renderSentence(formData, node.left, keyPrefix + 'left.', false, false, isRow), isRow ? (' ' + OPS[node.operator] + ' ') : topLevelBinaryOperator === 'OR' ? (_jsx(TopLevelBooleanSwitch, { node: node, keyPrefix: keyPrefix, handleOperatorChange: handleOperatorChange, Select: Select })) : null, node.right &&
|
|
1281
|
+
renderSentence(formData, node.left, keyPrefix + 'left.', false, false, isRow), isRow ? (' ' + OPS[node.operator] + ' ') : isTopLevel || topLevelBinaryOperator === 'OR' ? (_jsx(TopLevelBooleanSwitch, { node: node, keyPrefix: keyPrefix, handleOperatorChange: handleOperatorChange, Select: Select })) : null, node.right &&
|
|
1252
1282
|
renderSentence(formData, node.right, keyPrefix + 'right.', false, false, isRow)] })) }));
|
|
1253
1283
|
case 'column_ref':
|
|
1254
|
-
return node.column;
|
|
1284
|
+
return snakeCaseToTitleCase(node.column);
|
|
1255
1285
|
case 'expr_list':
|
|
1256
1286
|
if (node.value.length === 1) {
|
|
1257
1287
|
const subQuery = renderSentence(formData, node.value[0]);
|
|
@@ -1283,10 +1313,10 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
1283
1313
|
if (node.args.value.length < 1)
|
|
1284
1314
|
return null;
|
|
1285
1315
|
if (node.args.value[0].value) {
|
|
1286
|
-
return node.args.value[0].value.replaceAll('%', '');
|
|
1316
|
+
return snakeCaseToTitleCase(node.args.value[0].value.replaceAll('%', ''));
|
|
1287
1317
|
}
|
|
1288
1318
|
if (node.args.value[0].column)
|
|
1289
|
-
return node.args.value[0].column.replaceAll('%', '');
|
|
1319
|
+
return snakeCaseToTitleCase(node.args.value[0].column.replaceAll('%', ''));
|
|
1290
1320
|
return null;
|
|
1291
1321
|
}
|
|
1292
1322
|
if (node.name.toLowerCase() === 'current_date' ||
|
|
@@ -1323,10 +1353,22 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
1323
1353
|
const tableNamesInQuery = baseAst.from.map((tbl) => tbl.table);
|
|
1324
1354
|
return schemaTables
|
|
1325
1355
|
.filter((t) => tableNamesInQuery.includes(t.displayName))
|
|
1326
|
-
.flatMap((table) => table.columns
|
|
1356
|
+
.flatMap((table) => table.columns
|
|
1357
|
+
.map((c) => ({
|
|
1327
1358
|
...c,
|
|
1328
1359
|
table: table.displayName,
|
|
1329
|
-
}))
|
|
1360
|
+
}))
|
|
1361
|
+
.sort((a, b) => {
|
|
1362
|
+
const aIsId = a.name.toLowerCase() === 'id' ||
|
|
1363
|
+
a.name.toLowerCase().endsWith('_id');
|
|
1364
|
+
const bIsId = b.name.toLowerCase() === 'id' ||
|
|
1365
|
+
b.name.toLowerCase().endsWith('_id');
|
|
1366
|
+
if (aIsId && !bIsId)
|
|
1367
|
+
return 1;
|
|
1368
|
+
if (bIsId && !aIsId)
|
|
1369
|
+
return -1;
|
|
1370
|
+
return 0;
|
|
1371
|
+
}));
|
|
1330
1372
|
};
|
|
1331
1373
|
const getDateColumns = () => {
|
|
1332
1374
|
const allColumns = getAllPossibleColumns();
|
|
@@ -1377,26 +1419,6 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
1377
1419
|
},
|
|
1378
1420
|
as: null,
|
|
1379
1421
|
});
|
|
1380
|
-
const SortableItem = ({ id, label, setSelectedColumns, selectedColumns, }) => {
|
|
1381
|
-
const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id: id });
|
|
1382
|
-
const style = {
|
|
1383
|
-
transform: DND_CSS.Transform.toString(transform),
|
|
1384
|
-
transition,
|
|
1385
|
-
};
|
|
1386
|
-
const handleSelect = () => {
|
|
1387
|
-
setSelectedColumns((selectedColumns) => {
|
|
1388
|
-
if (selectedColumns.includes(id)) {
|
|
1389
|
-
return selectedColumns.filter((column) => column !== id);
|
|
1390
|
-
}
|
|
1391
|
-
else {
|
|
1392
|
-
return [...selectedColumns, id];
|
|
1393
|
-
}
|
|
1394
|
-
});
|
|
1395
|
-
};
|
|
1396
|
-
return (_jsx("div", { style: { userSelect: 'none', ...style }, ref: setNodeRef, children: _jsx(SelectColumn, { selected: selectedColumns?.includes(id), setSelected: handleSelect, label: label, children: _jsx("div", { style: {
|
|
1397
|
-
cursor: 'grab',
|
|
1398
|
-
}, ...attributes, ...listeners, children: _jsx(HandleButton, {}) }) }) }));
|
|
1399
|
-
};
|
|
1400
1422
|
const AddConditionPopover = ({ onSave }) => {
|
|
1401
1423
|
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 2 }, children: [_jsx("h1", { style: {
|
|
1402
1424
|
fontWeight: '600',
|
|
@@ -1429,6 +1451,17 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
1429
1451
|
if (data2.rows && data2.rows.length) {
|
|
1430
1452
|
const tables = getTableNames(baseAst);
|
|
1431
1453
|
const table = tables.length >= 1 ? tables[0] : initialTableName;
|
|
1454
|
+
const sortedFields = data2.fields.sort((a, b) => {
|
|
1455
|
+
const aIsId = a.name.toLowerCase() === 'id' ||
|
|
1456
|
+
a.name.toLowerCase().endsWith('_id');
|
|
1457
|
+
const bIsId = b.name.toLowerCase() === 'id' ||
|
|
1458
|
+
b.name.toLowerCase().endsWith('_id');
|
|
1459
|
+
if (aIsId && !bIsId)
|
|
1460
|
+
return 1;
|
|
1461
|
+
if (bIsId && !aIsId)
|
|
1462
|
+
return -1;
|
|
1463
|
+
return 0;
|
|
1464
|
+
});
|
|
1432
1465
|
if (pivot) {
|
|
1433
1466
|
// Do all of this to make sure we have the right unique columns when applying a pivot
|
|
1434
1467
|
let uniqueFormatted = {};
|
|
@@ -1562,8 +1595,8 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
1562
1595
|
}
|
|
1563
1596
|
return false;
|
|
1564
1597
|
};
|
|
1565
|
-
const handleAsk = async () => {
|
|
1566
|
-
if (!aiPrompt) {
|
|
1598
|
+
const handleAsk = async (overridePrompt = '') => {
|
|
1599
|
+
if (!aiPrompt && !overridePrompt) {
|
|
1567
1600
|
return;
|
|
1568
1601
|
}
|
|
1569
1602
|
try {
|
|
@@ -1582,7 +1615,7 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
1582
1615
|
method: 'POST',
|
|
1583
1616
|
headers: { 'Content-Type': 'application/json' },
|
|
1584
1617
|
body: JSON.stringify({
|
|
1585
|
-
initialQuestion: aiPrompt,
|
|
1618
|
+
initialQuestion: aiPrompt || overridePrompt,
|
|
1586
1619
|
publicKey: client.publicKey,
|
|
1587
1620
|
}),
|
|
1588
1621
|
});
|
|
@@ -1741,7 +1774,7 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
1741
1774
|
transform: DND_CSS.Transform.toString(transform),
|
|
1742
1775
|
transition,
|
|
1743
1776
|
};
|
|
1744
|
-
return (_jsx("div", { style: { ...style }, ref: setNodeRef, children: _jsx(DraggableColumn, { label: label, onDelete: onDelete, children: _jsx("div", { style: {
|
|
1777
|
+
return (_jsx("div", { style: { ...style }, ref: setNodeRef, children: _jsx(DraggableColumn, { label: snakeCaseToTitleCase(label), onDelete: onDelete, children: _jsx("div", { style: {
|
|
1745
1778
|
cursor: 'grab',
|
|
1746
1779
|
}, ...attributes, ...listeners, children: _jsx(HandleButton, {}) }) }) }));
|
|
1747
1780
|
};
|
|
@@ -1802,18 +1835,6 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
1802
1835
|
gap: 8,
|
|
1803
1836
|
}, children: [columnNamesInAst.map((name) => (_jsx(DraggableItem, { id: name, label: name, onDelete: () => handleDeleteColumn(name) }, name))), columnNamesInAst?.length > 0 && _jsx("div", { style: { height: 6 } })] }) }) }));
|
|
1804
1837
|
}
|
|
1805
|
-
const allNumericColumns = getNumericColumns().map((column) => ({
|
|
1806
|
-
label: column.displayName,
|
|
1807
|
-
value: column.name,
|
|
1808
|
-
}));
|
|
1809
|
-
const allNonNumericColumns = getNonNumericColumns().map((column) => ({
|
|
1810
|
-
label: column.displayName,
|
|
1811
|
-
value: column.name,
|
|
1812
|
-
}));
|
|
1813
|
-
const allStringColumns = getStringColumns().map((column) => ({
|
|
1814
|
-
label: column.displayName,
|
|
1815
|
-
value: column.name,
|
|
1816
|
-
}));
|
|
1817
1838
|
if (loading) {
|
|
1818
1839
|
return (_jsxs("div", { style: {
|
|
1819
1840
|
display: 'flex',
|
|
@@ -1824,7 +1845,7 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
1824
1845
|
if (!openPopover) {
|
|
1825
1846
|
setOpenPopover('AddColumnPopover');
|
|
1826
1847
|
}
|
|
1827
|
-
}, label: 'Select columns' }),
|
|
1848
|
+
}, label: 'Select columns' }), label: "Select columns", onClose: () => {
|
|
1828
1849
|
setIsPending(false);
|
|
1829
1850
|
setActiveEditItem(null);
|
|
1830
1851
|
setActivePath(null);
|
|
@@ -1937,7 +1958,7 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
1937
1958
|
newAst.orderby = null;
|
|
1938
1959
|
setBaseAst(newAst); // trigger refetch
|
|
1939
1960
|
setPivot(pivot);
|
|
1940
|
-
}, selectPivotOnEdit: true, showTrigger: !pivot || !pivotData, theme: theme, LabelComponent: Label, HeaderComponent: Header, dateRange: [null, null, null], recommendPivotCount: 3 }), pivot && pivotData && (_jsx(PivotCard, { pivotTable: {
|
|
1961
|
+
}, selectPivotOnEdit: true, showTrigger: !pivot || !pivotData, theme: theme, LabelComponent: Label, HeaderComponent: Header, dateRange: [null, null, null], recommendPivotCount: 3, SecondaryButtonComponent: SecondaryButton }), pivot && pivotData && (_jsx(PivotCard, { pivotTable: {
|
|
1941
1962
|
pivot: pivot,
|
|
1942
1963
|
rows: pivotData?.rows || [],
|
|
1943
1964
|
columns: pivotData?.columns || [],
|
|
@@ -1996,7 +2017,7 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
1996
2017
|
const newAst = { ...baseAst };
|
|
1997
2018
|
newAst.orderby.splice(id, 1);
|
|
1998
2019
|
setBaseAst(deepCopy(newAst));
|
|
1999
|
-
} }, `sort-sentence-${id}`))) })), _jsx(Popover, { isOpen: openPopover === 'AddSortPopover', trigger: _jsx(SecondaryButton, { onClick: () => {
|
|
2020
|
+
} }, `sort-sentence-${id}`))) })), _jsx(Popover, { isOpen: openPopover === 'AddSortPopover', setIsOpen: () => { }, trigger: _jsx(SecondaryButton, { onClick: () => {
|
|
2000
2021
|
if (!openPopover) {
|
|
2001
2022
|
setOpenPopover('AddSortPopover');
|
|
2002
2023
|
}
|
|
@@ -2005,14 +2026,45 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
2005
2026
|
setActiveEditItem(null);
|
|
2006
2027
|
setActivePath(null);
|
|
2007
2028
|
setOpenPopover(null);
|
|
2008
|
-
}, children: _jsx(AddSortPopover, { columns: selectedColumns, Select: Select, Button: Button, onSave: () => { } }) })
|
|
2029
|
+
}, children: _jsx(AddSortPopover, { columns: selectedColumns, Select: Select, Button: Button, onSave: () => { } }) }), _jsx("div", { style: { height: 28, width: '100%' } }), _jsx(SidebarHeading, { label: "Limit" }), _jsx("div", { style: { height: 4, width: '100%' } }), baseAst && baseAst.limit ? (_jsx("div", { style: {
|
|
2030
|
+
display: 'flex',
|
|
2031
|
+
flexDirection: 'column',
|
|
2032
|
+
gap: 8,
|
|
2033
|
+
marginBottom: 12,
|
|
2034
|
+
}, children: _jsx(LimitSentence, { limit: baseAst.limit, setOpenPopover: setOpenPopover, LimitPopover: SortPopover, EditPopover: AddLimitPopover, handleDelete: () => {
|
|
2035
|
+
const newAst = { ...baseAst };
|
|
2036
|
+
newAst.limit = null;
|
|
2037
|
+
setBaseAst(deepCopy(newAst));
|
|
2038
|
+
}, onSave: (limit) => {
|
|
2039
|
+
const newAst = { ...baseAst };
|
|
2040
|
+
newAst.limit = {
|
|
2041
|
+
seperator: '',
|
|
2042
|
+
value: [
|
|
2043
|
+
{
|
|
2044
|
+
type: 'number',
|
|
2045
|
+
value: limit,
|
|
2046
|
+
},
|
|
2047
|
+
],
|
|
2048
|
+
};
|
|
2049
|
+
setOpenPopover(null);
|
|
2050
|
+
setBaseAst(deepCopy(newAst));
|
|
2051
|
+
} }) })) : (_jsx(Popover, { isOpen: openPopover === 'AddLimitPopover', setIsOpen: () => { }, trigger: _jsx(SecondaryButton, { onClick: () => {
|
|
2052
|
+
if (!openPopover) {
|
|
2053
|
+
setOpenPopover('AddLimitPopover');
|
|
2054
|
+
}
|
|
2055
|
+
}, label: 'Add limit' }), title: "Limit", onClose: () => {
|
|
2056
|
+
setIsPending(false);
|
|
2057
|
+
setActiveEditItem(null);
|
|
2058
|
+
setActivePath(null);
|
|
2059
|
+
setOpenPopover(null);
|
|
2060
|
+
}, children: _jsx(TextInput, { value: 0, type: "number", style: { width: 120, minHeight: 32 }, onChange: (e) => { } }) }))] }), _jsxs(Container, { children: [!hideAi && (_jsxs("form", { onSubmit: (event) => {
|
|
2009
2061
|
event.preventDefault();
|
|
2010
2062
|
}, style: {
|
|
2011
2063
|
display: 'flex',
|
|
2012
2064
|
flexDirection: 'row',
|
|
2013
2065
|
gap: 12,
|
|
2014
2066
|
padding: 1,
|
|
2015
|
-
}, children: [_jsx(TextInput, { placeholder:
|
|
2067
|
+
}, children: [_jsx(TextInput, { placeholder: baseAst ? 'Ask a follow-up question...' : 'Ask a question...', type: "text", style: { width: '100%', fontSize: 14 }, value: aiPrompt }), _jsx(Button, { onClick: () => { }, label: 'Ask AI' }), baseAst && (_jsx(SecondaryButton, { onClick: clearAllState, label: "New report" }))] })), baseAst && (_jsxs(_Fragment, { children: [_jsx(TableLoadingState, {}), _jsxs("div", { style: {
|
|
2016
2068
|
display: 'flex',
|
|
2017
2069
|
flexDirection: 'row',
|
|
2018
2070
|
gap: '12px',
|
|
@@ -2137,7 +2189,7 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
2137
2189
|
setOpenPopover(null);
|
|
2138
2190
|
clearCheckboxes();
|
|
2139
2191
|
}
|
|
2140
|
-
} }) }))] }), _jsx("div", { style: { height: 28, width: '100%' } }), _jsx(SidebarHeading, { label: "Pivot" }), _jsx("div", { style: { height: 4, width: '100%' } }), _jsx(PivotModal, { pivotRowField: pivotRowField, setPivotRowField: setPivotRowField, pivotColumnField: pivotColumnField, setPivotColumnField: setPivotColumnField, pivotValueField: pivotValueField, setPivotValueField: setPivotValueField, pivotAggregation: pivotAggregation, setPivotAggregation: setPivotAggregation, createdPivots: createdPivots, setCreatedPivots: setCreatedPivots, recommendedPivots: recommendedPivots, setRecommendedPivots: setRecommendedPivots, popUpTitle: pivotPopUpTitle, setPopUpTitle: setPivotPopUpTitle, selectedTable: initialTableName, SelectComponent: Select, ButtonComponent: Button, PopoverComponent: PivotPopover, TextComponent: Text, isOpen: showPivotPopover, setIsOpen: setShowPivotPopover, showUpdatePivot: isEdittingPivot, setShowUpdatePivot: setIsEdittingPivot, parentRef: parentRef, data: rows, columns: processColumnsForChartBuilder(Object.keys(rows[0] ?? {})), triggerButtonText: 'Add pivot', selectedPivotIndex: selectedPivotIndex, setSelectedPivotIndex: setSelectedPivotIndex, removePivot: () => {
|
|
2192
|
+
} }) }))] }), _jsx("div", { style: { height: 28, width: '100%' } }), _jsx(SidebarHeading, { label: "Pivot" }), _jsx("div", { style: { height: 4, width: '100%' } }), _jsx(PivotModal, { pivotRowField: pivotRowField, setPivotRowField: setPivotRowField, pivotColumnField: pivotColumnField, setPivotColumnField: setPivotColumnField, pivotValueField: pivotValueField, setPivotValueField: setPivotValueField, pivotAggregation: pivotAggregation, setPivotAggregation: setPivotAggregation, createdPivots: createdPivots, setCreatedPivots: setCreatedPivots, recommendedPivots: recommendedPivots, setRecommendedPivots: setRecommendedPivots, popUpTitle: pivotPopUpTitle, setPopUpTitle: setPivotPopUpTitle, selectedTable: initialTableName, SelectComponent: Select, ButtonComponent: Button, SecondaryButtonComponent: SecondaryButton, PopoverComponent: PivotPopover, TextComponent: Text, isOpen: showPivotPopover, setIsOpen: setShowPivotPopover, showUpdatePivot: isEdittingPivot, setShowUpdatePivot: setIsEdittingPivot, parentRef: parentRef, data: rows, columns: processColumnsForChartBuilder(Object.keys(rows[0] ?? {})), triggerButtonText: 'Add pivot', selectedPivotIndex: selectedPivotIndex, setSelectedPivotIndex: setSelectedPivotIndex, removePivot: () => {
|
|
2141
2193
|
setPivot(null);
|
|
2142
2194
|
setPivotData(null);
|
|
2143
2195
|
}, selectPivot: (pivot) => {
|
|
@@ -2252,7 +2304,54 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
2252
2304
|
setActivePath(null);
|
|
2253
2305
|
setOpenPopover(null);
|
|
2254
2306
|
setBaseAst(deepCopy(newAst));
|
|
2255
|
-
} }) })
|
|
2307
|
+
} }) }), _jsx("div", { style: { height: 28, width: '100%' } }), _jsx(SidebarHeading, { label: "Limit" }), _jsx("div", { style: { height: 4, width: '100%' } }), baseAst && baseAst.limit ? (_jsx("div", { style: {
|
|
2308
|
+
display: 'flex',
|
|
2309
|
+
flexDirection: 'column',
|
|
2310
|
+
gap: 8,
|
|
2311
|
+
marginBottom: 12,
|
|
2312
|
+
}, children: _jsx(LimitSentence, { limit: baseAst.limit, setOpenPopover: setOpenPopover, LimitPopover: SortPopover, EditPopover: AddLimitPopover, handleDelete: () => {
|
|
2313
|
+
const newAst = { ...baseAst };
|
|
2314
|
+
newAst.limit = null;
|
|
2315
|
+
setBaseAst(deepCopy(newAst));
|
|
2316
|
+
}, onSave: (limit) => {
|
|
2317
|
+
const newAst = { ...baseAst };
|
|
2318
|
+
newAst.limit = {
|
|
2319
|
+
seperator: '',
|
|
2320
|
+
value: [
|
|
2321
|
+
{
|
|
2322
|
+
type: 'number',
|
|
2323
|
+
value: limit,
|
|
2324
|
+
},
|
|
2325
|
+
],
|
|
2326
|
+
};
|
|
2327
|
+
setOpenPopover(null);
|
|
2328
|
+
setBaseAst(deepCopy(newAst));
|
|
2329
|
+
} }) })) : (_jsx(Popover, { isOpen: openPopover === 'AddLimitPopover', setIsOpen: () => { }, trigger: _jsx(SecondaryButton, { onClick: () => {
|
|
2330
|
+
if (!baseAst) {
|
|
2331
|
+
return;
|
|
2332
|
+
}
|
|
2333
|
+
if (!openPopover) {
|
|
2334
|
+
setOpenPopover('AddLimitPopover');
|
|
2335
|
+
}
|
|
2336
|
+
}, label: 'Add limit' }), title: "Limit", onClose: () => {
|
|
2337
|
+
setIsPending(false);
|
|
2338
|
+
setActiveEditItem(null);
|
|
2339
|
+
setActivePath(null);
|
|
2340
|
+
setOpenPopover(null);
|
|
2341
|
+
}, children: _jsx(AddLimitPopover, { TextInput: TextInput, onSave: (limit) => {
|
|
2342
|
+
const newAst = { ...baseAst };
|
|
2343
|
+
newAst.limit = {
|
|
2344
|
+
seperator: '',
|
|
2345
|
+
value: [
|
|
2346
|
+
{
|
|
2347
|
+
type: 'number',
|
|
2348
|
+
value: Number(limit),
|
|
2349
|
+
},
|
|
2350
|
+
],
|
|
2351
|
+
};
|
|
2352
|
+
setOpenPopover(null);
|
|
2353
|
+
setBaseAst(deepCopy(newAst));
|
|
2354
|
+
} }) }))] }), _jsxs(Container, { children: [!hideAi && (_jsxs("form", { onSubmit: (event) => {
|
|
2256
2355
|
event.preventDefault();
|
|
2257
2356
|
handleAsk();
|
|
2258
2357
|
}, style: {
|
|
@@ -2265,7 +2364,7 @@ export default function ReportBuilder({ initialTableName = '', onAddToDashboardC
|
|
|
2265
2364
|
fields: pivotData?.fields || fields,
|
|
2266
2365
|
}, baseAst?.columns ?? []), columns: pivotData?.columns ||
|
|
2267
2366
|
enforceOrderOnColumns(Object.keys(rows[0] ?? {})).map((c) => {
|
|
2268
|
-
return { label: c, field: c };
|
|
2367
|
+
return { label: snakeCaseToTitleCase(c), field: c };
|
|
2269
2368
|
}), error: errorMessage, rowsPerPage: 20 })) })), _jsxs("div", { style: {
|
|
2270
2369
|
display: 'flex',
|
|
2271
2370
|
flexDirection: 'row',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SQLEditor.d.ts","sourceRoot":"","sources":["../../src/SQLEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,KAMN,MAAM,OAAO,CAAC;AAQf,OAAO,EAGL,mBAAmB,EACnB,mBAAmB,EAEpB,MAAM,2BAA2B,CAAC;AAInC,wBAAgB,qBAAqB,CAAC,MAAM,KAAA;;;;;EAwE3C;AA2BD,UAAU,oBAAoB;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,cAAc;IACtB,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC;IAEpC,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,GAAG,CAAC,OAAO,CAAC;IAC/D,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,GAAG,CAAC,OAAO,CAAC;IAExE,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,GAAG,CAAC,OAAO,CAAC;IACrE,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,GAAG,CAAC,OAAO,CAAC;IAC7D,gBAAgB,CAAC,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC;IACrC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,GAAG,CAAC,OAAO,CAAC;IAC9D,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACxC,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC9C,cAAc,CAAC,EAAE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|
1
|
-
{"version":3,"file":"ChartTooltipFrame.d.ts","sourceRoot":"","sources":["../../../../src/components/Chart/ChartTooltipFrame.tsx"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC;CACZ,
|
|
1
|
+
{"version":3,"file":"ChartTooltipFrame.d.ts","sourceRoot":"","sources":["../../../../src/components/Chart/ChartTooltipFrame.tsx"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC;CACZ,2CAmBA"}
|
|
@@ -8,6 +8,7 @@ export default function ChartTooltipFrame({ children, theme, }) {
|
|
|
8
8
|
background: theme?.backgroundColor || '#ffffff',
|
|
9
9
|
borderRadius: '6px',
|
|
10
10
|
zIndex: 40,
|
|
11
|
+
display: 'block',
|
|
11
12
|
boxShadow: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
|
|
12
13
|
}, children: children }));
|
|
13
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineChart.d.ts","sourceRoot":"","sources":["../../../../src/components/Chart/LineChart.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,MAAM,EACN,QAAa,EACb,WAAW,EACX,IAAI,EACJ,cAAc,EACd,UAAU,EACV,WAAW,EACX,KAAK,EACL,UAAU,EACV,iBAAwB,EACxB,SAAiB,EACjB,SAAiB,EACjB,iBAAyB,EACzB,gBAAwB,EACxB,gBAAwB,GACzB,EAAE;IACD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,WAAW,EAAE,GAAG,EAAE,CAAC;IACnB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,GAAG,CAAC;IACX,UAAU,EAAE,GAAG,CAAC;IAChB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gBAAgB,EAAE,KAAK,GAAG,MAAM,CAAC;CAClC,
|
|
1
|
+
{"version":3,"file":"LineChart.d.ts","sourceRoot":"","sources":["../../../../src/components/Chart/LineChart.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,MAAM,EACN,QAAa,EACb,WAAW,EACX,IAAI,EACJ,cAAc,EACd,UAAU,EACV,WAAW,EACX,KAAK,EACL,UAAU,EACV,iBAAwB,EACxB,SAAiB,EACjB,SAAiB,EACjB,iBAAyB,EACzB,gBAAwB,EACxB,gBAAwB,GACzB,EAAE;IACD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,WAAW,EAAE,GAAG,EAAE,CAAC;IACnB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,GAAG,CAAC;IACX,UAAU,EAAE,GAAG,CAAC;IAChB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gBAAgB,EAAE,KAAK,GAAG,MAAM,CAAC;CAClC,kDAgPA"}
|
|
@@ -50,6 +50,7 @@ export default function LineChart({ colors, colorMap = {}, yAxisFields, data, co
|
|
|
50
50
|
// Allows the users to override the color scheme on a per-chart basis.
|
|
51
51
|
const getCustomColor = (index, field, gradient) => {
|
|
52
52
|
let key = index === 0 ? 'primary' : 'comparison';
|
|
53
|
+
field = field.replace('comparison_', '');
|
|
53
54
|
if (colorMap && colorMap[field]) {
|
|
54
55
|
if (index === 0 && gradient === 'start')
|
|
55
56
|
key = 'primaryGradientStart';
|
|
@@ -110,12 +111,14 @@ export default function LineChart({ colors, colorMap = {}, yAxisFields, data, co
|
|
|
110
111
|
}, position: { y: 0 } }), yAxisFields.map((elem, index) => {
|
|
111
112
|
// hash the color stops so they're stable, valid html ids
|
|
112
113
|
const gradientStart = getCustomColor(index, elem.field, 'start') ??
|
|
114
|
+
getCustomColor(index, elem.field) ??
|
|
113
115
|
selectColor(elem, colors, index);
|
|
114
116
|
const gradientStop = getCustomColor(index, elem.field, 'stop') ?? '#00000000';
|
|
115
117
|
const uniqueId = `gradient_${hashCode(gradientStart)}_${hashCode(gradientStop)}`;
|
|
116
118
|
return (_jsx("defs", { children: _jsxs("linearGradient", { id: uniqueId, x1: "0", y1: "0", x2: "0", y2: "1", children: [_jsx("stop", { offset: "5%", stopColor: gradientStart, stopOpacity: 0.4 }), _jsx("stop", { offset: "95%", stopColor: gradientStop, stopOpacity: 0 })] }) }, `defs_${uniqueId}_${index}`));
|
|
117
119
|
}), yAxisFields.map((elem, index) => {
|
|
118
120
|
const gradientStart = hashCode(getCustomColor(index, elem.field, 'start') ??
|
|
121
|
+
getCustomColor(index, elem.field) ??
|
|
119
122
|
selectColor(elem, colors, index));
|
|
120
123
|
const gradientStop = hashCode(getCustomColor(index, elem.field, 'stop') ?? '#00000000');
|
|
121
124
|
const uniqueId = `gradient_${gradientStart}_${gradientStop}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuillSelect.d.ts","sourceRoot":"","sources":["../../../src/components/QuillSelect.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGtD,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,KAAK,EACL,QAAQ,EACR,KAAK,EACL,KAAK,GACN,EAAE,oBAAoB,
|
|
1
|
+
{"version":3,"file":"QuillSelect.d.ts","sourceRoot":"","sources":["../../../src/components/QuillSelect.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAGtD,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,KAAK,EACL,QAAQ,EACR,KAAK,EACL,KAAK,GACN,EAAE,oBAAoB,2CAwMtB"}
|
|
@@ -7,7 +7,13 @@ export function QuillSelectComponent({ options, value, onChange, theme, label, }
|
|
|
7
7
|
useOnClickOutside(modalRef, (e) => {
|
|
8
8
|
setShowModal(false);
|
|
9
9
|
});
|
|
10
|
-
return (_jsxs("div", { style: {
|
|
10
|
+
return (_jsxs("div", { style: {
|
|
11
|
+
position: 'relative',
|
|
12
|
+
width: 200,
|
|
13
|
+
minWidth: 200,
|
|
14
|
+
boxShadow: 'rgba(0, 0, 0, 0.1) 0px 1px 5px 0px',
|
|
15
|
+
borderRadius: '6px',
|
|
16
|
+
}, children: [label && (_jsx("div", { style: {
|
|
11
17
|
fontSize: 14,
|
|
12
18
|
color: theme.primaryTextColor,
|
|
13
19
|
fontFamily: theme.fontFamily,
|
|
@@ -45,14 +45,14 @@ export default function AddColumnPopover({ onSave, orderedColumnNames, setOrdere
|
|
|
45
45
|
flexDirection: 'row',
|
|
46
46
|
alignItems: 'center',
|
|
47
47
|
marginTop: 2,
|
|
48
|
-
}, children: _jsx(TextInput, { type: "text", value: search, placeholder: 'Search...', style: {
|
|
48
|
+
}, children: _jsx(TextInput, { type: "text", value: search, placeholder: 'Search...', style: { marginBottom: 6, width: '100%' }, onChange: (e) => setSearch(e.target.value) }) }), _jsx(DndContext, { sensors: sensors, collisionDetection: closestCenter, onDragEnd: handleDragEnd, children: _jsx(SortableContext, { items: orderedColumnNames, strategy: verticalListSortingStrategy, children: _jsxs("div", { style: {
|
|
49
49
|
display: 'flex',
|
|
50
50
|
flexDirection: 'column',
|
|
51
51
|
gap: 8,
|
|
52
52
|
overflowY: 'auto',
|
|
53
53
|
maxWidth: '300px',
|
|
54
54
|
}, children: [searchResults.map((value) => {
|
|
55
|
-
return (_jsx(SortableItem, { theme: theme, selectedColumns: selectedColumns, setSelectedColumns: setSelectedColumns, id: value, label: value.replace('.', ' '), SelectColumn: SelectColumn, HandleButton: HandleButton }, value));
|
|
55
|
+
return (_jsx(SortableItem, { theme: theme, selectedColumns: selectedColumns, setSelectedColumns: setSelectedColumns, id: value, label: value.replace('.', ' | '), SelectColumn: SelectColumn, HandleButton: HandleButton }, value));
|
|
56
56
|
}), search.length > 0 && searchResults.length === 0 && (_jsx("div", { style: { fontFamily: theme?.fontFamily }, children: "No results found" }))] }) }) }), _jsxs("div", { style: {
|
|
57
57
|
display: 'flex',
|
|
58
58
|
width: '100%',
|
|
@@ -103,7 +103,7 @@ export default function AddColumnPopover({ onSave, orderedColumnNames, setOrdere
|
|
|
103
103
|
setPivot(null);
|
|
104
104
|
}
|
|
105
105
|
onSave();
|
|
106
|
-
}, label: "
|
|
106
|
+
}, label: "Select columns" })] })] }));
|
|
107
107
|
}
|
|
108
108
|
const SortableItem = ({ id, label, setSelectedColumns, theme, selectedColumns, SelectColumn, HandleButton, }) => {
|
|
109
109
|
const { attributes, listeners, setNodeRef, transform, transition } = useSortable({ id: id });
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const LimitSentence: ({ limit, handleDelete, setOpenPopover, onSave, popoverTitle, LimitPopover, EditPopover, children, }: any) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const AddLimitPopover: ({ onSave, initialLimit, isEdit, onDelete, }: any) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=AddLimitPopover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddLimitPopover.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/AddLimitPopover.tsx"],"names":[],"mappings":"AAaA,eAAO,MAAM,aAAa,wGASvB,GAAG,4CAiCL,CAAC;AAEF,eAAO,MAAM,eAAe,gDAKzB,GAAG,4CAmCL,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useContext } from 'react';
|
|
3
|
+
import { MemoizedButton, MemoizedSecondaryButton } from '../UiComponents';
|
|
4
|
+
import { ThemeContext } from '../../Context';
|
|
5
|
+
import { QuillTextInput } from './ui';
|
|
6
|
+
const SORT_VALUE_TO_LABEL = {
|
|
7
|
+
ASC: 'ascending',
|
|
8
|
+
DESC: 'descending',
|
|
9
|
+
};
|
|
10
|
+
export const LimitSentence = ({ limit, handleDelete, setOpenPopover, onSave, popoverTitle = 'Edit limit', LimitPopover, EditPopover, children, }) => {
|
|
11
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
12
|
+
const handleClickDelete = (e) => {
|
|
13
|
+
setOpenPopover(null);
|
|
14
|
+
handleDelete();
|
|
15
|
+
};
|
|
16
|
+
return (_jsx("div", { style: { width: '100%' }, children: _jsx(LimitPopover
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
, {
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
filterLabel: `limit ${limit.value[0].value}`, onClickDelete: handleClickDelete, popoverTitle: popoverTitle, popoverChildren: _jsx(EditPopover, { onSave: (column, direction) => {
|
|
21
|
+
setIsOpen(false);
|
|
22
|
+
onSave(column, direction);
|
|
23
|
+
}, isEdit: true, onDelete: handleClickDelete, initialLimit: limit.value[0].value }), isOpen: isOpen, setIsOpen: setIsOpen, onDelete: () => {
|
|
24
|
+
handleDelete();
|
|
25
|
+
} }) }));
|
|
26
|
+
};
|
|
27
|
+
export const AddLimitPopover = ({ onSave, initialLimit, isEdit, onDelete, }) => {
|
|
28
|
+
const [limit, setLimit] = useState(initialLimit || 0);
|
|
29
|
+
const [theme] = useContext(ThemeContext);
|
|
30
|
+
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 12 }, children: [_jsx("div", { style: { display: 'flex', flexDirection: 'row', gap: 12, padding: '6px 0px' }, children: _jsx(QuillTextInput, { value: limit, type: "number", style: { width: 200, minHeight: 32, padding: '6px 12px' }, onChange: (e) => {
|
|
31
|
+
setLimit(e.target.value);
|
|
32
|
+
} }) }), _jsx("div", { style: {
|
|
33
|
+
display: 'flex',
|
|
34
|
+
flexDirection: 'row',
|
|
35
|
+
justifyContent: 'end',
|
|
36
|
+
gap: 12,
|
|
37
|
+
}, children: isEdit ? (_jsxs(_Fragment, { children: [_jsx(MemoizedSecondaryButton, { onClick: onDelete, label: "Delete" }), _jsx(MemoizedButton, { onClick: () => onSave(limit), label: "Edit limit" })] })) : (_jsx(MemoizedButton, { onClick: () => onSave(limit), label: "Add limit" })) })] }));
|
|
38
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddSortPopover.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/AddSortPopover.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AddSortPopover.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/AddSortPopover.tsx"],"names":[],"mappings":"AAYA,eAAO,MAAM,YAAY,iMAetB,GAAG,wDA2CL,CAAC;AAEF,eAAO,MAAM,cAAc,mDAMxB,GAAG,4CAiEL,CAAC"}
|