File tree Expand file tree Collapse file tree 3 files changed +31
-5
lines changed 
resources/views/components Expand file tree Collapse file tree 3 files changed +31
-5
lines changed Original file line number Diff line number Diff line change 77
88
99@if  ($this -> isTailwind 
10-     <div  {{  $this -> getPaginationWrapperAttributes   } }
10+     <div  {{  $this -> getPaginationWrapperAttributesBag ()   } }
1111        @if  ($this -> paginationVisibilityIsEnabled ()
1212            <div  class =" mt-4 px-4 md:p-0 sm:flex justify-between items-center space-y-4 sm:space-y-0" 
1313                <div >
4949        @endif 
5050    </div >
5151@elseif  ($this -> isBootstrap4 
52-     <div  {{  $this -> getPaginationWrapperAttributes   } }
52+     <div  {{  $this -> getPaginationWrapperAttributesBag ()   } }
5353        @if  ($this -> paginationVisibilityIsEnabled ()
5454            @if  ($this -> paginationIsEnabled () &&  $this -> isPaginationMethod (' standard' &&  $this -> getRows -> lastPage () >  1 
5555                <div  class =" row mt-3" 
102102        @endif 
103103    </div >
104104@elseif  ($this -> isBootstrap5 
105-     <div  {{  $this -> getPaginationWrapperAttributes   } }
105+     <div  {{  $this -> getPaginationWrapperAttributesBag ()   } }
106106        @if  ($this -> paginationVisibilityIsEnabled ()
107107            @if  ($this -> paginationIsEnabled () &&  $this -> isPaginationMethod (' standard' &&  $this -> getRows -> lastPage () >  1 
108108                <div  class =" row mt-3" 
Original file line number Diff line number Diff line change 33namespace  Rappasoft \LaravelLivewireTables \Traits \Helpers ;
44
55use  Livewire \Attributes \Computed ;
6+ use  Illuminate \View \ComponentAttributeBag ;
67
78trait  PaginationHelpers
89{
@@ -156,9 +157,15 @@ public function getShouldRetrieveTotalItemCount(): bool
156157        return  $ this shouldRetrieveTotalItemCount ;
157158    }
158159
159-     #[Computed]
160160    public  function  getPaginationWrapperAttributes (): array 
161161    {
162-         return  $ this paginationWrapperAttributes ;
162+         return  $ this paginationWrapperAttributes  ?? ['class '  => '' ];
163+     }
164+ 
165+ 
166+     #[Computed]
167+     public  function  getPaginationWrapperAttributesBag (): ComponentAttributeBag 
168+     {
169+         return  new  ComponentAttributeBag ($ this getPaginationWrapperAttributes ());
163170    }
164171}
Original file line number Diff line number Diff line change @@ -182,5 +182,24 @@ public function test_can_get_pagination_wrapper_attributes(): void
182182        $ this basicTable ->setPaginationWrapperAttributes (['class '  => 'text-lg ' ]);
183183
184184        $ this assertSame (['class '  => 'text-lg ' ], $ this basicTable ->getPaginationWrapperAttributes ());
185+ 
186+         $ this basicTable ->setPaginationWrapperAttributes (['class '  => 'text-lg ' , 'testval '  => '456 ' ]);
187+ 
188+         $ this assertSame (['class '  => 'text-lg ' , 'testval '  => '456 ' ], $ this basicTable ->getPaginationWrapperAttributes ());
189+ 
190+     }
191+ 
192+     public  function  test_can_get_pagination_wrapper_attributes_bag (): void 
193+     {
194+         $ this assertSame ((new  \Illuminate \View \ComponentAttributeBag (['class '  => '' ]))->getAttributes (), $ this basicTable ->getPaginationWrapperAttributesBag ()->getAttributes ());
195+ 
196+         $ this basicTable ->setPaginationWrapperAttributes (['class '  => 'text-lg ' ]);
197+ 
198+         $ this assertSame ((new  \Illuminate \View \ComponentAttributeBag (['class '  => 'text-lg ' ]))->getAttributes (), $ this basicTable ->getPaginationWrapperAttributesBag ()->getAttributes ());
199+ 
200+         $ this basicTable ->setPaginationWrapperAttributes (['class '  => 'text-lg ' , 'testval '  => '123 ' ]);
201+ 
202+         $ this assertSame ((new  \Illuminate \View \ComponentAttributeBag (['class '  => 'text-lg ' , 'testval '  => '123 ' ]))->getAttributes (), $ this basicTable ->getPaginationWrapperAttributesBag ()->getAttributes ());
203+ 
185204    }
186205}
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments