filament-google-maps
filament-google-maps copied to clipboard
MapField autocomplete() does not work inside Builder Blocks
Description:
When a Geocomplete
is used to autocomplete a MapField
inside of a Block
when using a Builder
field, the autocomplete feature does not work.
It does however work as regular fields, and inside of a Repeater
field, it only breaks when inside a Builder
.
Reproducible Code:
<?php
namespace App\Filament\Resources;
use Cheesegrits\FilamentGoogleMaps\Fields\Geocomplete;
use Cheesegrits\FilamentGoogleMaps\Fields\Map as MapField;
use Filament\Forms\Components\Builder;
use Filament\Forms\Components\Builder\Block;
use Filament\Forms\Components\Repeater;
use Filament\Resources\Form;
use Filament\Resources\Resource;
class ExampleResource extends Resource
{
public static function form(Form $form): Form
{
return $form
->schema([
// This works
Geocomplete::make('location'),
MapField::make('map')
->autocomplete('location')
->mapControls([
'mapTypeControl' => true,
'scaleControl' => true,
'zoomControl' => true,
])
->draggable()
->clickable(true)
->label('Map'),
// This also works
Repeater::make('locations_repeater')->schema([
Geocomplete::make('location'),
MapField::make('map')
->autocomplete('location')
->mapControls([
'mapTypeControl' => true,
'scaleControl' => true,
'zoomControl' => true,
])
->draggable()
->clickable(true)
->label('Map'),
]),
// This does not.
// When you type an address in the Geocomplete field and select it,
// the MapField does not update to the selected address/location.
Builder::make('locations_builder')->blocks([
Block::make('location_block')
->schema([
Geocomplete::make('location'),
MapField::make('map')
->autocomplete('location')
->mapControls([
'mapTypeControl' => true,
'scaleControl' => true,
'zoomControl' => true,
])
->draggable()
->clickable(true)
->label('Map'),
]),
]),
]);
}
}
Versions:
Note, I also tested it on filament-google-maps version v1.0.23, and the same problem occurred.
Generated with composer show -i | grep filament
Package | Version |
---|---|
cheesegrits/filament-google-maps | v2.0.0-alpha6 |
filament/filament | v2.17.43 |
filament/forms | v2.17.43 |
filament/notifications | v2.17.43 |
filament/support | v2.17.43 |
filament/tables | v2.17.43 |