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

Function buildInferredColumns

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

Source from the content-addressed store, hash-verified

149
150 // Start a new column whenever the row key wraps
151 function buildInferredColumns (sourceItems: T[], groupKey: string) {
152 const columns: PivotColumn<C>[] = []
153 const groupItems: C[] = []
154
155 let currentCells: (C | null)[] = Array(rowKeys.length).fill(null)
156 let currentItems: C[] = []
157 let columnIndex = 0
158 let lastRowIndex = -1
159
160 for (const item of sourceItems) {
161 const rowKey = getPropertyFromItem(item, itemRow)
162 const rowIndex = rowIndexByKey.get(rowKey)
163
164 if (rowIndex === undefined) continue
165
166 if (rowIndex <= lastRowIndex) {
167 columns.push({ key: String(columnIndex), cells: currentCells, items: currentItems })
168 columnIndex++
169 currentCells = Array(rowKeys.length).fill(null)
170 currentItems = []
171 }
172
173 const cell = makeCell(item, rowKey, columnIndex, groupKey)
174 currentCells[rowIndex] = cell
175 currentItems.push(cell)
176 groupItems.push(cell)
177 lastRowIndex = rowIndex
178 }
179
180 if (currentCells.some(c => c !== null)) {
181 columns.push({ key: String(columnIndex), cells: currentCells, items: currentItems })
182 }
183
184 return { columns, groupItems }
185 }
186
187 for (const [groupKey, { label, items: sourceItems }] of groupMap) {
188 const { columns, groupItems } = explicit

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…