goobs-frontend
Version:
A comprehensive React-based libary for building modern web applications
60 lines • 2.31 kB
TypeScript
import { default as React } from 'react';
import { ColumnDef, RowData, DataGridStyles } from '../../types';
/**
* Props for the Rows component.
* These are passed from the Table parent component.
*/
interface RowsProps {
/** Array of row data objects to display */
rows: RowData[];
/** Column definitions determining display and editing behavior */
columns: ColumnDef[];
/** Array of currently selected row IDs */
selectedRowIds: string[];
/** Handler for row click (toggles selection) */
onRowClick?: (row: RowData) => void;
/** Theme and style configuration */
styles?: DataGridStyles;
/** Currently editing cell { rowId, field } or null */
editingCell?: {
rowId: string;
field: string;
} | null;
/** Current value in the editing input */
editingValue?: string;
/** Called when user clicks a cell to start editing */
onCellClick?: (rowId: string, field: string, currentValue: unknown) => void;
/** Called when user saves an edited cell */
onCellSave?: (rowId: string, field: string, value: string) => void;
/** Called when user cancels editing */
onCellCancel?: () => void;
/** Called as user types in edit input */
onEditingValueChange?: (value: string) => void;
/**
* Access control forwarded from the grid. Cell-editing affordances
* (pointer cursor, `data-cell-state="editable"`, click-to-edit — both
* inline editors and the composite-field modal) only activate with
* 'write' access. Mirrors MobileCardView's Card, which already gates
* field editing on `permissions.access === 'write'`.
*/
permissions?: {
access: 'no-access' | 'read' | 'write';
} | undefined;
}
/**
* ROWS COMPONENT
* --------------
* Renders all data rows in the table body.
*
* RENDERING LOGIC:
* 1. For each row, determine if selected and apply styles
* 2. For each cell, determine content based on:
* a. Is it being edited? -> Render EditableCell
* b. Does column have renderCell? -> Use custom renderer
* c. Is value an array? -> Render as Chips
* d. Does column have special type? -> Use formatter
* e. Default -> Display as safe string
*/
declare const Rows: React.FC<RowsProps>;
export default Rows;
//# sourceMappingURL=index.d.ts.map