This repository was archived by the owner on Jun 27, 2024. It is now read-only.
File tree 9 files changed +75
-96
lines changed
9 files changed +75
-96
lines changed Original file line number Diff line number Diff line change 1
1
<template >
2
- <div class =" min-h-screen flex flex-col sm:justify-center items-center pt-6 sm:pt-0 bg-gray-100" >
2
+ <div class =" min-h-screen flex flex-col items-center bg-gray-100" >
3
3
<div class =" w-full max-w-7xl mt-6 sm:px-6 py-4 bg-white shadow-md overflow-hidden sm:rounded-lg" >
4
4
<slot />
5
5
</div >
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ defineProps(["users"])
13
13
<Table
14
14
:inertia =" $inertia"
15
15
:resource =" users"
16
- :prevent-overlapping-requests = " false "
16
+ :input-debounce = " 0 "
17
17
>
18
18
<template #cell (actions)="{ item: user }">
19
19
<a
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Tests \Browser ;
4
+
5
+ use App \Models \User ;
6
+ use Laravel \Dusk \Browser ;
7
+ use Tests \DuskTestCase ;
8
+
9
+ class ColumnTest extends DuskTestCase
10
+ {
11
+ /** @test */
12
+ public function it_can_toggle_columns ()
13
+ {
14
+ $ this ->browse (function (Browser $ browser ) {
15
+ $ users = User::query ()
16
+ ->select (['id ' , 'name ' , 'email ' ])
17
+ ->orderBy ('name ' )
18
+ ->get ();
19
+
20
+ $ browser ->visit ('/users/eloquent ' )
21
+ ->assertSeeIn ('tr:first-child td:nth-child(2) ' , $ users ->get (0 )->email )
22
+ ->press ('@columns-dropdown ' )
23
+ ->press ('@toggle-column-email ' )
24
+ ->waitUntilMissingText ($ users ->get (0 )->email )
25
+ ->press ('@toggle-column-email ' )
26
+ ->waitForTextIn ('tr:first-child td:nth-child(2) ' , $ users ->get (0 )->email );
27
+ });
28
+ }
29
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Tests \Browser ;
4
+
5
+ use App \Models \User ;
6
+ use Laravel \Dusk \Browser ;
7
+ use Tests \DuskTestCase ;
8
+
9
+ class FilterTest extends DuskTestCase
10
+ {
11
+ /** @test */
12
+ public function it_can_use_select_filters ()
13
+ {
14
+ $ this ->browse (function (Browser $ browser ) {
15
+ User::orderBy ('name ' )->first ()->forceFill ([
16
+ 'language_code ' => 'en ' ,
17
+ ])->save ();
18
+
19
+ $ users = User::query ()
20
+ ->orderBy ('name ' )
21
+ ->get ();
22
+
23
+ $ firstDutchUser = $ users ->firstWhere ('language_code ' , 'nl ' );
24
+
25
+ $ browser ->visit ('/users/eloquent ' )
26
+ ->assertSeeIn ('tr:first-child td:nth-child(1) ' , $ users ->get (0 )->name )
27
+ ->press ('@filters-dropdown ' )
28
+ ->select ('language_code ' , 'nl ' )
29
+ ->waitUntilMissingText ($ users ->get (0 )->name )
30
+ ->assertSeeIn ('tr:first-child td:nth-child(1) ' , $ firstDutchUser ->name );
31
+ });
32
+ }
33
+ }
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<fieldset
3
3
:key =" `table-${name}`"
4
+ class =" min-w-0"
4
5
:class =" {'opacity-75': isVisiting}"
5
6
:disabled =" preventOverlappingRequests && isVisiting"
6
7
>
Original file line number Diff line number Diff line change 30
30
<button
31
31
v-for =" (searchInput, key) in searchInputs"
32
32
:key =" key"
33
- class ="
34
- text-left
35
- w-full
36
- px-4
37
- py-2
38
- text-sm text-gray-700
39
- hover:bg-gray-100 hover:text-gray-900
40
- "
33
+ class =" text-left w-full px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-gray-900"
41
34
role =" menuitem"
42
35
@click.prevent =" enableSearch(searchInput.key)"
43
36
>
Original file line number Diff line number Diff line change 46
46
47
47
<button
48
48
type =" button"
49
- class ="
50
- ml-4
51
- relative
52
- inline-flex
53
- flex-shrink-0
54
- h-6
55
- w-11
56
- border-2 border-transparent
57
- rounded-full
58
- cursor-pointer
59
- transition-colors
60
- ease-in-out
61
- duration-200
62
- focus:outline-none
63
- focus:ring-2
64
- focus:ring-offset-2
65
- focus:ring-light-blue-500
66
- "
49
+ class =" ml-4 relative inline-flex flex-shrink-0 h-6 w-11 border-2 border-transparent rounded-full cursor-pointer transition-colors ease-in-out duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-light-blue-500"
67
50
:class =" {
68
51
'bg-green-500': !column.hidden,
69
52
'bg-gray-200': column.hidden,
70
- 'cursor-not-allowed': !column.hidden && oneVisibleFilterLeft(),
71
53
}"
72
- :disabled =" !column.hidden && oneVisibleFilterLeft()"
73
54
:aria-pressed =" !column.hidden"
74
55
:aria-labelledby =" `toggle-column-${column.key}`"
75
56
:aria-describedby =" `toggle-column-${column.key}`"
83
64
'translate-x-5': !column.hidden,
84
65
'translate-x-0': column.hidden,
85
66
}"
86
- class ="
87
- inline-block
88
- h-5
89
- w-5
90
- rounded-full
91
- bg-white
92
- shadow
93
- transform
94
- ring-0
95
- transition
96
- ease-in-out
97
- duration-200
98
- "
67
+ class =" inline-block h-5 w-5 rounded-full bg-white shadow transform ring-0 transition ease-in-out duration-200"
99
68
/>
100
69
</button >
101
70
</li >
107
76
108
77
<script setup>
109
78
import ButtonWithDropdown from " ./ButtonWithDropdown.vue" ;
110
- import filter from " lodash-es/filter" ;
111
79
112
80
const props = defineProps ({
113
81
columns: {
@@ -125,10 +93,4 @@ const props = defineProps({
125
93
required: true ,
126
94
},
127
95
});
128
-
129
- function oneVisibleFilterLeft () {
130
- return filter (props .columns , (column ) => {
131
- return ! column .hidden ;
132
- }).length === 1 ;
133
- }
134
96
</script >
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<ButtonWithDropdown
3
3
placement =" bottom-end"
4
+ dusk =" filters-dropdown"
4
5
:active =" hasEnabledFilters"
5
6
>
6
7
<template #button >
38
39
<div class =" p-2" >
39
40
<select
40
41
v-if =" filter.type === 'select'"
42
+ :name =" filter.key"
41
43
:value =" filter.value"
42
- class ="
43
- block
44
- focus:ring-indigo-500 focus:border-indigo-500
45
- w-full
46
- shadow-sm
47
- sm:text-sm
48
- border-gray-300
49
- rounded-md
50
- "
44
+ class =" block focus:ring-indigo-500 focus:border-indigo-500 w-full shadow-sm sm:text-sm border-gray-300 rounded-md"
51
45
@change =" onFilterChange(filter.key, $event.target.value)"
52
46
>
53
47
<option
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div
3
- class ="
4
- w-full
5
- bg-gradient-to-r
6
- from-blue-50
7
- to-blue-100
8
- bg-white
9
- p-4
10
- mb-4
11
- rounded
12
- mt-4
13
- "
3
+ class =" w-full bg-gradient-to-r from-blue-50 to-blue-100 bg-white p-4 mb-4 rounded mt-4"
14
4
>
15
5
<div class =" flex flex-row space-x-4" >
16
6
<div class =" space-y-4" >
35
25
<input
36
26
:ref =" skipUnwrap.el"
37
27
:key =" searchInput.key"
38
- class ="
39
- block
40
- w-full
41
- sm:text-sm
42
- rounded-md
43
- shadow-sm
44
- focus:ring-indigo-500 focus:border-indigo-500
45
- border-gray-300
46
- "
28
+ class =" block w-full sm:text-sm rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 border-gray-300"
47
29
:value =" searchInput.value"
48
30
type =" text"
49
31
@input =" onChange(searchInput.key, $event.target.value)"
50
32
>
51
33
<div
52
- class ="
53
- absolute
54
- inset-y-0
55
- right-0
56
- pr-3
57
- flex
58
- items-center
59
- "
34
+ class =" absolute inset-y-0 right-0 pr-3 flex items-center"
60
35
>
61
36
<button
62
- class ="
63
- rounded-md
64
- text-gray-400
65
- hover:text-gray-500
66
- focus:outline-none
67
- focus:ring-2
68
- focus:ring-offset-2
69
- focus:ring-indigo-500
70
- "
37
+ class =" rounded-md text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500"
71
38
@click.prevent =" onRemove(searchInput.key)"
72
39
>
73
40
<span class =" sr-only" >Remove search</span >
You can’t perform that action at this time.
0 commit comments