Skip to content

Commit

Permalink
License Explorer fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike-E-angelo committed Jun 4, 2024
1 parent 270fdc3 commit 2bd63b6
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 37 deletions.
21 changes: 16 additions & 5 deletions DragonSpark.Syncfusion/Components/Column.razor
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,19 @@

@code {

protected override void OnInitialized()
{
ActualTemplate = Template != null ? x => Template((T)x) : null;
base.OnInitialized();
}
protected override void OnInitialized()
{
ActualTemplate = Template != null ? x => Template((T)x) : null;
base.OnInitialized();

if (!DisplayFilter)
{
Columns.Execute(Field);
}
}

[CascadingParameter]
ISpecialColumnContainer Columns { get; set; } = default!;

RenderFragment<object>? ActualTemplate { get; set; }

Expand All @@ -39,6 +47,9 @@
[Parameter]
public bool AllowSorting { get; set; } = true;

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

[Parameter]
public string Format { get; set; } = default!;

Expand Down
86 changes: 54 additions & 32 deletions DragonSpark.Syncfusion/Components/DataQueryGrid.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@using BlazorPro.BlazorSize
@using DragonSpark.Compose
@using DragonSpark.Model.Commands
@using DragonSpark.Model.Operations
@using DragonSpark.Presentation
@using DragonSpark.Presentation.Components.Content.Rendering
Expand All @@ -13,45 +14,57 @@

@typeparam T
@inherits DataQueryComponent
@implements ISpecialColumnContainer

@inject IMemoryCache Memory
@inject IContentKey Key
@inject ProtectedSessionStorage Session

<AdaptiveGrid T="T"
@ref="@_subject"
Id="@Id"
Enabled="@_active"
FilterType="@FilterType"
Columns="@Columns"
AllowSelection="@AllowSelection"
AllowPaging="@AllowPaging"
AllowFiltering="@AllowFiltering"
AllowSorting="@AllowSorting"
AllowExport="@AllowExport"
Breakpoint="@Breakpoint"
DesktopToolbar="@DesktopToolbar"
MobileToolbar="@MobileToolbar"
CssClass="@CssClass"
PageSize="@PageSize"
LoadingTemplate="@LoadingTemplate"
@attributes="@AdditionalAttributes">

<GridTemplates EmptyRecordTemplate="@EmptyTemplate"/>

<GridEvents TValue="T" DataBound="OnDataBound" OnActionBegin="@OnActionBegin"/>
<Syncfusion.Blazor.Data.SfDataManager Adaptor="Adaptors.CustomAdaptor">
<DataRequestCallbackAdaptor Requested="@OnRequest"/>
</Syncfusion.Blazor.Data.SfDataManager>
@if (ChildContent is not null)
{
@ChildContent
}
</AdaptiveGrid>
@if (_display)
{
<style>
.e-excelfilter .e-searchbox {
display: none;
}
</style>
}

<CascadingValue TValue="ISpecialColumnContainer" IsFixed="true" Value="@this">
<AdaptiveGrid T="T"
@ref="@_subject"
Id="@Id"
Enabled="@_active"
FilterType="@FilterType"
Columns="@Columns"
AllowSelection="@AllowSelection"
AllowPaging="@AllowPaging"
AllowFiltering="@AllowFiltering"
AllowSorting="@AllowSorting"
AllowExport="@AllowExport"
Breakpoint="@Breakpoint"
DesktopToolbar="@DesktopToolbar"
MobileToolbar="@MobileToolbar"
CssClass="@CssClass"
PageSize="@PageSize"
LoadingTemplate="@LoadingTemplate"
@attributes="@AdditionalAttributes">

<GridTemplates EmptyRecordTemplate="@EmptyTemplate"/>

<GridEvents TValue="T" DataBound="OnDataBound" OnActionBegin="@OnActionBegin"/>
<Syncfusion.Blazor.Data.SfDataManager Adaptor="Adaptors.CustomAdaptor">
<DataRequestCallbackAdaptor Requested="@OnRequest"/>
</Syncfusion.Blazor.Data.SfDataManager>
@if (ChildContent is not null)
{
@ChildContent
}
</AdaptiveGrid>
</CascadingValue>

@code {
readonly Model.Results.Switch _refresh = new(), _active = new(true), _update = new(true);

readonly Model.Results.Switch _refresh = new(), _active = new(true), _update = new(true), _display = new();
readonly HashSet<string> _columns = new();
GridStateVariable _store = null!;
AdaptiveGrid<T>? _subject;

Expand Down Expand Up @@ -140,6 +153,10 @@
{
switch (arg.RequestType)
{
case Action.FilterBeforeOpen:
_display.Execute(_columns.Contains(arg.ColumnName));
break;

case Action.BeginEdit:
var allow = new Allow<T>(arg.Data);
await Editing.InvokeAsync(allow);
Expand Down Expand Up @@ -169,4 +186,9 @@
base.OnParametersSet();
}

void ICommand<string>.Execute(string parameter)
{
_columns.Add(parameter);
}

}
5 changes: 5 additions & 0 deletions DragonSpark.Syncfusion/Components/SpecialColumnContainer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using DragonSpark.Model.Commands;

namespace DragonSpark.SyncfusionRendering.Components;

public interface ISpecialColumnContainer : ICommand<string>;

0 comments on commit 2bd63b6

Please sign in to comment.