public override void BuildInputRendererTree(IRendererTreeBuilder rendererTreeBuilder, IActualItemContext <object> actualItemContext, Action <string, object> onChangeAction)
        {
            var localColumnName = actualItemContext.ActualColumnName;
            var value           = actualItemContext.GetActualItemColumnValue(localColumnName);

            if (IsSupportedDateType(value))
            {
                var dateTimeValue          = ConvertToDateTime(value);
                var dateValueContatinsTime = dateTimeValue.TimeOfDay.TotalSeconds != 0;
                var dateFormat             = dateValueContatinsTime ? "yyyy-MM-dd'T'HH:mm:ss" : "yyyy-MM-dd";

                rendererTreeBuilder
                .OpenElement(HtmlTagNames.Div, "edit-field-wrapper")
                .OpenElement(HtmlTagNames.Input, "edit-text-field")
                .AddAttribute(HtmlAttributes.Type, dateValueContatinsTime ? "datetime-local" : "date")
                .AddAttribute(HtmlAttributes.Value, BindMethods.GetValue(dateTimeValue, dateFormat))
                .AddAttribute(HtmlJSEvents.OnChange, BindMethods.SetValueHandler(delegate(DateTime __value)
                {
                    onChangeAction?.Invoke(localColumnName, __value);
                }, dateTimeValue, dateFormat))
                .CloseElement()
                .CloseElement();
            }
            else
            {
                successor.BuildInputRendererTree(rendererTreeBuilder, actualItemContext, onChangeAction);
            }
        }
예제 #2
0
        private void BuildRendererTreeForInputs(BlazorRendererTreeBuilder rendererBuilder)
        {
            if (parser == TryParseDateTime || parser == TryParseDateTimeOffset)
            {
                rendererBuilder
                .OpenElement(HtmlTagNames.Input, "edit-text-field edit-date-field-filter")
                .AddAttribute(HtmlAttributes.Type, HtmlAttributes.TypeDate)
                .AddAttribute(HtmlAttributes.Value, BindMethods.GetValue(FormatDateAsString(actualFilterValue)))
                .AddAttribute(HtmlJSEvents.OnChange, BindMethods.SetValueHandler(delegate(string __value)
                {
                    FilterValueChanged(__value);
                }, FormatDateAsString(actualFilterValue)))
                .CloseElement();

                return;
            }

            rendererBuilder
            .OpenElement(HtmlTagNames.Input, "edit-text-field edit-text-field-filter")
            .AddAttribute(HtmlAttributes.Value, BindMethods.GetValue(filterIsApplied ? actualFilterValue.ToString() : string.Empty))
            .AddAttribute(HtmlJSEvents.OnChange, BindMethods.SetValueHandler(delegate(string __value)
            {
                FilterValueChanged(__value);
            }, actualFilterValue?.ToString() ?? string.Empty))
            .CloseElement();
        }
예제 #3
0
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            int ct = 0;

            if (_gameController.ClientPlayer == ClientPlayerType.Waiting)
            {
                builder.OpenElement(ct++, "text");
                builder.AddAttribute(ct++, "x", _offsetX - _colWidth / 2);
                builder.AddAttribute(ct++, "y", _vertexLength * 5);

                builder.AddAttribute(ct++, "style", $"fill:black;font-size:{GetFontSize()}px;");
                builder.AddContent(ct++, "Waiting for oponent....");
                builder.CloseElement();
            }
            else
            {
                Console.WriteLine($"Player={_gameController.Game.CurrentPlayer.Color} Stage={_gameController.Game.TurnStage} TurnNo={_gameController.Game.TurnNo}");

                builder.OpenElement(ct++, "svg");
                builder.AddAttribute(ct++, "height", _height);
                builder.AddAttribute(ct++, "width", _width);
                builder.AddAttribute(ct++, "style", "text-align:center;");
                builder.AddAttribute(ct++, "onclick", BindMethods.GetEventHandlerValue <UIMouseEventArgs>(HandleClick));
                DrawBoard(builder, ref ct);
                builder.CloseElement();
            }
            base.BuildRenderTree(builder);
        }
