rappasoft/laravel-livewire-tables

[Feature Request]: Hide Bulk actions dropdown

jacksontong opened this issue · 5 comments

Overview

There is a case where I don't want my action to be in the dropdown, I could render and call it manually with toolbar-right-start, but the bulk actions dropdown is still showing even though there is no action in it.

Detailed explanation

The check boxes column and the dropdown are using the same logic to show/hide, so I can't hide one without the other

if ($component->bulkActionsAreEnabled() && $component->hasBulkActions()) {

}

It would be good to have a new setting to show the check boxes column without showing the bulk actions dropdown.

Notes

No response

Will be adding in an "alwaysHideBulkActionsDropdown" option, probably next weekend tbh!

This will be in the next release, as part of this PR #1738, I've yet to finish up the naming convention, writing tests, and updating docs, but the functionality is present. I'll finalise the naming convention this weekend.

So the outstanding item is docs, as there's quite a few new methods introduced to:

  • Always hide the Bulk Actions Button (and thus the menu)
  • Customise classes for:
    • Bulk Actions Button
    • Bulk Actions Menu
    • Bulk Actions Menu Items

I've made a start on the documentation, but it may be the tail end of next week before I add in the default values etc (to match the standard for the docs)

So the "development" branch now has the option for Always hide the Bulk Actions Button (and thus the menu)

I will do a release by next weekend.

setShouldAlwaysHideBulkActionsDropdownOption

Allows hiding the Bulk Actions button & menu, regardless of whether there are any items selected, or hideBulkActionsWhenEmptyEnabled behaviour

public function configure(): void
{
    $this->setShouldAlwaysHideBulkActionsDropdownOption(true);
}

setShouldAlwaysHideBulkActionsDropdownOptionEnabled

Allows hiding the Bulk Actions button & menu, regardless of whether there are any items selected, or hideBulkActionsWhenEmptyEnabled behaviour

public function configure(): void
{
    $this->setShouldAlwaysHideBulkActionsDropdownOptionEnabled();
}

setShouldAlwaysHideBulkActionsDropdownOptionDisabled

Restores the Bulk Actions to default functionality, so it will respect the hideBulkActionsWhenEmptyEnabled behaviour

public function configure(): void
{
    $this->setShouldAlwaysHideBulkActionsDropdownOptionDisabled();
}

Now released as v3.2.8, please advise if anything not as expected!