mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: fix typo (#2540)
This commit is contained in:
@ -1,12 +1,15 @@
|
|||||||
use crate::entities::FieldType;
|
use std::str::FromStr;
|
||||||
use crate::services::cell::{CellProtobufBlobParser, DecodedCellData, FromCellString};
|
|
||||||
use crate::services::field::CELL_DATE;
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use collab::core::any_map::AnyMapExtension;
|
use collab::core::any_map::AnyMapExtension;
|
||||||
use collab_database::rows::{new_cell_builder, Cell};
|
use collab_database::rows::{new_cell_builder, Cell};
|
||||||
use flowy_error::{FlowyError, FlowyResult};
|
|
||||||
use protobuf::ProtobufError;
|
use protobuf::ProtobufError;
|
||||||
use std::str::FromStr;
|
|
||||||
|
use flowy_error::{FlowyError, FlowyResult};
|
||||||
|
|
||||||
|
use crate::entities::FieldType;
|
||||||
|
use crate::services::cell::{CellProtobufBlobParser, DecodedCellData, FromCellString};
|
||||||
|
use crate::services::field::CELL_DATA;
|
||||||
|
|
||||||
pub const CHECK: &str = "Yes";
|
pub const CHECK: &str = "Yes";
|
||||||
pub const UNCHECK: &str = "No";
|
pub const UNCHECK: &str = "No";
|
||||||
@ -36,7 +39,7 @@ impl AsRef<[u8]> for CheckboxCellData {
|
|||||||
|
|
||||||
impl From<&Cell> for CheckboxCellData {
|
impl From<&Cell> for CheckboxCellData {
|
||||||
fn from(cell: &Cell) -> Self {
|
fn from(cell: &Cell) -> Self {
|
||||||
let value = cell.get_str_value(CELL_DATE).unwrap_or_default();
|
let value = cell.get_str_value(CELL_DATA).unwrap_or_default();
|
||||||
CheckboxCellData::from_cell_str(&value).unwrap_or_default()
|
CheckboxCellData::from_cell_str(&value).unwrap_or_default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -44,7 +47,7 @@ impl From<&Cell> for CheckboxCellData {
|
|||||||
impl From<CheckboxCellData> for Cell {
|
impl From<CheckboxCellData> for Cell {
|
||||||
fn from(data: CheckboxCellData) -> Self {
|
fn from(data: CheckboxCellData) -> Self {
|
||||||
new_cell_builder(FieldType::Checkbox)
|
new_cell_builder(FieldType::Checkbox)
|
||||||
.insert_str_value(CELL_DATE, data.to_string())
|
.insert_str_value(CELL_DATA, data.to_string())
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ use crate::entities::{DateCellDataPB, FieldType};
|
|||||||
use crate::services::cell::{
|
use crate::services::cell::{
|
||||||
CellProtobufBlobParser, DecodedCellData, FromCellChangeset, FromCellString, ToCellChangeset,
|
CellProtobufBlobParser, DecodedCellData, FromCellChangeset, FromCellString, ToCellChangeset,
|
||||||
};
|
};
|
||||||
use crate::services::field::CELL_DATE;
|
use crate::services::field::CELL_DATA;
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
pub struct DateCellChangeset {
|
pub struct DateCellChangeset {
|
||||||
@ -63,7 +63,7 @@ pub struct DateCellData {
|
|||||||
impl From<&Cell> for DateCellData {
|
impl From<&Cell> for DateCellData {
|
||||||
fn from(cell: &Cell) -> Self {
|
fn from(cell: &Cell) -> Self {
|
||||||
let timestamp = cell
|
let timestamp = cell
|
||||||
.get_str_value(CELL_DATE)
|
.get_str_value(CELL_DATA)
|
||||||
.and_then(|data| data.parse::<i64>().ok());
|
.and_then(|data| data.parse::<i64>().ok());
|
||||||
|
|
||||||
let include_time = cell.get_bool_value("include_time").unwrap_or_default();
|
let include_time = cell.get_bool_value("include_time").unwrap_or_default();
|
||||||
@ -84,7 +84,7 @@ impl From<DateCellData> for Cell {
|
|||||||
None => "".to_owned(),
|
None => "".to_owned(),
|
||||||
};
|
};
|
||||||
new_cell_builder(FieldType::DateTime)
|
new_cell_builder(FieldType::DateTime)
|
||||||
.insert_str_value(CELL_DATE, timestamp_string)
|
.insert_str_value(CELL_DATA, timestamp_string)
|
||||||
.insert_bool_value("include_time", data.include_time)
|
.insert_bool_value("include_time", data.include_time)
|
||||||
.insert_str_value("timezone_id", data.timezone_id)
|
.insert_str_value("timezone_id", data.timezone_id)
|
||||||
.build()
|
.build()
|
||||||
|
@ -1,24 +1,26 @@
|
|||||||
use crate::entities::{FieldType, NumberFilterPB};
|
|
||||||
use crate::services::cell::{CellDataChangeset, CellDataDecoder};
|
|
||||||
use crate::services::field::type_options::number_type_option::format::*;
|
|
||||||
use crate::services::field::{
|
|
||||||
NumberCellFormat, TypeOption, TypeOptionCellData, TypeOptionCellDataCompare,
|
|
||||||
TypeOptionCellDataFilter, TypeOptionTransform, CELL_DATE,
|
|
||||||
};
|
|
||||||
use collab_database::fields::{Field, TypeOptionData, TypeOptionDataBuilder};
|
|
||||||
|
|
||||||
use crate::services::field::type_options::util::ProtobufStr;
|
|
||||||
use collab::core::any_map::AnyMapExtension;
|
|
||||||
use collab_database::rows::{new_cell_builder, Cell};
|
|
||||||
use fancy_regex::Regex;
|
|
||||||
use flowy_error::FlowyResult;
|
|
||||||
use lazy_static::lazy_static;
|
|
||||||
use rust_decimal::Decimal;
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
use collab::core::any_map::AnyMapExtension;
|
||||||
|
use collab_database::fields::{Field, TypeOptionData, TypeOptionDataBuilder};
|
||||||
|
use collab_database::rows::{new_cell_builder, Cell};
|
||||||
|
use fancy_regex::Regex;
|
||||||
|
use lazy_static::lazy_static;
|
||||||
|
use rust_decimal::Decimal;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use flowy_error::FlowyResult;
|
||||||
|
|
||||||
|
use crate::entities::{FieldType, NumberFilterPB};
|
||||||
|
use crate::services::cell::{CellDataChangeset, CellDataDecoder};
|
||||||
|
use crate::services::field::type_options::number_type_option::format::*;
|
||||||
|
use crate::services::field::type_options::util::ProtobufStr;
|
||||||
|
use crate::services::field::{
|
||||||
|
NumberCellFormat, TypeOption, TypeOptionCellData, TypeOptionCellDataCompare,
|
||||||
|
TypeOptionCellDataFilter, TypeOptionTransform, CELL_DATA,
|
||||||
|
};
|
||||||
|
|
||||||
// Number
|
// Number
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
pub struct NumberTypeOption {
|
pub struct NumberTypeOption {
|
||||||
@ -34,14 +36,14 @@ pub struct NumberCellData(pub String);
|
|||||||
|
|
||||||
impl From<&Cell> for NumberCellData {
|
impl From<&Cell> for NumberCellData {
|
||||||
fn from(cell: &Cell) -> Self {
|
fn from(cell: &Cell) -> Self {
|
||||||
Self(cell.get_str_value(CELL_DATE).unwrap_or_default())
|
Self(cell.get_str_value(CELL_DATA).unwrap_or_default())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<NumberCellData> for Cell {
|
impl From<NumberCellData> for Cell {
|
||||||
fn from(data: NumberCellData) -> Self {
|
fn from(data: NumberCellData) -> Self {
|
||||||
new_cell_builder(FieldType::Number)
|
new_cell_builder(FieldType::Number)
|
||||||
.insert_str_value(CELL_DATE, data.0)
|
.insert_str_value(CELL_DATA, data.0)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
use crate::entities::FieldType;
|
|
||||||
use crate::services::cell::{DecodedCellData, FromCellString};
|
|
||||||
use crate::services::field::CELL_DATE;
|
|
||||||
use collab::core::any_map::AnyMapExtension;
|
use collab::core::any_map::AnyMapExtension;
|
||||||
use collab_database::rows::{new_cell_builder, Cell};
|
use collab_database::rows::{new_cell_builder, Cell};
|
||||||
|
|
||||||
use flowy_error::FlowyResult;
|
use flowy_error::FlowyResult;
|
||||||
|
|
||||||
|
use crate::entities::FieldType;
|
||||||
|
use crate::services::cell::{DecodedCellData, FromCellString};
|
||||||
|
use crate::services::field::CELL_DATA;
|
||||||
|
|
||||||
pub const SELECTION_IDS_SEPARATOR: &str = ",";
|
pub const SELECTION_IDS_SEPARATOR: &str = ",";
|
||||||
|
|
||||||
/// List of select option ids
|
/// List of select option ids
|
||||||
@ -25,7 +27,7 @@ impl SelectOptionIds {
|
|||||||
|
|
||||||
pub fn to_cell_data(&self, field_type: FieldType) -> Cell {
|
pub fn to_cell_data(&self, field_type: FieldType) -> Cell {
|
||||||
new_cell_builder(field_type)
|
new_cell_builder(field_type)
|
||||||
.insert_str_value(CELL_DATE, self.to_string())
|
.insert_str_value(CELL_DATA, self.to_string())
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -41,7 +43,7 @@ impl FromCellString for SelectOptionIds {
|
|||||||
|
|
||||||
impl From<&Cell> for SelectOptionIds {
|
impl From<&Cell> for SelectOptionIds {
|
||||||
fn from(cell: &Cell) -> Self {
|
fn from(cell: &Cell) -> Self {
|
||||||
let value = cell.get_str_value(CELL_DATE).unwrap_or_default();
|
let value = cell.get_str_value(CELL_DATA).unwrap_or_default();
|
||||||
Self::from(value)
|
Self::from(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,22 +1,23 @@
|
|||||||
|
use std::cmp::Ordering;
|
||||||
|
|
||||||
|
use bytes::Bytes;
|
||||||
|
use collab::core::any_map::AnyMapExtension;
|
||||||
|
use collab_database::fields::{Field, TypeOptionData, TypeOptionDataBuilder};
|
||||||
|
use collab_database::rows::{new_cell_builder, Cell};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use flowy_error::{FlowyError, FlowyResult};
|
||||||
|
|
||||||
use crate::entities::{FieldType, TextFilterPB};
|
use crate::entities::{FieldType, TextFilterPB};
|
||||||
use crate::services::cell::{
|
use crate::services::cell::{
|
||||||
stringify_cell_data, CellDataChangeset, CellDataDecoder, CellProtobufBlobParser, DecodedCellData,
|
stringify_cell_data, CellDataChangeset, CellDataDecoder, CellProtobufBlobParser, DecodedCellData,
|
||||||
FromCellString,
|
FromCellString,
|
||||||
};
|
};
|
||||||
|
use crate::services::field::type_options::util::ProtobufStr;
|
||||||
use crate::services::field::{
|
use crate::services::field::{
|
||||||
TypeOption, TypeOptionCellData, TypeOptionCellDataCompare, TypeOptionCellDataFilter,
|
TypeOption, TypeOptionCellData, TypeOptionCellDataCompare, TypeOptionCellDataFilter,
|
||||||
TypeOptionTransform, CELL_DATE,
|
TypeOptionTransform, CELL_DATA,
|
||||||
};
|
};
|
||||||
use bytes::Bytes;
|
|
||||||
use collab_database::fields::{Field, TypeOptionData, TypeOptionDataBuilder};
|
|
||||||
|
|
||||||
use crate::services::field::type_options::util::ProtobufStr;
|
|
||||||
use collab::core::any_map::AnyMapExtension;
|
|
||||||
use collab_database::rows::{new_cell_builder, Cell};
|
|
||||||
use flowy_error::{FlowyError, FlowyResult};
|
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use std::cmp::Ordering;
|
|
||||||
|
|
||||||
/// For the moment, the `RichTextTypeOptionPB` is empty. The `data` property is not
|
/// For the moment, the `RichTextTypeOptionPB` is empty. The `data` property is not
|
||||||
/// used yet.
|
/// used yet.
|
||||||
@ -35,7 +36,7 @@ impl TypeOption for RichTextTypeOption {
|
|||||||
|
|
||||||
impl From<TypeOptionData> for RichTextTypeOption {
|
impl From<TypeOptionData> for RichTextTypeOption {
|
||||||
fn from(data: TypeOptionData) -> Self {
|
fn from(data: TypeOptionData) -> Self {
|
||||||
let s = data.get_str_value(CELL_DATE).unwrap_or_default();
|
let s = data.get_str_value(CELL_DATA).unwrap_or_default();
|
||||||
Self { inner: s }
|
Self { inner: s }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,7 +44,7 @@ impl From<TypeOptionData> for RichTextTypeOption {
|
|||||||
impl From<RichTextTypeOption> for TypeOptionData {
|
impl From<RichTextTypeOption> for TypeOptionData {
|
||||||
fn from(data: RichTextTypeOption) -> Self {
|
fn from(data: RichTextTypeOption) -> Self {
|
||||||
TypeOptionDataBuilder::new()
|
TypeOptionDataBuilder::new()
|
||||||
.insert_str_value(CELL_DATE, data.inner)
|
.insert_str_value(CELL_DATA, data.inner)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ use crate::services::field::{
|
|||||||
TypeOptionCellDataCompare, TypeOptionCellDataFilter, TypeOptionTransform, URLTypeOption,
|
TypeOptionCellDataCompare, TypeOptionCellDataFilter, TypeOptionTransform, URLTypeOption,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const CELL_DATE: &str = "data";
|
pub const CELL_DATA: &str = "data";
|
||||||
|
|
||||||
/// A helper trait that used to erase the `Self` of `TypeOption` trait to make it become a Object-safe trait
|
/// A helper trait that used to erase the `Self` of `TypeOption` trait to make it become a Object-safe trait
|
||||||
/// Only object-safe traits can be made into trait objects.
|
/// Only object-safe traits can be made into trait objects.
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
use crate::entities::{FieldType, URLCellDataPB};
|
|
||||||
use crate::services::cell::{CellProtobufBlobParser, DecodedCellData, FromCellString};
|
|
||||||
use crate::services::field::CELL_DATE;
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use collab::core::any_map::AnyMapExtension;
|
use collab::core::any_map::AnyMapExtension;
|
||||||
use collab_database::rows::{new_cell_builder, Cell};
|
use collab_database::rows::{new_cell_builder, Cell};
|
||||||
use flowy_error::{internal_error, FlowyResult};
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
use flowy_error::{internal_error, FlowyResult};
|
||||||
|
|
||||||
|
use crate::entities::{FieldType, URLCellDataPB};
|
||||||
|
use crate::services::cell::{CellProtobufBlobParser, DecodedCellData, FromCellString};
|
||||||
|
use crate::services::field::CELL_DATA;
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
|
||||||
pub struct URLCellData {
|
pub struct URLCellData {
|
||||||
pub url: String,
|
pub url: String,
|
||||||
@ -29,7 +31,7 @@ impl URLCellData {
|
|||||||
impl From<&Cell> for URLCellData {
|
impl From<&Cell> for URLCellData {
|
||||||
fn from(cell: &Cell) -> Self {
|
fn from(cell: &Cell) -> Self {
|
||||||
let url = cell.get_str_value("url").unwrap_or_default();
|
let url = cell.get_str_value("url").unwrap_or_default();
|
||||||
let content = cell.get_str_value(CELL_DATE).unwrap_or_default();
|
let content = cell.get_str_value(CELL_DATA).unwrap_or_default();
|
||||||
Self { url, data: content }
|
Self { url, data: content }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,7 +40,7 @@ impl From<URLCellData> for Cell {
|
|||||||
fn from(data: URLCellData) -> Self {
|
fn from(data: URLCellData) -> Self {
|
||||||
new_cell_builder(FieldType::URL)
|
new_cell_builder(FieldType::URL)
|
||||||
.insert_str_value("url", data.url)
|
.insert_str_value("url", data.url)
|
||||||
.insert_str_value(CELL_DATE, data.data)
|
.insert_str_value(CELL_DATA, data.data)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user