/** * patient-table — column definitions * ---------------------------------------------------------------------------- * `buildPatientColumns(t, opts)` returns the ordered `ColDef[]` for * the patient grid. Every patient field is its OWN column — sortable, filterable * and individually hideable via ColumnToggle — rather than several fields jumbled * into one composite cell. Each column wires the right kit cell renderer + the * right kit filter + floatingFilter, a localised `headerName` (from * `ui.patientTable.column.*`) and a stable `colId`. * * Identity is SPLIT across three pinned-start columns (the spec's * "Avatar · First · Last"): * • `avatar` — ImageCellRenderer (photo, initials fallback), sr-only header. * • `firstName` — plain text. * • `lastName` — LinkCellRenderer (the patient-detail link, `identityHref`). * All three are pinned-start P0 anchors and never auto-hide. * * COLUMN VISIBILITY * ----------------- * `●` default-visible columns carry a `responsiveTier`; the responsive hook hides * them by tier as the grid narrows. Every other (grouped) column ships * `hide: true` and NO tier, so the hook leaves it alone and a user ColumnToggle * override wins. The anchors (avatar / firstName / lastName / actions) omit a * tier so they are never auto-hidden. * * RESPONSIVE TIER MECHANISM * ------------------------- * Each column may carry a custom `responsiveTier` (`P0`–`P3`) property. AG Grid's * `ColDef` is an open/extensible shape — extra properties pass through untouched * at runtime — but its TS type is closed, so we type each entry as * `PatientColDefWithTier` and read the tier back via {@link getResponsiveTier} * (no `any`, no reliance on AG Grid's loose `context`). * * CUSTOM FIELDS * ------------- * `opts.customFields` appends one dynamic column per descriptor after the * standard columns: `colId: \`custom:${fieldName}\``, a LITERAL `headerName` * (the practice-defined label — never i18n-keyed), a `valueGetter` reading * `row.customFields?.[fieldName]`, and a renderer + filter chosen by `type` * (`text` → plain text · `checkbox` → ✓/— · `dropdown` → Tag chip). All ship * `hide: true` and no tier. * * CONSTRAINTS: * • No colour / spacing / radius / font literal in any `cellStyle`/`cellClass` * here — only token-bound `ds:` utility classes — so the AG Grid theme bridge * stays in control of theming. * • CSS logical properties only. * • PHI rule (PRS 26 §6): no `PatientRow` field other than `id` is ever placed * in a DOM `data-*` attribute. Renderers surface name/contact/DOB as text * content only; these defs pass values, not attributes. */ import type { TFunction } from 'i18next'; import type { PatientColDef, PatientColumnDef, PatientCustomFieldDef, PatientRow, PatientRowAction, ResponsiveTier } from './types'; /** * A patient leaf column carrying its responsive-priority tier. AG Grid passes * the extra `responsiveTier` key through untouched; we keep it strongly typed * (no `any`, no reliance on AG Grid's `context: any`) so the responsive hook can * read it back via {@link getResponsiveTier}. */ export type PatientColDefWithTier = PatientColDef & { /** * Responsive priority, carried in AG Grid's own `context` bag. Lower numbers * survive longer as the grid narrows: `P0` always visible, `P3` first to hide. * Consumed by `useResponsiveColumns`. * * `context` is the documented place for application data. A bare top-level key * is rejected by AG Grid's colDef validation and logged as `invalid colDef * property` in every consumer's console. */ context?: { responsiveTier?: ResponsiveTier; }; }; /** * Read the responsive tier off a column definition. Returns `undefined` for * columns that opt out of responsive toggling — the pinned anchors and every * `hide: true` grouped column deliberately omit a tier so they are never * auto-managed by the responsive hook. */ export declare function getResponsiveTier(colDef: PatientColumnDef): ResponsiveTier | undefined; /** Options threaded into {@link buildPatientColumns}. */ export interface BuildPatientColumnsOptions { /** * Mask sensitive contact details (email) — when `true` the `email` column * ships hidden. Forwarded from `PatientTable`'s `hidePatientDetails`. Default * `false`. */ hideDetails?: boolean; /** * Live getter for the actions-column density. When it returns `true`, the * `ActionsCellRenderer` collapses its inline buttons into a single "…" overflow * menu (the spec's 180→88px compact density). Reading via a getter lets a * density toggle flip without rebuilding column defs (preserves column state) — * call `api.refreshCells({ force: true })` after flipping the backing value. * Defaults to a getter that always returns `false`. */ getActionsCompact?: () => boolean; /** * Invoked when a per-row action button is activated, with the resolved action * descriptor and the patient row. Only `row.id` ever leaves this boundary into * persistence / agent surfaces — never PHI. */ onRowAction?: (action: PatientRowAction, patient: PatientRow) => void; /** * Derive the patient-detail href for the `lastName` link column, e.g. * `(row) => \`/patients/${row.id}\``. When omitted the lastName cell renders a * button that calls `onRowAction` with the `show` action instead. */ identityHref?: string | ((row: PatientRow) => string | undefined); /** * Per-practice custom-field descriptors. Each appends one dynamic `custom:*` * column (hidden by default) after the standard columns. See * {@link PatientCustomFieldDef}. */ customFields?: PatientCustomFieldDef[]; /** * ISO 4217 code for the money columns (`unpaidBalance`, `billableAmount`). * Defaults to `EUR`; a practice billing in another currency must pass its own, * or every amount in the grid claims euros. */ currency?: string; } /** * The fixed number of per-row actions the patient grid builds (show · edit · * email reminder · sms reminder · reassign · delete — see {@link buildRowActions}). * Exposed so the component can size the actions column to its EXPANDED footprint * (`actionsColumnWidth(PATIENT_ROW_ACTION_COUNT)`) when flipping the runtime * compact-actions toggle off, without rebuilding the column defs. Keep in sync * with the array {@link buildRowActions} returns. */ export declare const PATIENT_ROW_ACTION_COUNT = 6; /** * Build the ordered patient-grid column definitions — one field per column. * * @param t `react-i18next` translation fn (default `ui` namespace). * @param opts See {@link BuildPatientColumnsOptions} — density getter, row-action * callback, detail masking, identity href, custom fields. * @returns Ordered `PatientColumnDef[]`. Default-visible columns carry a * `responsiveTier` (read via {@link getResponsiveTier}); the pinned * anchors and every grouped (`hide: true`) column omit it so they are * never auto-hidden. */ export declare function buildPatientColumns(t: TFunction, opts?: BuildPatientColumnsOptions): PatientColumnDef[]; //# sourceMappingURL=columns.d.ts.map