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