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