MCPcopy
hub / github.com/handsontable/handsontable / propToCol

Method propToCol

handsontable/src/dataMap/dataMap.ts:292–309  ·  view source on GitHub ↗

* Translates property into visual column index. * * @param {string|number} prop Column property which may be also a physical column index. * @returns {string|number} Visual column index or passed argument.

(prop: string | number)

Source from the content-addressed store, hash-verified

290 * @returns {string|number} Visual column index or passed argument.
291 */
292 propToCol(prop: string | number) {
293 const cachedPhysicalIndex = this.propToColCache!.get(prop);
294
295 if (cachedPhysicalIndex !== undefined) {
296 return this.hot!.toVisualColumn(cachedPhysicalIndex);
297 }
298
299 // Property may be a physical column index.
300 if (typeof prop !== 'number') {
301 return prop;
302 }
303
304 const visualColumn = this.hot!.toVisualColumn(prop);
305
306 // Fall back to the physical index when toVisualColumn returns null
307 // (e.g. column is trimmed/hidden and has no visual equivalent).
308 return visualColumn !== null ? visualColumn : prop;
309 }
310
311 /**
312 * Returns data's schema.

Callers 4

replaceDataFunction · 0.95
getMethod · 0.95
getCopyableMethod · 0.95
setMethod · 0.95

Calls 2

toVisualColumnMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected