@smallwebco/tinypivot-react 1.0.83 → 1.1.1

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