mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-12-02 17:13:33 +01:00
fix(viewers): summary row as the table's last row, identifiers left out
The CSV summary row read as a floating card: rounded, a repeated "Avg" label in every cell, distinct counts under text columns and an average of the seed column. - The footer follows the column grid: square edges, a 2px top rule and the header's solid fill. It stays at the bottom of the scroll area, which no longer has vertical padding, so no rows show past it; a short table ends on it. - One "Average" select in the first column (or the row-number column) sets the aggregate for every numeric column. Cells show only the value, right-aligned, semibold. A column can override it from its menu, marked by a small label in its cell. - Text, date and identifier columns are empty in the footer; their distinct counts stay in the column menu. - Identifiers (seed, id, run, fold, index, year by name, or small consecutive whole numbers that repeat) are left out of the summary, group averages and default charts. "Treat as number" in the column menu brings one back (#table:num=seed). - Markdown and notebook tables get the same footer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
43e92bef53
commit
4fc3a8b2df
11 files changed
+231
-148
No files matched your search
@@ -110,12 +110,12 @@
|
||||
</tr></thead>
|
||||
<tbody v-if="sorted.length" v-html="bodyHtml"></tbody>
|
||||
<tbody v-else><tr class="dt-empty-row"><td :colspan="table.columns.length + (groupColumn ? 0 : 1)">No rows match. <button type="button" class="dt-link" @click="clearFilters()">Clear the filters</button></td></tr></tbody>
|
||||
<tfoot v-if="sorted.length">
|
||||
<tfoot v-if="sorted.length && hasSummary">
|
||||
<tr class="dt-summary">
|
||||
<td class="csv-rownum" v-if="!groupColumn"><span aria-hidden="true">Σ</span><span class="sr-only">Summary</span></td>
|
||||
<td v-for="(c, ci) in table.columns" :key="c.index" :class="{ 'is-num': c.type === 'number' }">
|
||||
<span class="dt-sum" v-if="summary[ci].kind === 'number'"><label class="dt-sum-fn"><span class="sr-only">Summary of {{ c.name }}</span><select :value="summary[ci].fn" @change="setSum(c, $event.target.value)"><option v-for="[fn, text] in AGGREGATES" :key="fn" :value="fn">{{ text }}</option></select><span class="dt-sum-fn-label" aria-hidden="true">{{ aggregateShort(summary[ci].fn) }}</span></label><b class="dt-sum-value">{{ summary[ci].text }}</b></span>
|
||||
<span class="dt-sum is-text" v-else>{{ summary[ci].text }}</span>
|
||||
<td class="csv-rownum" v-if="!groupColumn"><label class="dt-row-fn" v-if="!sumInFirst"><span class="sr-only">Summary row</span><select :value="s.sum" @change="setRowSum($event.target.value)"><option v-for="[fn, text] in AGGREGATES" :key="fn" :value="fn">{{ text }}</option></select><svg class="ui-icon dt-caret" aria-hidden="true"><use href="#ui-icon-chevron-down"></use></svg></label></td>
|
||||
<td v-for="(c, ci) in table.columns" :key="c.index" :class="{ 'is-num': summary[ci].kind === 'number' }">
|
||||
<label class="dt-row-fn" v-if="ci === 0 && sumInFirst"><span class="sr-only">Summary row</span><select :value="s.sum" @change="setRowSum($event.target.value)"><option v-for="[fn, text] in AGGREGATES" :key="fn" :value="fn">{{ text }}</option></select><svg class="ui-icon dt-caret" aria-hidden="true"><use href="#ui-icon-chevron-down"></use></svg></label>
|
||||
<template v-else-if="summary[ci].kind === 'number'"><span class="dt-sum-own" v-if="sumOverride(c)" :title="AGGREGATE_LABEL[sumOverride(c)] + ' (set in the column menu)'">{{ aggregateShort(sumOverride(c)) }}</span>{{ summary[ci].text }}</template>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
@@ -135,6 +135,14 @@
|
||||
<figcaption><span>{{ menuStats.histFrom }}</span><span>{{ menuStats.histTo }}</span></figcaption>
|
||||
</figure>
|
||||
<ul class="dt-top" v-if="menuStats.top && menuStats.top.length"><li v-for="t in menuStats.top" :key="t.value"><span class="dt-top-name"><template v-for="(seg, si) in redactParts(t.value)" :key="si"><span v-if="seg.n" class="redact-slot" role="img" :aria-label="'Redacted term ' + seg.n"><i>{{ seg.n }}</i></span><template v-else>{{ seg.t }}</template></template></span><span class="dt-top-bar" :style="{ width: Math.max(4, t.share) + '%' }"></span><span class="dt-top-n">{{ t.count }}</span></li></ul>
|
||||
<div class="dt-menu-sec dt-menu-row" v-if="isMeasure(menuColumn)">
|
||||
<span class="dt-menu-label">Summary row</span>
|
||||
<label class="dt-select"><span class="sr-only">Summary of {{ menuColumn.name }}</span><select :value="s.sums[menuColumn.name] || s.sum" @change="setSum(menuColumn, $event.target.value)"><option v-for="[fn, text] in AGGREGATES" :key="fn" :value="fn">{{ text }}{{ fn === s.sum ? ' (row)' : '' }}</option></select><svg class="ui-icon dt-caret" aria-hidden="true"><use href="#ui-icon-chevron-down"></use></svg></label>
|
||||
</div>
|
||||
<div class="dt-menu-sec" v-if="!groupColumn && menuColumn.identifier">
|
||||
<button type="button" class="dt-menu-action" role="switch" :aria-checked="isMeasure(menuColumn) ? 'true' : 'false'" @click="treatAsNumber(menuColumn, !isMeasure(menuColumn))"><svg class="ui-icon" aria-hidden="true"><use :href="isMeasure(menuColumn) ? '#ui-icon-check' : '#ui-icon-list'"></use></svg>{{ isMeasure(menuColumn) ? 'Treated as a number · undo' : 'Treat as number' }}</button>
|
||||
<p class="dt-menu-hint" v-if="!isMeasure(menuColumn)">Looks like an identifier, so it is left out of the summary row and group averages.</p>
|
||||
</div>
|
||||
<div class="dt-menu-sec">
|
||||
<div class="seg-filter dt-menu-sort" role="group" aria-label="Sort">
|
||||
<button type="button" class="seg-chip" :class="{ active: sortState(menuColumn) === 'asc' }" @click="setSort(menuColumn, sortState(menuColumn) === 'asc' ? null : 'asc')">{{ menuColumn.type === 'text' ? 'A → Z' : 'Low → high' }}</button>
|
||||
|
||||
Reference in new issue
Block a user