FIX: simplifies mini tag chooser events handling (#6252)
This commit is contained in:
parent
bfcf8ed61b
commit
da1d520d4c
|
@ -45,19 +45,15 @@ export default ComboBox.extend(Tags, {
|
|||
);
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this._super(...arguments);
|
||||
click(event) {
|
||||
if (event.target.tagName === "BUTTON") {
|
||||
const $button = $(event.target);
|
||||
|
||||
this.$(".selected-name").off("touchend.select-kit pointerup.select-kit");
|
||||
},
|
||||
|
||||
didInsertElement() {
|
||||
this._super(...arguments);
|
||||
|
||||
this.$(".selected-name").on(
|
||||
"touchend.select-kit pointerup.select-kit",
|
||||
() => this.focusFilterOrHeader()
|
||||
);
|
||||
if ($button.hasClass("selected-tag")) {
|
||||
this._destroyEvent(event);
|
||||
this.destroyTags(this.computeContentItem($button.attr("data-value")));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@computed("hasReachedMaximum")
|
||||
|
@ -74,37 +70,6 @@ export default ComboBox.extend(Tags, {
|
|||
return computedContent;
|
||||
},
|
||||
|
||||
didRender() {
|
||||
this._super();
|
||||
|
||||
this.$(".select-kit-body").on(
|
||||
"click.mini-tag-chooser",
|
||||
".selected-tag",
|
||||
event => {
|
||||
event.stopImmediatePropagation();
|
||||
this.destroyTags(
|
||||
this.computeContentItem($(event.target).attr("data-value"))
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
this.$(".select-kit-header").on(
|
||||
"focus.mini-tag-chooser",
|
||||
".selected-name",
|
||||
event => {
|
||||
event.stopImmediatePropagation();
|
||||
this.focus(event);
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
willDestroyElement() {
|
||||
this._super();
|
||||
|
||||
this.$(".select-kit-body").off("click.mini-tag-chooser");
|
||||
this.$(".select-kit-header").off("focus.mini-tag-chooser");
|
||||
},
|
||||
|
||||
// we are directly mutatings tags to define the current selection
|
||||
mutateValue() {},
|
||||
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
{{input class="selected-name" value=label readonly="readonly" tabindex="-1"}}
|
||||
|
||||
<span class="selected-name">{{label}}</span>
|
||||
{{d-icon caretIcon class="caret-icon"}}
|
||||
|
|
Loading…
Reference in New Issue