wcz-layout 9.7.0 → 10.0.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 (93) hide show
  1. package/dist/AggregatedCell-BtKC5-m6.mjs +497 -0
  2. package/dist/AggregatedCell-BtKC5-m6.mjs.map +1 -0
  3. package/dist/Approval-C-hF4jbT.mjs.map +1 -1
  4. package/dist/DialogsContext-DLqA8RJ_.mjs.map +1 -1
  5. package/dist/Email-BzQQkbe9.mjs.map +1 -1
  6. package/dist/FileMeta-DDqUju1Y.mjs.map +1 -1
  7. package/dist/LayoutTable-4DLs-NI-.d.mts +752 -0
  8. package/dist/{QueryClientParam-Cbb0MIKg.d.mts → QueryClientParam-JcH0mJWl.d.mts} +2 -2
  9. package/dist/RouterListItemButton-ULMlaQh6.mjs.map +1 -1
  10. package/dist/{User-1gKoYJvW.d.mts → User-D4__w1I1.d.mts} +4 -2
  11. package/dist/approval-DFExxyAJ.mjs +84 -0
  12. package/dist/approval-DFExxyAJ.mjs.map +1 -0
  13. package/dist/auth.d.mts +21 -11
  14. package/dist/auth.mjs +43 -26
  15. package/dist/auth.mjs.map +1 -1
  16. package/dist/components.d.mts +22 -30
  17. package/dist/components.mjs +786 -139
  18. package/dist/components.mjs.map +1 -1
  19. package/dist/createApi-CLYWCzR2.mjs +27 -0
  20. package/dist/createApi-CLYWCzR2.mjs.map +1 -0
  21. package/dist/data/client.d.mts +702 -1152
  22. package/dist/data/client.mjs +4 -3
  23. package/dist/data/client.mjs.map +1 -1
  24. package/dist/data/server.d.mts +3 -3
  25. package/dist/data/server.mjs +4 -2
  26. package/dist/data/server.mjs.map +1 -1
  27. package/dist/{file-BWcNzq55.mjs → file-CZwQfvTU.mjs} +5 -24
  28. package/dist/file-CZwQfvTU.mjs.map +1 -0
  29. package/dist/{file-DimNsRly.mjs → file-aSQto2rw.mjs} +6 -7
  30. package/dist/file-aSQto2rw.mjs.map +1 -0
  31. package/dist/hooks.d.mts +7 -46
  32. package/dist/hooks.mjs +2578 -239
  33. package/dist/hooks.mjs.map +1 -1
  34. package/dist/index.d.mts +28 -9
  35. package/dist/index.mjs +1248 -500
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/middleware.d.mts +20 -19
  38. package/dist/middleware.mjs +47 -2
  39. package/dist/middleware.mjs.map +1 -1
  40. package/dist/models.d.mts +17 -10
  41. package/dist/models.mjs.map +1 -1
  42. package/dist/{peoplesoft-CskGsqd6.d.mts → peoplesoft-BY_75WTS.d.mts} +2 -2
  43. package/dist/{peoplesoft-DTPGpN2h.mjs → peoplesoft-CQnc01Hc.mjs} +24 -81
  44. package/dist/peoplesoft-CQnc01Hc.mjs.map +1 -0
  45. package/dist/providers-Dbl95AxR.mjs +74 -0
  46. package/dist/providers-Dbl95AxR.mjs.map +1 -0
  47. package/dist/tokens-D8CVIFTb.mjs +143 -0
  48. package/dist/tokens-D8CVIFTb.mjs.map +1 -0
  49. package/dist/{utils-5x4uNxsX.d.mts → utils-Bhi0KiBx.d.mts} +18 -6
  50. package/dist/{utils-DjdexspV.mjs → utils-KaM5VMTJ.mjs} +64 -42
  51. package/dist/utils-KaM5VMTJ.mjs.map +1 -0
  52. package/dist/utils.d.mts +2 -2
  53. package/dist/utils.mjs +2 -2
  54. package/dist/vite.d.mts +1 -2
  55. package/dist/vite.mjs +3 -3
  56. package/dist/vite.mjs.map +1 -1
  57. package/package.json +23 -23
  58. package/skills/client-db/SKILL.md +104 -96
  59. package/skills/db-schema/SKILL.md +46 -33
  60. package/skills/dialogs/SKILL.md +21 -27
  61. package/skills/forms/SKILL.md +60 -39
  62. package/skills/general/SKILL.md +56 -25
  63. package/skills/general/references/exports.md +106 -0
  64. package/skills/migrations/SKILL.md +53 -2
  65. package/skills/migrations/versions/migrate-v9-to-v10.md +581 -0
  66. package/skills/routing/SKILL.md +50 -60
  67. package/skills/server-functions/SKILL.md +36 -56
  68. package/skills/services/SKILL.md +7 -4
  69. package/skills/services/docs/approval.md +2 -2
  70. package/skills/services/docs/peoplesoft.md +1 -1
  71. package/skills/start/SKILL.md +9 -5
  72. package/skills/start/steps/05-database-setup.md +52 -52
  73. package/skills/start/steps/06-entra-setup.md +1 -1
  74. package/skills/start/steps/07-vault-setup.md +5 -12
  75. package/skills/table/SKILL.md +275 -0
  76. package/skills/unslop/SKILL.md +80 -0
  77. package/dist/NotificationContext-CgwUOeW0.mjs +0 -7
  78. package/dist/NotificationContext-CgwUOeW0.mjs.map +0 -1
  79. package/dist/authMiddleware-DPly0b_T.mjs +0 -48
  80. package/dist/authMiddleware-DPly0b_T.mjs.map +0 -1
  81. package/dist/entra-CJSyeQsx.mjs +0 -109
  82. package/dist/entra-CJSyeQsx.mjs.map +0 -1
  83. package/dist/file-BWcNzq55.mjs.map +0 -1
  84. package/dist/file-DimNsRly.mjs.map +0 -1
  85. package/dist/msalServer-DLwA7_ta.mjs +0 -30
  86. package/dist/msalServer-DLwA7_ta.mjs.map +0 -1
  87. package/dist/peoplesoft-DTPGpN2h.mjs.map +0 -1
  88. package/dist/useDialogs-BUzVrTSP.mjs +0 -248
  89. package/dist/useDialogs-BUzVrTSP.mjs.map +0 -1
  90. package/dist/user-Dzv0N9fj.d.mts +0 -16
  91. package/dist/utils-DjdexspV.mjs.map +0 -1
  92. package/skills/data-grid/SKILL.md +0 -142
  93. package/skills/migrations/versions/migrate-v9-to-v10.tsx +0 -9
