Coder Social home page Coder Social logo

fgilde / mudblazor.extensions Goto Github PK

View Code? Open in Web Editor NEW
226.0 8.0 21.0 354.91 MB

MudBlazor.Extensions from https://www.mudex.org is a small extension for MudBlazor from https://mudblazor.com

Home Page: http://www.mudex.org

License: MIT License

C# 69.39% HTML 9.67% CSS 6.49% JavaScript 7.71% SCSS 6.56% PowerShell 0.15% Shell 0.01%

mudblazor.extensions's Introduction

GitHub Repo stars GitHub GitHub last commit Nuget version Nuget downloads Website Publish Nuget Preview Package and deploy Test App Publish Nuget Release Package Deploy TryMudEx

MudBlazor.Extensions

The MudBlazor.Extensions is a convenient package that extends the capabilities of the MudBlazor component library. This guide will demonstrate the setup process for your project, along with detailed explanations of the components, extensions, and functionalities provided. It's important to note that this package requires a MudBlazor project and the referenced MudBlazor package. For further information and assistance, please visit the official MudBlazor documentation at MudBlazor and MudBlazor/Templates.

Demos

Azure Cloudflare

Try Online

TryMudEx

Alt

Table of Contents

Installation

The installation process is straightforward. All you need to do is add the MudBlazor.Extensions NuGet package to your Blazor project. You can do this using the following code:

<PackageReference Include="MudBlazor.Extensions" Version="*" />

Setting Up MudBlazor.Extensions

Setting up MudBlazor.Extensions involves three steps:

  1. Update the _Imports.razor with the following lines:
@using MudBlazor.Extensions
@using MudBlazor.Extensions.Components
@using MudBlazor.Extensions.Components.ObjectEdit
  1. Register MudBlazor.Extensions in your Startup.cs in the ConfigureServices method.
// use this to add MudServices and the MudBlazor.Extensions
builder.Services.AddMudServicesWithExtensions();

// or this to add only the MudBlazor.Extensions but please ensure that this is added after mud servicdes are added. That means after `AddMudServices`
builder.Services.AddMudExtensions();
  1. (Optional) Define default dialogOptions.
builder.Services.AddMudServicesWithExtensions(c =>
{
    c.WithDefaultDialogOptions(ex =>
    {
        ex.Position = DialogPosition.BottomRight;
    });
});

if your are running on Blazor Server side, you should also use the MudBlazorExtensionMiddleware you can do this in your startup or program.cs by adding the following line on your WebApplication:

    app.UseMudExtensions();

(Optional) if you have problems with automatic loaded styles you can also load the styles manually by adding the following line to your index.html or _Host.cshtml

<link id="mudex-styles" href="_content/MudBlazor.Extensions/mudBlazorExtensions.min.css" rel="stylesheet">

If you have loaded styles manually you should disable the automatic loading of the styles in the AddMudExtensions or AddMudServicesWithExtensions method. You can do this by adding the following line to your Startup.cs in the ConfigureServices method.

builder.Services.AddMudServicesWithExtensions(c => c.WithoutAutomaticCssLoading());

Showcase Videos

Expand videos

Showcase

ComponentInDialog.mp4
DialogAppearance.mp4
MudExCardList.mp4
MudExColorBubble.mp4
MudExColorPicker.mp4
MudExFileDisplay.mp4
MudExGradientText.mp4
MudExObjectEdit.mp4
MudExPopover.mp4
MudExSlideBar.mp4
MudExSplitPanel.mp4
MudExTaskBar.mp4
SimpleDialogs.mp4
MudExThemeEdit.mp4

Components

This section introduces you to the various components provided by the MudBlazor.Extensions.

MudExObjectEdit

The MudExObjectEdit is a robust component that allows for object editing and automatically generates the corresponding UI. This component supports automatic validation for DataAnnotation Validations or fluent registered validations for your model.

To use MudExObjectEdit, you can simply use the MudExObjectEditForm and pass your model to it as shown below:

<MudExObjectEditForm OnValidSubmit="@OnSubmit" Value="@MyModel"></MudExObjectEditForm>

You can also utilize the MudExObjectEditDialog to edit your model in a dialog. The easiest way to do this is by using the extension method EditObject on the IDialogService.

dialogService.EditObject(User, "Dialog Title", dialogOptionsEx);

More

MudExStructuredDataEditor

The MudExStructuredDataEditor is a component that allows object editing and automatically generates the corresponding UI based on structured data like json, xml or yaml. This component supports all the same as MudExObjectEditForm.

To use MudExStructuredDataEditor, you can simply bind your data string shown as bellow:

    <MudExStructuredDataEditor @bind-Data="_dataString"></MudExStructuredDataEditor>

You can also utilize the MudExStructuredDataEditor to edit your data in a dialog. The easiest way to do this is by using the extension method EditStructuredDataString on the IDialogService.

dialogService.EditStructuredDataString(_dataType, _dataString, $"Auto Generated Editor for {_dataType}", ((_,_) => Task.FromResult("")));

You can find a running Sample here

MudExFileDisplay

The MudExFileDisplay component is designed to display file contents, such as a preview before uploading or for referenced files. This component can automatically handle URLs or streams and deliver the best possible display. Additionally, you can implement IMudExFileDisplay in your own component to register a custom file display. This is excacly what MudExFileDisplayZip does, which is used by MudExFileDisplay to display zip files or what MudExFileDisplayMarkdown does to display markdown files.

Example of using MudExFileDisplay:

 <MudExFileDisplay FileName="NameOfYourFile.pdf" ContentType="application/pdf" Url="@Url"></MudExFileDisplay>

SAMPLE

MudExFileDisplayZip

This component can be automatically utilized by MudExFileDisplay, but can also be used manually if necessary. Note: If you're using the ContentStream it should not be closed or disposed.

 <MudExFileDisplayZip AllowDownload="@AllowDownload" RootFolderName="@FileName" ContentStream="@ContentStream" Url="@Url"></MudExFileDisplayZip>

SAMPLE

MudExFileDisplayDialog

A small dialog for the MudExFileDisplay Component. It can be used with static helpers as shown below:

 await MudExFileDisplayDialog.Show(_dialogService, dataUrl, request.FileName, request.ContentType, ex => ex.JsRuntime = _jsRuntime);

It can be used directly with an IBrowserFile:

 IBrowserFile file = File;
 await MudExFileDisplayDialog.Show(_dialogService, file, ex => ex.JsRuntime = _jsRuntime);

Or it can be used manually with the MudBlazor dialogService:

var parameters = new DialogParameters
{
    {nameof(Icon), BrowserFileExtensions.IconForFile(contentType)},
    {nameof(Url), url},
    {nameof(ContentType), contentType}
};
await dialogService.ShowEx<MudExFileDisplayDialog>(title, parameters, optionsEx);

SAMPLE

More

MudExUploadEdit

MudExUploadEdit is a versatile file upload component with a wide range of features such as MIME and extension whitelisting/blacklisting, folder upload, drag and drop, copy and paste, renaming, and integration with Dropbox, Google Drive, and OneDrive.

SAMPLE

More

Extensions

Resizable or Draggable Dialogs

You can make your dialogs resizable or draggable using the following code snippet:

var options = new DialogOptionsEx { Resizeable = true, DragMode = MudDialogDragMode.Simple, CloseButton = true, FullWidth = true };
var dialog = await _dialogService.ShowEx<YourMudDialog>("Your Dialog Title", parameters, options);

Adding a Maximize Button

You can add a maximize button to your dialogs with the following code:

var options = new DialogOptionsEx { MaximizeButton = true, CloseButton = true };
var dialog = await _dialogService.ShowEx<YourMudDialog>("Your Dialog Title", parameters, options);

Adding Custom Buttons

To add custom buttons to your dialog, first define the callback methods as JSInvokable in your component code:

[JSInvokable]
public void AlarmClick()
{
   // OnAlarmButton Click
}

[JSInvokable]
public void ColorLensClick()
{
   // OnColorLensButton Click
}

Next, define your custom buttons:

var buttons = new[]
{
    new MudDialogButton( DotNetObjectReference.Create(this as object), nameof(AlarmClick)) {Icon = Icons.Material.Filled.Alarm},
    new MudDialogButton( DotNetObjectReference.Create(this as object), nameof(ColorLensClick)) {Icon = Icons.Material.Filled.ColorLens},
};

