Skip to content

Commit 5c3fdae

Browse files
committed
Update Repeater to exclusively use tableMode
1 parent a37e651 commit 5c3fdae

File tree

1 file changed

+6
-25
lines changed

1 file changed

+6
-25
lines changed

src/Fields/Repeater.php

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ public static function getDefaultConfig(): array
5454
'form' => [],
5555
'tableMode' => false,
5656
'tableColumns' => [],
57-
'table' => false,
5857
'compact' => false,
5958
];
6059
}
@@ -79,6 +78,7 @@ public static function make(string $name, ?Field $field = null): Input
7978
$input = $input->compact();
8079
}
8180

81+
8282
if ($isReorderableWithButtons) {
8383
$input = $input->reorderableWithButtons();
8484
}
@@ -114,19 +114,13 @@ public static function make(string $name, ?Field $field = null): Input
114114
if ($field && $field->children->count() > 0) {
115115
$input = $input->schema(self::generateSchemaFromChildren($field->children));
116116

117-
// Apply table mode if enabled (HEAD strategy)
117+
// Apply table mode if enabled
118118
if ($field->config['tableMode'] ?? self::getDefaultConfig()['tableMode']) {
119119
$tableColumns = self::generateTableColumnsFromChildren($field->children, $field->config['tableColumns'] ?? []);
120120
if (! empty($tableColumns)) {
121121
$input = $input->table($tableColumns);
122122
}
123123
}
124-
// Apply table if enabled (MAIN strategy)
125-
elseif ($field->config['table'] ?? self::getDefaultConfig()['table']) {
126-
$input = $input
127-
->table(self::generateTableColumns($field->children))
128-
->schema(self::generateSchemaFromChildren($field->children, false));
129-
}
130124
}
131125

132126
return $input;
@@ -171,15 +165,13 @@ public function getForm(): array
171165
->default(1)
172166
->numeric()
173167
->visible(fn (Get $get): bool => ! ($get('config.tableMode') ?? false)),
174-
Forms\Components\Toggle::make('config.table')
175-
->label(__('Table repeater')),
176-
Forms\Components\Toggle::make('config.compact')
177-
->label(__('Compact table'))
178-
->live()
179-
->visible(fn (Get $get): bool => $get('config.table') === true),
180168
Forms\Components\Toggle::make('config.tableMode')
181169
->label(__('Table Mode'))
182170
->live(),
171+
Forms\Components\Toggle::make('config.compact')
172+
->label(__('Compact table'))
173+
->live()
174+
->visible(fn (Get $get): bool => ($get('config.tableMode') ?? false)),
183175
]),
184176
AdjacencyList::make('config.form')
185177
->columnSpanFull()
@@ -269,18 +261,7 @@ protected function excludeFromBaseSchema(): array
269261
return ['defaultValue'];
270262
}
271263

272-
private static function generateTableColumns(Collection $children): array
273-
{
274-
$columns = [];
275-
276-
$children = $children->sortBy('position');
277264

278-
foreach ($children as $child) {
279-
$columns[] = TableColumn::make($child['slug']);
280-
}
281-
282-
return $columns;
283-
}
284265

285266
private static function generateSchemaFromChildren(Collection $children, bool $isTableMode = false): array
286267
{

0 commit comments

Comments
 (0)