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

36 lines
894 B
TypeScript

import { HttpClient } from "core/http";
import { Serializable } from "interface/serializableType";
import React, { createElement, memo } from "react";
export class Layout {
private readonly http: HttpClient;
private readonly MemoizedElement: React.MemoExoticComponent<
(props: {
children: React.ReactNode;
args?: Serializable;
http: HttpClient;
}) => React.ReactNode
>;
constructor(
public element: (props: {
children: React.ReactNode;
args?: Serializable;
http: HttpClient;
}) => React.ReactNode,
services?: {
http?: HttpClient;
},
) {
this.http = services?.http || HttpClient.getInstance();
this.MemoizedElement = memo(element);
}
render(props: { children: React.ReactNode; args?: Serializable }) {
return createElement(this.MemoizedElement, {
...props,
http: this.http,
});
}
}