diff --git a/BlazorBootstrap.Demo.RCL/Components/Pages/Demos/PdfViewer/PdfViewer_Demo_05_Password_Protected_A.razor b/BlazorBootstrap.Demo.RCL/Components/Pages/Demos/PdfViewer/PdfViewer_Demo_05_Password_Protected_A.razor index 6605c7fcf..106406c29 100644 --- a/BlazorBootstrap.Demo.RCL/Components/Pages/Demos/PdfViewer/PdfViewer_Demo_05_Password_Protected_A.razor +++ b/BlazorBootstrap.Demo.RCL/Components/Pages/Demos/PdfViewer/PdfViewer_Demo_05_Password_Protected_A.razor @@ -1,3 +1,3 @@ diff --git a/BlazorBootstrap.Demo.RCL/Components/Pages/Demos/PdfViewer/PdfViewer_Demo_05_Password_Protected_B_Prompt_For_Password.razor b/BlazorBootstrap.Demo.RCL/Components/Pages/Demos/PdfViewer/PdfViewer_Demo_05_Password_Protected_B_Prompt_For_Password.razor index a4c9aa0ec..2611b5a7d 100644 --- a/BlazorBootstrap.Demo.RCL/Components/Pages/Demos/PdfViewer/PdfViewer_Demo_05_Password_Protected_B_Prompt_For_Password.razor +++ b/BlazorBootstrap.Demo.RCL/Components/Pages/Demos/PdfViewer/PdfViewer_Demo_05_Password_Protected_B_Prompt_For_Password.razor @@ -1,6 +1,6 @@ @if (showPdfViewer) { - + } else { diff --git a/blazorbootstrap/Components/Offcanvas/Offcanvas.razor.cs b/blazorbootstrap/Components/Offcanvas/Offcanvas.razor.cs index 7c3d705c6..7acc50b59 100644 --- a/blazorbootstrap/Components/Offcanvas/Offcanvas.razor.cs +++ b/blazorbootstrap/Components/Offcanvas/Offcanvas.razor.cs @@ -6,11 +6,11 @@ public partial class Offcanvas : BlazorBootstrapComponentBase private Type? childComponent; - private DotNetObjectReference objRef = default!; + private DotNetObjectReference? objRef; - private Dictionary parameters = default!; + private Dictionary? parameters; - private string title = default!; + private string? title; #endregion @@ -69,11 +69,15 @@ protected override async Task OnInitializedAsync() /// /// Hides an offcanvas. /// + [AddedVersion("1.0.0")] + [Description("Hides an offcanvas.")] public async Task HideAsync() => await JSRuntime.InvokeVoidAsync("window.blazorBootstrap.offcanvas.hide", Id); /// /// Shows an offcanvas. /// + [AddedVersion("1.0.0")] + [Description("Shows an offcanvas.")] public async Task ShowAsync() => await ShowAsync(null, null, null); /// @@ -82,6 +86,8 @@ protected override async Task OnInitializedAsync() /// /// /// + [AddedVersion("1.0.0")] + [Description("Opens a offcanvas. T is component.")] public async Task ShowAsync(string title, Dictionary? parameters = null) => await ShowAsync(title, typeof(T), parameters); private async Task ShowAsync(string? title, Type? type, Dictionary? parameters) @@ -107,163 +113,208 @@ private async Task ShowAsync(string? title, Type? type, Dictionary /// Gets or sets the body CSS class. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Gets or sets the body CSS class.")] + [ParameterTypeName("string?")] [Parameter] - public string BodyCssClass { get; set; } = default!; + public string? BodyCssClass { get; set; } /// /// Gets or sets the body template. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Gets or sets the body template.")] + [ParameterTypeName("RenderFragment?")] [Parameter] - public RenderFragment BodyTemplate { get; set; } = default!; + public RenderFragment? BodyTemplate { get; set; } /// /// If , offcanvas closes when escape key is pressed. + /// + /// Default value is . + /// /// - /// - /// Default value is true. - /// + [AddedVersion("1.0.0")] + [DefaultValue(true)] + [Description("If true, offcanvas closes when escape key is pressed.")] [Parameter] public bool CloseOnEscape { get; set; } = true; /// /// Gets or sets the footer CSS class. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Gets or sets the footer CSS class.")] + [ParameterTypeName("string?")] [Parameter] - public string FooterCssClass { get; set; } = default!; + public string? FooterCssClass { get; set; } /// /// Gets or sets the footer template. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Gets or sets the footer template.")] + [ParameterTypeName("RenderFragment?")] [Parameter] - public RenderFragment FooterTemplate { get; set; } = default!; + public RenderFragment? FooterTemplate { get; set; } /// /// Gets or sets the header CSS class. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Gets or sets the header CSS class.")] + [ParameterTypeName("string?")] [Parameter] - public string HeaderCssClass { get; set; } = default!; + public string? HeaderCssClass { get; set; } /// /// Gets or sets the header template. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Gets or sets the header template.")] + [ParameterTypeName("RenderFragment?")] [Parameter] - public RenderFragment HeaderTemplate { get; set; } = default!; + public RenderFragment? HeaderTemplate { get; set; } /// /// Indicates whether body scrolling is allowed while offcanvas is open. + /// + /// Default value is . + /// /// - /// - /// Default value is false. - /// + [AddedVersion("1.0.0")] + [DefaultValue(false)] + [Description("Indicates whether body scrolling is allowed while offcanvas is open.")] [Parameter] public bool IsScrollable { get; set; } /// - /// This event is fired when an offcanvas element has been hidden from the user (will wait for CSS transitions to - /// complete). + /// This event is fired when an offcanvas element has been hidden from the user (will wait for CSS transitions to complete). /// + [AddedVersion("1.0.0")] + [Description("This event is fired when an offcanvas element has been hidden from the user (will wait for CSS transitions to complete).")] [Parameter] public EventCallback OnHidden { get; set; } /// /// This event is fired immediately when the hide method has been called. /// + [AddedVersion("1.0.0")] + [Description("This event is fired immediately when the hide method has been called.")] [Parameter] public EventCallback OnHiding { get; set; } /// /// This event fires immediately when the show instance method is called. /// + [AddedVersion("1.0.0")] + [Description("This event fires immediately when the show instance method is called.")] [Parameter] public EventCallback OnShowing { get; set; } /// - /// This event is fired when an offcanvas element has been made visible to the user (will wait for CSS transitions to - /// complete). + /// This event is fired when an offcanvas element has been made visible to the user (will wait for CSS transitions to complete). /// + [AddedVersion("1.0.0")] + [Description("This event is fired when an offcanvas element has been made visible to the user (will wait for CSS transitions to complete).")] [Parameter] public EventCallback OnShown { get; set; } /// /// Gets or sets the offcanvas placement. - /// - /// + /// /// Default value is . - /// + /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(Placement.End)] + [Description("Gets or sets the offcanvas placement.")] [Parameter] public Placement Placement { get; set; } = Placement.End; /// /// If , modal shows close button in the header. + /// + /// Default value is . + /// /// - /// - /// Default value is true. - /// + [AddedVersion("1.0.0")] + [DefaultValue(true)] + [Description("If true, modal shows close button in the header.")] [Parameter] public bool ShowCloseButton { get; set; } = true; /// /// Gets or sets the offcanvas size. - /// - /// + /// /// Default value is . - /// + /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(OffcanvasSize.Regular)] + [Description("Gets or sets the offcanvas size.")] [Parameter] public OffcanvasSize Size { get; set; } = OffcanvasSize.Regular; /// /// Gets or sets the tab index. - /// - /// + /// /// Default value is -1. - /// + /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(-1)] + [Description("Gets or sets the tab index.")] [Parameter] public int TabIndex { get; set; } = -1; /// /// Gets or sets the offcanvas title. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// - [Parameter] - public string Title { get; set; } = default!; - - [Obsolete("Use `UseStaticBackdrop` parameter.")] - /// - /// Indicates whether to apply a backdrop on body while offcanvas is open. - /// - /// - /// Default value is true. - /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Gets or sets the offcanvas title.")] + [ParameterTypeName("string?")] [Parameter] - public bool UseBackdrop { get; set; } = true; + public string? Title { get; set; } /// - /// When `UseStaticBackdrop` is set to true, the offcanvas will not close when clicking outside of it. + /// When `UseStaticBackdrop` is set to , the offcanvas will not close when clicking outside of it. + /// + /// Default value is . + /// /// - /// - /// Default value is false. - /// + [AddedVersion("1.0.0")] + [DefaultValue(false)] + [Description("When `UseStaticBackdrop` is set to true, the offcanvas will not close when clicking outside of it.")] [Parameter] public bool UseStaticBackdrop { get; set; } diff --git a/blazorbootstrap/Components/Pagination/Pagination.razor.cs b/blazorbootstrap/Components/Pagination/Pagination.razor.cs index 23a5b733c..f4f642744 100644 --- a/blazorbootstrap/Components/Pagination/Pagination.razor.cs +++ b/blazorbootstrap/Components/Pagination/Pagination.razor.cs @@ -75,36 +75,48 @@ private async Task SetPageNumberTo(int newPageNumber) /// /// Gets or sets the active page number. /// - /// + /// /// Default value is 1. - /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(1)] + [Description("Gets or sets the active page number.")] [Parameter] public int ActivePageNumber { get; set; } = 1; /// /// Gets or sets the pagination alignment. /// - /// + /// /// Default value is . - /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(Alignment.None)] + [Description("Gets or sets the pagination alignment.")] [Parameter] public Alignment Alignment { get; set; } = Alignment.None; /// /// Gets or sets the maximum page links to be displayed. /// - /// + /// /// Default value is 5. - /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(5)] + [Description("Gets or sets the maximum page links to be displayed.")] [Parameter] public int DisplayPages { get; set; } = 5; /// /// Gets or sets the first link icon. /// - /// + /// /// Default value is . - /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(IconName.None)] + [Description("Gets or sets the first link icon.")] [Parameter] public IconName FirstLinkIcon { get; set; } = IconName.None; @@ -113,9 +125,13 @@ private async Task SetPageNumberTo(int newPageNumber) /// /// Gets or sets the first link text. 'FirstLinkText' is ignored if 'FirstLinkIcon' is specified. /// - /// - /// Default value is null. - /// + /// + /// Default value is . + /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Gets or sets the first link text. FirstLinkText is ignored if FirstLinkIcon is specified.")] + [ParameterTypeName("string?")] [Parameter] public string? FirstLinkText { get; set; } @@ -124,9 +140,12 @@ private async Task SetPageNumberTo(int newPageNumber) /// /// Gets or sets the last link icon. /// - /// + /// /// Default value is . - /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(IconName.None)] + [Description("Gets or sets the last link icon.")] [Parameter] public IconName LastLinkIcon { get; set; } = IconName.None; @@ -135,9 +154,13 @@ private async Task SetPageNumberTo(int newPageNumber) /// /// Gets or sets the last link text. 'LastLinkText' is ignored if 'LastLinkIcon' is specified. /// - /// - /// Default value is null. - /// + /// + /// Default value is . + /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Gets or sets the last link text. LastLinkText is ignored if LastLinkIcon is specified.")] + [ParameterTypeName("string?")] [Parameter] public string? LastLinkText { get; set; } @@ -146,9 +169,12 @@ private async Task SetPageNumberTo(int newPageNumber) /// /// Gets or sets the next link icon. /// - /// + /// /// Default value is . - /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(IconName.None)] + [Description("Gets or sets the next link icon.")] [Parameter] public IconName NextLinkIcon { get; set; } = IconName.None; @@ -157,9 +183,13 @@ private async Task SetPageNumberTo(int newPageNumber) /// /// Gets or sets the next link text. 'NextLinkText' is ignored if 'NextLinkIcon' is specified. /// - /// - /// Default value is null. - /// + /// + /// Default value is . + /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Gets or sets the next link text. NextLinkText is ignored if NextLinkIcon is specified.")] + [ParameterTypeName("string?")] [Parameter] public string? NextLinkText { get; set; } @@ -168,6 +198,8 @@ private async Task SetPageNumberTo(int newPageNumber) /// /// This event fires immediately when the page number is changed. /// + [AddedVersion("1.0.0")] + [Description("This event fires immediately when the page number is changed.")] [Parameter] public EventCallback PageChanged { get; set; } @@ -178,9 +210,12 @@ private async Task SetPageNumberTo(int newPageNumber) /// /// Gets or sets the previous link icon. /// - /// + /// /// Default value is . - /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(IconName.None)] + [Description("Gets or sets the previous link icon.")] [Parameter] public IconName PreviousLinkIcon { get; set; } = IconName.None; @@ -189,9 +224,13 @@ private async Task SetPageNumberTo(int newPageNumber) /// /// Gets or sets the previous link text. 'PreviousLinkText' is ignored if 'PreviousLinkIcon' is specified. /// - /// + /// /// Default value is null. - /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Gets or sets the previous link text. PreviousLinkText is ignored if PreviousLinkIcon is specified.")] + [ParameterTypeName("string?")] [Parameter] public string? PreviousLinkText { get; set; } @@ -199,19 +238,25 @@ private async Task SetPageNumberTo(int newPageNumber) /// /// Gets or sets the pagination size. - /// - /// + /// /// Default value is . - /// + /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(PaginationSize.None)] + [Description("Gets or sets the pagination size.")] [Parameter] public PaginationSize Size { get; set; } = PaginationSize.None; /// /// Gets or sets the total pages. - /// - /// + /// /// Default value is 0. - /// + /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(0)] + [Description("Gets or sets the total pages.")] [Parameter] public int TotalPages { get; set; } diff --git a/blazorbootstrap/Components/PdfViewer/PdfViewer.razor.cs b/blazorbootstrap/Components/PdfViewer/PdfViewer.razor.cs index d4a4a18d9..029b54396 100644 --- a/blazorbootstrap/Components/PdfViewer/PdfViewer.razor.cs +++ b/blazorbootstrap/Components/PdfViewer/PdfViewer.razor.cs @@ -32,7 +32,7 @@ public partial class PdfViewer : BlazorBootstrapComponentBase protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) - await PdfViewerJsInterop.InitializeAsync(objRef!, Id!, scale, rotation, Url!, Password!); + await PdfViewerJsInterop!.InitializeAsync(objRef!, Id!, scale, rotation, Url!, Password!); await base.OnAfterRenderAsync(firstRender); } @@ -53,7 +53,7 @@ protected override async Task OnParametersSetAsync() { oldOrientation = Orientation; rotation = Orientation == Orientation.Portrait ? 0 : -90; - await PdfViewerJsInterop.RotateAsync(objRef!, Id!, rotation); + await PdfViewerJsInterop!.RotateAsync(objRef!, Id!, rotation); } await base.OnParametersSetAsync(); @@ -94,7 +94,7 @@ public void SetPdfViewerMetaData(PdfViewerModel pdfViewerModel) OnPageChanged.InvokeAsync(new PdfViewerEventArgs(pageNumber, pagesCount)); } - private async Task FirstPageAsync() => await PdfViewerJsInterop.FirstPageAsync(objRef!, Id!); + private async Task FirstPageAsync() => await PdfViewerJsInterop!.FirstPageAsync(objRef!, Id!); private int GetZoomPercentage(int zoomLevel) => zoomLevel switch @@ -119,9 +119,9 @@ private int GetZoomPercentage(int zoomLevel) => _ => 100 }; - private async Task LastPageAsync() => await PdfViewerJsInterop.LastPageAsync(objRef!, Id!); + private async Task LastPageAsync() => await PdfViewerJsInterop!.LastPageAsync(objRef!, Id!); - private async Task NextPageAsync() => await PdfViewerJsInterop.NextPageAsync(objRef!, Id!); + private async Task NextPageAsync() => await PdfViewerJsInterop!.NextPageAsync(objRef!, Id!); private async Task PageNumberChangedAsync(int value) { @@ -130,12 +130,12 @@ private async Task PageNumberChangedAsync(int value) else pageNumber = value; - await PdfViewerJsInterop.GotoPageAsync(objRef!, Id!, pageNumber); + await PdfViewerJsInterop!.GotoPageAsync(objRef!, Id!, pageNumber); } - private async Task PreviousPageAsync() => await PdfViewerJsInterop.PreviousPageAsync(objRef!, Id!); + private async Task PreviousPageAsync() => await PdfViewerJsInterop!.PreviousPageAsync(objRef!, Id!); - private async Task PrintAsync() => await PdfViewerJsInterop.PrintAsync(objRef!, Id!, Url!); + private async Task PrintAsync() => await PdfViewerJsInterop!.PrintAsync(objRef!, Id!, Url!); private async Task ResetZoomAsync() { @@ -143,14 +143,14 @@ private async Task ResetZoomAsync() var zp = GetZoomPercentage(defaultZoomLevel); zoomPercentage = $"{zp}%"; scale = 0.01 * zp; - await PdfViewerJsInterop.ZoomInOutAsync(objRef!, Id!, scale); + await PdfViewerJsInterop!.ZoomInOutAsync(objRef!, Id!, scale); } private async Task RotateClockwiseAsync() { rotation += 90; rotation = rotation.Equals(360) ? 0 : rotation; - await PdfViewerJsInterop.RotateAsync(objRef!, Id!, rotation); + await PdfViewerJsInterop!.RotateAsync(objRef!, Id!, rotation); // Orientation SetOrientation(); @@ -160,7 +160,7 @@ private async Task RotateCounterclockwiseAsync() { rotation -= 90; rotation = rotation.Equals(-360) ? 0 : rotation; - await PdfViewerJsInterop.RotateAsync(objRef!, Id!, rotation); + await PdfViewerJsInterop!.RotateAsync(objRef!, Id!, rotation); // Orientation SetOrientation(); @@ -179,7 +179,7 @@ private async Task SwitchOrientationAsync() oldOrientation = Orientation; Orientation = Orientation == Orientation.Portrait ? Orientation.Landscape : Orientation.Portrait; rotation = Orientation == Orientation.Portrait ? 0 : -90; - await PdfViewerJsInterop.RotateAsync(objRef!, Id!, rotation); + await PdfViewerJsInterop!.RotateAsync(objRef!, Id!, rotation); } private async Task ZoomInAsync() @@ -191,7 +191,7 @@ private async Task ZoomInAsync() var zp = GetZoomPercentage(zoomLevel); zoomPercentage = $"{zp}%"; scale = 0.01 * zp; - await PdfViewerJsInterop.ZoomInOutAsync(objRef!, Id!, scale); + await PdfViewerJsInterop!.ZoomInOutAsync(objRef!, Id!, scale); } private async Task ZoomOutAsync() @@ -203,7 +203,7 @@ private async Task ZoomOutAsync() var zp = GetZoomPercentage(zoomLevel); zoomPercentage = $"{zp}%"; scale = 0.01 * zp; - await PdfViewerJsInterop.ZoomInOutAsync(objRef!, Id!, scale); + await PdfViewerJsInterop!.ZoomInOutAsync(objRef!, Id!, scale); } #endregion @@ -213,36 +213,49 @@ private async Task ZoomOutAsync() /// /// This event fires immediately after the PDF document is loaded. /// + [AddedVersion("1.0.0")] + [Description("This event fires immediately after the PDF document is loaded.")] [Parameter] public EventCallback OnDocumentLoaded { get; set; } /// /// This event fires if there is an error loading the PDF document. /// + [AddedVersion("1.11.0")] + [Description("This event fires if there is an error loading the PDF document.")] [Parameter] public EventCallback OnDocumentLoadError { get; set; } /// /// This event fires immediately after the page is changed. /// + [AddedVersion("1.11.0")] + [Description("This event fires immediately after the page is changed.")] [Parameter] public EventCallback OnPageChanged { get; set; } /// /// Gets or sets the preferred orientation for the PDF viewer. - /// - /// + /// /// Default value is . - /// + /// + /// + [AddedVersion("2.1.0")] + [DefaultValue(Orientation.Portrait)] + [Description("Gets or sets the preferred orientation for the PDF viewer.")] [Parameter] public Orientation Orientation { get; set; } = Orientation.Portrait; /// /// Gets or sets the password used for the PDF document if it is password-protected. - /// - /// + /// /// Default value is . - /// + /// + /// + [AddedVersion("3.5.0")] + [DefaultValue(null)] + [Description("Gets or sets the password used for the PDF document if it is password-protected.")] + [ParameterTypeName("string?")] [Parameter] public string? Password { get; set; } @@ -250,15 +263,19 @@ private async Task ZoomOutAsync() /// Provides JavaScript interop functionality for the PDF viewer. /// [Inject] - private PdfViewerJsInterop PdfViewerJsInterop { get; set; } = default!; + private PdfViewerJsInterop? PdfViewerJsInterop { get; set; } /// /// Gets or sets the URL of the PDF document to be displayed. /// PDF Viewer component supports base64 string as a URL. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.11.0")] + [DefaultValue(null)] + [Description("Gets or sets the URL of the PDF document to be displayed. PDF Viewer component supports base64 string as a URL.")] + [ParameterTypeName("string?")] [Parameter] public string? Url { get; set; }