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
chore: add documentation
appflowya0d0a130308e
diff --git a/frontend/rust-lib/flowy-grid/src/services/cell/cell_operation.rs b/frontend/rust-lib/flowy-grid/src/services/cell/cell_operation.rsindex 681e8beffe..cdb80ed8ad 100644--- a/frontend/rust-lib/flowy-grid/src/services/cell/cell_operation.rs+++ b/frontend/rust-lib/flowy-grid/src/services/cell/cell_operation.rs@@ -18,14 +18,29 @@ pub trait CellGroupOperation {/// Return object that describes the cell.pub trait CellDisplayable<CD> {- fn display_data(+ /// Serialize the cell data into `CellBytes` that will be posted to `Dart` side+ ///+ /// Using `utf8` to encode the cell data if the cell data using `String` as its data container.+ /// Using `protobuf` to encode the cell data if the cell data using `Protobuf struct` as its data container.+ ///+ fn displayed_cell_bytes(&self,cell_data: CellData<CD>,decoded_field_type: &FieldType,field_rev: &FieldRevision,) -> FlowyResult<CellBytes>;- fn display_string(+ /// Serialize the cell data into `String` that is readable+ ///+ /// The cell data is not readable which means it can't display the cell data directly to user.+ /// For example,+ /// 1. the cell data is timestamp if its field type is FieldType::Date that is not readable.+ /// it needs to be parsed as the date string.+ ///+ /// 2. the cell data is a commas separated id if its field type if FieldType::MultiSelect that is not readable.+ /// it needs to be parsed as a commas separated option name.+ ///+ fn displayed_cell_string(&self,cell_data: CellData<CD>,decoded_field_type: &FieldType,@@ -126,25 +141,25 @@ pub fn decode_cell_data_to_string(let result = match to_field_type {FieldType::RichText => field_rev.get_type_option::<RichTextTypeOptionPB>(field_type)?- .display_string(cell_data.into(), from_field_type, field_rev),+ .displayed_cell_string(cell_data.into(), from_field_type, field_rev),FieldType::Number => field_rev.get_type_option::<NumberTypeOptionPB>(field_type)?- .display_string(cell_data.into(), from_field_type, field_rev),+ .displayed_cell_string(cell_data.into(), from_field_type, field_rev),FieldType::DateTime => field_rev.get_type_option::<DateTypeOptionPB>(field_type)?- .display_string(cell_data.into(), from_field_type, field_rev),+ .displayed_cell_string(cell_data.into(), from_field_type, field_rev),FieldType::SingleSelect => field_rev.get_type_option::<SingleSelectTypeOptionPB>(field_type)?- .display_string(cell_data.into(), from_field_type, field_rev),+ .displayed_cell_string(cell_data.into(), from_field_type, field_rev),FieldType::MultiSelect => field_rev.get_type_option::<MultiSelectTypeOptionPB>(field_type)?- .display_string(cell_data.into(), from_field_type, field_rev),+ .displayed_cell_string(cell_data.into(), from_field_type, field_rev),FieldType::Checkbox => field_rev.get_type_option::<CheckboxTypeOptionPB>(field_type)?- .display_string(cell_data.into(), from_field_type, field_rev),+ .displayed_cell_string(cell_data.into(), from_field_type, field_rev),FieldType::URL => field_rev.get_type_option::<URLTypeOptionPB>(field_type)?- .display_string(cell_data.into(), from_field_type, field_rev),+ .displayed_cell_string(cell_data.into(), from_field_type, field_rev),};Some(result)};diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option/checkbox_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option/checkbox_type_option.rsindex 9c672bb941..399dffbb3a 100644--- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option/checkbox_type_option.rs+++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/checkbox_type_option/checkbox_type_option.rs@@ -45,7 +45,7 @@ pub struct CheckboxTypeOptionPB {impl_type_option!(CheckboxTypeOptionPB, FieldType::Checkbox);impl CellDisplayable<CheckboxCellData> for CheckboxTypeOptionPB {- fn display_data(+ fn displayed_cell_bytes(&self,cell_data: CellData<CheckboxCellData>,_decoded_field_type: &FieldType,@@ -55,7 +55,7 @@ impl CellDisplayable<CheckboxCellData> for CheckboxTypeOptionPB {Ok(CellBytes::new(cell_data))}- fn display_string(+ fn displayed_cell_string(&self,cell_data: CellData<CheckboxCellData>,_decoded_field_type: &FieldType,@@ -77,7 +77,7 @@ impl CellDataOperation<CheckboxCellData, String> for CheckboxTypeOptionPB {return Ok(CellBytes::default());}- self.display_data(cell_data, decoded_field_type, field_rev)+ self.displayed_cell_bytes(cell_data, decoded_field_type, field_rev)}fn apply_changeset(diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option/date_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option/date_type_option.rsindex 379e125345..6a468b92f9 100644--- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option/date_type_option.rs+++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/date_type_option/date_type_option.rs@@ -119,7 +119,7 @@ impl DateTypeOptionPB {}impl CellDisplayable<DateTimestamp> for DateTypeOptionPB {- fn display_data(+ fn displayed_cell_bytes(&self,cell_data: CellData<DateTimestamp>,_decoded_field_type: &FieldType,@@ -130,7 +130,7 @@ impl CellDisplayable<DateTimestamp> for DateTypeOptionPB {CellBytes::from(date_cell_data)}- fn display_string(+ fn displayed_cell_string(&self,cell_data: CellData<DateTimestamp>,_decoded_field_type: &FieldType,@@ -156,7 +156,7 @@ impl CellDataOperation<DateTimestamp, DateCellChangesetPB> for DateTypeOptionPBif !decoded_field_type.is_date() {return Ok(CellBytes::default());}- self.display_data(cell_data, decoded_field_type, field_rev)+ self.displayed_cell_bytes(cell_data, decoded_field_type, field_rev)}fn apply_changeset(diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option/number_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option/number_type_option.rsindex f8d6c96828..68cb6a1f2e 100644--- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option/number_type_option.rs+++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/number_type_option/number_type_option.rs@@ -108,7 +108,7 @@ pub(crate) fn strip_currency_symbol<T: ToString>(s: T) -> String {}impl CellDisplayable<String> for NumberTypeOptionPB {- fn display_data(+ fn displayed_cell_bytes(&self,cell_data: CellData<String>,_decoded_field_type: &FieldType,@@ -121,7 +121,7 @@ impl CellDisplayable<String> for NumberTypeOptionPB {}}- fn display_string(+ fn displayed_cell_string(&self,cell_data: CellData<String>,_decoded_field_type: &FieldType,@@ -143,7 +143,7 @@ impl CellDataOperation<String, String> for NumberTypeOptionPB {return Ok(CellBytes::default());}- self.display_data(cell_data, decoded_field_type, field_rev)+ self.displayed_cell_bytes(cell_data, decoded_field_type, field_rev)}fn apply_changeset(diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option/multi_select_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option/multi_select_type_option.rsindex 21eb2b7a54..d83f00cde7 100644--- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option/multi_select_type_option.rs+++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option/multi_select_type_option.rs@@ -50,7 +50,7 @@ impl CellDataOperation<SelectOptionIds, SelectOptionCellChangeset> for MultiSeledecoded_field_type: &FieldType,field_rev: &FieldRevision,) -> FlowyResult<CellBytes> {- self.display_data(cell_data, decoded_field_type, field_rev)+ self.displayed_cell_bytes(cell_data, decoded_field_type, field_rev)}fn apply_changeset(diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option/select_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option/select_option.rsindex db8156b865..a31dcf882d 100644--- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option/select_option.rs+++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option/select_option.rs@@ -115,7 +115,7 @@ impl<T> CellDisplayable<SelectOptionIds> for TwhereT: SelectOptionOperation,{- fn display_data(+ fn displayed_cell_bytes(&self,cell_data: CellData<SelectOptionIds>,decoded_field_type: &FieldType,@@ -128,7 +128,7 @@ whereCellBytes::from(self.selected_select_option(cell_data))}- fn display_string(+ fn displayed_cell_string(&self,cell_data: CellData<SelectOptionIds>,_decoded_field_type: &FieldType,diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option/single_select_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option/single_select_type_option.rsindex 2d6db7e61c..b56f630f28 100644--- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option/single_select_type_option.rs+++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/selection_type_option/single_select_type_option.rs@@ -52,7 +52,7 @@ impl CellDataOperation<SelectOptionIds, SelectOptionCellChangeset> for SingleSeldecoded_field_type: &FieldType,field_rev: &FieldRevision,) -> FlowyResult<CellBytes> {- self.display_data(cell_data, decoded_field_type, field_rev)+ self.displayed_cell_bytes(cell_data, decoded_field_type, field_rev)}fn apply_changeset(diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option/text_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option/text_type_option.rsindex d7a5b248c3..7614f5af37 100644--- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option/text_type_option.rs+++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/text_type_option/text_type_option.rs@@ -40,7 +40,7 @@ pub struct RichTextTypeOptionPB {impl_type_option!(RichTextTypeOptionPB, FieldType::RichText);impl CellDisplayable<String> for RichTextTypeOptionPB {- fn display_data(+ fn displayed_cell_bytes(&self,cell_data: CellData<String>,_decoded_field_type: &FieldType,@@ -50,7 +50,7 @@ impl CellDisplayable<String> for RichTextTypeOptionPB {Ok(CellBytes::new(cell_str))}- fn display_string(+ fn displayed_cell_string(&self,cell_data: CellData<String>,_decoded_field_type: &FieldType,@@ -77,7 +77,7 @@ impl CellDataOperation<String, String> for RichTextTypeOptionPB {let s = decode_cell_data_to_string(cell_data, decoded_field_type, decoded_field_type, field_rev);Ok(CellBytes::new(s.unwrap_or_else(|_| "".to_owned())))} else {- self.display_data(cell_data, decoded_field_type, field_rev)+ self.displayed_cell_bytes(cell_data, decoded_field_type, field_rev)}}diff --git a/frontend/rust-lib/flowy-grid/src/services/field/type_options/url_type_option/url_type_option.rs b/frontend/rust-lib/flowy-grid/src/services/field/type_options/url_type_option/url_type_option.rsindex c3bacd7480..760c480a05 100644--- a/frontend/rust-lib/flowy-grid/src/services/field/type_options/url_type_option/url_type_option.rs+++ b/frontend/rust-lib/flowy-grid/src/services/field/type_options/url_type_option/url_type_option.rs@@ -39,7 +39,7 @@ pub struct URLTypeOptionPB {impl_type_option!(URLTypeOptionPB, FieldType::URL);impl CellDisplayable<URLCellDataPB> for URLTypeOptionPB {- fn display_data(+ fn displayed_cell_bytes(&self,cell_data: CellData<URLCellDataPB>,_decoded_field_type: &FieldType,@@ -49,7 +49,7 @@ impl CellDisplayable<URLCellDataPB> for URLTypeOptionPB {CellBytes::from(cell_data)}- fn display_string(+ fn displayed_cell_string(&self,cell_data: CellData<URLCellDataPB>,_decoded_field_type: &FieldType,@@ -70,7 +70,7 @@ impl CellDataOperation<URLCellDataPB, String> for URLTypeOptionPB {if !decoded_field_type.is_url() {return Ok(CellBytes::default());}- self.display_data(cell_data, decoded_field_type, field_rev)+ self.displayed_cell_bytes(cell_data, decoded_field_type, field_rev)}fn apply_changeset(