This is a work in progress. ugh!
awcodes / filament-table-repeater Goto Github PK
View Code? Open in Web Editor NEWA modified version of the Filament Forms Repeater to display it as a table.
License: MIT License
A modified version of the Filament Forms Repeater to display it as a table.
License: MIT License
This is a work in progress. ugh!
When a table is given the ability to be orderable, there is an interesting bug where it overlays more than just the row that is being manipulated. It looks to be a distance below selection as some of the top selections do not experience the same issue.
I attempted with the standard Repeater, and it does not occur.
Any thoughts?
v3
v3.0.4
PHP 8.3
Forms\Components\Select::make('supplier_id')
->relationship('supplier', 'name')
->live()
->required(),
TableRepeater::make('purchaseOrderItems')
->headers([
Header::make('Product Name'),
Header::make('Quantity'),
Header::make('Unit Cost'),
])
->schema([
Forms\Components\Select::make('product_id')
->options(function (Forms\Get $get) {
return Product::where('supplier_id', $get('supplier_id'))->pluck('name', 'id');
})
->required(),
])
->columnSpan('full')
When the value of supplier_id changes it should get all Product that is connected to supplier_id but it seems that $get('supplier_id')
returns blank.
I should get the value of supplier_id
Forms\Components\Select::make('supplier_id')
->relationship('supplier', 'name')
->live()
->required(),
TableRepeater::make('purchaseOrderItems')
->headers([
Header::make('Product Name'),
Header::make('Quantity'),
Header::make('Unit Cost'),
])
->schema([
Forms\Components\Select::make('product_id')
->options(function (Forms\Get $get) {
return Product::where('supplier_id', $get('supplier_id'))->pluck('name', 'id');
})
->required(),
])
->columnSpan('full')
create a code similar to this
No response
No response
v3
v2.1
PHP 8.3
I could never get the headers() method to function as expected, decided to look into the source code to figure out what's happening.
In reference to the documentation, the table headers can be modified by passing an array of the desired headers to the headers() method. For example:
TableRepeater::make('product') ->headers(['Product Name', 'Quantity'])
However, it should be noted that the correct syntax involves including the field name as the key otherwise TableRepeater will simply use the default label of the fields.
TableRepeater::make('social') ->headers(['name' => 'Product Name', 'qty' -> 'Quantity'])
For the headers to work
Provide an array to the headers() method without specifying keys.
No response
No response
Since the latest version our table repeater broke.
See flare: https://flareapp.io/share/4m4B0RJ7
This is our repeater:
Tab::make('Producten')
->schema([
TableRepeater::make('products')
->relationship('orderItems')
->createItemButtonLabel('Regel toevoegen')
->label('')
->hideLabels()
->columnWidths([
'sku' => '150px',
'description1' => '350px',
'description2' => '350px',
'item_quantity' => '100px',
'price' => '100px',
'total_price' => '100px',
])
->schema([
xxxxxx
]),
previously i am using the v1.0.0 without the admin panel and it work as it should be except the select behaviour as reported in #3 , now i upgrade it to v1.0.2 and the style break as below
any workaround to fix this as it only happen if not using the admin panel
v3
3.0.4
8.3.6
Hello. I had an error with the alignment of the elements when I was selecting elements with a long and short name
Length of items should be static size
Here is the code:
private static function ingredientTab(): \Illuminate\Contracts\Support\Htmlable
{
return Tab::make('Ингредиенты')
->schema([
Section::make()
->schema([
TableRepeater::make('productIngredients')
->label('')
->relationship()
->headers([
Header::make('name'),
Header::make('required'),
])
->showLabels()
->renderHeader(false)
->schema([
Select::make('ingredient_id')
->label('')
->relationship('ingredient', 'name'),
Toggle::make('required')
->label('Обязательный'),
])
->defaultItems(0)
->addActionLabel('Добавить')
->columnSpan('full'),
])->maxWidth('full'),
]);
}
Problem in alignment of Select and Toggle components
No response
No response
v3
v2.0.2
PHP 8.2.4
When you have multiple TableRepeater
s component on the same form, it adds random elements to sibling repeaters.
See video.
I tried to use the ->key()
method but the problem persisted.
Items should be only added/removed to/from the repeater you are interacting with.
use Awcodes\FilamentTableRepeater\Components\TableRepeater;
use Coolsam\FilamentFlatpickr\Forms\Components\Flatpickr;
// ...
Forms\Components\Tabs\Tab::make('Schedule')
->schema([
TableRepeater::make('mondays')
->schema([
Flatpickr::make('start'),
Flatpickr::make('end'),
]),
TableRepeater::make('tuesdays')
->schema([
Flatpickr::make('start'),
Flatpickr::make('end'),
]),
TableRepeater::make('wednesdays')
->schema([
Flatpickr::make('start'),
Flatpickr::make('end'),
]),
TableRepeater::make('thursdays')
->schema([
Flatpickr::make('start'),
Flatpickr::make('end'),
]),
TableRepeater::make('fridays')
->schema([
Flatpickr::make('start'),
Flatpickr::make('end'),
]),
TableRepeater::make('saturdays')
->schema([
Flatpickr::make('start'),
Flatpickr::make('end'),
]),
TableRepeater::make('sundays')
->schema([
Flatpickr::make('start'),
Flatpickr::make('end'),
]),
])
->columns(3)
->columnSpanFull();
No response
No response
has-hidden-label
class makes the text Drag & Drop your files or Browse
dissapear.
Still have no time to investigate and open a PR. You might want to fix it? Thanks.
v3
v3
PHP 8.1
I have an issue with Break Down feature, the fields dont appear between 768px and 1024px if I set the following
->stackAt(MaxWidth::Large)
Greater than 1024px :
Labels to appear for each field.
1 - Setting the stackAt option:
->stackAt(MaxWidth::Large)
2- Changing the width of the browser .
3- Refresh Page.
No response
No response
v3
v2.0.0
PHP 8.1.0
"TagsInput" is not working correctly. Let's imagine the following scenario:
use Filament\Forms\Components;
use Awcodes\FilamentTableRepeater\Components\TableRepeater;
TableRepeater::make('preview')
->key('tablePreview')
->schema([
Components\TagsInput::make('grid_line')->disabled(),
Components\TagsInput::make('grid_columns'),
])
->default([]),
Basically, when adding new lines and adding tags, whenever you delete the first record, the next one becomes a duplicate, for example:
I ended up deleting the "Preto" line, but he ended up duplicating everything.
The expectation would be not to duplicate "Amarelo", 33 and 34. As in the example below:
Normally use "Tablet Repeater" together with "Tags Input".
use Filament\Forms\Form;
use Filament\Forms\Components;
use Awcodes\FilamentTableRepeater\Components\TableRepeater;
public static function form(Form $form): Form
{
return $form
->schema([
TableRepeater::make('preview')
->key('tablePreview')
->schema([
Components\TagsInput::make('grid_line')->disabled(),
Components\TagsInput::make('grid_columns'),
])
->default([]),
]);
}
Add two lines with any tags, then delete the first.
No response
No response
v3
v2.1
PHP 8.3
I received the following error when using TableRepeater 2.1 on Filament v 3.1 to v 3.2. Also tried this on a fresh install of Filament 3.1 and 3.2 and both returned the same error:
Livewire only supports one HTML element per component. Multiple root elements detected for component:
The temporary fix for now is to downgrade TableRepeater to 2.0 or use the default Filament Repeater.
TableRepeater 2.1 to work on Filament
Simply use TableRepeater with an eloquent relationship.
No response
No response
v3
v2.0.0
PHP 8.2
When using the new actions feature inside a table repeater:
Forms\Components\Actions::make([
Forms\Components\Actions\Action::make('resetStars')
->icon('heroicon-m-x-mark')
->color('danger')
->requiresConfirmation()
->action(function () {
}),
])
This breaks the repeater when using columnWidths(): Method Filament\Forms\Components\Actions::getName does not exist.
To render the action buttons.
Create a tablerepeater, use the columnWidths() method, and add this:
Forms\Components\Actions::make([
Forms\Components\Actions\Action::make('resetStars')
->icon('heroicon-m-x-mark')
->color('danger')
->requiresConfirmation()
->action(function () {
}),
])
No response
No response
v3
v3.0.2
PHP 8.1.27
ErrorException: Undefined array key 0 when creating a new Item:
Click on New:
Code:
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('field1'),
Forms\Components\TextInput::make('field2'),
Forms\Components\TextInput::make('field3'),
\Awcodes\TableRepeater\Components\TableRepeater::make('details')
->relationship('details')
->schema([
Forms\Components\TextInput::make('field4'),
Forms\Components\TextInput::make('field5'),
Forms\Components\TextInput::make('field6')
->hidden(fn (string $operation): bool => $operation === 'view'),
]),
]);
}
Migration:
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('purchase_orders', function (Blueprint $table) {
$table->id();
$table->string('field1');
$table->string('field2');
$table->string('field3');
$table->timestamps();
});
Schema::create('purchase_order_details', function (Blueprint $table) {
$table->id();
$table->foreignId('purchase_order_id');
$table->string('field4');
$table->string('field5');
$table->string('field6');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('purchase_order_details');
Schema::dropIfExists('purchase_orders');
}
Display the creation form
As explain above
No response
No response
v3
v3.0.0
8.3
The new version requires me to add headers, but if I have hidden inputs, they will break the layout. If I do not add a header, I will have an index out of range exception.
Add a hidden input
No response
No response
v3
v2.1.0
PHP 8.3.0
Using defaultItems(0)
will result in a Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization
error. A simple repeater will not issue this error and works as expected. The issue is resolved when using a custom label for each fields.
Expected an empty repeater in the create form.
I'm using this code
Section::make()->schema([
TableRepeater::make('projectSpNatures')
->relationship()
->columnSpan('full')
->schema([
Select::make('spNature_id')
->relationship('spNature', 'name')
->hiddenLabel(true)
->required(),
TextInput::make('budget')
->hiddenLabel(true)
->numeric(),
])
->defaultItems(0)
->cloneable()
->orderColumn('sort_order')
->mutateRelationshipDataBeforeSaveUsing(fn($record, $data) => $data['project_id'] = $record->project_id)
])
->hiddenOn(['view', 'edit']),
Adding a ->label("Custom label")
for each field will resolve the issue.
No response
No response
if we use the radio button or checkbox list,
and use hide labels then it is hiding the radios and checkboxes.
The solution is to change css slightly like
.filament-table-repeater-column.has-hidden-label label:not(.filament-forms-checkbox-list-component-option-label, .filament-forms-radio-component label)
{
/* css */
}
Thanks
So I have the table repeater in a slideover() based form. If i set the max items to 3, the add item button doesnt disappear until Ive added 3 items, then click it again and it finally disappears. Should disappear after the 3rd one is added dont you think and not until you try to add a 4th?
Now probably related and the biggest problem, but if click that 3 times and the button disappears and I do not add or save any data and then cancel/close the slideover, then reopen it, there are no items (which there shouldnt be because i didnt save any), but the Add Items button is missing.
v3
v2.0.0
PHP 8.10
The header is displayed white instead of dark grey.
This is caused by the opacity added to the background color in dark mode.
Besides this the rounding isn't working.
The table header being grey
Just a fresh install, with headers.
Then you see white headers.
No response
No response
v3
v3.0.2
PHP 8.3.0
When all "default" actions per row are disabled, the row-actions column is not shown. This means that the extraItemActions are not displayed.
The row actions column should be visible
TableRepeater::make('myItems')
->headers([...])
->schema([...])
->extraItemActions([
Action::make('someAction'),
])
->addable(false)
->reorderable(false)
->deletable(false)
No response
No response
Setting a defaultItems(1) with Filament v3 does not result in any default items. No errors, just no default items.
v3
2.1.0
8.3
Undefined variable $visibleExtraItemActions
It to work
install v2.1
No response
No response
v3
v2
8.1
Using a Form Select inside the repeater with a createOptionForm
, the created option is saved and associated with the repeater relationship but, after save, the select is cleared. Refreshing the page then shows the select value.
TableRepeater::make('clientContacts')
->label('Contacts')
->relationship()
->schema([
Forms\Components\Select::make('contact_id')
->relationship('contact', 'name')
->required()
->searchable()
->createOptionForm([
Forms\Components\TextInput::make('name')
->required(),
Forms\Components\TextInput::make('email')
->email(),
Forms\Components\TextInput::make('office_phone')
->tel(),
Forms\Components\TextInput::make('mobile_phone')
->tel()
])->createOptionModalHeading('Create Contact'),
Forms\Components\TextInput::make('description')
])
The expected behavior is that the select value would remain after saving.
In a form, add the TableRepeater referencing a relationship and within the TableRepeater schema, include a Select with a createOptionForm. Open an existing record that contains the TableRepeater and attempt to add a new relationship by clicking the suffix create action then save.
No response
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.