@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.
Files changed (39) hide show
  1. package/README.md +35 -2
  2. package/dist/index.d.ts +442 -337
  3. package/dist/index.js +811 -694
  4. package/dist/index.js.map +1 -1
  5. package/dist/styles.css +1 -1
  6. package/package.json +15 -7
  7. package/skills/columns/SKILL.md +8 -7
  8. package/skills/features/SKILL.md +104 -16
  9. package/skills/getting-started/SKILL.md +39 -16
  10. package/skills/options/SKILL.md +12 -7
  11. package/skills/server-side/SKILL.md +5 -2
  12. package/src/tmdatagrid/TMDataGridContext.ts +1 -1
  13. package/src/tmdatagrid/components/TMDataGrid.module.css +63 -0
  14. package/src/tmdatagrid/{TMDataGrid.tsx → components/TMDataGrid.tsx} +9 -4
  15. package/src/tmdatagrid/components/TMDataGridColumnsPanel.module.css +25 -0
  16. package/src/tmdatagrid/{TMDataGridColumnsPanel.tsx → components/TMDataGridColumnsPanel.tsx} +3 -3
  17. package/src/tmdatagrid/components/TMDataGridFilterPanel.module.css +20 -0
  18. package/src/tmdatagrid/{TMDataGridFilterPanel.tsx → components/TMDataGridFilterPanel.tsx} +4 -4
  19. package/src/tmdatagrid/components/TMDataGridFooter.module.css +10 -0
  20. package/src/tmdatagrid/components/TMDataGridFooter.tsx +143 -0
  21. package/src/tmdatagrid/components/TMDataGridHeaderCell.module.css +153 -0
  22. package/src/tmdatagrid/{TMDataGridHeaderCell.tsx → components/TMDataGridHeaderCell.tsx} +22 -13
  23. package/src/tmdatagrid/components/TMDataGridSelectColumn.tsx +100 -0
  24. package/src/tmdatagrid/components/TMDataGridTable.module.css +103 -0
  25. package/src/tmdatagrid/{TMDataGridTable.tsx → components/TMDataGridTable.tsx} +79 -20
  26. package/src/tmdatagrid/components/TMDataGridToolbar.module.css +12 -0
  27. package/src/tmdatagrid/{TMDataGridToolbar.tsx → components/TMDataGridToolbar.tsx} +5 -5
  28. package/src/tmdatagrid/components/sticky.module.css +45 -0
  29. package/src/tmdatagrid/{capabilities.ts → core/capabilities.ts} +30 -2
  30. package/src/tmdatagrid/{columnOrdering.ts → core/columnOrdering.ts} +2 -2
  31. package/src/tmdatagrid/{columnUtils.ts → core/columnUtils.ts} +1 -1
  32. package/src/tmdatagrid/{persistence.ts → core/persistence.ts} +80 -2
  33. package/src/tmdatagrid/index.ts +15 -9
  34. package/src/tmdatagrid/useTMDataGrid.tsx +102 -55
  35. package/src/tmdatagrid/TMDataGrid.module.css +0 -410
  36. package/src/tmdatagrid/TMDataGridFooter.tsx +0 -74
  37. /package/src/tmdatagrid/{icons.ts → components/icons.ts} +0 -0
  38. /package/src/tmdatagrid/{filterOperators.ts → core/filterOperators.ts} +0 -0
  39. /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