wcz-layout 10.0.0 → 10.1.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 (40) hide show
  1. package/dist/{AggregatedCell-BtKC5-m6.mjs → AggregatedCell-C7nAQyMO.mjs} +15 -2
  2. package/dist/AggregatedCell-C7nAQyMO.mjs.map +1 -0
  3. package/dist/{LayoutTable-4DLs-NI-.d.mts → LayoutTable-BkrjgpW_.d.mts} +10 -4
  4. package/dist/{approval-DFExxyAJ.mjs → approval-BYryxFOW.mjs} +2 -2
  5. package/dist/{approval-DFExxyAJ.mjs.map → approval-BYryxFOW.mjs.map} +1 -1
  6. package/dist/auth.mjs +4 -4
  7. package/dist/components.d.mts +1 -1
  8. package/dist/components.mjs +47 -21
  9. package/dist/components.mjs.map +1 -1
  10. package/dist/{createApi-CLYWCzR2.mjs → createApi-DGJJ4I_R.mjs} +3 -3
  11. package/dist/{createApi-CLYWCzR2.mjs.map → createApi-DGJJ4I_R.mjs.map} +1 -1
  12. package/dist/data/client.d.mts +0 -36
  13. package/dist/data/client.mjs +4 -4
  14. package/dist/data/client.mjs.map +1 -1
  15. package/dist/data/server.mjs +4 -4
  16. package/dist/{file-aSQto2rw.mjs → file-C14fhUeg.mjs} +4 -4
  17. package/dist/{file-aSQto2rw.mjs.map → file-C14fhUeg.mjs.map} +1 -1
  18. package/dist/{file-CZwQfvTU.mjs → file-C5BOj1q8.mjs} +4 -4
  19. package/dist/{file-CZwQfvTU.mjs.map → file-C5BOj1q8.mjs.map} +1 -1
  20. package/dist/hooks.d.mts +1 -1
  21. package/dist/hooks.mjs +456 -447
  22. package/dist/hooks.mjs.map +1 -1
  23. package/dist/index.mjs +2 -2
  24. package/dist/middleware.mjs +2 -2
  25. package/dist/{peoplesoft-CQnc01Hc.mjs → peoplesoft-BkJMCcHb.mjs} +3 -3
  26. package/dist/{peoplesoft-CQnc01Hc.mjs.map → peoplesoft-BkJMCcHb.mjs.map} +1 -1
  27. package/dist/{providers-Dbl95AxR.mjs → providers-DrairEO2.mjs} +2 -2
  28. package/dist/{providers-Dbl95AxR.mjs.map → providers-DrairEO2.mjs.map} +1 -1
  29. package/dist/{tokens-D8CVIFTb.mjs → tokens-BLRreL1j.mjs} +3 -3
  30. package/dist/{tokens-D8CVIFTb.mjs.map → tokens-BLRreL1j.mjs.map} +1 -1
  31. package/dist/{utils-KaM5VMTJ.mjs → utils-BUpDoqme.mjs} +13 -13
  32. package/dist/utils-BUpDoqme.mjs.map +1 -0
  33. package/dist/utils.mjs +1 -1
  34. package/package.json +130 -128
  35. package/skills/general/SKILL.md +122 -125
  36. package/skills/migrations/versions/migrate-v9-to-v10.md +3 -2
  37. package/skills/services/docs/peoplesoft.md +114 -110
  38. package/skills/table/SKILL.md +18 -30
  39. package/dist/AggregatedCell-BtKC5-m6.mjs.map +0 -1
  40. package/dist/utils-KaM5VMTJ.mjs.map +0 -1
@@ -1,125 +1,122 @@
1
- ---
2
- name: general
3
- description: "Use ALWAYS, before any other skill here, for every code change in this project. Defines the approved stack (TanStack, Vite+, MUI), TypeScript and naming conventions, date formatting, light/dark theming, testing and the validation command, and the src/ and tests/ folder layout that decides where each new file goes."
4
- metadata:
5
- type: convention
6
- library: wcz-layout
7
- ---
8
-
9
- > This is the default skill. Reference it in combination with more specific skills (e.g., `forms`, `table`, `dialogs`) for targeted tasks. For the full catalogue of every `wcz-layout` import subpath and what it exports, read [references/exports.md](references/exports.md).
10
-
11
- ## Preferred Technology Stack
12
-
13
- Favor the established platform before introducing custom code or a new dependency:
14
-
15
- - **TanStack ecosystem:** Reach for the TanStack library that owns the problem instead of hand-rolling it — Start for the full-stack app and server functions, Router for routing and route-level data loading, DB for client-side collections and live queries, AI for LLM-backed chat and streaming, Form for form state and validation, Hotkeys for keyboard shortcuts, Virtual for long lists and grids, Pacer for debouncing, throttling, rate limiting and queueing.
16
- - **Vite+:** Use Vite+ for the development server, formatting, linting and testing.
17
- - **Material UI:** Use Material UI for interface components and icons. When an advanced capability is needed, consider MUI X Charts for data visualization, Tree View for hierarchical data, Scheduler for calendars and timelines, and Chat for AI-powered conversations.
18
-
19
- Before implementing an external library feature, consult the current documentation through Context7 MCP. Do not add a new dependency when one of these platform libraries already covers the requirement.
20
-
21
- When the requirement is not covered above and a well-maintained, popular library solves it, use that library instead of writing your own implementation.
22
-
23
- ## Coding Conventions
24
-
25
- - Write strict ES2023 TypeScript. Preserve local inference, type public boundaries and never use explicit `any`.
26
- - Stick to double quotes, semicolons, and the `~/` alias for `src/` imports.
27
- - Avoid `useMemo` / `useCallback`; the React Compiler handles memoization.
28
- - Keep code self-documenting; only add comments to clarify non-obvious intent.
29
- - Run the narrow relevant test, then `vp check --fix`. It formats, lints and type-checks.
30
-
31
- ## User Interface
32
-
33
- - Translate every user-facing string via `useTranslation` (or `t` outside components).
34
- - Format all client-side dates with `"L LT"` or `"L"`.
35
- - Build skeletons for loading states.
36
- - When building UI, always design for both light and dark mode; this app uses
37
- `colorSchemeSelector: "data-mui-color-scheme"`, so prefer `theme.applyStyles("dark", ...)`
38
- for mode-specific styling.
39
-
40
- ## Testing
41
-
42
- - Tests run on `vp test` (bundled in vite-plus).
43
-
44
- ## File Organization
45
-
46
- Use this ownership model for new application code. Keep feature-specific code close to its route; promote it to a root directory only when it is shared across multiple features. One database table = one file per layer: every `<table>` slot below is the same singular camelCase table name, never grouped with its parent or child tables.
47
-
48
- ```txt
49
- src/ # client-first architecture
50
- ├── components/ # shared components across multiple routes
51
- ├── db/ # TanStack DB
52
- │ ├── collections/ # collection descriptors
53
- │ │ └── <table>.ts
54
- │ ├── queries/ # live query option objects
55
- │ │ └── <table>.ts
56
- │ └── persistence.ts # browser SQLite persistence
57
- ├── env.ts # clientEnv + serverEnv via createEnv
58
- ├── hooks/ # shared hooks across multiple routes
59
- │ └── useTheme.ts # MUI theme + color schemes
60
- ├── lib/ # isomorphic/shared logic usable by client and server
61
- │ ├── auth/
62
- │ │ ├── permissions.ts # as const satisfies Permissions
63
- │ │ └── scopes.ts # as const satisfies Scopes
64
- │ ├── locales/
65
- │ │ ├── cs.json
66
- │ │ └── en.json
67
- │ └── schemas/ # shared Zod schemas
68
- │ └── <table>.ts
69
- ├── router.tsx # QueryClient, DbClient, router options
70
- ├── routes/ # TanStack Router file-based routing
71
- │ ├── __root.tsx
72
- │ ├── index.tsx
73
- │ ├── login.tsx # required by requireAuth
74
- │ ├── auth/ # OAuth handlers
75
- │ │ ├── login.ts
76
- │ │ ├── callback.ts
77
- │ │ └── logout.ts
78
- │ ├── api/ # REST API routes (only when a public API is required)
79
- │ │ └── features/
80
- │ │ ├── index.ts
81
- │ │ └── $id.ts
82
- │ └── features/ # feature folder with multiple routes (kebab-case, plural)
83
- │ ├── -components/ # route-specific components
84
- │ ├── -hooks/ # route-specific hooks
85
- │ ├── index.tsx
86
- │ ├── create.tsx
87
- │ ├── $id.tsx
88
- │ └── edit.$id.tsx
89
- ├── server/ # server-only code, never imported from a component
90
- │ ├── actions/
91
- │ │ └── <table>.ts
92
- │ ├── db/
93
- │ │ ├── migrations/
94
- │ │ ├── schemas/ # Drizzle schemas
95
- │ │ │ ├── <table>.ts
96
- │ │ │ └── relations.ts
97
- │ │ └── index.ts # pool, search_path, auto-migrate
98
- │ └── middleware/
99
- │ └── databaseMiddleware.ts # app-local, not a library export
100
- ├── start.ts # request middleware, incl. CSRF
101
- ├── types/
102
- │ ├── i18next.d.ts # types t() against en.json
103
- │ └── wcz-layout.d.ts # declares virtual:wcz-layout
104
- tests/
105
- ├── unit/
106
- │ ├── lib/
107
- │ │ └── schemas/
108
- │ │ └── <table>.test.ts
109
- │ ├── hooks/
110
- │ │ └── useX.test.ts
111
- │ └── routes/
112
- │ └── features/
113
- │ └── -components/
114
- │ └── XCard.test.tsx
115
- ├── integration/
116
- │ ├── server/
117
- │ │ └── actions/
118
- │ │ └── <table>.test.ts
119
- │ └── db/
120
- │ └── collections/
121
- │ └── <table>.test.ts
122
- └── e2e/
123
- └── features/
124
- └── create.spec.ts
125
- ```
1
+ ---
2
+ name: general
3
+ description: "Use ALWAYS, before any other skill here, for every code change in this project. Defines the approved stack (TanStack, Vite+, MUI), TypeScript and naming conventions, date formatting, light/dark theming, testing and the validation command, and the src/ and tests/ folder layout that decides where each new file goes."
4
+ metadata:
5
+ type: convention
6
+ library: wcz-layout
7
+ ---
8
+
9
+ > This is the default skill. Reference it in combination with more specific skills (e.g., `forms`, `table`, `dialogs`, etc.) for targeted tasks. For the full catalogue of every `wcz-layout` import subpath and what it exports, read [references/exports.md](references/exports.md).
10
+
11
+ ## Preferred Technology Stack
12
+
13
+ Favor the established platform before introducing custom code or a new dependency:
14
+
15
+ - **TanStack ecosystem:** Reach for the TanStack library that owns the problem instead of hand-rolling it — Start for the full-stack app and server functions, Router for routing and route-level data loading, DB for client-side collections and live queries, AI for LLM-backed chat and streaming, Form for form state and validation, Hotkeys for keyboard shortcuts, Virtual for long lists and grids, Pacer for debouncing, throttling, rate limiting and queueing.
16
+ - **Vite+:** Use Vite+ for the development server, formatting, linting and testing.
17
+ - **Material UI:** Use Material UI for interface components and icons. When an advanced capability is needed, consider MUI X Charts for data visualization, Tree View for hierarchical data, Scheduler for calendars and timelines, and Chat for AI-powered conversations.
18
+
19
+ When the requirement is not covered above, look for an existing library before writing any logic. Prefer a well-maintained, widely adopted, typed library over custom implementations, even for seemingly simple functionality where a library can reduce edge cases and bugs. If a suitable library exists, install it and use it. Only implement the functionality yourself when it takes a few lines or no suitable library exists.
20
+
21
+ ## Coding Conventions
22
+
23
+ - Write strict ES2023 TypeScript. Preserve local inference, type public boundaries and never use explicit `any`.
24
+ - Stick to double quotes, semicolons, and the `~/` alias for `src/` imports.
25
+ - Avoid `useMemo` / `useCallback`; the React Compiler handles memoization.
26
+ - Keep code self-documenting; only add comments to clarify non-obvious intent.
27
+ - Run the narrow relevant test, then `vp check --fix`. It formats, lints and type-checks.
28
+
29
+ ## User Interface
30
+
31
+ - Translate every user-facing string via `useTranslation` (or `t` outside components).
32
+ - Format all client-side dates with `"L LT"` or `"L"`.
33
+ - Build skeletons for loading states.
34
+ - When building UI, always design for both light and dark mode; this app uses `colorSchemeSelector: "data-mui-color-scheme"`, so prefer `theme.applyStyles("dark", ...)` for mode-specific styling.
35
+ - Always design for desktop and mobile, using responsive layouts and breakpoints to keep the UI usable on any screen.
36
+
37
+ ## Testing
38
+
39
+ - Tests run on `vp test` (bundled in vite-plus).
40
+
41
+ ## File Organization
42
+
43
+ Use this ownership model for new application code. Keep feature-specific code close to its route; promote it to a root directory only when it is shared across multiple features. One database table = one file per layer: every `<table>` slot below is the same singular camelCase table name, never grouped with its parent or child tables.
44
+
45
+ ```txt
46
+ src/ # client-first architecture
47
+ ├── components/ # shared components across multiple routes
48
+ ├── db/ # TanStack DB
49
+ │ ├── collections/ # collection descriptors
50
+ │ │ └── <table>.ts
51
+ │ ├── queries/ # live query option objects
52
+ │ │ └── <table>.ts
53
+ │ └── persistence.ts # browser SQLite persistence
54
+ ├── env.ts # clientEnv + serverEnv via createEnv
55
+ ├── hooks/ # shared hooks across multiple routes
56
+ │ └── useTheme.ts # MUI theme + color schemes
57
+ ├── lib/ # isomorphic/shared logic usable by client and server
58
+ │ ├── auth/
59
+ │ │ ├── permissions.ts # as const satisfies Permissions
60
+ │ │ └── scopes.ts # as const satisfies Scopes
61
+ │ ├── locales/
62
+ │ │ ├── cs.json
63
+ │ │ └── en.json
64
+ │ └── schemas/ # shared Zod schemas
65
+ │ └── <table>.ts
66
+ ├── router.tsx # QueryClient, DbClient, router options
67
+ ├── routes/ # TanStack Router file-based routing
68
+ │ ├── __root.tsx
69
+ │ ├── index.tsx
70
+ │ ├── login.tsx # required by requireAuth
71
+ │ ├── auth/ # OAuth handlers
72
+ │ │ ├── login.ts
73
+ │ │ ├── callback.ts
74
+ │ │ └── logout.ts
75
+ │ ├── api/ # REST API routes (only when a public API is required)
76
+ │ │ └── features/
77
+ │ │ ├── index.ts
78
+ │ │ └── $id.ts
79
+ │ └── features/ # feature folder with multiple routes (kebab-case, plural)
80
+ │ ├── -components/ # route-specific components
81
+ │ ├── -hooks/ # route-specific hooks
82
+ │ ├── index.tsx
83
+ │ ├── create.tsx
84
+ │ ├── $id.tsx
85
+ │ └── edit.$id.tsx
86
+ ├── server/ # server-only code, never imported from a component
87
+ │ ├── actions/
88
+ │ │ └── <table>.ts
89
+ │ ├── db/
90
+ │ │ ├── migrations/
91
+ │ │ ├── schemas/ # Drizzle schemas
92
+ │ │ │ ├── <table>.ts
93
+ │ │ │ └── relations.ts
94
+ │ │ └── index.ts # pool, search_path, auto-migrate
95
+ │ └── middleware/
96
+ │ └── databaseMiddleware.ts # app-local, not a library export
97
+ ├── start.ts # request middleware, incl. CSRF
98
+ ├── types/
99
+ │ ├── i18next.d.ts # types t() against en.json
100
+ │ └── wcz-layout.d.ts # declares virtual:wcz-layout
101
+ tests/
102
+ ├── unit/
103
+ │ ├── lib/
104
+ │ │ └── schemas/
105
+ │ │ └── <table>.test.ts
106
+ │ ├── hooks/
107
+ │ │ └── useX.test.ts
108
+ │ └── routes/
109
+ │ └── features/
110
+ │ └── -components/
111
+ │ └── XCard.test.tsx
112
+ ├── integration/
113
+ │ ├── server/
114
+ │ │ └── actions/
115
+ │ │ └── <table>.test.ts
116
+ │ └── db/
117
+ │ └── collections/
118
+ │ └── <table>.test.ts
119
+ └── e2e/
120
+ └── features/
121
+ └── create.spec.ts
122
+ ```
@@ -21,6 +21,7 @@ middleware arrays you need to eyeball vanish into the churn.
21
21
  | Install | `@tanstack/react-table` | 9.x |
22
22
  | Install | `@tanstack/react-virtual` | 3.x |
23
23
  | Install | `@tanstack/react-hotkeys` | 0.x |
24
+ | Install | `@tanstack/react-pacer` | 0.x |
24
25
  | Install | `@mui/x-date-pickers` | 9.x |
25
26
  | Upgrade | `@tanstack/react-query` | **≥ 5.102** |
26
27
  | Upgrade | `@tanstack/react-router-ssr-query` | latest 1.x |
@@ -28,7 +29,7 @@ middleware arrays you need to eyeball vanish into the churn.
28
29
  | Delete | `@mui/x-date-pickers-pro` | — |
29
30
 
30
31
  ```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-table@9 @tanstack/react-virtual@3 @tanstack/react-hotkeys@0 @tanstack/react-pacer@0 @mui/x-date-pickers@9
32
33
  npm install @tanstack/react-query@latest @tanstack/react-router-ssr-query@latest
33
34
  npm uninstall @mui/x-data-grid-premium @mui/x-date-pickers-pro
34
35
  ```
@@ -304,7 +305,7 @@ quick filter, columns panel and filter panel itself. In `useTheme.ts`, drop
304
305
  | `ignoreDiacritics` | always on |
305
306
  | `rowSelectionModel` state | `table.getSelectedRowIds()`, `table.resetRowSelection()` |
306
307
  | `cellSelection` | always on, `Mod+C` copies the range as TSV |
307
- | `GridActionsCellItem` in a `type: "actions"` column | a `display` column rendering `cell.ActionsCell` |
308
+ | `GridActionsCellItem` in a `type: "actions"` column | a `display` column rendering `cell.ActionsCell`, `showInMenu` kept |
308
309
 
309
310
  **Every row needs an `id`.** `getRowId` is not an option — the library hardcodes
310
311
  `row.id`. A table over a view or a natural-key table without an `id` column must add
@@ -1,110 +1,114 @@
1
- # peoplesoft
2
-
3
- ## Client
4
-
5
- - Employee:
6
- `searchEmployeesQueryOptions`
7
- `employeesQueryOptions`
8
- `activeEmployeesQueryOptions`
9
- `employeeByEmployeeIdQueryOptions`
10
- `previousEmployeeIdsQueryOptions`
11
- `employeeSupervisorQueryOptions`
12
- `employeeSubordinatesQueryOptions`
13
- `employeeManagerQueryOptions`
14
- `employeeGeneralManagerQueryOptions`
15
- `companyGeneralManagerQueryOptions`
16
- - Department:
17
- `departmentsQueryOptions`
18
- `departmentByIdQueryOptions`
19
- `departmentManagerQueryOptions`
20
- `departmentEmployeesQueryOptions`
21
-
22
- ## Server
23
-
24
- - Employee:
25
- `searchEmployees`
26
- `getEmployees`
27
- `getActiveEmployees`
28
- `getEmployeeByEmployeeId`
29
- `getPreviousEmployeeIds`
30
- `getEmployeeSupervisor`
31
- `getEmployeeSubordinates`
32
- `getEmployeeManager`
33
- `getEmployeeGeneralManager`
34
- `getCompanyGeneralManager`
35
- - Department:
36
- `getDepartments`
37
- `getDepartmentById`
38
- `getDepartmentManager`
39
- `getDepartmentEmployees`
40
-
41
- ## Schemas/Models
42
-
43
- ```ts
44
- const EmployeeSchema = z.object({
45
- badgeId: z.string().trim(),
46
- category: z.string().trim(),
47
- categoryGroup: EmployeeCategoryGroup,
48
- companyCode: z.string().trim(),
49
- contactPhone: z.string().trim(),
50
- departmentId: z.string().trim(),
51
- departmentDescription: z.string().trim(),
52
- emailString: z.string().trim().nullable(),
53
- employeeId: z.string().trim(),
54
- extensionNumber: z.string().trim(),
55
- firstName: z.string().trim(),
56
- gender: z.string().trim(),
57
- hiredDate: z.date(),
58
- lastName: z.string().trim(),
59
- managerId: z.string().trim(),
60
- middleName: z.string().trim(),
61
- name: z.string().trim(),
62
- nameTitleCase: z.string().trim(),
63
- nfcSn: z.string().trim(),
64
- plantId: z.string().trim(),
65
- position: z.string().trim(),
66
- previousEmployeeIds: z.string().trim().nullable(),
67
- reHiredDate: z.date().nullable(),
68
- recordNumber: z.number(),
69
- status: EmployeeStatus,
70
- supervisorId: z.string().trim(),
71
- terminationDate: z.date().nullable(),
72
- terminationFutureDate: z.date().nullable(),
73
- type: z.string().trim(),
74
- upperDepartmentId: z.string().trim(),
75
- jobCode: z.string().trim(),
76
- jobDescription: z.string().trim(),
77
- terminationReason: z.string().trim().nullable(),
78
- supervisorRecordNumber: z.number(),
79
- });
80
-
81
- const DepartmentSchema = z.object({
82
- departmentId: z.string().trim(),
83
- description: z.string().trim(),
84
- managerId: z.string().trim(),
85
- managerRecordNumber: z.string().trim(),
86
- treeLevel: z.number(),
87
- upperDepartmentId: z.string().trim(),
88
- companyCode: z.string().trim(),
89
- location: z.string().trim(),
90
- salLocation: z.string().trim(),
91
- plantId: z.string().trim(),
92
- manager: EmployeeSchema,
93
- });
94
-
95
- const EmployeeCategoryGroup = z.enum(["IDL", "FD", "FI"]);
96
- const EmployeeStatus = z.enum(["Active", "Terminated", "Leave of Absence"]);
97
- ```
98
-
99
- ## Examples
100
-
101
- ```ts
102
- import { activeEmployeesQueryOptions } from "wcz-layout/data/client";
103
- import { getEmployeeManager } from "wcz-layout/data/server";
104
-
105
- // client
106
- const { data: employees = [] } = useQuery(activeEmployeesQueryOptions());
107
-
108
- // server
109
- const manager = await getEmployeeManager({ data: { employeeId } });
110
- ```
1
+ # peoplesoft
2
+
3
+ ## Client
4
+
5
+ - Employee:
6
+ `searchEmployeesQueryOptions`
7
+ `employeesQueryOptions`
8
+ `activeEmployeesQueryOptions`
9
+ `employeeByEmployeeIdQueryOptions`
10
+ `previousEmployeeIdsQueryOptions`
11
+ `employeeSupervisorQueryOptions`
12
+ `employeeSubordinatesQueryOptions`
13
+ `employeeManagerQueryOptions`
14
+ `employeeGeneralManagerQueryOptions`
15
+ `companyGeneralManagerQueryOptions`
16
+ `searchEmployees`
17
+ `getEmployees`
18
+ `getActiveEmployees`
19
+ - Department:
20
+ `departmentsQueryOptions`
21
+ `departmentByIdQueryOptions`
22
+ `departmentManagerQueryOptions`
23
+ `departmentEmployeesQueryOptions`
24
+ `getDepartments`
25
+
26
+ ## Server
27
+
28
+ - Employee:
29
+ `searchEmployees`
30
+ `getEmployees`
31
+ `getActiveEmployees`
32
+ `getEmployeeByEmployeeId`
33
+ `getPreviousEmployeeIds`
34
+ `getEmployeeSupervisor`
35
+ `getEmployeeSubordinates`
36
+ `getEmployeeManager`
37
+ `getEmployeeGeneralManager`
38
+ `getCompanyGeneralManager`
39
+ - Department:
40
+ `getDepartments`
41
+ `getDepartmentById`
42
+ `getDepartmentManager`
43
+ `getDepartmentEmployees`
44
+
45
+ ## Schemas/Models
46
+
47
+ ```ts
48
+ const EmployeeSchema = z.object({
49
+ badgeId: z.string().trim(),
50
+ category: z.string().trim(),
51
+ categoryGroup: EmployeeCategoryGroup,
52
+ companyCode: z.string().trim(),
53
+ contactPhone: z.string().trim(),
54
+ departmentId: z.string().trim(),
55
+ departmentDescription: z.string().trim(),
56
+ emailString: z.string().trim().nullable(),
57
+ employeeId: z.string().trim(),
58
+ extensionNumber: z.string().trim(),
59
+ firstName: z.string().trim(),
60
+ gender: z.string().trim(),
61
+ hiredDate: z.date(),
62
+ lastName: z.string().trim(),
63
+ managerId: z.string().trim(),
64
+ middleName: z.string().trim(),
65
+ name: z.string().trim(),
66
+ nameTitleCase: z.string().trim(),
67
+ nfcSn: z.string().trim(),
68
+ plantId: z.string().trim(),
69
+ position: z.string().trim(),
70
+ previousEmployeeIds: z.string().trim().nullable(),
71
+ reHiredDate: z.date().nullable(),
72
+ recordNumber: z.number(),
73
+ status: EmployeeStatus,
74
+ supervisorId: z.string().trim(),
75
+ terminationDate: z.date().nullable(),
76
+ terminationFutureDate: z.date().nullable(),
77
+ type: z.string().trim(),
78
+ upperDepartmentId: z.string().trim(),
79
+ jobCode: z.string().trim(),
80
+ jobDescription: z.string().trim(),
81
+ terminationReason: z.string().trim().nullable(),
82
+ supervisorRecordNumber: z.number(),
83
+ });
84
+
85
+ const DepartmentSchema = z.object({
86
+ departmentId: z.string().trim(),
87
+ description: z.string().trim(),
88
+ managerId: z.string().trim(),
89
+ managerRecordNumber: z.string().trim(),
90
+ treeLevel: z.number(),
91
+ upperDepartmentId: z.string().trim(),
92
+ companyCode: z.string().trim(),
93
+ location: z.string().trim(),
94
+ salLocation: z.string().trim(),
95
+ plantId: z.string().trim(),
96
+ manager: EmployeeSchema,
97
+ });
98
+
99
+ const EmployeeCategoryGroup = z.enum(["IDL", "FD", "FI"]);
100
+ const EmployeeStatus = z.enum(["Active", "Terminated", "Leave of Absence"]);
101
+ ```
102
+
103
+ ## Examples
104
+
105
+ ```ts
106
+ import { activeEmployeesQueryOptions } from "wcz-layout/data/client";
107
+ import { getEmployeeManager } from "wcz-layout/data/server";
108
+
109
+ // client
110
+ const { data: employees = [] } = useQuery(activeEmployeesQueryOptions());
111
+
112
+ // server
113
+ const manager = await getEmployeeManager({ data: { employeeId } });
114
+ ```
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: table
3
- description: "Use when building or changing a data table, grid, or list page. Covers useLayoutTable, LayoutTable, createLayoutColumnHelper, column definitions and headers, cell formatters, filter variants, sorting, row selection and bulk actions, per-row actions, pagination, footer aggregation."
3
+ description: "Use when building or changing a data table. Covers useLayoutTable, LayoutTable, createLayoutColumnHelper, column definitions and headers, cell formatters, filter variants, sorting, row selection and bulk actions, per-row actions, pagination, footer aggregation."
4
4
  metadata:
5
5
  type: convention
6
6
  library: wcz-layout
@@ -15,49 +15,36 @@ metadata:
15
15
 
16
16
  ## Rules
17
17
 
18
- - For selection and actions display columns, always set `size: 50`,
19
- `enableResizing: false`, and `enableCellSelection: false`.
20
- - Create the column helper once at module scope, outside the component:
21
- `const columnHelper = createLayoutColumnHelper<Todo>()`. Wrap the array in
22
- `columnHelper.columns([...])` so each column keeps its own value type.
23
18
  - Build the instance with `useLayoutTable({ data, columns })` and pass it to
24
19
  `<LayoutTable table={table} />`. Rows are keyed by `row.id`, so every row object
25
20
  needs an `id`.
21
+ - For selection and actions display columns, always set `size: 50`,
22
+ `enableResizing: false`, and `enableCellSelection: false`. An actions column
23
+ that shows more than one button needs about 40px more per extra button.
26
24
  - Render cells with the bound components off the render prop
27
25
  (`cell.ValueCell`, `NumberCell`, `DateCell`, `DateTimeCell`, `BooleanCell`)
28
26
  instead of raw JSX. They carry the alignment, the number and date locale, and
29
27
  the noWrap behaviour. Write raw JSX only when the cell is a link or
30
28
  another interactive element.
31
- - Set `meta.variant` for non-text filters. Omission means `"text"`.
32
29
  - Give `meta.label` to any column whose `header` is not a plain string. A string
33
30
  header supplies the label automatically; a function or JSX header leaves the
34
31
  header menu and column selector without a label; the filter picker falls back to
35
- `column.id`. `meta` has four keys: `label`, `align`, `variant`, `options`.
32
+ `column.id`. `meta` has five keys: `label`, `align`, `variant`, `options`, `flex`.
33
+ - `meta.flex` makes a column share the width left over from the sized columns, in
34
+ proportion like CSS `flex-grow`. `size` stays its minimum width. Resizing the column
35
+ pins it to a fixed width.
36
+ - Wrap the table in `Fullscreen` when it is the only content on the page.
37
+ - Props: `title`, `actions`, `showToolbar`,
38
+ `loading`, `pagination`, `pageSizeOptions`, `onRowClick`, `onRowDoubleClick`,
39
+ `sx`, and the `disableSearch` / `disableColumnFilter` / `disableColumnSelector` /
40
+ `disableColumnMenu` escape hatches.
41
+ - Rows and columns virtualize by default.
42
+ - Set `meta.variant` for non-text filters. Omission means `"text"`.
36
43
  - Do not enumerate `meta.options` for a free-text column. `select` and
