Skip to content

Commit

Permalink
🆕 feat: SThirdPartySchemeSelect (#721)
Browse files Browse the repository at this point in the history
  • Loading branch information
wzh425 authored Aug 1, 2024
1 parent 5189c40 commit 1c0f128
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<MicrosoftPackageVersion Condition="'$(TargetFramework)' == 'net7.0'">7.0.0</MicrosoftPackageVersion>
<MicrosoftPackageVersion Condition="'$(TargetFramework)' == 'net8.0'">8.0.0</MicrosoftPackageVersion>
<MasaFrameworkPackageVersion>1.2.0-preview.2</MasaFrameworkPackageVersion>
<MasaStackSdksPackageVersion>1.1.1-preview.4</MasaStackSdksPackageVersion>
<MasaStackSdksPackageVersion>1.1.1-preview.6</MasaStackSdksPackageVersion>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions Masa.Stack.Components.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Stack.Components", "sr
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MasaWasmApp", "tests\MasaWasmApp\MasaWasmApp.csproj", "{5C2DD1F3-214F-475C-81D4-D13EC7ACEFE4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Stack.Components.Standalone", "src\Masa.Stack.Components.Standalone\Masa.Stack.Components.Standalone.csproj", "{DA7D3D4E-BCEA-4FE0-904A-0BD0231A0C69}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Stack.Components.Standalone", "src\Masa.Stack.Components.Standalone\Masa.Stack.Components.Standalone.csproj", "{DA7D3D4E-BCEA-4FE0-904A-0BD0231A0C69}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Stack.Components.Standalone.TestApp", "tests\Masa.Stack.Components.Standalone.TestApp\Masa.Stack.Components.Standalone.TestApp.csproj", "{F1DE11A5-3AF2-474F-84B4-C964F8250265}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Stack.Components.Standalone.TestApp", "tests\Masa.Stack.Components.Standalone.TestApp\Masa.Stack.Components.Standalone.TestApp.csproj", "{F1DE11A5-3AF2-474F-84B4-C964F8250265}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
@namespace Masa.Stack.Components
@inherits MasaComponentBase

<SSelect Value="Value"
ValueChanged="ValueChanged"
Items="ThirdPartyIdps"
Label="@T(Label??"")"
ItemText="e => e.DisplayName"
ItemValue="e => e.Name"
Small=Small
Clearable=Clearable
BackgroundColor="@(FillBackground?"fill-background":"white")"
Style="@($"{Style}")"
Class="@($"{Class}")">
<ItemContent Context="data">
<div class="d-flex align-center" style="height:48px;">
<MAvatar Size=30>
<img src="@data.Item?.Icon" />
</MAvatar>
<div class="my-auto">
<span class="body2 emphasis2--text ml-2">@data.Item?.Name</span>
</div>
</div>
</ItemContent>
</SSelect>

@code {
[Parameter]
public string Value { get; set; } = string.Empty;

[Parameter]
public EventCallback<string> ValueChanged { get; set; }

[Parameter]
public List<ThirdPartyIdpSelectModel>? ThirdPartyIdps { get; set; }

[Parameter]
public bool Small { get; set; }

[Parameter]
public string? Label { get; set; }

[Parameter]
public bool Clearable { get; set; }

[Parameter]
public bool FillBackground { get; set; } = true;

protected override async Task OnInitializedAsync()
{
if (ThirdPartyIdps is null)
{
await InitThirdPartyIdps();
}
else Label ??= "ThirdPartyIdp";
}

public async Task InitThirdPartyIdps()
{
ThirdPartyIdps = new();
ThirdPartyIdps.AddRange(await AuthClient.ThirdPartyIdpService.GetSelectAsync(default, true));
}
}

0 comments on commit 1c0f128

Please sign in to comment.