예제 #4
0
        protected override void BuildRenderTreeInternal(GridRendererContext rendererContext, PermissionContext permissionContext)
        {
            rendererContext.OpenElement(HtmlTagNames.TableRow, rendererContext.CssClasses.TableRow);

            var localActualItem = rendererContext.ActualItem;

            rendererContext.AddOnClickEvent(() =>
                                            BindMethods.GetEventHandlerValue((UIMouseEventArgs e) =>
            {
                rendererContext.TableDataSet
                .GridViewEvents
                .OnItemClicked?.Invoke(new ItemClickedArgs {
                    Item = localActualItem
                });
            }));

            foreach (var property in rendererContext.GridItemProperties)
            {
                rendererContext.ActualColumnName = property.Name;
                rendererContext.ActualColumnPropertyCanBeEdited = property.CanWrite;

                gridPartRenderers.ForEach(renderer => renderer.BuildRendererTree(rendererContext, permissionContext));
            }

            rendererContext.CloseElement();

            gridPartRenderersAfter.ForEach(renderer => renderer.BuildRendererTree(rendererContext, permissionContext));
        }
예제 #5
0
        private void RenderDeleteButton(GridRendererContext rendererContext, PermissionContext permissionContext)
        {
            if (!permissionContext.HasDeleteItemPermission ||
                !rendererContext.GridConfiguration.InlineEditOptions.AllowDeleting)
            {
                return;
            }

            var localActualItem = rendererContext.ActualItem;

            rendererContext.OpenElement(HtmlTagNames.Button, "action-button");
            rendererContext.AddOnClickEvent(() =>
                                            BindMethods.GetEventHandlerValue((UIMouseEventArgs e) =>
            {
                rendererContext.TableDataSet.DeleteItem(localActualItem);
                rendererContext.RequestRerenderNotification?.Invoke();
            })
                                            );

            rendererContext.OpenElement(HtmlTagNames.Span, "action-button-span");
            rendererContext.OpenElement(HtmlTagNames.I, "fas fa-trash-alt");
            rendererContext.CloseElement();
            rendererContext.CloseElement();
            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();
        }
        public override void RenderInput(GridRendererContext gridRendererContext)
        {
            var localColumnName = gridRendererContext.ActualColumnName;
            var value           = gridRendererContext.PropertyValueAccessor.GetValue(gridRendererContext.ActualItem, localColumnName);

            if (IsSupportedDateType(value))
            {
                var dateTimeValue          = ConvertToDateTime(value);
                var dateValueContatinsTime = dateTimeValue.TimeOfDay.TotalSeconds != 0;
                var dateFormat             = dateValueContatinsTime ? "yyyy-MM-dd'T'HH:mm:ss" : "yyyy-MM-dd";

                gridRendererContext.OpenElement(HtmlTagNames.Div, "edit-field-wrapper");
                gridRendererContext.OpenElement(HtmlTagNames.Input, "edit-text-field");
                gridRendererContext.AddAttribute(HtmlAttributes.Type, dateValueContatinsTime ? "datetime-local" : "date");
                gridRendererContext.AddAttribute(HtmlAttributes.Value, BindMethods.GetValue(dateTimeValue, dateFormat));
                gridRendererContext.AddAttribute(HtmlJSEvents.OnChange, BindMethods.SetValueHandler(delegate(DateTime __value)
                {
                    gridRendererContext
                    .TableDataSet
                    .EditItemProperty(localColumnName, __value);
                }, dateTimeValue, dateFormat)
                                                 );

                gridRendererContext.CloseElement();
                gridRendererContext.CloseElement();
            }
            else
            {
                successor.RenderInput(gridRendererContext);
            }
        }
        private void RenderTab(
            GridRendererContext rendererContext,
            IMasterTableDataSet masterTableDataSet,
            ITableDataAdapter selectedDataAdapter,
            ITableDataAdapter dataAdapter)
        {
            var masterDetailRelationship = rendererContext
                                           .GridConfiguration
                                           .FindRelationshipConfiguration(dataAdapter.UnderlyingTypeOfItem);

            var localActualItem = rendererContext.ActualItem;

            rendererContext.OpenElement(HtmlTagNames.Button,
                                        selectedDataAdapter.IsForSameUnderlyingType(dataAdapter) ? "tabs-button tabs-button-active" : "tabs-button");

            rendererContext.AddOnClickEvent(() =>
                                            BindMethods.GetEventHandlerValue((UIMouseEventArgs e) =>
                                                                             masterTableDataSet.SelectDataAdapter(new MasterDetailRowArguments(dataAdapter, localActualItem)))
                                            );

            rendererContext.OpenElement(HtmlTagNames.Span, "tabs-button-text");
            rendererContext.AddContent(masterDetailRelationship.DetailGridViewPageCaption(dataAdapter));
            rendererContext.CloseElement();
            rendererContext.CloseElement();
        }
