@jielga/tmdatagrid 2.0.0-beta.0 → 2.0.0-beta.10

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 (72) hide show
  1. package/README.md +32 -34
  2. package/dist/index.d.ts +691 -242
  3. package/dist/index.js +3432 -2328
  4. package/dist/index.js.map +1 -1
  5. package/dist/styles.css +1 -1
  6. package/package.json +2 -1
  7. package/skills/appearance/SKILL.md +77 -37
  8. package/skills/cell-selection/SKILL.md +43 -51
  9. package/skills/columns/SKILL.md +111 -13
  10. package/skills/data/SKILL.md +64 -60
  11. package/skills/editing/SKILL.md +288 -329
  12. package/skills/editing/references/common-mistakes.md +264 -0
  13. package/skills/editing/references/editing-api.md +83 -33
  14. package/skills/editing/references/editors-and-validation.md +97 -33
  15. package/skills/filtering/SKILL.md +51 -50
  16. package/skills/getting-started/SKILL.md +20 -18
  17. package/skills/grouping/SKILL.md +60 -45
  18. package/skills/options/SKILL.md +35 -7
  19. package/skills/rows/SKILL.md +65 -61
  20. package/skills/rows/references/rows-api.md +7 -7
  21. package/skills/server-side/SKILL.md +1 -1
  22. package/skills/testing/SKILL.md +12 -11
  23. package/src/tmdatagrid/TMDataGridContext.ts +7 -19
  24. package/src/tmdatagrid/components/TMDataGrid.module.css +20 -2
  25. package/src/tmdatagrid/components/TMDataGrid.tsx +11 -6
  26. package/src/tmdatagrid/components/TMDataGridCellEditor.tsx +108 -29
  27. package/src/tmdatagrid/components/TMDataGridColumnsPanel.tsx +10 -32
  28. package/src/tmdatagrid/components/TMDataGridDetailsColumn.tsx +9 -12
  29. package/src/tmdatagrid/components/TMDataGridDraftActions.tsx +296 -0
  30. package/src/tmdatagrid/components/TMDataGridEditColumn.tsx +267 -93
  31. package/src/tmdatagrid/components/TMDataGridEntryRows.tsx +169 -82
  32. package/src/tmdatagrid/components/TMDataGridFooter.tsx +5 -5
  33. package/src/tmdatagrid/components/TMDataGridGroupColumn.tsx +4 -3
  34. package/src/tmdatagrid/components/TMDataGridHeaderCell.tsx +84 -27
  35. package/src/tmdatagrid/components/TMDataGridMenu.tsx +222 -0
  36. package/src/tmdatagrid/components/TMDataGridSelectColumn.tsx +13 -10
  37. package/src/tmdatagrid/components/TMDataGridTable.module.css +106 -11
  38. package/src/tmdatagrid/components/TMDataGridTable.tsx +607 -122
  39. package/src/tmdatagrid/components/TMDataGridToolbar.module.css +4 -0
  40. package/src/tmdatagrid/components/TMDataGridToolbar.tsx +12 -55
  41. package/src/tmdatagrid/components/editors/TMDataGridBooleanEditor.tsx +3 -3
  42. package/src/tmdatagrid/components/editors/TMDataGridDateEditor.tsx +3 -3
  43. package/src/tmdatagrid/components/editors/TMDataGridMultiSelectEditor.tsx +3 -3
  44. package/src/tmdatagrid/components/editors/TMDataGridNumberEditor.tsx +37 -7
  45. package/src/tmdatagrid/components/editors/TMDataGridSelectEditor.tsx +3 -3
  46. package/src/tmdatagrid/components/editors/TMDataGridStringEditor.tsx +3 -3
  47. package/src/tmdatagrid/components/editors/editorShared.ts +15 -30
  48. package/src/tmdatagrid/components/icons.ts +2 -0
  49. package/src/tmdatagrid/components/useHideableColumns.ts +52 -0
  50. package/src/tmdatagrid/core/autosize.ts +30 -6
  51. package/src/tmdatagrid/core/capabilities.ts +24 -6
  52. package/src/tmdatagrid/core/cellExport.ts +6 -7
  53. package/src/tmdatagrid/core/cellNavigation.ts +2 -2
  54. package/src/tmdatagrid/core/cellRange.ts +6 -6
  55. package/src/tmdatagrid/core/columnOrdering.ts +30 -1
  56. package/src/tmdatagrid/core/columnUtils.ts +14 -0
  57. package/src/tmdatagrid/core/controlledState.ts +179 -0
  58. package/src/tmdatagrid/core/draftCellContext.ts +68 -0
  59. package/src/tmdatagrid/core/editEngine.ts +1111 -121
  60. package/src/tmdatagrid/core/editorFocus.ts +8 -4
  61. package/src/tmdatagrid/core/filterOperators.ts +6 -6
  62. package/src/tmdatagrid/core/labels.ts +32 -7
  63. package/src/tmdatagrid/core/labelsSv.ts +10 -2
  64. package/src/tmdatagrid/core/matchHighlight.ts +3 -3
  65. package/src/tmdatagrid/core/persistence.ts +3 -3
  66. package/src/tmdatagrid/core/resizePreview.ts +141 -0
  67. package/src/tmdatagrid/core/rowSelection.ts +3 -3
  68. package/src/tmdatagrid/core/summary.ts +10 -2
  69. package/src/tmdatagrid/core/useSettledTableState.ts +36 -0
  70. package/src/tmdatagrid/index.ts +22 -9
  71. package/src/tmdatagrid/useTMDataGrid.tsx +492 -137
  72. package/src/tmdatagrid/components/TMDataGridEditActions.tsx +0 -162
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # TMDataGrid
2
2
 
