2018-07-10 13:35:43 +00:00
|
|
|
import ModalContainer from './ModalContainer';
|
2019-07-30 11:01:06 +00:00
|
|
|
import frappe from 'frappejs';
|
2018-07-10 13:35:43 +00:00
|
|
|
|
|
|
|
const Plugin = {
|
2019-07-30 11:01:06 +00:00
|
|
|
install(Vue) {
|
2018-07-10 13:35:43 +00:00
|
|
|
this.event = new Vue();
|
|
|
|
|
|
|
|
Vue.prototype.$modal = {
|
|
|
|
show(...args) {
|
2018-09-28 13:12:34 +00:00
|
|
|
return Plugin.modalContainer.add(...args);
|
2018-07-10 13:35:43 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
hide(id) {
|
|
|
|
Plugin.event.$emit('hide', id);
|
|
|
|
}
|
2019-07-30 11:01:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
frappe.showModal = Vue.prototype.$modal.show;
|
2018-07-10 13:35:43 +00:00
|
|
|
|
|
|
|
// create modal container
|
|
|
|
const div = document.createElement('div');
|
|
|
|
document.body.appendChild(div);
|
|
|
|
new Vue({ render: h => h(ModalContainer) }).$mount(div);
|
|
|
|
}
|
2019-07-30 11:01:06 +00:00
|
|
|
};
|
2018-07-10 13:35:43 +00:00
|
|
|
|
2019-07-30 11:01:06 +00:00
|
|
|
export default Plugin;
|