0){i.find(":text, :checkbox, :radio").each(function(t,i){var r=n(i),u=r.attr("id");u||r.attr("id",n.getUID())});var e=i.html(),r=n("body").addClass("bb-printview-open"),u=n("<\/div>").addClass("bb-printview").html(e).appendTo(r);u.find(":input").each(function(t,i){var r=n(i),u=r.attr("id");r.attr("type")==="checkbox"?r.prop("checked",n("#"+u).prop("checked")):r.val(n("#"+u).val())});window.setTimeout(function(){window.print();r.removeClass("bb-printview-open");u.remove()},50)}else window.setTimeout(function(){window.print()},50)}})}(jQuery),function(n){n.extend({bb_reconnect:function(){var t=window.setInterval(function(){var i=n("#components-reconnect-modal"),r;if(i.length>0&&(r=i.attr("class"),r==="components-reconnect-show")){window.clearInterval(t);async function n(){await fetch("");location.reload()}n();setInterval(n,5e3)}},2e3)}})}(jQuery),function(n){n.extend({bb_resize_monitor:function(t,i){var r=n.bb_get_responsive(),u=function(){var u=r;r=n.bb_get_responsive();u!==r&&(u=r,t.invokeMethodAsync(i,r))};return window.attachEvent?window.attachEvent("onresize",u):window.addEventListener&&window.addEventListener("resize",u,!0),r},bb_get_responsive:function(){return window.getComputedStyle(document.body,":before").content.replace(/\"/g,"")}})}(jQuery),function(n){n.extend({bb_ribbon:function(n,t,i){window.bb_ribbons===undefined&&(window.bb_ribbons={});window.bb_ribbons[n]={obj:t,method:i}}});n(function(){n(document).on("click",function(t){var u=n(t.target),i=n(".ribbon-tab"),r;i.hasClass("is-expand")&&(r=u.closest(".ribbon-tab").length===0,r&&i.toArray().forEach(function(n){var i=n.id,t;i&&(t=window.bb_ribbons[i],t&&t.obj.invokeMethodAsync(t.method))}))})})}(jQuery),function(n){n.extend({bb_row:function(t){var i=n(t);i.grid()}})}(jQuery),function(n){n.extend({bb_slider:function(t,i,r){var f=n(t),h=f.find(".disabled").length>0;if(!h){var e=0,o=0,u=0,s=f.innerWidth();f.find(".slider-button-wrapper").drag(function(n){s=f.innerWidth();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/s)+o;isNaN(u)&&(u=0);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){f=i.innerWidth();e=i.innerHeight();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){var i=n(t),r=window.setInterval(function(){i.is(":visible")&&(window.clearInterval(r),i.lgbTab("active"))},200)}})}(jQuery),function(n){n.extend({bb_table_search:function(t,i,r,u){n(t).data("bb_table_search",{obj:i,searchMethod:r,clearSearchMethod:u})},bb_table_row_hover:function(t){var i=t.find(".table-excel-toolbar"),r=t.find("tbody > tr").each(function(t,r){n(r).hover(function(){var t=n(this).position().top;i.css({top:t+"px",display:"block"})},function(){i.css({top:top+"px",display:"none"})})})},bb_table_resize:function(t){var u=t.find(".col-resizer");if(u.length>0){var f=function(t){var u=n(this),i=u.closest("th");t?i.addClass("border-resize"):i.removeClass("border-resize");var r=i.index(),f=i.closest(".table-resize").find("tbody"),e=f.find("tr").each(function(){var i=n(this.children[r]);t?i.addClass("border-resize"):i.removeClass("border-resize")});return r},i=0,e=0,r=0,o=0;u.each(function(){n(this).drag(function(u){r=f.call(this,!0);var s=t.find("table colgroup col")[r].width;i=s?parseInt(s):n(this).closest("th").width();e=n(this).closest("table").width();o=u.clientX},function(u){t.find("table colgroup").each(function(t,f){var l=n(f).find("col")[r],c=u.clientX-o,s,h;l.width=i+c;s=n(f).closest("table");h=e+c;s.parent().hasClass("table-fixed-header")?s.width(h):f.parentNode.style.width=h-6+"px"})},function(){f.call(this,!1)})})}},bb_table_load:function(t,i){var u=n(t),r=u.find(".table-loader");i==="show"?r.addClass("show"):r.removeClass("show")},bb_table_filter_calc:function(t){var c=t.find(".table-toolbar"),l=0,h,e,u;c.length>0&&(l=c.outerHeight(!0));var o=n(this),a=o.position(),v=o.attr("data-field"),f=t.find('.table-filter-item[data-field="'+v+'"]'),i=o.closest("th"),y=i.closest("thead"),p=y.outerHeight(!0)-i.outerHeight(!0),s=i.outerWidth(!0)+i.position().left-f.outerWidth(!0)/2,r=0,w=i.hasClass("fixed");i.hasClass("sortable")&&(r=24);i.hasClass("filterable")&&(r=r+12);h=0;w||(h=i.closest("table").parent().scrollLeft());e=i.offset().left+i.outerWidth(!0)-r+f.outerWidth(!0)/2-n(window).width();r=r+h;e>0&&(s=s-e-16,$arrow=f.find(".card-arrow"),$arrow.css({left:"calc(50% - 0.5rem + "+(e+16)+"px)"}));u=t.find(".table-search").outerHeight(!0);u===undefined?u=0:u+=8;f.css({top:a.top+l+p+u+50,left:s-r})},bb_table_filter:function(t){t.on("click",".filterable .fa-filter",function(){n.bb_table_filter_calc.call(this,t)})},bb_table_getCaretPosition:function(n){var t=-1,i=n.selectionStart,r=n.selectionEnd;return i==r&&(i==n.value.length?t=1:i==0&&(t=0)),t},bb_table_excel_keybord:function(t){var f=t.find(".table-excel").length>0;if(f){var i={TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESCAPE:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT_ARROW:37,UP_ARROW:38,RIGHT_ARROW:39,DOWN_ARROW:40},e=function(n){var t=window.setTimeout(function(){window.clearTimeout(t);n.focus();n.select()},10)},r=function(t,i){var r=!1,f=t[i],u=n(f).find("input.form-control:not([readonly]");return u.length>0&&(e(u),r=!0),r},u=function(n,t){var o=n.closest("td"),e=o.closest("tr"),u=e.children("td"),f=u.index(o);if(t==i.LEFT_ARROW){while(f-->0)if(r(u,f))break}else if(t==i.RIGHT_ARROW){while(f++0&&(u>0&&(h=i.parent().css("height"),t.find(".table-search-collapse").each(function(){n(this).data("fixed-height",h)})),i.parent().css({height:"calc(100% - "+e+"px)"}));o=r.outerHeight(!0);o>0&&i.css({height:"calc(100% - "+o+"px)"})},bb_table:function(t,i,r,u){var f=window.setInterval(function(){var e=n(t).find(".table");e.length!==0&&(window.clearInterval(f),n.bb_table_init(t,i,r,u))},100)},bb_table_init:function(t,i,r,u){var f=n(t),l=f.find(".table-fixed").length>0,a,h,c,e,o,v,s;if(l){a=f.find(".table-fixed-header");h=f.find(".table-fixed-body");h.on("scroll",function(){var n=h.scrollLeft();a.scrollLeft(n)});if(c=f.find(".fixed-scroll"),c.length===1){for(e=c.prev();e.length===1;)if(e.hasClass("fixed-right")&&!e.hasClass("modified"))o=e.css("right"),o=o.replace("px",""),n.browser.versions.mobile&&(o=parseFloat(o)-6+"px"),e.css({right:o}).addClass("modified"),e=e.prev();else break;n.browser.versions.mobile&&c.remove()}n.bb_table_fixedbody(f,h,a);f.find(".col-resizer:last").remove()}v=f.find(".table-cell.is-sort .table-text");s=u;v.each(function(){var i=n(this).parent().find(".fa:last"),t;i.length>0&&(t=s.unset,i.hasClass("fa-sort-asc")?t=s.sortAsc:i.hasClass("fa-sort-desc")&&(t=s.sortDesc),n(this).tooltip({container:"body",title:t}))});v.on("click",function(){var i=n(this),u=i.parent().find(".fa:last"),t="sortAsc",r,f;u.hasClass("fa-sort-asc")?t="sortDesc":u.hasClass("fa-sort-desc")&&(t="unset");r=n("#"+i.attr("aria-describedby"));r.length>0&&(f=r.find(".tooltip-inner"),f.html(s[t]),i.attr("data-original-title",s[t]))});f.children(".table-scroll").scroll(function(){f.find(".table-filter-item.show").each(function(){var t=n(this).attr("data-field"),i=f.find('.fa-filter[data-field="'+t+'"]')[0];n.bb_table_filter_calc.call(i,f)})});n.bb_table_row_hover(f);n.bb_table_filter(f);n.bb_table_resize(f);n.bb_table_excel_keybord(f);f.on("click",".table-search-collapse",function(){var i=n(this).toggleClass("is-open"),t=i.closest(".card").find(".card-body");t.length===1&&(t.is(":hidden")&&(l&&f.find(".table-fixed-body").parent().css({height:i.data("fixed-height")}),t.parent().toggleClass("collapsed")),t.slideToggle("fade",function(){var t=n(this);t.is(":hidden")&&t.parent().toggleClass("collapsed");l&&n.bb_table_fixedbody(f)}))})}});n(function(){n(document).on("keyup",function(t){var r,i;t.key==="Enter"?(r=n(t.target).closest(".table-container"),i=r.data("bb_table_search"),i&&i.obj.invokeMethodAsync(i.searchMethod)):t.key==="Escape"&&(r=n(t.target).closest(".table-container"),i=r.data("bb_table_search"),i&&i.obj.invokeMethodAsync(i.clearSearchMethod))});n(document).on("click",function(t){var i=n(t.target),u=i.closest(".dropdown-menu.show"),r;u.length>0||(r=i.closest(".btn-col"),r.length>0)||n(".table-toolbar > .btn-group > .btn-col > .dropdown-toggle.show").each(function(t,i){n(i).trigger("click")})})})}(jQuery),function(n){n.extend({bb_setTitle:function(n){document.title=n}})}(jQuery),function(n){n.extend({bb_toast_close:function(t){var i=n(t);i.find(".btn-close").trigger("click")},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-bs-autohide")!=="false",e=parseInt(u.attr("data-bs-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(".btn-close").trigger("click")},e));u.addClass("show")},50);u.on("click",".btn-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),function(n){n.extend({bb_transition:function(t,i,r){n(t).on("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oAnimationEnd",function(){i.invokeMethodAsync(r)})}})}(jQuery),function(n){n.extend({bb_tree:function(t){var i=n(t);i.find(".tree-content").hover(function(){n(this).parent().addClass("hover")},function(){n(this).parent().removeClass("hover")});i.on("click",".tree-node",function(){var i=n(this),r=i.prev(),t=r.find('[type="radio"]');t.attr("disabeld")!=="disabled"&&t.trigger("click")})}})}(jQuery),function(n){n.extend({bb_tree_view:function(t){var i=n(t);i.find(".tree-content").hover(function(){n(this).parent().addClass("hover")},function(){n(this).parent().removeClass("hover")});i.on("click",".tree-node",function(){var i=n(this),r=i.prev(),t=r.find('[type="radio"]');t.attr("disabeld")!=="disabled"&&t.trigger("click")})}})}(jQuery),function(n){n.extend({bb_form:function(t){var i=n("#"+t);i.find("[aria-describedby]").each(function(t,i){var u=bootstrap.Tooltip.getInstance(i),r;u&&(r=n(i),r.tooltip("dispose"))})}})}(jQuery);
\ No newline at end of file
diff --git a/src/BootstrapBlazor/wwwroot/lib/extensions/longbow.component.js b/src/BootstrapBlazor/wwwroot/lib/extensions/longbow.component.js
index 16d8a3412f0e23b06b324ebed60740667eaca49d..9eb700ff1cc2b02d23adbfac30d41565c0f7c2bd 100644
--- a/src/BootstrapBlazor/wwwroot/lib/extensions/longbow.component.js
+++ b/src/BootstrapBlazor/wwwroot/lib/extensions/longbow.component.js
@@ -111,117 +111,6 @@
}
}
- /* Confirm */
- const NAME$Confirm = 'Confirm';
-
- class Confirm extends BaseComponent {
- constructor(element, config) {
- super(element, config);
-
- this._id = element.getAttribute('id');
- }
-
- _getPopoverBodyElement() {
- return document.querySelector(`[data-bs-target="${this._id}"]`);
- }
-
- _setListeners() {
- this._show = () => {
- const disabled = this._isDisabled();
- if (disabled) {
- event.preventDefault();
- } else {
- this._element.classList.add('show');
- }
-
- };
-
- this._inserted = () => {
- const body = this._getPopoverBodyElement();
- const dorpdown = Utility.getDescribedElement(this._element);
- dorpdown.append(body);
- };
-
- this._hide = () => {
- const body = this._getPopoverBodyElement();
- if (body) {
- const container = document.querySelector(this._config.confirm_container);
- container.append(body);
- }
-
- const dropdown = Utility.getDescribedElement(this._element);
- if (dropdown) {
- dropdown.classList.remove('show');
- }
-
- this._element.classList.remove('show');
- }
-
- bootstrap.EventHandler.on(this._element, 'show.bs.popover', this._show);
- bootstrap.EventHandler.on(this._element, 'inserted.bs.popover', this._inserted);
- bootstrap.EventHandler.on(this._element, 'hide.bs.popover', this._hide);
-
- if (this._config.dismiss != null) {
- bootstrap.EventHandler.one(document, 'click', this._config.dismiss, this._hide);
- }
- }
-
- dispose() {
- if (this._config.dismiss != null) {
- bootstrap.EventHandler.off(document, 'click', this._config.dismiss, this._hide);
- }
- super.dispose();
- }
-
- static _create(element) {
- let p = new bb.Confirm(element);
- p.show();
- }
-
- static init(element) {
- element = getElement(element);
- let p = Confirm.getInstance(element);
- if (p !== null && p._isShown()) {
- p.hide();
-
- const duration = getTransitionDurationFromElement(element, 15);
- let handler = window.setTimeout(() => {
- window.clearTimeout(handler);
- p.dispose();
-
- Confirm._create(element);
- }, duration);
- } else {
- Confirm._create(element);
- }
- }
-
- static submit(element) {
- element = getElement(element)
- const form = element.closest('form');
- if (form !== null) {
- const button = document.createElement('button');
- button.setAttribute('type', 'submit');
- button.setAttribute('hidden', 'true');
- form.append(button);
- button.click();
- button.remove();
- }
- }
-
- static get Default() {
- return {
- class: 'popover-confirm',
- dismiss: '[data-bb-dismiss]',
- confirm_container: '.popover-confirm-container'
- }
- }
-
- static get NAME() {
- return NAME$Confirm;
- }
- }
-
// bootstrap.EventHandler.on(document, 'click', function (e) {
// const el = e.target;
// if (el.closest(`.${Confirm.Default.class}.show`) === null && el.closest(`${Confirm.Default.confirm_container}`) === null) {
@@ -603,7 +492,6 @@
return {
AutoRedirect,
Carousel,
- Confirm,
Utility
};
});
diff --git a/src/BootstrapBlazor/wwwroot/modules/base/base-dropdown.js b/src/BootstrapBlazor/wwwroot/modules/base/base-dropdown.js
index 43ac80c13e47385d38cb21f3ecbcccc560bdfdca..be2abb8a8c9d47fa8e85d90472791954d4b2c629 100644
--- a/src/BootstrapBlazor/wwwroot/modules/base/base-dropdown.js
+++ b/src/BootstrapBlazor/wwwroot/modules/base/base-dropdown.js
@@ -100,30 +100,15 @@ export class DropdownBase extends BlazorComponent {
EventHandler.on(this._element, 'click', this._config.toggleClass, active)
EventHandler.on(this._toggleMenu, 'click', '.dropdown-item', () => this.hide())
- if (!window.bb_select) {
- window.bb_select = true
+ if (!window.bb_dropdown) {
+ window.bb_dropdown = true
- console.log(window.bb_select)
+ console.log('dropdown')
EventHandler.on(document, 'click', closePopover);
}
}
}
- _hackPopover() {
- this._popover._isWithContent = () => true
-
- const getTipElement = this._popover._getTipElement
- let fn = tip => {
- tip.classList.add(this._config.class)
- tip.classList.add('shadow')
- }
- this._popover._getTipElement = () => {
- let tip = getTipElement.call(this._popover)
- fn(tip)
- return tip
- }
- }
-
_isDisabled() {
return isDisabled(this._element) || isDisabled(this._element.parentNode) || isDisabled(this._element.querySelector('.form-control'))
}
diff --git a/src/BootstrapBlazor/wwwroot/modules/base/blazor-component.js b/src/BootstrapBlazor/wwwroot/modules/base/blazor-component.js
index ba203601b448d25da2b3ac72d44724c23bd35ad8..e6b68e15449cf9e547f9edf1ceefce94233ad7be 100644
--- a/src/BootstrapBlazor/wwwroot/modules/base/blazor-component.js
+++ b/src/BootstrapBlazor/wwwroot/modules/base/blazor-component.js
@@ -23,6 +23,23 @@ class BlazorComponent extends BaseComponent {
}
+ _hackPopover() {
+ if(this._popover) {
+ this._popover._isWithContent = () => true
+
+ const getTipElement = this._popover._getTipElement
+ let fn = tip => {
+ tip.classList.add(this._config.class)
+ tip.classList.add('shadow')
+ }
+ this._popover._getTipElement = () => {
+ let tip = getTipElement.call(this._popover)
+ fn(tip)
+ return tip
+ }
+ }
+ }
+
_dispose() {
}
diff --git a/src/BootstrapBlazor/wwwroot/modules/base/data.js b/src/BootstrapBlazor/wwwroot/modules/base/data.js
index 10b7b84691b32eed8811a412e702f86650baa3ec..c70ef93dd75836b1bd02726a84736fa742cec516 100644
--- a/src/BootstrapBlazor/wwwroot/modules/base/data.js
+++ b/src/BootstrapBlazor/wwwroot/modules/base/data.js
@@ -21,13 +21,14 @@ export default {
// make it clear we only want one instance per element
// can be removed later when multiple key/instances are fine to be used
- if (!instanceMap.has(key) && instanceMap.size !== 0) {
- // eslint-disable-next-line no-console
- console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`)
- return
+ //if (!instanceMap.has(key) && instanceMap.size !== 0) {
+ // // eslint-disable-next-line no-console
+ // console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`)
+ // return
+ //}
+ if (!instanceMap.has(key)) {
+ instanceMap.set(key, instance)
}
-
- instanceMap.set(key, instance)
},
get(element, key) {
diff --git a/src/BootstrapBlazor/wwwroot/modules/button.js b/src/BootstrapBlazor/wwwroot/modules/button.js
new file mode 100644
index 0000000000000000000000000000000000000000..3aa296b4459ce4315e3c232565a0038e226c833d
--- /dev/null
+++ b/src/BootstrapBlazor/wwwroot/modules/button.js
@@ -0,0 +1,38 @@
+import BlazorComponent from "./base/blazor-component.js"
+import { Confirm } from "./confirm.js";
+
+export class Button extends BlazorComponent {
+ _execute(args) {
+ const method = args[0]
+ if (method === 'showTooltip') {
+ const title = args[1]
+ bootstrap.Tooltip.getOrCreateInstance(this._element, {
+ title: title
+ })
+ }
+ else if (method === 'removeTooltip') {
+ const tooltip = bootstrap.Tooltip.getInstance(this._element)
+ if (tooltip) {
+ tooltip.dispose()
+ }
+ }
+ else if (method === 'showConfirm') {
+ let confirm = Confirm.getInstance(this._element)
+ if (!confirm) {
+ confirm = new Confirm(this._element)
+ confirm.toggle()
+ }
+ }
+ else if (method === 'submit') {
+ const form = this._element.closest('form');
+ if (form !== null) {
+ const button = document.createElement('button');
+ button.setAttribute('type', 'submit');
+ button.setAttribute('hidden', 'true');
+ form.append(button);
+ button.click();
+ button.remove();
+ }
+ }
+ }
+}
diff --git a/src/BootstrapBlazor/wwwroot/modules/confirm.js b/src/BootstrapBlazor/wwwroot/modules/confirm.js
new file mode 100644
index 0000000000000000000000000000000000000000..5f2c831879aea4bb5d118ab67f03f044734ad8fc
--- /dev/null
+++ b/src/BootstrapBlazor/wwwroot/modules/confirm.js
@@ -0,0 +1,108 @@
+import BlazorComponent from "./base/blazor-component.js"
+import EventHandler from "./base/event-handler.js";
+import { isDisabled } from "./base/index.js"
+import { getDescribedElement, getDescribedOwner } from "./base/utility.js"
+
+export class Confirm extends BlazorComponent {
+ static get Default() {
+ return {
+ class: 'popover-confirm',
+ dismiss: '.popover-confirm-buttons > div',
+ popoverSelector: '.popover-confirm.show',
+ container: '[data-bb-toggle="confirm"]'
+ }
+ }
+
+ _init() {
+ this._popover = bootstrap.Popover.getOrCreateInstance(this._element)
+ this._hackPopover()
+ this._id = this._element.getAttribute("id")
+ this._container = this._element.querySelector(this._config.container)
+ this._setListeners()
+ }
+
+ _setListeners() {
+ this._show = e => {
+ const disabled = isDisabled(this._element);
+ if (disabled) {
+ e.preventDefault()
+ }
+ }
+
+ this._inserted = () => {
+ const popover = getDescribedElement(this._element)
+
+ const children = this._container.children
+ const len = children.length
+ for (let i = 0; i < len; i++) {
+ popover.appendChild(children[0])
+ }
+ }
+
+ this._hide = () => {
+ const popover = getDescribedElement(this._element)
+ popover.classList.remove('show')
+
+ const children = popover.children
+ const len = children.length
+ for (let i = 1; i < len; i++) {
+ this._container.appendChild(children[1])
+ }
+ }
+
+ EventHandler.on(this._element, 'show.bs.popover', this._show)
+ EventHandler.on(this._element, 'inserted.bs.popover', this._inserted)
+ EventHandler.on(this._element, 'hide.bs.popover', this._hide)
+
+ if (this._config.dismiss != null) {
+ EventHandler.on(document, 'click', this._config.dismiss, () => this._popover.hide())
+ }
+
+ this._checkCancel = el => {
+ // check button
+ let self = el === this._element || el.closest('.dropdown-toggle') === this._element
+ self = self && this._popover._isShown()
+
+ // check popover
+ self = self || el.closest(this._config.popoverSelector)
+ return self
+ }
+
+ this._closeConfirm = e => {
+ const el = e.target
+ if (!this._checkCancel(el)) {
+ document.querySelectorAll(this._config.popoverSelector).forEach(function (ele) {
+ const element = getDescribedOwner(ele)
+ if (element) {
+ const popover = bootstrap.Popover.getInstance(element);
+ if (popover) {
+ popover.hide()
+ }
+ }
+ })
+ }
+ }
+
+ if (!window.bb_confirm) {
+ window.bb_confirm = true
+
+ console.log('confirm')
+ EventHandler.on(document, 'click', this._closeConfirm);
+ }
+ }
+
+ toggle() {
+ if (this._popover) {
+ this._popover.toggle()
+ }
+ }
+
+ _dispose() {
+ if (this._popover) {
+ this._popover.dispose()
+ }
+ if (this._config.dismiss != null) {
+ EventHandler.off(document, 'click', this._config.dismiss)
+ }
+ }
+}
diff --git a/src/BootstrapBlazor/wwwroot/modules/select.js b/src/BootstrapBlazor/wwwroot/modules/select.js
index dd0d9ec0525519d99946ed742696b28f515f0197..22691e5247c979f01d60b51e3e491c2e6a0efd47 100644
--- a/src/BootstrapBlazor/wwwroot/modules/select.js
+++ b/src/BootstrapBlazor/wwwroot/modules/select.js
@@ -102,10 +102,10 @@ export class Select extends DropdownBase {
}
_dispose() {
- super._dispose()
-
EventHandler.off(this._element, 'show.bs.dropdown')
EventHandler.off(this._element, 'shown.bs.dropdown')
EventHandler.off(this._element, 'keydown')
+
+ super._dispose()
}
}