mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 12:56:05 +00:00
made the creation of an entity more accessible and obvious
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
} from "data/data-schema";
|
||||
import { useBknd } from "ui/client/bknd";
|
||||
import type { TSchemaActions } from "ui/client/schema/actions";
|
||||
import { bkndModals } from "ui/modals";
|
||||
|
||||
export function useBkndData() {
|
||||
const { config, app, schema, actions: bkndActions } = useBknd();
|
||||
@@ -62,7 +63,8 @@ export function useBkndData() {
|
||||
}
|
||||
};
|
||||
const $data = {
|
||||
entity: (name: string) => entities[name]
|
||||
entity: (name: string) => entities[name],
|
||||
modals
|
||||
};
|
||||
|
||||
return {
|
||||
@@ -75,6 +77,15 @@ export function useBkndData() {
|
||||
};
|
||||
}
|
||||
|
||||
const modals = {
|
||||
createAny: () => bkndModals.open(bkndModals.ids.dataCreate, {}),
|
||||
createEntity: () =>
|
||||
bkndModals.open(bkndModals.ids.dataCreate, {
|
||||
initialPath: ["entities", "entity"],
|
||||
initialState: { action: "entity" }
|
||||
})
|
||||
};
|
||||
|
||||
function entityFieldActions(bkndActions: TSchemaActions, entityName: string) {
|
||||
return {
|
||||
add: async (name: string, field: TAppDataField) => {
|
||||
|
||||
Reference in New Issue
Block a user