mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-11-29 18:48:50 +08:00
fix(module: cascader): style and class properties (#1269)
This commit is contained in:
parent
e5225afb05
commit
10b3346c4f
@ -3,7 +3,6 @@
|
|||||||
@inherits AntInputComponentBase<string>
|
@inherits AntInputComponentBase<string>
|
||||||
|
|
||||||
<CascadingValue Value=@("ant-cascader-menus") Name="PrefixCls">
|
<CascadingValue Value=@("ant-cascader-menus") Name="PrefixCls">
|
||||||
<div class="@ClassMapper.Class" style="@Style" id="@Id" tabindex="-1" @ref="Ref">
|
|
||||||
<OverlayTrigger Visible="@(ToggleState && _nodelist != null && _nodelist.Any())"
|
<OverlayTrigger Visible="@(ToggleState && _nodelist != null && _nodelist.Any())"
|
||||||
ComplexAutoCloseAndVisible="true"
|
ComplexAutoCloseAndVisible="true"
|
||||||
Trigger="new[] { TriggerType.Click }"
|
Trigger="new[] { TriggerType.Click }"
|
||||||
@ -11,9 +10,9 @@
|
|||||||
OverlayEnterCls="ant-slide-up-enter ant-slide-up-enter-active ant-slide-up"
|
OverlayEnterCls="ant-slide-up-enter ant-slide-up-enter-active ant-slide-up"
|
||||||
OverlayLeaveCls="ant-slide-up-leave ant-slide-up-leave-active ant-slide-up">
|
OverlayLeaveCls="ant-slide-up-leave ant-slide-up-leave-active ant-slide-up">
|
||||||
<Unbound>
|
<Unbound>
|
||||||
<span @ref="context.Current" class="ant-cascader-picker @_pickerSizeClass" tabindex="1" @onclick="InputOnToggle" @onblur="CascaderOnBlur" @onmouseover="InputOnMouseOver" @onmouseout="InputOnMouseOut">
|
<span @ref="context.Current" style="@Style" id="@Id" class="@ClassMapper.Class" tabindex="1" @onclick="InputOnToggle" @onblur="CascaderOnBlur" @onmouseover="InputOnMouseOver" @onmouseout="InputOnMouseOut">
|
||||||
<span class="ant-cascader-picker-label"></span>
|
<span class="ant-cascader-picker-label"></span>
|
||||||
<input autocomplete="off" tabindex="-1" placeholder="@PlaceHolder" class="ant-input ant-cascader-input @_inputSizeClass" readonly="@Readonly" type="text" value="@_displayText">
|
<input autocomplete="off" tabindex="-1" placeholder="@PlaceHolder" class="@_inputClassMapper.Class" readonly="@Readonly" type="text" value="@_displayText">
|
||||||
@if (string.IsNullOrWhiteSpace(Value) || !ShowClearIcon)
|
@if (string.IsNullOrWhiteSpace(Value) || !ShowClearIcon)
|
||||||
{
|
{
|
||||||
<Icon Type="down" Class="@($"ant-cascader-picker-arrow {(ToggleState ? "ant-cascader-picker-arrow-expand" : string.Empty)}")" />
|
<Icon Type="down" Class="@($"ant-cascader-picker-arrow {(ToggleState ? "ant-cascader-picker-arrow-expand" : string.Empty)}")" />
|
||||||
@ -73,5 +72,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</Overlay>
|
</Overlay>
|
||||||
</OverlayTrigger>
|
</OverlayTrigger>
|
||||||
</div>
|
|
||||||
</CascadingValue>
|
</CascadingValue>
|
@ -77,7 +77,7 @@ namespace AntDesign
|
|||||||
else if (_nodelist.Count != 0) _nodelist.Clear();
|
else if (_nodelist.Count != 0) _nodelist.Clear();
|
||||||
_nodelist.AddRange(value);
|
_nodelist.AddRange(value);
|
||||||
|
|
||||||
_optionsNeedInitialize = true;
|
ProcessParentAndDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,9 +98,6 @@ namespace AntDesign
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal List<CascaderNode> _renderNodes = new List<CascaderNode>();
|
internal List<CascaderNode> _renderNodes = new List<CascaderNode>();
|
||||||
|
|
||||||
private string _pickerSizeClass = string.Empty;
|
|
||||||
private string _inputSizeClass = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 浮层 展开/折叠状态
|
/// 浮层 展开/折叠状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -117,36 +114,28 @@ namespace AntDesign
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private SelectedTypeEnum SelectedType { get; set; }
|
private SelectedTypeEnum SelectedType { get; set; }
|
||||||
|
|
||||||
|
private ClassMapper _inputClassMapper = new ClassMapper();
|
||||||
private string _displayText;
|
private string _displayText;
|
||||||
private bool _optionsNeedInitialize;
|
|
||||||
|
private static Hashtable _sizeMap = new Hashtable()
|
||||||
|
{
|
||||||
|
["large"] = "lg",
|
||||||
|
["small"] = "sm"
|
||||||
|
};
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
base.OnInitialized();
|
base.OnInitialized();
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
ClassMapper.Add("ant-cascader-picker")
|
||||||
{
|
.GetIf(() => $"ant-cascader-picker-{Size}", () => _sizeMap.ContainsKey(Size))
|
||||||
base.OnParametersSet();
|
.GetIf(() => $"ant-input-{_sizeMap[Size]}", () => _sizeMap.ContainsKey(Size))
|
||||||
|
;
|
||||||
|
|
||||||
Hashtable sizeMap = new Hashtable()
|
_inputClassMapper
|
||||||
{
|
.Add("ant-input")
|
||||||
["large"] = "lg",
|
.Add("ant-cascader-input")
|
||||||
["small"] = "sm"
|
.GetIf(() => $"ant-input-{_sizeMap[Size]}", () => _sizeMap.ContainsKey(Size));
|
||||||
};
|
|
||||||
|
|
||||||
if (sizeMap.ContainsKey(Size))
|
|
||||||
{
|
|
||||||
_pickerSizeClass = $"ant-cascader-picker-{Size}";
|
|
||||||
_inputSizeClass = $"ant-input-{sizeMap[Size]}";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_pickerSizeClass = "";
|
|
||||||
_inputSizeClass = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
ProcessParentAndDefault();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnValueChange(string value)
|
protected override void OnValueChange(string value)
|
||||||
@ -310,13 +299,8 @@ namespace AntDesign
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void ProcessParentAndDefault()
|
private void ProcessParentAndDefault()
|
||||||
{
|
{
|
||||||
if (_optionsNeedInitialize)
|
InitCascaderNodeState(_nodelist, null, 0);
|
||||||
{
|
SetDefaultValue(Value ?? DefaultValue);
|
||||||
_optionsNeedInitialize = false;
|
|
||||||
|
|
||||||
InitCascaderNodeState(_nodelist, null, 0);
|
|
||||||
SetDefaultValue(Value ?? DefaultValue);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user