chore: update single select

This commit is contained in:
nathan 2024-06-20 22:19:46 +08:00
parent bda56defaf
commit b4d03c0097
2 changed files with 21 additions and 2 deletions

View File

@ -211,6 +211,12 @@ pub struct SingleSelectTypeOptionPB {
#[pb(index = 2)] #[pb(index = 2)]
pub disable_color: bool, pub disable_color: bool,
#[pb(index = 3)]
ai_fill_enabled: bool,
#[pb(index = 4)]
generated_options: Vec<SelectOptionPB>,
} }
impl From<SingleSelectTypeOption> for SingleSelectTypeOptionPB { impl From<SingleSelectTypeOption> for SingleSelectTypeOptionPB {
@ -222,6 +228,12 @@ impl From<SingleSelectTypeOption> for SingleSelectTypeOptionPB {
.map(|option| option.into()) .map(|option| option.into())
.collect(), .collect(),
disable_color: data.disable_color, disable_color: data.disable_color,
ai_fill_enabled: data.ai_fill_enabled,
generated_options: data
.generated_options
.into_iter()
.map(|option| option.into())
.collect(),
} }
} }
} }
@ -235,6 +247,13 @@ impl From<SingleSelectTypeOptionPB> for SingleSelectTypeOption {
.map(|option| option.into()) .map(|option| option.into())
.collect(), .collect(),
disable_color: data.disable_color, disable_color: data.disable_color,
version: 1,
ai_fill_enabled: data.ai_fill_enabled,
generated_options: data
.generated_options
.into_iter()
.map(|option| option.into())
.collect(),
} }
} }
} }

View File

@ -33,8 +33,8 @@ impl SelectOption {
impl From<AnyMap> for SelectOption { impl From<AnyMap> for SelectOption {
fn from(map: AnyMap) -> Self { fn from(map: AnyMap) -> Self {
SelectOption { SelectOption {
id: map.get_str("id").unwrap_or_default(), id: map.get_str_value("id").unwrap_or_default(),
name: map.get_str("name").unwrap_or_default(), name: map.get_str_value("name").unwrap_or_default(),
color: SelectOptionColor::from(map.get_i64_value("color").unwrap_or(0)), color: SelectOptionColor::from(map.get_i64_value("color").unwrap_or(0)),
} }
} }