refactor🎨: (阅读代码):state..ts增加注释

master
yetao 2 weeks ago
parent dda533c036
commit f4a0fe5568

@ -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',

Loading…
Cancel
Save