예제 #1
0
        public void ResolveColumnPermission(IGridViewColumnAnotations columnConfig, string columnName)
        {
            var permissionAccess = PermissionAccess.None;

            if (columnConfig is null)
            {
                permissionAccess |= PermissionAccess.Read | PermissionAccess.Write;
            }
            else
            {
                permissionAccess |= columnConfig.ReadPermissionRestrictionFunc(currentUserPermission)
                   ? PermissionAccess.Read
                   : PermissionAccess.None;

                permissionAccess |= columnConfig.WritePermissionRestrictionFunc(currentUserPermission)
                   ? PermissionAccess.Write
                   : PermissionAccess.None;
            }

            columnPermissions.Add(columnName, permissionAccess);
        }
 private void RenderSimpleColumnHeader(GridRendererContext rendererContext, PropertyInfo property, IGridViewColumnAnotations columnConfiguration)
 {
     rendererContext.OpenElement(HtmlTagNames.TableHeadCell, rendererContext.CssClasses.TableHeaderCell);
     rendererContext.AddContent(GetColumnCaption(columnConfiguration, property));
     rendererContext.CloseElement();
 }
        private void RenderSortableColumnHeader(GridRendererContext rendererContext, PropertyInfo property, IGridViewColumnAnotations columnConfiguration)
        {
            rendererContext.OpenElement(HtmlTagNames.TableHeadCell, rendererContext.CssClasses.TableHeaderCell);
            rendererContext.OpenElement(HtmlTagNames.Span,
                                        rendererContext.SortingByActualColumnName ? "table-cell-head-sortable table-cell-head-sortable-active" : "table-cell-head-sortable");
            rendererContext.AddOnClickEvent(() =>
                                            BindMethods.GetEventHandlerValue(async(UIMouseEventArgs e) =>
                                                                             await rendererContext.TableDataSet.SetSortExpression(property.Name))
                                            );

            if (rendererContext.SortingByActualColumnName)
            {
                var arrowDirection = rendererContext.TableDataSet.SortingOptions.SortDescending ? "fas fa-arrow-down" : "fas fa-arrow-up";
                rendererContext.AddContent(GetColumnCaption(columnConfiguration, property));
                rendererContext.OpenElement(HtmlTagNames.I, $"table-cell-head-arrow {arrowDirection}");
                rendererContext.CloseElement();
            }
            else
            {
                rendererContext.AddContent(GetColumnCaption(columnConfiguration, property));
            }

            rendererContext.CloseElement();
            rendererContext.CloseElement();
        }
 private string GetColumnCaption(IGridViewColumnAnotations columnConfiguration, PropertyInfo property)
 => columnConfiguration?.Caption ?? property.Name;
예제 #5
0
        private void RenderSortableColumnHeader(GridRendererContext rendererContext, PropertyInfo property, IGridViewColumnAnotations columnConfiguration)
        {
            rendererContext.OpenElement(HtmlTagNames.Span,
                                        rendererContext.SortingByActualColumnName ? "table-cell-head-sortable table-cell-head-sortable-active" : "table-cell-head-sortable");
            rendererContext.AddOnClickEvent(
                EventCallback.Factory.Create(this, async(MouseEventArgs e) =>
            {
                await rendererContext.TableDataSet.SetSortExpression(property.Name);
                rendererContext.RequestRerenderNotification?.Invoke();
            })
                );

            if (rendererContext.SortingByActualColumnName)
            {
                var arrowDirection = rendererContext.TableDataSet.SortingOptions.SortDescending ? "fas fa-arrow-down" : "fas fa-arrow-up";
                rendererContext.AddContent(GetColumnCaption(columnConfiguration, property));
                rendererContext.OpenElement(HtmlTagNames.I, $"table-cell-head-arrow {arrowDirection}");
                rendererContext.CloseElement();
            }
            else
            {
                rendererContext.AddContent(GetColumnCaption(columnConfiguration, property));
            }

            rendererContext.CloseElement();
        }
예제 #6
0
 private string GetColumnStyle(IGridViewColumnAnotations columnConfiguration)
 => columnConfiguration?.HeaderStyle ?? string.Empty;