Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>10.0.2</Version>
<Version>10.0.3</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ public partial class UniverSheet
[Parameter]
public string? Lang { get; set; }

/// <summary>
/// 获得/设置 设置工具栏样式 默认 default 未设置
/// </summary>
[Parameter]
public UniverSheetRibbonType RibbonType { get; set; }
Comment on lines +33 to +37
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Explicitly initialize RibbonType to UniverSheetRibbonType.Default to make the intended default resilient to future enum changes.

This currently depends on RibbonType defaulting to the enum’s implicit 0 value being Default. If the enum order changes or a new value is added before Default, the runtime default will change unintentionally. Initializing it explicitly (e.g. public UniverSheetRibbonType RibbonType { get; set; } = UniverSheetRibbonType.Default;) makes the intended default robust to such changes.

Suggested change
/// <summary>
/// 获得/设置 设置工具栏样式 默认 default 未设置
/// </summary>
[Parameter]
public UniverSheetRibbonType RibbonType { get; set; }
/// <summary>
/// 获得/设置 设置工具栏样式 默认 default 未设置
/// </summary>
[Parameter]
public UniverSheetRibbonType RibbonType { get; set; } = UniverSheetRibbonType.Default;

Comment on lines +33 to +37
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RibbonType parameter will always send a value to JavaScript (defaulting to "default" when not explicitly set by the user), which means the JavaScript fallback ?? 'simple' in univer.js line 62 will never be used. Additionally, the documentation comment "默认 default 未设置" (defaults to default, not set) is ambiguous. Consider making the RibbonType property nullable (UniverSheetRibbonType?) to allow it to truly be unset and align with the JavaScript fallback behavior, or update the documentation to clearly state that it defaults to the Default enum value.

Copilot uses AI. Check for mistakes.

/// <summary>
/// 获得/设置 需要传递的数据
/// </summary>
Expand Down Expand Up @@ -87,7 +93,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
/// <inheritdoc/>
/// </summary>
/// <returns></returns>
protected override Task InvokeInitAsync() => InvokeVoidAsync("init", Id, Interop, new { Theme, Lang, Plugins, Data });
protected override Task InvokeInitAsync() => InvokeVoidAsync("init", Id, Interop, new { Theme, Lang, Plugins, Data, RibbonType = RibbonType.ToDescriptionString() });

/// <summary>
/// 推送数据方法
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ export async function init(id, invoke, options) {
return;
}

const { theme, lang, plugins, data } = options;
const { theme, lang, plugins, data, ribbonType } = options;
const univerSheet = {
el,
invoke,
data,
plugins,
theme,
lang
lang,
ribbonType
};

await createUniverSheetAsync(univerSheet);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (c) BootstrapBlazor & Argo Zhang (argo@live.ca). All rights reserved.
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The copyright header in this file uses "BootstrapBlazor & Argo Zhang (argo@live.ca)", which is inconsistent with other files in the same directory (e.g., UniverSheetData.cs, UniverSheet.razor.cs) that use "Argo Zhang (argo@163.com)". The copyright header should be consistent across all files in the component.

Suggested change
// Copyright (c) BootstrapBlazor & Argo Zhang (argo@live.ca). All rights reserved.
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.

Copilot uses AI. Check for mistakes.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Website: https://www.blazor.zone
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The website URL in this file is "https://www.blazor.zone", which is inconsistent with other files in the same directory (e.g., UniverSheetData.cs, UniverSheet.razor.cs) that use "https://www.blazor.zone or https://argozhang.github.io/". The header format should be consistent across all files in the component.

Suggested change
// Website: https://www.blazor.zone
// Website: https://www.blazor.zone or https://argozhang.github.io/

Copilot uses AI. Check for mistakes.

using System.ComponentModel;

namespace BootstrapBlazor.Components;

/// <summary>
/// UniverSheet 工具栏样式枚举
/// </summary>
public enum UniverSheetRibbonType
{
/// <summary>
/// 默认样式
/// </summary>
[Description("default")]
Default,

/// <summary>
/// 经典样式
/// </summary>
[Description("classic")]
Classic,

/// <summary>
/// 简单样式
/// </summary>
[Description("simple")]
Simple
}
Loading