Files
cms_thermo_active/Step/wwwroot/src/modules/base-components/modal-container.ts
T
Paolo Possanzini 013f564374 fix job-editor
2018-09-27 17:07:21 +02:00

39 lines
955 B
TypeScript

import { Factory, MessageService } from "src/_base";
export default {
computed: {
isVisible: function () {
return this.currentView != null;
}
},
props: {
containerName: { default: "modal" },
informHmi: { default: true }
},
data: function () {
return {
currentView: null,
deferred: null,
model: null,
};
},
created() {
Factory.Get(MessageService).subscribeToChannel("show-" + this.containerName, args => {
if (this.informHmi)
Factory.Get(MessageService).publishToChannel("HMI-show-modal");
this.currentView = args[0];
if (args[1])
this.deferred = args[1];
if (args[2])
this.model = args[2];
});
Factory.Get(MessageService).subscribeToChannel("hide-" + this.containerName, args => {
if (this.informHmi)
Factory.Get(MessageService).publishToChannel("HMI-hide-modal", 300);
this.currentView = null;
});
}
};