import { ReactNode } from 'react'; export interface EditableGridColumn { /** Canonical column key — matches `EditableGridRow.cells` keys. */ key: string; /** Header content (string or any node). */ label: ReactNode; /** * Accessible name for the cell editors of this column — required only when * `label` is a non-string node (otherwise the string `label`, else `key`, is * used). */ ariaLabel?: string; /** Value semantics — drives the cell editor; NOT a domain enum. */ type: "STRING" | "NUMBER" | "DATE" | "DATETIME" | "ENUM"; required?: boolean; /** Options when `type === "ENUM"`. */ enumValues?: string[]; /** Format placeholder shown in the cell (e.g. "MM.yyyy") — display only. */ hint?: string; /** * Optional value transform applied on blur/commit (e.g. TR decimal comma * "1,5" → "1.5"). Default: identity — the grid never coerces, the consumer's * backend owns parsing (legacy `strToNumber` parity). */ normalize?: (raw: string) => string; } export interface EditableGridRow { /** * STABLE identity — server `row_number` (review) or a client uuid assigned * once at creation (compose). NEVER the array index (anti-pattern #2): status, * errors and cell edits all map by `rowId`, so reorder/paginate can't skew them. */ rowId: string; /** Column key → raw string value (no client-side type coercion). */ cells: Record; /** Row-level validation state — drives the trailing status column. */ status?: "pending" | "valid" | "invalid"; /** Row-level messages, surfaced in the status Popover. */ errors?: string[]; /** Caller-managed; the grid never sets it (consumer drives re-validate). */ dirty?: boolean; } /** Localized accessible names for the row-status indicator (§4 — no baked literals). */ export interface EditableGridStatusLabels { pending?: string; valid?: string; invalid?: string; } export interface EditableGridProps { columns: EditableGridColumn[]; rows: EditableGridRow[]; onRowsChange: (rows: EditableGridRow[]) => void; /** Show an "add row" control (appends an empty row). */ allowRowAdd?: boolean; /** Show a per-row delete control. */ allowRowDelete?: boolean; /** Show a "clear all" control (empties every cell, keeps rows & rowIds). */ allowClear?: boolean; /** Read-only grid: no cell edit, no add/delete/clear controls. */ readOnly?: boolean; /** Column keys that are never editable even when the grid is editable. */ readOnlyColumns?: string[]; /** * Per-cell validation, keyed rowId → columnKey → message. Independent of * `row.status`/`row.errors`; tints the cell border + native title. */ cellErrors?: Record>; /** * Accessible labels for the row-status indicator, keyed by status. Supply * localized text (e.g. `{ invalid: "Geçersiz" }`); when a status is absent * here it falls back to a localized default from the ui-kit `common` bundle * (`editablegrid.status_{pending,valid,invalid}`) — never a raw enum value. */ statusLabels?: EditableGridStatusLabels; /** * Scroll a specific row into view (acceptance-(c) "scroll-to-row"). Set to a * `rowId` (e.g. the first invalid row after a validate pass); changing the * value re-triggers the scroll. */ scrollToRowId?: string; /** Force windowing on/off. Default: auto-on when `rows.length > virtualizeThreshold`. */ virtualized?: boolean; /** Auto-virtualize above this row count (default 100). */ virtualizeThreshold?: number; /** Estimated row height (px) for the virtualizer (default 40). */ rowHeight?: number; /** Scroll viewport height used when virtualizing (default 480). */ maxHeight?: number | string; /** Cap enforced by add-row AND paste-append (overflow dropped). */ maxRows?: number; /** * Called when a **paste** appends rows past `maxRows`, with the number of * dropped rows. (Add-row is prevented up front by disabling the button at the * cap, so it never reports here.) */ onMaxRowsExceeded?: (droppedCount: number) => void; addRowLabel?: ReactNode; emptyState?: ReactNode; className?: string; } /** * EditableGrid — spreadsheet-style, controlled, prop-driven data-entry organism * (GAP-EDITGRID). Composition of ui-kit `Table`/`Input`/`Badge`/`Popover` * primitives — no third-party grid, no package fork (ADR-010). * * Fully generic (§13): the same API serves MDM's bulk-entry (compose/review) and * any other consumer's manual-entry grid — domain vocabulary maps onto generic * capability flags + typed columns, never leaks into this contract. */ export declare const EditableGrid: import('react').ForwardRefExoticComponent>; //# sourceMappingURL=EditableGrid.d.ts.map