Class ActionItemsBuilder<TBuilder, TSet, TConfig>
- Namespace
- Htmx.Components.Models.Builders
- Assembly
- Htmx.Components.dll
Abstract base class for builders that create action item collections. Provides common functionality for building sets of actions (buttons, links, etc.) with fluent configuration.
public abstract class ActionItemsBuilder<TBuilder, TSet, TConfig> : BuilderBase<TBuilder, TSet> where TBuilder : ActionItemsBuilder<TBuilder, TSet, TConfig> where TSet : class, IActionSet, new() where TConfig : ActionSetConfig, new()
Type Parameters
TBuilder
The concrete builder type for fluent chaining
TSet
The type of action set being built
TConfig
The configuration type used to store build settings
- Inheritance
-
BuilderBase<TBuilder, TSet>ActionItemsBuilder<TBuilder, TSet, TConfig>
- Derived
- Inherited Members
- Extension Methods
Constructors
ActionItemsBuilder(IServiceProvider)
Initializes a new instance of the ActionItemsBuilder with the specified service provider.
protected ActionItemsBuilder(IServiceProvider serviceProvider)
Parameters
serviceProvider
IServiceProviderThe service provider for dependency injection
Fields
_config
The configuration object that stores settings for building the action set. Contains all the accumulated configuration from builder method calls.
protected readonly TConfig _config
Field Value
- TConfig
Methods
AddAction(Action<ActionModelBuilder>)
Adds a new action to the collection using a fluent configuration delegate. This allows for detailed customization of individual action items.
public TBuilder AddAction(Action<ActionModelBuilder> configure)
Parameters
configure
Action<ActionModelBuilder>A delegate that configures the action using an ActionModelBuilder
Returns
- TBuilder
The current builder instance for method chaining
AddItem(IActionItem)
Adds a pre-configured action item directly to the collection. This method is useful when you have an existing IActionItem instance to add.
public TBuilder AddItem(IActionItem item)
Parameters
item
IActionItemThe action item to add to the collection
Returns
- TBuilder
The current builder instance for method chaining
AddRange(IEnumerable<IActionItem>)
Adds multiple pre-configured action items to the collection. This method allows for bulk addition of action items from another source.
public TBuilder AddRange(IEnumerable<IActionItem> items)
Parameters
items
IEnumerable<IActionItem>The collection of action items to add
Returns
- TBuilder
The current builder instance for method chaining