Finally, add your custom buttons to the dialog:

var options = new DialogOptionsEx { MaximizeButton = true, CloseButton = true, Buttons = buttons };
var dialog = await _dialogService.ShowEx<YourMudDialog>("Your Dialog Title", parameters, options);

Your dialog can now look like this:

SAMPLE

Using Animation to Show Dialog

You can use animation to display your dialog. This is done by setting the Animation property of DialogOptionsEx.

var options = new DialogOptionsEx { 
    MaximizeButton = true, 
    CloseButton = true, 
    Buttons = buttons, 
    Position = DialogPosition.CenterRight, 
    Animation = AnimationType.SlideIn, 
    AnimationDuration = TimeSpan.FromMilliseconds(500),
    FullHeight = true
};
var dialog = await _dialogService.ShowEx<YourMudDialog>("Your Dialog Title", parameters, options);

SAMPLE

When you animate a dialog with dialogServiceEx, it's recommended to add the class mud-ex-dialog-initial to your dialog to ensure no visibility before animation.

<MudDialog Class="mud-ex-dialog-initial">

NOTE: All animations can be used on other components as well. Currently, the following animations are supported: SlideIn,FadeIn,Scale,Slide,Fade,Zoom,Roll,JackInTheBox,Hinge,Rotate,Bounce,Back,Jello,Wobble,Tada,Swing,HeadShake,Shake,RubberBand,Pulse,Flip,FlipX,FlipY.

Using Extension Method with an Action<YourDialog>

Instead of using DialogParameters, you can call the extension method with an Action<YourDialog>

await dialogService.ShowEx<SampleDialog>("Simple Dialog", dialog => { dialog.ContentMessage = "Hello"; },options);

More

Conclusion

This README file provides an overview of the MudBlazor.Extensions library, which is designed to simplify and enhance the development process in Blazor using MudBlazor. The library contains a variety of components, extensions, and features that aim to reduce the time and effort required to build intricate UIs. For additional information or help, visit the official MudBlazor website or MudBlazor GitHub repository.

We hope you find this library helpful and encourage you to provide any feedback or contribute to its development.

License

MudBlazor.Extensions is released under the MIT License. See the bundled LICENSE file for details.

Change Log

Latest Changes:

  • 2.0.3 > Update MudBlazor to 7.5.0
  • 2.0.3 > Fix small bugs
  • 2.0.0 > Update MudBlazor to 7.0.0
  • 2.0.0 > Breaking: Rename: Many properties and behavoirs as MudBlazor does. Se migration gide from MudBlazor 6 to 7 here
  • 1.7.89 > Fix bug that uploadable file is not updated in MudExObjectEditDialog
  • 1.7.88 > Dialogs now supporting a can close event to allow canceling the close event see sample
  • 1.7.88 > Add new Components MudExTreeView.
  • 1.7.88 > Update MudBlazor to 6.20.0
  • 1.7.88 > New Component MudExFileDisplayExcel to support preview of Excel files in MudExFileDisplay and MudExUploadEdit .
  • 1.7.88 > MudExUploadEdit now supports recording audio.
  • 1.7.88 > New Component MudExGravatar.
  • 1.7.88 > Dialogs now supporting CustomSize and CustomPostion to allow more flexibility.
  • 1.7.88 > New service IDialogEventService to allow handling of dialog events
  • 1.7.88 > Dialog supports now a CloseAnimation
  • 1.7.88 > New Service ISpeechRecognitionService to allow easy speech to text conversion or audio recording without any UI
  • 1.7.88 > New Component MudExSpeechToTextButton to allow easy speech to text conversion or audio recording
  • 1.7.87 > Small minor BugFixes
  • 1.7.87 > Improve key navigation in MudExSelect and MudExList
  • 1.7.87 > Update MudBlazor to 6.19.1
  • 1.7.86 > Update MudBlazor to 6.18.0

Full change log can be found here

Planned Features

Notice this is just a first preview version. There are some features planned like

  • Dragging with snap behaviour

If you like this package, please star it on GitHub and share it with your friends If not, you can give a star anyway and let me know what I can improve to make it better for you.

Links

GitHub NuGet

mudblazor.extensions's People

Contributors

fgilde avatar jaronmlifsey avatar vavdb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mudblazor.extensions's Issues

[Bug]: MudExFileDisplay won't load file from Stream

Contact Details

No response

What happened?

I have a Blazor Server with a upload folder where files are uploaded.
If i want to display one of these files from stream using the following command:

await DialogService.ShowFileDisplayDialog(stream, uploadedFile.uploaded_file_orig_file_name, mimetype, HandleContentError, ex => ex.JsRuntime = JS);

the display control shows as follows:
image

I checked if the stream is available, which it is.

Unfortunately i cannot use the newest version of MudEx because of a bug in MudBlazor since 6.5.

Expected Behavior

The file should be displayed.

Screenshots

No response

What application type are you referring to?

Other

Custom Application Type

Server

MudBlazor.Extension Version

1.7.61

MudBlazor Version

6.4.1

What browser are you using?

Chrome

Sample Solution

No response

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Bug]: Required and Required Error in MudExSelect

Contact Details

No response

What happened?

Required is not working in MudExSelect, even though Required is set to true and RequiredError is being ignored.

Here is an example image:
image

Expected Behavior

Required is expected to work the same as the MudTextField field, where if the value is not filled in, MudForm validates the fields and does not allow them to be ignored.

I believe the same error occurs with MudExChipSelect as well

Screenshots

No response

Reproduction link

No response

What application type are you referring to?

WebAssembly

Custom Application Type

No response

MudBlazor.Extension Version

1.7.87-prev-2404011353-main

MudBlazor Version

6.19.1

What .net Version are you using?

.Net8

What browser are you using?

Chrome

Sample Solution

<MudGrid>
    <MudItem xs="12">
        <MudForm Model="@_dataFormFinancialOwner" @ref="_form">
            <MudCard Elevation="1">
                <MudCardContent>
                    <MudGrid>
                        <MudItem xs="12" md="4">
                            <MudExSelect T="Company"
                                         SearchBox="true"
                                         SearchBoxAutoFocus="false"
                                         SearchBoxClearable="true"
                                         SearchBoxVariant="MudBlazor.Variant.Text"
                                         SearchBoxAdornment="MudBlazor.Adornment.End"
                                         Label="Selecione a escola."
                                         Variant="Variant.Outlined"
                                         Value="@_dataFormFinancialOwner.Company"
                                         ValueChanged="OnSchoolSelectedValueChangedAsync"
                                         ToStringFunc="@(v => v?.Name)"
                                         Margin="Margin.Dense"
                                         Required="true"
                                         SearchBoxPlaceholder="Digite o nome da escola"
                                         RequiredError="ร‰ necessรกrio selecionar uma escola" />

                        </MudItem>
                    </MudGrid>
                </MudCardContent>
            </MudCard>
        </MudForm>
    </MudItem>
    <MudItem xs="12">
        <MudCard Elevation="1">
            <MudCardContent>
                <MudGrid Style="align-items: center;">
                    <MudButton Variant="Variant.Filled" Color="MudBlazor.Color.Primary" OnClick="@AddAsync">Salvar</MudButton>
                </MudGrid>
            </MudCardContent>
        </MudCard>
    </MudItem>
</MudGrid>

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Issue rendering the Dialog on .Net 8 - ServerRendered

Contact Details

[email protected]

What happened?

I have followed the exact steps as mentioned. https://github.com/fgilde/MudBlazor.Extensions?tab=readme-ov-file#setting-up-mudblazorextensions

In using this on .Net 8 and running this in InteractiveServer render mode.

When I call a dialog,

var dialog = await DialogService.ShowEx("ShowDialog");

I got the following exception,

