Ejemplo n.º 1
0
 protected override void OnParametersSet()
 {
     base.OnParametersSet();
     if (string.IsNullOrWhiteSpace(showingImage) && !string.IsNullOrWhiteSpace(Image))
     {
         showingImage = Image;
     }
     if (IsLoading)
     {
         IsDisabled = true;
     }
     cssClassBuilder = HtmlPropertyBuilder.CreateCssClassBuilder();
     if (string.IsNullOrWhiteSpace(Cls) || AppendCustomCls)
     {
         cssClassBuilder.Add($"el-button", $"el-button--{Type.ToString().ToLower()}", Cls)
         .AddIf(Size != ButtonSize.Default, $"el-button--{Size.ToString().ToLower()}")
         .AddIf(IsPlain, "is-plain")
         .AddIf(IsRound, "is-round")
         .AddIf(IsDisabled, "is-disabled")
         .AddIf(IsLoading, "is-loading")
         .AddIf(IsCircle, "is-circle");
         return;
     }
     cssClassBuilder.AddIf(!string.IsNullOrWhiteSpace(Cls), Cls);
     if (string.IsNullOrWhiteSpace(Cls))
     {
         cssClassBuilder.Add($"el-button", $"el-button--{Type.ToString().ToLower()}")
         .AddIf(Size != ButtonSize.Default, $"el-button--{Size.ToString().ToLower()}")
         .AddIf(IsPlain, "is-plain")
         .AddIf(IsRound, "is-round")
         .AddIf(IsDisabled, "is-disabled")
         .AddIf(IsLoading, "is-loading")
         .AddIf(IsCircle, "is-circle");
     }
 }
Ejemplo n.º 2
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            await base.OnAfterRenderAsync(firstRender);

            if (firstRender)
            {
                thisRef    = DotNetObjectReference.Create(this);
                clsBuilder = HtmlPropertyBuilder.CreateCssClassBuilder()
                             .Add("blazor-animation")
                             .Add(Cls?.Split(' ') ?? new string[0]);

                await JSRuntime.InvokeVoidAsync("RegisterAnimationBegin", thisRef, animationElement);

                styleBuilder = HtmlPropertyBuilder.CreateCssStyleBuilder()
                               .Add(InitialStyle?.Split(';') ?? new string[0])
                               .AddIf(IsAbsolute, "position:absolute")
                               .Add("transition:all 1s ease");
                if (paths.Any())
                {
                    var firstStyle = paths.Peek();
                    styleBuilder.Remove("transition").Add($"transition:all {(firstStyle.Duration <= 0 ? 1000 : firstStyle.Duration)}ms ease");
                }
                MarkAsRequireRender();
                StateHasChanged();
                return;
            }
            if (!animationBegined)
            {
                animationBegined = true;
                await AnimationElementLoadAsync();
            }
        }
Ejemplo n.º 3
0
        protected override void OnParametersSet()
        {
            base.OnParametersSet();
            warpperClsBuilder = HtmlPropertyBuilder.CreateCssClassBuilder()
                                .Add("el-select", Cls);
            if (valueType == null)
            {
                InitilizeEnumValues(FormItem != null);
            }
            if (FormItem == null)
            {
                Label = Label ?? Options.FirstOrDefault(x => TypeHelper.Equal(x.Key, Value))?.Text;
                return;
            }

            if (FormItem.OriginValueHasRendered)
            {
                return;
            }
            FormItem.OriginValueHasRendered = true;
            if (FormItem.Form.Values.Any())
            {
                Value = FormItem.OriginValue;
            }

            if (dict != null && Value != null)
            {
                Label = dict[Value] ?? Label;
            }
            SetFieldValue(Value, false);
        }
Ejemplo n.º 4
0
 protected override void OnParametersSet()
 {
     base.OnParametersSet();
     wrapperClsBuilder = HtmlPropertyBuilder.CreateCssClassBuilder()
                         .Add("el-input", Cls, $"el-input--{Size.ToString().ToLower()}")
                         .AddIf(IsClearable || !string.IsNullOrWhiteSpace(SuffixIcon), "el-input--suffix")
                         .AddIf(!string.IsNullOrWhiteSpace(PrefixIcon), "el-input--prefix")
                         .AddIf(IsDisabled, "is-disabled")
                         .AddIf(Prepend != null, "el-input-group", "el-input-group--append", "el-input-group--prepend");
     if (FormItem == null)
     {
         return;
     }
     if (FormItem.OriginValueHasRendered)
     {
         SetFieldValue(Value ?? FormItem.Value, false);
         Value = Value ?? FormItem.OriginValue;
         return;
     }
     FormItem.OriginValueHasRendered = true;
     if (FormItem.Form.Values.Any())
     {
         Value = FormItem.OriginValue;
     }
     Console.WriteLine($"OnParametersSet 设置输入框 {Name} 值:" + Value);
     SetFieldValue(Value, false);
 }
