- Converting all to Typescript

- Installing 1.0.0.beta Quasar Upgrade
   - (Part 1 - Upgrade Components)
This commit is contained in:
Paolo Arena
2019-03-11 19:21:10 +01:00
parent bb3be0ec16
commit 74ecc4f278
46 changed files with 5986 additions and 0 deletions

5
src/boot/axios.ts Normal file
View File

@@ -0,0 +1,5 @@
import axios from 'axios'
export default ({ Vue }) => {
Vue.prototype.$axios = axios
}

5
src/boot/dialog.ts Normal file
View File

@@ -0,0 +1,5 @@
import Dialog from 'quasar'
export default ({ Vue }) => {
Vue.use(Dialog)
}

10
src/boot/dragula.ts Normal file
View File

@@ -0,0 +1,10 @@
import Vue from 'vue'
import { Vue2Dragula } from 'vue2-dragula'
export default ({ Vue }) => {
Vue.use(Vue2Dragula, {
logging: {
service: false // to only log methods in service (DragulaService)
}
})
}

View File

@@ -0,0 +1,7 @@
// import something here
import errorHandler from '../error-handler'
// leave the export, even if you don't use it
export default ({ app, router, Vue }) => {
// something to do
Vue.prototype.$errorHandler = errorHandler
}

View File

@@ -0,0 +1,8 @@
import globalroutines from '../globalroutines'
export default ({ app, router, store, Vue }) => {
// something to do
Vue.prototype.$globalroutines = globalroutines
}

89
src/boot/guard.ts Normal file
View File

@@ -0,0 +1,89 @@
// import something here
// leave the export, even if you don't use it
export default ({ app, router, store, Vue }) => {
// something to do
// ******************************************
// *** Per non permettere di accedere alle pagine in cui è necessario essere Loggati ! ***
// ******************************************
// Creates a `nextMiddleware()` function which not only
// runs the default `next()` callback but also triggers
// the subsequent Middleware function.
function nextFactory(context, middleware, index) {
const subsequentMiddleware = middleware[index]
// If no subsequent Middleware exists,
// the default `next()` callback is returned.
if (!subsequentMiddleware) return context.next
return (...parameters) => {
// Run the default Vue Router `next()` callback first.
context.next(...parameters)
// Then run the subsequent Middleware with a new
// `nextMiddleware()` callback.
const nextMiddleware = nextFactory(context, middleware, index + 1)
subsequentMiddleware({ ...context, next: nextMiddleware })
};
}
router.beforeEach((to, from, next) => {
if (to.meta.middleware) {
const middleware = Array.isArray(to.meta.middleware)
? to.meta.middleware
: [to.meta.middleware];
const context = {
from,
next,
router,
to,
};
const nextMiddleware = nextFactory(context, middleware, 1)
return middleware[0]({ ...context, next: nextMiddleware })
}
return next()
})
/*router.beforeEach((to, from, next) => {
var accessToken = store.state.session.userSession.accessToken
// ESTANDO LOGEADO
if (accessToken) {
// SE PERMITE IR DE AREA PUBLICA A PRIVADA
if (!from.matched.some(record => record.meta.requiresAuth) && to.matched.some(record => record.meta.requiresAuth)) {
next()
}
// SE PERMITE IR DE UNA AREA PRIVADA A OTRA PRIVADA
if (from.matched.some(record => record.meta.requiresAuth) && to.matched.some(record => record.meta.requiresAuth)) {
next()
}
// NO SE PERMITE IR A UN AREA PUBLICA DESDE UN AREA PRIVADA
if (from.matched.some(record => record.meta.requiresAuth) && !to.matched.some(record => record.meta.requiresAuth)) {
next(false)
}
// SE REDIRIJE AL PANEL
if (!from.matched.some(record => record.meta.requiresAuth) && !to.matched.some(record => record.meta.requiresAuth)) {
next('/Panel')
}
// NO ESTA LOGEADO
} else {
// SE PERMITE IR DE UNA AREA PUBLICA A OTRA PUBLICA
if (!from.matched.some(record => record.meta.requiresAuth) && !to.matched.some(record => record.meta.requiresAuth)) {
next()
}
// SE PERMITE IR DE UNA AREA PRIVADA A UNA PUBLICA (LOGOUT)
if (from.matched.some(record => record.meta.requiresAuth) && !to.matched.some(record => record.meta.requiresAuth)) {
next()
}
// NO SE PERMITE IR DE UNA AREA PUBLICA A UNA PRIVADA
if (!from.matched.some(record => record.meta.requiresAuth) && to.matched.some(record => record.meta.requiresAuth)) {
// REDIRIGIR A LOGIN
next('/')
}
}
})*/
}

View File

@@ -0,0 +1,7 @@
// import something here
import { _LocalStorage } from '../local-storage'
// leave the export, even if you don't use it
export default ({ app, router, Vue }) => {
// something to do
Vue.prototype.$_localStorage = _LocalStorage
}

9
src/boot/myconfig.ts Normal file
View File

@@ -0,0 +1,9 @@
// import something here
import myconfig from '../myconfig'
// leave the export, even if you don't use it
export default ({ Vue }) => {
//Vue.use(myconfig);
// something to do
Vue.prototype.$myconfig = myconfig
}

5
src/boot/vee-validate.ts Normal file
View File

@@ -0,0 +1,5 @@
import VeeValidate from "vee-validate";
export default ({ Vue }) => {
Vue.use(VeeValidate, { inject: false })
}

45
src/boot/vue-i18n.ts Normal file
View File

@@ -0,0 +1,45 @@
// src/boot/vue-i18n.js
import VueI18n from 'vue-i18n'
import messages from '../statics/i18n'
import { tools } from '../store/Modules/tools'
export default ({ app, store, Vue }) => {
Vue.use(VueI18n)
// Vue.config.lang = process.env.LANG_DEFAULT;
let mylang = tools.getItemLS(tools.localStorage.lang)
if ((navigator) && (mylang === '')) {
mylang = navigator.language
// console.log(`LANG NAVIGATOR ${mylang}`)
}
if (mylang === '')
mylang = process.env.LANG_DEFAULT;
if (mylang.toLowerCase() === 'es-es')
mylang = 'es'
// console.log('MYLANG2=', mylang)
// console.log('process.env.LANG_DEFAULT=', process.env.LANG_DEFAULT)
Vue.config.lang = mylang
// import(`quasar/lang/${mylang}`).then(lang => {
// console.log(' ... LANGDEFAULT=', lang)
// this.$q.i18n.set(lang.default)
// import(`src/statics/i18n`).then(function () {
// })
// })
// console.log("PLUGINS INIT....");
// console.log("LANG_DEFAULT: ")
// console.log(process.env.LANG_DEFAULT)
// Set i18n instance on app
app.i18n = new VueI18n({
fallbackLocale: mylang,
locale: mylang,
messages
})
}

20
src/boot/vue-idb.ts Normal file
View File

@@ -0,0 +1,20 @@
import Vue from 'vue'
import VueIdb from 'vue-idb'
export default ({ Vue }) => {
Vue.use(VueIdb)
}
/*
export default new VueIdb({
version: 1,
database: 'test',
schemas: [
{ categories: '++_id, sub_categ_id, descr_it' }
]
})
*/

5
src/boot/vuelidate.ts Normal file
View File

@@ -0,0 +1,5 @@
import Vuelidate from 'vuelidate'
export default ({ Vue }) => {
Vue.use(Vuelidate)
}