Refactor UI components for layout management and results display
- Replaced the `renderizar` function in `layouts.rs` with a new `view` function using Iced for a more modern UI approach. - Introduced a new `view_secao_layouts` function to handle the display of saved layouts. - Updated the `resultado.rs` file to use Iced for rendering the results screen, including buttons for actions and pagination controls. - Created a new `selecionar_aba.rs` file for the selection of XLSX sheet tabs, implementing a preview feature. - Removed old rendering functions and replaced them with Iced components for better performance and maintainability. - Added design tokens in `design_tokens.json` for consistent styling across the application. - Created a mockup HTML file to visualize the UI design.
This commit is contained in:
+2
-53
@@ -2,9 +2,10 @@ pub mod configuracao_colunas;
|
||||
pub mod import;
|
||||
pub mod layouts;
|
||||
pub mod resultado;
|
||||
pub mod selecionar_aba;
|
||||
|
||||
/// Converte um índice de coluna base-0 para a notação de letras do Excel (A, B, ..., Z, AA, ...).
|
||||
fn indice_para_letra(mut idx: usize) -> String {
|
||||
pub fn indice_para_letra(mut idx: usize) -> String {
|
||||
let mut resultado = String::new();
|
||||
loop {
|
||||
resultado.insert(0, (b'A' + (idx % 26) as u8) as char);
|
||||
@@ -15,55 +16,3 @@ fn indice_para_letra(mut idx: usize) -> String {
|
||||
}
|
||||
resultado
|
||||
}
|
||||
|
||||
/// Renderiza uma tabela simples de pré-visualização do arquivo.
|
||||
/// Exibe uma linha de cabeçalho com letras no estilo Excel (A, B, C, ...)
|
||||
/// seguida pelas linhas de dados.
|
||||
pub fn renderizar_tabela_preview(ui: &mut egui::Ui, linhas: &[Vec<String>]) {
|
||||
let num_colunas = linhas.iter().map(|l| l.len()).max().unwrap_or(0);
|
||||
if num_colunas == 0 {
|
||||
return;
|
||||
}
|
||||
|
||||
ui.label(
|
||||
egui::RichText::new(format!("Pré-visualização ({} linha(s))", linhas.len()))
|
||||
.small()
|
||||
.weak(),
|
||||
);
|
||||
ui.add_space(2.0);
|
||||
|
||||
egui::ScrollArea::horizontal()
|
||||
.id_salt("scroll_preview")
|
||||
.max_height(160.0)
|
||||
.show(ui, |ui| {
|
||||
egui::Grid::new("tabela_preview")
|
||||
.striped(true)
|
||||
.spacing([8.0, 2.0])
|
||||
.show(ui, |ui| {
|
||||
// Linha de cabeçalho: letras A, B, C, ... com índice base-0 entre parênteses
|
||||
for i in 0..num_colunas {
|
||||
ui.label(
|
||||
egui::RichText::new(format!("{} ({})", indice_para_letra(i), i))
|
||||
.strong()
|
||||
.monospace(),
|
||||
);
|
||||
}
|
||||
ui.end_row();
|
||||
|
||||
// Linhas de dados
|
||||
for linha in linhas {
|
||||
for col in 0..num_colunas {
|
||||
let celula = linha.get(col).map(|s| s.as_str()).unwrap_or("");
|
||||
let texto = if celula.chars().count() > 30 {
|
||||
let truncado: String = celula.chars().take(30).collect();
|
||||
format!("{}...", truncado)
|
||||
} else {
|
||||
celula.to_string()
|
||||
};
|
||||
ui.label(egui::RichText::new(texto).monospace().small());
|
||||
}
|
||||
ui.end_row();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user