Sha256: 7db21fb0583746b50ac1380d59366ebfbe05820feec0fe0310ce89711ea657a9

Contents?: true

Size: 1.01 KB

Versions: 415

Compression:

Stored size: 1.01 KB

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
      let headers: string[] = [];
      [].forEach.call(table.querySelectorAll('th'), (header: HTMLTableCellElement) => {
        let colSpan = header.colSpan
        for (let i = 0; i < colSpan; i++) {
          headers.push(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

415 entries across 415 versions & 1 rubygems

Version Path
playbook_ui-13.31.0.pre.alpha.PBNTR342navtabbing3230 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-13.32.0 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-13.31.0.pre.alpha.powercentrainplaybookpt23212 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-13.31.0.pre.alpha.PLAY882formpillprimaryandneutral3201 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-13.31.0.pre.alpha.play1262iconstyles3172 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-13.31.0.pre.alpha.play1262iconstyles3171 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-13.31.0 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-13.30.0.pre.alpha.play1367contenttagnoninputkits3159 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-13.30.0.pre.alpha.20240515remotebuildkitconversion3150 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-13.30.0.pre.alpha.PBNTR353draggablev53136 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-13.30.0.pre.alpha.PLAY1328fixtimelinekitglobalpropsreact3096 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-13.30.0 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-13.29.0.pre.alpha.removeduplicatekitexampleclass3063 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-13.29.0.pre.alpha.PBNTR329draggablev33060 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-13.29.0.pre.alpha.PBNTR329draggablev33059 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-13.29.0.pre.alpha.testingcollapsibleissue3052 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-13.29.0 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-13.28.0.pre.alpha.PBNTR297gradientoverlay3029 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-13.28.0.pre.alpha.pbntr312tableheaderflexremoval3019 app/pb_kits/playbook/pb_table/index.ts
playbook_ui-13.28.0.pre.alpha.dialogturbostreameventlistener3017 app/pb_kits/playbook/pb_table/index.ts