@quillsql/react 2.11.13 → 2.11.14
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 +197 -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 +1 -1
- package/dist/cjs/components/ReportBuilder/convert.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/convert.js +38 -12
- package/dist/cjs/components/UiComponents.js +2 -2
- 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 +197 -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 +1 -1
- package/dist/esm/components/ReportBuilder/convert.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/convert.js +38 -12
- package/dist/esm/components/UiComponents.js +2 -2
- 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',
|
|
@@ -25,7 +25,7 @@ export const SortSentence = ({ sortData, keyPrefix, columns, handleDelete, setEd
|
|
|
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
|
};
|
|
@@ -300,8 +300,8 @@ export function MemoizedModal({ isOpen, onClose, setIsOpen, title, children, the
|
|
|
300
300
|
}, children: title }), _jsx(MemoizedDeleteButton, { onClick: onClose, style: { marginRight: 10, marginTop: 10 } })] }), children] }) })] }));
|
|
301
301
|
}
|
|
302
302
|
export const MemoizedDeleteButton = ({ onClick, style }) => (_jsxs("button", { className: "quill-delete-button", type: "button", onClick: onClick, style: {
|
|
303
|
-
height:
|
|
304
|
-
width:
|
|
303
|
+
height: 40,
|
|
304
|
+
width: 40,
|
|
305
305
|
border: 'none',
|
|
306
306
|
cursor: 'pointer',
|
|
307
307
|
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':
|