!3521 feat(#I60FH2): extensions package support NET7

* chore: 更新依赖包到 V7
* fix: 修复首次加载 lastValue 赋值
* refactor: 重构代码消除警告信息
* refactor: 重构代码消除警告信息
* chore: 更新组件版本 7.0
* refactor: 数据库扩展更新版本到 7.0
* chore: 移除 localizer 解决方案文件夹
* refactor: 中间件支持 NET7
This commit is contained in:
Argo 2022-11-10 02:42:21 +00:00
parent 40ec85b682
commit 8862ad7c04
22 changed files with 70 additions and 310 deletions

View File

@ -130,9 +130,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTestEditor", "test\Unit
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BootstrapBlazor.Topology", "src\Extensions\Components\BootstrapBlazor.Topology\BootstrapBlazor.Topology.csproj", "{6312863E-771D-4EFE-9B9D-071A01222E7A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BootstrapBlazor.BarCode", "src\Extensions\Components\BootstrapBlazor.BarCode\BootstrapBlazor.BarCode.csproj", "{7F7F3B85-7B15-485C-8DC2-BAFD8C086957}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "localizer", "localizer", "{699C2CBB-AAF3-4F70-B5D0-A3EDBD5D73B8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BootstrapBlazor.BarCode", "src\Extensions\Components\BootstrapBlazor.BarCode\BootstrapBlazor.BarCode.csproj", "{7F7F3B85-7B15-485C-8DC2-BAFD8C086957}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "localization", "localization", "{1BA43FCA-FA64-449E-A1F1-9C2C4A1D2D3F}"
ProjectSection(SolutionItems) = preProject

View File

@ -18,17 +18,17 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor.BaiduSpeech" Version="6.0.9" />
<PackageReference Include="BootstrapBlazor.BarCode" Version="6.4.0" />
<PackageReference Include="BootstrapBlazor.Chart" Version="6.*" />
<PackageReference Include="BootstrapBlazor.CherryMarkdown" Version="6.1.1" />
<PackageReference Include="BootstrapBlazor.FontAwesome" Version="6.3.0" />
<PackageReference Include="BootstrapBlazor.Markdown" Version="6.3.2" />
<PackageReference Include="BootstrapBlazor.BaiduSpeech" Version="7.0.0" />
<PackageReference Include="BootstrapBlazor.BarCode" Version="7.0.0" />
<PackageReference Include="BootstrapBlazor.Chart" Version="7.0.0" />
<PackageReference Include="BootstrapBlazor.CherryMarkdown" Version="7.0.0" />
<PackageReference Include="BootstrapBlazor.FontAwesome" Version="7.0.0" />
<PackageReference Include="BootstrapBlazor.Markdown" Version="7.0.0" />
<PackageReference Include="BootstrapBlazor.OnScreenKeyboard" Version="6.0.7" />
<PackageReference Include="BootstrapBlazor.SignaturePad" Version="6.0.7" />
<PackageReference Include="BootstrapBlazor.SummerNote" Version="6.1.0" />
<PackageReference Include="BootstrapBlazor.TableExport" Version="6.*" />
<PackageReference Include="BootstrapBlazor.Topology" Version="6.1.1" />
<PackageReference Include="BootstrapBlazor.SummerNote" Version="7.0.0" />
<PackageReference Include="BootstrapBlazor.TableExport" Version="7.0.0" />
<PackageReference Include="BootstrapBlazor.Topology" Version="7.0.0" />
</ItemGroup>
<ItemGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<Version>6.0.4</Version>
<Version>7.0.0</Version>
</PropertyGroup>
<PropertyGroup>
@ -11,7 +11,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.9.5" />
<PackageReference Include="BootstrapBlazor" Version="7.0.0" />
</ItemGroup>
</Project>

View File

@ -97,7 +97,7 @@ public class AzureRecognizerProvider : IRecognizerProvider, IAsyncDisposable
Logger.LogError(ex, "ExchangeToken");
}
return ret;
});
})!;
/// <summary>
/// 客户端回调方法

View File

