Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix-manifest-field-options.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"emdash": patch
---

fix(core): pass field.options through to admin manifest for plugin field widgets
8 changes: 7 additions & 1 deletion packages/core/src/astro/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ export interface ManifestCollection {
label?: string;
required?: boolean;
widget?: string;
options?: Array<{ value: string; label: string }>;
/**
* Field options. Two shapes:
* - Legacy enum: `Array<{ value, label }>` for select / multiSelect widgets
* - Plugin widgets: `Record<string, unknown>` for arbitrary per-field config
* (e.g. a checkbox grid receiving its column definitions)
*/
options?: Array<{ value: string; label: string }> | Record<string, unknown>;
}
>;
}
Expand Down
14 changes: 12 additions & 2 deletions packages/core/src/emdash-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,10 @@ export class EmDashRuntime {
label?: string;
required?: boolean;
widget?: string;
options?: Array<{ value: string; label: string }>;
// Two shapes: legacy enum-style `[{ value, label }]` for select widgets,
// or arbitrary `Record<string, unknown>` for plugin field widgets that
// need per-field config (e.g. a checkbox grid receiving its column defs).
options?: Array<{ value: string; label: string }> | Record<string, unknown>;
}
> = {};

Expand All @@ -1166,7 +1169,14 @@ export class EmDashRuntime {
required: field.required,
};
if (field.widget) entry.widget = field.widget;
// Include select/multiSelect options from validation
// Plugin field widgets read their per-field config from `field.options`,
// which the seed schema types as `Record<string, unknown>`. Pass it
// through to the manifest so plugin widgets in the admin SPA receive it.
if (field.options) {
entry.options = field.options;
}
// Legacy: select/multiSelect enum options live on `field.validation.options`.
// Wins over `field.options` to preserve existing behavior for enum widgets.
if (field.validation?.options) {
entry.options = field.validation.options.map((v) => ({
value: v,
Expand Down
Loading