mirror of
https://gitee.com/ThingsGateway/ThingsGateway.git
synced 2025-10-20 10:50:48 +08:00
build: 10.11.101
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<div class="tg-table h-100">
|
||||
|
||||
<Table TItem="TItem" IsBordered="true" IsStriped="true" TableSize="TableSize.Compact" SelectedRows=SelectedRows SelectedRowsChanged=privateSelectedRowsChanged IsMultipleSelect="IsMultipleSelect" @ref="Instance" SearchTemplate="SearchTemplate"
|
||||
DataService="DataService" CreateItemCallback="CreateItemCallback!"
|
||||
DataService="DataService" CreateItemCallback="CreateItemCallback!" RenderMode=RenderMode
|
||||
IsPagination="IsPagination" PageItemsSource="PageItemsSource" IsFixedHeader="IsFixedHeader" IndentSize=24 RowHeight=RowHeight ShowSearchText="ShowSearchText" ShowSearchButton="ShowSearchButton" DisableEditButtonCallback="DisableEditButtonCallback" DisableDeleteButtonCallback="DisableDeleteButtonCallback" BeforeShowEditDialogCallback=" BeforeShowEditDialogCallback!"
|
||||
IsTree="IsTree" OnTreeExpand="OnTreeExpand!" TreeNodeConverter="TreeNodeConverter!" TreeIcon="fa-solid fa-circle-chevron-right" TreeExpandIcon="fa-solid fa-circle-chevron-right fa-rotate-90" IsAutoQueryFirstRender=IsAutoQueryFirstRender
|
||||
ShowDefaultButtons="ShowDefaultButtons" ShowAdvancedSearch="ShowAdvancedSearch" ShowResetButton=ShowResetButton
|
||||
|
@@ -14,6 +14,10 @@ namespace ThingsGateway.Admin.Razor;
|
||||
public partial class AdminTable<TItem> where TItem : class, new()
|
||||
{
|
||||
|
||||
/// <inheritdoc cref="Table{TItem}.RenderMode"/>
|
||||
[Parameter]
|
||||
public TableRenderMode RenderMode { get; set; }
|
||||
|
||||
public List<ITableColumn> Columns => Instance?.Columns;
|
||||
|
||||
|
||||
|
@@ -8,8 +8,6 @@
|
||||
// QQ群:605534569
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using ThingsGateway.NewLife.Log;
|
||||
|
||||
namespace ThingsGateway.NewLife;
|
||||
|
||||
/// <summary>
|
||||
|
@@ -8,8 +8,6 @@
|
||||
// QQ群:605534569
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using ThingsGateway.NewLife;
|
||||
|
||||
namespace ThingsGateway;
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
@@ -1,7 +1,6 @@
|
||||
using System.Reflection;
|
||||
|
||||
using ThingsGateway.NewLife.Log;
|
||||
using ThingsGateway.NewLife.Reflection;
|
||||
|
||||
namespace ThingsGateway.NewLife.Threading;
|
||||
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<Project>
|
||||
|
||||
<PropertyGroup>
|
||||
<PluginVersion>10.11.100</PluginVersion>
|
||||
<ProPluginVersion>10.11.100</ProPluginVersion>
|
||||
<DefaultVersion>10.11.100</DefaultVersion>
|
||||
<PluginVersion>10.11.101</PluginVersion>
|
||||
<ProPluginVersion>10.11.101</ProPluginVersion>
|
||||
<DefaultVersion>10.11.101</DefaultVersion>
|
||||
<AuthenticationVersion>10.11.6</AuthenticationVersion>
|
||||
<SourceGeneratorVersion>10.11.6</SourceGeneratorVersion>
|
||||
<NET8Version>8.0.20</NET8Version>
|
||||
|
@@ -73,7 +73,7 @@ public interface IChannelOptions
|
||||
bool RtsEnable { get; set; }
|
||||
|
||||
bool StreamAsync { get; set; }
|
||||
|
||||
|
||||
Handshake Handshake { get; set; }
|
||||
#endregion
|
||||
/// <summary>
|
||||
|
@@ -100,7 +100,7 @@ public static class LoggerExtensions
|
||||
/// </summary>
|
||||
public static string GetDeviceLogBasePath()
|
||||
{
|
||||
return PathExtensions.CombinePathWithOs("Logs","DeviceLog");
|
||||
return PathExtensions.CombinePathWithOs("Logs", "DeviceLog");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@@ -143,7 +143,7 @@ public class Channel : ChannelOptionsBase, IPrimaryIdEntity, IBaseDataEntity, IB
|
||||
[SugarColumn(ColumnDescription = "StreamAsync", IsNullable = true)]
|
||||
[AutoGenerateColumn(Visible = false, Filterable = true, Sortable = true)]
|
||||
public override bool StreamAsync { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Handshake
|
||||
/// </summary>
|
||||
|
@@ -5,7 +5,6 @@
|
||||
@using ThingsGateway.Admin.Razor
|
||||
@using ThingsGateway.Gateway.Application
|
||||
@inherits ComponentDefault
|
||||
@typeparam TItem
|
||||
|
||||
|
||||
@foreach (var col in RowContent.Columns)
|
||||
@@ -14,13 +13,7 @@
|
||||
<DynamicElement TagName="div" TriggerClick="@false"
|
||||
StopPropagation="false"
|
||||
class="@GetCellClassString(col, false, false)">
|
||||
@{
|
||||
<DynamicElement TagName="div" TriggerDoubleClick="false" GenerateElement="false"
|
||||
StopPropagation="true"
|
||||
class="@GetDoubleClickCellClassString(false)">
|
||||
@GetValue(col, RowContent.Row)
|
||||
</DynamicElement>
|
||||
}
|
||||
@GetValue(col, RowContent.Row)
|
||||
</DynamicElement>
|
||||
</td>
|
||||
}
|
||||
|
@@ -16,25 +16,33 @@ using TouchSocket.Core;
|
||||
|
||||
namespace ThingsGateway.Gateway.Razor;
|
||||
|
||||
public partial class VariableRow<TItem> : IDisposable
|
||||
public partial class VariableRow : IDisposable
|
||||
{
|
||||
[Parameter]
|
||||
public TableRowContext<TItem>? RowContent { get; set; }
|
||||
|
||||
public TableRowContext<VariableRuntime>? RowContent { get; set; }
|
||||
private bool Disposed;
|
||||
public void Dispose()
|
||||
{
|
||||
Disposed = true;
|
||||
timer?.SafeDispose();
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
TimerX? timer;
|
||||
protected override void OnInitialized()
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
timer = new TimerX(Refresh, null, 1000, 1000, "VariableRow");
|
||||
base.OnInitialized();
|
||||
if (firstRender)
|
||||
{
|
||||
timer = new TimerX(Refresh, null, 1000, 1000, "VariableRow");
|
||||
}
|
||||
base.OnAfterRender(firstRender);
|
||||
}
|
||||
|
||||
private Task Refresh(object? state)
|
||||
{
|
||||
return InvokeAsync(StateHasChanged);
|
||||
if (!Disposed)
|
||||
return InvokeAsync(StateHasChanged);
|
||||
else
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
protected override void OnParametersSet()
|
||||
@@ -49,7 +57,7 @@ public partial class VariableRow<TItem> : IDisposable
|
||||
/// <param name="col"></param>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
protected RenderFragment GetValue(ITableColumn col, TItem item) => builder =>
|
||||
protected RenderFragment GetValue(ITableColumn col, VariableRuntime item) => builder =>
|
||||
{
|
||||
if (col.Template != null)
|
||||
{
|
||||
@@ -66,9 +74,9 @@ public partial class VariableRow<TItem> : IDisposable
|
||||
}
|
||||
};
|
||||
|
||||
internal static string? GetDoubleClickCellClassString(bool trigger) => CssBuilder.Default()
|
||||
.AddClass("is-dbcell", trigger)
|
||||
.Build();
|
||||
// internal static string? GetDoubleClickCellClassString(bool trigger) => CssBuilder.Default()
|
||||
//.AddClass("is-dbcell", trigger)
|
||||
//.Build();
|
||||
|
||||
/// <summary>
|
||||
/// 获得指定列头固定列样式
|
||||
@@ -160,16 +168,29 @@ public partial class VariableRow<TItem> : IDisposable
|
||||
/// <param name="hasChildren"></param>
|
||||
/// <param name="inCell"></param>
|
||||
/// <returns></returns>
|
||||
protected string? GetCellClassString(ITableColumn col, bool hasChildren, bool inCell) => CellClassStringCache.GetOrAdd(col, col => CssBuilder.Default("table-cell")
|
||||
.AddClass(col.GetAlign().ToDescriptionString(), col.Align == Alignment.Center || col.Align == Alignment.Right)
|
||||
.AddClass("is-wrap", col.GetTextWrap())
|
||||
.AddClass("is-ellips", col.GetTextEllipsis())
|
||||
.AddClass("is-tips", col.GetShowTips())
|
||||
.AddClass("is-resizable", AllowResizing)
|
||||
.AddClass("is-tree", IsTree && hasChildren)
|
||||
.AddClass("is-incell", inCell)
|
||||
.AddClass(col.CssClass)
|
||||
.Build());
|
||||
protected string? GetCellClassString(ITableColumn col, bool hasChildren, bool inCell)
|
||||
{
|
||||
if (CellClassStringCache.TryGetValue(col, out var cached))
|
||||
{
|
||||
return cached;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool trigger = false;
|
||||
return CellClassStringCache.GetOrAdd(col, col => CssBuilder.Default("table-cell")
|
||||
.AddClass(col.GetAlign().ToDescriptionString(), col.Align == Alignment.Center || col.Align == Alignment.Right)
|
||||
.AddClass("is-wrap", col.GetTextWrap())
|
||||
.AddClass("is-ellips", col.GetTextEllipsis())
|
||||
.AddClass("is-tips", col.GetShowTips())
|
||||
.AddClass("is-resizable", AllowResizing)
|
||||
.AddClass("is-tree", IsTree && hasChildren)
|
||||
.AddClass("is-incell", inCell)
|
||||
.AddClass("is-dbcell", trigger)
|
||||
.AddClass(col.CssClass)
|
||||
.Build());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private bool AllowResizing = true;
|
||||
private bool IsTree = false;
|
||||
@@ -180,12 +201,24 @@ public partial class VariableRow<TItem> : IDisposable
|
||||
/// </summary>
|
||||
/// <param name="col"></param>
|
||||
/// <returns></returns>
|
||||
protected string? GetFixedCellClassString(ITableColumn col) => FixedCellClassStringCache.GetOrAdd(col, col => CssBuilder.Default()
|
||||
.AddClass("fixed", col.Fixed)
|
||||
.AddClass("fixed-right", col.Fixed && IsTail(col))
|
||||
.AddClass("fr", IsLastColumn(col))
|
||||
.AddClass("fl", IsFirstColumn(col))
|
||||
.Build());
|
||||
protected string? GetFixedCellClassString(ITableColumn col)
|
||||
{
|
||||
if (FixedCellClassStringCache.TryGetValue(col, out var cached))
|
||||
{
|
||||
return cached;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FixedCellClassStringCache.GetOrAdd(col, col => CssBuilder.Default()
|
||||
.AddClass("fixed", col.Fixed)
|
||||
.AddClass("fixed-right", col.Fixed && IsTail(col))
|
||||
.AddClass("fr", IsLastColumn(col))
|
||||
.AddClass("fl", IsFirstColumn(col))
|
||||
.Build());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
[Parameter]
|
||||
@@ -193,33 +226,53 @@ public partial class VariableRow<TItem> : IDisposable
|
||||
public List<ITableColumn> Columns => ColumnsFunc();
|
||||
|
||||
private ConcurrentDictionary<ITableColumn, bool> LastFixedColumnCache { get; } = new(ReferenceEqualityComparer.Instance);
|
||||
private bool IsLastColumn(ITableColumn col) => LastFixedColumnCache.GetOrAdd(col, col =>
|
||||
private bool IsLastColumn(ITableColumn col)
|
||||
{
|
||||
var ret = false;
|
||||
if (col.Fixed && !IsTail(col))
|
||||
if (LastFixedColumnCache.TryGetValue(col, out var cached))
|
||||
{
|
||||
var index = Columns.IndexOf(col) + 1;
|
||||
ret = index < Columns.Count && Columns[index].Fixed == false;
|
||||
return cached;
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
private ConcurrentDictionary<ITableColumn, bool> FirstFixedColumnCache { get; } = new(ReferenceEqualityComparer.Instance);
|
||||
private bool IsFirstColumn(ITableColumn col) => FirstFixedColumnCache.GetOrAdd(col, col =>
|
||||
{
|
||||
var ret = false;
|
||||
if (col.Fixed && IsTail(col))
|
||||
else
|
||||
{
|
||||
// 查找前一列是否固定
|
||||
var index = Columns.IndexOf(col) - 1;
|
||||
if (index > 0)
|
||||
return LastFixedColumnCache.GetOrAdd(col, col =>
|
||||
{
|
||||
ret = !Columns[index].Fixed;
|
||||
}
|
||||
var ret = false;
|
||||
if (col.Fixed && !IsTail(col))
|
||||
{
|
||||
var index = Columns.IndexOf(col) + 1;
|
||||
ret = index < Columns.Count && Columns[index].Fixed == false;
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
|
||||
}
|
||||
private ConcurrentDictionary<ITableColumn, bool> FirstFixedColumnCache { get; } = new(ReferenceEqualityComparer.Instance);
|
||||
private bool IsFirstColumn(ITableColumn col)
|
||||
{
|
||||
if (FirstFixedColumnCache.TryGetValue(col, out var cached))
|
||||
{
|
||||
return cached;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FirstFixedColumnCache.GetOrAdd(col, col =>
|
||||
{
|
||||
var ret = false;
|
||||
if (col.Fixed && IsTail(col))
|
||||
{
|
||||
// 查找前一列是否固定
|
||||
var index = Columns.IndexOf(col) - 1;
|
||||
if (index > 0)
|
||||
{
|
||||
ret = !Columns[index].Fixed;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -15,12 +15,13 @@
|
||||
AllowResizing="true"
|
||||
OnAdd="OnAdd"
|
||||
IsFixedHeader=true
|
||||
ShowCardView=false
|
||||
IsMultipleSelect=true
|
||||
SearchMode=SearchMode.Top
|
||||
ShowExtendButtons=true
|
||||
ShowToolbar="true"
|
||||
ShowExportButton
|
||||
|
||||
RenderMode="TableRenderMode.Table"
|
||||
ShowDefaultButtons=true
|
||||
ShowSearch=false
|
||||
ExtendButtonColumnWidth=220
|
||||
|
@@ -15,9 +15,6 @@ using BootstrapBlazor.Components;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.Extensions.Localization;
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
using ThingsGateway.Gateway.Application;
|
||||
|
||||
namespace ThingsGateway.Server;
|
||||
|
Reference in New Issue
Block a user