From 9a80a52fd5f83c7f039efad54b5a4f8473c8c5a1 Mon Sep 17 00:00:00 2001 From: Vishesh 'ironeagle' Bangotra Date: Fri, 19 Jun 2026 19:18:41 +0530 Subject: [PATCH] form single line per field --- react-openapi/src/components/ResourceDetail.tsx | 2 +- react-openapi/src/components/ResourceForm.tsx | 13 +++++++++---- react-openapi/src/components/ResourceList.tsx | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/react-openapi/src/components/ResourceDetail.tsx b/react-openapi/src/components/ResourceDetail.tsx index 39eea3c..c7a3f5e 100644 --- a/react-openapi/src/components/ResourceDetail.tsx +++ b/react-openapi/src/components/ResourceDetail.tsx @@ -85,7 +85,7 @@ export function ResourceDetail({ resource, basePath }: ResourceDetailProps) { fmt = field.inlineDisplayFormat ?? resource.displayFormat; } return ( - + ); diff --git a/react-openapi/src/components/ResourceForm.tsx b/react-openapi/src/components/ResourceForm.tsx index 65fa0ca..7b3cf93 100644 --- a/react-openapi/src/components/ResourceForm.tsx +++ b/react-openapi/src/components/ResourceForm.tsx @@ -106,7 +106,7 @@ export function ResourceForm({ resource, basePath, mode }: ResourceFormProps) { } const opts = items.map((item: any) => ({ - value: item[targetRes.primaryKey], + value: resolvePk(item, targetRes.primaryKey), label: applyFormat(item, targetRes.displayFormat), })); console.log(`[loadFkOptions] computed ${opts.length} options for field "${fieldName}"`, opts.slice(0, 3)); @@ -139,9 +139,9 @@ export function ResourceForm({ resource, basePath, mode }: ResourceFormProps) { const targetRes = allResources.find((r) => r.name === rel.config.resource); if (targetRes) { if (Array.isArray(val)) { - resolved[rel.fieldName] = val.map((item: any) => item[targetRes.primaryKey]); + resolved[rel.fieldName] = val.map((item: any) => resolvePk(item, targetRes.primaryKey)); } else if (typeof val === "object") { - resolved[rel.fieldName] = val[targetRes.primaryKey]; + resolved[rel.fieldName] = resolvePk(val, targetRes.primaryKey); } } if (!rel.config.prefetch) { @@ -237,7 +237,7 @@ export function ResourceForm({ resource, basePath, mode }: ResourceFormProps) { {resource.orderedFields .filter((f) => !(f.name === resource.primaryKey && mode === "edit")) .map((field) => ( - + String(obj[key] ?? "")); diff --git a/react-openapi/src/components/ResourceList.tsx b/react-openapi/src/components/ResourceList.tsx index d92a04c..9677719 100644 --- a/react-openapi/src/components/ResourceList.tsx +++ b/react-openapi/src/components/ResourceList.tsx @@ -387,7 +387,7 @@ export function ResourceList({ resource, basePath }: ResourceListProps) { {detailRow && ( {visibleColumns.map((col) => ( - +