From 9c27027213c271e313945f929517ae623d5b2a9b Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Sun, 20 Mar 2022 16:30:03 +0800 Subject: [PATCH 01/20] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=20IsTrim=20?= =?UTF-8?q?=E8=AF=B4=E6=98=8E=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Shared/Locales/en.json | 1 + src/BootstrapBlazor.Shared/Locales/zh.json | 1 + .../Samples/Inputs.razor | 23 ++++++++++--------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/BootstrapBlazor.Shared/Locales/en.json b/src/BootstrapBlazor.Shared/Locales/en.json index de9ced53f..3606e1391 100644 --- a/src/BootstrapBlazor.Shared/Locales/en.json +++ b/src/BootstrapBlazor.Shared/Locales/en.json @@ -1222,6 +1222,7 @@ "Block11Intro": "Use the BootstrapPassword component", "IsTrimTitle": "Trim", "IsTrimIntro": "Use IsTrim=\"true\" to automatically trim white space when entering content", + "TrimDescription": "The front and back spaces in the component will be trimmed when set IsTrim to true", "PlaceHolder": "Please enter ...", "TestName": "Tom", "Log": "The key triggers the current text box value", diff --git a/src/BootstrapBlazor.Shared/Locales/zh.json b/src/BootstrapBlazor.Shared/Locales/zh.json index 720df626c..e7998d292 100644 --- a/src/BootstrapBlazor.Shared/Locales/zh.json +++ b/src/BootstrapBlazor.Shared/Locales/zh.json @@ -1224,6 +1224,7 @@ "Block11Intro": "使用 BootstrapPassword 组件", "IsTrimTitle": "修剪空白", "IsTrimIntro": "使用 IsTrim=\"true\" 可在输入内容的时候自动修剪空白", + "TrimDescription": "设置参数 IsTrim 值为 true 后,组件内的前后空格将会被裁减", "PlaceHolder": "请输入 ...", "TestName": "张三", "Log": "按键触发 当前文本框值", diff --git a/src/BootstrapBlazor.Shared/Samples/Inputs.razor b/src/BootstrapBlazor.Shared/Samples/Inputs.razor index 3f602dfec..0bffc95ce 100644 --- a/src/BootstrapBlazor.Shared/Samples/Inputs.razor +++ b/src/BootstrapBlazor.Shared/Samples/Inputs.razor @@ -12,7 +12,7 @@ @Localizer["Span1"]
- +
@@ -46,7 +46,7 @@ @Localizer["Span1"]
- +
@((MarkupString)Localizer["Div1"].Value)
@@ -61,7 +61,7 @@ @Localizer["Span2"]
- +
@@ -74,21 +74,21 @@

@((MarkupString)Localizer["P3"].Value)

- +

@((MarkupString)Localizer["P4"].Value)

- +

@((MarkupString)Localizer["P5"].Value)

- +
@@ -102,13 +102,13 @@

@((MarkupString)Localizer["P6"].Value)

- +
- +
@Localizer["Div2"]: @Model.Count.ToString("000")
@@ -146,19 +146,20 @@ @Localizer["Span1"]
- +
+

@((MarkupString)Localizer["TrimDescription"].Value)

