Skip to content

getDataFields

getDataFields(props): Record<string, AdminDataField>

Defined in: packages/core/src/fields/utils.ts:454

Flattens a fields record — legal at any nesting level a fields record appears (a collection’s/global’s own top-level fields, a group()’s fields, a group-shaped array()’s items, a blocks() block’s own fields) — down to the data fields every schema/validation/type-gen/RBAC/index/version/list-column/ default-value consumer needs: ui() entries are dropped; an unnamed tabs() tab’s, or a row()’s/collapsible()’s, children are hoisted up to this level (recursively, so a hoisted child that is itself a UI field is flattened too); a NAMED tab becomes one group()-shaped data field keyed by the tab’s own name, built via the real group() factory so it carries every default a hand-built group field would. Every UI container’s own admin.condition is AND-ed into each field it flattens through andFieldConditions — a field hidden by its tab’s/row’s/ collapsible’s condition is exactly as hidden as one hidden by its own. Likewise admin.hidden/admin.readOnly are OR-ed in: a field under a hidden/read-only container is itself hidden/read-only even if its own flag says otherwise — a container can only ever make a descendant MORE restricted, never less.

Record<string, AdminField>

Record<string, AdminDataField>

The flattened data fields, keyed by their resolved data key.

When two entries flatten to the same data key (two fields named the same, a named tab reusing a sibling’s key, two tabs sharing a name, …).