2 class EntitySelectorPopup {
6 window.EntitySelectorPopup = this;
11 this.selectButton = elem.querySelector('.entity-link-selector-confirm');
12 this.selectButton.addEventListener('click', this.onSelectButtonClick.bind(this));
14 window.$events.listen('entity-select-change', this.onSelectionChange.bind(this));
15 window.$events.listen('entity-select-confirm', this.onSelectionConfirm.bind(this));
19 this.callback = callback;
20 this.elem.components.overlay.show();
24 this.elem.components.overlay.hide();
27 onSelectButtonClick() {
29 if (this.selection !== null && this.callback) this.callback(this.selection);
32 onSelectionConfirm(entity) {
34 if (this.callback && entity) this.callback(entity);
37 onSelectionChange(entity) {
38 this.selection = entity;
39 if (entity === null) {
40 this.selectButton.setAttribute('disabled', 'true');
42 this.selectButton.removeAttribute('disabled');
47 export default EntitySelectorPopup;