@quillsql/react 2.16.89 → 2.16.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +41 -3
- package/dist/index.js +41 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -64337,6 +64337,20 @@ function resolveTableColumnLabel(fieldRaw, labelRaw) {
|
|
|
64337
64337
|
const label = String(labelRaw ?? "").trim();
|
|
64338
64338
|
return !label || label === field ? toTitleCaseLabel(field) : label;
|
|
64339
64339
|
}
|
|
64340
|
+
function reportColumnsContainPivotOutputFields(report) {
|
|
64341
|
+
if (!report?.pivot || String(report.chartType ?? "").toLowerCase() !== "table" || !Array.isArray(report.columns) || report.columns.length === 0) {
|
|
64342
|
+
return false;
|
|
64343
|
+
}
|
|
64344
|
+
const detailFields = new Set(
|
|
64345
|
+
[
|
|
64346
|
+
...report.reportBuilderState?.columns ?? [],
|
|
64347
|
+
...report.columnInternal ?? []
|
|
64348
|
+
].flatMap((column) => [column.field, column.alias]).map((field) => String(field ?? "").trim()).filter(Boolean)
|
|
64349
|
+
);
|
|
64350
|
+
return report.columns.some(
|
|
64351
|
+
(column) => !detailFields.has(String(column.field ?? "").trim())
|
|
64352
|
+
);
|
|
64353
|
+
}
|
|
64340
64354
|
function mergeDisplayAndSourceForTableFormats(args) {
|
|
64341
64355
|
const {
|
|
64342
64356
|
effectiveReportBuilderTableNames,
|
|
@@ -64346,7 +64360,8 @@ function mergeDisplayAndSourceForTableFormats(args) {
|
|
|
64346
64360
|
includeSelectedSchemaFallback
|
|
64347
64361
|
} = args;
|
|
64348
64362
|
const selectedTableNames = new Set(effectiveReportBuilderTableNames);
|
|
64349
|
-
const
|
|
64363
|
+
const savedColumnsArePivotDisplayColumns = reportColumnsContainPivotOutputFields(sourceReport);
|
|
64364
|
+
const persistedReportColumns = !savedColumnsArePivotDisplayColumns && Array.isArray(sourceReport?.columns) && sourceReport.columns.length > 0 ? sourceReport.columns : null;
|
|
64350
64365
|
const pivotTableColumnsFromSchema = sourceReport?.pivot && !persistedReportColumns && scopedSchemaColumns.length > 0 && selectedTableNames.size > 0 ? scopedSchemaColumns.filter(
|
|
64351
64366
|
(column) => selectedTableNames.has(String(column.table ?? "").trim())
|
|
64352
64367
|
) : [];
|
|
@@ -67730,7 +67745,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67730
67745
|
table: String(column.table ?? "").trim() || resolveColumnTableFromReportMetadata(sourceReport, column.field)
|
|
67731
67746
|
}))
|
|
67732
67747
|
);
|
|
67733
|
-
const
|
|
67748
|
+
const savedColumnsArePivotDisplayColumns = reportColumnsContainPivotOutputFields(sourceReport);
|
|
67749
|
+
const sourceDisplayColumns = savedDisplayColumns.length > 0 && !savedColumnsArePivotDisplayColumns ? savedDisplayColumns : sourceDisplayColumnsFromSchema.length > 0 ? sourceDisplayColumnsFromSchema : sourceQueryColumns;
|
|
67734
67750
|
const shouldKeepLocalRowGroup = groupRowsBySetViaSetReportRef.current || groupColumnsBySetViaSetReportRef.current && prev.groupRowsBy !== void 0;
|
|
67735
67751
|
const shouldKeepLocalColumnGroup = groupColumnsBySetViaSetReportRef.current || groupRowsBySetViaSetReportRef.current && prev.groupColumnsBy !== void 0;
|
|
67736
67752
|
const nextGroupRowsBy = shouldTakePivotGroupsFromSource ? shouldKeepLocalRowGroup ? prev.groupRowsBy : sourceRowGroupOption : prev.groupRowsBy !== void 0 ? prev.groupRowsBy : groupRowsBySetViaSetReportRef.current ? prev.groupRowsBy : sourceRowGroupOption;
|
|
@@ -71158,6 +71174,28 @@ function useReport(reportIdArg, options = {}) {
|
|
|
71158
71174
|
const hasReportFlagsOverride = overrides?.reportFlags !== void 0;
|
|
71159
71175
|
const isFlatTable = String(resolvedChartType).toLowerCase() === "table" && !effectiveReportBuilderState.pivot;
|
|
71160
71176
|
const isPivotTable = String(resolvedChartType).toLowerCase() === "table" && Boolean(effectiveReportBuilderState.pivot);
|
|
71177
|
+
const fallbackDetailColumns = effectiveReportBuilderState.columns.map(
|
|
71178
|
+
(column) => {
|
|
71179
|
+
const field = String(column.alias ?? "").trim() || String(column.field ?? "").trim();
|
|
71180
|
+
const tableName = String(column.table ?? "").trim();
|
|
71181
|
+
const metadata = [
|
|
71182
|
+
...sourceReport.columnInternal ?? [],
|
|
71183
|
+
...sourceReport.columns ?? []
|
|
71184
|
+
].find((candidate) => {
|
|
71185
|
+
const candidateField = String(candidate.field ?? "").trim();
|
|
71186
|
+
const candidateTable = String(
|
|
71187
|
+
candidate.table ?? ""
|
|
71188
|
+
).trim();
|
|
71189
|
+
return (candidateField === field || candidateField === String(column.field ?? "").trim()) && (!tableName || !candidateTable || candidateTable === tableName);
|
|
71190
|
+
});
|
|
71191
|
+
return {
|
|
71192
|
+
field,
|
|
71193
|
+
label: String(metadata?.label ?? "").trim() || toTitleCaseLabel(field),
|
|
71194
|
+
format: String(metadata?.format ?? "").trim() || "string"
|
|
71195
|
+
};
|
|
71196
|
+
}
|
|
71197
|
+
);
|
|
71198
|
+
const columnsSelectedForSave = table.columns.length > 0 ? table.columns : fallbackDetailColumns;
|
|
71161
71199
|
const resp = await saveReport({
|
|
71162
71200
|
report: {
|
|
71163
71201
|
...EMPTY_INTERNAL_REPORT,
|
|
@@ -71169,7 +71207,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
71169
71207
|
dashboardName: resolvedDashboardName,
|
|
71170
71208
|
...isAdmin ? { adminMode: true } : {},
|
|
71171
71209
|
...hasSectionOverride ? { section: overrides.section } : {},
|
|
71172
|
-
columns:
|
|
71210
|
+
columns: columnsSelectedForSave,
|
|
71173
71211
|
...isFlatTable ? {
|
|
71174
71212
|
sort: effectiveReportBuilderState.sort?.[0] ?? null
|
|
71175
71213
|
} : {},
|
package/dist/index.js
CHANGED
|
@@ -64545,6 +64545,20 @@ function resolveTableColumnLabel(fieldRaw, labelRaw) {
|
|
|
64545
64545
|
const label = String(labelRaw ?? "").trim();
|
|
64546
64546
|
return !label || label === field ? toTitleCaseLabel(field) : label;
|
|
64547
64547
|
}
|
|
64548
|
+
function reportColumnsContainPivotOutputFields(report) {
|
|
64549
|
+
if (!report?.pivot || String(report.chartType ?? "").toLowerCase() !== "table" || !Array.isArray(report.columns) || report.columns.length === 0) {
|
|
64550
|
+
return false;
|
|
64551
|
+
}
|
|
64552
|
+
const detailFields = new Set(
|
|
64553
|
+
[
|
|
64554
|
+
...report.reportBuilderState?.columns ?? [],
|
|
64555
|
+
...report.columnInternal ?? []
|
|
64556
|
+
].flatMap((column) => [column.field, column.alias]).map((field) => String(field ?? "").trim()).filter(Boolean)
|
|
64557
|
+
);
|
|
64558
|
+
return report.columns.some(
|
|
64559
|
+
(column) => !detailFields.has(String(column.field ?? "").trim())
|
|
64560
|
+
);
|
|
64561
|
+
}
|
|
64548
64562
|
function mergeDisplayAndSourceForTableFormats(args) {
|
|
64549
64563
|
const {
|
|
64550
64564
|
effectiveReportBuilderTableNames,
|
|
@@ -64554,7 +64568,8 @@ function mergeDisplayAndSourceForTableFormats(args) {
|
|
|
64554
64568
|
includeSelectedSchemaFallback
|
|
64555
64569
|
} = args;
|
|
64556
64570
|
const selectedTableNames = new Set(effectiveReportBuilderTableNames);
|
|
64557
|
-
const
|
|
64571
|
+
const savedColumnsArePivotDisplayColumns = reportColumnsContainPivotOutputFields(sourceReport);
|
|
64572
|
+
const persistedReportColumns = !savedColumnsArePivotDisplayColumns && Array.isArray(sourceReport?.columns) && sourceReport.columns.length > 0 ? sourceReport.columns : null;
|
|
64558
64573
|
const pivotTableColumnsFromSchema = sourceReport?.pivot && !persistedReportColumns && scopedSchemaColumns.length > 0 && selectedTableNames.size > 0 ? scopedSchemaColumns.filter(
|
|
64559
64574
|
(column) => selectedTableNames.has(String(column.table ?? "").trim())
|
|
64560
64575
|
) : [];
|
|
@@ -67938,7 +67953,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67938
67953
|
table: String(column.table ?? "").trim() || resolveColumnTableFromReportMetadata(sourceReport, column.field)
|
|
67939
67954
|
}))
|
|
67940
67955
|
);
|
|
67941
|
-
const
|
|
67956
|
+
const savedColumnsArePivotDisplayColumns = reportColumnsContainPivotOutputFields(sourceReport);
|
|
67957
|
+
const sourceDisplayColumns = savedDisplayColumns.length > 0 && !savedColumnsArePivotDisplayColumns ? savedDisplayColumns : sourceDisplayColumnsFromSchema.length > 0 ? sourceDisplayColumnsFromSchema : sourceQueryColumns;
|
|
67942
67958
|
const shouldKeepLocalRowGroup = groupRowsBySetViaSetReportRef.current || groupColumnsBySetViaSetReportRef.current && prev.groupRowsBy !== void 0;
|
|
67943
67959
|
const shouldKeepLocalColumnGroup = groupColumnsBySetViaSetReportRef.current || groupRowsBySetViaSetReportRef.current && prev.groupColumnsBy !== void 0;
|
|
67944
67960
|
const nextGroupRowsBy = shouldTakePivotGroupsFromSource ? shouldKeepLocalRowGroup ? prev.groupRowsBy : sourceRowGroupOption : prev.groupRowsBy !== void 0 ? prev.groupRowsBy : groupRowsBySetViaSetReportRef.current ? prev.groupRowsBy : sourceRowGroupOption;
|
|
@@ -71366,6 +71382,28 @@ function useReport(reportIdArg, options = {}) {
|
|
|
71366
71382
|
const hasReportFlagsOverride = overrides?.reportFlags !== void 0;
|
|
71367
71383
|
const isFlatTable = String(resolvedChartType).toLowerCase() === "table" && !effectiveReportBuilderState.pivot;
|
|
71368
71384
|
const isPivotTable = String(resolvedChartType).toLowerCase() === "table" && Boolean(effectiveReportBuilderState.pivot);
|
|
71385
|
+
const fallbackDetailColumns = effectiveReportBuilderState.columns.map(
|
|
71386
|
+
(column) => {
|
|
71387
|
+
const field = String(column.alias ?? "").trim() || String(column.field ?? "").trim();
|
|
71388
|
+
const tableName = String(column.table ?? "").trim();
|
|
71389
|
+
const metadata = [
|
|
71390
|
+
...sourceReport.columnInternal ?? [],
|
|
71391
|
+
...sourceReport.columns ?? []
|
|
71392
|
+
].find((candidate) => {
|
|
71393
|
+
const candidateField = String(candidate.field ?? "").trim();
|
|
71394
|
+
const candidateTable = String(
|
|
71395
|
+
candidate.table ?? ""
|
|
71396
|
+
).trim();
|
|
71397
|
+
return (candidateField === field || candidateField === String(column.field ?? "").trim()) && (!tableName || !candidateTable || candidateTable === tableName);
|
|
71398
|
+
});
|
|
71399
|
+
return {
|
|
71400
|
+
field,
|
|
71401
|
+
label: String(metadata?.label ?? "").trim() || toTitleCaseLabel(field),
|
|
71402
|
+
format: String(metadata?.format ?? "").trim() || "string"
|
|
71403
|
+
};
|
|
71404
|
+
}
|
|
71405
|
+
);
|
|
71406
|
+
const columnsSelectedForSave = table.columns.length > 0 ? table.columns : fallbackDetailColumns;
|
|
71369
71407
|
const resp = await saveReport({
|
|
71370
71408
|
report: {
|
|
71371
71409
|
...EMPTY_INTERNAL_REPORT,
|
|
@@ -71377,7 +71415,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
71377
71415
|
dashboardName: resolvedDashboardName,
|
|
71378
71416
|
...isAdmin ? { adminMode: true } : {},
|
|
71379
71417
|
...hasSectionOverride ? { section: overrides.section } : {},
|
|
71380
|
-
columns:
|
|
71418
|
+
columns: columnsSelectedForSave,
|
|
71381
71419
|
...isFlatTable ? {
|
|
71382
71420
|
sort: effectiveReportBuilderState.sort?.[0] ?? null
|
|
71383
71421
|
} : {},
|