@jielga/tmdatagrid 0.1.0 → 0.2.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/README.md +35 -2
- package/dist/index.d.ts +442 -337
- package/dist/index.js +811 -694
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +15 -7
- package/skills/columns/SKILL.md +8 -7
- package/skills/features/SKILL.md +104 -16
- package/skills/getting-started/SKILL.md +39 -16
- package/skills/options/SKILL.md +12 -7
- package/skills/server-side/SKILL.md +5 -2
- package/src/tmdatagrid/TMDataGridContext.ts +1 -1
- package/src/tmdatagrid/components/TMDataGrid.module.css +63 -0
- package/src/tmdatagrid/{TMDataGrid.tsx → components/TMDataGrid.tsx} +9 -4
- package/src/tmdatagrid/components/TMDataGridColumnsPanel.module.css +25 -0
- package/src/tmdatagrid/{TMDataGridColumnsPanel.tsx → components/TMDataGridColumnsPanel.tsx} +3 -3
- package/src/tmdatagrid/components/TMDataGridFilterPanel.module.css +20 -0
- package/src/tmdatagrid/{TMDataGridFilterPanel.tsx → components/TMDataGridFilterPanel.tsx} +4 -4
- package/src/tmdatagrid/components/TMDataGridFooter.module.css +10 -0
- package/src/tmdatagrid/components/TMDataGridFooter.tsx +143 -0
- package/src/tmdatagrid/components/TMDataGridHeaderCell.module.css +153 -0
- package/src/tmdatagrid/{TMDataGridHeaderCell.tsx → components/TMDataGridHeaderCell.tsx} +22 -13
- package/src/tmdatagrid/components/TMDataGridSelectColumn.tsx +100 -0
- package/src/tmdatagrid/components/TMDataGridTable.module.css +103 -0
- package/src/tmdatagrid/{TMDataGridTable.tsx → components/TMDataGridTable.tsx} +79 -20
- package/src/tmdatagrid/components/TMDataGridToolbar.module.css +12 -0
- package/src/tmdatagrid/{TMDataGridToolbar.tsx → components/TMDataGridToolbar.tsx} +5 -5
- package/src/tmdatagrid/components/sticky.module.css +45 -0
- package/src/tmdatagrid/{capabilities.ts → core/capabilities.ts} +30 -2
- package/src/tmdatagrid/{columnOrdering.ts → core/columnOrdering.ts} +2 -2
- package/src/tmdatagrid/{columnUtils.ts → core/columnUtils.ts} +1 -1
- package/src/tmdatagrid/{persistence.ts → core/persistence.ts} +80 -2
- package/src/tmdatagrid/index.ts +15 -9
- package/src/tmdatagrid/useTMDataGrid.tsx +102 -55
- package/src/tmdatagrid/TMDataGrid.module.css +0 -410
- package/src/tmdatagrid/TMDataGridFooter.tsx +0 -74
- /package/src/tmdatagrid/{icons.ts → components/icons.ts} +0 -0
- /package/src/tmdatagrid/{filterOperators.ts → core/filterOperators.ts} +0 -0
- /package/src/tmdatagrid/{sizes.ts → core/sizes.ts} +0 -0
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { ActionIcon, Group, Select, Text } from "@mantine/core";
|
|
2
|
-
import { useSelector } from "@tanstack/react-store";
|
|
3
|
-
import classes from "./TMDataGrid.module.css";
|
|
4
|
-
import { useTMDataGridContext } from "./TMDataGridContext";
|
|
5
|
-
import { ChevronLeftIcon, ChevronRightIcon } from "./icons";
|
|
6
|
-
|
|
7
|
-
export type TMDataGridFooterProps = {
|
|
8
|
-
pageSizeOptions?: ReadonlyArray<number>;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* MUI-style pager: "Rows per page · from–to of total · ‹ ›".
|
|
13
|
-
*
|
|
14
|
-
* Row totals come from `table.getRowCount()`, which prefers `options.rowCount`
|
|
15
|
-
* — so a server-paged grid shows the server's total without changes here.
|
|
16
|
-
*/
|
|
17
|
-
export function TMDataGridFooter({
|
|
18
|
-
pageSizeOptions = [10, 25, 50, 100],
|
|
19
|
-
}: TMDataGridFooterProps) {
|
|
20
|
-
const { table, controlSize } = useTMDataGridContext();
|
|
21
|
-
useSelector(table.store);
|
|
22
|
-
|
|
23
|
-
const { pageIndex, pageSize } = table.store.state.pagination;
|
|
24
|
-
const total = table.getRowCount();
|
|
25
|
-
const from = total === 0 ? 0 : pageIndex * pageSize + 1;
|
|
26
|
-
const to = Math.min(total, (pageIndex + 1) * pageSize);
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<div className={classes.footer}>
|
|
30
|
-
<Group gap="xs" wrap="nowrap">
|
|
31
|
-
<Text size={controlSize} c="dimmed">
|
|
32
|
-
Rows per page:
|
|
33
|
-
</Text>
|
|
34
|
-
<Select
|
|
35
|
-
size={controlSize}
|
|
36
|
-
w={78}
|
|
37
|
-
allowDeselect={false}
|
|
38
|
-
variant="unstyled"
|
|
39
|
-
data={pageSizeOptions.map(String)}
|
|
40
|
-
value={String(pageSize)}
|
|
41
|
-
onChange={(value) => {
|
|
42
|
-
table.setPageSize(Number(value) || pageSizeOptions[0]);
|
|
43
|
-
table.setPageIndex(0);
|
|
44
|
-
}}
|
|
45
|
-
/>
|
|
46
|
-
</Group>
|
|
47
|
-
|
|
48
|
-
<Text size={controlSize} c="dimmed">
|
|
49
|
-
{from}–{to} of {total}
|
|
50
|
-
</Text>
|
|
51
|
-
|
|
52
|
-
<Group gap={4} wrap="nowrap">
|
|
53
|
-
<ActionIcon
|
|
54
|
-
variant="subtle"
|
|
55
|
-
color="gray"
|
|
56
|
-
aria-label="Previous page"
|
|
57
|
-
disabled={!table.getCanPreviousPage()}
|
|
58
|
-
onClick={() => table.previousPage()}
|
|
59
|
-
>
|
|
60
|
-
<ChevronLeftIcon size={18} stroke={1.6} />
|
|
61
|
-
</ActionIcon>
|
|
62
|
-
<ActionIcon
|
|
63
|
-
variant="subtle"
|
|
64
|
-
color="gray"
|
|
65
|
-
aria-label="Next page"
|
|
66
|
-
disabled={!table.getCanNextPage()}
|
|
67
|
-
onClick={() => table.nextPage()}
|
|
68
|
-
>
|
|
69
|
-
<ChevronRightIcon size={18} stroke={1.6} />
|
|
70
|
-
</ActionIcon>
|
|
71
|
-
</Group>
|
|
72
|
-
</div>
|
|
73
|
-
);
|
|
74
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|