3
- A data grid for React built on [TanStack Table v9](https://tanstack.com/table) and
4
- [Mantine](https://mantine.dev). Rows are always virtualized, columns are resizable,
5
- reorderable, sortable, filterable, hideable and pinnable, and every piece of grid
6
- chrome is a component you opt into.
3
+ A data grid for React built on [TanStack Table v9](https://tanstack.com/table)
4
+ and [Mantine](https://mantine.dev). Rows are always virtualized, columns are
5
+ resizable, reorderable, sortable, filterable, hideable and pinnable, and every
6
+ part of the grid interface is a component you render yourself.
7
7
 
8
8
  ## Installation
9
9
 
@@ -79,18 +79,16 @@ export function Employees({ data }: { data: Employee[] }) {
79
79
  ```
80
80
 
81
81
  Only the parts you render exist, and only the features you enable have state.
82
- Pagination is opt-in via `enablePagination` (implied by `manualPagination`) -
83
- by default every row renders, virtualized. A column that defines no filter
84
- shows no filter control.
82
+ Pagination is opt in through `enablePagination` (implied by `manualPagination`);
83
+ by default every row renders, virtualized. A column that defines no filter shows
84
+ no filter control.
85
85
 
86
86
  ## Documentation
87
87
 
88
- The documentation is written as markdown under [`src/docs/`](src/docs) and served by the
89
- demo site:
90
-
91
- One page per touchpoint: the prose, the demos that show it, and the reference
92
- table for everything that page owns. [`docsPages.ts`](src/docs/docsPages.ts) is
93
- the registry and the sidebar order.
88
+ The documentation is markdown under [`src/docs/`](src/docs), served by the demo
89
+ site. There is one page per topic, each holding the prose, its demos and a
90
+ reference table. [`docsPages.ts`](src/docs/docsPages.ts) is the registry and the
91
+ sidebar order.
94
92
 
95
93
  | Section | Pages |
96
94
  | -------------------- | ---------------------------------------------------------------- |
@@ -109,10 +107,10 @@ is the demo site that documents it.
109
107
 
110
108
  | Path | Contents |
111
109
  | ------------------- | ------------------------------------------------------------ |
112
- | `index.ts` | The public API - the only entry point the package exposes |
110
+ | `index.ts` | The public API, and the only entry point the package exposes |
113
111
  | `useTMDataGrid.tsx` | The hook that builds the table, and the types it is built on |
114
112
  | `core/` | Headless logic: filtering, ordering, persistence, capabilities |
115
- | `components/` | The React chrome and its co-located CSS modules |
113
+ | `components/` | The React components and their co-located CSS modules |
116
114
 
117
115
  ### Examples
118
116
 
@@ -122,14 +120,14 @@ The demo site's examples live in [`src/examples/`](src/examples):
122
120
  | ----------------- | -------------------------------------------------------------- |
123
121
  | `demoRegistry.ts` | Pairs each demo module with its own source through `import.meta.glob` |
124
122
  | `demos/` | One file per demo: one idea, no headings, no explanation |
125
- | `data/` | Shared datasets, and the column set for demos about other things |
126
- | `playground/` | The kitchen sink, every feature at once behind switches |
123
+ | `data/` | Shared datasets, and the column set used by unrelated demos |
124
+ | `playground/` | Every feature at once, behind switches |
127
125
 
128
- Adding a demo is adding a file under `demos/` and naming it from a ` ```demo `
129
- fence on the docs page that explains it. The registry pairs each module with
130
- its own source, so the code on screen cannot drift from the code running.
131
- [`demos.test.tsx`](src/examples/demos.test.tsx) mounts every registered demo,
132
- so a demo that stops working fails the suite whether or not it still compiles.
126
+ To add a demo, add a file under `demos/` and name it from a ` ```demo ` fence on
127
+ the docs page that explains it. The registry pairs each module with its own
128
+ source, so the code on screen cannot drift from the code running.
129
+ [`demos.test.tsx`](src/examples/demos.test.tsx) mounts every registered demo, so
130
+ a demo that stops working fails the suite whether or not it still compiles.
133
131
 
134
132
  ```sh
135
133
  npm install
@@ -141,8 +139,8 @@ npm run test:watch
141
139
 
142
140
  ## Testing
143
141
 
144
- For testing an application that *uses* the grid - the test ids, roles and ARIA
145
- attributes it publishes, and how to drive it from Playwright - see
142
+ For testing an application that *uses* the grid, including the test ids, roles
143
+ and ARIA attributes it publishes and how to drive it from Playwright, see
146
144
  [Testing](src/docs/testing.md). What follows is about this repo's own suite.
147
145
 
148
146
  Vitest with React Testing Library, in jsdom. Tests sit next to the code they
@@ -150,11 +148,11 @@ cover as `*.test.ts(x)` and are excluded from both the package and the
150
148
  declaration build; shared fixtures live in [`src/test/`](src/test) so they stay
151
149
  out of `src/tmdatagrid/` entirely.
152
150
 
153
- Two things worth knowing before adding to them:
151
+ Two things to know before adding to them:
154
152
 
155
- - `vitest.setup.ts` installs what jsdom does not provide - an in-memory
156
- `Storage`, `matchMedia`, `ResizeObserver`, and element sizes. The last one
157
- matters: without a measurable box, the virtualizer renders no rows at all.
153
+ - `vitest.setup.ts` installs what jsdom does not provide: an in-memory
154
+ `Storage`, `matchMedia`, `ResizeObserver`, and element sizes. Element sizes
155
+ matter, because without a measurable box the virtualizer renders no rows.
158
156
  - The Mantine provider in the harness runs with `env="test"`, which disables
159
157
  transitions. Without it a popover never finishes mounting and its panel is
160
158
  never found.
@@ -183,8 +181,8 @@ works everywhere without putting `.js` extensions in the sources.
183
181
  ## Publishing
184
182
 
185
183
  Releases are managed by [Changesets](https://github.com/changesets/changesets).
186
- Nothing publishes from an ordinary push - a release happens only when the
187
- version PR is merged.
184
+ Nothing publishes from an ordinary push. A release happens only when the version
185
+ PR is merged.
188
186
 
189
187
  Describe your change in the same PR that makes it:
190
188
 
@@ -196,9 +194,9 @@ That writes a markdown file under `.changeset/`. Commit it alongside the code.
196
194
 
197
195
  Once on `main`, [`release.yml`](.github/workflows/release.yml) opens a
198
196
  **chore: version packages** PR that collects every pending changeset, bumps
199
- `package.json`, writes `CHANGELOG.md` and syncs the skills. The PR is the
200
- release proposal: review the version it picked and the changelog it wrote, then
201
- merge it to publish to npm with provenance.
197
+ `package.json`, writes `CHANGELOG.md` and syncs the skills. Review the version it
198
+ picked and the changelog it wrote, then merge it to publish to npm with
199
+ provenance.
202
200
 
203
201
  The package build runs from `prepublishOnly` rather than as a workflow step, so
204
202
  `npm publish` cannot ship a stale `dist` whether it runs in CI or by hand.
@@ -212,7 +210,7 @@ The package build runs from `prepublishOnly` rather than as a workflow step, so
212
210
  Intent reports a skill as stale when its `library_version` trails the package
213
211
  version, so without that step every release would leave every skill stale.
214
212
  Because it runs inside the version command, the bump and the skill sync land in
215
- the same PR and are reviewed together.
213
+ the same PR.
216
214
 
217
215
  To check what a release would contain without publishing anything:
218
216