mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
egui_extras::Table improvements (#2369)
* Use simple `ui.interact` for the resize line * Introduce TableReizeState * Simplify some code * Add striped options to table demo * Auto-size table columns by double-clicking the resize line * Table: add option to auto-size the columns * Table: don't let column width gets too small, unless clipping is on * egui_extras: always use serde Otherwise using `get_persisted` etc is impossible, and working around that tedious. * Avoid clipping last column in a resizable table * Some better naming * Table: Use new `Column` for setting column sizes and properties Also make `clip` a per-column property * All Table:s store state for auto-sizing purposes * Customize each column wether or not it is resizable * fix some auto-sizing bugs * Fix shrinkage of adaptive column content * Rename `scroll` to `vscroll` for clarity * Add Table::scroll_to_row * scroll_to_row takes alignment * Fix bug in table sizing * Strip: turn clipping OFF by default, because it is dangerous and sucks * Add TableBody::mac_rect helper * Table: add options to control the scroll area height. * Docstring fixes * Cleanup
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
use super::{button::DatePickerButtonState, month_data};
|
||||
use crate::{Size, StripBuilder, TableBuilder};
|
||||
use chrono::{Date, Datelike, NaiveDate, Utc, Weekday};
|
||||
|
||||
use egui::{Align, Button, Color32, ComboBox, Direction, Id, Layout, RichText, Ui, Vec2};
|
||||
|
||||
#[derive(Default, Clone)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
use super::{button::DatePickerButtonState, month_data};
|
||||
|
||||
use crate::{Column, Size, StripBuilder, TableBuilder};
|
||||
|
||||
#[derive(Default, Clone, serde::Deserialize, serde::Serialize)]
|
||||
struct DatePickerPopupState {
|
||||
year: i32,
|
||||
month: u32,
|
||||
@@ -243,9 +245,8 @@ impl<'a> DatePickerPopup<'a> {
|
||||
strip.cell(|ui| {
|
||||
ui.spacing_mut().item_spacing = Vec2::new(1.0, 2.0);
|
||||
TableBuilder::new(ui)
|
||||
.scroll(false)
|
||||
.clip(false)
|
||||
.columns(Size::remainder(), if self.calendar_week { 8 } else { 7 })
|
||||
.vscroll(false)
|
||||
.columns(Column::remainder(), if self.calendar_week { 8 } else { 7 })
|
||||
.header(height, |mut header| {
|
||||
if self.calendar_week {
|
||||
header.col(|ui| {
|
||||
|
||||
Reference in New Issue
Block a user