예제 #9
0
        private void RenderGroupingFooterPart(GridRendererContext rendererContext)
        {
            rendererContext.OpenElement(HtmlTagNames.Div, rendererContext.CssClasses.FooterCssClasses.GroupingPartWrapper);
            rendererContext.OpenElement(HtmlTagNames.Select);
            rendererContext.AddAttribute(HtmlAttributes.Id, groupingSelectId);

            rendererContext.AddOnChangeEvent(() =>
                                             BindMethods.GetEventHandlerValue(async(UIChangeEventArgs e) =>
            {
                string propertyName = e.Value.ToString();
                if (propertyName == noGroupingOptionText)
                {
                    rendererContext.TableDataSet.GroupingOptions.DeactivateGrouping();
                }
                else
                {
                    rendererContext.TableDataSet.GroupingOptions.SetGroupedProperty(propertyName);
                }
                await rendererContext.TableDataSet.GoToPage(0);
                rendererContext.RequestRerenderNotification?.Invoke();
            })
                                             );


            if (!rendererContext.TableDataSet.GroupingOptions.IsGroupingActive)
            {
                rendererContext.OpenElement(HtmlTagNames.Option);
                rendererContext.AddAttribute(HtmlAttributes.Disabled, true);
                rendererContext.AddContent(groupByPlaceholder);
                rendererContext.CloseElement();
            }
            else
            {
                rendererContext.OpenElement(HtmlTagNames.Option);
                rendererContext.AddAttribute(HtmlAttributes.Value, string.Empty);
                rendererContext.AddContent(noGroupingOptionText);
                rendererContext.CloseElement();
            }

            foreach (var groupableProperty in rendererContext.TableDataSet.GroupingOptions.GroupableProperties)
            {
                rendererContext.OpenElement(HtmlTagNames.Option);

                if (groupableProperty == rendererContext.TableDataSet.GroupingOptions.GroupedProperty)
                {
                    rendererContext.AddAttribute(HtmlAttributes.Selected, true);
                }

                rendererContext.AddAttribute(HtmlAttributes.Value, groupableProperty.Name);
                rendererContext.ActualColumnName = groupableProperty.Name;
                var displayedGroupablePropertyName = rendererContext.ActualColumnConfiguration?.Caption ?? groupableProperty.Name;
                rendererContext.AddContent(displayedGroupablePropertyName);
                rendererContext.CloseElement();
            }
            rendererContext.CloseElement();
            rendererContext.CloseElement();
        }
예제 #10
0
 /// <inheritdoc />
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.OpenElement(0, "textarea");
     builder.AddAttribute(1, "id", Id);
     builder.AddAttribute(2, "class", CssClass);
     builder.AddAttribute(3, "value", BindMethods.GetValue(CurrentValue));
     builder.AddAttribute(4, "onchange", BindMethods.SetValueHandler(__value => CurrentValue = __value, CurrentValue));
     builder.CloseElement();
 }
예제 #11
0
 /// <inheritdoc />
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.OpenElement(0, "textarea");
     builder.AddMultipleAttributes(1, AdditionalAttributes);
     builder.AddAttribute(2, "class", CssClass);
     builder.AddAttribute(3, "value", BindMethods.GetValue(CurrentValue));
     builder.AddAttribute(4, "onchange", EventCallback.Factory.CreateBinder <string>(this, __value => CurrentValueAsString = __value, CurrentValueAsString));
     builder.CloseElement();
 }
