UNPKG

mod-arch-shared

Version:

Shared UI components and utilities for modular architecture micro-frontend projects

48 lines 2.21 kB
import { SortableData } from './types'; /** * Represents a column that can be managed (shown/hidden, reordered) */ export interface ManagedColumn { /** Unique identifier for the column (typically matches SortableData.field) */ id: string; /** Display label for the column */ label: string; /** Whether the column is currently visible */ isVisible: boolean; } /** * Configuration for the useManageColumns hook */ export interface UseManageColumnsConfig<T, C extends SortableData<T> = SortableData<T>> { /** All possible columns (the full column definition) */ allColumns: C[]; /** Unique key for localStorage persistence */ storageKey: string; /** Default visible column fields when no localStorage value exists */ defaultVisibleColumnIds?: string[]; /** Maximum number of manageable columns that can be visible */ maxVisibleColumns?: number; } /** * Return type for the useManageColumns hook */ export interface UseManageColumnsResult<T, C extends SortableData<T> = SortableData<T>> { /** The columns to render in the table, filtered and ordered by visibility settings */ visibleColumns: C[]; /** All manageable columns with their current visibility state (for the modal) */ managedColumns: ManagedColumn[]; /** Callback to update which columns are visible (called from modal) */ setVisibleColumnIds: (columnIds: string[]) => void; /** The currently visible column IDs (for display purposes like "X of Y selected") */ visibleColumnIds: string[]; /** Default visible column fields when no localStorage value exists. Returned as-is for convenience to pass to ManageColumnsModal. */ defaultVisibleColumnIds?: string[]; /** Whether the manage columns modal is open */ isModalOpen: boolean; /** Opens the manage columns modal */ openModal: () => void; /** Closes the manage columns modal */ closeModal: () => void; } export declare const useManageColumns: <T, C extends SortableData<T> = SortableData<T>>({ allColumns, storageKey, defaultVisibleColumnIds, maxVisibleColumns, }: UseManageColumnsConfig<T, C>) => UseManageColumnsResult<T, C>; //# sourceMappingURL=useManageColumns.d.ts.map