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
/// A flowing layout where order is the data: cells render in list order and
/// wrap onto a new line every `wrapWidth` cells. A cell's position is its
/// index — there are no coordinates and no row or column counts.
///
/// Deliberately has no `rowConfigs`: rows are derived wrap lines, so a
/// persisted per-row config would be silently mis-targeted whenever
/// `wrapWidth` or a fan-out's cardinality changed. Do not add one for symmetry.
#[derive(
Debug,
Clone,
conjure_object::serde::Serialize,
conjure_object::serde::Deserialize,
conjure_object::private::DeriveWith
)]
#[serde(crate = "conjure_object::serde")]
#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
#[conjure_object::private::staged_builder::staged_builder]
#[builder(crate = conjure_object::private::staged_builder, update, inline)]
pub struct ValueTableLayoutFlow {
#[builder(default, list(item(type = super::ValueTableFlowCell)))]
#[serde(rename = "cells", skip_serializing_if = "Vec::is_empty", default)]
cells: Vec<super::ValueTableFlowCell>,
#[serde(rename = "wrapWidth")]
wrap_width: i32,
#[builder(default, list(item(type = super::ValueTableGridRowColumnConfig)))]
#[serde(rename = "columnConfigs", skip_serializing_if = "Vec::is_empty", default)]
column_configs: Vec<super::ValueTableGridRowColumnConfig>,
#[builder(
default,
map(key(type = String, into), value(type = super::ValueTableMultiCellConfig))
)]
#[serde(
rename = "groups",
skip_serializing_if = "std::collections::BTreeMap::is_empty",
default
)]
groups: std::collections::BTreeMap<String, super::ValueTableMultiCellConfig>,
}
impl ValueTableLayoutFlow {
/// Constructs a new instance of the type.
#[inline]
pub fn new(wrap_width: i32) -> Self {
Self::builder().wrap_width(wrap_width).build()
}
/// The cells to display, in render order.
#[inline]
pub fn cells(&self) -> &[super::ValueTableFlowCell] {
&*self.cells
}
/// The number of cells per wrap line, and therefore the flow's column count.
/// Never infer that count from `columnConfigs`, which is sparse: `[]` means
/// `wrapWidth` columns none of which are configured, not zero columns.
#[inline]
pub fn wrap_width(&self) -> i32 {
self.wrap_width
}
/// Column-level configurations, sparse over the `wrapWidth` columns: a column
/// with no header and no cell config has no entry. `position` is authoritative
/// rather than the array index, and must be less than `wrapWidth`. The
/// count-plus-configs pairing mirrors `ValueTableLayoutGrid`'s `columnCount`,
/// though that arm's list is written densely.
#[inline]
pub fn column_configs(&self) -> &[super::ValueTableGridRowColumnConfig] {
&*self.column_configs
}
/// Per-group cell configuration, keyed by `ValueTableFlowCell.groupId`. A
/// group with no entry falls back to `gridDefaultCellConfigs`; entries with
/// no matching cell are tolerated.
#[inline]
pub fn groups(
&self,
) -> &std::collections::BTreeMap<String, super::ValueTableMultiCellConfig> {
&self.groups
}
}