Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #62

Merged
merged 20 commits into from
Mar 21, 2023
Merged
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
15 changes: 10 additions & 5 deletions .github/workflows/php-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
matrix:
os: [ubuntu-22.04]
php: [8.1, 8.2]
laravel: [9.*, 10.*]
laravel: [8.*, 9.*, 10.*]
stability: [prefer-dist]
exclude:
- laravel: 10.*
Expand Down Expand Up @@ -56,30 +56,35 @@ jobs:

- name: Update dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction
run: composer update --${{ matrix.stability }} --no-interaction

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Run Unit Tests L8
if: startsWith(matrix.laravel, '8') == true
run: php -d pcov.enabled=1 ./vendor/bin/paratest --testsuite='Standard' --exclude-group skip8 --passthru-php="'-d pcov.enabled=1'"

- name: Run Unit Tests L9 L10
if: ${{ matrix.laravel }} != '8.*'
if: startsWith(matrix.laravel, '8') == false
run: php -d pcov.enabled=1 ./vendor/bin/paratest --testsuite='Standard' --passthru-php="'-d pcov.enabled=1'"

- name: Run PHPStan
if: startsWith(matrix.laravel, '8') == false
run: phpstan analyse src

- name: phpunit-coverage-badge-l9
if: ${{ matrix.laravel }} == '9.*'
if: startsWith(matrix.laravel, '9') == true
uses: timkrase/phpunit-coverage-badge@v1.2.1
with:
coverage_badge_path: 'docs/images/badges/phpunit-coverage-L9-${{ matrix.php }}-develop.svg'
push_badge: true
repo_token: ${{ secrets.GITHUB_TOKEN }}

