@jimka/typescript-ui / component/table / CellEditorPool
Class: CellEditorPool
Defined in: src/typescript/lib/component/table/cell/editor/CellEditorPool.ts:41
Per-table registry that holds at most one shared editor instance per editor variant.
Every cell in Body used to allocate its own editor up front, but only one cell can be edited at a time. The pool keeps the renderer-per-row model untouched while collapsing the N editors down to one instance per cell-provided key returned from Cell.getEditorKey. On CellEditorPool.acquire the editor is lazily constructed (and its blur/keydown listeners wired once), then re-used across every subsequent edit of the same variant.
Built-in keys are seeded by the constructor:
"string","number","date""time"/"time:seconds""datetime"/"datetime:seconds"
Custom cells can opt in by overriding Cell.getEditorKey and registering a factory via CellEditorPool.register before the first edit. Cells that return null from getEditorKey (e.g. BooleanCell, GlyphCell, DefaultCell) keep their legacy behaviour.
Constructors
new CellEditorPool()
new CellEditorPool(): CellEditorPoolDefined in: src/typescript/lib/component/table/cell/editor/CellEditorPool.ts:50
Constructs a pool pre-seeded with factories for every built-in typed cell.
Returns
Methods
acquire()
acquire(key: string, cell: Cell<any>): null | CellEditor<unknown>Defined in: src/typescript/lib/component/table/cell/editor/CellEditorPool.ts:85
Returns the shared editor for key, lazily constructing it on first call and marking cell as the active edit target.
Parameters
key
string
The editor variant key returned by Cell.getEditorKey.
cell
Cell<any>
The cell that is starting an edit; receives subsequent blur/keydown events.
Returns
null | CellEditor<unknown>
The shared editor instance, or null if no factory is registered for key.
register()
register(key: string, factory: CellEditorFactory): thisDefined in: src/typescript/lib/component/table/cell/editor/CellEditorPool.ts:70
Registers or overrides a factory for the given pool key.
Parameters
key
string
The editor variant key, matching Cell.getEditorKey.
factory
A factory that constructs a fresh editor instance.
Returns
this
This pool, for method chaining.
Remarks
If an editor was already cached for the key it is dropped so the new factory runs on the next call to CellEditorPool.acquire.
release()
release(): voidDefined in: src/typescript/lib/component/table/cell/editor/CellEditorPool.ts:106
Clears the active-cell pointer. Called by Cell when an edit commits or cancels.
Returns
void