Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove builtin global component #4714

Merged
merged 3 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.17.0
20.18.3
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ import { debounce, ICommandService, IContextService, IUniverInstanceService, Loc
import { ConfigContext, ConfigProvider, defaultTheme, themeInstance } from '@univerjs/design';
import { IRenderManagerService } from '@univerjs/engine-render';
import { MenuSingle } from '@univerjs/icons';
import { builtInGlobalComponents,
import {
BuiltInUIPart,
ComponentContainer,
ContextMenu,
GlobalZone,
UNI_DISABLE_CHANGING_FOCUS_KEY,
useComponentsOfPart,
useDependency,
Expand Down Expand Up @@ -265,7 +266,7 @@ export function UniWorkbench(props: IUniWorkbenchProps) {
</div>
</div>
<ComponentContainer key="global" components={globalComponents} />
<ComponentContainer key="built-in-global" components={builtInGlobalComponents} />
<GlobalZone />
{contextMenu && <ContextMenu />}
<FloatingContainer />
</ReactFlowProvider>
Expand Down
7 changes: 2 additions & 5 deletions packages/ui/src/controllers/ui/ui-mobile.controller.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,14 @@ import type { IUniverUIConfig } from '../config.schema';
import type { IUIController, IWorkbenchOptions } from './ui.controller';
import { Disposable, Inject, Injector, IUniverInstanceService, LifecycleService, LifecycleStages, Optional, toDisposable, UniverInstanceType } from '@univerjs/core';
import { render as createRoot, unmount } from '@univerjs/design';

import { IRenderManagerService } from '@univerjs/engine-render';

import React from 'react';
import { ILayoutService } from '../../services/layout/layout.service';
import { IMenuManagerService } from '../../services/menu/menu-manager.service';
import { BuiltInUIPart, IUIPartsService } from '../../services/parts/parts.service';
import { connectInjector } from '../../utils/di';
import { FloatDom } from '../../views/components/dom/FloatDom';
import { CanvasPopup } from '../../views/components/popup/CanvasPopup';
import { MobileApp } from '../../views/MobileApp';
import { MobileWorkbench } from '../../views/mobile-workbench/MobileWorkbench';
import { menuSchema } from '../menus/menu.schema';

const STEADY_TIMEOUT = 3000;
Expand Down Expand Up @@ -113,7 +110,7 @@ function bootstrap(
mountContainer = createContainer('univer');
}

const ConnectedApp = connectInjector(MobileApp, injector);
const ConnectedApp = connectInjector(MobileWorkbench, injector);
const onRendered = (canvasElement: HTMLElement) => callback(canvasElement, mountContainer);

function render() {
Expand Down
1 change: 0 additions & 1 deletion packages/ui/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ export { UNIVER_UI_PLUGIN_NAME } from './ui-plugin';
export * from './utils';
export { ComponentContainer, type IComponentContainerProps, useComponentsOfPart } from './views/components/ComponentContainer';
export { ZenZone } from './views/components/zen-zone/ZenZone';
export { builtInGlobalComponents } from './views/parts';

// #region - workbench components

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@
*/

import type { ILocale } from '@univerjs/design';
import type { IWorkbenchOptions } from '../controllers/ui/ui.controller';
import type { IWorkbenchOptions } from '../../controllers/ui/ui.controller';
import { LocaleService, ThemeService } from '@univerjs/core';
import { ConfigProvider, defaultTheme, themeInstance } from '@univerjs/design';
import React, { useEffect, useMemo, useRef, useState } from 'react';
import { BuiltInUIPart } from '../services/parts/parts.service';
import { useDependency } from '../utils/di';
import { ComponentContainer, useComponentsOfPart } from './components/ComponentContainer';
import { MobileContextMenu } from './components/context-menu/MobileContextMenu';
import { Sidebar } from './components/sidebar/Sidebar';
import { ZenZone } from './components/zen-zone/ZenZone';
import styles from './mobile-app.module.less';
import { builtInGlobalComponents } from './parts';
import { BuiltInUIPart } from '../../services/parts/parts.service';
import { useDependency } from '../../utils/di';
import { ComponentContainer, useComponentsOfPart } from '../components/ComponentContainer';
import { MobileContextMenu } from '../components/context-menu/MobileContextMenu';
import { GlobalZone } from '../components/global-zone/GlobalZone';
import { Sidebar } from '../components/sidebar/Sidebar';
import { ZenZone } from '../components/zen-zone/ZenZone';
import styles from './mobile-workbench.module.less';

export interface IUniverAppProps extends IWorkbenchOptions {
mountContainer: HTMLElement;

onRendered?: (container: HTMLElement) => void;
}

export function MobileApp(props: IUniverAppProps) {
export function MobileWorkbench(props: IUniverAppProps) {
const {
header = true,
footer = true,
Expand Down Expand Up @@ -139,12 +139,11 @@ export function MobileApp(props: IUniverAppProps) {
<ComponentContainer key="footer" components={footerComponents} />
</footer>
)}

<GlobalZone />
<ZenZone />
</section>
</div>
<ComponentContainer key="global" components={globalComponents} />
<ComponentContainer key="built-in-global" components={builtInGlobalComponents} />
{contextMenu && <MobileContextMenu />}
</ConfigProvider>
);
Expand Down
21 changes: 0 additions & 21 deletions packages/ui/src/views/parts.ts

This file was deleted.

5 changes: 2 additions & 3 deletions packages/ui/src/views/workbench/Workbench.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ import { BuiltInUIPart } from '../../services/parts/parts.service';
import { useDependency } from '../../utils/di';
import { ComponentContainer, useComponentsOfPart } from '../components/ComponentContainer';
import { DesktopContextMenu } from '../components/context-menu/ContextMenu';

import { GlobalZone } from '../components/global-zone/GlobalZone';
import { Sidebar } from '../components/sidebar/Sidebar';
import { ZenZone } from '../components/zen-zone/ZenZone';
import { builtInGlobalComponents } from '../parts';
import styles from './workbench.module.less';

export interface IUniverWorkbenchProps extends IWorkbenchOptions {
Expand Down Expand Up @@ -197,7 +196,7 @@ export function DesktopWorkbench(props: IUniverWorkbenchProps) {
</section>
</div>
<ComponentContainer key="global" components={globalComponents} />
<ComponentContainer key="built-in-global" components={builtInGlobalComponents} />
<GlobalZone />
{contextMenu && <DesktopContextMenu />}
<FloatingContainer />
<div id="univer-popup-portal" />
Expand Down