feat(18-01): money list column, danger record actions, preview Edit rule and table kit (task 2)
- columns.yaml type: money with currency or currencyFrom (exactly one), never searchable, not sortable by default; every list row carries the currencyFrom column's value under its own key; the schema serves currency and currencyFrom on the column - pact.AdminRecordAction.Danger, served as danger on cabana.RecordAction (absent when false); RecordActions.vue passes it to the confirm dialog - CellValue money kind through formatMoney with the row's code, the em dash when empty and the amount alone without a code; DataTable aligns money headers and cells to the right - PreviewView renders Edit only when a registered value field allows update (F6) - main.css .summer-table* and .summer-stat__note kit classes (F7) over --c-* variables; cabana README kit rows - fixture record actions void (danger) and resend; TestMoneyListCompile, TestMoneyListSmoke and TestRecordActionDangerSmoke; regenerated OpenAPI and TS types; rebuilt dist; lists-and-filters and admin-controllers docs
This commit is contained in:
@@ -172,10 +172,16 @@ function statesOf(row: AdminRecord): string[] {
|
||||
function cellClass(column: ListColumn, columnIndex: number, states: string[] = []): string {
|
||||
// A deleted or disabled row mutes every cell; the first keeps weight 600.
|
||||
const muted = states.includes('deleted') || states.includes('disabled')
|
||||
const align = alignClass(column)
|
||||
if (columnIndex === 0) {
|
||||
return muted ? 'font-semibold text-muted' : 'font-semibold'
|
||||
return [muted ? 'font-semibold text-muted' : 'font-semibold', align].filter(Boolean).join(' ')
|
||||
}
|
||||
return muted || relation.value || column.relation ? 'text-muted' : ''
|
||||
return [muted || relation.value || column.relation ? 'text-muted' : '', align].filter(Boolean).join(' ')
|
||||
}
|
||||
|
||||
/** A money column aligns its header and cells to the right (UI-SPEC F1). */
|
||||
function alignClass(column: ListColumn): string {
|
||||
return column.type === 'money' ? 'text-right' : ''
|
||||
}
|
||||
|
||||
/** First-cell text of a row with states: struck through, danger or muted. */
|
||||
@@ -228,7 +234,7 @@ const widths = ['w-3/5', 'w-2/5', 'w-1/2', 'w-3/4', 'w-1/3', 'w-2/3', 'w-1/2', '
|
||||
:key="column.key"
|
||||
scope="col"
|
||||
:aria-sort="canSort(column) ? (sortState(column) ?? 'none') : undefined"
|
||||
:class="sortState(column) ? 'text-text' : 'text-muted'"
|
||||
:class="[sortState(column) ? 'text-text' : 'text-muted', alignClass(column)]"
|
||||
class="px-3.5 text-[12px] font-semibold first:pl-5 last:pr-5"
|
||||
>
|
||||
<button
|
||||
@@ -313,23 +319,23 @@ const widths = ['w-3/5', 'w-2/5', 'w-1/2', 'w-3/4', 'w-1/3', 'w-2/3', 'w-1/2', '
|
||||
class="min-w-0 truncate text-left font-semibold text-text"
|
||||
@click="openFrom($event, row)"
|
||||
>
|
||||
<CellValue :column="column" :value="row[column.key]" />
|
||||
<CellValue :column="column" :value="row[column.key]" :row="row" />
|
||||
</button>
|
||||
<CellValue v-else :column="column" :value="row[column.key]" />
|
||||
<CellValue v-else :column="column" :value="row[column.key]" :row="row" />
|
||||
</span>
|
||||
<span v-else-if="columnIndex === 0 && statesOf(row).length > 0" class="flex items-center gap-2">
|
||||
<RouterLink v-if="linkOf(row)" :to="linkOf(row)!" :class="stateTextClass(statesOf(row))">
|
||||
<CellValue :column="column" :value="row[column.key]" />
|
||||
<CellValue :column="column" :value="row[column.key]" :row="row" />
|
||||
</RouterLink>
|
||||
<span v-else :class="stateTextClass(statesOf(row))">
|
||||
<CellValue :column="column" :value="row[column.key]" />
|
||||
<CellValue :column="column" :value="row[column.key]" :row="row" />
|
||||
</span>
|
||||
<RowStateBadges :states="statesOf(row)" :labels="stateLabels" />
|
||||
</span>
|
||||
<RouterLink v-else-if="columnIndex === 0 && linkOf(row)" :to="linkOf(row)!" class="text-text no-underline">
|
||||
<CellValue :column="column" :value="row[column.key]" />
|
||||
<CellValue :column="column" :value="row[column.key]" :row="row" />
|
||||
</RouterLink>
|
||||
<CellValue v-else :column="column" :value="row[column.key]" />
|
||||
<CellValue v-else :column="column" :value="row[column.key]" :row="row" />
|
||||
</td>
|
||||
<td v-if="trailing" data-trailing class="w-[56px] pr-5">
|
||||
<slot name="trailing" :row="row" />
|
||||
|
||||
Reference in New Issue
Block a user