(rowIndex: number)
| 398 | } |
| 399 | |
| 400 | private insertRow(rowIndex: number): void { |
| 401 | const value = this.model.getRow(rowIndex); |
| 402 | const eDiv = document.createElement('div'); |
| 403 | |
| 404 | eDiv.classList.add('ag-virtual-list-item', `ag-${this.cssIdentifier}-virtual-list-item`); |
| 405 | _setAriaRole(eDiv, this.ariaRole === 'tree' ? 'treeitem' : 'option'); |
| 406 | _setAriaSetSize(eDiv, this.model.getRowCount()); |
| 407 | _setAriaPosInSet(eDiv, rowIndex + 1); |
| 408 | eDiv.setAttribute('tabindex', '-1'); |
| 409 | |
| 410 | eDiv.style.height = `${this.rowHeight}px`; |
| 411 | eDiv.style.top = `${this.rowHeight * rowIndex}px`; |
| 412 | |
| 413 | const rowComponent = this.componentCreator(value, eDiv); |
| 414 | |
| 415 | rowComponent.addGuiEventListener('focusin', () => (this.lastFocusedRowIndex = rowIndex)); |
| 416 | |
| 417 | eDiv.appendChild(rowComponent.getGui()); |
| 418 | |
| 419 | // keep the DOM order consistent with the order of the rows |
| 420 | if (this.renderedRows.has(rowIndex - 1)) { |
| 421 | this.renderedRows.get(rowIndex - 1)!.eDiv.insertAdjacentElement('afterend', eDiv); |
| 422 | } else if (this.renderedRows.has(rowIndex + 1)) { |
| 423 | this.renderedRows.get(rowIndex + 1)!.eDiv.insertAdjacentElement('beforebegin', eDiv); |
| 424 | } else { |
| 425 | this.eContainer.appendChild(eDiv); |
| 426 | } |
| 427 | |
| 428 | this.renderedRows.set(rowIndex, { rowComponent, eDiv, value }); |
| 429 | } |
| 430 | |
| 431 | private removeRow(rowIndex: number) { |
| 432 | const component = this.renderedRows.get(rowIndex)!; |
no test coverage detected