@xcelsior/ui-spreadsheets 1.3.5 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  {
2
- "lastSentAt": "2026-03-31T06:22:45.213Z"
2
+ "lastSentAt": "2026-04-08T02:53:32.151Z"
3
3
  }
package/dist/index.d.mts CHANGED
@@ -362,6 +362,8 @@ interface SpreadsheetProps<T = any> {
362
362
  compactView?: boolean;
363
363
  /** Persisted column widths (columnId → width in px) */
364
364
  columnWidths?: Record<string, number>;
365
+ /** Column IDs that are hidden from view */
366
+ hiddenColumns?: string[];
365
367
  };
366
368
  /** Callback when spreadsheet settings are changed by the user */
367
369
  onSettingsChange?: (settings: {
@@ -372,6 +374,7 @@ interface SpreadsheetProps<T = any> {
372
374
  defaultPinnedColumns?: string[];
373
375
  defaultPinnedRightColumns?: string[];
374
376
  defaultSort?: SpreadsheetSortConfig | null;
377
+ hiddenColumns?: string[];
375
378
  }) => void;
376
379
  /** Loading state */
377
380
  isLoading?: boolean;
@@ -565,6 +568,8 @@ interface SpreadsheetHeaderProps {
565
568
  onDuplicateCheckClick?: () => void;
566
569
  /** Number of rows with duplicate values (shown as badge when > 0) */
567
570
  duplicateCount?: number;
571
+ /** Callback when hide column is clicked */
572
+ onHideClick?: () => void;
568
573
  /** Resize handle props from useSpreadsheetColumnResize */
569
574
  resizeHandleProps?: {
570
575
  onMouseDown: (e: React$1.MouseEvent) => void;
@@ -676,6 +681,12 @@ interface SpreadsheetToolbarProps {
676
681
  showFiltersPanel?: boolean;
677
682
  /** Callback to toggle the active filters panel */
678
683
  onToggleFiltersPanel?: () => void;
684
+ /** Number of hidden columns (shows indicator when > 0) */
685
+ hiddenColumnCount?: number;
686
+ /** Callback to show all hidden columns */
687
+ onShowAllColumns?: () => void;
688
+ /** Callback to open column visibility settings */
689
+ onManageColumns?: () => void;
679
690
  /** Custom className */
680
691
  className?: string;
681
692
  }
@@ -839,6 +850,8 @@ interface SpreadsheetSettings {
839
850
  columnWidths?: Record<string, number>;
840
851
  /** Column IDs with duplicate checking enabled */
841
852
  duplicateCheckColumns?: string[];
853
+ /** Column IDs that are hidden from view */
854
+ hiddenColumns?: string[];
842
855
  }
843
856
  interface SpreadsheetSettingsModalProps {
844
857
  /** Whether the modal is open */
@@ -851,6 +864,8 @@ interface SpreadsheetSettingsModalProps {
851
864
  onSave: (settings: SpreadsheetSettings) => void;
852
865
  /** Available columns for pinning/sorting */
853
866
  columns: SpreadsheetColumn[];
867
+ /** Column groups for organized visibility toggles */
868
+ columnGroups?: SpreadsheetColumnGroup[];
854
869
  /** Title for the modal */
855
870
  title?: string;
856
871
  /** Available page size options */
package/dist/index.d.ts CHANGED
@@ -362,6 +362,8 @@ interface SpreadsheetProps<T = any> {
362
362
  compactView?: boolean;
363
363
  /** Persisted column widths (columnId → width in px) */
364
364
  columnWidths?: Record<string, number>;
365
+ /** Column IDs that are hidden from view */
366
+ hiddenColumns?: string[];
365
367
  };
366
368
  /** Callback when spreadsheet settings are changed by the user */
367
369
  onSettingsChange?: (settings: {
@@ -372,6 +374,7 @@ interface SpreadsheetProps<T = any> {
372
374
  defaultPinnedColumns?: string[];
373
375
  defaultPinnedRightColumns?: string[];
374
376
  defaultSort?: SpreadsheetSortConfig | null;
377
+ hiddenColumns?: string[];
375
378
  }) => void;
376
379
  /** Loading state */
377
380
  isLoading?: boolean;
@@ -565,6 +568,8 @@ interface SpreadsheetHeaderProps {
565
568
  onDuplicateCheckClick?: () => void;
566
569
  /** Number of rows with duplicate values (shown as badge when > 0) */
567
570
  duplicateCount?: number;
571
+ /** Callback when hide column is clicked */
572
+ onHideClick?: () => void;
568
573
  /** Resize handle props from useSpreadsheetColumnResize */
569
574
  resizeHandleProps?: {
570
575
  onMouseDown: (e: React$1.MouseEvent) => void;
@@ -676,6 +681,12 @@ interface SpreadsheetToolbarProps {
676
681
  showFiltersPanel?: boolean;
677
682
  /** Callback to toggle the active filters panel */
678
683
  onToggleFiltersPanel?: () => void;
684
+ /** Number of hidden columns (shows indicator when > 0) */
685
+ hiddenColumnCount?: number;
686
+ /** Callback to show all hidden columns */
687
+ onShowAllColumns?: () => void;
688
+ /** Callback to open column visibility settings */
689
+ onManageColumns?: () => void;
679
690
  /** Custom className */
680
691
  className?: string;
681
692
  }
@@ -839,6 +850,8 @@ interface SpreadsheetSettings {
839
850
  columnWidths?: Record<string, number>;
840
851
  /** Column IDs with duplicate checking enabled */
841
852
  duplicateCheckColumns?: string[];
853
+ /** Column IDs that are hidden from view */
854
+ hiddenColumns?: string[];
842
855
  }
843
856
  interface SpreadsheetSettingsModalProps {
844
857
  /** Whether the modal is open */
@@ -851,6 +864,8 @@ interface SpreadsheetSettingsModalProps {
851
864
  onSave: (settings: SpreadsheetSettings) => void;
852
865
  /** Available columns for pinning/sorting */
853
866
  columns: SpreadsheetColumn[];
867
+ /** Column groups for organized visibility toggles */
868
+ columnGroups?: SpreadsheetColumnGroup[];
854
869
  /** Title for the modal */
855
870
  title?: string;
856
871
  /** Available page size options */
package/dist/index.js CHANGED
@@ -141,6 +141,9 @@ function HiDotsVertical(props) {
141
141
  function HiExclamation(props) {
142
142
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 20 20", "fill": "currentColor", "aria-hidden": "true" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "d": "M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z", "clipRule": "evenodd" } }] })(props);
143
143
  }
144
+ function HiEyeOff(props) {
145
+ return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 20 20", "fill": "currentColor", "aria-hidden": "true" }, "child": [{ "tag": "path", "attr": { "fillRule": "evenodd", "d": "M3.707 2.293a1 1 0 00-1.414 1.414l14 14a1 1 0 001.414-1.414l-1.473-1.473A10.014 10.014 0 0019.542 10C18.268 5.943 14.478 3 10 3a9.958 9.958 0 00-4.512 1.074l-1.78-1.781zm4.261 4.26l1.514 1.515a2.003 2.003 0 012.45 2.45l1.514 1.514a4 4 0 00-5.478-5.478z", "clipRule": "evenodd" } }, { "tag": "path", "attr": { "d": "M12.454 16.697L9.75 13.992a4 4 0 01-3.742-3.741L2.335 6.578A9.98 9.98 0 00.458 10c1.274 4.057 5.065 7 9.542 7 .847 0 1.669-.105 2.454-.303z" } }] })(props);
146
+ }
144
147
  function HiEye(props) {
145
148
  return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 20 20", "fill": "currentColor", "aria-hidden": "true" }, "child": [{ "tag": "path", "attr": { "d": "M10 12a2 2 0 100-4 2 2 0 000 4z" } }, { "tag": "path", "attr": { "fillRule": "evenodd", "d": "M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z", "clipRule": "evenodd" } }] })(props);
146
149
  }
@@ -1369,6 +1372,9 @@ var SpreadsheetToolbar = ({
1369
1372
  onClearFilter,
1370
1373
  showFiltersPanel,
1371
1374
  onToggleFiltersPanel,
1375
+ hiddenColumnCount = 0,
1376
+ onShowAllColumns,
1377
+ onManageColumns,
1372
1378
  className
1373
1379
  }) => {
1374
1380
  const [showMoreMenu, setShowMoreMenu] = import_react5.default.useState(false);
@@ -1588,6 +1594,31 @@ var SpreadsheetToolbar = ({
1588
1594
  ]
1589
1595
  }
1590
1596
  ),
1597
+ hiddenColumnCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center gap-1.5 px-2.5 py-1.5 bg-amber-50 border border-amber-200 rounded text-xs text-amber-700", children: [
1598
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "font-medium", children: [
1599
+ hiddenColumnCount,
1600
+ " hidden"
1601
+ ] }),
1602
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1603
+ "button",
1604
+ {
1605
+ type: "button",
1606
+ onClick: onShowAllColumns,
1607
+ className: "text-amber-800 underline hover:text-amber-900 transition-colors",
1608
+ children: "Show"
1609
+ }
1610
+ ),
1611
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-amber-300", children: "|" }),
1612
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1613
+ "button",
1614
+ {
1615
+ type: "button",
1616
+ onClick: onManageColumns,
1617
+ className: "text-amber-800 underline hover:text-amber-900 transition-colors",
1618
+ children: "Manage"
1619
+ }
1620
+ )
1621
+ ] }),
1591
1622
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "relative", ref: menuRef, children: [
1592
1623
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
1593
1624
  "button",
@@ -1711,7 +1742,8 @@ function ColumnHeaderActions({
1711
1742
  resolvedWidth,
1712
1743
  enableDuplicateCheck = false,
1713
1744
  hasDuplicateCheck = false,
1714
- onDuplicateCheckClick
1745
+ onDuplicateCheckClick,
1746
+ onHideClick
1715
1747
  }) {
1716
1748
  const [overflowOpen, setOverflowOpen] = (0, import_react6.useState)(false);
1717
1749
  const overflowRef = (0, import_react6.useRef)(null);
@@ -1859,7 +1891,26 @@ function ColumnHeaderActions({
1859
1891
  "Check Duplicates"
1860
1892
  ]
1861
1893
  }
1862
- )
1894
+ ),
1895
+ onHideClick && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
1896
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "border-t border-gray-100 my-1" }),
1897
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
1898
+ "button",
1899
+ {
1900
+ type: "button",
1901
+ onClick: (e) => {
1902
+ e.stopPropagation();
1903
+ onHideClick();
1904
+ setOverflowOpen(false);
1905
+ },
1906
+ className: "flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-gray-100 text-left text-gray-700",
1907
+ children: [
1908
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HiEyeOff, { className: "h-3.5 w-3.5 shrink-0" }),
1909
+ "Hide column"
1910
+ ]
1911
+ }
1912
+ )
1913
+ ] })
1863
1914
  ]
1864
1915
  }
1865
1916
  ),
@@ -1947,6 +1998,19 @@ function ColumnHeaderActions({
1947
1998
  title: "Check duplicates",
1948
1999
  children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HiExclamation, { className: "h-3 w-3" })
1949
2000
  }
2001
+ ),
2002
+ onHideClick && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2003
+ "button",
2004
+ {
2005
+ type: "button",
2006
+ onClick: (e) => {
2007
+ e.stopPropagation();
2008
+ onHideClick();
2009
+ },
2010
+ className: "p-0.5 hover:bg-gray-200 rounded text-gray-400 opacity-0 group-hover:opacity-100 transition-opacity",
2011
+ title: "Hide column",
2012
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HiEyeOff, { className: "h-3 w-3" })
2013
+ }
1950
2014
  )
1951
2015
  ] });
1952
2016
  }
@@ -1975,6 +2039,7 @@ var SpreadsheetHeader = ({
1975
2039
  hasDuplicateCheck = false,
1976
2040
  onDuplicateCheckClick,
1977
2041
  duplicateCount,
2042
+ onHideClick,
1978
2043
  resizeHandleProps,
1979
2044
  resolvedWidth,
1980
2045
  topOffset = 0,
@@ -2058,7 +2123,8 @@ var SpreadsheetHeader = ({
2058
2123
  resolvedWidth,
2059
2124
  enableDuplicateCheck: true,
2060
2125
  hasDuplicateCheck,
2061
- onDuplicateCheckClick
2126
+ onDuplicateCheckClick,
2127
+ onHideClick
2062
2128
  }
2063
2129
  )
2064
2130
  ] }),
