feat(core): More granular hiding of parts
This adds new top-level part config settings: - hide: hides this part and only this part (not new) - hideDependencies: Do not hide this part, but hide its dependencies - hideAll: Hide both this part and its dependencies
This commit is contained in:
parent
c79aea43b9
commit
bf7926b98d
1 changed files with 12 additions and 1 deletions
|
@ -686,6 +686,10 @@ Pattern.prototype.resolveDependency = function (
|
||||||
|
|
||||||
/** Adds a part as a simple dependency **/
|
/** Adds a part as a simple dependency **/
|
||||||
Pattern.prototype.addDependency = function (name, part, dep) {
|
Pattern.prototype.addDependency = function (name, part, dep) {
|
||||||
|
if (part.hideDependencies || part.hideAll) {
|
||||||
|
dep.hide = true
|
||||||
|
dep.hideAll = true
|
||||||
|
}
|
||||||
this.dependencies[name] = mergeDependencies(dep.name, this.dependencies[name])
|
this.dependencies[name] = mergeDependencies(dep.name, this.dependencies[name])
|
||||||
if (typeof this.__parts[dep.name] === 'undefined') {
|
if (typeof this.__parts[dep.name] === 'undefined') {
|
||||||
this.__parts[dep.name] = decoratePartDependency(dep)
|
this.__parts[dep.name] = decoratePartDependency(dep)
|
||||||
|
@ -713,6 +717,10 @@ Pattern.prototype.preresolveDependencies = function (count=0) {
|
||||||
this.inject[name] = part.from.name
|
this.inject[name] = part.from.name
|
||||||
if (typeof this.__parts[part.from.name] === 'undefined') {
|
if (typeof this.__parts[part.from.name] === 'undefined') {
|
||||||
this.__parts[part.from.name] = decoratePartDependency(part.from)
|
this.__parts[part.from.name] = decoratePartDependency(part.from)
|
||||||
|
if (part.hideDependencies || part.hideAll) {
|
||||||
|
this.__parts[part.from.name].hide = true
|
||||||
|
this.__parts[part.from.name].hideAll = true
|
||||||
|
}
|
||||||
addPartConfig(this.__parts[part.from.name], this.config)
|
addPartConfig(this.__parts[part.from.name], this.config)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -806,7 +814,10 @@ Pattern.prototype.isHidden = function (partName) {
|
||||||
if (this.settings.only.includes(partName)) return false
|
if (this.settings.only.includes(partName)) return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return (this.__parts?.[partName]?.hide) ? true : false
|
if (this.__parts?.[partName]?.hide) return true
|
||||||
|
if (this.__parts?.[partName]?.hideAll) return true
|
||||||
|
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Determines whether a part is wanted by the user
|
/** Determines whether a part is wanted by the user
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue