From 13c3b673a56f66fe7e7092f135ede814b5aa4869 Mon Sep 17 00:00:00 2001 From: Argo-Cloud Date: Sat, 20 Mar 2021 01:06:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Tab=20=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=9C=A8=E5=BC=B9=E7=AA=97=E4=B8=AD=20active=20?= =?UTF-8?q?=E8=93=9D=E6=9D=A1=E5=88=9D=E5=A7=8B=E5=8C=96=E4=B8=8D=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Tab/Tab.razor.cs.js | 8 +++++++- src/BootstrapBlazor/Components/Tab/Tab.razor.cs.min.js | 2 +- .../wwwroot/js/bootstrap.blazor.bundle.min.js | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/BootstrapBlazor/Components/Tab/Tab.razor.cs.js b/src/BootstrapBlazor/Components/Tab/Tab.razor.cs.js index a822da1bd..a8289a5ee 100644 --- a/src/BootstrapBlazor/Components/Tab/Tab.razor.cs.js +++ b/src/BootstrapBlazor/Components/Tab/Tab.razor.cs.js @@ -1,7 +1,13 @@ (function ($) { $.extend({ bb_tab: function (el) { - $(el).tab('active'); + var $el = $(el); + var handler = window.setInterval(function () { + if ($el.is(':visible')) { + window.clearInterval(handler); + $el.tab('active'); + } + }, 200); } }); })(jQuery); diff --git a/src/BootstrapBlazor/Components/Tab/Tab.razor.cs.min.js b/src/BootstrapBlazor/Components/Tab/Tab.razor.cs.min.js index c7fd64c0a..f37536177 100644 --- a/src/BootstrapBlazor/Components/Tab/Tab.razor.cs.min.js +++ b/src/BootstrapBlazor/Components/Tab/Tab.razor.cs.min.js @@ -1 +1 @@ -(function(n){n.extend({bb_tab:function(t){n(t).tab("active")}})})(jQuery); \ No newline at end of file +(function(n){n.extend({bb_tab:function(t){var i=n(t),r=window.setInterval(function(){i.is(":visible")&&(window.clearInterval(r),i.tab("active"))},200)}})})(jQuery); \ No newline at end of file diff --git a/src/BootstrapBlazor/wwwroot/js/bootstrap.blazor.bundle.min.js b/src/BootstrapBlazor/wwwroot/js/bootstrap.blazor.bundle.min.js index af91ca91c..6ffe58b58 100644 --- a/src/BootstrapBlazor/wwwroot/js/bootstrap.blazor.bundle.min.js +++ b/src/BootstrapBlazor/wwwroot/js/bootstrap.blazor.bundle.min.js @@ -67,7 +67,7 @@ var QRCode;!function(){function a(a){this.mode=c.MODE_8BIT_BYTE,this.data=a,this (function(n){n.extend({bb_multi_select:function(t,i,r){n(t).data("bb_multi_select",{obj:i,method:r})}});n(function(){n(document).on("click",function(t){var r=n(t.target),i=r.closest(".multi-select");n(".multi-select.show").each(function(){if(i.length===0||this!=i[0]){var t=n(this).data("bb_multi_select");t.obj.invokeMethodAsync(t.method)}})})})})(jQuery); (function(n){n.extend({slider:function(t,i,r){var f=n(t),s=f.find(".disabled").length>0;if(!s){var e=0,o=0,u=0,h=f.innerWidth();f.find(".slider-button-wrapper").drag(function(n){e=n.clientX||n.touches[0].clientX;o=parseInt(f.attr("aria-valuetext"));f.find(".slider-button-wrapper, .slider-button").addClass("dragging")},function(n){var t=n.clientX||n.changedTouches[0].clientX;u=Math.ceil((t-e)*100/h)+o;u<=0&&(u=0);u>=100&&(u=100);f.find(".slider-bar").css({width:u.toString()+"%"});f.find(".slider-button-wrapper").css({left:u.toString()+"%"});f.attr("aria-valuetext",u.toString());i.invokeMethodAsync(r,u)},function(){f.find(".slider-button-wrapper, .slider-button").removeClass("dragging");i.invokeMethodAsync(r,u)})}}})})(jQuery); (function(n){n.extend({bb_split:function(t){var i=n(t),f=i.innerWidth(),e=i.innerHeight(),u=0,r=0,o=0,s=0,h=!i.children().hasClass("is-horizontal");i.children().children(".split-bar").drag(function(n){h?(s=n.clientY||n.touches[0].clientY,u=i.children().children(".split-left").innerHeight()*100/e):(o=n.clientX||n.touches[0].clientX,u=i.children().children(".split-left").innerWidth()*100/f);i.toggleClass("dragging")},function(n){var t,c;h?(t=n.clientY||n.changedTouches[0].clientY,r=Math.ceil((t-s)*100/e)+u):(c=n.clientX||n.changedTouches[0].clientX,r=Math.ceil((c-o)*100/f)+u);r<=0&&(r=0);r>=100&&(r=100);i.children().children(".split-left").css({"flex-basis":r.toString()+"%"});i.children().children(".split-right").css({"flex-basis":(100-r).toString()+"%"});i.attr("data-split",r)},function(){i.toggleClass("dragging")})}})})(jQuery); -(function(n){n.extend({bb_tab:function(t){n(t).tab("active")}})})(jQuery); +(function(n){n.extend({bb_tab:function(t){var i=n(t),r=window.setInterval(function(){i.is(":visible")&&(window.clearInterval(r),i.tab("active"))},200)}})})(jQuery); (function(){$.extend({bb_table_search:function(n,t,i,r){$(n).data("bb_table_search",{obj:t,searchMethod:i,clearSearchMethod:r})},bb_table_resize:function(n){var r=n.find(".col-resizer");if(r.length>0){var u=function(n){var r=$(this),t=r.closest("th");n?t.addClass("border-resize"):t.removeClass("border-resize");var i=t.index(),u=t.closest(".table-resize").find("tbody"),f=u.find("tr").each(function(){var t=$(this.children[i]);n?t.addClass("border-resize"):t.removeClass("border-resize")});return i},t=0,f=0,i=0,e=0;r.each(function(){$(this).drag(function(r){i=u.call(this,!0);var o=n.find("table colgroup col")[i].width;t=o?parseInt(o):$(this).closest("th").width();f=$(this).closest("table").width();e=r.clientX},function(r){n.find("table colgroup").each(function(n,u){var s=$(u).find("col")[i],o=r.clientX-e;s.width=t+o;n===0&&$(u).closest("table").width(f+o)})},function(){u.call(this,!1)})})}},bb_table_load:function(n,t){var r=$(n),i=r.find(".table-loader");t==="show"?i.addClass("show"):i.removeClass("show")},bb_table:function(n,t,i){var r=$(n),v=function(){r.find(".is-tips").tooltip({container:"body",title:function(){return $(this).text()}})},y,s,o,u,f,h,e,c,l,a,p;if(t==="fixTableHeader"){y=r.find(".table-fixed-header");s=r.find(".table-fixed-body");s.on("scroll",function(){var n=s.scrollLeft();y.scrollLeft(n)});if(o=r.find(".fixed-scroll"),o.length===1){for(u=o.prev();u.length===1;)if(u.hasClass("fixed-right")&&!u.hasClass("modified"))f=u.css("right"),f=f.replace("px",""),$.browser.versions.mac?f=parseFloat(f)-2+"px":$.browser.versions.mobile&&(f=parseFloat(f)-17+"px"),u.css({right:f}).addClass("modified"),u=u.prev();else break;$.browser.versions.mobile&&o.remove()}r.find(".col-resizer:last").remove();$.bb_table_resize(r)}else if(t==="init"){h=r.find(".table-cell.is-sort .table-text");e={unset:"点击升序",sortAsc:"点击降序",sortDesc:"取消排序"};h.each(function(){var t=$(this).parent().find(".fa:last"),n;t.length>0&&(n=e.unset,t.hasClass("fa-sort-asc")?n=e.sortAsc:t.hasClass("fa-sort-desc")&&(n=e.sortDesc),$(this).tooltip({container:"body",title:n}))});h.on("click",function(){var t=$(this),r=t.parent().find(".fa:last"),n="sortAsc",i,u;r.hasClass("fa-sort-asc")?n="sortDesc":r.hasClass("fa-sort-desc")&&(n="unset");i=$("#"+t.attr("aria-describedby"));i.length>0&&(u=i.find(".tooltip-inner"),u.html(e[n]),t.attr("data-original-title",e[n]))});c=r.find(".table-toolbar");l=0;c.length>0&&(l=c.height());a=function(){var o=$(this).position(),s=$(this).attr("data-field"),i=r.find('.table-filter-item[data-field="'+s+'"]'),n=$(this).closest("th"),f=n.outerWidth()+n.position().left-i.outerWidth()/2,t=0,e,u;n.hasClass("sortable")&&(t=24);n.hasClass("filterable")&&(t=t+12);e=n.closest("table").parent().scrollLeft();u=n.offset().left+n.outerWidth()-t+i.outerWidth()/2-$(window).width();t=t+e;u>0&&(f=f-u-16,$arrow=i.find(".card-arrow"),$arrow.css({left:"calc(50% - 0.5rem + "+(u+16)+"px)"}));i.css({top:o.top+l+50,left:f-t})};r.find(".filterable .fa-filter").on("click",function(){a.call(this)});v();r.children(".table-scroll").scroll(function(){r.find(".table-filter-item.show").each(function(){var n=$(this).attr("data-field"),t=r.find('.fa-filter[data-field="'+n+'"]')[0];a.call(t)})});$.bb_table_resize(r)}else{if(t==="width")return p=0,i?r.outerWidth(!0):$(window).outerWidth(!0);t==="tooltip"&&v()}}});$(function(){$(document).on("keyup",function(n){var i,t;n.key==="Enter"?(i=$(n.target).closest(".table-container"),t=i.data("bb_table_search"),t&&t.obj.invokeMethodAsync(t.searchMethod)):n.key==="Escape"&&(i=$(n.target).closest(".table-container"),t=i.data("bb_table_search"),t&&t.obj.invokeMethodAsync(t.clearSearchMethod))})})})(jQuery); (function(n){n.extend({bb_filter:function(t,i,r){n(t).data("bb_filter",{obj:i,method:r})}});n(function(){n(document).on("click",function(t){var i=n(t.target),r=i.closest(".popover-datetime"),u,f,e;r.length==1&&(u=r.attr("id"),f=n('[aria-describedby="'+u+'"]'),f.closest(".datetime-picker").hasClass("is-filter"))||(e=i.closest(".table-filter-item"),e.length==0&&n(".table-filter-item.show").each(function(){var t=n(this).data("bb_filter");t.obj.invokeMethodAsync(t.method)}))});n(document).on("keyup",function(t){var i,r;t.key==="Enter"?(i=n(".table-filter .table-filter-item.show:first"),r=i.data("bb_filter"),r&&(i.removeClass("show"),r.obj.invokeMethodAsync("ConfirmByKey"))):t.key==="Escape"&&(i=n(".table-filter .table-filter-item.show:first"),r=i.data("bb_filter"),r&&(i.removeClass("show"),r.obj.invokeMethodAsync("EscByKey")))})})})(jQuery); (function(n){n.extend({bb_toast:function(t,i,r){var f,o;window.Toasts===undefined&&(window.Toasts=[]);Toasts.push(t);var u=n(t),s=u.attr("data-autohide")!=="false",e=parseInt(u.attr("data-delay"));u.addClass("d-block");f=null;o=window.setTimeout(function(){window.clearTimeout(o);s&&(u.find(".toast-progress").css({width:"100%",transition:"width "+e/1e3+"s linear"}),f=window.setTimeout(function(){window.clearTimeout(f);u.find(".close").trigger("click")},e));u.addClass("show")},50);u.on("click",".close",function(n){n.preventDefault();n.stopPropagation();f!=null&&window.clearTimeout(f);u.removeClass("show");var t=window.setTimeout(function(){window.clearTimeout(t);u.removeClass("d-block");Toasts.remove(u[0]);Toasts.length===0&&i.invokeMethodAsync(r)},500)})}})})(jQuery); -- Gitee