diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index c8a66b07..9fa43b71 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -58,3 +58,6 @@ jobs: - name: Pint run: composer test:pint + + - name: LaraDumps Check debug + run: composer ds:check diff --git a/.github/workflows/mysql.yml b/.github/workflows/mysql.yml index a5bbea2a..d943c069 100644 --- a/.github/workflows/mysql.yml +++ b/.github/workflows/mysql.yml @@ -1,17 +1,7 @@ name: MySQL on: - push: - branches: - - "**" - paths-ignore: - - "art/**" - - "README.md" - pull_request: - types: [ready_for_review, synchronize, opened] - paths-ignore: - - "art/**" - - "README.md" + workflow_dispatch: jobs: build: diff --git a/.github/workflows/pgsql.yml b/.github/workflows/pgsql.yml index 0cf98624..27711e5c 100644 --- a/.github/workflows/pgsql.yml +++ b/.github/workflows/pgsql.yml @@ -1,17 +1,7 @@ name: PostGreSQL on: - push: - branches: - - "**" - paths-ignore: - - "art/**" - - "README.md" - pull_request: - types: [ready_for_review, synchronize, opened] - paths-ignore: - - "art/**" - - "README.md" + workflow_dispatch: jobs: build: diff --git a/composer.json b/composer.json index dedb3acf..fbd99a58 100644 --- a/composer.json +++ b/composer.json @@ -19,12 +19,12 @@ ], "require": { "php": "^8.1", - "livewire/livewire": "^3.3.5", + "livewire/livewire": "^3.4.3", "laravel/prompts": "^0.1.15" }, "require-dev": { "composer/composer": "^2.6.6", - "laravel/pint": "^1.13.8", + "laravel/pint": "^1.13.10", "laradumps/laradumps-core": "^1.1", "larastan/larastan": "^2.8.1", "pestphp/pest": "2.28.0", @@ -81,7 +81,11 @@ "@test:mysql", "@test:pgsql" ], + "ds:check": [ + "@php vendor/bin/laradumps check --dir=src,resources,tests --text=dump,dd --ignore=dumpTo,Dump stop-on-failure" + ], "verify": [ + "@ds:check", "@test:pint", "@test:types", "@test" diff --git a/package.json b/package.json index 77985789..86f0874c 100644 --- a/package.json +++ b/package.json @@ -22,19 +22,19 @@ }, "homepage": "https://github.com/Power-Components/livewire-powergrid#readme", "dependencies": { - "alpinejs": "^3.12.2", + "alpinejs": "^3.13.5", "laravel-mix": "^6.0.49", - "tom-select": "^2.2.2" + "tom-select": "^2.3.1" }, "devDependencies": { - "autoprefixer": "^10.4.14", - "blade-formatter": "^1.37.1", - "cypress": "^13.3.0", + "autoprefixer": "^10.4.17", + "blade-formatter": "^1.38.6", + "cypress": "^13.6.3", "flatpickr": "^4.6.13", - "postcss": "^8.4.31", + "postcss": "^8.4.33", "resolve-url-loader": "^5.0.0", - "sass": "^1.66.1", - "sass-loader": "^13.3.2", - "tailwindcss": "^3.3.1" + "sass": "^1.70.0", + "sass-loader": "^14.0.0", + "tailwindcss": "^3.4.1" } } diff --git a/resources/views/components/frameworks/bootstrap5/filters/boolean.blade.php b/resources/views/components/frameworks/bootstrap5/filters/boolean.blade.php index c4ddb0ad..a7152721 100644 --- a/resources/views/components/frameworks/bootstrap5/filters/boolean.blade.php +++ b/resources/views/components/frameworks/bootstrap5/filters/boolean.blade.php @@ -5,10 +5,14 @@ 'filter' => null, ]) @php - unset($filter['className']); - extract($filter); + $fieldClassName = data_get($filter, 'className'); + $field = data_get($filter, 'field'); + $title = data_get($column, 'title'); - $defaultAttributes = \PowerComponents\LivewirePowerGrid\Components\Filters\FilterBoolean::getWireAttributes($field, $title); + $trueLabel = data_get($filter, 'trueLabel'); + $falseLabel = data_get($filter, 'falseLabel'); + + $defaultAttributes = $fieldClassName::getWireAttributes($field, $title); $selectClasses = Arr::toCssClasses([data_get($theme, 'selectClass'), data_get($column, 'headerClass'), 'power_grid']); diff --git a/resources/views/components/frameworks/bootstrap5/filters/date-picker.blade.php b/resources/views/components/frameworks/bootstrap5/filters/date-picker.blade.php index 5bb61c91..eaf1818d 100644 --- a/resources/views/components/frameworks/bootstrap5/filters/date-picker.blade.php +++ b/resources/views/components/frameworks/bootstrap5/filters/date-picker.blade.php @@ -7,8 +7,9 @@ 'type' => 'datetime', ]) @php - unset($filter['className']); - extract($filter); + $params = data_get($filter, 'params'); + $field = data_get($filter, 'field'); + $title = data_get($column, 'title'); $customConfig = []; if ($params) { @@ -38,11 +39,11 @@ class="{{ data_get($theme, 'baseClass') }}" >
@php + $fieldClassName = data_get($filter, 'className'); + $field = strval(data_get($filter, 'field')); - $title = strval(data_get($filter, 'title')); + $title = strval(data_get($column, 'title')); $operators = (array) data_get($filter, 'operators', []); $placeholder = strval(data_get($filter, 'placeholder')); $componentAttributes = (array) data_get($filter, 'attributes', []); diff --git a/resources/views/components/frameworks/bootstrap5/filters/number.blade.php b/resources/views/components/frameworks/bootstrap5/filters/number.blade.php index 9a393c3e..b7515b0c 100644 --- a/resources/views/components/frameworks/bootstrap5/filters/number.blade.php +++ b/resources/views/components/frameworks/bootstrap5/filters/number.blade.php @@ -6,10 +6,12 @@ ]) @php - extract($filter); - unset($filter['className']); + $fieldClassName = data_get($filter, 'className'); + $field = data_get($filter, 'field'); - $defaultAttributes = \PowerComponents\LivewirePowerGrid\Components\Filters\FilterNumber::getWireAttributes($field, $filter); + $componentAttributes = (array) data_get($filter, 'attributes'); + + $defaultAttributes = $fieldClassName::getWireAttributes($field, array_merge($filter, (array)$column)); $filterClasses = Arr::toCssClasses([data_get($theme, 'inputClass'), data_get($column, 'headerClass'), 'power_grid']); diff --git a/resources/views/components/frameworks/bootstrap5/filters/select.blade.php b/resources/views/components/frameworks/bootstrap5/filters/select.blade.php index 1ffc0582..0784f8be 100644 --- a/resources/views/components/frameworks/bootstrap5/filters/select.blade.php +++ b/resources/views/components/frameworks/bootstrap5/filters/select.blade.php @@ -7,8 +7,8 @@ ]) @php - $field = strval(data_get($filter, 'field')); - $title = strval(data_get($filter, 'title')); + $field = data_get($filter, 'field'); + $title = data_get($column, 'title'); $defaultAttributes = \PowerComponents\LivewirePowerGrid\Components\Filters\FilterSelect::getWireAttributes($field, $title); diff --git a/resources/views/components/frameworks/bootstrap5/header/enabled-filters.blade.php b/resources/views/components/frameworks/bootstrap5/header/enabled-filters.blade.php index 16a66bd9..01beecd7 100644 --- a/resources/views/components/frameworks/bootstrap5/header/enabled-filters.blade.php +++ b/resources/views/components/frameworks/bootstrap5/header/enabled-filters.blade.php @@ -25,10 +25,10 @@ class="badge rounded-pill bg-secondary">{{ trans('livewire-powergrid::datatable. @endif - @foreach ($enabledFilters as $field => $filter) + @foreach ($enabledFilters as $filter) @isset($filter['label'])
{{ $filter['label'] }} diff --git a/resources/views/components/frameworks/tailwind/filter.blade.php b/resources/views/components/frameworks/tailwind/filter.blade.php index 6a9ac555..63e66431 100644 --- a/resources/views/components/frameworks/tailwind/filter.blade.php +++ b/resources/views/components/frameworks/tailwind/filter.blade.php @@ -24,84 +24,58 @@ class="pg-filter-container" $customConfig = []; @endphp
- @foreach ($filtersFromColumns as $filters) - @foreach ($filters as $filter) - @if (str(data_get($filter, 'className'))->contains('FilterMultiSelect')) -
- + @if ($className->contains('FilterMultiSelect')) + -
- @endif - @if (str(data_get($filter, 'className'))->contains('FilterDateTimePicker')) -
- @includeIf(data_get($theme, 'filterDatePicker.view'), [ - 'filter' => $filter, - 'tableName' => $tableName, - 'classAttr' => 'w-full', - 'theme' => data_get($theme, 'filterDatePicker'), - 'type' => 'datetime', - ]) -
- @endif - @if (str(data_get($filter, 'className'))->contains('FilterDatePicker')) -
- @includeIf(data_get($theme, 'filterDatePicker.view'), [ - 'filter' => $filter, - 'tableName' => $tableName, - 'classAttr' => 'w-full', - 'theme' => data_get($theme, 'filterDatePicker'), - 'type' => 'date', - ]) -
- @endif - @if (str(data_get($filter, 'className'))->contains(['FilterSelect', 'FilterEnumSelect'])) -
- @includeIf(data_get($theme, 'filterSelect.view'), [ - 'filter' => $filter, - 'theme' => data_get($theme, 'filterSelect'), - ]) -
- @endif - @if (str(data_get($filter, 'className'))->contains('FilterNumber')) -
- @includeIf(data_get($theme, 'filterNumber.view'), [ - 'filter' => $filter, - 'theme' => data_get($theme, 'filterNumber'), - ]) -
- @endif - @if (str(data_get($filter, 'className'))->contains('FilterInputText')) -
- @includeIf(data_get($theme, 'filterInputText.view'), [ - 'filter' => $filter, - 'theme' => data_get($theme, 'filterInputText'), - ]) -
- @endif - @if (str(data_get($filter, 'className'))->contains('FilterBoolean')) -
- @includeIf(data_get($theme, 'filterBoolean.view'), [ - 'filter' => $filter, - 'theme' => data_get($theme, 'filterBoolean'), - ]) -
- @endif - @if (str(data_get($filter, 'className'))->contains('FilterDynamic')) -
- + @elseif ($className->contains(['FilterDateTimePicker', 'FilterDatePicker'])) + @includeIf(data_get($theme, 'filterDatePicker.view'), [ + 'filter' => $filter, + 'tableName' => $tableName, + 'classAttr' => 'w-full', + 'theme' => data_get($theme, 'filterDatePicker'), + 'type' => $className->contains('FilterDateTimePicker') ? 'datetime' : 'date', + ]) + @elseif ($className->contains(['FilterSelect', 'FilterEnumSelect'])) + @includeIf(data_get($theme, 'filterSelect.view'), [ + 'filter' => $filter, + 'theme' => data_get($theme, 'filterSelect'), + ]) + @elseif ($className->contains('FilterNumber')) + @includeIf(data_get($theme, 'filterNumber.view'), [ + 'filter' => $filter, + 'theme' => data_get($theme, 'filterNumber'), + ]) + @elseif ($className->contains('FilterInputText')) + @includeIf(data_get($theme, 'filterInputText.view'), [ + 'filter' => $filter, + 'theme' => data_get($theme, 'filterInputText'), + ]) + @elseif ($className->contains('FilterBoolean')) + @includeIf(data_get($theme, 'filterBoolean.view'), [ + 'filter' => $filter, + 'theme' => data_get($theme, 'filterBoolean'), + ]) + @elseif ($className->contains('FilterDynamic')) + -
+ :attributes="new \Illuminate\View\ComponentAttributeBag(data_get($filter, 'attributes', []))" + /> @endif - @endforeach +
@endforeach
diff --git a/resources/views/components/frameworks/tailwind/filters/boolean.blade.php b/resources/views/components/frameworks/tailwind/filters/boolean.blade.php index 0173dc63..9ec7e474 100644 --- a/resources/views/components/frameworks/tailwind/filters/boolean.blade.php +++ b/resources/views/components/frameworks/tailwind/filters/boolean.blade.php @@ -6,10 +6,14 @@ 'filter' => null, ]) @php - unset($filter['className']); - extract($filter); + $fieldClassName = data_get($filter, 'className'); + $field = data_get($filter, 'field'); + $title = data_get($column, 'title'); - $defaultAttributes = \PowerComponents\LivewirePowerGrid\Components\Filters\FilterBoolean::getWireAttributes($field, $title); + $trueLabel = data_get($filter, 'trueLabel'); + $falseLabel = data_get($filter, 'falseLabel'); + + $defaultAttributes = $fieldClassName::getWireAttributes($field, $title); $selectClasses = Arr::toCssClasses([data_get($theme, 'selectClass'), $class, data_get($column, 'headerClass'), 'power_grid']); diff --git a/resources/views/components/frameworks/tailwind/filters/date-picker.blade.php b/resources/views/components/frameworks/tailwind/filters/date-picker.blade.php index d857ca55..35ae36e4 100644 --- a/resources/views/components/frameworks/tailwind/filters/date-picker.blade.php +++ b/resources/views/components/frameworks/tailwind/filters/date-picker.blade.php @@ -5,10 +5,12 @@ 'column' => null, 'tableName' => null, 'type' => 'datetime', + 'filter' => null, ]) @php - unset($filter['className']); - extract($filter); + $params = data_get($filter, 'params'); + $field = data_get($filter, 'field'); + $title = data_get($column, 'title'); $customConfig = []; if ($params) { @@ -44,7 +46,7 @@ class="{{ data_get($theme, 'baseClass') }}" @endif @php + $fieldClassName = data_get($filter, 'className'); + $field = strval(data_get($filter, 'field')); - $title = strval(data_get($filter, 'title')); + $title = strval(data_get($column, 'title')); $operators = (array) data_get($filter, 'operators', []); $placeholder = strval(data_get($filter, 'placeholder')); $componentAttributes = (array) data_get($filter, 'attributes', []); - - $inputTextOptions = \PowerComponents\LivewirePowerGrid\Components\Filters\FilterInputText::getInputTextOperators(); + + $inputTextOptions = $fieldClassName::getInputTextOperators(); $inputTextOptions = count($operators) > 0 ? $operators : $inputTextOptions; $showSelectOptions = !(count($inputTextOptions) === 1 && in_array('contains', $inputTextOptions)); - + $defaultPlaceholder = data_get($column, 'placeholder') ?: data_get($column, 'title'); $overridePlaceholder = $placeholder ?: $defaultPlaceholder; - + unset($filter['placeholder']); - - $defaultAttributes = \PowerComponents\LivewirePowerGrid\Components\Filters\FilterInputText::getWireAttributes($field, $title); - + + $defaultAttributes = $fieldClassName::getWireAttributes($field, $title); + $selectClasses = \Illuminate\Support\Arr::toCssClasses(['power_grid', data_get($theme, 'selectClass'), data_get($column, 'headerClass')]); $inputClasses = \Illuminate\Support\Arr::toCssClasses(['power_grid', data_get($theme, 'inputClass')]); - + $params = array_merge( [ 'showSelectOptions' => $showSelectOptions, @@ -67,6 +69,7 @@ class="{{ data_get($theme, 'baseClass') }}" '', ]) @php - unset($filter['className']); - extract($filter); + $fieldClassName = data_get($filter, 'className'); + $field = data_get($filter, 'field'); $componentAttributes = (array) data_get($filter, 'attributes'); - $defaultAttributes = \PowerComponents\LivewirePowerGrid\Components\Filters\FilterNumber::getWireAttributes($field, $filter); + $defaultAttributes = $fieldClassName::getWireAttributes($field, array_merge($filter, (array)$column)); $filterClasses = Arr::toCssClasses([data_get($theme, 'inputClass'), data_get($column, 'headerClass'), 'power_grid']); diff --git a/resources/views/components/frameworks/tailwind/filters/select.blade.php b/resources/views/components/frameworks/tailwind/filters/select.blade.php index ea304980..8129b535 100644 --- a/resources/views/components/frameworks/tailwind/filters/select.blade.php +++ b/resources/views/components/frameworks/tailwind/filters/select.blade.php @@ -6,12 +6,12 @@ 'filter' => null, ]) @php - unset($filter['className']); - extract($filter); + $field = data_get($filter, 'field'); + $title = data_get($column, 'title'); $defaultAttributes = \PowerComponents\LivewirePowerGrid\Components\Filters\FilterSelect::getWireAttributes($field, $title); - $filterClasses = Arr::toCssClasses([data_get($theme, 'selectClass'), $class, data_get($column, 'headerClass'), 'power_grid']); + $filterClasses = \Illuminate\Support\Arr::toCssClasses([data_get($theme, 'selectClass'), $class, data_get($column, 'headerClass'), 'power_grid']); $params = array_merge([...data_get($filter, 'attributes'), ...$defaultAttributes], $filter); @endphp diff --git a/resources/views/components/frameworks/tailwind/header/enabled-filters.blade.php b/resources/views/components/frameworks/tailwind/header/enabled-filters.blade.php index b1861687..b109aaca 100644 --- a/resources/views/components/frameworks/tailwind/header/enabled-filters.blade.php +++ b/resources/views/components/frameworks/tailwind/header/enabled-filters.blade.php @@ -1,5 +1,5 @@ @if (count($enabledFilters)) -
+
@if (count($enabledFilters) > 1) {{ trans('livewire-powergrid::datatable.buttons.clear_all_filters') }} @@ -13,16 +13,17 @@
@endif - @foreach ($enabledFilters as $field => $filter) + @foreach ($enabledFilters as $filter) @isset($filter['label']) {{ $filter['label'] }}