diff --git a/browser/IgBlazorSamples.Client/wwwroot/index.html b/browser/IgBlazorSamples.Client/wwwroot/index.html index 3a45a7f295..89d7620c93 100644 --- a/browser/IgBlazorSamples.Client/wwwroot/index.html +++ b/browser/IgBlazorSamples.Client/wwwroot/index.html @@ -124,7 +124,6 @@ - diff --git a/samples/grids/grid/editing-excel-style-custom/App.razor b/samples/grids/grid/editing-excel-style-custom/App.razor deleted file mode 100644 index 5b6f9d1951..0000000000 --- a/samples/grids/grid/editing-excel-style-custom/App.razor +++ /dev/null @@ -1,80 +0,0 @@ -@using IgniteUI.Blazor.Controls - -@inject IJSRuntime JS - -
-
- - - - - - - - - - - - - - - - - -
-
- -@code { - - protected override async Task OnAfterRenderAsync(bool firstRender) - { - var grid1 = this.grid1; - } - - async private void rendered() - { - await JS.InvokeVoidAsync("attachKeyDownEvent"); - } - - private IgbGrid grid1; - private bool shouldAppendValue = false; - - private NwindData _nwindData = null; - public NwindData NwindData - { - get - { - if (_nwindData == null) - { - _nwindData = new NwindData(); - } - return _nwindData; - } - } -} \ No newline at end of file diff --git a/samples/grids/grid/editing-excel-style-custom/BlazorClientApp.csproj b/samples/grids/grid/editing-excel-style-custom/BlazorClientApp.csproj deleted file mode 100644 index d6524b8676..0000000000 --- a/samples/grids/grid/editing-excel-style-custom/BlazorClientApp.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - net9.0 - 3.0 - Infragistics.Samples - Infragistics.Samples - - - - 1701;1702,IDE0028,BL0005,0219,CS1998 - - - - - - - - - - diff --git a/samples/grids/grid/editing-excel-style-custom/BlazorClientApp.sln b/samples/grids/grid/editing-excel-style-custom/BlazorClientApp.sln deleted file mode 100644 index 1e2eda208a..0000000000 --- a/samples/grids/grid/editing-excel-style-custom/BlazorClientApp.sln +++ /dev/null @@ -1,25 +0,0 @@ - -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 diff --git a/samples/grids/grid/editing-excel-style-custom/NwindData.cs b/samples/grids/grid/editing-excel-style-custom/NwindData.cs deleted file mode 100644 index 25e092c72a..0000000000 --- a/samples/grids/grid/editing-excel-style-custom/NwindData.cs +++ /dev/null @@ -1,125 +0,0 @@ -using System; -using System.Collections.Generic; -public class NwindDataItem -{ - public double ProductID { get; set; } - public string ProductName { get; set; } - public double SupplierID { get; set; } - public double CategoryID { get; set; } - public string QuantityPerUnit { get; set; } - public double UnitPrice { get; set; } - public double UnitsInStock { get; set; } - public double UnitsOnOrder { get; set; } - public double ReorderLevel { get; set; } - public bool Discontinued { get; set; } - public string OrderDate { get; set; } - public double Rating { get; set; } - public List Locations { get; set; } -} -public class NwindDataItem_LocationsItem -{ - public string Shop { get; set; } - public string LastInventory { get; set; } -} - -public class NwindData - : List -{ - public NwindData() - { - this.Add(new NwindDataItem() { ProductID = 1, ProductName = @"Chai", SupplierID = 1, CategoryID = 1, QuantityPerUnit = @"10 boxes x 20 bags", UnitPrice = 18, UnitsInStock = 39, UnitsOnOrder = 30, ReorderLevel = 10, Discontinued = false, OrderDate = @"2012-02-12", Rating = 5, Locations = new List() - { - new NwindDataItem_LocationsItem() { Shop = @"Fun-Tasty Co.", LastInventory = @"2018-06-12" }, - new NwindDataItem_LocationsItem() { Shop = @"Farmer Market", LastInventory = @"2018-04-04" }} - }); - this.Add(new NwindDataItem() { ProductID = 2, ProductName = @"Chang", SupplierID = 1, CategoryID = 1, QuantityPerUnit = @"24 - 12 oz bottles", UnitPrice = 19, UnitsInStock = 17, UnitsOnOrder = 40, ReorderLevel = 25, Discontinued = true, OrderDate = @"2003-03-17", Rating = 5, Locations = new List() - { - new NwindDataItem_LocationsItem() { Shop = @"Super Market", LastInventory = @"2018-09-09" }} - }); - this.Add(new NwindDataItem() { ProductID = 3, ProductName = @"Aniseed Syrup", SupplierID = 1, CategoryID = 2, QuantityPerUnit = @"12 - 550 ml bottles", UnitPrice = 10, UnitsInStock = 13, UnitsOnOrder = 70, ReorderLevel = 25, Discontinued = false, OrderDate = @"2006-03-17", Rating = 3, Locations = new List() - { - new NwindDataItem_LocationsItem() { Shop = @"Farmer Market", LastInventory = @"2018-04-04" }, - new NwindDataItem_LocationsItem() { Shop = @"Street Market", LastInventory = @"2018-12-12" }, - new NwindDataItem_LocationsItem() { Shop = @"24/7 Market", LastInventory = @"2018-11-11" }} - }); - this.Add(new NwindDataItem() { ProductID = 4, ProductName = @"Chef Antons Cajun Seasoning", SupplierID = 2, CategoryID = 2, QuantityPerUnit = @"48 - 6 oz jars", UnitPrice = 22, UnitsInStock = 53, UnitsOnOrder = 30, ReorderLevel = 0, Discontinued = false, OrderDate = @"2016-03-17", Rating = 3, Locations = new List() - { - new NwindDataItem_LocationsItem() { Shop = @"Fun-Tasty Co.", LastInventory = @"2018-06-12" }, - new NwindDataItem_LocationsItem() { Shop = @"Farmer Market", LastInventory = @"2018-04-04" }, - new NwindDataItem_LocationsItem() { Shop = @"Street Market", LastInventory = @"2018-12-12" }} - }); - this.Add(new NwindDataItem() { ProductID = 5, ProductName = @"Chef Antons Gumbo Mix", SupplierID = 2, CategoryID = 2, QuantityPerUnit = @"36 boxes", UnitPrice = 21.35, UnitsInStock = 0, UnitsOnOrder = 30, ReorderLevel = 0, Discontinued = true, OrderDate = @"2011-11-11", Rating = 5, Locations = new List() - { - new NwindDataItem_LocationsItem() { Shop = @"Super Market", LastInventory = @"2018-09-09" }} - }); - this.Add(new NwindDataItem() { ProductID = 6, ProductName = @"Grandmas Boysenberry Spread", SupplierID = 3, CategoryID = 2, QuantityPerUnit = @"12 - 8 oz jars", UnitPrice = 25, UnitsInStock = 0, UnitsOnOrder = 30, ReorderLevel = 25, Discontinued = false, OrderDate = @"2017-12-17", Rating = 4, Locations = new List() - { - new NwindDataItem_LocationsItem() { Shop = @"Super Market", LastInventory = @"2018-09-09" }} - }); - this.Add(new NwindDataItem() { ProductID = 7, ProductName = @"Uncle Bobs Organic Dried Pears", SupplierID = 3, CategoryID = 7, QuantityPerUnit = @"12 - 1 lb pkgs.", UnitPrice = 30, UnitsInStock = 150, UnitsOnOrder = 30, ReorderLevel = 10, Discontinued = false, OrderDate = @"2016-07-17", Rating = 5, Locations = new List() - { - new NwindDataItem_LocationsItem() { Shop = @"Fun-Tasty Co.", LastInventory = @"2018-06-12" }, - new NwindDataItem_LocationsItem() { Shop = @"Farmer Market", LastInventory = @"2018-04-04" }, - new NwindDataItem_LocationsItem() { Shop = @"Street Market", LastInventory = @"2018-12-12" }} - }); - this.Add(new NwindDataItem() { ProductID = 8, ProductName = @"Northwoods Cranberry Sauce", SupplierID = 3, CategoryID = 2, QuantityPerUnit = @"12 - 12 oz jars", UnitPrice = 40, UnitsInStock = 6, UnitsOnOrder = 30, ReorderLevel = 0, Discontinued = false, OrderDate = @"2018-01-17", Rating = 4, Locations = new List() - { - new NwindDataItem_LocationsItem() { Shop = @"Fun-Tasty Co.", LastInventory = @"2018-06-12" }, - new NwindDataItem_LocationsItem() { Shop = @"Farmer Market", LastInventory = @"2018-04-04" }} - }); - this.Add(new NwindDataItem() { ProductID = 9, ProductName = @"Mishi Kobe Niku", SupplierID = 4, CategoryID = 6, QuantityPerUnit = @"18 - 500 g pkgs.", UnitPrice = 97, UnitsInStock = 29, UnitsOnOrder = 30, ReorderLevel = 0, Discontinued = true, OrderDate = @"2010-02-17", Rating = 4, Locations = new List() - { - new NwindDataItem_LocationsItem() { Shop = @"Farmer Market", LastInventory = @"2018-04-04" }} - }); - this.Add(new NwindDataItem() { ProductID = 10, ProductName = @"Ikura", SupplierID = 4, CategoryID = 8, QuantityPerUnit = @"12 - 200 ml jars", UnitPrice = 31, UnitsInStock = 31, UnitsOnOrder = 30, ReorderLevel = 0, Discontinued = false, OrderDate = @"2008-05-17", Rating = 3, Locations = new List() - { - new NwindDataItem_LocationsItem() { Shop = @"Wall Market", LastInventory = @"2018-12-06" }} - }); - this.Add(new NwindDataItem() { ProductID = 11, ProductName = @"Queso Cabrales", SupplierID = 5, CategoryID = 4, QuantityPerUnit = @"1 kg pkg.", UnitPrice = 21, UnitsInStock = 22, UnitsOnOrder = 30, ReorderLevel = 30, Discontinued = false, OrderDate = @"2009-01-17", Rating = 5, Locations = new List() - { - new NwindDataItem_LocationsItem() { Shop = @"Fun-Tasty Co.", LastInventory = @"2018-06-12" }, - new NwindDataItem_LocationsItem() { Shop = @"Farmer Market", LastInventory = @"2018-04-04" }} - }); - this.Add(new NwindDataItem() { ProductID = 12, ProductName = @"Queso Manchego La Pastora", SupplierID = 5, CategoryID = 4, QuantityPerUnit = @"10 - 500 g pkgs.", UnitPrice = 38, UnitsInStock = 86, UnitsOnOrder = 30, ReorderLevel = 0, Discontinued = false, OrderDate = @"2015-11-17", Rating = 3, Locations = new List() - { - new NwindDataItem_LocationsItem() { Shop = @"Farmer Market", LastInventory = @"2018-04-04" }} - }); - this.Add(new NwindDataItem() { ProductID = 13, ProductName = @"Konbu", SupplierID = 6, CategoryID = 8, QuantityPerUnit = @"2 kg box", UnitPrice = 6, UnitsInStock = 24, UnitsOnOrder = 30, ReorderLevel = 5, Discontinued = false, OrderDate = @"2015-03-17", Rating = 2, Locations = new List() - { - new NwindDataItem_LocationsItem() { Shop = @"Super Market", LastInventory = @"2018-09-09" }} - }); - this.Add(new NwindDataItem() { ProductID = 14, ProductName = @"Tofu", SupplierID = 6, CategoryID = 7, QuantityPerUnit = @"40 - 100 g pkgs.", UnitPrice = 23.25, UnitsInStock = 35, UnitsOnOrder = 30, ReorderLevel = 0, Discontinued = false, OrderDate = @"2017-06-17", Rating = 4, Locations = new List() - { - new NwindDataItem_LocationsItem() { Shop = @"Farmer Market", LastInventory = @"2018-04-04" }, - new NwindDataItem_LocationsItem() { Shop = @"Street Market", LastInventory = @"2018-12-12" }} - }); - this.Add(new NwindDataItem() { ProductID = 15, ProductName = @"Genen Shouyu", SupplierID = 6, CategoryID = 2, QuantityPerUnit = @"24 - 250 ml bottles", UnitPrice = 15.5, UnitsInStock = 39, UnitsOnOrder = 30, ReorderLevel = 5, Discontinued = false, OrderDate = @"2014-03-17", Rating = 4, Locations = new List() - { - new NwindDataItem_LocationsItem() { Shop = @"Local Market", LastInventory = @"2018-07-03" }, - new NwindDataItem_LocationsItem() { Shop = @"Wall Market", LastInventory = @"2018-12-06" }} - }); - this.Add(new NwindDataItem() { ProductID = 16, ProductName = @"Pavlova", SupplierID = 7, CategoryID = 3, QuantityPerUnit = @"32 - 500 g boxes", UnitPrice = 17.45, UnitsInStock = 29, UnitsOnOrder = 30, ReorderLevel = 10, Discontinued = false, OrderDate = @"2018-03-28", Rating = 2, Locations = new List() - { - new NwindDataItem_LocationsItem() { Shop = @"Farmer Market", LastInventory = @"2018-04-04" }, - new NwindDataItem_LocationsItem() { Shop = @"Street Market", LastInventory = @"2018-12-12" }, - new NwindDataItem_LocationsItem() { Shop = @"24/7 Market", LastInventory = @"2018-11-11" }} - }); - this.Add(new NwindDataItem() { ProductID = 17, ProductName = @"Alice Mutton", SupplierID = 7, CategoryID = 6, QuantityPerUnit = @"20 - 1 kg tins", UnitPrice = 39, UnitsInStock = 0, UnitsOnOrder = 30, ReorderLevel = 0, Discontinued = true, OrderDate = @"2015-08-17", Rating = 2, Locations = new List() - { - new NwindDataItem_LocationsItem() { Shop = @"Farmer Market", LastInventory = @"2018-04-04" }} - }); - this.Add(new NwindDataItem() { ProductID = 18, ProductName = @"Carnarvon Tigers", SupplierID = 7, CategoryID = 8, QuantityPerUnit = @"16 kg pkg.", UnitPrice = 62.5, UnitsInStock = 42, UnitsOnOrder = 30, ReorderLevel = 0, Discontinued = false, OrderDate = @"2005-09-27", Rating = 2, Locations = new List() - { - new NwindDataItem_LocationsItem() { Shop = @"24/7 Market", LastInventory = @"2018-11-11" }, - new NwindDataItem_LocationsItem() { Shop = @"Super Market", LastInventory = @"2018-09-09" }} - }); - this.Add(new NwindDataItem() { ProductID = 19, ProductName = @"Teatime Chocolate Biscuits", SupplierID = 8, CategoryID = 3, QuantityPerUnit = @"", UnitPrice = 9.2, UnitsInStock = 25, UnitsOnOrder = 30, ReorderLevel = 5, Discontinued = false, OrderDate = @"2001-03-17", Rating = 2, Locations = new List() - { - new NwindDataItem_LocationsItem() { Shop = @"Local Market", LastInventory = @"2018-07-03" }} - }); - this.Add(new NwindDataItem() { ProductID = 20, ProductName = @"Sir Rodneys Marmalade", SupplierID = 8, CategoryID = 3, QuantityPerUnit = @"4 - 100 ml jars", UnitPrice = 4.5, UnitsInStock = 40, UnitsOnOrder = 30, ReorderLevel = 0, Discontinued = false, OrderDate = @"2005-03-17", Rating = 5, Locations = new List() - { - new NwindDataItem_LocationsItem() { Shop = @"Super Market", LastInventory = @"2018-09-09" }} - }); - } -} diff --git a/samples/grids/grid/editing-excel-style-custom/Program.cs b/samples/grids/grid/editing-excel-style-custom/Program.cs deleted file mode 100644 index bc5b15de32..0000000000 --- a/samples/grids/grid/editing-excel-style-custom/Program.cs +++ /dev/null @@ -1,37 +0,0 @@ -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; -using IgniteUI.Blazor.Controls; -using System.Text.Json; -using System.Text.Json.Serialization; - -namespace Infragistics.Samples -{ - public class Program - { - public static async Task Main(string[] args) - { - var builder = WebAssemblyHostBuilder.CreateDefault(args); - builder.RootComponents.Add("app"); - builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); - // registering Ignite UI modules - builder.Services.AddIgniteUIBlazor( - typeof(IgbInputModule), - typeof(IgbGridModule) - ); - - builder.Services.Configure(options => - { - options.ReferenceHandler = ReferenceHandler.Preserve; - options.MaxDepth = 64; // Increase the maximum depth if needed - }); - await builder.Build().RunAsync(); - } - } -} diff --git a/samples/grids/grid/editing-excel-style-custom/Properties/launchSettings.json b/samples/grids/grid/editing-excel-style-custom/Properties/launchSettings.json deleted file mode 100644 index 18bd6fb5bc..0000000000 --- a/samples/grids/grid/editing-excel-style-custom/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "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" - } - } -} \ No newline at end of file diff --git a/samples/grids/grid/editing-excel-style-custom/ReadMe.md b/samples/grids/grid/editing-excel-style-custom/ReadMe.md deleted file mode 100644 index d96f621853..0000000000 --- a/samples/grids/grid/editing-excel-style-custom/ReadMe.md +++ /dev/null @@ -1,70 +0,0 @@ - - - -This folder contains implementation of Blazor application with example of Editing Excel Style Custom feature using [Grid](https://www.infragistics.com/products/ignite-ui-blazor/blazor/components/general-getting-started.html) component. - - - - - - - View Docs - - - View Code - - - Run Sample - - - - - -## 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) diff --git a/samples/grids/grid/editing-excel-style-custom/_Imports.razor b/samples/grids/grid/editing-excel-style-custom/_Imports.razor deleted file mode 100644 index d27d337cb1..0000000000 --- a/samples/grids/grid/editing-excel-style-custom/_Imports.razor +++ /dev/null @@ -1,9 +0,0 @@ -// these namespaces are global to the app -@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 Microsoft.AspNetCore.Components.WebAssembly.Http -@using Microsoft.JSInterop -@using Infragistics.Samples diff --git a/samples/grids/grid/editing-excel-style-custom/wwwroot/events.js b/samples/grids/grid/editing-excel-style-custom/wwwroot/events.js deleted file mode 100644 index 4bb1d4dc70..0000000000 --- a/samples/grids/grid/editing-excel-style-custom/wwwroot/events.js +++ /dev/null @@ -1,90 +0,0 @@ -igRegisterScript("WebGridEditingExcelStyle", (ev) => { - // Assuming `ev.detail.target` gives you the grid element or another relevant element - var gridElement = ev.detail.target; // This is just an example; adjust based on actual structure - - // Attach the onkeydown event listener to the gridElement or a specific child element - gridElement.addEventListener('keydown', (keydownEvent) => { - - }, false); - -}); - -var shouldAppendValue = false; - -window.attachKeyDownEvent = () => { - var grid1 = document.querySelectorAll("igc-grid")[0]; - - grid1.addEventListener('activeNodeChange', (event) => { - grid1.endEdit(); - (grid1.getElementsByClassName("igx-grid__tbody-content")[0]).focus(); - }); - - grid1.addEventListener('keydown', (e) => { - var code = e.code; - var grid1 = window.grid1; - var activeElem = grid1.selectedCells[0]; - - if ((e.code >= 'Digit0' && e.code <= 'Digit9') || - (e.code >= 'KeyA' && e.code <= 'KeyZ') || - (e.code >= 'Numpad0' && e.code <= 'Numpad9') && - e.code !== 'Enter' && e.code !== 'NumpadEnter') { - - if (activeElem && activeElem.editMode === false) { - activeElem.editMode = true; - activeElem.editValue = e.key; - shouldAppendValue = true; - grid1.markForCheck(); - } else - - if (activeElem && activeElem.editMode && this.shouldAppendValue) { - e.preventDefault(); - activeElem.editValue = activeElem.editValue + e.key; - shouldAppendValue = false; - } - } - - if (code === 'Backspace') { - if (activeElem == null || activeElem.editMode == false) { - return; - } - const rowIndex = activeElem.row.index; - const columnKey = activeElem.column.field; - - grid1.data[rowIndex][columnKey] = ''; - grid1.markForCheck(); - - } - - if (code === 'Enter' || code === 'NumpadEnter') { - - if (activeElem == null) { - return; - } - - const thisRow = activeElem.row.index; - const dataView = this.grid1.dataView; - const nextRowIndex = this.getNextEditableRowIndex(thisRow, dataView, e.shiftKey); - - grid1.navigateTo(nextRowIndex, activeElem.column.visibleIndex, (obj) => { - grid1.clearCellSelection(); - obj.target.activate(); - }); - } - }); -} - -window.getNextEditableRowIndex = (currentRowIndex, dataView, previous) => { - if (currentRowIndex < 0 || (currentRowIndex === 0 && previous) || (currentRowIndex >= dataView.length - 1 && !previous)) { - return currentRowIndex; - } - if (previous) { - return dataView.findLastIndex((rec, index) => index < currentRowIndex && this.isEditableDataRecordAtIndex(index, dataView)); - } - return dataView.findIndex((rec, index) => index > currentRowIndex && this.isEditableDataRecordAtIndex(index, dataView)); -} - -function isEditableDataRecordAtIndex(dataViewIndex, dataView) { - const rec = dataView[dataViewIndex]; - return !rec.expression && !rec.summaries && !rec.childGridsData && !rec.detailsData; -} - diff --git a/samples/grids/grid/editing-excel-style-custom/wwwroot/index.css b/samples/grids/grid/editing-excel-style-custom/wwwroot/index.css deleted file mode 100644 index 50ca13caa6..0000000000 --- a/samples/grids/grid/editing-excel-style-custom/wwwroot/index.css +++ /dev/null @@ -1,4 +0,0 @@ -/* -CSS styles are loaded from the shared CSS file located at: -https://static.infragistics.com/xplatform/css/samples/ -*/ diff --git a/samples/grids/grid/editing-excel-style-custom/wwwroot/index.html b/samples/grids/grid/editing-excel-style-custom/wwwroot/index.html deleted file mode 100644 index 2f36baee77..0000000000 --- a/samples/grids/grid/editing-excel-style-custom/wwwroot/index.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - Samples | IgniteUI for Blazor | Infragistics - - - - - - - - - - -
- An unhandled error has occurred. - Reload - 🗙 -
- - - - - - - - - - diff --git a/samples/grids/grid/editing-excel-style/App.razor b/samples/grids/grid/editing-excel-style/App.razor index 438808afba..3122bba5cc 100644 --- a/samples/grids/grid/editing-excel-style/App.razor +++ b/samples/grids/grid/editing-excel-style/App.razor @@ -1,80 +1,36 @@ @using IgniteUI.Blazor.Controls - +@using Microsoft.AspNetCore.Components.Web @inject IJSRuntime JS
- - - - - - - - - - - - - - - + + + -
@code { - - protected override async Task OnAfterRenderAsync(bool firstRender) - { - var grid1 = this.grid1; - - } - private IgbGrid grid1; - private NwindData _nwindData = null; - public NwindData NwindData + async Task OnKeydown(KeyboardEventArgs e) { - get - { - if (_nwindData == null) - { - _nwindData = new NwindData(); - } - return _nwindData; - } + await JS.InvokeVoidAsync("keydownHandler", e); } -} \ No newline at end of file + private NwindData _nwindData; + public NwindData NwindData => _nwindData ??= new NwindData(); +} diff --git a/samples/grids/grid/editing-excel-style/Program.cs b/samples/grids/grid/editing-excel-style/Program.cs index c6da4c4ab7..bc5b15de32 100644 --- a/samples/grids/grid/editing-excel-style/Program.cs +++ b/samples/grids/grid/editing-excel-style/Program.cs @@ -7,7 +7,9 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using IgniteUI.Blazor.Controls; // for registering Ignite UI modules +using IgniteUI.Blazor.Controls; +using System.Text.Json; +using System.Text.Json.Serialization; namespace Infragistics.Samples { @@ -23,6 +25,12 @@ public static async Task Main(string[] args) typeof(IgbInputModule), typeof(IgbGridModule) ); + + builder.Services.Configure(options => + { + options.ReferenceHandler = ReferenceHandler.Preserve; + options.MaxDepth = 64; // Increase the maximum depth if needed + }); await builder.Build().RunAsync(); } } diff --git a/samples/grids/grid/editing-excel-style/wwwroot/events.js b/samples/grids/grid/editing-excel-style/wwwroot/events.js index 5e2db2a51c..faa18a2d3a 100644 --- a/samples/grids/grid/editing-excel-style/wwwroot/events.js +++ b/samples/grids/grid/editing-excel-style/wwwroot/events.js @@ -1,46 +1,67 @@ +let shouldAppendValue = false; +igRegisterScript("onActiveNodeChange", (ev) => { + const grid = ev.target; + grid.endEdit(); + setTimeout(() => { + (grid.getElementsByClassName("igx-grid__tbody-content")[0]).focus(); + }, 0); +}, false); + +window.keydownHandler = (e) => { + const grid = document.getElementById("grid1"); + if (!grid) return; -igRegisterScript("WebGridEditingExcelStyle", (ev) => { - var key = ev.detail.event.keyCode; - var grid = ev.detail.target.grid; - var activeElem = grid.navigation.activeNode; + const code = e.code; + const active = grid.selectedCells?.[0]; - if ((key >= 48 && key <= 57) || (key >= 65 && key <= 90) || (key >= 97 && key <= 122)) { - var columnName = grid.getColumnByVisibleIndex(activeElem.column).field; - var cell = grid.getCellByColumn(activeElem.row, columnName); + const isAlphaNum = + (code >= 'Digit0' && code <= 'Digit9') || + (code >= 'KeyA' && code <= 'KeyZ') || + (code >= 'Numpad0' && code <= 'Numpad9'); - if (cell && !grid.crudService.cellInEditMode) { - grid.crudService.enterEditMode(cell); - cell.editValue = key; + if (isAlphaNum && code !== 'Enter' && code !== 'NumpadEnter') { + if (active && active.editMode === false) { + active.editMode = true; + active.editValue = e.key; + shouldAppendValue = true; + grid.markForCheck(); + } else if (active && active.editMode && shouldAppendValue) { + active.editValue = `${active.editValue ?? ""}${e.key}`; + shouldAppendValue = false; } } - if (key == 13) { - var thisRow = activeElem.row; - var column = activeElem.column; - var rowInfo = grid.dataView; + if (code === 'Backspace') { + if (!active || active.editMode === false) return; + const rowIndex = active.row.index; + const columnKey = active.column.field; + grid.data[rowIndex][columnKey] = ''; + grid.markForCheck(); + } - var nextRow = this.getNextEditableRowIndex(thisRow, rowInfo, ev.detail.event.shiftKey); + if (code === 'Enter' || code === 'NumpadEnter') { + if (!active) return; + const thisRow = active.row.index; + const dataView = grid.dataView; + const nextIndex = window.getNextEditableRowIndex(thisRow, dataView, !!e.shiftKey); - grid.navigateTo(nextRow, column, (obj) => { - obj.target.activate(); + grid.navigateTo(nextIndex, active.column.visibleIndex, (obj) => { grid.clearCellSelection(); + obj.target.activate(); }); } -}, false); +}; -function getNextEditableRowIndex(currentRowIndex, dataView, previous) { - if (currentRowIndex < 0 || (currentRowIndex === 0 && previous) || (currentRowIndex >= dataView.length - 1 && !previous)) { +window.getNextEditableRowIndex = (currentRowIndex, dataView, previous) => { + if (currentRowIndex < 0 || (currentRowIndex === 0 && previous) || (currentRowIndex >= dataView.length - 1 && !previous)) return currentRowIndex; - } - if (previous) { - return dataView.findLastIndex((rec, index) => index < currentRowIndex && this.isEditableDataRecordAtIndex(index, dataView)); - } - return dataView.findIndex((rec, index) => index > currentRowIndex && this.isEditableDataRecordAtIndex(index, dataView)); -} + if (previous) + return dataView.findLastIndex((_, i) => i < currentRowIndex && window.isEditableDataRecordAtIndex(i, dataView)); + return dataView.findIndex((_, i) => i > currentRowIndex && window.isEditableDataRecordAtIndex(i, dataView)); +}; -function isEditableDataRecordAtIndex(dataViewIndex, dataView) { - const rec = dataView[dataViewIndex]; +window.isEditableDataRecordAtIndex = (i, dataView) => { + const rec = dataView[i]; return !rec.expression && !rec.summaries && !rec.childGridsData && !rec.detailsData; -} - +}; diff --git a/samples/grids/grid/editing-excel-style/wwwroot/index.html b/samples/grids/grid/editing-excel-style/wwwroot/index.html index 6ea07bab27..2f36baee77 100644 --- a/samples/grids/grid/editing-excel-style/wwwroot/index.html +++ b/samples/grids/grid/editing-excel-style/wwwroot/index.html @@ -26,6 +26,8 @@ + +