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.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
build(workspace): build iife
Dushusira1d40f621c02
diff --git a/examples/univer-preact-ts/package.json b/examples/univer-preact-ts/package.jsonindex d3b7563be8..1b1350ade0 100644--- a/examples/univer-preact-ts/package.json+++ b/examples/univer-preact-ts/package.json@@ -47,6 +47,7 @@"@univerjs/sheets-plugin-formula": "workspace:^0.0.1","@univerjs/sheets-plugin-import-xlsx": "workspace:^0.0.1","@univerjs/sheets-plugin-numfmt": "workspace:^0.0.1",+ "@univerjs/ui-plugin-sheets": "workspace:^0.0.1","preact": "^10.12.1"}}\ No newline at end of filediff --git a/examples/univer-preact-ts/src/index.ts b/examples/univer-preact-ts/src/index.tsindex ac6915157a..b6bc09a4b4 100644--- a/examples/univer-preact-ts/src/index.ts+++ b/examples/univer-preact-ts/src/index.ts@@ -1,23 +1,24 @@-import { IDocumentData, ISlideData, IWorkbookConfig, UniverDoc, UniverSheet, UniverSlide } from '@univerjs/core';+import { Univer, IDocumentData, ISlideData, IWorkbookConfig, UniverDoc, UniverSheet, UniverSlide } from '@univerjs/core';import { RenderEngine } from '@univerjs/base-render';-import { BaseComponentPlugin } from '@univerjs/base-ui';import { ISheetPluginConfig, SheetPlugin } from '@univerjs/base-sheets';+import { SheetUIPlugin,ISheetUIPluginConfig } from '@univerjs/ui-plugin-sheets';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 { CollaborationPlugin, ICollaborationPluginConfig } from '@univerjs/common-plugin-collaboration';import { DEFAULT_FORMULA_DATA, FormulaPlugin, IFormulaConfig } from '@univerjs/sheets-plugin-formula';-import { INumfmtPluginConfig, NumfmtPlugin } from '@univerjs/sheets-plugin-numfmt';-import { ClipboardPlugin } from '@univerjs/sheets-plugin-clipboard';-import { ImportXlsxPlugin } from '@univerjs/sheets-plugin-import-xlsx';+// import { INumfmtPluginConfig, NumfmtPlugin } from '@univerjs/sheets-plugin-numfmt';+// import { ClipboardPlugin } from '@univerjs/sheets-plugin-clipboard';+// import { ImportXlsxPlugin } from '@univerjs/sheets-plugin-import-xlsx';interface ISheetPropsCustom {coreConfig?: Partial<IWorkbookConfig>;baseSheetsConfig?: ISheetPluginConfig;- numfmtConfig?: INumfmtPluginConfig;+ uiSheetsConfig?: ISheetUIPluginConfig;+ // numfmtConfig?: INumfmtPluginConfig;formulaConfig?: IFormulaConfig;- collaborationConfig?: ICollaborationPluginConfig;+ // collaborationConfig?: ICollaborationPluginConfig;}/**@@ -26,18 +27,25 @@ interface ISheetPropsCustom {class UniverSheetCustom {constructor() {}init(config: ISheetPropsCustom = {}): UniverSheet {+ const univer = new Univer();++ // base-render+ univer.install(new RenderEngine());+ // universheet instanceconst universheet = UniverSheet.newInstance(config.coreConfig);-- universheet.installPlugin(new RenderEngine());- universheet.installPlugin(new UniverComponentSheet());+ univer.addUniverSheet(universheet);+ // base-sheetuniversheet.installPlugin(new SheetPlugin(config.baseSheetsConfig));- universheet.installPlugin(new BaseComponentPlugin());- universheet.installPlugin(new NumfmtPlugin(config.numfmtConfig));- FormulaPlugin.create(config.formulaConfig).installTo(universheet);+ // ui-plugin-sheets+ univer.install(+ new SheetUIPlugin(config.uiSheetsConfig)+ );+ // universheet.installPlugin(new NumfmtPlugin(config.numfmtConfig));+ // FormulaPlugin.create(config.formulaConfig).installTo(universheet);- universheet.installPlugin(new ClipboardPlugin());- universheet.installPlugin(new ImportXlsxPlugin());- universheet.installPlugin(new CollaborationPlugin(config.collaborationConfig));+ // universheet.installPlugin(new ClipboardPlugin());+ // universheet.installPlugin(new ImportXlsxPlugin());+ // universheet.installPlugin(new CollaborationPlugin(config.collaborationConfig));return universheet;}@@ -51,76 +59,75 @@ const univerSheetCustom = function (config?: ISheetPropsCustom) {return new UniverSheetCustom().init(config);};-interface IDocPropsCustom {- coreConfig?: Partial<IDocumentData>;- baseDocsConfig?: IDocPluginConfig;-}--/**- * Initialize the core and all plugins- */-class UniverDocCustom {- constructor() {}- init(config: IDocPropsCustom = {}): UniverDoc {- const univerdoc = UniverDoc.newInstance(config.coreConfig);-- univerdoc.installPlugin(new RenderEngine());- univerdoc.installPlugin(new UniverComponentSheet());- univerdoc.installPlugin(new DocPlugin(config.baseDocsConfig));-- return univerdoc;- }-}+// interface IDocPropsCustom {+// coreConfig?: Partial<IDocumentData>;+// baseDocsConfig?: IDocPluginConfig;+// }++// /**+// * Initialize the core and all plugins+// */+// class UniverDocCustom {+// constructor() {}+// init(config: IDocPropsCustom = {}): UniverDoc {+// const univerdoc = UniverDoc.newInstance(config.coreConfig);++// univerdoc.installPlugin(new RenderEngine());+// univerdoc.installPlugin(new DocPlugin(config.baseDocsConfig));++// return univerdoc;+// }+// }+// /**+// * Wrapped into a function,easy to use+// * @param config+// * @returns+// */+// const univerDocCustom = function (config?: IDocPropsCustom) {+// return new UniverDocCustom().init(config);+// };++// interface ISlidePropsCustom {+// coreConfig?: Partial<ISlideData>;+// baseSlidesConfig?: ISlidePluginConfig;+// }++// /**+// * Initialize the core and all plugins+// */+// class UniverSlideCustom {+// constructor() {}+// init(config: ISlidePropsCustom = {}): UniverSlide {+// const universlide = UniverSlide.newInstance(config.coreConfig);++// universlide.installPlugin(new RenderEngine());+// universlide.installPlugin(new SlidePlugin(config.baseSlidesConfig));++// return universlide;+// }+// }/*** Wrapped into a function,easy to use* @param config* @returns*/-const univerDocCustom = function (config?: IDocPropsCustom) {- return new UniverDocCustom().init(config);-};--interface ISlidePropsCustom {- coreConfig?: Partial<ISlideData>;- baseSlidesConfig?: ISlidePluginConfig;-}--/**- * Initialize the core and all plugins- */-class UniverSlideCustom {- constructor() {}- init(config: ISlidePropsCustom = {}): UniverSlide {- const universlide = UniverSlide.newInstance(config.coreConfig);-- universlide.installPlugin(new RenderEngine());- universlide.installPlugin(new UniverComponentSheet());- universlide.installPlugin(new SlidePlugin(config.baseSlidesConfig));-- return universlide;- }-}-/**- * Wrapped into a function,easy to use- * @param config- * @returns- */-const univerSlideCustom = function (config?: ISlidePropsCustom) {- return new UniverSlideCustom().init(config);-};+// const univerSlideCustom = function (config?: ISlidePropsCustom) {+// return new UniverSlideCustom().init(config);+// };-export { univerSheetCustom, univerDocCustom, univerSlideCustom };+export { univerSheetCustom};+// export { univerSheetCustom, univerDocCustom, univerSlideCustom };export * as UniverCore from '@univerjs/core';export * as BaseRender from '@univerjs/base-render';export * as BaseComponent from '@univerjs/base-ui';-export * as StyleUniver from '@univerjs/style-univer';export * as BaseSheets from '@univerjs/base-sheets';-export * as BaseDocs from '@univerjs/base-docs';-export * as BaseSlides from '@univerjs/base-slides';+// export * as BaseDocs from '@univerjs/base-docs';+// export * as BaseSlides from '@univerjs/base-slides';+export * as UIPluginSheets from '@univerjs/ui-plugin-sheets';export * as CommonPluginData from '@univerjs/common-plugin-data';-export * as CommonPluginCollaboration from '@univerjs/common-plugin-collaboration';-export * as SheetsPluginFormula from '@univerjs/sheets-plugin-formula';-export * as SheetsPluginNumfmt from '@univerjs/sheets-plugin-numfmt';-export * as SheetsPluginClipboard from '@univerjs/sheets-plugin-clipboard';-export * as SheetsPluginImportXlsx from '@univerjs/sheets-plugin-import-xlsx';+// export * as CommonPluginCollaboration from '@univerjs/common-plugin-collaboration';+// export * as SheetsPluginFormula from '@univerjs/sheets-plugin-formula';+// export * as SheetsPluginNumfmt from '@univerjs/sheets-plugin-numfmt';+// export * as SheetsPluginClipboard from '@univerjs/sheets-plugin-clipboard';+// export * as SheetsPluginImportXlsx from '@univerjs/sheets-plugin-import-xlsx';diff --git a/examples/univer-sheet-ts/src/main.tsx b/examples/univer-sheet-ts/src/main.tsxindex f4440350af..ad71ad5ee6 100644--- a/examples/univer-sheet-ts/src/main.tsx+++ b/examples/univer-sheet-ts/src/main.tsx@@ -60,9 +60,19 @@ universheet.installPlugin(new SheetPlugin());univer.install(new SheetUIPlugin({container: 'universheet',+ layout: {+ sheetContainerConfig: {+ // infoBar: false,+ // formulaBar: false,+ // toolbar:true,+ // sheetBar: false,+ // countBar: false,+ // rightMenu: false+ }+ }}));-FormulaPlugin.create(DEFAULT_FORMULA_DATA_DEMO).installTo(universheet);+// FormulaPlugin.create(DEFAULT_FORMULA_DATA_DEMO).installTo(universheet);FindPlugin.create().installTo(universheet);// sheets-plugin-ui univer.install(new SheetsUI)// sheets-plugin-ui univer.install(new SheetsUIdiff --git a/packages/base-formula-engine/src/index.ts b/packages/base-formula-engine/src/index.tsindex 4762ef84a5..d1129b4b67 100644--- a/packages/base-formula-engine/src/index.ts+++ b/packages/base-formula-engine/src/index.ts@@ -1,11 +1,3 @@export { FormulaEnginePlugin } from './FormulaEnginePlugin';-export {- type FormulaDataType,- type IInterpreterDatasetConfig,- type SheetDataType,- type UnitDataType,- type SheetNameMapType,- type IFormulaData,- type ArrayFormulaDataType,-} from './Basics/Common';+export type { FormulaDataType, IInterpreterDatasetConfig, SheetDataType, UnitDataType, SheetNameMapType, IFormulaData, ArrayFormulaDataType } from './Basics/Common';diff --git a/packages/base-sheets/src/View/Render/Views/SheetView.ts b/packages/base-sheets/src/View/Render/Views/SheetView.tsindex 573f12e84d..541aa77596 100644--- a/packages/base-sheets/src/View/Render/Views/SheetView.ts+++ b/packages/base-sheets/src/View/Render/Views/SheetView.ts@@ -114,7 +114,7 @@ export class SheetView extends BaseView {scene.addObjects([spreadsheet], 0);scene.addObjects([spreadsheetRowTitle, spreadsheetColumnTitle, SpreadsheetLeftTopPlaceholder], 2);scene.transformByState({- width: this._columnWidthByTitle(worksheet),+ width: this._columnWidthByTitle(worksheet) + columnTotalWidth,height: this._rowHeightByTitle(worksheet) + rowTotalHeight,// width: this._columnWidthByTitle(worksheet) + columnTotalWidth + 100,// height: this._rowHeightByTitle(worksheet) + rowTotalHeight + 200,diff --git a/packages/ui-plugin-sheets/src/Controller/FormulaBarUIController.ts b/packages/ui-plugin-sheets/src/Controller/FormulaBarUIController.tsindex d37ae7c0de..a16b09891d 100644--- a/packages/ui-plugin-sheets/src/Controller/FormulaBarUIController.ts+++ b/packages/ui-plugin-sheets/src/Controller/FormulaBarUIController.ts@@ -74,11 +74,11 @@ export class FormulaBarUIController {if (cell) {cellValue = cell.value;}- this._formulaBar.setFormulaContent(cellValue);+ this._formulaBar?.setFormulaContent(cellValue);}// empty cellelse {- this._formulaBar.setFormulaContent('');+ this._formulaBar?.setFormulaContent('');}}});diff --git a/packages/ui-plugin-sheets/src/SheetUIPlugin.ts b/packages/ui-plugin-sheets/src/SheetUIPlugin.tsindex f7791ca13c..03c359e9b0 100644--- a/packages/ui-plugin-sheets/src/SheetUIPlugin.ts+++ b/packages/ui-plugin-sheets/src/SheetUIPlugin.ts@@ -44,7 +44,10 @@ export class SheetUIPlugin extends Plugin<SheetUIPluginObserve, Context> {this._componentManager = new ComponentManager();this._registerManager = new RegisterManager(this);this._appUIController = new AppUIController(this);- this.initRender();+ // AppUIController initializes the DOM as an asynchronous rendering process, and must wait for the UI rendering to complete before starting to render the canvas+ this.UIDidMount(() => {+ this.initRender();+ });}getConfig() {diff --git a/packages/ui-plugin-sheets/src/View/App.tsx b/packages/ui-plugin-sheets/src/View/App.tsxindex eab6ccf4a3..c4c0bd6e54 100644--- a/packages/ui-plugin-sheets/src/View/App.tsx+++ b/packages/ui-plugin-sheets/src/View/App.tsx@@ -47,6 +47,7 @@ export class App extends Component<BaseUIProps, IState> {fontSize: '14px',zIndex: 100,}}+ className="univer-dev-operation"><spanstyle={{