System.InvalidOperationException: JavaScript interop calls cannot be issued at this time. This is because the component is being statically rendered. When prerendering is enabled, JavaScript interop calls can only be performed during the OnAfterRenderAsync lifecycle method.
   at Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime.BeginInvokeJS(Int64 asyncHandle, String identifier, String argsJson, JSCallResultType resultType, Int64 targetInstanceId)
   at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, CancellationToken cancellationToken, Object[] args)
   at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
   at MudBlazor.Extensions.Helper.JsRuntimeExtensions.IsNamespaceAvailableAsync(IJSRuntime js, String ns)
   at MudBlazor.Extensions.Helper.JsImportHelper.InitializeMudBlazorExtensionsCoreAsync(IJSRuntime runtime, Boolean force)
   at MudBlazor.Extensions.Helper.JsImportHelper.GetInitializedJsRuntime(Object field, IJSRuntime fallback)
   at MudBlazor.Extensions.DialogServiceExt.InjectOptionsAsync(IDialogReference dialogReference, DialogOptionsEx options)
   at MudBlazor.Extensions.DialogServiceExt.InjectOptionsAsync(Task`1 dialogReference, DialogOptionsEx options)
   at MudBlazor.Extensions.DialogServiceExt.ShowAndInject(IDialogService dialogService, Type type, String title, DialogOptionsEx options, DialogParameters parameters)
   at MudBlazor.Extensions.Core.MudExDialogReferenceExtensions.AsMudExDialogReferenceAsync[TComponent](Task`1 dialogReference)

Note: This is working fine in MudBlazor

Expected Behavior

Dialog should be should without app crash,

Screenshots

image

Reproduction link

No response

What application type are you referring to?

ServerRendered

Custom Application Type

No response

MudBlazor.Extension Version

MudBlazor Version

6.11.1

What browser are you using?

Chrome

Sample Solution

MudBlazorExt_Issue.zip

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Bug]: MudExPopover does not appear to properly dispose of JS click event listener when re-rendering the component

Contact Details

[email protected]

What happened?

I have a table where each cell uses a MudExPopover for editing the cell value.
I noticed that if the parameters on the page have changed several times, then the page begins to behave very slowly.

I've tracked this issue down to the MudExPopover and the fact that each time the component re-renders, more and more click event listeners are getting added to the document.

I have enabled 'DisposeEvent' on the component but that doesn't appear to solve the issue, in fact it only serves to cause the following error to appear in the browser log each time the popover component is rendered:
Uncaught (in promise) Error: System.ArgumentException: There is no tracked object with id '7'. Perhaps the DotNetObjectReference instance was already disposed. (Parameter 'dotNetObjectId') at Microsoft.JSInterop.JSRuntime.GetObjectReference(Int64 dotNetObjectId) at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.BeginInvokeDotNet(JSRuntime jsRuntime, DotNetInvocationInfo invocationInfo, String argsJson) at kt.endInvokeDotNetFromJS (blazor.server.js:1:3700) at blazor.server.js:1:72077 at Array.forEach (<anonymous>) at kt._invokeClientMethod (blazor.server.js:1:72063) at kt._processIncomingData (blazor.server.js:1:70105) at connection.onreceive (blazor.server.js:1:64508) at o.onmessage (blazor.server.js:1:48842)

Refreshing the page solves the problem as all of the JS events will be cleared.

Using the command getEventListeners(document); in the browser console shows that the list of 'click' listeners increases with each render of the popover.

Expected Behavior

Disposing of a MudExPopover component should be properly disposing the JS click event.

Screenshots

Screenshot of browser log error
image

Screenshot of usage of MudExPopover in code
image

Screenshot of JS function adding click event listener
image

Reproduction link

https://trymudex.azurewebsites.net/snippet/wkQHvbEwoRUrrWnK

What application type are you referring to?

ServerRendered

Custom Application Type

No response

MudBlazor.Extension Version

1.7.75

MudBlazor Version

6.11.0

What browser are you using?

Edge

Sample Solution

No response

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Bug]: dialog flashes in middle of screen and reappears with animation

Contact Details

No response

What happened?

When using the below code, a dialog window flashes briefly in the middle of the screen, disappears, and reappears with an animation. The delay before it disappears is longer if the @rendermode InteractiveServer directive is removed. If I click the "Edit Test Button" a second time, the dialog appears as expected (without the flashing behavior).

This is an asp 8.0 application (not WASM).

@rendermode InteractiveServer
@page "/"

@using MudBlazor.Extensions.Options;

@using System.ComponentModel.DataAnnotations

@inject IJSRuntime Js
@inject IDialogService dialogService;

<MudButton OnClick="@ShowSampleDialog" Variant="Variant.Filled" Color="Color.Primary">Edit Test Object</MudButton>

@code {

    public class TestObject
    {
        [Required]
        public string Value { get; set; } = "Test";
        [Range(1, 100)]
        public int Number { get; set; }
    }


    private async Task ShowSampleDialog()
    {
        DialogOptionsEx dlgOptions = new()
        {
            MaximizeButton = true,
            CloseButton = true,
            FullHeight = false,
            CloseOnEscapeKey = true,
            MaxWidth = MaxWidth.Medium,
            FullWidth = false,
            DragMode = MudDialogDragMode.Simple,
            Animations = new[] { AnimationType.SlideIn },
            DisableSizeMarginY = true,
            DisablePositionMargin = true,
            // ShowAtCursor = true,
            // CursorPositionOrigin = Origin.TopLeft
        };
        var res = await dialogService.EditObject(new TestObject(), "Auto Generated Editor for TestObject", OnSubmit, dlgOptions, meta => meta.WrapEachInMudItem(i => i.xs = 6));
        if (!res.Cancelled)
            await Js.InvokeVoidAsync("alert", "Save");
    }
    

    private async Task<string> OnSubmit(TestObject value, MudExObjectEditDialog<TestObject> dialog)
    {
        await Task.Delay(2000); // Simulate server save
        if (value.Value == "Test")
            return "'Test' is as Value not allowed or already exists";
        if (value.Value == "Exception")
            throw new Exception("This is a test exception");
        return null;
    }

}

Expected Behavior

I expect the dialog to slide-in from the top and not briefly flash in the center of the screen.

Screenshots

No response

Reproduction link

No response

What application type are you referring to?

ServerRendered

Custom Application Type

No response

MudBlazor.Extension Version

1.7.83

MudBlazor Version

6.15.0

What browser are you using?

Chrome, Firefox, Other

Sample Solution

No response

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Bug]: no value for property MudExConfiguration for MudExFileDisplayZip

Contact Details

No response

What happened?

After updating to 1.7.67 when using the MudExFileDisplayZip I get the following error

System.InvalidOperationException: Cannot provide a value for property 'MudExConfiguration' on type 'MudBlazor.Extensions.Components.MudExFileDisplayZip'. There is no registered service of type 'MudBlazor.Extensions.Options.MudExConfiguration'.

         at Microsoft.AspNetCore.Components.ComponentFactory.<>c__DisplayClass7_0.<CreateInitializer>g__Initialize|1(IServiceProvider serviceProvider, IComponent component)
         at Microsoft.AspNetCore.Components.ComponentFactory.PerformPropertyInjection(IServiceProvider serviceProvider, IComponent instance)
         at Microsoft.AspNetCore.Components.ComponentFactory.InstantiateComponent(IServiceProvider serviceProvider, Type componentType)
         at Microsoft.AspNetCore.Components.RenderTree.Renderer.InstantiateChildComponentOnFrame(RenderTreeFrame& frame, Int32 parentComponentId)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewComponentFrame(DiffContext& diffContext, Int32 frameIndex)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewSubtree(DiffContext& diffContext, Int32 frameIndex)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& diffContext, Int32 newFrameIndex)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.ComputeDiff(Renderer renderer, RenderBatchBuilder batchBuilder, Int32 componentId, ArrayRange`1 oldTree, ArrayRange`1 newTree)
         at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)
         at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()

This was working fine on an older version of the project so I'm not sure what may have changed between then and now. I dont see anything in the release notes or readme about it.

Expected Behavior

Zip content would render in the dialog.

Screenshots

No response

What application type are you referring to?

ServerRendered

Custom Application Type

No response

MudBlazor.Extension Version

1.7.67

MudBlazor Version

6.10.0

What browser are you using?

Chrome, Firefox

Sample Solution

No response

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Bug]: Unable to add spaces in filter bar of MudExSelect

Contact Details

No response

What happened?

It looks like you can't add spaces in the filter bar of the MudExSelect. Pressing spacebar send your cursor to the end of the line and then write a " ".

Expected Behavior

