echoes/frontend/core/theme.ts
lsy ba17778a8f 数据库:合并自定义字段和设计字段,所有限制移到应用层限制
后端:删除数据库构建需要等级,jwt添加rote信息
前端:修复post,删除插件机制,优化http
2024-12-18 21:54:37 +08:00

54 lines
1.3 KiB
TypeScript

import React from "react";
import { Configuration } from "interface/serializableType";
import {ThemeConfig} from "interface/theme";
import {HttpClient} from "core/http"
// 创建布局渲染器的工厂函数
const createLayoutRenderer = (layoutComponent: any, args: Configuration) => {
return (children: React.ReactNode) => {
return layoutComponent.render({
children,
args,
});
};
};
// 创建组件的工厂函数
const createComponentRenderer = (path: string) => {
return React.lazy(async () => {
const module = await import(/* @vite-ignore */ path);
return {
default: (props: any) => {
if (typeof module.default.render === "function") {
return module.default.render(props);
}
},
};
});
};
export class TemplateManager {
private static instance: TemplateManager;
private routes = new Map<string, string>();
private layout: React.FC | undefined;
private error: React.FC | undefined;
private loading: React.FC | undefined;
private field : ThemeConfig;
private constructor() {
const http=HttpClient.getInstance();
http.systemToken()
}
public static getInstance(): TemplateManager {
if (!TemplateManager.instance) {
TemplateManager.instance = new TemplateManager();
}
return TemplateManager.instance;
}
// 读取主题和模板中的模板
}