Zeige den Inhalt eingeklappter Abschnitte beim Gestalten und beschleunige die Abschnittsköpfe
- „Abschnitt gestalten“ an einem eingeklappten Abschnitt zeigte nichts: Der Inhalt des gestalteten Abschnitts liegt im Kontext jetzt immer offen; der Zustand „eingeklappt“ bleibt erhalten. - Die Beschriftung von Abschnitt und Platz las Filaments verdichteten Zustand des ganzen Eintrags (alle Felder aller Widgets, je Anfrage und Eintrag). Sie liest jetzt den Rohzustand des Repeaters. Bei 30 Abschnitten sinkt die Serverzeit je Anfrage um etwa die Hälfte. Anzeige unverändert. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
882e041e74
commit
9818c7f61b
6 files changed
+95
-2
No files matched your search
@@ -44,7 +44,7 @@ public static function repeater(string $name = 'sections'): Repeater
|
||||
->hiddenLabel()
|
||||
->schema(self::sectionSchema())
|
||||
->columns(['default' => 1, 'xl' => 2])
|
||||
->itemLabel(fn (array $state, ?int $index): HtmlString => self::sectionLabel($state, $index))
|
||||
->itemLabel(fn (Repeater $component, string $key, ?int $index): HtmlString => self::sectionLabel(self::rawItem($component, $key), $index))
|
||||
->addActionLabel('Abschnitt hinzufügen')
|
||||
->addBetweenActionLabel('Abschnitt hier einfügen')
|
||||
->defaultItems(0)
|
||||
@@ -170,7 +170,7 @@ private static function sectionSchema(): array
|
||||
->reorderableWithDragAndDrop()
|
||||
->reorderableWithButtons(false)
|
||||
->reorderAction(fn (Action $action): Action => $action->label('Baustein auf einen anderen Platz ziehen')->tooltip('Baustein auf einen anderen Platz ziehen'))
|
||||
->itemLabel(fn (array $state, ?int $index, Get $get): HtmlString => self::slotLabel($state, $index, $get('layout')))
|
||||
->itemLabel(fn (Repeater $component, string $key, ?int $index, Get $get): HtmlString => self::slotLabel(self::rawItem($component, $key), $index, $get('layout')))
|
||||
->default(fn (): array => self::arrangeSlots([], SectionLayouts::DEFAULT))
|
||||
->extraAttributes(function (Get $get): array {
|
||||
// Die eingestellte Hintergrundfarbe steht schon im Seitenaufbau hinter den Plätzen (nur bei eigener Fläche).
|
||||
@@ -761,6 +761,20 @@ private static function editorColumns(mixed $layout): string
|
||||
return implode(' ', array_map(fn (int $unit): string => "minmax(0, {$unit}fr)", $units));
|
||||
}
|
||||
|
||||
/**
|
||||
* Zustand eines Eintrags aus dem Rohzustand des Repeaters. Filaments `$state` im Beschriftungsausdruck verdichtet den
|
||||
* ganzen Eintrag samt aller Felder der Widgets (je Abschnitt und Platz einmal je Anfrage); die Beschriftung braucht
|
||||
* nur Werte, die schon im Rohzustand stehen.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private static function rawItem(Repeater $component, string $key): array
|
||||
{
|
||||
$state = $component->getRawState();
|
||||
|
||||
return is_array($state) && is_array($state[$key] ?? null) ? $state[$key] : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<string, mixed> $state
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user