From d47a2d86edc09fb51f7e474b3f9493281168bcf6 Mon Sep 17 00:00:00 2001 From: phoenix Date: Wed, 27 Jan 2021 17:11:02 +0300 Subject: [PATCH] add -- option withFlatten --- readme.md | 3 ++- src/NestedTreeAttachManyField.php | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 5f9efde..5270c33 100644 --- a/readme.md +++ b/readme.md @@ -61,7 +61,8 @@ Here are a few customization options - `->withPlaceholder(string $placeholder)` // - placeholder in tree select - `->withMaxHeight(int $maxHeight)` - `->withSortValueBy(string $sortBy)` // - @see https://vue-treeselect.js.org/#flat-mode-and-sort-values -- `->withAlwaysOpen(boot $alwaysOpen)` // - by default select is open, but you can change it behavior +- `->withAlwaysOpen(bool $alwaysOpen)` // - by default select is open, but you can change it behavior +- `->withFlatten(bool $flatten)` // - by default flatten is enabled, but you can change it behavior - `->useSingleSelect()` // - ability for select only one value diff --git a/src/NestedTreeAttachManyField.php b/src/NestedTreeAttachManyField.php index 5005e36..c0672ce 100644 --- a/src/NestedTreeAttachManyField.php +++ b/src/NestedTreeAttachManyField.php @@ -163,6 +163,15 @@ public function withSortValueBy(string $sortBy): NestedTreeAttachManyField return $this; } + public function withFlatten(bool $flatten): NestedTreeAttachManyField + { + $this->withMeta([ + 'flatten' => $flatten, + ]); + + return $this; + } + public function useSingleSelect(): NestedTreeAttachManyField { $this->withMeta([