Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
albertwoo committed Mar 19, 2024
2 parents 5e09294 + 92a72fa commit 941f507
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 307 deletions.
Original file line number Diff line number Diff line change
@@ -1,39 +1,26 @@
namespace rec Microsoft.AspNetCore.Components.Authorization.DslInternals

open System.Threading.Tasks
open FSharp.Data.Adaptive
open Fun.Blazor
open Fun.Blazor.Operators
open Microsoft.AspNetCore.Components.Authorization.DslInternals

/// A base class for components that display differing content depending on the user's authorization status.
type AuthorizeViewCoreBuilder<'FunBlazorGeneric when 'FunBlazorGeneric :> Microsoft.AspNetCore.Components.IComponent>() =
inherit ComponentWithDomAndChildAttrBuilder<'FunBlazorGeneric>()
/// The content that will be displayed if the user is authorized.
[<CustomOperation("ChildContent")>] member inline _.ChildContent ([<InlineIfLambda>] render: AttrRenderFragment, fn: Microsoft.AspNetCore.Components.Authorization.AuthenticationState -> NodeRenderFragment) = render ==> html.renderFragment("ChildContent", fn)
/// The content that will be displayed if the user is not authorized.
[<CustomOperation("NotAuthorized")>] member inline _.NotAuthorized ([<InlineIfLambda>] render: AttrRenderFragment, fn: Microsoft.AspNetCore.Components.Authorization.AuthenticationState -> NodeRenderFragment) = render ==> html.renderFragment("NotAuthorized", fn)
/// The content that will be displayed if the user is authorized.
/// If you specify a value for this parameter, do not also specify a value for ChildContent.
[<CustomOperation("Authorized")>] member inline _.Authorized ([<InlineIfLambda>] render: AttrRenderFragment, fn: Microsoft.AspNetCore.Components.Authorization.AuthenticationState -> NodeRenderFragment) = render ==> html.renderFragment("Authorized", fn)
/// The content that will be displayed while asynchronous authorization is in progress.
[<CustomOperation("Authorizing")>] member inline _.Authorizing ([<InlineIfLambda>] render: AttrRenderFragment, fragment) = render ==> html.renderFragment("Authorizing", fragment)
/// The content that will be displayed while asynchronous authorization is in progress.
[<CustomOperation("Authorizing")>] member inline _.Authorizing ([<InlineIfLambda>] render: AttrRenderFragment, fragments) = render ==> html.renderFragment("Authorizing", fragment { yield! fragments })
/// The content that will be displayed while asynchronous authorization is in progress.
[<CustomOperation("Authorizing")>] member inline _.Authorizing ([<InlineIfLambda>] render: AttrRenderFragment, x: string) = render ==> html.renderFragment("Authorizing", html.text x)
/// The content that will be displayed while asynchronous authorization is in progress.
[<CustomOperation("Authorizing")>] member inline _.Authorizing ([<InlineIfLambda>] render: AttrRenderFragment, x: int) = render ==> html.renderFragment("Authorizing", html.text x)
/// The content that will be displayed while asynchronous authorization is in progress.
[<CustomOperation("Authorizing")>] member inline _.Authorizing ([<InlineIfLambda>] render: AttrRenderFragment, x: float) = render ==> html.renderFragment("Authorizing", html.text x)
/// The resource to which access is being controlled.
[<CustomOperation("Resource")>] member inline _.Resource ([<InlineIfLambda>] render: AttrRenderFragment, x: System.Object) = render ==> ("Resource" => x)

/// Displays differing content depending on the user's authorization status.
type AuthorizeViewBuilder<'FunBlazorGeneric when 'FunBlazorGeneric :> Microsoft.AspNetCore.Components.IComponent>() =
inherit AuthorizeViewCoreBuilder<'FunBlazorGeneric>()
/// The policy name that determines whether the content can be displayed.
[<CustomOperation("Policy")>] member inline _.Policy ([<InlineIfLambda>] render: AttrRenderFragment, x: System.String) = render ==> ("Policy" => x)
/// A comma delimited list of roles that are allowed to display the content.
[<CustomOperation("Roles")>] member inline _.Roles ([<InlineIfLambda>] render: AttrRenderFragment, x: System.String) = render ==> ("Roles" => x)

type CascadingAuthenticationStateBuilder<'FunBlazorGeneric when 'FunBlazorGeneric :> Microsoft.AspNetCore.Components.IComponent>() =
Expand All @@ -52,15 +39,7 @@ module DslCE =
open System.Diagnostics.CodeAnalysis
open Microsoft.AspNetCore.Components.Authorization.DslInternals


/// A base class for components that display differing content depending on the user's authorization status.
type AuthorizeViewCore'
/// A base class for components that display differing content depending on the user's authorization status.
[<DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof<Microsoft.AspNetCore.Components.Authorization.AuthorizeViewCore>)>] () = inherit AuthorizeViewCoreBuilder<Microsoft.AspNetCore.Components.Authorization.AuthorizeViewCore>()

