Skip to content

Commit 44afc80

Browse files
ArgoZhangA5196060
andauthored
refactor(Input): style to fit the input-group mode (#4993)
* refactor(Input): style to fit the input-group mode Co-Authored-By: A5196060 <166673003+A5196060@users.noreply.github.com> * refactor: 调整右侧间隙 * chore: bump version 9.2.0 * doc: 增加 Clearable 文档 --------- Co-authored-by: A5196060 <166673003+A5196060@users.noreply.github.com>
1 parent f83730d commit 44afc80

File tree

6 files changed

+52
-4
lines changed

6 files changed

+52
-4
lines changed

src/BootstrapBlazor.Server/Components/Samples/Inputs.razor

+29
Original file line numberDiff line numberDiff line change
@@ -222,4 +222,33 @@
222222
</div>
223223
</DemoBlock>
224224

225+
<DemoBlock Title="@Localizer["ClearableTitle"]"
226+
Introduction="@Localizer["ClearableIntro"]"
227+
Name="OnInput">
228+
<div class="row g-3">
229+
<div class="col-12 col-sm-6">
230+
<BootstrapInput Value="Model.Name" Clearable="true" ShowLabel="true" DisplayText="Clearable" />
231+
</div>
232+
</div>
233+
<div class="row form-inline g-3 mt-0">
234+
<div class="col-12 col-sm-6">
235+
<BootstrapInput Value="Model.Name" Clearable="true" ShowLabel="true" DisplayText="Clearable" />
236+
</div>
237+
</div>
238+
<div class="row g-3 mt-0">
239+
<div class="col-12 col-sm-6">
240+
<BootstrapInputGroup>
241+
<BootstrapInputGroupLabel ShowRequiredMark DisplayText="Clearable"></BootstrapInputGroupLabel>
242+
<BootstrapInput Value="@Model.Name" Clearable="true" />
243+
</BootstrapInputGroup>
244+
</div>
245+
<div class="col-12 col-sm-6">
246+
<BootstrapInputGroup>
247+
<BootstrapInput Value="@Model.Name" Clearable="true" />
248+
<BootstrapInputGroupLabel ShowRequiredMark DisplayText="Clearable"></BootstrapInputGroupLabel>
249+
</BootstrapInputGroup>
250+
</div>
251+
</div>
252+
</DemoBlock>
253+
225254
<AttributeTable Items="@GetAttributes()" />

src/BootstrapBlazor.Server/Locales/en-US.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -2780,7 +2780,9 @@
27802780
"InputsFormatStringSetting": "Set up",
27812781
"InputsFormatStringTips": "The <code>BootstrapInput</code> component binds <code>byte[]</code> array and formats it as an example of <code>base64</code> encoded string",
27822782
"UseInputEvent": "Whether use oninput event when bind-value",
2783-
"IsTrim": "automatically trim white space when entering content"
2783+
"IsTrim": "automatically trim white space when entering content",
2784+
"ClearableTitle": "Clearable",
2785+
"ClearableIntro": "By setting the <code>Clearable=\"true\"</code> parameter, a small <b>Clear</b> button will be displayed when the component gains focus or when the mouse hovers over it."
27842786
},
27852787
"BootstrapBlazor.Server.Components.Samples.InputNumbers": {
27862788
"InputNumbersTitle": "InputNumber",

src/BootstrapBlazor.Server/Locales/zh-CN.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -2780,7 +2780,9 @@
27802780
"InputsFormatStringSetting": "设置",
27812781
"InputsFormatStringTips": "<code>BootstrapInput</code> 组件绑定 <code>byte[]</code> 数组,格式化成 <code>base64</code> 编码字符串示例",
27822782
"UseInputEvent": "是否在文本框输入值时触发",
2783-
"IsTrim": "是否自动去除空格"
2783+
"IsTrim": "是否自动去除空格",
2784+
"ClearableTitle": "清除",
2785+
"ClearableIntro": "通过设置 <code>Clearable=\"true\"</code> 参数,使组件获得焦点或者鼠标悬浮时显示一个 <b>清除</b> 小按钮"
27842786
},
27852787
"BootstrapBlazor.Server.Components.Samples.InputNumbers": {
27862788
"InputNumbersTitle": "InputNumber 组件",

src/BootstrapBlazor/BootstrapBlazor.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.2.0-beta01</Version>
4+
<Version>9.2.0</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

src/BootstrapBlazor/Components/Input/BootstrapInput.razor.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
color: var(--bb-border-hover-color);
1515
cursor: pointer;
1616
position: absolute;
17-
right: 11px;
17+
right: 10px;
1818
display: none;
1919
}
2020

src/BootstrapBlazor/Components/Input/BootstrapInputGroup.razor.scss

+15
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
> .datetime-picker,
33
> .select,
44
> .switch,
5+
> .bb-clearable-input,
56
> .auto-complete {
67
width: 1%;
78
flex: 1 1 auto;
@@ -39,6 +40,20 @@
3940
}
4041
}
4142
}
43+
44+
> .bb-clearable-input:not(:first-child) {
45+
> input {
46+
border-top-left-radius: 0;
47+
border-bottom-left-radius: 0;
48+
}
49+
}
50+
51+
> .bb-clearable-input:not(:last-child) {
52+
> input {
53+
border-top-right-radius: 0;
54+
border-bottom-right-radius: 0;
55+
}
56+
}
4257
}
4358

4459
.input-group-xs {

0 commit comments

Comments
 (0)