@smallwebco/tinypivot-react 1.0.83 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/dist/index.cjs +874 -497
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -5
- package/dist/index.d.ts +21 -5
- package/dist/index.js +866 -489
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1314,7 +1314,8 @@ function CalculatedFieldModal({
|
|
|
1314
1314
|
availableFields,
|
|
1315
1315
|
existingField,
|
|
1316
1316
|
onClose,
|
|
1317
|
-
onSave
|
|
1317
|
+
onSave,
|
|
1318
|
+
theme
|
|
1318
1319
|
}) {
|
|
1319
1320
|
const [name, setName] = useState3("");
|
|
1320
1321
|
const [formula, setFormula] = useState3("");
|
|
@@ -1385,7 +1386,7 @@ function CalculatedFieldModal({
|
|
|
1385
1386
|
}, [onClose]);
|
|
1386
1387
|
if (!show)
|
|
1387
1388
|
return null;
|
|
1388
|
-
const modalContent = /* @__PURE__ */ jsx2("div", { className:
|
|
1389
|
+
const modalContent = /* @__PURE__ */ jsx2("div", { className: `vpg-modal-overlay vpg-theme-${theme ?? "light"}`, onClick: handleOverlayClick, children: /* @__PURE__ */ jsxs2("div", { className: "vpg-modal", children: [
|
|
1389
1390
|
/* @__PURE__ */ jsxs2("div", { className: "vpg-modal-header", children: [
|
|
1390
1391
|
/* @__PURE__ */ jsxs2("h3", { children: [
|
|
1391
1392
|
existingField ? "Edit" : "Create",
|
|
@@ -2962,9 +2963,9 @@ function ColumnFilter({
|
|
|
2962
2963
|
}
|
|
2963
2964
|
|
|
2964
2965
|
// src/components/DataGrid.tsx
|
|
2965
|
-
import { formatDate as coreFormatDate, formatNumber as coreFormatNumber } from "@smallwebco/tinypivot-core";
|
|
2966
|
-
import { useCallback as
|
|
2967
|
-
import { createPortal as
|
|
2966
|
+
import { canUseDrillThrough, formatDate as coreFormatDate, formatNumber as coreFormatNumber, getDrillThroughRows } from "@smallwebco/tinypivot-core";
|
|
2967
|
+
import { useCallback as useCallback15, useEffect as useEffect12, useMemo as useMemo15, useRef as useRef4, useState as useState15 } from "react";
|
|
2968
|
+
import { createPortal as createPortal3 } from "react-dom";
|
|
2968
2969
|
|
|
2969
2970
|
// src/hooks/useExcelGrid.ts
|
|
2970
2971
|
import { formatCellValue, getColumnUniqueValues, isDateRange, isNumericRange } from "@smallwebco/tinypivot-core";
|
|
@@ -3628,7 +3629,7 @@ import {
|
|
|
3628
3629
|
savePivotConfig
|
|
3629
3630
|
} from "@smallwebco/tinypivot-core";
|
|
3630
3631
|
import { useCallback as useCallback11, useEffect as useEffect9, useMemo as useMemo11, useState as useState11 } from "react";
|
|
3631
|
-
function usePivotTable(data) {
|
|
3632
|
+
function usePivotTable(data, enableDrillDown = true) {
|
|
3632
3633
|
const { canUsePivot, requirePro } = useLicense();
|
|
3633
3634
|
const [rowFields, setRowFieldsState] = useState11([]);
|
|
3634
3635
|
const [columnFields, setColumnFieldsState] = useState11([]);
|
|
@@ -3637,6 +3638,7 @@ function usePivotTable(data) {
|
|
|
3637
3638
|
const [showColumnTotals, setShowColumnTotals] = useState11(true);
|
|
3638
3639
|
const [calculatedFields, setCalculatedFields] = useState11(() => loadCalculatedFields());
|
|
3639
3640
|
const [currentStorageKey, setCurrentStorageKey] = useState11(null);
|
|
3641
|
+
const [collapsedPaths, setCollapsedPaths] = useState11(/* @__PURE__ */ new Set());
|
|
3640
3642
|
const availableFields = useMemo11(() => {
|
|
3641
3643
|
return computeAvailableFields(data);
|
|
3642
3644
|
}, [data]);
|
|
@@ -3664,8 +3666,8 @@ function usePivotTable(data) {
|
|
|
3664
3666
|
showRowTotals,
|
|
3665
3667
|
showColumnTotals,
|
|
3666
3668
|
calculatedFields
|
|
3667
|
-
});
|
|
3668
|
-
}, [data, isConfigured, canUsePivot, rowFields, columnFields, valueFields, showRowTotals, showColumnTotals, calculatedFields]);
|
|
3669
|
+
}, { collapsedPaths: enableDrillDown ? collapsedPaths : /* @__PURE__ */ new Set() });
|
|
3670
|
+
}, [data, isConfigured, canUsePivot, rowFields, columnFields, valueFields, showRowTotals, showColumnTotals, calculatedFields, collapsedPaths, enableDrillDown]);
|
|
3669
3671
|
useEffect9(() => {
|
|
3670
3672
|
if (data.length === 0)
|
|
3671
3673
|
return;
|
|
@@ -3697,6 +3699,18 @@ function usePivotTable(data) {
|
|
|
3697
3699
|
setValueFields([]);
|
|
3698
3700
|
}
|
|
3699
3701
|
}
|
|
3702
|
+
try {
|
|
3703
|
+
const collapsedKey = `${storageKey}-collapsed`;
|
|
3704
|
+
const raw = sessionStorage.getItem(collapsedKey);
|
|
3705
|
+
if (raw) {
|
|
3706
|
+
const parsed = JSON.parse(raw);
|
|
3707
|
+
setCollapsedPaths(new Set(parsed));
|
|
3708
|
+
} else {
|
|
3709
|
+
setCollapsedPaths(/* @__PURE__ */ new Set());
|
|
3710
|
+
}
|
|
3711
|
+
} catch {
|
|
3712
|
+
setCollapsedPaths(/* @__PURE__ */ new Set());
|
|
3713
|
+
}
|
|
3700
3714
|
}
|
|
3701
3715
|
}, [data]);
|
|
3702
3716
|
useEffect9(() => {
|
|
@@ -3712,6 +3726,15 @@ function usePivotTable(data) {
|
|
|
3712
3726
|
};
|
|
3713
3727
|
savePivotConfig(currentStorageKey, config);
|
|
3714
3728
|
}, [currentStorageKey, rowFields, columnFields, valueFields, showRowTotals, showColumnTotals, calculatedFields]);
|
|
3729
|
+
useEffect9(() => {
|
|
3730
|
+
if (!currentStorageKey)
|
|
3731
|
+
return;
|
|
3732
|
+
try {
|
|
3733
|
+
const collapsedKey = `${currentStorageKey}-collapsed`;
|
|
3734
|
+
sessionStorage.setItem(collapsedKey, JSON.stringify(Array.from(collapsedPaths)));
|
|
3735
|
+
} catch {
|
|
3736
|
+
}
|
|
3737
|
+
}, [collapsedPaths, currentStorageKey]);
|
|
3715
3738
|
const addRowField = useCallback11(
|
|
3716
3739
|
(field) => {
|
|
3717
3740
|
if (!rowFields.includes(field)) {
|
|
@@ -3813,6 +3836,55 @@ function usePivotTable(data) {
|
|
|
3813
3836
|
});
|
|
3814
3837
|
setValueFields((prev) => prev.filter((v) => v.field !== `calc:${id}`));
|
|
3815
3838
|
}, []);
|
|
3839
|
+
const toggleCollapsedPath = useCallback11(
|
|
3840
|
+
(key, altKey, _rowFields, currentPivotResult) => {
|
|
3841
|
+
if (!altKey) {
|
|
3842
|
+
const next2 = new Set(collapsedPaths);
|
|
3843
|
+
if (next2.has(key)) {
|
|
3844
|
+
next2.delete(key);
|
|
3845
|
+
} else {
|
|
3846
|
+
next2.add(key);
|
|
3847
|
+
}
|
|
3848
|
+
setCollapsedPaths(next2);
|
|
3849
|
+
return next2;
|
|
3850
|
+
}
|
|
3851
|
+
if (!currentPivotResult)
|
|
3852
|
+
return /* @__PURE__ */ new Set();
|
|
3853
|
+
let targetDepth = -1;
|
|
3854
|
+
for (const meta of currentPivotResult.rowMeta) {
|
|
3855
|
+
for (const gs of meta.groupStarts) {
|
|
3856
|
+
if (gs.key === key) {
|
|
3857
|
+
targetDepth = gs.depth;
|
|
3858
|
+
break;
|
|
3859
|
+
}
|
|
3860
|
+
}
|
|
3861
|
+
if (targetDepth >= 0)
|
|
3862
|
+
break;
|
|
3863
|
+
}
|
|
3864
|
+
if (targetDepth < 0)
|
|
3865
|
+
return /* @__PURE__ */ new Set();
|
|
3866
|
+
const keysAtDepth = /* @__PURE__ */ new Set();
|
|
3867
|
+
for (const meta of currentPivotResult.rowMeta) {
|
|
3868
|
+
for (const gs of meta.groupStarts) {
|
|
3869
|
+
if (gs.depth === targetDepth) {
|
|
3870
|
+
keysAtDepth.add(gs.key);
|
|
3871
|
+
}
|
|
3872
|
+
}
|
|
3873
|
+
}
|
|
3874
|
+
const shouldCollapse = !collapsedPaths.has(key);
|
|
3875
|
+
const next = new Set(collapsedPaths);
|
|
3876
|
+
for (const k of keysAtDepth) {
|
|
3877
|
+
if (shouldCollapse) {
|
|
3878
|
+
next.add(k);
|
|
3879
|
+
} else {
|
|
3880
|
+
next.delete(k);
|
|
3881
|
+
}
|
|
3882
|
+
}
|
|
3883
|
+
setCollapsedPaths(next);
|
|
3884
|
+
return next;
|
|
3885
|
+
},
|
|
3886
|
+
[collapsedPaths]
|
|
3887
|
+
);
|
|
3816
3888
|
return {
|
|
3817
3889
|
// State
|
|
3818
3890
|
rowFields,
|
|
@@ -3821,6 +3893,7 @@ function usePivotTable(data) {
|
|
|
3821
3893
|
showRowTotals,
|
|
3822
3894
|
showColumnTotals,
|
|
3823
3895
|
calculatedFields,
|
|
3896
|
+
collapsedPaths,
|
|
3824
3897
|
// Computed
|
|
3825
3898
|
availableFields,
|
|
3826
3899
|
unassignedFields,
|
|
@@ -3841,14 +3914,141 @@ function usePivotTable(data) {
|
|
|
3841
3914
|
setRowFields,
|
|
3842
3915
|
setColumnFields,
|
|
3843
3916
|
addCalculatedField,
|
|
3844
|
-
removeCalculatedField
|
|
3917
|
+
removeCalculatedField,
|
|
3918
|
+
toggleCollapsedPath
|
|
3919
|
+
};
|
|
3920
|
+
}
|
|
3921
|
+
|
|
3922
|
+
// src/components/DrillThroughModal.tsx
|
|
3923
|
+
import { exportToCSV as exportToCSV2, getAggregationLabel as getAggregationLabel2 } from "@smallwebco/tinypivot-core";
|
|
3924
|
+
import { useCallback as useCallback12, useEffect as useEffect10, useMemo as useMemo12, useState as useState12 } from "react";
|
|
3925
|
+
import { createPortal as createPortal2 } from "react-dom";
|
|
3926
|
+
import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3927
|
+
var PAGE_SIZE = 50;
|
|
3928
|
+
function DrillThroughModal({
|
|
3929
|
+
show,
|
|
3930
|
+
result,
|
|
3931
|
+
onClose,
|
|
3932
|
+
theme
|
|
3933
|
+
}) {
|
|
3934
|
+
const [currentPage, setCurrentPage] = useState12(1);
|
|
3935
|
+
useEffect10(() => {
|
|
3936
|
+
if (show) {
|
|
3937
|
+
setCurrentPage(1);
|
|
3938
|
+
}
|
|
3939
|
+
}, [show, result]);
|
|
3940
|
+
useEffect10(() => {
|
|
3941
|
+
if (!show)
|
|
3942
|
+
return;
|
|
3943
|
+
const handleKeydown = (event) => {
|
|
3944
|
+
if (event.key === "Escape") {
|
|
3945
|
+
onClose();
|
|
3946
|
+
}
|
|
3947
|
+
};
|
|
3948
|
+
document.addEventListener("keydown", handleKeydown);
|
|
3949
|
+
return () => document.removeEventListener("keydown", handleKeydown);
|
|
3950
|
+
}, [show, onClose]);
|
|
3951
|
+
const columns = useMemo12(() => {
|
|
3952
|
+
if (!result || result.rows.length === 0)
|
|
3953
|
+
return [];
|
|
3954
|
+
return Object.keys(result.rows[0]);
|
|
3955
|
+
}, [result]);
|
|
3956
|
+
const totalPages = useMemo12(() => {
|
|
3957
|
+
if (!result)
|
|
3958
|
+
return 1;
|
|
3959
|
+
return Math.max(1, Math.ceil(result.rows.length / PAGE_SIZE));
|
|
3960
|
+
}, [result]);
|
|
3961
|
+
const pageRows = useMemo12(() => {
|
|
3962
|
+
if (!result)
|
|
3963
|
+
return [];
|
|
3964
|
+
const start = (currentPage - 1) * PAGE_SIZE;
|
|
3965
|
+
return result.rows.slice(start, start + PAGE_SIZE);
|
|
3966
|
+
}, [result, currentPage]);
|
|
3967
|
+
const modalTitle = useMemo12(() => {
|
|
3968
|
+
if (!result)
|
|
3969
|
+
return "Drill Through";
|
|
3970
|
+
const { descriptor } = result;
|
|
3971
|
+
const parts = [];
|
|
3972
|
+
if (descriptor.rowPath.length > 0)
|
|
3973
|
+
parts.push(descriptor.rowPath.join(" \xD7 "));
|
|
3974
|
+
if (descriptor.columnPath.length > 0)
|
|
3975
|
+
parts.push(descriptor.columnPath.join(" \xD7 "));
|
|
3976
|
+
const slice = parts.length > 0 ? parts.join(" \xD7 ") : "Grand Total";
|
|
3977
|
+
const aggLabel = getAggregationLabel2(descriptor.aggregation);
|
|
3978
|
+
const valueStr = descriptor.formattedValue !== "-" ? ` = ${descriptor.formattedValue}` : "";
|
|
3979
|
+
return `${slice} \u2014 ${aggLabel} of ${descriptor.valueField}${valueStr} \xB7 ${descriptor.rowCount} rows`;
|
|
3980
|
+
}, [result]);
|
|
3981
|
+
const handleOverlayClick = useCallback12((e) => {
|
|
3982
|
+
if (e.target === e.currentTarget) {
|
|
3983
|
+
onClose();
|
|
3984
|
+
}
|
|
3985
|
+
}, [onClose]);
|
|
3986
|
+
const handleExport = useCallback12(() => {
|
|
3987
|
+
if (!result || result.rows.length === 0)
|
|
3988
|
+
return;
|
|
3989
|
+
exportToCSV2(result.rows, columns, { filename: "drill-through.csv" });
|
|
3990
|
+
}, [result, columns]);
|
|
3991
|
+
const formatCellValue2 = (value) => {
|
|
3992
|
+
if (value === null || value === void 0)
|
|
3993
|
+
return "";
|
|
3994
|
+
return String(value);
|
|
3845
3995
|
};
|
|
3996
|
+
if (!show || typeof document === "undefined")
|
|
3997
|
+
return null;
|
|
3998
|
+
return createPortal2(
|
|
3999
|
+
/* @__PURE__ */ jsx7("div", { className: `vpg-modal-overlay vpg-theme-${theme ?? "light"}`, onClick: handleOverlayClick, children: /* @__PURE__ */ jsxs7("div", { className: "vpg-modal vpg-drill-modal", children: [
|
|
4000
|
+
/* @__PURE__ */ jsxs7("div", { className: "vpg-modal-header", children: [
|
|
4001
|
+
/* @__PURE__ */ jsx7("h3", { className: "vpg-drill-title", children: modalTitle }),
|
|
4002
|
+
/* @__PURE__ */ jsx7("button", { className: "vpg-modal-close", onClick: onClose, children: "\xD7" })
|
|
4003
|
+
] }),
|
|
4004
|
+
/* @__PURE__ */ jsx7("div", { className: "vpg-modal-body vpg-drill-body", children: !result || result.rows.length === 0 ? /* @__PURE__ */ jsx7("div", { className: "vpg-drill-empty", children: "No source rows found for this cell." }) : /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
4005
|
+
/* @__PURE__ */ jsx7("div", { className: "vpg-drill-table-wrapper", children: /* @__PURE__ */ jsxs7("table", { className: "vpg-drill-table", children: [
|
|
4006
|
+
/* @__PURE__ */ jsx7("thead", { children: /* @__PURE__ */ jsx7("tr", { children: columns.map((col) => /* @__PURE__ */ jsx7("th", { children: col }, col)) }) }),
|
|
4007
|
+
/* @__PURE__ */ jsx7("tbody", { children: pageRows.map((row, rowIdx) => /* @__PURE__ */ jsx7("tr", { children: columns.map((col) => /* @__PURE__ */ jsx7("td", { children: formatCellValue2(row[col]) }, col)) }, rowIdx)) })
|
|
4008
|
+
] }) }),
|
|
4009
|
+
totalPages > 1 && /* @__PURE__ */ jsxs7("div", { className: "vpg-drill-pagination", children: [
|
|
4010
|
+
/* @__PURE__ */ jsx7(
|
|
4011
|
+
"button",
|
|
4012
|
+
{
|
|
4013
|
+
className: "vpg-page-btn",
|
|
4014
|
+
disabled: currentPage === 1,
|
|
4015
|
+
onClick: () => setCurrentPage((p) => Math.max(1, p - 1)),
|
|
4016
|
+
children: "\u2190"
|
|
4017
|
+
}
|
|
4018
|
+
),
|
|
4019
|
+
/* @__PURE__ */ jsxs7("span", { children: [
|
|
4020
|
+
"Page",
|
|
4021
|
+
" ",
|
|
4022
|
+
currentPage,
|
|
4023
|
+
" ",
|
|
4024
|
+
"of",
|
|
4025
|
+
" ",
|
|
4026
|
+
totalPages
|
|
4027
|
+
] }),
|
|
4028
|
+
/* @__PURE__ */ jsx7(
|
|
4029
|
+
"button",
|
|
4030
|
+
{
|
|
4031
|
+
className: "vpg-page-btn",
|
|
4032
|
+
disabled: currentPage === totalPages,
|
|
4033
|
+
onClick: () => setCurrentPage((p) => Math.min(totalPages, p + 1)),
|
|
4034
|
+
children: "\u2192"
|
|
4035
|
+
}
|
|
4036
|
+
)
|
|
4037
|
+
] })
|
|
4038
|
+
] }) }),
|
|
4039
|
+
/* @__PURE__ */ jsxs7("div", { className: "vpg-modal-footer", children: [
|
|
4040
|
+
result && result.rows.length > 0 && /* @__PURE__ */ jsx7("button", { className: "vpg-btn vpg-btn-secondary", onClick: handleExport, children: "Export CSV" }),
|
|
4041
|
+
/* @__PURE__ */ jsx7("button", { className: "vpg-btn vpg-btn-primary", onClick: onClose, children: "Close" })
|
|
4042
|
+
] })
|
|
4043
|
+
] }) }),
|
|
4044
|
+
document.body
|
|
4045
|
+
);
|
|
3846
4046
|
}
|
|
3847
4047
|
|
|
3848
4048
|
// src/components/PivotConfig.tsx
|
|
3849
4049
|
import { AGGREGATION_OPTIONS, getAggregationSymbol } from "@smallwebco/tinypivot-core";
|
|
3850
|
-
import { useCallback as
|
|
3851
|
-
import { Fragment as
|
|
4050
|
+
import { useCallback as useCallback13, useMemo as useMemo13, useState as useState13 } from "react";
|
|
4051
|
+
import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3852
4052
|
function aggregationRequiresPro(agg) {
|
|
3853
4053
|
return agg !== "sum";
|
|
3854
4054
|
}
|
|
@@ -3890,15 +4090,15 @@ function PivotConfig({
|
|
|
3890
4090
|
onUpdateCalculatedField,
|
|
3891
4091
|
theme
|
|
3892
4092
|
}) {
|
|
3893
|
-
const [fieldSearch, setFieldSearch] =
|
|
3894
|
-
const [showCalcModal, setShowCalcModal] =
|
|
3895
|
-
const [editingCalcField, setEditingCalcField] =
|
|
4093
|
+
const [fieldSearch, setFieldSearch] = useState13("");
|
|
4094
|
+
const [showCalcModal, setShowCalcModal] = useState13(false);
|
|
4095
|
+
const [editingCalcField, setEditingCalcField] = useState13(null);
|
|
3896
4096
|
const { canUseAdvancedAggregations } = useLicense();
|
|
3897
|
-
const isAggregationAvailable =
|
|
4097
|
+
const isAggregationAvailable = useCallback13((agg) => {
|
|
3898
4098
|
return !aggregationRequiresPro(agg) || canUseAdvancedAggregations;
|
|
3899
4099
|
}, [canUseAdvancedAggregations]);
|
|
3900
|
-
const numericFieldNames =
|
|
3901
|
-
const calculatedFieldsAsStats =
|
|
4100
|
+
const numericFieldNames = useMemo13(() => availableFields.filter((f) => f.isNumeric).map((f) => f.field), [availableFields]);
|
|
4101
|
+
const calculatedFieldsAsStats = useMemo13(() => {
|
|
3902
4102
|
if (!calculatedFields)
|
|
3903
4103
|
return [];
|
|
3904
4104
|
return calculatedFields.map((calc) => ({
|
|
@@ -3912,11 +4112,11 @@ function PivotConfig({
|
|
|
3912
4112
|
calcFormula: calc.formula
|
|
3913
4113
|
}));
|
|
3914
4114
|
}, [calculatedFields]);
|
|
3915
|
-
const allAvailableFields =
|
|
4115
|
+
const allAvailableFields = useMemo13(() => [
|
|
3916
4116
|
...availableFields.map((f) => ({ ...f, isCalculated: false })),
|
|
3917
4117
|
...calculatedFieldsAsStats
|
|
3918
4118
|
], [availableFields, calculatedFieldsAsStats]);
|
|
3919
|
-
const assignedFields =
|
|
4119
|
+
const assignedFields = useMemo13(() => {
|
|
3920
4120
|
const rowSet = new Set(rowFields);
|
|
3921
4121
|
const colSet = new Set(columnFields);
|
|
3922
4122
|
const valueMap = new Map(valueFields.map((v) => [v.field, v]));
|
|
@@ -3926,7 +4126,7 @@ function PivotConfig({
|
|
|
3926
4126
|
valueConfig: valueMap.get(f.field)
|
|
3927
4127
|
}));
|
|
3928
4128
|
}, [allAvailableFields, rowFields, columnFields, valueFields]);
|
|
3929
|
-
const unassignedFields =
|
|
4129
|
+
const unassignedFields = useMemo13(() => {
|
|
3930
4130
|
const rowSet = new Set(rowFields);
|
|
3931
4131
|
const colSet = new Set(columnFields);
|
|
3932
4132
|
const valSet = new Set(valueFields.map((v) => v.field));
|
|
@@ -3934,7 +4134,7 @@ function PivotConfig({
|
|
|
3934
4134
|
(f) => !rowSet.has(f.field) && !colSet.has(f.field) && !valSet.has(f.field)
|
|
3935
4135
|
);
|
|
3936
4136
|
}, [allAvailableFields, rowFields, columnFields, valueFields]);
|
|
3937
|
-
const filteredUnassignedFields =
|
|
4137
|
+
const filteredUnassignedFields = useMemo13(() => {
|
|
3938
4138
|
if (!fieldSearch.trim())
|
|
3939
4139
|
return unassignedFields;
|
|
3940
4140
|
const search = fieldSearch.toLowerCase().trim();
|
|
@@ -3945,13 +4145,13 @@ function PivotConfig({
|
|
|
3945
4145
|
});
|
|
3946
4146
|
}, [unassignedFields, fieldSearch]);
|
|
3947
4147
|
const assignedCount = assignedFields.length;
|
|
3948
|
-
const getFieldDisplayName =
|
|
4148
|
+
const getFieldDisplayName = useCallback13((field) => {
|
|
3949
4149
|
if (field.isCalculated && field.calcName) {
|
|
3950
4150
|
return field.calcName;
|
|
3951
4151
|
}
|
|
3952
4152
|
return field.field;
|
|
3953
4153
|
}, []);
|
|
3954
|
-
const handleDragStart =
|
|
4154
|
+
const handleDragStart = useCallback13(
|
|
3955
4155
|
(field, event) => {
|
|
3956
4156
|
event.dataTransfer?.setData("text/plain", field);
|
|
3957
4157
|
event.dataTransfer.effectAllowed = "move";
|
|
@@ -3959,7 +4159,7 @@ function PivotConfig({
|
|
|
3959
4159
|
},
|
|
3960
4160
|
[onDragStart]
|
|
3961
4161
|
);
|
|
3962
|
-
const handleAggregationChange =
|
|
4162
|
+
const handleAggregationChange = useCallback13(
|
|
3963
4163
|
(field, currentAgg, newAgg) => {
|
|
3964
4164
|
if (!isAggregationAvailable(newAgg)) {
|
|
3965
4165
|
console.warn(`[TinyPivot] "${newAgg}" aggregation requires a Pro license. Visit https://tiny-pivot.com/#pricing to upgrade.`);
|
|
@@ -3969,7 +4169,7 @@ function PivotConfig({
|
|
|
3969
4169
|
},
|
|
3970
4170
|
[onUpdateAggregation, isAggregationAvailable]
|
|
3971
4171
|
);
|
|
3972
|
-
const toggleRowColumn =
|
|
4172
|
+
const toggleRowColumn = useCallback13(
|
|
3973
4173
|
(field, currentAssignment) => {
|
|
3974
4174
|
if (currentAssignment === "row") {
|
|
3975
4175
|
onRemoveRowField(field);
|
|
@@ -3981,7 +4181,7 @@ function PivotConfig({
|
|
|
3981
4181
|
},
|
|
3982
4182
|
[onRemoveRowField, onAddColumnField, onRemoveColumnField, onAddRowField]
|
|
3983
4183
|
);
|
|
3984
|
-
const removeField =
|
|
4184
|
+
const removeField = useCallback13(
|
|
3985
4185
|
(field, assignedTo, valueConfig) => {
|
|
3986
4186
|
if (assignedTo === "row") {
|
|
3987
4187
|
onRemoveRowField(field);
|
|
@@ -3993,15 +4193,15 @@ function PivotConfig({
|
|
|
3993
4193
|
},
|
|
3994
4194
|
[onRemoveRowField, onRemoveColumnField, onRemoveValueField]
|
|
3995
4195
|
);
|
|
3996
|
-
const handleTotalsToggle =
|
|
4196
|
+
const handleTotalsToggle = useCallback13((checked) => {
|
|
3997
4197
|
onShowRowTotalsChange(checked);
|
|
3998
4198
|
onShowColumnTotalsChange(checked);
|
|
3999
4199
|
}, [onShowRowTotalsChange, onShowColumnTotalsChange]);
|
|
4000
|
-
const openCalcModal =
|
|
4200
|
+
const openCalcModal = useCallback13((field) => {
|
|
4001
4201
|
setEditingCalcField(field || null);
|
|
4002
4202
|
setShowCalcModal(true);
|
|
4003
4203
|
}, []);
|
|
4004
|
-
const handleSaveCalcField =
|
|
4204
|
+
const handleSaveCalcField = useCallback13((field) => {
|
|
4005
4205
|
if (editingCalcField && onUpdateCalculatedField) {
|
|
4006
4206
|
onUpdateCalculatedField(field);
|
|
4007
4207
|
} else if (onAddCalculatedField) {
|
|
@@ -4010,14 +4210,14 @@ function PivotConfig({
|
|
|
4010
4210
|
setShowCalcModal(false);
|
|
4011
4211
|
setEditingCalcField(null);
|
|
4012
4212
|
}, [editingCalcField, onAddCalculatedField, onUpdateCalculatedField]);
|
|
4013
|
-
const handleCloseCalcModal =
|
|
4213
|
+
const handleCloseCalcModal = useCallback13(() => {
|
|
4014
4214
|
setShowCalcModal(false);
|
|
4015
4215
|
setEditingCalcField(null);
|
|
4016
4216
|
}, []);
|
|
4017
|
-
return /* @__PURE__ */
|
|
4018
|
-
/* @__PURE__ */
|
|
4019
|
-
/* @__PURE__ */
|
|
4020
|
-
/* @__PURE__ */
|
|
4217
|
+
return /* @__PURE__ */ jsxs8("div", { className: `vpg-pivot-config ${theme ? `vpg-theme-${theme}` : ""}`, children: [
|
|
4218
|
+
/* @__PURE__ */ jsxs8("div", { className: "vpg-config-header", children: [
|
|
4219
|
+
/* @__PURE__ */ jsxs8("h3", { className: "vpg-config-title", children: [
|
|
4220
|
+
/* @__PURE__ */ jsx8("svg", { className: "vpg-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx8(
|
|
4021
4221
|
"path",
|
|
4022
4222
|
{
|
|
4023
4223
|
strokeLinecap: "round",
|
|
@@ -4028,13 +4228,13 @@ function PivotConfig({
|
|
|
4028
4228
|
) }),
|
|
4029
4229
|
"Fields"
|
|
4030
4230
|
] }),
|
|
4031
|
-
/* @__PURE__ */
|
|
4231
|
+
/* @__PURE__ */ jsx8("div", { className: "vpg-header-actions", children: assignedCount > 0 && /* @__PURE__ */ jsx8(
|
|
4032
4232
|
"button",
|
|
4033
4233
|
{
|
|
4034
4234
|
className: "vpg-action-btn vpg-clear-btn",
|
|
4035
4235
|
title: "Clear all",
|
|
4036
4236
|
onClick: onClearConfig,
|
|
4037
|
-
children: /* @__PURE__ */
|
|
4237
|
+
children: /* @__PURE__ */ jsx8("svg", { className: "vpg-icon-sm", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx8(
|
|
4038
4238
|
"path",
|
|
4039
4239
|
{
|
|
4040
4240
|
strokeLinecap: "round",
|
|
@@ -4046,9 +4246,9 @@ function PivotConfig({
|
|
|
4046
4246
|
}
|
|
4047
4247
|
) })
|
|
4048
4248
|
] }),
|
|
4049
|
-
assignedCount > 0 && /* @__PURE__ */
|
|
4050
|
-
/* @__PURE__ */
|
|
4051
|
-
/* @__PURE__ */
|
|
4249
|
+
assignedCount > 0 && /* @__PURE__ */ jsxs8("div", { className: "vpg-assigned-section", children: [
|
|
4250
|
+
/* @__PURE__ */ jsx8("div", { className: "vpg-section-label", children: "Active" }),
|
|
4251
|
+
/* @__PURE__ */ jsx8("div", { className: "vpg-assigned-list", children: assignedFields.map((field) => /* @__PURE__ */ jsxs8(
|
|
4052
4252
|
"div",
|
|
4053
4253
|
{
|
|
4054
4254
|
className: `vpg-assigned-item vpg-type-${field.assignedTo}${field.isCalculated ? " vpg-type-calc" : ""}`,
|
|
@@ -4057,12 +4257,12 @@ function PivotConfig({
|
|
|
4057
4257
|
onDragStart: (e) => handleDragStart(field.field, e),
|
|
4058
4258
|
onDragEnd,
|
|
4059
4259
|
children: [
|
|
4060
|
-
/* @__PURE__ */
|
|
4061
|
-
/* @__PURE__ */
|
|
4062
|
-
/* @__PURE__ */
|
|
4260
|
+
/* @__PURE__ */ jsxs8("div", { className: "vpg-item-main", children: [
|
|
4261
|
+
/* @__PURE__ */ jsx8("span", { className: `vpg-item-badge ${field.assignedTo}${field.isCalculated ? " calc" : ""}`, children: field.isCalculated ? "\u0192" : field.assignedTo === "row" ? "R" : field.assignedTo === "column" ? "C" : getAggregationSymbol(field.valueConfig?.aggregation || "sum") }),
|
|
4262
|
+
/* @__PURE__ */ jsx8("span", { className: "vpg-item-name", children: getFieldDisplayName(field) })
|
|
4063
4263
|
] }),
|
|
4064
|
-
/* @__PURE__ */
|
|
4065
|
-
(field.assignedTo === "row" || field.assignedTo === "column") && /* @__PURE__ */
|
|
4264
|
+
/* @__PURE__ */ jsxs8("div", { className: "vpg-item-actions", children: [
|
|
4265
|
+
(field.assignedTo === "row" || field.assignedTo === "column") && /* @__PURE__ */ jsx8(
|
|
4066
4266
|
"button",
|
|
4067
4267
|
{
|
|
4068
4268
|
className: "vpg-toggle-btn",
|
|
@@ -4071,14 +4271,14 @@ function PivotConfig({
|
|
|
4071
4271
|
e.stopPropagation();
|
|
4072
4272
|
toggleRowColumn(field.field, field.assignedTo);
|
|
4073
4273
|
},
|
|
4074
|
-
children: /* @__PURE__ */
|
|
4274
|
+
children: /* @__PURE__ */ jsx8(
|
|
4075
4275
|
"svg",
|
|
4076
4276
|
{
|
|
4077
4277
|
className: "vpg-icon-xs",
|
|
4078
4278
|
fill: "none",
|
|
4079
4279
|
stroke: "currentColor",
|
|
4080
4280
|
viewBox: "0 0 24 24",
|
|
4081
|
-
children: /* @__PURE__ */
|
|
4281
|
+
children: /* @__PURE__ */ jsx8(
|
|
4082
4282
|
"path",
|
|
4083
4283
|
{
|
|
4084
4284
|
strokeLinecap: "round",
|
|
@@ -4091,7 +4291,7 @@ function PivotConfig({
|
|
|
4091
4291
|
)
|
|
4092
4292
|
}
|
|
4093
4293
|
),
|
|
4094
|
-
field.assignedTo === "value" && field.valueConfig && /* @__PURE__ */
|
|
4294
|
+
field.assignedTo === "value" && field.valueConfig && /* @__PURE__ */ jsx8(
|
|
4095
4295
|
"select",
|
|
4096
4296
|
{
|
|
4097
4297
|
className: "vpg-agg-select",
|
|
@@ -4105,7 +4305,7 @@ function PivotConfig({
|
|
|
4105
4305
|
);
|
|
4106
4306
|
},
|
|
4107
4307
|
onClick: (e) => e.stopPropagation(),
|
|
4108
|
-
children: AGGREGATION_OPTIONS.map((agg) => /* @__PURE__ */
|
|
4308
|
+
children: AGGREGATION_OPTIONS.map((agg) => /* @__PURE__ */ jsxs8(
|
|
4109
4309
|
"option",
|
|
4110
4310
|
{
|
|
4111
4311
|
value: agg.value,
|
|
@@ -4121,7 +4321,7 @@ function PivotConfig({
|
|
|
4121
4321
|
))
|
|
4122
4322
|
}
|
|
4123
4323
|
),
|
|
4124
|
-
/* @__PURE__ */
|
|
4324
|
+
/* @__PURE__ */ jsx8(
|
|
4125
4325
|
"button",
|
|
4126
4326
|
{
|
|
4127
4327
|
className: "vpg-remove-btn",
|
|
@@ -4139,14 +4339,14 @@ function PivotConfig({
|
|
|
4139
4339
|
field.field
|
|
4140
4340
|
)) })
|
|
4141
4341
|
] }),
|
|
4142
|
-
/* @__PURE__ */
|
|
4143
|
-
/* @__PURE__ */
|
|
4342
|
+
/* @__PURE__ */ jsxs8("div", { className: "vpg-unassigned-section", children: [
|
|
4343
|
+
/* @__PURE__ */ jsx8("div", { className: "vpg-section-header", children: /* @__PURE__ */ jsxs8("div", { className: "vpg-section-label", children: [
|
|
4144
4344
|
"Available",
|
|
4145
4345
|
" ",
|
|
4146
|
-
/* @__PURE__ */
|
|
4346
|
+
/* @__PURE__ */ jsx8("span", { className: "vpg-count", children: unassignedFields.length })
|
|
4147
4347
|
] }) }),
|
|
4148
|
-
/* @__PURE__ */
|
|
4149
|
-
/* @__PURE__ */
|
|
4348
|
+
/* @__PURE__ */ jsxs8("div", { className: "vpg-field-search", children: [
|
|
4349
|
+
/* @__PURE__ */ jsx8("svg", { className: "vpg-search-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx8(
|
|
4150
4350
|
"path",
|
|
4151
4351
|
{
|
|
4152
4352
|
strokeLinecap: "round",
|
|
@@ -4155,7 +4355,7 @@ function PivotConfig({
|
|
|
4155
4355
|
d: "M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
|
|
4156
4356
|
}
|
|
4157
4357
|
) }),
|
|
4158
|
-
/* @__PURE__ */
|
|
4358
|
+
/* @__PURE__ */ jsx8(
|
|
4159
4359
|
"input",
|
|
4160
4360
|
{
|
|
4161
4361
|
type: "text",
|
|
@@ -4165,7 +4365,7 @@ function PivotConfig({
|
|
|
4165
4365
|
className: "vpg-search-input"
|
|
4166
4366
|
}
|
|
4167
4367
|
),
|
|
4168
|
-
fieldSearch && /* @__PURE__ */
|
|
4368
|
+
fieldSearch && /* @__PURE__ */ jsx8("button", { className: "vpg-clear-search", onClick: () => setFieldSearch(""), children: /* @__PURE__ */ jsx8("svg", { className: "vpg-icon-xs", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx8(
|
|
4169
4369
|
"path",
|
|
4170
4370
|
{
|
|
4171
4371
|
strokeLinecap: "round",
|
|
@@ -4175,8 +4375,8 @@ function PivotConfig({
|
|
|
4175
4375
|
}
|
|
4176
4376
|
) }) })
|
|
4177
4377
|
] }),
|
|
4178
|
-
/* @__PURE__ */
|
|
4179
|
-
filteredUnassignedFields.map((field) => /* @__PURE__ */
|
|
4378
|
+
/* @__PURE__ */ jsxs8("div", { className: "vpg-field-list", children: [
|
|
4379
|
+
filteredUnassignedFields.map((field) => /* @__PURE__ */ jsxs8(
|
|
4180
4380
|
"div",
|
|
4181
4381
|
{
|
|
4182
4382
|
className: `vpg-field-item${field.isNumeric && !field.isCalculated ? " vpg-is-numeric" : ""}${field.isCalculated ? " vpg-is-calculated" : ""}`,
|
|
@@ -4185,10 +4385,10 @@ function PivotConfig({
|
|
|
4185
4385
|
onDragStart: (e) => handleDragStart(field.field, e),
|
|
4186
4386
|
onDragEnd,
|
|
4187
4387
|
children: [
|
|
4188
|
-
/* @__PURE__ */
|
|
4189
|
-
/* @__PURE__ */
|
|
4190
|
-
field.isCalculated ? /* @__PURE__ */
|
|
4191
|
-
/* @__PURE__ */
|
|
4388
|
+
/* @__PURE__ */ jsx8("span", { className: `vpg-field-type-icon${field.isCalculated ? " vpg-calc-type" : ""}`, title: field.type, children: getFieldIcon(field.type, field.isCalculated) }),
|
|
4389
|
+
/* @__PURE__ */ jsx8("span", { className: "vpg-field-name", children: getFieldDisplayName(field) }),
|
|
4390
|
+
field.isCalculated ? /* @__PURE__ */ jsxs8(Fragment5, { children: [
|
|
4391
|
+
/* @__PURE__ */ jsx8(
|
|
4192
4392
|
"button",
|
|
4193
4393
|
{
|
|
4194
4394
|
className: "vpg-field-edit",
|
|
@@ -4202,7 +4402,7 @@ function PivotConfig({
|
|
|
4202
4402
|
children: "\u270E"
|
|
4203
4403
|
}
|
|
4204
4404
|
),
|
|
4205
|
-
/* @__PURE__ */
|
|
4405
|
+
/* @__PURE__ */ jsx8(
|
|
4206
4406
|
"button",
|
|
4207
4407
|
{
|
|
4208
4408
|
className: "vpg-field-delete",
|
|
@@ -4216,22 +4416,22 @@ function PivotConfig({
|
|
|
4216
4416
|
children: "\xD7"
|
|
4217
4417
|
}
|
|
4218
4418
|
)
|
|
4219
|
-
] }) : /* @__PURE__ */
|
|
4419
|
+
] }) : /* @__PURE__ */ jsx8("span", { className: "vpg-unique-count", children: field.uniqueCount })
|
|
4220
4420
|
]
|
|
4221
4421
|
},
|
|
4222
4422
|
field.field
|
|
4223
4423
|
)),
|
|
4224
|
-
filteredUnassignedFields.length === 0 && fieldSearch && /* @__PURE__ */
|
|
4424
|
+
filteredUnassignedFields.length === 0 && fieldSearch && /* @__PURE__ */ jsxs8("div", { className: "vpg-empty-hint", children: [
|
|
4225
4425
|
'No fields match "',
|
|
4226
4426
|
fieldSearch,
|
|
4227
4427
|
'"'
|
|
4228
4428
|
] }),
|
|
4229
|
-
unassignedFields.length === 0 && /* @__PURE__ */
|
|
4429
|
+
unassignedFields.length === 0 && /* @__PURE__ */ jsx8("div", { className: "vpg-empty-hint", children: "All fields assigned" })
|
|
4230
4430
|
] })
|
|
4231
4431
|
] }),
|
|
4232
|
-
/* @__PURE__ */
|
|
4233
|
-
/* @__PURE__ */
|
|
4234
|
-
/* @__PURE__ */
|
|
4432
|
+
/* @__PURE__ */ jsxs8("div", { className: "vpg-options-section", children: [
|
|
4433
|
+
/* @__PURE__ */ jsxs8("label", { className: "vpg-option-toggle", children: [
|
|
4434
|
+
/* @__PURE__ */ jsx8(
|
|
4235
4435
|
"input",
|
|
4236
4436
|
{
|
|
4237
4437
|
type: "checkbox",
|
|
@@ -4239,19 +4439,20 @@ function PivotConfig({
|
|
|
4239
4439
|
onChange: (e) => handleTotalsToggle(e.target.checked)
|
|
4240
4440
|
}
|
|
4241
4441
|
),
|
|
4242
|
-
/* @__PURE__ */
|
|
4442
|
+
/* @__PURE__ */ jsx8("span", { children: "Totals" })
|
|
4243
4443
|
] }),
|
|
4244
|
-
/* @__PURE__ */
|
|
4245
|
-
/* @__PURE__ */
|
|
4246
|
-
/* @__PURE__ */
|
|
4444
|
+
/* @__PURE__ */ jsxs8("button", { className: "vpg-calc-btn", onClick: () => openCalcModal(), title: "Add calculated field (e.g. Profit Margin %)", children: [
|
|
4445
|
+
/* @__PURE__ */ jsx8("span", { className: "vpg-calc-icon", children: "\u0192" }),
|
|
4446
|
+
/* @__PURE__ */ jsx8("span", { children: "+ Calc" })
|
|
4247
4447
|
] })
|
|
4248
4448
|
] }),
|
|
4249
|
-
/* @__PURE__ */
|
|
4449
|
+
/* @__PURE__ */ jsx8(
|
|
4250
4450
|
CalculatedFieldModal,
|
|
4251
4451
|
{
|
|
4252
4452
|
show: showCalcModal,
|
|
4253
4453
|
availableFields: numericFieldNames,
|
|
4254
4454
|
existingField: editingCalcField,
|
|
4455
|
+
theme,
|
|
4255
4456
|
onClose: handleCloseCalcModal,
|
|
4256
4457
|
onSave: handleSaveCalcField
|
|
4257
4458
|
}
|
|
@@ -4260,9 +4461,9 @@ function PivotConfig({
|
|
|
4260
4461
|
}
|
|
4261
4462
|
|
|
4262
4463
|
// src/components/PivotSkeleton.tsx
|
|
4263
|
-
import { getAggregationLabel as
|
|
4264
|
-
import { useCallback as
|
|
4265
|
-
import { Fragment as
|
|
4464
|
+
import { getAggregationLabel as getAggregationLabel3, getAggregationSymbol as getAggregationSymbol2 } from "@smallwebco/tinypivot-core";
|
|
4465
|
+
import { useCallback as useCallback14, useEffect as useEffect11, useMemo as useMemo14, useState as useState14 } from "react";
|
|
4466
|
+
import { Fragment as Fragment6, jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
4266
4467
|
function PivotSkeleton({
|
|
4267
4468
|
rowFields,
|
|
4268
4469
|
columnFields,
|
|
@@ -4275,6 +4476,8 @@ function PivotSkeleton({
|
|
|
4275
4476
|
activeFilters,
|
|
4276
4477
|
totalRowCount,
|
|
4277
4478
|
filteredRowCount,
|
|
4479
|
+
enableDrillDown,
|
|
4480
|
+
enableDrillThrough,
|
|
4278
4481
|
onAddRowField,
|
|
4279
4482
|
onRemoveRowField,
|
|
4280
4483
|
onAddColumnField,
|
|
@@ -4283,10 +4486,12 @@ function PivotSkeleton({
|
|
|
4283
4486
|
onRemoveValueField,
|
|
4284
4487
|
onReorderRowFields,
|
|
4285
4488
|
onReorderColumnFields,
|
|
4489
|
+
onToggleCollapse,
|
|
4490
|
+
onDrillThroughCell,
|
|
4286
4491
|
theme
|
|
4287
4492
|
}) {
|
|
4288
4493
|
const { showWatermark, canUsePivot, isDemo } = useLicense();
|
|
4289
|
-
const getValueFieldDisplayName =
|
|
4494
|
+
const getValueFieldDisplayName = useCallback14((field) => {
|
|
4290
4495
|
if (field.startsWith("calc:")) {
|
|
4291
4496
|
const calcId = field.replace("calc:", "");
|
|
4292
4497
|
const calcField = calculatedFields?.find((c) => c.id === calcId);
|
|
@@ -4294,15 +4499,15 @@ function PivotSkeleton({
|
|
|
4294
4499
|
}
|
|
4295
4500
|
return field;
|
|
4296
4501
|
}, [calculatedFields]);
|
|
4297
|
-
const isCalculatedField =
|
|
4502
|
+
const isCalculatedField = useCallback14((field) => {
|
|
4298
4503
|
return field.startsWith("calc:");
|
|
4299
4504
|
}, []);
|
|
4300
|
-
const [dragOverArea, setDragOverArea] =
|
|
4301
|
-
const [reorderDragSource, setReorderDragSource] =
|
|
4302
|
-
const [reorderDropTarget, setReorderDropTarget] =
|
|
4303
|
-
const [sortDirection, setSortDirection] =
|
|
4304
|
-
const [sortTarget, setSortTarget] =
|
|
4305
|
-
const toggleSort =
|
|
4505
|
+
const [dragOverArea, setDragOverArea] = useState14(null);
|
|
4506
|
+
const [reorderDragSource, setReorderDragSource] = useState14(null);
|
|
4507
|
+
const [reorderDropTarget, setReorderDropTarget] = useState14(null);
|
|
4508
|
+
const [sortDirection, setSortDirection] = useState14("asc");
|
|
4509
|
+
const [sortTarget, setSortTarget] = useState14("row");
|
|
4510
|
+
const toggleSort = useCallback14((target = "row") => {
|
|
4306
4511
|
if (sortTarget === target) {
|
|
4307
4512
|
setSortDirection((prev) => prev === "asc" ? "desc" : "asc");
|
|
4308
4513
|
} else {
|
|
@@ -4310,13 +4515,13 @@ function PivotSkeleton({
|
|
|
4310
4515
|
setSortDirection("asc");
|
|
4311
4516
|
}
|
|
4312
4517
|
}, [sortTarget]);
|
|
4313
|
-
const [selectedCell, setSelectedCell] =
|
|
4314
|
-
const [selectionStart, setSelectionStart] =
|
|
4315
|
-
const [selectionEnd, setSelectionEnd] =
|
|
4316
|
-
const [isSelecting, setIsSelecting] =
|
|
4317
|
-
const [showCopyToast, setShowCopyToast] =
|
|
4318
|
-
const [copyToastMessage, setCopyToastMessage] =
|
|
4319
|
-
const selectionBounds =
|
|
4518
|
+
const [selectedCell, setSelectedCell] = useState14(null);
|
|
4519
|
+
const [selectionStart, setSelectionStart] = useState14(null);
|
|
4520
|
+
const [selectionEnd, setSelectionEnd] = useState14(null);
|
|
4521
|
+
const [isSelecting, setIsSelecting] = useState14(false);
|
|
4522
|
+
const [showCopyToast, setShowCopyToast] = useState14(false);
|
|
4523
|
+
const [copyToastMessage, setCopyToastMessage] = useState14("");
|
|
4524
|
+
const selectionBounds = useMemo14(() => {
|
|
4320
4525
|
if (!selectionStart || !selectionEnd)
|
|
4321
4526
|
return null;
|
|
4322
4527
|
return {
|
|
@@ -4326,7 +4531,7 @@ function PivotSkeleton({
|
|
|
4326
4531
|
maxCol: Math.max(selectionStart.col, selectionEnd.col)
|
|
4327
4532
|
};
|
|
4328
4533
|
}, [selectionStart, selectionEnd]);
|
|
4329
|
-
const handleCellMouseDown =
|
|
4534
|
+
const handleCellMouseDown = useCallback14(
|
|
4330
4535
|
(rowIndex, colIndex, event) => {
|
|
4331
4536
|
event.preventDefault();
|
|
4332
4537
|
if (event.shiftKey && selectedCell) {
|
|
@@ -4340,7 +4545,7 @@ function PivotSkeleton({
|
|
|
4340
4545
|
},
|
|
4341
4546
|
[selectedCell]
|
|
4342
4547
|
);
|
|
4343
|
-
const handleCellMouseEnter =
|
|
4548
|
+
const handleCellMouseEnter = useCallback14(
|
|
4344
4549
|
(rowIndex, colIndex) => {
|
|
4345
4550
|
if (isSelecting) {
|
|
4346
4551
|
setSelectionEnd({ row: rowIndex, col: colIndex });
|
|
@@ -4348,7 +4553,7 @@ function PivotSkeleton({
|
|
|
4348
4553
|
},
|
|
4349
4554
|
[isSelecting]
|
|
4350
4555
|
);
|
|
4351
|
-
const isCellSelected =
|
|
4556
|
+
const isCellSelected = useCallback14(
|
|
4352
4557
|
(rowIndex, colIndex) => {
|
|
4353
4558
|
if (!selectionBounds) {
|
|
4354
4559
|
return selectedCell?.row === rowIndex && selectedCell?.col === colIndex;
|
|
@@ -4358,12 +4563,12 @@ function PivotSkeleton({
|
|
|
4358
4563
|
},
|
|
4359
4564
|
[selectionBounds, selectedCell]
|
|
4360
4565
|
);
|
|
4361
|
-
|
|
4566
|
+
useEffect11(() => {
|
|
4362
4567
|
const handleMouseUp = () => setIsSelecting(false);
|
|
4363
4568
|
document.addEventListener("mouseup", handleMouseUp);
|
|
4364
4569
|
return () => document.removeEventListener("mouseup", handleMouseUp);
|
|
4365
4570
|
}, []);
|
|
4366
|
-
const sortedRowIndices =
|
|
4571
|
+
const sortedRowIndices = useMemo14(() => {
|
|
4367
4572
|
if (!pivotResult)
|
|
4368
4573
|
return [];
|
|
4369
4574
|
const indices = pivotResult.rowHeaders.map((_, i) => i);
|
|
@@ -4391,7 +4596,7 @@ function PivotSkeleton({
|
|
|
4391
4596
|
});
|
|
4392
4597
|
return indices;
|
|
4393
4598
|
}, [pivotResult, sortTarget, sortDirection]);
|
|
4394
|
-
const copySelectionToClipboard =
|
|
4599
|
+
const copySelectionToClipboard = useCallback14(() => {
|
|
4395
4600
|
if (!selectionBounds || !pivotResult)
|
|
4396
4601
|
return;
|
|
4397
4602
|
const { minRow, maxRow, minCol, maxCol } = selectionBounds;
|
|
@@ -4417,7 +4622,7 @@ function PivotSkeleton({
|
|
|
4417
4622
|
console.error("Copy failed:", err);
|
|
4418
4623
|
});
|
|
4419
4624
|
}, [selectionBounds, pivotResult, sortedRowIndices]);
|
|
4420
|
-
|
|
4625
|
+
useEffect11(() => {
|
|
4421
4626
|
const handleKeydown = (event) => {
|
|
4422
4627
|
if (!selectionBounds)
|
|
4423
4628
|
return;
|
|
@@ -4435,7 +4640,7 @@ function PivotSkeleton({
|
|
|
4435
4640
|
document.addEventListener("keydown", handleKeydown);
|
|
4436
4641
|
return () => document.removeEventListener("keydown", handleKeydown);
|
|
4437
4642
|
}, [selectionBounds, copySelectionToClipboard]);
|
|
4438
|
-
const selectionStats =
|
|
4643
|
+
const selectionStats = useMemo14(() => {
|
|
4439
4644
|
if (!selectionBounds || !pivotResult)
|
|
4440
4645
|
return null;
|
|
4441
4646
|
const { minRow, maxRow, minCol, maxCol } = selectionBounds;
|
|
@@ -4464,18 +4669,18 @@ function PivotSkeleton({
|
|
|
4464
4669
|
avg
|
|
4465
4670
|
};
|
|
4466
4671
|
}, [selectionBounds, pivotResult, sortedRowIndices]);
|
|
4467
|
-
const formatStatValue =
|
|
4672
|
+
const formatStatValue = useCallback14((val) => {
|
|
4468
4673
|
if (Math.abs(val) >= 1e6)
|
|
4469
4674
|
return `${(val / 1e6).toFixed(2)}M`;
|
|
4470
4675
|
if (Math.abs(val) >= 1e3)
|
|
4471
4676
|
return `${(val / 1e3).toFixed(2)}K`;
|
|
4472
4677
|
return val.toFixed(2);
|
|
4473
4678
|
}, []);
|
|
4474
|
-
const columnHeaderCells =
|
|
4679
|
+
const columnHeaderCells = useMemo14(() => {
|
|
4475
4680
|
if (!pivotResult || pivotResult.headers.length === 0) {
|
|
4476
4681
|
return [
|
|
4477
4682
|
valueFields.map((vf) => ({
|
|
4478
|
-
label: `${getValueFieldDisplayName(vf.field)} (${
|
|
4683
|
+
label: `${getValueFieldDisplayName(vf.field)} (${getAggregationLabel3(vf.aggregation)})`,
|
|
4479
4684
|
colspan: 1
|
|
4480
4685
|
}))
|
|
4481
4686
|
];
|
|
@@ -4499,13 +4704,13 @@ function PivotSkeleton({
|
|
|
4499
4704
|
return result;
|
|
4500
4705
|
}, [pivotResult, valueFields]);
|
|
4501
4706
|
const hasActiveFilters = activeFilters && activeFilters.length > 0;
|
|
4502
|
-
const filterSummary =
|
|
4707
|
+
const filterSummary = useMemo14(() => {
|
|
4503
4708
|
if (!activeFilters || activeFilters.length === 0)
|
|
4504
4709
|
return "";
|
|
4505
4710
|
return activeFilters.map((f) => f.column).join(", ");
|
|
4506
4711
|
}, [activeFilters]);
|
|
4507
|
-
const [showFilterTooltip, setShowFilterTooltip] =
|
|
4508
|
-
const filterTooltipDetails =
|
|
4712
|
+
const [showFilterTooltip, setShowFilterTooltip] = useState14(false);
|
|
4713
|
+
const filterTooltipDetails = useMemo14(() => {
|
|
4509
4714
|
if (!activeFilters || activeFilters.length === 0)
|
|
4510
4715
|
return [];
|
|
4511
4716
|
return activeFilters.map((f) => {
|
|
@@ -4530,7 +4735,7 @@ function PivotSkeleton({
|
|
|
4530
4735
|
};
|
|
4531
4736
|
});
|
|
4532
4737
|
}, [activeFilters]);
|
|
4533
|
-
const handleDragOver =
|
|
4738
|
+
const handleDragOver = useCallback14(
|
|
4534
4739
|
(area, event) => {
|
|
4535
4740
|
event.preventDefault();
|
|
4536
4741
|
event.dataTransfer.dropEffect = "move";
|
|
@@ -4538,10 +4743,10 @@ function PivotSkeleton({
|
|
|
4538
4743
|
},
|
|
4539
4744
|
[]
|
|
4540
4745
|
);
|
|
4541
|
-
const handleDragLeave =
|
|
4746
|
+
const handleDragLeave = useCallback14(() => {
|
|
4542
4747
|
setDragOverArea(null);
|
|
4543
4748
|
}, []);
|
|
4544
|
-
const handleDrop =
|
|
4749
|
+
const handleDrop = useCallback14(
|
|
4545
4750
|
(area, event) => {
|
|
4546
4751
|
event.preventDefault();
|
|
4547
4752
|
const field = event.dataTransfer?.getData("text/plain");
|
|
@@ -4571,7 +4776,7 @@ function PivotSkeleton({
|
|
|
4571
4776
|
},
|
|
4572
4777
|
[rowFields, columnFields, valueFields, onAddRowField, onRemoveRowField, onAddColumnField, onRemoveColumnField, onAddValueField, onRemoveValueField]
|
|
4573
4778
|
);
|
|
4574
|
-
const handleChipDragStart =
|
|
4779
|
+
const handleChipDragStart = useCallback14(
|
|
4575
4780
|
(zone, index, event) => {
|
|
4576
4781
|
setReorderDragSource({ zone, index });
|
|
4577
4782
|
event.dataTransfer.effectAllowed = "move";
|
|
@@ -4582,11 +4787,11 @@ function PivotSkeleton({
|
|
|
4582
4787
|
},
|
|
4583
4788
|
[]
|
|
4584
4789
|
);
|
|
4585
|
-
const handleChipDragEnd =
|
|
4790
|
+
const handleChipDragEnd = useCallback14(() => {
|
|
4586
4791
|
setReorderDragSource(null);
|
|
4587
4792
|
setReorderDropTarget(null);
|
|
4588
4793
|
}, []);
|
|
4589
|
-
const handleChipDragOver =
|
|
4794
|
+
const handleChipDragOver = useCallback14(
|
|
4590
4795
|
(zone, index, event) => {
|
|
4591
4796
|
event.preventDefault();
|
|
4592
4797
|
if (reorderDragSource && reorderDragSource.zone === zone) {
|
|
@@ -4596,10 +4801,10 @@ function PivotSkeleton({
|
|
|
4596
4801
|
},
|
|
4597
4802
|
[reorderDragSource]
|
|
4598
4803
|
);
|
|
4599
|
-
const handleChipDragLeave =
|
|
4804
|
+
const handleChipDragLeave = useCallback14(() => {
|
|
4600
4805
|
setReorderDropTarget(null);
|
|
4601
4806
|
}, []);
|
|
4602
|
-
const handleChipDrop =
|
|
4807
|
+
const handleChipDrop = useCallback14(
|
|
4603
4808
|
(zone, targetIndex, event) => {
|
|
4604
4809
|
event.preventDefault();
|
|
4605
4810
|
event.stopPropagation();
|
|
@@ -4625,39 +4830,95 @@ function PivotSkeleton({
|
|
|
4625
4830
|
},
|
|
4626
4831
|
[reorderDragSource, rowFields, columnFields, onReorderRowFields, onReorderColumnFields]
|
|
4627
4832
|
);
|
|
4628
|
-
const isChipDragSource =
|
|
4833
|
+
const isChipDragSource = useCallback14(
|
|
4629
4834
|
(zone, index) => {
|
|
4630
4835
|
return reorderDragSource?.zone === zone && reorderDragSource?.index === index;
|
|
4631
4836
|
},
|
|
4632
4837
|
[reorderDragSource]
|
|
4633
4838
|
);
|
|
4634
|
-
const isChipDropTarget =
|
|
4839
|
+
const isChipDropTarget = useCallback14(
|
|
4635
4840
|
(zone, index) => {
|
|
4636
4841
|
return reorderDropTarget?.zone === zone && reorderDropTarget?.index === index;
|
|
4637
4842
|
},
|
|
4638
4843
|
[reorderDropTarget]
|
|
4639
4844
|
);
|
|
4640
4845
|
const currentFontSize = fontSize;
|
|
4846
|
+
const columnPaths = useMemo14(() => {
|
|
4847
|
+
if (!pivotResult || columnFields.length === 0)
|
|
4848
|
+
return [];
|
|
4849
|
+
const numCols = pivotResult.data[0]?.length ?? 0;
|
|
4850
|
+
const numValueFields = valueFields.length || 1;
|
|
4851
|
+
const paths = [];
|
|
4852
|
+
for (let colIdx = 0; colIdx < numCols; colIdx++) {
|
|
4853
|
+
const colKeyIndex = Math.floor(colIdx / numValueFields);
|
|
4854
|
+
const path = [];
|
|
4855
|
+
for (let h = 0; h < columnFields.length; h++) {
|
|
4856
|
+
const headerRow = pivotResult.headers[h];
|
|
4857
|
+
if (headerRow) {
|
|
4858
|
+
path.push(headerRow[colKeyIndex * numValueFields] ?? "");
|
|
4859
|
+
}
|
|
4860
|
+
}
|
|
4861
|
+
paths.push(path);
|
|
4862
|
+
}
|
|
4863
|
+
return paths;
|
|
4864
|
+
}, [pivotResult, columnFields, valueFields]);
|
|
4865
|
+
const findGroupStart = useCallback14((sortedIdx, idx) => {
|
|
4866
|
+
if (!pivotResult)
|
|
4867
|
+
return null;
|
|
4868
|
+
const meta = pivotResult.rowMeta[sortedIdx];
|
|
4869
|
+
if (!meta)
|
|
4870
|
+
return null;
|
|
4871
|
+
return meta.groupStarts.find((gs) => gs.depth === idx) ?? null;
|
|
4872
|
+
}, [pivotResult]);
|
|
4873
|
+
const handleChevronClick = useCallback14((groupStart, event) => {
|
|
4874
|
+
onToggleCollapse?.(groupStart.key, event.altKey);
|
|
4875
|
+
}, [onToggleCollapse]);
|
|
4876
|
+
const handleDrillThroughCell = useCallback14((sortedIdx, colIdx) => {
|
|
4877
|
+
if (!pivotResult)
|
|
4878
|
+
return;
|
|
4879
|
+
const meta = pivotResult.rowMeta[sortedIdx];
|
|
4880
|
+
const rowPath = meta ? meta.path : [];
|
|
4881
|
+
const colPath = columnPaths[colIdx] ?? [];
|
|
4882
|
+
const numValueFields = valueFields.length || 1;
|
|
4883
|
+
const valueFieldIndex = colIdx % numValueFields;
|
|
4884
|
+
onDrillThroughCell?.({ rowPath, columnPath: colPath, valueFieldIndex });
|
|
4885
|
+
}, [pivotResult, columnPaths, valueFields, onDrillThroughCell]);
|
|
4886
|
+
const handleDrillThroughRowTotal = useCallback14((sortedIdx) => {
|
|
4887
|
+
if (!pivotResult)
|
|
4888
|
+
return;
|
|
4889
|
+
const meta = pivotResult.rowMeta[sortedIdx];
|
|
4890
|
+
const rowPath = meta ? meta.path : [];
|
|
4891
|
+
onDrillThroughCell?.({ rowPath, columnPath: [], valueFieldIndex: 0 });
|
|
4892
|
+
}, [pivotResult, onDrillThroughCell]);
|
|
4893
|
+
const handleDrillThroughColTotal = useCallback14((colIdx) => {
|
|
4894
|
+
const colPath = columnPaths[colIdx] ?? [];
|
|
4895
|
+
const numValueFields = valueFields.length || 1;
|
|
4896
|
+
const valueFieldIndex = colIdx % numValueFields;
|
|
4897
|
+
onDrillThroughCell?.({ rowPath: [], columnPath: colPath, valueFieldIndex });
|
|
4898
|
+
}, [columnPaths, valueFields, onDrillThroughCell]);
|
|
4899
|
+
const handleDrillThroughGrandTotal = useCallback14(() => {
|
|
4900
|
+
onDrillThroughCell?.({ rowPath: [], columnPath: [], valueFieldIndex: 0 });
|
|
4901
|
+
}, [onDrillThroughCell]);
|
|
4641
4902
|
const rowHeaderWidth = 180;
|
|
4642
|
-
const rowHeaderColWidth =
|
|
4903
|
+
const rowHeaderColWidth = useMemo14(() => {
|
|
4643
4904
|
const numCols = Math.max(rowFields.length, 1);
|
|
4644
4905
|
return Math.max(rowHeaderWidth / numCols, 80);
|
|
4645
4906
|
}, [rowFields.length]);
|
|
4646
|
-
const getRowHeaderLeftOffset =
|
|
4907
|
+
const getRowHeaderLeftOffset = useCallback14((fieldIdx) => {
|
|
4647
4908
|
return fieldIdx * rowHeaderColWidth;
|
|
4648
4909
|
}, [rowHeaderColWidth]);
|
|
4649
|
-
return /* @__PURE__ */
|
|
4910
|
+
return /* @__PURE__ */ jsxs9(
|
|
4650
4911
|
"div",
|
|
4651
4912
|
{
|
|
4652
4913
|
className: `vpg-pivot-skeleton vpg-font-${currentFontSize} ${theme ? `vpg-theme-${theme}` : ""} ${draggingField ? "vpg-is-dragging" : ""}`,
|
|
4653
4914
|
children: [
|
|
4654
|
-
showCopyToast && /* @__PURE__ */
|
|
4655
|
-
/* @__PURE__ */
|
|
4915
|
+
showCopyToast && /* @__PURE__ */ jsxs9("div", { className: "vpg-toast", children: [
|
|
4916
|
+
/* @__PURE__ */ jsx9("svg", { className: "vpg-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx9("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }),
|
|
4656
4917
|
copyToastMessage
|
|
4657
4918
|
] }),
|
|
4658
|
-
/* @__PURE__ */
|
|
4659
|
-
/* @__PURE__ */
|
|
4660
|
-
/* @__PURE__ */
|
|
4919
|
+
/* @__PURE__ */ jsxs9("div", { className: "vpg-skeleton-header", children: [
|
|
4920
|
+
/* @__PURE__ */ jsxs9("div", { className: "vpg-skeleton-title", children: [
|
|
4921
|
+
/* @__PURE__ */ jsx9("svg", { className: "vpg-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx9(
|
|
4661
4922
|
"path",
|
|
4662
4923
|
{
|
|
4663
4924
|
strokeLinecap: "round",
|
|
@@ -4666,24 +4927,24 @@ function PivotSkeleton({
|
|
|
4666
4927
|
d: "M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"
|
|
4667
4928
|
}
|
|
4668
4929
|
) }),
|
|
4669
|
-
/* @__PURE__ */
|
|
4930
|
+
/* @__PURE__ */ jsx9("span", { children: "Pivot Table" })
|
|
4670
4931
|
] }),
|
|
4671
|
-
/* @__PURE__ */
|
|
4672
|
-
hasActiveFilters && /* @__PURE__ */
|
|
4932
|
+
/* @__PURE__ */ jsxs9("div", { className: "vpg-header-right", children: [
|
|
4933
|
+
hasActiveFilters && /* @__PURE__ */ jsxs9(
|
|
4673
4934
|
"div",
|
|
4674
4935
|
{
|
|
4675
4936
|
className: "vpg-filter-indicator",
|
|
4676
4937
|
onMouseEnter: () => setShowFilterTooltip(true),
|
|
4677
4938
|
onMouseLeave: () => setShowFilterTooltip(false),
|
|
4678
4939
|
children: [
|
|
4679
|
-
/* @__PURE__ */
|
|
4940
|
+
/* @__PURE__ */ jsx9(
|
|
4680
4941
|
"svg",
|
|
4681
4942
|
{
|
|
4682
4943
|
className: "vpg-filter-icon",
|
|
4683
4944
|
fill: "none",
|
|
4684
4945
|
stroke: "currentColor",
|
|
4685
4946
|
viewBox: "0 0 24 24",
|
|
4686
|
-
children: /* @__PURE__ */
|
|
4947
|
+
children: /* @__PURE__ */ jsx9(
|
|
4687
4948
|
"path",
|
|
4688
4949
|
{
|
|
4689
4950
|
strokeLinecap: "round",
|
|
@@ -4694,11 +4955,11 @@ function PivotSkeleton({
|
|
|
4694
4955
|
)
|
|
4695
4956
|
}
|
|
4696
4957
|
),
|
|
4697
|
-
/* @__PURE__ */
|
|
4958
|
+
/* @__PURE__ */ jsxs9("span", { className: "vpg-filter-text", children: [
|
|
4698
4959
|
"Filtered:",
|
|
4699
4960
|
" ",
|
|
4700
|
-
/* @__PURE__ */
|
|
4701
|
-
filteredRowCount !== void 0 && totalRowCount !== void 0 && /* @__PURE__ */
|
|
4961
|
+
/* @__PURE__ */ jsx9("strong", { children: filterSummary }),
|
|
4962
|
+
filteredRowCount !== void 0 && totalRowCount !== void 0 && /* @__PURE__ */ jsxs9("span", { className: "vpg-filter-count", children: [
|
|
4702
4963
|
"(",
|
|
4703
4964
|
filteredRowCount.toLocaleString(),
|
|
4704
4965
|
" ",
|
|
@@ -4709,13 +4970,13 @@ function PivotSkeleton({
|
|
|
4709
4970
|
"rows)"
|
|
4710
4971
|
] })
|
|
4711
4972
|
] }),
|
|
4712
|
-
showFilterTooltip && /* @__PURE__ */
|
|
4713
|
-
/* @__PURE__ */
|
|
4714
|
-
filterTooltipDetails.map((filter) => /* @__PURE__ */
|
|
4715
|
-
/* @__PURE__ */
|
|
4716
|
-
/* @__PURE__ */
|
|
4717
|
-
filter.values.map((val, idx) => /* @__PURE__ */
|
|
4718
|
-
filter.remaining > 0 && /* @__PURE__ */
|
|
4973
|
+
showFilterTooltip && /* @__PURE__ */ jsxs9("div", { className: "vpg-filter-tooltip", children: [
|
|
4974
|
+
/* @__PURE__ */ jsx9("div", { className: "vpg-tooltip-header", children: "Active Filters" }),
|
|
4975
|
+
filterTooltipDetails.map((filter) => /* @__PURE__ */ jsxs9("div", { className: "vpg-tooltip-filter", children: [
|
|
4976
|
+
/* @__PURE__ */ jsx9("div", { className: "vpg-tooltip-column", children: filter.column }),
|
|
4977
|
+
/* @__PURE__ */ jsx9("div", { className: "vpg-tooltip-values", children: filter.isRange ? /* @__PURE__ */ jsx9("span", { className: "vpg-tooltip-value vpg-range-value", children: filter.displayText }) : /* @__PURE__ */ jsxs9(Fragment6, { children: [
|
|
4978
|
+
filter.values.map((val, idx) => /* @__PURE__ */ jsx9("span", { className: "vpg-tooltip-value", children: val }, idx)),
|
|
4979
|
+
filter.remaining > 0 && /* @__PURE__ */ jsxs9("span", { className: "vpg-tooltip-more", children: [
|
|
4719
4980
|
"+",
|
|
4720
4981
|
filter.remaining,
|
|
4721
4982
|
" ",
|
|
@@ -4723,7 +4984,7 @@ function PivotSkeleton({
|
|
|
4723
4984
|
] })
|
|
4724
4985
|
] }) })
|
|
4725
4986
|
] }, filter.column)),
|
|
4726
|
-
filteredRowCount !== void 0 && totalRowCount !== void 0 && /* @__PURE__ */
|
|
4987
|
+
filteredRowCount !== void 0 && totalRowCount !== void 0 && /* @__PURE__ */ jsxs9("div", { className: "vpg-tooltip-summary", children: [
|
|
4727
4988
|
"Showing",
|
|
4728
4989
|
" ",
|
|
4729
4990
|
filteredRowCount.toLocaleString(),
|
|
@@ -4738,20 +4999,20 @@ function PivotSkeleton({
|
|
|
4738
4999
|
]
|
|
4739
5000
|
}
|
|
4740
5001
|
),
|
|
4741
|
-
isConfigured && /* @__PURE__ */
|
|
4742
|
-
/* @__PURE__ */
|
|
5002
|
+
isConfigured && /* @__PURE__ */ jsxs9("div", { className: "vpg-config-summary", children: [
|
|
5003
|
+
/* @__PURE__ */ jsxs9("span", { className: "vpg-summary-badge vpg-rows", children: [
|
|
4743
5004
|
rowFields.length,
|
|
4744
5005
|
" ",
|
|
4745
5006
|
"row",
|
|
4746
5007
|
rowFields.length !== 1 ? "s" : ""
|
|
4747
5008
|
] }),
|
|
4748
|
-
/* @__PURE__ */
|
|
5009
|
+
/* @__PURE__ */ jsxs9("span", { className: "vpg-summary-badge vpg-cols", children: [
|
|
4749
5010
|
columnFields.length,
|
|
4750
5011
|
" ",
|
|
4751
5012
|
"col",
|
|
4752
5013
|
columnFields.length !== 1 ? "s" : ""
|
|
4753
5014
|
] }),
|
|
4754
|
-
/* @__PURE__ */
|
|
5015
|
+
/* @__PURE__ */ jsxs9("span", { className: "vpg-summary-badge vpg-vals", children: [
|
|
4755
5016
|
valueFields.length,
|
|
4756
5017
|
" ",
|
|
4757
5018
|
"val",
|
|
@@ -4760,8 +5021,8 @@ function PivotSkeleton({
|
|
|
4760
5021
|
] })
|
|
4761
5022
|
] })
|
|
4762
5023
|
] }),
|
|
4763
|
-
!canUsePivot ? /* @__PURE__ */
|
|
4764
|
-
/* @__PURE__ */
|
|
5024
|
+
!canUsePivot ? /* @__PURE__ */ jsx9("div", { className: "vpg-pro-required", children: /* @__PURE__ */ jsxs9("div", { className: "vpg-pro-content", children: [
|
|
5025
|
+
/* @__PURE__ */ jsx9("svg", { className: "vpg-pro-icon", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsx9(
|
|
4765
5026
|
"path",
|
|
4766
5027
|
{
|
|
4767
5028
|
strokeLinecap: "round",
|
|
@@ -4770,11 +5031,11 @@ function PivotSkeleton({
|
|
|
4770
5031
|
d: "M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"
|
|
4771
5032
|
}
|
|
4772
5033
|
) }),
|
|
4773
|
-
/* @__PURE__ */
|
|
4774
|
-
/* @__PURE__ */
|
|
4775
|
-
] }) }) : /* @__PURE__ */
|
|
4776
|
-
/* @__PURE__ */
|
|
4777
|
-
/* @__PURE__ */
|
|
5034
|
+
/* @__PURE__ */ jsx9("h3", { children: "Pivot Unavailable" }),
|
|
5035
|
+
/* @__PURE__ */ jsx9("p", { children: "Pivot mode could not be enabled in this session. Try reloading the page." })
|
|
5036
|
+
] }) }) : /* @__PURE__ */ jsxs9(Fragment6, { children: [
|
|
5037
|
+
/* @__PURE__ */ jsxs9("div", { className: "vpg-config-bar", children: [
|
|
5038
|
+
/* @__PURE__ */ jsxs9(
|
|
4778
5039
|
"div",
|
|
4779
5040
|
{
|
|
4780
5041
|
className: `vpg-drop-zone vpg-row-zone ${dragOverArea === "row" ? "vpg-drag-over" : ""}`,
|
|
@@ -4782,12 +5043,12 @@ function PivotSkeleton({
|
|
|
4782
5043
|
onDragLeave: handleDragLeave,
|
|
4783
5044
|
onDrop: (e) => handleDrop("row", e),
|
|
4784
5045
|
children: [
|
|
4785
|
-
/* @__PURE__ */
|
|
4786
|
-
/* @__PURE__ */
|
|
4787
|
-
/* @__PURE__ */
|
|
5046
|
+
/* @__PURE__ */ jsxs9("div", { className: "vpg-zone-header", children: [
|
|
5047
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-zone-icon vpg-row-icon", children: "\u2193" }),
|
|
5048
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-zone-label", children: "Rows" })
|
|
4788
5049
|
] }),
|
|
4789
|
-
/* @__PURE__ */
|
|
4790
|
-
rowFields.map((field, idx) => /* @__PURE__ */
|
|
5050
|
+
/* @__PURE__ */ jsxs9("div", { className: "vpg-zone-chips", children: [
|
|
5051
|
+
rowFields.map((field, idx) => /* @__PURE__ */ jsxs9(
|
|
4791
5052
|
"div",
|
|
4792
5053
|
{
|
|
4793
5054
|
className: `vpg-mini-chip vpg-row-chip ${isChipDragSource("row", idx) ? "vpg-chip-dragging" : ""} ${isChipDropTarget("row", idx) ? "vpg-chip-drop-target" : ""}`,
|
|
@@ -4798,9 +5059,9 @@ function PivotSkeleton({
|
|
|
4798
5059
|
onDragLeave: handleChipDragLeave,
|
|
4799
5060
|
onDrop: (e) => handleChipDrop("row", idx, e),
|
|
4800
5061
|
children: [
|
|
4801
|
-
/* @__PURE__ */
|
|
4802
|
-
/* @__PURE__ */
|
|
4803
|
-
/* @__PURE__ */
|
|
5062
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-drag-handle", children: "\u22EE\u22EE" }),
|
|
5063
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-mini-name", children: field }),
|
|
5064
|
+
/* @__PURE__ */ jsx9(
|
|
4804
5065
|
"button",
|
|
4805
5066
|
{
|
|
4806
5067
|
className: "vpg-mini-remove",
|
|
@@ -4815,12 +5076,12 @@ function PivotSkeleton({
|
|
|
4815
5076
|
},
|
|
4816
5077
|
field
|
|
4817
5078
|
)),
|
|
4818
|
-
rowFields.length === 0 && /* @__PURE__ */
|
|
5079
|
+
rowFields.length === 0 && /* @__PURE__ */ jsx9("span", { className: "vpg-zone-hint", children: "Drop here" })
|
|
4819
5080
|
] })
|
|
4820
5081
|
]
|
|
4821
5082
|
}
|
|
4822
5083
|
),
|
|
4823
|
-
/* @__PURE__ */
|
|
5084
|
+
/* @__PURE__ */ jsxs9(
|
|
4824
5085
|
"div",
|
|
4825
5086
|
{
|
|
4826
5087
|
className: `vpg-drop-zone vpg-column-zone ${dragOverArea === "column" ? "vpg-drag-over" : ""}`,
|
|
@@ -4828,12 +5089,12 @@ function PivotSkeleton({
|
|
|
4828
5089
|
onDragLeave: handleDragLeave,
|
|
4829
5090
|
onDrop: (e) => handleDrop("column", e),
|
|
4830
5091
|
children: [
|
|
4831
|
-
/* @__PURE__ */
|
|
4832
|
-
/* @__PURE__ */
|
|
4833
|
-
/* @__PURE__ */
|
|
5092
|
+
/* @__PURE__ */ jsxs9("div", { className: "vpg-zone-header", children: [
|
|
5093
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-zone-icon vpg-column-icon", children: "\u2192" }),
|
|
5094
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-zone-label", children: "Columns" })
|
|
4834
5095
|
] }),
|
|
4835
|
-
/* @__PURE__ */
|
|
4836
|
-
columnFields.map((field, idx) => /* @__PURE__ */
|
|
5096
|
+
/* @__PURE__ */ jsxs9("div", { className: "vpg-zone-chips", children: [
|
|
5097
|
+
columnFields.map((field, idx) => /* @__PURE__ */ jsxs9(
|
|
4837
5098
|
"div",
|
|
4838
5099
|
{
|
|
4839
5100
|
className: `vpg-mini-chip vpg-column-chip ${isChipDragSource("column", idx) ? "vpg-chip-dragging" : ""} ${isChipDropTarget("column", idx) ? "vpg-chip-drop-target" : ""}`,
|
|
@@ -4844,9 +5105,9 @@ function PivotSkeleton({
|
|
|
4844
5105
|
onDragLeave: handleChipDragLeave,
|
|
4845
5106
|
onDrop: (e) => handleChipDrop("column", idx, e),
|
|
4846
5107
|
children: [
|
|
4847
|
-
/* @__PURE__ */
|
|
4848
|
-
/* @__PURE__ */
|
|
4849
|
-
/* @__PURE__ */
|
|
5108
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-drag-handle", children: "\u22EE\u22EE" }),
|
|
5109
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-mini-name", children: field }),
|
|
5110
|
+
/* @__PURE__ */ jsx9(
|
|
4850
5111
|
"button",
|
|
4851
5112
|
{
|
|
4852
5113
|
className: "vpg-mini-remove",
|
|
@@ -4861,12 +5122,12 @@ function PivotSkeleton({
|
|
|
4861
5122
|
},
|
|
4862
5123
|
field
|
|
4863
5124
|
)),
|
|
4864
|
-
columnFields.length === 0 && /* @__PURE__ */
|
|
5125
|
+
columnFields.length === 0 && /* @__PURE__ */ jsx9("span", { className: "vpg-zone-hint", children: "Drop here" })
|
|
4865
5126
|
] })
|
|
4866
5127
|
]
|
|
4867
5128
|
}
|
|
4868
5129
|
),
|
|
4869
|
-
/* @__PURE__ */
|
|
5130
|
+
/* @__PURE__ */ jsxs9(
|
|
4870
5131
|
"div",
|
|
4871
5132
|
{
|
|
4872
5133
|
className: `vpg-drop-zone vpg-value-zone ${dragOverArea === "value" ? "vpg-drag-over" : ""}`,
|
|
@@ -4874,19 +5135,19 @@ function PivotSkeleton({
|
|
|
4874
5135
|
onDragLeave: handleDragLeave,
|
|
4875
5136
|
onDrop: (e) => handleDrop("value", e),
|
|
4876
5137
|
children: [
|
|
4877
|
-
/* @__PURE__ */
|
|
4878
|
-
/* @__PURE__ */
|
|
4879
|
-
/* @__PURE__ */
|
|
5138
|
+
/* @__PURE__ */ jsxs9("div", { className: "vpg-zone-header", children: [
|
|
5139
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-zone-icon vpg-value-icon", children: "\u03A3" }),
|
|
5140
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-zone-label", children: "Values" })
|
|
4880
5141
|
] }),
|
|
4881
|
-
/* @__PURE__ */
|
|
4882
|
-
valueFields.map((vf) => /* @__PURE__ */
|
|
5142
|
+
/* @__PURE__ */ jsxs9("div", { className: "vpg-zone-chips", children: [
|
|
5143
|
+
valueFields.map((vf) => /* @__PURE__ */ jsxs9(
|
|
4883
5144
|
"div",
|
|
4884
5145
|
{
|
|
4885
5146
|
className: `vpg-mini-chip vpg-value-chip${isCalculatedField(vf.field) ? " vpg-calc-chip" : ""}`,
|
|
4886
5147
|
children: [
|
|
4887
|
-
/* @__PURE__ */
|
|
4888
|
-
/* @__PURE__ */
|
|
4889
|
-
/* @__PURE__ */
|
|
5148
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-agg-symbol", children: isCalculatedField(vf.field) ? "\u0192" : getAggregationSymbol2(vf.aggregation) }),
|
|
5149
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-mini-name", children: getValueFieldDisplayName(vf.field) }),
|
|
5150
|
+
/* @__PURE__ */ jsx9(
|
|
4890
5151
|
"button",
|
|
4891
5152
|
{
|
|
4892
5153
|
className: "vpg-mini-remove",
|
|
@@ -4898,21 +5159,21 @@ function PivotSkeleton({
|
|
|
4898
5159
|
},
|
|
4899
5160
|
`${vf.field}-${vf.aggregation}`
|
|
4900
5161
|
)),
|
|
4901
|
-
valueFields.length === 0 && /* @__PURE__ */
|
|
5162
|
+
valueFields.length === 0 && /* @__PURE__ */ jsx9("span", { className: "vpg-zone-hint", children: "Drop numeric" })
|
|
4902
5163
|
] })
|
|
4903
5164
|
]
|
|
4904
5165
|
}
|
|
4905
5166
|
)
|
|
4906
5167
|
] }),
|
|
4907
|
-
(!isConfigured || !pivotResult) && /* @__PURE__ */
|
|
4908
|
-
/* @__PURE__ */
|
|
5168
|
+
(!isConfigured || !pivotResult) && /* @__PURE__ */ jsx9("div", { className: "vpg-placeholder", children: /* @__PURE__ */ jsxs9("div", { className: "vpg-placeholder-content", children: [
|
|
5169
|
+
/* @__PURE__ */ jsx9(
|
|
4909
5170
|
"svg",
|
|
4910
5171
|
{
|
|
4911
5172
|
className: "vpg-placeholder-icon",
|
|
4912
5173
|
fill: "none",
|
|
4913
5174
|
viewBox: "0 0 24 24",
|
|
4914
5175
|
stroke: "currentColor",
|
|
4915
|
-
children: /* @__PURE__ */
|
|
5176
|
+
children: /* @__PURE__ */ jsx9(
|
|
4916
5177
|
"path",
|
|
4917
5178
|
{
|
|
4918
5179
|
strokeLinecap: "round",
|
|
@@ -4923,83 +5184,111 @@ function PivotSkeleton({
|
|
|
4923
5184
|
)
|
|
4924
5185
|
}
|
|
4925
5186
|
),
|
|
4926
|
-
/* @__PURE__ */
|
|
5187
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-placeholder-text", children: valueFields.length === 0 ? /* @__PURE__ */ jsxs9(Fragment6, { children: [
|
|
4927
5188
|
"Add a",
|
|
4928
5189
|
" ",
|
|
4929
|
-
/* @__PURE__ */
|
|
5190
|
+
/* @__PURE__ */ jsx9("strong", { children: "Values" }),
|
|
4930
5191
|
" ",
|
|
4931
5192
|
"field to see your pivot table"
|
|
4932
|
-
] }) : rowFields.length === 0 && columnFields.length === 0 ? /* @__PURE__ */
|
|
5193
|
+
] }) : rowFields.length === 0 && columnFields.length === 0 ? /* @__PURE__ */ jsxs9(Fragment6, { children: [
|
|
4933
5194
|
"Add",
|
|
4934
5195
|
" ",
|
|
4935
|
-
/* @__PURE__ */
|
|
5196
|
+
/* @__PURE__ */ jsx9("strong", { children: "Row" }),
|
|
4936
5197
|
" ",
|
|
4937
5198
|
"or",
|
|
4938
5199
|
" ",
|
|
4939
|
-
/* @__PURE__ */
|
|
5200
|
+
/* @__PURE__ */ jsx9("strong", { children: "Column" }),
|
|
4940
5201
|
" ",
|
|
4941
5202
|
"fields to group your data"
|
|
4942
5203
|
] }) : "Your pivot table will appear here" })
|
|
4943
5204
|
] }) }),
|
|
4944
|
-
isConfigured && pivotResult && /* @__PURE__ */
|
|
4945
|
-
/* @__PURE__ */
|
|
4946
|
-
levelIdx === 0 && (rowFields.length > 0 ? rowFields : ["Rows"]).map((field, fieldIdx) => /* @__PURE__ */
|
|
5205
|
+
isConfigured && pivotResult && /* @__PURE__ */ jsx9("div", { className: "vpg-table-container", children: /* @__PURE__ */ jsxs9("table", { className: "vpg-pivot-table", children: [
|
|
5206
|
+
/* @__PURE__ */ jsx9("thead", { children: columnHeaderCells.map((headerRow, levelIdx) => /* @__PURE__ */ jsxs9("tr", { className: "vpg-column-header-row", children: [
|
|
5207
|
+
levelIdx === 0 && (rowFields.length > 0 ? rowFields : ["Rows"]).map((field, fieldIdx) => /* @__PURE__ */ jsx9(
|
|
4947
5208
|
"th",
|
|
4948
5209
|
{
|
|
4949
5210
|
className: "vpg-row-header-label",
|
|
4950
5211
|
rowSpan: columnHeaderCells.length,
|
|
4951
5212
|
style: { width: `${rowHeaderColWidth}px`, minWidth: "80px", left: `${getRowHeaderLeftOffset(fieldIdx)}px` },
|
|
4952
5213
|
onClick: () => toggleSort("row"),
|
|
4953
|
-
children: /* @__PURE__ */
|
|
4954
|
-
/* @__PURE__ */
|
|
4955
|
-
(fieldIdx === rowFields.length - 1 || rowFields.length === 0) && /* @__PURE__ */
|
|
5214
|
+
children: /* @__PURE__ */ jsxs9("div", { className: "vpg-header-content", children: [
|
|
5215
|
+
/* @__PURE__ */ jsx9("span", { children: field }),
|
|
5216
|
+
(fieldIdx === rowFields.length - 1 || rowFields.length === 0) && /* @__PURE__ */ jsx9("span", { className: `vpg-sort-indicator ${sortTarget === "row" ? "active" : ""}`, children: sortTarget === "row" ? sortDirection === "asc" ? "\u2191" : "\u2193" : "\u21C5" })
|
|
4956
5217
|
] })
|
|
4957
5218
|
},
|
|
4958
5219
|
`row-header-${fieldIdx}`
|
|
4959
5220
|
)),
|
|
4960
|
-
headerRow.map((cell, idx) => /* @__PURE__ */
|
|
5221
|
+
headerRow.map((cell, idx) => /* @__PURE__ */ jsx9(
|
|
4961
5222
|
"th",
|
|
4962
5223
|
{
|
|
4963
5224
|
className: "vpg-column-header-cell",
|
|
4964
5225
|
colSpan: cell.colspan,
|
|
4965
5226
|
onClick: () => levelIdx === columnHeaderCells.length - 1 && toggleSort(idx),
|
|
4966
|
-
children: /* @__PURE__ */
|
|
4967
|
-
/* @__PURE__ */
|
|
4968
|
-
levelIdx === columnHeaderCells.length - 1 && /* @__PURE__ */
|
|
5227
|
+
children: /* @__PURE__ */ jsxs9("div", { className: "vpg-header-content", children: [
|
|
5228
|
+
/* @__PURE__ */ jsx9("span", { children: cell.label }),
|
|
5229
|
+
levelIdx === columnHeaderCells.length - 1 && /* @__PURE__ */ jsx9("span", { className: `vpg-sort-indicator ${sortTarget === idx ? "active" : ""}`, children: sortTarget === idx ? sortDirection === "asc" ? "\u2191" : "\u2193" : "\u21C5" })
|
|
4969
5230
|
] })
|
|
4970
5231
|
},
|
|
4971
5232
|
idx
|
|
4972
5233
|
)),
|
|
4973
|
-
pivotResult.rowTotals.length > 0 && levelIdx === 0 && /* @__PURE__ */
|
|
5234
|
+
pivotResult.rowTotals.length > 0 && levelIdx === 0 && /* @__PURE__ */ jsx9("th", { className: "vpg-total-header", rowSpan: columnHeaderCells.length, children: "Total" })
|
|
4974
5235
|
] }, `header-${levelIdx}`)) }),
|
|
4975
|
-
/* @__PURE__ */
|
|
4976
|
-
sortedRowIndices.map((sortedIdx) => /* @__PURE__ */
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
{
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5236
|
+
/* @__PURE__ */ jsxs9("tbody", { children: [
|
|
5237
|
+
sortedRowIndices.map((sortedIdx) => /* @__PURE__ */ jsxs9(
|
|
5238
|
+
"tr",
|
|
5239
|
+
{
|
|
5240
|
+
className: `vpg-data-row${pivotResult.rowMeta[sortedIdx]?.isSubtotal ? " vpg-subtotal-row" : ""}`,
|
|
5241
|
+
children: [
|
|
5242
|
+
pivotResult.rowHeaders[sortedIdx].map((val, idx) => {
|
|
5243
|
+
const groupStart = findGroupStart(sortedIdx, idx);
|
|
5244
|
+
return /* @__PURE__ */ jsxs9(
|
|
5245
|
+
"th",
|
|
5246
|
+
{
|
|
5247
|
+
className: "vpg-row-header-cell",
|
|
5248
|
+
style: { width: `${rowHeaderColWidth}px`, minWidth: "80px", left: `${getRowHeaderLeftOffset(idx)}px` },
|
|
5249
|
+
children: [
|
|
5250
|
+
enableDrillDown !== false && groupStart && /* @__PURE__ */ jsx9(
|
|
5251
|
+
"span",
|
|
5252
|
+
{
|
|
5253
|
+
className: "vpg-collapse-toggle",
|
|
5254
|
+
onClick: (e) => handleChevronClick(groupStart, e),
|
|
5255
|
+
children: groupStart.isCollapsed ? "\u25B8" : "\u25BE"
|
|
5256
|
+
}
|
|
5257
|
+
),
|
|
5258
|
+
val
|
|
5259
|
+
]
|
|
5260
|
+
},
|
|
5261
|
+
`row-${sortedIdx}-${idx}`
|
|
5262
|
+
);
|
|
5263
|
+
}),
|
|
5264
|
+
pivotResult.data[sortedIdx].map((cell, colIdx) => {
|
|
5265
|
+
const displayRowIdx = sortedRowIndices.indexOf(sortedIdx);
|
|
5266
|
+
return /* @__PURE__ */ jsx9(
|
|
5267
|
+
"td",
|
|
5268
|
+
{
|
|
5269
|
+
className: `vpg-data-cell ${isCellSelected(displayRowIdx, colIdx) ? "selected" : ""} ${cell.value === null ? "vpg-is-null" : ""}`,
|
|
5270
|
+
onMouseDown: (e) => handleCellMouseDown(displayRowIdx, colIdx, e),
|
|
5271
|
+
onMouseEnter: () => handleCellMouseEnter(displayRowIdx, colIdx),
|
|
5272
|
+
onDoubleClick: enableDrillThrough !== false ? () => handleDrillThroughCell(sortedIdx, colIdx) : void 0,
|
|
5273
|
+
children: cell.formattedValue
|
|
5274
|
+
},
|
|
5275
|
+
colIdx
|
|
5276
|
+
);
|
|
5277
|
+
}),
|
|
5278
|
+
pivotResult.rowTotals[sortedIdx] && /* @__PURE__ */ jsx9(
|
|
5279
|
+
"td",
|
|
5280
|
+
{
|
|
5281
|
+
className: "vpg-data-cell vpg-total-cell",
|
|
5282
|
+
onDoubleClick: enableDrillThrough !== false ? () => handleDrillThroughRowTotal(sortedIdx) : void 0,
|
|
5283
|
+
children: pivotResult.rowTotals[sortedIdx].formattedValue
|
|
5284
|
+
}
|
|
5285
|
+
)
|
|
5286
|
+
]
|
|
5287
|
+
},
|
|
5288
|
+
sortedIdx
|
|
5289
|
+
)),
|
|
5290
|
+
pivotResult.columnTotals.length > 0 && /* @__PURE__ */ jsxs9("tr", { className: "vpg-totals-row", children: [
|
|
5291
|
+
/* @__PURE__ */ jsx9(
|
|
5003
5292
|
"th",
|
|
5004
5293
|
{
|
|
5005
5294
|
className: "vpg-row-header-cell vpg-total-label",
|
|
@@ -5008,13 +5297,28 @@ function PivotSkeleton({
|
|
|
5008
5297
|
children: "Total"
|
|
5009
5298
|
}
|
|
5010
5299
|
),
|
|
5011
|
-
pivotResult.columnTotals.map((cell, colIdx) => /* @__PURE__ */
|
|
5012
|
-
|
|
5300
|
+
pivotResult.columnTotals.map((cell, colIdx) => /* @__PURE__ */ jsx9(
|
|
5301
|
+
"td",
|
|
5302
|
+
{
|
|
5303
|
+
className: "vpg-data-cell vpg-total-cell",
|
|
5304
|
+
onDoubleClick: enableDrillThrough !== false ? () => handleDrillThroughColTotal(colIdx) : void 0,
|
|
5305
|
+
children: cell.formattedValue
|
|
5306
|
+
},
|
|
5307
|
+
colIdx
|
|
5308
|
+
)),
|
|
5309
|
+
pivotResult.rowTotals.length > 0 && /* @__PURE__ */ jsx9(
|
|
5310
|
+
"td",
|
|
5311
|
+
{
|
|
5312
|
+
className: "vpg-data-cell vpg-grand-total-cell",
|
|
5313
|
+
onDoubleClick: enableDrillThrough !== false ? () => handleDrillThroughGrandTotal() : void 0,
|
|
5314
|
+
children: pivotResult.grandTotal.formattedValue
|
|
5315
|
+
}
|
|
5316
|
+
)
|
|
5013
5317
|
] })
|
|
5014
5318
|
] })
|
|
5015
5319
|
] }) }),
|
|
5016
|
-
isConfigured && pivotResult && /* @__PURE__ */
|
|
5017
|
-
/* @__PURE__ */
|
|
5320
|
+
isConfigured && pivotResult && /* @__PURE__ */ jsxs9("div", { className: "vpg-skeleton-footer", children: [
|
|
5321
|
+
/* @__PURE__ */ jsxs9("span", { className: "vpg-footer-info", children: [
|
|
5018
5322
|
pivotResult.rowHeaders.length,
|
|
5019
5323
|
" ",
|
|
5020
5324
|
"rows \xD7",
|
|
@@ -5022,30 +5326,30 @@ function PivotSkeleton({
|
|
|
5022
5326
|
" ",
|
|
5023
5327
|
"columns"
|
|
5024
5328
|
] }),
|
|
5025
|
-
selectionStats && selectionStats.count > 1 && /* @__PURE__ */
|
|
5026
|
-
/* @__PURE__ */
|
|
5027
|
-
/* @__PURE__ */
|
|
5028
|
-
/* @__PURE__ */
|
|
5329
|
+
selectionStats && selectionStats.count > 1 && /* @__PURE__ */ jsxs9("div", { className: "vpg-selection-stats", children: [
|
|
5330
|
+
/* @__PURE__ */ jsxs9("span", { className: "vpg-stat", children: [
|
|
5331
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-stat-label", children: "Count:" }),
|
|
5332
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-stat-value", children: selectionStats.count })
|
|
5029
5333
|
] }),
|
|
5030
|
-
selectionStats.numericCount > 0 && /* @__PURE__ */
|
|
5031
|
-
/* @__PURE__ */
|
|
5032
|
-
/* @__PURE__ */
|
|
5033
|
-
/* @__PURE__ */
|
|
5034
|
-
/* @__PURE__ */
|
|
5334
|
+
selectionStats.numericCount > 0 && /* @__PURE__ */ jsxs9(Fragment6, { children: [
|
|
5335
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-stat-divider", children: "|" }),
|
|
5336
|
+
/* @__PURE__ */ jsxs9("span", { className: "vpg-stat", children: [
|
|
5337
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-stat-label", children: "Sum:" }),
|
|
5338
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-stat-value", children: formatStatValue(selectionStats.sum) })
|
|
5035
5339
|
] }),
|
|
5036
|
-
/* @__PURE__ */
|
|
5037
|
-
/* @__PURE__ */
|
|
5038
|
-
/* @__PURE__ */
|
|
5039
|
-
/* @__PURE__ */
|
|
5340
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-stat-divider", children: "|" }),
|
|
5341
|
+
/* @__PURE__ */ jsxs9("span", { className: "vpg-stat", children: [
|
|
5342
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-stat-label", children: "Avg:" }),
|
|
5343
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-stat-value", children: formatStatValue(selectionStats.avg) })
|
|
5040
5344
|
] })
|
|
5041
5345
|
] })
|
|
5042
5346
|
] })
|
|
5043
5347
|
] })
|
|
5044
5348
|
] }),
|
|
5045
|
-
showWatermark && canUsePivot && /* @__PURE__ */
|
|
5046
|
-
/* @__PURE__ */
|
|
5047
|
-
/* @__PURE__ */
|
|
5048
|
-
/* @__PURE__ */
|
|
5349
|
+
showWatermark && canUsePivot && /* @__PURE__ */ jsx9("div", { className: `vpg-watermark ${isDemo ? "vpg-demo-mode" : ""}`, children: isDemo ? /* @__PURE__ */ jsxs9(Fragment6, { children: [
|
|
5350
|
+
/* @__PURE__ */ jsx9("span", { className: "vpg-demo-badge", children: "DEMO" }),
|
|
5351
|
+
/* @__PURE__ */ jsx9("span", { children: "Pro features unlocked for evaluation" }),
|
|
5352
|
+
/* @__PURE__ */ jsx9(
|
|
5049
5353
|
"a",
|
|
5050
5354
|
{
|
|
5051
5355
|
href: "https://tiny-pivot.com/#pricing",
|
|
@@ -5055,14 +5359,14 @@ function PivotSkeleton({
|
|
|
5055
5359
|
children: "Get Pro License \u2192"
|
|
5056
5360
|
}
|
|
5057
5361
|
)
|
|
5058
|
-
] }) : /* @__PURE__ */
|
|
5362
|
+
] }) : /* @__PURE__ */ jsx9("a", { href: "https://tiny-pivot.com", target: "_blank", rel: "noopener noreferrer", children: "Powered by TinyPivot" }) })
|
|
5059
5363
|
]
|
|
5060
5364
|
}
|
|
5061
5365
|
);
|
|
5062
5366
|
}
|
|
5063
5367
|
|
|
5064
5368
|
// src/components/DataGrid.tsx
|
|
5065
|
-
import { Fragment as
|
|
5369
|
+
import { Fragment as Fragment7, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
5066
5370
|
var MIN_COL_WIDTH = 120;
|
|
5067
5371
|
var MAX_COL_WIDTH = 350;
|
|
5068
5372
|
function DataGrid({
|
|
@@ -5087,53 +5391,59 @@ function DataGrid({
|
|
|
5087
5391
|
dateFormat = "iso",
|
|
5088
5392
|
fieldRoleOverrides,
|
|
5089
5393
|
aiAnalyst,
|
|
5394
|
+
enableDrillDown = true,
|
|
5395
|
+
enableDrillThrough = true,
|
|
5090
5396
|
onCellClick,
|
|
5091
5397
|
onExport,
|
|
5092
5398
|
onCopy,
|
|
5093
5399
|
onAIDataLoaded,
|
|
5094
5400
|
onAIConversationUpdate,
|
|
5095
5401
|
onAIQueryExecuted,
|
|
5096
|
-
onAIError
|
|
5402
|
+
onAIError,
|
|
5403
|
+
onCollapseChange,
|
|
5404
|
+
onDrillThrough
|
|
5097
5405
|
}) {
|
|
5098
|
-
const { showWatermark, canUsePivot, canUseCharts, canUseAIAnalyst, isDemo, isPro } = useLicense();
|
|
5406
|
+
const { showWatermark, canUsePivot, canUseCharts, canUseAIAnalyst, isDemo, isPro, licenseInfo } = useLicense();
|
|
5407
|
+
const [drillThroughResult, setDrillThroughResult] = useState15(null);
|
|
5408
|
+
const [showDrillThroughModal, setShowDrillThroughModal] = useState15(false);
|
|
5099
5409
|
const showAIAnalyst = aiAnalyst?.enabled && canUseAIAnalyst;
|
|
5100
|
-
const currentTheme =
|
|
5410
|
+
const currentTheme = useMemo15(() => {
|
|
5101
5411
|
if (theme === "auto") {
|
|
5102
5412
|
return window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
5103
5413
|
}
|
|
5104
5414
|
return theme;
|
|
5105
5415
|
}, [theme]);
|
|
5106
|
-
const [currentFontSize, setCurrentFontSize] =
|
|
5107
|
-
const [globalSearchTerm, setGlobalSearchTerm] =
|
|
5108
|
-
const [showSearchInput, setShowSearchInput] =
|
|
5109
|
-
const [currentPage, setCurrentPage] =
|
|
5110
|
-
const [columnWidths, setColumnWidths] =
|
|
5111
|
-
const [resizingColumnId, setResizingColumnId] =
|
|
5112
|
-
const [resizeStartX, setResizeStartX] =
|
|
5113
|
-
const [resizeStartWidth, setResizeStartWidth] =
|
|
5114
|
-
const [gridHeight, setGridHeight] =
|
|
5115
|
-
const [isResizingVertically, setIsResizingVertically] =
|
|
5116
|
-
const [verticalResizeStartY, setVerticalResizeStartY] =
|
|
5117
|
-
const [verticalResizeStartHeight, setVerticalResizeStartHeight] =
|
|
5118
|
-
const [showCopyToast, setShowCopyToast] =
|
|
5119
|
-
const [copyToastMessage, setCopyToastMessage] =
|
|
5120
|
-
const [viewMode, setViewMode] =
|
|
5416
|
+
const [currentFontSize, setCurrentFontSize] = useState15(initialFontSize);
|
|
5417
|
+
const [globalSearchTerm, setGlobalSearchTerm] = useState15("");
|
|
5418
|
+
const [showSearchInput, setShowSearchInput] = useState15(false);
|
|
5419
|
+
const [currentPage, setCurrentPage] = useState15(1);
|
|
5420
|
+
const [columnWidths, setColumnWidths] = useState15({});
|
|
5421
|
+
const [resizingColumnId, setResizingColumnId] = useState15(null);
|
|
5422
|
+
const [resizeStartX, setResizeStartX] = useState15(0);
|
|
5423
|
+
const [resizeStartWidth, setResizeStartWidth] = useState15(0);
|
|
5424
|
+
const [gridHeight, setGridHeight] = useState15(initialHeight);
|
|
5425
|
+
const [isResizingVertically, setIsResizingVertically] = useState15(false);
|
|
5426
|
+
const [verticalResizeStartY, setVerticalResizeStartY] = useState15(0);
|
|
5427
|
+
const [verticalResizeStartHeight, setVerticalResizeStartHeight] = useState15(0);
|
|
5428
|
+
const [showCopyToast, setShowCopyToast] = useState15(false);
|
|
5429
|
+
const [copyToastMessage, setCopyToastMessage] = useState15("");
|
|
5430
|
+
const [viewMode, setViewMode] = useState15("grid");
|
|
5121
5431
|
const aiAnalystRef = useRef4(null);
|
|
5122
|
-
const [aiLoadedData, setAiLoadedData] =
|
|
5123
|
-
const [isLoadingFullData, setIsLoadingFullData] =
|
|
5124
|
-
const displayData =
|
|
5125
|
-
const [_chartConfig, setChartConfig] =
|
|
5126
|
-
const handleChartConfigChange =
|
|
5432
|
+
const [aiLoadedData, setAiLoadedData] = useState15(null);
|
|
5433
|
+
const [isLoadingFullData, setIsLoadingFullData] = useState15(false);
|
|
5434
|
+
const displayData = useMemo15(() => aiLoadedData || data, [aiLoadedData, data]);
|
|
5435
|
+
const [_chartConfig, setChartConfig] = useState15(null);
|
|
5436
|
+
const handleChartConfigChange = useCallback15((config) => {
|
|
5127
5437
|
setChartConfig(config);
|
|
5128
5438
|
}, []);
|
|
5129
|
-
const [showPivotConfig, setShowPivotConfig] =
|
|
5130
|
-
const [draggingField, setDraggingField] =
|
|
5131
|
-
const [activeFilterColumn, setActiveFilterColumn] =
|
|
5132
|
-
const [filterDropdownPosition, setFilterDropdownPosition] =
|
|
5133
|
-
const [selectedCell, setSelectedCell] =
|
|
5134
|
-
const [selectionStart, setSelectionStart] =
|
|
5135
|
-
const [selectionEnd, setSelectionEnd] =
|
|
5136
|
-
const [isSelecting, setIsSelecting] =
|
|
5439
|
+
const [showPivotConfig, setShowPivotConfig] = useState15(true);
|
|
5440
|
+
const [draggingField, setDraggingField] = useState15(null);
|
|
5441
|
+
const [activeFilterColumn, setActiveFilterColumn] = useState15(null);
|
|
5442
|
+
const [filterDropdownPosition, setFilterDropdownPosition] = useState15({ top: 0, left: 0, maxHeight: 400 });
|
|
5443
|
+
const [selectedCell, setSelectedCell] = useState15(null);
|
|
5444
|
+
const [selectionStart, setSelectionStart] = useState15(null);
|
|
5445
|
+
const [selectionEnd, setSelectionEnd] = useState15(null);
|
|
5446
|
+
const [isSelecting, setIsSelecting] = useState15(false);
|
|
5137
5447
|
const tableContainerRef = useRef4(null);
|
|
5138
5448
|
const tableBodyRef = useRef4(null);
|
|
5139
5449
|
const fontSizeOptions = [
|
|
@@ -5162,7 +5472,7 @@ function DataGrid({
|
|
|
5162
5472
|
setDateRangeFilter,
|
|
5163
5473
|
getDateRangeFilter
|
|
5164
5474
|
} = useExcelGrid({ data: displayData, enableSorting: true, enableFiltering: true });
|
|
5165
|
-
const filteredDataForPivot =
|
|
5475
|
+
const filteredDataForPivot = useMemo15(() => {
|
|
5166
5476
|
const filteredRows = table.getFilteredRowModel().rows;
|
|
5167
5477
|
return filteredRows.map((row) => row.original);
|
|
5168
5478
|
}, [table, columnFilters]);
|
|
@@ -5190,9 +5500,58 @@ function DataGrid({
|
|
|
5190
5500
|
setRowFields,
|
|
5191
5501
|
setColumnFields,
|
|
5192
5502
|
addCalculatedField,
|
|
5193
|
-
removeCalculatedField
|
|
5194
|
-
|
|
5195
|
-
|
|
5503
|
+
removeCalculatedField,
|
|
5504
|
+
toggleCollapsedPath
|
|
5505
|
+
} = usePivotTable(filteredDataForPivot, enableDrillDown);
|
|
5506
|
+
const handleToggleCollapse = useCallback15(
|
|
5507
|
+
(key, altKey) => {
|
|
5508
|
+
const next = toggleCollapsedPath(key, altKey, pivotRowFields, pivotResult);
|
|
5509
|
+
onCollapseChange?.(Array.from(next));
|
|
5510
|
+
},
|
|
5511
|
+
[toggleCollapsedPath, pivotRowFields, pivotResult, onCollapseChange]
|
|
5512
|
+
);
|
|
5513
|
+
const handleDrillThroughCell = useCallback15(
|
|
5514
|
+
(payload) => {
|
|
5515
|
+
if (!enableDrillThrough)
|
|
5516
|
+
return;
|
|
5517
|
+
if (!canUseDrillThrough(licenseInfo)) {
|
|
5518
|
+
console.warn('[TinyPivot] "Drill-through" requires a Pro license. Visit https://tiny-pivot.com/#pricing to upgrade.');
|
|
5519
|
+
return;
|
|
5520
|
+
}
|
|
5521
|
+
const pivotConfig = {
|
|
5522
|
+
rowFields: pivotRowFields,
|
|
5523
|
+
columnFields: pivotColumnFields,
|
|
5524
|
+
valueFields: pivotValueFields,
|
|
5525
|
+
showRowTotals: pivotShowRowTotals,
|
|
5526
|
+
showColumnTotals: pivotShowColumnTotals
|
|
5527
|
+
};
|
|
5528
|
+
const result = getDrillThroughRows(
|
|
5529
|
+
filteredDataForPivot,
|
|
5530
|
+
pivotConfig,
|
|
5531
|
+
payload.rowPath,
|
|
5532
|
+
payload.columnPath,
|
|
5533
|
+
payload.valueFieldIndex
|
|
5534
|
+
);
|
|
5535
|
+
setDrillThroughResult(result);
|
|
5536
|
+
setShowDrillThroughModal(true);
|
|
5537
|
+
onDrillThrough?.(result);
|
|
5538
|
+
},
|
|
5539
|
+
[
|
|
5540
|
+
enableDrillThrough,
|
|
5541
|
+
licenseInfo,
|
|
5542
|
+
pivotRowFields,
|
|
5543
|
+
pivotColumnFields,
|
|
5544
|
+
pivotValueFields,
|
|
5545
|
+
pivotShowRowTotals,
|
|
5546
|
+
pivotShowColumnTotals,
|
|
5547
|
+
filteredDataForPivot,
|
|
5548
|
+
onDrillThrough
|
|
5549
|
+
]
|
|
5550
|
+
);
|
|
5551
|
+
const handleCloseDrillThroughModal = useCallback15(() => {
|
|
5552
|
+
setShowDrillThroughModal(false);
|
|
5553
|
+
}, []);
|
|
5554
|
+
const activeFilterInfo = useMemo15(() => {
|
|
5196
5555
|
if (activeFilters.length === 0)
|
|
5197
5556
|
return null;
|
|
5198
5557
|
return activeFilters.map((f) => {
|
|
@@ -5230,8 +5589,8 @@ function DataGrid({
|
|
|
5230
5589
|
};
|
|
5231
5590
|
});
|
|
5232
5591
|
}, [activeFilters, dateFormat]);
|
|
5233
|
-
const rows =
|
|
5234
|
-
const searchFilteredData =
|
|
5592
|
+
const rows = useMemo15(() => table.getFilteredRowModel().rows, [table, columnFilters]);
|
|
5593
|
+
const searchFilteredData = useMemo15(() => {
|
|
5235
5594
|
if (!globalSearchTerm.trim() || !enableSearch) {
|
|
5236
5595
|
return rows;
|
|
5237
5596
|
}
|
|
@@ -5249,22 +5608,22 @@ function DataGrid({
|
|
|
5249
5608
|
});
|
|
5250
5609
|
}, [rows, globalSearchTerm, enableSearch, columnKeys]);
|
|
5251
5610
|
const totalSearchedRows = searchFilteredData.length;
|
|
5252
|
-
const totalPages =
|
|
5611
|
+
const totalPages = useMemo15(() => {
|
|
5253
5612
|
if (!enablePagination)
|
|
5254
5613
|
return 1;
|
|
5255
5614
|
return Math.max(1, Math.ceil(totalSearchedRows / pageSize));
|
|
5256
5615
|
}, [enablePagination, totalSearchedRows, pageSize]);
|
|
5257
|
-
const paginatedRows =
|
|
5616
|
+
const paginatedRows = useMemo15(() => {
|
|
5258
5617
|
if (!enablePagination)
|
|
5259
5618
|
return searchFilteredData;
|
|
5260
5619
|
const start = (currentPage - 1) * pageSize;
|
|
5261
5620
|
const end = start + pageSize;
|
|
5262
5621
|
return searchFilteredData.slice(start, end);
|
|
5263
5622
|
}, [enablePagination, searchFilteredData, currentPage, pageSize]);
|
|
5264
|
-
|
|
5623
|
+
useEffect12(() => {
|
|
5265
5624
|
setCurrentPage(1);
|
|
5266
5625
|
}, [columnFilters, globalSearchTerm]);
|
|
5267
|
-
const selectionBounds =
|
|
5626
|
+
const selectionBounds = useMemo15(() => {
|
|
5268
5627
|
if (!selectionStart || !selectionEnd)
|
|
5269
5628
|
return null;
|
|
5270
5629
|
return {
|
|
@@ -5274,7 +5633,7 @@ function DataGrid({
|
|
|
5274
5633
|
maxCol: Math.max(selectionStart.col, selectionEnd.col)
|
|
5275
5634
|
};
|
|
5276
5635
|
}, [selectionStart, selectionEnd]);
|
|
5277
|
-
const selectionStats =
|
|
5636
|
+
const selectionStats = useMemo15(() => {
|
|
5278
5637
|
if (!selectionBounds)
|
|
5279
5638
|
return null;
|
|
5280
5639
|
const { minRow, maxRow, minCol, maxCol } = selectionBounds;
|
|
@@ -5304,7 +5663,7 @@ function DataGrid({
|
|
|
5304
5663
|
const avg = sum / values.length;
|
|
5305
5664
|
return { count, sum, avg, numericCount: values.length };
|
|
5306
5665
|
}, [selectionBounds, rows, columnKeys]);
|
|
5307
|
-
|
|
5666
|
+
useEffect12(() => {
|
|
5308
5667
|
if (typeof document === "undefined")
|
|
5309
5668
|
return;
|
|
5310
5669
|
if (displayData.length === 0)
|
|
@@ -5328,7 +5687,7 @@ function DataGrid({
|
|
|
5328
5687
|
}
|
|
5329
5688
|
setColumnWidths(widths);
|
|
5330
5689
|
}, [displayData, columnKeys]);
|
|
5331
|
-
const startColumnResize =
|
|
5690
|
+
const startColumnResize = useCallback15(
|
|
5332
5691
|
(columnId, event) => {
|
|
5333
5692
|
if (!enableColumnResize)
|
|
5334
5693
|
return;
|
|
@@ -5340,7 +5699,7 @@ function DataGrid({
|
|
|
5340
5699
|
},
|
|
5341
5700
|
[enableColumnResize, columnWidths]
|
|
5342
5701
|
);
|
|
5343
|
-
|
|
5702
|
+
useEffect12(() => {
|
|
5344
5703
|
if (!resizingColumnId)
|
|
5345
5704
|
return;
|
|
5346
5705
|
const handleResizeMove = (event) => {
|
|
@@ -5361,7 +5720,7 @@ function DataGrid({
|
|
|
5361
5720
|
document.removeEventListener("mouseup", handleResizeEnd);
|
|
5362
5721
|
};
|
|
5363
5722
|
}, [resizingColumnId, resizeStartX, resizeStartWidth]);
|
|
5364
|
-
const startVerticalResize =
|
|
5723
|
+
const startVerticalResize = useCallback15(
|
|
5365
5724
|
(event) => {
|
|
5366
5725
|
if (!enableVerticalResize)
|
|
5367
5726
|
return;
|
|
@@ -5372,7 +5731,7 @@ function DataGrid({
|
|
|
5372
5731
|
},
|
|
5373
5732
|
[enableVerticalResize, gridHeight]
|
|
5374
5733
|
);
|
|
5375
|
-
|
|
5734
|
+
useEffect12(() => {
|
|
5376
5735
|
if (!isResizingVertically)
|
|
5377
5736
|
return;
|
|
5378
5737
|
const handleVerticalResizeMove = (event) => {
|
|
@@ -5390,7 +5749,7 @@ function DataGrid({
|
|
|
5390
5749
|
document.removeEventListener("mouseup", handleVerticalResizeEnd);
|
|
5391
5750
|
};
|
|
5392
5751
|
}, [isResizingVertically, verticalResizeStartY, verticalResizeStartHeight, minHeight, maxHeight]);
|
|
5393
|
-
const handleExport =
|
|
5752
|
+
const handleExport = useCallback15(() => {
|
|
5394
5753
|
if (viewMode === "pivot") {
|
|
5395
5754
|
if (!pivotResult)
|
|
5396
5755
|
return;
|
|
@@ -5436,7 +5795,7 @@ function DataGrid({
|
|
|
5436
5795
|
columnKeys,
|
|
5437
5796
|
onExport
|
|
5438
5797
|
]);
|
|
5439
|
-
const copySelectionToClipboard =
|
|
5798
|
+
const copySelectionToClipboard = useCallback15(() => {
|
|
5440
5799
|
if (!selectionBounds || !enableClipboard)
|
|
5441
5800
|
return;
|
|
5442
5801
|
const text = formatSelectionForClipboard(
|
|
@@ -5461,7 +5820,7 @@ function DataGrid({
|
|
|
5461
5820
|
}
|
|
5462
5821
|
);
|
|
5463
5822
|
}, [selectionBounds, enableClipboard, rows, columnKeys, onCopy]);
|
|
5464
|
-
const handleMouseDown =
|
|
5823
|
+
const handleMouseDown = useCallback15(
|
|
5465
5824
|
(rowIndex, colIndex, event) => {
|
|
5466
5825
|
event.preventDefault();
|
|
5467
5826
|
if (event.shiftKey && selectedCell) {
|
|
@@ -5485,7 +5844,7 @@ function DataGrid({
|
|
|
5485
5844
|
},
|
|
5486
5845
|
[selectedCell, rows, columnKeys, onCellClick]
|
|
5487
5846
|
);
|
|
5488
|
-
const handleMouseEnter =
|
|
5847
|
+
const handleMouseEnter = useCallback15(
|
|
5489
5848
|
(rowIndex, colIndex) => {
|
|
5490
5849
|
if (isSelecting) {
|
|
5491
5850
|
setSelectionEnd({ row: rowIndex, col: colIndex });
|
|
@@ -5494,7 +5853,7 @@ function DataGrid({
|
|
|
5494
5853
|
[isSelecting]
|
|
5495
5854
|
);
|
|
5496
5855
|
const isShowingAIData = aiLoadedData !== null;
|
|
5497
|
-
const resetToFullData =
|
|
5856
|
+
const resetToFullData = useCallback15(async () => {
|
|
5498
5857
|
if (aiAnalystRef.current?.selectedDataSource) {
|
|
5499
5858
|
setIsLoadingFullData(true);
|
|
5500
5859
|
try {
|
|
@@ -5515,37 +5874,37 @@ function DataGrid({
|
|
|
5515
5874
|
}
|
|
5516
5875
|
clearAllFilters();
|
|
5517
5876
|
}, [clearAllFilters]);
|
|
5518
|
-
const handleAIDataLoaded =
|
|
5877
|
+
const handleAIDataLoaded = useCallback15(
|
|
5519
5878
|
(payload) => {
|
|
5520
5879
|
setAiLoadedData(payload.data);
|
|
5521
5880
|
onAIDataLoaded?.(payload);
|
|
5522
5881
|
},
|
|
5523
5882
|
[onAIDataLoaded]
|
|
5524
5883
|
);
|
|
5525
|
-
const handleAIConversationUpdate =
|
|
5884
|
+
const handleAIConversationUpdate = useCallback15(
|
|
5526
5885
|
(payload) => {
|
|
5527
5886
|
onAIConversationUpdate?.(payload);
|
|
5528
5887
|
},
|
|
5529
5888
|
[onAIConversationUpdate]
|
|
5530
5889
|
);
|
|
5531
|
-
const handleAIQueryExecuted =
|
|
5890
|
+
const handleAIQueryExecuted = useCallback15(
|
|
5532
5891
|
(payload) => {
|
|
5533
5892
|
onAIQueryExecuted?.(payload);
|
|
5534
5893
|
},
|
|
5535
5894
|
[onAIQueryExecuted]
|
|
5536
5895
|
);
|
|
5537
|
-
const handleAIError =
|
|
5896
|
+
const handleAIError = useCallback15(
|
|
5538
5897
|
(payload) => {
|
|
5539
5898
|
onAIError?.(payload);
|
|
5540
5899
|
},
|
|
5541
5900
|
[onAIError]
|
|
5542
5901
|
);
|
|
5543
|
-
|
|
5902
|
+
useEffect12(() => {
|
|
5544
5903
|
const handleMouseUp = () => setIsSelecting(false);
|
|
5545
5904
|
document.addEventListener("mouseup", handleMouseUp);
|
|
5546
5905
|
return () => document.removeEventListener("mouseup", handleMouseUp);
|
|
5547
5906
|
}, []);
|
|
5548
|
-
|
|
5907
|
+
useEffect12(() => {
|
|
5549
5908
|
const handleKeydown = (event) => {
|
|
5550
5909
|
if ((event.ctrlKey || event.metaKey) && event.key === "c" && selectionBounds) {
|
|
5551
5910
|
event.preventDefault();
|
|
@@ -5563,7 +5922,7 @@ function DataGrid({
|
|
|
5563
5922
|
document.addEventListener("keydown", handleKeydown);
|
|
5564
5923
|
return () => document.removeEventListener("keydown", handleKeydown);
|
|
5565
5924
|
}, [selectionBounds, copySelectionToClipboard]);
|
|
5566
|
-
const openFilterDropdown =
|
|
5925
|
+
const openFilterDropdown = useCallback15(
|
|
5567
5926
|
(columnId, event) => {
|
|
5568
5927
|
event.stopPropagation();
|
|
5569
5928
|
const target = event.currentTarget;
|
|
@@ -5592,28 +5951,28 @@ function DataGrid({
|
|
|
5592
5951
|
},
|
|
5593
5952
|
[]
|
|
5594
5953
|
);
|
|
5595
|
-
const closeFilterDropdown =
|
|
5954
|
+
const closeFilterDropdown = useCallback15(() => {
|
|
5596
5955
|
setActiveFilterColumn(null);
|
|
5597
5956
|
}, []);
|
|
5598
|
-
const handleFilter =
|
|
5957
|
+
const handleFilter = useCallback15(
|
|
5599
5958
|
(columnId, values) => {
|
|
5600
5959
|
setColumnFilter(columnId, values);
|
|
5601
5960
|
},
|
|
5602
5961
|
[setColumnFilter]
|
|
5603
5962
|
);
|
|
5604
|
-
const handleRangeFilter =
|
|
5963
|
+
const handleRangeFilter = useCallback15(
|
|
5605
5964
|
(columnId, range) => {
|
|
5606
5965
|
setNumericRangeFilter(columnId, range);
|
|
5607
5966
|
},
|
|
5608
5967
|
[setNumericRangeFilter]
|
|
5609
5968
|
);
|
|
5610
|
-
const handleDateRangeFilter =
|
|
5969
|
+
const handleDateRangeFilter = useCallback15(
|
|
5611
5970
|
(columnId, range) => {
|
|
5612
5971
|
setDateRangeFilter(columnId, range);
|
|
5613
5972
|
},
|
|
5614
5973
|
[setDateRangeFilter]
|
|
5615
5974
|
);
|
|
5616
|
-
const handleSort =
|
|
5975
|
+
const handleSort = useCallback15(
|
|
5617
5976
|
(columnId, direction) => {
|
|
5618
5977
|
if (direction === null) {
|
|
5619
5978
|
const current = getSortDirection(columnId);
|
|
@@ -5637,7 +5996,7 @@ function DataGrid({
|
|
|
5637
5996
|
},
|
|
5638
5997
|
[getSortDirection, toggleSort]
|
|
5639
5998
|
);
|
|
5640
|
-
const isCellSelected =
|
|
5999
|
+
const isCellSelected = useCallback15(
|
|
5641
6000
|
(rowIndex, colIndex) => {
|
|
5642
6001
|
if (!selectionBounds) {
|
|
5643
6002
|
return selectedCell?.row === rowIndex && selectedCell?.col === colIndex;
|
|
@@ -5679,54 +6038,54 @@ function DataGrid({
|
|
|
5679
6038
|
}
|
|
5680
6039
|
return String(value);
|
|
5681
6040
|
};
|
|
5682
|
-
const totalTableWidth =
|
|
6041
|
+
const totalTableWidth = useMemo15(() => {
|
|
5683
6042
|
return columnKeys.reduce((sum, key) => sum + (columnWidths[key] || MIN_COL_WIDTH), 0);
|
|
5684
6043
|
}, [columnKeys, columnWidths]);
|
|
5685
6044
|
const activeFilterCount = columnFilters.length;
|
|
5686
|
-
return /* @__PURE__ */
|
|
6045
|
+
return /* @__PURE__ */ jsxs10(
|
|
5687
6046
|
"div",
|
|
5688
6047
|
{
|
|
5689
6048
|
className: `vpg-data-grid vpg-font-${currentFontSize} vpg-theme-${currentTheme} ${stripedRows ? "vpg-striped" : ""} ${resizingColumnId ? "vpg-resizing" : ""} ${isResizingVertically ? "vpg-resizing-vertical" : ""}`,
|
|
5690
6049
|
style: { height: `${gridHeight}px` },
|
|
5691
6050
|
children: [
|
|
5692
|
-
showCopyToast && /* @__PURE__ */
|
|
5693
|
-
/* @__PURE__ */
|
|
6051
|
+
showCopyToast && /* @__PURE__ */ jsxs10("div", { className: "vpg-toast", children: [
|
|
6052
|
+
/* @__PURE__ */ jsx10("svg", { className: "vpg-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }),
|
|
5694
6053
|
copyToastMessage
|
|
5695
6054
|
] }),
|
|
5696
|
-
/* @__PURE__ */
|
|
5697
|
-
/* @__PURE__ */
|
|
5698
|
-
showPivot && /* @__PURE__ */
|
|
5699
|
-
showAIAnalyst && /* @__PURE__ */
|
|
6055
|
+
/* @__PURE__ */ jsxs10("div", { className: "vpg-toolbar", children: [
|
|
6056
|
+
/* @__PURE__ */ jsxs10("div", { className: "vpg-toolbar-left", children: [
|
|
6057
|
+
showPivot && /* @__PURE__ */ jsxs10("div", { className: "vpg-view-toggle", children: [
|
|
6058
|
+
showAIAnalyst && /* @__PURE__ */ jsxs10(
|
|
5700
6059
|
"button",
|
|
5701
6060
|
{
|
|
5702
6061
|
className: `vpg-view-btn vpg-ai-btn ${viewMode === "ai" ? "active" : ""}`,
|
|
5703
6062
|
onClick: () => setViewMode("ai"),
|
|
5704
6063
|
children: [
|
|
5705
|
-
/* @__PURE__ */
|
|
6064
|
+
/* @__PURE__ */ jsx10("svg", { className: "vpg-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 2a2 2 0 0 1 2 2c0 .74-.4 1.39-1 1.73V7h1a7 7 0 0 1 7 7h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1v1a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-1H2a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h1a7 7 0 0 1 7-7h1V5.73c-.6-.34-1-.99-1-1.73a2 2 0 0 1 2-2z" }) }),
|
|
5706
6065
|
"AI Analyst"
|
|
5707
6066
|
]
|
|
5708
6067
|
}
|
|
5709
6068
|
),
|
|
5710
|
-
aiAnalyst?.enabled && !canUseAIAnalyst && /* @__PURE__ */
|
|
6069
|
+
aiAnalyst?.enabled && !canUseAIAnalyst && /* @__PURE__ */ jsxs10(
|
|
5711
6070
|
"button",
|
|
5712
6071
|
{
|
|
5713
6072
|
className: "vpg-view-btn vpg-ai-btn vpg-pro-feature",
|
|
5714
6073
|
title: "AI Analyst (Pro feature)",
|
|
5715
6074
|
onClick: (e) => e.preventDefault(),
|
|
5716
6075
|
children: [
|
|
5717
|
-
/* @__PURE__ */
|
|
6076
|
+
/* @__PURE__ */ jsx10("svg", { className: "vpg-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 2a2 2 0 0 1 2 2c0 .74-.4 1.39-1 1.73V7h1a7 7 0 0 1 7 7h1a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-1v1a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-1H2a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1h1a7 7 0 0 1 7-7h1V5.73c-.6-.34-1-.99-1-1.73a2 2 0 0 1 2-2z" }) }),
|
|
5718
6077
|
"AI Analyst",
|
|
5719
|
-
/* @__PURE__ */
|
|
6078
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-pro-badge", children: "Pro" })
|
|
5720
6079
|
]
|
|
5721
6080
|
}
|
|
5722
6081
|
),
|
|
5723
|
-
/* @__PURE__ */
|
|
6082
|
+
/* @__PURE__ */ jsxs10(
|
|
5724
6083
|
"button",
|
|
5725
6084
|
{
|
|
5726
6085
|
className: `vpg-view-btn ${viewMode === "grid" ? "active" : ""}`,
|
|
5727
6086
|
onClick: () => setViewMode("grid"),
|
|
5728
6087
|
children: [
|
|
5729
|
-
/* @__PURE__ */
|
|
6088
|
+
/* @__PURE__ */ jsx10("svg", { className: "vpg-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10(
|
|
5730
6089
|
"path",
|
|
5731
6090
|
{
|
|
5732
6091
|
strokeLinecap: "round",
|
|
@@ -5739,13 +6098,13 @@ function DataGrid({
|
|
|
5739
6098
|
]
|
|
5740
6099
|
}
|
|
5741
6100
|
),
|
|
5742
|
-
/* @__PURE__ */
|
|
6101
|
+
/* @__PURE__ */ jsxs10(
|
|
5743
6102
|
"button",
|
|
5744
6103
|
{
|
|
5745
6104
|
className: `vpg-view-btn vpg-pivot-btn ${viewMode === "pivot" ? "active" : ""}`,
|
|
5746
6105
|
onClick: () => setViewMode("pivot"),
|
|
5747
6106
|
children: [
|
|
5748
|
-
/* @__PURE__ */
|
|
6107
|
+
/* @__PURE__ */ jsx10("svg", { className: "vpg-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10(
|
|
5749
6108
|
"path",
|
|
5750
6109
|
{
|
|
5751
6110
|
strokeLinecap: "round",
|
|
@@ -5758,14 +6117,14 @@ function DataGrid({
|
|
|
5758
6117
|
]
|
|
5759
6118
|
}
|
|
5760
6119
|
),
|
|
5761
|
-
/* @__PURE__ */
|
|
6120
|
+
/* @__PURE__ */ jsxs10(
|
|
5762
6121
|
"button",
|
|
5763
6122
|
{
|
|
5764
6123
|
className: `vpg-view-btn vpg-chart-btn ${viewMode === "chart" ? "active" : ""} ${!canUseCharts ? "vpg-pro-feature" : ""}`,
|
|
5765
6124
|
title: canUseCharts ? "Chart Builder" : "Chart Builder (Pro feature)",
|
|
5766
6125
|
onClick: () => canUseCharts && setViewMode("chart"),
|
|
5767
6126
|
children: [
|
|
5768
|
-
/* @__PURE__ */
|
|
6127
|
+
/* @__PURE__ */ jsx10("svg", { className: "vpg-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10(
|
|
5769
6128
|
"path",
|
|
5770
6129
|
{
|
|
5771
6130
|
strokeLinecap: "round",
|
|
@@ -5775,19 +6134,19 @@ function DataGrid({
|
|
|
5775
6134
|
}
|
|
5776
6135
|
) }),
|
|
5777
6136
|
"Chart",
|
|
5778
|
-
!canUseCharts && /* @__PURE__ */
|
|
6137
|
+
!canUseCharts && /* @__PURE__ */ jsx10("span", { className: "vpg-pro-badge", children: "Pro" })
|
|
5779
6138
|
]
|
|
5780
6139
|
}
|
|
5781
6140
|
)
|
|
5782
6141
|
] }),
|
|
5783
|
-
viewMode === "grid" && /* @__PURE__ */
|
|
5784
|
-
enableSearch && /* @__PURE__ */
|
|
6142
|
+
viewMode === "grid" && /* @__PURE__ */ jsxs10(Fragment7, { children: [
|
|
6143
|
+
enableSearch && /* @__PURE__ */ jsx10("div", { className: "vpg-search-container", children: !showSearchInput ? /* @__PURE__ */ jsx10(
|
|
5785
6144
|
"button",
|
|
5786
6145
|
{
|
|
5787
6146
|
className: "vpg-icon-btn",
|
|
5788
6147
|
title: "Search (Ctrl+F)",
|
|
5789
6148
|
onClick: () => setShowSearchInput(true),
|
|
5790
|
-
children: /* @__PURE__ */
|
|
6149
|
+
children: /* @__PURE__ */ jsx10("svg", { className: "vpg-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10(
|
|
5791
6150
|
"path",
|
|
5792
6151
|
{
|
|
5793
6152
|
strokeLinecap: "round",
|
|
@@ -5797,15 +6156,15 @@ function DataGrid({
|
|
|
5797
6156
|
}
|
|
5798
6157
|
) })
|
|
5799
6158
|
}
|
|
5800
|
-
) : /* @__PURE__ */
|
|
5801
|
-
/* @__PURE__ */
|
|
6159
|
+
) : /* @__PURE__ */ jsxs10("div", { className: "vpg-search-box", children: [
|
|
6160
|
+
/* @__PURE__ */ jsx10(
|
|
5802
6161
|
"svg",
|
|
5803
6162
|
{
|
|
5804
6163
|
className: "vpg-search-icon",
|
|
5805
6164
|
fill: "none",
|
|
5806
6165
|
stroke: "currentColor",
|
|
5807
6166
|
viewBox: "0 0 24 24",
|
|
5808
|
-
children: /* @__PURE__ */
|
|
6167
|
+
children: /* @__PURE__ */ jsx10(
|
|
5809
6168
|
"path",
|
|
5810
6169
|
{
|
|
5811
6170
|
strokeLinecap: "round",
|
|
@@ -5816,7 +6175,7 @@ function DataGrid({
|
|
|
5816
6175
|
)
|
|
5817
6176
|
}
|
|
5818
6177
|
),
|
|
5819
|
-
/* @__PURE__ */
|
|
6178
|
+
/* @__PURE__ */ jsx10(
|
|
5820
6179
|
"input",
|
|
5821
6180
|
{
|
|
5822
6181
|
type: "text",
|
|
@@ -5833,14 +6192,14 @@ function DataGrid({
|
|
|
5833
6192
|
autoFocus: true
|
|
5834
6193
|
}
|
|
5835
6194
|
),
|
|
5836
|
-
globalSearchTerm && /* @__PURE__ */
|
|
6195
|
+
globalSearchTerm && /* @__PURE__ */ jsx10("button", { className: "vpg-search-clear", onClick: () => setGlobalSearchTerm(""), children: /* @__PURE__ */ jsx10(
|
|
5837
6196
|
"svg",
|
|
5838
6197
|
{
|
|
5839
6198
|
className: "vpg-icon-xs",
|
|
5840
6199
|
fill: "none",
|
|
5841
6200
|
stroke: "currentColor",
|
|
5842
6201
|
viewBox: "0 0 24 24",
|
|
5843
|
-
children: /* @__PURE__ */
|
|
6202
|
+
children: /* @__PURE__ */ jsx10(
|
|
5844
6203
|
"path",
|
|
5845
6204
|
{
|
|
5846
6205
|
strokeLinecap: "round",
|
|
@@ -5852,9 +6211,9 @@ function DataGrid({
|
|
|
5852
6211
|
}
|
|
5853
6212
|
) })
|
|
5854
6213
|
] }) }),
|
|
5855
|
-
/* @__PURE__ */
|
|
5856
|
-
/* @__PURE__ */
|
|
5857
|
-
/* @__PURE__ */
|
|
6214
|
+
/* @__PURE__ */ jsxs10("div", { className: "vpg-font-size-control", children: [
|
|
6215
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-label", children: "Size:" }),
|
|
6216
|
+
/* @__PURE__ */ jsx10("div", { className: "vpg-font-size-toggle", children: fontSizeOptions.map((opt) => /* @__PURE__ */ jsx10(
|
|
5858
6217
|
"button",
|
|
5859
6218
|
{
|
|
5860
6219
|
className: `vpg-font-size-btn ${currentFontSize === opt.value ? "active" : ""}`,
|
|
@@ -5864,8 +6223,8 @@ function DataGrid({
|
|
|
5864
6223
|
opt.value
|
|
5865
6224
|
)) })
|
|
5866
6225
|
] }),
|
|
5867
|
-
activeFilterCount > 0 && /* @__PURE__ */
|
|
5868
|
-
/* @__PURE__ */
|
|
6226
|
+
activeFilterCount > 0 && /* @__PURE__ */ jsxs10("div", { className: "vpg-filter-info", children: [
|
|
6227
|
+
/* @__PURE__ */ jsx10("svg", { className: "vpg-icon", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx10(
|
|
5869
6228
|
"path",
|
|
5870
6229
|
{
|
|
5871
6230
|
fillRule: "evenodd",
|
|
@@ -5873,28 +6232,28 @@ function DataGrid({
|
|
|
5873
6232
|
clipRule: "evenodd"
|
|
5874
6233
|
}
|
|
5875
6234
|
) }),
|
|
5876
|
-
/* @__PURE__ */
|
|
6235
|
+
/* @__PURE__ */ jsxs10("span", { children: [
|
|
5877
6236
|
activeFilterCount,
|
|
5878
6237
|
" ",
|
|
5879
6238
|
"filter",
|
|
5880
6239
|
activeFilterCount > 1 ? "s" : ""
|
|
5881
6240
|
] })
|
|
5882
6241
|
] }),
|
|
5883
|
-
globalSearchTerm && /* @__PURE__ */
|
|
6242
|
+
globalSearchTerm && /* @__PURE__ */ jsx10("div", { className: "vpg-search-info", children: /* @__PURE__ */ jsxs10("span", { children: [
|
|
5884
6243
|
totalSearchedRows,
|
|
5885
6244
|
" ",
|
|
5886
6245
|
"match",
|
|
5887
6246
|
totalSearchedRows !== 1 ? "es" : ""
|
|
5888
6247
|
] }) })
|
|
5889
6248
|
] }),
|
|
5890
|
-
viewMode === "pivot" && canUsePivot && /* @__PURE__ */
|
|
5891
|
-
/* @__PURE__ */
|
|
6249
|
+
viewMode === "pivot" && canUsePivot && /* @__PURE__ */ jsxs10(Fragment7, { children: [
|
|
6250
|
+
/* @__PURE__ */ jsxs10(
|
|
5892
6251
|
"button",
|
|
5893
6252
|
{
|
|
5894
6253
|
className: `vpg-config-toggle ${showPivotConfig ? "active" : ""}`,
|
|
5895
6254
|
onClick: () => setShowPivotConfig(!showPivotConfig),
|
|
5896
6255
|
children: [
|
|
5897
|
-
/* @__PURE__ */
|
|
6256
|
+
/* @__PURE__ */ jsx10("svg", { className: "vpg-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10(
|
|
5898
6257
|
"path",
|
|
5899
6258
|
{
|
|
5900
6259
|
strokeLinecap: "round",
|
|
@@ -5909,8 +6268,8 @@ function DataGrid({
|
|
|
5909
6268
|
]
|
|
5910
6269
|
}
|
|
5911
6270
|
),
|
|
5912
|
-
pivotIsConfigured && /* @__PURE__ */
|
|
5913
|
-
/* @__PURE__ */
|
|
6271
|
+
pivotIsConfigured && /* @__PURE__ */ jsxs10("div", { className: "vpg-pivot-status", children: [
|
|
6272
|
+
/* @__PURE__ */ jsx10("svg", { className: "vpg-icon", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx10(
|
|
5914
6273
|
"path",
|
|
5915
6274
|
{
|
|
5916
6275
|
fillRule: "evenodd",
|
|
@@ -5918,13 +6277,13 @@ function DataGrid({
|
|
|
5918
6277
|
clipRule: "evenodd"
|
|
5919
6278
|
}
|
|
5920
6279
|
) }),
|
|
5921
|
-
/* @__PURE__ */
|
|
6280
|
+
/* @__PURE__ */ jsx10("span", { children: "Pivot configured" })
|
|
5922
6281
|
] })
|
|
5923
6282
|
] })
|
|
5924
6283
|
] }),
|
|
5925
|
-
/* @__PURE__ */
|
|
5926
|
-
viewMode === "grid" && activeFilterCount > 0 && /* @__PURE__ */
|
|
5927
|
-
/* @__PURE__ */
|
|
6284
|
+
/* @__PURE__ */ jsxs10("div", { className: "vpg-toolbar-right", children: [
|
|
6285
|
+
viewMode === "grid" && activeFilterCount > 0 && /* @__PURE__ */ jsxs10("button", { className: "vpg-clear-filters", onClick: clearAllFilters, children: [
|
|
6286
|
+
/* @__PURE__ */ jsx10("svg", { className: "vpg-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10(
|
|
5928
6287
|
"path",
|
|
5929
6288
|
{
|
|
5930
6289
|
strokeLinecap: "round",
|
|
@@ -5935,7 +6294,7 @@ function DataGrid({
|
|
|
5935
6294
|
) }),
|
|
5936
6295
|
"Clear Filters"
|
|
5937
6296
|
] }),
|
|
5938
|
-
viewMode === "grid" && isShowingAIData && /* @__PURE__ */
|
|
6297
|
+
viewMode === "grid" && isShowingAIData && /* @__PURE__ */ jsxs10(
|
|
5939
6298
|
"button",
|
|
5940
6299
|
{
|
|
5941
6300
|
className: `vpg-reset-data-btn${isLoadingFullData ? " vpg-loading-btn" : ""}`,
|
|
@@ -5943,7 +6302,7 @@ function DataGrid({
|
|
|
5943
6302
|
title: "Reset to full dataset",
|
|
5944
6303
|
onClick: resetToFullData,
|
|
5945
6304
|
children: [
|
|
5946
|
-
/* @__PURE__ */
|
|
6305
|
+
/* @__PURE__ */ jsx10("svg", { className: `vpg-icon${isLoadingFullData ? " vpg-spin" : ""}`, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10(
|
|
5947
6306
|
"path",
|
|
5948
6307
|
{
|
|
5949
6308
|
strokeLinecap: "round",
|
|
@@ -5952,17 +6311,17 @@ function DataGrid({
|
|
|
5952
6311
|
d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
|
|
5953
6312
|
}
|
|
5954
6313
|
) }),
|
|
5955
|
-
/* @__PURE__ */
|
|
6314
|
+
/* @__PURE__ */ jsx10("span", { children: isLoadingFullData ? "Loading..." : "Full Data" })
|
|
5956
6315
|
]
|
|
5957
6316
|
}
|
|
5958
6317
|
),
|
|
5959
|
-
enableClipboard && selectionBounds && viewMode === "grid" && /* @__PURE__ */
|
|
6318
|
+
enableClipboard && selectionBounds && viewMode === "grid" && /* @__PURE__ */ jsx10(
|
|
5960
6319
|
"button",
|
|
5961
6320
|
{
|
|
5962
6321
|
className: "vpg-icon-btn",
|
|
5963
6322
|
title: "Copy selection (Ctrl+C)",
|
|
5964
6323
|
onClick: copySelectionToClipboard,
|
|
5965
|
-
children: /* @__PURE__ */
|
|
6324
|
+
children: /* @__PURE__ */ jsx10("svg", { className: "vpg-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10(
|
|
5966
6325
|
"path",
|
|
5967
6326
|
{
|
|
5968
6327
|
strokeLinecap: "round",
|
|
@@ -5973,14 +6332,14 @@ function DataGrid({
|
|
|
5973
6332
|
) })
|
|
5974
6333
|
}
|
|
5975
6334
|
),
|
|
5976
|
-
enableExport && viewMode === "grid" && /* @__PURE__ */
|
|
6335
|
+
enableExport && viewMode === "grid" && /* @__PURE__ */ jsxs10(
|
|
5977
6336
|
"button",
|
|
5978
6337
|
{
|
|
5979
6338
|
className: "vpg-export-btn",
|
|
5980
6339
|
title: "Export to CSV",
|
|
5981
6340
|
onClick: handleExport,
|
|
5982
6341
|
children: [
|
|
5983
|
-
/* @__PURE__ */
|
|
6342
|
+
/* @__PURE__ */ jsx10("svg", { className: "vpg-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10(
|
|
5984
6343
|
"path",
|
|
5985
6344
|
{
|
|
5986
6345
|
strokeLinecap: "round",
|
|
@@ -5993,7 +6352,7 @@ function DataGrid({
|
|
|
5993
6352
|
]
|
|
5994
6353
|
}
|
|
5995
6354
|
),
|
|
5996
|
-
enableExport && viewMode === "pivot" && pivotIsConfigured && /* @__PURE__ */
|
|
6355
|
+
enableExport && viewMode === "pivot" && pivotIsConfigured && /* @__PURE__ */ jsxs10(
|
|
5997
6356
|
"button",
|
|
5998
6357
|
{
|
|
5999
6358
|
className: `vpg-export-btn ${!isPro ? "vpg-export-btn-disabled" : ""}`,
|
|
@@ -6001,7 +6360,7 @@ function DataGrid({
|
|
|
6001
6360
|
title: isPro ? "Export Pivot to CSV" : "Export Pivot to CSV (Pro feature)",
|
|
6002
6361
|
onClick: () => isPro && handleExport(),
|
|
6003
6362
|
children: [
|
|
6004
|
-
/* @__PURE__ */
|
|
6363
|
+
/* @__PURE__ */ jsx10("svg", { className: "vpg-icon", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10(
|
|
6005
6364
|
"path",
|
|
6006
6365
|
{
|
|
6007
6366
|
strokeLinecap: "round",
|
|
@@ -6017,7 +6376,7 @@ function DataGrid({
|
|
|
6017
6376
|
)
|
|
6018
6377
|
] })
|
|
6019
6378
|
] }),
|
|
6020
|
-
showAIAnalyst && aiAnalyst && /* @__PURE__ */
|
|
6379
|
+
showAIAnalyst && aiAnalyst && /* @__PURE__ */ jsx10("div", { className: "vpg-ai-view", style: { display: viewMode === "ai" ? void 0 : "none" }, children: /* @__PURE__ */ jsx10(
|
|
6021
6380
|
AIAnalyst,
|
|
6022
6381
|
{
|
|
6023
6382
|
ref: aiAnalystRef,
|
|
@@ -6029,13 +6388,13 @@ function DataGrid({
|
|
|
6029
6388
|
onError: handleAIError
|
|
6030
6389
|
}
|
|
6031
6390
|
) }),
|
|
6032
|
-
viewMode === "grid" && /* @__PURE__ */
|
|
6033
|
-
loading && /* @__PURE__ */
|
|
6034
|
-
/* @__PURE__ */
|
|
6035
|
-
/* @__PURE__ */
|
|
6391
|
+
viewMode === "grid" && /* @__PURE__ */ jsxs10("div", { ref: tableContainerRef, className: "vpg-grid-container", tabIndex: 0, children: [
|
|
6392
|
+
loading && /* @__PURE__ */ jsxs10("div", { className: "vpg-loading", children: [
|
|
6393
|
+
/* @__PURE__ */ jsx10("div", { className: "vpg-spinner" }),
|
|
6394
|
+
/* @__PURE__ */ jsx10("span", { children: "Loading data..." })
|
|
6036
6395
|
] }),
|
|
6037
|
-
!loading && displayData.length === 0 && /* @__PURE__ */
|
|
6038
|
-
/* @__PURE__ */
|
|
6396
|
+
!loading && displayData.length === 0 && /* @__PURE__ */ jsxs10("div", { className: "vpg-empty", children: [
|
|
6397
|
+
/* @__PURE__ */ jsx10("div", { className: "vpg-empty-icon", children: /* @__PURE__ */ jsx10("svg", { className: "vpg-icon-lg", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10(
|
|
6039
6398
|
"path",
|
|
6040
6399
|
{
|
|
6041
6400
|
strokeLinecap: "round",
|
|
@@ -6044,10 +6403,10 @@ function DataGrid({
|
|
|
6044
6403
|
d: "M9 17v-2m3 2v-4m3 4v-6m2 10H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
|
|
6045
6404
|
}
|
|
6046
6405
|
) }) }),
|
|
6047
|
-
/* @__PURE__ */
|
|
6406
|
+
/* @__PURE__ */ jsx10("span", { children: "No data available" })
|
|
6048
6407
|
] }),
|
|
6049
|
-
!loading && displayData.length > 0 && filteredRowCount === 0 && /* @__PURE__ */
|
|
6050
|
-
/* @__PURE__ */
|
|
6408
|
+
!loading && displayData.length > 0 && filteredRowCount === 0 && /* @__PURE__ */ jsxs10("div", { className: "vpg-empty", children: [
|
|
6409
|
+
/* @__PURE__ */ jsx10("div", { className: "vpg-empty-icon vpg-warning", children: /* @__PURE__ */ jsx10("svg", { className: "vpg-icon-lg", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10(
|
|
6051
6410
|
"path",
|
|
6052
6411
|
{
|
|
6053
6412
|
strokeLinecap: "round",
|
|
@@ -6056,11 +6415,11 @@ function DataGrid({
|
|
|
6056
6415
|
d: "M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z"
|
|
6057
6416
|
}
|
|
6058
6417
|
) }) }),
|
|
6059
|
-
/* @__PURE__ */
|
|
6060
|
-
/* @__PURE__ */
|
|
6418
|
+
/* @__PURE__ */ jsx10("span", { children: "No matching records" }),
|
|
6419
|
+
/* @__PURE__ */ jsx10("button", { className: "vpg-clear-link", onClick: clearAllFilters, children: "Clear all filters" })
|
|
6061
6420
|
] }),
|
|
6062
|
-
!loading && filteredRowCount > 0 && /* @__PURE__ */
|
|
6063
|
-
/* @__PURE__ */
|
|
6421
|
+
!loading && filteredRowCount > 0 && /* @__PURE__ */ jsx10("div", { className: "vpg-table-wrapper", children: /* @__PURE__ */ jsxs10("table", { className: "vpg-table", style: { minWidth: `${totalTableWidth}px` }, children: [
|
|
6422
|
+
/* @__PURE__ */ jsx10("thead", { children: /* @__PURE__ */ jsx10("tr", { children: columnKeys.map((colId) => /* @__PURE__ */ jsxs10(
|
|
6064
6423
|
"th",
|
|
6065
6424
|
{
|
|
6066
6425
|
className: `vpg-header-cell ${hasActiveFilter(colId) ? "vpg-has-filter" : ""} ${getSortDirection(colId) !== null ? "vpg-is-sorted" : ""} ${activeFilterColumn === colId ? "vpg-is-active" : ""}`,
|
|
@@ -6075,16 +6434,16 @@ function DataGrid({
|
|
|
6075
6434
|
}
|
|
6076
6435
|
},
|
|
6077
6436
|
children: [
|
|
6078
|
-
/* @__PURE__ */
|
|
6079
|
-
/* @__PURE__ */
|
|
6080
|
-
/* @__PURE__ */
|
|
6081
|
-
getSortDirection(colId) && /* @__PURE__ */
|
|
6437
|
+
/* @__PURE__ */ jsxs10("div", { className: "vpg-header-content", children: [
|
|
6438
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-header-text", children: colId }),
|
|
6439
|
+
/* @__PURE__ */ jsxs10("div", { className: "vpg-header-icons", children: [
|
|
6440
|
+
getSortDirection(colId) && /* @__PURE__ */ jsx10("span", { className: "vpg-sort-indicator", children: getSortDirection(colId) === "asc" ? /* @__PURE__ */ jsx10(
|
|
6082
6441
|
"svg",
|
|
6083
6442
|
{
|
|
6084
6443
|
className: "vpg-icon-sm",
|
|
6085
6444
|
fill: "currentColor",
|
|
6086
6445
|
viewBox: "0 0 20 20",
|
|
6087
|
-
children: /* @__PURE__ */
|
|
6446
|
+
children: /* @__PURE__ */ jsx10(
|
|
6088
6447
|
"path",
|
|
6089
6448
|
{
|
|
6090
6449
|
fillRule: "evenodd",
|
|
@@ -6093,13 +6452,13 @@ function DataGrid({
|
|
|
6093
6452
|
}
|
|
6094
6453
|
)
|
|
6095
6454
|
}
|
|
6096
|
-
) : /* @__PURE__ */
|
|
6455
|
+
) : /* @__PURE__ */ jsx10(
|
|
6097
6456
|
"svg",
|
|
6098
6457
|
{
|
|
6099
6458
|
className: "vpg-icon-sm",
|
|
6100
6459
|
fill: "currentColor",
|
|
6101
6460
|
viewBox: "0 0 20 20",
|
|
6102
|
-
children: /* @__PURE__ */
|
|
6461
|
+
children: /* @__PURE__ */ jsx10(
|
|
6103
6462
|
"path",
|
|
6104
6463
|
{
|
|
6105
6464
|
fillRule: "evenodd",
|
|
@@ -6109,13 +6468,13 @@ function DataGrid({
|
|
|
6109
6468
|
)
|
|
6110
6469
|
}
|
|
6111
6470
|
) }),
|
|
6112
|
-
hasActiveFilter(colId) && /* @__PURE__ */
|
|
6471
|
+
hasActiveFilter(colId) && /* @__PURE__ */ jsx10("span", { className: "vpg-filter-indicator", children: /* @__PURE__ */ jsx10(
|
|
6113
6472
|
"svg",
|
|
6114
6473
|
{
|
|
6115
6474
|
className: "vpg-icon-xs",
|
|
6116
6475
|
fill: "currentColor",
|
|
6117
6476
|
viewBox: "0 0 20 20",
|
|
6118
|
-
children: /* @__PURE__ */
|
|
6477
|
+
children: /* @__PURE__ */ jsx10(
|
|
6119
6478
|
"path",
|
|
6120
6479
|
{
|
|
6121
6480
|
fillRule: "evenodd",
|
|
@@ -6125,14 +6484,14 @@ function DataGrid({
|
|
|
6125
6484
|
)
|
|
6126
6485
|
}
|
|
6127
6486
|
) }),
|
|
6128
|
-
/* @__PURE__ */
|
|
6487
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-dropdown-arrow", title: "Filter & Sort", children: /* @__PURE__ */ jsx10(
|
|
6129
6488
|
"svg",
|
|
6130
6489
|
{
|
|
6131
6490
|
className: "vpg-icon-sm",
|
|
6132
6491
|
fill: "none",
|
|
6133
6492
|
stroke: "currentColor",
|
|
6134
6493
|
viewBox: "0 0 24 24",
|
|
6135
|
-
children: /* @__PURE__ */
|
|
6494
|
+
children: /* @__PURE__ */ jsx10(
|
|
6136
6495
|
"path",
|
|
6137
6496
|
{
|
|
6138
6497
|
strokeLinecap: "round",
|
|
@@ -6145,7 +6504,7 @@ function DataGrid({
|
|
|
6145
6504
|
) })
|
|
6146
6505
|
] })
|
|
6147
6506
|
] }),
|
|
6148
|
-
enableColumnResize && /* @__PURE__ */
|
|
6507
|
+
enableColumnResize && /* @__PURE__ */ jsx10(
|
|
6149
6508
|
"div",
|
|
6150
6509
|
{
|
|
6151
6510
|
className: "vpg-resize-handle",
|
|
@@ -6156,7 +6515,7 @@ function DataGrid({
|
|
|
6156
6515
|
},
|
|
6157
6516
|
colId
|
|
6158
6517
|
)) }) }),
|
|
6159
|
-
/* @__PURE__ */
|
|
6518
|
+
/* @__PURE__ */ jsx10("tbody", { ref: tableBodyRef, children: paginatedRows.map((row, rowIndex) => /* @__PURE__ */ jsx10("tr", { className: "vpg-row", children: columnKeys.map((colId, colIndex) => /* @__PURE__ */ jsx10(
|
|
6160
6519
|
"td",
|
|
6161
6520
|
{
|
|
6162
6521
|
className: `vpg-cell ${isCellSelected(rowIndex, colIndex) ? "vpg-selected" : ""} ${getColumnStats(colId).type === "number" ? "vpg-is-number" : ""}`,
|
|
@@ -6174,8 +6533,8 @@ function DataGrid({
|
|
|
6174
6533
|
)) }, row.id)) })
|
|
6175
6534
|
] }) })
|
|
6176
6535
|
] }),
|
|
6177
|
-
viewMode === "pivot" && /* @__PURE__ */
|
|
6178
|
-
showPivotConfig && canUsePivot && /* @__PURE__ */
|
|
6536
|
+
viewMode === "pivot" && /* @__PURE__ */ jsxs10("div", { className: "vpg-pivot-container", children: [
|
|
6537
|
+
showPivotConfig && canUsePivot && /* @__PURE__ */ jsx10("div", { className: "vpg-pivot-config-panel", children: /* @__PURE__ */ jsx10(
|
|
6179
6538
|
PivotConfig,
|
|
6180
6539
|
{
|
|
6181
6540
|
availableFields: pivotAvailableFields,
|
|
@@ -6204,37 +6563,55 @@ function DataGrid({
|
|
|
6204
6563
|
theme: currentTheme
|
|
6205
6564
|
}
|
|
6206
6565
|
) }),
|
|
6207
|
-
/* @__PURE__ */
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6566
|
+
/* @__PURE__ */ jsxs10("div", { className: `vpg-pivot-main ${!showPivotConfig ? "vpg-full-width" : ""}`, children: [
|
|
6567
|
+
/* @__PURE__ */ jsx10(
|
|
6568
|
+
PivotSkeleton,
|
|
6569
|
+
{
|
|
6570
|
+
rowFields: pivotRowFields,
|
|
6571
|
+
columnFields: pivotColumnFields,
|
|
6572
|
+
valueFields: pivotValueFields,
|
|
6573
|
+
calculatedFields: pivotCalculatedFields,
|
|
6574
|
+
isConfigured: pivotIsConfigured,
|
|
6575
|
+
draggingField,
|
|
6576
|
+
pivotResult,
|
|
6577
|
+
fontSize: currentFontSize,
|
|
6578
|
+
activeFilters: activeFilterInfo,
|
|
6579
|
+
totalRowCount,
|
|
6580
|
+
filteredRowCount,
|
|
6581
|
+
enableDrillDown,
|
|
6582
|
+
enableDrillThrough,
|
|
6583
|
+
onAddRowField: addRowField,
|
|
6584
|
+
onRemoveRowField: removeRowField,
|
|
6585
|
+
onAddColumnField: addColumnField,
|
|
6586
|
+
onRemoveColumnField: removeColumnField,
|
|
6587
|
+
onAddValueField: addValueField,
|
|
6588
|
+
onRemoveValueField: removeValueField,
|
|
6589
|
+
onUpdateAggregation: updateValueFieldAggregation,
|
|
6590
|
+
onReorderRowFields: setRowFields,
|
|
6591
|
+
onReorderColumnFields: setColumnFields,
|
|
6592
|
+
onToggleCollapse: handleToggleCollapse,
|
|
6593
|
+
onDrillThroughCell: handleDrillThroughCell,
|
|
6594
|
+
theme: currentTheme
|
|
6595
|
+
}
|
|
6596
|
+
),
|
|
6597
|
+
/* @__PURE__ */ jsx10(
|
|
6598
|
+
DrillThroughModal,
|
|
6599
|
+
{
|
|
6600
|
+
show: showDrillThroughModal,
|
|
6601
|
+
result: drillThroughResult,
|
|
6602
|
+
rowFields: pivotRowFields,
|
|
6603
|
+
columnFields: pivotColumnFields,
|
|
6604
|
+
valueFields: pivotValueFields,
|
|
6605
|
+
theme: currentTheme,
|
|
6606
|
+
onClose: handleCloseDrillThroughModal
|
|
6607
|
+
}
|
|
6608
|
+
)
|
|
6609
|
+
] })
|
|
6233
6610
|
] }),
|
|
6234
|
-
viewMode === "chart" && /* @__PURE__ */
|
|
6235
|
-
activeFilterInfo && activeFilterInfo.length > 0 && /* @__PURE__ */
|
|
6236
|
-
/* @__PURE__ */
|
|
6237
|
-
/* @__PURE__ */
|
|
6611
|
+
viewMode === "chart" && /* @__PURE__ */ jsxs10("div", { className: "vpg-chart-view", children: [
|
|
6612
|
+
activeFilterInfo && activeFilterInfo.length > 0 && /* @__PURE__ */ jsxs10("div", { className: "vpg-chart-filter-bar", children: [
|
|
6613
|
+
/* @__PURE__ */ jsx10("svg", { className: "vpg-icon", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx10("path", { fillRule: "evenodd", d: "M3 3a1 1 0 011-1h12a1 1 0 011 1v3a1 1 0 01-.293.707L12 11.414V15a1 1 0 01-.293.707l-2 2A1 1 0 018 17v-5.586L3.293 6.707A1 1 0 013 6V3z", clipRule: "evenodd" }) }),
|
|
6614
|
+
/* @__PURE__ */ jsxs10("span", { children: [
|
|
6238
6615
|
"Chart showing",
|
|
6239
6616
|
filteredRowCount.toLocaleString(),
|
|
6240
6617
|
" ",
|
|
@@ -6243,9 +6620,9 @@ function DataGrid({
|
|
|
6243
6620
|
" ",
|
|
6244
6621
|
"records"
|
|
6245
6622
|
] }),
|
|
6246
|
-
/* @__PURE__ */
|
|
6623
|
+
/* @__PURE__ */ jsx10("button", { className: "vpg-chart-clear-filters", onClick: clearAllFilters, children: "Clear filters" })
|
|
6247
6624
|
] }),
|
|
6248
|
-
/* @__PURE__ */
|
|
6625
|
+
/* @__PURE__ */ jsx10(
|
|
6249
6626
|
ChartBuilder,
|
|
6250
6627
|
{
|
|
6251
6628
|
data: filteredDataForPivot,
|
|
@@ -6255,55 +6632,55 @@ function DataGrid({
|
|
|
6255
6632
|
}
|
|
6256
6633
|
)
|
|
6257
6634
|
] }),
|
|
6258
|
-
/* @__PURE__ */
|
|
6259
|
-
/* @__PURE__ */
|
|
6260
|
-
/* @__PURE__ */
|
|
6635
|
+
/* @__PURE__ */ jsxs10("div", { className: "vpg-footer", children: [
|
|
6636
|
+
/* @__PURE__ */ jsx10("div", { className: "vpg-footer-left", children: viewMode === "grid" ? enablePagination ? /* @__PURE__ */ jsxs10(Fragment7, { children: [
|
|
6637
|
+
/* @__PURE__ */ jsxs10("span", { children: [
|
|
6261
6638
|
((currentPage - 1) * pageSize + 1).toLocaleString(),
|
|
6262
6639
|
"-",
|
|
6263
6640
|
Math.min(currentPage * pageSize, totalSearchedRows).toLocaleString()
|
|
6264
6641
|
] }),
|
|
6265
|
-
/* @__PURE__ */
|
|
6266
|
-
/* @__PURE__ */
|
|
6267
|
-
totalSearchedRows !== totalRowCount && /* @__PURE__ */
|
|
6642
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-separator", children: "of" }),
|
|
6643
|
+
/* @__PURE__ */ jsx10("span", { children: totalSearchedRows.toLocaleString() }),
|
|
6644
|
+
totalSearchedRows !== totalRowCount && /* @__PURE__ */ jsxs10("span", { className: "vpg-filtered-note", children: [
|
|
6268
6645
|
"(",
|
|
6269
6646
|
totalRowCount.toLocaleString(),
|
|
6270
6647
|
" ",
|
|
6271
6648
|
"total)"
|
|
6272
6649
|
] })
|
|
6273
|
-
] }) : filteredRowCount === totalRowCount && totalSearchedRows === totalRowCount ? /* @__PURE__ */
|
|
6650
|
+
] }) : filteredRowCount === totalRowCount && totalSearchedRows === totalRowCount ? /* @__PURE__ */ jsxs10("span", { children: [
|
|
6274
6651
|
totalRowCount.toLocaleString(),
|
|
6275
6652
|
" ",
|
|
6276
6653
|
"records"
|
|
6277
|
-
] }) : /* @__PURE__ */
|
|
6278
|
-
/* @__PURE__ */
|
|
6279
|
-
/* @__PURE__ */
|
|
6280
|
-
/* @__PURE__ */
|
|
6281
|
-
/* @__PURE__ */
|
|
6282
|
-
] }) : viewMode === "pivot" ? /* @__PURE__ */
|
|
6283
|
-
/* @__PURE__ */
|
|
6284
|
-
/* @__PURE__ */
|
|
6285
|
-
/* @__PURE__ */
|
|
6654
|
+
] }) : /* @__PURE__ */ jsxs10(Fragment7, { children: [
|
|
6655
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-filtered-count", children: totalSearchedRows.toLocaleString() }),
|
|
6656
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-separator", children: "of" }),
|
|
6657
|
+
/* @__PURE__ */ jsx10("span", { children: totalRowCount.toLocaleString() }),
|
|
6658
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-separator", children: "records" })
|
|
6659
|
+
] }) : viewMode === "pivot" ? /* @__PURE__ */ jsxs10(Fragment7, { children: [
|
|
6660
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-pivot-label", children: "Pivot Table" }),
|
|
6661
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-separator", children: "\u2022" }),
|
|
6662
|
+
/* @__PURE__ */ jsxs10("span", { children: [
|
|
6286
6663
|
totalRowCount.toLocaleString(),
|
|
6287
6664
|
" ",
|
|
6288
6665
|
"source records"
|
|
6289
6666
|
] })
|
|
6290
|
-
] }) : /* @__PURE__ */
|
|
6291
|
-
/* @__PURE__ */
|
|
6292
|
-
/* @__PURE__ */
|
|
6293
|
-
/* @__PURE__ */
|
|
6667
|
+
] }) : /* @__PURE__ */ jsxs10(Fragment7, { children: [
|
|
6668
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-chart-label", children: "Chart Builder" }),
|
|
6669
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-separator", children: "\u2022" }),
|
|
6670
|
+
/* @__PURE__ */ jsxs10("span", { children: [
|
|
6294
6671
|
totalRowCount.toLocaleString(),
|
|
6295
6672
|
" ",
|
|
6296
6673
|
"records"
|
|
6297
6674
|
] })
|
|
6298
6675
|
] }) }),
|
|
6299
|
-
enablePagination && viewMode === "grid" && totalPages > 1 && /* @__PURE__ */
|
|
6300
|
-
/* @__PURE__ */
|
|
6676
|
+
enablePagination && viewMode === "grid" && totalPages > 1 && /* @__PURE__ */ jsxs10("div", { className: "vpg-pagination", children: [
|
|
6677
|
+
/* @__PURE__ */ jsx10(
|
|
6301
6678
|
"button",
|
|
6302
6679
|
{
|
|
6303
6680
|
className: "vpg-page-btn",
|
|
6304
6681
|
disabled: currentPage === 1,
|
|
6305
6682
|
onClick: () => setCurrentPage(1),
|
|
6306
|
-
children: /* @__PURE__ */
|
|
6683
|
+
children: /* @__PURE__ */ jsx10("svg", { className: "vpg-icon-sm", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10(
|
|
6307
6684
|
"path",
|
|
6308
6685
|
{
|
|
6309
6686
|
strokeLinecap: "round",
|
|
@@ -6314,13 +6691,13 @@ function DataGrid({
|
|
|
6314
6691
|
) })
|
|
6315
6692
|
}
|
|
6316
6693
|
),
|
|
6317
|
-
/* @__PURE__ */
|
|
6694
|
+
/* @__PURE__ */ jsx10(
|
|
6318
6695
|
"button",
|
|
6319
6696
|
{
|
|
6320
6697
|
className: "vpg-page-btn",
|
|
6321
6698
|
disabled: currentPage === 1,
|
|
6322
6699
|
onClick: () => setCurrentPage((p) => Math.max(1, p - 1)),
|
|
6323
|
-
children: /* @__PURE__ */
|
|
6700
|
+
children: /* @__PURE__ */ jsx10("svg", { className: "vpg-icon-sm", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10(
|
|
6324
6701
|
"path",
|
|
6325
6702
|
{
|
|
6326
6703
|
strokeLinecap: "round",
|
|
@@ -6331,7 +6708,7 @@ function DataGrid({
|
|
|
6331
6708
|
) })
|
|
6332
6709
|
}
|
|
6333
6710
|
),
|
|
6334
|
-
/* @__PURE__ */
|
|
6711
|
+
/* @__PURE__ */ jsxs10("span", { className: "vpg-page-info", children: [
|
|
6335
6712
|
"Page",
|
|
6336
6713
|
" ",
|
|
6337
6714
|
currentPage,
|
|
@@ -6340,13 +6717,13 @@ function DataGrid({
|
|
|
6340
6717
|
" ",
|
|
6341
6718
|
totalPages
|
|
6342
6719
|
] }),
|
|
6343
|
-
/* @__PURE__ */
|
|
6720
|
+
/* @__PURE__ */ jsx10(
|
|
6344
6721
|
"button",
|
|
6345
6722
|
{
|
|
6346
6723
|
className: "vpg-page-btn",
|
|
6347
6724
|
disabled: currentPage === totalPages,
|
|
6348
6725
|
onClick: () => setCurrentPage((p) => Math.min(totalPages, p + 1)),
|
|
6349
|
-
children: /* @__PURE__ */
|
|
6726
|
+
children: /* @__PURE__ */ jsx10("svg", { className: "vpg-icon-sm", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10(
|
|
6350
6727
|
"path",
|
|
6351
6728
|
{
|
|
6352
6729
|
strokeLinecap: "round",
|
|
@@ -6357,13 +6734,13 @@ function DataGrid({
|
|
|
6357
6734
|
) })
|
|
6358
6735
|
}
|
|
6359
6736
|
),
|
|
6360
|
-
/* @__PURE__ */
|
|
6737
|
+
/* @__PURE__ */ jsx10(
|
|
6361
6738
|
"button",
|
|
6362
6739
|
{
|
|
6363
6740
|
className: "vpg-page-btn",
|
|
6364
6741
|
disabled: currentPage === totalPages,
|
|
6365
6742
|
onClick: () => setCurrentPage(totalPages),
|
|
6366
|
-
children: /* @__PURE__ */
|
|
6743
|
+
children: /* @__PURE__ */ jsx10("svg", { className: "vpg-icon-sm", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx10(
|
|
6367
6744
|
"path",
|
|
6368
6745
|
{
|
|
6369
6746
|
strokeLinecap: "round",
|
|
@@ -6375,45 +6752,45 @@ function DataGrid({
|
|
|
6375
6752
|
}
|
|
6376
6753
|
)
|
|
6377
6754
|
] }),
|
|
6378
|
-
viewMode === "grid" && selectionStats && selectionStats.count > 1 && /* @__PURE__ */
|
|
6379
|
-
/* @__PURE__ */
|
|
6380
|
-
/* @__PURE__ */
|
|
6381
|
-
/* @__PURE__ */
|
|
6755
|
+
viewMode === "grid" && selectionStats && selectionStats.count > 1 && /* @__PURE__ */ jsxs10("div", { className: "vpg-selection-stats", children: [
|
|
6756
|
+
/* @__PURE__ */ jsxs10("span", { className: "vpg-stat", children: [
|
|
6757
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-stat-label", children: "Count:" }),
|
|
6758
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-stat-value", children: selectionStats.count })
|
|
6382
6759
|
] }),
|
|
6383
|
-
selectionStats.numericCount > 0 && /* @__PURE__ */
|
|
6384
|
-
/* @__PURE__ */
|
|
6385
|
-
/* @__PURE__ */
|
|
6386
|
-
/* @__PURE__ */
|
|
6387
|
-
/* @__PURE__ */
|
|
6760
|
+
selectionStats.numericCount > 0 && /* @__PURE__ */ jsxs10(Fragment7, { children: [
|
|
6761
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-stat-divider", children: "|" }),
|
|
6762
|
+
/* @__PURE__ */ jsxs10("span", { className: "vpg-stat", children: [
|
|
6763
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-stat-label", children: "Sum:" }),
|
|
6764
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-stat-value", children: formatStatValue(selectionStats.sum) })
|
|
6388
6765
|
] }),
|
|
6389
|
-
/* @__PURE__ */
|
|
6390
|
-
/* @__PURE__ */
|
|
6391
|
-
/* @__PURE__ */
|
|
6392
|
-
/* @__PURE__ */
|
|
6766
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-stat-divider", children: "|" }),
|
|
6767
|
+
/* @__PURE__ */ jsxs10("span", { className: "vpg-stat", children: [
|
|
6768
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-stat-label", children: "Avg:" }),
|
|
6769
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-stat-value", children: formatStatValue(selectionStats.avg) })
|
|
6393
6770
|
] })
|
|
6394
6771
|
] })
|
|
6395
6772
|
] }),
|
|
6396
|
-
/* @__PURE__ */
|
|
6397
|
-
/* @__PURE__ */
|
|
6398
|
-
/* @__PURE__ */
|
|
6399
|
-
/* @__PURE__ */
|
|
6400
|
-
] }) : showWatermark ? /* @__PURE__ */
|
|
6401
|
-
/* @__PURE__ */
|
|
6402
|
-
/* @__PURE__ */
|
|
6403
|
-
/* @__PURE__ */
|
|
6404
|
-
/* @__PURE__ */
|
|
6405
|
-
/* @__PURE__ */
|
|
6773
|
+
/* @__PURE__ */ jsx10("div", { className: "vpg-footer-right", children: isDemo ? /* @__PURE__ */ jsxs10("div", { className: "vpg-demo-banner", children: [
|
|
6774
|
+
/* @__PURE__ */ jsx10("span", { className: "vpg-demo-badge", children: "DEMO" }),
|
|
6775
|
+
/* @__PURE__ */ jsx10("span", { children: "Pro features enabled" }),
|
|
6776
|
+
/* @__PURE__ */ jsx10("a", { href: "https://tiny-pivot.com/#pricing", target: "_blank", rel: "noopener noreferrer", children: "Get License \u2192" })
|
|
6777
|
+
] }) : showWatermark ? /* @__PURE__ */ jsx10("span", { className: "vpg-watermark-inline", children: /* @__PURE__ */ jsxs10("a", { href: "https://tiny-pivot.com", target: "_blank", rel: "noopener noreferrer", children: [
|
|
6778
|
+
/* @__PURE__ */ jsxs10("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
6779
|
+
/* @__PURE__ */ jsx10("rect", { x: "3", y: "3", width: "7", height: "7" }),
|
|
6780
|
+
/* @__PURE__ */ jsx10("rect", { x: "14", y: "3", width: "7", height: "7" }),
|
|
6781
|
+
/* @__PURE__ */ jsx10("rect", { x: "14", y: "14", width: "7", height: "7" }),
|
|
6782
|
+
/* @__PURE__ */ jsx10("rect", { x: "3", y: "14", width: "7", height: "7" })
|
|
6406
6783
|
] }),
|
|
6407
6784
|
"Powered by TinyPivot"
|
|
6408
6785
|
] }) }) : null })
|
|
6409
6786
|
] }),
|
|
6410
|
-
enableVerticalResize && /* @__PURE__ */
|
|
6411
|
-
/* @__PURE__ */
|
|
6412
|
-
/* @__PURE__ */
|
|
6413
|
-
/* @__PURE__ */
|
|
6787
|
+
enableVerticalResize && /* @__PURE__ */ jsx10("div", { className: "vpg-vertical-resize-handle", onMouseDown: startVerticalResize, children: /* @__PURE__ */ jsxs10("div", { className: "vpg-resize-grip", children: [
|
|
6788
|
+
/* @__PURE__ */ jsx10("span", {}),
|
|
6789
|
+
/* @__PURE__ */ jsx10("span", {}),
|
|
6790
|
+
/* @__PURE__ */ jsx10("span", {})
|
|
6414
6791
|
] }) }),
|
|
6415
|
-
activeFilterColumn && typeof document !== "undefined" &&
|
|
6416
|
-
/* @__PURE__ */
|
|
6792
|
+
activeFilterColumn && typeof document !== "undefined" && createPortal3(
|
|
6793
|
+
/* @__PURE__ */ jsx10(
|
|
6417
6794
|
"div",
|
|
6418
6795
|
{
|
|
6419
6796
|
className: "vpg-filter-portal",
|
|
@@ -6424,7 +6801,7 @@ function DataGrid({
|
|
|
6424
6801
|
maxHeight: `${filterDropdownPosition.maxHeight}px`,
|
|
6425
6802
|
zIndex: 9999
|
|
6426
6803
|
},
|
|
6427
|
-
children: /* @__PURE__ */
|
|
6804
|
+
children: /* @__PURE__ */ jsx10(
|
|
6428
6805
|
ColumnFilter,
|
|
6429
6806
|
{
|
|
6430
6807
|
columnId: activeFilterColumn,
|