( items: TaskListRenderItem[], visibleProperties: string[] | undefined, cardOptions: TaskCardOptions )
| 1816 | } |
| 1817 | |
| 1818 | private async renderGroupedVirtual( |
| 1819 | items: TaskListRenderItem[], |
| 1820 | visibleProperties: string[] | undefined, |
| 1821 | cardOptions: TaskCardOptions |
| 1822 | ): Promise<void> { |
| 1823 | // Populate group key lookup for cross-group drag detection |
| 1824 | this.syncGroupedDragMetadata(items); |
| 1825 | |
| 1826 | if (!this.virtualScroller) { |
| 1827 | this.virtualScroller = new VirtualScroller<TaskListVirtualItem>({ |
| 1828 | container: this.itemsContainer!, |
| 1829 | items: items, |
| 1830 | // itemHeight omitted - automatically calculated from sample (headers + cards) |
| 1831 | overscan: 5, |
| 1832 | renderItem: (item) => { |
| 1833 | if (!("type" in item)) { |
| 1834 | throw new Error("Unexpected flat task item in grouped renderer"); |
| 1835 | } |
| 1836 | if (item.type === "primary-header" || item.type === "sub-header") { |
| 1837 | return this.createGroupHeader(item); |
| 1838 | } else { |
| 1839 | const cardEl = createTaskCard( |
| 1840 | item.task, |
| 1841 | this.plugin, |
| 1842 | visibleProperties, |
| 1843 | cardOptions |
| 1844 | ); |
| 1845 | // Attach drag handlers for sort_order reordering |
| 1846 | this.configureCardForManualReordering(cardEl, item.task, item.groupKey); |
| 1847 | this.taskInfoCache.set(item.task.path, item.task); |
| 1848 | this.lastTaskSignatures.set( |
| 1849 | item.task.path, |
| 1850 | this.buildTaskSignature(item.task) |
| 1851 | ); |
| 1852 | return cardEl; |
| 1853 | } |
| 1854 | }, |
| 1855 | getItemKey: (item) => { |
| 1856 | if (!("type" in item)) { |
| 1857 | return item.path; |
| 1858 | } |
| 1859 | if (item.type === "primary-header") { |
| 1860 | return `primary-${item.groupKey}`; |
| 1861 | } else if (item.type === "sub-header") { |
| 1862 | return `sub-${item.groupKey}:${item.subGroupKey}`; |
| 1863 | } else { |
| 1864 | return item.task.path; |
| 1865 | } |
| 1866 | }, |
| 1867 | }); |
| 1868 | |
| 1869 | window.setTimeout(() => { |
| 1870 | this.virtualScroller?.recalculate(); |
| 1871 | }, 0); |
| 1872 | } else { |
| 1873 | this.resetVirtualScrollerIfCardRenderChanged( |
| 1874 | this.buildCardRenderSignature(visibleProperties, cardOptions) |
| 1875 | ); |
no test coverage detected