#pragma checksum "C:\Users\an\Downloads\RichTextEditor_Test\Pages\ButtonContextMenu.razor" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "ede53efc88e4f93a837422400838a1ebd3dea447"
// <auto-generated/>
#pragma warning disable 1591
namespace NoTrackedObject_Test.Pages
{
    #line hidden
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading.Tasks;
#nullable restore
#line 1 "C:\Users\an\Downloads\RichTextEditor_Test\_Imports.razor"
using System.Net.Http;

#line default
#line hidden
#nullable disable
#nullable restore
#line 2 "C:\Users\an\Downloads\RichTextEditor_Test\_Imports.razor"
using Microsoft.AspNetCore.Authorization;

#line default
#line hidden
#nullable disable
#nullable restore
#line 3 "C:\Users\an\Downloads\RichTextEditor_Test\_Imports.razor"
using Microsoft.AspNetCore.Components.Authorization;

#line default
#line hidden
#nullable disable
#nullable restore
#line 4 "C:\Users\an\Downloads\RichTextEditor_Test\_Imports.razor"
using Microsoft.AspNetCore.Components.Forms;

#line default
#line hidden
#nullable disable
#nullable restore
#line 5 "C:\Users\an\Downloads\RichTextEditor_Test\_Imports.razor"
using Microsoft.AspNetCore.Components.Routing;

#line default
#line hidden
#nullable disable
#nullable restore
#line 6 "C:\Users\an\Downloads\RichTextEditor_Test\_Imports.razor"
using Microsoft.AspNetCore.Components.Web;

#line default
#line hidden
#nullable disable
#nullable restore
#line 7 "C:\Users\an\Downloads\RichTextEditor_Test\_Imports.razor"
using Microsoft.JSInterop;

#line default
#line hidden
#nullable disable
#nullable restore
#line 8 "C:\Users\an\Downloads\RichTextEditor_Test\_Imports.razor"
using NoTrackedObject_Test;

#line default
#line hidden
#nullable disable
#nullable restore
#line 9 "C:\Users\an\Downloads\RichTextEditor_Test\_Imports.razor"
using NoTrackedObject_Test.Shared;

#line default
#line hidden
#nullable disable
#nullable restore
#line 10 "C:\Users\an\Downloads\RichTextEditor_Test\_Imports.razor"
using Syncfusion.Blazor;

#line default
#line hidden
#nullable disable
#nullable restore
#line 1 "C:\Users\an\Downloads\RichTextEditor_Test\Pages\ButtonContextMenu.razor"
using Syncfusion.Blazor.SplitButtons;

#line default
#line hidden
#nullable disable
#nullable restore
#line 2 "C:\Users\an\Downloads\RichTextEditor_Test\Pages\ButtonContextMenu.razor"
using Microsoft.AspNetCore.Components;

#line default
#line hidden
#nullable disable
#nullable restore
#line 4 "C:\Users\an\Downloads\RichTextEditor_Test\Pages\ButtonContextMenu.razor"
using NoTrackedObject_Test.Data;

#line default
#line hidden
#nullable disable
    public partial class ButtonContextMenu : Microsoft.AspNetCore.Components.ComponentBase, IDisposable
    {
        #pragma warning disable 1998
        protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder)
        {
            __builder.AddMarkupContent(0, @"<style>
    :not(.e-dropdown-popup).rcc-dropdown-btn {
        background-color: white;
        color: #039BE5;
        box-shadow: 0 1px 3px 0 rgba(204, 212, 216, 0.6);
        border: solid 1px #dbe0e2;
        padding: 1px 9px;
    }

    .e-dropdown-popup.rcc-dropdown-items {
        z-index: 1003 !important;
    }
</style>

");
#nullable restore
#line 24 "C:\Users\an\Downloads\RichTextEditor_Test\Pages\ButtonContextMenu.razor"
 if (DropDownMenuItems != null && DropDownMenuItems.Any())
{

#line default
#line hidden
#nullable disable
            __builder.AddContent(1, "    ");
            __builder.OpenComponent<Syncfusion.Blazor.SplitButtons.SfDropDownButton>(2);
            __builder.AddAttribute(3, "Items", Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<System.Collections.Generic.List<Syncfusion.Blazor.SplitButtons.DropDownMenuItem>>(
#nullable restore
#line 26 "C:\Users\an\Downloads\RichTextEditor_Test\Pages\ButtonContextMenu.razor"
                              DropDownMenuItems

#line default
#line hidden
#nullable disable
            ));
            __builder.AddAttribute(4, "Content", Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<System.String>(
#nullable restore
#line 27 "C:\Users\an\Downloads\RichTextEditor_Test\Pages\ButtonContextMenu.razor"
                                CustomContent

#line default
#line hidden
#nullable disable
            ));
            __builder.AddAttribute(5, "CssClass", "rcc-dropdown-items e-caret-hide rcc-dropdown-btn");
            __builder.AddAttribute(6, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => {
                __builder2.AddMarkupContent(7, "\r\n        ");
                __builder2.OpenComponent<Syncfusion.Blazor.SplitButtons.DropDownButtonEvents>(8);
                __builder2.AddAttribute(9, "ItemSelected", Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<Microsoft.AspNetCore.Components.EventCallback<Syncfusion.Blazor.SplitButtons.MenuEventArgs>>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Syncfusion.Blazor.SplitButtons.MenuEventArgs>(this, 
#nullable restore
#line 30 "C:\Users\an\Downloads\RichTextEditor_Test\Pages\ButtonContextMenu.razor"
                                              async (e) => await DropSelect(e)

#line default
#line hidden
#nullable disable
                )));
                __builder2.AddAttribute(10, "Opened", Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<Microsoft.AspNetCore.Components.EventCallback<Syncfusion.Blazor.SplitButtons.OpenCloseMenuEventArgs>>(Microsoft.AspNetCore.Components.EventCallback.Factory.Create<Syncfusion.Blazor.SplitButtons.OpenCloseMenuEventArgs>(this, 
#nullable restore
#line 31 "C:\Users\an\Downloads\RichTextEditor_Test\Pages\ButtonContextMenu.razor"
                                        async () => await OnMenuOpen()

#line default
#line hidden
#nullable disable
                )));
                __builder2.CloseComponent();
                __builder2.AddMarkupContent(11, "\r\n    ");
            }
            ));
            __builder.AddComponentReferenceCapture(12, (__value) => {
#nullable restore
#line 28 "C:\Users\an\Downloads\RichTextEditor_Test\Pages\ButtonContextMenu.razor"
                             dropDownButton = (Syncfusion.Blazor.SplitButtons.SfDropDownButton)__value;

#line default
#line hidden
#nullable disable
            }
            );
            __builder.CloseComponent();
            __builder.AddMarkupContent(13, "\r\n");
#nullable restore
#line 33 "C:\Users\an\Downloads\RichTextEditor_Test\Pages\ButtonContextMenu.razor"
}

#line default
#line hidden
#nullable disable
        }
        #pragma warning restore 1998
