Ejemplo n.º 1
0
 public async Task InputSearchKeyup(KeyboardEventArgs e)
 {
     if (e.Key == "Enter")
     {
         await GridComponent.AddSearch(_searchValue);
     }
 }
Ejemplo n.º 2
0
        public async Task SetChecked(bool value)
        {
            if (!Column.HeaderCheckbox)
            {
                return;
            }
            var oldValue = _allChecked;

            _allChecked = value;
            var allItemsDisplayed = GridComponent.Grid.ItemsCount == GridComponent.Grid.OriginalItemsCount;

            if (allItemsDisplayed)
            {
                GridComponent.CheckboxesKeyed.AddParameter(Column.Name, new QueryDictionary <(CheckboxComponent <T>, bool)>());
                LastHeaderCheckedValue = value;
            }

            var args = new HeaderCheckboxEventArgs <T>
            {
                ColumnName  = Column.Name,
                Value       = value ? CheckboxValue.Checked : CheckboxValue.Unchecked,
                HeaderValue = value ? CheckboxValue.Checked : CheckboxValue.Unchecked,
            };

            if (_allChecked != oldValue)
            {
                await GridComponent.OnHeaderCheckboxChanged(args);
                await InvokeAsync(StateHasChanged);
            }
        }
Ejemplo n.º 3
0
        protected async Task UpdateItem()
        {
            try
            {
                Error        = "";
                ColumnErrors = new QueryDictionary <string>();
                _tabGroups   = null;
                await GridComponent.UpdateItem(this);
            }
            catch (GridException e)
            {
                await OnParametersSetAsync();

                _shouldRender = true;
                Error         = string.IsNullOrWhiteSpace(e.Code) ? e.Message :  e.Code + " - " + e.Message;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                await OnParametersSetAsync();

                _shouldRender = true;
                Error         = Strings.UpdateError;
            }
        }
Ejemplo n.º 4
0
 protected async Task TitleButtonClicked()
 {
     if (Column.IsSorted)
     {
         if (Column.Direction == GridSortDirection.Ascending)
         {
             await GridComponent.GetSortUrl(SortingSettings.ColumnQueryParameterName, Column.Name, SortingSettings.DirectionQueryParameterName,
                                            ((int)GridSortDirection.Descending).ToString(CultureInfo.InvariantCulture));
         }
         else
         {
             if (Column.InitialDirection.HasValue)
             {
                 await GridComponent.GetSortUrl(SortingSettings.ColumnQueryParameterName, Column.Name, SortingSettings.DirectionQueryParameterName,
                                                ((int)GridSortDirection.Ascending).ToString(CultureInfo.InvariantCulture));
             }
             else
             {
                 await GridComponent.GetSortUrl(SortingSettings.ColumnQueryParameterName, SortingSettings.DirectionQueryParameterName);
             }
         }
     }
     else
     {
         await GridComponent.GetSortUrl(SortingSettings.ColumnQueryParameterName, Column.Name, SortingSettings.DirectionQueryParameterName,
                                        ((int)GridSortDirection.Ascending).ToString(CultureInfo.InvariantCulture));
     }
 }
 public async Task AddFilter(FilterCollection filters)
 {
     _isFilterVisible = !_isFilterVisible;
     _shouldRender    = true;
     StateHasChanged();
     await GridComponent.AddFilter(Column, filters);
 }
Ejemplo n.º 6
0
 public async Task FilterIconClicked()
 {
     //switch visibility for the filter dialog:
     _isVisible = !_isVisible;
     StateHasChanged();
     await GridComponent.GridComponentClick();
 }
Ejemplo n.º 7
0
        private async Task RowCheckboxChanged(CheckboxEventArgs <T> e)
        {
            if (e.ColumnName != Column.Name || !Column.HeaderCheckbox)
            {
                return;
            }
            var oldValue = _allChecked;

            var checkedCount = GridComponent.CheckboxesKeyed.Get(Column.Name).Values.Count(r => r.Item2);

            if (checkedCount > 0 && checkedCount != GridComponent.Grid.Pager.OriginalItemsCount)
            {
                _allChecked = null;
            }
            else
            {
                _allChecked            = checkedCount == GridComponent.Grid.Pager.OriginalItemsCount;
                LastHeaderCheckedValue = _allChecked == true;
                GridComponent.CheckboxesKeyed.AddParameter(Column.Name, new QueryDictionary <(CheckboxComponent <T>, bool)>());
            }

            if (_allChecked != oldValue)
            {
                var args = new HeaderCheckboxEventArgs <T>
                {
                    ColumnName  = Column.Name,
                    Value       = _allChecked == true ? CheckboxValue.Checked : CheckboxValue.Unchecked,
                    HeaderValue = _allChecked == null ? CheckboxValue.Gray : (_allChecked == true ? CheckboxValue.Checked : CheckboxValue.Unchecked),
                    StringKey   = e.StringKey,
                };
                await GridComponent.OnHeaderCheckboxChanged(args);
                await InvokeAsync(StateHasChanged);
            }
        }
