Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions src/BootstrapBlazor/Components/Button/PopConfirmButton.razor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import EventHandler from "../../modules/event-handler.js"

const config = {
class: 'popover-confirm',
dismiss: '.popover-confirm-buttons > div',
popoverSelector: '.popover-confirm.show'
}

Expand Down Expand Up @@ -63,22 +62,6 @@ export function init(id) {
EventHandler.on(el, 'inserted.bs.popover', confirm.inserted)
EventHandler.on(el, 'hide.bs.popover', confirm.hide)

if (config.dismiss != null) {
confirm.dismissHandler = e => {
const ele = e.target.closest(config.popoverSelector)
if (ele) {
const element = getDescribedOwner(ele)
if (element) {
const popover = bootstrap.Popover.getInstance(element);
if (popover) {
popover.hide()
}
}
}
}
EventHandler.on(document, 'click', config.dismiss, confirm.dismissHandler)
}

confirm.checkCancel = el => {
// check button
let self = el === confirm.el || el.closest('.dropdown-toggle') === confirm.el
Expand Down Expand Up @@ -170,9 +153,6 @@ export function dispose(id) {
if (confirm.popover) {
confirm.popover.dispose();
}
if (config.dismiss) {
EventHandler.off(document, 'click', config.dismiss, confirm.dismissHandler)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<div class="popover-confirm-body">
@if (ChildContent != null)
{
<CascadingValue Value="TriggerCloseAsync" Name="PopoverConfirmButtonCloseAsync" IsFixed="true">
<CascadingValue Value="TriggerConfirmAsync" Name="PopoverConfirmButtonConfirmAsync" IsFixed="true">
<CascadingValue Value="OnCloseClick" Name="PopoverConfirmButtonCloseAsync" IsFixed="true">
<CascadingValue Value="OnConfirmClick" Name="PopoverConfirmButtonConfirmAsync" IsFixed="true">
@ChildContent
</CascadingValue>
</CascadingValue>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ protected override void OnParametersSet()
/// </summary>
public async Task OnCloseClick()
{
await InvokeVoidAsync("hide", Id);
if (OnClose != null)
{
await OnClose();
Expand All @@ -132,21 +133,10 @@ public async Task OnCloseClick()
/// </summary>
public async Task OnConfirmClick()
{
await InvokeVoidAsync("hide", Id);
if (OnConfirm != null)
{
await OnConfirm();
}
}

private async Task TriggerCloseAsync()
{
await InvokeVoidAsync("hide", Id);
await OnCloseClick();
}

private async Task TriggerConfirmAsync()
{
await InvokeVoidAsync("hide", Id);
await OnConfirmClick();
}
}