Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions browser/IgBlazorSamples.Client/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
<script src="sb/grid-multi-row-dragging.js" type="module"></script>
<script src="sb/grid-overview.js" type="module"></script>
<script src="sb/grid-overview-dark.js" type="module"></script>
<script src="sb/grid-overview-inventory.js" type="module"></script>
<script src="sb/grid-paste.js" type="module"></script>
<script src="sb/grid-row-classes.js" type="module"></script>
<script src="sb/grid-row-drag-base.js" type="module"></script>
Expand Down
97 changes: 97 additions & 0 deletions samples/grids/grid/overview-inventory/App.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
@using IgniteUI.Blazor.Controls

<div class="container vertical ig-typography">
@* Registers the icons that the cell templates in wwwroot/events.js show. *@
<IgbIcon @ref="iconRegistrar" hidden></IgbIcon>
<div class="container vertical fill">
<IgbGrid Class="inventory-grid"
Data="organicFoods"
PrimaryKey="SKU"
RowHeight="51"
RowSelection="GridSelectionMode.Multiple"
RowEditable="true"
AllowFiltering="true"
FilterMode="FilterMode.ExcelStyleFilter"
AllowAdvancedFiltering="true"
SortingExpressions="sortingExpressions"
GroupingExpressions="groupingExpressions"
HideGroupedColumns="true">
<IgbGridToolbar>
<IgbGridToolbarTitle>Organic and natural foods</IgbGridToolbarTitle>
<IgbGridToolbarActions>
<IgbGridToolbarHiding></IgbGridToolbarHiding>
<IgbGridToolbarPinning></IgbGridToolbarPinning>
<IgbGridToolbarExporter ExportStartedScript="InventoryExcludeActions"></IgbGridToolbarExporter>
<IgbGridToolbarAdvancedFiltering></IgbGridToolbarAdvancedFiltering>
</IgbGridToolbarActions>
</IgbGridToolbar>

<IgbColumn Field="ProductName" Header="Product" Width="304px" Sortable="true" Editable="false"
BodyTemplateScript="InventoryProductTemplate"></IgbColumn>
<IgbColumn Field="SKU" Header="SKU" Width="88px" Sortable="true" Editable="false"></IgbColumn>
<IgbColumn Field="Category" Header="Category" Width="160px" Sortable="true" Groupable="true" Editable="false"></IgbColumn>
<IgbColumn Field="Supplier" Header="Supplier" Width="156px" Sortable="true" Groupable="true" Editable="true"></IgbColumn>
<IgbColumn Field="Organic" Header="Organic" DataType="GridColumnDataType.Boolean" Width="104px"
Sortable="true" Groupable="true" Editable="false"></IgbColumn>
<IgbColumn Field="Storage" Header="Storage" Width="128px" Sortable="true" Groupable="true" Editable="false"
BodyTemplateScript="InventoryStorageTemplate"></IgbColumn>
<IgbColumn Field="Quantity" Header="Quantity" DataType="GridColumnDataType.Number" Width="108px"
Sortable="true" Editable="false"></IgbColumn>
<IgbColumn Field="StockLevel" Header="Stock Level" DataType="GridColumnDataType.Number" Width="132px"
Sortable="true" Editable="false" BodyTemplateScript="InventoryStockLevelTemplate"></IgbColumn>
<IgbColumn Field="Unit" Header="Unit" Width="120px" Sortable="true" Editable="false"></IgbColumn>
<IgbColumn Field="Status" Header="Status" Width="120px" Sortable="true" Groupable="true" Editable="false"
BodyTemplateScript="InventoryStatusTemplate"></IgbColumn>
<IgbColumn Field="UnitPrice" Header="Unit Price" DataType="GridColumnDataType.Currency" PipeArgs="euroPipeArgs"
Width="116px" Sortable="true" Editable="true"></IgbColumn>
<IgbColumn Field="RetailPrice" Header="Retail Price" DataType="GridColumnDataType.Currency" PipeArgs="euroPipeArgs"
Width="124px" Sortable="true" Editable="true"></IgbColumn>
<IgbColumn Field="ExpiryDate" Header="Expiry Date" DataType="GridColumnDataType.Date" Width="124px"
Sortable="true" Editable="true"></IgbColumn>
<IgbColumn Header="Actions" Width="84px" Pinned="true" PinningPosition="ColumnPinningPosition.End"
Filterable="false" Editable="false" DisableHiding="true" DisablePinning="true"
BodyTemplateScript="InventoryActionsTemplate"></IgbColumn>

<IgbPaginator PerPage="15"></IgbPaginator>
</IgbGrid>
</div>
</div>