@@ -0,0 +1,581 @@
1
+ # Migrate wcz-layout v9 to v10
2
+
3
+ Two headline changes:
4
+
5
+ 1. Login moves to a `/login` page where the user picks a provider. AWS Cognito joins
6
+ Entra. Entra-only apps behave as before, apart from the new page.
7
+ 2. Every paid MUI X package is gone. `LayoutTable` (TanStack Table v9) replaces
8
+ `DataGridPremium`, pickers move to the free `@mui/x-date-pickers`, and there is no
9
+ licence key any more.
10
+
11
+ Work through the steps in order.
12
+
13
+ Commit the migration edits before running `vp check --fix`. On a repo not already
14
+ formatted to the current config it rewrites hundreds of unrelated files, and the
15
+ middleware arrays you need to eyeball vanish into the churn.
16
+
17
+ ## 1. Dependencies
18
+
19
+ | Action | Package | Version |
20
+ | ------- | ---------------------------------- | ----------- |
21
+ | Install | `@tanstack/react-table` | 9.x |
22
+ | Install | `@tanstack/react-virtual` | 3.x |
23
+ | Install | `@tanstack/react-hotkeys` | 0.x |
24
+ | Install | `@mui/x-date-pickers` | 9.x |
25
+ | Upgrade | `@tanstack/react-query` | **≥ 5.102** |
26
+ | Upgrade | `@tanstack/react-router-ssr-query` | latest 1.x |
27
+ | Delete | `@mui/x-data-grid-premium` | — |
28
+ | Delete | `@mui/x-date-pickers-pro` | — |
29
+
30
+ ```bash
31
+ npm install @tanstack/react-table@9 @tanstack/react-virtual@3 @tanstack/react-hotkeys@0 @mui/x-date-pickers@9
32
+ npm install @tanstack/react-query@latest @tanstack/react-router-ssr-query@latest
33
+ npm uninstall @mui/x-data-grid-premium @mui/x-date-pickers-pro
34
+ ```
35
+
36
+ **Both query upgrades are mandatory** and neither failure names a version:
37
+
38
+ - react-query below 5.102 lacks `QueryKeyWithDataTag`, which v10's `.d.mts` reference.
39
+ Every `wcz-layout/data/client` export then resolves to `unknown`, surfacing as
40
+ `TS18046: 'x' is of type 'unknown'` scattered through your own components.
41
+ - ssr-query below 1.167.2 hydrates against the pre-5.102 shape and throws
42
+ `Cannot read properties of undefined (reading 'mutations')` in the browser. No type
43
+ error, so `vp check` passes and the page silently falls back to client rendering.
44
+
45
+ If `@mui/material` is pinned to an exact version — common, to match the pinned MUI X
46
+ Pro packages — loosen it to a caret range, or the install fails `ERESOLVE` against a
47
+ newer `@mui/icons-material`.
48
+
49
+ Then: rewrite every `@mui/x-date-pickers-pro` reference to `@mui/x-date-pickers`,
50
+ including the `/// <reference types="@mui/x-date-pickers-pro/themeAugmentation" />`
51
+ line atop `src/hooks/useTheme.ts` — not an import, so grepping for one misses it.
52
+ Delete every `@mui/x-license` import from `src/router.tsx` and what it feeds —
53
+ `LicenseInfo.setLicenseKey`, plus `muiXTelemetrySettings.disableTelemetry()` where it
54
+ is used. Drop `VITE_MUI_LICENSE_KEY` from `src/env.ts` and `.env*`, and remove it
55
+ from Vault. If that empties the `client` block, delete `clientEnv` and its
56
+ import in `src/router.tsx`; delete any `.env*` file left empty.
57
+
58
+ The range pickers were Pro-only, so `DateRangePicker`, `TimeRangePicker` and
59
+ `DateTimeRangePicker` are gone from `useLayoutForm`. Replace each with two adjacent
60
+ single-value fields, validate the ordering in the form schema, and delete the
61
+ `MuiDateRangePicker` / `MuiDateTimeRangePicker` entries from `useTheme.ts`.
62
+
63
+ ## 2. Renamed auth exports
64
+
65
+ | v9 | v10 | From |
66
+ | ---------------------------------------------- | ----------------------- | ----------------------- |
67
+ | `requirePermission("key")` | `requireAuth("key")` | `wcz-layout/utils` |
68
+ | `requirePermission("all")` | `requireAuth()` | `wcz-layout/utils` |
69
+ | `authorizationMiddleware("key")` | `authMiddleware("key")` | `wcz-layout/middleware` |
70
+ | `authorizationMiddleware("all")` | `authMiddleware()` | `wcz-layout/middleware` |
71
+ | `authenticationMiddleware()` | `authMiddleware()` | `wcz-layout/middleware` |
72
+ | `authenticationMiddleware({ optional: true })` | dropped, see step 6 | |
73
+
74
+ **The "any employee" key must go.** v9 apps carried a key listing the company-wide
75
+ employee groups (`wcz-all-employees`, `wscz-all-employees`) to mean "anyone signed
76
+ in". v10 says that with no key at all. Delete the entry from `permissions.ts` —
77
+ leaving it breaks AWS, whose sessions carry no groups, so a key-checked guard rejects
78
+ every Cognito user.
79
+
80
+ **Find it by its groups, not its name.** It is usually called `all`, but not always —
81
+ one app named it `tester`. Read `permissions.ts` and pick the key whose value is the
82
+ company-wide employee groups; that is the one to translate and delete, whatever it is
83
+ called. Keys naming a real group (`admin` and friends) stay. Replace any
84
+ `hasPermission(user, <that key>)` with `!!user`.
85
+
86
+ New: `LoginForm` (`wcz-layout/components`), `loginProvidersQueryOptions`
87
+ (`wcz-layout`), `Permissions` and `Scopes` types (`wcz-layout/models`), and
88
+ `userMiddleware` (`wcz-layout/middleware`) — puts the caller in `context.user`,
89
+ `null` when anonymous, requires nobody.
90
+
91
+ Unchanged: `hasPermission`, `getUser`, `getAccessToken`, `getAppToken`,
92
+ `handleLogin`, `handleCallback`, `handleLogout`, `csrfMiddleware`,
93
+ `validationMiddleware`. `User` gains an additive `provider` field.
94
+
95
+ Removed from `wcz-layout/components`: `RouterGridActionsCellItem` and
96
+ `EditableColumnHeader` (grid wrappers — row actions now live in a `display` column),
97
+ and `TypographyWithIcon` (inline a `Stack direction="row"` with the icon and a
98
+ `Typography`).
99
+
100
+ ## 3. src/lib/auth/permissions.ts
101
+
102
+ ```ts
103
+ import type { Permissions } from "wcz-layout/models";
104
+
105
+ export const permissions = {
106
+ admin: ["wcz-developers"],
107
+ } as const satisfies Permissions;
108
+ ```
109
+
110
+ ## 4. src/lib/auth/scopes.ts
111
+
112
+ Arrays become strings, one scope per key. The object form is only for an API an AWS
113
+ session must reach.
114
+
115
+ ```ts
116
+ import type { Scopes } from "wcz-layout/models";
117
+
118
+ export const scopes = {
119
+ graph: "User.Read",
120
+ api: "api://wistron.com/project-name/access_as_user",
121
+ // reachable by both providers:
122
+ // file: { entra: "api://…/access_as_user", aws: "https://…/access_as_user" },
123
+ } as const satisfies Scopes;
124
+ ```
125
+
126
+ Keep `as const satisfies` on both files — `as const` is what keeps
127
+ `requireAuth("admin")` and `getAccessToken("file")` type-checked.
128
+
129
+ ## 5. src/routes/login.tsx, new and required
130
+
131
+ `requireAuth` redirects unauthenticated users to `/login`; without this file they 404.
132
+
133
+ ```tsx
134
+ import { createFileRoute } from "@tanstack/react-router";
135
+ import { loginProvidersQueryOptions } from "wcz-layout";
136
+ import { LoginForm } from "wcz-layout/components";
137
+
138
+ export const Route = createFileRoute("/login")({
139
+ loader: ({ context }) => context.queryClient.query(loginProvidersQueryOptions),
140
+ component: LoginForm,
141
+ });
142
+ ```
143
+
144
+ The loader makes the buttons server-render. `LoginForm` takes no props; it reads
145
+ `?returnTo` itself and shows one button per configured provider.
146
+
147
+ `tsc` will report `'"/login"' is not assignable to 'keyof FileRoutesByPath'` until the
148
+ route tree regenerates — run `vp check` before chasing it.
149
+
150
+ ## 6. src/server/middleware/databaseMiddleware.ts
151
+
152
+ Only if the app has one. The change is one line — swap its auth dependency:
153
+
154
+ ```diff
155
+ - .middleware([authenticationMiddleware({ optional: true })]) // or authenticationMiddleware()
156
+ + .middleware([userMiddleware])
157
+ ```
158
+
159
+ Keep the shape the app already has. If it is a plain exported middleware object, it
160
+ stays one. If it is a factory that existed only to carry an `optional` flag, the
161
+ generic factory, the pre-built instances and the overloads all go — there is one
162
+ signature now.
163
+
164
+ ### Did it authenticate on its own?
165
+
166
+ Check what the v9 middleware composed before touching any call site:
167
+
168
+ - `authenticationMiddleware({ optional: true })` — required nobody. Nothing opens up.
169
+ - `authenticationMiddleware()` — **required a signed-in user**, and every call site
170
+ that stood alone inherited that. `userMiddleware` requires nobody, so each of those
171
+ now serves anonymous callers unless you add `authMiddleware()` yourself.
172
+
173
+ | v9 call site | v9 meaning | v10 |
174
+ | ---------------------------------------------------------- | ------------------- | -------------------------------------------------- |
175
+ | `databaseMiddleware({ optional: true })` | anonymous allowed | `[databaseMiddleware()]` |
176
+ | `databaseMiddleware()` over `authenticationMiddleware()` | user required | `[databaseMiddleware(), authMiddleware()]` |
177
+ | `[authorizationMiddleware("admin"), databaseMiddleware()]` | permission required | `[databaseMiddleware(), authMiddleware("admin")]` |
178
+
179
+ Grep the middleware name, not `createServerFn` — route `server.middleware` arrays
180
+ count too, and job, cron and webhook endpoints are where a lone `databaseMiddleware`
181
+ hides. Those are the worst ones to leave anonymous.
182
+
183
+ ### Order: `databaseMiddleware` first
184
+
185
+ Middleware context merges left to right and the later entry wins, so the order
186
+ decides whether `context.user` is nullable in the handler. `databaseMiddleware`
187
+ declares `userMiddleware` and contributes `user: User | null`; `authMiddleware`
188
+ contributes `user: User`. Put the database one first and the narrowed type survives:
189
+
190
+ ```ts
191
+ .middleware([databaseMiddleware(), authMiddleware("admin")])
192
+ .handler(({ context }) => context.user.name) // User, no narrowing needed
193
+ ```
194
+
195
+ v9 arrays are usually written the other way round, so reorder them as you go. Any
196
+ `validationMiddleware` in a REST route still goes **after** `authMiddleware`, or an
197
+ unauthenticated caller gets their body parsed and your validation errors back:
198
+ `[databaseMiddleware(), authMiddleware("admin"), validationMiddleware(Schema)]`.
199
+
200
+ ## 7. src/start.ts
201
+
202
+ v10 apps need no `src/start.ts` just for CSRF. When the file is absent, TanStack Start
203
+ installs its own default request middleware,
204
+ `createCsrfMiddleware({ filter: (ctx) => ctx.handlerType === "serverFn" })` — exactly
205
+ what `csrfMiddleware` from `wcz-layout/middleware` is.
206
+
207
+ Open the file and read what `createStart` returns:
208
+
209
+ - **Only `requestMiddleware: [csrfMiddleware]`**, with `csrfMiddleware` imported from
210
+ `wcz-layout/middleware` and no other option → delete `src/start.ts` completely.
211
+ - **Anything else** — a second entry in `requestMiddleware`, a `functionMiddleware`
212
+ array, any other option, or a `createCsrfMiddleware` of the app's own with a
213
+ different filter → keep the file as it is.
214
+
215
+ After deleting, `src/routeTree.gen.ts` still imports `startInstance` from `./start.ts`
216
+ until the route tree regenerates — run `vp check` before chasing it. Nothing else
217
+ should import `startInstance`; grep to confirm.
218
+
219
+ ## 8. Locales
220
+
221
+ The app owns every string — the vite plugin builds i18next resources from the app's
222
+ `src/lib/locales/*.json`, so a key the library renders but the app does not define
223
+ comes out raw. The package does not ship its locale files: the complete v10 `Layout`
224
+ block for `en` and `cs` is at the end of this guide, under
225
+ [Appendix: v10 Layout locales](#appendix-v10-layout-locales).
226
+
227
+ v10 adds the whole `Layout.Table` namespace plus `Layout.ContinueWith` and
228
+ `Layout.TestEnvironment`. Take only the `Layout` key; nothing else in the app's
229
+ locale files is the library's.
230
+
231
+ **Merge it into the app's `Layout`, do not replace the block.** Apps add their own
232
+ keys inside that namespace (`Layout.Loading`, `Layout.NotProvided` in one app), and a
233
+ wholesale replace silently deletes them — which *does* break the build, because
234
+ `src/types/i18next.d.ts` types `t()` from `en.json` and the app's own
235
+ `t("Layout.Loading")` calls stop compiling. So: overlay the library's keys on top of
236
+ the app's, then look at what is left over. A leftover key the app's own code
237
+ references is the app's — keep it. One nothing references is a v9 library key v10
238
+ dropped — remove it, or it lingers forever because it passes every check.
239
+
240
+ **Use the block from the guide of the major you are migrating to.** Do this step
241
+ again in every major's pass: `Layout` keys change between majors, and each guide's
242
+ appendix holds its own major's set. A v9 → v11 upgrade runs the v10 pass with this
243
+ appendix and the v11 pass with the v11 guide's. Carrying v10's block into a v11 app
244
+ leaves the wrong key set.
245
+
246
+ **A library key the app never calls can go missing without failing the build.**
247
+ `t()` is typed from the app's `en.json`, so it catches the app's own calls and nothing
248
+ else — the library's are compiled already. A `Layout.Table.*` key the app never
249
+ references therefore survives `vp check` and surfaces only as a raw key string on
250
+ screen. Verify deliberately: compare the app's `Layout` key set against the appendix,
251
+ and look at the login card and the table toolbar, where a miss shows first.
252
+
253
+ **Every language the app ships needs the new keys, not just the two.** The appendix
254
+ covers `en` and `cs`; an app may have any number of files in `src/lib/locales/`. For
255
+ every other file (`de.json`, `pl.json`, `zh.json`, …), take the **English** block and
256
+ translate it into that file's language yourself, as part of this step — do not ask,
257
+ do not leave English values in place, do not skip the file. Nobody else will, and the
258
+ gap is invisible until someone switches language.
259
+
260
+ - Merge the same way as above: keys the app already translated keep their existing
261
+ values; translate only the keys the file is missing.
262
+ - Translate values only. Keys, `{{provider}}` / `{{name}}` / `{{count}}`
263
+ interpolations and the `<env>` tag stay byte-for-byte.
264
+ - Emit the plural suffixes the target language needs, not English's. English has
265
+ `_one` / `_other`, Czech adds `_few`, Polish needs `_one` / `_few` / `_many` /
266
+ `_other`, and Chinese or Japanese only `_other`. When unsure, check
267
+ `new Intl.PluralRules("<lang>").resolvedOptions().pluralCategories`; a category
268
+ that only applies to fractions (Czech `many`) can be left out, `count` is whole.
269
+ - Match the tone of the file's existing strings (formal vs. informal address).
270
+
271
+ `Layout.TestEnvironment` holds an `<env>` tag the mascot renders through `Trans` —
272
+ keep the tag in every language, it colours the word.
273
+
274
+ ## 9. Replace the grid
275
+
276
+ **Only where `DataGridPremium` is used.** A table already built on TanStack Table
277
+ stays exactly as written — do not convert it to `LayoutTable`. This step exists
278
+ because the paid grid is gone, not because `LayoutTable` is the house table for
279
+ everything. Grep for `DataGridPremium`; anything else is out of scope.
280
+
281
+ Read the `table` skill before writing any columns — it documents the API. This is
282
+ only the mapping.
283
+
284
+ Delete `src/components/DataGridToolbar.tsx`; `LayoutTable` renders the toolbar,
285
+ quick filter, columns panel and filter panel itself. In `useTheme.ts`, drop
286
+ `import { csCZ, enUS } from "@mui/x-data-grid/locales"` and its two entries.
287
+
288
+ | DataGridPremium | LayoutTable |
289
+ | --------------------------------------------------- | ------------------------------------------------------------- |
290
+ | `Array<GridColDef<Row>>` | `columnHelper.columns([...])` from `createLayoutColumnHelper` |
291
+ | `field` / `headerName` | the accessor key / `header` |
292
+ | `width`, `flex`, `minWidth` | `size` |
293
+ | `renderCell` | `cell: ({ cell }) => <cell.ValueCell />` |
294
+ | `valueGetter: (_v, row) => row.x.y` | `columnHelper.accessor((row) => row.x.y, { id: "..." })` |
295
+ | `align` / `headerAlign` | `meta: { align }` |
296
+ | `initialState.pinnedColumns.left` / `.right` | `initialState.columnPinning.start` / `.end` |
297
+ | `initialState.sorting.sortModel` `{field, sort}` | `initialState.sorting` `[{ id, desc }]` |
298
+ | `valueFormatter` on a date column | `cell.DateCell` or `cell.DateTimeCell` |
299
+ | `valueFormatter` with an `Intl.NumberFormat` | `cell.NumberCell options={...}`, same options object |
300
+ | `type: "singleSelect"` with `valueOptions` | `meta: { variant: "select", options }` |
301
+ | `type: "number"` / `"date"` / `"boolean"` | `meta: { variant: "number" \| "date" \| "boolean" }` |
302
+ | `rows` and `columns` props | `useLayoutTable({ data, columns })`, then `table={table}` |
303
+ | `showToolbar` with `slots.toolbar` | `showToolbar` with `title` and `actions` on `LayoutTable` |
304
+ | `ignoreDiacritics` | always on |
305
+ | `rowSelectionModel` state | `table.getSelectedRowIds()`, `table.resetRowSelection()` |
306
+ | `cellSelection` | always on, `Mod+C` copies the range as TSV |
307
+ | `GridActionsCellItem` in a `type: "actions"` column | a `display` column rendering `cell.ActionsCell` |
308
+
309
+ **Every row needs an `id`.** `getRowId` is not an option — the library hardcodes
310
+ `row.id`. A table over a view or a natural-key table without an `id` column must add
311
+ one where the rows are built (`id: row.cpn`), and the row type gains `id: string`.
312
+
313
+ **Dropped with no replacement**, so decide per case whether to rebuild or drop:
314
+ `getRowClassName` and `cellClassName` (style inside the cell instead — a `sx` on
315
+ `cell.NumberCell` colours the text, nothing reaches the row), `rowHeight`, the
316
+ Excel export button, and `localeText` overrides such as `footerTotalRows`. Any `sx`
317
+ block targeting `.MuiDataGrid-*` classes is dead: delete it rather than translating
318
+ it, LayoutTable's DOM is unrelated.
319
+
320
+ **State persistence changes shape.** `apiRef.exportState()` / `restoreState()` and the
321
+ per-change callbacks (`onSortModelChange`, `onPinnedColumnsChange`, …) are gone.
322
+ Restore by passing `initialState` read from storage before first render, and persist
323
+ with one effect on `table.state`. There is no `onStateChange` option.
324
+
325
+ **Shared generic column factories do not port.** A v9 helper like
326
+ `actionColumn<T>(): GridColDef<T>` reused across pages cannot be rewritten as
327
+ `(helper: ColumnHelper<T>) => ...` — `createLayoutColumnHelper` is invariant in its row
328
+ type, so a concrete helper will not satisfy a generic parameter. Share the *contents*
329
+ instead: a function returning `Array<RowAction<T>>` (that type is generic-friendly) or
330
+ a plain predicate, and let each page write its own five-line `display` column.
331
+
332
+ **Inline editing has no equivalent.** No `editMode`, no `processRowUpdate`, no
333
+ editable columns, and `EditableColumnHeader` is gone. A page built on
334
+ `editMode="row"` is a redesign, not a column mapping: move create and edit into a
335
+ dialog with a `useLayoutForm` and leave the table read-only. Usually the largest item
336
+ in the whole migration. It also retires `rowModesModel`, the `isNew` row flag and any
337
+ "turn the Zod error into a string for the grid" helper — delete them, the form renders
338
+ field errors itself.
339
+
340
+ **Bulk actions need a selection column.** A v9 page driving actions off
341
+ `Object.keys(cellSelectionModel)` has nothing to map onto: cell selection is always on
342
+ in v10 but exists for `Mod+C`. `table.getSelectedRowIds()` reads *row* selection,
343
+ which renders only if the columns start with a `select` display column
344
+ (`header.SelectAllCell` / `cell.SelectCell`, `size: 50`, `enableResizing: false`,
345
+ `enableCellSelection: false`). Ids come back as plain strings, so the `id.toString()`
346
+ that `GridRowId` forced can go.
347
+
348
+ Two behaviours that catch people out. `meta.variant: "select"` and `"multi-select"`
349
+ read options from the column's faceted unique values, so pass `meta.options` only when
350
+ the label differs from the stored value — a translated database enum, derived from
351
+ `enumValues`. And grouping shows a value only for the grouping column and columns that
352
+ resolve an aggregation function (a number or `Date`, unless the column sets
353
+ `aggregationFn`); others stay blank in a group row.
354
+
355
+ ## 10. useNotification
356
+
357
+ `useNotification` is gone, along with its snackbar and the `snackbarOrigin` layout
358
+ option. Replace every call with something the page renders itself — a success
359
+ animation, a non-dismissing alert dialog for errors. Match whatever the app already
360
+ does for feedback rather than introducing a new pattern.
361
+
362
+ Two things to check:
363
+
364
+ - A `notify(..., { severity: "error" })` sitting next to an `alert(error.message)`
365
+ from `useDialogs` is redundant. Delete the `notify`, keep the `alert`.
366
+ - A success `notify` that fires **after** a `navigate` cannot become a component on
367
+ the page it was called from — that page has already unmounted. Invert it: render
368
+ the feedback, and navigate when it finishes.
369
+
370
+ ## 11. AWS Cognito, optional
371
+
372
+ Skip for Entra-only apps. To offer AWS, add to the `server` block of `src/env.ts`:
373
+
374
+ ```ts
375
+ AWS_ISSUER: z.url().optional(), // https://cognito-idp.<region>.amazonaws.com/<poolId>
376
+ AWS_DOMAIN: z.url().optional(), // https://<prefix>.auth.<region>.amazoncognito.com
377
+ AWS_CLIENT_ID: z.string().min(1).optional(),
378
+ AWS_CLIENT_SECRET: z.string().min(1).optional(),
379
+ ```
380
+
381
+ Set all four in `.env.local`; the second button appears only when all are present.
382
+ The Cognito app client must be confidential, use the authorization-code grant, and
383
+ list `<origin>/auth/callback` as callback and `<origin>/` as sign-out URL.
384
+
385
+ An AWS session requests OIDC scopes only, so it cannot mint a delegated API token.
386
+ Cognito cannot widen scopes after login, so adding a downstream API means requesting
387
+ every `aws` scope in `scopes.ts` at login, and an unregistered one fails the whole
388
+ sign-in — register them all on the app client first. Downstream APIs must also accept
389
+ the Cognito JWKS and authorize on the token's `scope` claim, since Cognito access
390
+ tokens carry no `aud`.
391
+
392
+ ## Appendix: v10 Layout locales
393
+
394
+ The complete `Layout` block wcz-layout v10 renders, for step 8. Merge it into the
395
+ app's `src/lib/locales/en.json` and `cs.json` as that step describes — do not paste
396
+ it over the app's block. For any other language, translate the English block.
397
+
398
+ ### en.json
399
+
400
+ ```json
401
+ {
402
+ "Layout": {
403
+ "LogIn": "Log In",
404
+ "ContinueWith": "Continue with {{provider}}",
405
+ "Logout": "Logout",
406
+ "Language": "Language",
407
+ "Appearance": "Appearance",
408
+ "Light": "Light",
409
+ "Dark": "Dark",
410
+ "System": "System",
411
+ "ThisPageCouldNotBeFound": "This page could not be found.",
412
+ "Settings": "Settings",
413
+ "Unauthorized": "Unauthorized",
414
+ "TestEnvironment": "You’re in the <env>TEST</env> environment",
415
+ "Dialog": {
416
+ "Confirm": "Confirm",
417
+ "Cancel": "Cancel",
418
+ "Alert": "Alert"
419
+ },
420
+ "File": {
421
+ "AreYouSureYouWantToDelete": "Are you sure you want to delete {{name}}?",
422
+ "DragSomeFilesHereOrClickToSelectThem": "Drag some files here or click to select them",
423
+ "Delete": "Delete",
424
+ "Download": "Download"
425
+ },
426
+ "Table": {
427
+ "Search": "Search",
428
+ "ClearSearch": "Clear search",
429
+ "ColumnMenu": "Column menu",
430
+ "Filters": "Filters",
431
+ "AddFilter": "Add filter",
432
+ "RemoveFilter": "Remove filter",
433
+ "ClearFilters": "Clear filters",
434
+ "And": "and",
435
+ "Or": "or",
436
+ "Field": "Field",
437
+ "Operator": "Operator",
438
+ "Value": "Value",
439
+ "NoValueRequired": "No value required",
440
+ "From": "From",
441
+ "To": "To",
442
+ "DaysFromToday": "Days from today",
443
+ "NoRows": "No rows",
444
+ "SortAscending": "Sort ascending",
445
+ "SortDescending": "Sort descending",
446
+ "ClearSort": "Clear sort",
447
+ "PinStart": "Pin to start",
448
+ "PinEnd": "Pin to end",
449
+ "Unpin": "Unpin",
450
+ "GroupBy": "Group by this column",
451
+ "Ungroup": "Stop grouping",
452
+ "RowActions": "Row actions",
453
+ "SelectedCount_one": "{{count}} selected",
454
+ "SelectedCount_other": "{{count}} selected",
455
+ "MoveLeft": "Move left",
456
+ "MoveRight": "Move right",
457
+ "All": "All",
458
+ "Columns": "Columns",
459
+ "ShowHideAll": "Show/Hide all",
460
+ "HideColumn": "Hide column",
461
+ "Operators": {
462
+ "includesString": "contains",
463
+ "notIncludesString": "does not contain",
464
+ "equalsString": "is",
465
+ "notEqualsString": "is not",
466
+ "startsWith": "starts with",
467
+ "endsWith": "ends with",
468
+ "isEmpty": "is empty",
469
+ "isNotEmpty": "is not empty",
470
+ "equals": "is",
471
+ "notEquals": "is not",
472
+ "greaterThan": "is greater than",
473
+ "greaterThanOrEqualTo": "is greater than or equal to",
474
+ "lessThan": "is less than",
475
+ "lessThanOrEqualTo": "is less than or equal to",
476
+ "inRange": "is between",
477
+ "isRelativeToToday": "is relative to today",
478
+ "Date": {
479
+ "lessThan": "is before",
480
+ "lessThanOrEqualTo": "is on or before",
481
+ "greaterThan": "is after",
482
+ "greaterThanOrEqualTo": "is on or after"
483
+ }
484
+ }
485
+ }
486
+ }
487
+ }
488
+ ```
489
+
490
+ ### cs.json
491
+
492
+ ```json
493
+ {
494
+ "Layout": {
495
+ "LogIn": "Přihlásit se",
496
+ "ContinueWith": "Pokračovat přes {{provider}}",
497
+ "Logout": "Odhlásit se",
498
+ "Language": "Jazyk",
499
+ "Appearance": "Vzhled",
500
+ "Light": "Světlý",
501
+ "Dark": "Tmavý",
502
+ "System": "Systém",
503
+ "ThisPageCouldNotBeFound": "Tato stránka nebyla nalezena.",
504
+ "Settings": "Nastavení",
505
+ "Unauthorized": "Neoprávněný",
506
+ "TestEnvironment": "Jste v <env>TESTOVACÍM</env> prostředí",
507
+ "Dialog": {
508
+ "Confirm": "Potvrdit",
509
+ "Cancel": "Zrušit",
510
+ "Alert": "Upozornění"
511
+ },
512
+ "File": {
513
+ "AreYouSureYouWantToDelete": "Opravdu chcete smazat {{name}}?",
514
+ "DragSomeFilesHereOrClickToSelectThem": "Přetáhněte sem některé soubory nebo je vyberte kliknutím",
515
+ "Delete": "Smazat",
516
+ "Download": "Stáhnout"
517
+ },
518
+ "Table": {
519
+ "Search": "Hledat",
520
+ "ClearSearch": "Zrušit hledání",
521
+ "ColumnMenu": "Nabídka sloupce",
522
+ "Filters": "Filtry",
523
+ "AddFilter": "Přidat filtr",
524
+ "RemoveFilter": "Odebrat filtr",
525
+ "ClearFilters": "Zrušit filtry",
526
+ "And": "a",
527
+ "Or": "nebo",
528
+ "Field": "Pole",
529
+ "Operator": "Operátor",
530
+ "Value": "Hodnota",
531
+ "NoValueRequired": "Hodnota není potřeba",
532
+ "From": "Od",
533
+ "To": "Do",
534
+ "DaysFromToday": "Dnů od dneška",
535
+ "NoRows": "Žádné řádky",
536
+ "SortAscending": "Seřadit vzestupně",
537
+ "SortDescending": "Seřadit sestupně",
538
+ "ClearSort": "Zrušit řazení",
539
+ "PinStart": "Připnout na začátek",
540
+ "PinEnd": "Připnout na konec",
541
+ "Unpin": "Odepnout",
542
+ "GroupBy": "Seskupit podle sloupce",
543
+ "Ungroup": "Zrušit seskupení",
544
+ "RowActions": "Akce řádku",
545
+ "SelectedCount_one": "{{count}} vybraný",
546
+ "SelectedCount_few": "{{count}} vybrané",
547
+ "SelectedCount_other": "{{count}} vybraných",
548
+ "MoveLeft": "Posunout doleva",
549
+ "MoveRight": "Posunout doprava",
550
+ "All": "Vše",
551
+ "Columns": "Sloupce",
552
+ "ShowHideAll": "Zobrazit/skrýt vše",
553
+ "HideColumn": "Skrýt sloupec",
554
+ "Operators": {
555
+ "includesString": "obsahuje",
556
+ "notIncludesString": "neobsahuje",
557
+ "equalsString": "je",
558
+ "notEqualsString": "není",
559
+ "startsWith": "začíná na",
560
+ "endsWith": "končí na",
561
+ "isEmpty": "je prázdné",
562
+ "isNotEmpty": "není prázdné",
563
+ "equals": "je",
564
+ "notEquals": "není",
565
+ "greaterThan": "je větší než",
566
+ "greaterThanOrEqualTo": "je větší nebo rovno",
567
+ "lessThan": "je menší než",
568
+ "lessThanOrEqualTo": "je menší nebo rovno",
569
+ "inRange": "je mezi",
570
+ "isRelativeToToday": "je relativní ke dnešku",
571
+ "Date": {
572
+ "lessThan": "je před",
573
+ "lessThanOrEqualTo": "je nejpozději",
574
+ "greaterThan": "je po",
575
+ "greaterThanOrEqualTo": "je nejdříve"
576
+ }
577
+ }
578
+ }
579
+ }
580
+ }
581
+ ```