private string?GetThemeItemClass(SelectedItem item) => CssBuilder.Default("theme-item") .AddClass("active", SiteOptions.CurrentValue.CurrentTheme == item.Value) .Build();
/// <summary> /// 获取消息样式 /// </summary> /// <param name="item"></param> /// <returns></returns> private string?GetClassString(ConsoleMessageItem item) => CssBuilder.Default() .AddClass($"text-{item.Color.ToDescriptionString()}", item.Color != Color.None) .Build();
/// <summary> /// 获得/设置 设置当前项是否 Active 方法 /// </summary> /// <param name="item"></param> /// <returns></returns> protected string?ActiveItem(SelectedItem item) => CssBuilder.Default("dropdown-item") .AddClass("active", () => item.Value == CurrentValueAsString) .Build();
/// <summary> /// 通过 MenumItem 获取 IsDisabled 状态字符串 /// </summary> /// <returns></returns> public static string?GetDisabledClassString(this MenuItem item) => CssBuilder.Default() .AddClass("disabled", item.IsDisabled) .Build();
/// <summary> /// 获得 组件样式 /// </summary> protected string?GetClassString(string?defaultClass = "checkbox-list form-control") => CssBuilder.Default() .AddClass(defaultClass) .AddClass("no-border", !ShowBorder && ValidCss != "is-invalid") .AddClass("is-vertical", IsVertical) .AddClass(CssClass).AddClass(ValidCss) .Build();
private string?GetItemClassString(CollapseItem item) => CssBuilder.Default("accordion-item") .AddClass(item.Class, !string.IsNullOrEmpty(item.Class)) .Build();
private string?GetItemClassString(SelectedItem item) => CssBuilder.Default("dropdown-item") .AddClass("active", GetCheckedState(item)) .Build();
private static string?GetButtonClassString(CollapseItem item) => CssBuilder.Default("accordion-button") .AddClass("collapsed", item.IsCollapsed) .AddClass($"btn-{item.TitleColor.ToDescriptionString()}", item.TitleColor != Color.None) .AddClass($"accordion-button-{item.TitleColor.ToDescriptionString()}", item.TitleColor != Color.None) .Build();
private static string?GetClassString(bool collpased) => CssBuilder.Default("accordion-collapse collapse") .AddClass("show", !collpased) .Build();
/// <summary> /// 获得 图标样式 /// </summary> /// <returns></returns> internal string?ToIconClassString() => CssBuilder.Default("timeline-item-icon") .AddClass(Icon, !string.IsNullOrEmpty(Icon)) .AddClass($"text-{Color.ToDescriptionString()}", Color != Color.None) .Build();
private string?GetItemClass(SelectedItem item) => CssBuilder.Default("transfer-panel-item") .AddClass(OnSetItemClass?.Invoke(item)) .Build();
/// <summary> /// 获得 时间线节点样式 /// </summary> internal string?ToNodeClassString() => CssBuilder.Default("timeline-item-node-normal timeline-item-node") .AddClass($"bg-{Color.ToDescriptionString()}", Color != Color.None && string.IsNullOrEmpty(Icon)) .AddClass("is-icon", !string.IsNullOrEmpty(Icon)) .Build();
private static string?GetClassString(RibbonTabItem item) => CssBuilder.Default() .AddClass("active", item.IsActive) .Build();
/// <summary> /// 获得 当前样式名称 /// </summary> private string?GetClassName(int index) => CssBuilder.Default("time-spinner-item") .AddClass("prev", ViewMode switch {
/// <summary> /// 设置当前项是否 Active 方法 /// </summary> /// <param name="item"></param> /// <returns></returns> private string?ActiveItem(SelectedItem item) => CssBuilder.Default("dropdown-item") .AddClass("active", () => item.Value == CurrentValueAsString) .AddClass("disabled", item.IsDisabled) .Build();
/// <summary> /// /// </summary> /// <param name="item"></param> /// <param name="className"></param> /// <returns></returns> private string?GetDropdownClassString(MenuItem item, string className = "") => CssBuilder.Default(className) .AddClass("dropdown", string.IsNullOrEmpty(className) && !Parent.IsBottom) .AddClass("dropup", string.IsNullOrEmpty(className) && Parent.IsBottom) .AddClass("disabled", item.IsDisabled) .AddClass("active", item.IsActive) .Build();