@code {
// The Material icons of the cell templates, as SVG; they take the colour of the text.
private const string IconCollection = "material";
private const string AcUnitIcon = "<svg viewBox='0 0 20 20'><path d='M18.3333 9.16667H14.8583L17.5583 6.46667L16.3833 5.28333L12.5 9.16667H10.8333V7.5L14.7167 3.61667L13.5333 2.44167L10.8333 5.14167V1.66667H9.16667V5.14167L6.46667 2.44167L5.28333 3.61667L9.16667 7.5V9.16667H7.5L3.61667 5.28333L2.44167 6.46667L5.14167 9.16667H1.66667V10.8333H5.14167L2.44167 13.5333L3.61667 14.7167L7.5 10.8333H9.16667V12.5L5.28333 16.3833L6.46667 17.5583L9.16667 14.8583V18.3333H10.8333V14.8583L13.5333 17.5583L14.7167 16.3833L10.8333 12.5V10.8333H12.5L16.3833 14.7167L17.5583 13.5333L14.8583 10.8333H18.3333V9.16667Z'/></svg>";
private const string FormatColorResetIcon = "<svg viewBox='0 0 20 20'><path d='M15 11.6667C15 8.33333 10 2.66667 10 2.66667C10 2.66667 8.89167 3.925 7.725 5.6L14.8833 12.7583C14.9583 12.4083 15 12.0417 15 11.6667ZM14.2667 14.2667L10.4167 10.4167L4.39167 4.39167L3.33333 5.45833L6.1 8.225C5.45833 9.43333 5 10.6583 5 11.6667C5 14.425 7.24167 16.6667 10 16.6667C11.2667 16.6667 12.4167 16.1917 13.3 15.4167L15.4917 17.6083L16.55 16.55L14.2667 14.2667Z'/></svg>";
private const string ThermostatIcon = "<svg viewBox='0 0 20 20'><path d='M12.5 10.8333V4.16667C12.5 2.78333 11.3833 1.66667 10 1.66667C8.61667 1.66667 7.5 2.78333 7.5 4.16667V10.8333C6.49167 11.5917 5.83333 12.8083 5.83333 14.1667C5.83333 16.4667 7.7 18.3333 10 18.3333C12.3 18.3333 14.1667 16.4667 14.1667 14.1667C14.1667 12.8083 13.5083 11.5917 12.5 10.8333ZM9.16667 9.16667V4.16667C9.16667 3.70833 9.54167 3.33333 10 3.33333C10.4583 3.33333 10.8333 3.70833 10.8333 4.16667V5H10V5.83333H10.8333V7.5H10V8.33333H10.8333V9.16667H9.16667Z'/></svg>";
private const string EditIcon = "<svg viewBox='0 0 18 18'><path d='M2.25 12.9372V15.7497H5.0625L13.3575 7.45468L10.545 4.64218L2.25 12.9372ZM15.5325 5.27968C15.825 4.98718 15.825 4.51468 15.5325 4.22218L13.7775 2.46718C13.485 2.17468 13.0125 2.17468 12.72 2.46718L11.3475 3.83968L14.16 6.65218L15.5325 5.27968Z'/></svg>";
private const string DeleteIcon = "<svg viewBox='0 0 18 18'><path d='M4.5 14.25C4.5 15.075 5.175 15.75 6 15.75H12C12.825 15.75 13.5 15.075 13.5 14.25V5.25H4.5V14.25ZM14.25 3H11.625L10.875 2.25H7.125L6.375 3H3.75V4.5H14.25V3Z'/></svg>";

private readonly OrganicFoodsData organicFoods = new OrganicFoodsData();

private readonly IgbSortingExpression[] sortingExpressions =
{
new IgbSortingExpression { FieldName = "ProductName", Dir = SortingDirection.Asc, IgnoreCase = true }
};

private readonly IgbGroupingExpression[] groupingExpressions =
{
new IgbGroupingExpression { FieldName = "Category", Dir = SortingDirection.Asc, IgnoreCase = true }
};

private readonly IgbColumnPipeArgs euroPipeArgs = new IgbColumnPipeArgs { CurrencyCode = "EUR", DigitsInfo = "1.2-2" };

private IgbIcon iconRegistrar;

protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
await iconRegistrar.EnsureReady();
await iconRegistrar.RegisterIconFromTextAsync("ac_unit", AcUnitIcon, IconCollection);
await iconRegistrar.RegisterIconFromTextAsync("format_color_reset", FormatColorResetIcon, IconCollection);
await iconRegistrar.RegisterIconFromTextAsync("thermostat", ThermostatIcon, IconCollection);
await iconRegistrar.RegisterIconFromTextAsync("edit", EditIcon, IconCollection);
await iconRegistrar.RegisterIconFromTextAsync("delete", DeleteIcon, IconCollection);
}
}
}
25 changes: 25 additions & 0 deletions samples/grids/grid/overview-inventory/BlazorClientApp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
<AssemblyName>Infragistics.Samples</AssemblyName>
<RootNamespace>Infragistics.Samples</RootNamespace>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702,IDE0028,BL0005,0219,CS1998</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="IgniteUI.Blazor.Trial" Version="26.2.8" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.1" />
<PackageReference Include="System.Net.Http.Json" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
<Folder Include="Services\" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions samples/grids/grid/overview-inventory/BlazorClientApp.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29613.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorClientApp", "BlazorClientApp.csproj", "{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F69CC3F0-BCD1-4CE6-9F39-CBED14E7FA78}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FC52AAC8-4488-40AE-9621-75F6BA744B18}
EndGlobalSection
EndGlobal
37 changes: 37 additions & 0 deletions samples/grids/grid/overview-inventory/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System;
using System.Net.Http;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Text;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

