@quillsql/react 2.12.23 → 2.12.25
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/Chart.d.ts +43 -0
- package/dist/cjs/Chart.d.ts.map +1 -1
- package/dist/cjs/Chart.js +14 -7
- package/dist/cjs/Dashboard.js +1 -1
- package/dist/cjs/Table.d.ts.map +1 -1
- package/dist/cjs/Table.js +9 -8
- package/dist/cjs/components/Chart/BarChart.js +1 -1
- package/dist/cjs/components/Chart/LineChart.js +1 -1
- package/dist/cjs/hooks/useExport.d.ts.map +1 -1
- package/dist/cjs/hooks/useExport.js +102 -26
- package/dist/cjs/utils/merge.js +0 -8
- package/dist/esm/Chart.d.ts +43 -0
- package/dist/esm/Chart.d.ts.map +1 -1
- package/dist/esm/Chart.js +10 -4
- package/dist/esm/Dashboard.js +1 -1
- package/dist/esm/Table.d.ts.map +1 -1
- package/dist/esm/Table.js +9 -8
- package/dist/esm/components/Chart/BarChart.js +1 -1
- package/dist/esm/components/Chart/LineChart.js +1 -1
- package/dist/esm/hooks/useExport.d.ts.map +1 -1
- package/dist/esm/hooks/useExport.js +100 -27
- package/dist/esm/utils/merge.js +0 -8
- package/package.json +2 -1
package/dist/cjs/Chart.d.ts
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
import { QuillTheme } from './QuillProvider';
|
|
3
3
|
import { type QuillReport } from './Dashboard';
|
|
4
4
|
import { Filter } from './models/Filter';
|
|
5
|
+
interface BaseChartProps {
|
|
6
|
+
colors?: string[];
|
|
7
|
+
containerStyle?: React.CSSProperties;
|
|
8
|
+
className?: string;
|
|
9
|
+
isAnimationActive?: boolean;
|
|
10
|
+
hideXAxis?: boolean;
|
|
11
|
+
hideYAxis?: boolean;
|
|
12
|
+
hideCartesianGrid?: boolean;
|
|
13
|
+
hideDateRangeFilter?: boolean;
|
|
14
|
+
hideHorizontalCartesianGrid?: boolean;
|
|
15
|
+
hideVerticalCartesianGrid?: boolean;
|
|
16
|
+
hideSubsequentXAxisTicks?: boolean;
|
|
17
|
+
cartesianGridLineStyle?: 'solid' | 'dashed';
|
|
18
|
+
cartesianGridLineColor?: string;
|
|
19
|
+
comparisonLineStyle?: 'solid' | 'dashed';
|
|
20
|
+
mapColorsToFields?: (_report: QuillReport, _theme: QuillTheme) => ColorMapType;
|
|
21
|
+
LoadingComponent?: () => JSX.Element;
|
|
22
|
+
filters?: Filter[];
|
|
23
|
+
onClickChartElement?: (data: any) => void;
|
|
24
|
+
}
|
|
25
|
+
interface WithConfig extends BaseChartProps {
|
|
26
|
+
config: QuillReport | any;
|
|
27
|
+
}
|
|
5
28
|
export declare function isEquivalent(filters1: any[], filters2: any[]): boolean;
|
|
6
29
|
export declare function didFiltersChange(dashboardItem: any, filters: any[]): boolean;
|
|
7
30
|
export type ColorMapType = {
|
|
@@ -158,5 +181,25 @@ export interface ChartProps {
|
|
|
158
181
|
* @see https://docs.quillsql.com/components/chart
|
|
159
182
|
*/
|
|
160
183
|
declare const Chart: (props: ChartProps) => import("react/jsx-runtime").JSX.Element;
|
|
184
|
+
interface ChartDisplayProps extends WithConfig {
|
|
185
|
+
loading: boolean;
|
|
186
|
+
paginating?: boolean;
|
|
187
|
+
error?: string;
|
|
188
|
+
isComparison?: boolean;
|
|
189
|
+
colorMap?: ColorMapType;
|
|
190
|
+
reportId?: string;
|
|
191
|
+
onPageChange?: (page: {
|
|
192
|
+
currentPage: number;
|
|
193
|
+
rowsPerPage: number;
|
|
194
|
+
}) => void;
|
|
195
|
+
onSortChange?: (sort: {
|
|
196
|
+
field: string;
|
|
197
|
+
direction: string;
|
|
198
|
+
}) => void;
|
|
199
|
+
onClickChartElement?: (data: any) => void;
|
|
200
|
+
dateBucket?: string;
|
|
201
|
+
overrideTheme?: QuillTheme;
|
|
202
|
+
}
|
|
203
|
+
export declare const ChartDisplay: ({ reportId, config, colors, className, containerStyle, hideXAxis, hideYAxis, hideCartesianGrid, hideDateRangeFilter, hideHorizontalCartesianGrid, hideVerticalCartesianGrid, hideSubsequentXAxisTicks, cartesianGridLineStyle, cartesianGridLineColor, comparisonLineStyle, isAnimationActive, loading, paginating, error, isComparison, colorMap, LoadingComponent, onPageChange, onSortChange, onClickChartElement, dateBucket, overrideTheme, }: ChartDisplayProps) => import("react/jsx-runtime").JSX.Element;
|
|
161
204
|
export default Chart;
|
|
162
205
|
//# sourceMappingURL=Chart.d.ts.map
|
package/dist/cjs/Chart.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../src/Chart.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAe7C,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../src/Chart.tsx"],"names":[],"mappings":";AAaA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAe7C,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAKzC,UAAU,cAAc;IACtB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,wBAAwB,CAAC,EAAE,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jB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5E,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACpE,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,UAAU,CAAC;CAC5B;AAED,eAAO,MAAM,YAAY,ubA4BtB,iBAAiB,4CAkdnB,CAAC;AAWF,eAAe,KAAK,CAAC"}
|
package/dist/cjs/Chart.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.didFiltersChange = exports.isEquivalent = void 0;
|
|
6
|
+
exports.ChartDisplay = exports.didFiltersChange = exports.isEquivalent = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
/* eslint-disable no-unused-vars */
|
|
9
9
|
const react_1 = require("react");
|
|
@@ -146,7 +146,7 @@ const Chart = (props) => {
|
|
|
146
146
|
let data = props;
|
|
147
147
|
if ('config' in data) {
|
|
148
148
|
const isLoading = Boolean(!data.config);
|
|
149
|
-
return ((0, jsx_runtime_1.jsx)(ChartDisplay, { ...data, error: isLoading || data.config?.rows ? undefined : 'No rows found', loading: isLoading, isComparison: Boolean(data?.config?.compareRows?.length), onClickChartElement: props.onClickChartElement }));
|
|
149
|
+
return ((0, jsx_runtime_1.jsx)(exports.ChartDisplay, { ...data, error: isLoading || data.config?.rows ? undefined : 'No rows found', loading: isLoading, isComparison: Boolean(data?.config?.compareRows?.length), onClickChartElement: props.onClickChartElement }));
|
|
150
150
|
}
|
|
151
151
|
const theme = (0, useTheme_1.default)();
|
|
152
152
|
const chartColors = (0, react_1.useMemo)(() => {
|
|
@@ -369,15 +369,18 @@ const ChartUpdater = ({ colors, reportId, className, containerStyle, isAnimation
|
|
|
369
369
|
setInitialLoad(false);
|
|
370
370
|
getChartData();
|
|
371
371
|
}, [specificDashboardFilter, client, reportId]);
|
|
372
|
-
return ((0, jsx_runtime_1.jsx)(ChartDisplay, { config: report, reportId: reportId, colors: colors, className: className, containerStyle: containerStyle, hideXAxis: hideXAxis, hideYAxis: hideYAxis, hideCartesianGrid: hideCartesianGrid, hideHorizontalCartesianGrid: hideHorizontalCartesianGrid, hideVerticalCartesianGrid: hideVerticalCartesianGrid, hideSubsequentXAxisTicks: hideSubsequentXAxisTicks, cartesianGridLineStyle: cartesianGridLineStyle, cartesianGridLineColor: cartesianGridLineColor, hideDateRangeFilter: hideDateRangeFilter, comparisonLineStyle: comparisonLineStyle, isAnimationActive: isAnimationActive, isComparison: isComparison, loading: loading || initialLoad, paginating: paginating, error: error, colorMap: colorMap, LoadingComponent: LoadingComponent, onPageChange: onPageChange, onSortChange: onSortChange, onClickChartElement: onClickChartElement }));
|
|
372
|
+
return ((0, jsx_runtime_1.jsx)(exports.ChartDisplay, { config: report, reportId: reportId, colors: colors, className: className, containerStyle: containerStyle, hideXAxis: hideXAxis, hideYAxis: hideYAxis, hideCartesianGrid: hideCartesianGrid, hideHorizontalCartesianGrid: hideHorizontalCartesianGrid, hideVerticalCartesianGrid: hideVerticalCartesianGrid, hideSubsequentXAxisTicks: hideSubsequentXAxisTicks, cartesianGridLineStyle: cartesianGridLineStyle, cartesianGridLineColor: cartesianGridLineColor, hideDateRangeFilter: hideDateRangeFilter, comparisonLineStyle: comparisonLineStyle, isAnimationActive: isAnimationActive, isComparison: isComparison, loading: loading || initialLoad, paginating: paginating, error: error, colorMap: colorMap, LoadingComponent: LoadingComponent, onPageChange: onPageChange, onSortChange: onSortChange, onClickChartElement: onClickChartElement }));
|
|
373
373
|
};
|
|
374
|
-
const ChartDisplay = ({ reportId, config, colors, className, containerStyle, hideXAxis, hideYAxis, hideCartesianGrid, hideDateRangeFilter = false, hideHorizontalCartesianGrid = false, hideVerticalCartesianGrid = true, hideSubsequentXAxisTicks = false, cartesianGridLineStyle = 'solid', cartesianGridLineColor, comparisonLineStyle, isAnimationActive, loading = false, paginating = false, error = undefined, isComparison = false, colorMap, LoadingComponent = ChartSkeleton_1.QuillLoadingSkeleton, onPageChange, onSortChange, onClickChartElement, dateBucket, }) => {
|
|
374
|
+
const ChartDisplay = ({ reportId, config, colors, className, containerStyle, hideXAxis, hideYAxis, hideCartesianGrid, hideDateRangeFilter = false, hideHorizontalCartesianGrid = false, hideVerticalCartesianGrid = true, hideSubsequentXAxisTicks = false, cartesianGridLineStyle = 'solid', cartesianGridLineColor, comparisonLineStyle, isAnimationActive, loading = false, paginating = false, error = undefined, isComparison = false, colorMap, LoadingComponent = ChartSkeleton_1.QuillLoadingSkeleton, onPageChange, onSortChange, onClickChartElement, dateBucket, overrideTheme, }) => {
|
|
375
375
|
const { dashboardFilters } = (0, react_1.useContext)(Context_1.DashboardFiltersContext);
|
|
376
376
|
const specificDashboardFilter = (0, react_1.useMemo)(() => {
|
|
377
|
+
if (!dashboardFilters) {
|
|
378
|
+
return [];
|
|
379
|
+
}
|
|
377
380
|
return dashboardFilters.filter((f) => f && config && config.dashboardName === f.dashboardName);
|
|
378
381
|
}, [dashboardFilters]);
|
|
379
382
|
const { downloadCSV } = (0, useExport_1.useExport)(reportId);
|
|
380
|
-
const theme = (0, useTheme_1.default)();
|
|
383
|
+
const theme = overrideTheme ?? (0, useTheme_1.default)();
|
|
381
384
|
const chartColors = (0, react_1.useMemo)(() => {
|
|
382
385
|
return colors?.length
|
|
383
386
|
? colors
|
|
@@ -426,7 +429,10 @@ const ChartDisplay = ({ reportId, config, colors, className, containerStyle, hid
|
|
|
426
429
|
return config?.pivotColumns ?? config?.yAxisFields ?? [];
|
|
427
430
|
}
|
|
428
431
|
};
|
|
429
|
-
const yAxisFields = getYAxisFields();
|
|
432
|
+
const [yAxisFields, setYAxisFields] = (0, react_1.useState)(getYAxisFields());
|
|
433
|
+
(0, react_1.useEffect)(() => {
|
|
434
|
+
setYAxisFields(getYAxisFields());
|
|
435
|
+
}, [config, specificDashboardFilter]);
|
|
430
436
|
if (error) {
|
|
431
437
|
return (0, jsx_runtime_1.jsx)(ChartError_1.default, { className: className, containerStyle: containerStyle });
|
|
432
438
|
}
|
|
@@ -436,7 +442,7 @@ const ChartDisplay = ({ reportId, config, colors, className, containerStyle, hid
|
|
|
436
442
|
config?.chartType !== 'table' &&
|
|
437
443
|
rows &&
|
|
438
444
|
rows.length > MAX_ROWS_FOR_GENERIC_TABLE) {
|
|
439
|
-
return ((0, jsx_runtime_1.jsx)(ChartError_1.default, { className: className, containerStyle: containerStyle, label:
|
|
445
|
+
return ((0, jsx_runtime_1.jsx)(ChartError_1.default, { className: className, containerStyle: containerStyle, label: `Charts can only display ${MAX_ROWS_FOR_GENERIC_TABLE} rows. Please add a pivot or modify the query.` }));
|
|
440
446
|
}
|
|
441
447
|
else if (!config || loading) {
|
|
442
448
|
return ((0, jsx_runtime_1.jsx)("div", { className: className, style: containerStyle, children: (0, jsx_runtime_1.jsx)(LoadingComponent, {}) }));
|
|
@@ -652,6 +658,7 @@ const ChartDisplay = ({ reportId, config, colors, className, containerStyle, hid
|
|
|
652
658
|
}
|
|
653
659
|
return ((0, jsx_runtime_1.jsx)(LineChart_1.default, { colors: chartColors, colorMap: colorMap, yAxisFields: yAxisFields.sort(sortComparisonFirst), data: lineChartData, xAxisField: config.xAxisField, xAxisLabel: config.xAxisLabel, xAxisFormat: config.xAxisFormat, containerStyle: containerStyle, className: className, theme: theme, comparison: dateFilter?.comparison, isAnimationActive: isAnimationActive, hideXAxis: hideXAxis, hideYAxis: hideYAxis, hideCartesianGrid: hideCartesianGrid, hideHorizontalCartesianGrid: hideHorizontalCartesianGrid, hideVerticalCartesianGrid: hideVerticalCartesianGrid, hideSubsequentXAxisTicks: hideSubsequentXAxisTicks, cartesianGridLineStyle: cartesianGridLineStyle ?? 'solid', comparisonLineStyle: comparisonLineStyle ?? 'solid', cartesianGridLineColor: cartesianGridLineColor, onClickChartElement: onClickChartElement, dateFilter: dateFilter }));
|
|
654
660
|
};
|
|
661
|
+
exports.ChartDisplay = ChartDisplay;
|
|
655
662
|
// Sort to put comparison first (ie. underneath) primary.
|
|
656
663
|
const sortComparisonFirst = (a, b) => {
|
|
657
664
|
const key = 'comparison_';
|
package/dist/cjs/Dashboard.js
CHANGED
package/dist/cjs/Table.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAe9D,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAyBD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,IAAI,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,EAAE,CAAC;IAEhC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,OAAO,CAAC,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;IAEJ;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IAEzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC;IAErC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,QAAA,MAAM,KAAK,UAAW,UAAU,4CAkC/B,CAAC;AA+GF,eAAe,KAAK,CAAC"}
|
package/dist/cjs/Table.js
CHANGED
|
@@ -12,6 +12,7 @@ const QuillTable_1 = __importDefault(require("./components/QuillTable"));
|
|
|
12
12
|
const useFormat_1 = require("./hooks/useFormat");
|
|
13
13
|
const useExport_1 = require("./hooks/useExport");
|
|
14
14
|
const errorProcessing_1 = require("./utils/errorProcessing");
|
|
15
|
+
const Chart_1 = require("./Chart");
|
|
15
16
|
/**
|
|
16
17
|
* ### Quill Table
|
|
17
18
|
*
|
|
@@ -57,9 +58,10 @@ const ChartUpdater = ({ reportId, containerStyle, className, dashboard, dispatch
|
|
|
57
58
|
const specificDashboardFilter = (0, react_1.useMemo)(() => {
|
|
58
59
|
return dashboardFilters
|
|
59
60
|
.sort((filter) => (filter.filterType === 'date_range' ? -1 : 1))
|
|
60
|
-
.filter((f) =>
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
.filter((f) => dashboard &&
|
|
62
|
+
dashboard[reportId] &&
|
|
63
|
+
f &&
|
|
64
|
+
f.dashboardName === dashboard[reportId].dashboardName);
|
|
63
65
|
}, [dashboardFilters, dashboard]);
|
|
64
66
|
const { rows, loading } = (0, useFormat_1.useMemoizedRows)(reportId);
|
|
65
67
|
const { downloadCSV } = (0, useExport_1.useExport)(reportId);
|
|
@@ -67,6 +69,9 @@ const ChartUpdater = ({ reportId, containerStyle, className, dashboard, dispatch
|
|
|
67
69
|
(0, react_1.useEffect)(() => {
|
|
68
70
|
let isSubscribed = true;
|
|
69
71
|
async function getChartOptions() {
|
|
72
|
+
if (!(0, Chart_1.didFiltersChange)(dashboard[reportId], specificDashboardFilter)) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
70
75
|
if (isSubscribed) {
|
|
71
76
|
try {
|
|
72
77
|
const hostedBody = {
|
|
@@ -110,10 +115,6 @@ const ChartUpdater = ({ reportId, containerStyle, className, dashboard, dispatch
|
|
|
110
115
|
isSubscribed = false;
|
|
111
116
|
};
|
|
112
117
|
}, [specificDashboardFilter, client.customerId, reportId]);
|
|
113
|
-
return ((0, jsx_runtime_1.jsx)(QuillTable_1.default, { hideCSVDownloadButton: hideCSVDownloadButton,
|
|
114
|
-
// @ts-ignore
|
|
115
|
-
columns: dashboard[reportId]?.columns || [],
|
|
116
|
-
// @ts-ignore
|
|
117
|
-
rows: rows || dashboard[reportId]?.rows || [], containerStyle: containerStyle, className: className, LoadingComponent: LoadingComponent, isLoading: loading, downloadCSV: downloadCSV }));
|
|
118
|
+
return ((0, jsx_runtime_1.jsx)(QuillTable_1.default, { hideCSVDownloadButton: hideCSVDownloadButton, columns: dashboard[reportId]?.columns || [], rows: rows || dashboard[reportId]?.rows || [], containerStyle: containerStyle, className: className, LoadingComponent: LoadingComponent, isLoading: loading, downloadCSV: downloadCSV }));
|
|
118
119
|
};
|
|
119
120
|
exports.default = Table;
|
|
@@ -13,7 +13,7 @@ const ChartTooltip_1 = __importDefault(require("../../components/Chart/ChartTool
|
|
|
13
13
|
const getDomain_1 = __importDefault(require("../../utils/getDomain"));
|
|
14
14
|
const react_1 = require("react");
|
|
15
15
|
function BarChart({ colors, colorMap, yAxisFields, data, containerStyle, className, xAxisField, xAxisFormat, theme, comparison, isStacked, isAnimationActive = true, hideXAxis = false, hideYAxis = false, hideCartesianGrid = false, onClickChartElement, dateFilter, }) {
|
|
16
|
-
const [formattedData, setFormattedData] = (0, react_1.useState)(
|
|
16
|
+
const [formattedData, setFormattedData] = (0, react_1.useState)(data);
|
|
17
17
|
(0, react_1.useEffect)(() => {
|
|
18
18
|
if (!data || data.length === 0) {
|
|
19
19
|
return;
|
|
@@ -14,7 +14,7 @@ const getDomain_1 = __importDefault(require("../../utils/getDomain"));
|
|
|
14
14
|
const react_1 = require("react");
|
|
15
15
|
const crypto_1 = require("../../utils/crypto");
|
|
16
16
|
function LineChart({ colors, colorMap = {}, yAxisFields, data, containerStyle, className, xAxisField, xAxisFormat, theme, comparison, isAnimationActive = true, hideXAxis = false, hideYAxis = false, hideCartesianGrid = false, hideHorizontalCartesianGrid = false, hideVerticalCartesianGrid = true, hideSubsequentXAxisTicks = false, cartesianGridLineStyle = 'solid', comparisonLineStyle = 'solid', cartesianGridLineColor, onClickChartElement = () => { }, dateFilter, }) {
|
|
17
|
-
const [formattedData, setFormattedData] = (0, react_1.useState)(
|
|
17
|
+
const [formattedData, setFormattedData] = (0, react_1.useState)(data);
|
|
18
18
|
(0, react_1.useEffect)(() => {
|
|
19
19
|
if (!data || data.length === 0) {
|
|
20
20
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExport.d.ts","sourceRoot":"","sources":["../../../src/hooks/useExport.
|
|
1
|
+
{"version":3,"file":"useExport.d.ts","sourceRoot":"","sources":["../../../src/hooks/useExport.tsx"],"names":[],"mappings":"AA6EA,eAAO,MAAM,SAAS,cAAe,MAAM;;;;CAuC1C,CAAC"}
|
|
@@ -1,12 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.useExport = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
8
|
const csv_1 = require("../utils/csv");
|
|
5
9
|
const react_1 = require("react");
|
|
6
10
|
const dataFetcher_1 = require("../utils/dataFetcher");
|
|
7
11
|
const Context_1 = require("../Context");
|
|
12
|
+
const react_dom_1 = __importDefault(require("react-dom"));
|
|
13
|
+
const Chart_1 = require("../Chart");
|
|
14
|
+
const useTheme_1 = __importDefault(require("./useTheme"));
|
|
15
|
+
const valueFormatter_1 = require("../utils/valueFormatter");
|
|
16
|
+
const dashboard_1 = require("../utils/dashboard");
|
|
17
|
+
const react_to_print_1 = require("react-to-print");
|
|
18
|
+
async function getExportData(client, dashboardFilters, reportId) {
|
|
19
|
+
const minimalFilters = Object.values(dashboardFilters).length
|
|
20
|
+
? Object.values(dashboardFilters).map((filter) => {
|
|
21
|
+
const newFilter = { ...filter };
|
|
22
|
+
if (newFilter.filterType === 'date_range') {
|
|
23
|
+
delete newFilter['field'];
|
|
24
|
+
delete newFilter['options'];
|
|
25
|
+
delete newFilter['selectedValue'];
|
|
26
|
+
}
|
|
27
|
+
return newFilter;
|
|
28
|
+
})
|
|
29
|
+
: [];
|
|
30
|
+
const hostedBody = {
|
|
31
|
+
metadata: {
|
|
32
|
+
dashboardItemId: reportId,
|
|
33
|
+
orgId: client.customerId || '*',
|
|
34
|
+
clientId: client.publicKey,
|
|
35
|
+
task: 'item',
|
|
36
|
+
databaseType: client?.databaseType,
|
|
37
|
+
filters: minimalFilters,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
const cloudBody = {
|
|
41
|
+
id: reportId,
|
|
42
|
+
};
|
|
43
|
+
const resp = await (0, dataFetcher_1.getData)(client, 'itempost', 'same-origin', hostedBody, cloudBody);
|
|
44
|
+
const cleanedReport = await (0, dashboard_1.cleanDashboardItem)(resp, dashboardFilters);
|
|
45
|
+
if (cleanedReport.chartType === 'table' && cleanedReport.pivot) {
|
|
46
|
+
cleanedReport.columns = cleanedReport.yAxisFields;
|
|
47
|
+
}
|
|
48
|
+
return cleanedReport;
|
|
49
|
+
}
|
|
8
50
|
const useExport = (reportId) => {
|
|
9
51
|
const { dashboardFilters } = (0, react_1.useContext)(Context_1.DashboardFiltersContext);
|
|
52
|
+
const theme = (0, useTheme_1.default)();
|
|
10
53
|
const [client] = (0, react_1.useContext)(Context_1.ClientContext);
|
|
11
54
|
const [isLoading, setIsLoading] = (0, react_1.useState)(false);
|
|
12
55
|
if (!reportId) {
|
|
@@ -15,31 +58,7 @@ const useExport = (reportId) => {
|
|
|
15
58
|
return {
|
|
16
59
|
downloadCSV: async () => {
|
|
17
60
|
setIsLoading(true);
|
|
18
|
-
const
|
|
19
|
-
? Object.values(dashboardFilters).map((filter) => {
|
|
20
|
-
const newFilter = { ...filter };
|
|
21
|
-
if (newFilter.filterType === 'date_range') {
|
|
22
|
-
delete newFilter['field'];
|
|
23
|
-
delete newFilter['options'];
|
|
24
|
-
delete newFilter['selectedValue'];
|
|
25
|
-
}
|
|
26
|
-
return newFilter;
|
|
27
|
-
})
|
|
28
|
-
: [];
|
|
29
|
-
const hostedBody = {
|
|
30
|
-
metadata: {
|
|
31
|
-
dashboardItemId: reportId,
|
|
32
|
-
orgId: client.customerId || '*',
|
|
33
|
-
clientId: client.publicKey,
|
|
34
|
-
task: 'item',
|
|
35
|
-
databaseType: client?.databaseType,
|
|
36
|
-
filters: minimalFilters,
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
const cloudBody = {
|
|
40
|
-
id: reportId,
|
|
41
|
-
};
|
|
42
|
-
const resp = await (0, dataFetcher_1.getData)(client, 'itempost', 'same-origin', hostedBody, cloudBody);
|
|
61
|
+
const resp = await getExportData(client, dashboardFilters, reportId);
|
|
43
62
|
(0, csv_1.downloadCSV)({
|
|
44
63
|
rows: resp.rows,
|
|
45
64
|
fields: resp.columns,
|
|
@@ -47,8 +66,65 @@ const useExport = (reportId) => {
|
|
|
47
66
|
});
|
|
48
67
|
setIsLoading(false);
|
|
49
68
|
},
|
|
50
|
-
downloadPDF: () => {
|
|
69
|
+
downloadPDF: async () => {
|
|
70
|
+
setIsLoading(true);
|
|
71
|
+
const resp = await getExportData(client, dashboardFilters, reportId);
|
|
72
|
+
const iframe = document.createElement('iframe');
|
|
73
|
+
document.body.appendChild(iframe);
|
|
74
|
+
if (iframe && iframe.contentDocument) {
|
|
75
|
+
react_dom_1.default.render((0, jsx_runtime_1.jsx)(PDFDetail, { report: resp, theme: theme }), iframe.contentDocument.body);
|
|
76
|
+
}
|
|
77
|
+
// delete the iframe
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
document.body.removeChild(iframe);
|
|
80
|
+
}, 1000);
|
|
81
|
+
setIsLoading(false);
|
|
82
|
+
},
|
|
51
83
|
isLoading,
|
|
52
84
|
};
|
|
53
85
|
};
|
|
54
86
|
exports.useExport = useExport;
|
|
87
|
+
function PDFDetail({ report, theme }) {
|
|
88
|
+
const componentRef = (0, react_1.useRef)(null);
|
|
89
|
+
const handlePrint = (0, react_to_print_1.useReactToPrint)({
|
|
90
|
+
content: () => componentRef.current,
|
|
91
|
+
pageStyle: `@page {
|
|
92
|
+
size: letter;
|
|
93
|
+
margin: 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
body {
|
|
97
|
+
margin: 2rem;
|
|
98
|
+
}`,
|
|
99
|
+
});
|
|
100
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
101
|
+
setTimeout(() => handlePrint(), 1500);
|
|
102
|
+
}, []);
|
|
103
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: componentRef, style: { display: 'flex', flexDirection: 'column', margin: '2rem' }, children: [(0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center' }, children: (0, jsx_runtime_1.jsx)("h2", { style: {
|
|
104
|
+
fontSize: 18,
|
|
105
|
+
fontWeight: '600',
|
|
106
|
+
textAlign: 'left',
|
|
107
|
+
paddingLeft: 10,
|
|
108
|
+
color: theme?.primaryTextColor,
|
|
109
|
+
}, children: report.name }) }), (0, jsx_runtime_1.jsxs)("div", { style: { paddingLeft: 20, paddingRight: 20 }, children: [report.chartType !== 'table' && ((0, jsx_runtime_1.jsx)(Chart_1.ChartDisplay, { overrideTheme: theme, config: report, containerStyle: {
|
|
110
|
+
display: 'flex',
|
|
111
|
+
height: 400,
|
|
112
|
+
}, loading: false, isAnimationActive: false })), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
113
|
+
border: '1px solid',
|
|
114
|
+
borderRadius: '4px',
|
|
115
|
+
borderStyle: 'none',
|
|
116
|
+
}, children: (0, jsx_runtime_1.jsxs)("table", { style: {
|
|
117
|
+
fontFamily: 'sans-serif',
|
|
118
|
+
width: '100%',
|
|
119
|
+
borderCollapse: 'collapse',
|
|
120
|
+
borderStyle: 'none',
|
|
121
|
+
}, children: [(0, jsx_runtime_1.jsx)("thead", { style: {
|
|
122
|
+
textAlign: 'left',
|
|
123
|
+
textOverflow: 'ellipsis',
|
|
124
|
+
whiteSpace: 'nowrap',
|
|
125
|
+
overflow: 'hidden',
|
|
126
|
+
}, children: (0, jsx_runtime_1.jsx)("tr", { children: report.columns.map((col, colIndex) => ((0, jsx_runtime_1.jsx)("th", { style: { padding: '2px', paddingLeft: '3px' }, children: col.label }, 'head' + colIndex))) }) }), (0, jsx_runtime_1.jsx)("tbody", { children: report.rows.map((row, rowIndex) => ((0, jsx_runtime_1.jsx)("tr", { children: report.columns.map((col, colIndex) => ((0, jsx_runtime_1.jsx)("td", { style: { padding: '2px', paddingLeft: '3px' }, children: (0, valueFormatter_1.quillFormat)({
|
|
127
|
+
value: row[col.field],
|
|
128
|
+
format: col.format,
|
|
129
|
+
}) }, 'cell' + col.field + colIndex + rowIndex))) }, 'row' + rowIndex))) })] }) })] })] }));
|
|
130
|
+
}
|
package/dist/cjs/utils/merge.js
CHANGED
|
@@ -19,14 +19,6 @@ function mergeForwards(resp) {
|
|
|
19
19
|
}
|
|
20
20
|
j++;
|
|
21
21
|
}
|
|
22
|
-
while (j < compRows.length) {
|
|
23
|
-
const obj = {};
|
|
24
|
-
for (const [key, value] of Object.entries(compRows[j])) {
|
|
25
|
-
obj[`comparison_${key}`] = value;
|
|
26
|
-
}
|
|
27
|
-
resp.rows.push(obj);
|
|
28
|
-
j++;
|
|
29
|
-
}
|
|
30
22
|
}
|
|
31
23
|
// eslint-disable-next-line no-unused-vars
|
|
32
24
|
function mergeBackwards(resp) {
|
package/dist/esm/Chart.d.ts
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
import { QuillTheme } from './QuillProvider';
|
|
3
3
|
import { type QuillReport } from './Dashboard';
|
|
4
4
|
import { Filter } from './models/Filter';
|
|
5
|
+
interface BaseChartProps {
|
|
6
|
+
colors?: string[];
|
|
7
|
+
containerStyle?: React.CSSProperties;
|
|
8
|
+
className?: string;
|
|
9
|
+
isAnimationActive?: boolean;
|
|
10
|
+
hideXAxis?: boolean;
|
|
11
|
+
hideYAxis?: boolean;
|
|
12
|
+
hideCartesianGrid?: boolean;
|
|
13
|
+
hideDateRangeFilter?: boolean;
|
|
14
|
+
hideHorizontalCartesianGrid?: boolean;
|
|
15
|
+
hideVerticalCartesianGrid?: boolean;
|
|
16
|
+
hideSubsequentXAxisTicks?: boolean;
|
|
17
|
+
cartesianGridLineStyle?: 'solid' | 'dashed';
|
|
18
|
+
cartesianGridLineColor?: string;
|
|
19
|
+
comparisonLineStyle?: 'solid' | 'dashed';
|
|
20
|
+
mapColorsToFields?: (_report: QuillReport, _theme: QuillTheme) => ColorMapType;
|
|
21
|
+
LoadingComponent?: () => JSX.Element;
|
|
22
|
+
filters?: Filter[];
|
|
23
|
+
onClickChartElement?: (data: any) => void;
|
|
24
|
+
}
|
|
25
|
+
interface WithConfig extends BaseChartProps {
|
|
26
|
+
config: QuillReport | any;
|
|
27
|
+
}
|
|
5
28
|
export declare function isEquivalent(filters1: any[], filters2: any[]): boolean;
|
|
6
29
|
export declare function didFiltersChange(dashboardItem: any, filters: any[]): boolean;
|
|
7
30
|
export type ColorMapType = {
|
|
@@ -158,5 +181,25 @@ export interface ChartProps {
|
|
|
158
181
|
* @see https://docs.quillsql.com/components/chart
|
|
159
182
|
*/
|
|
160
183
|
declare const Chart: (props: ChartProps) => import("react/jsx-runtime").JSX.Element;
|
|
184
|
+
interface ChartDisplayProps extends WithConfig {
|
|
185
|
+
loading: boolean;
|
|
186
|
+
paginating?: boolean;
|
|
187
|
+
error?: string;
|
|
188
|
+
isComparison?: boolean;
|
|
189
|
+
colorMap?: ColorMapType;
|
|
190
|
+
reportId?: string;
|
|
191
|
+
onPageChange?: (page: {
|
|
192
|
+
currentPage: number;
|
|
193
|
+
rowsPerPage: number;
|
|
194
|
+
}) => void;
|
|
195
|
+
onSortChange?: (sort: {
|
|
196
|
+
field: string;
|
|
197
|
+
direction: string;
|
|
198
|
+
}) => void;
|
|
199
|
+
onClickChartElement?: (data: any) => void;
|
|
200
|
+
dateBucket?: string;
|
|
201
|
+
overrideTheme?: QuillTheme;
|
|
202
|
+
}
|
|
203
|
+
export declare const ChartDisplay: ({ reportId, config, colors, className, containerStyle, hideXAxis, hideYAxis, hideCartesianGrid, hideDateRangeFilter, hideHorizontalCartesianGrid, hideVerticalCartesianGrid, hideSubsequentXAxisTicks, cartesianGridLineStyle, cartesianGridLineColor, comparisonLineStyle, isAnimationActive, loading, paginating, error, isComparison, colorMap, LoadingComponent, onPageChange, onSortChange, onClickChartElement, dateBucket, overrideTheme, }: ChartDisplayProps) => import("react/jsx-runtime").JSX.Element;
|
|
161
204
|
export default Chart;
|
|
162
205
|
//# sourceMappingURL=Chart.d.ts.map
|
package/dist/esm/Chart.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../src/Chart.tsx"],"names":[],"mappings":";AA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AAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACpE,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,UAAU,CAAC;CAC5B;AAED,eAAO,MAAM,YAAY,ubA4BtB,iBAAiB,4CAkdnB,CAAC;AAWF,eAAe,KAAK,CAAC"}
|
package/dist/esm/Chart.js
CHANGED
|
@@ -363,13 +363,16 @@ const ChartUpdater = ({ colors, reportId, className, containerStyle, isAnimation
|
|
|
363
363
|
}, [specificDashboardFilter, client, reportId]);
|
|
364
364
|
return (_jsx(ChartDisplay, { config: report, reportId: reportId, colors: colors, className: className, containerStyle: containerStyle, hideXAxis: hideXAxis, hideYAxis: hideYAxis, hideCartesianGrid: hideCartesianGrid, hideHorizontalCartesianGrid: hideHorizontalCartesianGrid, hideVerticalCartesianGrid: hideVerticalCartesianGrid, hideSubsequentXAxisTicks: hideSubsequentXAxisTicks, cartesianGridLineStyle: cartesianGridLineStyle, cartesianGridLineColor: cartesianGridLineColor, hideDateRangeFilter: hideDateRangeFilter, comparisonLineStyle: comparisonLineStyle, isAnimationActive: isAnimationActive, isComparison: isComparison, loading: loading || initialLoad, paginating: paginating, error: error, colorMap: colorMap, LoadingComponent: LoadingComponent, onPageChange: onPageChange, onSortChange: onSortChange, onClickChartElement: onClickChartElement }));
|
|
365
365
|
};
|
|
366
|
-
const ChartDisplay = ({ reportId, config, colors, className, containerStyle, hideXAxis, hideYAxis, hideCartesianGrid, hideDateRangeFilter = false, hideHorizontalCartesianGrid = false, hideVerticalCartesianGrid = true, hideSubsequentXAxisTicks = false, cartesianGridLineStyle = 'solid', cartesianGridLineColor, comparisonLineStyle, isAnimationActive, loading = false, paginating = false, error = undefined, isComparison = false, colorMap, LoadingComponent = QuillLoadingSkeleton, onPageChange, onSortChange, onClickChartElement, dateBucket, }) => {
|
|
366
|
+
export const ChartDisplay = ({ reportId, config, colors, className, containerStyle, hideXAxis, hideYAxis, hideCartesianGrid, hideDateRangeFilter = false, hideHorizontalCartesianGrid = false, hideVerticalCartesianGrid = true, hideSubsequentXAxisTicks = false, cartesianGridLineStyle = 'solid', cartesianGridLineColor, comparisonLineStyle, isAnimationActive, loading = false, paginating = false, error = undefined, isComparison = false, colorMap, LoadingComponent = QuillLoadingSkeleton, onPageChange, onSortChange, onClickChartElement, dateBucket, overrideTheme, }) => {
|
|
367
367
|
const { dashboardFilters } = useContext(DashboardFiltersContext);
|
|
368
368
|
const specificDashboardFilter = useMemo(() => {
|
|
369
|
+
if (!dashboardFilters) {
|
|
370
|
+
return [];
|
|
371
|
+
}
|
|
369
372
|
return dashboardFilters.filter((f) => f && config && config.dashboardName === f.dashboardName);
|
|
370
373
|
}, [dashboardFilters]);
|
|
371
374
|
const { downloadCSV } = useExport(reportId);
|
|
372
|
-
const theme = useTheme();
|
|
375
|
+
const theme = overrideTheme ?? useTheme();
|
|
373
376
|
const chartColors = useMemo(() => {
|
|
374
377
|
return colors?.length
|
|
375
378
|
? colors
|
|
@@ -418,7 +421,10 @@ const ChartDisplay = ({ reportId, config, colors, className, containerStyle, hid
|
|
|
418
421
|
return config?.pivotColumns ?? config?.yAxisFields ?? [];
|
|
419
422
|
}
|
|
420
423
|
};
|
|
421
|
-
const yAxisFields = getYAxisFields();
|
|
424
|
+
const [yAxisFields, setYAxisFields] = useState(getYAxisFields());
|
|
425
|
+
useEffect(() => {
|
|
426
|
+
setYAxisFields(getYAxisFields());
|
|
427
|
+
}, [config, specificDashboardFilter]);
|
|
422
428
|
if (error) {
|
|
423
429
|
return _jsx(ChartError, { className: className, containerStyle: containerStyle });
|
|
424
430
|
}
|
|
@@ -428,7 +434,7 @@ const ChartDisplay = ({ reportId, config, colors, className, containerStyle, hid
|
|
|
428
434
|
config?.chartType !== 'table' &&
|
|
429
435
|
rows &&
|
|
430
436
|
rows.length > MAX_ROWS_FOR_GENERIC_TABLE) {
|
|
431
|
-
return (_jsx(ChartError, { className: className, containerStyle: containerStyle, label:
|
|
437
|
+
return (_jsx(ChartError, { className: className, containerStyle: containerStyle, label: `Charts can only display ${MAX_ROWS_FOR_GENERIC_TABLE} rows. Please add a pivot or modify the query.` }));
|
|
432
438
|
}
|
|
433
439
|
else if (!config || loading) {
|
|
434
440
|
return (_jsx("div", { className: className, style: containerStyle, children: _jsx(LoadingComponent, {}) }));
|
package/dist/esm/Dashboard.js
CHANGED
package/dist/esm/Table.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAe9D,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAyBD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,IAAI,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,EAAE,CAAC;IAEhC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,OAAO,CAAC,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;IAEJ;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IAEzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC;IAErC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,QAAA,MAAM,KAAK,UAAW,UAAU,4CAkC/B,CAAC;AA+GF,eAAe,KAAK,CAAC"}
|
package/dist/esm/Table.js
CHANGED
|
@@ -7,6 +7,7 @@ import QuillTable from './components/QuillTable';
|
|
|
7
7
|
import { useMemoizedRows } from './hooks/useFormat';
|
|
8
8
|
import { useExport } from './hooks/useExport';
|
|
9
9
|
import { processFilterErrorList } from './utils/errorProcessing';
|
|
10
|
+
import { didFiltersChange } from './Chart';
|
|
10
11
|
/**
|
|
11
12
|
* ### Quill Table
|
|
12
13
|
*
|
|
@@ -52,9 +53,10 @@ const ChartUpdater = ({ reportId, containerStyle, className, dashboard, dispatch
|
|
|
52
53
|
const specificDashboardFilter = useMemo(() => {
|
|
53
54
|
return dashboardFilters
|
|
54
55
|
.sort((filter) => (filter.filterType === 'date_range' ? -1 : 1))
|
|
55
|
-
.filter((f) =>
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
.filter((f) => dashboard &&
|
|
57
|
+
dashboard[reportId] &&
|
|
58
|
+
f &&
|
|
59
|
+
f.dashboardName === dashboard[reportId].dashboardName);
|
|
58
60
|
}, [dashboardFilters, dashboard]);
|
|
59
61
|
const { rows, loading } = useMemoizedRows(reportId);
|
|
60
62
|
const { downloadCSV } = useExport(reportId);
|
|
@@ -62,6 +64,9 @@ const ChartUpdater = ({ reportId, containerStyle, className, dashboard, dispatch
|
|
|
62
64
|
useEffect(() => {
|
|
63
65
|
let isSubscribed = true;
|
|
64
66
|
async function getChartOptions() {
|
|
67
|
+
if (!didFiltersChange(dashboard[reportId], specificDashboardFilter)) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
65
70
|
if (isSubscribed) {
|
|
66
71
|
try {
|
|
67
72
|
const hostedBody = {
|
|
@@ -105,10 +110,6 @@ const ChartUpdater = ({ reportId, containerStyle, className, dashboard, dispatch
|
|
|
105
110
|
isSubscribed = false;
|
|
106
111
|
};
|
|
107
112
|
}, [specificDashboardFilter, client.customerId, reportId]);
|
|
108
|
-
return (_jsx(QuillTable, { hideCSVDownloadButton: hideCSVDownloadButton,
|
|
109
|
-
// @ts-ignore
|
|
110
|
-
columns: dashboard[reportId]?.columns || [],
|
|
111
|
-
// @ts-ignore
|
|
112
|
-
rows: rows || dashboard[reportId]?.rows || [], containerStyle: containerStyle, className: className, LoadingComponent: LoadingComponent, isLoading: loading, downloadCSV: downloadCSV }));
|
|
113
|
+
return (_jsx(QuillTable, { hideCSVDownloadButton: hideCSVDownloadButton, columns: dashboard[reportId]?.columns || [], rows: rows || dashboard[reportId]?.rows || [], containerStyle: containerStyle, className: className, LoadingComponent: LoadingComponent, isLoading: loading, downloadCSV: downloadCSV }));
|
|
113
114
|
};
|
|
114
115
|
export default Table;
|
|
@@ -8,7 +8,7 @@ import ChartTooltip from '../../components/Chart/ChartTooltip';
|
|
|
8
8
|
import getDomain from '../../utils/getDomain';
|
|
9
9
|
import { useEffect, useState } from 'react';
|
|
10
10
|
export default function BarChart({ colors, colorMap, yAxisFields, data, containerStyle, className, xAxisField, xAxisFormat, theme, comparison, isStacked, isAnimationActive = true, hideXAxis = false, hideYAxis = false, hideCartesianGrid = false, onClickChartElement, dateFilter, }) {
|
|
11
|
-
const [formattedData, setFormattedData] = useState(
|
|
11
|
+
const [formattedData, setFormattedData] = useState(data);
|
|
12
12
|
useEffect(() => {
|
|
13
13
|
if (!data || data.length === 0) {
|
|
14
14
|
return;
|
|
@@ -9,7 +9,7 @@ import getDomain from '../../utils/getDomain';
|
|
|
9
9
|
import { useEffect, useState } from 'react';
|
|
10
10
|
import { hashCode } from '../../utils/crypto';
|
|
11
11
|
export default function LineChart({ colors, colorMap = {}, yAxisFields, data, containerStyle, className, xAxisField, xAxisFormat, theme, comparison, isAnimationActive = true, hideXAxis = false, hideYAxis = false, hideCartesianGrid = false, hideHorizontalCartesianGrid = false, hideVerticalCartesianGrid = true, hideSubsequentXAxisTicks = false, cartesianGridLineStyle = 'solid', comparisonLineStyle = 'solid', cartesianGridLineColor, onClickChartElement = () => { }, dateFilter, }) {
|
|
12
|
-
const [formattedData, setFormattedData] = useState(
|
|
12
|
+
const [formattedData, setFormattedData] = useState(data);
|
|
13
13
|
useEffect(() => {
|
|
14
14
|
if (!data || data.length === 0) {
|
|
15
15
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExport.d.ts","sourceRoot":"","sources":["../../../src/hooks/useExport.
|
|
1
|
+
{"version":3,"file":"useExport.d.ts","sourceRoot":"","sources":["../../../src/hooks/useExport.tsx"],"names":[],"mappings":"AA6EA,eAAO,MAAM,SAAS,cAAe,MAAM;;;;CAuC1C,CAAC"}
|
|
@@ -1,9 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
2
|
import { downloadCSV } from '../utils/csv';
|
|
2
|
-
import { useContext, useState } from 'react';
|
|
3
|
+
import { useContext, useLayoutEffect, useRef, useState, } from 'react';
|
|
3
4
|
import { getData } from '../utils/dataFetcher';
|
|
4
5
|
import { ClientContext, DashboardFiltersContext } from '../Context';
|
|
6
|
+
import ReactDOM from 'react-dom';
|
|
7
|
+
import { ChartDisplay } from '../Chart';
|
|
8
|
+
import useTheme from './useTheme';
|
|
9
|
+
import { quillFormat } from '../utils/valueFormatter';
|
|
10
|
+
import { cleanDashboardItem } from '../utils/dashboard';
|
|
11
|
+
import { useReactToPrint } from 'react-to-print';
|
|
12
|
+
async function getExportData(client, dashboardFilters, reportId) {
|
|
13
|
+
const minimalFilters = Object.values(dashboardFilters).length
|
|
14
|
+
? Object.values(dashboardFilters).map((filter) => {
|
|
15
|
+
const newFilter = { ...filter };
|
|
16
|
+
if (newFilter.filterType === 'date_range') {
|
|
17
|
+
delete newFilter['field'];
|
|
18
|
+
delete newFilter['options'];
|
|
19
|
+
delete newFilter['selectedValue'];
|
|
20
|
+
}
|
|
21
|
+
return newFilter;
|
|
22
|
+
})
|
|
23
|
+
: [];
|
|
24
|
+
const hostedBody = {
|
|
25
|
+
metadata: {
|
|
26
|
+
dashboardItemId: reportId,
|
|
27
|
+
orgId: client.customerId || '*',
|
|
28
|
+
clientId: client.publicKey,
|
|
29
|
+
task: 'item',
|
|
30
|
+
databaseType: client?.databaseType,
|
|
31
|
+
filters: minimalFilters,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
const cloudBody = {
|
|
35
|
+
id: reportId,
|
|
36
|
+
};
|
|
37
|
+
const resp = await getData(client, 'itempost', 'same-origin', hostedBody, cloudBody);
|
|
38
|
+
const cleanedReport = await cleanDashboardItem(resp, dashboardFilters);
|
|
39
|
+
if (cleanedReport.chartType === 'table' && cleanedReport.pivot) {
|
|
40
|
+
cleanedReport.columns = cleanedReport.yAxisFields;
|
|
41
|
+
}
|
|
42
|
+
return cleanedReport;
|
|
43
|
+
}
|
|
5
44
|
export const useExport = (reportId) => {
|
|
6
45
|
const { dashboardFilters } = useContext(DashboardFiltersContext);
|
|
46
|
+
const theme = useTheme();
|
|
7
47
|
const [client] = useContext(ClientContext);
|
|
8
48
|
const [isLoading, setIsLoading] = useState(false);
|
|
9
49
|
if (!reportId) {
|
|
@@ -12,31 +52,7 @@ export const useExport = (reportId) => {
|
|
|
12
52
|
return {
|
|
13
53
|
downloadCSV: async () => {
|
|
14
54
|
setIsLoading(true);
|
|
15
|
-
const
|
|
16
|
-
? Object.values(dashboardFilters).map((filter) => {
|
|
17
|
-
const newFilter = { ...filter };
|
|
18
|
-
if (newFilter.filterType === 'date_range') {
|
|
19
|
-
delete newFilter['field'];
|
|
20
|
-
delete newFilter['options'];
|
|
21
|
-
delete newFilter['selectedValue'];
|
|
22
|
-
}
|
|
23
|
-
return newFilter;
|
|
24
|
-
})
|
|
25
|
-
: [];
|
|
26
|
-
const hostedBody = {
|
|
27
|
-
metadata: {
|
|
28
|
-
dashboardItemId: reportId,
|
|
29
|
-
orgId: client.customerId || '*',
|
|
30
|
-
clientId: client.publicKey,
|
|
31
|
-
task: 'item',
|
|
32
|
-
databaseType: client?.databaseType,
|
|
33
|
-
filters: minimalFilters,
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
const cloudBody = {
|
|
37
|
-
id: reportId,
|
|
38
|
-
};
|
|
39
|
-
const resp = await getData(client, 'itempost', 'same-origin', hostedBody, cloudBody);
|
|
55
|
+
const resp = await getExportData(client, dashboardFilters, reportId);
|
|
40
56
|
downloadCSV({
|
|
41
57
|
rows: resp.rows,
|
|
42
58
|
fields: resp.columns,
|
|
@@ -44,7 +60,64 @@ export const useExport = (reportId) => {
|
|
|
44
60
|
});
|
|
45
61
|
setIsLoading(false);
|
|
46
62
|
},
|
|
47
|
-
downloadPDF: () => {
|
|
63
|
+
downloadPDF: async () => {
|
|
64
|
+
setIsLoading(true);
|
|
65
|
+
const resp = await getExportData(client, dashboardFilters, reportId);
|
|
66
|
+
const iframe = document.createElement('iframe');
|
|
67
|
+
document.body.appendChild(iframe);
|
|
68
|
+
if (iframe && iframe.contentDocument) {
|
|
69
|
+
ReactDOM.render(_jsx(PDFDetail, { report: resp, theme: theme }), iframe.contentDocument.body);
|
|
70
|
+
}
|
|
71
|
+
// delete the iframe
|
|
72
|
+
setTimeout(() => {
|
|
73
|
+
document.body.removeChild(iframe);
|
|
74
|
+
}, 1000);
|
|
75
|
+
setIsLoading(false);
|
|
76
|
+
},
|
|
48
77
|
isLoading,
|
|
49
78
|
};
|
|
50
79
|
};
|
|
80
|
+
function PDFDetail({ report, theme }) {
|
|
81
|
+
const componentRef = useRef(null);
|
|
82
|
+
const handlePrint = useReactToPrint({
|
|
83
|
+
content: () => componentRef.current,
|
|
84
|
+
pageStyle: `@page {
|
|
85
|
+
size: letter;
|
|
86
|
+
margin: 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
body {
|
|
90
|
+
margin: 2rem;
|
|
91
|
+
}`,
|
|
92
|
+
});
|
|
93
|
+
useLayoutEffect(() => {
|
|
94
|
+
setTimeout(() => handlePrint(), 1500);
|
|
95
|
+
}, []);
|
|
96
|
+
return (_jsxs("div", { ref: componentRef, style: { display: 'flex', flexDirection: 'column', margin: '2rem' }, children: [_jsx("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center' }, children: _jsx("h2", { style: {
|
|
97
|
+
fontSize: 18,
|
|
98
|
+
fontWeight: '600',
|
|
99
|
+
textAlign: 'left',
|
|
100
|
+
paddingLeft: 10,
|
|
101
|
+
color: theme?.primaryTextColor,
|
|
102
|
+
}, children: report.name }) }), _jsxs("div", { style: { paddingLeft: 20, paddingRight: 20 }, children: [report.chartType !== 'table' && (_jsx(ChartDisplay, { overrideTheme: theme, config: report, containerStyle: {
|
|
103
|
+
display: 'flex',
|
|
104
|
+
height: 400,
|
|
105
|
+
}, loading: false, isAnimationActive: false })), _jsx("div", { style: {
|
|
106
|
+
border: '1px solid',
|
|
107
|
+
borderRadius: '4px',
|
|
108
|
+
borderStyle: 'none',
|
|
109
|
+
}, children: _jsxs("table", { style: {
|
|
110
|
+
fontFamily: 'sans-serif',
|
|
111
|
+
width: '100%',
|
|
112
|
+
borderCollapse: 'collapse',
|
|
113
|
+
borderStyle: 'none',
|
|
114
|
+
}, children: [_jsx("thead", { style: {
|
|
115
|
+
textAlign: 'left',
|
|
116
|
+
textOverflow: 'ellipsis',
|
|
117
|
+
whiteSpace: 'nowrap',
|
|
118
|
+
overflow: 'hidden',
|
|
119
|
+
}, children: _jsx("tr", { children: report.columns.map((col, colIndex) => (_jsx("th", { style: { padding: '2px', paddingLeft: '3px' }, children: col.label }, 'head' + colIndex))) }) }), _jsx("tbody", { children: report.rows.map((row, rowIndex) => (_jsx("tr", { children: report.columns.map((col, colIndex) => (_jsx("td", { style: { padding: '2px', paddingLeft: '3px' }, children: quillFormat({
|
|
120
|
+
value: row[col.field],
|
|
121
|
+
format: col.format,
|
|
122
|
+
}) }, 'cell' + col.field + colIndex + rowIndex))) }, 'row' + rowIndex))) })] }) })] })] }));
|
|
123
|
+
}
|
package/dist/esm/utils/merge.js
CHANGED
|
@@ -15,14 +15,6 @@ function mergeForwards(resp) {
|
|
|
15
15
|
}
|
|
16
16
|
j++;
|
|
17
17
|
}
|
|
18
|
-
while (j < compRows.length) {
|
|
19
|
-
const obj = {};
|
|
20
|
-
for (const [key, value] of Object.entries(compRows[j])) {
|
|
21
|
-
obj[`comparison_${key}`] = value;
|
|
22
|
-
}
|
|
23
|
-
resp.rows.push(obj);
|
|
24
|
-
j++;
|
|
25
|
-
}
|
|
26
18
|
}
|
|
27
19
|
// eslint-disable-next-line no-unused-vars
|
|
28
20
|
function mergeBackwards(resp) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quillsql/react",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.25",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"import": "./dist/esm/index.js",
|
|
@@ -24,6 +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
|
+
"react-to-print": "^2.15.1",
|
|
27
28
|
"recharts": "^2.12.5"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|