예제 #12
0
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            base.BuildRenderTree(builder);

            LoadStateIfExists();

            var rendererBuilder = new BlazorRendererTreeBuilder(builder);

            rendererBuilder
            .OpenElement(HtmlTagNames.Button, filterIsApplied ? "action-button action-button-small action-button-filter-active" : "action-button action-button-small")
            .AddAttribute(HtmlJSEvents.OnClick,
                          BindMethods.GetEventHandlerValue((UIMouseEventArgs e) =>
            {
                filterDefinitionOpened = !filterDefinitionOpened;
            })
                          )
            .OpenElement(HtmlTagNames.Span)
            .OpenElement(HtmlTagNames.I, "fas fa-filter")
            .CloseElement()
            .CloseElement()
            .CloseElement();


            rendererBuilder.OpenElement(HtmlTagNames.Div,
                                        filterDefinitionOpened
                ? parser != TryParseBool
                        ? $"{WrapperCssClass} {WrapperCssClass}-open"
                        : $"{WrapperCssClass} {WrapperCssClass}-open {WrapperCssCheckboxClass}"
                : $"{WrapperCssClass}");

            if (parser == TryParseBool)
            {
                BuildRendererTreeForCheckbox(rendererBuilder);
            }
            else
            {
                BuildRendererTreeForFilterOperations(rendererBuilder);
                BuildRendererTreeForInputs(rendererBuilder);
            }

            if (parser != TryParseBool)
            {
                rendererBuilder.OpenElement(HtmlTagNames.Div, "filter-buttons");
                rendererBuilder.OpenElement(HtmlTagNames.Button, "btn btn-light filter-buttons-clear")
                .AddOnClickEvent(() =>
                                 BindMethods.GetEventHandlerValue((UIMouseEventArgs e) =>
                {
                    ClearFilter();
                })
                                 )
                .AddContent("Clear")
                .CloseElement()
                .CloseElement();
            }

            rendererBuilder.CloseElement();
        }
예제 #13
0
        private void RenderGroupingFooterPart(GridRendererContext rendererContext)
        {
            rendererContext.OpenElement(HtmlTagNames.Div, rendererContext.CssClasses.FooterCssClasses.GroupingPartWrapper);
            rendererContext.OpenElement(HtmlTagNames.Select, "group-select");
            rendererContext.AddAttribute(HtmlAttributes.Id, GroupingSelectId);
            rendererContext.AddOnChangeEvent(() =>
                                             BindMethods.GetEventHandlerValue(async(UIChangeEventArgs e) =>
            {
                rendererContext.TableDataSet.GroupingOptions.SetGroupedProperty(e.Value.ToString());
                await rendererContext.TableDataSet.GoToPage(0);
                rendererContext.RequestRerenderNotification?.Invoke();
            })
                                             );

            if (!rendererContext.TableDataSet.GroupingOptions.IsGroupingActive)
            {
                rendererContext.OpenElement(HtmlTagNames.Option);
                rendererContext.AddAttribute(HtmlAttributes.Disabled, true);
                rendererContext.AddContent(GroupByPlaceholder);
                rendererContext.CloseElement();
            }

            foreach (var groupableProperty in rendererContext.TableDataSet.GroupingOptions.GroupableProperties)
            {
                rendererContext.OpenElement(HtmlTagNames.Option);

                if (groupableProperty == rendererContext.TableDataSet.GroupingOptions.GroupedProperty)
                {
                    rendererContext.AddAttribute(HtmlAttributes.Selected, true);
                }

                rendererContext.AddAttribute(HtmlAttributes.Value, groupableProperty.Name);
                rendererContext.AddContent(rendererContext.GetColumnCaption(groupableProperty.Name) ?? groupableProperty.Name);
                rendererContext.CloseElement();
            }

            rendererContext.CloseElement();
            rendererContext.CloseElement();

            if (rendererContext.TableDataSet.GroupingOptions.IsGroupingActive)
            {
                rendererContext.OpenElement(HtmlTagNames.Button, "action-button");
                rendererContext.AddOnClickEvent(() =>
                                                BindMethods.GetEventHandlerValue((UIMouseEventArgs e) =>
                {
                    rendererContext.TableDataSet.GroupingOptions.DeactivateGrouping();
                    rendererContext.RequestRerenderNotification?.Invoke();
                })
                                                );

                rendererContext.OpenElement(HtmlTagNames.Span, "action-button-span");
                rendererContext.OpenElement(HtmlTagNames.I, "fas fa-times");
                rendererContext.CloseElement();
                rendererContext.CloseElement();
                rendererContext.CloseElement();
            }
        }
