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.7</Version>
<Version>10.0.9</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
@inherits BootstrapModuleComponentBase
@attribute [JSModuleAutoLoader("./_content/BootstrapBlazor.UniverSheet/Components/UniverSheet.razor.js", JSObjectReference = true)]

<div @attributes="@AdditionalAttributes" class="@ClassString" id="@Id" style="position: relative; overflow: hidden;">
<div class="bb-univer-sheet-wrap" style="height: 100%;"></div>
<div class="bb-univer-sheet-backdrop" style="background-color: #000; opacity: 0.3; position: absolute; inset: 0; z-index: 1205; display: flex; align-items: center; justify-content: center;">
<div style="color: #fff;">@LoadingText</div>
</div>
<div @attributes="@AdditionalAttributes" class="@ClassString" id="@Id">
<div class="bb-univer-sheet-wrap"></div>
@if (ShowLoading)
{
<div class="bb-univer-sheet-backdrop" style="display: none;">
<div class="bb-univer-sheet-load">@LoadingText</div>
</div>
}
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ public partial class UniverSheet
[Parameter]
public UniverSheetData? Data { get; set; }

/// <summary>
/// 获得/设置 是否显示加载遮罩 默认 true 显示遮罩
/// </summary>
[Parameter]
public bool ShowLoading { get; set; } = true;

/// <summary>
/// 获得/设置 正在加载显示文本 默认 null 未设置读取资源文件
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
import { isFunction, registerBootstrapBlazorModule } from '../../BootstrapBlazor/modules/utility.js'
import { addLink, isFunction, registerBootstrapBlazorModule } from '../../BootstrapBlazor/modules/utility.js'
import { createUniverSheetAsync } from '../univer.js'
import Data from '../../BootstrapBlazor/modules/data.js'
import EventHandler from "../../BootstrapBlazor/modules/event-handler.js"

