@quillsql/react 2.12.26 → 2.12.27
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 +17 -2
- package/dist/cjs/Chart.d.ts.map +1 -1
- package/dist/cjs/Chart.js +110 -80
- package/dist/cjs/Context.d.ts +1 -0
- package/dist/cjs/Context.d.ts.map +1 -1
- package/dist/cjs/Context.js +17 -2
- package/dist/cjs/Table.d.ts +15 -1
- package/dist/cjs/Table.d.ts.map +1 -1
- package/dist/cjs/Table.js +134 -60
- package/dist/cjs/components/Dashboard/DashboardFilter.d.ts.map +1 -1
- package/dist/cjs/components/Dashboard/DashboardFilter.js +1 -1
- package/dist/cjs/utils/dashboard.d.ts +1 -0
- package/dist/cjs/utils/dashboard.d.ts.map +1 -1
- package/dist/cjs/utils/dashboard.js +20 -1
- package/dist/cjs/utils/filterProcessing.d.ts +2 -0
- package/dist/cjs/utils/filterProcessing.d.ts.map +1 -1
- package/dist/cjs/utils/filterProcessing.js +129 -1
- package/dist/esm/Chart.d.ts +17 -2
- package/dist/esm/Chart.d.ts.map +1 -1
- package/dist/esm/Chart.js +113 -83
- package/dist/esm/Context.d.ts +1 -0
- package/dist/esm/Context.d.ts.map +1 -1
- package/dist/esm/Context.js +16 -1
- package/dist/esm/Table.d.ts +15 -1
- package/dist/esm/Table.d.ts.map +1 -1
- package/dist/esm/Table.js +137 -63
- package/dist/esm/components/Dashboard/DashboardFilter.d.ts.map +1 -1
- package/dist/esm/components/Dashboard/DashboardFilter.js +1 -1
- package/dist/esm/utils/dashboard.d.ts +1 -0
- package/dist/esm/utils/dashboard.d.ts.map +1 -1
- package/dist/esm/utils/dashboard.js +18 -0
- package/dist/esm/utils/filterProcessing.d.ts +2 -0
- package/dist/esm/utils/filterProcessing.d.ts.map +1 -1
- package/dist/esm/utils/filterProcessing.js +126 -0
- package/package.json +1 -1
package/dist/cjs/Chart.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { QuillTheme } from './QuillProvider';
|
|
3
3
|
import { type QuillReport } from './Dashboard';
|
|
4
4
|
import { Filter } from './models/Filter';
|
|
5
|
+
import { MultiSelectComponentProps, SelectComponentProps } from './components/UiComponents';
|
|
6
|
+
import { DateRangePickerComponentProps } from './DateRangePicker/QuillDateRangePicker';
|
|
5
7
|
interface BaseChartProps {
|
|
6
8
|
colors?: string[];
|
|
7
9
|
containerStyle?: React.CSSProperties;
|
|
@@ -99,6 +101,8 @@ export interface ChartProps {
|
|
|
99
101
|
* Whether the date range filter has been disabled.
|
|
100
102
|
*/
|
|
101
103
|
hideDateRangeFilter?: boolean;
|
|
104
|
+
/** Whether to hide the table filters component, deafulted to true */
|
|
105
|
+
hideFilters?: boolean;
|
|
102
106
|
/**
|
|
103
107
|
* Whether the comparison range shows as dashed for date comparison line
|
|
104
108
|
* charts (as opposed to the default solid line).
|
|
@@ -143,6 +147,16 @@ export interface ChartProps {
|
|
|
143
147
|
* A loading component to show when the chart is loading.
|
|
144
148
|
*/
|
|
145
149
|
LoadingComponent?: () => JSX.Element;
|
|
150
|
+
/** A select component prop for the table filters */
|
|
151
|
+
SelectComponent?: (props: SelectComponentProps) => JSX.Element;
|
|
152
|
+
/** A multi select component prop for the table filters */
|
|
153
|
+
MultiSelectComponent?: (props: MultiSelectComponentProps) => JSX.Element;
|
|
154
|
+
/** A date range picker component prop for the table filters */
|
|
155
|
+
DateRangePickerComponent?: (props: DateRangePickerComponentProps) => JSX.Element;
|
|
156
|
+
/** A filter container component component prop for the table filters */
|
|
157
|
+
FilterContainerComponent?: ({ children, }: {
|
|
158
|
+
children: ReactNode;
|
|
159
|
+
}) => JSX.Element;
|
|
146
160
|
/**
|
|
147
161
|
* Styles the top-level container of the Chart.
|
|
148
162
|
*
|
|
@@ -199,7 +213,8 @@ interface ChartDisplayProps extends WithConfig {
|
|
|
199
213
|
onClickChartElement?: (data: any) => void;
|
|
200
214
|
dateBucket?: string;
|
|
201
215
|
overrideTheme?: QuillTheme;
|
|
216
|
+
initialDateFilter?: any;
|
|
202
217
|
}
|
|
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;
|
|
218
|
+
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, initialDateFilter, }: ChartDisplayProps) => import("react/jsx-runtime").JSX.Element;
|
|
204
219
|
export default Chart;
|
|
205
220
|
//# 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":";
|
|
1
|
+
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../src/Chart.tsx"],"names":[],"mappings":"AACA,OAAO,EAA4C,SAAS,EAAE,MAAM,OAAO,CAAC;AAa5E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAkB7C,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAQzC,OAAO,EACL,yBAAyB,E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AAI,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;IAC3B,iBAAiB,CAAC,EAAE,GAAG,CAAC;CACzB;AAED,eAAO,MAAM,YAAY,0cA6BtB,iBAAiB,4CA4dnB,CAAC;AAWF,eAAe,KAAK,CAAC"}
|
package/dist/cjs/Chart.js
CHANGED
|
@@ -26,6 +26,11 @@ const useTheme_1 = __importDefault(require("./hooks/useTheme"));
|
|
|
26
26
|
const errorProcessing_1 = require("./utils/errorProcessing");
|
|
27
27
|
const filterProcessing_1 = require("./utils/filterProcessing");
|
|
28
28
|
const dashboard_1 = require("./utils/dashboard");
|
|
29
|
+
const UiComponents_1 = require("./components/UiComponents");
|
|
30
|
+
const DashboardFilter_1 = require("./components/Dashboard/DashboardFilter");
|
|
31
|
+
const QuillSelect_1 = require("./components/QuillSelect");
|
|
32
|
+
const QuillMultiSelect_1 = require("./components/QuillMultiSelect");
|
|
33
|
+
const QuillDateRangePicker_1 = require("./DateRangePicker/QuillDateRangePicker");
|
|
29
34
|
const MAX_ROWS_FOR_GENERIC_TABLE = 300;
|
|
30
35
|
// @ts-ignore
|
|
31
36
|
function sumByKey(arr, key) {
|
|
@@ -156,17 +161,11 @@ const Chart = (props) => {
|
|
|
156
161
|
? theme.chartColors
|
|
157
162
|
: ['#4E80EE', '#E14F62', '#55B5A6', '#E9A23B', '#6466E9', '#55B685'];
|
|
158
163
|
}, [data.colors]);
|
|
159
|
-
return ((0, jsx_runtime_1.jsx)(ChartUpdater, { reportId: data.reportId, className: data.className, containerStyle: data.containerStyle, colors: chartColors, isAnimationActive: data.isAnimationActive, hideXAxis: data.hideXAxis, hideYAxis: data.hideYAxis, hideCartesianGrid: data.hideCartesianGrid, hideHorizontalCartesianGrid: data.hideHorizontalCartesianGrid, hideVerticalCartesianGrid: data.hideVerticalCartesianGrid, hideSubsequentXAxisTicks: data.hideSubsequentXAxisTicks, hideDateRangeFilter: data.hideDateRangeFilter, cartesianGridLineStyle: data.cartesianGridLineStyle, cartesianGridLineColor: data.cartesianGridLineColor, comparisonLineStyle: data.comparisonLineStyle, mapColorsToFields: data.mapColorsToFields ?? fallbackMapColorsToFields, LoadingComponent: data.LoadingComponent, filters: data.filters, onClickChartElement: props.onClickChartElement }));
|
|
164
|
+
return ((0, jsx_runtime_1.jsx)(ChartUpdater, { reportId: data.reportId, className: data.className, containerStyle: data.containerStyle, colors: chartColors, isAnimationActive: data.isAnimationActive, hideXAxis: data.hideXAxis, hideYAxis: data.hideYAxis, hideCartesianGrid: data.hideCartesianGrid, hideHorizontalCartesianGrid: data.hideHorizontalCartesianGrid, hideVerticalCartesianGrid: data.hideVerticalCartesianGrid, hideSubsequentXAxisTicks: data.hideSubsequentXAxisTicks, hideDateRangeFilter: data.hideDateRangeFilter, cartesianGridLineStyle: data.cartesianGridLineStyle, cartesianGridLineColor: data.cartesianGridLineColor, comparisonLineStyle: data.comparisonLineStyle, mapColorsToFields: data.mapColorsToFields ?? fallbackMapColorsToFields, LoadingComponent: data.LoadingComponent, filters: data.filters, onClickChartElement: props.onClickChartElement, SelectComponent: data.SelectComponent, MultiSelectComponent: data.MultiSelectComponent, DateRangePickerComponent: data.DateRangePickerComponent, FilterContainerComponent: data.FilterContainerComponent, hideFilters: data.hideFilters }));
|
|
160
165
|
};
|
|
161
|
-
const ChartUpdater = ({ colors, reportId, className, containerStyle, isAnimationActive, hideXAxis, hideYAxis, hideCartesianGrid, hideHorizontalCartesianGrid = false, hideVerticalCartesianGrid = true, hideSubsequentXAxisTicks = false, cartesianGridLineStyle = 'solid', cartesianGridLineColor, comparisonLineStyle, hideDateRangeFilter = false, mapColorsToFields, LoadingComponent = ChartSkeleton_1.QuillLoadingSkeleton, filters, onClickChartElement, }) => {
|
|
166
|
+
const ChartUpdater = ({ colors, reportId, className, containerStyle, isAnimationActive, hideXAxis, hideYAxis, hideCartesianGrid, hideHorizontalCartesianGrid = false, hideVerticalCartesianGrid = true, hideSubsequentXAxisTicks = false, cartesianGridLineStyle = 'solid', cartesianGridLineColor, comparisonLineStyle, hideDateRangeFilter = false, hideFilters = false, mapColorsToFields, LoadingComponent = ChartSkeleton_1.QuillLoadingSkeleton, SelectComponent = QuillSelect_1.QuillSelectComponent, MultiSelectComponent = QuillMultiSelect_1.QuillMultiSelectComponent, DateRangePickerComponent = QuillDateRangePicker_1.QuillDateRangePicker, FilterContainerComponent = UiComponents_1.QuillFilterContainerComponent, filters, onClickChartElement, }) => {
|
|
162
167
|
const { dispatch, dashboard } = (0, react_1.useContext)(Context_1.DashboardContext);
|
|
163
|
-
const {
|
|
164
|
-
const specificDashboardFilter = (0, react_1.useMemo)(() => {
|
|
165
|
-
return dashboardFilters.filter((f) => dashboard &&
|
|
166
|
-
dashboard[reportId] &&
|
|
167
|
-
f &&
|
|
168
|
-
f.dashboardName === dashboard[reportId].dashboardName);
|
|
169
|
-
}, [dashboardFilters, dashboard]);
|
|
168
|
+
const { reportFiltersDispatch, reportFilters } = (0, react_1.useContext)(Context_1.ReportFiltersContext);
|
|
170
169
|
const [initialLoad, setInitialLoad] = (0, react_1.useState)(true);
|
|
171
170
|
const [loading, setLoading] = (0, react_1.useState)(true);
|
|
172
171
|
const [paginating, setPaginating] = (0, react_1.useState)(false);
|
|
@@ -179,7 +178,10 @@ const ChartUpdater = ({ colors, reportId, className, containerStyle, isAnimation
|
|
|
179
178
|
page: 0,
|
|
180
179
|
});
|
|
181
180
|
const [report, setReport] = (0, react_1.useState)(undefined);
|
|
181
|
+
const [dateFilter, setDateFilter] = (0, react_1.useState)(undefined);
|
|
182
|
+
const [chartFilters, setChartFilters] = (0, react_1.useState)([]);
|
|
182
183
|
const [previousPage, setPreviousPage] = (0, react_1.useState)(0);
|
|
184
|
+
const [filterUpdateIndex, setFilterUpdateIndex] = (0, react_1.useState)(-1);
|
|
183
185
|
const theme = (0, useTheme_1.default)();
|
|
184
186
|
const onPageChange = (page) => {
|
|
185
187
|
if ((previousPage < page.currentPage &&
|
|
@@ -196,10 +198,6 @@ const ChartUpdater = ({ colors, reportId, className, containerStyle, isAnimation
|
|
|
196
198
|
};
|
|
197
199
|
const getChartDataPaginate = async (processing) => {
|
|
198
200
|
setPaginating(true);
|
|
199
|
-
if (!didFiltersChange(dashboard[reportId], specificDashboardFilter)) {
|
|
200
|
-
setPaginating(false);
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
201
|
try {
|
|
204
202
|
let updatedProcessing = { ...additionalProcessing, ...processing };
|
|
205
203
|
if (processing && processing.sort) {
|
|
@@ -210,8 +208,8 @@ const ChartUpdater = ({ colors, reportId, className, containerStyle, isAnimation
|
|
|
210
208
|
}
|
|
211
209
|
// Remove extra fields on each filter so we don't confuse the backend.
|
|
212
210
|
const allowDateRange = !hideDateRangeFilter;
|
|
213
|
-
const minimalFilters = Object.values(
|
|
214
|
-
? Object.values(
|
|
211
|
+
const minimalFilters = Object.values(dashboard.filters).length
|
|
212
|
+
? Object.values(chartFilters)
|
|
215
213
|
.filter((f) => allowDateRange || f.filterType !== 'date_range')
|
|
216
214
|
.map((filter) => {
|
|
217
215
|
const newFilter = { ...filter };
|
|
@@ -257,11 +255,6 @@ const ChartUpdater = ({ colors, reportId, className, containerStyle, isAnimation
|
|
|
257
255
|
};
|
|
258
256
|
const cleanedReport = await (0, dashboard_1.cleanDashboardItem)(dashboardItem, filters);
|
|
259
257
|
setReport(cleanedReport);
|
|
260
|
-
dispatch({
|
|
261
|
-
type: 'UPDATE_DASHBOARD_ITEM',
|
|
262
|
-
id: reportId,
|
|
263
|
-
data: cleanedReport,
|
|
264
|
-
});
|
|
265
258
|
if (mapColorsToFields) {
|
|
266
259
|
setColorMap(mapColorsToFields(cleanedReport, theme));
|
|
267
260
|
}
|
|
@@ -279,85 +272,68 @@ const ChartUpdater = ({ colors, reportId, className, containerStyle, isAnimation
|
|
|
279
272
|
setPaginating(false);
|
|
280
273
|
}
|
|
281
274
|
};
|
|
282
|
-
const getChartData = async (
|
|
283
|
-
setLoading(true);
|
|
284
|
-
if (!didFiltersChange(dashboard[reportId], specificDashboardFilter)) {
|
|
285
|
-
setLoading(false);
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
275
|
+
const getChartData = async (reportFilterInfo) => {
|
|
288
276
|
try {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
if (!updatedProcessing.page) {
|
|
292
|
-
updatedProcessing.page = {};
|
|
293
|
-
}
|
|
294
|
-
updatedProcessing.page.currentPage = 0;
|
|
295
|
-
}
|
|
296
|
-
// Remove extra fields on each filter so we don't confuse the backend.
|
|
297
|
-
const allowDateRange = !hideDateRangeFilter;
|
|
298
|
-
const minimalFilters = Object.values(specificDashboardFilter).length
|
|
299
|
-
? Object.values(specificDashboardFilter)
|
|
300
|
-
.filter((f) => allowDateRange || f.filterType !== 'date_range')
|
|
301
|
-
.map((filter) => {
|
|
302
|
-
const newFilter = { ...filter };
|
|
303
|
-
if (newFilter.filterType === 'date_range') {
|
|
304
|
-
delete newFilter['field'];
|
|
305
|
-
delete newFilter['options'];
|
|
306
|
-
delete newFilter['selectedValue'];
|
|
307
|
-
}
|
|
308
|
-
return newFilter;
|
|
309
|
-
})
|
|
310
|
-
: [];
|
|
311
|
-
if (filters) {
|
|
312
|
-
minimalFilters.push(...filters);
|
|
277
|
+
if (filterUpdateIndex === reportFilterInfo.updateIndex) {
|
|
278
|
+
return;
|
|
313
279
|
}
|
|
280
|
+
const filters = reportFilterInfo.filters;
|
|
281
|
+
setLoading(true);
|
|
314
282
|
const hostedBody = {
|
|
315
283
|
metadata: {
|
|
316
284
|
dashboardItemId: reportId,
|
|
317
285
|
orgId: client.customerId || '*',
|
|
318
286
|
clientId: client.publicKey,
|
|
319
287
|
task: 'item',
|
|
320
|
-
|
|
321
|
-
|
|
288
|
+
getDefaultDashboardFilters: filters ? false : true,
|
|
289
|
+
databaseType: client?.databaseType,
|
|
322
290
|
customFields,
|
|
323
|
-
|
|
324
|
-
paginateTable: true,
|
|
291
|
+
filters,
|
|
325
292
|
},
|
|
326
293
|
};
|
|
327
294
|
const cloudBody = {
|
|
328
295
|
id: reportId,
|
|
329
|
-
filters: minimalFilters.filter((f) => f.dashboardName === dashboard[reportId].dashboardName),
|
|
330
296
|
};
|
|
331
|
-
|
|
332
|
-
const resp = await (0, dataFetcher_1.getData)(client, 'itempost', 'omit', hostedBody, cloudBody);
|
|
297
|
+
const resp = await (0, dataFetcher_1.getData)(client, 'itempost', 'same-origin', hostedBody, cloudBody);
|
|
333
298
|
(0, errorProcessing_1.processFilterErrorList)(resp);
|
|
334
299
|
if (resp && resp.name !== 'error' && !resp.errorMessage) {
|
|
335
300
|
setIsComparison(!!resp.compareRows?.length);
|
|
336
301
|
if (resp.compareRows) {
|
|
337
302
|
(0, merge_1.mergeComparisonRange)(resp);
|
|
338
303
|
}
|
|
339
|
-
const
|
|
340
|
-
...resp,
|
|
341
|
-
filtersApplied: minimalFilters.filter((f) => f.dashboardName === dashboard[reportId].dashboardName),
|
|
342
|
-
};
|
|
343
|
-
const cleanedReport = await (0, dashboard_1.cleanDashboardItem)(dashboardItem, filters);
|
|
304
|
+
const cleanedReport = await (0, dashboard_1.cleanDashboardItem)(resp, filters ? filters : resp.filters);
|
|
344
305
|
if (cleanedReport.chartType === 'table' && cleanedReport.pivot) {
|
|
345
306
|
cleanedReport.columns = cleanedReport.yAxisFields;
|
|
346
307
|
}
|
|
347
308
|
setReport(cleanedReport);
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
309
|
+
let filterArray = filters;
|
|
310
|
+
// THIS SHOULD ONLY BE UNDEFINED ON INITIAL LOAD
|
|
311
|
+
if (!filterArray) {
|
|
312
|
+
filterArray = resp.filters.map((filter) => {
|
|
313
|
+
return (0, filterProcessing_1.processFilterFromBackend)(filter, resp.rows);
|
|
314
|
+
});
|
|
315
|
+
reportFiltersDispatch({
|
|
316
|
+
type: 'UPDATE_REPORT_FILTER',
|
|
317
|
+
id: reportId,
|
|
318
|
+
data: {
|
|
319
|
+
filters: filterArray,
|
|
320
|
+
updateIndex: reportFilterInfo.updateIndex,
|
|
321
|
+
},
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
const dateFilter = filterArray.find((filter) => {
|
|
325
|
+
return filter.filterType === 'date_range';
|
|
352
326
|
});
|
|
327
|
+
setFilterUpdateIndex(reportFilterInfo.updateIndex);
|
|
328
|
+
setDateFilter(dateFilter);
|
|
329
|
+
setChartFilters(filterArray);
|
|
353
330
|
if (mapColorsToFields) {
|
|
354
|
-
setColorMap(mapColorsToFields(
|
|
331
|
+
setColorMap(mapColorsToFields(resp, theme));
|
|
355
332
|
}
|
|
356
333
|
}
|
|
357
334
|
else {
|
|
358
335
|
setError(resp?.errorMessage);
|
|
359
336
|
}
|
|
360
|
-
setAdditionProcessing(updatedProcessing);
|
|
361
337
|
setLoading(false);
|
|
362
338
|
}
|
|
363
339
|
catch (e) {
|
|
@@ -366,12 +342,60 @@ const ChartUpdater = ({ colors, reportId, className, containerStyle, isAnimation
|
|
|
366
342
|
}
|
|
367
343
|
};
|
|
368
344
|
(0, react_1.useEffect)(() => {
|
|
345
|
+
// IF WE HAVE THE DATA IN DASHBOARD CONTEXT AND IT IS THE INITIAL LAOD DON'T FETCH DATA
|
|
346
|
+
if (initialLoad && dashboard[reportId]) {
|
|
347
|
+
setInitialLoad(false);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
setInitialLoad(false);
|
|
351
|
+
let parsedReportFilters = reportFilters[reportId]
|
|
352
|
+
? reportFilters[reportId]
|
|
353
|
+
: { updateIndex: 0 };
|
|
354
|
+
getChartData(parsedReportFilters);
|
|
355
|
+
}, [client.customerId, reportId, reportFilters[reportId]?.updateIndex]);
|
|
356
|
+
(0, react_1.useEffect)(() => {
|
|
357
|
+
if (!dashboard || !dashboard[reportId]) {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
369
360
|
setInitialLoad(false);
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
361
|
+
setLoading(false);
|
|
362
|
+
setReport(dashboard[reportId]);
|
|
363
|
+
setChartFilters(dashboard[reportId].filtersApplied);
|
|
364
|
+
const dateFilter = dashboard[reportId].filtersApplied.find((filter) => {
|
|
365
|
+
return filter.filterType === 'date_range';
|
|
366
|
+
});
|
|
367
|
+
setDateFilter(dateFilter);
|
|
368
|
+
}, []);
|
|
369
|
+
return ((0, jsx_runtime_1.jsxs)("div", { children: [!hideFilters && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
370
|
+
display: 'flex',
|
|
371
|
+
boxSizing: 'content-box',
|
|
372
|
+
flexDirection: 'row',
|
|
373
|
+
alignItems: 'center',
|
|
374
|
+
}, children: (0, jsx_runtime_1.jsx)(FilterContainerComponent, { children: chartFilters.map((filter, index) => ((0, jsx_runtime_1.jsx)(DashboardFilter_1.DashboardFilter, { filter: filter, onChangeFilter: (filter, value = null, comparison = null) => {
|
|
375
|
+
const updatedFilters = chartFilters.map((f) => {
|
|
376
|
+
if (f.field === filter.field ||
|
|
377
|
+
(f.filterType === 'date_range' &&
|
|
378
|
+
filter.filterType === 'date_range')) {
|
|
379
|
+
return (0, filterProcessing_1.updateFilter)(f, value, comparison);
|
|
380
|
+
}
|
|
381
|
+
return f;
|
|
382
|
+
});
|
|
383
|
+
setChartFilters(updatedFilters);
|
|
384
|
+
getChartData({
|
|
385
|
+
filters: updatedFilters,
|
|
386
|
+
updateIndex: filterUpdateIndex + 1,
|
|
387
|
+
});
|
|
388
|
+
reportFiltersDispatch({
|
|
389
|
+
type: 'UPDATE_REPORT_FILTER',
|
|
390
|
+
id: reportId,
|
|
391
|
+
data: {
|
|
392
|
+
filters: updatedFilters,
|
|
393
|
+
updateIndex: filterUpdateIndex + 1,
|
|
394
|
+
},
|
|
395
|
+
});
|
|
396
|
+
}, theme: theme, SelectComponent: SelectComponent, MultiSelectComponent: MultiSelectComponent, DateRangePickerComponent: DateRangePickerComponent }, index))) }) })), (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, initialDateFilter: dateFilter })] }));
|
|
373
397
|
};
|
|
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, }) => {
|
|
398
|
+
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, initialDateFilter, }) => {
|
|
375
399
|
const { dashboardFilters } = (0, react_1.useContext)(Context_1.DashboardFiltersContext);
|
|
376
400
|
const specificDashboardFilter = (0, react_1.useMemo)(() => {
|
|
377
401
|
if (!dashboardFilters) {
|
|
@@ -389,9 +413,14 @@ const ChartDisplay = ({ reportId, config, colors, className, containerStyle, hid
|
|
|
389
413
|
: ['#4E80EE', '#E14F62', '#55B5A6', '#E9A23B', '#6466E9', '#55B685'];
|
|
390
414
|
}, [colors]);
|
|
391
415
|
const rows = config?.pivotRows ?? config?.rows ?? [];
|
|
392
|
-
const
|
|
393
|
-
(
|
|
394
|
-
|
|
416
|
+
const getDateFilter = () => {
|
|
417
|
+
if (!hideDateRangeFilter) {
|
|
418
|
+
return (0, filterProcessing_1.findAndProcessDateFilter)(Object.values(specificDashboardFilter));
|
|
419
|
+
}
|
|
420
|
+
return undefined;
|
|
421
|
+
};
|
|
422
|
+
const [dateFilter, setDateFilter] = (0, react_1.useState)(initialDateFilter ?? getDateFilter());
|
|
423
|
+
const getYAxisFields = (curDateFilter) => {
|
|
395
424
|
if (config && config.pivot && config.pivot.columnField) {
|
|
396
425
|
return (config?.pivotColumns
|
|
397
426
|
.slice(1)
|
|
@@ -411,8 +440,8 @@ const ChartDisplay = ({ reportId, config, colors, className, containerStyle, hid
|
|
|
411
440
|
}) ?? []);
|
|
412
441
|
}
|
|
413
442
|
else {
|
|
414
|
-
if (
|
|
415
|
-
|
|
443
|
+
if (curDateFilter?.comparison &&
|
|
444
|
+
curDateFilter.comparisonRange.value !== 'NO_COMPARISON') {
|
|
416
445
|
const comparisonYAxisFields = config?.yAxisFields?.map((field) => {
|
|
417
446
|
return {
|
|
418
447
|
...field,
|
|
@@ -429,10 +458,11 @@ const ChartDisplay = ({ reportId, config, colors, className, containerStyle, hid
|
|
|
429
458
|
return config?.pivotColumns ?? config?.yAxisFields ?? [];
|
|
430
459
|
}
|
|
431
460
|
};
|
|
432
|
-
const [yAxisFields, setYAxisFields] = (0, react_1.useState)(getYAxisFields());
|
|
461
|
+
const [yAxisFields, setYAxisFields] = (0, react_1.useState)(getYAxisFields(dateFilter ?? getDateFilter()));
|
|
433
462
|
(0, react_1.useEffect)(() => {
|
|
434
|
-
setYAxisFields(getYAxisFields());
|
|
435
|
-
|
|
463
|
+
setYAxisFields(getYAxisFields(initialDateFilter ?? getDateFilter()));
|
|
464
|
+
setDateFilter(initialDateFilter ?? getDateFilter());
|
|
465
|
+
}, [config, specificDashboardFilter, initialDateFilter]);
|
|
436
466
|
if (error) {
|
|
437
467
|
return (0, jsx_runtime_1.jsx)(ChartError_1.default, { className: className, containerStyle: containerStyle });
|
|
438
468
|
}
|
package/dist/cjs/Context.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export declare const ReportBuilderQueryContext: React.Context<any>;
|
|
|
19
19
|
export declare const SavedReportsQueryContext: React.Context<any>;
|
|
20
20
|
export declare const DashboardContext: React.Context<any>;
|
|
21
21
|
export declare const DashboardFiltersContext: React.Context<any>;
|
|
22
|
+
export declare const ReportFiltersContext: React.Context<any>;
|
|
22
23
|
export declare const ChartDateFiltersContext: React.Context<any>;
|
|
23
24
|
export declare const useChartDateFilters: () => {
|
|
24
25
|
getChartDateFilterById: (id: string) => any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/Context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAMf,eAAO,MAAM,iBAAiB,oBAAwC,CAAC;AACvE,eAAO,MAAM,aAAa,oBAAwC,CAAC;AACnE,eAAO,MAAM,kBAAkB,oBAAwC,CAAC;AACxE,eAAO,MAAM,cAAc,oBAA0C,CAAC;AACtE,eA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AAO,MAAM,kBAAkB,oBAAwC,CAAC;AACxE,eAAO,MAAM,YAAY,oBAA0C,CAAC;AACpE,eAAO,MAAM,aAAa,oBAA0C,CAAC;AACrE,eAAO,MAAM,sCAAsC,oBAGjD,CAAC;AACH,eAAO,MAAM,0BAA0B,oBAGrC,CAAC;AACH,eAAO,MAAM,0BAA0B,oBAGrC,CAAC;AACH,eAAO,MAAM,oCAAoC,oBAG/C,CAAC;AACH,eAAO,MAAM,yBAAyB,oBAAwC,CAAC;AAC/E,eAAO,MAAM,wBAAwB,oBAAwC,CAAC;AAC9E,eAAO,MAAM,gBAAgB,oBAAwC,CAAC;AACtE,eAAO,MAAM,uBAAuB,oBAAwC,CAAC;AAC7E,eAAO,MAAM,oBAAoB,oBAAwC,CAAC;AAC1E,eAAO,MAAM,uBAAuB,oBAAwC,CAAC;AAE7E,eAAO,MAAM,mBAAmB;iCAKM,MAAM;6BACV,MAAM,cAAc,GAAG;CAQxD,CAAC;AA6DF,eAAO,MAAM,eAAe,qIAWzB,GAAG,mDAkQL,CAAC"}
|
package/dist/cjs/Context.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ContextProvider = exports.useChartDateFilters = exports.ChartDateFiltersContext = exports.DashboardFiltersContext = exports.DashboardContext = exports.SavedReportsQueryContext = exports.ReportBuilderQueryContext = exports.EditVisualizationModalVisibleContext = exports.QueryResultsLoadingContext = exports.ActiveVisualizationContext = exports.CreateVisualizationModalVisibleContext = exports.ClientContext = exports.ThemeContext = exports.EditorQueryContext = exports.SaveQueryModalStatusContext = exports.SavedQueriesContext = exports.HistoryContext = exports.SelectedSidebarIndexContext = exports.RowsContext = exports.ColumnsContext = exports.CustomFieldContext = exports.SchemaContext = exports.DateFilterContext = void 0;
|
|
3
|
+
exports.ContextProvider = exports.useChartDateFilters = exports.ChartDateFiltersContext = exports.ReportFiltersContext = exports.DashboardFiltersContext = exports.DashboardContext = exports.SavedReportsQueryContext = exports.ReportBuilderQueryContext = exports.EditVisualizationModalVisibleContext = exports.QueryResultsLoadingContext = exports.ActiveVisualizationContext = exports.CreateVisualizationModalVisibleContext = exports.ClientContext = exports.ThemeContext = exports.EditorQueryContext = exports.SaveQueryModalStatusContext = exports.SavedQueriesContext = exports.HistoryContext = exports.SelectedSidebarIndexContext = exports.RowsContext = exports.ColumnsContext = exports.CustomFieldContext = exports.SchemaContext = exports.DateFilterContext = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const schema_1 = require("./utils/schema");
|
|
@@ -40,6 +40,7 @@ exports.ReportBuilderQueryContext = (0, react_1.createContext)(['', dummySetter]
|
|
|
40
40
|
exports.SavedReportsQueryContext = (0, react_1.createContext)(['', dummySetter]);
|
|
41
41
|
exports.DashboardContext = (0, react_1.createContext)([{}, dummySetter]);
|
|
42
42
|
exports.DashboardFiltersContext = (0, react_1.createContext)([[], dummySetter]);
|
|
43
|
+
exports.ReportFiltersContext = (0, react_1.createContext)([{}, dummySetter]);
|
|
43
44
|
exports.ChartDateFiltersContext = (0, react_1.createContext)([{}, dummySetter]);
|
|
44
45
|
const useChartDateFilters = () => {
|
|
45
46
|
const { chartDateFilters, setChartDateFilters } = (0, react_1.useContext)(exports.ChartDateFiltersContext);
|
|
@@ -74,6 +75,16 @@ const dashboardReducer = (state, action) => {
|
|
|
74
75
|
return state;
|
|
75
76
|
}
|
|
76
77
|
};
|
|
78
|
+
const reportFiltersReducer = (state, action) => {
|
|
79
|
+
switch (action.type) {
|
|
80
|
+
case 'UPDATE_REPORT_FILTER':
|
|
81
|
+
return { ...state, [action.id]: action.data };
|
|
82
|
+
case 'CLEAR_REPORT_FILTERS':
|
|
83
|
+
return {};
|
|
84
|
+
default:
|
|
85
|
+
return state;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
77
88
|
const dashboardFiltersReducer = (state, action) => {
|
|
78
89
|
switch (action.type) {
|
|
79
90
|
case 'UPDATE_DASHBOARD_FILTER':
|
|
@@ -116,6 +127,7 @@ const ContextProvider = ({ children, initialTheme, publicKey, environment, authT
|
|
|
116
127
|
const [editVisualizationModalVisible, setEditVisualizationModalVisible] = (0, react_1.useState)(false);
|
|
117
128
|
const [dashboard, dispatch] = (0, react_1.useReducer)(dashboardReducer, {});
|
|
118
129
|
const [dashboardFilters, dashboardFiltersDispatch] = (0, react_1.useReducer)(dashboardFiltersReducer, []);
|
|
130
|
+
const [reportFilters, reportFiltersDispatch] = (0, react_1.useReducer)(reportFiltersReducer, {});
|
|
119
131
|
const customFieldHelper = async (client) => {
|
|
120
132
|
const customFields = await (0, schema_1.getCustomFieldInfo)(client, 'context');
|
|
121
133
|
setCustomFields(customFields);
|
|
@@ -258,6 +270,9 @@ const ContextProvider = ({ children, initialTheme, publicKey, environment, authT
|
|
|
258
270
|
], children: (0, jsx_runtime_1.jsx)(exports.DashboardContext.Provider, { value: { dashboard, dispatch }, children: (0, jsx_runtime_1.jsx)(exports.DashboardFiltersContext.Provider, { value: {
|
|
259
271
|
dashboardFilters,
|
|
260
272
|
dashboardFiltersDispatch,
|
|
261
|
-
}, children:
|
|
273
|
+
}, children: (0, jsx_runtime_1.jsx)(exports.ReportFiltersContext.Provider, { value: {
|
|
274
|
+
reportFilters,
|
|
275
|
+
reportFiltersDispatch,
|
|
276
|
+
}, children: children }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }));
|
|
262
277
|
};
|
|
263
278
|
exports.ContextProvider = ContextProvider;
|
package/dist/cjs/Table.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { MultiSelectComponentProps, SelectComponentProps } from './components/UiComponents';
|
|
3
|
+
import { DateRangePickerComponentProps } from './DateRangePicker/QuillDateRangePicker';
|
|
2
4
|
export interface TableColumn {
|
|
3
5
|
label: string;
|
|
4
6
|
field: string;
|
|
@@ -78,6 +80,8 @@ export interface TableProps {
|
|
|
78
80
|
* Whether to show the download csv button.
|
|
79
81
|
*/
|
|
80
82
|
hideCSVDownloadButton?: boolean;
|
|
83
|
+
/** Whether to hide the table filters component, deafulted to true */
|
|
84
|
+
hideFilters?: boolean;
|
|
81
85
|
/**
|
|
82
86
|
* Whether this table component is loading.
|
|
83
87
|
*/
|
|
@@ -90,6 +94,16 @@ export interface TableProps {
|
|
|
90
94
|
* A loading component to show when the table is loading.
|
|
91
95
|
*/
|
|
92
96
|
LoadingComponent?: () => JSX.Element;
|
|
97
|
+
/** A select component prop for the table filters */
|
|
98
|
+
SelectComponent?: (props: SelectComponentProps) => JSX.Element;
|
|
99
|
+
/** A multi select component prop for the table filters */
|
|
100
|
+
MultiSelectComponent?: (props: MultiSelectComponentProps) => JSX.Element;
|
|
101
|
+
/** A date range picker component prop for the table filters */
|
|
102
|
+
DateRangePickerComponent?: (props: DateRangePickerComponentProps) => JSX.Element;
|
|
103
|
+
/** A filter container component component prop for the table filters */
|
|
104
|
+
FilterContainerComponent?: ({ children, }: {
|
|
105
|
+
children: ReactNode;
|
|
106
|
+
}) => JSX.Element;
|
|
93
107
|
/**
|
|
94
108
|
* Styles the top-level container of the Table.
|
|
95
109
|
*
|
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,
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,SAAS,EAKV,MAAM,OAAO,CAAC;AAuBf,OAAO,EACL,yBAAyB,EAEzB,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AAInC,OAAO,EACL,6BAA6B,EAE9B,MAAM,wCAAwC,CAAC;AAGhD,MAAM,WAAW,WAAW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