chore(core): Do not add hide methods to options
This commit is contained in:
parent
07b814c254
commit
58c15f6c81
2 changed files with 0 additions and 51 deletions
|
@ -47,10 +47,6 @@ export function Design(config) {
|
|||
// Replace config.parts with the resolved config
|
||||
config.parts = parts
|
||||
|
||||
// Ensure all options have a hide() method and menu property
|
||||
config.options = completeOptions(config.options)
|
||||
|
||||
|
||||
const pattern = function (settings) {
|
||||
Pattern.call(this, config)
|
||||
|
||||
|
@ -67,25 +63,3 @@ export function Design(config) {
|
|||
return pattern
|
||||
}
|
||||
|
||||
/*
|
||||
* A default hide() method for options that lack it
|
||||
* As this always return false, the option will never be hidden
|
||||
*/
|
||||
const hide = () => false
|
||||
|
||||
/*
|
||||
* Helper method to add the default hide() method to options who lack one
|
||||
* as well as set the `menu` property to false (if it's missing)
|
||||
*/
|
||||
const completeOptions = options => {
|
||||
if (options) {
|
||||
for (const option in options) {
|
||||
if (typeof options[option] === 'object') {
|
||||
options[option] = { hide, menu: false, ...options[option] }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue