@quillsql/react 2.16.73 → 2.16.75
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 +44 -22
- package/dist/index.js +44 -22
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -63671,6 +63671,31 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63671
63671
|
() => getSchemaForeignKeyMapping(schemaForReportBuilderState),
|
|
63672
63672
|
[schemaForReportBuilderState]
|
|
63673
63673
|
);
|
|
63674
|
+
const datasourceJoinOptionsByTable = (0, import_react61.useMemo)(() => {
|
|
63675
|
+
const tableNames = new Set(
|
|
63676
|
+
schemaForReportBuilderState.map((table2) => String(table2.name ?? "").trim()).filter(Boolean)
|
|
63677
|
+
);
|
|
63678
|
+
const compatibleByTable = new Map(
|
|
63679
|
+
Array.from(tableNames, (tableName) => [tableName, /* @__PURE__ */ new Set()])
|
|
63680
|
+
);
|
|
63681
|
+
for (const [tableName, mappings] of Object.entries(schemaForeignKeyMap)) {
|
|
63682
|
+
if (!tableNames.has(tableName)) continue;
|
|
63683
|
+
for (const mapping of mappings) {
|
|
63684
|
+
const foreignTableName = String(mapping.foreignTable ?? "").trim();
|
|
63685
|
+
if (!foreignTableName || foreignTableName === tableName || !tableNames.has(foreignTableName)) {
|
|
63686
|
+
continue;
|
|
63687
|
+
}
|
|
63688
|
+
compatibleByTable.get(tableName)?.add(foreignTableName);
|
|
63689
|
+
compatibleByTable.get(foreignTableName)?.add(tableName);
|
|
63690
|
+
}
|
|
63691
|
+
}
|
|
63692
|
+
return new Map(
|
|
63693
|
+
Array.from(compatibleByTable, ([tableName, compatibleTables]) => [
|
|
63694
|
+
tableName,
|
|
63695
|
+
Array.from(compatibleTables)
|
|
63696
|
+
])
|
|
63697
|
+
);
|
|
63698
|
+
}, [schemaForReportBuilderState, schemaForeignKeyMap]);
|
|
63674
63699
|
const reportBuilderBaseTableNamesKey = (sourceReport?.reportBuilderState?.tables ?? []).map((t) => String(t?.name ?? "").trim()).filter(Boolean).join("\0") ?? "";
|
|
63675
63700
|
const selectedBaseTableNamesForFieldOptions = (0, import_react61.useMemo)(() => {
|
|
63676
63701
|
const fromPicker = schemaDatasourceIds?.map((id) => String(id ?? "").trim()).filter(Boolean) ?? [];
|
|
@@ -63757,9 +63782,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63757
63782
|
queryColumnsBootstrapKey
|
|
63758
63783
|
]);
|
|
63759
63784
|
const datasourceOptions = (0, import_react61.useMemo)(() => {
|
|
63760
|
-
const tableNames = new Set(
|
|
63761
|
-
schemaForReportBuilderState.map((table2) => String(table2.name ?? "").trim()).filter(Boolean)
|
|
63762
|
-
);
|
|
63763
63785
|
const seen = /* @__PURE__ */ new Set();
|
|
63764
63786
|
const result = [];
|
|
63765
63787
|
for (const table2 of schemaForReportBuilderState) {
|
|
@@ -63769,16 +63791,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63769
63791
|
result.push({
|
|
63770
63792
|
value: name2,
|
|
63771
63793
|
label: toTitleCaseLabel(name2),
|
|
63772
|
-
joinOptions:
|
|
63773
|
-
[name2],
|
|
63774
|
-
schemaForeignKeyMap
|
|
63775
|
-
).filter(
|
|
63776
|
-
(candidate) => candidate !== name2 && tableNames.has(candidate)
|
|
63777
|
-
)
|
|
63794
|
+
joinOptions: datasourceJoinOptionsByTable.get(name2) ?? []
|
|
63778
63795
|
});
|
|
63779
63796
|
}
|
|
63780
63797
|
return result;
|
|
63781
|
-
}, [schemaForReportBuilderState,
|
|
63798
|
+
}, [schemaForReportBuilderState, datasourceJoinOptionsByTable]);
|
|
63782
63799
|
const queryBuilderFieldConfigByName = (0, import_react61.useMemo)(() => {
|
|
63783
63800
|
const configByName = buildQueryBuilderFieldConfigByName(
|
|
63784
63801
|
schemaForReportBuilderState
|
|
@@ -66276,14 +66293,16 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66276
66293
|
pivotRefreshQueryEnabled,
|
|
66277
66294
|
effectiveReportId
|
|
66278
66295
|
]);
|
|
66296
|
+
const settledPivotForChart = sourceReport?.pivot ?? null;
|
|
66297
|
+
const settledSourceRowFieldForChart = String(
|
|
66298
|
+
sourceReport?.pivotResultSourceRowField ?? settledPivotForChart?.rowField ?? ""
|
|
66299
|
+
).trim();
|
|
66300
|
+
const pendingPivotChangesDimensions = Boolean(
|
|
66301
|
+
sourceReport && pendingPivotRefresh && nextPivot && (settledSourceRowFieldForChart !== String(nextPivot.rowField ?? "").trim() || String(settledPivotForChart?.rowFieldTable ?? "").trim() !== String(nextPivot.rowFieldTable ?? "").trim() || String(settledPivotForChart?.columnField ?? "").trim() !== String(nextPivot.columnField ?? "").trim() || String(settledPivotForChart?.columnFieldTable ?? "").trim() !== String(nextPivot.columnFieldTable ?? "").trim())
|
|
66302
|
+
);
|
|
66279
66303
|
const chartData = (0, import_react61.useMemo)(() => {
|
|
66280
66304
|
if (!sourceReport) return void 0;
|
|
66281
66305
|
const rowsForChart = Array.isArray(sourceReport.rows) ? sourceReport.rows : [];
|
|
66282
|
-
const settledPivot = sourceReport.pivot ?? null;
|
|
66283
|
-
const settledSourceRowField = String(
|
|
66284
|
-
sourceReport.pivotResultSourceRowField ?? settledPivot?.rowField ?? ""
|
|
66285
|
-
).trim();
|
|
66286
|
-
const pendingPivotChangesDimensions = pendingPivotRefresh && Boolean(nextPivot) && (settledSourceRowField !== String(nextPivot?.rowField ?? "").trim() || String(settledPivot?.rowFieldTable ?? "").trim() !== String(nextPivot?.rowFieldTable ?? "").trim() || String(settledPivot?.columnField ?? "").trim() !== String(nextPivot?.columnField ?? "").trim() || String(settledPivot?.columnFieldTable ?? "").trim() !== String(nextPivot?.columnFieldTable ?? "").trim());
|
|
66287
66306
|
const chartPivot = pendingPivotChangesDimensions ? sourceReport.pivot ?? null : nextPivot ?? (!chartPivotHydratedFromSourceRef.current ? sourceReport.pivot ?? null : null);
|
|
66288
66307
|
const chartPivotForDisplay = chartPivot && sourceReport.pivotResultRowField && sourceReport.pivotResultSourceRowField === chartPivot.rowField ? {
|
|
66289
66308
|
...chartPivot,
|
|
@@ -66310,7 +66329,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66310
66329
|
sourceReport,
|
|
66311
66330
|
chartType,
|
|
66312
66331
|
nextPivot,
|
|
66313
|
-
|
|
66332
|
+
pendingPivotChangesDimensions,
|
|
66314
66333
|
effectiveReportBuilderState,
|
|
66315
66334
|
useInMemoryEngines,
|
|
66316
66335
|
chartPivotHydrationEpoch
|
|
@@ -67209,6 +67228,12 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67209
67228
|
const tableColumnSettingsById = (0, import_react61.useMemo)(() => {
|
|
67210
67229
|
const map = /* @__PURE__ */ new Map();
|
|
67211
67230
|
const effectiveById = tableFormatMerge.formatByColumnOptionId;
|
|
67231
|
+
const mergedColumnByField = /* @__PURE__ */ new Map();
|
|
67232
|
+
for (const column of tableFormatMerge.columns) {
|
|
67233
|
+
if (!mergedColumnByField.has(column.field)) {
|
|
67234
|
+
mergedColumnByField.set(column.field, column);
|
|
67235
|
+
}
|
|
67236
|
+
}
|
|
67212
67237
|
const chartColById = /* @__PURE__ */ new Map();
|
|
67213
67238
|
if (isPivotTableChart && chart?.columns?.length) {
|
|
67214
67239
|
for (const c of chart.columns) {
|
|
@@ -67289,9 +67314,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67289
67314
|
optionField
|
|
67290
67315
|
);
|
|
67291
67316
|
const effectiveFromId = effectiveById.get(columnId) ?? (encodedForMerge !== columnId ? effectiveById.get(encodedForMerge) : void 0) ?? "";
|
|
67292
|
-
const
|
|
67293
|
-
|
|
67294
|
-
).trim();
|
|
67317
|
+
const mergedByField = mergedColumnByField.get(optionField);
|
|
67318
|
+
const mergeByFieldFormat = String(mergedByField?.format ?? "").trim();
|
|
67295
67319
|
const columnPivotMeasureFormat = columnPivotMeasureFormatByAggregationField.get(optionField) ?? columnPivotMeasureFormatByAggregationField.get(columnId);
|
|
67296
67320
|
const chartFallback = isPivotTableChart ? chartColById.get(columnId) ?? chartColById.get(encodedForMerge) ?? yAxisByField.get(optionField) ?? (columnPivotMeasureFormat ? {
|
|
67297
67321
|
label: "",
|
|
@@ -67306,9 +67330,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67306
67330
|
isRowPivotCol ? rowAxisLabel : chartFallback?.label ?? ""
|
|
67307
67331
|
).trim();
|
|
67308
67332
|
const persistedTableLabel = String(
|
|
67309
|
-
tableFormatMerge.labelByColumnOptionId.get(columnId) ??
|
|
67310
|
-
(column) => column.field === optionField
|
|
67311
|
-
)?.label ?? ""
|
|
67333
|
+
tableFormatMerge.labelByColumnOptionId.get(columnId) ?? mergedByField?.label ?? ""
|
|
67312
67334
|
).trim();
|
|
67313
67335
|
const resolvedColFormat = isRowPivotCol ? String(resolvedXAxisFormat ?? "").trim() || effectiveFromId || mergeByFieldFormat || fromDisplay || String(chartFallback?.format ?? "").trim() || "string" : fromDisplay || effectiveFromId || mergeByFieldFormat;
|
|
67314
67336
|
map.set(columnId, {
|
package/dist/index.js
CHANGED
|
@@ -63883,6 +63883,31 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63883
63883
|
() => getSchemaForeignKeyMapping(schemaForReportBuilderState),
|
|
63884
63884
|
[schemaForReportBuilderState]
|
|
63885
63885
|
);
|
|
63886
|
+
const datasourceJoinOptionsByTable = useMemo33(() => {
|
|
63887
|
+
const tableNames = new Set(
|
|
63888
|
+
schemaForReportBuilderState.map((table2) => String(table2.name ?? "").trim()).filter(Boolean)
|
|
63889
|
+
);
|
|
63890
|
+
const compatibleByTable = new Map(
|
|
63891
|
+
Array.from(tableNames, (tableName) => [tableName, /* @__PURE__ */ new Set()])
|
|
63892
|
+
);
|
|
63893
|
+
for (const [tableName, mappings] of Object.entries(schemaForeignKeyMap)) {
|
|
63894
|
+
if (!tableNames.has(tableName)) continue;
|
|
63895
|
+
for (const mapping of mappings) {
|
|
63896
|
+
const foreignTableName = String(mapping.foreignTable ?? "").trim();
|
|
63897
|
+
if (!foreignTableName || foreignTableName === tableName || !tableNames.has(foreignTableName)) {
|
|
63898
|
+
continue;
|
|
63899
|
+
}
|
|
63900
|
+
compatibleByTable.get(tableName)?.add(foreignTableName);
|
|
63901
|
+
compatibleByTable.get(foreignTableName)?.add(tableName);
|
|
63902
|
+
}
|
|
63903
|
+
}
|
|
63904
|
+
return new Map(
|
|
63905
|
+
Array.from(compatibleByTable, ([tableName, compatibleTables]) => [
|
|
63906
|
+
tableName,
|
|
63907
|
+
Array.from(compatibleTables)
|
|
63908
|
+
])
|
|
63909
|
+
);
|
|
63910
|
+
}, [schemaForReportBuilderState, schemaForeignKeyMap]);
|
|
63886
63911
|
const reportBuilderBaseTableNamesKey = (sourceReport?.reportBuilderState?.tables ?? []).map((t) => String(t?.name ?? "").trim()).filter(Boolean).join("\0") ?? "";
|
|
63887
63912
|
const selectedBaseTableNamesForFieldOptions = useMemo33(() => {
|
|
63888
63913
|
const fromPicker = schemaDatasourceIds?.map((id) => String(id ?? "").trim()).filter(Boolean) ?? [];
|
|
@@ -63969,9 +63994,6 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63969
63994
|
queryColumnsBootstrapKey
|
|
63970
63995
|
]);
|
|
63971
63996
|
const datasourceOptions = useMemo33(() => {
|
|
63972
|
-
const tableNames = new Set(
|
|
63973
|
-
schemaForReportBuilderState.map((table2) => String(table2.name ?? "").trim()).filter(Boolean)
|
|
63974
|
-
);
|
|
63975
63997
|
const seen = /* @__PURE__ */ new Set();
|
|
63976
63998
|
const result = [];
|
|
63977
63999
|
for (const table2 of schemaForReportBuilderState) {
|
|
@@ -63981,16 +64003,11 @@ function useReport(reportIdArg, options = {}) {
|
|
|
63981
64003
|
result.push({
|
|
63982
64004
|
value: name2,
|
|
63983
64005
|
label: toTitleCaseLabel(name2),
|
|
63984
|
-
joinOptions:
|
|
63985
|
-
[name2],
|
|
63986
|
-
schemaForeignKeyMap
|
|
63987
|
-
).filter(
|
|
63988
|
-
(candidate) => candidate !== name2 && tableNames.has(candidate)
|
|
63989
|
-
)
|
|
64006
|
+
joinOptions: datasourceJoinOptionsByTable.get(name2) ?? []
|
|
63990
64007
|
});
|
|
63991
64008
|
}
|
|
63992
64009
|
return result;
|
|
63993
|
-
}, [schemaForReportBuilderState,
|
|
64010
|
+
}, [schemaForReportBuilderState, datasourceJoinOptionsByTable]);
|
|
63994
64011
|
const queryBuilderFieldConfigByName = useMemo33(() => {
|
|
63995
64012
|
const configByName = buildQueryBuilderFieldConfigByName(
|
|
63996
64013
|
schemaForReportBuilderState
|
|
@@ -66488,14 +66505,16 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66488
66505
|
pivotRefreshQueryEnabled,
|
|
66489
66506
|
effectiveReportId
|
|
66490
66507
|
]);
|
|
66508
|
+
const settledPivotForChart = sourceReport?.pivot ?? null;
|
|
66509
|
+
const settledSourceRowFieldForChart = String(
|
|
66510
|
+
sourceReport?.pivotResultSourceRowField ?? settledPivotForChart?.rowField ?? ""
|
|
66511
|
+
).trim();
|
|
66512
|
+
const pendingPivotChangesDimensions = Boolean(
|
|
66513
|
+
sourceReport && pendingPivotRefresh && nextPivot && (settledSourceRowFieldForChart !== String(nextPivot.rowField ?? "").trim() || String(settledPivotForChart?.rowFieldTable ?? "").trim() !== String(nextPivot.rowFieldTable ?? "").trim() || String(settledPivotForChart?.columnField ?? "").trim() !== String(nextPivot.columnField ?? "").trim() || String(settledPivotForChart?.columnFieldTable ?? "").trim() !== String(nextPivot.columnFieldTable ?? "").trim())
|
|
66514
|
+
);
|
|
66491
66515
|
const chartData = useMemo33(() => {
|
|
66492
66516
|
if (!sourceReport) return void 0;
|
|
66493
66517
|
const rowsForChart = Array.isArray(sourceReport.rows) ? sourceReport.rows : [];
|
|
66494
|
-
const settledPivot = sourceReport.pivot ?? null;
|
|
66495
|
-
const settledSourceRowField = String(
|
|
66496
|
-
sourceReport.pivotResultSourceRowField ?? settledPivot?.rowField ?? ""
|
|
66497
|
-
).trim();
|
|
66498
|
-
const pendingPivotChangesDimensions = pendingPivotRefresh && Boolean(nextPivot) && (settledSourceRowField !== String(nextPivot?.rowField ?? "").trim() || String(settledPivot?.rowFieldTable ?? "").trim() !== String(nextPivot?.rowFieldTable ?? "").trim() || String(settledPivot?.columnField ?? "").trim() !== String(nextPivot?.columnField ?? "").trim() || String(settledPivot?.columnFieldTable ?? "").trim() !== String(nextPivot?.columnFieldTable ?? "").trim());
|
|
66499
66518
|
const chartPivot = pendingPivotChangesDimensions ? sourceReport.pivot ?? null : nextPivot ?? (!chartPivotHydratedFromSourceRef.current ? sourceReport.pivot ?? null : null);
|
|
66500
66519
|
const chartPivotForDisplay = chartPivot && sourceReport.pivotResultRowField && sourceReport.pivotResultSourceRowField === chartPivot.rowField ? {
|
|
66501
66520
|
...chartPivot,
|
|
@@ -66522,7 +66541,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
66522
66541
|
sourceReport,
|
|
66523
66542
|
chartType,
|
|
66524
66543
|
nextPivot,
|
|
66525
|
-
|
|
66544
|
+
pendingPivotChangesDimensions,
|
|
66526
66545
|
effectiveReportBuilderState,
|
|
66527
66546
|
useInMemoryEngines,
|
|
66528
66547
|
chartPivotHydrationEpoch
|
|
@@ -67421,6 +67440,12 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67421
67440
|
const tableColumnSettingsById = useMemo33(() => {
|
|
67422
67441
|
const map = /* @__PURE__ */ new Map();
|
|
67423
67442
|
const effectiveById = tableFormatMerge.formatByColumnOptionId;
|
|
67443
|
+
const mergedColumnByField = /* @__PURE__ */ new Map();
|
|
67444
|
+
for (const column of tableFormatMerge.columns) {
|
|
67445
|
+
if (!mergedColumnByField.has(column.field)) {
|
|
67446
|
+
mergedColumnByField.set(column.field, column);
|
|
67447
|
+
}
|
|
67448
|
+
}
|
|
67424
67449
|
const chartColById = /* @__PURE__ */ new Map();
|
|
67425
67450
|
if (isPivotTableChart && chart?.columns?.length) {
|
|
67426
67451
|
for (const c of chart.columns) {
|
|
@@ -67501,9 +67526,8 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67501
67526
|
optionField
|
|
67502
67527
|
);
|
|
67503
67528
|
const effectiveFromId = effectiveById.get(columnId) ?? (encodedForMerge !== columnId ? effectiveById.get(encodedForMerge) : void 0) ?? "";
|
|
67504
|
-
const
|
|
67505
|
-
|
|
67506
|
-
).trim();
|
|
67529
|
+
const mergedByField = mergedColumnByField.get(optionField);
|
|
67530
|
+
const mergeByFieldFormat = String(mergedByField?.format ?? "").trim();
|
|
67507
67531
|
const columnPivotMeasureFormat = columnPivotMeasureFormatByAggregationField.get(optionField) ?? columnPivotMeasureFormatByAggregationField.get(columnId);
|
|
67508
67532
|
const chartFallback = isPivotTableChart ? chartColById.get(columnId) ?? chartColById.get(encodedForMerge) ?? yAxisByField.get(optionField) ?? (columnPivotMeasureFormat ? {
|
|
67509
67533
|
label: "",
|
|
@@ -67518,9 +67542,7 @@ function useReport(reportIdArg, options = {}) {
|
|
|
67518
67542
|
isRowPivotCol ? rowAxisLabel : chartFallback?.label ?? ""
|
|
67519
67543
|
).trim();
|
|
67520
67544
|
const persistedTableLabel = String(
|
|
67521
|
-
tableFormatMerge.labelByColumnOptionId.get(columnId) ??
|
|
67522
|
-
(column) => column.field === optionField
|
|
67523
|
-
)?.label ?? ""
|
|
67545
|
+
tableFormatMerge.labelByColumnOptionId.get(columnId) ?? mergedByField?.label ?? ""
|
|
67524
67546
|
).trim();
|
|
67525
67547
|
const resolvedColFormat = isRowPivotCol ? String(resolvedXAxisFormat ?? "").trim() || effectiveFromId || mergeByFieldFormat || fromDisplay || String(chartFallback?.format ?? "").trim() || "string" : fromDisplay || effectiveFromId || mergeByFieldFormat;
|
|
67526
67548
|
map.set(columnId, {
|