wcz-layout 10.1.10 → 10.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/dist/Approval-D1TfISUL.mjs.map +1 -1
- package/dist/{LayoutTable-CxQNMuwo.d.mts → ChatLayout-BmLySLXy.d.mts} +11 -2
- package/dist/ChatLayout-Tpuwo8-b.mjs +1622 -0
- package/dist/ChatLayout-Tpuwo8-b.mjs.map +1 -0
- package/dist/DialogsContext-D23fJjYR.mjs.map +1 -1
- package/dist/Email-rnz3H0x3.mjs.map +1 -1
- package/dist/FileMeta-CPBWI_jA.mjs.map +1 -1
- package/dist/RouterListItemButton-CF-8w-08.mjs +62 -0
- package/dist/RouterListItemButton-CF-8w-08.mjs.map +1 -0
- package/dist/{approval-ByDIMRhe.mjs → approval-HB2w5jzc.mjs} +2 -2
- package/dist/approval-HB2w5jzc.mjs.map +1 -0
- package/dist/auth.mjs +4 -4
- package/dist/auth.mjs.map +1 -1
- package/dist/components.d.mts +3 -2
- package/dist/components.mjs +522 -627
- package/dist/components.mjs.map +1 -1
- package/dist/{createApi-L3ypB1gH.mjs → createApi-CKgFi53y.mjs} +3 -4
- package/dist/createApi-CKgFi53y.mjs.map +1 -0
- package/dist/data/client.mjs +3 -4
- package/dist/data/client.mjs.map +1 -1
- package/dist/data/server.mjs +4 -4
- package/dist/data/server.mjs.map +1 -1
- package/dist/env-BwFl7nWc.mjs +48 -0
- package/dist/env-BwFl7nWc.mjs.map +1 -0
- package/dist/{file-CwumKq_P.mjs → file-X1sK4ok6.mjs} +5 -4
- package/dist/file-X1sK4ok6.mjs.map +1 -0
- package/dist/{file-B4Q_bGLN.mjs → file-tkfsnk5F.mjs} +6 -5
- package/dist/file-tkfsnk5F.mjs.map +1 -0
- package/dist/generatedChart-k7NEdi5Z.mjs +211 -0
- package/dist/generatedChart-k7NEdi5Z.mjs.map +1 -0
- package/dist/hooks.d.mts +30 -2
- package/dist/hooks.mjs +1750 -1227
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.d.mts +9 -2
- package/dist/index.mjs +1250 -1010
- package/dist/index.mjs.map +1 -1
- package/dist/middleware.mjs +2 -2
- package/dist/middleware.mjs.map +1 -1
- package/dist/models.d.mts +2 -2
- package/dist/models.mjs.map +1 -1
- package/dist/{peoplesoft-D1jPlXr9.mjs → peoplesoft-RnvfLbWH.mjs} +4 -23
- package/dist/peoplesoft-RnvfLbWH.mjs.map +1 -0
- package/dist/{providers-gKUqnVV5.mjs → providers-BfFg_3eo.mjs} +4 -20
- package/dist/providers-BfFg_3eo.mjs.map +1 -0
- package/dist/{tokens-DODxwvZ2.mjs → tokens-C4SErO-K.mjs} +10 -4
- package/dist/tokens-C4SErO-K.mjs.map +1 -0
- package/dist/{utils-obBGIuT3.mjs → utils-C2MZoH9U.mjs} +4 -31
- package/dist/utils-C2MZoH9U.mjs.map +1 -0
- package/dist/{utils-giYfiv39.d.mts → utils-CNYCSgip.d.mts} +2 -2
- package/dist/utils-DnMFybj3.mjs +27 -0
- package/dist/utils-DnMFybj3.mjs.map +1 -0
- package/dist/utils.d.mts +11 -2
- package/dist/utils.mjs +3 -5
- package/dist/vite.mjs.map +1 -1
- package/package.json +19 -21
- package/skills/ai/SKILL.md +156 -97
- package/skills/client-db/SKILL.md +104 -90
- package/skills/db-schema/SKILL.md +28 -20
- package/skills/dialogs/SKILL.md +26 -38
- package/skills/forms/SKILL.md +133 -73
- package/skills/general/SKILL.md +111 -126
- package/skills/general/references/auth.md +3 -7
- package/skills/routing/SKILL.md +60 -66
- package/skills/server-functions/SKILL.md +71 -26
- package/skills/services/SKILL.md +1 -1
- package/skills/services/docs/approval.md +4 -4
- package/skills/table/SKILL.md +113 -130
- package/dist/AggregatedCell-3CIdlmt6.mjs +0 -615
- package/dist/AggregatedCell-3CIdlmt6.mjs.map +0 -1
- package/dist/RouterListItemButton-B-cQ1XwU.mjs +0 -78
- package/dist/RouterListItemButton-B-cQ1XwU.mjs.map +0 -1
- package/dist/approval-ByDIMRhe.mjs.map +0 -1
- package/dist/createApi-L3ypB1gH.mjs.map +0 -1
- package/dist/file-B4Q_bGLN.mjs.map +0 -1
- package/dist/file-CwumKq_P.mjs.map +0 -1
- package/dist/peoplesoft-D1jPlXr9.mjs.map +0 -1
- package/dist/providers-gKUqnVV5.mjs.map +0 -1
- package/dist/tokens-DODxwvZ2.mjs.map +0 -1
- package/dist/utils-obBGIuT3.mjs.map +0 -1
- package/skills/general/references/exports.md +0 -117
|
@@ -83,7 +83,7 @@ const ApprovalFlowSchema = z.object({
|
|
|
83
83
|
batchSequence: z.number().optional(),
|
|
84
84
|
approvalSequence: z.number(),
|
|
85
85
|
stepApprovalOrder: StepApprovalOrder,
|
|
86
|
-
steps: z.array(
|
|
86
|
+
steps: z.array(z.custom<ApprovalFlowStep>()),
|
|
87
87
|
isActive: z.boolean().default(false).optional(),
|
|
88
88
|
});
|
|
89
89
|
|
|
@@ -169,10 +169,10 @@ const ApprovalSchema = z.object({
|
|
|
169
169
|
type: ApprovalRequestType.default("Single").optional(),
|
|
170
170
|
status: ApprovalStatus,
|
|
171
171
|
created: z.date(),
|
|
172
|
-
createdBy:
|
|
172
|
+
createdBy: z.custom<ApprovalEmployee>(),
|
|
173
173
|
updated: z.date().optional(),
|
|
174
|
-
updatedBy:
|
|
175
|
-
approvalFlows: z.array(
|
|
174
|
+
updatedBy: z.custom<ApprovalEmployee>().optional(),
|
|
175
|
+
approvalFlows: z.array(z.custom<ApprovalFlow>()).min(1),
|
|
176
176
|
currentApprovers: z.array(
|
|
177
177
|
ApprovalEmployeeSchema.extend({ proxies: z.array(ApprovalProxySchema) }),
|
|
178
178
|
),
|
package/skills/table/SKILL.md
CHANGED
|
@@ -1,57 +1,60 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: table
|
|
3
|
-
description: "Use when building or changing a data table
|
|
3
|
+
description: "Use when building or changing a data table or list page in app: useLayoutTable, LayoutTable, createLayoutColumnHelper, columns and headers, cell formatters, filter variants, sorting, row selection and bulk actions, per-row actions, pagination or server paging, footer aggregation, column sizing, or styling table parts."
|
|
4
4
|
metadata:
|
|
5
5
|
type: convention
|
|
6
6
|
library: wcz-layout
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
> hand. This skill covers only the wcz-layout conventions on top of it.
|
|
9
|
+
`useLayoutTable` and `createLayoutColumnHelper` (`wcz-layout/hooks`) are the `useAppTable` and
|
|
10
|
+
`createAppColumnHelper` of TanStack Table v9's `createTableHook`, with wcz-layout's features and
|
|
11
|
+
components; feature APIs: load `@tanstack/table-core#table-features`. Never render a
|
|
12
|
+
`<table>` or `useTable` yourself, and ignore upstream's own virtualization and pagination
|
|
13
|
+
setup: `LayoutTable` (`wcz-layout/components`) does both.
|
|
15
14
|
|
|
16
15
|
## Rules
|
|
17
16
|
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
`
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
header menu
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
`
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
-
|
|
46
|
-
|
|
47
|
-
`
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
17
|
+
- `const table = useLayoutTable({ data, columns })`, then `<LayoutTable table={table} />`.
|
|
18
|
+
Rows are keyed by `row.id`, so every row needs an `id`. A list page wraps it in
|
|
19
|
+
`Fullscreen` and passes `loading={isLoading}` from `useLiveQuery`.
|
|
20
|
+
- Columns: `columnHelper.columns([...])` with `columnHelper.accessor("field", …)` or
|
|
21
|
+
`columnHelper.display({ id, … })`, from a module-level
|
|
22
|
+
`const columnHelper = createLayoutColumnHelper<Entity>()`. No row models: the features are
|
|
23
|
+
installed.
|
|
24
|
+
- Cells render the bound formatters, `cell.ValueCell`, `NumberCell`, `DateCell`, `DateTimeCell`,
|
|
25
|
+
`BooleanCell`: they carry alignment, locale formats and one-line ellipsis. Raw JSX only for a
|
|
26
|
+
link or another interactive element.
|
|
27
|
+
- Selection and actions display columns: `size: 50`, `enableResizing: false`,
|
|
28
|
+
`enableCellSelection: false`; each extra visible action button adds about 40 px.
|
|
29
|
+
- `meta` keys: `label`, `align`, `variant`, `options`, `flex`. A column whose `header` is not
|
|
30
|
+
a plain string needs `meta.label` (header menu, column selector and filter picker read it).
|
|
31
|
+
- `meta.variant` picks the filter: `"text"` (default), `"number"`, `"boolean"`, `"date"`,
|
|
32
|
+
`"select"`, `"multi-select"`. Select variants build their options from the faceted unique
|
|
33
|
+
values; pass `options` only when labels differ from stored values or the list is fixed, and
|
|
34
|
+
for a database enum derive them from `.enumValues`.
|
|
35
|
+
- `size` is the starting width. `meta.flex` lets a column grow and shrink in proportion, like
|
|
36
|
+
CSS `flex`, so the table fills its container without horizontal scroll; it stops at
|
|
37
|
+
`minSize` (default 20), after which the table scrolls. A resized column keeps its width.
|
|
38
|
+
- Rows and columns virtualize and rows are measured: a cell may wrap onto several lines once
|
|
39
|
+
its content has `whiteSpace: "normal"`.
|
|
40
|
+
- Toolbar actions: create (`RouterIconButton` to the create page), edit when exactly one row is
|
|
41
|
+
selected, delete when any are: `confirm(t("DeleteConfirmation", { count }))`, the optimistic
|
|
42
|
+
delete, `when("settled")`, then `table.resetRowSelection()`; `catch` alerts. Icons are
|
|
43
|
+
`fontSize="small"` inside a `Tooltip`.
|
|
44
|
+
- `LayoutTable` props: `title`, `actions`, `showToolbar`, `loading`, `pagination`,
|
|
45
|
+
`pageSizeOptions`, `onRowClick`, `onRowDoubleClick`, `sx`, and `disableSearch`,
|
|
46
|
+
`disableColumnFilter`, `disableColumnSelector`, `disableColumnMenu`.
|
|
47
|
+
- Server-paged tables (reports, lists sorted over more rows than the browser should hold;
|
|
48
|
+
deep offset collection queries load a growing prefix, see client-db): use Query/server pages.
|
|
49
|
+
Load upstream Query integration/state guidance for request keys, totals and manual flags; pass
|
|
50
|
+
`manualPagination: true`, `rowCount` and controlled `state.pagination` /
|
|
51
|
+
`onPaginationChange` (plus the `manual*` flags for what the server sorts and filters) to
|
|
52
|
+
`useLayoutTable`, with `pagination` on `LayoutTable`.
|
|
51
53
|
|
|
52
54
|
## Example
|
|
53
55
|
|
|
54
56
|
```tsx
|
|
57
|
+
// src/routes/features/index.tsx
|
|
55
58
|
import { Fullscreen, LayoutTable, RouterIconButton, RouterLink } from "wcz-layout/components";
|
|
56
59
|
import {
|
|
57
60
|
createLayoutColumnHelper,
|
|
@@ -60,14 +63,20 @@ import {
|
|
|
60
63
|
useTranslation,
|
|
61
64
|
} from "wcz-layout/hooks";
|
|
62
65
|
|
|
63
|
-
const
|
|
66
|
+
export const Route = createFileRoute("/features/")({
|
|
67
|
+
component: RouteComponent,
|
|
68
|
+
beforeLoad: requireAuth("admin"),
|
|
69
|
+
loader: ({ context }) => context.dbClient.preloadLiveQuery(featuresQueryOptions),
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const columnHelper = createLayoutColumnHelper<Feature>();
|
|
64
73
|
|
|
65
74
|
function RouteComponent() {
|
|
66
75
|
const { t } = useTranslation();
|
|
67
76
|
const { confirm, alert } = useDialogs();
|
|
68
77
|
const navigate = useNavigate();
|
|
69
|
-
const
|
|
70
|
-
const { data, isLoading } = useLiveQuery(
|
|
78
|
+
const features = useFeatureCollection();
|
|
79
|
+
const { data, isLoading } = useLiveQuery(featuresQueryOptions);
|
|
71
80
|
|
|
72
81
|
const columns = columnHelper.columns([
|
|
73
82
|
columnHelper.display({
|
|
@@ -79,10 +88,10 @@ function RouteComponent() {
|
|
|
79
88
|
enableCellSelection: false,
|
|
80
89
|
}),
|
|
81
90
|
columnHelper.accessor("name", {
|
|
82
|
-
header: t("
|
|
91
|
+
header: t("Feature.Name"),
|
|
83
92
|
cell: ({ cell }) => (
|
|
84
93
|
<RouterLink
|
|
85
|
-
to="/
|
|
94
|
+
to="/features/$id"
|
|
86
95
|
params={{ id: cell.row.original.id }}
|
|
87
96
|
underline="hover"
|
|
88
97
|
color="inherit"
|
|
@@ -91,33 +100,7 @@ function RouteComponent() {
|
|
|
91
100
|
</RouterLink>
|
|
92
101
|
),
|
|
93
102
|
size: 260,
|
|
94
|
-
|
|
95
|
-
columnHelper.accessor("assignee", {
|
|
96
|
-
header: t("Todo.Assignee"),
|
|
97
|
-
cell: ({ cell }) => <cell.ValueCell />,
|
|
98
|
-
// No options: the filter builds them from the faceted unique values.
|
|
99
|
-
meta: { variant: "multi-select" },
|
|
100
|
-
size: 180,
|
|
101
|
-
}),
|
|
102
|
-
columnHelper.accessor("priority", {
|
|
103
|
-
header: t("Todo.Priority"),
|
|
104
|
-
cell: ({ cell }) => <cell.NumberCell />,
|
|
105
|
-
footer: ({ header }) => <header.AggregationFooter options={{ maximumFractionDigits: 1 }} />,
|
|
106
|
-
aggregationFn: "mean",
|
|
107
|
-
meta: { variant: "number", align: "right" },
|
|
108
|
-
size: 120,
|
|
109
|
-
}),
|
|
110
|
-
columnHelper.accessor("starred", {
|
|
111
|
-
header: t("Todo.Starred"),
|
|
112
|
-
cell: ({ cell }) => <cell.BooleanCell />,
|
|
113
|
-
meta: { variant: "boolean", align: "center" },
|
|
114
|
-
size: 120,
|
|
115
|
-
}),
|
|
116
|
-
columnHelper.accessor("createdAt", {
|
|
117
|
-
header: t("Todo.CreatedAt"),
|
|
118
|
-
cell: ({ cell }) => <cell.DateTimeCell />,
|
|
119
|
-
meta: { variant: "date" },
|
|
120
|
-
size: 190,
|
|
103
|
+
meta: { flex: 1 },
|
|
121
104
|
}),
|
|
122
105
|
]);
|
|
123
106
|
|
|
@@ -127,12 +110,12 @@ function RouteComponent() {
|
|
|
127
110
|
const handleOnDelete = createOptimisticAction<Array<string>>({
|
|
128
111
|
onMutate: (ids) => {
|
|
129
112
|
ids.forEach((id) => {
|
|
130
|
-
|
|
113
|
+
features.delete(id);
|
|
131
114
|
});
|
|
132
115
|
},
|
|
133
116
|
mutationFn: async (ids) => {
|
|
134
|
-
await
|
|
135
|
-
await
|
|
117
|
+
await deleteFeatures({ data: ids });
|
|
118
|
+
await features.utils.refetch({ throwOnError: true });
|
|
136
119
|
},
|
|
137
120
|
});
|
|
138
121
|
|
|
@@ -142,36 +125,30 @@ function RouteComponent() {
|
|
|
142
125
|
table={table}
|
|
143
126
|
loading={isLoading}
|
|
144
127
|
showToolbar
|
|
145
|
-
title={t("
|
|
146
|
-
onRowDoubleClick={(row) => navigate({ to: "/
|
|
128
|
+
title={t("Feature.Features")}
|
|
129
|
+
onRowDoubleClick={(row) => navigate({ to: "/features/$id", params: { id: row.id } })}
|
|
147
130
|
actions={
|
|
148
131
|
<>
|
|
149
132
|
<Tooltip title={t("Create")}>
|
|
150
|
-
<RouterIconButton to="/
|
|
133
|
+
<RouterIconButton to="/features/create">
|
|
151
134
|
<Add fontSize="small" />
|
|
152
135
|
</RouterIconButton>
|
|
153
136
|
</Tooltip>
|
|
154
|
-
|
|
155
137
|
{selectedIds.length === 1 && (
|
|
156
138
|
<Tooltip title={t("Edit")}>
|
|
157
|
-
<RouterIconButton to="/
|
|
139
|
+
<RouterIconButton to="/features/edit/$id" params={{ id: selectedIds[0] }}>
|
|
158
140
|
<Edit fontSize="small" />
|
|
159
141
|
</RouterIconButton>
|
|
160
142
|
</Tooltip>
|
|
161
143
|
)}
|
|
162
|
-
|
|
163
144
|
{selectedIds.length > 0 && (
|
|
164
145
|
<Tooltip title={t("Delete")}>
|
|
165
146
|
<IconButton
|
|
166
147
|
onClick={async () => {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
);
|
|
170
|
-
if (!confirmed) return;
|
|
171
|
-
|
|
148
|
+
if (!(await confirm(t("DeleteConfirmation", { count: selectedIds.length }))))
|
|
149
|
+
return;
|
|
172
150
|
try {
|
|
173
|
-
|
|
174
|
-
await transaction.isPersisted.promise;
|
|
151
|
+
await handleOnDelete(selectedIds).when("settled");
|
|
175
152
|
table.resetRowSelection();
|
|
176
153
|
} catch (error) {
|
|
177
154
|
if (error instanceof Error) await alert(error.message);
|
|
@@ -196,9 +173,48 @@ function RouteComponent() {
|
|
|
196
173
|
}
|
|
197
174
|
```
|
|
198
175
|
|
|
199
|
-
|
|
176
|
+
Additional columns only when the entity schema has these fields:
|
|
200
177
|
|
|
201
178
|
```tsx
|
|
179
|
+
import { Typography } from "@mui/material";
|
|
180
|
+
import { featureStatusEnum } from "~/server/db/schemas/feature";
|
|
181
|
+
|
|
182
|
+
columnHelper.accessor("quantity", {
|
|
183
|
+
header: t("Feature.Quantity"),
|
|
184
|
+
cell: ({ cell }) => <cell.NumberCell />,
|
|
185
|
+
footer: ({ header }) => <header.AggregationFooter />,
|
|
186
|
+
aggregationFn: "sum",
|
|
187
|
+
meta: { variant: "number", align: "right" },
|
|
188
|
+
});
|
|
189
|
+
columnHelper.accessor("active", {
|
|
190
|
+
header: t("Feature.Active"),
|
|
191
|
+
cell: ({ cell }) => <cell.BooleanCell />,
|
|
192
|
+
meta: { variant: "boolean", align: "center" },
|
|
193
|
+
});
|
|
194
|
+
columnHelper.accessor("dueAt", {
|
|
195
|
+
header: t("Feature.DueAt"),
|
|
196
|
+
cell: ({ cell }) => <cell.DateCell />,
|
|
197
|
+
meta: { variant: "date" },
|
|
198
|
+
});
|
|
199
|
+
columnHelper.accessor("status", {
|
|
200
|
+
header: t("Feature.Status"),
|
|
201
|
+
cell: ({ cell }) => (
|
|
202
|
+
<Typography variant="body2" noWrap>
|
|
203
|
+
{t(`Feature.StatusLabels.${cell.getValue()}`)}
|
|
204
|
+
</Typography>
|
|
205
|
+
),
|
|
206
|
+
meta: {
|
|
207
|
+
variant: "multi-select",
|
|
208
|
+
options: featureStatusEnum.enumValues.map((value) => ({
|
|
209
|
+
value,
|
|
210
|
+
label: t(`Feature.StatusLabels.${value}`),
|
|
211
|
+
})),
|
|
212
|
+
},
|
|
213
|
+
});
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
```tsx
|
|
217
|
+
// per-row actions: one inline button, the rest in the row menu
|
|
202
218
|
columnHelper.display({
|
|
203
219
|
id: "actions",
|
|
204
220
|
cell: ({ cell }) => (
|
|
@@ -207,7 +223,7 @@ columnHelper.display({
|
|
|
207
223
|
{
|
|
208
224
|
label: t("Edit"),
|
|
209
225
|
icon: <Edit fontSize="small" />,
|
|
210
|
-
onClick: (row) => navigate({ to: "/
|
|
226
|
+
onClick: (row) => navigate({ to: "/features/edit/$id", params: { id: row.id } }),
|
|
211
227
|
},
|
|
212
228
|
{
|
|
213
229
|
label: t("Delete"),
|
|
@@ -224,44 +240,11 @@ columnHelper.display({
|
|
|
224
240
|
});
|
|
225
241
|
```
|
|
226
242
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
On the header render prop: `SelectAllCell`, `ExpandAllCell`, `AggregationFooter`,
|
|
230
|
-
`HeaderMenu`, `HeaderSortLabel`, `HeaderResizeHandle`. On the cell one:
|
|
231
|
-
`SelectCell`, `ExpandCell`, `GroupCell`, `PinRowCell`, `ActionsCell` and the
|
|
232
|
-
formatter cells. `LayoutTable` already places the menu, the sort label and the
|
|
233
|
-
resize handle, so reach for those three only when building a table by hand.
|
|
234
|
-
|
|
235
|
-
### Custom cells and headers
|
|
236
|
-
|
|
237
|
-
The render prop only exposes the components registered in the library. To write your
|
|
238
|
-
own, read the context directly inside a plain component: `useCellContext<TValue>()`,
|
|
239
|
-
`useHeaderContext()` or `useTableContext()` from `wcz-layout/hooks`.
|
|
240
|
-
`layoutTableFeatures` and the `LayoutTableFeatures` type are the feature set
|
|
241
|
-
`useLayoutTable` installs — you need them only to type a hand-built table instance.
|
|
242
|
-
|
|
243
|
-
## Common Mistakes
|
|
244
|
-
|
|
245
|
-
### CRITICAL: Writing TanStack Table v8 column definitions
|
|
246
|
-
|
|
247
|
-
Wrong: `accessorKey: "name"`, `cell: (info) => info.getValue()`, `getCoreRowModel:
|
|
248
|
-
getCoreRowModel()`.
|
|
249
|
-
|
|
250
|
-
Correct: `columnHelper.accessor("name", { cell: ({ cell }) => <cell.ValueCell /> })`
|
|
251
|
-
inside `columnHelper.columns([...])`, and no row models at all.
|
|
252
|
-
|
|
253
|
-
This is v9. v8 column defs either type-error inside `columnHelper.columns()` or
|
|
254
|
-
silently no-op, and row models are gone.
|
|
255
|
-
|
|
256
|
-
### HIGH: Adding your own virtualizer or pager
|
|
257
|
-
|
|
258
|
-
Wrong: wrapping rows in `useVirtualizer` from `@tanstack/react-virtual`, or bolting on
|
|
259
|
-
a `TablePagination`.
|
|
260
|
-
|
|
261
|
-
Correct: render `<LayoutTable table={table} />` and pass `pagination` if the user wants
|
|
262
|
-
a pager.
|
|
263
|
-
|
|
264
|
-
`LayoutTable` already virtualizes rows and columns. A second virtualizer fights the
|
|
265
|
-
first over scroll position.
|
|
243
|
+
## Bound components
|
|
266
244
|
|
|
267
|
-
|
|
245
|
+
Header render prop: `SelectAllCell`, `ExpandAllCell`, `AggregationFooter`, `HeaderMenu`,
|
|
246
|
+
`HeaderSortLabel`, `HeaderResizeHandle`. Cell render prop: `SelectCell`, `ExpandCell`,
|
|
247
|
+
`GroupCell`, `PinRowCell`, `ActionsCell` and the formatters. `LayoutTable` already places the
|
|
248
|
+
menu, sort label and resize handle. A custom cell or header is a plain component reading
|
|
249
|
+
`useCellContext<TValue>()`, `useHeaderContext()` or `useTableContext()` from `wcz-layout/hooks`;
|
|
250
|
+
`layoutTableFeatures` and `LayoutTableFeatures` only type a hand-built table instance.
|