Class ModuleList
Represents a module that handles list data and operations within a section.
Inherited Members
Namespace: DataWeb.Structure.Modules
Assembly: DataWeb.Core.dll
Syntax
public class ModuleList : Module
Remarks
This class includes functionalities for data retrieval, user-defined filters, search, pagination, layout management, and context-based actions. It integrates with various services like item, list, user, and export services for enhanced data processing and user interaction handling.
Constructors
ModuleList(Section, NavigationContext, IServiceProvider)
Represents a module that handles list data and operations within a section.
Declaration
public ModuleList(Section section, NavigationContext navigationContext, IServiceProvider serviceProvider)
Parameters
Type | Name | Description |
---|---|---|
Section | section | |
NavigationContext | navigationContext | |
IServiceProvider | serviceProvider |
Remarks
This class includes functionalities for data retrieval, user-defined filters, search, pagination, layout management, and context-based actions. It integrates with various services like item, list, user, and export services for enhanced data processing and user interaction handling.
Methods
CloneAsync(Item, Item, CancellationToken)
Clones an item asynchronously.
Declaration
public override Task CloneAsync(Item item, Item itemCloned, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Item | item | The item to be cloned. |
Item | itemCloned | The resulting cloned item. |
CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
Overrides
GetActionsAsync(CancellationToken)
Retrieves the list of actions available in the current section, including export actions if enabled.
Declaration
public override Task<List<ContextAction>> GetActionsAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
Type | Description |
---|---|
Task<List<ContextAction>> | A task that represents the asynchronous operation. The task result contains the list of actions. |
Overrides
GetContextItemsAsync(bool, List<string>, CancellationToken)
Retrieves context items for the list view based on filters, user settings, and pagination.
Declaration
public virtual Task<ModuleList.ContextItemResult> GetContextItemsAsync(bool isPagination = false, List<string> itemIdMasters = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
bool | isPagination | Indicates whether to apply pagination. |
List<string> | itemIdMasters | A list of specific item IDs to retrieve. If null, filtered items are retrieved. |
CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
Type | Description |
---|---|
Task<ModuleList.ContextItemResult> | A task that represents the asynchronous operation. The task result contains the context items and pagination info. |
GetDataAsync(IEnumerable<UserSetting>, CancellationToken)
Asynchronously retrieves data for the module list.
Declaration
public virtual Task<ModuleList.ListData> GetDataAsync(IEnumerable<UserSetting> userSettings, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<UserSetting> | userSettings | User settings for filtering and customization. |
CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
Type | Description |
---|---|
Task<ModuleList.ListData> | A task representing the asynchronous operation. The task result contains the list data. |
GetDeferredDataAsync(ItemsParams, IEnumerable<UserSetting>, CancellationToken)
Asynchronously retrieves deferred data for the module list.
Declaration
public virtual Task<IEnumerable<ModuleList.DeferredItem>> GetDeferredDataAsync(ModuleList.ItemsParams itemsParams, IEnumerable<UserSetting> userSettings, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
ModuleList.ItemsParams | itemsParams | Parameters specifying which items to retrieve. |
IEnumerable<UserSetting> | userSettings | User settings for data processing. |
CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
Type | Description |
---|---|
Task<IEnumerable<ModuleList.DeferredItem>> | A task representing the asynchronous operation. The task result contains the deferred items. |
GetSearchSuggestionsAsync(SearchSuggestionFilter, IEnumerable<UserSetting>, CancellationToken)
Asynchronously retrieves search suggestions based on a filter.
Declaration
public virtual Task<IEnumerable<string>> GetSearchSuggestionsAsync(ModuleList.SearchSuggestionFilter suggestionFilter, IEnumerable<UserSetting> userSettings, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
ModuleList.SearchSuggestionFilter | suggestionFilter | The filter to apply for suggestions. |
IEnumerable<UserSetting> | userSettings | User settings for context-specific behavior. |
CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
Type | Description |
---|---|
Task<IEnumerable<string>> | A task representing the asynchronous operation. The task result contains a list of suggestions. |
IsCompletedAsync(Item, Section, CancellationToken)
Checks whether the given item is completed.
Declaration
public override Task<bool> IsCompletedAsync(Item item, Section currentSection, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Item | item | The item to check. |
Section | currentSection | The current section of the item. |
CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
Type | Description |
---|---|
Task<bool> | A task representing the asynchronous operation. The task result indicates whether the item is completed. |
Overrides
ProcessActionAsync(ContextAction, IUser, List<string>, List<ProvidedValue>, NavigationContext, CancellationToken)
Processes a specified action and performs the corresponding operation, such as exporting filtered or selected items.
Declaration
public override Task<ContextAction.Result> ProcessActionAsync(ContextAction action, IUser user, List<string> itemIds = null, List<Form.ProvidedValue> controlValues = null, NavigationContext navigationContext = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
ContextAction | action | The context action to process. |
IUser | user | The user initiating the action. |
List<string> | itemIds | The IDs of the items to be included in the action (optional). |
List<Form.ProvidedValue> | controlValues | Additional control values associated with the action (optional). |
NavigationContext | navigationContext | The navigation context in which the action is performed (optional). |
CancellationToken | cancellationToken | Token to cancel the asynchronous operation. |
Returns
Type | Description |
---|---|
Task<ContextAction.Result> | A task that represents the asynchronous operation. The task result contains the result of the action processing, including any generated files or error details. |
Overrides
Remarks
This method extends the base class behavior to handle specific actions such as exporting filtered or selected items. It generates an Excel file when the action is related to data export and validates the input as needed.
ProcessExportAsync(IEnumerable<ContextItem>, CancellationToken)
Processes a specific action in the context of the list view, such as exporting filtered or selected items.
Declaration
public virtual Task<Stream> ProcessExportAsync(IEnumerable<ContextItem> contextItems, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<ContextItem> | contextItems | |
CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
Type | Description |
---|---|
Task<Stream> | A task that represents the asynchronous operation. The task result contains the result of the action, including any generated file streams. |
ProcessOnExportAsync(IEnumerable<ContextItem>, List<Dictionary<string, object>>, CancellationToken)
Executes additional processing on exported data before finalizing the export operation.
Declaration
public virtual Task ProcessOnExportAsync(IEnumerable<ContextItem> contextItems, List<Dictionary<string, object>> exportItems, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<ContextItem> | contextItems | The collection of context items being exported. |
List<Dictionary<string, object>> | exportItems | The list of exported data in dictionary format. |
CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous operation. |
ProcessOnItemCloneAsync(Item, Item, Navigation, CancellationToken)
Processes the cloning of an item and performs additional logic after the item is cloned.
Declaration
public virtual Task ProcessOnItemCloneAsync(Item item, Item itemSource, Navigation itemNavigation, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Item | item | The item being cloned. |
Item | itemSource | The source item being cloned from. |
Navigation | itemNavigation | The navigation context of the item. |
CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
Type | Description |
---|---|
Task | A task that represents the completion of post-clone processing. |
ProcessOnItemDeleteAsync(Item, Navigation, CancellationToken)
Processes item deletion asynchronously.
Declaration
public virtual Task ProcessOnItemDeleteAsync(Item item, Navigation itemNavigation, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Item | item | The item to delete. |
Navigation | itemNavigation | Navigation context for the item. |
CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
ProcessOnItemMoveAsync(Item, Navigation, CancellationToken)
Processes the movement of an item and performs additional logic after the item is moved.
Declaration
public virtual Task ProcessOnItemMoveAsync(Item item, Navigation itemNavigation, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Item | item | The item being moved. |
Navigation | itemNavigation | The navigation context of the item. |
CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
Type | Description |
---|---|
Task | A task that represents the completion of post-move processing. |
ProcessOnItemSetStatusAsync(Item, ItemStatus, Navigation, CancellationToken)
Processes item status change asynchronously.
Declaration
public virtual Task ProcessOnItemSetStatusAsync(Item item, ItemStatus previousStatus, Navigation itemNavigation, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Item | item | The item to update. |
ItemStatus | previousStatus | The previous status of the item. |
Navigation | itemNavigation | Navigation context for the item. |
CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
SetLayoutAsync(LayoutUpdate, CancellationToken)
Updates the layout mode for the module list.
Declaration
public virtual Task SetLayoutAsync(ModuleList.LayoutUpdate layoutUpdate, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
ModuleList.LayoutUpdate | layoutUpdate | The layout update details. |
CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
SetOrderByAsync(OrderByUpdate, IEnumerable<UserSetting>, CancellationToken)
Updates the order by settings for the module list.
Declaration
public virtual Task SetOrderByAsync(ModuleList.OrderByUpdate orderByUpdate, IEnumerable<UserSetting> userSettings, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
ModuleList.OrderByUpdate | orderByUpdate | The order by update details. |
IEnumerable<UserSetting> | userSettings | User settings for context-specific behavior. |
CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
SetPageIndexAsync(PageIndexUpdate, CancellationToken)
Updates the page index for the module list.
Declaration
public virtual Task SetPageIndexAsync(ModuleList.PageIndexUpdate pageIndexUpdate, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
ModuleList.PageIndexUpdate | pageIndexUpdate | The page index update details. |
CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |
SetSearchAsync(SearchUpdate, CancellationToken)
Updates the search filters for the module list.
Declaration
public virtual Task SetSearchAsync(ModuleList.SearchUpdate searchUpdate, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
ModuleList.SearchUpdate | searchUpdate | The search update details. |
CancellationToken | cancellationToken | Token to cancel the operation. |
Returns
Type | Description |
---|---|
Task | A task representing the asynchronous operation. |