mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 12:56:05 +00:00
added format command and added trailing commas to reduce conflicts
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
||||
IconExternalLink,
|
||||
IconPhoto,
|
||||
IconPlus,
|
||||
IconSettings
|
||||
IconSettings,
|
||||
} from "@tabler/icons-react";
|
||||
import type { Entity, TEntityType } from "data";
|
||||
import { TbDatabasePlus } from "react-icons/tb";
|
||||
@@ -26,7 +26,7 @@ export function DataRoot({ children }) {
|
||||
const entityList: Record<TEntityType, Entity[]> = {
|
||||
regular: [],
|
||||
generated: [],
|
||||
system: []
|
||||
system: [],
|
||||
} as const;
|
||||
const [navigate] = useNavigate();
|
||||
const context = window.location.href.match(/\/schema/) ? "schema" : "data";
|
||||
@@ -65,7 +65,7 @@ export function DataRoot({ children }) {
|
||||
<SegmentedControl
|
||||
data={[
|
||||
{ value: "data", label: "Data" },
|
||||
{ value: "schema", label: "Schema" }
|
||||
{ value: "schema", label: "Schema" },
|
||||
]}
|
||||
value={context}
|
||||
onChange={handleSegmentChange}
|
||||
@@ -103,7 +103,7 @@ const EntityLinkList = ({
|
||||
entities,
|
||||
title,
|
||||
context,
|
||||
suggestCreate = false
|
||||
suggestCreate = false,
|
||||
}: { entities: Entity[]; title?: string; context: "data" | "schema"; suggestCreate?: boolean }) => {
|
||||
const { $data } = useBkndData();
|
||||
if (entities.length === 0) {
|
||||
@@ -113,7 +113,7 @@ const EntityLinkList = ({
|
||||
description="Create your first entity to get started."
|
||||
secondary={{
|
||||
children: "Create entity",
|
||||
onClick: () => $data.modals.createEntity()
|
||||
onClick: () => $data.modals.createEntity(),
|
||||
}}
|
||||
/>
|
||||
) : null;
|
||||
@@ -123,7 +123,7 @@ const EntityLinkList = ({
|
||||
<nav
|
||||
className={twMerge(
|
||||
"flex flex-col flex-1 gap-1 px-3",
|
||||
title && "border-t border-primary/10 pt-2"
|
||||
title && "border-t border-primary/10 pt-2",
|
||||
)}
|
||||
>
|
||||
{title && <div className="text-sm text-primary/50 ml-3.5 mb-1">{title}</div>}
|
||||
@@ -148,7 +148,7 @@ const EntityLinkList = ({
|
||||
const EntityContextMenu = ({
|
||||
entity,
|
||||
children,
|
||||
enabled = true
|
||||
enabled = true,
|
||||
}: { entity: Entity; children: DropdownClickableChild; enabled?: boolean }) => {
|
||||
if (!enabled) return children;
|
||||
const [navigate] = useNavigate();
|
||||
@@ -162,41 +162,41 @@ const EntityContextMenu = ({
|
||||
<Dropdown
|
||||
className="flex flex-col w-full"
|
||||
dropdownWrapperProps={{
|
||||
className: "min-w-fit"
|
||||
className: "min-w-fit",
|
||||
}}
|
||||
title={entity.label + " Actions"}
|
||||
items={[
|
||||
href && {
|
||||
icon: IconExternalLink,
|
||||
label: "Open in tab",
|
||||
onClick: () => navigate(href, { target: "_blank" })
|
||||
onClick: () => navigate(href, { target: "_blank" }),
|
||||
},
|
||||
separator,
|
||||
!$data.system(entity.name).any && {
|
||||
icon: IconPlus,
|
||||
label: "Create new",
|
||||
onClick: () => navigate(routes.data.entity.create(entity.name))
|
||||
onClick: () => navigate(routes.data.entity.create(entity.name)),
|
||||
},
|
||||
{
|
||||
icon: IconDatabase,
|
||||
label: "List entries",
|
||||
onClick: () => navigate(routes.data.entity.list(entity.name))
|
||||
onClick: () => navigate(routes.data.entity.list(entity.name)),
|
||||
},
|
||||
separator,
|
||||
{
|
||||
icon: IconAlignJustified,
|
||||
label: "Manage fields",
|
||||
onClick: () => navigate(routes.data.schema.entity(entity.name))
|
||||
onClick: () => navigate(routes.data.schema.entity(entity.name)),
|
||||
},
|
||||
{
|
||||
icon: IconCirclesRelation,
|
||||
label: "Add relation",
|
||||
onClick: () => $data.modals.createRelation(entity.name)
|
||||
onClick: () => $data.modals.createRelation(entity.name),
|
||||
},
|
||||
!$data.system(entity.name).media && {
|
||||
icon: IconPhoto,
|
||||
label: "Add media",
|
||||
onClick: () => $data.modals.createMedia(entity.name)
|
||||
onClick: () => $data.modals.createMedia(entity.name),
|
||||
},
|
||||
separator,
|
||||
{
|
||||
@@ -204,9 +204,9 @@ const EntityContextMenu = ({
|
||||
label: "Advanced",
|
||||
onClick: () =>
|
||||
navigate(routes.settings.path(["data", "entities", entity.name]), {
|
||||
absolute: true
|
||||
})
|
||||
}
|
||||
absolute: true,
|
||||
}),
|
||||
},
|
||||
]}
|
||||
openEvent="onContextMenu"
|
||||
position="bottom-start"
|
||||
@@ -232,11 +232,11 @@ export function DataEmpty() {
|
||||
description="Please select an entity from the left sidebar or create a new one to continue."
|
||||
secondary={{
|
||||
children: "Go to schema",
|
||||
onClick: handleButtonClick
|
||||
onClick: handleButtonClick,
|
||||
}}
|
||||
primary={{
|
||||
children: "Create entity",
|
||||
onClick: $data.modals.createEntity
|
||||
onClick: $data.modals.createEntity,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -38,13 +38,13 @@ export function DataEntityUpdate({ params }) {
|
||||
entity.name,
|
||||
entityId,
|
||||
{
|
||||
with: local_relation_refs
|
||||
with: local_relation_refs,
|
||||
},
|
||||
{
|
||||
keepPreviousData: false,
|
||||
revalidateOnFocus: false,
|
||||
shouldRetryOnError: false
|
||||
}
|
||||
shouldRetryOnError: false,
|
||||
},
|
||||
);
|
||||
|
||||
function goBack() {
|
||||
@@ -85,7 +85,7 @@ export function DataEntityUpdate({ params }) {
|
||||
action: "update",
|
||||
entity,
|
||||
initialData: $q.data?.toJSON(),
|
||||
onSubmitted
|
||||
onSubmitted,
|
||||
});
|
||||
|
||||
if (!data && !$q.isLoading) {
|
||||
@@ -117,24 +117,24 @@ export function DataEntityUpdate({ params }) {
|
||||
entity: entity.toJSON(),
|
||||
schema: entity.toSchema({ clean: true }),
|
||||
form: Form.state.values,
|
||||
state: Form.state
|
||||
}
|
||||
state: Form.state,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Settings",
|
||||
onClick: () =>
|
||||
navigate(routes.settings.path(["data", "entities", entity.name]), {
|
||||
absolute: true
|
||||
})
|
||||
absolute: true,
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: "Delete",
|
||||
onClick: handleDelete,
|
||||
destructive: true,
|
||||
disabled: fieldsDisabled
|
||||
}
|
||||
disabled: fieldsDisabled,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<IconButton Icon={TbDots} />
|
||||
@@ -160,7 +160,7 @@ export function DataEntityUpdate({ params }) {
|
||||
<Breadcrumbs2
|
||||
path={[
|
||||
{ label: entity.label, href: routes.data.entity.list(entity.name) },
|
||||
{ label: `Edit #${entityId}` }
|
||||
{ label: `Edit #${entityId}` },
|
||||
]}
|
||||
/>
|
||||
</AppShell.SectionHeader>
|
||||
@@ -191,7 +191,7 @@ export function DataEntityUpdate({ params }) {
|
||||
function EntityDetailRelations({
|
||||
id,
|
||||
entity,
|
||||
relations
|
||||
relations,
|
||||
}: {
|
||||
id: number;
|
||||
entity: Entity;
|
||||
@@ -199,7 +199,7 @@ function EntityDetailRelations({
|
||||
}) {
|
||||
const [selected, setSelected] = useState<EntityRelation>(
|
||||
// @ts-ignore
|
||||
relations.length > 0 ? relations[0] : undefined
|
||||
relations.length > 0 ? relations[0] : undefined,
|
||||
);
|
||||
|
||||
function handleClick(relation: EntityRelation) {
|
||||
@@ -225,7 +225,7 @@ function EntityDetailRelations({
|
||||
label: ucFirst(other.reference),
|
||||
onClick: () => handleClick(relation),
|
||||
active: selected?.other(entity).reference === other.reference,
|
||||
badge: relation.type()
|
||||
badge: relation.type(),
|
||||
};
|
||||
})}
|
||||
/>
|
||||
@@ -239,7 +239,7 @@ function EntityDetailRelations({
|
||||
function EntityDetailInner({
|
||||
id,
|
||||
entity,
|
||||
relation
|
||||
relation,
|
||||
}: {
|
||||
id: number;
|
||||
entity: Entity;
|
||||
@@ -251,11 +251,11 @@ function EntityDetailInner({
|
||||
const search = {
|
||||
select: other.entity.getSelect(undefined, "table"),
|
||||
limit: 10,
|
||||
offset: 0
|
||||
offset: 0,
|
||||
};
|
||||
// @todo: add custom key for invalidation
|
||||
const $q = useApiQuery((api) =>
|
||||
api.data.readManyByReference(entity.name, id, other.reference, search)
|
||||
api.data.readManyByReference(entity.name, id, other.reference, search),
|
||||
);
|
||||
|
||||
function handleClickRow(row: Record<string, any>) {
|
||||
@@ -268,7 +268,7 @@ function EntityDetailInner({
|
||||
const ref = relation.getReferenceQuery(other.entity, id, other.reference);
|
||||
handleClickNew = () => {
|
||||
navigate(routes.data.entity.create(other.entity.name), {
|
||||
query: ref.where
|
||||
query: ref.where,
|
||||
});
|
||||
//navigate(routes.data.entity.create(other.entity.name) + `?${query}`);
|
||||
};
|
||||
|
||||
@@ -52,7 +52,7 @@ export function DataEntityCreate({ params }) {
|
||||
action: "create",
|
||||
entity: entity,
|
||||
initialData: search.value,
|
||||
onSubmitted
|
||||
onSubmitted,
|
||||
});
|
||||
|
||||
const fieldsDisabled = $q.isLoading || $q.isValidating || Form.state.isSubmitting;
|
||||
@@ -83,7 +83,7 @@ export function DataEntityCreate({ params }) {
|
||||
<Breadcrumbs2
|
||||
path={[
|
||||
{ label: entity.label, href: routes.data.entity.list(entity.name) },
|
||||
{ label: "Create" }
|
||||
{ label: "Create" },
|
||||
]}
|
||||
/>
|
||||
</AppShell.SectionHeader>
|
||||
|
||||
@@ -22,10 +22,10 @@ const searchSchema = Type.Composite(
|
||||
Type.Pick(querySchema, ["select", "where", "sort"]),
|
||||
Type.Object({
|
||||
page: Type.Optional(Type.Number({ default: 1 })),
|
||||
perPage: Type.Optional(Type.Number({ default: 10 }))
|
||||
})
|
||||
perPage: Type.Optional(Type.Number({ default: 10 })),
|
||||
}),
|
||||
],
|
||||
{ additionalProperties: false }
|
||||
{ additionalProperties: false },
|
||||
);
|
||||
|
||||
const PER_PAGE_OPTIONS = [5, 10, 25];
|
||||
@@ -41,7 +41,7 @@ export function DataEntityList({ params }) {
|
||||
const [navigate] = useNavigate();
|
||||
const search = useSearch(searchSchema, {
|
||||
select: entity.getSelect(undefined, "table"),
|
||||
sort: entity.getDefaultSort()
|
||||
sort: entity.getDefaultSort(),
|
||||
});
|
||||
|
||||
const $q = useApiQuery(
|
||||
@@ -50,13 +50,13 @@ export function DataEntityList({ params }) {
|
||||
select: search.value.select,
|
||||
limit: search.value.perPage,
|
||||
offset: (search.value.page - 1) * search.value.perPage,
|
||||
sort: `${search.value.sort.dir === "asc" ? "" : "-"}${search.value.sort.by}`
|
||||
sort: `${search.value.sort.dir === "asc" ? "" : "-"}${search.value.sort.by}`,
|
||||
}),
|
||||
{
|
||||
enabled: !!entity,
|
||||
revalidateOnFocus: true,
|
||||
keepPreviousData: true
|
||||
}
|
||||
keepPreviousData: true,
|
||||
},
|
||||
);
|
||||
const data = $q.data?.data;
|
||||
const meta = $q.data?.body.meta;
|
||||
@@ -94,19 +94,19 @@ export function DataEntityList({ params }) {
|
||||
items={[
|
||||
{
|
||||
label: "Settings",
|
||||
onClick: () => navigate(routes.data.schema.entity(entity.name))
|
||||
onClick: () => navigate(routes.data.schema.entity(entity.name)),
|
||||
},
|
||||
{
|
||||
label: "Data Schema",
|
||||
onClick: () => navigate(routes.data.schema.root())
|
||||
onClick: () => navigate(routes.data.schema.root()),
|
||||
},
|
||||
{
|
||||
label: "Advanced Settings",
|
||||
onClick: () =>
|
||||
navigate(routes.settings.path(["data", "entities", entity.name]), {
|
||||
absolute: true
|
||||
})
|
||||
}
|
||||
absolute: true,
|
||||
}),
|
||||
},
|
||||
]}
|
||||
position="bottom-end"
|
||||
>
|
||||
@@ -158,7 +158,7 @@ function EntityCreateButton({ entity }: { entity: Entity }) {
|
||||
if (entity.type === "system") {
|
||||
const system = {
|
||||
users: b.app.config.auth.entity_name,
|
||||
media: b.app.config.media.entity_name
|
||||
media: b.app.config.media.entity_name,
|
||||
};
|
||||
if (system.users === entity.name) {
|
||||
return (
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
IconAlignJustified,
|
||||
IconBolt,
|
||||
IconCirclesRelation,
|
||||
IconSettings
|
||||
IconSettings,
|
||||
} from "@tabler/icons-react";
|
||||
import { isDebug } from "core";
|
||||
import type { Entity } from "data";
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
TbDots,
|
||||
TbPhoto,
|
||||
TbPlus,
|
||||
TbSitemap
|
||||
TbSitemap,
|
||||
} from "react-icons/tb";
|
||||
import { useBkndData } from "ui/client/schema/data/use-bknd-data";
|
||||
import { Button } from "ui/components/buttons/Button";
|
||||
@@ -56,16 +56,16 @@ export function DataSchemaEntity({ params }) {
|
||||
label: "Data",
|
||||
onClick: () =>
|
||||
navigate(routes.data.root() + routes.data.entity.list(entity.name), {
|
||||
absolute: true
|
||||
})
|
||||
absolute: true,
|
||||
}),
|
||||
},
|
||||
{
|
||||
label: "Advanced Settings",
|
||||
onClick: () =>
|
||||
navigate(routes.settings.path(["data", "entities", entity.name]), {
|
||||
absolute: true
|
||||
})
|
||||
}
|
||||
absolute: true,
|
||||
}),
|
||||
},
|
||||
]}
|
||||
position="bottom-end"
|
||||
>
|
||||
@@ -76,19 +76,19 @@ export function DataSchemaEntity({ params }) {
|
||||
{
|
||||
icon: TbCirclesRelation,
|
||||
label: "Add relation",
|
||||
onClick: () => $data.modals.createRelation(entity.name)
|
||||
onClick: () => $data.modals.createRelation(entity.name),
|
||||
},
|
||||
{
|
||||
icon: TbPhoto,
|
||||
label: "Add media",
|
||||
onClick: () => $data.modals.createMedia(entity.name)
|
||||
onClick: () => $data.modals.createMedia(entity.name),
|
||||
},
|
||||
() => <div className="h-px my-1 w-full bg-primary/5" />,
|
||||
{
|
||||
icon: TbDatabasePlus,
|
||||
label: "Create Entity",
|
||||
onClick: () => $data.modals.createEntity()
|
||||
}
|
||||
onClick: () => $data.modals.createEntity(),
|
||||
},
|
||||
]}
|
||||
position="bottom-end"
|
||||
>
|
||||
@@ -124,7 +124,7 @@ export function DataSchemaEntity({ params }) {
|
||||
primary={{
|
||||
children: "Advanced Settings",
|
||||
onClick: () =>
|
||||
navigate(routes.settings.path(["data", "relations"]), { absolute: true })
|
||||
navigate(routes.settings.path(["data", "relations"]), { absolute: true }),
|
||||
}}
|
||||
/>
|
||||
</AppShell.SectionHeaderAccordionItem>
|
||||
@@ -141,8 +141,8 @@ export function DataSchemaEntity({ params }) {
|
||||
children: "Advanced Settings",
|
||||
onClick: () =>
|
||||
navigate(routes.settings.path(["data", "indices"]), {
|
||||
absolute: true
|
||||
})
|
||||
absolute: true,
|
||||
}),
|
||||
}}
|
||||
/>
|
||||
</AppShell.SectionHeaderAccordionItem>
|
||||
@@ -154,7 +154,7 @@ export function DataSchemaEntity({ params }) {
|
||||
const Fields = ({
|
||||
entity,
|
||||
open,
|
||||
toggle
|
||||
toggle,
|
||||
}: { entity: Entity; open: boolean; toggle: () => void }) => {
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
const [updates, setUpdates] = useState(0);
|
||||
@@ -209,7 +209,7 @@ const Fields = ({
|
||||
$data.modals.createMedia(entity.name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
}))}
|
||||
/>
|
||||
|
||||
@@ -241,7 +241,7 @@ const Fields = ({
|
||||
const BasicSettings = ({
|
||||
entity,
|
||||
open,
|
||||
toggle
|
||||
toggle,
|
||||
}: { entity: Entity; open: boolean; toggle: () => void }) => {
|
||||
const d = useBkndData();
|
||||
const config = d.entities?.[entity.name]?.config;
|
||||
@@ -249,7 +249,7 @@ const BasicSettings = ({
|
||||
|
||||
const schema = cloneDeep(
|
||||
// @ts-ignore
|
||||
d.schema.properties.entities.additionalProperties?.properties?.config
|
||||
d.schema.properties.entities.additionalProperties?.properties?.config,
|
||||
);
|
||||
|
||||
const [_schema, _config] = extractSchema(schema as any, config, ["fields"]);
|
||||
|
||||
@@ -5,8 +5,8 @@ import * as AppShell from "ui/layouts/AppShell/AppShell";
|
||||
|
||||
const DataSchemaCanvas = lazy(() =>
|
||||
import("ui/modules/data/components/canvas/DataSchemaCanvas").then((m) => ({
|
||||
default: m.DataSchemaCanvas
|
||||
}))
|
||||
default: m.DataSchemaCanvas,
|
||||
})),
|
||||
);
|
||||
|
||||
export function DataSchemaIndex() {
|
||||
|
||||
@@ -6,12 +6,12 @@ import {
|
||||
type Static,
|
||||
StringIdentifier,
|
||||
objectCleanEmpty,
|
||||
ucFirstAllSnakeToPascalWithSpaces
|
||||
ucFirstAllSnakeToPascalWithSpaces,
|
||||
} from "core/utils";
|
||||
import { Entity } from "data";
|
||||
import {
|
||||
type TAppDataEntityFields,
|
||||
fieldsSchemaObject as originalFieldsSchemaObject
|
||||
fieldsSchemaObject as originalFieldsSchemaObject,
|
||||
} from "data/data-schema";
|
||||
import { omit } from "lodash-es";
|
||||
import { forwardRef, memo, useEffect, useImperativeHandle } from "react";
|
||||
@@ -34,12 +34,12 @@ const fieldsSchema = Type.Union(Object.values(fieldsSchemaObject));
|
||||
const fieldSchema = Type.Object({
|
||||
name: StringIdentifier,
|
||||
new: Type.Optional(Type.Boolean({ const: true })),
|
||||
field: fieldsSchema
|
||||
field: fieldsSchema,
|
||||
});
|
||||
type TFieldSchema = Static<typeof fieldSchema>;
|
||||
|
||||
const schema = Type.Object({
|
||||
fields: Type.Array(fieldSchema)
|
||||
fields: Type.Array(fieldSchema),
|
||||
});
|
||||
type TFieldsFormSchema = Static<typeof schema>;
|
||||
|
||||
@@ -70,7 +70,7 @@ export const EntityFieldsForm = forwardRef<EntityFieldsFormRef, EntityFieldsForm
|
||||
function EntityFieldsForm({ fields: _fields, sortable, additionalFieldTypes, ...props }, ref) {
|
||||
const entityFields = Object.entries(_fields).map(([name, field]) => ({
|
||||
name,
|
||||
field
|
||||
field,
|
||||
}));
|
||||
|
||||
const {
|
||||
@@ -81,22 +81,22 @@ export const EntityFieldsForm = forwardRef<EntityFieldsFormRef, EntityFieldsForm
|
||||
register,
|
||||
setValue,
|
||||
setError,
|
||||
reset
|
||||
reset,
|
||||
} = useForm({
|
||||
mode: "all",
|
||||
resolver: typeboxResolver(schema),
|
||||
defaultValues: {
|
||||
fields: entityFields
|
||||
} as TFieldsFormSchema
|
||||
fields: entityFields,
|
||||
} as TFieldsFormSchema,
|
||||
});
|
||||
const { fields, append, remove, move } = useFieldArray({
|
||||
control,
|
||||
name: "fields"
|
||||
name: "fields",
|
||||
});
|
||||
|
||||
function toCleanValues(formData: TFieldsFormSchema): TAppDataEntityFields {
|
||||
return Object.fromEntries(
|
||||
formData.fields.map((field) => [field.name, objectCleanEmpty(field.field)])
|
||||
formData.fields.map((field) => [field.name, objectCleanEmpty(field.field)]),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ export const EntityFieldsForm = forwardRef<EntityFieldsFormRef, EntityFieldsForm
|
||||
getData: () => {
|
||||
return toCleanValues(getValues());
|
||||
},
|
||||
isValid: () => isValid
|
||||
isValid: () => isValid,
|
||||
}));
|
||||
|
||||
function handleAppend(_type: keyof typeof fieldsSchemaObject) {
|
||||
@@ -125,8 +125,8 @@ export const EntityFieldsForm = forwardRef<EntityFieldsFormRef, EntityFieldsForm
|
||||
new: true,
|
||||
field: {
|
||||
type: _type,
|
||||
config: {}
|
||||
}
|
||||
config: {},
|
||||
},
|
||||
};
|
||||
append(newField);
|
||||
}
|
||||
@@ -137,7 +137,7 @@ export const EntityFieldsForm = forwardRef<EntityFieldsFormRef, EntityFieldsForm
|
||||
setValue,
|
||||
getValues,
|
||||
control,
|
||||
setError
|
||||
setError,
|
||||
};
|
||||
return (
|
||||
<>
|
||||
@@ -197,20 +197,20 @@ export const EntityFieldsForm = forwardRef<EntityFieldsFormRef, EntityFieldsForm
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const SelectType = ({
|
||||
onSelect,
|
||||
additionalFieldTypes = [],
|
||||
onSelected
|
||||
onSelected,
|
||||
}: {
|
||||
onSelect: (type: string) => void;
|
||||
additionalFieldTypes?: (TFieldSpec & { onClick?: () => void })[];
|
||||
onSelected?: () => void;
|
||||
}) => {
|
||||
const types: (TFieldSpec & { onClick?: () => void })[] = fieldSpecs.filter(
|
||||
(s) => s.addable !== false
|
||||
(s) => s.addable !== false,
|
||||
);
|
||||
|
||||
if (additionalFieldTypes) {
|
||||
@@ -266,7 +266,7 @@ function EntityField({
|
||||
form: { watch, register, setValue, getValues, control, setError },
|
||||
remove,
|
||||
errors,
|
||||
dnd
|
||||
dnd,
|
||||
}: {
|
||||
field: FieldArrayWithId<TFieldsFormSchema, "fields", "id">;
|
||||
index: number;
|
||||
@@ -307,7 +307,7 @@ function EntityField({
|
||||
className={twMerge(
|
||||
"flex flex-col border border-muted rounded bg-background mb-2",
|
||||
opened && "mb-6",
|
||||
hasErrors && "border-red-500 "
|
||||
hasErrors && "border-red-500 ",
|
||||
)}
|
||||
{...dndProps}
|
||||
>
|
||||
@@ -331,7 +331,7 @@ function EntityField({
|
||||
classNames={{
|
||||
root: "w-full h-full",
|
||||
wrapper: "font-mono h-full",
|
||||
input: "pt-px !h-full"
|
||||
input: "pt-px !h-full",
|
||||
}}
|
||||
{...register(`fields.${index}.name`)}
|
||||
disabled={!field.new}
|
||||
@@ -416,7 +416,7 @@ function EntityField({
|
||||
onChange={(value) => {
|
||||
setValue(`${prefix}.config`, {
|
||||
...getValues([`fields.${index}.config`])[0],
|
||||
...value
|
||||
...value,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user