From d364bf9dc0034fcb94d1f4e108166da60557943c Mon Sep 17 00:00:00 2001 From: MarkStega Date: Sun, 3 Mar 2024 16:18:01 -0500 Subject: [PATCH] 5.1.4 (#1268) * Fix bug * Release notes * 2024-02-29 Prior to merge of singleSelectBug * 2024-02-29 EoD * 2024-03-01 BMoD * 2024-03-03 Remove MBGrid/MBGrid NG as they were still maked as experimental * Remove MD3 grid * Update docs removing experimental references --------- Co-authored-by: Simon Ziegler --- .../Articles/PlusComponents.md | 1 - .../Components/Grid/MBEnumerationsGrid.cs | 21 - Material.Blazor.MD3/Components/Grid/MBGrid.cs | 1151 ---------------- Material.Blazor.MD3/Components/Grid/MBGrid.md | 24 - .../Components/Grid/MBGrid.scss | 273 ---- Material.Blazor.MD3/Components/Grid/MBGrid.ts | 101 -- .../Grid/MBGridColumnConfiguration.cs | 47 - .../Grid/MBGridIconSpecification.cs | 9 - .../Grid/MBGridTextColorSpecification.cs | 11 - .../Components/Grid/MBGrid_DataHelper.cs | 210 --- Material.Blazor.MD3/Components/toc.yml | 3 - .../Scripts/material.blazor.ts | 2 - .../Styles/_material-symbols-outlined.scss | 2 +- .../Styles/_material-symbols-rounded.scss | 2 +- .../Styles/_material-symbols-sharp.scss | 2 +- .../Styles/material.blazor.scss | 1 - Material.Blazor.MD3/package-lock.json | 180 +-- Material.Blazor.MD3/package.json | 12 +- .../Material.Blazor.Test.csproj | 4 +- .../Material.Blazor.Website.MD3.csproj | 2 +- Material.Blazor.Website.MD3/Pages/Grid.razor | 227 ---- .../Shared/MainLayout.razor | 4 - Material.Blazor.Website.MD3/package-lock.json | 172 +-- Material.Blazor.Website.MD3/package.json | 10 +- .../wwwroot/js/material.blazor.website.js | 60 + .../wwwroot/js/material.blazor.website.min.js | 1 + .../Pages/ChipsSelectMulti.razor | 98 -- .../Pages/ChipsSelectSingle.razor | 75 -- Material.Blazor.Website/Pages/Grid.razor | 225 ---- Material.Blazor.Website/Pages/GridMT.razor | 240 ---- Material.Blazor.Website/Pages/Scheduler.razor | 193 --- .../Shared/MainLayout.razor | 6 - Material.Blazor.Website/package-lock.json | 172 +-- Material.Blazor.Website/package.json | 10 +- Material.Blazor/Articles/PlusComponents.md | 11 - .../ChipsSelectMulti/MBChipsSelectMulti.md | 34 - .../ChipsSelectMulti/MBChipsSelectMulti.razor | 64 - .../MBChipsSelectMulti.razor.cs | 122 -- .../ChipsSelectMulti/MBChipsSelectMulti.ts | 59 - .../ChipsSelectSingle/MBChipsSelectSingle.md | 34 - .../MBChipsSelectSingle.razor | 11 - .../MBChipsSelectSingle.razor.cs | 59 - .../Components/Grid/MBEnumerationsGrid.cs | 21 - Material.Blazor/Components/Grid/MBGrid.cs | 1153 ---------------- Material.Blazor/Components/Grid/MBGrid.md | 24 - Material.Blazor/Components/Grid/MBGrid.scss | 273 ---- Material.Blazor/Components/Grid/MBGrid.ts | 101 -- .../Grid/MBGridColumnConfiguration.cs | 47 - .../Grid/MBGridIconSpecification.cs | 12 - Material.Blazor/Components/Grid/MBGridMT.cs | 1047 --------------- .../Grid/MBGridTextColorSpecification.cs | 11 - .../Components/Grid/MBGrid_DataHelper.cs | 210 --- .../Components/Scheduler/MBScheduler.cs | 1192 ----------------- .../Components/Scheduler/MBScheduler.md | 24 - .../Components/Scheduler/MBScheduler.scss | 126 -- .../Components/Scheduler/MBScheduler.ts | 37 - .../Scheduler/MBSchedulerAppointment.cs | 21 - Material.Blazor/Components/toc.yml | 12 - .../Foundation/ComponentFoundation.cs | 10 +- Material.Blazor/Foundation/InputComponent.cs | 4 +- .../Foundation/SingleSelectComponent.cs | 2 +- Material.Blazor/Scripts/material.blazor.ts | 6 - .../Styles/_material-symbols-outlined.scss | 2 +- .../Styles/_material-symbols-rounded.scss | 2 +- .../Styles/_material-symbols-sharp.scss | 2 +- Material.Blazor/Styles/material.blazor.scss | 2 - Material.Blazor/package-lock.json | 172 +-- Material.Blazor/package.json | 10 +- ReleaseNotes.md | 21 + 69 files changed, 473 insertions(+), 8016 deletions(-) delete mode 100644 Material.Blazor.MD3/Components/Grid/MBEnumerationsGrid.cs delete mode 100644 Material.Blazor.MD3/Components/Grid/MBGrid.cs delete mode 100644 Material.Blazor.MD3/Components/Grid/MBGrid.md delete mode 100644 Material.Blazor.MD3/Components/Grid/MBGrid.scss delete mode 100644 Material.Blazor.MD3/Components/Grid/MBGrid.ts delete mode 100644 Material.Blazor.MD3/Components/Grid/MBGridColumnConfiguration.cs delete mode 100644 Material.Blazor.MD3/Components/Grid/MBGridIconSpecification.cs delete mode 100644 Material.Blazor.MD3/Components/Grid/MBGridTextColorSpecification.cs delete mode 100644 Material.Blazor.MD3/Components/Grid/MBGrid_DataHelper.cs delete mode 100644 Material.Blazor.Website.MD3/Pages/Grid.razor create mode 100644 Material.Blazor.Website.MD3/wwwroot/js/material.blazor.website.js create mode 100644 Material.Blazor.Website.MD3/wwwroot/js/material.blazor.website.min.js delete mode 100644 Material.Blazor.Website/Pages/ChipsSelectMulti.razor delete mode 100644 Material.Blazor.Website/Pages/ChipsSelectSingle.razor delete mode 100644 Material.Blazor.Website/Pages/Grid.razor delete mode 100644 Material.Blazor.Website/Pages/GridMT.razor delete mode 100644 Material.Blazor.Website/Pages/Scheduler.razor delete mode 100644 Material.Blazor/Components/ChipsSelectMulti/MBChipsSelectMulti.md delete mode 100644 Material.Blazor/Components/ChipsSelectMulti/MBChipsSelectMulti.razor delete mode 100644 Material.Blazor/Components/ChipsSelectMulti/MBChipsSelectMulti.razor.cs delete mode 100644 Material.Blazor/Components/ChipsSelectMulti/MBChipsSelectMulti.ts delete mode 100644 Material.Blazor/Components/ChipsSelectSingle/MBChipsSelectSingle.md delete mode 100644 Material.Blazor/Components/ChipsSelectSingle/MBChipsSelectSingle.razor delete mode 100644 Material.Blazor/Components/ChipsSelectSingle/MBChipsSelectSingle.razor.cs delete mode 100644 Material.Blazor/Components/Grid/MBEnumerationsGrid.cs delete mode 100644 Material.Blazor/Components/Grid/MBGrid.cs delete mode 100644 Material.Blazor/Components/Grid/MBGrid.md delete mode 100644 Material.Blazor/Components/Grid/MBGrid.scss delete mode 100644 Material.Blazor/Components/Grid/MBGrid.ts delete mode 100644 Material.Blazor/Components/Grid/MBGridColumnConfiguration.cs delete mode 100644 Material.Blazor/Components/Grid/MBGridIconSpecification.cs delete mode 100644 Material.Blazor/Components/Grid/MBGridMT.cs delete mode 100644 Material.Blazor/Components/Grid/MBGridTextColorSpecification.cs delete mode 100644 Material.Blazor/Components/Grid/MBGrid_DataHelper.cs delete mode 100644 Material.Blazor/Components/Scheduler/MBScheduler.cs delete mode 100644 Material.Blazor/Components/Scheduler/MBScheduler.md delete mode 100644 Material.Blazor/Components/Scheduler/MBScheduler.scss delete mode 100644 Material.Blazor/Components/Scheduler/MBScheduler.ts delete mode 100644 Material.Blazor/Components/Scheduler/MBSchedulerAppointment.cs diff --git a/Material.Blazor.MD3/Articles/PlusComponents.md b/Material.Blazor.MD3/Articles/PlusComponents.md index aa4ef1482..a523f8db4 100644 --- a/Material.Blazor.MD3/Articles/PlusComponents.md +++ b/Material.Blazor.MD3/Articles/PlusComponents.md @@ -14,7 +14,6 @@ implements further Blazor/Material Theme hybrid components that we term "Plus Co | [MBDateTimeField](xref:C.MBDateTimeField) | A date or date/time typed text field | | [MBDecimalField](xref:C.MBDecimalField) | A numeric decimal text field. | | [MBDoubleField](xref:C.MBDoubleField) | A numeric double text field. | -| [MBGrid](xref:C.MBGrideld) | A data driven table with grouping, sorting, and various data display options. | | [MBRadioButtonGroup](xref:C.MBRadioButtonGroup) | A collection of radio buttons with a single selection | ## Experimental Component List diff --git a/Material.Blazor.MD3/Components/Grid/MBEnumerationsGrid.cs b/Material.Blazor.MD3/Components/Grid/MBEnumerationsGrid.cs deleted file mode 100644 index a55dd6666..000000000 --- a/Material.Blazor.MD3/Components/Grid/MBEnumerationsGrid.cs +++ /dev/null @@ -1,21 +0,0 @@ -// ToDo: -// -// Move enumerations to MBEnumerations -// - -namespace Material.Blazor; - -public enum MB_Grid_Measurement -{ - EM, - FitToData, - Percent, - PX, -} - -public enum MB_Grid_ColumnType -{ - Icon, - Text, - TextColor, -}; diff --git a/Material.Blazor.MD3/Components/Grid/MBGrid.cs b/Material.Blazor.MD3/Components/Grid/MBGrid.cs deleted file mode 100644 index 5c62115d9..000000000 --- a/Material.Blazor.MD3/Components/Grid/MBGrid.cs +++ /dev/null @@ -1,1151 +0,0 @@ -// -// ToDo: -// If we ever have functionality to 'move' rows we need to revisit the -// Steve Sanderson 'best practices' for sequence numbers -// -// Bugs: -// Resolve issue with ElementReferences -// - -using System; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Drawing; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -using Material.Blazor.Internal; -using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Components.Rendering; -using Microsoft.AspNetCore.Components.Web; -using Microsoft.JSInterop; -// -// Implements a scrollable, multi-column grid. When created we get a list of column -// config objects and a list of data objects with the column content for each -// row. -// -// We 'select' a line when it is clicked on so the caller can either immediately respond or -// save the selection for later. -// - -namespace Material.Blazor; - -/// -/// A Material Theme grid capable of displaying icons, colored text, and text. -/// -/// N.B.: At this time the grid is in preview. Expect the API to change. -/// -public class MBGrid : ComponentFoundation -{ - #region Members - - // Remember that adding/removing/renaming parameters requires an update - // to SetParametersAsync - - /// - /// The configuration of each column to be displayed. See the definition of MBGridColumnConfiguration - /// for details. - /// - [Parameter, EditorRequired] public IEnumerable> ColumnConfigurations { get; set; } = null; - - - /// - /// The Group is an optional boolean indicating that grouping is in effect. - /// - [Parameter] public bool Group { get; set; } = false; - - - /// - /// The GroupedOrderedData contains the data to be displayed. - /// The outer key is used for grouping and is directly displayed if grouping is enabled. - /// The inner key must be a unique identifier - /// that is used to indicate a row that has been clicked. - /// - [Parameter, EditorRequired] public IEnumerable>>> GroupedOrderedData { get; set; } - - - /// - /// A boolean indicating whether the selected row is highlighted - /// - [Parameter] public bool HighlightSelectedRow { get; set; } = false; - - -#nullable enable annotations - /// - /// The KeyExpression is used to add a key to each row of the grid - /// - [Parameter] public Func? KeyExpression { get; set; } = null; -#nullable restore annotations - - - /// - /// LogIdentification is added to logging message to allow differentiation between multiple grids - /// on a single page or component - /// - [Parameter] public string LogIdentification { get; set; } = ""; - - - /// - /// Measurement determines the unit of size (EM, Percent, PX) or if the grid is to measure the - /// data widths (FitToData) - /// - [Parameter] public MB_Grid_Measurement Measurement { get; set; } = MB_Grid_Measurement.Percent; - - - /// - /// ObscurePMI controls whether or not columns marked as PMI are obscured. - /// - [Parameter] public bool ObscurePMI { get; set; } - - - /// - /// Callback for a mouse click - /// - [Parameter] public EventCallback OnMouseClickCallback { get; set; } - - - /// - /// Headers are optional - /// - [Parameter] public bool SuppressHeader { get; set; } = false; - - - [Inject] IJSRuntime JsRuntime { get; set; } - - - private float[] ColumnWidthArray; - private ElementReference GridBodyRef { get; set; } - private ElementReference GridHeaderRef { get; set; } - private string GridBodyID { get; set; } = Utilities.GenerateUniqueElementName(); - private string GridHeaderID { get; set; } = Utilities.GenerateUniqueElementName(); - private bool HasCompletedFullRender { get; set; } = false; - private bool IsSimpleRender { get; set; } = true; - private bool IsMeasurementNeeded { get; set; } = false; - private float ScrollWidth { get; set; } - private string SelectedKey { get; set; } = ""; - - //Instantiate a Semaphore with a value of 1. This means that only 1 thread can be granted access at a time. - private readonly SemaphoreSlim semaphoreSlim = new(1, 1); - - private bool ShouldRenderValue { get; set; } = true; - - #endregion - - #region BuildColGroup - private void BuildColGroup(RenderTreeBuilder builder, ref int rendSeq) - { - // Create the sizing colgroup collection - builder.OpenElement(rendSeq++, "colgroup"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-colgroup"); - var colIndex = 0; - foreach (var col in ColumnConfigurations) - { - var styleStr = CreateMeasurementStyle(col, ColumnWidthArray[colIndex]); - builder.OpenElement(rendSeq++, "col"); - builder.AddAttribute(rendSeq++, "style", styleStr); - builder.CloseElement(); // col - colIndex++; - } - builder.CloseElement(); // colgroup - } - #endregion - - #region BuildGridTDElement - private static string BuildGridTDElement( - RenderTreeBuilder builder, - ref int rendSeq, - bool isFirstColumn, - bool isHeaderRow, - string rowBackgroundColorClass) - { - builder.OpenElement(rendSeq++, "td"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-td " + rowBackgroundColorClass); - - if (isHeaderRow) - { - if (isFirstColumn) - { - // T R B L - return " border-width: 1px; border-style: solid; border-color: black; "; - } - else - { - // T R B - return " border-width: 1px 1px 1px 0px; border-style: solid; border-color: black; "; - } - } - else - { - if (isFirstColumn) - { - // R L - return " border-width: 0px 1px 0px 1px; border-style: solid; border-color: black; "; - } - else - { - // R - return " border-width: 0px 1px 0px 0px; border-style: solid; border-color: black; "; - } - } - } - #endregion - - #region BuildRenderTree - protected override void BuildRenderTree(RenderTreeBuilder builder) - { - LoggingService.LogDebug("[" + LogIdentification + "] BuildRenderTree entered; IsSimpleRender == " + IsSimpleRender.ToString()); - LoggingService.LogDebug("[" + LogIdentification + "] HasCompletedFullRender == " + HasCompletedFullRender.ToString()); - LoggingService.LogDebug("[" + LogIdentification + "] ShouldRenderValue == " + ShouldRenderValue.ToString()); - if (IsSimpleRender || (!ShouldRenderValue)) - { - LoggingService.LogDebug("[" + LogIdentification + "] (Simple) entered"); - // We are going to render a DIV and nothing else - // We need to get into OnAfterRenderAsync so that we can use JS interop to measure - // the text - base.BuildRenderTree(builder); - builder.OpenElement(1, "div"); - builder.CloseElement(); - HasCompletedFullRender = false; - LoggingService.LogDebug("[" + LogIdentification + "] (Simple) leaving"); - } - else - { - LoggingService.LogDebug("[" + LogIdentification + "] (Full) entered"); - - // - // Using the column cfg and column data, render our list. Here is the layout. - // The column headers are optional. - // - // div class="@class", style="@style" - // div mb-grid-header - Contains the header and the vscroll - // table - - // tr - - // td* - Header - // div mb-grid-body - Contains the rows and the vscroll - // table - Contains the rows - // tr* - Rows - // td* - Columns of the row - // - - base.BuildRenderTree(builder); - var rendSeq = 2; - string styleStr; - - if (((@class != null) && (@class.Length > 0)) || ((style != null) && (style.Length > 0))) - { - builder.OpenElement(rendSeq++, "div"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-div-outer " + @class); - builder.AddAttribute(rendSeq++, "style", style); - } - - // Based on the column config generate the column titles unless asked not to - if (!SuppressHeader) - { - builder.OpenElement(rendSeq++, "div"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-div-header mb-grid-backgroundcolor-header-background"); - //builder.AddAttribute(rendSeq++, "style", "padding-right: " + ScrollWidth.ToString() + "px; "); - builder.AddAttribute(rendSeq++, "id", GridHeaderID); - builder.AddElementReferenceCapture(rendSeq++, (__value) => { GridHeaderRef = __value; }); - builder.OpenElement(rendSeq++, "table"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-table"); - BuildColGroup(builder, ref rendSeq); - builder.OpenElement(rendSeq++, "thead"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-thead"); - builder.OpenElement(rendSeq++, "tr"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-tr"); - - // For each column output a TD - var isHeaderRow = true; - var colCount = 0; - foreach (var col in ColumnConfigurations) - { - styleStr = BuildGridTDElement( - builder, - ref rendSeq, - colCount == 0, - isHeaderRow, - "mb-grid-backgroundcolor-header-background"); - - // Set the header colors - styleStr += " color: " + col.ForegroundColorHeader.Name + ";"; - styleStr += " background-color : " + col.BackgroundColorHeader.Name + ";"; - - builder.AddAttribute(rendSeq++, "style", styleStr); - builder.AddContent(rendSeq++, col.Title); - - // Close this column TD - builder.CloseElement(); - - colCount++; - } - - builder.CloseElement(); // tr - - builder.CloseElement(); // thead - - builder.CloseElement(); //table - - builder.CloseElement(); // div mb-grid-header - } - - // - // We now need to build a "display centric" data representation with rows added for breaks, etc. - // For the first pass we are going to skip this step and just display the raw content - // - - if (GroupedOrderedData != null) - { - var isFirstGrouper = true; - - // This div holds the scrolled content - builder.OpenElement(rendSeq++, "div"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-div-body"); - builder.AddAttribute(rendSeq++, "id", "mb-grid-div-body"); - builder.AddAttribute(rendSeq++, "onscroll", - EventCallback.Factory.Create(this, GridSyncScroll)); - builder.AddAttribute(rendSeq++, "id", GridBodyID); - builder.AddElementReferenceCapture(rendSeq++, (__value) => { GridBodyRef = __value; }); - builder.OpenElement(rendSeq++, "table"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-table"); - BuildColGroup(builder, ref rendSeq); - builder.OpenElement(rendSeq++, "tbody"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-tbody"); - - foreach (var kvp in GroupedOrderedData) - { - if (Group) - { - // We output a row with the group name - // Do a div for this row - builder.OpenElement(rendSeq++, "tr"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-tr"); - builder.OpenElement(rendSeq++, "td"); - builder.AddAttribute(rendSeq++, "colspan", ColumnConfigurations.Count().ToString()); - builder.AddAttribute(rendSeq++, "class", "mb-grid-td-group mb-grid-backgroundcolor-row-group"); - if (isFirstGrouper) - { - isFirstGrouper = false; - builder.AddAttribute(rendSeq++, "style", "border-top: 1px solid black; "); - } - builder.AddAttribute(rendSeq++, "mbgrid-td-wide", "0"); - builder.AddContent(rendSeq++, " " + kvp.Key); - builder.CloseElement(); // td - builder.CloseElement(); // tr - } - - var rowCount = 0; - foreach (var rowValues in kvp.Value) - { - var rowKey = KeyExpression(rowValues.Value).ToString(); - - string rowBackgroundColorClass; - if ((rowKey == SelectedKey) && HighlightSelectedRow) - { - // It's the selected row so set the selection color as the background - rowBackgroundColorClass = "mb-grid-backgroundcolor-row-selected"; - } - else - { - // Not selected or not highlighted so we alternate - if ((rowCount / 2) * 2 == rowCount) - { - // Even - rowBackgroundColorClass = "mb-grid-backgroundcolor-row-even"; - } - else - { - // Odd - rowBackgroundColorClass = "mb-grid-backgroundcolor-row-odd"; - } - } - - // Do a tr - builder.OpenElement(rendSeq++, "tr"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-tr " + rowBackgroundColorClass); - builder.AddAttribute(rendSeq++, "id", rowKey); - - builder.AddAttribute - ( - rendSeq++, - "onclick", - EventCallback.Factory.Create(this, e => OnMouseClickInternal(rowKey)) - ); - - // For each column output a td - var colCount = 0; - var isHeaderRow = false; - foreach (var columnDefinition in ColumnConfigurations) - { - styleStr = BuildGridTDElement( - builder, - ref rendSeq, - colCount == 0, - isHeaderRow, - rowBackgroundColorClass); - - switch (columnDefinition.ColumnType) - { - case MB_Grid_ColumnType.Icon: - if (columnDefinition.DataExpression != null) - { - try - { - var value = (MBGridIconSpecification)columnDefinition.DataExpression(rowValues.Value); - - styleStr += " text-align: center;"; - builder.AddAttribute(rendSeq++, "style", styleStr); - builder.OpenComponent(rendSeq++, typeof(MBIcon)); - var descriptor = MBIcon.IconDescriptorConstructor( - color: ColorToCSSColor(value.IconColor), - name: value.IconName); - builder.AddAttribute(rendSeq++, "Descriptor", descriptor); - builder.CloseComponent(); - } - catch - { - throw new Exception("Backing value incorrect for MBGrid.Icon column."); - } - } - break; - - case MB_Grid_ColumnType.Text: - // It's a text type column so add the text related styles - // We may be overriding the alternating row color added by class - - if (columnDefinition.ForegroundColorExpression != null) - { - var value = columnDefinition.ForegroundColorExpression(rowValues.Value); - styleStr += - " color: " + ColorToCSSColor((Color)value) + "; "; - } - - if (columnDefinition.BackgroundColorExpression != null) - { - var value = columnDefinition.BackgroundColorExpression(rowValues.Value); - if ((Color)value != Color.Transparent) - { - styleStr += - " background-color: " + ColorToCSSColor((Color)value) + "; "; - } - } - - if (columnDefinition.IsPMI && ObscurePMI) - { - styleStr += - " filter: blur(0.25em); "; - } - - builder.AddAttribute(rendSeq++, "style", styleStr); - - // Bind the object as our content. - if (columnDefinition.DataExpression != null) - { - var value = columnDefinition.DataExpression(rowValues.Value); - var formattedValue = string.IsNullOrEmpty(columnDefinition.FormatString) ? value?.ToString() : string.Format("{0:" + columnDefinition.FormatString + "}", value); - builder.AddContent(1, formattedValue); - } - break; - - case MB_Grid_ColumnType.TextColor: - if (columnDefinition.DataExpression != null) - { - try - { - var value = (MBGridTextColorSpecification)columnDefinition.DataExpression(rowValues.Value); - - if (value.Suppress) - { - builder.AddAttribute(rendSeq++, "style", styleStr); - } - else - { - // We need to add the colors - styleStr += - " color: " + ColorToCSSColor(value.ForegroundColor) - + "; background-color: " + ColorToCSSColor(value.BackgroundColor) + ";"; - - if (columnDefinition.IsPMI && ObscurePMI) - { - styleStr += - " filter: blur(0.25em); "; - } - - builder.AddAttribute(rendSeq++, "style", styleStr); - builder.AddContent(rendSeq++, value.Text); - } - } - catch - { - throw new Exception("Backing value incorrect for MBGrid.TextColor column."); - } - } - break; - - default: - throw new Exception("MBGrid -- Unknown column type"); - } - - // Close this column span - builder.CloseElement(); - - colCount++; - } - - // Close this row's div - builder.CloseElement(); - - rowCount++; - } - } - - builder.CloseElement(); // tbody - - builder.CloseElement(); // table - - builder.CloseElement(); // div mb-grid-body-outer - - if (((@class != null) && (@class.Length > 0)) || ((style != null) && (style.Length > 0))) - { - builder.CloseElement(); // div class= style= - } - } - - HasCompletedFullRender = true; - LoggingService.LogDebug("[" + LogIdentification + "] (Full) leaving"); - } - LoggingService.LogDebug("[" + LogIdentification + "] leaving; IsSimpleRender == " + IsSimpleRender.ToString()); - LoggingService.LogDebug("[" + LogIdentification + "] leaving; HasCompletedFullRender == " + HasCompletedFullRender.ToString()); - } - #endregion - - #region ColorToCSSColor - private static string ColorToCSSColor(Color color) - { - int rawColor = color.ToArgb(); - rawColor &= 0xFFFFFF; - return "#" + rawColor.ToString("X6"); - } - #endregion - - #region CreateMeasurementStyle - private string CreateMeasurementStyle(MBGridColumnConfiguration col, float columnWidth) - { - string subStyle = Measurement switch - { - MB_Grid_Measurement.EM => "em", - MB_Grid_Measurement.FitToData => "", - MB_Grid_Measurement.PX => "px", - MB_Grid_Measurement.Percent => "%", - _ => throw new Exception("Unexpected measurement type in MBGrid"), - }; - - if (subStyle.Length > 0) - { - return - "width: " + col.Width.ToString() + subStyle + " !important; " + - "max-width: " + col.Width.ToString() + subStyle + " !important; " + - "min-width: " + col.Width.ToString() + subStyle + " !important; "; - } - else - { - return - "width: " + columnWidth.ToString() + "px !important; " + - "max-width: " + columnWidth.ToString() + "px !important; " + - "min-width: " + columnWidth.ToString() + "px !important; "; - } - } - #endregion - - #region GridSyncScroll - protected async Task GridSyncScroll() - { - LoggingService.LogDebug("[" + LogIdentification + "] GridSyncScroll()"); - await InvokeJsVoidAsync("MaterialBlazor.MBGrid.syncScrollByID", GridHeaderID, GridBodyID); - //await InvokeVoidAsync("MaterialBlazor.MBGrid.syncScrollByRef", GridHeaderRef, GridBodyRef); - } - #endregion - - #region MeasureWidthsAsync - private async Task MeasureWidthsAsync() - { - if (GroupedOrderedData == null) - { - return; - } - - // Measure the width of a vertical scrollbar (Used to set the padding of the header) - ScrollWidth = await JsRuntime.InvokeAsync( - "MaterialBlazor.MBGrid.getScrollBarWidth", - "mb-grid-div-body"); - ScrollWidth = 0; - - if (Measurement == MB_Grid_Measurement.FitToData) - { - // Create a simple data dictionary from the GroupedDataDictionary - var dataList = new List(); - foreach (var outerKVP in GroupedOrderedData) - { - foreach (var innerKVP in outerKVP.Value) - { - dataList.Add(innerKVP.Value); - } - } - // Measure the header columns - var stringArrayHeader = new string[ColumnConfigurations.Count()]; - var colIndex = 0; - foreach (var col in ColumnConfigurations) - { - stringArrayHeader[colIndex] = col.Title; - colIndex++; - } - - ColumnWidthArray = await JsRuntime.InvokeAsync( - "MaterialBlazor.MBGrid.getTextWidths", - "mb-grid-header-td-measure", - ColumnWidthArray, - stringArrayHeader); - - // Measure the body columns - var stringArrayBody = new string[ColumnConfigurations.Count() * dataList.Count]; - colIndex = 0; - foreach (var enumerableData in dataList) - { - foreach (var columnDefinition in ColumnConfigurations) - { - switch (columnDefinition.ColumnType) - { - case MB_Grid_ColumnType.Icon: - // We let the column width get driven by the title - stringArrayBody[colIndex] = ""; - break; - - case MB_Grid_ColumnType.Text: - if (columnDefinition.DataExpression != null) - { - var value = columnDefinition.DataExpression(enumerableData); - var formattedValue = string.IsNullOrEmpty(columnDefinition.FormatString) ? value?.ToString() : string.Format("{0:" + columnDefinition.FormatString + "}", value); - stringArrayBody[colIndex] = formattedValue; - } - break; - - case MB_Grid_ColumnType.TextColor: - if (columnDefinition.DataExpression != null) - { - try - { - var value = (MBGridTextColorSpecification)columnDefinition.DataExpression(enumerableData); - if (!value.Suppress) - { - stringArrayBody[colIndex] = value.Text; - } - else - { - stringArrayBody[colIndex] = ""; - } - } - catch - { - throw new Exception("Backing value incorrect for MBGrid.TextColor column."); - } - } - break; - - default: - throw new Exception("MBGrid -- Unknown column type"); - } - - colIndex++; - } - } - - if (LoggingService.CurrentLevel() <= (int)MBLoggingLevel.Debug) - { - var total = 0; - foreach (var c in stringArrayBody) - { - if (c != null) - { - total += c.Length; - } - } - LoggingService.LogDebug("[" + LogIdentification + "] Measuring " + stringArrayBody.Length + " strings with a total size of " + total.ToString() + " bytes"); - } - - ColumnWidthArray = await JsRuntime.InvokeAsync( - "MaterialBlazor.MBGrid.getTextWidths", - "mb-grid-body-td-measure", - ColumnWidthArray, - stringArrayBody); - - for (var col = 0; col < ColumnWidthArray.Length; col++) - { - // - // We adjust a bit because we were still getting an ellipsis on the longest text. - // This is caused by the fact that creates - // a 372px wide column - // - - ColumnWidthArray[col] += 1; - } - } - } - #endregion - - #region OnAfterRenderAsync - protected override async Task OnAfterRenderAsync(bool firstRender) - { - var needsSHC = false; - await semaphoreSlim.WaitAsync(); - try - { - await base.OnAfterRenderAsync(firstRender); - - LoggingService.LogDebug("[" + LogIdentification + "] OnAfterRenderAsync entered"); - LoggingService.LogDebug("[" + LogIdentification + "] firstRender: " + firstRender.ToString()); - LoggingService.LogDebug("[" + LogIdentification + "] IsSimpleRender: " + IsSimpleRender.ToString()); - LoggingService.LogDebug("[" + LogIdentification + "] IsMeasurementNeeded: " + IsMeasurementNeeded.ToString()); - - if (IsSimpleRender) - { - IsSimpleRender = false; - needsSHC = true; - } - - if (IsMeasurementNeeded) - { - IsMeasurementNeeded = false; - - if (Measurement == MB_Grid_Measurement.FitToData) - { - LoggingService.LogDebug("[" + LogIdentification + "] Calling MeasureWidthsAsync"); - await MeasureWidthsAsync(); - LoggingService.LogDebug("[" + LogIdentification + "] Returned from MeasureWidthsAsync"); - - needsSHC = true; - } - } - } - finally - { - if (needsSHC) - { - await InvokeAsync(StateHasChanged); - } - - LoggingService.LogDebug("[" + LogIdentification + "] about to release semaphore (OnAfterRenderAsync)"); - - semaphoreSlim.Release(); - } - } - #endregion - - #region OnInitializedAsync - protected override async Task OnInitializedAsync() - { - LoggingService.LogDebug("[" + LogIdentification + "] MBGrid.OnInitializedAsync entered"); - - await base.OnInitializedAsync(); - - if (ColumnConfigurations == null) - { - throw new System.Exception("MBGrid requires column configuration definitions."); - } - - LoggingService.LogDebug("[" + LogIdentification + "] MBGrid.OnInitializedAsync completed"); - } - #endregion - - #region OnMouseClickInternal - private Task OnMouseClickInternal(string newRowKey) - { - LoggingService.LogDebug("[" + LogIdentification + "] OnMouseClickInternal with HighlightSelectedRow:" + HighlightSelectedRow.ToString()); - - if (newRowKey != SelectedKey) - { - SelectedKey = newRowKey; - } - return OnMouseClickCallback.InvokeAsync(newRowKey); - } - #endregion - - #region ScrollToIndicatedRowAsync - public async Task ScrollToIndicatedRowAsync(string rowIdentifier) - { - LoggingService.LogDebug("[" + LogIdentification + "] ScrollToIndicatedRowAsync(" + rowIdentifier + ")"); - await InvokeJsVoidAsync("MaterialBlazor.MBGrid.scrollToIndicatedRow", rowIdentifier); - } - #endregion - - #region SetParametersAsync - private int oldParameterHash { get; set; } = -1; - public override Task SetParametersAsync(ParameterView parameters) - { - LoggingService.LogDebug("[" + LogIdentification + "] SetParametersAsync entry"); - - semaphoreSlim.WaitAsync(); - try - { - var count = parameters.ToDictionary().Count; - LoggingService.LogDebug("[" + LogIdentification + "] SetParametersAsync parameter count: " + count.ToString()); - foreach (var parameter in parameters) - { - LoggingService.LogDebug("[" + LogIdentification + "] SetParametersAsync parameter: " + parameter.Name); - switch (parameter.Name) - { - case nameof(@class): - @class = (string)parameter.Value; - break; - case nameof(ColumnConfigurations): - ColumnConfigurations = (IEnumerable>)parameter.Value; - // - // We are going to measure the actual sizes using JS if the Measurement is FitToData - // We need to create the ColumnWidthArray regardless of the measurement type as we need to pass - // values to BuildColGroup->CreateMeasurementStyle - // - ColumnWidthArray = new float[ColumnConfigurations.Count()]; - break; - case nameof(Group): - Group = (bool)parameter.Value; - break; - case nameof(GroupedOrderedData): - GroupedOrderedData = (IEnumerable>>>)parameter.Value; - break; - case nameof(HighlightSelectedRow): - HighlightSelectedRow = (bool)parameter.Value; - break; - case nameof(KeyExpression): - KeyExpression = (Func)parameter.Value; - break; - case nameof(LogIdentification): - LogIdentification = (string)parameter.Value; - break; - case nameof(Measurement): - Measurement = (MB_Grid_Measurement)parameter.Value; - break; - case nameof(ObscurePMI): - ObscurePMI = (bool)parameter.Value; - break; - case nameof(OnMouseClickCallback): - OnMouseClickCallback = (EventCallback)parameter.Value; - break; - case nameof(style): - style = (string)parameter.Value; - break; - case nameof(SuppressHeader): - SuppressHeader = (bool)parameter.Value; - break; - default: - LoggingService.LogTrace("[" + LogIdentification + "] MBGrid encountered an unknown parameter:" + parameter.Name); - break; - } - } - - LoggingService.LogDebug("[" + LogIdentification + "] about to compute parameter hash"); - - HashCode newConfigurationParametersHash = new(); - - if (HighlightSelectedRow) - { - newConfigurationParametersHash = HashCode - .OfEach(ColumnConfigurations) - .And(@class) - .And(Group) - .And(HighlightSelectedRow) - .And(KeyExpression) - .And(Measurement) - .And(ObscurePMI) - .And(OnMouseClickCallback) - .And(SelectedKey) // Not a parameter but if we don't include this we won't re-render after selecting a row - .And(style) - .And(SuppressHeader); - } - else - { - newConfigurationParametersHash = HashCode - .OfEach(ColumnConfigurations) - .And(@class) - .And(Group) - .And(HighlightSelectedRow) - .And(KeyExpression) - .And(Measurement) - .And(ObscurePMI) - .And(OnMouseClickCallback) - .And(style) - .And(SuppressHeader); - } - LoggingService.LogDebug("[" + LogIdentification + "] 'configuration' parameters hash == " + ((int)newConfigurationParametersHash).ToString()); - - // - // We have to implement the double loop for grouped ordered data as the OfEach/AndEach - // do not recurse into the second enumerable and certainly don't look at the rowValues - // - HashCode newDataParameterHash = new(); - if ((GroupedOrderedData != null) && (ColumnConfigurations != null)) - { - foreach (var kvp in GroupedOrderedData) - { - LoggingService.LogDebug("[" + LogIdentification + "] key == " + kvp.Key + " with " + kvp.Value.Count().ToString() + " rows"); - - foreach (var rowValues in kvp.Value) - { - var rowKey = KeyExpression(rowValues.Value).ToString(); - - newDataParameterHash = new HashCode(HashCode.CombineHashCodes( - newDataParameterHash.value, - HashCode.Of(rowKey))); - - foreach (var columnDefinition in ColumnConfigurations) - { - switch (columnDefinition.ColumnType) - { - case MB_Grid_ColumnType.Icon: - if (columnDefinition.DataExpression != null) - { - try - { - var value = (MBGridIconSpecification)columnDefinition.DataExpression(rowValues.Value); - - newDataParameterHash = new HashCode(HashCode.CombineHashCodes( - newDataParameterHash.value, - HashCode.Of(value))); - } - catch - { - throw new Exception("Backing value incorrect for MBGrid.Icon column."); - } - } - break; - - case MB_Grid_ColumnType.Text: - if (columnDefinition.DataExpression != null) - { - var value = columnDefinition.DataExpression(rowValues.Value); - var formattedValue = string.IsNullOrEmpty(columnDefinition.FormatString) ? value?.ToString() : string.Format("{0:" + columnDefinition.FormatString + "}", value); - - newDataParameterHash = new HashCode(HashCode.CombineHashCodes( - newDataParameterHash.value, - HashCode.Of(value))); - } - break; - - case MB_Grid_ColumnType.TextColor: - if (columnDefinition.DataExpression != null) - { - try - { - var value = (MBGridTextColorSpecification)columnDefinition.DataExpression(rowValues.Value); - - newDataParameterHash = new HashCode(HashCode.CombineHashCodes( - newDataParameterHash.value, - HashCode.Of(value))); - } - catch - { - throw new Exception("Backing value incorrect for MBGrid.TextColor column."); - } - } - break; - - default: - throw new Exception("MBGrid -- Unknown column type"); - } - } - } - } - LoggingService.LogDebug("[" + LogIdentification + "] 'data' parameter hash == " + ((int)newDataParameterHash).ToString()); - } - - HashCode newParameterHash = new HashCode( - HashCode.CombineHashCodes( - newConfigurationParametersHash.value, - newDataParameterHash.value)); - - LoggingService.LogDebug("[" + LogIdentification + "] hash == " + ((int)newParameterHash).ToString()); - if (newParameterHash == oldParameterHash) - { - // This is a call to ParametersSetAsync with what in all likelyhood is the same - // parameters. Hashing isn't perfect so there is some tiny possibility that new parameters - // are present and the same hash value was computed. - if (HasCompletedFullRender) - { - ShouldRenderValue = false; - } - else - { - ShouldRenderValue = true; - } - -// LoggingService.LogDebug("[" + LogIdentification + "] EQUAL hash"); - } - else - { - ShouldRenderValue = true; - IsSimpleRender = true; - IsMeasurementNeeded = true; - oldParameterHash = newParameterHash; - LoggingService.LogDebug("[" + LogIdentification + "] DIFFERING hash"); - } - } - finally - { - LoggingService.LogDebug("[" + LogIdentification + "] about to release semaphore (SetParametersAsync)"); - - semaphoreSlim.Release(); - } - - return base.SetParametersAsync(ParameterView.Empty); - } - #endregion - - #region ShouldRender - protected override bool ShouldRender() - { - return ShouldRenderValue; - } - #endregion - -} - -#region HashCode - -/// -/// A hash code used to help with implementing . -/// -/// This code is from the blog post at https://rehansaeed.com/gethashcode-made-easy/ -/// -public struct HashCode : IEquatable -{ - private const int EmptyCollectionPrimeNumber = 19; - public readonly int value; - - /// - /// Initializes a new instance of the struct. - /// - /// The value. - public HashCode(int value) => this.value = value; - - /// - /// Performs an implicit conversion from to . - /// - /// The hash code. - /// The result of the conversion. - public static implicit operator int(HashCode hashCode) => hashCode.value; - - /// - /// Implements the operator ==. - /// - /// The left. - /// The right. - /// The result of the operator. - public static bool operator ==(HashCode left, HashCode right) => left.Equals(right); - - /// - /// Implements the operator !=. - /// - /// The left. - /// The right. - /// The result of the operator. - public static bool operator !=(HashCode left, HashCode right) => !(left == right); - - /// - /// Takes the hash code of the specified item. - /// - /// The type of the item. - /// The item. - /// The new hash code. - public static HashCode Of(T item) => new HashCode(GetHashCode(item)); - - /// - /// Takes the hash code of the specified items. - /// - /// The type of the items. - /// The collection. - /// The new hash code. - public static HashCode OfEach(IEnumerable items) => - items == null ? new HashCode(0) : new HashCode(GetHashCode(items, 0)); - - /// - /// Adds the hash code of the specified item. - /// - /// The type of the item. - /// The item. - /// The new hash code. - public HashCode And(T item) => - new HashCode(CombineHashCodes(this.value, GetHashCode(item))); - - /// - /// Adds the hash code of the specified items in the collection. - /// - /// The type of the items. - /// The collection. - /// The new hash code. - public HashCode AndEach(IEnumerable items) - { - if (items == null) - { - return new HashCode(this.value); - } - - return new HashCode(GetHashCode(items, this.value)); - } - - public bool Equals(HashCode other) => this.value.Equals(other.value); - - public override bool Equals(object obj) - { - if (obj is HashCode) - { - return this.Equals((HashCode)obj); - } - - return false; - } - - /// - /// Throws . - /// - /// Does not return. - /// Implicitly convert this struct to an to get the hash code. - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => - throw new NotSupportedException( - "Implicitly convert this struct to an int to get the hash code."); - - public static int CombineHashCodes(int h1, int h2) - { - unchecked - { - // Code copied from System.Tuple so it must be the best way to combine hash codes or at least a good one. - return ((h1 << 5) + h1) ^ h2; - } - } - - private static int GetHashCode(T item) => item?.GetHashCode() ?? 0; - - private static int GetHashCode(IEnumerable items, int startHashCode) - { - var temp = startHashCode; - - var enumerator = items.GetEnumerator(); - if (enumerator.MoveNext()) - { - temp = CombineHashCodes(temp, GetHashCode(enumerator.Current)); - - while (enumerator.MoveNext()) - { - temp = CombineHashCodes(temp, GetHashCode(enumerator.Current)); - } - } - else - { - temp = CombineHashCodes(temp, EmptyCollectionPrimeNumber); - } - - return temp; - } -} - -#endregion - diff --git a/Material.Blazor.MD3/Components/Grid/MBGrid.md b/Material.Blazor.MD3/Components/Grid/MBGrid.md deleted file mode 100644 index 390e9531c..000000000 --- a/Material.Blazor.MD3/Components/Grid/MBGrid.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -uid: C.MBGrid -title: MBGrid ---- -# MBGrid<TRowData> - -## Summary - -A grid built on a table base using BuildRenderTree. - -## Warning - -This is a preview version of the grid. The expectation must be that implementation details and the API will change. - -## Details - -- tbd. - -  - -  - -[![Components](https://img.shields.io/static/v1?label=Components&message=Plus&color=red)](xref:A.PlusComponents) -[![Docs](https://img.shields.io/static/v1?label=API%20Documentation&message=MBGrid&color=brightgreen)](xref:Material.Blazor.MBGrid`1) \ No newline at end of file diff --git a/Material.Blazor.MD3/Components/Grid/MBGrid.scss b/Material.Blazor.MD3/Components/Grid/MBGrid.scss deleted file mode 100644 index 725754801..000000000 --- a/Material.Blazor.MD3/Components/Grid/MBGrid.scss +++ /dev/null @@ -1,273 +0,0 @@ -@charset "UTF-8"; - -@use '@material/theme'; -@use '@material/theme/custom-properties'; -@use '@material/theme/color-palette'; -@use 'sass:string'; - -$border-color: color-palette.$blue-grey-500; -$header-color: color-palette.$blue-grey-100; - -$group-row-color: color-palette.$blue-100; -$group-row-color-hover: darken($group-row-color, 4%); - -$odd-row-color: color-palette.$yellow-100; -$odd-row-color-hover: darken($odd-row-color, 4%); - -$even-row-color: color-palette.$yellow-200; -$even-row-color-hover: darken($even-row-color, 4%); - -$selected-row-color: color-palette.$green-100; -$selected-row-color-hover: darken($selected-row-color, 4%); - -:root { - --mb-grid-border-color: #{$border-color}; - --mb-grid-header-color: #{$header-color}; - --mb-grid-group-row-color: #{$group-row-color}; - --mb-grid-group-row-color-hover: #{$group-row-color-hover}; - --mb-grid-odd-row-color: #{$odd-row-color}; - --mb-grid-odd-row-color-hover: #{$odd-row-color-hover}; - --mb-grid-even-row-color: #{$even-row-color}; - --mb-grid-even-row-color-hover: #{$even-row-color-hover}; - --mb-grid-selected-row-color: #{$selected-row-color}; - --mb-grid-selected-row-color-hover: #{$selected-row-color-hover}; -} - -.mb-mgrid { - border-radius: 0px; - - .mdc-data-table__header-cell:first-child { - border-top-left-radius: 0px; - } - - .mdc-data-table__header-cell:last-child { - border-top-right-radius: 0px; - } -} - -.mb-mgrid__colored { - border-color: var(--mb-grid-border-color); - - .mdc-data-table__header-cell { - background-color: var(--mb-grid-header-color); - border-left-color: var(--mb-grid-border-color); - border-bottom-color: var(--mb-grid-border-color); - } - - tbody td { - border-left-color: var(--mb-grid-border-color); - border-bottom-color: var(--mb-grid-border-color); - } - - .mb-mgrid__group-row { - background-color: var(--mb-grid-group-row-color); - - &:hover { - background-color: var(--mb-grid-group-row-color-hover); - } - } - - .mb-mgrid__row:nth-child(odd):not(.mb-mgrid__row-selected) { - background-color: var(--mb-grid-odd-row-color); - - &:hover { - background-color: var(--mb-grid-odd-row-color-hover); - } - } - - .mb-mgrid__row:nth-child(even):not(.mb-mgrid__row-selected) { - background-color: var(--mb-grid-even-row-color); - - &:hover { - background-color: var(--mb-grid-even-row-color-hover); - } - } - - .mb-mgrid__row-selected { - background-color: var(--mb-grid-selected-row-color); - - &:hover { - background-color: var(--mb-grid-selected-row-color-hover); - } - } -} - - -.mb-mgrid__vertical-dividers { - .mdc-data-table__header-cell:not(:first-child), .mb-mgrid__group-row td:not(:first-child), .mb-mgrid__row td:not(:first-child) { - padding-left: 15px; - border-left-width: 1px; - border-left-style: solid; - } -} - - -/* Original grid */ - -.mb-grid-div-outer { - width: 100% !important; - height: 100% !important; - max-width: 100% !important; - max-height: 100% !important; - overflow: hidden; - box-sizing: border-box; - padding: 0; - margin: 0; -} - -.mb-grid-div-header { - font-family: Arial; - font-weight: bolder; - padding: 0; - overflow-x: hidden; - overflow-y: scroll; - text-align: left; - box-sizing: border-box; - display: flex; - flex-direction: row; - flex-shrink: 0; - flex-grow: 0; - flex-basis: auto; - align-items: stretch; -} - -.mb-grid-div-body { - font-family: Arial; - background: lightblue; - font-weight: normal; - padding: 0; - overflow-x: scroll; - overflow-y: scroll; - text-align: left; - box-sizing: border-box; -} - -.mb-grid-table { - border: 0; - border-collapse: collapse; - border-spacing: 0; - -webkit-border-horizontal-spacing: 0px; - -webkit-border-vertical-spacing: 0px; - flex-grow: 1; - overflow: hidden; - font-size: 1.0rem; - table-layout: fixed; - text-align: left; - text-indent: unset; - text-overflow: ellipsis; - text-wrap: none; - vertical-align: middle; - width: 100%; -} - -.mb-grid-colgroup { - display: table-column-group; -} - -.mb-grid-thead { -} - -.mb-grid-tbody { -} - -.mb-grid-tr { -} - -.mb-grid-td { - cursor: default; - display: table-cell; - flex: 0 0 auto; - padding: 4px; - font-size: inherit; - text-overflow: ellipsis; - overflow: hidden; - box-sizing: border-box; - white-space: nowrap; - letter-spacing: initial; -} - -.mb-grid-td-group { - display: table-cell; - color: black; - border-bottom: 0px; - border-left: 1px solid darkblue; - border-right: 1px solid darkblue; - border-top: 2px solid darkblue; - font-size: x-large; - font-weight: bolder; - flex: 0 0 auto; -} - -.mb-grid-backgroundcolor-header-background { - background: lightgray; - background-color: lightgray; -} - -.mb-grid-backgroundcolor-row-even { - background-color: khaki; -} - -.mb-grid-backgroundcolor-row-odd { - background-color: lemonchiffon; -} - -.mb-grid-backgroundcolor-row-group { - background-color: lightblue; -} - -.mb-grid-backgroundcolor-row-selected { - background-color: lightgreen; -} - -.mb-grid-header-td-measure { - font-family: Arial; - font-weight: bolder; - border-collapse: collapse; - border-spacing: 0; - -webkit-border-horizontal-spacing: 0px; - -webkit-border-vertical-spacing: 0px; - text-align: left; - text-indent: unset; - display: table-cell; - flex: 0 0 auto; - padding: 4px; - font-size: inherit; - text-overflow: unset; - letter-spacing: initial; - overflow: hidden; - box-sizing: border-box; - white-space: nowrap; - background: #d3d3d3; - border-width: 1px; - border-style: solid; - border-color: black; - color: Black; - background-color: LightGray; -} - -.mb-grid-body-td-measure { - font-family: Arial; - font-weight: normal; - border-collapse: collapse; - border-spacing: 0; - -webkit-border-horizontal-spacing: 0px; - -webkit-border-vertical-spacing: 0px; - text-align: left; - text-indent: unset; - display: table-cell; - flex: 0 0 auto; - padding: 4px; - font-size: inherit; - text-overflow: unset; - letter-spacing: initial; - overflow: hidden; - box-sizing: border-box; - white-space: nowrap; - background-color: khaki; - border-width: 0px 1px 0px 0px; - border-style: solid; - border-color: black; - color: #000000; - cursor: default; -} - diff --git a/Material.Blazor.MD3/Components/Grid/MBGrid.ts b/Material.Blazor.MD3/Components/Grid/MBGrid.ts deleted file mode 100644 index f35fc376b..000000000 --- a/Material.Blazor.MD3/Components/Grid/MBGrid.ts +++ /dev/null @@ -1,101 +0,0 @@ -export function syncScrollByID(gridHeaderID: string, gridBodyID: string) { - const headerDiv: HTMLElement | null = document.getElementById(gridHeaderID); - const bodyDiv: HTMLElement | null = document.getElementById(gridBodyID); - if ((headerDiv != null) && (bodyDiv != null)) { - headerDiv.scrollLeft = bodyDiv.scrollLeft; - } -} - -export function syncScrollByRef(gridHeaderRef: HTMLElement, gridBodyRef: HTMLElement) { - gridHeaderRef.scrollLeft = gridBodyRef.scrollLeft; -} - -export function getScrollBarWidth(className: string): number { - const firstDiv: HTMLDivElement = document.createElement("div"); - - // Set styles - firstDiv.style.position = 'absolute'; - firstDiv.style.visibility = 'hidden'; - firstDiv.style.whiteSpace = 'nowrap'; - firstDiv.style.left = '-9999px'; - - // Set the class - firstDiv.className = className; - - // Append to the body - document.body.appendChild(firstDiv); - - // Create a second div - const secondDiv: HTMLDivElement = document.createElement("div"); - - // Append it as a child of the first div - firstDiv.appendChild(secondDiv); - - // Calculate width - const width: number = firstDiv.offsetWidth - secondDiv.offsetWidth; - - // Remove the divs - document.body.removeChild(firstDiv); - - return width; -} - -export function getTextWidths( - className: string, - currentWidths: number[], - textToMeasure: string[]): number[] { - - // Create an element - const ele: HTMLDivElement = document.createElement('div'); - - // Set styles - ele.style.position = 'absolute'; - ele.style.visibility = 'hidden'; - ele.style.whiteSpace = 'nowrap'; - ele.style.left = '-9999px'; - - // Set the class - ele.className = className; - - // Append to the body - document.body.appendChild(ele); - - // Log time -// console.log("Prior to for loop in getTextWidths " + new Date().toString()); - - for (let i = 0; i < textToMeasure.length; i++) { - // Set the text - ele.innerText = textToMeasure[i]; - - // Get the width - var width: string = window.getComputedStyle(ele).width; - var unadornedWidth: string = width.slice(0, width.indexOf("px")); - var numericWidth: number = parseFloat(unadornedWidth); - var indexMod = i % currentWidths.length; - - if (numericWidth > currentWidths[indexMod]) { - currentWidths[indexMod] = numericWidth; - } - } - - // Log time -// console.log("Completed for loop in getTextWidths " + new Date().toString()); - - // Remove the element - document.body.removeChild(ele); - - - return currentWidths; -} - -export function scrollToIndicatedRow(rowIdentifier: string) -{ - console.log("scrollToIndicatedRow: " + rowIdentifier); - const row = document.getElementById(rowIdentifier); - console.log("scrollToIndicatedRow element: " + row); - if (row != null) - { - console.log("scrollToIndicatedRow scrollIntoView"); - row.scrollIntoView({ behavior: "smooth", block: "start", inline: "nearest" }); - } -} diff --git a/Material.Blazor.MD3/Components/Grid/MBGridColumnConfiguration.cs b/Material.Blazor.MD3/Components/Grid/MBGridColumnConfiguration.cs deleted file mode 100644 index 8b58364e9..000000000 --- a/Material.Blazor.MD3/Components/Grid/MBGridColumnConfiguration.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Drawing; -using System.Linq.Expressions; - -namespace Material.Blazor; - -public class MBGridColumnConfiguration -{ - public Func BackgroundColorExpression { get; set; } - public Color BackgroundColorHeader { get; set; } - public MB_Grid_ColumnType ColumnType { get; private set; } - public Func DataExpression { get; set; } - public Func ForegroundColorExpression { get; set; } - public Color ForegroundColorHeader { get; set; } - public string FormatString { get; set; } - public bool IsPMI { get; set; } - public Func SuppressDisplayExpression { get; set; } - public string Title { get; set; } - public int Width { get; set; } - - private MBGridColumnConfiguration() { } - public MBGridColumnConfiguration( - Expression> backgroundColorExpression = null, - Color? backgroundColorHeader = null, - MB_Grid_ColumnType columnType = MB_Grid_ColumnType.Text, - Expression> dataExpression = null, - Expression> foregroundColorExpression = null, - Color? foregroundColorHeader = null, - string formatString = null, - bool isPMI = false, - Expression> suppressDisplayExpression = null, - string title = "", - int width = 10) - { - BackgroundColorExpression = backgroundColorExpression?.Compile();// ?? Color.LightGray; - BackgroundColorHeader = backgroundColorHeader ?? Color.LightGray; - ColumnType = columnType; - DataExpression = dataExpression?.Compile(); - ForegroundColorExpression = foregroundColorExpression?.Compile();// ?? Color.Black; - ForegroundColorHeader = foregroundColorHeader ?? Color.Black; - FormatString = formatString; - IsPMI = isPMI; - SuppressDisplayExpression = suppressDisplayExpression?.Compile(); - Title = title; - Width = width; - } -} diff --git a/Material.Blazor.MD3/Components/Grid/MBGridIconSpecification.cs b/Material.Blazor.MD3/Components/Grid/MBGridIconSpecification.cs deleted file mode 100644 index 5b31c0bf7..000000000 --- a/Material.Blazor.MD3/Components/Grid/MBGridIconSpecification.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Drawing; - -namespace Material.Blazor; - -public class MBGridIconSpecification -{ - public Color IconColor { get; set; } - public string IconName { get; set; } -} diff --git a/Material.Blazor.MD3/Components/Grid/MBGridTextColorSpecification.cs b/Material.Blazor.MD3/Components/Grid/MBGridTextColorSpecification.cs deleted file mode 100644 index 25374c548..000000000 --- a/Material.Blazor.MD3/Components/Grid/MBGridTextColorSpecification.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Drawing; - -namespace Material.Blazor; - -public class MBGridTextColorSpecification -{ - public Color BackgroundColor { get; set; } - public Color ForegroundColor { get; set; } - public bool Suppress { get; set; } = false; - public string Text { get; set; } -} diff --git a/Material.Blazor.MD3/Components/Grid/MBGrid_DataHelper.cs b/Material.Blazor.MD3/Components/Grid/MBGrid_DataHelper.cs deleted file mode 100644 index 979c85b4f..000000000 --- a/Material.Blazor.MD3/Components/Grid/MBGrid_DataHelper.cs +++ /dev/null @@ -1,210 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; - -namespace Material.Blazor; - -public enum Direction { Ascending, Descending } -public class MBGrid_DataHelper -{ - public IEnumerable>>> - PrepareGridData( - IEnumerable data, - PropertyInfo dataKeyInfo, - PropertyInfo orderPropertyInfo1 = null, - Direction orderDirection1 = Direction.Ascending, - PropertyInfo orderPropertyInfo2 = null, - Direction orderDirection2 = Direction.Ascending, - bool group = false, - PropertyInfo groupPropertyInfo = null, - IEnumerable groupItemEnumerable = null, - Func, - PropertyInfo, - Direction, - PropertyInfo, - Direction, - IEnumerable> OrderData = null, - Func, - bool, - PropertyInfo, - PropertyInfo, - IEnumerable, - IEnumerable>>>> GroupItems = null - ) - { - IEnumerable orderedData; - - if (OrderData == null) - { - orderedData = orderData( - data, - orderPropertyInfo1, - orderDirection1, - orderPropertyInfo2, - orderDirection2); - } - else - { - orderedData = OrderData( - data, - orderPropertyInfo1, - orderDirection1, - orderPropertyInfo2, - orderDirection2); - } - - if (GroupItems == null) - { - return groupItems( - orderedData, - group, - dataKeyInfo, - groupPropertyInfo, - groupItemEnumerable); - } - else - { - return GroupItems( - orderedData, - group, - dataKeyInfo, - groupPropertyInfo, - groupItemEnumerable); - } - } - - private IEnumerable orderData( - IEnumerable data, - PropertyInfo orderPropertyInfo1, - Direction orderDirection1, - PropertyInfo orderPropertyInfo2, - Direction orderDirection2 - ) - { - // Perform the group(s) - IEnumerable orderedData; - - if (orderPropertyInfo1 == null) - { - // No grouping - orderedData = data; - } - else - { - if (orderPropertyInfo2 == null) - { - // grouping by first property - if (orderDirection1 == Direction.Ascending) - { - orderedData = data.OrderBy(x => orderPropertyInfo1.GetValue(x)); - } - else - { - orderedData = data.OrderByDescending(x => orderPropertyInfo1.GetValue(x)); - } - } - else - { - // grouping by both properties - if (orderDirection1 == Direction.Ascending) - { - if (orderDirection2 == Direction.Ascending) - { - orderedData = data - .OrderBy(x => orderPropertyInfo1.GetValue(x)) - .ThenBy(x => orderPropertyInfo2.GetValue(x)); - } - else - { - orderedData = data - .OrderBy(x => orderPropertyInfo1.GetValue(x)) - .ThenByDescending(x => orderPropertyInfo2.GetValue(x)); - } - } - else - { - if (orderDirection2 == Direction.Ascending) - { - orderedData = data - .OrderByDescending(x => orderPropertyInfo1.GetValue(x)) - .ThenBy(x => orderPropertyInfo2.GetValue(x)); - } - else - { - orderedData = data - .OrderByDescending(x => orderPropertyInfo1.GetValue(x)) - .ThenByDescending(x => orderPropertyInfo2.GetValue(x)); - } - } - } - } - return orderedData; - } - - private IEnumerable>>> - groupItems( - IEnumerable orderedData, - bool group, - PropertyInfo dataKeyInfo, - PropertyInfo groupPropertyInfo, - IEnumerable groupItems) - { - List>>> groupedOrderedData = new(); - - // Perform the grouping - if (!group) - { - var tempDataAsSingleGroup = new List>(); - foreach (var db in orderedData) - { - tempDataAsSingleGroup.Add(new KeyValuePair(dataKeyInfo.GetValue(db).ToString(), db)); - } - groupedOrderedData.Add(new KeyValuePair>>("FauxKey", tempDataAsSingleGroup)); - } - else - { - var groupedData = orderedData - .GroupBy(x => groupPropertyInfo.GetValue(x)) - .ToDictionary(g => g.Key.ToString(), g => g.ToList()); - - if (groupItems == null) - { - // We will default to alphabetical order - var sortedGroupedData = new SortedDictionary>(groupedData, StringComparer.CurrentCultureIgnoreCase); - foreach (var kvp in sortedGroupedData) - { - var tempGroupedSortedData = new List>(); - foreach (var db in kvp.Value) - { - tempGroupedSortedData.Add(new KeyValuePair(dataKeyInfo.GetValue(db).ToString(), db)); - } - groupedOrderedData.Add(new KeyValuePair>>(kvp.Key, tempGroupedSortedData)); - } - } - else - { - foreach (var key in groupItems) - { - if (groupedData.ContainsKey(key)) - { - var tempGroupedSortedData = new List>(); - foreach (var db in groupedData[key]) - { - tempGroupedSortedData.Add(new KeyValuePair(dataKeyInfo.GetValue(db).ToString(), db)); - } - groupedOrderedData.Add(new KeyValuePair>>(key, tempGroupedSortedData)); - } - else - { - var tempEmptyGroupedSortedData = new List>(); - groupedOrderedData.Add(new KeyValuePair>>(key, tempEmptyGroupedSortedData)); - } - } - } - } - - return groupedOrderedData; - } -} - diff --git a/Material.Blazor.MD3/Components/toc.yml b/Material.Blazor.MD3/Components/toc.yml index cb6386017..9ff6d25b7 100644 --- a/Material.Blazor.MD3/Components/toc.yml +++ b/Material.Blazor.MD3/Components/toc.yml @@ -31,9 +31,6 @@ - name: MBFloatingActionButton topicUid: C.MBFloatingActionButton -- name: MBGrid - topicUid: C.MBGrid - - name: MBIcon topicUid: C.MBIcon diff --git a/Material.Blazor.MD3/Scripts/material.blazor.ts b/Material.Blazor.MD3/Scripts/material.blazor.ts index 9316fde3e..82c6f9c3f 100644 --- a/Material.Blazor.MD3/Scripts/material.blazor.ts +++ b/Material.Blazor.MD3/Scripts/material.blazor.ts @@ -7,7 +7,6 @@ import '@material/web/all.js'; M.B.MD3 JS */ import * as MBDialog from '../Components/Dialog/MBDialog'; -import * as MBGrid from '../Components/Grid/MBGrid'; import * as MBMenu from '../Components/Menu/MBMenu'; import * as MBTabs from '../Components/Tabs/MBTabs'; import * as MBTextField from '../Components/TextField/MBTextField'; @@ -20,7 +19,6 @@ import * as MBDataTable from '../Components.MD2/DataTable/MBDataTable'; (window).MaterialBlazor = { MBDialog, - MBGrid, MBMenu, MBTabs, MBTextField, diff --git a/Material.Blazor.MD3/Styles/_material-symbols-outlined.scss b/Material.Blazor.MD3/Styles/_material-symbols-outlined.scss index a09d8a9bf..202bc5b49 100644 --- a/Material.Blazor.MD3/Styles/_material-symbols-outlined.scss +++ b/Material.Blazor.MD3/Styles/_material-symbols-outlined.scss @@ -3,7 +3,7 @@ font-family: 'Material Symbols Outlined'; font-style: normal; font-weight: 100 700; - src: url(https://fonts.gstatic.com/s/materialsymbolsoutlined/v164/kJEhBvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oFsI.woff2) format('woff2'); + src: url(https://fonts.gstatic.com/s/materialsymbolsoutlined/v166/kJEhBvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oFsI.woff2) format('woff2'); } .material-symbols-outlined { diff --git a/Material.Blazor.MD3/Styles/_material-symbols-rounded.scss b/Material.Blazor.MD3/Styles/_material-symbols-rounded.scss index e839806f4..a0c1cd80c 100644 --- a/Material.Blazor.MD3/Styles/_material-symbols-rounded.scss +++ b/Material.Blazor.MD3/Styles/_material-symbols-rounded.scss @@ -3,7 +3,7 @@ font-family: 'Material Symbols Rounded'; font-style: normal; font-weight: 100 700; - src: url(https://fonts.gstatic.com/s/materialsymbolsrounded/v162/sykg-zNym6YjUruM-QrEh7-nyTnjDwKNJ_190Fjzag.woff2) format('woff2'); + src: url(https://fonts.gstatic.com/s/materialsymbolsrounded/v164/sykg-zNym6YjUruM-QrEh7-nyTnjDwKNJ_190Fjzag.woff2) format('woff2'); } .material-symbols-rounded { diff --git a/Material.Blazor.MD3/Styles/_material-symbols-sharp.scss b/Material.Blazor.MD3/Styles/_material-symbols-sharp.scss index cce0ebf22..f7d9e8141 100644 --- a/Material.Blazor.MD3/Styles/_material-symbols-sharp.scss +++ b/Material.Blazor.MD3/Styles/_material-symbols-sharp.scss @@ -3,7 +3,7 @@ font-family: 'Material Symbols Sharp'; font-style: normal; font-weight: 100 700; - src: url(https://fonts.gstatic.com/s/materialsymbolssharp/v160/gNMVW2J8Roq16WD5tFNRaeLQk6-SHQ_R00k4aWE.woff2) format('woff2'); + src: url(https://fonts.gstatic.com/s/materialsymbolssharp/v162/gNMVW2J8Roq16WD5tFNRaeLQk6-SHQ_R00k4aWE.woff2) format('woff2'); } .material-symbols-sharp { diff --git a/Material.Blazor.MD3/Styles/material.blazor.scss b/Material.Blazor.MD3/Styles/material.blazor.scss index 7416fa6df..a4c5d169f 100644 --- a/Material.Blazor.MD3/Styles/material.blazor.scss +++ b/Material.Blazor.MD3/Styles/material.blazor.scss @@ -5,7 +5,6 @@ @use '_material-symbols-rounded.scss'; @use '_material-symbols-sharp.scss'; -@use '../Components/Grid/MBGrid.scss'; @use '../Components/Menu/MBMenu.scss'; @use '../Components/Toast/MBToast.scss'; diff --git a/Material.Blazor.MD3/package-lock.json b/Material.Blazor.MD3/package-lock.json index 578d4aac9..709bf1ead 100644 --- a/Material.Blazor.MD3/package-lock.json +++ b/Material.Blazor.MD3/package-lock.json @@ -10,19 +10,19 @@ "license": "MIT", "devDependencies": { "@babel/cli": "^7.23.9", - "@babel/core": "^7.23.9", + "@babel/core": "^7.24.0", "@babel/plugin-transform-class-properties": "^7.23.3", - "@babel/plugin-transform-object-rest-spread": "^7.23.4", - "@babel/plugin-transform-runtime": "^7.23.9", - "@babel/preset-env": "^7.23.9", + "@babel/plugin-transform-object-rest-spread": "^7.24.0", + "@babel/plugin-transform-runtime": "^7.24.0", + "@babel/preset-env": "^7.24.0", "@babel/preset-typescript": "^7.23.3", - "@material/web": "^1.2.1-nightly.3e934e1.0", + "@material/web": "^1.3.1-nightly.c3d303e.0", "babel-loader": "^9.1.3", "fork-ts-checker-webpack-plugin": "^9.0.2", "material-components-web": "14.0.0", "regexp": "^1.0.0", "sass": "1.39.2", - "terser": "^5.27.2", + "terser": "^5.28.1", "ts-loader": "^9.5.1", "typescript": "^5.3.3", "webpack": "^5.90.3", @@ -94,9 +94,9 @@ } }, "node_modules/@babel/core": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.9.tgz", - "integrity": "sha512-5q0175NOjddqpvvzU+kDiSOAk4PfdO6FvwCWoQ6RO7rTzEe8vlo+4HVfcnAREhD4npMs0e9uZypjTwzZPCf/cw==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.24.0.tgz", + "integrity": "sha512-fQfkg0Gjkza3nf0c7/w6Xf34BW4YvzNfACRLmmb7XRLa6XHdR+K9AlJlxneFfWYf6uhOzuzZVTjF/8KfndZANw==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.2.0", @@ -104,11 +104,11 @@ "@babel/generator": "^7.23.6", "@babel/helper-compilation-targets": "^7.23.6", "@babel/helper-module-transforms": "^7.23.3", - "@babel/helpers": "^7.23.9", - "@babel/parser": "^7.23.9", - "@babel/template": "^7.23.9", - "@babel/traverse": "^7.23.9", - "@babel/types": "^7.23.9", + "@babel/helpers": "^7.24.0", + "@babel/parser": "^7.24.0", + "@babel/template": "^7.24.0", + "@babel/traverse": "^7.24.0", + "@babel/types": "^7.24.0", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -179,9 +179,9 @@ } }, "node_modules/@babel/helper-create-class-features-plugin": { - "version": "7.23.10", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.23.10.tgz", - "integrity": "sha512-2XpP2XhkXzgxecPNEEK8Vz8Asj9aRxt08oKOqtiZoqV2UGZ5T+EkyP9sXQ9nwMxBIG34a7jmasVqoMop7VdPUw==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.24.0.tgz", + "integrity": "sha512-QAH+vfvts51BCsNZ2PhY6HAggnlS6omLLFTsIpeqZk/MmJ6cW7tgz5yRv0fMJThcr6FmbMrENh1RgrWPTYA76g==", "dev": true, "dependencies": { "@babel/helper-annotate-as-pure": "^7.22.5", @@ -324,9 +324,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", - "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.0.tgz", + "integrity": "sha512-9cUznXMG0+FxRuJfvL82QlTqIzhVW9sL0KjMPHhAOOvpQGL8QtdxnBKILjBqxlHyliz0yCa1G903ZXI/FuHy2w==", "dev": true, "engines": { "node": ">=6.9.0" @@ -444,14 +444,14 @@ } }, "node_modules/@babel/helpers": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.9.tgz", - "integrity": "sha512-87ICKgU5t5SzOT7sBMfCOZQ2rHjRU+Pcb9BoILMYz600W6DkVRLFBPwQ18gwUVvggqXivaUakpnxWQGbpywbBQ==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.24.0.tgz", + "integrity": "sha512-ulDZdc0Aj5uLc5nETsa7EPx2L7rM0YJM8r7ck7U73AXi7qOV44IHHRAYZHY6iU1rr3C5N4NtTmMRUJP6kwCWeA==", "dev": true, "dependencies": { - "@babel/template": "^7.23.9", - "@babel/traverse": "^7.23.9", - "@babel/types": "^7.23.9" + "@babel/template": "^7.24.0", + "@babel/traverse": "^7.24.0", + "@babel/types": "^7.24.0" }, "engines": { "node": ">=6.9.0" @@ -472,9 +472,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.9.tgz", - "integrity": "sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.0.tgz", + "integrity": "sha512-QuP/FxEAzMSjXygs8v4N9dvdXzEHN4W1oF3PxuWAtPo08UdM17u89RDMgjLn/mlc56iM0HlLmVkO/wgR+rDgHg==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -1279,14 +1279,14 @@ } }, "node_modules/@babel/plugin-transform-object-rest-spread": { - "version": "7.23.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.23.4.tgz", - "integrity": "sha512-9x9K1YyeQVw0iOXJlIzwm8ltobIIv7j2iLyP2jIhEbqPRQ7ScNgwQufU2I0Gq11VjyG4gI4yMXt2VFags+1N3g==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.24.0.tgz", + "integrity": "sha512-y/yKMm7buHpFFXfxVFS4Vk1ToRJDilIa6fKRioB9Vjichv58TDGXTvqV0dN7plobAmTW5eSEGXDngE+Mm+uO+w==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.23.3", - "@babel/helper-compilation-targets": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5", + "@babel/compat-data": "^7.23.5", + "@babel/helper-compilation-targets": "^7.23.6", + "@babel/helper-plugin-utils": "^7.24.0", "@babel/plugin-syntax-object-rest-spread": "^7.8.3", "@babel/plugin-transform-parameters": "^7.23.3" }, @@ -1442,13 +1442,13 @@ } }, "node_modules/@babel/plugin-transform-runtime": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.23.9.tgz", - "integrity": "sha512-A7clW3a0aSjm3ONU9o2HAILSegJCYlEZmOhmBRReVtIpY/Z/p7yIZ+wR41Z+UipwdGuqwtID/V/dOdZXjwi9gQ==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.24.0.tgz", + "integrity": "sha512-zc0GA5IitLKJrSfXlXmp8KDqLrnGECK7YRfQBmEKg1NmBOQ7e+KuclBEKJgzifQeUYLdNiAw4B4bjyvzWVLiSA==", "dev": true, "dependencies": { "@babel/helper-module-imports": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-plugin-utils": "^7.24.0", "babel-plugin-polyfill-corejs2": "^0.4.8", "babel-plugin-polyfill-corejs3": "^0.9.0", "babel-plugin-polyfill-regenerator": "^0.5.5", @@ -1619,14 +1619,14 @@ } }, "node_modules/@babel/preset-env": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.23.9.tgz", - "integrity": "sha512-3kBGTNBBk9DQiPoXYS0g0BYlwTQYUTifqgKTjxUwEUkduRT2QOa0FPGBJ+NROQhGyYO5BuTJwGvBnqKDykac6A==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.24.0.tgz", + "integrity": "sha512-ZxPEzV9IgvGn73iK0E6VB9/95Nd7aMFpbE0l8KQFDG70cOV9IxRP7Y2FUPmlK0v6ImlLqYX50iuZ3ZTVhOF2lA==", "dev": true, "dependencies": { "@babel/compat-data": "^7.23.5", "@babel/helper-compilation-targets": "^7.23.6", - "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-plugin-utils": "^7.24.0", "@babel/helper-validator-option": "^7.23.5", "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.23.3", "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.23.3", @@ -1679,7 +1679,7 @@ "@babel/plugin-transform-new-target": "^7.23.3", "@babel/plugin-transform-nullish-coalescing-operator": "^7.23.4", "@babel/plugin-transform-numeric-separator": "^7.23.4", - "@babel/plugin-transform-object-rest-spread": "^7.23.4", + "@babel/plugin-transform-object-rest-spread": "^7.24.0", "@babel/plugin-transform-object-super": "^7.23.3", "@babel/plugin-transform-optional-catch-binding": "^7.23.4", "@babel/plugin-transform-optional-chaining": "^7.23.4", @@ -1752,9 +1752,9 @@ "dev": true }, "node_modules/@babel/runtime": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.9.tgz", - "integrity": "sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.0.tgz", + "integrity": "sha512-Chk32uHMg6TnQdvw2e9IlqPpFX/6NLuK0Ys2PqLb7/gL5uFn9mXvK715FGLlOLQrcO4qIkNHkvPGktzzXexsFw==", "dev": true, "dependencies": { "regenerator-runtime": "^0.14.0" @@ -1764,23 +1764,23 @@ } }, "node_modules/@babel/template": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.23.9.tgz", - "integrity": "sha512-+xrD2BWLpvHKNmX2QbpdpsBaWnRxahMwJjO+KZk2JOElj5nSmKezyS1B4u+QbHMTX69t4ukm6hh9lsYQ7GHCKA==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.0.tgz", + "integrity": "sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA==", "dev": true, "dependencies": { "@babel/code-frame": "^7.23.5", - "@babel/parser": "^7.23.9", - "@babel/types": "^7.23.9" + "@babel/parser": "^7.24.0", + "@babel/types": "^7.24.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.9.tgz", - "integrity": "sha512-I/4UJ9vs90OkBtY6iiiTORVMyIhJ4kAVmsKo9KFc8UOxMeUfi2hvtIBsET5u9GizXE6/GFSuKCTNfgCswuEjRg==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.0.tgz", + "integrity": "sha512-HfuJlI8qq3dEDmNU5ChzzpZRWq+oxCZQyMzIMEqLho+AQnhMnKQUzH6ydo3RBl/YjPCuk68Y6s0Gx0AeyULiWw==", "dev": true, "dependencies": { "@babel/code-frame": "^7.23.5", @@ -1789,8 +1789,8 @@ "@babel/helper-function-name": "^7.23.0", "@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.23.9", - "@babel/types": "^7.23.9", + "@babel/parser": "^7.24.0", + "@babel/types": "^7.24.0", "debug": "^4.3.1", "globals": "^11.1.0" }, @@ -1799,9 +1799,9 @@ } }, "node_modules/@babel/types": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.9.tgz", - "integrity": "sha512-dQjSq/7HaSjRM43FFGnv5keM2HsxpmyV1PfaSVm0nzzjwwTmjOe6J4bC8e3+pTEIgHaHj+1ZlLThRJ2auc/w1Q==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.0.tgz", + "integrity": "sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w==", "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.23.4", @@ -1822,9 +1822,9 @@ } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", - "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.4.tgz", + "integrity": "sha512-Oud2QPM5dHviZNn4y/WhhYKSXksv+1xLEIsNrAbGcFzUN3ubqWRFT5gwPchNc5NuzILOU4tPBDTZ4VwhL8Y7cw==", "dev": true, "dependencies": { "@jridgewell/set-array": "^1.0.1", @@ -1845,9 +1845,9 @@ } }, "node_modules/@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true, "engines": { "node": ">=6.0.0" @@ -1870,9 +1870,9 @@ "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.22", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz", - "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==", + "version": "0.3.23", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.23.tgz", + "integrity": "sha512-9/4foRoUKp8s96tSkh8DlAAc5A0Ty8vLXld+l9gjKKY6ckwI8G15f0hskGmuLZu78ZlGa1vtsfOa+lnB4vG6Jg==", "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", @@ -2679,9 +2679,9 @@ } }, "node_modules/@material/web": { - "version": "1.2.1-nightly.3e934e1.0", - "resolved": "https://registry.npmjs.org/@material/web/-/web-1.2.1-nightly.3e934e1.0.tgz", - "integrity": "sha512-vWrhZyTXVhPB152V60k26MhVt24r4OY4vFqfZBS6RqvEMYuSoC2t4PVrWiXYzFFDdGOZbvF+7XWfiea+XdE+BQ==", + "version": "1.3.1-nightly.c3d303e.0", + "resolved": "https://registry.npmjs.org/@material/web/-/web-1.3.1-nightly.c3d303e.0.tgz", + "integrity": "sha512-f9bP2ajpebxznK6usyCgXNRBxb3oGiGRZIpsQT6FbGb0U1PF6B+CRpVCwcxmPPwucnbnkHRIDqfALeDw8EeLAg==", "dev": true, "dependencies": { "lit": "^2.7.4 || ^3.0.0", @@ -2696,9 +2696,9 @@ "optional": true }, "node_modules/@types/eslint": { - "version": "8.56.2", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.2.tgz", - "integrity": "sha512-uQDwm1wFHmbBbCZCqAlq6Do9LYwByNZHWzXppSnay9SuwJ+VRbjkbLABer54kcPnMSlG6Fdiy2yaFXm/z9Z5gw==", + "version": "8.56.5", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.5.tgz", + "integrity": "sha512-u5/YPJHo1tvkSF2CE0USEkxon82Z5DBy2xR+qfyYNszpX9qcs4sT6uq2kBbj4BXY1+DBGDPnrhMZV3pKWGNukw==", "dev": true, "dependencies": { "@types/estree": "*", @@ -2728,9 +2728,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.19", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", - "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", + "version": "20.11.24", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.24.tgz", + "integrity": "sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -3182,9 +3182,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001588", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001588.tgz", - "integrity": "sha512-+hVY9jE44uKLkH0SrUTqxjxqNTOWHsbnQDIKjwkZ3lNTzUUVdBLBGXtj/q5Mp5u98r3droaZAewQuEDzjQdZlQ==", + "version": "1.0.30001591", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001591.tgz", + "integrity": "sha512-PCzRMei/vXjJyL5mJtzNiUCKP59dm8Apqc3PH8gJkMnMXZGox93RbE76jHsmLwmIo6/3nsYIpJtx0O7u5PqFuQ==", "dev": true, "funding": [ { @@ -3390,15 +3390,15 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.677", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.677.tgz", - "integrity": "sha512-erDa3CaDzwJOpyvfKhOiJjBVNnMM0qxHq47RheVVwsSQrgBA9ZSGV9kdaOfZDPXcHzhG7lBxhj6A7KvfLJBd6Q==", + "version": "1.4.687", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.687.tgz", + "integrity": "sha512-Ic85cOuXSP6h7KM0AIJ2hpJ98Bo4hyTUjc4yjMbkvD+8yTxEhfK9+8exT2KKYsSjnCn2tGsKVSZwE7ZgTORQCw==", "dev": true }, "node_modules/enhanced-resolve": { - "version": "5.15.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", - "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", + "version": "5.15.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.1.tgz", + "integrity": "sha512-3d3JRbwsCLJsYgvb6NuWEG44jjPSOMuS73L/6+7BZuoKm3W+qXnSoIYVHi8dG7Qcg4inAY4jbzkZ7MnskePeDg==", "dev": true, "dependencies": { "graceful-fs": "^4.2.4", @@ -4995,9 +4995,9 @@ } }, "node_modules/terser": { - "version": "5.27.2", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.27.2.tgz", - "integrity": "sha512-sHXmLSkImesJ4p5apTeT63DsV4Obe1s37qT8qvwHRmVxKTBH7Rv9Wr26VcAMmLbmk9UliiwK8z+657NyJHHy/w==", + "version": "5.28.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.28.1.tgz", + "integrity": "sha512-wM+bZp54v/E9eRRGXb5ZFDvinrJIOaTapx3WUokyVGZu5ucVCK55zEgGd5Dl2fSr3jUo5sDiERErUWLY6QPFyA==", "dev": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", diff --git a/Material.Blazor.MD3/package.json b/Material.Blazor.MD3/package.json index 04b1097e2..2533c9d6b 100644 --- a/Material.Blazor.MD3/package.json +++ b/Material.Blazor.MD3/package.json @@ -20,19 +20,19 @@ "license": "MIT", "devDependencies": { "@babel/cli": "^7.23.9", - "@babel/core": "^7.23.9", + "@babel/core": "^7.24.0", "@babel/plugin-transform-class-properties": "^7.23.3", - "@babel/plugin-transform-object-rest-spread": "^7.23.4", - "@babel/plugin-transform-runtime": "^7.23.9", - "@babel/preset-env": "^7.23.9", + "@babel/plugin-transform-object-rest-spread": "^7.24.0", + "@babel/plugin-transform-runtime": "^7.24.0", + "@babel/preset-env": "^7.24.0", "@babel/preset-typescript": "^7.23.3", - "@material/web": "^1.2.1-nightly.3e934e1.0", + "@material/web": "^1.3.1-nightly.c3d303e.0", "babel-loader": "^9.1.3", "fork-ts-checker-webpack-plugin": "^9.0.2", "material-components-web": "14.0.0", "regexp": "^1.0.0", "sass": "1.39.2", - "terser": "^5.27.2", + "terser": "^5.28.1", "ts-loader": "^9.5.1", "typescript": "^5.3.3", "webpack": "^5.90.3", diff --git a/Material.Blazor.Test/Material.Blazor.Test.csproj b/Material.Blazor.Test/Material.Blazor.Test.csproj index 9a72ec3ec..1aebf2951 100644 --- a/Material.Blazor.Test/Material.Blazor.Test.csproj +++ b/Material.Blazor.Test/Material.Blazor.Test.csproj @@ -8,8 +8,8 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Material.Blazor.Website.MD3/Material.Blazor.Website.MD3.csproj b/Material.Blazor.Website.MD3/Material.Blazor.Website.MD3.csproj index 63732969b..bdc1277ae 100644 --- a/Material.Blazor.Website.MD3/Material.Blazor.Website.MD3.csproj +++ b/Material.Blazor.Website.MD3/Material.Blazor.Website.MD3.csproj @@ -39,7 +39,7 @@ - + diff --git a/Material.Blazor.Website.MD3/Pages/Grid.razor b/Material.Blazor.Website.MD3/Pages/Grid.razor deleted file mode 100644 index 4edff3948..000000000 --- a/Material.Blazor.Website.MD3/Pages/Grid.razor +++ /dev/null @@ -1,227 +0,0 @@ -@page "/grid" - -@using Material.Blazor - -@inject IMBToastService ToastService - - - -

- Shows a grid using many of the grid features. -

-
- - -
- - -

- Grid showing the raw data -

- - -
-
-
- -
- - -

- Grid showing the data sorted by family name then given name -

- - -
-
-
- -
- - -

- Sorted, Grouped grid hiding the grouping column without group list -

- - -
-
-
- -
- - -

- Sorted, Grouped grid hiding the grouping column with group list -

- - -
-
-
- -
-
- -@code { - private class Person - { - public Guid UniqueIdentifier { get; set; } - public string Salutation { get; set; } - public string GivenName { get; set; } - public string FamilyName { get; set; } - - public override string ToString() - { - return $"{Salutation} {GivenName} {FamilyName}"; - } - } - - private Person[] People = -{ - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Marie", FamilyName = "Curie" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Albert", FamilyName = "Einstein" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Andrew", FamilyName = "Huxley" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Bob", FamilyName = "Dylan" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Barack", FamilyName = "Obama" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Ms", GivenName = "Nadine", FamilyName = "Gordimer" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Muhammad", FamilyName = "Yunus" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "RtHon", GivenName = "Lord", FamilyName = "Rayleigh" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Ms", GivenName = "Grazia", FamilyName = "Deledda" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Jean-Paul", FamilyName = "Sartre" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Esther", FamilyName = "Duflo" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Yoshinori", FamilyName = "Ohsumi" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Robert", FamilyName = "Merton" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Steven", FamilyName = "McClintock" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Joseph", FamilyName = "McClintock" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Barbara", FamilyName = "McClintock" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Boris", FamilyName = "Pasternak" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Willy", FamilyName = "Brandt" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Isaac", FamilyName = "Bashevis Singer" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Ms", GivenName = "Olga", FamilyName = "Tokarczuk" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Günter", FamilyName = "Grass" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "John", FamilyName = "Hume" }, - }; - - private IEnumerable>>> PeopleAsRawData; - private IEnumerable>>> PeopleAsOrderedData; - private IEnumerable>>> PeopleAsGroupedData; - private IEnumerable>>> PeopleAsGroupedDataWithGroupList; - private List GroupOrderedList = new(); - private List> ColumnConfigurations { get; set; } = null; - private List> ColumnConfigurations2 { get; set; } = null; - - public Grid() - { - GroupOrderedList.Add("Dr"); - GroupOrderedList.Add("Mr"); - GroupOrderedList.Add("Ms"); - GroupOrderedList.Add("Prof"); - GroupOrderedList.Add("Professor"); - GroupOrderedList.Add("RtHon"); - - PeopleAsRawData = new MBGrid_DataHelper().PrepareGridData( - People, - typeof(Person).GetProperty("UniqueIdentifier") - ); - - PeopleAsOrderedData = new MBGrid_DataHelper().PrepareGridData( - People, - typeof(Person).GetProperty("UniqueIdentifier"), - typeof(Person).GetProperty("FamilyName"), - orderPropertyInfo2: typeof(Person).GetProperty("GivenName") - ); - - PeopleAsGroupedData = new MBGrid_DataHelper().PrepareGridData( - People, - typeof(Person).GetProperty("UniqueIdentifier"), - typeof(Person).GetProperty("FamilyName"), - orderPropertyInfo2: typeof(Person).GetProperty("GivenName"), - group: true, - groupPropertyInfo: typeof(Person).GetProperty("Salutation") - ); - - PeopleAsGroupedDataWithGroupList = new MBGrid_DataHelper().PrepareGridData( - People, - typeof(Person).GetProperty("UniqueIdentifier"), - typeof(Person).GetProperty("FamilyName"), - orderPropertyInfo2: typeof(Person).GetProperty("GivenName"), - group: true, - groupPropertyInfo: typeof(Person).GetProperty("Salutation"), - groupItemEnumerable: GroupOrderedList - ); - - ColumnConfigurations = new List>(); - - ColumnConfigurations.Add(new MBGridColumnConfiguration( - dataExpression: c => c.GivenName, - title: "Given name", - width: 10)); - ColumnConfigurations.Add(new MBGridColumnConfiguration( - dataExpression: c => c.FamilyName, - title: "Family name", - width: 15)); - ColumnConfigurations.Add(new MBGridColumnConfiguration( - width: 75)); - - - ColumnConfigurations2 = new List>(); - - ColumnConfigurations2.Add(new MBGridColumnConfiguration( - dataExpression: c => c.Salutation, - title: "Salutation", - width: 10)); - ColumnConfigurations2.Add(new MBGridColumnConfiguration( - dataExpression: c => c.GivenName, - title: "Given name", - width: 10)); - ColumnConfigurations2.Add(new MBGridColumnConfiguration( - dataExpression: c => c.FamilyName, - title: "Family name", - width: 15)); - ColumnConfigurations2.Add(new MBGridColumnConfiguration( - width: 65)); - } - - protected async Task MBGridRowClicked(string guid) - { - await Task.CompletedTask; - - ToastService.ShowToast( - heading: "Row clicked", - message: $"You clicked on '{guid}'", - level: MBToastLevel.Success, - showIcon: false); - } - -} \ No newline at end of file diff --git a/Material.Blazor.Website.MD3/Shared/MainLayout.razor b/Material.Blazor.Website.MD3/Shared/MainLayout.razor index 954486efd..b25a7d3cd 100644 --- a/Material.Blazor.Website.MD3/Shared/MainLayout.razor +++ b/Material.Blazor.Website.MD3/Shared/MainLayout.razor @@ -64,10 +64,6 @@ LeadingIcon="offline_bolt" Label="Floating Action Button" @onclick="@(() => ListItemClickHandler("floatingactionbutton"))" /> - =6.9.0" @@ -443,14 +443,14 @@ } }, "node_modules/@babel/helpers": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.9.tgz", - "integrity": "sha512-87ICKgU5t5SzOT7sBMfCOZQ2rHjRU+Pcb9BoILMYz600W6DkVRLFBPwQ18gwUVvggqXivaUakpnxWQGbpywbBQ==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.24.0.tgz", + "integrity": "sha512-ulDZdc0Aj5uLc5nETsa7EPx2L7rM0YJM8r7ck7U73AXi7qOV44IHHRAYZHY6iU1rr3C5N4NtTmMRUJP6kwCWeA==", "dev": true, "dependencies": { - "@babel/template": "^7.23.9", - "@babel/traverse": "^7.23.9", - "@babel/types": "^7.23.9" + "@babel/template": "^7.24.0", + "@babel/traverse": "^7.24.0", + "@babel/types": "^7.24.0" }, "engines": { "node": ">=6.9.0" @@ -471,9 +471,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.9.tgz", - "integrity": "sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.0.tgz", + "integrity": "sha512-QuP/FxEAzMSjXygs8v4N9dvdXzEHN4W1oF3PxuWAtPo08UdM17u89RDMgjLn/mlc56iM0HlLmVkO/wgR+rDgHg==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -1278,14 +1278,14 @@ } }, "node_modules/@babel/plugin-transform-object-rest-spread": { - "version": "7.23.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.23.4.tgz", - "integrity": "sha512-9x9K1YyeQVw0iOXJlIzwm8ltobIIv7j2iLyP2jIhEbqPRQ7ScNgwQufU2I0Gq11VjyG4gI4yMXt2VFags+1N3g==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.24.0.tgz", + "integrity": "sha512-y/yKMm7buHpFFXfxVFS4Vk1ToRJDilIa6fKRioB9Vjichv58TDGXTvqV0dN7plobAmTW5eSEGXDngE+Mm+uO+w==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.23.3", - "@babel/helper-compilation-targets": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5", + "@babel/compat-data": "^7.23.5", + "@babel/helper-compilation-targets": "^7.23.6", + "@babel/helper-plugin-utils": "^7.24.0", "@babel/plugin-syntax-object-rest-spread": "^7.8.3", "@babel/plugin-transform-parameters": "^7.23.3" }, @@ -1441,13 +1441,13 @@ } }, "node_modules/@babel/plugin-transform-runtime": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.23.9.tgz", - "integrity": "sha512-A7clW3a0aSjm3ONU9o2HAILSegJCYlEZmOhmBRReVtIpY/Z/p7yIZ+wR41Z+UipwdGuqwtID/V/dOdZXjwi9gQ==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.24.0.tgz", + "integrity": "sha512-zc0GA5IitLKJrSfXlXmp8KDqLrnGECK7YRfQBmEKg1NmBOQ7e+KuclBEKJgzifQeUYLdNiAw4B4bjyvzWVLiSA==", "dev": true, "dependencies": { "@babel/helper-module-imports": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-plugin-utils": "^7.24.0", "babel-plugin-polyfill-corejs2": "^0.4.8", "babel-plugin-polyfill-corejs3": "^0.9.0", "babel-plugin-polyfill-regenerator": "^0.5.5", @@ -1618,14 +1618,14 @@ } }, "node_modules/@babel/preset-env": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.23.9.tgz", - "integrity": "sha512-3kBGTNBBk9DQiPoXYS0g0BYlwTQYUTifqgKTjxUwEUkduRT2QOa0FPGBJ+NROQhGyYO5BuTJwGvBnqKDykac6A==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.24.0.tgz", + "integrity": "sha512-ZxPEzV9IgvGn73iK0E6VB9/95Nd7aMFpbE0l8KQFDG70cOV9IxRP7Y2FUPmlK0v6ImlLqYX50iuZ3ZTVhOF2lA==", "dev": true, "dependencies": { "@babel/compat-data": "^7.23.5", "@babel/helper-compilation-targets": "^7.23.6", - "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-plugin-utils": "^7.24.0", "@babel/helper-validator-option": "^7.23.5", "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.23.3", "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.23.3", @@ -1678,7 +1678,7 @@ "@babel/plugin-transform-new-target": "^7.23.3", "@babel/plugin-transform-nullish-coalescing-operator": "^7.23.4", "@babel/plugin-transform-numeric-separator": "^7.23.4", - "@babel/plugin-transform-object-rest-spread": "^7.23.4", + "@babel/plugin-transform-object-rest-spread": "^7.24.0", "@babel/plugin-transform-object-super": "^7.23.3", "@babel/plugin-transform-optional-catch-binding": "^7.23.4", "@babel/plugin-transform-optional-chaining": "^7.23.4", @@ -1751,9 +1751,9 @@ "dev": true }, "node_modules/@babel/runtime": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.9.tgz", - "integrity": "sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.0.tgz", + "integrity": "sha512-Chk32uHMg6TnQdvw2e9IlqPpFX/6NLuK0Ys2PqLb7/gL5uFn9mXvK715FGLlOLQrcO4qIkNHkvPGktzzXexsFw==", "dev": true, "dependencies": { "regenerator-runtime": "^0.14.0" @@ -1763,23 +1763,23 @@ } }, "node_modules/@babel/template": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.23.9.tgz", - "integrity": "sha512-+xrD2BWLpvHKNmX2QbpdpsBaWnRxahMwJjO+KZk2JOElj5nSmKezyS1B4u+QbHMTX69t4ukm6hh9lsYQ7GHCKA==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.0.tgz", + "integrity": "sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA==", "dev": true, "dependencies": { "@babel/code-frame": "^7.23.5", - "@babel/parser": "^7.23.9", - "@babel/types": "^7.23.9" + "@babel/parser": "^7.24.0", + "@babel/types": "^7.24.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.9.tgz", - "integrity": "sha512-I/4UJ9vs90OkBtY6iiiTORVMyIhJ4kAVmsKo9KFc8UOxMeUfi2hvtIBsET5u9GizXE6/GFSuKCTNfgCswuEjRg==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.0.tgz", + "integrity": "sha512-HfuJlI8qq3dEDmNU5ChzzpZRWq+oxCZQyMzIMEqLho+AQnhMnKQUzH6ydo3RBl/YjPCuk68Y6s0Gx0AeyULiWw==", "dev": true, "dependencies": { "@babel/code-frame": "^7.23.5", @@ -1788,8 +1788,8 @@ "@babel/helper-function-name": "^7.23.0", "@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.23.9", - "@babel/types": "^7.23.9", + "@babel/parser": "^7.24.0", + "@babel/types": "^7.24.0", "debug": "^4.3.1", "globals": "^11.1.0" }, @@ -1798,9 +1798,9 @@ } }, "node_modules/@babel/types": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.9.tgz", - "integrity": "sha512-dQjSq/7HaSjRM43FFGnv5keM2HsxpmyV1PfaSVm0nzzjwwTmjOe6J4bC8e3+pTEIgHaHj+1ZlLThRJ2auc/w1Q==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.0.tgz", + "integrity": "sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w==", "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.23.4", @@ -1821,9 +1821,9 @@ } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", - "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.4.tgz", + "integrity": "sha512-Oud2QPM5dHviZNn4y/WhhYKSXksv+1xLEIsNrAbGcFzUN3ubqWRFT5gwPchNc5NuzILOU4tPBDTZ4VwhL8Y7cw==", "dev": true, "dependencies": { "@jridgewell/set-array": "^1.0.1", @@ -1844,9 +1844,9 @@ } }, "node_modules/@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true, "engines": { "node": ">=6.0.0" @@ -1869,9 +1869,9 @@ "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.22", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz", - "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==", + "version": "0.3.23", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.23.tgz", + "integrity": "sha512-9/4foRoUKp8s96tSkh8DlAAc5A0Ty8vLXld+l9gjKKY6ckwI8G15f0hskGmuLZu78ZlGa1vtsfOa+lnB4vG6Jg==", "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", @@ -2670,9 +2670,9 @@ "optional": true }, "node_modules/@types/eslint": { - "version": "8.56.2", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.2.tgz", - "integrity": "sha512-uQDwm1wFHmbBbCZCqAlq6Do9LYwByNZHWzXppSnay9SuwJ+VRbjkbLABer54kcPnMSlG6Fdiy2yaFXm/z9Z5gw==", + "version": "8.56.5", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.5.tgz", + "integrity": "sha512-u5/YPJHo1tvkSF2CE0USEkxon82Z5DBy2xR+qfyYNszpX9qcs4sT6uq2kBbj4BXY1+DBGDPnrhMZV3pKWGNukw==", "dev": true, "dependencies": { "@types/estree": "*", @@ -2702,9 +2702,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.19", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", - "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", + "version": "20.11.24", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.24.tgz", + "integrity": "sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -3150,9 +3150,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001588", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001588.tgz", - "integrity": "sha512-+hVY9jE44uKLkH0SrUTqxjxqNTOWHsbnQDIKjwkZ3lNTzUUVdBLBGXtj/q5Mp5u98r3droaZAewQuEDzjQdZlQ==", + "version": "1.0.30001591", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001591.tgz", + "integrity": "sha512-PCzRMei/vXjJyL5mJtzNiUCKP59dm8Apqc3PH8gJkMnMXZGox93RbE76jHsmLwmIo6/3nsYIpJtx0O7u5PqFuQ==", "dev": true, "funding": [ { @@ -3358,15 +3358,15 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.677", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.677.tgz", - "integrity": "sha512-erDa3CaDzwJOpyvfKhOiJjBVNnMM0qxHq47RheVVwsSQrgBA9ZSGV9kdaOfZDPXcHzhG7lBxhj6A7KvfLJBd6Q==", + "version": "1.4.687", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.687.tgz", + "integrity": "sha512-Ic85cOuXSP6h7KM0AIJ2hpJ98Bo4hyTUjc4yjMbkvD+8yTxEhfK9+8exT2KKYsSjnCn2tGsKVSZwE7ZgTORQCw==", "dev": true }, "node_modules/enhanced-resolve": { - "version": "5.15.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", - "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", + "version": "5.15.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.1.tgz", + "integrity": "sha512-3d3JRbwsCLJsYgvb6NuWEG44jjPSOMuS73L/6+7BZuoKm3W+qXnSoIYVHi8dG7Qcg4inAY4jbzkZ7MnskePeDg==", "dev": true, "dependencies": { "graceful-fs": "^4.2.4", @@ -4932,9 +4932,9 @@ } }, "node_modules/terser": { - "version": "5.27.2", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.27.2.tgz", - "integrity": "sha512-sHXmLSkImesJ4p5apTeT63DsV4Obe1s37qT8qvwHRmVxKTBH7Rv9Wr26VcAMmLbmk9UliiwK8z+657NyJHHy/w==", + "version": "5.28.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.28.1.tgz", + "integrity": "sha512-wM+bZp54v/E9eRRGXb5ZFDvinrJIOaTapx3WUokyVGZu5ucVCK55zEgGd5Dl2fSr3jUo5sDiERErUWLY6QPFyA==", "dev": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", diff --git a/Material.Blazor.Website.MD3/package.json b/Material.Blazor.Website.MD3/package.json index 19c3f1bc0..26fc51558 100644 --- a/Material.Blazor.Website.MD3/package.json +++ b/Material.Blazor.Website.MD3/package.json @@ -15,18 +15,18 @@ "license": "MIT", "devDependencies": { "@babel/cli": "^7.23.9", - "@babel/core": "^7.23.9", + "@babel/core": "^7.24.0", "@babel/plugin-transform-class-properties": "^7.23.3", - "@babel/plugin-transform-object-rest-spread": "^7.23.4", - "@babel/plugin-transform-runtime": "^7.23.9", - "@babel/preset-env": "^7.23.9", + "@babel/plugin-transform-object-rest-spread": "^7.24.0", + "@babel/plugin-transform-runtime": "^7.24.0", + "@babel/preset-env": "^7.24.0", "@babel/preset-typescript": "^7.23.3", "babel-loader": "^9.1.3", "fork-ts-checker-webpack-plugin": "^9.0.2", "material-components-web": "14.0.0", "regexp": "^1.0.0", "sass": "1.39.2", - "terser": "^5.27.2", + "terser": "^5.28.1", "ts-loader": "^9.5.1", "typescript": "^5.3.3", "webpack": "^5.90.3", diff --git a/Material.Blazor.Website.MD3/wwwroot/js/material.blazor.website.js b/Material.Blazor.Website.MD3/wwwroot/js/material.blazor.website.js new file mode 100644 index 000000000..cfd034278 --- /dev/null +++ b/Material.Blazor.Website.MD3/wwwroot/js/material.blazor.website.js @@ -0,0 +1,60 @@ +/******/ (() => { // webpackBootstrap +/******/ "use strict"; +/******/ // The require scope +/******/ var __webpack_require__ = {}; +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ (() => { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = (exports, definition) => { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ })(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ (() => { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = (exports) => { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ })(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; + +// NAMESPACE OBJECT: ./Scripts/_MBTheme.ts +var _MBTheme_namespaceObject = {}; +__webpack_require__.r(_MBTheme_namespaceObject); +__webpack_require__.d(_MBTheme_namespaceObject, { + setTheme: () => (setTheme) +}); + +;// CONCATENATED MODULE: ./Scripts/_MBTheme.ts +function setTheme(sheetName, minify) { + var _document$getElementB; + var extension = ".css"; + if (minify === true) { + extension = ".min.css"; + } + (_document$getElementB = document.getElementById("app-style")) === null || _document$getElementB === void 0 || _document$getElementB.setAttribute("href", "_content/Material.Blazor.Website.MD3/css/" + sheetName + extension); +} +;// CONCATENATED MODULE: ./scripts/material.blazor.website.ts + +window.MaterialBlazorWebsite = { + MBTheme: _MBTheme_namespaceObject +}; +/******/ })() +; \ No newline at end of file diff --git a/Material.Blazor.Website.MD3/wwwroot/js/material.blazor.website.min.js b/Material.Blazor.Website.MD3/wwwroot/js/material.blazor.website.min.js new file mode 100644 index 000000000..21b854346 --- /dev/null +++ b/Material.Blazor.Website.MD3/wwwroot/js/material.blazor.website.min.js @@ -0,0 +1 @@ +(()=>{"use strict";var e={d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function o(e,t){var o,r=".css";!0===t&&(r=".min.css"),null===(o=document.getElementById("app-style"))||void 0===o||o.setAttribute("href","_content/Material.Blazor.Website.MD3/css/"+e+r)}e.r(t),e.d(t,{setTheme:()=>o}),window.MaterialBlazorWebsite={MBTheme:t}})(); \ No newline at end of file diff --git a/Material.Blazor.Website/Pages/ChipsSelectMulti.razor b/Material.Blazor.Website/Pages/ChipsSelectMulti.razor deleted file mode 100644 index 630b8c093..000000000 --- a/Material.Blazor.Website/Pages/ChipsSelectMulti.razor +++ /dev/null @@ -1,98 +0,0 @@ -@page "/chipsselectmulti" - -@inject IMBToastService ToastService - - - - -

- Chips - with multi-select capability. -

-
- - -
- - -

- Two sets of two-way bound segmented buttons -

- -

- -

- -

- -

-
-
-
- - -
- - -

- Checkboxes bound to buttons - display only and non-interactive. -

- -

- -

-

- -

-

- -

-
-
-
-
-
- - -@code { - MBIconBearingSelectElement[] KittenBreeds = new MBIconBearingSelectElement[] - { - new MBIconBearingSelectElement { SelectedValue = "brit-short", Label = "British Shorthair" }, - new MBIconBearingSelectElement { SelectedValue = "russ-blue", Label = "Russian Blue", Icon="admin_panel_settings" }, - new MBIconBearingSelectElement { SelectedValue = "ice-invis", Label = "Icelandic Invisible", Icon="card_membership" } - }; - - - IList sbvalues = new string[] { "brit-short", "ice-invis" }; - IList SBValues - { - get => sbvalues; - set - { - sbvalues = value; - CheckboxValues = KittenBreeds.Select(x => sbvalues.Contains(x.SelectedValue)).ToArray(); - StateHasChanged(); - } - } - - bool[] CheckboxValues; - - protected override void OnInitialized() - { - base.OnInitialized(); - - CheckboxValues = KittenBreeds.Select(k => SBValues.Contains(k.SelectedValue)).ToArray(); - } -} \ No newline at end of file diff --git a/Material.Blazor.Website/Pages/ChipsSelectSingle.razor b/Material.Blazor.Website/Pages/ChipsSelectSingle.razor deleted file mode 100644 index b2bf900f2..000000000 --- a/Material.Blazor.Website/Pages/ChipsSelectSingle.razor +++ /dev/null @@ -1,75 +0,0 @@ -@page "/chipsselectsingle" - -@inject IMBToastService ToastService - - - - -

- Chips with single-select capability. -

-
- - -
- - -

- Two sets of two-way bound segmented buttons -

- -

- -

- -

- -

- -

@selectedKitten

-
-
-
- - -
- - -

- Radio buttons bound to segmented buttons. -

- -

- -

-
-
-
-
-
- - -@code { - MBIconBearingSelectElement[] KittenBreeds = new MBIconBearingSelectElement[] - { - new MBIconBearingSelectElement { SelectedValue = "brit-short", Label = "British Shorthair" }, - new MBIconBearingSelectElement { SelectedValue = "russ-blue", Label = "Russian Blue", Icon="admin_panel_settings" }, - new MBIconBearingSelectElement { SelectedValue = "ice-invis", Label = "Icelandic Invisible", Icon="card_membership" } - }; - - - string selectedKitten = "russ-blue"; - - - bool[] CheckboxValues = { false, false, false }; -} \ No newline at end of file diff --git a/Material.Blazor.Website/Pages/Grid.razor b/Material.Blazor.Website/Pages/Grid.razor deleted file mode 100644 index 4ba3e96ee..000000000 --- a/Material.Blazor.Website/Pages/Grid.razor +++ /dev/null @@ -1,225 +0,0 @@ -@page "/grid" - -@inject IMBToastService ToastService - - - -

- Shows a grid using many of the grid features. -

-
- - -
- - -

- Grid showing the raw data -

- - -
-
-
- -
- - -

- Grid showing the data sorted by family name then given name -

- - -
-
-
- -
- - -

- Sorted, Grouped grid hiding the grouping column without group list -

- - -
-
-
- -
- - -

- Sorted, Grouped grid hiding the grouping column with group list -

- - -
-
-
- -
-
- -@code { - private class Person - { - public Guid UniqueIdentifier { get; set; } - public string Salutation { get; set; } - public string GivenName { get; set; } - public string FamilyName { get; set; } - - public override string ToString() - { - return $"{Salutation} {GivenName} {FamilyName}"; - } - } - - private Person[] People = -{ - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Marie", FamilyName = "Curie" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Albert", FamilyName = "Einstein" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Andrew", FamilyName = "Huxley" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Bob", FamilyName = "Dylan" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Barack", FamilyName = "Obama" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Ms", GivenName = "Nadine", FamilyName = "Gordimer" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Muhammad", FamilyName = "Yunus" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "RtHon", GivenName = "Lord", FamilyName = "Rayleigh" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Ms", GivenName = "Grazia", FamilyName = "Deledda" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Jean-Paul", FamilyName = "Sartre" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Esther", FamilyName = "Duflo" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Yoshinori", FamilyName = "Ohsumi" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Robert", FamilyName = "Merton" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Steven", FamilyName = "McClintock" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Joseph", FamilyName = "McClintock" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Barbara", FamilyName = "McClintock" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Boris", FamilyName = "Pasternak" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Willy", FamilyName = "Brandt" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Isaac", FamilyName = "Bashevis Singer" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Ms", GivenName = "Olga", FamilyName = "Tokarczuk" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Günter", FamilyName = "Grass" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "John", FamilyName = "Hume" }, - }; - - private IEnumerable>>> PeopleAsRawData; - private IEnumerable>>> PeopleAsOrderedData; - private IEnumerable>>> PeopleAsGroupedData; - private IEnumerable>>> PeopleAsGroupedDataWithGroupList; - private List GroupOrderedList = new(); - private List> ColumnConfigurations { get; set; } = null; - private List> ColumnConfigurations2 { get; set; } = null; - - public Grid() - { - GroupOrderedList.Add("Dr"); - GroupOrderedList.Add("Mr"); - GroupOrderedList.Add("Ms"); - GroupOrderedList.Add("Prof"); - GroupOrderedList.Add("Professor"); - GroupOrderedList.Add("RtHon"); - - PeopleAsRawData = new MBGrid_DataHelper().PrepareGridData( - People, - typeof(Person).GetProperty("UniqueIdentifier") - ); - - PeopleAsOrderedData = new MBGrid_DataHelper().PrepareGridData( - People, - typeof(Person).GetProperty("UniqueIdentifier"), - typeof(Person).GetProperty("FamilyName"), - orderPropertyInfo2: typeof(Person).GetProperty("GivenName") - ); - - PeopleAsGroupedData = new MBGrid_DataHelper().PrepareGridData( - People, - typeof(Person).GetProperty("UniqueIdentifier"), - typeof(Person).GetProperty("FamilyName"), - orderPropertyInfo2: typeof(Person).GetProperty("GivenName"), - group: true, - groupPropertyInfo: typeof(Person).GetProperty("Salutation") - ); - - PeopleAsGroupedDataWithGroupList = new MBGrid_DataHelper().PrepareGridData( - People, - typeof(Person).GetProperty("UniqueIdentifier"), - typeof(Person).GetProperty("FamilyName"), - orderPropertyInfo2: typeof(Person).GetProperty("GivenName"), - group: true, - groupPropertyInfo: typeof(Person).GetProperty("Salutation"), - groupItemEnumerable: GroupOrderedList - ); - - ColumnConfigurations = new List>(); - - ColumnConfigurations.Add(new MBGridColumnConfiguration( - dataExpression: c => c.GivenName, - title: "Given name", - width: 10)); - ColumnConfigurations.Add(new MBGridColumnConfiguration( - dataExpression: c => c.FamilyName, - title: "Family name", - width: 15)); - ColumnConfigurations.Add(new MBGridColumnConfiguration( - width: 75)); - - - ColumnConfigurations2 = new List>(); - - ColumnConfigurations2.Add(new MBGridColumnConfiguration( - dataExpression: c => c.Salutation, - title: "Salutation", - width: 10)); - ColumnConfigurations2.Add(new MBGridColumnConfiguration( - dataExpression: c => c.GivenName, - title: "Given name", - width: 10)); - ColumnConfigurations2.Add(new MBGridColumnConfiguration( - dataExpression: c => c.FamilyName, - title: "Family name", - width: 15)); - ColumnConfigurations2.Add(new MBGridColumnConfiguration( - width: 65)); - } - - protected async Task MBGridRowClicked(string guid) - { - await Task.CompletedTask; - - ToastService.ShowToast( - heading: "Row clicked", - message: $"You clicked on '{guid}'", - level: MBToastLevel.Success, - showIcon: false); - } - -} \ No newline at end of file diff --git a/Material.Blazor.Website/Pages/GridMT.razor b/Material.Blazor.Website/Pages/GridMT.razor deleted file mode 100644 index ab47c50d5..000000000 --- a/Material.Blazor.Website/Pages/GridMT.razor +++ /dev/null @@ -1,240 +0,0 @@ -@page "/gridmt" - -@inject IMBToastService ToastService - - - -

- Shows a grid using many of the grid features. -

-

- This is an EXPERIMENTAL component. It's API is subject to change. It's styling is not yet - Material. It will not be released as part of Blazor 3.0.0 except in EXPERIMENTAL form. -

-
- - -
- - -

- Grid showing the raw data -

- - -
-
-
- -
- - -

- Grid showing the data sorted by family name then given name -

- - -
-
-
- -
- - -

- Sorted, Grouped grid hiding the grouping column without group list -

- - -
-
-
- -
- - -

- Sorted, Grouped grid hiding the grouping column with group list -

- - -
-
-
- -
-
- -@code { - private class Person - { - public Guid UniqueIdentifier { get; set; } - public string Salutation { get; set; } - public string GivenName { get; set; } - public string FamilyName { get; set; } - - public override string ToString() - { - return $"{Salutation} {GivenName} {FamilyName}"; - } - } - - private Person[] People = - { - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Marie", FamilyName = "Curie" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Albert", FamilyName = "Einstein" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Andrew", FamilyName = "Huxley" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Bob", FamilyName = "Dylan" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Barack", FamilyName = "Obama" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Ms", GivenName = "Nadine", FamilyName = "Gordimer" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Muhammad", FamilyName = "Yunus" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "RtHon", GivenName = "Lord", FamilyName = "Rayleigh" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Ms", GivenName = "Grazia", FamilyName = "Deledda" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Jean-Paul", FamilyName = "Sartre" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Esther", FamilyName = "Duflo" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Yoshinori", FamilyName = "Ohsumi" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Robert", FamilyName = "Merton" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Steven", FamilyName = "McClintock" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Joseph", FamilyName = "McClintock" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Prof", GivenName = "Barbara", FamilyName = "McClintock" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Boris", FamilyName = "Pasternak" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Willy", FamilyName = "Brandt" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Isaac", FamilyName = "Bashevis Singer" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Ms", GivenName = "Olga", FamilyName = "Tokarczuk" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "Günter", FamilyName = "Grass" }, - new Person() { UniqueIdentifier=Guid.NewGuid(), Salutation = "Mr", GivenName = "John", FamilyName = "Hume" }, - }; - - private IEnumerable>>> PeopleAsRawData; - private IEnumerable>>> PeopleAsOrderedData; - private IEnumerable>>> PeopleAsGroupedData; - private IEnumerable>>> PeopleAsGroupedDataWithGroupList; - private List GroupOrderedList = new(); - private List> ColumnConfigurations { get; set; } = null; - private List> ColumnConfigurations2 { get; set; } = null; - - public GridMT() - { - GroupOrderedList.Add("Dr"); - GroupOrderedList.Add("Mr"); - GroupOrderedList.Add("Ms"); - GroupOrderedList.Add("Prof"); - GroupOrderedList.Add("Professor"); - GroupOrderedList.Add("RtHon"); - - PeopleAsRawData = new MBGrid_DataHelper().PrepareGridData( - People, - typeof(Person).GetProperty("UniqueIdentifier") - ); - - PeopleAsOrderedData = new MBGrid_DataHelper().PrepareGridData( - People, - typeof(Person).GetProperty("UniqueIdentifier"), - typeof(Person).GetProperty("FamilyName"), - orderPropertyInfo2: typeof(Person).GetProperty("GivenName") - ); - - PeopleAsGroupedData = new MBGrid_DataHelper().PrepareGridData( - People, - typeof(Person).GetProperty("UniqueIdentifier"), - typeof(Person).GetProperty("FamilyName"), - orderPropertyInfo2: typeof(Person).GetProperty("GivenName"), - group: true, - groupPropertyInfo: typeof(Person).GetProperty("Salutation") - ); - - PeopleAsGroupedDataWithGroupList = new MBGrid_DataHelper().PrepareGridData( - People, - typeof(Person).GetProperty("UniqueIdentifier"), - typeof(Person).GetProperty("FamilyName"), - orderPropertyInfo2: typeof(Person).GetProperty("GivenName"), - group: true, - groupPropertyInfo: typeof(Person).GetProperty("Salutation"), - groupItemEnumerable: GroupOrderedList - ); - - ColumnConfigurations = new List>(); - - ColumnConfigurations.Add(new MBGridColumnConfiguration( - dataExpression: c => c.GivenName, - title: "Given name", - width: 10)); - ColumnConfigurations.Add(new MBGridColumnConfiguration( - dataExpression: c => c.FamilyName, - title: "Family name", - width: 15)); - ColumnConfigurations.Add(new MBGridColumnConfiguration( - width: 75)); - - - ColumnConfigurations2 = new List>(); - - ColumnConfigurations2.Add(new MBGridColumnConfiguration( - dataExpression: c => c.Salutation, - title: "Salutation", - width: 10)); - ColumnConfigurations2.Add(new MBGridColumnConfiguration( - dataExpression: c => c.GivenName, - title: "Given name", - width: 10)); - ColumnConfigurations2.Add(new MBGridColumnConfiguration( - dataExpression: c => c.FamilyName, - title: "Family name", - width: 15)); - ColumnConfigurations2.Add(new MBGridColumnConfiguration( - width: 65)); - } - - protected async Task MBGridRowClicked(string guid) - { - await Task.CompletedTask; - - ToastService.ShowToast( - heading: "Row clicked", - message: $"You clicked on '{guid}'", - level: MBToastLevel.Success, - showIcon: false); - } - -} \ No newline at end of file diff --git a/Material.Blazor.Website/Pages/Scheduler.razor b/Material.Blazor.Website/Pages/Scheduler.razor deleted file mode 100644 index eaa6cb39c..000000000 --- a/Material.Blazor.Website/Pages/Scheduler.razor +++ /dev/null @@ -1,193 +0,0 @@ -@page "/scheduler" -@using System.Drawing - -@inject IMBToastService ToastService - - - -

- Shows a Scheduler using many of the Scheduler features. -

-

- This is an EXPERIMENTAL component. It's API is subject to change. It's styling is not yet - Material. It will not be released as part of Blazor 3.0.0 except in EXPERIMENTAL form. -

-
- - -
- - -

- Scheduler using parameter defaults -

- - - -
-
-
- -
- - -

- Scheduler using a single column and just one appointment -

- - - -
-
-
- -
-
- -@code { - List appointmentList1 = new List() - { - - new MBSchedulerAppointment - { - BackgroundColor = Color.Blue, - Column = 1, - EndTime = new DateTime(2022, 4, 4, 17, 0, 0), - ForegroundColor = Color.White, - StartTime = new DateTime(2022, 4, 4, 7, 0, 0), - Title = "XYZ practice block time", - Uid = Guid.NewGuid() - }, - - new MBSchedulerAppointment - { - BackgroundColor = Color.Blue, - Column = 1, - EndTime = new DateTime(2022, 4, 5, 12, 0, 0), - ForegroundColor = Color.White, - StartTime = new DateTime(2022, 4, 5, 7, 0, 0), - Title = "XYZ practice block time", - Uid = Guid.NewGuid() - }, - - new MBSchedulerAppointment - { - BackgroundColor = Color.Blue, - Column = 1, - EndTime = new DateTime(2022, 4, 8, 17, 0, 0), - ForegroundColor = Color.White, - StartTime = new DateTime(2022, 4, 8, 7, 0, 0), - Title = "XYZ practice block time", - Uid = Guid.NewGuid() - }, - - new MBSchedulerAppointment - { - BackgroundColor = Color.Purple, - Column = 2, - EndTime = new DateTime(2022, 4, 4, 10, 30, 0), - ForegroundColor = Color.White, - StartTime = new DateTime(2022, 4, 4, 7, 0, 0), - Title = "Smith", - Uid = Guid.NewGuid() - }, - - new MBSchedulerAppointment - { - BackgroundColor = Color.LightGreen, - Column = 2, - EndTime = new DateTime(2022, 4, 4, 12, 30, 0), - ForegroundColor = Color.White, - StartTime = new DateTime(2022, 4, 4, 10, 30, 0), - Title = "Jenkins", - Uid = Guid.NewGuid() - }, - - new MBSchedulerAppointment - { - BackgroundColor = Color.LightGreen, - Column = 2, - EndTime = new DateTime(2022, 4, 5, 10, 30, 0), - ForegroundColor = Color.White, - StartTime = new DateTime(2022, 4, 5, 7, 0, 0), - Title = "Jenkins", - Uid = Guid.NewGuid() - }, - - new MBSchedulerAppointment - { - BackgroundColor = Color.LightCoral, - Column = 2, - EndTime = new DateTime(2022, 4, 5, 14, 30, 0), - ForegroundColor = Color.White, - StartTime = new DateTime(2022, 4, 5, 12, 30, 0), - Title = "Adams", - Uid = Guid.NewGuid() - } - }; - - List appointmentList2 = new List() - { - - new MBSchedulerAppointment - { - BackgroundColor = Color.Purple, - Column = 1, - EndTime = new DateTime(2022, 4, 4, 10, 30, 0), - ForegroundColor = Color.White, - StartTime = new DateTime(2022, 4, 4, 7, 0, 0), - Title = "Smith", - Uid = Guid.NewGuid() - } - }; - - public Scheduler() - { - } - - public async Task OnDragEnd1(MBScheduler.DragEndInfo dei) - { - await Task.CompletedTask; - List newAppointmentList = new List(); - - foreach (var appt in appointmentList1) - { - if (appt.Uid == dei.appointment.Uid) - { - // There is no validation in this demo but this is where it should - // be performed - appt.StartTime = dei.newStartTime; - appt.EndTime = dei.newEndTime; - } - newAppointmentList.Add(appt); - } - appointmentList1 = newAppointmentList; - StateHasChanged(); - } - - public async Task OnDragEnd2(MBScheduler.DragEndInfo dei) - { - await Task.CompletedTask; - List newAppointmentList = new List(); - - foreach (var appt in appointmentList2) - { - if (appt.Uid == dei.appointment.Uid) - { - // There is no validation in this demo but this is where it should - // be performed - appt.StartTime = dei.newStartTime; - appt.EndTime = dei.newEndTime; - } - newAppointmentList.Add(appt); - } - appointmentList2 = newAppointmentList; - StateHasChanged(); - } -} diff --git a/Material.Blazor.Website/Shared/MainLayout.razor b/Material.Blazor.Website/Shared/MainLayout.razor index 0e97e8dee..e7ae0171c 100644 --- a/Material.Blazor.Website/Shared/MainLayout.razor +++ b/Material.Blazor.Website/Shared/MainLayout.razor @@ -32,7 +32,6 @@ - @@ -64,11 +63,6 @@ - - - - - diff --git a/Material.Blazor.Website/package-lock.json b/Material.Blazor.Website/package-lock.json index af2f910d4..f8cca95bc 100644 --- a/Material.Blazor.Website/package-lock.json +++ b/Material.Blazor.Website/package-lock.json @@ -10,18 +10,18 @@ "license": "MIT", "devDependencies": { "@babel/cli": "^7.23.9", - "@babel/core": "^7.23.9", + "@babel/core": "^7.24.0", "@babel/plugin-transform-class-properties": "^7.23.3", - "@babel/plugin-transform-object-rest-spread": "^7.23.4", - "@babel/plugin-transform-runtime": "^7.23.9", - "@babel/preset-env": "^7.23.9", + "@babel/plugin-transform-object-rest-spread": "^7.24.0", + "@babel/plugin-transform-runtime": "^7.24.0", + "@babel/preset-env": "^7.24.0", "@babel/preset-typescript": "^7.23.3", "babel-loader": "^9.1.3", "fork-ts-checker-webpack-plugin": "^9.0.2", "material-components-web": "14.0.0", "regexp": "^1.0.0", "sass": "1.39.2", - "terser": "^5.27.2", + "terser": "^5.28.1", "ts-loader": "^9.5.1", "typescript": "^5.3.3", "webpack": "^5.90.3", @@ -93,9 +93,9 @@ } }, "node_modules/@babel/core": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.9.tgz", - "integrity": "sha512-5q0175NOjddqpvvzU+kDiSOAk4PfdO6FvwCWoQ6RO7rTzEe8vlo+4HVfcnAREhD4npMs0e9uZypjTwzZPCf/cw==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.24.0.tgz", + "integrity": "sha512-fQfkg0Gjkza3nf0c7/w6Xf34BW4YvzNfACRLmmb7XRLa6XHdR+K9AlJlxneFfWYf6uhOzuzZVTjF/8KfndZANw==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.2.0", @@ -103,11 +103,11 @@ "@babel/generator": "^7.23.6", "@babel/helper-compilation-targets": "^7.23.6", "@babel/helper-module-transforms": "^7.23.3", - "@babel/helpers": "^7.23.9", - "@babel/parser": "^7.23.9", - "@babel/template": "^7.23.9", - "@babel/traverse": "^7.23.9", - "@babel/types": "^7.23.9", + "@babel/helpers": "^7.24.0", + "@babel/parser": "^7.24.0", + "@babel/template": "^7.24.0", + "@babel/traverse": "^7.24.0", + "@babel/types": "^7.24.0", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -178,9 +178,9 @@ } }, "node_modules/@babel/helper-create-class-features-plugin": { - "version": "7.23.10", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.23.10.tgz", - "integrity": "sha512-2XpP2XhkXzgxecPNEEK8Vz8Asj9aRxt08oKOqtiZoqV2UGZ5T+EkyP9sXQ9nwMxBIG34a7jmasVqoMop7VdPUw==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.24.0.tgz", + "integrity": "sha512-QAH+vfvts51BCsNZ2PhY6HAggnlS6omLLFTsIpeqZk/MmJ6cW7tgz5yRv0fMJThcr6FmbMrENh1RgrWPTYA76g==", "dev": true, "dependencies": { "@babel/helper-annotate-as-pure": "^7.22.5", @@ -323,9 +323,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", - "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.0.tgz", + "integrity": "sha512-9cUznXMG0+FxRuJfvL82QlTqIzhVW9sL0KjMPHhAOOvpQGL8QtdxnBKILjBqxlHyliz0yCa1G903ZXI/FuHy2w==", "dev": true, "engines": { "node": ">=6.9.0" @@ -443,14 +443,14 @@ } }, "node_modules/@babel/helpers": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.9.tgz", - "integrity": "sha512-87ICKgU5t5SzOT7sBMfCOZQ2rHjRU+Pcb9BoILMYz600W6DkVRLFBPwQ18gwUVvggqXivaUakpnxWQGbpywbBQ==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.24.0.tgz", + "integrity": "sha512-ulDZdc0Aj5uLc5nETsa7EPx2L7rM0YJM8r7ck7U73AXi7qOV44IHHRAYZHY6iU1rr3C5N4NtTmMRUJP6kwCWeA==", "dev": true, "dependencies": { - "@babel/template": "^7.23.9", - "@babel/traverse": "^7.23.9", - "@babel/types": "^7.23.9" + "@babel/template": "^7.24.0", + "@babel/traverse": "^7.24.0", + "@babel/types": "^7.24.0" }, "engines": { "node": ">=6.9.0" @@ -471,9 +471,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.9.tgz", - "integrity": "sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.0.tgz", + "integrity": "sha512-QuP/FxEAzMSjXygs8v4N9dvdXzEHN4W1oF3PxuWAtPo08UdM17u89RDMgjLn/mlc56iM0HlLmVkO/wgR+rDgHg==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -1278,14 +1278,14 @@ } }, "node_modules/@babel/plugin-transform-object-rest-spread": { - "version": "7.23.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.23.4.tgz", - "integrity": "sha512-9x9K1YyeQVw0iOXJlIzwm8ltobIIv7j2iLyP2jIhEbqPRQ7ScNgwQufU2I0Gq11VjyG4gI4yMXt2VFags+1N3g==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.24.0.tgz", + "integrity": "sha512-y/yKMm7buHpFFXfxVFS4Vk1ToRJDilIa6fKRioB9Vjichv58TDGXTvqV0dN7plobAmTW5eSEGXDngE+Mm+uO+w==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.23.3", - "@babel/helper-compilation-targets": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5", + "@babel/compat-data": "^7.23.5", + "@babel/helper-compilation-targets": "^7.23.6", + "@babel/helper-plugin-utils": "^7.24.0", "@babel/plugin-syntax-object-rest-spread": "^7.8.3", "@babel/plugin-transform-parameters": "^7.23.3" }, @@ -1441,13 +1441,13 @@ } }, "node_modules/@babel/plugin-transform-runtime": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.23.9.tgz", - "integrity": "sha512-A7clW3a0aSjm3ONU9o2HAILSegJCYlEZmOhmBRReVtIpY/Z/p7yIZ+wR41Z+UipwdGuqwtID/V/dOdZXjwi9gQ==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.24.0.tgz", + "integrity": "sha512-zc0GA5IitLKJrSfXlXmp8KDqLrnGECK7YRfQBmEKg1NmBOQ7e+KuclBEKJgzifQeUYLdNiAw4B4bjyvzWVLiSA==", "dev": true, "dependencies": { "@babel/helper-module-imports": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-plugin-utils": "^7.24.0", "babel-plugin-polyfill-corejs2": "^0.4.8", "babel-plugin-polyfill-corejs3": "^0.9.0", "babel-plugin-polyfill-regenerator": "^0.5.5", @@ -1618,14 +1618,14 @@ } }, "node_modules/@babel/preset-env": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.23.9.tgz", - "integrity": "sha512-3kBGTNBBk9DQiPoXYS0g0BYlwTQYUTifqgKTjxUwEUkduRT2QOa0FPGBJ+NROQhGyYO5BuTJwGvBnqKDykac6A==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.24.0.tgz", + "integrity": "sha512-ZxPEzV9IgvGn73iK0E6VB9/95Nd7aMFpbE0l8KQFDG70cOV9IxRP7Y2FUPmlK0v6ImlLqYX50iuZ3ZTVhOF2lA==", "dev": true, "dependencies": { "@babel/compat-data": "^7.23.5", "@babel/helper-compilation-targets": "^7.23.6", - "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-plugin-utils": "^7.24.0", "@babel/helper-validator-option": "^7.23.5", "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.23.3", "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.23.3", @@ -1678,7 +1678,7 @@ "@babel/plugin-transform-new-target": "^7.23.3", "@babel/plugin-transform-nullish-coalescing-operator": "^7.23.4", "@babel/plugin-transform-numeric-separator": "^7.23.4", - "@babel/plugin-transform-object-rest-spread": "^7.23.4", + "@babel/plugin-transform-object-rest-spread": "^7.24.0", "@babel/plugin-transform-object-super": "^7.23.3", "@babel/plugin-transform-optional-catch-binding": "^7.23.4", "@babel/plugin-transform-optional-chaining": "^7.23.4", @@ -1751,9 +1751,9 @@ "dev": true }, "node_modules/@babel/runtime": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.9.tgz", - "integrity": "sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.0.tgz", + "integrity": "sha512-Chk32uHMg6TnQdvw2e9IlqPpFX/6NLuK0Ys2PqLb7/gL5uFn9mXvK715FGLlOLQrcO4qIkNHkvPGktzzXexsFw==", "dev": true, "dependencies": { "regenerator-runtime": "^0.14.0" @@ -1763,23 +1763,23 @@ } }, "node_modules/@babel/template": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.23.9.tgz", - "integrity": "sha512-+xrD2BWLpvHKNmX2QbpdpsBaWnRxahMwJjO+KZk2JOElj5nSmKezyS1B4u+QbHMTX69t4ukm6hh9lsYQ7GHCKA==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.0.tgz", + "integrity": "sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA==", "dev": true, "dependencies": { "@babel/code-frame": "^7.23.5", - "@babel/parser": "^7.23.9", - "@babel/types": "^7.23.9" + "@babel/parser": "^7.24.0", + "@babel/types": "^7.24.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.9.tgz", - "integrity": "sha512-I/4UJ9vs90OkBtY6iiiTORVMyIhJ4kAVmsKo9KFc8UOxMeUfi2hvtIBsET5u9GizXE6/GFSuKCTNfgCswuEjRg==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.0.tgz", + "integrity": "sha512-HfuJlI8qq3dEDmNU5ChzzpZRWq+oxCZQyMzIMEqLho+AQnhMnKQUzH6ydo3RBl/YjPCuk68Y6s0Gx0AeyULiWw==", "dev": true, "dependencies": { "@babel/code-frame": "^7.23.5", @@ -1788,8 +1788,8 @@ "@babel/helper-function-name": "^7.23.0", "@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.23.9", - "@babel/types": "^7.23.9", + "@babel/parser": "^7.24.0", + "@babel/types": "^7.24.0", "debug": "^4.3.1", "globals": "^11.1.0" }, @@ -1798,9 +1798,9 @@ } }, "node_modules/@babel/types": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.9.tgz", - "integrity": "sha512-dQjSq/7HaSjRM43FFGnv5keM2HsxpmyV1PfaSVm0nzzjwwTmjOe6J4bC8e3+pTEIgHaHj+1ZlLThRJ2auc/w1Q==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.0.tgz", + "integrity": "sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w==", "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.23.4", @@ -1821,9 +1821,9 @@ } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", - "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.4.tgz", + "integrity": "sha512-Oud2QPM5dHviZNn4y/WhhYKSXksv+1xLEIsNrAbGcFzUN3ubqWRFT5gwPchNc5NuzILOU4tPBDTZ4VwhL8Y7cw==", "dev": true, "dependencies": { "@jridgewell/set-array": "^1.0.1", @@ -1844,9 +1844,9 @@ } }, "node_modules/@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true, "engines": { "node": ">=6.0.0" @@ -1869,9 +1869,9 @@ "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.22", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz", - "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==", + "version": "0.3.23", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.23.tgz", + "integrity": "sha512-9/4foRoUKp8s96tSkh8DlAAc5A0Ty8vLXld+l9gjKKY6ckwI8G15f0hskGmuLZu78ZlGa1vtsfOa+lnB4vG6Jg==", "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", @@ -2670,9 +2670,9 @@ "optional": true }, "node_modules/@types/eslint": { - "version": "8.56.2", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.2.tgz", - "integrity": "sha512-uQDwm1wFHmbBbCZCqAlq6Do9LYwByNZHWzXppSnay9SuwJ+VRbjkbLABer54kcPnMSlG6Fdiy2yaFXm/z9Z5gw==", + "version": "8.56.5", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.5.tgz", + "integrity": "sha512-u5/YPJHo1tvkSF2CE0USEkxon82Z5DBy2xR+qfyYNszpX9qcs4sT6uq2kBbj4BXY1+DBGDPnrhMZV3pKWGNukw==", "dev": true, "dependencies": { "@types/estree": "*", @@ -2702,9 +2702,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.19", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", - "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", + "version": "20.11.24", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.24.tgz", + "integrity": "sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -3150,9 +3150,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001588", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001588.tgz", - "integrity": "sha512-+hVY9jE44uKLkH0SrUTqxjxqNTOWHsbnQDIKjwkZ3lNTzUUVdBLBGXtj/q5Mp5u98r3droaZAewQuEDzjQdZlQ==", + "version": "1.0.30001591", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001591.tgz", + "integrity": "sha512-PCzRMei/vXjJyL5mJtzNiUCKP59dm8Apqc3PH8gJkMnMXZGox93RbE76jHsmLwmIo6/3nsYIpJtx0O7u5PqFuQ==", "dev": true, "funding": [ { @@ -3358,15 +3358,15 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.677", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.677.tgz", - "integrity": "sha512-erDa3CaDzwJOpyvfKhOiJjBVNnMM0qxHq47RheVVwsSQrgBA9ZSGV9kdaOfZDPXcHzhG7lBxhj6A7KvfLJBd6Q==", + "version": "1.4.687", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.687.tgz", + "integrity": "sha512-Ic85cOuXSP6h7KM0AIJ2hpJ98Bo4hyTUjc4yjMbkvD+8yTxEhfK9+8exT2KKYsSjnCn2tGsKVSZwE7ZgTORQCw==", "dev": true }, "node_modules/enhanced-resolve": { - "version": "5.15.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", - "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", + "version": "5.15.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.1.tgz", + "integrity": "sha512-3d3JRbwsCLJsYgvb6NuWEG44jjPSOMuS73L/6+7BZuoKm3W+qXnSoIYVHi8dG7Qcg4inAY4jbzkZ7MnskePeDg==", "dev": true, "dependencies": { "graceful-fs": "^4.2.4", @@ -4932,9 +4932,9 @@ } }, "node_modules/terser": { - "version": "5.27.2", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.27.2.tgz", - "integrity": "sha512-sHXmLSkImesJ4p5apTeT63DsV4Obe1s37qT8qvwHRmVxKTBH7Rv9Wr26VcAMmLbmk9UliiwK8z+657NyJHHy/w==", + "version": "5.28.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.28.1.tgz", + "integrity": "sha512-wM+bZp54v/E9eRRGXb5ZFDvinrJIOaTapx3WUokyVGZu5ucVCK55zEgGd5Dl2fSr3jUo5sDiERErUWLY6QPFyA==", "dev": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", diff --git a/Material.Blazor.Website/package.json b/Material.Blazor.Website/package.json index fd3789d62..6ccc05e5c 100644 --- a/Material.Blazor.Website/package.json +++ b/Material.Blazor.Website/package.json @@ -21,18 +21,18 @@ "license": "MIT", "devDependencies": { "@babel/cli": "^7.23.9", - "@babel/core": "^7.23.9", + "@babel/core": "^7.24.0", "@babel/plugin-transform-class-properties": "^7.23.3", - "@babel/plugin-transform-object-rest-spread": "^7.23.4", - "@babel/plugin-transform-runtime": "^7.23.9", - "@babel/preset-env": "^7.23.9", + "@babel/plugin-transform-object-rest-spread": "^7.24.0", + "@babel/plugin-transform-runtime": "^7.24.0", + "@babel/preset-env": "^7.24.0", "@babel/preset-typescript": "^7.23.3", "babel-loader": "^9.1.3", "fork-ts-checker-webpack-plugin": "^9.0.2", "material-components-web": "14.0.0", "regexp": "^1.0.0", "sass": "1.39.2", - "terser": "^5.27.2", + "terser": "^5.28.1", "ts-loader": "^9.5.1", "typescript": "^5.3.3", "webpack": "^5.90.3", diff --git a/Material.Blazor/Articles/PlusComponents.md b/Material.Blazor/Articles/PlusComponents.md index 01c683397..a4de6c60a 100644 --- a/Material.Blazor/Articles/PlusComponents.md +++ b/Material.Blazor/Articles/PlusComponents.md @@ -26,7 +26,6 @@ implements further Blazor/Material Theme hybrid components that we term "Plus Co | [MBDragAndDropList](xref:C.MBDragAndDropList) | A list of user provided render fragments that can be re-ordered with drag and drop. | | [MBFileUploadButton](xref:C.MBFileUploadButton) | A material button styled wrapper for the `InputFile` component. | | [MBFileUploadDragAndDrop](xref:C.MBFileUploadDragAndDrop) | A material card styled wrapper for the `InputFile` component that can load files either by drag and drop or clicking the card area. | -| [MBGrid](xref:C.MBGrid) | Displays a grid composed from the elements specified as parameters. | | [MBIcon](xref:C.MBIcon) | Displays an icon from the specified icon foundry or the default foundry from [MBCascadingDefaults](xref:U.MBCascadingDefaults). See also [MBIconHelper](xref:U.MBIconHelper). | | [MBMenuSelectionGroup](xref:C.MBMenuSelectionGroup) | Allows grouping of menu items to enable multiple 'selected' checks | | [MBNumericDecimalField](xref:C.MBNumericDecimalField) | Wraps [MBTextField](xref:C.MBTextField) to format numeric entry of a `decimal`. | @@ -38,13 +37,3 @@ implements further Blazor/Material Theme hybrid components that we term "Plus Co | [MBSlidingContent](xref:C.MBSlidingContent) | A templated component to provide previous/next navigation through a series of pages with light left/right and fade in/out animation. | | [MBSlidingTabBar](xref:C.MBSlidingTabBar) | An `MBTabBar` augmented with content displayed in a `MBSlidingContent` | | MBToast | An `MBToast` component used to show toast notifications` | - -## Experimental Component List - -| Component | Notes | -| :-------- | :---- | -| [MBChipsSelectMulti](xref:C.MBChipsSelectMulti) | A [Material Filter Chipset](https://github.com/material-components/material-components-web/tree/v12.0.0/packages/mdc-chips#chips). Implements a multi-select chipset ("filter chips"). | -| [MBChipsSelectSingle](xref:C.MBChipsSelectSingle) | A [Material Choice Chipset](https://github.com/material-components/material-components-web/tree/v12.0.0/packages/mdc-chips#chips). Implements a single-select chipset ("choice chips"). | -| [MBGridMT](xref:C.MBGrid) | Displays a grid themed as MWC composed from the elements specified as parameters. | -| [MBScheduler](xref:C.MBScheduler) | Displays a schedule composed from the elements specified as parameters. | - diff --git a/Material.Blazor/Components/ChipsSelectMulti/MBChipsSelectMulti.md b/Material.Blazor/Components/ChipsSelectMulti/MBChipsSelectMulti.md deleted file mode 100644 index 7192ab6f1..000000000 --- a/Material.Blazor/Components/ChipsSelectMulti/MBChipsSelectMulti.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -uid: C.MBChipsSelectMulti -title: MBChipsSelectMulti ---- -# MBChipsSelectMulti<TItem> - -## Summary - -A [Material Chip Set](https://github.com/material-components/material-components-web/tree/v9.0.0/packages/mdc-chips#chips) configured as a multi-select. - -## Details - -- Accepts an `IEnumerable>` of selectable items; -- Binds to an `IList` of all items selected; -- Ignores the `Disabled` parameter because Material Components Web segmented buttons do not implement a disabled state. - -## Assisting Blazor Rendering with `@key` - -- MBSegmentedButtonMulti renders similar buttons with a `foreach` loop; -- In general each item rendered in a loop in Blazor should be supplied with a unique object via the `@key` attribute - see [Blazor University](https://blazor-university.com/components/render-trees/optimising-using-key/); -- MBSegmentedButtonMulti by default uses the `SelectedValue` property of each item in the `Items` parameter as the key, however you can override this. Material.Blazor does this because we have had instances where Blazor crashes with the default key giving an exception message such as "The given key 'MyObject' was not present"; -- You can provide a function delegate to the `GetKeysFunc` parameter - we have used two variants of this: - - First to get a unique `Id` property that happens to be in our item's class: `GetKeysFunc="@((item) => item.Id)"`; and - - Second using a "fake key" where we create a GUID to act as the key: `GetKeysFunc="@((item) => Guid.NewGuid())"`. - - You can see an example of this in the [MBList demonstration website page's code](https://github.com/Material-Blazor/Material.Blazor/blob/main/Material.Blazor.Website/Pages/List.razor#L155). - -- ChipsSelectSingle & Items are set in OnInitialized and not in SetParameters - -  - -  - -[![Components](https://img.shields.io/static/v1?label=Components&message=Core&color=blue)](xref:A.CoreComponents) -[![Docs](https://img.shields.io/static/v1?label=API%20Documentation&message=MBChipsSelectMulti&color=brightgreen)](xref:Material.Blazor.MBChipsSelectMulti`1) diff --git a/Material.Blazor/Components/ChipsSelectMulti/MBChipsSelectMulti.razor b/Material.Blazor/Components/ChipsSelectMulti/MBChipsSelectMulti.razor deleted file mode 100644 index 0e1617208..000000000 --- a/Material.Blazor/Components/ChipsSelectMulti/MBChipsSelectMulti.razor +++ /dev/null @@ -1,64 +0,0 @@ -@namespace Material.Blazor - -@inherits MultiSelectComponent> -@typeparam TItem - - - - - - @for (int j = 0; j < ItemsArray.Length; j++) - { - int i = j; - string id = $"{_chipSetName}__chip-{i}"; - int tabIndex = (i == 0) ? 0 : -1; - var selected = Value.Contains(ItemsArray[i].SelectedValue); - @*var chipClass = "mdc-evolution-chip mdc-evolution-chip--selectable mdc-evolution-chip--filter " + (selected ? "mdc-evolution-chip--selected" : "mdc-evolution-chip--deselected") + (AppliedDisabled ? " mdc-evolution-chip--disabled" : "");*@ - var chipClass = "mdc-evolution-chip mdc-evolution-chip--selectable mdc-evolution-chip--filter" + (AppliedDisabled ? " mdc-evolution-chip--disabled" : ""); - - - - - - - - - @*@if (!string.IsNullOrWhiteSpace(ItemsArray[i].Icon)) - { - var iconClass = "mdc-evolution-chip__icon mdc-evolution-chip__icon--primary" + (selected ? " mdc-evolution-chip__icon--leading-hidden" : ""); - - - }*@ - - @if (true || !IsMultiSelect) - { - - - - - - } - - - @ItemsArray[i].Label - - - } - - diff --git a/Material.Blazor/Components/ChipsSelectMulti/MBChipsSelectMulti.razor.cs b/Material.Blazor/Components/ChipsSelectMulti/MBChipsSelectMulti.razor.cs deleted file mode 100644 index 3744e9b51..000000000 --- a/Material.Blazor/Components/ChipsSelectMulti/MBChipsSelectMulti.razor.cs +++ /dev/null @@ -1,122 +0,0 @@ -using Material.Blazor.Internal; -using Microsoft.AspNetCore.Components; -using Microsoft.JSInterop; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Material.Blazor; - -/// -/// A Material Theme segmented button orientated as a multi-select. -/// -public partial class MBChipsSelectMulti : MultiSelectComponent> -{ - /// - /// If this component is rendered inside a single-select segmented button, add the "" class. - /// - [CascadingParameter] private MBChipsSelectSingle ChipsSelectSingle { get; set; } - - /// - /// Inclusion of touch target - /// - [Parameter] public bool? TouchTarget { get; set; } - - - private readonly string _chipSetName = Utilities.GenerateUniqueElementName(); - - private bool AppliedTouchTarget => CascadingDefaults.AppliedTouchTarget(TouchTarget); - //private Dictionary[] ChipAttributes { get; set; } - //private Dictionary[] ChipIconAttributes { get; set; } - //private Dictionary[] ChipSpanAttributes { get; set; } - private ElementReference ChipsReference { get; set; } - private MBIconBearingSelectElement[] ItemsArray { get; set; } - private bool IsMultiSelect { get; set; } - private DotNetObjectReference> ObjectReference { get; set; } - - - // Would like to use however DocFX cannot resolve to references outside Material.Blazor - protected override async Task OnInitializedAsync() - { - await base.OnInitializedAsync(); - - IsMultiSelect = ChipsSelectSingle == null; - - ItemsArray = Items.ToArray(); - - ObjectReference = DotNetObjectReference.Create(this); - } - - - private bool _disposed = false; - protected override void Dispose(bool disposing) - { - if (_disposed) - { - return; - } - - if (disposing) - { - ObjectReference?.Dispose(); - } - - _disposed = true; - - base.Dispose(disposing); - } - - - /// - /// For Material Theme to notify of menu item selection via JS Interop. - /// - [JSInvokable] - public void NotifyMultiSelected(int[] selectedIndexes) - { - //var selectedIndexes = Enumerable.Range(0, selected.Length).Where(i => selected[i]); - ComponentValue = ItemsArray.Where((item, index) => selectedIndexes.Contains(index)).Select(x => x.SelectedValue).ToArray(); - } - - - /// - /// For Material Theme to notify of menu item selection via JS Interop. - /// - [JSInvokable] - public void NotifySingleSelected(int index) - { - ComponentValue = new TItem[] { ItemsArray[index].SelectedValue }; - } - - - /// - private protected override Task SetComponentValueAsync() - { - return InvokeJsVoidAsync("MaterialBlazor.MBChipsSelectMulti.setSelected", ChipsReference, Items.Select(x => Value.Contains(x.SelectedValue)).ToArray()); - } - - - /// - private protected override Task OnDisabledSetAsync() - { - return InvokeJsVoidAsync("MaterialBlazor.MBChipsSelectMulti.setDisabled", ChipsReference, AppliedDisabled); - } - - - /// - internal override Task InstantiateMcwComponent() - { - return InvokeJsVoidAsync("MaterialBlazor.MBChipsSelectMulti.init", ChipsReference, IsMultiSelect, ObjectReference); - } - - - /// - /// Used by to set the value. - /// - /// - internal Task SetSingleSelectValue(TItem value) - { - Value = new TItem[] { value }; - return SetComponentValueAsync(); - } -} diff --git a/Material.Blazor/Components/ChipsSelectMulti/MBChipsSelectMulti.ts b/Material.Blazor/Components/ChipsSelectMulti/MBChipsSelectMulti.ts deleted file mode 100644 index bbf6c27ba..000000000 --- a/Material.Blazor/Components/ChipsSelectMulti/MBChipsSelectMulti.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { MDCChipSet } from '@material/chips'; -import { MDCChipActionType } from '@material/chips/action/constants'; - -export function init(elem, isMultiSelect, dotNetObject) { - if (!elem) { - return; - } - elem._chipSet = MDCChipSet.attachTo(elem); - elem._isMultiSelect = isMultiSelect; - - const clickedCallback = () => { - if (elem._isMultiSelect) { - dotNetObject.invokeMethodAsync('NotifyMultiSelected', Array.from(elem._chipSet.getSelectedChipIndexes())); - //dotNetObject.invokeMethodAsync('NotifyMultiSelected', elem._chipSet.chips.map(x => x.isActionSelected(0))); - } - else { - let result = -1; - - for (let i = 0; i < elem._chipSet.chips.length; i++) { - if (elem._chipSet.chips[i].foundation.isActionSelected(MDCChipActionType.PRIMARY)) { - result = i; - } - } - - dotNetObject.invokeMethodAsync('NotifySingleSelected', result); - - //var selectedChips = elem._chipSet.chips.filter(x => x.isActionSelected(0)); - - //if (selectedChips.length == 0) { - // dotNetObject.invokeMethodAsync('NotifySingleSelected', -1); - //} - //else { - // dotNetObject.invokeMethodAsync('NotifySingleSelected', elem._chipSet.chips.findIndex(x => x.id === selectedChips[0].id)); - //} - } - }; - - elem._chipSet.listen('MDCChipSet:selection', clickedCallback); -} - -export function setDisabled(elem, value) { - if (!elem) { - return; - } - elem._chipSet.disabled = value; -} - -// This function doesn't appear to work properly - see https://github.com/Material-Blazor/Material.Blazor/issues/366 -export function setSelected(elem, selectedFlags) { - if (!elem) { - return; - } - for (let i = 0; i < selectedFlags.length; i++) { - //elem._chipSet.chips[i].selected = selectedFlags[i]; - elem._chipSet.foundation.adapter.selectChipAtIndex(i, selectedFlags[i], false); - //elem._chipSet.chips[i].foundation.setSelectedFromChipSet(selectedFlags[i], false); - //elem._chipSet.chips[i].foundation.notifySelection(selectedFlags[i], false); - } -} diff --git a/Material.Blazor/Components/ChipsSelectSingle/MBChipsSelectSingle.md b/Material.Blazor/Components/ChipsSelectSingle/MBChipsSelectSingle.md deleted file mode 100644 index 9230b29a6..000000000 --- a/Material.Blazor/Components/ChipsSelectSingle/MBChipsSelectSingle.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -uid: C.MBChipsSelectSingle -title: MBChipsSelectSingle ---- -# MBChipsSelectSingle<TItem> - -## Summary - -A [Material Chip Set](https://github.com/material-components/material-components-web/tree/v9.0.0/packages/mdc-chips#chips) configured as a single-select. - -## Details - -- Accepts an `IEnumerable>` of selectable items; -- Binds to a `TItem` for the selected value; -- Ignores the `Disabled` parameter because Material Components Web segmented buttons do not implement a disabled state. - -## Assisting Blazor Rendering with `@key` - -- MBSegmentedButtonMulti renders similar buttons with a `foreach` loop; -- In general each item rendered in a loop in Blazor should be supplied with a unique object via the `@key` attribute - see [Blazor University](https://blazor-university.com/components/render-trees/optimising-using-key/); -- MBSegmentedButtonMulti by default uses the `SelectedValue` property of each item in the `Items` parameter as the key, however you can override this. Material.Blazor does this because we have had instances where Blazor crashes with the default key giving an exception message such as "The given key 'MyObject' was not present"; -- You can provide a function delegate to the `GetKeysFunc` parameter - we have used two variants of this: - - First to get a unique `Id` property that happens to be in our item's class: `GetKeysFunc="@((item) => item.Id)"`; and - - Second using a "fake key" where we create a GUID to act as the key: `GetKeysFunc="@((item) => Guid.NewGuid())"`. - - You can see an example of this in the [MBList demonstration website page's code](https://github.com/Material-Blazor/Material.Blazor/blob/main/Material.Blazor.Website/Pages/List.razor#L155). - -- Value, ChipsSelectSingle, & Items are set in OnInitialized and not in SetParameters - -  - -  - -[![Components](https://img.shields.io/static/v1?label=Components&message=Core&color=blue)](xref:A.CoreComponents) -[![Docs](https://img.shields.io/static/v1?label=API%20Documentation&message=MBChipsSelectSingle&color=brightgreen)](xref:Material.Blazor.MBChipsSelectSingle`1) diff --git a/Material.Blazor/Components/ChipsSelectSingle/MBChipsSelectSingle.razor b/Material.Blazor/Components/ChipsSelectSingle/MBChipsSelectSingle.razor deleted file mode 100644 index 093846be6..000000000 --- a/Material.Blazor/Components/ChipsSelectSingle/MBChipsSelectSingle.razor +++ /dev/null @@ -1,11 +0,0 @@ -@namespace Material.Blazor - -@inherits SingleSelectComponent> -@typeparam TItem - - - - - \ No newline at end of file diff --git a/Material.Blazor/Components/ChipsSelectSingle/MBChipsSelectSingle.razor.cs b/Material.Blazor/Components/ChipsSelectSingle/MBChipsSelectSingle.razor.cs deleted file mode 100644 index f7c6703a8..000000000 --- a/Material.Blazor/Components/ChipsSelectSingle/MBChipsSelectSingle.razor.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Material.Blazor.Internal; -using Microsoft.AspNetCore.Components; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Material.Blazor; - -/// -/// A Material Theme segmented button orientated as a single-select. -/// -public partial class MBChipsSelectSingle : SingleSelectComponent> -{ -#nullable enable annotations - /// - /// The foundry to use for both leading and trailing icons. - /// IconFoundry="IconHelper.MIIcon()" - /// IconFoundry="IconHelper.FAIcon()" - /// IconFoundry="IconHelper.OIIcon()" - /// Overrides - /// - [Parameter] public IMBIconFoundry? IconFoundry { get; set; } -#nullable restore annotations - - - private MBChipsSelectMulti ChipsSelectMulti { get; set; } - - private IList multiValues; - private IList MultiValues - { - get => multiValues; - set - { - multiValues = value; - ComponentValue = multiValues.FirstOrDefault(); - } - } - - - // Would like to use however DocFX cannot resolve to references outside Material.Blazor - protected override async Task OnInitializedAsync() - { - await base.OnInitializedAsync(); - - var appliedItemValidation = CascadingDefaults.AppliedItemValidation(ItemValidation); - - ComponentValue = ValidateItemList(Items, appliedItemValidation).value; - - multiValues = new TItem[] { Value }; - } - - - /// - private protected override Task SetComponentValueAsync() - { - ChipsSelectMulti.SetSingleSelectValue(Value); - return Task.CompletedTask; - } -} diff --git a/Material.Blazor/Components/Grid/MBEnumerationsGrid.cs b/Material.Blazor/Components/Grid/MBEnumerationsGrid.cs deleted file mode 100644 index a55dd6666..000000000 --- a/Material.Blazor/Components/Grid/MBEnumerationsGrid.cs +++ /dev/null @@ -1,21 +0,0 @@ -// ToDo: -// -// Move enumerations to MBEnumerations -// - -namespace Material.Blazor; - -public enum MB_Grid_Measurement -{ - EM, - FitToData, - Percent, - PX, -} - -public enum MB_Grid_ColumnType -{ - Icon, - Text, - TextColor, -}; diff --git a/Material.Blazor/Components/Grid/MBGrid.cs b/Material.Blazor/Components/Grid/MBGrid.cs deleted file mode 100644 index 9a4d73eba..000000000 --- a/Material.Blazor/Components/Grid/MBGrid.cs +++ /dev/null @@ -1,1153 +0,0 @@ -// -// ToDo: -// If we ever have functionality to 'move' rows we need to revisit the -// Steve Sanderson 'best practices' for sequence numbers -// -// Bugs: -// Resolve issue with ElementReferences -// - -using System; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.ComponentModel; -using System.Drawing; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -using Material.Blazor.Internal; -using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Components.Rendering; -using Microsoft.AspNetCore.Components.Web; -using Microsoft.JSInterop; -// -// Implements a scrollable, multi-column grid. When created we get a list of column -// config objects and a list of data objects with the column content for each -// row. -// -// We 'select' a line when it is clicked on so the caller can either immediately respond or -// save the selection for later. -// - -namespace Material.Blazor; - -/// -/// A Material Theme grid capable of displaying icons, colored text, and text. -/// -/// N.B.: At this time the grid is in preview. Expect the API to change. -/// -public class MBGrid : ComponentFoundation -{ - #region Members - - // Remember that adding/removing/renaming parameters requires an update - // to SetParametersAsync - - /// - /// The configuration of each column to be displayed. See the definition of MBGridColumnConfiguration - /// for details. - /// - [Parameter, EditorRequired] public IEnumerable> ColumnConfigurations { get; set; } = null; - - - /// - /// The Group is an optional boolean indicating that grouping is in effect. - /// - [Parameter] public bool Group { get; set; } = false; - - - /// - /// The GroupedOrderedData contains the data to be displayed. - /// The outer key is used for grouping and is directly displayed if grouping is enabled. - /// The inner key must be a unique identifier - /// that is used to indicate a row that has been clicked. - /// - [Parameter, EditorRequired] public IEnumerable>>> GroupedOrderedData { get; set; } - - - /// - /// A boolean indicating whether the selected row is highlighted - /// - [Parameter] public bool HighlightSelectedRow { get; set; } = false; - - -#nullable enable annotations - /// - /// The KeyExpression is used to add a key to each row of the grid - /// - [Parameter] public Func? KeyExpression { get; set; } = null; -#nullable restore annotations - - - /// - /// LogIdentification is added to logging message to allow differentiation between multiple grids - /// on a single page or component - /// - [Parameter] public string LogIdentification { get; set; } = ""; - - - /// - /// Measurement determines the unit of size (EM, Percent, PX) or if the grid is to measure the - /// data widths (FitToData) - /// - [Parameter] public MB_Grid_Measurement Measurement { get; set; } = MB_Grid_Measurement.Percent; - - - /// - /// ObscurePMI controls whether or not columns marked as PMI are obscured. - /// - [Parameter] public bool ObscurePMI { get; set; } - - - /// - /// Callback for a mouse click - /// - [Parameter] public EventCallback OnMouseClickCallback { get; set; } - - - /// - /// Headers are optional - /// - [Parameter] public bool SuppressHeader { get; set; } = false; - - - [Inject] IJSRuntime JsRuntime { get; set; } - - - private float[] ColumnWidthArray; - private ElementReference GridBodyRef { get; set; } - private ElementReference GridHeaderRef { get; set; } - private string GridBodyID { get; set; } = Utilities.GenerateUniqueElementName(); - private string GridHeaderID { get; set; } = Utilities.GenerateUniqueElementName(); - private bool HasCompletedFullRender { get; set; } = false; - private bool IsSimpleRender { get; set; } = true; - private bool IsMeasurementNeeded { get; set; } = false; - private float ScrollWidth { get; set; } - private string SelectedKey { get; set; } = ""; - - //Instantiate a Semaphore with a value of 1. This means that only 1 thread can be granted access at a time. - private readonly SemaphoreSlim semaphoreSlim = new(1, 1); - - private bool ShouldRenderValue { get; set; } = true; - - #endregion - - #region BuildColGroup - private void BuildColGroup(RenderTreeBuilder builder, ref int rendSeq) - { - // Create the sizing colgroup collection - builder.OpenElement(rendSeq++, "colgroup"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-colgroup"); - var colIndex = 0; - foreach (var col in ColumnConfigurations) - { - var styleStr = CreateMeasurementStyle(col, ColumnWidthArray[colIndex]); - builder.OpenElement(rendSeq++, "col"); - builder.AddAttribute(rendSeq++, "style", styleStr); - builder.CloseElement(); // col - colIndex++; - } - builder.CloseElement(); // colgroup - } - #endregion - - #region BuildGridTDElement - private static string BuildGridTDElement( - RenderTreeBuilder builder, - ref int rendSeq, - bool isFirstColumn, - bool isHeaderRow, - string rowBackgroundColorClass) - { - builder.OpenElement(rendSeq++, "td"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-td " + rowBackgroundColorClass); - - if (isHeaderRow) - { - if (isFirstColumn) - { - // T R B L - return " border-width: 1px; border-style: solid; border-color: black; "; - } - else - { - // T R B - return " border-width: 1px 1px 1px 0px; border-style: solid; border-color: black; "; - } - } - else - { - if (isFirstColumn) - { - // R L - return " border-width: 0px 1px 0px 1px; border-style: solid; border-color: black; "; - } - else - { - // R - return " border-width: 0px 1px 0px 0px; border-style: solid; border-color: black; "; - } - } - } - #endregion - - #region BuildRenderTree - protected override void BuildRenderTree(RenderTreeBuilder builder) - { - LoggingService.LogDebug("[" + LogIdentification + "] BuildRenderTree entered; IsSimpleRender == " + IsSimpleRender.ToString()); - LoggingService.LogDebug("[" + LogIdentification + "] HasCompletedFullRender == " + HasCompletedFullRender.ToString()); - LoggingService.LogDebug("[" + LogIdentification + "] ShouldRenderValue == " + ShouldRenderValue.ToString()); - if (IsSimpleRender || (!ShouldRenderValue)) - { - LoggingService.LogDebug("[" + LogIdentification + "] (Simple) entered"); - // We are going to render a DIV and nothing else - // We need to get into OnAfterRenderAsync so that we can use JS interop to measure - // the text - base.BuildRenderTree(builder); - builder.OpenElement(1, "div"); - builder.CloseElement(); - HasCompletedFullRender = false; - LoggingService.LogDebug("[" + LogIdentification + "] (Simple) leaving"); - } - else - { - LoggingService.LogDebug("[" + LogIdentification + "] (Full) entered"); - - // - // Using the column cfg and column data, render our list. Here is the layout. - // The column headers are optional. - // - // div class="@class", style="@style" - // div mb-grid-header - Contains the header and the vscroll - // table - - // tr - - // td* - Header - // div mb-grid-body - Contains the rows and the vscroll - // table - Contains the rows - // tr* - Rows - // td* - Columns of the row - // - - base.BuildRenderTree(builder); - var rendSeq = 2; - string styleStr; - - if (((@class != null) && (@class.Length > 0)) || ((style != null) && (style.Length > 0))) - { - builder.OpenElement(rendSeq++, "div"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-div-outer " + @class); - builder.AddAttribute(rendSeq++, "style", style); - } - - // Based on the column config generate the column titles unless asked not to - if (!SuppressHeader) - { - builder.OpenElement(rendSeq++, "div"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-div-header mb-grid-backgroundcolor-header-background"); - //builder.AddAttribute(rendSeq++, "style", "padding-right: " + ScrollWidth.ToString() + "px; "); - builder.AddAttribute(rendSeq++, "id", GridHeaderID); - builder.AddElementReferenceCapture(rendSeq++, (__value) => { GridHeaderRef = __value; }); - builder.OpenElement(rendSeq++, "table"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-table"); - BuildColGroup(builder, ref rendSeq); - builder.OpenElement(rendSeq++, "thead"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-thead"); - builder.OpenElement(rendSeq++, "tr"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-tr"); - - // For each column output a TD - var isHeaderRow = true; - var colCount = 0; - foreach (var col in ColumnConfigurations) - { - styleStr = BuildGridTDElement( - builder, - ref rendSeq, - colCount == 0, - isHeaderRow, - "mb-grid-backgroundcolor-header-background"); - - // Set the header colors - styleStr += " color: " + col.ForegroundColorHeader.Name + ";"; - styleStr += " background-color : " + col.BackgroundColorHeader.Name + ";"; - - builder.AddAttribute(rendSeq++, "style", styleStr); - builder.AddContent(rendSeq++, col.Title); - - // Close this column TD - builder.CloseElement(); - - colCount++; - } - - builder.CloseElement(); // tr - - builder.CloseElement(); // thead - - builder.CloseElement(); //table - - builder.CloseElement(); // div mb-grid-header - } - - // - // We now need to build a "display centric" data representation with rows added for breaks, etc. - // For the first pass we are going to skip this step and just display the raw content - // - - if (GroupedOrderedData != null) - { - var isFirstGrouper = true; - - // This div holds the scrolled content - builder.OpenElement(rendSeq++, "div"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-div-body"); - builder.AddAttribute(rendSeq++, "id", "mb-grid-div-body"); - builder.AddAttribute(rendSeq++, "onscroll", - EventCallback.Factory.Create(this, GridSyncScroll)); - builder.AddAttribute(rendSeq++, "id", GridBodyID); - builder.AddElementReferenceCapture(rendSeq++, (__value) => { GridBodyRef = __value; }); - builder.OpenElement(rendSeq++, "table"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-table"); - BuildColGroup(builder, ref rendSeq); - builder.OpenElement(rendSeq++, "tbody"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-tbody"); - - foreach (var kvp in GroupedOrderedData) - { - if (Group) - { - // We output a row with the group name - // Do a div for this row - builder.OpenElement(rendSeq++, "tr"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-tr"); - builder.OpenElement(rendSeq++, "td"); - builder.AddAttribute(rendSeq++, "colspan", ColumnConfigurations.Count().ToString()); - builder.AddAttribute(rendSeq++, "class", "mb-grid-td-group mb-grid-backgroundcolor-row-group"); - if (isFirstGrouper) - { - isFirstGrouper = false; - builder.AddAttribute(rendSeq++, "style", "border-top: 1px solid black; "); - } - builder.AddAttribute(rendSeq++, "mbgrid-td-wide", "0"); - builder.AddContent(rendSeq++, " " + kvp.Key); - builder.CloseElement(); // td - builder.CloseElement(); // tr - } - - var rowCount = 0; - foreach (var rowValues in kvp.Value) - { - var rowKey = KeyExpression(rowValues.Value).ToString(); - - string rowBackgroundColorClass; - if ((rowKey == SelectedKey) && HighlightSelectedRow) - { - // It's the selected row so set the selection color as the background - rowBackgroundColorClass = "mb-grid-backgroundcolor-row-selected"; - } - else - { - // Not selected or not highlighted so we alternate - if ((rowCount / 2) * 2 == rowCount) - { - // Even - rowBackgroundColorClass = "mb-grid-backgroundcolor-row-even"; - } - else - { - // Odd - rowBackgroundColorClass = "mb-grid-backgroundcolor-row-odd"; - } - } - - // Do a tr - builder.OpenElement(rendSeq++, "tr"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-tr " + rowBackgroundColorClass); - builder.AddAttribute(rendSeq++, "id", rowKey); - - builder.AddAttribute - ( - rendSeq++, - "onclick", - EventCallback.Factory.Create(this, e => OnMouseClickInternal(rowKey)) - ); - - // For each column output a td - var colCount = 0; - var isHeaderRow = false; - foreach (var columnDefinition in ColumnConfigurations) - { - styleStr = BuildGridTDElement( - builder, - ref rendSeq, - colCount == 0, - isHeaderRow, - rowBackgroundColorClass); - - switch (columnDefinition.ColumnType) - { - case MB_Grid_ColumnType.Icon: - if (columnDefinition.DataExpression != null) - { - try - { - var value = (MBGridIconSpecification)columnDefinition.DataExpression(rowValues.Value); - - // We need to add the color alignment to the base styles - styleStr += - " color: " + ColorToCSSColor(value.IconColor) + ";" - + " text-align: center;"; - - builder.AddAttribute(rendSeq++, "style", styleStr); - builder.OpenComponent(rendSeq++, typeof(MBIcon)); - builder.AddAttribute(rendSeq++, "IconFoundry", value.IconFoundry); - builder.AddAttribute(rendSeq++, "IconName", value.IconName); - builder.CloseComponent(); - } - catch - { - throw new Exception("Backing value incorrect for MBGrid.Icon column."); - } - } - break; - - case MB_Grid_ColumnType.Text: - // It's a text type column so add the text related styles - // We may be overriding the alternating row color added by class - - if (columnDefinition.ForegroundColorExpression != null) - { - var value = columnDefinition.ForegroundColorExpression(rowValues.Value); - styleStr += - " color: " + ColorToCSSColor((Color)value) + "; "; - } - - if (columnDefinition.BackgroundColorExpression != null) - { - var value = columnDefinition.BackgroundColorExpression(rowValues.Value); - if ((Color)value != Color.Transparent) - { - styleStr += - " background-color: " + ColorToCSSColor((Color)value) + "; "; - } - } - - if (columnDefinition.IsPMI && ObscurePMI) - { - styleStr += - " filter: blur(0.25em); "; - } - - builder.AddAttribute(rendSeq++, "style", styleStr); - - // Bind the object as our content. - if (columnDefinition.DataExpression != null) - { - var value = columnDefinition.DataExpression(rowValues.Value); - var formattedValue = string.IsNullOrEmpty(columnDefinition.FormatString) ? value?.ToString() : string.Format("{0:" + columnDefinition.FormatString + "}", value); - builder.AddContent(1, formattedValue); - } - break; - - case MB_Grid_ColumnType.TextColor: - if (columnDefinition.DataExpression != null) - { - try - { - var value = (MBGridTextColorSpecification)columnDefinition.DataExpression(rowValues.Value); - - if (value.Suppress) - { - builder.AddAttribute(rendSeq++, "style", styleStr); - } - else - { - // We need to add the colors - styleStr += - " color: " + ColorToCSSColor(value.ForegroundColor) - + "; background-color: " + ColorToCSSColor(value.BackgroundColor) + ";"; - - if (columnDefinition.IsPMI && ObscurePMI) - { - styleStr += - " filter: blur(0.25em); "; - } - - builder.AddAttribute(rendSeq++, "style", styleStr); - builder.AddContent(rendSeq++, value.Text); - } - } - catch - { - throw new Exception("Backing value incorrect for MBGrid.TextColor column."); - } - } - break; - - default: - throw new Exception("MBGrid -- Unknown column type"); - } - - // Close this column span - builder.CloseElement(); - - colCount++; - } - - // Close this row's div - builder.CloseElement(); - - rowCount++; - } - } - - builder.CloseElement(); // tbody - - builder.CloseElement(); // table - - builder.CloseElement(); // div mb-grid-body-outer - - if (((@class != null) && (@class.Length > 0)) || ((style != null) && (style.Length > 0))) - { - builder.CloseElement(); // div class= style= - } - } - - HasCompletedFullRender = true; - LoggingService.LogDebug("[" + LogIdentification + "] (Full) leaving"); - } - LoggingService.LogDebug("[" + LogIdentification + "] leaving; IsSimpleRender == " + IsSimpleRender.ToString()); - LoggingService.LogDebug("[" + LogIdentification + "] leaving; HasCompletedFullRender == " + HasCompletedFullRender.ToString()); - } - #endregion - - #region ColorToCSSColor - private static string ColorToCSSColor(Color color) - { - int rawColor = color.ToArgb(); - rawColor &= 0xFFFFFF; - return "#" + rawColor.ToString("X6"); - } - #endregion - - #region CreateMeasurementStyle - private string CreateMeasurementStyle(MBGridColumnConfiguration col, float columnWidth) - { - string subStyle = Measurement switch - { - MB_Grid_Measurement.EM => "em", - MB_Grid_Measurement.FitToData => "", - MB_Grid_Measurement.PX => "px", - MB_Grid_Measurement.Percent => "%", - _ => throw new Exception("Unexpected measurement type in MBGrid"), - }; - - if (subStyle.Length > 0) - { - return - "width: " + col.Width.ToString() + subStyle + " !important; " + - "max-width: " + col.Width.ToString() + subStyle + " !important; " + - "min-width: " + col.Width.ToString() + subStyle + " !important; "; - } - else - { - return - "width: " + columnWidth.ToString() + "px !important; " + - "max-width: " + columnWidth.ToString() + "px !important; " + - "min-width: " + columnWidth.ToString() + "px !important; "; - } - } - #endregion - - #region GridSyncScroll - protected async Task GridSyncScroll() - { - LoggingService.LogDebug("[" + LogIdentification + "] GridSyncScroll()"); - await InvokeJsVoidAsync("MaterialBlazor.MBGrid.syncScrollByID", GridHeaderID, GridBodyID); - //await InvokeVoidAsync("MaterialBlazor.MBGrid.syncScrollByRef", GridHeaderRef, GridBodyRef); - } - #endregion - - #region MeasureWidthsAsync - private async Task MeasureWidthsAsync() - { - if (GroupedOrderedData == null) - { - return; - } - - // Measure the width of a vertical scrollbar (Used to set the padding of the header) - ScrollWidth = await JsRuntime.InvokeAsync( - "MaterialBlazor.MBGrid.getScrollBarWidth", - "mb-grid-div-body"); - ScrollWidth = 0; - - if (Measurement == MB_Grid_Measurement.FitToData) - { - // Create a simple data dictionary from the GroupedDataDictionary - var dataList = new List(); - foreach (var outerKVP in GroupedOrderedData) - { - foreach (var innerKVP in outerKVP.Value) - { - dataList.Add(innerKVP.Value); - } - } - // Measure the header columns - var stringArrayHeader = new string[ColumnConfigurations.Count()]; - var colIndex = 0; - foreach (var col in ColumnConfigurations) - { - stringArrayHeader[colIndex] = col.Title; - colIndex++; - } - - ColumnWidthArray = await JsRuntime.InvokeAsync( - "MaterialBlazor.MBGrid.getTextWidths", - "mb-grid-header-td-measure", - ColumnWidthArray, - stringArrayHeader); - - // Measure the body columns - var stringArrayBody = new string[ColumnConfigurations.Count() * dataList.Count]; - colIndex = 0; - foreach (var enumerableData in dataList) - { - foreach (var columnDefinition in ColumnConfigurations) - { - switch (columnDefinition.ColumnType) - { - case MB_Grid_ColumnType.Icon: - // We let the column width get driven by the title - stringArrayBody[colIndex] = ""; - break; - - case MB_Grid_ColumnType.Text: - if (columnDefinition.DataExpression != null) - { - var value = columnDefinition.DataExpression(enumerableData); - var formattedValue = string.IsNullOrEmpty(columnDefinition.FormatString) ? value?.ToString() : string.Format("{0:" + columnDefinition.FormatString + "}", value); - stringArrayBody[colIndex] = formattedValue; - } - break; - - case MB_Grid_ColumnType.TextColor: - if (columnDefinition.DataExpression != null) - { - try - { - var value = (MBGridTextColorSpecification)columnDefinition.DataExpression(enumerableData); - if (!value.Suppress) - { - stringArrayBody[colIndex] = value.Text; - } - else - { - stringArrayBody[colIndex] = ""; - } - } - catch - { - throw new Exception("Backing value incorrect for MBGrid.TextColor column."); - } - } - break; - - default: - throw new Exception("MBGrid -- Unknown column type"); - } - - colIndex++; - } - } - - if (LoggingService.CurrentLevel() <= (int)MBLoggingLevel.Debug) - { - var total = 0; - foreach (var c in stringArrayBody) - { - if (c != null) - { - total += c.Length; - } - } - LoggingService.LogDebug("[" + LogIdentification + "] Measuring " + stringArrayBody.Length + " strings with a total size of " + total.ToString() + " bytes"); - } - - ColumnWidthArray = await JsRuntime.InvokeAsync( - "MaterialBlazor.MBGrid.getTextWidths", - "mb-grid-body-td-measure", - ColumnWidthArray, - stringArrayBody); - - for (var col = 0; col < ColumnWidthArray.Length; col++) - { - // - // We adjust a bit because we were still getting an ellipsis on the longest text. - // This is caused by the fact that creates - // a 372px wide column - // - - ColumnWidthArray[col] += 1; - } - } - } - #endregion - - #region OnAfterRenderAsync - protected override async Task OnAfterRenderAsync(bool firstRender) - { - var needsSHC = false; - await semaphoreSlim.WaitAsync(); - try - { - await base.OnAfterRenderAsync(firstRender); - - LoggingService.LogDebug("[" + LogIdentification + "] OnAfterRenderAsync entered"); - LoggingService.LogDebug("[" + LogIdentification + "] firstRender: " + firstRender.ToString()); - LoggingService.LogDebug("[" + LogIdentification + "] IsSimpleRender: " + IsSimpleRender.ToString()); - LoggingService.LogDebug("[" + LogIdentification + "] IsMeasurementNeeded: " + IsMeasurementNeeded.ToString()); - - if (IsSimpleRender) - { - IsSimpleRender = false; - needsSHC = true; - } - - if (IsMeasurementNeeded) - { - IsMeasurementNeeded = false; - - if (Measurement == MB_Grid_Measurement.FitToData) - { - LoggingService.LogDebug("[" + LogIdentification + "] Calling MeasureWidthsAsync"); - await MeasureWidthsAsync(); - LoggingService.LogDebug("[" + LogIdentification + "] Returned from MeasureWidthsAsync"); - - needsSHC = true; - } - } - } - finally - { - if (needsSHC) - { - await InvokeAsync(StateHasChanged); - } - - LoggingService.LogDebug("[" + LogIdentification + "] about to release semaphore (OnAfterRenderAsync)"); - - semaphoreSlim.Release(); - } - } - #endregion - - #region OnInitializedAsync - protected override async Task OnInitializedAsync() - { - LoggingService.LogDebug("[" + LogIdentification + "] MBGrid.OnInitializedAsync entered"); - - await base.OnInitializedAsync(); - - if (ColumnConfigurations == null) - { - throw new System.Exception("MBGrid requires column configuration definitions."); - } - - LoggingService.LogDebug("[" + LogIdentification + "] MBGrid.OnInitializedAsync completed"); - } - #endregion - - #region OnMouseClickInternal - private Task OnMouseClickInternal(string newRowKey) - { - LoggingService.LogDebug("[" + LogIdentification + "] OnMouseClickInternal with HighlightSelectedRow:" + HighlightSelectedRow.ToString()); - - if (newRowKey != SelectedKey) - { - SelectedKey = newRowKey; - } - return OnMouseClickCallback.InvokeAsync(newRowKey); - } - #endregion - - #region ScrollToIndicatedRowAsync - public async Task ScrollToIndicatedRowAsync(string rowIdentifier) - { - LoggingService.LogDebug("[" + LogIdentification + "] ScrollToIndicatedRowAsync(" + rowIdentifier + ")"); - await InvokeJsVoidAsync("MaterialBlazor.MBGrid.scrollToIndicatedRow", rowIdentifier); - } - #endregion - - #region SetParametersAsync - private int oldParameterHash { get; set; } = -1; - public override Task SetParametersAsync(ParameterView parameters) - { - LoggingService.LogDebug("[" + LogIdentification + "] SetParametersAsync entry"); - - semaphoreSlim.WaitAsync(); - try - { - var count = parameters.ToDictionary().Count; - LoggingService.LogDebug("[" + LogIdentification + "] SetParametersAsync parameter count: " + count.ToString()); - foreach (var parameter in parameters) - { - LoggingService.LogDebug("[" + LogIdentification + "] SetParametersAsync parameter: " + parameter.Name); - switch (parameter.Name) - { - case nameof(@class): - @class = (string)parameter.Value; - break; - case nameof(ColumnConfigurations): - ColumnConfigurations = (IEnumerable>)parameter.Value; - // - // We are going to measure the actual sizes using JS if the Measurement is FitToData - // We need to create the ColumnWidthArray regardless of the measurement type as we need to pass - // values to BuildColGroup->CreateMeasurementStyle - // - ColumnWidthArray = new float[ColumnConfigurations.Count()]; - break; - case nameof(Group): - Group = (bool)parameter.Value; - break; - case nameof(GroupedOrderedData): - GroupedOrderedData = (IEnumerable>>>)parameter.Value; - break; - case nameof(HighlightSelectedRow): - HighlightSelectedRow = (bool)parameter.Value; - break; - case nameof(KeyExpression): - KeyExpression = (Func)parameter.Value; - break; - case nameof(LogIdentification): - LogIdentification = (string)parameter.Value; - break; - case nameof(Measurement): - Measurement = (MB_Grid_Measurement)parameter.Value; - break; - case nameof(ObscurePMI): - ObscurePMI = (bool)parameter.Value; - break; - case nameof(OnMouseClickCallback): - OnMouseClickCallback = (EventCallback)parameter.Value; - break; - case nameof(style): - style = (string)parameter.Value; - break; - case nameof(SuppressHeader): - SuppressHeader = (bool)parameter.Value; - break; - default: - LoggingService.LogTrace("[" + LogIdentification + "] MBGrid encountered an unknown parameter:" + parameter.Name); - break; - } - } - - LoggingService.LogDebug("[" + LogIdentification + "] about to compute parameter hash"); - - HashCode newConfigurationParametersHash = new(); - - if (HighlightSelectedRow) - { - newConfigurationParametersHash = HashCode - .OfEach(ColumnConfigurations) - .And(@class) - .And(Group) - .And(HighlightSelectedRow) - .And(KeyExpression) - .And(Measurement) - .And(ObscurePMI) - .And(OnMouseClickCallback) - .And(SelectedKey) // Not a parameter but if we don't include this we won't re-render after selecting a row - .And(style) - .And(SuppressHeader); - } - else - { - newConfigurationParametersHash = HashCode - .OfEach(ColumnConfigurations) - .And(@class) - .And(Group) - .And(HighlightSelectedRow) - .And(KeyExpression) - .And(Measurement) - .And(ObscurePMI) - .And(OnMouseClickCallback) - .And(style) - .And(SuppressHeader); - } - LoggingService.LogDebug("[" + LogIdentification + "] 'configuration' parameters hash == " + ((int)newConfigurationParametersHash).ToString()); - - // - // We have to implement the double loop for grouped ordered data as the OfEach/AndEach - // do not recurse into the second enumerable and certainly don't look at the rowValues - // - HashCode newDataParameterHash = new(); - if ((GroupedOrderedData != null) && (ColumnConfigurations != null)) - { - foreach (var kvp in GroupedOrderedData) - { - LoggingService.LogDebug("[" + LogIdentification + "] key == " + kvp.Key + " with " + kvp.Value.Count().ToString() + " rows"); - - foreach (var rowValues in kvp.Value) - { - var rowKey = KeyExpression(rowValues.Value).ToString(); - - newDataParameterHash = new HashCode(HashCode.CombineHashCodes( - newDataParameterHash.value, - HashCode.Of(rowKey))); - - foreach (var columnDefinition in ColumnConfigurations) - { - switch (columnDefinition.ColumnType) - { - case MB_Grid_ColumnType.Icon: - if (columnDefinition.DataExpression != null) - { - try - { - var value = (MBGridIconSpecification)columnDefinition.DataExpression(rowValues.Value); - - newDataParameterHash = new HashCode(HashCode.CombineHashCodes( - newDataParameterHash.value, - HashCode.Of(value))); - } - catch - { - throw new Exception("Backing value incorrect for MBGrid.Icon column."); - } - } - break; - - case MB_Grid_ColumnType.Text: - if (columnDefinition.DataExpression != null) - { - var value = columnDefinition.DataExpression(rowValues.Value); - var formattedValue = string.IsNullOrEmpty(columnDefinition.FormatString) ? value?.ToString() : string.Format("{0:" + columnDefinition.FormatString + "}", value); - - newDataParameterHash = new HashCode(HashCode.CombineHashCodes( - newDataParameterHash.value, - HashCode.Of(value))); - } - break; - - case MB_Grid_ColumnType.TextColor: - if (columnDefinition.DataExpression != null) - { - try - { - var value = (MBGridTextColorSpecification)columnDefinition.DataExpression(rowValues.Value); - - newDataParameterHash = new HashCode(HashCode.CombineHashCodes( - newDataParameterHash.value, - HashCode.Of(value))); - } - catch - { - throw new Exception("Backing value incorrect for MBGrid.TextColor column."); - } - } - break; - - default: - throw new Exception("MBGrid -- Unknown column type"); - } - } - } - } - LoggingService.LogDebug("[" + LogIdentification + "] 'data' parameter hash == " + ((int)newDataParameterHash).ToString()); - } - - HashCode newParameterHash = new HashCode( - HashCode.CombineHashCodes( - newConfigurationParametersHash.value, - newDataParameterHash.value)); - - LoggingService.LogDebug("[" + LogIdentification + "] hash == " + ((int)newParameterHash).ToString()); - if (newParameterHash == oldParameterHash) - { - // This is a call to ParametersSetAsync with what in all likelyhood is the same - // parameters. Hashing isn't perfect so there is some tiny possibility that new parameters - // are present and the same hash value was computed. - if (HasCompletedFullRender) - { - ShouldRenderValue = false; - } - else - { - ShouldRenderValue = true; - } - -// LoggingService.LogDebug("[" + LogIdentification + "] EQUAL hash"); - } - else - { - ShouldRenderValue = true; - IsSimpleRender = true; - IsMeasurementNeeded = true; - oldParameterHash = newParameterHash; - LoggingService.LogDebug("[" + LogIdentification + "] DIFFERING hash"); - } - } - finally - { - LoggingService.LogDebug("[" + LogIdentification + "] about to release semaphore (SetParametersAsync)"); - - semaphoreSlim.Release(); - } - - return base.SetParametersAsync(ParameterView.Empty); - } - #endregion - - #region ShouldRender - protected override bool ShouldRender() - { - return ShouldRenderValue; - } - #endregion - -} - -#region HashCode - -/// -/// A hash code used to help with implementing . -/// -/// This code is from the blog post at https://rehansaeed.com/gethashcode-made-easy/ -/// -public struct HashCode : IEquatable -{ - private const int EmptyCollectionPrimeNumber = 19; - public readonly int value; - - /// - /// Initializes a new instance of the struct. - /// - /// The value. - public HashCode(int value) => this.value = value; - - /// - /// Performs an implicit conversion from to . - /// - /// The hash code. - /// The result of the conversion. - public static implicit operator int(HashCode hashCode) => hashCode.value; - - /// - /// Implements the operator ==. - /// - /// The left. - /// The right. - /// The result of the operator. - public static bool operator ==(HashCode left, HashCode right) => left.Equals(right); - - /// - /// Implements the operator !=. - /// - /// The left. - /// The right. - /// The result of the operator. - public static bool operator !=(HashCode left, HashCode right) => !(left == right); - - /// - /// Takes the hash code of the specified item. - /// - /// The type of the item. - /// The item. - /// The new hash code. - public static HashCode Of(T item) => new HashCode(GetHashCode(item)); - - /// - /// Takes the hash code of the specified items. - /// - /// The type of the items. - /// The collection. - /// The new hash code. - public static HashCode OfEach(IEnumerable items) => - items == null ? new HashCode(0) : new HashCode(GetHashCode(items, 0)); - - /// - /// Adds the hash code of the specified item. - /// - /// The type of the item. - /// The item. - /// The new hash code. - public HashCode And(T item) => - new HashCode(CombineHashCodes(this.value, GetHashCode(item))); - - /// - /// Adds the hash code of the specified items in the collection. - /// - /// The type of the items. - /// The collection. - /// The new hash code. - public HashCode AndEach(IEnumerable items) - { - if (items == null) - { - return new HashCode(this.value); - } - - return new HashCode(GetHashCode(items, this.value)); - } - - public bool Equals(HashCode other) => this.value.Equals(other.value); - - public override bool Equals(object obj) - { - if (obj is HashCode) - { - return this.Equals((HashCode)obj); - } - - return false; - } - - /// - /// Throws . - /// - /// Does not return. - /// Implicitly convert this struct to an to get the hash code. - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => - throw new NotSupportedException( - "Implicitly convert this struct to an int to get the hash code."); - - public static int CombineHashCodes(int h1, int h2) - { - unchecked - { - // Code copied from System.Tuple so it must be the best way to combine hash codes or at least a good one. - return ((h1 << 5) + h1) ^ h2; - } - } - - private static int GetHashCode(T item) => item?.GetHashCode() ?? 0; - - private static int GetHashCode(IEnumerable items, int startHashCode) - { - var temp = startHashCode; - - var enumerator = items.GetEnumerator(); - if (enumerator.MoveNext()) - { - temp = CombineHashCodes(temp, GetHashCode(enumerator.Current)); - - while (enumerator.MoveNext()) - { - temp = CombineHashCodes(temp, GetHashCode(enumerator.Current)); - } - } - else - { - temp = CombineHashCodes(temp, EmptyCollectionPrimeNumber); - } - - return temp; - } -} - -#endregion - diff --git a/Material.Blazor/Components/Grid/MBGrid.md b/Material.Blazor/Components/Grid/MBGrid.md deleted file mode 100644 index 390e9531c..000000000 --- a/Material.Blazor/Components/Grid/MBGrid.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -uid: C.MBGrid -title: MBGrid ---- -# MBGrid<TRowData> - -## Summary - -A grid built on a table base using BuildRenderTree. - -## Warning - -This is a preview version of the grid. The expectation must be that implementation details and the API will change. - -## Details - -- tbd. - -  - -  - -[![Components](https://img.shields.io/static/v1?label=Components&message=Plus&color=red)](xref:A.PlusComponents) -[![Docs](https://img.shields.io/static/v1?label=API%20Documentation&message=MBGrid&color=brightgreen)](xref:Material.Blazor.MBGrid`1) \ No newline at end of file diff --git a/Material.Blazor/Components/Grid/MBGrid.scss b/Material.Blazor/Components/Grid/MBGrid.scss deleted file mode 100644 index 725754801..000000000 --- a/Material.Blazor/Components/Grid/MBGrid.scss +++ /dev/null @@ -1,273 +0,0 @@ -@charset "UTF-8"; - -@use '@material/theme'; -@use '@material/theme/custom-properties'; -@use '@material/theme/color-palette'; -@use 'sass:string'; - -$border-color: color-palette.$blue-grey-500; -$header-color: color-palette.$blue-grey-100; - -$group-row-color: color-palette.$blue-100; -$group-row-color-hover: darken($group-row-color, 4%); - -$odd-row-color: color-palette.$yellow-100; -$odd-row-color-hover: darken($odd-row-color, 4%); - -$even-row-color: color-palette.$yellow-200; -$even-row-color-hover: darken($even-row-color, 4%); - -$selected-row-color: color-palette.$green-100; -$selected-row-color-hover: darken($selected-row-color, 4%); - -:root { - --mb-grid-border-color: #{$border-color}; - --mb-grid-header-color: #{$header-color}; - --mb-grid-group-row-color: #{$group-row-color}; - --mb-grid-group-row-color-hover: #{$group-row-color-hover}; - --mb-grid-odd-row-color: #{$odd-row-color}; - --mb-grid-odd-row-color-hover: #{$odd-row-color-hover}; - --mb-grid-even-row-color: #{$even-row-color}; - --mb-grid-even-row-color-hover: #{$even-row-color-hover}; - --mb-grid-selected-row-color: #{$selected-row-color}; - --mb-grid-selected-row-color-hover: #{$selected-row-color-hover}; -} - -.mb-mgrid { - border-radius: 0px; - - .mdc-data-table__header-cell:first-child { - border-top-left-radius: 0px; - } - - .mdc-data-table__header-cell:last-child { - border-top-right-radius: 0px; - } -} - -.mb-mgrid__colored { - border-color: var(--mb-grid-border-color); - - .mdc-data-table__header-cell { - background-color: var(--mb-grid-header-color); - border-left-color: var(--mb-grid-border-color); - border-bottom-color: var(--mb-grid-border-color); - } - - tbody td { - border-left-color: var(--mb-grid-border-color); - border-bottom-color: var(--mb-grid-border-color); - } - - .mb-mgrid__group-row { - background-color: var(--mb-grid-group-row-color); - - &:hover { - background-color: var(--mb-grid-group-row-color-hover); - } - } - - .mb-mgrid__row:nth-child(odd):not(.mb-mgrid__row-selected) { - background-color: var(--mb-grid-odd-row-color); - - &:hover { - background-color: var(--mb-grid-odd-row-color-hover); - } - } - - .mb-mgrid__row:nth-child(even):not(.mb-mgrid__row-selected) { - background-color: var(--mb-grid-even-row-color); - - &:hover { - background-color: var(--mb-grid-even-row-color-hover); - } - } - - .mb-mgrid__row-selected { - background-color: var(--mb-grid-selected-row-color); - - &:hover { - background-color: var(--mb-grid-selected-row-color-hover); - } - } -} - - -.mb-mgrid__vertical-dividers { - .mdc-data-table__header-cell:not(:first-child), .mb-mgrid__group-row td:not(:first-child), .mb-mgrid__row td:not(:first-child) { - padding-left: 15px; - border-left-width: 1px; - border-left-style: solid; - } -} - - -/* Original grid */ - -.mb-grid-div-outer { - width: 100% !important; - height: 100% !important; - max-width: 100% !important; - max-height: 100% !important; - overflow: hidden; - box-sizing: border-box; - padding: 0; - margin: 0; -} - -.mb-grid-div-header { - font-family: Arial; - font-weight: bolder; - padding: 0; - overflow-x: hidden; - overflow-y: scroll; - text-align: left; - box-sizing: border-box; - display: flex; - flex-direction: row; - flex-shrink: 0; - flex-grow: 0; - flex-basis: auto; - align-items: stretch; -} - -.mb-grid-div-body { - font-family: Arial; - background: lightblue; - font-weight: normal; - padding: 0; - overflow-x: scroll; - overflow-y: scroll; - text-align: left; - box-sizing: border-box; -} - -.mb-grid-table { - border: 0; - border-collapse: collapse; - border-spacing: 0; - -webkit-border-horizontal-spacing: 0px; - -webkit-border-vertical-spacing: 0px; - flex-grow: 1; - overflow: hidden; - font-size: 1.0rem; - table-layout: fixed; - text-align: left; - text-indent: unset; - text-overflow: ellipsis; - text-wrap: none; - vertical-align: middle; - width: 100%; -} - -.mb-grid-colgroup { - display: table-column-group; -} - -.mb-grid-thead { -} - -.mb-grid-tbody { -} - -.mb-grid-tr { -} - -.mb-grid-td { - cursor: default; - display: table-cell; - flex: 0 0 auto; - padding: 4px; - font-size: inherit; - text-overflow: ellipsis; - overflow: hidden; - box-sizing: border-box; - white-space: nowrap; - letter-spacing: initial; -} - -.mb-grid-td-group { - display: table-cell; - color: black; - border-bottom: 0px; - border-left: 1px solid darkblue; - border-right: 1px solid darkblue; - border-top: 2px solid darkblue; - font-size: x-large; - font-weight: bolder; - flex: 0 0 auto; -} - -.mb-grid-backgroundcolor-header-background { - background: lightgray; - background-color: lightgray; -} - -.mb-grid-backgroundcolor-row-even { - background-color: khaki; -} - -.mb-grid-backgroundcolor-row-odd { - background-color: lemonchiffon; -} - -.mb-grid-backgroundcolor-row-group { - background-color: lightblue; -} - -.mb-grid-backgroundcolor-row-selected { - background-color: lightgreen; -} - -.mb-grid-header-td-measure { - font-family: Arial; - font-weight: bolder; - border-collapse: collapse; - border-spacing: 0; - -webkit-border-horizontal-spacing: 0px; - -webkit-border-vertical-spacing: 0px; - text-align: left; - text-indent: unset; - display: table-cell; - flex: 0 0 auto; - padding: 4px; - font-size: inherit; - text-overflow: unset; - letter-spacing: initial; - overflow: hidden; - box-sizing: border-box; - white-space: nowrap; - background: #d3d3d3; - border-width: 1px; - border-style: solid; - border-color: black; - color: Black; - background-color: LightGray; -} - -.mb-grid-body-td-measure { - font-family: Arial; - font-weight: normal; - border-collapse: collapse; - border-spacing: 0; - -webkit-border-horizontal-spacing: 0px; - -webkit-border-vertical-spacing: 0px; - text-align: left; - text-indent: unset; - display: table-cell; - flex: 0 0 auto; - padding: 4px; - font-size: inherit; - text-overflow: unset; - letter-spacing: initial; - overflow: hidden; - box-sizing: border-box; - white-space: nowrap; - background-color: khaki; - border-width: 0px 1px 0px 0px; - border-style: solid; - border-color: black; - color: #000000; - cursor: default; -} - diff --git a/Material.Blazor/Components/Grid/MBGrid.ts b/Material.Blazor/Components/Grid/MBGrid.ts deleted file mode 100644 index f35fc376b..000000000 --- a/Material.Blazor/Components/Grid/MBGrid.ts +++ /dev/null @@ -1,101 +0,0 @@ -export function syncScrollByID(gridHeaderID: string, gridBodyID: string) { - const headerDiv: HTMLElement | null = document.getElementById(gridHeaderID); - const bodyDiv: HTMLElement | null = document.getElementById(gridBodyID); - if ((headerDiv != null) && (bodyDiv != null)) { - headerDiv.scrollLeft = bodyDiv.scrollLeft; - } -} - -export function syncScrollByRef(gridHeaderRef: HTMLElement, gridBodyRef: HTMLElement) { - gridHeaderRef.scrollLeft = gridBodyRef.scrollLeft; -} - -export function getScrollBarWidth(className: string): number { - const firstDiv: HTMLDivElement = document.createElement("div"); - - // Set styles - firstDiv.style.position = 'absolute'; - firstDiv.style.visibility = 'hidden'; - firstDiv.style.whiteSpace = 'nowrap'; - firstDiv.style.left = '-9999px'; - - // Set the class - firstDiv.className = className; - - // Append to the body - document.body.appendChild(firstDiv); - - // Create a second div - const secondDiv: HTMLDivElement = document.createElement("div"); - - // Append it as a child of the first div - firstDiv.appendChild(secondDiv); - - // Calculate width - const width: number = firstDiv.offsetWidth - secondDiv.offsetWidth; - - // Remove the divs - document.body.removeChild(firstDiv); - - return width; -} - -export function getTextWidths( - className: string, - currentWidths: number[], - textToMeasure: string[]): number[] { - - // Create an element - const ele: HTMLDivElement = document.createElement('div'); - - // Set styles - ele.style.position = 'absolute'; - ele.style.visibility = 'hidden'; - ele.style.whiteSpace = 'nowrap'; - ele.style.left = '-9999px'; - - // Set the class - ele.className = className; - - // Append to the body - document.body.appendChild(ele); - - // Log time -// console.log("Prior to for loop in getTextWidths " + new Date().toString()); - - for (let i = 0; i < textToMeasure.length; i++) { - // Set the text - ele.innerText = textToMeasure[i]; - - // Get the width - var width: string = window.getComputedStyle(ele).width; - var unadornedWidth: string = width.slice(0, width.indexOf("px")); - var numericWidth: number = parseFloat(unadornedWidth); - var indexMod = i % currentWidths.length; - - if (numericWidth > currentWidths[indexMod]) { - currentWidths[indexMod] = numericWidth; - } - } - - // Log time -// console.log("Completed for loop in getTextWidths " + new Date().toString()); - - // Remove the element - document.body.removeChild(ele); - - - return currentWidths; -} - -export function scrollToIndicatedRow(rowIdentifier: string) -{ - console.log("scrollToIndicatedRow: " + rowIdentifier); - const row = document.getElementById(rowIdentifier); - console.log("scrollToIndicatedRow element: " + row); - if (row != null) - { - console.log("scrollToIndicatedRow scrollIntoView"); - row.scrollIntoView({ behavior: "smooth", block: "start", inline: "nearest" }); - } -} diff --git a/Material.Blazor/Components/Grid/MBGridColumnConfiguration.cs b/Material.Blazor/Components/Grid/MBGridColumnConfiguration.cs deleted file mode 100644 index 8b58364e9..000000000 --- a/Material.Blazor/Components/Grid/MBGridColumnConfiguration.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Drawing; -using System.Linq.Expressions; - -namespace Material.Blazor; - -public class MBGridColumnConfiguration -{ - public Func BackgroundColorExpression { get; set; } - public Color BackgroundColorHeader { get; set; } - public MB_Grid_ColumnType ColumnType { get; private set; } - public Func DataExpression { get; set; } - public Func ForegroundColorExpression { get; set; } - public Color ForegroundColorHeader { get; set; } - public string FormatString { get; set; } - public bool IsPMI { get; set; } - public Func SuppressDisplayExpression { get; set; } - public string Title { get; set; } - public int Width { get; set; } - - private MBGridColumnConfiguration() { } - public MBGridColumnConfiguration( - Expression> backgroundColorExpression = null, - Color? backgroundColorHeader = null, - MB_Grid_ColumnType columnType = MB_Grid_ColumnType.Text, - Expression> dataExpression = null, - Expression> foregroundColorExpression = null, - Color? foregroundColorHeader = null, - string formatString = null, - bool isPMI = false, - Expression> suppressDisplayExpression = null, - string title = "", - int width = 10) - { - BackgroundColorExpression = backgroundColorExpression?.Compile();// ?? Color.LightGray; - BackgroundColorHeader = backgroundColorHeader ?? Color.LightGray; - ColumnType = columnType; - DataExpression = dataExpression?.Compile(); - ForegroundColorExpression = foregroundColorExpression?.Compile();// ?? Color.Black; - ForegroundColorHeader = foregroundColorHeader ?? Color.Black; - FormatString = formatString; - IsPMI = isPMI; - SuppressDisplayExpression = suppressDisplayExpression?.Compile(); - Title = title; - Width = width; - } -} diff --git a/Material.Blazor/Components/Grid/MBGridIconSpecification.cs b/Material.Blazor/Components/Grid/MBGridIconSpecification.cs deleted file mode 100644 index 73786fcb3..000000000 --- a/Material.Blazor/Components/Grid/MBGridIconSpecification.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Drawing; - -namespace Material.Blazor; - -public class MBGridIconSpecification -{ - public Color IconColor { get; set; } -#nullable enable annotations - public IMBIconFoundry? IconFoundry { get; set; } = null; -#nullable restore annotations - public string IconName { get; set; } -} diff --git a/Material.Blazor/Components/Grid/MBGridMT.cs b/Material.Blazor/Components/Grid/MBGridMT.cs deleted file mode 100644 index 51206cea5..000000000 --- a/Material.Blazor/Components/Grid/MBGridMT.cs +++ /dev/null @@ -1,1047 +0,0 @@ -#define Logging - -// ToDo: -// -// Cleanup: -// Move enumerations to MBEnumerations -// -// Bugs: -// Padding resolution for GridHeader -// Resolve issue with ElementReferences -// - -using Material.Blazor.Internal; -using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Components.Rendering; -using Microsoft.AspNetCore.Components.Web; -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -// -// Implements a scrollable, multi-column grid. When created we get a list of column -// config objects and a list of data objects with the column content for each -// row. -// -// We 'select' a line when it is clicked on so the caller can either immediately respond or -// save the selection for later. -// - -namespace Material.Blazor; - -/// -/// A Material Theme grid capable of displaying icons, colored text, and text. -/// -/// N.B.: At this time the grid is in preview. Expect the API to change. -/// -public class MBGridMT : ComponentFoundation -{ - #region Parameters - - /// - /// The configuration of each column to be displayed. See the definition of MBGridColumnConfiguration - /// for details. - /// - [Parameter, EditorRequired] public IEnumerable> ColumnConfigurations { get; set; } = null; - - - /// - /// The Group is an optional boolean indicating that grouping is in effect. - /// - [Parameter] public bool Group { get; set; } = false; - - - /// - /// The GroupedOrderedData contains the data to be displayed. - /// The outer key is used for grouping and is directly displayed if grouping is enabled. - /// The inner key must be a unique identifier - /// that is used to indicate a row that has been clicked. - /// - [Parameter, EditorRequired] public IEnumerable>>> GroupedOrderedData { get; set; } - - - /// - /// A boolean indicating whether the selected row is highlighted - /// - [Parameter] public bool HighlightSelectedRow { get; set; } = false; - - -#nullable enable annotations - /// - /// The KeyExpression is used to add a key to each row of the grid - /// - [Parameter] public Func? KeyExpression { get; set; } = null; -#nullable restore annotations - - - /// - /// LogIdentification is added to logging message to allow differentiation between multiple grids - /// on a single page or component - /// - [Parameter] public string LogIdentification { get; set; } = null; - - - /// - /// Measurement determines the unit of size (EM, Percent, PX) or if the grid is to measure the - /// data widths (FitToData) - /// - [Parameter] public MB_Grid_Measurement Measurement { get; set; } = MB_Grid_Measurement.Percent; - - - /// - /// ObscurePMI controls whether or not columns marked as PMI are obscured. - /// - [Parameter] public bool ObscurePMI { get; set; } - - - /// - /// Callback for a mouse click - /// - [Parameter] public EventCallback OnMouseClick { get; set; } - - - /// - /// Headers are optional - /// - [Parameter] public bool SuppressHeader { get; set; } = false; - - - /// - /// Set to true to apply grid colors, false to suppress. - /// - [Parameter] public bool ApplyColors { get; set; } = false; - - /// - /// Set to true to apply vertical dividers to data rows and headers but not group headers. - /// - [Parameter] public bool ApplyVerticalDividers { get; set; } = false; - - - /// - /// The grid's data table density. - /// - [Parameter] public MBDensity? Density { get; set; } - #endregion - - #region Members - private MBCascadingDefaults.DensityInfo DensityInfo => CascadingDefaults.GetDensityCssClass(CascadingDefaults.AppliedDataTableDensity(Density)); - private float[] ColumnWidthArray; - //private ElementReference GridBodyRef { get; set; } - //private ElementReference GridHeaderRef { get; set; } - //private string GridBodyID { get; set; } = Utilities.GenerateUniqueElementName(); - private string GridHeaderID { get; set; } = Utilities.GenerateUniqueElementName(); - private bool HasCompletedFullRender { get; set; } = false; - private bool IsSimpleRender { get; set; } = true; - private float ScrollWidth { get; set; } - private string SelectedKey { get; set; } = ""; - - //Instantiate a Semaphore with a value of 1. This means that only 1 thread can be granted access at a time. - private readonly SemaphoreSlim semaphoreSlim = new(1, 1); - - private bool ShouldRenderValue { get; set; } = true; - - #endregion - - #region BuildColGroup - private void BuildColGroup(RenderTreeBuilder builder, ref int rendSeq) - { - // Create the sizing colgroup collection - builder.OpenElement(rendSeq++, "colgroup"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-colgroup"); - var colIndex = 0; - foreach (var col in ColumnConfigurations) - { - var styleStr = CreateMeasurementStyle(col, ColumnWidthArray[colIndex]); - builder.OpenElement(rendSeq++, "col"); - builder.AddAttribute(rendSeq++, "style", styleStr); - builder.CloseElement(); // col - colIndex++; - } - builder.CloseElement(); // colgroup - } - #endregion - - #region BuildNewGridTD - private static string BuildNewGridTD( - RenderTreeBuilder builder, - ref int rendSeq, - bool isFirstColumn, - bool isHeaderRow, - string rowBackgroundColorClass) - { - builder.OpenElement(rendSeq++, "td"); - builder.AddAttribute(rendSeq++, "class", "mb-grid-td " + rowBackgroundColorClass); - - if (isHeaderRow) - { - if (isFirstColumn) - { - // T R B L - return " border-width: 1px; border-style: solid; border-color: black; "; - } - else - { - // T R B - return " border-width: 1px 1px 1px 0px; border-style: solid; border-color: black; "; - } - } - else - { - if (isFirstColumn) - { - // R L - return " border-width: 0px 1px 0px 1px; border-style: solid; border-color: black; "; - } - else - { - // R - return " border-width: 0px 1px 0px 0px; border-style: solid; border-color: black; "; - } - } - } - #endregion - - #region BuildRenderTree - protected override void BuildRenderTree(RenderTreeBuilder builder) - { -#if Logging - GridLogDebug("BuildRenderTree entered; IsSimpleRender == " + IsSimpleRender.ToString()); - GridLogDebug(" HasCompletedFullRender == " + HasCompletedFullRender.ToString()); - GridLogDebug(" ShouldRenderValue == " + ShouldRenderValue.ToString()); -#endif - if (IsSimpleRender || (!ShouldRenderValue)) - { -#if Logging - GridLogDebug(" (Simple) entered"); -#endif - // We are going to render a DIV and nothing else - // We need to get into OnAfterRenderAsync so that we can use JS interop to measure - // the text - base.BuildRenderTree(builder); - builder.OpenElement(1, "div"); - builder.CloseElement(); - HasCompletedFullRender = false; -#if Logging - GridLogDebug(" (Simple) leaving"); -#endif - } - else - { -#if Logging - GridLogDebug(" (Full) entered"); -#endif - - // - // Using the column cfg and column data, render our list. Here is the layout. - // The column headers are optional. - // - // div class="@class", style="@style" - // div mb-grid-header - Contains the header and the vscroll - // table - - // tr - - // td* - Header - // div mb-grid-body - Contains the rows and the vscroll - // table - Contains the rows - // tr* - Rows - // td* - Columns of the row - // - - base.BuildRenderTree(builder); - var rendSeq = 2; - string classStr = $"mdc-data-table{(DensityInfo.ApplyCssClass ? $" {DensityInfo.CssClassName}" : "")} mdc-data-table--sticky-header mb-mgrid{(ApplyColors ? " mb-mgrid__colored" : "")}{(ApplyVerticalDividers ? " mb-mgrid__vertical-dividers" : "")} {@class}"; - var columnCount = ColumnConfigurations.Count().ToString(); - - builder.OpenElement(rendSeq++, "div"); - builder.AddAttribute(rendSeq++, "class", classStr); - builder.AddAttribute(rendSeq++, "style", style); - - if (!SuppressHeader || GroupedOrderedData != null) - { - builder.OpenElement(rendSeq++, "div"); - builder.AddAttribute(rendSeq++, "class", "mdc-data-table__table-container"); - builder.OpenElement(rendSeq++, "table"); - builder.AddAttribute(rendSeq++, "class", "mdc-data-table__table"); - BuildColGroup(builder, ref rendSeq); - - // Based on the column config generate the column titles unless asked not to - if (!SuppressHeader) - { - //BuildColGroup(builder, ref rendSeq); - builder.OpenElement(rendSeq++, "thead"); - builder.OpenElement(rendSeq++, "tr"); - //builder.AddAttribute(rendSeq++, "class", "mdc-data-table__header-row mb-grid-material-trx"); - builder.AddAttribute(rendSeq++, "class", "mdc-data-table__header-row"); - - // For each column output a TD - var colCount = 0; - foreach (var col in ColumnConfigurations) - { - //styleStr = BuildNewGridTD( - // builder, - // ref rendSeq, - // colCount == 0, - // isHeaderRow, - // "mb-grid-backgroundcolor-header-background"); - - //// Set the header colors - //styleStr += " color: " + col.ForegroundColorHeader.Name + ";"; - //styleStr += " background-color : " + col.BackgroundColorHeader.Name + ";"; - builder.OpenElement(rendSeq++, "td"); - builder.AddAttribute(rendSeq++, "class", "mdc-data-table__header-cell"); - //builder.AddAttribute(rendSeq++, "style", styleStr); - builder.AddContent(rendSeq++, col.Title); - - // Close this column TD - builder.CloseElement(); - - colCount++; - } - - builder.CloseElement(); // tr - - builder.CloseElement(); // thead - } - - // - // We now need to build a "display centric" data representation with rows added for breaks, etc. - // For the first pass we are going to skip this step and just display the raw content - // - - if (GroupedOrderedData != null) - { - //var isFirstGrouper = true; - - //BuildColGroup(builder, ref rendSeq); - builder.OpenElement(rendSeq++, "tbody"); - builder.AddAttribute(rendSeq++, "class", "mdc-data-table__content"); - - foreach (var kvp in GroupedOrderedData) - { - if (Group) - { - // We output a row with the group name - // Do a div for this row - builder.OpenElement(rendSeq++, "tr"); - builder.AddAttribute(rendSeq++, "class", "mdc-data-table__row mb-mgrid__group-row"); - builder.OpenElement(rendSeq++, "td"); - builder.AddAttribute(rendSeq++, "colspan", columnCount); - builder.AddAttribute(rendSeq++, "class", "mdc-data-table__cell"); - //if (isFirstGrouper) - //{ - // isFirstGrouper = false; - // builder.AddAttribute(rendSeq++, "style", "border-top: 1px solid black; "); - //} - //builder.AddAttribute(rendSeq++, "mbgrid-td-wide", "0"); - builder.AddContent(rendSeq++, " " + kvp.Key); - builder.CloseElement(); // td - builder.CloseElement(); // tr - } - - var rowCount = 0; - foreach (var rowValues in kvp.Value) - { - var rowKey = KeyExpression(rowValues.Value).ToString(); - - //string rowBackgroundColorClass = ""; - - //if ((rowKey == SelectedKey) && HighlightSelectedRow) - //{ - // // It's the selected row so set the selection color as the background - // rowBackgroundColorClass = "mb-mgrid__row-selected"; - //} - //else - //{ - // // Not selected or not highlighted so we alternate - // if ((rowCount / 2) * 2 == rowCount) - // { - // // Even - // rowBackgroundColorClass = "mb-grid-backgroundcolor-row-even"; - // } - // else - // { - // // Odd - // rowBackgroundColorClass = "mb-grid-backgroundcolor-row-odd"; - // } - //} - - var selected = (rowKey == SelectedKey) && HighlightSelectedRow; - // Do a tr - builder.OpenElement(rendSeq++, "tr"); - //builder.AddAttribute(rendSeq++, "class", "mb-grid-tr " + rowBackgroundColorClass); - builder.AddAttribute(rendSeq++, "class", $"mdc-data-table__row mb-mgrid__row{(selected ? " mb-mgrid__row-selected" : "")}"); - - builder.AddAttribute - ( - rendSeq++, - "onclick", - EventCallback.Factory.Create(this, e => OnMouseClickInternal(rowKey)) - ); - - // For each column output a td - var colCount = 0; - foreach (var columnDefinition in ColumnConfigurations) - { - //styleStr = BuildNewGridTD( - // builder, - // ref rendSeq, - // colCount == 0, - // isHeaderRow, - // rowBackgroundColorClass); - builder.OpenElement(rendSeq++, "td"); - builder.AddAttribute(rendSeq++, "class", "mdc-data-table__cell"); - - switch (columnDefinition.ColumnType) - { - case MB_Grid_ColumnType.Icon: - if (columnDefinition.DataExpression != null) - { - try - { - var value = (MBGridIconSpecification)columnDefinition.DataExpression(rowValues.Value); - - // We need to add the color alignment to the base styles - //styleStr += - // " color: " + ColorToCSSColor(value.IconColor) + ";" - // + " text-align: center;"; - - //builder.AddAttribute(rendSeq++, "style", styleStr); - builder.OpenComponent(rendSeq++, typeof(MBIcon)); - builder.AddAttribute(rendSeq++, "IconFoundry", value.IconFoundry); - builder.AddAttribute(rendSeq++, "IconName", value.IconName); - builder.CloseComponent(); - } - catch - { - throw new Exception("Backing value incorrect for MBGrid.Icon column."); - } - } - break; - - case MB_Grid_ColumnType.Text: - // It's a text type column so add the text related styles - // We may be overriding the alternating row color added by class - - //if (columnDefinition.ForegroundColorExpression != null) - //{ - // var value = columnDefinition.ForegroundColorExpression(rowValues.Value); - // styleStr += - // " color: " + ColorToCSSColor((Color)value) + "; "; - //} - - //if (columnDefinition.BackgroundColorExpression != null) - //{ - // var value = columnDefinition.BackgroundColorExpression(rowValues.Value); - // if ((Color)value != Color.Transparent) - // { - // styleStr += - // " background-color: " + ColorToCSSColor((Color)value) + "; "; - // } - //} - - //if (columnDefinition.IsPMI && ObscurePMI) - //{ - // styleStr += - // " filter: blur(0.25em); "; - //} - - //builder.AddAttribute(rendSeq++, "style", styleStr); - - // Bind the object as our content. - if (columnDefinition.DataExpression != null) - { - var value = columnDefinition.DataExpression(rowValues.Value); - var formattedValue = string.IsNullOrEmpty(columnDefinition.FormatString) ? value?.ToString() : string.Format("{0:" + columnDefinition.FormatString + "}", value); - builder.AddContent(1, formattedValue); - } - break; - - case MB_Grid_ColumnType.TextColor: - if (columnDefinition.DataExpression != null) - { - try - { - var value = (MBGridTextColorSpecification)columnDefinition.DataExpression(rowValues.Value); - - if (value.Suppress) - { - //builder.AddAttribute(rendSeq++, "style", styleStr); - } - else - { - // We need to add the colors - //styleStr += - // " color: " + ColorToCSSColor(value.ForegroundColor) - // + "; background-color: " + ColorToCSSColor(value.BackgroundColor) + ";"; - - //if (columnDefinition.IsPMI && ObscurePMI) - //{ - // styleStr += - // " filter: blur(0.25em); "; - //} - - //builder.AddAttribute(rendSeq++, "style", styleStr); - builder.AddContent(rendSeq++, value.Text); - } - } - catch - { - throw new Exception("Backing value incorrect for MBGrid.TextColor column."); - } - } - break; - - default: - throw new Exception("MBGrid -- Unknown column type"); - } - - // Close this column span - builder.CloseElement(); - - colCount++; - } - - // Close this row's div - builder.CloseElement(); - - rowCount++; - } - } - - builder.CloseElement(); // tbody - } - - builder.CloseElement(); //div mdc-data-table__table-container - builder.CloseElement(); //table - - //builder.CloseElement(); // div mb-grid-header - - //builder.CloseElement(); // div class= style= - } - - builder.CloseElement(); // div mdc-data-table - - HasCompletedFullRender = true; -#if Logging - GridLogDebug(" (Full) leaving"); -#endif - } -#if Logging - GridLogDebug(" leaving; IsSimpleRender == " + IsSimpleRender.ToString()); - GridLogDebug(" leaving; HasCompletedFullRender == " + HasCompletedFullRender.ToString()); -#endif - } - #endregion - - #region ColorToCSSColor - private static string ColorToCSSColor(Color color) - { - int rawColor = color.ToArgb(); - rawColor &= 0xFFFFFF; - return "#" + rawColor.ToString("X6"); - } - #endregion - - #region CreateMeasurementStyle - private string CreateMeasurementStyle(MBGridColumnConfiguration col, float columnWidth) - { - string subStyle = Measurement switch - { - MB_Grid_Measurement.EM => "em", - MB_Grid_Measurement.FitToData => "", - MB_Grid_Measurement.PX => "px", - MB_Grid_Measurement.Percent => "%", - _ => throw new Exception("Unexpected measurement type in MBGrid"), - }; - - if (subStyle.Length > 0) - { - return - "width: " + col.Width.ToString() + subStyle + " !important; " + - "max-width: " + col.Width.ToString() + subStyle + " !important; " + - "min-width: " + col.Width.ToString() + subStyle + " !important; "; - } - else - { - return - "width: " + columnWidth.ToString() + "px !important; " + - "max-width: " + columnWidth.ToString() + "px !important; " + - "min-width: " + columnWidth.ToString() + "px !important; "; - } - } - #endregion - - #region Logging - - private void GridLogDebug(string message) - { - if (string.IsNullOrWhiteSpace(LogIdentification)) - { - LoggingService.LogDebug(message); - } - else - { - LoggingService.LogDebug("[" + LogIdentification + "] " + message); - } - } - - private void GridLogTrace(string message) - { - if (string.IsNullOrWhiteSpace(LogIdentification)) - { - LoggingService.LogTrace(message); - } - else - { - LoggingService.LogTrace("[" + LogIdentification + "] " + message); - } - } - - #endregion - - #region OnAfterRenderAsync - protected override async Task OnAfterRenderAsync(bool firstRender) - { - var needsSHC = false; - await semaphoreSlim.WaitAsync(); - try - { - await base.OnAfterRenderAsync(firstRender); - -#if Logging - GridLogDebug("OnAfterRenderAsync entered"); - GridLogDebug(" firstRender: " + firstRender.ToString()); - GridLogDebug(" IsSimpleRender: " + IsSimpleRender.ToString()); -#endif - - if (IsSimpleRender) - { - IsSimpleRender = false; - needsSHC = true; - } - } - finally - { - if (needsSHC) - { - await InvokeAsync(StateHasChanged); - } -#if Logging - GridLogDebug(" about to release semaphore (OnAfterRenderAsync)"); -#endif - semaphoreSlim.Release(); - } - } - #endregion - - #region OnInitialized - protected override async Task OnInitializedAsync() - { -#if Logging - GridLogDebug("MBGrid.OnInitialized entered"); -#endif - await base.OnInitializedAsync(); - - if (ColumnConfigurations == null) - { - throw new System.Exception("MBGrid requires column configuration definitions."); - } -#if Logging - GridLogDebug("MBGrid.OnInitialized completed"); -#endif - } - #endregion - - #region OnMouseClickInternal - private void OnMouseClickInternal(string newRowKey) - { -#if Logging - GridLogDebug("OnMouseClickInternal with HighlightSelectedRow:" + HighlightSelectedRow.ToString()); -#endif - if (newRowKey != SelectedKey) - { - SelectedKey = newRowKey; - OnMouseClick.InvokeAsync(newRowKey); - } - else - { - OnMouseClick.InvokeAsync(newRowKey); - } - } - #endregion - - #region SetParametersAsync - private int oldParameterHash { get; set; } = -1; - public override Task SetParametersAsync(ParameterView parameters) - { - base.SetParametersAsync(parameters); -#if Logging - GridLogDebug("SetParametersAsync entry"); -#endif - semaphoreSlim.WaitAsync(); - try - { - foreach (var parameter in parameters) - { - switch (parameter.Name) - { - case nameof(@class): - @class = (string)parameter.Value; - break; - case nameof(ColumnConfigurations): - ColumnConfigurations = (IEnumerable>)parameter.Value; - // - // We are going to measure the actual sizes using JS if the Measurement is FitToData - // We need to create the ColumnWidthArray regardless of the measurement type as we need to pass - // values to BuildColGroup->CreateMeasurementStyle - // - ColumnWidthArray = new float[ColumnConfigurations.Count()]; - break; - case nameof(Group): - Group = (bool)parameter.Value; - break; - case nameof(GroupedOrderedData): - GroupedOrderedData = (IEnumerable>>>)parameter.Value; - break; - case nameof(HighlightSelectedRow): - HighlightSelectedRow = (bool)parameter.Value; - break; - case nameof(KeyExpression): - KeyExpression = (Func)parameter.Value; - break; - case nameof(LogIdentification): - LogIdentification = (string)parameter.Value; - break; - case nameof(Measurement): - Measurement = (MB_Grid_Measurement)parameter.Value; - break; - case nameof(ObscurePMI): - ObscurePMI = (bool)parameter.Value; - break; - case nameof(OnMouseClick): - OnMouseClick = (EventCallback)parameter.Value; - break; - case nameof(style): - style = (string)parameter.Value; - break; - case nameof(SuppressHeader): - SuppressHeader = (bool)parameter.Value; - break; - default: -#if Logging - GridLogTrace("MBGrid encountered an unknown parameter:" + parameter.Name); -#endif - break; - } - } - -#if Logging - GridLogDebug(" about to compute parameter hash"); -#endif - HashCode newParameterHash; - - if (HighlightSelectedRow) - { - newParameterHash = HashCode - .OfEach(ColumnConfigurations) - .And(@class) - .And(Group) - .And(HighlightSelectedRow) - .And(KeyExpression) - .And(Measurement) - .And(ObscurePMI) - .And(OnMouseClick) - .And(SelectedKey) // Not a parameter but if we don't include this we won't re-render after selecting a row - .And(style) - .And(SuppressHeader); - } - else - { - newParameterHash = HashCode - .OfEach(ColumnConfigurations) - .And(@class) - .And(Group) - .And(HighlightSelectedRow) - .And(KeyExpression) - .And(Measurement) - .And(ObscurePMI) - .And(OnMouseClick) - .And(style) - .And(SuppressHeader); - } - - // - // We have to implement the double loop for grouped ordered data as the OfEach/AndEach - // do not recurse into the second enumerable and certainly don't look at the rowValues - // - if ((GroupedOrderedData != null) && (ColumnConfigurations != null)) - { - foreach (var kvp in GroupedOrderedData) - { -#if Logging - GridLogDebug(" key == " + kvp.Key + " with " + kvp.Value.Count().ToString() + " rows"); -#endif - foreach (var rowValues in kvp.Value) - { - var rowKey = KeyExpression(rowValues.Value).ToString(); - - newParameterHash = new HashCode(HashCode.CombineHashCodes( - newParameterHash.value, - HashCode.Of(rowKey))); - - foreach (var columnDefinition in ColumnConfigurations) - { - switch (columnDefinition.ColumnType) - { - case MB_Grid_ColumnType.Icon: - if (columnDefinition.DataExpression != null) - { - try - { - var value = (MBGridIconSpecification)columnDefinition.DataExpression(rowValues.Value); - - newParameterHash = new HashCode(HashCode.CombineHashCodes( - newParameterHash.value, - HashCode.Of(value))); - } - catch - { - throw new Exception("Backing value incorrect for MBGrid.Icon column."); - } - } - break; - - case MB_Grid_ColumnType.Text: - if (columnDefinition.DataExpression != null) - { - var value = columnDefinition.DataExpression(rowValues.Value); - var formattedValue = string.IsNullOrEmpty(columnDefinition.FormatString) ? value?.ToString() : string.Format("{0:" + columnDefinition.FormatString + "}", value); - - newParameterHash = new HashCode(HashCode.CombineHashCodes( - newParameterHash.value, - HashCode.Of(value))); - } - break; - - case MB_Grid_ColumnType.TextColor: - if (columnDefinition.DataExpression != null) - { - try - { - var value = (MBGridTextColorSpecification)columnDefinition.DataExpression(rowValues.Value); - - newParameterHash = new HashCode(HashCode.CombineHashCodes( - newParameterHash.value, - HashCode.Of(value))); - } - catch - { - throw new Exception("Backing value incorrect for MBGrid.TextColor column."); - } - } - break; - - default: - throw new Exception("MBGrid -- Unknown column type"); - } - } - } - } - } - -#if Logging - GridLogDebug(" hash == " + ((int)newParameterHash).ToString()); -#endif - if (newParameterHash == oldParameterHash) - { - // This is a call to ParametersSetAsync with what in all likelyhood is the same - // parameters. Hashing isn't perfect so there is some tiny possibility that new parameters - // are present and the same hash value was computed. - if (HasCompletedFullRender) - { - ShouldRenderValue = false; - } - else - { - ShouldRenderValue = true; - } -#if Logging - GridLogDebug(" EQUAL hash"); -#endif - } - else - { - ShouldRenderValue = true; - IsSimpleRender = true; - oldParameterHash = newParameterHash; -#if Logging - GridLogDebug(" DIFFERING hash"); -#endif - } - } - finally - { -#if Logging - GridLogDebug(" about to release semaphore (SetParametersAsync)"); -#endif - semaphoreSlim.Release(); - } - - return base.SetParametersAsync(ParameterView.Empty); - } - #endregion - - #region ShouldRender - protected override bool ShouldRender() - { - return ShouldRenderValue; - } - #endregion - -} - -//#region HashCode - -///// -///// A hash code used to help with implementing . -///// -///// This code is from the blog post at https://rehansaeed.com/gethashcode-made-easy/ -///// -//public struct HashCode : IEquatable -//{ -// private const int EmptyCollectionPrimeNumber = 19; -// public readonly int value; - -// /// -// /// Initializes a new instance of the struct. -// /// -// /// The value. -// public HashCode(int value) => this.value = value; - -// /// -// /// Performs an implicit conversion from to . -// /// -// /// The hash code. -// /// The result of the conversion. -// public static implicit operator int(HashCode hashCode) => hashCode.value; - -// /// -// /// Implements the operator ==. -// /// -// /// The left. -// /// The right. -// /// The result of the operator. -// public static bool operator ==(HashCode left, HashCode right) => left.Equals(right); - -// /// -// /// Implements the operator !=. -// /// -// /// The left. -// /// The right. -// /// The result of the operator. -// public static bool operator !=(HashCode left, HashCode right) => !(left == right); - -// /// -// /// Takes the hash code of the specified item. -// /// -// /// The type of the item. -// /// The item. -// /// The new hash code. -// public static HashCode Of(T item) => new HashCode(GetHashCode(item)); - -// /// -// /// Takes the hash code of the specified items. -// /// -// /// The type of the items. -// /// The collection. -// /// The new hash code. -// public static HashCode OfEach(IEnumerable items) => -// items == null ? new HashCode(0) : new HashCode(GetHashCode(items, 0)); - -// /// -// /// Adds the hash code of the specified item. -// /// -// /// The type of the item. -// /// The item. -// /// The new hash code. -// public HashCode And(T item) => -// new HashCode(CombineHashCodes(this.value, GetHashCode(item))); - -// /// -// /// Adds the hash code of the specified items in the collection. -// /// -// /// The type of the items. -// /// The collection. -// /// The new hash code. -// public HashCode AndEach(IEnumerable items) -// { -// if (items == null) -// { -// return new HashCode(this.value); -// } - -// return new HashCode(GetHashCode(items, this.value)); -// } - -// /// -// public bool Equals(HashCode other) => this.value.Equals(other.value); - -// /// -// public override bool Equals(object obj) -// { -// if (obj is HashCode) -// { -// return this.Equals((HashCode)obj); -// } - -// return false; -// } - -// /// -// /// Throws . -// /// -// /// Does not return. -// /// Implicitly convert this struct to an to get the hash code. -// [EditorBrowsable(EditorBrowsableState.Never)] -// public override int GetHashCode() => -// throw new NotSupportedException( -// "Implicitly convert this struct to an int to get the hash code."); - -// public static int CombineHashCodes(int h1, int h2) -// { -// unchecked -// { -// // Code copied from System.Tuple so it must be the best way to combine hash codes or at least a good one. -// return ((h1 << 5) + h1) ^ h2; -// } -// } - -// private static int GetHashCode(T item) => item?.GetHashCode() ?? 0; - -// private static int GetHashCode(IEnumerable items, int startHashCode) -// { -// var temp = startHashCode; - -// var enumerator = items.GetEnumerator(); -// if (enumerator.MoveNext()) -// { -// temp = CombineHashCodes(temp, GetHashCode(enumerator.Current)); - -// while (enumerator.MoveNext()) -// { -// temp = CombineHashCodes(temp, GetHashCode(enumerator.Current)); -// } -// } -// else -// { -// temp = CombineHashCodes(temp, EmptyCollectionPrimeNumber); -// } - -// return temp; -// } -//} - -//#endregion - diff --git a/Material.Blazor/Components/Grid/MBGridTextColorSpecification.cs b/Material.Blazor/Components/Grid/MBGridTextColorSpecification.cs deleted file mode 100644 index 25374c548..000000000 --- a/Material.Blazor/Components/Grid/MBGridTextColorSpecification.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Drawing; - -namespace Material.Blazor; - -public class MBGridTextColorSpecification -{ - public Color BackgroundColor { get; set; } - public Color ForegroundColor { get; set; } - public bool Suppress { get; set; } = false; - public string Text { get; set; } -} diff --git a/Material.Blazor/Components/Grid/MBGrid_DataHelper.cs b/Material.Blazor/Components/Grid/MBGrid_DataHelper.cs deleted file mode 100644 index 979c85b4f..000000000 --- a/Material.Blazor/Components/Grid/MBGrid_DataHelper.cs +++ /dev/null @@ -1,210 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; - -namespace Material.Blazor; - -public enum Direction { Ascending, Descending } -public class MBGrid_DataHelper -{ - public IEnumerable>>> - PrepareGridData( - IEnumerable data, - PropertyInfo dataKeyInfo, - PropertyInfo orderPropertyInfo1 = null, - Direction orderDirection1 = Direction.Ascending, - PropertyInfo orderPropertyInfo2 = null, - Direction orderDirection2 = Direction.Ascending, - bool group = false, - PropertyInfo groupPropertyInfo = null, - IEnumerable groupItemEnumerable = null, - Func, - PropertyInfo, - Direction, - PropertyInfo, - Direction, - IEnumerable> OrderData = null, - Func, - bool, - PropertyInfo, - PropertyInfo, - IEnumerable, - IEnumerable>>>> GroupItems = null - ) - { - IEnumerable orderedData; - - if (OrderData == null) - { - orderedData = orderData( - data, - orderPropertyInfo1, - orderDirection1, - orderPropertyInfo2, - orderDirection2); - } - else - { - orderedData = OrderData( - data, - orderPropertyInfo1, - orderDirection1, - orderPropertyInfo2, - orderDirection2); - } - - if (GroupItems == null) - { - return groupItems( - orderedData, - group, - dataKeyInfo, - groupPropertyInfo, - groupItemEnumerable); - } - else - { - return GroupItems( - orderedData, - group, - dataKeyInfo, - groupPropertyInfo, - groupItemEnumerable); - } - } - - private IEnumerable orderData( - IEnumerable data, - PropertyInfo orderPropertyInfo1, - Direction orderDirection1, - PropertyInfo orderPropertyInfo2, - Direction orderDirection2 - ) - { - // Perform the group(s) - IEnumerable orderedData; - - if (orderPropertyInfo1 == null) - { - // No grouping - orderedData = data; - } - else - { - if (orderPropertyInfo2 == null) - { - // grouping by first property - if (orderDirection1 == Direction.Ascending) - { - orderedData = data.OrderBy(x => orderPropertyInfo1.GetValue(x)); - } - else - { - orderedData = data.OrderByDescending(x => orderPropertyInfo1.GetValue(x)); - } - } - else - { - // grouping by both properties - if (orderDirection1 == Direction.Ascending) - { - if (orderDirection2 == Direction.Ascending) - { - orderedData = data - .OrderBy(x => orderPropertyInfo1.GetValue(x)) - .ThenBy(x => orderPropertyInfo2.GetValue(x)); - } - else - { - orderedData = data - .OrderBy(x => orderPropertyInfo1.GetValue(x)) - .ThenByDescending(x => orderPropertyInfo2.GetValue(x)); - } - } - else - { - if (orderDirection2 == Direction.Ascending) - { - orderedData = data - .OrderByDescending(x => orderPropertyInfo1.GetValue(x)) - .ThenBy(x => orderPropertyInfo2.GetValue(x)); - } - else - { - orderedData = data - .OrderByDescending(x => orderPropertyInfo1.GetValue(x)) - .ThenByDescending(x => orderPropertyInfo2.GetValue(x)); - } - } - } - } - return orderedData; - } - - private IEnumerable>>> - groupItems( - IEnumerable orderedData, - bool group, - PropertyInfo dataKeyInfo, - PropertyInfo groupPropertyInfo, - IEnumerable groupItems) - { - List>>> groupedOrderedData = new(); - - // Perform the grouping - if (!group) - { - var tempDataAsSingleGroup = new List>(); - foreach (var db in orderedData) - { - tempDataAsSingleGroup.Add(new KeyValuePair(dataKeyInfo.GetValue(db).ToString(), db)); - } - groupedOrderedData.Add(new KeyValuePair>>("FauxKey", tempDataAsSingleGroup)); - } - else - { - var groupedData = orderedData - .GroupBy(x => groupPropertyInfo.GetValue(x)) - .ToDictionary(g => g.Key.ToString(), g => g.ToList()); - - if (groupItems == null) - { - // We will default to alphabetical order - var sortedGroupedData = new SortedDictionary>(groupedData, StringComparer.CurrentCultureIgnoreCase); - foreach (var kvp in sortedGroupedData) - { - var tempGroupedSortedData = new List>(); - foreach (var db in kvp.Value) - { - tempGroupedSortedData.Add(new KeyValuePair(dataKeyInfo.GetValue(db).ToString(), db)); - } - groupedOrderedData.Add(new KeyValuePair>>(kvp.Key, tempGroupedSortedData)); - } - } - else - { - foreach (var key in groupItems) - { - if (groupedData.ContainsKey(key)) - { - var tempGroupedSortedData = new List>(); - foreach (var db in groupedData[key]) - { - tempGroupedSortedData.Add(new KeyValuePair(dataKeyInfo.GetValue(db).ToString(), db)); - } - groupedOrderedData.Add(new KeyValuePair>>(key, tempGroupedSortedData)); - } - else - { - var tempEmptyGroupedSortedData = new List>(); - groupedOrderedData.Add(new KeyValuePair>>(key, tempEmptyGroupedSortedData)); - } - } - } - } - - return groupedOrderedData; - } -} - diff --git a/Material.Blazor/Components/Scheduler/MBScheduler.cs b/Material.Blazor/Components/Scheduler/MBScheduler.cs deleted file mode 100644 index f1a4eabe1..000000000 --- a/Material.Blazor/Components/Scheduler/MBScheduler.cs +++ /dev/null @@ -1,1192 +0,0 @@ -using Material.Blazor.Internal; -using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Components.Rendering; -using Microsoft.AspNetCore.Components.Web; -using Microsoft.JSInterop; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Threading; -using System.Threading.Tasks; - -// -// Implements a multi-column schedule. -// - -namespace Material.Blazor; - -/// -/// A Material Theme scheduler capable of displaying icons, colored text, and text. -/// -/// N.B.: At this time the scheduler is in preview. Expect the API to change. -/// -public class MBScheduler : ComponentFoundation -{ - #region Members - - /// - /// The set of appointments to be displayed - /// - [Parameter] public IEnumerable Appointments { get; set; } - - /// - /// The number of subcolumns within a day - /// - [Parameter] public int NumberOfSubColumns { get; set; } = 2; - - /// - /// The number of days to be shown - /// - [Parameter] public int NumberOfDays { get; set; } = 5; - - /// - /// Callback for a completed drag event - /// - [Parameter, EditorRequired] public EventCallback OnDragEnd { get; set; } - - /// - /// The initial date - /// - [Parameter] public DateTime StartDate { get; set; } = new DateTime(2022, 04, 04); - - /// - /// The time of the start of the workday - /// - [Parameter] public TimeOnly WorkDayStart { get; set; } = new TimeOnly(7, 0, 0); - - /// - /// The time of the end of the workday - /// - [Parameter] public TimeOnly WorkDayEnd { get; set; } = new TimeOnly(17, 0, 0); - - [Inject] private IJSRuntime JsRuntime { get; set; } - - private int AppointmentColumnWidth { get; set; } - private List ColumnConfigurations { get; set; } - private MBSchedulerAppointment CurrentDragAppointment { get; set; } - private int CurrentDragOffsetX { get; set; } - private int CurrentDragOffsetY { get; set; } - private int DayColumnWidth { get; set; } - private string DropClass { get; set; } = ""; - private int FifteenMinuteHeight { get; set; } - private bool IsFirstMeasurementCompleted { get; set; } = false; - private bool IsSecondMeasurementCompleted { get; set; } = false; - private int LeftEdgeOfColumn1 { get; set; } - private string MeasureBodyRow0Column1ID { get; set; } = Utilities.GenerateUniqueElementName(); - private string MeasureHeaderColumn0ID { get; set; } = Utilities.GenerateUniqueElementName(); - private string MeasureTableID { get; set; } = Utilities.GenerateUniqueElementName(); - private string MeasureWidthID { get; set; } = Utilities.GenerateUniqueElementName(); - - //Instantiate a Semaphore with a value of 1. This means that only 1 thread can be granted access at a time. - private SemaphoreSlim SemaphoreSlim { get; set; } = new(1, 1); - private bool ShouldRenderValue { get; set; } = true; - private ClientBoundingRect TableBoundingRectangle { get; set; } - - #endregion - - #region BuildColGroup - private void BuildColGroup(RenderTreeBuilder builder, ref int rendSeq) - { - // Create the sizing colgroup collection - builder.OpenElement(rendSeq++, "colgroup"); - builder.AddAttribute(rendSeq++, "class", "mb-scheduler-colgroup"); - var colIndex = 0; - foreach (var col in ColumnConfigurations) - { - var styleStr = - "width: " + col.Width.ToString() + "px !important; " + - "max-width: " + col.Width.ToString() + "px !important; " + - "min-width: " + col.Width.ToString() + "px !important; "; - builder.OpenElement(rendSeq++, "col"); - builder.AddAttribute(rendSeq++, "style", styleStr); - builder.CloseElement(); // col - colIndex++; - } - builder.CloseElement(); // colgroup - } - #endregion - - #region BuildRenderTree - protected override void BuildRenderTree(RenderTreeBuilder builder) - { - LoggingService.LogDebug("BuildRenderTree entered; IsMeasurementCompleted == " + IsFirstMeasurementCompleted.ToString()); - LoggingService.LogDebug(" ShouldRenderValue == " + ShouldRenderValue.ToString()); - - base.BuildRenderTree(builder); - var rendSeq = 1; - string styleStr; - - if (!IsFirstMeasurementCompleted) - { - // For the first render we are only going to create a simple table - // with a header of one element at 100% width - - builder.OpenElement(rendSeq++, "div"); - builder.AddAttribute(rendSeq++, "class", "mb-scheduler-div-header mb-scheduler-backgroundcolor-header-background"); - builder.OpenElement(rendSeq++, "table"); - builder.AddAttribute(rendSeq++, "class", "mb-scheduler-table mb-scheduler-table-measurement"); - - builder.OpenElement(rendSeq++, "colgroup"); - builder.AddAttribute(rendSeq++, "class", "mb-scheduler-colgroup"); - var styleStr1 = - "width: 100% !important; " + - "max-width: 100% !important; " + - "min-width: 100% !important; "; - builder.OpenElement(rendSeq++, "col"); - builder.AddAttribute(rendSeq++, "style", styleStr1); - builder.CloseElement(); // col - builder.CloseElement(); // colgroup - - builder.OpenElement(rendSeq++, "thead"); - builder.AddAttribute(rendSeq++, "class", "mb-scheduler-thead"); - builder.OpenElement(rendSeq++, "tr"); - builder.AddAttribute(rendSeq++, "class", "mb-scheduler-tr"); - builder.OpenElement(rendSeq++, "td"); - builder.AddAttribute(rendSeq++, "class", "mb-scheduler-td "); - var styleh = " border-width: 1px; border-style: solid; border-color: black; "; - builder.AddAttribute(rendSeq++, "style", styleh); - builder.AddAttribute(rendSeq++, "id", MeasureWidthID); - builder.AddContent(rendSeq++, "Meaningless title"); - builder.CloseElement(); //td - builder.CloseElement(); // tr - builder.CloseElement(); // thead - builder.CloseElement(); //table - builder.CloseElement(); // div mb-scheduler-header - } - else - { - // - // Using the column cfg and column data, render our scheduler. Here is the layout. - // - // div class="@class", style="@style" - // div mb-scheduler-header - Contains the header - // table - - // tr - - // td* - Header - // div mb-scheduler-body - Contains the rows - // table - Contains the rows - // tr* - Rows - // td* - Columns of the row - // - rendSeq = 100; - - if (((@class != null) && (@class.Length > 0)) || ((style != null) && (style.Length > 0))) - { - builder.OpenElement(rendSeq++, "div"); - builder.AddAttribute(rendSeq++, "class", "mb-scheduler-div-outer " + @class); - builder.AddAttribute(rendSeq++, "style", style); - } - - // Based on the column config generate the column titles - builder.OpenElement(rendSeq++, "div"); - builder.AddAttribute(rendSeq++, "class", "mb-scheduler-div-header mb-scheduler-backgroundcolor-header-background"); - //builder.AddAttribute(rendSeq++, "style", "padding-right: " + ScrollWidth.ToString() + "px; "); - builder.OpenElement(rendSeq++, "table"); - builder.AddAttribute(rendSeq++, "class", "mb-scheduler-table"); - BuildColGroup(builder, ref rendSeq); - builder.OpenElement(rendSeq++, "thead"); - builder.AddAttribute(rendSeq++, "class", "mb-scheduler-thead"); - builder.OpenElement(rendSeq++, "tr"); - builder.AddAttribute(rendSeq++, "class", "mb-scheduler-tr"); - - // For each column output a TD - var isHeaderRow = true; - var colCount = 0; - foreach (var col in ColumnConfigurations) - { - styleStr = BuildScheduleTD( - builder, - ref rendSeq, - colCount == 0, - isHeaderRow, - false, - "mb-scheduler-header"); - - builder.AddAttribute(rendSeq++, "style", styleStr); - if (colCount == 0) - { - builder.AddAttribute(rendSeq++, "id", MeasureHeaderColumn0ID); - } - builder.AddContent(rendSeq++, col.Title); - - // Close this column TD - builder.CloseElement(); - - colCount++; - } - - builder.CloseElement(); // tr - - builder.CloseElement(); // thead - - builder.CloseElement(); //table - - builder.CloseElement(); // div mb-scheduler-header - - // - // We now need to build the background grid showing the time (on the - // hour) and the quarter hour lines - // - - // This div holds the scrolled content - builder.OpenElement(rendSeq++, "div"); - builder.AddAttribute(rendSeq++, "class", "mb-scheduler-div-body"); - builder.OpenElement(rendSeq++, "table"); - builder.AddAttribute(rendSeq++, "class", "mb-scheduler-table @DropClass"); - builder.AddAttribute(rendSeq++, "id", MeasureTableID); - - builder.AddAttribute(rendSeq++, "ondragenter", global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, HandleDragEnter)); - //builder.AddEventPreventDefaultAttribute(rendSeq++, "ondragenter", true); - //builder.AddEventStopPropagationAttribute(rendSeq++, "ondragenter", true); - - builder.AddAttribute(rendSeq++, "ondragleave", global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, HandleDragLeave)); - //builder.AddEventPreventDefaultAttribute(rendSeq++, "ondragleave", true); - //builder.AddEventStopPropagationAttribute(rendSeq++, "ondragleave", true); - - builder.AddAttribute(rendSeq++, "ondragover", global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, HandleDragOver)); - builder.AddEventPreventDefaultAttribute(rendSeq++, "ondragover", true); - //builder.AddEventStopPropagationAttribute(rendSeq++, "ondragover", true); - - builder.AddAttribute(rendSeq++, "ondrop", global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, HandleDragDrop)); - //builder.AddEventPreventDefaultAttribute(rendSeq++, "ondrop", true); - //builder.AddEventStopPropagationAttribute(rendSeq++, "ondrop", true); - - BuildColGroup(builder, ref rendSeq); - builder.OpenElement(rendSeq++, "tbody"); - builder.AddAttribute(rendSeq++, "class", "mb-scheduler-tbody"); - - var dateTime = new DateTime(2022, 1, 1, WorkDayStart.Hour, WorkDayStart.Minute, 0); - var endTime = new DateTime(2022, 1, 1, WorkDayEnd.Hour, WorkDayEnd.Minute, 0); - var rowCount = 0; - var lastRow = Convert.ToInt32(((endTime - dateTime).TotalMinutes / 15) - 1); - while (dateTime < endTime) - { - // We alternate colors - string rowColorClassNormal; - string rowColorClassHidden; - if ((rowCount / 2) * 2 == rowCount) - { - // Even - rowColorClassNormal = "mb-scheduler-color-row-even-normal"; - rowColorClassHidden = "mb-scheduler-color-row-even-hidden"; - } - else - { - // Odd - rowColorClassNormal = "mb-scheduler-color-row-odd-normal"; - rowColorClassHidden = "mb-scheduler-color-row-odd-hidden"; - } - - // Do a tr - builder.OpenElement(rendSeq++, "tr"); - builder.AddAttribute(rendSeq++, "class", "mb-scheduler-tr " + rowColorClassNormal); - - // For each column output a td - colCount = 0; - string rowColorClass = rowColorClassNormal; - foreach (var columnDefinition in ColumnConfigurations) - { - string formattedValue; - if ((colCount == 0) && (dateTime.Minute == 0)) - { - formattedValue = dateTime.ToString("HHmm"); - } - else - { - formattedValue = "."; - rowColorClass = rowColorClassHidden; - } - styleStr = BuildScheduleTD( - builder, - ref rendSeq, - colCount == 0, - false, - rowCount == lastRow, - rowColorClass); - - builder.AddAttribute(rendSeq++, "style", styleStr); - if ((rowCount == 0) && (colCount == 1)) - { - builder.AddAttribute(rendSeq++, "id", MeasureBodyRow0Column1ID); - } - builder.AddContent(rendSeq++, formattedValue); - - // Close this column span - builder.CloseElement(); - - colCount++; - } - - // Close this row's div - builder.CloseElement(); - - rowCount++; - dateTime += new TimeSpan(0, 15, 0); - } - - builder.CloseElement(); // tbody - - builder.CloseElement(); // table - - if (IsSecondMeasurementCompleted) - { - foreach (var appt in Appointments) - { - ComputeAppointmentCoordinates( - appt, - out var x, - out var y, - out var h, - out var w); - - var l = - " Appt: " + - appt.Title + " " + - appt.StartTime.ToString() + " " + - "x/y/h/w " + - x.ToString() + "/" + - y.ToString() + "/" + - h.ToString() + "/" + - w.ToString() + "/"; - LoggingService.LogDebug(l); - - appt.Height = h; - appt.RelativeX = x; - appt.RelativeY = y; - appt.Width = w; - //builder.OpenComponent(rendSeq++); - //builder.AddAttribute(rendSeq++, "Height", h); - //builder.AddAttribute(rendSeq++, "SchedulerAppointment", appt); - //builder.AddAttribute( - // rendSeq++, - // "SchedulerRef", - // global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( - // this)); - //builder.AddAttribute(rendSeq++, "Width", w); - //builder.AddAttribute(rendSeq++, "X", x); - //builder.AddAttribute(rendSeq++, "Y", y); - //builder.CloseComponent(); - - //< div class="mb-scheduler-div-appointment" - // draggable="true" - // @ondragstart="HandleDragStart" - // style="@styleString"> - - //
- // @SchedulerAppointment.Title - // - - // - builder.OpenElement(rendSeq++, "div"); - builder.AddAttribute(rendSeq++, "class", "mb-scheduler-div-appointment"); - builder.AddAttribute(rendSeq++, "draggable", "true"); - builder.AddAttribute(rendSeq++, "ondragstart", global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, HandleDragStart)); - //builder.AddEventPreventDefaultAttribute(rendSeq++, "ondragstart", true); - //builder.AddEventStopPropagationAttribute(rendSeq++, "ondragstart", true); - styleStr = - "background: " + appt.BackgroundColor.Name + ";" + - "border-width: 0; " + - "border-radius: 4px; " + - "border-style: solid; " + - "color: " + appt.ForegroundColor.Name + ";" + - "top: " + y.ToString() + "px; " + - "left: " + x.ToString() + "px; " + - "position: absolute; " + - "width: " + w.ToString() + "px; " + - "height: " + h.ToString() + "px; "; - builder.AddAttribute(rendSeq++, "style", styleStr); - builder.OpenElement(rendSeq++, "div"); - builder.AddAttribute(rendSeq++, "style", "padding: 4px; "); - builder.AddContent(rendSeq++, appt.Title); - builder.CloseComponent(); - builder.CloseComponent(); - } - } - - builder.CloseElement(); // div mb-scheduler-body-outer - - if (((@class != null) && (@class.Length > 0)) || ((style != null) && (style.Length > 0))) - { - builder.CloseElement(); // div class= style= - } - LoggingService.LogDebug(" BuildRenderTree completed"); - } - } - #endregion - - #region BuildScheduleTD - internal static string BuildScheduleTD( - RenderTreeBuilder builder, - ref int rendSeq, - bool isFirstColumn, - bool isHeaderRow, - bool isLastRow, - string rowBackgroundColorClass) - { - builder.OpenElement(rendSeq++, "td"); - builder.AddAttribute(rendSeq++, "class", "mb-scheduler-td " + rowBackgroundColorClass); - - if (isHeaderRow) - { - if (isFirstColumn) - { - // T R B L - return " border-width: 1px; border-style: solid; border-color: black; "; - } - else - { - // T R B - return " border-width: 1px 1px 1px 0px; border-style: solid; border-color: black; "; - } - } - else - { - if (isLastRow) - { - if (isFirstColumn) - { - // R B L - return " border-width: 0px 1px 1px 1px; border-style: solid; border-color: black; "; - } - else - { - // R B - return " border-width: 0px 1px 1px 0px; border-style: solid; border-color: black; "; - } - } - else - { - if (isFirstColumn) - { - // R L - return " border-width: 0px 1px 0px 1px; border-style: solid; border-color: black; "; - } - else - { - // R - return " border-width: 0px 1px 0px 0px; border-style: solid; border-color: black; "; - } - } - } - } - #endregion - - #region ComputeAppointmentCoordinates - - internal void ComputeAppointmentCoordinates( - MBSchedulerAppointment appt, - out int x, - out int y, - out int h, - out int w) - { - var dayOffsetTimespan = appt.StartTime.Date - StartDate; - x = LeftEdgeOfColumn1 + dayOffsetTimespan.Days * DayColumnWidth; - if (appt.Column == 2) - { - x += AppointmentColumnWidth + 2; - } - - var timeOffsetTimespan = appt.StartTime - - new DateTime(appt.StartTime.Year, - appt.StartTime.Month, - appt.StartTime.Day, - WorkDayStart.Hour, - WorkDayStart.Minute, - 0); - y = timeOffsetTimespan.Hours * 4 * FifteenMinuteHeight + - (timeOffsetTimespan.Minutes / 15) * FifteenMinuteHeight; - - var timeHeightTimespan = appt.EndTime - appt.StartTime; - h = timeHeightTimespan.Hours * 4 * FifteenMinuteHeight + - (timeHeightTimespan.Minutes / 15) * FifteenMinuteHeight; - w = AppointmentColumnWidth; - } - - #endregion - - #region HandleDragDrop - - private async Task HandleDragDrop(DragEventArgs dea) - { - DropClass = ""; - // Compute the day offset - var dayOffset = - (Convert.ToInt32(dea.ClientX) - - CurrentDragOffsetX - - Convert.ToInt32(TableBoundingRectangle.left) - - LeftEdgeOfColumn1) / - DayColumnWidth; - if (dayOffset < 0) - { - return; - } - var offset = - (Convert.ToInt32(dea.ClientY) - - CurrentDragOffsetY - - Convert.ToInt32(TableBoundingRectangle.top)); - var timeOffset = - offset / - FifteenMinuteHeight; - //timeOffset = - // (dea.ClientY - - // dea.OffsetY - - // TableBoundingRectangle.top) / - // FifteenMinuteHeight; - if (timeOffset < 0) - { - return; - } - - var delta = CurrentDragAppointment.EndTime - CurrentDragAppointment.StartTime; - var newAppointmentStartTime = StartDate + - new TimeSpan( - dayOffset, - WorkDayStart.Hour, - WorkDayStart.Minute + timeOffset * 15, - 0); - - var dragInfo = new DragEndInfo - { - altKey = dea.AltKey, - ctrlKey = dea.CtrlKey, - metaKey = dea.MetaKey, - appointment = CurrentDragAppointment, - newEndTime = newAppointmentStartTime + delta, - newStartTime = newAppointmentStartTime - }; - - await OnDragEnd.InvokeAsync(dragInfo); - } - - #endregion - - #region HandleDragEnter - - private async Task HandleDragEnter(DragEventArgs dea) - { - await Task.CompletedTask; - DropClass = "mb-scheduler-table-can-drop"; - } - - #endregion - - #region HandleDragLeave - - private async Task HandleDragLeave(DragEventArgs dea) - { - await Task.CompletedTask; - DropClass = ""; - } - - #endregion - - #region HandleDragOver - - private async Task HandleDragOver(DragEventArgs dea) - { - await Task.CompletedTask; - - //dropClass = ""; - - //if (AllowedStatuses != null && !AllowedStatuses.Contains(Container.Payload.Status)) return; - - //await Container.UpdateJobAsync(ListStatus); - } - - #endregion - - #region HandleDragStart - - // this method is invoked from MBAppointment.razor.cs - public async Task HandleDragStart(DragEventArgs dea) - { - CurrentDragOffsetX = Convert.ToInt32(dea.OffsetX); - CurrentDragOffsetY = Convert.ToInt32(dea.OffsetY); - - TableBoundingRectangle = await JsRuntime.InvokeAsync( - "MaterialBlazor.MBScheduler.getElementBoundingClientRect", - MeasureTableID); - - //Find the appointment that is being dragged - foreach (var appt in Appointments) - { - var absoluteLeft = - Convert.ToInt32(TableBoundingRectangle.left) + - appt.RelativeX; - var absoluteRight = absoluteLeft + appt.Width; - var absoluteTop = - Convert.ToInt32(TableBoundingRectangle.top) + - appt.RelativeY; - var absoluteBottom = absoluteTop + appt.Height; - - if ((dea.ClientX >= absoluteLeft) && - (dea.ClientX<= absoluteRight) && - (dea.ClientY>= absoluteTop) && - (dea.ClientY <= absoluteBottom)) - { - CurrentDragAppointment = appt; - break; - } - } - - } - - #endregion - - #region MeasureKeyElementsAsync - private async Task MeasureKeyElementsAsync(bool isFirstMeasurement) - { - if (isFirstMeasurement) - { - // We are now going to adjust the column widths to integral pixel - // values for use in the 2nd rendering - var elementArray = await JsRuntime.InvokeAsync( - "MaterialBlazor.MBScheduler.getElementDimensions", - MeasureWidthID); - var width = Convert.ToInt32(elementArray[1]); - var timeWidth = (6 * width) / 100; - var availableWidth = width - timeWidth; - var standardColumnWidth = availableWidth / NumberOfDays; - foreach (var col in ColumnConfigurations) - { - col.Width = standardColumnWidth; - } - ColumnConfigurations[0].Width = timeWidth; - LoggingService.LogDebug("Measured timeWidth: " + timeWidth.ToString()); - LoggingService.LogDebug("Measured standardColumnWidth: " + standardColumnWidth.ToString()); - } - else - { - var element1Array = await JsRuntime.InvokeAsync( - "MaterialBlazor.MBScheduler.getElementDimensions", - MeasureHeaderColumn0ID); - LeftEdgeOfColumn1 = Convert.ToInt32(element1Array[1]) + 1; - - var element2Array = await JsRuntime.InvokeAsync( - "MaterialBlazor.MBScheduler.getElementDimensions", - MeasureBodyRow0Column1ID); - DayColumnWidth = Convert.ToInt32(element2Array[1]); - FifteenMinuteHeight = Convert.ToInt32(element2Array[0]); - if (NumberOfSubColumns == 1) - { - AppointmentColumnWidth = Convert.ToInt32(element2Array[1]) - 5; - } - else - { - AppointmentColumnWidth = (Convert.ToInt32(element2Array[1]) / 2) - 5; - } - LoggingService.LogDebug("Measured LeftEdgeOfColumn1: " + LeftEdgeOfColumn1.ToString()); - LoggingService.LogDebug("Measured DayColumnWidth: " + DayColumnWidth.ToString()); - LoggingService.LogDebug("Measured FifteenMinuteHeight: " + FifteenMinuteHeight.ToString()); - LoggingService.LogDebug("Measured AppointmentColumnWidth: " + AppointmentColumnWidth.ToString()); - } - } - #endregion - - #region OnAfterRenderAsync - protected override async Task OnAfterRenderAsync(bool firstRender) - { - await SemaphoreSlim.WaitAsync(); - var needsSHC = false; - try - { - await base.OnAfterRenderAsync(firstRender); - - LoggingService.LogDebug("OnAfterRenderAsync entered"); - LoggingService.LogDebug(" firstRender: " + firstRender.ToString()); - LoggingService.LogDebug(" IsFirstMeasurementCompleted: " + IsFirstMeasurementCompleted.ToString()); - LoggingService.LogDebug(" IsSecondMeasurementCompleted: " + IsSecondMeasurementCompleted.ToString()); - - if (!IsFirstMeasurementCompleted) - { - LoggingService.LogDebug(" Calling First MeasureKeyElementsAsync"); - - await MeasureKeyElementsAsync(true); - - needsSHC = true; - IsFirstMeasurementCompleted = true; - } - else - { - if (!IsSecondMeasurementCompleted) - { - LoggingService.LogDebug(" Calling Second MeasureKeyElementsAsync"); - - await MeasureKeyElementsAsync(false); - - needsSHC = true; - IsSecondMeasurementCompleted = true; - } - } - } - finally - { - if (needsSHC) - { - await InvokeAsync(StateHasChanged); - } - - LoggingService.LogDebug(" about to release semaphore (OnAfterRenderAsync)"); - SemaphoreSlim.Release(); - } - } - #endregion - - #region OnInitializedAsync - protected override async Task OnInitializedAsync() - { - LoggingService.LogDebug("MBSchedule.OnInitialized entered"); - - await base.OnInitializedAsync(); - - ValidateParameters(); - - ColumnConfigurations = new(); - ColumnConfigurations.Add(new ColumnConfiguration("Time", 1)); - var date = StartDate; - for (int i = 0; i < NumberOfDays; i++) - { - ColumnConfigurations.Add(new ColumnConfiguration(date.ToString("D"), 1)); - date += new TimeSpan(24, 0, 0); - } - - LoggingService.LogDebug("MBSchedule.OnInitialized completed"); - } - #endregion - - #region SetParametersAsync - private int oldParameterHash { get; set; } = -1; - public override Task SetParametersAsync(ParameterView parameters) - { - LoggingService.LogDebug("SetParametersAsync entry"); - - SemaphoreSlim.WaitAsync(); - try - { - // foreach (var parameter in parameters) - // { - // switch (parameter.Name) - // { - // case nameof(@class): - // @class = (string)parameter.Value; - // break; - // case nameof(ColumnConfigurations): - // ColumnConfigurations = (IEnumerable>)parameter.Value; - // // - // // We are going to measure the actual sizes using JS if the Measurement is FitToData - // // We need to create the ColumnWidthArray regardless of the measurement type as we need to pass - // // values to BuildColGroup->CreateMeasurementStyle - // // - // ColumnWidthArray = new float[ColumnConfigurations.Count()]; - // break; - // case nameof(Group): - // Group = (bool)parameter.Value; - // break; - // case nameof(GroupedOrderedData): - // GroupedOrderedData = (IEnumerable>>>)parameter.Value; - // break; - // case nameof(HighlightSelectedRow): - // HighlightSelectedRow = (bool)parameter.Value; - // break; - // case nameof(KeyExpression): - // KeyExpression = (Func)parameter.Value; - // break; - // case nameof(LogIdentification): - // LogIdentification = (string)parameter.Value; - // break; - // case nameof(Measurement): - // Measurement = (MB_Grid_Measurement)parameter.Value; - // break; - // case nameof(ObscurePMI): - // ObscurePMI = (bool)parameter.Value; - // break; - // case nameof(OnMouseClick): - // OnMouseClick = (EventCallback)parameter.Value; - // break; - // case nameof(style): - // style = (string)parameter.Value; - // break; - // case nameof(SuppressHeader): - // SuppressHeader = (bool)parameter.Value; - // break; - // default: - //#if GridLogging - // GridLogTrace("MBGrid encountered an unknown parameter:" + parameter.Name); - //#endif - // break; - // } - // } - - //#if GridLogging - // GridLogDebug(" about to compute parameter hash"); - //#endif - // HashCode newParameterHash; - - // if (HighlightSelectedRow) - // { - // newParameterHash = HashCode - // .OfEach(ColumnConfigurations) - // .And(@class) - // .And(Group) - // .And(HighlightSelectedRow) - // .And(KeyExpression) - // .And(Measurement) - // .And(ObscurePMI) - // .And(OnMouseClick) - // .And(SelectedKey) // Not a parameter but if we don't include this we won't re-render after selecting a row - // .And(style) - // .And(SuppressHeader); - // } - // else - // { - // newParameterHash = HashCode - // .OfEach(ColumnConfigurations) - // .And(@class) - // .And(Group) - // .And(HighlightSelectedRow) - // .And(KeyExpression) - // .And(Measurement) - // .And(ObscurePMI) - // .And(OnMouseClick) - // .And(style) - // .And(SuppressHeader); - // } - - // // - // // We have to implement the double loop for grouped ordered data as the OfEach/AndEach - // // do not recurse into the second enumerable and certainly don't look at the rowValues - // // - // if ((GroupedOrderedData != null) && (ColumnConfigurations != null)) - // { - // foreach (var kvp in GroupedOrderedData) - // { - //#if GridLogging - // GridLogDebug(" key == " + kvp.Key + " with " + kvp.Value.Count().ToString() + " rows"); - //#endif - // foreach (var rowValues in kvp.Value) - // { - // var rowKey = KeyExpression(rowValues.Value).ToString(); - - // newParameterHash = new HashCode(HashCode.CombineHashCodes( - // newParameterHash.value, - // HashCode.Of(rowKey))); - - // foreach (var columnDefinition in ColumnConfigurations) - // { - // switch (columnDefinition.ColumnType) - // { - // case MB_Grid_ColumnType.Icon: - // if (columnDefinition.DataExpression != null) - // { - // try - // { - // var value = (MBGridIconSpecification)columnDefinition.DataExpression(rowValues.Value); - - // newParameterHash = new HashCode(HashCode.CombineHashCodes( - // newParameterHash.value, - // HashCode.Of(value))); - // } - // catch - // { - // throw new Exception("Backing value incorrect for MBGrid.Icon column."); - // } - // } - // break; - - // case MB_Grid_ColumnType.Text: - // if (columnDefinition.DataExpression != null) - // { - // var value = columnDefinition.DataExpression(rowValues.Value); - // var formattedValue = string.IsNullOrEmpty(columnDefinition.FormatString) ? value?.ToString() : string.Format("{0:" + columnDefinition.FormatString + "}", value); - - // newParameterHash = new HashCode(HashCode.CombineHashCodes( - // newParameterHash.value, - // HashCode.Of(value))); - // } - // break; - - // case MB_Grid_ColumnType.TextColor: - // if (columnDefinition.DataExpression != null) - // { - // try - // { - // var value = (MBGridTextColorSpecification)columnDefinition.DataExpression(rowValues.Value); - - // newParameterHash = new HashCode(HashCode.CombineHashCodes( - // newParameterHash.value, - // HashCode.Of(value))); - // } - // catch - // { - // throw new Exception("Backing value incorrect for MBGrid.TextColor column."); - // } - // } - // break; - - // default: - // throw new Exception("MBGrid -- Unknown column type"); - // } - // } - // } - // } - // } - - //#if GridLogging - // GridLogDebug(" hash == " + ((int)newParameterHash).ToString()); - //#endif - // if (newParameterHash == oldParameterHash) - // { - // // This is a call to ParametersSetAsync with what in all likelyhood is the same - // // parameters. Hashing isn't perfect so there is some tiny possibility that new parameters - // // are present and the same hash value was computed. - // if (HasCompletedFullRender) - // { - // ShouldRenderValue = false; - // } - // else - // { - // ShouldRenderValue = true; - // } - //#if GridLogging - // GridLogDebug(" EQUAL hash"); - //#endif - // } - // else - // { - // ShouldRenderValue = true; - // IsSimpleRender = true; - // IsMeasurementNeeded = true; - // oldParameterHash = newParameterHash; - //#if GridLogging - // GridLogDebug(" DIFFERING hash"); - //#endif - // } - } - finally - { - LoggingService.LogDebug(" about to release semaphore (SetParametersAsync)"); - - SemaphoreSlim.Release(); - } - - // return base.GetSelectionAsync(ParameterView.Empty); - - return base.SetParametersAsync(parameters); - } - #endregion - - #region ShouldRender - protected override bool ShouldRender() - { - return ShouldRenderValue; - } - #endregion - - #region ValidateParameters - internal void ValidateParameters() - { - if ((NumberOfSubColumns < 1) || (NumberOfSubColumns > 2)) - { - throw new Exception("MBScheduler -- Illegal ColumnCount of " + NumberOfSubColumns.ToString()); - } - - if (Appointments == null) - { - throw new Exception("MBScheduler -- Appointments is null"); - } - } - - #endregion - - #region Class ColumnConfiguration - - internal class ColumnConfiguration - { - public string Title { get; set; } - public int Width { get; set; } - - private ColumnConfiguration() { } - public ColumnConfiguration( - string title = "", - int width = 10) - { - Title = title; - Width = width; - } - } - - #endregion - - #region Struct DragEndInformation - public struct DragEndInfo - { - public bool altKey { get; set; } - public MBSchedulerAppointment appointment { get; set; } - public bool ctrlKey { get; set; } - public bool metaKey { get; set; } - public DateTime newEndTime { get; set; } - public DateTime newStartTime { get; set; } - } - - #endregion - - #region Struct HashCode2 - - /// - /// A hash code used to help with implementing . - /// - /// This code is from the blog post at https://rehansaeed.com/gethashcode-made-easy/ - /// - public struct HashCode2 : IEquatable - { - private const int EmptyCollectionPrimeNumber = 19; - public readonly int value; - - /// - /// Initializes a new instance of the struct. - /// - /// The value. - public HashCode2(int value) => this.value = value; - - /// - /// Performs an implicit conversion from to . - /// - /// The hash code. - /// The result of the conversion. - public static implicit operator int(HashCode2 hashCode) => hashCode.value; - - /// - /// Implements the operator ==. - /// - /// The left. - /// The right. - /// The result of the operator. - public static bool operator ==(HashCode2 left, HashCode2 right) => left.Equals(right); - - /// - /// Implements the operator !=. - /// - /// The left. - /// The right. - /// The result of the operator. - public static bool operator !=(HashCode2 left, HashCode2 right) => !(left == right); - - /// - /// Takes the hash code of the specified item. - /// - /// The type of the item. - /// The item. - /// The new hash code. - public static HashCode2 Of(T item) => new HashCode2(GetHashCode(item)); - - /// - /// Takes the hash code of the specified items. - /// - /// The type of the items. - /// The collection. - /// The new hash code. - public static HashCode2 OfEach(IEnumerable items) => - items == null ? new HashCode2(0) : new HashCode2(GetHashCode(items, 0)); - - /// - /// Adds the hash code of the specified item. - /// - /// The type of the item. - /// The item. - /// The new hash code. - public HashCode2 And(T item) => - new HashCode2(CombineHashCodes(this.value, GetHashCode(item))); - - /// - /// Adds the hash code of the specified items in the collection. - /// - /// The type of the items. - /// The collection. - /// The new hash code. - public HashCode2 AndEach(IEnumerable items) - { - if (items == null) - { - return new HashCode2(this.value); - } - - return new HashCode2(GetHashCode(items, this.value)); - } - - public bool Equals(HashCode2 other) => this.value.Equals(other.value); - - public override bool Equals(object obj) - { - if (obj is HashCode2) - { - return this.Equals((HashCode2)obj); - } - - return false; - } - - /// - /// Throws . - /// - /// Does not return. - /// Implicitly convert this struct to an to get the hash code. - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => - throw new NotSupportedException( - "Implicitly convert this struct to an int to get the hash code."); - - public static int CombineHashCodes(int h1, int h2) - { - unchecked - { - // Code copied from System.Tuple so it must be the best way to combine hash codes or at least a good one. - return ((h1 << 5) + h1) ^ h2; - } - } - - private static int GetHashCode(T item) => item?.GetHashCode() ?? 0; - - private static int GetHashCode(IEnumerable items, int startHashCode) - { - var temp = startHashCode; - - var enumerator = items.GetEnumerator(); - if (enumerator.MoveNext()) - { - temp = CombineHashCodes(temp, GetHashCode(enumerator.Current)); - - while (enumerator.MoveNext()) - { - temp = CombineHashCodes(temp, GetHashCode(enumerator.Current)); - } - } - else - { - temp = CombineHashCodes(temp, EmptyCollectionPrimeNumber); - } - - return temp; - } - } - - #endregion - - #region Struct ClientBoundingRect - - public struct ClientBoundingRect - { - public double bottom { get; set; } - public double height { get; set; } - public double left { get; set; } - public double right { get; set; } - public double top { get; set; } - public double width { get; set; } - public double x { get; set; } - public double y { get; set; } - - } - - #endregion -} - diff --git a/Material.Blazor/Components/Scheduler/MBScheduler.md b/Material.Blazor/Components/Scheduler/MBScheduler.md deleted file mode 100644 index ac7ce6848..000000000 --- a/Material.Blazor/Components/Scheduler/MBScheduler.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -uid: C.MBScheduler -title: MBScheduler ---- -# MBScheduler - -## Summary - -A scheduler built on a table base using BuildRenderTree. - -## Warning - -This is a preview version of the scheduler. The expectation must be that implementation details and the API will change. - -## Details - -- tbd. - -  - -  - -[![Components](https://img.shields.io/static/v1?label=Components&message=Plus&color=red)](xref:A.PlusComponents) -[![Docs](https://img.shields.io/static/v1?label=API%20Documentation&message=MBScheduler&color=brightgreen)](xref:Material.Blazor.MBScheduler) \ No newline at end of file diff --git a/Material.Blazor/Components/Scheduler/MBScheduler.scss b/Material.Blazor/Components/Scheduler/MBScheduler.scss deleted file mode 100644 index 3ad8a267f..000000000 --- a/Material.Blazor/Components/Scheduler/MBScheduler.scss +++ /dev/null @@ -1,126 +0,0 @@ -@charset "UTF-8"; - -.mb-scheduler-div-outer { - width: 100% !important; - height: 100% !important; - max-width: 100% !important; - max-height: 100% !important; - overflow: hidden; - box-sizing: border-box; - padding: 0; - margin: 0; -} - -.mb-scheduler-div-header { - font-family: Arial; - font-weight: bolder; - padding: 0; - overflow: hidden; - text-align: center; - box-sizing: border-box; -} - -.mb-scheduler-div-body { - font-family: Arial; - font-weight: normal; - background: lightblue; - padding: 0; - overflow: hidden; - position: relative; - box-sizing: border-box; -} - -.mb-scheduler-table { - border: 0; - border-collapse: collapse; - border-spacing: 0; - overflow: hidden; - font-size: 1.0rem; - table-layout: fixed; - text-align: center; - text-indent: unset; - text-overflow: ellipsis; - vertical-align: middle; -} - -.mb-scheduler-table-can-drop { - border-bottom: 4px dashed green; - border-collapse:unset; - border-spacing:unset; -} - -.mb-scheduler-table-measurement { - width: 100%; -} - -.mb-scheduler-colgroup { - display: table-column-group; -} - -.mb-scheduler-thead { -} - -.mb-scheduler-tbody { -} - -.mb-scheduler-tr { -} - -.mb-scheduler-td { - cursor: default; - display: table-cell; - flex: 0 0 auto; - padding: 4px; - font-size: 12px; - text-overflow: ellipsis; - overflow: hidden; - box-sizing: border-box; - white-space: nowrap; - letter-spacing: initial; -} - -.mb-scheduler-td-group { - display: table-cell; - color: black; - border-bottom: 0px; - border-left: 1px solid darkblue; - border-right: 1px solid darkblue; - border-top: 2px solid darkblue; - font-size: x-large; - font-weight: bolder; - flex: 0 0 auto; -} - -.mb-scheduler-header { - background: lightgray; - background-color: lightgray; - color: black; -} - -.mb-scheduler-color-row-even-normal { - background-color: khaki; - color: black; -} - -.mb-scheduler-color-row-even-hidden { - background-color: khaki; - color: khaki; -} - -.mb-scheduler-color-row-odd-normal { - background-color: lemonchiffon; - color: black; -} - -.mb-scheduler-color-row-odd-hidden { - background-color: lemonchiffon; - color: lemonchiffon; -} - -.mb-scheduler-div-appointment { - cursor: grab; -} - -.mb-scheduler-div-appointment:active { - cursor: grabbing; -} diff --git a/Material.Blazor/Components/Scheduler/MBScheduler.ts b/Material.Blazor/Components/Scheduler/MBScheduler.ts deleted file mode 100644 index aab8b528d..000000000 --- a/Material.Blazor/Components/Scheduler/MBScheduler.ts +++ /dev/null @@ -1,37 +0,0 @@ -export function getElementDimensions( - elementId: string): number[] { - - // Create an element - const element: HTMLElement | null = document.getElementById(elementId); - var retval: number[] = new Array(2); - - if (element != null) { - // Get the height - var height: string = window.getComputedStyle(element).height; - var unadornedHeight: string = height.slice(0, height.indexOf("px")); - var numericHeight: number = parseFloat(unadornedHeight); - retval[0] = numericHeight; - - // Get the width - var width: string = window.getComputedStyle(element).width; - var unadornedWidth: string = width.slice(0, width.indexOf("px")); - var numericWidth: number = parseFloat(unadornedWidth); - retval[1] = numericWidth; - } - - return retval; -} - -export function getElementBoundingClientRect( - elementId: string): DOMRect | null { - - // Create an element - const element: HTMLElement | null = document.getElementById(elementId); - - if (element != null) { - // Get the bounding rectangle - return element.getBoundingClientRect(); - } - - return null; -} diff --git a/Material.Blazor/Components/Scheduler/MBSchedulerAppointment.cs b/Material.Blazor/Components/Scheduler/MBSchedulerAppointment.cs deleted file mode 100644 index f505a1422..000000000 --- a/Material.Blazor/Components/Scheduler/MBSchedulerAppointment.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Drawing; -using System.Linq.Expressions; - -namespace Material.Blazor; - -public class MBSchedulerAppointment -{ - public Color BackgroundColor { get; set; } - public int Column { get; set; } - public DateTime EndTime { get; set; } - public Color ForegroundColor { get; set; } - public int Height { get; set; } - public int RelativeX { get; set; } - public int RelativeY { get; set; } - public DateTime StartTime { get; set; } - public string Title { get; set; } - public Guid Uid { get; set; } - public int Width { get; set; } - -} diff --git a/Material.Blazor/Components/toc.yml b/Material.Blazor/Components/toc.yml index c344c35dc..5d9a5ddff 100644 --- a/Material.Blazor/Components/toc.yml +++ b/Material.Blazor/Components/toc.yml @@ -46,12 +46,6 @@ - name: MBCheckbox topicUid: C.MBCheckbox -- name: MBChipsSelectMulti - topicUid: C.MBChipsSelectMulti - -- name: MBChipsSelectSingle - topicUid: C.MBChipsSelectSingle - - name: MBCircularProgress topicUid: C.MBCircularProgress @@ -79,9 +73,6 @@ - name: MBFloatingActionButton topicUid: C.MBFloatingActionButton -- name: MBGrid - topicUid: C.MBGrid - - name: MBIcon topicUid: C.MBIcon @@ -136,9 +127,6 @@ - name: MBRadioButtonGroup topicUid: C.MBRadioButtonGroup -- name: MBScheduler - topicUid: C.MBScheduler - - name: MBSegmentedButtonMulti topicUid: C.MBSegmentedButtonMulti diff --git a/Material.Blazor/Foundation/ComponentFoundation.cs b/Material.Blazor/Foundation/ComponentFoundation.cs index 5d9e331a3..1761b29f1 100644 --- a/Material.Blazor/Foundation/ComponentFoundation.cs +++ b/Material.Blazor/Foundation/ComponentFoundation.cs @@ -66,6 +66,12 @@ public abstract class ComponentFoundation : ComponentBase, IDisposable private protected ConditionalCssClasses ConditionalCssClasses { get; } = new ConditionalCssClasses(); + /// + /// Allows to run for the next render only. + /// + private protected bool AllowNextOnAfterRenderAsync { get; set; } = false; + + /// /// The concurrent queue for javascript interop actions. /// @@ -328,10 +334,12 @@ protected sealed override void OnAfterRender(bool firstRender) /// protected override Task OnAfterRenderAsync(bool firstRender) { - if (firstRender) + if (firstRender || AllowNextOnAfterRenderAsync) { try { + AllowNextOnAfterRenderAsync = false; + if (ParentDialog != null && !ParentDialog.HasInstantiated) { ParentDialog.RegisterLayoutAction(this); diff --git a/Material.Blazor/Foundation/InputComponent.cs b/Material.Blazor/Foundation/InputComponent.cs index 45d6daa76..0d60d56a8 100644 --- a/Material.Blazor/Foundation/InputComponent.cs +++ b/Material.Blazor/Foundation/InputComponent.cs @@ -85,6 +85,7 @@ public abstract class InputComponent : ComponentFoundation ///// private bool AllowNextRenderOnce { get; set; } = false; + /// /// Gets a string that indicates the status of the field being edited. This will include /// some combination of "modified", "valid", or "invalid", depending on the status of the field. @@ -106,9 +107,10 @@ private protected void AllowAllRenders() #region AllowNextRender - private protected void AllowNextRender() + private protected void AllowNextRender(bool allowNextOnAfterRenderAsync = false) { AllowNextRenderOnce = true; + AllowNextOnAfterRenderAsync = allowNextOnAfterRenderAsync; } #endregion diff --git a/Material.Blazor/Foundation/SingleSelectComponent.cs b/Material.Blazor/Foundation/SingleSelectComponent.cs index dbc1f6640..de501d811 100644 --- a/Material.Blazor/Foundation/SingleSelectComponent.cs +++ b/Material.Blazor/Foundation/SingleSelectComponent.cs @@ -60,7 +60,7 @@ protected override async Task OnParametersSetAsync() } } - AllowNextRender(); + AllowNextRender(true); await InvokeAsync(StateHasChanged).ConfigureAwait(false); } } diff --git a/Material.Blazor/Scripts/material.blazor.ts b/Material.Blazor/Scripts/material.blazor.ts index 8cbcca3e4..6e81952dd 100644 --- a/Material.Blazor/Scripts/material.blazor.ts +++ b/Material.Blazor/Scripts/material.blazor.ts @@ -3,7 +3,6 @@ import * as MBAutocompleteTextField from '../Components/AutocompleteTextField/MB import * as MBBladeSet from '../Components/BladeSet/MBBladeSet'; import * as MBButton from '../Components/Button/MBButton'; import * as MBCard from '../Components/Card/MBCard'; -import * as MBChipsSelectMulti from '../Components/ChipsSelectMulti/MBChipsSelectMulti'; import * as MBCheckbox from '../Components/Checkbox/MBCheckbox'; import * as MBCircularProgress from '../Components/CircularProgress/MBCircularProgress'; import * as MBDataTable from '../Components/DataTable/MBDataTable'; @@ -13,7 +12,6 @@ import * as MBDrawer from '../Components/Drawer/MBDrawer'; import * as MBDragAndDropList from '../Components/DragAndDropList/MBDragAndDropList'; import * as MBFileUpload from '../Components/FileUpload/MBFileUpload'; import * as MBFloatingActionButton from '../Components/FloatingActionButton/MBFloatingActionButton'; -import * as MBGrid from '../Components/Grid/MBGrid'; import * as MBIconButton from '../Components/IconButton/MBIconButton'; import * as MBIconButtonToggle from '../Components/IconButtonToggle/MBIconButtonToggle'; import * as MBLinearProgress from '../Components/LinearProgress/MBLinearProgress'; @@ -21,7 +19,6 @@ import * as MBList from '../Components/List/MBList'; import * as MBMenu from '../Components/Menu/MBMenu'; import * as MBMenuSurface from '../Components/MenuSurface/MBMenuSurface'; import * as MBRadioButton from '../Components/RadioButton/MBRadioButton'; -import * as MBScheduler from '../Components/Scheduler/MBScheduler'; import * as MBSegmentedButtonMulti from '../Components/SegmentedButtonMulti/MBSegmentedButtonMulti'; import * as MBSelect from '../Components/Select/MBSelect'; import * as MBSlider from '../Components/Slider/MBSlider'; @@ -38,7 +35,6 @@ import * as MBTopAppBar from '../Components/TopAppBar/MBTopAppBar'; MBBladeSet, MBButton, MBCard, - MBChipsSelectMulti, MBCheckbox, MBCircularProgress, MBDataTable, @@ -48,7 +44,6 @@ import * as MBTopAppBar from '../Components/TopAppBar/MBTopAppBar'; MBDragAndDropList, MBFileUpload, MBFloatingActionButton, - MBGrid, MBIconButton, MBIconButtonToggle, MBLinearProgress, @@ -56,7 +51,6 @@ import * as MBTopAppBar from '../Components/TopAppBar/MBTopAppBar'; MBMenu, MBMenuSurface, MBRadioButton, - MBScheduler, MBSegmentedButtonMulti, MBSelect, MBSlider, diff --git a/Material.Blazor/Styles/_material-symbols-outlined.scss b/Material.Blazor/Styles/_material-symbols-outlined.scss index a09d8a9bf..202bc5b49 100644 --- a/Material.Blazor/Styles/_material-symbols-outlined.scss +++ b/Material.Blazor/Styles/_material-symbols-outlined.scss @@ -3,7 +3,7 @@ font-family: 'Material Symbols Outlined'; font-style: normal; font-weight: 100 700; - src: url(https://fonts.gstatic.com/s/materialsymbolsoutlined/v164/kJEhBvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oFsI.woff2) format('woff2'); + src: url(https://fonts.gstatic.com/s/materialsymbolsoutlined/v166/kJEhBvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oFsI.woff2) format('woff2'); } .material-symbols-outlined { diff --git a/Material.Blazor/Styles/_material-symbols-rounded.scss b/Material.Blazor/Styles/_material-symbols-rounded.scss index e839806f4..a0c1cd80c 100644 --- a/Material.Blazor/Styles/_material-symbols-rounded.scss +++ b/Material.Blazor/Styles/_material-symbols-rounded.scss @@ -3,7 +3,7 @@ font-family: 'Material Symbols Rounded'; font-style: normal; font-weight: 100 700; - src: url(https://fonts.gstatic.com/s/materialsymbolsrounded/v162/sykg-zNym6YjUruM-QrEh7-nyTnjDwKNJ_190Fjzag.woff2) format('woff2'); + src: url(https://fonts.gstatic.com/s/materialsymbolsrounded/v164/sykg-zNym6YjUruM-QrEh7-nyTnjDwKNJ_190Fjzag.woff2) format('woff2'); } .material-symbols-rounded { diff --git a/Material.Blazor/Styles/_material-symbols-sharp.scss b/Material.Blazor/Styles/_material-symbols-sharp.scss index cce0ebf22..f7d9e8141 100644 --- a/Material.Blazor/Styles/_material-symbols-sharp.scss +++ b/Material.Blazor/Styles/_material-symbols-sharp.scss @@ -3,7 +3,7 @@ font-family: 'Material Symbols Sharp'; font-style: normal; font-weight: 100 700; - src: url(https://fonts.gstatic.com/s/materialsymbolssharp/v160/gNMVW2J8Roq16WD5tFNRaeLQk6-SHQ_R00k4aWE.woff2) format('woff2'); + src: url(https://fonts.gstatic.com/s/materialsymbolssharp/v162/gNMVW2J8Roq16WD5tFNRaeLQk6-SHQ_R00k4aWE.woff2) format('woff2'); } .material-symbols-sharp { diff --git a/Material.Blazor/Styles/material.blazor.scss b/Material.Blazor/Styles/material.blazor.scss index cc52c2dca..131ba9de9 100644 --- a/Material.Blazor/Styles/material.blazor.scss +++ b/Material.Blazor/Styles/material.blazor.scss @@ -20,12 +20,10 @@ @use '../Components/DragAndDropList/MBDragAndDropList.scss'; @use '../Components/FileUpload/MBFileUpload.scss'; @use '../Components/IconButton/MBIconButton.scss'; -@use '../Components/Grid/MBGrid.scss'; @use '../Components/List/MBList.scss'; @use '../Components/Paginator/MBPaginator.scss'; @use '../Components/RadioButton/MBRadioButton.scss'; @use '../Components/RadioButtonGroup/MBRadioButtonGroup.scss'; -@use '../Components/Scheduler/MBScheduler.scss'; @use '../Components/SegmentedButtonMulti/MBSegmentedButtonMulti.scss'; @use '../Components/Select/MBSelect.scss'; @use '../Components/Shield/MBShield.scss'; diff --git a/Material.Blazor/package-lock.json b/Material.Blazor/package-lock.json index a6c235413..4160846fa 100644 --- a/Material.Blazor/package-lock.json +++ b/Material.Blazor/package-lock.json @@ -10,18 +10,18 @@ "license": "MIT", "devDependencies": { "@babel/cli": "^7.23.9", - "@babel/core": "^7.23.9", + "@babel/core": "^7.24.0", "@babel/plugin-transform-class-properties": "^7.23.3", - "@babel/plugin-transform-object-rest-spread": "^7.23.4", - "@babel/plugin-transform-runtime": "^7.23.9", - "@babel/preset-env": "^7.23.9", + "@babel/plugin-transform-object-rest-spread": "^7.24.0", + "@babel/plugin-transform-runtime": "^7.24.0", + "@babel/preset-env": "^7.24.0", "@babel/preset-typescript": "^7.23.3", "babel-loader": "^9.1.3", "fork-ts-checker-webpack-plugin": "^9.0.2", "material-components-web": "14.0.0", "regexp": "^1.0.0", "sass": "1.39.2", - "terser": "^5.27.2", + "terser": "^5.28.1", "ts-loader": "^9.5.1", "typescript": "^5.3.3", "webpack": "^5.90.3", @@ -93,9 +93,9 @@ } }, "node_modules/@babel/core": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.9.tgz", - "integrity": "sha512-5q0175NOjddqpvvzU+kDiSOAk4PfdO6FvwCWoQ6RO7rTzEe8vlo+4HVfcnAREhD4npMs0e9uZypjTwzZPCf/cw==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.24.0.tgz", + "integrity": "sha512-fQfkg0Gjkza3nf0c7/w6Xf34BW4YvzNfACRLmmb7XRLa6XHdR+K9AlJlxneFfWYf6uhOzuzZVTjF/8KfndZANw==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.2.0", @@ -103,11 +103,11 @@ "@babel/generator": "^7.23.6", "@babel/helper-compilation-targets": "^7.23.6", "@babel/helper-module-transforms": "^7.23.3", - "@babel/helpers": "^7.23.9", - "@babel/parser": "^7.23.9", - "@babel/template": "^7.23.9", - "@babel/traverse": "^7.23.9", - "@babel/types": "^7.23.9", + "@babel/helpers": "^7.24.0", + "@babel/parser": "^7.24.0", + "@babel/template": "^7.24.0", + "@babel/traverse": "^7.24.0", + "@babel/types": "^7.24.0", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -178,9 +178,9 @@ } }, "node_modules/@babel/helper-create-class-features-plugin": { - "version": "7.23.10", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.23.10.tgz", - "integrity": "sha512-2XpP2XhkXzgxecPNEEK8Vz8Asj9aRxt08oKOqtiZoqV2UGZ5T+EkyP9sXQ9nwMxBIG34a7jmasVqoMop7VdPUw==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.24.0.tgz", + "integrity": "sha512-QAH+vfvts51BCsNZ2PhY6HAggnlS6omLLFTsIpeqZk/MmJ6cW7tgz5yRv0fMJThcr6FmbMrENh1RgrWPTYA76g==", "dev": true, "dependencies": { "@babel/helper-annotate-as-pure": "^7.22.5", @@ -323,9 +323,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", - "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.24.0.tgz", + "integrity": "sha512-9cUznXMG0+FxRuJfvL82QlTqIzhVW9sL0KjMPHhAOOvpQGL8QtdxnBKILjBqxlHyliz0yCa1G903ZXI/FuHy2w==", "dev": true, "engines": { "node": ">=6.9.0" @@ -443,14 +443,14 @@ } }, "node_modules/@babel/helpers": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.9.tgz", - "integrity": "sha512-87ICKgU5t5SzOT7sBMfCOZQ2rHjRU+Pcb9BoILMYz600W6DkVRLFBPwQ18gwUVvggqXivaUakpnxWQGbpywbBQ==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.24.0.tgz", + "integrity": "sha512-ulDZdc0Aj5uLc5nETsa7EPx2L7rM0YJM8r7ck7U73AXi7qOV44IHHRAYZHY6iU1rr3C5N4NtTmMRUJP6kwCWeA==", "dev": true, "dependencies": { - "@babel/template": "^7.23.9", - "@babel/traverse": "^7.23.9", - "@babel/types": "^7.23.9" + "@babel/template": "^7.24.0", + "@babel/traverse": "^7.24.0", + "@babel/types": "^7.24.0" }, "engines": { "node": ">=6.9.0" @@ -471,9 +471,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.9.tgz", - "integrity": "sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.24.0.tgz", + "integrity": "sha512-QuP/FxEAzMSjXygs8v4N9dvdXzEHN4W1oF3PxuWAtPo08UdM17u89RDMgjLn/mlc56iM0HlLmVkO/wgR+rDgHg==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -1278,14 +1278,14 @@ } }, "node_modules/@babel/plugin-transform-object-rest-spread": { - "version": "7.23.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.23.4.tgz", - "integrity": "sha512-9x9K1YyeQVw0iOXJlIzwm8ltobIIv7j2iLyP2jIhEbqPRQ7ScNgwQufU2I0Gq11VjyG4gI4yMXt2VFags+1N3g==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.24.0.tgz", + "integrity": "sha512-y/yKMm7buHpFFXfxVFS4Vk1ToRJDilIa6fKRioB9Vjichv58TDGXTvqV0dN7plobAmTW5eSEGXDngE+Mm+uO+w==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.23.3", - "@babel/helper-compilation-targets": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5", + "@babel/compat-data": "^7.23.5", + "@babel/helper-compilation-targets": "^7.23.6", + "@babel/helper-plugin-utils": "^7.24.0", "@babel/plugin-syntax-object-rest-spread": "^7.8.3", "@babel/plugin-transform-parameters": "^7.23.3" }, @@ -1441,13 +1441,13 @@ } }, "node_modules/@babel/plugin-transform-runtime": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.23.9.tgz", - "integrity": "sha512-A7clW3a0aSjm3ONU9o2HAILSegJCYlEZmOhmBRReVtIpY/Z/p7yIZ+wR41Z+UipwdGuqwtID/V/dOdZXjwi9gQ==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.24.0.tgz", + "integrity": "sha512-zc0GA5IitLKJrSfXlXmp8KDqLrnGECK7YRfQBmEKg1NmBOQ7e+KuclBEKJgzifQeUYLdNiAw4B4bjyvzWVLiSA==", "dev": true, "dependencies": { "@babel/helper-module-imports": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-plugin-utils": "^7.24.0", "babel-plugin-polyfill-corejs2": "^0.4.8", "babel-plugin-polyfill-corejs3": "^0.9.0", "babel-plugin-polyfill-regenerator": "^0.5.5", @@ -1618,14 +1618,14 @@ } }, "node_modules/@babel/preset-env": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.23.9.tgz", - "integrity": "sha512-3kBGTNBBk9DQiPoXYS0g0BYlwTQYUTifqgKTjxUwEUkduRT2QOa0FPGBJ+NROQhGyYO5BuTJwGvBnqKDykac6A==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.24.0.tgz", + "integrity": "sha512-ZxPEzV9IgvGn73iK0E6VB9/95Nd7aMFpbE0l8KQFDG70cOV9IxRP7Y2FUPmlK0v6ImlLqYX50iuZ3ZTVhOF2lA==", "dev": true, "dependencies": { "@babel/compat-data": "^7.23.5", "@babel/helper-compilation-targets": "^7.23.6", - "@babel/helper-plugin-utils": "^7.22.5", + "@babel/helper-plugin-utils": "^7.24.0", "@babel/helper-validator-option": "^7.23.5", "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.23.3", "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.23.3", @@ -1678,7 +1678,7 @@ "@babel/plugin-transform-new-target": "^7.23.3", "@babel/plugin-transform-nullish-coalescing-operator": "^7.23.4", "@babel/plugin-transform-numeric-separator": "^7.23.4", - "@babel/plugin-transform-object-rest-spread": "^7.23.4", + "@babel/plugin-transform-object-rest-spread": "^7.24.0", "@babel/plugin-transform-object-super": "^7.23.3", "@babel/plugin-transform-optional-catch-binding": "^7.23.4", "@babel/plugin-transform-optional-chaining": "^7.23.4", @@ -1751,9 +1751,9 @@ "dev": true }, "node_modules/@babel/runtime": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.9.tgz", - "integrity": "sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.24.0.tgz", + "integrity": "sha512-Chk32uHMg6TnQdvw2e9IlqPpFX/6NLuK0Ys2PqLb7/gL5uFn9mXvK715FGLlOLQrcO4qIkNHkvPGktzzXexsFw==", "dev": true, "dependencies": { "regenerator-runtime": "^0.14.0" @@ -1763,23 +1763,23 @@ } }, "node_modules/@babel/template": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.23.9.tgz", - "integrity": "sha512-+xrD2BWLpvHKNmX2QbpdpsBaWnRxahMwJjO+KZk2JOElj5nSmKezyS1B4u+QbHMTX69t4ukm6hh9lsYQ7GHCKA==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.24.0.tgz", + "integrity": "sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA==", "dev": true, "dependencies": { "@babel/code-frame": "^7.23.5", - "@babel/parser": "^7.23.9", - "@babel/types": "^7.23.9" + "@babel/parser": "^7.24.0", + "@babel/types": "^7.24.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.9.tgz", - "integrity": "sha512-I/4UJ9vs90OkBtY6iiiTORVMyIhJ4kAVmsKo9KFc8UOxMeUfi2hvtIBsET5u9GizXE6/GFSuKCTNfgCswuEjRg==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.24.0.tgz", + "integrity": "sha512-HfuJlI8qq3dEDmNU5ChzzpZRWq+oxCZQyMzIMEqLho+AQnhMnKQUzH6ydo3RBl/YjPCuk68Y6s0Gx0AeyULiWw==", "dev": true, "dependencies": { "@babel/code-frame": "^7.23.5", @@ -1788,8 +1788,8 @@ "@babel/helper-function-name": "^7.23.0", "@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.23.9", - "@babel/types": "^7.23.9", + "@babel/parser": "^7.24.0", + "@babel/types": "^7.24.0", "debug": "^4.3.1", "globals": "^11.1.0" }, @@ -1798,9 +1798,9 @@ } }, "node_modules/@babel/types": { - "version": "7.23.9", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.9.tgz", - "integrity": "sha512-dQjSq/7HaSjRM43FFGnv5keM2HsxpmyV1PfaSVm0nzzjwwTmjOe6J4bC8e3+pTEIgHaHj+1ZlLThRJ2auc/w1Q==", + "version": "7.24.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.24.0.tgz", + "integrity": "sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w==", "dev": true, "dependencies": { "@babel/helper-string-parser": "^7.23.4", @@ -1821,9 +1821,9 @@ } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", - "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.4.tgz", + "integrity": "sha512-Oud2QPM5dHviZNn4y/WhhYKSXksv+1xLEIsNrAbGcFzUN3ubqWRFT5gwPchNc5NuzILOU4tPBDTZ4VwhL8Y7cw==", "dev": true, "dependencies": { "@jridgewell/set-array": "^1.0.1", @@ -1844,9 +1844,9 @@ } }, "node_modules/@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", "dev": true, "engines": { "node": ">=6.0.0" @@ -1869,9 +1869,9 @@ "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.22", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz", - "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==", + "version": "0.3.23", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.23.tgz", + "integrity": "sha512-9/4foRoUKp8s96tSkh8DlAAc5A0Ty8vLXld+l9gjKKY6ckwI8G15f0hskGmuLZu78ZlGa1vtsfOa+lnB4vG6Jg==", "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", @@ -2670,9 +2670,9 @@ "optional": true }, "node_modules/@types/eslint": { - "version": "8.56.2", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.2.tgz", - "integrity": "sha512-uQDwm1wFHmbBbCZCqAlq6Do9LYwByNZHWzXppSnay9SuwJ+VRbjkbLABer54kcPnMSlG6Fdiy2yaFXm/z9Z5gw==", + "version": "8.56.5", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.5.tgz", + "integrity": "sha512-u5/YPJHo1tvkSF2CE0USEkxon82Z5DBy2xR+qfyYNszpX9qcs4sT6uq2kBbj4BXY1+DBGDPnrhMZV3pKWGNukw==", "dev": true, "dependencies": { "@types/estree": "*", @@ -2702,9 +2702,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.11.19", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.19.tgz", - "integrity": "sha512-7xMnVEcZFu0DikYjWOlRq7NTPETrm7teqUT2WkQjrTIkEgUyyGdWsj/Zg8bEJt5TNklzbPD1X3fqfsHw3SpapQ==", + "version": "20.11.24", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.24.tgz", + "integrity": "sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==", "dev": true, "dependencies": { "undici-types": "~5.26.4" @@ -3150,9 +3150,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001588", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001588.tgz", - "integrity": "sha512-+hVY9jE44uKLkH0SrUTqxjxqNTOWHsbnQDIKjwkZ3lNTzUUVdBLBGXtj/q5Mp5u98r3droaZAewQuEDzjQdZlQ==", + "version": "1.0.30001591", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001591.tgz", + "integrity": "sha512-PCzRMei/vXjJyL5mJtzNiUCKP59dm8Apqc3PH8gJkMnMXZGox93RbE76jHsmLwmIo6/3nsYIpJtx0O7u5PqFuQ==", "dev": true, "funding": [ { @@ -3358,15 +3358,15 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.677", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.677.tgz", - "integrity": "sha512-erDa3CaDzwJOpyvfKhOiJjBVNnMM0qxHq47RheVVwsSQrgBA9ZSGV9kdaOfZDPXcHzhG7lBxhj6A7KvfLJBd6Q==", + "version": "1.4.687", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.687.tgz", + "integrity": "sha512-Ic85cOuXSP6h7KM0AIJ2hpJ98Bo4hyTUjc4yjMbkvD+8yTxEhfK9+8exT2KKYsSjnCn2tGsKVSZwE7ZgTORQCw==", "dev": true }, "node_modules/enhanced-resolve": { - "version": "5.15.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", - "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", + "version": "5.15.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.1.tgz", + "integrity": "sha512-3d3JRbwsCLJsYgvb6NuWEG44jjPSOMuS73L/6+7BZuoKm3W+qXnSoIYVHi8dG7Qcg4inAY4jbzkZ7MnskePeDg==", "dev": true, "dependencies": { "graceful-fs": "^4.2.4", @@ -4932,9 +4932,9 @@ } }, "node_modules/terser": { - "version": "5.27.2", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.27.2.tgz", - "integrity": "sha512-sHXmLSkImesJ4p5apTeT63DsV4Obe1s37qT8qvwHRmVxKTBH7Rv9Wr26VcAMmLbmk9UliiwK8z+657NyJHHy/w==", + "version": "5.28.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.28.1.tgz", + "integrity": "sha512-wM+bZp54v/E9eRRGXb5ZFDvinrJIOaTapx3WUokyVGZu5ucVCK55zEgGd5Dl2fSr3jUo5sDiERErUWLY6QPFyA==", "dev": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", diff --git a/Material.Blazor/package.json b/Material.Blazor/package.json index 22f285583..c4182c850 100644 --- a/Material.Blazor/package.json +++ b/Material.Blazor/package.json @@ -22,18 +22,18 @@ "license": "MIT", "devDependencies": { "@babel/cli": "^7.23.9", - "@babel/core": "^7.23.9", + "@babel/core": "^7.24.0", "@babel/plugin-transform-class-properties": "^7.23.3", - "@babel/plugin-transform-object-rest-spread": "^7.23.4", - "@babel/plugin-transform-runtime": "^7.23.9", - "@babel/preset-env": "^7.23.9", + "@babel/plugin-transform-object-rest-spread": "^7.24.0", + "@babel/plugin-transform-runtime": "^7.24.0", + "@babel/preset-env": "^7.24.0", "@babel/preset-typescript": "^7.23.3", "babel-loader": "^9.1.3", "fork-ts-checker-webpack-plugin": "^9.0.2", "material-components-web": "14.0.0", "regexp": "^1.0.0", "sass": "1.39.2", - "terser": "^5.27.2", + "terser": "^5.28.1", "ts-loader": "^9.5.1", "typescript": "^5.3.3", "webpack": "^5.90.3", diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 152a4fa58..6a14e8729 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -4,6 +4,27 @@ title: ReleaseNotes --- # Release Notes +#### [5.1.4](https://github.com/Material-Blazor/Material.Blazor/tree/5.1.4) + +Released 2024-03-?? + +**Updates** +- MD2/MD3: Dependabot updates +- MD2: Fixed bug in single select components where updates to the item list would not allow items added to the list to be selected. +- MD2: Removed EXPERIMENTAL components (MBGrid, MBGridMT, MBChipsSelectSingle, MBChipsSelectMulti, MBScheduler) + +**New components** + +**New features** + +**Breaking Changes** + +**Deprecated Components** + +**Known issues** + +
+ #### [5.1.3](https://github.com/Material-Blazor/Material.Blazor/tree/5.1.3) Released 2024-02-21