예제 #14
0
            public void Compose(TreeComposer composer)
            {
                if (!this.OnClick.IsDefault())
                {
                    Debug.Assert(this.OnClickAsync.IsDefault(), "Cannot set both sync and async versions of this event");
                    composer.builder.AddAttribute(composer.sequence++, "onclick", BindMethods.GetEventHandlerValue(this.OnClick));
                }

                if (!this.OnClickAsync.IsDefault())
                {
                    Debug.Assert(this.OnClick.IsDefault(), "Cannot set both sync and async versions of this event");
                    composer.builder.AddAttribute(composer.sequence++, "onclick", BindMethods.GetEventHandlerValue(this.OnClickAsync));
                }

                if (!this.OnInput.IsDefault())
                {
                    composer.builder.AddAttribute(composer.sequence++, "oninput", BindMethods.GetEventHandlerValue(this.OnInput));
                }

                if (!this.OnMouseWheelAsync.IsDefault())
                {
                    composer.builder.AddAttribute(composer.sequence++, "onmousewheel", BindMethods.GetEventHandlerValue(this.OnMouseWheelAsync));
                }

                if (!this.OnKeyDown.IsDefault())
                {
                    Debug.Assert(this.OnKeyDownAsync.IsDefault(), "Cannot set both sync and async versions of this event");
                    composer.builder.AddAttribute(composer.sequence++, "onkeydown", BindMethods.GetEventHandlerValue(this.OnKeyDown));
                }

                if (!this.OnKeyDownAsync.IsDefault())
                {
                    Debug.Assert(this.OnKeyDown.IsDefault(), "Cannot set both sync and async versions of this event");
                    composer.builder.AddAttribute(composer.sequence++, "onkeydown", BindMethods.GetEventHandlerValue(this.OnKeyDownAsync));
                }

                if (!this.OnKeyUp.IsDefault())
                {
                    composer.builder.AddAttribute(composer.sequence++, "onkeyup", BindMethods.GetEventHandlerValue(this.OnKeyUp));
                }

                if (!this.OnMouseDown.IsDefault())
                {
                    composer.builder.AddAttribute(composer.sequence++, "onmousedown", BindMethods.GetEventHandlerValue(this.OnMouseDown));
                }

                if (!this.OnMouseUp.IsDefault())
                {
                    composer.builder.AddAttribute(composer.sequence++, "onmouseup", BindMethods.GetEventHandlerValue(this.OnMouseUp));
                }

                if (!this.OnMouseMove.IsDefault())
                {
                    composer.builder.AddAttribute(composer.sequence++, "onmousemove", BindMethods.GetEventHandlerValue(this.OnMouseMove));
                }
            }
예제 #15
0
 /// <inheritdoc />
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.OpenElement(0, "input");
     builder.AddMultipleAttributes(1, AdditionalAttributes);
     builder.AddAttribute(2, "type", "checkbox");
     builder.AddAttribute(3, "class", CssClass);
     builder.AddAttribute(4, "checked", BindMethods.GetValue(CurrentValue));
     builder.AddAttribute(5, "onchange", EventCallback.Factory.CreateBinder <bool>(this, __value => CurrentValue = __value, CurrentValue));
     builder.CloseElement();
 }
예제 #16
0
 private void AddDoubleValueHandlerIfValueIsDouble(IRendererTreeBuilder rendererTreeBuilder, Action <string, object> onChangeAction, string localColumnName, object value)
 {
     if (value is double doubleValue)
     {
         rendererTreeBuilder.AddAttribute(HtmlJSEvents.OnChange, BindMethods.SetValueHandler(delegate(double __value)
         {
             onChangeAction?.Invoke(localColumnName, __value);
         }, doubleValue)
                                          );
     }
 }
예제 #17
0
 /// <inheritdoc />
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.OpenElement(0, "input");
     builder.AddAttribute(1, "step", _stepAttributeValue); // Before the splat so the user can override
     builder.AddMultipleAttributes(2, AdditionalAttributes);
     builder.AddAttribute(3, "type", "number");
     builder.AddAttribute(4, "class", CssClass);
     builder.AddAttribute(5, "value", BindMethods.GetValue(CurrentValueAsString));
     builder.AddAttribute(6, "onchange", EventCallback.Factory.CreateBinder <string>(this, __value => CurrentValueAsString = __value, CurrentValueAsString));
     builder.CloseElement();
 }
