@namespace Radzen.Blazor
@using Radzen.Blazor.Spreadsheet
@using Radzen.Documents.Spreadsheet
@inherits RadzenSpreadsheetToolBase
<RadzenButton Variant="Variant.Text" ButtonStyle="ButtonStyle.Base" Size="ButtonSize.Small" Click=@OnInsertRowBeforeClick Icon="add_row_above" ButtonType="ButtonType.Button" Disabled=@IsDisabled
    title=@(Spreadsheet?.Localize(nameof(RadzenStrings.Spreadsheet_InsertRowAbove)) ?? "Insert Row Above") />
@code {
    protected override SpreadsheetFeature? Feature => SpreadsheetFeature.Editing;

    private async Task OnInsertRowBeforeClick()
    {
        if (Worksheet is null || Spreadsheet is null)
        {
            return;
        }

        await Spreadsheet.ExecuteAsync(new InsertRowCommand(Worksheet, Worksheet.Selection.Range.Start.Row));
    }
}
