Skip to content

Commit

Permalink
Merge pull request #6379 from getkirby/fix/section-table-columns
Browse files Browse the repository at this point in the history
Fix table column regressions
  • Loading branch information
bastianallgeier authored Apr 10, 2024
2 parents 281da3e + 7b5f3cf commit 9389848
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
11 changes: 7 additions & 4 deletions config/sections/mixins/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,15 @@
$form = Form::for($model)->values();

foreach ($this->columns as $columnName => $column) {
// don't overwrite columns
$item[$columnName] ??= match (empty($column['value'])) {
$item[$columnName] = match (empty($column['value'])) {
// if column value defined, resolve the query
false => $model->toString($column['value']),
// otherwise use the form value
default => $form[$column['id'] ?? $columnName] ?? null,
// otherwise use the form value,
// but don't overwrite columns
default =>
$item[$columnName] ??
$form[$column['id'] ?? $columnName] ??
null,
};
}

Expand Down
1 change: 1 addition & 0 deletions panel/src/components/Layout/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
<!-- Cell -->
<k-table-cell
v-for="(column, columnIndex) in columns"
:id="columnIndex"
:key="rowIndex + '-' + columnIndex"
:column="column"
:field="fields[columnIndex]"
Expand Down
8 changes: 7 additions & 1 deletion panel/src/components/Layout/TableCell.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<template>
<td :data-align="column.align" :data-mobile="mobile" class="k-table-cell">
<td
:data-align="column.align"
:data-column-id="id"
:data-mobile="mobile"
class="k-table-cell"
>
<!-- Table cell type component -->
<component
:is="component"
Expand All @@ -25,6 +30,7 @@ export default {
* Optional corresponding field options
*/
field: Object,
id: String,
/**
* Keep cell on mobile
*/
Expand Down

0 comments on commit 9389848

Please sign in to comment.