Skip to content

Commit b2c922b

Browse files
author
antoine
committed
Remove list collapsed item template
1 parent 444af63 commit b2c922b

File tree

4 files changed

+0
-49
lines changed

4 files changed

+0
-49
lines changed

docs/guide/form-fields/list.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -63,29 +63,6 @@ Default: false.
6363

6464
This is only useful when using the `WithSharpFormEloquentUpdater` trait. You can define here the name of an numerical order attribute (typically: `order`), and it will be automatically updated in the `save()` process.
6565

66-
### `setCollapsedItemInlineTemplate(string $template)`
67-
### `setCollapsedItemTemplatePath(string $template)`
68-
69-
The UI for a `sortable` List is to add a "reorder" button, which swaps the list in a readonly state. But for big List items it can be useful to define a special template for this reordering state.
70-
For inline template, just write the template as a string, using placeholders for data like this: `{{var}}`.
71-
72-
73-
Example:
74-
75-
```php
76-
$list->setCollapsedItemInlineTemplate(
77-
'Foreground: <strong>{{color}}</strong>'
78-
)
79-
```
80-
81-
For template path, give the relative path of a template file (stating in the views Laravel folder).
82-
The template will be [interpreted by Vue.js](https://vuejs.org/v2/guide/syntax.html), meaning you can add data placeholders, DOM structure but also directives, and anything that Vue will parse. For instance:
83-
84-
```vue
85-
<div v-if="show">result is {{value}}</div>
86-
<div v-else>result is unknown</div>
87-
```
88-
8966
### `setRemovable(bool $removable = true)`
9067

9168
Defines if items can be removed by the user.

src/Data/Form/Fields/FormListFieldData.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public function __construct(
2525
#[LiteralTypeScriptType('{ [key:string]: FormFieldData }')]
2626
public array $itemFields,
2727
public string $addText,
28-
public ?string $collapsedItemTemplate = null,
2928
public ?int $maxItemCount = null,
3029
public ?string $bulkUploadField = null,
3130
public ?int $bulkUploadLimit = null,

src/Form/Fields/SharpFormListField.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
class SharpFormListField extends SharpFormField
99
{
10-
use SharpFormFieldWithTemplates;
11-
1210
const FIELD_TYPE = 'list';
1311

1412
protected bool $addable = false;
@@ -103,20 +101,6 @@ public function setBulkUploadFileCountLimitAtOnce(int $limit): self
103101
return $this;
104102
}
105103

106-
public function setCollapsedItemInlineTemplate(string $collapsedItemInlineTemplate): self
107-
{
108-
$this->setInlineTemplate($collapsedItemInlineTemplate, 'item');
109-
110-
return $this;
111-
}
112-
113-
public function setCollapsedItemTemplatePath(string $collapsedItemTemplatePath): self
114-
{
115-
$this->setTemplatePath($collapsedItemTemplatePath, 'item');
116-
117-
return $this;
118-
}
119-
120104
public function addItemField(SharpFormField $field): self
121105
{
122106
$this->itemFields[] = $field;
@@ -178,7 +162,6 @@ public function toArray(): array
178162
'removable' => $this->removable,
179163
'sortable' => $this->sortable,
180164
'addText' => $this->addText ?? trans('sharp::form.list.add_button'),
181-
'collapsedItemTemplate' => $this->template('item'),
182165
'maxItemCount' => $this->maxItemCount,
183166
'bulkUploadField' => $this->allowBulkUpload ? $this->bulkUploadItemFieldKey : null,
184167
'bulkUploadLimit' => $this->bulkUploadFileCountLimit,

tests/Unit/Form/Fields/SharpFormListFieldTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,6 @@
9595
->toHaveKey('bulkUploadLimit', 8);
9696
});
9797

98-
it('allows to define collapsedItemInlineTemplate', function () {
99-
$formField = buildFakeListField()
100-
->setCollapsedItemInlineTemplate('template');
101-
102-
expect($formField->toArray())
103-
->toHaveKey('collapsedItemTemplate', 'template');
104-
});
105-
10698
it('allows to add an itemField', function () {
10799
$formField = buildFakeListField()
108100
->addItemField(

0 commit comments

Comments
 (0)