Ejemplo n.º 5
0
        protected override void OnParametersSet()
        {
            base.OnParametersSet();
            formItemCssBuilder = HtmlPropertyBuilder.CreateCssStyleBuilder().AddIf(IsHidden, "display:none")
                                 .Add(Style);

            if (!Form.Values.Any())
            {
                return;
            }
            if (string.IsNullOrWhiteSpace(Name))
            {
                if (GetType() != typeof(BFormActionItem))
                {
                    ExceptionHelper.Throw(ExceptionHelper.FormItemMustHaveName, "BFormItem 组件必须指定 Name 属性");
                }
                return;
            }
            if (OriginValueHasSet)
            {
                return;
            }
            OriginValueHasSet = true;
            if (Form.Values.TryGetValue(Name, out var value))
            {
                OriginValue = (TValue)value;
                Console.WriteLine($"设置 FormItem {Name} 值:" + value);
                Value = (TValue)value;
            }
            OriginValueHasRendered = false;
        }
Ejemplo n.º 6
0
 protected override void OnParametersSet()
 {
     iconCssBuilder = HtmlPropertyBuilder.CreateCssClassBuilder()
                      .AddIf(Closable, "el-tag__close", "el-icon-close");
     tagCssBuilder = HtmlPropertyBuilder.CreateCssClassBuilder()
                     .Add("el-tag", $"el-tag--{Size.ToString().ToLower()}", $"el-tag--{Theme.ToString().ToLower()}", $"el-tag--{Type.ToString().ToLower()}");
     tagStyleBuilder = HtmlPropertyBuilder.CreateCssStyleBuilder()
                       .AddIf(!string.IsNullOrEmpty(Style), Style.Split(';'));
 }
Ejemplo n.º 7
0
 protected override void OnParametersSet()
 {
     styleBuilder = HtmlPropertyBuilder.CreateCssStyleBuilder()
                    .AddIf(NavigationHeight <= 0, "height:160px")
                    .AddIf(NavigationHeight > 0, $"height:{NavigationHeight.ToString()}px");
     menuStyleBuilder = HtmlPropertyBuilder.CreateCssStyleBuilder()
                        .AddIf(string.IsNullOrEmpty(MenuBackgroundColor), "background-color:#0062AF;")
                        .AddIf(!string.IsNullOrEmpty(MenuBackgroundColor), $"background-color:{MenuBackgroundColor}")
                        .AddIf(!string.IsNullOrEmpty(MenuText), $"color:{MenuText}")
                        .AddIf(string.IsNullOrEmpty(MenuText), "color:#fff;")
                        .Add("border-radus:3px");
 }
Ejemplo n.º 8
0
 protected override void OnParametersSet()
 {
     base.OnParametersSet();
     layoutCssBuilder = HtmlPropertyBuilder.CreateCssStyleBuilder();
     if (North != null)
     {
         layoutCssBuilder = layoutCssBuilder.AddIf(Fit, $"height:calc(100vh - {NorthHeight}px)");
     }
     else
     {
         layoutCssBuilder = layoutCssBuilder.AddIf(Fit, "height:calc(100vh)");
     }
     layoutCssBuilder = layoutCssBuilder.Add(Style);
 }
Ejemplo n.º 9
0
 protected override void OnParametersSet()
 {
     base.OnParametersSet();
     CheckBoxGroupCssBuilder = HtmlPropertyBuilder.CreateCssClassBuilder()
                               .Add("el-transfer-panel__list")
                               .AddIf(EnableSearch, "is-filterable");
     if (FormItem == null)
     {
         return;
     }
     if (FormItem.OriginValueHasRendered)
     {
         return;
     }
     FormItem.OriginValueHasRendered = true;
     if (FormItem.Form.Values.Any())
     {
         ResetList2(FormItem.OriginValue);
     }
     SyncFieldValue(false);
 }
Ejemplo n.º 10
0
 protected override void OnInitialized()
 {
     base.OnInitialized();
     styleBuilder = HtmlPropertyBuilder.CreateCssStyleBuilder()
                    .Add("display:none");
 }
Ejemplo n.º 11
0
 protected override void OnParametersSet()
 {
     base.OnParametersSet();
     layoutCssBuilder = HtmlPropertyBuilder.CreateCssStyleBuilder().AddIf(Fit, "height:calc(100vh)").Add(Style);
 }
Ejemplo n.º 12
0
 protected override void OnParametersSet()
 {
     base.OnParametersSet();
     wrapperClassBuilder = CssClassBuilder.CreateCssClassBuilder().Add("el-card", "box-card", $"is-{Shadow.ToString().ToLower()}-shadow", Cls);
     bodyClassBuilder    = CssClassBuilder.CreateCssClassBuilder().Add("el-card__body", BodyCls);
 }