/// Displays differing content depending on the user's authorization status.
type AuthorizeView'
/// Displays differing content depending on the user's authorization status.
[<DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof<Microsoft.AspNetCore.Components.Authorization.AuthorizeView>)>] () = inherit AuthorizeViewBuilder<Microsoft.AspNetCore.Components.Authorization.AuthorizeView>()
type AuthorizeViewCore' [<DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof<Microsoft.AspNetCore.Components.Authorization.AuthorizeViewCore>)>] () = inherit AuthorizeViewCoreBuilder<Microsoft.AspNetCore.Components.Authorization.AuthorizeViewCore>()
type AuthorizeView' [<DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof<Microsoft.AspNetCore.Components.Authorization.AuthorizeView>)>] () = inherit AuthorizeViewBuilder<Microsoft.AspNetCore.Components.Authorization.AuthorizeView>()
type CascadingAuthenticationState' [<DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof<Microsoft.AspNetCore.Components.Authorization.CascadingAuthenticationState>)>] () = inherit CascadingAuthenticationStateBuilder<Microsoft.AspNetCore.Components.Authorization.CascadingAuthenticationState>()

Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net8.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TrimMode>link</TrimMode>
<IsTrimmable>true</IsTrimmable>
<Version>8.0.2</Version>
<Version>8.0.3</Version>
</PropertyGroup>
<ItemGroup>
<Compile Include="Fun.Blazor.Bindings\Microsoft.AspNetCore.Components.Authorization.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference FunBlazor="" FunBlazorNamespace="Microsoft.AspNetCore.Components.Authorization" Include="Microsoft.AspNetCore.Components.Authorization" Version="8.0.2" />
<PackageReference FunBlazor="" FunBlazorNamespace="Microsoft.AspNetCore.Components.Authorization" Include="Microsoft.AspNetCore.Components.Authorization" Version="8.0.3" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="6.0.0" />
<PackageReference Include="Fun.Blazor" Version="3.2.*" />
<PackageReference Include="Fun.Blazor" Version="4.0.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace rec Microsoft.AspNetCore.Components.QuickGrid.DslInternals

open System.Threading.Tasks
open FSharp.Data.Adaptive
open Fun.Blazor
open Fun.Blazor.Operators
Expand Down Expand Up @@ -57,7 +58,7 @@ type ColumnBaseBuilder<'FunBlazorGeneric, 'TGridItem when 'FunBlazorGeneric :> M
/// if IsDefaultSortColumn is true.
[<CustomOperation("InitialSortDirection")>] member inline _.InitialSortDirection ([<InlineIfLambda>] render: AttrRenderFragment, x: Microsoft.AspNetCore.Components.QuickGrid.SortDirection) = render ==> ("InitialSortDirection" => x)
/// Indicates whether this column should be sorted by default.
[<CustomOperation("IsDefaultSortColumn")>] member inline _.IsDefaultSortColumn ([<InlineIfLambda>] render: AttrRenderFragment, x: System.Boolean) = render ==> ("IsDefaultSortColumn" => x)
[<CustomOperation("IsDefaultSortColumn")>] member inline _.IsDefaultSortColumn ([<InlineIfLambda>] render: AttrRenderFragment, ?x: bool) = render ==> ("IsDefaultSortColumn" => (defaultArg x true))
/// If specified, virtualized grids will use this template to render cells whose data has not yet been loaded.
[<CustomOperation("PlaceholderTemplate")>] member inline _.PlaceholderTemplate ([<InlineIfLambda>] render: AttrRenderFragment, fn: Microsoft.AspNetCore.Components.Web.Virtualization.PlaceholderContext -> NodeRenderFragment) = render ==> html.renderFragment("PlaceholderTemplate", fn)

Expand Down Expand Up @@ -122,7 +123,7 @@ type QuickGridBuilder<'FunBlazorGeneric, 'TGridItem when 'FunBlazorGeneric :> Mi
///
/// Generally it's preferable not to use Virtualize if the amount of data being rendered
/// is small or if you are using pagination.
[<CustomOperation("Virtualize")>] member inline _.Virtualize ([<InlineIfLambda>] render: AttrRenderFragment, x: System.Boolean) = render ==> ("Virtualize" => x)
[<CustomOperation("Virtualize")>] member inline _.Virtualize ([<InlineIfLambda>] render: AttrRenderFragment, ?x: bool) = render ==> ("Virtualize" => (defaultArg x true))
/// This is applicable only when using Virtualize. It defines an expected height in pixels for
/// each row, allowing the virtualization mechanism to fetch the correct number of items to match the display
/// size and to ensure accurate scrolling.
Expand All @@ -148,6 +149,7 @@ type QuickGridBuilder<'FunBlazorGeneric, 'TGridItem when 'FunBlazorGeneric :> Mi

namespace rec Microsoft.AspNetCore.Components.QuickGrid.DslInternals.Infrastructure

open System.Threading.Tasks
open FSharp.Data.Adaptive
open Fun.Blazor
open Fun.Blazor.Operators
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net8.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TrimMode>link</TrimMode>
<IsTrimmable>true</IsTrimmable>
<Version>8.0.2</Version>
<Version>8.0.3</Version>
</PropertyGroup>
<ItemGroup>
<Compile Include="Fun.Blazor.Bindings\Microsoft.AspNetCore.Components.QuickGrid.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference FunBlazor="" FunBlazorNamespace="Microsoft.AspNetCore.Components.QuickGrid" Include="Microsoft.AspNetCore.Components.QuickGrid" Version="8.0.2" />
<PackageReference FunBlazor="" FunBlazorNamespace="Microsoft.AspNetCore.Components.QuickGrid" Include="Microsoft.AspNetCore.Components.QuickGrid" Version="8.0.3" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="6.0.0" />
<PackageReference Include="Fun.Blazor" Version="3.2.*" />
<PackageReference Include="Fun.Blazor" Version="4.0.0" />
</ItemGroup>
</Project>
Loading

0 comments on commit 941f507

Please sign in to comment.