@namespace Connected.Components
@inherits UIComponent

<ToolBar @attributes="CustomAttributes" Class="@Classname">
    @if (HorizontalAlignment == HorizontalAlignment.End ||
       (HorizontalAlignment == HorizontalAlignment.Right && !RightToLeft) ||
       (HorizontalAlignment == HorizontalAlignment.Left && RightToLeft) ||
        HorizontalAlignment == HorizontalAlignment.Center)
    {
        <div class="table-pagination-spacer"></div>
    }
    @if (!HideRowsPerPage)
    {
        <div class="@PaginationClassname">
            <div class="table-pagination-caption">
                <div class="table-pagination-information">@RowsPerPageString</div>
            </div>
            <CascadingValue Name="SubscribeToParentForm" Value="false" IsFixed>
                <Select T="string" ValueChanged="SetRowsPerPage" Value="@Table?.RowsPerPage.ToString()" Class="table-pagination-select" DisableUnderLine="true" Dense="true">
                    @foreach (int pageSize in PageSizeOptions)
                    {
                        <SelectItem T="string" Value="@pageSize.ToString()">@pageSize.ToString().ToUpper()</SelectItem>
                    }
                </Select>
            </CascadingValue>
        </div>
    }
    @if (!HidePageNumber)
    {
        <div class="table-pagination-caption">
            <div class="table-page-number-information">@Info</div>
        </div>
    }
    @if (!HidePagination)
    {
        <div class="table-pagination-actions">
            <IconButton Class="flip-x-rtl" Icon="@FirstIcon" Disabled="@BackButtonsDisabled" @onclick="@(() => Table.NavigateTo(Page.First))" aria-label="First page" />
            <IconButton Class="flip-x-rtl" Icon="@BeforeIcon" Disabled="@BackButtonsDisabled" @onclick="@(() => Table.NavigateTo(Page.Previous))" aria-label="Previous page" />
            <IconButton Class="flip-x-rtl" Icon="@NextIcon" Disabled="@ForwardButtonsDisabled" @onclick="@(() => Table.NavigateTo(Page.Next))" aria-label="Next page" />
            <IconButton Class="flip-x-rtl" Icon="@LastIcon" Disabled="@ForwardButtonsDisabled" @onclick="@(() => Table.NavigateTo(Page.Last))" aria-label="Last page" />
        </div>
    }
    @if (HorizontalAlignment == HorizontalAlignment.Start ||
     (HorizontalAlignment == HorizontalAlignment.Left && !RightToLeft) ||
     (HorizontalAlignment == HorizontalAlignment.Right && RightToLeft) ||
      HorizontalAlignment == HorizontalAlignment.Center)
    {
        <div class="table-pagination-spacer"></div>
    }
</ToolBar>

