diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d93ae14..aee1561 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,12 +24,13 @@ jobs: NUGET_API_KEY: ${{secrets.NUGET_API_KEY}} Bundle: True run: | - dotnet restore src/BootstrapBlazor --no-cache - dotnet build src/BootstrapBlazor + dotnet restore --no-cache + dotnet build - name: Test run: | - dotnet test test/UnitTest --collect:"XPlat Code Coverage" + dotnet test ./test/UnitTestEditor --collect:"XPlat Code Coverage" + dotnet test ./test/UnitTestHoliday --collect:"XPlat Code Coverage" - name: Upload to Codecov uses: codecov/codecov-action@v4 diff --git a/src/components/BootstrapBlazor.BarcodeGenerator/BarCodeGenerator.razor b/src/components/BootstrapBlazor.BarcodeGenerator/BarCodeGenerator.razor deleted file mode 100644 index 0b92419..0000000 --- a/src/components/BootstrapBlazor.BarcodeGenerator/BarCodeGenerator.razor +++ /dev/null @@ -1,5 +0,0 @@ -@namespace BootstrapBlazor.Components - - - - diff --git a/src/components/BootstrapBlazor.BarcodeGenerator/BarCodeGenerator.razor.cs b/src/components/BootstrapBlazor.BarcodeGenerator/BarCodeGenerator.razor.cs deleted file mode 100644 index b541aff..0000000 --- a/src/components/BootstrapBlazor.BarcodeGenerator/BarCodeGenerator.razor.cs +++ /dev/null @@ -1,142 +0,0 @@ -// ********************************** -// Densen Informatica 中讯科技 -// 作者:Alex Chow -// e-mail:zhouchuanglin@gmail.com -// ********************************** - -using Microsoft.AspNetCore.Components; -using Microsoft.JSInterop; -using System.Diagnostics.CodeAnalysis; - -namespace BootstrapBlazor.Components; - -/// -/// 条码生成器 BarCodes -/// -public partial class BarCodeGenerator : IAsyncDisposable -{ - [Inject] - [NotNull] - private IJSRuntime? JSRuntime { get; set; } - - private IJSObjectReference? Module { get; set; } - - private DotNetObjectReference? Instance { get; set; } - - /// - /// UI界面元素的引用对象 - /// - public ElementReference Element { get; set; } - - /// - /// 条码类型/ Barcode type - /// - [Parameter] - public EnumBarcodeType? Type { get; set; } - - /// - /// 条码值/ Barcode value - /// - [Parameter] - public string? Value { get; set; } - - /// - /// 选项 - /// - [Parameter] - public BarcodeGeneratorOption Options { get; set; } = new(); - - /// - /// 条码生成(svg)回调方法/ Barcode generated(svg) callback method - /// - [Parameter] - public Func? OnResult { get; set; } - - /// - /// 错误回调方法/Error callback method - /// - [Parameter] - public Func? OnError { get; set; } - - private bool FirstRender { get; set; } = true; - - protected override async Task OnAfterRenderAsync(bool firstRender) - { - try - { - if (!firstRender) return; - FirstRender=false; - Instance = DotNetObjectReference.Create(this); - Module = await JSRuntime.InvokeAsync("import", "./_content/BootstrapBlazor.BarcodeGenerator/BarCodeGenerator.razor.js" + "?v=" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); - await GenerateBarcode(); - - } - catch (Exception e) - { - if (OnError != null) await OnError.Invoke(e.Message); - } - - } - - protected override async Task OnParametersSetAsync() - { - if (FirstRender) return; - await GenerateBarcode(); - } - - [JSInvokable] - public async Task GetError(string err) - { - if (OnError != null) await OnError.Invoke(err); - } - - /// - /// 生成条码/ Generate barcode - /// - /// - /// - /// - public async Task GenerateBarcode(string? input = null, BarcodeGeneratorOption? options = null) - { - if (input != null) - Value = input; - if (options != null) - Options = options; - - if (!string.IsNullOrWhiteSpace(Value) || Options.Value!=null) - { - try - { - if (Type != null) - Options.Type = Type.Value; - if (Value != null) - Options.Value = Value; - var res = await Module!.InvokeAsync("Gen", Instance, Element, Options); - if (OnResult != null) - await OnResult.Invoke(res); - } - catch (Exception ex) - { - Console.WriteLine(ex.Message); - } - - } - } - - [JSInvokable] - public async Task GetResult(string err) - { - if (OnResult != null) - await OnResult.Invoke(err); - } - - async ValueTask IAsyncDisposable.DisposeAsync() - { - if (Module is not null) - { - await Module.DisposeAsync(); - } - Instance?.Dispose(); - } - -} diff --git a/src/components/BootstrapBlazor.BarcodeGenerator/BarCodeGenerator.razor.js b/src/components/BootstrapBlazor.BarcodeGenerator/BarCodeGenerator.razor.js deleted file mode 100644 index fe3f265..0000000 --- a/src/components/BootstrapBlazor.BarcodeGenerator/BarCodeGenerator.razor.js +++ /dev/null @@ -1,15 +0,0 @@ -import '/_content/BootstrapBlazor.BarcodeGenerator/JsBarcode.all.min.js'; - -export function Gen(instance, element, options) { - var ele = element.querySelector("[data-action=barcode]"); - - if (options.fontOption) { - if (options.fontOption == "normal") - options.fontOption = ""; - else if (options.fontOption == "bold_italic") - options.fontOption = "bold italic"; - } - - JsBarcode(ele, options.value, options); - return ele.innerHTML// .toDataURL("image/jpeg", 0.8); -} diff --git a/src/components/BootstrapBlazor.BarcodeGenerator/BarcodeGenerator.razor b/src/components/BootstrapBlazor.BarcodeGenerator/BarcodeGenerator.razor new file mode 100644 index 0000000..1ce6a1c --- /dev/null +++ b/src/components/BootstrapBlazor.BarcodeGenerator/BarcodeGenerator.razor @@ -0,0 +1,7 @@ +@namespace BootstrapBlazor.Components +@inherits BootstrapModuleComponentBase +@attribute [JSModuleAutoLoader("./_content/BootstrapBlazor.BarcodeGenerator/BarcodeGenerator.razor.js", AutoInvokeInit = false, AutoInvokeDispose = false)] + + + + diff --git a/src/components/BootstrapBlazor.BarcodeGenerator/BarcodeGenerator.razor.cs b/src/components/BootstrapBlazor.BarcodeGenerator/BarcodeGenerator.razor.cs new file mode 100644 index 0000000..9a1d97e --- /dev/null +++ b/src/components/BootstrapBlazor.BarcodeGenerator/BarcodeGenerator.razor.cs @@ -0,0 +1,84 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Website: https://www.blazor.zone or https://argozhang.github.io/ + +using Microsoft.AspNetCore.Components; + +namespace BootstrapBlazor.Components; + +/// +/// 条码生成器组件 +/// +public partial class BarcodeGenerator +{ + private string? _value; + private BarcodeGeneratorOption _options = new(); + + /// + /// 获得/设置 条码值 + /// + [Parameter] + public string? Value { get; set; } + + /// + /// 获得/设置 实例值 + /// + [Parameter] + public BarcodeGeneratorOption? Options { get; set; } + + /// + /// 获得/设置 条码生成回调方法 + /// + [Parameter] + public Func? OnCompletedAsync { get; set; } + + private string? ClassString => CssBuilder.Default("bb-barcode") + .AddClassFromAttributes(AdditionalAttributes) + .Build(); + + /// + /// + /// + protected override async Task OnAfterRenderAsync(bool firstRender) + { + await base.OnAfterRenderAsync(firstRender); + + var render = false; + if (_value != Value) + { + _value = Value; + render = true; + } + if (_options.DifferAndAssign(Options)) + { + render = true; + } + + if (render) + { + var result = await GenerateBarCode(Value, Options); + if (OnCompletedAsync != null) + { + await OnCompletedAsync(result); + } + } + } + + /// + /// 生成条码方法 + /// + /// + /// + /// + public async Task Generate(string? value = null, BarcodeGeneratorOption? options = null) + { + if (_value != value) + { + _value = Value = value; + } + + return await GenerateBarCode(_value, options); + } + + private Task GenerateBarCode(string? value, BarcodeGeneratorOption? options = null) => InvokeAsync("generate", Id, value, options); +} diff --git a/src/components/BootstrapBlazor.BarcodeGenerator/BarcodeGenerator.razor.js b/src/components/BootstrapBlazor.BarcodeGenerator/BarcodeGenerator.razor.js new file mode 100644 index 0000000..eecc6be --- /dev/null +++ b/src/components/BootstrapBlazor.BarcodeGenerator/BarcodeGenerator.razor.js @@ -0,0 +1,16 @@ +import './JsBarcode.all.min.js'; + +export function generate(id, value, options) { + const el = document.getElementById(id); + if (el === null) { + return; + } + + if (typeof (JsBarcode) !== 'function') { + console.error('import JsBarcode failed'); + } + + const svg = el.querySelector("svg"); + JsBarcode(svg, value, options); + return svg.outerHTML; +} diff --git a/src/components/BootstrapBlazor.BarcodeGenerator/BarcodeGeneratorOption.cs b/src/components/BootstrapBlazor.BarcodeGenerator/BarcodeGeneratorOption.cs index 1e873ca..72098df 100644 --- a/src/components/BootstrapBlazor.BarcodeGenerator/BarcodeGeneratorOption.cs +++ b/src/components/BootstrapBlazor.BarcodeGenerator/BarcodeGeneratorOption.cs @@ -1,10 +1,8 @@ -// ********************************** -// Densen Informatica 中讯科技 -// 作者:Alex Chow -// e-mail:zhouchuanglin@gmail.com -// ********************************** +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Website: https://www.blazor.zone or https://argozhang.github.io/ -using System.ComponentModel; +using BootstrapBlazor.Core.Converter; using System.ComponentModel.DataAnnotations; using System.Text.Json.Serialization; @@ -16,155 +14,127 @@ namespace BootstrapBlazor.Components; public class BarcodeGeneratorOption { /// - /// 条码类型, 默认 "auto" (CODE128) / Barcode type, default "auto" (CODE128) + /// 获得/设置 条码类型 默认 "auto" (CODE128) /// - [DisplayName("条码类型")] - [JsonConverter(typeof(JsonStringEnumConverter)), JsonPropertyName("format")] - public EnumBarcodeType Type { get; set; } = EnumBarcodeType.CODE128; - - /// - /// 条码值 / Barcode value - /// - [DisplayName("条码值")] + [JsonConverter(typeof(JsonDescriptionEnumConverter))] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public string? Value { get; set; } + public EnumBarcodeFormat? Format { get; set; } /// - /// 单个条形的宽度,默认值:2 / Width,default: 2 + /// 获得/设置 单个条形的宽度 默认值:2 /// - [DisplayName("宽度")] [Range(1, 6)] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - public int Width { get; set; } = 2; + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public int? Width { get; set; } /// - /// 条形码的高度,默认值:100 / Height,default: 100 + /// 获得/设置 条形码的高度 默认值 100 /// - [DisplayName("高度")] [Range(10, 300)] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - public int Height { get; set; } = 100; + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public int? Height { get; set; } /// - /// 显示条码文字,默认 true + /// 获得/设置 显示条码文字,默认 true /// - [DisplayName("显示条码文字")] - public bool DisplayValue { get; set; } = true; + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public bool? DisplayValue { get; set; } /// - /// 覆盖显示的文本/ Overide the text that is diplayed + /// 获得/设置 覆盖显示的文本 /// - [DisplayName("覆盖显示的文本")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public string? Text { get; set; } /// - /// 字体式样 + /// 获得/设置 字体式样 /// - [DisplayName("字体式样")] - //[JsonConverter(typeof(JsonStringEnumConverter))] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - public EnumBarcodeFontOption FontOptions { get; set; }= EnumBarcodeFontOption.normal; + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonEnumConverter(true)] + public EnumBarcodeTextFontOption? FontOptions { get; set; } /// - /// 字体,默认值:"monospace"等宽 / default: "monospace" + /// 获得/设置 字体,默认值:"monospace" 等宽 /// - [DisplayName("字体")] - //[JsonConverter(typeof(JsonStringEnumConverter))] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - public EnumBarcodeFont Font { get; set; } = EnumBarcodeFont.Monospace; + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonEnumConverter(true)] + public EnumBarcodeTextFont? Font { get; set; } /// - /// 文字对齐,默认值:'中心' + /// 获得/设置 文字对齐 默认值 center /// - [DisplayName("文字对齐")] - //[JsonConverter(typeof(JsonStringEnumConverter))] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - public EnumBarcodeTextAlign TextAlign { get; set; } = EnumBarcodeTextAlign.center; + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonEnumConverter(true)] + public EnumBarcodeTextAlign? TextAlign { get; set; } /// - /// 文字位置,默认值:'底部' + /// 获得/设置 文字位置,默认值 bottom /// - [DisplayName("文字位置")] - //[JsonConverter(typeof(JsonStringEnumConverter))] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - public EnumTextPosition TextPosition { get; set; } = EnumTextPosition.bottom; + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + [JsonEnumConverter(true)] + public EnumBarcodeTextPosition? TextPosition { get; set; } /// - /// 文本边距,默认值:2 + /// 获得/设置 文本边距 默认值:2 /// - [DisplayName("文字间距")] [Range(-30, 100)] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - public int TextMargin { get; set; } = 2; + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public int? TextMargin { get; set; } /// - /// 字体大小,默认值:20 + /// 获得/设置 字体大小,默认值:20 /// - [DisplayName("字体大小")] [Range(8, 52)] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - public int FontSize { get; set; } = 20; + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public int? FontSize { get; set; } /// - /// 背景色,默认值:'#ffffff' (CSS color) + /// 获得/设置 背景色 默认值 #FFFFFF /// - [DisplayName("背景色")] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - public string Background { get; set; }= "#ffffff"; + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? Background { get; set; } /// - /// 线条颜色,默认值:'#000000' (CSS color) + /// 获得/设置 线条颜色 默认值 #000000 /// - [DisplayName("线条颜色")] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - public string LineColor { get; set; }= "#000000"; + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public string? LineColor { get; set; } /// - /// 间距,默认值:10 + /// 获得/设置 间距 默认值 10 /// - [DisplayName("间距")] [Range(-30, 100)] - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] - public int Margin { get; set; } = 10; + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public int? Margin { get; set; } /// - /// 顶部间距 + /// 获得/设置 顶部间距 默认 null 未设置 /// - [DisplayName("顶部间距")] - [Range(-30, 100)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public int? MarginTop { get; set; } /// - /// 底部间距 + /// 获得/设置 底部间距 默认 null 未设置 /// - [DisplayName("底部间距")] - [Range(-30, 100)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public int? MarginBottom { get; set; } /// - /// 左侧间距 + /// 获得/设置 左侧间距 默认 null 未设置 /// - [DisplayName("左侧间距")] [Range(-30, 100)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public int? MarginLeft { get; set; } /// - /// 右侧间距 + /// 获得/设置 右侧间距 默认 null 未设置 /// - [DisplayName("右侧间距")] - [Range(-30, 100)] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public int? MarginRight { get; set; } /// - /// 底线平整 (仅EAN8/EAN13) / Only for EAN8/EAN13 + /// 获得/设置 底线平整 默认 false (仅EAN8/EAN13) 有效 /// - [DisplayName("底线平整 (仅EAN8/EAN13)")] - public bool Flat { get; set; } - - + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] + public bool? Flat { get; set; } } diff --git a/src/components/BootstrapBlazor.BarcodeGenerator/BarcodeGeneratorOptionsExtensions.cs b/src/components/BootstrapBlazor.BarcodeGenerator/BarcodeGeneratorOptionsExtensions.cs new file mode 100644 index 0000000..cbcfdef --- /dev/null +++ b/src/components/BootstrapBlazor.BarcodeGenerator/BarcodeGeneratorOptionsExtensions.cs @@ -0,0 +1,118 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Website: https://www.blazor.zone or https://argozhang.github.io/ + +namespace BootstrapBlazor.Components; + +static class BarcodeGeneratorOptionsExtensions +{ + /// + /// 检查是否相同方法 + /// + /// + /// + /// + public static bool DifferAndAssign(this BarcodeGeneratorOption options, BarcodeGeneratorOption? source) + { + var ret = false; + if (source != null) + { + if (options.Format != source.Format) + { + options.Format = source.Format; + ret = true; + } + if (options.Width != source.Width) + { + options.Width = source.Width; + ret = true; + } + if (options.Height != source.Height) + { + options.Height = source.Height; + ret = true; + } + if (options.DisplayValue != source.DisplayValue) + { + options.DisplayValue = source.DisplayValue; + ret = true; + } + if (options.Text != source.Text) + { + options.Text = source.Text; + ret = true; + } + if (options.FontOptions != source.FontOptions) + { + options.FontOptions = source.FontOptions; + ret = true; + } + if (options.Font != source.Font) + { + options.Font = source.Font; + ret = true; + } + if (options.TextAlign != source.TextAlign) + { + options.TextAlign = source.TextAlign; + ret = true; + } + if (options.TextPosition != source.TextPosition) + { + options.TextPosition = source.TextPosition; + ret = true; + } + if (options.TextMargin != source.TextMargin) + { + options.TextMargin = source.TextMargin; + ret = true; + } + if (options.FontSize != source.FontSize) + { + options.FontSize = source.FontSize; + ret = true; + } + if (options.Background != source.Background) + { + options.Background = source.Background; + ret = true; + } + if (options.LineColor != source.LineColor) + { + options.LineColor = source.LineColor; + ret = true; + } + if (options.Margin != source.Margin) + { + options.Margin = source.Margin; + ret = true; + } + if (options.MarginTop != source.MarginTop) + { + options.MarginTop = source.MarginTop; + ret = true; + } + if (options.MarginBottom != source.MarginBottom) + { + options.MarginBottom = source.MarginBottom; + ret = true; + } + if (options.MarginLeft != source.MarginLeft) + { + options.MarginLeft = source.MarginLeft; + ret = true; + } + if (options.MarginRight != source.MarginRight) + { + options.MarginRight = source.MarginRight; + ret = true; + } + if (options.Flat != source.Flat) + { + options.Flat = source.Flat; + ret = true; + } + } + return ret; + } +} diff --git a/src/components/BootstrapBlazor.BarcodeGenerator/BootstrapBlazor.BarcodeGenerator.csproj b/src/components/BootstrapBlazor.BarcodeGenerator/BootstrapBlazor.BarcodeGenerator.csproj index dd69c29..ad34123 100644 --- a/src/components/BootstrapBlazor.BarcodeGenerator/BootstrapBlazor.BarcodeGenerator.csproj +++ b/src/components/BootstrapBlazor.BarcodeGenerator/BootstrapBlazor.BarcodeGenerator.csproj @@ -1,41 +1,16 @@ - - net6.0;net7.0;net8.0 - enable - enable - - - 0.1.1 - https://github.com/densen2014/BootstrapBlazor.BarcodeGenerator - https://github.com/densen2014/BootstrapBlazor.BarcodeGenerator - git - Bootstrap Blazor BarcodeGenerator 条码生成器 组件 - Bootstrap UI BarcodeGenerator components experience - BootstrapBlazor.BarcodeGenerator - BootstrapBlazor.BarcodeGenerator - ..\keys\Longbow.Utility.snk - True - ..\..\..\Bin - + + 8.1.0 + - - - + + Bootstrap Blazor WebAssembly wasm UI Components Barcode + Bootstrap UI components extensions of Barcode Generator + - - - + + + - - - - - - - - - - - diff --git a/src/components/BootstrapBlazor.BarcodeGenerator/EnumBarcodeFormat.cs b/src/components/BootstrapBlazor.BarcodeGenerator/EnumBarcodeFormat.cs new file mode 100644 index 0000000..3807928 --- /dev/null +++ b/src/components/BootstrapBlazor.BarcodeGenerator/EnumBarcodeFormat.cs @@ -0,0 +1,87 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Website: https://www.blazor.zone or https://argozhang.github.io/ + +using System.ComponentModel; + +namespace BootstrapBlazor.Components; + +/// +/// 条码类型 +/// +public enum EnumBarcodeFormat +{ + /// + /// + /// + CODE128, + /// + /// + /// + CODE128A, + /// + /// + /// + CODE128B, + /// + /// + /// + CODE128C, + /// + /// + /// + EAN13, + /// + /// + /// + EAN8, + /// + /// + /// + EAN5, + /// + /// + /// + EAN2, + /// + /// + /// + UPC, + /// + /// + /// + CODE39, + /// + /// + /// + ITF14, + /// + /// + /// + ITF, + /// + /// + /// + MSI, + /// + /// + /// + MSI10, + /// + /// + /// + MSI11, + /// + /// + /// + MSI1010, + /// + /// + /// + MSI1110, + /// + /// + /// + [Description("pharmacode")] + Pharmacode +} diff --git a/src/components/BootstrapBlazor.BarcodeGenerator/EnumBarcodeTextAlign.cs b/src/components/BootstrapBlazor.BarcodeGenerator/EnumBarcodeTextAlign.cs new file mode 100644 index 0000000..5cb1966 --- /dev/null +++ b/src/components/BootstrapBlazor.BarcodeGenerator/EnumBarcodeTextAlign.cs @@ -0,0 +1,24 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Website: https://www.blazor.zone or https://argozhang.github.io/ + +namespace BootstrapBlazor.Components; + +/// +/// 条码文本对齐方式 +/// +public enum EnumBarcodeTextAlign +{ + /// + /// + /// + Left, + /// + /// + /// + Center, + /// + /// + /// + Right, +} diff --git a/src/components/BootstrapBlazor.BarcodeGenerator/EnumBarcodeTextFont.cs b/src/components/BootstrapBlazor.BarcodeGenerator/EnumBarcodeTextFont.cs new file mode 100644 index 0000000..833b7e5 --- /dev/null +++ b/src/components/BootstrapBlazor.BarcodeGenerator/EnumBarcodeTextFont.cs @@ -0,0 +1,32 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Website: https://www.blazor.zone or https://argozhang.github.io/ + +namespace BootstrapBlazor.Components; + +/// +/// 条码文本字体 +/// +public enum EnumBarcodeTextFont +{ + /// + /// + /// + Monospace, + /// + /// + /// + SansSerif, + /// + /// + /// + Serif, + /// + /// + /// + Fantasy, + /// + /// + /// + Cursive, +} diff --git a/src/components/BootstrapBlazor.BarcodeGenerator/EnumBarcodeTextFontOption.cs b/src/components/BootstrapBlazor.BarcodeGenerator/EnumBarcodeTextFontOption.cs new file mode 100644 index 0000000..6bd3a94 --- /dev/null +++ b/src/components/BootstrapBlazor.BarcodeGenerator/EnumBarcodeTextFontOption.cs @@ -0,0 +1,28 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Website: https://www.blazor.zone or https://argozhang.github.io/ + +namespace BootstrapBlazor.Components; + +/// +/// 条码文本字体设置 +/// +public enum EnumBarcodeTextFontOption +{ + /// + /// + /// + Normal, + /// + /// + /// + Bold, + /// + /// + /// + Italic, + /// + /// + /// + Bold_Italic, +} diff --git a/src/components/BootstrapBlazor.BarcodeGenerator/EnumBarcodeTextPosition.cs b/src/components/BootstrapBlazor.BarcodeGenerator/EnumBarcodeTextPosition.cs new file mode 100644 index 0000000..3d55d58 --- /dev/null +++ b/src/components/BootstrapBlazor.BarcodeGenerator/EnumBarcodeTextPosition.cs @@ -0,0 +1,20 @@ +// Copyright (c) Argo Zhang (argo@163.com). All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +// Website: https://www.blazor.zone or https://argozhang.github.io/ + +namespace BootstrapBlazor.Components; + +/// +/// 条码文本位置 +/// +public enum EnumBarcodeTextPosition +{ + /// + /// 底部 + /// + Bottom, + /// + /// 顶部 + /// + Top, +} diff --git a/src/components/BootstrapBlazor.BarcodeGenerator/EnumBarcodeType.cs b/src/components/BootstrapBlazor.BarcodeGenerator/EnumBarcodeType.cs deleted file mode 100644 index 9793687..0000000 --- a/src/components/BootstrapBlazor.BarcodeGenerator/EnumBarcodeType.cs +++ /dev/null @@ -1,88 +0,0 @@ -// ********************************** -// Densen Informatica 中讯科技 -// 作者:Alex Chow -// e-mail:zhouchuanglin@gmail.com -// ********************************** - -using System.ComponentModel; -using System.Runtime.Serialization; -using System.Text.Json.Serialization; - -namespace BootstrapBlazor.Components; - -/// -/// 条码类型 -/// -[JsonConverter(typeof(JsonStringEnumConverter))] -public enum EnumBarcodeType -{ - CODE128, - CODE128A, - CODE128B, - CODE128C, - EAN13, - EAN8, - EAN5, - EAN2, - UPC, - CODE39, - ITF14, - ITF, - MSI, - MSI10, - MSI11, - MSI1010, - MSI1110, - pharmacode, -} - -[JsonConverter(typeof(JsonStringEnumConverter))] -public enum EnumBarcodeTextAlign -{ - [Description("左对齐")] - left, - - [Description("居中")] - center, - - [Description("右对齐")] - right, -} - -[JsonConverter(typeof(JsonStringEnumConverter))] -public enum EnumTextPosition -{ - [Description("底部")] - bottom, - - [Description("顶部")] - top, -} - -[JsonConverter(typeof(JsonStringEnumConverter))] -public enum EnumBarcodeFont -{ - Monospace, - SansSerif, - Serif, - Fantasy, - Cursive, -} - -[JsonConverter(typeof(JsonStringEnumConverter))] -public enum EnumBarcodeFontOption -{ - [Description("一般")] - [EnumMember(Value = "")] - normal, - - [Description("加粗")] - bold, - - [Description("斜体")] - italic, - - [Description("加粗斜体")] - [EnumMember(Value = "bold italic")] - bold_italic, -} diff --git a/src/components/BootstrapBlazor.BarcodeGenerator/wwwroot/JsBarcode.all.min.js b/src/components/BootstrapBlazor.BarcodeGenerator/wwwroot/JsBarcode.all.min.js index 289aa08..94da1c2 100644 --- a/src/components/BootstrapBlazor.BarcodeGenerator/wwwroot/JsBarcode.all.min.js +++ b/src/components/BootstrapBlazor.BarcodeGenerator/wwwroot/JsBarcode.all.min.js @@ -1,2 +1,2 @@ -/*! JsBarcode v3.11.0 | (c) Johan Lindell | MIT license */ -!function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=20)}([function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function t(e,n){r(this,t),this.data=e,this.text=n.text||e,this.options=n};e.default=o},function(t,e,n){"use strict";function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Object.defineProperty(e,"__esModule",{value:!0});var o,i=e.SET_A=0,u=e.SET_B=1,a=e.SET_C=2,f=(e.SHIFT=98,e.START_A=103),c=e.START_B=104,s=e.START_C=105;e.MODULO=103,e.STOP=106,e.FNC1=207,e.SET_BY_CODE=(o={},r(o,f,i),r(o,c,u),r(o,s,a),o),e.SWAP={101:i,100:u,99:a},e.A_START_CHAR=String.fromCharCode(208),e.B_START_CHAR=String.fromCharCode(209),e.C_START_CHAR=String.fromCharCode(210),e.A_CHARS="[\0-_È-Ï]",e.B_CHARS="[ -È-Ï]",e.C_CHARS="(Ï*[0-9]{2}Ï*)",e.BARS=[11011001100,11001101100,11001100110,10010011e3,10010001100,10001001100,10011001e3,10011000100,10001100100,11001001e3,11001000100,11000100100,10110011100,10011011100,10011001110,10111001100,10011101100,10011100110,11001110010,11001011100,11001001110,11011100100,11001110100,11101101110,11101001100,11100101100,11100100110,11101100100,11100110100,11100110010,11011011e3,11011000110,11000110110,10100011e3,10001011e3,10001000110,10110001e3,10001101e3,10001100010,11010001e3,11000101e3,11000100010,10110111e3,10110001110,10001101110,10111011e3,10111000110,10001110110,11101110110,11010001110,11000101110,11011101e3,11011100010,11011101110,11101011e3,11101000110,11100010110,11101101e3,11101100010,11100011010,11101111010,11001000010,11110001010,1010011e4,10100001100,1001011e4,10010000110,10000101100,10000100110,1011001e4,10110000100,1001101e4,10011000010,10000110100,10000110010,11000010010,1100101e4,11110111010,11000010100,10001111010,10100111100,10010111100,10010011110,10111100100,10011110100,10011110010,11110100100,11110010100,11110010010,11011011110,11011110110,11110110110,10101111e3,10100011110,10001011110,10111101e3,10111100010,11110101e3,11110100010,10111011110,10111101110,11101011110,11110101110,11010000100,1101001e4,11010011100,1100011101011]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.SIDE_BIN="101",e.MIDDLE_BIN="01010",e.BINARIES={L:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],G:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"],R:["1110010","1100110","1101100","1000010","1011100","1001110","1010000","1000100","1001000","1110100"],O:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],E:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"]},e.EAN2_STRUCTURE=["LL","LG","GL","GG"],e.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],e.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2),o=function(t,e,n){var o=t.split("").map(function(t,n){return r.BINARIES[e[n]]}).map(function(e,n){return e?e[t[n]]:""});if(n){var i=t.length-1;o=o.map(function(t,e){return e=200){i=t.shift()-105;var u=c.SWAP[i];void 0!==u?o=e.next(t,n+1,u):(r!==c.SET_A&&r!==c.SET_B||i!==c.SHIFT||(t[0]=r===c.SET_A?t[0]>95?t[0]-96:t[0]:t[0]<32?t[0]+96:t[0]),o=e.next(t,n+1,r))}else i=e.correctIndex(t,r),o=e.next(t,n+1,r);var a=e.getBar(i),f=i*n;return{result:a+o.result,checksum:f+o.checksum}}}]),e}(f.default);e.default=s},function(t,e,n){"use strict";function r(t){for(var e=0,n=0;n10*n.width?10*n.width:n.fontSize,r.guardHeight=n.height+r.fontSize/2+n.textMargin,r}return u(e,t),a(e,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(t,e){return this.text.substr(t,e)}},{key:"leftEncode",value:function(t,e){return(0,s.default)(t,e)}},{key:"rightText",value:function(t,e){return this.text.substr(t,e)}},{key:"rightEncode",value:function(t,e){return(0,s.default)(t,e)}},{key:"encodeGuarded",value:function(){var t={fontSize:this.fontSize},e={height:this.guardHeight};return[{data:f.SIDE_BIN,options:e},{data:this.leftEncode(),text:this.leftText(),options:t},{data:f.MIDDLE_BIN,options:e},{data:this.rightEncode(),text:this.rightText(),options:t},{data:f.SIDE_BIN,options:e}]}},{key:"encodeFlat",value:function(){return{data:[f.SIDE_BIN,this.leftEncode(),f.MIDDLE_BIN,this.rightEncode(),f.SIDE_BIN].join(""),text:this.text}}}]),e}(p.default);e.default=d},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t){var e,n=0;for(e=1;e<11;e+=2)n+=parseInt(t[e]);for(e=0;e<11;e+=2)n+=3*parseInt(t[e]);return(10-n%10)%10}Object.defineProperty(e,"__esModule",{value:!0});var f=function(){function t(t,e){for(var n=0;n10*n.width?r.fontSize=10*n.width:r.fontSize=n.fontSize,r.guardHeight=n.height+r.fontSize/2+n.textMargin,r}return u(e,t),f(e,[{key:"valid",value:function(){return-1!==this.data.search(/^[0-9]{12}$/)&&this.data[11]==a(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var t="";return t+="101",t+=(0,s.default)(this.data.substr(0,6),"LLLLLL"),t+="01010",t+=(0,s.default)(this.data.substr(6,6),"RRRRRR"),t+="101",{data:t,text:this.text}}},{key:"guardedEncoding",value:function(){var t=[];return this.displayValue&&t.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),t.push({data:"101"+(0,s.default)(this.data[0],"L"),options:{height:this.guardHeight}}),t.push({data:(0,s.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),t.push({data:"01010",options:{height:this.guardHeight}}),t.push({data:(0,s.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),t.push({data:(0,s.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&t.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),t}}]),e}(p.default);e.default=d},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var n=0;n0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function o(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e}function f(t,e,n){var r;if(n)r=n;else{if("undefined"==typeof document)return 0;r=document.createElement("canvas").getContext("2d")}return r.font=e.fontOptions+" "+e.fontSize+"px "+e.font,r.measureText(t).width}Object.defineProperty(e,"__esModule",{value:!0}),e.getTotalWidthOfEncodings=e.calculateEncodingAttributes=e.getBarcodePadding=e.getEncodingHeight=e.getMaximumHeightOfEncodings=void 0;var c=n(5),s=function(t){return t&&t.__esModule?t:{default:t}}(c);e.getMaximumHeightOfEncodings=a,e.getEncodingHeight=r,e.getBarcodePadding=o,e.calculateEncodingAttributes=i,e.getTotalWidthOfEncodings=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(27),o=n(26),i=n(33),u=n(37),a=n(42),f=n(44),c=n(43),s=n(34);e.default={CODE39:r.CODE39,CODE128:o.CODE128,CODE128A:o.CODE128A,CODE128B:o.CODE128B,CODE128C:o.CODE128C,EAN13:i.EAN13,EAN8:i.EAN8,EAN5:i.EAN5,EAN2:i.EAN2,UPC:i.UPC,UPCE:i.UPCE,ITF14:u.ITF14,ITF:u.ITF,MSI:a.MSI,MSI10:a.MSI10,MSI11:a.MSI11,MSI1010:a.MSI1010,MSI1110:a.MSI1110,pharmacode:f.pharmacode,codabar:c.codabar,GenericBarcode:s.GenericBarcode}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n=a(t);return e+String.fromCharCode(o?206:205)+r(t,o)}Object.defineProperty(e,"__esModule",{value:!0});var i=n(1),u=function(t){return t.match(new RegExp("^"+i.A_CHARS+"*"))[0].length},a=function(t){return t.match(new RegExp("^"+i.B_CHARS+"*"))[0].length},f=function(t){return t.match(new RegExp("^"+i.C_CHARS+"*"))[0]};e.default=function(t){var e=void 0;if(f(t).length>=2)e=i.C_START_CHAR+o(t);else{var n=u(t)>a(t);e=(n?i.A_START_CHAR:i.B_START_CHAR)+r(t,n)}return e.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,function(t,e){return String.fromCharCode(203)+e})}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.CODE128C=e.CODE128B=e.CODE128A=e.CODE128=void 0;var o=n(24),i=r(o),u=n(21),a=r(u),f=n(22),c=r(f),s=n(23),l=r(s);e.CODE128=i.default,e.CODE128A=a.default,e.CODE128B=c.default,e.CODE128C=l.default},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function u(t){return a(c(t))}function a(t){return b[t].toString(2)}function f(t){return y[t]}function c(t){return y.indexOf(t)}function s(t){for(var e=0,n=0;n10*n.width?r.fontSize=10*n.width:r.fontSize=n.fontSize,r.guardHeight=n.height+r.fontSize/2+n.textMargin,r}return u(e,t),f(e,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var t="";return t+="101",t+=this.encodeMiddleDigits(),t+="010101",{data:t,text:this.text}}},{key:"guardedEncoding",value:function(){var t=[];return this.displayValue&&t.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),t.push({data:"101",options:{height:this.guardHeight}}),t.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),t.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&t.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),t}},{key:"encodeMiddleDigits",value:function(){var t=this.upcA[0],e=this.upcA[this.upcA.length-1],n=y[parseInt(e)][parseInt(t)];return(0,s.default)(this.middleDigits,n)}}]),e}(p.default);e.default=b},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.UPCE=e.UPC=e.EAN2=e.EAN5=e.EAN8=e.EAN13=void 0;var o=n(28),i=r(o),u=n(31),a=r(u),f=n(30),c=r(f),s=n(29),l=r(s),p=n(12),d=r(p),h=n(32),y=r(h);e.EAN13=i.default,e.EAN8=a.default,e.EAN5=c.default,e.EAN2=l.default,e.UPC=d.default,e.UPCE=y.default},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0}),e.GenericBarcode=void 0;var u=function(){function t(t,e){for(var n=0;n=3&&this.number<=131070}}]),e}(f.default);e.pharmacode=c},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){var e={};for(var n in f.default)f.default.hasOwnProperty(n)&&(t.hasAttribute("jsbarcode-"+n.toLowerCase())&&(e[n]=t.getAttribute("jsbarcode-"+n.toLowerCase())),t.hasAttribute("data-"+n.toLowerCase())&&(e[n]=t.getAttribute("data-"+n.toLowerCase())));return e.value=t.getAttribute("jsbarcode-value")||t.getAttribute("data-value"),e=(0,u.default)(e)}Object.defineProperty(e,"__esModule",{value:!0});var i=n(9),u=r(i),a=n(10),f=r(a);e.default=o},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n0?(o=0,n.textAlign="left"):"right"==t.textAlign?(o=e.width-1,n.textAlign="right"):(o=e.width/2,n.textAlign="center"),n.fillText(e.text,o,i)}}},{key:"moveCanvasDrawing",value:function(t){this.canvas.getContext("2d").translate(t.width,0)}},{key:"restoreCanvas",value:function(){this.canvas.getContext("2d").restore()}}]),t}();e.default=f},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(46),i=r(o),u=n(49),a=r(u),f=n(48),c=r(f);e.default={CanvasRenderer:i.default,SVGRenderer:a.default,ObjectRenderer:c.default}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n0&&(this.drawRect(u-e.width*i,r,e.width*i,e.height,t),i=0);i>0&&this.drawRect(u-e.width*(i-1),r,e.width*i,e.height,t)}},{key:"drawSVGText",value:function(t,e,n){var r=this.document.createElementNS(f,"text");if(e.displayValue){var o,i;r.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),i="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(o=0,r.setAttribute("text-anchor","start")):"right"==e.textAlign?(o=n.width-1,r.setAttribute("text-anchor","end")):(o=n.width/2,r.setAttribute("text-anchor","middle")),r.setAttribute("x",o),r.setAttribute("y",i),r.appendChild(this.document.createTextNode(n.text)),t.appendChild(r)}}},{key:"setSvgAttributes",value:function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",f),n.setAttribute("version","1.1"),n.setAttribute("style","transform: translate(0,0)")}},{key:"createGroup",value:function(t,e,n){var r=this.document.createElementNS(f,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}},{key:"setGroupOptions",value:function(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}},{key:"drawRect",value:function(t,e,n,r,o){var i=this.document.createElementNS(f,"rect");return i.setAttribute("x",t),i.setAttribute("y",e),i.setAttribute("width",n),i.setAttribute("height",r),o.appendChild(i),i}}]),t}();e.default=c}]); \ No newline at end of file +/*! JsBarcode v3.11.6 | (c) Johan Lindell | MIT license */ +!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=15)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default=function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.data=e,this.text=n.text||e,this.options=n}},function(t,e,n){"use strict";var r;function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Object.defineProperty(e,"__esModule",{value:!0});var i=e.SET_A=0,a=e.SET_B=1,u=e.SET_C=2,f=(e.SHIFT=98,e.START_A=103),c=e.START_B=104,s=e.START_C=105;e.MODULO=103,e.STOP=106,e.FNC1=207,e.SET_BY_CODE=(o(r={},f,i),o(r,c,a),o(r,s,u),r),e.SWAP={101:i,100:a,99:u},e.A_START_CHAR=String.fromCharCode(208),e.B_START_CHAR=String.fromCharCode(209),e.C_START_CHAR=String.fromCharCode(210),e.A_CHARS="[\0-_È-Ï]",e.B_CHARS="[ -È-Ï]",e.C_CHARS="(Ï*[0-9]{2}Ï*)",e.BARS=[11011001100,11001101100,11001100110,10010011e3,10010001100,10001001100,10011001e3,10011000100,10001100100,11001001e3,11001000100,11000100100,10110011100,10011011100,10011001110,10111001100,10011101100,10011100110,11001110010,11001011100,11001001110,11011100100,11001110100,11101101110,11101001100,11100101100,11100100110,11101100100,11100110100,11100110010,11011011e3,11011000110,11000110110,10100011e3,10001011e3,10001000110,10110001e3,10001101e3,10001100010,11010001e3,11000101e3,11000100010,10110111e3,10110001110,10001101110,10111011e3,10111000110,10001110110,11101110110,11010001110,11000101110,11011101e3,11011100010,11011101110,11101011e3,11101000110,11100010110,11101101e3,11101100010,11100011010,11101111010,11001000010,11110001010,1010011e4,10100001100,1001011e4,10010000110,10000101100,10000100110,1011001e4,10110000100,1001101e4,10011000010,10000110100,10000110010,11000010010,1100101e4,11110111010,11000010100,10001111010,10100111100,10010111100,10010011110,10111100100,10011110100,10011110010,11110100100,11110010100,11110010010,11011011110,11011110110,11110110110,10101111e3,10100011110,10001011110,10111101e3,10111100010,11110101e3,11110100010,10111011110,10111101110,11101011110,11110101110,11010000100,1101001e4,11010011100,1100011101011]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.SIDE_BIN="101",e.MIDDLE_BIN="01010",e.BINARIES={L:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],G:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"],R:["1110010","1100110","1101100","1000010","1011100","1001110","1010000","1000100","1001000","1110100"],O:["0001101","0011001","0010011","0111101","0100011","0110001","0101111","0111011","0110111","0001011"],E:["0100111","0110011","0011011","0100001","0011101","0111001","0000101","0010001","0001001","0010111"]},e.EAN2_STRUCTURE=["LL","LG","GL","GG"],e.EAN5_STRUCTURE=["GGLLL","GLGLL","GLLGL","GLLLG","LGGLL","LLGGL","LLLGG","LGLGL","LGLLG","LLGLG"],e.EAN13_STRUCTURE=["LLLLLL","LLGLGG","LLGGLG","LLGGGL","LGLLGG","LGGLLG","LGGGLL","LGLGLG","LGLGGL","LGGLGL"]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(2);e.default=function(t,e,n){var o=t.split("").map((function(t,n){return r.BINARIES[e[n]]})).map((function(e,n){return e?e[t[n]]:""}));if(n){var i=t.length-1;o=o.map((function(t,e){return e=200){i=t.shift()-105;var a=u.SWAP[i];void 0!==a?o=e.next(t,n+1,a):(r!==u.SET_A&&r!==u.SET_B||i!==u.SHIFT||(t[0]=r===u.SET_A?t[0]>95?t[0]-96:t[0]:t[0]<32?t[0]+96:t[0]),o=e.next(t,n+1,r))}else i=e.correctIndex(t,r),o=e.next(t,n+1,r);var f=i*n;return{result:e.getBar(i)+o.result,checksum:f+o.checksum}}}]),e}(a.default);e.default=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.mod10=function(t){for(var e=0,n=0;n10*n.width?10*n.width:n.fontSize,r.guardHeight=n.height+r.fontSize/2+n.textMargin,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),r(e,[{key:"encode",value:function(){return this.options.flat?this.encodeFlat():this.encodeGuarded()}},{key:"leftText",value:function(t,e){return this.text.substr(t,e)}},{key:"leftEncode",value:function(t,e){return(0,i.default)(t,e)}},{key:"rightText",value:function(t,e){return this.text.substr(t,e)}},{key:"rightEncode",value:function(t,e){return(0,i.default)(t,e)}},{key:"encodeGuarded",value:function(){var t={fontSize:this.fontSize},e={height:this.guardHeight};return[{data:o.SIDE_BIN,options:e},{data:this.leftEncode(),text:this.leftText(),options:t},{data:o.MIDDLE_BIN,options:e},{data:this.rightEncode(),text:this.rightText(),options:t},{data:o.SIDE_BIN,options:e}]}},{key:"encodeFlat",value:function(){return{data:[o.SIDE_BIN,this.leftEncode(),o.MIDDLE_BIN,this.rightEncode(),o.SIDE_BIN].join(""),text:this.text}}}]),e}(a(n(0)).default);e.default=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n10*n.width?r.fontSize=10*n.width:r.fontSize=n.fontSize,r.guardHeight=n.height+r.fontSize/2+n.textMargin,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),r(e,[{key:"valid",value:function(){return-1!==this.data.search(/^[0-9]{12}$/)&&this.data[11]==u(this.data)}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var t="";return t+="101",t+=(0,o.default)(this.data.substr(0,6),"LLLLLL"),t+="01010",t+=(0,o.default)(this.data.substr(6,6),"RRRRRR"),{data:t+="101",text:this.text}}},{key:"guardedEncoding",value:function(){var t=[];return this.displayValue&&t.push({data:"00000000",text:this.text.substr(0,1),options:{textAlign:"left",fontSize:this.fontSize}}),t.push({data:"101"+(0,o.default)(this.data[0],"L"),options:{height:this.guardHeight}}),t.push({data:(0,o.default)(this.data.substr(1,5),"LLLLL"),text:this.text.substr(1,5),options:{fontSize:this.fontSize}}),t.push({data:"01010",options:{height:this.guardHeight}}),t.push({data:(0,o.default)(this.data.substr(6,5),"RRRRR"),text:this.text.substr(6,5),options:{fontSize:this.fontSize}}),t.push({data:(0,o.default)(this.data[11],"R")+"101",options:{height:this.guardHeight}}),this.displayValue&&t.push({data:"00000000",text:this.text.substr(11,1),options:{textAlign:"right",fontSize:this.fontSize}}),t}}]),e}(i(n(0)).default);function u(t){var e,n=0;for(e=1;e<11;e+=2)n+=parseInt(t[e]);for(e=0;e<11;e+=2)n+=3*parseInt(t[e]);return(10-n%10)%10}e.default=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=function(){function t(t,e){for(var n=0;n0?e.fontSize+e.textMargin:0)+e.marginTop+e.marginBottom}function u(t,e,n){if(n.displayValue&&ee&&(e=t[n].height);return e},e.getEncodingHeight=a,e.getBarcodePadding=u,e.calculateEncodingAttributes=function(t,e,n){for(var r=0;r=i(t);return e+String.fromCharCode(r?206:205)+u(t,r)}e.default=function(t){var e=void 0;if(a(t).length>=2)e=r.C_START_CHAR+f(t);else{var n=o(t)>i(t);e=(n?r.A_START_CHAR:r.B_START_CHAR)+u(t,n)}return e.replace(/[\xCD\xCE]([^])[\xCD\xCE]/,(function(t,e){return String.fromCharCode(203)+e}))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=function(){function t(t,e){for(var n=0;n10*n.width?r.fontSize=10*n.width:r.fontSize=n.fontSize,r.guardHeight=n.height+r.fontSize/2+n.textMargin,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),r(e,[{key:"valid",value:function(){return this.isValid}},{key:"encode",value:function(){return this.options.flat?this.flatEncoding():this.guardedEncoding()}},{key:"flatEncoding",value:function(){var t="";return t+="101",t+=this.encodeMiddleDigits(),{data:t+="010101",text:this.text}}},{key:"guardedEncoding",value:function(){var t=[];return this.displayValue&&t.push({data:"00000000",text:this.text[0],options:{textAlign:"left",fontSize:this.fontSize}}),t.push({data:"101",options:{height:this.guardHeight}}),t.push({data:this.encodeMiddleDigits(),text:this.text.substring(1,7),options:{fontSize:this.fontSize}}),t.push({data:"010101",options:{height:this.guardHeight}}),this.displayValue&&t.push({data:"00000000",text:this.text[7],options:{textAlign:"right",fontSize:this.fontSize}}),t}},{key:"encodeMiddleDigits",value:function(){var t=this.upcA[0],e=this.upcA[this.upcA.length-1],n=s[parseInt(e)][parseInt(t)];return(0,o.default)(this.middleDigits,n)}}]),e}(i.default);function p(t,e){for(var n=parseInt(t[t.length-1]),r=c[n],o="",i=0,u=0;u=3&&this.number<=131070}}]),e}(((r=i)&&r.__esModule?r:{default:r}).default);e.pharmacode=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.codabar=void 0;var r,o=function(){function t(t,e){for(var n=0;n0?(n=0,o.textAlign="left"):"right"==t.textAlign?(n=e.width-1,o.textAlign="right"):(n=e.width/2,o.textAlign="center"),o.fillText(e.text,n,r))}},{key:"moveCanvasDrawing",value:function(t){this.canvas.getContext("2d").translate(t.width,0)}},{key:"restoreCanvas",value:function(){this.canvas.getContext("2d").restore()}}]),t}();e.default=f},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,o=function(){function t(t,e){for(var n=0;n0&&(this.drawRect(a-e.width*i,r,e.width*i,e.height,t),i=0);i>0&&this.drawRect(a-e.width*(i-1),r,e.width*i,e.height,t)}},{key:"drawSVGText",value:function(t,e,n){var r,o,i=this.document.createElementNS(f,"text");e.displayValue&&(i.setAttribute("style","font:"+e.fontOptions+" "+e.fontSize+"px "+e.font),o="top"==e.textPosition?e.fontSize-e.textMargin:e.height+e.textMargin+e.fontSize,"left"==e.textAlign||n.barcodePadding>0?(r=0,i.setAttribute("text-anchor","start")):"right"==e.textAlign?(r=n.width-1,i.setAttribute("text-anchor","end")):(r=n.width/2,i.setAttribute("text-anchor","middle")),i.setAttribute("x",r),i.setAttribute("y",o),i.appendChild(this.document.createTextNode(n.text)),t.appendChild(i))}},{key:"setSvgAttributes",value:function(t,e){var n=this.svg;n.setAttribute("width",t+"px"),n.setAttribute("height",e+"px"),n.setAttribute("x","0px"),n.setAttribute("y","0px"),n.setAttribute("viewBox","0 0 "+t+" "+e),n.setAttribute("xmlns",f),n.setAttribute("version","1.1"),n.setAttribute("style","transform: translate(0,0)")}},{key:"createGroup",value:function(t,e,n){var r=this.document.createElementNS(f,"g");return r.setAttribute("transform","translate("+t+", "+e+")"),n.appendChild(r),r}},{key:"setGroupOptions",value:function(t,e){t.setAttribute("style","fill:"+e.lineColor+";")}},{key:"drawRect",value:function(t,e,n,r,o){var i=this.document.createElementNS(f,"rect");return i.setAttribute("x",t),i.setAttribute("y",e),i.setAttribute("width",n),i.setAttribute("height",r),o.appendChild(i),i}}]),t}();e.default=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n + + + . . . + + + + . . . + + + + +``` + +3. Open the `~/Startup.cs` file in the and register the `Bootstrap Blazor` service: + + **C#** + +``` +namespace BootstrapBlazorAppName +{ + public class Startup + { + public void ConfigureServices(IServiceCollection services) + { + //more code may be present here + services.AddBootstrapBlazor(); + } + + //more code may be present here + } +} +``` + +## Visual Studio Integration + +To create a new `Bootstrap Blazor` UI for Blazor application, use the Create New Project Wizard. The wizard detects all installed versions of `Bootstrap Blazor` for Blazor and lists them in the Version combobox—this enables you to start your project with the desired version. You can also get the latest version to make sure you are up to date. + +1. Get the Wizard + +To use the Create New Project Wizard, install the `Bootstrap Blazor` UI for Blazor Visual Studio Extensions. You can get it from the: + +- Visual Studio Marketplace (for Windows) + +2. Start the Wizard + +To start the wizard, use either of the following approaches + +### Using the Project menu: + +- Click File > New > Project. +- Find and click the C# Blazor Application option (you can use the search, or filter by Blazor templates). +- Follow the wizard.