2024-12-04 02:35:06 +08:00
|
|
|
import { HttpClient } from "core/http";
|
|
|
|
import { CapabilityService } from "core/capability";
|
|
|
|
import { Serializable } from "interface/serializableType";
|
2024-12-03 01:37:02 +08:00
|
|
|
|
|
|
|
export class Layout {
|
|
|
|
private http: HttpClient;
|
|
|
|
private capability: CapabilityService;
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
public element: (props: {
|
|
|
|
children: React.ReactNode;
|
|
|
|
args?: Serializable;
|
|
|
|
}) => React.ReactNode,
|
|
|
|
services?: {
|
|
|
|
http?: HttpClient;
|
|
|
|
capability?: CapabilityService;
|
2024-12-04 02:35:06 +08:00
|
|
|
},
|
2024-12-03 01:37:02 +08:00
|
|
|
) {
|
|
|
|
this.http = services?.http || HttpClient.getInstance();
|
|
|
|
this.capability = services?.capability || CapabilityService.getInstance();
|
|
|
|
}
|
|
|
|
|
2024-12-04 02:35:06 +08:00
|
|
|
render(props: { children: React.ReactNode; args?: Serializable }) {
|
2024-12-03 01:37:02 +08:00
|
|
|
return this.element(props);
|
|
|
|
}
|
2024-12-04 02:35:06 +08:00
|
|
|
}
|