jattac.libs.web.responsive-table 0.8.0 → 0.8.2
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/README.md +46 -0
- package/dist/Context/TableContext.d.ts +91 -0
- package/dist/Hooks/useTableDataSource.d.ts +23 -0
- package/dist/UI/DesktopView.d.ts +2 -29
- package/dist/UI/InfiniteTable.d.ts +2 -2
- package/dist/UI/MobileView.d.ts +2 -25
- package/dist/UI/ResponsiveTable.d.ts +31 -2
- package/dist/UI/TableBodyCell.d.ts +9 -0
- package/dist/UI/TableBodyRow.d.ts +21 -0
- package/dist/UI/TableHeaderCell.d.ts +8 -0
- package/dist/UI/TableSentinel.d.ts +7 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.es.js +1207 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.js +374 -264
- package/dist/index.js.map +1 -1
- package/docs/configuration.md +23 -0
- package/docs/examples.md +23 -24
- package/package.json +1 -1
- package/dist/Data/IGroupedRowDefinition.d.ts +0 -10
- package/dist/Data/IInfiniteScrollTypes.d.ts +0 -15
- package/dist/Plugins/GroupingPlugin.d.ts +0 -17
- package/dist/Plugins/HighlightPlugin.d.ts +0 -23
- package/dist/UI/ResponsiveTable.stories.d.ts +0 -17
- /package/dist/{Plugins/SelectionPlugin.test.d.ts → UI/SmartDataSource.test.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -16,6 +16,52 @@ ResponsiveTable is a high-performance, type-safe React component designed for co
|
|
|
16
16
|
npm install jattac.libs.web.responsive-table
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
## Styling
|
|
20
|
+
|
|
21
|
+
For the table to look its best, you must import the provided CSS in your application entry point (e.g., `_app.tsx` or `index.tsx`):
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import 'jattac.libs.web.responsive-table/dist/index.css';
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Delightful Data Fetching: Smart Data Source
|
|
30
|
+
|
|
31
|
+
The new `dataSource` pattern makes handling large datasets, server-side sorting, and infinite scroll completely painless. You provide the fetch logic; we handle the bookkeeping.
|
|
32
|
+
|
|
33
|
+
### Basic Usage
|
|
34
|
+
```tsx
|
|
35
|
+
<ResponsiveTable
|
|
36
|
+
dataSource={async ({ page, pageSize }) => {
|
|
37
|
+
const users = await api.getUsers({ page, pageSize });
|
|
38
|
+
return users; // Table automatically handles appending and hasMore detection!
|
|
39
|
+
}}
|
|
40
|
+
columnDefinitions={columns}
|
|
41
|
+
/>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### With Sorting & Filtering
|
|
45
|
+
The table tells you exactly what it needs based on user interaction:
|
|
46
|
+
```tsx
|
|
47
|
+
<ResponsiveTable
|
|
48
|
+
dataSource={async ({ page, pageSize, sort, filter }) => {
|
|
49
|
+
return await api.getUsers({
|
|
50
|
+
page,
|
|
51
|
+
limit: pageSize,
|
|
52
|
+
sortBy: sort?.columnId,
|
|
53
|
+
order: sort?.direction,
|
|
54
|
+
search: filter
|
|
55
|
+
});
|
|
56
|
+
}}
|
|
57
|
+
columnDefinitions={columns}
|
|
58
|
+
sortProps={{ initialSortColumn: 'name' }}
|
|
59
|
+
filterProps={{ showFilter: true }}
|
|
60
|
+
/>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
19
65
|
## Basic Implementation
|
|
20
66
|
|
|
21
67
|
The following example demonstrates a standard implementation of the ResponsiveTable component:
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { IResponsiveTableColumnDefinition } from '../Data/IResponsiveTableColumnDefinition';
|
|
3
|
+
import { IResponsiveTablePlugin } from '../Plugins/IResponsiveTablePlugin';
|
|
4
|
+
export type ColumnDefinition<TData> = IResponsiveTableColumnDefinition<TData> | ((data: TData, rowIndex?: number) => IResponsiveTableColumnDefinition<TData>);
|
|
5
|
+
/**
|
|
6
|
+
* Parameters passed to the dataSource function.
|
|
7
|
+
*/
|
|
8
|
+
export interface IDataSourceParams {
|
|
9
|
+
/** The 1-based page number to fetch. */
|
|
10
|
+
page: number;
|
|
11
|
+
/** The number of items to fetch per page. */
|
|
12
|
+
pageSize: number;
|
|
13
|
+
/** The active sort configuration, if any. */
|
|
14
|
+
sort?: {
|
|
15
|
+
columnId: string;
|
|
16
|
+
direction: 'asc' | 'desc';
|
|
17
|
+
};
|
|
18
|
+
/** The active filter string, if any. */
|
|
19
|
+
filter?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The result of a dataSource fetch.
|
|
23
|
+
* Can be a simple array of items (hasMore will be auto-detected)
|
|
24
|
+
* or an object containing items and an optional totalCount.
|
|
25
|
+
*/
|
|
26
|
+
export type DataSourceResult<TData> = TData[] | {
|
|
27
|
+
items: TData[];
|
|
28
|
+
totalCount?: number;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* A function that fetches data from an external source (e.g., an API).
|
|
32
|
+
*/
|
|
33
|
+
export type DataSource<TData> = (params: IDataSourceParams) => Promise<DataSourceResult<TData>>;
|
|
34
|
+
interface TableContextValue<TData> {
|
|
35
|
+
/** The raw data provided to the table (or the combined data from dataSource). */
|
|
36
|
+
data: TData[];
|
|
37
|
+
/** The data after being processed by plugins (sort, filter, etc.). */
|
|
38
|
+
processedData: TData[];
|
|
39
|
+
/** Alias for processedData, used for backward compatibility. */
|
|
40
|
+
currentData: TData[];
|
|
41
|
+
/** The list of columns that are currently visible. */
|
|
42
|
+
visibleColumns: ColumnDefinition<TData>[];
|
|
43
|
+
/** The full list of column definitions provided to the table. */
|
|
44
|
+
originalColumnDefinitions: ColumnDefinition<TData>[];
|
|
45
|
+
/** The list of plugins currently active on the table. */
|
|
46
|
+
activePlugins: IResponsiveTablePlugin<TData>[];
|
|
47
|
+
/** Callback for when a row is clicked. */
|
|
48
|
+
onRowClick?: (item: TData) => void;
|
|
49
|
+
/** Configuration for row selection. */
|
|
50
|
+
selectionProps?: {
|
|
51
|
+
onSelectionChange: (selectedItems: TData[]) => void;
|
|
52
|
+
rowIdKey: keyof TData;
|
|
53
|
+
mode?: 'single' | 'multiple';
|
|
54
|
+
selectedItems?: TData[];
|
|
55
|
+
selectedRowClassName?: string;
|
|
56
|
+
};
|
|
57
|
+
/** Configuration for table animations and loading states. */
|
|
58
|
+
animationProps?: {
|
|
59
|
+
isLoading?: boolean;
|
|
60
|
+
animateOnLoad?: boolean;
|
|
61
|
+
};
|
|
62
|
+
/** The smart data source used for server-side operations and infinite scroll. */
|
|
63
|
+
dataSource?: DataSource<TData>;
|
|
64
|
+
/** The current state of pagination and async loading. */
|
|
65
|
+
pagination?: {
|
|
66
|
+
currentPage: number;
|
|
67
|
+
pageSize: number;
|
|
68
|
+
hasMore: boolean;
|
|
69
|
+
totalCount?: number;
|
|
70
|
+
isLoading: boolean;
|
|
71
|
+
isFetchingMore: boolean;
|
|
72
|
+
loadNextPage: () => void;
|
|
73
|
+
};
|
|
74
|
+
getRawColumnDefinition: (colDef: ColumnDefinition<TData>) => IResponsiveTableColumnDefinition<TData>;
|
|
75
|
+
getColumnDefinition: (colDef: ColumnDefinition<TData>, rowIndex: number) => IResponsiveTableColumnDefinition<TData>;
|
|
76
|
+
onHeaderClickCallback: (colDef: ColumnDefinition<TData>) => ((id: string) => void) | undefined;
|
|
77
|
+
getClickableHeaderClassName: (onHeaderClick: ((id: string) => void) | undefined, colDef: ColumnDefinition<TData>) => string;
|
|
78
|
+
getHeaderProps: (colDef: ColumnDefinition<TData>) => React.HTMLAttributes<HTMLElement> & {
|
|
79
|
+
className?: string;
|
|
80
|
+
};
|
|
81
|
+
getRowProps: (row: TData) => React.HTMLAttributes<HTMLElement>;
|
|
82
|
+
getRowId: (row: TData, index: number) => string | number;
|
|
83
|
+
renderCell: (content: React.ReactNode, row: TData, colDef: IResponsiveTableColumnDefinition<TData>) => React.ReactNode;
|
|
84
|
+
}
|
|
85
|
+
export declare const useTableContext: <TData>() => TableContextValue<TData>;
|
|
86
|
+
interface TableProviderProps<TData> {
|
|
87
|
+
children: ReactNode;
|
|
88
|
+
value: Omit<TableContextValue<TData>, 'currentData' | 'getRawColumnDefinition' | 'getColumnDefinition' | 'onHeaderClickCallback' | 'getClickableHeaderClassName' | 'getHeaderProps' | 'getRowProps' | 'getRowId' | 'renderCell'>;
|
|
89
|
+
}
|
|
90
|
+
export declare function TableProvider<TData>({ children, value }: TableProviderProps<TData>): React.JSX.Element;
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DataSource } from '../Context/TableContext';
|
|
2
|
+
interface UseTableDataSourceProps<TData> {
|
|
3
|
+
dataSource?: DataSource<TData>;
|
|
4
|
+
pageSize?: number;
|
|
5
|
+
initialData?: TData[];
|
|
6
|
+
sort?: {
|
|
7
|
+
columnId: string;
|
|
8
|
+
direction: 'asc' | 'desc';
|
|
9
|
+
};
|
|
10
|
+
filter?: string;
|
|
11
|
+
}
|
|
12
|
+
interface UseTableDataSourceReturn<TData> {
|
|
13
|
+
data: TData[];
|
|
14
|
+
currentPage: number;
|
|
15
|
+
hasMore: boolean;
|
|
16
|
+
totalCount?: number;
|
|
17
|
+
isLoading: boolean;
|
|
18
|
+
isFetchingMore: boolean;
|
|
19
|
+
loadNextPage: () => Promise<void>;
|
|
20
|
+
resetAndFetch: () => Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
export declare const useTableDataSource: <TData>(props: UseTableDataSourceProps<TData>) => UseTableDataSourceReturn<TData>;
|
|
23
|
+
export {};
|
package/dist/UI/DesktopView.d.ts
CHANGED
|
@@ -1,42 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { IResponsiveTableColumnDefinition } from '../Data/IResponsiveTableColumnDefinition';
|
|
3
2
|
import IFooterColumnDefinition from '../Data/IFooterColumnDefinition';
|
|
4
|
-
|
|
5
|
-
interface DesktopViewProps<TData> {
|
|
6
|
-
columnDefinitions: ColumnDefinition<TData>[];
|
|
7
|
-
originalColumnDefinitions: ColumnDefinition<TData>[];
|
|
8
|
-
currentData: TData[];
|
|
3
|
+
interface DesktopViewProps {
|
|
9
4
|
maxHeight?: string;
|
|
10
5
|
isHeaderSticky: boolean;
|
|
11
6
|
tableContainerRef: React.RefObject<HTMLDivElement>;
|
|
12
7
|
headerRef: React.RefObject<HTMLTableSectionElement>;
|
|
13
|
-
getRowProps: (row: TData) => React.HTMLAttributes<HTMLElement>;
|
|
14
|
-
getHeaderProps: (colDef: ColumnDefinition<TData>) => React.HTMLAttributes<HTMLElement> & {
|
|
15
|
-
className?: string;
|
|
16
|
-
};
|
|
17
|
-
onHeaderClickCallback: (colDef: ColumnDefinition<TData>) => ((id: string) => void) | undefined;
|
|
18
|
-
getClickableHeaderClassName: (onHeaderClick: ((id: string) => void) | undefined, colDef: ColumnDefinition<TData>) => string;
|
|
19
|
-
getRawColumnDefinition: (colDef: ColumnDefinition<TData>) => IResponsiveTableColumnDefinition<TData>;
|
|
20
|
-
getColumnDefinition: (colDef: ColumnDefinition<TData>, rowIndex: number) => IResponsiveTableColumnDefinition<TData>;
|
|
21
|
-
renderCell: (content: React.ReactNode, row: TData, colDef: IResponsiveTableColumnDefinition<TData>) => React.ReactNode;
|
|
22
|
-
rowClickFunction: (item: TData) => void;
|
|
23
8
|
footerRows?: {
|
|
24
9
|
columns: IFooterColumnDefinition[];
|
|
25
10
|
}[];
|
|
26
11
|
renderPluginFooters: () => React.ReactNode;
|
|
27
12
|
onScroll?: (e: React.UIEvent<HTMLDivElement>) => void;
|
|
28
|
-
animationProps?: {
|
|
29
|
-
isLoading?: boolean;
|
|
30
|
-
animateOnLoad?: boolean;
|
|
31
|
-
};
|
|
32
|
-
selectionProps?: {
|
|
33
|
-
onSelectionChange: (selectedItems: TData[]) => void;
|
|
34
|
-
rowIdKey: keyof TData;
|
|
35
|
-
mode?: 'single' | 'multiple';
|
|
36
|
-
selectedItems?: TData[];
|
|
37
|
-
selectedRowClassName?: string;
|
|
38
|
-
};
|
|
39
|
-
onRowClick?: (item: TData) => void;
|
|
40
13
|
}
|
|
41
|
-
declare function DesktopView<TData>(props: DesktopViewProps
|
|
14
|
+
declare function DesktopView<TData>(props: DesktopViewProps): React.JSX.Element;
|
|
42
15
|
export default DesktopView;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SortDirection } from '../Data/IResponsiveTableColumnDefinition';
|
|
3
3
|
import IFooterRowDefinition from '../Data/IFooterRowDefinition';
|
|
4
4
|
import { IResponsiveTablePlugin } from '../Plugins/IResponsiveTablePlugin';
|
|
5
|
-
|
|
5
|
+
import { ColumnDefinition } from '../Context/TableContext';
|
|
6
6
|
interface IInfiniteScrollProps<TData> {
|
|
7
7
|
onLoadMore: (currentData: TData[]) => Promise<TData[] | null>;
|
|
8
8
|
hasMore?: boolean;
|
package/dist/UI/MobileView.d.ts
CHANGED
|
@@ -1,29 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { ColumnDefinition } from './ResponsiveTable';
|
|
4
|
-
interface MobileViewProps<TData> {
|
|
5
|
-
currentData: TData[];
|
|
6
|
-
columnDefinitions: ColumnDefinition<TData>[];
|
|
7
|
-
onRowClick?: (item: TData) => void;
|
|
8
|
-
selectionProps?: {
|
|
9
|
-
onSelectionChange: (selectedItems: TData[]) => void;
|
|
10
|
-
rowIdKey: keyof TData;
|
|
11
|
-
mode?: 'single' | 'multiple';
|
|
12
|
-
selectedItems?: TData[];
|
|
13
|
-
selectedRowClassName?: string;
|
|
14
|
-
};
|
|
15
|
-
animationProps?: {
|
|
16
|
-
isLoading?: boolean;
|
|
17
|
-
animateOnLoad?: boolean;
|
|
18
|
-
};
|
|
19
|
-
getRowProps: (row: TData) => React.HTMLAttributes<HTMLElement>;
|
|
20
|
-
getRowId: (row: TData, index: number) => string | number;
|
|
21
|
-
getColumnDefinition: (colDef: ColumnDefinition<TData>, rowIndex: number) => IResponsiveTableColumnDefinition<TData>;
|
|
22
|
-
onHeaderClickCallback: (colDef: ColumnDefinition<TData>) => ((id: string) => void) | undefined;
|
|
23
|
-
getClickableHeaderClassName: (onHeaderClick: ((id: string) => void) | undefined, colDef: ColumnDefinition<TData>) => string;
|
|
24
|
-
renderCell: (content: React.ReactNode, row: TData, colDef: IResponsiveTableColumnDefinition<TData>) => React.ReactNode;
|
|
25
|
-
rowClickFunction: (item: TData) => void;
|
|
2
|
+
interface MobileViewProps {
|
|
26
3
|
mobileFooter: React.ReactNode;
|
|
27
4
|
}
|
|
28
|
-
declare function MobileView<TData>(props: MobileViewProps
|
|
5
|
+
declare function MobileView<TData>(props: MobileViewProps): React.JSX.Element;
|
|
29
6
|
export default MobileView;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SortDirection } from '../Data/IResponsiveTableColumnDefinition';
|
|
3
3
|
import IFooterRowDefinition from '../Data/IFooterRowDefinition';
|
|
4
4
|
import { IResponsiveTablePlugin } from '../Plugins/IResponsiveTablePlugin';
|
|
5
|
-
|
|
5
|
+
import { ColumnDefinition, DataSource } from '../Context/TableContext';
|
|
6
|
+
export { ColumnDefinition };
|
|
6
7
|
interface IInfiniteScrollProps<TData> {
|
|
7
8
|
onLoadMore: (currentData: TData[]) => Promise<TData[] | null>;
|
|
8
9
|
hasMore?: boolean;
|
|
@@ -14,21 +15,43 @@ interface ISortProps {
|
|
|
14
15
|
initialSortDirection?: SortDirection;
|
|
15
16
|
}
|
|
16
17
|
interface IProps<TData> {
|
|
18
|
+
/** The definitions for each column in the table. */
|
|
17
19
|
columnDefinitions: ColumnDefinition<TData>[];
|
|
20
|
+
/** The initial data to display. If using dataSource, this acts as the starting set. */
|
|
18
21
|
data: TData[];
|
|
22
|
+
/**
|
|
23
|
+
* A smart data source function for server-side pagination, sorting, and filtering.
|
|
24
|
+
* If provided, the table automatically handles infinite scroll and re-fetching on sort/filter.
|
|
25
|
+
*/
|
|
26
|
+
dataSource?: DataSource<TData>;
|
|
27
|
+
/** The number of items to fetch per page when using dataSource. Defaults to 20. */
|
|
28
|
+
pageSize?: number;
|
|
29
|
+
/** A component to display when there is no data. */
|
|
19
30
|
noDataComponent?: ReactNode;
|
|
31
|
+
/** The maximum height of the table container (enables internal scrolling). */
|
|
20
32
|
maxHeight?: string;
|
|
33
|
+
/** Callback for when a row is clicked. */
|
|
21
34
|
onRowClick?: (item: TData) => void;
|
|
35
|
+
/** Custom definitions for footer rows. */
|
|
22
36
|
footerRows?: IFooterRowDefinition[];
|
|
37
|
+
/** The pixel width at which the table switches to mobile card view. Defaults to 600. */
|
|
23
38
|
mobileBreakpoint?: number;
|
|
39
|
+
/** An array of plugins to extend table functionality. */
|
|
24
40
|
plugins?: IResponsiveTablePlugin<TData>[];
|
|
41
|
+
/** If true, the header will stick to the top of the page when scrolling. */
|
|
25
42
|
enablePageLevelStickyHeader?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Props for manual infinite scroll handling.
|
|
45
|
+
* NOTE: Prefer using `dataSource` for a more seamless experience.
|
|
46
|
+
*/
|
|
26
47
|
infiniteScrollProps?: IInfiniteScrollProps<TData>;
|
|
48
|
+
/** Configuration for the built-in filter plugin. */
|
|
27
49
|
filterProps?: {
|
|
28
50
|
showFilter?: boolean;
|
|
29
51
|
filterPlaceholder?: string;
|
|
30
52
|
className?: string;
|
|
31
53
|
};
|
|
54
|
+
/** Configuration for row selection. */
|
|
32
55
|
selectionProps?: {
|
|
33
56
|
onSelectionChange: (selectedItems: TData[]) => void;
|
|
34
57
|
rowIdKey: keyof TData;
|
|
@@ -36,11 +59,17 @@ interface IProps<TData> {
|
|
|
36
59
|
selectedItems?: TData[];
|
|
37
60
|
selectedRowClassName?: string;
|
|
38
61
|
};
|
|
62
|
+
/** Configuration for loading states and entrance animations. */
|
|
39
63
|
animationProps?: {
|
|
40
64
|
isLoading?: boolean;
|
|
41
65
|
animateOnLoad?: boolean;
|
|
42
66
|
};
|
|
67
|
+
/** Initial sort state for the table. */
|
|
43
68
|
sortProps?: ISortProps;
|
|
44
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* A highly customizable, mobile-first responsive React table.
|
|
72
|
+
* Supports static data or async data sources with built-in infinite scroll.
|
|
73
|
+
*/
|
|
45
74
|
declare function ResponsiveTable<TData>(props: IProps<TData>): React.JSX.Element;
|
|
46
75
|
export default ResponsiveTable;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ColumnDefinition } from '../Context/TableContext';
|
|
3
|
+
interface TableBodyCellProps<TData> {
|
|
4
|
+
row: TData;
|
|
5
|
+
rowIndex: number;
|
|
6
|
+
columnDefinition: ColumnDefinition<TData>;
|
|
7
|
+
}
|
|
8
|
+
export declare function TableBodyCell<TData>(props: TableBodyCellProps<TData>): React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ColumnDefinition } from '../Context/TableContext';
|
|
3
|
+
interface TableBodyRowProps<TData> {
|
|
4
|
+
row: TData;
|
|
5
|
+
rowIndex: number;
|
|
6
|
+
columnDefinitions: ColumnDefinition<TData>[];
|
|
7
|
+
onRowClick?: (item: TData) => void;
|
|
8
|
+
selectionProps?: {
|
|
9
|
+
onSelectionChange: (selectedItems: TData[]) => void;
|
|
10
|
+
rowIdKey: keyof TData;
|
|
11
|
+
mode?: 'single' | 'multiple';
|
|
12
|
+
selectedItems?: TData[];
|
|
13
|
+
selectedRowClassName?: string;
|
|
14
|
+
};
|
|
15
|
+
animationProps?: {
|
|
16
|
+
isLoading?: boolean;
|
|
17
|
+
animateOnLoad?: boolean;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare function TableBodyRow<TData>(props: TableBodyRowProps<TData>): React.JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ColumnDefinition } from '../Context/TableContext';
|
|
3
|
+
interface TableHeaderCellProps<TData> {
|
|
4
|
+
columnDefinition: ColumnDefinition<TData>;
|
|
5
|
+
colIndex: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function TableHeaderCell<TData>(props: TableHeaderCellProps<TData>): React.JSX.Element;
|
|
8
|
+
export {};
|
package/dist/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ResponsiveTable-module_responsiveTable__4y-Od{--table-border-color:#e0e0e0;--table-header-bg:#f8f9fa;--table-row-hover-bg:#f1f3f5;--table-row-stripe-bg:#fafbfc;--card-bg:#fff;--card-border-color:#e0e0e0;--card-shadow:0 2px 8px rgba(0,0,0,.06);--text-color:#212529;--text-color-muted:#6c757d;--interactive-color:#0056b3;--primary-color:#007bff}.ResponsiveTable-module_tableContainer__VjWjH{border:1px solid var(--table-border-color);border-radius:8px;overflow-x:auto;width:100%}.ResponsiveTable-module_responsiveTable__4y-Od{background-color:var(--card-bg);border-collapse:collapse;color:var(--text-color);width:100%}.ResponsiveTable-module_responsiveTable__4y-Od thead th{background-color:var(--table-header-bg);border-bottom:2px solid var(--table-border-color);color:var(--text-color-muted);font-size:.75rem;font-weight:600;letter-spacing:.05em;padding:1rem;text-align:left;text-transform:uppercase;z-index:1}.ResponsiveTable-module_responsiveTable__4y-Od td{border-bottom:1px solid var(--table-border-color);font-size:.9rem;padding:1rem;text-align:left}.ResponsiveTable-module_responsiveTable__4y-Od tr:last-child td{border-bottom:none}.ResponsiveTable-module_responsiveTable__4y-Od tr:nth-child(2n){background-color:var(--table-row-stripe-bg)}.ResponsiveTable-module_responsiveTable__4y-Od tr:hover{background-color:var(--table-row-hover-bg)}.ResponsiveTable-module_cardContainer__Het4h{display:flex;flex-direction:column;gap:1rem;padding:.5rem}.ResponsiveTable-module_card__b-U2v{background-color:var(--card-bg);border:1px solid var(--card-border-color);border-radius:12px;box-shadow:var(--card-shadow);overflow:hidden;padding:1.25rem;transition:box-shadow .2s ease-in-out,transform .2s ease-in-out}.ResponsiveTable-module_card__b-U2v:hover{box-shadow:0 4px 16px rgba(0,0,0,.08);transform:translateY(-2px)}.ResponsiveTable-module_card-header__Ttk51{border-bottom:1px solid var(--table-border-color);margin-bottom:1rem;padding-bottom:.5rem}.ResponsiveTable-module_card-row__qvIUJ{align-items:flex-start;display:flex;gap:1rem;justify-content:space-between;margin:0 0 .75rem}.ResponsiveTable-module_card-row__qvIUJ:last-child{margin-bottom:0}.ResponsiveTable-module_card-label__v9L71{color:var(--text-color-muted);font-size:.75rem;font-weight:600;text-transform:uppercase;white-space:nowrap}.ResponsiveTable-module_card-value__BO-c-{color:var(--text-color);font-size:.9rem;text-align:right}.ResponsiveTable-module_clickableRow__0kjWm{cursor:pointer}.ResponsiveTable-module_clickableHeader__xHQhF{cursor:pointer;transition:color .2s}.ResponsiveTable-module_clickableHeader__xHQhF:hover{color:var(--interactive-color)}.ResponsiveTable-module_sortable__yvA60{cursor:pointer}.ResponsiveTable-module_sorted-asc__jzOIa,.ResponsiveTable-module_sorted-desc__7WCFK{background-color:#f0f7ff!important;color:var(--interactive-color)!important}.ResponsiveTable-module_headerInnerWrapper__3VAhD{align-items:center;display:flex;justify-content:space-between;width:100%}.ResponsiveTable-module_headerContent__ODMzS{flex-grow:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ResponsiveTable-module_sortIcon__A9WtD{background-position:50%;background-repeat:no-repeat;background-size:contain;flex-shrink:0;height:1rem;margin-left:.5rem;opacity:.3;width:1rem}.ResponsiveTable-module_sortable__yvA60:hover .ResponsiveTable-module_sortIcon__A9WtD{opacity:.8}.ResponsiveTable-module_sortable__yvA60 .ResponsiveTable-module_sortIcon__A9WtD{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236c757d'%3E%3Cpath d='M10 18h4v-2h-4v2zm-6-8v2h16V8H4zm3-6h10v2H7V2z'/%3E%3C/svg%3E")}.ResponsiveTable-module_sorted-asc__jzOIa .ResponsiveTable-module_sortIcon__A9WtD{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230056b3'%3E%3Cpath d='m7 14 5-5 5 5z'/%3E%3C/svg%3E");opacity:1}.ResponsiveTable-module_sorted-desc__7WCFK .ResponsiveTable-module_sortIcon__A9WtD{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230056b3'%3E%3Cpath d='m7 10 5 5 5-5z'/%3E%3C/svg%3E");opacity:1}.ResponsiveTable-module_responsiveTable__4y-Od tfoot{background-color:var(--table-header-bg);border-top:2px solid var(--table-border-color)}.ResponsiveTable-module_footerCell__8H-uG{font-size:.9rem;font-weight:600;padding:1rem;text-align:right}.ResponsiveTable-module_clickableFooterCell__WB9Ss{color:var(--interactive-color);cursor:pointer}.ResponsiveTable-module_clickableFooterCell__WB9Ss:hover{text-decoration:underline}.ResponsiveTable-module_footerCard__-NE2M{background-color:var(--table-header-bg);border:1px solid var(--card-border-color);border-radius:12px;margin-top:1rem;overflow:hidden;padding:1.25rem}.ResponsiveTable-module_footer-card-row__Vv6Ur{display:flex;font-size:.9rem;font-weight:600;justify-content:space-between;margin:0 0 .75rem}.ResponsiveTable-module_selectedRow__-JyNW{background-color:#e7f1ff!important}.ResponsiveTable-module_card__b-U2v.ResponsiveTable-module_selectedRow__-JyNW{border-left:4px solid var(--primary-color)}.ResponsiveTable-module_animatedRow__SFjrJ{animation:ResponsiveTable-module_fadeInUp__jMCS7 .4s ease-out forwards;opacity:0}@keyframes ResponsiveTable-module_fadeInUp__jMCS7{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.ResponsiveTable-module_skeleton__XxsXW{background-color:#f0f0f0;border-radius:4px;overflow:hidden;position:relative}.ResponsiveTable-module_skeleton__XxsXW:after{animation:ResponsiveTable-module_shimmer__H8PhC 1.5s infinite;background:linear-gradient(90deg,transparent,hsla(0,0%,100%,.6),transparent);content:"";height:100%;left:-150%;position:absolute;top:0;width:150%}@keyframes ResponsiveTable-module_shimmer__H8PhC{0%{transform:translateX(0)}to{transform:translateX(100%)}}.ResponsiveTable-module_noDataWrapper__Rj-k3{align-items:center;background-color:var(--table-header-bg);border:2px dashed var(--table-border-color);border-radius:12px;color:var(--text-color-muted);display:flex;flex-direction:column;gap:1rem;justify-content:center;padding:4rem 2rem}.ResponsiveTable-module_noData__IpwNq{font-size:1.1rem;font-weight:500}.ResponsiveTable-module_spinner__Pn-3D{animation:ResponsiveTable-module_spin__i3NHn .8s linear infinite;border:3px solid rgba(0,0,0,.1);border-left:3px solid var(--primary-color);border-radius:50%;height:24px;width:24px}@keyframes ResponsiveTable-module_spin__i3NHn{to{transform:rotate(1turn)}}.ResponsiveTable-module_infoContainer__b9IF5{align-items:center;color:var(--text-color-muted);display:flex;font-size:.85rem;gap:.5rem;justify-content:center;padding:1.5rem}.ResponsiveTable-module_stickyHeader__-jjN- th{box-shadow:0 2px 4px rgba(0,0,0,.05);position:sticky;top:0}.ResponsiveTable-module_internalStickyHeader__idiJY th{position:sticky;top:0}.LoadingSpinner-module_spinner__F9V3x{animation:LoadingSpinner-module_spin__VkBDO .8s cubic-bezier(.4,0,.2,1) infinite;border:3px solid rgba(0,0,0,.05);border-left:3px solid var(--primary-color,#007bff);border-radius:50%;display:inline-block;height:28px;vertical-align:middle;width:28px}@keyframes LoadingSpinner-module_spin__VkBDO{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.NoMoreDataMessage-module_infoContainer__dk1r5{align-items:center;background-color:var(--table-header-bg,#f8f9fa);border-top:1px solid var(--table-border-color,#e0e0e0);color:var(--text-color-muted,#6c757d);display:flex;font-size:.85rem;gap:.75rem;justify-content:center;padding:2rem;width:100%}.NoMoreDataMessage-module_infoContainer__dk1r5.NoMoreDataMessage-module_noMoreData__ATuIg{font-weight:600;letter-spacing:.02em}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import IFooterColumnDefinition from './Data/IFooterColumnDefinition';
|
|
2
2
|
import IFooterRowDefinition from './Data/IFooterRowDefinition';
|
|
3
3
|
import { IResponsiveTableColumnDefinition, SortDirection } from './Data/IResponsiveTableColumnDefinition';
|
|
4
|
-
import ResponsiveTable
|
|
4
|
+
import ResponsiveTable from './UI/ResponsiveTable';
|
|
5
|
+
import { ColumnDefinition, DataSource, IDataSourceParams, DataSourceResult } from './Context/TableContext';
|
|
5
6
|
import { FilterPlugin } from './Plugins/FilterPlugin';
|
|
6
7
|
import { InfiniteScrollPlugin } from './Plugins/InfiniteScrollPlugin';
|
|
7
8
|
import { IResponsiveTablePlugin } from './Plugins/IResponsiveTablePlugin';
|
|
8
9
|
import { SortPlugin } from './Plugins/SortPlugin';
|
|
9
10
|
import { SelectionPlugin } from './Plugins/SelectionPlugin';
|
|
10
|
-
export { SortDirection, IResponsiveTableColumnDefinition, ColumnDefinition, IFooterColumnDefinition, IFooterRowDefinition, FilterPlugin, InfiniteScrollPlugin, IResponsiveTablePlugin, SortPlugin, SelectionPlugin, };
|
|
11
|
+
export { SortDirection, IResponsiveTableColumnDefinition, ColumnDefinition, DataSource, IDataSourceParams, DataSourceResult, IFooterColumnDefinition, IFooterRowDefinition, FilterPlugin, InfiniteScrollPlugin, IResponsiveTablePlugin, SortPlugin, SelectionPlugin, };
|
|
11
12
|
export default ResponsiveTable;
|