Skip to content

Commit

Permalink
Merge pull request #1 from Backiaraj/autocomplete
Browse files Browse the repository at this point in the history
Update the project
  • Loading branch information
rajendranr-5483 authored Oct 13, 2023
2 parents 948be94 + 9e65302 commit ec96eec
Show file tree
Hide file tree
Showing 64 changed files with 1,692 additions and 1,496 deletions.
22 changes: 12 additions & 10 deletions App.razor → Client/App.razor
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
</Found>
<NotFound>
<LayoutView Layout="@typeof(MainLayout)">
<p>Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
20 changes: 20 additions & 0 deletions Client/CustomizingAppearance.Client.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.2" PrivateAssets="all" />
<PackageReference Include="Syncfusion.Blazor.DropDowns" Version="23.1.40" />
<PackageReference Include="Syncfusion.Blazor.Themes" Version="23.1.40" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Shared\CustomizingAppearance.Shared.csproj" />
</ItemGroup>

</Project>
34 changes: 18 additions & 16 deletions Pages/Counter.razor → Client/Pages/Counter.razor
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
@page "/counter"

<h1>Counter</h1>

<p>Current count: @currentCount</p>

<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>

@code {
private int currentCount = 0;

private void IncrementCount()
{
currentCount++;
}
}
@page "/counter"

<PageTitle>Counter</PageTitle>

<h1>Counter</h1>

<p role="status">Current count: @currentCount</p>

<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>

@code {
private int currentCount = 0;

private void IncrementCount()
{
currentCount++;
}
}
102 changes: 47 additions & 55 deletions Pages/FetchData.razor → Client/Pages/FetchData.razor
Original file line number Diff line number Diff line change
@@ -1,55 +1,47 @@
@page "/fetchdata"
@inject HttpClient Http

<h1>Weather forecast</h1>

<p>This component demonstrates fetching data from the server.</p>

@if (forecasts == null)
{
<p><em>Loading...</em></p>
}
else
{
<table class="table">
<thead>
<tr>
<th>Date</th>
<th>Temp. (C)</th>
<th>Temp. (F)</th>
<th>Summary</th>
</tr>
</thead>
<tbody>
@foreach (var forecast in forecasts)
{
<tr>
<td>@forecast.Date.ToShortDateString()</td>
<td>@forecast.TemperatureC</td>
<td>@forecast.TemperatureF</td>
<td>@forecast.Summary</td>
</tr>
}
</tbody>
</table>
}

@code {
private WeatherForecast[] forecasts;

protected override async Task OnInitializedAsync()
{
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json");
}

public class WeatherForecast
{
public DateTime Date { get; set; }

public int TemperatureC { get; set; }

public string Summary { get; set; }

public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}
}
@page "/fetchdata"
@using CustomizingAppearance.Shared
@inject HttpClient Http

<PageTitle>Weather forecast</PageTitle>

<h1>Weather forecast</h1>

<p>This component demonstrates fetching data from the server.</p>

@if (forecasts == null)
{
<p><em>Loading...</em></p>
}
else
{
<table class="table">
<thead>
<tr>
<th>Date</th>
<th>Temp. (C)</th>
<th>Temp. (F)</th>
<th>Summary</th>
</tr>
</thead>
<tbody>
@foreach (var forecast in forecasts)
{
<tr>
<td>@forecast.Date.ToShortDateString()</td>
<td>@forecast.TemperatureC</td>
<td>@forecast.TemperatureF</td>
<td>@forecast.Summary</td>
</tr>
}
</tbody>
</table>
}

@code {
private WeatherForecast[]? forecasts;

protected override async Task OnInitializedAsync()
{
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("WeatherForecast");
}
}
117 changes: 117 additions & 0 deletions Client/Pages/Index.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
@page "/"

<SfAutoComplete TValue="string" TItem="EmployeeData" Placeholder="Select a customer" DataSource="@Data">
<AutoCompleteTemplates TItem="EmployeeData">
<ItemTemplate>
<div>
<img class="empImage" src="css/images/@((context as EmployeeData).EmployeeImageID).png" alt="employee" />
<div class="ename"> @((context as EmployeeData).FirstName) </div>
<div class="country"> @((context as EmployeeData).Country) </div>
</div>
</ItemTemplate>
<HeaderTemplate>
<span class='header'>
<span class='photo_header'>Photo</span>
<span class='info_header'>Employee Info</span>
</span>
</HeaderTemplate>
<FooterTemplate>
<span class='footer'>My Footer</span>
</FooterTemplate>
<NoRecordsTemplate>
<span class='norecord'>No Data Available!</span>
</NoRecordsTemplate>
</AutoCompleteTemplates>
<AutoCompleteFieldSettings Value="FirstName"></AutoCompleteFieldSettings>
</SfAutoComplete>

@code {

public class EmployeeData
{
public string FirstName { get; set; }
public string Country { get; set; }
public string EmployeeImageID { get; set; }
}
List<EmployeeData> Data = new List<EmployeeData>
{
new EmployeeData() { FirstName = "Andrew Fuller", Country = "England", EmployeeImageID = "7" },
new EmployeeData() { FirstName = "Anne Dodsworth", Country = "USA", EmployeeImageID = "1" },
new EmployeeData() { FirstName = "Janet Leverling", Country = "USA", EmployeeImageID = "3" },
new EmployeeData() { FirstName = "Laura Callahan", Country = "USA", EmployeeImageID = "2"},
new EmployeeData() { FirstName = "Margaret Peacock", Country = "USA", EmployeeImageID = "6"},
new EmployeeData() { FirstName = "Michael Suyama", Country = "USA", EmployeeImageID = "9" },
new EmployeeData() { FirstName = "Nancy Davolio", Country = "USA", EmployeeImageID = "4"},
new EmployeeData() { FirstName = "Robert King", Country = "England", EmployeeImageID = "8"},
new EmployeeData() { FirstName = "Steven Buchanan", Country = "England", EmployeeImageID = "10"},
};
}
<style>
.control_wrapper {
width: 260px;
margin-left: 25%;
margin-right: 40%;
margin-top: 10%;
margin-bottom: 15%;
}
.empImage {
margin: 6px 16px;
float: left;
width: 50px;
height: 50px;
}
.ename {
display: block !important;
opacity: .87;
font-size: 16px;
margin-top: 8px;
}
.country {
opacity: .54;
font-size: 14px;
margin-top: -15px;
margin-bottom: 7px;
}
.header {
display: table;
width: 100%;
margin: auto;
height: 40px;
font-size: 15px;
font-weight: 600;
text-indent: 16px;
}
.photo_header {
display: table-cell;
vertical-align: middle;
width: 22%;
text-indent: 16px;
}
.info_header {
display: table-cell;
vertical-align: middle;
width: 50%;
}
.footer {
text-indent: 1.2em;
display: block;
font-size: 15px;
line-height: 40px;
border-top: 1px solid #e0e0e0;
}
.norecord {
font-size: 15px;
vertical-align: middle;
}
</style>
12 changes: 12 additions & 0 deletions Client/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using CustomizingAppearance.Client;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Syncfusion.Blazor;

var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");

builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddSyncfusionBlazor();
await builder.Build().RunAsync();
Original file line number Diff line number Diff line change
@@ -1,29 +1,40 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:55917",
"sslPort": 44328
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"MyBlazorApp": {
"commandName": "Project",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:13715",
"sslPort": 44348
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "http://localhost:5159",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"applicationUrl": "https://localhost:7055;http://localhost:5159",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
Loading

0 comments on commit ec96eec

Please sign in to comment.