@quillsql/react 2.15.17 → 2.16.1
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/index.cjs +238 -65
- package/dist/index.d.cts +36 -5
- package/dist/index.d.ts +36 -5
- package/dist/index.js +238 -65
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1751,8 +1751,13 @@ interface SQLEditorProps {
|
|
|
1751
1751
|
onCloseChartBuilder?: () => void;
|
|
1752
1752
|
/**
|
|
1753
1753
|
* A callback that is fired when a report has been added to a dashboard.
|
|
1754
|
+
* @deprecated Use onSubmitCreateReport and onSubmitEditReport instead
|
|
1754
1755
|
*/
|
|
1755
1756
|
onAddToDashboardComplete?: (report: QuillReport) => void;
|
|
1757
|
+
/** A callback function that will trigger when a new chart is saved */
|
|
1758
|
+
onSubmitCreateReport?: (report: QuillReport) => void;
|
|
1759
|
+
/** A callback function that will trigger when a chart is edited */
|
|
1760
|
+
onSubmitEditReport?: (report: QuillReport) => void;
|
|
1756
1761
|
onSaveQueryComplete?: (report: QuillReport) => void;
|
|
1757
1762
|
/** A callback function triggered when a chart element is clicked */
|
|
1758
1763
|
onClickChartElement?: (event: any) => void;
|
|
@@ -1779,9 +1784,14 @@ interface SQLEditorProps {
|
|
|
1779
1784
|
*/
|
|
1780
1785
|
isAdminEnabled?: boolean;
|
|
1781
1786
|
/**
|
|
1782
|
-
*
|
|
1787
|
+
* Options for the chart builder modal.
|
|
1783
1788
|
*/
|
|
1784
|
-
|
|
1789
|
+
chartBuilderOptions?: {
|
|
1790
|
+
/** Whether to show table format options. */
|
|
1791
|
+
showTableFormatOptions?: boolean;
|
|
1792
|
+
/** Whether to show dashboard filter fields. */
|
|
1793
|
+
showDashboardFilterFields?: boolean;
|
|
1794
|
+
};
|
|
1785
1795
|
/**
|
|
1786
1796
|
* Whether to show date field options.
|
|
1787
1797
|
*/
|
|
@@ -1794,6 +1804,10 @@ interface SQLEditorProps {
|
|
|
1794
1804
|
* A dashboard item.
|
|
1795
1805
|
*/
|
|
1796
1806
|
report?: QuillReport;
|
|
1807
|
+
/**
|
|
1808
|
+
* A report id that the SQL Editor will query from and modify.
|
|
1809
|
+
*/
|
|
1810
|
+
reportId?: string;
|
|
1797
1811
|
/**
|
|
1798
1812
|
* The default query to use as a placeholder.
|
|
1799
1813
|
*/
|
|
@@ -1802,6 +1816,10 @@ interface SQLEditorProps {
|
|
|
1802
1816
|
* The default dashboard to add the query to.
|
|
1803
1817
|
*/
|
|
1804
1818
|
destinationDashboard: string;
|
|
1819
|
+
/**
|
|
1820
|
+
* The section of the dashboard to add items to.
|
|
1821
|
+
*/
|
|
1822
|
+
destinationSection?: string;
|
|
1805
1823
|
/**
|
|
1806
1824
|
* The title of the ChartBuilder dialog.
|
|
1807
1825
|
*/
|
|
@@ -1856,7 +1874,7 @@ interface SQLEditorProps {
|
|
|
1856
1874
|
* ### SQLEditor API
|
|
1857
1875
|
* @see https://docs.quillsql.com/components/sql-editor
|
|
1858
1876
|
*/
|
|
1859
|
-
declare function SQLEditor({ ButtonComponent, SecondaryButtonComponent, DeleteButtonComponent, TextInputComponent, SelectComponent, TableComponent, isNewQueryEnabled, LoadingComponent, ModalComponent, PopoverComponent, CardComponent, LabelComponent, HeaderComponent, SubHeaderComponent, TextComponent, ErrorMessageComponent, ChartBuilderInputRowContainer, ChartBuilderInputColumnContainer, PivotRowContainer, PivotColumnContainer, ChartBuilderFormContainer, CheckboxComponent, defaultQuery, destinationDashboard, onChangeQuery, onChangeData, onChangeColumns, onChangeFields, onDiscardChanges, onSaveChanges, onCloseChartBuilder, isChartBuilderEnabled, isAdminEnabled, chartBuilderTitle, runQueryOnMount, onAddToDashboardComplete, onSaveQueryComplete, addToDashboardButtonLabel, report, organizationName, isChartBuilderHorizontalView, containerStyle, className, onClickChartElement, onRequestAddVirtualTable, }: SQLEditorProps): react_jsx_runtime.JSX.Element;
|
|
1877
|
+
declare function SQLEditor({ ButtonComponent, SecondaryButtonComponent, DeleteButtonComponent, TextInputComponent, SelectComponent, TableComponent, isNewQueryEnabled, LoadingComponent, ModalComponent, PopoverComponent, CardComponent, LabelComponent, HeaderComponent, SubHeaderComponent, TextComponent, ErrorMessageComponent, ChartBuilderInputRowContainer, ChartBuilderInputColumnContainer, PivotRowContainer, PivotColumnContainer, ChartBuilderFormContainer, CheckboxComponent, defaultQuery, destinationDashboard, destinationSection, onChangeQuery, onChangeData, onChangeColumns, onChangeFields, onDiscardChanges, onSaveChanges, onCloseChartBuilder, isChartBuilderEnabled, isAdminEnabled, chartBuilderOptions, chartBuilderTitle, runQueryOnMount, onAddToDashboardComplete, onSubmitCreateReport, onSubmitEditReport, onSaveQueryComplete, addToDashboardButtonLabel, report, reportId, organizationName, isChartBuilderHorizontalView, containerStyle, className, onClickChartElement, onRequestAddVirtualTable, }: SQLEditorProps): react_jsx_runtime.JSX.Element;
|
|
1860
1878
|
declare const SchemaListComponent: ({ schema, theme, loading, LoadingComponent, width, onClick, style, onRequestAddVirtualTable, ButtonComponent, }: {
|
|
1861
1879
|
schema: any;
|
|
1862
1880
|
theme: any;
|
|
@@ -2126,6 +2144,15 @@ interface ReportBuilderProps {
|
|
|
2126
2144
|
isAIEnabled?: boolean;
|
|
2127
2145
|
/** Whether the PivotModal's AI features are enabled. */
|
|
2128
2146
|
pivotRecommendationsEnabled?: boolean;
|
|
2147
|
+
/**
|
|
2148
|
+
* Options for the chart builder modal.
|
|
2149
|
+
*/
|
|
2150
|
+
chartBuilderOptions?: {
|
|
2151
|
+
/** Whether to show table format options. */
|
|
2152
|
+
showTableFormatOptions?: boolean;
|
|
2153
|
+
/** Whether to show dashboard filter fields. */
|
|
2154
|
+
showDashboardFilterFields?: boolean;
|
|
2155
|
+
};
|
|
2129
2156
|
/**
|
|
2130
2157
|
* Applies the following classes to the ReportBuilder.
|
|
2131
2158
|
*
|
|
@@ -2195,7 +2222,7 @@ interface ReportBuilderProps {
|
|
|
2195
2222
|
* ### Report Builder API
|
|
2196
2223
|
* @see https://docs.quillsql.com/components/report-builder
|
|
2197
2224
|
*/
|
|
2198
|
-
declare function ReportBuilder$1({ initialTableName, onSubmitEditReport, onSubmitCreateReport, onSubmitSaveQuery, onDiscardChanges, onSaveChanges, onCloseChartBuilder, destinationDashboard, destinationSection, chartBuilderTitle, organizationName, ButtonComponent, SecondaryButtonComponent, DeleteButtonComponent, ModalComponent, TextInputComponent, SelectComponent, MultiSelectComponent, TableComponent, PopoverComponent, TabsComponent, CheckboxComponent, SidebarComponent, ContainerComponent, SelectColumnComponent, DraggableColumnComponent, SidebarHeadingComponent, FilterPopoverComponent, SortPopoverComponent, LimitPopoverComponent, CardComponent, LabelComponent, HeaderComponent, SubHeaderComponent, TextComponent, ErrorMessageComponent, ChartBuilderInputRowContainer, ChartBuilderInputColumnContainer, PivotRowContainer, PivotColumnContainer, LoadingComponent, ColumnSearchEmptyState, ChartBuilderFormContainer, ChartBuilderModalComponent, isAdminEnabled, isAIEnabled, containerStyle, className, pivotRecommendationsEnabled, reportId, hideCopySQL, isChartBuilderHorizontalView, onClickChartElement, onRequestAddVirtualTable, submitButtonLabel, }: ReportBuilderProps): react_jsx_runtime.JSX.Element;
|
|
2225
|
+
declare function ReportBuilder$1({ initialTableName, onSubmitEditReport, onSubmitCreateReport, onSubmitSaveQuery, onDiscardChanges, onSaveChanges, onCloseChartBuilder, destinationDashboard, destinationSection, chartBuilderTitle, organizationName, ButtonComponent, SecondaryButtonComponent, DeleteButtonComponent, ModalComponent, TextInputComponent, SelectComponent, MultiSelectComponent, TableComponent, PopoverComponent, TabsComponent, CheckboxComponent, SidebarComponent, ContainerComponent, SelectColumnComponent, DraggableColumnComponent, SidebarHeadingComponent, FilterPopoverComponent, SortPopoverComponent, LimitPopoverComponent, CardComponent, LabelComponent, HeaderComponent, SubHeaderComponent, TextComponent, ErrorMessageComponent, ChartBuilderInputRowContainer, ChartBuilderInputColumnContainer, PivotRowContainer, PivotColumnContainer, LoadingComponent, ColumnSearchEmptyState, ChartBuilderFormContainer, ChartBuilderModalComponent, isAdminEnabled, isAIEnabled, containerStyle, className, pivotRecommendationsEnabled, chartBuilderOptions, reportId, hideCopySQL, isChartBuilderHorizontalView, onClickChartElement, onRequestAddVirtualTable, submitButtonLabel, }: ReportBuilderProps): react_jsx_runtime.JSX.Element;
|
|
2199
2226
|
|
|
2200
2227
|
/**
|
|
2201
2228
|
* Props for the Quill ChartEditor component.
|
|
@@ -3260,6 +3287,10 @@ interface SaveReportProps {
|
|
|
3260
3287
|
onSubmitCreateReport?: (report: QuillReport) => void;
|
|
3261
3288
|
/** The destination section for the report. */
|
|
3262
3289
|
destinationSection?: string;
|
|
3290
|
+
/** Whether to show table format options. */
|
|
3291
|
+
showTableFormatOptions?: boolean;
|
|
3292
|
+
/** Whether to show dashboard filter fields. */
|
|
3293
|
+
showDashboardFilterFields?: boolean;
|
|
3263
3294
|
/** A select component. */
|
|
3264
3295
|
SelectComponent?: (props: {
|
|
3265
3296
|
value: string | number | undefined | null;
|
|
@@ -3399,7 +3430,7 @@ interface SaveReportProps {
|
|
|
3399
3430
|
/** The label for the submit button. */
|
|
3400
3431
|
submitButtonLabel?: string;
|
|
3401
3432
|
}
|
|
3402
|
-
declare const SaveReport: ({ reportBuilder, isOpen, setIsOpen, isAdminEnabled, chartBuilderTitle, onSubmitEditReport, onSubmitCreateReport, destinationSection, SelectComponent, TextInputComponent, ButtonComponent, SecondaryButtonComponent, HeaderComponent, SubHeaderComponent, LabelComponent, TextComponent, CardComponent, ModalComponent, PopoverComponent, TableComponent, DeleteButtonComponent, LoadingComponent, ChartBuilderInputRowContainer, ChartBuilderInputColumnContainer, PivotRowContainer, PivotColumnContainer, ErrorMessageComponent, CheckboxComponent, ChartBuilderFormContainer, onClickChartElement, SaveTrigger, submitButtonLabel, }: SaveReportProps) => react_jsx_runtime.JSX.Element;
|
|
3433
|
+
declare const SaveReport: ({ reportBuilder, isOpen, setIsOpen, isAdminEnabled, chartBuilderTitle, onSubmitEditReport, onSubmitCreateReport, destinationSection, showTableFormatOptions, showDashboardFilterFields, SelectComponent, TextInputComponent, ButtonComponent, SecondaryButtonComponent, HeaderComponent, SubHeaderComponent, LabelComponent, TextComponent, CardComponent, ModalComponent, PopoverComponent, TableComponent, DeleteButtonComponent, LoadingComponent, ChartBuilderInputRowContainer, ChartBuilderInputColumnContainer, PivotRowContainer, PivotColumnContainer, ErrorMessageComponent, CheckboxComponent, ChartBuilderFormContainer, onClickChartElement, SaveTrigger, submitButtonLabel, }: SaveReportProps) => react_jsx_runtime.JSX.Element;
|
|
3403
3434
|
|
|
3404
3435
|
interface ReportTableProps {
|
|
3405
3436
|
reportBuilder: ReportBuilder;
|
package/dist/index.js
CHANGED
|
@@ -620,12 +620,9 @@ var formatPercent = (value) => {
|
|
|
620
620
|
return formatterPercent.format(Number(value));
|
|
621
621
|
};
|
|
622
622
|
var _getUTCDateHelper = (value, fmt) => {
|
|
623
|
-
if (value === null || value === void 0) {
|
|
624
|
-
return "-";
|
|
625
|
-
}
|
|
626
623
|
const parsedDate = parse(value, fmt, /* @__PURE__ */ new Date());
|
|
627
624
|
const utcDate = isValid(parsedDate) ? utcToZonedTime(parsedDate, "UTC") : utcToZonedTime(new Date(value), "UTC");
|
|
628
|
-
if (!isValid(utcDate)) return
|
|
625
|
+
if (!isValid(utcDate)) return value;
|
|
629
626
|
return format(utcDate, fmt);
|
|
630
627
|
};
|
|
631
628
|
var format_YYYY = (value) => _getUTCDateHelper(value, "yyyy");
|
|
@@ -636,11 +633,8 @@ var format_MMM_dd_yyyy = (value) => {
|
|
|
636
633
|
return _getUTCDateHelper(value, "dd MMM yyyy");
|
|
637
634
|
};
|
|
638
635
|
var format_MMM_d_MMM_d = (value, dateRange, databaseType) => {
|
|
639
|
-
if (value === null || value === void 0) {
|
|
640
|
-
return "-";
|
|
641
|
-
}
|
|
642
636
|
const utcDate = parseISO(value.split("T")[0]);
|
|
643
|
-
if (!isValid(utcDate)) return "
|
|
637
|
+
if (!isValid(utcDate)) return "Invalid date";
|
|
644
638
|
let weekStartsOn = 1;
|
|
645
639
|
if (databaseType && ["mssql"].includes(databaseType)) {
|
|
646
640
|
weekStartsOn = 0;
|
|
@@ -671,21 +665,15 @@ var format_MMM_d_MMM_d = (value, dateRange, databaseType) => {
|
|
|
671
665
|
}
|
|
672
666
|
};
|
|
673
667
|
var format_MMM_dd_hh_mm_ap_pm = (value) => {
|
|
674
|
-
if (value === null || value === void 0) {
|
|
675
|
-
return "-";
|
|
676
|
-
}
|
|
677
668
|
const utcDate = utcToZonedTime(new Date(value), "UTC");
|
|
678
|
-
if (!isValid(utcDate)) return "
|
|
669
|
+
if (!isValid(utcDate)) return "Invalid date";
|
|
679
670
|
const formatStr = utcDate.getMinutes() === 0 ? "MMM do h a" : "MMM do h:mm a";
|
|
680
671
|
const res = format(utcDate, formatStr);
|
|
681
672
|
return res.slice(0, -2) + res.slice(-2).toLowerCase();
|
|
682
673
|
};
|
|
683
674
|
var format_wo_yyyy = (value) => {
|
|
684
|
-
if (value === null || value === void 0) {
|
|
685
|
-
return "-";
|
|
686
|
-
}
|
|
687
675
|
const utcDate = utcToZonedTime(new Date(value), "UTC");
|
|
688
|
-
if (!isValid(utcDate)) return "
|
|
676
|
+
if (!isValid(utcDate)) return "Invalid date";
|
|
689
677
|
return `${getWeek(utcDate)},${utcDate.getFullYear()}`;
|
|
690
678
|
};
|
|
691
679
|
function parseNumber(value) {
|
|
@@ -28396,7 +28384,7 @@ var ChartTooltipPrimary = (props) => /* @__PURE__ */ jsxs22(ChartTooltipFrame2,
|
|
|
28396
28384
|
paddingTop: 2,
|
|
28397
28385
|
paddingBottom: 2
|
|
28398
28386
|
},
|
|
28399
|
-
children:
|
|
28387
|
+
children: !isNaN(new Date(props.label)) && props.dateFormatter ? props.dateFormatter(props.label) : !isNaN(new Date(props.label)) ? format6(new Date(props.label), "MMM yyyy") : props.label
|
|
28400
28388
|
}
|
|
28401
28389
|
)
|
|
28402
28390
|
}
|
|
@@ -28445,9 +28433,9 @@ function reformatComparisonPayload(props, primaryLabel, comparisonLabel) {
|
|
|
28445
28433
|
const nameKey = isComparison ? `comparison_${props.xAxisField}` : props.xAxisField;
|
|
28446
28434
|
const days = LABEL_TO_DAYS[primaryLabel] ?? 0;
|
|
28447
28435
|
const primaryDate = item.payload[props.xAxisField] ?? 0;
|
|
28448
|
-
const compDate =
|
|
28436
|
+
const compDate = subDays2(new Date(primaryDate), days + 1);
|
|
28449
28437
|
const date = item.payload[nameKey] ?? format6(compDate, props.xAxisFormat);
|
|
28450
|
-
const name2 = props.dateFormatter
|
|
28438
|
+
const name2 = props.dateFormatter(date);
|
|
28451
28439
|
const color2 = item.color;
|
|
28452
28440
|
const value = props.valueFormatter(item.value, item.name);
|
|
28453
28441
|
if (!columnsByKey[""]) {
|
|
@@ -28479,7 +28467,7 @@ function reformatComparisonPayload(props, primaryLabel, comparisonLabel) {
|
|
|
28479
28467
|
return columnsByKey;
|
|
28480
28468
|
}
|
|
28481
28469
|
function getTooltipLabel(props, altTooltipLabel, isDateXAxis) {
|
|
28482
|
-
return props.payload.length <= 2 && altTooltipLabel && isDateXAxis ?
|
|
28470
|
+
return props.payload.length <= 2 && altTooltipLabel && isDateXAxis ? !isNaN(new Date(altTooltipLabel)) && props.dateFormatter ? props.dateFormatter(altTooltipLabel) : !isNaN(new Date(altTooltipLabel)) ? format6(new Date(altTooltipLabel), "MMM yyyy") : altTooltipLabel : !isNaN(new Date(props.label)) && props.dateFormatter ? props.dateFormatter(props.label) : !isNaN(new Date(props.label)) ? format6(new Date(props.label), "MMM yyyy") : props.label;
|
|
28483
28471
|
}
|
|
28484
28472
|
function ChartTooltipComparison(props) {
|
|
28485
28473
|
const isDateXAxis = isDateFormat(props.xAxisFormat);
|
|
@@ -31734,23 +31722,53 @@ function QuillMetricComponent({
|
|
|
31734
31722
|
width: "100%"
|
|
31735
31723
|
}
|
|
31736
31724
|
}
|
|
31737
|
-
) : !report?.rows?.[0] || report.rows[0][report.xAxisField] ===
|
|
31725
|
+
) : !report?.rows || report?.rows?.length === 0 || report.rows[0]?.[report.xAxisField] === null || report.rows[0]?.[report.xAxisField] === void 0 ? /* @__PURE__ */ jsx43(
|
|
31738
31726
|
"div",
|
|
31739
31727
|
{
|
|
31740
31728
|
style: {
|
|
31741
|
-
|
|
31742
|
-
|
|
31743
|
-
|
|
31744
|
-
|
|
31745
|
-
|
|
31746
|
-
alignItems: "center",
|
|
31747
|
-
fontSize: 13,
|
|
31748
|
-
fontFamily: theme?.fontFamily,
|
|
31749
|
-
color: theme?.secondaryTextColor,
|
|
31750
|
-
maxWidth: "100%",
|
|
31751
|
-
width: "100%"
|
|
31729
|
+
padding: 0,
|
|
31730
|
+
height: "100%",
|
|
31731
|
+
width: "100%",
|
|
31732
|
+
boxSizing: "content-box",
|
|
31733
|
+
flex: 1
|
|
31752
31734
|
},
|
|
31753
|
-
children:
|
|
31735
|
+
children: /* @__PURE__ */ jsx43(
|
|
31736
|
+
"div",
|
|
31737
|
+
{
|
|
31738
|
+
style: {
|
|
31739
|
+
fontFamily: theme?.fontFamily,
|
|
31740
|
+
fontSize: 32,
|
|
31741
|
+
color: theme?.primaryTextColor,
|
|
31742
|
+
fontWeight: "600",
|
|
31743
|
+
textOverflow: "ellipsis",
|
|
31744
|
+
margin: 0,
|
|
31745
|
+
whiteSpace: "nowrap",
|
|
31746
|
+
boxSizing: "content-box",
|
|
31747
|
+
maxWidth: "100%",
|
|
31748
|
+
textAlign: "left",
|
|
31749
|
+
overflow: "hidden",
|
|
31750
|
+
height: "100%",
|
|
31751
|
+
minHeight: "80px",
|
|
31752
|
+
display: "flex",
|
|
31753
|
+
width: "100%",
|
|
31754
|
+
flexDirection: "row",
|
|
31755
|
+
justifyContent: "center",
|
|
31756
|
+
alignItems: "center"
|
|
31757
|
+
},
|
|
31758
|
+
children: /* @__PURE__ */ jsx43(
|
|
31759
|
+
"span",
|
|
31760
|
+
{
|
|
31761
|
+
style: {
|
|
31762
|
+
fontFamily: theme?.fontFamily,
|
|
31763
|
+
fontSize: 13,
|
|
31764
|
+
color: theme?.secondaryTextColor,
|
|
31765
|
+
fontWeight: "normal"
|
|
31766
|
+
},
|
|
31767
|
+
children: "No results"
|
|
31768
|
+
}
|
|
31769
|
+
)
|
|
31770
|
+
}
|
|
31771
|
+
)
|
|
31754
31772
|
}
|
|
31755
31773
|
) : /* @__PURE__ */ jsx43(
|
|
31756
31774
|
MetricDisplay,
|
|
@@ -32941,7 +32959,7 @@ function USMap({
|
|
|
32941
32959
|
acc[curr[xAxisField]?.toString()] = curr;
|
|
32942
32960
|
return acc;
|
|
32943
32961
|
}, {});
|
|
32944
|
-
const measureField = yAxisFields[0]
|
|
32962
|
+
const measureField = yAxisFields[0]?.field;
|
|
32945
32963
|
const [scaleLog, setScaleLog] = useState14(null);
|
|
32946
32964
|
useEffect12(() => {
|
|
32947
32965
|
import("d3-scale").then((scale) => {
|
|
@@ -32977,6 +32995,29 @@ function USMap({
|
|
|
32977
32995
|
const hoveredValue = useMemo12(() => {
|
|
32978
32996
|
return !hoveredState ? void 0 : mappedData[fipsToNames[hoveredState]?.abbreviation ?? ""]?.[measureField] ?? mappedData[fipsToNames[hoveredState]?.name ?? ""]?.[measureField] ?? mappedData[fipsToNames[hoveredState]?.abbreviation?.toLowerCase() ?? ""]?.[measureField] ?? mappedData[fipsToNames[hoveredState]?.name?.toLowerCase() ?? ""]?.[measureField];
|
|
32979
32997
|
}, [hoveredState, mappedData, measureField]);
|
|
32998
|
+
if (!measureField) {
|
|
32999
|
+
return /* @__PURE__ */ jsx45(
|
|
33000
|
+
"div",
|
|
33001
|
+
{
|
|
33002
|
+
style: {
|
|
33003
|
+
display: "flex",
|
|
33004
|
+
flex: "1 0 auto",
|
|
33005
|
+
marginLeft: "auto",
|
|
33006
|
+
marginRight: "auto",
|
|
33007
|
+
marginTop: "auto",
|
|
33008
|
+
marginBottom: "auto",
|
|
33009
|
+
justifyContent: "center",
|
|
33010
|
+
alignItems: "center",
|
|
33011
|
+
fontSize: 13,
|
|
33012
|
+
color: theme?.secondaryTextColor,
|
|
33013
|
+
fontFamily: theme?.fontFamily,
|
|
33014
|
+
...containerStyle
|
|
33015
|
+
},
|
|
33016
|
+
className,
|
|
33017
|
+
children: "No results"
|
|
33018
|
+
}
|
|
33019
|
+
);
|
|
33020
|
+
}
|
|
32980
33021
|
return /* @__PURE__ */ jsxs34(
|
|
32981
33022
|
"div",
|
|
32982
33023
|
{
|
|
@@ -33109,7 +33150,7 @@ function WorldMap({
|
|
|
33109
33150
|
acc[curr[xAxisField]?.toString()] = curr;
|
|
33110
33151
|
return acc;
|
|
33111
33152
|
}, {});
|
|
33112
|
-
const measureField = yAxisFields[0]
|
|
33153
|
+
const measureField = yAxisFields[0]?.field;
|
|
33113
33154
|
const [scaleLog, setScaleLog] = useState14(null);
|
|
33114
33155
|
useEffect12(() => {
|
|
33115
33156
|
import("d3-scale").then((scale) => {
|
|
@@ -33145,6 +33186,29 @@ function WorldMap({
|
|
|
33145
33186
|
const hoveredValue = useMemo12(() => {
|
|
33146
33187
|
return !hoveredCountry ? void 0 : mappedData[isoToNames[hoveredCountry]?.abbreviation ?? ""]?.[measureField] ?? mappedData[isoToNames[hoveredCountry]?.name ?? ""]?.[measureField] ?? mappedData[isoToNames[hoveredCountry]?.abbreviation?.toLowerCase() ?? ""]?.[measureField] ?? mappedData[isoToNames[hoveredCountry]?.name?.toLowerCase() ?? ""]?.[measureField];
|
|
33147
33188
|
}, [hoveredCountry, mappedData, measureField]);
|
|
33189
|
+
if (!measureField) {
|
|
33190
|
+
return /* @__PURE__ */ jsx45(
|
|
33191
|
+
"div",
|
|
33192
|
+
{
|
|
33193
|
+
style: {
|
|
33194
|
+
display: "flex",
|
|
33195
|
+
flex: "1 0 auto",
|
|
33196
|
+
marginLeft: "auto",
|
|
33197
|
+
marginRight: "auto",
|
|
33198
|
+
marginTop: "auto",
|
|
33199
|
+
marginBottom: "auto",
|
|
33200
|
+
justifyContent: "center",
|
|
33201
|
+
alignItems: "center",
|
|
33202
|
+
fontSize: 13,
|
|
33203
|
+
color: theme?.secondaryTextColor,
|
|
33204
|
+
fontFamily: theme?.fontFamily,
|
|
33205
|
+
...containerStyle
|
|
33206
|
+
},
|
|
33207
|
+
className,
|
|
33208
|
+
children: "No results"
|
|
33209
|
+
}
|
|
33210
|
+
);
|
|
33211
|
+
}
|
|
33148
33212
|
return /* @__PURE__ */ jsxs34(
|
|
33149
33213
|
"div",
|
|
33150
33214
|
{
|
|
@@ -35652,27 +35716,41 @@ var ChartDisplay = ({
|
|
|
35652
35716
|
);
|
|
35653
35717
|
}
|
|
35654
35718
|
if (config?.chartType?.toLowerCase() === "metric") {
|
|
35655
|
-
if (!config?.rows || config?.rows?.length === 0 ||
|
|
35656
|
-
config?.rows[0][config?.xAxisField] === null) {
|
|
35719
|
+
if (!config?.rows || config?.rows?.length === 0 || config?.rows[0]?.[config?.xAxisField] === null || config?.rows[0]?.[config?.xAxisField] === void 0) {
|
|
35657
35720
|
return /* @__PURE__ */ jsx48(
|
|
35658
35721
|
"div",
|
|
35659
35722
|
{
|
|
35660
35723
|
style: {
|
|
35661
|
-
display: "flex",
|
|
35662
|
-
flex: "1 0 auto",
|
|
35663
|
-
// height: containerStyle?.height || '100%',
|
|
35664
|
-
margin: "auto",
|
|
35665
|
-
justifyContent: "center",
|
|
35666
|
-
alignItems: "center",
|
|
35667
|
-
fontSize: 13,
|
|
35668
35724
|
fontFamily: theme?.fontFamily,
|
|
35669
|
-
|
|
35725
|
+
fontSize: 32,
|
|
35726
|
+
color: theme?.primaryTextColor,
|
|
35727
|
+
fontWeight: "600",
|
|
35728
|
+
textOverflow: "ellipsis",
|
|
35729
|
+
margin: 0,
|
|
35730
|
+
whiteSpace: "nowrap",
|
|
35731
|
+
boxSizing: "content-box",
|
|
35670
35732
|
maxWidth: "100%",
|
|
35733
|
+
textAlign: "left",
|
|
35734
|
+
overflow: "hidden",
|
|
35735
|
+
height: containerStyle?.height || "100%",
|
|
35736
|
+
display: "flex",
|
|
35671
35737
|
width: "100%",
|
|
35738
|
+
flexDirection: "row",
|
|
35739
|
+
alignItems: "center",
|
|
35672
35740
|
...containerStyle
|
|
35673
35741
|
},
|
|
35674
35742
|
className,
|
|
35675
|
-
children:
|
|
35743
|
+
children: /* @__PURE__ */ jsx48(
|
|
35744
|
+
"span",
|
|
35745
|
+
{
|
|
35746
|
+
style: {
|
|
35747
|
+
fontFamily: theme?.fontFamily,
|
|
35748
|
+
fontSize: 13,
|
|
35749
|
+
color: theme?.secondaryTextColor
|
|
35750
|
+
},
|
|
35751
|
+
children: "No results"
|
|
35752
|
+
}
|
|
35753
|
+
)
|
|
35676
35754
|
}
|
|
35677
35755
|
);
|
|
35678
35756
|
}
|
|
@@ -42625,15 +42703,19 @@ function ChartBuilderWithModal(props) {
|
|
|
42625
42703
|
title: title || "Add to dashboard",
|
|
42626
42704
|
width: isHorizontalView ? modalWidth : void 0,
|
|
42627
42705
|
height: isHorizontalView ? modalHeight : void 0,
|
|
42628
|
-
children: (
|
|
42629
|
-
|
|
42630
|
-
|
|
42631
|
-
|
|
42632
|
-
|
|
42633
|
-
|
|
42634
|
-
|
|
42635
|
-
|
|
42636
|
-
|
|
42706
|
+
children: (() => {
|
|
42707
|
+
const resolvedReport = props.reportId ? dashboard[props.reportId] ?? props.tempReport : props.tempReport;
|
|
42708
|
+
return resolvedReport ? /* @__PURE__ */ jsx65(
|
|
42709
|
+
ChartBuilder,
|
|
42710
|
+
{
|
|
42711
|
+
...props,
|
|
42712
|
+
tempReport: resolvedReport,
|
|
42713
|
+
filtersEnabled: filtersEnabledState,
|
|
42714
|
+
onFiltersEnabledChanged: setFiltersEnabledState,
|
|
42715
|
+
runQueryOnMount: filtersEnabledState
|
|
42716
|
+
}
|
|
42717
|
+
) : /* @__PURE__ */ jsx65("div", { style: { padding: 20 }, children: /* @__PURE__ */ jsx65(QuillLoadingComponent, {}) });
|
|
42718
|
+
})()
|
|
42637
42719
|
}
|
|
42638
42720
|
) });
|
|
42639
42721
|
}
|
|
@@ -42683,6 +42765,7 @@ function ChartBuilder({
|
|
|
42683
42765
|
hideSubmitButton = false,
|
|
42684
42766
|
hideDateRangeFilter = false,
|
|
42685
42767
|
showTableFormatOptions,
|
|
42768
|
+
showDashboardFilterFields,
|
|
42686
42769
|
initialUniqueValues,
|
|
42687
42770
|
initialUniqueValuesIsLoading,
|
|
42688
42771
|
pivotRecommendationsEnabled = true,
|
|
@@ -42712,7 +42795,7 @@ function ChartBuilder({
|
|
|
42712
42795
|
const { tenants, flags } = useContext26(TenantContext);
|
|
42713
42796
|
const report = useMemo21(() => {
|
|
42714
42797
|
return reportId && !tempReport ? allReportsById[reportId] : tempReport;
|
|
42715
|
-
}, [reportId]);
|
|
42798
|
+
}, [reportId, tempReport, allReportsById]);
|
|
42716
42799
|
const [windowWidth, setWindowWidth] = useState28(1200);
|
|
42717
42800
|
const [rows, setRows] = useState28(report?.rows ?? []);
|
|
42718
42801
|
const [itemQuery, setItemQuery] = useState28(report?.itemQuery);
|
|
@@ -45205,7 +45288,7 @@ function ChartBuilder({
|
|
|
45205
45288
|
]
|
|
45206
45289
|
}
|
|
45207
45290
|
),
|
|
45208
|
-
specificDashboardFilters.length > 0 && isAdmin && /* @__PURE__ */ jsxs47(
|
|
45291
|
+
specificDashboardFilters.length > 0 && (showDashboardFilterFields || isAdmin) && /* @__PURE__ */ jsxs47(
|
|
45209
45292
|
"div",
|
|
45210
45293
|
{
|
|
45211
45294
|
style: {
|
|
@@ -45216,7 +45299,7 @@ function ChartBuilder({
|
|
|
45216
45299
|
},
|
|
45217
45300
|
children: [
|
|
45218
45301
|
/* @__PURE__ */ jsx65(HeaderComponent, { label: "Dashboard filter fields" }),
|
|
45219
|
-
isAdmin && formData.dateField && dashboardConfig[formData.dashboardName ?? destinationDashboardName ?? ""]?.config.dateFilter?.label && /* @__PURE__ */ jsxs47(ChartBuilderInputRowContainer, { children: [
|
|
45302
|
+
(showDashboardFilterFields || isAdmin) && formData.dateField && dashboardConfig[formData.dashboardName ?? destinationDashboardName ?? ""]?.config.dateFilter?.label && /* @__PURE__ */ jsxs47(ChartBuilderInputRowContainer, { children: [
|
|
45220
45303
|
/* @__PURE__ */ jsx65(
|
|
45221
45304
|
TextInputComponent,
|
|
45222
45305
|
{
|
|
@@ -46155,6 +46238,7 @@ function SQLEditor({
|
|
|
46155
46238
|
CheckboxComponent = QuillChartBuilderCheckboxComponent,
|
|
46156
46239
|
defaultQuery,
|
|
46157
46240
|
destinationDashboard,
|
|
46241
|
+
destinationSection,
|
|
46158
46242
|
onChangeQuery,
|
|
46159
46243
|
onChangeData,
|
|
46160
46244
|
onChangeColumns,
|
|
@@ -46164,12 +46248,16 @@ function SQLEditor({
|
|
|
46164
46248
|
onCloseChartBuilder,
|
|
46165
46249
|
isChartBuilderEnabled = false,
|
|
46166
46250
|
isAdminEnabled = false,
|
|
46251
|
+
chartBuilderOptions,
|
|
46167
46252
|
chartBuilderTitle,
|
|
46168
46253
|
runQueryOnMount = false,
|
|
46169
46254
|
onAddToDashboardComplete,
|
|
46255
|
+
onSubmitCreateReport,
|
|
46256
|
+
onSubmitEditReport,
|
|
46170
46257
|
onSaveQueryComplete,
|
|
46171
46258
|
addToDashboardButtonLabel = "Add to dashboard",
|
|
46172
46259
|
report = void 0,
|
|
46260
|
+
reportId = void 0,
|
|
46173
46261
|
organizationName = void 0,
|
|
46174
46262
|
isChartBuilderHorizontalView = true,
|
|
46175
46263
|
containerStyle = { height: "100vh" },
|
|
@@ -46180,7 +46268,7 @@ function SQLEditor({
|
|
|
46180
46268
|
const [sqlPrompt, setSqlPrompt] = useState30("");
|
|
46181
46269
|
const [client] = useContext28(ClientContext);
|
|
46182
46270
|
const [theme] = useContext28(ThemeContext);
|
|
46183
|
-
const { tenants } = useContext28(TenantContext);
|
|
46271
|
+
const { tenants, flags } = useContext28(TenantContext);
|
|
46184
46272
|
const { dashboards } = useDashboards();
|
|
46185
46273
|
const {
|
|
46186
46274
|
data,
|
|
@@ -46189,6 +46277,7 @@ function SQLEditor({
|
|
|
46189
46277
|
} = useDashboardInternal(destinationDashboard);
|
|
46190
46278
|
const { getToken, quillFetchWithToken } = useContext28(FetchContext);
|
|
46191
46279
|
const { eventTracking } = useContext28(EventTrackingContext);
|
|
46280
|
+
const { allReportsById } = useAllReports();
|
|
46192
46281
|
const destinationDashboardConfig = useMemo22(() => {
|
|
46193
46282
|
return dashboards?.find((d) => d.name === destinationDashboard);
|
|
46194
46283
|
}, [dashboards, destinationDashboard]);
|
|
@@ -46256,6 +46345,46 @@ function SQLEditor({
|
|
|
46256
46345
|
reload();
|
|
46257
46346
|
}
|
|
46258
46347
|
}, [data, dashboardIsLoading]);
|
|
46348
|
+
useEffect24(() => {
|
|
46349
|
+
const loadReport = async () => {
|
|
46350
|
+
let reportToLoad;
|
|
46351
|
+
if (!client) {
|
|
46352
|
+
return;
|
|
46353
|
+
}
|
|
46354
|
+
try {
|
|
46355
|
+
if (!reportId) {
|
|
46356
|
+
throw new Error("Report ID is required");
|
|
46357
|
+
}
|
|
46358
|
+
reportToLoad = allReportsById[reportId];
|
|
46359
|
+
if (!reportToLoad) {
|
|
46360
|
+
throw new Error("Report not found");
|
|
46361
|
+
}
|
|
46362
|
+
setQuery(reportToLoad.queryString || "");
|
|
46363
|
+
setTempReport(reportToLoad);
|
|
46364
|
+
if (reportToLoad.rows && reportToLoad.rows.length > 0) {
|
|
46365
|
+
setRows(reportToLoad.rows);
|
|
46366
|
+
setDisplayTable(true);
|
|
46367
|
+
}
|
|
46368
|
+
} catch (err) {
|
|
46369
|
+
console.error(err);
|
|
46370
|
+
eventTracking?.logError?.({
|
|
46371
|
+
type: "bug",
|
|
46372
|
+
severity: "high",
|
|
46373
|
+
message: "Error loading report",
|
|
46374
|
+
errorMessage: err.message,
|
|
46375
|
+
errorStack: err.stack,
|
|
46376
|
+
errorData: {
|
|
46377
|
+
caller: "SQLEditor",
|
|
46378
|
+
function: "loadReport"
|
|
46379
|
+
}
|
|
46380
|
+
});
|
|
46381
|
+
setErrorMessage("Error when loading report");
|
|
46382
|
+
}
|
|
46383
|
+
};
|
|
46384
|
+
if (reportId && client) {
|
|
46385
|
+
loadReport();
|
|
46386
|
+
}
|
|
46387
|
+
}, [allReportsById[reportId || ""], client]);
|
|
46259
46388
|
const dynamicHeight = tableRef.current ? tableRef.current.clientHeight : cachedHeight;
|
|
46260
46389
|
const rowsPerPage = Math.max(
|
|
46261
46390
|
DEFAULT_ROWS_PER_PAGE,
|
|
@@ -47074,13 +47203,38 @@ function SQLEditor({
|
|
|
47074
47203
|
isHorizontalView: isChartBuilderHorizontalView,
|
|
47075
47204
|
isOpen: isChartBuilderOpen,
|
|
47076
47205
|
setIsOpen: setIsChartBuilderOpen,
|
|
47077
|
-
onAddToDashboardComplete
|
|
47206
|
+
onAddToDashboardComplete: reportId || report?.id ? (data2) => {
|
|
47207
|
+
if (onSubmitEditReport) {
|
|
47208
|
+
onSubmitEditReport(data2);
|
|
47209
|
+
} else if (onAddToDashboardComplete) {
|
|
47210
|
+
onAddToDashboardComplete(data2);
|
|
47211
|
+
}
|
|
47212
|
+
if (!isAdminEnabled && destinationDashboard) {
|
|
47213
|
+
reload(destinationDashboard, false, {
|
|
47214
|
+
report: data2,
|
|
47215
|
+
action: "upsert"
|
|
47216
|
+
});
|
|
47217
|
+
}
|
|
47218
|
+
} : (data2) => {
|
|
47219
|
+
if (onSubmitCreateReport) {
|
|
47220
|
+
onSubmitCreateReport(data2);
|
|
47221
|
+
} else if (onAddToDashboardComplete) {
|
|
47222
|
+
onAddToDashboardComplete(data2);
|
|
47223
|
+
}
|
|
47224
|
+
if (!isAdminEnabled && destinationDashboard) {
|
|
47225
|
+
reload(destinationDashboard, false, {
|
|
47226
|
+
report: data2,
|
|
47227
|
+
action: "upsert"
|
|
47228
|
+
});
|
|
47229
|
+
}
|
|
47230
|
+
},
|
|
47078
47231
|
destinationDashboard,
|
|
47232
|
+
destinationSection,
|
|
47079
47233
|
isAdmin: isAdminEnabled,
|
|
47080
47234
|
title: chartBuilderTitle,
|
|
47081
47235
|
buttonLabel: addToDashboardButtonLabel,
|
|
47082
47236
|
tempReport,
|
|
47083
|
-
reportId: report?.id,
|
|
47237
|
+
reportId: reportId || report?.id,
|
|
47084
47238
|
organizationName,
|
|
47085
47239
|
CardComponent,
|
|
47086
47240
|
TableComponent,
|
|
@@ -47105,6 +47259,8 @@ function SQLEditor({
|
|
|
47105
47259
|
CheckboxComponent,
|
|
47106
47260
|
hideDateRangeFilter: true,
|
|
47107
47261
|
hideDeleteButton: true,
|
|
47262
|
+
showTableFormatOptions: chartBuilderOptions?.showTableFormatOptions,
|
|
47263
|
+
showDashboardFilterFields: chartBuilderOptions?.showDashboardFilterFields,
|
|
47108
47264
|
onClickChartElement,
|
|
47109
47265
|
isEditingMode: true
|
|
47110
47266
|
}
|
|
@@ -47124,7 +47280,7 @@ function SQLEditor({
|
|
|
47124
47280
|
isAdmin: false,
|
|
47125
47281
|
title: "Save query",
|
|
47126
47282
|
buttonLabel: "Save query",
|
|
47127
|
-
tempReport,
|
|
47283
|
+
tempReport: { ...tempReport, dashboardName: SAVED_QUERIES_DASHBOARD },
|
|
47128
47284
|
reportId: report?.id,
|
|
47129
47285
|
organizationName,
|
|
47130
47286
|
CardComponent,
|
|
@@ -48892,7 +49048,6 @@ var useReportBuilderInternal = ({
|
|
|
48892
49048
|
}
|
|
48893
49049
|
report = allReportsById[reportId];
|
|
48894
49050
|
if (!report) {
|
|
48895
|
-
console.log("no report");
|
|
48896
49051
|
throw new Error("Report not found");
|
|
48897
49052
|
}
|
|
48898
49053
|
const { ast: newAst, pivot: newPivot } = await fetchASTFromQuillReport(
|
|
@@ -51442,6 +51597,8 @@ var SaveReport = ({
|
|
|
51442
51597
|
onSubmitEditReport = () => void 0,
|
|
51443
51598
|
onSubmitCreateReport = () => void 0,
|
|
51444
51599
|
destinationSection,
|
|
51600
|
+
showTableFormatOptions,
|
|
51601
|
+
showDashboardFilterFields,
|
|
51445
51602
|
SelectComponent = QuillSelectComponent,
|
|
51446
51603
|
TextInputComponent = QuillTextInput,
|
|
51447
51604
|
ButtonComponent = MemoizedButton,
|
|
@@ -51474,6 +51631,7 @@ var SaveReport = ({
|
|
|
51474
51631
|
),
|
|
51475
51632
|
submitButtonLabel
|
|
51476
51633
|
}) => {
|
|
51634
|
+
const { reload } = useDashboardInternal(reportBuilder.destinationDashboard ?? null);
|
|
51477
51635
|
return /* @__PURE__ */ jsxs59("div", { children: [
|
|
51478
51636
|
SaveTrigger,
|
|
51479
51637
|
/* @__PURE__ */ jsx79(
|
|
@@ -51486,7 +51644,17 @@ var SaveReport = ({
|
|
|
51486
51644
|
isHorizontalView: true,
|
|
51487
51645
|
isOpen,
|
|
51488
51646
|
setIsOpen,
|
|
51489
|
-
onAddToDashboardComplete: reportBuilder.reportId ?
|
|
51647
|
+
onAddToDashboardComplete: reportBuilder.reportId ? (data) => {
|
|
51648
|
+
onSubmitEditReport(data);
|
|
51649
|
+
if (!isAdminEnabled && reportBuilder.destinationDashboard) {
|
|
51650
|
+
reload(reportBuilder.destinationDashboard, false, { report: data, action: "upsert" });
|
|
51651
|
+
}
|
|
51652
|
+
} : (data) => {
|
|
51653
|
+
onSubmitCreateReport(data);
|
|
51654
|
+
if (!isAdminEnabled && reportBuilder.destinationDashboard) {
|
|
51655
|
+
reload(reportBuilder.destinationDashboard, false, { report: data, action: "upsert" });
|
|
51656
|
+
}
|
|
51657
|
+
},
|
|
51490
51658
|
destinationDashboard: reportBuilder.destinationDashboard,
|
|
51491
51659
|
destinationSection,
|
|
51492
51660
|
initialUniqueValues: reportBuilder.columnUniqueValues,
|
|
@@ -51515,6 +51683,8 @@ var SaveReport = ({
|
|
|
51515
51683
|
FormContainer: ChartBuilderFormContainer,
|
|
51516
51684
|
hideDateRangeFilter: true,
|
|
51517
51685
|
hideDeleteButton: true,
|
|
51686
|
+
showTableFormatOptions,
|
|
51687
|
+
showDashboardFilterFields,
|
|
51518
51688
|
buttonLabel: submitButtonLabel ?? (!!reportBuilder.reportId ? "Save changes" : "Add to dashboard"),
|
|
51519
51689
|
onClickChartElement,
|
|
51520
51690
|
isEditingMode: true
|
|
@@ -51610,6 +51780,7 @@ function ReportBuilder({
|
|
|
51610
51780
|
containerStyle,
|
|
51611
51781
|
className,
|
|
51612
51782
|
pivotRecommendationsEnabled = true,
|
|
51783
|
+
chartBuilderOptions,
|
|
51613
51784
|
reportId,
|
|
51614
51785
|
hideCopySQL = true,
|
|
51615
51786
|
isChartBuilderHorizontalView = true,
|
|
@@ -52049,6 +52220,8 @@ function ReportBuilder({
|
|
|
52049
52220
|
ErrorMessageComponent,
|
|
52050
52221
|
PivotRowContainer,
|
|
52051
52222
|
PivotColumnContainer,
|
|
52223
|
+
showTableFormatOptions: chartBuilderOptions?.showTableFormatOptions,
|
|
52224
|
+
showDashboardFilterFields: chartBuilderOptions?.showDashboardFilterFields,
|
|
52052
52225
|
onClickChartElement,
|
|
52053
52226
|
submitButtonLabel
|
|
52054
52227
|
}
|
|
@@ -52069,7 +52242,7 @@ function ReportBuilder({
|
|
|
52069
52242
|
isAdmin: false,
|
|
52070
52243
|
title: "Save query",
|
|
52071
52244
|
buttonLabel: "Save query",
|
|
52072
|
-
tempReport,
|
|
52245
|
+
tempReport: { ...tempReport, dashboardName: SAVED_QUERIES_DASHBOARD },
|
|
52073
52246
|
reportId,
|
|
52074
52247
|
organizationName,
|
|
52075
52248
|
CardComponent,
|