Sha256: 2c529b8f11e6ec3f182c75233495765d630186f7c8eb4238fd1c9c5cb3072928

Contents?: true

Size: 895 Bytes

Versions: 20

Compression:

Stored size: 895 Bytes

Contents

import PbEnhancedElement from '../pb_enhanced_element'

export default class PbTable extends PbEnhancedElement {
  static get selector() {
    return '.table-responsive-collapse'
  }

  connect() {
    const tables = document.querySelectorAll('.table-responsive-collapse');

    // Each Table
    [].forEach.call(tables, (table: HTMLTableElement) => {
      // Header Titles
      var headers = [].map.call(table.querySelectorAll('th'), (header: Element) => {
        return header.textContent.replace(/\r?\n|\r/, '')
      });

      // for each row in tbody
      [].forEach.call(table.querySelectorAll('tbody tr'), (row: HTMLTableRowElement) => {
        // for each cell
        [].forEach.call(row.cells, (cell: HTMLTableCellElement, headerIndex: number) => {
          // apply the attribute
          cell.setAttribute('data-title', headers[headerIndex])
        })
      })
    })
  }
}

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
playbook_ui-12.18.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown629 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-12.18.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown628 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-12.18.0.pre.alpha.play786multilevelselectimprovements627 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-12.18.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown626 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-12.18.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown617 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-12.18.0.pre.alpha.play786multilevelselectimprovements613 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-12.18.0.pre.alpha.PLAY747carddarktokens610 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-12.18.0.pre.alpha.PLAY785typeaheadts608 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-12.18.0.pre.alpha.PLAY785typeaheadts607 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-12.18.0 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-12.17.1 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-12.17.0.pre.alpha.lightboxcurrentPhotoIndex582 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-12.17.0 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-12.16.0.pre.alpha.tooltippositionprop566 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-12.16.0.pre.alpha.PLAY693tooltipwrongbg558 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-12.16.0.pre.alpha.PLAY693tooltipwrongbg547 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-12.16.0.pre.alpha.PLAY693tooltipwrongbg532 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-12.16.0.pre.alpha.lightboxcurrentphotoprop531 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-12.16.0.pre.alpha.tiptaptestingpart1528 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-12.16.0 app/pb_kits/playbook/pb_table/index.ts