@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/esm/ChartBuilder.js
CHANGED
|
@@ -8,7 +8,7 @@ import { removeDoubleQuotes, snakeAndCamelCaseToTitleCase, } from './utils/textP
|
|
|
8
8
|
import { QuillSelectComponent } from './components/QuillSelect';
|
|
9
9
|
import { TEMP_REPORT_ID, } from './models/Report';
|
|
10
10
|
import { QuillCard } from './components/QuillCard';
|
|
11
|
-
import { NUMBER_FORMAT_TYPES, quillFormat } from './utils/valueFormatter';
|
|
11
|
+
import { quillAutoFormat, NUMBER_FORMAT_TYPES, quillFormat, } from './utils/valueFormatter';
|
|
12
12
|
import { convertFieldTypeToJSType, isDateType, isNumberType, isStringType, } from './utils/columnProcessing';
|
|
13
13
|
import { getSelectFromAST, getTablesHelper } from './utils/astProcessing';
|
|
14
14
|
import { validateReport } from './utils/validation';
|
|
@@ -27,7 +27,17 @@ import { useQuillCloud } from './utils/dataFetcher';
|
|
|
27
27
|
import { QuillMultiSelectSectionList } from './components/QuillMultiSelectSectionList';
|
|
28
28
|
import { ALL_TENANTS, REFERENCE_LINE, SINGLE_TENANT } from './utils/constants';
|
|
29
29
|
import { disambiguatedValueField } from './utils/pivotConstructor';
|
|
30
|
-
const CHART_TYPES = [
|
|
30
|
+
const CHART_TYPES = [
|
|
31
|
+
'column',
|
|
32
|
+
'line',
|
|
33
|
+
'table',
|
|
34
|
+
'metric',
|
|
35
|
+
'gauge',
|
|
36
|
+
'bar',
|
|
37
|
+
'pie',
|
|
38
|
+
'US map',
|
|
39
|
+
'World map',
|
|
40
|
+
];
|
|
31
41
|
const CHART_TO_LABELS = {
|
|
32
42
|
column: { xAxisLabel: 'X-Axis', yAxisLabel: 'Y-Axis' },
|
|
33
43
|
line: { xAxisLabel: 'X-Axis', yAxisLabel: 'Y-Axis' },
|
|
@@ -42,7 +52,9 @@ const CHART_TO_LABELS = {
|
|
|
42
52
|
function getPivotMetricOptions(pivot, selectedPivotTable, chartType) {
|
|
43
53
|
if (['metric', 'gauge'].includes(chartType) && selectedPivotTable) {
|
|
44
54
|
return selectedPivotTable.columns.map((elem) => ({
|
|
45
|
-
label: elem.field === pivot?.rowField
|
|
55
|
+
label: elem.field === pivot?.rowField
|
|
56
|
+
? `Pivot Row (${elem.field})`
|
|
57
|
+
: elem.field,
|
|
46
58
|
value: elem.field,
|
|
47
59
|
}));
|
|
48
60
|
}
|
|
@@ -91,7 +103,15 @@ export function createInitialFormData(columns) {
|
|
|
91
103
|
function getChartTypeOptions(formData, dashboard) {
|
|
92
104
|
let viableCharts = CHART_TYPES;
|
|
93
105
|
if (dashboard && dashboard.dateFilter && dashboard.dateFilter.comparison) {
|
|
94
|
-
viableCharts = viableCharts.filter((chart) => ![
|
|
106
|
+
viableCharts = viableCharts.filter((chart) => ![
|
|
107
|
+
'table',
|
|
108
|
+
'metric',
|
|
109
|
+
'gauge',
|
|
110
|
+
'bar',
|
|
111
|
+
'pie',
|
|
112
|
+
'US map',
|
|
113
|
+
'World map',
|
|
114
|
+
].includes(chart));
|
|
95
115
|
}
|
|
96
116
|
if (formData.pivot && !formData.pivot.rowField) {
|
|
97
117
|
return viableCharts
|
|
@@ -103,13 +123,16 @@ function getChartTypeOptions(formData, dashboard) {
|
|
|
103
123
|
}
|
|
104
124
|
else {
|
|
105
125
|
return viableCharts
|
|
106
|
-
.filter((elem) => !(
|
|
126
|
+
.filter((elem) => !(formData.pivot &&
|
|
107
127
|
formData.pivot.columnField &&
|
|
108
|
-
(elem === 'bar' ||
|
|
128
|
+
(elem === 'bar' ||
|
|
129
|
+
elem === 'pie' ||
|
|
130
|
+
elem === 'US map' ||
|
|
131
|
+
elem === 'World map')))
|
|
109
132
|
.map((elem) => ({ label: elem, value: elem }));
|
|
110
133
|
}
|
|
111
134
|
}
|
|
112
|
-
function createReportFromForm(formData, report, selectedPivotTable, rows = [], filtersApplied = [], referenceLineQueryResults) {
|
|
135
|
+
export function createReportFromForm(formData, report, selectedPivotTable, rows = [], filtersApplied = [], referenceLineQueryResults) {
|
|
113
136
|
const newReport = convertInternalReportToReport(mergeComparisonRange({
|
|
114
137
|
...formData,
|
|
115
138
|
dashboardName: formData.dashboardName || '',
|
|
@@ -131,11 +154,15 @@ function createReportFromForm(formData, report, selectedPivotTable, rows = [], f
|
|
|
131
154
|
columnInternal: report?.columnInternal ?? [],
|
|
132
155
|
referenceLines: formData.referenceLines?.map((elem) => ({
|
|
133
156
|
label: elem.label,
|
|
134
|
-
query: elem.label === REFERENCE_LINE
|
|
157
|
+
query: elem.label === REFERENCE_LINE
|
|
158
|
+
? [Number(elem.y1) || 0, Number(elem.y2) || 0]
|
|
159
|
+
: elem.label,
|
|
135
160
|
})) || [],
|
|
136
161
|
referenceLineYValues: formData.referenceLines?.map((elem, index) => ({
|
|
137
162
|
label: elem.label,
|
|
138
|
-
query: elem.label === REFERENCE_LINE
|
|
163
|
+
query: elem.label === REFERENCE_LINE
|
|
164
|
+
? [Number(elem.y1) || 0, Number(elem.y2) || 0]
|
|
165
|
+
: referenceLineQueryResults?.[index],
|
|
139
166
|
})) || [],
|
|
140
167
|
}), filtersApplied);
|
|
141
168
|
return newReport;
|
|
@@ -255,9 +282,9 @@ export function ChartBuilderWithModal(props) {
|
|
|
255
282
|
*/
|
|
256
283
|
export default function ChartBuilder({ TextInputComponent = QuillTextInput, SelectComponent = QuillSelectComponent,
|
|
257
284
|
// MultiSelectComponent = QuillMultiSelectComponentWithCombo,
|
|
258
|
-
ButtonComponent = MemoizedButton, SecondaryButtonComponent = MemoizedSecondaryButton, HeaderComponent = MemoizedHeader, SubHeaderComponent = MemoizedSubHeader, LabelComponent = MemoizedLabel, DeleteButtonComponent = MemoizedDeleteButton, TextComponent = MemoizedText, PopoverComponent = MemoizedPopover, CardComponent = QuillCard, TableComponent = QuillTableComponent, ModalComponent = MemoizedModal, LoadingComponent = QuillLoadingComponent, ErrorMessageComponent = QuillErrorMessageComponent, ChartBuilderInputRowContainer = QuillChartBuilderInputRowContainer, ChartBuilderInputColumnContainer = QuillChartBuilderInputColumnContainer, PivotRowContainer = QuillPivotRowContainer, PivotColumnContainer = QuillPivotColumnContainer, FormContainer = QuillChartBuilderFormContainer, ErrorComponent = QuillChartErrorWithAction, CheckboxComponent = 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,
|
|
285
|
+
ButtonComponent = MemoizedButton, SecondaryButtonComponent = MemoizedSecondaryButton, HeaderComponent = MemoizedHeader, SubHeaderComponent = MemoizedSubHeader, LabelComponent = MemoizedLabel, DeleteButtonComponent = MemoizedDeleteButton, TextComponent = MemoizedText, PopoverComponent = MemoizedPopover, CardComponent = QuillCard, TableComponent = QuillTableComponent, ModalComponent = MemoizedModal, LoadingComponent = QuillLoadingComponent, ErrorMessageComponent = QuillErrorMessageComponent, ChartBuilderInputRowContainer = QuillChartBuilderInputRowContainer, ChartBuilderInputColumnContainer = QuillChartBuilderInputColumnContainer, PivotRowContainer = QuillPivotRowContainer, PivotColumnContainer = QuillPivotColumnContainer, FormContainer = QuillChartBuilderFormContainer, ErrorComponent = QuillChartErrorWithAction, CheckboxComponent = 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,
|
|
259
286
|
// isLoading,
|
|
260
|
-
onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
287
|
+
destinationDashboard, onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
261
288
|
const [client] = useContext(ClientContext);
|
|
262
289
|
const [theme] = useContext(ThemeContext);
|
|
263
290
|
const [schemaData] = useContext(SchemaDataContext);
|
|
@@ -390,7 +417,7 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
390
417
|
}
|
|
391
418
|
: undefined;
|
|
392
419
|
const columns = report?.columnInternal ?? [];
|
|
393
|
-
const
|
|
420
|
+
const destinationDashboardName = destinationDashboard || report?.dashboardName;
|
|
394
421
|
const query = report?.queryString;
|
|
395
422
|
const [loadingFormData, setLoadingFormData] = useState(false);
|
|
396
423
|
const [triggeredEditChart, setTriggeredEditChart] = useState(false);
|
|
@@ -575,19 +602,24 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
575
602
|
...report,
|
|
576
603
|
// ...pivotData,
|
|
577
604
|
dateField: dateField,
|
|
578
|
-
referenceLines: report?.referenceLines
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
605
|
+
referenceLines: report?.referenceLines
|
|
606
|
+
? report.referenceLines?.map(({ label, query }) => {
|
|
607
|
+
if (typeof query === 'string') {
|
|
608
|
+
return { label, y1: undefined, y2: undefined };
|
|
609
|
+
}
|
|
610
|
+
return {
|
|
611
|
+
label,
|
|
612
|
+
y1: query[0],
|
|
613
|
+
y2: query[1],
|
|
614
|
+
};
|
|
615
|
+
})
|
|
616
|
+
: [],
|
|
588
617
|
};
|
|
589
618
|
};
|
|
590
619
|
const [formData, setFormData] = useState(formFormDataFromReport(report));
|
|
620
|
+
const reportCustomFields = useMemo(() => {
|
|
621
|
+
return (report?.columnsWithCustomFields?.filter((col) => !report?.columns?.some((c) => col.field === c.field)) ?? []);
|
|
622
|
+
}, [report?.columnsWithCustomFields, report?.columns]);
|
|
591
623
|
const referenceLineQueryResults = useMemo(() => {
|
|
592
624
|
return formData?.referenceLines?.map((line) => {
|
|
593
625
|
if (line.label === REFERENCE_LINE) {
|
|
@@ -718,14 +750,14 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
718
750
|
{ label: 'New - Dashboard', value: 'New - Dashboard' },
|
|
719
751
|
];
|
|
720
752
|
}
|
|
721
|
-
if (
|
|
753
|
+
if (destinationDashboardName) {
|
|
722
754
|
dashboardOptions = [
|
|
723
|
-
{ label:
|
|
755
|
+
{ label: destinationDashboardName, value: destinationDashboardName },
|
|
724
756
|
];
|
|
725
757
|
}
|
|
726
758
|
let dashboardName = report?.dashboardName ?? dashboardOptions[0]?.label ?? '';
|
|
727
|
-
if (
|
|
728
|
-
dashboardName =
|
|
759
|
+
if (destinationDashboardName) {
|
|
760
|
+
dashboardName = destinationDashboardName;
|
|
729
761
|
}
|
|
730
762
|
const curDashboard = await updateDashboardFilters(dashboardName);
|
|
731
763
|
setDashboardOptions(dashboardOptions);
|
|
@@ -834,7 +866,8 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
834
866
|
{ value: 'whole_number', label: 'whole number' },
|
|
835
867
|
{ value: 'two_decimal_places', label: 'two decimal places' },
|
|
836
868
|
{ value: 'percent', label: 'percentage' },
|
|
837
|
-
]
|
|
869
|
+
]
|
|
870
|
+
: ALL_FORMAT_OPTIONS;
|
|
838
871
|
}, [chartData?.chartType]);
|
|
839
872
|
const fetchPivotData = async (pivot, tableInfo, uniqueValues, overrideFilters) => {
|
|
840
873
|
const dashboardFilters = filtersEnabled
|
|
@@ -863,7 +896,7 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
863
896
|
: undefined,
|
|
864
897
|
client,
|
|
865
898
|
uniqueValues,
|
|
866
|
-
dashboardName:
|
|
899
|
+
dashboardName: destinationDashboardName,
|
|
867
900
|
tenants,
|
|
868
901
|
additionalProcessing: baseProcessing,
|
|
869
902
|
});
|
|
@@ -908,12 +941,17 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
908
941
|
if (!rows)
|
|
909
942
|
return [];
|
|
910
943
|
return rows.map((row) => {
|
|
911
|
-
|
|
944
|
+
const columns = formData.includeCustomFields && !containsCustomFields
|
|
945
|
+
? formData.columns.concat(reportCustomFields)
|
|
946
|
+
: formData.columns;
|
|
947
|
+
return columns.reduce((formattedRow, column) => {
|
|
912
948
|
// Apply the format function to each field in the row
|
|
913
|
-
const formattedValue =
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
949
|
+
const formattedValue = column.inferFormat
|
|
950
|
+
? quillAutoFormat(row[column.field])
|
|
951
|
+
: quillFormat({
|
|
952
|
+
value: row[column.field],
|
|
953
|
+
format: column.format,
|
|
954
|
+
});
|
|
917
955
|
formattedRow[column.field] = formattedValue;
|
|
918
956
|
return formattedRow;
|
|
919
957
|
}, {});
|
|
@@ -944,7 +982,7 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
944
982
|
rowsOnly: false,
|
|
945
983
|
rowCountOnly: true,
|
|
946
984
|
filterMap: canonicalFilterMap,
|
|
947
|
-
dashboardName:
|
|
985
|
+
dashboardName: destinationDashboardName,
|
|
948
986
|
});
|
|
949
987
|
if (tableInfo.rowCount !== undefined) {
|
|
950
988
|
setRowCount(tableInfo.rowCount);
|
|
@@ -996,7 +1034,7 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
996
1034
|
rowsOnly: true,
|
|
997
1035
|
rowCountOnly: false,
|
|
998
1036
|
filterMap: canonicalFilterMap,
|
|
999
|
-
dashboardName:
|
|
1037
|
+
dashboardName: destinationDashboardName,
|
|
1000
1038
|
});
|
|
1001
1039
|
setCurrentProcessing(processing);
|
|
1002
1040
|
setRows(tableInfo.rows);
|
|
@@ -1005,7 +1043,7 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1005
1043
|
fetchRowCount(processing, overrideFilters);
|
|
1006
1044
|
if (formData.pivot) {
|
|
1007
1045
|
try {
|
|
1008
|
-
const uniqueValues = await getUniqueValuesByColumns(tableInfo.columns.filter((column) => column.field === formData.pivot?.columnField), report.queryString, tableInfo.rows, client, tenants, schemaData.customFields ?? {}, overrideFilters,
|
|
1046
|
+
const uniqueValues = await getUniqueValuesByColumns(tableInfo.columns.filter((column) => column.field === formData.pivot?.columnField), report.queryString, tableInfo.rows, client, tenants, schemaData.customFields ?? {}, overrideFilters, destinationDashboardName);
|
|
1009
1047
|
fetchPivotData(formData.pivot, tableInfo, uniqueValues, overrideFilters);
|
|
1010
1048
|
}
|
|
1011
1049
|
catch (e) {
|
|
@@ -1072,7 +1110,7 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1072
1110
|
rowsOnly: false,
|
|
1073
1111
|
rowCountOnly: false,
|
|
1074
1112
|
filterMap: canonicalFilterMap,
|
|
1075
|
-
dashboardName:
|
|
1113
|
+
dashboardName: destinationDashboardName,
|
|
1076
1114
|
pivot: isPivotTable ? report.pivot : undefined,
|
|
1077
1115
|
getPivotRowCount: false,
|
|
1078
1116
|
});
|
|
@@ -1120,8 +1158,20 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1120
1158
|
else if (index !== undefined) {
|
|
1121
1159
|
// For dynamic array fields
|
|
1122
1160
|
const [field, subfield] = fieldName.split('.');
|
|
1161
|
+
let newLabel = undefined;
|
|
1162
|
+
if (field === 'columns' && subfield === 'field') {
|
|
1163
|
+
if (!formData['columns'][index]?.label) {
|
|
1164
|
+
newLabel = snakeAndCamelCaseToTitleCase(value);
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1123
1167
|
// @ts-ignore
|
|
1124
|
-
const updatedArray = formData[field].map((item, i) => i === index
|
|
1168
|
+
const updatedArray = formData[field].map((item, i) => i === index
|
|
1169
|
+
? {
|
|
1170
|
+
...item,
|
|
1171
|
+
label: newLabel ? newLabel : item.label,
|
|
1172
|
+
[subfield]: value,
|
|
1173
|
+
}
|
|
1174
|
+
: item);
|
|
1125
1175
|
updatedForm = { ...formData, [field]: updatedArray };
|
|
1126
1176
|
setFormData(updatedForm);
|
|
1127
1177
|
setChartTypes(getChartTypeOptions(updatedForm, dashboardConfig[updatedForm.dashboardName ?? '']));
|
|
@@ -1235,6 +1285,11 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1235
1285
|
...formData,
|
|
1236
1286
|
dashboardName: formData.dashboardName,
|
|
1237
1287
|
pivot: null,
|
|
1288
|
+
chartType: formEmptyState.chartType,
|
|
1289
|
+
xAxisField: formEmptyState.xAxisField,
|
|
1290
|
+
xAxisFormat: formEmptyState.xAxisFormat,
|
|
1291
|
+
xAxisLabel: formEmptyState.xAxisLabel,
|
|
1292
|
+
yAxisFields: formEmptyState.yAxisFields,
|
|
1238
1293
|
});
|
|
1239
1294
|
// maybe validate
|
|
1240
1295
|
setSelectedPivotTable(undefined);
|
|
@@ -1329,9 +1384,7 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1329
1384
|
...(formData.dateField?.table
|
|
1330
1385
|
? {}
|
|
1331
1386
|
: { dateField: { ...defaultDateField } }),
|
|
1332
|
-
|
|
1333
|
-
? {}
|
|
1334
|
-
: { dashboardName: report?.dashboardName }),
|
|
1387
|
+
dashboardName: destinationDashboardName,
|
|
1335
1388
|
query: report?.queryString ?? '',
|
|
1336
1389
|
pivot: formData.pivot,
|
|
1337
1390
|
referencedTables: allTables,
|
|
@@ -1360,7 +1413,9 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1360
1413
|
referenceLines: formData.referenceLines.map((line) => {
|
|
1361
1414
|
return {
|
|
1362
1415
|
label: line.label,
|
|
1363
|
-
query: line.label === REFERENCE_LINE
|
|
1416
|
+
query: line.label === REFERENCE_LINE
|
|
1417
|
+
? [Number(line.y1 ?? 0) || 0, Number(line.y2 ?? 0) || 0]
|
|
1418
|
+
: '',
|
|
1364
1419
|
};
|
|
1365
1420
|
}),
|
|
1366
1421
|
};
|
|
@@ -1422,15 +1477,17 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1422
1477
|
gap: '20px',
|
|
1423
1478
|
flexDirection: isHorizontalView ? 'row' : 'column',
|
|
1424
1479
|
boxSizing: 'border-box',
|
|
1425
|
-
}, children: [_jsxs("div", { style: {
|
|
1480
|
+
}, children: [hideChartView ? null : (_jsxs("div", { style: {
|
|
1426
1481
|
display: 'flex',
|
|
1427
1482
|
flexDirection: 'column',
|
|
1428
1483
|
gap: isOpen ? 16 : 20,
|
|
1429
1484
|
overflowY: 'scroll',
|
|
1430
1485
|
height: isHorizontalView || !isOpen ? '100%' : 800,
|
|
1431
1486
|
...(isHorizontalView && {
|
|
1432
|
-
flexGrow: 1,
|
|
1433
|
-
|
|
1487
|
+
// flexGrow: 1,
|
|
1488
|
+
width: !isOpen
|
|
1489
|
+
? '100%'
|
|
1490
|
+
: `calc(100% - ${formWidth}px - 20px)`, // width of left sidebar plus gap
|
|
1434
1491
|
}),
|
|
1435
1492
|
...(!isHorizontalView && isOpen && { width: formWidth }),
|
|
1436
1493
|
}, children: [!isEditingMode && (report?.adminError || report?.error) ? (_jsx(ErrorComponent, { label: report.adminError || report.error, onClick: onClickChartError })) : ((isHorizontalView || (!isOpen && windowWidth > 1200)) && (_jsx(InternalChart, { report: chartData, filtersEnabled: filtersEnabled, setFiltersEnabled: (hide) => {
|
|
@@ -1441,10 +1498,13 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1441
1498
|
// formData.chartType === 'metric'
|
|
1442
1499
|
// ? 100
|
|
1443
1500
|
// : `calc(${filtersEnabled ? 50 : 70}%)`,
|
|
1444
|
-
...(isHorizontalView && {
|
|
1501
|
+
...(isHorizontalView && {
|
|
1502
|
+
flexGrow: !['table'].includes(formData.chartType) ? 1 : 0,
|
|
1503
|
+
}),
|
|
1445
1504
|
}, onClickChartElement: onClickChartElement, filterToggleDisabled: Object.values(validFilter).includes(false), onDashboardFilterChange: onDashboardFilterChange, layoutChanged: isOpen }))),
|
|
1446
1505
|
// Make sure to display non-pivoted table when using pivot chart
|
|
1447
|
-
|
|
1506
|
+
!hideChartView &&
|
|
1507
|
+
(isHorizontalView || (!isOpen && windowWidth < 1200)) && (_jsxs("div", { style: {
|
|
1448
1508
|
width: '100%',
|
|
1449
1509
|
// height:
|
|
1450
1510
|
// isHorizontalView || !isOpen
|
|
@@ -1462,23 +1522,25 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1462
1522
|
? 200
|
|
1463
1523
|
: formData.chartType === 'metric'
|
|
1464
1524
|
? 300
|
|
1465
|
-
:
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1525
|
+
: 500,
|
|
1526
|
+
flexGrow: formData.chartType !== 'table' ? 1 : 0,
|
|
1527
|
+
}, onClickChartElement: onClickChartElement, filterToggleDisabled: Object.values(validFilter).includes(false), onDashboardFilterChange: onDashboardFilterChange, layoutChanged: isOpen })), hideTableView ? null : formData.chartType !== 'table' ? (_jsx(TableComponent, { rows: formattedRows, columns: includeCustomFields && !containsCustomFields
|
|
1528
|
+
? formData.columns.concat(reportCustomFields)
|
|
1529
|
+
: formData.columns, onPageChange: (page) => {
|
|
1470
1530
|
onPageChange(page);
|
|
1471
1531
|
setCurrentPage(page);
|
|
1472
1532
|
}, onSortChange: (sort) => {
|
|
1473
1533
|
onSortChange && onSortChange(sort);
|
|
1474
|
-
}, currentPage: currentPage, rowCount: rowCount, isLoading: isLoading, rowCountIsLoading: rowCountIsLoading, disableSort: disableSort })) : (_jsx(TableComponent, { rows: formattedRows, columns: selectedPivotTable
|
|
1534
|
+
}, currentPage: currentPage, rowCount: rowCount, isLoading: isLoading, rowCountIsLoading: rowCountIsLoading, disableSort: disableSort, hideLabels: false })) : (_jsx(TableComponent, { rows: formattedRows, columns: selectedPivotTable
|
|
1475
1535
|
? selectedPivotTable.columns
|
|
1476
|
-
:
|
|
1536
|
+
: includeCustomFields && !containsCustomFields
|
|
1537
|
+
? formData.columns.concat(reportCustomFields)
|
|
1538
|
+
: formData.columns, onPageChange: (page) => {
|
|
1477
1539
|
onPageChange(page, true);
|
|
1478
1540
|
setCurrentPage(page);
|
|
1479
1541
|
}, onSortChange: (sort) => {
|
|
1480
1542
|
onSortChange && onSortChange(sort, true);
|
|
1481
|
-
}, currentPage: currentPage, rowCount: selectedPivotTable ? pivotData?.rowCount : rowCount, rowCountIsLoading: rowCountIsLoading, isLoading: isLoading, disableSort: disableSort }))] }))] }), isOpen && (_jsxs("form", { ref: parentRef, id: "quill-chart-form", onSubmit: handleSubmit, style: {
|
|
1543
|
+
}, currentPage: currentPage, rowCount: selectedPivotTable ? pivotData?.rowCount : rowCount, rowCountIsLoading: rowCountIsLoading, isLoading: isLoading, disableSort: disableSort, hideLabels: false }))] }))] })), isOpen && (_jsxs("form", { ref: parentRef, id: "quill-chart-form", onSubmit: handleSubmit, style: {
|
|
1482
1544
|
display: 'flex',
|
|
1483
1545
|
flexDirection: 'column',
|
|
1484
1546
|
gap: 20,
|
|
@@ -1494,30 +1556,35 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1494
1556
|
paddingTop: modalPadding,
|
|
1495
1557
|
paddingBottom: modalPadding,
|
|
1496
1558
|
}),
|
|
1497
|
-
}, children: [_jsxs(FormContainer, { children: [
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
: formData.chartType === '
|
|
1505
|
-
?
|
|
1506
|
-
: formData.chartType === '
|
|
1507
|
-
?
|
|
1508
|
-
:
|
|
1509
|
-
|
|
1510
|
-
|
|
1559
|
+
}, children: [_jsxs(FormContainer, { children: [hideChartView
|
|
1560
|
+
? null
|
|
1561
|
+
: (formData.pivot || formData.chartType !== 'table') &&
|
|
1562
|
+
windowWidth < 1200 && (_jsx(InternalChart, { report: chartData, filtersEnabled: filtersEnabled, setFiltersEnabled: (hide) => {
|
|
1563
|
+
onFiltersEnabledChanged(hide);
|
|
1564
|
+
}, colors: theme?.chartColors, loading: false, hideDateRangeFilter: hideDateRangeFilter, isAdmin: isAdmin, containerStyle: {
|
|
1565
|
+
width: '100%',
|
|
1566
|
+
height: formData.chartType === 'table'
|
|
1567
|
+
? 200
|
|
1568
|
+
: formData.chartType === 'metric'
|
|
1569
|
+
? 300
|
|
1570
|
+
: formData.chartType === 'US map' ||
|
|
1571
|
+
formData.chartType === 'World map'
|
|
1572
|
+
? 'fit-content'
|
|
1573
|
+
: 500,
|
|
1574
|
+
flexGrow: !['table'].includes(formData.chartType)
|
|
1575
|
+
? 1
|
|
1576
|
+
: 0,
|
|
1577
|
+
}, onClickChartElement: onClickChartElement, filterToggleDisabled: Object.values(validFilter).includes(false), onDashboardFilterChange: onDashboardFilterChange, layoutChanged: isOpen })), _jsxs(ChartBuilderInputRowContainer, { children: [_jsx("div", { ref: inputRef, style: { display: 'flex', flexDirection: 'column' }, children: _jsx(TextInputComponent
|
|
1511
1578
|
// {...autofocusRefProp}
|
|
1512
1579
|
, {
|
|
1513
1580
|
// {...autofocusRefProp}
|
|
1514
|
-
id: "chart-builder-name", label: "Name", width: 200, value: formData.name, onChange: (e) => handleChange(e.target.value, 'name'), placeholder: "Name" }) }), showDashboardDropdown && !
|
|
1581
|
+
id: "chart-builder-name", label: "Name", width: 200, value: formData.name, onChange: (e) => handleChange(e.target.value, 'name'), placeholder: "Name" }) }), showDashboardDropdown && !destinationDashboardName && (_jsx("div", { style: { display: 'flex', flexDirection: 'column' }, children: _jsx(SelectComponent, { label: "Dashboard", value: formData.dashboardName || '', onChange: async (e) => {
|
|
1515
1582
|
handleChange(e.target.value, 'dashboardName');
|
|
1516
1583
|
await updateDashboardFilters(e.target.value);
|
|
1517
1584
|
}, options: dashboardOptions.map((elem) => ({
|
|
1518
1585
|
label: elem.label,
|
|
1519
1586
|
value: elem.label,
|
|
1520
|
-
})), width: 200 }) })), _jsx("div", { ref: selectRef, style: { display: 'flex', flexDirection: 'column' }, children: _jsx(SelectComponent, { label: "Chart type", value: formData.chartType, onChange: (e) => handleChange(e.target.value, 'chartType'), options: chartTypes, width: 200 }) })] }), _jsxs("div", { style: {
|
|
1587
|
+
})), width: 200 }) })), hideChartType ? (_jsx("div", { style: { width: 200 } })) : (_jsx("div", { ref: selectRef, style: { display: 'flex', flexDirection: 'column' }, children: _jsx(SelectComponent, { label: "Chart type", value: formData.chartType, onChange: (e) => handleChange(e.target.value, 'chartType'), options: chartTypes, width: 200 }) }))] }), hidePivotForm ? null : (_jsxs("div", { style: {
|
|
1521
1588
|
display: 'flex',
|
|
1522
1589
|
flexDirection: 'column',
|
|
1523
1590
|
gap: 6,
|
|
@@ -1541,10 +1608,12 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1541
1608
|
},
|
|
1542
1609
|
]);
|
|
1543
1610
|
setPivotPopUpTitle('Edit pivot');
|
|
1544
|
-
}, selectedPivotIndex: -1, onEditPivot: () => { }, CardComponent: CardComponent, ButtonComponent: ButtonComponent, HeaderComponent: HeaderComponent, showEdit: false, onClose: handleDeletePivot, minHeight: 180, LabelComponent: LabelComponent, TextComponent: TextComponent }) }) }))] })] })
|
|
1611
|
+
}, selectedPivotIndex: -1, onEditPivot: () => { }, CardComponent: CardComponent, ButtonComponent: ButtonComponent, HeaderComponent: HeaderComponent, showEdit: false, onClose: handleDeletePivot, minHeight: 180, LabelComponent: LabelComponent, TextComponent: TextComponent }) }) }))] })] })), !hideChartView &&
|
|
1612
|
+
(formData.pivot || formData.chartType !== 'table') && (_jsxs("div", { children: [CHART_TO_LABELS[formData.chartType]?.xAxisLabel && (_jsx("div", { style: {
|
|
1545
1613
|
display: 'flex',
|
|
1546
1614
|
flexDirection: 'column',
|
|
1547
|
-
}, children: _jsx(HeaderComponent, { label: "Chart" }) })), CHART_TO_LABELS[formData.chartType]?.xAxisLabel && (_jsxs("div", { children: [_jsx(SubHeaderComponent, { label: CHART_TO_LABELS[formData.chartType]?.xAxisLabel ??
|
|
1615
|
+
}, children: _jsx(HeaderComponent, { label: "Chart" }) })), CHART_TO_LABELS[formData.chartType]?.xAxisLabel && (_jsxs("div", { children: [_jsx(SubHeaderComponent, { label: CHART_TO_LABELS[formData.chartType]?.xAxisLabel ??
|
|
1616
|
+
'' }), _jsxs(ChartBuilderInputRowContainer, { children: [_jsx(SelectComponent, { value: formData.xAxisField, onChange: (e) => handleChange(e.target.value, 'xAxisField'), options: formData.pivot
|
|
1548
1617
|
? getPivotMetricOptions(formData.pivot, selectedPivotTable, formData.chartType)
|
|
1549
1618
|
: columns.map((elem) => ({
|
|
1550
1619
|
label: elem.field,
|
|
@@ -1555,7 +1624,8 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1555
1624
|
: formData.xAxisFormat, onChange: (e) => handleChange(e.target.value, 'xAxisFormat'), options: formData.pivot &&
|
|
1556
1625
|
isDateField(formData.xAxisField ?? '')
|
|
1557
1626
|
? [{ value: 'string', label: 'date' }]
|
|
1558
|
-
: xAxisFormatOptions, width: 200, hideEmptyOption: true })] })] })), CHART_TO_LABELS[formData.chartType]?.yAxisLabel && (_jsxs("div", { children: [_jsx(SubHeaderComponent, { label: CHART_TO_LABELS[formData.chartType]?.yAxisLabel ??
|
|
1627
|
+
: xAxisFormatOptions, width: 200, hideEmptyOption: true })] })] })), CHART_TO_LABELS[formData.chartType]?.yAxisLabel && (_jsxs("div", { children: [_jsx(SubHeaderComponent, { label: CHART_TO_LABELS[formData.chartType]?.yAxisLabel ??
|
|
1628
|
+
'' }), _jsxs(ChartBuilderInputColumnContainer, { children: [formData.yAxisFields.map((yAxisField, index) => (_jsxs(ChartBuilderInputRowContainer, { children: [_jsx(SelectComponent, { value: formData.pivot
|
|
1559
1629
|
? formData.pivot.aggregations?.length
|
|
1560
1630
|
? (disambiguatedValueField(formData.pivot) ?? 'count')
|
|
1561
1631
|
: 'count'
|
|
@@ -1582,31 +1652,47 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1582
1652
|
})?.value ?? NUMBER_OPTIONS[0].value)
|
|
1583
1653
|
: yAxisField.format, onChange: (e) => handleChange(e.target.value, 'yAxisFields.format', index), options: formData.pivot
|
|
1584
1654
|
? NUMBER_OPTIONS
|
|
1585
|
-
: ALL_FORMAT_OPTIONS, width: 200, hideEmptyOption: true }), !formData.pivot && (_jsx("div", { ref: deleteRef, style: { marginLeft: deleteButtonMargin }, children: _jsx(DeleteButtonComponent, { onClick: () => handleRemoveField('yAxisFields', index) }) }))] }, 'yAxisField' + index))), !formData.pivot && (_jsx("div", { children: _jsx(SecondaryButtonComponent, { onClick: () => handleAddField('yAxisFields'), label: "Add field +" }) }))] })] })), client?.featureFlags?.['referenceLines'] &&
|
|
1655
|
+
: ALL_FORMAT_OPTIONS, width: 200, hideEmptyOption: true }), !formData.pivot && (_jsx("div", { ref: deleteRef, style: { marginLeft: deleteButtonMargin }, children: _jsx(DeleteButtonComponent, { onClick: () => handleRemoveField('yAxisFields', index) }) }))] }, 'yAxisField' + index))), !formData.pivot && (_jsx("div", { children: _jsx(SecondaryButtonComponent, { onClick: () => handleAddField('yAxisFields'), label: "Add field +" }) }))] })] })), client?.featureFlags?.['referenceLines'] &&
|
|
1656
|
+
(chartData.chartType === 'line' ||
|
|
1657
|
+
chartData.chartType === 'column') && (_jsxs("div", { children: [_jsx(SubHeaderComponent, { label: 'Reference Lines' }), _jsxs(ChartBuilderInputColumnContainer, { children: [formData.referenceLines?.map((refLine, index) => (_jsxs(ChartBuilderInputRowContainer, { children: [_jsx(SelectComponent, { width: 200, value: refLine.label, onChange: (e) => handleChange(e.target.value, 'referenceLines.label', index),
|
|
1586
1658
|
// only include numeric columns
|
|
1587
|
-
options: [
|
|
1659
|
+
options: [
|
|
1660
|
+
{
|
|
1588
1661
|
label: 'Custom Values',
|
|
1589
|
-
value: REFERENCE_LINE
|
|
1590
|
-
}
|
|
1662
|
+
value: REFERENCE_LINE,
|
|
1663
|
+
},
|
|
1664
|
+
].concat((selectedPivotTable?.columns
|
|
1665
|
+
? selectedPivotTable.columns
|
|
1666
|
+
: columns)
|
|
1667
|
+
.filter((c) => NUMBER_FORMAT_TYPES.includes(c.format))
|
|
1668
|
+
.map((elem) => ({
|
|
1591
1669
|
label: elem.field,
|
|
1592
1670
|
value: elem.field,
|
|
1593
|
-
}))) }), refLine.label === REFERENCE_LINE && (_jsxs(_Fragment, { children: [_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) }), _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) })] })), _jsx("div", { ref: deleteRef, style: { marginLeft: deleteButtonMargin }, children: _jsx(DeleteButtonComponent, { onClick: () => handleRemoveField('referenceLines', index) }) })] }, 'referenceLine' + index))), _jsx("div", { children: _jsx(SecondaryButtonComponent, { onClick: () => handleAddField('referenceLines'), label: "Add line +" }) })] })] })] })), windowWidth < 1200 && (_jsx("div", { style: {
|
|
1671
|
+
}))) }), refLine.label === REFERENCE_LINE && (_jsxs(_Fragment, { children: [_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) }), _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) })] })), _jsx("div", { ref: deleteRef, style: { marginLeft: deleteButtonMargin }, children: _jsx(DeleteButtonComponent, { onClick: () => handleRemoveField('referenceLines', index) }) })] }, 'referenceLine' + index))), _jsx("div", { children: _jsx(SecondaryButtonComponent, { onClick: () => handleAddField('referenceLines'), label: "Add line +" }) })] })] }))] })), windowWidth < 1200 && (_jsx("div", { style: {
|
|
1594
1672
|
width: '100%',
|
|
1595
1673
|
height: isHorizontalView || !isOpen ? 'calc(50% - 10px)' : 400,
|
|
1596
1674
|
flexGrow: 1,
|
|
1597
|
-
}, children: formData.chartType !== 'table' ? (_jsx(TableComponent, { rows: formattedRows, columns:
|
|
1675
|
+
}, children: formData.chartType !== 'table' ? (_jsx(TableComponent, { rows: formattedRows, columns: includeCustomFields && !containsCustomFields
|
|
1676
|
+
? formData.columns.concat(reportCustomFields)
|
|
1677
|
+
: formData.columns, onPageChange: (page) => {
|
|
1598
1678
|
onPageChange(page);
|
|
1599
1679
|
setCurrentPage(page);
|
|
1600
1680
|
}, onSortChange: (sort) => {
|
|
1601
1681
|
onSortChange && onSortChange(sort);
|
|
1602
|
-
}, currentPage: currentPage, rowCount: rowCount, rowCountIsLoading: rowCountIsLoading, isLoading: isLoading, disableSort: disableSort })) : (_jsx(TableComponent, { rows: formattedRows, columns: selectedPivotTable
|
|
1682
|
+
}, currentPage: currentPage, rowCount: rowCount, rowCountIsLoading: rowCountIsLoading, isLoading: isLoading, disableSort: disableSort, hideLabels: false })) : (_jsx(TableComponent, { rows: formattedRows, columns: selectedPivotTable
|
|
1603
1683
|
? selectedPivotTable.columns
|
|
1604
|
-
:
|
|
1684
|
+
: includeCustomFields && !containsCustomFields
|
|
1685
|
+
? formData.columns.concat(reportCustomFields)
|
|
1686
|
+
: formData.columns, onPageChange: (page) => {
|
|
1605
1687
|
onPageChange(page, true);
|
|
1606
1688
|
setCurrentPage(page);
|
|
1607
1689
|
}, onSortChange: (sort) => {
|
|
1608
1690
|
onSortChange && onSortChange(sort, true);
|
|
1609
|
-
}, currentPage: currentPage, rowCount: selectedPivotTable ? pivotData?.rowCount : rowCount, rowCountIsLoading: rowCountIsLoading, isLoading: isLoading, disableSort: disableSort })) })), (showTableFormatOptions || isAdmin) && (_jsxs("div", {
|
|
1691
|
+
}, currentPage: currentPage, rowCount: selectedPivotTable ? pivotData?.rowCount : rowCount, rowCountIsLoading: rowCountIsLoading, isLoading: isLoading, disableSort: disableSort, hideLabels: false })) })), (showTableFormatOptions || isAdmin) && (_jsxs("div", { style: {
|
|
1692
|
+
display: 'flex',
|
|
1693
|
+
flexDirection: 'column',
|
|
1694
|
+
gap: 6,
|
|
1695
|
+
}, children: [_jsxs("div", { style: {
|
|
1610
1696
|
display: 'flex',
|
|
1611
1697
|
flexDirection: 'column',
|
|
1612
1698
|
}, children: [_jsx(HeaderComponent, { label: "Table" }), _jsx(SubHeaderComponent, { label: "Columns" })] }), _jsxs(ChartBuilderInputColumnContainer, { children: [formData.pivot &&
|
|
@@ -1651,7 +1737,14 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1651
1737
|
flexDirection: 'row',
|
|
1652
1738
|
gap: 10,
|
|
1653
1739
|
}, children: [_jsx(SecondaryButtonComponent, { onClick: () => handleAddField('columns'), label: "Add column +" }), isAdmin &&
|
|
1654
|
-
client?.featureFlags?.customFieldsEnabled && (_jsx(
|
|
1740
|
+
client?.featureFlags?.customFieldsEnabled && (_jsx(QuillToolTip, { text: "Custom field directly referenced in report", enabled: containsCustomFields, textStyle: {
|
|
1741
|
+
maxWidth: '200px',
|
|
1742
|
+
whiteSpace: 'normal',
|
|
1743
|
+
}, children: _jsx(CheckboxComponent, { isChecked: containsCustomFields || includeCustomFields, label: "Include Custom Fields", onChange: () => setIncludeCustomFields((prev) => !prev), disabled: containsCustomFields, containerStyle: {
|
|
1744
|
+
height: containsCustomFields
|
|
1745
|
+
? '100%' // required when wrapped with QuillToolTip
|
|
1746
|
+
: undefined,
|
|
1747
|
+
} }) }))] })) })] })] })), isAdmin && tenants && dashboardOwner && (_jsxs("div", { style: {
|
|
1655
1748
|
display: 'flex',
|
|
1656
1749
|
flexDirection: 'column',
|
|
1657
1750
|
gap: 12,
|
|
@@ -1760,7 +1853,7 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1760
1853
|
gap: 6,
|
|
1761
1854
|
}, children: [_jsx(HeaderComponent, { label: "Dashboard filter fields" }), isAdmin &&
|
|
1762
1855
|
formData.dateField &&
|
|
1763
|
-
dashboardConfig[formData.dashboardName ??
|
|
1856
|
+
dashboardConfig[formData.dashboardName ?? destinationDashboardName ?? '']?.config.dateFilter?.label && (_jsxs(ChartBuilderInputRowContainer, { children: [_jsx(TextInputComponent, { id: 'filterMap.dateFilter.' +
|
|
1764
1857
|
(dashboardConfig[formData.dashboardName ?? '']
|
|
1765
1858
|
?.config.dateFilter?.label ?? 'Date'), value: dashboardConfig[formData.dashboardName ?? '']
|
|
1766
1859
|
?.config.dateFilter?.label ?? 'Date', width: 200, onChange: () => { }, label: 'Filter', disabled: true }), _jsx("div", { style: { display: 'flex', flexDirection: 'column' }, children: _jsx(SelectComponent, { label: "Virtual Table", value: formData.dateField?.table, onChange: (e) => handleChange(e.target.value, 'dateField.table'), options: dateFieldOptions.map((elem) => ({
|
|
@@ -1785,12 +1878,14 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1785
1878
|
.map((filter, index) => (_jsxs(ChartBuilderInputRowContainer, { children: [_jsx(TextInputComponent, { id: 'filterMap.' + filter.label, value: filter.label, width: 200, onChange: () => { }, label: index === 0 &&
|
|
1786
1879
|
!(isAdmin &&
|
|
1787
1880
|
formData.dateField &&
|
|
1788
|
-
dashboardConfig[formData.dashboardName ?? '']
|
|
1881
|
+
dashboardConfig[formData.dashboardName ?? '']
|
|
1882
|
+
?.config.dateFilter?.label)
|
|
1789
1883
|
? 'Filter'
|
|
1790
1884
|
: '', disabled: true }), _jsx(SelectComponent, { label: index === 0 &&
|
|
1791
1885
|
!(isAdmin &&
|
|
1792
1886
|
formData.dateField &&
|
|
1793
|
-
dashboardConfig[formData.dashboardName ?? '']
|
|
1887
|
+
dashboardConfig[formData.dashboardName ?? '']
|
|
1888
|
+
?.config.dateFilter?.label)
|
|
1794
1889
|
? 'Virtual Table'
|
|
1795
1890
|
: '', value: filterMap[filter.label]?.table ?? filter.table, onChange: (e) => setFilterMap({
|
|
1796
1891
|
...filterMap,
|
|
@@ -1808,7 +1903,8 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1808
1903
|
})), width: 200 }), _jsx(SelectComponent, { label: index === 0 &&
|
|
1809
1904
|
!(isAdmin &&
|
|
1810
1905
|
formData.dateField &&
|
|
1811
|
-
dashboardConfig[formData.dashboardName ?? '']
|
|
1906
|
+
dashboardConfig[formData.dashboardName ?? '']
|
|
1907
|
+
?.config.dateFilter?.label)
|
|
1812
1908
|
? 'Field'
|
|
1813
1909
|
: '', value: filterMap[filter.label]?.field ?? filter.field, onChange: (e) => setFilterMap({
|
|
1814
1910
|
...filterMap,
|
|
@@ -1847,15 +1943,15 @@ onClickChartElement, isEditingMode = false, disableSort = true, }) {
|
|
|
1847
1943
|
justifyContent: 'space-between',
|
|
1848
1944
|
alignItems: 'center',
|
|
1849
1945
|
gap: 6,
|
|
1850
|
-
}, children: [!!filterIssues?.length && (_jsx(ErrorMessageComponent, { errorMessage: filterIssues[0] || '
|
|
1946
|
+
}, children: [!!filterIssues?.length && (_jsx(ErrorMessageComponent, { errorMessage: filterIssues[0] || 'Dashboard - Report issues', containerStyle: { height: '100%' } })), _jsxs("div", { style: {
|
|
1851
1947
|
display: 'flex',
|
|
1852
1948
|
flexDirection: 'row',
|
|
1853
1949
|
gap: 10,
|
|
1854
1950
|
backgroundColor: 'white',
|
|
1855
|
-
}, children: [_jsx(SecondaryButtonComponent, { onClick: () => {
|
|
1951
|
+
}, children: [hideDiscardChanges ? null : (_jsx(SecondaryButtonComponent, { onClick: () => {
|
|
1856
1952
|
setIsOpen(false);
|
|
1857
1953
|
onDiscardChanges && onDiscardChanges();
|
|
1858
|
-
}, label: 'Discard changes' }), _jsx(ButtonComponent, { onClick: () => {
|
|
1954
|
+
}, label: 'Discard changes' })), _jsx(ButtonComponent, { onClick: () => {
|
|
1859
1955
|
if (loadingFormData) {
|
|
1860
1956
|
setTriggeredEditChart(true);
|
|
1861
1957
|
}
|