Exemple #1
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();
            }
        }
        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;
        }
Exemple #3
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(';'));
 }
Exemple #4
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");
 }
 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);
 }
Exemple #6
0
 protected override void OnInitialized()
 {
     base.OnInitialized();
     styleBuilder = HtmlPropertyBuilder.CreateCssStyleBuilder()
                    .Add("display:none");
 }
Exemple #7
0
 protected override void OnParametersSet()
 {
     base.OnParametersSet();
     layoutCssBuilder = HtmlPropertyBuilder.CreateCssStyleBuilder().AddIf(Fit, "height:calc(100vh)").Add(Style);
 }