@quillsql/react 2.11.16 → 2.11.17
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 +117 -42
- package/dist/cjs/Chart.d.ts.map +1 -1
- package/dist/cjs/Chart.js +44 -18
- package/dist/cjs/ChartBuilder.d.ts +194 -30
- package/dist/cjs/ChartBuilder.d.ts.map +1 -1
- package/dist/cjs/ChartBuilder.js +122 -62
- package/dist/cjs/ChartEditor.d.ts +114 -18
- 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 +46 -152
- 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 +188 -42
- package/dist/cjs/ReportBuilder.d.ts.map +1 -1
- package/dist/cjs/ReportBuilder.js +466 -394
- package/dist/cjs/SQLEditor.d.ts +158 -23
- package/dist/cjs/SQLEditor.d.ts.map +1 -1
- package/dist/cjs/SQLEditor.js +35 -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/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 +8 -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 +4 -14
- 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 +2 -1
- package/dist/cjs/components/ReportBuilder/convert.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/convert.js +40 -20
- 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 +83 -18
- package/dist/cjs/components/ReportBuilder/ui.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/ui.js +52 -100
- package/dist/cjs/components/ReportBuilder/util.d.ts +2 -1
- package/dist/cjs/components/ReportBuilder/util.d.ts.map +1 -1
- package/dist/cjs/components/ReportBuilder/util.js +16 -9
- package/dist/cjs/components/UiComponents.d.ts +86 -86
- package/dist/cjs/components/UiComponents.d.ts.map +1 -1
- package/dist/cjs/components/UiComponents.js +118 -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.map +1 -1
- package/dist/cjs/internals/ReportBuilder/PivotList.js +10 -10
- package/dist/cjs/internals/ReportBuilder/PivotModal.d.ts +29 -14
- package/dist/cjs/internals/ReportBuilder/PivotModal.d.ts.map +1 -1
- package/dist/cjs/internals/ReportBuilder/PivotModal.js +73 -49
- package/dist/cjs/utils/dataFetcher.d.ts.map +1 -1
- package/dist/cjs/utils/dataFetcher.js +2 -0
- package/dist/esm/Chart.d.ts +117 -42
- package/dist/esm/Chart.d.ts.map +1 -1
- package/dist/esm/Chart.js +45 -19
- package/dist/esm/ChartBuilder.d.ts +194 -30
- package/dist/esm/ChartBuilder.d.ts.map +1 -1
- package/dist/esm/ChartBuilder.js +122 -62
- package/dist/esm/ChartEditor.d.ts +114 -18
- 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 +49 -153
- 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 +188 -42
- package/dist/esm/ReportBuilder.d.ts.map +1 -1
- package/dist/esm/ReportBuilder.js +468 -396
- package/dist/esm/SQLEditor.d.ts +158 -23
- package/dist/esm/SQLEditor.d.ts.map +1 -1
- package/dist/esm/SQLEditor.js +35 -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/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 +8 -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 +4 -14
- 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 +2 -1
- package/dist/esm/components/ReportBuilder/convert.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/convert.js +33 -13
- 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 +83 -18
- package/dist/esm/components/ReportBuilder/ui.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/ui.js +50 -98
- package/dist/esm/components/ReportBuilder/util.d.ts +2 -1
- package/dist/esm/components/ReportBuilder/util.d.ts.map +1 -1
- package/dist/esm/components/ReportBuilder/util.js +14 -8
- package/dist/esm/components/UiComponents.d.ts +86 -86
- package/dist/esm/components/UiComponents.d.ts.map +1 -1
- package/dist/esm/components/UiComponents.js +111 -101
- 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.map +1 -1
- package/dist/esm/internals/ReportBuilder/PivotList.js +10 -10
- package/dist/esm/internals/ReportBuilder/PivotModal.d.ts +29 -14
- package/dist/esm/internals/ReportBuilder/PivotModal.d.ts.map +1 -1
- package/dist/esm/internals/ReportBuilder/PivotModal.js +73 -49
- package/dist/esm/utils/dataFetcher.d.ts.map +1 -1
- package/dist/esm/utils/dataFetcher.js +2 -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,8 @@ 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 {
|
|
19
|
-
import
|
|
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", {});
|
|
18
|
+
import { QuillDropdownComponent, QuillEmptyDashboardComponent, } from './components/UiComponents';
|
|
19
|
+
import { DashboardFilter } from './components/Dashboard/DashboardFilter';
|
|
149
20
|
const defaultChartContainerStyles = {
|
|
150
21
|
display: 'flex',
|
|
151
22
|
width: '100%',
|
|
@@ -153,10 +24,37 @@ const defaultChartContainerStyles = {
|
|
|
153
24
|
height: 300,
|
|
154
25
|
};
|
|
155
26
|
/**
|
|
156
|
-
* Quill Dashboard
|
|
27
|
+
* ### Quill Dashboard
|
|
28
|
+
*
|
|
29
|
+
* Dynamically displays a filterable grid of charts, metrics, and tables with
|
|
30
|
+
* live data from your database. Once implemented, Quill lets you perform
|
|
31
|
+
* zero-downtime, zero-code updates to your dashboard views on an org-level as
|
|
32
|
+
* well as company-wide.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```js
|
|
36
|
+
* // Usage without custom components
|
|
37
|
+
* <Dashboard />
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```js
|
|
42
|
+
* // You can also pass your own components
|
|
43
|
+
* <Dashboard
|
|
44
|
+
* name="saved_reports"
|
|
45
|
+
* SelectComponent={MySelect}
|
|
46
|
+
* onClickDashboardItem={(item) => navigate(`/detail/${item.id}`)}
|
|
47
|
+
* MetricComponent={MyMetric}
|
|
48
|
+
* ChartComponent={MyChart}
|
|
49
|
+
* TableComponent={MyTable}
|
|
50
|
+
* containerStyle={{ backgroundColor: 'white', padding: '10px' }}
|
|
51
|
+
* />
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* ### API Reference
|
|
55
|
+
* @see https://docs.quillsql.com/components/dashboard
|
|
157
56
|
*/
|
|
158
|
-
export default function Dashboard({ name,
|
|
159
|
-
const { dateFilter } = useDateFilter();
|
|
57
|
+
export default function Dashboard({ name, SelectComponent = QuillDropdownComponent, 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
58
|
const { dispatch } = useContext(DashboardContext);
|
|
161
59
|
const { isLoading: isDataLoading, data, reload, } = useDashboard(name);
|
|
162
60
|
const [dashboardSections, setDashboardSections] = useState(null);
|
|
@@ -417,16 +315,16 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle =
|
|
|
417
315
|
return _jsx(EmptyDashboardComponent, {});
|
|
418
316
|
const sortByOrdering = (a, b) => {
|
|
419
317
|
if (a.order === undefined && b.order === undefined)
|
|
420
|
-
return 0;
|
|
318
|
+
return 0;
|
|
421
319
|
if (a.order === undefined)
|
|
422
|
-
return 1;
|
|
320
|
+
return 1;
|
|
423
321
|
if (b.order === undefined)
|
|
424
|
-
return -1;
|
|
425
|
-
return a.order - b.order;
|
|
322
|
+
return -1;
|
|
323
|
+
return a.order - b.order;
|
|
426
324
|
};
|
|
427
325
|
const sortedFilters = Object.values(dashboardFilters)
|
|
428
326
|
.sort((filter) => (filter.filterType === 'date_range' ? -1 : 1))
|
|
429
|
-
.filter((f) => !
|
|
327
|
+
.filter((f) => !hideDateRangeFilter || f.filterType !== 'date_range');
|
|
430
328
|
const metrics = (section) => dashboardSections[section]
|
|
431
329
|
.filter(({ chartType }) => chartType === 'metric')
|
|
432
330
|
.sort(sortByOrdering);
|
|
@@ -436,7 +334,7 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle =
|
|
|
436
334
|
const tables = (section) => dashboardSections[section]
|
|
437
335
|
.filter(({ chartType }) => chartType === 'table')
|
|
438
336
|
.sort(sortByOrdering);
|
|
439
|
-
return (_jsxs("div", { ...styleToProps(containerStyle), children: [!hideFilters && sortedFilters.length > 0 && (_jsx("div", { style: {
|
|
337
|
+
return (_jsxs("div", { className: className, ...styleToProps(containerStyle), children: [!hideFilters && sortedFilters.length > 0 && (_jsx("div", { style: {
|
|
440
338
|
display: 'flex',
|
|
441
339
|
boxSizing: 'content-box',
|
|
442
340
|
flexDirection: 'row',
|
|
@@ -448,9 +346,7 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle =
|
|
|
448
346
|
flexDirection: 'row',
|
|
449
347
|
alignItems: 'center',
|
|
450
348
|
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)
|
|
349
|
+
}, children: sortedFilters.map((filter, index) => (_jsx(DashboardFilter, { filter: filter, onChangeFilter: updateFilter, theme: theme, SelectComponent: SelectComponent, DateRangePickerComponent: DateRangePickerComponent }, index))) }) })), Object.keys(dashboardSections)
|
|
454
350
|
.sort(function (a, b) {
|
|
455
351
|
return a.length - b.length;
|
|
456
352
|
})
|
|
@@ -464,15 +360,15 @@ export default function Dashboard({ name, containerStyle, chartContainerStyle =
|
|
|
464
360
|
textAlign: 'left',
|
|
465
361
|
marginTop: 12,
|
|
466
362
|
}, 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, {
|
|
363
|
+
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
364
|
? () => handleOnClickDashboardItem(item)
|
|
469
|
-
:
|
|
470
|
-
}) })), charts(section).length > 0 && (_jsx(DashboardSectionComponent, { section: "charts", children: charts(section).map((item, index) => (_jsx(ChartComponent, {
|
|
365
|
+
: undefined }, item.name + '' + index)) }, `${item.name}${index}`));
|
|
366
|
+
}) })), 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
367
|
? () => handleOnClickDashboardItem(item)
|
|
472
|
-
:
|
|
368
|
+
: undefined, children: _jsx(Chart, { containerStyle: chartContainerStyle, chartId: item._id, colors: theme.chartColors?.length
|
|
473
369
|
? theme.chartColors
|
|
474
|
-
: undefined, hideXAxis: hideXAxis, hideYAxis: hideYAxis, hideCartesianGrid: hideCartesianGrid,
|
|
370
|
+
: 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
371
|
? () => handleOnClickDashboardItem(item)
|
|
476
|
-
:
|
|
372
|
+
: undefined })) }, `${item.name}${index}`))) }))] }, section + '' + sectionIndex));
|
|
477
373
|
})] }));
|
|
478
374
|
}
|
|
@@ -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 {
|