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"); } }
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(); 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); }
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); }
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(';')); }
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); }