From 1e5c71b2ade8de9fb88ba43144e36b6ad4bcb8b9 Mon Sep 17 00:00:00 2001 From: logelog <194732487+logelog@users.noreply.github.com> Date: Wed, 22 Jul 2026 13:37:03 +0200 Subject: [PATCH 1/7] feat(admin): show configured fields in content lists --- .changeset/collection-list-columns.md | 6 ++ packages/admin/src/components/ContentList.tsx | 95 ++++++++++++++++++- packages/admin/src/components/index.ts | 2 +- packages/admin/src/lib/api/client.ts | 1 + packages/admin/src/lib/api/schema.ts | 7 ++ packages/admin/src/router.tsx | 14 +++ .../tests/components/ContentList.test.tsx | 41 ++++++++ packages/core/src/api/schemas/schema.ts | 9 ++ packages/core/src/astro/types.ts | 2 + packages/core/src/cli/commands/export-seed.ts | 1 + .../migrations/054_collection_admin_config.ts | 16 ++++ .../core/src/database/migrations/runner.ts | 2 + packages/core/src/database/types.ts | 1 + packages/core/src/emdash-runtime.ts | 33 +++++++ packages/core/src/schema/registry.ts | 26 +++++ packages/core/src/schema/types.ts | 9 ++ packages/core/src/seed/apply.ts | 2 + packages/core/src/seed/types.ts | 3 +- packages/core/src/seed/validate.ts | 17 ++++ .../core/tests/database/migrations.test.ts | 1 + .../integration/database/migrations.test.ts | 1 + .../tests/unit/runtime/manifest-build.test.ts | 64 ++++++++++++- .../core/tests/unit/schema/registry.test.ts | 13 +++ 23 files changed, 362 insertions(+), 4 deletions(-) create mode 100644 .changeset/collection-list-columns.md create mode 100644 packages/core/src/database/migrations/054_collection_admin_config.ts diff --git a/.changeset/collection-list-columns.md b/.changeset/collection-list-columns.md new file mode 100644 index 0000000000..a9c058ef0e --- /dev/null +++ b/.changeset/collection-list-columns.md @@ -0,0 +1,6 @@ +--- +"emdash": minor +"@emdash-cms/admin": minor +--- + +Adds collection-configured custom field columns to admin content lists. Collection seeds and schema APIs can declare up to four supported fields through `admin.listColumns`; EmDash validates them when building the manifest and renders their stored values between the title and status columns. diff --git a/packages/admin/src/components/ContentList.tsx b/packages/admin/src/components/ContentList.tsx index 5647a57398..4fa4c193f6 100644 --- a/packages/admin/src/components/ContentList.tsx +++ b/packages/admin/src/components/ContentList.tsx @@ -42,6 +42,13 @@ export interface ContentListSort { direction: "asc" | "desc"; } +export interface ContentListColumn { + slug: string; + label: string; + kind: string; + options?: Array<{ value: string; label: string }>; +} + /** Status filter values. `"all"` clears the status filter. */ export type ContentStatusFilter = "all" | "published" | "draft" | "scheduled" | "archived"; @@ -63,6 +70,8 @@ export interface ContentListProps { collection: string; collectionLabel: string; items: ContentItem[]; + /** Validated custom-field columns from the collection manifest. */ + listColumns?: ContentListColumn[]; trashedItems?: TrashedContentItem[]; isLoading?: boolean; isTrashedLoading?: boolean; @@ -157,6 +166,7 @@ export function ContentList({ collection, collectionLabel, items, + listColumns = [], trashedItems = [], isLoading, isTrashedLoading, @@ -315,7 +325,7 @@ export function ContentList({ } })(); }; - const colSpan = (i18n ? 5 : 4) + (bulkEnabled ? 1 : 0); + const colSpan = (i18n ? 5 : 4) + listColumns.length + (bulkEnabled ? 1 : 0); return (