#pragma once // data_table_drill — drill-down stack + breadcrumb de stages. // Sub-funcion extraida de modules/data_table/data_table.cpp (issue 0107c). // // Responsabilidad: // - make_drill_filter: construye un Filter Op::Eq sobre un col_idx. // - apply_drill_step / undo_drill_step: manipula el stack drill_back/forward. // - drill_up: retrocede un stage. // - drill_into: API publica que anade un filter al stage previo y cambia active. // - draw_stage_breadcrumb: UI de la barra de breadcrumb con botones < > ^. // // Rangos del fuente original: // - make_drill_filter : linea 700-706 // - apply_drill_step : lineas 708-718 // - undo_drill_step : lineas 720-730 // - drill_up : lineas 731-745 // - drill_into : lineas 2898-2919 // - draw_stage_breadcrumb: lineas 1383-1488 // // Dependencias: data_table_types.h (State, DrillStep, Filter, Stage). #include "core/data_table_types.h" #include #include namespace data_table { // --------------------------------------------------------------------------- // Helpers internos del drill stack (usados por drill_into y draw_stage_breadcrumb). // Se exponen en el header para que data_table_grid pueda llamarlos al // procesar el drill popup de celdas en stage > 0. // --------------------------------------------------------------------------- // make_drill_filter: crea un Filter Op::Eq para col_idx con el valor dado. Filter make_drill_filter(int col_idx, const std::string& value); // apply_drill_step: inserta step.added en el stage en step.target_stage y // actualiza st.active_stage. Retorna true si el step se aplico correctamente. bool apply_drill_step(State& st, const DrillStep& step); // undo_drill_step: elimina el filter insertado por apply_drill_step y restaura // st.active_stage a step.prev_active_stage. Retorna true si se deshizo. bool undo_drill_step(State& st, const DrillStep& step); // drill_up: retrocede st.active_stage en 1 si hay stages previos. // Retorna true si se pudo retroceder. bool drill_up(State& st); // --------------------------------------------------------------------------- // API publica: drill_into // Anade un filter Op::Eq sobre col_name=value al stage (from_stage - 1) y // cambia st.active_stage a from_stage - 1. Graba el step en st.drill_back // y limpia st.drill_forward (rama nueva del arbol de drill). // // prev_input_headers: headers del INPUT del stage from_stage (para traducir // col_name a col_idx en el stage previo). // --------------------------------------------------------------------------- void drill_into(State& st, int from_stage, const std::string& col_name, const std::string& value, const std::vector& prev_input_headers); // --------------------------------------------------------------------------- // UI: draw_stage_breadcrumb // Dibuja la barra de navegacion de drill con botones < (back), > (forward), // ^ (up) y el nombre del stage activo. Mutates st.drill_back/forward y // st.active_stage en respuesta a clicks. // --------------------------------------------------------------------------- void draw_stage_breadcrumb(State& st); } // namespace data_table