fix: render enum column cell labels from options prop#24
Merged
Conversation
DataGridEnumColumn and DataGridEnumListColumn previously ignored the `options` prop when rendering cells — only the filter UI used it, so cells showed raw enum values. Cell renderers now receive `enumOptions` and `enumName` via ColumnRenderProps and resolve labels from the options record, falling back to the raw value. The bindx-ui variant additionally falls back to EnumOptionsFormatter context when `options` is absent but the field carries an `enumName` (exported via `enumScalar`). Extract `createColumnStaticRender` from `createColumn` so enum columns — which need a narrower generic signature than `ColumnComponent` can express — can attach the static render via `Object.assign`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DataGridEnumColumn/DataGridEnumListColumnignored theoptionsprop when rendering cells — only the filter UI consumed it, so cells showed raw enum values. Cell renderers now receiveenumOptionsandenumNamethroughColumnRenderPropsand resolve labels from the options record (falling back to the raw value).bindx-uivariant additionally falls back to theEnumOptionsFormattercontext whenoptionsis absent but the field carries anenumName(now exported viaenumScalar).createColumnStaticRenderfromcreateColumnso enum columns — which need a narrower generic signature thanColumnComponentcan express — can attach the static render viaObject.assign.Test plan
tests/react/dataview/dataGridEnumColumnOptions.test.tsx— headless dataview: options record labels, array fallback, enum list labelstests/react/dataview/dataGridEnumColumnUi.test.tsx— bindx-ui: options record, children override,EnumOptionsFormattercontext fallback, options > context priority, enum list labelstests/react/dataview/dataGridFiltering.test.tsxupdated to assert against labels (Published/Draft) instead of raw values