Skip to content

Commit 70a7715

Browse files
committed
support v4-beta
1 parent 32317d7 commit 70a7715

File tree

12 files changed

+192
-95
lines changed

12 files changed

+192
-95
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ testbench.yaml
1212
vendor
1313
node_modules
1414
.php-cs-fixer.cache
15+
package-lock.json

README.md

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected function form(Form $form): Form
4848
->collapsible()
4949
->minItems(3)
5050
->maxItems(5)
51-
->columnSpan('full'),
51+
->columnSpanFull(),
5252

5353
]);
5454
}
@@ -119,28 +119,9 @@ protected function form(Form $form): Form
119119
}
120120
```
121121

122-
## Style customization
122+
## Alternative
123123

124-
Besides the `colStyles()` method mentioned above, we use few css classes to provide extra ability for style customization. These classes were so called CSS "hook" classes. They are prefixed with `it-`(short for `icetalker`, which is the vendor name). Although we already have hook classes in old version, it's never been documented here. And for now, we rename these hook name by the new prefix `it-`:
125-
126-
- `it-table-repeater` instead of `filament-table-repeater` in old version: As what you can tell from the class name, it allows you to customize the style for the whole table.
127-
- `it-table-repeater-cell-label` instead of `filament-table-repeater-header-cell` in old version: As what you can tell from the class name, it allows you to customize the style for the label of each column.
128-
- `it-table-repeater-cell` instead of `filament-table-repeater-tbody-cell` in old version: As what you can tell from the class name, it allows you to customize the style for the cell of each column.
129-
- `it-table-repeater-row`. This is new hook class, so that you can customize the style for each row.
130-
131-
You may add CSS to these classes in your `app.css` file, and filled with your own styles like this:
132-
133-
```css
134-
.it-table-repeater-cell-label {
135-
background-color: #fafafa;
136-
}
137-
```
138-
139-
## Testing
140-
141-
```bash
142-
composer test
143-
```
124+
Since Filament v4, `Reapeater` Component has it own `table()` method. You could use it to achieve the same function if you are using the latest version.
144125

145126
## Changelog
146127

composer.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717
}
1818
],
1919
"require": {
20-
"php": "^8.0",
21-
"filament/forms": "^3.0",
22-
"spatie/laravel-package-tools": "^1.9.2",
23-
"illuminate/contracts": "^8.6|^9.0|^10.0|^11.0|^12.0"
20+
"php": "~8.2",
21+
"filament/forms": "~4.0",
22+
"spatie/laravel-package-tools": "^1.9.2"
2423
},
2524
"require-dev": {
2625
"friendsofphp/php-cs-fixer": "^3.8",

config/filament-table-repeater.php

Lines changed: 0 additions & 5 deletions
This file was deleted.

dist/css/table-repeater.css

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"type": "module",
3+
"private": true,
4+
"scripts": {
5+
"build:css": "npx @tailwindcss/cli -i resources/css/table-repeater.css -o dist/css/table-repeater.css --postcss --minify",
6+
"build": "npm run build:css"
7+
},
8+
"devDependencies": {
9+
"@tailwindcss/forms": "^0.5.10",
10+
"@tailwindcss/typography": "^0.5.16",
11+
"autoprefixer": "^10.4.21",
12+
"postcss": "^8.5.6",
13+
"postcss-nesting": "^13.0.2",
14+
"tailwindcss": "^4.1.11"
15+
}
16+
}

post.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
plugins: {
3+
"tailwindcss/nesting": {},
4+
tailwindcss: {},
5+
autoprefixer: {},
6+
},
7+
};

resources/css/table-repeater.css

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
@import 'tailwindcss';
2+
3+
@custom-variant dark (&:where(.dark, .dark *));
4+
5+
.it-table-repeater {
6+
@apply bg-white border border-gray-200 shadow-sm rounded-xl relative dark:bg-gray-800 dark:border-gray-600;
7+
8+
& .it-table-repeater-header{
9+
@apply flex items-center h-10 overflow-hidden border-b border-gray-100 bg-gray-50 rounded-t-xl dark:bg-gray-800 dark:border-gray-700;
10+
11+
& :first-child{
12+
@apply flex-1;
13+
}
14+
15+
& > div {
16+
17+
& .it-table-repeater-btn-collapse{
18+
@apply flex items-center justify-center flex-none w-10 h-10 text-gray-400 transition hover:text-gray-300 dark:text-gray-400 dark:hover:text-gray-500;
19+
}
20+
}
21+
22+
}
23+
24+
& > div{
25+
& > table {
26+
@apply w-full text-left rtl:text-right table-auto mx-4;
27+
28+
29+
& > thead {
30+
& > tr {
31+
& > th {
32+
@apply p-2;
33+
}
34+
}
35+
}
36+
37+
& >tbody{
38+
& > tr {
39+
& > td {
40+
@apply px-1 py-2 align-top;
41+
}
42+
43+
& .it-table-repeater-actions{
44+
@apply flex items-center gap-x-3 py-2 px-1;
45+
}
46+
47+
}
48+
}
49+
}
50+
51+
& .it-table-repeater-collapsed {
52+
@apply p-2 text-xs text-center text-gray-400;
53+
}
54+
55+
}
56+
57+
& .it-table-repeater-add {
58+
@apply flex py-2 px-8
59+
}
60+
61+
}
62+
63+
.it-hidden{
64+
@apply hidden
65+
}

0 commit comments

Comments
 (0)