Merge remote-tracking branch 'origin/master'

This commit is contained in:
MattMo 2023-07-08 09:48:09 -07:00
commit 8670aca627

View File

@ -965,9 +965,40 @@ class IgniteTemplate {
return null; return null;
} }
}); });
} else if (value) { } else if (Array.isArray(value) && value.length > 0 && value[0] instanceof IgniteProperty) {
this.attribute("disabled", "disabled"); //There must be a converter for this to work correctly
this.class("disabled"); if (!converter) {
throw "Cannot pass an array of properties without using a converter!";
}
//Attack a callback for all the properties
value.forEach(prop => {
if (prop instanceof IgniteProperty) {
let updateDisabled = () => {
this.onAttributeChanged("disabled", converter(...value.getPropertyValues()) ? "disabled" : null);
this.onClassChanged("disabled", converter(...value.getPropertyValues()) ? "disabled" : null);
}
this._callbacks.push(prop.attachOnChange((oldValue, newValue) => updateDisabled()));
this._callbacks.push(prop.attachOnPush((list, items) => updateDisabled()));
this._callbacks.push(prop.attachOnUnshift((list, items) => updateDisabled()));
this._callbacks.push(prop.attachOnPop((list) => updateDisabled()));
this._callbacks.push(prop.attachOnShift((list) => updateDisabled()));
this._callbacks.push(prop.attachOnSplice((list, start, deleteCount, items) => updateDisabled()));
}
});
if (converter(...value.getPropertyValues())) {
this.attribute("disabled", "disabled");
this.class("disabled");
}
} else {
value = converter ? converter(value) : value;
if (value) {
this.attribute("disabled", "disabled");
this.class("disabled");
}
} }
return this; return this;