// Generated, do not edit. sha256:a4f2c112e439e3cff424dfd351eedcec45c341af567633d67ac86c751e1e4999 import { esc } from './escape.js'; export function cellClasses(col) { const classes = []; if (col.align === 'num') classes.push('num'); else if (col.align === 'center') classes.push('center'); if (col.text) classes.push('text'); return classes; } export function cellClassAttr(col) { const classes = cellClasses(col); return classes.length ? ` class="${classes.join(' ')}"` : ''; } export function cellHtml(col, row) { const raw = col.render ? col.render(row) : esc(row[col.key] ?? ''); const content = col.text ? `
${raw}
` : raw; return `${content}`; } export function expCellHtml(hasExpansion, isOpen, chevron) { if (!hasExpansion) return ''; return ``; } export function headRowHtml({ columns, sort, hasExpansion, hasActions }) { const ths = columns.map(col => { const classes = cellClasses(col); const label = esc(col.label || ''); if (!col.sortable) return `${label}`; const active = sort && sort.key === col.key; const arrow = active ? `` : ''; const ariaSort = active ? ` aria-sort="${sort.dir === 'asc' ? 'ascending' : 'descending'}"` : ''; return `${label}${arrow}`; }).join(''); const expTh = hasExpansion ? '' : ''; return `${expTh}${ths}${hasActions ? '' : ''}`; } const PLUS = ''; export function controlsHtml({ cfg, labels, canCreate, groupCols, groupKey, groupKey2, groupKey3, search, editing }) { const dis = editing ? ' disabled' : ''; const newLabel = esc(cfg.newLabel || labels.new); const newBtn = canCreate ? `` : ''; const noteText = typeof cfg.toolbarNote === 'function' ? cfg.toolbarNote() : cfg.toolbarNote; const note = noteText ? `${esc(noteText)}` : ''; const toolbarBtns = (cfg.toolbarActions || []).map(a => a.icon ? `` : ``).join(''); let group = ''; if (groupCols.length && cfg.groupChoice !== false) { const noneText = esc(cfg.noneLabel || labels.none); const aria = ` aria-label="${esc(cfg.groupLabel || cfg.noneLabel || labels.none)}"`; const none = ``; const opt = (c, chosen) => ``; const select = (level, cols, chosen) => ``; group = select(1, groupCols, groupKey); if (groupKey) { group += select(2, groupCols.filter(c => c.key !== groupKey), groupKey2); if (groupKey2) { const cols3 = groupCols.filter(c => c.key !== groupKey && c.key !== groupKey2); if (cols3.length) group += select(3, cols3, groupKey3); } } } const searchText = esc(cfg.searchLabel || labels.search); const searchBox = ``; const filterSlot = groupKey && cfg.groupChoice !== false && cfg.columns.some(c => c.key === groupKey) ? '
' : ''; const countBox = `
${cfg.rows.length}
`; return `
${newBtn}${note}${toolbarBtns}${group}${searchBox}${filterSlot}${countBox}
`; } const sameId = (a, b) => a != null && b != null && String(a) === String(b); export function editActionsHtml({ cfg, labels }) { return `
`; } export function actionsCellHtml({ cfg, labels, row, idKey, isEditRow, editing, selectedId }) { if (isEditRow || editing) return ''; const id = row[idKey]; if (!sameId(id, selectedId)) return ''; const eid = esc(id); const extra = (cfg.extraActions || []).map(a => ``).join(''); const edit = (cfg.onSave && (!cfg.rowEditable || cfg.rowEditable(row))) ? `` : ''; const del = (cfg.onDelete && (!cfg.rowDeletable || cfg.rowDeletable(row))) ? `` : ''; return `
${extra}${edit}${del}
`; } export function groupHeaderRowHtml({ token, label, count, summaryHtml = '', isCollapsed = false, collapsible, colCount, chevron }) { const chev = collapsible ? `` : ''; const attrs = collapsible ? ` data-gcollapse="${esc(token)}" role="button" tabindex="0"` : ''; const sum = summaryHtml ? `${summaryHtml}` : ''; return `
${chev}${esc(label)}${count}${sum}
`; } export function frameHtml({ controls, head, body, hasExpansion, title = '' }) { const wrapClasses = hasExpansion ? ' sticky-sel has-exp' : ''; const titleHtml = title ? `
${esc(title)}
` : ''; return `
${titleHtml}${controls}
${head}${body}
`; }