Skip to content

Commit

Permalink
Rename QRCodeJSOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
stsrki committed Nov 12, 2024
1 parent d6a3733 commit ec9aa25
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Source/Extensions/Blazorise.PdfViewer/PdfViewer.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public override async Task SetParametersAsync( ParameterView parameters )
{
if ( JSModule is not null )
{
await JSModule.UpdateOptions( ElementRef, ElementId, new PdfViewerUpdateJSOptions
await JSModule.UpdateOptions( ElementRef, ElementId, new()
{
Source = new( sourceChanged, paramSource ),
PageNumber = new( pageNumberChanged, paramPageNumber ),
Expand Down
2 changes: 1 addition & 1 deletion Source/Extensions/Blazorise.QRCode/JSQRCodeModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public JSQRCodeModule( IJSRuntime jsRuntime, IVersionProvider versionProvider, B
/// <param name="elementId">ID of the rendered element.</param>
/// <param name="options">Additional options for the tooltip initialization.</param>
/// <returns>A task that represents the asynchronous operation.</returns>
public virtual ValueTask Initialize( ElementReference elementRef, string elementId, QRCodeInitializeAndUpdateJSOptions options )
public virtual ValueTask Initialize( ElementReference elementRef, string elementId, QRCodeJSOptions options )
=> InvokeSafeVoidAsync( "initialize", elementRef, elementId, options );

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions Source/Extensions/Blazorise.QRCode/QRCode.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected virtual async Task SynchronizeQRCode()
await JSModule.Update( ElementRef, ElementId, GetOptions() );
}

private QRCodeInitializeAndUpdateJSOptions GetOptions()
private QRCodeJSOptions GetOptions()
{
var eccLevel = EccLevel switch
{
Expand All @@ -94,11 +94,11 @@ private QRCodeInitializeAndUpdateJSOptions GetOptions()
_ => throw new ArgumentOutOfRangeException()
};

return new QRCodeInitializeAndUpdateJSOptions
return new()
{
Value = Payload?.ToString() ?? Value,
EccLevel = eccLevel,
DarkColor= DarkColor,
DarkColor = DarkColor,
LightColor = LightColor,
PixelsPerModule = PixelsPerModule,
DrawQuietZones = DrawQuietZones,
Expand Down
41 changes: 39 additions & 2 deletions Source/Extensions/Blazorise.QRCode/QRCodeJSOptions.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,52 @@
namespace Blazorise.QRCode;

public class QRCodeInitializeAndUpdateJSOptions
/// <summary>
/// Represents JavaScript options for configuring a QR code generator.
/// </summary>
public class QRCodeJSOptions
{
/// <summary>
/// Gets or sets the value or content encoded within the QR code.
/// </summary>
public string Value { get; set; }

/// <summary>
/// Gets or sets the error correction level of the QR code (e.g., "L", "M", "Q", "H").
/// </summary>
public string EccLevel { get; set; }

/// <summary>
/// Gets or sets the color for the dark modules of the QR code.
/// </summary>
public string DarkColor { get; set; }

/// <summary>
/// Gets or sets the color for the light modules of the QR code.
/// </summary>
public string LightColor { get; set; }

/// <summary>
/// Gets or sets the number of pixels per module, determining the size of the QR code.
/// </summary>
public int PixelsPerModule { get; set; }

/// <summary>
/// Gets or sets a value indicating whether quiet zones (margins) should be drawn around the QR code.
/// </summary>
public bool DrawQuietZones { get; set; }

/// <summary>
/// Gets or sets the path or URL of an icon to be displayed in the center of the QR code.
/// </summary>
public string Icon { get; set; }

/// <summary>
/// Gets or sets the size of the icon as a percentage of the QR code size.
/// </summary>
public int IconSizePercentage { get; set; }
public int IconBorderWidth { get; set; }

/// <summary>
/// Gets or sets the width of the border around the icon, in pixels.
/// </summary>
public int IconBorderWidth { get; set; }
}

0 comments on commit ec9aa25

Please sign in to comment.