[ENHANCEMENT/FIX] Fix hideToggleable, add Action Rules
editOnClick(),
toggleable(),
unless()` condition and others...
#1559
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
⚡ 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): #1539
Documentation
This PR requires Documentation update?