mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-09-13 02:54:26 +08:00
feat(web): 新增控制台布局切换并完善状态与磁盘交互
新增经典、悬浮和侧栏布局,保存用户偏好,并调整工具栏、状态摘要及窄屏交互。 统一控制台弹层外观、焦点行为和中英文文案。 根据虚拟磁盘文件访问能力显示浏览入口、容量信息和不可用状态。 验证:npm run build 通过(vue-tsc 类型检查和 Vite 生产构建)。
This commit is contained in:
22
web/src/composables/useConsoleAppearance.ts
Normal file
22
web/src/composables/useConsoleAppearance.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { inject, provide, type InjectionKey, type Ref } from 'vue'
|
||||
import type { ConsoleLayout } from '@/composables/useConsoleLayout'
|
||||
|
||||
// Injection follows component ownership through portals, without styling settings/login.
|
||||
const consoleAppearanceKey: InjectionKey<Readonly<Ref<ConsoleLayout>>> = Symbol('consoleAppearance')
|
||||
|
||||
export function provideConsoleAppearance(layout: Readonly<Ref<ConsoleLayout>>) {
|
||||
provide(consoleAppearanceKey, layout)
|
||||
}
|
||||
|
||||
export function useConsoleAppearance() {
|
||||
return inject(consoleAppearanceKey, undefined)
|
||||
}
|
||||
|
||||
// Focus the panel itself so the first help tooltip does not obscure its controls on open.
|
||||
// Keyboard users can then Tab into the panel's controls in their normal order.
|
||||
export function focusConsolePanel(event: Event) {
|
||||
if (event.target instanceof HTMLElement) {
|
||||
event.preventDefault()
|
||||
event.target.focus({ preventScroll: true })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user