@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
|
@@ -3,6 +3,7 @@ import { useState, useContext } from 'react';
|
|
|
3
3
|
import { QuillSelectComponent } from '../QuillSelect';
|
|
4
4
|
import { MemoizedButton, MemoizedSecondaryButton } from '../UiComponents';
|
|
5
5
|
import { ThemeContext } from '../../Context';
|
|
6
|
+
import { snakeCaseToTitleCase } from '../../utils/textProcessing';
|
|
6
7
|
const SORT_VALUE_TO_LABEL = {
|
|
7
8
|
ASC: 'ascending',
|
|
8
9
|
DESC: 'descending',
|
|
@@ -24,7 +25,7 @@ export const SortSentence = ({ sortData, keyPrefix, columns, handleDelete, setEd
|
|
|
24
25
|
// @ts-ignore
|
|
25
26
|
, {
|
|
26
27
|
// @ts-ignore
|
|
27
|
-
filterLabel: `${sortData.expr.column || sortData.expr.value} is ${SORT_VALUE_TO_LABEL[sortData.type]}`, onClickDelete: handleClickDelete, popoverTitle: popoverTitle, popoverChildren: _jsx(EditPopover, { onSave: (column, direction) => {
|
|
28
|
+
filterLabel: `${snakeCaseToTitleCase(sortData.expr.column) || snakeCaseToTitleCase(sortData.expr.value)} is ${SORT_VALUE_TO_LABEL[sortData.type]}`, onClickDelete: handleClickDelete, popoverTitle: popoverTitle, popoverChildren: _jsx(EditPopover, { onSave: (column, direction) => {
|
|
28
29
|
setIsOpen(false);
|
|
29
30
|
onSave(column, direction);
|
|
30
31
|
}, columns: columns, isEdit: true, onDelete: handleClickDelete, column: sortData.expr.column || sortData.expr.value }), isOpen: isOpen, setIsOpen: setIsOpen, onDelete: () => {
|
|
@@ -37,11 +38,16 @@ export const AddSortPopover = ({ onSave, columns, isEdit, onDelete, column, }) =
|
|
|
37
38
|
const [sortColumn, setSortColumn] = useState(column || '');
|
|
38
39
|
const [sortDirection, setSortDirection] = useState('ASC');
|
|
39
40
|
const [theme] = useContext(ThemeContext);
|
|
40
|
-
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 12 }, children: [_jsxs("div", { style: {
|
|
41
|
+
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 12 }, children: [_jsxs("div", { style: {
|
|
42
|
+
display: 'flex',
|
|
43
|
+
flexDirection: 'row',
|
|
44
|
+
gap: 12,
|
|
45
|
+
padding: '6px 0px',
|
|
46
|
+
}, children: [_jsx(QuillSelectComponent, { theme: theme, value: sortColumn, onChange: (value) => {
|
|
41
47
|
setSortColumn(value);
|
|
42
48
|
}, options: [
|
|
43
49
|
...columns.map((column) => ({
|
|
44
|
-
label: column.split('.')[1],
|
|
50
|
+
label: snakeCaseToTitleCase(column.split('.')[1] || ''),
|
|
45
51
|
value: column.split('.')[1],
|
|
46
52
|
})),
|
|
47
53
|
] }), _jsx(QuillSelectComponent, { theme: theme, value: sortDirection, onChange: (value) => {
|
|
@@ -54,5 +60,5 @@ export const AddSortPopover = ({ onSave, columns, isEdit, onDelete, column, }) =
|
|
|
54
60
|
flexDirection: 'row',
|
|
55
61
|
justifyContent: 'end',
|
|
56
62
|
gap: 12,
|
|
57
|
-
}, children: isEdit ? (_jsxs(_Fragment, { children: [_jsx(MemoizedSecondaryButton, { onClick: onDelete, label: "Delete" }), _jsx(MemoizedButton, { onClick: () => onSave(sortColumn, sortDirection), label: "
|
|
63
|
+
}, children: isEdit ? (_jsxs(_Fragment, { children: [_jsx(MemoizedSecondaryButton, { onClick: onDelete, label: "Delete" }), _jsx(MemoizedButton, { onClick: () => onSave(sortColumn, sortDirection), label: "Edit sort" })] })) : (_jsx(MemoizedButton, { onClick: () => onSave(sortColumn, sortDirection), label: "Add sort" })) })] }));
|
|
58
64
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bigDateMap.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/bigDateMap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bigDateMap.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/bigDateMap.ts"],"names":[],"mappings":"AAaA;;GAEG;AACH,eAAO,MAAM,oBAAoB;wBAoCnB,GAAG;CAmpBhB,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// A giant map of partial objects keys to functions that take the root node
|
|
2
2
|
// and return a strinified version of the node. Used to populate the filters.
|
|
3
|
+
import { snakeCaseToTitleCase } from '../../utils/textProcessing';
|
|
3
4
|
/**
|
|
4
5
|
* Trims off the _at suffix of columnNames so "created_at" becomes "created"
|
|
5
6
|
*/
|
|
6
7
|
function cleanDateFieldName(fieldName) {
|
|
7
8
|
if (!fieldName)
|
|
8
9
|
return undefined;
|
|
9
|
-
return fieldName.replace('_at', '');
|
|
10
|
+
return snakeCaseToTitleCase(fieldName.replace('_at', ''));
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* A big map of partial objects and a callback to convert each to a string.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/ui.tsx"],"names":[],"mappings":";
|
|
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,sGAoEpB,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"}
|
|
@@ -5,6 +5,7 @@ import MemoizedQuillTable from '../QuillTable';
|
|
|
5
5
|
import { ThemeContext } from '../../Context';
|
|
6
6
|
import { isNodeEmptyCollection } from './util';
|
|
7
7
|
import { downloadCSV } from '../../utils/csv';
|
|
8
|
+
import { snakeCaseToTitleCase } from '../../utils/textProcessing';
|
|
8
9
|
/**
|
|
9
10
|
* This file is a collection of basic UI components that conform to the shape
|
|
10
11
|
* expected by the Report Builder. Where possible, we use our existing
|
|
@@ -106,7 +107,7 @@ export const QuillSidebarHeading = ({ label }) => (_jsx(MemoizedHeader, { childr
|
|
|
106
107
|
export const QuillSidebarSubHeading = ({ label }) => (_jsx(MemoizedLabel, { children: label }));
|
|
107
108
|
// The gray thing on the left.
|
|
108
109
|
export const QuillSidebar = forwardRef(({ children, ...props }, forwardedRef) => (_jsx("div", { style: {
|
|
109
|
-
|
|
110
|
+
overflowX: 'visible',
|
|
110
111
|
padding: '12px',
|
|
111
112
|
width: '25%',
|
|
112
113
|
height: '100%',
|
|
@@ -175,7 +176,7 @@ export const QuillPopover = forwardRef(({ children, trigger, isOpen, onClose = (
|
|
|
175
176
|
fontSize: 18,
|
|
176
177
|
margin: 0,
|
|
177
178
|
textAlign: 'left',
|
|
178
|
-
|
|
179
|
+
marginBottom: 5,
|
|
179
180
|
color: theme?.primaryTextColor,
|
|
180
181
|
fontFamily: theme?.fontFamily,
|
|
181
182
|
}, children: title })), children] }));
|
|
@@ -250,7 +251,7 @@ export const QuillSelectColumn = ({ label, selected, setSelected, children, }) =
|
|
|
250
251
|
overflow: 'hidden',
|
|
251
252
|
fontFamily: theme?.fontFamily,
|
|
252
253
|
color: theme?.primaryTextColor,
|
|
253
|
-
}, children: label })] })] }));
|
|
254
|
+
}, children: snakeCaseToTitleCase(label) })] })] }));
|
|
254
255
|
};
|
|
255
256
|
// A draggable card with a grab-handle and a column name
|
|
256
257
|
export const QuillDraggableColumn = ({ label, children, onDelete }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../src/components/ReportBuilder/util.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,eAAO,MAAM,qBAAqB,SAAU,GAAG,YAW9C,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,GAAG,WAa1C;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,GAAG,WAK5C;AAGD,eAAO,MAAM,WAAW,SAAU,GAAG,YAuBpC,CAAC;AAKF,eAAO,MAAM,oBAAoB,SAAU,GAAG,QAE7C,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG;;;;;;;;EAU3C;AAKD,eAAO,MAAM,eAAe,QAAS,GAAG,QAMvC,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,WAiBvD;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,GAAG,iBAQjD;AAED,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,GAAG,EACT,YAAY,EAAE,MAAM,GACnB,MAAM,GAAG,IAAI,CAOf;AAQD,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,GAAG,EACT,YAAY,EAAE,MAAM,GACnB,MAAM,GAAG,IAAI,CAWf;AAED,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,GAAG,EACT,YAAY,EAAE,MAAM,GACnB,MAAM,GAAG,IAAI,CAOf;AAMD,eAAO,MAAM,mBAAmB,SAAU,GAAG,gBAAgB,MAAM,YA4BlE,CAAC;AAIF,eAAO,MAAM,2BAA2B,SAAU,GAAG,YAUpD,CAAC;AAIF,eAAO,MAAM,oBAAoB,SACzB,GAAG,gBACK,MAAM,KACnB,OAoBF,CAAC;AAEF,eAAO,MAAM,qBAAqB,SAAU,GAAG,gBAAgB,MAAM,QAYpE,CAAC;AAEF,eAAO,MAAM,4BAA4B,SAAU,GAAG,KAAG,OAUxD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,SAAU,GAAG,QA4B3C,CAAC;AAGF,eAAO,MAAM,UAAU,eAAgB,MAAM,SAe5C,CAAC;AAmBF;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,MAAM,UAsBvE;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,UAgB9C;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,MAAM,sBAmBtE;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,SAAU,GAAG,YAU1C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,SAAU,GAAG,YAOxC,CAAC;AAEF,wBAAgB,aAAa,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,WAehD;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,GAAG,GACV,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAyB1C;AAED,eAAO,MAAM,QAAQ,QAAS,GAAG,QAAoC,CAAC;AAEtE,eAAO,MAAM,QAAQ,MAAO,MAAM,WAA2C,CAAC;AA4L9E,eAAO,MAAM,iBAAiB,SAAU,GAAG;;;;;;;CAc1C,CAAC;AAqCF,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,OAQvE"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// A collection of reusable, pure, utility functions for the Report Builder.
|
|
2
2
|
import { getQuarter } from 'date-fns';
|
|
3
3
|
import { DATE_DESCRIPTION_MAP } from './bigDateMap';
|
|
4
|
+
import { snakeCaseToTitleCase } from '../../utils/textProcessing';
|
|
4
5
|
/**
|
|
5
6
|
* A node that is "in" or "not in" where none of the variants are selected.
|
|
6
7
|
*/
|
|
@@ -120,7 +121,7 @@ export function formatDateComparisonNode(node) {
|
|
|
120
121
|
}
|
|
121
122
|
export function getInTheCurrentIntervalSentence(node, databaseType) {
|
|
122
123
|
if (databaseType === 'BigQuery') {
|
|
123
|
-
const dateColumn = node.left.args.value[0].column;
|
|
124
|
+
const dateColumn = snakeCaseToTitleCase(node.left.args.value[0].column);
|
|
124
125
|
const periodValue = node.left.args.value[1].column.toLowerCase();
|
|
125
126
|
return `${dateColumn} in the current ${periodValue}`;
|
|
126
127
|
}
|
|
@@ -133,7 +134,7 @@ const BIG_QUERY_DAY_TO_INTERVAL_MAP = {
|
|
|
133
134
|
};
|
|
134
135
|
export function getInTheLastIntervalSentence(node, databaseType) {
|
|
135
136
|
if (databaseType === 'BigQuery') {
|
|
136
|
-
const dateColumn = node.left.column;
|
|
137
|
+
const dateColumn = snakeCaseToTitleCase(node.left.column);
|
|
137
138
|
const amount = node.right.args.value[1].expr.value;
|
|
138
139
|
let unit = node.right.args.value[1].unit.toLowerCase();
|
|
139
140
|
if (unit.includes('*')) {
|
|
@@ -145,7 +146,7 @@ export function getInTheLastIntervalSentence(node, databaseType) {
|
|
|
145
146
|
}
|
|
146
147
|
export function getInThePreviousIntervalSentence(node, databaseType) {
|
|
147
148
|
if (databaseType === 'BigQuery') {
|
|
148
|
-
const dateColumn = node.left.args.value[0].column;
|
|
149
|
+
const dateColumn = snakeCaseToTitleCase(node.left.args.value[0].column);
|
|
149
150
|
const periodValue = node.left.args.value[1].column.toLowerCase();
|
|
150
151
|
return `${dateColumn} in the previous ${periodValue}`;
|
|
151
152
|
}
|
|
@@ -201,6 +202,7 @@ export const isTheCurrentInterval = (node, databaseType) => {
|
|
|
201
202
|
const isInsideOfDateTrunc = ['AND'].includes(node.operator) &&
|
|
202
203
|
(node.left.operator === '=' || node.left.type === 'double_quote_string') &&
|
|
203
204
|
node.right.operator === '=' &&
|
|
205
|
+
node.right.name &&
|
|
204
206
|
node.right.name.toLowerCase() === 'date_trunc' &&
|
|
205
207
|
node.args.value[0].type === 'single_quote_string' &&
|
|
206
208
|
node.args.value[1].type === 'binary_expr' &&
|
|
@@ -356,14 +358,14 @@ export function tryConvertDateEquality(node, databaseType) {
|
|
|
356
358
|
if (isDateTruncEquals(node)) {
|
|
357
359
|
const columnNode = node.left.args.value[1];
|
|
358
360
|
const columnName = columnNode.column ?? columnNode.value;
|
|
359
|
-
const cleanColumnName = columnName.replaceAll('_at', '');
|
|
361
|
+
const cleanColumnName = snakeCaseToTitleCase(columnName.replaceAll('_at', ''));
|
|
360
362
|
const prettyDateSuffix = dateTruncSuffixToString(node, databaseType);
|
|
361
363
|
return `${cleanColumnName} ${prettyDateSuffix}`;
|
|
362
364
|
}
|
|
363
365
|
else if (isExtractEquals(node)) {
|
|
364
366
|
const columnNode = node.left.args.source;
|
|
365
367
|
const columnName = columnNode.column ?? columnNode.value;
|
|
366
|
-
const cleanColumnName = columnName.replaceAll('_at', '');
|
|
368
|
+
const cleanColumnName = snakeCaseToTitleCase(columnName.replaceAll('_at', ''));
|
|
367
369
|
const prettyDateSuffix = extractSuffixToString(node);
|
|
368
370
|
return `${cleanColumnName} ${prettyDateSuffix}`;
|
|
369
371
|
}
|
|
@@ -8,7 +8,7 @@ export interface Pivot {
|
|
|
8
8
|
title?: string;
|
|
9
9
|
triggerButtonText?: string;
|
|
10
10
|
}
|
|
11
|
-
export declare const PivotModal: ({ pivotRowField, setPivotRowField, pivotColumnField, setPivotColumnField, pivotValueField, setPivotValueField, pivotAggregation, setPivotAggregation, popUpTitle, setPopUpTitle, selectedTable, SelectComponent, ButtonComponent, PopoverComponent, HeaderComponent, LabelComponent, TextComponent, selectedPivotIndex, setSelectedPivotIndex, removePivot, selectPivot, showUpdatePivot, setShowUpdatePivot, data, columns, theme, isOpen, setIsOpen, dateRange, createdPivots, setCreatedPivots, recommendedPivots, setRecommendedPivots, triggerButtonText, showPivotEditButton, showEditOnPivotClick, selectPivotOnEdit, showTrigger, rightAlign, parentRef, recommendPivotCount, }: {
|
|
11
|
+
export declare const PivotModal: ({ pivotRowField, setPivotRowField, pivotColumnField, setPivotColumnField, pivotValueField, setPivotValueField, pivotAggregation, setPivotAggregation, popUpTitle, setPopUpTitle, selectedTable, SelectComponent, ButtonComponent, SecondaryButtonComponent, PopoverComponent, HeaderComponent, LabelComponent, TextComponent, selectedPivotIndex, setSelectedPivotIndex, removePivot, selectPivot, showUpdatePivot, setShowUpdatePivot, data, columns, theme, isOpen, setIsOpen, dateRange, createdPivots, setCreatedPivots, recommendedPivots, setRecommendedPivots, triggerButtonText, showPivotEditButton, showEditOnPivotClick, selectPivotOnEdit, showTrigger, rightAlign, parentRef, recommendPivotCount, }: {
|
|
12
12
|
pivotRowField: any;
|
|
13
13
|
setPivotRowField: any;
|
|
14
14
|
pivotColumnField: any;
|
|
@@ -22,6 +22,7 @@ export declare const PivotModal: ({ pivotRowField, setPivotRowField, pivotColumn
|
|
|
22
22
|
selectedTable: any;
|
|
23
23
|
SelectComponent: any;
|
|
24
24
|
ButtonComponent: any;
|
|
25
|
+
SecondaryButtonComponent: any;
|
|
25
26
|
PopoverComponent: any;
|
|
26
27
|
HeaderComponent: any;
|
|
27
28
|
LabelComponent: any;
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6CAqtBtB,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;;;;;;EA6atB"}
|
|
@@ -3,13 +3,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useCallback, useContext, useMemo, useState, useEffect, useRef, } from 'react';
|
|
4
4
|
import { ClientContext } from '../../Context';
|
|
5
5
|
import { getDataFromCloud } from '../../utils/dataFetcher';
|
|
6
|
-
import { RefreshIcon } from '../../assets';
|
|
7
6
|
import { PivotList, PivotCard } from './PivotList';
|
|
8
7
|
import { differenceInDays, eachDayOfInterval, eachMonthOfInterval, eachWeekOfInterval, eachYearOfInterval, endOfDay, isWithinInterval, subMilliseconds, min, max, add, } from 'date-fns';
|
|
9
8
|
import { valueFormatter } from '../../utils/valueFormatter';
|
|
10
9
|
import { numberFormatOptions, dateFormatOptions } from '../../ChartBuilder';
|
|
11
10
|
import { snakeCaseToTitleCase } from '../../utils/textProcessing';
|
|
12
|
-
import { QuillCard } from '../../components/QuillCard';
|
|
13
11
|
const QuillHover = () => {
|
|
14
12
|
return (_jsx("style", { children: `
|
|
15
13
|
.quill-hover {
|
|
@@ -23,7 +21,7 @@ const QuillHover = () => {
|
|
|
23
21
|
}
|
|
24
22
|
` }));
|
|
25
23
|
};
|
|
26
|
-
export const PivotModal = ({ pivotRowField, setPivotRowField, pivotColumnField, setPivotColumnField, pivotValueField, setPivotValueField, pivotAggregation, setPivotAggregation, popUpTitle, setPopUpTitle, selectedTable, SelectComponent, ButtonComponent, PopoverComponent, HeaderComponent, LabelComponent, TextComponent, selectedPivotIndex, setSelectedPivotIndex, removePivot, selectPivot, showUpdatePivot, setShowUpdatePivot, data, columns, theme, isOpen, setIsOpen, dateRange, createdPivots, setCreatedPivots, recommendedPivots, setRecommendedPivots, triggerButtonText = 'Pivot', showPivotEditButton = false, showEditOnPivotClick = true, selectPivotOnEdit = false, showTrigger = true, rightAlign = false, parentRef, recommendPivotCount = 6, }) => {
|
|
24
|
+
export const PivotModal = ({ pivotRowField, setPivotRowField, pivotColumnField, setPivotColumnField, pivotValueField, setPivotValueField, pivotAggregation, setPivotAggregation, popUpTitle, setPopUpTitle, selectedTable, SelectComponent, ButtonComponent, SecondaryButtonComponent, PopoverComponent, HeaderComponent, LabelComponent, TextComponent, selectedPivotIndex, setSelectedPivotIndex, removePivot, selectPivot, showUpdatePivot, setShowUpdatePivot, data, columns, theme, isOpen, setIsOpen, dateRange, createdPivots, setCreatedPivots, recommendedPivots, setRecommendedPivots, triggerButtonText = 'Pivot', showPivotEditButton = false, showEditOnPivotClick = true, selectPivotOnEdit = false, showTrigger = true, rightAlign = false, parentRef, recommendPivotCount = 6, }) => {
|
|
27
25
|
const [isLoading, setIsLoading] = useState(false);
|
|
28
26
|
const [pivotUpdateIndex, setPivotUpdateIndex] = useState(null);
|
|
29
27
|
const [selectedPivotType, setSelectedPivotType] = useState('recommended');
|
|
@@ -93,7 +91,7 @@ export const PivotModal = ({ pivotRowField, setPivotRowField, pivotColumnField,
|
|
|
93
91
|
const columnSelectOptions = useMemo(() => {
|
|
94
92
|
return [
|
|
95
93
|
...Object.keys(columnsToShow).map((key) => {
|
|
96
|
-
return { label: key, value: key };
|
|
94
|
+
return { label: snakeCaseToTitleCase(key), value: key };
|
|
97
95
|
}),
|
|
98
96
|
];
|
|
99
97
|
}, [columnsToShow]);
|
|
@@ -227,6 +225,9 @@ export const PivotModal = ({ pivotRowField, setPivotRowField, pivotColumnField,
|
|
|
227
225
|
setShowUpdatePivot(false);
|
|
228
226
|
setPopUpTitle('Add Pivot');
|
|
229
227
|
}, style: rightAlign ? { right: 0 } : {}, parentRef: parentRef, showTrigger: showTrigger, label: triggerButtonText, isOpen: isOpen, setIsOpen: setIsOpen, onClick: () => {
|
|
228
|
+
if (columns.length === 0) {
|
|
229
|
+
setIsOpen(false);
|
|
230
|
+
}
|
|
230
231
|
// table is not loaded yet, so pivot button is not clickable
|
|
231
232
|
if (Object.keys(columnsToShow).length === 0) {
|
|
232
233
|
return;
|
|
@@ -239,12 +240,10 @@ export const PivotModal = ({ pivotRowField, setPivotRowField, pivotColumnField,
|
|
|
239
240
|
backgroundColor: 'rgb(255, 255, 255)',
|
|
240
241
|
display: 'flex',
|
|
241
242
|
flexDirection: 'column',
|
|
242
|
-
}, children: [_jsx(HeaderComponent, { children: popUpTitle }), _jsx("div", { style: { height: 12 } }), _jsx("div", { style: { width: divWidth }, children: samplePivotTable
|
|
243
|
+
}, children: [_jsx(HeaderComponent, { children: popUpTitle }), _jsx("div", { style: { height: 12 } }), _jsx("div", { style: { width: divWidth }, children: samplePivotTable && (_jsx("div", { style: {
|
|
243
244
|
marginBottom: 20,
|
|
244
245
|
minHeight: 160,
|
|
245
|
-
}, children: _jsx(PivotCard, { pivotTable: samplePivotTable, theme: theme, index: 0, onSelectPivot: () => { }, selectedPivotIndex: -1, onEditPivot: () => { }, ButtonComponent: ButtonComponent, showEdit: false, clickable: false, minHeight: 140, LabelComponent: LabelComponent, TextComponent: TextComponent, HeaderComponent: HeaderComponent }) }))
|
|
246
|
-
color: theme.secondaryTextColor,
|
|
247
|
-
}, children: "Select a row field and aggregation type to see a preview" }) }) })) }), _jsxs("div", { style: {
|
|
246
|
+
}, children: _jsx(PivotCard, { pivotTable: samplePivotTable, theme: theme, index: 0, onSelectPivot: () => { }, selectedPivotIndex: -1, onEditPivot: () => { }, ButtonComponent: ButtonComponent, showEdit: false, clickable: false, minHeight: 140, LabelComponent: LabelComponent, TextComponent: TextComponent, HeaderComponent: HeaderComponent }) })) }), _jsxs("div", { style: {
|
|
248
247
|
display: 'flex',
|
|
249
248
|
flexDirection: 'column',
|
|
250
249
|
gap: 10,
|
|
@@ -352,26 +351,24 @@ export const PivotModal = ({ pivotRowField, setPivotRowField, pivotColumnField,
|
|
|
352
351
|
columns: selectedPivotTable?.columns,
|
|
353
352
|
}, theme: theme, index: 0, onSelectPivot: () => { }, selectedPivotIndex: -1, onEditPivot: () => { }, ButtonComponent: ButtonComponent, showEdit: false, onClose: () => {
|
|
354
353
|
removePivot();
|
|
355
|
-
}, clickable: true, minHeight: 180, LabelComponent: LabelComponent, TextComponent: TextComponent, HeaderComponent: HeaderComponent }) }) })) : (_jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
borderRadius: 5,
|
|
374
|
-
}, className: "quill-hover", children: [_jsx(QuillHover, {}), _jsx(RefreshIcon, { style: { marginRight: 5 } }), "Refresh"] }) }), isLoading ? (_jsxs("div", { style: {
|
|
354
|
+
}, clickable: true, minHeight: 180, LabelComponent: LabelComponent, TextComponent: TextComponent, HeaderComponent: HeaderComponent }) }) })) : (_jsxs("div", { style: { display: 'flex', flexDirection: 'column' }, children: [_jsxs("div", { style: {
|
|
355
|
+
display: 'flex',
|
|
356
|
+
flexDirection: 'row',
|
|
357
|
+
width: '100%',
|
|
358
|
+
alignItems: 'center',
|
|
359
|
+
justifyContent: 'space-between',
|
|
360
|
+
paddingBottom: 12,
|
|
361
|
+
}, children: [_jsx("div", { style: {
|
|
362
|
+
fontWeight: '600',
|
|
363
|
+
fontSize: 18,
|
|
364
|
+
}, children: "Recommended pivots" }), _jsx("div", { children: _jsx(SecondaryButtonComponent, { onClick: refreshPivots, label: _jsxs("div", { style: {
|
|
365
|
+
display: 'flex',
|
|
366
|
+
flexDirection: 'row',
|
|
367
|
+
whiteSpace: 'nowrap',
|
|
368
|
+
alignItems: 'center',
|
|
369
|
+
gap: 6,
|
|
370
|
+
fontSize: 14,
|
|
371
|
+
}, children: [_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", style: { width: 16, height: 16 }, children: _jsx("path", { fillRule: "evenodd", d: "M9 4.5a.75.75 0 0 1 .721.544l.813 2.846a3.75 3.75 0 0 0 2.576 2.576l2.846.813a.75.75 0 0 1 0 1.442l-2.846.813a3.75 3.75 0 0 0-2.576 2.576l-.813 2.846a.75.75 0 0 1-1.442 0l-.813-2.846a3.75 3.75 0 0 0-2.576-2.576l-2.846-.813a.75.75 0 0 1 0-1.442l2.846-.813A3.75 3.75 0 0 0 7.466 7.89l.813-2.846A.75.75 0 0 1 9 4.5ZM18 1.5a.75.75 0 0 1 .728.568l.258 1.036c.236.94.97 1.674 1.91 1.91l1.036.258a.75.75 0 0 1 0 1.456l-1.036.258c-.94.236-1.674.97-1.91 1.91l-.258 1.036a.75.75 0 0 1-1.456 0l-.258-1.036a2.625 2.625 0 0 0-1.91-1.91l-1.036-.258a.75.75 0 0 1 0-1.456l1.036-.258a2.625 2.625 0 0 0 1.91-1.91l.258-1.036A.75.75 0 0 1 18 1.5ZM16.5 15a.75.75 0 0 1 .712.513l.394 1.183c.15.447.5.799.948.948l1.183.395a.75.75 0 0 1 0 1.422l-1.183.395c-.447.15-.799.5-.948.948l-.395 1.183a.75.75 0 0 1-1.422 0l-.395-1.183a1.5 1.5 0 0 0-.948-.948l-1.183-.395a.75.75 0 0 1 0-1.422l1.183-.395c.447-.15.799-.5.948-.948l.395-1.183A.75.75 0 0 1 16.5 15Z", clipRule: "evenodd" }) }), "Regenerate"] }) }) })] }), isLoading ? (_jsxs("div", { style: {
|
|
375
372
|
background: theme.backgroundColor,
|
|
376
373
|
width: 250,
|
|
377
374
|
minWidth: 250,
|
|
@@ -382,7 +379,7 @@ export const PivotModal = ({ pivotRowField, setPivotRowField, pivotColumnField,
|
|
|
382
379
|
display: 'flex',
|
|
383
380
|
margin: '0px auto',
|
|
384
381
|
justifyContent: 'center',
|
|
385
|
-
}, children: [_jsx("div", { style: { height: 100 } }), _jsxs("svg", { width: "24", height: "24", children: [_jsx("circle", { cx: "12", cy: "12", r: "9.375", strokeWidth: "3.75", strokeDasharray: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 2 / 3)", strokeDashoffset: "calc(2 * 3.14 * 9.375 / 6)", stroke: theme?.primaryTextColor || '#364153', fill: "none", transform: "rotate(-90 12 12)", children: _jsx("animateTransform", { attributeName: "transform", attributeType: "XML", type: "rotate", from: "-180 12 12", to: "180 12 12", dur: "0.8s", repeatCount: "indefinite" }) }), _jsx("circle", { cx: "12", cy: "12", r: "9.375", strokeWidth: "3.75", strokeDasharray: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 1 / 3)", strokeDashoffset: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 2 / 3)", stroke: '#ADB1B9', fill: "none", transform: "rotate(90 12 12)", children: _jsx("animateTransform", { attributeName: "transform", attributeType: "XML", type: "rotate", from: "0 12 12", to: "360 12 12", dur: "0.8s", repeatCount: "indefinite" }) })] })] })) : (
|
|
382
|
+
}, children: [_jsx("div", { style: { height: 100 } }), _jsxs("svg", { width: "24", height: "24", children: [_jsx("circle", { cx: "12", cy: "12", r: "9.375", strokeWidth: "3.75", strokeDasharray: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 2 / 3)", strokeDashoffset: "calc(2 * 3.14 * 9.375 / 6)", stroke: theme?.primaryTextColor || '#364153', fill: "none", transform: "rotate(-90 12 12)", children: _jsx("animateTransform", { attributeName: "transform", attributeType: "XML", type: "rotate", from: "-180 12 12", to: "180 12 12", dur: "0.8s", repeatCount: "indefinite" }) }), _jsx("circle", { cx: "12", cy: "12", r: "9.375", strokeWidth: "3.75", strokeDasharray: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 1 / 3)", strokeDashoffset: "calc(2 * 3.14 * 9.375 / 3) calc(2 * 3.14 * 9.375 * 2 / 3)", stroke: '#ADB1B9', fill: "none", transform: "rotate(90 12 12)", children: _jsx("animateTransform", { attributeName: "transform", attributeType: "XML", type: "rotate", from: "0 12 12", to: "360 12 12", dur: "0.8s", repeatCount: "indefinite" }) })] })] })) : (_jsx("div", { children: _jsx(PivotList, { recommendedPivotTables: recommendedPivotTables, createdPivotTables: createdPivotTables, theme: theme, onSelectRecommendedPivot: onSelectRecommendedPivot, onSelectCreatedPivot: onSelectCreatedPivot, selectedPivotIndex: selectedPivotIndex, selectedPivotType: selectedPivotType, ButtonComponent: ButtonComponent, HeaderComponent: HeaderComponent, onEditRecommendedPivot: onEditRecommendedPivot, onEditCreatedPivot: onEditPivot, showCreatePivot: true, showPivotEditButton: showPivotEditButton, LabelComponent: LabelComponent, TextComponent: TextComponent }) }))] })) })) }) })] }) }));
|
|
386
383
|
};
|
|
387
384
|
export function generatePivotTableYAxis(pivot, cols, format) {
|
|
388
385
|
// Use the column field for the field and label if there is one
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDomain.d.ts","sourceRoot":"","sources":["../../../src/utils/getDomain.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"getDomain.d.ts","sourceRoot":"","sources":["../../../src/utils/getDomain.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,EAAE,CA8BtE"}
|
|
@@ -21,6 +21,9 @@ export default function getDomain(data, fields) {
|
|
|
21
21
|
});
|
|
22
22
|
});
|
|
23
23
|
const [minValue, maxValue] = numericValues.reduce(([min, max], value) => [Math.min(min, value), Math.max(max, value)], [Infinity, -Infinity]);
|
|
24
|
+
if (minValue === 0 && maxValue === 0) {
|
|
25
|
+
return [0, 1];
|
|
26
|
+
}
|
|
24
27
|
return fuzzyRound(Math.min(minValue, 0), maxValue);
|
|
25
28
|
}
|
|
26
29
|
// Rounds the range to 4 equally-spaced increments of nice,round numbers.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quillsql/react",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.13",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"import": "./dist/esm/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@monaco-editor/react": "^4.5.1",
|
|
25
25
|
"date-fns": "^2.29.3",
|
|
26
26
|
"date-fns-tz": "^2.0.0",
|
|
27
|
-
"recharts": "^2.5
|
|
27
|
+
"recharts": "^2.12.5"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@repo/eslint-config": "*",
|