It should add the space where the cursor is, not a the end of the line

Screenshots

image

Reproduction link

mudex.org/mud-ex-select

What application type are you referring to?

WebAssembly

Custom Application Type

No response

MudBlazor.Extension Version

1.7.86

MudBlazor Version

6.18.0

What .net Version are you using?

.Net8

What browser are you using?

Chrome

Sample Solution

No response

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Bug]: Validation fails on any amount of files

Contact Details

[email protected]

What happened?

A form with a MudExUploadEdit with the attribute Required=true will not successfully validate even with files added. Attempting to submit will just mark the field "This field is required."

Expected Behavior

The form successfully will validate with one or more files in the component.

Screenshots

No response

Reproduction link

No response

What application type are you referring to?

ServerRendered

Custom Application Type

No response

MudBlazor.Extension Version

1.7.76

MudBlazor Version

6.11.0

What browser are you using?

Chrome, Edge

Sample Solution

No response

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Support .NET 6 dropped?

Hi,
My app runs on that version and if I follow the instructions in the README my solution will not compile. Have you completely dropped support of .NET 6?

Thanks

MudExObjectEditForm: text (string) RenderWith dropdown (select)

Feature request type

Enhance component

Component name

MudExObjectEditForm

Is your feature request related to a problem?

In my model I have a string value that I want to be populated based on a dropdown select input (where the entries are generated based on context, so I cannot use static strings/enums). I tried to get it working a bit 'hacky' with the "RenderAs" function by passing in the MudSelect component (along with the properties including a RenderFragment of the MudSelectItems as ChildElement etc.) but did not manage to get it working properly.

Describe the solution you'd like

I would like some way to use a dropdown as input component to set a value in the passed model.

Have you seen this feature anywhere else?

No

Describe alternatives you've considered

The only alternative I see is to not use MudExObjectEditForm and build the whole form manually.

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Bug]: Unable to resolve service for type 'System.Net.Http.HttpClient' while attempting to activate 'MudBlazor.Extensions.Services.MudExFileService'

Contact Details

[email protected]

What happened?

After upgrading to 1.7.68, we are now seeing the following exception at application startup. (When we roll back to 1.7.67, we do not see this exception).

