Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

style(examples): add eslint

Dushusir11d3f841632f
diff --git a/examples/univer-doc-ts/src/Types/index.d.ts b/examples/univer-doc-ts/src/Types/index.d.ts
index 6941b08b06..7b892cdd6e 100644
--- a/examples/univer-doc-ts/src/Types/index.d.ts
+++ b/examples/univer-doc-ts/src/Types/index.d.ts
@@ -1,6 +1,5 @@
/// <reference types="vite/client" />
-export * from '../index';
declare module 'univer-doc-ts' {}
// use css module
diff --git a/examples/univer-doc-ts/src/Types/preact.d.ts b/examples/univer-doc-ts/src/Types/preact.d.ts
index 21573e1251..0d092b3751 100644
--- a/examples/univer-doc-ts/src/Types/preact.d.ts
+++ b/examples/univer-doc-ts/src/Types/preact.d.ts
@@ -1,4 +1,4 @@
/// <reference types="enzyme-adapter-preact-pure" />
import JSX = preact.JSX;
-declare module 'enzyme';
\ No newline at end of file
+declare module 'enzyme';
diff --git a/examples/univer-preact-ts/src/index.ts b/examples/univer-preact-ts/src/index.ts
index 9851a3580f..daa1de342e 100644
--- a/examples/univer-preact-ts/src/index.ts
+++ b/examples/univer-preact-ts/src/index.ts
@@ -2,14 +2,13 @@ import { Univer, IDocumentData, ISlideData, IWorkbookConfig, UniverDoc, UniverSh
import { RenderEngine } from '@univerjs/base-render';
import { ISheetPluginConfig, SheetPlugin } from '@univerjs/base-sheets';
-import { SheetUIPlugin,ISheetUIPluginConfig } from '@univerjs/ui-plugin-sheets';
+import { SheetUIPlugin, ISheetUIPluginConfig } from '@univerjs/ui-plugin-sheets';
import { DocUIPlugin, IDocUIPluginConfig } from '@univerjs/ui-plugin-docs';
import { SlideUIPlugin, ISlideUIPluginConfig } from '@univerjs/ui-plugin-slides';
import { IDocPluginConfig, DocPlugin } from '@univerjs/base-docs';
import { ISlidePluginConfig, SlidePlugin } from '@univerjs/base-slides';
-import { DEFAULT_WORKBOOK_DATA } from '@univerjs/common-plugin-data';
// import { CollaborationPlugin, ICollaborationPluginConfig } from '@univerjs/common-plugin-collaboration';
-import { DEFAULT_FORMULA_DATA, FormulaPlugin, IFormulaConfig } from '@univerjs/sheets-plugin-formula';
+import { IFormulaConfig } from '@univerjs/sheets-plugin-formula';
import { CollaborationPlugin, ICollaborationPluginConfig } from '@univerjs/common-plugin-collaboration';
import { ClipboardPlugin } from '@univerjs/sheets-plugin-clipboard';
import { ImportXlsxPlugin } from '@univerjs/sheets-plugin-import-xlsx';
@@ -32,24 +31,21 @@ interface ISheetPropsCustom {
* Initialize the core and all plugins
*/
class UniverSheetCustom {
- constructor() {}
init(config: ISheetPropsCustom = {}): UniverSheet {
const univer = new Univer(config.univerConfig);
-
+
// base-render
univer.install(new RenderEngine());
// universheet instance
const universheet = UniverSheet.newInstance(config.coreConfig);
univer.addUniverSheet(universheet);
- univer.install(new UIPlugin())
+ univer.install(new UIPlugin());
// base-sheets
universheet.installPlugin(new SheetPlugin(config.baseSheetsConfig));
// ui-plugin-sheets
- univer.install(
- new SheetUIPlugin(config.uiSheetsConfig)
- );
+ univer.install(new SheetUIPlugin(config.uiSheetsConfig));
univer.install(new CollaborationPlugin(config.collaborationConfig));
// universheet.installPlugin(new NumfmtPlugin(config.numfmtConfig));
// FormulaPlugin.create(config.formulaConfig).installTo(universheet);
@@ -80,11 +76,9 @@ interface IDocPropsCustom {
* Initialize the core and all plugins
*/
class UniverDocCustom {
- constructor() {}
init(config: IDocPropsCustom = {}): UniverDoc {
-
const univer = new Univer(config.univerConfig);
-
+
// base-render
univer.install(new RenderEngine());
@@ -92,14 +86,12 @@ class UniverDocCustom {
const univerdoc = UniverDoc.newInstance(config.coreConfig);
univer.addUniverDoc(univerdoc);
- univer.install(new UIPlugin())
+ univer.install(new UIPlugin());
// base-docs
univerdoc.installPlugin(new DocPlugin(config.baseDocsConfig));
// ui-plugin-sheets
- univer.install(
- new DocUIPlugin(config.uiDocsConfig)
- );
+ univer.install(new DocUIPlugin(config.uiDocsConfig));
return univerdoc;
}
@@ -124,23 +116,20 @@ interface ISlidePropsCustom {
* Initialize the core and all plugins
*/
class UniverSlideCustom {
- constructor() {}
init(config: ISlidePropsCustom = {}): UniverSlide {
const univer = new Univer(config.univerConfig);
-
+
// base-render
univer.install(new RenderEngine());
// universlide instance
const universlide = UniverSlide.newInstance(config.coreConfig);
univer.addUniverSlide(universlide);
- univer.install(new UIPlugin())
+ univer.install(new UIPlugin());
// base-slides
universlide.installPlugin(new SlidePlugin(config.baseSlidesConfig));
// ui-plugin-slides
- univer.install(
- new SlideUIPlugin(config.uiSlidesConfig)
- );
+ univer.install(new SlideUIPlugin(config.uiSlidesConfig));
return universlide;
}
diff --git a/examples/univer-preact-ts/src/main.tsx b/examples/univer-preact-ts/src/main.tsx
index 6331916034..2aec98d83d 100644
--- a/examples/univer-preact-ts/src/main.tsx
+++ b/examples/univer-preact-ts/src/main.tsx
@@ -1,5 +1,5 @@
-import { DEFAULT_WORKBOOK_DATA, DEFAULT_WORKBOOK_DATA_DEMO, DEFAULT_WORKBOOK_DATA_DEMO3, DEFAULT_WORKBOOK_DATA_DEMO5, DEFAULT_WORKBOOK_DATA_DEMO7, DEFAULT_WORKBOOK_DATA_DOWN } from '@univerjs/common-plugin-data';
-import { IWorkbookConfig, IWorksheetConfig, SheetTypes, Tools } from '@univerjs/core';
+import { DEFAULT_WORKBOOK_DATA_DEMO7 } from '@univerjs/common-plugin-data';
+import { Tools } from '@univerjs/core';
import { univerSheetCustom } from '.';
const baseSheetsConfig = {
@@ -32,7 +32,7 @@ let uiSheetsConfig = {
rightMenu: false,
},
},
-}
+};
let columnCount = 8;
if (window.innerWidth < 1366) {
@@ -60,17 +60,18 @@ const defaultWorkbookData = Tools.deepClone(DEFAULT_WORKBOOK_DATA_DEMO7);
// },
// };
-
-
-
-const ipAddress = 'localhost:8500'
+const ipAddress = 'localhost:8500';
// const ipAddress = '47.100.177.253:8500'
-const config = {"type":"sheet","template":"DEMO1"}
+const config = { type: 'sheet', template: 'DEMO1' };
-insertButton()
-insertUpdateButton()
+insertButton();
+insertUpdateButton();
-function insertInputBox(id) {
+interface Message {
+ id: string;
+ config: string;
+}
+function insertInputBox(id: string) {
// 创建一个输入框元素
const box = document.createElement('input');
box.type = 'text';
@@ -80,37 +81,37 @@ function insertInputBox(id) {
box.style.position = 'fixed';
box.style.right = '0';
box.style.top = '70px';
- box.addEventListener('blur',(e)=>{
- const txt = e.target.value;
+ box.addEventListener('blur', (e) => {
+ const txt = (e.target as HTMLInputElement).value;
const message = {
- "type": "data",
- "data": txt
- }
- sendMessage(message)
- })
+ type: 'data',
+ data: txt,
+ };
+ sendMessage(message);
+ });
- const url = `${'ws://'+ipAddress+'/ws/'}${id}`;
+ const url = `${`ws://${ipAddress}/ws/`}${id}`;
const socket = new WebSocket(url);
// 连接建立时触发的事件
- socket.onopen = function(event) {
- console.log("WebSocket connected");
+ socket.onopen = function (event) {
+ console.log('WebSocket connected');
};
// 接收到消息时触发的事件
- socket.onmessage = function(event) {
- const message = JSON.parse(event.data);
- console.log("Received message:", message);
+ socket.onmessage = function (event) {
+ const message = JSON.parse(event.data);
+ console.log('Received message:', message);
};
// 连接关闭时触发的事件
- socket.onclose = function(event) {
- console.log("WebSocket closed:", event);
+ socket.onclose = function (event) {
+ console.log('WebSocket closed:', event);
};
// 发送消息
- function sendMessage(message) {
- socket.send(JSON.stringify(message));
+ function sendMessage(message: object) {
+ socket.send(JSON.stringify(message));
}
}
// openDocs()
@@ -135,35 +136,33 @@ function insertUpdateButton() {
button.style.right = '0';
button.style.top = '50px';
-
// 添加按钮点击事件处理程序
- button.addEventListener('click', function() {
+ button.addEventListener('click', () => {
// 获取输入框的值
const inputValue = input.value;
- openDocs(inputValue,(json)=>{
+ openDocs(inputValue, (json: Message) => {
const universheetconfig = json.config;
const id = json.id;
const downUISheetsConfig = {
container: 'universheet-demo',
- }
+ };
const univerSheet = univerSheetCustom({
- univerConfig:{
- id
+ univerConfig: {
+ id,
+ },
+ coreConfig: JSON.parse(universheetconfig),
+ uiSheetsConfig: downUISheetsConfig,
+ collaborationConfig: {
+ url: `${`ws://${ipAddress}/ws/`}${id}`,
},
- coreConfig:JSON.parse(universheetconfig),
- uiSheetsConfig:downUISheetsConfig,
- collaborationConfig:{
- url: `${'ws://'+ipAddress+'/ws/'}${id}`
- }
});
// const ids = univerSheet.getWorkBook().getContext().getUniver().getGlobalContext().getUniverId();
// console.info('ids===',ids)
-
// insertInputBox(id)
- })
+ });
// insertInputBox(inputValue)
});
@@ -181,108 +180,98 @@ function insertButton() {
button.style.right = '0';
button.style.top = '0';
-
// 添加按钮点击事件处理程序
- button.addEventListener('click', function() {
- newDocs('http://'+ipAddress+'/new',config,(json)=>{
+ button.addEventListener('click', () => {
+ newDocs(`http://${ipAddress}/new`, config, (json: Message) => {
const id = json.id;
const config = json.config;
-
- if(config === 'default'){
+ if (config === 'default') {
const universheet = univerSheetCustom({
uiSheetsConfig,
- coreConfig:defaultWorkbookData
+ coreConfig: defaultWorkbookData,
});
- const universheetconfig = universheet.getWorkBook().getConfig()
+ const universheetconfig = universheet.getWorkBook().getConfig();
- updateDocs(id,universheetconfig)
+ updateDocs(id, universheetconfig);
}
-
- })
+ });
});
-
-
-
}
-function newDocs(url:string, params:object, cb?:(json:object)=>void) {
+function newDocs(url: string, params: object, cb?: (json: Message) => void) {
fetch(url, {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify(params)
- }).then(response => {
- if (response.ok) {
- return response.json();
- } else {
- throw new Error(response.statusText);
- }
- })
- .then(document => {
- // 处理获取到的文档信息
- console.log(document);
- cb && cb(document)
- })
- .catch(error => {
- console.error(error);
- });
-
- }
-
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify(params),
+ })
+ .then((response) => {
+ if (response.ok) {
+ return response.json();
+ }
+ throw new Error(response.statusText);
+ })
+ .then((document) => {
+ // 处理获取到的文档信息
+ console.log(document);
+ cb && cb(document);
+ })
+ .catch((error) => {
+ console.error(error);
+ });
+}
- function openDocs(id,cb?) {
+function openDocs(id: string, cb?: (obj: Message) => void) {
// 定义请求参数
- const data = new FormData();
- data.append('id', id);
+ const data = new FormData();
+ data.append('id', id);
- // 创建 XMLHttpRequest 对象
- const xhr = new XMLHttpRequest();
+ // 创建 XMLHttpRequest 对象
+ const xhr = new XMLHttpRequest();
- // 监听请求完成事件
- xhr.onload = function() {
+ // 监听请求完成事件
+ xhr.onload = function () {
if (xhr.status === 200) {
const document = JSON.parse(xhr.responseText);
// 处理获取到的文档信息
console.log(document);
- cb && cb(document)
+ cb && cb(document);
} else {
console.error(xhr.statusText);
}
- };
-
- // 发送 POST 请求
- xhr.open('POST', 'http://'+ipAddress+'/open', true);
- xhr.send(data);
+ };
- }
- function updateDocs(id,config,cb?) {
+ // 发送 POST 请求
+ xhr.open('POST', `http://${ipAddress}/open`, true);
+ xhr.send(data);
+}
+function updateDocs(id: string, config: object, cb?: (obj: object) => void) {
// 定义请求参数
- const data = new FormData();
- data.append('id', id);
- data.append('config', JSON.stringify(config));
+ const data = new FormData();
+ data.append('id', id);
+ data.append('config', JSON.stringify(config));
- // 创建 XMLHttpRequest 对象
- const xhr = new XMLHttpRequest();
+ // 创建 XMLHttpRequest 对象
+ const xhr = new XMLHttpRequest();
- // 监听请求完成事件
- xhr.onload = function() {
+ // 监听请求完成事件
+ xhr.onload = function () {
if (xhr.status === 200) {
const document = JSON.parse(xhr.responseText);
// 处理获取到的文档信息
console.log(document);
- cb && cb(document)
+ cb && cb(document);
} else {
console.error(xhr.statusText);
}
- };
-
- // 发送 POST 请求
- xhr.open('POST', 'http://'+ipAddress+'/update', true);
- xhr.send(data);
+ };
- }
+ // 发送 POST 请求
+ xhr.open('POST', `http://${ipAddress}/update`, true);
+ xhr.send(data);
+}
// const sheetConfigDown = {
// container: 'universheet-demo-down',
diff --git a/examples/univer-sheet-ts/src/Types/index.d.ts b/examples/univer-sheet-ts/src/Types/index.d.ts
index bf64e445ee..6aabf2941f 100644
--- a/examples/univer-sheet-ts/src/Types/index.d.ts
+++ b/examples/univer-sheet-ts/src/Types/index.d.ts
@@ -1,6 +1,5 @@
/// <reference types="vite/client" />
-export * from '../index';
declare module 'univer-sheet-ts' {}
// use css module
diff --git a/examples/univer-sheet-ts/src/Types/preact.d.ts b/examples/univer-sheet-ts/src/Types/preact.d.ts
index 21573e1251..0d092b3751 100644
--- a/examples/univer-sheet-ts/src/Types/preact.d.ts
+++ b/examples/univer-sheet-ts/src/Types/preact.d.ts
@@ -1,4 +1,4 @@
/// <reference types="enzyme-adapter-preact-pure" />
import JSX = preact.JSX;
-declare module 'enzyme';
\ No newline at end of file
+declare module 'enzyme';
diff --git a/examples/univer-sheet-ts/src/main.tsx b/examples/univer-sheet-ts/src/main.tsx
index 7c40a4d9b8..146b732417 100644
--- a/examples/univer-sheet-ts/src/main.tsx
+++ b/examples/univer-sheet-ts/src/main.tsx
@@ -1,25 +1,10 @@
-import { UniverSheet, UniverDoc, UniverSlide, Univer } from '@univerjs/core';
+import { UniverSheet, Univer } from '@univerjs/core';
import { RenderEngine } from '@univerjs/base-render';
import { SheetPlugin } from '@univerjs/base-sheets';
import { SheetUIPlugin } from '@univerjs/ui-plugin-sheets';
-import { DEFAULT_FORMULA_DATA, DEFAULT_FORMULA_DATA_DEMO, DEFAULT_FORMULA_DATA_DEMO1, FormulaPlugin } from '@univerjs/sheets-plugin-formula';
-import { NumfmtPlugin } from '@univerjs/sheets-plugin-numfmt';
-import {
- DEFAULT_WORKBOOK_DATA,
- DEFAULT_WORKBOOK_DATA_DEMO,
- DEFAULT_WORKBOOK_DATA_DEMO1,
- DEFAULT_WORKBOOK_DATA_DEMO2,
- DEFAULT_WORKBOOK_DATA_DEMO3,
- DEFAULT_WORKBOOK_DATA_DEMO4,
- DEFAULT_WORKBOOK_DATA_DEMO5,
- DEFAULT_WORKBOOK_DATA_DEMO6,
- DEFAULT_WORKBOOK_DATA_DEMO7,
- DEFAULT_WORKBOOK_DATA_DEMO8,
- DEFAULT_WORKBOOK_DATA_DOWN,
-} from '@univerjs/common-plugin-data';
+import { DEFAULT_WORKBOOK_DATA_DEMO } from '@univerjs/common-plugin-data';
import { ClipboardPlugin } from '@univerjs/sheets-plugin-clipboard';
import { ImportXlsxPlugin } from '@univerjs/sheets-plugin-import-xlsx';
-import { FindPlugin } from '@univerjs/sheets-plugin-find';
import { UIPlugin } from '@univerjs/base-ui';
const uiDefaultConfigDemo = {
@@ -56,7 +41,7 @@ univer.install(new RenderEngine());
const universheet = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA_DEMO);
// sheet.installPlugin(new RenderEngine());
univer.addUniverSheet(universheet);
-univer.install(new UIPlugin())
+univer.install(new UIPlugin());
// base-sheet
universheet.installPlugin(new SheetPlugin());
@@ -83,19 +68,3 @@ univer.install(
// FindPlugin.create().installTo(universheet);
universheet.installPlugin(new ClipboardPlugin());
universheet.installPlugin(new ImportXlsxPlugin());
-// sheets-plugin-ui univer.install(new SheetsUI)
-// sheets-plugin-ui univer.install(new SheetsUI
-// const univerSheetDemo = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA_DEMO);
-// const univerSheetDemo = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA_DEMO1);
-// const univerSheetDemo = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA_DEMO2);
-// const univerSheetDemo = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA_DEMO3);
-// const univerSheetDemo = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA_DEMO);
-// univerSheetDemo.installPlugin(new RenderEngine());
-// univerSheetDemo.installPlugin(new UniverComponentSheet());
-// univerSheetDemo.installPlugin(new SheetPlugin(uiDefaultConfigDemo));
-// univerSheetDemo.installPlugin(new BaseComponentPlugin());
-// univerSheetDemo.installPlugin(new NumfmtPlugin());
-// FormulaPlugin.create(DEFAULT_FORMULA_DATA_DEMO).installTo(univerSheetDemo);
-// FormulaPlugin.create(DEFAULT_FORMULA_DATA_DEMO1).installTo(univerSheetDemo);
-
-// univerSheetDemo.installPlugin(new ImportXlsxPlugin());
diff --git a/examples/univer-slide-ts/src/Types/index.d.ts b/examples/univer-slide-ts/src/Types/index.d.ts
index 020e7e28fa..b17e352583 100644
--- a/examples/univer-slide-ts/src/Types/index.d.ts
+++ b/examples/univer-slide-ts/src/Types/index.d.ts
@@ -1,6 +1,5 @@
/// <reference types="vite/client" />
-export * from '../index';
declare module 'univer-slide-ts' {}
// use css module
diff --git a/examples/univer-slide-ts/src/Types/preact.d.ts b/examples/univer-slide-ts/src/Types/preact.d.ts
index 21573e1251..0d092b3751 100644
--- a/examples/univer-slide-ts/src/Types/preact.d.ts
+++ b/examples/univer-slide-ts/src/Types/preact.d.ts
@@ -1,4 +1,4 @@
/// <reference types="enzyme-adapter-preact-pure" />
import JSX = preact.JSX;
-declare module 'enzyme';
\ No newline at end of file
+declare module 'enzyme';
diff --git a/examples/univer-slide-ts/src/main.tsx b/examples/univer-slide-ts/src/main.tsx
index b7da69d12e..fb7530b71a 100644
--- a/examples/univer-slide-ts/src/main.tsx
+++ b/examples/univer-slide-ts/src/main.tsx
@@ -1,9 +1,9 @@
-import { PLUGIN_NAMES, Univer, UniverSlide } from '@univerjs/core';
+import { Univer, UniverSlide } from '@univerjs/core';
import { RenderEngine } from '@univerjs/base-render';
import { SlidePlugin } from '@univerjs/base-slides';
import { DEFAULT_SLIDE_DATA } from '@univerjs/common-plugin-data';
-import {SlideUIPlugin} from '@univerjs/ui-plugin-slides'
+import { SlideUIPlugin } from '@univerjs/ui-plugin-slides';
import { UIPlugin } from '@univerjs/base-ui';
// univer
@@ -16,13 +16,15 @@ univer.install(new RenderEngine());
const universlide = UniverSlide.newInstance(DEFAULT_SLIDE_DATA);
univer.addUniverSlide(universlide);
-univer.install(new UIPlugin())
+univer.install(new UIPlugin());
universlide.installPlugin(new SlidePlugin());
-univer.install(new SlideUIPlugin({
- container: 'universlide',
- layout: {
- slideContainerConfig:{
- innerLeft: true,
- }
- },
-}))
+univer.install(
+ new SlideUIPlugin({
+ container: 'universlide',
+ layout: {
+ slideContainerConfig: {
+ innerLeft: true,
+ },
+ },
+ })
+);
diff --git a/examples/univer-vanilla-ts/src/Types/index.d.ts b/examples/univer-vanilla-ts/src/Types/index.d.ts
index 37f3ac0839..6eb519fe1d 100644
--- a/examples/univer-vanilla-ts/src/Types/index.d.ts
+++ b/examples/univer-vanilla-ts/src/Types/index.d.ts
@@ -1,9 +1,7 @@
/// <reference types="vite/client" />
-export * from '../index';
declare module 'univer-vanilla-ts' {}
-
// use css module
declare module '*.less' {
const resource: { [key: string]: string };
diff --git a/examples/univer-vanilla-ts/src/Types/preact.d.ts b/examples/univer-vanilla-ts/src/Types/preact.d.ts
index 21573e1251..0d092b3751 100644
--- a/examples/univer-vanilla-ts/src/Types/preact.d.ts
+++ b/examples/univer-vanilla-ts/src/Types/preact.d.ts
@@ -1,4 +1,4 @@
/// <reference types="enzyme-adapter-preact-pure" />
import JSX = preact.JSX;
-declare module 'enzyme';
\ No newline at end of file
+declare module 'enzyme';
diff --git a/examples/univer-vanilla-ts/src/main.tsx b/examples/univer-vanilla-ts/src/main.tsx
index 595eb9602f..883375d27e 100644
--- a/examples/univer-vanilla-ts/src/main.tsx
+++ b/examples/univer-vanilla-ts/src/main.tsx
@@ -1,28 +1,10 @@
-import { UniverSheet, UniverDoc, UniverSlide, Univer, PLUGIN_NAMES } from '@univerjs/core';
+import { UniverSheet, Univer } from '@univerjs/core';
import { RenderEngine } from '@univerjs/base-render';
import { SheetPlugin } from '@univerjs/base-sheets';
-import { CanvasView as SlideCanvasView } from '@univerjs/base-slides';
import { SheetUIPlugin } from '@univerjs/ui-plugin-sheets';
-import { SlideUIPlugin } from '@univerjs/ui-plugin-slides';
import { UIPlugin } from '@univerjs/base-ui';
-import {
- DEFAULT_FORMULA_DATA,
- DEFAULT_FORMULA_DATA_DEMO,
- DEFAULT_FORMULA_DATA_DEMO1,
- FormulaPlugin,
-} from '@univerjs/sheets-plugin-formula';
-import { NumfmtPlugin } from '@univerjs/sheets-plugin-numfmt';
-import {
- DEFAULT_WORKBOOK_DATA,
- DEFAULT_WORKBOOK_DATA_DEMO,
- DEFAULT_WORKBOOK_DATA_DEMO1,
- DEFAULT_WORKBOOK_DATA_DEMO2,
- DEFAULT_WORKBOOK_DATA_DEMO3,
- DEFAULT_WORKBOOK_DATA_DEMO4,
- DEFAULT_WORKBOOK_DATA_DOWN,
-} from '@univerjs/common-plugin-data';
-import { ClipboardPlugin } from '@univerjs/sheets-plugin-clipboard';
-import { ImportXlsxPlugin } from '@univerjs/sheets-plugin-import-xlsx';
+
+import { DEFAULT_WORKBOOK_DATA_DEMO } from '@univerjs/common-plugin-data';
// univer
const univer = new Univer();
@@ -34,7 +16,7 @@ univer.install(new RenderEngine());
const universheet = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA_DEMO);
univer.addUniverSheet(universheet);
-univer.install(new UIPlugin())
+univer.install(new UIPlugin());
// base-sheet
universheet.installPlugin(
new SheetPlugin({
@@ -58,40 +40,8 @@ universheet.installPlugin(
);
// base-slides init CanvasView
-univer.install(new SheetUIPlugin({
- container:'universheet'
-}))
-
-
-// render canvas without ui plugin
-// const engine = univer.getGlobalContext().getPluginManager().getRequirePluginByName<RenderEngine>(PLUGIN_NAMES.BASE_RENDER).getEngine();
-// let container = document.querySelector('#universheet') as HTMLElement
-
-// // mount canvas to DOM container
-// engine.setContainer(container);
-
-// window.addEventListener('resize', () => {
-// engine.resize();
-// });
-
-// // should be clear
-// setTimeout(() => {
-// engine.resize();
-// }, 0);
-
-// sheets-plugin-ui univer.install(new SheetsUI)
-// const univerSheetDemo = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA_DEMO);
-// const univerSheetDemo = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA_DEMO1);
-// const univerSheetDemo = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA_DEMO2);
-// const univerSheetDemo = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA_DEMO3);
-// const univerSheetDemo = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA_DEMO);
-// univerSheetDemo.installPlugin(new RenderEngine());
-// univerSheetDemo.installPlugin(new UniverComponentSheet());
-// univerSheetDemo.installPlugin(new SheetPlugin(uiDefaultConfigDemo));
-// univerSheetDemo.installPlugin(new BaseComponentPlugin());
-// univerSheetDemo.installPlugin(new NumfmtPlugin());
-// FormulaPlugin.create(DEFAULT_FORMULA_DATA_DEMO).installTo(univerSheetDemo);
-// FormulaPlugin.create(DEFAULT_FORMULA_DATA_DEMO1).installTo(univerSheetDemo);
-
-// univerSheetDemo.installPlugin(new ClipboardPlugin());
-// univerSheetDemo.installPlugin(new ImportXlsxPlugin());
+univer.install(
+ new SheetUIPlugin({
+ container: 'universheet',
+ })
+);