@@ -2110,7 +2176,8 @@ function useSpreadsheetPinning({
2110
2176
  showRowIndex = true,
2111
2177
  defaultPinnedColumns = [],
2112
2178
  defaultPinnedRightColumns = [],
2113
- getColumnWidth
2179
+ getColumnWidth,
2180
+ hiddenColumns = []
2114
2181
  }) {
2115
2182
  const [pinnedColumns, setPinnedColumns] = (0, import_react8.useState)(() => {
2116
2183
  const map = /* @__PURE__ */ new Map();
@@ -2197,9 +2264,13 @@ function useSpreadsheetPinning({
2197
2264
  return newSet;
2198
2265
  });
2199
2266
  }, []);
2267
+ const hiddenColumnsSet = (0, import_react8.useMemo)(() => new Set(hiddenColumns), [hiddenColumns]);
2200
2268
  const visibleColumns = (0, import_react8.useMemo)(() => {
2201
2269
  if (!columns || !Array.isArray(columns) || columns.length === 0) return [];
2202
2270
  let result = [...columns];
2271
+ if (hiddenColumnsSet.size > 0) {
2272
+ result = result.filter((column) => !hiddenColumnsSet.has(column.id));
2273
+ }
2203
2274
  if (columnGroups && Array.isArray(columnGroups)) {
2204
2275
  result = result.filter((column) => {
2205
2276
  const group = columnGroups.find((g) => g.columns.includes(column.id));
@@ -2209,7 +2280,7 @@ function useSpreadsheetPinning({
2209
2280
  });
2210
2281
  }
2211
2282
  return result;
2212
- }, [columns, columnGroups, collapsedGroups, pinnedColumns]);
2283
+ }, [columns, columnGroups, collapsedGroups, pinnedColumns, hiddenColumnsSet]);
2213
2284
  (0, import_react8.useEffect)(() => {
2214
2285
  requestAnimationFrame(() => measureColumnWidths());
2215
2286
  }, [measureColumnWidths, visibleColumns, pinnedColumns]);
@@ -2479,14 +2550,24 @@ var SpreadsheetSettingsModal = ({
2479
2550
  settings,
2480
2551
  onSave,
2481
2552
  columns,
2553
+ columnGroups,
2482
2554
  title = "Spreadsheet Settings",
2483
2555
  pageSizeOptions = [25, 50, 100, 200]
2484
2556
  }) => {
2485
- const [activeTab, setActiveTab] = (0, import_react10.useState)("columns");
2557
+ const [activeTab, setActiveTab] = (0, import_react10.useState)("visibility");
2486
2558
  const [localSettings, setLocalSettings] = (0, import_react10.useState)(settings);
2487
2559
  (0, import_react10.useEffect)(() => {
2488
2560
  setLocalSettings(settings);
2489
2561
  }, [settings]);
2562
+ const hiddenColumnsSet = (0, import_react10.useMemo)(
2563
+ () => new Set(localSettings.hiddenColumns ?? []),
2564
+ [localSettings.hiddenColumns]
2565
+ );
2566
+ const ungroupedColumns = (0, import_react10.useMemo)(() => {
2567
+ if (!columnGroups?.length) return columns;
2568
+ const groupedIds = new Set(columnGroups.flatMap((g) => g.columns));
2569
+ return columns.filter((c) => !groupedIds.has(c.id));
2570
+ }, [columns, columnGroups]);
2490
2571
  if (!isOpen) return null;
2491
2572
  const handleSave = () => {
2492
2573
  onSave(localSettings);
@@ -2534,7 +2615,23 @@ var SpreadsheetSettingsModal = ({
2534
2615
  onSave(newSettings);
2535
2616
  }
2536
2617
  };
2618
+ const hiddenCount = hiddenColumnsSet.size;
2619
+ const toggleColumnVisibility = (columnId) => {
2620
+ const isHidden = hiddenColumnsSet.has(columnId);
2621
+ const newHidden = isHidden ? (localSettings.hiddenColumns ?? []).filter((id) => id !== columnId) : [...localSettings.hiddenColumns ?? [], columnId];
2622
+ setLocalSettings({ ...localSettings, hiddenColumns: newHidden });
2623
+ };
2624
+ const setGroupVisibility = (groupColumnIds, visible) => {
2625
+ const currentHidden = new Set(localSettings.hiddenColumns ?? []);
2626
+ if (visible) {
2627
+ groupColumnIds.forEach((id) => currentHidden.delete(id));
2628
+ } else {
2629
+ groupColumnIds.forEach((id) => currentHidden.add(id));
2630
+ }
2631
+ setLocalSettings({ ...localSettings, hiddenColumns: Array.from(currentHidden) });
2632
+ };
2537
2633
  const tabs = [
2634
+ { id: "visibility", label: `Column Visibility${hiddenCount > 0 ? ` (${hiddenCount})` : ""}`, Icon: HiEyeOff },
2538
2635
  { id: "columns", label: "Pinned Columns", Icon: HiViewBoards },
2539
2636
  { id: "sorting", label: "Default Sorting", Icon: HiSortAscending },
2540
2637
  { id: "display", label: "Display Options", Icon: HiEye }
@@ -2557,7 +2654,7 @@ var SpreadsheetSettingsModal = ({
2557
2654
  "aria-label": "Close settings"
2558
2655
  }
2559
2656
  ),
2560
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "bg-white rounded-lg w-[90%] max-w-[700px] max-h-[90vh] flex flex-col shadow-xl relative z-10", children: [
2657
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "bg-white rounded-lg w-[70%] max-w-1/2 max-h-[70vh] flex flex-col shadow-xl relative z-10", children: [
2561
2658
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "px-6 py-5 border-b border-gray-200 flex items-center justify-between", children: [
2562
2659
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-3", children: [
2563
2660
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(HiCog, { className: "h-6 w-6 text-blue-600" }),
@@ -2587,6 +2684,131 @@ var SpreadsheetSettingsModal = ({
2587
2684
  tab.id
2588
2685
  )) }),
2589
2686
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex-1 overflow-auto p-6", children: [
2687
+ activeTab === "visibility" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
2688
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "p-4 bg-amber-50 border border-amber-200 rounded-lg mb-4 flex gap-3", children: [
2689
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(HiEyeOff, { className: "h-4 w-4 text-amber-600 shrink-0 mt-0.5" }),
2690
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
2691
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "text-sm font-semibold text-gray-900 mb-1", children: "Column Visibility" }),
2692
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "text-sm text-gray-600", children: [
2693
+ "Toggle columns on or off. Hidden columns are removed from the table but their data is preserved.",
2694
+ hiddenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "ml-1 font-medium text-amber-700", children: [
2695
+ hiddenCount,
2696
+ " column",
2697
+ hiddenCount !== 1 ? "s" : "",
2698
+ " hidden."
2699
+ ] })
2700
+ ] })
2701
+ ] })
2702
+ ] }),
2703
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex gap-2 mb-4", children: [
2704
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2705
+ "button",
2706
+ {
2707
+ type: "button",
2708
+ onClick: () => setLocalSettings({ ...localSettings, hiddenColumns: [] }),
2709
+ className: "px-3 py-1.5 text-xs font-medium text-green-700 bg-green-50 border border-green-200 rounded-lg hover:bg-green-100 transition-colors",
2710
+ children: "Show All"
2711
+ }
2712
+ ),
2713
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2714
+ "button",
2715
+ {
2716
+ type: "button",
2717
+ onClick: () => setLocalSettings({
2718
+ ...localSettings,
2719
+ hiddenColumns: columns.map((c) => c.id)
2720
+ }),
2721
+ className: "px-3 py-1.5 text-xs font-medium text-red-700 bg-red-50 border border-red-200 rounded-lg hover:bg-red-100 transition-colors",
2722
+ children: "Hide All"
2723
+ }
2724
+ )
2725
+ ] }),
2726
+ columnGroups?.map((group) => {
2727
+ const groupCols = columns.filter((c) => group.columns.includes(c.id));
2728
+ if (groupCols.length === 0) return null;
2729
+ const hiddenInGroup = groupCols.filter((c) => hiddenColumnsSet.has(c.id)).length;
2730
+ const allHidden = hiddenInGroup === groupCols.length;
2731
+ const allVisible = hiddenInGroup === 0;
2732
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mb-4", children: [
2733
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center justify-between mb-2", children: [
2734
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex items-center gap-2", children: [
2735
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2736
+ "div",
2737
+ {
2738
+ className: "w-3 h-3 rounded-sm",
2739
+ style: { backgroundColor: group.headerColor }
2740
+ }
2741
+ ),
2742
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium text-gray-900", children: group.label }),
2743
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { className: "text-xs text-gray-500", children: [
2744
+ "(",
2745
+ groupCols.length - hiddenInGroup,
2746
+ "/",
2747
+ groupCols.length,
2748
+ ")"
2749
+ ] })
2750
+ ] }),
2751
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex gap-1", children: [
2752
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2753
+ "button",
2754
+ {
2755
+ type: "button",
2756
+ onClick: () => setGroupVisibility(group.columns, true),
2757
+ disabled: allVisible,
2758
+ className: "px-2 py-0.5 text-xs text-green-700 hover:bg-green-50 rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",
2759
+ children: "Show all"
2760
+ }
2761
+ ),
2762
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2763
+ "button",
2764
+ {
2765
+ type: "button",
2766
+ onClick: () => setGroupVisibility(group.columns, false),
2767
+ disabled: allHidden,
2768
+ className: "px-2 py-0.5 text-xs text-red-700 hover:bg-red-50 rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",
2769
+ children: "Hide all"
2770
+ }
2771
+ )
2772
+ ] })
2773
+ ] }),
2774
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2", children: groupCols.map((column) => {
2775
+ const isHidden = hiddenColumnsSet.has(column.id);
2776
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2777
+ "button",
2778
+ {
2779
+ type: "button",
2780
+ onClick: () => toggleColumnVisibility(column.id),
2781
+ className: `flex items-center gap-2 p-3 rounded-lg border transition-colors text-left ${isHidden ? "bg-gray-100 border-gray-200 text-gray-400" : "bg-green-50 border-green-300 text-green-800"}`,
2782
+ children: [
2783
+ isHidden ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(HiEyeOff, { className: "h-4 w-4 shrink-0" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(HiEye, { className: "h-4 w-4 shrink-0" }),
2784
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm flex-1 truncate", children: column.label })
2785
+ ]
2786
+ },
2787
+ column.id
2788
+ );
2789
+ }) })
2790
+ ] }, group.id);
2791
+ }),
2792
+ ungroupedColumns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "mb-4", children: [
2793
+ columnGroups?.length ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "flex items-center gap-2 mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm font-medium text-gray-900", children: "Other" }) }) : null,
2794
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2", children: ungroupedColumns.map((column) => {
2795
+ const isHidden = hiddenColumnsSet.has(column.id);
2796
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2797
+ "button",
2798
+ {
2799
+ type: "button",
2800
+ onClick: () => toggleColumnVisibility(column.id),
2801
+ className: `flex items-center gap-2 p-3 rounded-lg border transition-colors text-left ${isHidden ? "bg-gray-100 border-gray-200 text-gray-400" : "bg-green-50 border-green-300 text-green-800"}`,
2802
+ children: [
2803
+ isHidden ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(HiEyeOff, { className: "h-4 w-4 shrink-0" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(HiEye, { className: "h-4 w-4 shrink-0" }),
2804
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "text-sm flex-1 truncate", children: column.label })
2805
+ ]
2806
+ },
2807
+ column.id
2808
+ );
2809
+ }) })
2810
+ ] })
2811
+ ] }),
2590
2812
  activeTab === "columns" && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
