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 `BaseComponent` (#1188)
白熱40a86a1b7fcb
diff --git a/packages/docs-ui/src/views/doc-container/DocContainer.tsx b/packages/docs-ui/src/views/doc-container/DocContainer.tsxindex 81f1aad567..ea3963e5a1 100644--- a/packages/docs-ui/src/views/doc-container/DocContainer.tsx+++ b/packages/docs-ui/src/views/doc-container/DocContainer.tsx@@ -14,13 +14,12 @@* limitations under the License.*/-import type { BaseComponentProps } from '@univerjs/ui';import React, { Component, createRef } from 'react';import type { IUniverDocsUIConfig } from '../../basics';import style from './index.module.less';-interface IBaseDocContainerProps extends BaseComponentProps {+interface IBaseDocContainerProps {config: IUniverDocsUIConfig;changeLocale: (locale: string) => void;methods?: any;@@ -47,10 +46,6 @@ export class DocContainer extends Component<IBaseDocContainerProps> {this.changeSkin(props.config.container as string, 'default');}- override componentDidMount() {- this.props.getComponent?.(this);- }-/*** split mouse down* @param ediff --git a/packages/slides-ui/src/views/info-bar/InfoBar.tsx b/packages/slides-ui/src/views/info-bar/InfoBar.tsxindex 9ea07df7a2..a6e2eed267 100644--- a/packages/slides-ui/src/views/info-bar/InfoBar.tsx+++ b/packages/slides-ui/src/views/info-bar/InfoBar.tsx@@ -16,7 +16,6 @@import type { Nullable } from '@univerjs/core';import { Container, Input, Tooltip } from '@univerjs/design';-import type { BaseComponentProps } from '@univerjs/ui';import React, { Component } from 'react';import type { BaseInfoBarProps } from '../../controllers/info-bar-ui-controller';@@ -26,7 +25,7 @@ interface IState {infoList: Nullable<BaseInfoBarProps>;}-interface IProps extends BaseComponentProps {+interface IProps {renameSheet: () => void;}@@ -42,10 +41,6 @@ export class InfoBar extends Component<IProps, IState> {};}- override componentDidMount() {- this.props.getComponent?.(this);- }-setInfoList(list: BaseInfoBarProps) {this.setState({infoList: list,diff --git a/packages/slides-ui/src/views/slide-bar/SlideBar.tsx b/packages/slides-ui/src/views/slide-bar/SlideBar.tsxindex 0129c9b7d4..27f13fdbdc 100644--- a/packages/slides-ui/src/views/slide-bar/SlideBar.tsx+++ b/packages/slides-ui/src/views/slide-bar/SlideBar.tsx@@ -15,7 +15,6 @@*/import type { ISlidePage } from '@univerjs/core';-import type { BaseComponentProps } from '@univerjs/ui';import React, { Component, createRef } from 'react';import styles from './index.module.less';@@ -25,7 +24,7 @@ interface SlideBarState {activePageId?: string;}-interface IProps extends BaseComponentProps {+interface IProps {addSlide: () => void;activeSlide: (pageId: string) => void;}diff --git a/packages/slides-ui/src/views/slide-container/SlideContainer.tsx b/packages/slides-ui/src/views/slide-container/SlideContainer.tsxindex 27cd3d84cd..ef4aa06bf1 100644--- a/packages/slides-ui/src/views/slide-container/SlideContainer.tsx+++ b/packages/slides-ui/src/views/slide-container/SlideContainer.tsx@@ -14,7 +14,6 @@* limitations under the License.*/-import type { BaseComponentProps } from '@univerjs/ui';import React, { Component, createRef } from 'react';import type { IUniverSlidesUIConfig } from '../../basics';@@ -23,7 +22,7 @@ import { SlideBar } from '../slide-bar/SlideBar';import { Toolbar } from '../toolbar';import style from './index.module.less';-export interface BaseSlideContainerProps extends BaseComponentProps {+export interface BaseSlideContainerProps {config: IUniverSlidesUIConfig;changeLocale: (locale: string) => void;methods?: any;@@ -50,10 +49,6 @@ export class SlideContainer extends Component<BaseSlideContainerProps> {this.changeSkin(props.config.container as string, 'default');}- override componentDidMount() {- this.props.getComponent?.(this);- }-/*** split mouse down* @param ediff --git a/packages/slides-ui/src/views/toolbar/Toolbar.tsx b/packages/slides-ui/src/views/toolbar/Toolbar.tsxindex 2f860d2a43..463b913afd 100644--- a/packages/slides-ui/src/views/toolbar/Toolbar.tsx+++ b/packages/slides-ui/src/views/toolbar/Toolbar.tsx@@ -15,7 +15,6 @@*/import { Button, Container, Tooltip } from '@univerjs/design';-import type { BaseComponentProps } from '@univerjs/ui';import React, { Component, createRef } from 'react';import type { UniverSlidesUIPlugin } from '../..';@@ -23,7 +22,7 @@ import { SLIDE_UI_PLUGIN_NAME } from '../../basics';import type { IToolbarItemProps } from '../../controllers';import styles from './index.module.less';-interface IProps extends BaseComponentProps {+interface IProps {style?: React.CSSProperties;toolList: IToolbarItemProps[];}@@ -195,7 +194,6 @@ export class Toolbar extends Component<IProps, IState> {};override componentDidMount() {- this.props.getComponent?.(this);window.addEventListener('resize', this.debounceSetToolbarListWidth);}diff --git a/packages/ui/src/BaseComponent.ts b/packages/ui/src/BaseComponent.tsdeleted file mode 100644index c417976c60..0000000000--- a/packages/ui/src/BaseComponent.ts+++ /dev/null@@ -1,20 +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.- */--export interface BaseComponentProps {- getComponent?: (ref: any) => void; //获取自身组件- id?: string; // 组件id-}diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.tsindex cb40c453c7..82d103fefb 100644--- a/packages/ui/src/index.ts+++ b/packages/ui/src/index.ts@@ -14,7 +14,6 @@* limitations under the License.*/-export * from './BaseComponent';export * from './common';export { getMenuHiddenObservable } from './common/menu-hidden-observable';export * from './components';