Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
### Unreleased

- Fix multiple-dependencies with non-scalar values

### 2.15.2

- Support drag and drop for array item
Expand Down
10 changes: 5 additions & 5 deletions src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,14 +179,14 @@ export class AbstractEditor {
if (!editor || !editor.dependenciesFulfilled || !value) {
this.dependenciesFulfilled = false
} else if (Array.isArray(choices)) {
this.dependenciesFulfilled = choices.some(choice => {
this.dependenciesFulfilled &&= choices.some(choice => {
if (JSON.stringify(value) === JSON.stringify(choice)) {
return true
}
})
} else if (typeof choices === 'object') {
if (typeof value !== 'object') {
this.dependenciesFulfilled = choices === value
this.dependenciesFulfilled &&= choices === value
} else {
Object.keys(choices).some(key => {
if (!hasOwnProperty(choices, key)) {
Expand All @@ -199,12 +199,12 @@ export class AbstractEditor {
})
}
} else if (typeof choices === 'string' || typeof choices === 'number') {
this.dependenciesFulfilled = this.dependenciesFulfilled && value === choices
this.dependenciesFulfilled &&= value === choices
} else if (typeof choices === 'boolean') {
if (choices) {
this.dependenciesFulfilled = this.dependenciesFulfilled && (value || value.length > 0)
this.dependenciesFulfilled &&= (value || value.length > 0)
} else {
this.dependenciesFulfilled = this.dependenciesFulfilled && (!value || value.length === 0)
this.dependenciesFulfilled &&= (!value || value.length === 0)
}
}
}
Expand Down