FEATURE: implements minimum selection for select-kit

This commit is contained in:
Joffrey JAFFEUX
2018-04-05 16:45:19 +02:00
committed by GitHub
parent cd6a99a027
commit f0fe16d824
15 changed files with 186 additions and 52 deletions

View File

@ -140,10 +140,23 @@ export default SelectKitComponent.extend({
},
computeHeaderContent() {
return {
let content = {
title: this.get("title"),
selection: this.get("selection")
};
if (this.get("noneLabel")) {
if (!this.get("hasSelection")) {
content.title = content.name = content.label = I18n.t(this.get("noneLabel"));
}
} else {
if (!this.get("hasReachedMinimum")) {
const key = this.get("minimumLabel") || "select_kit.min_content_not_reached";
content.title = content.name = content.label = I18n.t(key, { count: this.get("minimum") });
}
}
return content;
},
@computed("filter")
@ -154,7 +167,7 @@ export default SelectKitComponent.extend({
},
validateSelect() {
return this._super() && !this.get("hasReachedLimit");
return this._super() && !this.get("hasReachedMaximum");
},
@computed("computedValues.[]", "computedContent.[]")