37
44
  `multi-select` read their options from the faceted unique values, so the choices
38
45
  track the data. Pass explicit string options when labels differ from stored values or
39
46
  the UI needs a fixed list. Derive database-enum options from `enumValues`, never a
40
47
  second hand-written list.
41
- - Translate every `header`. The table's own strings come from the app's
42
- `src/lib/locales/*.json` under `Layout.Table`. See the `general` skill for the
43
- setup step: the app owns the whole `Layout` namespace, not just `Layout.Table`.
44
- - Wrap the table in `Fullscreen` when it is the only content on the page.
45
- - Rows and columns virtualize by default. Pass `pagination` for page-based navigation.
46
- Virtualization reduces rendered DOM; it does not reduce fetched data or replace
47
- server-side pagination. Column virtualization
48
- switches off for grouped header rows and while `loading`, which is a real perf
49
- cliff on wide tables that use `columnHelper.group`.
50
- - Props go on `LayoutTable`, not on a slot: `title`, `actions`, `showToolbar`,
51
- `loading`, `pagination`, `pageSizeOptions`, `onRowClick`, `onRowDoubleClick`,
52
- `sx`, and the `disableSearch` / `disableColumnFilter` / `disableColumnSelector` /
53
- `disableColumnMenu` escape hatches.
54
- - Omit the second `useLayoutTable` selector when passing its result to `LayoutTable`; the
55
- renderer requires the full selected state.
56
- - For bulk actions read `table.getSelectedRowIds()` and clear with
57
- `table.resetRowSelection()`. For per-row actions add a `display` column rendering
58
- `cell.ActionsCell` with a `RowAction[]`.
59
- - A footer total needs both halves: `aggregationFn` on the column and
60
- `footer: ({ header }) => <header.AggregationFooter />`.
61
48
 
62
49
  ## Example
63
50
 
@@ -221,14 +208,15 @@ columnHelper.display({
221
208
  {
222
209
  label: t("Delete"),
223
210
  icon: <Delete fontSize="small" />,
224
- divider: true,
211
+ showInMenu: true,
225
212
  onClick: (row) => remove(row.id),
226
213
  },
227
214
  ]}
228
215
  />
229
216
  ),
230
- size: 60,
217
+ size: 50,
231
218
  enableResizing: false,
219
+ enableCellSelection: false,
232
220
  }),
233
221
  ```
234
222