From 1e14bc6e0bce15bd632667aa0cbc07255ab5dc03 Mon Sep 17 00:00:00 2001 From: Tim Jones Date: Sun, 25 Jan 2015 01:37:07 -0600 Subject: [PATCH] Merged templates into tc-grid.js and added 6to5 transpiler --- dist/tc-grid-templates.js | 1 - dist/tc-grid.css | 28 +-- dist/tc-grid.js | 470 ++++++++++++++++++-------------------- gulpfile.js | 96 +++++--- package.json | 12 +- src/js/tcGridDirective.js | 14 +- 6 files changed, 309 insertions(+), 312 deletions(-) delete mode 100644 dist/tc-grid-templates.js diff --git a/dist/tc-grid-templates.js b/dist/tc-grid-templates.js deleted file mode 100644 index 0ccada4..0000000 --- a/dist/tc-grid-templates.js +++ /dev/null @@ -1 +0,0 @@ -angular.module("tc-grid").run(["$templateCache", function($templateCache) {$templateCache.put("tcGrid.html","
\r\n
\r\n
\r\n
\r\n
\r\n %HEADER%\r\n
\r\n
\r\n
\r\n
\r\n %CHILDREN%\r\n
\r\n
\r\n \r\n
\r\n \r\n
1\">\r\n
\r\n {{(%OPTIONS%.paging.currentPage - 1) * %OPTIONS%.paging.pageSize + 1}}\r\n -\r\n {{%OPTIONS%.paging.currentPage === %OPTIONS%.internal.pageCount ? %OPTIONS%.paging.totalItemCount : %OPTIONS%.paging.currentPage * %OPTIONS%.paging.pageSize}}\r\n of\r\n {{%OPTIONS%.paging.totalItemCount}}\r\n
\r\n
\r\n {{%OPTIONS%.paging.currentPage}} / {{%OPTIONS%.internal.pageCount}}\r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n\r\n
");}]); \ No newline at end of file diff --git a/dist/tc-grid.css b/dist/tc-grid.css index 43254d0..6e7a4c5 100644 --- a/dist/tc-grid.css +++ b/dist/tc-grid.css @@ -28,13 +28,12 @@ } .tcGrid__scope .tc-grid .tc-style_table .tc-display_thead .tc-style_sort:after { margin-left: 5px; - font-family: FontAwesome; } .tcGrid__scope .tc-grid .tc-style_table .tc-display_thead .tc-style_sort.desc:after { - content: "\f0d7"; + content: "\25BC"; } .tcGrid__scope .tc-grid .tc-style_table .tc-display_thead .tc-style_sort.asc:after { - content: "\f0d8"; + content: "\25B2"; } .tcGrid__scope .tc-grid .tc-style_table .tc-display_tbody .tc-style_tr:nth-child(odd) { background-color: #f5f5f5; @@ -85,12 +84,6 @@ .tcGrid__scope .tc-grid .tc-display_table .tc-display_thead .tc-display_tr .tc-display_th { display: table-cell; } -.tcGrid__scope .tc-grid .tc-display_table .tc-display_thead .tc-display_tr .tc-display_sort.desc:after { - content: "\f0d7"; -} -.tcGrid__scope .tc-grid .tc-display_table .tc-display_thead .tc-display_tr .tc-display_sort.asc:after { - content: "\f0d8"; -} .tcGrid__scope .tc-grid .tc-display_table .tc-display_tbody { display: table-row-group; } @@ -130,13 +123,12 @@ } .tcGrid__scope .tc-grid_bootstrap .tc-style_table .tc-display_thead .tc-style_sort:after { margin-left: 5px; - font-family: FontAwesome; } .tcGrid__scope .tc-grid_bootstrap .tc-style_table .tc-display_thead .tc-style_sort.desc:after { - content: "\f0d7"; + content: "\25BC"; } .tcGrid__scope .tc-grid_bootstrap .tc-style_table .tc-display_thead .tc-style_sort.asc:after { - content: "\f0d8"; + content: "\25B2"; } .tcGrid__scope .tc-grid_bootstrap .tc-style_table .tc-display_tbody .tc-style_tr:nth-child(odd) { background-color: #ffffff; @@ -187,12 +179,6 @@ .tcGrid__scope .tc-grid_bootstrap .tc-display_table .tc-display_thead .tc-display_tr .tc-display_th { display: table-cell; } -.tcGrid__scope .tc-grid_bootstrap .tc-display_table .tc-display_thead .tc-display_tr .tc-display_sort.desc:after { - content: "\f0d7"; -} -.tcGrid__scope .tc-grid_bootstrap .tc-display_table .tc-display_thead .tc-display_tr .tc-display_sort.asc:after { - content: "\f0d8"; -} .tcGrid__scope .tc-grid_bootstrap .tc-display_table .tc-display_tbody { display: table-row-group; } @@ -214,12 +200,6 @@ .tcGrid__scope .tc-grid_bootstrap .tc-display_table .tc-display_thead .tc-display_tr .tc-display_th { display: table-cell; } -.tcGrid__scope .tc-grid_bootstrap .tc-display_table .tc-display_thead .tc-display_tr .tc-display_sort.desc:after { - content: "\f0d7"; -} -.tcGrid__scope .tc-grid_bootstrap .tc-display_table .tc-display_thead .tc-display_tr .tc-display_sort.asc:after { - content: "\f0d8"; -} .tcGrid__scope .tc-grid_bootstrap .tc-display_table .tc-display_tbody { display: table-row-group; } diff --git a/dist/tc-grid.js b/dist/tc-grid.js index 9b5c9dc..91b5657 100644 --- a/dist/tc-grid.js +++ b/dist/tc-grid.js @@ -1,251 +1,235 @@ +"use strict"; + (function () { - 'use strict'; - angular.module('tc-grid', []) - .directive('tcGrid', tcGrid) - .directive('tcGridColumn', tcGridColumn); + "use strict"; + var tcGrid = function ($parse, $templateCache) { + return { + restrict: "E", + compile: function (element, attrs, transclude) { + var children = element.children(); + + var headerHtml = ""; + + attrs.columns = []; + + angular.forEach(children, function (child, index) { + var el = angular.element(child); + + var colField = el.attr("tc-col-field"); + var colName = el.attr("tc-col-name") || colField || ""; + var sort = el.attr("tc-col-sort"); + var ignoreClick = el.attr("tc-ignore-click"); + var colClass = el.attr("tc-col-class"); + + var sortExpression = sort ? ",'" + sort + "'" : ""; + + var sortFn = ""; + + if (colField || sort) { + sortFn = " ng-click=\"" + attrs.tcGridOptions + ".internal.sort('" + (sort || colField) + "'" + sortExpression + ")\""; + attrs.columns.push(sort || colField); + } + + if (ignoreClick) el.attr("ng-click", "$event.stopPropagation();"); + + if (el.html() === "" && colField) el.html("{{row." + colField + "}}"); + + el.addClass(colClass || "tc-style_td"); + el.attr("tc-col-index", index + 1); + + headerHtml += "
" + colName + "
"; + }); + + var templateHtml = $templateCache.get("tcGrid.html"); + templateHtml = templateHtml.replace(/%OPTIONS%/g, attrs.tcGridOptions); + templateHtml = templateHtml.replace(/%HEADER%/g, headerHtml); + templateHtml = templateHtml.replace(/%DATA%/g, attrs.tcGridData); + templateHtml = templateHtml.replace(/%GRIDCLASS%/g, attrs.tcGridClass || "tc-grid"); + templateHtml = templateHtml.replace(/%ROWCLICK%/g, attrs.tcRowClick ? "ng-click=\"" + attrs.tcRowClick + "\"" : ""); + templateHtml = templateHtml.replace(/%FILTER%/g, attrs.tcGridFilter ? " | filter: " + attrs.tcGridFilter : ""); + templateHtml = templateHtml.replace(/%ROWCLASS%/g, attrs.tcRowClass || "tc-style_tr"); + templateHtml = templateHtml.replace(/%CHILDREN%/g, children.parent().html()); + + var template = angular.element(templateHtml); + + element.html(""); + element.append(template); - function tcGrid($parse, $templateCache) { return { - restrict: 'E', - compile: function (element, attrs, transclude) { - var children = element.children(); - - var headerHtml = ""; - - attrs.columns = []; - - angular.forEach(children, function (child, index) { - var el = angular.element(child); - - var colField = el.attr('tc-col-field'); - var colName = el.attr('tc-col-name') || colField || ''; - var sort = el.attr('tc-col-sort'); - var ignoreClick = el.attr('tc-ignore-click'); - var colClass = el.attr('tc-col-class'); - - var sortExpression = (sort) ? (',\'' + sort + '\'') : ''; - - var sortFn = ''; - - if (colField || sort) { - sortFn = ' ng-click="' + attrs.tcGridOptions + '.internal.sort(\'' + (sort || colField) + '\'' + sortExpression + ')"'; - attrs.columns.push(sort || colField); - } - - if (ignoreClick) - el.attr('ng-click', '$event.stopPropagation();'); - - if (el.html() === '' && colField) - el.html('{{row.' + colField + '}}'); - - el.addClass(colClass || 'tc-style_td'); - el.attr('tc-col-index', index + 1); - - headerHtml += '
' + colName + '
'; - }); - - var templateHtml = $templateCache.get('tcGrid.html'); - templateHtml = templateHtml.replace(/%OPTIONS%/g, attrs.tcGridOptions); - templateHtml = templateHtml.replace(/%HEADER%/g, headerHtml); - templateHtml = templateHtml.replace(/%DATA%/g, attrs.tcGridData); - templateHtml = templateHtml.replace(/%GRIDCLASS%/g, attrs.tcGridClass || 'tc-grid'); - templateHtml = templateHtml.replace(/%ROWCLICK%/g, attrs.tcRowClick ? 'ng-click="' + attrs.tcRowClick + '"' : ""); - templateHtml = templateHtml.replace(/%FILTER%/g, attrs.tcGridFilter ? ' | filter: ' + attrs.tcGridFilter : ""); - templateHtml = templateHtml.replace(/%ROWCLASS%/g, attrs.tcRowClass || 'tc-style_tr'); - templateHtml = templateHtml.replace(/%CHILDREN%/g, children.parent().html()); - - var template = angular.element(templateHtml); - - element.html(''); - element.append(template); - - return { - pre: function(scope, ele, attrs, ctrl) {}, - post: function(scope, element, attrs, ctrl) {} - }; - }, - controller: function($scope, $element, $attrs) { - var options = $parse($attrs.tcGridOptions)($scope); - - var watchInitialized = false; - - return init(); - - function init() { - initOptions(); - initWatch(); - - if (options) { - if (options.sorting.onSortChange) - sortChanged(); - else if (options.paging.onPageChange) - pageChanged(); - } - } - - function initOptions() { - if (!options) return; - - options.internal = { - pageCount: 1, - showFooter: false, - prev: prev, - next: next, - first: first, - last: last, - sort: sort, - columns: $attrs.columns - }; - - if (options.paging) - initPaging(); - - if (options.sorting) - initSort(); - } - - function initWatch() { - $scope.$watch($attrs.tcGridOptions, pageCountWatcher, true); - - function pageCountWatcher() { - if(!watchInitialized) { - watchInitialized = true; - return; - } - - options = $parse($attrs.tcGridOptions)($scope); - - if (options && options.paging) - getPageCount(); - } - } - - function initPaging() { - if (!options.paging.pageSize || options.paging.pageSize < 1) - options.paging.pageSize = 20; - - if (!options.paging.totalItemCount || options.paging.totalItemCount < 0) - options.paging.totalItemCount = 0; - - if (!options.paging.currentPage || options.paging.currentPage < 1) - options.paging.currentPage = 1; - - getPageCount(); - - options.internal.showFooter = true; - } - - function initSort() { - if(!options.sorting.sort) return; - - angular.forEach(options.sorting.sort, function (sortItem) { - var col = sortItem.split(' ')[0]; - var dir = sortItem.split(' ')[1] || 'asc'; - - var column = fetchColumn(col); - column.addClass(dir.toLowerCase()); - }); - } - - - function getPageCount() { - options.internal.pageCount = (options.paging.totalItemCount > 0) - ? Math.ceil(options.paging.totalItemCount / options.paging.pageSize) - : 0; - - if (options.internal.pageCount < 1) { - options.internal.pageCount = 1; - } - } - - function first() { - options.paging.currentPage = 1; - pageChanged(); - } - - function prev() { - options.paging.currentPage -= 1; - if (options.paging.currentPage < 1) { - options.paging.currentPage = 1; - } - pageChanged(); - } - - function next() { - options.paging.currentPage += 1; - if (options.paging.currentPage > options.internal.pageCount) { - options.paging.currentPage = options.internal.pageCount; - } - pageChanged(); - } - - function last() { - options.paging.currentPage = options.internal.pageCount; - pageChanged(); - } - - function pageChanged() { - if (options.paging.onPageChange) { - options.paging.onPageChange(options.paging.currentPage, options.paging.pageSize, options.sorting.sort); - } - } - - function sortChanged() { - if (options.sorting.onSortChange) { - if (options.paging) { - options.paging.currentPage = 1; - options.sorting.onSortChange(options.paging.currentPage, options.paging.pageSize, options.sorting.sort); - } else { - options.sorting.onSortChange(null, null, options.sorting.sort); - } - } - } - - function sort(field, expression) { - if (options.internal.columns.length === 0) - return; - - var col = fetchColumn(field); - - var direction = 'asc'; - - if (col.hasClass('asc')) - direction = 'desc'; - - cleanSortClasses(); - - col.addClass(direction); - - options.sorting.sort = [(expression || field) + ' ' + direction]; - - sortChanged(); - } - - function cleanSortClasses() { - angular.forEach(options.internal.columns, function (col) { - var colElement = fetchColumn(col); - colElement.removeClass('desc'); - colElement.removeClass('asc'); - }); - } - - function fetchColumn(name) { - var id = $attrs.tcGridOptions + '_' + name.replace(/\./g, ''); - return angular.element(document.getElementById(id)); - } + pre: function (scope, ele, attrs, ctrl) {}, + post: function (scope, element, attrs, ctrl) {} + }; + }, + controller: function ($scope, $element, $attrs) { + var init = function () { + initOptions(); + initWatch(); + + if (options) { + if (options.sorting.onSortChange) sortChanged();else if (options.paging.onPageChange) pageChanged(); + } + }; + + var initOptions = function () { + if (!options) return; + + options.internal = { + pageCount: 1, + showFooter: false, + prev: prev, + next: next, + first: first, + last: last, + sort: sort, + columns: $attrs.columns + }; + + if (options.paging) initPaging(); + + if (options.sorting) initSort(); + }; + + var initWatch = function () { + var pageCountWatcher = function () { + if (!watchInitialized) { + watchInitialized = true; + return; } + + options = $parse($attrs.tcGridOptions)($scope); + + if (options && options.paging) getPageCount(); + }; + + $scope.$watch($attrs.tcGridOptions, pageCountWatcher, true); }; + var initPaging = function () { + if (!options.paging.pageSize || options.paging.pageSize < 1) options.paging.pageSize = 20; - } + if (!options.paging.totalItemCount || options.paging.totalItemCount < 0) options.paging.totalItemCount = 0; - function tcGridColumn() { - return { - restrict: 'E', - require: '^tcGrid', - replace: true, - transclude: true, - template: "
" - }; - } -}()); + if (!options.paging.currentPage || options.paging.currentPage < 1) options.paging.currentPage = 1; + + getPageCount(); + + options.internal.showFooter = true; + }; + + var initSort = function () { + if (!options.sorting.sort) return; + + angular.forEach(options.sorting.sort, function (sortItem) { + var col = sortItem.split(" ")[0]; + var dir = sortItem.split(" ")[1] || "asc"; + + var column = fetchColumn(col); + column.addClass(dir.toLowerCase()); + }); + }; + + var getPageCount = function () { + options.internal.pageCount = options.paging.totalItemCount > 0 ? Math.ceil(options.paging.totalItemCount / options.paging.pageSize) : 0; + + if (options.internal.pageCount < 1) { + options.internal.pageCount = 1; + } + }; + + var first = function () { + options.paging.currentPage = 1; + pageChanged(); + }; + + var prev = function () { + options.paging.currentPage -= 1; + if (options.paging.currentPage < 1) { + options.paging.currentPage = 1; + } + pageChanged(); + }; + + var next = function () { + options.paging.currentPage += 1; + if (options.paging.currentPage > options.internal.pageCount) { + options.paging.currentPage = options.internal.pageCount; + } + pageChanged(); + }; + + var last = function () { + options.paging.currentPage = options.internal.pageCount; + pageChanged(); + }; + + var pageChanged = function () { + if (options.paging.onPageChange) { + options.paging.onPageChange(options.paging.currentPage, options.paging.pageSize, options.sorting.sort); + } + }; + + var sortChanged = function () { + if (options.sorting.onSortChange) { + if (options.paging) { + options.paging.currentPage = 1; + options.sorting.onSortChange(options.paging.currentPage, options.paging.pageSize, options.sorting.sort); + } else { + options.sorting.onSortChange(null, null, options.sorting.sort); + } + } + }; + + var sort = function (field, expression) { + if (options.internal.columns.length === 0) return; + + var col = fetchColumn(field); + + var direction = "asc"; + + if (col.hasClass("asc")) direction = "desc"; + + cleanSortClasses(); + + col.addClass(direction); + + options.sorting.sort = [(expression || field) + " " + direction]; + + sortChanged(); + }; + + var cleanSortClasses = function () { + angular.forEach(options.internal.columns, function (col) { + var colElement = fetchColumn(col); + colElement.removeClass("desc"); + colElement.removeClass("asc"); + }); + }; + + var fetchColumn = function (name) { + var id = $attrs.tcGridOptions + "_" + name.replace(/\./g, ""); + return angular.element(document.getElementById(id)); + }; + + var options = $parse($attrs.tcGridOptions)($scope); + + var watchInitialized = false; + + return init(); + } + }; + + }; + + var tcGridColumn = function () { + return { + restrict: "E", + require: "^tcGrid", + replace: true, + transclude: true, + template: "
" + }; + }; + + angular.module("tc-grid", []).directive("tcGrid", tcGrid).directive("tcGridColumn", tcGridColumn); +})(); +angular.module("tc-grid").run(["$templateCache", function($templateCache) {$templateCache.put("tcGrid.html","
\r\n
\r\n
\r\n
\r\n
\r\n %HEADER%\r\n
\r\n
\r\n
\r\n
\r\n %CHILDREN%\r\n
\r\n
\r\n \r\n
\r\n \r\n
1\">\r\n
\r\n {{(%OPTIONS%.paging.currentPage - 1) * %OPTIONS%.paging.pageSize + 1}}\r\n -\r\n {{%OPTIONS%.paging.currentPage === %OPTIONS%.internal.pageCount ? %OPTIONS%.paging.totalItemCount : %OPTIONS%.paging.currentPage * %OPTIONS%.paging.pageSize}}\r\n of\r\n {{%OPTIONS%.paging.totalItemCount}}\r\n
\r\n
\r\n {{%OPTIONS%.paging.currentPage}} / {{%OPTIONS%.internal.pageCount}}\r\n \r\n \r\n \r\n \r\n
\r\n
\r\n
\r\n
\r\n\r\n
");}]); \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 789d409..2418cc9 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -3,50 +3,82 @@ var del = require('del'); var concat = require('gulp-concat'); var less = require('gulp-less'); var templateCache = require('gulp-angular-templatecache'); -var debug = require('gulp-debug'); -var jsSrc = [ - "src/js/**/*.js" -]; -var templateSrc = [ - "src/templates/**/*.html" -]; -var lessSrc = [ - "src/less/**/*.less" +var to5 = require('gulp-6to5'); +var runSequence = require('run-sequence'); +var vinylPaths = require('vinyl-paths'); + +var config = { + src: { + watch: "src/**/*.*", + js: "src/js/**/*.js", + less: "src/less/**/*.less", + html: "src/templates/**/*.html" + }, + dist: { + base: "dist", + js: "tc-grid-directives.js", + less: "tc-grid.css", + html: "tc-grid-templates.js", + bundle: "tc-grid.js", + angularModule: "tc-grid" + } +}; + +var htmlBundle = [ + config.dist.base + "/" + config.dist.js, + config.dist.base + "/" + config.dist.html ]; -var distJs = [ - "dist/*.js" -] +function remove(files){ + del.sync(config.dist.base + "/**/" + files, { force: true }); +} -gulp.task('clean', function() { - del.sync("dest/**/*.*", { force: true }); +gulp.task('clean', function(done) { + remove('*.*'); + done(); }); -gulp.task('less-compile', ['clean'], function() { - gulp.src(lessSrc) - .pipe(concat('tc-grid.css')) +gulp.task('less-build', function() { + return gulp.src(config.src.less) + .pipe(concat(config.dist.less)) .pipe(less()) - .pipe(gulp.dest('dist/')) + .pipe(gulp.dest(config.dist.base)); }); -gulp.task('js-compile', ['clean'], function() { - gulp.src(jsSrc) - .pipe(concat('tc-grid.js')) - .pipe(gulp.dest('dist/')); +gulp.task('js-build', function() { + return gulp.src(config.src.js) + .pipe(concat(config.dist.js)) + .pipe(to5()) + .pipe(gulp.dest(config.dist.base)); }); -gulp.task('template-compile', function() { - gulp.src(templateSrc) - .pipe(templateCache('tc-grid-templates.js', {module: 'tc-grid'})) - .pipe(gulp.dest('dist/')); -}) +gulp.task('html-build', function() { + return gulp.src(config.src.html) + .pipe(templateCache(config.dist.html, {module: config.dist.angularModule})) + .pipe(gulp.dest(config.dist.base)); +}); + +gulp.task('html-merge', function(){ + return gulp.src(htmlBundle) + .pipe(concat(config.dist.bundle)) + .pipe(gulp.dest(config.dist.base)); +}); -gulp.task('compile', ['js-compile', 'template-compile'], function() { +gulp.task('html-clean', function(done){ + del.sync(htmlBundle, { force: true }); + done(); +}); +gulp.task('build', function(done) { + runSequence( + 'clean', + ['less-build','js-build'], + 'html-build', + 'html-merge', + 'html-clean', + done); }) -gulp.task('default', ['js-compile', 'less-compile'], function() { - gulp.watch(templateSrc, ['template-compile']) - gulp.watch(jsSrc, ['js-compile']) - gulp.watch(lessSrc, ['less-compile']) +gulp.task('default', ['build'], function() { + gulp.watch(config.src.watch, ['build']); }); \ No newline at end of file diff --git a/package.json b/package.json index ad92a51..7ef03ab 100644 --- a/package.json +++ b/package.json @@ -8,12 +8,14 @@ }, "author": "Third Corner", "license": "ISC", - "devDependencies": { + "devDependencies": { "del": "^0.1.3", "gulp": "^3.8.10", - "gulp-angular-templatecache": "^1.4.2", - "gulp-concat": "^2.4.2", - "gulp-debug": "^1.0.1", - "gulp-less": "^1.3.6" + "gulp-6to5": "^2.0.2", + "gulp-angular-templatecache": "^1.4.2", + "gulp-concat": "^2.4.2", + "gulp-less": "^1.3.6", + "run-sequence": "^1.0.2", + "vinyl-paths": "^1.0.0" } } diff --git a/src/js/tcGridDirective.js b/src/js/tcGridDirective.js index 08e6740..b4c544a 100644 --- a/src/js/tcGridDirective.js +++ b/src/js/tcGridDirective.js @@ -7,14 +7,14 @@ function tcGrid($parse, $templateCache) { return { restrict: 'E', - compile: function (element, attrs, transclude) { + compile: (element, attrs, transclude) => { var children = element.children(); var headerHtml = ""; attrs.columns = []; - angular.forEach(children, function (child, index) { + angular.forEach(children, (child, index) => { var el = angular.element(child); var colField = el.attr('tc-col-field'); @@ -60,11 +60,11 @@ element.append(template); return { - pre: function(scope, ele, attrs, ctrl) {}, - post: function(scope, element, attrs, ctrl) {} + pre: (scope, ele, attrs, ctrl) => {}, + post: (scope, element, attrs, ctrl) => {} }; }, - controller: function($scope, $element, $attrs) { + controller: ($scope, $element, $attrs) => { var options = $parse($attrs.tcGridOptions)($scope); var watchInitialized = false; @@ -138,7 +138,7 @@ function initSort() { if(!options.sorting.sort) return; - angular.forEach(options.sorting.sort, function (sortItem) { + angular.forEach(options.sorting.sort, (sortItem) => { var col = sortItem.split(' ')[0]; var dir = sortItem.split(' ')[1] || 'asc'; @@ -222,7 +222,7 @@ } function cleanSortClasses() { - angular.forEach(options.internal.columns, function (col) { + angular.forEach(options.internal.columns, col => { var colElement = fetchColumn(col); colElement.removeClass('desc'); colElement.removeClass('asc');