( collectionRef: RefObject<HTMLElement | null>, key: Key )
| 28 | } |
| 29 | |
| 30 | export function getItemElement( |
| 31 | collectionRef: RefObject<HTMLElement | null>, |
| 32 | key: Key |
| 33 | ): Element | null | undefined { |
| 34 | let selector = `[data-key="${CSS.escape(String(key))}"]`; |
| 35 | let collection = collectionRef.current?.dataset.collection; |
| 36 | if (collection) { |
| 37 | selector = `[data-collection="${CSS.escape(collection)}"]${selector}`; |
| 38 | } |
| 39 | return collectionRef.current?.querySelector(selector); |
| 40 | } |
| 41 | |
| 42 | const collectionMap = new WeakMap<Collection<any>, string>(); |
| 43 | export function useCollectionId(collection: Collection<any>): string { |
no outgoing calls
no test coverage detected