getFieldTypeGroupedOptions function exported ✓ 100.0%
Last updated: 2026-03-01T23:25:47.131Z
Metrics
LOC: 19
Complexity: 1
Params: 2
Coverage: 100.0% (8/8 lines, 6x executed)
Signature
getFieldTypeGroupedOptions(
types: readonly FieldType[] = FIELD_TYPES,
): : FieldTypeGroup[]
Summary
Returns field type options grouped by category, sorted alphabetically within each group and with groups themselves sorted alphabetically by their label. Groups with no matching types are omitted.
Source Code
export function getFieldTypeGroupedOptions(
types: readonly FieldType[] = FIELD_TYPES,
): FieldTypeGroup[] {
const typeSet = new Set(types);
return (
Object.entries(FIELD_TYPES_BY_CATEGORY) as [FieldCategory, FieldType[]][]
)
.map(([category, categoryTypes]) => ({
category,
label: FIELD_CATEGORY_LABELS[category],
options: categoryTypes
.filter((t) => typeSet.has(t))
.map((type) => ({ value: type, label: getFieldTypeLabel(type) }))
.sort((a, b) => a.label.localeCompare(b.label, "pt-BR")),
}))
.filter((group) => group.options.length > 0)
.sort((a, b) => a.label.localeCompare(b.label, "pt-BR"));
}
Dependencies (Outgoing)
| Target | Type |
|---|---|
| getFieldTypeLabel | calls |
Impact (Incoming)
| Source | Type |
|---|---|
| addLog | uses |
| buildFieldTypeOptionsHtml | uses |