MCPcopy
hub / github.com/vuetifyjs/vuetify / buildExplicitColumns

Function buildExplicitColumns

packages/vuetify/src/labs/VHeatmap/pivot.ts:119–148  ·  view source on GitHub ↗
(sourceItems: T[], groupKey: string)

Source from the content-addressed store, hash-verified

117 }
118
119 function buildExplicitColumns (sourceItems: T[], groupKey: string) {
120 const groupItems: C[] = []
121
122 const columnKeys = columnsProp
123 ? [...columnsProp]
124 : [...new Set(sourceItems.map(item => getPropertyFromItem(item, itemColumn)))]
125
126 const columns: PivotColumn<C>[] = columnKeys.map(key => ({
127 key: String(key),
128 cells: Array(rowKeys.length).fill(null),
129 items: [],
130 }))
131 const columnIndexByKey = new Map<any, number>(columnKeys.map((k, i) => [k, i]))
132
133 for (const item of sourceItems) {
134 const rowKey = getPropertyFromItem(item, itemRow)
135 const columnKey = getPropertyFromItem(item, itemColumn)
136 const rowIndex = rowIndexByKey.get(rowKey)
137 const columnIndex = columnIndexByKey.get(columnKey)
138
139 if (rowIndex === undefined || columnIndex === undefined) continue
140
141 const cell = makeCell(item, rowKey, columnKey, groupKey)
142 columns[columnIndex].cells[rowIndex] = cell
143 columns[columnIndex].items.push(cell)
144 groupItems.push(cell)
145 }
146
147 return { columns, groupItems }
148 }
149
150 // Start a new column whenever the row key wraps
151 function buildInferredColumns (sourceItems: T[], groupKey: string) {

Callers 1

usePivotFunction · 0.85

Calls 3

getPropertyFromItemFunction · 0.90
makeCellFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…