@quillsql/react 2.11.16 → 2.11.18
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 +109 -42
- package/dist/cjs/Chart.d.ts.map +1 -1
- package/dist/cjs/Chart.js +44 -18
- package/dist/cjs/ChartBuilder.d.ts +204 -30
- package/dist/cjs/ChartBuilder.d.ts.map +1 -1
- package/dist/cjs/ChartBuilder.js +124 -63
- package/dist/cjs/ChartEditor.d.ts +123 -19
- package/dist/cjs/ChartEditor.d.ts.map +1 -1
- package/dist/cjs/ChartEditor.js +47 -15
- package/dist/cjs/Dashboard.d.ts +148 -91
- package/dist/cjs/Dashboard.d.ts.map +1 -1
- package/dist/cjs/Dashboard.js +51 -159
- package/dist/cjs/DateRangePicker/QuillDateRangePicker.d.ts +21 -1
- package/dist/cjs/DateRangePicker/QuillDateRangePicker.d.ts.map +1 -1
- package/dist/cjs/DateRangePicker/QuillDateRangePicker.js +5 -2
- package/dist/cjs/DateRangePicker/dateRangePickerUtils.js +1 -1
- package/dist/cjs/QuillProvider.d.ts +105 -2
- package/dist/cjs/QuillProvider.d.ts.map +1 -1
- package/dist/cjs/QuillProvider.js +59 -0
- package/dist/cjs/ReportBuilder.d.ts +194 -42
- package/dist/cjs/ReportBuilder.d.ts.map +1 -1
- package/dist/cjs/ReportBuilder.js +563 -416
- package/dist/cjs/SQLEditor.d.ts +160 -23
- package/dist/cjs/SQLEditor.d.ts.map +1 -1
- package/dist/cjs/SQLEditor.js +36 -30
- package/dist/cjs/Table.d.ts +119 -15
- package/dist/cjs/Table.d.ts.map +1 -1
- package/dist/cjs/Table.js +37 -6
- package/dist/cjs/TableChart.d.ts.map +1 -1
- package/dist/cjs/TableChart.js +0 -194
- package/dist/cjs/{BarList.d.ts → components/Chart/BarList.d.ts} +1 -1
- package/dist/cjs/components/Chart/BarList.d.ts.map +1 -0
- package/dist/cjs/{BarList.js → components/Chart/BarList.js} +1 -1
- package/dist/cjs/components/Chart/LineChart.d.ts +2 -3
- package/dist/cjs/components/Chart/LineChart.d.ts.map +1 -1
- package/dist/cjs/components/Chart/LineChart.js +3 -3
- package/dist/cjs/components/Chart/PieChart.d.ts.map +1 -0
- package/dist/cjs/{PieChart.js → components/Chart/PieChart.js} +1 -1
- package/dist/cjs/components/Dashboard/ChartComponent.d.ts +2 -1
- package/dist/cjs/components/Dashboard/ChartComponent.d.ts.map +1 -1
- package/dist/cjs/components/Dashboard/ChartComponent.js +6 -7
- package/dist/cjs/components/Dashboard/DashboardFilter.d.ts +22 -0
- package/dist/cjs/components/Dashboard/DashboardFilter.d.ts.map +1 -0
- package/dist/cjs/components/Dashboard/DashboardFilter.js +75 -0
- package/dist/cjs/components/Dashboard/DataLoader.d.ts +1 -1
- package/dist/cjs/components/Dashboard/DataLoader.d.ts.map +1 -1
- package/dist/cjs/components/Dashboard/DataLoader.js +1 -1
- package/dist/cjs/components/Dashboard/MetricComponent.d.ts +2 -12
- package/dist/cjs/components/Dashboard/MetricComponent.d.ts.map +1 -1
- package/dist/cjs/components/Dashboard/MetricComponent.js +39 -17
- package/dist/cjs/components/Dashboard/TableComponent.d.ts +2 -1
- package/dist/cjs/components/Dashboard/TableComponent.d.ts.map +1 -1
- package/dist/cjs/components/Dashboard/TableComponent.js +6 -9
- package/dist/cjs/components/QuillCard.d.ts +2 -7
- package/dist/cjs/components/QuillCard.d.ts.map +1 -1
- package/dist/cjs/components/QuillCard.js +15 -9
- package/dist/cjs/components/QuillSelect.d.ts +4 -1
- package/dist/cjs/components/QuillSelect.d.ts.map +1 -1
- package/dist/cjs/components/QuillSelect.js +13 -8
- package/dist/cjs/components/QuillTable.d.ts +16 -2
- package/dist/cjs/components/QuillTable.d.ts.map +1 -1
- package/dist/cjs/components/QuillTable.js +4 -4
- package/dist/cjs/components/ReportBuilder/AddColumnPopover.d.ts +9 -3
- package/dist/cjs/components/ReportBuilder/AddColumnPopover.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/AddColumnPopover.js +10 -6
- package/dist/cjs/components/ReportBuilder/AddLimitPopover.d.ts +13 -1
- package/dist/cjs/components/ReportBuilder/AddLimitPopover.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/AddLimitPopover.js +5 -15
- package/dist/cjs/components/ReportBuilder/AddSortPopover.d.ts +21 -1
- package/dist/cjs/components/ReportBuilder/AddSortPopover.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/AddSortPopover.js +15 -17
- package/dist/cjs/components/ReportBuilder/bigDateMap.js +1 -1
- package/dist/cjs/components/ReportBuilder/convert.d.ts +3 -1
- package/dist/cjs/components/ReportBuilder/convert.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/convert.js +60 -21
- package/dist/cjs/components/ReportBuilder/operators.d.ts +15 -10
- package/dist/cjs/components/ReportBuilder/operators.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/operators.js +23 -10
- package/dist/cjs/components/ReportBuilder/pivot.d.ts +2 -1
- package/dist/cjs/components/ReportBuilder/pivot.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/ui.d.ts +82 -18
- package/dist/cjs/components/ReportBuilder/ui.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/ui.js +55 -103
- package/dist/cjs/components/ReportBuilder/util.d.ts +10 -4
- package/dist/cjs/components/ReportBuilder/util.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/util.js +124 -71
- package/dist/cjs/components/UiComponents.d.ts +81 -87
- package/dist/cjs/components/UiComponents.d.ts.map +1 -1
- package/dist/cjs/components/UiComponents.js +76 -103
- package/dist/cjs/hooks/index.d.ts +1 -0
- package/dist/cjs/hooks/index.d.ts.map +1 -1
- package/dist/cjs/hooks/index.js +3 -1
- package/dist/cjs/hooks/useTheme.d.ts +7 -0
- package/dist/cjs/hooks/useTheme.d.ts.map +1 -0
- package/dist/cjs/hooks/useTheme.js +12 -0
- package/dist/cjs/index.d.ts +10 -2
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/internals/ReportBuilder/PivotList.d.ts +5 -2
- package/dist/cjs/internals/ReportBuilder/PivotList.d.ts.map +1 -1
- package/dist/cjs/internals/ReportBuilder/PivotList.js +21 -21
- package/dist/cjs/internals/ReportBuilder/PivotModal.d.ts +30 -14
- package/dist/cjs/internals/ReportBuilder/PivotModal.d.ts.map +1 -1
- package/dist/cjs/internals/ReportBuilder/PivotModal.js +77 -52
- package/dist/cjs/utils/dataFetcher.d.ts.map +1 -1
- package/dist/cjs/utils/dataFetcher.js +2 -0
- package/dist/cjs/utils/parserBigQuery.d.ts +6 -0
- package/dist/cjs/utils/parserBigQuery.d.ts.map +1 -0
- package/dist/cjs/utils/parserBigQuery.js +60 -0
- package/dist/cjs/utils/parserPostgres.d.ts +3 -0
- package/dist/cjs/utils/parserPostgres.d.ts.map +1 -0
- package/dist/cjs/utils/parserPostgres.js +42 -0
- package/dist/esm/Chart.d.ts +109 -42
- package/dist/esm/Chart.d.ts.map +1 -1
- package/dist/esm/Chart.js +45 -19
- package/dist/esm/ChartBuilder.d.ts +204 -30
- package/dist/esm/ChartBuilder.d.ts.map +1 -1
- package/dist/esm/ChartBuilder.js +124 -63
- package/dist/esm/ChartEditor.d.ts +123 -19
- package/dist/esm/ChartEditor.d.ts.map +1 -1
- package/dist/esm/ChartEditor.js +51 -19
- package/dist/esm/Dashboard.d.ts +148 -91
- package/dist/esm/Dashboard.d.ts.map +1 -1
- package/dist/esm/Dashboard.js +54 -160
- package/dist/esm/DateRangePicker/QuillDateRangePicker.d.ts +21 -1
- package/dist/esm/DateRangePicker/QuillDateRangePicker.d.ts.map +1 -1
- package/dist/esm/DateRangePicker/QuillDateRangePicker.js +6 -3
- package/dist/esm/DateRangePicker/dateRangePickerUtils.js +1 -1
- package/dist/esm/QuillProvider.d.ts +105 -2
- package/dist/esm/QuillProvider.d.ts.map +1 -1
- package/dist/esm/QuillProvider.js +59 -0
- package/dist/esm/ReportBuilder.d.ts +194 -42
- package/dist/esm/ReportBuilder.d.ts.map +1 -1
- package/dist/esm/ReportBuilder.js +566 -419
- package/dist/esm/SQLEditor.d.ts +160 -23
- package/dist/esm/SQLEditor.d.ts.map +1 -1
- package/dist/esm/SQLEditor.js +36 -30
- package/dist/esm/Table.d.ts +119 -15
- package/dist/esm/Table.d.ts.map +1 -1
- package/dist/esm/Table.js +38 -7
- package/dist/esm/TableChart.d.ts.map +1 -1
- package/dist/esm/TableChart.js +0 -194
- package/dist/esm/{BarList.d.ts → components/Chart/BarList.d.ts} +1 -1
- package/dist/esm/components/Chart/BarList.d.ts.map +1 -0
- package/dist/esm/{BarList.js → components/Chart/BarList.js} +1 -1
- package/dist/esm/components/Chart/LineChart.d.ts +2 -3
- package/dist/esm/components/Chart/LineChart.d.ts.map +1 -1
- package/dist/esm/components/Chart/LineChart.js +3 -3
- package/dist/esm/components/Chart/PieChart.d.ts.map +1 -0
- package/dist/esm/{PieChart.js → components/Chart/PieChart.js} +1 -1
- package/dist/esm/components/Dashboard/ChartComponent.d.ts +2 -1
- package/dist/esm/components/Dashboard/ChartComponent.d.ts.map +1 -1
- package/dist/esm/components/Dashboard/ChartComponent.js +5 -6
- package/dist/esm/components/Dashboard/DashboardFilter.d.ts +22 -0
- package/dist/esm/components/Dashboard/DashboardFilter.d.ts.map +1 -0
- package/dist/esm/components/Dashboard/DashboardFilter.js +71 -0
- package/dist/esm/components/Dashboard/DataLoader.d.ts +1 -1
- package/dist/esm/components/Dashboard/DataLoader.d.ts.map +1 -1
- package/dist/esm/components/Dashboard/DataLoader.js +1 -1
- package/dist/esm/components/Dashboard/MetricComponent.d.ts +2 -12
- package/dist/esm/components/Dashboard/MetricComponent.d.ts.map +1 -1
- package/dist/esm/components/Dashboard/MetricComponent.js +39 -17
- package/dist/esm/components/Dashboard/TableComponent.d.ts +2 -1
- package/dist/esm/components/Dashboard/TableComponent.d.ts.map +1 -1
- package/dist/esm/components/Dashboard/TableComponent.js +6 -9
- package/dist/esm/components/QuillCard.d.ts +2 -7
- package/dist/esm/components/QuillCard.d.ts.map +1 -1
- package/dist/esm/components/QuillCard.js +15 -9
- package/dist/esm/components/QuillSelect.d.ts +4 -1
- package/dist/esm/components/QuillSelect.d.ts.map +1 -1
- package/dist/esm/components/QuillSelect.js +14 -9
- package/dist/esm/components/QuillTable.d.ts +16 -2
- package/dist/esm/components/QuillTable.d.ts.map +1 -1
- package/dist/esm/components/QuillTable.js +4 -4
- package/dist/esm/components/ReportBuilder/AddColumnPopover.d.ts +9 -3
- package/dist/esm/components/ReportBuilder/AddColumnPopover.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/AddColumnPopover.js +10 -6
- package/dist/esm/components/ReportBuilder/AddLimitPopover.d.ts +13 -1
- package/dist/esm/components/ReportBuilder/AddLimitPopover.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/AddLimitPopover.js +5 -15
- package/dist/esm/components/ReportBuilder/AddSortPopover.d.ts +21 -1
- package/dist/esm/components/ReportBuilder/AddSortPopover.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/AddSortPopover.js +17 -19
- package/dist/esm/components/ReportBuilder/bigDateMap.js +1 -1
- package/dist/esm/components/ReportBuilder/convert.d.ts +3 -1
- package/dist/esm/components/ReportBuilder/convert.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/convert.js +51 -13
- package/dist/esm/components/ReportBuilder/operators.d.ts +15 -10
- package/dist/esm/components/ReportBuilder/operators.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/operators.js +23 -10
- package/dist/esm/components/ReportBuilder/pivot.d.ts +2 -1
- package/dist/esm/components/ReportBuilder/pivot.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/ui.d.ts +82 -18
- package/dist/esm/components/ReportBuilder/ui.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/ui.js +53 -101
- package/dist/esm/components/ReportBuilder/util.d.ts +10 -4
- package/dist/esm/components/ReportBuilder/util.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/util.js +114 -67
- package/dist/esm/components/UiComponents.d.ts +81 -87
- package/dist/esm/components/UiComponents.d.ts.map +1 -1
- package/dist/esm/components/UiComponents.js +71 -102
- package/dist/esm/hooks/index.d.ts +1 -0
- package/dist/esm/hooks/index.d.ts.map +1 -1
- package/dist/esm/hooks/index.js +1 -0
- package/dist/esm/hooks/useTheme.d.ts +7 -0
- package/dist/esm/hooks/useTheme.d.ts.map +1 -0
- package/dist/esm/hooks/useTheme.js +10 -0
- package/dist/esm/index.d.ts +10 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/internals/ReportBuilder/PivotList.d.ts +5 -2
- package/dist/esm/internals/ReportBuilder/PivotList.d.ts.map +1 -1
- package/dist/esm/internals/ReportBuilder/PivotList.js +21 -21
- package/dist/esm/internals/ReportBuilder/PivotModal.d.ts +30 -14
- package/dist/esm/internals/ReportBuilder/PivotModal.d.ts.map +1 -1
- package/dist/esm/internals/ReportBuilder/PivotModal.js +77 -52
- package/dist/esm/utils/dataFetcher.d.ts.map +1 -1
- package/dist/esm/utils/dataFetcher.js +2 -0
- package/dist/esm/utils/parserBigQuery.d.ts +6 -0
- package/dist/esm/utils/parserBigQuery.d.ts.map +1 -0
- package/dist/esm/utils/parserBigQuery.js +52 -0
- package/dist/esm/utils/parserPostgres.d.ts +3 -0
- package/dist/esm/utils/parserPostgres.d.ts.map +1 -0
- package/dist/esm/utils/parserPostgres.js +37 -0
- package/package.json +1 -1
- package/dist/cjs/BarList.d.ts.map +0 -1
- package/dist/cjs/PieChart.d.ts.map +0 -1
- package/dist/esm/BarList.d.ts.map +0 -1
- package/dist/esm/PieChart.d.ts.map +0 -1
- /package/dist/cjs/{PieChart.d.ts → components/Chart/PieChart.d.ts} +0 -0
- /package/dist/esm/{PieChart.d.ts → components/Chart/PieChart.d.ts} +0 -0
package/dist/esm/Dashboard.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
|
|
2
|
+
/* eslint-disable no-unused-vars */
|
|
3
|
+
import { useContext, useEffect, useState, } from 'react';
|
|
3
4
|
import Chart from './Chart';
|
|
4
|
-
import { PRIMARY_RANGE, COMPARISON_RANGE, defaultOptionsV2,
|
|
5
|
-
import { ClientContext, DashboardContext, ThemeContext, DashboardFiltersContext, DateFilterContext,
|
|
6
|
-
import { ArrowDownHeadIcon } from './assets';
|
|
5
|
+
import { PRIMARY_RANGE, COMPARISON_RANGE, defaultOptionsV2, getRangeFromPresetOptions, } from './DateRangePicker/dateRangePickerUtils';
|
|
6
|
+
import { ClientContext, DashboardContext, ThemeContext, DashboardFiltersContext, DateFilterContext, } from './Context';
|
|
7
7
|
import { useDashboard } from './hooks/useDashboard';
|
|
8
8
|
import { hashCode } from './utils/crypto';
|
|
9
9
|
import DashboardSectionContainer from './components/Dashboard/DashboardSectionContainer';
|
|
@@ -15,137 +15,9 @@ import { styleToProps } from './utils/styles';
|
|
|
15
15
|
import { cleanDashboardItem } from './utils/dashboard';
|
|
16
16
|
import { QuillDateRangePicker } from './DateRangePicker/QuillDateRangePicker';
|
|
17
17
|
import DataLoader from './components/Dashboard/DataLoader';
|
|
18
|
+
import { QuillEmptyDashboardComponent } from './components/UiComponents';
|
|
19
|
+
import { DashboardFilter } from './components/Dashboard/DashboardFilter';
|
|
18
20
|
import { QuillSelectComponent } from './components/QuillSelect';
|
|
19
|
-
import ChartSkeleton from './components/Chart/ChartSkeleton';
|
|
20
|
-
export function DashboardFilter({ filter, onChangeFilter, SelectComponent = QuillSelectComponent, DateRangePickerComponent, theme, }) {
|
|
21
|
-
const { comparisonRange, setComparisonRange } = useComparisonRange();
|
|
22
|
-
const { setDateFilter } = useDateFilter();
|
|
23
|
-
const [filterValue, setFilterValue] = useState(null);
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (filter.filterType === 'string') {
|
|
26
|
-
setFilterValue(filter.selectedValue);
|
|
27
|
-
}
|
|
28
|
-
if (filter.filterType == 'date_range') {
|
|
29
|
-
setDateFilter(filter.preset.label);
|
|
30
|
-
if (filter?.comparisonRange?.value) {
|
|
31
|
-
const newComparisonRange = COMPARISON_OPTIONS.find((option) => {
|
|
32
|
-
return option.value === filter.comparisonRange.value;
|
|
33
|
-
});
|
|
34
|
-
setComparisonRange(newComparisonRange);
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
setComparisonRange(null);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}, [filter]);
|
|
41
|
-
if (filter.filterType === 'string') {
|
|
42
|
-
return (_jsx(SelectComponent, { theme: theme, label: filter.label, value: filterValue, onChange: (e) => {
|
|
43
|
-
onChangeFilter(filter, e);
|
|
44
|
-
}, options: [
|
|
45
|
-
...filter.options.map((elem) => {
|
|
46
|
-
return {
|
|
47
|
-
label: elem[filter.labelField],
|
|
48
|
-
value: elem[filter.field],
|
|
49
|
-
};
|
|
50
|
-
}),
|
|
51
|
-
] }));
|
|
52
|
-
}
|
|
53
|
-
if (filter.filterType == 'date_range') {
|
|
54
|
-
return (_jsxs("div", { style: {
|
|
55
|
-
display: 'flex',
|
|
56
|
-
flexDirection: 'row',
|
|
57
|
-
alignItems: 'flex-end',
|
|
58
|
-
}, children: [_jsx(DateRangePickerComponent, { label: filter.label, dateRange: { startDate: filter.startDate, endDate: filter.endDate }, preset: filter.preset.label, onChangeDateRange: (value) => {
|
|
59
|
-
onChangeFilter(filter, {
|
|
60
|
-
startDate: value.startDate,
|
|
61
|
-
endDate: value.endDate,
|
|
62
|
-
});
|
|
63
|
-
}, onChangePreset: (value) => {
|
|
64
|
-
onChangeFilter(filter, { preset: value });
|
|
65
|
-
}, presetOptions: filter.options.map((option) => {
|
|
66
|
-
return { label: option.label, value: option.label };
|
|
67
|
-
}) }), comparisonRange && (_jsx("div", { children: _jsxs("div", { style: {
|
|
68
|
-
display: 'flex',
|
|
69
|
-
flexDirection: 'row',
|
|
70
|
-
alignItems: 'center',
|
|
71
|
-
}, children: [_jsx("div", { style: {
|
|
72
|
-
paddingLeft: 16,
|
|
73
|
-
paddingRight: 12,
|
|
74
|
-
color: theme?.secondaryTextColor,
|
|
75
|
-
fontFamily: theme?.fontFamily,
|
|
76
|
-
fontSize: 14,
|
|
77
|
-
display: 'flex',
|
|
78
|
-
alignItems: 'center',
|
|
79
|
-
flex: 1,
|
|
80
|
-
minWidth: 80,
|
|
81
|
-
justifyContent: 'center',
|
|
82
|
-
}, children: "compared to" }), _jsx(SelectComponent, { theme: theme, value: comparisonRange.value, onChange: (e) => {
|
|
83
|
-
onChangeFilter(filter, null, COMPARISON_OPTIONS.find((option) => {
|
|
84
|
-
return option.value === e;
|
|
85
|
-
}));
|
|
86
|
-
}, options: COMPARISON_OPTIONS.map((compareOption) => {
|
|
87
|
-
return {
|
|
88
|
-
value: compareOption.value,
|
|
89
|
-
label: compareOption.text,
|
|
90
|
-
};
|
|
91
|
-
}) })] }) }))] }));
|
|
92
|
-
}
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
const QuillDropdownComponent = ({ onChange, value, label, options, }) => {
|
|
96
|
-
const [theme] = useContext(ThemeContext);
|
|
97
|
-
const handleOnChange = useCallback((event) => {
|
|
98
|
-
onChange(event.target.value);
|
|
99
|
-
}, [onChange]);
|
|
100
|
-
return (_jsxs("div", { children: [label && (_jsx("div", { style: {
|
|
101
|
-
marginBottom: 6,
|
|
102
|
-
fontWeight: theme.labelFontWeight || '600',
|
|
103
|
-
color: theme.secondaryTextColor,
|
|
104
|
-
fontFamily: theme.fontFamily,
|
|
105
|
-
fontSize: 14,
|
|
106
|
-
}, children: label })), _jsxs("div", { style: { position: 'relative', height: 38 }, children: [_jsxs("select", { onChange: handleOnChange, value: value ?? '', id: 'reportbuilderdropdown',
|
|
107
|
-
// defaultValue="Select"
|
|
108
|
-
style: {
|
|
109
|
-
width: '100%',
|
|
110
|
-
WebkitAppearance: 'none',
|
|
111
|
-
minWidth: 230,
|
|
112
|
-
outline: 'none',
|
|
113
|
-
textAlign: 'left',
|
|
114
|
-
whiteSpace: 'nowrap',
|
|
115
|
-
overflow: 'hidden',
|
|
116
|
-
textOverflow: 'ellipsis',
|
|
117
|
-
borderRadius: 6,
|
|
118
|
-
paddingLeft: 12,
|
|
119
|
-
paddingRight: 12,
|
|
120
|
-
height: 38,
|
|
121
|
-
borderWidth: theme.borderWidth,
|
|
122
|
-
borderColor: theme.borderColor,
|
|
123
|
-
background: theme.backgroundColor,
|
|
124
|
-
color: theme.primaryTextColor,
|
|
125
|
-
boxShadow: '0 1px 2px 0 rgba(0,0,0,.05)',
|
|
126
|
-
fontFamily: theme.fontFamily,
|
|
127
|
-
fontSize: 14,
|
|
128
|
-
fontWeight: 500,
|
|
129
|
-
boxSizing: 'border-box',
|
|
130
|
-
}, children: [_jsx("option", { value: "", children: "Select" }), options.map((option, index) => (_jsx("option", { value: option.value, children: option.label }, option.label + index)))] }), _jsx(ArrowDownHeadIcon, { style: {
|
|
131
|
-
height: '20px',
|
|
132
|
-
width: '20px',
|
|
133
|
-
flex: 'none',
|
|
134
|
-
position: 'absolute',
|
|
135
|
-
right: 8,
|
|
136
|
-
top: 9,
|
|
137
|
-
color: theme?.secondaryTextColor,
|
|
138
|
-
}, "aria-hidden": "true" })] })] }));
|
|
139
|
-
};
|
|
140
|
-
const MemoizedDropdown = memo(QuillDropdownComponent);
|
|
141
|
-
const areEqual = (prevProps, nextProps) => {
|
|
142
|
-
// This function returns true if passing nextProps to render would return
|
|
143
|
-
// the same result as passing prevProps to render, otherwise it returns false
|
|
144
|
-
return (prevProps.dateRange.startDate === nextProps.dateRange.startDate &&
|
|
145
|
-
prevProps.dateRange.endDate === nextProps.dateRange.endDate);
|
|
146
|
-
};
|
|
147
|
-
const MemoizedDateRangePicker = memo(QuillDateRangePicker, areEqual);
|
|
148
|
-
const QuillEmptyDashboardComponent = () => _jsx("div", {});
|
|
149
21
|
const defaultChartContainerStyles = {
|
|
150
22
|
display: 'flex',
|
|
151
23
|
width: '100%',
|
|
@@ -153,10 +25,37 @@ const defaultChartContainerStyles = {
|
|
|
153
25
|
height: 300,
|
|
154
26
|
};
|
|
155
27
|
/**
|
|
156
|
-
* Quill Dashboard
|
|
28
|
+
* ### Quill Dashboard
|
|
29
|
+
*
|
|
30
|
+
* Dynamically displays a filterable grid of charts, metrics, and tables with
|
|
31
|
+
* live data from your database. Once implemented, Quill lets you perform
|
|
32
|
+
* zero-downtime, zero-code updates to your dashboard views on an org-level as
|
|
33
|
+
* well as company-wide.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```js
|
|
37
|
+
* // Usage without custom components
|
|
38
|
+
* <Dashboard />
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```js
|
|
43
|
+
* // You can also pass your own components
|
|
44
|
+
* <Dashboard
|
|
45
|
+
* name="saved_reports"
|
|
46
|
+
* SelectComponent={MySelect}
|
|
47
|
+
* onClickDashboardItem={(item) => navigate(`/detail/${item.id}`)}
|
|
48
|
+
* MetricComponent={MyMetric}
|
|
49
|
+
* ChartComponent={MyChart}
|
|
50
|
+
* TableComponent={MyTable}
|
|
51
|
+
* containerStyle={{ backgroundColor: 'white', padding: '10px' }}
|
|
52
|
+
* />
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* ### API Reference
|
|
56
|
+
* @see https://docs.quillsql.com/components/dashboard
|
|
157
57
|
*/
|
|
158
|
-
export default function Dashboard({ name,
|
|
159
|
-
const { dateFilter } = useDateFilter();
|
|
58
|
+
export default function Dashboard({ name, SelectComponent = QuillSelectComponent, EmptyDashboardComponent = QuillEmptyDashboardComponent, DateRangePickerComponent = QuillDateRangePicker, MetricComponent = QuillMetricComponent, ChartComponent = QuillChartComponent, TableComponent = QuillTableComponent, DashboardSectionComponent = DashboardSection, DashboardSectionContainerComponent = DashboardSectionContainer, onClickDashboardItem, onChangeLoading, hideFilters, hideDateRangeFilter = false, hideXAxis = false, hideYAxis = false, hideCartesianGrid = false, comparisonLineStyle = 'solid', containerStyle, className, chartContainerStyle = defaultChartContainerStyles, }) {
|
|
160
59
|
const { dispatch } = useContext(DashboardContext);
|
|
161
60
|
const { isLoading: isDataLoading, data, reload, } = useDashboard(name);
|
|
162
61
|
const [dashboardSections, setDashboardSections] = useState(null);
|
|
@@ -265,8 +164,11 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle =
|
|
|
265
164
|
}
|
|
266
165
|
};
|
|
267
166
|
const handleOnClickDashboardItem = (elem) => {
|
|
167
|
+
const cleanedItem = cleanDashboardItem(dashboard[elem._id] ?? elem, dashboardFilters);
|
|
268
168
|
if (dashboard[elem._id]?._id && onClickDashboardItem) {
|
|
269
|
-
|
|
169
|
+
// The _id add-on is a patch for backwards compatability
|
|
170
|
+
// TODO: remove all _id references from the codebase (admin and react)
|
|
171
|
+
onClickDashboardItem({ ...cleanedItem, _id: elem._id });
|
|
270
172
|
}
|
|
271
173
|
else if (onClickDashboardItem) {
|
|
272
174
|
dispatch({
|
|
@@ -274,13 +176,7 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle =
|
|
|
274
176
|
id: elem._id,
|
|
275
177
|
data: { ...elem, filtersApplied: dashboardFilters },
|
|
276
178
|
});
|
|
277
|
-
onClickDashboardItem({
|
|
278
|
-
...dashboard[elem._id],
|
|
279
|
-
_id: elem._id,
|
|
280
|
-
error_id: elem._id,
|
|
281
|
-
name: elem.name,
|
|
282
|
-
query: elem.queryString,
|
|
283
|
-
});
|
|
179
|
+
onClickDashboardItem({ ...cleanedItem, _id: elem._id });
|
|
284
180
|
}
|
|
285
181
|
};
|
|
286
182
|
function removeQuotes(str) {
|
|
@@ -417,16 +313,16 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle =
|
|
|
417
313
|
return _jsx(EmptyDashboardComponent, {});
|
|
418
314
|
const sortByOrdering = (a, b) => {
|
|
419
315
|
if (a.order === undefined && b.order === undefined)
|
|
420
|
-
return 0;
|
|
316
|
+
return 0;
|
|
421
317
|
if (a.order === undefined)
|
|
422
|
-
return 1;
|
|
318
|
+
return 1;
|
|
423
319
|
if (b.order === undefined)
|
|
424
|
-
return -1;
|
|
425
|
-
return a.order - b.order;
|
|
320
|
+
return -1;
|
|
321
|
+
return a.order - b.order;
|
|
426
322
|
};
|
|
427
323
|
const sortedFilters = Object.values(dashboardFilters)
|
|
428
324
|
.sort((filter) => (filter.filterType === 'date_range' ? -1 : 1))
|
|
429
|
-
.filter((f) => !
|
|
325
|
+
.filter((f) => !hideDateRangeFilter || f.filterType !== 'date_range');
|
|
430
326
|
const metrics = (section) => dashboardSections[section]
|
|
431
327
|
.filter(({ chartType }) => chartType === 'metric')
|
|
432
328
|
.sort(sortByOrdering);
|
|
@@ -436,7 +332,7 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle =
|
|
|
436
332
|
const tables = (section) => dashboardSections[section]
|
|
437
333
|
.filter(({ chartType }) => chartType === 'table')
|
|
438
334
|
.sort(sortByOrdering);
|
|
439
|
-
return (_jsxs("div", { ...styleToProps(containerStyle), children: [!hideFilters && sortedFilters.length > 0 && (_jsx("div", { style: {
|
|
335
|
+
return (_jsxs("div", { className: className, ...styleToProps(containerStyle), children: [!hideFilters && sortedFilters.length > 0 && (_jsx("div", { style: {
|
|
440
336
|
display: 'flex',
|
|
441
337
|
boxSizing: 'content-box',
|
|
442
338
|
flexDirection: 'row',
|
|
@@ -448,9 +344,7 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle =
|
|
|
448
344
|
flexDirection: 'row',
|
|
449
345
|
alignItems: 'center',
|
|
450
346
|
gap: 12,
|
|
451
|
-
}, children: sortedFilters.map((filter, index) => (_jsx(DashboardFilter, { filter: filter, onChangeFilter: updateFilter, theme: theme, SelectComponent: SelectComponent
|
|
452
|
-
? DateRangePickerComponent
|
|
453
|
-
: MemoizedDateRangePicker }, index))) }) })), Object.keys(dashboardSections)
|
|
347
|
+
}, children: sortedFilters.map((filter, index) => (_jsx(DashboardFilter, { filter: filter, onChangeFilter: updateFilter, theme: theme, SelectComponent: SelectComponent, DateRangePickerComponent: DateRangePickerComponent }, index))) }) })), Object.keys(dashboardSections)
|
|
454
348
|
.sort(function (a, b) {
|
|
455
349
|
return a.length - b.length;
|
|
456
350
|
})
|
|
@@ -464,15 +358,15 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle =
|
|
|
464
358
|
textAlign: 'left',
|
|
465
359
|
marginTop: 12,
|
|
466
360
|
}, children: section })] })), metrics(section).length > 0 && (_jsx(DashboardSectionComponent, { section: "metrics", children: metrics(section).map((item, index) => {
|
|
467
|
-
return (_jsx(DataLoader, { id: item._id, children: ({ isLoading, error }) => (_jsx(MetricComponent, {
|
|
361
|
+
return (_jsx(DataLoader, { id: item._id, children: ({ isLoading, error }) => (_jsx(MetricComponent, { error: error, isLoading: isLoading, dashboardItem: cleanDashboardItem(dashboard[item._id] ?? item, dashboardFilters), onClick: onClickDashboardItem
|
|
468
362
|
? () => handleOnClickDashboardItem(item)
|
|
469
|
-
:
|
|
470
|
-
}) })), charts(section).length > 0 && (_jsx(DashboardSectionComponent, { section: "charts", children: charts(section).map((item, index) => (_jsx(ChartComponent, {
|
|
363
|
+
: undefined }, item.name + '' + index)) }, `${item.name}${index}`));
|
|
364
|
+
}) })), charts(section).length > 0 && (_jsx(DashboardSectionComponent, { section: "charts", children: charts(section).map((item, index) => (_jsx(ChartComponent, { dashboardItem: cleanDashboardItem(dashboard[item._id] ?? item, dashboardFilters), onClick: onClickDashboardItem
|
|
471
365
|
? () => handleOnClickDashboardItem(item)
|
|
472
|
-
:
|
|
366
|
+
: undefined, children: _jsx(Chart, { containerStyle: chartContainerStyle, chartId: item._id, colors: theme.chartColors?.length
|
|
473
367
|
? theme.chartColors
|
|
474
|
-
: undefined, hideXAxis: hideXAxis, hideYAxis: hideYAxis, hideCartesianGrid: hideCartesianGrid,
|
|
368
|
+
: undefined, hideXAxis: hideXAxis, hideYAxis: hideYAxis, hideCartesianGrid: hideCartesianGrid, comparisonLineStyle: comparisonLineStyle }) }, item.name + '' + index))) })), tables(section).length > 0 && (_jsx(DashboardSectionComponent, { section: "tables", children: tables(section).map((item, index) => (_jsx(DataLoader, { id: item._id, children: ({ isLoading, error }) => (_jsx(TableComponent, { dashboardItem: cleanDashboardItem(dashboard[item._id] ?? item, dashboardFilters), isLoading: isLoading, error: error, onClick: onClickDashboardItem
|
|
475
369
|
? () => handleOnClickDashboardItem(item)
|
|
476
|
-
:
|
|
370
|
+
: undefined })) }, `${item.name}${index}`))) }))] }, section + '' + sectionIndex));
|
|
477
371
|
})] }));
|
|
478
372
|
}
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChangeEvent } from 'react';
|
|
2
|
+
export interface DateRangePickerComponentProps {
|
|
3
|
+
preset: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
dateRange: {
|
|
6
|
+
startDate: Date;
|
|
7
|
+
endDate: Date;
|
|
8
|
+
};
|
|
9
|
+
presetOptions: {
|
|
10
|
+
label: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}[];
|
|
13
|
+
onChangeDateRange: ({ startDate, endDate, }: {
|
|
14
|
+
startDate: Date;
|
|
15
|
+
endDate: Date;
|
|
16
|
+
}) => void;
|
|
17
|
+
onChangePreset: (event: ChangeEvent<HTMLSelectElement>) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The fallback date range picked used in <Dashboard/>.
|
|
21
|
+
*/
|
|
2
22
|
export declare function QuillDateRangePicker({ dateRange, onChangeDateRange, presetOptions, onChangePreset, preset, label, }: DateRangePickerComponentProps): import("react/jsx-runtime").JSX.Element;
|
|
3
23
|
//# sourceMappingURL=QuillDateRangePicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuillDateRangePicker.d.ts","sourceRoot":"","sources":["../../../src/DateRangePicker/QuillDateRangePicker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"QuillDateRangePicker.d.ts","sourceRoot":"","sources":["../../../src/DateRangePicker/QuillDateRangePicker.tsx"],"names":[],"mappings":"AAAA,OAAc,EACZ,WAAW,EAKZ,MAAM,OAAO,CAAC;AAqBf,MAAM,WAAW,6BAA6B;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,EAAE;QAAE,SAAS,EAAE,IAAI,CAAC;QAAC,OAAO,EAAE,IAAI,CAAA;KAAE,CAAC;IAC9C,aAAa,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAClD,iBAAiB,EAAE,CAAC,EAClB,SAAS,EACT,OAAO,GACR,EAAE;QACD,SAAS,EAAE,IAAI,CAAC;QAChB,OAAO,EAAE,IAAI,CAAC;KACf,KAAK,IAAI,CAAC;IACX,cAAc,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;CACjE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,MAAM,EACN,KAAK,GACN,EAAE,6BAA6B,2CA8H/B"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useContext, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { useContext, useEffect, useRef, useState, } from 'react';
|
|
3
3
|
import { startOfMonth, endOfMonth, format, eachDayOfInterval, subMonths, startOfWeek, endOfWeek, differenceInDays, startOfDay, addMonths, isBefore, isAfter, } from 'date-fns';
|
|
4
4
|
import { ThemeContext } from '../Context';
|
|
5
5
|
import { useOnClickOutside } from '../hooks';
|
|
6
6
|
import { QuillSelectComponent } from '../components/QuillSelect';
|
|
7
|
+
/**
|
|
8
|
+
* The fallback date range picked used in <Dashboard/>.
|
|
9
|
+
*/
|
|
7
10
|
export function QuillDateRangePicker({ dateRange, onChangeDateRange, presetOptions, onChangePreset, preset, label, }) {
|
|
8
11
|
const [theme] = useContext(ThemeContext);
|
|
9
12
|
const [anchorStartDate, setAnchorStartDate] = useState(getAnchorStartDate(dateRange.startDate, dateRange.endDate));
|
|
@@ -54,8 +57,8 @@ export function QuillDateRangePicker({ dateRange, onChangeDateRange, presetOptio
|
|
|
54
57
|
value: option.label,
|
|
55
58
|
})), value: localPreset.label || '', onChange: (e) => {
|
|
56
59
|
onChangePreset(e);
|
|
57
|
-
setLocalPreset({ label: e });
|
|
58
|
-
}
|
|
60
|
+
setLocalPreset({ label: e.target.value });
|
|
61
|
+
} })] }));
|
|
59
62
|
}
|
|
60
63
|
function CalendarRow({ theme, anchorStartDate, anchorEndDate, setAnchorStartDate, setAnchorEndDate, localStartDate, localEndDate, setLocalStartDate, setLocalEndDate, updateDateFilter, setLocalPreset, setShowModal, }) {
|
|
61
64
|
const modalRef = useRef(null);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { addDays, differenceInDays, endOfToday, format, isEqual, isToday, max, min, startOfDay, startOfMonth, startOfToday, startOfWeek, startOfYear, sub, } from 'date-fns';
|
|
2
|
-
import { hexToRgbaWith10PercentAlpha } from '../BarList';
|
|
2
|
+
import { hexToRgbaWith10PercentAlpha } from '../components/Chart/BarList';
|
|
3
3
|
export const getWeekdays = (locale) => {
|
|
4
4
|
const firstDayOfWeek = startOfWeek(new Date());
|
|
5
5
|
return Array.from(Array(7)).map((e, i) => format(addDays(firstDayOfWeek, i), 'EEEEEE', { locale }));
|
|
@@ -17,7 +17,51 @@ interface WithQueryEndpoint extends BaseQuillProviderProps {
|
|
|
17
17
|
queryHeaders: object;
|
|
18
18
|
withCredentials?: boolean;
|
|
19
19
|
}
|
|
20
|
-
type
|
|
20
|
+
export type IQuillProviderProps = WithOrganizationId | WithQueryEndpoint;
|
|
21
|
+
/**
|
|
22
|
+
* Props for the QuillProvider component.
|
|
23
|
+
*/
|
|
24
|
+
export type QuillProviderProps = {
|
|
25
|
+
/**
|
|
26
|
+
* Your Quill public key.
|
|
27
|
+
*/
|
|
28
|
+
publicKey: string;
|
|
29
|
+
/**
|
|
30
|
+
* The url of the query endpoint if using self-hosted.
|
|
31
|
+
*/
|
|
32
|
+
queryEndpoint: string | never;
|
|
33
|
+
/**
|
|
34
|
+
* Request headers passed to queryEndpoint, if self-hosted.
|
|
35
|
+
*/
|
|
36
|
+
queryHeaders: object | never;
|
|
37
|
+
/**
|
|
38
|
+
* The organization id of this request, if any.
|
|
39
|
+
*/
|
|
40
|
+
organizationId?: string;
|
|
41
|
+
/**
|
|
42
|
+
* The environment where this request is executed (eg. 'production')
|
|
43
|
+
*/
|
|
44
|
+
environment?: string;
|
|
45
|
+
/**
|
|
46
|
+
* The theme object used to customize all quill components.
|
|
47
|
+
*/
|
|
48
|
+
theme?: QuillTheme;
|
|
49
|
+
/**
|
|
50
|
+
* Whether to pass credentials to the custom query endpoint, if any.
|
|
51
|
+
*/
|
|
52
|
+
withCredentials?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* The children of this provider (typically, this is the rest of your app).
|
|
55
|
+
*/
|
|
56
|
+
children?: React.ReactNode;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* ## Quill Theme
|
|
60
|
+
* Customizable styles used throughout Quill.
|
|
61
|
+
*
|
|
62
|
+
* ### QuillTheme API
|
|
63
|
+
* @see https://docs.quillsql.com/components/quill-provider#quilltheme
|
|
64
|
+
*/
|
|
21
65
|
export interface QuillTheme {
|
|
22
66
|
fontFamily: string;
|
|
23
67
|
backgroundColor: string;
|
|
@@ -29,9 +73,9 @@ export interface QuillTheme {
|
|
|
29
73
|
chartTickColor: string;
|
|
30
74
|
chartColors: string[];
|
|
31
75
|
borderColor: string;
|
|
76
|
+
borderWidth: number;
|
|
32
77
|
primaryButtonColor?: string;
|
|
33
78
|
secondaryButtonColor?: string;
|
|
34
|
-
borderWidth: number;
|
|
35
79
|
buttonFontWeight?: number;
|
|
36
80
|
labelFontWeight?: number;
|
|
37
81
|
fontSize?: number;
|
|
@@ -55,6 +99,65 @@ export declare const defaultQuillTheme: {
|
|
|
55
99
|
loadingStateBackgroundColor: string;
|
|
56
100
|
hoverBackgroundColor: string;
|
|
57
101
|
};
|
|
102
|
+
/**
|
|
103
|
+
* ### Quill Provider
|
|
104
|
+
*
|
|
105
|
+
* The quill provider allows all the quill components in your app to share
|
|
106
|
+
* information which lets your dashboards render fast and update dynamically.
|
|
107
|
+
*
|
|
108
|
+
* Similar to React’s `Context.Provider`, `QuillProvider` wraps your React app
|
|
109
|
+
* and places Quill Client on the context, enabling you to access it from
|
|
110
|
+
* anywhere in your component tree. We suggest putting the QuillProvider
|
|
111
|
+
* somewhere high in your app, above any component that might need to access
|
|
112
|
+
* your quill data.
|
|
113
|
+
*
|
|
114
|
+
* ### Quickstart
|
|
115
|
+
* There are two ways to set up the QuillProvider; with an organization id using
|
|
116
|
+
* our fully-managed cloud platform, or with a query endpoint pointing to your
|
|
117
|
+
* own server running our self-hosted server SDK.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```js
|
|
121
|
+
* // Usage with organization id
|
|
122
|
+
* <QuillProvider
|
|
123
|
+
* organizationId={'acme_org'}
|
|
124
|
+
* publicKey={QUILL_API_KEY}
|
|
125
|
+
* >
|
|
126
|
+
* // rest of your app here
|
|
127
|
+
* </QuillProvider>
|
|
128
|
+
* ```
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```js
|
|
132
|
+
* // Usage with query endpoint
|
|
133
|
+
* <QuillProvider
|
|
134
|
+
* queryEndpoint="https://example.com/quill"
|
|
135
|
+
* queryHeaders={AUTH_HEADERS}
|
|
136
|
+
* publicKey={QUILL_API_KEY}
|
|
137
|
+
* >
|
|
138
|
+
* // rest of your app here
|
|
139
|
+
* </QuillProvider>
|
|
140
|
+
* ```
|
|
141
|
+
*
|
|
142
|
+
* ### Custom Themes
|
|
143
|
+
* You can also pass in a custom theme into the QuillProvider to automatically
|
|
144
|
+
* style all default quill components at the same time. The combination of
|
|
145
|
+
* passing custom themes as well as passing your existing components gets you
|
|
146
|
+
* pixel-perfect dashboards in a fraction of the time.
|
|
147
|
+
*
|
|
148
|
+
* Our guide on custom themes is coming soon.
|
|
149
|
+
*
|
|
150
|
+
* ### Endpoint Authorization
|
|
151
|
+
* When self-hosting the server SDK, you might need extra authentication measures
|
|
152
|
+
* to ensure a secure system. In addition to passing a `queryHeaders` object along
|
|
153
|
+
* with any requests to your custom endpoint, you also can pass a `withCredentials`
|
|
154
|
+
* boolean.
|
|
155
|
+
*
|
|
156
|
+
* Our guide on endpoint authorization is coming soon.
|
|
157
|
+
*
|
|
158
|
+
* ### Dashboard API
|
|
159
|
+
* @see https://docs.quillsql.com/components/quill-provider
|
|
160
|
+
*/
|
|
58
161
|
declare const QuillProvider: ({ organizationId, publicKey, queryEndpoint, queryHeaders, environment, children, theme, withCredentials, }: QuillProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
59
162
|
export default QuillProvider;
|
|
60
163
|
//# sourceMappingURL=QuillProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuillProvider.d.ts","sourceRoot":"","sources":["../../src/QuillProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"QuillProvider.d.ts","sourceRoot":"","sources":["../../src/QuillProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,sBAAsB;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,UAAU,kBAAmB,SAAQ,sBAAsB;IACzD,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,UAAU,iBAAkB,SAAQ,sBAAsB;IACxD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAGD,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,GAAG,iBAAiB,CAAC;AAEzE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,aAAa,EAAE,MAAM,GAAG,KAAK,CAAC;IAE9B;;OAEG;IACH,YAAY,EAAE,MAAM,GAAG,KAAK,CAAC;IAE7B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,KAAK,CAAC,EAAE,UAAU,CAAC;IAEnB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2BAA2B,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;CAwB7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,QAAA,MAAM,aAAa,+GAShB,kBAAkB,4CA+BpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -25,6 +25,65 @@ export const defaultQuillTheme = {
|
|
|
25
25
|
loadingStateBackgroundColor: '#F9F9FA',
|
|
26
26
|
hoverBackgroundColor: '#F4F4F5',
|
|
27
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* ### Quill Provider
|
|
30
|
+
*
|
|
31
|
+
* The quill provider allows all the quill components in your app to share
|
|
32
|
+
* information which lets your dashboards render fast and update dynamically.
|
|
33
|
+
*
|
|
34
|
+
* Similar to React’s `Context.Provider`, `QuillProvider` wraps your React app
|
|
35
|
+
* and places Quill Client on the context, enabling you to access it from
|
|
36
|
+
* anywhere in your component tree. We suggest putting the QuillProvider
|
|
37
|
+
* somewhere high in your app, above any component that might need to access
|
|
38
|
+
* your quill data.
|
|
39
|
+
*
|
|
40
|
+
* ### Quickstart
|
|
41
|
+
* There are two ways to set up the QuillProvider; with an organization id using
|
|
42
|
+
* our fully-managed cloud platform, or with a query endpoint pointing to your
|
|
43
|
+
* own server running our self-hosted server SDK.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```js
|
|
47
|
+
* // Usage with organization id
|
|
48
|
+
* <QuillProvider
|
|
49
|
+
* organizationId={'acme_org'}
|
|
50
|
+
* publicKey={QUILL_API_KEY}
|
|
51
|
+
* >
|
|
52
|
+
* // rest of your app here
|
|
53
|
+
* </QuillProvider>
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```js
|
|
58
|
+
* // Usage with query endpoint
|
|
59
|
+
* <QuillProvider
|
|
60
|
+
* queryEndpoint="https://example.com/quill"
|
|
61
|
+
* queryHeaders={AUTH_HEADERS}
|
|
62
|
+
* publicKey={QUILL_API_KEY}
|
|
63
|
+
* >
|
|
64
|
+
* // rest of your app here
|
|
65
|
+
* </QuillProvider>
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* ### Custom Themes
|
|
69
|
+
* You can also pass in a custom theme into the QuillProvider to automatically
|
|
70
|
+
* style all default quill components at the same time. The combination of
|
|
71
|
+
* passing custom themes as well as passing your existing components gets you
|
|
72
|
+
* pixel-perfect dashboards in a fraction of the time.
|
|
73
|
+
*
|
|
74
|
+
* Our guide on custom themes is coming soon.
|
|
75
|
+
*
|
|
76
|
+
* ### Endpoint Authorization
|
|
77
|
+
* When self-hosting the server SDK, you might need extra authentication measures
|
|
78
|
+
* to ensure a secure system. In addition to passing a `queryHeaders` object along
|
|
79
|
+
* with any requests to your custom endpoint, you also can pass a `withCredentials`
|
|
80
|
+
* boolean.
|
|
81
|
+
*
|
|
82
|
+
* Our guide on endpoint authorization is coming soon.
|
|
83
|
+
*
|
|
84
|
+
* ### Dashboard API
|
|
85
|
+
* @see https://docs.quillsql.com/components/quill-provider
|
|
86
|
+
*/
|
|
28
87
|
const QuillProvider = ({ organizationId, publicKey, queryEndpoint = 'https://quill-344421.uc.r.appspot.com/cloud', queryHeaders, environment, children, theme = defaultQuillTheme, withCredentials = false, }) => {
|
|
29
88
|
return (_jsxs(ContextProvider, { initialTheme: theme, publicKey: publicKey, environment: environment, customerId: organizationId, queryEndpoint: queryEndpoint, queryHeaders: queryHeaders, withCredentials: withCredentials, children: [children, _jsx("style", { children: `/* For WebKit-based browsers (Chrome, Safari, Opera) */
|
|
30
89
|
::-webkit-scrollbar {
|