1
0
mirror of https://github.com/tabler/tabler.git synced 2025-12-22 01:44:25 +04:00

Apply eslint 🍪

This commit is contained in:
Damian Sznajder
2019-06-17 21:43:15 +02:00
parent 9febb4be53
commit 497f238fd4
5 changed files with 96 additions and 103 deletions

View File

@@ -10,12 +10,11 @@ bs.init({
'/dist': 'dist',
'/libs': 'static/libs',
'/img': 'static/img',
}
},
},
files: ['tmp/**/*', 'dist/css/*.css', 'dist/js/*.js'],
watchOptions: {
ignoreInitial: true
ignoreInitial: true,
},
notify: false
notify: false,
});

View File

@@ -4,7 +4,7 @@ const fs = require('fs'),
path = require('path'),
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;
let items = {};
@@ -17,5 +17,4 @@ data.replace(re, function (match, g1, g2, g3) {
items[g1][g2] = g3;
});
fs.writeFileSync('pages/_data/icons.yml', yaml.stringify(items));

View File

@@ -20,13 +20,13 @@ const plugins = [
'createClass',
'inheritsLoose',
'defineProperty',
'objectSpread'
]
})
'objectSpread',
],
}),
];
const globals = {
'popper.js': 'Popper'
'popper.js': 'Popper',
};
if (BUNDLE) {
@@ -43,10 +43,10 @@ const rollupConfig = {
banner,
file: path.resolve(__dirname, `../dist/js/${fileDest}.js`),
format: ESM ? 'esm' : 'umd',
globals
globals,
},
external,
plugins
plugins,
};
if (!ESM) {

View File

@@ -1,7 +1,7 @@
(function($) {
$(document).ready(function() {
$().peity && $('[data-spark]').each(function () {
$().peity &&
$('[data-spark]').each(function() {
const $this = $(this),
data = $this.attr('data-spark'),
color = $this.attr('data-spark-color') || 'blue',
@@ -14,11 +14,11 @@
fillColor = tabler.colors[color];
if (type === 'donut' || type === 'pie') {
fillColor = [fillColor, tabler.hexToRgbA(fillColor, .1)];
fillColor = [fillColor, tabler.hexToRgbA(fillColor, 0.1)];
} else if (type === 'bar') {
fillColor = [fillColor];
} else if (type === 'line') {
fillColor = tabler.hexToRgbA(fillColor, .1);
fillColor = tabler.hexToRgbA(fillColor, 0.1);
}
$div.peity(type, {
@@ -29,24 +29,19 @@
stroke: strokeColor,
strokeWidth: 2,
fill: fillColor,
padding: .2,
innerRadius: (type === 'donut') ? 17 : 0
padding: 0.2,
innerRadius: type === 'donut' ? 17 : 0,
});
});
});
})(jQuery);
/*
charts default configuration
*/
if (window.Apex) {
var borderColor = 'rgba(0, 0, 0, 0.09)';
var mutedColor = '#888e9a';
const borderColor = 'rgba(0, 0, 0, 0.09)';
const mutedColor = '#888e9a';
window.Apex = {
chart: {
@@ -56,11 +51,11 @@ if (window.Apex) {
show: false,
},
zoom: {
enabled: false
enabled: false,
},
animations: {
enabled: false,
}
},
},
grid: {
@@ -71,8 +66,8 @@ if (window.Apex) {
right: 0,
left: 0,
bottom: 0,
top: 0
}
top: 0,
},
},
dataLabels: {
@@ -100,7 +95,7 @@ if (window.Apex) {
fill: {
type: 'solid',
opacity: 1
opacity: 1,
},
markers: {
@@ -109,7 +104,7 @@ if (window.Apex) {
radius: 2,
hover: {
size: 4,
}
},
},
legend: {
@@ -117,22 +112,22 @@ if (window.Apex) {
fontSize: '14px',
markers: {
width: 8,
height: 8
height: 8,
},
itemMargin: {
horizontal: 0,
vertical: 8
vertical: 8,
},
},
title: {
style: {
fontSize: '14px',
}
},
},
tooltip: {
fillSeriesColor: false
fillSeriesColor: false,
},
xaxis: {
@@ -140,27 +135,27 @@ if (window.Apex) {
style: {
colors: mutedColor,
fontSize: '12px',
}
},
},
tooltip: {
enabled: false
enabled: false,
},
axisBorder: {
color: borderColor,
height: 0
height: 0,
},
axisTicks: {
show: true,
height: 4,
color: borderColor
}
color: borderColor,
},
},
yaxis: {
show: false,
labels: {
show: false
}
}
show: false,
},
},
};
}

View File

@@ -52,7 +52,7 @@ const tabler = {
return parseInt(h, 16);
}
weight = (typeof(weight) !== 'undefined') ? weight : 50;
weight = typeof weight !== 'undefined' ? weight : 50;
let color = '#';
@@ -74,8 +74,12 @@ const tabler = {
toggleFullscreen: function(elem) {
elem = elem || document.documentElement;
if (!document.fullscreenElement && !document.mozFullScreenElement &&
!document.webkitFullscreenElement && !document.msFullscreenElement) {
if (
!document.fullscreenElement &&
!document.mozFullScreenElement &&
!document.webkitFullscreenElement &&
!document.msFullscreenElement
) {
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.msRequestFullscreen) {
@@ -96,10 +100,9 @@ const tabler = {
document.webkitExitFullscreen();
}
}
}
},
};
$(document).ready(function() {
const $body = $('body');
@@ -113,21 +116,18 @@ $(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip();
$('[data-toggle="popover"]').popover();
/*
Autosize plugin
*/
if (window.autosize) {
(function() {
var $elem = $('[data-toggle="autosize"]');
const $elem = $('[data-toggle="autosize"]');
if ($elem) {
$elem.each(function() {
autosize($(this));
});
}
})();
}
@@ -136,14 +136,14 @@ $(document).ready(function () {
*/
if (window.IMask) {
(function() {
var $elem = $('[data-mask]');
const $elem = $('[data-mask]');
if ($elem) {
$elem.each(function() {
IMask($(this).get(0), {
mask: $(this).attr('data-mask'),
lazy: $(this).attr('data-mask-visible') === 'true'
})
lazy: $(this).attr('data-mask-visible') === 'true',
});
});
}
})();
@@ -153,7 +153,7 @@ $(document).ready(function () {
* Seelectize plugin
*/
if (jQuery && jQuery().selectize) {
var $elem = $('[data-selectize]');
const $elem = $('[data-selectize]');
if ($elem) {
$elem.selectize();