-
-
Notifications
You must be signed in to change notification settings - Fork 202
refactor: Cleanup Neo.grid.Body and optimize Row/Body responsibilities (#8964) #8974
Copy link
Copy link
Closed
Labels
Description
The current Neo.grid.Body implementation retains several methods and imports that are either obsolete (due to the Neo.grid.Row refactoring) or misplaced (logic that belongs in Neo.grid.Row).
Goal: Clean up and optimize Neo.grid.Body and Neo.grid.Row by removing dead code and enforcing stricter separation of concerns.
Scope:
- Remove Unused Imports:
Neo.grid.Body: RemoveNeoArrayimport (check usage).
- Move/Refactor ID Generation:
getCellId: Currently in Body, called by Row. Should this move to Row? A cell ID is intrinsically tied to the Row and Column. If Row generates its own VDOM, it should probably generate its own cell IDs.getRowId: Body needs this for pooling (createRowPool) and finding rows (getRowId(rowIndex)). This likely needs to stay in Body or be a static helper, as Body manages the pool.
- Move/Refactor Styling:
getRowClass: Currently in Body, called by Row. Row should probably own its own class logic, or Body passes configuration.
- Review other legacy methods:
- Check for other methods in Body that were used by the old
createRowimplementation but are now unused.
- Check for other methods in Body that were used by the old
Specific Tasks:
- Analyze
src/grid/Body.mjs: Identify unused imports and methods. - Analyze
src/grid/Row.mjs: Identify dependencies on Body that should be internal. - Refactor: Move
getCellIdlogic toRow.mjs(asgetCellId(column))? Or keep it central? Central ensures consistency for external lookups (e.g. SelectionModel).- Decision:
GridBodyneeds to lookup cells/rows for selection and navigation. SogetCellId(rowIndex, dataField)MUST exist on Body (or be easily deriving). If we move it to Row, Body can't easily calculating ID without finding the Row instance first. - Refinement: Keep
getCellIdon Body for global access, but ensureRowuses it efficiently.
- Decision:
- Cleanup: Remove
NeoArrayif unused. RemovegetRowClassfrom Body and implementbaseCls/clslogic inRow?Rowalready hasrowClslogic.GridBody.getRowClasswas an override point. If we remove it, we break extensibility? We should check ifRowcallsgridBody.getRowClass.
Let's start by analyzing the files.
Reactions are currently unavailable