Migrate old admin modules and local crud deps

Port pages for data forms, score admin, student maintenance,
vacation records, menu routing, and workbench. Add team switching,
dynamic menu loading, viewport scaling, and bundled local fast-crud
packages.
This commit is contained in:
2026-11-02 12:21:25 +08:00
parent 47dd605067
commit 792131228a
232 changed files with 60676 additions and 604 deletions
+9
View File
@@ -0,0 +1,9 @@
export type LoggerConfig = {
off?: {
tableColumns?: boolean;
};
};
export type GlobalConfig = {
logger?: LoggerConfig;
};
export declare const GlobalConfig: GlobalConfig;
+9
View File
@@ -0,0 +1,9 @@
import { DynamicallyCrudOptions, UseCrudProps } from "../d";
declare const defaultCrudOptions: {
commonOptions(ctx?: UseCrudProps<any, any>): any;
defaultOptions(opts: {
t: any;
crudOptionsRef: any;
}): DynamicallyCrudOptions<any>;
};
export default defaultCrudOptions;
+13
View File
@@ -0,0 +1,13 @@
export * from "./use-crud";
export * from "./use-compute";
export * from "./use-dict";
export * from "./use-dict-define";
export * from "./use-types";
export * from "./use-ui";
export * from "./use-expose";
export * from "./use-merge";
export * from "./use-columns";
export * from "./use-drag";
export * from "./use-form";
export * from "./config";
export * from "./use-plugins";
+22
View File
@@ -0,0 +1,22 @@
import { ColumnCompositionProps, ColumnProps, CompositionColumns, CrudOptions, DynamicallyCrudOptions, FormProps, TableColumnsProps, UseFsContext } from "../d";
export type MergeColumnPlugin = {
name: string;
handle: (columnProps: any, crudOptions: any, index: number) => {};
order: number;
};
export declare function registerMergeColumnPlugin(plugin: MergeColumnPlugin): void;
export declare function buildTableColumnsFlatMap(map: TableColumnsProps, columns: TableColumnsProps): TableColumnsProps;
declare function doColumnsSort(columns: TableColumnsProps): TableColumnsProps;
declare function buildFormOptions(crudOptions: DynamicallyCrudOptions, context?: UseFsContext, mode?: string): FormProps;
declare function buildColumns(userOptions: CrudOptions): CrudOptions;
export declare function forEachTableColumns(columns: TableColumnsProps, callback: (col: ColumnProps, key: string) => void): void;
export declare function forEachColumns(columns: CompositionColumns, callback: (col: ColumnCompositionProps, key: string) => void): void;
export declare function useColumns(): {
buildFormOptions: typeof buildFormOptions;
buildColumns: typeof buildColumns;
registerMergeColumnPlugin: typeof registerMergeColumnPlugin;
forEachColumns: typeof forEachColumns;
doColumnsSort: typeof doColumnsSort;
forEachTableColumns: typeof forEachTableColumns;
};
export {};
+25
View File
@@ -0,0 +1,25 @@
import { Ref } from "vue";
import { AsyncComputeRef, ComputeFn, ComputeRef, ScopeContext } from "../d";
declare function doComputed(getTargetFunc: any, getContextFn: () => any, excludes?: any[], userComputedFn?: (target: any) => any): import("vue").ComputedRef<any>;
export declare class ComputeValue<T = any, R = any> implements ComputeRef<T, R> {
computeFn: ComputeFn<T, R>;
constructor(computeFn: ComputeFn<T, R>);
}
export declare function compute<T = any, R = any>(computeFn: ComputeFn<T, R>): ComputeRef<T, R>;
export type GetContextFn = () => any;
export declare class AsyncComputeValue<RV, R = any, WV = any> implements AsyncComputeRef<RV, R> {
watch?: (context: ScopeContext<R>) => WV;
asyncFn: (value: WV, getContextFn: GetContextFn) => Promise<RV>;
defaultValue?: any;
constructor(options: AsyncComputeRef<RV, R>);
buildAsyncRef(getContextFn: GetContextFn): Ref<RV, RV>;
}
export declare function asyncCompute<RV = any, R = any, WV = any>(options: AsyncComputeRef<RV, R, WV>): AsyncComputeRef<RV, R, WV>;
export declare function useCompute(): {
ComputeValue: typeof ComputeValue;
compute: typeof compute;
AsyncComputeValue: typeof AsyncComputeValue;
asyncCompute: typeof asyncCompute;
doComputed: typeof doComputed;
};
export {};
+14
View File
@@ -0,0 +1,14 @@
import { CrudBinding, CrudExpose, UseCrudProps, UseCrudRet, UseFsProps, UseFsRet } from "../d";
import { Ref } from "vue";
export declare function useCrud<T = any, R = any>(ctx: UseCrudProps<T, R>): UseCrudRet<R>;
export declare function useFs<R = any, C = any>(props: UseFsProps<R, C>): UseFsRet<R, C>;
export declare function useFsAsync<R = any, C = any>(props: UseFsProps<R, C>): Promise<UseFsRet<R, C>>;
export type UseFsRefOptions = {
deep?: boolean;
};
export declare function useFsRef(): {
crudRef: Ref<any, any>;
crudBinding: Ref<CrudBinding, CrudBinding>;
context: any;
crudExpose: CrudExpose<any>;
};
+167
View File
@@ -0,0 +1,167 @@
import { UnwrapNestedRefs } from "vue";
declare const UnMergeable: {
new (): {
cloneable: boolean;
setCloneable(cloneable: any): void;
};
};
export type DictRequest = (req: {
url: string;
dict: Dict;
}) => Promise<any[]>;
declare function setDictRequest(request: DictRequest): void;
export type DictGetUrl = (context?: any) => string;
export type DictGetData<T> = (context?: any) => Promise<T[]>;
/**
* Dict参数
*/
export interface DictOptions<T = any> {
/**
* dict请求url
*/
url?: string | DictGetUrl;
/**
* 自定义获取data远程方法
*/
getData?: DictGetData<T>;
/**
* 字典项value字段名称
*/
value?: string;
/**
* 字典项label字段名称
*/
label?: string;
labelBuilder?: (item: any) => string;
/**
* 字典项children字段名称
*/
children?: string;
/**
* 字典项color字段名称
*/
color?: string;
/**
* 是否是树形
*/
isTree?: boolean;
/**
* 是否全局缓存, 建议将dict()实例放到全局文件中引用,相当于store,也可达到全局缓存的效果
*/
cache?: boolean;
/**
* 是否将本dict当做原型,所有组件引用后将clone一个实例
*/
prototype?: boolean;
/**
* 是否分发时复制
*/
cloneable?: boolean;
/**
* dict创建后是否立即请求
*/
immediate?: boolean;
/**
* 根据values 远程获取字典
* @param values
*/
getNodesByValues?: (values: any[], options?: LoadDictOpts) => Promise<T[]>;
/**
* dict数据远程加载完后触发
*/
onReady?: (context: any) => void;
/**
* 自定义参数
*/
custom?: any;
/**
* 本地字典数据,无需远程请求
*/
data?: T[];
}
export type LoadDictOpts = {
reload?: boolean;
value?: any;
[key: string]: any;
};
export type DictOnReadyContext = {
dict: Dict;
[key: string]: any;
};
/**
*
* @param url
* @param context = {dict, scope}
* @returns {Promise<*>}
*/
export declare class Dict<T = any> extends UnMergeable implements DictOptions<T> {
cache: boolean;
prototype: boolean;
immediate: boolean;
url?: string | DictGetUrl;
getData?: DictGetData<T>;
value: string;
label: string;
labelBuilder?: (item: any) => string;
children: string;
color: string;
isTree: boolean;
_data: null | T[];
get data(): T[];
set data(data: T[]);
originalData?: T[];
dataMap: any;
loading: boolean;
custom: {};
getNodesByValues?: (values: any, options?: LoadDictOpts) => Promise<T[]>;
onReady?: (context: DictOnReadyContext) => void;
notifies: Array<any>;
constructor(dict: DictOptions<T>);
isDynamic(): boolean;
setData(data: any[]): void;
/**
* 加载字典
*/
_loadDict(context: LoadDictOpts): Promise<any[]>;
_triggerNotify(): void;
_registerNotify(): Promise<any[]>;
/**
* 加载字典
* @param context 当prototype=true时会传入
*/
loadDict(context?: LoadDictOpts): Promise<any[]>;
reloadDict(context?: LoadDictOpts): Promise<any[]>;
_unfetchValues: Record<any, {
loading: boolean;
value: any;
}>;
/**
* 根据value获取nodes 追加数据
* @param values
*/
appendByValues(values: any[]): Promise<any[]>;
clear(): void;
getRemoteDictData(context?: any): Promise<any>;
toMap(): void;
buildMap(map: any, list: any): void;
getValue(item: any): any;
getLabel(item: any): any;
getChildren(item: any): any;
getColor(item: any): any;
getDictData(): T[];
getDictMap(): any;
getNodeByValue(value: any): any;
getNodesFromDataMap(value: any): any[];
}
/**
* 创建Dict对象
* 注意:这里只能定义返回<any>,否则build结果会缺失index.d.ts
* @param config
*/
export declare function dict<T = any>(config: DictOptions<T>): UnwrapNestedRefs<Dict<any>>;
export declare function useDictDefine(): {
dict: typeof dict;
setDictRequest: typeof setDictRequest;
Dict: typeof Dict;
};
export {};
+16
View File
@@ -0,0 +1,16 @@
import { Dict } from "../use/use-dict-define";
export declare function useDict(props: any, ctx: any, vModel?: string): {
createComputedOptions: () => import("vue").ComputedRef<any>;
loadDict: (reload?: boolean) => Promise<void>;
reloadDict: () => Promise<void>;
clearDict: () => void;
getDictData: () => any;
getDict: () => any;
watchValue: () => void;
getValue: (item: any) => any;
getLabel: (item: any) => any;
getChildren: (item: any) => any;
getColor: (item: any) => any;
removePropValue: (item: any, prop: any) => void;
curDict: Dict<any>;
};
+8
View File
@@ -0,0 +1,8 @@
export type DragModalOptions = {
getModal: () => HTMLElement;
};
declare function dragModal(opts: DragModalOptions): Promise<void>;
export declare function useDrag(): {
dragModal: typeof dragModal;
};
export {};
+22
View File
@@ -0,0 +1,22 @@
import { Ref } from "vue";
import { CrudExpose } from "../d/expose";
import { CrudBinding } from "../d";
export type UseExposeProps<R = any> = {
crudRef: Ref;
crudBinding: Ref<CrudBinding<R>>;
};
export type UseExposeRet<R = any> = {
expose: CrudExpose<R>;
crudExpose: CrudExpose<R>;
};
export type UseEditableProps<R = any> = {
crudExpose: CrudExpose<R>;
};
export type EditableOnEnabledProps = {
editable: any;
};
/**
*
* @param props
*/
export declare function useExpose<R = any>(props: UseExposeProps<R>): UseExposeRet<R>;
+16
View File
@@ -0,0 +1,16 @@
import { DynamicallyCrudOptions, OpenDialogProps } from "../d";
import { ComponentInternalInstance, VNode } from "vue";
export type FormWrapperInstance = {
id: string;
vNode: VNode;
vm: ComponentInternalInstance;
props: any;
};
export type OpenFormDialogProps<R = any> = {
crudOptions: DynamicallyCrudOptions<R>;
context?: any;
};
export declare function useFormWrapper(pd?: any): {
openDialog: (opts: OpenDialogProps) => Promise<any>;
openCrudFormDialog: <R = any>(opts: OpenFormDialogProps<R>) => Promise<any>;
};
+12
View File
@@ -0,0 +1,12 @@
declare function merge(target: any, ...sources: any): any;
declare function cloneDeep(target: any): any;
declare class UnMergeable {
cloneable: boolean;
setCloneable(cloneable: any): void;
}
export declare function useMerge(): {
merge: typeof merge;
cloneDeep: typeof cloneDeep;
UnMergeable: typeof UnMergeable;
};
export {};
+4
View File
@@ -0,0 +1,4 @@
import { CrudOptionsPluginHandle, CrudOptionsPluginOpts, CrudOptionsPluginReg } from "../d";
export declare const crudOptionsPlugins: Record<string, CrudOptionsPluginReg>;
export declare function registerCrudOptionsPlugin(name: string, plugin: CrudOptionsPluginHandle, opts?: CrudOptionsPluginOpts): void;
export declare function getCrudOptionsPlugin(name: string): CrudOptionsPluginReg;
+6
View File
@@ -0,0 +1,6 @@
export declare function useTypes(): {
addTypes: (newTypes: any) => void;
getType: (key: string) => any;
getTypes: () => any;
install: () => void;
};
+2
View File
@@ -0,0 +1,2 @@
import { uiContext, useUi } from "../ui";
export { uiContext, useUi };
+3
View File
@@ -0,0 +1,3 @@
export declare function useVModel(props: any, ctx: any, vModel: string): {
[x: string]: any;
};