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);
            }
        }
Exemplo n.º 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();
        }
        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);
            }
        }
Exemplo n.º 4
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();
 }
Exemplo n.º 5
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();
 }
Exemplo n.º 6
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();
 }
Exemplo n.º 7
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();
 }
Exemplo n.º 8
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();
 }
Exemplo n.º 9
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();
 }
Exemplo n.º 10
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();
 }
Exemplo n.º 11
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();
 }
Exemplo n.º 12
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();
 }
Exemplo n.º 13
0
        public override void BuildInputRendererTree(IRendererTreeBuilder rendererTreeBuilder, IActualItemContext <object> actualItemContext, Action <string, object> onChangeAction)
        {
            var localColumnName = actualItemContext.ActualColumnName;
            var value           = actualItemContext.GetActualItemColumnValue(localColumnName);

            rendererTreeBuilder
            .OpenElement(HtmlTagNames.Div, "edit-field-wrapper")
            .OpenElement(HtmlTagNames.Input, "edit-text-field")
            .AddAttribute(HtmlAttributes.Type, GetInputType(value?.ToString() ?? InputTypeText))
            .AddAttribute(HtmlAttributes.Value, BindMethods.GetValue(value))
            .AddAttribute(HtmlJSEvents.OnChange,
                          BindMethods.SetValueHandler(delegate(string __value)
            {
                onChangeAction?.Invoke(localColumnName, __value);
            }, value?.ToString() ?? string.Empty)
                          )
            .CloseElement()
            .CloseElement();
        }
Exemplo n.º 14
0
        public override void RenderInput(GridRendererContext gridRendererContext)
        {
            var localColumnName = gridRendererContext.ActualColumnName;
            var value           = gridRendererContext.PropertyValueAccessor.GetValue(gridRendererContext.ActualItem, gridRendererContext.ActualColumnName);

            gridRendererContext.OpenElement(HtmlTagNames.Div, "edit-field-wrapper");
            gridRendererContext.OpenElement(HtmlTagNames.Input, "edit-text-field");
            gridRendererContext.AddAttribute(HtmlAttributes.Type, GetInputType(value.ToString()));
            gridRendererContext.AddAttribute(HtmlAttributes.Value, BindMethods.GetValue(value));
            gridRendererContext.AddAttribute(HtmlJSEvents.OnChange, BindMethods.SetValueHandler(delegate(string __value)
            {
                gridRendererContext
                .TableDataSet
                .EditItemProperty(localColumnName, __value);
            }, value.ToString())
                                             );

            gridRendererContext.CloseElement();
            gridRendererContext.CloseElement();
        }
Exemplo n.º 15
0
        public override void RenderInput(GridRendererContext gridRendererContext)
        {
            var localColumnName = gridRendererContext.ActualColumnName;
            var value           = gridRendererContext.PropertyValueAccessor.GetValue(gridRendererContext.ActualItem, localColumnName);

            if (IsSupportedNumberType(value))
            {
                gridRendererContext.OpenElement(HtmlTagNames.Div, "edit-field-wrapper");
                gridRendererContext.OpenElement(HtmlTagNames.Input, "edit-text-field");
                gridRendererContext.AddAttribute(HtmlAttributes.Type, "number");
                gridRendererContext.AddAttribute(HtmlAttributes.Value, BindMethods.GetValue(value));
                TryAddOnChangeHandler(gridRendererContext, localColumnName, value);
                gridRendererContext.CloseElement();
                gridRendererContext.CloseElement();
            }
            else
            {
                successor.RenderInput(gridRendererContext);
            }
        }
Exemplo n.º 16
0
        public override void BuildInputRendererTree(IRendererTreeBuilder rendererTreeBuilder, IActualItemContext <object> actualItemContext, Action <string, object> onChangeAction)
        {
            var localColumnName = actualItemContext.ActualColumnName;
            var value           = actualItemContext.GetActualItemColumnValue(localColumnName);

            if (IsSupportedNumberType(value))
            {
                rendererTreeBuilder
                .OpenElement(HtmlTagNames.Div, "edit-field-wrapper")
                .OpenElement(HtmlTagNames.Input, "edit-text-field")
                .AddAttribute(HtmlAttributes.Type, "number")
                .AddAttribute(HtmlAttributes.Value, BindMethods.GetValue(value));

                TryAddOnChangeHandler(rendererTreeBuilder, onChangeAction, localColumnName, value);

                rendererTreeBuilder
                .CloseElement()
                .CloseElement();
            }
            else
            {
                successor.BuildInputRendererTree(rendererTreeBuilder, actualItemContext, onChangeAction);
            }
        }