System.AggregateException
  HResult=0x80131500
  Message=Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: MudBlazor.Extensions.Services.MudExFileService Lifetime: Transient ImplementationType: MudBlazor.Extensions.Services.MudExFileService': Unable to resolve service for type 'System.Net.Http.HttpClient' while attempting to activate 'MudBlazor.Extensions.Services.MudExFileService'.) (Error while validating the service descriptor 'ServiceType: MudBlazor.Extensions.Services.MudExFileService Lifetime: Transient ImplementationType: MudBlazor.Extensions.Services.MudExFileService': Unable to resolve service for type 'System.Net.Http.HttpClient' while attempting to activate 'MudBlazor.Extensions.Services.MudExFileService'.)
  Source=Microsoft.Extensions.DependencyInjection
  StackTrace:
   at Microsoft.Extensions.DependencyInjection.ServiceProvider..ctor(ICollection`1 serviceDescriptors, ServiceProviderOptions options)
   at Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(IServiceCollection services, ServiceProviderOptions options)
   at Microsoft.Extensions.Hosting.HostApplicationBuilder.Build()
   at Microsoft.AspNetCore.Builder.WebApplicationBuilder.Build()
   at Program.<Main>$(String[] args) in C:\temp\TestApp3\Program.cs:line 11

  This exception was originally thrown at this call stack:
    [External Code]

Inner Exception 1:
InvalidOperationException: Error while validating the service descriptor 'ServiceType: MudBlazor.Extensions.Services.MudExFileService Lifetime: Transient ImplementationType: MudBlazor.Extensions.Services.MudExFileService': Unable to resolve service for type 'System.Net.Http.HttpClient' while attempting to activate 'MudBlazor.Extensions.Services.MudExFileService'.

Inner Exception 2:
InvalidOperationException: Unable to resolve service for type 'System.Net.Http.HttpClient' while attempting to activate 'MudBlazor.Extensions.Services.MudExFileService'.
using MudBlazor.Extensions;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddHttpContextAccessor();
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();

builder.Services.AddMudExtensions();
builder.Services.AddMudServicesWithExtensions();

var app = builder.Build();
app.UseDeveloperExceptionPage();
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");

app.Run();

Expected Behavior

No exception

Screenshots

Screenshot_2
Screenshot_1

What application type are you referring to?

ServerRendered

Custom Application Type

No response

MudBlazor.Extension Version

1.7.68

MudBlazor Version

6.10.0

What browser are you using?

Chrome

Sample Solution

TestApp.zip

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Bug]: Dialog flickers before actual showing animation

What happened?

Project is a Blazor Server.
When opening a dialog with basic settings from mudex.org, dialog first shows with zoom transition, disappears and then shows again with actual configured animation.

Code looks as follows:

public DialogOptionsEx Options { get; set; } = new()
    {
        MaximizeButton = true,
        CloseButton = true,
        FullHeight = true,
        CloseOnEscapeKey = true,
        MaxWidth = MaxWidth.Medium,
        FullWidth = true,
        DragMode = MudDialogDragMode.Simple,
        Animations = new[] { AnimationType.SlideIn },
        Position = DialogPosition.CenterRight,
        DisableSizeMarginY = true,
        DisablePositionMargin = true
    };

public async Task OpenMudExDialog()
{
    await Task.Delay(1000);
    IDialogReference dlgReference = await DialogService.ShowEx<DlgYesNoPrompt>("Simple Dialog", dialog => { dialog.ContentText = "Hello from dialog sample page"; }, Options);
}

Expected Behavior

Dialog should not be shown using the MudBlazor standard animation before getting shown correctly

Screenshots

No response

What application type are you referring to?

ServerRendered

Custom Application Type

No response

MudBlazor.Extension Version

1.7.68-prev-2309182049-stream-and-blob

MudBlazor Version

6.10.0

What browser are you using?

Chrome

Sample Solution

No response

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Bug]: ReflectionTypeLoadException with Mudblazor 6.17.0

Contact Details

No response

What happened?

After upgrading Mudblazor from 6.16.0 to 6.17.0, I get a ReflectionTypeLoadException when adding MudExtensions with

builder.Services.AddMudServicesWithExtensions(c => c.WithoutAutomaticCssLoading());
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
Method 'Show' on type 'MudBlazor.Extensions.Services.MudExDialogService' from assembly 'MudBlazor.Extensions, Version=1.7.84.0, Culture=neutral, PublicKeyToken=null' tried to implicitly implement an interface method with weaker type parameter constraints.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at Nextended.Core.Extensions.ServiceCollectionExtensions.<>c.<RegisterAllImplementationsOf>b__4_1(Assembly a)
   at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at Nextended.Core.Extensions.ServiceCollectionExtensions.RegisterAllImplementationsOf(IServiceCollection services, Type[] interfacesToSearchImplementationsFor, Assembly[] assembliesToSearchImplementationsIn, ServiceLifetime lifeTime)
   at MudBlazor.Extensions.ServiceCollectionExtensions.AddMudExtensions(IServiceCollection services, Assembly[] serviceImplementationAssemblies)
   at MudBlazor.Extensions.ServiceCollectionExtensions.AddMudExtensions(IServiceCollection services, Action`1 config, Assembly[] serviceImplementationAssemblies)
   at MudBlazor.Extensions.ServiceCollectionExtensions.AddMudServicesWithExtensions(IServiceCollection services, Action`1 config, Assembly[] serviceImplementationAssemblies)
   at Program.<Main>$(String[] args) in /home/david/github/WebAppV3/WebAppV3/Program.cs:line 39
System.TypeLoadException: Method 'Show' on type 'MudBlazor.Extensions.Services.MudExDialogService' from assembly 'MudBlazor.Extensions, Version=1.7.84.0, Culture=neutral, PublicKeyToken=null' tried to implicitly implement an interface method with weaker type parameter constraints.

Expected Behavior

No exception.

Screenshots

No response

Reproduction link

No response

What application type are you referring to?

Please select an application type...

Custom Application Type

No response

MudBlazor.Extension Version

1.7.84

MudBlazor Version

6.17.0

What browser are you using?

Chrome

Sample Solution

No response

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Error when initializing the page on MAUI Blazor

Hello,

I find your project awesome, but i am faced to a problem when i have tried the MudExObjectEditForm

here you are the code

<MudExObjectEditForm OnValidSubmit="@OnSubmit" Value="@MyModel"></MudExObjectEditForm>
@code{
    private Model MyModel { get; set; } = new Model();

    private void OnSubmit()
    {
        
    }

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender)
            await JsRuntime.InitializeMudBlazorExtensionsAsync();
        await base.OnAfterRenderAsync(firstRender);
    }

    public class Model
    {
        public int Id{ get; set; }
        public string Name{ get; set; }
        public DateTime CreadtionDate{ get; set; }
        public bool Activate{ get; set; }
    }
}

I have followed correctly and i have done it several times but i got this error each time i load the page having the form.
I got this error

blazor.webview.js:1 
        
Could not find 'mudElementRef.getBoundingClientRect' ('mudElementRef' was undefined).
Error: Could not find 'mudElementRef.getBoundingClientRect' ('mudElementRef' was undefined).
    at https://0.0.0.0/_framework/blazor.webview.js:1:328
    at Array.forEach (<anonymous>)
    at s.findFunction (https://0.0.0.0/_framework/blazor.webview.js:1:296)
    at S (https://0.0.0.0/_framework/blazor.webview.js:1:2442)
    at https://0.0.0.0/_framework/blazor.webview.js:1:3330
    at new Promise (<anonymous>)
    at beginInvokeJSFromDotNet (https://0.0.0.0/_framework/blazor.webview.js:1:3311)
    at https://0.0.0.0/_framework/blazor.webview.js:1:42799
    at EventTarget.<anonymous> (<anonymous>:7:62)
    at EmbeddedBrowserWebView.<anonymous> (<anonymous>:1:37578)
   at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
   at MudBlazor.MudCollapse.UpdateHeight()
   at MudBlazor.MudCollapse.OnAfterRenderAsync(Boolean firstRender)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

How to reproduce:

  1. create a maui blazor project
  2. add prerequisite like in the readme
  3. add the code above in the index.razor

Hope it helps, thanks for your work :)

Another small layout error

Hi,

Thanks for your corrections (1.7.28 & .29), I have another layout error, a new div appeared and breaks the full-height css property any idea ?

image

MudBlazor : 6.1.7
MudBlazor.Extensions : 1.7.29

[Bug]: Multiple non-modal dialogs closing issue

What happened?

While poping-up multiple non-modal dialog windows and closing them in different order than it was opened causes user to click two times on X icon (or close button) and also new dialog reappears...

Expected Behavior

Closing multiple dialog windows should not be dependent on order of theirs opening and aslo should not cause automatic reopening of a new dialog...

Screenshots

screeen_record.mp4

What application type are you referring to?

ServerRendered

Custom Application Type

No response

MudBlazor.Extension Version

1.7.66

MudBlazor Version

6.9.0

What browser are you using?

Chrome

Sample Solution

No response

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Bug]: DialogService.ShowEx results in Microsoft.JSInterop.JSDisconnectedException after page refresh (as of 1.7.64)

Contact Details

No response

What happened?

Hello, Florian -- Since the 1.7.64 release, we are now seeing a Microsoft.JSInterop.JSDisconnectedException message in the browser console when we call DialogService.ShowEx after a hard page refresh.

var options = new DialogOptionsEx { CloseOnEscapeKey = true, DragMode = MudDialogDragMode.Simple, CloseButton = true };
await DialogService.ShowEx<TestDialog>("Test Dialog", options);

(Admittedly this sounds like a strange scenario. We do these hard page refreshes when we are editing code / hot module reloading.)

Suspect it has something to do with recent changes around InitializeMudBlazorExtensionsAsync()...the call to which we did not remove, even though it is marked as obsolete.

If we do remove the InitializeMudBlazorExtensionsAsync() then it appears we have to pass a JsRuntime reference as part of DialogOptionsEx (which we actually tried, but it still resulted in this exception).

Error: Microsoft.JSInterop.JSDisconnectedException: JavaScript interop calls cannot be issued at this time. This is because the circuit has disconnected and is being disposed.
   at Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime.BeginInvokeJS(Int64 asyncHandle, String identifier, String argsJson, JSCallResultType resultType, Int64 targetInstanceId)
   at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, CancellationToken cancellationToken, Object[] args)
   at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
   at MudBlazor.Extensions.Helper.JsRuntimeExtensions.IsNamespaceAvailableAsync(IJSRuntime js, String ns)
   at MudBlazor.Extensions.Helper.JsImportHelper.InitializeMudBlazorExtensionsCoreAsync(IJSRuntime runtime, Boolean force)
   at MudBlazor.Extensions.Helper.JsImportHelper.GetInitializedJsRuntime(Object field, IJSRuntime fallback)
   at MudBlazor.Extensions.DialogServiceExt.InjectOptionsAsync(IDialogReference dialogReference, DialogOptionsEx options)
   at MudBlazor.Extensions.DialogServiceExt.InjectOptionsAsync(Task`1 dialogReference, DialogOptionsEx options)
   at MudBlazor.Extensions.DialogServiceExt.ShowAndInject(IDialogService dialogService, Type type, String title, DialogOptionsEx options, DialogParameters parameters)
   at MudBlazor.Extensions.Core.MudExDialogReferenceExtensions.AsMudExDialogReferenceAsync[TComponent](Task`1 dialogReference)
   at TestApp.Index.OnOpenTestDialogClick() in C:\temp\TestApp\Index.razor.cs:line 15
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at MudBlazor.MudBaseButton.OnClickHandler(MouseEventArgs ev)
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

We are going to pin to 1.7.63 for the time being.

I will try to create a minimal sample application and upload it here soon.

Thanks for all your work on this project. It is much appreciated.

Expected Behavior

No exception

Screenshots

No response

What browser are you using?

Chrome

Sample Solution

TestApp.zip

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Bug]: FileDisplayZip styles isn't applied until you refresh(?) the component

Contact Details

No response

What happened?

On page load:
image

After opening any file preview and then closing it:
image

And also, can you please add to documetation that ContentStream field on FileDisplay & FileDisplayZip needs NOT closed/disposed stream?

Thanks a lot for this library! I'm really enjoying it

Expected Behavior

Screenshots

No response

What browser are you using?

Chrome

Sample Solution

No response

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Extra space when animating dialog from a position other than center or custom

Hello,

I've been fiddling around with this extension now for a whole day and I'm really liking it so far. I have a product owner who insists on having dialogs fly in from from different sides depending on different scenarios. The dialog needs to fly in from a given side and take up the entire screen until the user closes it.

This extension is almost perfect in meeting that requirement, but there's some extra space that appears on the sides that I can't figure out how to resolve without some JS/CSS hacks. When setting the DialogOptionsEx Position to anything other than custom or center, there's always a 32 pixel space on the top/bottom/left/right depending on what the position is set to. Setting DisableSizeMarginY, DisableSizeMarginX, and DisablePositionMargin aren't having an effect if the animation is moving along that axis.

For example, setting the animation to SlideIn, FullScreen to true, DisableSizeMarginY to true, and Position to BottomCenter leaves a 32 pixel gap at the bottom and pushes the top side of the dialog off screen by the same amount. Alternatively, setting the animation to SlideIn, FullScreen to true, DisableSizeMarginX to true, and Position to CenterRight leaves a 32 pixel gap on the right side pushing content off screen to the left. This happens no matter the animation, and the same gap is present whether fullscreen is true or false. Setting the Position to Center resolves the offsetting issue but then the animations don't move in the desired directions.

I could be missing something, as there's a GIF on the dialog section of the readme that shows a dialog flying out in the way I would expect but with no gap on the side. Here's the function I've been testing with:

private void OpenFullScreenDialog<TDialogType>(string title = "") where TDialogType : ComponentBase
{
        var options = new DialogOptionsEx
        {
            MaximizeButton = true,
            CloseButton = true,
            Position = DialogPosition.CenterRight,
            Animations = new AnimationType[] { AnimationType.SlideIn },
            AnimationDuration = TimeSpan.FromMilliseconds(500),
            FullScreen = true,
            DisableSizeMarginX = true,
        };

        _dialogService.ShowEx<TDialogType>(title, options);
}

Crashes on startup AddMudExtensions()

MudBlazor 6.1.6
MudBlazor.Extensions 1.7.27

Crashes on startup AddMudExtensions()

Unable to load one or more of the requested types.
Method 'get_RenderCompleteTaskCompletionSource' in type 'MudBlazor.Extensions.Core.MudExDialogRef`1' from assembly 'MudBlazor.Extensions, Version=1.7.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
mbextension

Microsoft.JSInterop.JSException: Failed to fetch dynamically imported module: MudBlazor.Extensions/js/components/MoveContent.min.js

Hello,

I have this error on my server :

Error: Microsoft.JSInterop.JSException: Failed to fetch dynamically imported module: http://my-service/_content/MudBlazor.Extensions/js/components/MoveContent.min.js

 at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
   at BlazorJS.BlazorJSExtensions.ImportModuleAsync(IJSRuntime js, String file)
   at BlazorJS.BlazorJSExtensions.ImportModuleAndCreateJsAsync(IJSRuntime js, String file, String jsCreateMethod, Object[] args)
   at MudBlazor.Extensions.Components.Base.MudExJsRequiredBaseComponent`1.ImportModuleAndCreateJsAsync()
   at MudBlazor.Extensions.Components.MoveContent.ImportModuleAndCreateJsAsync()
   at MudBlazor.Extensions.Components.Base.MudExJsRequiredBaseComponent`1.OnAfterRenderAsync(Boolean firstRender)
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

runtime/sdk : .net 7
build chain: -c Release -r linux-x64 --self-contained false

image

Any idea? The MudExFileDisplay.min.js file doesn't seem to be a problem.

[Bug]: Dialogs Stop Working on 2nd client

Contact Details

No response

What happened?

With Blazor server, when I try to use the same dialog across 2 different browser sessions, the dialog on the first browser session fails to load after the second session is used. If I refresh the first session, then that one can use the dialogs and now the second session cant. In 1.7.34 it's throwing the below error, but in 1.7.63 an error is never thrown, but the dialog never loads.

Microsoft.JSInterop.JSException: 'Cannot read properties of null (reading 'querySelector')
TypeError: Cannot read properties of null (reading 'querySelector')
    at new MudBlazorExtensionHelper (https://localhost:7030/_content/MudBlazor.Extensions/MudBlazor.Extensions.lib.module.js:1:4120)
    at Object.setNextDialogOptions (https://localhost:7030/_content/MudBlazor.Extensions/MudBlazor.Extensions.lib.module.js:1:10276)
    at https://localhost:7030/_framework/blazor.server.js:1:3501
    at new Promise (<anonymous>)
    at kt.beginInvokeJSFromDotNet (https://localhost:7030/_framework/blazor.server.js:1:3475)
    at https://localhost:7030/_framework/blazor.server.js:1:72077
    at Array.forEach (<anonymous>)
    at kt._invokeClientMethod (https://localhost:7030/_framework/blazor.server.js:1:72063)
    at kt._processIncomingData (https://localhost:7030/_framework/blazor.server.js:1:70105)
    at connection.onreceive (https://localhost:7030/_framework/blazor.server.js:1:64508)'

Here's the code to spawn the dialog:

<MudButton Class="d-flex align-center justify-center mud-width-full mud-paper mud-elevation-1 pa-4" @onclick="@(() => _dialogService.OpenFullScreenDialog<EnrolleeDialogList>(DialogPosition.BottomCenter, SharedDialogParameters))">

public static async void OpenFullScreenDialog<TDialogType>(
            this IDialogService _dialogService,
            DialogPosition destinationPosition,
            DialogParameters dialogParameters = null,
            Action<DialogResult> callback = null) where TDialogType : ComponentBase
        {
            var options = new DialogOptionsEx
            {
                MaximizeButton = false,
                CloseButton = false,
                //NoHeader = true,
                Resizeable = false,
                Position = destinationPosition,
                Animations = new AnimationType[] { AnimationType.Slide },
                AnimationDuration = TimeSpan.FromMilliseconds(500),
                FullScreen = true,
                FullWidth = true,
                FullHeight = true,
                DisablePositionMargin = true,
                DisableSizeMarginY = true,
                DisableSizeMarginX = true
            };

            if (dialogParameters == null)
            {
                dialogParameters = new DialogParameters();
            }

            var dialog = await _dialogService.ShowEx<TDialogType>(string.Empty, dialogParameters, options);
            if (callback != null)
            {
                callback(await dialog.Result);
            }
        }

Expected Behavior

The dialog should appear no matter how many sessions try to use it

Screenshots

No response

What browser are you using?

Chrome

Sample Solution

No response

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Inline Dialog Support

Is there a way to apply the MudBlazor.Extensions functionality for an Inline MudBlazor Dialog? If not, are there any future plans for adding such support or are the static IDialogService.ShowEx methods the only planned supported technique?

Exception with ShowConfirmationDialogAsync

Got a 'Could not find Microsoft.JSInterop.JSException: Could not find MudBlazorExtensions.setNextDialogOptions (MudBlazorExtenions was undefined)

I had to add this to my _Layout.cshtml

<script src="_content/MudBlazor.Extensions/js/mudBlazorExtensions.js"></script>

To solve it. Strangely I did not run into this locally, only after release.

@inject IJSRuntime jsRuntime 
...
        var res = await DialogService
            .ShowConfirmationDialogAsync("Confirmation",
                $"Are you sure you want to remove?",
                "Remove",
                "No",
                Icons.Material.Filled.Quiz,
                new DialogOptionsEx() { JsRuntime = jsRuntime });

[Bug]: MudExUploadEdit Crashes Dialogs

Contact Details

[email protected]

What happened?

Created a MudDialog containing only a MudExUploadEdit. Upon trying to open said dialog, the screen darkens as if a dialog was opened, but nothing renders. Tried testing with another component (Mud DataGrid) within the dialog, same issue. Removing the MudExUploadEdit and just leaving the DataGrid made the dialog render correctly. The MudExUploadEdit uses the following definition (also included in screenshots):

<MudExUploadEdit MimeTypes="@mimeTypes" TextDropZone="Drop Files Here or Click Upload Files" T="UploadableFile"
                 DropZoneClickAction="DropZoneClickAction.UploadFile" ShowFileUploadButton="false" @ref="component" MinHeight="68"
                 AllowFolderUpload="false" AllowExternalUrl="false" Style="border: grey 3px dashed;" AllowRename="true"
                 ShowProgressForLoadingData="true" ColorizeIcons="true">
</MudExUploadEdit>
//Which has MudExUploadEdit<UploadableFile> component; and a string[] of valid mimeTypes in the code block.

Expected Behavior

The dialog should display the MudExUploadEdit, either alone or with another component within the dialog.

Screenshots

image

Reproduction link

No response

What application type are you referring to?

ServerRendered

Custom Application Type

No response

MudBlazor.Extension Version

1.7.76

MudBlazor Version

6.11.0

What browser are you using?

Chrome

Sample Solution

No response

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Customize edit list

Hi,
how can i customize the edit form for MudExObjectEditForm?

Best regards

Not working

I followed the readme trying to use the dialog extensions but I cannot get it to work.
Should I also add your js and css files in my _Host.cshtml / index.html?

Exception on InitializeMudBlazorExtensionsAsync

blazor.webview.js:1

   Could not find 'BlazorJS.addCss' ('BlazorJS' was undefined).

Error: Could not find 'BlazorJS.addCss' ('BlazorJS' was undefined).
at https://0.0.0.0/_framework/blazor.webview.js:1:328
at Array.forEach ()
at s.findFunction (https://0.0.0.0/_framework/blazor.webview.js:1:296)
at S (https://0.0.0.0/_framework/blazor.webview.js:1:2437)
at https://0.0.0.0/_framework/blazor.webview.js:1:3325
at new Promise ()
at beginInvokeJSFromDotNet (https://0.0.0.0/_framework/blazor.webview.js:1:3306)
at https://0.0.0.0/_framework/blazor.webview.js:1:40711
at EventTarget. (:7:62)
at EmbeddedBrowserWebView. (:1:38156)
at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
at Microsoft.JSInterop.JSRuntimeExtensions.InvokeVoidAsync(IJSRuntime jsRuntime, String identifier, Object[] args)
at BlazorJS.BlazorJSExtensions.AddCss(IJSRuntime runtime, String cssContent)
at MudBlazor.Extensions.Helper.JsImportHelper.InitializeMudBlazorExtensionsAsync(IJSRuntime runtime, Boolean force)
at AerosealUI.Shared.MainLayout.OnAfterRenderAsync(Boolean firstRender)
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState)

Add more descriptive code samples

Feature request type

Other

Component name

No response

Is your feature request related to a problem?

Your code sample use the component properties grid which makes it very easy to try them. That is really great. But it is very hard to understand what to do it something does not work as expected and there is there code setting properties. After all I will not embed you components with the component grid but by setting properties in Razor/C# code.

Describe the solution you'd like

Your code sample use the component properties grid which makes it very easy to try them. That is really great. But it is hard to understand what to do if something does not work as expected and there is code setting properties. After all I will not embed your components with the component grid but by setting properties in Razor/C# code. A nice approach would be to generate sample code for the component using the input to the component properties editor. That would be a KILLER feature!

Note: the component grid should be built-in into Visual Studio. In the god old days that was a key selling point for VB, Delphi and VS.

Have you seen this feature anywhere else?

A nice approach would be to generate sample code for the component using the input to the component properties editor. That would be a KILLER feature!
Else provide manually crafter code samples

Describe alternatives you've considered

A nice approach would be to generate sample code for the component using the input to the component properties editor. That would be a KILLER feature!
Else provide manually crafter code samples

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Callback for when data is available for files in MudExUploadEdit

Feature request type

Enhance component

Component name

MudExUploadEdit

Is your feature request related to a problem?

Before the latest release, UploadRequestsChanged would be called when data for files was available. Now, the files appear immediately with loading symbols, and UploadRequestsChanged is called before the data is available. I like the loading symbols, but there's no way of knowing when the data is available now.

Describe the solution you'd like

Another callback for when files have available data.

Have you seen this feature anywhere else?

Prior versions of this component.

Describe alternatives you've considered

No response

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

ObjectEditMeta ReadOnly prefix in MudTextField

Hi,

Would it be possible to give a string property a readonly prefix?
I try to achieve the following:

I have two properties:

` meta.Property(m => m.Category)
.WithOrder(1)
.WithLabel(_localizer[LK.TranslationsFormCategory])
.RenderWith<CategorySelect, TranslationCategoryDTO>(c => c.Value)
.WrapInMudItem(i => i.xs = 12); ;

meta.Property(m => m.Key)
.WithOrder(2)
.WithLabel(_localizer[LK.TranslationsFormKey])
.WithAdditionalAttributes<MudTextField>(true, t => t.Variant = Variant.Filled);`

I would like to use the category selected as prefix for the key making them a unique combination. The user can only create the key.
So for example

Selected Category is registration.

The key text shows: registration_XXXXXX where the user can only change the XXXXX
Would this somehow be possible?

Thanks in advance

Dennis

[Bug]: MudTextField not clickable

Contact Details

[email protected]

What happened?

When using:

var options = new DialogOptionsEx
        {
            NoHeader = true,
            DragMode = MudDialogDragMode.Simple
        };

I can click everywhere in Dialog and it is draggable.
I cannot click into Textfields anmore.
Dropdown are clickable.

Expected Behavior

Text fields are clickable and I can fill them with text.

Screenshots

No response

Reproduction link

No response

What application type are you referring to?

ServerRendered

Custom Application Type

No response

MudBlazor.Extension Version

1.7.83

MudBlazor Version

6.12.0

What browser are you using?

Chrome

Sample Solution

No response

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Add MudBlazor form validation integration to MudExUploadEdit

Feature request type

Enhance component

Component name

MudExUploadEdit

Is your feature request related to a problem?

MudExUploadEdit does not support custom validation on form submission.

Describe the solution you'd like

Add custom validation to the components. Ideally, they would extend MudFormComponent and so integrate with other MudBlazor form components. For example, I want to add validation such that the user must upload a specific set of 3 files with specific names and form validation should fail if that's not the case when they hit submit.

Have you seen this feature anywhere else?

MudBlazor FileUpload.

Describe alternatives you've considered

I've created a wrapper component to add validation to arbitrary components. This works well enough, but ideally the extension components would act like MudBlazor Form components on its own. Here's the code I used if interested in implementing this request. A real solution would likely have the components inherit from MudFormComponent to integrate with mud forms and call validation whenever the user adds a file (not after the file is fully read from like this workaround).

ValidationWrapper.razor

@typeparam T
@inherits MudFormComponent<T, string>

<MudInputControl Class="@Class" Style="@Style" Error="HasErrors" ErrorText="@GetErrorText()" Required="@Required">
    <InputContent>
        @ChildContent
    </InputContent>
</MudInputControl>

@code {
    /// <summary>
    /// The value of the ValidationWrapper component. This will be passed to the set validation function.
    /// </summary>
    [Parameter]
    [EditorRequired]
    public T? Value
    {
        get => _value;
        set
        {
            if (_value != null && _value.Equals(value))
            {
                return;
            }
            _value = value;
        }
    }
    public ValidationWrapper() : base(new DefaultConverter<T>()) { }

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

And then the usage:

  <ValidationWrapper @ref="FileUploadValidator"
                     T="IReadOnlyList<UploadableFile>"
                     Required="true"
                     Value="@Files"
                     Class="fileUploadContainer"
                     Validation="@FilesValidator">
      <MudExUploadEdit @ref="UploadComponent"
                       T="UploadableFile"
                       Extensions="@(new string[]{".xlsx"})"
                       TextUploadFile="Click here to upload files"
                       TextDropZone="Drag and Drop files here"
                       ColorizeIcons="true"
                       MinHeight="80"
                       AllowFolderUpload="false"
                       AllowExternalUrl="false"
                       Class="MudExUploadExCustom"
                       AllowRename="true"
                       UploadRequests="@Files"
                       UploadRequestsChanged="OnFilesChanged"
                       AllowPreview="false"></MudExUploadEdit>
  </ValidationWrapper>

@code {
    private ValidationWrapper<IReadOnlyList<UploadableFile>> FileUploadValidator = default!;
    private List<UploadableFile> Files = new();
    private Func<IReadOnlyList<UploadableFile>, string?> FilesValidator { get; private set; }
    private Task OnFilesChanged(IList<UploadableFile> files)
    {
        return FileUploadValidator.Validate();
    }
}

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Localize submit and cancel button on dialog

Hi,

Thank you for this great extension.
I have a small issue and I can't figure it out myself. I'm using the MudExObjectEdit in a dialog.

How would I be able to change the text on the cancel and submit button as well as the color of the submit when I use dialogService.EditObject?
I tried already a lot with adding parameters like:

var parameters = new DialogParameters();
        parameters.Add("CancelText", _localizer[LK.Global_DialogCancelText].Value);
        parameters.Add("SubmitText", _localizer[LK.Global_DialogSubmitText].Value);
        parameters.Add("Color", Color.Primary);

But it doesn't seem to find the values I need. Could you help me?

Thanks,
Dennis

[Bug]: Getting Microsoft.JSInterop.JSException: 'Cannot read properties of null (reading 'innerText') when trying to show a dialog

Contact Details

No response

What happened?

I recently updated my project from v1.7.34 to v1.7.63 both are using MudBlazor 6.7.0, but the issue also happens in 6.2.0.

When I go to open any dialog, using the same code as I had before, I am getting the following error:

Microsoft.JSInterop.JSException: 'Cannot read properties of null (reading 'innerText')
TypeError: Cannot read properties of null (reading 'innerText')
    at MudExDialogHandler._updateDialog (https://localhost:7030/_content/MudBlazor.Extensions/MudBlazor.Extensions.lib.module.js:1:9236)
    at new MudExDialogHandlerBase (https://localhost:7030/_content/MudBlazor.Extensions/MudBlazor.Extensions.lib.module.js:1:7904)
    at new MudExDialogHandler (https://localhost:7030/_content/MudBlazor.Extensions/MudBlazor.Extensions.lib.module.js:1:12239)
    at new MudBlazorExtensionHelper (https://localhost:7030/_content/MudBlazor.Extensions/MudBlazor.Extensions.lib.module.js:1:18331)
    at Object.setNextDialogOptions (https://localhost:7030/_content/MudBlazor.Extensions/MudBlazor.Extensions.lib.module.js:1:18924)
    at https://localhost:7030/_framework/blazor.server.js:1:3501
    at new Promise (<anonymous>)
    at kt.beginInvokeJSFromDotNet (https://localhost:7030/_framework/blazor.server.js:1:3475)
    at https://localhost:7030/_framework/blazor.server.js:1:72077
    at Array.forEach (<anonymous>)'

I don't think I'm missing anything that would lead to this error, here is the method I use to show the popup:

public async void OpenFullScreenDialog<TDialogType>(
            DialogPosition destinationPosition,
            DialogParameters dialogParameters = null,
            Action<DialogResult> callback = null) where TDialogType : ComponentBase
    {
        var options = new DialogOptionsEx
            {
                MaximizeButton = false,
                CloseButton = false,
                NoHeader = true,
                Resizeable = false,
                Position = destinationPosition,
                Animations = new AnimationType[] { AnimationType.Slide },
                AnimationDuration = TimeSpan.FromMilliseconds(500),
                FullScreen = true,
                FullWidth = true,
                FullHeight = true,
                DisablePositionMargin = true,
                DisableSizeMarginY = true,
                DisableSizeMarginX = true
            };

        if (dialogParameters == null)
        {
            dialogParameters = new DialogParameters();
        }

        var dialog = await _dialogService.ShowEx<TDialogType>("Test", dialogParameters, options);
        if (callback != null)
        {
            callback(await dialog.Result);
        }
    }

And just in case it's something new on the dialog that I'm missing, here is one of the razor components that it's trying to show:

<MudDialog Class="mud-ex-dialog-initial">
    <DialogContent>
        <MudStack Class="pt-3" Justify="Justify.FlexStart" Row="true">
            <MudItem Class="pl-4">
                <MudIconButton Icon="@Icons.Material.Filled.Close" Variant="Variant.Outlined" Size="Size.Medium" OnClick="Close" />
            </MudItem>
            <MudText Class="pl-4" Typo="Typo.h4">Room Status</MudText>
        </MudStack>
        <MudContainer Style="width:50vw; overflow-y: scroll">
            <MudAlert Severity="Severity.Normal">The reactor type is RBMK-1000</MudAlert>
            <MudAlert Severity="Severity.Info">The reactor was fired up successfully</MudAlert>
            <MudAlert Severity="Severity.Success">The reactor is running at optimum temperature</MudAlert>
            <MudAlert Severity="Severity.Warning">The reactor temperature exceeds the optimal range</MudAlert>
            <MudAlert Severity="Severity.Error">Meltdown is imminent</MudAlert>
        </MudContainer>
    </DialogContent>
</MudDialog>


@code
{
    [CascadingParameter]
    MudDialogInstance MudDialog { get; set; }

    private void Close()
    {
        MudDialog.Close();
    }
}

Expected Behavior

Would have expected the dialog to animate in like it does in v1.7.34

Screenshots

No response

What browser are you using?

Chrome

Sample Solution

No response

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Value cannot be null. (Parameter 'jsRuntime')

On the latest version of VS 2022, I create a project from the MudBlazor template, install MudBlazorExtensions from the Nuget package on it, and call the display method from the ShowEx extension, but I get the error
"Value cannot be null. (Parameter 'jsRuntime')"
Help me learn how to use your extension, maybe I'm not specifying the necessary link to the JS of your extension or somethin
download

[Bug]: MudExUploadEdit totally breaks application.

What happened?

MudBlazor: 6.8.0
Ex: 1.7.64

When I try to upload files (or even select them), server freezes and after some time this happens:
image
image

It happens always besides when I try to upload this one file, but even it breaks everything:
image

It saves same way then:
image

My code:

	<MudExUploadEdit @bind-UploadRequests="files" MimeTypes="@mimeTypes" T="UploadableFile" Style="height: 400px; max-height: 400px; width: 800px" AllowMultiple="true" />
	<MudButton OnClick="@UploadFiles">upload</MudButton>


@code {
	private string[] mimeTypes =
	{
        "image/*"
    };
	IList<UploadableFile> files;
	private async Task UploadFiles()
	{
		string fileStorage = Configuration.GetValue<string>("FileStorage")!;
		foreach (var file in files)
		{
			Directory.CreateDirectory(Path.Combine(fileStorage, "CARD"));
			string newName = Path.GetRandomFileName(); 
			string newFileName = Path.ChangeExtension(newName, Path.GetExtension(file.FileName));
			string path = Path.Combine(fileStorage, "CARD", newFileName);
			await File.WriteAllBytesAsync(path, file.Data);
		}
	}

Edit: I managed to upload one webp file too somehow, but others don't work.

Expected Behavior

To not freeze

What browser are you using?

Chrome

[Bug]: Component JS loading does not respect App Base Path

Contact Details

No response

What happened?

For an application with the app base path configured

When a page with a MudBlazor.Extensions component loads it does not include the path base
Example: https://localhost:44354/_content/MudBlazor.Extensions/js/components/MudExSplitter.min.js

This is a problem for my deployed app as it runs into a CORS error.

I believe the issue is just a missing . prefix to make the path relative

internal static string ComponentJs(string componentName)
=> $"/_content/{Assembly.GetExecutingAssembly().GetName().Name}/js/components/{componentName}{min}.js{Cb()}";

Expected Behavior

component JS url path should include the configured path base

With a path base of /mybase/path/
Expected: https://localhost:44354/mybase/path/_content/MudBlazor.Extensions/js/components/MudExSplitter.min.js

Screenshots

No response

Reproduction link

No response

What application type are you referring to?

WebAssembly

Custom Application Type

No response

MudBlazor.Extension Version

1.7.77

MudBlazor Version

6.11.1

What browser are you using?

Chrome

Sample Solution

No response

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

MudGrid support in resizable MudDialog

Is is possible to add MudGrid support in context of a MudDialog. At present it seems a MudGrid within a MudDialog doesn't react to the dialog being resized.

When trying out the https://mudblazor.com/components/grid#grid-with-breakpoints example and also applying the resize ability (provided by this MudBlazor.Extensions library) the controls always stay in their original locations. Only resizing of the main browser document does the MudGrid on the dialog react and subsequently re-layout its controls.

We haven't decided on whether to use the MudGrid or our own flex based solution but would prefer the former approach. As always we will contribute to this issue should we find a solution ourselves.

[Bug]: MudExChipSelect focus issue

Contact Details

No response

What happened?

We have run into problems being able to consistently be able to get focus into the Filter textbox when using MudExChipSelect.

Your response from another (unrelated) issue:

I will have a look at it. I know MudBlazor have had a bug and it was solved. You can see it here its working https://cae4f752.mudblazor-extensions.pages.dev/chip-select but now it looks like the Bug is back and now here its no more working https://www.mudex.org/chip-select. But I didnt changed anything in MudExChipSelect or dependent logic.
Maybe I need to rebuild the chipselect. However can I then close this issue? For the chip select you can create a new one.

Expected Behavior

Focus is given to the Filter textbox when clicking on it

Screenshots

No response

What browser are you using?

Chrome

Sample Solution

TestApp.zip

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Loading icon for files while uploading

Feature request type

Enhance component

Component name

MudExUploadEdit

Is your feature request related to a problem?

No response

Describe the solution you'd like

When you upload a larger file or upload many files the component "hangs" and there is no update that the files are being added to the component. Users may try to re-upload because of no visual indication. Maybe the file can show up as soon as it is added then instead of the rename/delete icons it has a loading wheel until it is finished?

Have you seen this feature anywhere else?

No response

Describe alternatives you've considered

No response

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Ability to click drop are to upload file

Feature request type

Enhance component

Component name

MudExUploadEdit

Is your feature request related to a problem?

If you have the drag & drop area it makes sense to the user to be able to click on that same area to upload a file. (Click or drop files here)

Describe the solution you'd like

When you click on the drop area it pulls up the file upload just like you clicked on the Upload File button.

Have you seen this feature anywhere else?

JQuery Dropzone

Describe alternatives you've considered

No response

Pull Request

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.