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:
Jakub Zych
2026-10-13 11:22:36 +02:00
parent 20385e53ee
commit 0c8605123e
29 changed files with 615 additions and 56 deletions

View File

@@ -20,7 +20,7 @@ import (
const listSearchTerm = "search"
var listColumnTypes = map[string]struct{}{
"text": {}, "datetime": {}, "switch": {}, "date": {}, "time": {},
"text": {}, "datetime": {}, "switch": {}, "date": {}, "time": {}, moneyType: {},
}
type listDocument struct {
@@ -68,6 +68,10 @@ type columnDocument struct {
Relation string `yaml:"relation"`
Select string `yaml:"select"`
Invisible bool `yaml:"invisible"`
// Currency and CurrencyFrom are the `type: money` column's currency
// source (D-07), exactly one of them.
Currency string `yaml:"currency"`
CurrencyFrom string `yaml:"currencyFrom"`
}
// CompileListSchema compiles config_list.yaml and the columns.yaml it names.
@@ -267,20 +271,27 @@ func compileColumns(pluginID string, ctl pact.AdminController, fsys fs.FS, colPa
return nil, bootErr(pluginID, ctl.ID(), colPath, fmt.Errorf("column %s is not on the model", key))
}
}
sortable := spec.Relation == ""
if err := checkMoneyColumn(typ, key, spec, ctl); err != nil {
return nil, bootErr(pluginID, ctl.ID(), colPath, fmt.Errorf("column %s: %w", key, err))
}
// A money column is not sortable unless the file says so (PHP:
// sortable: false), and never searchable.
sortable := spec.Relation == "" && typ != moneyType
if spec.Sortable != nil {
sortable = *spec.Sortable
}
compiled = append(compiled, ListColumn{
Key: key,
Label: spec.Label,
Searchable: spec.Searchable,
Sortable: sortable,
Type: typ,
Relation: spec.Relation,
Select: spec.Select,
Invisible: spec.Invisible,
fieldType: pluginType,
Key: key,
Label: spec.Label,
Searchable: spec.Searchable,
Sortable: sortable,
Type: typ,
Relation: spec.Relation,
Select: spec.Select,
Invisible: spec.Invisible,
Currency: spec.Currency,
CurrencyFrom: spec.CurrencyFrom,
fieldType: pluginType,
})
}
return compiled, nil