bolt-table 0.1.37 → 0.1.39

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.d.mts CHANGED
@@ -251,8 +251,30 @@ interface AIColumnVisibilityOperation {
251
251
  type: "hideColumns" | "showColumns";
252
252
  columns: string[];
253
253
  }
254
+ /** Resize a column to a specific width. */
255
+ interface AIResizeColumnOperation {
256
+ type: "resizeColumn";
257
+ column: string;
258
+ width: number;
259
+ }
260
+ /** Reorder columns by moving a column to a new position. */
261
+ interface AIReorderColumnsOperation {
262
+ type: "reorderColumns";
263
+ order: string[];
264
+ }
265
+ /** Pin or unpin a column. */
266
+ interface AIPinColumnOperation {
267
+ type: "pinColumn";
268
+ column: string;
269
+ pinned: "left" | "right" | false;
270
+ }
271
+ /** Set the current page number. */
272
+ interface AISetPageOperation {
273
+ type: "setPage";
274
+ page: number;
275
+ }
254
276
  /** Union of all possible AI operations. */
255
- type AIOperation = AIFilterOperation | AIStyleOperation | AICellStyleOperation | AISortOperation | AIColumnVisibilityOperation;
277
+ type AIOperation = AIFilterOperation | AIStyleOperation | AICellStyleOperation | AISortOperation | AIColumnVisibilityOperation | AIResizeColumnOperation | AIReorderColumnsOperation | AIPinColumnOperation | AISetPageOperation;
256
278
  /** The structured response returned by the AI. */
