salix/front/salix/components/descriptor-popover/index.js

31 lines
741 B
JavaScript

import ngModule from '../../module';
import Popover from 'core/components/popover';
import './style.scss';
export default class DescriptorPopover extends Popover {
show(parent, id) {
if (!id) return;
super.show(parent);
this.id = id;
this.descriptor = this.content.querySelector('.vn-descriptor').$ctrl;
this.descriptor.load(id)
.then(() => this.$.$applyAsync(() => this.relocate()));
}
hide() {
super.hide();
this.id = null;
this.descriptor = null;
}
}
ngModule.vnComponent('vnDescriptorPopover', {
slotTemplate: require('./index.html'),
controller: DescriptorPopover,
transclude: {
descriptor: '?slotDescriptor'
}
});