// Playground tables: iterador de la fn `data_table` antes de promoverla al // registry y migrar las apps C++ que hoy usan `ImGui::BeginTable` raw. #include "app_base.h" #include "imgui.h" #include "core/logger.h" #include "data_table.h" #include namespace { struct Row { const char* name; const char* lang; const char* domain; const char* purity; const char* description; }; const std::vector& sample_rows() { static const std::vector rows = { {"filter_slice", "go", "core", "pure", "Filtra slice con predicado"}, {"map_slice", "go", "core", "pure", "Aplica f a cada elemento"}, {"reduce_slice", "go", "core", "pure", "Fold con acumulador"}, {"sma", "py", "finance", "pure", "Simple moving average"}, {"ema", "py", "finance", "pure", "Exponential moving average"}, {"rsi", "py", "finance", "pure", "Relative strength index"}, {"table_view", "cpp", "viz", "pure", "Tabla ImGui actual del registry"}, {"line_plot", "cpp", "viz", "pure", "ImPlot line wrapper"}, {"scatter_plot", "cpp", "viz", "pure", "ImPlot scatter wrapper"}, {"bar_chart", "cpp", "viz", "pure", "ImPlot bar wrapper"}, {"heatmap", "cpp", "viz", "pure", "ImPlot heatmap wrapper"}, {"sqlite_open", "go", "infra", "impure", "Open SQLite con WAL+FK"}, {"http_json_response", "go", "infra", "impure", "Helper JSON response"}, {"http_parse_body", "go", "infra", "impure", "Parse JSON body"}, {"rsync_deploy", "bash", "infra", "impure", "rsync local -> remoto"}, {"systemd_install", "go", "infra", "impure", "Sube unit + enable + start"}, {"systemd_restart", "go", "infra", "impure", "Restart servicio remoto"}, {"jupyter_discover", "py", "notebook", "impure", "Descubre instancias Jupyter"}, {"jupyter_exec", "py", "notebook", "impure", "Ejecuta celda y vuelca output"}, {"docker_pull_image", "go", "infra", "impure", "docker pull con timeout"}, {"graph_force_layout", "cpp", "viz", "pure", "Force-directed CPU"}, {"graph_force_layout_gpu","cpp", "viz", "pure", "Force-directed GPU (compute)"}, {"sql_workbench", "cpp", "core", "impure", "Workbench SQL embebido"}, {"text_editor", "cpp", "core", "impure", "Editor de texto con highlighting"}, {"icon_font", "cpp", "core", "impure", "Carga tabler-icons.ttf"}, }; return rows; } const char* const* flatten_cells(int& rows, int& cols) { static std::vector flat; static bool built = false; if (!built) { const auto& src = sample_rows(); flat.reserve(src.size() * 5); for (const auto& r : src) { flat.push_back(r.name); flat.push_back(r.lang); flat.push_back(r.domain); flat.push_back(r.purity); flat.push_back(r.description); } built = true; } rows = (int)sample_rows().size(); cols = 5; return flat.data(); } } // namespace void render() { static data_table::State st; if (ImGui::Begin("Tables Playground - data_table v0.1")) { ImGui::TextWrapped( "Iteracion 1: sort real al pulsar header, click en celda -> popup operador " "(=, !=, >, >=, <, <=) -> chip removible. Click derecho header: filter input, " "conditional color, hide column, show/hide columns."); ImGui::Separator(); static const char* headers[] = {"name", "lang", "domain", "purity", "description"}; int rows = 0, cols = 0; const char* const* cells = flatten_cells(rows, cols); data_table::render("##registry_sample", headers, cols, cells, rows, st); } ImGui::End(); } #ifndef FN_TEST_BUILD int main() { return fn::run_app({ .title = "Tables Playground", .width = 1280, .height = 800, .about = {.name = "tables_playground", .version = "0.2.0", .description = "Playground para iterar mejoras sobre table_view antes de promover al registry."}, .log = {.file_path = "tables_playground.log", .level = static_cast(fn_log::Level::Info)} }, render); } #endif