#nullable restore
#line 35 "C:\Users\an\Downloads\RichTextEditor_Test\Pages\ButtonContextMenu.razor"
       
    private IEnumerable<MenuItem> items;
    private SfDropDownButton dropDownButton;
    private string itemsSerialized = "";

    [Parameter]
    public string DataUpId { get; set; } = "EmptyDataUp";

    [Parameter]
    public string CustomContent { get; set; } = "...";

    [Parameter]
    public EventCallback<MouseEventArgs> OnClick { get; set; }

    [Parameter]
    public bool Primary { get; set; }

    [Parameter]
    public IEnumerable<MenuItem> Items
    {
        get
        {
            return items;
        }

        set
        {
            items = value;

            ReloadItems();
        }
    }

    [Parameter]
    public RenderFragment ChildContent { get; set; }

    [Parameter]
    public EventCallback<bool> OnOpenContextMenu { get; set; }

    [Parameter]
    public object Context { get; set; }

    private List<DropDownMenuItem> DropDownMenuItems;
    [Inject]
    private NavigationManager Navigation { get; set; }

    protected override void OnInitialized()
    {
        ReloadItems();
    }

    private void ReloadItems()
    {
        if (this.Items != null)
        {
            var newitemsSerialized = Newtonsoft.Json.JsonConvert.SerializeObject(this.Items);
            if (newitemsSerialized == this.itemsSerialized)
            {
                return;
            }
            else
            {
                this.itemsSerialized = newitemsSerialized;

                this.DropDownMenuItems = Items.Where(x => !x.Disabled && !x.Hidden).Select(x => new DropDownMenuItem()
                {
                    Disabled = x.Disabled,
                    Text = x.Text,
                    Separator = x.Separator,
                    Id = x.Id
                }).ToList();
            }
        }
        else
        {
            if (this.itemsSerialized != null)
            {
                this.itemsSerialized = null;
            }
        }
    }

    private async Task OnMenuOpen()
    {
        if (OnOpenContextMenu.HasDelegate)
        {
            await OnOpenContextMenu.InvokeAsync(true);
        }

        ReloadItems();
    }

    private async Task DropSelect(MenuEventArgs args)
    {
        MenuItem rencoreMenuItem = Items.FirstOrDefault(x => x != null && !string.IsNullOrEmpty(x.Id) && x.Id.Equals(args.Item.Id, StringComparison.InvariantCultureIgnoreCase));

        if (rencoreMenuItem != null)
        {
            if (rencoreMenuItem != null && !string.IsNullOrEmpty(rencoreMenuItem.Url))
            {
                Navigation.NavigateTo(rencoreMenuItem.Url);
            }
        }
    }

    public void Dispose()
    {
        try
        {
            if (dropDownButton != null)
            {
                dropDownButton.Dispose();
            }
        }
        catch (ObjectDisposedException ex)
        {
            // ignore
        }
    }

#line default
#line hidden
#nullable disable
        [global::Microsoft.AspNetCore.Components.InjectAttribute] private IJSRuntime JSRuntime { get; set; }
    }
}
#pragma warning restore 1591
