@quillsql/react 2.11.13 → 2.11.15
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/ReportBuilder.d.ts.map +1 -1
- package/dist/cjs/ReportBuilder.js +206 -139
- package/dist/cjs/components/Dashboard/MetricComponent.js +2 -2
- package/dist/cjs/components/QuillCard.d.ts.map +1 -1
- package/dist/cjs/components/QuillCard.js +2 -4
- package/dist/cjs/components/QuillTable.d.ts.map +1 -1
- package/dist/cjs/components/QuillTable.js +2 -2
- package/dist/cjs/components/ReportBuilder/AddSortPopover.js +2 -2
- package/dist/cjs/components/ReportBuilder/convert.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/convert.js +38 -12
- package/dist/cjs/components/ReportBuilder/ui.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/ui.js +14 -2
- package/dist/cjs/components/UiComponents.d.ts.map +1 -1
- package/dist/cjs/components/UiComponents.js +14 -9
- package/dist/cjs/internals/ReportBuilder/PivotList.d.ts.map +1 -1
- package/dist/cjs/internals/ReportBuilder/PivotList.js +28 -2
- package/dist/cjs/internals/ReportBuilder/PivotModal.d.ts.map +1 -1
- package/dist/cjs/internals/ReportBuilder/PivotModal.js +23 -3
- package/dist/esm/ReportBuilder.d.ts.map +1 -1
- package/dist/esm/ReportBuilder.js +206 -139
- package/dist/esm/components/Dashboard/MetricComponent.js +2 -2
- package/dist/esm/components/QuillCard.d.ts.map +1 -1
- package/dist/esm/components/QuillCard.js +2 -4
- package/dist/esm/components/QuillTable.d.ts.map +1 -1
- package/dist/esm/components/QuillTable.js +2 -2
- package/dist/esm/components/ReportBuilder/AddSortPopover.js +2 -2
- package/dist/esm/components/ReportBuilder/convert.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/convert.js +38 -12
- package/dist/esm/components/ReportBuilder/ui.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/ui.js +14 -2
- package/dist/esm/components/UiComponents.d.ts.map +1 -1
- package/dist/esm/components/UiComponents.js +14 -9
- package/dist/esm/internals/ReportBuilder/PivotList.d.ts.map +1 -1
- package/dist/esm/internals/ReportBuilder/PivotList.js +28 -2
- package/dist/esm/internals/ReportBuilder/PivotModal.d.ts.map +1 -1
- package/dist/esm/internals/ReportBuilder/PivotModal.js +23 -3
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ export default function QuillMetricComponent({ dashboardItem, onClickDashboardIt
|
|
|
16
16
|
cursor: 'pointer',
|
|
17
17
|
boxSizing: 'content-box',
|
|
18
18
|
borderRadius: 8,
|
|
19
|
-
paddingBottom: 30,
|
|
19
|
+
paddingBottom: isLoading ? 0 : 30,
|
|
20
20
|
...style,
|
|
21
21
|
}, children: _jsx("div", { style: {
|
|
22
22
|
width: '100%',
|
|
@@ -60,7 +60,7 @@ export default function QuillMetricComponent({ dashboardItem, onClickDashboardIt
|
|
|
60
60
|
display: 'flex',
|
|
61
61
|
alignItems: 'center',
|
|
62
62
|
justifyContent: 'flex-end',
|
|
63
|
-
}, children: 'view report →' })) : null] }), isLoading ? (_jsx(ChartSkeleton, {})) : error ? (_jsx(ChartError, {})) : data.rows?.length === 0 ||
|
|
63
|
+
}, children: 'view report →' })) : null] }), isLoading ? (_jsx(ChartSkeleton, { containerStyle: { maxHeight: '78px', height: style?.height ?? '100%' } })) : error ? (_jsx(ChartError, {})) : data.rows?.length === 0 ||
|
|
64
64
|
data.rows[0][data.xAxisField] === null ? (_jsx("div", { style: {
|
|
65
65
|
display: 'flex',
|
|
66
66
|
flex: '1 0 auto',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuillCard.d.ts","sourceRoot":"","sources":["../../../src/components/QuillCard.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,UAAU,cAAc;IACtB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,KAAK,EACL,OAAO,EACP,UAAkB,EAClB,SAAgB,EAChB,OAAO,EACP,SAAa,EACb,KAAU,GACX,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"QuillCard.d.ts","sourceRoot":"","sources":["../../../src/components/QuillCard.tsx"],"names":[],"mappings":"AACA,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,UAAU,cAAc;IACtB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,KAAK,EACL,OAAO,EACP,UAAkB,EAClB,SAAgB,EAChB,OAAO,EACP,SAAa,EACb,KAAU,GACX,EAAE,cAAc,2CAmEhB"}
|
|
@@ -28,12 +28,10 @@ export function QuillCard({ children, theme, onClick, isSelected = false, clicka
|
|
|
28
28
|
e.stopPropagation();
|
|
29
29
|
onClose();
|
|
30
30
|
}, style: {
|
|
31
|
-
height:
|
|
32
|
-
width:
|
|
31
|
+
height: 40,
|
|
32
|
+
width: 40,
|
|
33
33
|
top: 4,
|
|
34
34
|
right: 4,
|
|
35
|
-
// marginTop: -12,
|
|
36
|
-
// marginRight: -12,
|
|
37
35
|
position: 'absolute',
|
|
38
36
|
cursor: 'pointer',
|
|
39
37
|
border: 'none',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuillTable.d.ts","sourceRoot":"","sources":["../../../src/components/QuillTable.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAMrD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,IAAI,EACJ,OAAO,EACP,OAAO,EACP,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,gBAA0C,EAC1C,WAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"QuillTable.d.ts","sourceRoot":"","sources":["../../../src/components/QuillTable.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAMrD,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,IAAI,EACJ,OAAO,EACP,OAAO,EACP,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,gBAA0C,EAC1C,WAAgB,EAChB,eAA8B,EAC9B,WAAW,GACZ,EAAE,mBAAmB,2CAwZrB"}
|
|
@@ -3,7 +3,7 @@ import { useContext, useEffect, useState } from 'react';
|
|
|
3
3
|
import { compareValues } from '../utils/valueFormatter';
|
|
4
4
|
import { ThemeContext } from '../Context';
|
|
5
5
|
import ChartSkeleton from './Chart/ChartSkeleton';
|
|
6
|
-
export default function QuillTable({ rows, columns, loading, showDownloadCSVButton, downloadFileName, containerStyle, LoadingComponent = () => _jsx(ChartSkeleton, {}), rowsPerPage = 10, emptyStateLabel = 'No results
|
|
6
|
+
export default function QuillTable({ rows, columns, loading, showDownloadCSVButton, downloadFileName, containerStyle, LoadingComponent = () => _jsx(ChartSkeleton, {}), rowsPerPage = 10, emptyStateLabel = 'No results', downloadCSV, }) {
|
|
7
7
|
const [activeRows, setActiveRows] = useState([]);
|
|
8
8
|
const [page, setPage] = useState(1);
|
|
9
9
|
const [maxPage, setMaxPage] = useState(1);
|
|
@@ -130,7 +130,7 @@ export default function QuillTable({ rows, columns, loading, showDownloadCSVButt
|
|
|
130
130
|
: undefined,
|
|
131
131
|
}, children: _jsx("path", { fillRule: "evenodd", d: "M10 3a.75.75 0 01.75.75v10.638l3.96-4.158a.75.75 0 111.08 1.04l-5.25 5.5a.75.75 0 01-1.08 0l-5.25-5.5a.75.75 0 111.08-1.04l3.96 4.158V3.75A.75.75 0 0110 3z", clipRule: "evenodd" }) }))] }, 'sqlcol' + index))) }) }), (activeRows && activeRows.length === 0) ||
|
|
132
132
|
(columns && columns.length === 0) ? (_jsx("div", { style: {
|
|
133
|
-
padding: '
|
|
133
|
+
padding: '30px 0',
|
|
134
134
|
display: 'flex',
|
|
135
135
|
flex: '1 0 auto',
|
|
136
136
|
margin: 'auto',
|
|
@@ -21,11 +21,11 @@ export const SortSentence = ({ sortData, keyPrefix, columns, handleDelete, setEd
|
|
|
21
21
|
if (!sortData && (!sortData.expr.column || !sortData.expr.value)) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
return (_jsx("div", {
|
|
24
|
+
return (_jsx("div", { children: _jsx(SortPopover
|
|
25
25
|
// @ts-ignore
|
|
26
26
|
, {
|
|
27
27
|
// @ts-ignore
|
|
28
|
-
filterLabel: `${snakeCaseToTitleCase(sortData.expr.column) || snakeCaseToTitleCase(sortData.expr.value)}
|
|
28
|
+
filterLabel: `${snakeCaseToTitleCase(sortData.expr.column) || snakeCaseToTitleCase(sortData.expr.value)} ${SORT_VALUE_TO_LABEL[sortData.type]}`, onClickDelete: handleClickDelete, popoverTitle: popoverTitle, popoverChildren: _jsx(EditPopover, { onSave: (column, direction) => {
|
|
29
29
|
setIsOpen(false);
|
|
30
30
|
onSave(column, direction);
|
|
31
31
|
}, columns: columns, isEdit: true, onDelete: handleClickDelete, column: sortData.expr.column || sortData.expr.value }), isOpen: isOpen, setIsOpen: setIsOpen, onDelete: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/convert.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,IAAI,GAAG,EACpB,GAAG,EAMJ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAc,SAAS,EAAE,MAAM,UAAU,CAAC;AASjD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAuBlE;AAGD,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,QAahB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAAC,MAAM,CAuCpD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,GAAG,CAAC,MAAM,EACf,YAAY,EAAE,SAAS,EAAE,GACxB,GAAG,CAAC,MAAM,CAwBZ;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,GAAG,EACR,SAAS,mBAAc,EACvB,YAAY,EAAE,SAAS,EAAE;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/convert.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,IAAI,GAAG,EACpB,GAAG,EAMJ,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAc,SAAS,EAAE,MAAM,UAAU,CAAC;AASjD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAuBlE;AAGD,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,QAahB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAAC,MAAM,CAuCpD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,GAAG,CAAC,MAAM,EACf,YAAY,EAAE,SAAS,EAAE,GACxB,GAAG,CAAC,MAAM,CAwBZ;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,GAAG,EACR,SAAS,mBAAc,EACvB,YAAY,EAAE,SAAS,EAAE;;;;;;;;;;;;;;EA8b1B;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG;;;EA6G5D;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,OAyJtE;AAID,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAY1E"}
|
|
@@ -191,8 +191,14 @@ export function convertGroupBy(ast, prevPivot = null, schemaTables) {
|
|
|
191
191
|
}
|
|
192
192
|
if (columnName === '*') {
|
|
193
193
|
// TODO: make valueField be a number
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
for (let i = 0; i < columns.length; i++) {
|
|
195
|
+
if (!isIdColumn(columns[i]?.field) &&
|
|
196
|
+
isNumericColumnType(columns[i]?.fieldType)) {
|
|
197
|
+
pivot.valueField = columns[i].field;
|
|
198
|
+
columnName = columns[i].field;
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
196
202
|
}
|
|
197
203
|
newColumns.push({
|
|
198
204
|
type: 'expr',
|
|
@@ -270,17 +276,19 @@ export function convertGroupBy(ast, prevPivot = null, schemaTables) {
|
|
|
270
276
|
const columnName = columnNode?.value || columnNode?.column;
|
|
271
277
|
// if count(*), make the value field an actual column
|
|
272
278
|
if (columnName === '*') {
|
|
273
|
-
|
|
274
|
-
|
|
279
|
+
const numericColumn = columns.find((c) => {
|
|
280
|
+
return isNumericColumnType(c.fieldType) && !isIdColumn(c.field);
|
|
281
|
+
});
|
|
282
|
+
pivot.valueField = numericColumn?.field;
|
|
275
283
|
pivot.aggregationType = column?.expr?.name.toLowerCase();
|
|
276
|
-
const findByName = (x) => [x.expr?.value, x.expr?.column].includes(
|
|
284
|
+
const findByName = (x) => [x.expr?.value, x.expr?.column].includes(numericColumn.field);
|
|
277
285
|
if (!newColumns.find(findByName)) {
|
|
278
286
|
newColumns.push({
|
|
279
287
|
type: 'expr',
|
|
280
288
|
expr: {
|
|
281
289
|
type: 'column_ref',
|
|
282
290
|
table: null,
|
|
283
|
-
column:
|
|
291
|
+
column: numericColumn?.field || '',
|
|
284
292
|
},
|
|
285
293
|
as: null,
|
|
286
294
|
});
|
|
@@ -628,8 +636,14 @@ export function convertStringComparison(node, databaseType) {
|
|
|
628
636
|
type: 'expr_list',
|
|
629
637
|
value: [
|
|
630
638
|
databaseType === 'BigQuery'
|
|
631
|
-
? {
|
|
632
|
-
|
|
639
|
+
? {
|
|
640
|
+
type: 'column_ref',
|
|
641
|
+
value: obj.left.column || obj.left.value,
|
|
642
|
+
}
|
|
643
|
+
: {
|
|
644
|
+
type: 'double_quote_string',
|
|
645
|
+
value: obj.left.column || obj.left.value,
|
|
646
|
+
},
|
|
633
647
|
],
|
|
634
648
|
},
|
|
635
649
|
};
|
|
@@ -666,8 +680,14 @@ export function convertStringComparison(node, databaseType) {
|
|
|
666
680
|
type: 'expr_list',
|
|
667
681
|
value: [
|
|
668
682
|
databaseType === 'BigQuery'
|
|
669
|
-
? {
|
|
670
|
-
|
|
683
|
+
? {
|
|
684
|
+
type: 'column_ref',
|
|
685
|
+
value: obj.left.column || obj.left.value,
|
|
686
|
+
}
|
|
687
|
+
: {
|
|
688
|
+
type: 'double_quote_string',
|
|
689
|
+
value: obj.left.column || obj.left.value,
|
|
690
|
+
},
|
|
671
691
|
],
|
|
672
692
|
},
|
|
673
693
|
};
|
|
@@ -702,8 +722,14 @@ export function convertStringComparison(node, databaseType) {
|
|
|
702
722
|
type: 'expr_list',
|
|
703
723
|
value: [
|
|
704
724
|
databaseType === 'BigQuery'
|
|
705
|
-
? {
|
|
706
|
-
|
|
725
|
+
? {
|
|
726
|
+
type: 'column_ref',
|
|
727
|
+
value: obj.left.column || obj.left.value,
|
|
728
|
+
}
|
|
729
|
+
: {
|
|
730
|
+
type: 'double_quote_string',
|
|
731
|
+
value: obj.left.column || obj.left.value,
|
|
732
|
+
},
|
|
707
733
|
],
|
|
708
734
|
},
|
|
709
735
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/ui.tsx"],"names":[],"mappings":";AAiBA;;;;;GAKG;AAEH,eAAO,MAAM,WAAW,2BAA4B,GAAG,4CA2BtD,CAAC;AAEF,eAAO,MAAM,oBAAoB,2BAA4B,GAAG,4CA2B/D,CAAC;AAEF,eAAO,MAAM,cAAc,UAAW,GAAG,4CAuBxC,CAAC;AAEF,eAAO,MAAM,uBAAuB,uCAKjC,GAAG,4CAiBL,CAAC;AAEF,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/ui.tsx"],"names":[],"mappings":";AAiBA;;;;;GAKG;AAEH,eAAO,MAAM,WAAW,2BAA4B,GAAG,4CA2BtD,CAAC;AAEF,eAAO,MAAM,oBAAoB,2BAA4B,GAAG,4CA2B/D,CAAC;AAEF,eAAO,MAAM,cAAc,UAAW,GAAG,4CAuBxC,CAAC;AAEF,eAAO,MAAM,uBAAuB,uCAKjC,GAAG,4CAiBL,CAAC;AAEF,eAAO,MAAM,QAAQ,sGAoFpB,CAAC;AAGF,eAAO,MAAM,mBAAmB,cAAe,GAAG,4CAEjD,CAAC;AAGF,eAAO,MAAM,sBAAsB,cAAe,GAAG,4CAEpD,CAAC;AAGF,eAAO,MAAM,YAAY,sGAiBxB,CAAC;AAGF,eAAO,MAAM,eAAe,sGAuB3B,CAAC;AAEF,eAAO,MAAM,WAAW,2BAA4B,GAAG,4CAUtD,CAAC;AAEF,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,QAAQ,EACR,KAAU,EACV,OAAO,EACP,MAAM,GACP,EAAE,GAAG,2CAgDL;AAED,eAAO,MAAM,YAAY,sGAkCxB,CAAC;AAGF,eAAO,MAAM,iBAAiB,+CAwE7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,gDAK3B,GAAG,4CA6CL,CAAC;AAGF,eAAO,MAAM,oBAAoB,kCAAmC,GAAG,4CAiDtE,CAAC;AAGF,eAAO,MAAM,uBAAuB,+CAMnC,CAAC;AAGF,eAAO,MAAM,sBAAsB,+CAMlC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;GAG/B,CAAC;AAEF,eAAO,MAAM,SAAS,sGAIrB,CAAC;AAEF,eAAO,MAAM,WAAW,8DAMrB,GAAG,4CAwBL,CAAC;AAEF,eAAO,MAAM,kBAAkB,4FAO5B,GAAG,4CAqBL,CAAC;AAEF,eAAO,MAAM,gBAAgB,sFAO1B,GAAG,4CAqBL,CAAC;AAEF,eAAO,MAAM,UAAU,sTAuBpB,GAAG,4CAqFL,CAAC;AAEF,eAAO,MAAM,gBAAgB,oDAK1B,GAAG,4CAeL,CAAC"}
|
|
@@ -80,15 +80,27 @@ export const QuillTag = forwardRef(({ label, onClick, children, onClickDelete, h
|
|
|
80
80
|
boxShadow: '0px 1px 4px #e2e8f005',
|
|
81
81
|
border: '1px solid #e2e8f0',
|
|
82
82
|
borderRadius: 6,
|
|
83
|
+
paddingLeft: 8,
|
|
83
84
|
display: 'flex',
|
|
85
|
+
minHeight: 30,
|
|
84
86
|
flexDirection: 'row',
|
|
85
87
|
width: '100%',
|
|
86
|
-
padding: '4px 8px',
|
|
87
88
|
alignItems: 'center',
|
|
88
89
|
backgroundColor: theme?.backgroundColor || 'white',
|
|
89
90
|
fontFamily: theme?.fontFamily,
|
|
90
91
|
fontSize: 14,
|
|
91
|
-
|
|
92
|
+
whiteSpace: 'nowrap',
|
|
93
|
+
textOverflow: 'ellipsis',
|
|
94
|
+
maxWidth: '100%',
|
|
95
|
+
}, ref: forwardedRef, onClick: onClick, children: [_jsx("div", { style: {
|
|
96
|
+
alignItems: 'center',
|
|
97
|
+
fontFamily: theme?.fontFamily,
|
|
98
|
+
fontSize: 14,
|
|
99
|
+
whiteSpace: 'nowrap',
|
|
100
|
+
textOverflow: 'ellipsis',
|
|
101
|
+
maxWidth: '90%',
|
|
102
|
+
overflow: 'hidden',
|
|
103
|
+
}, children: label ?? children }), !hideDelete && (_jsx("div", { style: {
|
|
92
104
|
marginLeft: 'auto',
|
|
93
105
|
marginRight: '8px',
|
|
94
106
|
display: 'flex',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiComponents.d.ts","sourceRoot":"","sources":["../../../src/components/UiComponents.tsx"],"names":[],"mappings":"AACA,OAAO,KAAwC,MAAM,OAAO,CAAC;AAK7D,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,GAAG,CAAC;CACZ;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAA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ED,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,OAAO,EACP,SAAS,EACT,KAAK,EACL,QAAQ,EACR,KAAK,EACL,KAAU,GACX;;;;;;;;CAAA,kDA4FA;AAED,eAAO,MAAM,oBAAoB;;;6CA0BhC,CAAC;AAEF,eAAO,MAAM,cAAc,+CAwD1B,CAAC"}
|
|
@@ -140,6 +140,7 @@ export const MemoizedLabel = ({ children }) => {
|
|
|
140
140
|
color: theme?.secondaryTextColor || '#575E6A',
|
|
141
141
|
userSelect: 'none',
|
|
142
142
|
paddingBottom: 5,
|
|
143
|
+
margin: 0,
|
|
143
144
|
}, children: children }));
|
|
144
145
|
};
|
|
145
146
|
export const MemoizedCheckbox = ({ checked, onChange, style = {}, ...props }) => (_jsx("input", { type: "checkbox", checked: checked, onChange: () => onChange(!checked), style: { width: '14px', height: '14px', margin: 'auto 0', ...style }, ...props }));
|
|
@@ -178,13 +179,17 @@ export const MemoizedTabs = ({ defaultValue, options, onValueChange }) => (_jsx(
|
|
|
178
179
|
color: '#606572',
|
|
179
180
|
}),
|
|
180
181
|
}, children: label }))) }));
|
|
181
|
-
export const MemoizedText = ({ children }) =>
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
182
|
+
export const MemoizedText = ({ children }) => {
|
|
183
|
+
const [theme] = useContext(ThemeContext);
|
|
184
|
+
return (_jsx("p", { style: {
|
|
185
|
+
fontSize: 12,
|
|
186
|
+
fontWeight: 400,
|
|
187
|
+
margin: 0,
|
|
188
|
+
color: '#575E6A',
|
|
189
|
+
userSelect: 'none',
|
|
190
|
+
fontFamily: theme?.fontFamily,
|
|
191
|
+
}, children: children }));
|
|
192
|
+
};
|
|
188
193
|
const useOnClickOutside = (ref, handler) => {
|
|
189
194
|
useEffect(() => {
|
|
190
195
|
const listener = (event) => {
|
|
@@ -300,8 +305,8 @@ export function MemoizedModal({ isOpen, onClose, setIsOpen, title, children, the
|
|
|
300
305
|
}, children: title }), _jsx(MemoizedDeleteButton, { onClick: onClose, style: { marginRight: 10, marginTop: 10 } })] }), children] }) })] }));
|
|
301
306
|
}
|
|
302
307
|
export const MemoizedDeleteButton = ({ onClick, style }) => (_jsxs("button", { className: "quill-delete-button", type: "button", onClick: onClick, style: {
|
|
303
|
-
height:
|
|
304
|
-
width:
|
|
308
|
+
height: 40,
|
|
309
|
+
width: 40,
|
|
305
310
|
border: 'none',
|
|
306
311
|
cursor: 'pointer',
|
|
307
312
|
display: 'flex',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PivotList.d.ts","sourceRoot":"","sources":["../../../../src/internals/ReportBuilder/PivotList.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PivotList.d.ts","sourceRoot":"","sources":["../../../../src/internals/ReportBuilder/PivotList.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;6CA8MrB,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;6CAmFrB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { QuillCard } from '../../components/QuillCard';
|
|
3
3
|
import { quillFormat } from '../../utils/valueFormatter';
|
|
4
|
+
import { snakeCaseToTitleCase } from '../../utils/textProcessing';
|
|
4
5
|
export const PivotCard = ({ pivotTable, theme, index, onSelectPivot, selectedPivotIndex, onEditPivot, ButtonComponent, showEdit = false, clickable = true, onClose = () => { }, minHeight = 0, LabelComponent, TextComponent, HeaderComponent, }) => {
|
|
5
6
|
const maxRowsInPivotPeak = 5;
|
|
6
7
|
return (_jsx(QuillCard, { theme: theme, onClick: () => onSelectPivot(pivotTable.pivot, index), isSelected: index === selectedPivotIndex, clickable: clickable, onClose: onClose, minHeight: minHeight, children: _jsxs("div", { style: {
|
|
@@ -17,7 +18,32 @@ export const PivotCard = ({ pivotTable, theme, index, onSelectPivot, selectedPiv
|
|
|
17
18
|
whiteSpace: 'nowrap',
|
|
18
19
|
textOverflow: 'ellipsis',
|
|
19
20
|
paddingBottom: 6,
|
|
20
|
-
}, children: _jsx(HeaderComponent, { children: pivotTable.pivot.title }) })), _jsxs("table", { children: [_jsx("thead", { children:
|
|
21
|
+
}, children: _jsx(HeaderComponent, { children: pivotTable.pivot.title }) })), pivotTable.columns.length === 0 ? (_jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [pivotTable.pivot.rowField && (_jsx("th", { style: {
|
|
22
|
+
fontWeight: 600,
|
|
23
|
+
paddingRight: 5,
|
|
24
|
+
flex: 1,
|
|
25
|
+
textAlign: 'left',
|
|
26
|
+
whiteSpace: 'nowrap',
|
|
27
|
+
textOverflow: 'ellipsis',
|
|
28
|
+
}, children: _jsx(LabelComponent, { children: snakeCaseToTitleCase(pivotTable.pivot.rowField) }) }, pivotTable.pivot.rowField)), pivotTable.pivot.columnField && (_jsx("th", { style: {
|
|
29
|
+
fontWeight: 600,
|
|
30
|
+
paddingRight: 5,
|
|
31
|
+
flex: 1,
|
|
32
|
+
textAlign: 'left',
|
|
33
|
+
whiteSpace: 'nowrap',
|
|
34
|
+
textOverflow: 'ellipsis',
|
|
35
|
+
}, children: _jsx(LabelComponent, { children: snakeCaseToTitleCase(pivotTable.pivot.columnField) }) }, pivotTable.pivot.columnField)), !pivotTable.pivot.columnField &&
|
|
36
|
+
pivotTable.pivot.valueField && (_jsx("th", { style: {
|
|
37
|
+
fontWeight: 600,
|
|
38
|
+
paddingRight: 5,
|
|
39
|
+
flex: 1,
|
|
40
|
+
textAlign: 'left',
|
|
41
|
+
whiteSpace: 'nowrap',
|
|
42
|
+
textOverflow: 'ellipsis',
|
|
43
|
+
}, children: _jsx(LabelComponent, { children: snakeCaseToTitleCase(pivotTable.pivot.valueField) }) }, pivotTable.pivot.valueField))] }) }), _jsx("div", { style: {
|
|
44
|
+
paddingLeft: '2px',
|
|
45
|
+
width: '100%',
|
|
46
|
+
}, children: _jsx(TextComponent, { children: "No results" }) })] })) : (_jsxs("table", { children: [_jsx("thead", { children: _jsx("tr", { children: pivotTable.columns.map((column) => (_jsx("th", { style: {
|
|
21
47
|
fontWeight: 600,
|
|
22
48
|
paddingRight: 5,
|
|
23
49
|
flex: 1,
|
|
@@ -36,7 +62,7 @@ export const PivotCard = ({ pivotTable, theme, index, onSelectPivot, selectedPiv
|
|
|
36
62
|
value: row[colum.field],
|
|
37
63
|
format: pivotTable.pivot.valueFieldType,
|
|
38
64
|
})
|
|
39
|
-
: row[colum.field] }) }, i))) }, index))) })] })] }), _jsxs("div", { style: {
|
|
65
|
+
: row[colum.field] }) }, i))) }, index))) })] }))] }), _jsxs("div", { style: {
|
|
40
66
|
display: 'flex',
|
|
41
67
|
justifyContent: 'space-between',
|
|
42
68
|
}, children: [pivotTable.rows.length > maxRowsInPivotPeak ? (_jsx("div", { children: _jsxs(TextComponent, { children: ["...", pivotTable.rows.length - maxRowsInPivotPeak < 5
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PivotModal.d.ts","sourceRoot":"","sources":["../../../../src/internals/ReportBuilder/PivotModal.tsx"],"names":[],"mappings":"AA+BA,MAAM,WAAW,KAAK;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAkBD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"PivotModal.d.ts","sourceRoot":"","sources":["../../../../src/internals/ReportBuilder/PivotModal.tsx"],"names":[],"mappings":"AA+BA,MAAM,WAAW,KAAK;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAkBD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6CA0tBtB,CAAC;AAEF,wBAAgB,uBAAuB,CAAC,KAAK,KAAA,EAAE,IAAI,KAAA,EAAE,MAAM,KAAA,OAyB1D;AAkHD,wBAAgB,WAAW,CAAC,SAAS,KAAA,WAYpC;AAgCD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,GAAG,EACT,SAAS,EAAE,GAAG,EACd,YAAY,EAAE,OAAO,EACrB,QAAQ,SAAK,EACb,SAAS,GAAE,GAAU;;;;;;EA6btB"}
|
|
@@ -151,6 +151,11 @@ export const PivotModal = ({ pivotRowField, setPivotRowField, pivotColumnField,
|
|
|
151
151
|
setRecommendedPivots(recommendedPivots
|
|
152
152
|
.filter((pivot) => pivot.rowField != '')
|
|
153
153
|
.map((pivot) => {
|
|
154
|
+
if (columnsToShow[pivot.columnField] === 'date') {
|
|
155
|
+
const columnField = pivot.columnField;
|
|
156
|
+
pivot.columnField = pivot.rowField;
|
|
157
|
+
pivot.rowField = columnField;
|
|
158
|
+
}
|
|
154
159
|
return {
|
|
155
160
|
...pivot,
|
|
156
161
|
rowFieldType: columnsToShow[pivot.rowField],
|
|
@@ -765,6 +770,16 @@ export function generatePivotTable(pivot, data, dateRange, isComparison, rowLimi
|
|
|
765
770
|
: 0;
|
|
766
771
|
}
|
|
767
772
|
break;
|
|
773
|
+
case 'avg':
|
|
774
|
+
value = filteredData.length
|
|
775
|
+
? filteredData.reduce((sum, item) => sum + parseFloat(item[key] ?? 0), 0) / filteredData.length
|
|
776
|
+
: 0;
|
|
777
|
+
if (isComparison) {
|
|
778
|
+
comparisonValue = comparisonFilteredData.length
|
|
779
|
+
? comparisonFilteredData.reduce((sum, item) => sum + parseFloat(item[key] ?? 0), 0) / comparisonFilteredData.length
|
|
780
|
+
: 0;
|
|
781
|
+
}
|
|
782
|
+
break;
|
|
768
783
|
case 'max':
|
|
769
784
|
value = filteredData.reduce((max, item) => Math.max(max, parseFloat(item[key] ?? 0)), -Infinity);
|
|
770
785
|
if (isComparison) {
|
|
@@ -877,11 +892,16 @@ function valueFieldAggregation(data, valueField, aggregationType) {
|
|
|
877
892
|
value = data.reduce((sum, item) => sum + parseFloat(item[valueField] ?? 0), 0);
|
|
878
893
|
break;
|
|
879
894
|
case 'count':
|
|
880
|
-
value =
|
|
895
|
+
value = data.length;
|
|
896
|
+
break;
|
|
897
|
+
case 'avg':
|
|
898
|
+
value = data.length
|
|
899
|
+
? data.reduce((sum, item) => sum + parseFloat(item[valueField] ?? 0), 0) / data.length
|
|
900
|
+
: 0;
|
|
881
901
|
break;
|
|
882
902
|
case 'average':
|
|
883
|
-
value =
|
|
884
|
-
?
|
|
903
|
+
value = data.length
|
|
904
|
+
? data.reduce((sum, item) => sum + parseFloat(item[valueField] ?? 0), 0) / data.length
|
|
885
905
|
: 0;
|
|
886
906
|
break;
|
|
887
907
|
case 'max':
|