-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Options Editor and ModalDialog in Blazor - Using blazor in PredefinedList
- Loading branch information
Showing
26 changed files
with
669 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<Import Project="..\..\Directory.Build.props" /> | ||
<Import Project="..\OrchardCore.Build\OrchardCore.Commons.props" /> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>$(CommonTargetFrameworks)</TargetFrameworks> | ||
</PropertyGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
|
||
<Import Project="..\OrchardCore.Build\OrchardCore.Commons.targets" /> | ||
|
||
</Project> |
5 changes: 5 additions & 0 deletions
5
src/OrchardCore.Components/OrchardCore.Admin.Components/OrchardAdminApp.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<h3>Future Admin App in Blazor</h3> | ||
|
||
@code { | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
src/OrchardCore.Components/OrchardCore.Admin.Components/OrchardCore.Admin.Components.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Razor"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>$(CommonTargetFrameworks)</TargetFrameworks> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
|
||
<ItemGroup> | ||
<SupportedPlatform Include="browser" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\OrchardCore.Common.Components\OrchardCore.Common.Components.csproj" /> | ||
</ItemGroup> | ||
</Project> |
1 change: 1 addition & 0 deletions
1
src/OrchardCore.Components/OrchardCore.Admin.Components/_Imports.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@using Microsoft.AspNetCore.Components.Web |
5 changes: 5 additions & 0 deletions
5
src/OrchardCore.Components/OrchardCore.Admin.WebAssembly.App/Initializer.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<h3>Initializer</h3> | ||
|
||
@code { | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
...ore.Components/OrchardCore.Admin.WebAssembly.App/OrchardCore.Admin.WebAssembly.App.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>$(CommonTargetFrameworks)</TargetFrameworks> | ||
|
||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile> | ||
<StaticWebAssetProjectMode>Default</StaticWebAssetProjectMode> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.CustomElements" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\OrchardCore.Admin.Components\OrchardCore.Admin.Components.csproj" /> | ||
<ProjectReference Include="..\OrchardCore.Common.Components\OrchardCore.Common.Components.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
12 changes: 12 additions & 0 deletions
12
src/OrchardCore.Components/OrchardCore.Admin.WebAssembly.App/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using Microsoft.AspNetCore.Components.Web; | ||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting; | ||
using OrchardCore.Admin.WebAssembly.App; | ||
using OrchardCore.Common.Components; | ||
|
||
var builder = WebAssemblyHostBuilder.CreateDefault(args); | ||
builder.RootComponents.RegisterCustomElement<OptionEditor>("option-editor"); | ||
builder.RootComponents.RegisterCustomElement<Initializer>("init"); | ||
builder.Services.AddScoped<ExampleJsInterop>(); | ||
|
||
|
||
await builder.Build().RunAsync(); |
9 changes: 9 additions & 0 deletions
9
src/OrchardCore.Components/OrchardCore.Admin.WebAssembly.App/_Imports.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@using System.Net.Http | ||
@using System.Net.Http.Json | ||
@using Microsoft.AspNetCore.Components.Forms | ||
@using Microsoft.AspNetCore.Components.Routing | ||
@using Microsoft.AspNetCore.Components.Web | ||
@using static Microsoft.AspNetCore.Components.Web.RenderMode | ||
@using Microsoft.AspNetCore.Components.Web.Virtualization | ||
@using Microsoft.JSInterop | ||
@using OrchardCore.Admin.WebAssembly.App |
43 changes: 43 additions & 0 deletions
43
src/OrchardCore.Components/OrchardCore.Common.Components/ColloctedJSComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Components; | ||
using Microsoft.JSInterop; | ||
|
||
namespace OrchardCore.Common.Components; | ||
|
||
public class ColloctedJSComponent : ComponentBase, IAsyncDisposable | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
ns8482e
Author
Contributor
|
||
{ | ||
[Inject] | ||
private IJSRuntime? JS { get; set; } | ||
|
||
[Parameter] | ||
public bool RaiseDomEvents { get; set; } | ||
|
||
protected IJSObjectReference? JSModule { get; private set; } | ||
|
||
protected override async Task OnAfterRenderAsync(bool firstRender) | ||
{ | ||
if (firstRender) | ||
{ | ||
var ns = GetType().Namespace; | ||
var cmp = GetType().Name; | ||
if (JS is not null) | ||
{ | ||
JSModule = await JS.InvokeAsync<IJSObjectReference>("import", | ||
$"./_content/{ns}/{cmp}.razor.js"); | ||
} | ||
} | ||
} | ||
|
||
async ValueTask IAsyncDisposable.DisposeAsync() | ||
{ | ||
if (JSModule is not null) | ||
{ | ||
await JSModule.DisposeAsync(); | ||
} | ||
} | ||
|
||
} |
59 changes: 59 additions & 0 deletions
59
src/OrchardCore.Components/OrchardCore.Common.Components/ModalDialog.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<div class="modal fade @IsOpenClass text-start" role="dialog" style="display:@IsOpenDisplayStyle" aria-hidden="true"> | ||
<div class="modal-dialog modal-dialog-centered" role="document"> | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title">@Title</h5> | ||
<button type="button" class="btn-close" aria-label="Close" @onclick="Close"></button> | ||
</div> | ||
<div class="modal-body"> | ||
@Body | ||
</div> | ||
<div class="modal-footer"> | ||
@Actions | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
@if (ShowBackdrop && IsOpen) | ||
{ | ||
<div class="modal-backdrop fade show"></div> | ||
} | ||
|
||
@code { | ||
|
||
[Parameter] | ||
public string? Title { get; set; } | ||
[Parameter] | ||
public bool ShowBackdrop { get; set; } | ||
[Parameter] | ||
public RenderFragment? Body { get; set; } | ||
[Parameter] | ||
public RenderFragment? Actions { get; set; } | ||
|
||
|
||
public bool IsOpen { get; set; } | ||
|
||
string IsOpenClass { get; set; } = string.Empty; | ||
|
||
string IsOpenDisplayStyle { get; set; } = "none"; | ||
|
||
public async Task Open() | ||
{ | ||
IsOpenDisplayStyle = "block"; | ||
IsOpen = true; | ||
await Task.Delay(100);//Delay allows bootstrap to perform nice fade animation | ||
IsOpenClass = "show"; | ||
StateHasChanged(); | ||
|
||
} | ||
|
||
public async Task Close() | ||
{ | ||
IsOpenClass = ""; | ||
IsOpen = false; | ||
await Task.Delay(250);//Delay allows bootstrap to perform nice fade animation | ||
IsOpenDisplayStyle = "none"; | ||
StateHasChanged(); | ||
} | ||
} |
Oops, something went wrong.
Hey @ns8482e; Seems like a typo to me. May be you intended to convey either "collocated", "collected" or "connected" for "CollocatedJSComponent", CollectedJSComponent" or "ConnectedJSComponent" although I don't think they match either: it's an option-editor and neither of above generic terms seems to fit.