@Localizer["Span1"]
- - 123@Model.Name456 + +
123@Model.Name456
-- Gitee From 68c284ccb80e428b67b48268fdcde2a6088930d2 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Sun, 20 Mar 2022 16:30:40 +0800 Subject: [PATCH 02/20] =?UTF-8?q?test:=20=E6=9B=B4=E6=96=B0=20IpAddress=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/IpAddress/IpAddress.razor.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/BootstrapBlazor/Components/IpAddress/IpAddress.razor.cs b/src/BootstrapBlazor/Components/IpAddress/IpAddress.razor.cs index 05a74bde7..470d04409 100644 --- a/src/BootstrapBlazor/Components/IpAddress/IpAddress.razor.cs +++ b/src/BootstrapBlazor/Components/IpAddress/IpAddress.razor.cs @@ -51,6 +51,7 @@ public partial class IpAddress Value3 = "0"; Value4 = "0"; } + UpdateValue(); } /// -- Gitee From b4b134b73505432f7e2c21e827f0d21e7616e21b Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Sun, 20 Mar 2022 16:32:55 +0800 Subject: [PATCH 03/20] =?UTF-8?q?feat:=20=E7=BB=84=E4=BB=B6=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=20ShowLabelTooltip=20=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Display/DisplayBase.cs | 6 ++++++ .../Components/EditorForm/EditorForm.razor.cs | 6 ++++++ .../Components/ValidateForm/ValidateForm.razor.cs | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/src/BootstrapBlazor/Components/Display/DisplayBase.cs b/src/BootstrapBlazor/Components/Display/DisplayBase.cs index 11f0033f3..fb2e86b92 100644 --- a/src/BootstrapBlazor/Components/Display/DisplayBase.cs +++ b/src/BootstrapBlazor/Components/Display/DisplayBase.cs @@ -56,6 +56,12 @@ public abstract class DisplayBase : TooltipComponentBase [Parameter] public bool? ShowLabel { get; set; } + /// + /// 获得/设置 是否显示标签 Tooltip 多用于标签文字过长导致裁减时使用 默认 false 始终不显示 + /// + [Parameter] + public bool ShowLabelTooltip { get; set; } + /// /// 获得/设置 显示名称 /// diff --git a/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs b/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs index 2a192dadd..cbec8640b 100644 --- a/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs +++ b/src/BootstrapBlazor/Components/EditorForm/EditorForm.razor.cs @@ -79,6 +79,12 @@ public sealed partial class EditorForm : IShowLabel [Parameter] public bool? ShowLabel { get; set; } + /// + /// 获得/设置 是否显示标签 Tooltip 多用于标签文字过长导致裁减时使用 默认 false 始终不显示 + /// + [Parameter] + public bool ShowLabelTooltip { get; set; } + /// /// 获得/设置 是否显示为 Display 组件 默认为 false /// diff --git a/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs b/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs index e06a0efb9..0b8cffc18 100644 --- a/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs +++ b/src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs @@ -75,6 +75,12 @@ public partial class ValidateForm : IAsyncDisposable [Parameter] public bool ShowLabel { get; set; } = true; + /// + /// 获得/设置 是否显示标签 Tooltip 多用于标签文字过长导致裁减时使用 默认 false 始终不显示 + /// + [Parameter] + public bool ShowLabelTooltip { get; set; } + [Inject] [NotNull] private IOptions? Options { get; set; } -- Gitee From 258ee5b1f0f11d3c03875959a2f3a86ea93fa8b5 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Sun, 20 Mar 2022 16:48:02 +0800 Subject: [PATCH 04/20] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Shared/Locales/en.json | 2 +- src/BootstrapBlazor.Shared/Locales/zh.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor.Shared/Locales/en.json b/src/BootstrapBlazor.Shared/Locales/en.json index 3606e1391..22738005e 100644 --- a/src/BootstrapBlazor.Shared/Locales/en.json +++ b/src/BootstrapBlazor.Shared/Locales/en.json @@ -1781,7 +1781,7 @@ "BasicUsageLi7": "Set the asynchronous submission form by setting the value of the Button Button property IsAsync", "BasicUsageLi8": "Components within a form are typically used to bind the property values of Model in both directions using bidirectional binding techniques, causing the component to refresh and re-render when its value changes StateHasChanged, and the method is called, i.e. its component or page is refreshed and re-rendered", "BasicUsageLi9": "After the value of the component control in the form is modified, the OnFieldChanged method is called", - "FormLabelWidth": "The default width of component front label is 120px. If you need more, please change the style variable --bs-row-label-width in the project style file", + "FormLabelWidth": "The default width of component front label is 120px. If you need more, please change the style variable --bs-row-label-width in the project style file or remove RowType.Inline", "BasicUsageP2": "Note:", "InnerComponentTitle": "Built-in components", "InnerComponentIntro": "Place the support form components into the ValidateForm", diff --git a/src/BootstrapBlazor.Shared/Locales/zh.json b/src/BootstrapBlazor.Shared/Locales/zh.json index e7998d292..81fff1950 100644 --- a/src/BootstrapBlazor.Shared/Locales/zh.json +++ b/src/BootstrapBlazor.Shared/Locales/zh.json @@ -1784,7 +1784,7 @@ "BasicUsageLi7": "通过设置提交按钮 Button 属性 IsAsync 值,设置异步提交表单", "BasicUsageLi8": "表单内组件通常用法都是使用双向绑定技术对 Model 的属性值进行双向绑定,当其值改变时会导致所在组件 StateHasChanged 方法被调用,即其所在组件或者页面进行刷新重新渲染", "BasicUsageLi9": "表单内组件控件的值修改后 OnFieldChanged 方法被调用", - "FormLabelWidth": "组件前置标签默认宽度为 120px 六个汉字,如需要更多汉字请在项目样式文件中更改样式变量 --bs-row-label-width 即可", + "FormLabelWidth": "组件前置标签默认宽度为 120px 六个汉字,如需要更多汉字请在项目样式文件中更改样式变量 --bs-row-label-width 即可,或者设置表单显示标签在组件上方", "BasicUsageP2": "注意事项:", "InnerComponentTitle": "内置组件", "InnerComponentIntro": "放置支持表单组件到 ValidateForm 中", -- Gitee From 15a3be7818ada522ea52a4b972f2893250ca9ed9 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Sun, 20 Mar 2022 17:00:16 +0800 Subject: [PATCH 05/20] =?UTF-8?q?refactor:=20=E7=B2=BE=E7=AE=80=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Utils/Utility.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Utils/Utility.cs b/src/BootstrapBlazor/Utils/Utility.cs index 5ee927b3e..6c6b77209 100644 --- a/src/BootstrapBlazor/Utils/Utility.cs +++ b/src/BootstrapBlazor/Utils/Utility.cs @@ -367,7 +367,7 @@ public static class Utility public static object GenerateValueExpression(object model, string fieldName, Type fieldType) { var type = model.GetType(); - return fieldName.Contains(".") ? ComplexPropertyValueExpression() : SimplePropertyValueExpression(); + return fieldName.Contains('.') ? ComplexPropertyValueExpression() : SimplePropertyValueExpression(); object SimplePropertyValueExpression() { -- Gitee From 73c4e6a2ed87559d7b03176de017d8123a29a315 Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Sun, 20 Mar 2022 17:28:39 +0800 Subject: [PATCH 06/20] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20BootstrapLab?= =?UTF-8?q?el=20=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Label/BootstrapLabel.js | 10 +++++ .../Components/Label/BootstrapLabel.min.js | 1 + .../Components/Label/BootstrapLabel.razor | 4 ++ .../Components/Label/BootstrapLabel.razor.cs | 39 +++++++++++++++++++ .../wwwroot/js/bootstrap.blazor.bundle.min.js | 2 +- .../wwwroot/js/bootstrap.blazor.min.js | 2 +- 6 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 src/BootstrapBlazor/Components/Label/BootstrapLabel.js create mode 100644 src/BootstrapBlazor/Components/Label/BootstrapLabel.min.js create mode 100644 src/BootstrapBlazor/Components/Label/BootstrapLabel.razor create mode 100644 src/BootstrapBlazor/Components/Label/BootstrapLabel.razor.cs diff --git a/src/BootstrapBlazor/Components/Label/BootstrapLabel.js b/src/BootstrapBlazor/Components/Label/BootstrapLabel.js new file mode 100644 index 000000000..4f4566d13 --- /dev/null +++ b/src/BootstrapBlazor/Components/Label/BootstrapLabel.js @@ -0,0 +1,10 @@ +(function ($) { + $.extend({ + bb_showLabelTooltip: function (el, title) { + var $el = $(el); + $el.tooltip({ + title + }); + } + }); +}(jQuery)); diff --git a/src/BootstrapBlazor/Components/Label/BootstrapLabel.min.js b/src/BootstrapBlazor/Components/Label/BootstrapLabel.min.js new file mode 100644 index 000000000..cbcea5501 --- /dev/null +++ b/src/BootstrapBlazor/Components/Label/BootstrapLabel.min.js @@ -0,0 +1 @@ +(function(e){var t=function(t){var n=this;t!==undefined?n.prevValues[t]=e(e(n).find(".ipv4-cell")[t]).val():e(n).find(".ipv4-cell").each(function(t,r){n.prevValues[t]=e(r).val()})},n=function(t){var n=this;t!==undefined?e(e(n).find(".ipv4-cell")[t]).val(n.prevValues[t]):e(n).find(".ipv4-cell").each(function(t,r){e(r).val(n.prevValues)})},r=function(t){var n=this;if(t===undefined&&t<0&&t>3)return;e(e(n).find(".ipv4-cell")[t]).focus()},i=function(e){if(typeof e!="string")return!1;var t=e.split(".");return t.length!==4?!1:t.reduce(function(e,t){return e===!1||t.length===0?!1:Number(t)>=0&&Number(t)<=255?!0:!1},!0)},s=function(){var t="";return this.find(".ipv4-cell").each(function(n,r){t+=n==0?e(r).val():"."+e(r).val()}),t},o=function(){var e=this;if("selectionStart"in e)return e.selectionStart;if(document.selection){e.focus();var t=document.selection.createRange(),n=document.selection.createRange().text.length;return t.moveStart("character",-e.value.length),t.text.length-n}throw new Error("cell is not an input")};e.fn.ipv4_input=function(u,a){this.each(function(){if(e(this).hasClass("ipv4-input"))return;var i=this;i.prevValues=[],e(i).toggleClass("ipv4-input",!0),e(i).html(''),e(this).find(".ipv4-cell").focus(function(){e(this).select(),e(i).toggleClass("selected",!0)}),e(this).find(".ipv4-cell").focusout(function(){e(i).toggleClass("selected",!1)}),e(this).find(".ipv4-cell").each(function(s,u){e(u).keydown(function(n){n.keyCode>=48&&n.keyCode<=57||n.keyCode>=96&&n.keyCode<=105?t.call(i,s):n.keyCode==37||n.keyCode==39?n.keyCode==37&&o.call(u)===0?(r.call(i,s-1),n.preventDefault()):n.keyCode==39&&o.call(u)===e(u).val().length&&(r.call(i,s+1),n.preventDefault()):n.keyCode!=9&&n.keyCode!=8&&n.keyCode!=46&&n.preventDefault()}),e(u).keyup(function(t){if(t.keyCode>=48&&t.keyCode<=57||t.keyCode>=96&&t.keyCode<=105){var o=e(this).val(),u=Number(o);u>255?n.call(i,s):o.length>1&&o[0]==="0"?n.call(i,s):o.length===3&&r.call(i,s+1)}})})});var f=function(t,n){t=="rwd"&&(n===undefined?this.toggleClass("rwd"):this.toggleClass("rwd",n));if(t=="value"){if(n===undefined)return s.call(this);if(!i(n))throw new Error("invalid ip address");var r=n.split(".");this.find(".ipv4-cell").each(function(t,n){e(n).val(r[t])})}return t=="valid"?i(s.call(this)):(t=="clear"&&this.find(".ipv4-cell").each(function(t,n){e(n).val("")}),this)},l=this;if(e.type(u)==="object"){var c=u;for(var h in c)f.call(this,h,u[h])}else l=f.call(this,u,a);return l}})(jQuery); \ No newline at end of file diff --git a/src/BootstrapBlazor/Components/Label/BootstrapLabel.razor b/src/BootstrapBlazor/Components/Label/BootstrapLabel.razor new file mode 100644 index 000000000..9f970878b --- /dev/null +++ b/src/BootstrapBlazor/Components/Label/BootstrapLabel.razor @@ -0,0 +1,4 @@ +@namespace BootstrapBlazor.Components +@inherits BootstrapComponentBase + + diff --git a/src/BootstrapBlazor/Components/Label/BootstrapLabel.razor.cs b/src/BootstrapBlazor/Components/Label/BootstrapLabel.razor.cs new file mode 100644 index 000000000..b6fbad42b --- /dev/null +++ b/src/BootstrapBlazor/Components/Label/BootstrapLabel.razor.cs @@ -0,0 +1,39 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Website: https://www.blazor.zone or https://argozhang.github.io/ + +using Microsoft.AspNetCore.Components; + +namespace BootstrapBlazor.Components; + +public partial class BootstrapLabel +{ + /// + /// 获得/设置 组件值 显示文本 默认 null + /// + [Parameter] + public string? Value { get; set; } + + /// + /// 获得/设置 是否显示标签 Tooltip 多用于标签文字过长导致裁减时使用 默认 false 始终不显示 + /// + [Parameter] + public bool ShowLabelTooltip { get; set; } + + private ElementReference LabelElement { get; set; } + + /// + /// OnAfterRender 方法 + /// + /// + protected override async Task OnAfterRenderAsync(bool firstRender) + { + if (firstRender) + { + if (ShowLabelTooltip && Value != null) + { + await JSRuntime.InvokeVoidAsync(LabelElement, "bb_showLabelTooltip", Value); + } + } + } +} diff --git a/src/BootstrapBlazor/wwwroot/js/bootstrap.blazor.bundle.min.js b/src/BootstrapBlazor/wwwroot/js/bootstrap.blazor.bundle.min.js index 3bf04f3b6..df103ab72 100644 --- a/src/BootstrapBlazor/wwwroot/js/bootstrap.blazor.bundle.min.js +++ b/src/BootstrapBlazor/wwwroot/js/bootstrap.blazor.bundle.min.js @@ -13,4 +13,4 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this /*! Summernote v0.8.18 | (c) 2013- Alan Hong and other contributors | MIT license */ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("jquery"));else if("function"==typeof define&&define.amd)define(["jquery"],e);else{var n="object"==typeof exports?e(require("jquery")):e(t.jQuery);for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(self,(function(t){return(()=>{"use strict";var e={9458:e=>{e.exports=t}},n={};function o(t){var i=n[t];if(void 0!==i)return i.exports;var r=n[t]={exports:{}};return e[t](r,r.exports,o),r.exports}o.amdO={},o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{o.r(i);var t=o(9458),e=o.n(t);function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){for(var n=0;n'),u=s('