2591
2813
  /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "p-4 bg-blue-50 border border-blue-200 rounded-lg mb-4 flex gap-3", children: [
2592
2814
  /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(HiViewBoards, { className: "h-4 w-4 text-blue-600 shrink-0 mt-0.5" }),
@@ -4671,7 +4893,8 @@ function Spreadsheet({
4671
4893
  defaultPageSize: initialSettings?.defaultPageSize ?? 25,
4672
4894
  defaultZoom: initialSettings?.defaultZoom ?? 100,
4673
4895
  autoSave: initialSettings?.autoSave ?? true,
4674
- compactView: initialSettings?.compactView ?? false
4896
+ compactView: initialSettings?.compactView ?? false,
4897
+ hiddenColumns: initialSettings?.hiddenColumns ?? []
4675
4898
  });
4676
4899
  const {
4677
4900
  isCellDuplicate,
@@ -4698,6 +4921,15 @@ function Spreadsheet({
4698
4921
  },
4699
4922
  [toggleDuplicateCheck, duplicateCheckColumns, onDuplicateCheckChange]
4700
4923
  );
4924
+ const handleHideColumn = (0, import_react23.useCallback)(
4925
+ (columnId) => {
4926
+ setSpreadsheetSettings((prev) => ({
4927
+ ...prev,
4928
+ hiddenColumns: [...prev.hiddenColumns ?? [], columnId]
4929
+ }));
4930
+ },
4931
+ []
4932
+ );
4701
4933
  const [isProcessing, setIsProcessing] = (0, import_react23.useState)(false);
4702
4934
  const {
4703
4935
  filters,
@@ -4772,7 +5004,8 @@ function Spreadsheet({
4772
5004
  columnGroups,
4773
5005
  defaultPinnedColumns: initialSettings?.defaultPinnedColumns,
4774
5006
  defaultPinnedRightColumns: initialSettings?.defaultPinnedRightColumns,
4775
- getColumnWidth
5007
+ getColumnWidth,
5008
+ hiddenColumns: spreadsheetSettings.hiddenColumns
4776
5009
  });
4777
5010
  const {
4778
5011
  getCellComments,
@@ -5280,7 +5513,12 @@ function Spreadsheet({
5280
5513
  onSave: handleSave,
5281
5514
  onSettings: () => setShowSettingsModal(true),
5282
5515
  onShowShortcuts: () => setShowKeyboardShortcuts(true),
5283
- menuItems: toolbarMenuItems
5516
+ menuItems: toolbarMenuItems,
5517
+ hiddenColumnCount: spreadsheetSettings.hiddenColumns?.length ?? 0,
5518
+ onShowAllColumns: () => {
5519
+ setSpreadsheetSettings((prev) => ({ ...prev, hiddenColumns: [] }));
5520
+ },
5521
+ onManageColumns: () => setShowSettingsModal(true)
5284
5522
  }
5285
5523
  ),
5286
5524
  /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { ref: tableRef, className: cn("flex-1 overflow-auto border border-gray-200 rounded spreadsheet-scroll-container relative", isResizing && "select-none"), onMouseUp: handleMouseUp, children: [
@@ -5388,6 +5626,7 @@ function Spreadsheet({
5388
5626
  activeFilterColumn === column.id ? null : column.id
5389
5627
  ),
5390
5628
  onPinClick: () => handleTogglePin(column.id),
5629
+ onHideClick: () => handleHideColumn(column.id),
5391
5630
  onHighlightClick: enableHighlighting ? () => setHighlightPickerColumn(column.id) : void 0,
5392
5631
  resizeHandleProps: getResizeHandleProps(
5393
5632
  column.id,
@@ -5833,6 +6072,7 @@ function Spreadsheet({
5833
6072
  onSettingsChange?.(newSettings);
5834
6073
  },
5835
6074
  columns: columns || [],
6075
+ columnGroups,
5836
6076
  title: "Spreadsheet Settings",
5837
6077
  pageSizeOptions
5838
6078
  }