diff --git a/.changeset/fix-manifest-field-options.md b/.changeset/fix-manifest-field-options.md new file mode 100644 index 000000000..46a7a7048 --- /dev/null +++ b/.changeset/fix-manifest-field-options.md @@ -0,0 +1,5 @@ +--- +"emdash": patch +--- + +fix(core): pass field.options through to admin manifest for plugin field widgets diff --git a/packages/core/src/astro/types.ts b/packages/core/src/astro/types.ts index cecf24a00..bf159efbe 100644 --- a/packages/core/src/astro/types.ts +++ b/packages/core/src/astro/types.ts @@ -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` for arbitrary per-field config + * (e.g. a checkbox grid receiving its column definitions) + */ + options?: Array<{ value: string; label: string }> | Record; } >; } diff --git a/packages/core/src/emdash-runtime.ts b/packages/core/src/emdash-runtime.ts index c20d6d312..83b1c1b7a 100644 --- a/packages/core/src/emdash-runtime.ts +++ b/packages/core/src/emdash-runtime.ts @@ -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` 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; } > = {}; @@ -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`. 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,