laravel-livewire-tables icon indicating copy to clipboard operation
laravel-livewire-tables copied to clipboard

ComponentColumn Added

Open CristhoferMF opened this issue 2 years ago • 2 comments

All Submissions:

  • [x] Have you followed the guidelines in our Contributing document?
  • [x] Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. [x] Does your submission pass tests and did you add any new tests needed for your feature?
  2. [x] Did you update all templates (if applicable)?
  3. [ ] Did you add the relevant documentation (if applicable)?
  4. [x] Did you test locally to make sure your feature works as intended?

Explain

Added a new Column type for projec blade component (anonimous). This is better than create a cell for that component or return a view with an instance of ComponentAttributeBag. Until now if you want to render a blade component, you had to create a new cell and place the component there or 'hack' it like this.

Column::make("Email", "email")
->format(function ($value) {
    return view('components.alert')
        ->with('attributes', new ComponentAttributeBag([
            'type' => Str::endsWith($value, 'example.org') ? 'success' : 'danger',
            'dismissible' => true,
        ]))
        ->with('slot', $value);
}),

After this PR it will be like that:

ComponentColumn::make("Email", "email")
->component('alert')
->attributes(fn ($value, $row, Column $column) => [
    'type' => Str::endsWith($value, 'example.org') ? 'success' : 'danger',
    'dismissible' => true,
]),

CristhoferMF avatar Jun 26 '22 21:06 CristhoferMF

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 26 '22 22:07 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 02 '22 04:09 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 28 '22 00:10 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 12 '22 03:12 stale[bot]