@npm-questionpro/wick-ui-lib 1.37.1 → 1.38.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,10 +1,19 @@
1
+ import { ExpandedState } from '@tanstack/react-table';
2
+ import { default as React } from 'react';
1
3
  import { IWuTableRowSelection } from '../types/IWuRowSelection';
2
4
  import { IWuTableColumnDef } from '../types/IWuTableColumnDef';
3
- export declare function useWuTableCore<T>({ data, columns, rowSelection, }: {
5
+ export declare function useWuTableCore<T>({ data, columns, rowSelection, isRowExpandable, }: {
4
6
  data: T[];
5
7
  columns: IWuTableColumnDef<T>[];
6
8
  rowSelection?: IWuTableRowSelection<T>;
9
+ isRowExpandable?: boolean;
7
10
  }): {
8
11
  finalColumns: IWuTableColumnDef<T>[];
9
12
  rowSelectionState: Record<number, boolean>;
13
+ sortableColumns: string[];
14
+ selectedRowCount: number;
15
+ columnsWithExpand: IWuTableColumnDef<T>[];
16
+ expanded: ExpandedState;
17
+ setExpanded: React.Dispatch<React.SetStateAction<ExpandedState>>;
18
+ handleRowSelectionChange: (updater: React.SetStateAction<Record<number, boolean>>) => void;
10
19
  };
@@ -0,0 +1,6 @@
1
+ export declare function useTableScroll(): {
2
+ scrollContainerRef: React.RefObject<HTMLDivElement | null>;
3
+ isScrolledLeft: boolean;
4
+ isScrolledRight: boolean;
5
+ handleScroll: () => void;
6
+ };
@@ -7,4 +7,5 @@ export type IWuTableColumnDef<Data> = ColumnDef<Data> & {
7
7
  headerAlign?: 'left' | 'right' | 'center';
8
8
  cellAlign?: 'left' | 'right' | 'center';
9
9
  expandableRowContent?: (row: Row<Data>) => React.ReactNode;
10
+ sticky?: 'left' | 'right';
10
11
  };
@@ -8,6 +8,8 @@ interface IWuTableBodyProps<T> {
8
8
  CustomLoader?: React.ReactNode;
9
9
  isRowDisabled?: (row: T) => boolean;
10
10
  isRowExpandable?: boolean;
11
+ isScrolledLeft?: boolean;
12
+ isScrolledRight?: boolean;
11
13
  }
12
- export declare const WuTableBody: <T>({ table, size, NoDataContent, isLoading, CustomLoader, isRowDisabled, isRowExpandable, }: IWuTableBodyProps<T>) => React.JSX.Element;
14
+ export declare const WuTableBody: <T>({ table, size, NoDataContent, isLoading, CustomLoader, isRowDisabled, isRowExpandable, isScrolledLeft, isScrolledRight, }: IWuTableBodyProps<T>) => React.JSX.Element;
13
15
  export {};
@@ -1,7 +1,7 @@
1
1
  import { Table } from '@tanstack/react-table';
2
2
  import { default as React } from 'react';
3
3
  import { IColumnDefaultSorting } from '../types/IColumnDefaultSorting';
4
- export declare const WuTableHeader: <T>({ table, sortableColumns, manual, onSort, size, isRowSelected, HeaderAction, isStickyHeader, asVirtualContent, isRowExpandable, }: {
4
+ export declare const WuTableHeader: <T>({ table, sortableColumns, manual, onSort, size, isRowSelected, HeaderAction, isStickyHeader, asVirtualContent, isRowExpandable, isScrolledLeft, isScrolledRight, }: {
5
5
  table: Table<T>;
6
6
  sortableColumns: string[];
7
7
  manual?: boolean;
@@ -12,4 +12,6 @@ export declare const WuTableHeader: <T>({ table, sortableColumns, manual, onSort
12
12
  isStickyHeader?: boolean;
13
13
  asVirtualContent?: boolean;
14
14
  isRowExpandable?: boolean;
15
+ isScrolledLeft?: boolean;
16
+ isScrolledRight?: boolean;
15
17
  }) => React.JSX.Element;
@@ -12,5 +12,7 @@ export interface IWuVirtualTableBodyProps<T> {
12
12
  manual?: boolean;
13
13
  onSort?: (meta: IColumnDefaultSorting) => void;
14
14
  tableLayout?: 'fixed' | 'auto';
15
+ isScrolledLeft?: boolean;
16
+ isScrolledRight?: boolean;
15
17
  }
16
- export declare const WuVirtualTableBody: <T>({ table, size, isRowDisabled, containerHeight, sortableColumns, HeaderAction, isRowSelected, manual, onSort, tableLayout, }: IWuVirtualTableBodyProps<T>) => React.JSX.Element;
18
+ export declare const WuVirtualTableBody: <T>({ table, size, isRowDisabled, containerHeight, sortableColumns, HeaderAction, isRowSelected, manual, onSort, tableLayout, isScrolledLeft, isScrolledRight, }: IWuVirtualTableBodyProps<T>) => React.JSX.Element;
@@ -1,8 +1,16 @@
1
- import { Column, Row } from '@tanstack/react-table';
1
+ import { Cell, Column, Row } from '@tanstack/react-table';
2
2
  import { default as React } from 'react';
3
3
  import { IWuTableColumnDef } from '../types/IWuTableColumnDef';
4
4
  export declare const EXPANDER_COLUMN_SIZE = 48;
5
5
  export declare const EXPANDER_COLUMN_ID = "expander";
6
6
  export declare function createExpanderColumn<T>(isRowExpandable: boolean | undefined, finalColumns: IWuTableColumnDef<T>[]): IWuTableColumnDef<T>[];
7
7
  export declare function getExpandedContent<T>(row: Row<T>, columns: Column<T>[]): React.ReactNode | undefined;
8
+ export type IStickyMeta = {
9
+ sticky: 'left' | 'right';
10
+ offset: number;
11
+ isStickyEdge: boolean;
12
+ };
13
+ export declare function buildStickyColumnMap<T>(visibleColumns: Column<T>[]): Map<string, IStickyMeta>;
14
+ export declare function renderStickyEdgeShadow(sticky: 'left' | 'right' | undefined, isStickyEdge: boolean, isScrolledLeft?: boolean, isScrolledRight?: boolean): React.ReactNode;
8
15
  export declare function shouldVirtualizeTable(enabled: boolean | undefined, threshold: number | undefined, dataLength: number): boolean;
16
+ export declare function renderTableCellContent<T>(cell: Cell<T, unknown>, columnDef: IWuTableColumnDef<T>): React.ReactNode;
@@ -1,5 +1,5 @@
1
- export declare const getTableRowClasses: (isSelected: boolean, isDisabled: boolean) => string;
2
- export declare const getTableCellClasses: (columnId: string, size?: "compact" | "default", cellAlign?: "left" | "center" | "right") => string;
1
+ export declare const getTableRowClasses: (isDisabled?: boolean) => string;
2
+ export declare const getTableCellClasses: (size?: "compact" | "default", cellAlign?: "left" | "center" | "right") => string;
3
3
  export declare const getHeaderHeightClass: (size?: "compact" | "default") => string;
4
4
  export declare const getHeaderAlignClasses: (headerAlign?: "left" | "center" | "right") => string;
5
5
  export declare const getSortIconAlignClasses: (headerAlign?: "left" | "center" | "right") => string;