Welcome and thank you for your interest in contributing to our project!. You must use this template to submit a Pull Request or it will not be accepted.
Motivation
[X] Bug fix
[X] Enhancement
[ ] New feature
[X] Breaking change
Description
This Pull Request fixes the bug of hideToggleable not being applied and adds new Action Rules as documented below.
As a minor detail, I have also linked the README screenshot to the "Demo Dish" table.
✨ New Rules
unless() conditition
Rule::rows()->alternating()
Rule::rows()->hideToggleDetail()
Rule::rows()->disableEditOnClick()
Rule::toggleable($column)
Rule::editOnClick($column)
Rule::rows()->hideToggleable() (fixed)
Screenshot
Example using alternating() to produce a zebra-striped table, Rule::editOnClick('name')->enable() forces inline editing on dish ID # 10, Rule::rows()->hideToggleable() hiding the toggleable on dishes ID # 5,6,10
Forcefully enable or disable a edit on click, regardless of column configuration or its permission.
TOGGLEABLE RULE
show() / hide()
Forcefully show or hide a toggleable switch, regardless of column configuration or its permission.
Usage/Examples
Specific target rules have precedence over column and row rules. That is, if a column is configured to NOT have permission to display a toggleable switch, but a rule is targeting that column with the show() modifier, this toggle will be rendered.
In the next example, the column doesn't have permission to show toggleables. However, the dish with ID 1 will forcefully display a toggle, while all other rows will have the fallback badge.
In a similar case, now the column active has permission to display toggles. In this column, we will hide toggles when active is false. So, when a user switches it to false, he cannot switch to true again. However, for the dish #1, the checkbox will always be shown.
⚡ PowerGrid - Pull Request
Welcome and thank you for your interest in contributing to our project!. You must use this template to submit a Pull Request or it will not be accepted.
Motivation
Description
This Pull Request fixes the bug of
hideToggleable
not being applied and adds new Action Rules as documented below.As a minor detail, I have also linked the README screenshot to the "Demo Dish" table.
✨
New Rulesunless()
condititionRule::rows()->alternating()
Rule::rows()->hideToggleDetail()
Rule::rows()->disableEditOnClick()
Rule::toggleable($column)
Rule::editOnClick($column)
Rule::rows()->hideToggleable()
(fixed)Screenshot
Example using
alternating()
to produce a zebra-striped table,Rule::editOnClick('name')->enable()
forces inline editing on dish ID # 10,Rule::rows()->hideToggleable()
hiding the toggleable on dishes ID # 5,6,10📜
New Rules Action Rules SummaryUsage/Examples
Specific target rules have precedence over column and row rules. That is, if a column is configured to NOT have permission to display a toggleable switch, but a rule is targeting that column with the
show()
modifier, this toggle will be rendered.In the next example, the column doesn't have permission to show toggleables. However, the dish with ID 1 will forcefully display a toggle, while all other rows will have the fallback badge.
In a similar case, now the column active has permission to display toggles. In this column, we will hide toggles when active is false. So, when a user switches it to false, he cannot switch to true again. However, for the dish #1, the checkbox will always be shown.
The
alternating()
modifier is a convenient way to produce a zebra-stripped table.For more details, see the tests associated with the
tests/Concerns/Components/ComponentsForTestRule.php
component.❗
POSSIBLE BREAKING CHANGESThe following views were altered and will cause breaking changes in users who published/customized the views.
resources/views/components/row.blade.php
resources/views/components/frameworks/bootstrap5/toggleable.blade.php
resources/views/components/frameworks/tailwind/toggleable.blade.php
Related Issue(s): https://github.com/Power-Components/livewire-powergrid/issues/1539
Documentation
This PR requires Documentation update?