From b3ae7681f842bda0ffefa5e1c5ef6dc33dae3201 Mon Sep 17 00:00:00 2001 From: zhangw Date: Fri, 20 Dec 2024 05:58:56 -0500 Subject: [PATCH 1/5] feat: facade-enums --- packages/core/src/facade/f-enum.ts | 41 ++++++++++++++++++++++++++++ packages/core/src/facade/f-univer.ts | 5 ++++ 2 files changed, 46 insertions(+) create mode 100644 packages/core/src/facade/f-enum.ts diff --git a/packages/core/src/facade/f-enum.ts b/packages/core/src/facade/f-enum.ts new file mode 100644 index 00000000000..b81c5ad0138 --- /dev/null +++ b/packages/core/src/facade/f-enum.ts @@ -0,0 +1,41 @@ +/** + * Copyright 2023-present DreamNum Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { DataValidationErrorStyle } from '../types/enum/data-validation-error-style'; +import { DataValidationOperator } from '../types/enum/data-validation-operator'; +import { DataValidationRenderMode } from '../types/enum/data-validation-render-mode'; +import { DataValidationStatus } from '../types/enum/data-validation-status'; +import { DataValidationType } from '../types/enum/data-validation-type'; +import { FBase } from './f-base'; + +export class FEnum extends FBase { + static fEnums: FEnum | null = null; + static getEnums() { + if (!this.fEnums) { + this.fEnums = new FEnum(); + } + return this.fEnums; + } + + dataValidation = { + type: DataValidationType, + errorStyle: DataValidationErrorStyle, + renderMode: DataValidationRenderMode, + operator: DataValidationOperator, + validStatus: DataValidationStatus, + }; +} + diff --git a/packages/core/src/facade/f-univer.ts b/packages/core/src/facade/f-univer.ts index afad97371a4..c61d01e12cb 100644 --- a/packages/core/src/facade/f-univer.ts +++ b/packages/core/src/facade/f-univer.ts @@ -25,6 +25,7 @@ import { RedoCommand, UndoCommand } from '../services/undoredo/undoredo.service' import { Univer } from '../univer'; import { FBase } from './f-base'; import { FBlob } from './f-blob'; +import { FEnum } from './f-enum'; import { FHooks } from './f-hooks'; export class FUniver extends FBase { @@ -162,4 +163,8 @@ export class FUniver extends FBase { newBlob(): FBlob { return this._injector.createInstance(FBlob); } + + get enums() { + return this._injector.createInstance(FEnum); + } } From e862219c7f331f5c41c15ab61c3db4748e860838 Mon Sep 17 00:00:00 2001 From: zhangw Date: Fri, 20 Dec 2024 06:00:56 -0500 Subject: [PATCH 2/5] feat: update --- packages/core/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 259e249433d..389900d178c 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -42,6 +42,7 @@ export { MemoryCursor } from './common/memory-cursor'; export { mixinClass } from './common/mixin'; export { FBase } from './facade/f-base'; export { FUniver } from './facade/f-univer'; +export { FEnum } from './facade/f-enum'; export { FHooks } from './facade/f-hooks'; export { FBlob, type IFBlobSource } from './facade/f-blob'; export { isNumeric, isSafeNumeric } from './common/number'; From a29c8bf633254462c19204af311286c9181d8a78 Mon Sep 17 00:00:00 2001 From: zhangw Date: Fri, 20 Dec 2024 06:08:46 -0500 Subject: [PATCH 3/5] feat: update --- packages/core/src/facade/f-enum.ts | 41 ---------------------------- packages/core/src/facade/f-univer.ts | 14 +++++++--- 2 files changed, 10 insertions(+), 45 deletions(-) delete mode 100644 packages/core/src/facade/f-enum.ts diff --git a/packages/core/src/facade/f-enum.ts b/packages/core/src/facade/f-enum.ts deleted file mode 100644 index b81c5ad0138..00000000000 --- a/packages/core/src/facade/f-enum.ts +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright 2023-present DreamNum Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { DataValidationErrorStyle } from '../types/enum/data-validation-error-style'; -import { DataValidationOperator } from '../types/enum/data-validation-operator'; -import { DataValidationRenderMode } from '../types/enum/data-validation-render-mode'; -import { DataValidationStatus } from '../types/enum/data-validation-status'; -import { DataValidationType } from '../types/enum/data-validation-type'; -import { FBase } from './f-base'; - -export class FEnum extends FBase { - static fEnums: FEnum | null = null; - static getEnums() { - if (!this.fEnums) { - this.fEnums = new FEnum(); - } - return this.fEnums; - } - - dataValidation = { - type: DataValidationType, - errorStyle: DataValidationErrorStyle, - renderMode: DataValidationRenderMode, - operator: DataValidationOperator, - validStatus: DataValidationStatus, - }; -} - diff --git a/packages/core/src/facade/f-univer.ts b/packages/core/src/facade/f-univer.ts index c61d01e12cb..db80d9ba8e2 100644 --- a/packages/core/src/facade/f-univer.ts +++ b/packages/core/src/facade/f-univer.ts @@ -22,10 +22,14 @@ import { ICommandService } from '../services/command/command.service'; import { IUniverInstanceService } from '../services/instance/instance.service'; import { LifecycleService } from '../services/lifecycle/lifecycle.service'; import { RedoCommand, UndoCommand } from '../services/undoredo/undoredo.service'; +import { DataValidationErrorStyle } from '../types/enum/data-validation-error-style'; +import { DataValidationOperator } from '../types/enum/data-validation-operator'; +import { DataValidationRenderMode } from '../types/enum/data-validation-render-mode'; +import { DataValidationStatus } from '../types/enum/data-validation-status'; +import { DataValidationType } from '../types/enum/data-validation-type'; import { Univer } from '../univer'; import { FBase } from './f-base'; import { FBlob } from './f-blob'; -import { FEnum } from './f-enum'; import { FHooks } from './f-hooks'; export class FUniver extends FBase { @@ -164,7 +168,9 @@ export class FUniver extends FBase { return this._injector.createInstance(FBlob); } - get enums() { - return this._injector.createInstance(FEnum); - } + DataValidationType = DataValidationType; + DataValidationErrorStyle = DataValidationErrorStyle; + DataValidationRenderMode = DataValidationRenderMode; + DataValidationOperator = DataValidationOperator; + DataValidationStatus = DataValidationStatus; } From 756080e11d47349aecdf9fc7b4b5d12237821409 Mon Sep 17 00:00:00 2001 From: zhangw Date: Fri, 20 Dec 2024 06:10:11 -0500 Subject: [PATCH 4/5] feat: update --- packages/core/src/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 389900d178c..259e249433d 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -42,7 +42,6 @@ export { MemoryCursor } from './common/memory-cursor'; export { mixinClass } from './common/mixin'; export { FBase } from './facade/f-base'; export { FUniver } from './facade/f-univer'; -export { FEnum } from './facade/f-enum'; export { FHooks } from './facade/f-hooks'; export { FBlob, type IFBlobSource } from './facade/f-blob'; export { isNumeric, isSafeNumeric } from './common/number'; From 98b1654f1d8e544657f7215c5bcdf10af9830767 Mon Sep 17 00:00:00 2001 From: zhangw Date: Tue, 24 Dec 2024 20:46:57 +0800 Subject: [PATCH 5/5] feat: update --- packages/core/src/facade/f-enum.ts | 29 ++++++++++++++++++++++++++++ packages/core/src/facade/f-event.ts | 19 ++++++++++++++++++ packages/core/src/facade/f-univer.ts | 23 ++++++++++++---------- packages/core/src/facade/f-util.ts | 19 ++++++++++++++++++ packages/core/src/index.ts | 2 ++ 5 files changed, 82 insertions(+), 10 deletions(-) create mode 100644 packages/core/src/facade/f-enum.ts create mode 100644 packages/core/src/facade/f-event.ts create mode 100644 packages/core/src/facade/f-util.ts diff --git a/packages/core/src/facade/f-enum.ts b/packages/core/src/facade/f-enum.ts new file mode 100644 index 00000000000..d68af3cd6d5 --- /dev/null +++ b/packages/core/src/facade/f-enum.ts @@ -0,0 +1,29 @@ +/** + * Copyright 2023-present DreamNum Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { DataValidationErrorStyle } from '../types/enum/data-validation-error-style'; +import { DataValidationOperator } from '../types/enum/data-validation-operator'; +import { DataValidationRenderMode } from '../types/enum/data-validation-render-mode'; +import { DataValidationStatus } from '../types/enum/data-validation-status'; +import { DataValidationType } from '../types/enum/data-validation-type'; + +export class FEnum { + static DataValidationType = DataValidationType; + static DataValidationErrorStyle = DataValidationErrorStyle; + static DataValidationRenderMode = DataValidationRenderMode; + static DataValidationOperator = DataValidationOperator; + static DataValidationStatus = DataValidationStatus; +} diff --git a/packages/core/src/facade/f-event.ts b/packages/core/src/facade/f-event.ts new file mode 100644 index 00000000000..5f7744944e2 --- /dev/null +++ b/packages/core/src/facade/f-event.ts @@ -0,0 +1,19 @@ +/** + * Copyright 2023-present DreamNum Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export class FEventName { + static CellChanged = 'CellChanged'; +} diff --git a/packages/core/src/facade/f-univer.ts b/packages/core/src/facade/f-univer.ts index db80d9ba8e2..e36fb6324d6 100644 --- a/packages/core/src/facade/f-univer.ts +++ b/packages/core/src/facade/f-univer.ts @@ -22,14 +22,11 @@ import { ICommandService } from '../services/command/command.service'; import { IUniverInstanceService } from '../services/instance/instance.service'; import { LifecycleService } from '../services/lifecycle/lifecycle.service'; import { RedoCommand, UndoCommand } from '../services/undoredo/undoredo.service'; -import { DataValidationErrorStyle } from '../types/enum/data-validation-error-style'; -import { DataValidationOperator } from '../types/enum/data-validation-operator'; -import { DataValidationRenderMode } from '../types/enum/data-validation-render-mode'; -import { DataValidationStatus } from '../types/enum/data-validation-status'; -import { DataValidationType } from '../types/enum/data-validation-type'; import { Univer } from '../univer'; import { FBase } from './f-base'; import { FBlob } from './f-blob'; +import { FEnum } from './f-enum'; +import { FEventName } from './f-event'; import { FHooks } from './f-hooks'; export class FUniver extends FBase { @@ -168,9 +165,15 @@ export class FUniver extends FBase { return this._injector.createInstance(FBlob); } - DataValidationType = DataValidationType; - DataValidationErrorStyle = DataValidationErrorStyle; - DataValidationRenderMode = DataValidationRenderMode; - DataValidationOperator = DataValidationOperator; - DataValidationStatus = DataValidationStatus; + get Enum() { + return FEnum; + } + + get Event() { + return FEventName; + } + + addEvent(event: FEventName, callback: () => void) { + + } } diff --git a/packages/core/src/facade/f-util.ts b/packages/core/src/facade/f-util.ts new file mode 100644 index 00000000000..f025dde7cbb --- /dev/null +++ b/packages/core/src/facade/f-util.ts @@ -0,0 +1,19 @@ +/** + * Copyright 2023-present DreamNum Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export class FUtil { + static Range = Range; +} diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 259e249433d..51a3e3edff2 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -44,6 +44,8 @@ export { FBase } from './facade/f-base'; export { FUniver } from './facade/f-univer'; export { FHooks } from './facade/f-hooks'; export { FBlob, type IFBlobSource } from './facade/f-blob'; +export { FEventName } from './facade/f-event'; +export { FEnum } from './facade/f-enum'; export { isNumeric, isSafeNumeric } from './common/number'; export { Registry, RegistryAsMap } from './common/registry'; export { requestImmediateMacroTask } from './common/request-immediate-macro-task';