@quillsql/react 2.10.4 → 2.10.6
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 +2 -2
- package/dist/cjs/Chart.d.ts.map +1 -1
- package/dist/cjs/Chart.js +22 -30
- package/dist/cjs/ChartBuilder.d.ts.map +1 -1
- package/dist/cjs/ChartBuilder.js +18 -9
- package/dist/cjs/ChartEditor.js +1 -1
- package/dist/cjs/Context.d.ts +22 -39
- package/dist/cjs/Context.d.ts.map +1 -1
- package/dist/cjs/Context.js +11 -9
- package/dist/cjs/Dashboard.d.ts +116 -26
- package/dist/cjs/Dashboard.d.ts.map +1 -1
- package/dist/cjs/Dashboard.js +92 -402
- package/dist/cjs/DateRangePicker/dateRangePickerUtils.d.ts +18 -1
- package/dist/cjs/DateRangePicker/dateRangePickerUtils.d.ts.map +1 -1
- package/dist/cjs/DateRangePicker/dateRangePickerUtils.js +9 -9
- package/dist/cjs/SQLEditor.d.ts.map +1 -1
- package/dist/cjs/SQLEditor.js +2 -4
- package/dist/cjs/Table.d.ts.map +1 -1
- package/dist/cjs/Table.js +12 -2
- package/dist/cjs/components/Chart/BarChart.d.ts +2 -2
- package/dist/cjs/components/Chart/BarChart.js +2 -2
- package/dist/cjs/components/Chart/ChartError.d.ts +3 -0
- package/dist/cjs/components/Chart/ChartError.d.ts.map +1 -0
- package/dist/cjs/components/Chart/ChartError.js +29 -0
- package/dist/cjs/components/Chart/ChartSkeleton.d.ts +3 -0
- package/dist/cjs/components/Chart/ChartSkeleton.d.ts.map +1 -0
- package/dist/cjs/components/Chart/ChartSkeleton.js +20 -0
- package/dist/cjs/components/Chart/ChartTooltipFrame.d.ts.map +1 -1
- package/dist/cjs/components/Chart/ChartTooltipFrame.js +1 -0
- package/dist/cjs/components/Chart/LineChart.d.ts +2 -2
- package/dist/cjs/components/Chart/LineChart.js +2 -2
- package/dist/cjs/components/Dashboard/DashboardGroup.d.ts +3 -0
- package/dist/cjs/components/Dashboard/DashboardGroup.d.ts.map +1 -0
- package/dist/cjs/components/Dashboard/DashboardGroup.js +16 -0
- package/dist/cjs/components/Dashboard/DashboardItem.d.ts +3 -0
- package/dist/cjs/components/Dashboard/DashboardItem.d.ts.map +1 -0
- package/dist/cjs/components/Dashboard/DashboardItem.js +64 -0
- package/dist/cjs/components/Dashboard/DashboardSection.d.ts +3 -0
- package/dist/cjs/components/Dashboard/DashboardSection.d.ts.map +1 -0
- package/dist/cjs/components/Dashboard/DashboardSection.js +7 -0
- package/dist/cjs/hooks/useQuill.d.ts.map +1 -1
- package/dist/cjs/hooks/useQuill.js +15 -9
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/internals/ReportBuilder/PivotModal.d.ts +1 -1
- package/dist/cjs/internals/ReportBuilder/PivotModal.js +1 -1
- package/dist/cjs/utils/axisFormatter.d.ts.map +1 -1
- package/dist/cjs/utils/axisFormatter.js +7 -18
- package/dist/cjs/utils/dashboard.d.ts +12 -0
- package/dist/cjs/utils/dashboard.d.ts.map +1 -0
- package/dist/cjs/utils/dashboard.js +150 -0
- package/dist/cjs/utils/styles.d.ts +17 -0
- package/dist/cjs/utils/styles.d.ts.map +1 -0
- package/dist/cjs/utils/styles.js +20 -0
- package/dist/cjs/utils/valueFormatter.d.ts +1 -1
- package/dist/cjs/utils/valueFormatter.d.ts.map +1 -1
- package/dist/cjs/utils/valueFormatter.js +7 -18
- package/dist/cjs/utils/valueFormatterCSV.d.ts.map +1 -1
- package/dist/cjs/utils/valueFormatterCSV.js +7 -15
- package/dist/esm/Chart.d.ts +2 -2
- package/dist/esm/Chart.d.ts.map +1 -1
- package/dist/esm/Chart.js +23 -31
- package/dist/esm/ChartBuilder.d.ts.map +1 -1
- package/dist/esm/ChartBuilder.js +18 -9
- package/dist/esm/ChartEditor.js +1 -1
- package/dist/esm/Context.d.ts +22 -39
- package/dist/esm/Context.d.ts.map +1 -1
- package/dist/esm/Context.js +11 -9
- package/dist/esm/Dashboard.d.ts +116 -26
- package/dist/esm/Dashboard.d.ts.map +1 -1
- package/dist/esm/Dashboard.js +89 -376
- package/dist/esm/DateRangePicker/dateRangePickerUtils.d.ts +18 -1
- package/dist/esm/DateRangePicker/dateRangePickerUtils.d.ts.map +1 -1
- package/dist/esm/DateRangePicker/dateRangePickerUtils.js +9 -9
- package/dist/esm/SQLEditor.d.ts.map +1 -1
- package/dist/esm/SQLEditor.js +2 -4
- package/dist/esm/Table.d.ts.map +1 -1
- package/dist/esm/Table.js +12 -2
- package/dist/esm/components/Chart/BarChart.d.ts +2 -2
- package/dist/esm/components/Chart/BarChart.js +2 -2
- package/dist/esm/components/Chart/ChartError.d.ts +3 -0
- package/dist/esm/components/Chart/ChartError.d.ts.map +1 -0
- package/dist/esm/components/Chart/ChartError.js +26 -0
- package/dist/esm/components/Chart/ChartSkeleton.d.ts +3 -0
- package/dist/esm/components/Chart/ChartSkeleton.d.ts.map +1 -0
- package/dist/esm/components/Chart/ChartSkeleton.js +17 -0
- package/dist/esm/components/Chart/ChartTooltipFrame.d.ts.map +1 -1
- package/dist/esm/components/Chart/ChartTooltipFrame.js +1 -0
- package/dist/esm/components/Chart/LineChart.d.ts +2 -2
- package/dist/esm/components/Chart/LineChart.js +2 -2
- package/dist/esm/components/Dashboard/DashboardGroup.d.ts +3 -0
- package/dist/esm/components/Dashboard/DashboardGroup.d.ts.map +1 -0
- package/dist/esm/components/Dashboard/DashboardGroup.js +13 -0
- package/dist/esm/components/Dashboard/DashboardItem.d.ts +3 -0
- package/dist/esm/components/Dashboard/DashboardItem.d.ts.map +1 -0
- package/dist/esm/components/Dashboard/DashboardItem.js +61 -0
- package/dist/esm/components/Dashboard/DashboardSection.d.ts +3 -0
- package/dist/esm/components/Dashboard/DashboardSection.d.ts.map +1 -0
- package/dist/esm/components/Dashboard/DashboardSection.js +4 -0
- package/dist/esm/hooks/useQuill.d.ts.map +1 -1
- package/dist/esm/hooks/useQuill.js +16 -10
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/internals/ReportBuilder/PivotModal.d.ts +1 -1
- package/dist/esm/internals/ReportBuilder/PivotModal.js +1 -1
- package/dist/esm/utils/axisFormatter.d.ts.map +1 -1
- package/dist/esm/utils/axisFormatter.js +7 -18
- package/dist/esm/utils/dashboard.d.ts +12 -0
- package/dist/esm/utils/dashboard.d.ts.map +1 -0
- package/dist/esm/utils/dashboard.js +146 -0
- package/dist/esm/utils/styles.d.ts +17 -0
- package/dist/esm/utils/styles.d.ts.map +1 -0
- package/dist/esm/utils/styles.js +16 -0
- package/dist/esm/utils/valueFormatter.d.ts +1 -1
- package/dist/esm/utils/valueFormatter.d.ts.map +1 -1
- package/dist/esm/utils/valueFormatter.js +7 -18
- package/dist/esm/utils/valueFormatterCSV.d.ts.map +1 -1
- package/dist/esm/utils/valueFormatterCSV.js +7 -15
- package/package.json +2 -5
package/dist/cjs/Chart.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ interface BaseChartProps {
|
|
|
8
8
|
isAnimationActive?: boolean;
|
|
9
9
|
hideXAxis?: boolean;
|
|
10
10
|
hideYAxis?: boolean;
|
|
11
|
-
|
|
11
|
+
hideCartesianGrid?: boolean;
|
|
12
12
|
}
|
|
13
13
|
interface WithChartId extends BaseChartProps {
|
|
14
14
|
chartId: string;
|
|
@@ -35,6 +35,6 @@ interface WithConfig extends BaseChartProps {
|
|
|
35
35
|
config: DashboardItem | any;
|
|
36
36
|
}
|
|
37
37
|
type ChartProps = WithChartId | WithConfig;
|
|
38
|
-
declare const Chart: ({ chartId, config, colors, containerStyle, query, SelectComponent, dateRangeFilterDisabled, isAnimationActive, hideXAxis, hideYAxis,
|
|
38
|
+
declare const Chart: ({ chartId, config, colors, containerStyle, query, SelectComponent, dateRangeFilterDisabled, isAnimationActive, hideXAxis, hideYAxis, hideCartesianGrid, }: ChartProps) => import("react/jsx-runtime").JSX.Element;
|
|
39
39
|
export default Chart;
|
|
40
40
|
//# sourceMappingURL=Chart.d.ts.map
|
package/dist/cjs/Chart.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../src/Chart.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../src/Chart.tsx"],"names":[],"mappings":";AA2BA,UAAU,cAAc;IACtB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,UAAU,WAAY,SAAQ,cAAc;IAC1C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,WAAW,GACnB,cAAc,GACd,mBAAmB,GACnB,oBAAoB,GACpB,eAAe,GACf,cAAc,GACd,UAAU,GACV,aAAa,GACb,eAAe,GACf,oBAAoB,GACpB,UAAU,GACV,SAAS,GACT,QAAQ,CAAC;AAEb,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,KAAK,EAAE,GAAG,CAAC;CACZ;AAED,UAAU,UAAW,SAAQ,cAAc;IACzC,MAAM,EAAE,aAAa,GAAG,GAAG,CAAC;CAC7B;AAED,KAAK,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC;AAyE3C,QAAA,MAAM,KAAK,8JAYR,UAAU,4CAkCZ,CAAC;AAodF,eAAe,KAAK,CAAC"}
|
package/dist/cjs/Chart.js
CHANGED
|
@@ -19,6 +19,8 @@ const valueFormatter_1 = require("./utils/valueFormatter");
|
|
|
19
19
|
const LineChart_1 = __importDefault(require("./components/Chart/LineChart"));
|
|
20
20
|
const BarChart_1 = __importDefault(require("./components/Chart/BarChart"));
|
|
21
21
|
const merge_1 = require("./utils/merge");
|
|
22
|
+
const ChartSkeleton_1 = __importDefault(require("./components/Chart/ChartSkeleton"));
|
|
23
|
+
const ChartError_1 = __importDefault(require("./components/Chart/ChartError"));
|
|
22
24
|
// @ts-ignore
|
|
23
25
|
function sumByKey(arr, key) {
|
|
24
26
|
// @ts-ignore
|
|
@@ -72,13 +74,7 @@ function didFiltersChange(dashboardItem, filters) {
|
|
|
72
74
|
}
|
|
73
75
|
return !isEquivalent(dashboardItem.filtersApplied, filters);
|
|
74
76
|
}
|
|
75
|
-
|
|
76
|
-
return s.split('').reduce(function (a, b) {
|
|
77
|
-
a = (a << 5) - a + b.charCodeAt(0);
|
|
78
|
-
return a & a;
|
|
79
|
-
}, 0);
|
|
80
|
-
}
|
|
81
|
-
const Chart = ({ chartId, config, colors, containerStyle, query, SelectComponent, dateRangeFilterDisabled = false, isAnimationActive = true, hideXAxis = false, hideYAxis = false, hideCartesionGrid = false, }) => {
|
|
77
|
+
const Chart = ({ chartId, config, colors, containerStyle, query, SelectComponent, dateRangeFilterDisabled = false, isAnimationActive = true, hideXAxis = false, hideYAxis = false, hideCartesianGrid = false, }) => {
|
|
82
78
|
const { dispatch, dashboard } = (0, react_1.useContext)(Context_1.DashboardContext);
|
|
83
79
|
const { dashboardFilters } = (0, react_1.useContext)(Context_1.DashboardFiltersContext);
|
|
84
80
|
// eslint-disable-next-line no-unused-vars
|
|
@@ -91,9 +87,9 @@ const Chart = ({ chartId, config, colors, containerStyle, query, SelectComponent
|
|
|
91
87
|
? theme.chartColors
|
|
92
88
|
: ['#4E80EE', '#E14F62', '#55B5A6', '#E9A23B', '#6466E9', '#55B685'];
|
|
93
89
|
}, [colors]);
|
|
94
|
-
return ((0, jsx_runtime_1.jsx)(ChartUpdater, { config: config, dispatch: dispatch, dashboard: dashboard, chartId: chartId, containerStyle: containerStyle, colors: chartColors, client: client, theme: theme, dashboardFilters: dashboardFilters, query: query, isAnimationActive: isAnimationActive, hideXAxis: hideXAxis, hideYAxis: hideYAxis,
|
|
90
|
+
return ((0, jsx_runtime_1.jsx)(ChartUpdater, { config: config, dispatch: dispatch, dashboard: dashboard, chartId: chartId, containerStyle: containerStyle, colors: chartColors, client: client, theme: theme, dashboardFilters: dashboardFilters, query: query, isAnimationActive: isAnimationActive, hideXAxis: hideXAxis, hideYAxis: hideYAxis, hideCartesianGrid: hideCartesianGrid, dateRangeFilterDisabled: dateRangeFilterDisabled }));
|
|
95
91
|
};
|
|
96
|
-
const ChartUpdater = ({ colors, chartId, config, containerStyle, dashboard, dispatch, client, theme, dashboardFilters, isAnimationActive, hideXAxis, hideYAxis,
|
|
92
|
+
const ChartUpdater = ({ colors, chartId, config, containerStyle, dashboard, dispatch, client, theme, dashboardFilters, isAnimationActive, hideXAxis, hideYAxis, hideCartesianGrid, dateRangeFilterDisabled, }) => {
|
|
97
93
|
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
98
94
|
const [isComparison, setIsComparison] = (0, react_1.useState)(false);
|
|
99
95
|
const [bucketData, setBucketData] = (0, react_1.useState)(null);
|
|
@@ -105,13 +101,14 @@ const ChartUpdater = ({ colors, chartId, config, containerStyle, dashboard, disp
|
|
|
105
101
|
}
|
|
106
102
|
try {
|
|
107
103
|
setLoading(true);
|
|
108
|
-
|
|
104
|
+
// Remove extra fields on each filter so we don't confuse the backend.
|
|
105
|
+
const allowDateRange = !dateRangeFilterDisabled;
|
|
106
|
+
const minimalFilters = Object.values(dashboardFilters).length
|
|
109
107
|
? Object.values(dashboardFilters)
|
|
110
|
-
.filter((f) =>
|
|
108
|
+
.filter((f) => allowDateRange || f.filterType !== 'date_range')
|
|
111
109
|
.map((filter) => {
|
|
112
110
|
const newFilter = { ...filter };
|
|
113
111
|
if (newFilter.filterType === 'date_range') {
|
|
114
|
-
// filter.field = chartDateFilter?.field;
|
|
115
112
|
delete newFilter['field'];
|
|
116
113
|
delete newFilter['options'];
|
|
117
114
|
delete newFilter['selectedValue'];
|
|
@@ -125,16 +122,15 @@ const ChartUpdater = ({ colors, chartId, config, containerStyle, dashboard, disp
|
|
|
125
122
|
...(client.customerId && { orgId: client.customerId }),
|
|
126
123
|
clientId: client.publicKey,
|
|
127
124
|
task: 'item',
|
|
128
|
-
filters:
|
|
125
|
+
filters: minimalFilters,
|
|
129
126
|
},
|
|
130
127
|
};
|
|
131
128
|
const cloudBody = {
|
|
132
129
|
id: chartId,
|
|
133
|
-
filters:
|
|
130
|
+
filters: minimalFilters,
|
|
134
131
|
};
|
|
135
132
|
const resp = await (0, dataFetcher_1.getData)(client, 'itempost', 'omit', hostedBody, cloudBody);
|
|
136
|
-
if (resp) {
|
|
137
|
-
setLoading(false);
|
|
133
|
+
if (resp && resp.name !== 'error') {
|
|
138
134
|
setIsComparison(!!resp.compareRows?.length);
|
|
139
135
|
if (resp.compareRows) {
|
|
140
136
|
(0, merge_1.mergeComparisonRange)(resp);
|
|
@@ -148,6 +144,7 @@ const ChartUpdater = ({ colors, chartId, config, containerStyle, dashboard, disp
|
|
|
148
144
|
},
|
|
149
145
|
});
|
|
150
146
|
}
|
|
147
|
+
setLoading(false);
|
|
151
148
|
}
|
|
152
149
|
catch (e) {
|
|
153
150
|
console.log('Error fetching chart: ', e);
|
|
@@ -227,17 +224,12 @@ const ChartUpdater = ({ colors, chartId, config, containerStyle, dashboard, disp
|
|
|
227
224
|
: null;
|
|
228
225
|
}, [pivotTable]);
|
|
229
226
|
if (!config && (!dashboard[chartId] || loading)) {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
width: '100%',
|
|
237
|
-
boxSizing: 'content-box',
|
|
238
|
-
borderRadius: 8,
|
|
239
|
-
overflow: 'hidden',
|
|
240
|
-
}, children: (0, jsx_runtime_1.jsxs)("svg", { width: "100%", height: "100%", xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", children: [(0, jsx_runtime_1.jsx)("rect", { width: "100%", height: "100%", fill: theme?.loadingStateBackgroundColor || '#F9F9FA' }), (0, jsx_runtime_1.jsx)("defs", { fill: theme?.loadingStateBackgroundColor || '#F9F9FA', children: (0, jsx_runtime_1.jsxs)("linearGradient", { id: "skeletonGradient", x1: "0%", y1: "0%", x2: "10%", y2: "0%", gradientUnits: "userSpaceOnUse", children: [(0, jsx_runtime_1.jsx)("stop", { offset: "0%", stopColor: "rgba(255,255,255,0)" }), (0, jsx_runtime_1.jsx)("stop", { offset: "50%", stopColor: "#FEFEFE" }), (0, jsx_runtime_1.jsx)("stop", { offset: "100%", stopColor: "rgba(255,255,255,0)" }), (0, jsx_runtime_1.jsx)("animate", { attributeName: "x1", from: "-100%", to: "100%", dur: "2s", repeatCount: "indefinite" }), (0, jsx_runtime_1.jsx)("animate", { attributeName: "x2", from: "-50%", to: "150%", dur: "2s", repeatCount: "indefinite" })] }) }), (0, jsx_runtime_1.jsx)("rect", { width: "50%", height: "100%", fill: "url(#skeletonGradient)", children: (0, jsx_runtime_1.jsx)("animate", { attributeName: "x", from: "-100%", to: "100%", dur: "2s", repeatCount: "indefinite" }) })] }) }) }));
|
|
227
|
+
if (loading) {
|
|
228
|
+
return (0, jsx_runtime_1.jsx)(ChartSkeleton_1.default, { containerStyle: containerStyle });
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
return (0, jsx_runtime_1.jsx)(ChartError_1.default, { containerStyle: containerStyle });
|
|
232
|
+
}
|
|
241
233
|
}
|
|
242
234
|
// TODO: Figure out if we can use ?? to coalesce these into the variable.
|
|
243
235
|
const chartTypes = [config?.chartType, dashboard[chartId]?.chartType];
|
|
@@ -265,7 +257,7 @@ const ChartUpdater = ({ colors, chartId, config, containerStyle, dashboard, disp
|
|
|
265
257
|
}
|
|
266
258
|
if (chartTypes.includes('table')) {
|
|
267
259
|
const data = dashboard[chartId] ? dashboard[chartId] : config;
|
|
268
|
-
return ((0, jsx_runtime_1.jsx)(Table_1.SpecialTable, { rows: pivotTable?.rows ?? data.rows ?? [], columns: pivotTable?.columns ?? data.
|
|
260
|
+
return ((0, jsx_runtime_1.jsx)(Table_1.SpecialTable, { rows: pivotTable?.rows ?? data.rows ?? [], columns: pivotTable?.columns ?? data.columns ?? data.yAxisFields, height: '400px', containerStyle: {
|
|
269
261
|
...containerStyle,
|
|
270
262
|
}, theme: theme, isTableChart: true, name: data.name }));
|
|
271
263
|
}
|
|
@@ -335,7 +327,7 @@ const ChartUpdater = ({ colors, chartId, config, containerStyle, dashboard, disp
|
|
|
335
327
|
? config.xAxisFormat
|
|
336
328
|
: bucketData
|
|
337
329
|
? bucketData.xAxisFormat
|
|
338
|
-
: dashboard[chartId].xAxisFormat, containerStyle: containerStyle, comparison: dateFilter?.comparison, isAnimationActive: isAnimationActive, hideXAxis: hideXAxis, hideYAxis: hideYAxis,
|
|
330
|
+
: dashboard[chartId].xAxisFormat, containerStyle: containerStyle, comparison: dateFilter?.comparison, isAnimationActive: isAnimationActive, hideXAxis: hideXAxis, hideYAxis: hideYAxis, hideCartesianGrid: hideCartesianGrid }));
|
|
339
331
|
}
|
|
340
332
|
if (chartTypes.includes('metric')) {
|
|
341
333
|
const data = dashboard[chartId] ? dashboard[chartId] : config;
|
|
@@ -378,6 +370,6 @@ const ChartUpdater = ({ colors, chartId, config, containerStyle, dashboard, disp
|
|
|
378
370
|
? config.xAxisFormat
|
|
379
371
|
: bucketData
|
|
380
372
|
? bucketData.xAxisFormat
|
|
381
|
-
: dashboard[chartId].xAxisFormat, containerStyle: containerStyle, theme: theme, comparison: dateFilter?.comparison, isAnimationActive: isAnimationActive, hideXAxis: hideXAxis, hideYAxis: hideYAxis,
|
|
373
|
+
: dashboard[chartId].xAxisFormat, containerStyle: containerStyle, theme: theme, comparison: dateFilter?.comparison, isAnimationActive: isAnimationActive, hideXAxis: hideXAxis, hideYAxis: hideYAxis, hideCartesianGrid: hideCartesianGrid }));
|
|
382
374
|
};
|
|
383
375
|
exports.default = Chart;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartBuilder.d.ts","sourceRoot":"","sources":["../../src/ChartBuilder.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAWhF,OAAO,EACL,KAAK,EAIN,MAAM,sCAAsC,CAAC;AAG9C,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACX,UAAU,EACV,SAAS,EACT,iBAAiB,EAUjB,qBAAqB,EAEtB,MAAM,2BAA2B,CAAC;AAgBnC,wBAAgB,oBAAoB,CAAC,GAAG,KAAA,OAavC;
|
|
1
|
+
{"version":3,"file":"ChartBuilder.d.ts","sourceRoot":"","sources":["../../src/ChartBuilder.tsx"],"names":[],"mappings":"AACA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAWhF,OAAO,EACL,KAAK,EAIN,MAAM,sCAAsC,CAAC;AAG9C,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACX,UAAU,EACV,SAAS,EACT,iBAAiB,EAUjB,qBAAqB,EAEtB,MAAM,2BAA2B,CAAC;AAgBnC,wBAAgB,oBAAoB,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CAAC,EAAE,OAAO,CAAC;IACjC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,wBAAwB,CAAC,EAAE,MAAM,IAAI,CAAC;IACtC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,SAAS,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IAC9B,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,iBAAiB,CAAC,EAAE,KAAK,EAAE,CAAC;IAC5B,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AACD,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CA4B5D"}
|
package/dist/cjs/ChartBuilder.js
CHANGED
|
@@ -37,13 +37,9 @@ const POSTGRES_DATE_TYPES = [
|
|
|
37
37
|
'time',
|
|
38
38
|
'timetz',
|
|
39
39
|
];
|
|
40
|
-
|
|
41
|
-
// const parser = new Parser();
|
|
40
|
+
function getTablesHelper(ast, allTables) {
|
|
42
41
|
const tables = [];
|
|
43
42
|
const withAliases = [];
|
|
44
|
-
const resp = await (0, dataFetcher_1.getDataFromCloud)(client, `astify`, { query: sqlQuery });
|
|
45
|
-
let ast = resp.ast;
|
|
46
|
-
ast = ast.length ? ast[0] : ast;
|
|
47
43
|
if (ast.with && ast.with.length) {
|
|
48
44
|
for (let i = 0; i < ast.with.length; i++) {
|
|
49
45
|
withAliases.push(ast.with[i].name.value);
|
|
@@ -57,10 +53,19 @@ async function getReferencedTables(client, sqlQuery, dbTables) {
|
|
|
57
53
|
}
|
|
58
54
|
}
|
|
59
55
|
}
|
|
60
|
-
|
|
56
|
+
if (ast.from && ast.from.length) {
|
|
57
|
+
for (let i = 0; i < ast.from.length; i++) {
|
|
58
|
+
if (ast.from[i].expr && ast.from[i].expr.ast) {
|
|
59
|
+
const recursiveAST = ast.from[i].expr.ast;
|
|
60
|
+
const recursiveTables = getTablesHelper(recursiveAST, allTables);
|
|
61
|
+
tables.push(...recursiveTables.map((t) => t.name));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const astFrom = ast?.from?.filter((t) => t.table).map((elem) => elem.table) || [];
|
|
61
66
|
const astSelect = ast?.select?.from?.map((elem) => elem.table) || [];
|
|
62
67
|
const tablesInQuery = [...tables, ...astFrom, ...astSelect].filter((elem) => !withAliases.includes(elem));
|
|
63
|
-
return
|
|
68
|
+
return allTables
|
|
64
69
|
.filter((table) => tablesInQuery.includes(table.displayName))
|
|
65
70
|
.map((table) => {
|
|
66
71
|
return {
|
|
@@ -70,6 +75,10 @@ async function getReferencedTables(client, sqlQuery, dbTables) {
|
|
|
70
75
|
})
|
|
71
76
|
.filter((table) => table.columns.length > 0);
|
|
72
77
|
}
|
|
78
|
+
async function getReferencedTables(client, sqlQuery, dbTables) {
|
|
79
|
+
const resp = await (0, dataFetcher_1.getDataFromCloud)(client, `astify`, { query: sqlQuery });
|
|
80
|
+
return getTablesHelper(resp.ast.length ? resp.ast[0] : resp.ast, dbTables);
|
|
81
|
+
}
|
|
73
82
|
const AGGREGATION_TYPES = [
|
|
74
83
|
{ label: 'sum', value: 'sum' },
|
|
75
84
|
{ label: 'count', value: 'count' },
|
|
@@ -228,7 +237,7 @@ function ChartBuilderForm({ TextInput = UiComponents_1.MemoizedTextInput, Select
|
|
|
228
237
|
};
|
|
229
238
|
const firstNumberColumn = columns?.find((col) => exports.numberFormatOptions.includes(col.format));
|
|
230
239
|
const formEmptyState = {
|
|
231
|
-
name: '',
|
|
240
|
+
name: 'My Chart',
|
|
232
241
|
dashboardName: dashboardOptions?.[0]?.label,
|
|
233
242
|
columns: columns.map((col) => {
|
|
234
243
|
return { ...col, label: snakeCaseToTitleCase(col.label) };
|
|
@@ -466,7 +475,7 @@ function ChartBuilderForm({ TextInput = UiComponents_1.MemoizedTextInput, Select
|
|
|
466
475
|
}
|
|
467
476
|
: { clientId: publicKey }).toString();
|
|
468
477
|
const resp = await (0, dataFetcher_1.getData)(client, `dashedit2?${searchParams}`, 'same-origin', hostedBody, cloudBody);
|
|
469
|
-
if (resp) {
|
|
478
|
+
if (resp && resp.name !== "error") {
|
|
470
479
|
if (resp.compareRows) {
|
|
471
480
|
(0, merge_1.mergeComparisonRange)(resp);
|
|
472
481
|
}
|
package/dist/cjs/ChartEditor.js
CHANGED
|
@@ -47,7 +47,7 @@ function ChartEditor({ isOpen, chartId, isEditMode, admin = false, destinationDa
|
|
|
47
47
|
filters: [],
|
|
48
48
|
};
|
|
49
49
|
const resp = await (0, dataFetcher_1.getData)(client, 'itempost', 'omit', hostedBody, cloudBody);
|
|
50
|
-
if (resp) {
|
|
50
|
+
if (resp && resp.name !== "error") {
|
|
51
51
|
if (resp.compareRows) {
|
|
52
52
|
(0, merge_1.mergeComparisonRange)(resp);
|
|
53
53
|
}
|
package/dist/cjs/Context.d.ts
CHANGED
|
@@ -1,34 +1,29 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const
|
|
18
|
-
export declare const
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const
|
|
21
|
-
export declare const
|
|
22
|
-
export declare const ChartDateFiltersContext: React.Context<{}[]>;
|
|
2
|
+
export declare const DateFilterContext: React.Context<any>;
|
|
3
|
+
export declare const SchemaContext: React.Context<any>;
|
|
4
|
+
export declare const ColumnsContext: React.Context<any>;
|
|
5
|
+
export declare const RowsContext: React.Context<any>;
|
|
6
|
+
export declare const SelectedSidebarIndexContext: React.Context<any>;
|
|
7
|
+
export declare const HistoryContext: React.Context<any>;
|
|
8
|
+
export declare const SavedQueriesContext: React.Context<any>;
|
|
9
|
+
export declare const SaveQueryModalStatusContext: React.Context<any>;
|
|
10
|
+
export declare const EditorQueryContext: React.Context<any>;
|
|
11
|
+
export declare const ThemeContext: React.Context<any>;
|
|
12
|
+
export declare const ClientContext: React.Context<any>;
|
|
13
|
+
export declare const CreateVisualizationModalVisibleContext: React.Context<any>;
|
|
14
|
+
export declare const ActiveVisualizationContext: React.Context<any>;
|
|
15
|
+
export declare const QueryResultsLoadingContext: React.Context<any>;
|
|
16
|
+
export declare const EditVisualizationModalVisibleContext: React.Context<any>;
|
|
17
|
+
export declare const ReportBuilderQueryContext: React.Context<any>;
|
|
18
|
+
export declare const SavedReportsQueryContext: React.Context<any>;
|
|
19
|
+
export declare const DashboardContext: React.Context<any>;
|
|
20
|
+
export declare const DashboardFiltersContext: React.Context<any>;
|
|
21
|
+
export declare const ChartDateFiltersContext: React.Context<any>;
|
|
23
22
|
export declare const useChartDateFilters: () => {
|
|
24
23
|
getChartDateFilterById: (id: string) => any;
|
|
25
24
|
setChartDateFilter: (id: string, dateFilter: any) => void;
|
|
26
25
|
};
|
|
27
|
-
|
|
28
|
-
value: string;
|
|
29
|
-
text: string;
|
|
30
|
-
} | null;
|
|
31
|
-
export declare const ComparisonRangeContext: React.Context<ComparisonRangeContextType>;
|
|
26
|
+
export declare const ComparisonRangeContext: React.Context<any>;
|
|
32
27
|
export declare const useDateFilter: () => {
|
|
33
28
|
dateFilter: any;
|
|
34
29
|
setDateFilter: any;
|
|
@@ -37,17 +32,5 @@ export declare const useComparisonRange: () => {
|
|
|
37
32
|
comparisonRange: any;
|
|
38
33
|
setComparisonRange: any;
|
|
39
34
|
};
|
|
40
|
-
export declare const ContextProvider: ({ children, initialTheme, publicKey, environment, authToken, customerId, userId, queryEndpoint, queryHeaders, withCredentials, }:
|
|
41
|
-
children: any;
|
|
42
|
-
initialTheme: any;
|
|
43
|
-
publicKey: any;
|
|
44
|
-
environment: any;
|
|
45
|
-
authToken: any;
|
|
46
|
-
customerId: any;
|
|
47
|
-
userId: any;
|
|
48
|
-
queryEndpoint: any;
|
|
49
|
-
queryHeaders: any;
|
|
50
|
-
withCredentials: any;
|
|
51
|
-
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
52
|
-
export {};
|
|
35
|
+
export declare const ContextProvider: ({ children, initialTheme, publicKey, environment, authToken, customerId, userId, queryEndpoint, queryHeaders, withCredentials, }: any) => import("react/jsx-runtime").JSX.Element | null;
|
|
53
36
|
//# sourceMappingURL=Context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/Context.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/Context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAKf,eAAO,MAAM,iBAAiB,oBAAwC,CAAC;AACvE,eAAO,MAAM,aAAa,oBAAwC,CAAC;AACnE,eAAO,MAAM,cAAc,oBAA0C,CAAC;AACtE,eAAO,MAAM,WAAW,oBAA0C,CAAC;AACnE,eAAO,MAAM,2BAA2B,oBAAuC,CAAC;AAChF,eAAO,MAAM,cAAc,oBAAwC,CAAC;AACpE,eAAO,MAAM,mBAAmB,oBAAwC,CAAC;AACzE,eAAO,MAAM,2BAA2B,oBAGtC,CAAC;AACH,eAAO,MAAM,kBAAkB,oBAAwC,CAAC;AACxE,eAAO,MAAM,YAAY,oBAA0C,CAAC;AACpE,eAAO,MAAM,aAAa,oBAA0C,CAAC;AACrE,eAAO,MAAM,sCAAsC,oBAGjD,CAAC;AACH,eAAO,MAAM,0BAA0B,oBAGrC,CAAC;AACH,eAAO,MAAM,0BAA0B,oBAGrC,CAAC;AACH,eAAO,MAAM,oCAAoC,oBAG/C,CAAC;AACH,eAAO,MAAM,yBAAyB,oBAAwC,CAAC;AAC/E,eAAO,MAAM,wBAAwB,oBAAwC,CAAC;AAC9E,eAAO,MAAM,gBAAgB,oBAAwC,CAAC;AACtE,eAAO,MAAM,uBAAuB,oBAAwC,CAAC;AAC7E,eAAO,MAAM,uBAAuB,oBAAwC,CAAC;AAE7E,eAAO,MAAM,mBAAmB;iCAKM,MAAM;6BACV,MAAM,cAAc,GAAG;CAQxD,CAAC;AAEF,eAAO,MAAM,sBAAsB,oBAA2B,CAAC;AAE/D,eAAO,MAAM,aAAa;;;CAGzB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;CAK9B,CAAC;AAuDF,eAAO,MAAM,eAAe,qIAWzB,GAAG,mDAqML,CAAC"}
|
package/dist/cjs/Context.js
CHANGED
|
@@ -2,13 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ContextProvider = exports.useComparisonRange = exports.useDateFilter = exports.ComparisonRangeContext = exports.useChartDateFilters = exports.ChartDateFiltersContext = exports.DashboardFiltersContext = exports.DashboardContext = exports.SavedReportsQueryContext = exports.ReportBuilderQueryContext = exports.EditVisualizationModalVisibleContext = exports.QueryResultsLoadingContext = exports.ActiveVisualizationContext = exports.CreateVisualizationModalVisibleContext = exports.ClientContext = exports.ThemeContext = exports.EditorQueryContext = exports.SaveQueryModalStatusContext = exports.SavedQueriesContext = exports.HistoryContext = exports.SelectedSidebarIndexContext = exports.RowsContext = exports.ColumnsContext = exports.SchemaContext = exports.DateFilterContext = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
// @ts-nocheck
|
|
6
|
-
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
7
5
|
const react_1 = require("react");
|
|
8
|
-
const QuillProvider_1 = require("./QuillProvider");
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
10
6
|
const dummySetter = () => { };
|
|
11
|
-
exports.DateFilterContext = (0, react_1.createContext)([
|
|
7
|
+
exports.DateFilterContext = (0, react_1.createContext)([[], dummySetter]);
|
|
12
8
|
exports.SchemaContext = (0, react_1.createContext)([[], dummySetter]);
|
|
13
9
|
exports.ColumnsContext = (0, react_1.createContext)([null, dummySetter]);
|
|
14
10
|
exports.RowsContext = (0, react_1.createContext)([null, dummySetter]);
|
|
@@ -20,14 +16,20 @@ exports.SaveQueryModalStatusContext = (0, react_1.createContext)([
|
|
|
20
16
|
dummySetter,
|
|
21
17
|
]);
|
|
22
18
|
exports.EditorQueryContext = (0, react_1.createContext)(['', dummySetter]);
|
|
23
|
-
exports.ThemeContext = (0, react_1.createContext)([
|
|
19
|
+
exports.ThemeContext = (0, react_1.createContext)([null, dummySetter]);
|
|
24
20
|
exports.ClientContext = (0, react_1.createContext)([null, dummySetter]);
|
|
25
21
|
exports.CreateVisualizationModalVisibleContext = (0, react_1.createContext)([
|
|
26
22
|
false,
|
|
27
23
|
dummySetter,
|
|
28
24
|
]);
|
|
29
|
-
exports.ActiveVisualizationContext = (0, react_1.createContext)([
|
|
30
|
-
|
|
25
|
+
exports.ActiveVisualizationContext = (0, react_1.createContext)([
|
|
26
|
+
null,
|
|
27
|
+
dummySetter,
|
|
28
|
+
]);
|
|
29
|
+
exports.QueryResultsLoadingContext = (0, react_1.createContext)([
|
|
30
|
+
false,
|
|
31
|
+
dummySetter,
|
|
32
|
+
]);
|
|
31
33
|
exports.EditVisualizationModalVisibleContext = (0, react_1.createContext)([
|
|
32
34
|
false,
|
|
33
35
|
dummySetter,
|
|
@@ -49,7 +51,7 @@ const useChartDateFilters = () => {
|
|
|
49
51
|
};
|
|
50
52
|
};
|
|
51
53
|
exports.useChartDateFilters = useChartDateFilters;
|
|
52
|
-
exports.ComparisonRangeContext = (0, react_1.createContext)(
|
|
54
|
+
exports.ComparisonRangeContext = (0, react_1.createContext)(null);
|
|
53
55
|
const useDateFilter = () => {
|
|
54
56
|
const { dateFilter, setDateFilter } = (0, react_1.useContext)(exports.DateFilterContext);
|
|
55
57
|
return { dateFilter, setDateFilter };
|
package/dist/cjs/Dashboard.d.ts
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DateRangePickerOption } from './DateRangePicker/DateRangePicker';
|
|
3
|
-
interface
|
|
3
|
+
interface QuillOption {
|
|
4
4
|
value: string;
|
|
5
5
|
label: string;
|
|
6
6
|
}
|
|
7
7
|
interface SelectComponentProps {
|
|
8
8
|
label: string;
|
|
9
|
-
onChange: (
|
|
9
|
+
onChange: (_: string) => void;
|
|
10
10
|
value: string;
|
|
11
|
-
options:
|
|
11
|
+
options: QuillOption[];
|
|
12
12
|
}
|
|
13
|
-
type DateRange = [];
|
|
13
|
+
type DateRange = Date[];
|
|
14
14
|
interface DateRangePickerComponentProps {
|
|
15
15
|
dateRange: DateRange;
|
|
16
16
|
label: string;
|
|
17
|
-
onChangeDateRange: (
|
|
17
|
+
onChangeDateRange: (_: any) => void;
|
|
18
18
|
selectedPreset: string;
|
|
19
19
|
presetOptions: DateRangePickerOption[];
|
|
20
|
-
onChangePreset: (
|
|
20
|
+
onChangePreset: (_: any) => void;
|
|
21
21
|
preset: string;
|
|
22
22
|
}
|
|
23
23
|
interface FilterButtonComponentProps {
|
|
@@ -30,30 +30,123 @@ interface ModalComponentProps {
|
|
|
30
30
|
onClose: () => void;
|
|
31
31
|
title: string;
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
export type AxisFormat = 'percent' | 'dollar_amount' | 'dollar_cents' | 'whole_number' | 'one_decimal_place' | 'two_decimal_places' | 'string' | 'yyyy' | 'MMM_yyyy' | 'MMM_dd_yyyy' | 'hh_ap_pm' | 'MMM_dd-MMM_dd' | 'MMM_dd_hh:mm_ap_pm' | 'wo, yyyy';
|
|
34
|
+
/**
|
|
35
|
+
* A dashboard item represents an individual item on a dashboard.
|
|
36
|
+
*
|
|
37
|
+
* Dashboard items can be charts, metric tiles, tables, etc. and can be styled
|
|
38
|
+
* however you'd like.
|
|
39
|
+
*/
|
|
40
|
+
export interface DashboardItemData {
|
|
41
|
+
/** The dashboard item's unique id. */
|
|
42
|
+
id: string;
|
|
43
|
+
/** The name of the dashboard item. */
|
|
34
44
|
name: string;
|
|
45
|
+
/** The name of the dashboard this item belongs to. */
|
|
46
|
+
dashboardName: string;
|
|
47
|
+
/** The rows of data returned from this item's query. */
|
|
48
|
+
rows: {
|
|
49
|
+
[key: string]: string;
|
|
50
|
+
}[];
|
|
51
|
+
/** The columns data returned from this item's query. */
|
|
52
|
+
columns: any[];
|
|
53
|
+
/** The type of this chart. */
|
|
54
|
+
chartType: string;
|
|
55
|
+
/** The table and field this chart uses for date filtering */
|
|
56
|
+
dateField: {
|
|
57
|
+
table: string;
|
|
58
|
+
field: string;
|
|
59
|
+
} | null;
|
|
60
|
+
/** The pivot used in this query */
|
|
61
|
+
pivot: {
|
|
62
|
+
title: string;
|
|
63
|
+
aggregationType: 'sum' | 'average' | 'count';
|
|
64
|
+
rowField: string;
|
|
65
|
+
rowFieldType: string;
|
|
66
|
+
columnField: string | undefined;
|
|
67
|
+
columnFieldType: string | undefined;
|
|
68
|
+
valueField: string;
|
|
69
|
+
} | null;
|
|
70
|
+
/** The formatted primary range aggregation value, if any. */
|
|
71
|
+
primaryAggregation?: string;
|
|
72
|
+
/** The formatted comparison range aggregation value, if any. */
|
|
73
|
+
comparisonAggregation?: string;
|
|
74
|
+
/** The percent change in the aggragations, if any. */
|
|
75
|
+
aggregationPercentChange?: string;
|
|
76
|
+
/** The label of the xAxis. */
|
|
77
|
+
xAxisLabel: string;
|
|
78
|
+
/** The field to use for this item's xAxis. */
|
|
79
|
+
xAxisField: string;
|
|
80
|
+
/** The format for this item's xAxis. */
|
|
81
|
+
xAxisFormat: AxisFormat;
|
|
82
|
+
/**
|
|
83
|
+
* A list of metadata about the yAxes of this item.
|
|
84
|
+
*/
|
|
85
|
+
yAxisFields: {
|
|
86
|
+
/** The field for this yAxis. */
|
|
87
|
+
field: string;
|
|
88
|
+
/** The label to use for this yAxis. */
|
|
89
|
+
label: string;
|
|
90
|
+
/** The format of the data in this yAxis. */
|
|
91
|
+
format: AxisFormat;
|
|
92
|
+
}[];
|
|
93
|
+
/**
|
|
94
|
+
* The relative ordering of this dashboard item in relation to its sibling
|
|
95
|
+
* dashboard items. Ordering starts at 1 and counts up.
|
|
96
|
+
*
|
|
97
|
+
* Also note that dashboard items in the same section are first grouped by
|
|
98
|
+
* `chartType` and then each group is sorted by `order`. Currently, the first
|
|
99
|
+
* group is the `metric` items and the last group is the `table` items with
|
|
100
|
+
* the rest of the items in between.
|
|
101
|
+
*/
|
|
102
|
+
order: number;
|
|
103
|
+
/**
|
|
104
|
+
* The rows of data returned from this item's query over the comparison date
|
|
105
|
+
* range as opposed to the primary date range.
|
|
106
|
+
*/
|
|
107
|
+
compareRows: {
|
|
108
|
+
[key: string]: string;
|
|
109
|
+
}[];
|
|
110
|
+
/** A map of filters that have been applied to this query. */
|
|
111
|
+
filtersApplied: {
|
|
112
|
+
[key: string]: any;
|
|
113
|
+
};
|
|
35
114
|
}
|
|
36
|
-
interface DashboardItemProps {
|
|
115
|
+
export interface DashboardItemProps {
|
|
116
|
+
dashboardItem: DashboardItemData | undefined;
|
|
117
|
+
onClickDashboardItem?: any;
|
|
37
118
|
children: any;
|
|
38
|
-
dashboardItem: DashboardItemData;
|
|
39
119
|
}
|
|
40
|
-
interface DashboardProps {
|
|
120
|
+
export interface DashboardProps {
|
|
121
|
+
/** The name of the dashboard. Must be unique. */
|
|
41
122
|
name?: string;
|
|
42
|
-
|
|
123
|
+
/**
|
|
124
|
+
* The styles for the dashboard container.
|
|
125
|
+
*
|
|
126
|
+
* This container is the parent of all the filtering buttons as well as any
|
|
127
|
+
* dashboard sections. The passed style can either be an object of React-style
|
|
128
|
+
* CSSProperties or a TailwindCSS-style classname string.
|
|
129
|
+
*/
|
|
130
|
+
containerStyle?: React.CSSProperties | string;
|
|
43
131
|
metricContainerStyle?: React.CSSProperties;
|
|
44
132
|
chartContainerStyle?: React.CSSProperties;
|
|
45
133
|
maxColumnWidth?: number;
|
|
46
134
|
rowHeight?: number;
|
|
47
|
-
onClickDashboardItem?: (
|
|
135
|
+
onClickDashboardItem?: (_: any) => void;
|
|
48
136
|
hideFilters?: boolean;
|
|
49
137
|
dateRangeFilterDisabled?: boolean;
|
|
50
138
|
EmptyDashboardComponent?: () => JSX.Element;
|
|
51
|
-
|
|
52
|
-
DashboardItemComponent?: (
|
|
53
|
-
DateRangePickerComponent?: (
|
|
54
|
-
FilterButtonComponent?: (
|
|
55
|
-
FilterModalComponent?: (
|
|
56
|
-
|
|
139
|
+
SelectComponent?: (_: SelectComponentProps) => JSX.Element;
|
|
140
|
+
DashboardItemComponent?: (_: DashboardItemProps) => JSX.Element;
|
|
141
|
+
DateRangePickerComponent?: (_: DateRangePickerComponentProps) => JSX.Element;
|
|
142
|
+
FilterButtonComponent?: (_: FilterButtonComponentProps) => JSX.Element;
|
|
143
|
+
FilterModalComponent?: (_: ModalComponentProps) => JSX.Element;
|
|
144
|
+
DashboardSectionComponent?: (_: any) => JSX.Element;
|
|
145
|
+
DashboardGroupComponent?: (_: any) => JSX.Element;
|
|
146
|
+
onChangeLoading?: (_: boolean) => void;
|
|
147
|
+
hideXAxis?: boolean;
|
|
148
|
+
hideYAxis?: boolean;
|
|
149
|
+
hideCartesianGrid?: boolean;
|
|
57
150
|
}
|
|
58
151
|
interface comparisonOption {
|
|
59
152
|
value: string;
|
|
@@ -61,14 +154,11 @@ interface comparisonOption {
|
|
|
61
154
|
}
|
|
62
155
|
export declare const COMPARISON_OPTIONS: comparisonOption[];
|
|
63
156
|
export declare const PRIMARY_OPTIONS: any[];
|
|
64
|
-
export declare function DashboardFilter({ filter, onChangeFilter, SelectComponent, DateRangePickerComponent, theme, }:
|
|
65
|
-
filter: any;
|
|
66
|
-
onChangeFilter: any;
|
|
67
|
-
SelectComponent: any;
|
|
68
|
-
DateRangePickerComponent: any;
|
|
69
|
-
theme: any;
|
|
70
|
-
}): import("react/jsx-runtime").JSX.Element | null;
|
|
157
|
+
export declare function DashboardFilter({ filter, onChangeFilter, SelectComponent, DateRangePickerComponent, theme, }: any): import("react/jsx-runtime").JSX.Element | null;
|
|
71
158
|
export declare const QuillDateRangePicker: ({ label, dateRange, onChangeDateRange, presetOptions, preset, onChangePreset, }: DateRangePickerComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
72
|
-
|
|
159
|
+
/**
|
|
160
|
+
* Quill Dashboard.
|
|
161
|
+
*/
|
|
162
|
+
export default function Dashboard({ name, containerStyle, chartContainerStyle, metricContainerStyle, maxColumnWidth, rowHeight, onClickDashboardItem, hideFilters, dateRangeFilterDisabled, SelectComponent, EmptyDashboardComponent, DateRangePickerComponent, FilterButtonComponent, FilterModalComponent, onChangeLoading, DashboardItemComponent, DashboardSectionComponent, DashboardGroupComponent, hideXAxis, hideYAxis, hideCartesianGrid, }: DashboardProps): import("react/jsx-runtime").JSX.Element | null;
|
|
73
163
|
export {};
|
|
74
164
|
//# sourceMappingURL=Dashboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dashboard.d.ts","sourceRoot":"","sources":["../../src/Dashboard.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Dashboard.d.ts","sourceRoot":"","sources":["../../src/Dashboard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AA+Cf,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAU1E,UAAU,WAAW;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAA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