@quillsql/react 2.13.20 → 2.13.21
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.map +1 -1
- package/dist/cjs/Chart.js +171 -23
- package/dist/cjs/Context.d.ts.map +1 -1
- package/dist/cjs/Context.js +13 -8
- package/dist/cjs/components/Dashboard/DashboardFilter.d.ts.map +1 -1
- package/dist/cjs/components/Dashboard/DashboardFilter.js +19 -1
- package/dist/cjs/components/Dashboard/DataLoader.d.ts.map +1 -1
- package/dist/cjs/components/Dashboard/DataLoader.js +4 -5
- package/dist/cjs/hooks/useExport.d.ts.map +1 -1
- package/dist/cjs/hooks/useExport.js +101 -70
- package/dist/cjs/hooks/useQuill.d.ts.map +1 -1
- package/dist/cjs/hooks/useQuill.js +21 -21
- package/dist/cjs/utils/filterProcessing.d.ts +2 -1
- package/dist/cjs/utils/filterProcessing.d.ts.map +1 -1
- package/dist/cjs/utils/filterProcessing.js +16 -0
- package/dist/cjs/utils/queryConstructor.d.ts.map +1 -1
- package/dist/cjs/utils/queryConstructor.js +2 -1
- package/dist/cjs/utils/report.d.ts +1 -1
- package/dist/cjs/utils/report.d.ts.map +1 -1
- package/dist/cjs/utils/report.js +4 -2
- package/dist/esm/Chart.d.ts.map +1 -1
- package/dist/esm/Chart.js +173 -25
- package/dist/esm/Context.d.ts.map +1 -1
- package/dist/esm/Context.js +13 -8
- package/dist/esm/components/Dashboard/DashboardFilter.d.ts.map +1 -1
- package/dist/esm/components/Dashboard/DashboardFilter.js +20 -2
- package/dist/esm/components/Dashboard/DataLoader.d.ts.map +1 -1
- package/dist/esm/components/Dashboard/DataLoader.js +4 -5
- package/dist/esm/hooks/useExport.d.ts.map +1 -1
- package/dist/esm/hooks/useExport.js +102 -71
- package/dist/esm/hooks/useQuill.d.ts.map +1 -1
- package/dist/esm/hooks/useQuill.js +21 -21
- package/dist/esm/utils/filterProcessing.d.ts +2 -1
- package/dist/esm/utils/filterProcessing.d.ts.map +1 -1
- package/dist/esm/utils/filterProcessing.js +15 -0
- package/dist/esm/utils/queryConstructor.d.ts.map +1 -1
- package/dist/esm/utils/queryConstructor.js +2 -1
- package/dist/esm/utils/report.d.ts +1 -1
- package/dist/esm/utils/report.d.ts.map +1 -1
- package/dist/esm/utils/report.js +4 -2
- package/package.json +4 -4
package/dist/esm/Chart.js
CHANGED
|
@@ -10,9 +10,11 @@ import LineChart from './components/Chart/LineChart';
|
|
|
10
10
|
import BarChart from './components/Chart/BarChart';
|
|
11
11
|
import { QuillLoadingSkeleton } from './components/Chart/ChartSkeleton';
|
|
12
12
|
import ChartError from './components/Chart/ChartError';
|
|
13
|
-
import { convertCustomFilter, FilterType, } from './models/Filter';
|
|
14
|
-
import { findAndProcessDateFilter } from './utils/filterProcessing';
|
|
13
|
+
import { convertCustomFilter, DashboardFilterType as DashboardFilterVariant, FilterType, } from './models/Filter';
|
|
14
|
+
import { applyCustomFilterToDashDateFilter, findAndProcessDateFilter, } from './utils/filterProcessing';
|
|
15
15
|
import { QuillFilterContainerComponent, } from './components/UiComponents';
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17
|
+
import { DashboardFilter } from './components/Dashboard/DashboardFilter';
|
|
16
18
|
import { QuillSelectComponent } from './components/QuillSelect';
|
|
17
19
|
import { QuillMultiSelectComponent } from './components/QuillMultiSelect';
|
|
18
20
|
import { QuillDateRangePicker } from './DateRangePicker/QuillDateRangePicker';
|
|
@@ -21,6 +23,7 @@ import { DEFAULT_PAGINATION } from './utils/paginationProcessing';
|
|
|
21
23
|
import QuillMetricComponent from './components/Dashboard/MetricComponent';
|
|
22
24
|
import DataLoader, { ChartDataLoader, } from './components/Dashboard/DataLoader';
|
|
23
25
|
import QuillTableComponent from './components/Dashboard/TableComponent';
|
|
26
|
+
import { COMPARISON_RANGE, defaultOptionsV2, getRangeFromPresetOptions, PRIMARY_RANGE, } from './DateRangePicker/dateRangePickerUtils';
|
|
24
27
|
const MAX_ROWS_FOR_GENERIC_TABLE = 500;
|
|
25
28
|
// @ts-ignore
|
|
26
29
|
function sumByKey(arr, key) {
|
|
@@ -142,17 +145,63 @@ FilterContainerComponent = QuillFilterContainerComponent, TableComponent = Quill
|
|
|
142
145
|
const [dashboard] = useContext(DashboardContext);
|
|
143
146
|
const { dashboardFilters } = useContext(DashboardFiltersContext);
|
|
144
147
|
const { reports, reportsDispatch, fetchIndividualReport } = useContext(ReportsContext);
|
|
145
|
-
const { reportFiltersDispatch, reportFilters } = useContext(ReportFiltersContext);
|
|
146
|
-
const customDateFilterExists = useMemo(() => {
|
|
147
|
-
return filters?.some((f) => f.filterType === FilterType.DateCustomFilter);
|
|
148
|
-
}, [filters]);
|
|
148
|
+
const { reportFiltersDispatch, reportFilters, loadFiltersForReport } = useContext(ReportFiltersContext);
|
|
149
149
|
const specificReportFilters = useMemo(() => {
|
|
150
|
-
return Object.values(reportFilters[reportId] ??
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
150
|
+
return Object.values(reportFilters[reportId] ??
|
|
151
|
+
(dashboard[reportId]
|
|
152
|
+
? dashboardFilters[dashboard[reportId].dashboardName]
|
|
153
|
+
: null) ??
|
|
154
|
+
{}).map((f) => f.filter);
|
|
155
|
+
}, [reportFilters[reportId]]);
|
|
156
|
+
const reportDateFilter = useMemo(() => {
|
|
157
|
+
return specificReportFilters.find((f) => f.filterType === 'date_range');
|
|
158
|
+
}, [specificReportFilters]);
|
|
159
|
+
const presetOptions = useMemo(() => {
|
|
160
|
+
return reportDateFilter
|
|
161
|
+
? (reportDateFilter.presetRanges?.map((elem) => {
|
|
162
|
+
if (!elem.isStatic) {
|
|
163
|
+
return {
|
|
164
|
+
label: elem.label,
|
|
165
|
+
value: elem.value,
|
|
166
|
+
startDate: PRIMARY_RANGE[elem.value]?.startDate ??
|
|
167
|
+
PRIMARY_RANGE['LAST_30_DAYS'].startDate,
|
|
168
|
+
endDate: PRIMARY_RANGE[elem.value]?.endDate ??
|
|
169
|
+
PRIMARY_RANGE['LAST_30_DAYS'].endDate,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
label: elem.label,
|
|
174
|
+
value: elem.value,
|
|
175
|
+
startDate: new Date(elem.startDate),
|
|
176
|
+
endDate: new Date(elem.endDate),
|
|
177
|
+
};
|
|
178
|
+
}) ?? defaultOptionsV2)
|
|
179
|
+
: defaultOptionsV2;
|
|
180
|
+
}, [reportDateFilter]);
|
|
181
|
+
const userFilters = useMemo(() => {
|
|
182
|
+
return filters?.filter((f) => f.filterType !== FilterType.DateCustomFilter &&
|
|
183
|
+
f.filterType !== FilterType.DateFilter &&
|
|
184
|
+
f.filterType !== FilterType.DateComparisonFilter);
|
|
185
|
+
}, [filters]);
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
if (reportDateFilter) {
|
|
188
|
+
// Filter for custom date filter that applies to the report's dateField
|
|
189
|
+
const customDateFilter = filters?.find((f) => f.filterType === FilterType.DateCustomFilter);
|
|
190
|
+
if (!customDateFilter) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
reportFiltersDispatch({
|
|
194
|
+
type: 'UPDATE_REPORT_FILTER',
|
|
195
|
+
id: reportId,
|
|
196
|
+
data: {
|
|
197
|
+
filter: applyCustomFilterToDashDateFilter(customDateFilter, reportDateFilter),
|
|
198
|
+
loading: false,
|
|
199
|
+
},
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}, [filters]);
|
|
154
203
|
const report = useMemo(() => reports[reportId], [reports, reportId]);
|
|
155
|
-
const [loading, setLoading] = useState(
|
|
204
|
+
const [loading, setLoading] = useState(true);
|
|
156
205
|
const [theme] = useContext(ThemeContext);
|
|
157
206
|
const colorMap = useMemo(() => {
|
|
158
207
|
if (mapColorsToFields && report && theme) {
|
|
@@ -161,6 +210,96 @@ FilterContainerComponent = QuillFilterContainerComponent, TableComponent = Quill
|
|
|
161
210
|
}, [report, theme]);
|
|
162
211
|
const [client, clientLoading] = useContext(ClientContext);
|
|
163
212
|
const [error, setError] = useState(undefined);
|
|
213
|
+
const updateFilter = (filter, value, comparison) => {
|
|
214
|
+
let filterValue = {};
|
|
215
|
+
if (filter.filterType === DashboardFilterVariant.String) {
|
|
216
|
+
if (filter.stringFilterType === 'multiselect') {
|
|
217
|
+
if ((value?.length ?? 0) === 0) {
|
|
218
|
+
filterValue = { values: undefined, operator: undefined };
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
filterValue = { values: value, operator: 'IN' };
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
filterValue = { selectedValue: value };
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
else if (filter.filterType === DashboardFilterVariant.Date) {
|
|
229
|
+
if (comparison ||
|
|
230
|
+
(filter.comparison &&
|
|
231
|
+
(filter.comparisonRange?.value ?? 'NO_COMPARISON') !==
|
|
232
|
+
'NO_COMPARISON')) {
|
|
233
|
+
let preset = '';
|
|
234
|
+
if (comparison) {
|
|
235
|
+
preset = filter.preset.value;
|
|
236
|
+
}
|
|
237
|
+
const key = comparison?.value ||
|
|
238
|
+
(filter.comparisonRange?.value ?? 'NO_COMPARISON');
|
|
239
|
+
let primaryRange = {
|
|
240
|
+
startDate: value ? value.startDate : filter.startDate,
|
|
241
|
+
endDate: value ? value.endDate : filter.endDate,
|
|
242
|
+
};
|
|
243
|
+
if (value && value.preset) {
|
|
244
|
+
preset = value.preset;
|
|
245
|
+
primaryRange = getRangeFromPresetOptions(value.preset, presetOptions);
|
|
246
|
+
}
|
|
247
|
+
filterValue = {
|
|
248
|
+
startDate: primaryRange.startDate,
|
|
249
|
+
endDate: primaryRange.endDate,
|
|
250
|
+
preset: {
|
|
251
|
+
label: presetOptions.find((o) => o.value === preset)?.label ?? preset,
|
|
252
|
+
value: preset,
|
|
253
|
+
},
|
|
254
|
+
comparisonRange: {
|
|
255
|
+
startDate: COMPARISON_RANGE[key](primaryRange)
|
|
256
|
+
?.startDate,
|
|
257
|
+
endDate: COMPARISON_RANGE[key](primaryRange)
|
|
258
|
+
?.endDate,
|
|
259
|
+
value: key,
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
const primaryRange = value && value.preset
|
|
265
|
+
? getRangeFromPresetOptions(value.preset, presetOptions)
|
|
266
|
+
: {
|
|
267
|
+
startDate: value?.startDate || filter.startDate,
|
|
268
|
+
endDate: value?.endDate || filter.endDate,
|
|
269
|
+
};
|
|
270
|
+
const preset = value?.preset ? value.preset : '';
|
|
271
|
+
filterValue = {
|
|
272
|
+
startDate: primaryRange.startDate,
|
|
273
|
+
endDate: primaryRange.endDate,
|
|
274
|
+
preset: {
|
|
275
|
+
label: presetOptions.find((o) => o.value === preset)?.label ?? preset,
|
|
276
|
+
value: preset,
|
|
277
|
+
},
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
reportFiltersDispatch({
|
|
282
|
+
type: 'UPDATE_REPORT_FILTER',
|
|
283
|
+
id: reportId,
|
|
284
|
+
data: {
|
|
285
|
+
filter: {
|
|
286
|
+
...filter,
|
|
287
|
+
...filterValue,
|
|
288
|
+
},
|
|
289
|
+
loading: true,
|
|
290
|
+
},
|
|
291
|
+
});
|
|
292
|
+
// FIXME: filter options by other options
|
|
293
|
+
// setTimeout(() => {
|
|
294
|
+
// loadFiltersForReport(
|
|
295
|
+
// reportId,
|
|
296
|
+
// 'Chart',
|
|
297
|
+
// specificReportFilters,
|
|
298
|
+
// filter.label,
|
|
299
|
+
// userFilters?.map(convertCustomFilter),
|
|
300
|
+
// );
|
|
301
|
+
// }, 2000);
|
|
302
|
+
};
|
|
164
303
|
const fetchReportHelper = async () => {
|
|
165
304
|
if (!client) {
|
|
166
305
|
return;
|
|
@@ -177,34 +316,43 @@ FilterContainerComponent = QuillFilterContainerComponent, TableComponent = Quill
|
|
|
177
316
|
}
|
|
178
317
|
};
|
|
179
318
|
useEffect(() => {
|
|
180
|
-
if (reportId === undefined || reportId === '' || clientLoading)
|
|
319
|
+
if (reportId === undefined || reportId === '' || clientLoading) {
|
|
181
320
|
return;
|
|
321
|
+
}
|
|
322
|
+
if (dashboard[reportId] &&
|
|
323
|
+
dashboardFilters[dashboard[reportId].dashboardName]) {
|
|
324
|
+
reportFiltersDispatch({
|
|
325
|
+
type: 'ADD_REPORT_FILTERS',
|
|
326
|
+
id: reportId,
|
|
327
|
+
data: Object.values(dashboardFilters[dashboard[reportId].dashboardName] ?? {}),
|
|
328
|
+
});
|
|
329
|
+
}
|
|
182
330
|
if (dashboard[reportId]) {
|
|
183
331
|
reportsDispatch({
|
|
184
332
|
type: 'ADD_REPORT',
|
|
185
333
|
id: reportId,
|
|
186
334
|
data: dashboard[reportId],
|
|
187
335
|
});
|
|
336
|
+
setLoading(false);
|
|
188
337
|
}
|
|
189
338
|
else if (!reports[reportId]) {
|
|
190
339
|
fetchReportHelper();
|
|
340
|
+
return;
|
|
191
341
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
199
|
-
}, [dashboard[reportId], dashboardFilters[reportId], clientLoading]);
|
|
342
|
+
setLoading(false);
|
|
343
|
+
}, [
|
|
344
|
+
dashboard[reportId],
|
|
345
|
+
dashboard[reportId] && dashboardFilters[dashboard[reportId].dashboardName],
|
|
346
|
+
clientLoading,
|
|
347
|
+
]);
|
|
200
348
|
if (report?.error || error) {
|
|
201
349
|
return (_jsx("div", { style: containerStyle, className: className, children: _jsx(ChartError, { errorMessage: report?.error ?? error }) }));
|
|
202
350
|
}
|
|
203
|
-
return (
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
351
|
+
return (_jsxs("div", { children: [!hideFilters && (_jsx(FilterContainerComponent, { children: specificReportFilters.map((filter, index) => (_jsx(DashboardFilter, { filter: filter, isLoading: reportFilters[reportId]?.[filter.label]?.loading, onChangeFilter: updateFilter, theme: theme, SelectComponent: SelectComponent, MultiSelectComponent: MultiSelectComponent, DateRangePickerComponent: DateRangePickerComponent }, index))) })), loading || !report ? (_jsx("div", { style: containerStyle, className: className, children: _jsx(LoadingComponent, {}) })) : (_jsxs(_Fragment, { children: [('table' === report.chartType || 'metric' === report.chartType) && (_jsx(DataLoader, { item: report, filters: specificReportFilters, userFilters: userFilters?.map(convertCustomFilter), additionalProcessing: {
|
|
352
|
+
page: DEFAULT_PAGINATION,
|
|
353
|
+
}, reportMode: true, children: ({ isLoading, error, onPageChange, onSortChange, data, rowCount, rowCountIsLoading, }) => 'metric' === report.chartType ? (_jsx(MetricComponent, { error: error, isLoading: isLoading, report: data })) : (_jsx(TableComponent, { report: data, isLoading: isLoading, error: error, rowCount: rowCount ?? data?.rowCount ?? data?.rows?.length ?? 0, rowCountIsLoading: rowCountIsLoading, onPageChange: (page) => onPageChange(page), onSortChange: (sort) => onSortChange(sort) })) })), report.chartType !== 'table' && report.chartType !== 'metric' && (_jsx(ChartDataLoader, { item: report, dateBucket: dateBucket, userFilters: userFilters?.map(convertCustomFilter), additionalProcessing: {
|
|
354
|
+
page: DEFAULT_PAGINATION,
|
|
355
|
+
}, filters: specificReportFilters, reportMode: true, children: ({ isLoading, data, error }) => error ? (_jsx("div", { style: containerStyle, className: className, children: _jsx(ChartError, { errorMessage: error }) })) : (_jsx(ChartDisplay, { config: data, 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, loading: isLoading, scrollable: true, colorMap: colorMap, LoadingComponent: LoadingComponent, onClickChartElement: onClickChartElement })) }))] }))] }));
|
|
208
356
|
}
|
|
209
357
|
export const ChartDisplay = ({ reportId, config, colors, className, containerStyle, hideXAxis, hideYAxis, hideCartesianGrid, hideDateRangeFilter = false, hideHorizontalCartesianGrid = false, hideVerticalCartesianGrid = true, hideSubsequentXAxisTicks = false, cartesianGridLineStyle = 'solid', cartesianGridLineColor, comparisonLineStyle, isAnimationActive, scrollable = false, loading = false, ErrorComponent = ChartError, colorMap, LoadingComponent = QuillLoadingSkeleton, onPageChange, onSortChange, onClickChartElement, overrideTheme, }) => {
|
|
210
358
|
const { downloadCSV } = useExport(reportId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/Context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/Context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAA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AS,CAAC;IAC1B,YAAY,EAAE,UAAU,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,mDAo0BA,CAAC"}
|
package/dist/esm/Context.js
CHANGED
|
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, createContext, useEffect, useReducer, useRef, } from 'react';
|
|
3
3
|
import { getSchemaInfoWithCustomFields } from './utils/schema';
|
|
4
4
|
import { fetchClient } from './utils/client';
|
|
5
|
+
import { FilterType } from './models/Filter';
|
|
5
6
|
import { getDashboard as requestGetDashboard } from './utils/dashboard';
|
|
6
7
|
import equal from 'fast-deep-equal';
|
|
7
8
|
import { defaultOptionsV2, PRIMARY_RANGE, } from './DateRangePicker/dateRangePickerUtils';
|
|
@@ -306,7 +307,6 @@ export const ContextProvider = ({ children, initialTheme, publicKey, organizatio
|
|
|
306
307
|
}
|
|
307
308
|
}, [initialTheme]);
|
|
308
309
|
async function loadFiltersForReport(reportId, initiator, filters, updatedFilterLabel, customFilters) {
|
|
309
|
-
const mergedDateFilters = mergeCustomFilters(filters, customFilters ?? []);
|
|
310
310
|
// Abort all previous fetch requests
|
|
311
311
|
const currentRequest = reportFilterOptionsAbortControllers.current[reportId];
|
|
312
312
|
if (currentRequest) {
|
|
@@ -372,14 +372,16 @@ export const ContextProvider = ({ children, initialTheme, publicKey, organizatio
|
|
|
372
372
|
...filter,
|
|
373
373
|
options: undefined,
|
|
374
374
|
},
|
|
375
|
-
appliedFilters:
|
|
375
|
+
appliedFilters: filters
|
|
376
376
|
.filter((f) => f.label !== filter.label)
|
|
377
377
|
.map((f) => ({
|
|
378
378
|
...f,
|
|
379
379
|
query: undefined,
|
|
380
380
|
options: undefined,
|
|
381
381
|
})),
|
|
382
|
-
customFilters
|
|
382
|
+
customFilters: customFilters?.filter((f) => f.filterType !== FilterType.DateCustomFilter &&
|
|
383
|
+
f.filterType !== FilterType.DateFilter &&
|
|
384
|
+
f.filterType !== FilterType.DateComparisonFilter),
|
|
383
385
|
},
|
|
384
386
|
}),
|
|
385
387
|
signal: filterOptionsAbortController?.signal,
|
|
@@ -458,7 +460,7 @@ export const ContextProvider = ({ children, initialTheme, publicKey, organizatio
|
|
|
458
460
|
useNewNodeSql: true,
|
|
459
461
|
// rowsOnly,
|
|
460
462
|
// rowCountOnly,
|
|
461
|
-
|
|
463
|
+
getDefaultDashboardFilters: !filters.length,
|
|
462
464
|
},
|
|
463
465
|
};
|
|
464
466
|
const cloudBody = {
|
|
@@ -482,7 +484,7 @@ export const ContextProvider = ({ children, initialTheme, publicKey, organizatio
|
|
|
482
484
|
orgId: client.organizationId ?? organizationId,
|
|
483
485
|
useNewNodeSql: true,
|
|
484
486
|
filters: filters?.map((f) => ({ ...f, options: undefined })),
|
|
485
|
-
getDefaultDashboardFilters:
|
|
487
|
+
getDefaultDashboardFilters: !filters.length,
|
|
486
488
|
additionalProcessing,
|
|
487
489
|
dateBucket,
|
|
488
490
|
databaseType: client.databaseType,
|
|
@@ -510,12 +512,15 @@ export const ContextProvider = ({ children, initialTheme, publicKey, organizatio
|
|
|
510
512
|
id: reportId,
|
|
511
513
|
data: { ...report, filtersApplied: customFilters },
|
|
512
514
|
});
|
|
513
|
-
if (!fetchRows) {
|
|
514
|
-
const
|
|
515
|
+
if (!fetchRows || !filters?.length) {
|
|
516
|
+
const returnedFilters = !fetchRows
|
|
517
|
+
? results.data.filters
|
|
518
|
+
: results.filters;
|
|
519
|
+
const dateFilterTemplate = returnedFilters.find((f) => f.filterType === 'date_range');
|
|
515
520
|
const dateFilter = dateFilterTemplate
|
|
516
521
|
? createDefaultDateFilter(dateFilterTemplate, [report], report.dashboardName)
|
|
517
522
|
: undefined;
|
|
518
|
-
const stringFilters =
|
|
523
|
+
const stringFilters = returnedFilters.filter((f) => f.filterType !== 'date_range');
|
|
519
524
|
const allFilters = [
|
|
520
525
|
...(dateFilter ? [dateFilter] : []),
|
|
521
526
|
...stringFilters,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardFilter.d.ts","sourceRoot":"","sources":["../../../../src/components/Dashboard/DashboardFilter.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"DashboardFilter.d.ts","sourceRoot":"","sources":["../../../../src/components/Dashboard/DashboardFilter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,4CAA4C,CAAC;AAGpD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,eAAe,IAAI,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEjE,KAAK,mBAAmB,GAAG,CAAC,EAC1B,KAAK,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,KAAK,EACL,SAAS,EACT,eAAe,GAChB,EAAE;IACD,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;IACJ,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;CACjE,KAAK,GAAG,CAAC,OAAO,CAAC;AAElB,KAAK,wBAAwB,GAAG,CAAC,EAC/B,KAAK,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,KAAK,EACL,SAAS,GACV,EAAE;IACD,KAAK,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AmB,CAAC,4BAA4B,CAAC,CAAC;IAC5D,KAAK,EAAE,UAAU,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,cAAc,EACd,eAAsC,EACtC,oBAAgD,EAChD,wBAA+C,EAC/C,KAAK,EACL,SAAS,GACV,EAAE,oBAAoB,kDAwJtB"}
|
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { COMPARISON_OPTIONS, PRIMARY_RANGE } from '../../DateRangePicker/dateRangePickerUtils';
|
|
3
4
|
import { QuillDateRangePicker, } from '../../DateRangePicker/QuillDateRangePicker';
|
|
4
5
|
import { QuillMultiSelectComponent } from '../QuillMultiSelect';
|
|
5
6
|
import { QuillSelectComponent } from '../QuillSelect';
|
|
6
7
|
export function DashboardFilter({ filter, onChangeFilter, SelectComponent = QuillSelectComponent, MultiSelectComponent = QuillMultiSelectComponent, DateRangePickerComponent = QuillDateRangePicker, theme, isLoading, }) {
|
|
8
|
+
const preset = useMemo(() => {
|
|
9
|
+
if ('preset' in filter && 'startDate' in filter && 'endDate' in filter) {
|
|
10
|
+
if (!filter.preset)
|
|
11
|
+
return '';
|
|
12
|
+
if (!filter.startDate || !filter.endDate)
|
|
13
|
+
return filter.preset.value;
|
|
14
|
+
const presetRange = filter.presetRanges?.find((range) => range.value === filter.preset.value) ?? PRIMARY_RANGE[filter.preset.value];
|
|
15
|
+
if (!presetRange)
|
|
16
|
+
return filter.preset.value;
|
|
17
|
+
if (presetRange.startDate !== filter.startDate ||
|
|
18
|
+
presetRange.endDate !== filter.endDate) {
|
|
19
|
+
return '';
|
|
20
|
+
}
|
|
21
|
+
return filter.preset.value;
|
|
22
|
+
}
|
|
23
|
+
return '';
|
|
24
|
+
}, [filter]);
|
|
7
25
|
if (!filter.options && !isLoading && !(filter.filterType === 'date_range')) {
|
|
8
26
|
return null;
|
|
9
27
|
}
|
|
@@ -45,7 +63,7 @@ export function DashboardFilter({ filter, onChangeFilter, SelectComponent = Quil
|
|
|
45
63
|
display: 'flex',
|
|
46
64
|
flexDirection: 'row',
|
|
47
65
|
alignItems: 'flex-end',
|
|
48
|
-
}, children: [_jsx(DateRangePickerComponent, { label: filter.label, dateRange: { startDate: filter.startDate, endDate: filter.endDate }, preset:
|
|
66
|
+
}, children: [_jsx(DateRangePickerComponent, { label: filter.label, dateRange: { startDate: filter.startDate, endDate: filter.endDate }, preset: preset, onChangeDateRange: (value) => {
|
|
49
67
|
onChangeFilter(filter, {
|
|
50
68
|
startDate: value.startDate,
|
|
51
69
|
endDate: value.endDate,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataLoader.d.ts","sourceRoot":"","sources":["../../../../src/components/Dashboard/DataLoader.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAuB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAajD,OAAO,EACL,oBAAoB,EAErB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"DataLoader.d.ts","sourceRoot":"","sources":["../../../../src/components/Dashboard/DataLoader.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAuB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAajD,OAAO,EACL,oBAAoB,EAErB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA0BtE,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE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AAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAIF,eAAO,MAAM,eAAe,4FAQzB;IACD,IAAI,EAAE,WAAW,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,CAClB,OAAO,EAAE,WAAW,EACpB,MAAM,EAAE,UAAU,KACf,YAAY,CAAC;IAClB,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,WAAW,CAAC,EAAE,cAAc,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,CAAC,EACT,SAAS,EACT,KAAK,EACL,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,iBAAiB,GAClB,EAAE,yBAAyB,KAAK,GAAG,CAAC,OAAO,CAAC;CAC9C,KAAG,GAAG,CAAC,OA2JP,CAAC"}
|
|
@@ -7,7 +7,6 @@ import { fetchResultsByReport, } from '../../utils/tableProcessing';
|
|
|
7
7
|
import { didFiltersChange } from '../../Chart';
|
|
8
8
|
import { mergeComparisonRange } from '../../utils/merge';
|
|
9
9
|
import equal from 'fast-deep-equal';
|
|
10
|
-
import { mergeCustomFilters } from '../../utils/filterProcessing';
|
|
11
10
|
const constructReportFromItem = (item) => {
|
|
12
11
|
return {
|
|
13
12
|
...EMPTY_INTERNAL_REPORT,
|
|
@@ -136,7 +135,7 @@ export default function DataLoader({ item, children, filters, userFilters, addit
|
|
|
136
135
|
rowCountAbortController.current?.abort();
|
|
137
136
|
rowCountAbortController.current = new AbortController();
|
|
138
137
|
try {
|
|
139
|
-
const rowCount = await fetchReportRowCount(item.id, client, true,
|
|
138
|
+
const rowCount = await fetchReportRowCount(item.id, client, true, filters.concat(userFilters ?? []), processing, schemaData.customFields, rowCountAbortController.current.signal);
|
|
140
139
|
rowCountAbortController.current = null;
|
|
141
140
|
if (rowCount) {
|
|
142
141
|
if (reportMode) {
|
|
@@ -204,7 +203,7 @@ export default function DataLoader({ item, children, filters, userFilters, addit
|
|
|
204
203
|
updateTableRowsAbortController.current?.abort();
|
|
205
204
|
updateTableRowsAbortController.current = new AbortController();
|
|
206
205
|
const updatedProcessing = { ...additionalProcessing, ...processing };
|
|
207
|
-
const paginatedRows = await fetchResultsByReport(item.id, client, updatedProcessing,
|
|
206
|
+
const paginatedRows = await fetchResultsByReport(item.id, client, updatedProcessing, filters.concat(userFilters ?? []), schemaData.customFields, true, undefined, updateTableRowsAbortController.current.signal);
|
|
208
207
|
updateTableRowsAbortController.current = null;
|
|
209
208
|
if (paginatedRows.error) {
|
|
210
209
|
throw new Error('Error fetching chart');
|
|
@@ -272,7 +271,7 @@ export default function DataLoader({ item, children, filters, userFilters, addit
|
|
|
272
271
|
rowsAbortController.current = null;
|
|
273
272
|
}
|
|
274
273
|
else {
|
|
275
|
-
const { report: fetchedReport, error } = await fetchReport(item.id, client, true,
|
|
274
|
+
const { report: fetchedReport, error } = await fetchReport(item.id, client, true, filters.concat(userFilters ?? []), processing, undefined, schemaData.customFields, true, false, rowsAbortController.current.signal);
|
|
276
275
|
rowsAbortController.current = null;
|
|
277
276
|
dispatch({
|
|
278
277
|
type: 'ADD_DASHBOARD_ITEM',
|
|
@@ -392,7 +391,7 @@ export const ChartDataLoader = ({ item, children, dateBucket, additionalProcessi
|
|
|
392
391
|
fetchReportAbortController.current = null;
|
|
393
392
|
}
|
|
394
393
|
else {
|
|
395
|
-
const { report, error } = await fetchReport(item.id, client, useReportTask,
|
|
394
|
+
const { report, error } = await fetchReport(item.id, client, useReportTask, filters.concat(userFilters ?? []), {
|
|
396
395
|
...additionalProcessing,
|
|
397
396
|
...(item.pivot ? {} : { page: DEFAULT_PAGINATION }),
|
|
398
397
|
}, dateBucket, schemaData.customFields, undefined, undefined, fetchReportAbortController.current.signal);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExport.d.ts","sourceRoot":"","sources":["../../../src/hooks/useExport.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useExport.d.ts","sourceRoot":"","sources":["../../../src/hooks/useExport.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AA0D/C,eAAO,MAAM,SAAS,cACT,MAAM,mEAMd;IACD,uBAAuB,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,GAAG,CAAC,OAAO,CAAC;IAChE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;;;;;;;;;;;;CAyOF,CAAC;AAEF,UAAU,aAAa;IACrB,MAAM,EAAE,WAAW,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;CAC5B"}
|