enumOptions and enum reader used everywhere

This commit is contained in:
2026-06-04 16:17:03 +05:30
parent d6506e854a
commit 80ca1ac9a9
8 changed files with 77 additions and 48 deletions

View File

@@ -8,8 +8,8 @@ export function resolveTemplate(template: string, item: any): string {
}
export function getFieldOptions(field: ResourceField, relationData?: any[]): SelectOption[] {
if (field.type === 'enum' && field.options) {
return field.options.map(opt => ({
if (field.type === 'enum') {
return (field.options ?? []).map(opt => ({
key: opt,
value: field.enumLabels?.[opt] ?? opt,
}));