diff --git a/.github/workflows/run-tests-pcov-pull.yml b/.github/workflows/run-tests-pcov-pull.yml new file mode 100644 index 000000000..fbfdb8af2 --- /dev/null +++ b/.github/workflows/run-tests-pcov-pull.yml @@ -0,0 +1,74 @@ +name: run-tests-pcov-pull + +on: [pull_request] + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + php: [8.2] + laravel: [10] + stability: [prefer-dist] + + name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, pcntl, pdo, sqlite, pdo_sqlite, bcmath, intl, iconv, fileinfo + tools: phpunit:latest + ini-values: memory_limit=512M + coverage: pcov + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup problem matchers for PHP + run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + + - name: Get composer cache directory + id: composer-cache + run: | + echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-PHP${{ matrix.php }}-Laravel${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-PHP${{ matrix.php }}-Laravel${{ matrix.laravel }}-composer- + + - name: Add token + run: | + composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} + + - name: Install dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer require "laravel/framework:${{ matrix.laravel }}.*" --no-interaction --no-update + + - name: Update dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer update --${{ matrix.stability }} --no-interaction + + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Run Unit Tests + run: php ./vendor/bin/paratest --cache-directory=".phpunit.cache/code-coverage" --strict-coverage --coverage-clover ./coverage.xml --processes=4 + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + token: ${{ secrets.CODE_COV_TOKEN }} + files: ./coverage.xml + verbose: true + + diff --git a/.github/workflows/run-tests-pcov.yml b/.github/workflows/run-tests-pcov.yml new file mode 100644 index 000000000..1456d1cf1 --- /dev/null +++ b/.github/workflows/run-tests-pcov.yml @@ -0,0 +1,74 @@ +name: run-tests-pcov + +on: [push] + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + php: [8.2] + laravel: [10] + stability: [prefer-dist] + + name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, pcntl, pdo, sqlite, pdo_sqlite, bcmath, intl, iconv, fileinfo + tools: phpunit:latest + ini-values: memory_limit=512M + coverage: pcov + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup problem matchers for PHP + run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + + - name: Get composer cache directory + id: composer-cache + run: | + echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-PHP${{ matrix.php }}-Laravel${{ matrix.laravel }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-PHP${{ matrix.php }}-Laravel${{ matrix.laravel }}-composer- + + - name: Add token + run: | + composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} + + - name: Install dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer require "laravel/framework:${{ matrix.laravel }}.*" --no-interaction --no-update + + - name: Update dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer update --${{ matrix.stability }} --no-interaction + + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Run Unit Tests + run: php ./vendor/bin/paratest --cache-directory=".phpunit.cache/code-coverage" --strict-coverage --coverage-clover ./coverage.xml --processes=4 + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + token: ${{ secrets.CODE_COV_TOKEN }} + files: ./coverage.xml + verbose: true + + diff --git a/.gitignore b/.gitignore index 043be3f9a..d5834f1b7 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,6 @@ phpunit.xml.dist.bak phpunit.xml.dist.dev .github/workflows/code-cov.yml .history/* +.env +phpunit.xml.bak +phpstan.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bebf46f0..02c4d149d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ All notable changes to `laravel-livewire-tables` will be documented in this file ## [Unreleased] +- Enhancements + - Add customisable Search Placeholder - setSearchPlaceholder() + - Add CodeCov workflows ## [2.15.0] - 2023-07-15 diff --git a/docs/search/available-methods.md b/docs/search/available-methods.md index b0d20ac09..028361f7e 100644 --- a/docs/search/available-methods.md +++ b/docs/search/available-methods.md @@ -94,6 +94,17 @@ public function configure(): void } ``` +## setSearchPlaceholder + +Set a custom placeholder for the search box + +```php +public function configure(): void +{ + $this->setSearchPlaceholder('Enter Search Term'); +} +``` + --- You can only set one of the follow search modifiers: diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 2d49abb8d..5ff33415f 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,8 +1,24 @@ - - - - tests - - + + + + tests + + + + + config + database + src + + diff --git a/resources/lang/tk.json b/resources/lang/tk.json index 78bb1460b..7c41e705a 100644 --- a/resources/lang/tk.json +++ b/resources/lang/tk.json @@ -1,6 +1,6 @@ { "All": "Hemmesi", - "All Columns": "Colhli sütünler", + "All Columns": "Ähli sütünler", "Applied Filters": "Ulanylýan Süzgüçler", "Applied Sorting": "Ulanylýan Tertipleşdirme", "Bulk Actions": "Köpçülikleýin Hereketler", @@ -10,22 +10,22 @@ "Deselect All": "Hemmesini Aýyr", "Done Reordering": "Täzeden Tertiplendi", "Filters": "Süzgüçler", - "No": "Hayir", + "No": "Ýok", "No items found. Try to broaden your search.": "Hiç zat tapylmady. Gözlegiňizi giňeltmäge synanyşyň.", "of": "aralygy", "Remove filter option": "Süzgüç görnüşini aýyryň", "Remove sort option": "Tertiplemek görnüşini aýyryň", "Reorder": "Tertibe salmak", "results": "netijeler", - "row": "hatarlar", + "row": "hatar", "rows": "hatarlar", "rows, do you want to select all": "hatarlar, hemmesini saýlamak isleýärsiňizmi?", "Search": "Gözlemek", - "Select All": "Hepsini seç", + "Select All": "Hemmesini saýla", "Showing": "Görkezmek", "to": "-", - "Yes": "Evet", + "Yes": "Hawa", "You are currently selecting all": "Häzirki wagtda hemmesini saýlap alýarsyňyz", "You are not connected to the internet.": "Siz internete birikmediksiňiz.", "You have selected": "Saýladyňyz" -} \ No newline at end of file +} diff --git a/resources/views/components/tools/toolbar.blade.php b/resources/views/components/tools/toolbar.blade.php index 5fc835417..2dbcb1664 100644 --- a/resources/views/components/tools/toolbar.blade.php +++ b/resources/views/components/tools/toolbar.blade.php @@ -35,7 +35,8 @@ class="inline-flex justify-center items-center w-full md:w-auto px-4 py-2 border @if ($component->searchIsEnabled() && $component->searchVisibilityIsEnabled())
getSearchOptions() }}="{{ $component->getTableName() }}.search" - placeholder="{{ __('Search') }}" type="text" + placeholder="{{ $component->getSearchPlaceholder() }}" + type="text" class="block w-full border-gray-300 rounded-md shadow-sm transition duration-150 ease-in-out sm:text-sm sm:leading-5 dark:bg-gray-700 dark:text-white dark:border-gray-600 @if ($component->hasSearch()) rounded-none rounded-l-md focus:ring-0 focus:border-gray-300 @else focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md @endif" /> @if ($component->hasSearch()) @@ -327,7 +328,8 @@ class="block w-full border-gray-300 rounded-md shadow-sm transition duration-150 @if ($component->searchIsEnabled() && $component->searchVisibilityIsEnabled())
getSearchOptions() }}="{{ $component->getTableName() }}.search" - placeholder="{{ __('Search') }}" type="text" class="form-control"> + placeholder="{{ $component->getSearchPlaceholder() }}" + type="text" class="form-control"> @if ($component->hasSearch())
@@ -556,7 +558,8 @@ class="px-2 {{ $loop->last ? 'mb-0' : 'mb-1' }}"> @if ($component->searchIsEnabled() && $component->searchVisibilityIsEnabled())
getSearchOptions() }}="{{ $component->getTableName() }}.search" - placeholder="{{ __('Search') }}" type="text" class="form-control"> + placeholder="{{ $component->getSearchPlaceholder() }}" + type="text" class="form-control"> @if ($component->hasSearch())