@quillsql/react 2.10.5 → 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 +11 -16
- 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 -27
- package/dist/cjs/Dashboard.d.ts.map +1 -1
- package/dist/cjs/Dashboard.js +85 -412
- 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 +8 -8
- package/dist/cjs/Table.d.ts.map +1 -1
- package/dist/cjs/Table.js +11 -1
- package/dist/cjs/components/Chart/BarChart.d.ts +2 -2
- package/dist/cjs/components/Chart/BarChart.js +2 -2
- 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/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/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/esm/Chart.d.ts +2 -2
- package/dist/esm/Chart.d.ts.map +1 -1
- package/dist/esm/Chart.js +11 -16
- 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 -27
- package/dist/esm/Dashboard.d.ts.map +1 -1
- package/dist/esm/Dashboard.js +81 -385
- 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 +8 -8
- package/dist/esm/Table.d.ts.map +1 -1
- package/dist/esm/Table.js +11 -1
- package/dist/esm/components/Chart/BarChart.d.ts +2 -2
- package/dist/esm/components/Chart/BarChart.js +2 -2
- 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/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/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/package.json +2 -5
|
@@ -58,14 +58,14 @@ export const PRIMARY_RANGE = {
|
|
|
58
58
|
* Maps between the keys of primary range and the short code.
|
|
59
59
|
*/
|
|
60
60
|
export const PRIMARY_CODES = {
|
|
61
|
-
THIS_WEEK:
|
|
62
|
-
THIS_MONTH:
|
|
63
|
-
THIS_YEAR:
|
|
64
|
-
LAST_7_DAYS:
|
|
65
|
-
LAST_30_DAYS:
|
|
66
|
-
LAST_90_DAYS:
|
|
67
|
-
LAST_6_MONTHS:
|
|
68
|
-
ALL_TIME:
|
|
61
|
+
THIS_WEEK: 'wk',
|
|
62
|
+
THIS_MONTH: 'm',
|
|
63
|
+
THIS_YEAR: 'y',
|
|
64
|
+
LAST_7_DAYS: 'w',
|
|
65
|
+
LAST_30_DAYS: 't',
|
|
66
|
+
LAST_90_DAYS: '90d',
|
|
67
|
+
LAST_6_MONTHS: '6m',
|
|
68
|
+
ALL_TIME: 'at',
|
|
69
69
|
};
|
|
70
70
|
/**
|
|
71
71
|
* A helpful map between comparison range keys and a function that takes the
|
package/dist/esm/Table.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/Table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAcxE,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,iBAAiB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,cAAc;IACtB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC;CACtC;AAED,QAAA,MAAM,KAAK,sGAQR,iBAAiB,GAAG,cAAc,4CAqEpC,CAAC;AAEF,UAAU,yBAAyB;IACjC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;
|
|
1
|
+
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/Table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAcxE,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,iBAAiB;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,cAAc;IACtB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC;CACtC;AAED,QAAA,MAAM,KAAK,sGAQR,iBAAiB,GAAG,cAAc,4CAqEpC,CAAC;AAEF,UAAU,yBAAyB;IACjC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAkCD,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,IAAI,EACJ,MAAM,EACN,cAAc,EACd,OAAO,EACP,gBAAgB,EAChB,KAAK,EACL,qBAA4B,EAC5B,WAAW,EACX,0BAA0B,EAC1B,6BAA6B,EAC7B,YAAoB,EACpB,IAAI,GACL,EAAE;IACD,OAAO,EAAE,GAAG,EAAE,CAAC;IACf,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC;IACrC,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0BAA0B,CAAC,EAAE,CAC3B,KAAK,EAAE,yBAAyB,KAC7B,GAAG,CAAC,OAAO,CAAC;IACjB,6BAA6B,CAAC,EAAE,CAC9B,KAAK,EAAE,yBAAyB,KAC7B,GAAG,CAAC,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,kDAomBA;AA2UD,eAAe,KAAK,CAAC"}
|
package/dist/esm/Table.js
CHANGED
|
@@ -47,6 +47,16 @@ const Table = ({ chartId, columns, rows, containerStyle, csvFilename, showDownlo
|
|
|
47
47
|
const compareValues = (a, b, column) => {
|
|
48
48
|
const valueA = a[column];
|
|
49
49
|
const valueB = b[column];
|
|
50
|
+
// Null checks
|
|
51
|
+
if (valueA === null && valueB === null) {
|
|
52
|
+
return 0; // Both values are null, consider them equal
|
|
53
|
+
}
|
|
54
|
+
else if (valueA === null) {
|
|
55
|
+
return -1; // ValueA is null, consider it smaller
|
|
56
|
+
}
|
|
57
|
+
else if (valueB === null) {
|
|
58
|
+
return 1; // ValueB is null, consider it smaller
|
|
59
|
+
}
|
|
50
60
|
// For numbers
|
|
51
61
|
if (!isNaN(valueA) && !isNaN(valueB)) {
|
|
52
62
|
return valueA - valueB;
|
|
@@ -444,7 +454,7 @@ const ChartUpdater = ({ chartId, containerStyle, dashboard, dispatch, client, da
|
|
|
444
454
|
filters: [...Object.values(dashboardFilters)],
|
|
445
455
|
};
|
|
446
456
|
const resp = await getData(client, 'itempost', 'omit', hostedBody, cloudBody);
|
|
447
|
-
if (resp && resp.name !==
|
|
457
|
+
if (resp && resp.name !== 'error') {
|
|
448
458
|
if (resp.compareRows) {
|
|
449
459
|
mergeComparisonRange(resp);
|
|
450
460
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export default function BarChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxisFormat, theme, comparison, isStacked, isAnimationActive, hideXAxis, hideYAxis,
|
|
2
|
+
export default function BarChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxisFormat, theme, comparison, isStacked, isAnimationActive, hideXAxis, hideYAxis, hideCartesianGrid, }: {
|
|
3
3
|
colors: string[];
|
|
4
4
|
yAxisFields: any[];
|
|
5
5
|
data: any[];
|
|
@@ -13,6 +13,6 @@ export default function BarChart({ colors, yAxisFields, data, containerStyle, xA
|
|
|
13
13
|
isAnimationActive: boolean;
|
|
14
14
|
hideXAxis: boolean;
|
|
15
15
|
hideYAxis: boolean;
|
|
16
|
-
|
|
16
|
+
hideCartesianGrid: boolean;
|
|
17
17
|
}): import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
//# sourceMappingURL=BarChart.d.ts.map
|
|
@@ -6,7 +6,7 @@ import { axisFormatter } from '../../utils/axisFormatter';
|
|
|
6
6
|
import { selectColor } from '../../utils/color';
|
|
7
7
|
import ChartTooltip from '../../components/Chart/ChartTooltip';
|
|
8
8
|
import getDomain from '../../utils/getDomain';
|
|
9
|
-
export default function BarChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxisFormat, theme, comparison, isStacked, isAnimationActive = true, hideXAxis = false, hideYAxis = false,
|
|
9
|
+
export default function BarChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxisFormat, theme, comparison, isStacked, isAnimationActive = true, hideXAxis = false, hideYAxis = false, hideCartesianGrid = false, }) {
|
|
10
10
|
if (!data || data.length === 0) {
|
|
11
11
|
return (_jsx("div", { style: {
|
|
12
12
|
display: 'flex',
|
|
@@ -22,7 +22,7 @@ export default function BarChart({ colors, yAxisFields, data, containerStyle, xA
|
|
|
22
22
|
return (_jsx("div", { style: {
|
|
23
23
|
...containerStyle,
|
|
24
24
|
boxSizing: 'content-box',
|
|
25
|
-
}, children: _jsx(ResponsiveContainer, { width: "100%", height: '100%', children: _jsxs(ReChartsBarChart, { data: data, layout: 'horizontal', children: [!
|
|
25
|
+
}, children: _jsx(ResponsiveContainer, { width: "100%", height: '100%', children: _jsxs(ReChartsBarChart, { data: data, layout: 'horizontal', children: [!hideCartesianGrid && (_jsx(CartesianGrid, { horizontal: true, vertical: false, stroke: "#e5e7eb" })), _jsx(YAxis, { width: 44, hide: hideYAxis, axisLine: false, tickLine: false, type: "number", domain: getDomain(data, yAxisFields), tick: { transform: 'translate(-3, 0)' }, style: {
|
|
26
26
|
fontSize: '12px',
|
|
27
27
|
fontFamily: theme.chartLabelFontFamily,
|
|
28
28
|
}, tickFormatter: (tick) => axisFormatter({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartTooltipFrame.d.ts","sourceRoot":"","sources":["../../../../src/components/Chart/ChartTooltipFrame.tsx"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC;CACZ,
|
|
1
|
+
{"version":3,"file":"ChartTooltipFrame.d.ts","sourceRoot":"","sources":["../../../../src/components/Chart/ChartTooltipFrame.tsx"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,QAAQ,EACR,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC;CACZ,2CAkBA"}
|
|
@@ -7,6 +7,7 @@ export default function ChartTooltipFrame({ children, theme, }) {
|
|
|
7
7
|
borderWidth: 1,
|
|
8
8
|
background: theme?.backgroundColor || '#ffffff',
|
|
9
9
|
borderRadius: '6px',
|
|
10
|
+
zIndex: 40,
|
|
10
11
|
boxShadow: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
|
|
11
12
|
}, children: children }));
|
|
12
13
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export default function LineChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxisFormat, theme, comparison, isAnimationActive, hideXAxis, hideYAxis,
|
|
2
|
+
export default function LineChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxisFormat, theme, comparison, isAnimationActive, hideXAxis, hideYAxis, hideCartesianGrid, }: {
|
|
3
3
|
colors: string[];
|
|
4
4
|
yAxisFields: any[];
|
|
5
5
|
data: any[];
|
|
@@ -11,6 +11,6 @@ export default function LineChart({ colors, yAxisFields, data, containerStyle, x
|
|
|
11
11
|
isAnimationActive: boolean;
|
|
12
12
|
hideXAxis: boolean;
|
|
13
13
|
hideYAxis: boolean;
|
|
14
|
-
|
|
14
|
+
hideCartesianGrid: boolean;
|
|
15
15
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
16
16
|
//# sourceMappingURL=LineChart.d.ts.map
|
|
@@ -6,7 +6,7 @@ import { axisFormatter } from '../../utils/axisFormatter';
|
|
|
6
6
|
import { selectColor } from '../../utils/color';
|
|
7
7
|
import ChartTooltip from '../../components/Chart/ChartTooltip';
|
|
8
8
|
import getDomain from '../../utils/getDomain';
|
|
9
|
-
export default function LineChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxisFormat, theme, comparison, isAnimationActive = true, hideXAxis = false, hideYAxis = false,
|
|
9
|
+
export default function LineChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxisFormat, theme, comparison, isAnimationActive = true, hideXAxis = false, hideYAxis = false, hideCartesianGrid = false, }) {
|
|
10
10
|
if (!yAxisFields || !yAxisFields.length) {
|
|
11
11
|
return null;
|
|
12
12
|
}
|
|
@@ -22,7 +22,7 @@ export default function LineChart({ colors, yAxisFields, data, containerStyle, x
|
|
|
22
22
|
color: theme.secondaryTextColor,
|
|
23
23
|
}, children: "No results found for specified time period." }));
|
|
24
24
|
}
|
|
25
|
-
return (_jsx("div", { style: { ...containerStyle
|
|
25
|
+
return (_jsx("div", { style: { ...containerStyle }, children: _jsx(ResponsiveContainer, { width: "100%", height: '100%', children: _jsxs(ReChartsAreaChart, { data: data, children: [!hideCartesianGrid && (_jsx(CartesianGrid, { horizontal: true, vertical: false, stroke: "#e5e7eb" })), _jsx(XAxis, { dataKey: xAxisField, hide: hideXAxis, tick: { transform: 'translate(0, 6)' }, style: {
|
|
26
26
|
fontSize: '12px',
|
|
27
27
|
fontFamily: theme?.chartLabelFontFamily ||
|
|
28
28
|
theme?.fontFamily ||
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardGroup.d.ts","sourceRoot":"","sources":["../../../../src/components/Dashboard/DashboardGroup.tsx"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,GAAG,GAAG,GAAG,CAAC,OAAO,CAiBrE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export default function DashboardGroup({ children }) {
|
|
3
|
+
return (_jsx("div", { style: {
|
|
4
|
+
boxSizing: 'content-box',
|
|
5
|
+
width: `100%`,
|
|
6
|
+
listStyleType: 'none',
|
|
7
|
+
marginBottom: 50,
|
|
8
|
+
display: 'grid',
|
|
9
|
+
gridGap: 25,
|
|
10
|
+
gridTemplateColumns: `repeat(auto-fill,minmax(400px, 1fr))`,
|
|
11
|
+
gridTemplateRows: `repeat(${170}px)`,
|
|
12
|
+
}, children: children }));
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardItem.d.ts","sourceRoot":"","sources":["../../../../src/components/Dashboard/DashboardItem.tsx"],"names":[],"mappings":";AAGA,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,aAAa,EACb,oBAA+B,EAC/B,QAAQ,GACT,EAAE,GAAG,GAAG,GAAG,CAAC,OAAO,CAkGnB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useContext } from 'react';
|
|
3
|
+
import { ThemeContext } from '../../Context';
|
|
4
|
+
export default function DashboardItem({ dashboardItem, onClickDashboardItem = () => { }, children, }) {
|
|
5
|
+
const [theme] = useContext(ThemeContext);
|
|
6
|
+
return (_jsx("div", { onClick: () => onClickDashboardItem(dashboardItem), style: {
|
|
7
|
+
height: '100%',
|
|
8
|
+
cursor: 'pointer',
|
|
9
|
+
boxSizing: 'content-box',
|
|
10
|
+
paddingRight: 25,
|
|
11
|
+
minHeight: 400,
|
|
12
|
+
borderRadius: 8,
|
|
13
|
+
paddingTop: 20,
|
|
14
|
+
}, children: _jsx("div", { style: {
|
|
15
|
+
width: '100%',
|
|
16
|
+
height: '100%',
|
|
17
|
+
boxSizing: 'content-box',
|
|
18
|
+
}, children: _jsx("div", { style: {
|
|
19
|
+
width: '100%',
|
|
20
|
+
height: '100%',
|
|
21
|
+
boxSizing: 'content-box',
|
|
22
|
+
}, children: _jsxs("div", { style: {
|
|
23
|
+
display: 'flex',
|
|
24
|
+
flexDirection: 'column',
|
|
25
|
+
justifyContent: 'space-between',
|
|
26
|
+
height: '100%',
|
|
27
|
+
boxSizing: 'content-box',
|
|
28
|
+
}, children: [_jsxs("div", { style: {
|
|
29
|
+
display: 'flex',
|
|
30
|
+
flexDirection: 'row',
|
|
31
|
+
justifyContent: 'space-between',
|
|
32
|
+
boxSizing: 'content-box',
|
|
33
|
+
}, children: [_jsx("div", { style: {
|
|
34
|
+
fontFamily: theme.fontFamily,
|
|
35
|
+
color: theme.primaryTextColor,
|
|
36
|
+
boxSizing: 'content-box',
|
|
37
|
+
fontSize: 18,
|
|
38
|
+
fontWeight: '500',
|
|
39
|
+
textOverflow: 'ellipsis',
|
|
40
|
+
// marginLeft: 25,
|
|
41
|
+
padding: 0,
|
|
42
|
+
whiteSpace: 'nowrap',
|
|
43
|
+
display: 'block',
|
|
44
|
+
maxWidth: '100%',
|
|
45
|
+
overflow: 'hidden',
|
|
46
|
+
}, children: dashboardItem?.name }), onClickDashboardItem ? (_jsx("div", { style: {
|
|
47
|
+
fontFamily: theme.fontFamily,
|
|
48
|
+
color: theme.primaryTextColor,
|
|
49
|
+
boxSizing: 'content-box',
|
|
50
|
+
fontWeight: '500',
|
|
51
|
+
fontSize: 14,
|
|
52
|
+
minWidth: 14 * 7,
|
|
53
|
+
display: 'flex',
|
|
54
|
+
alignItems: 'center',
|
|
55
|
+
justifyContent: 'flex-end',
|
|
56
|
+
}, children: 'view report →' })) : null] }), _jsx("div", { style: {
|
|
57
|
+
padding: 0,
|
|
58
|
+
height: '100%',
|
|
59
|
+
boxSizing: 'content-box',
|
|
60
|
+
}, children: children })] }) }) }) }, dashboardItem?.name));
|
|
61
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DashboardSection.d.ts","sourceRoot":"","sources":["../../../../src/components/Dashboard/DashboardSection.tsx"],"names":[],"mappings":";AAAA,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE,GAAG,GAAG,GAAG,CAAC,OAAO,CAMvE"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as Dashboard } from './Dashboard';
|
|
1
|
+
export { default as Dashboard, type DashboardProps, type DashboardItemProps, type DashboardItemData, type AxisFormat, } from './Dashboard';
|
|
2
2
|
export { default as QuillProvider } from './QuillProvider';
|
|
3
3
|
export { default as Chart } from './Chart';
|
|
4
4
|
export { default as Table } from './Table';
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,IAAI,SAAS,EACpB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,UAAU,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
export { default as Dashboard } from './Dashboard';
|
|
2
|
+
export { default as Dashboard, } from './Dashboard';
|
|
3
3
|
export { default as QuillProvider } from './QuillProvider';
|
|
4
4
|
export { default as Chart } from './Chart';
|
|
5
5
|
export { default as Table } from './Table';
|
|
@@ -474,7 +474,7 @@ function generatePivotTitle(pivot) {
|
|
|
474
474
|
}
|
|
475
475
|
function getDateRange(dateRange, column, data) {
|
|
476
476
|
if (!dateRange || !dateRange[0]) {
|
|
477
|
-
if (data.length == 0) {
|
|
477
|
+
if (data.length == 0 || !data[0][column]) {
|
|
478
478
|
return { start: new Date(), end: new Date() };
|
|
479
479
|
}
|
|
480
480
|
const firstDate = data[0][column] === null ? null : new Date(data[0][column]);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DashboardItemData } from '../Dashboard';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a cleaned version of the dashboard item we store in state. We clean
|
|
4
|
+
* the dashboard item so that we aren't exposing unnecessary details to the
|
|
5
|
+
* client and also so that we can give the developer using our items a stable
|
|
6
|
+
* interface to build amazing dashboards on top of.
|
|
7
|
+
* @param item
|
|
8
|
+
*/
|
|
9
|
+
export declare function cleanDashboardItem(item: {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
} | undefined): DashboardItemData | undefined;
|
|
12
|
+
//# sourceMappingURL=dashboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../../src/utils/dashboard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAQjD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG,SAAS,GACvC,iBAAiB,GAAG,SAAS,CA4B/B"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { valueFormatter } from './valueFormatter';
|
|
3
|
+
import { generatePivotTable, generatePivotTableYAxis, } from '../internals/ReportBuilder/PivotModal';
|
|
4
|
+
import { DashboardFiltersContext } from '../Context';
|
|
5
|
+
/**
|
|
6
|
+
* Returns a cleaned version of the dashboard item we store in state. We clean
|
|
7
|
+
* the dashboard item so that we aren't exposing unnecessary details to the
|
|
8
|
+
* client and also so that we can give the developer using our items a stable
|
|
9
|
+
* interface to build amazing dashboards on top of.
|
|
10
|
+
* @param item
|
|
11
|
+
*/
|
|
12
|
+
export function cleanDashboardItem(item) {
|
|
13
|
+
if (!item)
|
|
14
|
+
return undefined;
|
|
15
|
+
const pivotTable = getPivotTable(item);
|
|
16
|
+
const { primaryAggregation, comparisonAggregation, aggregationPercentChange, } = getAggragations(pivotTable, item);
|
|
17
|
+
return {
|
|
18
|
+
id: item._id,
|
|
19
|
+
name: item.name,
|
|
20
|
+
dashboardName: item.dashboardName,
|
|
21
|
+
rows: item.rows,
|
|
22
|
+
compareRows: item.compareRows,
|
|
23
|
+
columns: item.columns,
|
|
24
|
+
chartType: item.chartType,
|
|
25
|
+
dateField: item.dateField,
|
|
26
|
+
pivot: item.pivot,
|
|
27
|
+
primaryAggregation,
|
|
28
|
+
comparisonAggregation,
|
|
29
|
+
aggregationPercentChange,
|
|
30
|
+
yAxisFields: extractPivotedYAxis(pivotTable, item),
|
|
31
|
+
xAxisLabel: item.xAxisLabel,
|
|
32
|
+
xAxisField: item.xAxisField,
|
|
33
|
+
xAxisFormat: item.xAxisFormat,
|
|
34
|
+
order: item.order,
|
|
35
|
+
filtersApplied: item.filtersApplied,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Extracts the aggregations from the item, if any.
|
|
40
|
+
*/
|
|
41
|
+
function getAggragations(pivotTable, item) {
|
|
42
|
+
const yAxisFields = extractPivotedYAxis(pivotTable, item);
|
|
43
|
+
const rows = extractPivotedData(pivotTable, item);
|
|
44
|
+
// extract the aggragation for the primary range.
|
|
45
|
+
const mainKey = yAxisFields[0]?.field ?? item.pivot?.valueField;
|
|
46
|
+
const primary = mainKey
|
|
47
|
+
? rows.reduce((sum, row) => sum + parseFloat(row[mainKey]), 0)
|
|
48
|
+
: 0;
|
|
49
|
+
// extract the aggragation for the comparison range, if applicable.
|
|
50
|
+
const compKey = yAxisFields[1]?.field ?? item.pivot?.valueField;
|
|
51
|
+
const comparison = compKey
|
|
52
|
+
? rows.reduce((sum, row) => sum + parseFloat(row[compKey]), 0)
|
|
53
|
+
: 0;
|
|
54
|
+
return {
|
|
55
|
+
primaryAggregation: formatAggragation(item, primary),
|
|
56
|
+
comparisonAggregation: formatAggragation(item, comparison),
|
|
57
|
+
aggregationPercentChange: formatPercentageWithSign(comparison, primary),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Applies a valueFormatter to the given value based on the format in the item.
|
|
62
|
+
*/
|
|
63
|
+
function formatAggragation(item, value) {
|
|
64
|
+
if (!value)
|
|
65
|
+
return undefined;
|
|
66
|
+
return valueFormatter({
|
|
67
|
+
value,
|
|
68
|
+
field: item.pivot?.valueField,
|
|
69
|
+
fields: item.yAxisFields,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Formats the percentage change from a to b with the sign included.
|
|
74
|
+
*/
|
|
75
|
+
function formatPercentageWithSign(a, b) {
|
|
76
|
+
const formatter = new Intl.NumberFormat('en-US', {
|
|
77
|
+
style: 'percent',
|
|
78
|
+
signDisplay: 'exceptZero',
|
|
79
|
+
minimumFractionDigits: 2,
|
|
80
|
+
maximumFractionDigits: 2,
|
|
81
|
+
});
|
|
82
|
+
return formatter.format(Number(b - a));
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Extract and transform the data from itemInfo.
|
|
86
|
+
*/
|
|
87
|
+
function getPivotTable(itemInfo, config = undefined) {
|
|
88
|
+
if (!itemInfo)
|
|
89
|
+
return [];
|
|
90
|
+
const { dashboardFilters } = useContext(DashboardFiltersContext);
|
|
91
|
+
const dateFilter = Object.values(dashboardFilters ?? {}).find((filter) => filter.filterType == 'date_range');
|
|
92
|
+
const pivot = itemInfo?.pivot || config?.pivot;
|
|
93
|
+
const data = itemInfo ? itemInfo : config;
|
|
94
|
+
return pivot && data?.rows
|
|
95
|
+
? generatePivotTable(pivot, JSON.parse(JSON.stringify(data.rows)), // deep copy
|
|
96
|
+
dateFilter?.startDate
|
|
97
|
+
? [dateFilter?.startDate, dateFilter?.endDate, null]
|
|
98
|
+
: [null, null, null], Boolean(dateFilter?.comparisonRange?.startDate), -1, dateFilter?.comparisonRange?.startDate
|
|
99
|
+
? [
|
|
100
|
+
dateFilter?.comparisonRange.startDate,
|
|
101
|
+
dateFilter?.comparisonRange.endDate,
|
|
102
|
+
null,
|
|
103
|
+
]
|
|
104
|
+
: [null, null, null])
|
|
105
|
+
: null;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Returns the data list based on whether the table is pivoted and if there is
|
|
109
|
+
* a config value passed into this component.
|
|
110
|
+
*/
|
|
111
|
+
function extractPivotedData(pivotTable, item, config = undefined) {
|
|
112
|
+
if (pivotTable)
|
|
113
|
+
return pivotTable.rows;
|
|
114
|
+
if (config) {
|
|
115
|
+
if (config.bucketedRows.length > 0)
|
|
116
|
+
return config.bucketedRows;
|
|
117
|
+
return config.rows;
|
|
118
|
+
}
|
|
119
|
+
return item.rows;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Extracts the yAxis from the pivot table, if one exists.
|
|
123
|
+
*/
|
|
124
|
+
function extractPivotedYAxis(pivotTable, itemInfo, config = undefined) {
|
|
125
|
+
if (!pivotTable)
|
|
126
|
+
return [];
|
|
127
|
+
const pivot = itemInfo?.pivot || config?.pivot;
|
|
128
|
+
const yAxisFields = config ? config.yAxisFields : itemInfo?.yAxisFields;
|
|
129
|
+
const pivotTableYAxis = yAxisFields
|
|
130
|
+
? generatePivotTableYAxis(pivot, pivotTable.columns, yAxisFields?.[0]?.format)
|
|
131
|
+
: null;
|
|
132
|
+
const fields = pivotTableYAxis
|
|
133
|
+
? pivotTableYAxis
|
|
134
|
+
: config
|
|
135
|
+
? config.yAxisFields
|
|
136
|
+
: itemInfo.yAxisFields;
|
|
137
|
+
if (fields.length == 1) {
|
|
138
|
+
const sampleField = fields[0];
|
|
139
|
+
fields[fields.length] = {
|
|
140
|
+
...sampleField,
|
|
141
|
+
field: `comparison_${sampleField.field}`,
|
|
142
|
+
label: `comparison ${sampleField.label}`,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
return fields;
|
|
146
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
export type StyleInput = string | CSSProperties | undefined;
|
|
3
|
+
export type StyleProps = {
|
|
4
|
+
className: string;
|
|
5
|
+
} | {
|
|
6
|
+
style: CSSProperties;
|
|
7
|
+
} | {};
|
|
8
|
+
/**
|
|
9
|
+
* Converts the given styles to a props object that can be passed directly into
|
|
10
|
+
* a jsx/tsx component. Converts to className if styles is a string, otherwise
|
|
11
|
+
* treats it as CSSProperties.
|
|
12
|
+
*
|
|
13
|
+
* Example:
|
|
14
|
+
* <div {...styleToProps(containerStyle)}>...</div>
|
|
15
|
+
*/
|
|
16
|
+
export declare function styleToProps(styles: StyleInput): StyleProps;
|
|
17
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/utils/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;AAC5D,MAAM,MAAM,UAAU,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,aAAa,CAAA;CAAE,GAAG,EAAE,CAAC;AAE/E;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAO3D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts the given styles to a props object that can be passed directly into
|
|
3
|
+
* a jsx/tsx component. Converts to className if styles is a string, otherwise
|
|
4
|
+
* treats it as CSSProperties.
|
|
5
|
+
*
|
|
6
|
+
* Example:
|
|
7
|
+
* <div {...styleToProps(containerStyle)}>...</div>
|
|
8
|
+
*/
|
|
9
|
+
export function styleToProps(styles) {
|
|
10
|
+
if (!styles)
|
|
11
|
+
return {};
|
|
12
|
+
if (typeof styles === 'string') {
|
|
13
|
+
return { className: styles };
|
|
14
|
+
}
|
|
15
|
+
return { style: styles };
|
|
16
|
+
}
|
|
@@ -12,6 +12,6 @@ type Props = {
|
|
|
12
12
|
/**
|
|
13
13
|
* Pretty-prints the given values to their nice-looking string form.
|
|
14
14
|
*/
|
|
15
|
-
export declare const valueFormatter: ({ value, field, fields, }: Props) => string
|
|
15
|
+
export declare const valueFormatter: ({ value, field, fields, }: Props) => string;
|
|
16
16
|
export {};
|
|
17
17
|
//# sourceMappingURL=valueFormatter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"valueFormatter.d.ts","sourceRoot":"","sources":["../../../src/utils/valueFormatter.ts"],"names":[],"mappings":"AAGA,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC;IACpD,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACjC,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,8BAIxB,KAAK,KAAG,
|
|
1
|
+
{"version":3,"file":"valueFormatter.d.ts","sourceRoot":"","sources":["../../../src/utils/valueFormatter.ts"],"names":[],"mappings":"AAGA,KAAK,KAAK,GAAG;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC;IACpD,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACjC,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,8BAIxB,KAAK,KAAG,MA+BV,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quillsql/react",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.6",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"import": "./dist/esm/index.js",
|
|
@@ -32,11 +32,8 @@
|
|
|
32
32
|
"@types/react-dom": "^18.2.18",
|
|
33
33
|
"eslint": "^8.56.0",
|
|
34
34
|
"react": "^18.2.0",
|
|
35
|
+
"react-dom": "^18.2.0",
|
|
35
36
|
"typescript": "^5.3.3"
|
|
36
37
|
},
|
|
37
|
-
"peerDependencies": {
|
|
38
|
-
"react-dom": ">=17"
|
|
39
|
-
},
|
|
40
|
-
"`description": "Quill React components for building dashboards and reporting.",
|
|
41
38
|
"access": "public"
|
|
42
39
|
}
|