|
1 | 1 | # React Multi Level Table |
2 | 2 |
|
| 3 | +<div align="center"> |
| 4 | +<!-- Screenshot of the table component in action --> |
| 5 | +<img src="./src/assets/table-image.png" alt="Multi Level Table Component Example" width="800" height="400"/> |
| 6 | +</div> |
| 7 | + |
3 | 8 | ## Table of Contents |
4 | 9 |
|
5 | 10 | - [Overview](#overview) |
@@ -144,33 +149,33 @@ The MultiLevelTable component accepts the following props: |
144 | 149 | | selectable | boolean | No | false | Enable/disable row selection | |
145 | 150 |
|
146 | 151 | #### State Props |
147 | | -| Prop | Type | Required | Description | |
148 | | -|------|------|----------|-------------| |
149 | | -| selectionState | SelectionState | Yes | Current selection state with selected rows and all selected flag | |
150 | | -| searchTerm | string | Yes | Current search term for filtering data | |
151 | | -| selectedFilterValues | Set<string \| number> | Yes | Currently selected filter values | |
152 | | -| deletePopup | object | Yes | Delete confirmation popup state (isOpen, itemId, itemName) | |
153 | | -| bulkDeletePopup | object | Yes | Bulk delete confirmation popup state (isOpen, selectedCount) | |
154 | | -| openDropdowns | Set<string> | Yes | Set of currently open dropdown IDs | |
155 | | -| expandedRows | Set<string \| number> | Yes | Set of currently expanded row IDs | |
| 152 | +| Prop | Type | Required | Default | Description | |
| 153 | +|------|------|----------|---------|-------------| |
| 154 | +| selectionState | SelectionState | No | { selectedRows: new Set(), isAllSelected: false } | Current selection state with selected rows and all selected flag | |
| 155 | +| searchTerm | string | No | '' | Current search term for filtering data | |
| 156 | +| selectedFilterValues | Set<string \| number> | No | new Set() | Currently selected filter values | |
| 157 | +| deletePopup | object | No | { isOpen: false, itemId: null, itemName: '' } | Delete confirmation popup state (isOpen, itemId, itemName) | |
| 158 | +| bulkDeletePopup | object | No | { isOpen: false, selectedCount: 0 } | Bulk delete confirmation popup state (isOpen, selectedCount) | |
| 159 | +| openDropdowns | Set<string> | No | new Set() | Set of currently open dropdown IDs | |
| 160 | +| expandedRows | Set<string \| number> | No | new Set() | Set of currently expanded row IDs | |
156 | 161 |
|
157 | 162 | #### Handler Props |
158 | | -| Prop | Type | Description | |
159 | | -|------|------|-------------| |
160 | | -| onSearchChange | (searchTerm: string) => void | Updates the search term for filtering data | |
161 | | -| onFilterChange | (values: Set<string \| number>) => void | Updates the selected filter values | |
162 | | -| onDeleteClick | (itemId: string \| number, itemName: string) => void | Handles delete button click for a specific row | |
163 | | -| onDeleteConfirm | () => void | Confirms the delete action for the selected row | |
164 | | -| onDeleteCancel | () => void | Cancels the delete action and closes popup | |
165 | | -| onBulkDeleteClick | () => void | Handles bulk delete button click for selected rows | |
166 | | -| onBulkDeleteConfirm | () => void | Confirms the bulk delete action for selected rows | |
167 | | -| onBulkDeleteCancel | () => void | Cancels the bulk delete action and closes popup | |
168 | | -| onDropdownToggle | (buttonId: string, isOpen: boolean) => void | Toggles dropdown open/close state for action buttons | |
169 | | -| onDropdownClose | (buttonId: string) => void | Closes a specific dropdown by ID | |
170 | | -| onButtonClick | (button: ButtonConfig) => void | Handles click events for action buttons (export, filter, etc.) | |
171 | | -| onSelectAll | () => void | Handles select all checkbox click to select/deselect all rows | |
172 | | -| onRowSelect | (rowId: string \| number) => void | Handles individual row selection checkbox click | |
173 | | -| onRowToggle | (rowId: string \| number) => void | Handles row expand/collapse toggle for nested rows | |
| 163 | +| Prop | Type | Required | Default | Description | |
| 164 | +|------|------|----------|---------|-------------| |
| 165 | +| onSearchChange | (searchTerm: string) => void | No | - | Updates the search term for filtering data | |
| 166 | +| onFilterChange | (values: Set<string \| number>) => void | No | - | Updates the selected filter values | |
| 167 | +| onDeleteClick | (itemId: string \| number, itemName: string) => void | No | - | Handles delete button click for a specific row | |
| 168 | +| onDeleteConfirm | () => void | No | - | Confirms the delete action for the selected row | |
| 169 | +| onDeleteCancel | () => void | No | - | Cancels the delete action and closes popup | |
| 170 | +| onBulkDeleteClick | () => void | No | - | Handles bulk delete button click for selected rows | |
| 171 | +| onBulkDeleteConfirm | () => void | No | - | Confirms the bulk delete action for selected rows | |
| 172 | +| onBulkDeleteCancel | () => void | No | - | Cancels the bulk delete action and closes popup | |
| 173 | +| onDropdownToggle | (buttonId: string, isOpen: boolean) => void | No | - | Toggles dropdown open/close state for action buttons | |
| 174 | +| onDropdownClose | (buttonId: string) => void | No | - | Closes a specific dropdown by ID | |
| 175 | +| onButtonClick | (button: ButtonConfig) => void | No | - | Handles click events for action buttons (export, filter, etc.) | |
| 176 | +| onSelectAll | () => void | No | - | Handles select all checkbox click to select/deselect all rows | |
| 177 | +| onRowSelect | (rowId: string \| number) => void | No | - | Handles individual row selection checkbox click | |
| 178 | +| onRowToggle | (rowId: string \| number) => void | No | - | Handles row expand/collapse toggle for nested rows | |
174 | 179 |
|
175 | 180 | #### Additional Props |
176 | 181 | | Prop | Type | Default | Description | |
@@ -356,6 +361,7 @@ interface PaginationProps { |
356 | 361 | previousPage: () => void; // Go to previous page |
357 | 362 | setPageSize: (pageSize: number) => void; // Change page size |
358 | 363 | state: TableStateWithPagination<T>; // Current table state |
| 364 | + theme?: ThemeProps; // Optional theme for styling |
359 | 365 | } |
360 | 366 | ``` |
361 | 367 |
|
|
0 commit comments