@quillsql/react 2.9.6 → 2.9.8
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/AddToDashboardModal.js +8 -8
- package/dist/cjs/DateRangePicker/dateRangePickerUtils.d.ts.map +1 -1
- package/dist/cjs/DateRangePicker/dateRangePickerUtils.js +8 -8
- package/dist/cjs/components/Chart/BarChart.d.ts.map +1 -1
- package/dist/cjs/components/Chart/BarChart.js +5 -4
- package/dist/cjs/components/Chart/LineChart.js +2 -3
- package/dist/cjs/utils/dataFetcher.d.ts.map +1 -1
- package/dist/cjs/utils/dataFetcher.js +4 -4
- package/dist/esm/AddToDashboardModal.js +9 -9
- package/dist/esm/DateRangePicker/dateRangePickerUtils.d.ts.map +1 -1
- package/dist/esm/DateRangePicker/dateRangePickerUtils.js +9 -9
- package/dist/esm/components/Chart/BarChart.d.ts.map +1 -1
- package/dist/esm/components/Chart/BarChart.js +5 -4
- package/dist/esm/components/Chart/LineChart.js +2 -3
- package/dist/esm/utils/dataFetcher.d.ts.map +1 -1
- package/dist/esm/utils/dataFetcher.js +4 -4
- package/package.json +3 -2
|
@@ -851,11 +851,11 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
|
|
|
851
851
|
if (resp.dateFilter.initialRange === 'LAST_90_DAYS') {
|
|
852
852
|
const filter = {
|
|
853
853
|
startDate: (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 90 }),
|
|
854
|
-
endDate:
|
|
854
|
+
endDate: (0, date_fns_1.endOfToday)(),
|
|
855
855
|
filterType: 'date_range',
|
|
856
856
|
selectedValue: [
|
|
857
857
|
(0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 90 }),
|
|
858
|
-
|
|
858
|
+
(0, date_fns_1.endOfToday)(),
|
|
859
859
|
'90d',
|
|
860
860
|
],
|
|
861
861
|
field: 'date_range',
|
|
@@ -874,11 +874,11 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
|
|
|
874
874
|
else if (resp.dateFilter.initialRange === 'LAST_30_DAYS') {
|
|
875
875
|
const filter = {
|
|
876
876
|
startDate: (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 30 }),
|
|
877
|
-
endDate:
|
|
877
|
+
endDate: (0, date_fns_1.endOfToday)(),
|
|
878
878
|
filterType: 'date_range',
|
|
879
879
|
selectedValue: [
|
|
880
880
|
(0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 30 }),
|
|
881
|
-
|
|
881
|
+
(0, date_fns_1.endOfToday)(),
|
|
882
882
|
't',
|
|
883
883
|
],
|
|
884
884
|
options: options,
|
|
@@ -899,9 +899,9 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
|
|
|
899
899
|
else if (resp.dateFilter.initialRange === 'CURRENT_MONTH') {
|
|
900
900
|
const filter = {
|
|
901
901
|
startDate: (0, date_fns_2.startOfMonth)(new Date()),
|
|
902
|
-
endDate:
|
|
902
|
+
endDate: (0, date_fns_1.endOfToday)(),
|
|
903
903
|
filterType: 'date_range',
|
|
904
|
-
selectedValue: [(0, date_fns_2.startOfMonth)(new Date()),
|
|
904
|
+
selectedValue: [(0, date_fns_2.startOfMonth)(new Date()), (0, date_fns_1.endOfToday)(), 'm'],
|
|
905
905
|
options: options,
|
|
906
906
|
field: 'date_range',
|
|
907
907
|
label: 'Date',
|
|
@@ -919,11 +919,11 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
|
|
|
919
919
|
else {
|
|
920
920
|
const filter = {
|
|
921
921
|
startDate: (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 90 }),
|
|
922
|
-
endDate:
|
|
922
|
+
endDate: (0, date_fns_1.endOfToday)(),
|
|
923
923
|
filterType: 'date_range',
|
|
924
924
|
selectedValue: [
|
|
925
925
|
(0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 90 }),
|
|
926
|
-
|
|
926
|
+
(0, date_fns_1.endOfToday)(),
|
|
927
927
|
'90d',
|
|
928
928
|
],
|
|
929
929
|
options: options,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateRangePickerUtils.d.ts","sourceRoot":"","sources":["../../../src/DateRangePicker/dateRangePickerUtils.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dateRangePickerUtils.d.ts","sourceRoot":"","sources":["../../../src/DateRangePicker/dateRangePickerUtils.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,eAAO,MAAM,WAAW,WAAY,MAAM,aAKzC,CAAC;AAEF,eAAO,MAAM,UAAU,MAAO,MAAM,UAAU,MAAM,WAEnD,CAAC;AAEF,eAAO,MAAM,2BAA2B,kBACvB,MAAM,GAAG,IAAI,GAAG,SAAS,oBACtB,qBAAqB,EAAE,gBAU1C,CAAC;AAEF,eAAO,MAAM,yBAAyB,kBACrB,MAAM,GAAG,IAAI,GAAG,SAAS,oBACtB,qBAAqB,EAAE,SAU1C,CAAC;AAEF,eAAO,MAAM,cAAc,cACd,IAAI,GAAG,IAAI,GAAG,SAAS,WACzB,IAAI,GAAG,IAAI,GAAG,SAAS,yBACT,MAAM,GAAG,IAAI,GAAG,SAAS,mBAC/B,qBAAqB,EAAE,gBAWzC,CAAC;AAEF,eAAO,MAAM,YAAY,YACd,IAAI,GAAG,IAAI,GAAG,SAAS,WACvB,IAAI,GAAG,IAAI,GAAG,SAAS,yBACT,MAAM,GAAG,IAAI,GAAG,SAAS,mBAC/B,qBAAqB,EAAE,gBASzC,CAAC;AAEF;;GAEG;AACH,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,IAAI,CAAC;IACZ,GAAG,EAAE,IAAI,CAAC;CACX,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAAA;CASjE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,OAAO,aAAa,GAAG,MAAM,CAAA;CAStE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,cAAc,KAAK,cAAc,GAAG,IAAI,CAAC;CAmBjE,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,qBAAqB,EAyCjD,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,qBAAqB,EA+BvD,CAAC;AAEF,eAAO,MAAM,kBAAkB,WAAY,MAAM,6BAGhD,CAAC;AAEF,eAAO,MAAM,aAAa,UACjB,GAAG,QACJ,IAAI,kBACM,IAAI,GAAG,IAAI,gBACb,IAAI,GAAG,IAAI,eACZ,IAAI,GAAG,SAAS,kBACb,OAAO,QAgCxB,CAAC;AAkGF,eAAO,MAAM,eAAe,qBACR,IAAI,GAAG,IAAI,kBACb,IAAI,GAAG,IAAI,uBA0C5B,CAAC;AAyHF,eAAO,MAAM,mBAAmB,cACnB,IAAI,GAAG,IAAI,WACb,IAAI,GAAG,IAAI,WACX,MAAM,WAyChB,CAAC;;AAEF,yEAAyE"}
|
|
@@ -54,14 +54,14 @@ exports.parseEndDate = parseEndDate;
|
|
|
54
54
|
* key ending on today.
|
|
55
55
|
*/
|
|
56
56
|
exports.PRIMARY_RANGE = {
|
|
57
|
-
THIS_WEEK: { start: (0, date_fns_1.startOfWeek)((0, date_fns_1.startOfToday)()), end:
|
|
58
|
-
THIS_MONTH: { start: (0, date_fns_1.startOfMonth)((0, date_fns_1.startOfToday)()), end:
|
|
59
|
-
THIS_YEAR: { start: (0, date_fns_1.startOfYear)((0, date_fns_1.startOfToday)()), end:
|
|
60
|
-
LAST_7_DAYS: { start: (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 7 }), end:
|
|
61
|
-
LAST_30_DAYS: { start: (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 30 }), end:
|
|
62
|
-
LAST_90_DAYS: { start: (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 90 }), end:
|
|
63
|
-
LAST_6_MONTHS: { start: (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { months: 6 }), end:
|
|
64
|
-
ALL_TIME: { start: new Date(0), end:
|
|
57
|
+
THIS_WEEK: { start: (0, date_fns_1.startOfWeek)((0, date_fns_1.startOfToday)()), end: (0, date_fns_1.endOfToday)() },
|
|
58
|
+
THIS_MONTH: { start: (0, date_fns_1.startOfMonth)((0, date_fns_1.startOfToday)()), end: (0, date_fns_1.endOfToday)() },
|
|
59
|
+
THIS_YEAR: { start: (0, date_fns_1.startOfYear)((0, date_fns_1.startOfToday)()), end: (0, date_fns_1.endOfToday)() },
|
|
60
|
+
LAST_7_DAYS: { start: (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 7 }), end: (0, date_fns_1.endOfToday)() },
|
|
61
|
+
LAST_30_DAYS: { start: (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 30 }), end: (0, date_fns_1.endOfToday)() },
|
|
62
|
+
LAST_90_DAYS: { start: (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { days: 90 }), end: (0, date_fns_1.endOfToday)() },
|
|
63
|
+
LAST_6_MONTHS: { start: (0, date_fns_1.sub)((0, date_fns_1.startOfToday)(), { months: 6 }), end: (0, date_fns_1.endOfToday)() },
|
|
64
|
+
ALL_TIME: { start: new Date(0), end: (0, date_fns_1.endOfToday)() },
|
|
65
65
|
};
|
|
66
66
|
/**
|
|
67
67
|
* Maps between the keys of primary range and the short code.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarChart.d.ts","sourceRoot":"","sources":["../../../../src/components/Chart/BarChart.tsx"],"names":[],"mappings":";AAgBA,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,MAAM,EACN,WAAW,EACX,IAAI,EACJ,cAAc,EACd,UAAU,EACV,WAAW,EACX,KAAK,EACL,UAAU,EACV,SAAS,EACT,iBAAwB,EACxB,SAAiB,EACjB,SAAiB,EACjB,iBAAyB,GAC1B,EAAE;IACD,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,GAAG,EAAE,CAAC;IACnB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,GAAG,CAAC;IACX,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;CAC5B,
|
|
1
|
+
{"version":3,"file":"BarChart.d.ts","sourceRoot":"","sources":["../../../../src/components/Chart/BarChart.tsx"],"names":[],"mappings":";AAgBA,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,MAAM,EACN,WAAW,EACX,IAAI,EACJ,cAAc,EACd,UAAU,EACV,WAAW,EACX,KAAK,EACL,UAAU,EACV,SAAS,EACT,iBAAwB,EACxB,SAAiB,EACjB,SAAiB,EACjB,iBAAyB,GAC1B,EAAE;IACD,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,GAAG,EAAE,CAAC;IACnB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,GAAG,CAAC;IACX,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;CAC5B,2CAiJA"}
|
|
@@ -10,6 +10,7 @@ const valueFormatter_1 = require("../../utils/valueFormatter");
|
|
|
10
10
|
const axisFormatter_1 = require("../../utils/axisFormatter");
|
|
11
11
|
const color_1 = require("../../utils/color");
|
|
12
12
|
const ChartTooltip_1 = __importDefault(require("../../components/Chart/ChartTooltip"));
|
|
13
|
+
const getDomain_1 = __importDefault(require("../../utils/getDomain"));
|
|
13
14
|
function BarChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxisFormat, theme, comparison, isStacked, isAnimationActive = true, hideXAxis = false, hideYAxis = false, hideCartesionGrid = false, }) {
|
|
14
15
|
if (!data || data.length === 0) {
|
|
15
16
|
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
@@ -26,9 +27,7 @@ function BarChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxis
|
|
|
26
27
|
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
27
28
|
...containerStyle,
|
|
28
29
|
boxSizing: 'content-box',
|
|
29
|
-
}, children: (0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: '100%', children: (0, jsx_runtime_1.jsxs)(recharts_1.BarChart, { data: data, layout: 'horizontal', children: [!hideCartesionGrid && ((0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, { horizontal: true, vertical: false, stroke: "#e5e7eb" })), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, { width: 44, hide: hideYAxis, axisLine: false, tickLine: false, type: "number",
|
|
30
|
-
// domain={getDomain(data, yAxisFields)}
|
|
31
|
-
tick: { transform: 'translate(-3, 0)' }, style: {
|
|
30
|
+
}, children: (0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { width: "100%", height: '100%', children: (0, jsx_runtime_1.jsxs)(recharts_1.BarChart, { data: data, layout: 'horizontal', children: [!hideCartesionGrid && ((0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, { horizontal: true, vertical: false, stroke: "#e5e7eb" })), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, { width: 44, hide: hideYAxis, axisLine: false, tickLine: false, type: "number", domain: (0, getDomain_1.default)(data, yAxisFields), tick: { transform: 'translate(-3, 0)' }, style: {
|
|
32
31
|
fontSize: '12px',
|
|
33
32
|
fontFamily: theme.chartLabelFontFamily,
|
|
34
33
|
}, tickFormatter: (tick) => (0, axisFormatter_1.axisFormatter)({
|
|
@@ -59,6 +58,8 @@ function BarChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxis
|
|
|
59
58
|
field: payload[0].dataKey,
|
|
60
59
|
fields: yAxisFields,
|
|
61
60
|
}), xAxisFormat: xAxisFormat, xAxisField: xAxisField, colors: colors }));
|
|
62
|
-
}, position: { y: 0 } }), yAxisFields.map((elem) => ((0, jsx_runtime_1.jsx)(recharts_1.Bar, { name: elem.label, dataKey: elem.field, stackId: isStacked &&
|
|
61
|
+
}, position: { y: 0 } }), yAxisFields.map((elem) => ((0, jsx_runtime_1.jsx)(recharts_1.Bar, { name: elem.label, dataKey: elem.field, stackId: isStacked &&
|
|
62
|
+
(elem.field?.replace('comparison_', '') ??
|
|
63
|
+
'unknown'), type: "linear", fill: (0, color_1.selectColor)(elem, colors, yAxisFields.findIndex((field) => field.field === elem.field?.replace('comparison_', ''))), isAnimationActive: isAnimationActive }, elem.field)))] }) }) }));
|
|
63
64
|
}
|
|
64
65
|
exports.default = BarChart;
|
|
@@ -10,6 +10,7 @@ const valueFormatter_1 = require("../../utils/valueFormatter");
|
|
|
10
10
|
const axisFormatter_1 = require("../../utils/axisFormatter");
|
|
11
11
|
const color_1 = require("../../utils/color");
|
|
12
12
|
const ChartTooltip_1 = __importDefault(require("../../components/Chart/ChartTooltip"));
|
|
13
|
+
const getDomain_1 = __importDefault(require("../../utils/getDomain"));
|
|
13
14
|
function LineChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxisFormat, theme, comparison, isAnimationActive = true, hideXAxis = false, hideYAxis = false, hideCartesionGrid = false, }) {
|
|
14
15
|
if (!yAxisFields || !yAxisFields.length) {
|
|
15
16
|
return null;
|
|
@@ -36,9 +37,7 @@ function LineChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxi
|
|
|
36
37
|
value: tick,
|
|
37
38
|
field: xAxisField,
|
|
38
39
|
fields: [{ field: xAxisField, format: xAxisFormat }],
|
|
39
|
-
}) }), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, { hide: hideYAxis, width: 44, axisLine: false, tickLine: false, type: "number",
|
|
40
|
-
// domain={getDomain(data, yAxisFields)}
|
|
41
|
-
tick: { transform: 'translate(-3, 0)' }, style: {
|
|
40
|
+
}) }), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, { hide: hideYAxis, width: 44, axisLine: false, tickLine: false, type: "number", domain: (0, getDomain_1.default)(data, yAxisFields), tick: { transform: 'translate(-3, 0)' }, style: {
|
|
42
41
|
fontSize: '12px',
|
|
43
42
|
fontFamily: theme?.chartLabelFontFamily ||
|
|
44
43
|
theme?.fontFamily ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataFetcher.d.ts","sourceRoot":"","sources":["../../../src/utils/dataFetcher.tsx"],"names":[],"mappings":"AAEA,wBAAsB,OAAO,CAC3B,MAAM,EAAE,GAAG,EACX,kBAAkB,EAAE,MAAM,EAC1B,MAAM,EAAE,kBAAkB,EAC1B,iBAAiB,EAAE,GAAG,EACtB,gBAAgB,EAAE,GAAG,EACrB,MAAM,SAAS,gBAkChB;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,GAAG,EACX,kBAAkB,EAAE,MAAM,EAC1B,gBAAgB,EAAE,GAAG,EACrB,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"dataFetcher.d.ts","sourceRoot":"","sources":["../../../src/utils/dataFetcher.tsx"],"names":[],"mappings":"AAEA,wBAAsB,OAAO,CAC3B,MAAM,EAAE,GAAG,EACX,kBAAkB,EAAE,MAAM,EAC1B,MAAM,EAAE,kBAAkB,EAC1B,iBAAiB,EAAE,GAAG,EACtB,gBAAgB,EAAE,GAAG,EACrB,MAAM,SAAS,gBAkChB;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,GAAG,EACX,kBAAkB,EAAE,MAAM,EAC1B,gBAAgB,EAAE,GAAG,EACrB,MAAM,SAAS,gBA+BhB"}
|
|
@@ -20,7 +20,7 @@ async function getData(client, cloudQueryEndpoint, noCred, hostedRequestBody, cl
|
|
|
20
20
|
const result = {
|
|
21
21
|
...responseJson.data,
|
|
22
22
|
rows: responseJson?.queries?.queryResults[0]?.rows,
|
|
23
|
-
compareRows: responseJson?.queries?.queryResults[1]?.rows
|
|
23
|
+
compareRows: responseJson?.queries?.queryResults[1]?.rows,
|
|
24
24
|
};
|
|
25
25
|
return result;
|
|
26
26
|
}
|
|
@@ -37,9 +37,9 @@ async function getData(client, cloudQueryEndpoint, noCred, hostedRequestBody, cl
|
|
|
37
37
|
exports.getData = getData;
|
|
38
38
|
async function getDataFromCloud(client, cloudQueryEndpoint, cloudRequestBody, method = 'POST') {
|
|
39
39
|
const environment = client?.environment;
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
{
|
|
40
|
+
const host = process.env.QUILL_SERVER_HOST ?? 'https://quill-344421.uc.r.appspot.com';
|
|
41
|
+
const url = `${host}/${cloudQueryEndpoint}`;
|
|
42
|
+
const resp = await fetch(url, {
|
|
43
43
|
method,
|
|
44
44
|
headers: {
|
|
45
45
|
Authorization: 'Bearer ',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
// @ts-nocheck
|
|
3
3
|
import React, { useContext, useEffect, useState } from 'react';
|
|
4
|
-
import { sub, startOfToday } from 'date-fns';
|
|
4
|
+
import { sub, startOfToday, endOfToday } from 'date-fns';
|
|
5
5
|
import { getData, getDataFromCloud } from './utils/dataFetcher';
|
|
6
6
|
import { ClientContext, SchemaContext, ThemeContext, DateFilterContext, DashboardContext, DashboardFiltersContext, } from './Context';
|
|
7
7
|
import { differenceInDays, differenceInHours, differenceInMonths, differenceInYears, startOfDay, startOfHour, startOfMonth, startOfYear, } from 'date-fns';
|
|
@@ -817,11 +817,11 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
|
|
|
817
817
|
if (resp.dateFilter.initialRange === 'LAST_90_DAYS') {
|
|
818
818
|
const filter = {
|
|
819
819
|
startDate: sub(startOfToday(), { days: 90 }),
|
|
820
|
-
endDate:
|
|
820
|
+
endDate: endOfToday(),
|
|
821
821
|
filterType: 'date_range',
|
|
822
822
|
selectedValue: [
|
|
823
823
|
sub(startOfToday(), { days: 90 }),
|
|
824
|
-
|
|
824
|
+
endOfToday(),
|
|
825
825
|
'90d',
|
|
826
826
|
],
|
|
827
827
|
field: 'date_range',
|
|
@@ -840,11 +840,11 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
|
|
|
840
840
|
else if (resp.dateFilter.initialRange === 'LAST_30_DAYS') {
|
|
841
841
|
const filter = {
|
|
842
842
|
startDate: sub(startOfToday(), { days: 30 }),
|
|
843
|
-
endDate:
|
|
843
|
+
endDate: endOfToday(),
|
|
844
844
|
filterType: 'date_range',
|
|
845
845
|
selectedValue: [
|
|
846
846
|
sub(startOfToday(), { days: 30 }),
|
|
847
|
-
|
|
847
|
+
endOfToday(),
|
|
848
848
|
't',
|
|
849
849
|
],
|
|
850
850
|
options: options,
|
|
@@ -865,9 +865,9 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
|
|
|
865
865
|
else if (resp.dateFilter.initialRange === 'CURRENT_MONTH') {
|
|
866
866
|
const filter = {
|
|
867
867
|
startDate: startOfMonth(new Date()),
|
|
868
|
-
endDate:
|
|
868
|
+
endDate: endOfToday(),
|
|
869
869
|
filterType: 'date_range',
|
|
870
|
-
selectedValue: [startOfMonth(new Date()),
|
|
870
|
+
selectedValue: [startOfMonth(new Date()), endOfToday(), 'm'],
|
|
871
871
|
options: options,
|
|
872
872
|
field: 'date_range',
|
|
873
873
|
label: 'Date',
|
|
@@ -885,11 +885,11 @@ function FormikForm({ data, xAxisOptions, yAxisOptions, fieldOptions, dateFieldO
|
|
|
885
885
|
else {
|
|
886
886
|
const filter = {
|
|
887
887
|
startDate: sub(startOfToday(), { days: 90 }),
|
|
888
|
-
endDate:
|
|
888
|
+
endDate: endOfToday(),
|
|
889
889
|
filterType: 'date_range',
|
|
890
890
|
selectedValue: [
|
|
891
891
|
sub(startOfToday(), { days: 90 }),
|
|
892
|
-
|
|
892
|
+
endOfToday(),
|
|
893
893
|
'90d',
|
|
894
894
|
],
|
|
895
895
|
options: options,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateRangePickerUtils.d.ts","sourceRoot":"","sources":["../../../src/DateRangePicker/dateRangePickerUtils.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dateRangePickerUtils.d.ts","sourceRoot":"","sources":["../../../src/DateRangePicker/dateRangePickerUtils.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,eAAO,MAAM,WAAW,WAAY,MAAM,aAKzC,CAAC;AAEF,eAAO,MAAM,UAAU,MAAO,MAAM,UAAU,MAAM,WAEnD,CAAC;AAEF,eAAO,MAAM,2BAA2B,kBACvB,MAAM,GAAG,IAAI,GAAG,SAAS,oBACtB,qBAAqB,EAAE,gBAU1C,CAAC;AAEF,eAAO,MAAM,yBAAyB,kBACrB,MAAM,GAAG,IAAI,GAAG,SAAS,oBACtB,qBAAqB,EAAE,SAU1C,CAAC;AAEF,eAAO,MAAM,cAAc,cACd,IAAI,GAAG,IAAI,GAAG,SAAS,WACzB,IAAI,GAAG,IAAI,GAAG,SAAS,yBACT,MAAM,GAAG,IAAI,GAAG,SAAS,mBAC/B,qBAAqB,EAAE,gBAWzC,CAAC;AAEF,eAAO,MAAM,YAAY,YACd,IAAI,GAAG,IAAI,GAAG,SAAS,WACvB,IAAI,GAAG,IAAI,GAAG,SAAS,yBACT,MAAM,GAAG,IAAI,GAAG,SAAS,mBAC/B,qBAAqB,EAAE,gBASzC,CAAC;AAEF;;GAEG;AACH,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,IAAI,CAAC;IACZ,GAAG,EAAE,IAAI,CAAC;CACX,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAAA;CASjE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,OAAO,aAAa,GAAG,MAAM,CAAA;CAStE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,KAAK,EAAE,cAAc,KAAK,cAAc,GAAG,IAAI,CAAC;CAmBjE,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,qBAAqB,EAyCjD,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,qBAAqB,EA+BvD,CAAC;AAEF,eAAO,MAAM,kBAAkB,WAAY,MAAM,6BAGhD,CAAC;AAEF,eAAO,MAAM,aAAa,UACjB,GAAG,QACJ,IAAI,kBACM,IAAI,GAAG,IAAI,gBACb,IAAI,GAAG,IAAI,eACZ,IAAI,GAAG,SAAS,kBACb,OAAO,QAgCxB,CAAC;AAkGF,eAAO,MAAM,eAAe,qBACR,IAAI,GAAG,IAAI,kBACb,IAAI,GAAG,IAAI,uBA0C5B,CAAC;AAyHF,eAAO,MAAM,mBAAmB,cACnB,IAAI,GAAG,IAAI,WACb,IAAI,GAAG,IAAI,WACX,MAAM,WAyChB,CAAC;;AAEF,yEAAyE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addDays, differenceInDays, format, isEqual, isToday, max, min, startOfDay, startOfMonth, startOfToday, startOfWeek, startOfYear, sub, } from 'date-fns';
|
|
1
|
+
import { addDays, differenceInDays, endOfToday, format, isEqual, isToday, max, min, startOfDay, startOfMonth, startOfToday, startOfWeek, startOfYear, sub, } from 'date-fns';
|
|
2
2
|
import { hexToRgbaWith10PercentAlpha } from '../BarList';
|
|
3
3
|
export const getWeekdays = (locale) => {
|
|
4
4
|
const firstDayOfWeek = startOfWeek(new Date());
|
|
@@ -45,14 +45,14 @@ export const parseEndDate = (endDate, maxDate, selectedDropdownValue, dropdownOp
|
|
|
45
45
|
* key ending on today.
|
|
46
46
|
*/
|
|
47
47
|
export const PRIMARY_RANGE = {
|
|
48
|
-
THIS_WEEK: { start: startOfWeek(startOfToday()), end:
|
|
49
|
-
THIS_MONTH: { start: startOfMonth(startOfToday()), end:
|
|
50
|
-
THIS_YEAR: { start: startOfYear(startOfToday()), end:
|
|
51
|
-
LAST_7_DAYS: { start: sub(startOfToday(), { days: 7 }), end:
|
|
52
|
-
LAST_30_DAYS: { start: sub(startOfToday(), { days: 30 }), end:
|
|
53
|
-
LAST_90_DAYS: { start: sub(startOfToday(), { days: 90 }), end:
|
|
54
|
-
LAST_6_MONTHS: { start: sub(startOfToday(), { months: 6 }), end:
|
|
55
|
-
ALL_TIME: { start: new Date(0), end:
|
|
48
|
+
THIS_WEEK: { start: startOfWeek(startOfToday()), end: endOfToday() },
|
|
49
|
+
THIS_MONTH: { start: startOfMonth(startOfToday()), end: endOfToday() },
|
|
50
|
+
THIS_YEAR: { start: startOfYear(startOfToday()), end: endOfToday() },
|
|
51
|
+
LAST_7_DAYS: { start: sub(startOfToday(), { days: 7 }), end: endOfToday() },
|
|
52
|
+
LAST_30_DAYS: { start: sub(startOfToday(), { days: 30 }), end: endOfToday() },
|
|
53
|
+
LAST_90_DAYS: { start: sub(startOfToday(), { days: 90 }), end: endOfToday() },
|
|
54
|
+
LAST_6_MONTHS: { start: sub(startOfToday(), { months: 6 }), end: endOfToday() },
|
|
55
|
+
ALL_TIME: { start: new Date(0), end: endOfToday() },
|
|
56
56
|
};
|
|
57
57
|
/**
|
|
58
58
|
* Maps between the keys of primary range and the short code.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarChart.d.ts","sourceRoot":"","sources":["../../../../src/components/Chart/BarChart.tsx"],"names":[],"mappings":";AAgBA,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,MAAM,EACN,WAAW,EACX,IAAI,EACJ,cAAc,EACd,UAAU,EACV,WAAW,EACX,KAAK,EACL,UAAU,EACV,SAAS,EACT,iBAAwB,EACxB,SAAiB,EACjB,SAAiB,EACjB,iBAAyB,GAC1B,EAAE;IACD,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,GAAG,EAAE,CAAC;IACnB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,GAAG,CAAC;IACX,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;CAC5B,
|
|
1
|
+
{"version":3,"file":"BarChart.d.ts","sourceRoot":"","sources":["../../../../src/components/Chart/BarChart.tsx"],"names":[],"mappings":";AAgBA,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,MAAM,EACN,WAAW,EACX,IAAI,EACJ,cAAc,EACd,UAAU,EACV,WAAW,EACX,KAAK,EACL,UAAU,EACV,SAAS,EACT,iBAAwB,EACxB,SAAiB,EACjB,SAAiB,EACjB,iBAAyB,GAC1B,EAAE;IACD,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,GAAG,EAAE,CAAC;IACnB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,GAAG,CAAC;IACX,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,OAAO,CAAC;CAC5B,2CAiJA"}
|
|
@@ -5,6 +5,7 @@ import { valueFormatter } from '../../utils/valueFormatter';
|
|
|
5
5
|
import { axisFormatter } from '../../utils/axisFormatter';
|
|
6
6
|
import { selectColor } from '../../utils/color';
|
|
7
7
|
import ChartTooltip from '../../components/Chart/ChartTooltip';
|
|
8
|
+
import getDomain from '../../utils/getDomain';
|
|
8
9
|
export default function BarChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxisFormat, theme, comparison, isStacked, isAnimationActive = true, hideXAxis = false, hideYAxis = false, hideCartesionGrid = false, }) {
|
|
9
10
|
if (!data || data.length === 0) {
|
|
10
11
|
return (_jsx("div", { style: {
|
|
@@ -21,9 +22,7 @@ export default function BarChart({ colors, yAxisFields, data, containerStyle, xA
|
|
|
21
22
|
return (_jsx("div", { style: {
|
|
22
23
|
...containerStyle,
|
|
23
24
|
boxSizing: 'content-box',
|
|
24
|
-
}, children: _jsx(ResponsiveContainer, { width: "100%", height: '100%', children: _jsxs(ReChartsBarChart, { data: data, layout: 'horizontal', children: [!hideCartesionGrid && (_jsx(CartesianGrid, { horizontal: true, vertical: false, stroke: "#e5e7eb" })), _jsx(YAxis, { width: 44, hide: hideYAxis, axisLine: false, tickLine: false, type: "number",
|
|
25
|
-
// domain={getDomain(data, yAxisFields)}
|
|
26
|
-
tick: { transform: 'translate(-3, 0)' }, style: {
|
|
25
|
+
}, children: _jsx(ResponsiveContainer, { width: "100%", height: '100%', children: _jsxs(ReChartsBarChart, { data: data, layout: 'horizontal', children: [!hideCartesionGrid && (_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: {
|
|
27
26
|
fontSize: '12px',
|
|
28
27
|
fontFamily: theme.chartLabelFontFamily,
|
|
29
28
|
}, tickFormatter: (tick) => axisFormatter({
|
|
@@ -54,5 +53,7 @@ export default function BarChart({ colors, yAxisFields, data, containerStyle, xA
|
|
|
54
53
|
field: payload[0].dataKey,
|
|
55
54
|
fields: yAxisFields,
|
|
56
55
|
}), xAxisFormat: xAxisFormat, xAxisField: xAxisField, colors: colors }));
|
|
57
|
-
}, position: { y: 0 } }), yAxisFields.map((elem) => (_jsx(Bar, { name: elem.label, dataKey: elem.field, stackId: isStacked &&
|
|
56
|
+
}, position: { y: 0 } }), yAxisFields.map((elem) => (_jsx(Bar, { name: elem.label, dataKey: elem.field, stackId: isStacked &&
|
|
57
|
+
(elem.field?.replace('comparison_', '') ??
|
|
58
|
+
'unknown'), type: "linear", fill: selectColor(elem, colors, yAxisFields.findIndex((field) => field.field === elem.field?.replace('comparison_', ''))), isAnimationActive: isAnimationActive }, elem.field)))] }) }) }));
|
|
58
59
|
}
|
|
@@ -5,6 +5,7 @@ import { valueFormatter } from '../../utils/valueFormatter';
|
|
|
5
5
|
import { axisFormatter } from '../../utils/axisFormatter';
|
|
6
6
|
import { selectColor } from '../../utils/color';
|
|
7
7
|
import ChartTooltip from '../../components/Chart/ChartTooltip';
|
|
8
|
+
import getDomain from '../../utils/getDomain';
|
|
8
9
|
export default function LineChart({ colors, yAxisFields, data, containerStyle, xAxisField, xAxisFormat, theme, comparison, isAnimationActive = true, hideXAxis = false, hideYAxis = false, hideCartesionGrid = false, }) {
|
|
9
10
|
if (!yAxisFields || !yAxisFields.length) {
|
|
10
11
|
return null;
|
|
@@ -31,9 +32,7 @@ export default function LineChart({ colors, yAxisFields, data, containerStyle, x
|
|
|
31
32
|
value: tick,
|
|
32
33
|
field: xAxisField,
|
|
33
34
|
fields: [{ field: xAxisField, format: xAxisFormat }],
|
|
34
|
-
}) }), _jsx(YAxis, { hide: hideYAxis, width: 44, axisLine: false, tickLine: false, type: "number",
|
|
35
|
-
// domain={getDomain(data, yAxisFields)}
|
|
36
|
-
tick: { transform: 'translate(-3, 0)' }, style: {
|
|
35
|
+
}) }), _jsx(YAxis, { hide: hideYAxis, width: 44, axisLine: false, tickLine: false, type: "number", domain: getDomain(data, yAxisFields), tick: { transform: 'translate(-3, 0)' }, style: {
|
|
37
36
|
fontSize: '12px',
|
|
38
37
|
fontFamily: theme?.chartLabelFontFamily ||
|
|
39
38
|
theme?.fontFamily ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataFetcher.d.ts","sourceRoot":"","sources":["../../../src/utils/dataFetcher.tsx"],"names":[],"mappings":"AAEA,wBAAsB,OAAO,CAC3B,MAAM,EAAE,GAAG,EACX,kBAAkB,EAAE,MAAM,EAC1B,MAAM,EAAE,kBAAkB,EAC1B,iBAAiB,EAAE,GAAG,EACtB,gBAAgB,EAAE,GAAG,EACrB,MAAM,SAAS,gBAkChB;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,GAAG,EACX,kBAAkB,EAAE,MAAM,EAC1B,gBAAgB,EAAE,GAAG,EACrB,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"dataFetcher.d.ts","sourceRoot":"","sources":["../../../src/utils/dataFetcher.tsx"],"names":[],"mappings":"AAEA,wBAAsB,OAAO,CAC3B,MAAM,EAAE,GAAG,EACX,kBAAkB,EAAE,MAAM,EAC1B,MAAM,EAAE,kBAAkB,EAC1B,iBAAiB,EAAE,GAAG,EACtB,gBAAgB,EAAE,GAAG,EACrB,MAAM,SAAS,gBAkChB;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,GAAG,EACX,kBAAkB,EAAE,MAAM,EAC1B,gBAAgB,EAAE,GAAG,EACrB,MAAM,SAAS,gBA+BhB"}
|
|
@@ -17,7 +17,7 @@ export async function getData(client, cloudQueryEndpoint, noCred, hostedRequestB
|
|
|
17
17
|
const result = {
|
|
18
18
|
...responseJson.data,
|
|
19
19
|
rows: responseJson?.queries?.queryResults[0]?.rows,
|
|
20
|
-
compareRows: responseJson?.queries?.queryResults[1]?.rows
|
|
20
|
+
compareRows: responseJson?.queries?.queryResults[1]?.rows,
|
|
21
21
|
};
|
|
22
22
|
return result;
|
|
23
23
|
}
|
|
@@ -33,9 +33,9 @@ export async function getData(client, cloudQueryEndpoint, noCred, hostedRequestB
|
|
|
33
33
|
}
|
|
34
34
|
export async function getDataFromCloud(client, cloudQueryEndpoint, cloudRequestBody, method = 'POST') {
|
|
35
35
|
const environment = client?.environment;
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
{
|
|
36
|
+
const host = process.env.QUILL_SERVER_HOST ?? 'https://quill-344421.uc.r.appspot.com';
|
|
37
|
+
const url = `${host}/${cloudQueryEndpoint}`;
|
|
38
|
+
const resp = await fetch(url, {
|
|
39
39
|
method,
|
|
40
40
|
headers: {
|
|
41
41
|
Authorization: 'Bearer ',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quillsql/react",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.8",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"import": "./dist/esm/index.js",
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "rm -rf dist && tsc -p tsconfig.json && tsc -p tsconfig.esm.json",
|
|
16
16
|
"dev": "tsc -p tsconfig.json -w & tsc -p tsconfig.esm.json",
|
|
17
|
-
"lint": "eslint . --max-warnings 0"
|
|
17
|
+
"lint": "eslint . --max-warnings 0",
|
|
18
|
+
"pub": "rm -rf dist && tsc -p tsconfig.json && tsc -p tsconfig.esm.json && npm publish --access public"
|
|
18
19
|
},
|
|
19
20
|
"dependencies": {
|
|
20
21
|
"@monaco-editor/react": "^4.5.1",
|