@ -104,7 +104,7 @@ public class AzureSynthesizerProvider : ISynthesizerProvider, IAsyncDisposable
Logger.LogError(ex, "ExchangeToken");
}
return ret;
});
})!;
/// <summary>
/// Callback 回调方法 由 Javascript 调用
@ -114,7 +114,7 @@ public class AzureSynthesizerProvider : ISynthesizerProvider, IAsyncDisposable
[JSInvokable]
public async Task Callback(SynthesizerStatus status)
{
Logger.LogInformation($"SynthesizerStatus: {status}");
Logger.LogInformation("SynthesizerStatus: {Status}", status);
if (Option.Callback != null)
{
await Option.Callback(status);

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<Version>6.0.9</Version>
<Version>7.0.0</Version>
</PropertyGroup>
<PropertyGroup>
@ -12,7 +12,7 @@
<ItemGroup>
<PackageReference Include="Baidu.AI" Version="4.15.10" />
<PackageReference Include="BootstrapBlazor" Version="6.9.5" />
<PackageReference Include="BootstrapBlazor" Version="7.0.0" />
</ItemGroup>
</Project>

View File

@ -3,7 +3,7 @@
<Import Project="..\..\..\bundleconfig.props" />
<PropertyGroup>
<Version>6.4.0</Version>
<Version>7.0.0</Version>
</PropertyGroup>
<PropertyGroup>
@ -24,7 +24,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.11.25" />
<PackageReference Include="BootstrapBlazor" Version="7.0.0" />
</ItemGroup>
<ItemGroup>

View File

@ -1,110 +1 @@
import BlazorComponent from "../../../_content/BootstrapBlazor/modules/base/blazor-component.js"
import EventHandler from "../../../_content/BootstrapBlazor/modules/base/event-handler.js"
import { vibrate } from "../../../_content/BootstrapBlazor/modules/base/utility.js"
export class BarcodeReader extends BlazorComponent {
_init() {
this._reader = new ZXing.BrowserMultiFormatReader()
this._scanType = this._config.scan
this._invoker = this._config.arguments[0]
if (this._scanType === 'Camera') {
this.scan = () => {
this._invoker.invokeMethodAsync("Start")
const deviceId = this._element.getAttribute('data-bb-deviceid')
const video = this._element.querySelector('video').getAttribute('id')
this._reader.decodeFromVideoDevice(deviceId, video, (result, err) => {
if (result) {
vibrate()
console.log(result.text)
this._invoker.invokeMethodAsync("GetResult", result.text)
const autoStop = this._element.getAttribute('data-bb-autostop') === 'true'
if (autoStop) {
this.stop()
}
}
if (err && !(err instanceof ZXing.NotFoundException)) {
console.error(err)
this._invoker.invokeMethodAsync('GetError', err)
}
})
}
this.stop = () => {
this._reader.reset();
this._invoker.invokeMethodAsync("Stop")
}
this._reader.getVideoInputDevices().then(videoInputDevices => {
this._invoker.invokeMethodAsync("InitDevices", videoInputDevices).then(() => {
const autoStart = this._element.getAttribute('data-bb-autostart') === 'true'
if (this._config.autoStart && videoInputDevices.length > 0) {
const button = this._element.querySelector('[data-bb-method="scan"]')
button.click()
}
})
})
} else {
const scanImageHandler = () => {
const files = this._reader.file.files
if (files.length === 0) {
return
}
const reader = new FileReader()
reader.onloadend = e => {
this._reader.decodeFromImageUrl(e.target.result).then(result => {
if (result) {
vibrate()
console.log(result.text);
this._invoker.invokeMethodAsync('GetResult', result.text)
}
}).catch((err) => {
if (err) {
console.log(err)
this._invoker.invokeMethodAsync('GetError', err.message)
}
})
}
reader.readAsDataURL(files[0])
}
const resetFile = () => {
let file = this._element.querySelector('[type="file"]')
if (file) {
EventHandler.off(file, 'change');
file.remove()
}
file = document.createElement('input')
file.setAttribute('type', 'file')
file.setAttribute('hidden', 'true')
file.setAttribute('accept', 'image/*')
this._element.append(file)
EventHandler.on(file, 'change', scanImageHandler)
this._reader.file = file
return file
}
this.scanImage = () => {
let file = resetFile()
file.click()
}
}
const eventHandler = e => {
let button = e.delegateTarget
const method = button.getAttribute('data-bb-method')
const fn = this[method]
if (typeof fn === 'function') {
fn()
}
}
EventHandler.on(this._element, 'click', '[data-bb-method]', eventHandler)
}
_dispose() {
EventHandler.off(this._element, 'click', '[data-bb-method]')
this._reader.reset()
}
}
import BlazorComponent from"../../../_content/BootstrapBlazor/modules/base/blazor-component.js";import EventHandler from"../../../_content/BootstrapBlazor/modules/base/event-handler.js";import{vibrate as n}from"../../../_content/BootstrapBlazor/modules/base/utility.js";export class BarcodeReader extends BlazorComponent{_init(){if(this._reader=new ZXing.BrowserMultiFormatReader,this._scanType=this._config.scan,this._invoker=this._config.arguments[0],this._scanType==="Camera")this.scan=()=>{this._invoker.invokeMethodAsync("Start");const t=this._element.getAttribute("data-bb-deviceid"),i=this._element.querySelector("video").getAttribute("id");this._reader.decodeFromVideoDevice(t,i,(t,i)=>{if(t){n();console.log(t.text);this._invoker.invokeMethodAsync("GetResult",t.text);const i=this._element.getAttribute("data-bb-autostop")==="true";i&&this.stop()}!i||i instanceof ZXing.NotFoundException||(console.error(i),this._invoker.invokeMethodAsync("GetError",i))})},this.stop=()=>{this._reader.reset(),this._invoker.invokeMethodAsync("Stop")},this._reader.getVideoInputDevices().then(n=>{this._invoker.invokeMethodAsync("InitDevices",n).then(()=>{const t=this._element.getAttribute("data-bb-autostart")==="true";if(this._config.autoStart&&n.length>0){const n=this._element.querySelector('[data-bb-method="scan"]');n.click()}})});else{const t=()=>{const t=this._reader.file.files;if(t.length!==0){const i=new FileReader;i.onloadend=t=>{this._reader.decodeFromImageUrl(t.target.result).then(t=>{t&&(n(),console.log(t.text),this._invoker.invokeMethodAsync("GetResult",t.text))}).catch(n=>{n&&(console.log(n),this._invoker.invokeMethodAsync("GetError",n.message))})};i.readAsDataURL(t[0])}},i=()=>{let n=this._element.querySelector('[type="file"]');n&&(EventHandler.off(n,"change"),n.remove());n=document.createElement("input");n.setAttribute("type","file");n.setAttribute("hidden","true");n.setAttribute("accept","image/*");this._element.append(n);EventHandler.on(n,"change",t);return this._reader.file=n,n};this.scanImage=()=>{let n=i();n.click()}}const t=n=>{let i=n.delegateTarget;const r=i.getAttribute("data-bb-method"),t=this[r];typeof t=="function"&&t()};EventHandler.on(this._element,"click","[data-bb-method]",t)}_dispose(){EventHandler.off(this._element,"click","[data-bb-method]");this._reader.reset()}}

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@
<Import Project="..\..\..\bundleconfig.props" />
<PropertyGroup>
<Version>6.0.0</Version>
<Version>7.0.0</Version>
<PackageTags>Bootstrap Blazor WebAssembly wasm UI Components Chart</PackageTags>
<Description>Bootstrap UI components extensions of Chart.js</Description>
</PropertyGroup>
@ -31,7 +31,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.9.5" />
<PackageReference Include="BootstrapBlazor" Version="7.0.0" />
</ItemGroup>
</Project>

View File

@ -3,7 +3,7 @@
<Import Project="..\..\..\bundleconfig.props" />
<PropertyGroup>
<Version>6.1.1</Version>
<Version>7.0.0</Version>
</PropertyGroup>
<ItemGroup>
@ -14,7 +14,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.11.25" />
<PackageReference Include="BootstrapBlazor" Version="7.0.0" />
</ItemGroup>
<ItemGroup>

View File

@ -25,25 +25,12 @@ public partial class CherryMarkdown : IAsyncDisposable
[Parameter]
public ToolbarSettings? ToolbarSettings { get; set; }
private string? _value;
private bool IsRender { get; set; }
private string? _lastValue;
/// <summary>
/// 获得/设置 组件值
/// </summary>
[Parameter]
public string? Value
{
get => _value;
set
{
if (_value != value)
{
_value = value;
IsRender = true;
}
}
}
public string? Value { get; set; }
/// <summary>
/// 获得/设置 组件值回调
@ -81,7 +68,9 @@ public partial class CherryMarkdown : IAsyncDisposable
protected override void OnInitialized()
{
base.OnInitialized();
Option.Value = _value;
_lastValue = Value;
Option.Value = Value;
Option.Editor = EditorSettings ?? new EditorSettings();
Option.Toolbars = ToolbarSettings ?? new ToolbarSettings();
if (IsViewer == true)
@ -97,7 +86,6 @@ public partial class CherryMarkdown : IAsyncDisposable
/// <returns></returns>
protected override async Task ModuleInitAsync()
{
IsRender = false;
await InvokeInitAsync(Id, Option, nameof(Upload));
}
@ -107,9 +95,9 @@ public partial class CherryMarkdown : IAsyncDisposable
/// <returns></returns>
protected override async Task ModuleExecuteAsync()
{
if (IsRender)
if (Value != _lastValue)
{
IsRender = false;
_lastValue = Value;
await InvokeExecuteAsync(Id, Value);
}
}
@ -150,13 +138,15 @@ public partial class CherryMarkdown : IAsyncDisposable
{
if (vals.Length == 2)
{
var hasChanged = !EqualityComparer<string>.Default.Equals(vals[0], _value);
var hasChanged = !EqualityComparer<string>.Default.Equals(vals[0], Value);
if (hasChanged)
{
_value = vals[0];
Value = vals[0];
_lastValue = Value;
if (ValueChanged.HasDelegate)
{
await ValueChanged.InvokeAsync(_value);
await ValueChanged.InvokeAsync(Value);
}
}

View File

@ -3,7 +3,7 @@
<Import Project="..\..\..\bundleconfig.props" />
<PropertyGroup>
<Version>6.3.1</Version>
<Version>7.0.0</Version>
</PropertyGroup>
<PropertyGroup>
@ -22,7 +22,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.11.25" />
<PackageReference Include="BootstrapBlazor" Version="7.0.0" />
</ItemGroup>
</Project>

View File

@ -3,7 +3,7 @@
<Import Project="..\..\..\bundleconfig.props" />
<PropertyGroup>
<Version>6.3.2</Version>
<Version>7.0.0</Version>
</PropertyGroup>
<PropertyGroup>
@ -19,7 +19,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.11.25" />
<PackageReference Include="BootstrapBlazor" Version="7.0.0" />
</ItemGroup>
<ItemGroup>

View File

@ -3,7 +3,7 @@
<Import Project="..\..\..\bundleconfig.props" />
<PropertyGroup>
<Version>6.1.0</Version>
<Version>7.0.0</Version>
</PropertyGroup>
<PropertyGroup>
@ -19,7 +19,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.11.3" />
<PackageReference Include="BootstrapBlazor" Version="7.0.0" />
</ItemGroup>
<ItemGroup>

View File

@ -4,7 +4,6 @@
using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using Microsoft.JSInterop;
using System.Globalization;
namespace BootstrapBlazor.Components;
@ -19,6 +18,7 @@ public partial class Editor : IAsyncDisposable
/// </summary>
private ElementReference EditorElement { get; set; }
[NotNull]
private JSModule<Editor>? Module { get; set; }
/// <summary>
@ -65,24 +65,13 @@ public partial class Editor : IAsyncDisposable
[NotNull]
private IStringLocalizer<Editor>? Localizer { get; set; }
private string? _value;
private bool _renderValue;
private string? _lastValue;
/// <summary>
/// 获得/设置 组件值
/// </summary>
[Parameter]
public string? Value
{
get { return _value; }
set
{
if (_value != value)
{
_value = value;
_renderValue = true;
}
}
}
public string? Value { get; set; }
/// <summary>
/// 获得/设置 语言,默认为 null 自动判断,内置中英文额外语言包需要自行引入语言包
@ -177,13 +166,11 @@ public partial class Editor : IAsyncDisposable
Module = await JSRuntime.LoadModule<Editor>("./_content/BootstrapBlazor.SummerNote/js/bootstrap.blazor.editor.min.js", this, false);
await Module.InvokeVoidAsync("bb_editor", EditorElement, methodGetPluginAttrs, methodClickPluginItem, nameof(Update), Height, Value ?? "", Language);
}
else if (_renderValue)
if (_lastValue != Value)
{
_renderValue = false;
if (Module != null)
{
await Module.InvokeVoidAsync("bb_editor_code", EditorElement, Value ?? "");
}
_lastValue = Value;
await Module.InvokeVoidAsync("bb_editor_code", EditorElement, Value ?? "");
}
}
@ -195,6 +182,8 @@ public partial class Editor : IAsyncDisposable
public async Task Update(string value)
{
Value = value;
_lastValue = Value;
if (ValueChanged.HasDelegate)
{
await ValueChanged.InvokeAsync(Value);
@ -204,8 +193,6 @@ public partial class Editor : IAsyncDisposable
{
await OnValueChanged.Invoke(value);
}
_renderValue = false;
}
/// <summary>

View File

@ -3,7 +3,7 @@
<Import Project="..\..\..\bundleconfig.props" />
<PropertyGroup>
<Version>6.0.0</Version>
<Version>7.0.0</Version>
<PackageTags>Bootstrap Blazor WebAssembly wasm UI Components Table Export</PackageTags>
<Description>Bootstrap UI components extensions of export</Description>
</PropertyGroup>
@ -17,7 +17,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.9.5" />
<PackageReference Include="BootstrapBlazor" Version="7.0.0" />
<PackageReference Include="EPPlus" Version="4.5.3.3" />
</ItemGroup>

View File

@ -3,7 +3,7 @@
<Import Project="..\..\..\bundleconfig.props" />
<PropertyGroup>
<Version>6.1.1</Version>
<Version>7.0.0</Version>
</PropertyGroup>
<PropertyGroup>
@ -19,7 +19,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.11.25" />
<PackageReference Include="BootstrapBlazor" Version="7.0.0" />
</ItemGroup>
<ItemGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>6.0.0</Version>
<Version>7.0.0</Version>
<PackageTags>Bootstrap Blazor WebAssembly wasm UI Components EFCore</PackageTags>
<Description>Bootstrap UI components extensions of EFCore</Description>
</PropertyGroup>
@ -14,8 +14,12 @@
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.*" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.*" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.9.5" />
<PackageReference Include="BootstrapBlazor" Version="7.0.0" />
</ItemGroup>
</Project>

View File

@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>6.0.5</Version>
<Version>7.0.0</Version>
<PackageTags>Bootstrap Blazor WebAssembly wasm UI Components FreeSql</PackageTags>
<Description>Bootstrap UI components extensions of FreeSql</Description>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.9.5" />
<PackageReference Include="FreeSql.Repository" Version="3.2.665" />
<PackageReference Include="BootstrapBlazor" Version="7.0.0" />
<PackageReference Include="FreeSql.Repository" Version="3.2.682" />
</ItemGroup>
</Project>

View File

@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>6.0.0</Version>
<Version>7.0.0</Version>
<PackageTags>Bootstrap Blazor WebAssembly wasm UI Components PetaPoco</PackageTags>
<Description>Bootstrap UI components extensions of PetaPoco</Description>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.9.5" />
<PackageReference Include="Longbow.PetaPoco" Version="5.*" />
<PackageReference Include="BootstrapBlazor" Version="7.0.0" />
<PackageReference Include="Longbow.PetaPoco" Version="5.0.1" />
<PackageReference Include="PetaPoco.Extensions" Version="6.0.0" />
</ItemGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>1.0.0</Version>
<Version>7.0.0</Version>
</PropertyGroup>
<ItemGroup>