@synerise/ds-table-new 0.1.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.
- package/CHANGELOG.md +10 -0
- package/LICENSE.md +21 -0
- package/README.md +153 -0
- package/dist/Table.const.d.ts +20 -0
- package/dist/Table.const.js +42 -0
- package/dist/Table.d.ts +3 -0
- package/dist/Table.js +51 -0
- package/dist/Table.styles.d.ts +15 -0
- package/dist/Table.styles.js +29 -0
- package/dist/Table.types.d.ts +359 -0
- package/dist/Table.types.js +1 -0
- package/dist/VirtualTable.d.ts +3 -0
- package/dist/VirtualTable.js +222 -0
- package/dist/components/BaseTable/BaseTable.d.ts +3 -0
- package/dist/components/BaseTable/BaseTable.js +114 -0
- package/dist/components/BaseTable/BaseTable.styles.d.ts +28 -0
- package/dist/components/BaseTable/BaseTable.styles.js +41 -0
- package/dist/components/Cell/Action/ActionCell.d.ts +3 -0
- package/dist/components/Cell/Action/ActionCell.js +16 -0
- package/dist/components/Cell/Action/ActionCell.styles.d.ts +5 -0
- package/dist/components/Cell/Action/ActionCell.styles.js +13 -0
- package/dist/components/Cell/Action/ActionCell.types.d.ts +13 -0
- package/dist/components/Cell/Action/ActionCell.types.js +1 -0
- package/dist/components/Cell/AvatarLabel/AvatarLabel.d.ts +4 -0
- package/dist/components/Cell/AvatarLabel/AvatarLabel.js +42 -0
- package/dist/components/Cell/AvatarLabel/AvatarLabel.styles.d.ts +27 -0
- package/dist/components/Cell/AvatarLabel/AvatarLabel.styles.js +49 -0
- package/dist/components/Cell/AvatarLabel/AvatarLabel.types.d.ts +22 -0
- package/dist/components/Cell/AvatarLabel/AvatarLabel.types.js +1 -0
- package/dist/components/Cell/Copyable/Copyable.styles.d.ts +2 -0
- package/dist/components/Cell/Copyable/Copyable.styles.js +14 -0
- package/dist/components/Cell/Copyable/Copyable.types.d.ts +11 -0
- package/dist/components/Cell/Copyable/Copyable.types.js +1 -0
- package/dist/components/Cell/Copyable/CopyableCell.d.ts +4 -0
- package/dist/components/Cell/Copyable/CopyableCell.js +28 -0
- package/dist/components/Cell/Editable/EditableCell.d.ts +4 -0
- package/dist/components/Cell/Editable/EditableCell.js +30 -0
- package/dist/components/Cell/Editable/EditableCell.styles.d.ts +4 -0
- package/dist/components/Cell/Editable/EditableCell.styles.js +14 -0
- package/dist/components/Cell/Editable/EditableCell.types.d.ts +11 -0
- package/dist/components/Cell/Editable/EditableCell.types.js +1 -0
- package/dist/components/Cell/FlagLabel/FlagLabelCell.d.ts +4 -0
- package/dist/components/Cell/FlagLabel/FlagLabelCell.js +16 -0
- package/dist/components/Cell/FlagLabel/FlagLabelCell.styles.d.ts +1 -0
- package/dist/components/Cell/FlagLabel/FlagLabelCell.styles.js +8 -0
- package/dist/components/Cell/FlagLabel/FlagLabelCell.types.d.ts +11 -0
- package/dist/components/Cell/FlagLabel/FlagLabelCell.types.js +1 -0
- package/dist/components/Cell/IconLabel/IconLabel.d.ts +4 -0
- package/dist/components/Cell/IconLabel/IconLabel.js +15 -0
- package/dist/components/Cell/IconLabel/IconLabel.styles.d.ts +3 -0
- package/dist/components/Cell/IconLabel/IconLabel.styles.js +9 -0
- package/dist/components/Cell/IconLabel/IconLabel.types.d.ts +13 -0
- package/dist/components/Cell/IconLabel/IconLabel.types.js +1 -0
- package/dist/components/Cell/IconTooltipCell/IconTooltipCell.d.ts +4 -0
- package/dist/components/Cell/IconTooltipCell/IconTooltipCell.js +19 -0
- package/dist/components/Cell/IconTooltipCell/IconTooltipCell.styles.d.ts +4 -0
- package/dist/components/Cell/IconTooltipCell/IconTooltipCell.styles.js +13 -0
- package/dist/components/Cell/IconTooltipCell/IconTooltipCell.types.d.ts +16 -0
- package/dist/components/Cell/IconTooltipCell/IconTooltipCell.types.js +1 -0
- package/dist/components/Cell/InputNumber/InputNumberCell.d.ts +4 -0
- package/dist/components/Cell/InputNumber/InputNumberCell.js +11 -0
- package/dist/components/Cell/InputNumber/InputNumberCell.styles.d.ts +3 -0
- package/dist/components/Cell/InputNumber/InputNumberCell.styles.js +11 -0
- package/dist/components/Cell/InputNumber/InputNumberCell.types.d.ts +7 -0
- package/dist/components/Cell/InputNumber/InputNumberCell.types.js +1 -0
- package/dist/components/Cell/LabelsWithShowMore/LabelsWithShowMore.d.ts +5 -0
- package/dist/components/Cell/LabelsWithShowMore/LabelsWithShowMore.js +33 -0
- package/dist/components/Cell/LabelsWithShowMore/LabelsWithShowMore.styles.d.ts +3 -0
- package/dist/components/Cell/LabelsWithShowMore/LabelsWithShowMore.styles.js +18 -0
- package/dist/components/Cell/LabelsWithShowMore/LabelsWithShowMore.types.d.ts +22 -0
- package/dist/components/Cell/LabelsWithShowMore/LabelsWithShowMore.types.js +1 -0
- package/dist/components/Cell/LabelsWithShowMore/Modal/Modal.d.ts +4 -0
- package/dist/components/Cell/LabelsWithShowMore/Modal/Modal.js +37 -0
- package/dist/components/Cell/LabelsWithShowMore/Modal/Modal.types.d.ts +15 -0
- package/dist/components/Cell/LabelsWithShowMore/Modal/Modal.types.js +1 -0
- package/dist/components/Cell/Star/StarCell.d.ts +4 -0
- package/dist/components/Cell/Star/StarCell.js +25 -0
- package/dist/components/Cell/Star/StarCell.styles.d.ts +5 -0
- package/dist/components/Cell/Star/StarCell.styles.js +16 -0
- package/dist/components/Cell/Star/StarCell.types.d.ts +17 -0
- package/dist/components/Cell/Star/StarCell.types.js +1 -0
- package/dist/components/Cell/StatusLabel/StatusLabel.d.ts +4 -0
- package/dist/components/Cell/StatusLabel/StatusLabel.js +18 -0
- package/dist/components/Cell/StatusLabel/StatusLabel.styles.d.ts +4 -0
- package/dist/components/Cell/StatusLabel/StatusLabel.styles.js +13 -0
- package/dist/components/Cell/StatusLabel/StatusLabel.types.d.ts +14 -0
- package/dist/components/Cell/StatusLabel/StatusLabel.types.js +1 -0
- package/dist/components/Cell/TagIcon/TagIcon.d.ts +4 -0
- package/dist/components/Cell/TagIcon/TagIcon.js +10 -0
- package/dist/components/Cell/TagIcon/TagIcon.styles.d.ts +3 -0
- package/dist/components/Cell/TagIcon/TagIcon.styles.js +9 -0
- package/dist/components/Cell/TagIcon/TagIcon.types.d.ts +11 -0
- package/dist/components/Cell/TagIcon/TagIcon.types.js +1 -0
- package/dist/components/Cell/TagsGroup/TagsGroup.d.ts +3 -0
- package/dist/components/Cell/TagsGroup/TagsGroup.js +26 -0
- package/dist/components/Cell/TagsGroup/TagsGroup.styles.d.ts +5 -0
- package/dist/components/Cell/TagsGroup/TagsGroup.styles.js +34 -0
- package/dist/components/Cell/TagsGroup/TagsGroup.types.d.ts +9 -0
- package/dist/components/Cell/TagsGroup/TagsGroup.types.js +1 -0
- package/dist/components/Cell/index.d.ts +26 -0
- package/dist/components/Cell/index.js +28 -0
- package/dist/components/TableBody/TableBody.d.ts +3 -0
- package/dist/components/TableBody/TableBody.js +40 -0
- package/dist/components/TableBody/TableBody.styles.d.ts +2 -0
- package/dist/components/TableBody/TableBody.styles.js +15 -0
- package/dist/components/TableBody/TableBodySkeleton/TableBodySkeleton.d.ts +5 -0
- package/dist/components/TableBody/TableBodySkeleton/TableBodySkeleton.js +42 -0
- package/dist/components/TableBody/TableBodySkeleton/TableBodySkeleton.styles.d.ts +9 -0
- package/dist/components/TableBody/TableBodySkeleton/TableBodySkeleton.styles.js +30 -0
- package/dist/components/TableBody/TableCell/TableCell.d.ts +16 -0
- package/dist/components/TableBody/TableCell/TableCell.js +19 -0
- package/dist/components/TableBody/TableCell/TableCell.styles.d.ts +10 -0
- package/dist/components/TableBody/TableCell/TableCell.styles.js +18 -0
- package/dist/components/TableBody/TableEmptyBody/TableEmptyBody.d.ts +3 -0
- package/dist/components/TableBody/TableEmptyBody/TableEmptyBody.js +18 -0
- package/dist/components/TableBody/TableEmptyBody/TableEmptyBody.styles.d.ts +4 -0
- package/dist/components/TableBody/TableEmptyBody/TableEmptyBody.styles.js +23 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/ErrorItem.d.ts +8 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/ErrorItem.js +19 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/ErrorItem.styles.d.ts +1 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/ErrorItem.styles.js +8 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/InfiniteLoaderRow.d.ts +14 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/InfiniteLoaderRow.js +50 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/LoadingItem.d.ts +5 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/LoadingItem.js +10 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/LoadingItem.styles.d.ts +1 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/LoadingItem.styles.js +9 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/NoMoreItem.d.ts +5 -0
- package/dist/components/TableBody/TableRow/InfiniteLoaderRow/NoMoreItem.js +10 -0
- package/dist/components/TableBody/TableRow/TableRow.d.ts +5 -0
- package/dist/components/TableBody/TableRow/TableRow.js +29 -0
- package/dist/components/TableBody/TableRow/TableRow.styles.d.ts +7 -0
- package/dist/components/TableBody/TableRow/TableRow.styles.js +15 -0
- package/dist/components/TableBody/TableRow/TableRowVirtual.d.ts +5 -0
- package/dist/components/TableBody/TableRow/TableRowVirtual.js +88 -0
- package/dist/components/TableBody/TableRowSelection/TableRowSelection.d.ts +3 -0
- package/dist/components/TableBody/TableRowSelection/TableRowSelection.js +39 -0
- package/dist/components/TableColumns/TableColumnSorter/SortIcons/DefaultSortIcon.d.ts +5 -0
- package/dist/components/TableColumns/TableColumnSorter/SortIcons/DefaultSortIcon.js +19 -0
- package/dist/components/TableColumns/TableColumnSorter/SortIcons/StringSortIcon.d.ts +5 -0
- package/dist/components/TableColumns/TableColumnSorter/SortIcons/StringSortIcon.js +19 -0
- package/dist/components/TableColumns/TableColumnSorter/TableColumnSorter.const.d.ts +4 -0
- package/dist/components/TableColumns/TableColumnSorter/TableColumnSorter.const.js +8 -0
- package/dist/components/TableColumns/TableColumnSorter/TableColumnSorter.d.ts +3 -0
- package/dist/components/TableColumns/TableColumnSorter/TableColumnSorter.js +75 -0
- package/dist/components/TableColumns/TableColumnSorter/TableColumnSorter.styles.d.ts +30 -0
- package/dist/components/TableColumns/TableColumnSorter/TableColumnSorter.styles.js +11 -0
- package/dist/components/TableColumns/TableColumns.d.ts +3 -0
- package/dist/components/TableColumns/TableColumns.js +28 -0
- package/dist/components/TableColumns/TableColumns.styles.d.ts +18 -0
- package/dist/components/TableColumns/TableColumns.styles.js +35 -0
- package/dist/components/TableHeader/TableCounter/TableCounter.d.ts +3 -0
- package/dist/components/TableHeader/TableCounter/TableCounter.js +33 -0
- package/dist/components/TableHeader/TableCounter/TableCounter.styles.d.ts +1 -0
- package/dist/components/TableHeader/TableCounter/TableCounter.styles.js +8 -0
- package/dist/components/TableHeader/TableHeader.d.ts +3 -0
- package/dist/components/TableHeader/TableHeader.js +103 -0
- package/dist/components/TableHeader/TableHeader.styles.d.ts +18 -0
- package/dist/components/TableHeader/TableHeader.styles.js +48 -0
- package/dist/components/TableHeader/TableHeaderSelection/TableHeaderSelection.d.ts +3 -0
- package/dist/components/TableHeader/TableHeaderSelection/TableHeaderSelection.js +123 -0
- package/dist/components/TableHeader/TableHeaderSelection/TableHeaderSelection.styles.d.ts +8 -0
- package/dist/components/TableHeader/TableHeaderSelection/TableHeaderSelection.styles.js +21 -0
- package/dist/components/TableHeader/TableLimit/TableLimit.d.ts +3 -0
- package/dist/components/TableHeader/TableLimit/TableLimit.js +50 -0
- package/dist/components/TableHeader/TableLimit/TableLimit.styles.d.ts +4 -0
- package/dist/components/TableHeader/TableLimit/TableLimit.styles.js +24 -0
- package/dist/components/TableHeader/TableLimit/TableLimit.types.d.ts +10 -0
- package/dist/components/TableHeader/TableLimit/TableLimit.types.js +1 -0
- package/dist/components/TableHorizontalScroll/TableHorizontalScroll.d.ts +6 -0
- package/dist/components/TableHorizontalScroll/TableHorizontalScroll.js +41 -0
- package/dist/components/TableHorizontalScroll/TableHorizontalScroll.styles.d.ts +12 -0
- package/dist/components/TableHorizontalScroll/TableHorizontalScroll.styles.js +33 -0
- package/dist/components/TableHorizontalScrollBar/TableHorizontalScrollBar.d.ts +6 -0
- package/dist/components/TableHorizontalScrollBar/TableHorizontalScrollBar.js +11 -0
- package/dist/components/TableHorizontalScrollBar/TableHorizontalScrollBar.styles.d.ts +4 -0
- package/dist/components/TableHorizontalScrollBar/TableHorizontalScrollBar.styles.js +14 -0
- package/dist/components/TablePagination/TablePagination.d.ts +3 -0
- package/dist/components/TablePagination/TablePagination.js +19 -0
- package/dist/components/TablePagination/TablePagination.styles.d.ts +1 -0
- package/dist/components/TablePagination/TablePagination.styles.js +8 -0
- package/dist/contexts/SelectionContext.d.ts +4 -0
- package/dist/contexts/SelectionContext.js +10 -0
- package/dist/contexts/StickyContext.d.ts +8 -0
- package/dist/contexts/StickyContext.js +9 -0
- package/dist/contexts/TableContext.d.ts +11 -0
- package/dist/contexts/TableContext.js +13 -0
- package/dist/hooks/useColumnSizing.d.ts +23 -0
- package/dist/hooks/useColumnSizing.js +95 -0
- package/dist/hooks/useDefaultTexts.d.ts +2 -0
- package/dist/hooks/useDefaultTexts.js +95 -0
- package/dist/hooks/useInfiniteScroll.d.ts +13 -0
- package/dist/hooks/useInfiniteScroll.js +58 -0
- package/dist/hooks/useRowKey.d.ts +4 -0
- package/dist/hooks/useRowKey.js +27 -0
- package/dist/hooks/useScrollSync.d.ts +2 -0
- package/dist/hooks/useScrollSync.js +23 -0
- package/dist/hooks/useTable.d.ts +14 -0
- package/dist/hooks/useTable.js +168 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +50 -0
- package/dist/types/table.d.js +1 -0
- package/dist/types/table.d.ts +28 -0
- package/dist/utils/arrayToTrueMap.d.ts +1 -0
- package/dist/utils/arrayToTrueMap.js +7 -0
- package/dist/utils/calculatePixels.d.ts +1 -0
- package/dist/utils/calculatePixels.js +21 -0
- package/dist/utils/compareKeys.d.ts +1 -0
- package/dist/utils/compareKeys.js +16 -0
- package/dist/utils/getChildrenColumnName.d.ts +1 -0
- package/dist/utils/getChildrenColumnName.js +7 -0
- package/dist/utils/getDefaultSkeletonColumns.d.ts +2 -0
- package/dist/utils/getDefaultSkeletonColumns.js +58 -0
- package/dist/utils/getInfiniteScrollPadding.d.ts +2 -0
- package/dist/utils/getInfiniteScrollPadding.js +13 -0
- package/dist/utils/getIsRevealed.d.ts +5 -0
- package/dist/utils/getIsRevealed.js +9 -0
- package/dist/utils/getPaginationConfig.d.ts +10 -0
- package/dist/utils/getPaginationConfig.js +19 -0
- package/dist/utils/getRecordSelectionStatus.d.ts +5 -0
- package/dist/utils/getRecordSelectionStatus.js +13 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/isRecordSelectable.d.ts +2 -0
- package/dist/utils/isRecordSelectable.js +14 -0
- package/dist/utils/legacyColumnConfigAdapter.d.ts +3 -0
- package/dist/utils/legacyColumnConfigAdapter.js +113 -0
- package/dist/utils/processColumns.d.ts +3 -0
- package/dist/utils/processColumns.js +24 -0
- package/dist/utils/sort.d.ts +3 -0
- package/dist/utils/sort.js +14 -0
- package/package.json +76 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
# 0.1.0 (2026-04-10)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **table-new:** initial commit ([a524cb9](https://github.com/Synerise/synerise-design/commit/a524cb9cfa464921edb9531ccf002dcc25a3b105))
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Synerise
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: table-new
|
|
3
|
+
title: TableNew
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
TableNew UI Component
|
|
7
|
+
|
|
8
|
+
A data table component for the Synerise Design System built on top of [@tanstack/react-table](https://tanstack.com/table) and [@tanstack/react-virtual](https://tanstack.com/virtual). It provides two variants: a standard paginated `Table` and a virtualized `VirtualTable` for large datasets with infinite scrolling.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
```
|
|
12
|
+
npm i @synerise/ds-table-new
|
|
13
|
+
or
|
|
14
|
+
yarn add @synerise/ds-table-new
|
|
15
|
+
or
|
|
16
|
+
pnpm add @synerise/ds-table-new
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### Standard paginated table
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { Table } from '@synerise/ds-table-new';
|
|
25
|
+
|
|
26
|
+
const columns = [
|
|
27
|
+
{ accessorKey: 'name', header: 'Name' },
|
|
28
|
+
{ accessorKey: 'age', header: 'Age' },
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const data = [
|
|
32
|
+
{ name: 'John', age: 28 },
|
|
33
|
+
{ name: 'Jane', age: 32 },
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
<Table data={data} columns={columns} pagination={{ pageSize: 10 }} />
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Virtualized table with infinite scroll
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
import { VirtualTable } from '@synerise/ds-table-new';
|
|
43
|
+
|
|
44
|
+
<VirtualTable
|
|
45
|
+
data={data}
|
|
46
|
+
columns={columns}
|
|
47
|
+
scroll={{ y: 500 }}
|
|
48
|
+
infiniteScroll={{
|
|
49
|
+
hasMore: true,
|
|
50
|
+
isLoading: false,
|
|
51
|
+
hasError: false,
|
|
52
|
+
onScrollEndReach: () => loadMore(),
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Demo
|
|
58
|
+
|
|
59
|
+
<iframe src="/storybook-static/iframe.html?id=components-table-new--default"></iframe>
|
|
60
|
+
|
|
61
|
+
## Exports
|
|
62
|
+
|
|
63
|
+
| Export | Description |
|
|
64
|
+
| --- | --- |
|
|
65
|
+
| `Table` | Standard paginated table component |
|
|
66
|
+
| `VirtualTable` | Virtualized table for large/infinite datasets |
|
|
67
|
+
| `TableCell` | Pre-built cell renderers |
|
|
68
|
+
| `legacyColumnConfigAdapter` | Utility to convert legacy column configs to TanStack format |
|
|
69
|
+
|
|
70
|
+
## API
|
|
71
|
+
|
|
72
|
+
### Shared props (Table & VirtualTable)
|
|
73
|
+
|
|
74
|
+
| Property | Description | Type | Default |
|
|
75
|
+
| --- | --- | --- | --- |
|
|
76
|
+
| `data` | Array of row data | `TData[]` | **required** |
|
|
77
|
+
| `columns` | Column definitions (TanStack ColumnDef) | `ColumnDef<TData, TValue>[]` | **required** |
|
|
78
|
+
| `title` | Table title rendered in the header bar | `ReactNode` | - |
|
|
79
|
+
| `rowKey` | Unique row identifier — function or property name | `((row: TData) => string) \| keyof TData` | - |
|
|
80
|
+
| `selectionConfig` | Row selection configuration (onChange, limit, etc.) | `SelectionConfig<TData>` | - |
|
|
81
|
+
| `selectedRowKeys` | Currently selected row keys | `string[]` | - |
|
|
82
|
+
| `onRowClick` | Row click handler | `(row: TData, event: MouseEvent) => void` | - |
|
|
83
|
+
| `onSort` | Sort change handler | `OnSortFn` | - |
|
|
84
|
+
| `isLoading` | Show loading skeleton | `boolean` | - |
|
|
85
|
+
| `cellHeight` | Estimated row height in px | `number` | - |
|
|
86
|
+
| `className` | CSS class for styled-components composition | `string` | - |
|
|
87
|
+
| `showHeader` | Show or hide the table header bar | `boolean` | - |
|
|
88
|
+
| `itemsMenu` | Rendered next to title when rows are selected (batch actions) | `ReactNode` | - |
|
|
89
|
+
| `searchComponent` | Search input rendered on the right side of the header | `ReactNode` | - |
|
|
90
|
+
| `filterComponent` | Filter controls rendered on the right side of the header | `ReactNode` | - |
|
|
91
|
+
| `headerButton` | Button rendered in the header | `ReactNode` | - |
|
|
92
|
+
| `cardStyles` | Render table with rounded corners and shadow | `boolean` | - |
|
|
93
|
+
| `headerWithBorderTop` | Render top border on the table header | `boolean` | - |
|
|
94
|
+
| `hideColumnNames` | Hide the column header row | `boolean` | - |
|
|
95
|
+
| `hideTitleBar` | Hide the entire title bar | `boolean` | - |
|
|
96
|
+
| `hideTitlePart` | Hide only the title, keep the counter | `boolean` | - |
|
|
97
|
+
| `disableColumnNamesLineBreak` | Apply `white-space: nowrap` to column header cells | `boolean` | - |
|
|
98
|
+
| `isCounterLoading` | Show skeleton in place of total count | `boolean` | - |
|
|
99
|
+
| `dataSourceTotalCount` | Total row count (useful when server-side) | `number` | - |
|
|
100
|
+
| `emptyDataComponent` | Custom empty state component | `ReactNode` | - |
|
|
101
|
+
| `texts` | Override default i18n text labels | `Partial<TableTexts>` | - |
|
|
102
|
+
| `expandable` | Tree/expandable row configuration | `Expandable<TData>` | - |
|
|
103
|
+
| `renderSelectionTitle` | Custom selection title renderer | `(selection?) => ReactNode` | - |
|
|
104
|
+
| `renderCustomCounter` | Custom counter renderer | `CustomCounterFn` | - |
|
|
105
|
+
|
|
106
|
+
### Table-only props
|
|
107
|
+
|
|
108
|
+
| Property | Description | Type | Default |
|
|
109
|
+
| --- | --- | --- | --- |
|
|
110
|
+
| `pagination` | Pagination config or `false` to disable | `boolean \| TablePaginationConfig` | `{ pageSize: 10 }` |
|
|
111
|
+
|
|
112
|
+
### VirtualTable-only props
|
|
113
|
+
|
|
114
|
+
| Property | Description | Type | Default |
|
|
115
|
+
| --- | --- | --- | --- |
|
|
116
|
+
| `scroll` | Scroll container dimensions `{ x?, y }` | `{ x?: number; y: number }` | - |
|
|
117
|
+
| `infiniteScroll` | Infinite scroll configuration | `InfiniteScrollProps` | - |
|
|
118
|
+
| `stickyHeader` | Stick header to top on scroll | `boolean` | - |
|
|
119
|
+
| `sticky` | Advanced sticky configuration with scroll container | `{ scrollThreshold?; offsetHeader?; getContainer }` | - |
|
|
120
|
+
| `tableRef` | Ref exposing `scrollToTop`, `scrollTo`, `scrollToIndex`, `getDimensions` | `RefObject<VirtualTableRef>` | - |
|
|
121
|
+
| `scrollElementRef` | External scroll container ref | `MutableRefObject<HTMLDivElement \| null>` | - |
|
|
122
|
+
| `onItemsRendered` | Callback with `{ visibleStartIndex }` as rows are virtualized | `(props: OnItemsRenderedProps) => void` | - |
|
|
123
|
+
| `onScrollToRecordIndex` | Callback when scrolling to a specific record index | `(recordIndex, callback?) => void` | - |
|
|
124
|
+
|
|
125
|
+
### SelectionConfig
|
|
126
|
+
|
|
127
|
+
| Property | Description | Type | Default |
|
|
128
|
+
| --- | --- | --- | --- |
|
|
129
|
+
| `onChange` | Called when selection changes | `(selectedRowKeys: string[], selectedRows: TData[]) => void` | **required** |
|
|
130
|
+
| `limit` | Maximum number of selectable rows | `number` | - |
|
|
131
|
+
| `hideSelectAll` | Hide "select all" checkbox | `boolean` | - |
|
|
132
|
+
| `fixed` | Fix selection column position | `boolean` | - |
|
|
133
|
+
| `selections` | Custom selection menu items | `SelectionItem[]` | - |
|
|
134
|
+
| `globalSelectionOnChange` | Handler for "select all across pages" | `(selected: boolean) => void` | - |
|
|
135
|
+
| `globalSelected` | Current global selection state | `boolean` | - |
|
|
136
|
+
| `checkRowSelectionStatus` | Per-row disabled/unavailable check | `(record: TData) => { disabled?; unavailable? }` | - |
|
|
137
|
+
| `independentSelectionExpandedRows` | Treat expanded child rows as independent selections | `boolean` | - |
|
|
138
|
+
|
|
139
|
+
### InfiniteScrollProps
|
|
140
|
+
|
|
141
|
+
| Property | Description | Type | Default |
|
|
142
|
+
| --- | --- | --- | --- |
|
|
143
|
+
| `hasMore` | Whether more data is available | `boolean` | **required** |
|
|
144
|
+
| `isLoading` | Whether data is currently loading | `boolean` | **required** |
|
|
145
|
+
| `hasError` | Whether the last fetch errored | `boolean` | **required** |
|
|
146
|
+
| `onScrollEndReach` | Called when user scrolls to bottom | `() => void` | - |
|
|
147
|
+
| `onScrollTopReach` | Called when user scrolls to top | `() => void` | - |
|
|
148
|
+
| `showBackToTopButton` | Show "back to top" button | `boolean` | - |
|
|
149
|
+
| `onBackToTop` | Called when "back to top" is clicked | `() => void` | - |
|
|
150
|
+
| `onRetryButtonClick` | Called when retry button is clicked | `(position: 'TOP' \| 'BOTTOM') => void` | - |
|
|
151
|
+
| `prevPage` | State for bidirectional infinite scroll (loading previous pages) | `InfiniteScrollState` | - |
|
|
152
|
+
| `maxScroll` | Maximum scroll height | `number` | - |
|
|
153
|
+
| `render` | Custom loader renderer | `(state: InfiniteScrollState) => ReactElement` | - |
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { OnSortFn, SelectionAll, SelectionInvert, StickyData } from './Table.types';
|
|
2
|
+
export declare const EXPANDED_ROW_PROPERTY = "expandedChild";
|
|
3
|
+
export declare const SELECTION_ALL: SelectionAll;
|
|
4
|
+
export declare const SELECTION_INVERT: SelectionInvert;
|
|
5
|
+
export declare const DEFAULT_CELL_HEIGHT = 73;
|
|
6
|
+
export declare const SELECTION_COLUMN_ID = "SELECTION_COLUMN_ID";
|
|
7
|
+
export declare const ACTION_COLUMN_ID = "ACTION_COLUMN_ID";
|
|
8
|
+
export declare const INFINITE_SCROLL_TRIGGER_THRESHOLD = 500;
|
|
9
|
+
export declare const INFINITE_SCROLL_PADDING_START = 101;
|
|
10
|
+
export declare const DEFAULT_PAGINATION_CONFIG: {
|
|
11
|
+
initialState: {
|
|
12
|
+
pagination: {
|
|
13
|
+
pageSize: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export declare const INFINITE_LOADER_ITEM_HEIGHT = 64;
|
|
18
|
+
export declare const DEFAULT_STICKY_VALUE: StickyData;
|
|
19
|
+
export declare const BOTTOM_BORDER_WIDTH = 1;
|
|
20
|
+
export declare const EMPTY_SORT_STATE: Parameters<OnSortFn>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
const EXPANDED_ROW_PROPERTY = "expandedChild";
|
|
2
|
+
const SELECTION_ALL = "SELECTION_ALL";
|
|
3
|
+
const SELECTION_INVERT = "SELECTION_INVERT";
|
|
4
|
+
const DEFAULT_CELL_HEIGHT = 73;
|
|
5
|
+
const SELECTION_COLUMN_ID = "SELECTION_COLUMN_ID";
|
|
6
|
+
const ACTION_COLUMN_ID = "ACTION_COLUMN_ID";
|
|
7
|
+
const INFINITE_SCROLL_TRIGGER_THRESHOLD = 500;
|
|
8
|
+
const INFINITE_SCROLL_PADDING_START = 101;
|
|
9
|
+
const DEFAULT_PAGINATION_CONFIG = {
|
|
10
|
+
initialState: {
|
|
11
|
+
pagination: {
|
|
12
|
+
pageSize: 10
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const INFINITE_LOADER_ITEM_HEIGHT = 64;
|
|
17
|
+
const DEFAULT_STICKY_VALUE = {
|
|
18
|
+
containerPaddingTop: 0,
|
|
19
|
+
titleBarHeight: 0,
|
|
20
|
+
columnHeadersHeight: 0,
|
|
21
|
+
isRevealed: false
|
|
22
|
+
};
|
|
23
|
+
const BOTTOM_BORDER_WIDTH = 1;
|
|
24
|
+
const EMPTY_SORT_STATE = [{
|
|
25
|
+
columnKey: "",
|
|
26
|
+
order: null
|
|
27
|
+
}, {}];
|
|
28
|
+
export {
|
|
29
|
+
ACTION_COLUMN_ID,
|
|
30
|
+
BOTTOM_BORDER_WIDTH,
|
|
31
|
+
DEFAULT_CELL_HEIGHT,
|
|
32
|
+
DEFAULT_PAGINATION_CONFIG,
|
|
33
|
+
DEFAULT_STICKY_VALUE,
|
|
34
|
+
EMPTY_SORT_STATE,
|
|
35
|
+
EXPANDED_ROW_PROPERTY,
|
|
36
|
+
INFINITE_LOADER_ITEM_HEIGHT,
|
|
37
|
+
INFINITE_SCROLL_PADDING_START,
|
|
38
|
+
INFINITE_SCROLL_TRIGGER_THRESHOLD,
|
|
39
|
+
SELECTION_ALL,
|
|
40
|
+
SELECTION_COLUMN_ID,
|
|
41
|
+
SELECTION_INVERT
|
|
42
|
+
};
|
package/dist/Table.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TableProps } from './Table.types';
|
|
3
|
+
export declare const Table: <TData extends object, TValue>({ data, columns, texts: defaultTexts, selectionConfig, isLoading, selectedRowKeys, pagination, ...props }: TableProps<TData, TValue>) => React.JSX.Element;
|
package/dist/Table.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useMemo } from "react";
|
|
3
|
+
import { BaseTable } from "./components/BaseTable/BaseTable.js";
|
|
4
|
+
import { SelectionContext } from "./contexts/SelectionContext.js";
|
|
5
|
+
import { TableContext } from "./contexts/TableContext.js";
|
|
6
|
+
import { useDefaultTexts } from "./hooks/useDefaultTexts.js";
|
|
7
|
+
import { useTable } from "./hooks/useTable.js";
|
|
8
|
+
import { getDefaultSkeletonColumns } from "./utils/getDefaultSkeletonColumns.js";
|
|
9
|
+
import { processColumns } from "./utils/processColumns.js";
|
|
10
|
+
const Table = ({
|
|
11
|
+
data,
|
|
12
|
+
columns,
|
|
13
|
+
texts: defaultTexts,
|
|
14
|
+
selectionConfig,
|
|
15
|
+
isLoading,
|
|
16
|
+
selectedRowKeys,
|
|
17
|
+
pagination,
|
|
18
|
+
...props
|
|
19
|
+
}) => {
|
|
20
|
+
const texts = useDefaultTexts(defaultTexts);
|
|
21
|
+
const wrapperRef = useRef(null);
|
|
22
|
+
const hasSelection = !!selectionConfig;
|
|
23
|
+
const processedColumns = useMemo(() => {
|
|
24
|
+
return columns.length ? processColumns(columns, hasSelection, texts) : columns;
|
|
25
|
+
}, [columns, hasSelection, texts]);
|
|
26
|
+
const skeletonColumns = useMemo(() => getDefaultSkeletonColumns(), []);
|
|
27
|
+
const finalColumns = !processedColumns.length && isLoading ? skeletonColumns : processedColumns;
|
|
28
|
+
const {
|
|
29
|
+
table,
|
|
30
|
+
paginationProps,
|
|
31
|
+
hasPagination,
|
|
32
|
+
columnSizing,
|
|
33
|
+
isColumnSizingReady
|
|
34
|
+
} = useTable({
|
|
35
|
+
data,
|
|
36
|
+
columns: finalColumns,
|
|
37
|
+
pagination,
|
|
38
|
+
selectionConfig,
|
|
39
|
+
selectedRowKeys,
|
|
40
|
+
wrapperRef,
|
|
41
|
+
requireColumnSizing: false
|
|
42
|
+
});
|
|
43
|
+
const tableContextValue = useMemo(() => ({
|
|
44
|
+
table,
|
|
45
|
+
getScrollContainer: () => null
|
|
46
|
+
}), [table]);
|
|
47
|
+
return /* @__PURE__ */ jsx(TableContext.Provider, { value: tableContextValue, children: /* @__PURE__ */ jsx(SelectionContext.Provider, { value: selectionConfig, children: /* @__PURE__ */ jsx(BaseTable, { texts, isLoading, hasPagination, paginationProps, tableOuterRef: wrapperRef, selectedRowKeys, columnSizing, isColumnSizingReady, ...props }) }) });
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
Table
|
|
51
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const TableContainer: import('styled-components').StyledComponent<"div", any, {
|
|
2
|
+
withBorderTop?: boolean;
|
|
3
|
+
withInfiniteScroll?: boolean;
|
|
4
|
+
}, never>;
|
|
5
|
+
export declare const commonPinnedStyles: import('styled-components').FlattenInterpolation<import('styled-components').ThemedStyledProps<{
|
|
6
|
+
isPinned?: "left" | "right" | false;
|
|
7
|
+
leftOffset?: number;
|
|
8
|
+
rightOffset?: number;
|
|
9
|
+
}, any>>;
|
|
10
|
+
export declare const commonRowStyles = "\n display: table;\n width: 100%;\n table-layout: fixed;\n";
|
|
11
|
+
export declare const commonCellStyles: import('styled-components').FlattenInterpolation<import('styled-components').ThemeProps<any>>;
|
|
12
|
+
export declare const TableSkeleton: import('styled-components').StyledComponent<({ size, numberOfSkeletons, width, height, className, }: import('@synerise/ds-skeleton').SkeletonProps) => React.JSX.Element, any, {
|
|
13
|
+
skeletonWidth?: string;
|
|
14
|
+
}, never>;
|
|
15
|
+
export declare const StyledTable: import('styled-components').StyledComponent<"table", any, {}, never>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import DSSkeleton from "@synerise/ds-skeleton";
|
|
3
|
+
const TableContainer = /* @__PURE__ */ styled.div.withConfig({
|
|
4
|
+
displayName: "Tablestyles__TableContainer",
|
|
5
|
+
componentId: "sc-zrmzmn-0"
|
|
6
|
+
})(["width:100%;overflow:scroll;", " ", " background:", ";"], (props) => props.withInfiniteScroll && `max-height: 1200px;`, (props) => props.withBorderTop && css(["border-top:solid 1px ", ";"], props.theme.palette["grey-200"]), (props) => props.theme.palette["white"]);
|
|
7
|
+
const commonPinnedStyles = /* @__PURE__ */ css(["left:", ";right:", ";position:", ";z-index:", ";"], (props) => props.isPinned === "left" ? `${props.leftOffset}px` : "auto", (props) => props.isPinned === "right" ? `${props.rightOffset}px` : "auto", (props) => props.isPinned ? "sticky" : "relative", (props) => props.isPinned ? 1 : 0);
|
|
8
|
+
const commonRowStyles = `
|
|
9
|
+
display: table;
|
|
10
|
+
width: 100%;
|
|
11
|
+
table-layout: fixed;
|
|
12
|
+
`;
|
|
13
|
+
const commonCellStyles = /* @__PURE__ */ css(["white-space:nowrap;overflow:hidden;padding:0 24px;text-overflow:ellipsis;border-bottom:1px solid ", ";transition:background-color 0.2s,border-color 0.2s;"], (props) => props.theme.palette["grey-200"]);
|
|
14
|
+
const TableSkeleton = /* @__PURE__ */ styled(DSSkeleton).withConfig({
|
|
15
|
+
displayName: "Tablestyles__TableSkeleton",
|
|
16
|
+
componentId: "sc-zrmzmn-1"
|
|
17
|
+
})(["padding:0;", ""], (props) => props.skeletonWidth && `width: ${props.skeletonWidth};`);
|
|
18
|
+
const StyledTable = /* @__PURE__ */ styled.table.withConfig({
|
|
19
|
+
displayName: "Tablestyles__StyledTable",
|
|
20
|
+
componentId: "sc-zrmzmn-2"
|
|
21
|
+
})(["width:100%;border-spacing:0;border-collapse:separate;"]);
|
|
22
|
+
export {
|
|
23
|
+
StyledTable,
|
|
24
|
+
TableContainer,
|
|
25
|
+
TableSkeleton,
|
|
26
|
+
commonCellStyles,
|
|
27
|
+
commonPinnedStyles,
|
|
28
|
+
commonRowStyles
|
|
29
|
+
};
|