Skip to content

Commit

Permalink
fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
luanfreitasdev committed Aug 20, 2021
2 parents d77fb8f + 4439423 commit 6b8c61f
Show file tree
Hide file tree
Showing 20 changed files with 196 additions and 208 deletions.
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,9 @@ PowerGrid comes with a variety of out-of-the-box features:

Our documentation is available at [https://livewire-powergrid.docsforge.com/](https://livewire-powergrid.docsforge.com/).

## 3. Examples
## 3. Example

Tailwind table

![Laravel Livewire Tables](docs/img/tailwind.gif)

Excel export

![Laravel Livewire Tables](docs/img/export.png)
![Laravel Livewire Tables](docs/img/example.gif)

## 4. Demo

Expand All @@ -87,4 +81,4 @@ Just click on this link to learn more => [https://github.com/Power-Components/co
Created by: [Luan Freitas](https://github.com/luanfreitasdev)

- [Contributions](../../contributors)
- Logo & artwork by [Caneco](https://github.com/caneco)
- Logo & artwork by [Caneco](https://github.com/caneco)
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"require": {
"php": "^7.4|^8",
"livewire/livewire": "^2.4",
"box/spout": "^3"
"box/spout": "^3",
"doctrine/dbal": "^3.1"
},
"scripts": {
"pest-test": "./vendor/bin/pest"
Expand Down
7 changes: 3 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ When you run the `php artisan powergrid:create` command, we can let you know if

> Add the package: `composer require composer/composer --dev` to your project.
> Change 'check_version' to `true` in `config/livewire-powergrid.php`
The console output will look like this in the future if your package is out of date:

```bash
Expand Down Expand Up @@ -262,8 +264,6 @@ You can view more functionalities consulting each of the following methods:
- [Template](#template)
- [Relation Search](#relation-search)



### setUp() Method

The Setup method is used to configure your component.
Expand Down Expand Up @@ -347,8 +347,7 @@ public function addColumns(): ?PowerGrid
return PowerGrid::eloquent()
->addColumn('id')
->addColumn('name')
->addColumn('size')

->addColumn('size')
/** Group Relationship **/
->addColumn('group_id', function (Product $product) {
return $product->group_id;
Expand Down
Binary file removed docs/img/bootstrap.png
Binary file not shown.
Binary file added docs/img/example.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/img/export.png
Binary file not shown.
Binary file removed docs/img/logo.png
Binary file not shown.
Binary file removed docs/img/tailwind.gif
Binary file not shown.
Binary file removed docs/img/tailwind.png
Binary file not shown.
13 changes: 12 additions & 1 deletion resources/config/livewire-powergrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@
*/
'js_framework_cdn' => [
'alpinejs' => 'https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.8.2/dist/alpine.min.js'
]
],

/*
|--------------------------------------------------------------------------
| Notification latest version
|--------------------------------------------------------------------------
|
| Add the package: `composer require composer/composer --dev` to your project.
| and change this value to `true`
|
*/
'check_version' => false

];
6 changes: 3 additions & 3 deletions resources/views/components/editable.blade.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
@props([
'primaryKey' => null,
'row' => null,
'field' => null,
'theme' => null
])
<div x-data="{ value: '<span style=\'border-bottom: dotted 1px;\'>{{ addslashes($row->$field) }}</span>' }">
<div x-data="{ value: '<span style=\'border-bottom: dotted 1px;\'>{{ addslashes($row->{$field}) }}</span>' }">
<button
style="width: 100%;{{ $theme->buttonClass }}"
x-on:click="value = editableInput({{ $row->id }}, '{{ addslashes($row->$field) }}', '{{ $field }}');"
x-on:click="value = editableInput({{ $row->{$primaryKey} }}, '{{ addslashes($row->{$field}) }}', '{{ $field }}');"
x-html="value"
></button>
</div>
Expand All @@ -28,4 +29,3 @@ function sendEventInputChanged(event, id, field) {
})
}
</script>

87 changes: 35 additions & 52 deletions resources/views/components/frameworks/tailwind/filter.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,67 +15,50 @@ class="appearance-none text-left text-base font-medium text-gray-500 focus:outli
{{ trans('livewire-powergrid::datatable.buttons.filter') }}
</button>
</div>
<div x-show="show" class="border-l border-b border-r border-gray-200 dark:border-gray-600 px-2 py-4 dark:border-0 dark:bg-gray-700">
<div x-show="show"
class="border-l border-b border-r border-gray-200 dark:border-gray-600 px-2 py-4 dark:border-0 dark:bg-gray-700">
<div>
@php
$customConfig = [];
@endphp
<div class="md:flex md:flex-wrap">

@if(isset($makeFilters['date_picker']))
@foreach($makeFilters['date_picker'] as $field => $date)
<div class="flex flex-col mb-2 md:w-1/2 lg:w-1/4">
<x-livewire-powergrid::filters.date-picker
:date="$date"
:inline="false"
classAttr="w-full"
:theme="$theme->filterDatePicker"/>
</div>
@endforeach
@endif
@foreach(data_get($makeFilters, 'date_picker') as $field => $date)
<div class="flex flex-col mb-2 md:w-1/2 lg:w-1/4">
<x-livewire-powergrid::filters.date-picker
:date="$date"
:inline="false"
classAttr="w-full"
:theme="$theme->filterDatePicker"/>
</div>
@endforeach

@if(isset($makeFilters['select']))
@foreach($makeFilters['select'] as $field => $select)
<div class="flex flex-col mb-2 md:w-1/2 lg:w-1/4">
<x-livewire-powergrid::filters.select
:select="$select"
:inline="false"
:theme="$theme->filterSelect"/>
</div>
@endforeach
@endif
@foreach(data_get($makeFilters, 'select') as $field => $select)
<div class="flex flex-col mb-2 md:w-1/2 lg:w-1/4">
<x-livewire-powergrid::filters.select
:select="$select"
:inline="false"
:theme="$theme->filterSelect"/>
</div>
@endforeach

@if(isset($makeFilters['number']))
@foreach($makeFilters['number'] as $field => $number)
<div class="flex flex-col mb-2 md:w-1/2 lg:w-1/4">
<x-livewire-powergrid::filters.number
:number="$number"
:inline="false"
:theme="$theme->filterNumber"/>
</div>
@endforeach
@endif
@foreach(data_get($makeFilters, 'number') as $field => $number)
<div class="flex flex-col mb-2 md:w-1/2 lg:w-1/4">
<x-livewire-powergrid::filters.number
:number="$number"
:inline="false"
:theme="$theme->filterNumber"/>
</div>
@endforeach

@if(isset($makeFilters['select']))
@foreach($makeFilters['select'] as $field => $select)
<div class="flex flex-col mb-2 md:w-1/2 lg:w-1/4">
<x-livewire-powergrid::filters.select
:select="$select"
:inline="false"
:theme="$theme->filterSelect"/>
</div>
@endforeach
@endif
@if(isset($makeFilters['number']))
@foreach($makeFilters['number'] as $field => $number)
<div class="flex flex-col mb-2 md:w-1/2 lg:w-1/4">
<x-livewire-powergrid::filters.number
:number="$number"
:inline="false"
:theme="$theme->filterNumber"/>
</div>
@endforeach
@endif
@foreach(data_get($makeFilters, 'select') as $field => $select)
<div class="flex flex-col mb-2 md:w-1/2 lg:w-1/4">
<x-livewire-powergrid::filters.select
:select="$select"
:inline="false"
:theme="$theme->filterSelect"/>
</div>
@endforeach
</div>
</div>
</div>
Expand Down
12 changes: 0 additions & 12 deletions resources/views/components/frameworks/tailwind/scripts.blade.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
<script>
function saveEditableInput(event, id, field) {
document.getElementsByClassName('message')[0].style.display = "none";
window.livewire.emit('eventInputChanged', {
id: id,
value: event.target.value,
field: field
})
}
function saveToggleableInput(value, id, field) {
document.getElementsByClassName('message')[0].style.display = "none";
window.livewire.emit('eventToggleChanged', {
Expand All @@ -15,8 +7,4 @@ function saveToggleableInput(value, id, field) {
value: value
})
}
function editableInput(id, value, field) {
document.getElementsByClassName('message')[0].style.display = "none";
return '<input value="' + value + '" class="block bg-green-200 text-black-700 border border-gray-200 rounded py-3 px-4 leading-tight focus:outline-none focus:bg-white focus:border-gray-500 dark:bg-gray-500" @keydown.enter=saveEditableInput($event,' + id + ',"' + field + '") >';
}
</script>
60 changes: 31 additions & 29 deletions resources/views/components/frameworks/tailwind/toggleable.blade.php
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
<div>
@if($column->toggleable['enabled'] === true)
<div class="items-center" x-data="{ toggle_{{ $row->id }}: {{ $row->$field }} }">
<div class="items-center"
x-data="{ toggle_{{ $field }}_{{ $row->id }}: {{ $row->{$field} }} }">
<div class="relative rounded-full w-12 h-6 transition duration-200 ease-linear"
:class="[toggle_{{ $row->id }} === 1 ? 'bg-green-400' : 'bg-gray-400']">
<label for="toggle_{{ $row->id }}"
class="absolute left-0 bg-white border-2 mb-2 w-6 h-6 rounded-full transition transform duration-100 ease-linear cursor-pointer"
:class="[toggle_{{ $row->id }} === 1 ? 'translate-x-full border-green-400' : 'translate-x-0 border-gray-400']"></label>
<input type="checkbox" id="toggle_{{ $row->id }}" name="toggle_{{ $row->id }}"
:class="[toggle_{{ $field }}_{{ $row->{$primaryKey} }} === 1 ? 'bg-green-400' : 'bg-gray-400']">
<label
class="absolute left-0 bg-white border-2 mb-2 w-6 h-6 rounded-full transition transform duration-100 ease-linear cursor-pointer"
:class="[toggle_{{ $field }}_{{ $row->id }} === 1 ? 'translate-x-full border-green-400' : 'translate-x-0 border-gray-400']"></label>
<input type="checkbox"
class="appearance-none w-full h-full active:outline-none focus:outline-none"
@click="saveToggleableInput((toggle_{{ $row->id }} === 0 ? toggle_{{ $row->id }} = 1 : toggle_{{ $row->id }} = 0), {{ $row->id }}, '{{ $field }}')">
@click="saveToggleableInput((toggle_{{ $field }}_{{ $row->{$primaryKey} }} === 0 ? toggle_{{ $field }}_{{ $row->{$primaryKey} }} = 1 : toggle_{{ $field }}_{{ $row->{$primaryKey} }} = 0), {{ $row->{$primaryKey} }}, '{{ $field }}')">
</div>
</div>
@else
<div class="flex flex-row">
@if($row->$field === 0)
<div style="padding-top: 0.1em; padding-bottom: 0.1rem"
class="text-xs px-3 text-center w-full bg-red-200 text-red-800 rounded-full">
{{ $column->toggleable['default'][1] }}
</div>
@else
<div style="padding-top: 0.1em; padding-bottom: 0.1rem"
class="text-xs px-3 text-center w-full bg-blue-200 text-blue-800 rounded-full">
{{ $column->toggleable['default'][0] }}
<div class="flex flex-row">
@if($row->{$field} === 0)
<div style="padding-top: 0.1em; padding-bottom: 0.1rem"
class="text-xs px-3 text-center w-full bg-red-200 text-red-800 rounded-full">
{{ $column->toggleable['default'][1] }}
</div>
@else
<div style="padding-top: 0.1em; padding-bottom: 0.1rem"
class="text-xs px-3 text-center w-full bg-blue-200 text-blue-800 rounded-full">
{{ $column->toggleable['default'][0] }}
</div>
@endif
</div>
@endif
</div>
@endif
<script>
function saveToggleableInput(value, id, field) {
document.getElementsByClassName('message')[0].style.display = "none";
window.livewire.emit('eventToggleChanged', {
id: id,
field: field,
value: value
})
}
</script>
</div>
<script>
function saveToggleableInput(value, id, field) {
document.getElementsByClassName('message')[0].style.display = "none";
window.livewire.emit('eventToggleChanged', {
id: id,
field: field,
value: value
})
}
</script>
Loading

0 comments on commit 6b8c61f

Please sign in to comment.