|
|
@ -1,31 +1,76 @@
|
|
|
|
|
|
|
|
// 导入 common/fileSystemConfig 模块中的 ConfigLocation 和 FileSystemConfig 类型
|
|
|
|
import type { ConfigLocation, FileSystemConfig } from 'common/fileSystemConfig';
|
|
|
|
import type { ConfigLocation, FileSystemConfig } from 'common/fileSystemConfig';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 定义一个视图状态接口,包含视图类型
|
|
|
|
|
|
|
|
* @interface IViewState
|
|
|
|
|
|
|
|
* @template V - 视图类型,必须是字符串
|
|
|
|
|
|
|
|
*/
|
|
|
|
interface IViewState<V extends string> {
|
|
|
|
interface IViewState<V extends string> {
|
|
|
|
|
|
|
|
// 视图的类型
|
|
|
|
view: V;
|
|
|
|
view: V;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 定义开始屏幕状态接口,继承自 IViewState
|
|
|
|
|
|
|
|
* @interface IStartScreenState
|
|
|
|
|
|
|
|
* @extends IViewState<'startscreen'>
|
|
|
|
|
|
|
|
*/
|
|
|
|
export interface IStartScreenState extends IViewState<'startscreen'> {
|
|
|
|
export interface IStartScreenState extends IViewState<'startscreen'> {
|
|
|
|
|
|
|
|
// 分组依据,默认为 'group'
|
|
|
|
groupBy: string;
|
|
|
|
groupBy: string;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 定义新配置状态接口,继承自 IViewState
|
|
|
|
|
|
|
|
* @interface INewConfigState
|
|
|
|
|
|
|
|
* @extends IViewState<'newconfig'>
|
|
|
|
|
|
|
|
*/
|
|
|
|
export interface INewConfigState extends IViewState<'newconfig'> {
|
|
|
|
export interface INewConfigState extends IViewState<'newconfig'> {
|
|
|
|
|
|
|
|
// 配置的位置,可选
|
|
|
|
location?: ConfigLocation;
|
|
|
|
location?: ConfigLocation;
|
|
|
|
|
|
|
|
// 配置的名称
|
|
|
|
name: string;
|
|
|
|
name: string;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 定义配置编辑器状态接口,继承自 IViewState
|
|
|
|
|
|
|
|
* @interface IConfigEditorState
|
|
|
|
|
|
|
|
* @extends IViewState<'configeditor'>
|
|
|
|
|
|
|
|
*/
|
|
|
|
export interface IConfigEditorState extends IViewState<'configeditor'> {
|
|
|
|
export interface IConfigEditorState extends IViewState<'configeditor'> {
|
|
|
|
|
|
|
|
// 旧的配置
|
|
|
|
oldConfig: FileSystemConfig;
|
|
|
|
oldConfig: FileSystemConfig;
|
|
|
|
|
|
|
|
// 新的配置
|
|
|
|
newConfig: FileSystemConfig;
|
|
|
|
newConfig: FileSystemConfig;
|
|
|
|
|
|
|
|
// 状态消息,可选
|
|
|
|
statusMessage?: string;
|
|
|
|
statusMessage?: string;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 定义配置定位器状态接口,继承自 IViewState
|
|
|
|
|
|
|
|
* @interface IConfigLocatorState
|
|
|
|
|
|
|
|
* @extends IViewState<'configlocator'>
|
|
|
|
|
|
|
|
*/
|
|
|
|
export interface IConfigLocatorState extends IViewState<'configlocator'> {
|
|
|
|
export interface IConfigLocatorState extends IViewState<'configlocator'> {
|
|
|
|
|
|
|
|
// 配置列表
|
|
|
|
configs: FileSystemConfig[];
|
|
|
|
configs: FileSystemConfig[];
|
|
|
|
|
|
|
|
// 搜索的配置名称
|
|
|
|
name: string;
|
|
|
|
name: string;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 定义一个状态类型,包含所有可能的视图状态
|
|
|
|
|
|
|
|
* @type IState
|
|
|
|
|
|
|
|
* @description 状态类型,可能是开始屏幕、新配置、配置编辑器或配置定位器状态
|
|
|
|
|
|
|
|
*/
|
|
|
|
export type IState = IStartScreenState | INewConfigState | IConfigEditorState | IConfigLocatorState;
|
|
|
|
export type IState = IStartScreenState | INewConfigState | IConfigEditorState | IConfigLocatorState;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 默认状态,包含默认的分组依据和视图类型
|
|
|
|
|
|
|
|
* @const DEFAULT_STATE
|
|
|
|
|
|
|
|
* @type {IState}
|
|
|
|
|
|
|
|
*/
|
|
|
|
export const DEFAULT_STATE: IState = {
|
|
|
|
export const DEFAULT_STATE: IState = {
|
|
|
|
groupBy: 'group',
|
|
|
|
groupBy: 'group',
|
|
|
|
view: 'startscreen',
|
|
|
|
view: 'startscreen',
|
|
|
|