carbon-components-angular
Version:
Next generation components
1,193 lines (999 loc) • 43.8 kB
HTML
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>carbon-components-angular documentation</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="../images/favicon.ico">
<link rel="stylesheet" href="../styles/style.css">
<link rel="stylesheet" href="../styles/dark.css">
<style>
footer.carbon {
position: absolute;
bottom: 0;
width: 100%;
z-index: 9999;
}
#root > div {
/*
* Subtracting the height of the footer to prevent
* overlaying the footer ontop of content
*/
height: calc(100vh - 48px);
}
</style>
</head>
<body>
<script>
// Blocking script to avoid flickering dark mode
// Dark mode toggle button
var useDark = window.matchMedia('(prefers-color-scheme: dark)');
var darkModeState = useDark.matches;
var $darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input');
var $darkModeToggles = document.querySelectorAll('.dark-mode-switch');
var darkModeStateLocal = localStorage.getItem('compodoc_darkmode-state');
function checkToggle(check) {
for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
$darkModeToggleSwitchers[i].checked = check;
}
}
function toggleDarkMode(state) {
if (window.localStorage) {
localStorage.setItem('compodoc_darkmode-state', state);
}
checkToggle(state);
const hasClass = document.body.classList.contains('dark');
if (state) {
for (var i = 0; i < $darkModeToggles.length; i++) {
$darkModeToggles[i].classList.add('dark');
}
if (!hasClass) {
document.body.classList.add('dark');
}
} else {
for (var i = 0; i < $darkModeToggles.length; i++) {
$darkModeToggles[i].classList.remove('dark');
}
if (hasClass) {
document.body.classList.remove('dark');
}
}
}
useDark.addEventListener('change', function (evt) {
toggleDarkMode(evt.matches);
});
if (darkModeStateLocal) {
darkModeState = darkModeStateLocal === 'true';
}
toggleDarkMode(darkModeState);
</script>
<div class="navbar navbar-default navbar-fixed-top d-md-none p-0">
<div class="d-flex">
<a href="../" class="navbar-brand">carbon-components-angular documentation</a>
<button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
</div>
</div>
<div class="xs-menu menu" id="mobile-menu">
<div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu>
</div>
<div class="container-fluid main">
<div class="row main">
<div class="d-none d-md-block menu">
<compodoc-menu mode="normal"></compodoc-menu>
</div>
<!-- START CONTENT -->
<div class="content class">
<div class="content-data">
<ol class="breadcrumb">
<li class="breadcrumb-item">Classes</li>
<li class="breadcrumb-item" >TableAdapter</li>
</ol>
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a href="#info"
class="nav-link"
class="nav-link active"
role="tab" id="info-tab" data-bs-toggle="tab" data-link="info">Info</a>
</li>
<li class="nav-item">
<a href="#source"
class="nav-link"
role="tab" id="source-tab" data-bs-toggle="tab" data-link="source">Source</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade active in" id="info">
<p class="comment">
<h3>File</h3>
</p>
<p class="comment">
<code>src/table/table-adapter.class.ts</code>
</p>
<p class="comment">
<h3>Description</h3>
</p>
<p class="comment">
<p>An abstract representation of a table that provides
a standard interface to query 2d tables for cell and row information.</p>
</p>
<section data-compodoc="block-index">
<h3 id="index">Index</h3>
<table class="table table-sm table-bordered index-table">
<tbody>
<tr>
<td class="col-md-4">
<h6><b>Methods</b></h6>
</td>
</tr>
<tr>
<td class="col-md-4">
<ul class="index-list">
<li>
<a href="#findColumnIndex" >findColumnIndex</a>
</li>
<li>
<a href="#findIndex" >findIndex</a>
</li>
<li>
<a href="#findRowIndex" >findRowIndex</a>
</li>
<li>
<a href="#getCell" >getCell</a>
</li>
<li>
<a href="#getColumn" >getColumn</a>
</li>
<li>
<a href="#getRow" >getRow</a>
</li>
</ul>
</td>
</tr>
<tr>
<td class="col-md-4">
<h6><b>Accessors</b></h6>
</td>
</tr>
<tr>
<td class="col-md-4">
<ul class="index-list">
<li>
<a href="#lastColumnIndex" >lastColumnIndex</a>
</li>
<li>
<a href="#lastRowIndex" >lastRowIndex</a>
</li>
</ul>
</td>
</tr>
</tbody>
</table>
</section>
<section data-compodoc="block-methods">
<h3 id="methods">
Methods
</h3>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="findColumnIndex"></a>
<span class="name">
<span ><b>findColumnIndex</b></span>
<a href="#findColumnIndex"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>findColumnIndex(cell: <a href="../classes/TableCellAdapter.html" target="_self">TableCellAdapter</a>)</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="75"
class="link-to-prism">src/table/table-adapter.class.ts:75</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>Finds the column index of a given cell</p>
</div>
<div class="io-description">
<b>Parameters :</b>
<table class="params">
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td>Optional</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td>cell</td>
<td>
<code><a href="../classes/TableCellAdapter.html" target="_self" >TableCellAdapter</a></code>
</td>
<td>
No
</td>
<td>
<p>the cell to search for</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="io-description">
<b>Returns : </b> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
</div>
<div class="io-description">
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="findIndex"></a>
<span class="name">
<span ><b>findIndex</b></span>
<a href="#findIndex"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>findIndex(cell: <a href="../classes/TableCellAdapter.html" target="_self">TableCellAdapter</a>)</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="90"
class="link-to-prism">src/table/table-adapter.class.ts:90</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>Finds the row and column index of a given cell</p>
</div>
<div class="io-description">
<b>Parameters :</b>
<table class="params">
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td>Optional</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td>cell</td>
<td>
<code><a href="../classes/TableCellAdapter.html" target="_self" >TableCellAdapter</a></code>
</td>
<td>
No
</td>
<td>
<p>the cell to search for</p>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="findRowIndex"></a>
<span class="name">
<span ><b>findRowIndex</b></span>
<a href="#findRowIndex"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>findRowIndex(cell: <a href="../classes/TableCellAdapter.html" target="_self">TableCellAdapter</a>)</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="82"
class="link-to-prism">src/table/table-adapter.class.ts:82</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>Finds the row index of a given cell</p>
</div>
<div class="io-description">
<b>Parameters :</b>
<table class="params">
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td>Optional</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td>cell</td>
<td>
<code><a href="../classes/TableCellAdapter.html" target="_self" >TableCellAdapter</a></code>
</td>
<td>
No
</td>
<td>
<p>the cell to search for</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="io-description">
<b>Returns : </b> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
</div>
<div class="io-description">
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="getCell"></a>
<span class="name">
<span ><b>getCell</b></span>
<a href="#getCell"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>getCell(row: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>, column: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>)</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="54"
class="link-to-prism">src/table/table-adapter.class.ts:54</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>Returns a cell from the table</p>
</div>
<div class="io-description">
<b>Parameters :</b>
<table class="params">
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td>Optional</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td>row</td>
<td>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
</td>
<td>
No
</td>
<td>
<p>index of the row</p>
</td>
</tr>
<tr>
<td>column</td>
<td>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
</td>
<td>
No
</td>
<td>
<p>index of the column</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="io-description">
<b>Returns : </b> <code><a href="../classes/TableCellAdapter.html" target="_self" >TableCellAdapter</a></code>
</div>
<div class="io-description">
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="getColumn"></a>
<span class="name">
<span ><b>getColumn</b></span>
<a href="#getColumn"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>getColumn(column: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>)</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="61"
class="link-to-prism">src/table/table-adapter.class.ts:61</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>Returns a row from the table</p>
</div>
<div class="io-description">
<b>Parameters :</b>
<table class="params">
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td>Optional</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td>column</td>
<td>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
</td>
<td>
No
</td>
<td>
<p>index of the column</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="io-description">
<b>Returns : </b> <code><a href="../classes/TableCellAdapter.html" target="_self" >TableCellAdapter[]</a></code>
</div>
<div class="io-description">
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="getRow"></a>
<span class="name">
<span ><b>getRow</b></span>
<a href="#getRow"><span class="icon ion-ios-link"></span></a>
</span>
</td>
</tr>
<tr>
<td class="col-md-4">
<code>getRow(row: <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank">number</a>)</code>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="68"
class="link-to-prism">src/table/table-adapter.class.ts:68</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>Returns a row from the table</p>
</div>
<div class="io-description">
<b>Parameters :</b>
<table class="params">
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td>Optional</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td>row</td>
<td>
<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
</td>
<td>
No
</td>
<td>
<p>index of the row</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="io-description">
<b>Returns : </b> <code><a href="../classes/TableRowAdapter.html" target="_self" >TableRowAdapter</a></code>
</div>
<div class="io-description">
</div>
</td>
</tr>
</tbody>
</table>
</section>
<section data-compodoc="block-accessors">
<h3 id="accessors">
Accessors
</h3>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="lastColumnIndex"></a>
<span class="name"><b>lastColumnIndex</b><a href="#lastColumnIndex"><span class="icon ion-ios-link"></span></a></span>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="accessor"><b>get</b><code>lastColumnIndex()</code></span>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="41" class="link-to-prism">src/table/table-adapter.class.ts:41</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>The last accessible column in the table</p>
</div>
<div class="io-description">
<b>Returns : </b> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
</div>
</td>
</tr>
</tbody>
</table>
<table class="table table-sm table-bordered">
<tbody>
<tr>
<td class="col-md-4">
<a name="lastRowIndex"></a>
<span class="name"><b>lastRowIndex</b><a href="#lastRowIndex"><span class="icon ion-ios-link"></span></a></span>
</td>
</tr>
<tr>
<td class="col-md-4">
<span class="accessor"><b>get</b><code>lastRowIndex()</code></span>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-line">Defined in <a href="" data-line="46" class="link-to-prism">src/table/table-adapter.class.ts:46</a></div>
</td>
</tr>
<tr>
<td class="col-md-4">
<div class="io-description"><p>The last accessible row in the table</p>
</div>
<div class="io-description">
<b>Returns : </b> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
</div>
</td>
</tr>
</tbody>
</table>
</section>
</div>
<div class="tab-pane fade tab-source-code" id="source">
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">export abstract class TableCellAdapter {
/**
* The index of the cell in the table
*/
cellIndex: number;
/**
* The number of columns spanned by this cell
*/
colSpan: number;
/**
* The number of rows spanned by this cell
*/
rowSpan: number;
}
/**
* An abstract class that represents a row in a table
*/
export abstract class TableRowAdapter {
/**
* The index of the row in the table
*/
rowIndex: number;
/**
* An array (or `HTMLCollection`) of `TableCellAdapter`s
*/
cells: HTMLCollection | TableCellAdapter[];
}
/**
* An abstract representation of a table that provides
* a standard interface to query 2d tables for cell and row information.
*/
export abstract class TableAdapter {
/**
* The last accessible column in the table
*/
public get lastColumnIndex(): number { return; }
/**
* The last accessible row in the table
*/
public get lastRowIndex(): number { return; }
/**
* Returns a cell from the table
*
* @param row index of the row
* @param column index of the column
*/
getCell(row: number, column: number): TableCellAdapter { return; }
/**
* Returns a row from the table
*
* @param column index of the column
*/
getColumn(column: number): TableCellAdapter[] { return; }
/**
* Returns a row from the table
*
* @param row index of the row
*/
getRow(row: number): TableRowAdapter { return; }
/**
* Finds the column index of a given cell
*
* @param cell the cell to search for
*/
findColumnIndex(cell: TableCellAdapter): number { return; }
/**
* Finds the row index of a given cell
*
* @param cell the cell to search for
*/
findRowIndex(cell: TableCellAdapter): number { return; }
/**
* Finds the row and column index of a given cell
*
* @param cell the cell to search for
* @returns a tuple that follows the `[row, column]` convention
*/
findIndex(cell: TableCellAdapter): [number, number] { return; }
}
enum TableDomSpanDirection {
colSpan = "colSpan",
rowSpan = "rowSpan"
}
/**
* A concrete implementation of `TableAdapter`
*
* Provides standard and consistent access to table cells and rows
*/
export class TableDomAdapter implements TableAdapter {
/**
* The last accessible column in the table
*/
public get lastColumnIndex() {
return this.getRealRowLength(this.tableElement.rows[0]);
}
/**
* The last accessible row in the table
*/
public get lastRowIndex() {
return this.tableElement.rows.length - 1;
}
/**
* `TableDomAdapter` works on a normal HTML table structure.
* Custom tables that don't follow the standard structure should use a custom implementation of `TableAdapter`.
*
* The standard structure allows us to directly query rows for cells and indexes - though we do have to handle colspans specially.
*
* @param tableElement the root HTML table element.
*/
constructor(public tableElement: HTMLTableElement) { }
/**
* Returns a cell from the table taking colspans in to account.
*
* @param row index of the row
* @param column index of the column
*/
getCell(row: number, column: number): HTMLTableCellElement {
const col = this.getColumn(column);
return this.findCellInColumn(col, row).cell;
}
/**
* Returns a column from the table, using the `id` and `headers` attributes
*
* See here for more detail these attributes: https://www.w3.org/TR/WCAG20-TECHS/H43.html
*
* @param column the index of the column
*/
getColumn(column: number): HTMLTableCellElement[] {
const firstHeader = Array.from(this.tableElement.rows[0].cells);
const { cell: header, realIndex: realColumnIndex } = this.findCellInRow(firstHeader, column);
const linkedCells: HTMLTableCellElement[] = [];
for (let i = 1; i < this.tableElement.rows.length; i++) {
const row = this.tableElement.rows[i];
// query for any cells that are linked to the given header id
// `~=` matches values in space separated lists - so `[headers~='foo']` would match `headers="foo bar"` and `headers="foo"`
// but not `headers="bar"` or `headers="bar baz"`
const linkedRowCells: NodeListOf<HTMLTableCellElement> = row.querySelectorAll(`[headers~='${header.id}']`);
// if we have more than one cell, get the one that is closest to the column
if (linkedRowCells.length > 1) {
const { cell } = this.findCellInRow(Array.from(linkedRowCells), column - realColumnIndex);
linkedCells.push(cell);
} else if (linkedRowCells[0]) {
linkedCells.push(linkedRowCells[0]);
}
}
// return an empty array if we can't find any linked cells
// returning anything else would be a lie
if (!linkedCells) {
return [];
}
return [header, ...linkedCells];
}
/**
* Returns a row from the table
*
* @param row index of the row
*/
getRow(row: number): HTMLTableRowElement {
return this.tableElement.rows[row];
}
/**
* Finds the column index of a given cell
*
* @param cell the cell to search for
*/
findColumnIndex(cell: HTMLTableCellElement): number {
const row = this.getRow(this.findRowIndex(cell));
if (!row) {
return;
}
// if the cell has linked headers we can do a more accurate lookup
if (cell && cell.headers) {
const ids = cell.headers.split(" ");
const headerRows = Array.from(this.tableElement.tHead.rows);
const indexes = [];
// start from the last row and work up
for (const headerRow of headerRows.reverse()) {
const headerCells = Array.from(headerRow.cells);
const header = headerCells.find(headerCell => ids.includes(headerCell.id));
// if we have a matching header, find it's index (adjusting for colspans)
if (header) {
// this is borrowed from below
let cellIndex = 0;
for (const c of headerCells) {
if (c === header) { break; }
cellIndex += c.colSpan;
}
indexes.push(cellIndex);
}
}
// sort the indexes largest to smallest to find the closest matching header index
const firstIndex = indexes.sort((a, b) => b - a)[0];
// search the row for cells that share the header
let similarCells = [];
for (const id of ids) {
// there's no selector that will match two space separated lists,
// so we have to iterate through the ids and query the row for each
const rowCells = Array.from(row.querySelectorAll(`[headers~='${id}']`));
for (const rowCell of rowCells) {
// only keep one set of cells
if (!similarCells.includes(rowCell)) {
similarCells.push(rowCell);
}
}
}
// DOM order is not preserved, so we have to sort the row
similarCells = similarCells.sort((a: HTMLTableCellElement, b: HTMLTableCellElement) => a.cellIndex - b.cellIndex);
// return the header index plus any adjustment within that headers column
return firstIndex + similarCells.indexOf(cell);
}
// fallback if the cell isn't linked to any headers
let cellIndex = 0;
for (const c of Array.from(row.cells)) {
if (c === cell) { break; }
cellIndex += c.colSpan;
}
return cellIndex;
}
/**
* Finds the row index of a given cell
*
* @param cell the cell to search for
*/
findRowIndex(cell: HTMLTableCellElement): number {
for (const row of Array.from(this.tableElement.rows)) {
if (row.contains(cell)) {
return row.rowIndex;
}
}
}
/**
* Finds the row and column index of a given cell
*
* @param cell the cell to search for
* @returns a tuple that follows the `[row, column]` convention
*/
findIndex(cell: HTMLTableCellElement): [number, number] {
return [this.findRowIndex(cell), this.findColumnIndex(cell)];
}
/**
* Helper function that returns the "real" length of a row.
* Only accurate with regard to colspans (though that's sufficient for it's uses here)
*
* TODO: Take rowSpan into account
*
* @param row the row to get the length of
*/
protected getRealRowLength(row: HTMLTableRowElement): number {
// start at -1 since the colspans will sum to 1 index greater than the total
return Array.from(row.cells).reduce((count, cell) => count + cell.colSpan, -1);
}
/**
* Finds a cell and it's real index given an array of cells, a target index, and the spanning direction
*
* @param cells An array of cells to search
* @param targetIndex The index we think the cell is located at
* @param spanDirection The direction of the cell spans. Should be `"colSpan"` for a row and `"rowSpan"` for a column
*/
protected findCell(cells: HTMLTableCellElement[], targetIndex: number, spanDirection: TableDomSpanDirection) {
// rows/cols can have fewer total cells than the actual table
// the model pretends all rows/cols behave the same (with col/row spans > 1 being N cells long)
// this maps that view to the HTML view (col/row spans > 1 are one element, so the array is shorter)
let realIndex = 0;
// i is only used for iterating the cells
for (let i = 0; i < targetIndex;) {
// skip the next N cells
i += cells[realIndex][spanDirection];
// don't bump realIndex if i now exceeds the cell we're shooting for
if (i > targetIndex) { break; }
// finally, increment realIndex (to keep it generally in step with i)
realIndex++;
}
return {
cell: cells[realIndex],
realIndex
};
}
/**
* Helper method around `findCell`, searches based on a row of cells
*
* @param row the row of elements to search
* @param index the index of the element
*/
protected findCellInRow(row: HTMLTableCellElement[], index: number) {
return this.findCell(row, index, TableDomSpanDirection.colSpan);
}
/**
* Helper method around `findCell`, searches based on a column of cells
*
* @param col the column of elements to search
* @param index the index of the element
*/
protected findCellInColumn(col: HTMLTableCellElement[], index: number) {
return this.findCell(col, index, TableDomSpanDirection.rowSpan);
}
}
</code></pre>
</div>
</div>
</div><div class="search-results">
<div class="has-results">
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
<ul class="search-results-list"></ul>
</div>
<div class="no-results">
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
</div>
</div>
</div>
<!-- END CONTENT -->
</div>
</div>
<label class="dark-mode-switch">
<input type="checkbox">
<span class="slider">
<svg class="slider-icon" viewBox="0 0 24 24" fill="none" height="20" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" width="20" xmlns="http://www.w3.org/2000/svg">
<path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
</svg>
</span>
</label>
<script>
var COMPODOC_CURRENT_PAGE_DEPTH = 1;
var COMPODOC_CURRENT_PAGE_CONTEXT = 'class';
var COMPODOC_CURRENT_PAGE_URL = 'TableAdapter.html';
var MAX_SEARCH_RESULTS = 15;
</script>
<script>
$darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input');
checkToggle(darkModeState);
if ($darkModeToggleSwitchers.length > 0) {
for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
$darkModeToggleSwitchers[i].addEventListener('change', function (event) {
darkModeState = !darkModeState;
toggleDarkMode(darkModeState);
});
}
}
</script>
<script src="../js/libs/custom-elements.min.js"></script>
<script src="../js/libs/lit-html.js"></script>
<script src="../js/menu-wc.js" defer></script>
<script nomodule src="../js/menu-wc_es5.js" defer></script>
<script src="../js/libs/bootstrap-native.js"></script>
<script src="../js/libs/es6-shim.min.js"></script>
<script src="../js/libs/EventDispatcher.js"></script>
<script src="../js/libs/promise.min.js"></script>
<script src="../js/libs/zepto.min.js"></script>
<script src="../js/compodoc.js"></script>
<script src="../js/tabs.js"></script>
<script src="../js/menu.js"></script>
<script src="../js/libs/clipboard.min.js"></script>
<script src="../js/libs/prism.js"></script>
<script src="../js/sourceCode.js"></script>
<script src="../js/search/search.js"></script>
<script src="../js/search/lunr.min.js"></script>
<script src="../js/search/search-lunr.js"></script>
<script src="../js/search/search_index.js"></script>
<script src="../js/lazy-load-graphs.js"></script>
<footer class="carbon">
<dds-footer-container key="footer" disable-locale-button="true" size="micro" />
</footer>
<script
key="8"
type="module"
src="https://1.www.s81c.com/common/carbon-for-ibm-dotcom/tag/v1/latest/footer.min.js">
</script>
<!-- Storybook override -->
<script>
document.title = "Carbon Components Angular";
</script>
<script
src="//1.www.s81c.com/common/stats/ibm-common.js"
type="text/javascript"
async="async">
</script>
</body>
</html>