Ejemplo n.º 8
0
        public async Task SetChecked(bool value)
        {
            if (Column.HeaderCheckbox)
            {
                // set a value and init ExceptCheckedRows for this column
                _allChecked     = value;
                _showAllChecked = true;
                GridComponent.ExceptCheckedRows.AddParameter(Column.Name, new QueryDictionary <bool>());

                CheckboxEventArgs <T> args = new CheckboxEventArgs <T>
                {
                    ColumnName = Column.Name
                };
                if (value)
                {
                    args.Value = CheckboxValue.Checked;
                }
                else
                {
                    args.Value = CheckboxValue.Unchecked;
                }
                await GridComponent.OnHeaderCheckboxChanged(args);

                StateHasChanged();
            }
        }
 public async Task RemoveFilter()
 {
     _isFilterVisible = !_isFilterVisible;
     _shouldRender    = true;
     StateHasChanged();
     await GridComponent.RemoveFilter(Column);
 }
Ejemplo n.º 10
0
        public async Task DeleteItem()
        {
            if (GridComponent.Grid.DeleteConfirmation && _code != _confirmationCode)
            {
                _shouldRender = true;
                Error         = Strings.DeleteConfirmCodeError;
                StateHasChanged();
                return;
            }

            try
            {
                _tabGroups = null;
                await GridComponent.DeleteItem(this);
            }
            catch (GridException e)
            {
                await OnParametersSetAsync();

                _shouldRender = true;
                Error         = string.IsNullOrWhiteSpace(e.Code) ? e.Message : e.Code + " - " + e.Message;
                StateHasChanged();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                await OnParametersSetAsync();

                _shouldRender = true;
                Error         = Strings.DeleteError;
                StateHasChanged();
            }
        }
        protected async Task CreateItem()
        {
            if (GridComponent.Grid.CreateConfirmation && _code != _confirmationCode)
            {
                _shouldRender = true;
                Error         = Strings.ConfirmCodeError;
                return;
            }

            try
            {
                Error        = "";
                ColumnErrors = new QueryDictionary <string>();
                _tabGroups   = null;
                await GridComponent.CreateItem(this);
            }
            catch (GridException e)
            {
                _shouldRender = true;
                Error         = string.IsNullOrWhiteSpace(e.Code) ? e.Message : e.Code + " - " + e.Message;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                _shouldRender = true;
                Error         = Strings.CreateError;
            }
        }
 public static RenderFragment CreateComponent(int sequence, GridComponent <T> gridComponent, Type componentType,
                                              IGridColumn column, object item, int?rowId, bool crud, VariableReference reference) => builder =>
 {
     builder.OpenComponent <CascadingValue <GridComponent <T> > >(++sequence);
     builder.AddAttribute(++sequence, "Value", gridComponent);
     builder.AddAttribute(++sequence, "Name", "GridComponent");
     builder.AddAttribute(++sequence, "ChildContent", CreateComponent(sequence, componentType, column, item, rowId, crud, reference));
     builder.CloseComponent();
 };
Ejemplo n.º 13
0
 public async Task HideTooltip()
 {
     if (!string.IsNullOrWhiteSpace(Column.TooltipValue))
     {
         _isTooltipVisible = false;
         StateHasChanged();
         await GridComponent.SetGridFocus();
     }
 }
Ejemplo n.º 14
0
 protected RenderFragment CreateComponent(int sequence, GridComponent <T> gridComponent, Type componentType,
                                          IGridColumn column, object item, int rowId) => builder =>
 {
     builder.OpenComponent <CascadingValue <GridComponent <T> > >(++_sequence);
     builder.AddAttribute(++_sequence, "Value", gridComponent);
     builder.AddAttribute(++_sequence, "Name", "GridComponent");
     builder.AddAttribute(++_sequence, "ChildContent", GridCellComponent <T>
                          .CreateComponent(sequence, componentType, column, item, rowId, false));
     builder.CloseComponent();
 };
 public async Task DisplayTooltip()
 {
     if (!string.IsNullOrWhiteSpace(Column.TooltipValue))
     {
         _isTooltipVisible = true;
         _shouldRender     = true;
         StateHasChanged();
         await GridComponent.SetGridFocus();
     }
 }
        protected async Task TitleButtonClicked()
        {
            //switch direction for link:
            GridSortDirection newDir = Column.Direction == GridSortDirection.Ascending
                                           ? GridSortDirection.Descending
                                           : GridSortDirection.Ascending;

            await GridComponent.GetSortUrl(SortingSettings.ColumnQueryParameterName, Column.Name,
                                           SortingSettings.DirectionQueryParameterName, ((int)newDir).ToString(CultureInfo.InvariantCulture));
        }
 protected async Task UpdateItem()
 {
     try
     {
         await GridComponent.UpdateItem(this);
     }
     catch (Exception)
     {
         Error = Strings.UpdateError;
     }
 }
        protected async Task HandleDrop()
        {
            if (!GridComponent.Grid.RearrangeColumnEnabled)
            {
                return;
            }

            _dropClass    = "";
            _shouldRender = true;

            await GridComponent.HandleColumnRearranged(this);
        }
 protected async Task HandleDrop()
 {
     _dropClass = "";
     if (Grid.Settings.SortSettings.SortValues.Any(r => r.ColumnName == GridComponent.Payload.ColumnName))
     {
         GridComponent.Payload = ColumnOrderValue.Null;
     }
     else
     {
         await GridComponent.AddExtSorting();
     }
 }
Ejemplo n.º 20
0
 protected async Task DeleteItem()
 {
     try
     {
         await GridComponent.DeleteItem(this);
     }
     catch (Exception)
     {
         _shouldRender = true;
         Error         = Strings.DeleteError;
     }
 }
Ejemplo n.º 21
0
        public async Task FilterIconClicked()
        {
            var isVisible = _isFilterVisible;

            GridComponent.FilterIconClicked();

            //switch visibility for the filter dialog:
            _isFilterVisible = !isVisible;

            StateHasChanged();
            await GridComponent.SetGridFocus();
        }
Ejemplo n.º 22
0
 protected async Task DeleteItem()
 {
     try
     {
         await GridComponent.DeleteItem(this);
     }
     catch (GridException e)
     {
         _shouldRender = true;
         Error         = string.IsNullOrWhiteSpace(e.Code) ? e.Message : e.Code + " - " + e.Message;
     }
     catch (Exception)
     {
         _shouldRender = true;
         Error         = Strings.DeleteError;
     }
 }
Ejemplo n.º 23
0
        public async Task SetChecked(bool value)
        {
            if (Column.HeaderCheckbox)
            {
                _allChecked = value;
                CheckboxEventArgs <T> args = new CheckboxEventArgs <T>
                {
                    ColumnName = Column.Name
                };
                if (_allChecked)
                {
                    args.Value = CheckboxValue.Checked;
                }
                else
                {
                    args.Value = CheckboxValue.Unchecked;
                }
                await GridComponent.OnHeaderCheckboxChanged(args);

                StateHasChanged();
            }
        }
Ejemplo n.º 24
0
        protected async Task DeleteItem()
        {
            try
            {
                _tabGroups = null;
                await GridComponent.DeleteItem(this);
            }
            catch (GridException e)
            {
                await OnParametersSetAsync();

                _shouldRender = true;
                Error         = string.IsNullOrWhiteSpace(e.Code) ? e.Message : e.Code + " - " + e.Message;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                await OnParametersSetAsync();

                _shouldRender = true;
                Error         = Strings.DeleteError;
            }
        }
Ejemplo n.º 25
0
 public async Task BackButtonClicked()
 {
     await GridComponent.Back();
 }
 protected void BackButtonClicked()
 {
     GridComponent.BackButton();
 }
 protected async Task CreateItem()
 {
     await GridComponent.CreateItem();
 }
Ejemplo n.º 28
0
 protected async Task UpdateItem()
 {
     await GridComponent.UpdateItem();
 }
 public async Task AddFilter(FilterCollection filters)
 {
     _isVisible = !_isVisible;
     await GridComponent.AddFilter(Column, filters);
 }
 public async Task RemoveFilter()
 {
     _isVisible = !_isVisible;
     await GridComponent.RemoveFilter(Column);
 }