UNPKG

@opentiny/fluent-editor

Version:

A rich text editor based on Quill 2.0, which extends rich modules and formats on the basis of Quill. It's powerful and out-of-the-box.

51 lines (50 loc) 1.63 kB
"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const tableConfig = [ { title: "Number", field: "id", width: "100" }, { title: "Title", field: "subject", width: "200" }, { title: "Priority", field: "priority", width: "100" }, { title: "Iteration", field: "iteration", width: "100" }, { title: "Status", field: "status", width: "100" }, { title: "Conductor", field: "assigned_to", width: "100" } ]; function createTable(data) { const table = document.createElement("table"); createColGroup(table); createTableHead(table); createTableBody(table, data); return table; } function createColGroup(table) { const colGroup = document.createElement("colgroup"); tableConfig.forEach(({ width }) => { const col = document.createElement("col"); col.setAttribute("width", width); colGroup.appendChild(col); }); table.insertAdjacentElement("afterbegin", colGroup); } function createTableHead(table) { const tHead = table.createTHead(); const tRow = tHead.insertRow(); tableConfig.forEach(({ title }) => { const tCell = tRow.insertCell(); tCell.textContent = title; }); return tHead; } function createTableBody(table, data) { const tBody = table.createTBody(); [].forEach.call(data, (d) => { const tRow = tBody.insertRow(); tRow.setAttribute("href", d.url); tableConfig.forEach(({ field }) => { const tCell = tRow.insertCell(); tCell.classList.add(`work-item-${field}`); tCell.textContent = d[field]; }); }); return tBody; } exports.createTable = createTable; //# sourceMappingURL=createTable.cjs.js.map