-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathUniverSheet.razor.js
More file actions
41 lines (33 loc) · 949 Bytes
/
UniverSheet.razor.js
File metadata and controls
41 lines (33 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import Data from '../../BootstrapBlazor/modules/data.js'
import { isFunction } from '../../BootstrapBlazor/modules/utility.js'
import { createUniverSheetAsync } from '../univer.js'
export async function init(id, invoke, options) {
const el = document.getElementById(id);
if (el === null) {
return;
}
const { theme, lang, plugins, data, ribbonType } = options;
const univerSheet = {
el,
invoke,
data,
plugins,
theme,
lang,
ribbonType
};
await createUniverSheetAsync(univerSheet);
Data.set(id, univerSheet);
invoke.invokeMethodAsync('TriggerReadyAsync');
}
export function execute(id, data) {
const univerSheet = Data.get(id);
return univerSheet.pushData(data);
}
export function dispose(id) {
const univerSheet = Data.get(id);
Data.remove(id);
if (isFunction(univerSheet.dispose)) {
univerSheet.dispose();
}
}