@namespace Connected.Components @using Connected.Utilities; @inherits TableBase @typeparam T
@if (Items != null || ServerData != null) { @if (ToolBarContent != null) { @ToolBarContent } @if (Context.SortLabels.Any()) {
}
@if (ColGroup != null) { @ColGroup } @if (HeaderContent != null || Columns != null) { @if (CustomHeader) { @HeaderContent } else { @if (HeaderContent != null) { @HeaderContent } @if (Columns != null) { @Columns(Def) } } } @if (Loading) { } @if(GroupBy != null) { @foreach (var group in GroupItemsPage) { } } else { @if (CurrentPageItems != null && CurrentPageItems.Count() > 0) { var rowIndex = 0; @{ var rowClass = new CssBuilder(RowClass).AddClass(RowClassFunc?.Invoke(item, rowIndex)).Build(); } @{ var rowStyle = new StyleBuilder().AddStyle(RowStyle).AddStyle(RowStyleFunc?.Invoke(item, rowIndex)).Build(); } @if ((!ReadOnly) && IsEditable && object.Equals(_editingItem, item)) { @if(RowEditingTemplate != null) { @RowEditingTemplate(item) } @if (Columns != null) { @Columns(item) } } else { if (RowTemplate != null) { @RowTemplate(item) } @if (Columns != null) { @Columns(item) } } @if (ChildRowContent != null) { @ChildRowContent(item) } @{ rowIndex++; } } } @if(!(CurrentPageItems != null && CurrentPageItems.Count() > 0) && (Loading ? LoadingContent != null : NoRecordsContent != null) ) { } @if (FooterContent != null || Columns != null) { @if (CustomFooter) { @FooterContent } else { @if (@FooterContent != null) { @FooterContent } @if (Columns != null) { @Columns(Def) } } }
@if(Loading) { @LoadingContent } else { @NoRecordsContent }
@if (PagerContent != null) {
@PagerContent
}
}
@code { // moved to code to avoid repeatedly code on markup block internal RenderFragment RenderRows(IEnumerable source, string customClass = null, bool isExpandable = false) { var rowIndex = 0; RenderFragment rootNode = @ ; RenderFragment child() => item => @ @{ var rowClass = new CssBuilder(RowClass).AddClass(RowClassFunc?.Invoke(item, rowIndex)).AddClass(customClass, ! string.IsNullOrEmpty("mud-table-row-group-indented-1")).Build(); var rowStyle = new StyleBuilder().AddStyle(RowStyle).AddStyle(RowStyleFunc?.Invoke(item, rowIndex)).Build(); } @if ((!ReadOnly) && IsEditable && object.Equals(_editingItem, item)) { @if(RowEditingTemplate != null) { @RowEditingTemplate(item) } @if (Columns != null) { @Columns(item) } } else { if (RowTemplate != null) { @RowTemplate(item) } @if (Columns != null) { @Columns(item) } } @if (ChildRowContent != null) { @ChildRowContent(item) } @{rowIndex++;} ; return rootNode; } }