예제 #18
0
        protected override void BuildRenderTreeInternal(GridRendererContext rendererContext, PermissionContext permissionContext)
        {
            using (new MeasurableScope(sw => logger.LogInformation($"Grid grouped body rendering duration {sw.ElapsedMilliseconds}ms")))
            {
                rendererContext.OpenElement(HtmlTagNames.TableBody, rendererContext.CssClasses.TableBody);
                foreach (var group in rendererContext.TableDataSet.GroupedItems)
                {
                    try
                    {
                        rendererContext.OpenElement(HtmlTagNames.TableRow, rendererContext.CssClasses.TableGroupRow);
                        rendererContext.OpenElement(HtmlTagNames.TableColumn, rendererContext.CssClasses.TableGroupRowCell);
                        rendererContext.AddAttribute(HtmlAttributes.Colspan, rendererContext.NumberOfColumns);
                        rendererContext.OpenElement(HtmlTagNames.Button, "pagination-button");
                        rendererContext.AddOnClickEvent(() =>
                                                        BindMethods.GetEventHandlerValue((UIMouseEventArgs e) =>
                        {
                            rendererContext.TableDataSet.ToggleGroupRow(group.Key);
                            rendererContext.RequestRerenderNotification?.Invoke();
                        })
                                                        );
                        rendererContext.OpenElement(HtmlTagNames.Span, "pagination-button-arrow");
                        rendererContext.OpenElement(HtmlTagNames.I, !group.IsCollapsed ? "fas fa-angle-down" : "fas fa-angle-right");
                        rendererContext.CloseElement();
                        rendererContext.CloseElement();
                        rendererContext.CloseElement();
                        rendererContext.AddMarkupContent($"\t<b>{rendererContext.TableDataSet.GroupingOptions.GroupedProperty.Name}:</b> {group.Key.ToString()}\t");
                        rendererContext.OpenElement(HtmlTagNames.I);
                        rendererContext.AddContent($"({group.Count})");
                        rendererContext.CloseElement();


                        if (!group.IsCollapsed)
                        {
                            var dataAdapter        = tableDataAdapterProvider.CreateCollectionTableDataAdapter(rendererContext.TableDataSet.UnderlyingTypeOfItem(), group);
                            var masterTableFeature = rendererContext.FlexGridContext.Features.Get <IMasterTableFeature>();
                            dataAdapter = tableDataAdapterProvider.CreateMasterTableDataAdapter(dataAdapter, masterTableFeature);

                            rendererContext.AddGridViewComponent(dataAdapter);
                        }

                        rendererContext.CloseElement();
                        rendererContext.CloseElement();
                    }
                    catch (Exception ex)
                    {
                        logger.LogError($"Error occured during rendering grouped grid view body. Ex: {ex}");

                        throw ex;
                    }
                }

                rendererContext.CloseElement();
            }
        }
예제 #19
0
 /// <inheritdoc />
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.OpenElement(0, "input");
     builder.AddMultipleAttributes(1, AdditionalAttributes);
     builder.AddAttribute(2, "type", "checkbox");
     builder.AddAttribute(3, "id", Id);
     builder.AddAttribute(4, "class", CssClass);
     builder.AddAttribute(5, "checked", BindMethods.GetValue(CurrentValue));
     builder.AddAttribute(6, "onchange", BindMethods.SetValueHandler(__value => CurrentValue = __value, CurrentValue));
     builder.CloseElement();
 }
예제 #20
0
 /// <inheritdoc />
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.OpenElement(0, "input");
     builder.AddAttribute(1, "type", "number");
     builder.AddAttribute(2, "step", _stepAttributeValue);
     builder.AddAttribute(3, "id", Id);
     builder.AddAttribute(4, "class", CssClass);
     builder.AddAttribute(5, "value", BindMethods.GetValue(CurrentValueAsString));
     builder.AddAttribute(6, "onchange", BindMethods.SetValueHandler(__value => CurrentValueAsString = __value, CurrentValueAsString));
     builder.CloseElement();
 }
