Skip to content

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

feat(base-slides): add base-slides plugin template

Dushusir0c81a8926030
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 6c91e68911..3c6ccbec16 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -56,7 +56,9 @@
"SUMIF",
"Tahoma",
"univer",
+ "univerdoc",
"universheet",
+ "universlide",
"Unmerge",
"Verdana",
"viewports",
diff --git a/package.json b/package.json
index 87a92d3f52..ac7f7b032c 100644
--- a/package.json
+++ b/package.json
@@ -9,6 +9,7 @@
"test:e2e": "pnpm run --filter @univer/base-sheets test:play",
"dev": "node scripts/dev",
"dev:doc": "pnpm run --filter @univer/base-docs dev",
+ "dev:slide": "pnpm run --filter @univer/base-slides dev",
"api": "node scripts/api",
"lighthouse-dev": "start /B node scripts/dev && lighthouse http://127.0.0.1:3103 --output html --output-path ./report.html",
"build": "node scripts/build.js",
diff --git a/packages/base-slides/.eslintrc.js b/packages/base-slides/.eslintrc.js
new file mode 100644
index 0000000000..7f4cf3e7ba
--- /dev/null
+++ b/packages/base-slides/.eslintrc.js
@@ -0,0 +1,51 @@
+module.exports = {
+ env: {
+ browser: true,
+ es2021: true,
+ node: true,
+ },
+ parser: '@typescript-eslint/parser',
+ extends: [
+ 'airbnb-typescript',
+ 'prettier',
+ 'eslint:recommended',
+ 'plugin:import/recommended',
+ 'plugin:import/typescript',
+ ],
+ parserOptions: {
+ ecmaVersion: 12,
+ sourceType: 'module',
+ project: './tsconfig.json',
+ },
+ plugins: ['@typescript-eslint', 'prettier', 'import'],
+ rules: {
+ 'prettier/prettier': [
+ 'error',
+ {
+ endOfLine: 'auto',
+ },
+ ],
+ 'import/prefer-default-export': 'off',
+ 'import/no-extraneous-dependencies': [
+ 'error',
+ { devDependencies: true },
+ ],
+ // turn on errors for missing imports
+ 'import/no-unresolved': 'error',
+ },
+ settings: {
+ 'import/parsers': {
+ '@typescript-eslint/parser': ['.ts', '.tsx'],
+ },
+ 'import/resolver': {
+ typescript: {
+ alwaysTryTypes: true, // always try to resolve config under `<root>@config` directory even it doesn't contain any source code, like `@config/unist`
+
+ // Choose from one of the "project" configs below or omit to use <root>/tsconfig.json by default
+
+ // use <root>/path/to/folder/tsconfig.json
+ project: './tsconfig.json',
+ },
+ },
+ },
+};
diff --git a/packages/base-slides/.gitignore b/packages/base-slides/.gitignore
new file mode 100644
index 0000000000..12e1bd6bec
--- /dev/null
+++ b/packages/base-slides/.gitignore
@@ -0,0 +1,101 @@
+#ide
+*.DS_Store
+.idea
+.vscode
+
+#npm
+package-lock.json
+
+dist
+lib
+docs/.vuepress/dist
+
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+lerna-debug.log*
+
+# Runtime config
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+
+# nyc test coverage
+.nyc_output
+
+# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# Bower dependency directory (https://bower.io/)
+bower_components
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (https://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directories
+node_modules
+jspm_packages/
+
+# TypeScript v1 declaration files
+typings/
+
+# Optional npm cache directory
+.npm
+
+# Optional eslint cache
+.eslintcache
+
+# Optional REPL History
+.node_repl_history
+
+# Output of 'npm pack'
+*.tgz
+
+# Yarn Integrity file
+.yarn-integrity
+
+# dotenv environment variables file
+.env
+
+# next.js build output
+.next
+
+#lerna-changelog
+.changelog
+
+
+#editor workspace file
+.idea/
+
+
+.DS_Store
+
+.history
+# examples
+
+
+# Production
+/build
+
+# Generated files
+.docusaurus
+.cache-loader
+
+# Misc
+.env.local
+.env.development.local
+.env.test.local
+.env.production.local
diff --git a/packages/base-slides/.prettierrc.cjs b/packages/base-slides/.prettierrc.cjs
new file mode 100644
index 0000000000..6604107223
--- /dev/null
+++ b/packages/base-slides/.prettierrc.cjs
@@ -0,0 +1,7 @@
+module.exports = {
+ singleQuote: true,
+ trailingComma: 'es5',
+ tabWidth: 4,
+ semi: true,
+ printWidth: 180,
+};
diff --git a/packages/base-slides/README-zh.md b/packages/base-slides/README-zh.md
new file mode 100644
index 0000000000..099744f6f6
--- /dev/null
+++ b/packages/base-slides/README-zh.md
@@ -0,0 +1,55 @@
+# style-universheet
+
+简体中文 | [English](./README.md)
+
+## 介绍
+
+UniverSheet Slides插件
+
+### 安装
+
+```bash
+npm i @univer/base-slides
+```
+
+### 使用
+
+```js
+impport {Slides} from '@univer/base-slides'
+
+const univerSheet = new UniverSheet();
+univerSheet.installPlugin(new Slides());
+```
+
+## 本地开发
+
+### 环境
+
+- [Node.js](https://nodejs.org/en/) Version >= 10
+- [npm](https://www.npmjs.com/) Version >= 6
+
+### 安装
+
+```
+pnpm install
+```
+
+### 开发
+
+```
+# 当前目录 ./packages/base-slides/
+npm run dev
+
+# 或者项目根目录 ./
+pnpm run --filter @univer/base-slides dev
+```
+
+### 打包
+
+```
+# 当前目录 ./packages/base-slides/
+npm run build
+
+# 或者根目录 ./
+pnpm run --filter @univer/base-slides build
+```
diff --git a/packages/base-slides/README.md b/packages/base-slides/README.md
new file mode 100644
index 0000000000..d75ab26f93
--- /dev/null
+++ b/packages/base-slides/README.md
@@ -0,0 +1,55 @@
+# style-universheet
+
+English| [简体中文](./README-zh.md)
+
+## Introduction
+
+UniverSheet Plugin Slides
+
+### Installation
+
+```bash
+npm i @univer/base-slides
+```
+
+### Usage
+
+```js
+impport {Slides} from '@univer/base-slides'
+
+const univerSheet = new UniverSheet();
+univerSheet.installPlugin(new Slides());
+```
+
+## Local development
+
+### Requirements
+
+- [Node.js](https://nodejs.org/en/) Version >= 10
+- [npm](https://www.npmjs.com/) Version >= 6
+
+### Installation
+
+```
+pnpm install
+```
+
+### Development
+
+```
+# Current directory ./packages/base-slides/
+npm run dev
+
+# Or project root directory ./
+pnpm run --filter @univer/base-slides dev
+```
+
+### Package
+
+```
+# Current directory ./packages/base-slides/
+npm run build
+
+# Or root directory ./
+pnpm run --filter @univer/base-slides build
+```
diff --git a/packages/base-slides/index.html b/packages/base-slides/index.html
new file mode 100644
index 0000000000..d0eb03769e
--- /dev/null
+++ b/packages/base-slides/index.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+ <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>
+ <style>
+ html,
+ body {
+ height: 100%;
+ margin: 0;
+ }
+ </style>
+</head>
+
+<body>
+ <div id="app"></div>
+ <div id="universlide" style="height: 100%;"></div>
+ <script type="module" src="/src/main.tsx"></script>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/packages/base-slides/jest.config.js b/packages/base-slides/jest.config.js
new file mode 100644
index 0000000000..73ef4bae42
--- /dev/null
+++ b/packages/base-slides/jest.config.js
@@ -0,0 +1,18 @@
+/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
+module.exports = {
+ preset: 'ts-jest',
+ testEnvironment: 'jsdom',
+ moduleFileExtensions: ['js', 'ts', 'tsx'],
+
+ roots: ['<rootDir>/src'],
+ testMatch: ['**/__tests__/**/*.+(ts|tsx|js)', '**/?(*.)+(spec|test).+(ts|tsx|js)'],
+ transform: {
+ '^.+\\.(ts|tsx)$': 'ts-jest',
+ '^.+\\.tsx?$': 'babel-jest', // https://github.com/kulshekhar/ts-jest/issues/937#issuecomment-455431207
+ },
+ globals: {
+ 'ts-jest': {
+ tsConfig: 'tsconfig.test.json',
+ },
+ },
+};
diff --git a/packages/base-slides/package.json b/packages/base-slides/package.json
new file mode 100644
index 0000000000..0b6025c381
--- /dev/null
+++ b/packages/base-slides/package.json
@@ -0,0 +1,60 @@
+{
+ "name": "@univer/base-slides",
+ "version": "0.0.1",
+ "description": "UniverSheet normal base-slides",
+ "keywords": [],
+ "author": "DreamNum <[email protected]>",
+ "license": "MIT",
+ "main": "./src/index.ts",
+ "module": "./src/index.ts",
+ "types": "./src/Types/index.d.ts",
+ "exports": {
+ ".": "./src/index.ts",
+ "./*": "./src/*"
+ },
+ "publishConfig": {
+ "main": "./lib/index.umd.js",
+ "module": "./lib/index.es.js",
+ "types": "./lib/index.d.ts"
+ },
+ "directories": {
+ "lib": "lib"
+ },
+ "scripts": {
+ "test": "jest",
+ "dev": "vite",
+ "build": "tsc && vite build",
+ "serve": "vite preview"
+ },
+ "devDependencies": {
+ "@preact/preset-vite": "2.0.0",
+ "@testing-library/preact": "^2.0.1",
+ "@types/jest": "^27.0.1",
+ "@types/node": "^16.4.6",
+ "@vitejs/plugin-legacy": "^1.5.1",
+ "eslint": "^8.22.0",
+ "eslint-config-airbnb-typescript": "^17.0.0",
+ "eslint-config-prettier": "^8.3.0",
+ "eslint-plugin-import": "^2.23.4",
+ "eslint-plugin-prettier": "^3.4.0",
+ "eslint-plugin-jsx-a11y": "^6.5.1",
+ "eslint-plugin-react": "^7.28.0",
+ "eslint-plugin-react-hooks": "^4.3.0",
+ "less": "^4.1.1",
+ "prettier": "^2.3.2",
+ "ts-jest": "29.0.1",
+ "ts-node": "^10.2.1",
+ "typescript": "^4.4.1-rc",
+ "vite": "^2.4.4"
+ },
+ "dependencies": {
+ "@univer/base-component": "workspace:^0.0.1",
+ "@univer/base-render": "workspace:^0.0.1",
+ "@univer/core": "workspace:^0.0.1",
+ "@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-slides/src/Basic/Const/PLUGIN_NAME.ts b/packages/base-slides/src/Basic/Const/PLUGIN_NAME.ts
new file mode 100644
index 0000000000..aecdecac81
--- /dev/null
+++ b/packages/base-slides/src/Basic/Const/PLUGIN_NAME.ts
@@ -0,0 +1 @@
+export const SLIDES_PLUGIN_NAME = 'slides';
diff --git a/packages/base-slides/src/Basic/Const/index.ts b/packages/base-slides/src/Basic/Const/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/base-slides/src/Basic/Enum/index.ts b/packages/base-slides/src/Basic/Enum/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/base-slides/src/Basic/Observer.ts b/packages/base-slides/src/Basic/Observer.ts
new file mode 100644
index 0000000000..77df6631e4
--- /dev/null
+++ b/packages/base-slides/src/Basic/Observer.ts
@@ -0,0 +1,90 @@
+import { IKeyboardEvent } from '@univer/base-render';
+import { Observable, Plugin } from '@univer/core';
+import { SlideContainer } from '../View/UI/SlideContainer';
+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>;
+
+ onSlideContainerDidMountObservable: Observable<SlideContainer>;
+
+ 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('onSlideContainerDidMountObservable');
+ 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('onSlideContainerDidMountObservable');
+ 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-slides/src/Basic/Shared/index.ts b/packages/base-slides/src/Basic/Shared/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/base-slides/src/Basic/index.ts b/packages/base-slides/src/Basic/index.ts
new file mode 100644
index 0000000000..640d1bb8b3
--- /dev/null
+++ b/packages/base-slides/src/Basic/index.ts
@@ -0,0 +1,4 @@
+export * from './Const';
+export * from './Enum';
+export * from '../Locale';
+export * from './Shared';
diff --git a/packages/base-slides/src/Controller/InfoBarController.ts b/packages/base-slides/src/Controller/InfoBarController.ts
new file mode 100644
index 0000000000..000b673fed
--- /dev/null
+++ b/packages/base-slides/src/Controller/InfoBarController.ts
@@ -0,0 +1,77 @@
+import { PLUGIN_NAMES } from '@univer/core';
+import { InfoBarModel } from '../Model/InfoBarModel';
+import { SlidePlugin } from '../SlidePlugin';
+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: SlidePlugin;
+
+ private _infoList: BaseInfoBarProps;
+
+ constructor(plugin: SlidePlugin) {
+ this._plugin = plugin;
+ this._infoList = {
+ back: {
+ locale: 'info.return',
+ },
+ update: {
+ locale: 'info.detailUpdate',
+ },
+ save: {
+ locale: 'info.detailSave',
+ },
+ rename: {
+ locale: 'info.tips',
+ },
+ sheet: {
+ label: 'UniverSlide Demo',
+ onBlur: this.setSlideName,
+ },
+ };
+ this._initialize();
+ }
+
+ private _initialize() {
+ const context = this._plugin.context;
+ const manager = context.getObserverManager();
+
+ manager.requiredObserver<InfoBar>('onInfoBarDidMountObservable', PLUGIN_NAMES.SLIDE).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);
+ }
+
+ setSlideName(e: FocusEvent) {
+ const target = e.target as HTMLInputElement;
+ const name = target.value;
+ this._infoBarModel.setName(name);
+ }
+}
diff --git a/packages/base-slides/src/Controller/SlideContainerController.ts b/packages/base-slides/src/Controller/SlideContainerController.ts
new file mode 100644
index 0000000000..8f0000e601
--- /dev/null
+++ b/packages/base-slides/src/Controller/SlideContainerController.ts
@@ -0,0 +1,14 @@
+import { BooleanNumber, CommandManager } from '@univer/core';
+import { SlidePlugin } from '../SlidePlugin';
+
+export class SlideContainerController {
+ private _plugin: SlidePlugin;
+
+ constructor(plugin: SlidePlugin) {
+ this._plugin = plugin;
+
+ this._initialize();
+ }
+
+ private _initialize() {}
+}
diff --git a/packages/base-slides/src/Controller/ToolBarController.ts b/packages/base-slides/src/Controller/ToolBarController.ts
new file mode 100644
index 0000000000..00f8d7acf3
--- /dev/null
+++ b/packages/base-slides/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 { SlidePlugin } from '../SlidePlugin';
+import { defaultLayout, ILayout } from '../View/UI/SlideContainer';
+
+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: SlidePlugin;
+
+ private _toolBarComponent: ToolBar;
+
+ private _toolList: IToolBarItemProps[];
+
+ private _lineColor: LineColor;
+
+ Render: BaseComponentRender;
+
+ private _borderInfo: BorderInfo; //存储边框信息
+
+ constructor(plugin: SlidePlugin) {
+ 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-slides/src/Controller/index.ts b/packages/base-slides/src/Controller/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/base-slides/src/Locale/en.ts b/packages/base-slides/src/Locale/en.ts
new file mode 100644
index 0000000000..6741a7f58d
--- /dev/null
+++ b/packages/base-slides/src/Locale/en.ts
@@ -0,0 +1,513 @@
+export default {
+ 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-slides/src/Locale/index.ts b/packages/base-slides/src/Locale/index.ts
new file mode 100644
index 0000000000..3ac4bcd0fd
--- /dev/null
+++ b/packages/base-slides/src/Locale/index.ts
@@ -0,0 +1,4 @@
+import zh from './zh';
+import en from './en';
+
+export { zh, en };
diff --git a/packages/base-slides/src/Locale/zh.ts b/packages/base-slides/src/Locale/zh.ts
new file mode 100644
index 0000000000..867e8315e7
--- /dev/null
+++ b/packages/base-slides/src/Locale/zh.ts
@@ -0,0 +1,376 @@
+export default {
+ 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-slides/src/Model/InfoBarModel.ts b/packages/base-slides/src/Model/InfoBarModel.ts
new file mode 100644
index 0000000000..ebe1531d49
--- /dev/null
+++ b/packages/base-slides/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-slides/src/Model/ToolBarModel.ts b/packages/base-slides/src/Model/ToolBarModel.ts
new file mode 100644
index 0000000000..c566e1db58
--- /dev/null
+++ b/packages/base-slides/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-slides/src/Model/index.ts b/packages/base-slides/src/Model/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/base-slides/src/Service/index.ts b/packages/base-slides/src/Service/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/base-slides/src/SlidePlugin.tsx b/packages/base-slides/src/SlidePlugin.tsx
new file mode 100644
index 0000000000..c84adaa711
--- /dev/null
+++ b/packages/base-slides/src/SlidePlugin.tsx
@@ -0,0 +1,191 @@
+import { SlideContext, Plugin, PLUGIN_NAMES, UniverSheet, Tools, AsyncFunction } from '@univer/core';
+import { getRefElement, isElement, ISlotProps, RefObject, render } from '@univer/base-component';
+import { Engine, RenderEngine } from '@univer/base-render';
+import { zh, en } from './Locale';
+import { install } from './Basic/Observer';
+import { ToolBarController } from './Controller/ToolBarController';
+import { SlideContainerController } from './Controller/SlideContainerController';
+import { BaseSlideContainerConfig, SlideContainer, ISlidePluginConfigBase } from './View/UI/SlideContainer';
+import { InfoBarController } from './Controller/InfoBarController';
+
+export interface ISlidePluginConfig extends ISlidePluginConfigBase {
+ container: HTMLElement | string;
+}
+
+const DEFAULT_SLIDE_PLUGIN_DATA = {
+ container: 'universlide',
+ layout: 'auto',
+};
+
+export class SlidePlugin extends Plugin {
+ private _config: ISlidePluginConfig;
+
+ 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 _slideContainerController: SlideContainerController;
+
+ private _componentList: Map<string, any>;
+
+ constructor(config: Partial<ISlidePluginConfig> = {}) {
+ super(PLUGIN_NAMES.SLIDE);
+
+ this._config = Tools.commonExtend(DEFAULT_SLIDE_PLUGIN_DATA, config);
+ }
+
+ static create(config?: ISlidePluginConfig) {
+ return new SlidePlugin(config);
+ }
+
+ installTo(universheetInstance: UniverSheet) {
+ universheetInstance.installPlugin(this);
+ }
+
+ initialize(): void {
+ const context = this.getContext();
+
+ this.getObserver('onSlideContainerDidMountObservable')?.add(() => {
+ this._initializeRender(context);
+ });
+
+ /**
+ * load more Locale object
+ */
+ context.getLocale().load({
+ en,
+ zh,
+ });
+
+ this._componentList = new Map();
+
+ this._toolBarControl = new ToolBarController(this);
+ this._infoBarControl = new InfoBarController(this);
+ this._slideContainerController = new SlideContainerController(this);
+
+ const slideContainer = this._initContainer(this._config.container);
+
+ const config: BaseSlideContainerConfig = {
+ skin: 'default',
+ layout: this._config.layout,
+ container: slideContainer,
+ 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(<SlideContainer config={config} />, slideContainer);
+ }
+
+ /**
+ * Convert id to DOM
+ * @param container
+ * @returns
+ */
+ private _initContainer(container: HTMLElement | string) {
+ let slideContainer = null;
+ if (typeof container === 'string') {
+ const containerDOM = document.getElementById(container);
+ if (containerDOM == null) {
+ slideContainer = document.createElement('div');
+ SlideContainer.id = container;
+ } else {
+ slideContainer = containerDOM;
+ }
+ } else if (isElement(container)) {
+ slideContainer = container;
+ } else {
+ slideContainer = document.createElement('div');
+ SlideContainer.id = 'univerdoc';
+ }
+
+ return slideContainer;
+ }
+
+ private _initializeRender(context: SlideContext) {
+ 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: SlideContext): 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-slides/src/Types/index.d.ts b/packages/base-slides/src/Types/index.d.ts
new file mode 100644
index 0000000000..62545c537f
--- /dev/null
+++ b/packages/base-slides/src/Types/index.d.ts
@@ -0,0 +1,12 @@
+/// <reference types="vite/client" />
+
+export * from '../index';
+declare module '@univer/base-slides' {}
+
+import JSX = preact.JSX;
+
+// use css module
+declare module '*.less' {
+ const resource: { [key: string]: string };
+ export = resource;
+}
diff --git a/packages/base-slides/src/View/Render/index.ts b/packages/base-slides/src/View/Render/index.ts
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/base-slides/src/View/UI/Common/Item/Item.tsx b/packages/base-slides/src/View/UI/Common/Item/Item.tsx
new file mode 100644
index 0000000000..452f01885e
--- /dev/null
+++ b/packages/base-slides/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-slides/src/View/UI/Common/Item/index.module.less b/packages/base-slides/src/View/UI/Common/Item/index.module.less
new file mode 100644
index 0000000000..4af2d58556
--- /dev/null
+++ b/packages/base-slides/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 file
diff --git a/packages/base-slides/src/View/UI/Common/Line/LineBold.tsx b/packages/base-slides/src/View/UI/Common/Line/LineBold.tsx
new file mode 100644
index 0000000000..47b64cbe43
--- /dev/null
+++ b/packages/base-slides/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-slides/src/View/UI/Common/Line/LineColor.tsx b/packages/base-slides/src/View/UI/Common/Line/LineColor.tsx
new file mode 100644
index 0000000000..8f792010f8
--- /dev/null
+++ b/packages/base-slides/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-slides/src/View/UI/Common/Select/Select.tsx b/packages/base-slides/src/View/UI/Common/Select/Select.tsx
new file mode 100644
index 0000000000..757013107d
--- /dev/null
+++ b/packages/base-slides/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-slides/src/View/UI/Common/Select/index.module.less b/packages/base-slides/src/View/UI/Common/Select/index.module.less
new file mode 100644
index 0000000000..6be9bc3c43
--- /dev/null
+++ b/packages/base-slides/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 file
diff --git a/packages/base-slides/src/View/UI/Common/TextButton/TextButton.tsx b/packages/base-slides/src/View/UI/Common/TextButton/TextButton.tsx
new file mode 100644
index 0000000000..9c2d9bf6ea
--- /dev/null
+++ b/packages/base-slides/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-slides/src/View/UI/Common/TextButton/index.module.css b/packages/base-slides/src/View/UI/Common/TextButton/index.module.css
new file mode 100644
index 0000000000..4fb4faa3e5
--- /dev/null
+++ b/packages/base-slides/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-slides/src/View/UI/Common/TextButton/index.module.less b/packages/base-slides/src/View/UI/Common/TextButton/index.module.less
new file mode 100644
index 0000000000..305b85ad5c
--- /dev/null
+++ b/packages/base-slides/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 file
diff --git a/packages/base-slides/src/View/UI/Common/index.ts b/packages/base-slides/src/View/UI/Common/index.ts
new file mode 100644
index 0000000000..cd8440b5fb
--- /dev/null
+++ b/packages/base-slides/src/View/UI/Common/index.ts
@@ -0,0 +1 @@
+// Basic business components
diff --git a/packages/base-slides/src/View/UI/InfoBar/InfoBar.tsx b/packages/base-slides/src/View/UI/InfoBar/InfoBar.tsx
new file mode 100644
index 0000000000..8938a6580f
--- /dev/null
+++ b/packages/base-slides/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.SLIDE)?.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-slides/src/View/UI/InfoBar/index.less b/packages/base-slides/src/View/UI/InfoBar/index.less
new file mode 100644
index 0000000000..59113a5d75
--- /dev/null
+++ b/packages/base-slides/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-slides/src/View/UI/InfoBar/index.ts b/packages/base-slides/src/View/UI/InfoBar/index.ts
new file mode 100644
index 0000000000..345955a1ce
--- /dev/null
+++ b/packages/base-slides/src/View/UI/InfoBar/index.ts
@@ -0,0 +1 @@
+export * from './InfoBar';
diff --git a/packages/base-slides/src/View/UI/InfoBar/infobar-zh.md b/packages/base-slides/src/View/UI/InfoBar/infobar-zh.md
new file mode 100644
index 0000000000..89972db6ef
--- /dev/null
+++ b/packages/base-slides/src/View/UI/InfoBar/infobar-zh.md
@@ -0,0 +1,10 @@
+---
+category: Components
+type: 通用
+title: InfoBar
+cover: ''
+---
+
+## 介绍
+
+最顶部的栏目,包含 logo/项目名
diff --git a/packages/base-slides/src/View/UI/SlideContainer/SlideContainer.tsx b/packages/base-slides/src/View/UI/SlideContainer/SlideContainer.tsx
new file mode 100644
index 0000000000..555f1f257d
--- /dev/null
+++ b/packages/base-slides/src/View/UI/SlideContainer/SlideContainer.tsx
@@ -0,0 +1,768 @@
+import {
+ AppContext,
+ IMainProps,
+ IMainState,
+ ISiderState,
+ ISlotElement,
+ ISlotProps,
+ Component,
+ BaseComponentSheet,
+ BaseComponentRender,
+ createRef,
+ RefObject,
+ cloneElement,
+ BaseComponentProps,
+ Description,
+} from '@univer/base-component';
+import { AsyncFunction, SlideContext, 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 { SlidePlugin } from '../../../SlidePlugin';
+import { InfoBar } from '../InfoBar';
+
+export interface ISlidePluginConfigBase {
+ 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 ISlidePluginConfigBase {
+ layout: string | ILayout;
+}
+
+export interface BaseSlideContainerConfig extends BaseComponentProps, ISlidePluginConfigBase {
+ container: HTMLElement;
+ skin: string;
+ context: SlideContext;
+ 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 BaseSlideContainerProps {
+ config: BaseSlideContainerConfig;
+}
+
+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,
+};
+
+/**
+ * SlideContainer
+ */
+
+// 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 SlideContainer extends Component<BaseSlideContainerProps, 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: BaseSlideContainerProps) {
+ 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<SlidePlugin>(PLUGIN_NAMES.SLIDE)
+ .getObserver('onSlideContainerDidMountObservable')
+ ?.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',
+ background: 'lightgray',
+ }}
+ >
+ 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-slides/src/View/UI/SlideContainer/index.module.less b/packages/base-slides/src/View/UI/SlideContainer/index.module.less
new file mode 100644
index 0000000000..036457241b
--- /dev/null
+++ b/packages/base-slides/src/View/UI/SlideContainer/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-slides/src/View/UI/SlideContainer/index.ts b/packages/base-slides/src/View/UI/SlideContainer/index.ts
new file mode 100644
index 0000000000..9cee177d14
--- /dev/null
+++ b/packages/base-slides/src/View/UI/SlideContainer/index.ts
@@ -0,0 +1 @@
+export * from './SlideContainer';
diff --git a/packages/base-slides/src/View/UI/ToolBar/Const.ts b/packages/base-slides/src/View/UI/ToolBar/Const.ts
new file mode 100644
index 0000000000..1701d084f8
--- /dev/null
+++ b/packages/base-slides/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-slides/src/View/UI/ToolBar/DataBar.tsx b/packages/base-slides/src/View/UI/ToolBar/DataBar.tsx
new file mode 100644
index 0000000000..f0f4350aa8
--- /dev/null
+++ b/packages/base-slides/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-slides/src/View/UI/ToolBar/SingleButton.tsx b/packages/base-slides/src/View/UI/ToolBar/SingleButton.tsx
new file mode 100644
index 0000000000..689c0c51dd
--- /dev/null
+++ b/packages/base-slides/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-slides/src/View/UI/ToolBar/ToolBar-zh.md b/packages/base-slides/src/View/UI/ToolBar/ToolBar-zh.md
new file mode 100644
index 0000000000..ffba806bfe
--- /dev/null
+++ b/packages/base-slides/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/base-slides/src/View/UI/ToolBar/ToolBar.md b/packages/base-slides/src/View/UI/ToolBar/ToolBar.md
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/base-slides/src/View/UI/ToolBar/ToolBar.tsx b/packages/base-slides/src/View/UI/ToolBar/ToolBar.tsx
new file mode 100644
index 0000000000..a55812c91b
--- /dev/null
+++ b/packages/base-slides/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 { SlidePlugin } from '../../../SlidePlugin';
+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<SlidePlugin>(PLUGIN_NAMES.SLIDE);
+
+ 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-slides/src/View/UI/ToolBar/index.less b/packages/base-slides/src/View/UI/ToolBar/index.less
new file mode 100644
index 0000000000..3302e5aa4f
--- /dev/null
+++ b/packages/base-slides/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-slides/src/View/UI/ToolBar/index.module.less b/packages/base-slides/src/View/UI/ToolBar/index.module.less
new file mode 100644
index 0000000000..4847d87beb
--- /dev/null
+++ b/packages/base-slides/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 file
diff --git a/packages/base-slides/src/View/UI/ToolBar/index.ts b/packages/base-slides/src/View/UI/ToolBar/index.ts
new file mode 100644
index 0000000000..a6b74775e1
--- /dev/null
+++ b/packages/base-slides/src/View/UI/ToolBar/index.ts
@@ -0,0 +1,2 @@
+export * from './ToolBar';
+export * from './SingleButton';
diff --git a/packages/base-slides/src/index.ts b/packages/base-slides/src/index.ts
new file mode 100644
index 0000000000..906fcfff62
--- /dev/null
+++ b/packages/base-slides/src/index.ts
@@ -0,0 +1,3 @@
+import { SlidePlugin } from './SlidePlugin';
+
+export { SlidePlugin };
diff --git a/packages/base-slides/src/main.tsx b/packages/base-slides/src/main.tsx
new file mode 100644
index 0000000000..817b49326b
--- /dev/null
+++ b/packages/base-slides/src/main.tsx
@@ -0,0 +1,17 @@
+import { UniverSlide } from '@univer/core';
+import { RenderEngine } from '@univer/base-render';
+import { UniverComponentSheet } from '@univer/style-universheet';
+import { SlidePlugin } from './SlidePlugin';
+
+const slidePluginConfig = {
+ container: 'universlide',
+ layout: {
+ innerLeft: true,
+ },
+};
+const univerSlideUp = UniverSlide.newInstance();
+
+univerSlideUp.installPlugin(new RenderEngine());
+univerSlideUp.installPlugin(new UniverComponentSheet());
+
+univerSlideUp.installPlugin(new SlidePlugin(slidePluginConfig));
diff --git a/packages/base-slides/src/preact.d.ts b/packages/base-slides/src/preact.d.ts
new file mode 100644
index 0000000000..0d9c32b84c
--- /dev/null
+++ b/packages/base-slides/src/preact.d.ts
@@ -0,0 +1 @@
+import JSX = preact.JSX;
diff --git a/packages/base-slides/tsconfig.json b/packages/base-slides/tsconfig.json
new file mode 100644
index 0000000000..fc81cbd47e
--- /dev/null
+++ b/packages/base-slides/tsconfig.json
@@ -0,0 +1,31 @@
+{
+ "compilerOptions": {
+ "rootDir": "./",
+ "outDir": "lib",
+ "target": "ESNext",
+
+ "lib": ["ESNext", "DOM", "WebWorker"],
+ "module": "ESNext",
+ "moduleResolution": "Node", //This value is needed for Node.js.
+
+ "declaration": true,
+ "declarationDir": "./lib",
+ "declarationMap": true,
+ "sourceMap": true,
+ "resolveJsonModule": true,
+ "strict": true,
+ "allowJs": true,
+
+ "baseUrl": "./",
+ "skipLibCheck": true,
+ "esModuleInterop": true, // auto allowSyntheticDefaultImports tru
+ "suppressImplicitAnyIndexErrors": true,
+ "experimentalDecorators": true,
+ "jsx": "preserve",
+ "jsxFactory": "h",
+ "jsxFragmentFactory": "Fragment",
+ "strictPropertyInitialization": false,
+ "types": ["jest", "node", "@types/jest"]
+ },
+ "include": ["src/**/*", "test/**/*.test.(ts|tsx|js)"]
+}
diff --git a/packages/base-slides/tsconfig.ref.json b/packages/base-slides/tsconfig.ref.json
new file mode 100644
index 0000000000..0c86b2c554
--- /dev/null
+++ b/packages/base-slides/tsconfig.ref.json
@@ -0,0 +1,7 @@
+{
+ "extends": "./tsconfig.json",
+ "include": ["src/**/*"],
+ "compilerOptions": {
+ "composite": true
+ }
+}
diff --git a/packages/base-slides/tsconfig.test.json b/packages/base-slides/tsconfig.test.json
new file mode 100644
index 0000000000..a2ac02c4ae
--- /dev/null
+++ b/packages/base-slides/tsconfig.test.json
@@ -0,0 +1,7 @@
+{
+ "extends": "./tsconfig.json",
+ "compilerOptions": {
+ "jsx": "react-jsx",
+ "jsxImportSource": "preact"
+ }
+}
diff --git a/packages/base-slides/vite.config.ts b/packages/base-slides/vite.config.ts
new file mode 100644
index 0000000000..020ecd6209
--- /dev/null
+++ b/packages/base-slides/vite.config.ts
@@ -0,0 +1,44 @@
+import { defineConfig } from 'vite';
+import path from 'path';
+import preact from '@preact/preset-vite';
+import legacy from '@vitejs/plugin-legacy';
+import { name, version } from './package.json';
+
+const resolve = (url: string) => path.resolve(__dirname, url);
+
+export default defineConfig({
+ build: {
+ // lib: {
+ // entry: resolve('src/index.ts'),
+ // name: 'BaseStyleUniver',
+ // formats: ['es', 'umd'],
+ // fileName: 'index',
+ // },
+ // outDir: './lib',
+ },
+ define: {
+ pkgJson: { name, version },
+ },
+ css: {
+ modules: {
+ localsConvention: 'camelCaseOnly', // dash to camelCase conversion// .apply-color -> applyColor
+ generateScopedName: 'univer-[local]', // custom prefix class name
+ },
+ preprocessorOptions: {
+ less: {
+ javascriptEnabled: true,
+ },
+ },
+ },
+ server: {
+ port: 3103,
+ open: true, // Automatically open the app in the browser on server start.
+ },
+ plugins: [
+ preact(),
+ legacy({
+ targets: ['ie >= 11'],
+ additionalLegacyPolyfills: ['regenerator-runtime/runtime'],
+ }),
+ ],
+});
diff --git a/packages/core/src/Basics/DocContext.ts b/packages/core/src/Basics/DocContext.ts
index 39a71e391a..e3735e6d98 100644
--- a/packages/core/src/Basics/DocContext.ts
+++ b/packages/core/src/Basics/DocContext.ts
@@ -1,13 +1,10 @@
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);
diff --git a/packages/core/src/Basics/SlideContext.ts b/packages/core/src/Basics/SlideContext.ts
new file mode 100644
index 0000000000..5c613a892e
--- /dev/null
+++ b/packages/core/src/Basics/SlideContext.ts
@@ -0,0 +1,14 @@
+import { ISlideData } from '../Interfaces/ISlideData';
+import { ContextBase } from './ContextBase';
+
+/**
+ * Core context, mount important instances, managers
+ */
+export class SlideContext extends ContextBase {
+ constructor(univerSlideData: Partial<ISlideData> = {}) {
+ super();
+ this._locale.initialize(univerSlideData.locale);
+ }
+
+ protected _setObserver(): void {}
+}
diff --git a/packages/core/src/Basics/UniverSlide.ts b/packages/core/src/Basics/UniverSlide.ts
new file mode 100644
index 0000000000..a2844197d5
--- /dev/null
+++ b/packages/core/src/Basics/UniverSlide.ts
@@ -0,0 +1,75 @@
+import { ISlideData } from '../Interfaces';
+import { Plugin } from '../Plugin';
+import { IOHttp, IOHttpConfig, Logger } from '../Shared';
+import { SlideContext } from './SlideContext';
+import { VersionCode, VersionEnv } from './Version';
+import { ColorBuilder } from '../Sheets/Domain/ColorBuilder';
+
+/**
+ * Externally provided UniverSlide root instance
+ */
+export class UniverSlide {
+ UniverSlideConfig: Partial<ISlideData>;
+
+ constructor(UniverSlideData: Partial<ISlideData> = {}) {
+ this.UniverSlideConfig = UniverSlideData;
+ this._context = new SlideContext(UniverSlideData);
+ }
+
+ static newInstance(UniverSlideData: Partial<ISlideData> = {}): UniverSlide {
+ Logger.capsule(VersionEnv, VersionCode, 'powered by :: UniverSlide :: ');
+ return new UniverSlide(UniverSlideData);
+ }
+
+ /**
+ *
+ * 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: SlideContext;
+
+ /**
+ * get SlideContext
+ */
+ 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.ts
index fa895a00de..859ffd53de 100644
--- a/packages/core/src/Basics/index.ts
+++ b/packages/core/src/Basics/index.ts
@@ -4,8 +4,10 @@ export * from './DocContext';
export * from './Environment';
export * from './Registry';
export * from './SheetContext';
+export * from './SlideContext';
export * from './UniverDoc';
export * from './UniverSheet';
+export * from './UniverSlide';
export * from './Version';
export * from './WorkBookObserver';
export * from './WorkBookObserverImpl';
diff --git a/packages/core/src/Command/SheetAction.ts b/packages/core/src/Command/SheetAction.ts
index 68f36c0328..b1b80a5388 100644
--- a/packages/core/src/Command/SheetAction.ts
+++ b/packages/core/src/Command/SheetAction.ts
@@ -13,6 +13,7 @@ export interface ISheetActionData extends IActionData {
/**
* Basics class for action
*
+ * TODO: SlideAction/DocAction
* @beta
*/
export abstract class SheetAction<
diff --git a/packages/core/src/Command/SheetCommand.ts b/packages/core/src/Command/SheetCommand.ts
index 6ce177eaad..e545cbe2bd 100644
--- a/packages/core/src/Command/SheetCommand.ts
+++ b/packages/core/src/Command/SheetCommand.ts
@@ -5,6 +5,8 @@ import { ISheetActionData } from './SheetAction';
/**
* Execute the undo-redo command
+ *
+ * TODO: SlideCommand/DocCommand
*/
export class SheetCommand extends CommandBase {
protected unit: Workbook;
diff --git a/packages/core/src/Interfaces/ISlideData.ts b/packages/core/src/Interfaces/ISlideData.ts
new file mode 100644
index 0000000000..cfb33f7aba
--- /dev/null
+++ b/packages/core/src/Interfaces/ISlideData.ts
@@ -0,0 +1,7 @@
+import { LocaleType } from '../Enum';
+
+export interface ISlideData {
+ slideId: string;
+ locale?: LocaleType;
+ title?: string;
+}
diff --git a/packages/core/src/Interfaces/index.ts b/packages/core/src/Interfaces/index.ts
index c11ab213de..fff318bd98 100644
--- a/packages/core/src/Interfaces/index.ts
+++ b/packages/core/src/Interfaces/index.ts
@@ -2,11 +2,13 @@
export * from './ICellData';
export * from './IColumnData';
export * from './IDocumentData';
+export * from './INamedRange';
export * from './IObserveData';
export * from './IRangeData';
export * from './IRowData';
export * from './ISelectionData';
export * from './IServiceData';
+export * from './ISlideData';
export * from './IStyleData';
export * from './IWorkbookData';
export * from './IWorksheetData';
diff --git a/tsconfig.json b/tsconfig.json
index a953a681bb..649362b77f 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -12,6 +12,8 @@
{ "path": "./packages/base-formula-engine/tsconfig.ref.json" },
{ "path": "./packages/base-numfmt-engine/tsconfig.ref.json" },
{ "path": "./packages/base-sheets/tsconfig.ref.json" },
+ { "path": "./packages/base-docs/tsconfig.ref.json" },
+ { "path": "./packages/base-slides/tsconfig.ref.json" },
{ "path": "./packages/style-universheet/tsconfig.ref.json" },
{ "path": "./packages/sheets-plugin-sort/tsconfig.ref.json" },
{ "path": "./packages/sheets-plugin-filter/tsconfig.ref.json" },