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
style(core):add comment,remove unused module,spell check
Dushusire956761c22ca
diff --git a/.vscode/settings.json b/.vscode/settings.jsonindex 9c451bb16b..cde9c3fe97 100644--- a/.vscode/settings.json+++ b/.vscode/settings.json@@ -30,6 +30,7 @@"FONTFACE","fract","gainsboro",+ "GANTT","Gridlines","Hanalei","hdmx",@@ -37,9 +38,9 @@"Hiragino","ilvl","Kaiti",+ "KANBAN","Lerp","Liti",- "universheet","mengshukeji","Overlines","Pacifico",diff --git a/packages/core/src/Basics/Registry.ts b/packages/core/src/Basics/Registry.tsindex 3df14711b8..f64dfd4f53 100644--- a/packages/core/src/Basics/Registry.ts+++ b/packages/core/src/Basics/Registry.ts@@ -1,3 +1,9 @@+/**+ * Add extension modules statically when the plugin is initialized, so that the plugin can register these extension modules uniformly+ *+ * @privateRemarks+ * zh: 在插件初始化的时候静态添加扩展模块,方便插件统一注册这些扩展模块+ */export class Registry {private _data: any[] = [];@@ -19,6 +25,12 @@ export class Registry {}}+/**+ * Add extension modules statically when the plugin is initialized, so that the plugin can register these extension modules uniformly+ *+ * @privateRemarks+ * zh: 在插件初始化的时候静态添加扩展模块,方便插件统一注册这些扩展模块+ */export class RegistryAsMap {private _data: Map<string, any> = new Map();diff --git a/packages/core/src/Basics/Sequence.ts b/packages/core/src/Basics/Sequence.tsindex c313ece47d..96f11c408a 100644--- a/packages/core/src/Basics/Sequence.ts+++ b/packages/core/src/Basics/Sequence.ts@@ -1,4 +1,8 @@-// 列下标 字母转数字+/**+ * column subscript letter to number+ * @param a letter+ * @returns+ */export function ABCToNumber(a: string) {if (a == null || a.length === 0) {return NaN;@@ -12,7 +16,6 @@ export function ABCToNumber(a: string) {charnum = getCharNumber(str[i]);numOut += charnum * 26 ** (al - i - 1);}- // console.log(a, numOut-1);if (numOut === 0) {return NaN;}@@ -24,7 +27,11 @@ const orderZ = 'Z'.charCodeAt(0);const order_a = 'a'.charCodeAt(0);const order_z = 'z'.charCodeAt(0);-// 列下标 数字转字母+/**+ * column subscript number to letters+ * @param n number+ * @returns+ */export function numberToABC(n: number) {const len = orderZ - orderA + 1;@@ -39,7 +46,12 @@ export function numberToABC(n: number) {return s;}-// 重复给定的字符串(第一个参数)num次(第二个参数)。如果num不是正数,则返回一个空字符串。+/**+ * Repeats the given string (first argument) num times (second argument). If num is not positive, an empty string is returned.+ * @param string given string+ * @param times repeat times+ * @returns+ */export function repeatStringNumTimes(string: string, times: number) {let repeatedString = '';while (times > 0) {@@ -49,7 +61,12 @@ export function repeatStringNumTimes(string: string, times: number) {return repeatedString;}-// 列下标 数字转列表样式的字母,例如25之后表示AA BB CC,而不是AA AB AC+/**+ * Column subscript numbers are converted to list-style letters, for example, after 25, it means AA BB CC, not AA AB AC+ * @param n number+ * @param uppercase Is it a capital letter+ * @returns+ */export function numberToListABC(n: number, uppercase = false) {const len = orderZ - orderA + 1;diff --git a/packages/core/src/Basics/sortRules.ts b/packages/core/src/Basics/SortRules.tssimilarity index 100%rename from packages/core/src/Basics/sortRules.tsrename to packages/core/src/Basics/SortRules.tsdiff --git a/packages/core/src/Basics/index.ts b/packages/core/src/Basics/index.tsindex 8e3d73d35b..a43b21976e 100644--- a/packages/core/src/Basics/index.ts+++ b/packages/core/src/Basics/index.ts@@ -5,6 +5,6 @@ export * from './Environment';export * from './UniverSheet';export * from './Version';export * from './Registry';-export * from './sortRules';+export * from './SortRules';export * from './Sequence';// @endindexdiff --git a/packages/core/src/Collaboration/IConflictRules.ts b/packages/core/src/Collaboration/IConflictRules.tsdeleted file mode 100644index 7f99078350..0000000000--- a/packages/core/src/Collaboration/IConflictRules.ts+++ /dev/null@@ -1 +0,0 @@-export interface IConflictRules {}diff --git a/packages/core/src/Command/ActionObservers.ts b/packages/core/src/Command/ActionObservers.tsindex 5da7948e3b..b6c981b749 100644--- a/packages/core/src/Command/ActionObservers.ts+++ b/packages/core/src/Command/ActionObservers.ts@@ -1,11 +1,17 @@import { Observable } from '../Observer';import { ActionBase, IActionData } from './ActionBase';+/**+ * Action type+ */export enum ActionType {REDO,UNDO,}+/**+ * Action observer props+ */export interface IActionObserverProps {type: ActionType;data: IActionData;diff --git a/packages/core/src/Command/CommandBase.ts b/packages/core/src/Command/CommandBase.tsindex 696c9da56b..7cf754bb4f 100644--- a/packages/core/src/Command/CommandBase.ts+++ b/packages/core/src/Command/CommandBase.ts@@ -4,6 +4,7 @@ import { CommandManager } from './CommandManager';import { CommandType } from './CommandObservers';import { CommandInjector } from './CommandInjectorObservers';import { Class, Nullable } from '../Shared';+/*** Manage action instances and action data*/diff --git a/packages/core/src/Command/CommandInjectorObservers.ts b/packages/core/src/Command/CommandInjectorObservers.tsindex f931054fbe..7a9afeec60 100644--- a/packages/core/src/Command/CommandInjectorObservers.ts+++ b/packages/core/src/Command/CommandInjectorObservers.ts@@ -2,6 +2,12 @@ import { Observable } from '../Observer';import { Class, Nullable } from '../Shared';import { ActionBase, IActionData } from './ActionBase';+/**+ * Command injector, after the core triggers the Command, the plug-in receives the Command Observer message, inserts its own Action, and combines it into one Command, which is convenient for undo/redo to be executed as a command.+ *+ * @privateRemarks+ * zh: Command injector, 核心触发的Command后,插件接受到Command Observer消息之后,插入自己的Action,组合为一个Command,方便撤销重做作为一个指令执行。+ */export interface CommandInjector {injectAction(action: ActionBase<IActionData>): void;diff --git a/packages/core/src/Command/CommandObservers.ts b/packages/core/src/Command/CommandObservers.tsindex 91dee100ea..312a9573e6 100644--- a/packages/core/src/Command/CommandObservers.ts+++ b/packages/core/src/Command/CommandObservers.ts@@ -1,14 +1,23 @@import { Observable } from '../Observer';import { ActionBase, IActionData } from './ActionBase';+/**+ * Command type+ */export enum CommandType {REDO,UNDO,}+/**+ * Command observer props+ */interface ICommandObserverProps {type: CommandType;actions: Array<ActionBase<IActionData>>;}+/**+ * Command observers+ */export class CommandObservers extends Observable<ICommandObserverProps> {}diff --git a/packages/core/src/Command/RegisterAction.ts b/packages/core/src/Command/RegisterAction.tsindex c3a1a35d2c..e322a1f9ff 100644--- a/packages/core/src/Command/RegisterAction.ts+++ b/packages/core/src/Command/RegisterAction.ts@@ -49,6 +49,10 @@ import { RemoveColumnAction } from '../Sheets/Action/removeColumnAction';import { RemoveSheetAction } from '../Sheets/Action/RemoveSheetAction';import { CommandManager } from './CommandManager';+/**+ * All Commands are registered statically. For each new Command, a static registration method must be added here.+ */+CommandManager.register(ACTION_NAMES.INSERT_ROW_DATA_ACTION, InsertRowDataAction);CommandManager.register(ACTION_NAMES.INSERT_ROW_ACTION, InsertRowAction);CommandManager.register(ACTION_NAMES.REMOVE_ROW_DATA_ACTION, RemoveRowDataAction);diff --git a/packages/core/src/Conflict/Conflict.ts b/packages/core/src/Conflict/Conflict.tsdeleted file mode 100644index e315a7765e..0000000000--- a/packages/core/src/Conflict/Conflict.ts+++ /dev/null@@ -1,7 +0,0 @@-import { ActionBase, IActionData } from '../Command/ActionBase';--export abstract class Conflict {- abstract comparison(- ...action: Array<ActionBase<IActionData>>- ): Array<ActionBase<IActionData>> | boolean;-}diff --git a/packages/core/src/Const/CONST.ts b/packages/core/src/Const/CONST.tsindex 1f6cea37ba..e31e04c1cd 100644--- a/packages/core/src/Const/CONST.ts+++ b/packages/core/src/Const/CONST.ts@@ -123,13 +123,13 @@ export const DEFAULT_STYLES: IStyleData = {* 0: false* 1: true*/- it: 0,+ it: BooleanNumber.FALSE,/*** bold* 0: false* 1: true*/- bl: 0,+ bl: BooleanNumber.FALSE,/*** underline*/@@ -157,7 +157,7 @@ export const DEFAULT_STYLES: IStyleData = {* true : 1* false : 0*/- v: 0,+ v: BooleanNumber.FALSE,},/** ** textDirection@@ -196,10 +196,6 @@ export const DEFAULT_STYLES: IStyleData = {b: 0,l: 0,},- /**- * format- */- // fm: { f: 'string', t: 'string' },};/**@@ -211,38 +207,3 @@ export const CONVERTOR_OPERATION = {REMOVE: 'remove',CHANGE: 'change',};--/**- * Random color for formula cell input- */-export 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',-];diff --git a/packages/core/src/Enum/AutoFillSeries.ts b/packages/core/src/Enum/AutoFillSeries.tsindex 710398deb2..4a4e46f47e 100644--- a/packages/core/src/Enum/AutoFillSeries.ts+++ b/packages/core/src/Enum/AutoFillSeries.ts@@ -1,9 +1,20 @@/**- * Mode of auto fill+ * Auto-fill series+ *+ * @remarks+ * An enumeration of the types of series used to calculate auto-filled values. The manner in which these series affect calculated values differs depending on the type and amount of source data.+ *+ * Reference: {@link https://developers.google.com/apps-script/reference/spreadsheet/auto-fill-series | Google Sheets Enum AutoFillSeries}*/export enum AutoFillSeries {- ALTERNATE_SERIES,+ /**+ * Default. Auto-filling with this setting results in the empty cells in the expanded range being filled with increments of the existing values.+ */DEFAULT_SERIES,+ /**+ * Auto-filling with this setting results in the empty cells in the expanded range being filled with copies of the existing values.+ */+ ALTERNATE_SERIES,}// TODO 同类型整合diff --git a/packages/core/src/Enum/KeyCode.ts b/packages/core/src/Enum/KeyCode.tsindex e2f828cc78..5a796423f1 100644--- a/packages/core/src/Enum/KeyCode.ts+++ b/packages/core/src/Enum/KeyCode.ts@@ -8,12 +8,12 @@ export enum KeyCode {SHIFT = 16,CTRL = 17,PAUSE = 19,- CAPSLOCK = 20,+ CAPS_LOCK = 20,ESC = 27,SPACE = 33,- PAGEUP = 33,- PAGEDOWN = 34,+ PAGE_UP = 33,+ PAGE_DOWN = 34,END = 35,HOME = 36,LEFT = 37,@@ -39,6 +39,6 @@ export enum KeyCode {F10 = 121,F11 = 122,F12 = 123,- NUMLOCK = 144,- SCROLLLOCK = 145,+ NUM_LOCK = 144,+ SCROLL_LOCK = 145,}diff --git a/packages/core/src/Sheets/Action/InsertColumnDataAction.ts b/packages/core/src/Sheets/Action/InsertColumnDataAction.tsindex 3251bd253d..ab0ec28c65 100644--- a/packages/core/src/Sheets/Action/InsertColumnDataAction.ts+++ b/packages/core/src/Sheets/Action/InsertColumnDataAction.ts@@ -12,7 +12,7 @@ import { ObjectArray } from '../../Shared';*/export interface IInsertColumnDataActionData extends IActionData {columnIndex: number;- columnData: ObjectMatrixPrimitiveType<ICellData>;+ columnData: ObjectMatrixPrimitiveType<ICellData>; // TODO Does it need to be merged with IKeyValue}/**diff --git a/packages/style-universheet/src/Components/RichText/CellInputHandler.ts b/packages/style-universheet/src/Components/RichText/CellInputHandler.tsindex 960e43e979..698bd5e3ef 100644--- a/packages/style-universheet/src/Components/RichText/CellInputHandler.ts+++ b/packages/style-universheet/src/Components/RichText/CellInputHandler.ts@@ -1,8 +1,43 @@import { $$, getNodeindex } from '@univer/base-component';-import { Nullable, LUCKY_COLOR, Tools } from '@univer/core';+import { Nullable, Tools } from '@univer/core';import { lang } from './locale';import styles from './index.module.less';+/**+ * 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*/