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:
@@ -1166,6 +1166,20 @@ func projectRowCtx(ctx context.Context, row any, controller pact.AdminController
|
||||
}
|
||||
out[col.Key] = field.Interface()
|
||||
}
|
||||
// A money column's currencyFrom value rides along under its own key even
|
||||
// when it is not a declared column, so the admin formats each row's
|
||||
// amount with that row's code (D-07).
|
||||
for _, col := range cols {
|
||||
if col.CurrencyFrom == "" {
|
||||
continue
|
||||
}
|
||||
if _, present := out[col.CurrencyFrom]; present {
|
||||
continue
|
||||
}
|
||||
if code := fieldByColumn(v, col.CurrencyFrom); code.IsValid() && code.CanInterface() {
|
||||
out[col.CurrencyFrom] = code.Interface()
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user