安裝 Livewire PowerGrid

This commit is contained in:
allen.yan 2025-04-23 10:14:19 +08:00
parent 945185a7e9
commit f5ef3bbc71
7 changed files with 337 additions and 2 deletions

View File

@ -11,6 +11,7 @@
"laravel/tinker": "^2.10.1", "laravel/tinker": "^2.10.1",
"livewire/livewire": "^3.4", "livewire/livewire": "^3.4",
"livewire/volt": "^1.7.0", "livewire/volt": "^1.7.0",
"power-components/livewire-powergrid": "^6.3",
"spatie/laravel-permission": "^6.17", "spatie/laravel-permission": "^6.17",
"wireui/wireui": "^2.4" "wireui/wireui": "^2.4"
}, },

80
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "288b2a039ced0d4d9f18d54dac1710ec", "content-hash": "7fca47874b86a18c0949dbf10c0850ec",
"packages": [ "packages": [
{ {
"name": "brick/math", "name": "brick/math",
@ -2731,6 +2731,84 @@
], ],
"time": "2024-07-20T21:41:07+00:00" "time": "2024-07-20T21:41:07+00:00"
}, },
{
"name": "power-components/livewire-powergrid",
"version": "v6.3.1",
"source": {
"type": "git",
"url": "https://github.com/Power-Components/livewire-powergrid.git",
"reference": "36192c917d7c62930a3099ee1cfe4373d05dfe6e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Power-Components/livewire-powergrid/zipball/36192c917d7c62930a3099ee1cfe4373d05dfe6e",
"reference": "36192c917d7c62930a3099ee1cfe4373d05dfe6e",
"shasum": ""
},
"require": {
"laravel/prompts": "*",
"livewire/livewire": "^3.6.0",
"php": "^8.2"
},
"require-dev": {
"composer/composer": "^2.7.9",
"laradumps/laradumps": "^3.2|^4.0",
"larastan/larastan": "^2.9.8",
"laravel/pint": "1.17",
"laravel/scout": "^10.11.3",
"openspout/openspout": "^4.24.5",
"orchestra/testbench": "^9.4|^10.0",
"pestphp/pest": "^2.35.1|^3.0"
},
"suggest": {
"openspout/openspout": "Required to export XLS and CSV"
},
"type": "library",
"extra": {
"laravel": {
"providers": [
"PowerComponents\\LivewirePowerGrid\\Providers\\PowerGridServiceProvider"
]
}
},
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"PowerComponents\\LivewirePowerGrid\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Luan Freitas",
"email": "luanfreitas10@protonmail.com",
"role": "Developer"
},
{
"name": "DanSysAnalyst",
"email": "daniel@sysanalyst.eu",
"role": "Developer"
}
],
"description": "PowerGrid generates Advanced Datatables using Laravel Livewire.",
"homepage": "https://github.com/power-components/livewire-powergrid",
"support": {
"issues": "https://github.com/Power-Components/livewire-powergrid/issues",
"source": "https://github.com/Power-Components/livewire-powergrid/tree/v6.3.1"
},
"funding": [
{
"url": "https://github.com/luanfreitasdev",
"type": "github"
}
],
"time": "2025-03-30T13:29:33+00:00"
},
{ {
"name": "psr/clock", "name": "psr/clock",
"version": "1.0.0", "version": "1.0.0",

View File

@ -0,0 +1,164 @@
<?php
use Illuminate\Support\Js;
return [
/*
|--------------------------------------------------------------------------
| Theme
|--------------------------------------------------------------------------
|
| PowerGrid supports Tailwind and Bootstrap 5 themes.
| Configure here the theme of your choice.
*/
'theme' => \PowerComponents\LivewirePowerGrid\Themes\Tailwind::class,
// 'theme' => \PowerComponents\LivewirePowerGrid\Themes\DaisyUI::class,
// 'theme' => \PowerComponents\LivewirePowerGrid\Themes\Bootstrap5::class,
'cache_ttl' => null,
'icon_resources' => [
'paths' => [
// 'default' => 'resources/views/components/icons',
// 'outline' => 'vendor/wireui/wireui/resources/views/components/icons/outline',
// 'solid' => 'vendor/wireui/wireui/resources/views/components/icons/solid',
],
'allowed' => [
// 'pencil',
],
'attributes' => ['class' => 'w-5 text-red-600'],
],
/*
|--------------------------------------------------------------------------
| Plugins
|--------------------------------------------------------------------------
|
| Plugins used: flatpickr.js to datepicker.
|
*/
'plugins' => [
/*
* https://flatpickr.js.org
*/
'flatpickr' => [
'locales' => [
'pt_BR' => [
'locale' => 'pt',
'dateFormat' => 'd/m/Y H:i',
'enableTime' => true,
'time_24hr' => true,
],
],
],
'select' => [
'default' => 'tom',
/*
* TomSelect Options
* https://tom-select.js.org
*/
'tom' => [
'plugins' => [
'clear_button' => [
'title' => 'Remove all selected options',
],
],
],
/*
* Slim Select options
* https://slimselectjs.com/
*/
'slim' => [
'settings' => [
'alwaysOpen' => false,
],
],
],
],
/*
|--------------------------------------------------------------------------
| Filters
|--------------------------------------------------------------------------
|
| PowerGrid supports inline and outside filters.
| 'inline': Filters data inside the table.
| 'outside': Filters data outside the table.
| 'null'
|
*/
'filter' => 'inline',
/*
|--------------------------------------------------------------------------
| Filters Attributes
|--------------------------------------------------------------------------
| You can add custom attributes to the filters.
| The key is the filter type and the value is a callback function.
| like: input_text, select, datetime, etc.
| The callback function receives the field and title as parameters.
| The callback function must return an array with the attributes.
*/
'filter_attributes' => [
'input_text' => \PowerComponents\LivewirePowerGrid\FilterAttributes\InputText::class,
'boolean' => \PowerComponents\LivewirePowerGrid\FilterAttributes\Boolean::class,
'number' => \PowerComponents\LivewirePowerGrid\FilterAttributes\Number::class,
'select' => \PowerComponents\LivewirePowerGrid\FilterAttributes\Select::class,
],
/*
|--------------------------------------------------------------------------
| Persisting
|--------------------------------------------------------------------------
|
| PowerGrid supports persisting of the filters, columns and sorting.
| 'session': persist in the session.
| 'cache': persist with cache.
| 'cookies': persist with cookies (default).
|
*/
'persist_driver' => 'cookies',
/*
|--------------------------------------------------------------------------
| Exportable class
|--------------------------------------------------------------------------
|
|
*/
'exportable' => [
'default' => 'openspout_v4',
'openspout_v4' => [
'xlsx' => \PowerComponents\LivewirePowerGrid\Components\Exports\OpenSpout\v4\ExportToXLS::class,
'csv' => \PowerComponents\LivewirePowerGrid\Components\Exports\OpenSpout\v4\ExportToCsv::class,
],
],
/*
|--------------------------------------------------------------------------
| Auto-Discover Models
|--------------------------------------------------------------------------
|
| PowerGrid will search for Models in the directories listed below.
| These Models be listed as options when you run the
| "artisan powergrid:create" command.
|
*/
'auto_discover_models_paths' => [
app_path('Models'),
],
];

View File

@ -1,3 +1,7 @@
/* 引入 PowerGrid 的樣式 */
@import './../../vendor/power-components/livewire-powergrid/dist/tailwind.css';
@tailwind base; @tailwind base;
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;

View File

@ -1 +1,2 @@
import './bootstrap'; import './bootstrap';
import './../../vendor/power-components/livewire-powergrid/dist/powergrid';

View File

@ -0,0 +1,75 @@
<?php
return [
'buttons' => [
'filter' => 'Filter',
'clear_all_filters' => 'Clear all',
],
'labels' => [
'action' => 'Actions',
'results_per_page' => 'Records per page',
'clear_filter' => 'Clear filter',
'no_data' => 'No records found',
'all' => 'All',
'selected' => 'Selected',
'filtered' => 'Filtered',
],
'placeholders' => [
'search' => 'Search...',
'select' => 'Select a period',
],
'pagination' => [
'showing' => 'Showing',
'to' => 'to',
'of' => 'of',
'results' => 'Results',
'all' => 'All',
],
'multi_select' => [
'select' => 'Select',
'all' => 'All',
],
'select' => [
'select' => 'Select',
'all' => 'All',
],
'boolean_filter' => [
'all' => 'All',
],
'input_text_options' => [
'is' => 'Is',
'is_not' => 'Is not',
'contains' => 'Contains',
'contains_not' => 'Does not contain',
'starts_with' => 'Starts with',
'ends_with' => 'Ends with',
'is_empty' => 'Is empty',
'is_not_empty' => 'Is not empty',
'is_null' => 'Is null',
'is_not_null' => 'Is not null',
'is_blank' => 'Is blank',
'is_not_blank' => 'Is not blank',
],
'export' => [
'exporting' => 'Please wait!',
'completed' => 'Export completed! Your files are ready for download',
],
'soft_deletes' => [
'message_with_trashed' => 'Displaying all records, including deleted ones.',
'message_only_trashed' => 'Displaying only deleted records.',
'without_trashed' => 'Without deleted',
'with_trashed' => 'With deleted',
'only_trashed' => 'Only deleted',
],
'multi_sort' => [
'message' => 'Multiple sort is active',
],
'buttons_macros' => [
'confirm' => [
'message' => 'Are you sure you want to perform this action?',
],
'confirm_prompt' => [
'message' => "Are you sure you want to perform this action? \n\n Enter :confirmValue to confirm.",
],
],
];

View File

@ -1,19 +1,28 @@
import defaultTheme from 'tailwindcss/defaultTheme'; import defaultTheme from 'tailwindcss/defaultTheme';
import forms from '@tailwindcss/forms'; import forms from '@tailwindcss/forms';
import colors from 'tailwindcss/colors'; // 需要這行來引入 colors
/** @type {import('tailwindcss').Config} */ /** @type {import('tailwindcss').Config} */
export default { export default {
presets: [ presets: [
require("./vendor/wireui/wireui/tailwind.config.js") require("./vendor/wireui/wireui/tailwind.config.js"),
require("./vendor/power-components/livewire-powergrid/tailwind.config.js"),
], ],
content: [ content: [
'./vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php', './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
'./storage/framework/views/*.php', './storage/framework/views/*.php',
'./resources/views/**/*.blade.php', './resources/views/**/*.blade.php',
// WireUI
"./vendor/wireui/wireui/src/*.php", "./vendor/wireui/wireui/src/*.php",
"./vendor/wireui/wireui/ts/**/*.ts", "./vendor/wireui/wireui/ts/**/*.ts",
"./vendor/wireui/wireui/src/WireUi/**/*.php", "./vendor/wireui/wireui/src/WireUi/**/*.php",
"./vendor/wireui/wireui/src/Components/**/*.php", "./vendor/wireui/wireui/src/Components/**/*.php",
// PowerGrid
'./app/Livewire/**/*Table.php',
'./vendor/power-components/livewire-powergrid/resources/views/**/*.php',
'./vendor/power-components/livewire-powergrid/src/Themes/Tailwind.php',
], ],
theme: { theme: {
@ -21,6 +30,9 @@ export default {
fontFamily: { fontFamily: {
sans: ['Figtree', ...defaultTheme.fontFamily.sans], sans: ['Figtree', ...defaultTheme.fontFamily.sans],
}, },
colors: {
"pg-primary": colors.gray, // 可用 pg-primary-500 之類使用
},
}, },
}, },