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