Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
fix: support float number
appflowybd0907b0a4b0
diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option.rsindex 03b4b194b0..f403a28272 100644--- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option.rs+++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option.rs@@ -85,7 +85,17 @@ impl CellDataOperation for NumberTypeOption {let cell_data = type_option_cell_data.data;match self.format {- NumberFormat::Number => cell_data.parse::<i64>().map_or(String::new(), |v| v.to_string()),+ NumberFormat::Number => {+ if let Ok(v) = cell_data.parse::<f64>() {+ return v.to_string();+ }++ if let Ok(v) = cell_data.parse::<i64>() {+ return v.to_string();+ }++ return String::new();+ }NumberFormat::Percent => cell_data.parse::<f64>().map_or(String::new(), |v| v.to_string()),_ => self.money_from_str(&cell_data),}@@ -100,7 +110,8 @@ impl CellDataOperation for NumberTypeOption {_cell_meta: Option<CellMeta>,) -> Result<String, FlowyError> {let changeset = changeset.into();- let data = self.strip_symbol(changeset);+ let data = changeset.to_string();+ let data = self.strip_symbol(data.trim());if !data.chars().all(char::is_numeric) {return Err(FlowyError::invalid_data().context("Should only contain numbers"));