1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
//! # Table Widgets
//!
//! A comprehensive suite of table widgets for displaying, organizing, and interacting with
//! structured data in terminal applications. This module provides multiple table variants
//! ranging from simple data display to advanced interactive tables with sorting, filtering,
//! pagination, and in-place editing capabilities.
//!
//! ## Features (Planned)
//!
//! - **Multiple table types**: Basic, advanced, hierarchical, and editable variants
//! - **Flexible column system**: Configurable widths, alignment, and styling
//! - **Data source flexibility**: Support for various data types and formats
//! - **Interactive sorting**: Multi-column sorting with visual indicators
//! - **Advanced filtering**: Built-in and custom filter functions
//! - **Pagination support**: Handle large datasets efficiently
//! - **Selection system**: Row, column, and cell selection modes
//! - **Scrolling capabilities**: Smooth horizontal and vertical navigation
//! - **Custom formatting**: Cell-level renderers and formatters
//! - **Keyboard navigation**: Full keyboard accessibility
//!
//! ## Widget Types
//!
//! ### Table
//! The foundational table widget for displaying structured data in rows and columns.
//! Provides basic functionality with customizable borders, headers, and cell formatting.
//! Perfect for simple data presentation needs.
//!
//! ### DataTable
//! An advanced table widget with interactive features including sorting, filtering,
//! and pagination. Designed for applications that need to display and manipulate
//! large datasets with user interaction capabilities.
//!
//! ### TreeTable
//! A hierarchical table widget supporting expandable and collapsible rows.
//! Ideal for displaying nested data structures like file systems, organizational
//! charts, or any tree-structured information.
//!
//! ### EditableTable
//! A fully interactive table widget with in-place editing capabilities.
//! Users can modify cell contents directly within the table interface,
//! making it perfect for data entry and spreadsheet-like applications.
//!
//! ## Visual Structure
//!
//! ```text
//! ┌─────────┬─────┬─────────────────────┐
//! │ Name │ Age │ Email │ ← Header row
//! ├─────────┼─────┼─────────────────────┤
//! │ Alice │ 25 │ alice@example.com │ ← Data rows
//! │ Bob │ 30 │ bob@example.com │
//! │ Charlie │ 35 │ charlie@example.com │
//! └─────────┴─────┴─────────────────────┘
//! ```
//!
//! ## Future API Design
//!
//! The table widgets will provide an intuitive, builder-pattern API:
//!
//! ```rust,ignore
//! use minui::{Table, Column, Alignment, Color, Widget};
//!
//! // Basic table setup
//! let table = Table::new(60, 20)
//! .with_columns([
//! Column::new("Name").with_width(20).with_alignment(Alignment::Left),
//! Column::new("Age").with_width(5).with_alignment(Alignment::Right),
//! Column::new("Email").with_width(30).with_alignment(Alignment::Left),
//! ])
//! .with_data([
//! ["Alice", "25", "alice@example.com"],
//! ["Bob", "30", "bob@example.com"],
//! ["Charlie", "35", "charlie@example.com"],
//! ])
//! .with_header(true)
//! .with_borders(true);
//! ```
//!
//! ## Advanced Features
//!
//! ```rust,ignore
//! use minui::{DataTable, SortOrder, FilterFunction};
//!
//! // Advanced table with interactive features
//! let data_table = DataTable::new(80, 25)
//! .with_sortable_columns(true)
//! .with_pagination(10) // 10 rows per page
//! .with_filter(FilterFunction::contains("search_term"))
//! .with_selection_mode(SelectionMode::Row)
//! .with_header_style(Color::Blue.into())
//! .with_alternate_row_colors(true);
//! ```
//!
//! ## Hierarchical Data Display
//!
//! ```rust,ignore
//! use minui::{TreeTable, TreeNode};
//!
//! // Tree table for nested data
//! let tree_table = TreeTable::new(60, 20)
//! .with_root_nodes([
//! TreeNode::new("Root 1")
//! .with_children([
//! TreeNode::new("Child 1.1"),
//! TreeNode::new("Child 1.2"),
//! ]),
//! TreeNode::new("Root 2")
//! .with_children([
//! TreeNode::new("Child 2.1"),
//! ]),
//! ])
//! .with_expand_collapse_indicator(true)
//! .with_indentation(2);
//! ```
//!
//! ## Event Handling
//!
//! ```rust,ignore
//! // Table interaction handling
//! match event {
//! Event::KeyUp => table.previous_row(),
//! Event::KeyDown => table.next_row(),
//! Event::Enter => {
//! if let Some(selected_row) = table.selected_row() {
//! println!("Selected: {:?}", selected_row);
//! }
//! }
//! _ => {}
//! }
//! ```
//!
//! ## Advanced Features
//!
//! ```rust,ignore
//! use minui::widgets::DataTable;
//!
//! let data_table = DataTable::new(0, 0, 80, 20)
//! .with_data_source(my_database_query)
//! .with_pagination(50) // 50 rows per page
//! .with_filter_bar(true)
//! .with_column_resizing(true)
//! .with_export_options(["CSV", "JSON"])
//! .with_cell_formatter("price", |value| format!("${:.2}", value));
//! ```
//!
//! ## Implementation Status
//!
//! Table widgets are not yet implemented. The current focus is on basic widgets
//! and core functionality. Table widgets will be added in a future release.
// TODO: Implement table widgets for structured data display
// This will include basic tables, data tables with sorting/filtering, and tree tables