|
@@ -50,41 +50,40 @@ pub fn create(grid_manager: Arc<GridManager>) -> Module {
|
|
pub enum GridEvent {
|
|
pub enum GridEvent {
|
|
/// [GetGrid] event is used to get the [GridPB]
|
|
/// [GetGrid] event is used to get the [GridPB]
|
|
///
|
|
///
|
|
- /// The event handler accepts [GridIdPB] and return [GridPB] if there is no errors.
|
|
|
|
- ///
|
|
|
|
|
|
+ /// The event handler accepts a [GridIdPB] and returns a [GridPB] if there are no errors.
|
|
#[event(input = "GridIdPB", output = "GridPB")]
|
|
#[event(input = "GridIdPB", output = "GridPB")]
|
|
GetGrid = 0,
|
|
GetGrid = 0,
|
|
|
|
|
|
/// [GetGridBlocks] event is used to get the grid's block.
|
|
/// [GetGridBlocks] event is used to get the grid's block.
|
|
///
|
|
///
|
|
- /// The event handler accepts [QueryGridBlocksPayloadPB] and return [RepeatedGridBlockPB]
|
|
|
|
- /// if there is no errors.
|
|
|
|
|
|
+ /// The event handler accepts a [QueryGridBlocksPayloadPB] and returns a [RepeatedGridBlockPB]
|
|
|
|
+ /// if there are no errors.
|
|
#[event(input = "QueryGridBlocksPayloadPB", output = "RepeatedGridBlockPB")]
|
|
#[event(input = "QueryGridBlocksPayloadPB", output = "RepeatedGridBlockPB")]
|
|
GetGridBlocks = 1,
|
|
GetGridBlocks = 1,
|
|
|
|
|
|
- /// [GetGridSetting] event is used to get the grid's setting.
|
|
|
|
|
|
+ /// [GetGridSetting] event is used to get the grid's settings.
|
|
///
|
|
///
|
|
/// The event handler accepts [GridIdPB] and return [GridSettingPB]
|
|
/// The event handler accepts [GridIdPB] and return [GridSettingPB]
|
|
/// if there is no errors.
|
|
/// if there is no errors.
|
|
#[event(input = "GridIdPB", output = "GridSettingPB")]
|
|
#[event(input = "GridIdPB", output = "GridSettingPB")]
|
|
GetGridSetting = 2,
|
|
GetGridSetting = 2,
|
|
|
|
|
|
- /// [UpdateGridSetting] event is used to update the grid's setting.
|
|
|
|
|
|
+ /// [UpdateGridSetting] event is used to update the grid's settings.
|
|
///
|
|
///
|
|
- /// The event handler accepts [GridIdPB] and return errors if failed to modify the grid's setting.
|
|
|
|
|
|
+ /// The event handler accepts [GridIdPB] and return errors if failed to modify the grid's settings.
|
|
#[event(input = "GridIdPB", input = "GridSettingChangesetPayloadPB")]
|
|
#[event(input = "GridIdPB", input = "GridSettingChangesetPayloadPB")]
|
|
UpdateGridSetting = 3,
|
|
UpdateGridSetting = 3,
|
|
|
|
|
|
- /// [GetFields] event is used to get the grid's setting.
|
|
|
|
|
|
+ /// [GetFields] event is used to get the grid's settings.
|
|
///
|
|
///
|
|
- /// The event handler accepts [QueryFieldPayloadPB] and return [RepeatedGridFieldPB]
|
|
|
|
- /// if there is no errors.
|
|
|
|
|
|
+ /// The event handler accepts a [QueryFieldPayloadPB] and returns a [RepeatedGridFieldPB]
|
|
|
|
+ /// if there are no errors.
|
|
#[event(input = "QueryFieldPayloadPB", output = "RepeatedGridFieldPB")]
|
|
#[event(input = "QueryFieldPayloadPB", output = "RepeatedGridFieldPB")]
|
|
GetFields = 10,
|
|
GetFields = 10,
|
|
|
|
|
|
- /// [UpdateField] event is used to update the field attributes.
|
|
|
|
|
|
+ /// [UpdateField] event is used to update a field's attributes.
|
|
///
|
|
///
|
|
- /// The event handler accepts [FieldChangesetPayloadPB] and return errors if failed to modify the
|
|
|
|
|
|
+ /// The event handler accepts a [FieldChangesetPayloadPB] and returns errors if failed to modify the
|
|
/// field.
|
|
/// field.
|
|
#[event(input = "FieldChangesetPayloadPB")]
|
|
#[event(input = "FieldChangesetPayloadPB")]
|
|
UpdateField = 11,
|
|
UpdateField = 11,
|
|
@@ -98,28 +97,28 @@ pub enum GridEvent {
|
|
/// Check out [this](https://appflowy.gitbook.io/docs/essential-documentation/contribute-to-appflowy/architecture/frontend/grid#fieldtype)
|
|
/// Check out [this](https://appflowy.gitbook.io/docs/essential-documentation/contribute-to-appflowy/architecture/frontend/grid#fieldtype)
|
|
/// for more information.
|
|
/// for more information.
|
|
///
|
|
///
|
|
- /// The event handler accepts [UpdateFieldTypeOptionPayloadPB] and return errors if failed to modify the
|
|
|
|
|
|
+ /// The event handler accepts a [UpdateFieldTypeOptionPayloadPB] and returns errors if failed to modify the
|
|
/// field.
|
|
/// field.
|
|
#[event(input = "UpdateFieldTypeOptionPayloadPB")]
|
|
#[event(input = "UpdateFieldTypeOptionPayloadPB")]
|
|
UpdateFieldTypeOption = 12,
|
|
UpdateFieldTypeOption = 12,
|
|
|
|
|
|
- /// [InsertField] event is used to insert a new field. If the field is already exists, the event
|
|
|
|
- /// handler will replace the value with the new field value.
|
|
|
|
|
|
+ /// [InsertField] event is used to insert a new Field. If the Field already exists, the event
|
|
|
|
+ /// handler will replace the value with the new Field value.
|
|
#[event(input = "InsertFieldPayloadPB")]
|
|
#[event(input = "InsertFieldPayloadPB")]
|
|
InsertField = 13,
|
|
InsertField = 13,
|
|
|
|
|
|
- /// [DeleteField] event is used to delete a new field. [DeleteFieldPayloadPB] is the context that
|
|
|
|
|
|
+ /// [DeleteField] event is used to delete a Field. [DeleteFieldPayloadPB] is the context that
|
|
/// is used to delete the field from the Grid.
|
|
/// is used to delete the field from the Grid.
|
|
#[event(input = "DeleteFieldPayloadPB")]
|
|
#[event(input = "DeleteFieldPayloadPB")]
|
|
DeleteField = 14,
|
|
DeleteField = 14,
|
|
|
|
|
|
- /// [SwitchToField] event is used to update the current field's type.
|
|
|
|
|
|
+ /// [SwitchToField] event is used to update the current Field's type.
|
|
/// It will insert a new FieldTypeOptionData if the new FieldType doesn't exist before, otherwise
|
|
/// It will insert a new FieldTypeOptionData if the new FieldType doesn't exist before, otherwise
|
|
/// reuse the existing FieldTypeOptionData. You could check the [GridRevisionPad] for more details.
|
|
/// reuse the existing FieldTypeOptionData. You could check the [GridRevisionPad] for more details.
|
|
#[event(input = "EditFieldPayloadPB", output = "FieldTypeOptionDataPB")]
|
|
#[event(input = "EditFieldPayloadPB", output = "FieldTypeOptionDataPB")]
|
|
SwitchToField = 20,
|
|
SwitchToField = 20,
|
|
|
|
|
|
- /// [DuplicateField] event is used to duplicate the field. The duplicated field data is kind of
|
|
|
|
|
|
+ /// [DuplicateField] event is used to duplicate a Field. The duplicated field data is kind of
|
|
/// deep copy of the target field. The passed in [DuplicateFieldPayloadPB] is the context that is
|
|
/// deep copy of the target field. The passed in [DuplicateFieldPayloadPB] is the context that is
|
|
/// used to duplicate the field.
|
|
/// used to duplicate the field.
|
|
///
|
|
///
|
|
@@ -128,17 +127,17 @@ pub enum GridEvent {
|
|
#[event(input = "DuplicateFieldPayloadPB")]
|
|
#[event(input = "DuplicateFieldPayloadPB")]
|
|
DuplicateField = 21,
|
|
DuplicateField = 21,
|
|
|
|
|
|
- /// [MoveItem] event is used to move the item. For the moment, the item has two types defined in
|
|
|
|
- /// the [MoveItemTypePB].
|
|
|
|
|
|
+ /// [MoveItem] event is used to move an item. For the moment, Item has two types defined in
|
|
|
|
+ /// [MoveItemTypePB].
|
|
#[event(input = "MoveItemPayloadPB")]
|
|
#[event(input = "MoveItemPayloadPB")]
|
|
MoveItem = 22,
|
|
MoveItem = 22,
|
|
|
|
|
|
- /// [GetFieldTypeOption] event is used to get the FieldTypeOption data for the specific field type.
|
|
|
|
|
|
+ /// [GetFieldTypeOption] event is used to get the FieldTypeOption data for a specific field type.
|
|
///
|
|
///
|
|
/// Check out the [FieldTypeOptionDataPB] for more details. If the [FieldTypeOptionData] does exist
|
|
/// Check out the [FieldTypeOptionDataPB] for more details. If the [FieldTypeOptionData] does exist
|
|
/// for the target type, the [TypeOptionBuilder] will create the default data for that type.
|
|
/// for the target type, the [TypeOptionBuilder] will create the default data for that type.
|
|
///
|
|
///
|
|
- /// Return the [FieldTypeOptionDataPB] if there is no errors.
|
|
|
|
|
|
+ /// Return the [FieldTypeOptionDataPB] if there are no errors.
|
|
#[event(input = "GridFieldTypeOptionIdPB", output = "FieldTypeOptionDataPB")]
|
|
#[event(input = "GridFieldTypeOptionIdPB", output = "FieldTypeOptionDataPB")]
|
|
GetFieldTypeOption = 23,
|
|
GetFieldTypeOption = 23,
|
|
|
|
|
|
@@ -146,8 +145,8 @@ pub enum GridEvent {
|
|
#[event(input = "CreateFieldPayloadPB", output = "FieldTypeOptionDataPB")]
|
|
#[event(input = "CreateFieldPayloadPB", output = "FieldTypeOptionDataPB")]
|
|
CreateFieldTypeOption = 24,
|
|
CreateFieldTypeOption = 24,
|
|
|
|
|
|
- /// [NewSelectOption] event is used to create a new select option. Return the [SelectOptionPB] if
|
|
|
|
- /// there is no errors.
|
|
|
|
|
|
+ /// [NewSelectOption] event is used to create a new select option. Returns a [SelectOptionPB] if
|
|
|
|
+ /// there are no errors.
|
|
#[event(input = "CreateSelectOptionPayloadPB", output = "SelectOptionPB")]
|
|
#[event(input = "CreateSelectOptionPayloadPB", output = "SelectOptionPB")]
|
|
NewSelectOption = 30,
|
|
NewSelectOption = 30,
|
|
|
|
|
|
@@ -157,13 +156,12 @@ pub enum GridEvent {
|
|
#[event(input = "GridCellIdPB", output = "SelectOptionCellDataPB")]
|
|
#[event(input = "GridCellIdPB", output = "SelectOptionCellDataPB")]
|
|
GetSelectOptionCellData = 31,
|
|
GetSelectOptionCellData = 31,
|
|
|
|
|
|
- /// [UpdateSelectOption] event is used to update the FieldTypeOptionData that its field_type is
|
|
|
|
|
|
+ /// [UpdateSelectOption] event is used to update a FieldTypeOptionData whose field_type is
|
|
/// FieldType::SingleSelect or FieldType::MultiSelect.
|
|
/// FieldType::SingleSelect or FieldType::MultiSelect.
|
|
///
|
|
///
|
|
/// This event may trigger the GridNotification::DidUpdateCell event.
|
|
/// This event may trigger the GridNotification::DidUpdateCell event.
|
|
- /// For example, the [SelectOptionChangesetPayloadPB] carries a change that update the name of
|
|
|
|
- /// the option.
|
|
|
|
- ///
|
|
|
|
|
|
+ /// For example, GridNotification::DidUpdateCell will be triggered if the [SelectOptionChangesetPayloadPB]
|
|
|
|
+ /// carries a change that updates the name of the option.
|
|
#[event(input = "SelectOptionChangesetPayloadPB")]
|
|
#[event(input = "SelectOptionChangesetPayloadPB")]
|
|
UpdateSelectOption = 32,
|
|
UpdateSelectOption = 32,
|
|
|
|
|
|
@@ -187,23 +185,23 @@ pub enum GridEvent {
|
|
/// [UpdateCell] event is used to update the cell content. The passed in data, [CellChangesetPB],
|
|
/// [UpdateCell] event is used to update the cell content. The passed in data, [CellChangesetPB],
|
|
/// carries the changes that will be applied to the cell content by calling `update_cell` function.
|
|
/// carries the changes that will be applied to the cell content by calling `update_cell` function.
|
|
///
|
|
///
|
|
- /// The 'content' property of the [CellChangesetPB] is String type. It can be used directly if the
|
|
|
|
- /// cell use string data. For example, the TextCell or NumberCell.
|
|
|
|
|
|
+ /// The 'content' property of the [CellChangesetPB] is a String type. It can be used directly if the
|
|
|
|
+ /// cell uses string data. For example, the TextCell or NumberCell.
|
|
///
|
|
///
|
|
/// But,it can be treated as a generic type, because we can use [serde] to deserialize the string
|
|
/// But,it can be treated as a generic type, because we can use [serde] to deserialize the string
|
|
- /// into a specific data type.For the moment, the 'content' will be deserialized to concrete type
|
|
|
|
- /// when the FieldType is SingleSelect, DateTime, and MultiSelect. We will discuss the details
|
|
|
|
- /// in [UpdateSelectOptionCell] and [UpdateDateCell] event.
|
|
|
|
|
|
+ /// into a specific data type. For the moment, the 'content' will be deserialized to a concrete type
|
|
|
|
+ /// when the FieldType is SingleSelect, DateTime, and MultiSelect. Please see
|
|
|
|
+ /// the [UpdateSelectOptionCell] and [UpdateDateCell] events for more details.
|
|
#[event(input = "CellChangesetPB")]
|
|
#[event(input = "CellChangesetPB")]
|
|
UpdateCell = 71,
|
|
UpdateCell = 71,
|
|
|
|
|
|
- /// [UpdateSelectOptionCell] event is used to update the select option cell data. [SelectOptionCellChangesetPayloadPB]
|
|
|
|
|
|
+ /// [UpdateSelectOptionCell] event is used to update a select option cell's data. [SelectOptionCellChangesetPayloadPB]
|
|
/// contains options that will be deleted or inserted. It can be cast to [CellChangesetPB] that
|
|
/// contains options that will be deleted or inserted. It can be cast to [CellChangesetPB] that
|
|
/// will be used by the `update_cell` function.
|
|
/// will be used by the `update_cell` function.
|
|
#[event(input = "SelectOptionCellChangesetPayloadPB")]
|
|
#[event(input = "SelectOptionCellChangesetPayloadPB")]
|
|
UpdateSelectOptionCell = 72,
|
|
UpdateSelectOptionCell = 72,
|
|
|
|
|
|
- /// [UpdateDateCell] event is used to update the date cell data. [DateChangesetPayloadPB]
|
|
|
|
|
|
+ /// [UpdateDateCell] event is used to update a date cell's data. [DateChangesetPayloadPB]
|
|
/// contains the date and the time string. It can be cast to [CellChangesetPB] that
|
|
/// contains the date and the time string. It can be cast to [CellChangesetPB] that
|
|
/// will be used by the `update_cell` function.
|
|
/// will be used by the `update_cell` function.
|
|
#[event(input = "DateChangesetPayloadPB")]
|
|
#[event(input = "DateChangesetPayloadPB")]
|