1.0.8 β’ Published 1 month ago
@shridey/intelligentable v1.0.8
π§ IntelligentTable Component
A highly customizable, feature-rich React table component built on Ant Designβs Table, with intelligent data handling, advanced sorting, filtering, and visualization capabilities.
β¨ Features
- β Smart Data Handling: Automatically detects and sorts percentages, grades, weekdays, and dates
- π¨ Visual Data Representation: Color-coded cells based on value thresholds
- π TSV Export: Built-in copy-to-clipboard and download fallback
- π± Responsive Design: Adapts to various screen sizes with horizontal scroll
- βΏ Accessibility Focused: Keyboard navigable with proper ARIA support
- π Dark Mode: Full compatibility with dark theme implementations
- β‘ Performance Optimized: Supports virtual scrolling for large datasets
π¦ Installation
npm install @shridey/intelligentable
# or
yarn add @shridey/intelligentable
π Usage
import IntelligentTable from "@shridey/intelligentable";
const columns = [
{
title: "Student",
dataIndex: "studentName",
operation: "count",
},
{
title: "Performance",
children: [
{
title: "Math",
dataIndex: "mathScore",
color: [
{ min: 0, max: 60, color: "#ff4d4f" },
{ min: 60, max: 80, color: "#faad14" },
{ min: 80, max: 101, color: "#52c41a" },
],
operation: "average",
},
],
},
];
const data = [
{ studentName: "Alice", mathScore: "85%" },
{ studentName: "Bob", mathScore: "72%" },
];
function App() {
return (
<IntelligentTable columns={columns} data={data} enableLegends enableCopy />
);
}
π§ Props
Prop | Type | Default | Description |
---|---|---|---|
columns | Array<Column> | [] | Table column configuration |
data | Array<Object> | [] | Data to display in the table |
schoolName | string | 'icps-clone' | Base path for student profile links |
summaryTitle | string | '' | Title for the summary row |
instructions | string | '' | Help text above the table |
loading | boolean | false | Shows loading indicator |
pagination | boolean | false | Enables pagination controls |
stickyHeader | boolean | false | Sticky header on scroll |
enableLegends | boolean | false | Show color legends |
enableSummary | boolean | true | Show summary calculation row |
enableCopy | boolean | true | Enable copy to clipboard |
darkMode | boolean | false | Dark theme compatibility |
styles | object | undefined | Inline style overrides |
π§± Column Configuration
Each column object can include the following properties:
{
title: 'Column Title',
dataIndex: 'fieldName',
operation: 'sum', // or 'average', 'count'
color: [
{ min: 0, max: 60, color: 'red' },
{ value: 'N/A', color: 'gray' }
],
filter: [
{ min: 0, max: 60, effect: true }
],
sorted: 'asc', // or 'desc'
width: 150,
handleClick: (id, name, field) => {}
}
π Advanced Features
π Smart Sorting
- Percentages (
85%
,90%
) - Grades (
K
,1
, ...,12
) - Weekdays (
Mon
,Tue
, ...) - Dates (various formats)
- Numbers and text (fallback)
π¨ Color Thresholds
color: [
{ min: 0, max: 60, color: "#ff4d4f" },
{ min: 60, max: 80, color: "#faad14" },
{ min: 80, max: 101, color: "#52c41a" },
];
π€ Data Export
- TSV (Tab-Separated Values) export
- Clipboard copy with fallback to file download
- Excel-friendly formatting
π Summary Row
- Automatic count, sum, average
- Per-column operation setting
- Custom title with
summaryTitle
prop
π¨ Theming & Customization
CSS Variables
:root {
--background-color: #ffffff;
--text-color: #333333;
--chart-background: #fafafa;
}
Inline Style Overrides
<IntelligentTable
styles={{
header: { fontSize: "14px" },
cell: { padding: "8px" },
}}
/>
β‘ Performance Tips
For large datasets (1000+ rows):
- β Use virtual scrolling
- β Set fixed column widths
- β Avoid complex renderers in cells
- β Enable pagination if needed
π Browser Support
Browser | Supported |
---|---|
Chrome | β Latest |
Firefox | β Latest |
Safari | β Latest |
Edge | β Latest |
IE11 | β Not Supported |
π€ Contributing
Contributions are welcome!
Please open an issue to propose changes or features before submitting a pull request.
π License
MIT Β© Shridhar Pandey