Skip to content

Commit 4b2e013

Browse files
committed
refactor: 增加 WorkbookData 属性
1 parent 8e4fced commit 4b2e013

2 files changed

Lines changed: 11 additions & 12 deletions

File tree

src/components/BootstrapBlazor.UniverSheet/Components/UniverSheetData.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@ public class UniverSheetData
2121
public string? CommandName { get; set; }
2222

2323
/// <summary>
24-
/// 获得/设置 数据 默认 null 未设置
24+
/// 获得/设置 表格数据 默认 null 未设置
2525
/// </summary>
26+
/// <remarks>给 UniverSheet Workbook 使用</remarks>
27+
public object? WorkbookData { get; set; }
28+
29+
/// <summary>
30+
/// 获得/设置 附加业务数据 默认 null 未设置
31+
/// </summary>
32+
/// <remarks>给自定义业务使用</remarks>
2633
public object? Data { get; set; }
2734
}

src/components/BootstrapBlazor.UniverSheet/wwwroot/univer.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export async function createUniverSheetAsync(sheet) {
3232
const { UniverSheetsDataValidationPlugin } = UniverSheetsDataValidation
3333
const { UniverSheetsDataValidationUIPlugin } = UniverSheetsDataValidationUi
3434
const { defaultTheme } = UniverDesign;
35-
35+
3636
const options = {
3737
theme: sheet.options.theme ?? defaultTheme,
3838
locale: sheet.options.lang ?? LocaleType.ZH_CN,
@@ -70,16 +70,8 @@ export async function createUniverSheetAsync(sheet) {
7070
...options
7171
});
7272

73-
const { data } = sheet.options;
74-
if (data) {
75-
const { messageName, commandName, data } = data;
76-
if (messageName === null && commandName === null && data) {
77-
univerAPI.createWorkbook(data);
78-
}
79-
}
80-
else {
81-
univerAPI.createUniverSheet();
82-
}
73+
const { workboolData } = sheet.options.data || {};
74+
univerAPI.createWorkbook(workboolData);
8375

8476
sheet.univer = univer;
8577
sheet.univerAPI = univerAPI;

0 commit comments

Comments
 (0)