- name: phpunit-coverage-badge-l10
if: ${{ matrix.laravel }} == '10.*'
if: startsWith(matrix.laravel, '10') == true
uses: timkrase/phpunit-coverage-badge@v1.2.1
with:
coverage_badge_path: 'docs/images/badges/phpunit-coverage-L10-${{ matrix.php }}-develop.svg'
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ Please see the [Wiki](https://github.com/LowerRockLabs/LaravelLivewireTablesAdva
# Laravel Support
| Version | Supported |
| :---: | :---: |
| 8 | ✗ |
| 8 | ✓ |
| 9 | ✓ |
| 10 | ✓ |


This package uses Arr::map, which is not supported under Laravel 8. If there is demand, then a version will be released supporting Laravel 8

# Installation
This package is available to be installed via Composer
```terminal
Expand Down
20 changes: 20 additions & 0 deletions docs/images/badges/phpunit-coverage-L8-8.2-develop.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@props(['theme'])
@php
$tableName = $component->getTableName();
$filterKey = $filter->getKey();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
wireValues: $wire.entangle('{{ $filterBasePath }}'),
defaultMin: {{ $minRange }},
defaultMax: {{ $maxRange }},
restrictUpdates: true,
restrictUpdates: false,
setupFilterMenu() {
let parentLabelElement = document.getElementById('{{ $filterLabelPath }}-label');
let currentFilterMenuLabel = document.querySelector('{{ $filterMenuLabel }}');
Expand Down Expand Up @@ -124,13 +124,10 @@
this.updateStyles();
},
allowUpdates() {
this.restrictUpdates = false;
this.updateWire();
},
updateWire() {
this.updateStyles();
if (!this.restrictUpdates) {
this.restrictUpdates = true;
if (this.wireValues != undefined) {
if (this.wireValues['min'] != undefined || this.wireValues['max'] != undefined)
{
Expand All @@ -146,8 +143,6 @@
else if ($refs.filterMin.value != this.defaultMin || $refs.filterMax.value != this.defaultMax) {
this.wireValues = { 'min': $refs.filterMin.value, 'max': $refs.filterMax.value };
}

}
},
init() {
this.setupWire();
Expand Down
33 changes: 26 additions & 7 deletions src/CustomFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,32 @@ public function getOptions(): array
*/
public function config($config = []): CustomFilter
{
$flattened = \Illuminate\Support\Arr::dot($config);

\Illuminate\Support\Arr::map($flattened, function (string $value, string $key) {
\Illuminate\Support\Arr::set($this->config, $key, $value);

return true;
});
$version = explode(".", app()->version())[0];
if ($version == 8) {
foreach ($config as $configIndex => $configValue) {
if (! is_array($configValue)) {
$this->config[$configIndex] = $configValue;
} else {
foreach ($configValue as $configIndex2 => $configValue2) {
if (! is_array($configValue2)) {
$this->config[$configIndex][$configIndex2] = $configValue2;
} else {
foreach ($configValue2 as $configIndex3 => $configValue3) {
$this->config[$configIndex][$configIndex2][$configIndex3] = $configValue3;
}
}
}
}
}
} else {
$flattened = \Illuminate\Support\Arr::dot($config);

\Illuminate\Support\Arr::map($flattened, function (string $value, string $key) {
\Illuminate\Support\Arr::set($this->config, $key, $value);

return true;
});
}

return $this;
}
Expand Down
31 changes: 25 additions & 6 deletions src/DatePickerFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,32 @@ public function getOptions(): array
*/
public function config($config = []): DatePickerFilter
{
$flattened = \Illuminate\Support\Arr::dot($config);

\Illuminate\Support\Arr::map($flattened, function (string $value, string $key) {
\Illuminate\Support\Arr::set($this->config, $key, $value);
$version = explode(".", app()->version())[0];
if ($version == 8) {
foreach ($config as $configIndex => $configValue) {
if (! is_array($configValue)) {
$this->config[$configIndex] = $configValue;
} else {
foreach ($configValue as $configIndex2 => $configValue2) {
if (! is_array($configValue2)) {
$this->config[$configIndex][$configIndex2] = $configValue2;
} else {
foreach ($configValue2 as $configIndex3 => $configValue3) {
$this->config[$configIndex][$configIndex2][$configIndex3] = $configValue3;
}
}
}
}
}
} else {
$flattened = \Illuminate\Support\Arr::dot($config);

return true;
});
\Illuminate\Support\Arr::map($flattened, function (string $value, string $key) {
\Illuminate\Support\Arr::set($this->config, $key, $value);

return true;
});
}

return $this;
}
Expand Down
31 changes: 25 additions & 6 deletions src/DateRangeFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,32 @@ public function getOptions(): array
*/
public function config($config = []): DateRangeFilter
{
$flattened = \Illuminate\Support\Arr::dot($config);

\Illuminate\Support\Arr::map($flattened, function (string $value, string $key) {
\Illuminate\Support\Arr::set($this->config, $key, $value);
$version = explode(".", app()->version())[0];
if ($version == 8) {
foreach ($config as $configIndex => $configValue) {
if (! is_array($configValue)) {
$this->config[$configIndex] = $configValue;
} else {
foreach ($configValue as $configIndex2 => $configValue2) {
if (! is_array($configValue2)) {
$this->config[$configIndex][$configIndex2] = $configValue2;
} else {
foreach ($configValue2 as $configIndex3 => $configValue3) {
$this->config[$configIndex][$configIndex2][$configIndex3] = $configValue3;
}
}
}
}
}
} else {
$flattened = \Illuminate\Support\Arr::dot($config);

return true;
});
\Illuminate\Support\Arr::map($flattened, function (string $value, string $key) {
\Illuminate\Support\Arr::set($this->config, $key, $value);

return true;
});
}

return $this;
}
Expand Down
31 changes: 25 additions & 6 deletions src/NumberRangeFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,32 @@ public function getOptions(): array
*/
public function config($config = []): NumberRangeFilter
{
$flattened = \Illuminate\Support\Arr::dot($config);

\Illuminate\Support\Arr::map($flattened, function (string $value, string $key) {
\Illuminate\Support\Arr::set($this->config, $key, $value);
$version = explode(".", app()->version())[0];
if ($version == 8) {
foreach ($config as $configIndex => $configValue) {
if (! is_array($configValue)) {
$this->config[$configIndex] = $configValue;
} else {
foreach ($configValue as $configIndex2 => $configValue2) {
if (! is_array($configValue2)) {
$this->config[$configIndex][$configIndex2] = $configValue2;
} else {
foreach ($configValue2 as $configIndex3 => $configValue3) {
$this->config[$configIndex][$configIndex2][$configIndex3] = $configValue3;
}
}
}
}
}
} else {
$flattened = \Illuminate\Support\Arr::dot($config);

return true;
});
\Illuminate\Support\Arr::map($flattened, function (string $value, string $key) {
\Illuminate\Support\Arr::set($this->config, $key, $value);

return true;
});
}

return $this;
}
Expand Down
33 changes: 26 additions & 7 deletions src/SlimSelectFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,32 @@ public function __construct(string $name, string $key = null)
*/
public function config($config = []): SlimSelectFilter
{
$flattened = \Illuminate\Support\Arr::dot($config);

\Illuminate\Support\Arr::map($flattened, function (string $value, string $key) {
\Illuminate\Support\Arr::set($this->config, $key, $value);

return true;
});
$version = explode(".", app()->version())[0];
if ($version == 8) {
foreach ($config as $configIndex => $configValue) {
if (! is_array($configValue)) {
$this->config[$configIndex] = $configValue;
} else {
foreach ($configValue as $configIndex2 => $configValue2) {
if (! is_array($configValue2)) {
$this->config[$configIndex][$configIndex2] = $configValue2;
} else {
foreach ($configValue2 as $configIndex3 => $configValue3) {
$this->config[$configIndex][$configIndex2][$configIndex3] = $configValue3;
}
}
}
}
}
} else {
$flattened = \Illuminate\Support\Arr::dot($config);

\Illuminate\Support\Arr::map($flattened, function (string $value, string $key) {
\Illuminate\Support\Arr::set($this->config, $key, $value);

return true;
});
}

return $this;
}
Expand Down
31 changes: 25 additions & 6 deletions src/SmartSelectFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,32 @@ public function __construct(string $name, string $key = null)
*/
public function config($config = []): SmartSelectFilter
{
$flattened = \Illuminate\Support\Arr::dot($config);

\Illuminate\Support\Arr::map($flattened, function (string $value, string $key) {
\Illuminate\Support\Arr::set($this->config, $key, $value);
$version = explode(".", app()->version())[0];
if ($version == 8) {
foreach ($config as $configIndex => $configValue) {
if (! is_array($configValue)) {
$this->config[$configIndex] = $configValue;
} else {
foreach ($configValue as $configIndex2 => $configValue2) {
if (! is_array($configValue2)) {
$this->config[$configIndex][$configIndex2] = $configValue2;
} else {
foreach ($configValue2 as $configIndex3 => $configValue3) {
$this->config[$configIndex][$configIndex2][$configIndex3] = $configValue3;
}
}
}
}
}
} else {
$flattened = \Illuminate\Support\Arr::dot($config);

return true;
});
\Illuminate\Support\Arr::map($flattened, function (string $value, string $key) {
\Illuminate\Support\Arr::set($this->config, $key, $value);

return true;
});
}

return $this;
}
Expand Down
Loading