@namespace AntDesign @inherits AntDomComponentBase @using OneOf;
@if (Config.Icon != null) { @(Config.Icon) } @if (Config.TitleTemplate != null) { @Config.TitleTemplate } else if (!string.IsNullOrWhiteSpace(Config.Title)) { @Config.Title }
@if (Config.Content.IsT0) { @(Config.Content.AsT0) } else { @(Config.Content.AsT1) }
@{ RenderFragment BuildButton(ButtonProps props, Func onClick, out Button btnRef) { btnRef = null; if (props == null) return null; var onClickEvent = new EventCallback(this, onClick); Button innerBtnRef = null; var children = props.ChildContent!.Value; RenderFragment compontent = (@); btnRef = innerBtnRef; return compontent; } } @switch (Config.ConfirmButtons) { case ConfirmButtons.OK: { @BuildButton(Config.Button1Props, async (e) => { await HandleBtn1Click(e, ConfirmResult.OK); }, out _okBtn) ; break; } case ConfirmButtons.OKCancel: { @BuildButton(Config.Button1Props, async (e) => { await HandleBtn1Click(e, ConfirmResult.OK); }, out _okBtn) ; @BuildButton(Config.Button2Props, async (e) => { await HandleBtn2Click(e, ConfirmResult.Cancel); }, out _cancelBtn) ; break; } case ConfirmButtons.YesNo: { @BuildButton(Config.Button1Props, async (e) => { await HandleBtn1Click(e, ConfirmResult.Yes); }, out _okBtn) ; @BuildButton(Config.Button2Props, async (e) => { await HandleBtn2Click(e, ConfirmResult.No); }, out _cancelBtn) ; break; } case ConfirmButtons.YesNoCancel: { @BuildButton(Config.Button1Props, async (e) => { await HandleBtn1Click(e, ConfirmResult.Yes); }, out _okBtn) ; @BuildButton(Config.Button2Props, async (e) => { await HandleBtn2Click(e, ConfirmResult.No); }, out _cancelBtn) ; @BuildButton(Config.Button3Props, async (e) => { await HandleBtn3Click(e, ConfirmResult.Cancel); }, out _) ; break; } case ConfirmButtons.RetryCancel: { @BuildButton(Config.Button1Props, async (e) => { await HandleBtn1Click(e, ConfirmResult.Retry); }, out _okBtn) ; @BuildButton(Config.Button2Props, async (e) => { await HandleBtn2Click(e, ConfirmResult.Cancel); }, out _cancelBtn) ; break; } case ConfirmButtons.AbortRetryIgnore: { @BuildButton(Config.Button1Props, async (e) => { await HandleBtn1Click(e, ConfirmResult.Abort); }, out _okBtn) ; @BuildButton(Config.Button2Props, async (e) => { await HandleBtn2Click(e, ConfirmResult.Retry); }, out _cancelBtn) ; @BuildButton(Config.Button3Props, async (e) => { await HandleBtn3Click(e, ConfirmResult.Ignore); }, out _) ; break; } }