protected override void OnInitialized() { string prefixCls = "ant-radio-group"; ClassMapper.Add(prefixCls) .If($"{prefixCls}-large", () => Size == "large") .If($"{prefixCls}-small", () => Size == "small") .GetIf(() => $"{prefixCls}-{ButtonStyle}", () => ButtonStyle.IsIn("outline", "solid")) .If($"{prefixCls}-rtl", () => RTL) ; base.OnInitialized(); }
protected override void OnInitialized() { if (MessageService != null) { MessageService.OnOpening += NotifyAsync;; MessageService.OnDestroy += Destroy; MessageService.OnConfig += Config; } ClassMapper .Add(PrefixCls) .If($"{PrefixCls}-rtl", () => RTL); }
protected void SetClass() { ClassMapperLabel.Clear() .Add($"{_prefixCls}-wrapper") .If($"{_prefixCls}-wrapper-checked", () => Checked); ClassMapper.Clear() .Add(_prefixCls) .If($"{_prefixCls}-checked", () => Checked && !Indeterminate) .If($"{_prefixCls}-disabled", () => Disabled) .If($"{_prefixCls}-indeterminate", () => Indeterminate) .If($"{_prefixCls}-rtl", () => RTL); }
private void SetClass() { WrapperClassMapper .If(WrapperClassName, () => !string.IsNullOrWhiteSpace(WrapperClassName)) .If($"{PrefixCls}-nested-loading", () => !Simple); ClassMapper .Add(PrefixCls) .If($"{PrefixCls}-spinning", () => _isLoading) .If($"{PrefixCls}-lg", () => Size == "large") .If($"{PrefixCls}-sm", () => Size == "small") .If($"{PrefixCls}-show-text", () => string.IsNullOrWhiteSpace(Tip)) .If($"{PrefixCls}-rtl", () => RTL); }
protected override void OnInitialized() { base.OnInitialized(); this.CurrentValue = this.CurrentValue ? this.CurrentValue : this.Checked; ClassMapper.Clear() .Add(_prefixCls) .If($"{_prefixCls}-checked", () => CurrentValue) .If($"{_prefixCls}-disabled", () => Disabled || Loading) .If($"{_prefixCls}-loading", () => Loading) .If($"{_prefixCls}-small", () => Size == "small") ; }
/// <summary> /// Sets the default classes. /// </summary> private void SetClassMap() { string prefixName = "ant-alert"; ClassMapper.Clear() .Add("ant-alert") .If($"{prefixName}-{Type}", () => !string.IsNullOrEmpty(Type)) .If($"{prefixName}-no-icon", () => !ShowIcon) .If($"{prefixName}-closable", () => Closable) .If($"{prefixName}-banner", () => Banner) .If($"{prefixName}-with-description", () => !string.IsNullOrEmpty(Description)) .If($"{prefixName}-slide-up-leave", () => _isClosing) ; }
protected void SetClass() { string prefixCls = "ant-back-top"; ClassMapper.Add(prefixCls); BackTopContentClassMapper .If($"{prefixCls}-content", () => ChildContent == null) .If("ant-fade ant-fade-leave ant-fade-leave-active", () => !_visible) .If("ant-fade ant-fade-enter ant-fade-enter-active", () => _visible) ; BackTopIconClassMapper.Add($"{prefixCls}-icon"); }
protected override void OnInitialized() { base.OnInitialized(); ClassMapper.Add("ant-cascader-picker") .GetIf(() => $"ant-cascader-picker-{Size}", () => _sizeMap.ContainsKey(Size)) .GetIf(() => $"ant-input-{_sizeMap[Size]}", () => _sizeMap.ContainsKey(Size)) ; _inputClassMapper .Add("ant-input") .Add("ant-cascader-input") .GetIf(() => $"ant-input-{_sizeMap[Size]}", () => _sizeMap.ContainsKey(Size)); }
protected virtual void SetClasses() { AffixWrapperClass = $"{PrefixCls}-affix-wrapper {(IsFocused ? $"{PrefixCls}-affix-wrapper-focused" : "")}"; GroupWrapperClass = $"{PrefixCls}-group-wrapper"; if (!string.IsNullOrWhiteSpace(Class)) { AffixWrapperClass = string.Join(" ", Class, AffixWrapperClass); ClassMapper.OriginalClass = ""; } ClassMapper.Clear() .Add($"{PrefixCls}") .If($"{PrefixCls}-lg", () => Size == InputSize.Large) .If($"{PrefixCls}-sm", () => Size == InputSize.Small) .If($"{PrefixCls}-rtl", () => RTL) ; Attributes ??= new Dictionary <string, object>(); if (MaxLength >= 0 && !Attributes.ContainsKey("maxlength")) { Attributes?.Add("maxlength", MaxLength); } if (Disabled) { // TODO: disable element AffixWrapperClass = string.Join(" ", AffixWrapperClass, $"{PrefixCls}-affix-wrapper-disabled"); ClassMapper.Add($"{PrefixCls}-disabled"); } if (AllowClear) { _allowClear = true; //ClearIconClass = $"{PrefixCls}-clear-icon"; ToggleClearBtn(); } if (Size == InputSize.Large) { AffixWrapperClass = string.Join(" ", AffixWrapperClass, $"{PrefixCls}-affix-wrapper-lg"); GroupWrapperClass = string.Join(" ", GroupWrapperClass, $"{PrefixCls}-group-wrapper-lg"); } else if (Size == InputSize.Small) { AffixWrapperClass = string.Join(" ", AffixWrapperClass, $"{PrefixCls}-affix-wrapper-sm"); GroupWrapperClass = string.Join(" ", GroupWrapperClass, $"{PrefixCls}-group-wrapper-sm"); } }
protected override void OnInitialized() { base.OnInitialized(); var prefixCls = "ant-upload"; ClassMapper .Add(prefixCls) .If($"{prefixCls}-rtl", () => RTL); _listClassMapper .Add($"{prefixCls}-list") .Get(() => $"{prefixCls}-list-{ListType}") .If($"{prefixCls}-list-rtl", () => RTL); }
protected override void OnInitialized() { ClassMapper.Add(PrefixName); _targetKeys = TargetKeys.ToList(); var selectedKeys = SelectedKeys.ToList(); _sourceSelectedKeys = selectedKeys.Where(key => !_targetKeys.Contains(key)).ToList(); _targetSelectedKeys = selectedKeys.Where(key => _targetKeys.Contains(key)).ToList(); var count = _sourceSelectedKeys.Count; InitData(); MathTitleCount(); }
internal void SetClassMap() { var prefix = "ant-timeline-item"; ClassMapper.Clear().Add(prefix) .If($"{prefix}-right", () => Position == "right") .If($"{prefix}-left", () => Position == "left") .If($"{prefix}-last", () => IsLast); var headPrefix = "ant-timeline-item-head"; _headClassMapper.Clear().Add(headPrefix) .If($"{headPrefix}-{Color}", () => _defaultColors.Contains(Color)) .If($"{headPrefix}-custom", () => Dot != null); }
protected override void OnInitialized() { base.OnInitialized(); Sortable = Sortable || SorterMultiple != default || SorterCompare != default || DefaultSortOrder != default || SortDirections?.Any() == true; if (IsHeader) { if (FieldExpression != null) { var paramExp = Expression.Parameter(ItemType); var member = ColumnExpressionHelper.GetReturnMemberInfo(FieldExpression); var bodyExp = Expression.MakeMemberAccess(paramExp, member); GetFieldExpression = Expression.Lambda(bodyExp, paramExp); } else if (DataIndex != null) { (_, GetFieldExpression) = ColumnDataIndexHelper <TData> .GetDataIndexConfig(this); } if (Sortable && GetFieldExpression != null) { SortModel = new SortModel <TData>(GetFieldExpression, SorterMultiple, DefaultSortOrder, SorterCompare); } if (GetFieldExpression != null) { var member = ColumnExpressionHelper.GetReturnMemberInfo(GetFieldExpression); DisplayName = member.GetCustomAttribute <DisplayNameAttribute>(true)?.DisplayName ?? member.Name; FieldName = member.Name; } } else if (IsBody) { SortModel = Context.HeaderColumns[ColIndex] is IFieldColumn fieldColumn ? fieldColumn.SortModel : null; (GetValue, _) = ColumnDataIndexHelper <TData> .GetDataIndexConfig(this); } SortDirections ??= Table.SortDirections; Sortable = Sortable || SortModel != null; _sortDirection = SortModel?.SortDirection ?? DefaultSortOrder ?? SortDirection.None; ClassMapper .If("ant-table-column-has-sorters", () => Sortable) .If($"ant-table-column-sort", () => Sortable && SortModel != null && SortModel.SortDirection.IsIn(SortDirection.Ascending, SortDirection.Descending)); }
protected override async Task OnInitializedAsync() { if (Type == "loading") { Spin = true; } await SetupSvgImg(); Button?.Icons.Add(this); ClassMapper.Add($"anticon") .GetIf(() => $"anticon-{Type}", () => !string.IsNullOrWhiteSpace(Type)); await base.OnInitializedAsync(); }
private void SetClassMap() { var cls = "ant-pagination"; ClassMapper .If($"{cls}-prev", () => Type == "prev") .If($"{cls}-next", () => Type == "next") .If($"{cls}-item", () => Type == "page") .If($"{cls}-jump-prev", () => Type == "prev_5") .If($"{cls}-jump-prev-custom-icon", () => Type == "prev_5") .If($"{cls}-jump-next", () => Type == "next_5") .If($"{cls}-jump-next-custom-icon", () => Type == "next_5") .If($"{cls}-disabled", () => Disabled) .If($"{cls}-item-active", () => Active) ; }
/// <summary> /// Sets the default classes. /// </summary> private void SetClassMap() { string prefixName = "ant-alert"; ClassMapper.Clear() .Add("ant-alert") .If($"{prefixName}-{Type}", () => !string.IsNullOrEmpty(Type)) .If($"{prefixName}-no-icon", () => !ShowIcon) .If($"{prefixName}-closable", () => Closable) .If($"{prefixName}-banner", () => Banner) .If($"{prefixName}-with-description", () => !string.IsNullOrEmpty(Description) || ChildContent != null) .If($"{prefixName}-motion", () => _isClosing) .If($"{prefixName}-motion-leave", () => _isClosing) .If($"{prefixName}-motion-leave-active", () => _isClosing && _motionStage == 1) ; }
protected override void OnInitialized() { base.OnInitialized(); if (FieldExpression != null) { _propertyReflector = PropertyReflector.Create(FieldExpression); if (Sortable) { SortModel = new SortModel <TData>(_propertyReflector.Value.PropertyInfo, 1, Sort); } } ClassMapper .If("ant-table-column-has-sorters", () => Sortable) .If($"ant-table-column-sort", () => Sortable && SortModel.SortType.IsIn(SortType.Ascending, SortType.Descending)); }
protected void SetClassMap() { ClassMapper.Clear() .Add($"{ClassPrefix}") .If($"{ClassPrefix}-open", () => _dropDown != null ? _dropDown.Visible : false) .If($"{ClassPrefix}-focused", () => IsShowSearch()) .If($"{ClassPrefix}-single", () => SelectMode == SelectMode.Default) .If($"{ClassPrefix}-multiple", () => SelectMode != SelectMode.Default) .If($"{ClassPrefix}-sm", () => Size == AntSizeLDSType.Small) .If($"{ClassPrefix}-lg", () => Size == AntSizeLDSType.Large) .If($"{ClassPrefix}-borderless", () => !Bordered) .If($"{ClassPrefix}-show-arrow", () => ShowArrow) .If($"{ClassPrefix}-show-search", () => IsShowSearch()) .If($"{ClassPrefix}-bordered", () => Bordered) .If($"{ClassPrefix}-loading", () => Loading) .If($"{ClassPrefix}-disabled", () => Disabled); }
protected virtual void SetClasses() { ClassMapper.Clear() .If($"{PrefixCls}", () => Type != "number") .If($"{PrefixCls}-lg", () => Size == InputSize.Large) .If($"{PrefixCls}-sm", () => Size == InputSize.Small); if (Attributes is null) { Attributes = new Dictionary <string, object>(); } AffixWrapperClass = $"{PrefixCls}-affix-wrapper"; GroupWrapperClass = $"{PrefixCls}-group-wrapper"; if (MaxLength >= 0) { Attributes?.Add("maxlength", MaxLength); } if (Disabled) { // TODO: disable element AffixWrapperClass = string.Join(" ", AffixWrapperClass, $"{PrefixCls}-affix-wrapper-disabled"); ClassMapper.Add($"{PrefixCls}-disabled"); } if (AllowClear) { _allowClear = true; //ClearIconClass = $"{PrefixCls}-clear-icon"; ToggleClearBtn(); } if (Size == InputSize.Large) { AffixWrapperClass = string.Join(" ", AffixWrapperClass, $"{PrefixCls}-affix-wrapper-lg"); GroupWrapperClass = string.Join(" ", GroupWrapperClass, $"{PrefixCls}-group-wrapper-lg"); } else if (Size == InputSize.Small) { AffixWrapperClass = string.Join(" ", AffixWrapperClass, $"{PrefixCls}-affix-wrapper-sm"); GroupWrapperClass = string.Join(" ", GroupWrapperClass, $"{PrefixCls}-group-wrapper-sm"); } }
protected override async Task OnInitializedAsync() { if (Type == "loading") { Spin = true; } await SetupSvgImg(); if (this is Icon icon) { Button?.Icons.Add(icon); } ClassMapper.Add("anticon anticon-sync"); await base.OnInitializedAsync(); }
protected void SetClassMap() { var prefixName = "ant-btn"; ClassMapper.Clear() .Add(prefixName) .GetIf(() => $"{prefixName}-{this.Type}", () => !string.IsNullOrEmpty(Type)) .If($"{prefixName}-dangerous", () => Danger) .GetIf(() => $"{prefixName}-{Shape}", () => !string.IsNullOrEmpty(Shape)) .If($"{prefixName}-lg", () => Size == "large") .If($"{prefixName}-sm", () => Size == "small") .If($"{prefixName}-loading", () => Loading) .If($"{prefixName}-icon-only", () => !string.IsNullOrEmpty(this.Icon) && this.ChildContent == null) .If($"{prefixName}-background-ghost", () => Ghost) .If($"{prefixName}-block", () => this.Block) .If($"{prefixName}-rtl", () => RTL) ; }
protected override void OnInitialized() { base.OnInitialized(); if (!string.IsNullOrWhiteSpace(Width)) { Style = $"width:{(CssSizeLength)Width};" + Style; } if (!string.IsNullOrWhiteSpace(Height)) { Style = $"height:{(CssSizeLength)Height};" + Style; _imgStyle = $"height:{(CssSizeLength)Height};" + _imgStyle; } ClassMapper.Add("ant-image") .If("ant-image-error", () => _isError); }
protected void SetClassMap() { ClassMapper.Clear() .Add($"{ClassPrefix}") .If($"{ClassPrefix}-single", () => SelectMode == SelectMode.Default) .If($"{ClassPrefix}-multiple", () => SelectMode != SelectMode.Default) .If($"{ClassPrefix}-sm", () => Size == AntSizeLDSType.Small) .If($"{ClassPrefix}-lg", () => Size == AntSizeLDSType.Large) .If($"{ClassPrefix}-borderless", () => !Bordered) .If($"{ClassPrefix}-show-arrow", () => ShowArrow) .If($"{ClassPrefix}-show-search", () => IsShowSearch()) .If($"{ClassPrefix}-bordered", () => Bordered) .If($"{ClassPrefix}-loading", () => Loading) .If($"{ClassPrefix}-disabled", () => Disabled); _dropdownClassMapper.Clear() .Add($"{ClassPrefix}-dropdown-hidden") .Add($"{ClassPrefix}-placement-bottomLeft"); }
/// <summary> /// Sets the default CSS classes. /// </summary> private void SetClassMap() { var prefixName = "ant-badge"; ClassMapper.Clear() .Add(prefixName) .If($"{prefixName}-status", () => !string.IsNullOrEmpty(Status) || !string.IsNullOrEmpty(Color)) .If($"{prefixName}-not-a-wrapper", () => ChildContent == null) ; CountClassMapper.Clear() .Add("ant-scroll-number") .If($"{prefixName}-count", () => !Dot) .If($"{prefixName}-dot", () => Dot) .If($"{prefixName}-multiple-words", () => _countArray.Length >= 2) .If($"{prefixName}-zoom-enter {prefixName}-zoom-enter-active", () => _dotEnter) .If($"{prefixName}-zoom-leave {prefixName}-zoom-leave-active", () => _dotLeave) ; }
protected override void OnParametersSet() { base.OnParametersSet(); if (Effect != AntCarouselEffect.ScrollX && Effect != AntCarouselEffect.Fade) { throw new ArgumentOutOfRangeException($"{nameof(Effect)} must be one of {nameof(AntCarouselEffect)}.{nameof(AntCarouselEffect.ScrollX)} or {nameof(AntCarouselEffect)}.{nameof(AntCarouselEffect.Fade)}."); } _timer?.Dispose(); if (Autoplay != TimeSpan.Zero) { _timer = new Timer(AutoplaySlick, null, (int)Autoplay.TotalMilliseconds, (int)Autoplay.TotalMilliseconds); } ClassMapper.Clear() .Add(PrefixCls) .If($"{PrefixCls}-vertical", () => DotPosition == AntCarouselDotPosition.Left || DotPosition == AntCarouselDotPosition.Right); }
protected override void OnInitialized() { base.OnInitialized(); Sortable = Sortable || SorterMultiple != default || SorterCompare != default || DefaultSortOrder != default || SortDirections?.Any() == true; if (IsHeader) { if (FieldExpression != null) { _propertyReflector = PropertyReflector.Create(FieldExpression); } if (Sortable) { if (_propertyReflector.HasValue) { SortModel = new SortModel <TData>(_propertyReflector.Value.PropertyInfo, SorterMultiple, DefaultSortOrder, SorterCompare); } else { (GetValue, SortModel) = ColumnDataIndexHelper <TData> .GetDataIndexConfig(this); } } } else if (IsBody) { SortModel = Context.HeaderColumns[ColIndex] is IFieldColumn fieldColumn ? fieldColumn.SortModel : null; (GetValue, _) = ColumnDataIndexHelper <TData> .GetDataIndexConfig(this); } SortDirections ??= Table.SortDirections; Sortable = Sortable || SortModel != null; _sortDirection = SortModel?.SortDirection ?? DefaultSortOrder ?? SortDirection.None; ClassMapper .If("ant-table-column-has-sorters", () => Sortable) .If($"ant-table-column-sort", () => Sortable && SortModel != null && SortModel.SortDirection.IsIn(SortDirection.Ascending, SortDirection.Descending)); }
/// <summary> /// Sets the default CSS classes. /// </summary> private void SetClassMap() { var prefixName = "ant-badge"; ClassMapper.Clear() .Add(prefixName) .If($"{prefixName}-status", () => !string.IsNullOrEmpty(Status) || !string.IsNullOrEmpty(Color)) .If($"{prefixName}-not-a-wrapper", () => ChildContent == null) ; CountClassMapper.Clear() .Add("ant-scroll-number") .If($"{prefixName}-count", () => !Dot) .If($"{prefixName}-dot", () => Dot) .If($"{prefixName}-count-sm", () => !string.IsNullOrWhiteSpace(Size) && Size.Equals("small", StringComparison.OrdinalIgnoreCase)) .GetIf(() => $"ant-badge-status-{StatusOrPresetColor}", () => StatusOrPresetColor != null) .If($"{prefixName}-multiple-words", () => _countArray.Length >= 2) .If($"{prefixName}-zoom-enter {prefixName}-zoom-enter-active", () => _dotEnter) .If($"{prefixName}-zoom-leave {prefixName}-zoom-leave-active", () => _dotLeave) ; }
protected override void OnInitialized() { base.OnInitialized(); ClassMapper .Add("ant-cascader-picker") .GetIf(() => $"ant-cascader-picker-{Size}", () => _sizeMap.ContainsKey(Size)) .If("ant-cascader-picker-rtl", () => RTL); _inputClassMapper .Add("ant-input") .Add("ant-cascader-input") .GetIf(() => $"ant-input-{_sizeMap[Size]}", () => _sizeMap.ContainsKey(Size)) .If("ant-cascader-input-rtl", () => RTL); _menuClassMapper .Add("ant-cascader-menu") .If($"ant-cascader-menu-rtl", () => RTL); SetDefaultValue(Value ?? DefaultValue); }
protected override void SetClasses() { base.SetClasses(); //ant-input-password-large ant-input-affix-wrapper ant-input-affix-wrapper-lg ClassMapper .If($"{PrefixCls}-password-large", () => Size == InputSize.Large) .If($"{PrefixCls}-password-small", () => Size == InputSize.Small) .If($"{PrefixCls}-password-rtl", () => RTL); AffixWrapperClass = string.Join(" ", AffixWrapperClass, $"{PrefixCls}-password"); if (VisibilityToggle) { Suffix = new RenderFragment((builder) => { int i = 0; builder.OpenElement(i++, "span"); builder.AddAttribute(i++, "class", $"{PrefixCls}-suffix"); builder.OpenComponent <Icon>(i++); builder.AddAttribute(i++, "class", $"{PrefixCls}-password-icon"); builder.AddAttribute(i++, "type", _eyeIcon); builder.AddAttribute(i++, "onclick", CallbackFactory.Create <MouseEventArgs>(this, async args => { var element = await JsInvokeAsync <HtmlElement>(JSInteropConstants.GetDomInfo, Ref); IsFocused = true; await this.FocusAsync(Ref); ToggleVisibility(args); if (element.SelectionStart != 0) { await Js.SetSelectionStartAsync(Ref, element.SelectionStart); } })); builder.CloseComponent(); builder.CloseElement(); }); } }
protected void SetClassMap() { string prefixName = "ant-btn"; Hashtable sizeMap = new Hashtable() { ["large"] = "lg", ["small"] = "sm" }; ClassMapper.Clear() .Add("ant-btn") .If($"{prefixName}-{this.Type}", () => !string.IsNullOrEmpty(Type)) .If($"{prefixName}-dangerous", () => Danger) .If($"{prefixName}-{Shape}", () => !string.IsNullOrEmpty(Shape)) .If($"{prefixName}-{sizeMap[this.Size]}", () => sizeMap.ContainsKey(Size)) .If($"{prefixName}-loading", () => Loading) .If($"{prefixName}-icon-only", () => Icons.Count == 0 && !this.Search && !this._isInDropdown && this.ChildContent == null) .If($"{prefixName}-background-ghost", () => Ghost) .If($"{prefixName}-block", () => this.Block) .If($"ant-input-search-button", () => this.Search) ; }