You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Track Tooltips, Popover, Modal, OffCanvas in service.
Modal, Offcanvas backdrop should only show on first open.
Add Dynamic rendering for Tooltips, Popover, Modal, OffCanvas
In each toggle on ShowAsync we need to prerender the component before it continues the show method for animations and remove it after hidden
Example Goal
Modal.cs
publicclassModal{publicConcurrentDictionary<string,dynamicType<object>>Children=new();public BSModal Add<T>(Action<T>params,stringid= Guid.NewGuid.ToString())whereT:class,new(){varresult=new T();Tparameters;
params.Invoke(parameters);
result.Fragment =// Build component match attribute for parameters
if(!Children .TryAdd(id, result,out _){throw("Blah");}
return parameters.ObjectReferance;}publicvoidRemove<T>(Tblah){// Remove}publicvoidRemove<T>(stringname){// Remove}[JSInvokable]publicoverrideasync Task InteropEventCallback(stringid,CallerNamename,EventTypetype,Dictionary<string,string>?classList,JavascriptEvent?e){//loop children see if event is related do actions}}
MainLayout
@Body
<BSDynamics/>
Any other component
privateBSModal_blah;protectedoverrideOnInitialized{_blah= BlazorStrap.Modal.Add<ModalComponent>(params,"optionalStringName");}publicasync Task ShowModalAsync(){await _blah.ShowAsync();// Or
BlazorStrap.Modal.ShowAsync("optionalStringName");}
ModalComponent.razor
<BSModalDataId="modal1" @ref="ObjectReferance"><Header>Modal Title</Header><Content>Woohoo, you're reading this text in a modal!</Content><FooterContext="modal"><BSButtonMarginStart="Margins.Auto" Color="BSColor.Secondary" @onclick="modal.HideAsync">Close</BSButton><BSButtonColor="BSColor.Primary">Save changes</BSButton></Footer></BSModal>
ModalComponent.razor.cs
publicpartialModalComponent: IDynamicInterface<BSModal?>{
public BSModal?ObjectReferance{get;set;}// This is on the interface}
The text was updated successfully, but these errors were encountered:
Example Goal
Modal.cs
MainLayout
Any other component
ModalComponent.razor
ModalComponent.razor.cs
The text was updated successfully, but these errors were encountered: