rappasoft / laravel-livewire-tables

A dynamic table component for Laravel Livewire
https://rappasoft.com/docs/laravel-livewire-tables/v2/introduction
MIT License
1.74k stars 329 forks source link

Missing component views for Bootstrap 4? #202

Closed nguillaumin closed 3 years ago

nguillaumin commented 3 years ago

Hi,

I'm trying to setup a table with Bootstrap 4 but I'm getting:

InvalidArgumentException
View [bootstrap-4.components.table.row-columns] not found. (View: /var/www/html/resources/views/vendor/livewire-tables/bootstrap-4/includes/table.blade.php) 

I have published the views via the artisan command, but it seems the Bootstrap 4 folder is missing the components/ sub-folder compared to Tailwind. Am I missing something or is it an oversight?

Thanks,

Nico

nguillaumin commented 3 years ago

In fact looking at the Bootstrap 4 views, they seem to be missing some features compared to Tailwind? For example making a row clickable does not seem to work as it's not implemented in includes/table.blade.php. So maybe the question is more: What's the status of the Bootstrap 4 support?

I don' t mind too much as I'm using Bootstrap 5 anyway so I would need to update the views. But I should probably use the Tailwind ones as a starting point?

nguillaumin commented 3 years ago

Another possible related issue: The components are aliased to the Tailiwind ones here. It means when creating a new theme it's still using the components under tailwind/components/, rather than <theme>/components/. Is there a way to configure / change this?

rappasoft commented 3 years ago

You're right I missed the table row click on BS. I ended up rushing bootstrap to get this out, I didn't think the components were necessary since there was no added markup. But i'm about to push a patch that adds the components. I couldn't get conditional components to register from the package service provider so I ended up aliasing them:

<x-livewire-tables:table.*> defaults to tailwind <x-livewire-tables:tw.table.*> also tailwind <x-livewire-tables:bs4.table.*> bootstrap

Let me know if you find anymore issues. Feel free to PR if you have time as i'm short on it.

I do have a full version running on BS4 and TW with no issues (not to say there aren't any)

nguillaumin commented 3 years ago

Thanks, no worries. I'm actually trying to make a Bootstrap 5 theme, so these changes won't actually help me much :wink:

Maybe the component aliasing should use the configured theme, if that's possible / make sense?

Blade::component('livewire-tables::'.config('livewire-tables.theme').'.components.table.table', 'livewire-tables::table');
rappasoft commented 3 years ago

I tried that, but I was getting errors nesting the components in the views for some reason. They would register on the main view, but use in subviews or includes would results in component not found errors. If I have more time i'll try to figure it out but it should be good for now. I have not used BS5 yet, if I have time and if its not too different then i'll make a theme for it.

nguillaumin commented 3 years ago

Ok fair enough, thanks for the fix.