Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,26 +94,6 @@ public function setUp(): void

> The `setUp` method is called on `mount` of the widget. See [livewire lifecycle hooks](https://laravel-livewire.com/docs/2.x/lifecycle-hooks) for more information.

### Global Configuration

If you want to set a default configuration for all instances of the map widget, you can use the `configureUsing` method in a service provider:

```php
MyMap::configureUsing(function (ResellerMap $widget) {
$widget->mapMarkers([
Marker::make('id')
->lat(51.505)
->lng(-0.09)
->popup('I am a popup')
->tooltip('I am a tooltip'),
])
->tileLayerUrl('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png')
->tileLayerOptions([
'attribution' => 'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors',
])
});
```

## Tile Layers

The map uses OpenStreetMap tiles by default, but you can change it to use any other provider using `$tileLayerUrl` property or `tileLayerUrl` method. It's recommended to also use the `tileLayerOptions` to set correct attributions.
Expand Down Expand Up @@ -566,24 +546,6 @@ $livewire->addCircle(Circle::make('circle-name')->lat(...)->lng(...)->options([.
$livewire->removeCircle('circle-name');
$livewire->updateCircle(Circle::make('circle-name')->lat(...)->lng(...)->options([...]));
```

### Update Map / Polling

set pollingInterval to anything you like inside your widget:
```php
protected static ?string $pollingInterval = '10s';
```

then inside your widget declare public function named updateMap, and add any logic you wish inside it

```php
public function updateMap(): void
{
// for example this clears markers, you can add markers, polygon ..etc
$this->mapMarkers([]);
}
```

## Images

![Header & Footer](https://raw.githubusercontent.com/webbingbrasil/filament-maps/main/docs/images/image-header-footer.png)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"require": {
"php": "^8.0",
"filament/filament": "^3.0.0",
"filament/filament": "^4.0 || ^5.0",
"spatie/laravel-package-tools": "^1.16"
},
"autoload": {
Expand Down
1 change: 0 additions & 1 deletion resources/views/button-action.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
:action="$action"
:label="$getLabel()"
component="filament-maps::icon-button"
class="filament-page-icon-button-action"
/>
37 changes: 23 additions & 14 deletions resources/views/components/actions/action.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,34 @@
'icon' => null,
])

@php
$isDisabled = $action->isDisabled();
$url = $action->getUrl();
@endphp

<x-dynamic-component
:x-on:click="$action->getAlpineClickHandler()"
:color="$action->getColor()"
:component="$component"
:dark-mode="config('filament.dark_mode')"
:attributes="\Filament\Support\prepare_inherited_attributes($attributes)->merge($action->getExtraAttributes())"
:disabled="$isDisabled"
:form="$action->getFormToSubmit()"
:tag="$action->getUrl() ? 'a' : 'button'"
:wire:click="$action->getLivewireClickHandler()"
:href="$action->isEnabled() ? $action->getUrl() : null"
:target="$action->shouldOpenUrlInNewTab() ? '_blank' : null"
:type="$action->canSubmitForm() ? 'submit' : 'button'"
:color="$action->getColor()"
:key-bindings="$action->getKeybindings()"
:tooltip="$action->getTooltip()"
:disabled="$action->isDisabled()"
:form-id="$action->getFormId()"
:href="$isDisabled ? null : $url"
:icon="$icon ?? $action->getIcon()"
:size="$action->getSize()"
:icon-size="$action->getIconSize()"
:key-bindings="$action->getKeyBindings()"
:label-sr-only="$action->isLabelHidden()"
dusk="filament.admin.action.{{ $action->getName() }}"
:tag="$url ? 'a' : 'button'"
:target="($url && $action->shouldOpenUrlInNewTab()) ? '_blank' : null"
:tooltip="$action->getTooltip()"
:type="$action->canSubmitForm() ? 'submit' : 'button'"
:wire:click="$action->getLivewireClickHandler()"
:wire:target="$action->getLivewireTarget()"
:x-on:click="$action->getAlpineClickHandler()"
:attributes="
\Filament\Support\prepare_inherited_attributes($attributes)
->merge($action->getExtraAttributes(), escape: false)
->class(['fi-ac-action'])
"
>
{{ $slot }}
</x-dynamic-component>
38 changes: 3 additions & 35 deletions resources/views/components/actions/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,35 +1,3 @@
@props([
'actions',
'alignment' => 'left',
'fullWidth' => false,
])

@if ($actions instanceof \Illuminate\Contracts\View\View)
{{ $actions }}
@elseif (is_array($actions))
@php
$actions = array_filter(
$actions,
fn (\Filament\Pages\Actions\Action | \Filament\Pages\Actions\ActionGroup $action): bool => ! $action->isHidden(),
);
@endphp

@if (count($actions))
<div
{{ $attributes->class([
'filament-page-actions',
'flex flex-wrap items-center gap-4' => ! $fullWidth,
match ($alignment) {
'center' => 'justify-center',
'right' => 'flex-row-reverse space-x-reverse',
default => 'justify-start',
} => ! $fullWidth,
'grid gap-2 grid-cols-[repeat(auto-fit,minmax(0,1fr))]' => $fullWidth,
]) }}
>
@foreach ($actions as $action)
{{ $action }}
@endforeach
</div>
@endif
@endif
<x-filament::actions
:attributes="\Filament\Support\prepare_inherited_attributes($attributes)"
/>
5 changes: 5 additions & 0 deletions resources/views/components/card/heading.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h3
{{ $attributes->class(['fi-maps-card-header-heading text-base font-semibold leading-6 text-gray-950 dark:text-white']) }}
>
{{ $slot }}
</h3>
60 changes: 60 additions & 0 deletions resources/views/components/card/index.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
@props([
'hasBorder' => true,
'heading' => null,
'footer' => null,
])

@php
$hasHeading = filled($heading);
$hasHeader = $hasHeading;

$hasFooter = filled($footer);
@endphp

<section class="fi-maps-card flex flex-col h-full overflow-hidden rounded-xl bg-white shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10">
@if ($hasHeader)
<header @class([
'fi-maps-card-header flex flex-col gap-3',
match ($hasBorder) {
true => 'px-4 py-2.5',
false => 'px-6 py-4',
}
])>
<div class="flex items-center gap-3">
@if ($hasHeading)
<div class="grid flex-1 gap-y-1">
@if ($hasHeading)
<x-filament-maps::card.heading>
{{ $heading }}
</x-filament-maps::card.heading>
@endif
</div>
@endif
</div>
</header>
@endif

<div
@class([
'fi-maps-card-content flex-1',
match ($hasBorder) {
true => 'p-6',
false => '',
},
])
>
{{ $slot }}
</div>

@if ($hasFooter)
<footer @class([
'fi-maps-card-footer border-t border-gray-200 dark:border-white/10',
match ($hasBorder) {
true => 'px-4 py-2.5',
false => 'px-6 py-4',
}
])>
{{ $footer }}
</footer>
@endif
</section>
Loading