예제 #21
0
 /// <inheritdoc />
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     base.BuildRenderTree(builder);
     builder.OpenElement(0, "select");
     builder.AddAttribute(1, "id", Id);
     builder.AddAttribute(2, "class", CssClass);
     builder.AddAttribute(3, "value", BindMethods.GetValue(CurrentValueAsString));
     builder.AddAttribute(4, "onchange", BindMethods.SetValueHandler(__value => CurrentValueAsString = __value, CurrentValueAsString));
     builder.AddContent(5, ChildContent);
     builder.CloseElement();
 }
예제 #22
0
 private void AddDoubleValueHandlerIfValueIsDouble(GridRendererContext gridRendererContext, string localColumnName, object value)
 {
     if (value is double doubleValue)
     {
         gridRendererContext.AddAttribute(HtmlJSEvents.OnChange, BindMethods.SetValueHandler(delegate(double __value)
         {
             gridRendererContext
             .TableDataSet
             .EditItemProperty(localColumnName, __value);
         }, doubleValue)
                                          );
     }
 }
예제 #23
0
 protected override void BuildRenderTree(RenderTreeBuilder builder)
 {
     builder.OpenElement(0, "input");
     builder.AddAttribute(1, "type", "checkbox");
     builder.AddAttribute(2, "value", BindMethods.GetValue(CheckboxEnabled));
     builder.AddAttribute(3, "onchange", BindMethods.SetValueHandler(__value => CheckboxEnabled = __value, CheckboxEnabled));
     builder.CloseElement();
     builder.OpenElement(4, "input");
     builder.AddAttribute(5, "value", BindMethods.GetValue(SomeStringProperty));
     builder.AddAttribute(6, "onchange", BindMethods.SetValueHandler(__value => SomeStringProperty = __value, SomeStringProperty));
     builder.AddAttribute(7, "disabled", !CheckboxEnabled);
     builder.CloseElement();
 }
        private void RenderSaveButton(GridRendererContext rendererContext)
        {
            rendererContext.OpenElement(HtmlTagNames.Button, "action-button");
            rendererContext.AddOnClickEvent(() =>
                                            BindMethods.GetEventHandlerValue((UIMouseEventArgs e) =>
                                                                             rendererContext.TableDataSet.SaveItem(rendererContext.PropertyValueAccessor))
                                            );

            rendererContext.OpenElement(HtmlTagNames.Span, "action-button-span");
            rendererContext.OpenElement(HtmlTagNames.I, "fas fa-save");
            rendererContext.CloseElement();
            rendererContext.CloseElement();
            rendererContext.CloseElement();
        }
        private void RenderDiscardButton(GridRendererContext rendererContext)
        {
            rendererContext.OpenElement(HtmlTagNames.Button, "action-button");
            rendererContext.AddOnClickEvent(() =>
                                            BindMethods.GetEventHandlerValue((UIMouseEventArgs e) =>
                                                                             rendererContext.TableDataSet.CancelEditation())
                                            );

            rendererContext.OpenElement(HtmlTagNames.Span, "action-button-span");
            rendererContext.OpenElement(HtmlTagNames.I, "fas fa-times");
            rendererContext.CloseElement();
            rendererContext.CloseElement();
            rendererContext.CloseElement();
        }
예제 #26
0
 private void AddLongValueHandlerIfValueIsLong(IRendererTreeBuilder rendererTreeBuilder, Action <string, object> onChangeAction, string localColumnName, object value)
 {
     if (value is long longValue)
     {
         rendererTreeBuilder.AddAttribute(HtmlJSEvents.OnChange, BindMethods.SetValueHandler(delegate(long __value)
         {
             onChangeAction?.Invoke(localColumnName, __value);
         }, longValue)
                                          );
     }
     else
     {
         AddDecimalValueHandlerIfValueIsDecimal(rendererTreeBuilder, onChangeAction, localColumnName, value);
     }
 }
예제 #27
0
        private void RenderButton(GridRendererContext rendererContext, PaginationButtonType buttonType, bool disabled, string buttonArrowClass)
        {
            rendererContext.OpenElement(HtmlTagNames.Button, !disabled ? "pagination-button" : "pagination-button pagination-button-disabled");
            rendererContext.AddDisabled(disabled);
            rendererContext.AddOnClickEvent(() =>
                                            BindMethods.GetEventHandlerValue(async(UIMouseEventArgs e) =>
                                                                             await GetPaginationTask(rendererContext, buttonType))
                                            );

            rendererContext.OpenElement(HtmlTagNames.Span, "pagination-button-arrow");
            rendererContext.OpenElement(HtmlTagNames.I, buttonArrowClass);
            rendererContext.CloseElement();
            rendererContext.CloseElement();
            rendererContext.CloseElement();
        }
