1
This commit is contained in:
@@ -1,16 +0,0 @@
|
|||||||
import { EventBuilderImpl } from '@/events/impl/EventBuilderImpl.ts'
|
|
||||||
import type { IEventMap } from '@/events/IEventBuilder.ts'
|
|
||||||
import type { IDesktopAppIcon } from '@/ui/types/IDesktopAppIcon.ts'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 桌面相关的事件
|
|
||||||
*/
|
|
||||||
export interface IDesktopEvent extends IEventMap {
|
|
||||||
/**
|
|
||||||
* 桌面应用位置改变
|
|
||||||
*/
|
|
||||||
desktopAppPosChange: (info: IDesktopAppIcon) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 窗口事件管理器 */
|
|
||||||
export const desktopEM = new EventBuilderImpl<IDesktopEvent>()
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
import { EventBuilderImpl } from '@/core/events/impl/EventBuilderImpl.ts'
|
|
||||||
import type { IEventMap } from '@/core/events/IEventBuilder.ts'
|
|
||||||
import type { IDesktopAppIcon } from '@/core/desktop/types/IDesktopAppIcon.ts'
|
|
||||||
|
|
||||||
export const eventManager = new EventBuilderImpl<IAllEvent>()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 系统进程的事件
|
|
||||||
* @description
|
|
||||||
* <p>onAuthChange - 认证状态改变</p>
|
|
||||||
* <p>onThemeChange - 主题改变</p>
|
|
||||||
*/
|
|
||||||
export interface IBasicSystemEvent extends IEventMap {
|
|
||||||
/** 认证状态改变 */
|
|
||||||
onAuthChange: () => {},
|
|
||||||
/** 主题改变 */
|
|
||||||
onThemeChange: (theme: string) => void
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 桌面进程的事件
|
|
||||||
* @description
|
|
||||||
* <p>onDesktopRootDomResize - 桌面根dom尺寸改变</p>
|
|
||||||
* <p>onDesktopProcessInitialize - 桌面进程初始化完成</p>
|
|
||||||
*/
|
|
||||||
export interface IDesktopEvent extends IEventMap {
|
|
||||||
/** 桌面根dom尺寸改变 */
|
|
||||||
onDesktopRootDomResize: (width: number, height: number) => void
|
|
||||||
/** 桌面进程初始化完成 */
|
|
||||||
onDesktopProcessInitialize: () => void
|
|
||||||
/** 桌面应用图标位置改变 */
|
|
||||||
onDesktopAppIconPos: (iconInfo: IDesktopAppIcon) => void
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IAllEvent extends IDesktopEvent, IBasicSystemEvent {}
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
import { EventBuilderImpl } from '@/events/impl/EventBuilderImpl.ts'
|
|
||||||
import type { IEventMap } from '@/events/IEventBuilder.ts'
|
|
||||||
import type { TWindowFormState } from '@/ui/types/WindowFormTypes.ts'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 窗口的事件
|
|
||||||
*/
|
|
||||||
export interface IWindowFormEvent extends IEventMap {
|
|
||||||
/**
|
|
||||||
* 窗口最小化
|
|
||||||
* @param id 窗口id
|
|
||||||
*/
|
|
||||||
windowFormMinimize: (id: string) => void
|
|
||||||
/**
|
|
||||||
* 窗口最大化
|
|
||||||
* @param id 窗口id
|
|
||||||
*/
|
|
||||||
windowFormMaximize: (id: string) => void
|
|
||||||
/**
|
|
||||||
* 窗口还原
|
|
||||||
* @param id 窗口id
|
|
||||||
*/
|
|
||||||
windowFormRestore: (id: string) => void
|
|
||||||
/**
|
|
||||||
* 窗口关闭
|
|
||||||
* @param id 窗口id
|
|
||||||
*/
|
|
||||||
windowFormClose: (id: string) => void
|
|
||||||
/**
|
|
||||||
* 窗口聚焦
|
|
||||||
* @param id 窗口id
|
|
||||||
*/
|
|
||||||
windowFormFocus: (id: string) => void
|
|
||||||
/**
|
|
||||||
* 窗口数据更新
|
|
||||||
* @param data 窗口数据
|
|
||||||
*/
|
|
||||||
windowFormDataUpdate: (data: IWindowFormDataUpdateParams) => void
|
|
||||||
/**
|
|
||||||
* 窗口创建完成
|
|
||||||
*/
|
|
||||||
windowFormCreated: () => void
|
|
||||||
/**
|
|
||||||
* 开始调整窗体尺寸
|
|
||||||
* @param id 窗口id
|
|
||||||
*/
|
|
||||||
windowFormResizeStart: (id: string) => void
|
|
||||||
/**
|
|
||||||
* 调整尺寸过程中
|
|
||||||
* @param data 窗口数据
|
|
||||||
*/
|
|
||||||
windowFormResizing: (data: IWindowFormDataUpdateParams) => void
|
|
||||||
/**
|
|
||||||
* 完成窗体尺寸调整
|
|
||||||
* @param id 窗口id
|
|
||||||
*/
|
|
||||||
windowFormResizeEnd: (id: string) => void
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IWindowFormDataUpdateParams {
|
|
||||||
/** 窗口id */
|
|
||||||
id: string
|
|
||||||
/** 窗口状态 */
|
|
||||||
state: TWindowFormState
|
|
||||||
/** 窗口宽度 */
|
|
||||||
width: number
|
|
||||||
/** 窗口高度 */
|
|
||||||
height: number
|
|
||||||
/** 窗口x坐标(左上角) */
|
|
||||||
x: number
|
|
||||||
/** 窗口y坐标(左上角) */
|
|
||||||
y: number
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 窗口事件管理器 */
|
|
||||||
export const wfem = new EventBuilderImpl<IWindowFormEvent>()
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { IEventBuilder, IEventMap } from '@/core/events/IEventBuilder.ts'
|
import type { IEventBuilder, IEventMap } from '../IEventBuilder.ts'
|
||||||
|
|
||||||
interface HandlerWrapper<T extends (...args: any[]) => any> {
|
interface HandlerWrapper<T extends (...args: any[]) => any> {
|
||||||
fn: T
|
fn: T
|
||||||
|
|||||||
@@ -9,7 +9,22 @@ import { EventCommunicationService } from './EventCommunicationService'
|
|||||||
import { ApplicationSandboxEngine } from './ApplicationSandboxEngine'
|
import { ApplicationSandboxEngine } from './ApplicationSandboxEngine'
|
||||||
import { ApplicationLifecycleManager } from './ApplicationLifecycleManager'
|
import { ApplicationLifecycleManager } from './ApplicationLifecycleManager'
|
||||||
import { externalAppDiscovery } from './ExternalAppDiscovery'
|
import { externalAppDiscovery } from './ExternalAppDiscovery'
|
||||||
import type { IWindowFormDataUpdateParams } from '@/events/WindowFormEventManager'
|
import type { TWindowFormState } from '@/ui/types/WindowFormTypes'
|
||||||
|
|
||||||
|
export interface IWindowFormDataUpdateParams {
|
||||||
|
/** 窗口id */
|
||||||
|
id: string
|
||||||
|
/** 窗口状态 */
|
||||||
|
state: TWindowFormState
|
||||||
|
/** 窗口宽度 */
|
||||||
|
width: number
|
||||||
|
/** 窗口高度 */
|
||||||
|
height: number
|
||||||
|
/** 窗口x坐标(左上角) */
|
||||||
|
x: number
|
||||||
|
/** 窗口y坐标(左上角) */
|
||||||
|
y: number
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统服务配置接口
|
* 系统服务配置接口
|
||||||
@@ -112,7 +127,7 @@ export class SystemServiceIntegration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.startTime = new Date()
|
this.startTime = new Date()
|
||||||
this.eventBus = new EventBuilderImpl()
|
this.eventBus = new EventBuilderImpl<any>()
|
||||||
|
|
||||||
this.setupGlobalErrorHandling()
|
this.setupGlobalErrorHandling()
|
||||||
}
|
}
|
||||||
@@ -627,17 +642,17 @@ export class SystemServiceIntegration {
|
|||||||
|
|
||||||
case 'move':
|
case 'move':
|
||||||
// 实现窗体移动功能
|
// 实现窗体移动功能
|
||||||
const window = this.windowService.getWindow(windowId);
|
const window = this.windowService.getWindow(windowId)
|
||||||
if (window && window.element) {
|
if (window && window.element) {
|
||||||
// 更新窗体位置
|
// 更新窗体位置
|
||||||
window.config.x = data.x;
|
window.config.x = data.x
|
||||||
window.config.y = data.y;
|
window.config.y = data.y
|
||||||
window.element.style.left = `${data.x}px`;
|
window.element.style.left = `${data.x}px`
|
||||||
window.element.style.top = `${data.y}px`;
|
window.element.style.top = `${data.y}px`
|
||||||
window.element.style.transform = 'none'; // 确保移除transform
|
window.element.style.transform = 'none' // 确保移除transform
|
||||||
return true;
|
return true
|
||||||
}
|
}
|
||||||
return false;
|
return false
|
||||||
|
|
||||||
case 'minimize':
|
case 'minimize':
|
||||||
return this.windowService.minimizeWindow(windowId)
|
return this.windowService.minimizeWindow(windowId)
|
||||||
@@ -939,4 +954,4 @@ export class SystemServiceIntegration {
|
|||||||
console.log(`[SystemService] ${message}`, data)
|
console.log(`[SystemService] ${message}`, data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user