mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 04:46:05 +00:00
feat: add admin options for entities and app shell
Introduced `BkndAdminEntitiesOptions` and `BkndAdminAppShellOptions` for advanced customization of entity actions, headers, footers, and app shell user menu. Updated related components, hooks, and types for seamless integration with the new configuration options.
This commit is contained in:
@@ -12,16 +12,11 @@ import {
|
||||
import { useApi } from "ui/client";
|
||||
import { type TSchemaActions, getSchemaActions } from "./schema/actions";
|
||||
import { AppReduced } from "./utils/AppReduced";
|
||||
import type { AppTheme } from "ui/client/use-theme";
|
||||
import { Message } from "ui/components/display/Message";
|
||||
import { useNavigate } from "ui/lib/routes";
|
||||
import type { BkndAdminProps } from "ui/Admin";
|
||||
|
||||
export type BkndAdminOptions = {
|
||||
basepath?: string;
|
||||
logo_return_path?: string;
|
||||
theme?: AppTheme;
|
||||
};
|
||||
type BkndContext = {
|
||||
export type BkndContext = {
|
||||
version: number;
|
||||
readonly: boolean;
|
||||
schema: ModuleSchemas;
|
||||
@@ -31,7 +26,7 @@ type BkndContext = {
|
||||
requireSecrets: () => Promise<void>;
|
||||
actions: ReturnType<typeof getSchemaActions>;
|
||||
app: AppReduced;
|
||||
options: BkndAdminOptions;
|
||||
options: BkndAdminProps["config"];
|
||||
fallback: boolean;
|
||||
};
|
||||
|
||||
@@ -53,7 +48,7 @@ export function BkndProvider({
|
||||
includeSecrets?: boolean;
|
||||
children: any;
|
||||
fallback?: React.ReactNode;
|
||||
options?: BkndAdminOptions;
|
||||
options?: BkndAdminProps["config"];
|
||||
}) {
|
||||
const [withSecrets, setWithSecrets] = useState<boolean>(includeSecrets);
|
||||
const [schema, setSchema] =
|
||||
@@ -180,7 +175,7 @@ export function useBknd({ withSecrets }: { withSecrets?: boolean } = {}): BkndCo
|
||||
return ctx;
|
||||
}
|
||||
|
||||
export function useBkndOptions(): BkndAdminOptions {
|
||||
export function useBkndOptions(): BkndAdminProps["config"] {
|
||||
const ctx = useContext(BkndContext);
|
||||
return (
|
||||
ctx.options ?? {
|
||||
|
||||
@@ -1 +1 @@
|
||||
export { BkndProvider, type BkndAdminOptions, useBknd, SchemaEditable } from "./BkndProvider";
|
||||
export { BkndProvider, type BkndContext, useBknd, SchemaEditable } from "./BkndProvider";
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { EntityRelation } from "data/relations";
|
||||
import { constructEntity, constructRelation } from "data/schema/constructor";
|
||||
import { RelationAccessor } from "data/relations/RelationAccessor";
|
||||
import { Flow, TaskMap } from "flows";
|
||||
import type { BkndAdminOptions } from "ui/client/BkndProvider";
|
||||
import type { BkndAdminProps } from "ui/Admin";
|
||||
|
||||
export type AppType = ReturnType<App["toJSON"]>;
|
||||
|
||||
@@ -20,7 +20,7 @@ export class AppReduced {
|
||||
|
||||
constructor(
|
||||
protected appJson: AppType,
|
||||
protected _options: BkndAdminOptions = {},
|
||||
protected _options: BkndAdminProps["config"] = {},
|
||||
) {
|
||||
//console.log("received appjson", appJson);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user