-
Notifications
You must be signed in to change notification settings - Fork 164
Fix dynamic select get value an object #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
a58a12a
5457920
769261a
a98ae62
834c136
66b9f95
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,14 +33,18 @@ | |
} | ||
}, | ||
|
||
created() { | ||
Nova.$on('nova-dependency-container-' + this.field.attribute, this.dependencyChange) | ||
}, | ||
|
||
methods: { | ||
|
||
registerDependencyWatchers(root) { | ||
root.$children.forEach(component => { | ||
if (this.componentIsDependency(component)) { | ||
|
||
component.$watch('value', (value) => { | ||
this.dependencyValues[component.field.attribute] = value; | ||
this.dependencyValues[component.field.attribute] = (typeof value === 'object' ? value.value : value); | ||
this.updateDependencyStatus() | ||
}, {immediate: true}) | ||
|
||
|
@@ -73,7 +77,7 @@ | |
return; | ||
} | ||
|
||
if(dependency.hasOwnProperty('value') && this.dependencyValues[dependency.field] !== dependency.value) { | ||
if(dependency.hasOwnProperty('value') && this.dependencyValues[dependency.field] != dependency.value) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I would say this change would be good, since first you as a dev should know what the value is that you are checking against, but also there are some odd type behaviors in JS that I don't think we want to mess with. |
||
this.dependenciesSatisfied = false; | ||
return; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,12 +92,14 @@ protected function applyRulesForChildFields($childField) | |
*/ | ||
public function validateFields() { | ||
$availableFields = []; | ||
foreach ($this->action()->fields() as $field) { | ||
if ($field instanceof NovaDependencyContainer) { | ||
$availableFields[] = $field; | ||
$this->extractChildFields($field->meta['fields']); | ||
} else { | ||
$availableFields[] = $field; | ||
if (!is_null($this->action()->fields())) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How would the action fields ever be null? That's not the method signature of the method that returns fields and is more likely a problem with not following that method signature over a bug. That being said, do you have an example of this being an issue? |
||
foreach ($this->action()->fields() as $field) { | ||
if ($field instanceof NovaDependencyContainer) { | ||
$availableFields[] = $field; | ||
$this->extractChildFields($field->meta['fields']); | ||
} else { | ||
$availableFields[] = $field; | ||
} | ||
} | ||
} | ||
|
||
|
@@ -109,4 +111,4 @@ public function validateFields() { | |
return $field->getCreationRules($this); | ||
})->all()); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this accomplish?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it used for another components to call this component field