// required for registering IgniteUIBlazor
using IgniteUI.Blazor.Controls;

namespace Infragistics.Samples
{
public class Program
{
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app");

builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });

// registering Infragistics Blazor, with the modules of the components
// that only the cell templates in wwwroot/events.js create
builder.Services.AddIgniteUIBlazor(
typeof(IgbBadgeModule),
typeof(IgbChipModule),
typeof(IgbIconButtonModule),
typeof(IgbLinearProgressModule)
);

await builder.Build().RunAsync();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:4200",
"sslPort": 44385
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"BlazorSamples": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:5001;http://localhost:4200"
}
}
}
68 changes: 68 additions & 0 deletions samples/grids/grid/overview-inventory/ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<!-- NOTE: do not change this file because it's auto re-generated from template: -->
<!-- https://github.com/IgniteUI/igniteui-blazor-examples/tree/vnext/templates/sample/ReadMe.md -->

This folder contains implementation of Blazor application with example of Overview Inventory feature using [Grid](https://www.infragistics.com/products/ignite-ui-blazor/blazor/components/general-getting-started.html) component.

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<body>
<a target="_blank" href="https://www.infragistics.com/products/ignite-ui-blazor/blazor/components/general-getting-started.html" rel="noopener noreferrer">
<img height="40px" style="border-radius: 0rem" alt="View Docs" src="https://dl.infragistics.com/x/img/browsers/button-docs.png"/>
</a>
<a target="_blank" href="./App.razor" rel="noopener noreferrer">
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="View Code" src="https://dl.infragistics.com/x/img/browsers/button-code.png"/>
</a>
<a target="_blank" href="https://infragistics.com/blazor-client/samples/grids/grid/overview-inventory" rel="noopener noreferrer">
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="Run Sample" src="https://dl.infragistics.com/x/img/browsers/button-run.png"/>
</a>
<!-- <a target="_blank" href="https://codesandbox.io/s/github/IgniteUI/igniteui-blazor-examples/tree/master/samples/grids/grid/overview-inventory?fontsize=14&hidenavigation=1&theme=dark&view=preview&file=/src/App.razor" rel="noopener noreferrer">
<img height="40px" style="border-radius: 0rem; max-width: 100%;" alt="Run Sample" src="https://dl.infragistics.com/x/img/browsers/button-sandbox.png"/>
</a> -->
</body>
</html>

## Branches

> **_NOTE:_** You should use [master](https://github.com/IgniteUI/igniteui-blazor-examples/tree/master) branch of this repository if you want to run samples on your computer. Use the [vnext](https://github.com/IgniteUI/igniteui-blazor-examples/tree/vnext) branch only when you want to contribute new samples to this repository.

## Setup

- instal **.NET SDK** from this [website](https://dotnet.microsoft.com/learn/aspnet/blazor-tutorial/install)

## Running App in Visual Studio 2022

NOTE: VS 2022 has better code highlighting and error detection than VS Code does.

- open **Visual Studio 2022** as an administrator

- open the **BlazorClientApp.sln** solution

- right click solution and select **Restore NuGet Packages** menu item

- click **Debug** menu and select **Start Debugging** or press **F5** key


## Running App in VS Code

- open **VS Code** as an administrator

- open this folder in **VS Code**

- open a terminal window

- to restore assemblies, run this command:
```dotnet restore```

- to run samples, run this command:
```dotnet watch run```

- wait for for message:
**Now listening on: http://localhost:4200**

- open **http://localhost:4200** in your browser


## Resources

- [Razor Component Models](https://www.codemag.com/article/1911052)
- [Razor Syntax](https://docs.microsoft.com/en-us/aspnet/core/blazor/components/?view=aspnetcore-3.1#razor-syntax)
- [Getting reference to components](https://docs.microsoft.com/en-us/aspnet/core/blazor/components/?view=aspnetcore-3.1#capture-references-to-components)
Loading