Skip to content

Commit

Permalink
Merge branch '3.x' into custom-schema
Browse files Browse the repository at this point in the history
  • Loading branch information
atmonshi committed Jun 10, 2024
2 parents 2ead25b + 7e9a70a commit 5e2fc50
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

All notable changes to `Bolt` will be documented in this file

## v3.0.52 - 2024-06-09

### What's Changed

* fix clone field to set the HTML ID by @atmonshi in https://github.com/lara-zeus/bolt/pull/302

**Full Changelog**: https://github.com/lara-zeus/bolt/compare/v3.0.51...v3.0.52

## v3.0.51 - 2024-06-07

### What's Changed
Expand Down Expand Up @@ -418,7 +426,6 @@ and you can remove the fork for `alperenersoy/filament-export`
**Full Changelog**: https://github.com/lara-zeus/bolt/compare/v2.1.28...v2.1.29
## v2.1.28 - 2023-12-14
### What's Changed

* Update doc and css by @atmonshi in https://github.com/lara-zeus/bolt/pull/218

**Full Changelog**: https://github.com/lara-zeus/bolt/compare/v2.1.27...v2.1.28
Expand Down
17 changes: 17 additions & 0 deletions src/Concerns/Schemata.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Filament\Facades\Filament;
use Filament\Forms\Components\Actions\Action;
use Filament\Forms\Components\Component;
use Filament\Forms\Components\DateTimePicker;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Grid;
Expand Down Expand Up @@ -366,6 +367,22 @@ public static function getSectionsSchema(): array
->orderColumn('ordering')
->cloneable()
->minItems(1)

->cloneAction(fn (Action $action) => $action->action(function (Component $component) {
$items = $component->getState();
$originalItem = end($items);
$clonedItem = array_merge($originalItem, [
'name' => $originalItem['name'] . ' new',
'options' => [
'htmlId' => $originalItem['options']['htmlId'] . Str::random(2),
],
]);

$items[] = $clonedItem;
$component->state($items);

return $items;
}))
->collapsible()
->collapsed(fn (string $operation) => $operation === 'edit')
->grid([
Expand Down

0 comments on commit 5e2fc50

Please sign in to comment.