예제 #28
0
        protected override void BuildRenderTree(RenderTreeBuilder builder)
        {
            if (!CreateItemOptions.IsCreateItemAllowed ||
                !PermissionContext.HasCreateItemPermission)
            {
                return;
            }

            base.BuildRenderTree(builder);

            var internalBuilder = new BlazorRendererTreeBuilder(builder);

            var createItemContext = new CreateItemContext(CreateItemOptions, CreateFormCssClasses);

            createItemContext.OnItemCreated += (object sender, ItemCreatedArgs e) => NewItemCreated?.Invoke(e);

            internalBuilder
            .OpenElement(HtmlTagNames.Div, "modal")
            .AddAttribute(HtmlAttributes.Id, CreateItemOptions.CreateItemModalName)
            .AddAttribute("role", "dialog")
            .OpenElement(HtmlTagNames.Div, $"modal-dialog modal-dialog-centered {CreateFormCssClasses.ModalSize}")
            .AddAttribute(HtmlAttributes.Id, CreateItemOptions.CreateItemModalSizeDiv)
            .OpenElement(HtmlTagNames.Div, "modal-content")
            .OpenElement(HtmlTagNames.Div, CreateFormCssClasses.ModalHeader)
            .OpenElement(HtmlTagNames.H4, "modal-title")
            .AddContent("Create Item")
            .CloseElement()
            .OpenElement(HtmlTagNames.Button, "close")
            .AddAttribute(HtmlJSEvents.OnClick, BindMethods.GetEventHandlerValue((UIMouseEventArgs e) => FlexGridInterop.HideModal(CreateItemOptions.CreateItemModalName)))
            .AddAttribute(HtmlAttributes.Type, "button")
            .AddAttribute("data-dismiss", "modal")
            .AddAttribute("aria-label", "Close")
            .OpenElement(HtmlTagNames.Span)
            .AddAttribute(HtmlAttributes.AriaHidden, "true")
            .AddContent(new MarkupString("&times;"))
            .CloseElement()
            .CloseElement()
            .CloseElement()
            .OpenElement(HtmlTagNames.Div, CreateFormCssClasses.ModalBody)
            .OpenComponent(typeof(CreateItemForm <,>)
                           .MakeGenericType(CreateItemOptions.ModelType, CreateItemOptions.OutputDtoType))
            .AddAttribute(nameof(CreateItemContext), createItemContext)
            .CloseComponent()
            .CloseElement()
            .CloseElement()
            .CloseElement()
            .CloseElement();
        }
        private void RenderEditButton(GridRendererContext rendererContext)
        {
            var localActualItem = rendererContext.ActualItem;

            rendererContext.OpenElement(HtmlTagNames.Button, "action-button");
            rendererContext.AddOnClickEvent(() =>
                                            BindMethods.GetEventHandlerValue((UIMouseEventArgs e) =>
                                                                             rendererContext.TableDataSet.StartEditItem(localActualItem))
                                            );

            rendererContext.OpenElement(HtmlTagNames.Span, "action-button-span");
            rendererContext.OpenElement(HtmlTagNames.I, "fas fa-edit");
            rendererContext.CloseElement();
            rendererContext.CloseElement();
            rendererContext.CloseElement();
        }
예제 #30
0
 private void BuildRendererTreeForCheckbox(BlazorRendererTreeBuilder rendererBuilder)
 {
     rendererBuilder
     .OpenElement(HtmlTagNames.Label, "switch")
     .OpenElement(HtmlTagNames.Input)
     .AddAttribute(HtmlAttributes.Type, HtmlAttributes.Checkbox)
     .AddAttribute(HtmlAttributes.Value, BindMethods.GetValue(actualFilterValue))
     .AddAttribute(HtmlJSEvents.OnChange, BindMethods.SetValueHandler(delegate(bool __value)
     {
         FilterBoolValueChanged(__value);
     }, (bool)(object)actualFilterValue))
     .CloseElement()
     .OpenElement(HtmlTagNames.Span, "slider round")
     .CloseElement()
     .CloseElement();
 }