inicios del FrontEnd
This commit is contained in:
7
APP/plugins/README.md
Normal file
7
APP/plugins/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# PLUGINS
|
||||
|
||||
**This directory is not required, you can delete it if you don't want to use it.**
|
||||
|
||||
This directory contains Javascript plugins that you want to run before mounting the root Vue.js application.
|
||||
|
||||
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/plugins).
|
||||
40
APP/plugins/RTLPlugin.js
Normal file
40
APP/plugins/RTLPlugin.js
Normal file
@@ -0,0 +1,40 @@
|
||||
export default {
|
||||
install(Vue) {
|
||||
let app = new Vue({
|
||||
data() {
|
||||
return {
|
||||
isRTL: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
getDocClasses() {
|
||||
return document.body.classList;
|
||||
},
|
||||
enableRTL() {
|
||||
import('@/assets/sass/vendor/bootstrap-rtl.scss')
|
||||
this.isRTL = true;
|
||||
this.getDocClasses().add('rtl');
|
||||
this.getDocClasses().add('menu-on-right');
|
||||
this.toggleBootstrapRTL(true);
|
||||
},
|
||||
disableRTL() {
|
||||
this.isRTL = false;
|
||||
this.getDocClasses().remove('rtl');
|
||||
this.getDocClasses().remove('menu-on-right');
|
||||
this.toggleBootstrapRTL(false);
|
||||
},
|
||||
toggleBootstrapRTL(value) {
|
||||
for (let i = 0; i < document.styleSheets.length; i++) {
|
||||
let styleSheet = document.styleSheets[i];
|
||||
let { href } = styleSheet;
|
||||
if (href && href.endsWith('bootstrap-rtl.css')) {
|
||||
styleSheet.disabled = !value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Vue.prototype.$rtl = app;
|
||||
}
|
||||
};
|
||||
37
APP/plugins/dashboard-plugin.js
Executable file
37
APP/plugins/dashboard-plugin.js
Executable file
@@ -0,0 +1,37 @@
|
||||
/*!
|
||||
|
||||
=========================================================
|
||||
* Nuxt Black Dashboard - v1.0.0
|
||||
=========================================================
|
||||
|
||||
* Product Page: https://www.creative-tim.com/product/nuxt-black-dashboard-pro
|
||||
* Copyright 2020 Creative Tim (https://www.creative-tim.com)
|
||||
|
||||
* Coded by Creative Tim
|
||||
|
||||
=========================================================
|
||||
|
||||
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
*/
|
||||
// Polyfills for js features used in the Dashboard but not supported in some browsers (mainly IE)
|
||||
import Vue from 'vue'
|
||||
import './extra/polyfills';
|
||||
// Notifications plugin. Used on Notifications page
|
||||
import Notifications from '@/components/NotificationPlugin';
|
||||
// A plugin file where you could register global components used across the app
|
||||
import './globalComponents';
|
||||
// A plugin file where you could register global directives
|
||||
import './globalDirectives';
|
||||
// Sidebar on the right. Used as a local plugin in DashboardLayout.vue
|
||||
import SideBar from '@/components/SidebarPlugin';
|
||||
// RTL (right to left plugin to support rtl layout). If you don't need support for rtl, remove this plugin
|
||||
import RTLPlugin from './RTLPlugin';
|
||||
|
||||
// element ui language configuration
|
||||
import lang from 'element-ui/lib/locale/lang/en';
|
||||
import locale from 'element-ui/lib/locale';
|
||||
locale.use(lang);
|
||||
|
||||
Vue.use(RTLPlugin);
|
||||
Vue.use(SideBar);
|
||||
Vue.use(Notifications);
|
||||
15
APP/plugins/directives/click-ouside.js
Normal file
15
APP/plugins/directives/click-ouside.js
Normal file
@@ -0,0 +1,15 @@
|
||||
export default {
|
||||
bind: function(el, binding, vnode) {
|
||||
el.clickOutsideEvent = function(event) {
|
||||
// here I check that click was outside the el and his childrens
|
||||
if (!(el == event.target || el.contains(event.target))) {
|
||||
// and if it did, call method provided in attribute value
|
||||
vnode.context[binding.expression](event);
|
||||
}
|
||||
};
|
||||
document.body.addEventListener('click', el.clickOutsideEvent);
|
||||
},
|
||||
unbind: function(el) {
|
||||
document.body.removeEventListener('click', el.clickOutsideEvent);
|
||||
}
|
||||
};
|
||||
96
APP/plugins/extra/polyfills.js
Normal file
96
APP/plugins/extra/polyfills.js
Normal file
@@ -0,0 +1,96 @@
|
||||
/* eslint-disable */
|
||||
import 'es6-promise/auto'
|
||||
|
||||
export default (function initPollyFills () {
|
||||
if (!Array.prototype.find) {
|
||||
Object.defineProperty(Array.prototype, 'find', {
|
||||
value: function (predicate) {
|
||||
// 1. Let O be ? ToObject(this value).
|
||||
if (this == null) {
|
||||
throw new TypeError('"this" is null or not defined');
|
||||
}
|
||||
|
||||
var o = Object(this);
|
||||
|
||||
// 2. Let len be ? ToLength(? Get(O, "length")).
|
||||
var len = o.length >>> 0;
|
||||
|
||||
// 3. If IsCallable(predicate) is false, throw a TypeError exception.
|
||||
if (typeof predicate !== 'function') {
|
||||
throw new TypeError('predicate must be a function');
|
||||
}
|
||||
|
||||
// 4. If thisArg was supplied, let T be thisArg; else let T be undefined.
|
||||
var thisArg = arguments[1];
|
||||
|
||||
// 5. Let k be 0.
|
||||
var k = 0;
|
||||
|
||||
// 6. Repeat, while k < len
|
||||
while (k < len) {
|
||||
// a. Let Pk be ! ToString(k).
|
||||
// b. Let kValue be ? Get(O, Pk).
|
||||
// c. Let testResult be ToBoolean(? Call(predicate, T, « kValue, k, O »)).
|
||||
// d. If testResult is true, return kValue.
|
||||
var kValue = o[k];
|
||||
if (predicate.call(thisArg, kValue, k, o)) {
|
||||
return kValue;
|
||||
}
|
||||
// e. Increase k by 1.
|
||||
k++;
|
||||
}
|
||||
|
||||
// 7. Return undefined.
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (typeof Object.assign !== 'function') {
|
||||
// Must be writable: true, enumerable: false, configurable: true
|
||||
Object.defineProperty(Object, "assign", {
|
||||
value: function assign (target, varArgs) { // .length of function is 2
|
||||
'use strict';
|
||||
if (target == null) { // TypeError if undefined or null
|
||||
throw new TypeError('Cannot convert undefined or null to object');
|
||||
}
|
||||
|
||||
var to = Object(target);
|
||||
|
||||
for (var index = 1; index < arguments.length; index++) {
|
||||
var nextSource = arguments[index];
|
||||
|
||||
if (nextSource != null) { // Skip over if undefined or null
|
||||
for (var nextKey in nextSource) {
|
||||
// Avoid bugs when hasOwnProperty is shadowed
|
||||
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
||||
to[nextKey] = nextSource[nextKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return to;
|
||||
},
|
||||
writable: true,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
if (!String.prototype.startsWith) {
|
||||
String.prototype.startsWith = function(search, pos) {
|
||||
return this.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
|
||||
};
|
||||
}
|
||||
if (!String.prototype.includes) {
|
||||
String.prototype.includes = function(search, start) {
|
||||
'use strict';
|
||||
if (typeof start !== 'number') {
|
||||
start = 0;
|
||||
}
|
||||
|
||||
if (start + search.length > this.length) {
|
||||
return false;
|
||||
} else {
|
||||
return this.indexOf(search, start) !== -1;
|
||||
}
|
||||
};
|
||||
}
|
||||
}())
|
||||
20
APP/plugins/globalComponents.js
Executable file
20
APP/plugins/globalComponents.js
Executable file
@@ -0,0 +1,20 @@
|
||||
import Vue from 'vue'
|
||||
import BaseInput from '@/components/Inputs/BaseInput.vue';
|
||||
import BaseDropdown from '@/components/BaseDropdown.vue';
|
||||
import Card from '@/components/Cards/Card.vue';
|
||||
import BaseButton from '@/components/BaseButton.vue';
|
||||
import BaseCheckbox from '@/components/Inputs/BaseCheckbox.vue';
|
||||
import { Input, InputNumber, Tooltip, Popover } from 'element-ui';
|
||||
/**
|
||||
* You can register global components here and use them as a plugin in your main Vue instance
|
||||
*/
|
||||
|
||||
Vue.component(BaseInput.name, BaseInput);
|
||||
Vue.component(BaseDropdown.name, BaseDropdown);
|
||||
Vue.component(Card.name, Card);
|
||||
Vue.component(BaseCheckbox.name, BaseCheckbox);
|
||||
Vue.component(BaseButton.name, BaseButton);
|
||||
Vue.component(Input.name, Input);
|
||||
Vue.component(InputNumber.name, InputNumber);
|
||||
Vue.use(Tooltip);
|
||||
Vue.use(Popover);
|
||||
7
APP/plugins/globalDirectives.js
Executable file
7
APP/plugins/globalDirectives.js
Executable file
@@ -0,0 +1,7 @@
|
||||
import Vue from 'vue'
|
||||
import clickOutside from './directives/click-ouside.js';
|
||||
|
||||
/**
|
||||
* You can register global directives here and use them as a plugin in your main Vue instance
|
||||
*/
|
||||
Vue.directive('click-outside', clickOutside);
|
||||
Reference in New Issue
Block a user