Skip to content

Commit

Permalink
add -- option ->isActiveFalseValue( $value )
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenix committed Jan 27, 2021
1 parent d47a2d8 commit cdf17f1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion resources/js/components/FormField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default {
id: node[this.field.idKey],
label: node[this.field.labelKey],
isDisabled: node.hasOwnProperty(this.field.activeKey)
&& node[this.field.activeKey] !== true,
&& node[this.field.activeKey] === this.field.isActiveFalse,
children: node.hasOwnProperty(this.field.childrenKey)
&& node[this.field.childrenKey].length > 0
? node[this.field.childrenKey]
Expand Down
10 changes: 10 additions & 0 deletions src/NestedTreeAttachManyField.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public function __construct($name, $attribute = null, $resource = null)
'disabled' => false,
'rtl' => false,
'maxHeight' => 500,
'isActiveFalse' => false
]);

/** @var Domain\Cache\Cache $requestCache */
Expand Down Expand Up @@ -172,6 +173,15 @@ public function withFlatten(bool $flatten): NestedTreeAttachManyField
return $this;
}

public function isActiveFalseValue( $value = false ): NestedTreeAttachManyField
{
$this->withMeta([
'isActiveFalse' => $value,
]);

return $this;
}

public function useSingleSelect(): NestedTreeAttachManyField
{
$this->withMeta([
Expand Down

0 comments on commit cdf17f1

Please sign in to comment.