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
feat(base-docs): add base-docs plugin
Dushusir9d19ce262829
diff --git a/packages/base-component/src/Common/AppContext.tsx b/packages/base-component/src/Common/AppContext.tsxindex c41783b88b..ba5f1eb574 100644--- a/packages/base-component/src/Common/AppContext.tsx+++ b/packages/base-component/src/Common/AppContext.tsx@@ -1,7 +1,7 @@/*** Use createContext to provide global language and skin settings*/-import { SheetContext, Locale } from '@univer/core';+import { ContextBase, Locale } from '@univer/core';import { createContext } from 'preact';export type AppContextValues = {@@ -9,7 +9,7 @@ export type AppContextValues = {currentLocale: string;// skin: string; // skin stringmessage: object; // detail Locale message- coreContext: SheetContext;+ coreContext: ContextBase;};const AppContext = createContext<Partial<AppContextValues>>({});diff --git a/packages/base-docs/index.html b/packages/base-docs/index.htmlindex e8b1031294..079daca0cf 100644--- a/packages/base-docs/index.html+++ b/packages/base-docs/index.html@@ -5,7 +5,7 @@<meta charset="UTF-8" /><link rel="icon" type="image/svg+xml" href="favicon.svg" /><meta name="viewport" content="width=device-width, initial-scale=1.0" />- <title>UniverSheet</title>+ <title>UniverDoc</title><style>html,body {@@ -17,7 +17,7 @@<body><div id="app"></div>- <div id="universheet-demo" style="height: 100%;"></div>+ <div id="univerdoc" style="height: 100%;"></div><script type="module" src="/src/main.tsx"></script></body>diff --git a/packages/base-docs/package.json b/packages/base-docs/package.jsonindex 2c40865756..8e65fd24e3 100644--- a/packages/base-docs/package.json+++ b/packages/base-docs/package.json@@ -54,6 +54,7 @@"@univer/base-sheets": "workspace:^0.0.1","@univer/sheets-plugin-filter": "workspace:^0.0.1","@univer/style-universheet": "workspace:^0.0.1",+ "css-vars-ponyfill": "^2.4.6","preact": "^10.5.14"}}diff --git a/packages/base-docs/src/Basic/Observer.ts b/packages/base-docs/src/Basic/Observer.tsnew file mode 100644index 0000000000..e9d0009dbe--- /dev/null+++ b/packages/base-docs/src/Basic/Observer.ts@@ -0,0 +1,90 @@+import { IKeyboardEvent } from '@univer/base-render';+import { Observable, Plugin } from '@univer/core';+import { DocContainer } from '../View/UI/DocContainer';+import { ToolBar } from '../View/UI/ToolBar/ToolBar';++export type SheetPluginObserve = {+ onAfterChangeFontFamilyObservable: Observable<string>;+ onAfterChangeFontSizeObservable: Observable<number>;+ onAfterChangeFontWeightObservable: Observable<boolean>;+ onAfterChangeFontItalicObservable: Observable<boolean>;+ onAfterChangeFontStrikethroughObservable: Observable<boolean>;+ onAfterChangeFontUnderlineObservable: Observable<boolean>;+ onAfterChangeFontBackgroundObservable: Observable<string>;+ onAfterChangeFontColorObservable: Observable<string>;++ onChangeCurrentSheetObserver: Observable<string>;++ onToolBarDidMountObservable: Observable<ToolBar>;++ onDocContainerDidMountObservable: Observable<DocContainer>;++ onSpreadsheetKeyDownObservable: Observable<IKeyboardEvent>;+ onSpreadsheetKeyUpObservable: Observable<IKeyboardEvent>;+ onSpreadsheetKeyCopyObservable: Observable<IKeyboardEvent>;+ onSpreadsheetKeyPasteObservable: Observable<IKeyboardEvent>;+ onSpreadsheetKeyCutObservable: Observable<IKeyboardEvent>;+ onSpreadsheetKeyCompositionStartObservable: Observable<IKeyboardEvent>;+ onSpreadsheetKeyCompositionUpdateObservable: Observable<IKeyboardEvent>;+ onSpreadsheetKeyCompositionEndObservable: Observable<IKeyboardEvent>;+};++export function uninstall(plugin: Plugin) {+ plugin.deleteObserve('onAfterChangeFontFamilyObservable');+ plugin.deleteObserve('onAfterChangeFontSizeObservable');+ plugin.deleteObserve('onAfterChangeFontWeightObservable');+ plugin.deleteObserve('onAfterChangeFontItalicObservable');+ plugin.deleteObserve('onAfterChangeFontStrikethroughObservable');+ plugin.deleteObserve('onAfterChangeFontUnderlineObservable');+ plugin.deleteObserve('onAfterChangeFontBackgroundObservable');+ plugin.deleteObserve('onAfterChangeFontColorObservable');++ plugin.deleteObserve('onToolBarDidMountObservable');++ plugin.deleteObserve('onChangeCurrentSheetObserver');+ plugin.deleteObserve('onDocContainerDidMountObservable');+ plugin.deleteObserve('onSpreadsheetKeyDownObservable');+ plugin.deleteObserve('onSpreadsheetKeyUpObservable');+ plugin.deleteObserve('onSpreadsheetKeyCopyObservable');+ plugin.deleteObserve('onSpreadsheetKeyPasteObservable');+ plugin.deleteObserve('onSpreadsheetKeyCutObservable');+ plugin.deleteObserve('onSpreadsheetKeyCompositionStartObservable');+ plugin.deleteObserve('onSpreadsheetKeyCompositionUpdateObservable');+ plugin.deleteObserve('onSpreadsheetKeyCompositionEndObservable');+}++export function install(plugin: Plugin) {+ plugin.pushToObserve('onAfterChangeFontFamilyObservable');+ plugin.pushToObserve('onAfterChangeFontSizeObservable');+ plugin.pushToObserve('onAfterChangeFontWeightObservable');+ plugin.pushToObserve('onAfterChangeFontItalicObservable');+ plugin.pushToObserve('onAfterChangeFontStrikethroughObservable');+ plugin.pushToObserve('onAfterChangeFontUnderlineObservable');+ plugin.pushToObserve('onAfterChangeFontBackgroundObservable');+ plugin.pushToObserve('onAfterChangeFontColorObservable');++ plugin.pushToObserve('onDragAndDropStartObserver');+ plugin.pushToObserve('onDragAndDroppingObserver');+ plugin.pushToObserve('onDragAndDropEndEndObserver');+ plugin.pushToObserve('onFillStartObserver');+ plugin.pushToObserve('onFillingObserver');+ plugin.pushToObserve('onFillEndObserver');++ plugin.pushToObserve('onChangeCurrentSheetObserver');++ plugin.pushToObserve('onToolBarDidMountObservable');++ plugin.pushToObserve('onSheetBarDidMountObservable');+ plugin.pushToObserve('onCountBarDidMountObservable');+ plugin.pushToObserve('onInfoBarDidMountObservable');+ plugin.pushToObserve('onRightMenuDidMountObservable');+ plugin.pushToObserve('onDocContainerDidMountObservable');+ plugin.pushToObserve('onSpreadsheetKeyDownObservable');+ plugin.pushToObserve('onSpreadsheetKeyUpObservable');+ plugin.pushToObserve('onSpreadsheetKeyCopyObservable');+ plugin.pushToObserve('onSpreadsheetKeyPasteObservable');+ plugin.pushToObserve('onSpreadsheetKeyCutObservable');+ plugin.pushToObserve('onSpreadsheetKeyCompositionStartObservable');+ plugin.pushToObserve('onSpreadsheetKeyCompositionUpdateObservable');+ plugin.pushToObserve('onSpreadsheetKeyCompositionEndObservable');+}diff --git a/packages/base-docs/src/Controller/DocContainerController.ts b/packages/base-docs/src/Controller/DocContainerController.tsnew file mode 100644index 0000000000..6c25206d23--- /dev/null+++ b/packages/base-docs/src/Controller/DocContainerController.ts@@ -0,0 +1,14 @@+import { BooleanNumber, CommandManager } from '@univer/core';+import { DocPlugin } from '../DocPlugin';++export class DocContainerController {+ private _plugin: DocPlugin;++ constructor(plugin: DocPlugin) {+ this._plugin = plugin;++ this._initialize();+ }++ private _initialize() {}+}diff --git a/packages/base-docs/src/Controller/InfoBarController.ts b/packages/base-docs/src/Controller/InfoBarController.tsnew file mode 100644index 0000000000..819fc133bb--- /dev/null+++ b/packages/base-docs/src/Controller/InfoBarController.ts@@ -0,0 +1,77 @@+import { PLUGIN_NAMES } from '@univer/core';+import { InfoBarModel } from '../Model/InfoBarModel';+import { DocPlugin } from '../DocPlugin';+import { InfoBar } from '../View/UI/InfoBar';++type IProps = {+ locale?: string;+ label?: string;+ onBlur?: (e: FocusEvent) => void;+};++export interface BaseInfoBarProps {+ back: IProps;+ update: IProps;+ save: IProps;+ rename: IProps;+ sheet: IProps;+}++export class InfoBarController {+ private _infoBarModel: InfoBarModel;++ private _infoBar: InfoBar;++ private _plugin: DocPlugin;++ private _infoList: BaseInfoBarProps;++ constructor(plugin: DocPlugin) {+ this._plugin = plugin;+ this._infoList = {+ back: {+ locale: 'info.return',+ },+ update: {+ locale: 'info.detailUpdate',+ },+ save: {+ locale: 'info.detailSave',+ },+ rename: {+ locale: 'info.tips',+ },+ sheet: {+ label: 'UniverDoc Demo',+ onBlur: this.setDocName,+ },+ };+ this._initialize();+ }++ private _initialize() {+ const context = this._plugin.context;+ const manager = context.getObserverManager();++ manager.requiredObserver<InfoBar>('onInfoBarDidMountObservable', PLUGIN_NAMES.DOCUMENT).add((component) => {+ this._infoBar = component;+ this.resetInfoList(this._infoList);+ });+ }++ resetInfoList(list: BaseInfoBarProps) {+ const locale = this._plugin.context.getLocale();+ for (let k in list) {+ if (list[k].locale) {+ list[k].label = locale.get(list[k].locale);+ }+ }+ this._infoBar.setInfoList(list);+ }++ setDocName(e: FocusEvent) {+ const target = e.target as HTMLInputElement;+ const name = target.value;+ this._infoBarModel.setName(name);+ }+}diff --git a/packages/base-docs/src/Controller/ToolBarController.ts b/packages/base-docs/src/Controller/ToolBarController.tsnew file mode 100644index 0000000000..9a051d4c6d--- /dev/null+++ b/packages/base-docs/src/Controller/ToolBarController.ts@@ -0,0 +1,321 @@+import { BaseComponentRender, BaseComponentSheet } from '@univer/base-component';+import { Tools, BorderType, BorderStyleTypes, HorizontalAlign, VerticalAlign, WrapStrategy, DEFAULT_STYLES } from '@univer/core';+import { ColorPicker } from '@univer/style-universheet';+import { DocPlugin } from '../DocPlugin';+import { defaultLayout, ILayout } from '../View/UI/DocContainer';++import {+ BORDER_LINE_CHILDREN,+ FONT_FAMILY_CHILDREN,+ FONT_SIZE_CHILDREN,+ HORIZONTAL_ALIGN_CHILDREN,+ MERGE_CHILDREN,+ TEXT_ROTATE_CHILDREN,+ TEXT_WRAP_CHILDREN,+ VERTICAL_ALIGN_CHILDREN,+} from '../View/UI/ToolBar/Const';+import styles from '../View/UI/ToolBar/index.module.less';+import { LineColor } from '../View/UI/Common/Line/LineColor';+import { ToolBar } from '../View/UI/ToolBar';+import { IToolBarItemProps, ToolBarModel } from '../Model/ToolBarModel';++interface BorderInfo {+ color: string;+ width: string;+}++/**+ *+ */+export class ToolBarController {+ private _toolBarModel: ToolBarModel;++ private _plugin: DocPlugin;++ private _toolBarComponent: ToolBar;++ private _toolList: IToolBarItemProps[];++ private _lineColor: LineColor;++ Render: BaseComponentRender;++ private _borderInfo: BorderInfo; //存储边框信息++ constructor(plugin: DocPlugin) {+ this._plugin = plugin;++ const pluginName = this._plugin.getPluginName();++ this.initRegisterComponent();++ const config =+ this._plugin.config.layout === 'auto'+ ? Tools.deepClone(defaultLayout.toolBarConfig)+ : Tools.deepMerge(defaultLayout.toolBarConfig, (this._plugin.config.layout as ILayout).toolBarConfig);++ this._borderInfo = {+ color: '#000',+ width: '1',+ };++ this._toolList = [+ {+ toolbarType: 1,+ tooltipLocale: 'toolbar.undo',+ customLabel: {+ name: 'ForwardIcon',+ },+ show: config.undoRedo,+ onClick: () => {+ this.setUndo();+ },+ },+ {+ toolbarType: 1,+ tooltipLocale: 'toolbar.redo',+ customLabel: {+ name: 'BackIcon',+ },+ show: config.undoRedo,+ onClick: () => {+ this.setRedo();+ },+ },++ {+ type: 0,+ tooltipLocale: 'font',+ selectClassName: styles.selectLabelString,+ show: config.font,+ border: true,+ onClick: (fontFamily: string) => {+ this._plugin.getObserver('onAfterChangeFontFamilyObservable')?.notifyObservers(fontFamily);+ },+ children: FONT_FAMILY_CHILDREN,+ },+ {+ type: 1,+ tooltipLocale: 'fontSize',+ label: String(DEFAULT_STYLES.fs),+ show: config.fontSize,+ onClick: (fontSize: number) => {+ this._plugin.getObserver('onAfterChangeFontSizeObservable')?.notifyObservers(fontSize);+ },+ onKeyUp: (fontSize: number) => {+ this._plugin.getObserver('onAfterChangeFontSizeObservable')?.notifyObservers(fontSize);+ },+ children: FONT_SIZE_CHILDREN,+ },+ {+ toolbarType: 1,+ tooltipLocale: 'bold',+ customLabel: {+ name: 'BoldIcon',+ },+ show: config.bold,+ onClick: (isBold: boolean) => {+ this._plugin.getObserver('onAfterChangeFontWeightObservable')?.notifyObservers(isBold);+ },+ },+ {+ toolbarType: 1,+ tooltipLocale: 'italic',+ customLabel: {+ name: 'ItalicIcon',+ },+ show: config.italic,+ onClick: (isItalic: boolean) => {+ this._plugin.getObserver('onAfterChangeFontItalicObservable')?.notifyObservers(isItalic);+ },+ },+ {+ toolbarType: 1,+ tooltipLocale: 'strikethrough',+ customLabel: {+ name: 'DeleteLineIcon',+ },+ show: config.strikethrough,+ onClick: (isStrikethrough: boolean) => {+ this._plugin.getObserver('onAfterChangeFontStrikethroughObservable')?.notifyObservers(isStrikethrough);+ },+ },+ {+ toolbarType: 1,+ tooltipLocale: 'underline',+ customLabel: {+ name: 'UnderLineIcon',+ },+ show: config.underline,+ onClick: (isItalic: boolean) => {+ this._plugin.getObserver('onAfterChangeFontUnderlineObservable')?.notifyObservers(isItalic);+ },+ },+ {+ type: 2,+ tooltipLocale: 'textColor',+ customLabel: {+ name: 'TextColorIcon',+ },+ show: config.textColor,+ onClick: (color: string) => {+ this._plugin.getObserver('onAfterChangeFontColorObservable')?.notifyObservers(color);+ },+ },+ {+ type: 2,+ tooltipLocale: 'fillColor',+ customLabel: {+ name: 'FillColorIcon',+ },+ show: config.fillColor,+ onClick: (color: string) => {+ this._plugin.getObserver('onAfterChangeFontBackgroundObservable')?.notifyObservers(color);+ },+ },+ ];++ this._toolBarModel = new ToolBarModel();+ this._toolBarModel.config = config;+ this._toolBarModel.toolList = this._toolList;++ this.init();+ }++ init() {+ this._plugin.getObserver('onAfterChangeFontFamilyObservable')?.add((value: string) => {+ this.setFontFamily(value);+ });+ this._plugin.getObserver('onAfterChangeFontSizeObservable')?.add((value: number) => {+ this.setFontSize(value);+ });+ this._plugin.getObserver('onAfterChangeFontWeightObservable')?.add((value: boolean) => {+ this.setFontWeight(value);+ });+ this._plugin.getObserver('onAfterChangeFontItalicObservable')?.add((value: boolean) => {+ this.setFontStyle(value);+ });+ this._plugin.getObserver('onAfterChangeFontStrikethroughObservable')?.add((value: boolean) => {+ this.setStrikeThrough(value);+ });+ this._plugin.getObserver('onAfterChangeFontUnderlineObservable')?.add((value: boolean) => {+ this.setUnderline(value);+ });+ this._plugin.getObserver('onAfterChangeFontColorObservable')?.add((value: string) => {+ this.setFontColor(value);+ });+ this._plugin.getObserver('onAfterChangeFontBackgroundObservable')?.add((value: string) => {+ this.setBackground(value);+ });++ this._plugin.getObserver('onToolBarDidMountObservable')?.add((component) => {+ //初始化视图+ this._toolBarComponent = component;+ this.resetToolBarList();+ });++ this._plugin.context+ .getObserverManager()+ .getObserver('onAfterChangeUILocaleObservable', 'workbook')+ ?.add(() => {});+ }++ initRegisterComponent() {+ const component = this._plugin.context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+ const pluginName = this._plugin.getPluginName();+ this.Render = component.getComponentRender();+ const registerIcon = {+ ForwardIcon: this.Render.renderFunction('ForwardIcon'),+ BackIcon: this.Render.renderFunction('BackIcon'),+ BoldIcon: this.Render.renderFunction('BoldIcon'),+ ItalicIcon: this.Render.renderFunction('ItalicIcon'),+ DeleteLineIcon: this.Render.renderFunction('DeleteLineIcon'),+ UnderLineIcon: this.Render.renderFunction('UnderLineIcon'),+ TextColorIcon: this.Render.renderFunction('TextColorIcon'),+ FillColorIcon: this.Render.renderFunction('FillColorIcon'),+ MergeIcon: this.Render.renderFunction('MergeIcon'),+ TopBorderIcon: this.Render.renderFunction('TopBorderIcon'),+ BottomBorderIcon: this.Render.renderFunction('BottomBorderIcon'),+ LeftBorderIcon: this.Render.renderFunction('LeftBorderIcon'),+ RightBorderIcon: this.Render.renderFunction('RightBorderIcon'),+ NoneBorderIcon: this.Render.renderFunction('NoneBorderIcon'),+ FullBorderIcon: this.Render.renderFunction('FullBorderIcon'),+ OuterBorderIcon: this.Render.renderFunction('OuterBorderIcon'),+ InnerBorderIcon: this.Render.renderFunction('InnerBorderIcon'),+ StripingBorderIcon: this.Render.renderFunction('StripingBorderIcon'),+ VerticalBorderIcon: this.Render.renderFunction('VerticalBorderIcon'),+ LeftAlignIcon: this.Render.renderFunction('LeftAlignIcon'),+ CenterAlignIcon: this.Render.renderFunction('CenterAlignIcon'),+ RightAlignIcon: this.Render.renderFunction('RightAlignIcon'),+ TopVerticalIcon: this.Render.renderFunction('TopVerticalIcon'),+ CenterVerticalIcon: this.Render.renderFunction('CenterVerticalIcon'),+ BottomVerticalIcon: this.Render.renderFunction('BottomVerticalIcon'),+ OverflowIcon: this.Render.renderFunction('OverflowIcon'),+ BrIcon: this.Render.renderFunction('BrIcon'),+ CutIcon: this.Render.renderFunction('CutIcon'),+ TextRotateIcon: this.Render.renderFunction('TextRotateIcon'),+ TextRotateAngleUpIcon: this.Render.renderFunction('TextRotateAngleUpIcon'),+ TextRotateAngleDownIcon: this.Render.renderFunction('TextRotateAngleDownIcon'),+ TextRotateVerticalIcon: this.Render.renderFunction('TextRotateVerticalIcon'),+ TextRotateRotationUpIcon: this.Render.renderFunction('TextRotateRotationUpIcon'),+ TextRotateRotationDownIcon: this.Render.renderFunction('TextRotateRotationDownIcon'),+ };++ // 注册自定义组件+ this._plugin.registerComponent(pluginName + LineColor.name, LineColor);+ this._plugin.registerComponent(pluginName + ColorPicker.name, ColorPicker);+ for (let k in registerIcon) {+ this._plugin.registerComponent(k, registerIcon[k]);+ }+ }++ resetLocale(toolList: any[]) {+ const locale = this._plugin.context.getLocale();++ for (let i = 0; i < toolList.length; i++) {+ const item = toolList[i];+ if (item.tooltipLocale) {+ item.tooltip = locale.get(item.tooltipLocale);+ }+ if (item.locale) {+ item.label = locale.get(item.locale);+ }+ if (item.suffixLocale) {+ item.suffix = locale.get(item.suffixLocale);+ }+ if (item.children) {+ item.children = this.resetLocale(item.children);+ }+ }+ return toolList;+ }++ resetToolBarList() {+ const toolList = this.resetLocale(this._toolList);+ this._toolBarComponent.setToolBar(toolList);+ }++ setRedo() {+ this._plugin.getContext().getCommandManager().redo();+ }++ setUndo() {+ this._plugin.getContext().getCommandManager().undo();+ }++ setFontColor(value: string) {}++ setBackground(value: string) {}++ setFontSize(value: number) {}++ setFontFamily(value: string) {}++ setFontWeight(value: boolean) {}++ setFontStyle(value: boolean) {}++ setStrikeThrough(value: boolean) {}++ setUnderline(value: boolean) {}+}diff --git a/packages/base-docs/src/DocPlugin.tsx b/packages/base-docs/src/DocPlugin.tsxnew file mode 100644index 0000000000..08fba9fa4a--- /dev/null+++ b/packages/base-docs/src/DocPlugin.tsx@@ -0,0 +1,187 @@+import { DocContext, Plugin, PLUGIN_NAMES, UniverSheet, Tools, AsyncFunction } from '@univer/core';+import { zh, en } from './Locale';+import { IOCContainer } from '@univer/core';+import { getRefElement, isElement, ISlotProps, RefObject, render } from '@univer/base-component';+import { install } from './Basic/Observer';+import { ToolBarController } from './Controller/ToolBarController';+import { DocContainerController } from './Controller/DocContainerController';+import { BaseDocContainerConfig, DocContainer, IDocPluginConfigBase } from './View/UI/DocContainer';+import { InfoBarController } from './Controller/InfoBarController';+import { Engine, RenderEngine } from '@univer/base-render';++export interface IDocPluginConfig extends IDocPluginConfigBase {+ container: HTMLElement | string;+}++const DEFAULT_DOCUMENT_PLUGIN_DATA = {+ container: 'univerdoc',+ layout: 'auto',+};++export class DocPlugin extends Plugin {+ private _config: IDocPluginConfig;+ private _toolBarRef: RefObject<HTMLElement>;+ private _infoBarControl: InfoBarController;++ private _splitLeftRef: RefObject<HTMLDivElement>;++ private _contentRef: RefObject<HTMLDivElement>;++ private _addButtonFunc: Function;++ private _addSiderFunc: AsyncFunction<ISlotProps>;++ private _addMainFunc: Function;++ private _showSiderByNameFunc: Function;++ private _showMainByNameFunc: Function;++ private _canvasEngine: Engine;++ private _toolBarControl: ToolBarController;+ private _docContainerController: DocContainerController;+ private _componentList: Map<string, any>;++ constructor(config: Partial<IDocPluginConfig> = {}) {+ super(PLUGIN_NAMES.DOCUMENT);++ this._config = Tools.commonExtend(DEFAULT_DOCUMENT_PLUGIN_DATA, config);+ }++ static create(config?: IDocPluginConfig) {+ return new DocPlugin(config);+ }++ installTo(universheetInstance: UniverSheet) {+ universheetInstance.installPlugin(this);+ }++ initialize(): void {+ const context = this.getContext();++ this.getObserver('onDocContainerDidMountObservable')?.add(() => {+ this._initializeRender(context);+ });++ /**+ * load more Locale object+ */+ context.getLocale().load({+ en: en,+ zh: zh,+ });++ this._componentList = new Map();++ this._toolBarControl = new ToolBarController(this);+ this._infoBarControl = new InfoBarController(this);+ this._docContainerController = new DocContainerController(this);++ const docContainer = this._initContainer(this._config.container);++ const config: BaseDocContainerConfig = {+ skin: 'default',+ layout: this._config.layout,+ container: docContainer,+ context,+ getSplitLeftRef: (ref) => {+ this._splitLeftRef = ref;+ },+ getContentRef: (ref) => {+ this._contentRef = ref;+ },+ addButton: (cb: Function) => {+ this._addButtonFunc = cb;+ },+ addSider: (cb: AsyncFunction<ISlotProps>) => {+ this._addSiderFunc = cb;+ },+ addMain: (cb: Function) => {+ this._addMainFunc = cb;+ },+ showSiderByName: (cb: Function) => {+ this._showSiderByNameFunc = cb;+ },+ showMainByName: (cb: Function) => {+ this._showMainByNameFunc = cb;+ },+ onDidMount: () => {},+ };++ render(<DocContainer config={config} />, docContainer);+ }++ /**+ * Convert id to DOM+ * @param container+ * @returns+ */+ private _initContainer(container: HTMLElement | string) {+ let docContainer = null;+ if (typeof container === 'string') {+ const containerDOM = document.getElementById(container);+ if (containerDOM == null) {+ docContainer = document.createElement('div');+ docContainer.id = container;+ } else {+ docContainer = containerDOM;+ }+ } else if (isElement(container)) {+ docContainer = container;+ } else {+ docContainer = document.createElement('div');+ docContainer.id = 'univerdoc';+ }++ return docContainer;+ }++ private _initializeRender(context: DocContext) {+ const engine = this.getPluginByName<RenderEngine>(PLUGIN_NAMES.BASE_RENDER)?.getEngine()!;++ this.register(engine);+ }++ register(engineInstance: Engine) {+ // The preact ref component cannot determine whether ref.current or ref.current.base is DOM+ let container: HTMLElement = getRefElement(this.getContentRef());++ this._canvasEngine = engineInstance;++ engineInstance.setContainer(container);+ window.onresize = () => {+ engineInstance.resize();+ };+ }++ get config() {+ return this._config;+ }++ getContentRef(): RefObject<HTMLDivElement> {+ return this._contentRef;+ }+ getToolBarControl() {+ return this._toolBarControl;+ }++ getInfoBarControl() {+ return this._infoBarControl;+ }++ onMounted(ctx: DocContext): void {+ install(this);+ this.initialize();+ }++ onDestroy(): void {}++ registerComponent(name: string, component: any, props?: any) {+ this._componentList.set(name, component);+ }++ getRegisterComponent(name: string) {+ return this._componentList.get(name);+ }+}diff --git a/packages/base-docs/src/DocsPlugin.tsx b/packages/base-docs/src/DocsPlugin.tsxdeleted file mode 100644index bf4064dd7d..0000000000--- a/packages/base-docs/src/DocsPlugin.tsx+++ /dev/null@@ -1,39 +0,0 @@-import { SheetContext, Plugin, PLUGIN_NAMES, UniverSheet } from '@univer/core';-import { zh, en } from './Locale';-import { IOCContainer } from '@univer/core';--export interface IDocsPluginConfig {}--export class DocsPlugin extends Plugin {- constructor(config?: IDocsPluginConfig) {- super(PLUGIN_NAMES.DOCUMENT);- }-- static create(config?: IDocsPluginConfig) {- return new DocsPlugin(config);- }-- installTo(universheetInstance: UniverSheet) {- universheetInstance.installPlugin(this);- }-- initialize(): void {- const context = this.getContext();-- /**- * load more Locale object- */- context.getLocale().load({- en: en,- zh: zh,- });- }-- onMapping(IOC: IOCContainer): void {}-- onMounted(ctx: SheetContext): void {- this.initialize();- }-- onDestroy(): void {}-}diff --git a/packages/base-docs/src/Locale/en.ts b/packages/base-docs/src/Locale/en.tsindex 699f0d5814..6741a7f58d 100644--- a/packages/base-docs/src/Locale/en.ts+++ b/packages/base-docs/src/Locale/en.ts@@ -1,9 +1,513 @@export default {- docsLabel: 'Docs',- docsRightLabel: 'more Docs',- docs: {+ spreadsheetLabel: 'Spreadsheet',+ spreadsheetRightLabel: 'more Sheets',+ spreadsheet: {one: 'one',two: 'two',three: 'three',},++ toolbar: {+ undo: 'Undo',+ redo: 'Redo',+ paintFormat: 'Paint format',+ currencyFormat: 'Format as currency',+ percentageFormat: 'Format as percent',+ numberDecrease: 'Decrease decimal places',+ numberIncrease: 'Increase decimal places',+ moreFormats: 'More formats',+ font: 'Font',+ fontSize: 'Font size',+ bold: 'Bold (Ctrl+B)',+ italic: 'Italic (Ctrl+I)',+ strikethrough: 'Strikethrough (Alt+Shift+5)',+ underline: 'Underline',+ textColor: {+ main: 'Text color',+ right: 'Choose color',+ },+ resetColor: 'Reset',+ customColor: 'CUSTOM',+ alternatingColors: 'Alternating colors',+ confirmColor: 'OK',+ cancelColor: 'Cancel',+ collapse: 'Collapse',+ fillColor: {+ main: 'Fill color',+ right: 'Choose color',+ },+ border: {+ main: 'Border',+ right: 'Border style',+ },+ mergeCell: {+ main: 'Merge cells',+ right: 'Choose merge type',+ },+ horizontalAlignMode: {+ main: 'Horizontal align',+ right: 'Alignment',+ },+ verticalAlignMode: {+ main: 'Vertical align',+ right: 'Alignment',+ },+ textWrapMode: {+ main: 'Text wrap',+ right: 'Text wrap mode',+ },+ textRotateMode: {+ main: 'Text rotate',+ right: 'Text rotate mode',+ },+ freezeTopRow: 'Freeze top row',+ sortAndFilter: 'Sort and filter',+ findAndReplace: 'Find and replace',+ sum: 'SUM',+ autoSum: 'Auto SUM',+ moreFunction: 'More functions',+ conditionalFormat: 'Conditional format',+ comment: 'Comment',+ pivotTable: 'Pivot Table',+ chart: 'Chart',+ screenshot: 'Screenshot',+ splitColumn: 'Split text',+ insertImage: 'Insert image',+ insertLink: 'Insert link',+ dataValidation: 'Data validation',+ protection: 'Protect the sheet',++ clearText: 'Clear color',+ noColorSelectedText: 'No color is selected',++ toolMore: 'More',+ toolLess: 'Less',+ toolClose: 'Close',+ toolMoreTip: 'More features',+ moreOptions: 'More options',++ cellFormat: 'Cell format config',+ print: 'Print',+ borderMethod: {+ top: 'Upper frame line',+ bottom: 'Lower frame line',+ left: 'Left frame line',+ right: 'Right frame line',+ },+ more: 'More',+ },+ defaultFmt: {+ Automatic: {+ text: 'Automatic',+ value: 'General',+ example: '',+ },+ Number: {+ text: 'Number',+ value: '##0.00',+ example: '1000.12',+ },+ Percent: {+ text: 'Percent',+ value: '#0.00%',+ example: '12.21%',+ },+ PlainText: {+ text: 'Plain text',+ value: '@',+ example: '',+ },+ Scientific: {+ text: 'Scientific',+ value: '0.00E+00',+ example: '1.01E+5',+ },+ Accounting: {+ text: 'Accounting',+ value: '¥(0.00)',+ example: '¥(1200.09)',+ },+ Thousand: {+ text: 'Ten Thousand',+ value: 'w',+ example: '1亿2000万2500',+ },+ Currency: {+ text: 'Currency',+ value: '¥0.00',+ example: '¥1200.09',+ },+ Digit: {+ text: '万元2位小数',+ value: 'w0.00',+ example: '2万2500.55',+ },+ Date: {+ text: 'Date',+ value: 'yyyy-MM-dd',+ example: '2017-11-29',+ },+ Time: { text: 'Time', value: 'hh:mm AM/PM', example: '3:00 PM' },+ Time24H: { text: 'Time 24H', value: 'hh:mm', example: '15:00' },+ DateTime: { text: 'Date time', value: 'yyyy-MM-dd hh:mm AM/PM', example: '2017-11-29 3:00 PM' },+ DateTime24H: { text: 'Date time 24H', value: 'yyyy-MM-dd hh:mm', example: '2017-11-29 15:00' },+ CustomFormats: { text: 'Custom Formats', value: 'fmtOtherSelf', example: '' },+ },+ format: {+ moreCurrency: 'More currency formats',+ moreDateTime: 'More date and time formats',+ moreNumber: 'More number formats',++ titleCurrency: 'Currency formats',+ decimalPlaces: 'Decimal places',+ titleDateTime: 'Date and time formats',+ titleNumber: 'Number formats',+ },+ fontFamily: {+ TimesNewRoman: 'Times New Roman',+ Arial: 'Arial',+ Tahoma: 'Tahoma',+ Verdana: 'Verdana',+ MicrosoftAccorblack: 'Microsoft Accor black ',+ SimSun: 'SimSun',+ SimHei: 'SimHei',+ Kaiti: 'Kaiti',+ FangSong: 'FangSong',+ NSimSun: 'NSimSun',+ STXinwei: 'STXinwei',+ STXingkai: 'STXingkai',+ STLiti: 'STLiti',+ HanaleiFill: 'HanaleiFill',+ Anton: 'Anton',+ Pacifico: 'Pacifico',+ },+ print: {+ normalBtn: 'Normal',+ layoutBtn: 'Page Layout',+ pageBtn: 'Page break preview',++ menuItemPrint: 'Print (Ctrl+P)',+ menuItemAreas: 'Print areas',+ menuItemRows: 'Print title rows',+ menuItemColumns: 'Print title columns',+ },+ align: {+ left: 'left',+ center: 'center',+ right: 'right',++ top: 'top',+ middle: 'middle',+ bottom: 'bottom',+ },++ dateFmtList: [+ {+ name: '1930-08-05',+ value: 'yyyy-MM-dd',+ },+ {+ name: '1930/8/5',+ value: 'yyyy/MM/dd',+ },+ {+ name: '08-05',+ value: 'MM-dd',+ },+ {+ name: '8-5',+ value: 'M-d',+ },+ {+ name: '13:30:30',+ value: 'h:mm:ss',+ },+ {+ name: '13:30',+ value: 'h:mm',+ },+ {+ name: 'PM 01:30',+ value: 'AM/PM hh:mm',+ },+ {+ name: 'PM 1:30',+ value: 'AM/PM h:mm',+ },+ {+ name: 'PM 1:30:30',+ value: 'AM/PM h:mm:ss',+ },+ {+ name: '08-05 PM 01:30',+ value: 'MM-dd AM/PM hh:mm',+ },+ ],+ numFmtList: [+ {+ name: '1235',+ value: '0',+ },+ {+ name: '1234.56',+ value: '0.00',+ },+ {+ name: '1,235',+ value: '#,##0',+ },+ {+ name: '1,234.56',+ value: '#,##0.00',+ },+ {+ name: '1,235',+ value: '#,##0_);(#,##0)',+ },+ {+ name: '1,235',+ value: '#,##0_);[Red](#,##0)',+ },+ {+ name: '1,234.56',+ value: '#,##0.00_);(#,##0.00)',+ },+ {+ name: '1,234.56',+ value: '#,##0.00_);[Red](#,##0.00)',+ },+ {+ name: '$1,235',+ value: '$#,##0_);($#,##0)',+ },+ {+ name: '$1,235',+ value: '$#,##0_);[Red]($#,##0)',+ },+ {+ name: '$1,234.56',+ value: '$#,##0.00_);($#,##0.00)',+ },+ {+ name: '$1,234.56',+ value: '$#,##0.00_);[Red]($#,##0.00)',+ },+ {+ name: '1234.56',+ value: '@',+ },+ {+ name: '123456%',+ value: '0%',+ },+ {+ name: '123456.00%',+ value: '0.00%',+ },+ {+ name: '1.23E+03',+ value: '0.00E+00',+ },+ {+ name: '1.2E+3',+ value: '##0.0E+0',+ },+ {+ name: '1234 5/9',+ value: '# ?/?',+ },+ {+ name: '1234 14/25',+ value: '# ??/??',+ },+ {+ name: '$ 1,235',+ value: '_($* #,##0_);_(...($* "-"_);_(@_)',+ },+ {+ name: '1,235',+ value: '_(* #,##0_);_(*..._(* "-"_);_(@_)',+ },+ {+ name: '$ 1,234.56',+ // "value": '_($* #,##0.00_)...* "-"??_);_(@_)'+ value: '_($* #,##0.00_);_(...($* "-"_);_(@_)',+ },+ {+ name: '1,234.56',+ value: '_(* #,##0.00_);...* "-"??_);_(@_)',+ },+ ],+ button: {+ confirm: 'OK',+ cancel: 'Cancel',+ close: 'Close',+ update: 'Update',+ delete: 'Delete',+ insert: 'Insert',+ prevPage: 'Previous',+ nextPage: 'Next',+ total: 'total:',+ },+ punctuation: {+ tab: 'Tab',+ semicolon: 'semicolond',+ comma: 'comma',+ space: 'space',+ },+ colorPicker: {+ collapse: 'Collapse',+ customColor: 'CUSTOM',+ change: 'Change',+ confirmColor: 'OK',+ cancelColor: 'Cancel',+ },+ borderLine: {+ borderTop: 'borderTop',+ borderBottom: 'borderBottom',+ borderLeft: 'borderLeft',+ borderRight: 'borderRight',+ borderNone: 'borderNone',+ borderAll: 'borderAll',+ borderOutside: 'borderOutside',+ borderInside: 'borderInside',+ borderHorizontal: 'borderHorizontal',+ borderVertical: 'borderVertical',+ borderColor: 'borderColor',+ borderSize: 'borderSize',+ },+ merge: {+ all: 'Merge all',+ vertical: 'Vertical merge',+ horizontal: 'Horizontal merger',+ cancel: 'Cancel merge',+ overlappingError: 'Cannot merge overlapping areas',+ partiallyError: 'Cannot perform this operation on partially merged cells',+ },+ textWrap: {+ overflow: 'Overflow',+ wrap: 'Wrap',+ clip: 'Clip',+ },+ textRotate: {+ none: 'None',+ angleUp: 'Tilt Up',+ angleDown: 'Tilt Down',+ vertical: 'Stack Vertically',+ rotationUp: 'Rotate Up',+ rotationDown: 'Rotate Down',+ },+ sheetConfig: {+ delete: 'Delete',+ copy: 'Copy',+ rename: 'Rename',+ changeColor: 'Change color',+ hide: 'Hide',+ unhide: 'Unhide',+ moveLeft: 'Move left',+ moveRight: 'Move right',+ resetColor: 'Reset color',+ cancelText: 'Cancel',+ chooseText: 'Confirm color',++ tipNameRepeat: 'The name of the tab page cannot be repeated! Please revise',+ noMoreSheet: 'The workbook contains at least one visual worksheet. To delete the selected worksheet, please insert a new worksheet or show a hidden worksheet.',+ confirmDelete: 'Are you sure to delete',+ redoDelete: 'Can be undo by Ctrl+Z',+ noHide: "Can't hide, at least keep one sheet tag",+ chartEditNoOpt: 'This operation is not allowed in chart editing mode!',+ sheetNameSpecCharError: 'The name cannot contain:[ ] : ? * / \' "',+ sheetNameCannotIsEmptyError: 'Sheet name cannot be empty',+ },+ rightClick: {+ copy: 'Copy',+ copyAs: 'Copy as',+ paste: 'Paste',+ insert: 'Insert',+ delete: 'Delete',+ deleteCell: 'Delete cell',+ deleteSelected: 'Delete selected ',+ hide: 'Hide',+ hideSelected: 'Hide selected ',+ showHide: 'Show hidden ',+ to: 'Towards',+ left: 'Left',+ right: 'Right',+ top: 'Top',+ bottom: 'Bottom',+ moveLeft: 'Move left',+ moveUp: 'Move up',+ add: 'Add',+ row: 'Row',+ column: 'Column',+ width: 'Width',+ height: 'Height',+ number: 'Number',+ confirm: 'Confirm',+ orderAZ: 'A-Z order',+ orderZA: 'Z-A order',+ clearContent: 'Clear content',+ matrix: 'Matrix operation',+ sortSelection: 'Sort',+ filterSelection: 'Filter',+ chartGeneration: 'Create chart',+ firstLineTitle: 'first line title',+ untitled: 'untitled',+ array1: 'One-dimensional array',+ array2: 'Two-dimensional array',+ array3: 'Multidimensional Arrays',+ diagonal: 'Diagonal',+ antiDiagonal: 'Anti-diagonal',+ diagonalOffset: 'Diagonal offset',+ offset: 'Offset',+ boolean: 'Boolean',+ flip: 'Flip',+ upAndDown: 'Up and down',+ leftAndRight: 'Left and right',+ clockwise: 'Clockwise',+ counterclockwise: 'Counterclockwise',+ transpose: 'Transpose',+ matrixCalculation: 'Matrix calculation',+ plus: 'Plus',+ minus: 'Minus',+ multiply: 'Multiply',+ divided: 'Divided',+ power: 'Power',+ root: 'Root',+ log: 'Log',+ delete0: 'Delete 0 values at both ends',+ removeDuplicate: 'Remove duplicate values',+ byRow: 'By row',+ byCol: 'By column',+ generateNewMatrix: 'Generate new matrix',+ },+ info: {+ detailUpdate: 'New opened',+ detailSave: 'Local cache restored',+ row: '',+ column: '',+ loading: 'Loading...',++ copy: 'Copy',+ return: 'Exit',+ rename: 'Rename',+ tips: 'WorkBook rename',+ noName: 'Untitled spreadsheet',+ wait: 'waiting for update',++ add: 'Add',+ addLast: 'more rows at bottom',+ backTop: 'Back to the top',+ // eslint-disable-next-line no-template-curly-in-string+ pageInfo: 'Total ${total},${totalPage} page,current ${currentPage}',+ nextPage: 'Next',++ tipInputNumber: 'Please enter the number',+ tipInputNumberLimit: 'The increase range is limited to 1-100',++ tipRowHeightLimit: 'Row height must be between 0 ~ 545',+ tipColumnWidthLimit: 'The column width must be between 0 ~ 2038',+ // eslint-disable-next-line no-template-curly-in-string+ pageInfoFull: 'Total ${total},${totalPage} page,All data displayed',+ },};diff --git a/packages/base-docs/src/Locale/zh.ts b/packages/base-docs/src/Locale/zh.tsindex fabbdd187e..867e8315e7 100644--- a/packages/base-docs/src/Locale/zh.ts+++ b/packages/base-docs/src/Locale/zh.ts@@ -1,9 +1,376 @@export default {- docsLabel: '插件',- docsRightLabel: '更多 Docs',- docs: {+ spreadsheetLabel: '插件',+ spreadsheetRightLabel: '更多 Sheets',+ spreadsheet: {one: '一',two: '二',three: '三',},++ toolbar: {+ undo: '撤销',+ redo: '重做',+ paintFormat: '格式刷',+ currencyFormat: '货币格式',+ percentageFormat: '百分比格式',+ numberDecrease: '减少小数位数',+ numberIncrease: '增加小数位数',+ moreFormats: '更多格式',+ font: '字体',+ fontSize: '字号大小',+ bold: '粗体 (Ctrl+B)',+ italic: '斜体 (Ctrl+I)',+ strikethrough: '删除线 (Alt+Shift+5)',+ underline: '下划线',+ textColor: {+ main: '文本颜色',+ right: '颜色选择',+ },+ resetColor: '重置颜色',+ customColor: '自定义',+ alternatingColors: '交替颜色',+ confirmColor: '确定颜色',+ cancelColor: '取消',+ collapse: '收起',+ fillColor: {+ main: '单元格颜色',+ right: '颜色选择',+ },+ border: {+ main: '边框',+ right: '边框类型',+ },+ mergeCell: {+ main: '合并单元格',+ right: '选择合并类型',+ },+ horizontalAlignMode: {+ main: '水平对齐',+ right: '对齐方式',+ },+ verticalAlignMode: {+ main: '垂直对齐',+ right: '对齐方式',+ },+ textWrapMode: {+ main: '文本换行',+ right: '换行方式',+ },+ textRotateMode: {+ main: '文本旋转',+ right: '旋转方式',+ },+ freezeTopRow: '冻结首行',+ sortAndFilter: '排序和筛选',+ findAndReplace: '查找替换',+ sum: '求和',+ autoSum: '自动求和',+ moreFunction: '更多函数',+ conditionalalFormat: '条件格式',+ comment: '批注',+ pivotTable: '数据透视表',+ chart: '图表',+ screenshot: '截图',+ splitColumn: '分列',+ insertImage: '插入图片',+ insertLink: '插入链接',+ dataValidation: '数据验证',+ protection: '保护工作表内容',++ clearText: '清除颜色选择',+ noColorSelectedText: '没有颜色被选择',++ toolMore: '更多',+ toolLess: '少于',+ toolClose: '收起',+ toolMoreTip: '更多功能',+ moreOptions: '更多选项',++ cellFormat: '设置单元格格式',+ print: '打印',+ borderMethod: {+ top: '上框线',+ bottom: '下框线',+ left: '左框线',+ right: '右框线',+ },+ more: '更多',+ },+ defaultFmt: {+ Automatic: {+ text: '自动',+ value: 'General',+ example: '',+ },+ Number: {+ text: '数字',+ value: '##0.00',+ example: '1000.12',+ },+ Percent: {+ text: '百分比',+ value: '#0.00%',+ example: '12.21%',+ },+ PlainText: {+ text: '纯文本',+ value: '@',+ example: '',+ },+ Scientific: {+ text: '科学计数',+ value: '0.00E+00',+ example: '1.01E+5',+ },+ Accounting: {+ text: '会计',+ value: '¥(0.00)',+ example: '¥(1200.09)',+ },+ Thousand: {+ text: '万元',+ value: 'w',+ example: '1亿2000万2500',+ },+ Currency: {+ text: '货币',+ value: '¥0.00',+ example: '¥1200.09',+ },+ Digit: {+ text: '万元2位小数',+ value: 'w0.00',+ example: '2万2500.55',+ },+ Date: {+ text: '日期',+ value: 'yyyy-MM-dd',+ example: '2017-11-29',+ },+ Time: { text: '时间', value: 'hh:mm AM/PM', example: '3:00 PM' },+ Time24H: { text: '时间24H', value: 'hh:mm', example: '15:00' },+ DateTime: { text: '日期时间', value: 'yyyy-MM-dd hh:mm AM/PM', example: '2017-11-29 3:00 PM' },+ DateTime24H: { text: '日期时间24H', value: 'yyyy-MM-dd hh:mm', example: '2017-11-29 15:00' },+ CustomFormats: { text: '自定义格式', value: 'fmtOtherSelf', example: '' },+ },+ format: {+ moreCurrency: '更多货币格式',+ moreDateTime: '更多日期与时间格式',+ moreNumber: '更多数字格式',++ titleCurrency: '货币格式',+ decimalPlaces: '小数位数',+ titleDateTime: '日期与时间格式',+ titleNumber: '数字格式',+ },+ fontFamily: {+ TimesNewRoman: 'Times New Roman',+ Arial: 'Arial',+ Tahoma: 'Tahoma',+ Verdana: 'Verdana',+ MicrosoftAccorblack: '微软雅黑',+ SimSun: '宋体',+ SimHei: '黑体',+ Kaiti: '楷体',+ FangSong: '仿宋',+ NSimSun: '新宋体',+ STXinwei: '华文新魏',+ STXingkai: '华文行楷',+ STLiti: '华文隶书',+ HanaleiFill: 'HanaleiFill',+ Anton: 'Anton',+ Pacifico: 'Pacifico',+ },+ print: {+ normalBtn: '常规视图',+ layoutBtn: '页面布局',+ pageBtn: '分页预览',++ menuItemPrint: '打印(Ctrl+P)',+ menuItemAreas: '打印区域',+ menuItemRows: '打印标题行',+ menuItemColumns: '打印标题列',+ },+ align: {+ left: '左对齐',+ center: '中间对齐',+ right: '右对齐',++ top: '顶部对齐',+ middle: '居中对齐',+ bottom: '底部对齐',+ },++ button: {+ confirm: '确定',+ cancel: '取消',+ close: '关闭',+ update: 'Update',+ delete: 'Delete',+ insert: '新建',+ prevPage: '上一页',+ nextPage: '下一页',+ total: '总共:',+ },+ punctuation: {+ tab: 'Tab 键',+ semicolon: '分号',+ comma: '逗号',+ space: '空格',+ },+ colorPicker: {+ collapse: '收起',+ customColor: '自定义',+ change: '切换',+ confirmColor: '确定',+ cancelColor: '取消',+ },+ borderLine: {+ borderTop: '上框线',+ borderBottom: '下框线',+ borderLeft: '左框线',+ borderRight: '右框线',+ borderNone: '无',+ borderAll: '所有',+ borderOutside: '外侧',+ borderInside: '内侧',+ borderHorizontal: '内侧横线',+ borderVertical: '内侧竖线',+ borderColor: '边框颜色',+ borderSize: '边框粗细',+ },+ merge: {+ all: '全部合并',+ vertical: '垂直合并',+ horizontal: '水平合并',+ cancel: '取消合并',+ overlappingError: '不能合并重叠区域',+ partiallyError: '无法对部分合并单元格执行此操作',+ },+ textWrap: {+ overflow: '溢出',+ wrap: '自动换行',+ clip: '截断',+ },+ textRotate: {+ none: '无旋转',+ angleUp: '向上倾斜',+ angleDown: '向下倾斜',+ vertical: '竖排文字',+ rotationUp: '向上90°',+ rotationDown: '向下90°',+ },+ sheetConfig: {+ delete: '删除',+ copy: '复制',+ rename: '重命名',+ changeColor: '更改颜色',+ hide: '隐藏',+ unhide: '取消隐藏',+ moveLeft: '向左移',+ moveRight: '向右移',+ resetColor: '重置颜色',+ cancelText: '取消',+ chooseText: '确定颜色',++ tipNameRepeat: '标签页的名称不能重复!请重新修改',+ noMoreSheet: '工作薄内至少含有一张可视工作表。若需删除选定的工作表,请先插入一张新工作表或显示一张隐藏的工作表。',+ confirmDelete: '是否删除',+ redoDelete: '可以通过Ctrl+Z撤销删除',+ noHide: '不能隐藏, 至少保留一个sheet标签',+ chartEditNoOpt: '图表编辑模式下不允许该操作!',+ sheetNameSpecCharError: "名称不能超过31个字符,首尾不能是' 且名称不能包含:\r\n[ ] : \\ ? * /",+ sheetNameCannotIsEmptyError: '名称不能为空!',+ },+ rightClick: {+ copy: '复制',+ copyAs: '复制为',+ paste: '粘贴',+ insert: '插入',+ delete: '删除',+ deleteCell: '删除单元格',+ deleteSelected: '删除选中',+ hide: '隐藏',+ hideSelected: '隐藏选中',+ showHide: '显示隐藏',+ to: '向',+ left: '左',+ right: '右',+ top: '上',+ bottom: '下',+ moveLeft: '左移',+ moveUp: '上移',+ add: '增加',+ row: '行',+ column: '列',+ width: '宽',+ height: '高',+ number: '数字',+ confirm: '确认',+ orderAZ: 'A-Z顺序排列',+ orderZA: 'Z-A降序排列',+ clearContent: '清除内容',+ matrix: '矩阵操作选区',+ sortSelection: '排序选区',+ filterSelection: '筛选选区',+ chartGeneration: '图表生成',+ firstLineTitle: '首行为标题',+ untitled: '无标题',+ array1: '一维数组',+ array2: '二维数组',+ array3: '多维数组',+ diagonal: '对角线',+ antiDiagonal: '反对角线',+ diagonalOffset: '对角偏移',+ offset: '偏移量',+ boolean: '布尔值',+ flip: '翻转',+ upAndDown: '上下',+ leftAndRight: '左右',+ clockwise: '顺时针',+ counterclockwise: '逆时针',+ transpose: '转置',+ matrixCalculation: '矩阵计算',+ plus: '加',+ minus: '减',+ multiply: '乘',+ divided: '除',+ power: '次方',+ root: '次方根',+ log: 'log',+ delete0: '删除两端0值',+ removeDuplicate: '删除重复值',+ byRow: '按行',+ byCol: '按列',+ generateNewMatrix: '生成新矩阵',+ },+ info: {+ detailUpdate: '新打开',+ detailSave: '已恢复本地缓存',+ row: '行',+ column: '列',+ loading: '渲染中···',++ copy: '副本',+ return: '返回',+ rename: '重命名',+ tips: '表格重命名',+ noName: '无标题的电子表格',+ wait: '待更新',++ add: '添加',+ addLast: '在底部添加',+ backTop: '回到顶部',+ // eslint-disable-next-line no-template-curly-in-string+ pageInfo: '共${total}条,${totalPage}页,当前已显示${currentPage}页',+ nextPage: '下一页',++ tipInputNumber: '请输入数字',+ tipInputNumberLimit: '增加范围限制在1-100',++ tipRowHeightLimit: '行高必须在0 ~ 545之间',+ tipColumnWidthLimit: '列宽必须在0 ~ 2038之间',+ // eslint-disable-next-line no-template-curly-in-string+ pageInfoFull: '共${total}条,${totalPage}页,已显示全部数据',+ },};diff --git a/packages/base-docs/src/Model/InfoBarModel.ts b/packages/base-docs/src/Model/InfoBarModel.tsnew file mode 100644index 0000000000..ebe1531d49--- /dev/null+++ b/packages/base-docs/src/Model/InfoBarModel.ts@@ -0,0 +1,11 @@+export class InfoBarModel {+ private _name: string;++ get name(): string {+ return this._name;+ }++ setName(name: string) {+ this._name = name;+ }+}diff --git a/packages/base-docs/src/Model/ToolBarModel.ts b/packages/base-docs/src/Model/ToolBarModel.tsnew file mode 100644index 0000000000..c566e1db58--- /dev/null+++ b/packages/base-docs/src/Model/ToolBarModel.ts@@ -0,0 +1,91 @@+import { BaseSelectChildrenProps, BaseSelectProps } from '../View/UI/Common/Select/Select';+import { BaseTextButtonProps } from '../View/UI/Common/TextButton/TextButton';++export interface IShowToolBarConfig {+ undoRedo?: boolean; // Undo redo+ paintFormat?: boolean; // Format brush+ currencyFormat?: boolean; // currency format+ percentageFormat?: boolean; // Percentage format+ numberDecrease?: boolean; // 'Decrease the number of decimal places'+ numberIncrease?: boolean; // 'Increase the number of decimal places+ moreFormats?: boolean; // 'More Formats'+ font?: boolean; // 'font'+ fontSize?: boolean; // 'Font size'+ bold?: boolean; // 'Bold (Ctrl+B)'+ italic?: boolean; // 'Italic (Ctrl+I)'+ strikethrough?: boolean; // 'Strikethrough (Alt+Shift+5)'+ underline?: boolean; // 'Underline (Alt+Shift+6)'+ textColor?: boolean; // 'Text color'+ fillColor?: boolean; // 'Cell color'+ border?: boolean; // 'border'+ mergeCell?: boolean; // 'Merge cells'+ horizontalAlignMode?: boolean; // 'Horizontal alignment'+ verticalAlignMode?: boolean; // 'Vertical alignment'+ textWrapMode?: boolean; // 'Wrap mode'+ textRotateMode?: boolean; // 'Text Rotation Mode'++ image?: boolean; // 'Insert picture'+ link?: boolean; // 'Insert link'+ chart?: boolean; // 'chart' (the icon is hidden, but if the chart plugin is configured, you can still create a new chart by right click)+ comment?: boolean; // 'comment'+ pivotTable?: boolean; // 'PivotTable'+ function?: boolean; // 'formula'+ frozenMode?: boolean; // 'freeze mode'+ sortAndFilter?: boolean; // 'Sort and filter'+ conditionalFormat?: boolean; // 'Conditional Format'+ dataValidation?: boolean; // 'Data Validation'+ splitColumn?: boolean; // 'Split column'+ screenshot?: boolean; // 'screenshot'+ findAndReplace?: boolean; // 'Find and Replace'+ protection?: boolean; // 'Worksheet protection'+ print?: boolean; // 'Print'+}++enum ToolbarType {+ SELECT,+ BUTTON,+}++// 继承基础下拉属性,添加国际化+export interface BaseToolBarSelectChildrenProps extends BaseSelectChildrenProps {+ locale?: string;+ suffixLocale?: string;+ children?: BaseToolBarSelectChildrenProps[];+}++interface BaseToolBarSelectProps extends BaseSelectProps {+ locale?: string;+ suffixLocale?: string;+ children?: BaseToolBarSelectChildrenProps[];+}++export interface IToolBarItemProps extends BaseToolBarSelectProps, BaseTextButtonProps {+ show?: boolean; //是否显示按钮+ toolbarType?: ToolbarType;+ locale?: string; //label国际化+ tooltipLocale?: string; //tooltip国际化+ tooltip?: string; //tooltip文字+ border?: boolean;+}++export class ToolBarModel {+ private _config: IShowToolBarConfig[];++ private _toolList: IToolBarItemProps[];++ get config(): IShowToolBarConfig[] {+ return this._config;+ }++ get toolList(): IToolBarItemProps[] {+ return this._toolList;+ }++ set config(value: IShowToolBarConfig[]) {+ this._config = value;+ }++ set toolList(value: IToolBarItemProps[]) {+ this._toolList = value;+ }+}diff --git a/packages/base-docs/src/View/UI/Common/Item/Item.tsx b/packages/base-docs/src/View/UI/Common/Item/Item.tsxnew file mode 100644index 0000000000..452f01885e--- /dev/null+++ b/packages/base-docs/src/View/UI/Common/Item/Item.tsx@@ -0,0 +1,35 @@+import { BaseComponentRender, BaseComponentSheet, BaseMenuItem, Component, ComponentChildren, joinClassNames } from '@univer/base-component';+import styles from './index.module.less';++export interface BaseItemProps extends BaseMenuItem {+ selected?: boolean;+ suffix?: ComponentChildren;+ border?: boolean;+}++export class Item extends Component<BaseItemProps> {+ Render: BaseComponentRender;++ initialize() {+ const component = this._context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+ this.Render = component.getComponentRender();+ }++ render() {+ const CorrectIcon = this.Render.renderFunction('CorrectIcon');+ const { selected, label, suffix, disabled } = this.props;+ return (+ <div className={joinClassNames(styles.selectItem, disabled ? styles.selectDisabledItem : '')}>+ {selected ? (+ <span className={styles.selectItemSelected}>+ <CorrectIcon />+ </span>+ ) : (+ ''+ )}+ <span className={styles.selectItemContent}>{label}</span>+ {suffix ? <span className={styles.selectItemSuffix}>{suffix}</span> : ''}+ </div>+ );+ }+}diff --git a/packages/base-docs/src/View/UI/Common/Item/index.module.less b/packages/base-docs/src/View/UI/Common/Item/index.module.lessnew file mode 100644index 0000000000..4af2d58556--- /dev/null+++ b/packages/base-docs/src/View/UI/Common/Item/index.module.less@@ -0,0 +1,35 @@+@import '@univer/style-universheet/assets/css/skin/base.module.less';++.select-item {+ padding: 5px 14px 5px 25px;+ display: flex;+ align-items: center;+ position: relative;+ justify-content: space-between;++ .select-item-selected {+ display: flex;+ align-items: center;+ position: absolute;+ left: 5px;+ top: 50%;+ transform: translateY(-50%) scale(1.5);+ }++ .select-item-content {+ display: block;+ }++ .select-item-suffix {+ margin-left: 10px;++ span[role="img"] {+ font-size: 24px;+ }+ }+}++.select-disabled-item {+ pointer-events: none;+ color: @gray-15;+}\ No newline at end of filediff --git a/packages/base-docs/src/View/UI/Common/Line/LineBold.tsx b/packages/base-docs/src/View/UI/Common/Line/LineBold.tsxnew file mode 100644index 0000000000..47b64cbe43--- /dev/null+++ b/packages/base-docs/src/View/UI/Common/Line/LineBold.tsx@@ -0,0 +1,56 @@+import { Component } from '@univer/base-component';+import { Nullable, Observer, Workbook } from '@univer/core';++interface IState {+ locale: string;+ img: string;+}++export class LineBold extends Component<null, IState> {+ private _localeObserver: Nullable<Observer<Workbook>>;++ initialize() {+ this.state = {+ locale: '',+ img: '#000',+ };+ }++ componentWillMount() {+ this.setLocale();+ this._localeObserver = this._context+ .getObserverManager()+ .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')+ ?.add(() => {+ this.setLocale();+ });+ }++ componentWillUnmount() {+ this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);+ }++ setLocale() {+ const locale = this.context.locale;++ this.setState({+ locale: locale.get('colorPicker'),+ });+ }++ setImg(img: string) {+ this.setState({+ img,+ });+ }++ render() {+ const { locale, img } = this.state;+ return (+ <>+ <span>{locale}</span>+ <img src={img} />+ </>+ );+ }+}diff --git a/packages/base-docs/src/View/UI/Common/Line/LineColor.tsx b/packages/base-docs/src/View/UI/Common/Line/LineColor.tsxnew file mode 100644index 0000000000..8f792010f8--- /dev/null+++ b/packages/base-docs/src/View/UI/Common/Line/LineColor.tsx@@ -0,0 +1,71 @@+import { BaseComponentRender, BaseComponentSheet, Component } from '@univer/base-component';+import { Nullable, Observer, Workbook } from '@univer/core';++interface IState {+ locale: string;+ color: string;+}++interface IProps {+ color: string;+}++export class LineColor extends Component<IProps, IState> {+ private _localeObserver: Nullable<Observer<Workbook>>;++ Render: BaseComponentRender;++ initialize() {+ const component = this._context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+ this.Render = component.getComponentRender();++ this.state = {+ locale: '',+ color: this.props.color ?? '#000',+ };+ }++ componentWillMount() {+ this.setLocale();+ this._localeObserver = this._context+ .getObserverManager()+ .getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')+ ?.add(() => {+ this.setLocale();+ });+ }++ componentWillUnmount() {+ this._context.getObserverManager().getObserver<Workbook>('onAfterChangeUILocaleObservable', 'workbook')?.remove(this._localeObserver);+ }++ componentDidMount() {+ this._context.getObserverManager().getObserver<LineColor>('onLineColorDidMountObservable')?.notifyObservers(this);+ }++ setLocale() {+ const locale = this.context.locale;++ this.setState({+ locale: locale.get('borderLine.borderColor'),+ });+ }++ setColor(color: string) {+ this.setState({+ color,+ });+ }++ render() {+ const RightIcon = this.Render.renderFunction('RightIcon');+ const { locale, color } = this.state;++ return (+ <div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>+ <span style={{ display: 'inline-block', borderBottom: `3px solid ${color}` }}>{locale}</span>+ <RightIcon />+ </div>+ );+ }+}diff --git a/packages/base-docs/src/View/UI/Common/Select/Select.tsx b/packages/base-docs/src/View/UI/Common/Select/Select.tsxnew file mode 100644index 0000000000..757013107d--- /dev/null+++ b/packages/base-docs/src/View/UI/Common/Select/Select.tsx@@ -0,0 +1,411 @@+import { BaseComponentRender, BaseComponentSheet, BaseMenuItem, BaseMenuProps, Component, ComponentChildren } from '@univer/base-component';+import { ColorPicker, Dropdown } from '@univer/style-universheet';+import { BaseItemProps, Item } from '../Item/Item';+import styles from './index.module.less';++enum SelectTypes {+ SINGLE, // 普通下拉+ INPUT,+ COLOR,+ DOUBLE,+ FIX,+ DOUBLEFIX,+}++enum DisplayTypes {+ LABEL,+ SUFFIX,+}++interface CustomComponent {+ name: string;+ props?: Record<string, any>;+}++export interface BaseSelectChildrenProps extends BaseItemProps {+ onKeyUp?: (...arg: any) => void;+ children?: BaseSelectChildrenProps[];+ unSelectable?: boolean; //选中后不生效事件+ customLabel?: CustomComponent;+ customSuffix?: CustomComponent;+}++export interface BaseSelectProps {+ type?: SelectTypes;+ children?: BaseSelectChildrenProps[];+ display?: DisplayTypes;+ label?: ComponentChildren;+ onClick?: (...arg: any) => void; //下拉Ul点击事件+ onKeyUp?: (...arg: any) => void;+ defaultColor?: string;+ hideSelectedIcon?: boolean;+ selectClassName?: string;+ name?: string;+ customLabel?: CustomComponent;+ customSuffix?: CustomComponent;+}++interface IState {+ menu: BaseMenuItem[];+ color: string;+ content: ComponentChildren;+ value: any;+}++export class Select extends Component<BaseSelectProps, IState> {+ Render: BaseComponentRender;++ ColorRef: any;++ onClick: (...arg: any) => void;++ onKeyUp: (...arg: any[]) => void;++ initialize() {+ const component = this._context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+ this.Render = component.getComponentRender();++ const { children = [], hideSelectedIcon } = this.props;+ const list = this.resetMenu(children, hideSelectedIcon);++ this.state = {+ menu: list,+ color: this.props.defaultColor ?? '#000',+ content: '',+ value: '',+ };+ }++ getType(type: SelectTypes) {+ switch (type) {+ case 0:+ return this.getSingle();+ case 1:+ return this.getInput();+ case 2:+ return this.getColor();+ case 3:+ return this.getDouble();+ case 4:+ return this.getFix();+ case 5:+ return this.getDoubleFix();+ }+ }++ componentDidMount() {+ const { type, display, children = [], label } = this.props;++ // 显示值可变+ if (type === 0 || type === 3) {+ if (!children.length) return;+ let index = children.findIndex((item) => item.selected);+ if (index < 0) index = 0;+ const list = this.handleSelected(index);+ const item = children[index];++ if (display === DisplayTypes.SUFFIX) {+ this.setState({+ content: item.suffix,+ menu: list,+ });+ } else {+ this.setState({+ content: item.label,+ menu: list,+ });+ }++ this.onClick = (...arg) => {+ const item = children[arg[2]];++ this.props.onClick?.(arg[1], arg[2], arg[3]);++ if (item.unSelectable) {+ return;+ }++ const list = this.handleSelected(arg[2]);++ if (display === DisplayTypes.SUFFIX) {+ this.setState({+ content: children[arg[2]].suffix,+ menu: list,+ });+ } else {+ this.setState({+ content: children[arg[2]].label,+ menu: list,+ });+ }+ };+ } else if (type === 1) {+ // 输入框+ if (!children.length) return;+ // 匹配label和选项label确定选中项+ const getLabel = (label: ComponentChildren) => {+ if (label !== null) {+ if (label === '') return;+ let index = children.findIndex((item) => label === item.label);+ let list = this.handleSelected(index < 0 ? null : index);+ this.setState({+ content: label,+ menu: list,+ });+ } else {+ let index = children.findIndex((item) => item.selected);+ if (index < 0) index = 0;+ let list = this.handleSelected(index);+ const item = children[index];++ this.setState({+ content: item.label,+ menu: list,+ });+ }+ };++ getLabel(label);++ this.onClick = (...arg) => {+ this.props.onClick?.(arg[1], arg[2], arg[3]);++ const list = this.handleSelected(arg[2]);+ this.setState({+ content: children[arg[2]].label,+ menu: list,+ });+ };++ this.onKeyUp = (e: KeyboardEvent) => {+ const value = (e.currentTarget as HTMLInputElement).value;+ this.props.onKeyUp?.(value);+ getLabel(value);+ };+ } else if (type === 2) {+ // 颜色选择器+ const list = this.handleSelected(null);+ this.setState({+ menu: list,+ });++ this.onClick = () => {+ const { color } = this.state;+ this.props.onClick?.(color);+ };+ } else if (type === 4 || type === 5) {+ //固定显示值+ if (!children.length) return;+ let index = children.findIndex((item) => item.selected);+ if (index < 0) index = 0;+ const item = children[index];+ const list = this.handleSelected(index);+ this.setState({+ menu: list,+ value: item.value,+ });++ this.onClick = (...arg) => {+ if (arg.length) {+ this.props.onClick?.(arg[1], arg[2], arg[3]);+ const list = this.handleSelected(arg[2]);+ this.setState({+ menu: list,+ value: children[arg[2]].value,+ });+ } else {+ this.props.onClick?.(this.state.value);+ }+ };+ }+ }++ resetMenu(children: BaseSelectChildrenProps[], hideSelectedIcon?: boolean) {+ const list: BaseMenuItem[] = [];+ for (let i = 0; i < children.length; i++) {+ let selected = false;+ if (!hideSelectedIcon) {+ selected = children[i].selected ?? false;+ }+ list[i] = { label: '' };+ list[i].label = <Item disabled={children[i].disabled} border={children[i].border} selected={selected} label={children[i].label} suffix={children[i].suffix}></Item>;+ list[i].disabled = children[i].disabled;+ list[i].style = children[i].style;+ list[i].value = children[i].value;+ list[i].className = children[i].className;+ list[i].onClick = children[i].onClick;++ if (children[i].children) {+ list[i].children = this.getChildren(children[i].children!);+ }+ }++ // 颜色下拉塞入colorPicker+ if (this.props.type === 2) {+ list[0] = {+ label: (+ <Item+ label={+ <ColorPicker+ style={{ display: 'block' }}+ ref={(ele) => (this.ColorRef = ele)}+ color={'#000'}+ onClick={(col: string) => {+ this.ColorRef.hideSelect();+ this.setState(+ {+ color: col,+ },+ () => {+ this.onClick();+ }+ );+ }}+ />+ }+ ></Item>+ ),+ };+ }++ return list;+ }++ getChildren(children: BaseSelectChildrenProps[]) {+ const menu: BaseMenuProps[] = children.map((item) => {+ const selected = this.props.hideSelectedIcon ? false : item.selected;+ item.label = <Item disabled={item.disabled} border={item.border} selected={selected} label={item.label} suffix={item.suffix}></Item>;+ if (item.children) {+ item.children = this.getChildren(item.children);+ }+ return item as BaseMenuItem;+ });+ return menu;+ }++ // 处理选中+ handleSelected = (index: number | null): BaseMenuItem[] | undefined => {+ const { children = [], hideSelectedIcon } = this.props;+ if (children.length) {+ children.forEach((item) => {+ item.selected = false;+ });+ if (index !== null) {+ children[index].selected = true;+ }+ }++ const list = this.resetMenu(children, hideSelectedIcon);+ return list;+ };++ // 普通下拉+ getSingle = () => {+ const { content, menu } = this.state;+ const { selectClassName = '' } = this.props;+ const Button = this.Render.renderFunction('Button');++ return (+ <div className={`${styles.selectSingle} ${selectClassName}`}>+ <Button type="text">+ <Dropdown menu={{ menu, onClick: this.onClick }} showArrow>+ <div>{content}</div>+ </Dropdown>+ </Button>+ </div>+ );+ };++ //Input下拉+ getInput = () => {+ const { content, menu } = this.state;+ const { selectClassName = '' } = this.props;+ const Input = this.Render.renderFunction('Input');+ const Button = this.Render.renderFunction('Button');++ return (+ <div className={`${styles.selectInput} ${selectClassName}`}>+ <Button type="text">+ <Dropdown menu={{ menu, onClick: this.onClick }} showArrow>+ <Input onKeyUp={this.onKeyUp} type="number" value={content as string} />+ </Dropdown>+ </Button>+ </div>+ );+ };++ //颜色选择器+ getColor = () => {+ const { label, selectClassName = '' } = this.props;+ const { color, menu } = this.state;+ const Button = this.Render.renderFunction('Button');+ const NextIcon = this.Render.renderFunction('NextIcon');++ return (+ <div className={`${styles.selectColor} ${styles.selectDouble} ${selectClassName}`}>+ <Button type="text">+ <Dropdown onClick={this.onClick} menu={{ menu, onClick: this.onClick }} icon={<NextIcon />}>+ <div className={styles.selectLabel}>{label}</div>+ <div className={styles.selectLine} style={{ background: color }}></div>+ </Dropdown>+ </Button>+ </div>+ );+ };++ getDouble = () => {+ const { content, menu } = this.state;+ const { selectClassName = '' } = this.props;+ const NextIcon = this.Render.renderFunction('NextIcon');+ const Button = this.Render.renderFunction('Button');++ return (+ <div className={`${styles.selectDouble} ${selectClassName}`}>+ <Button type="text">+ <Dropdown menu={{ menu, onClick: this.onClick }} icon={<NextIcon />}>+ <div className={styles.selectLabel}>{content}</div>+ </Dropdown>+ </Button>+ </div>+ );+ };++ getFix = () => {+ const { label, selectClassName = '' } = this.props;+ const { menu } = this.state;+ const Button = this.Render.renderFunction('Button');++ return (+ <div className={`${styles.selectDouble} ${selectClassName}`}>+ <Button type="text">+ <Dropdown menu={{ menu, onClick: this.onClick }} showArrow>+ <div className={styles.selectLabel}>{label}</div>+ </Dropdown>+ </Button>+ </div>+ );+ };++ getDoubleFix = () => {+ const { label, selectClassName = '' } = this.props;+ const { menu } = this.state;+ const Button = this.Render.renderFunction('Button');+ const NextIcon = this.Render.renderFunction('NextIcon');++ return (+ <div className={`${styles.selectDouble} ${selectClassName}`}>+ <Button type="text">+ <Dropdown onClick={this.onClick} menu={{ menu, onClick: this.onClick }} icon={<NextIcon />}>+ <div className={styles.selectLabel}>{label}</div>+ </Dropdown>+ </Button>+ </div>+ );+ };++ render() {+ const { type = 0 } = this.props;++ return <div className={styles.selectComponent}>{this.getType(type)}</div>;+ }+}diff --git a/packages/base-docs/src/View/UI/Common/Select/index.module.less b/packages/base-docs/src/View/UI/Common/Select/index.module.lessnew file mode 100644index 0000000000..6be9bc3c43--- /dev/null+++ b/packages/base-docs/src/View/UI/Common/Select/index.module.less@@ -0,0 +1,119 @@+@import '@univer/style-universheet/assets/css/skin/base.module.less';++.select-component {+ position: relative;+ margin: 0 3px;+ height: 26px;++ &:hover {+ background-color: @gray-14;+ }++ .select-button {+ padding: 0px 5px;++ span[role="img"] {+ font-size: 24px;+ }+ }++ .select-single {+ text-overflow: ellipsis;+ white-space: nowrap;+ }++ .select-input {++ input {+ width: 38px;+ height: 20px;+ background: transparent;+ border: 1px solid transparent;++ &::-webkit-outer-spin-button,+ &::-webkit-inner-spin-button {+ -webkit-appearance: none;+ }++ &[type="number"] {+ -moz-appearance: textfield;+ }++ &:hover {+ border: 1px solid transparent;+ }++ &:focus {+ background: #fff;+ border: 1px solid var(--primary-color-hover);+ }+ }+ }++ .select-color {++ .cols-menu {+ padding: 0;+ border: none;++ .cols-menuitem {+ padding: 0;+ }++ .select-item {+ padding: 0;+ }+ }++ }++ .select-double {+ .dropdown {+ height: 24px;+ padding-right: 0;+ }++ .drop-content {+ position: relative;++ .select-line {+ position: absolute;+ width: 15px;+ height: 5px;+ background-color: #000;+ bottom: 0px;+ left: 50%;+ transform: translate(-50%, 0);+ }+ }++ .drop-icon {+ border-left: 1px solid transparent;+ }++ &:hover {+ .drop-icon {+ border-left: 1px solid @gray-6;+ }+ }++ }++ .select-label {+ span[role="img"] {+ font-size: 24px;+ }+ }++ button {+ .button();+ border-color: transparent;+ height: auto;+ }++}++.button() {+ padding: 0px;+ box-sizing: border-box;+}\ No newline at end of filediff --git a/packages/base-docs/src/View/UI/Common/TextButton/TextButton.tsx b/packages/base-docs/src/View/UI/Common/TextButton/TextButton.tsxnew file mode 100644index 0000000000..9c2d9bf6ea--- /dev/null+++ b/packages/base-docs/src/View/UI/Common/TextButton/TextButton.tsx@@ -0,0 +1,47 @@+import { BaseComponentRender, BaseComponentSheet, Component, ComponentChildren } from '@univer/base-component';+import styles from './index.module.less';++export interface BaseTextButtonProps {+ active?: boolean;+ label?: ComponentChildren;+ onClick?: (...arg: any) => void;+}++interface IState {+ active?: boolean;+}++export class TextButton extends Component<BaseTextButtonProps, IState> {+ Render: BaseComponentRender;++ initialize() {+ const component = this._context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+ this.Render = component.getComponentRender();+ this.state = {+ active: this.props.active,+ };+ }++ handleClick = () => {+ const active = !this.state.active;+ this.props.onClick?.(active);++ this.setState({+ active,+ });+ };++ render() {+ const { label } = this.props;+ const { active } = this.state;+ const Button = this.Render.renderFunction('Button');++ return (+ <div className={styles.textButton}>+ <Button type="text" active={active} onClick={this.handleClick}>+ {label}+ </Button>+ </div>+ );+ }+}diff --git a/packages/base-docs/src/View/UI/Common/TextButton/index.module.css b/packages/base-docs/src/View/UI/Common/TextButton/index.module.cssnew file mode 100644index 0000000000..4fb4faa3e5--- /dev/null+++ b/packages/base-docs/src/View/UI/Common/TextButton/index.module.css@@ -0,0 +1,6 @@+.text-button span[role="img"] {+ font-size: 24px;+}+.text-button button {+ padding: 0 5px;+}diff --git a/packages/base-docs/src/View/UI/Common/TextButton/index.module.less b/packages/base-docs/src/View/UI/Common/TextButton/index.module.lessnew file mode 100644index 0000000000..305b85ad5c--- /dev/null+++ b/packages/base-docs/src/View/UI/Common/TextButton/index.module.less@@ -0,0 +1,9 @@+.text-button {+ span[role="img"] {+ font-size: 24px;+ }++ button {+ padding: 0 5px;+ }+}\ No newline at end of filediff --git a/packages/base-docs/src/View/UI/Common/index.ts b/packages/base-docs/src/View/UI/Common/index.tsnew file mode 100644index 0000000000..cd8440b5fb--- /dev/null+++ b/packages/base-docs/src/View/UI/Common/index.ts@@ -0,0 +1 @@+// Basic business componentsdiff --git a/packages/base-docs/src/View/UI/DocContainer/DocContainer.tsx b/packages/base-docs/src/View/UI/DocContainer/DocContainer.tsxnew file mode 100644index 0000000000..59f44ce2ec--- /dev/null+++ b/packages/base-docs/src/View/UI/DocContainer/DocContainer.tsx@@ -0,0 +1,767 @@+import {+ AppContext,+ IMainProps,+ IMainState,+ ISiderState,+ ISlotElement,+ ISlotProps,+ Component,+ BaseComponentSheet,+ BaseComponentRender,+ createRef,+ RefObject,+ cloneElement,+ BaseComponentProps,+ Description,+} from '@univer/base-component';+import { AsyncFunction, DocContext, IKeyType, LocaleType, PLUGIN_NAMES, Tools, Workbook } from '@univer/core';+import cssVars from 'css-vars-ponyfill';+import {+ Container,+ Content,+ Footer,+ FormulaBar,+ Header,+ // InfoBar,+ Layout,+ // SheetBar,+ Sider,+} from '@univer/style-universheet';+import defaultSkin from '@univer/style-universheet/assets/css/skin/default.module.less';+import darkSkin from '@univer/style-universheet/assets/css/skin/dark.module.less';+// All skins' less file+import greenSkin from '@univer/style-universheet/assets/css/skin/green.module.less';+// app context for skin and Locale+import style from './index.module.less';+import { ToolBar } from '../ToolBar';+import { DocPlugin } from '../../../DocPlugin';+import { InfoBar } from '../InfoBar';++export interface IDocPluginConfigBase {+ layout: string | ILayout;+}++interface IShowToolBarConfig {+ undoRedo?: boolean; // Undo redo+ paintFormat?: boolean; // Format brush+ currencyFormat?: boolean; // currency format+ percentageFormat?: boolean; // Percentage format+ numberDecrease?: boolean; // 'Decrease the number of decimal places'+ numberIncrease?: boolean; // 'Increase the number of decimal places+ moreFormats?: boolean; // 'More Formats'+ font?: boolean; // 'font'+ fontSize?: boolean; // 'Font size'+ bold?: boolean; // 'Bold (Ctrl+B)'+ italic?: boolean; // 'Italic (Ctrl+I)'+ strikethrough?: boolean; // 'Strikethrough (Alt+Shift+5)'+ underline?: boolean; // 'Underline (Alt+Shift+6)'+ textColor?: boolean; // 'Text color'+ fillColor?: boolean; // 'Cell color'+ border?: boolean; // 'border'+ mergeCell?: boolean; // 'Merge cells'+ horizontalAlignMode?: boolean; // 'Horizontal alignment'+ verticalAlignMode?: boolean; // 'Vertical alignment'+ textWrapMode?: boolean; // 'Wrap mode'+ textRotateMode?: boolean; // 'Text Rotation Mode'++ image?: boolean; // 'Insert picture'+ link?: boolean; // 'Insert link'+ chart?: boolean; // 'chart' (the icon is hidden, but if the chart plugin is configured, you can still create a new chart by right click)+ comment?: boolean; // 'comment'+ pivotTable?: boolean; // 'PivotTable'+ function?: boolean; // 'formula'+ frozenMode?: boolean; // 'freeze mode'+ sortAndFilter?: boolean; // 'Sort and filter'+ conditionalFormat?: boolean; // 'Conditional Format'+ dataValidation?: boolean; // 'Data Validation'+ splitColumn?: boolean; // 'Split column'+ screenshot?: boolean; // 'screenshot'+ findAndReplace?: boolean; // 'Find and Replace'+ protection?: boolean; // 'Worksheet protection'+ print?: boolean; // 'Print'+}++export interface ILayout {+ outerLeft?: boolean;++ outerRight?: boolean;++ header?: boolean;++ footer?: boolean;++ innerLeft?: boolean;++ innerRight?: boolean;++ frozenHeaderLT?: boolean;++ frozenHeaderRT?: boolean;++ frozenHeaderLM?: boolean;++ frozenContent?: boolean;++ // Whether to show the toolbar+ toolBar?: boolean;++ // Custom configuration toolbar,can be used in conjunction with showToolBar, showToolBarConfig has a higher priority+ toolBarConfig?: IShowToolBarConfig;++ /**+ * 左右或者上下分割content区域+ *+ * undefined: no split+ * false: no split+ * true: horizontal split+ * "horizontal": horizontal split+ * "vertical": vertical split+ */++ contentSplit?: boolean | string;+}++export interface IDocPluginConfigBase {+ layout: string | ILayout;+}++export interface BaseDocContainerConfig extends BaseComponentProps, IDocPluginConfigBase {+ container: HTMLElement;+ skin: string;+ context: DocContext;+ getSplitLeftRef: (ref: RefObject<HTMLDivElement>) => void;+ getContentRef: (ref: RefObject<HTMLDivElement>) => void;+ addButton: (cb: Function) => void;+ addSider: (cb: AsyncFunction<ISlotProps>) => void;+ addMain: (cb: Function) => void;+ showSiderByName: (cb: Function) => void;+ showMainByName: (cb: Function) => void;+ onDidMount: () => void;+}++export interface BaseDocContainerProps {+ config: BaseDocContainerConfig;+}++export const defaultLayout: ILayout = {+ outerLeft: false,++ outerRight: true,++ header: true,++ footer: true,++ innerLeft: false,++ innerRight: false,++ frozenHeaderLT: true,++ frozenHeaderRT: true,++ frozenHeaderLM: true,++ frozenContent: true,++ toolBar: true,++ toolBarConfig: {+ undoRedo: true, // Undo redo+ paintFormat: true, // Format brush+ currencyFormat: true, // currency format+ percentageFormat: true, // Percentage format+ numberDecrease: true, // 'Decrease the number of decimal places'+ numberIncrease: true, // 'Increase the number of decimal places+ moreFormats: true, // 'More Formats'+ font: true, // 'font'+ fontSize: true, // 'Font size'+ bold: true, // 'Bold (Ctrl+B)'+ italic: true, // 'Italic (Ctrl+I)'+ strikethrough: true, // 'Strikethrough (Alt+Shift+5)'+ underline: true, // 'Underline (Alt+Shift+6)'+ textColor: true, // 'Text color'+ fillColor: true, // 'Cell color'+ border: true, // 'border'+ mergeCell: true, // 'Merge cells'+ horizontalAlignMode: true, // 'Horizontal alignment'+ verticalAlignMode: true, // 'Vertical alignment'+ textWrapMode: true, // 'Wrap mode'+ textRotateMode: true, // 'Text Rotation Mode'+ image: true, // 'Insert picture'+ link: true, // 'Insert link'+ chart: true, // 'chart' (the icon is hidden, but if the chart plugin is configured, you can still create a new chart by right click)+ comment: true, // 'comment'+ pivotTable: true, // 'PivotTable'+ function: true, // 'formula'+ frozenMode: true, // 'freeze mode'+ sortAndFilter: true, // 'Sort and filter'+ conditionalFormat: true, // 'Conditional Format'+ dataValidation: true, // 'Data Validation'+ splitColumn: true, // 'Split column'+ screenshot: true, // 'screenshot'+ findAndReplace: true, // 'Find and Replace'+ protection: true, // 'Worksheet protection'+ print: true, // 'Print'+ },++ contentSplit: false,+};++/**+ * DocContainer+ */++// Types for state+type IState = {+ layout: ILayout;+ currentLocale: string;+ currentSkin: string;+ printVisible: boolean;+ isCellEditorVisible: boolean;+ siderPanelList: ISiderState[];+ mainList: IMainState[];+ showSider: boolean;+ renderState: number;+};++/**+ * One universheet instance DOM container+ */+export class DocContainer extends Component<BaseDocContainerProps, IState> {+ splitLeftRef = createRef<HTMLDivElement>();++ rightRef = createRef<HTMLDivElement>();++ menuRef = createRef();++ cellRightRef = createRef<HTMLDivElement>();++ btnRef = createRef<HTMLButtonElement>();++ contentRef = createRef<HTMLDivElement>();++ layoutContainerRef = createRef<HTMLDivElement>();++ containerRef = createRef<HTMLDivElement>();++ refMap: IKeyType<RefObject<HTMLElement> | any> = {};++ leftContentLeft: number;++ leftContentTop: number;++ rightBorderX: number;++ rightBorderY: number;++ Render: BaseComponentRender;++ constructor(props: BaseDocContainerProps) {+ super(props, { coreContext: props.config.context });++ const { container, skin, layout, context, addSider, addMain, showSiderByName, showMainByName } = props.config;++ addSider(this.addSider.bind(this));+ addMain(this.addMain.bind(this));+ showSiderByName(this.showSiderByName.bind(this));+ showMainByName(this.showMainByName.bind(this));++ const component = this._context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+ this.Render = component.getComponentRender();++ this.setSkin(container, skin);++ // init state+ this.state = {+ layout:+ layout === 'auto'+ ? Tools.deepClone(defaultLayout) // The defaultLayout must be cloned, otherwise the layout object will be referenced in multiple instances+ : Tools.deepMerge(defaultLayout, layout),+ currentLocale: context.getLocale().options.currentLocale,+ currentSkin: skin,+ printVisible: true,+ isCellEditorVisible: false,+ siderPanelList: [],+ mainList: [],+ showSider: false,+ renderState: 0,+ };+ }++ setSkin(container: HTMLElement, skin: string) {+ // Collect all skins+ let root = document.documentElement;++ // get all skins+ const skins = {+ default: defaultSkin,+ dark: darkSkin,+ green: greenSkin,+ };++ // current skin set by user+ let currentSkin = skins[skin];++ // transform "primaryColor" to "--primary-color"+ currentSkin = Object.fromEntries(Object.keys(currentSkin).map((item) => [`--${item.replace(/([A-Z])/g, '-$1').toLowerCase()}`, currentSkin[item]]));++ // ie11 does not support css variables, use css-vars-ponyfill to handle+ if (Tools.isIEBrowser()) {+ cssVars({+ // Options...++ // The container is invalid as rootElement, so the default setting is root.+ // Disadvantages: In ie11, only one set of skins can be used for multiple workbooks, and it is the skin set by the last workbook+ rootElement: root, // default++ variables: currentSkin,+ });+ } else {+ // set css variable++ let sheet = getSkinStyleSheet(container.id);++ /**+ * covert object to style, remove " and replace , to ;+ *+ * Example:+ *+ * before: {--primary-color:"#0188fb",--primary-color-hover:"#5391ff"}+ * after: {--primary-color:#0188fb;--primary-color-hover:#5391ff;}+ */++ sheet.insertRule(+ `#${container.id} ${JSON.stringify(currentSkin)+ .replace(/"/g, '')+ .replace(/,(?=--)/g, ';')}`+ );+ }++ /**+ * get skin style sheet+ * @param id+ * @returns+ */++ function getSkinStyleSheet(id: string) {+ const title = 'universheet-skin-style';+ // avoid duplicates+ for (let i = 0; i < document.styleSheets.length; i++) {+ if (document.styleSheets[i].title === title) {+ deleteStyleRuleIndexBySelector(document.styleSheets[i], id);++ return document.styleSheets[i];+ }+ }+ const head = document.head || document.getElementsByTagName('head')[0];+ const styleEle = document.createElement('style');+ styleEle.title = title;+ head.appendChild(styleEle);++ return document.styleSheets[document.styleSheets.length - 1];+ }++ /**+ * delete style rule in universheet-skin-style+ * @param skinStyleSheet+ * @param id+ */+ function deleteStyleRuleIndexBySelector(skinStyleSheet: CSSStyleSheet, id: string) {+ let index = 0;+ for (let i = 0; i < skinStyleSheet.cssRules.length; i++) {+ const rule = skinStyleSheet.cssRules[i];++ if (rule instanceof CSSStyleRule && rule.selectorText === `#${id}`) {+ index = i;+ skinStyleSheet.deleteRule(index);+ break;+ }+ }+ }+ }++ /**+ * 右键菜单+ */+ // rightMenu = (e: MouseEvent) => {+ // e.preventDefault();++ // this.rightRef.current && (this.rightRef.current as unknown as RightMenu).handleContextMenu(e);+ // };++ /**+ * resize split content+ */+ resizeSplitContent = () => {};++ /**+ * split mouse down+ * @param e+ */+ handleSplitBarMouseDown = (e: MouseEvent) => {+ e = e || window.event; // Compatible with IE browser++ // Store the current mouse position++ this.leftContentLeft = this.splitLeftRef.current?.getBoundingClientRect().left!;+ this.leftContentTop = this.splitLeftRef.current?.getBoundingClientRect().top!;++ const mainContainer = this.splitLeftRef.current?.parentElement;+ this.rightBorderX = mainContainer?.getBoundingClientRect()?.width!;+ this.rightBorderY = mainContainer?.getBoundingClientRect()?.height!;++ document.addEventListener('mousemove', this.handleSplitBarMouseMove, false);+ document.addEventListener('mouseup', this.handleSplitBarMouseUp, false);+ };++ /**+ * split mouse move+ * @param e+ */+ handleSplitBarMouseMove = (e: MouseEvent) => {+ e = e || window.event; // Compatible with IE browser++ let diffLeft = e.clientX - this.leftContentLeft;+ let diffTop = e.clientY - this.leftContentTop;++ // Prevent crossing borders+ diffLeft = diffLeft >= this.rightBorderX ? this.rightBorderX : diffLeft;+ diffTop = diffTop >= this.rightBorderY ? this.rightBorderY : diffTop;++ // set new width+ if (this.state.layout.contentSplit === 'vertical') {+ this.splitLeftRef.current!.style.height = `${diffTop}px`;+ } else {+ this.splitLeftRef.current!.style.width = `${diffLeft}px`;+ }+ };++ /**+ * split mouse up+ * @param e+ */+ handleSplitBarMouseUp = (e: MouseEvent) => {+ document.removeEventListener('mousemove', this.handleSplitBarMouseMove, false);+ document.removeEventListener('mouseup', this.handleSplitBarMouseUp, false);+ };++ /**+ * click and double click+ *+ * @param e+ */+ handleContentClick = (e: MouseEvent) => {+ // TODO: get observer from observeManager+ // this._onInputObserver = engine.onInputChangedObservable.add((eventData: IEvent)=>{+ // })+ };++ /**+ * add plugin sider panel+ */+ addSider(item: ISlotProps): Promise<void> {+ /**+ * There will be multiple plugin panel added, so you need to use prevState to add panel from the previous state, otherwise it will cause overwriting+ */+ return new Promise((resolve) => {+ this.setState(+ (prevState) => {+ const stateItem = Object.assign(item, {+ show: false,+ zIndex: prevState.siderPanelList.length + 1,+ });+ return {+ siderPanelList: [...prevState.siderPanelList, stateItem],+ };+ },+ () => {+ resolve();+ }+ );+ });+ }++ /**+ * add plugin main area+ */+ addMain(item: IMainProps): Promise<void> {+ /**+ * There will be multiple plugin main added, so you need to use prevState to add panel from the previous state, otherwise it will cause overwriting+ */+ return new Promise((resolve) => {+ this.setState(+ (prevState) => {+ const stateItem = Object.assign(item, {+ show: false,+ zIndex: prevState.mainList.length + 1,+ });+ return {+ mainList: [...prevState.mainList, stateItem],+ };+ },+ () => {+ resolve();+ }+ );+ });+ }++ /**+ *+ * show or hide panel+ *+ * When you open two sidebars, you need to set the zIndex of the newly opened sidebar to the highest, so every time you open a sidebar, you need to recalculate the zIndex. For example, we already have 6 sidebars, this When the 3rd sidebar is opened+ *+ * 1 2 3 4 5 6+ *+ * Set 3 to 6, then rearrange the order after 3 to 3, 4, 5, and get+ *+ * 1 2 6 3 4 5+ */+ showSiderByName(name: string, show: boolean): Promise<void> {+ /**+ * There will be multiple plugin panel added, so you need to use prevState to add panel from the previous state, otherwise it will cause overwriting+ */+ return new Promise((resolve) => {+ this.setState(+ (prevState) => {+ let showSider = false;++ let currentZIndex = 0;+ let zIndexList = prevState.siderPanelList.map((item) => {+ if (item.name === name) {+ currentZIndex = item.zIndex;+ }+ return item.zIndex;+ });++ const nextState = prevState.siderPanelList.map((item) => {+ // Set according to user needs+ if (item.name === name) {+ item.show = show;+ item.zIndex = Math.max(...zIndexList);+ } else if (item.zIndex > currentZIndex) {+ item.zIndex--;+ }++ // As long as there is a panel to be displayed, display the container+ if (item.show) {+ showSider = true;+ }+ return item;+ });++ return {+ siderPanelList: nextState,+ showSider,+ };+ },+ () => {+ resolve();+ }+ );+ });+ }++ /**+ * show or hide main+ */+ showMainByName(name: string, show: boolean): Promise<void> {+ /**+ * There will be multiple plugin panel added, so you need to use prevState to add panel from the previous state, otherwise it will cause overwriting+ */+ return new Promise((resolve) => {+ this.setState(+ (prevState) => {+ const nextState = prevState.mainList.map((item) => {+ // Set according to user needs+ if (item.name === name) {+ item.show = show;+ }++ return item;+ });++ return {+ mainList: nextState,+ };+ },+ () => {+ resolve();+ }+ );+ });+ }++ /**+ * destroy+ */+ componentWillUnmount() {}++ componentDidMount() {+ // mount can+ this.props.config.getSplitLeftRef(this.splitLeftRef);+ // mount canvas+ this.props.config.getContentRef(this.contentRef);++ this.props.config.onDidMount();++ this.setState(+ (preState) => ({+ ...preState,+ renderState: 1,+ }),+ () => {+ // After the mount is successful, an observe is issued to notify other plug-ins that they can start using dom+ this.getContext()+ .getPluginManager()+ .getRequirePluginByName<DocPlugin>(PLUGIN_NAMES.DOCUMENT)+ .getObserver('onDocContainerDidMountObservable')+ ?.notifyObservers(this);+ }+ );++ // this.initEvent();+ }++ /**+ * Render the component's HTML+ *+ * @returns {void}+ */+ render() {+ const { addButton, context } = this.props.config;+ const { layout, currentLocale, currentSkin, siderPanelList, mainList, showSider, renderState } = this.state;++ // Set Provider for entire Container+ return (+ <AppContext.Provider+ value={{+ locale: context.getLocale(),+ currentLocale: context.getLocale().options.currentLocale,+ coreContext: context,+ }}+ >+ <Container ref={this.layoutContainerRef} className={style.layoutContainer}>+ <Layout>+ <Sider style={{ display: layout.outerLeft ? 'block' : 'none' }}></Sider>+ <Layout className={style.mainContent} style={{ position: 'relative' }}>+ <Header style={{ display: layout.header ? 'block' : 'none' }}>+ <InfoBar></InfoBar>+ <ToolBar toolList={[]}></ToolBar>+ </Header>+ <Layout>+ <Sider+ style={{+ display: layout.innerLeft ? 'block' : 'none',+ }}+ >+ {/* innerLeft */}+ {/* <FilterSelect />+ <FilterSelect />+ <FilterSelect /> */}+ {/* <button+ onClick={(e) => {+ e.preventDefault();+ const rect = this.btnRef.current && this.btnRef.current.getBoundingClientRect();++ this.cellRightRef.current && (this.cellRightRef.current as unknown as RightMenu).handleContextMenu(e, rect, true);+ }}+ ref={this.btnRef}+ >+ 点击+ </button>+ {/* <PrintMode+ visible={this.state.printVisible}+ onCancel={() => {+ this.setState({+ printVisible: !this.state.printVisible,+ });+ }}+ /> */}+ </Sider>+ <Content className={layout.contentSplit === 'vertical' ? style.contentContainerVertical : style.contentContainerHorizontal}>+ {/* extend main content */}+ {mainList.map((item: IMainState, i) => {+ // if (!item.show) return null;++ if (item.type === ISlotElement.JSX) {+ // return item.content;+ return cloneElement(item.content as JSX.Element, {+ style: { display: item.show ? '' : 'none' },+ });+ }+ if (item.type === ISlotElement.JSX_STRING) {+ // if (item.content === 'RichText') {+ // const RichText = this.Render.renderFunction('RichText');+ // return <RichText />;+ // }+ const JSXElement = this.Render.renderFunction(item.content as keyof Description);+ this.refMap[item.name] = createRef<HTMLDivElement>();+ return <JSXElement ref={this.refMap[item.name]} style={{ display: item.show ? '' : 'none' }} />;+ }+ return item;+ })}++ {!!layout.contentSplit && (+ <Container ref={this.splitLeftRef} className={style.contentInnerLeftContainer}>+ <div className={style.hoverCursor} onMouseDown={this.handleSplitBarMouseDown}></div>+ </Container>+ )}+ <Container ref={this.contentRef} className={style.contentInnerRightContainer} onClick={this.handleContentClick}>+ {/* <div style={{ position: 'fixed', right: '200px', top: '10px', fontSize: '14px' }}>+ <span style={{ display: 'inline-block', width: 50, margin: '5px 0 0 5px' }}>皮肤</span>+ <select value={currentSkin} onChange={this.changeSkin.bind(this)} style={{ width: 55 }}>+ <option value="default">默认</option>+ <option value="dark">暗黑</option>+ <option value="green">绿色</option>+ </select>++ <span style={{ display: 'inline-block', width: 50, margin: '5px 0 0 5px' }}>语言</span>++ <select value={currentLocale} onChange={this.changeLocale.bind(this)} style={{ width: 55 }}>+ <option value="en">English</option>+ <option value="zh">中文</option>+ </select>++ <span style={{ visibility: 'hidden' }}>{renderState}</span>+ </div> */}+ </Container>+ </Content>+ <Sider+ style={{+ display: layout.innerRight ? 'block' : 'none',+ }}+ >+ {/* innerRight */}+ </Sider>+ </Layout>+ <Footer+ style={{+ display: layout.footer ? 'block' : 'none',+ }}+ ></Footer>+ </Layout>+ <Sider+ style={{+ display: layout.outerRight && showSider ? 'block' : 'none',+ }}+ className={style.outerRightContainer}+ >+ {siderPanelList.map((item: ISiderState, i) => {+ if (item.type === ISlotElement.JSX) {+ // return item.content;+ return cloneElement(item.label as JSX.Element, {+ style: { display: item.show ? '' : 'none', zIndex: item.zIndex },+ });+ }+ return item;+ })}+ </Sider>+ </Layout>+ </Container>+ </AppContext.Provider>+ );+ }+}diff --git a/packages/base-docs/src/View/UI/DocContainer/index.module.less b/packages/base-docs/src/View/UI/DocContainer/index.module.lessnew file mode 100644index 0000000000..036457241b--- /dev/null+++ b/packages/base-docs/src/View/UI/DocContainer/index.module.less@@ -0,0 +1,79 @@+@import '@univer/style-universheet/src/assets/css/skin/base.module.less';++.layout-container {+ // theme+ background-color: var(--bg);+ color: var(--text-color);+ height: 100%;++ .content-container-horizontal {+ display: flex;+ min-height: 14em;+ position: relative;++ .content-inner-left-container {+ // position: relative;+ width: 50%;+ padding-right: 10px;+ flex: none;++ .hover-cursor {+ position: absolute;+ right: 0;+ top: 0;+ height: 100%;+ width: 10px;+ background: gray;+ cursor: e-resize;+ }+ }++ .content-inner-right-container {+ width: 50%;+ flex: 1;+ // position: relative;+ }+ }++ .content-container-vertical {+ display: flex;+ flex-direction: column;+ min-height: 14em;+ position: relative;++ .content-inner-left-container {+ // position: relative;+ height: 50%;+ padding-bottom: 10px;+ flex: none;++ .hover-cursor {+ position: absolute;+ left: 0;+ bottom: 0;+ height: 10px;+ width: 100%;+ background: gray;+ cursor: n-resize;+ }+ }++ .content-inner-right-container {+ height: 50%;+ flex: 1;+ }+ }++ .main-content {+ background: var(--bg);+ }++ .outer-right-container {+ // position: relative;+ flex: 0 0 280px;+ > div {+ position: absolute;+ width: 100%;+ }+ }+}diff --git a/packages/base-docs/src/View/UI/DocContainer/index.ts b/packages/base-docs/src/View/UI/DocContainer/index.tsnew file mode 100644index 0000000000..2876a0a179--- /dev/null+++ b/packages/base-docs/src/View/UI/DocContainer/index.ts@@ -0,0 +1 @@+export * from './DocContainer';diff --git a/packages/base-docs/src/View/UI/DocsButton.tsx b/packages/base-docs/src/View/UI/DocsButton.tsxdeleted file mode 100644index 61954d2ed5..0000000000--- a/packages/base-docs/src/View/UI/DocsButton.tsx+++ /dev/null@@ -1,104 +0,0 @@-import { Nullable, Observer } from '@univer/core';-import { ISelectButton, IToolBarItemProps, Component, BaseSelectProps } from '@univer/base-component';--interface IProps {}-// Types for state-interface IState {- docs: IToolBarItemProps;-}--export class DocsButton extends Component<IProps, IState> {-- private _localeObserver: Nullable<Observer<void>>;- initialize(props: IProps) {-- const OrderASCIcon = this.getComponentRender().renderFunction('OrderASCIcon');- const OrderDESCIcon = this.getComponentRender().renderFunction('OrderDESCIcon');- const OrderIcon = this.getComponentRender().renderFunction('OrderIcon');- const NextIcon = this.getComponentRender().renderFunction('NextIcon');-- const docs: IToolBarItemProps = {- locale: 'docs',- type: 'select',- label: <OrderASCIcon />,- icon: <NextIcon />,- show: true,- border: false,- selectType: ISelectButton.DOUBLE,- needChange: false,- children: [- {- locale: 'docs.one',- icon: <OrderASCIcon />,- },- {- locale: 'docs.two',- icon: <OrderDESCIcon />,- },- {- locale: 'docs.three',- icon: <OrderIcon />,- },- ],- };-- this.state = {- docs: docs,- };- }-- /**- * init- */- componentWillMount() {- this.setLocale();-- // subscribe Locale change event-- this._localeObserver = this._context.getObserverManager().getObserver('onAfterChangeUILocaleObservable','core')?.add(() => {- this.setLocale();- });- }- /**- * destory- */- componentWillUnmount() {- this._context.getObserverManager().getObserver('onAfterChangeUILocaleObservable','core')?.remove(this._localeObserver);- }- /**- * set text by config setting and Locale message- */- setLocale() {- const locale = this._context.getLocale();- this.setState((prevState: IState) => {- let item = prevState.docs;- // set current Locale string for tooltip- item.tooltip = locale.get(`${item.locale}Label`);- item.tooltipRight = locale.get(`${item.locale}RightLabel`);-- // set current Locale string for select- item.children?.forEach((ele: IToolBarItemProps) => {- if (ele.locale) {- ele.label = locale.get(`${ele.locale}`);- }- });- item.label = typeof item.label == 'object' ? item.label : item.children![0].label;-- return {- docs: item,- };- });- }-- /**- * Render the component's HTML- *- * @returns {void}- */- render(props: IProps, state: IState) {- const { docs } = state;- const Select = this.getComponentRender().renderFunction('Select');- // Set Provider for entire Container- return <Select tooltip={docs.tooltip} tooltipRight={docs.tooltipRight} border={docs.border} needChange={docs.needChange} key={docs.locale} children={docs.children as BaseSelectProps[]} label={docs.label} icon={docs.icon} />;- }-}diff --git a/packages/base-docs/src/View/UI/InfoBar/InfoBar.tsx b/packages/base-docs/src/View/UI/InfoBar/InfoBar.tsxnew file mode 100644index 0000000000..b7d299181e--- /dev/null+++ b/packages/base-docs/src/View/UI/InfoBar/InfoBar.tsx@@ -0,0 +1,68 @@+import { BaseComponentRender, BaseComponentSheet, Component } from '@univer/base-component';+import { Nullable, PLUGIN_NAMES } from '@univer/core';+import { BaseInfoBarProps } from '../../../Controller/InfoBarController';+import './index.less';++interface IState {+ infoList: Nullable<BaseInfoBarProps>;+}++interface Iprops {}++export class InfoBar extends Component<Iprops, IState> {+ Render: BaseComponentRender;++ initialize() {+ const component = this._context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+ this.Render = component.getComponentRender();++ this.state = {+ infoList: null,+ };+ }++ componentDidMount() {+ this._context.getObserverManager().getObserver<InfoBar>('onInfoBarDidMountObservable', PLUGIN_NAMES.DOCUMENT)?.notifyObservers(this);+ }++ setInfoList(list: BaseInfoBarProps) {+ this.setState({+ infoList: list,+ });+ }++ render() {+ if (!this.state.infoList) return;+ const Button = this.Render.renderFunction('Button');+ const Container = this.Render.renderFunction('Container');+ const Input = this.Render.renderFunction('Input');+ const Tooltip = this.Render.renderFunction('Tooltip');+ const DropDownIcon = this.Render.renderFunction('DropDownIcon');+ const LogoIcon = this.Render.renderFunction('LogoIcon');++ const { back, sheet, update, save, rename } = this.state.infoList;++ return (+ <Container className={'universheet-info-detail'}>+ <div style={{ marginRight: '18px' }}>+ <Tooltip title={back.label} placement={'bottom'}>+ <Button className={'universheet-info-return'} type="text">+ <DropDownIcon rotate={90} />+ </Button>+ </Tooltip>+ </div>+ <div className={'sheet-name'}>+ <Tooltip title={rename.label} placement={'bottom'}>+ <Input bordered={false} value={sheet.label} onBlur={sheet.onBlur} />+ </Tooltip>+ </div>+ <div id="universheet-info-detail-update" className="universheet-info-detail-update">+ {update.label}+ </div>+ <div id="universheet-info-detail-save" className="universheet-info-detail-save">+ {save.label}+ </div>+ </Container>+ );+ }+}diff --git a/packages/base-docs/src/View/UI/InfoBar/index.less b/packages/base-docs/src/View/UI/InfoBar/index.lessnew file mode 100644index 0000000000..59113a5d75--- /dev/null+++ b/packages/base-docs/src/View/UI/InfoBar/index.less@@ -0,0 +1,46 @@+@import '@univer/style-universheet/assets/css/skin/base.module.less';++.universheet-info-detail {+ position: relative;+ left: 0;+ top: 0;+ margin: 0;+ padding: 0 17px;+ height: 56px;+ display: flex;+ align-items: center;+ background: var(--bg);+ box-shadow: 0 -1px 0 0 @gray-16;+ border-bottom: 1px solid var(--border-color-base);++ .universheet-info-return {+ font-size: 16px;+ padding: 0 5px;+ font-size: 14px;+ }++ .univericon.univericon-logo {+ margin-left: 18px;++ svg {+ width: 100%;+ height: 100%;+ }+ }++ .sheet-name {+ margin: 0 auto;+ }++ .universheet-info-detail-update {+ color: @gray-17;+ font-size: 12px;+ margin-left: 15px;+ }++ .universheet-info-detail-save {+ color: @gray-7;+ font-size: 12px;+ margin: 0 5px;+ }+}diff --git a/packages/base-docs/src/View/UI/InfoBar/index.ts b/packages/base-docs/src/View/UI/InfoBar/index.tsnew file mode 100644index 0000000000..345955a1ce--- /dev/null+++ b/packages/base-docs/src/View/UI/InfoBar/index.ts@@ -0,0 +1 @@+export * from './InfoBar';diff --git a/packages/base-docs/src/View/UI/InfoBar/infobar-zh.md b/packages/base-docs/src/View/UI/InfoBar/infobar-zh.mdnew file mode 100644index 0000000000..89972db6ef--- /dev/null+++ b/packages/base-docs/src/View/UI/InfoBar/infobar-zh.md@@ -0,0 +1,10 @@+---+category: Components+type: 通用+title: InfoBar+cover: ''+---++## 介绍++最顶部的栏目,包含 logo/项目名diff --git a/packages/base-docs/src/View/UI/ToolBar/Const.ts b/packages/base-docs/src/View/UI/ToolBar/Const.tsnew file mode 100644index 0000000000..1701d084f8--- /dev/null+++ b/packages/base-docs/src/View/UI/ToolBar/Const.ts@@ -0,0 +1,358 @@+export const FONT_SIZE_CHILDREN = [+ {+ label: '9',+ value: 9,+ },+ {+ label: '10',+ value: 10,+ },+ {+ label: '11',+ value: 11,+ },+ {+ label: '12',+ value: 12,+ },+ {+ label: '14',+ value: 14,+ },+ {+ label: '16',+ value: 16,+ },+ {+ label: '18',+ value: 18,+ },+ {+ label: '20',+ value: 20,+ },++ {+ label: '22',+ value: 22,+ },+ {+ label: '24',+ value: 24,+ },+ {+ label: '26',+ value: 26,+ },+ {+ label: '28',+ value: 28,+ },+ {+ label: '36',+ value: 36,+ },+ {+ label: '48',+ value: 48,+ },+ {+ label: '72',+ value: 72,+ },+];++export const FONT_FAMILY_CHILDREN = [+ {+ locale: 'fontFamily.TimesNewRoman',+ style: { 'font-family': 'Times New Roman' },+ value: 'Times New Roman',+ selected: true,+ },+ {+ locale: 'fontFamily.Arial',+ style: { 'font-family': 'Arial' },+ value: 'Arial',+ },+ {+ locale: 'fontFamily.Tahoma',+ style: { 'font-family': 'Tahoma' },+ value: 'Tahoma',+ },+ {+ locale: 'fontFamily.Verdana',+ style: { 'font-family': 'Verdana' },+ value: 'Verdana',+ },+ {+ locale: 'fontFamily.MicrosoftAccorblack',+ style: { 'font-family': '微软雅黑' },+ value: '微软雅黑',+ },+ {+ locale: 'fontFamily.SimSun',+ style: { 'font-family': '宋体' },+ value: '宋体',+ },+ {+ locale: 'fontFamily.SimHei',+ style: { 'font-family': '黑体' },+ value: '黑体',+ },+ {+ locale: 'fontFamily.Kaiti',+ style: { 'font-family': '楷体' },+ value: '楷体',+ },+ {+ locale: 'fontFamily.FangSong',+ style: { 'font-family': '仿宋' },+ value: '仿宋',+ },+ {+ locale: 'fontFamily.NSimSun',+ style: { 'font-family': '新宋体' },+ value: '新宋体',+ },+ {+ locale: 'fontFamily.STXinwei',+ style: { 'font-family': '华文新魏' },+ value: '华文新魏',+ },+ {+ locale: 'fontFamily.STXingkai',+ style: { 'font-family': '华文行楷' },+ value: '华文行楷',+ },+ {+ locale: 'fontFamily.STLiti',+ style: { 'font-family': '华文隶书' },+ value: '华文隶书',+ },+ {+ locale: 'fontFamily.HanaleiFill',+ style: { 'font-family': 'HanaleiFill' },+ value: 'HanaleiFill',+ },+ {+ locale: 'fontFamily.Anton',+ style: { 'font-family': 'Anton' },+ value: 'Anton',+ },+ {+ locale: 'fontFamily.Pacifico',+ style: { 'font-family': 'Pacifico' },+ value: 'Pacifico',+ },+];++export const BORDER_LINE_CHILDREN = [+ {+ locale: 'borderLine.borderTop',+ customSuffix: {+ name: 'TopBorderIcon',+ },+ value: 'top',+ },+ {+ locale: 'borderLine.borderBottom',+ customSuffix: {+ name: 'BottomBorderIcon',+ },+ value: 'bottom',+ },+ {+ locale: 'borderLine.borderLeft',+ customSuffix: {+ name: 'LeftBorderIcon',+ },+ value: 'left',+ },+ {+ locale: 'borderLine.borderRight',+ customSuffix: {+ name: 'RightBorderIcon',+ },+ value: 'right',+ border: true,+ },+ {+ locale: 'borderLine.borderNone',+ customSuffix: {+ name: 'NoneBorderIcon',+ },+ value: 'none',+ },+ {+ locale: 'borderLine.borderAll',+ customSuffix: {+ name: 'FullBorderIcon',+ },+ value: 'all',+ selected: true,+ },+ {+ locale: 'borderLine.borderOutside',+ customSuffix: {+ name: 'OuterBorderIcon',+ },+ value: 'outside',+ },+ {+ locale: 'borderLine.borderInside',+ customSuffix: {+ name: 'InnerBorderIcon',+ },+ value: 'inside',+ },+ {+ locale: 'borderLine.borderHorizontal',+ customSuffix: {+ name: 'StripingBorderIcon',+ },+ value: 'horizontal',+ },+ {+ locale: 'borderLine.borderVertical',+ customSuffix: {+ name: 'VerticalBorderIcon',+ },+ value: 'vertical',+ },+];++export const MERGE_CHILDREN = [+ {+ locale: 'merge.all',+ value: 'all',+ },+ {+ locale: 'merge.vertical',+ value: 'vertical',+ },+ {+ locale: 'merge.horizontal',+ value: 'horizontal',+ },+ {+ locale: 'merge.cancel',+ value: 'cancel',+ },+];++export const HORIZONTAL_ALIGN_CHILDREN = [+ {+ locale: 'align.left',+ customSuffix: {+ name: 'LeftAlignIcon',+ },+ value: 1,+ },+ {+ locale: 'align.center',+ customSuffix: {+ name: 'CenterAlignIcon',+ },+ value: 2,+ },+ {+ locale: 'align.right',+ customSuffix: {+ name: 'RightAlignIcon',+ },+ value: 3,+ },+];++export const VERTICAL_ALIGN_CHILDREN = [+ {+ locale: 'align.top',+ customSuffix: {+ name: 'TopVerticalIcon',+ },+ value: 1,+ },+ {+ locale: 'align.middle',+ customSuffix: {+ name: 'CenterVerticalIcon',+ },+ value: 2,+ },+ {+ locale: 'align.bottom',+ customSuffix: {+ name: 'BottomVerticalIcon',+ },+ value: 3,+ },+];++export const TEXT_WRAP_CHILDREN = [+ {+ locale: 'textWrap.overflow',+ customSuffix: {+ name: 'OverflowIcon',+ },+ value: 1,+ },+ {+ locale: 'textWrap.wrap',+ customSuffix: {+ name: 'BrIcon',+ },+ value: 3,+ },+ {+ locale: 'textWrap.clip',+ customSuffix: {+ name: 'CutIcon',+ },+ value: 2,+ },+];++export const TEXT_ROTATE_CHILDREN = [+ {+ locale: 'textRotate.none',+ customSuffix: {+ name: 'TextRotateIcon',+ },+ value: 0,+ },+ {+ locale: 'textRotate.angleUp',+ customSuffix: {+ name: 'TextRotateAngleUpIcon',+ },+ value: -45,+ },+ {+ locale: 'textRotate.angleDown',+ customSuffix: {+ name: 'TextRotateAngleDownIcon',+ },+ value: 45,+ },+ {+ locale: 'textRotate.vertical',+ customSuffix: {+ name: 'TextRotateVerticalIcon',+ },+ value: 'v',+ },+ {+ locale: 'textRotate.rotationUp',+ customSuffix: {+ name: 'TextRotateRotationUpIcon',+ },+ value: -90,+ },+ {+ locale: 'textRotate.rotationDown',+ customSuffix: {+ name: 'TextRotateRotationDownIcon',+ },+ value: 90,+ },+];diff --git a/packages/base-docs/src/View/UI/ToolBar/DataBar.tsx b/packages/base-docs/src/View/UI/ToolBar/DataBar.tsxnew file mode 100644index 0000000000..f0f4350aa8--- /dev/null+++ b/packages/base-docs/src/View/UI/ToolBar/DataBar.tsx@@ -0,0 +1,22 @@+type BarProps = {+ list: Array<Record<string, string>>;+ img: string;+ onClick?: (item: {}, index: number) => void;+};++export const DataBar = (props: BarProps) => {+ const { list, img, onClick } = props;+ const background = `url(${img}) no-repeat`;++ let handleClick = (item: {}, index: number) => {+ onClick?.call(this, item, index);+ };++ return (+ <div style="display: flex;">+ {list.map((item, index) => (+ <div onClick={() => handleClick(item, index)} style={{ width: '28px', height: '26px', background, backgroundPosition: `${item.x} ${item.y}` }}></div>+ ))}+ </div>+ );+};diff --git a/packages/base-docs/src/View/UI/ToolBar/SingleButton.tsx b/packages/base-docs/src/View/UI/ToolBar/SingleButton.tsxnew file mode 100644index 0000000000..689c0c51dd--- /dev/null+++ b/packages/base-docs/src/View/UI/ToolBar/SingleButton.tsx@@ -0,0 +1,68 @@+import { BaseSingleButtonProps, Component, JSXComponent, SingleButtonComponent } from '@univer/base-component';+import { Button, Tooltip } from '@univer/style-universheet';++import styles from './index.module.less';++export interface SingleButtonProps {+ label?: string | JSX.Element;+ icon?: JSX.Element | string | null | undefined;+ tooltip?: string;+ name?: string;+ key?: string;+ onClick?: (...arg: any[]) => void;+ active?: boolean;+ triggerUpdate?: (func: Function) => void;+}+export interface IState {+ active: boolean;+}++class SingleButton extends Component<SingleButtonProps, IState> {+ initialize(props: SingleButtonProps): void {+ // Mount update function, when updating the selection range, the cell formats corresponding to different ranges are different, and the toolbar status and values need to be updated in real time+ const { triggerUpdate, active } = props;+ triggerUpdate && triggerUpdate(this.update.bind(this));++ this.state = {+ active: active || false,+ };+ }++ update(active: boolean) {+ this.setState({ active });+ }++ onClick() {+ this.setState(+ (prevState: IState) => ({+ active: !prevState.active,+ }),+ () => {+ this.props.onClick && this.props.onClick(this.state.active);+ }+ );+ }++ render() {+ const { name, tooltip, label, icon, onClick, key } = this.props;+ const { active } = this.state;+ return (+ <div className={styles.singleButton} key={key}>+ <Tooltip title={tooltip!} placement={'bottom'}>+ <Button type="text" onClick={() => this.onClick()} active={active}>+ {label}+ {icon}+ </Button>+ </Tooltip>+ </div>+ );+ }+}++export class UniverSingleButton implements SingleButtonComponent {+ render(): JSXComponent<BaseSingleButtonProps> {+ return SingleButton;+ }+}++export { SingleButton };diff --git a/packages/base-docs/src/View/UI/ToolBar/ToolBar-zh.md b/packages/base-docs/src/View/UI/ToolBar/ToolBar-zh.mdnew file mode 100644index 0000000000..ffba806bfe--- /dev/null+++ b/packages/base-docs/src/View/UI/ToolBar/ToolBar-zh.md@@ -0,0 +1,92 @@+---+category: Components+type: 定制+title: ToolBar+subtitle: 工具栏+cover: ''+---++## 介绍++工具栏++## API++工具栏的属性说明如下:++| 属性 | 说明 | 类型 | 默认值 |+| ---------- | --------------------- | --------------------------- | -------------------------- |+| style | 自定义 css 央样式对象 | `JSX.CSSProperties` | - |+| config | 配置项 | `IShowToolBarConfig` | `IShowToolBarConfig` |+| forwardRef | preact refs 引用 | `RefObject<HTMLDivElement>` | - |+| func | 回调挂载 | `object` | `{ addButton: Function; }` |++`IShowToolBarConfig`包含以下配置,默认都为 `true`,可以指定想隐藏的工具栏按钮为`false`++```json+{+ "undoRedo": false, //撤销重做,注意撤消重做是两个按钮,由这一个配置决定显示还是隐藏+ "paintFormat": false, //格式刷+ "currencyFormat": false, //货币格式+ "percentageFormat": false, //百分比格式+ "numberDecrease": false, // '减少小数位数'+ "numberIncrease": false, // '增加小数位数+ "moreFormats": false, // '更多格式'+ "font": false, // '字体'+ "fontSize": false, // '字号大小'+ "bold": false, // '粗体 (Ctrl+B)'+ "italic": false, // '斜体 (Ctrl+I)'+ "strikethrough": false, // '删除线 (Alt+Shift+5)'+ "underline": false, // '下划线 (Alt+Shift+6)'+ "textColor": false, // '文本颜色'+ "fillColor": false, // '单元格颜色'+ "border": false, // '边框'+ "mergeCell": false, // '合并单元格'+ "horizontalAlignMode": false, // '水平对齐方式'+ "verticalAlignMode": false, // '垂直对齐方式'+ "textWrapMode": false, // '换行方式'+ "textRotateMode": false // '文本旋转方式'+}+```++以下这些配置已经分配到各个插件中了++```json+{+ "link": false, // '插入链接'+ "image": false, // '插入图片'+ "chart": false, // '图表'+ "comment": false, //'批注'+ "pivotTable": false, //'数据透视表'+ "function": false, // '公式'+ "frozenMode": false, // '冻结方式'+ "sort": false, // '排序'+ "filter": false, // '筛选'+ "conditionalalFormat": false, // '条件格式'+ "dataValidation": false, // '数据验证'+ "splitColumn": false, // '分列'+ "screenshot": false, // '截图'+ "findAndReplace": false, // '查找替换'+ "protection": false, // '工作表保护'+ "print": false // '打印'+}+```++## 案例++```jsx+import { ToolBar } from '@univer/style-universheet';++const SheetContainer = () => {+ return (+ <ToolBar+ style={{+ display: layout.toolBar ? 'block' : 'none',+ }}+ config={layout.toolBarConfig!}+ func={{ addButton }}+ ref={this.toolBarRef}+ ></ToolBar>+ );+};+```diff --git a/packages/core/src/Basics/Univer.ts b/packages/base-docs/src/View/UI/ToolBar/ToolBar.mdsimilarity index 100%rename from packages/core/src/Basics/Univer.tsrename to packages/base-docs/src/View/UI/ToolBar/ToolBar.mddiff --git a/packages/base-docs/src/View/UI/ToolBar/ToolBar.tsx b/packages/base-docs/src/View/UI/ToolBar/ToolBar.tsxnew file mode 100644index 0000000000..859f86e965--- /dev/null+++ b/packages/base-docs/src/View/UI/ToolBar/ToolBar.tsx@@ -0,0 +1,171 @@+import { BaseComponentProps, BaseComponentRender, BaseComponentSheet, Component, createRef } from '@univer/base-component';++import { PLUGIN_NAMES } from '@univer/core';+import { Select } from '@univer/style-universheet';+import { DocPlugin } from '../../../DocPlugin';+import { IToolBarItemProps } from '../../../Model/ToolBarModel';+import { TextButton } from '../Common/TextButton/TextButton';+import styles from './index.module.less';++interface IProps extends BaseComponentProps {+ style?: JSX.CSSProperties;+ toolList: IToolBarItemProps[];+ // forwardRefs?: RefObject<HTMLElement>;+}++interface IState {+ toolList: IToolBarItemProps[];+ moreToolList: IToolBarItemProps[];+ defaultToolList: IToolBarItemProps[];+ more: boolean;+ index: number;+ toolbarListWidths: number[];+ moreText: string;+}++export class ToolBar extends Component<IProps, IState> {+ toolbarWarp = createRef();++ toolbarRef = createRef();++ moreBtn = createRef();++ moreToolRef = createRef();++ SelectRef = createRef();++ Render: BaseComponentRender;++ initialize(props: IProps) {+ const component = this._context.getPluginManager().getPluginByName<BaseComponentSheet>('ComponentSheet')!;+ this.Render = component.getComponentRender();++ this.state = {+ // Button contains main button and drop down arrow, translation file contains main and right+ more: false,+ toolList: [],+ defaultToolList: [],+ moreToolList: [],+ index: 0,+ toolbarListWidths: [],+ moreText: '',+ };+ }++ /**+ * show more tool buttons+ *+ * TODO : 点击其他地方需要隐藏more buttons+ */+ moreTool = () => {+ let more = this.state.more;+ this.setState({ more: !more });++ if (!more) {+ document.addEventListener('click', this.hide, true);+ }+ };++ hide = (e: Event) => {+ if (this.moreToolRef.current.contains(e.target)) return;+ e.stopImmediatePropagation();+ this.setState({ more: false });+ document.removeEventListener('click', this.hide, true);+ };++ resetLabel = (toolList: any[]) => {+ const plugin = this._context.getPluginManager().getPluginByName<DocPlugin>(PLUGIN_NAMES.DOCUMENT);++ for (let i = 0; i < toolList.length; i++) {+ const item = toolList[i];++ // 优先寻找自定义组件+ if (item.customLabel) {+ const Label = plugin?.getRegisterComponent(item.customLabel.name);+ if (Label) {+ const props = item.customLabel.props ?? {};+ item.label = <Label {...props} />;+ }+ }++ if (item.customSuffix) {+ const Suffix = plugin?.getRegisterComponent(item.customSuffix.name);+ if (Suffix) {+ const props = item.customSuffix.props ?? {};+ item.suffix = <Suffix {...props} />;+ }+ }++ if (item.children) {+ item.children = this.resetLabel(item.children);+ }+ }+ return toolList;+ };++ setToolBar = (toolList: any[]) => {+ toolList = this.resetLabel(toolList);++ this.setState({+ toolList,+ });+ };++ componentDidMount() {+ this._context.getObserverManager().getObserver<ToolBar>('onToolBarDidMountObservable')?.notifyObservers(this);+ }++ render(props: IProps, state: IState) {+ const { toolList } = state;++ const Button = this.Render.renderFunction('Button');+ const Container = this.Render.renderFunction('Container');+ const Tooltip = this.Render.renderFunction('Tooltip');++ return (+ <Container style={{ position: 'relative' }}>+ <div className={styles.toolbarWarp} ref={this.toolbarWarp}>+ <div className={styles.toolbar} ref={this.toolbarRef}>+ {toolList.map((item) => {+ if (item.toolbarType) {+ return (+ <Tooltip title={item.tooltip} placement={'bottom'}>+ <TextButton label={item.label} onClick={item.onClick}></TextButton>+ </Tooltip>+ );+ }+ return (+ <Tooltip title={item.tooltip} placement={'bottom'}>+ <Select+ type={item.type}+ display={item.display}+ children={item.children}+ customLabel={item.customLabel}+ customSuffix={item.customSuffix}+ label={item.label}+ onClick={item.onClick}+ onKeyUp={item.onKeyUp}+ defaultColor={item.defaultColor}+ hideSelectedIcon={item.hideSelectedIcon}+ selectClassName={item.selectClassName}+ ></Select>+ </Tooltip>+ );+ })}+ </div>+ {this.state.moreToolList.length === 0 ? null : (+ <div ref={this.moreBtn} className={styles.singleButton}>+ <Tooltip title={this.state.moreText} placement={'bottom'}>+ <Button type="text" onClick={this.moreTool}>+ <div style={{ fontSize: '14px' }}>{this.state.moreText}</div>+ </Button>+ </Tooltip>+ </div>+ )}+ </div>++ <div className={`${styles.moreTool} ${this.state.more ? styles.moreShow : null}`} ref={this.moreToolRef}></div>+ </Container>+ );+ }+}diff --git a/packages/base-docs/src/View/UI/ToolBar/index.less b/packages/base-docs/src/View/UI/ToolBar/index.lessnew file mode 100644index 0000000000..3302e5aa4f--- /dev/null+++ b/packages/base-docs/src/View/UI/ToolBar/index.less@@ -0,0 +1,312 @@+@import '@univer/style-universheet/assets/css/skin/base.module.less';++.universheet-wa-editor.toolbar {+ height: 32px;+ background: var(--bg);+ position: relative;+ padding: 5px 0 3px 15px;+ border-bottom: 1px solid var(--bg);+ white-space: nowrap;+ transition: all 0.2s;+ box-sizing: initial;++ span[role='img'] {+ font-size: 24px;+ display: inline-block;+ }++ span[role='img'].univericon-nextIcon {+ font-size: 13px;+ }++ span[role='img'].univericon-rightIcon {+ font-size: 13px;+ }++ .universheet-toolbar-left-skin {+ width: 15px;+ position: absolute;+ left: 0;+ top: 1px;+ bottom: 1px;+ }++ .universheet-inline-block {+ display: inline-block;+ }++ .universheet-flex {+ display: flex;+ }++ .universheet-toolbar-button,+ .universheet-toolbar-menu-button {+ vertical-align: middle;++ &:hover {+ background: rgba(0, 0, 0, 0.06);+ }++ button {+ min-width: 26px;+ height: 26px;+ padding: 0;+ border: none;+ .toolbar-button();++ span {+ height: 100%;+ vertical-align: text-bottom;+ }+ }+ }++ .universheet-toolbar-button-outer-box,+ .universheet-toolbar-menu-button-outer-box {+ .outer-inner-box();+ }++ .universheet-toolbar-select {+ position: relative;+ }++ .universheet-toolbar-button-inner-box,+ .universheet-toolbar-menu-button-inner-box {+ padding: 0 2px;+ padding: 0;+ text-align: center;+ height: 26px;+ min-width: 26px;+ font-size: 12px;+ }++ .universheet-toolbar-menu-button-caption {+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ margin-left: 1px;+ text-align: center;+ height: 100%;+ }++ .universheet-toolbar-menu-button-text {+ width: 55px !important;+ }++ .universheet-toolbar-separator {+ line-height: normal;+ list-style: none;+ outline: 0;+ overflow: hidden;+ padding: 0;+ text-decoration: none;+ width: 0;+ height: 20px;+ vertical-align: top;+ border-left: 1px solid #e0e0e0;+ margin: 5px 1px;+ }++ .universheet-toolbar-combo-button {+ font-weight: 700;+ vertical-align: inherit;+ margin: 0 1px;+ .toolbar-button();+ }++ .universheet-toolbar-combo-button-inner-box,+ .universheet-toolbar-combo-button-outer-box {+ .outer-inner-box();+ }++ .universheet-toolbar-zoom-combobox .universheet-toolbar-combo-button-caption {+ width: 36px !important;+ }++ .universheet-toolbar-combo-button-caption {+ padding: 0;+ margin: 0 0 0 -3px;+ }++ .universheet-toolbar-textinput {+ -webkit-border-radius: 1px;+ -moz-border-radius: 1px;+ border-radius: 1px;+ border: 1px solid #d9d9d9;+ border-top: 1px solid silver;+ font-size: 13px;+ height: 25px;+ padding: 1px 0 1px 8px;+ }++ .universheet-toolbar-combo-button-input {+ background: 0 0;+ border: 1px solid transparent !important;+ color: var(--text-color);+ font-family: Arial, sans-serif !important;+ font-size: 11px !important;+ font-weight: 700 !important;+ height: 20px !important;+ overflow: hidden !important;+ color: rgba(0, 0, 0, 0.7);+ height: 22px !important;+ width: 22px;+ }++ .universheet-cols-menu {+ .menu-button();+ width: 252px;+ left: 0;+ top: 26px;+ display: none;+ }++ .universheet-cols-menu .universheet-cols-menuitem-hover,+ .universheet-cols-menu .universheet-cols-menuitem:hover {+ background-color: #efefef;+ }++ .universheet-cols-menu .universheet-cols-menuitem {+ position: relative;+ color: var(--text-color);+ cursor: pointer;+ list-style: none;+ margin: 0;+ padding: 1px 6em 1px 20px;+ white-space: nowrap;+ padding-left: 8px;+ vertical-align: middle;+ padding-right: 24px;+ user-select: none;+ line-height: 16px;+ }++ .universheet-submenu-arrow {+ -webkit-transition: all 218ms;+ -moz-transition: all 218ms;+ -o-transition: all 218ms;+ transition: all 218ms;+ font-size: 12px;+ left: auto;+ right: 15px;+ top: 50%;+ transform: translateY(-50%);+ padding-right: 0;+ position: absolute;+ text-align: right;+ opacity: 0.5;+ color: #000;+ user-select: none;+ font-family: Arial;+ }++ .universheet-toolbar-dblbutton {+ .universheet-toolbar-next-button {+ border-left: 1px solid transparent;+ position: relative;++ .universheet-next-menu {+ position: absolute;+ z-index: `getZindex('toolbar') `;+ background-color: #fff;+ box-shadow: var(--box-shadow-base);+ font-size: 12px;+ width: fit-content;++ .univer-menu-item > div {+ width: 100%;+ display: flex;+ justify-content: space-between;+ box-sizing: border-box;+ padding: 0 5px 0 0;++ .universheet-next-menu-icon {+ width: 25px;++ & ~ div {+ flex: 1;+ display: flex;+ justify-content: space-between;+ align-items: center;+ }+ }+ }++ svg {+ font-size: 24px;+ vertical-align: top;+ }+ }++ svg {+ font-size: 12px;+ vertical-align: middle;+ }+ }++ .universheet-color-bottom {+ width: 10px;+ margin: 0 auto;+ outline: 2px solid;+ position: relative;+ bottom: 7px;+ }++ button.univer-btn {+ min-width: 15px;++ &:active {+ background: transparent !important;+ }+ }++ :hover .universheet-toolbar-next-button {+ border-left: 1px solid #e0e0e0;+ }+ }+}++// 重复样式+.outer-inner-box() {+ border: 0;+ vertical-align: top;+ margin: 0;+ padding: 0;+}++.toolbar-button() {+ -webkit-border-radius: 2px;+ -moz-border-radius: 2px;+ border-radius: 2px;+ -webkit-user-select: none;+ -moz-user-select: none;+ -ms-user-select: none;+ background: 0;+ border: 1px solid transparent;+ outline: 0;+ padding: 0;+ list-style: none;+ font-size: 11px;+ text-decoration: none;+ cursor: default;+ height: 26px;+ line-height: 26px;+ color: var(--text-color);+}++.menu-button() {+ border-radius: 0;+ box-shadow: 0 2px 4px rgb(0 0 0 / 20%);+ transition: opacity 218ms;+ background: #fff;+ border: 1px solid rgba(0, 0, 0, 0.2);+ cursor: default;+ font-size: 13px;+ margin: 0;+ outline: 0;+ padding: 6px 0;+ position: absolute;+ z-index: ~`getZindex('toolbar') `;+ box-sizing: border-box;+ user-select: none;+}diff --git a/packages/base-docs/src/View/UI/ToolBar/index.module.less b/packages/base-docs/src/View/UI/ToolBar/index.module.lessnew file mode 100644index 0000000000..4847d87beb--- /dev/null+++ b/packages/base-docs/src/View/UI/ToolBar/index.module.less@@ -0,0 +1,187 @@+@import '@univer/style-universheet/assets/css/skin/base.module.less';++.toolbar-warp {+ height: 40px;+ max-height: fit-content;+ width: 100%;+ overflow: unset;+ box-sizing: border-box;+ font-size: var(--font-size);+ background-color: var(--bg);+ position: relative;+ display: flex;+ align-items: center;+ border-bottom: 1px solid var(--border-color-base);++ .single-button {+ &.more-hide {+ display: none;+ }++ &.more-show {+ display: block;+ }+ }+}++.toolbar {+ max-width: 100%;+ color: var(--text-color);+ padding: 5px 15px;+ height: 40px;+ position: relative;++ >div {+ // margin-top: 7px;+ height: 26px;+ display: inline-block;+ vertical-align: middle;+ margin: 7px 3px 0 3px;++ &.select-button:hover {+ background-color: #efefef;+ }+ }++ .cols-menu {+ overflow-y: auto;+ }++ .select-label-string {+ .drop-content {+ >div {+ overflow: hidden;+ text-overflow: ellipsis;+ white-space: nowrap;+ width: 90px;+ }+ }+ }++ .select-color-picker-parent {+ .select-item-content {+ width: 100%;+ }++ ul {+ padding: 0;+ }++ .select-color-picker {+ padding: 0;++ .select-item {+ padding: 0;+ }+ }+ }++ .single-button {+ margin: 0 3px;++ button {+ .button();+ font-size: 24px;+ }+ }++ .double-button {+ position: relative;+ display: flex;+ align-items: center;+ margin: 0 5px;++ .color-bottom {+ width: 10px;+ margin: 0 auto;+ outline: 2px solid;+ position: relative;+ bottom: 4px;+ }++ .double-button-right {+ height: 100%;+ display: flex;+ align-items: center;++ .double-button-right-popup {+ box-shadow: var(--box-shadow-base);+ background-color: var(--bg);+ position: absolute;+ left: 0;+ top: 35px;+ width: max-content;++ .double-button-menu-item {+ display: flex;+ align-content: center;++ .double-button-menu-item-icon {+ width: 25px;+ margin-right: 5px;+ }++ .double-button-menu-item-content {+ display: flex;+ align-items: center;+ }+ }+ }++ button {+ padding: 0;+ padding-right: 5px;+ }+ }++ button {+ .button();+ }++ span[role='img'] {+ font-size: 24px;+ }+ }+}++.more-button {+ height: 35px;+ margin: 5px;+ display: none;+ .button();++ &.more-show {+ display: block;+ }+}++.more-tool {+ height: 40px;+ display: none;+ align-items: center;+ padding: 0 10px;+ background-color: var(--bg);+ box-shadow: var(--box-shadow-base);+ position: absolute;+ right: 2em;+ top: 40px;+ z-index: `getZindex('toolbar') `;++ &.more-show {+ display: flex;+ }++ button {+ .button();+ font-size: 24px;+ }+}++.button() {+ padding: 0px 5px;+ line-height: 1;+}++span[role='img'].univericon-nextIcon {+ font-size: 12px;+}\ No newline at end of filediff --git a/packages/base-docs/src/View/UI/ToolBar/index.ts b/packages/base-docs/src/View/UI/ToolBar/index.tsnew file mode 100644index 0000000000..a6b74775e1--- /dev/null+++ b/packages/base-docs/src/View/UI/ToolBar/index.ts@@ -0,0 +1,2 @@+export * from './ToolBar';+export * from './SingleButton';diff --git a/packages/base-docs/src/index.ts b/packages/base-docs/src/index.tsindex 0a1fe66708..b092aeeb92 100644--- a/packages/base-docs/src/index.ts+++ b/packages/base-docs/src/index.ts@@ -1,3 +1,3 @@-import { DocsPlugin } from './DocsPlugin';+import { DocPlugin } from './DocPlugin';-export { DocsPlugin };+export { DocPlugin };diff --git a/packages/base-docs/src/main.tsx b/packages/base-docs/src/main.tsxindex 0ab3f77d3a..b81ebca114 100644--- a/packages/base-docs/src/main.tsx+++ b/packages/base-docs/src/main.tsx@@ -1,11 +1,11 @@import { UniverDoc } from '@univer/core';import { RenderEngine } from '@univer/base-render';import { UniverComponentSheet } from '@univer/style-universheet';-import { DocsPlugin } from './DocsPlugin';+import { DocPlugin } from './DocPlugin';const univerDocUp = UniverDoc.newInstance();univerDocUp.installPlugin(new RenderEngine());univerDocUp.installPlugin(new UniverComponentSheet());-univerDocUp.installPlugin(new DocsPlugin());+univerDocUp.installPlugin(new DocPlugin());diff --git a/packages/base-sheets/src/SheetPlugin.tsx b/packages/base-sheets/src/SheetPlugin.tsxindex 147b2db911..04056fbd6b 100644--- a/packages/base-sheets/src/SheetPlugin.tsx+++ b/packages/base-sheets/src/SheetPlugin.tsx@@ -1,6 +1,6 @@import { getRefElement, IMainProps, isElement, ISlotProps, RefObject, render } from '@univer/base-component';import { Engine, RenderEngine } from '@univer/base-render';-import { AsyncFunction, SheetContext, IOCContainer, IWorkbookConfig, Plugin, PLUGIN_NAMES, Tools } from '@univer/core';+import { AsyncFunction, SheetContext, IWorkbookConfig, Plugin, PLUGIN_NAMES, Tools } from '@univer/core';import { install, SheetPluginObserve, uninstall } from './Basics/Observer';import { RightMenuProps } from './Model/RightMenuModel';@@ -75,10 +75,10 @@ export class SheetPlugin extends Plugin<SheetPluginObserve, SheetContext> {private _componentList: Map<string, any>;- constructor(props: Partial<ISheetPluginConfig> = {}) {+ constructor(config: Partial<ISheetPluginConfig> = {}) {super(PLUGIN_NAMES.SPREADSHEET);- this._config = Tools.commonExtend(DEFAULT_SPREADSHEET_PLUGIN_DATA, props);+ this._config = Tools.commonExtend(DEFAULT_SPREADSHEET_PLUGIN_DATA, config);}register(engineInstance: Engine) {@@ -231,8 +231,6 @@ export class SheetPlugin extends Plugin<SheetPluginObserve, SheetContext> {this.context.getContextObserver('onSheetRenderDidMountObservable')?.notifyObservers();}- onMapping(IOC: IOCContainer): void {}-onDestroy(): void {super.onDestroy();uninstall(this);diff --git a/packages/core/src/Basics/DocContext.ts b/packages/core/src/Basics/DocContext.tsnew file mode 100644index 0000000000..39a71e391a--- /dev/null+++ b/packages/core/src/Basics/DocContext.ts@@ -0,0 +1,17 @@+import { IDocumentData } from '../Interfaces/IDocumentData';+import { Workbook } from '../Sheets/Domain';+import { ContextBase } from './ContextBase';++/**+ * Core context, mount important instances, managers+ */+export class DocContext extends ContextBase {+ protected _workbook: Workbook;++ constructor(univerDocData: Partial<IDocumentData> = {}) {+ super();+ this._locale.initialize(univerDocData.locale);+ }++ protected _setObserver(): void {}+}diff --git a/packages/core/src/Basics/UniverDoc.ts b/packages/core/src/Basics/UniverDoc.tsnew file mode 100644index 0000000000..31b0bcda76--- /dev/null+++ b/packages/core/src/Basics/UniverDoc.ts@@ -0,0 +1,75 @@+import { IDocumentData } from '../Interfaces';+import { Plugin } from '../Plugin';+import { IOHttp, IOHttpConfig, Logger } from '../Shared';+import { DocContext } from './DocContext';+import { VersionCode, VersionEnv } from './Version';+import { ColorBuilder } from '../Sheets/Domain/ColorBuilder';++/**+ * Externally provided UniverDoc root instance+ */+export class UniverDoc {+ univerDocConfig: Partial<IDocumentData>;++ constructor(UniverDocData: Partial<IDocumentData> = {}) {+ this.univerDocConfig = UniverDocData;+ this._context = new DocContext(UniverDocData);+ }++ static newInstance(UniverDocData: Partial<IDocumentData> = {}): UniverDoc {+ Logger.capsule(VersionEnv, VersionCode, 'powered by :: UniverDoc :: ');+ return new UniverDoc(UniverDocData);+ }++ /**+ *+ * Request data+ *+ * @example+ * Get data for all tables, including core and plugin data+ *+ * @param config+ */+ static get<T = void>(config: Omit<IOHttpConfig, 'type'>): Promise<T> {+ return IOHttp({ ...config, type: 'GET' });+ }++ /**+ * Submit data+ * @param config+ */+ static post<T = void>(config: Omit<IOHttpConfig, 'type'>): Promise<T> {+ return IOHttp({ ...config, type: 'POST' });+ }++ static newColor(): ColorBuilder {+ return new ColorBuilder();+ }++ private _context: DocContext;++ /**+ * get DocContext+ */+ get context() {+ return this._context;+ }++ /**+ * install plugin+ *+ * @param plugin - install plugin+ */+ installPlugin(plugin: Plugin): void {+ this._context.getPluginManager().install(plugin);+ }++ /**+ * uninstall plugin+ *+ * @param name - plugin name+ */+ uninstallPlugin(name: string): void {+ this._context.getPluginManager().uninstall(name);+ }+}diff --git a/packages/core/src/Basics/index.ts b/packages/core/src/Basics/index.tsindex 1bf67c1230..fa895a00de 100644--- a/packages/core/src/Basics/index.ts+++ b/packages/core/src/Basics/index.ts@@ -1,7 +1,10 @@// @index('./*.ts', f => `export * from '${f.path}'`)+export * from './ContextBase';+export * from './DocContext';export * from './Environment';export * from './Registry';export * from './SheetContext';+export * from './UniverDoc';export * from './UniverSheet';export * from './Version';export * from './WorkBookObserver';diff --git a/packages/core/src/Interfaces/IDocumentData.ts b/packages/core/src/Interfaces/IDocumentData.tsindex 8217731af9..704fbfdc0a 100644--- a/packages/core/src/Interfaces/IDocumentData.ts+++ b/packages/core/src/Interfaces/IDocumentData.ts@@ -2,6 +2,7 @@ import { IColorStyle, IStyleBase } from '.';import {BooleanNumber,HorizontalAlign,+ LocaleType,TextDirection,VerticalAlign,WrapStrategy,@@ -13,6 +14,7 @@ import {*/export interface IDocumentData extends IReferenceSource {documentId: string;+ locale?: LocaleType;title?: string;body?: IDocumentBody;documentStyle: IDocumentStyle;