mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
filament/widgets
This commit is contained in:
@@ -75,3 +75,23 @@ formComponents.forEach((component) => {
|
||||
})
|
||||
.catch(() => process.exit(1))
|
||||
})
|
||||
|
||||
esbuild
|
||||
.build({
|
||||
define: {
|
||||
'process.env.NODE_ENV': shouldWatch
|
||||
? `'production'`
|
||||
: `'development'`,
|
||||
},
|
||||
entryPoints: [
|
||||
`packages/widgets/resources/js/components/chart.js`,
|
||||
],
|
||||
outfile: `packages/widgets/dist/components/chart.js`,
|
||||
bundle: true,
|
||||
platform: 'neutral',
|
||||
mainFields: ['module', 'main'],
|
||||
watch: shouldWatch,
|
||||
minifySyntax: true,
|
||||
minifyWhitespace: true,
|
||||
})
|
||||
.catch(() => process.exit(1))
|
||||
|
||||
@@ -7,6 +7,8 @@ use Filament\Notifications\NotificationsServiceProvider;
|
||||
use Filament\SpatieLaravelTranslatablePluginServiceProvider;
|
||||
use Filament\Support\SupportServiceProvider;
|
||||
use Filament\Tables\TablesServiceProvider;
|
||||
use Filament\Tests\App\Navigation\NavigationServiceProvider;
|
||||
use Filament\Widgets\WidgetsServiceProvider;
|
||||
use Livewire\LivewireServiceProvider;
|
||||
use Orchestra\Testbench\Concerns\CreatesApplication;
|
||||
use Orchestra\Testbench\Foundation\Application;
|
||||
@@ -26,9 +28,11 @@ $app->register(LivewireServiceProvider::class);
|
||||
$app->register(FilamentServiceProvider::class);
|
||||
$app->register(ActionsServiceProvider::class);
|
||||
$app->register(FormsServiceProvider::class);
|
||||
$app->register(NavigationServiceProvider::class);
|
||||
$app->register(NotificationsServiceProvider::class);
|
||||
$app->register(SpatieLaravelTranslatablePluginServiceProvider::class);
|
||||
$app->register(SupportServiceProvider::class);
|
||||
$app->register(TablesServiceProvider::class);
|
||||
$app->register(WidgetsServiceProvider::class);
|
||||
|
||||
return $app;
|
||||
|
||||
Generated
+47
-46
@@ -127,16 +127,16 @@
|
||||
},
|
||||
{
|
||||
"name": "aws/aws-sdk-php",
|
||||
"version": "3.239.0",
|
||||
"version": "3.239.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/aws/aws-sdk-php.git",
|
||||
"reference": "33ae76381b77a1a2580817996dcc7b9e931ae5f4"
|
||||
"reference": "47aa3e427371af4449cd9cb07af7209376a535bb"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/33ae76381b77a1a2580817996dcc7b9e931ae5f4",
|
||||
"reference": "33ae76381b77a1a2580817996dcc7b9e931ae5f4",
|
||||
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/47aa3e427371af4449cd9cb07af7209376a535bb",
|
||||
"reference": "47aa3e427371af4449cd9cb07af7209376a535bb",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -215,9 +215,9 @@
|
||||
"support": {
|
||||
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
|
||||
"issues": "https://github.com/aws/aws-sdk-php/issues",
|
||||
"source": "https://github.com/aws/aws-sdk-php/tree/3.239.0"
|
||||
"source": "https://github.com/aws/aws-sdk-php/tree/3.239.1"
|
||||
},
|
||||
"time": "2022-10-18T18:17:00+00:00"
|
||||
"time": "2022-10-19T18:15:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "blade-ui-kit/blade-heroicons",
|
||||
@@ -1129,23 +1129,23 @@
|
||||
},
|
||||
{
|
||||
"name": "doctrine/inflector",
|
||||
"version": "2.0.5",
|
||||
"version": "2.0.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/doctrine/inflector.git",
|
||||
"reference": "ade2b3bbfb776f27f0558e26eed43b5d9fe1b392"
|
||||
"reference": "d9d313a36c872fd6ee06d9a6cbcf713eaa40f024"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/doctrine/inflector/zipball/ade2b3bbfb776f27f0558e26eed43b5d9fe1b392",
|
||||
"reference": "ade2b3bbfb776f27f0558e26eed43b5d9fe1b392",
|
||||
"url": "https://api.github.com/repos/doctrine/inflector/zipball/d9d313a36c872fd6ee06d9a6cbcf713eaa40f024",
|
||||
"reference": "d9d313a36c872fd6ee06d9a6cbcf713eaa40f024",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"doctrine/coding-standard": "^9",
|
||||
"doctrine/coding-standard": "^10",
|
||||
"phpstan/phpstan": "^1.8",
|
||||
"phpstan/phpstan-phpunit": "^1.1",
|
||||
"phpstan/phpstan-strict-rules": "^1.3",
|
||||
@@ -1200,7 +1200,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/doctrine/inflector/issues",
|
||||
"source": "https://github.com/doctrine/inflector/tree/2.0.5"
|
||||
"source": "https://github.com/doctrine/inflector/tree/2.0.6"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -1216,7 +1216,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-09-07T09:01:28+00:00"
|
||||
"time": "2022-10-20T09:10:12+00:00"
|
||||
},
|
||||
{
|
||||
"name": "doctrine/instantiator",
|
||||
@@ -1566,9 +1566,10 @@
|
||||
"dist": {
|
||||
"type": "path",
|
||||
"url": "packages/support",
|
||||
"reference": "3d4f0e5264799aed43db14b28538062b69d6777e"
|
||||
"reference": "4b871dceb7074da10b4ce0bd82978f05e8e6b1e6"
|
||||
},
|
||||
"require": {
|
||||
"blade-ui-kit/blade-icons": "^1.4",
|
||||
"illuminate/contracts": "^9.0",
|
||||
"illuminate/support": "^9.0",
|
||||
"illuminate/view": "^9.0",
|
||||
@@ -2336,16 +2337,16 @@
|
||||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v9.36.2",
|
||||
"version": "v9.36.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/framework.git",
|
||||
"reference": "0bcd350eec1974c9f912f129368587ef7e43722b"
|
||||
"reference": "80ba0561b3682b96743e1c152fde0698bbdb2412"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/0bcd350eec1974c9f912f129368587ef7e43722b",
|
||||
"reference": "0bcd350eec1974c9f912f129368587ef7e43722b",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/80ba0561b3682b96743e1c152fde0698bbdb2412",
|
||||
"reference": "80ba0561b3682b96743e1c152fde0698bbdb2412",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2434,7 +2435,7 @@
|
||||
"league/flysystem-read-only": "^3.3",
|
||||
"league/flysystem-sftp-v3": "^3.0",
|
||||
"mockery/mockery": "^1.5.1",
|
||||
"orchestra/testbench-core": "^7.8",
|
||||
"orchestra/testbench-core": "^7.11",
|
||||
"pda/pheanstalk": "^4.0",
|
||||
"phpstan/phpstan": "^1.4.7",
|
||||
"phpunit/phpunit": "^9.5.8",
|
||||
@@ -2518,7 +2519,7 @@
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2022-10-18T18:46:20+00:00"
|
||||
"time": "2022-10-19T13:23:53+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/pint",
|
||||
@@ -2836,16 +2837,16 @@
|
||||
},
|
||||
{
|
||||
"name": "league/flysystem",
|
||||
"version": "3.8.0",
|
||||
"version": "3.9.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/flysystem.git",
|
||||
"reference": "3d2ed6215e096e900662bd8f993fc5ad81cc4135"
|
||||
"reference": "60f3760352fe08e918bc3b1acae4e91af092ebe1"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/3d2ed6215e096e900662bd8f993fc5ad81cc4135",
|
||||
"reference": "3d2ed6215e096e900662bd8f993fc5ad81cc4135",
|
||||
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/60f3760352fe08e918bc3b1acae4e91af092ebe1",
|
||||
"reference": "60f3760352fe08e918bc3b1acae4e91af092ebe1",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2907,7 +2908,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/thephpleague/flysystem/issues",
|
||||
"source": "https://github.com/thephpleague/flysystem/tree/3.8.0"
|
||||
"source": "https://github.com/thephpleague/flysystem/tree/3.9.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -2923,7 +2924,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-10-18T06:54:34+00:00"
|
||||
"time": "2022-10-18T21:02:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "league/flysystem-aws-s3-v3",
|
||||
@@ -4336,23 +4337,23 @@
|
||||
},
|
||||
{
|
||||
"name": "orchestra/testbench",
|
||||
"version": "v7.10.2",
|
||||
"version": "v7.11.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/orchestral/testbench.git",
|
||||
"reference": "713f811ebba7524eb5891ac102a3f270578e078a"
|
||||
"reference": "64a5ef91760ab62acdd4adb10ebb1e1ad68e9311"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/orchestral/testbench/zipball/713f811ebba7524eb5891ac102a3f270578e078a",
|
||||
"reference": "713f811ebba7524eb5891ac102a3f270578e078a",
|
||||
"url": "https://api.github.com/repos/orchestral/testbench/zipball/64a5ef91760ab62acdd4adb10ebb1e1ad68e9311",
|
||||
"reference": "64a5ef91760ab62acdd4adb10ebb1e1ad68e9311",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"fakerphp/faker": "^1.9.2",
|
||||
"laravel/framework": "^9.34",
|
||||
"laravel/framework": "^9.36",
|
||||
"mockery/mockery": "^1.5.1",
|
||||
"orchestra/testbench-core": "^7.10.2",
|
||||
"orchestra/testbench-core": "^7.11",
|
||||
"php": "^8.0",
|
||||
"phpunit/phpunit": "^9.5.10",
|
||||
"spatie/laravel-ray": "^1.28",
|
||||
@@ -4389,7 +4390,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/orchestral/testbench/issues",
|
||||
"source": "https://github.com/orchestral/testbench/tree/v7.10.2"
|
||||
"source": "https://github.com/orchestral/testbench/tree/v7.11.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -4401,20 +4402,20 @@
|
||||
"type": "liberapay"
|
||||
}
|
||||
],
|
||||
"time": "2022-10-14T11:29:27+00:00"
|
||||
"time": "2022-10-19T11:54:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "orchestra/testbench-core",
|
||||
"version": "v7.10.2",
|
||||
"version": "v7.11.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/orchestral/testbench-core.git",
|
||||
"reference": "ef1c1bfe5f05f96151a5bd9a9ccd7c10650bc5d1"
|
||||
"reference": "7b67c9e23e9eb6e3e3b336f9ba3afe99072795e2"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/orchestral/testbench-core/zipball/ef1c1bfe5f05f96151a5bd9a9ccd7c10650bc5d1",
|
||||
"reference": "ef1c1bfe5f05f96151a5bd9a9ccd7c10650bc5d1",
|
||||
"url": "https://api.github.com/repos/orchestral/testbench-core/zipball/7b67c9e23e9eb6e3e3b336f9ba3afe99072795e2",
|
||||
"reference": "7b67c9e23e9eb6e3e3b336f9ba3afe99072795e2",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -4422,7 +4423,7 @@
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.9.2",
|
||||
"laravel/framework": "^9.34",
|
||||
"laravel/framework": "^9.36",
|
||||
"laravel/laravel": "9.x-dev",
|
||||
"laravel/pint": "^1.1",
|
||||
"mockery/mockery": "^1.5.1",
|
||||
@@ -4496,7 +4497,7 @@
|
||||
"type": "liberapay"
|
||||
}
|
||||
],
|
||||
"time": "2022-10-14T11:20:52+00:00"
|
||||
"time": "2022-10-19T11:47:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "pestphp/pest",
|
||||
@@ -5232,16 +5233,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpdoc-parser",
|
||||
"version": "1.11.0",
|
||||
"version": "1.12.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpdoc-parser.git",
|
||||
"reference": "7d1e81213b0c7eb8d5a9f524456cbc2778ed5c65"
|
||||
"reference": "5f13698464773fa6f5392a9e311f81e23e9c3ba7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/7d1e81213b0c7eb8d5a9f524456cbc2778ed5c65",
|
||||
"reference": "7d1e81213b0c7eb8d5a9f524456cbc2778ed5c65",
|
||||
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/5f13698464773fa6f5392a9e311f81e23e9c3ba7",
|
||||
"reference": "5f13698464773fa6f5392a9e311f81e23e9c3ba7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -5271,9 +5272,9 @@
|
||||
"description": "PHPDoc parser with support for nullable, intersection and generic types",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
|
||||
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.11.0"
|
||||
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.12.0"
|
||||
},
|
||||
"time": "2022-10-14T13:32:28+00:00"
|
||||
"time": "2022-10-20T07:49:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"php": "^8.0",
|
||||
"blade-ui-kit/blade-heroicons": "^2.0",
|
||||
"filament/support": "self.version",
|
||||
"illuminate/contracts": "^9.0",
|
||||
"illuminate/database": "^9.0",
|
||||
"illuminate/support": "^9.0",
|
||||
"livewire/livewire": "^2.10.7",
|
||||
"spatie/laravel-package-tools": "^1.9"
|
||||
},
|
||||
|
||||
@@ -12,9 +12,11 @@
|
||||
"danharrin/livewire-rate-limiting": "^0.3|^1.0",
|
||||
"filament/actions": "self.version",
|
||||
"filament/forms": "self.version",
|
||||
"filament/navigation": "self.version",
|
||||
"filament/notifications": "self.version",
|
||||
"filament/support": "self.version",
|
||||
"filament/tables": "self.version",
|
||||
"filament/widgets": "self.version",
|
||||
"illuminate/auth": "^9.0",
|
||||
"illuminate/console": "^9.0",
|
||||
"illuminate/contracts": "^9.0",
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+6
-20
File diff suppressed because one or more lines are too long
@@ -1,4 +1,3 @@
|
||||
import Chart from 'chart.js/auto'
|
||||
import Collapse from '@alpinejs/collapse'
|
||||
import Focus from '@alpinejs/focus'
|
||||
import Mousetrap from '@danharrin/alpine-mousetrap'
|
||||
@@ -63,8 +62,3 @@ document.addEventListener('alpine:init', () => {
|
||||
window.Alpine.store('theme', event.matches ? 'dark' : 'light')
|
||||
})
|
||||
})
|
||||
|
||||
Chart.defaults.font.family = `'DM Sans', sans-serif`
|
||||
Chart.defaults.color = '#6b7280'
|
||||
|
||||
window.Chart = Chart
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
@endif
|
||||
|
||||
@if ($headerWidgets = $this->getHeaderWidgets())
|
||||
<x-filament::widgets
|
||||
<x-filament-widgets::widgets
|
||||
:widgets="$headerWidgets"
|
||||
:columns="$this->getHeaderWidgetsColumns()"
|
||||
:data="$widgetData"
|
||||
@@ -25,7 +25,7 @@
|
||||
{{ $slot }}
|
||||
|
||||
@if ($footerWidgets = $this->getFooterWidgets())
|
||||
<x-filament::widgets
|
||||
<x-filament-widgets::widgets
|
||||
:widgets="$footerWidgets"
|
||||
:columns="$this->getFooterWidgetsColumns()"
|
||||
:data="$widgetData"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<x-filament::page class="filament-dashboard-page">
|
||||
<x-filament::widgets
|
||||
<x-filament-widgets::widgets
|
||||
:widgets="$this->getWidgets()"
|
||||
:columns="$this->getColumns()"
|
||||
/>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<x-filament::widget class="filament-account-widget">
|
||||
<x-filament::card>
|
||||
<x-filament-widgets::widget class="filament-account-widget">
|
||||
<x-filament-widgets::card>
|
||||
@php
|
||||
$user = \Filament\Facades\Filament::auth()->user();
|
||||
@endphp
|
||||
@@ -27,5 +27,5 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</x-filament::card>
|
||||
</x-filament::widget>
|
||||
</x-filament-widgets::card>
|
||||
</x-filament-widgets::widget>
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
@php
|
||||
$heading = $this->getHeading();
|
||||
$filters = $this->getFilters();
|
||||
@endphp
|
||||
|
||||
<x-filament::widget class="filament-widgets-chart-widget">
|
||||
<x-filament::card>
|
||||
@if ($heading || $filters)
|
||||
<div class="flex items-center justify-between gap-8">
|
||||
@if ($heading)
|
||||
<x-filament::card.heading>
|
||||
{{ $heading }}
|
||||
</x-filament::card.heading>
|
||||
@endif
|
||||
|
||||
@if ($filters)
|
||||
<select
|
||||
wire:model="filter"
|
||||
@class([
|
||||
'text-gray-900 border-gray-300 block h-10 transition duration-75 rounded-lg shadow-sm focus:border-primary-500 focus:ring-1 focus:ring-inset focus:ring-primary-500',
|
||||
'dark:bg-gray-700 dark:border-gray-600 dark:text-gray-200 dark:focus:border-primary-500' => config('filament.dark_mode'),
|
||||
])
|
||||
wire:loading.class="animate-pulse"
|
||||
>
|
||||
@foreach ($filters as $value => $label)
|
||||
<option value="{{ $value }}">
|
||||
{{ $label }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<x-filament::hr />
|
||||
@endif
|
||||
|
||||
<div {!! ($pollingInterval = $this->getPollingInterval()) ? "wire:poll.{$pollingInterval}=\"updateChartData\"" : '' !!}>
|
||||
<canvas
|
||||
x-data="{
|
||||
chart: null,
|
||||
|
||||
init: function () {
|
||||
let chart = this.initChart()
|
||||
|
||||
$wire.on('updateChartData', async ({ data }) => {
|
||||
chart.data = this.applyColorToData(data)
|
||||
chart.update('resize')
|
||||
})
|
||||
|
||||
$wire.on('filterChartData', async ({ data }) => {
|
||||
chart.destroy()
|
||||
chart = this.initChart(data)
|
||||
})
|
||||
},
|
||||
|
||||
initChart: function (data = null) {
|
||||
data = data ?? {{ json_encode($this->getCachedData()) }}
|
||||
|
||||
return this.chart = new Chart($el, {
|
||||
type: '{{ $this->getType() }}',
|
||||
data: this.applyColorToData(data),
|
||||
options: {{ json_encode($this->getOptions()) }} ?? {},
|
||||
})
|
||||
},
|
||||
|
||||
applyColorToData: function (data) {
|
||||
data.datasets.forEach((dataset, datasetIndex) => {
|
||||
if (! dataset.backgroundColor) {
|
||||
data.datasets[datasetIndex].backgroundColor = getComputedStyle($refs.backgroundColorElement).color
|
||||
}
|
||||
|
||||
if (! dataset.borderColor) {
|
||||
data.datasets[datasetIndex].borderColor = getComputedStyle($refs.borderColorElement).color
|
||||
}
|
||||
})
|
||||
|
||||
return data
|
||||
},
|
||||
}"
|
||||
wire:ignore
|
||||
@if ($maxHeight = $this->getMaxHeight())
|
||||
style="max-height: {{ $maxHeight }}"
|
||||
@endif
|
||||
>
|
||||
<span
|
||||
x-ref="backgroundColorElement"
|
||||
@class([
|
||||
'text-gray-50',
|
||||
'dark:text-gray-300' => config('filament.dark_mode'),
|
||||
])
|
||||
></span>
|
||||
|
||||
<span
|
||||
x-ref="borderColorElement"
|
||||
@class([
|
||||
'text-gray-500',
|
||||
'dark:text-gray-200' => config('filament.dark_mode'),
|
||||
])
|
||||
></span>
|
||||
</canvas>
|
||||
</div>
|
||||
</x-filament::card>
|
||||
</x-filament::widget>
|
||||
@@ -1,5 +1,5 @@
|
||||
<x-filament::widget class="filament-filament-info-widget">
|
||||
<x-filament::card class="relative">
|
||||
<x-filament-widgets::widget class="filament-filament-info-widget">
|
||||
<x-filament-widgets::card class="relative">
|
||||
<div class="relative h-12 flex flex-col justify-center items-center space-y-2">
|
||||
<div class="space-y-1">
|
||||
<a
|
||||
@@ -100,5 +100,5 @@
|
||||
<path d="m712 2047-32-24 23-21c31-29 33-28 47 14 16 49 2 60-38 31z"/>
|
||||
</g>
|
||||
</svg>
|
||||
</x-filament::card>
|
||||
</x-filament::widget>
|
||||
</x-filament-widgets::card>
|
||||
</x-filament-widgets::widget>
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
<x-filament::widget class="filament-widgets-table-widget">
|
||||
{{ $this->table }}
|
||||
</x-filament::widget>
|
||||
@@ -268,7 +268,6 @@ class FilamentServiceProvider extends PluginServiceProvider
|
||||
Commands\MakeRelationManagerCommand::class,
|
||||
Commands\MakeResourceCommand::class,
|
||||
Commands\MakeUserCommand::class,
|
||||
Commands\MakeWidgetCommand::class,
|
||||
];
|
||||
|
||||
$aliases = [];
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<x-filament::widget>
|
||||
<x-filament::card>
|
||||
{{-- Widget content --}}
|
||||
</x-filament::card>
|
||||
</x-filament::widget>
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "filament/navigation",
|
||||
"description": "Effortlessly build TALL-powered navigation menus.",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/filamentphp/filament",
|
||||
"support": {
|
||||
"issues": "https://github.com/filamentphp/filament/issues",
|
||||
"source": "https://github.com/filamentphp/filament"
|
||||
},
|
||||
"require": {
|
||||
"php": "^8.0",
|
||||
"blade-ui-kit/blade-heroicons": "^2.0",
|
||||
"filament/support": "self.version",
|
||||
"livewire/livewire": "^2.10.7",
|
||||
"spatie/laravel-package-tools": "^1.9"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Filament\\Navigation\\": "src"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Filament\\Navigation\\NavigationServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Navigation;
|
||||
|
||||
use Filament\Support\PluginServiceProvider;
|
||||
|
||||
class NavigationServiceProvider extends PluginServiceProvider
|
||||
{
|
||||
public static string $name = 'filament-navigation';
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "filament/widgets",
|
||||
"description": "Effortlessly build TALL-powered dashboard widgets.",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/filamentphp/filament",
|
||||
"support": {
|
||||
"issues": "https://github.com/filamentphp/filament/issues",
|
||||
"source": "https://github.com/filamentphp/filament"
|
||||
},
|
||||
"require": {
|
||||
"php": "^8.0",
|
||||
"blade-ui-kit/blade-heroicons": "^2.0",
|
||||
"filament/support": "self.version",
|
||||
"livewire/livewire": "^2.10.7",
|
||||
"spatie/laravel-package-tools": "^1.9"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Filament\\Widgets\\": "src"
|
||||
}
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Filament\\Widgets\\WidgetsServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true
|
||||
}
|
||||
+15
File diff suppressed because one or more lines are too long
@@ -0,0 +1,50 @@
|
||||
import Chart from 'chart.js/auto'
|
||||
|
||||
Chart.defaults.font.family = `'DM Sans', sans-serif`
|
||||
Chart.defaults.color = '#6b7280'
|
||||
|
||||
export default function chart({
|
||||
cachedData,
|
||||
options,
|
||||
type,
|
||||
}) {
|
||||
return {
|
||||
chart: null,
|
||||
|
||||
init: function () {
|
||||
let chart = this.initChart()
|
||||
|
||||
this.$wire.on('updateChartData', async ({ data }) => {
|
||||
chart.data = this.applyColorToData(data)
|
||||
chart.update('resize')
|
||||
})
|
||||
|
||||
this.$wire.on('filterChartData', async ({ data }) => {
|
||||
chart.destroy()
|
||||
chart = this.initChart(data)
|
||||
})
|
||||
},
|
||||
|
||||
initChart: function (data = null) {
|
||||
return this.chart = new Chart(this.$refs.canvas, {
|
||||
type: type,
|
||||
data: this.applyColorToData(data ?? cachedData),
|
||||
options: options ?? {},
|
||||
})
|
||||
},
|
||||
|
||||
applyColorToData: function (data) {
|
||||
data.datasets.forEach((dataset, datasetIndex) => {
|
||||
if (! dataset.backgroundColor) {
|
||||
data.datasets[datasetIndex].backgroundColor = getComputedStyle(this.$refs.backgroundColorElement).color
|
||||
}
|
||||
|
||||
if (! dataset.borderColor) {
|
||||
data.datasets[datasetIndex].borderColor = getComputedStyle(this.$refs.borderColorElement).color
|
||||
}
|
||||
})
|
||||
|
||||
return data
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
@php
|
||||
$heading = $this->getHeading();
|
||||
$filters = $this->getFilters();
|
||||
@endphp
|
||||
|
||||
<x-filament-widgets::widget class="filament-widgets-chart-widget">
|
||||
<x-filament-widgets::card>
|
||||
@if ($heading || $filters)
|
||||
<div class="flex items-center justify-between gap-8">
|
||||
@if ($heading)
|
||||
<x-filament-widgets::card.heading>
|
||||
{{ $heading }}
|
||||
</x-filament-widgets::card.heading>
|
||||
@endif
|
||||
|
||||
@if ($filters)
|
||||
<select
|
||||
wire:model="filter"
|
||||
@class([
|
||||
'text-gray-900 border-gray-300 block h-10 transition duration-75 rounded-lg shadow-sm focus:border-primary-500 focus:ring-1 focus:ring-inset focus:ring-primary-500',
|
||||
'dark:bg-gray-700 dark:border-gray-600 dark:text-gray-200 dark:focus:border-primary-500' => config('filament.dark_mode'),
|
||||
])
|
||||
wire:loading.class="animate-pulse"
|
||||
>
|
||||
@foreach ($filters as $value => $label)
|
||||
<option value="{{ $value }}">
|
||||
{{ $label }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<x-filament-widgets::hr />
|
||||
@endif
|
||||
|
||||
<div {!! ($pollingInterval = $this->getPollingInterval()) ? "wire:poll.{$pollingInterval}=\"updateChartData\"" : '' !!}>
|
||||
<div
|
||||
x-ignore
|
||||
ax-load
|
||||
ax-load-src="/js/filament/widgets/components/chart.js"
|
||||
x-data="chart({
|
||||
cachedData: @js($this->getCachedData()),
|
||||
options: @js($this->getOptions()),
|
||||
type: @js($this->getType()),
|
||||
})"
|
||||
wire:ignore
|
||||
>
|
||||
<canvas
|
||||
x-ref="canvas"
|
||||
@if ($maxHeight = $this->getMaxHeight())
|
||||
style="max-height: {{ $maxHeight }}"
|
||||
@endif
|
||||
></canvas>
|
||||
|
||||
<span
|
||||
x-ref="backgroundColorElement"
|
||||
class="text-gray-50 dark:text-gray-300"
|
||||
></span>
|
||||
|
||||
<span
|
||||
x-ref="borderColorElement"
|
||||
class="text-gray-500 dark:text-gray-200"
|
||||
></span>
|
||||
</div>
|
||||
</div>
|
||||
</x-filament-widgets::card>
|
||||
</x-filament-widgets::widget>
|
||||
@@ -0,0 +1,3 @@
|
||||
<h2 {{ $attributes->class(['text-xl font-semibold tracking-tight filament-card-heading']) }}>
|
||||
{{ $slot }}
|
||||
</h2>
|
||||
@@ -0,0 +1,53 @@
|
||||
@props([
|
||||
'actions' => null,
|
||||
'footer' => null,
|
||||
'header' => null,
|
||||
'heading' => null,
|
||||
])
|
||||
|
||||
<div {{ $attributes->class([
|
||||
'p-2 space-y-2 bg-white rounded-xl shadow',
|
||||
'dark:border-gray-600 dark:bg-gray-800' => config('filament.dark_mode'),
|
||||
]) }}>
|
||||
@if ($actions || $header || $heading)
|
||||
<div class="px-4 py-2">
|
||||
@if ($header)
|
||||
{{ $header }}
|
||||
@elseif ($actions || $heading)
|
||||
<div class="flex flex-col gap-4 xl:flex-row xl:items-center xl:justify-between">
|
||||
<x-filament-widgets::card.heading>
|
||||
{{ $heading }}
|
||||
</x-filament-widgets::card.heading>
|
||||
|
||||
@if ($actions)
|
||||
<div class="flex items-center space-x-2 rtl:space-x-reverse">
|
||||
{{ $actions }}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if (($actions || $header || $heading) && $slot->isNotEmpty())
|
||||
<x-filament-widgets::hr />
|
||||
@endif
|
||||
|
||||
<div class="space-y-2">
|
||||
@if ($slot->isNotEmpty())
|
||||
<div class="px-4 py-2 space-y-4">
|
||||
{{ $slot }}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@if ($footer && $slot->isNotEmpty())
|
||||
<x-filament-widgets::hr />
|
||||
@endif
|
||||
|
||||
@if ($footer)
|
||||
<div class="px-4 py-2">
|
||||
{{ $footer }}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@@ -0,0 +1,4 @@
|
||||
<x-filament-support::hr
|
||||
:attributes="\Filament\Support\prepare_inherited_attributes($attributes)"
|
||||
:dark-mode="config('filament.dark_mode')"
|
||||
/>
|
||||
+4
-4
@@ -1,9 +1,9 @@
|
||||
<x-filament::widget class="filament-stats-overview-widget">
|
||||
<x-filament-widgets::widget class="filament-stats-overview-widget">
|
||||
<div {!! ($pollingInterval = $this->getPollingInterval()) ? "wire:poll.{$pollingInterval}" : '' !!}>
|
||||
<x-filament::stats :columns="$this->getColumns()">
|
||||
<x-filament-widgets::stats :columns="$this->getColumns()">
|
||||
@foreach ($this->getCachedCards() as $card)
|
||||
{{ $card }}
|
||||
@endforeach
|
||||
</x-filament::stats>
|
||||
</x-filament-widgets::stats>
|
||||
</div>
|
||||
</x-filament::widget>
|
||||
</x-filament-widgets::widget>
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
$url = $getUrl();
|
||||
@endphp
|
||||
|
||||
<x-filament::stats.card
|
||||
<x-filament-widgets::stats.card
|
||||
:tag="$url ? 'a' : 'div'"
|
||||
:chart="$getChart()"
|
||||
:chart-color="$getChartColor()"
|
||||
@@ -0,0 +1,3 @@
|
||||
<x-filament-widgets::widget class="filament-widgets-table-widget">
|
||||
{{ $this->table }}
|
||||
</x-filament-widgets::widget>
|
||||
@@ -18,7 +18,7 @@ class ChartWidget extends Widget
|
||||
|
||||
protected static ?array $options = null;
|
||||
|
||||
protected static string $view = 'filament::widgets.chart-widget';
|
||||
protected static string $view = 'filament-widgets::chart-widget';
|
||||
|
||||
public function mount()
|
||||
{
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Commands\Aliases;
|
||||
namespace Filament\Widgets\Commands\Aliases;
|
||||
|
||||
use Filament\Commands;
|
||||
use Filament\Widgets\Commands;
|
||||
|
||||
class MakeWidgetCommand extends Commands\MakeWidgetCommand
|
||||
{
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Commands;
|
||||
namespace Filament\Widgets\Commands;
|
||||
|
||||
use Filament\Support\Commands\Concerns\CanManipulateFiles;
|
||||
use Filament\Support\Commands\Concerns\CanValidateInput;
|
||||
+1
-1
@@ -10,7 +10,7 @@ class StatsOverviewWidget extends Widget
|
||||
|
||||
protected int | string | array $columnSpan = 'full';
|
||||
|
||||
protected static string $view = 'filament::widgets.stats-overview-widget';
|
||||
protected static string $view = 'filament-widgets::stats-overview-widget';
|
||||
|
||||
protected function getColumns(): int
|
||||
{
|
||||
+1
-1
@@ -210,6 +210,6 @@ class Card extends Component implements Htmlable
|
||||
|
||||
public function render(): View
|
||||
{
|
||||
return view('filament::widgets.stats-overview-widget.card', $this->data());
|
||||
return view('filament-widgets::stats-overview-widget.card', $this->data());
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ class TableWidget extends Widget implements Tables\Contracts\HasTable
|
||||
makeTable as makeBaseTable;
|
||||
}
|
||||
|
||||
protected static string $view = 'filament::widgets.table-widget';
|
||||
protected static string $view = 'filament-widgets::table-widget';
|
||||
|
||||
/**
|
||||
* @deprecated Override the `table()` method to configure the table.
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Filament\Widgets;
|
||||
|
||||
use Filament\Support\Assets\AlpineComponent;
|
||||
use Filament\Support\PluginServiceProvider;
|
||||
|
||||
class WidgetsServiceProvider extends PluginServiceProvider
|
||||
{
|
||||
public static string $name = 'filament-widgets';
|
||||
|
||||
protected function getAssetPackage(): ?string
|
||||
{
|
||||
return 'widgets';
|
||||
}
|
||||
|
||||
protected function getAssets(): array
|
||||
{
|
||||
return [
|
||||
AlpineComponent::make('chart', __DIR__ . '/../dist/components/chart.js'),
|
||||
];
|
||||
}
|
||||
|
||||
protected function getCommands(): array
|
||||
{
|
||||
$commands = [
|
||||
Commands\MakeWidgetCommand::class,
|
||||
];
|
||||
|
||||
$aliases = [];
|
||||
|
||||
foreach ($commands as $command) {
|
||||
$class = 'Filament\\Widgets\\Commands\\Aliases\\' . class_basename($command);
|
||||
|
||||
if (! class_exists($class)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$aliases[] = $class;
|
||||
}
|
||||
|
||||
return array_merge($commands, $aliases);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<x-filament-widgets::widget>
|
||||
<x-filament-widgets::card>
|
||||
{{-- Widget content --}}
|
||||
</x-filament-widgets::card>
|
||||
</x-filament-widgets::widget>
|
||||
Reference in New Issue
Block a user