257
279
  interface AIResponse {
258
280
  operations: AIOperation[];
@@ -386,6 +408,10 @@ interface BoltTableProps<T extends DataRecord = DataRecord> {
386
408
  readonly aiPlaceholder?: string;
387
409
  /** Label for the AI button. Defaults to "Ask AI". */
388
410
  readonly aiButtonLabel?: React$1.ReactNode;
411
+ /** Enable row drag-and-drop reordering. When true, shows a grip handle on each row. Requires `onRowReorder`. */
412
+ readonly rowDragEnabled?: boolean;
413
+ /** Called when the user drops a row into a new position. Receives the old and new index. */
414
+ readonly onRowReorder?: (fromIndex: number, toIndex: number) => void;
389
415
  }
390
416
  interface ClassNamesTypes {
391
417
  /** Applied to all non-pinned column header cells. */
@@ -453,7 +479,7 @@ interface StylesTypes {
453
479
  /** Inline styles for the "X–Y of Z" info text. */
454
480
  paginationInfo?: CSSProperties;
455
481
  }
456
- declare function BoltTable<T extends DataRecord = DataRecord>({ columns: rawInitialColumns, data: rawData, rowHeight, expandedRowHeight, maxExpandedRowHeight, accentColor, className, classNames, styles, gripIcon, hideGripIcon, icons, pagination, onPaginationChange, onColumnResize, onColumnOrderChange, onColumnPin, onColumnHide, rowSelection, rowPinning, onRowPin, expandable, rowKey, onEndReached, onEndReachedThreshold, isLoading, onSortChange, onFilterChange, columnContextMenuItems, autoHeight, layoutLoading, emptyRenderer, rowClassName, rowStyle, disabledFilters, onCopy, keepPinnedRowsAcrossPages, onEdit, onRowClick, enableColumnVirtualization, enableDynamicRowHeight, columnPersistence, showColumnSettings, hideGlobalSearch, globalSearchValue, onGlobalSearchChange, toolbarContent, columnSettingsLabel, aiMode, aiConfig, onAIQuery, onAIResponse, aiPlaceholder, aiButtonLabel, }: BoltTableProps<T>): react_jsx_runtime.JSX.Element;
482
+ declare function BoltTable<T extends DataRecord = DataRecord>({ columns: rawInitialColumns, data: rawData, rowHeight, expandedRowHeight, maxExpandedRowHeight, accentColor, className, classNames, styles, gripIcon, hideGripIcon, icons, pagination, onPaginationChange, onColumnResize, onColumnOrderChange, onColumnPin, onColumnHide, rowSelection, rowPinning, onRowPin, expandable, rowKey, onEndReached, onEndReachedThreshold, isLoading, onSortChange, onFilterChange, columnContextMenuItems, autoHeight, layoutLoading, emptyRenderer, rowClassName, rowStyle, disabledFilters, onCopy, keepPinnedRowsAcrossPages, onEdit, onRowClick, enableColumnVirtualization, enableDynamicRowHeight, columnPersistence, showColumnSettings, hideGlobalSearch, globalSearchValue, onGlobalSearchChange, toolbarContent, columnSettingsLabel, aiMode, aiConfig, onAIQuery, onAIResponse, aiPlaceholder, aiButtonLabel, rowDragEnabled, onRowReorder, }: BoltTableProps<T>): react_jsx_runtime.JSX.Element;
457
483
 
458
484
  interface DraggableHeaderProps {
459
485
  /** Column definition for this header cell. */
@@ -506,8 +532,10 @@ interface DraggableHeaderProps {
506
532
  stickyTop?: number;
507
533
  /** When true, removes the left border (for the first visible column). */
508
534
  isFirstColumn?: boolean;
535
+ /** Called when the user double-clicks the resize handle to auto-fit column width. */
536
+ onAutoFitColumn?: (columnKey: string) => void;
509
537
  }
510
- declare const DraggableHeader: React$1.MemoExoticComponent<({ column, visualIndex, accentColor, onResizeStart, styles, classNames, hideGripIcon, gripIcon, stickyOffset, onTogglePin, onToggleHide, isLastColumn, sortDirection, onSort, filterValue, onFilter, onClearFilter, customContextMenuItems, icons, onColumnDragStart, disabledFilters, headerGridRow, headerHeight, stickyTop, isFirstColumn, }: DraggableHeaderProps) => react_jsx_runtime.JSX.Element>;
538
+ declare const DraggableHeader: React$1.MemoExoticComponent<({ column, visualIndex, accentColor, onResizeStart, styles, classNames, hideGripIcon, gripIcon, stickyOffset, onTogglePin, onToggleHide, isLastColumn, sortDirection, onSort, filterValue, onFilter, onClearFilter, customContextMenuItems, icons, onColumnDragStart, disabledFilters, headerGridRow, headerHeight, stickyTop, isFirstColumn, onAutoFitColumn, }: DraggableHeaderProps) => react_jsx_runtime.JSX.Element>;
511
539
 
512
540
  interface ResizeOverlayHandle {
513
541
  show: (viewportX: number, columnName: string, areaRect: DOMRect, headerLeftLocal: number, minSize: number, scrollTop: number, scrollLeft: number, initialLineX: number) => void;
@@ -592,7 +620,9 @@ interface TableBodyProps {
592
620
  columnGridIndexMap?: Map<string, number>;
593
621
  /** Optional AI cell style function. Returns extra styles for a specific cell. */
594
622
  cellStyleFn?: (record: DataRecord, columnKey: string) => React$1.CSSProperties | undefined;
623
+ /** Called when the user starts dragging a row by its grip handle. */
624
+ onRowDragStart?: (rowIndex: number, e: React$1.PointerEvent) => void;
595
625
  }
596
626
  declare const TableBody: React$1.FC<TableBodyProps>;
597
627
 
598
- export { type AICellStyleOperation, type AIColumnVisibilityOperation, type AICondition, type AIFilterOperation, type AIOperation, type AIOperator, type AIResponse, type AISortOperation, type AIStyleOperation, BoltTable, type BoltTableAIConfig, type BoltTableConfig, type BoltTableIcons, type CellContextMenuItem, type ClassNamesTypes, type ColumnContextMenuItem, type ColumnPersistenceConfig, type ColumnType, type DataRecord, DraggableHeader, type ExpandableConfig, type PaginationType, ResizeOverlay, type RowPinningConfig, type RowSelectionConfig, type SortDirection, type StylesTypes, TableBody, defineConfig };
628
+ export { type AICellStyleOperation, type AIColumnVisibilityOperation, type AICondition, type AIFilterOperation, type AIOperation, type AIOperator, type AIPinColumnOperation, type AIReorderColumnsOperation, type AIResizeColumnOperation, type AIResponse, type AISetPageOperation, type AISortOperation, type AIStyleOperation, BoltTable, type BoltTableAIConfig, type BoltTableConfig, type BoltTableIcons, type CellContextMenuItem, type ClassNamesTypes, type ColumnContextMenuItem, type ColumnPersistenceConfig, type ColumnType, type DataRecord, DraggableHeader, type ExpandableConfig, type PaginationType, ResizeOverlay, type RowPinningConfig, type RowSelectionConfig, type SortDirection, type StylesTypes, TableBody, defineConfig };
package/dist/index.d.ts CHANGED
@@ -251,8 +251,30 @@ interface AIColumnVisibilityOperation {
251
251
  type: "hideColumns" | "showColumns";
252
252
  columns: string[];
253
253
  }
254
+ /** Resize a column to a specific width. */
255
+ interface AIResizeColumnOperation {
256
+ type: "resizeColumn";
257
+ column: string;
258
+ width: number;
259
+ }
260
+ /** Reorder columns by moving a column to a new position. */
261
+ interface AIReorderColumnsOperation {
262
+ type: "reorderColumns";
263
+ order: string[];
264
+ }
265
+ /** Pin or unpin a column. */
266
+ interface AIPinColumnOperation {
267
+ type: "pinColumn";
268
+ column: string;
269
+ pinned: "left" | "right" | false;
270
+ }
271
+ /** Set the current page number. */
272
+ interface AISetPageOperation {
273
+ type: "setPage";
274
+ page: number;
275
+ }
254
276
  /** Union of all possible AI operations. */
255
- type AIOperation = AIFilterOperation | AIStyleOperation | AICellStyleOperation | AISortOperation | AIColumnVisibilityOperation;
277
+ type AIOperation = AIFilterOperation | AIStyleOperation | AICellStyleOperation | AISortOperation | AIColumnVisibilityOperation | AIResizeColumnOperation | AIReorderColumnsOperation | AIPinColumnOperation | AISetPageOperation;
256
278
  /** The structured response returned by the AI. */
257
279
  interface AIResponse {
258
280
  operations: AIOperation[];
@@ -386,6 +408,10 @@ interface BoltTableProps<T extends DataRecord = DataRecord> {
386
408
  readonly aiPlaceholder?: string;
387
409
  /** Label for the AI button. Defaults to "Ask AI". */
388
410
  readonly aiButtonLabel?: React$1.ReactNode;
411
+ /** Enable row drag-and-drop reordering. When true, shows a grip handle on each row. Requires `onRowReorder`. */
412
+ readonly rowDragEnabled?: boolean;
413
+ /** Called when the user drops a row into a new position. Receives the old and new index. */
414
+ readonly onRowReorder?: (fromIndex: number, toIndex: number) => void;
389
415
  }
390
416
  interface ClassNamesTypes {
391
417
  /** Applied to all non-pinned column header cells. */
@@ -453,7 +479,7 @@ interface StylesTypes {
453
479
  /** Inline styles for the "X–Y of Z" info text. */
454
480
  paginationInfo?: CSSProperties;
455
481
  }
456
- declare function BoltTable<T extends DataRecord = DataRecord>({ columns: rawInitialColumns, data: rawData, rowHeight, expandedRowHeight, maxExpandedRowHeight, accentColor, className, classNames, styles, gripIcon, hideGripIcon, icons, pagination, onPaginationChange, onColumnResize, onColumnOrderChange, onColumnPin, onColumnHide, rowSelection, rowPinning, onRowPin, expandable, rowKey, onEndReached, onEndReachedThreshold, isLoading, onSortChange, onFilterChange, columnContextMenuItems, autoHeight, layoutLoading, emptyRenderer, rowClassName, rowStyle, disabledFilters, onCopy, keepPinnedRowsAcrossPages, onEdit, onRowClick, enableColumnVirtualization, enableDynamicRowHeight, columnPersistence, showColumnSettings, hideGlobalSearch, globalSearchValue, onGlobalSearchChange, toolbarContent, columnSettingsLabel, aiMode, aiConfig, onAIQuery, onAIResponse, aiPlaceholder, aiButtonLabel, }: BoltTableProps<T>): react_jsx_runtime.JSX.Element;
482
+ declare function BoltTable<T extends DataRecord = DataRecord>({ columns: rawInitialColumns, data: rawData, rowHeight, expandedRowHeight, maxExpandedRowHeight, accentColor, className, classNames, styles, gripIcon, hideGripIcon, icons, pagination, onPaginationChange, onColumnResize, onColumnOrderChange, onColumnPin, onColumnHide, rowSelection, rowPinning, onRowPin, expandable, rowKey, onEndReached, onEndReachedThreshold, isLoading, onSortChange, onFilterChange, columnContextMenuItems, autoHeight, layoutLoading, emptyRenderer, rowClassName, rowStyle, disabledFilters, onCopy, keepPinnedRowsAcrossPages, onEdit, onRowClick, enableColumnVirtualization, enableDynamicRowHeight, columnPersistence, showColumnSettings, hideGlobalSearch, globalSearchValue, onGlobalSearchChange, toolbarContent, columnSettingsLabel, aiMode, aiConfig, onAIQuery, onAIResponse, aiPlaceholder, aiButtonLabel, rowDragEnabled, onRowReorder, }: BoltTableProps<T>): react_jsx_runtime.JSX.Element;
457
483
 
458
484
  interface DraggableHeaderProps {
459
485
  /** Column definition for this header cell. */
@@ -506,8 +532,10 @@ interface DraggableHeaderProps {
506
532
  stickyTop?: number;
507
533
  /** When true, removes the left border (for the first visible column). */
508
534
  isFirstColumn?: boolean;
535
+ /** Called when the user double-clicks the resize handle to auto-fit column width. */
536
+ onAutoFitColumn?: (columnKey: string) => void;
509
537
  }
510
- declare const DraggableHeader: React$1.MemoExoticComponent<({ column, visualIndex, accentColor, onResizeStart, styles, classNames, hideGripIcon, gripIcon, stickyOffset, onTogglePin, onToggleHide, isLastColumn, sortDirection, onSort, filterValue, onFilter, onClearFilter, customContextMenuItems, icons, onColumnDragStart, disabledFilters, headerGridRow, headerHeight, stickyTop, isFirstColumn, }: DraggableHeaderProps) => react_jsx_runtime.JSX.Element>;
538
+ declare const DraggableHeader: React$1.MemoExoticComponent<({ column, visualIndex, accentColor, onResizeStart, styles, classNames, hideGripIcon, gripIcon, stickyOffset, onTogglePin, onToggleHide, isLastColumn, sortDirection, onSort, filterValue, onFilter, onClearFilter, customContextMenuItems, icons, onColumnDragStart, disabledFilters, headerGridRow, headerHeight, stickyTop, isFirstColumn, onAutoFitColumn, }: DraggableHeaderProps) => react_jsx_runtime.JSX.Element>;
511
539
 
512
540
  interface ResizeOverlayHandle {
513
541
  show: (viewportX: number, columnName: string, areaRect: DOMRect, headerLeftLocal: number, minSize: number, scrollTop: number, scrollLeft: number, initialLineX: number) => void;
@@ -592,7 +620,9 @@ interface TableBodyProps {
592
620
  columnGridIndexMap?: Map<string, number>;
593
621
  /** Optional AI cell style function. Returns extra styles for a specific cell. */
594
622
  cellStyleFn?: (record: DataRecord, columnKey: string) => React$1.CSSProperties | undefined;
623
+ /** Called when the user starts dragging a row by its grip handle. */
624
+ onRowDragStart?: (rowIndex: number, e: React$1.PointerEvent) => void;
595
625
  }
596
626
  declare const TableBody: React$1.FC<TableBodyProps>;
597
627
 
598
- export { type AICellStyleOperation, type AIColumnVisibilityOperation, type AICondition, type AIFilterOperation, type AIOperation, type AIOperator, type AIResponse, type AISortOperation, type AIStyleOperation, BoltTable, type BoltTableAIConfig, type BoltTableConfig, type BoltTableIcons, type CellContextMenuItem, type ClassNamesTypes, type ColumnContextMenuItem, type ColumnPersistenceConfig, type ColumnType, type DataRecord, DraggableHeader, type ExpandableConfig, type PaginationType, ResizeOverlay, type RowPinningConfig, type RowSelectionConfig, type SortDirection, type StylesTypes, TableBody, defineConfig };
628
+ export { type AICellStyleOperation, type AIColumnVisibilityOperation, type AICondition, type AIFilterOperation, type AIOperation, type AIOperator, type AIPinColumnOperation, type AIReorderColumnsOperation, type AIResizeColumnOperation, type AIResponse, type AISetPageOperation, type AISortOperation, type AIStyleOperation, BoltTable, type BoltTableAIConfig, type BoltTableConfig, type BoltTableIcons, type CellContextMenuItem, type ClassNamesTypes, type ColumnContextMenuItem, type ColumnPersistenceConfig, type ColumnType, type DataRecord, DraggableHeader, type ExpandableConfig, type PaginationType, ResizeOverlay, type RowPinningConfig, type RowSelectionConfig, type SortDirection, type StylesTypes, TableBody, defineConfig };