FASES 1-7 completadas: - FilterBar extraído a table_core/filter_bar.zig (DRY) - Footer extraído a table_core/footer.zig (DRY) - AdvancedTable ahora soporta FilterBar + Footer opcional - validateCell añadido a TableDataSource VTable - VirtualAdvancedTable migrado a usar componentes compartidos Paridad UX completa entre AdvancedTable y VirtualAdvancedTable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
92 lines
3 KiB
Zig
92 lines
3 KiB
Zig
//! AdvancedTable Result - Return type from advancedTable() call
|
|
//!
|
|
//! Struct independiente que contiene el resultado de una llamada a advancedTable().
|
|
//! Extraído de state.zig para mejorar modularidad.
|
|
|
|
const table_core = @import("../table_core/table_core.zig");
|
|
const types = @import("types.zig");
|
|
|
|
pub const SortDirection = types.SortDirection;
|
|
pub const CRUDAction = types.CRUDAction;
|
|
|
|
/// Result returned from advancedTable() call
|
|
pub const AdvancedTableResult = struct {
|
|
// Selection
|
|
selection_changed: bool = false,
|
|
selected_row: ?usize = null,
|
|
selected_col: ?usize = null,
|
|
|
|
// Editing
|
|
edit_started: bool = false,
|
|
edit_ended: bool = false,
|
|
cell_edited: bool = false,
|
|
|
|
// Sorting
|
|
sort_changed: bool = false,
|
|
sort_column: ?usize = null,
|
|
sort_direction: SortDirection = .none,
|
|
|
|
// Row operations
|
|
row_inserted: bool = false,
|
|
row_deleted: bool = false,
|
|
row_moved: bool = false,
|
|
|
|
// Auto-CRUD
|
|
crud_action: ?CRUDAction = null,
|
|
crud_success: bool = true,
|
|
|
|
// Lookup (Phase 7)
|
|
lookup_success: ?bool = null, // null = no lookup, true = found, false = not found
|
|
|
|
// Focus
|
|
clicked: bool = false,
|
|
|
|
// =========================================================================
|
|
// FilterBar (PARIDAD con VirtualAdvancedTable - Enero 2026)
|
|
// =========================================================================
|
|
|
|
/// El filtro de texto cambió
|
|
filter_changed: bool = false,
|
|
|
|
/// Texto del filtro (válido si filter_changed)
|
|
filter_text: ?[]const u8 = null,
|
|
|
|
/// Un chip cambió de estado
|
|
chip_changed: bool = false,
|
|
|
|
/// Índice del chip que cambió
|
|
chip_index: ?u4 = null,
|
|
|
|
/// ¿El chip está ahora activo?
|
|
chip_active: bool = false,
|
|
|
|
// =========================================================================
|
|
// Edición CRUD Excel-style (simétrico con VirtualAdvancedTableResult)
|
|
// =========================================================================
|
|
|
|
/// Una fila fue completada (el usuario cambió de fila, tenía cambios pendientes)
|
|
row_committed: bool = false,
|
|
|
|
/// ID de la fila que se hizo commit (índice en AdvancedTable)
|
|
row_commit_id: i64 = table_core.NEW_ROW_ID,
|
|
|
|
/// Es un INSERT (ghost row) o UPDATE (fila existente)
|
|
row_commit_is_insert: bool = false,
|
|
|
|
/// Cambios de la fila (válidos si row_committed = true)
|
|
row_changes: [table_core.MAX_PENDING_COLUMNS]table_core.PendingCellChange = undefined,
|
|
|
|
/// Número de cambios en row_changes
|
|
row_changes_count: usize = 0,
|
|
|
|
/// Tab presionado para salir del widget
|
|
tab_out: bool = false,
|
|
|
|
/// Shift estaba presionado con Tab
|
|
tab_shift: bool = false,
|
|
|
|
/// Obtiene los cambios como slice
|
|
pub fn getRowChanges(self: *const AdvancedTableResult) []const table_core.PendingCellChange {
|
|
return self.row_changes[0..self.row_changes_count];
|
|
}
|
|
};
|