export async function init(id, invoke, options) {
await addLink('./_content/BootstrapBlazor.UniverSheet/css/univer-sheet.bundle.css');

const el = document.getElementById(id);
if (el === null) {
return;
}

const backdrop = el.querySelector('.bb-univer-sheet-backdrop');
if (backdrop) {
backdrop.style.removeProperty('display');
}

const { theme, lang, plugins, data, ribbonType, darkMode } = options;
const univerSheet = {
el: el.querySelector('.bb-univer-sheet-wrap'),
backdrop,
invoke,
data,
plugins,
Expand All @@ -21,7 +29,6 @@ export async function init(id, invoke, options) {
darkMode,
events: {
onRendered: () => {
const backdrop = el.querySelector('.bb-univer-sheet-backdrop');
if (backdrop) {
backdrop.classList.add('d-none');
}
Expand All @@ -42,7 +49,17 @@ export async function init(id, invoke, options) {
export function execute(id, data) {
const univerSheet = Data.get(id);

return univerSheet.pushData(data);
const { firstPush, backdrop, pushData } = univerSheet;
let ret = null;
if (pushData) {
ret = pushData(data);
}
if (firstPush === true && backdrop) {
setTimeout(() => {
backdrop.classList.add('d-none');
}, 100);
}
return ret;
}

export function dispose(id) {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@import 'univer-bundle.css';

.bb-univer-sheet {
width: 100%;
height: 100%;
position: relative;
overflow: hidden;
}

.bb-univer-sheet-wrap {
height: 100%;
}

.bb-univer-sheet-backdrop {
background-color: #000;
opacity: 0.5;
position: absolute;
inset: 0;
z-index: 1205;
display: flex;
align-items: center;
justify-content: center;
}

.bb-univer-sheet-load {
color: #fff;
}

.univer-theme {
position: relative;
z-index: 1200;
}

.univer-theme [role="toolbar"] > div {
justify-content: flex-start;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ export default class DataService {
static name = 'DataService';

registerUniverSheet(sheet) {
sheet.firstPush = true;
sheet.pushData = data => {
sheet.firstPush = false;
this._checkReceiveDataCallback();
return this._callback(data);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,4 @@ export class DefaultPlugin extends Plugin {
}
}

// 设置依赖
setDependencies(DefaultPlugin, [Injector]);
33 changes: 2 additions & 31 deletions src/components/BootstrapBlazor.UniverSheet/wwwroot/univer.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,10 @@
import { addScript, addLink, getTheme } from '../BootstrapBlazor/modules/utility.js'
import { addScript, getTheme } from '../BootstrapBlazor/modules/utility.js'
import DataService from './data-service.js'

const loadAssets2 = async lang => {
await addScript('./_content/BootstrapBlazor.UniverSheet/univer/react.production.min.js');
await addScript('./_content/BootstrapBlazor.UniverSheet/univer/react-dom.production.min.js');
await addScript('./_content/BootstrapBlazor.UniverSheet/univer/rxjs.umd.min.js');
await addScript('./_content/BootstrapBlazor.UniverSheet/univer/univerjs.presets.umd.min.js');
await addScript('./_content/BootstrapBlazor.UniverSheet/univer/univerjs.preset-sheets-core/index.umd.min.js');
await addScript('./_content/BootstrapBlazor.UniverSheet/univer/univerjs.preset-sheets-drawing/index.umd.min.js');
await addScript('./_content/BootstrapBlazor.UniverSheet/univer/univerjs.sheets-zen-editor/index.umd.min.js');
await addScript('./_content/BootstrapBlazor.UniverSheet/univer/univerjs.preset-sheets-data-validation/index.umd.min.js');
await addScript('./_content/BootstrapBlazor.UniverSheet/univer/univerjs.preset-sheets-thread-comment/index.umd.min.js');
await addScript('./_content/BootstrapBlazor.UniverSheet/univer/univerjs.preset-sheets-hyper-link/index.umd.min.js');
await addScript('./_content/BootstrapBlazor.UniverSheet/univer/univerjs.preset-sheets-filter/index.umd.min.js');
await addScript('./_content/BootstrapBlazor.UniverSheet/univer/univerjs.preset-sheets-conditional-formatting/index.umd.min.js');
await addScript('./_content/BootstrapBlazor.UniverSheet/univer/univerjs.preset-sheets-advanced/index.umd.min.js');

await addScript(`./_content/BootstrapBlazor.UniverSheet/univer/univerjs.preset-sheets-core/locales/${lang}.js`);
await addScript(`./_content/BootstrapBlazor.UniverSheet/univer/univerjs.preset-sheets-drawing/locales/${lang}.js`);
await addScript(`./_content/BootstrapBlazor.UniverSheet/univer/univerjs.sheets-zen-editor/locales/${lang}.js`);
await addScript(`./_content/BootstrapBlazor.UniverSheet/univer/univerjs.preset-sheets-data-validation/locales/${lang}.js`);
await addScript(`./_content/BootstrapBlazor.UniverSheet/univer/univerjs.preset-sheets-thread-comment/locales/${lang}.js`);
await addScript(`./_content/BootstrapBlazor.UniverSheet/univer/univerjs.preset-sheets-advanced/locales/${lang}.js`);

await addLink('./_content/BootstrapBlazor.UniverSheet/univer/univer-sheet.bundle.css');
}

const loadAssets = async lang => {
export async function createUniverSheetAsync(sheet) {
await addScript('./_content/BootstrapBlazor.UniverSheet/univer/univer-bundle.js');
await addLink('./_content/BootstrapBlazor.UniverSheet/univer/univer-sheet.bundle.css');
}

export async function createUniverSheetAsync(sheet) {
sheet.lang = sheet.lang ?? 'en-US';
await loadAssets(sheet.lang);
const { el } = sheet;
const { LocaleType, merge } = UniverCore;
Copy link

Copilot AI Jan 24, 2026

Choose a reason for hiding this comment

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

Unused variable LocaleType.

Suggested change
const { LocaleType, merge } = UniverCore;
const { merge } = UniverCore;

Copilot uses AI. Check for mistakes.
const { createUniver } = UniverPresets;
Expand Down
Loading
Loading