Skip to main content

fret_ui_headless/table/
core_model.rs

1use std::collections::BTreeMap;
2use std::sync::Arc;
3
4use super::{HeaderGroupSnapshot, RowCellsSnapshot};
5
6#[derive(Debug, Clone, PartialEq)]
7pub struct HeaderSizingSnapshot {
8    pub size: BTreeMap<Arc<str>, f32>,
9    pub start: BTreeMap<Arc<str>, f32>,
10}
11
12#[derive(Debug, Clone, PartialEq)]
13pub struct ColumnSizingSnapshot {
14    pub total_size: f32,
15    pub left_total_size: f32,
16    pub center_total_size: f32,
17    pub right_total_size: f32,
18}
19
20#[derive(Debug, Clone, PartialEq)]
21pub struct ColumnStartSnapshot {
22    pub all: BTreeMap<Arc<str>, f32>,
23    pub left: BTreeMap<Arc<str>, Option<f32>>,
24    pub center: BTreeMap<Arc<str>, Option<f32>>,
25    pub right: BTreeMap<Arc<str>, Option<f32>>,
26}
27
28#[derive(Debug, Clone, PartialEq)]
29pub struct ColumnAfterSnapshot {
30    pub all: BTreeMap<Arc<str>, f32>,
31    pub left: BTreeMap<Arc<str>, Option<f32>>,
32    pub center: BTreeMap<Arc<str>, Option<f32>>,
33    pub right: BTreeMap<Arc<str>, Option<f32>>,
34}
35
36#[derive(Debug, Clone, PartialEq)]
37pub struct LeafColumnSizingSnapshot {
38    pub sizing: ColumnSizingSnapshot,
39    pub size: BTreeMap<Arc<str>, f32>,
40    pub start: ColumnStartSnapshot,
41    pub after: ColumnAfterSnapshot,
42}
43
44#[derive(Debug, Clone, PartialEq, Eq)]
45pub struct ColumnCapabilitySnapshot {
46    pub can_hide: bool,
47    pub can_pin: bool,
48    pub pin_position: Option<super::ColumnPinPosition>,
49    pub pinned_index: i32,
50    pub can_resize: bool,
51    pub is_visible: bool,
52}
53
54#[derive(Debug, Clone, PartialEq, Eq)]
55pub struct ColumnNodeSnapshot {
56    pub id: Arc<str>,
57    pub depth: usize,
58    pub parent_id: Option<Arc<str>>,
59    pub child_ids: Vec<Arc<str>>,
60}
61
62#[derive(Debug, Clone, PartialEq, Eq)]
63pub struct LeafColumnsSnapshot {
64    pub all: Vec<Arc<str>>,
65    pub visible: Vec<Arc<str>>,
66    pub left_visible: Vec<Arc<str>>,
67    pub center_visible: Vec<Arc<str>>,
68    pub right_visible: Vec<Arc<str>>,
69}
70
71#[derive(Debug, Clone, PartialEq, Eq)]
72pub struct FlatColumnsSnapshot {
73    pub all: Vec<Arc<str>>,
74    pub visible: Vec<Arc<str>>,
75}
76
77#[derive(Debug, Clone, PartialEq, Eq)]
78pub struct RowModelIdSnapshot {
79    pub root: Vec<Arc<str>>,
80    pub flat: Vec<Arc<str>>,
81}
82
83#[derive(Debug, Clone, PartialEq, Eq)]
84pub struct CoreRowsSnapshot {
85    pub core: RowModelIdSnapshot,
86    pub row_model: RowModelIdSnapshot,
87}
88
89#[derive(Debug, Clone, PartialEq)]
90pub struct CoreModelSnapshot {
91    pub schema_version: u32,
92    pub column_tree: Vec<ColumnNodeSnapshot>,
93    pub column_capabilities: BTreeMap<Arc<str>, ColumnCapabilitySnapshot>,
94    pub flat_columns: FlatColumnsSnapshot,
95    pub leaf_columns: LeafColumnsSnapshot,
96    pub header_groups: Vec<HeaderGroupSnapshot>,
97    pub left_header_groups: Vec<HeaderGroupSnapshot>,
98    pub center_header_groups: Vec<HeaderGroupSnapshot>,
99    pub right_header_groups: Vec<HeaderGroupSnapshot>,
100    pub header_sizing: HeaderSizingSnapshot,
101    pub leaf_column_sizing: LeafColumnSizingSnapshot,
102    pub rows: CoreRowsSnapshot,
103    pub cells: BTreeMap<Arc<str>, RowCellsSnapshot>,
104}