@quillsql/react 2.13.41 → 2.13.43
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/ChartBuilder.d.ts +18 -3
- package/dist/cjs/ChartBuilder.d.ts.map +1 -1
- package/dist/cjs/ChartBuilder.js +186 -89
- package/dist/cjs/Context.d.ts.map +1 -1
- package/dist/cjs/Context.js +46 -16
- package/dist/cjs/Dashboard.d.ts.map +1 -1
- package/dist/cjs/Dashboard.js +0 -1
- package/dist/cjs/ReportBuilder.d.ts +2 -1
- package/dist/cjs/ReportBuilder.d.ts.map +1 -1
- package/dist/cjs/ReportBuilder.js +74 -4
- package/dist/cjs/SQLEditor.d.ts +2 -1
- package/dist/cjs/SQLEditor.d.ts.map +1 -1
- package/dist/cjs/SQLEditor.js +43 -3
- package/dist/cjs/components/Chart/GaugeChart.d.ts.map +1 -1
- package/dist/cjs/components/Chart/GaugeChart.js +70 -12
- package/dist/cjs/components/Chart/InternalChart.js +1 -1
- package/dist/cjs/components/Chart/MapChart.d.ts.map +1 -1
- package/dist/cjs/components/Chart/MapChart.js +65 -7
- package/dist/cjs/components/UiComponents.d.ts +2 -2
- package/dist/cjs/components/UiComponents.d.ts.map +1 -1
- package/dist/cjs/components/UiComponents.js +5 -4
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/internals/ReportBuilder/PivotModal.js +1 -1
- package/dist/cjs/models/Columns.d.ts +1 -0
- package/dist/cjs/models/Columns.d.ts.map +1 -1
- package/dist/cjs/utils/dashboard.d.ts +2 -1
- package/dist/cjs/utils/dashboard.d.ts.map +1 -1
- package/dist/cjs/utils/dashboard.js +12 -6
- package/dist/cjs/utils/pivotConstructor.d.ts.map +1 -1
- package/dist/cjs/utils/pivotConstructor.js +4 -1
- package/dist/cjs/utils/queryConstructor.d.ts.map +1 -1
- package/dist/cjs/utils/queryConstructor.js +12 -6
- package/dist/cjs/utils/report.d.ts.map +1 -1
- package/dist/cjs/utils/report.js +8 -6
- package/dist/cjs/utils/schema.d.ts +4 -2
- package/dist/cjs/utils/schema.d.ts.map +1 -1
- package/dist/cjs/utils/schema.js +7 -3
- package/dist/cjs/utils/tableProcessing.d.ts +2 -0
- package/dist/cjs/utils/tableProcessing.d.ts.map +1 -1
- package/dist/cjs/utils/tableProcessing.js +33 -3
- package/dist/cjs/utils/valueFormatter.d.ts +1 -0
- package/dist/cjs/utils/valueFormatter.d.ts.map +1 -1
- package/dist/cjs/utils/valueFormatter.js +55 -1
- package/dist/esm/ChartBuilder.d.ts +18 -3
- package/dist/esm/ChartBuilder.d.ts.map +1 -1
- package/dist/esm/ChartBuilder.js +187 -91
- package/dist/esm/Context.d.ts.map +1 -1
- package/dist/esm/Context.js +46 -16
- package/dist/esm/Dashboard.d.ts.map +1 -1
- package/dist/esm/Dashboard.js +0 -1
- package/dist/esm/ReportBuilder.d.ts +2 -1
- package/dist/esm/ReportBuilder.d.ts.map +1 -1
- package/dist/esm/ReportBuilder.js +74 -4
- package/dist/esm/SQLEditor.d.ts +2 -1
- package/dist/esm/SQLEditor.d.ts.map +1 -1
- package/dist/esm/SQLEditor.js +43 -3
- package/dist/esm/components/Chart/GaugeChart.d.ts.map +1 -1
- package/dist/esm/components/Chart/GaugeChart.js +33 -8
- package/dist/esm/components/Chart/InternalChart.js +1 -1
- package/dist/esm/components/Chart/MapChart.d.ts.map +1 -1
- package/dist/esm/components/Chart/MapChart.js +30 -5
- package/dist/esm/components/UiComponents.d.ts +2 -2
- package/dist/esm/components/UiComponents.d.ts.map +1 -1
- package/dist/esm/components/UiComponents.js +5 -4
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/internals/ReportBuilder/PivotModal.js +1 -1
- package/dist/esm/models/Columns.d.ts +1 -0
- package/dist/esm/models/Columns.d.ts.map +1 -1
- package/dist/esm/utils/dashboard.d.ts +2 -1
- package/dist/esm/utils/dashboard.d.ts.map +1 -1
- package/dist/esm/utils/dashboard.js +13 -7
- package/dist/esm/utils/pivotConstructor.d.ts.map +1 -1
- package/dist/esm/utils/pivotConstructor.js +4 -1
- package/dist/esm/utils/queryConstructor.d.ts.map +1 -1
- package/dist/esm/utils/queryConstructor.js +12 -6
- package/dist/esm/utils/report.d.ts.map +1 -1
- package/dist/esm/utils/report.js +9 -7
- package/dist/esm/utils/schema.d.ts +4 -2
- package/dist/esm/utils/schema.d.ts.map +1 -1
- package/dist/esm/utils/schema.js +7 -3
- package/dist/esm/utils/tableProcessing.d.ts +2 -0
- package/dist/esm/utils/tableProcessing.d.ts.map +1 -1
- package/dist/esm/utils/tableProcessing.js +33 -3
- package/dist/esm/utils/valueFormatter.d.ts +1 -0
- package/dist/esm/utils/valueFormatter.d.ts.map +1 -1
- package/dist/esm/utils/valueFormatter.js +53 -0
- package/package.json +6 -1
package/dist/cjs/ChartBuilder.js
CHANGED
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.dateFormatOptions = exports.numberFormatOptions = void 0;
|
|
7
7
|
exports.createInitialFormData = createInitialFormData;
|
|
8
|
+
exports.createReportFromForm = createReportFromForm;
|
|
8
9
|
exports.ChartBuilderWithModal = ChartBuilderWithModal;
|
|
9
10
|
exports.default = ChartBuilder;
|
|
10
11
|
exports.DashboardFilterModal = DashboardFilterModal;
|
|
@@ -35,7 +36,17 @@ const dataFetcher_1 = require("./utils/dataFetcher");
|
|
|
35
36
|
const QuillMultiSelectSectionList_1 = require("./components/QuillMultiSelectSectionList");
|
|
36
37
|
const constants_1 = require("./utils/constants");
|
|
37
38
|
const pivotConstructor_1 = require("./utils/pivotConstructor");
|
|
38
|
-
const CHART_TYPES = [
|
|
39
|
+
const CHART_TYPES = [
|
|
40
|
+
'column',
|
|
41
|
+
'line',
|
|
42
|
+
'table',
|
|
43
|
+
'metric',
|
|
44
|
+
'gauge',
|
|
45
|
+
'bar',
|
|
46
|
+
'pie',
|
|
47
|
+
'US map',
|
|
48
|
+
'World map',
|
|
49
|
+
];
|
|
39
50
|
const CHART_TO_LABELS = {
|
|
40
51
|
column: { xAxisLabel: 'X-Axis', yAxisLabel: 'Y-Axis' },
|
|
41
52
|
line: { xAxisLabel: 'X-Axis', yAxisLabel: 'Y-Axis' },
|
|
@@ -50,7 +61,9 @@ const CHART_TO_LABELS = {
|
|
|
50
61
|
function getPivotMetricOptions(pivot, selectedPivotTable, chartType) {
|
|
51
62
|
if (['metric', 'gauge'].includes(chartType) && selectedPivotTable) {
|
|
52
63
|
return selectedPivotTable.columns.map((elem) => ({
|
|
53
|
-
label: elem.field === pivot?.rowField
|
|
64
|
+
label: elem.field === pivot?.rowField
|
|
65
|
+
? `Pivot Row (${elem.field})`
|
|
66
|
+
: elem.field,
|
|
54
67
|
value: elem.field,
|
|
55
68
|
}));
|
|
56
69
|
}
|
|
@@ -99,7 +112,15 @@ function createInitialFormData(columns) {
|
|
|
99
112
|
function getChartTypeOptions(formData, dashboard) {
|
|
100
113
|
let viableCharts = CHART_TYPES;
|
|
101
114
|
if (dashboard && dashboard.dateFilter && dashboard.dateFilter.comparison) {
|
|
102
|
-
viableCharts = viableCharts.filter((chart) => ![
|
|
115
|
+
viableCharts = viableCharts.filter((chart) => ![
|
|
116
|
+
'table',
|
|
117
|
+
'metric',
|
|
118
|
+
'gauge',
|
|
119
|
+
'bar',
|
|
120
|
+
'pie',
|
|
121
|
+
'US map',
|
|
122
|
+
'World map',
|
|
123
|
+
].includes(chart));
|
|
103
124
|
}
|
|
104
125
|
if (formData.pivot && !formData.pivot.rowField) {
|
|
105
126
|
return viableCharts
|
|
@@ -111,9 +132,12 @@ function getChartTypeOptions(formData, dashboard) {
|
|
|
111
132
|
}
|
|
112
133
|
else {
|
|
113
134
|
return viableCharts
|
|
114
|
-
.filter((elem) => !(
|
|
135
|
+
.filter((elem) => !(formData.pivot &&
|
|
115
136
|
formData.pivot.columnField &&
|
|
116
|
-
(elem === 'bar' ||
|
|
137
|
+
(elem === 'bar' ||
|
|
138
|
+
elem === 'pie' ||
|
|
139
|
+
elem === 'US map' ||
|
|
140
|
+
elem === 'World map')))
|
|
117
141
|
.map((elem) => ({ label: elem, value: elem }));
|
|
118
142
|
}
|
|
119
143
|
}
|
|
@@ -139,11 +163,15 @@ function createReportFromForm(formData, report, selectedPivotTable, rows = [], f
|
|
|
139
163
|
columnInternal: report?.columnInternal ?? [],
|
|
140
164
|
referenceLines: formData.referenceLines?.map((elem) => ({
|
|
141
165
|
label: elem.label,
|
|
142
|
-
query: elem.label === constants_1.REFERENCE_LINE
|
|
166
|
+
query: elem.label === constants_1.REFERENCE_LINE
|
|
167
|
+
? [Number(elem.y1) || 0, Number(elem.y2) || 0]
|
|
168
|
+
: elem.label,
|
|
143
169
|
})) || [],
|
|
144
170
|
referenceLineYValues: formData.referenceLines?.map((elem, index) => ({
|
|
145
171
|
label: elem.label,
|
|
146
|
-
query: elem.label === constants_1.REFERENCE_LINE
|
|
172
|
+
query: elem.label === constants_1.REFERENCE_LINE
|
|
173
|
+
? [Number(elem.y1) || 0, Number(elem.y2) || 0]
|
|
174
|
+
: referenceLineQueryResults?.[index],
|
|
147
175
|
})) || [],
|
|
148
176
|
}), filtersApplied);
|
|
149
177
|
return newReport;
|
|
@@ -263,9 +291,9 @@ function ChartBuilderWithModal(props) {
|
|
|
263
291
|
*/
|
|
264
292
|
function ChartBuilder({ TextInputComponent = UiComponents_1.QuillTextInput, SelectComponent = QuillSelect_1.QuillSelectComponent,
|
|
265
293
|
// MultiSelectComponent = QuillMultiSelectComponentWithCombo,
|
|
266
|
-
ButtonComponent = UiComponents_1.MemoizedButton, SecondaryButtonComponent = UiComponents_1.MemoizedSecondaryButton, HeaderComponent = UiComponents_1.MemoizedHeader, SubHeaderComponent = UiComponents_1.MemoizedSubHeader, LabelComponent = UiComponents_1.MemoizedLabel, DeleteButtonComponent = UiComponents_1.MemoizedDeleteButton, TextComponent = UiComponents_1.MemoizedText, PopoverComponent = UiComponents_1.MemoizedPopover, CardComponent = QuillCard_1.QuillCard, TableComponent = UiComponents_1.QuillTableComponent, ModalComponent = UiComponents_1.MemoizedModal, LoadingComponent = UiComponents_1.QuillLoadingComponent, ErrorMessageComponent = UiComponents_1.QuillErrorMessageComponent, ChartBuilderInputRowContainer = UiComponents_1.QuillChartBuilderInputRowContainer, ChartBuilderInputColumnContainer = UiComponents_1.QuillChartBuilderInputColumnContainer, PivotRowContainer = UiComponents_1.QuillPivotRowContainer, PivotColumnContainer = UiComponents_1.QuillPivotColumnContainer, FormContainer = UiComponents_1.QuillChartBuilderFormContainer, ErrorComponent = ChartError_1.QuillChartErrorWithAction, CheckboxComponent = UiComponents_1.QuillChartBuilderCheckboxComponent, onClickChartError, isOpen, isHorizontalView = true, setIsOpen, dateRange, isAdmin = false, showDashboardDropdown = true, onAddToDashboardComplete, onDelete, onDiscardChanges, reportId, tempReport, recommendedPivots: rp = [], createdPivots: cp = [], dateColumn, buttonLabel, organizationName, hideDeleteButton = false, hideSubmitButton = false, hideDateRangeFilter = false, showTableFormatOptions, initialUniqueValues, initialUniqueValuesIsLoading, pivotRecommendationsEnabled = true, filtersEnabled, onFiltersEnabledChanged,
|
|
294
|
+
ButtonComponent = UiComponents_1.MemoizedButton, SecondaryButtonComponent = UiComponents_1.MemoizedSecondaryButton, HeaderComponent = UiComponents_1.MemoizedHeader, SubHeaderComponent = UiComponents_1.MemoizedSubHeader, LabelComponent = UiComponents_1.MemoizedLabel, DeleteButtonComponent = UiComponents_1.MemoizedDeleteButton, TextComponent = UiComponents_1.MemoizedText, PopoverComponent = UiComponents_1.MemoizedPopover, CardComponent = QuillCard_1.QuillCard, TableComponent = UiComponents_1.QuillTableComponent, ModalComponent = UiComponents_1.MemoizedModal, LoadingComponent = UiComponents_1.QuillLoadingComponent, ErrorMessageComponent = UiComponents_1.QuillErrorMessageComponent, ChartBuilderInputRowContainer = UiComponents_1.QuillChartBuilderInputRowContainer, ChartBuilderInputColumnContainer = UiComponents_1.QuillChartBuilderInputColumnContainer, PivotRowContainer = UiComponents_1.QuillPivotRowContainer, PivotColumnContainer = UiComponents_1.QuillPivotColumnContainer, FormContainer = UiComponents_1.QuillChartBuilderFormContainer, ErrorComponent = ChartError_1.QuillChartErrorWithAction, CheckboxComponent = UiComponents_1.QuillChartBuilderCheckboxComponent, onClickChartError, isOpen, isHorizontalView = true, setIsOpen, dateRange, isAdmin = false, showDashboardDropdown = true, hidePivotForm = false, onAddToDashboardComplete, onDelete, onDiscardChanges, reportId, tempReport, recommendedPivots: rp = [], createdPivots: cp = [], dateColumn, buttonLabel, organizationName, hideDeleteButton = false, hideSubmitButton = false, hideDateRangeFilter = false, showTableFormatOptions, initialUniqueValues, initialUniqueValuesIsLoading, pivotRecommendationsEnabled = true, hideTableView = false, hideChartView = false, hideChartType = false, hideDiscardChanges = false, filtersEnabled, onFiltersEnabledChanged,
|
|
267
295
|
// isLoading,
|
|
268
|
-
onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
296
|
+
destinationDashboard, onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
269
297
|
const [client] = (0, react_1.useContext)(Context_1.ClientContext);
|
|
270
298
|
const [theme] = (0, react_1.useContext)(Context_1.ThemeContext);
|
|
271
299
|
const [schemaData] = (0, react_1.useContext)(Context_1.SchemaDataContext);
|
|
@@ -398,7 +426,7 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
398
426
|
}
|
|
399
427
|
: undefined;
|
|
400
428
|
const columns = report?.columnInternal ?? [];
|
|
401
|
-
const
|
|
429
|
+
const destinationDashboardName = destinationDashboard || report?.dashboardName;
|
|
402
430
|
const query = report?.queryString;
|
|
403
431
|
const [loadingFormData, setLoadingFormData] = (0, react_1.useState)(false);
|
|
404
432
|
const [triggeredEditChart, setTriggeredEditChart] = (0, react_1.useState)(false);
|
|
@@ -583,19 +611,24 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
583
611
|
...report,
|
|
584
612
|
// ...pivotData,
|
|
585
613
|
dateField: dateField,
|
|
586
|
-
referenceLines: report?.referenceLines
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
614
|
+
referenceLines: report?.referenceLines
|
|
615
|
+
? report.referenceLines?.map(({ label, query }) => {
|
|
616
|
+
if (typeof query === 'string') {
|
|
617
|
+
return { label, y1: undefined, y2: undefined };
|
|
618
|
+
}
|
|
619
|
+
return {
|
|
620
|
+
label,
|
|
621
|
+
y1: query[0],
|
|
622
|
+
y2: query[1],
|
|
623
|
+
};
|
|
624
|
+
})
|
|
625
|
+
: [],
|
|
596
626
|
};
|
|
597
627
|
};
|
|
598
628
|
const [formData, setFormData] = (0, react_1.useState)(formFormDataFromReport(report));
|
|
629
|
+
const reportCustomFields = (0, react_1.useMemo)(() => {
|
|
630
|
+
return (report?.columnsWithCustomFields?.filter((col) => !report?.columns?.some((c) => col.field === c.field)) ?? []);
|
|
631
|
+
}, [report?.columnsWithCustomFields, report?.columns]);
|
|
599
632
|
const referenceLineQueryResults = (0, react_1.useMemo)(() => {
|
|
600
633
|
return formData?.referenceLines?.map((line) => {
|
|
601
634
|
if (line.label === constants_1.REFERENCE_LINE) {
|
|
@@ -726,14 +759,14 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
726
759
|
{ label: 'New - Dashboard', value: 'New - Dashboard' },
|
|
727
760
|
];
|
|
728
761
|
}
|
|
729
|
-
if (
|
|
762
|
+
if (destinationDashboardName) {
|
|
730
763
|
dashboardOptions = [
|
|
731
|
-
{ label:
|
|
764
|
+
{ label: destinationDashboardName, value: destinationDashboardName },
|
|
732
765
|
];
|
|
733
766
|
}
|
|
734
767
|
let dashboardName = report?.dashboardName ?? dashboardOptions[0]?.label ?? '';
|
|
735
|
-
if (
|
|
736
|
-
dashboardName =
|
|
768
|
+
if (destinationDashboardName) {
|
|
769
|
+
dashboardName = destinationDashboardName;
|
|
737
770
|
}
|
|
738
771
|
const curDashboard = await updateDashboardFilters(dashboardName);
|
|
739
772
|
setDashboardOptions(dashboardOptions);
|
|
@@ -842,7 +875,8 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
842
875
|
{ value: 'whole_number', label: 'whole number' },
|
|
843
876
|
{ value: 'two_decimal_places', label: 'two decimal places' },
|
|
844
877
|
{ value: 'percent', label: 'percentage' },
|
|
845
|
-
]
|
|
878
|
+
]
|
|
879
|
+
: ALL_FORMAT_OPTIONS;
|
|
846
880
|
}, [chartData?.chartType]);
|
|
847
881
|
const fetchPivotData = async (pivot, tableInfo, uniqueValues, overrideFilters) => {
|
|
848
882
|
const dashboardFilters = filtersEnabled
|
|
@@ -871,7 +905,7 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
871
905
|
: undefined,
|
|
872
906
|
client,
|
|
873
907
|
uniqueValues,
|
|
874
|
-
dashboardName:
|
|
908
|
+
dashboardName: destinationDashboardName,
|
|
875
909
|
tenants,
|
|
876
910
|
additionalProcessing: baseProcessing,
|
|
877
911
|
});
|
|
@@ -916,12 +950,17 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
916
950
|
if (!rows)
|
|
917
951
|
return [];
|
|
918
952
|
return rows.map((row) => {
|
|
919
|
-
|
|
953
|
+
const columns = formData.includeCustomFields && !containsCustomFields
|
|
954
|
+
? formData.columns.concat(reportCustomFields)
|
|
955
|
+
: formData.columns;
|
|
956
|
+
return columns.reduce((formattedRow, column) => {
|
|
920
957
|
// Apply the format function to each field in the row
|
|
921
|
-
const formattedValue =
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
958
|
+
const formattedValue = column.inferFormat
|
|
959
|
+
? (0, valueFormatter_1.quillAutoFormat)(row[column.field])
|
|
960
|
+
: (0, valueFormatter_1.quillFormat)({
|
|
961
|
+
value: row[column.field],
|
|
962
|
+
format: column.format,
|
|
963
|
+
});
|
|
925
964
|
formattedRow[column.field] = formattedValue;
|
|
926
965
|
return formattedRow;
|
|
927
966
|
}, {});
|
|
@@ -952,7 +991,7 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
952
991
|
rowsOnly: false,
|
|
953
992
|
rowCountOnly: true,
|
|
954
993
|
filterMap: canonicalFilterMap,
|
|
955
|
-
dashboardName:
|
|
994
|
+
dashboardName: destinationDashboardName,
|
|
956
995
|
});
|
|
957
996
|
if (tableInfo.rowCount !== undefined) {
|
|
958
997
|
setRowCount(tableInfo.rowCount);
|
|
@@ -1004,7 +1043,7 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1004
1043
|
rowsOnly: true,
|
|
1005
1044
|
rowCountOnly: false,
|
|
1006
1045
|
filterMap: canonicalFilterMap,
|
|
1007
|
-
dashboardName:
|
|
1046
|
+
dashboardName: destinationDashboardName,
|
|
1008
1047
|
});
|
|
1009
1048
|
setCurrentProcessing(processing);
|
|
1010
1049
|
setRows(tableInfo.rows);
|
|
@@ -1013,7 +1052,7 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1013
1052
|
fetchRowCount(processing, overrideFilters);
|
|
1014
1053
|
if (formData.pivot) {
|
|
1015
1054
|
try {
|
|
1016
|
-
const uniqueValues = await (0, tableProcessing_1.getUniqueValuesByColumns)(tableInfo.columns.filter((column) => column.field === formData.pivot?.columnField), report.queryString, tableInfo.rows, client, tenants, schemaData.customFields ?? {}, overrideFilters,
|
|
1055
|
+
const uniqueValues = await (0, tableProcessing_1.getUniqueValuesByColumns)(tableInfo.columns.filter((column) => column.field === formData.pivot?.columnField), report.queryString, tableInfo.rows, client, tenants, schemaData.customFields ?? {}, overrideFilters, destinationDashboardName);
|
|
1017
1056
|
fetchPivotData(formData.pivot, tableInfo, uniqueValues, overrideFilters);
|
|
1018
1057
|
}
|
|
1019
1058
|
catch (e) {
|
|
@@ -1080,7 +1119,7 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1080
1119
|
rowsOnly: false,
|
|
1081
1120
|
rowCountOnly: false,
|
|
1082
1121
|
filterMap: canonicalFilterMap,
|
|
1083
|
-
dashboardName:
|
|
1122
|
+
dashboardName: destinationDashboardName,
|
|
1084
1123
|
pivot: isPivotTable ? report.pivot : undefined,
|
|
1085
1124
|
getPivotRowCount: false,
|
|
1086
1125
|
});
|
|
@@ -1128,8 +1167,20 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1128
1167
|
else if (index !== undefined) {
|
|
1129
1168
|
// For dynamic array fields
|
|
1130
1169
|
const [field, subfield] = fieldName.split('.');
|
|
1170
|
+
let newLabel = undefined;
|
|
1171
|
+
if (field === 'columns' && subfield === 'field') {
|
|
1172
|
+
if (!formData['columns'][index]?.label) {
|
|
1173
|
+
newLabel = (0, textProcessing_1.snakeAndCamelCaseToTitleCase)(value);
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1131
1176
|
// @ts-ignore
|
|
1132
|
-
const updatedArray = formData[field].map((item, i) => i === index
|
|
1177
|
+
const updatedArray = formData[field].map((item, i) => i === index
|
|
1178
|
+
? {
|
|
1179
|
+
...item,
|
|
1180
|
+
label: newLabel ? newLabel : item.label,
|
|
1181
|
+
[subfield]: value,
|
|
1182
|
+
}
|
|
1183
|
+
: item);
|
|
1133
1184
|
updatedForm = { ...formData, [field]: updatedArray };
|
|
1134
1185
|
setFormData(updatedForm);
|
|
1135
1186
|
setChartTypes(getChartTypeOptions(updatedForm, dashboardConfig[updatedForm.dashboardName ?? '']));
|
|
@@ -1243,6 +1294,11 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1243
1294
|
...formData,
|
|
1244
1295
|
dashboardName: formData.dashboardName,
|
|
1245
1296
|
pivot: null,
|
|
1297
|
+
chartType: formEmptyState.chartType,
|
|
1298
|
+
xAxisField: formEmptyState.xAxisField,
|
|
1299
|
+
xAxisFormat: formEmptyState.xAxisFormat,
|
|
1300
|
+
xAxisLabel: formEmptyState.xAxisLabel,
|
|
1301
|
+
yAxisFields: formEmptyState.yAxisFields,
|
|
1246
1302
|
});
|
|
1247
1303
|
// maybe validate
|
|
1248
1304
|
setSelectedPivotTable(undefined);
|
|
@@ -1337,9 +1393,7 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1337
1393
|
...(formData.dateField?.table
|
|
1338
1394
|
? {}
|
|
1339
1395
|
: { dateField: { ...defaultDateField } }),
|
|
1340
|
-
|
|
1341
|
-
? {}
|
|
1342
|
-
: { dashboardName: report?.dashboardName }),
|
|
1396
|
+
dashboardName: destinationDashboardName,
|
|
1343
1397
|
query: report?.queryString ?? '',
|
|
1344
1398
|
pivot: formData.pivot,
|
|
1345
1399
|
referencedTables: allTables,
|
|
@@ -1368,7 +1422,9 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1368
1422
|
referenceLines: formData.referenceLines.map((line) => {
|
|
1369
1423
|
return {
|
|
1370
1424
|
label: line.label,
|
|
1371
|
-
query: line.label === constants_1.REFERENCE_LINE
|
|
1425
|
+
query: line.label === constants_1.REFERENCE_LINE
|
|
1426
|
+
? [Number(line.y1 ?? 0) || 0, Number(line.y2 ?? 0) || 0]
|
|
1427
|
+
: '',
|
|
1372
1428
|
};
|
|
1373
1429
|
}),
|
|
1374
1430
|
};
|
|
@@ -1430,15 +1486,17 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1430
1486
|
gap: '20px',
|
|
1431
1487
|
flexDirection: isHorizontalView ? 'row' : 'column',
|
|
1432
1488
|
boxSizing: 'border-box',
|
|
1433
|
-
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
1489
|
+
}, children: [hideChartView ? null : ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
1434
1490
|
display: 'flex',
|
|
1435
1491
|
flexDirection: 'column',
|
|
1436
1492
|
gap: isOpen ? 16 : 20,
|
|
1437
1493
|
overflowY: 'scroll',
|
|
1438
1494
|
height: isHorizontalView || !isOpen ? '100%' : 800,
|
|
1439
1495
|
...(isHorizontalView && {
|
|
1440
|
-
flexGrow: 1,
|
|
1441
|
-
|
|
1496
|
+
// flexGrow: 1,
|
|
1497
|
+
width: !isOpen
|
|
1498
|
+
? '100%'
|
|
1499
|
+
: `calc(100% - ${formWidth}px - 20px)`, // width of left sidebar plus gap
|
|
1442
1500
|
}),
|
|
1443
1501
|
...(!isHorizontalView && isOpen && { width: formWidth }),
|
|
1444
1502
|
}, children: [!isEditingMode && (report?.adminError || report?.error) ? ((0, jsx_runtime_1.jsx)(ErrorComponent, { label: report.adminError || report.error, onClick: onClickChartError })) : ((isHorizontalView || (!isOpen && windowWidth > 1200)) && ((0, jsx_runtime_1.jsx)(InternalChart_1.default, { report: chartData, filtersEnabled: filtersEnabled, setFiltersEnabled: (hide) => {
|
|
@@ -1449,10 +1507,13 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1449
1507
|
// formData.chartType === 'metric'
|
|
1450
1508
|
// ? 100
|
|
1451
1509
|
// : `calc(${filtersEnabled ? 50 : 70}%)`,
|
|
1452
|
-
...(isHorizontalView && {
|
|
1510
|
+
...(isHorizontalView && {
|
|
1511
|
+
flexGrow: !['table'].includes(formData.chartType) ? 1 : 0,
|
|
1512
|
+
}),
|
|
1453
1513
|
}, onClickChartElement: onClickChartElement, filterToggleDisabled: Object.values(validFilter).includes(false), onDashboardFilterChange: onDashboardFilterChange, layoutChanged: isOpen }))),
|
|
1454
1514
|
// Make sure to display non-pivoted table when using pivot chart
|
|
1455
|
-
|
|
1515
|
+
!hideChartView &&
|
|
1516
|
+
(isHorizontalView || (!isOpen && windowWidth < 1200)) && ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
1456
1517
|
width: '100%',
|
|
1457
1518
|
// height:
|
|
1458
1519
|
// isHorizontalView || !isOpen
|
|
@@ -1470,23 +1531,25 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1470
1531
|
? 200
|
|
1471
1532
|
: formData.chartType === 'metric'
|
|
1472
1533
|
? 300
|
|
1473
|
-
:
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1534
|
+
: 500,
|
|
1535
|
+
flexGrow: formData.chartType !== 'table' ? 1 : 0,
|
|
1536
|
+
}, onClickChartElement: onClickChartElement, filterToggleDisabled: Object.values(validFilter).includes(false), onDashboardFilterChange: onDashboardFilterChange, layoutChanged: isOpen })), hideTableView ? null : formData.chartType !== 'table' ? ((0, jsx_runtime_1.jsx)(TableComponent, { rows: formattedRows, columns: includeCustomFields && !containsCustomFields
|
|
1537
|
+
? formData.columns.concat(reportCustomFields)
|
|
1538
|
+
: formData.columns, onPageChange: (page) => {
|
|
1478
1539
|
onPageChange(page);
|
|
1479
1540
|
setCurrentPage(page);
|
|
1480
1541
|
}, onSortChange: (sort) => {
|
|
1481
1542
|
onSortChange && onSortChange(sort);
|
|
1482
|
-
}, currentPage: currentPage, rowCount: rowCount, isLoading: isLoading, rowCountIsLoading: rowCountIsLoading, disableSort: disableSort })) : ((0, jsx_runtime_1.jsx)(TableComponent, { rows: formattedRows, columns: selectedPivotTable
|
|
1543
|
+
}, currentPage: currentPage, rowCount: rowCount, isLoading: isLoading, rowCountIsLoading: rowCountIsLoading, disableSort: disableSort, hideLabels: false })) : ((0, jsx_runtime_1.jsx)(TableComponent, { rows: formattedRows, columns: selectedPivotTable
|
|
1483
1544
|
? selectedPivotTable.columns
|
|
1484
|
-
:
|
|
1545
|
+
: includeCustomFields && !containsCustomFields
|
|
1546
|
+
? formData.columns.concat(reportCustomFields)
|
|
1547
|
+
: formData.columns, onPageChange: (page) => {
|
|
1485
1548
|
onPageChange(page, true);
|
|
1486
1549
|
setCurrentPage(page);
|
|
1487
1550
|
}, onSortChange: (sort) => {
|
|
1488
1551
|
onSortChange && onSortChange(sort, true);
|
|
1489
|
-
}, currentPage: currentPage, rowCount: selectedPivotTable ? pivotData?.rowCount : rowCount, rowCountIsLoading: rowCountIsLoading, isLoading: isLoading, disableSort: disableSort }))] }))] }), isOpen && ((0, jsx_runtime_1.jsxs)("form", { ref: parentRef, id: "quill-chart-form", onSubmit: handleSubmit, style: {
|
|
1552
|
+
}, currentPage: currentPage, rowCount: selectedPivotTable ? pivotData?.rowCount : rowCount, rowCountIsLoading: rowCountIsLoading, isLoading: isLoading, disableSort: disableSort, hideLabels: false }))] }))] })), isOpen && ((0, jsx_runtime_1.jsxs)("form", { ref: parentRef, id: "quill-chart-form", onSubmit: handleSubmit, style: {
|
|
1490
1553
|
display: 'flex',
|
|
1491
1554
|
flexDirection: 'column',
|
|
1492
1555
|
gap: 20,
|
|
@@ -1502,30 +1565,35 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1502
1565
|
paddingTop: modalPadding,
|
|
1503
1566
|
paddingBottom: modalPadding,
|
|
1504
1567
|
}),
|
|
1505
|
-
}, children: [(0, jsx_runtime_1.jsxs)(FormContainer, { children: [
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
: formData.chartType === '
|
|
1513
|
-
?
|
|
1514
|
-
: formData.chartType === '
|
|
1515
|
-
?
|
|
1516
|
-
:
|
|
1517
|
-
|
|
1518
|
-
|
|
1568
|
+
}, children: [(0, jsx_runtime_1.jsxs)(FormContainer, { children: [hideChartView
|
|
1569
|
+
? null
|
|
1570
|
+
: (formData.pivot || formData.chartType !== 'table') &&
|
|
1571
|
+
windowWidth < 1200 && ((0, jsx_runtime_1.jsx)(InternalChart_1.default, { report: chartData, filtersEnabled: filtersEnabled, setFiltersEnabled: (hide) => {
|
|
1572
|
+
onFiltersEnabledChanged(hide);
|
|
1573
|
+
}, colors: theme?.chartColors, loading: false, hideDateRangeFilter: hideDateRangeFilter, isAdmin: isAdmin, containerStyle: {
|
|
1574
|
+
width: '100%',
|
|
1575
|
+
height: formData.chartType === 'table'
|
|
1576
|
+
? 200
|
|
1577
|
+
: formData.chartType === 'metric'
|
|
1578
|
+
? 300
|
|
1579
|
+
: formData.chartType === 'US map' ||
|
|
1580
|
+
formData.chartType === 'World map'
|
|
1581
|
+
? 'fit-content'
|
|
1582
|
+
: 500,
|
|
1583
|
+
flexGrow: !['table'].includes(formData.chartType)
|
|
1584
|
+
? 1
|
|
1585
|
+
: 0,
|
|
1586
|
+
}, onClickChartElement: onClickChartElement, filterToggleDisabled: Object.values(validFilter).includes(false), onDashboardFilterChange: onDashboardFilterChange, layoutChanged: isOpen })), (0, jsx_runtime_1.jsxs)(ChartBuilderInputRowContainer, { children: [(0, jsx_runtime_1.jsx)("div", { ref: inputRef, style: { display: 'flex', flexDirection: 'column' }, children: (0, jsx_runtime_1.jsx)(TextInputComponent
|
|
1519
1587
|
// {...autofocusRefProp}
|
|
1520
1588
|
, {
|
|
1521
1589
|
// {...autofocusRefProp}
|
|
1522
|
-
id: "chart-builder-name", label: "Name", width: 200, value: formData.name, onChange: (e) => handleChange(e.target.value, 'name'), placeholder: "Name" }) }), showDashboardDropdown && !
|
|
1590
|
+
id: "chart-builder-name", label: "Name", width: 200, value: formData.name, onChange: (e) => handleChange(e.target.value, 'name'), placeholder: "Name" }) }), showDashboardDropdown && !destinationDashboardName && ((0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'column' }, children: (0, jsx_runtime_1.jsx)(SelectComponent, { label: "Dashboard", value: formData.dashboardName || '', onChange: async (e) => {
|
|
1523
1591
|
handleChange(e.target.value, 'dashboardName');
|
|
1524
1592
|
await updateDashboardFilters(e.target.value);
|
|
1525
1593
|
}, options: dashboardOptions.map((elem) => ({
|
|
1526
1594
|
label: elem.label,
|
|
1527
1595
|
value: elem.label,
|
|
1528
|
-
})), width: 200 }) })), (0, jsx_runtime_1.jsx)("div", { ref: selectRef, style: { display: 'flex', flexDirection: 'column' }, children: (0, jsx_runtime_1.jsx)(SelectComponent, { label: "Chart type", value: formData.chartType, onChange: (e) => handleChange(e.target.value, 'chartType'), options: chartTypes, width: 200 }) })] }), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
1596
|
+
})), width: 200 }) })), hideChartType ? ((0, jsx_runtime_1.jsx)("div", { style: { width: 200 } })) : ((0, jsx_runtime_1.jsx)("div", { ref: selectRef, style: { display: 'flex', flexDirection: 'column' }, children: (0, jsx_runtime_1.jsx)(SelectComponent, { label: "Chart type", value: formData.chartType, onChange: (e) => handleChange(e.target.value, 'chartType'), options: chartTypes, width: 200 }) }))] }), hidePivotForm ? null : ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
1529
1597
|
display: 'flex',
|
|
1530
1598
|
flexDirection: 'column',
|
|
1531
1599
|
gap: 6,
|
|
@@ -1549,10 +1617,12 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1549
1617
|
},
|
|
1550
1618
|
]);
|
|
1551
1619
|
setPivotPopUpTitle('Edit pivot');
|
|
1552
|
-
}, selectedPivotIndex: -1, onEditPivot: () => { }, CardComponent: CardComponent, ButtonComponent: ButtonComponent, HeaderComponent: HeaderComponent, showEdit: false, onClose: handleDeletePivot, minHeight: 180, LabelComponent: LabelComponent, TextComponent: TextComponent }) }) }))] })] })
|
|
1620
|
+
}, selectedPivotIndex: -1, onEditPivot: () => { }, CardComponent: CardComponent, ButtonComponent: ButtonComponent, HeaderComponent: HeaderComponent, showEdit: false, onClose: handleDeletePivot, minHeight: 180, LabelComponent: LabelComponent, TextComponent: TextComponent }) }) }))] })] })), !hideChartView &&
|
|
1621
|
+
(formData.pivot || formData.chartType !== 'table') && ((0, jsx_runtime_1.jsxs)("div", { children: [CHART_TO_LABELS[formData.chartType]?.xAxisLabel && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
1553
1622
|
display: 'flex',
|
|
1554
1623
|
flexDirection: 'column',
|
|
1555
|
-
}, children: (0, jsx_runtime_1.jsx)(HeaderComponent, { label: "Chart" }) })), CHART_TO_LABELS[formData.chartType]?.xAxisLabel && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(SubHeaderComponent, { label: CHART_TO_LABELS[formData.chartType]?.xAxisLabel ??
|
|
1624
|
+
}, children: (0, jsx_runtime_1.jsx)(HeaderComponent, { label: "Chart" }) })), CHART_TO_LABELS[formData.chartType]?.xAxisLabel && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(SubHeaderComponent, { label: CHART_TO_LABELS[formData.chartType]?.xAxisLabel ??
|
|
1625
|
+
'' }), (0, jsx_runtime_1.jsxs)(ChartBuilderInputRowContainer, { children: [(0, jsx_runtime_1.jsx)(SelectComponent, { value: formData.xAxisField, onChange: (e) => handleChange(e.target.value, 'xAxisField'), options: formData.pivot
|
|
1556
1626
|
? getPivotMetricOptions(formData.pivot, selectedPivotTable, formData.chartType)
|
|
1557
1627
|
: columns.map((elem) => ({
|
|
1558
1628
|
label: elem.field,
|
|
@@ -1563,7 +1633,8 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1563
1633
|
: formData.xAxisFormat, onChange: (e) => handleChange(e.target.value, 'xAxisFormat'), options: formData.pivot &&
|
|
1564
1634
|
(0, PivotModal_1.isDateField)(formData.xAxisField ?? '')
|
|
1565
1635
|
? [{ value: 'string', label: 'date' }]
|
|
1566
|
-
: xAxisFormatOptions, width: 200, hideEmptyOption: true })] })] })), CHART_TO_LABELS[formData.chartType]?.yAxisLabel && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(SubHeaderComponent, { label: CHART_TO_LABELS[formData.chartType]?.yAxisLabel ??
|
|
1636
|
+
: xAxisFormatOptions, width: 200, hideEmptyOption: true })] })] })), CHART_TO_LABELS[formData.chartType]?.yAxisLabel && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(SubHeaderComponent, { label: CHART_TO_LABELS[formData.chartType]?.yAxisLabel ??
|
|
1637
|
+
'' }), (0, jsx_runtime_1.jsxs)(ChartBuilderInputColumnContainer, { children: [formData.yAxisFields.map((yAxisField, index) => ((0, jsx_runtime_1.jsxs)(ChartBuilderInputRowContainer, { children: [(0, jsx_runtime_1.jsx)(SelectComponent, { value: formData.pivot
|
|
1567
1638
|
? formData.pivot.aggregations?.length
|
|
1568
1639
|
? ((0, pivotConstructor_1.disambiguatedValueField)(formData.pivot) ?? 'count')
|
|
1569
1640
|
: 'count'
|
|
@@ -1590,31 +1661,47 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1590
1661
|
})?.value ?? NUMBER_OPTIONS[0].value)
|
|
1591
1662
|
: yAxisField.format, onChange: (e) => handleChange(e.target.value, 'yAxisFields.format', index), options: formData.pivot
|
|
1592
1663
|
? NUMBER_OPTIONS
|
|
1593
|
-
: ALL_FORMAT_OPTIONS, width: 200, hideEmptyOption: true }), !formData.pivot && ((0, jsx_runtime_1.jsx)("div", { ref: deleteRef, style: { marginLeft: deleteButtonMargin }, children: (0, jsx_runtime_1.jsx)(DeleteButtonComponent, { onClick: () => handleRemoveField('yAxisFields', index) }) }))] }, 'yAxisField' + index))), !formData.pivot && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: () => handleAddField('yAxisFields'), label: "Add field +" }) }))] })] })), client?.featureFlags?.['referenceLines'] &&
|
|
1664
|
+
: ALL_FORMAT_OPTIONS, width: 200, hideEmptyOption: true }), !formData.pivot && ((0, jsx_runtime_1.jsx)("div", { ref: deleteRef, style: { marginLeft: deleteButtonMargin }, children: (0, jsx_runtime_1.jsx)(DeleteButtonComponent, { onClick: () => handleRemoveField('yAxisFields', index) }) }))] }, 'yAxisField' + index))), !formData.pivot && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: () => handleAddField('yAxisFields'), label: "Add field +" }) }))] })] })), client?.featureFlags?.['referenceLines'] &&
|
|
1665
|
+
(chartData.chartType === 'line' ||
|
|
1666
|
+
chartData.chartType === 'column') && ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(SubHeaderComponent, { label: 'Reference Lines' }), (0, jsx_runtime_1.jsxs)(ChartBuilderInputColumnContainer, { children: [formData.referenceLines?.map((refLine, index) => ((0, jsx_runtime_1.jsxs)(ChartBuilderInputRowContainer, { children: [(0, jsx_runtime_1.jsx)(SelectComponent, { width: 200, value: refLine.label, onChange: (e) => handleChange(e.target.value, 'referenceLines.label', index),
|
|
1594
1667
|
// only include numeric columns
|
|
1595
|
-
options: [
|
|
1668
|
+
options: [
|
|
1669
|
+
{
|
|
1596
1670
|
label: 'Custom Values',
|
|
1597
|
-
value: constants_1.REFERENCE_LINE
|
|
1598
|
-
}
|
|
1671
|
+
value: constants_1.REFERENCE_LINE,
|
|
1672
|
+
},
|
|
1673
|
+
].concat((selectedPivotTable?.columns
|
|
1674
|
+
? selectedPivotTable.columns
|
|
1675
|
+
: columns)
|
|
1676
|
+
.filter((c) => valueFormatter_1.NUMBER_FORMAT_TYPES.includes(c.format))
|
|
1677
|
+
.map((elem) => ({
|
|
1599
1678
|
label: elem.field,
|
|
1600
1679
|
value: elem.field,
|
|
1601
|
-
}))) }), refLine.label === constants_1.REFERENCE_LINE && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(TextInputComponent, { id: "chart-builder-ref-line-y1", width: 200, value: refLine.y1?.toString() ?? '', placeholder: "Start value", onChange: (e) => handleChange(e.target.value, 'referenceLines.y1', index) }), (0, jsx_runtime_1.jsx)(TextInputComponent, { id: "chart-builder-ref-line-y2", width: 200, value: refLine.y2?.toString() ?? '', placeholder: "End value", onChange: (e) => handleChange(e.target.value, 'referenceLines.y2', index) })] })), (0, jsx_runtime_1.jsx)("div", { ref: deleteRef, style: { marginLeft: deleteButtonMargin }, children: (0, jsx_runtime_1.jsx)(DeleteButtonComponent, { onClick: () => handleRemoveField('referenceLines', index) }) })] }, 'referenceLine' + index))), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: () => handleAddField('referenceLines'), label: "Add line +" }) })] })] })] })), windowWidth < 1200 && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
1680
|
+
}))) }), refLine.label === constants_1.REFERENCE_LINE && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(TextInputComponent, { id: "chart-builder-ref-line-y1", width: 200, value: refLine.y1?.toString() ?? '', placeholder: "Start value", onChange: (e) => handleChange(e.target.value, 'referenceLines.y1', index) }), (0, jsx_runtime_1.jsx)(TextInputComponent, { id: "chart-builder-ref-line-y2", width: 200, value: refLine.y2?.toString() ?? '', placeholder: "End value", onChange: (e) => handleChange(e.target.value, 'referenceLines.y2', index) })] })), (0, jsx_runtime_1.jsx)("div", { ref: deleteRef, style: { marginLeft: deleteButtonMargin }, children: (0, jsx_runtime_1.jsx)(DeleteButtonComponent, { onClick: () => handleRemoveField('referenceLines', index) }) })] }, 'referenceLine' + index))), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: () => handleAddField('referenceLines'), label: "Add line +" }) })] })] }))] })), windowWidth < 1200 && ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
1602
1681
|
width: '100%',
|
|
1603
1682
|
height: isHorizontalView || !isOpen ? 'calc(50% - 10px)' : 400,
|
|
1604
1683
|
flexGrow: 1,
|
|
1605
|
-
}, children: formData.chartType !== 'table' ? ((0, jsx_runtime_1.jsx)(TableComponent, { rows: formattedRows, columns:
|
|
1684
|
+
}, children: formData.chartType !== 'table' ? ((0, jsx_runtime_1.jsx)(TableComponent, { rows: formattedRows, columns: includeCustomFields && !containsCustomFields
|
|
1685
|
+
? formData.columns.concat(reportCustomFields)
|
|
1686
|
+
: formData.columns, onPageChange: (page) => {
|
|
1606
1687
|
onPageChange(page);
|
|
1607
1688
|
setCurrentPage(page);
|
|
1608
1689
|
}, onSortChange: (sort) => {
|
|
1609
1690
|
onSortChange && onSortChange(sort);
|
|
1610
|
-
}, currentPage: currentPage, rowCount: rowCount, rowCountIsLoading: rowCountIsLoading, isLoading: isLoading, disableSort: disableSort })) : ((0, jsx_runtime_1.jsx)(TableComponent, { rows: formattedRows, columns: selectedPivotTable
|
|
1691
|
+
}, currentPage: currentPage, rowCount: rowCount, rowCountIsLoading: rowCountIsLoading, isLoading: isLoading, disableSort: disableSort, hideLabels: false })) : ((0, jsx_runtime_1.jsx)(TableComponent, { rows: formattedRows, columns: selectedPivotTable
|
|
1611
1692
|
? selectedPivotTable.columns
|
|
1612
|
-
:
|
|
1693
|
+
: includeCustomFields && !containsCustomFields
|
|
1694
|
+
? formData.columns.concat(reportCustomFields)
|
|
1695
|
+
: formData.columns, onPageChange: (page) => {
|
|
1613
1696
|
onPageChange(page, true);
|
|
1614
1697
|
setCurrentPage(page);
|
|
1615
1698
|
}, onSortChange: (sort) => {
|
|
1616
1699
|
onSortChange && onSortChange(sort, true);
|
|
1617
|
-
}, currentPage: currentPage, rowCount: selectedPivotTable ? pivotData?.rowCount : rowCount, rowCountIsLoading: rowCountIsLoading, isLoading: isLoading, disableSort: disableSort })) })), (showTableFormatOptions || isAdmin) && ((0, jsx_runtime_1.jsxs)("div", {
|
|
1700
|
+
}, currentPage: currentPage, rowCount: selectedPivotTable ? pivotData?.rowCount : rowCount, rowCountIsLoading: rowCountIsLoading, isLoading: isLoading, disableSort: disableSort, hideLabels: false })) })), (showTableFormatOptions || isAdmin) && ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
1701
|
+
display: 'flex',
|
|
1702
|
+
flexDirection: 'column',
|
|
1703
|
+
gap: 6,
|
|
1704
|
+
}, children: [(0, jsx_runtime_1.jsxs)("div", { style: {
|
|
1618
1705
|
display: 'flex',
|
|
1619
1706
|
flexDirection: 'column',
|
|
1620
1707
|
}, children: [(0, jsx_runtime_1.jsx)(HeaderComponent, { label: "Table" }), (0, jsx_runtime_1.jsx)(SubHeaderComponent, { label: "Columns" })] }), (0, jsx_runtime_1.jsxs)(ChartBuilderInputColumnContainer, { children: [formData.pivot &&
|
|
@@ -1659,7 +1746,14 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1659
1746
|
flexDirection: 'row',
|
|
1660
1747
|
gap: 10,
|
|
1661
1748
|
}, children: [(0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: () => handleAddField('columns'), label: "Add column +" }), isAdmin &&
|
|
1662
|
-
client?.featureFlags?.customFieldsEnabled && ((0, jsx_runtime_1.jsx)(
|
|
1749
|
+
client?.featureFlags?.customFieldsEnabled && ((0, jsx_runtime_1.jsx)(UiComponents_1.QuillToolTip, { text: "Custom field directly referenced in report", enabled: containsCustomFields, textStyle: {
|
|
1750
|
+
maxWidth: '200px',
|
|
1751
|
+
whiteSpace: 'normal',
|
|
1752
|
+
}, children: (0, jsx_runtime_1.jsx)(CheckboxComponent, { isChecked: containsCustomFields || includeCustomFields, label: "Include Custom Fields", onChange: () => setIncludeCustomFields((prev) => !prev), disabled: containsCustomFields, containerStyle: {
|
|
1753
|
+
height: containsCustomFields
|
|
1754
|
+
? '100%' // required when wrapped with QuillToolTip
|
|
1755
|
+
: undefined,
|
|
1756
|
+
} }) }))] })) })] })] })), isAdmin && tenants && dashboardOwner && ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
1663
1757
|
display: 'flex',
|
|
1664
1758
|
flexDirection: 'column',
|
|
1665
1759
|
gap: 12,
|
|
@@ -1768,7 +1862,7 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1768
1862
|
gap: 6,
|
|
1769
1863
|
}, children: [(0, jsx_runtime_1.jsx)(HeaderComponent, { label: "Dashboard filter fields" }), isAdmin &&
|
|
1770
1864
|
formData.dateField &&
|
|
1771
|
-
dashboardConfig[formData.dashboardName ??
|
|
1865
|
+
dashboardConfig[formData.dashboardName ?? destinationDashboardName ?? '']?.config.dateFilter?.label && ((0, jsx_runtime_1.jsxs)(ChartBuilderInputRowContainer, { children: [(0, jsx_runtime_1.jsx)(TextInputComponent, { id: 'filterMap.dateFilter.' +
|
|
1772
1866
|
(dashboardConfig[formData.dashboardName ?? '']
|
|
1773
1867
|
?.config.dateFilter?.label ?? 'Date'), value: dashboardConfig[formData.dashboardName ?? '']
|
|
1774
1868
|
?.config.dateFilter?.label ?? 'Date', width: 200, onChange: () => { }, label: 'Filter', disabled: true }), (0, jsx_runtime_1.jsx)("div", { style: { display: 'flex', flexDirection: 'column' }, children: (0, jsx_runtime_1.jsx)(SelectComponent, { label: "Virtual Table", value: formData.dateField?.table, onChange: (e) => handleChange(e.target.value, 'dateField.table'), options: dateFieldOptions.map((elem) => ({
|
|
@@ -1793,12 +1887,14 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1793
1887
|
.map((filter, index) => ((0, jsx_runtime_1.jsxs)(ChartBuilderInputRowContainer, { children: [(0, jsx_runtime_1.jsx)(TextInputComponent, { id: 'filterMap.' + filter.label, value: filter.label, width: 200, onChange: () => { }, label: index === 0 &&
|
|
1794
1888
|
!(isAdmin &&
|
|
1795
1889
|
formData.dateField &&
|
|
1796
|
-
dashboardConfig[formData.dashboardName ?? '']
|
|
1890
|
+
dashboardConfig[formData.dashboardName ?? '']
|
|
1891
|
+
?.config.dateFilter?.label)
|
|
1797
1892
|
? 'Filter'
|
|
1798
1893
|
: '', disabled: true }), (0, jsx_runtime_1.jsx)(SelectComponent, { label: index === 0 &&
|
|
1799
1894
|
!(isAdmin &&
|
|
1800
1895
|
formData.dateField &&
|
|
1801
|
-
dashboardConfig[formData.dashboardName ?? '']
|
|
1896
|
+
dashboardConfig[formData.dashboardName ?? '']
|
|
1897
|
+
?.config.dateFilter?.label)
|
|
1802
1898
|
? 'Virtual Table'
|
|
1803
1899
|
: '', value: filterMap[filter.label]?.table ?? filter.table, onChange: (e) => setFilterMap({
|
|
1804
1900
|
...filterMap,
|
|
@@ -1816,7 +1912,8 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1816
1912
|
})), width: 200 }), (0, jsx_runtime_1.jsx)(SelectComponent, { label: index === 0 &&
|
|
1817
1913
|
!(isAdmin &&
|
|
1818
1914
|
formData.dateField &&
|
|
1819
|
-
dashboardConfig[formData.dashboardName ?? '']
|
|
1915
|
+
dashboardConfig[formData.dashboardName ?? '']
|
|
1916
|
+
?.config.dateFilter?.label)
|
|
1820
1917
|
? 'Field'
|
|
1821
1918
|
: '', value: filterMap[filter.label]?.field ?? filter.field, onChange: (e) => setFilterMap({
|
|
1822
1919
|
...filterMap,
|
|
@@ -1855,15 +1952,15 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1855
1952
|
justifyContent: 'space-between',
|
|
1856
1953
|
alignItems: 'center',
|
|
1857
1954
|
gap: 6,
|
|
1858
|
-
}, children: [!!filterIssues?.length && ((0, jsx_runtime_1.jsx)(ErrorMessageComponent, { errorMessage: filterIssues[0] || '
|
|
1955
|
+
}, children: [!!filterIssues?.length && ((0, jsx_runtime_1.jsx)(ErrorMessageComponent, { errorMessage: filterIssues[0] || 'Dashboard - Report issues', containerStyle: { height: '100%' } })), (0, jsx_runtime_1.jsxs)("div", { style: {
|
|
1859
1956
|
display: 'flex',
|
|
1860
1957
|
flexDirection: 'row',
|
|
1861
1958
|
gap: 10,
|
|
1862
1959
|
backgroundColor: 'white',
|
|
1863
|
-
}, children: [(0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: () => {
|
|
1960
|
+
}, children: [hideDiscardChanges ? null : ((0, jsx_runtime_1.jsx)(SecondaryButtonComponent, { onClick: () => {
|
|
1864
1961
|
setIsOpen(false);
|
|
1865
1962
|
onDiscardChanges && onDiscardChanges();
|
|
1866
|
-
}, label: 'Discard changes' }), (0, jsx_runtime_1.jsx)(ButtonComponent, { onClick: () => {
|
|
1963
|
+
}, label: 'Discard changes' })), (0, jsx_runtime_1.jsx)(ButtonComponent, { onClick: () => {
|
|
1867
1964
|
if (loadingFormData) {
|
|
1868
1965
|
setTriggeredEditChart(true);
|
|
1869
1966
|
}
|