tree_table/args/
args_checkbox.rs1use crate::SpanKey;
2use crate::Val;
3use crate::statics::default_emit_event_for_api;
4use crate::statics::default_expand_for_api;
5use crate::statics::default_save_selection_for_api;
6use crate::statics::default_undo_for_api;
7use alloc::string::String;
8
9#[cfg_attr(feature = "tsify", derive(tsify::Tsify))]
10#[cfg_attr(feature = "tsify", tsify(from_wasm_abi))]
11#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
12#[derive(Debug, Clone, PartialEq)]
13pub struct CheckboxArgs {
14 pub key: SpanKey,
15 pub del: bool,
16 pub true_val: Option<Val>,
17 pub false_val: Option<Val>,
18 pub text: Option<String>,
19 pub state: bool,
20 #[cfg_attr(feature = "serde", serde(default = "default_emit_event_for_api"))]
21 pub emit: bool,
22 #[cfg_attr(feature = "serde", serde(default = "default_undo_for_api"))]
23 pub undo: bool,
24 #[cfg_attr(feature = "serde", serde(default = "default_save_selection_for_api"))]
25 pub save_selection: bool,
26 #[cfg_attr(feature = "serde", serde(default = "default_expand_for_api"))]
27 pub expand: bool,
28}
29
30impl Default for CheckboxArgs {
31 fn default() -> Self {
32 CheckboxArgs {
33 key: SpanKey::None,
34 del: true,
35 true_val: None,
36 false_val: None,
37 text: None,
38 state: true,
39 emit: default_emit_event_for_api(),
40 undo: default_undo_for_api(),
41 save_selection: default_save_selection_for_api(),
42 expand: default_expand_for_api(),
43 }
44 }
45}
46
47#[cfg_attr(feature = "tsify", derive(tsify::Tsify))]
48#[cfg_attr(feature = "tsify", tsify(from_wasm_abi))]
49#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
50#[derive(Debug, Clone, PartialEq)]
51pub struct SetCheckboxArgs {
52 pub key: SpanKey,
53 pub true_val: Option<Val>,
54 pub false_val: Option<Val>,
55 pub text: Option<Option<String>>,
56 pub state: Option<bool>,
57 #[cfg_attr(feature = "serde", serde(default = "default_emit_event_for_api"))]
58 pub emit: bool,
59 #[cfg_attr(feature = "serde", serde(default = "default_undo_for_api"))]
60 pub undo: bool,
61 #[cfg_attr(feature = "serde", serde(default = "default_save_selection_for_api"))]
62 pub save_selection: bool,
63}
64
65impl Default for SetCheckboxArgs {
66 fn default() -> Self {
67 SetCheckboxArgs {
68 key: SpanKey::None,
69 true_val: None,
70 false_val: None,
71 text: None,
72 state: None,
73 emit: default_emit_event_for_api(),
74 undo: default_undo_for_api(),
75 save_selection: default_save_selection_for_api(),
76 }
77 }
78}