71 lines
2.5 KiB
JavaScript
Vendored
71 lines
2.5 KiB
JavaScript
Vendored
/**
|
|
* First we will load all of this project's JavaScript dependencies which
|
|
* includes Vue and other libraries. It is a great starting point when
|
|
* building robust, powerful web applications using Vue and Laravel.
|
|
*/
|
|
|
|
require('./bootstrap');
|
|
|
|
window.Vue = require('vue');
|
|
import VueNestable from 'vue-nestable';
|
|
import vSelect from 'vue-select';
|
|
|
|
Vue.use(VueNestable);
|
|
/**
|
|
* The following block of code may be used to automatically register your
|
|
* Vue components. It will recursively scan this directory for the Vue
|
|
* components and automatically register them with their "basename".
|
|
*
|
|
* Eg. ./components/ExampleComponent.vue -> <example-component></example-component>
|
|
*/
|
|
|
|
// const files = require.context('./', true, /\.vue$/i)
|
|
// files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default))
|
|
|
|
Vue.component('folders-component', require('./components/FoldersComponent.vue').default);
|
|
Vue.component('edit-document', require('./components/EditDocumentComponent.vue').default);
|
|
Vue.component('add-document', require('./components/AddDocumentComponent.vue').default);
|
|
Vue.component('folder-select', require('./components/FoldersSelect.vue').default);
|
|
Vue.component('edit-user', require('./components/EditUserComponent.vue').default);
|
|
Vue.component('v-select', vSelect);
|
|
|
|
/* helper for directive click-outside */
|
|
function getClosest(elem, selector) {
|
|
for ( ; elem && elem !== document; elem = elem.parentNode) {
|
|
if (elem.matches( selector)) return elem
|
|
}
|
|
return null
|
|
}
|
|
/* Directives */
|
|
Vue.directive('click-outside', {
|
|
bind: function(el, binding) {
|
|
const bubble = binding.modifiers.bubble
|
|
const handler = (e) => {
|
|
// exlure les el avec data-click-outside="false" et input de vue2-dropzone
|
|
let exclude = getClosest(e.target, '[data-click-outside="false"], .dz-hidden-input');
|
|
if (bubble || (!el.contains(e.target) && el !== e.target && !exclude)) {
|
|
binding.value(e)
|
|
}
|
|
};
|
|
el.__vueClickOutside__ = handler;
|
|
// add Event Listeners
|
|
document.addEventListener('click', handler)
|
|
},
|
|
|
|
unbind: function(el) {
|
|
// Remove Event Listeners
|
|
document.removeEventListener('click', el.__vueClickOutside__);
|
|
el.__vueClickOutside__ = null
|
|
|
|
}
|
|
});
|
|
|
|
/**
|
|
* Next, we will create a fresh Vue application instance and attach it to
|
|
* the page. Then, you may begin adding components to this application
|
|
* or customize the JavaScript scaffolding to fit your unique needs.
|
|
*/
|
|
|
|
const app = new Vue({
|
|
el: '#app',
|
|
});
|