- Added a new skill for managing index and list table layouts in the ERP project, detailing layout and data contracts. - Updated project guidelines to reference the new index layout skill. - Introduced rules for page composition, column definitions, audit fields, action column width, and toolbar functionality. - Created utility functions for computing action column width and formatting audit fields, along with corresponding unit tests to ensure reliability. These changes enhance the application by providing a structured approach to index layouts, improving consistency and usability across the ERP project.
34 lines
1.3 KiB
Plaintext
34 lines
1.3 KiB
Plaintext
---
|
|
description: Index / list table contracts for FULL_PAGE modules (actions, audit columns, reload)
|
|
globs: apps/web/src/apps/**/*.page.index.tsx,packages/ui/src/foundations/enterprise-module/components/data-table/**
|
|
alwaysApply: false
|
|
---
|
|
|
|
# Web Index Table
|
|
|
|
Index pages: `EnterpriseIndexPageProvider` + `EnterpriseDataTable`. Do not rebuild the toolbar or default columns. Full layout: `.agents/skills/index-layout/SKILL.md`.
|
|
|
|
## Module columnDefs
|
|
|
|
Business fields only. Do **not** redeclare action, status, or audit columns.
|
|
|
|
```tsx
|
|
// GOOD
|
|
<EnterpriseDataTable columnDefs={[{ field: 'code' }, { field: 'name' }]} filterConfig={filterConfig} />
|
|
|
|
// BAD — duplicates shared prefix/postfix
|
|
columnDefs={[{ colId: 'action_column', width: 180 }, { field: 'created_at' }]}
|
|
```
|
|
|
|
## Audit fields
|
|
|
|
Transformers map camelCase: `createdBy`, `createdAt`, `updatedBy`, `updatedAt`. The shared table postfix binds those names (with snake_case fallback). Do not emit `creator_name` / `created_at` in TrackGo transformers.
|
|
|
|
## Action column
|
|
|
|
Width is computed in `EnterpriseDataTable` from privileges (`flex: 0`, nowrap icons). Do not hard-code `width: 180` in module pages.
|
|
|
|
## Reload
|
|
|
|
Toolbar includes search, filter, and reload. Reload calls `gridApi.refreshServerSide({ purge: true })` — never `window.location.reload()`. i18n: `common:actions.reload`.
|