mirror of
https://github.com/tabler/tabler.git
synced 2025-12-22 09:54:24 +04:00
Apply eslint 🍪
This commit is contained in:
@@ -10,12 +10,11 @@ bs.init({
|
|||||||
'/dist': 'dist',
|
'/dist': 'dist',
|
||||||
'/libs': 'static/libs',
|
'/libs': 'static/libs',
|
||||||
'/img': 'static/img',
|
'/img': 'static/img',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
files: ['tmp/**/*', 'dist/css/*.css', 'dist/js/*.js'],
|
files: ['tmp/**/*', 'dist/css/*.css', 'dist/js/*.js'],
|
||||||
watchOptions: {
|
watchOptions: {
|
||||||
ignoreInitial: true
|
ignoreInitial: true,
|
||||||
},
|
},
|
||||||
notify: false
|
notify: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -4,18 +4,17 @@ const fs = require('fs'),
|
|||||||
path = require('path'),
|
path = require('path'),
|
||||||
yaml = require('yaml');
|
yaml = require('yaml');
|
||||||
|
|
||||||
const data = fs.readFileSync(path.resolve(__dirname, '../scss/fonts/_tabler-webfont.scss'), "utf8"),
|
const data = fs.readFileSync(path.resolve(__dirname, '../scss/fonts/_tabler-webfont.scss'), 'utf8'),
|
||||||
re = /\$icon-([^\-\s]+)-([^:\s]+):\s'([^'\n]+)';/g;
|
re = /\$icon-([^\-\s]+)-([^:\s]+):\s'([^'\n]+)';/g;
|
||||||
|
|
||||||
let items = {};
|
let items = {};
|
||||||
|
|
||||||
data.replace(re, function (match, g1, g2, g3) {
|
data.replace(re, function(match, g1, g2, g3) {
|
||||||
if(!items[g1]) {
|
if (!items[g1]) {
|
||||||
items[g1] = {};
|
items[g1] = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
items[g1][g2] = g3;
|
items[g1][g2] = g3;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
fs.writeFileSync('pages/_data/icons.yml', yaml.stringify(items));
|
fs.writeFileSync('pages/_data/icons.yml', yaml.stringify(items));
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ const plugins = [
|
|||||||
'createClass',
|
'createClass',
|
||||||
'inheritsLoose',
|
'inheritsLoose',
|
||||||
'defineProperty',
|
'defineProperty',
|
||||||
'objectSpread'
|
'objectSpread',
|
||||||
]
|
],
|
||||||
})
|
}),
|
||||||
];
|
];
|
||||||
|
|
||||||
const globals = {
|
const globals = {
|
||||||
'popper.js': 'Popper'
|
'popper.js': 'Popper',
|
||||||
};
|
};
|
||||||
|
|
||||||
if (BUNDLE) {
|
if (BUNDLE) {
|
||||||
@@ -43,10 +43,10 @@ const rollupConfig = {
|
|||||||
banner,
|
banner,
|
||||||
file: path.resolve(__dirname, `../dist/js/${fileDest}.js`),
|
file: path.resolve(__dirname, `../dist/js/${fileDest}.js`),
|
||||||
format: ESM ? 'esm' : 'umd',
|
format: ESM ? 'esm' : 'umd',
|
||||||
globals
|
globals,
|
||||||
},
|
},
|
||||||
external,
|
external,
|
||||||
plugins
|
plugins,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!ESM) {
|
if (!ESM) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
(function ($) {
|
(function($) {
|
||||||
$(document).ready(function () {
|
$(document).ready(function() {
|
||||||
|
$().peity &&
|
||||||
$().peity && $('[data-spark]').each(function () {
|
$('[data-spark]').each(function() {
|
||||||
const $this = $(this),
|
const $this = $(this),
|
||||||
data = $this.attr('data-spark'),
|
data = $this.attr('data-spark'),
|
||||||
color = $this.attr('data-spark-color') || 'blue',
|
color = $this.attr('data-spark-color') || 'blue',
|
||||||
@@ -14,11 +14,11 @@
|
|||||||
fillColor = tabler.colors[color];
|
fillColor = tabler.colors[color];
|
||||||
|
|
||||||
if (type === 'donut' || type === 'pie') {
|
if (type === 'donut' || type === 'pie') {
|
||||||
fillColor = [fillColor, tabler.hexToRgbA(fillColor, .1)];
|
fillColor = [fillColor, tabler.hexToRgbA(fillColor, 0.1)];
|
||||||
} else if (type === 'bar') {
|
} else if (type === 'bar') {
|
||||||
fillColor = [fillColor];
|
fillColor = [fillColor];
|
||||||
} else if (type === 'line') {
|
} else if (type === 'line') {
|
||||||
fillColor = tabler.hexToRgbA(fillColor, .1);
|
fillColor = tabler.hexToRgbA(fillColor, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$div.peity(type, {
|
$div.peity(type, {
|
||||||
@@ -29,24 +29,19 @@
|
|||||||
stroke: strokeColor,
|
stroke: strokeColor,
|
||||||
strokeWidth: 2,
|
strokeWidth: 2,
|
||||||
fill: fillColor,
|
fill: fillColor,
|
||||||
padding: .2,
|
padding: 0.2,
|
||||||
innerRadius: (type === 'donut') ? 17 : 0
|
innerRadius: type === 'donut' ? 17 : 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
charts default configuration
|
charts default configuration
|
||||||
*/
|
*/
|
||||||
if (window.Apex) {
|
if (window.Apex) {
|
||||||
|
const borderColor = 'rgba(0, 0, 0, 0.09)';
|
||||||
var borderColor = 'rgba(0, 0, 0, 0.09)';
|
const mutedColor = '#888e9a';
|
||||||
var mutedColor = '#888e9a';
|
|
||||||
|
|
||||||
window.Apex = {
|
window.Apex = {
|
||||||
chart: {
|
chart: {
|
||||||
@@ -56,11 +51,11 @@ if (window.Apex) {
|
|||||||
show: false,
|
show: false,
|
||||||
},
|
},
|
||||||
zoom: {
|
zoom: {
|
||||||
enabled: false
|
enabled: false,
|
||||||
},
|
},
|
||||||
animations: {
|
animations: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
grid: {
|
grid: {
|
||||||
@@ -71,8 +66,8 @@ if (window.Apex) {
|
|||||||
right: 0,
|
right: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
bottom: 0,
|
bottom: 0,
|
||||||
top: 0
|
top: 0,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
dataLabels: {
|
dataLabels: {
|
||||||
@@ -100,7 +95,7 @@ if (window.Apex) {
|
|||||||
|
|
||||||
fill: {
|
fill: {
|
||||||
type: 'solid',
|
type: 'solid',
|
||||||
opacity: 1
|
opacity: 1,
|
||||||
},
|
},
|
||||||
|
|
||||||
markers: {
|
markers: {
|
||||||
@@ -109,7 +104,7 @@ if (window.Apex) {
|
|||||||
radius: 2,
|
radius: 2,
|
||||||
hover: {
|
hover: {
|
||||||
size: 4,
|
size: 4,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
legend: {
|
legend: {
|
||||||
@@ -117,22 +112,22 @@ if (window.Apex) {
|
|||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
markers: {
|
markers: {
|
||||||
width: 8,
|
width: 8,
|
||||||
height: 8
|
height: 8,
|
||||||
},
|
},
|
||||||
itemMargin: {
|
itemMargin: {
|
||||||
horizontal: 0,
|
horizontal: 0,
|
||||||
vertical: 8
|
vertical: 8,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
title: {
|
title: {
|
||||||
style: {
|
style: {
|
||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
tooltip: {
|
tooltip: {
|
||||||
fillSeriesColor: false
|
fillSeriesColor: false,
|
||||||
},
|
},
|
||||||
|
|
||||||
xaxis: {
|
xaxis: {
|
||||||
@@ -140,27 +135,27 @@ if (window.Apex) {
|
|||||||
style: {
|
style: {
|
||||||
colors: mutedColor,
|
colors: mutedColor,
|
||||||
fontSize: '12px',
|
fontSize: '12px',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
enabled: false
|
enabled: false,
|
||||||
},
|
},
|
||||||
axisBorder: {
|
axisBorder: {
|
||||||
color: borderColor,
|
color: borderColor,
|
||||||
height: 0
|
height: 0,
|
||||||
},
|
},
|
||||||
axisTicks: {
|
axisTicks: {
|
||||||
show: true,
|
show: true,
|
||||||
height: 4,
|
height: 4,
|
||||||
color: borderColor
|
color: borderColor,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
yaxis: {
|
yaxis: {
|
||||||
show: false,
|
show: false,
|
||||||
labels: {
|
labels: {
|
||||||
show: false
|
show: false,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
44
js/tabler.js
44
js/tabler.js
@@ -1,5 +1,5 @@
|
|||||||
const tabler = {
|
const tabler = {
|
||||||
colorVariation: function (color, variation) {
|
colorVariation: function(color, variation) {
|
||||||
const colorValue = this.colors[color];
|
const colorValue = this.colors[color];
|
||||||
|
|
||||||
if (colorValue) {
|
if (colorValue) {
|
||||||
@@ -24,7 +24,7 @@ const tabler = {
|
|||||||
throw new Error('Wrong color: ' + color);
|
throw new Error('Wrong color: ' + color);
|
||||||
},
|
},
|
||||||
|
|
||||||
hexToRgbA: function (hex, opacity) {
|
hexToRgbA: function(hex, opacity) {
|
||||||
let c;
|
let c;
|
||||||
|
|
||||||
opacity = opacity || 1;
|
opacity = opacity || 1;
|
||||||
@@ -40,7 +40,7 @@ const tabler = {
|
|||||||
throw new Error('Bad Hex');
|
throw new Error('Bad Hex');
|
||||||
},
|
},
|
||||||
|
|
||||||
mixColors: function (color_1, color_2, weight) {
|
mixColors: function(color_1, color_2, weight) {
|
||||||
color_1 = color_1.substr(1);
|
color_1 = color_1.substr(1);
|
||||||
color_2 = color_2.substr(1);
|
color_2 = color_2.substr(1);
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ const tabler = {
|
|||||||
return parseInt(h, 16);
|
return parseInt(h, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
weight = (typeof(weight) !== 'undefined') ? weight : 50;
|
weight = typeof weight !== 'undefined' ? weight : 50;
|
||||||
|
|
||||||
let color = '#';
|
let color = '#';
|
||||||
|
|
||||||
@@ -72,10 +72,14 @@ const tabler = {
|
|||||||
return color;
|
return color;
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleFullscreen: function (elem) {
|
toggleFullscreen: function(elem) {
|
||||||
elem = elem || document.documentElement;
|
elem = elem || document.documentElement;
|
||||||
if (!document.fullscreenElement && !document.mozFullScreenElement &&
|
if (
|
||||||
!document.webkitFullscreenElement && !document.msFullscreenElement) {
|
!document.fullscreenElement &&
|
||||||
|
!document.mozFullScreenElement &&
|
||||||
|
!document.webkitFullscreenElement &&
|
||||||
|
!document.msFullscreenElement
|
||||||
|
) {
|
||||||
if (elem.requestFullscreen) {
|
if (elem.requestFullscreen) {
|
||||||
elem.requestFullscreen();
|
elem.requestFullscreen();
|
||||||
} else if (elem.msRequestFullscreen) {
|
} else if (elem.msRequestFullscreen) {
|
||||||
@@ -96,14 +100,13 @@ const tabler = {
|
|||||||
document.webkitExitFullscreen();
|
document.webkitExitFullscreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
$(document).ready(function () {
|
|
||||||
const $body = $('body');
|
const $body = $('body');
|
||||||
|
|
||||||
$body.on('click', '[data-toggle="sidebar"]', function (e) {
|
$body.on('click', '[data-toggle="sidebar"]', function(e) {
|
||||||
$body.toggleClass('sidebar-opened');
|
$body.toggleClass('sidebar-opened');
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@@ -113,37 +116,34 @@ $(document).ready(function () {
|
|||||||
$('[data-toggle="tooltip"]').tooltip();
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
$('[data-toggle="popover"]').popover();
|
$('[data-toggle="popover"]').popover();
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Autosize plugin
|
Autosize plugin
|
||||||
*/
|
*/
|
||||||
if(window.autosize) {
|
if (window.autosize) {
|
||||||
(function() {
|
(function() {
|
||||||
|
const $elem = $('[data-toggle="autosize"]');
|
||||||
var $elem = $('[data-toggle="autosize"]');
|
|
||||||
|
|
||||||
if ($elem) {
|
if ($elem) {
|
||||||
$elem.each(function() {
|
$elem.each(function() {
|
||||||
autosize($(this));
|
autosize($(this));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Imask plugin
|
Imask plugin
|
||||||
*/
|
*/
|
||||||
if(window.IMask) {
|
if (window.IMask) {
|
||||||
(function() {
|
(function() {
|
||||||
var $elem = $('[data-mask]');
|
const $elem = $('[data-mask]');
|
||||||
|
|
||||||
if ($elem) {
|
if ($elem) {
|
||||||
$elem.each(function() {
|
$elem.each(function() {
|
||||||
IMask($(this).get(0), {
|
IMask($(this).get(0), {
|
||||||
mask: $(this).attr('data-mask'),
|
mask: $(this).attr('data-mask'),
|
||||||
lazy: $(this).attr('data-mask-visible') === 'true'
|
lazy: $(this).attr('data-mask-visible') === 'true',
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
@@ -152,8 +152,8 @@ $(document).ready(function () {
|
|||||||
/**
|
/**
|
||||||
* Seelectize plugin
|
* Seelectize plugin
|
||||||
*/
|
*/
|
||||||
if(jQuery && jQuery().selectize) {
|
if (jQuery && jQuery().selectize) {
|
||||||
var $elem = $('[data-selectize]');
|
const $elem = $('[data-selectize]');
|
||||||
|
|
||||||
if ($elem) {
|
if ($elem) {
|
||||||
$elem.selectize();
|
$elem.selectize();
|
||||||
|
|||||||
Reference in New Issue
Block a user