Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
refactor: remove unused image and formula plugins (#368)
Dushusir3ef99a7bb482
diff --git a/packages/sheets-plugin-formula/README-zh.md b/packages/sheets-plugin-formula/README-zh.mddeleted file mode 100644index 134bf67918..0000000000--- a/packages/sheets-plugin-formula/README-zh.md+++ /dev/null@@ -1,55 +0,0 @@-# style-univer--简体中文 | [English](./README.md)--## 介绍--UniverSheet Formula 插件--### 安装--```shell-npm i @univerjs/sheets-plugin-formula-```--### 使用--```js-import { Formula } from '@univerjs/sheets-plugin-formula';--const univerSheet = new UniverSheet();-univerSheet.installPlugin(new Formula());-```--## 本地开发--### 环境--- [Node.js](https://nodejs.org/en/) Version >= 10-- [npm](https://www.npmjs.com/) Version >= 6--### 安装--```-pnpm install-```--### 开发--```-# 当前目录 ./packages/sheets-plugin-formula/-npm run dev--# 或者项目根目录 ./-pnpm run --filter @univerjs/sheets-plugin-formula dev-```--### 打包--```-# 当前目录 ./packages/sheets-plugin-formula/-npm run build--# 或者根目录 ./-pnpm run --filter @univerjs/sheets-plugin-formula build-```diff --git a/packages/sheets-plugin-formula/README.md b/packages/sheets-plugin-formula/README.mddeleted file mode 100644index 798ff02170..0000000000--- a/packages/sheets-plugin-formula/README.md+++ /dev/null@@ -1,55 +0,0 @@-# style-univer--English| [简体中文](./README-zh.md)--## Introduction--UniverSheet Plugin Formula--### Installation--```shell-npm i @univerjs/sheets-plugin-formula-```--### Usage--```js-import { Formula } from '@univerjs/sheets-plugin-formula';--const univerSheet = new UniverSheet();-univerSheet.installPlugin(new Formula());-```--## 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/sheets-plugin-formula/-npm run dev--# Or project root directory ./-pnpm run --filter @univerjs/sheets-plugin-formula dev-```--### Package--```-# Current directory ./packages/sheets-plugin-formula/-npm run build--# Or root directory ./-pnpm run --filter @univerjs/sheets-plugin-formula build-```diff --git a/packages/sheets-plugin-formula/esbuild.config.mjs b/packages/sheets-plugin-formula/esbuild.config.mjsdeleted file mode 100644index 6a055f60dd..0000000000--- a/packages/sheets-plugin-formula/esbuild.config.mjs+++ /dev/null@@ -1,10 +0,0 @@-import esbuild from 'esbuild';--// eslint-disable-next-line import/no-relative-packages-import baseConfig from '../../esbuild.config.mjs';--esbuild.build({- ...baseConfig,- globalName: 'UniverSheetsPluginFormula',- outfile: './lib/univer-sheets-plugin-formula.js',-});diff --git a/packages/sheets-plugin-formula/package.json b/packages/sheets-plugin-formula/package.jsondeleted file mode 100644index 241cee2c2f..0000000000--- a/packages/sheets-plugin-formula/package.json+++ /dev/null@@ -1,62 +0,0 @@-{- "name": "@univerjs/sheets-plugin-formula",- "version": "0.0.1",- "description": "UniverSheet normal plugin formula",- "keywords": [],- "author": "DreamNum <[email protected]>",- "license": "MIT",- "main": "./src/index.ts",- "module": "./src/index.ts",- "types": "./src/Types/index.d.ts",- "publishConfig": {- "main": "./lib/univer-sheets-plugin-formula.cjs.js",- "module": "./lib/univer-sheets-plugin-formula.js",- "types": "./lib/index.d.ts",- "exports": {- ".": {- "require": "./lib/univer-sheets-plugin-formula.cjs.js",- "default": "./lib/univer-sheets-plugin-formula.js"- },- "./*": "./lib/*"- },- "access": "public"- },- "exports": {- ".": "./src/index.ts",- "./*": "./src/*"- },- "directories": {- "lib": "lib"- },- "files": [- "lib"- ],- "private": false,- "type": "module",- "scripts": {- "test": "vitest run",- "esbuild": "node ./esbuild.config.mjs"- },- "dependencies": {- "@univerjs/base-formula-engine": "workspace:*",- "@univerjs/base-render": "workspace:*",- "@univerjs/base-sheets": "workspace:*",- "@univerjs/base-ui": "workspace:*",- "@univerjs/core": "workspace:*",- "@univerjs/design": "workspace:*",- "@univerjs/ui-plugin-sheets": "workspace:*",- "@wendellhu/redi": "^0.12.10",- "react": "^18.2.0",- "react-dom": "^18.2.0"- },- "devDependencies": {- "@types/node": "^20.8.9",- "@types/react": "^18.2.33",- "@types/react-dom": "^18.2.14",- "@vitest/coverage-v8": "^0.34.6",- "esbuild": "^0.19.5",- "less": "^4.2.0",- "ts-node": "^10.9.1",- "vitest": "^0.34.6"- }-}diff --git a/packages/sheets-plugin-formula/src/Basics/Cache.ts b/packages/sheets-plugin-formula/src/Basics/Cache.tsdeleted file mode 100644index 002f98640e..0000000000--- a/packages/sheets-plugin-formula/src/Basics/Cache.ts+++ /dev/null@@ -1 +0,0 @@-export class Cache {}diff --git a/packages/sheets-plugin-formula/src/Basics/Const/CONFIG.ts b/packages/sheets-plugin-formula/src/Basics/Const/CONFIG.tsdeleted file mode 100644index e4800d3528..0000000000--- a/packages/sheets-plugin-formula/src/Basics/Const/CONFIG.ts+++ /dev/null@@ -1,3 +0,0 @@-export const CONFIG = {- show: true,-};diff --git a/packages/sheets-plugin-formula/src/Basics/Const/DEFAULT_FORMULA_DATA.ts b/packages/sheets-plugin-formula/src/Basics/Const/DEFAULT_FORMULA_DATA.tsdeleted file mode 100644index 70a071d9bc..0000000000--- a/packages/sheets-plugin-formula/src/Basics/Const/DEFAULT_FORMULA_DATA.ts+++ /dev/null@@ -1,148 +0,0 @@-import { IFormulaConfig } from '../Interfaces/IFormula';--export const DEFAULT_FORMULA_DATA: IFormulaConfig = {- formulaData: {- 'workbook-01': {- 'sheet-01': {- '12': {- '3': {- formula: '=SUM(F1, G8)',- row: 12,- column: 3,- sheetId: 'sheet-01',- },- },- '13': {- '3': {- formula: '=SUM(A3:G4)',- row: 13,- column: 3,- sheetId: 'sheet-01',- },- },- '14': {- '3': {- formula: '=SUM(D14, D13)',- row: 14,- column: 3,- sheetId: 'sheet-01',- },- },- },- },- },-};-export const DEFAULT_FORMULA_DATA_DOWN: IFormulaConfig = {- formulaData: {- 'workbook-02': {- 'sheet-0001': {- '12': {- '3': {- formula: '=SUM(F1, G8)',- row: 12,- column: 3,- sheetId: 'sheet-0001',- },- },- '13': {- '3': {- formula: '=SUM(A3:G4)',- row: 13,- column: 3,- sheetId: 'sheet-0001',- },- },- '14': {- '3': {- formula: '=SUM(D14, D13)',- row: 14,- column: 3,- sheetId: 'sheet-0001',- },- },- },- },- },-};--export const DEFAULT_FORMULA_DATA_DEMO: IFormulaConfig = {- formulaData: {- 'workbook-01': {- 'sheet-0003': {- '11': {- '6': {- formula: '=E12*F12',- row: 11,- column: 6,- sheetId: 'sheet-0003',- },- },- '12': {- '6': {- formula: '=E13*F13',- row: 12,- column: 6,- sheetId: 'sheet-0003',- },- },- '13': {- '6': {- formula: '=LAMBDA(x,x+2)(E14)',- row: 13,- column: 6,- sheetId: 'sheet-0003',- },- },- '19': {- '6': {- formula: '=SUM(G12:G19)',- row: 19,- column: 6,- sheetId: 'sheet-0003',- },- },- },- },- },-};--export const DEFAULT_FORMULA_DATA_DEMO1: IFormulaConfig = {- formulaData: {- 'workbook-01': {- 'sheet-0003': {- '11': {- '6': {- formula: '=E12*F12',- row: 11,- column: 6,- sheetId: 'sheet-0003',- },- },- '12': {- '6': {- formula: '=E13*F13',- row: 12,- column: 6,- sheetId: 'sheet-0003',- },- },- '13': {- '6': {- formula: '=LAMBDA(x,x+2)(E14)',- row: 13,- column: 6,- sheetId: 'sheet-0003',- },- },- '19': {- '6': {- formula: '=SUM(G12:G19)',- row: 19,- column: 6,- sheetId: 'sheet-0003',- },- },- },- },- },-};diff --git a/packages/sheets-plugin-formula/src/Basics/Const/FunctionList.ts b/packages/sheets-plugin-formula/src/Basics/Const/FunctionList.tsdeleted file mode 100644index 60bb14ca26..0000000000--- a/packages/sheets-plugin-formula/src/Basics/Const/FunctionList.ts+++ /dev/null@@ -1,154 +0,0 @@-export interface FormulaParamType {- /**- * formula param name locale key- */- name?: string;- /**- * formula param detail description locale key- */- detail?: string;- example?: string;- require?: string;- repeat?: string;- type?: string;-}--export interface FormulaType {- /**- * formula name- */- n?: string;- t?: number;- /**- * detail description locale key- */- d?: string;- a?: string;- m?: number[];- /**- * formula params locale key- */- p?: FormulaParamType[];-}--export const SelectCategoryType = [- {- label: 'formula.formulaMore.Math',- },- {- label: 'formula.formulaMore.Statistical',- },- {- label: 'formula.formulaMore.Lookup',- },- {- label: 'formula.formulaMore.universheet',- },- {- label: 'formula.formulaMore.dataMining',- },- {- label: 'formula.formulaMore.Database',- },- {- label: 'formula.formulaMore.Date',- },- {- label: 'formula.formulaMore.Filter',- },- {- label: 'formula.formulaMore.Financial',- },- {- label: 'formula.formulaMore.Engineering',- },- {- label: 'formula.formulaMore.Logical',- },- {- label: 'formula.formulaMore.Operator',- },- {- label: 'formula.formulaMore.Text',- },- {- label: 'formula.formulaMore.Parser',- },- {- label: 'formula.formulaMore.Array',- },- {- label: 'formula.formulaMore.other',- },-];--export const FunList: FormulaType[] = [- {- n: 'SUMIF',- t: 0,- d: 'formula.functionList.SUMIF.d',- p: [- {- name: 'formula.functionList.SUMIF.p.range.name',- detail: 'formula.functionList.SUMIF.p.range.detail',- example: 'A1:A10',- },- {- name: 'formula.functionList.SUMIF.p.rangeAll.name',- detail: 'formula.functionList.SUMIF.p.rangeAll.detail',- example: '">20"',- },- {- name: 'formula.functionList.SUMIF.p.range1.name',- detail: 'formula.functionList.SUMIF.p.range1.detail',- example: 'B1:B10',- },- ],- },- {- n: 'TAN',- t: 0,- d: 'formula.functionList.TAN.d',- p: [- {- name: 'formula.functionList.TAN.p.rangeNumber.name',- detail: 'formula.functionList.TAN.p.rangeNumber.detail',- },- ],- },- {- n: 'SUMIF2',- t: 2,- d: 'formula.functionList.SUMIF.d',- },- {- n: 'SUMIF2',- t: 2,- d: 'formula.functionList.SUMIF.d',- },- {- n: 'SUMIF3',- t: 3,- d: 'formula.functionList.SUMIF.d',- },- {- n: 'SUMIF4',- t: 4,- d: 'formula.functionList.SUMIF.d',- },- {- n: 'SUMIF5',- t: 5,- d: 'formula.functionList.SUMIF.d',- },- {- n: 'SUMIF6',- t: 6,- d: 'formula.functionList.SUMIF.d',- },- {- n: 'SUMIF7',- t: 7,- d: 'formula.functionList.SUMIF.d',- },-];diff --git a/packages/sheets-plugin-formula/src/Basics/Const/PLUGIN_NAME.ts b/packages/sheets-plugin-formula/src/Basics/Const/PLUGIN_NAME.tsdeleted file mode 100644index 272dbd75b8..0000000000--- a/packages/sheets-plugin-formula/src/Basics/Const/PLUGIN_NAME.ts+++ /dev/null@@ -1 +0,0 @@-export const FORMULA_PLUGIN_NAME = 'formula';diff --git a/packages/sheets-plugin-formula/src/Basics/Const/index.ts b/packages/sheets-plugin-formula/src/Basics/Const/index.tsdeleted file mode 100644index 1ec3503875..0000000000--- a/packages/sheets-plugin-formula/src/Basics/Const/index.ts+++ /dev/null@@ -1,6 +0,0 @@-// @index('./*.ts', f => `export * from '${f.path}'`)-export * from './CONFIG';-export * from './DEFAULT_FORMULA_DATA';-export * from './FunctionList';-export * from './PLUGIN_NAME';-// @endindexdiff --git a/packages/sheets-plugin-formula/src/Basics/Enum/ACTION_NAMES.ts b/packages/sheets-plugin-formula/src/Basics/Enum/ACTION_NAMES.tsdeleted file mode 100644index 2a7d39f37c..0000000000--- a/packages/sheets-plugin-formula/src/Basics/Enum/ACTION_NAMES.ts+++ /dev/null@@ -1,3 +0,0 @@-export enum ACTION_NAMES {- SET_FORMULA_RANGE_DATA_ACTION = 'SetFormulaRangeDataAction',-}diff --git a/packages/sheets-plugin-formula/src/Basics/Enum/FunctionType.ts b/packages/sheets-plugin-formula/src/Basics/Enum/FunctionType.tsdeleted file mode 100644index 7c3ea5c70d..0000000000--- a/packages/sheets-plugin-formula/src/Basics/Enum/FunctionType.ts+++ /dev/null@@ -1,18 +0,0 @@-export enum FunctionType {- Math,- Statistical,- Lookup,- universheet,- dataMining,- Database,- Date,- Filter,- Financial,- Engineering,- Logical,- Operator,- Text,- Parser,- Array,- other,-}diff --git a/packages/sheets-plugin-formula/src/Basics/Enum/index.ts b/packages/sheets-plugin-formula/src/Basics/Enum/index.tsdeleted file mode 100644index 355ae80973..0000000000--- a/packages/sheets-plugin-formula/src/Basics/Enum/index.ts+++ /dev/null@@ -1,3 +0,0 @@-// @index('./*.ts', f => `export * from '${f.path}'`)-export * from './ACTION_NAMES';-// @endindexdiff --git a/packages/sheets-plugin-formula/src/Basics/Interfaces/IFormula.ts b/packages/sheets-plugin-formula/src/Basics/Interfaces/IFormula.tsdeleted file mode 100644index 811eb9fb01..0000000000--- a/packages/sheets-plugin-formula/src/Basics/Interfaces/IFormula.ts+++ /dev/null@@ -1,68 +0,0 @@-import { FormulaDataType } from '@univerjs/base-formula-engine';--import { FormulaType } from '../Const/FunctionList';--export type IConfig = {};--// Types for props-export type IProps = { config: IConfig };--export interface IFormulaConfig {- formulaData: FormulaDataType;- calculationChain?: string[];- recalculationMode?: RecalculationModeType;-}--export enum RecalculationModeType {- AUTOMATIC = 'Automatic',- MANUAL = 'Manual',- AUTOMATIC_EXCEPT_TABLE = 'AutomaticExceptTable',-}--export interface Label {- type?: string;- locale?: string;- label?: string;- placeholderLocale?: string;- placeholder?: string;-}--export interface ILabel extends Label {- children?: Label[];- onClick?: () => void;-}--export interface FunListILabel extends Label {- children?: FormulaType[];- onClick: (value: FormulaType) => void;-}--export interface FunParams {- funParams: FormulaType;-}--export interface ICustomComponent {- name?: string;- props: {- select?: Label[];- funList?: FunListILabel;- funParams?: FunParams;- calcLocale?: string;- range?: string;- placeholderLocale?: string;- titleLocale?: string;- confirmTextLocale?: string;- };-}--export interface SearchFormulaModalData {- name: string;- label?: FunParams;- show?: boolean;- mask?: boolean;- group: ILabel[];- titleLocale?: string;- onCancel?: () => void;- children: ICustomComponent;- modal?: React.ReactNode; // 渲染的组件-}diff --git a/packages/sheets-plugin-formula/src/Basics/Interfaces/index.ts b/packages/sheets-plugin-formula/src/Basics/Interfaces/index.tsdeleted file mode 100644index af5abb7203..0000000000--- a/packages/sheets-plugin-formula/src/Basics/Interfaces/index.ts+++ /dev/null@@ -1,3 +0,0 @@-// @index('./*.ts', f => `export * from '${f.path}'`)-export * from './IFormula';-// @endindexdiff --git a/packages/sheets-plugin-formula/src/Basics/index.ts b/packages/sheets-plugin-formula/src/Basics/index.tsdeleted file mode 100644index 744f1ab56c..0000000000--- a/packages/sheets-plugin-formula/src/Basics/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './Cache';-export * from './Const';-export * from './Interfaces';diff --git a/packages/sheets-plugin-formula/src/Controller/ArrayFormulaLineController.ts b/packages/sheets-plugin-formula/src/Controller/ArrayFormulaLineController.tsdeleted file mode 100644index 9d6437435b..0000000000--- a/packages/sheets-plugin-formula/src/Controller/ArrayFormulaLineController.ts+++ /dev/null@@ -1,94 +0,0 @@-import { IRenderManagerService, Rect } from '@univerjs/base-render';-import { IRange, IUniverInstanceService, Workbook } from '@univerjs/core';--enum ARRAY_FORMULA_LINE_MANAGER_KEY {- top = '__ArrayFormulaLineTopControl__',- bottom = '__ArrayFormulaLineBottomControl__',- left = '__ArrayFormulaLineLeftControl__',- right = '__ArrayFormulaLineRightControl__',- line = '__ArrayFormulaLineControl__',-}--const LINE_COLOR = '#3969b9';-/**- * Ant Line Controller- */-export class ArrayFormulaLineControl {- private _arrayFormulaLine!: Rect;-- /**- * Create ArrayFormLineController- * @param plugin- */- constructor(- private _sheetId: string,- private _range: IRange,- @IUniverInstanceService private readonly _currentUniverSheet: IUniverInstanceService,- @IRenderManagerService private readonly _renderManagerService: IRenderManagerService- ) {- this._initialize();- }-- /**- * Return WorkBook- * @returns Workbook- */- getWorkBook(): Workbook {- return this._currentUniverSheet.getCurrentUniverSheetInstance();- }-- dispose() {- this._arrayFormulaLine?.dispose();- }-- private _initialize() {- const { startRow, startColumn, endRow, endColumn } = this._range;- const sheetId = this._sheetId;-- const workbook = this.getWorkBook();- const worksheet = workbook.getSheetBySheetId(sheetId);-- if (worksheet == null) {- throw new Error(`not found sheet from id: ${sheetId}`);- }-- const rowHeaderWidth = worksheet.getConfig().rowHeader.width;- const columnHeaderHeight = worksheet.getConfig().columnHeader.height;-- const rowManager = worksheet.getRowManager();- const columnManager = worksheet.getColumnManager();-- let totalHeight = 0;- let totalWidth = 0;- for (let i = startRow; i < endRow; i++) {- totalHeight += rowManager.getRowHeight(i);- }- for (let i = startColumn; i < endColumn; i++) {- totalWidth += columnManager.getColumnWidth(i);- }-- let offsetLeft = 0;- let offsetTop = 0;- for (let i = 0; i <= startRow - 1; i++) {- offsetTop += rowManager.getRowHeight(i);- }- for (let i = 0; i <= startColumn - 1; i++) {- offsetLeft += columnManager.getColumnWidth(i);- }-- this._arrayFormulaLine = new Rect(ARRAY_FORMULA_LINE_MANAGER_KEY.line, {- stroke: LINE_COLOR,- strokeWidth: 1,- left: offsetLeft + rowHeaderWidth,- top: offsetTop + columnHeaderHeight,- height: totalHeight,- width: totalWidth,- evented: false,- });-- const scene = this._renderManagerService.getCurrent()?.scene;- scene?.addObject(this._arrayFormulaLine);-- // this._arrayFormulaLine.makeDirty(true);- }-}diff --git a/packages/sheets-plugin-formula/src/Controller/CellInputHandler.ts b/packages/sheets-plugin-formula/src/Controller/CellInputHandler.tsdeleted file mode 100644index 7fcebf8d1b..0000000000--- a/packages/sheets-plugin-formula/src/Controller/CellInputHandler.ts+++ /dev/null@@ -1,941 +0,0 @@-import { getNodeIndex, xssDeal } from '@univerjs/base-ui';-import { IKeyValue, Nullable, Tools } from '@univerjs/core';--import { FunList } from '../Basics';--/**- * Random color for formula cell input- */-const LUCKY_COLOR = [- '#c1232b',- '#27727b',- '#fcce10',- '#e87c25',- '#b5c334',- '#fe8463',- '#9bca63',- '#fad860',- '#f3a43b',- '#60c0dd',- '#d7504b',- '#c6e579',- '#f4e001',- '#f0805a',- '#26c0c0',- '#c12e34',- '#e6b600',- '#0098d9',- '#2b821d',- '#005eaa',- '#339ca8',- '#cda819',- '#32a487',- '#3fb1e3',- '#6be6c1',- '#626c91',- '#a0a7e6',- '#c4ebad',- '#96dee8',-];--/**- * Handle cell input event- */-export class CellInputHandler {- functionHTMLIndex: number;-- functionRangeIndex: Range | number[];-- operator: string;-- operatorjson: object;-- rangestart: boolean;-- rangedrag_column_start: boolean;-- rangedrag_row_start: boolean;-- // inputValue: string;-- formula: IKeyValue[] = [];-- functionlistPosition: object;-- funcName: Nullable<string>;-- paramindex: number = 0;-- searchFunctionCell: any;-- editor: HTMLElement;-- constructor(ele: HTMLElement) {- this.functionHTMLIndex = 0;- this.functionRangeIndex = [];- this.operator = '===|!==|<>|<=|>=|=|+|-|>|<|/|*|%|&|^';- this.operatorjson = this.covertOperatorjson();- this.rangestart = false;- this.rangedrag_column_start = false;- this.rangedrag_row_start = false;- this.functionlistPosition = {};-- this.editor = ele;- }-- covertOperatorjson() {- const arr = this.operator.split('|');- const op: IKeyValue = {};-- for (let i = 0; i < arr.length; i++) {- op[arr[i].toString()] = 1;- }-- return op;- }-- getFormula() {- return this.formula || [];- }-- getInputValue() {- return this.editor.innerHTML;- }-- /**- * update value and html- * @param value- */- setInputValue(value: string) {- this.editor.innerHTML = xssDeal(value);- }-- getHelpFormula() {- return [this.funcName, this.paramindex];- }-- getFunctionlistPosition() {- return this.functionlistPosition;- }-- /**- * An entry that handles input events- *- * @param $input- * @param kcode- */- functionInputHandler($input: HTMLElement, kcode: number) {- const _this = this;-- const $editer = $input;- let value1 = $editer.innerHTML;- const value1txt = $editer.textContent || '';-- // You must use setTimeout to get the current input value- setTimeout(() => {- let value = $editer.textContent || '';- const valuetxt = value;- value = xssDeal(value);- _this.funcName = null;- if (value.length > 0 && value.substr(0, 1) === '=' && (kcode !== 229 || value.length === 1)) {- // _this.inputValue = value;- value = _this.functionHTMLGenerate(value);- value1 = _this.functionHTMLGenerate(value1txt);- const currSelection = window.getSelection();- if (currSelection) {- // all browsers, except IE before version 9- if (currSelection?.anchorNode instanceof HTMLElement && currSelection.anchorNode?.matches('div')) {- // const editorlen = $$('span', $editer).length;- // _this.functionRangeIndex = [- // editorlen - 1,- // $$('span', $editer)[editorlen - 1].textContent.length,- // ];- } else {- _this.functionRangeIndex = [- getNodeIndex(currSelection.anchorNode?.parentNode),- currSelection.anchorOffset,- ];- }- } else {- // Internet Explorer before version 9- const textRange = (document as any).selection.createRange();- _this.functionRangeIndex = textRange;- }-- $editer.innerHTML = value;- _this.functionRange($editer, value, value1);- _this.canceFunctionrangeSelected();-- if (kcode !== 46) {- // delete不执行此函数- // _this.createRangeHightlight();- }-- _this.rangestart = false;- _this.rangedrag_column_start = false;- _this.rangedrag_row_start = false;-- const current = _this.getrangeseleciton() as HTMLSpanElement;-- _this.helpFunctionExe($editer, current);- } else if (value1txt.substr(0, 1) !== '=') {- // if ($copy.attr('id') === 'universheet-rich-text-editor') {- // if ($copy.html().substr(0, 5) === '<span') {- // } else {- // $copy.html(value);- // }- // } else {- // $copy.html(value);- // }- } else {- // _this.inputValue = value;- }- }, 1);- }-- // from luckysheet- // eslint-disable-next-line max-lines-per-function- findrangeindex(v: string, vp: string) {- const _this = this;-- const re = /<span.*?>/g;- const v_a_string = v.replace(re, '');- const vp_a_string = vp.replace(re, '');- const v_a = v_a_string.split('</span>');- const vp_a = vp_a_string.split('</span>');- v_a.pop();- vp_a.pop();-- let pfri: IKeyValue = _this.functionRangeIndex;- // let i = 0;- const spanlen = vp_a.length > v_a.length ? v_a.length : vp_a.length;-- const vplen = vp_a.length;- const vlen = v_a.length;-- // 不增加元素输入- if (vplen === vlen) {- const i = pfri[0];- const p = vp_a[i];- const n = v_a[i];-- if (p == null) {- if (vp_a.length <= i) {- pfri = [vp_a.length - 1, vp_a.length - 1];- } else if (v_a.length <= i) {- pfri = [v_a.length - 1, v_a.length - 1];- }-- return pfri;- }- if (p.length === n.length) {- if (vp_a[i + 1] != null && v_a[i + 1] != null && vp_a[i + 1].length < v_a[i + 1].length) {- pfri[0] += 1;- pfri[1] = 1;- }-- return pfri;- }- if (p.length > n.length) {- if (- p != null &&- v_a[i + 1] != null &&- v_a[i + 1].substr(0, 1) === '"' &&- (p.indexOf('{') > -1 || p.indexOf('}') > -1)- ) {- pfri[0] += 1;- pfri[1] = 1;- }-- return pfri;- }- if (p.length < n.length) {- if (pfri[1] > n.length) {- pfri[1] = n.length;- }-- return pfri;- }- }- // 减少元素输入- else if (vplen > vlen) {- const i = pfri[0];- const p = vp_a[i];- const n = v_a[i];-- if (n == null) {- if (v_a[i - 1].indexOf('{') > -1) {- pfri[0] -= 1;- const start = v_a[i - 1].search('{');- pfri[1] += start;- } else {- pfri[0] = 0;- pfri[1] = 0;- }- } else if (p.length === n.length) {- if (- v_a[i + 1] != null &&- (v_a[i + 1].substr(0, 1) === '"' ||- v_a[i + 1].substr(0, 1) === '{' ||- v_a[i + 1].substr(0, 1) === '}')- ) {- pfri[0] += 1;- pfri[1] = 1;- } else if (p != null && p.length > 2 && p.substr(0, 1) === '"' && p.substr(p.length - 1, 1) === '"') {- // pfri[1] = n.length-1;- } else if (v_a[i] != null && v_a[i] === '")') {- pfri[1] = 1;- } else if (v_a[i] != null && v_a[i] === '"}') {- pfri[1] = 1;- } else if (v_a[i] != null && v_a[i] === '{)') {- pfri[1] = 1;- } else {- pfri[1] = n.length;- }-- return pfri;- } else if (p.length > n.length) {- if (- v_a[i + 1] != null &&- (v_a[i + 1].substr(0, 1) === '"' ||- v_a[i + 1].substr(0, 1) === '{' ||- v_a[i + 1].substr(0, 1) === '}')- ) {- pfri[0] += 1;- pfri[1] = 1;- }-- return pfri;- } else if (p.length < n.length) {- return pfri;- }-- return pfri;- }- // 增加元素输入- else if (vplen < vlen) {- const i = pfri[0];- const p = vp_a[i];- const n = v_a[i];-- if (p == null) {- pfri[0] = v_a.length - 1;-- if (n != null) {- pfri[1] = n.length;- } else {- pfri[1] = 1;- }- } else if (p.length === n.length) {- if (- vp_a[i + 1] != null &&- (vp_a[i + 1].substr(0, 1) === '"' ||- vp_a[i + 1].substr(0, 1) === '{' ||- vp_a[i + 1].substr(0, 1) === '}')- ) {- pfri[1] = n.length;- } else if (- v_a[i + 1] != null &&- v_a[i + 1].substr(0, 1) === '"' &&- (v_a[i + 1].substr(0, 1) === '{' || v_a[i + 1].substr(0, 1) === '}')- ) {- pfri[0] += 1;- pfri[1] = 1;- } else if (- n != null &&- n.substr(0, 1) === '"' &&- n.substr(n.length - 1, 1) === '"' &&- p.substr(0, 1) === '"' &&- p.substr(p.length - 1, 1) === ')'- ) {- pfri[1] = n.length;- } else if (- n != null &&- n.substr(0, 1) === '{' &&- n.substr(n.length - 1, 1) === '}' &&- p.substr(0, 1) === '{' &&- p.substr(p.length - 1, 1) === ')'- ) {- pfri[1] = n.length;- } else {- pfri[0] = pfri[0] + vlen - vplen;- if (v_a.length > vp_a.length) {- pfri[1] = v_a[i + 1].length;- } else {- pfri[1] = 1;- }- }-- return pfri;- } else if (p.length > n.length) {- if (p != null && p.substr(0, 1) === '"') {- pfri[1] = n.length;- } else if (v_a[i + 1] != null && /{.*?}/.test(v_a[i + 1])) {- pfri[0] += 1;- pfri[1] = v_a[i + 1].length;- } else if (- p != null &&- v_a[i + 1].substr(0, 1) === '"' &&- (p.indexOf('{') > -1 || p.indexOf('}') > -1)- ) {- pfri[0] += 1;- pfri[1] = 1;- }- // else if (p != null && (p.indexOf('{') > -1 || p.indexOf('}') > -1)) {- // }- else {- pfri[0] = pfri[0] + vlen - vplen - 1;- pfri[1] = v_a[i - 1].length;- }-- return pfri;- } else if (p.length < n.length) {- return pfri;- }-- return pfri;- }-- return null;- }-- setCaretPosition(textDom: HTMLElement, children: number, pos: number) {- try {- const el = textDom;- const range = document.createRange();- const sel = window.getSelection();- range.setStart(el.childNodes[children], pos);- range.collapse(true);- sel?.removeAllRanges();- sel?.addRange(range);- el.focus();- } catch (err) {- // universheetRangeLast(this.rangeResizeTo[0]);- }- }-- functionRange(obj: HTMLElement, v: string, vp: string) {- const _this = this;-- // ie11 10 9 ff safari- const currSelection = window.getSelection();- const fri = _this.findrangeindex(v, vp);-- // FIX: set position- if (fri == null && currSelection) {- currSelection.selectAllChildren((obj as IKeyValue)[0]);- currSelection.collapseToEnd();- } else if (fri != null) {- // const span = $$('span', obj);- // _this.setCaretPosition(Array.isArray(span) ? span[fri[0]] : span, 0, fri[1]);- }- }-- functionHTMLGenerate(txt: string) {- const _this = this;-- if (txt.length === 0 || txt.substr(0, 1) !== '=') {- return txt;- }-- _this.functionHTMLIndex = 0;-- return `<span dir="auto" class="universheet-formula-text-color">=</span>${_this.functionHTML(txt)}`;- }-- // from luckysheet- // eslint-disable-next-line max-lines-per-function- functionHTML(txt: string) {- const _this = this;-- if (_this.operatorjson == null) {- const arr = _this.operator.split('|');- const op: IKeyValue = {};-- for (let i = 0; i < arr.length; i++) {- op[arr[i].toString()] = 1;- }-- _this.operatorjson = op;- }-- if (txt.substr(0, 1) === '=') {- txt = txt.substr(1);- }-- const funcstack = txt.split('');- let i = 0;- let str = '';- let function_str = '';- const ispassby = true;- const matchConfig = {- bracket: 0,- comma: 0,- squote: 0,- dquote: 0,- braces: 0,- };-- while (i < funcstack.length) {- const s = funcstack[i];-- if (s === '(' && matchConfig.squote === 0 && matchConfig.dquote === 0 && matchConfig.braces === 0) {- matchConfig.bracket += 1;-- if (str.length > 0) {- function_str += `<span dir="auto" class="universheet-formula-text-func">${str}</span><span dir="auto" class="universheet-formula-text-lpar">(</span>`;- } else {- function_str += '<span dir="auto" class="universheet-formula-text-lpar">(</span>';- }-- str = '';- } else if (s === ')' && matchConfig.squote === 0 && matchConfig.dquote === 0 && matchConfig.braces === 0) {- matchConfig.bracket -= 1;- function_str += `${_this.functionHTML(- str- )}<span dir="auto" class="universheet-formula-text-rpar">)</span>`;- str = '';- } else if (s === '{' && matchConfig.squote === 0 && matchConfig.dquote === 0) {- str += '{';- matchConfig.braces += 1;- } else if (s === '}' && matchConfig.squote === 0 && matchConfig.dquote === 0) {- str += '}';- matchConfig.braces -= 1;- } else if (s === '"' && matchConfig.squote === 0) {- if (matchConfig.dquote > 0) {- if (str.length > 0) {- function_str += `${str}"</span>`;- } else {- function_str += '"</span>';- }-- matchConfig.dquote -= 1;- str = '';- } else {- matchConfig.dquote += 1;-- if (str.length > 0) {- function_str += `${_this.functionHTML(- str- )}<span dir="auto" class="universheet-formula-text-string">"`;- } else {- function_str += `<span dir="auto" class="universheet-formula-text-string">"`;- }-- str = '';- }- }- // 修正例如输入公式='1-2'!A1时,只有2'!A1是universheet-formula-functionrange-cell色,'1-是黑色的问题。- else if (s === "'" && matchConfig.dquote === 0) {- str += "'";- matchConfig.squote = matchConfig.squote === 0 ? 1 : 0;- } else if (s === ',' && matchConfig.squote === 0 && matchConfig.dquote === 0 && matchConfig.braces === 0) {- // matchConfig.comma += 1;- function_str += `${_this.functionHTML(- str- )}<span dir="auto" class="universheet-formula-text-comma">,</span>`;- str = '';- } else if (s === '&' && matchConfig.squote === 0 && matchConfig.dquote === 0 && matchConfig.braces === 0) {- if (str.length > 0) {- function_str += `${_this.functionHTML(- str- )}<span dir="auto" class="universheet-formula-text-calc">&</span>`;- str = '';- } else {- function_str += '<span dir="auto" class="universheet-formula-text-calc">&</span>';- }- } else if (- s in _this.operatorjson &&- matchConfig.squote === 0 &&- matchConfig.dquote === 0 &&- matchConfig.braces === 0- ) {- let s_next = '';- if (i + 1 < funcstack.length) {- s_next = funcstack[i + 1];- }-- let p = i - 1;- let s_pre = null;- if (p >= 0) {- do {- s_pre = funcstack[p--];- } while (p >= 0 && s_pre === ' ');- }-- if (s + s_next in _this.operatorjson) {- if (str.length > 0) {- function_str += `${_this.functionHTML(- str- )}<span dir="auto" class="universheet-formula-text-calc">${s}${s_next}</span>`;- str = '';- } else {- function_str += `<span dir="auto" class="universheet-formula-text-calc">${s}${s_next}</span>`;- }-- i++;- } else if (- !/[^0-9]/.test(s_next) &&- s === '-' &&- (s_pre === '(' || s_pre == null || s_pre === ',' || s_pre === ' ' || s_pre in _this.operatorjson)- ) {- str += s;- } else if (str.length > 0) {- function_str += `${_this.functionHTML(- str- )}<span dir="auto" class="universheet-formula-text-calc">${s}</span>`;- str = '';- } else {- function_str += `<span dir="auto" class="universheet-formula-text-calc">${s}</span>`;- }- } else {- str += s;- }-- if (i === funcstack.length - 1) {- // function_str += str;- if (_this.iscelldata(str.trim())) {- function_str += `<span class="universheet-formula-functionrange-cell" rangeindex="${- _this.functionHTMLIndex- }" dir="auto" style="color:${LUCKY_COLOR[_this.functionHTMLIndex]};">${str}</span>`;- _this.functionHTMLIndex++;- } else if (matchConfig.dquote > 0) {- function_str += `${str}</span>`;- } else if (str.indexOf('</span>') === -1 && str.length > 0) {- const regx = /{.*?}/;-- if (regx.test(str.trim())) {- const arraytxt = regx.exec(str)![0];- const arraystart = str.search(regx);- let alltxt = '';-- if (arraystart > 0) {- alltxt += `<span dir="auto" class="universheet-formula-text-color">${str.substr(- 0,- arraystart- )}</span>`;- }-- alltxt += `<span dir="auto" style="color:#959a05" class="universheet-formula-text-array">${arraytxt}</span>`;-- if (arraystart + arraytxt.length < str.length) {- alltxt += `<span dir="auto" class="universheet-formula-text-color">${str.substr(- arraystart + arraytxt.length,- str.length- )}</span>`;- }-- function_str += alltxt;- } else {- function_str += `<span dir="auto" class="universheet-formula-text-color">${str}</span>`;- }- }- }-- i++;- }-- return function_str;- }-- canceFunctionrangeSelected() {- // $('#universheet-formula-functionrange-select').hide();- // $('#universheet-row-count-show, #universheet-column-count-show').hide();- // // $("#universheet-cols-h-selected, #universheet-rows-h-selected").hide();- // $('#universheet-formula-search-c, #universheet-formula-help-c').hide();- }-- iscelldata(txt: string) {- // 判断是否为单元格格式- const val = txt.split('!');- let rangetxt;-- if (val.length > 1) {- rangetxt = val[1];- } else {- rangetxt = val[0];- }-- const reg_cell = /^(([a-zA-Z]+)|([$][a-zA-Z]+))(([0-9]+)|([$][0-9]+))$/g; // 增加正则判断单元格为字母+数字的格式:如 A1:B3- let reg_cellRange = /^(((([a-zA-Z]+)|([$][a-zA-Z]+))(([0-9]+)|([$][0-9]+)))|((([a-zA-Z]+)|([$][a-zA-Z]+))))$/g; // 增加正则判断单元格为字母+数字或字母的格式:如 A1:B3,A:A-- if (rangetxt.indexOf(':') === -1) {- const row = parseInt(rangetxt.replace(/[^0-9]/g, '')) - 1;- const col = Tools.ABCatNum(rangetxt.replace(/[^A-Za-z]/g, ''));-- if (!Number.isNaN(row) && !Number.isNaN(col) && rangetxt.toString().match(reg_cell)) {- return true;- }- if (!Number.isNaN(row)) {- return false;- }- if (!Number.isNaN(col)) {- return false;- }- return false;- }- reg_cellRange =- /^(((([a-zA-Z]+)|([$][a-zA-Z]+))(([0-9]+)|([$][0-9]+)))|((([a-zA-Z]+)|([$][a-zA-Z]+)))|((([0-9]+)|([$][0-9]+s))))$/g;-- rangetxt = rangetxt.split(':');-- const row = [];- const col = [];- row[0] = parseInt(rangetxt[0].replace(/[^0-9]/g, '')) - 1;- row[1] = parseInt(rangetxt[1].replace(/[^0-9]/g, '')) - 1;- if (row[0] > row[1]) {- return false;- }-- col[0] = Tools.ABCatNum(rangetxt[0].replace(/[^A-Za-z]/g, ''));- col[1] = Tools.ABCatNum(rangetxt[1].replace(/[^A-Za-z]/g, ''));- if (col[0] > col[1]) {- return false;- }-- if (rangetxt[0].toString().match(reg_cellRange) && rangetxt[1].toString().match(reg_cellRange)) {- return true;- }- return false;- }-- getrangeseleciton() {- const currSelection = window.getSelection()!;- const anchor = currSelection.anchorNode!;- const anchorOffset = currSelection.anchorOffset;- const anchorLength = anchor?.parentElement!.querySelectorAll('span');- if (anchor?.parentNode?.nodeName === 'SPAN' && anchorOffset !== 0) {- let txt = anchor.textContent!.trim();- let lasttxt = '';-- if (txt.length === 0 && anchor.parentNode.previousSibling) {- const ahr = anchor.parentNode.previousSibling!;- txt = ahr.textContent!.trim();- lasttxt = txt.substring(txt.length - 1, 1);- return ahr;- }- lasttxt = txt.substring(anchorOffset - 1, 1);- return anchor.parentNode;- }- if (anchor?.parentElement?.className === 'universheet-rich-text-editor') {- // const a = anchor.querySelectorAll('span');- // let txt = anchor.parentElement!.querySelectorAll('span')[anchorLength.length - 1].textContent!.trim();- let txt = anchor.textContent?.trim()!;-- if (txt.length === 0 && anchor!.parentElement!.querySelectorAll('span').length > 1) {- const ahr = anchor?.parentElement!.querySelectorAll('span')!;- const textContent = ahr[`${ahr.length - 2}`].textContent;- txt = (textContent && textContent.trim()) || '';- return ahr[anchorLength.length - 1];- }- return anchor.parentElement!.querySelectorAll('span')[anchorLength.length - 1];- }-- // if ((anchor.parentNode as HTMLElement).matches('span') && anchorOffset !== 0) {- // let txt = (anchor as HTMLElement).textContent!.trim(),- // lasttxt = '';-- // if (txt.length === 0 && (anchor.parentNode as HTMLElement).previousElementSibling!) {- // let ahr = anchor.parentElement!.previousElementSibling;- // // txt = ahr.textContent.trim();- // // lasttxt = txt.substr(txt.length - 1, 1);- // return ahr;- // } else {- // // lasttxt = txt.substr(anchorOffset - 1, 1);- // return anchor.parentNode;- // }- // } else if ((anchor as HTMLElement).matches(styles.richTextEditor) /*|| (anchor as HTMLElement).matches('#universheet-functionbox-cell')*/) {- // let txt = anchor.querySelectorAll('span').lastElementChild.textContent.trim();-- // if (txt.length === 0 && anchor.querySelectorAll('span').length > 1) {- // let ahr = anchor.querySelectorAll('span');- // // txt = ahr.eq(ahr.length - 2).textContent.trim();- // return ahr;- // } else {- // return anchor.querySelectorAll('span').lastElementChild;- // }- // } else if (- // (anchor.parentNode as HTMLElement).matches(styles.richTextEditor) ||- // /* (anchor.parentNode as HTMLElement).matches('#universheet-functionbox-cell') ||*/- // anchorOffset === 0- // ) {- // if (anchorOffset === 0) {- // anchor = anchor.parentNode!;- // }-- // if ((anchor as HTMLElement).previousElementSibling) {- // // let txt = anchor.previousElementSibling.textContent.trim();- // // let lasttxt = txt.substr(txt.length - 1, 1);- // return anchor.previousElementSibling;- // }- // }-- return null;- }-- searchFunction($editer: HTMLElement) {- const _this = this;- // const locale = 'zh';- this.formula = [];-- // let functionlist = lang[`${locale}`];-- const $cell = _this.getrangeseleciton();-- _this.searchFunctionCell = $cell;-- if ($cell == null || $editer == null) {- return;- }-- // Use innerText instead of innerHTML because rich text styles will appear"<span dir="auto" class="univer-formula-text-color">=</span><span dir="auto" class="univer-formula -text-color ">su</span>", resulting in inaccurate judgment of inputContent.substr(0, 1)- const inputContent = $editer.innerText;- const searchtxt = $cell.textContent!.toUpperCase();- const reg = /^[a-zA-Z]|[a-zA-Z_]+$/;- if (!reg.test(searchtxt) || inputContent.substr(0, 1) !== '=') {- return;- }- // return;- const result: any = {- f: [],- s: [],- t: [],- };- let result_i = 0;-- for (let i = 0; i < FunList.length; i++) {- const item = FunList[i];- const n = item.n;-- if (!n) continue;-- if (n === searchtxt) {- result.f.unshift(item);- result_i++;- } else if (n.substr(0, searchtxt.length) === searchtxt) {- result.s.unshift(item);- result_i++;- } else if (n.indexOf(searchtxt) > -1) {- result.t.unshift(item);- result_i++;- }-- if (result_i >= 10) {- break;- }- }-- const list = result.t.concat(result.s.concat(result.f));-- this.formula = list;- // if (list.length <= 0) {- // }- }-- helpFunctionExe($editer: HTMLElement, currSelection: HTMLSpanElement) {- const _this = this;- if (document.querySelectorAll('#universheet-formula-help-c').length === 0) {- for (let i = 0; i < FunList.length; i++) {- const n = FunList[i].n;- if (!n) continue;- (_this.functionlistPosition as IKeyValue)[n] = i;- }- }- if (!currSelection) {- return;- }-- const $prev = currSelection;- const $span = $editer.querySelectorAll('span');- const currentIndex = [].indexOf.call(- currSelection.parentNode!.querySelectorAll(currSelection.tagName),- currSelection as never- );- // currentIndex = currSelection.parentNode.childNodes.length - 1,- let i = currentIndex;-- if ($prev == null) {- return;- }- let funcName = null;- let paramindex = null;- if ($span[`${i}`].className === 'universheet-rich-text-editor') {- funcName = $span[`${i}`].textContent;- } else {- let $cur = null;- let exceptIndex = [-1, -1];-- while (--i > 0) {- $cur = $span[`${i}`];-- if (- $cur.className === 'universheet-formula-text-func' ||- $cur.textContent!.trim().toUpperCase() in _this.functionlistPosition- ) {- funcName = $cur.textContent;- paramindex = null;- let endstate = true;-- for (let a = i; a <= currentIndex; a++) {- if (!paramindex) {- paramindex = 0;- }-- if (a >= exceptIndex[0] && a <= exceptIndex[1]) {- continue;- }-- $cur = $span[`${a}`];- if ($cur.className === 'universheet-formula-text-rpar') {- exceptIndex = [i, a];- funcName = null;- endstate = false;- break;- }-- if ($cur.className === 'universheet-formula-text-comma') {- paramindex++;- }- }-- if (endstate) {- break;- }- }- }- }-- if (funcName == null) {- return;- }-- this.funcName = funcName;- this.paramindex = paramindex!;- }-- searchFunctionEnter(funcName: string) {- const _this = this;-- const functxt = funcName;-- const searchFunctionCell = _this.searchFunctionCell;-- searchFunctionCell.innerText = functxt;- const span = document.createElement('span');- span.dir = 'auto';- span.className = 'universheet-formula-text-color';- span.innerText = '(';- insertAfter(span, searchFunctionCell);-- _this.setCaretPosition(span, 0, 1);- }-}--function insertAfter(newElement: any, targetElement: { parentNode: any; nextSibling: any }) {- const parent = targetElement.parentNode;- if (parent.lastChild === targetElement) {- parent.appendChild(newElement);- } else {- parent.insertBefore(newElement, targetElement.nextSibling);- }-}diff --git a/packages/sheets-plugin-formula/src/Controller/FirstLoader.ts b/packages/sheets-plugin-formula/src/Controller/FirstLoader.tsdeleted file mode 100644index 6c4c73c5ca..0000000000--- a/packages/sheets-plugin-formula/src/Controller/FirstLoader.ts+++ /dev/null@@ -1,55 +0,0 @@-import { FormulaController } from './FormulaController';--export function firstLoader(formulaController: FormulaController) {- const dataModel = formulaController.getDataModel();- const engine = formulaController.getFormulaEngine();-- if (!engine) {- throw new Error();- }-- const sheetDataPromise = engine.execute(- formulaController.getUnitId(),- dataModel.getFormulaData(),- formulaController.toInterpreterCalculateProps(),- true- );-- // const commandManager = formulaController.getCommandManager();-- // const workBook = formulaController;-- // sheetDataPromise.then((data) => {- // if (!data) return;- // const { sheetData, arrayFormulaData } = data;-- // if (!sheetData) {- // return;- // }-- // const sheetIds = Object.keys(sheetData);-- // const actionList: ISetRangeDataActionData[] = [];-- // for (let i = 0, len = sheetIds.length; i < len; i++) {- // const sheetId = sheetIds[i];- // const cellData: ObjectMatrix<ICellData> = sheetData[sheetId];- // cellData.forValue((row, column, mainCell) => {- // const action = {- // actionName: ACTION_NAMES.SET_RANGE_DATA_ACTION,- // sheetId,- // cellValue: {- // [row]: {- // [column]: mainCell,- // },- // },- // };-- // actionList.push(ActionOperation.make<ISetRangeDataActionData>(action).removeCollaboration().removeUndo().removeExtension().getAction());- // });- // }-- // const command = new Command({ WorkBookUnit: workBook }, ...actionList);- // commandManager.invoke(command);- // });-}diff --git a/packages/sheets-plugin-formula/src/Controller/FormulaController.ts b/packages/sheets-plugin-formula/src/Controller/FormulaController.tsdeleted file mode 100644index 51919b8dfd..0000000000--- a/packages/sheets-plugin-formula/src/Controller/FormulaController.ts+++ /dev/null@@ -1,214 +0,0 @@-import {- ArrayFormulaDataType,- FormulaEngineService,- IInterpreterDatasetConfig,- SheetDataType,- SheetNameMapType,- UnitDataType,-} from '@univerjs/base-formula-engine';-import { SelectionManagerService } from '@univerjs/base-sheets';-import { IUniverInstanceService } from '@univerjs/core';-import { Inject, Injector } from '@wendellhu/redi';--import { IFormulaConfig } from '../Basics/Interfaces/IFormula';-import { FormulaDataModel } from '../Model/FormulaDataModel';-import { ArrayFormulaLineControl } from './ArrayFormulaLineController';--export class FormulaController {- private _formulaDataModel: FormulaDataModel;-- private _formulaEngine?: FormulaEngineService;-- private _interpreterCalculatePropsCache?: IInterpreterDatasetConfig;-- private _activeSheetId: string;-- private _arrayFormulaLineControls: ArrayFormulaLineControl[] = [];-- constructor(- config: IFormulaConfig,- @Inject(SelectionManagerService) private readonly _selectionManagerService: SelectionManagerService,- @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,- @Inject(Injector) private readonly _sheetInjector: Injector- ) {- this._formulaDataModel = new FormulaDataModel(config);-- this._activeSheetId = this._currentUniverService- .getCurrentUniverSheetInstance()-- .getActiveSheet()- .getSheetId();-- // this._initRegisterComponent();-- // this._sheetPlugin.addToolButton({- // name: FORMULA_PLUGIN_NAME,- // locale: FORMULA_PLUGIN_NAME,- // hideSelectedIcon: true,- // customLabel: {- // name: FORMULA_PLUGIN_NAME + FormulaLabel.name,- // props: {- // locale: 'formula.formula.sum',- // },- // },- // type: 5,- // show: CONFIG.show,- // tooltipLocale: 'formula.formulaLabel',- // children: [- // {- // locale: 'formula.formula.sum',- // suffix: 'SUM',- // },- // {- // locale: 'formula.formula.average',- // suffix: 'AVERAGE',- // },- // {- // locale: 'formula.formula.max',- // suffix: 'MAX',- // },- // {- // locale: 'formula.formula.min',- // suffix: 'MIN',- // border: true,- // },- // {- // locale: 'formula.formula.if',- // suffix: 'IF',- // },- // {- // locale: 'formula.formula.more',- // onClick: () => this._plugin.getSearchFormulaController().showFormulaModal('SearchFormula', true),- // },- // ],- // });-- // this._initialize();- }-- getDataModel() {- return this._formulaDataModel;- }-- setFormulaEngine(formulaEngineService: FormulaEngineService) {- this._formulaEngine = formulaEngineService;- }-- getFormulaEngine() {- return this._formulaEngine;- }-- toInterpreterCalculateProps(isRefresh = true) {- if (isRefresh || !this._interpreterCalculatePropsCache) {- this._interpreterCalculatePropsCache = this._toInterpreterCalculateProps();- }-- return this._interpreterCalculatePropsCache;- }-- getWorkbook() {- return this._currentUniverService.getCurrentUniverSheetInstance();- }-- getUnitId() {- return this.getWorkbook().getUnitId();- }-- addArrayFormulaData(value: ArrayFormulaDataType) {- this._formulaDataModel.setArrayFormulaData(value);-- this.clearArrayFormulaLineControl();- this.renderArrayFormulaLineControl();- }-- clearArrayFormulaLineControl() {- const arrayFormulaLineControls = this._arrayFormulaLineControls;- if (arrayFormulaLineControls.length > 0) {- for (const control of arrayFormulaLineControls) {- control.dispose();- }- }-- this._arrayFormulaLineControls = [];- }-- renderArrayFormulaLineControl() {- const arrayFormulaData = this._formulaDataModel.getArrayFormulaData();- const arrayFormula = arrayFormulaData[this._activeSheetId];- if (!arrayFormula) return;-- const currentCellData = this._selectionManagerService.getLast()?.primary;-- arrayFormula.forValue((r, c, v) => {- const { startRow, startColumn, endRow, endColumn } = v;- if (currentCellData) {- const { actualRow, actualColumn } = currentCellData;- if (- actualRow >= startRow &&- actualRow < endRow &&- actualColumn >= startColumn &&- actualColumn < endColumn- ) {- const arrayFormulaLineControl = this._sheetInjector.createInstance(- ArrayFormulaLineControl,- this._activeSheetId,- v- );- this._arrayFormulaLineControls.push(arrayFormulaLineControl);- }- }- });- }-- // private _initRegisterComponent() {- // // this._sheetPlugin.registerComponent(FORMULA_PLUGIN_NAME + FormulaLabel.name, FormulaLabel);- // this._plugin- // .getContext()- // .getUniver()- // .getGlobalContext()- // .getPluginManager()- // .getRequirePluginByName<SheetUIPlugin>(SHEET_UI_PLUGIN_NAME)- // .getAppUIController()- // .getSheetContainerController()- // .getMainSlotController()- // .addSlot(FORMULA_PLUGIN_NAME + FormulaLabel.name, {- // component: FormulaLabel,- // });- // }-- private _toInterpreterCalculateProps(): IInterpreterDatasetConfig {- const workbook = this;- const sheets = workbook.getWorkbook().getSheets();- const sheetData: SheetDataType = {};- const unitData: UnitDataType = {};- const sheetNameMap: SheetNameMapType = {};-- const currentUnitId = workbook.getUnitId();-- for (const sheet of sheets) {- sheetData[sheet.getSheetId()] = sheet.getCellMatrix();- sheetNameMap[sheet.getName()] = sheet.getSheetId();- }-- unitData[currentUnitId] = sheetData;-- const formulaData = this._formulaDataModel.getFormulaData();-- const activeSheet = workbook.getWorkbook().getActiveSheet();-- const rowCount = activeSheet.getRowCount();- const columnCount = activeSheet.getColumnCount();-- return {- unitData,- formulaData,- sheetNameMap,- currentRow: -1,- currentColumn: -1,- currentSheetId: '',- currentUnitId,- rowCount,- columnCount,- };- }-}diff --git a/packages/sheets-plugin-formula/src/Controller/FormulaPromptController.ts b/packages/sheets-plugin-formula/src/Controller/FormulaPromptController.tsdeleted file mode 100644index 0b66ef6121..0000000000--- a/packages/sheets-plugin-formula/src/Controller/FormulaPromptController.ts+++ /dev/null@@ -1,113 +0,0 @@-import { ComponentManager } from '@univerjs/base-ui';-import { Inject } from '@wendellhu/redi';--import { FunList } from '../Basics';-import { HelpFunction, SearchFunction } from '../View/UI/FormulaPrompt';-import { CellInputHandler } from './CellInputHandler';--export class FormulaPromptController {- // FIXME: strict initialization- cellInputHandler!: CellInputHandler;-- // FIXME: strict initialization- richTextEle!: HTMLElement;-- // FIXME: strict initialization- richTextEditEle!: HTMLElement;-- // FIXME: strict initialization- private _searchFunction!: SearchFunction;-- // FIXME: strict initialization- private _helpFunction!: HelpFunction;-- constructor(@Inject(ComponentManager) private _componentManager: ComponentManager) {- this._initialize();- }-- getSearchComponent(ref: SearchFunction) {- this._searchFunction = ref;- }-- getHelpComponent(ref: HelpFunction) {- this._helpFunction = ref;- }-- private _initialize() {- this._initRegisterComponent();- this._mount();- this._onRichTextKeyDownObservable();- this._onRichTextKeyUpObservable();- }-- private _initRegisterComponent() {- this._componentManager.register(SearchFunction.name, SearchFunction);- this._componentManager.register(HelpFunction.name, HelpFunction);- }-- private _mount() {- // const richTextEle = this._sheetContainerUIController.getCellEditorUIController()._richTextEle;- // this.richTextEle = richTextEle;- // this.richTextEditEle = $$('div', this.richTextEle);- // Register cell input formula support- // this.cellInputHandler = new CellInputHandler(this.richTextEditEle);- }-- private _onRichTextKeyDownObservable() {}-- private _onRichTextKeyUpObservable() {}-- private _update() {- this.cellInputHandler.searchFunction(this.richTextEditEle);- const formula = this.cellInputHandler.getFormula();- const helpFormula = this.cellInputHandler.getHelpFormula();- const height = parseInt(this.richTextEle.style.minHeight);- const width = parseInt(this.richTextEle.style.minWidth);- let left = parseInt(this.richTextEle.style.left);- let top = parseInt(this.richTextEle.style.top) + height;- // const sheetContainer = this._sheetContainerUIController.getContentRef().current;- const sheetContainer: any = null; // FIXME get container position?-- if (!sheetContainer) return;-- const screenW = sheetContainer.offsetWidth;- const screenH = sheetContainer.offsetHeight;- const position = { left, top };- const getPosition = (component: SearchFunction | HelpFunction) => {- const searchFunctionEle = component.getContentRef().current;-- if (!searchFunctionEle) return { left, top };-- const rootW = searchFunctionEle.offsetWidth;- const rootH = searchFunctionEle.offsetHeight;- const right = screenW - left > rootW;- const bottom = screenH - top > rootH;- if (!right) {- left -= rootW - width;- }- if (!bottom) {- top -= rootH + height;- }- return { left, top };- };-- if (formula[0]) {- this._searchFunction.updateState(true, formula, 0, position, () => {- const position = getPosition(this._searchFunction);- this._searchFunction.updateState(true, formula, 0, position);- });- this._helpFunction.updateState(false);- } else if (helpFormula[0]) {- const functionName = (helpFormula[0] as string).toUpperCase();- const functionInfo = FunList.find((item: any) => item.n === functionName) || {};- this._helpFunction.updateState(true, helpFormula[1] as number, functionInfo, position, () => {- const position = getPosition(this._helpFunction);- this._helpFunction.updateState(true, helpFormula[1] as number, functionInfo, position);- });- this._searchFunction.updateState(false);- } else {- this._searchFunction.updateState(false, formula);- this._helpFunction.updateState(false);- }- }-}diff --git a/packages/sheets-plugin-formula/src/Controller/SearchFormulaModalController.ts b/packages/sheets-plugin-formula/src/Controller/SearchFormulaModalController.tsdeleted file mode 100644index 7fa0cbbade..0000000000--- a/packages/sheets-plugin-formula/src/Controller/SearchFormulaModalController.ts+++ /dev/null@@ -1,145 +0,0 @@-import { ComponentManager } from '@univerjs/base-ui';-import { Inject } from '@wendellhu/redi';--import {- FORMULA_PLUGIN_NAME,- FormulaType,- FunList,- FunParams,- SearchFormulaModalData,- SelectCategoryType,-} from '../Basics';-import { SearchFormulaContent } from '../View/UI/SearchFormulaModal/SearchFormulaContent';-import { SearchItem } from '../View/UI/SearchFormulaModal/SearchItem';--export class SearchFormulaController {- private _modalData: SearchFormulaModalData[];-- // private _formulaModal!: SearchFormulaModal;-- private _funParams: FunParams;-- private _cellRangeModalData: SearchFormulaModalData;-- constructor(@Inject(ComponentManager) private readonly _componentManager: ComponentManager) {- this._funParams = {- funParams: {},- };- this._modalData = [- {- name: 'SearchFormula',- show: false,- group: [- {- label: 'button.confirm',- type: 'primary',- onClick: this.showSearchItemModal.bind(this),- },- {- label: 'button.cancel',- },- ],- onCancel: () => this.showFormulaModal('SearchFormula', false),- children: {- name: FORMULA_PLUGIN_NAME + SearchFormulaContent.name,- props: {- select: SelectCategoryType,- funList: {- onClick: this.selectFunParams.bind(this),- children: FunList,- },- },- },- },- {- name: 'SearchItem',- label: this._funParams,- show: false,- mask: false,- group: [- {- label: 'button.confirm',- type: 'primary',- },- {- label: 'button.cancel',- },- ],- onCancel: () => this.showFormulaModal('SearchItem', false),- children: {- name: FORMULA_PLUGIN_NAME + SearchItem.name,- props: {- funParams: this._funParams,- calcLocale: 'formula.formulaMore.calculationResult',- range: 'A1:B10',- },- },- },- ];-- this._cellRangeModalData = {- name: 'cellRangeModal',- titleLocale: 'formula.formulaMore.tipSelectDataRange',- show: false,- mask: false,- group: [- {- locale: 'button.confirm',- type: 'primary',- },- ],- onCancel: () => this.showFormulaModal('cellRangeModal', false),- children: {- props: {- placeholderLocale: '',- },- },- };- this._initialize();- }-- selectFunParams(value: FormulaType) {- this._funParams.funParams = value;- }-- showFormulaModal(name: string, show: boolean) {- const index = this._modalData.findIndex((item) => item.name === name);- if (index > -1) {- this._modalData[index].show = show;-- // this._formulaModal.setModal(this._modalData);- }- }-- showCellRangeModal(show: boolean) {- this._cellRangeModalData.show = show;- // const sheetPlugin = this._plugin.getPluginByName<SheetPlugin>(PLUGIN_NAMES.SPREADSHEET);- // const cellRangeModal = sheetPlugin?.getModalGroupControl().getModal(CellRangeModal.name);- // cellRangeModal.setModal(this._cellRangeModalData);- this.showFormulaModal('SearchItem', false);- }-- showSearchItemModal() {- this.showFormulaModal('SearchFormula', false);- this.showFormulaModal('SearchItem', true);- }-- private _initialize() {- this._initRegisterComponent();- }-- private _initRegisterComponent() {- // this._sheetContainerUIController- // .getMainSlotController()- // .addSlot(FORMULA_PLUGIN_NAME + SearchFormulaModal.name, {- // component: SearchFormulaModal,- // props: {- // getComponent: (ref: SearchFormulaModal) => {- // this._formulaModal = ref;- // },- // },- // });- this._componentManager.register(FORMULA_PLUGIN_NAME + SearchItem.name, SearchItem);- this._componentManager.register(FORMULA_PLUGIN_NAME + SearchFormulaContent.name, SearchFormulaContent);- }-}diff --git a/packages/sheets-plugin-formula/src/FormulaPlugin.tsx b/packages/sheets-plugin-formula/src/FormulaPlugin.tsxdeleted file mode 100644index 987b00afcc..0000000000--- a/packages/sheets-plugin-formula/src/FormulaPlugin.tsx+++ /dev/null@@ -1,68 +0,0 @@-import { FormulaEngineService } from '@univerjs/base-formula-engine';-import { LocaleService, Plugin, PluginType } from '@univerjs/core';-import { Dependency, Inject, Injector } from '@wendellhu/redi';--import { FORMULA_PLUGIN_NAME } from './Basics/Const/PLUGIN_NAME';-import { IFormulaConfig } from './Basics/Interfaces/IFormula';-import { FormulaController } from './Controller/FormulaController';-import { FormulaPromptController } from './Controller/FormulaPromptController';-import { SearchFormulaController } from './Controller/SearchFormulaModalController';-import { enUS } from './locale';--export class FormulaPlugin extends Plugin {- static override type = PluginType.Sheet;-- // protected _formulaActionExtensionFactory: FormulaActionExtensionFactory;-- private _formulaController!: FormulaController;-- private _searchFormulaController!: SearchFormulaController;-- private _formulaPromptController!: FormulaPromptController;-- constructor(- private _config: IFormulaConfig,- @Inject(Injector) override readonly _injector: Injector,- @Inject(LocaleService) private readonly _localeService: LocaleService- ) {- super(FORMULA_PLUGIN_NAME);-- this.initializeDependencies(this._injector);- }-- initialize(): void {- this._localeService.getLocale().load({- enUS,- });- }-- getFormulaEngine() {- return this._formulaController.getFormulaEngine();- }-- getFormulaController() {- return this._formulaController;- }-- getSearchFormulaController() {- return this._searchFormulaController;- }-- getFormulaPromptController() {- return this._formulaPromptController;- }-- private initializeDependencies(sheetInjector: Injector) {- const dependencies: Dependency[] = [[SearchFormulaController], [FormulaPromptController]];-- dependencies.forEach((d) => {- sheetInjector.add(d);- });-- this._searchFormulaController = this._injector.get(SearchFormulaController);- this._formulaPromptController = this._injector.get(FormulaPromptController);- this._formulaController = sheetInjector.createInstance(FormulaController, this._config);- sheetInjector.add([FormulaController, { useValue: this._formulaController }]);- sheetInjector.add([FormulaEngineService]);- }-}diff --git a/packages/sheets-plugin-formula/src/Model/Apply/SetFormulaRangeData.ts b/packages/sheets-plugin-formula/src/Model/Apply/SetFormulaRangeData.tsdeleted file mode 100644index 88578a029a..0000000000--- a/packages/sheets-plugin-formula/src/Model/Apply/SetFormulaRangeData.ts+++ /dev/null@@ -1,20 +0,0 @@-import { FormulaDataType } from '@univerjs/base-formula-engine';-import { Tools, Workbook } from '@univerjs/core';--import { FormulaController } from '../../Controller/FormulaController';--export function SetFormulaRangeData(- workbook: Workbook,- formulaData: FormulaDataType,- _formulaController: FormulaController-): FormulaDataType {- const formulaDataModel = _formulaController.getDataModel();-- // store old result- const result = Tools.deepClone(formulaDataModel.getFormulaData());-- // update- formulaDataModel.setFormulaData(formulaData);-- return result as FormulaDataType;-}diff --git a/packages/sheets-plugin-formula/src/Model/FormulaDataModel.ts b/packages/sheets-plugin-formula/src/Model/FormulaDataModel.tsdeleted file mode 100644index 1f36d46aa4..0000000000--- a/packages/sheets-plugin-formula/src/Model/FormulaDataModel.ts+++ /dev/null@@ -1,52 +0,0 @@-import { ArrayFormulaDataType, FormulaDataType } from '@univerjs/base-formula-engine';-import { ObjectMatrix } from '@univerjs/core';--import { IFormulaConfig, RecalculationModeType } from '../Basics/Interfaces/IFormula';--export class FormulaDataModel {- private _formulaData: FormulaDataType = {};-- private _arrayFormulaData: ArrayFormulaDataType = {};-- private _calculationChain: string[] = [];-- private _recalculationMode = RecalculationModeType.AUTOMATIC;-- constructor(config?: IFormulaConfig) {- if (config?.formulaData) {- this._formulaData = config.formulaData;- }-- if (config?.calculationChain) {- this._calculationChain = config.calculationChain;- }-- if (config?.recalculationMode) {- this._recalculationMode = config.recalculationMode;- }- }-- getFormulaData() {- return this._formulaData;- }-- setFormulaData(value: FormulaDataType) {- this._formulaData = value;- }-- getArrayFormulaData(): ArrayFormulaDataType {- return this._arrayFormulaData;- }-- setArrayFormulaData(value: ArrayFormulaDataType) {- Object.keys(value).forEach((sheetId) => {- const arrayFormula = value[sheetId];- if (!this._arrayFormulaData[sheetId]) {- this._arrayFormulaData[sheetId] = new ObjectMatrix();- }- arrayFormula.forValue((r, c, v) => {- this._arrayFormulaData[sheetId].setValue(r, c, v);- });- });- }-}diff --git a/packages/sheets-plugin-formula/src/Model/RegisterAction.ts b/packages/sheets-plugin-formula/src/Model/RegisterAction.tsdeleted file mode 100644index fcd5b81567..0000000000--- a/packages/sheets-plugin-formula/src/Model/RegisterAction.ts+++ /dev/null@@ -1,7 +0,0 @@-// TODO new formula command--// import { CommandManager } from '@univerjs/core';-// import { ACTION_NAMES } from '../Basics/Enum/ACTION_NAMES';-// import { SetFormulaRangeDataAction } from './Action/SetFormulaRangeDataAction';--// CommandManager.register(ACTION_NAMES.SET_FORMULA_RANGE_DATA_ACTION, SetFormulaRangeDataAction);diff --git a/packages/sheets-plugin-formula/src/Service/FormulaCacheLoader.ts b/packages/sheets-plugin-formula/src/Service/FormulaCacheLoader.tsdeleted file mode 100644index dde1cbba22..0000000000--- a/packages/sheets-plugin-formula/src/Service/FormulaCacheLoader.ts+++ /dev/null@@ -1,64 +0,0 @@-import { CellValueType, ICellData, IWorkbookConfig, ObjectMatrix } from '@univerjs/core';--type SheetDataType = { [sheetName: string]: ObjectMatrix<ICellData> };--type CellDataType = string | number | boolean;--export class FormulaCacheLoader {- // Workbook data- private _sheetData: SheetDataType = {};-- // Active worksheet name- private _activeSheetName: string = '';-- // 18.5.1.2 table (Table)- private _tableData: { [tableName: string]: string } = {};-- // 18.2.6 definedNames (Defined Names)- private _definedNames: { [name: string]: string } = {};-- // formula runtime data- private _sheetDataCache: SheetDataType = {};-- loadSheetData(workBookData: IWorkbookConfig) {}-- loadTableData(tableData: { [tableName: string]: string }) {}-- loadDefinedNames(definedNames: { [name: string]: string }) {}-- getSheetData(sheetName: string) {- return this._sheetData[sheetName];- }-- getActiveSheetData() {- return this._sheetData[this._activeSheetName];- }-- getTable(tableName: string) {- return this._tableData[tableName];- }-- getDefinedName(name: string) {- return this._definedNames[name];- }-- setSheetDataCache(sheetName: string, row: number, column: number, value: CellDataType, cellType: CellValueType) {- if (!this._sheetDataCache) {- this._sheetDataCache = {};- }-- if (!this._sheetDataCache[sheetName]) {- this._sheetDataCache[sheetName] = new ObjectMatrix<ICellData>();- }-- const sheetDataCacheActive = this._sheetDataCache[sheetName];- sheetDataCacheActive.setValue(row, column, {- v: value,- t: cellType,- });- }-- resetSheetDataCache() {- this._sheetDataCache = {};- }-}diff --git a/packages/sheets-plugin-formula/src/Service/index.ts b/packages/sheets-plugin-formula/src/Service/index.tsdeleted file mode 100644index 7f937b0e26..0000000000--- a/packages/sheets-plugin-formula/src/Service/index.ts+++ /dev/null@@ -1,7 +0,0 @@-/**- *- * en: Operate and register localData- *- * zh: 操作、注册localData- */-export * from './FormulaCacheLoader';diff --git a/packages/sheets-plugin-formula/src/Types/index.d.ts b/packages/sheets-plugin-formula/src/Types/index.d.tsdeleted file mode 100644index fcc24ab459..0000000000--- a/packages/sheets-plugin-formula/src/Types/index.d.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from '../index';-declare module '@univerjs/sheets-plugin-formula' {}diff --git a/packages/sheets-plugin-formula/src/View/Render/index.ts b/packages/sheets-plugin-formula/src/View/Render/index.tsdeleted file mode 100644index e69de29bb2..0000000000diff --git a/packages/sheets-plugin-formula/src/View/UI/FormulaLabel.tsx b/packages/sheets-plugin-formula/src/View/UI/FormulaLabel.tsxdeleted file mode 100644index e9360271bf..0000000000--- a/packages/sheets-plugin-formula/src/View/UI/FormulaLabel.tsx+++ /dev/null@@ -1,19 +0,0 @@-import { Component } from 'react';--interface IProps {- label: string;-}--export class FormulaLabel extends Component<IProps> {- override render() {- // const SumIcon = this._render.renderFunction('SumIcon');- const { label } = this.props;-- return (- <div style={{ display: 'flex', alignItems: 'center' }}>- {/* <Icon.Data.SumIcon /> */}- {label}- </div>- );- }-}diff --git a/packages/sheets-plugin-formula/src/View/UI/FormulaPrompt/HelpFunction.tsx b/packages/sheets-plugin-formula/src/View/UI/FormulaPrompt/HelpFunction.tsxdeleted file mode 100644index 488ab11b93..0000000000--- a/packages/sheets-plugin-formula/src/View/UI/FormulaPrompt/HelpFunction.tsx+++ /dev/null@@ -1,160 +0,0 @@-import { BaseComponentProps } from '@univerjs/base-ui';-import { Component, createRef } from 'react';--import { FormulaParamType, FormulaType } from '../../../Basics';-import styles from './index.module.less';--interface IProps extends BaseComponentProps {- funName: any;- paramIndex: number;-}--interface IState {- activeIndex: number;- functionInfo: FormulaType;- helpFormulaActive: boolean;- position: {- left: number;- top: number;- };-}--export class HelpFunction extends Component<IProps, IState> {- contentRef = createRef<HTMLDivElement>();-- constructor(props: IProps) {- super(props);- this.initialize();- }-- initialize() {- this.state = {- activeIndex: 0,- functionInfo: {},- helpFormulaActive: false,- position: {- left: 0,- top: 0,- },- };- }-- override UNSAFE_componentWillMount() {}-- override componentDidMount() {- this.props.getComponent?.(this);- }-- updateState(- helpFormulaActive: boolean,- activeIndex: number = 0,- functionInfo: FormulaType = {},- position = { left: 0, top: 0 },- cb?: () => void- ) {- this.setState(- {- helpFormulaActive,- functionInfo,- activeIndex,- position,- },- cb- );- }-- getState() {- return this.state;- }-- getContentRef() {- return this.contentRef;- }-- override render() {- const { activeIndex, functionInfo, helpFormulaActive, position } = this.state;-- return (- <div- className={styles.helpFunction}- style={{- display: helpFormulaActive ? 'block' : 'none',- position: 'absolute',- left: `${position.left}px`,- top: `${position.top}px`,- }}- ref={this.contentRef}- >- <div className={styles.helpFunctionTitle}>- <Help title={functionInfo.n} value={functionInfo.p} type="name" active={activeIndex} />- </div>- <div className={styles.helpFunctionContent}>- <div>{/* <CustomLabel label="formula.formulaMore.helpExample" /> */}</div>- <Help title={functionInfo.n} value={functionInfo.p} type="example" active={activeIndex} />- <Params- // title={(<CustomLabel label="formula.formulaMore.helpAbstract" />) as unknown as string}- // value={(<CustomLabel label={functionInfo.d} />) as unknown as string}- />- <>- {functionInfo &&- functionInfo.p &&- functionInfo.p.map((item: FormulaParamType, i: number) => (- <Params- key={i}- className={activeIndex === i ? styles.helpFunctionActive : ''}- // title={(<CustomLabel label={item.name} />) as unknown as string}- // value={(<CustomLabel label={item.detail} />) as unknown as string}- active={activeIndex}- />- ))}- </>- </div>- </div>- );- }-}--interface IParamsProps {- className?: string;- title?: string;- value?: string;- active?: number;-}--interface IParamsState {}--const Params = (props: IParamsProps) => (- <div className={`${styles.helpFunctionContentParams} ${props.className}`}>- <div className={styles.helpFunctionContentTitle}>{props.title}</div>- <div className={styles.helpFunctionContentDetail}>{props.value}</div>- </div>-);--interface IHelpProps {- title?: string;- value?: FormulaParamType[];- type: string;- active: number;-}--interface IHelpState {}--class Help extends Component<IHelpProps, IHelpState> {- override render() {- return (- <div>- <span>- {this.props.title}- {'('}- </span>- {this.props.value &&- this.props.value.map((item: FormulaParamType, i: number) => (- <span key={i} className={this.props.active === i ? styles.helpFunctionActive : ''}>- {/* <CustomLabel label={(item as IKeyValue)[`${this.props.type}`]} />, */}- </span>- ))}- <span>{')'}</span>- </div>- );- }-}diff --git a/packages/sheets-plugin-formula/src/View/UI/FormulaPrompt/SearchFunction.tsx b/packages/sheets-plugin-formula/src/View/UI/FormulaPrompt/SearchFunction.tsxdeleted file mode 100644index 158cc19652..0000000000--- a/packages/sheets-plugin-formula/src/View/UI/FormulaPrompt/SearchFunction.tsx+++ /dev/null@@ -1,99 +0,0 @@-import { BaseComponentProps } from '@univerjs/base-ui';-import { IKeyValue } from '@univerjs/core';-import { Component, createRef } from 'react';--import styles from './index.module.less';--interface IProps extends BaseComponentProps {}--interface IState {- lang: string;- locale: [];- formulaValue: string;- formula: IKeyValue[];- functionList: any;- selectIndex: number;- searchActive: boolean;- position: {- left: number;- top: number;- };-}--export class SearchFunction extends Component<IProps, IState> {- contentRef = createRef<HTMLUListElement>();-- constructor(props: IProps) {- super(props);- this.initialize();- }-- initialize() {- this.state = {- lang: '',- locale: [],- formulaValue: '',- functionList: [],- selectIndex: 0,- formula: [],- searchActive: false,- position: {- left: 0,- top: 0,- },- };- }-- override componentDidMount() {- this.props.getComponent?.(this);- }-- override componentWillUpdate(nextProps: any) {}-- getContentRef() {- return this.contentRef;- }-- /**- *- * @param searchActive- * @param formula- * @param selectIndex- */- updateState(- searchActive: boolean,- formula: IKeyValue[] = [],- selectIndex: number = 0,- position = { left: 0, top: 0 },- cb?: () => void- ) {- this.setState({ searchActive, formula, selectIndex, position }, cb);- }-- getState() {- return this.state;- }-- override render() {- const { selectIndex, formula, searchActive, position } = this.state;- return (- <ul- className={styles.searchFunction}- style={{- display: searchActive ? 'block' : 'none',- position: 'absolute',- left: `${position.left}px`,- top: `${position.top}px`,- }}- ref={this.contentRef}- >- {formula.map((item: any, i: number) => (- <li key={i} className={selectIndex === i ? styles.searchFunctionActive : ''}>- <div className={styles.formulaName}>{item.n}</div>- <div className={styles.formulaDetail}>{/* <CustomLabel label={item.d} /> */}</div>- </li>- ))}- </ul>- );- }-}diff --git a/packages/sheets-plugin-formula/src/View/UI/FormulaPrompt/index.module.less b/packages/sheets-plugin-formula/src/View/UI/FormulaPrompt/index.module.lessdeleted file mode 100644index 74352bd675..0000000000--- a/packages/sheets-plugin-formula/src/View/UI/FormulaPrompt/index.module.less+++ /dev/null@@ -1,56 +0,0 @@-.search-function {- background-color: var(--bg);- border: 1px solid rgba(0, 0, 0, 0.2);- box-shadow: 0 2px 4px rgb(0 0 0 / 20%);- font-size: 14px;- z-index: 6;- width: 300px;- list-style: none;- margin: 0;- padding: 0;- > li {- padding: 5px 10px;- }- .formula-detail {- display: none;- }- .search-function-active {- background-color: var(--bg-hover);-- .formula-detail {- display: block;- }- }-}--.help-function {- background-color: var(--bg);- border: 1px solid rgba(0, 0, 0, 0.2);- box-shadow: 0 2px 4px rgb(0 0 0 / 20%);- font-size: 14px;- z-index: 6;- width: 300px;-- .help-function-title {- padding: 5px 15px;- background-color: #f5f5f5;- border-bottom: 1px solid #ebebeb;- }- .help-function-content {- max-height: 300px;- overflow-y: scroll;- padding: 1px 15px;- .help-function-content-params {- margin: 15px 0;- .help-function-content-title {- color: #666;- }- .help-function-content-detail {- font-size: 12px;- }- }- }- .help-function-active {- background-color: #fff9b2;- }-}diff --git a/packages/sheets-plugin-formula/src/View/UI/FormulaPrompt/index.ts b/packages/sheets-plugin-formula/src/View/UI/FormulaPrompt/index.tsdeleted file mode 100644index 6a93ca5311..0000000000--- a/packages/sheets-plugin-formula/src/View/UI/FormulaPrompt/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './HelpFunction';-export * from './SearchFunction';diff --git a/packages/sheets-plugin-formula/src/View/UI/IfGenerate/ifGenerate.tsx b/packages/sheets-plugin-formula/src/View/UI/IfGenerate/ifGenerate.tsxdeleted file mode 100644index 8c1713bc72..0000000000--- a/packages/sheets-plugin-formula/src/View/UI/IfGenerate/ifGenerate.tsx+++ /dev/null@@ -1,138 +0,0 @@-import { AppContext } from '@univerjs/base-ui';-import { Nullable, Observer, Workbook } from '@univerjs/core';-import { Component } from 'react';--import { IConfig } from '../../../Basics/Interfaces/IFormula';--interface IProps {- visible: boolean;- onOk: () => void;- onCancel: (e: React.MouseEvent<HTMLSpanElement, MouseEvent>) => void;- config: IConfig;-}--interface IState {- option: Array<{ key: number; value: string }>;- divisionMode: string;- locale: any;-}--class IfGenerate extends Component<IProps, IState> {- static override contextType = AppContext;-- private _localeObserver: Nullable<Observer<Workbook>>;-- constructor(props: IProps) {- super(props);-- // super(props);- this.state = {- option: [- { key: 1, value: '划分值相同' },- { key: 2, value: '划分为N份' },- { key: 3, value: '自定义输入' },- ],- divisionMode: '',- locale: null,- };- }-- /**- * init- */- override UNSAFE_componentWillMount() {- this.setLocale();- }-- setLocale() {- const localeService = (this.context as any).injector!.get('localeService');- const locale = localeService.getLocale().get('formula');-- this.setState({ locale });- }-- override render() {- const { locale } = this.state;- return (- // <Modal- // title={locale.formula.if}- // width={320}- // isDrag={true}- // footer={false}- // visible={this.props.visible}- // onCancel={this.props.onCancel}- // >- // <div className={styles.ifGenerate}>- // <div>- // <div className={styles.label}>{locale.ifFormula.ifGenCompareValueTitle}</div>- // <div className={styles.input}>- // <input type="text" />- // </div>- // </div>- // <div>- // <div className={styles.label}>{locale.ifFormula.ifGenRangeTitle}</div>- // <div className={styles.inputSection}>- // <div className={styles.input}>- // <input type="text" />- // </div>- // <div> {locale.ifFormula.ifGenRangeTo} </div>- // <div className={styles.input}>- // <input type="text" />- // </div>- // </div>- // <div className={styles.input}>- // <input type="text" />- // </div>- // </div>- // <div>- // <div className={styles.label}>{locale.ifFormula.ifGenCutWay}</div>- // <div className={styles.inputSection}>- // {/* <Select- // options={this.state.option}- // onChange={(val) => {- // this.setState({ divisionMode: val.value });- // }}- // /> */}- // <Select children={this.state.option as unknown as BaseSelectProps[]}></Select>- // <div className={styles.input} style={{ marginLeft: '10px' }}>- // <input type="text" />- // </div>- // </div>- // <div- // style={{- // textAlign: 'center',- // backgroundColor: '#1890ff',- // color: '#fff',- // fontSize: '14px',- // padding: '5px',- // borderRadius: '3px',- // }}- // >- // {locale.ifFormula.ifGenCutSame}- // </div>- // </div>- // <div className={styles.ifGenerateCode}>- // <div className={styles.input}>- // <input type="text" placeholder={locale.ifFormula.ifGenTipLableTitile} />- // </div>- // <div className={styles.inputGroup}>- // <input className={styles.inputGroupBig} type="text" />- // <input className={styles.inputGroupSmall} type="text" />- // <span>E6</span>- // <input className={styles.inputGroupSmall} type="text" />- // <input className={styles.inputGroupBig} type="text" />- // </div>- // </div>- // <div className={styles.btnGroup}>- // <Button className={`${styles.cancelBtn} ${styles.btn}`}>{locale.cancel}</Button>- // <Button className={`${styles.cleanBtn} ${styles.btn}`}>{locale.ClearValidation}</Button>- // <Button className={`${styles.okBtn} ${styles.btn}`}>{locale.ok}</Button>- // </div>- // </div>- // </Modal>- <></>- );- }-}--export { IfGenerate };diff --git a/packages/sheets-plugin-formula/src/View/UI/IfGenerate/index.module.less b/packages/sheets-plugin-formula/src/View/UI/IfGenerate/index.module.lessdeleted file mode 100644index 33c5492aca..0000000000--- a/packages/sheets-plugin-formula/src/View/UI/IfGenerate/index.module.less+++ /dev/null@@ -1,78 +0,0 @@-.if-generate {- > div {- margin: 10px 0;-- .label {- font-size: 14px;- font-weight: bold;- margin-bottom: 10px;- }-- .inputSection {- display: flex;- align-items: center;- margin-bottom: 10px;-- .self-input {- height: 28px;- }- }- }-- .if-generate-code {- display: block;- border: 1px solid var(--gray-5);- overflow: auto;- max-height: 110px;- padding: 5px;-- .input-Group {- display: flex;- margin-top: 10px;- justify-content: space-between;-- .input-Group-big {- width: 60px;- }-- .input-Group-small {- width: 30px;- }-- input {- font-size: 12px;- border: none;- background-color: var(--gray-2);- outline: 1px solid var(--gray-5);- padding: 0 5px;- }- }- }-- .input {- border: 1px solid var(--gray-5);- padding: 5px;- border-radius: 3px;- display: flex;-- input {- width: 100%;- border: none;- outline: none;- background-color: var(--gray-2);- }- }-}--.if-generate .btnGroup {- margin: 0;- display: flex;- justify-content: space-between;-- .btn {- text-align: center;- padding: 0 5px;- border-radius: 3px;- font-size: 14px;- }-}diff --git a/packages/sheets-plugin-formula/src/View/UI/IfGenerate/index.ts b/packages/sheets-plugin-formula/src/View/UI/IfGenerate/index.tsdeleted file mode 100644index de0e8519bb..0000000000--- a/packages/sheets-plugin-formula/src/View/UI/IfGenerate/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './ifGenerate';diff --git a/packages/sheets-plugin-formula/src/View/UI/SearchFormulaModal/SearchFormulaContent.tsx b/packages/sheets-plugin-formula/src/View/UI/SearchFormulaModal/SearchFormulaContent.tsxdeleted file mode 100644index cb3df090c5..0000000000--- a/packages/sheets-plugin-formula/src/View/UI/SearchFormulaModal/SearchFormulaContent.tsx+++ /dev/null@@ -1,172 +0,0 @@-import { BaseComponentProps, debounce, Input, Select } from '@univerjs/base-ui';-import { Component, createRef } from 'react';--import { FormulaType, FunListILabel, Label } from '../../../Basics';-import styles from './index.module.less';--interface IProps extends BaseComponentProps {- select: Label[];- funList: FunListILabel;-}--interface IState {- functionList: FormulaType[] | undefined;- type: number;-}--export class SearchFormulaContent extends Component<IProps, IState> {- functionListRef = createRef<HTMLDivElement>();-- constructor(props: IProps) {- super(props);- this.initialize();- }-- initialize() {- this.state = {- functionList: undefined,- type: 0,- };- }-- changeInput(e: Event) {- const value = (e.target as HTMLInputElement).value;- let { functionList } = this.state;- const { type } = this.state;- if (value) {- functionList = functionList?.filter((item) => {- if (item.n?.includes(value) || item.d?.includes(value)) {- return item;- }- return null;- });- } else {- functionList = this.props.funList.children?.filter((item) => item.t === type);- }-- this.setState({- functionList,- });- }-- selectType(value: string, index: number) {- const { funList } = this.props;- const functionList = funList.children?.filter((item) => item.t === index);- this.setState(- {- functionList: this.getFunctionList(functionList ?? []),- type: index,- },- () => {- this.highLightLi(0);- }- );- }-- override componentDidMount() {- const functionList = this.getFunctionList(this.props.funList.children?.filter((item) => item.t === 0) ?? []);- this.setState(- {- functionList,- type: 0,- },- () => {- this.highLightLi(0);- }- );- }-- highLightLi(index: number) {- const item = this.functionListRef.current?.querySelectorAll(`.${styles.functionListsItem}`);- if (!item) return;-- for (let i = 0; i < item.length; i++) {- item[i].classList.remove(styles.functionListsItemActive);- }- (item[index] as HTMLElement).classList.add(styles.functionListsItemActive);- (item[index] as HTMLElement).click();- }-- handleClick(item: FormulaType, index: number) {- const { funList } = this.props;- this.highLightLi(index);- funList.onClick(item);- }-- /**- * 国际化- */- getSelect(): Array<{ label: string | JSX.Element }> {- const { select } = this.props;- const arr: Array<{ label: string | JSX.Element }> = [];- for (let i = 0; i < select.length; i++) {- // arr.push({- // label: <CustomLabel label={select[i].label} />,- // });- }- return arr;- }-- getFunctionList(list: FormulaType[]) {- const functionList = JSON.parse(JSON.stringify(list));- for (let i = 0; i < functionList.length; i++) {- for (const k in functionList[i]) {- if (functionList[i][k] instanceof Array) {- functionList[i][k] = this.getFunctionList(functionList[i][k]);- } else if (typeof functionList[i][k] === 'string') {- // functionList[i][k] = <CustomLabel label={functionList[i][k]} />;- }- }- }- return functionList as FormulaType[];- }-- override render() {- const { functionList } = this.state;-- return (- <div className={styles.functionModal}>- <div className={styles.functionSearch}>- <div className={styles.functionLabel}>- {/* <CustomLabel label="formula.formulaMore.findFunctionTitle" />; */}- </div>- <Input- // placeholder={- // (<CustomLabel label="formula.formulaMore.tipInputFunctionName" />) as unknown as string- // }- onChange={debounce(this.changeInput.bind(this), 50)}- />- </div>- <div className={styles.functionSelect}>- <div className={styles.functionLabel}>- {/* <CustomLabel label="formula.formulaMore.selectCategory" /> */}- </div>- <div className={styles.functionSelector}>- <Select- onClick={this.selectType.bind(this)}- children={this.getSelect()}- hideSelectedIcon={true}- ></Select>- </div>- </div>- <div className={styles.functionList} ref={this.functionListRef}>- <div className={styles.functionLabel}>- {/* <CustomLabel label="formula.formulaMore.selectFunctionTitle" /> */}- </div>- <ul className={styles.functionLists}>- {functionList?.map((item, index) => (- <li- key={index}- className={`${styles.functionListsItem}`}- onClick={() => this.handleClick(item, index)}- >- <div className={styles.functionListsItemName}>{item.n}</div>- <div className={styles.functionListsItemDetail}>{item.d}</div>- </li>- ))}- </ul>- </div>- </div>- );- }-}diff --git a/packages/sheets-plugin-formula/src/View/UI/SearchFormulaModal/SearchFormulaModal.tsx b/packages/sheets-plugin-formula/src/View/UI/SearchFormulaModal/SearchFormulaModal.tsxdeleted file mode 100644index 83c1597f21..0000000000--- a/packages/sheets-plugin-formula/src/View/UI/SearchFormulaModal/SearchFormulaModal.tsx+++ /dev/null@@ -1,69 +0,0 @@-import { BaseComponentProps } from '@univerjs/base-ui';-import { Component } from 'react';--import { SearchFormulaModalData } from '../../../Basics/Interfaces/IFormula';--interface IProps extends BaseComponentProps {}--interface IState {- modalData: SearchFormulaModalData[];-}--export class SearchFormulaModal extends Component<IProps, IState> {- constructor(props: IProps) {- super(props);- this.initialize();- }-- initialize() {- this.state = {- modalData: [],- };- }-- override componentDidMount() {- this.props.getComponent?.(this);- }-- setModal(modalData: SearchFormulaModalData[]) {- const componentManager = (this.context as any).injector!.get('componentManager');-- modalData.forEach((item) => {- const Label = componentManager?.get(item.children.name!);- if (Label) {- const props = item.children.props ?? {};- item.modal = <Label {...props} />;- }- });-- this.setState({- modalData,- });- }-- override render() {- const { modalData } = this.state;- // Set Provider for entire Container- return (- <>- {modalData.map((item, index) => {- if (!item.show) return;- return (- // <Modal- // key={index}- // isDrag={true}- // mask={item.mask}- // title={item.label?.funParams.n}- // visible={item.show}- // group={item.group as ModalButtonGroup[]} // FIXME type error- // onCancel={item.onCancel}- // >- // {item.modal}- // </Modal>- <></>- );- })}- </>- );- }-}diff --git a/packages/sheets-plugin-formula/src/View/UI/SearchFormulaModal/SearchItem.tsx b/packages/sheets-plugin-formula/src/View/UI/SearchFormulaModal/SearchItem.tsxdeleted file mode 100644index d7c45bf4ec..0000000000--- a/packages/sheets-plugin-formula/src/View/UI/SearchFormulaModal/SearchItem.tsx+++ /dev/null@@ -1,109 +0,0 @@-import { BaseComponentProps } from '@univerjs/base-ui';-import { Component } from 'react';--import { FormulaParamType, FunParams } from '../../../Basics';-import styles from './index.module.less';--interface IProps extends BaseComponentProps {- funParams: FunParams;- calc: string;-}--interface IState {- description: FormulaParamType;- rangeList: string[];- index: number;-}--export class SearchItem extends Component<IProps, IState> {- constructor(props: IProps) {- super(props);- this.initialize();- }-- initialize() {- this.state = {- description: {},- rangeList: [],- index: 0,- };- }-- override componentDidMount() {- const { funParams } = this.props;- const description = funParams?.funParams.p?.[0];-- if (!description) return;-- this.setState({- description,- });- }-- handleClick(index: number) {- const { funParams } = this.props;- const description = funParams?.funParams.p?.[index];-- if (!description) return;-- this.setState({- description,- index,- });- }-- changeRange(range: string) {- const { index, rangeList } = this.state;- rangeList[index] = range;- this.setState({- rangeList,- });- }-- override render() {- const { funParams, calc } = this.props;- const { description, rangeList } = this.state;-- if (!funParams) return;-- return (- <div className={styles.functionParamModal}>- <div className={styles.functionParamList}>- {funParams.funParams?.p?.map((item, index) => (- <div key={index}>- <span>{item.name}:</span>- <div onClick={() => this.handleClick(index)}>- {/* <CellRange- contentPlaceholder={- (- <CustomLabel label="formula.formulaMore.tipDataRangeTitle" />- ) as unknown as string- }- title={- (- <CustomLabel label="formula.formulaMore.tipSelectDataRange" />- ) as unknown as string- }- value={rangeList[index]}- onClick={() => {}}- /> */}- </div>- <span>={'{}'}</span>- </div>- ))}- </div>- <div className={styles.functionParamDesc}>- <div className={styles.functionParamDescDetail}>{funParams.funParams?.d}</div>- <div className={styles.functionParamDescDetails}>- <p>- {description.name}: {description.detail}- </p>- </div>- </div>- <div className={styles.functionParamResult}>- {calc}={}- </div>- </div>- );- }-}diff --git a/packages/sheets-plugin-formula/src/View/UI/SearchFormulaModal/index.module.less b/packages/sheets-plugin-formula/src/View/UI/SearchFormulaModal/index.module.lessdeleted file mode 100644index f9a46c1482..0000000000--- a/packages/sheets-plugin-formula/src/View/UI/SearchFormulaModal/index.module.less+++ /dev/null@@ -1,128 +0,0 @@-.function-modal {- font-size: 14px;-- >div {- margin-bottom: 10px;- }-- .function-search {- input {- width: 100%;- height: 24px;- line-height: 24px;- border: 1px solid #d4d4d4;- padding: 0 10px;- box-sizing: border-box;- font-size: 12px;- }- }-- .function-select {- display: flex;- align-items: center;-- .function-label {- margin-bottom: 0;- }-- .function-selector {- border: 1px solid var(--border-color);- border-radius: var(--border-radius-base);-- .select-component {- height: auto;- margin: 0;- }-- .select-button {- margin: 0;- }- }- }-- .function-list {- .function-lists {- width: 100%;- height: 170px;- border: 1px solid #d4d4d4;- overflow-y: auto;- margin: 0;- padding: 0;-- .function-lists-item {- padding: 5px;- border-bottom: 1px solid #d4d4d4;- cursor: pointer;- list-style: none;-- .function-lists-item-name {}-- .function-lists-item-detail {}-- &-active {- background-color: var(--primary-color);- color: #fff;- }-- &:hover {- background-color: var(--primary-color-hover);- color: #fff;- }- }- }- }-- .function-label {- margin-right: 10px;- margin-bottom: 10px;- }-}--.function-param-modal {- .function-param-list {- border: 1px solid;- padding: 0.5 em;-- >div {- display: flex;- padding: 5px 0;-- >span {- flex: 1;-- &:first-child {- text-align: right;- }- }-- input {- flex: 1;- }- }- }-- .function-param-desc {- margin: 1em 0;-- .function-param-desc-detail {}-- .function-param-desc-details {- padding: 10px;- height: 100px;- overflow: auto;- margin-top: 1em;- box-sizing: border-box;- font-size: 12px;- }- }-- .function-param-result {}-}--.function-btn {- .btn {- padding: 5px;- line-height: 1;- font-size: 14px;- }-}\ No newline at end of filediff --git a/packages/sheets-plugin-formula/src/View/UI/SearchFormulaModal/index.ts b/packages/sheets-plugin-formula/src/View/UI/SearchFormulaModal/index.tsdeleted file mode 100644index 8327037e0f..0000000000--- a/packages/sheets-plugin-formula/src/View/UI/SearchFormulaModal/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './SearchFormulaModal';diff --git a/packages/sheets-plugin-formula/src/index.ts b/packages/sheets-plugin-formula/src/index.tsdeleted file mode 100644index 797623be5c..0000000000--- a/packages/sheets-plugin-formula/src/index.ts+++ /dev/null@@ -1,5 +0,0 @@-/* eslint-disable import/first */-import './Model/RegisterAction';--export * from './Basics';-export * from './FormulaPlugin';diff --git a/packages/sheets-plugin-formula/src/locale/en-US.ts b/packages/sheets-plugin-formula/src/locale/en-US.tsdeleted file mode 100644index 512b455903..0000000000--- a/packages/sheets-plugin-formula/src/locale/en-US.ts+++ /dev/null@@ -1,312 +0,0 @@-export default {- formula: {- formulaLabel: 'SUM',- formulaRightLabel: 'more formule',- ok: 'Ok',- cancel: 'Cancel',- clearValidation: 'Clear Validation',- formula: {- sum: 'sum',- average: 'average',- count: 'count',- max: 'max',- min: 'min',- if: 'If formula generator',- more: 'More functions...',- },- functionList: {- SUMIF: {- d: 'Returns a conditional sum across a range.',- p: {- range: {- name: 'range',- detail: 'The range which is tested against `criterion`.',- },- rangeAll: {- name: 'criterion',- detail: 'The pattern or test to apply to `range`.',- },- range1: {- name: 'sum_range',- detail: 'The range to be summed, if different from `range`.',- },- },- },- TAN: {- d: 'Returns the tangent of an angle provided in radians.',- p: {- rangeNumber: {- name: 'angle',- detail: 'The angle to find the tangent of, in radians.',- },- },- },- TANH: {- d: 'Returns the hyperbolic tangent of any real number.',- p: {- rangeNumber: {- name: 'value',- detail: 'Any real value to calculate the hyperbolic tangent of.',- },- },- },- CEILING: {- d: 'Rounds a number up to the nearest integer multiple of specified significance `factor`.',- p: {- rangeNumber: {- name: 'value',- detail: 'The value to round up to the nearest integer multiple of `factor`.',- },- rangeNumber1: {- name: 'factor',- detail: 'The number to whose multiples `value` will be rounded.',- },- },- },- ATAN: {- d: 'Returns the inverse tangent of a value, in radians.',- p: {- rangeNumber: {- name: 'value',- detail: 'The value for which to calculate the inverse tangent.',- },- },- },- ASINH: {- d: 'Returns the inverse hyperbolic sine of a number.',- p: {- rangeNumber: {- name: 'value',- detail: 'The value for which to calculate the inverse hyperbolic sine.',- },- },- },- ABS: {- d: 'Returns the absolute value of a number.',- p: {- rangeNumber: {- name: 'value',- detail: 'The number of which to return the absolute value.',- },- },- },- COUNTBLANK: {- d: 'Returns the number of empty values in a list of values and ranges.',- p: {- range: {- name: 'value1',- detail: 'The first value or range in which to count the number of blanks.',- },- },- },- COSH: {- d: 'Returns the hyperbolic cosine of any real number.',- p: {- rangeNumber: {- name: 'value',- detail: 'Any real value to calculate the hyperbolic cosine of.',- },- },- },- COUNTIF: {- d: 'Returns a conditional count across a range.',- p: {- range: {- name: 'range',- detail: 'The range that is tested against `criterion`.',- },- rangeAll: {- name: 'criterion',- detail: 'The pattern or test to apply to `range`.',- },- },- },- ERFC: {- d: 'Returns the complementary Gauss error function of a value.',- p: {- rangeNumber: {- name: 'z',- detail: 'The number for which to calculate the complementary Gauss error function.',- },- },- },- VLOOKUP: {- d: 'Vertical lookup. Searches down the first column of a range for a key and returns the value of a specified cell in the row found.',- p: {- rangeAll: {- name: 'search_key',- detail: 'The value to search for. For example, `42`, `"Cats"`, or `I24`.',- },- rangeAll1: {- name: 'range',- detail: 'The range to consider for the search. The first column in the range is searched for the key specified in `search_key`. ',- },- rangeNumber: {- name: 'index',- detail: 'The column index of the value to be returned, where the first column in `range` is numbered 1.',- },- rangeAll2: {- name: 'is_sorted',- detail: 'Indicates whether the column to be searched (the first column of the specified range) is sorted, in which case the closest match for `search_key` will be returned.',- },- },- },- TIME: {- d: 'Converts a provided hour, minute, and second into a time.',- p: {- rangeNumber: {- name: 'hour',- detail: '0The hour component of the time.',- },- rangeNumber1: {- name: 'minute',- detail: 'The minute component of the time.',- },- rangeNumber2: {- name: 'second',- detail: 'The second component of the time.',- },- },- },- EFFECT: {- d: 'Calculates the annual effective interest rate given the nominal rate and number of compounding periods per year.',- p: {- rangeNumber: {- name: 'nominal_rate',- detail: 'The nominal interest rate per year.',- },- rangeNumber1: {- name: 'periods_per_year',- detail: 'The number of compounding periods per year.',- },- },- },- BIN2DEC: {- d: 'Converts a signed binary number to decimal format.',- p: {- rangeAll: {- name: 'signed_binary_number',- detail: 'The signed 10-bit binary value to be converted to decimal, provided as a string.',- },- },- },- TRUE: {- d: 'Returns the logical value `TRUE`.',- },- NE: {- d: 'Returns `TRUE` if two specified values are not equal and `FALSE` otherwise. Equivalent to the `!=` operator.',- p: {- rangeAll: {- name: 'value1',- detail: 'The first value.',- },- rangeAll1: {- name: 'value2',- detail: 'The value to test against `value1` for inequality.',- },- },- },- SEX_BY_IDCARD: {- d: 'Calculate gender based on Chinese ID number. Support 15 or 18',- p: {- rangeAll: {- name: 'ID number',- detail: '15-digit or 18-digit ID number or range.',- },- },- },- },- functiontype: {- '0': 'Math',- '1': 'Statistical',- '2': 'Lookup',- '3': 'UniverSheet',- '4': 'Data Mining',- '5': 'Database',- '6': 'Date',- '7': 'Filter',- '8': 'Financial',- '9': 'Engineering',- '10': 'Logical',- '11': 'Operator',- '12': 'Text',- '13': 'Parser',- '14': 'Array',- '15': 'Other',- },- formulaMore: {- valueTitle: 'Value',- tipSelectDataRange: 'Select data range',- tipDataRangeTitle: 'Data range',- findFunctionTitle: 'Search function',- tipInputFunctionName: 'Function name or brief description of function',- whole: 'Whole',-- Math: 'Math',- Statistical: 'Statistical',- Lookup: 'Lookup',- universheet: 'UniverSheet',- dataMining: 'Data Mining',- Database: 'Database',- Date: 'Date',- Filter: 'Filter',- Financial: 'Financial',- Engineering: 'Engineering',- Logical: 'Logical',- Operator: 'Operator',- Text: 'Text',- Parser: 'Parser',- Array: 'Array',- other: 'Other',-- selectFunctionTitle: 'Select a function',- calculationResult: 'Result',-- tipSuccessText: 'Success',- tipParamErrorText: 'Parameter type error',-- helpClose: 'Close',- helpCollapse: 'Collapse',- helpExample: 'Example',- helpAbstract: 'Abstract',-- execfunctionError: 'Error in the formula',- execfunctionSelfError: 'The formula cannot refer to its own cell',- execfunctionSelfErrorResult:- 'The formula cannot refer to its own cell, which will lead to inaccurate calculation results',-- allowRepeatText: 'Repeat',- allowOptionText: 'Option',-- selectCategory: 'Or select a category',- },- ifFormula: {- tipNotBelongToIf: 'This cell function does not belong to the if formula!',- tipSelectCell: 'Please select the cell to insert the function',-- ifGenCompareValueTitle: 'Comparison value',- ifGenSelectCellTitle: 'Click to select cell',- ifGenRangeTitle: 'Range',- ifGenRangeTo: 'to',- ifGenRangeEvaluate: 'Range evaluate',- ifGenSelectRangeTitle: 'Click to select range',- ifGenCutWay: 'Partition way',- ifGenCutSame: 'Same Partition value',- ifGenCutNpiece: 'Partition by N',- ifGenCutCustom: 'Custom',- ifGenCutConfirm: 'Confirm',-- ifGenTipSelectCell: 'Select cells',- ifGenTipSelectCellPlace: 'Please select cells',-- ifGenTipSelectRange: 'Select range',- ifGenTipSelectRangePlace: 'Please select range',-- ifGenTipNotNullValue: 'The comparison value cannot be empty!',- ifGenTipLableTitile: 'Label',- ifGenTipRangeNotforNull: 'The range cannot be empty!',- ifGenTipCutValueNotforNull: 'The partition value cannot be empty!',- ifGenTipNotGenCondition: 'No conditions are available for generation!',- },- },-};diff --git a/packages/sheets-plugin-formula/src/locale/index.ts b/packages/sheets-plugin-formula/src/locale/index.tsdeleted file mode 100644index b0b1d48d5d..0000000000--- a/packages/sheets-plugin-formula/src/locale/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export { default as enUS } from './en-US';-export { default as zhCN } from './zh-CN';diff --git a/packages/sheets-plugin-formula/src/locale/zh-CN.ts b/packages/sheets-plugin-formula/src/locale/zh-CN.tsdeleted file mode 100644index 5828658362..0000000000--- a/packages/sheets-plugin-formula/src/locale/zh-CN.ts+++ /dev/null@@ -1,293 +0,0 @@-export default {- formula: {- formulaLabel: '求和',- formulaRightLabel: '更多公式',- ok: '确定',- cancel: '取消',- clearValidation: '清除验证',- formula: {- sum: '求和',- average: '平均值',- count: '计数',- max: '最大值',- min: '最小值',- if: 'if公式生成器',- more: '更多函数...',- },- functionList: {- SUMIF: {- d: '对范围中符合指定条件的值求和。',- p: {- range: {- name: '范围',- detail: '要根据条件进行检测的范围。',- },- rangeAll: {- name: '条件',- detail: '要应用于范围的模式或测试条件。\n\n如果范围包含的是要检测的文本,则条件必须为字符串。条件可以包含通配符,包括用于匹配单个字符的?或用于匹配零个或连续多个字符的*。要匹配问号星号本身,请在该字符前面加上波浪号(~)前缀(即~?和~*)。字符串条件必须用引号括起来。函数会检查范围中的每个单元格与条件是否相等或匹配(如果使用了通配符)。\n\n如果范围包含的是要检测的数字,则条件可以是字符串也可以是数字。如果给定的条件是一个数字,则检查范围中的每个单元格是否等于条件。另外,条件也可能是包含数字的字符串(也将对其进行相等检测),或者带有以下前缀的数字:=(检查是否相等)、>(检查范围单元格的值是否大于条件值)或<(检查范围单元格的值是否小于条件值)',- },- range1: {- name: '求和范围',- detail: '要求和的范围(如果与范围不同)。',- },- },- },- TAN: {- d: '返回已知角度的正切值。',- p: {- rangeNumber: {- name: '角度',- detail: '要求其正切值的角度,以弧度表示。',- },- },- },- TANH: {- d: '返回给定实数的双曲正切值。',- p: {- rangeNumber: {- name: '值',- detail: '要计算其双曲正切值的实数。',- },- },- },- CEILING: {- d: '将数值向上取整为最接近的指定因数的倍数。',- p: {- rangeNumber: {- name: '值',- detail: '要向上舍入的数值。',- },- rangeNumber1: {- name: '因数',- detail: '要将值舍入到此数的整数倍。',- },- },- },- ATAN: {- d: '返回数值的反正切值,以弧度表示。',- p: {- rangeNumber: {- name: '值',- detail: '要计算其反正切值的数值。',- },- },- },- ASINH: {- d: '返回数值的反双曲正弦值。',- p: {- rangeNumber: {- name: '值',- detail: '要计算其反双曲正弦值的数值。',- },- },- },- ABS: {- d: '返回数值的绝对值。',- p: {- rangeNumber: {- name: 'value',- detail: '要返回其绝对值的数。',- },- },- },- COUNTBLANK: {- d: '返回给定范围内的空单元格数。',- p: {- range: {- name: '范围',- detail: '要统计空白单元格数量的范围。',- },- },- },- COSH: {- d: '返回给定实数的双曲余弦值。',- p: {- rangeNumber: {- name: '值',- detail: '要计算其双曲余弦值的实数值。',- },- },- },- COUNTIF: {- d: '返回范围内满足某个条件的单元格的数量。',- p: {- range: {- name: '范围',- detail: '要根据条件进行检测的范围。',- },- rangeAll: {- name: '条件',- detail: '要应用于范围的模式或测试条件。\n\n如果范围包含的是要检测的文本,则条件必须为字符串。条件可以包含通配符,包括用于匹配单个字符的?或用于匹配零个或连续多个字符的*。要匹配问号星号本身,请在该字符前面加上波浪号(~)前缀(即~?和~*)。字符串条件必须用引号括起来。函数会检查范围中的每个单元格与条件是否相等或匹配(如果使用了通配符)。\n\n如果范围包含的是要检测的数字,则条件可以是字符串也可以是数字。如果给定的条件是一个数字,则检查范围中的每个单元格是否等于条件。另外,条件也可能是包含数字的字符串(也将对其进行相等检测),或者带有以下前缀的数字:=、>、>=、<或<=,这些条件将分别用于检查范围中的单元格是否等于、大于、大于等于、小于、小于等于条件值。',- },- },- },- ERFC: {- d: '返回数值的互补高斯误差函数。',- p: {- rangeNumber: {- name: 'z',- detail: '要为其计算互补高斯误差函数的数值。',- },- },- },- VLOOKUP: {- d: '纵向查找。在范围的第一列中自上而下搜索某个键值,并返回所找到的行中指定单元格的值。',- p: {- rangeAll: {- name: '搜索键值',- detail: '要搜索的值,如 42、"Cats" 或 I24。',- },- rangeAll1: {- name: '范围',- detail: '要进行搜索的范围。VLOOKUP 将在该范围的第一列中搜索搜索键值中指定的键值。',- },- rangeNumber: {- name: '索引',- detail: '要返回的值的列索引,范围中的第一列编号为 1。\n\n如果索引不是介于 1 和范围中的列数之间,将返回 #VALUE! 。',- },- rangeAll2: {- name: '已排序',- detail: '[默认值为 TRUE() ] - 指示要搜索的列(指定范围的第一列)是否已排序。大多数情况下,建议设为 FALSE()。\n\n建议将已排序设为 FALSE。如果设为 FALSE,将返回完全匹配项。如果存在多个匹配值,将返回找到的第一个值对应的单元格的内容,如果找不到匹配值,则返回 #N/A。\n\n如果将已排序设为 TRUE 或省略,将返回(小于或等于搜索键值的)最接近的匹配项。如果搜索的列中所有的值均大于搜索键值,则返回 #N/A。',- },- },- },- TIME: {- d: '将给定的小时、分钟和秒转换为时间。',- p: {- rangeNumber: {- name: '小时',- detail: '0(零)到 32767 之间的数字,代表小时。\n\n任何大于 23 的值都会除以 24,余数将作为小时值。',- },- rangeNumber1: {- name: '分钟',- detail: '0(零)到 32767 之间的数字,代表分钟。\n\n任何大于 59 的值将转换为小时和分钟。',- },- rangeNumber2: {- name: '秒',- detail: '0(零)到 32767 之间的数字,代表秒。\n\n任何大于 59 的值将转换为小时、分钟和秒。',- },- },- },- EFFECT: {- d: '根据名义利率及每年的复利计息期数来计算实际年利率。',- p: {- rangeNumber: {- name: 'nominal_rate',- detail: '每年的名义利率。',- },- rangeNumber1: {- name: 'npery',- detail: '每年的复利计算期数。',- },- },- },- BIN2DEC: {- d: '将二进制数转换为十进制数。',- p: {- rangeAll: {- name: 'number',- detail: '要转换为十进制数的带符号的10位二进制数值(以字符串形式提供)。\n\n带符号的二进制数的最高位是符号位;也就是说,负数是以二的补码形式表示的。\n\n对于此函数,最大的正数输入值为0111111111,最小的负数输入值为1000000000。\n\n如果所提供的带符号的二进制数是有效的二进制数,会自动将其转换为相应的字符串输入。例如,BIN2DEC(100)和BIN2DEC("100")得出的结果相同,均为4。',- },- },- },- TRUE: {- d: '返回逻辑值 TRUE。',- },- NE: {- d: '如果指定的值不相等,则返回“TRUE”;否则返回“FALSE”。相当于“<>”运算符。',- p: {- rangeAll: {- name: 'value1',- detail: '第一个值。',- },- rangeAll1: {- name: 'value2',- detail: '要检查是否与 value1 不相等的值。',- },- },- },- SEX_BY_IDCARD: {- d: '根据中国身份证号计算出性别。支持15位或18位身份证',- p: {- rangeAll: {- name: '身份证号',- detail: '15位或者18位的身份证号或范围。',- },- },- },- },- formulaMore: {- valueTitle: '值',- tipSelectDataRange: '选取数据范围',- tipDataRangeTitle: '数据范围',- findFunctionTitle: '查找函数',- tipInputFunctionName: '请输入您要查找的函数名称或函数功能的简要描述',- whole: '全部',-- Math: '数学',- Statistical: '统计',- Lookup: '查找',- universheet: 'UniverSheet内置',- dataMining: '数据挖掘',- Database: '数据源',- Date: '日期',- Filter: '过滤器',- Financial: '财务',- Engineering: '工程计算',- Logical: '逻辑',- Operator: '运算符',- Text: '文本',- Parser: '转换工具',- Array: '数组',- other: '其它',-- selectFunctionTitle: '选择函数',- calculationResult: '计算结果',-- tipSuccessText: '成功',- tipParamErrorText: '参数类型错误',-- helpClose: '关闭',- helpCollapse: '收起',- helpExample: '示例',- helpAbstract: '摘要',-- execfunctionError: '提示", "公式存在错误',- execfunctionSelfError: '公式不可引用其本身的单元格',- execfunctionSelfErrorResult: '公式不可引用其本身的单元格,会导致计算结果不准确',-- allowRepeatText: '可重复',- allowOptionText: '可选',-- selectCategory: '或选择类别',- },- ifFormula: {- tipNotBelongToIf: '该单元格函数不属于if公式!',- tipSelectCell: '请选择单元格插入函数',-- ifGenCompareValueTitle: '比较值',- ifGenSelectCellTitle: '点击选择单元格',- ifGenRangeTitle: '范围',- ifGenRangeTo: '至',- ifGenRangeEvaluate: '范围评估',- ifGenSelectRangeTitle: '点击选择范围',- ifGenCutWay: '划分方式',- ifGenCutSame: '划分值相同',- ifGenCutNpiece: '划分为N份',- ifGenCutCustom: '自定义输入',- ifGenCutConfirm: '生成',-- ifGenTipSelectCell: '选择单元格',- ifGenTipSelectCellPlace: '请选择单元格',-- ifGenTipSelectRange: '选择单范围',- ifGenTipSelectRangePlace: '请选择范围',-- ifGenTipNotNullValue: '比较值不能为空!',- ifGenTipLableTitile: '标签',- ifGenTipRangeNotforNull: '范围不能为空!',- ifGenTipCutValueNotforNull: '划分值不能为空!',- ifGenTipNotGenCondition: '没有生成可用的条件!',- },- },-};diff --git a/packages/sheets-plugin-formula/tsconfig.json b/packages/sheets-plugin-formula/tsconfig.jsondeleted file mode 100644index 55a9dcacca..0000000000--- a/packages/sheets-plugin-formula/tsconfig.json+++ /dev/null@@ -1,14 +0,0 @@-{- "extends": "../../tsconfig.json",- "compilerOptions": {- "rootDir": "./",- "outDir": "lib",- "baseUrl": "./",- "esModuleInterop": true, // auto allowSyntheticDefaultImports true- "strictPropertyInitialization": false- },- "include": [- "src/**/*",- "test/**/*.test.(ts|tsx|js)"- ]-}\ No newline at end of filediff --git a/packages/sheets-plugin-image/README-zh.md b/packages/sheets-plugin-image/README-zh.mddeleted file mode 100644index 94e48be24e..0000000000--- a/packages/sheets-plugin-image/README-zh.md+++ /dev/null@@ -1,98 +0,0 @@-# style-univer--简体中文 | [English](./README.md)--## 介绍--UniverSheet 官方 UI 组件库--## 特性--- 纯 tsx 组件,可方便集成到 vue/react-- 按需引入,不用担心影响打包体积--## 用法--### 安装--```shell-npm i @univerjs/style-univer-```--### 使用--```js-import baseUI from '@univerjs/style-univer';-universheet.install(baseUI);-universheet.create({- plugins: ['style-univer'],-});-```--## 本地开发--### 环境--- [Node.js](https://nodejs.org/en/) Version >= 10-- [npm](https://www.npmjs.com/) Version >= 7--### 安装--```-npm i-```--### 开发--```-# 当前目录 ./packages/style-univer/-npm run dev--# 或者项目根目录 ./-npm run dev -w @univerjs/style-univer-```--### 打包--```-# 当前目录 ./packages/style-univer/-npm run build--# 或者根目录 ./-npm run build -w @univerjs/style-univer-```--## 组件库文档--使用[Docusaurus 2](https://docusaurus.io/)构建--### 安装--```console-# 根目录-npm i-```--### 开发--```console-# 当前目录-npm run start--# 或者根目录-npm run start -w @univerjs/style-univer-```--此命令启动本地开发服务器并打开浏览器窗口。 大多数更改都会实时刷新,而无需重新启动服务器。--### 打包--```console-# 当前目录-npm run build:doc--# 或者根目录-npm run build:doc -w @univerjs/style-univer-```--此命令将静态内容生成到 `build` 目录中,并且可以使用任何静态内容托管服务来提供。diff --git a/packages/sheets-plugin-image/README.md b/packages/sheets-plugin-image/README.mddeleted file mode 100644index 532bbde9e0..0000000000--- a/packages/sheets-plugin-image/README.md+++ /dev/null@@ -1,98 +0,0 @@-# style-univer--English| [简体中文](./README-zh.md)--## Introduction--UniverSheet official UI component library--## Features--- Pure tsx components, which can be easily integrated into vue/react-- Import on demand, don’t worry about affecting the package size--## Usage--### Install--```shell-npm i @univerjs/style-univer-```--### Import--```js-import baseUI from '@univerjs/style-univer';-universheet.install(baseUI);-universheet.create({- plugins: ['style-univer'],-});-```--## Local development--### Requirements--- [Node.js](https://nodejs.org/en/) Version >= 10-- [npm](https://www.npmjs.com/) Version >= 7--### Installation--```-npm i-```--### Development--```-# Current directory ./packages/style-univer/-npm run dev--# Or project root directory ./-npm run dev -w @univerjs/style-univer-```--### Package--```-# Current directory ./packages/style-univer/-npm run build--# Or root directory ./-npm run build -w @univerjs/style-univer-```--## Doc Website--This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.--### Installation--```console-# root folder-npm i-```--### Development--```console-# style-univer folder-npm run start--# or root folder-npm run start -w @univerjs/style-univer-```--This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.--### Build--```console-# style-univer folder-npm run build:doc--# or root folder-npm run build:doc -w @univerjs/style-univer-```--This command generates static content into the `build` directory and can be served using any static contents hosting service.diff --git a/packages/sheets-plugin-image/esbuild.config.mjs b/packages/sheets-plugin-image/esbuild.config.mjsdeleted file mode 100644index e8cba77046..0000000000--- a/packages/sheets-plugin-image/esbuild.config.mjs+++ /dev/null@@ -1,10 +0,0 @@-import esbuild from 'esbuild';--// eslint-disable-next-line import/no-relative-packages-import baseConfig from '../../esbuild.config.mjs';--esbuild.build({- ...baseConfig,- globalName: 'UniverSheetsPluginImage',- outfile: './lib/univer-sheets-plugin-image.js',-});diff --git a/packages/sheets-plugin-image/index.html b/packages/sheets-plugin-image/index.htmldeleted file mode 100644index 000b4bf2fc..0000000000--- a/packages/sheets-plugin-image/index.html+++ /dev/null@@ -1,32 +0,0 @@-<!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;- padding: 0;- overflow: hidden;- }-- #universheet-demo-up {- width: 100%;- height: 100%;- }- </style>-</head>--<body>- <div id="app" style="z-index: 1; position: fixed; font-size: 20px; color: green;"></div>- <div id="universheet-demo-up"></div>- <div id="universheet-demo-down"></div>- <script type="module" src="/src/main.tsx"></script>-</body>--</html>\ No newline at end of filediff --git a/packages/sheets-plugin-image/package.json b/packages/sheets-plugin-image/package.jsondeleted file mode 100644index d0fb966eb4..0000000000--- a/packages/sheets-plugin-image/package.json+++ /dev/null@@ -1,64 +0,0 @@-{- "name": "@univerjs/sheets-plugin-image",- "version": "0.0.1",- "description": "UniverSheet normal plugin UI manager",- "keywords": [],- "author": "DreamNum <[email protected]>",- "license": "MIT",- "main": "./src/index.ts",- "module": "./src/index.ts",- "types": "./src/Types/index.d.ts",- "publishConfig": {- "main": "./lib/univer-sheets-plugin-image.cjs.js",- "module": "./lib/univer-sheets-plugin-image.js",- "types": "./lib/index.d.ts",- "exports": {- ".": {- "require": "./lib/univer-sheets-plugin-image.cjs.js",- "default": "./lib/univer-sheets-plugin-image.js"- },- "./*": "./lib/*"- },- "access": "public"- },- "exports": {- ".": "./src/index.ts",- "./*": "./src/*"- },- "directories": {- "lib": "lib"- },- "files": [- "lib"- ],- "private": false,- "type": "module",- "scripts": {- "test": "vitest run",- "test:watch": "vitest",- "coverage": "vitest run --coverage",- "esbuild": "node ./esbuild.config.mjs"- },- "dependencies": {- "@univerjs/base-render": "workspace:*",- "@univerjs/base-sheets": "workspace:*",- "@univerjs/base-ui": "workspace:*",- "@univerjs/common-plugin-data": "workspace:*",- "@univerjs/core": "workspace:*",- "@univerjs/design": "workspace:*",- "@univerjs/ui-plugin-sheets": "workspace:*",- "@wendellhu/redi": "^0.12.10",- "react": "^18.2.0",- "react-dom": "^18.2.0"- },- "devDependencies": {- "@types/node": "^20.8.9",- "@types/react": "^18.2.33",- "@types/react-dom": "^18.2.14",- "@vitest/coverage-v8": "^0.34.6",- "esbuild": "^0.19.5",- "less": "^4.2.0",- "ts-node": "^10.9.1",- "vitest": "^0.34.6"- }-}\ No newline at end of filediff --git a/packages/sheets-plugin-image/src/Basics/Const/ACTION_NAMES.ts b/packages/sheets-plugin-image/src/Basics/Const/ACTION_NAMES.tsdeleted file mode 100644index 7db40daa42..0000000000--- a/packages/sheets-plugin-image/src/Basics/Const/ACTION_NAMES.ts+++ /dev/null@@ -1,4 +0,0 @@-export enum ACTION_NAMES {- SET_IMAGE_TYPE_ACTION = 'ImagePlugin-SetImageTypeAction',- ADD_IMAGE_PROPERTY_ACTION = 'ImagePlugin-AddImagePropertyAction',-}diff --git a/packages/sheets-plugin-image/src/Basics/Const/PLUGIN_NAME.ts b/packages/sheets-plugin-image/src/Basics/Const/PLUGIN_NAME.tsdeleted file mode 100644index cde16865df..0000000000--- a/packages/sheets-plugin-image/src/Basics/Const/PLUGIN_NAME.ts+++ /dev/null@@ -1 +0,0 @@-export const OVER_GRID_IMAGE_PLUGIN_NAME = 'overGridImage';diff --git a/packages/sheets-plugin-image/src/Basics/Const/index.ts b/packages/sheets-plugin-image/src/Basics/Const/index.tsdeleted file mode 100644index a1f79b393d..0000000000--- a/packages/sheets-plugin-image/src/Basics/Const/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './ACTION_NAMES';-export * from './PLUGIN_NAME';diff --git a/packages/sheets-plugin-image/src/Basics/Enum/BorderType.ts b/packages/sheets-plugin-image/src/Basics/Enum/BorderType.tsdeleted file mode 100644index 9ea39bfa31..0000000000--- a/packages/sheets-plugin-image/src/Basics/Enum/BorderType.ts+++ /dev/null@@ -1,6 +0,0 @@-export enum BorderType {- Solid,- Dashed,- Point,- Double,-}diff --git a/packages/sheets-plugin-image/src/Basics/Enum/NormalType.ts b/packages/sheets-plugin-image/src/Basics/Enum/NormalType.tsdeleted file mode 100644index 937d8baeef..0000000000--- a/packages/sheets-plugin-image/src/Basics/Enum/NormalType.ts+++ /dev/null@@ -1,5 +0,0 @@-export enum NormalType {- MoveAndSize,- MoveNotSize,- NotMoveSize,-}diff --git a/packages/sheets-plugin-image/src/Basics/Enum/index.ts b/packages/sheets-plugin-image/src/Basics/Enum/index.tsdeleted file mode 100644index 916092d75e..0000000000--- a/packages/sheets-plugin-image/src/Basics/Enum/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './BorderType';-export * from './NormalType';diff --git a/packages/sheets-plugin-image/src/Basics/Interfaces/IData.ts b/packages/sheets-plugin-image/src/Basics/Interfaces/IData.tsdeleted file mode 100644index 868a1d2a62..0000000000--- a/packages/sheets-plugin-image/src/Basics/Interfaces/IData.ts+++ /dev/null@@ -1,10 +0,0 @@-import { BorderType, NormalType } from '../Enum';--export type IProps = {- normal: NormalType;- fixed: boolean;- borderStyle: BorderType;- borderWidth: number;- borderRadius: number;- borderColor: string;-};diff --git a/packages/sheets-plugin-image/src/Basics/Interfaces/IOverGridImagePluginConfig.ts b/packages/sheets-plugin-image/src/Basics/Interfaces/IOverGridImagePluginConfig.tsdeleted file mode 100644index 60ff391df5..0000000000--- a/packages/sheets-plugin-image/src/Basics/Interfaces/IOverGridImagePluginConfig.ts+++ /dev/null@@ -1 +0,0 @@-export interface IOverGridImagePluginConfig {}diff --git a/packages/sheets-plugin-image/src/Basics/Interfaces/IOverGridImageProperty.ts b/packages/sheets-plugin-image/src/Basics/Interfaces/IOverGridImageProperty.tsdeleted file mode 100644index 4491675718..0000000000--- a/packages/sheets-plugin-image/src/Basics/Interfaces/IOverGridImageProperty.ts+++ /dev/null@@ -1,21 +0,0 @@-import { IPictureProps } from '@univerjs/base-render';--export enum OverGridImageBorderType {- DASHED,- SOLID,- DOUBLE,-}--export interface IOverGridImageProperty extends IPictureProps {- id: string;- sheetId: string;- radius: number;- url: string;- borderType: OverGridImageBorderType;- width: number;- height: number;- row: number;- column: number;- borderColor: string;- borderWidth: number;-}diff --git a/packages/sheets-plugin-image/src/Basics/Interfaces/index.ts b/packages/sheets-plugin-image/src/Basics/Interfaces/index.tsdeleted file mode 100644index a340b37814..0000000000--- a/packages/sheets-plugin-image/src/Basics/Interfaces/index.ts+++ /dev/null@@ -1,3 +0,0 @@-export * from './IData';-export * from './IOverGridImagePluginConfig';-export * from './IOverGridImageProperty';diff --git a/packages/sheets-plugin-image/src/Basics/Library/FileSelected.ts b/packages/sheets-plugin-image/src/Basics/Library/FileSelected.tsdeleted file mode 100644index 158a71c45f..0000000000--- a/packages/sheets-plugin-image/src/Basics/Library/FileSelected.ts+++ /dev/null@@ -1,62 +0,0 @@-export class FileSelected {- static ACCEPT = {- XLSX: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',- CVS: '.csv',- TXT: 'text/plain',- IMAGE: 'image/*',- };-- protected _element: HTMLInputElement;-- protected _accept: string;-- protected _multiple: boolean;-- constructor(multiple: boolean, accept: string) {- this._multiple = multiple;- this._accept = accept;- this._element = document.createElement('input');- this._element.setAttribute('type', 'file');- this._element.setAttribute('accept', accept);- if (multiple) {- this._element.setAttribute('multiple', 'multiple');- }- }-- static async chooseImage(): Promise<File> {- return (await new FileSelected(false, FileSelected.ACCEPT.IMAGE).choose()) as File;- }-- static async chooseXlsx(): Promise<File> {- return (await new FileSelected(false, FileSelected.ACCEPT.IMAGE).choose()) as File;- }-- async choose(): Promise<File | FileList | null> {- let callback: (event: Event) => void;- return new Promise((resolve) => {- this._element.value = '';- this._element.addEventListener(- 'change',- (callback = () => {- const files = this._element.files;- if (files && files.length) {- if (this._multiple) {- resolve(files);- } else {- resolve(files[0]);- }- } else {- resolve(null);- }- this._element.removeEventListener('change', callback);- })- );- const event = new MouseEvent('click', {- bubbles: true,- detail: 0,- cancelable: false,- });- this._element.dispatchEvent(event);- });- }-}diff --git a/packages/sheets-plugin-image/src/Basics/Library/index.ts b/packages/sheets-plugin-image/src/Basics/Library/index.tsdeleted file mode 100644index 8af4b57205..0000000000--- a/packages/sheets-plugin-image/src/Basics/Library/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './FileSelected';diff --git a/packages/sheets-plugin-image/src/Basics/index.ts b/packages/sheets-plugin-image/src/Basics/index.tsdeleted file mode 100644index 59d5ebb91e..0000000000--- a/packages/sheets-plugin-image/src/Basics/index.ts+++ /dev/null@@ -1,4 +0,0 @@-export * from './Const';-export * from './Enum';-export * from './Interfaces';-export * from './Library';diff --git a/packages/sheets-plugin-image/src/Controller/CellImageController.ts b/packages/sheets-plugin-image/src/Controller/CellImageController.tsdeleted file mode 100644index 49e9e3c6d4..0000000000--- a/packages/sheets-plugin-image/src/Controller/CellImageController.ts+++ /dev/null@@ -1,3 +0,0 @@-export class CellImageController {- // TODO ...-}diff --git a/packages/sheets-plugin-image/src/Controller/OverGridImageController.ts b/packages/sheets-plugin-image/src/Controller/OverGridImageController.tsdeleted file mode 100644index 18a064110a..0000000000--- a/packages/sheets-plugin-image/src/Controller/OverGridImageController.ts+++ /dev/null@@ -1,31 +0,0 @@-import { ComponentManager, IMenuService } from '@univerjs/base-ui';-import { Disposable, ICommandService } from '@univerjs/core';-import { Inject, Injector } from '@wendellhu/redi';--import { IOverGridImageProperty } from '../Basics';-import { UploadOperation } from '../commands/operations/upload.operation';-import { IImagePluginData } from '../Symbol';-import { ImportImageMenuItemFactory } from './menu';--export class OverGridImageController extends Disposable {- constructor(- @Inject(Injector) readonly _injector: Injector,- @Inject(IImagePluginData) _imagePluginData: Map<string, IOverGridImageProperty>,- @ICommandService private readonly _commandService: ICommandService,- @Inject(ComponentManager) private readonly _componentManager: ComponentManager,- @IMenuService private readonly _menuService: IMenuService- ) {- super();-- // this._componentManager.register('ImageIcon', Icon.View.ImageIcon);- this._initializeContextMenu();-- [UploadOperation].forEach((command) => this.disposeWithMe(this._commandService.registerCommand(command)));- }-- private _initializeContextMenu() {- [ImportImageMenuItemFactory].forEach((factory) => {- this.disposeWithMe(this._menuService.addMenuItem(this._injector.invoke(factory)));- });- }-}diff --git a/packages/sheets-plugin-image/src/Controller/index.ts b/packages/sheets-plugin-image/src/Controller/index.tsdeleted file mode 100644index d1626709ab..0000000000--- a/packages/sheets-plugin-image/src/Controller/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './CellImageController';-export * from './OverGridImageController';diff --git a/packages/sheets-plugin-image/src/Controller/menu.ts b/packages/sheets-plugin-image/src/Controller/menu.tsdeleted file mode 100644index a7b2f5e05f..0000000000--- a/packages/sheets-plugin-image/src/Controller/menu.ts+++ /dev/null@@ -1,16 +0,0 @@-import { IMenuButtonItem, MenuItemType, MenuPosition } from '@univerjs/base-ui';-import { IAccessor } from '@wendellhu/redi';--import { UploadOperation } from '../commands/operations/upload.operation';--export function ImportImageMenuItemFactory(accessor: IAccessor): IMenuButtonItem {- return {- id: UploadOperation.id,- type: MenuItemType.BUTTON,- icon: 'ImageIcon',- title: 'Image', // FIXME use translation- tooltip: 'Import Image', // FIXME use translation- positions: [MenuPosition.TOOLBAR_START],- // TODO@Dushusir disabled$ status- };-}diff --git a/packages/sheets-plugin-image/src/ImagePlugin.tsx b/packages/sheets-plugin-image/src/ImagePlugin.tsxdeleted file mode 100644index c971d65d9f..0000000000--- a/packages/sheets-plugin-image/src/ImagePlugin.tsx+++ /dev/null@@ -1,55 +0,0 @@-import { LocaleService, Plugin, PluginType } from '@univerjs/core';-import { Dependency, Inject, Injector } from '@wendellhu/redi';--import { IOverGridImagePluginConfig, IOverGridImageProperty, OVER_GRID_IMAGE_PLUGIN_NAME } from './Basics';-import { CellImageController, OverGridImageController } from './Controller';-import { UploadService } from './services/upload.service';-import { IImagePluginData } from './Symbol';-import { OverImageRender } from './View/Render';--/**- * TODO: 考虑加入单元格图片的情况,- *- * 如果工具栏的“插入单元格图片”“插入浮动图片”是在一个按钮的下拉列表里,那么UI部分是重叠的,所以这里应该叫 ImagePlugin,下面再细分 OverGridImage 和 CellImage- *- */-export class ImagePlugin extends Plugin {- static override type = PluginType.Sheet;-- protected _overGridImageController: OverGridImageController | null = null;-- protected _overImageRender: OverImageRender | null = null;-- protected _imagePluginData: Map<string, IOverGridImageProperty>;-- protected _cellImageController: CellImageController | null = null;-- constructor(- private _config: IOverGridImagePluginConfig,- @Inject(Injector) override readonly _injector: Injector,- @Inject(LocaleService) private readonly _localeService: LocaleService- ) {- super(OVER_GRID_IMAGE_PLUGIN_NAME);- this._imagePluginData = new Map<string, IOverGridImageProperty>();- this._injector.add([IImagePluginData, { useFactory: () => this._imagePluginData }]);- }-- override onRendered(): void {- this._initializeDependencies(this._injector);- }-- private _initializeDependencies(sheetInjector: Injector) {- const dependencies: Dependency[] = [- [OverGridImageController],- [CellImageController],- [OverImageRender],- [UploadService],- ];- dependencies.forEach((d) => {- sheetInjector.add(d);- });- this._overImageRender = sheetInjector.createInstance(OverImageRender);- this._cellImageController = sheetInjector.createInstance(CellImageController);- this._overGridImageController = sheetInjector.createInstance(OverGridImageController);- }-}diff --git a/packages/sheets-plugin-image/src/Model/Action/AddOverGridImageAction.ts b/packages/sheets-plugin-image/src/Model/Action/AddOverGridImageAction.tsdeleted file mode 100644index 1f670ac7dd..0000000000--- a/packages/sheets-plugin-image/src/Model/Action/AddOverGridImageAction.ts+++ /dev/null@@ -1,61 +0,0 @@-// import { ACTION_NAMES, OverGridImageBorderType } from '../../Basics';-// import { AddOverGridImageApply, RemoveOverGridImageApply } from '../Apply';-// import { IRemoveOverGridImageActionData } from './RemoveOverGridImageAction';--// export interface IAddOverGridImageActionData extends ISheetActionData {-// id: string;-// sheetId: string;-// radius: number;-// url: string;-// borderType: OverGridImageBorderType;-// width: number;-// height: number;-// row: number;-// column: number;-// borderColor: string;-// borderWidth: number;-// }--// export class AddOverGridImageAction extends SheetActionBase<-// IAddOverGridImageActionData,-// IRemoveOverGridImageActionData-// > {-// static NAME = 'AddImagePropertyAction';--// constructor(actionData: IAddOverGridImageActionData, commandUnit: CommandUnit, observers: ActionObservers) {-// super(actionData, commandUnit, observers);-// this._oldActionData = {-// actionName: ACTION_NAMES.SET_IMAGE_TYPE_ACTION,-// id: this.do(),-// sheetId: actionData.sheetId,-// injector: actionData.injector,-// };-// }--// do(): string {-// const result = AddOverGridImageApply(this._doActionData);-// this._observers.notifyObservers({-// type: ActionType.REDO,-// data: this._doActionData,-// action: this,-// });-// return result;-// }--// redo(): void {-// this.do();-// }--// undo(): void {-// RemoveOverGridImageApply(this._oldActionData);-// this._observers.notifyObservers({-// type: ActionType.UNDO,-// data: this._oldActionData,-// action: this,-// });-// }--// validate(): boolean {-// return false;-// }-// }diff --git a/packages/sheets-plugin-image/src/Model/Action/RemoveOverGridImageAction.ts b/packages/sheets-plugin-image/src/Model/Action/RemoveOverGridImageAction.tsdeleted file mode 100644index 4b789596f3..0000000000--- a/packages/sheets-plugin-image/src/Model/Action/RemoveOverGridImageAction.ts+++ /dev/null@@ -1,49 +0,0 @@-// import { ActionObservers, CommandUnit, CommonParameter, ISheetActionData, SheetActionBase } from '@univerjs/core';--// import { OverGridImageBorderType } from '../../Basics';-// import { IAddOverGridImageActionData } from './AddOverGridImageAction';--// export interface IRemoveOverGridImageActionData extends ISheetActionData {-// id: string;-// }--// export class RemoveOverGridImageAction extends SheetActionBase<-// IRemoveOverGridImageActionData,-// IAddOverGridImageActionData-// > {-// static NAME = 'RemoveOverGridImageAction';--// constructor(actionData: IRemoveOverGridImageActionData, commandUnit: CommandUnit, observers: ActionObservers) {-// super(actionData, commandUnit, observers);-// this._oldActionData = {-// id: '',-// actionName: '',-// sheetId: '',-// radius: 0,-// url: '',-// borderType: OverGridImageBorderType.SOLID,-// width: 0,-// height: 0,-// row: 0,-// column: 0,-// borderColor: '',-// borderWidth: 0,-// };-// }--// override redo(commonParameter?: CommonParameter | undefined): void {-// throw new Error('Method not implemented.');-// }--// override undo(commonParameter?: CommonParameter | undefined): void {-// throw new Error('Method not implemented.');-// }--// override do(commonParameter?: CommonParameter | undefined): void {-// throw new Error('Method not implemented.');-// }--// override validate(): boolean {-// throw new Error('Method not implemented.');-// }-// }diff --git a/packages/sheets-plugin-image/src/Model/Action/SetOverGridImageTypeAction.ts b/packages/sheets-plugin-image/src/Model/Action/SetOverGridImageTypeAction.tsdeleted file mode 100644index b502ff2083..0000000000--- a/packages/sheets-plugin-image/src/Model/Action/SetOverGridImageTypeAction.ts+++ /dev/null@@ -1,57 +0,0 @@-// import { ActionObservers, CommandUnit, ISheetActionData, SheetActionBase } from '@univerjs/core';--// import { ACTION_NAMES, OVER_GRID_IMAGE_PLUGIN_NAME } from '../../Basics';-// import { SetOverGridImageTypeApply } from '../Apply';--// export interface ISetImageTypeData extends ISheetActionData {-// id: string;-// type: string;-// }--// export class SetImageTypeAction extends SheetActionBase<ISetImageTypeData, ISetImageTypeData> {-// static NAME = 'SetImageTypeAction';--// constructor(actionData: ISetImageTypeData, commandUnit: CommandUnit, observers: ActionObservers) {-// super(actionData, commandUnit, observers);-// this._oldActionData = {-// actionName: ACTION_NAMES.SET_IMAGE_TYPE_ACTION,-// id: actionData.id,-// sheetId: actionData.sheetId,-// type: this.do(),-// };-// }--// redo(): void {-// this.do();-// }--// do(): string {-// const worksheet = this.getWorkSheet();-// const context = worksheet.getContext();-// const manager = context.getPluginManager();-// const plugin = manager.getPluginByName(OVER_GRID_IMAGE_PLUGIN_NAME) as OverGridImagePlugin;-// return SetOverGridImageTypeApply(-// plugin,-// this._doActionData.sheetId,-// this._doActionData.id,-// this._doActionData.type-// );-// }--// undo(): void {-// const worksheet = this.getWorkSheet();-// const context = worksheet.getContext();-// const manager = context.getPluginManager();-// const plugin = manager.getPluginByName(OVER_GRID_IMAGE_PLUGIN_NAME) as OverGridImagePlugin;-// SetOverGridImageTypeApply(-// plugin,-// this._oldActionData.sheetId,-// this._oldActionData.id,-// this._oldActionData.type-// );-// }--// validate(): boolean {-// return false;-// }-// }diff --git a/packages/sheets-plugin-image/src/Model/Action/index.ts b/packages/sheets-plugin-image/src/Model/Action/index.tsdeleted file mode 100644index e69de29bb2..0000000000diff --git a/packages/sheets-plugin-image/src/Model/Apply/AddOverGridImageApply.ts b/packages/sheets-plugin-image/src/Model/Apply/AddOverGridImageApply.tsdeleted file mode 100644index a296a23fbf..0000000000--- a/packages/sheets-plugin-image/src/Model/Apply/AddOverGridImageApply.ts+++ /dev/null@@ -1,24 +0,0 @@-// import { IImagePluginData } from '../../Symbol';-// import { IAddOverGridImageActionData } from '../Action';--// export function AddOverGridImageApply(property: IAddOverGridImageActionData): string {-// const injector = property.injector;-// if (injector == null) {-// throw new Error('Error injector is null');-// }-// const imagePluginData = injector.get(IImagePluginData);-// imagePluginData.set(property.id, {-// id: property.id,-// sheetId: property.sheetId,-// radius: property.radius,-// url: property.url,-// borderType: property.borderType,-// width: property.width,-// height: property.height,-// row: property.row,-// column: property.column,-// borderColor: property.borderColor,-// borderWidth: property.borderWidth,-// });-// return property.id;-// }diff --git a/packages/sheets-plugin-image/src/Model/Apply/RemoveOverGridImageApply.ts b/packages/sheets-plugin-image/src/Model/Apply/RemoveOverGridImageApply.tsdeleted file mode 100644index 78e89c800c..0000000000--- a/packages/sheets-plugin-image/src/Model/Apply/RemoveOverGridImageApply.ts+++ /dev/null@@ -1,11 +0,0 @@-// import { IImagePluginData } from '../../Symbol';-// import { IRemoveOverGridImageActionData } from '../Action';--// export function RemoveOverGridImageApply(property: IRemoveOverGridImageActionData): void {-// const injector = property.injector;-// if (injector == null) {-// throw new Error('Error injector is null');-// }-// const imagePluginData = injector.get(IImagePluginData);-// imagePluginData.delete(property.id);-// }diff --git a/packages/sheets-plugin-image/src/Model/Apply/SetOverGridImageTypeApply.ts b/packages/sheets-plugin-image/src/Model/Apply/SetOverGridImageTypeApply.tsdeleted file mode 100644index 5e808041d5..0000000000--- a/packages/sheets-plugin-image/src/Model/Apply/SetOverGridImageTypeApply.ts+++ /dev/null@@ -1 +0,0 @@-export function SetOverGridImageTypeApply(sheetId: string, id: string, type: string) {}diff --git a/packages/sheets-plugin-image/src/Model/Apply/index.ts b/packages/sheets-plugin-image/src/Model/Apply/index.tsdeleted file mode 100644index 97d5dca57e..0000000000--- a/packages/sheets-plugin-image/src/Model/Apply/index.ts+++ /dev/null@@ -1,3 +0,0 @@-// export * from './AddOverGridImageApply';-// export * from './RemoveOverGridImageApply';-export * from './SetOverGridImageTypeApply';diff --git a/packages/sheets-plugin-image/src/Model/index.ts b/packages/sheets-plugin-image/src/Model/index.tsdeleted file mode 100644index e247731bcb..0000000000--- a/packages/sheets-plugin-image/src/Model/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './Apply';diff --git a/packages/sheets-plugin-image/src/RegisterAction.ts b/packages/sheets-plugin-image/src/RegisterAction.tsdeleted file mode 100644index 8af4021f46..0000000000--- a/packages/sheets-plugin-image/src/RegisterAction.ts+++ /dev/null@@ -1,8 +0,0 @@-// TODO new command--// import { CommandManager } from '@univerjs/core';-// import { AddOverGridImageAction, RemoveOverGridImageAction, SetImageTypeAction } from './Model';--// CommandManager.register(SetImageTypeAction.NAME, SetImageTypeAction);-// CommandManager.register(AddOverGridImageAction.NAME, AddOverGridImageAction);-// CommandManager.register(RemoveOverGridImageAction.NAME, RemoveOverGridImageAction);diff --git a/packages/sheets-plugin-image/src/Symbol/index.ts b/packages/sheets-plugin-image/src/Symbol/index.tsdeleted file mode 100644index e1667b06e0..0000000000--- a/packages/sheets-plugin-image/src/Symbol/index.ts+++ /dev/null@@ -1,5 +0,0 @@-import { createIdentifier } from '@wendellhu/redi';--import { IOverGridImageProperty } from '../Basics';--export const IImagePluginData = createIdentifier<Map<string, IOverGridImageProperty>>('image-plugin-data');diff --git a/packages/sheets-plugin-image/src/Types/index.d.ts b/packages/sheets-plugin-image/src/Types/index.d.tsdeleted file mode 100644index f317ef2c1b..0000000000--- a/packages/sheets-plugin-image/src/Types/index.d.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from '../index';-declare module '@univerjs/sheets-plugin-image' {}diff --git a/packages/sheets-plugin-image/src/View/Render/OverImageRender.ts b/packages/sheets-plugin-image/src/View/Render/OverImageRender.tsdeleted file mode 100644index dd7ca54f68..0000000000--- a/packages/sheets-plugin-image/src/View/Render/OverImageRender.ts+++ /dev/null@@ -1,58 +0,0 @@-import { IRenderingEngine, Scene } from '@univerjs/base-render';-import { Inject, Injector } from '@wendellhu/redi';--import { IOverGridImageProperty } from '../../Basics';-import { OverImageShape } from './OverImageShape';--export class OverImageRender {- static LAYER_Z_INDEX: number = 1000;-- private _mainScene: Scene;-- constructor(@Inject(Injector) readonly _injector: Injector) {- const engine = _injector.get(IRenderingEngine);- this._mainScene = engine.getScene('mainScene') as Scene;- if (this._mainScene == null) {- throw new Error('main scene is null !!');- }-- // TODO new command listener- // CommandManager.getActionObservers().add((event) => {- // switch (event.data.actionName) {- // case AddOverGridImageAction.NAME: {- // const data = event.data as IAddOverGridImageActionData;- // this.addOverImage(data);- // break;- // }- // case RemoveOverGridImageAction.NAME: {- // const data = event.data as IRemoveOverGridImageActionData;- // this.removeOverImage(data.id);- // break;- // }- // }- // });- }-- addOverImage(property: IOverGridImageProperty): void {- const shape = new OverImageShape(property);- this._mainScene.addObject(shape, OverImageRender.LAYER_Z_INDEX);- }-- removeOverImage(id: string): void {- const layer = this._mainScene.getLayer(OverImageRender.LAYER_Z_INDEX);- if (layer != null) {- const readyRemove = [];- const layerObject = layer.getObjects();- for (let i = 0; i < layerObject.length; i++) {- const shape = layerObject[i] as OverImageShape;- if (shape.getProperty().id === id) {- readyRemove.push(shape);- }- }- for (let i = 0; i < readyRemove.length; i++) {- const shape = layerObject[i] as OverImageShape;- layer.removeObject(shape);- }- }- }-}diff --git a/packages/sheets-plugin-image/src/View/Render/OverImageShape.ts b/packages/sheets-plugin-image/src/View/Render/OverImageShape.tsdeleted file mode 100644index 59683fc36b..0000000000--- a/packages/sheets-plugin-image/src/View/Render/OverImageShape.ts+++ /dev/null@@ -1,109 +0,0 @@-import { Picture } from '@univerjs/base-render';--import { IOverGridImageProperty, OverGridImageBorderType } from '../../Basics';--export class OverImageShape extends Picture {- protected _property: IOverGridImageProperty;-- constructor(property: IOverGridImageProperty) {- super(property.id, property);- this._property = property;- }-- static drawRoundRect(- ctx: CanvasRenderingContext2D,- x: number,- y: number,- width: number,- height: number,- tl: number,- tr: number,- bl: number,- br: number- ) {- ctx.beginPath();- ctx.moveTo(x + tl, y);- ctx.lineTo(x + width - tr, y);- ctx.quadraticCurveTo(x + width, y, x + width, y + tr);- ctx.lineTo(x + width, y + height - br);- ctx.quadraticCurveTo(x + width, y + height, x + width - br, y + height);- ctx.lineTo(x + bl, y + height);- ctx.quadraticCurveTo(x, y + height, x, y + height - bl);- ctx.lineTo(x, y + tl);- ctx.quadraticCurveTo(x, y, x + tl, y);- ctx.closePath();- }-- static drawDashedBorder(ctx: CanvasRenderingContext2D, shape: OverImageShape) {- const { radius = 60, borderWidth = 10, borderColor = 'red' } = shape.getProperty();- const x = -borderWidth / 2;- const y = -borderWidth / 2;- const w = shape.width + borderWidth;- const h = shape.height + borderWidth;- OverImageShape.drawRoundRect(ctx, x, y, w, h, radius, radius, radius, radius);- ctx.setLineDash([10, 10, 10]);- ctx.lineWidth = borderWidth;- ctx.lineCap = 'round';- ctx.strokeStyle = borderColor;- ctx.stroke();- }-- static drawSolidBorder(ctx: CanvasRenderingContext2D, shape: OverImageShape) {- const { radius = 60, borderWidth = 10, borderColor = 'red' } = shape.getProperty();- const x = -borderWidth / 2;- const y = -borderWidth / 2;- const w = shape.width + borderWidth;- const h = shape.height + borderWidth;- OverImageShape.drawRoundRect(ctx, x, y, w, h, radius, radius, radius, radius);- ctx.lineWidth = borderWidth;- ctx.strokeStyle = borderColor;- ctx.stroke();- }-- static drawDoubleBorder(ctx: CanvasRenderingContext2D, shape: OverImageShape) {- const { radius = 60, borderWidth = 10, borderColor = 'red' } = shape.getProperty();- const x1 = -borderWidth / 2;- const y1 = -borderWidth / 2;- const w1 = shape.width + borderWidth;- const h1 = shape.height + borderWidth;- OverImageShape.drawRoundRect(ctx, x1, y1, w1, h1, radius, radius, radius, radius);- ctx.lineWidth = borderWidth;- ctx.strokeStyle = borderColor;- ctx.stroke();- const x2 = x1 - 5;- const y2 = y1 - 5;- const w2 = w1 + 5;- const h2 = h1 + 5;- OverImageShape.drawRoundRect(ctx, x2, y2, w2, h2, radius, radius, radius, radius);- ctx.lineWidth = borderWidth;- ctx.strokeStyle = borderColor;- ctx.stroke();- }-- static override drawWith(ctx: CanvasRenderingContext2D, shape: OverImageShape): void {- const { borderType } = shape.getProperty();- switch (borderType) {- case OverGridImageBorderType.SOLID: {- OverImageShape.drawSolidBorder(ctx, shape);- break;- }- case OverGridImageBorderType.DASHED: {- OverImageShape.drawDashedBorder(ctx, shape);- break;- }- case OverGridImageBorderType.DOUBLE: {- OverImageShape.drawDoubleBorder(ctx, shape);- break;- }- }- }-- getProperty(): IOverGridImageProperty {- return this._property;- }-- protected override _draw(ctx: CanvasRenderingContext2D) {- OverImageShape.drawWith(ctx, this);- super._draw(ctx);- }-}diff --git a/packages/sheets-plugin-image/src/View/Render/index.ts b/packages/sheets-plugin-image/src/View/Render/index.tsdeleted file mode 100644index 3764c92896..0000000000--- a/packages/sheets-plugin-image/src/View/Render/index.ts+++ /dev/null@@ -1,2 +0,0 @@-export * from './OverImageRender';-export * from './OverImageShape';diff --git a/packages/sheets-plugin-image/src/View/UI/ImagePanel/ImagePanelUI.module.less b/packages/sheets-plugin-image/src/View/UI/ImagePanel/ImagePanelUI.module.lessdeleted file mode 100644index 92c274958e..0000000000--- a/packages/sheets-plugin-image/src/View/UI/ImagePanel/ImagePanelUI.module.less+++ /dev/null@@ -1,54 +0,0 @@-.image-panel-setting {- width: 100em;- height: 100%;- background: var(--bg);-- .vertical-middle {- vertical-align: middle- }-- .label {- padding-right: 0.5em;- }-- .section {- border-bottom: 1px solid #eaeaea;- }-- .title {- color: #ffffff;- height: 3em;- padding-left: 0.5em;- line-height: 3em;- background: #333;-- .title-text {- font-size: 13px;- }-- .title-close {- font-size: 20px;- float: right;- margin-right: 10px;- cursor: pointer;- }- }-- .wrap {-- .wrap-title {- padding: 0.5rem 0 0 0.5em;- font-weight: bold;- font-size: 13px;- }-- .wrap-panel {- padding: 0.5rem 0 0.5rem 1.5em;- font-size: 12px;-- .wrap-item {- padding: 0.2em;- }- }- }-}diff --git a/packages/sheets-plugin-image/src/View/UI/ImagePanel/ImagePanelUI.tsx b/packages/sheets-plugin-image/src/View/UI/ImagePanel/ImagePanelUI.tsxdeleted file mode 100644index 181787d101..0000000000--- a/packages/sheets-plugin-image/src/View/UI/ImagePanel/ImagePanelUI.tsx+++ /dev/null@@ -1,111 +0,0 @@-import { Component } from 'react';--import { BorderType, NormalType } from '../../../Basics';--export interface ImagePanelUIProps {- normal: NormalType;- fixed: boolean;- borderStyle: BorderType;- borderWidth: number;- borderColor: string;- borderRadius: number;-}--export class ImagePanelUI extends Component<ImagePanelUIProps> {- private _width: number = 0;-- private _height: number = 0;-- private _radius: number = 0;-- constructor(props: ImagePanelUIProps) {- super(props);- this.initialize(props);- }-- initialize(props: ImagePanelUIProps) {- // imagePlugin.getObserver('onActiveImage')!.add((data) => {- // this._width = data.width;- // this._height = data.height;- // this._radius = data.radius;- // });- }-- override render() {- return (- // <SiderModal name={OVER_GRID_IMAGE_PLUGIN_NAME} title={'图片设置'} style={{}}>- // <div className={Style.imagePanelSetting}>- // {/* 常规 */}- // <div className={Style.section}>- // <div className={Style.wrap}>- // <div className={Style.wrapTitle}> 常规 </div>- // <div className={Style.wrapPanel}>- // <div className={Style.wrapItem}>- // <input name="type" type="radio" />- // <span> 移动图片并调整单元格大小 </span>- // </div>- // <div className={Style.wrapItem}>- // <input name="type" type="radio" />- // <span> 移动图片并不调整单元格大小 </span>- // </div>- // <div className={Style.wrapItem}>- // <input name="type" type="radio" />- // <span> 不移动图片并调整单元格大小 </span>- // </div>- // </div>- // </div>- // </div>-- // {/* 固定 */}- // <div className={Style.section}>- // <div className={Style.wrap}>- // <div className={Style.wrapPanel}>- // <input type="checkbox" className={Style.verticalMiddle} />- // <span className={Style.verticalMiddle}>固定位置</span>- // </div>- // </div>- // </div>-- // {/* 边框 */}- // <div className={Style.section}>- // <div className={Style.wrap}>- // <div className={Style.wrapTitle}></div>- // <div className={Style.wrapPanel}></div>- // </div>- // </div>-- // {/* 样式 */}- // <div className={Style.section}>- // <div className={Style.wrap}>- // <div className={Style.wrapTitle}>边框</div>- // <div className={Style.wrapPanel}>- // <div className={Style.wrapItem}>- // <span className={Style.label}>宽度:</span>- // <input type="text" value={this._width} />- // </div>- // <div className={Style.wrapItem}>- // <span className={Style.label}>半径:</span>- // <input type="text" value={this._radius} />- // </div>- // <div className={Style.wrapItem}>- // <span className={Style.label}>样式:</span>- // <select>- // <option>实线</option>- // <option>虚线</option>- // <option>点状</option>- // <option>双线</option>- // </select>- // </div>- // <div className={Style.wrapItem}>- // <span className={Style.label}>颜色:</span>- // <ColorPicker color={'#000'} />- // </div>- // </div>- // </div>- // </div>- // </div>- // </SiderModal>- <></>- );- }-}diff --git a/packages/sheets-plugin-image/src/View/UI/ImageUploadButton/ImageUploadButtonUI.module.less b/packages/sheets-plugin-image/src/View/UI/ImageUploadButton/ImageUploadButtonUI.module.lessdeleted file mode 100644index e69de29bb2..0000000000diff --git a/packages/sheets-plugin-image/src/View/UI/ImageUploadButton/ImageUploadButtonUI.tsx b/packages/sheets-plugin-image/src/View/UI/ImageUploadButton/ImageUploadButtonUI.tsxdeleted file mode 100644index 82b84bee68..0000000000--- a/packages/sheets-plugin-image/src/View/UI/ImageUploadButton/ImageUploadButtonUI.tsx+++ /dev/null@@ -1,31 +0,0 @@-import { Component } from 'react';--export interface ImageUploadButtonUIProps {- chooseCallback: (url: string, file: File) => void;-}--export class ImageUploadButtonUI extends Component<ImageUploadButtonUIProps> {- constructor(props: ImageUploadButtonUIProps) {- super(props);- this.initialize(props);- }-- initialize(props: ImageUploadButtonUIProps) {- this.state = {};- }-- override render() {- // const Props: IToolbarItemProps = {- // locale: 'ImageUploadButtonUI',- // type: 'single',- // label: <OrderIcon />,- // show: true,- // onClick: async (item: IToolbarItemProps, context: SheetContext) => {- // const file = await FileSelected.chooseImage();- // this.props.chooseCallback(URL.createObjectURL(file), file);- // },- // };- // return <SingleButton tooltip={Props.tooltip} key={Props.locale} name={Props.locale} label={Props.label} onClick={Props.onClick} />;- return undefined;- }-}diff --git a/packages/sheets-plugin-image/src/commands/operations/upload.operation.ts b/packages/sheets-plugin-image/src/commands/operations/upload.operation.tsdeleted file mode 100644index 16ed6fcd75..0000000000--- a/packages/sheets-plugin-image/src/commands/operations/upload.operation.ts+++ /dev/null@@ -1,14 +0,0 @@-import { CommandType, ICommand } from '@univerjs/core';-import { IAccessor } from '@wendellhu/redi';--import { UploadService } from '../../services/upload.service';--export const UploadOperation: ICommand = {- id: 'image.operation.upload',- type: CommandType.OPERATION,- handler: async (accessor: IAccessor) => {- const uploadService = accessor.get(UploadService);- uploadService.upload();- return true;- },-};diff --git a/packages/sheets-plugin-image/src/index.ts b/packages/sheets-plugin-image/src/index.tsdeleted file mode 100644index 641bfc8114..0000000000--- a/packages/sheets-plugin-image/src/index.ts+++ /dev/null@@ -1,3 +0,0 @@-import './RegisterAction';--export { ImagePlugin } from './ImagePlugin';diff --git a/packages/sheets-plugin-image/src/main.tsx b/packages/sheets-plugin-image/src/main.tsxdeleted file mode 100644index b3da93405b..0000000000--- a/packages/sheets-plugin-image/src/main.tsx+++ /dev/null@@ -1,18 +0,0 @@-// import { RenderEngine } from '@univerjs/base-render';-// import { SheetPlugin } from '@univerjs/base-sheets';-// import { DEFAULT_WORKBOOK_DATA } from '@univerjs/common-plugin-data';-// import { UniverSheet } from '@univerjs/core';--// const uiDefaultConfigUp = {-// container: 'universheet-demo-up',-// };-// const univerSheetUp = UniverSheet.newInstance(DEFAULT_WORKBOOK_DATA);-// univerSheetUp.installPlugin(new RenderEngine());-// univerSheetUp.installPlugin(new UniverComponentSheet());-// univerSheetUp.installPlugin(new RenderEngine());-// univerSheetUp.installPlugin(new SheetPlugin(uiDefaultConfigUp));-// // univerSheetUp.installPlugin(-// // new OverGridImagePlugin({-// // value: [],-// // })-// // );diff --git a/packages/sheets-plugin-image/src/services/upload.service.ts b/packages/sheets-plugin-image/src/services/upload.service.tsdeleted file mode 100644index 033d21fc7d..0000000000--- a/packages/sheets-plugin-image/src/services/upload.service.ts+++ /dev/null@@ -1,54 +0,0 @@-import { SelectionManagerService } from '@univerjs/base-sheets';-import { IUniverInstanceService } from '@univerjs/core';-import { Inject, Injector } from '@wendellhu/redi';--import { FileSelected } from '../Basics';--export class UploadService {- constructor(- @Inject(Injector) readonly _injector: Injector,- @IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,- @Inject(SelectionManagerService) private readonly _selectionManagerService: SelectionManagerService- ) {}-- upload() {- const { _selectionManagerService, _currentUniverService, _injector } = this;- const selection = _selectionManagerService.getLast()?.range;- const worksheet = this._currentUniverService.getCurrentUniverSheetInstance().getActiveSheet();- if (selection == null) {- return;- }- const activeRange = worksheet.getRange(selection);- const rowIndex = activeRange.getRowIndex();- const columnIndex = activeRange.getColumn();- const workbook = _currentUniverService.getCurrentUniverSheetInstance();- FileSelected.chooseImage().then((file) => {- const reader = new FileReader();- const img = new Image();- reader.readAsDataURL(file);- reader.onload = () => {- img.src = reader.result as string;- };- img.onload = () => {- // FIXME use command system- // const action: IAddOverGridImageActionData = {- // actionName: AddOverGridImageAction.NAME,- // id: Tools.generateRandomId(),- // borderType: OverGridImageBorderType.SOLID,- // row: rowIndex || 1,- // column: columnIndex || 1,- // url: img.src,- // radius: 0,- // width: img.width,- // height: img.height,- // borderColor: '#000000',- // borderWidth: 1,- // sheetId: workbook.getActiveSheet().getSheetId(),- // injector: _injector,- // };- // const command = new Command({ WorkBookUnit: workbook }, action);- // this._commandManager.invoke(command);- };- });- }-}diff --git a/packages/sheets-plugin-image/tsconfig.json b/packages/sheets-plugin-image/tsconfig.jsondeleted file mode 100644index 56379c3a55..0000000000--- a/packages/sheets-plugin-image/tsconfig.json+++ /dev/null@@ -1,14 +0,0 @@-{- "extends": "../../tsconfig.json",- "compilerOptions": {- "rootDir": "./",- "outDir": "lib",- "baseUrl": "./",- "esModuleInterop": true,- "strictPropertyInitialization": false- },- "include": [- "src/**/*",- "test/**/*.test.(ts|tsx|js)"- ]-}\ No newline at end of file