Giter VIP home page Giter VIP logo

Comments (7)

stsrki avatar stsrki commented on May 31, 2024

@David-Moreira, I need your help with this one. For some reason, when the ModalProvider passes the Size parameter to the ModalContent, which is used by the Fluent provider, it seems to never change after that. I cannot figure out what is wrong.

from blazorise.

David-Moreira avatar David-Moreira commented on May 31, 2024

@David-Moreira, I need your help with this one. For some reason, when the ModalProvider passes the Size parameter to the ModalContent, which is used by the Fluent provider, it seems to never change after that. I cannot figure out what is wrong.

hmm do you have a branch open with the attempt?

from blazorise.

stsrki avatar stsrki commented on May 31, 2024

I just did this in the demo

public async Task ShowStateful()
{
    if ( statefulModalInstance is null )
    {
        statefulModalInstance = await ModalService.Show<Counter>( "My Stateful content", new ModalInstanceOptions()
        {
            Stateful = true,
            RenderMode = ModalRenderMode.LazyLoad,
+            Size = ModalSize.ExtraLarge,
        } );

        return;
    }

    await ModalService.Show( statefulModalInstance );
}

from blazorise.

David-Moreira avatar David-Moreira commented on May 31, 2024

Strange I believe I've seen that work. Is it happening provider specifically?

from blazorise.

stsrki avatar stsrki commented on May 31, 2024

Yes. For the Fluent provider, I had to propagate the Size from ModalContent to the Modal parent component.

from blazorise.

David-Moreira avatar David-Moreira commented on May 31, 2024

It seems like the custom handlers in FluentUI to propagate the Size from ModalContent to the Modal parent component only propagate on an actual change.
Since the ModalProvider renders on demand, the Size parameter will already start defined as Extra Large and will not be detected as a change.

I added the OnInitialized with similar code and it seems to work properly. Can you verify?

protected override void OnInitialized()
    {
        if ( ParentModal is FluentUI2.Components.Modal fluentModal )
        {
//EDIT: Maybe adding a Size != Default on initialization would be okay to avoid running this code on defaults.
            fluentModal.NotifyModalSizeChanged( Size );
            fluentModal.NotifyModalCenteredChanged( Centered );
        }

        base.OnInitialized();
    }

image

from blazorise.

stsrki avatar stsrki commented on May 31, 2024

It still doesn't work as expected. It remembers the last size and shows XL for all opened modal instances If you go to the demo tests/modal-provider, and update

public async Task ShowStateful()
{
    if ( statefulModalInstance is null )
    {
        statefulModalInstance = await ModalService.Show<Counter>( "My Stateful content", new ModalInstanceOptions()
        {
            Stateful = true,
            RenderMode = ModalRenderMode.LazyLoad,
            Size = ModalSize.ExtraLarge,
        } );

        return;
    }

    await ModalService.Show( statefulModalInstance );
}

launch and click on

image

Now click on any other demo and it will still show as XL modal.

from blazorise.

Related Issues (20)

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.